ADDED CCRegression/CommonCrypto/CCCryptorTestFuncs.c Index: CCRegression/CommonCrypto/CCCryptorTestFuncs.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CCCryptorTestFuncs.c @@ -0,0 +1,709 @@ +/* + * CCCryptorTestFuncs.c + * CCRegressions + * + * + */ + + +#include +#include "CCCryptorTestFuncs.h" +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" + + +CCCryptorStatus +CCCryptWithMode(CCOperation op, CCMode mode, CCAlgorithm alg, CCPadding padding, const void *iv, + const void *key, size_t keyLength, const void *tweak, size_t tweakLength, + int numRounds, CCModeOptions options, + const void *dataIn, size_t dataInLength, + void *dataOut, size_t dataOutAvailable, size_t *dataOutMoved) +#ifdef CRYPTORWITHMODE +{ + CCCryptorRef cref; + CCCryptorStatus retval; + size_t moved; + + if((retval = CCCryptorCreateWithMode(op, mode, alg, padding, iv, key, keyLength, tweak, tweakLength, numRounds, options, &cref)) != kCCSuccess) { + return retval; + } + + if((retval = CCCryptorUpdate(cref, dataIn, dataInLength, dataOut, dataOutAvailable, &moved)) != kCCSuccess) { + return retval; + } + + dataOut += moved; + dataOutAvailable -= moved; + *dataOutMoved = moved; + + if((retval = CCCryptorFinal(cref, dataOut, dataOutAvailable, &moved)) != kCCSuccess) { + return retval; + } + + *dataOutMoved += moved; + + CCCryptorRelease(cref); + + return kCCSuccess; +} +#else +{ + return kCCSuccess; +} +#endif + + + +CCCryptorStatus +CCMultiCrypt(CCOperation op, CCAlgorithm alg, CCOptions options, const void *key, size_t keyLength, const void *iv, const void *dataIn, size_t dataInLength, + void *dataOut, size_t dataOutAvailable, size_t *dataOutMoved) +{ + CCCryptorRef cref; + CCCryptorStatus retval; + size_t p1, p2; + size_t newmoved; + size_t finalSize; + + retval = CCCryptorCreate(op, alg, options, key, keyLength, iv, &cref); + if(retval != kCCSuccess) { + diag("Cryptor Create Failed\n"); + return retval; + } + p1 = ( dataInLength / 16 ) * 16 - 1; + if(p1 > 16) p1 = dataInLength; + p2 = dataInLength - p1; + // diag("Processing length %d in two parts %d and %d\n", (int) dataInLength, (int) p1, (int) p2); + + *dataOutMoved = 0; + + if(p1) { + retval = CCCryptorUpdate(cref, dataIn, p1, dataOut, dataOutAvailable, dataOutMoved); + if(retval) { + diag("P1 - Tried to move %d - failed retval = %d\n", (int) p1, (int) retval); + return retval; + } + dataIn += p1; + dataOut += *dataOutMoved; + dataOutAvailable -= *dataOutMoved; + } + if(p2) { + + retval = CCCryptorUpdate(cref, dataIn, p2, dataOut, dataOutAvailable, &newmoved); + if(retval) { + diag("P2 - Tried to move %d - failed\n", (int) p2); + return retval; + } + dataIn += p2; + dataOut += newmoved; + dataOutAvailable -= newmoved; + *dataOutMoved += newmoved; + } + + /* We've had reports that Final fails on some platforms if it's only cipher blocksize. */ + switch(alg) { + case kCCAlgorithmDES: /* fallthrough */ + case kCCAlgorithm3DES: finalSize = kCCBlockSizeDES; break; + case kCCAlgorithmAES128: finalSize = kCCBlockSizeAES128; break; + case kCCAlgorithmCAST: finalSize = kCCBlockSizeCAST; break; + case kCCAlgorithmRC2: finalSize = kCCBlockSizeRC2; break; + default: finalSize = dataOutAvailable; + } + + retval = CCCryptorFinal(cref, dataOut, finalSize, &newmoved); + if(retval) { + diag("Final - failed %d\n", (int) retval); + return retval; + } + retval = CCCryptorRelease(cref); + if(retval) { + diag("Final - release failed %d\n", (int) retval); + return retval; + } + *dataOutMoved += newmoved; + return kCCSuccess; + + +} + +CCCryptorStatus +CCMultiCryptWithMode(CCOperation op, CCMode mode, CCAlgorithm alg, CCPadding padding, const void *iv, + const void *key, size_t keyLength, const void *tweak, size_t tweakLength, + int numRounds, CCModeOptions options, + const void *dataIn, size_t dataInLength, + void *dataOut, size_t dataOutAvailable, size_t *dataOutMoved) +#ifdef CRYPTORWITHMODE +{ + CCCryptorRef cref; + CCCryptorStatus retval; + size_t p1, p2; + size_t newmoved; + + if((retval = CCCryptorCreateWithMode(op, mode, alg, padding, iv, key, keyLength, tweak, tweakLength, numRounds, options, &cref)) != kCCSuccess) { + return retval; + } + p1 = ( dataInLength / 16 ) * 16 - 1; + if(p1 > 16) p1 = dataInLength; + p2 = dataInLength - p1; + // diag("Processing length %d in two parts %d and %d\n", (int) dataInLength, (int) p1, (int) p2); + + *dataOutMoved = 0; + + if(p1) { + retval = CCCryptorUpdate(cref, dataIn, p1, dataOut, dataOutAvailable, dataOutMoved); + if(retval) { + diag("P1 - Tried to move %d - failed retval = %d\n", (int) p1, (int) retval); + return retval; + } + dataIn += p1; + dataOut += *dataOutMoved; + dataOutAvailable -= *dataOutMoved; + } + if(p2) { + + retval = CCCryptorUpdate(cref, dataIn, p2, dataOut, dataOutAvailable, &newmoved); + if(retval) { + diag("P2 - Tried to move %d - failed\n", (int) p2); + return retval; + } + dataIn += p2; + dataOut += newmoved; + dataOutAvailable -= newmoved; + *dataOutMoved += newmoved; + } + retval = CCCryptorFinal(cref, dataOut, dataOutAvailable, &newmoved); + if(retval) { + diag("Final - failed %d\n", (int) retval); + return retval; + } + retval = CCCryptorRelease(cref); + if(retval) { + diag("Final - release failed %d\n", (int) retval); + return retval; + } + *dataOutMoved += newmoved; + return kCCSuccess; +} +#else +{ + return kCCSuccess; +} +#endif + + +static byteBuffer +ccConditionalTextBuffer(char *inputText) +{ + byteBuffer ret; + + if(inputText) ret = hexStringToBytes(inputText); + else { + ret = hexStringToBytes(""); + ret->bytes = NULL; + } + return ret; +} + +int +CCCryptTestCase(char *keyStr, char *ivStr, CCAlgorithm alg, CCOptions options, char *cipherText, char *plainText) +{ + byteBuffer key, iv; + byteBuffer pt, ct; + + + CCCryptorStatus retval; + char cipherDataOut[4096]; + char plainDataOut[4096]; + size_t dataOutMoved; + byteBuffer bb; + + key = hexStringToBytes(keyStr); + pt = ccConditionalTextBuffer(plainText); + ct = ccConditionalTextBuffer(cipherText); + iv = ccConditionalTextBuffer(ivStr); + + + if((retval = CCCrypt(kCCEncrypt, alg, options, key->bytes, key->len, iv->bytes, pt->bytes, pt->len, cipherDataOut, 4096, &dataOutMoved)) != kCCSuccess) { + diag("Encrypt Failed %d\n", retval); + return 1; + } + + bb = bytesToBytes(cipherDataOut, dataOutMoved); + + // If ct isn't defined we're gathering data - print the ciphertext result + if(!ct->bytes) { + diag("Input Length %d Result: %s\n", (int) pt->len, bytesToHexString(bb)); + } else { + if (!bytesAreEqual(ct, bb)) { + diag("FAIL Encrypt Output %s\nEncrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(ct)); + return 1; + } + } + + free(bb); + + if((retval = CCCrypt(kCCDecrypt, alg, options, key->bytes, key->len, iv->bytes, cipherDataOut, dataOutMoved, plainDataOut, 4096, &dataOutMoved)) != kCCSuccess) { + diag("Decrypt Failed\n"); + return 1; + } + + bb = bytesToBytes(plainDataOut, dataOutMoved); + + if (!bytesAreEqual(pt, bb)) { + diag("FAIL Decrypt Output %s\nDecrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(pt)); + return 1; + } + + // if(ct->bytes && iv->bytes) diag("PASS Test for length %d\n", (int) pt->len); + // if(ct && (iv->bytes == NULL)) diag("PASS NULL IV Test for length %d\n", (int) pt->len); + + free(pt); + free(ct); + free(key); + free(iv); + return 0; +} + + + + +int +CCMultiCryptTestCase(char *keyStr, char *ivStr, CCAlgorithm alg, CCOptions options, char *cipherText, char *plainText) +{ + byteBuffer key, iv; + byteBuffer pt, ct; + + + CCCryptorStatus retval; + char cipherDataOut[4096]; + char plainDataOut[4096]; + size_t dataOutMoved; + byteBuffer bb; + + key = hexStringToBytes(keyStr); + pt = ccConditionalTextBuffer(plainText); + ct = ccConditionalTextBuffer(cipherText); + iv = ccConditionalTextBuffer(ivStr); + + + if((retval = CCMultiCrypt(kCCEncrypt, alg, options, key->bytes, key->len, iv->bytes, pt->bytes, pt->len, cipherDataOut, 4096, &dataOutMoved)) != kCCSuccess) { + diag("Encrypt Failed\n"); + return 1; + } + + bb = bytesToBytes(cipherDataOut, dataOutMoved); + + // If ct isn't defined we're gathering data - print the ciphertext result + if(!ct->bytes) { + diag("Input Length %d Result: %s\n", (int) pt->len, bytesToHexString(bb)); + } else { + if (!bytesAreEqual(ct, bb)) { + diag("FAIL Encrypt Output %s\nEncrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(ct)); + return 1; + } + } + + free(bb); + + if((retval = CCMultiCrypt(kCCDecrypt, alg, options, key->bytes, key->len, iv->bytes, cipherDataOut, dataOutMoved, plainDataOut, 4096, &dataOutMoved)) != kCCSuccess) { + diag("Decrypt Failed\n"); + return 1; + } + + bb = bytesToBytes(plainDataOut, dataOutMoved); + + if (!bytesAreEqual(pt, bb)) { + diag("FAIL Decrypt Output %s\nDecrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(pt)); + return 1; + } + + // if(ct && iv->bytes) diag("PASS Test for length %d\n", (int) pt->len); + // if(ct && (iv->bytes == NULL)) diag("PASS NULL IV Test for length %d\n", (int) pt->len); + + free(pt); + free(ct); + free(key); + free(iv); + return 0; +} + + + + +int +CCModeTestCase(char *keyStr, char *ivStr, CCMode mode, CCAlgorithm alg, CCPadding padding, char *cipherText, char *plainText) +#ifdef CRYPTORWITHMODE +{ + byteBuffer key, iv; + byteBuffer pt, ct; + + CCCryptorStatus retval; + char cipherDataOut[4096]; + char plainDataOut[4096]; + size_t dataOutMoved; + byteBuffer bb; + + key = hexStringToBytes(keyStr); + pt = ccConditionalTextBuffer(plainText); + ct = ccConditionalTextBuffer(cipherText); + iv = ccConditionalTextBuffer(ivStr); + + if((retval = CCCryptWithMode(kCCEncrypt, mode, alg, padding, iv->bytes, key->bytes, key->len, NULL, 0, 0, 0, pt->bytes, pt->len, + cipherDataOut, 4096, &dataOutMoved)) != kCCSuccess) { + diag("Encrypt Failed\n"); + return 1; + } + + bb = bytesToBytes(cipherDataOut, dataOutMoved); + + // If ct isn't defined we're gathering data - print the ciphertext result + if(!ct->bytes) { + diag("Input Length %d Result: %s\n", (int) pt->len, bytesToHexString(bb)); + } else { + if (!bytesAreEqual(ct, bb)) { + diag("FAIL\nEncrypt Output %s\nEncrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(ct)); + return 1; + } + } + + free(bb); + + if((retval = CCCryptWithMode(kCCDecrypt, mode, alg, padding, iv->bytes, key->bytes, key->len, NULL, 0, 0, 0, cipherDataOut, dataOutMoved, + plainDataOut, 4096, &dataOutMoved)) != kCCSuccess) { + diag("Decrypt Failed\n"); + return 1; + } + + bb = bytesToBytes(plainDataOut, dataOutMoved); + + if (!bytesAreEqual(pt, bb)) { + diag("FAIL Decrypt Output %s\nDecrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(pt)); + return 1; + } + + // if(ct->bytes && iv->bytes) diag("PASS Test for length %d\n", (int) pt->len); + // if(ct->bytes && (iv->bytes == NULL)) diag("PASS NULL IV Test for length %d\n", (int) pt->len); + + free(pt); + free(ct); + free(key); + free(iv); + return 0; +} +#else +{ + return 0; +} +#endif + + + + +int +CCMultiModeTestCase(char *keyStr, char *ivStr, CCMode mode, CCAlgorithm alg, CCPadding padding, char *cipherText, char *plainText) +#ifdef CRYPTORWITHMODE +{ + byteBuffer key, iv; + byteBuffer pt, ct; + CCCryptorStatus retval; + char cipherDataOut[4096]; + char plainDataOut[4096]; + size_t dataOutMoved; + byteBuffer bb; + + key = hexStringToBytes(keyStr); + pt = ccConditionalTextBuffer(plainText); + ct = ccConditionalTextBuffer(cipherText); + iv = ccConditionalTextBuffer(ivStr); + + if((retval = CCMultiCryptWithMode(kCCEncrypt, mode, alg, padding, iv->bytes,key->bytes, key->len, NULL, 0,0, 0, pt->bytes, pt->len, + cipherDataOut, 4096, &dataOutMoved)) != kCCSuccess) { + diag("Encrypt Failed\n"); + return 1; + } + + bb = bytesToBytes(cipherDataOut, dataOutMoved); + + // If ct isn't defined we're gathering data - print the ciphertext result + if(!ct->bytes) { + diag("Input Length %d Result: %s\n", (int) pt->len, bytesToHexString(bb)); + } else { + if (!bytesAreEqual(ct, bb)) { + diag("FAIL\nEncrypt Output %s\nEncrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(ct)); + return 1; + } + } + + free(bb); + + if((retval = CCMultiCryptWithMode(kCCEncrypt, mode, alg, padding, iv->bytes, key->bytes, key->len, NULL, 0, 0, 0, + cipherDataOut, dataOutMoved, plainDataOut, 4096, &dataOutMoved)) != kCCSuccess) { + diag("Decrypt Failed\n"); + return 1; + } + + bb = bytesToBytes(plainDataOut, dataOutMoved); + + if (!bytesAreEqual(pt, bb)) { + diag("FAIL Decrypt Output %s\nDecrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(pt)); + return 1; + } + + // if(ct && iv->bytes) diag("PASS Test for length %d\n", (int) pt->len); + // if(ct && (iv->bytes == NULL)) diag("PASS NULL IV Test for length %d\n", (int) pt->len); + + free(pt); + free(ct); + free(key); + free(iv); + return 0; +} +#else +{ + return kCCSuccess; +} +#endif + +#ifdef CCSYMGCM + +static CCCryptorStatus +CCCryptorGCMDiscreet( + CCOperation op, /* kCCEncrypt, kCCDecrypt */ + CCAlgorithm alg, + const void *key, /* raw key material */ + size_t keyLength, + const void *iv, + size_t ivLen, + const void *aData, + size_t aDataLen, + const void *dataIn, + size_t dataInLength, + void *dataOut, + const void *tag, + size_t *tagLength) +{ + CCCryptorStatus retval; + CCCryptorRef cref; + + retval = CCCryptorCreateWithMode(op, kCCModeGCM, alg, ccNoPadding, NULL, key, keyLength, NULL, 0, 0, 0, &cref); + if(retval != kCCSuccess) return retval; + + retval = CCCryptorGCMAddIV(cref, iv, ivLen); + if(retval != kCCSuccess) { + printf("Failed to add IV\n"); + goto out; + } + + retval = CCCryptorGCMaddAAD(cref, aData, aDataLen); + if(retval != kCCSuccess) { + printf("Failed to add ADD\n"); + goto out; + } + + + if(kCCEncrypt == op) { + retval = CCCryptorGCMEncrypt(cref, dataIn, dataInLength, dataOut); + if(retval != kCCSuccess) { + printf("Failed to Encrypt\n"); + goto out; + } + } else { + retval = CCCryptorGCMDecrypt(cref, dataIn, dataInLength, dataOut); + if(retval != kCCSuccess) { + printf("Failed to Decrypt\n"); + goto out; + } + } + + + retval = CCCryptorGCMFinal(cref, tag, tagLength); + if(retval != kCCSuccess) { + printf("Failed to Finalize and get tag\n"); + goto out; + } + retval = CCCryptorGCMReset(cref); + if(retval != kCCSuccess) { + printf("Failed to Reset\n"); + } + + +out: + + CCCryptorRelease(cref); + return retval; +} + + +int +CCCryptorGCMTestCase(char *keyStr, char *ivStr, char *aDataStr, char *tagStr, CCAlgorithm alg, char *cipherText, char *plainText) +{ + byteBuffer key, iv; + byteBuffer pt, ct; + byteBuffer adata, tag; + byteBuffer bb; + + + CCCryptorStatus retval; + char cipherDataOut[4096]; + char plainDataOut[4096]; + char tagDataOut[4096]; + size_t tagDataOutlen; + size_t dataLen; + + + key = hexStringToBytes(keyStr); + adata = ccConditionalTextBuffer(aDataStr); + tag = hexStringToBytes(tagStr); + pt = ccConditionalTextBuffer(plainText); + ct = ccConditionalTextBuffer(cipherText); + iv = ccConditionalTextBuffer(ivStr); + + dataLen = pt->len; + + tagDataOutlen = tag->len; + memset(tagDataOut, 0, 16); + if((retval = CCCryptorGCM(kCCEncrypt, alg, key->bytes, key->len, iv->bytes, iv->len, adata->bytes, adata->len, pt->bytes, dataLen, cipherDataOut, tagDataOut, &tagDataOutlen)) != kCCSuccess) { + diag("Encrypt Failed\n"); + return 1; + } + + bb = bytesToBytes(cipherDataOut, dataLen); + + // If ct isn't defined we're gathering data - print the ciphertext result + if(!ct->bytes) { + diag("Input Length %d Result: %s\n", (int) dataLen, bytesToHexString(bb)); + } else { + if (!bytesAreEqual(ct, bb)) { + diag("FAIL Encrypt Output %s\nEncrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(ct)); + return 1; + } + } + + free(bb); +#if NEVER + bb = bytesToBytes(tagDataOut, tagDataOutlen); + if (!bytesAreEqual(tag, bb)) { + diag("FAIL Tag on plaintext is wrong\n got %s\n expected %s\n", bytesToHexString(bb), bytesToHexString(tag)); + return 1; + } +#endif + + tagDataOutlen = tag->len; + memset(tagDataOut, 0, 16); + if((retval = CCCryptorGCM(kCCDecrypt, alg, key->bytes, key->len, iv->bytes, iv->len, adata->bytes, adata->len, cipherDataOut, dataLen, plainDataOut, tagDataOut, &tagDataOutlen)) != kCCSuccess) { + diag("Decrypt Failed\n"); + return 1; + } + + bb = bytesToBytes(plainDataOut, dataLen); + + if (!bytesAreEqual(pt, bb)) { + diag("FAIL Decrypt Output %s\nDecrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(pt)); + return 1; + } + + free(bb); + + bb = bytesToBytes(tagDataOut, tagDataOutlen); + if (!bytesAreEqual(tag, bb)) { + diag("FAIL Tag on ciphertext is wrong\n got %s\n expected %s\n", bytesToHexString(bb), bytesToHexString(tag)); + return 1; + } + + free(bb); + free(pt); + free(ct); + free(key); + free(iv); + // diag("Pass One-Shot GCM Test\n"); + return 0; +} + +int +CCCryptorGCMDiscreetTestCase(char *keyStr, char *ivStr, char *aDataStr, char *tagStr, CCAlgorithm alg, char *cipherText, char *plainText) +{ + byteBuffer key, iv; + byteBuffer pt, ct; + byteBuffer adata, tag; + byteBuffer bb; + + + CCCryptorStatus retval; + char cipherDataOut[4096]; + char plainDataOut[4096]; + char tagDataOut[4096]; + size_t tagDataOutlen; + size_t dataLen; + + + key = hexStringToBytes(keyStr); + adata = ccConditionalTextBuffer(aDataStr); + tag = hexStringToBytes(tagStr); + pt = ccConditionalTextBuffer(plainText); + ct = ccConditionalTextBuffer(cipherText); + iv = ccConditionalTextBuffer(ivStr); + + dataLen = pt->len; + + tagDataOutlen = tag->len; + memset(tagDataOut, 0, 4096); + if((retval = CCCryptorGCMDiscreet(kCCEncrypt, alg, key->bytes, key->len, iv->bytes, iv->len, adata->bytes, adata->len, pt->bytes, dataLen, cipherDataOut, tagDataOut, &tagDataOutlen)) != kCCSuccess) { + diag("Encrypt Failed\n"); + return 1; + } + + bb = bytesToBytes(cipherDataOut, dataLen); + + // If ct isn't defined we're gathering data - print the ciphertext result + if(!ct->bytes) { + diag("Input Length %d Result: %s\n", (int) dataLen, bytesToHexString(bb)); + } else { + if (!bytesAreEqual(ct, bb)) { + diag("FAIL Encrypt Output %s\nEncrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(ct)); + return 1; + } + } + + free(bb); + +#ifdef NEVER + bb = bytesToBytes(tagDataOut, tagDataOutlen); + if (!bytesAreEqual(tag, bb)) { + diag("FAIL Tag on plaintext is wrong\n got %s\n expected %s\n", bytesToHexString(bb), bytesToHexString(tag)); + return 1; + } +#endif + + tagDataOutlen = tag->len; + memset(tagDataOut, 0, 4096); + if((retval = CCCryptorGCMDiscreet(kCCDecrypt, alg, key->bytes, key->len, iv->bytes, iv->len, adata->bytes, adata->len, cipherDataOut, dataLen, plainDataOut, tagDataOut, &tagDataOutlen)) != kCCSuccess) { + diag("Decrypt Failed\n"); + return 1; + } + + bb = bytesToBytes(plainDataOut, dataLen); + + if (!bytesAreEqual(pt, bb)) { + diag("FAIL Decrypt Output %s\nDecrypt Expect %s\n", bytesToHexString(bb), bytesToHexString(pt)); + return 1; + } + + free(bb); + + bb = bytesToBytes(tagDataOut, tagDataOutlen); + if (!bytesAreEqual(tag, bb)) { + diag("FAIL Tag on ciphertext is wrong\n got %s\n expected %s\n", bytesToHexString(bb), bytesToHexString(tag)); + return 1; + } + + free(bb); + free(pt); + free(ct); + free(key); + free(iv); + // diag("Pass Discreet GCM Test\n"); + + return 0; +} + +#endif ADDED CCRegression/CommonCrypto/CCCryptorTestFuncs.h Index: CCRegression/CommonCrypto/CCCryptorTestFuncs.h ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CCCryptorTestFuncs.h @@ -0,0 +1,61 @@ +/* + * CCCryptorTestFuncs.h + * CCRegressions + * + * + */ + +#include "capabilities.h" +#include +#ifdef CRYPTORWITHMODE +#include +#else +typedef uint32_t CCMode; +typedef uint32_t CCPadding; +typedef uint32_t CCModeOptions; +#endif + +/* This is a CCCrypt with the Updates split into two parts */ + +CCCryptorStatus +CCMultiCrypt(CCOperation op, CCAlgorithm alg, CCOptions options, const void *key, size_t keyLength, const void *iv, const void *dataIn, size_t dataInLength, + void *dataOut, size_t dataOutAvailable, size_t *dataOutMoved); + + +/* This is a CCCrypt allowing mode specification */ + +CCCryptorStatus +CCCryptWithMode(CCOperation op, CCMode mode, CCAlgorithm alg, CCPadding padding, const void *iv, + const void *key, size_t keyLength, const void *tweak, size_t tweakLength, + int numRounds, CCModeOptions options, + const void *dataIn, size_t dataInLength, + void *dataOut, size_t dataOutAvailable, size_t *dataOutMoved); + +CCCryptorStatus +CCMultiCryptWithMode(CCOperation op, CCMode mode, CCAlgorithm alg, CCPadding padding, const void *iv, + const void *key, size_t keyLength, const void *tweak, size_t tweakLength, + int numRounds, CCModeOptions options, + const void *dataIn, size_t dataInLength, + void *dataOut, size_t dataOutAvailable, size_t *dataOutMoved); + +/* This is a Test Case "doer" using CCCrypt */ +int +CCCryptTestCase(char *keyStr, char *ivStr, CCAlgorithm alg, CCOptions options, char *cipherText, char *plainText); + +/* This is a Test Case "doer" using CCMultiCrypt */ +int +CCMultiCryptTestCase(char *keyStr, char *ivStr, CCAlgorithm alg, CCOptions options, char *cipherText, char *plainText); + +/* This is a Test Case "doer" using CCCryptWithMode */ +int +CCModeTestCase(char *keyStr, char *ivStr, CCMode mode, CCAlgorithm alg, CCPadding padding, char *cipherText, char *plainText); + +/* This is a Test Case "doer" using CCMultiCryptWithMode */ +int +CCMultiModeTestCase(char *keyStr, char *ivStr, CCMode mode, CCAlgorithm alg, CCPadding padding, char *cipherText, char *plainText); +/* This is a Test Case "doer" using CCCryptorGCM */ +int +CCCryptorGCMTestCase(char *keyStr, char *ivStr, char *aDataStr, char *tagStr, CCAlgorithm alg, char *cipherText, char *plainText); +int +CCCryptorGCMDiscreetTestCase(char *keyStr, char *ivStr, char *aDataStr, char *tagStr, CCAlgorithm alg, char *cipherText, char *plainText); + ADDED CCRegression/CommonCrypto/CommonBaseEncoding.c Index: CCRegression/CommonCrypto/CommonBaseEncoding.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonBaseEncoding.c @@ -0,0 +1,269 @@ + +// +// CNEncoding.c +// CCRegressions +// +#include +#include "testbyteBuffer.h" +#include "capabilities.h" +#include "testmore.h" + +#if (CNENCODER == 0) +entryPoint(CommonBaseEncoding,"Base XX Encoding") +#else + +#include + +static int kTestTestCount = 358; + +#define BUFSIZ 1024 + +static int +doWithEncoders(CNEncoderRef encoder, CNEncoderRef decoder, char *input, char *expected) +{ + CNStatus retval; + char outBuf[BUFSIZ], secondBuf[BUFSIZ]; + size_t outLen, outAvailable, secondLen, secondAvailable; + + outAvailable = BUFSIZ; + outLen = 0; + retval = CNEncoderUpdate(encoder, input, strlen(input), outBuf, &outAvailable); + + ok(retval == kCNSuccess, "encoded"); + + outLen = outAvailable; + outAvailable = BUFSIZ - outLen; + + retval = CNEncoderFinal(encoder, &outBuf[outLen], &outAvailable); + + ok(retval == kCNSuccess, "finalized"); + + outLen += outAvailable; + + if(expected) { + ok(strncmp(expected, outBuf, strlen(expected)) == 0, "output matches"); + if(strncmp(expected, outBuf, strlen(expected))) { + printf("Encoding %s\n%s\n%s\n", input, expected, outBuf); + } + } + + retval = CNEncoderRelease(&encoder); + + ok(retval == kCNSuccess, "released"); + + + secondAvailable = BUFSIZ; + secondLen = 0; + retval = CNEncoderUpdate(decoder, outBuf, outLen, secondBuf, &secondAvailable); + + ok(retval == kCNSuccess, "encoded"); + + + secondLen = secondAvailable; + secondAvailable = BUFSIZ - secondLen; + + retval = CNEncoderFinal(decoder, &secondBuf[secondLen], &secondLen); + + ok(retval == kCNSuccess, "finalized"); + + secondLen += secondAvailable; + + ok(strncmp(input, secondBuf, strlen(input)) == 0, "output matches"); + + retval = CNEncoderRelease(&decoder); + ok(retval == kCNSuccess, "encoder Released"); + + return 0; +} + + +static int +doEncoder(CNEncodings encodingStrat, char *input, char *expected) +{ + CNStatus retval; + CNEncoderRef encoder, decoder; + + retval = CNEncoderCreate(encodingStrat, kCNEncode, &encoder); + + ok(retval == kCNSuccess, "got an encoder"); + + retval = CNEncoderCreate(encodingStrat, kCNDecode, &decoder); + + ok(retval == kCNSuccess, "got a decoder"); + + + doWithEncoders(encoder, decoder, input, expected); + + return 0; +} + + +static int +doCustomEncoder(const char *name, + const uint8_t baseNum, + const char *charMap, + const uint8_t padChar, char *input, char *expected) +{ + CNStatus retval; + CNEncoderRef encoder, decoder; + + retval = CNEncoderCreateCustom(name, baseNum, charMap, padChar, kCNEncode, &encoder); + + ok(retval == kCNSuccess, "got an encoder"); + + retval = CNEncoderCreateCustom(name, baseNum, charMap, padChar, kCNDecode, &decoder); + + ok(retval == kCNSuccess, "got a decoder"); + + doWithEncoders(encoder, decoder, input, expected); + + return 0; +} + +static int +doOneShotStyle(CNEncodings encodingStrat, char *input, char *expected) +{ + CNStatus retval; + char outBuf[BUFSIZ], secondBuf[BUFSIZ]; + size_t outLen, outAvailable, secondLen, secondAvailable; + + outAvailable = BUFSIZ; + retval = CNEncode(encodingStrat, kCNEncode, input, strlen(input), outBuf, &outAvailable); + + outLen = outAvailable; + + if(expected) { + ok(strncmp(expected, outBuf, strlen(expected)) == 0, "output matches"); + if(strncmp(expected, outBuf, strlen(expected))) { + printf("Encoding %s\n%s\n%s\n", input, expected, outBuf); + } + } + + + secondAvailable = BUFSIZ; + retval = CNEncode(encodingStrat, kCNDecode, outBuf, outLen, secondBuf, &secondAvailable); + + secondLen = secondAvailable; + + ok(strncmp(input, secondBuf, strlen(input)) == 0, "output matches"); + if(strncmp(input, secondBuf, strlen(input))) { + printf("input: %s\n", input); + printf("result: %s\n", secondBuf); + } + + return 0; +} + + + +int CommonBaseEncoding(int argc, char *const *argv) { + int accum = 0; + + plan_tests(kTestTestCount); + + // diag("Base64\n"); + + doEncoder(kCNEncodingBase64, "", ""); + doEncoder(kCNEncodingBase64, "f", "Zg=="); + doEncoder(kCNEncodingBase64, "fo", "Zm8="); + doEncoder(kCNEncodingBase64, "foo", "Zm9v"); + doEncoder(kCNEncodingBase64, "foob", "Zm9vYg=="); + doEncoder(kCNEncodingBase64, "fooba", "Zm9vYmE="); + doEncoder(kCNEncodingBase64, "foobar", "Zm9vYmFy"); + + //diag("Base32\n"); + + doEncoder(kCNEncodingBase32, "", ""); + doEncoder(kCNEncodingBase32, "f", "MY======"); + doEncoder(kCNEncodingBase32, "fo", "MZXQ===="); + doEncoder(kCNEncodingBase32, "foo", "MZXW6==="); + doEncoder(kCNEncodingBase32, "foob", "MZXW6YQ="); + doEncoder(kCNEncodingBase32, "fooba", "MZXW6YTB"); + doEncoder(kCNEncodingBase32, "foobar", "MZXW6YTBOI======"); + + //diag("Base32HEX\n"); + + doEncoder(kCNEncodingBase32HEX, "", ""); + doEncoder(kCNEncodingBase32HEX, "f", "CO======"); + doEncoder(kCNEncodingBase32HEX, "fo", "CPNG===="); + doEncoder(kCNEncodingBase32HEX, "foo", "CPNMU==="); + doEncoder(kCNEncodingBase32HEX, "foob", "CPNMUOG="); + doEncoder(kCNEncodingBase32HEX, "fooba", "CPNMUOJ1"); + doEncoder(kCNEncodingBase32HEX, "foobar", "CPNMUOJ1E8======"); + + //diag("Base16\n"); + + doEncoder(kCNEncodingBase16, "", ""); + doEncoder(kCNEncodingBase16, "f", "66"); + doEncoder(kCNEncodingBase16, "fo", "666F"); + doEncoder(kCNEncodingBase16, "foo", "666F6F"); + doEncoder(kCNEncodingBase16, "foob", "666F6F62"); + doEncoder(kCNEncodingBase16, "fooba", "666F6F6261"); + doEncoder(kCNEncodingBase16, "foobar", "666F6F626172"); + + //diag("Base64 Long\n"); + accum |= doEncoder(kCNEncodingBase64, + "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.", + ""); +<<<<<<< HEAD + //diag("Custom\n"); +======= + + diag("Base64 - One-Shot\n"); + + doOneShotStyle(kCNEncodingBase64, "", ""); + doOneShotStyle(kCNEncodingBase64, "f", "Zg=="); + doOneShotStyle(kCNEncodingBase64, "fo", "Zm8="); + doOneShotStyle(kCNEncodingBase64, "foo", "Zm9v"); + doOneShotStyle(kCNEncodingBase64, "foob", "Zm9vYg=="); + doOneShotStyle(kCNEncodingBase64, "fooba", "Zm9vYmE="); + doOneShotStyle(kCNEncodingBase64, "foobar", "Zm9vYmFy"); + + diag("Base32 - One-Shot\n"); + + doOneShotStyle(kCNEncodingBase32, "", ""); + doOneShotStyle(kCNEncodingBase32, "f", "MY======"); + doOneShotStyle(kCNEncodingBase32, "fo", "MZXQ===="); + doOneShotStyle(kCNEncodingBase32, "foo", "MZXW6==="); + doOneShotStyle(kCNEncodingBase32, "foob", "MZXW6YQ="); + doOneShotStyle(kCNEncodingBase32, "fooba", "MZXW6YTB"); + doOneShotStyle(kCNEncodingBase32, "foobar", "MZXW6YTBOI======"); + + diag("Base32HEX - One-Shot\n"); + + doOneShotStyle(kCNEncodingBase32HEX, "", ""); + doOneShotStyle(kCNEncodingBase32HEX, "f", "CO======"); + doOneShotStyle(kCNEncodingBase32HEX, "fo", "CPNG===="); + doOneShotStyle(kCNEncodingBase32HEX, "foo", "CPNMU==="); + doOneShotStyle(kCNEncodingBase32HEX, "foob", "CPNMUOG="); + doOneShotStyle(kCNEncodingBase32HEX, "fooba", "CPNMUOJ1"); + doOneShotStyle(kCNEncodingBase32HEX, "foobar", "CPNMUOJ1E8======"); + + diag("Base16 - One-Shot\n"); + + doOneShotStyle(kCNEncodingBase16, "", ""); + doOneShotStyle(kCNEncodingBase16, "f", "66"); + doOneShotStyle(kCNEncodingBase16, "fo", "666F"); + doOneShotStyle(kCNEncodingBase16, "foo", "666F6F"); + doOneShotStyle(kCNEncodingBase16, "foob", "666F6F62"); + doOneShotStyle(kCNEncodingBase16, "fooba", "666F6F6261"); + doOneShotStyle(kCNEncodingBase16, "foobar", "666F6F626172"); + + diag("Base64 Long - One-Shot\n"); + accum |= doOneShotStyle(kCNEncodingBase64, + "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.", + ""); + + + + + diag("Custom\n"); + accum |= doCustomEncoder("Custom64", 64, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/", '*', + "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.", + ""); + + return 0; +} + +#endif + ADDED CCRegression/CommonCrypto/CommonBigDigest.c Index: CCRegression/CommonCrypto/CommonBigDigest.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonBigDigest.c @@ -0,0 +1,106 @@ +#include +#include "testbyteBuffer.h" +#include "capabilities.h" +#include "testmore.h" +#include +#include + +#if (CCBIGDIGEST == 0) +entryPoint(CommonBigDigest,"CommonCrypto CCDigest Large Size test") +#else +#include +#include +#include +#include +#include +#include +#include + + +static void DigestInChunks(CCDigestAlgorithm algorithm, size_t chunksize, const uint8_t *bytesToDigest, size_t numbytes, uint8_t *outbuf) +{ + CCDigestRef d = CCDigestCreate(algorithm); + while(numbytes) { + size_t n = (numbytes < chunksize) ? numbytes: chunksize; + CCDigestUpdate(d, bytesToDigest, n); + numbytes -= n; bytesToDigest += n; + } + if(CCDigestFinal(d, outbuf)) return; + CCDigestDestroy(d); +} + +/* + * Compute the digest of a whole file + */ + +static int +checksum_file(char *filename, CCDigestAlgorithm algorithm) +{ + struct stat st; + size_t digestsize = CCDigestGetOutputSize(algorithm); + uint8_t mdwhole[digestsize]; + uint8_t mdchunk[digestsize]; + size_t blocksz = 0x40000000L; // 1 GB + off_t filesize; + u_char *buf; + int fd; + + fd = open(filename, O_RDONLY); + if (fd < 0) { + perror(filename); + return -1; + } + if (fstat(fd, &st) < 0) { + perror(filename); + (void) close(fd); + return -1; + } + + filesize = st.st_size; + buf = (u_char *) mmap(NULL, filesize, + PROT_READ, MAP_PRIVATE | MAP_NOCACHE, fd, 0); + if (buf == (u_char *) -1) { + perror("mmap"); + close(fd); + return -1; + } + (void) madvise(buf, filesize, MADV_SEQUENTIAL); + printf("File is mapped\n"); + + /* + * First do it in one big chunk + */ + + CCDigest(algorithm, buf, filesize, mdwhole); + + /* + * Now do it in several 1GB chunks + */ + + DigestInChunks(algorithm, blocksz, buf, filesize, mdchunk); + + (void) munmap(buf, filesize); + (void) close(fd); + + int cmpval = memcmp(mdchunk, mdwhole, digestsize); + ok(cmpval == 0, "Results are the same for both digests"); + + return 0; +} + + +static const int kTestTestCount = 1000; + +int CommonBigDigest(int argc, char *const *argv) +{ + + plan_tests(kTestTestCount); + + char *testpath = "/Volumes/Data/Users/murf/Downloads/Zin_12A130_AppleInternal_038-2423-191.dmg"; + checksum_file(testpath, kCCDigestSHA1); + + return 0; +} + + +#endif ADDED CCRegression/CommonCrypto/CommonBigNum.c Index: CCRegression/CommonCrypto/CommonBigNum.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonBigNum.c @@ -0,0 +1,478 @@ + +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" +#include "CommonRandomSPI.h" + + + + +#if (CCBIGNUM == 0) +entryPoint(CommonBigNum,"Big Number Arithmetic") +#else + +#include +static int kTestTestCount = 7; + + + +#define STRESSSIZE 5000 + +static int testCreateFree() +{ + CCStatus status; + CCBigNumRef stress[STRESSSIZE]; + for(size_t i=0; ibytes, bb->len); break; + } + ok(status == kCCSuccess, "BigNum Created"); + } else { + /* printf("(%lu) Freeing\n", ri); */ + CCBigNumClear(stress[ri]); + CCBigNumFree(stress[ri]); + stress[ri] = NULL; + } + CCBigNumFree(r); + } + } + return 0; +} + +static int testHexString() +{ + CCStatus status; + char *hexstring = "1002030405060708090021222324252627282920"; + CCBigNumRef num1 = CCBigNumFromHexString(&status, hexstring); + char *output; + + ok(status == 0, "BigNum Created"); + output = CCBigNumToHexString(&status, num1); + ok(status == 0, "Value retrieved"); + ok(strcmp(output, hexstring) == 0, "strings are equal"); + if(strcmp(output, hexstring)) { + printf("output: %s\n", output); + printf("input : %s\n", hexstring); + } + free(output); + CCBigNumFree(num1); + + return 0; + +} + +static int testData() +{ + CCStatus status; + char *hexstring = "1002030405060708090021222324252627282920"; + byteBuffer bb = hexStringToBytes(hexstring); + CCBigNumRef num1 = CCBigNumFromData(&status, bb->bytes, bb->len); + char *output; + + ok(status == 0, "BigNum Created"); + output = CCBigNumToHexString(&status, num1); + ok(status == 0, "Value retrieved"); + ok(strcmp(output, hexstring) == 0, "strings are equal"); + if(strcmp(output, hexstring)) { + printf("output: %s\n", output); + printf("input : %s\n", hexstring); + } + free(output); + + byteBuffer outbuf = mallocByteBuffer(64); + outbuf->len = CCBigNumToData(&status, num1, outbuf->bytes); + ok(status == 0, "Value retrieved 2"); + + ok(bytesAreEqual(bb, outbuf), "input == output"); + free(bb); + free(outbuf); + CCBigNumFree(num1); + + return 0; + +} + +static int testI() +{ + CCStatus status; + uint32_t I=0x10203040; + char *hexstring = "10203040"; + byteBuffer bb = hexStringToBytes(hexstring); + CCBigNumRef num1 = CCCreateBigNum(&status); + char *output; + + ok(status == 0, "BigNum Created"); + status = CCBigNumSetI(num1, I); + ok(status == 0, "BigNum Set to I"); + output = CCBigNumToHexString(&status, num1); + ok(status == 0, "Value retrieved"); + ok(strcmp(output, hexstring) == 0, "strings are equal"); + if(strcmp(output, hexstring)) { + printf("output: %s\n", output); + printf("input : %s\n", hexstring); + } + free(output); + + uint32_t outI = CCBigNumGetI(&status, num1); + ok(status == 0, "Value retrieved 2"); + + ok(outI == I, "input == output"); + free(bb); + CCBigNumFree(num1); + + return 0; + +} + + +static int testCompare() +{ + CCStatus status; + char *lowstring = "030405060708090021222324252627282920"; + char *midstring = "1002030405060708090021222324252627282920"; + char *histring = "1002030405060708090f21222324252627282920"; + CCBigNumRef low = CCBigNumFromHexString(&status, lowstring); + ok(status == 0, "BigNum Created"); + CCBigNumRef mid = CCBigNumFromHexString(&status, midstring); + ok(status == 0, "BigNum Created"); + CCBigNumRef midsame = CCBigNumFromHexString(&status, midstring); + ok(status == 0, "BigNum Created"); + CCBigNumRef hi = CCBigNumFromHexString(&status, histring); + ok(status == 0, "BigNum Created"); + CCBigNumRef iVal = CCCreateBigNum(&status); + ok(status == 0, "BigNum Created"); + status = CCBigNumSetI(iVal, 67); + + ok(CCBigNumCompare(mid, low) == 1, "mid > low"); + ok(CCBigNumCompare(mid, hi) == -1, "mid < hi"); + ok(CCBigNumCompare(mid, midsame) == 0, "mid == midsame"); + ok(CCBigNumCompareI(iVal, 67) == 0, "iVal equality is correct"); + ok(CCBigNumCompareI(iVal, 66) > 0, "iVal greater is correct"); + ok(CCBigNumCompareI(iVal, 68) < 0, "iVal less than is correct"); + + CCBigNumFree(low); + CCBigNumFree(mid); + CCBigNumFree(midsame); + CCBigNumFree(hi); + CCBigNumFree(iVal); + + return 0; + +} + +static int testBitCount() +{ + CCStatus status; + char *hexstring = "1002030405060708090021222324252627282920"; + CCBigNumRef num1 = CCBigNumFromHexString(&status, hexstring); + ok(status == 0, "BigNum Created"); + + int bits = CCBigNumBitCount(num1); + ok(bits == 157, "bit count is correct"); + + CCBigNumFree(num1); + return 0; +} + +static int testAddSub() +{ + CCStatus status; + char *hex1 = "1002030405060708090021222324252627282920"; + char *hex2 = "1002030405060708090021222324252627282920"; + char *result = "200406080a0c0e101200424446484a4c4e505240"; + CCBigNumRef num1 = CCBigNumFromHexString(&status, hex1); + CCBigNumRef num2 = CCBigNumFromHexString(&status, hex2); + CCBigNumRef output = CCCreateBigNum(&status); + CCBigNumRef resultExpected = CCBigNumFromHexString(&status, result); + + status = CCBigNumAdd(output, num1, num2); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected) == 0, "expected operation result"); + + status = CCBigNumSub(output, num1, num2); + ok(status == 0, "operation completed"); + CCBigNumSetI(resultExpected, 0); + ok(CCBigNumCompare(output, resultExpected) == 0, "expected operation result"); + + CCBigNumFree(num1); + CCBigNumFree(num2); + CCBigNumFree(output); + CCBigNumFree(resultExpected); + return 0; +} + +static int testAddSubI() +{ + CCStatus status; + char *hex1 = "1002030405060708090021222324252627282920"; + char *result = "1002030405060708090021222324252627282921"; + CCBigNumRef num1 = CCBigNumFromHexString(&status, hex1); + CCBigNumRef output = CCCreateBigNum(&status); + CCBigNumRef resultExpected = CCBigNumFromHexString(&status, result); + + status = CCBigNumAddI(output, num1, 1); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected) == 0, "expected operation result"); + + status = CCBigNumSubI(output, output, 1); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, num1) == 0, "expected operation result"); + + CCBigNumFree(num1); + CCBigNumFree(output); + CCBigNumFree(resultExpected); + return 0; +} + + +static int testShift() +{ + CCStatus status; + + // Shift n right by 11 + CCBigNumRef n = CCBigNumFromHexString(&status, "1002030405060708090021222324252627282920"); + CCBigNumRef resultExpected = CCBigNumFromHexString(&status, "200406080a0c0e101200424446484a4c4e505"); + CCBigNumRef output = CCCreateBigNum(&status); + status = CCBigNumRightShift(output, n, 11); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected) == 0, "expected operation result"); + + // Shift n left by 14 + CCBigNumRef resultExpected2 = CCBigNumFromHexString(&status, "40080c1014181c20240084888c9094989ca0a480000"); + status = CCBigNumLeftShift(output, n, 14); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected2) == 0, "expected operation result"); + + + CCBigNumFree(n); + CCBigNumFree(output); + CCBigNumFree(resultExpected); + CCBigNumFree(resultExpected2); + return 0; +} + +static int testModExp() +{ + CCStatus status; + + // Shift n right by 11 + CCBigNumRef a = CCBigNumFromHexString(&status, "c968e40c5304364b057425920b18cc358f254ddb0f42f84850d6deec46006b4a692e52b7c3bddead45f77f2c1be1c606521d8a24260429f362d65b57873dbf270e97e210b872e45e97cb4cd87977ad20491e53c48cf0e88da9a61312675a2527c86ac537740c5e4206972f09c0f91fa1c9f14a2cf1be07e82a3b6fd58dc12c3a"); + CCBigNumRef b = CCBigNumFromHexString(&status, "010001"); + CCBigNumRef c = CCBigNumFromHexString(&status, "354c912b09ee7abff5b3d94ed52a9e8dcae582e094daa375c495f970710af73efcc4f9776010511f654c7408a6d5d351ab1d94a0fede757d782b54ddcf6fe8d714870b78b0e67a9754cb03a5cf63bbda1c71791902ea4527fb0cd76437391e5422c704ffb6d6018261171d8cee98adcf0243f1fd520fb3761afe94a2f4d99f94"); + CCBigNumRef resultExpected = CCBigNumFromHexString(&status, "0fb978a4f4fccdb14c7268918b784c4f6d5281c0d6ff43e60e88e97f97f2617608de2488c84eb99a3f467013c860536ec74f4968abeccbc1b026ee5873e40bdd292f8f7416a93df619288b49ba21d3e09aa796cb35a340b1abfda4e3b6cd92df2de64967e6a59f787586929c4d2920da20caeb384594d7f2b7e999dab0d6a1ac"); + CCBigNumRef output = CCCreateBigNum(&status); + + status = CCBigNumModExp(output, a, b, c); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected) == 0, "expected operation result"); + + CCBigNumFree(a); + CCBigNumFree(b); + CCBigNumFree(c); + CCBigNumFree(output); + CCBigNumFree(resultExpected); + return 0; +} + +static int testMod() +{ + CCStatus status; + + // Shift n right by 11 + CCBigNumRef a = CCBigNumFromHexString(&status, "c968e40c5304364b057425920b18cc358f254ddb0f42f84850d6deec46006b4a692e52b7c3bddead45f77f2c1be1c606521d8a24260429f362d65b57873dbf270e97e210b872e45e97cb4cd87977ad20491e53c48cf0e88da9a61312675a2527c86ac537740c5e4206972f09c0f91fa1c9f14a2cf1be07e82a3b6fd58dc12c3a"); + CCBigNumRef c = CCBigNumFromHexString(&status, "354c912b09ee7abff5b3d94ed52a9e8dcae582e094daa375c495f970710af73efcc4f9776010511f654c7408a6d5d351ab1d94a0fede757d782b54ddcf6fe8d714870b78b0e67a9754cb03a5cf63bbda1c71791902ea4527fb0cd76437391e5422c704ffb6d6018261171d8cee98adcf0243f1fd520fb3761afe94a2f4d99f94"); + CCBigNumRef resultExpected = CCBigNumFromHexString(&status, "2983308b3538c60b245899a58b98f08c2e74c53950b30de70314f29af2df858d72df6651a38ceb4f1612231227604c1150c4cc412968c97afa545cbe18ee04a1d102bfa6a5bf7498996a41e70b4c7991f3c9e87984321915b87f8ce5c1aeca2b6015b6384f8a59bae351d662f52f1634c3257434fb8eed85d93fb1ecaf344d7e"); + CCBigNumRef output = CCCreateBigNum(&status); + + status = CCBigNumMod(output, a, c); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected) == 0, "expected operation result"); + + CCBigNumFree(a); + CCBigNumFree(c); + CCBigNumFree(output); + CCBigNumFree(resultExpected); + return 0; +} + + +static int testModI() +{ + CCStatus status; + + // Shift n right by 11 + CCBigNumRef a = CCBigNumFromHexString(&status, "c968e40c5304364b057425920b18cc358f254ddb0f42f84850d6deec46006b4a692e52b7c3bddead45f77f2c1be1c606521d8a24260429f362d65b57873dbf270e97e210b872e45e97cb4cd87977ad20491e53c48cf0e88da9a61312675a2527c86ac537740c5e4206972f09c0f91fa1c9f14a2cf1be07e82a3b6fd58dc12c3a"); + uint32_t c=63; + uint32_t resultExpected = 23; + uint32_t output; + + status = CCBigNumModI(&output, a, c); + ok(status == 0, "operation completed"); + ok(resultExpected == output, "expected operation result"); + + CCBigNumFree(a); + return 0; +} + + +static int testMul() +{ + CCStatus status; + + // Shift n right by 11 + CCBigNumRef a = CCBigNumFromHexString(&status, "c968e40c5304364b057425920b18cc358f254ddb0f42f84850d6deec46006b4a692e52b7c3bddead45f77f2c1be1c606521d8a24260429f362d65b57873dbf270e97e210b872e45e97cb4cd87977ad20491e53c48cf0e88da9a61312675a2527c86ac537740c5e4206972f09c0f91fa1c9f14a2cf1be07e82a3b6fd58dc12c3a"); + CCBigNumRef c = CCBigNumFromHexString(&status, "354c912b09ee7abff5b3d94ed52a9e8dcae582e094daa375c495f970710af73efcc4f9776010511f654c7408a6d5d351ab1d94a0fede757d782b54ddcf6fe8d714870b78b0e67a9754cb03a5cf63bbda1c71791902ea4527fb0cd76437391e5422c704ffb6d6018261171d8cee98adcf0243f1fd520fb3761afe94a2f4d99f94"); + CCBigNumRef resultExpected = CCBigNumFromHexString(&status, "29eef49086721db0707b81175570af0db1517307f313564ff3a07f695514e92f525efea63ab5de4830c06b365f5c21cba747b96c6cb315d5b3dfa6642324e0a30f0a999acd196c1c78b99bff4d53e1e1e5d02b521a964a286279129e9bfbb51738743617a73f896bfd21e7c4c24e8f72a4a995781b0b4fa1b37a2320b935b0c5e130f27a65135ac4b7247db58e7f752550d92e08b177a84d5d0364cd8c74d4e2bb086d1cd9bc4c541e86ecf66940be30b73675a63921f9fd1fdfa6db57bd4b13304ac0ac84d64c262d5802a1363ee1d519f88b8ca0997a77f7ece081042d88814da526c44f1323c7ac5b7eeedccda0e28bc65bc415bba767d34f161ab34f9788"); + CCBigNumRef output = CCCreateBigNum(&status); + + status = CCBigNumMul(output, a, c); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected) == 0, "expected operation result"); + + CCBigNumFree(a); + CCBigNumFree(c); + CCBigNumFree(output); + CCBigNumFree(resultExpected); + return 0; +} + +static int testMulI() +{ + CCStatus status; + + // Shift n right by 11 + CCBigNumRef a = CCBigNumFromHexString(&status, "c968e40c5304364b057425920b18cc358f254ddb0f42f84850d6deec46006b4a692e52b7c3bddead45f77f2c1be1c606521d8a24260429f362d65b57873dbf270e97e210b872e45e97cb4cd87977ad20491e53c48cf0e88da9a61312675a2527c86ac537740c5e4206972f09c0f91fa1c9f14a2cf1be07e82a3b6fd58dc12c3a"); + uint32_t c = 63; + CCBigNumRef resultExpected = CCBigNumFromHexString(&status, "3190d01f086e095c7657953ef0bb1a412e3a2e28e8c17b19cbe4e0dc253a1a674fe2665b392bb9cca437e84bdadc8fbb8e3544fee55b0652e552c07a8a48320a9c9760a21d644633475b07e945e4739af1fe769d5eaf493adcbfdeb1876f2f24ca524688a58f0b323f9f3493667d4ec8d0b261410f7dc3f22264a0858de289e246"); + CCBigNumRef output = CCCreateBigNum(&status); + + status = CCBigNumMulI(output, a, c); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected) == 0, "expected operation result"); + + CCBigNumFree(a); + CCBigNumFree(output); + CCBigNumFree(resultExpected); + return 0; +} + +static int testPrime() +{ + CCStatus status; + + // Shift n right by 11 + CCBigNumRef a = CCBigNumFromHexString(&status, "09c75b"); + ok(CCBigNumIsPrime(&status, a), "prime number"); + CCBigNumRef b = CCBigNumFromHexString(&status, "09c75c"); + ok(!CCBigNumIsPrime(&status, b), "not prime number"); + + return 0; +} + + +static int testDiv() +{ + CCStatus status; + + // Shift n right by 11 + CCBigNumRef a = CCBigNumFromHexString(&status, "c968e40c5304364b057425920b18cc358f254ddb0f42f84850d6deec46006b4a692e52b7c3bddead45f77f2c1be1c606521d8a24260429f362d65b57873dbf270e97e210b872e45e97cb4cd87977ad20491e53c48cf0e88da9a61312675a2527c86ac537740c5e4206972f09c0f91fa1c9f14a2cf1be07e82a3b6fd58dc12c3a"); + CCBigNumRef c = CCBigNumFromHexString(&status, "354c912b09ee7abff5b3d94ed52a9e8dcae582e094daa375c495f970710af73efcc4f9776010511f654c7408a6d5d351ab1d94a0fede757d782b54ddcf6fe8d714870b78b0e67a9754cb03a5cf63bbda1c71791902ea4527fb0cd76437391e5422c704ffb6d6018261171d8cee98adcf0243f1fd520fb3761afe94a2f4d99f94"); + CCBigNumRef resultExpected = CCBigNumFromHexString(&status, "03"); + CCBigNumRef c2 = CCBigNumFromHexString(&status, "43"); // dec 67 + CCBigNumRef resultExpected2 = CCBigNumFromHexString(&status, "30190c6ded9da99f49e63e76ef8ba736d1f1fbaac2b0786cf88f03904dd9e4210da7b80d5121e11dea7fe13c3482557f99574b04cfc3dc2ad6a5d1097089039e578b6f4c9708551a690684fa61c8850b87e8acd70e8d970eb9b5086018ae5ceec10e08e33675949951d00b3ba487e8fc9b35cceffc985d96f6fb16e2c25456f"); + CCBigNumRef output = CCCreateBigNum(&status); + + status = CCBigNumDiv(output, NULL, a, c); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected) == 0, "expected operation result"); + + status = CCBigNumDiv(output, NULL, a, c2); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected2) == 0, "expected operation result"); + + CCBigNumFree(a); + CCBigNumFree(c); + CCBigNumFree(c2); + CCBigNumFree(output); + CCBigNumFree(resultExpected); + CCBigNumFree(resultExpected2); + return 0; +} + + +static int testMulMod() +{ + CCStatus status; + + // Shift n right by 11 + CCBigNumRef a = CCBigNumFromHexString(&status, "c968e40c5304364b057425920b18cc358f254ddb0f42f84850d6deec46006b4a692e52b7c3bddead45f77f2c1be1c606521d8a24260429f362d65b57873dbf270e97e210b872e45e97cb4cd87977ad20491e53c48cf0e88da9a61312675a2527c86ac537740c5e4206972f09c0f91fa1c9f14a2cf1be07e82a3b6fd58dc12c3a"); + CCBigNumRef c = CCBigNumFromHexString(&status, "354c912b09ee7abff5b3d94ed52a9e8dcae582e094daa375c495f970710af73efcc4f9776010511f654c7408a6d5d351ab1d94a0fede757d782b54ddcf6fe8d714870b78b0e67a9754cb03a5cf63bbda1c71791902ea4527fb0cd76437391e5422c704ffb6d6018261171d8cee98adcf0243f1fd520fb3761afe94a2f4d99f94"); + CCBigNumRef mod1 = CCBigNumFromHexString(&status, "912b09ee7abff5b3d94ed52a9e8dcae582e094daa375c495f970710af73efcc4f9776010511f654c7408a6d5d351ab1d94a0fede757d782b54ddcf6fe8d714870b78b0e67a9754cb03a5cf63bbda1c71791902ea4527fb0cd76437391e5422c704ffb6d6018261171d8cee98adcf0243f1fd520fb3761afe94a2f4d99f94"); + CCBigNumRef mod2 = CCBigNumFromHexString(&status, "43"); // dec 67 + CCBigNumRef resultExpected1 = CCBigNumFromHexString(&status, "57c1dfcd53105f1f653539172a789fc97067101320d12b93dd400eaad0bbb9d8d9857beeeae28c1ad0614075f1d59bb12556f78d85e4af9d2283fa5d3c192a03a59932dd537d4c1a9d74a8a2d647f266cc4fe9365c5c9b8ac4d5afc960002850243b2175eb09842d1f1cfd59bdd5c2564cb056586d2186aae39583061a88"); + CCBigNumRef resultExpected2 = CCBigNumFromHexString(&status, "3d"); + CCBigNumRef output = CCCreateBigNum(&status); + + status = CCBigNumMulMod(output, a, c, mod1); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected1) == 0, "expected operation result"); + + status = CCBigNumMulMod(output, a, c, mod2); + ok(status == 0, "operation completed"); + ok(CCBigNumCompare(output, resultExpected2) == 0, "expected operation result"); + + CCBigNumFree(a); + CCBigNumFree(c); + CCBigNumFree(output); + CCBigNumFree(resultExpected1); + CCBigNumFree(resultExpected2); + CCBigNumFree(mod1); + CCBigNumFree(mod2); + return 0; +} + + + + +int CommonBigNum(int argc, char *const *argv) { + + + plan_tests(kTestTestCount); + + for(int i=0; i<10; i++) { + testCreateFree(); + testHexString(); + testData(); + testI(); + testCompare(); + testBitCount(); + testAddSub(); + testAddSubI(); + testShift(); + testMod(); + testModI(); + testModExp(); + testMul(); + testMulI(); + testPrime(); + testDiv(); + testMulMod(); + } + + return 0; +} +#endif /* CCBigNum */ ADDED CCRegression/CommonCrypto/CommonCMac.c Index: CCRegression/CommonCrypto/CommonCMac.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCMac.c @@ -0,0 +1,71 @@ +// +// CCCMACtests.c +// CCRegressions +// + +#include +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" + +#if (CCCMAC == 0) +entryPoint(CommonCMac,"Common CMac") +#else + +#include + +static int +CMACTest(char *input, char *keystr, char *expected) +{ + byteBuffer mdBuf; + byteBuffer inputBytes, expectedBytes, keyBytes; + char *digestName; + char outbuf[160]; + int retval = 0; + + inputBytes = hexStringToBytes(input); + expectedBytes = hexStringToBytes(expected); + keyBytes = hexStringToBytes(keystr); + mdBuf = mallocByteBuffer(CC_CMACAES_DIGEST_LENGTH); digestName = "CMAC-AES"; + CCAESCmac(keyBytes->bytes, inputBytes->bytes, inputBytes->len, mdBuf->bytes); + + sprintf(outbuf, "Hmac-%s test for %s", digestName, input); + + ok(bytesAreEqual(mdBuf, expectedBytes), outbuf); + + if(!bytesAreEqual(mdBuf, expectedBytes)) { + diag("HMAC FAIL: HMAC-%s(\"%s\")\n expected %s\n got %s\n", digestName, input, expected, bytesToHexString(mdBuf)); + retval = 1; + } else { + // diag("HMAC PASS: HMAC-%s(\"%s\")\n", digestName, input); + } + + free(mdBuf); + free(expectedBytes); + free(keyBytes); + free(inputBytes); + return retval; +} + +static int kTestTestCount = 4; + +int CommonCMac (int argc, char *const *argv) { + char *strvalue, *keyvalue; + plan_tests(kTestTestCount); + int accum = 0; + + strvalue = ""; + keyvalue = "2b7e151628aed2a6abf7158809cf4f3c"; + accum |= CMACTest(strvalue, keyvalue, "bb1d6929e95937287fa37d129b756746"); + strvalue = "6bc1bee22e409f96e93d7e117393172a"; + accum |= CMACTest(strvalue, keyvalue, "070a16b46b4d4144f79bdd9dd04a287c"); + strvalue = "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411"; + accum |= CMACTest(strvalue, keyvalue, "dfa66747de9ae63030ca32611497c827"); + strvalue = "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710"; + accum |= CMACTest(strvalue, keyvalue, "51f0bebf7e3b9d92fc49741779363cfe"); + + return accum; +} +#endif + + ADDED CCRegression/CommonCrypto/CommonCryptoCTSPadding.c Index: CCRegression/CommonCrypto/CommonCryptoCTSPadding.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoCTSPadding.c @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#include +#include +#include +#include +#include "CCCryptorTestFuncs.h" +#include "testbyteBuffer.h" +#include "capabilities.h" +#include "testmore.h" + +#if (CCPADCTS == 0) +entryPoint(CommonCryptoCTSPadding,"CommonCrypto CTS Padding Testing") + +#else + +static int kTestTestCount = 9; + +int CommonCryptoCTSPadding(int argc, char *const *argv) +{ + char *keyStr; + char *iv; + char *plainText; + char *cipherText; + CCMode mode; + CCAlgorithm alg; + CCPadding padding; + int retval, accum = 0; + char *test; + + keyStr = "636869636b656e207465726979616b69"; + iv = "0f0e0d0c0b0a09080706050403020100"; + mode = kCCModeCBC; + alg = kCCAlgorithmAES128; + padding = ccCBCCTS1; + + plan_tests(kTestTestCount); + + test = "CTS1 Test - Length 64"; + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "e22abba9d2a201b18dc2f57e04aba21a16e0ed6358164c59ca64d204f33247ee2dc88b70f6ae0243d2dbcd6822a1058604b1c432a7a71395b36d820e2c3de4ee"; + diag(test); + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, test); + accum += retval; + + test = "CTS1 Test - Length 63"; + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "e22abba9d2a201b18dc2f57e04aba21a16e0ed6358164c59ca64d204f33247ee2dc88b70f6ae0243d2dbcd6822a105950b6576660739916d058623d688e27e"; + diag(test); + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, test); + accum += retval; + + test = "CTS1 Test - Length 57"; + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "e22abba9d2a201b18dc2f57e04aba21a16e0ed6358164c59ca64d204f33247ee2dc88b70f6ae0243d2db751002ef7a0f9d915d15346571eee7aa"; + diag(test); + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, test); + accum += retval; + + + padding = ccCBCCTS2; + + test = "CTS2 Test - Length 64"; + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "e22abba9d2a201b18dc2f57e04aba21a16e0ed6358164c59ca64d204f33247ee2dc88b70f6ae0243d2dbcd6822a1058604b1c432a7a71395b36d820e2c3de4ee"; + diag(test); + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, test); + accum += retval; + + test = "CTS2 Test - Length 63"; + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "e22abba9d2a201b18dc2f57e04aba21a16e0ed6358164c59ca64d204f33247ee950b6576660739916d058623d688e27e2dc88b70f6ae0243d2dbcd6822a105"; + diag(test); + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, test); + accum += retval; + + test = "CTS2 Test - Length 57"; + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "e22abba9d2a201b18dc2f57e04aba21a16e0ed6358164c59ca64d204f33247ee751002ef7a0f9d915d15346571eee7aa2dc88b70f6ae0243d2db"; + diag(test); + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, test); + accum += retval; + + padding = ccCBCCTS3; + + test = "CTS3 Test - Length 64"; + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "e22abba9d2a201b18dc2f57e04aba21a16e0ed6358164c59ca64d204f33247ee04b1c432a7a71395b36d820e2c3de4ee2dc88b70f6ae0243d2dbcd6822a10586"; + diag(test); + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, test); + accum += retval; + + test = "CTS3 Test - Length 63"; + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "e22abba9d2a201b18dc2f57e04aba21a16e0ed6358164c59ca64d204f33247ee950b6576660739916d058623d688e27e2dc88b70f6ae0243d2dbcd6822a105"; + diag(test); + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, test); + accum += retval; + + test = "CTS3 Test - Length 57"; + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "e22abba9d2a201b18dc2f57e04aba21a16e0ed6358164c59ca64d204f33247ee751002ef7a0f9d915d15346571eee7aa2dc88b70f6ae0243d2db"; + diag(test); + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, test); + accum += retval; + + + return accum != 0; +} +#endif ADDED CCRegression/CommonCrypto/CommonCryptoReset.c Index: CCRegression/CommonCrypto/CommonCryptoReset.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoReset.c @@ -0,0 +1,96 @@ +// +// CommonCryptoReset.c +// CommonCrypto +// +// Created by Richard Murphy on 2/10/12. +// Copyright (c) 2012 McKenzie-Murphy. All rights reserved. +// + +#include "capabilities.h" +#include +#include +#include +#include +#include "CCCryptorTestFuncs.h" +#include "testbyteBuffer.h" +#include "testmore.h" + + + + + +#if (CCRESET == 0) +entryPoint(CommonCryptoReset,"CommonCrypto Reset Testing") +#else + + + + +static int kTestTestCount = 13; + +int CommonCryptoReset(int argc, char *const *argv) +{ + CCCryptorRef cref; + CCCryptorStatus retval; + size_t moved; + uint8_t key[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; + uint8_t plain[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; + uint8_t nulliv[16]; + uint8_t cipher1[16], cipher2[16], cipher3[16], cipher4[16], cipher5[16], unused[16]; + + plan_tests(kTestTestCount); + + bzero(nulliv, 16); + + retval = CCCryptorCreateWithMode(kCCEncrypt, kCCModeCBC, kCCAlgorithmAES128, + ccNoPadding, NULL, key, 16, NULL, 0, 0, 0, &cref); + + ok(retval == kCCSuccess, "cryptor created"); + + retval = CCCryptorUpdate(cref, plain, 16, cipher1, 16, &moved); + + ok((retval == kCCSuccess && moved == 16), "first update"); + + retval = CCCryptorUpdate(cref, plain, 16, cipher2, 16, &moved); + + ok((retval == kCCSuccess && moved == 16), "second (chained) update"); + + ok(memcmp(cipher1, cipher2, 16) != 0, "chained crypts shouldn't be the same even with the same data"); + + retval = CCCryptorReset(cref, NULL); + + ok(retval == kCCSuccess, "cryptor NULL reset"); + + retval = CCCryptorUpdate(cref, plain, 16, cipher3, 16, &moved); + + ok((retval == kCCSuccess && moved == 16), "third update - NULL Reset"); + + ok(memcmp(cipher1, cipher3, 16) == 0, "reset crypt should be the same as the start"); + + retval = CCCryptorReset(cref, nulliv); + + ok(retval == kCCSuccess, "cryptor zero iv reset"); + + retval = CCCryptorUpdate(cref, plain, 16, cipher4, 16, &moved); + + ok((retval == kCCSuccess && moved == 16), "fourth update - zero iv Reset"); + + ok(memcmp(cipher1, cipher4, 16) == 0, "reset crypt should be the same as the start"); + + retval = CCCryptorUpdate(cref, plain, 16, cipher5, 16, &moved); + + ok((retval == kCCSuccess && moved == 16), "fifth (chained) update"); + + ok(memcmp(cipher2, cipher5, 16) == 0, "reset crypt should be the same as the second"); + + retval = CCCryptorFinal(cref, unused, 16, &moved); + + ok((retval == kCCSuccess && moved == 0), "Final - no work"); + + CCCryptorRelease(cref); + + return kCCSuccess; + +} + +#endif ADDED CCRegression/CommonCrypto/CommonCryptoSymCBC.c Index: CCRegression/CommonCrypto/CommonCryptoSymCBC.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoSymCBC.c @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * CBCTest.c + * CommonCrypto + */ + +#include +#include "CCCryptorTestFuncs.h" +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" + +#if (CCSYMCBC == 0) +entryPoint(CommonCryptoSymCBC,"CommonCrypto Symmetric CBC Testing") +#else + + +static int kTestTestCount = 28; + +int CommonCryptoSymCBC(int argc, char *const *argv) { + char *keyStr; + char *iv; + char *plainText; + char *cipherText; + CCAlgorithm alg; + CCOptions options; + int retval; + int accum = 0; + + keyStr = "000102030405060708090a0b0c0d0e0f"; + iv = "0f0e0d0c0b0a09080706050403020100"; + alg = kCCAlgorithmAES128; + options = kCCOptionPKCS7Padding; + + plan_tests(kTestTestCount); + + accum = (int) genRandomSize(1,10); + // 1 + plainText = "0a"; + cipherText = "a385b047a4108a8748bf96b435738213"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 1 byte CCCrypt"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 1 byte Multiple Updates"); + accum |= retval; + + // 15 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "324a44cf3395b14214861084019f9257"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 15 byte CCCrypt"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 15 byte Multiple Updates"); + accum |= retval; + + // 16 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "16d67a52c1e8384f7ed887c2011605346544febcf84574c334f1145d17567047"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 16 byte CCCrypt"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 16 byte Multiple Updates"); + accum |= retval; + + // 17 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "16d67a52c1e8384f7ed887c2011605348b72cecb00bbc00f328af6bb69085b02"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 17 byte CCCrypt"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 17 byte Multiple Updates"); + accum |= retval; + + // 31 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "16d67a52c1e8384f7ed887c2011605347175cf878a75bc1947ae79c6c6835030"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 31 byte CCCrypt"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 31 byte Multiple Updates"); + accum |= retval; + + // 32 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "16d67a52c1e8384f7ed887c20116053486869f3b83f3b3a83531e4169e97b7244a49199daa033fa88f07dd4be52ae78e"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 32 byte CCCrypt"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 32 byte Multiple Updates"); + accum |= retval; + + // 33 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "16d67a52c1e8384f7ed887c20116053486869f3b83f3b3a83531e4169e97b724d0080fb874dd556fa86b314acc4f597b"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 33 byte CCCrypt"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 33 byte Multiple Updates"); + accum |= retval; + + iv = NULL; + // 1 + plainText = "0a"; + cipherText = "27cae51ac763b250945fd805c937119b"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 1 byte CCCrypt NULL IV"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 1 byte Multiple Updates NULL IV"); + accum |= retval; + + // 15 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "feb9c3a005dcbd1e2630af742e988e81"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 15 byte CCCrypt NULL IV"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 15 byte Multiple Updates NULL IV"); + accum |= retval; + + // 16 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "d307b25d3abaf87c0053e8188152992a8b002a94911ee1e157d815a026cfadeb"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 16 byte CCCrypt NULL IV"); + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 16 byte Multiple Updates NULL IV"); + accum |= retval; + + // 17 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "d307b25d3abaf87c0053e8188152992ab8fe4130b613e93617b2eda2e0c5c678"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 17 byte CCCrypt NULL IV"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 17 byte Multiple Updates NULL IV"); + accum |= retval; + + // 31 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "d307b25d3abaf87c0053e8188152992a4157ad665141a79481f463357707f759"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 31 byte CCCrypt NULL IV"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 31 byte Multiple Updates NULL IV"); + accum |= retval; + + // 32 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "d307b25d3abaf87c0053e8188152992a923832530aa268661a6c1fa3c69d6a23dc6d5c0d7fa8127cfd601cae71b4c14f"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 32 byte CCCrypt NULL IV"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 32 byte Multiple Updates NULL IV"); + accum |= retval; + + // 33 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "d307b25d3abaf87c0053e8188152992a923832530aa268661a6c1fa3c69d6a2382178b537aa2946f7a4124ee33744edd"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 33 byte CCCrypt NULL IV"); + accum |= retval; + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + ok(retval == 0, "CBC with Padding 33 byte Multiple Updates NULL IV"); + accum |= retval; + + return accum != 0; +} +#endif + ADDED CCRegression/CommonCrypto/CommonCryptoSymCFB.c Index: CCRegression/CommonCrypto/CommonCryptoSymCFB.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoSymCFB.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#include +#include "CCCryptorTestFuncs.h" +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" + +#if (CCSYMCFB == 0) +entryPoint(CommonCryptoSymCFB,"CommonCrypto Symmetric CFB Testing") +#else +static int kTestTestCount = 5; + +int CommonCryptoSymCFB(int argc, char *const *argv) +{ + char *keyStr; + char *iv; + char *plainText; + char *cipherText; + CCMode mode; + CCAlgorithm alg; + CCPadding padding; + int retval, accum = 0; + + keyStr = "00000000000000000000000000000000"; + mode = kCCModeCFB; + alg = kCCAlgorithmAES128; + padding = ccNoPadding; + + plan_tests(kTestTestCount); + + plainText = "00000000000000000000000000000000"; + iv = "80000000000000000000000000000000"; + cipherText = "3ad78e726c1ec02b7ebfe92b23d9ec34"; + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, "CFB Test 1"); + accum += retval; + + plainText = "00000000000000000000000000000000"; + iv = "c0000000000000000000000000000000"; + cipherText = "aae5939c8efdf2f04e60b9fe7117b2c2"; + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, "CFB Test 2"); + accum += retval; + + plainText = "00000000000000000000000000000000"; + iv = "ffffffffffffffffffffffc000000000"; + cipherText = "90684a2ac55fe1ec2b8ebd5622520b73"; + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, "CFB Test 3"); + accum += retval; + + keyStr = "f36f40aeb3e20c19440081919df4ecb9"; + plainText = "5552ee4fbf25859cdfecf34742d640855c55a00a1c6aa571c322b4ddf561b6e110de0f9dbe6fd42ac687383928fc48f6680ed9332aa6bec2ffdb3e227fbac55f9847d93325bf5071c220c0a3dfeb38f214292d47b4acb7b0a597fe056f21eecb"; + iv = "cf75d0cae8dbce85e0bc0e58eb4e82c0"; + cipherText = "d579c0e622047e0efef9ddacc94be36450d09366e38ea9e4ed3c2e39923f580fdc436a874e34fb39330f8a8a7bf1f68d8a93644a2b9d1fed260eb6e7c8ac874d616ec02b57d08f043aae552fc52bf11eb4a4ed5918ff81738b3ea3ce244c9cd1"; + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, "CFB Test 4"); + accum += retval; + + keyStr = "02f5f980a3c6af2984c9eed684f5224f"; + plainText = "cb9056b3c195cef43da2634271f2f34e556868ac41d0ea35bb6854aa8e9fe49a1c1c3685f4027341a773c69dd8530f45934edce5e01c95919703f665759ec26870deb6b6484ebcdf5f9b628aca538a5ea8ed6322b20a982214fac7d57c8234be70dcbf90e40013950c2221506f7ccd623d4de6aae2225cb0db54ad44c8d2a162c3203759f1a0df2c5611e939ee553e18f9774ec696ec4903931992f88416711d"; + iv = "7844c96a2c65e9c334573b9894d91046"; + cipherText = "227d8e80650e60c1c9e9ab2f8fe8bc24185725f1f1b8e326b73c04501e91995d5a7be17d0c74ce1cd2d5a3d917738dea486fb523297aea2badc6f8766ffdfcc6e8efd640a8d5d1f55d1e4fe4f03bb9f66956eaa9864ee760d1ad3e5faaae6da36476c55d1f25d7c064b9c518ce5b3f42ecdb1c3ef57c7b3fa3ef188218d0d0c417056935bcc76a90ff277f9e698ff9a599ebaa6c2723288c9f0817694e400ce6"; + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, "CFB Test 5"); + accum += retval; + + keyStr = "e0000000000000000000000000000000"; + iv = NULL; + plainText = "00000000000000000000000000000000"; + cipherText = "72a1da770f5d7ac4c9ef94d822affd97"; + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, "CFB Test NULLIV"); + accum += retval; + + + return accum != 0; +} +#endif ADDED CCRegression/CommonCrypto/CommonCryptoSymCTR.c Index: CCRegression/CommonCrypto/CommonCryptoSymCTR.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoSymCTR.c @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#include +#include +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" + +#if (CCSYMCTR == 0) +entryPoint(CommonCryptoSymCTR,"CommonCrypto Symmetric CTR Testing") +#else +static int kTestTestCount = 10; + +static CCCryptorStatus doCrypt(char *in, char *out, CCCryptorRef cryptor) { + byteBuffer inbb = hexStringToBytes(in); + byteBuffer outbb = hexStringToBytes(out); + byteBuffer buf = mallocByteBuffer(64); + CCCryptorStatus retval = CCCryptorUpdate(cryptor, inbb->bytes, inbb->len, buf->bytes, buf->len, &buf->len); + if(!retval) { + ok(bytesAreEqual(outbb, buf), "crypt results are equal"); + } + return retval; +} + +int CommonCryptoSymCTR(int argc, char *const *argv) +{ + CCCryptorStatus retval; + CCCryptorRef cryptor; + + plan_tests(kTestTestCount); + + byteBuffer key = hexStringToBytes("2b7e151628aed2a6abf7158809cf4f3c"); + byteBuffer counter = hexStringToBytes("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"); + + retval = CCCryptorCreateWithMode(kCCEncrypt, kCCModeCTR, kCCAlgorithmAES128, + ccNoPadding, counter->bytes, key->bytes, key->len, + NULL, 0, 0, kCCModeOptionCTR_LE, &cryptor); + + + ok(retval == kCCUnimplemented, "CTR Mode Encrypt unavailable for kCCModeOptionCTR_LE"); + + retval = CCCryptorCreateWithMode(kCCEncrypt, kCCModeCTR, kCCAlgorithmAES128, + ccNoPadding, counter->bytes, key->bytes, key->len, + NULL, 0, 0, kCCModeOptionCTR_BE, &cryptor); + + ok(retval == kCCSuccess, "CTR Mode Encrypt"); + + retval = doCrypt("6bc1bee22e409f96e93d7e117393172a", + "874d6191b620e3261bef6864990db6ce", + cryptor); + + + ok(retval == kCCSuccess, "CTR Mode Encrypt"); + + retval = doCrypt("ae2d8a571e03ac9c9eb76fac45af8e51", + "9806f66b7970fdff8617187bb9fffdff", + cryptor); + + + ok(retval == kCCSuccess, "CTR Mode Encrypt"); + + retval = doCrypt("30c81c46a35ce411e5fbc1191a0a52ef", + "5ae4df3edbd5d35e5b4f09020db03eab", + cryptor); + + ok(retval == kCCSuccess, "CTR Mode Encrypt"); + + retval = doCrypt("f69f2445df4f9b17ad2b417be66c3710", + "1e031dda2fbe03d1792170a0f3009cee", + cryptor); + + ok(retval == kCCSuccess, "CTR Mode Encrypt"); + + + return 0; +} +#endif ADDED CCRegression/CommonCrypto/CommonCryptoSymGCM.c Index: CCRegression/CommonCrypto/CommonCryptoSymGCM.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoSymGCM.c @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * CCGCMTest.c + * CommonCrypto + */ + +#include "capabilities.h" +#include +#include +#include +#include "CCCryptorTestFuncs.h" +#include "testbyteBuffer.h" +#include "testmore.h" + +#if (CCSYMGCM == 0) +entryPoint(CommonCryptoSymGCM,"CommonCrypto Symmetric GCM Testing") +#else + + + + +static int kTestTestCount = 7; + +int CommonCryptoSymGCM(int argc, char *const *argv) { + char *keyStr; + char *iv; + char *plainText; + char *cipherText; + char *adata; + char *tag; + CCAlgorithm alg; + int retval, accum = 0; + + alg = kCCAlgorithmAES128; + + plan_tests(kTestTestCount); + + /* testcase #1 */ + + keyStr = "00000000000000000000000000000000"; + adata = ""; + iv = "000000000000000000000000"; + plainText = ""; + cipherText = ""; + tag = "58e2fccefa7e3061367f1d57a4e7455a"; + + retval = CCCryptorGCMTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + retval = CCCryptorGCMDiscreetTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + + ok(retval == 0, "AES-GCM Testcase 1"); + accum += retval; + + /* testcase #2 */ + + keyStr = "00000000000000000000000000000000"; + adata = ""; + iv = "000000000000000000000000"; + plainText = "00000000000000000000000000000000"; + cipherText = "0388dace60b6a392f328c2b971b2fe78"; + tag = "ab6e47d42cec13bdf53a67b21257bddf"; + + retval = CCCryptorGCMTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + retval = CCCryptorGCMDiscreetTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + ok(retval == 0, "AES-GCM Testcase 2"); + accum += retval; + + /* testcase #3 */ + + keyStr = "feffe9928665731c6d6a8f9467308308"; + adata = ""; + iv = "cafebabefacedbaddecaf888"; + plainText = "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255"; + cipherText = "42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091473f5985"; + tag = "4d5c2af327cd64a62cf35abd2ba6fab4"; + + retval = CCCryptorGCMTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + retval = CCCryptorGCMDiscreetTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + ok(retval == 0, "AES-GCM Testcase 3"); + accum += retval; + + /* testcase #4 */ + + keyStr = "feffe9928665731c6d6a8f9467308308"; + adata = "feedfacedeadbeeffeedfacedeadbeefabaddad2"; + iv = "cafebabefacedbaddecaf888"; + plainText = "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39"; + cipherText = "42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091"; + tag = "5bc94fbc3221a5db94fae95ae7121a47"; + + retval = CCCryptorGCMTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + retval = CCCryptorGCMDiscreetTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + ok(retval == 0, "AES-GCM Testcase 4"); + accum += retval; + + /* testcase #5 */ + + keyStr = "feffe9928665731c6d6a8f9467308308"; + adata = "feedfacedeadbeeffeedfacedeadbeefabaddad2"; + iv = "cafebabefacedbad"; + plainText = "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39"; + cipherText = "61353b4c2806934a777ff51fa22a4755699b2a714fcdc6f83766e5f97b6c742373806900e49f24b22b097544d4896b424989b5e1ebac0f07c23f4598"; + tag = "3612d2e79e3b0785561be14aaca2fccb"; + + retval = CCCryptorGCMTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + retval = CCCryptorGCMDiscreetTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + ok(retval == 0, "AES-GCM Testcase 5"); + accum += retval; + + /* testcase #6 */ + + keyStr = "feffe9928665731c6d6a8f9467308308"; + adata = "feedfacedeadbeeffeedfacedeadbeefabaddad2"; + iv = "9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b"; + plainText = "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39"; + cipherText = "8ce24998625615b603a033aca13fb894be9112a5c3a211a8ba262a3cca7e2ca701e4a9a4fba43c90ccdcb281d48c7c6fd62875d2aca417034c34aee5"; + tag = "619cc5aefffe0bfa462af43c1699d050"; + + retval = CCCryptorGCMTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + retval = CCCryptorGCMDiscreetTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + ok(retval == 0, "AES-GCM Testcase 6"); + accum += retval; + + /* testcase #46 from BG (catchestheLTCbugofv1.15) */ + keyStr = "00000000000000000000000000000000"; + adata = "688e1aa984de926dc7b4c47f44"; + iv = "b72138b5a05ff5070e8cd94183f761d8"; + plainText = "a2aab3ad8b17acdda288426cd7c429b7ca86b7aca05809c70ce82db25711cb5302eb2743b036f3d750d6cf0dc0acb92950d546db308f93b4ff244afa9dc72bcd758d2c"; + cipherText = "cbc8d2f15481a4cc7dd1e19aaa83de5678483ec359ae7dec2ab8d534e0906f4b4663faff58a8b2d733b845eef7c9b331e9e10eb2612c995feb1ac15a6286cce8b297a8"; + tag = "8d2d2a9372626f6bee8580276a6366bf"; + + retval = CCCryptorGCMTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + retval = CCCryptorGCMDiscreetTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + ok(retval == 0, "AES-GCM Testcase 7"); + accum += retval; + + /* testcase #8 - #1 with NULL IV and AAD */ + + keyStr = "00000000000000000000000000000000"; + adata = ""; + iv = ""; + plainText = ""; + cipherText = ""; + tag = "66e94bd4ef8a2c3b884cfa59ca342b2e"; + + retval = CCCryptorGCMTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + retval = CCCryptorGCMDiscreetTestCase(keyStr, iv, adata, tag, alg, cipherText, plainText); + + + return accum != 0; +} +#endif + ADDED CCRegression/CommonCrypto/CommonCryptoSymOFB.c Index: CCRegression/CommonCrypto/CommonCryptoSymOFB.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoSymOFB.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#include +#include "CCCryptorTestFuncs.h" +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" + +#if (CCSYMOFB == 0) +entryPoint(CommonCryptoSymOFB,"CommonCrypto Symmetric OFB Testing") +#else +static int kTestTestCount = 5; + +int CommonCryptoSymOFB(int argc, char *const *argv) +{ + char *keyStr; + char *iv; + char *plainText; + char *cipherText; + CCMode mode; + CCAlgorithm alg; + CCPadding padding; + int retval, accum = 0; + + keyStr = "000102030405060708090a0b0c0d0e0f"; + iv = "0f0e0d0c0b0a09080706050403020100"; + mode = kCCModeOFB; + alg = kCCAlgorithmAES128; + padding = ccNoPadding; + + plan_tests(kTestTestCount); + + // 1 + plainText = "0a"; + cipherText = "2a"; + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, "OFB Mode single byte"); + accum += retval; + + // 15 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "2aa3f398be4651e20e15f6d666a493a"; + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, "OFB Mode 15 byte"); + accum += retval; + + // 16 + plainText = "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a"; + cipherText = "2aa3f398be4651e20e15f6d666a49360a"; + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, "OFB Mode single byte"); + accum += retval; + + // from OFBVarTxt256e KAT test 1 + keyStr = "0000000000000000000000000000000000000000000000000000000000000000"; + iv = "80000000000000000000000000000000"; + mode = kCCModeOFB; + alg = kCCAlgorithmAES128; + padding = ccNoPadding; + plainText = "00000000000000000000000000000000"; + cipherText = "ddc6bf790c15760d8d9aeb6f9a75fd4e"; + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, "OFB Mode OFBVarTxt256e KAT test 1"); + accum += retval; + + // from OFBVarTxt256e KAT test 13 + keyStr = "0000000000000000000000000000000000000000000000000000000000000000"; + iv = "fffc0000000000000000000000000000"; + mode = kCCModeOFB; + alg = kCCAlgorithmAES128; + padding = ccNoPadding; + plainText = "00000000000000000000000000000000"; + cipherText = "dc8f0e4915fd81ba70a331310882f6da"; + retval = CCModeTestCase(keyStr, iv, mode, alg, padding, cipherText, plainText); + ok(retval == 0, "OFB Mode OFBVarTxt256e KAT test 13"); + accum += retval; + + return accum != 0; +} +#endif ADDED CCRegression/CommonCrypto/CommonCryptoSymOffset.c Index: CCRegression/CommonCrypto/CommonCryptoSymOffset.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoSymOffset.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * CCSymOffset.c + * CommonCrypto + */ + +#include +#include +#include +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" + +#if (CCSYMOFFSET == 0) +entryPoint(CommonCryptoSymOffset,"CommonCrypto Symmetric Unaligned Testing") +#else + + + +#define ILIKEEMDISBIG 4096 +#define ALITTLEONTHESIDE 5 + + +static int kTestTestCount = ALITTLEONTHESIDE; + + +int CommonCryptoSymOffset(int argc, char *const *argv) { + int accum = 0; + uint8_t iLikeBigBuffs[ILIKEEMDISBIG]; + uint8_t andICannotLie[ILIKEEMDISBIG]; + uint8_t iLikeEmRoundandBig[ILIKEEMDISBIG]; + int i; + size_t moved; + CCCryptorStatus retval; + byteBuffer key = hexStringToBytes("010203040506070809000a0b0c0d0e0f"); + + plan_tests(kTestTestCount); + + + for(i=0; ibytes, key->len, NULL, iLikeBigBuffs+i, ILIKEEMDISBIG-16, andICannotLie+i, ILIKEEMDISBIG, &moved); + retval = CCCrypt(kCCDecrypt, kCCAlgorithmAES128, 0, key->bytes, key->len, NULL, andICannotLie+i, moved, iLikeEmRoundandBig+i, ILIKEEMDISBIG, &moved); + if(moved != (ILIKEEMDISBIG-16)) + retval = 99; + else if(memcmp(iLikeBigBuffs+i, iLikeEmRoundandBig+i, moved)) + retval = 999; + ok(retval == 0, "Encrypt/Decrypt Cycle"); + accum += retval; + } + + return accum != 0; +} +#endif + ADDED CCRegression/CommonCrypto/CommonCryptoSymRC2.c Index: CCRegression/CommonCrypto/CommonCryptoSymRC2.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoSymRC2.c @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * CCRC2KAT.c + * CCRegressions + * + */ + +#include +#include "CCCryptorTestFuncs.h" +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" + +#if (CCSYMRC2 == 0) +entryPoint(CommonCryptoSymRC2,"Common Crypto RC2 Test") +#else + + +#ifdef WEIRDCASE +static int kTestTestCount = 12; +#else +static int kTestTestCount = 8; +#endif + + +int CommonCryptoSymRC2(int argc, char *const *argv) { + char *keyStr; + char *iv; + char *plainText; + char *cipherText; + CCAlgorithm alg; + CCOptions options; + int retval; + int rkeylen, ekeylenBits; + char printString[128]; + + alg = kCCAlgorithmRC2; + iv = NULL; + options = 0; + plan_tests(kTestTestCount); + + rkeylen = 8; + ekeylenBits = 63; + keyStr = "0000000000000000"; + plainText = "0000000000000000"; + cipherText = "ebb773f993278eff"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) One-Shot", rkeylen, ekeylenBits); + ok(retval == 0, printString); + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) Multi", rkeylen, ekeylenBits); + ok(retval == 0, printString); + + rkeylen = 8; + ekeylenBits = 64; + keyStr = "ffffffffffffffff"; + plainText = "ffffffffffffffff"; + cipherText = "278b27e42e2f0d49"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) One-Shot", rkeylen, ekeylenBits); + ok(retval == 0, printString); + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) Multi", rkeylen, ekeylenBits); + ok(retval == 0, printString); + + rkeylen = 8; + ekeylenBits = 64; + keyStr = "3000000000000000"; + plainText = "1000000000000001"; + cipherText = "30649edf9be7d2c2"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) One-Shot", rkeylen, ekeylenBits); + ok(retval == 0, printString); + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) Multi", rkeylen, ekeylenBits); + ok(retval == 0, printString); + +#ifdef WEIRDCASE + rkeylen = 1; + ekeylenBits = 64; + keyStr = "88"; + plainText = "0000000000000000"; + cipherText = "61a8a244adacccf0"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) One-Shot", rkeylen, ekeylenBits); + ok(retval == 0, printString); + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) Multi", rkeylen, ekeylenBits); + ok(retval == 0, printString); + + rkeylen = 7; + ekeylenBits = 64; + keyStr = "88bca90e90875a"; + plainText = "0000000000000000"; + cipherText = "6ccf4308974c267f"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) One-Shot", rkeylen, ekeylenBits); + ok(retval == 0, printString); + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) Multi", rkeylen, ekeylenBits); + ok(retval == 0, printString); + + rkeylen = 16; + ekeylenBits = 64; + keyStr = "88bca90e90875a7f0f79c384627bafb2"; + plainText = "0000000000000000"; + cipherText = "1a807d272bbe5db1"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) One-Shot", rkeylen, ekeylenBits); + ok(retval == 0, printString); + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) Multi", rkeylen, ekeylenBits); + ok(retval == 0, printString); +#endif + + rkeylen = 16; + ekeylenBits = 128; + keyStr = "88bca90e90875a7f0f79c384627bafb2"; + plainText = "0000000000000000"; + cipherText = "2269552ab0f85ca6"; + retval = CCCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) One-Shot", rkeylen, ekeylenBits); + ok(retval == 0, printString); + retval = CCMultiCryptTestCase(keyStr, iv, alg, options, cipherText, plainText); + sprintf(printString, "RC2 %d byte Key (effective %d bits) Multi", rkeylen, ekeylenBits); + ok(retval == 0, printString); + + + return 0; +} +#endif ADDED CCRegression/CommonCrypto/CommonCryptoSymRegression.c Index: CCRegression/CommonCrypto/CommonCryptoSymRegression.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoSymRegression.c @@ -0,0 +1,714 @@ +/* Copyright 2006 Apple Computer, Inc. + * + * ccSymTest.c - test CommonCrypto symmetric encrypt/decrypt. + */ +#include "testmore.h" +#include "capabilities.h" +#if (CCSYMREGRESSION == 0) +entryPoint(CommonCryptoSymRegression,"CommonCrypto Base Behavior Regression Tests") +#else + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// #include + +/* + * Defaults. + */ +#define LOOPS_DEF 500 +#define MIN_DATA_SIZE 8 +#define MAX_DATA_SIZE 10000 /* bytes */ +#define MAX_KEY_SIZE kCCKeySizeMaxRC4 /* bytes */ +#define MAX_BLOCK_SIZE kCCBlockSizeAES128 /* bytes */ +#define LOOP_NOTIFY 250 + +/* + * Enumerate algs our own way to allow iteration. + */ +typedef enum { + ALG_AES_128 = 1, /* 128 bit block, 128 bit key */ + ALG_AES_192, /* 128 bit block, 192 bit key */ + ALG_AES_256, /* 128 bit block, 256 bit key */ + ALG_DES, + ALG_3DES, + ALG_CAST, + ALG_RC4, + /* these aren't in CommonCrypto (yet?) */ + ALG_RC2, + ALG_RC5, + ALG_BFISH, + ALG_ASC, + ALG_NULL /* normally not used */ +} SymAlg; +#define ALG_FIRST ALG_AES_128 +#define ALG_LAST ALG_RC4 + + +#define LOG_SIZE 0 +#if LOG_SIZE +#define logSize(s) diag s +#else +#define logSize(s) +#endif + + + + +static void +appGetRandomBytes(void *keyBytes, size_t keySizeInBytes) +{ + int fd; + + if((fd = open("/dev/random", O_RDONLY)) < 0) { + diag("Can't open Random\n"); + exit(0); + } + if(read(fd, keyBytes, keySizeInBytes) != keySizeInBytes) { + diag("Can't read Random\n"); + exit(0); + } + close(fd); +} + +/* min <= return <= max */ +static unsigned +genRand(unsigned min, unsigned max) +{ + unsigned i; + if(min == max) { + return min; + } + appGetRandomBytes(&i, 4); + return (min + (i % (max - min + 1))); +} + + +static void printCCError(const char *str, CCCryptorStatus crtn) +{ + const char *errStr; + char unknownStr[200]; + + switch(crtn) { + case kCCSuccess: errStr = "kCCSuccess"; break; + case kCCParamError: errStr = "kCCParamError"; break; + case kCCBufferTooSmall: errStr = "kCCBufferTooSmall"; break; + case kCCMemoryFailure: errStr = "kCCMemoryFailure"; break; + case kCCAlignmentError: errStr = "kCCAlignmentError"; break; + case kCCDecodeError: errStr = "kCCDecodeError"; break; + case kCCUnimplemented: errStr = "kCCUnimplemented"; break; + default: + sprintf(unknownStr, "Unknown(%ld)\n", (long)crtn); + errStr = unknownStr; + break; + } + diag("***%s returned %s\n", str, errStr); +} + +/* max context size */ +#define CC_MAX_CTX_SIZE kCCContextSizeRC4 + +/* + * We write a marker at end of expected output and at end of caller-allocated + * CCCryptorRef, and check at the end to make sure they weren't written + */ +#define MARKER_LENGTH 8 +#define MARKER_BYTE 0x7e + +/* + * Test harness for CCCryptor with lots of options. + */ +static CCCryptorStatus doCCCrypt( + bool forEncrypt, + CCAlgorithm encrAlg, + bool doCbc, + bool doPadding, + const void *keyBytes, size_t keyLen, + const void *iv, + bool randUpdates, + bool inPlace, /* !doPadding only */ + size_t ctxSize, /* if nonzero, we allocate ctx */ + bool askOutSize, + const uint8_t *inText, size_t inTextLen, + uint8_t **outText, size_t *outTextLen) /* both returned, WE malloc */ +{ + CCCryptorRef cryptor = NULL; + CCCryptorStatus crtn; + CCOperation op = forEncrypt ? kCCEncrypt : kCCDecrypt; + CCOptions options = 0; + uint8_t *outBuf = NULL; /* mallocd output buffer */ + uint8_t *outp; /* running ptr into outBuf */ + const uint8_t *inp; /* running ptr into inText */ + size_t outLen = 0; /* bytes remaining in outBuf */ + size_t toMove; /* bytes remaining in inText */ + size_t thisMoveOut; /* output from CCCryptUpdate()/CCCryptFinal() */ + size_t outBytes; /* total bytes actually produced in outBuf */ + char ctx[CC_MAX_CTX_SIZE]; /* for CCCryptorCreateFromData() */ + uint8_t *textMarker = NULL; /* 8 bytes of marker here after expected end of + * output */ + char *ctxMarker = NULL; /* ditto for caller-provided context */ + unsigned dex; + size_t askedOutSize; /* from the lib */ + size_t thisOutLen; /* dataOutAvailable we use */ + + + if(0) diag("%s %s %s keylen %d %s %s %s %s %s input length %ld\n", + forEncrypt ? "Encrypting": "Decrypting", + doCbc ? "CBC": "ECB", + doPadding ? "Padding ON": "Padding OFF", + (int) keyLen, + iv ? "IV Provided": "No IV Provided", + randUpdates ? "Random Updates": "Non-Random Updates", + inPlace ? "In Place": "Separate Buffers", + ctxSize ? "We Allocate": "CC Allocated", + askOutSize ? "Ask OutSize": "Don't Ask OutSize", + inTextLen); + + if(ctxSize > CC_MAX_CTX_SIZE) { + diag("***HEY! Adjust CC_MAX_CTX_SIZE!\n"); + exit(1); + } + if(!doCbc) { + options |= kCCOptionECBMode; + } + if(doPadding) { + options |= kCCOptionPKCS7Padding; + } + + /* just hack this one */ + outLen = inTextLen; + if(forEncrypt) { + outLen += MAX_BLOCK_SIZE; + } + + outBuf = (uint8_t *)malloc(outLen + MARKER_LENGTH); + memset(outBuf, 0xEE, outLen + MARKER_LENGTH); + + /* library should not touch this memory */ + textMarker = outBuf + outLen; + memset(textMarker, MARKER_BYTE, MARKER_LENGTH); + + /* subsequent errors to errOut: */ + + if(inPlace) { + memmove(outBuf, inText, inTextLen); + inp = outBuf; + } + else { + inp = inText; + } + + if(!randUpdates) { + /* one shot */ + if(askOutSize) { + crtn = CCCrypt(op, encrAlg, options, + keyBytes, keyLen, iv, + inp, inTextLen, + outBuf, 0, &askedOutSize); + if(crtn != kCCBufferTooSmall) { + diag("***Did not get kCCBufferTooSmall as expected\n"); + diag(" alg %d inTextLen %lu cbc %d padding %d keyLen %lu\n", + (int)encrAlg, (unsigned long)inTextLen, (int)doCbc, (int)doPadding, + (unsigned long)keyLen); + printCCError("CCCrypt", crtn); + crtn = -1; + goto errOut; + } + outLen = askedOutSize; + } + crtn = CCCrypt(op, encrAlg, options, + keyBytes, keyLen, iv, + inp, inTextLen, + outBuf, outLen, &outLen); + if(crtn) { + printCCError("CCCrypt", crtn); + goto errOut; + } + *outText = outBuf; + *outTextLen = outLen; + goto errOut; + } + + /* random multi updates */ + if(ctxSize) { + size_t ctxSizeCreated; + + if(askOutSize) { + crtn = CCCryptorCreateFromData(op, encrAlg, options, + keyBytes, keyLen, iv, + ctx, 0 /* ctxSize */, + &cryptor, &askedOutSize); + if(crtn != kCCBufferTooSmall) { + diag("***Did not get kCCBufferTooSmall as expected\n"); + printCCError("CCCryptorCreateFromData", crtn); + crtn = -1; + goto errOut; + } + ctxSize = askedOutSize; + } + crtn = CCCryptorCreateFromData(op, encrAlg, options, + keyBytes, keyLen, iv, + ctx, ctxSize, &cryptor, &ctxSizeCreated); + if(crtn) { + printCCError("CCCryptorCreateFromData", crtn); + return crtn; + } + ctxMarker = ctx + ctxSizeCreated; + memset(ctxMarker, MARKER_BYTE, MARKER_LENGTH); + } + else { + crtn = CCCryptorCreate(op, encrAlg, options, + keyBytes, keyLen, iv, + &cryptor); + if(crtn) { + printCCError("CCCryptorCreate", crtn); + return crtn; + } + } + + toMove = inTextLen; /* total to go */ + outp = outBuf; + outBytes = 0; /* bytes actually produced in outBuf */ + + while(toMove) { + size_t thisMoveIn; /* input to CCryptUpdate() */ + + thisMoveIn = (size_t) genRand(1, (unsigned int) toMove); + logSize(("###ptext segment len %lu\n", (unsigned long)thisMoveIn)); + if(askOutSize) { + thisOutLen = CCCryptorGetOutputLength(cryptor, thisMoveIn, false); + } + else { + thisOutLen = outLen; + } + crtn = CCCryptorUpdate(cryptor, inp, thisMoveIn, + outp, thisOutLen, &thisMoveOut); + if(crtn) { + printCCError("CCCryptorUpdate", crtn); + goto errOut; + } + inp += thisMoveIn; + toMove -= thisMoveIn; + outp += thisMoveOut; + outLen -= thisMoveOut; + outBytes += thisMoveOut; + } + + if(doPadding) { + /* Final is not needed if padding is disabled */ + if(askOutSize) { + thisOutLen = CCCryptorGetOutputLength(cryptor, 0, true); + } + else { + thisOutLen = outLen; + } + crtn = CCCryptorFinal(cryptor, outp, thisOutLen, &thisMoveOut); + } + else { + thisMoveOut = 0; + crtn = kCCSuccess; + } + + if(crtn) { + printCCError("CCCryptorFinal", crtn); + goto errOut; + } + + outBytes += thisMoveOut; + *outText = outBuf; + *outTextLen = outBytes; + crtn = kCCSuccess; + + for(dex=0; dex 31) { + diag("We don't have that many bits\n"); + exit(1); + } + unsigned mask = 1 << bit; + return (word & mask) ? true : false; +} + + +static int kTestTestCount = 1; + + +int CommonCryptoSymRegression(int argc, char *const *argv) +{ + unsigned loop; + uint8_t *ptext; + size_t ptextLen; + bool stagedEncr = false; + bool stagedDecr = false; + bool doPadding; + bool doCbc = false; + bool nullIV; + const char *algStr; + CCAlgorithm encrAlg; + int i; + int currAlg; // ALG_xxx + uint32_t minKeySizeInBytes; + uint32_t maxKeySizeInBytes; + uint32_t keySizeInBytes = 0; + int rtn = 0; + uint32_t blockSize; // for noPadding case + size_t ctxSize; // always set per alg + size_t ctxSizeUsed; // passed to doTest + bool askOutSize; // inquire output size each op + + /* + * User-spec'd params + */ + bool keySizeSpec = false; // false: use rand key size + SymAlg minAlg = ALG_FIRST; + SymAlg maxAlg = ALG_LAST; + unsigned loops = LOOPS_DEF; + bool verbose = false; + size_t minPtextSize = MIN_DATA_SIZE; + size_t maxPtextSize = MAX_DATA_SIZE; + bool quiet = true; + unsigned pauseInterval = 0; + bool paddingSpec = false; // true: user calls doPadding, const + bool cbcSpec = false; // ditto for doCbc + bool stagedSpec = false; // ditto for stagedEncr and stagedDecr + bool inPlace = false; // en/decrypt in place for ECB + bool allocCtxSpec = false; // use allocCtx + bool allocCtx = false; // allocate context ourself + + plan_tests(kTestTestCount); + + + ptext = (uint8_t *)malloc(maxPtextSize); + if(ptext == NULL) { + diag("Insufficient heap space\n"); + exit(1); + } + /* ptext length set in test loop */ + + if(!quiet) diag("Starting ccSymTest; args: "); + for(i=1; i +#include +#include +#include "CCCryptorTestFuncs.h" +#include "testbyteBuffer.h" +#include "testmore.h" + +#if (CCSYMXTS == 0) +entryPoint(CommonCryptoSymXTS,"CommonCrypto Symmetric XTS Testing") +#else + +static int kTestTestCount = 1000; + +/* + # CAVS 9.0 + # XTSGen information for "sample"; + # State tested: Encrypt/Decrypt + # combinedKey Length: AES128 + # Data Unit Lengths Tested: 128 256 192 576 4096 + # Generated on Wed Mar 31 11:08:59 2010 + */ + +#define ENCRYPT 0 +#define DECRYPT 1 + + +static void +doXTSTestCase(int caseNumber, int direction, int dataLenBits, char *ivStr, char *cipherText, char *plainText, char *combinedKey) +{ + char keyString[65], twkString[65]; + int ckLen, keyLength; + byteBuffer key, tweak, iv; + byteBuffer pt, ct; + CCCryptorRef encCryptorRef; + CCCryptorStatus retval; + char dataOut[4096]; + int dataLen; + + dataLen = dataLenBits / 8; + ckLen = strlen(combinedKey)/2; + strncpy(keyString, combinedKey, ckLen); + keyString[ckLen] = 0; + strncpy(twkString, combinedKey+ckLen, ckLen); + twkString[ckLen] = 0; + + keyLength = ckLen/2; + + key = hexStringToBytes(keyString); + tweak = hexStringToBytes(twkString); + iv = hexStringToBytes(ivStr); + + pt = hexStringToBytes(plainText); + ct = hexStringToBytes(cipherText); + + if((retval = CCCryptorCreateWithMode(0, kCCModeXTS, kCCAlgorithmAES128, ccDefaultPadding, NULL, key->bytes, key->len, tweak->bytes, tweak->len, 0, 0, &encCryptorRef)) == kCCSuccess) { + if(direction == ENCRYPT) { + if((retval = CCCryptorEncryptDataBlock(encCryptorRef, iv->bytes, pt->bytes, dataLen, dataOut)) == kCCSuccess) { + byteBuffer output = bytesToBytes(dataOut, dataLen); + ok(bytesAreEqual(output, ct), "Bytes are Equal to expected value"); + free(output); + } else printf("Failed to encrypt %d\n", retval); + + } else { + if((retval = CCCryptorDecryptDataBlock(encCryptorRef, iv->bytes, ct->bytes, dataLen, dataOut)) == kCCSuccess) { + byteBuffer output = bytesToBytes(dataOut, dataLen); + ok(bytesAreEqual(output, pt), "Bytes are Equal to expected value"); + free(output); + } else printf("Failed to decrypt %d\n", retval); + } + + if((retval = CCCryptorRelease(encCryptorRef)) != kCCSuccess) printf("Finalize failed\n"); + } else { + printf("Failed to create Cryptor\n"); + } + + + free(pt); + free(ct); + free(key); + free(tweak); + free(iv); + +} + +int CommonCryptoSymXTS(int argc, char *const *argv) { + int direction; + int caseNumber; + int dataLen; + char *combinedKey; + char *iv; + char *plainText; + char *cipherText; + + plan_tests(kTestTestCount); + + direction = ENCRYPT; + + caseNumber = 1; + dataLen = 128; + combinedKey = "46e6ed9ef42dcdb3c893093c28e1fc0f91f5caa3b6e0bc5a14e783215c1d5b61"; + iv = "72f3b054cbdc2f9e3c5bc551d44ddba0"; + plainText = "e3778d68e730ef945b4ae3bc5b936bdd"; + cipherText = "97409f1f71ae4521cb49a32973de4d05"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 2; + dataLen = 128; + combinedKey = "9356cdad251ab61114cec2c44a6092dde9f746cc65ae3bd4966864aa3626d188"; + iv = "68882783652436c4857a88c0c373417e"; + plainText = "ce176bdde339505ba15dea36d28ce87d"; + cipherText = "22f5f937dfb39e5b7425ed863d310be1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 3; + dataLen = 128; + combinedKey = "c3daa5a0b67699f781050478cbfb8e93f381f71663d4c17375df9112c46a1863"; + iv = "26be92ac9883cea1da85335f8c169edb"; + plainText = "d988cd5db0502786c519b71cb38f4c62"; + cipherText = "e90a71b4bcd1baf3eb1f51ffecc464a9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 4; + dataLen = 128; + combinedKey = "924d6e017be6ed2686f4b2b7f50629b860c5e0a51d40f0c57847fc3fd9e79c48"; + iv = "0f5a522a6d4bc6650531860ac6223471"; + plainText = "0d8e5ba22f3fedb14ab6ab2fce9b0f84"; + cipherText = "b80a22c1e6522c47844158774b55131e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 5; + dataLen = 128; + combinedKey = "5a7d8971136edc537e767135958c13fa7549c059cd14a2f19abaa86aad09b56c"; + iv = "4108e1a5e460b29a52f1d960f7d8541d"; + plainText = "9634a03111720ef421e6dd5a6a9869c3"; + cipherText = "8437d5973fae25c6e5f3fd6795e5ea7a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 6; + dataLen = 128; + combinedKey = "e70c3574ba7d4be13d944c87c94ec8c5bf7b7fb10e1bb34c326af55c2385cfc2"; + iv = "200fc1e13044c4d473f410b91a26402f"; + plainText = "109184aefa5ebade528f50f497819af9"; + cipherText = "1e4cccaf01de731a3b5d5882b2db3af6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 7; + dataLen = 128; + combinedKey = "aa94d75ee53206db4ebc4d0bd8b5c0aa7600677c620bbe2a6c08bde8d6b2ebc5"; + iv = "bafe6f820df92ae653e70fce03159093"; + plainText = "b425ce1c7d7524404d2a2be5de5c1c28"; + cipherText = "d2c2c145a71daf7bd3339596474439ba"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 8; + dataLen = 128; + combinedKey = "9bb0eaf85277f24f15a3d86aed6c9cc5a218531886efb7c98be7a864b8c1d365"; + iv = "d4d6ad1e9d90f44c08c30dd9216c984a"; + plainText = "ca212d69459d37e284b8e03cfc99c1ad"; + cipherText = "09d9be40648420ee46141d717654c569"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 9; + dataLen = 128; + combinedKey = "af558471cdedddf76da56c3428ec8977b812152d386ed35dcbc8f833a36cc612"; + iv = "6f19db800dc2f23642bbbf1348d8141c"; + plainText = "22590e7d9368bb8c3fbf543144704fec"; + cipherText = "a394535e6069737682389f44d29b1f04"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 10; + dataLen = 128; + combinedKey = "b193c8d188a759da598bf5cd2e2c18a714dfcc29d4872c379208769b3c24c754"; + iv = "985a005543fe821949ff374d14abac1f"; + plainText = "5c916b0688c37acc2d413d37e941becf"; + cipherText = "1b3dfebd87bca7e745bdd5969280e3b4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 11; + dataLen = 128; + combinedKey = "9eeb844d6133cc6250015374883d394d99756aa7c9ff87b263b2ed8623a343a1"; + iv = "ea49deb5767de58ac448ecd0870b1133"; + plainText = "e94be598b8b79af4a96b0a75eff1624c"; + cipherText = "de1bc0e8065f47725abcd960eb7b0007"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 12; + dataLen = 128; + combinedKey = "0b9272f968591908540cdc73bdc4e21e675afecea6b6ed11787f879a35ac8a76"; + iv = "ef8b4a7f6840d527139f27cd12d5b503"; + plainText = "26adc7c756b66b768c18ca524bc7eaf4"; + cipherText = "4910b9bf93e6f5396c6dc1fbca34ae93"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 13; + dataLen = 128; + combinedKey = "d1e5752b6d4edcba52c7cdc783d639deb4949b7c0fd49f7e990758e93d2427a7"; + iv = "999568ef48e3e5be3ee183d1cf6cadc6"; + plainText = "ebadc47d64132e5a947b2bbb6cb74de7"; + cipherText = "e12ec44d0a161af9a2f610d3d7ee80cb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 14; + dataLen = 128; + combinedKey = "8343d923672c7251dac3c0e2b4ba938ddda625d96d87f65728dbc1c7a19d7956"; + iv = "d2985181e51af64ca2fe258b0532f01e"; + plainText = "ea36ad6982084bae3dfb5da13a848bc9"; + cipherText = "5756b2c27e3759d8aac41c112ce46f1d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 15; + dataLen = 128; + combinedKey = "9bdea2cb7980cf3b6ad584aff48cd9b48bcaa04a22d2d285f987c7472ea26462"; + iv = "314b49ef42bead17d471edb4f7bd8249"; + plainText = "593fddd423b07dd305e6fa755646eb87"; + cipherText = "c4c90e697472d8654728e476686707b5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 16; + dataLen = 128; + combinedKey = "a9d1d6fc95145da71f855ca00987583a31dd2e8042b7f2cf18b401f73d50b455"; + iv = "02371d129cb6549113eae4fdb4f33a58"; + plainText = "a83389303b071ada2ad63fb022ce8185"; + cipherText = "fc007f02d048b0fd5ac1f4961ad371d4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 17; + dataLen = 128; + combinedKey = "e43aa519a45d3995f1ef7de5ffebb1ef953c1e725489dc6a79c44b8339cb4ede"; + iv = "6fdcc5d82dda465558ea491f2ee95965"; + plainText = "44f98b934211c32167e6ca984fa72f48"; + cipherText = "0e6b661c07514e535e154d4fece0efbb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 18; + dataLen = 128; + combinedKey = "05331feac8e26c7abf7b0199471b1b3156046f7d5d6366e0dfcd58d16b7fd7bb"; + iv = "3231245be6cdbf7ba62e72744d8d5d44"; + plainText = "5b0003774dedbee211b62b14389129f8"; + cipherText = "14fc9642efb9d7cbac1535f849c25329"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 19; + dataLen = 128; + combinedKey = "ebdb518a8fda4dc1626865f0152c874f0b939c2f5cff005c3ff73f40fefcccb6"; + iv = "dc88a417430c423d03fda7592b9dcfed"; + plainText = "f7c296278e13d62c8d7a6d0423897769"; + cipherText = "5c2331739d4719b4b17641732d1d507c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 20; + dataLen = 128; + combinedKey = "8562619696b172f713f292e4e1f6d8b70f786ff2ff737c259a14ae0f4e453235"; + iv = "4c3f1509a5913c01e008a90b16345199"; + plainText = "362357e4d3941c67f93510bc84eb87ef"; + cipherText = "d837806c7dc8568b196236499b901eab"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 21; + dataLen = 128; + combinedKey = "b9c8c973664be2404ff6b8939f0f43597b84f4bf3ac8a2c34586e37a12a55c8c"; + iv = "8f6543078cb5544cfdded59f997236c2"; + plainText = "e23581d57ad3da3338f89244f7e53226"; + cipherText = "003c2ef98b83e55e033a7d19baf07209"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 22; + dataLen = 128; + combinedKey = "a6fbbf745b5846556beea67b2e9cab498b7635b674b9e0c999bf66d09a7398d0"; + iv = "2b3fbde91758802b76a7c980d42b43a7"; + plainText = "2d804bf5cda27a0eb3f7e0de08637abe"; + cipherText = "48b2778badffa7bfff409c3671e2c231"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 23; + dataLen = 128; + combinedKey = "e345a20273cf591c5b8ac1078f4fc21c80b8a55d1b3d7c89c548b5ae133ad33d"; + iv = "09083e8b63955a9e7589f2fe426c3923"; + plainText = "8aafab9e4004337c4a25432829bfc64b"; + cipherText = "f4abb4567ee454ce8900207addb64255"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 24; + dataLen = 128; + combinedKey = "d9bb58abf817a3819de1f9019dbc419d54e017e0dde1f3e9362db83adeede286"; + iv = "b28fc90a246ad2e7b312b39521324566"; + plainText = "5ce6cb2cb0d7c47267daa31fb72645da"; + cipherText = "6a9429e36ad17e3ca724c0638022baa5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 25; + dataLen = 128; + combinedKey = "9dbd6ff6274013ec4899f545172533a536706d896f543086d125c7b89c745a3e"; + iv = "22f7ff47ee95c5a92699c670ee187ce2"; + plainText = "0eba4b729eddc6afe88b8023d70ce102"; + cipherText = "3fbf5577e484aaef548bb4caef1b23ef"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 26; + dataLen = 128; + combinedKey = "be1627c0dd8151c2598ba752c0088453c9a21a37b9f1089d089b2b196fd88e03"; + iv = "d45e2ece32961f017b325583e8ee464e"; + plainText = "d353fea07c903a8ff976812cf3e61413"; + cipherText = "27f2cb552e96fc9c2c5c35e3787a1b3b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 27; + dataLen = 128; + combinedKey = "2b94e2c5ced0d24e89b459a073c66b4b0dfd051217a07dd429661291ac4cedb3"; + iv = "8d3eb008b842709a6a243b350cc1a7de"; + plainText = "c3af28e1c47b04adff1320b479a944c7"; + cipherText = "4f32d026c8f7bf0ddca47e155ef207a7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 28; + dataLen = 128; + combinedKey = "5b2374e8a8a9b8236ae1738583aaad5461abbb80ea14fb8f143965f0c612fa90"; + iv = "22f9721dde3fbe8dc8ad24078249fb4d"; + plainText = "65708c99b1ef29119f39833f992b05d9"; + cipherText = "be21c7ce2f2969bd4c918fd847cf8c0e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 29; + dataLen = 128; + combinedKey = "7362e35382a84edcdf02a858d24c6e1239a4feefeb3840bc440cbc20b38d9ab1"; + iv = "b268a26206a4161e7f00bbe7d1de3aec"; + plainText = "3a9c8280677c9f00a9c8bfc5eb2b7552"; + cipherText = "1ecc638cb3f8cc1beaec26109973a313"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 30; + dataLen = 128; + combinedKey = "a0d42681a867aa924323c1dfef7ccbb9a8ec0885b2528f0ac86c942b39531a74"; + iv = "bd0d971dfdaa454acdafc8a992dbdd50"; + plainText = "ab4f20d49ae5579069044aa261875638"; + cipherText = "b9671ea04b324745bb1a0ebdb2e074f2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 31; + dataLen = 128; + combinedKey = "a0aa082c8ecfc68787fac6c0e78d7fe9c99bebe150300bacb74136b7cd9810e6"; + iv = "c9b3f621a1374e0eda23376ca2c26fd0"; + plainText = "1d9ede1aafa7af65da4b56bd65e95d18"; + cipherText = "072dc9fc2631552242253fccb7ff34d6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 32; + dataLen = 128; + combinedKey = "5f6710301f15c2a1e350db816a7dc2baea8038b1de58b23271f00e1bbdba291e"; + iv = "e83aed0175373f8110e5bc0cb0ed5ebe"; + plainText = "2f640069cd78d0c7433c126e7533d837"; + cipherText = "b147bfbbbafeefedd7fea3f985475c8c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 33; + dataLen = 128; + combinedKey = "e1f3b00669ef69c1a13cc3fc2612d69e59a817cdb147392c319a7e16fab86b73"; + iv = "b94b110641d6f9c9882b880dcf39477a"; + plainText = "5c11f78d35c075e69cc89c99f8e6ffeb"; + cipherText = "6bfaf03085a13d4bf791dd73377671a5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 34; + dataLen = 128; + combinedKey = "71c29ff5285aeca9778d4e3c2c189015aa1b809e9925920389ec02c05171352a"; + iv = "16413f69056a1d0cd00676f5c6006a0f"; + plainText = "c96302351d0b1f012033e48f61b34d54"; + cipherText = "03e93d77d1d87f80fe938135b1bafd55"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 35; + dataLen = 128; + combinedKey = "704e0bdf9bb04b45a77206875521d0389645761d17cf9e1d11e108775747f02b"; + iv = "a19f4719fda33bbe44f91bd595badb37"; + plainText = "80fc4ae7787a8295171ab7ab3bd60e53"; + cipherText = "aa5278853d472e1fbc6cf86cd83c34e9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 36; + dataLen = 128; + combinedKey = "832f3883c68141587892056f63fa07d8ac6828a065b4a7504b910d4a6ab7e1a2"; + iv = "850f6075d946c84ba3eb43045c73d9db"; + plainText = "6e3e792aee862cbbeb8d1e9379d6c5b9"; + cipherText = "b29ba178d9a3550c2a1fa6e8d62b3ad6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 37; + dataLen = 128; + combinedKey = "cca67d91764890c26b04ec62822b98b63879ce4dc6abdc680564660f2dcb6eb6"; + iv = "3d15f99e28819305095dcea7fd62efea"; + plainText = "f9a767fbd3f43ad79774140d56a3b544"; + cipherText = "f21615ca2cf2ab30e65c933dfe814dc8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 38; + dataLen = 128; + combinedKey = "0979ef8f8fc0ef73e6a51af3289e63bad7453d2f7c460deac6533f39a98194dc"; + iv = "a3c446f313ed8f05622a969c7c58ec03"; + plainText = "21fb484c68a9caf60fde8d22994751aa"; + cipherText = "b4965ff7237bec62268d98723a6b8d22"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 39; + dataLen = 128; + combinedKey = "8c1022158815a2072388dec097648836d300d8eb4c0fec669edd585a00b09461"; + iv = "b4e1d80d8009246e026b243ab8e21fc1"; + plainText = "e6e3d67a7e32dcda953b5c9aef6e2468"; + cipherText = "410d67bc7b0b9db8cd285027db2f142f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 40; + dataLen = 128; + combinedKey = "6805e0920fdc81817c16ff312042812d4d0fea04e97a0088d5ce033f77f57516"; + iv = "6782e9e185ee7c2dbd5f20739f7470b8"; + plainText = "32f03cab33cfe6870946d8ef9926d40f"; + cipherText = "0d44276de44fcc1a22c0a23f5947741a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 41; + dataLen = 128; + combinedKey = "13de7c37bc706262b3dd21e512f7a1c304b0b8a1a5ac990c0d7d44beb7c7c241"; + iv = "d283e9a36ce280bf92ad05b9d1070194"; + plainText = "de8369c5f7b7efaa5d693ccfbc1ceaa2"; + cipherText = "11a61b1439b00d4723957dcbd1d283c2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 42; + dataLen = 128; + combinedKey = "c6986f1ff45871a394fe42bb5f28bd1fe94587c0da5211a9da75b98fa38708cf"; + iv = "1c87714aae7220b31a97f7c158dbc414"; + plainText = "71fdf4428222172b949efb7d6b5b4b01"; + cipherText = "6fdab096ae06c8981ffddff8b924d4f3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 43; + dataLen = 128; + combinedKey = "0ddf33773e2aa3b1ae099bb3a7196af03808f9b4067c9352c895e4569908e279"; + iv = "cd2e892985428763375455ddde7aaea1"; + plainText = "b49af688227f7e370d419e4375d0934a"; + cipherText = "db905a71789d633bceaa95f91b3f79e2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 44; + dataLen = 128; + combinedKey = "c292b87b0420866b6cfdfd176a6ee3e53a16cf0c4714fd04c7415dd664957690"; + iv = "a1f87b4d8c7b5c39ba079b70f183074f"; + plainText = "2328fb489b22b4b641e9e220b8908ee5"; + cipherText = "3cb229bc84c14196e648ce4557e28aef"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 45; + dataLen = 128; + combinedKey = "c5e3f3a4602298c3b06ab95709fc75d1c6127f940732b8d7e19de13060c3c870"; + iv = "a691bd37bcbc1feb55dcbc0dd8741596"; + plainText = "3fc1ee7738d5327b10cbb6ba30163372"; + cipherText = "c410953aaa123407bb9cec43899d1afb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 46; + dataLen = 128; + combinedKey = "6cb9b7c3b70f882bf3d52b4438fedf6ea93470f4f333a0a9d2278de371c28470"; + iv = "9fa157f1c4dc9ed96b4003baf9bca591"; + plainText = "2a3728d273291c2ea36eff4e0284e304"; + cipherText = "c88c50df49d10fe6fa9fd2e06bd25683"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 47; + dataLen = 128; + combinedKey = "3f90966532aa543c112edb9fe44f84e54bfdc3f1b8c706e499e8838f3dbbffc7"; + iv = "d8184540b9f12055cec7eaf9f3654292"; + plainText = "f31df15bfa89416a45cb3a75dc00cbbb"; + cipherText = "a252bb4a094b1b9ce6078b1302c2fe46"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 48; + dataLen = 128; + combinedKey = "0e54eb8e1a4c86689f9251d5305cdf032ffea11f817c7b6ceba4420e5a405346"; + iv = "f247a2e183647843b38d6a2bfef5261a"; + plainText = "67a7407531c6c97f5789e6c8f5fba76f"; + cipherText = "cb0479e1af394846ed87265b2973ec62"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 49; + dataLen = 128; + combinedKey = "e391abf5c55268ec220e04afc56176abd8be2cbbc3e59781aada92559d1f75cc"; + iv = "ee5f726f0ffbdf1b74032c2edc610bfd"; + plainText = "99cba520cf1b6fef60cfc2ea5b925214"; + cipherText = "81510ac069d947a0ff083cbb8a710d21"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 50; + dataLen = 128; + combinedKey = "0bc73b1d487f0fa300c9fa391b9465ad3ac774de11d1c28f3caf05d612526f9d"; + iv = "d9d5248904c97fba325791d31c283236"; + plainText = "0331ef217d21e7d1a1225ead8c24e532"; + cipherText = "dac01da3abaf93d84cd488623d2f30db"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 51; + dataLen = 128; + combinedKey = "5eb1e3ed21073b30c4a86b800f5016063b4323e45e3960ea8f02e925a0e5028a"; + iv = "35134aa893fade41cce5166b187ecdae"; + plainText = "025f1b8d80affad53bd24f1b8549a1d4"; + cipherText = "d778d225b5b7f279af04505a603f6825"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 52; + dataLen = 128; + combinedKey = "f70c0d0607942bd86c9e0a10fec0764b810610b3db0480b2603d210f827a6c17"; + iv = "628e0b549af3631772ed9d6fb2e583a5"; + plainText = "bb20b8c6079b4031b0ca8167ebcc0bfe"; + cipherText = "71985d1264332ebac96d78acc22da238"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 53; + dataLen = 128; + combinedKey = "95907c8ab5ffcacd6edc0ed1653d0952f32712345e8d90e70e0a578e4fabe406"; + iv = "de3fceb65a26f8b7f733687e1449b33f"; + plainText = "51921ed1a94dc00848b1720b2c3b0a2e"; + cipherText = "7176d3cc65da80ddd31ee5a7e04e6da5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 54; + dataLen = 128; + combinedKey = "bde5cb87cc9d3f4f82080e24e7772505f8d120cc30914e10d8ca26ab351107ac"; + iv = "13dc996addc206f37faa1582f23cd988"; + plainText = "1096b53b6ee922d2118c3687041e11b5"; + cipherText = "0be8b71493abe873cbd4b0418fd54a07"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 55; + dataLen = 128; + combinedKey = "9574df5e0f2d41575692cc17fac224fe248536e14e3a77c96a0ca562ced70357"; + iv = "fa0dec91a79d9727795103e171c0945a"; + plainText = "c716d57bc533cd638083e0d000dd10c6"; + cipherText = "6fc24608851e700f555d76063ff3c532"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 56; + dataLen = 128; + combinedKey = "039e8bb0db225f832d14579ea186862ff141a91fcd791bfd238d3e74fc26e1dd"; + iv = "2b0468421fae752d6f092e48e4dfe616"; + plainText = "9fe68f428392a0a2b3e9324036a6c74f"; + cipherText = "6243f127847ce42adef3c7a97894971b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 57; + dataLen = 128; + combinedKey = "f01c0794bf1578bcdeeec7ce3343174f47d0cdafdff8fde019ea39c2d7836fff"; + iv = "ee2ca121a9e02418938774e6ad7f1d79"; + plainText = "a46eb1a762fb4ea048a15047f1e333f3"; + cipherText = "a975a6ac7de0a128db676dd973106448"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 58; + dataLen = 128; + combinedKey = "67207b23513be52bb908118bd9862b4e52bbafb601c24c342ffe018ec9cbe272"; + iv = "233c205982f614f2ee64bb937ad85be5"; + plainText = "99dbdf6ff5fc4450cef2f6fab860ba9c"; + cipherText = "47fca4290504c3df315d27ad95c7c7e4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 59; + dataLen = 128; + combinedKey = "aa30edb92a8d7e5b63bd7be9215fe12f426f2374d62369972acba999c60ad354"; + iv = "38aa14a2a214bd6c672b16638787f1ba"; + plainText = "4a0bc1a2cfc4757a37781614fd508aa2"; + cipherText = "6d542689ebeaf63188b247238a4f227d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 60; + dataLen = 128; + combinedKey = "4172acf17cd3a35e25f8f63f81925d2a280144306ae6a31ba3122f7a259b73ba"; + iv = "88ad8b3fa62c0859bbccbcbba00c6a7e"; + plainText = "110677671b17aa047be06aa8ecc3e4d1"; + cipherText = "ca0db6fbec082af5932ba15455d519cd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 61; + dataLen = 128; + combinedKey = "2151f570c4abaafb47c5e8202ae3b2d79e507f52f4b6d02f31a9e629377bdd43"; + iv = "155b4ab7c2c8834bb633a9bb5f5b2d17"; + plainText = "b29b5bce0684ae4118679363d3a9f7be"; + cipherText = "477c30645d8e09a1fa42be96c8315fbb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 62; + dataLen = 128; + combinedKey = "0d7e885a32ca4fdd91e175ca993330dc3d7ad2f2ad39896406bef6cb20c6b725"; + iv = "b7cfedeb9f34f2d21d291cff9d2d3fd3"; + plainText = "49bc8db5279a47ff8231479840eab25c"; + cipherText = "f852ebf7396e6a1bc29ec6fe62f0e88c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 63; + dataLen = 128; + combinedKey = "7aeabad799722b259b95757d3cfc6b5ca5bebef59e8892e9cbbd783803682554"; + iv = "834d045ce3c9fb95f5ef351c7b8dad02"; + plainText = "b855dcd03cc80de45b39031163911cd0"; + cipherText = "f7aa96945867bedd459c9702ec417410"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 64; + dataLen = 128; + combinedKey = "cff5c8a1cebee0e46c2f4151cf8830d0b57bafd715e2064beb4d6219a1f94276"; + iv = "491e35cd472072be033210ce2e1e46dd"; + plainText = "bf6a53fdfa4e325299bf1f0526617cd5"; + cipherText = "70737ac9d0739e07fe6d02700f956a8d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 65; + dataLen = 128; + combinedKey = "bc029f3cf23d7fc964a255eaecffbcb320e8942ea28ff4ec1a47f9e91cd0087f"; + iv = "6a8dfa2418fd8acb74fc7d0b38b736be"; + plainText = "51a835dda82e4b017056e44c928da4b1"; + cipherText = "22b823847488545d93177aa37b5d9b9a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 66; + dataLen = 128; + combinedKey = "a1c0787bf4de26b10053bf1c4615c1a602883d6566a7184baa11b2d39859b1d0"; + iv = "a0875430151f7d0a065966a3909e5339"; + plainText = "642c9617344156c4a3e259497c370382"; + cipherText = "04b86a5628cb39e39378c09d8a6c675b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 67; + dataLen = 128; + combinedKey = "f4c98233c56c9954bbdd23d9052e2ee5392807ff2f310eb5063a1f6da2bbfb63"; + iv = "07fdc8f424e6c0fbeba275c0cbff2661"; + plainText = "58b69bae6465fb3646bd0a561792fd37"; + cipherText = "05182e495d2c6efc8385d4c4a8e0b34a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 68; + dataLen = 128; + combinedKey = "ded3bc05f96c73bc19ff9e3b7924f6aeb99a808a40f529b8871c3ed1a91528ac"; + iv = "1e1e6d1eb7aeb8073c16e9fc40a1f6b3"; + plainText = "85cc116def8a2011c0e6cd87c074240f"; + cipherText = "3f5de8a874871e18820e49e122f08a09"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 69; + dataLen = 128; + combinedKey = "5efe21747bf4f1c1d40b78504773211c25ee89c9144d8d92f62ab7961830ceec"; + iv = "f15f589d6b539ae3b07fe17b65ebe8b0"; + plainText = "f688af4b8f7ba44e4598c85577784ba0"; + cipherText = "f8b9ee876bfa3b8a76b9e177e0f3c350"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 70; + dataLen = 128; + combinedKey = "459d9ca7a00b4a991c594b9d8811485338e3c778155f682292416aca9dfdde76"; + iv = "985a0997419d71c5fb44cb9cd919d9e9"; + plainText = "6d6640d6aef06a17b2f5234e968e1300"; + cipherText = "4002ea43561885a63ca623bfbb92b4d1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 71; + dataLen = 128; + combinedKey = "3b420ca90eb3164c7bae206c7c0b998dadd137ccfd8dae1e3e1982e157ffe54a"; + iv = "475fb55a3e2aedb247fac73a2911d5aa"; + plainText = "4ccbf906500a90ed0ca37d36dcdb94b9"; + cipherText = "2006e048d21ff72e207e99a1669f7e54"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 72; + dataLen = 128; + combinedKey = "49019a26481f3c4b96152fbee1cd6062db95585ce41f8c152412f3e80b9be04f"; + iv = "f742332f722cfd65d99eb7a41101c781"; + plainText = "064ff066318deb0456453344f8ecd2b2"; + cipherText = "eafae9829732af77fa7d15be007b9572"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 73; + dataLen = 128; + combinedKey = "f5565f09b164ffad67160cc6cc756fa206b628c8f217f9d88df26a50487be3e9"; + iv = "387de8be00c8c1247efa76a8de256f99"; + plainText = "2945847377fd128f974a35b88633615b"; + cipherText = "308ddfb2e666ae52ee2e335fe6c2e417"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 74; + dataLen = 128; + combinedKey = "892b137375e05b418e690871cb9e148346651fd17801025421a5beff77d866a6"; + iv = "af9bfc09932e51904cae248a81e3e423"; + plainText = "49d4da9feb315f53c51fcbd92a7df31c"; + cipherText = "4dc2fc3083a64a080be6bbbf75482542"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 75; + dataLen = 128; + combinedKey = "22e2cdb46071edebaf579ac87f76697c3039d7b24b732501f1760440ff2a945b"; + iv = "2b54feaa1089b4e211fc2b59ac504606"; + plainText = "89e6133f383c4846dde4c8884798714c"; + cipherText = "d37b188b6c28e308b78a71f15769cdfd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 76; + dataLen = 128; + combinedKey = "6b56792baaadcbfd9278e8a35f9ce05224bc932e5c2309142a739e0781827ba8"; + iv = "ef9237736e1c80ae0c4ff8ea4a18ee57"; + plainText = "fdb0ce22a0e20a38d59158a28f82a898"; + cipherText = "477bc6120c1001598d248b79e87ad1fd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 77; + dataLen = 128; + combinedKey = "5bde251c2ed13c163ee932bbb2d75f5c242d3ddb2b79dd09e2398bcad56e6148"; + iv = "e5b2793f1abe4eb4453ca9943132d0cd"; + plainText = "e064397bfd890f40c668cb70f8766eb6"; + cipherText = "bf4482c770d049a6a47e9c5fc4a83ab9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 78; + dataLen = 128; + combinedKey = "ea92fa8a37554b4236c0e26ebc58836715253b8370b270eccaf54f8ea1367ab1"; + iv = "fbfa557bbf11ab6995a11bdcf75a00b7"; + plainText = "ba5a69b64b8a0046238d882dfddd8519"; + cipherText = "04142c0e8153d293ee8231c5169e8e9e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 79; + dataLen = 128; + combinedKey = "eba364e12d39c43d66ae2044cd00aace61cfeb51729613ac655051b8d23d601e"; + iv = "c212065e39efc646a25f6f7c04713017"; + plainText = "09be2e4df15463335fa23da38bb15ee1"; + cipherText = "07a60189e3840c0e2e637950d31c427a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 80; + dataLen = 128; + combinedKey = "9ab67592094b580f4c744d5318a1abe84188a13c0e9a76735c7d04edb878110c"; + iv = "930e93300d03ba45c228707d86f6f132"; + plainText = "0d1d2d79804b5ced3f5ff416561cbd77"; + cipherText = "8c45a7067282f3f6e1cdd9a2d4ec4d1f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 81; + dataLen = 128; + combinedKey = "dd73892731abbb61a53e2a10b501ccd68fac3c847b70add43fc341e296bd1d33"; + iv = "118e9286d54eafeadd36c82fd1f0471d"; + plainText = "4b3c7a217cdabf7e09ceaa3dc7abde38"; + cipherText = "ec01c43a3f4fa9ba7609a47e3c13a9f2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 82; + dataLen = 128; + combinedKey = "8b54dc39148094a75c409545ed7561bc32e33590582fbcabd770d2cbac780af3"; + iv = "1bb8035e783930d4ee5f987444f32535"; + plainText = "044f7efffdf536b2981b317e72661317"; + cipherText = "cee7a05f00b273526fa71a87aa63980f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 83; + dataLen = 128; + combinedKey = "a1c32733e4099c2e523ec542b90fe47fb834b0c21d10d7f1575e5a7f9be63c03"; + iv = "574fbb893e52913d2187f7e9b36bb1b2"; + plainText = "6d11ba6c40fde736081a5c4f635f1004"; + cipherText = "5a1ba8a0c296fde62780bd3ab66889e2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 84; + dataLen = 128; + combinedKey = "948912a5453dc0641158039dd159d4e57058a7e4e3007d45b8ae0af8cbd80c82"; + iv = "6dd2af9c5727d65b745d29eb05827961"; + plainText = "bb0378abf90cde34f0f630db175fe345"; + cipherText = "cda72c110d1e11fba06c93f7a75cd6ac"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 85; + dataLen = 128; + combinedKey = "b59042a135e9fac74daa76d9a6cd2b752f47c3b79589023c537a522d187f674d"; + iv = "f49d7bd75460049350654e3ee28e85d6"; + plainText = "409173735af74af9a74ddbb6e00e72bd"; + cipherText = "59aa8122cc80d6e8b8188c5fff138c34"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 86; + dataLen = 128; + combinedKey = "7b417a0151266f1e76bc41238bf20647001556b9cfa1af9b7a6a4666e8f16395"; + iv = "1e62967ce97b5038437cd2054d9b7a53"; + plainText = "d5eb1acf5c4594809f83afe4b28dffb2"; + cipherText = "a3654e33ad5afe939e514502438ff26c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 87; + dataLen = 128; + combinedKey = "c6e1067dbb927b95b5a9810819e3379a7de05b13cbb403ebfdae8053c0256158"; + iv = "c7e42b26d7acd4d3797f423d305d8d81"; + plainText = "e47c0a19194be29220a1da312cc12607"; + cipherText = "b2b05f88075ab53903758193ff49ea55"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 88; + dataLen = 128; + combinedKey = "ce24a5004274e90a9b6501f9539615c287fa238b9019f98cd4c95af652ac0c2c"; + iv = "68c8cd9a82ca38a789baf9b53ff5c6c8"; + plainText = "4efa06f07b9acc0ee4ac524bdcb7495b"; + cipherText = "805d16c4010890fda3dcf0f511c36716"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 89; + dataLen = 128; + combinedKey = "2c66060d58339180ad03a9b45f8625994c68c916b639c45034776356119a18a9"; + iv = "53ca5b86394762089083adc9386fa0e7"; + plainText = "4b012fed344f187ea9562cfb6c4355cf"; + cipherText = "d612fda0371f4c2affca867b33c8abe3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 90; + dataLen = 128; + combinedKey = "da9539b1add00192323e104ae59a17a38ddd45a3e6e19b7c3f7ae2cc4927f8b7"; + iv = "cb50cc089c09d518d56f9282aa61b217"; + plainText = "22f755f2b50128cecea8108dc07573df"; + cipherText = "18e6c76d12abb7ef1fd7653a32d150a6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 91; + dataLen = 128; + combinedKey = "2d2036ad520a30fc8b656be3a339f0fffb2934b64afe1aa2ea91972096a93ab6"; + iv = "d2c1012df83b7ffd9b8515a0fc43e6d3"; + plainText = "9d6ecbd13728aa28f9987b14843ca5ff"; + cipherText = "d5669cb7b36f321ddf65ca667930b7c6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 92; + dataLen = 128; + combinedKey = "5b2d617a9c3634f7baa0c173e9cf77a5ee98c22709f7521d75db48fe608ae85d"; + iv = "b6220b0eef27fb45c5348242dd2eca6f"; + plainText = "157e07c77b7302428938889e7cfe054a"; + cipherText = "f6d0f0987b21970d12002e918fb8a137"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 93; + dataLen = 128; + combinedKey = "1cf728ffb420f5895afba534687a613bf7b525a1355438e8283a2e5f22209c9f"; + iv = "59b7cf637d51e1fce46bf04c4814f927"; + plainText = "98a67247d79b75274c0f6b26e893e158"; + cipherText = "07f0bcdc2ba2b6eb2db9ff4cff869cd1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 94; + dataLen = 128; + combinedKey = "6a1528a110baf8134c15e46dad1b206455d50b56861ea0b106a7ad84e9c4b607"; + iv = "c36c11d6c1786d4a9a066af6b8218699"; + plainText = "d14e1778109fe3b5cf83d5dd159c45c8"; + cipherText = "157628c394d91927de372bbc037fb7f1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 95; + dataLen = 128; + combinedKey = "71dfd80de7a706d60f76224cb813cc8c13170cf0c9fa0ccb9db77bafd8311776"; + iv = "0c9693bcf4d4346c430f021afb25de9e"; + plainText = "56dc37b6473882df2e6b89934f67463b"; + cipherText = "c0d60f4c7ebe08d1a87238df7497b295"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 96; + dataLen = 128; + combinedKey = "bb41248db8388b5c809728838d45d6b5ca536ef43860976345b0b1d64d4e1b46"; + iv = "0d7d53c6c3d46cad187f71b46f008a27"; + plainText = "606c97a5d698caabb76b3ff63ea82873"; + cipherText = "85330dabf5162ad8fdb01fe24c0fbeac"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 97; + dataLen = 128; + combinedKey = "a5654ff447d985078c267806ebc611d3fef0a119693e30d754a6835d57f1ec04"; + iv = "1715d4ece0455826b09ddaa745ca831e"; + plainText = "527b08c654cacb38106f2639aca980a3"; + cipherText = "eb425eccd25f12358a140aff19d74d46"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 98; + dataLen = 128; + combinedKey = "0a54f704753393e93d20c7a35322a5bde43daf418af1421c6d7a5ce94d18a9df"; + iv = "45984e9b2df2b80aa2826b1b751d4a4c"; + plainText = "8a8ae807266dda61304ac4ddcaf5dcbe"; + cipherText = "3ff1c17cb6461454c0f3f34b6bd157f9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 99; + dataLen = 128; + combinedKey = "f933a0b1742194c3c264084a763d2b7fc9cfa5f8d3954d20a1c62179b2748695"; + iv = "649429d48bedbef7de785de35ec68cb9"; + plainText = "a48be035a8421cac2c99d1eadc13975c"; + cipherText = "fcdd77570d7856e470bf60a81fd10732"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 100; + dataLen = 128; + combinedKey = "ec9abff0ebf84e10af5fe85e5783410db6e434dc4e56d2bef6716a1fb60def9e"; + iv = "340f40818f10b2b27121d4f42842bcea"; + plainText = "fa3208895cbe866b124b301a4b09751a"; + cipherText = "1efdb4b8a973ade739b73877697eb138"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 101; + dataLen = 256; + combinedKey = "c17c372b5626916d98c02629f5d276474557e3feaa75783634d55f154e0a8d18"; + iv = "dc052215ba655cce707e513d543a5085"; + plainText = "e9b9e29fdfa1af535a1ec50ed9204f75c62f40a9a19e5049cc1048e7047b8acb"; + cipherText = "b7b416a56cc32f753c259b943ea07a9dc030840c8055831e2231f7bfbd0a734b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 102; + dataLen = 256; + combinedKey = "8712dc338dc23f7db7e24a5615bcf7763906175650e8f7b958185b8aa8724c2b"; + iv = "0525e21ec21c95f840f99017c72f276e"; + plainText = "65046acef34bdaf401fb7427103ed25bac7cd09898bf9f6c07c8b99b51d6f3c1"; + cipherText = "ddb95bc391d4820d7655126cf11db4681bd2f1e1e42f20b479aae1fb3a8e3e39"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 103; + dataLen = 256; + combinedKey = "25f7bba87c5ea6d1907e16aeeab834422b447493f9fc4198e05eaa01c71a2ec1"; + iv = "86c0fd2de3dad674a741e20cdec7d7b2"; + plainText = "4e95911733d5b4e43e5efd875771b0bd574e7db6e19aed31622c08c7f1472bf5"; + cipherText = "0caa97270bb41f092cf649a70833a6424dd50fcf2e9f55f02e91976dcd2c2ff9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 104; + dataLen = 256; + combinedKey = "a6fd2e5ca44fba1cbbe368f3bf5c45857b7d13ef7998fd915a36b471efb3b73b"; + iv = "08a420e18abd36a969ae33ac59c3cb8f"; + plainText = "642b97b2ee7f12050461742c07d1154bceeb15c7cbe1228fe21a64b6ab5fe796"; + cipherText = "b427a817ee891f9e40a4ddcf8d78f9289c7ccfa244e8c5d3a72c8245e76646bb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 105; + dataLen = 256; + combinedKey = "ba4108734b283393922952d5e32ce539fbe675d94ab54f389559ce05c36a0f2c"; + iv = "5c36625dda1b2528db7bf7aeef95185d"; + plainText = "71c70aafe1b7e355aca682e322c0a1dca4411c0922029f895ccaa6bca9fc2583"; + cipherText = "5e3c5fdfc6714deb37ad1642e94ee96b4ccdc501626dd50d1369a3ca2898b84c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 106; + dataLen = 256; + combinedKey = "de347dc30cf773853def15df0a45fbdc657f0a433497d63382e0d409dbe88b91"; + iv = "a786b4d4f9139d56f6bc422658d2ef29"; + plainText = "214b3f186a58001800f74b38845665d5e8c15cba2516f4f4f615cfd59f3102c7"; + cipherText = "035f6e4cb86f7fa9fe8d28fc3c0943c5875c1b0ce69eb2b7933345080d0d95d5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 107; + dataLen = 256; + combinedKey = "7abf4b5cb9534b99e954f1c0fc52edab6a105664c54d59f5b12d7f9c01c63c50"; + iv = "40f4d9b5bb05b7409ee787dd299f1fb0"; + plainText = "c62c0f01fa8fce3a6b456743f655905995d3cef9f08dd94af51e6e76c9599efe"; + cipherText = "26df5ad6ec95a5f598f558ab179ab30979d5a8f66d59d114769a667fb8513b9e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 108; + dataLen = 256; + combinedKey = "dca0b4e2b30ddb8cc6a3c8fe5f32f32303d36aa48cce71f3dfdce8f1e40caf14"; + iv = "253aa216299fcd983e4f3ed90bcb8e01"; + plainText = "b0032714ee64789b7b4c23f0a5a19179f1ec5dc7a81a07c1d5e69a9ff9347187"; + cipherText = "3170763465743ce55eb4da71b27bb503cb63a8e668d5cfbaa48456650ad97187"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 109; + dataLen = 256; + combinedKey = "73e5b3d89a90df344f21c8d8c91b196e866c0368b57a843c04e95639c7ce2288"; + iv = "e8365f08da13e301d02a4cba18448124"; + plainText = "e83364b77fe97045f279e69a35781f28d62d5d0eb7ed51abf07d3525e401e73a"; + cipherText = "3c0e4ccdd867ef191ae59c6ea8584e65aa5f15e86f3ee06304c0c0e63e2b7643"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 110; + dataLen = 256; + combinedKey = "419f46458ba9ca86635003ca1406ccbb8fa8fff30b65ed595ea2fe4cd0c1dfad"; + iv = "809dbc7702f49db627be507e65be5fdc"; + plainText = "121540d511ed015770f02093e255ba0be6c1ea8ad0bdfe39414a11a5d61edd16"; + cipherText = "ac1fb064974950f3a60b7af3c7639ba59bc93b26ca33f8abd5bc1210e3473656"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 111; + dataLen = 256; + combinedKey = "54f7657fb97329f679d00f66be9f589b739e85371f84945ad0ad1bcddaa15529"; + iv = "8c23e7f4604d85c1ad1b588378864c37"; + plainText = "70a9b84698b9125c58d6b5f1962afcb83928324762804866c607f199412d0645"; + cipherText = "cc36dd360807fc92322cc4e74890e43663657fe79325c9eeeea1c476eec8fedb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 112; + dataLen = 256; + combinedKey = "160efe62676d0de0b7aed7eeaf064f4761937077122e3c9ad229350f599a4040"; + iv = "f3d95f6c23ed16fa618c764bffc581be"; + plainText = "a4b9c7c5badcdac11136e72bcee8bcf54d3f7a4fd0f9e1e563ac08b694b0ed90"; + cipherText = "d534ca942d918af061f05dd0cbac5f4f702ce2d2082c3751265fb728e56914fb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 113; + dataLen = 256; + combinedKey = "86a5ac4605ef1f878cecf5a9cf92a1b6192f8dab384cd75ccb84262bb4bc73cc"; + iv = "7653870a4e7b3699d0e8b71d7fb3c1c1"; + plainText = "7c0365cdb477aadbfdb26ed46efd0d2df6bd5883125b3305f3542857ef135b66"; + cipherText = "d6b1a9b4efc82cbd8abe4f5c35a951cb932fd4d0ad3ff686b78ceea26fa1f7a2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 114; + dataLen = 256; + combinedKey = "2357c1def609ff88b50ac23dce634df70f5cf9209ac851b4e2638dfc1e4351b6"; + iv = "2479ff2e39f851bc119d78df794191c7"; + plainText = "19c7ead499b1ab2f6a6946d2bec289bddfbe0a2e39dd9cca52429c65291f3229"; + cipherText = "f9ad4a526fb19b6d2c05d6dd5aa1445d04e55dc4cf8f4eea5847af90e25b4017"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 115; + dataLen = 256; + combinedKey = "63a77b6dd778fca13d0deea4fb66161b5652f04d3efe4c86dea02e1c08fac73c"; + iv = "50c8307d3ec80900a239b4f68863e787"; + plainText = "b0973852b8f692e6dfd1ce30b2e4311036a6df891ab0d5b3974c2a70b28d2e90"; + cipherText = "d1b2e1ffb86590aeb2d6608a6a5799ae154f2c21ecd2213db621ed72cee9c276"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 116; + dataLen = 256; + combinedKey = "3c557e959f555ee0de73dce8350e079490812bae4e902217bfc9690b61e2d9fd"; + iv = "e49c169831f792b4c2826f05eaaa24bd"; + plainText = "c2c072c7231318bc44abff3b84e8937779e0140adf2252fc3b1fbbd4ae50d4b0"; + cipherText = "caa4276ca7a9bbc1dab01fd550c7094e7560e3adb367ffbb92d163cf5a6c83ec"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 117; + dataLen = 256; + combinedKey = "84ba78b12227e29a501b4f6abc35c9b9a7c9b9cdff98af957e487ee130d4e116"; + iv = "24df05f1ff24fbc7853ac52761a6ec8c"; + plainText = "befd5682b64501b57e822da9874c789bd117b46e127813169304d69d224d9d0c"; + cipherText = "d0663c5a96097318885a732cf266e7edae01f3bf9a560051b03a976bb19ee88d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 118; + dataLen = 256; + combinedKey = "f58450c79e335ec7eb1706b7497cb7a2c55c0dfabe2f1a2708a789840e6a441e"; + iv = "26bf01918d9abf182ed62c95356f9bf7"; + plainText = "b8246768361ceb689c8dcee70833a495c2b019539bb6af2bf9fbed6001c7f567"; + cipherText = "fbf1bdd97a2655aaef9cde7cda9d1c2143b5913a371d2ac44c3e339f2e3af5e2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 119; + dataLen = 256; + combinedKey = "7da9b23985ff82f9e0b97b9e3ccb810ba10449b4ec4021d4378ed8b254d24f42"; + iv = "2eb0019fe6a51ccb4e9dc85750919027"; + plainText = "b2abe40e07ae6ca9aa112dc4e4145f1c2a21dee8d43d2a6be305c1fe8228723e"; + cipherText = "f5d5784fbf46d84c6cc56d88bc1ef58636d8a888f5065af91810fb8f2133fbac"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 120; + dataLen = 256; + combinedKey = "feaad2c51acad21b490be4b6855c0822a97af8271f5a2fdd7a4d2d5a0ab25fa0"; + iv = "49d5f8f501bc6817e566396c42ee234d"; + plainText = "2b2c080fca4b071374961a61a449b98b2fce6a8c4e1291eb8132e9f4a80b845d"; + cipherText = "98ff2ddbc71eec4374e916ef56b7c3da881f07930e7cfb79bd54f7b3dcf2d689"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 121; + dataLen = 256; + combinedKey = "1fe9f90a37e71431f505457ba7f90bf0598be1a59378c445aff75e8e458ec657"; + iv = "362a35f22dfb33ac208209acd878c027"; + plainText = "9efd492a3ab077a12a67a405d17553d23a8ec60c9de52e425b91c8031403d4d3"; + cipherText = "2e2062f7fb2bf70c4c37ebf9fa967cff665f2bea91dc9336ca293816de996170"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 122; + dataLen = 256; + combinedKey = "c9a844684c7e31347765b98a01ad672c3578a7cca73fdab032f7ecd10ada0689"; + iv = "03e90d5c02b6d040a872ccefb4ab38d2"; + plainText = "cbc6d2f141866dabccb850a34fb27c821f113c0429b4b73442fce7ca7f1300af"; + cipherText = "122a05473e5bb53614e6d68596bb27ee317590542efbc39dbca2c5523eed57cd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 123; + dataLen = 256; + combinedKey = "f220324197652ea93d97cd63becca9d5732683ef0569acb42ff9cba56fde3d73"; + iv = "3f40d9594e8b0d182589d8a0e6fecd17"; + plainText = "eb25def15641f80845392381f5c486698ad5355883809f1a99f7cf1ad8521d71"; + cipherText = "1afd1b88e62ac39d2895aa98ea5f1fe0f3ad48ec6271aeef0e4f4f61cd03dd7d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 124; + dataLen = 256; + combinedKey = "186d4ff1bd586a31efc153ac46ffa0bb4eaaccbb7ab6f21b40bd89ae3419c208"; + iv = "bdb0d4a2841a59aa125cc572fe3de5e4"; + plainText = "92a42a9f4aafd9a817ae5df2587035d30361c271793cf668399f194fb972dca3"; + cipherText = "f670b6a95aa854d187402fe15b72df586d10afd78b0d529a5954522fa8b1f248"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 125; + dataLen = 256; + combinedKey = "9eb927d686e5380cee80e4313dfc4a6fb7b93c67787060e84459850d305d0dad"; + iv = "a0a2d7a7d863282ebafbe0712bf298c6"; + plainText = "0d49c003942a76b9c97460d69309cd5c4d529b24c931683574992f95e9000257"; + cipherText = "555efb9e49b2961059563ed59ba0a2f49682599d7f3c1bbb4f8c5cdd517773e3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 126; + dataLen = 256; + combinedKey = "f5c9f118a1d0a27590d34b0e520a4632ef0b8ef49ac8d670edc346ead5ae88a8"; + iv = "542f3ef5b3027e03273b54077dff2a3e"; + plainText = "8d1472eeb26e2904ea1b5dff164b1441804a58bb39e7e99d4e324ca40d2895c7"; + cipherText = "ea1127a766df06cb5af5b7a25f16caa706b067372366b9f5f6ba3a4efa23c812"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 127; + dataLen = 256; + combinedKey = "6bb4ad6ced2b1d50a9ad5f66e1d16e2a821e563529697055e7ae3178b6814a68"; + iv = "bd16e5dc1fb18be7c47531ed1923234b"; + plainText = "48a0861ebe8179456cee8e3a412f5b85fbad124f6cf8355f9d0f70200c740672"; + cipherText = "0a378360a0eb0ab6835d01880c23b1931d22b06b8504b6a014bcab79d963ec53"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 128; + dataLen = 256; + combinedKey = "150d03c17da5fe7422dac51298287a5d4b30aebaed785ba66cebc1f1ab007fb1"; + iv = "fc3ed71740ae0aa909724d501f04ae91"; + plainText = "3d3eaddb3a73db2892d91caf8dae82545fcb836c2ab9c0329ef3e9b6c527a53e"; + cipherText = "c636d13577b37a68e823b6d0e87827a47c54d735483fe0b2487b48576574d465"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 129; + dataLen = 256; + combinedKey = "ffee0b5a65efeb42e538aeda73037d94bf9d36b8a6a9c2b145ba142a607c760c"; + iv = "199a0ced9c9fcaee9c0b38bbd06f6674"; + plainText = "cdc3d155ff05ea58512b25d705b162d9b22fed9b691e79dd581eefd71fc40e17"; + cipherText = "8405bc24cdea6eb7948e4f29d2c34cd344dee8bf71906048776ab2413e435dfc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 130; + dataLen = 256; + combinedKey = "9f33c089f3bd6c50c5f2332eb0a0d023696bc770d863b033879e7191f5f9655a"; + iv = "d3d4e8e95a42183e61ecfdbdb7b7260f"; + plainText = "e5819181143e83fd0c21e0d6d8e4edb8240fa13955a41ee18bf6d7fb3eb27888"; + cipherText = "7d4bcdb6fb84c8dfc03a5c07857896fab0aa3554cd2967fc6510be2eecd520fd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 131; + dataLen = 256; + combinedKey = "d2bd1f7f6584fab6d93659be4c72ef2c1e855b725b1c2f6e22e56595591a8c32"; + iv = "653f53b9e016b22ffbe0f70dd3d5e0cc"; + plainText = "f95d51444a01b6505d3cca7bec5050aef5951146a1ca11c743bd853bbbed48ff"; + cipherText = "95ffb2d80c8623b500243e31b7488632b279e3bf35c5b62d687976938b19f25d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 132; + dataLen = 256; + combinedKey = "fd16abcb0209b43993c1d1607682b8e9a6347087f39b3591a02d3fba49b35248"; + iv = "4518764a3a3d362132a65802373c88a0"; + plainText = "643d5c7bf3d6932233863f97869de49c7edf056a0570174a275a9d23a1681953"; + cipherText = "02cb12154b49f814d698d8e2cc475d8c703682f1cbd58cf264590192a57e15e8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 133; + dataLen = 256; + combinedKey = "cab9925ff7a83d3081a384bff6fd701c69e2d1fe14773cd882b6156f531fb4f6"; + iv = "a25bf3170e3441c11dc09b75e931209a"; + plainText = "e89fb9ee859a907c09b6a2bb0be8763b8d5ff78b2df416353b34fe7799e47d68"; + cipherText = "accef6b1e3c81551585dd9f0caa79051cbe711f29478914cf3edb40b89a3b459"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 134; + dataLen = 256; + combinedKey = "cd7ae924c7b16d69beb5f2bb49e63359ac0c1e85e6629356f20e61ad587beefb"; + iv = "babdb59861255627188b2baf855220f6"; + plainText = "ca586003ca561172fe12e88d1cc87e46a818d1c4345fcec600b1899c9872e94d"; + cipherText = "56fa3f1129afe29ffacdc23b96a1d0cb684cde37d7bdc865f119003bb35b1625"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 135; + dataLen = 256; + combinedKey = "ea86ecb69cb95379089af2282de2c1777bd045990805fec77af59a59a60e0973"; + iv = "3a2e81ea77e49c98d9b3348ec2e8c3bf"; + plainText = "42faa6457bb4d1b765a8d69213a881972e0e6f69f6aef8121c8b3229feb9a7d0"; + cipherText = "f76a933486daf9c18b11ccc56e4f06516c74dd4d859d6101b2321b264be4d988"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 136; + dataLen = 256; + combinedKey = "2bc8c8c2ede375f68342b85599aebe95053f9540ffb5c6dfd546d727b85866d3"; + iv = "a9c7a140749916169ab7d03ad69b09db"; + plainText = "2b880c706181778df9dbb149b5cc7332fce0c6f2396a62bea9f63d436b676f5d"; + cipherText = "e735c33c64c46833ae9004a3242ea8a4483a23446c8a30039bf1ce9e9aac648c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 137; + dataLen = 256; + combinedKey = "d2dcbbbd6dd4837fdf67cec26a2dac9a34f8f3155d912084913233fee995e0e6"; + iv = "b724fa1b5544987ee02507334eb4b403"; + plainText = "bbb881aa6cde8fffbafc60ebbb92f1408f62efa890a34165302d955a50d28a8f"; + cipherText = "543556475807367e29ecc9df9a3cf3e5c2bdcac2fb3a1a34880b428a77ef058e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 138; + dataLen = 256; + combinedKey = "e8890d22487499a7e9484aa5a2b907c7a74e6e4dd8acd6f8295f5fa8fb428fcf"; + iv = "3d39a8273577aa6f2cc77a825f008fb0"; + plainText = "7e9eae63331a1141796302f6f8faa4a1e57cf88c451aa9d0a197c604f39d6e73"; + cipherText = "a51059302f51dba607ae3a6c147d117026642a2141fdb7ec32063d66c7cb732f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 139; + dataLen = 256; + combinedKey = "8328bcee227cbebb333439fcb2f6a6983c1036d32acb876d5c497d0672a79f93"; + iv = "c156adc18410efed7e40e1f71d1c346a"; + plainText = "c5569bc57aa6335ef418a88f431e207df1344b7871519628dcffb3dd4014eed1"; + cipherText = "8a9759b7b861646cdc69d71899ce1b7945974ed5cf30fd7fa6522d0365b0a456"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 140; + dataLen = 256; + combinedKey = "b250c7ebb90ffaf586237b4ee2fb7a50a55be3b36240717d350677a8bec184ff"; + iv = "8aa8d620f4c7d912c1fcf8c9c4d97120"; + plainText = "436e79a7aa1ef3ea7711b50bce0a4b42d74262ede83285e2440105b6273555fb"; + cipherText = "1249c501c7c9d8738b44ea886aa937b51166d2f1d78b2bdeeb89a6f57c92ad84"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 141; + dataLen = 256; + combinedKey = "108d6aa5663f607ff23baa0a2df009c8ba66a961609e1ddb55ecd3e7c004843a"; + iv = "9e1bc5989069195701e463573fdb449d"; + plainText = "fe74b0bae73e63e14380acadad688813782b4e58c0a66dc0f5d4a0afa6ffead5"; + cipherText = "2a1278fd5b629a99e490ede424d60638a342a422c3724297e67e7655fa30ab33"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 142; + dataLen = 256; + combinedKey = "68e87481fbc1a6ad5212b5a90623a19259e815bc480c965218940935e719c2a8"; + iv = "c5a0c814d862dca858a8fde9349082b1"; + plainText = "0e51977754a6e12543987cd5c198f2b2d2fa557489554cf21d2d6475b368ad89"; + cipherText = "b5168def622240d072635fcdac76f53792e0911659f9164f462aff6393bc3230"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 143; + dataLen = 256; + combinedKey = "00aaaf503ff48e0b5e243c04e2964318e025515a3af61d17389924ecd7f5b78a"; + iv = "574c5546dfdbb250c65d7a1393535e38"; + plainText = "f0bfb5a2ee5bc76fa824a995cf21474cda83f7772b745029aa5db45efa2a5702"; + cipherText = "7b799a04b0b7523e6bf1780c92b0e00165c95db33cb1d6dae31b95fd1d06852e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 144; + dataLen = 256; + combinedKey = "fe67a19db571d11b510bcc68582f920c900bbbf1179f49fd165b8d43d22fd76b"; + iv = "fe1c65e0f7dcc447efc0b73f3eccb387"; + plainText = "e6a5ee6d2d7dac1d49e6dc729707d8629233ddd624a6e0f4e6f2f94da5b4a22e"; + cipherText = "2a084f60b0984284887fbceecb34dc06522501d49132b8c09953d8f1e7f92526"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 145; + dataLen = 256; + combinedKey = "1fbe68d25691e994174402172568270cd19bb73ae569f58bf416db2583cf3dfc"; + iv = "a24fa3f6ae4eff66987c3440fa970411"; + plainText = "b54e1a6cf7a25e1b28c83bfedda0bdb3dc2016c6934d9a46fb761552c2983e14"; + cipherText = "412f8d6f00e06749fe997839e355170fc226a30859035a2f5c8534c3eb75a305"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 146; + dataLen = 256; + combinedKey = "b3a64b061daf37b460aaff669ecfeaf9e1184e75979e3625a39a8f4efd224060"; + iv = "3508616ae6beecd711bef5bf36272b6a"; + plainText = "de2a2664734c2951bb379927bf1fbd59611389f062459aef1dc1785622bd3c7d"; + cipherText = "b1d4fa46e5ca6e1cff727defb393c0b6705ab20103dc5389e1e16510e7825043"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 147; + dataLen = 256; + combinedKey = "08b61fd53e44012c3e79439c5d70510dc397779e6eda447f4726bde244e54fc3"; + iv = "74d64e519f70f6a07cf78eb5bee0daf9"; + plainText = "54d0d71ee3150949a4a9e7ed5a2511b962284a72b19a5bcbfa2b374739679f74"; + cipherText = "93e047ca46b1c895be3d40b4e1a8ae7e2445b7e4b5b73096e8348d83de41a9f9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 148; + dataLen = 256; + combinedKey = "b0793620d1e0e70e09761ab823375f8254f6d9aa19c1b0e9b0e93537e4e9d273"; + iv = "171888926b3234a78f85a18699a78d66"; + plainText = "4967ed2f9b45c88c0fc4dbe62c5e60d3b869f442feff68235115eb721dc8f97b"; + cipherText = "d11da60d048b85951aa2c2a1904b1466b65b42d0a884af1babd52d819bde90ba"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 149; + dataLen = 256; + combinedKey = "914f0fa83fbf0672e2e8750eff6b63e76d995b92b8381cc0467583cf1383b753"; + iv = "c09411a193cda4fbc6b41cf311fbbfe3"; + plainText = "06c6d47114af28ff9552c25eeac02e063b073f1c805f0aacd7101e45a3e54335"; + cipherText = "d8a63140cb2193fda13c6e562dd478e53b947b5fe0ca986258f9545645ce7484"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 150; + dataLen = 256; + combinedKey = "79d81e8f16e131591c4478b2359629863d05e4cb8a8cc448029fc3dcf359136d"; + iv = "1c4d0b9bc104259141f8eba79b02c0e3"; + plainText = "a6abb3d0ad235cf19e2abb3f08419e46fc7f085df88d920c5ef6c2339f35d5a1"; + cipherText = "e27a9b1080c250b1ccfc29f156842851fbbbdfc1b0304df6f9113bafbfd4eaf0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 151; + dataLen = 256; + combinedKey = "db676f35d34d6cf87926320c9a5d176f5bfbe43ca3c086dd84d4523fc3dd286a"; + iv = "b76091a033157e2a8a6bdb0a41a3ceaa"; + plainText = "015ccf8269e7b550683a1d464a4af8de8d247dba5b522399a098873bca306f4e"; + cipherText = "921fc41eda0390ab6fd000dfd17a4e435dcfc3edee865ad6bc63e14e9be08cc2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 152; + dataLen = 256; + combinedKey = "c0ece3ca6208cdad6e80960f688bc6d44f667e63d2d2334809f5a56097108a70"; + iv = "5c02ea040a42ace63506ccf11bfc416a"; + plainText = "db6faf2b5c5b3405ac29c81f5f9a4226b78a47f6c5d88a84aca5f949464649a2"; + cipherText = "0e698e0b904eac5043067621c1c2e4d4d70e112ebe4bb0d36d9c7f98f5b11bbb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 153; + dataLen = 256; + combinedKey = "ec1ae252e67461610fdbc89430d5b86cdc742b137c98b522b748c9dd7b19d4c2"; + iv = "1760c4f448e9fd9f1a1ca87066e85357"; + plainText = "9878f297ca65cc5bdb75ce1aaa9cdcc606851be4c7102a2b1be93330610701be"; + cipherText = "16df0807260558ec9ead9546740b4a26fd18db929fac98bc626705e0353e575b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 154; + dataLen = 256; + combinedKey = "d490bcaa38f5dbfba1bda07766c89360a073ab286b08e1eb2313d20ae2c8bfd6"; + iv = "0781515a38152d9bd6ccc767fd8790c6"; + plainText = "033ebfd9307cb933d7f31bba686d12131aee098bbafc78e34432818945316e43"; + cipherText = "731c4518dad667ccfdaf9ca43687b0e7b229701bd424e13744b98c092edda272"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 155; + dataLen = 256; + combinedKey = "7c6a18620a938f9a7db57daf12228e3726b627885b64acc66663feac88723bc5"; + iv = "b711b097148cf15399798a797b32e40b"; + plainText = "1db63594d07288752e02e80c96a00a27b2622aefcf892d620d6af143842b685d"; + cipherText = "fd6fbeecb81fbe6a01a383bfb93821978496dc8e6e7cc849a5f303eaf991f44e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 156; + dataLen = 256; + combinedKey = "b3c5019d4a999f9867dc273e774004e52aa6e8f8ef30f111a8fa9f33caf911d1"; + iv = "1389912f693a91dd75c6abc8e3178f38"; + plainText = "d2a45db4fe4977f9eeffeab5c298672db54340acc7fd330a603a5d50ba094048"; + cipherText = "60a2b46f265a130bbe945c311487947be98f95dd94d07463f856e22e2f00ae10"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 157; + dataLen = 256; + combinedKey = "42ab6421bb941ae050265e2cba5428d2b8d809a4e8955b19e8f9bb6c2a506ab8"; + iv = "47b2af6be281dba549b5edda6013c33e"; + plainText = "a7b464c1a1d3e02ce6418e1aba07afea9e3b1875960425ade82c3a7d8e28ca20"; + cipherText = "a52dde23a7ef21c5b71baa35db4c866de399b2413c256ad27897ee3fb1fc3fc2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 158; + dataLen = 256; + combinedKey = "bb8c1ce52a26eff7891b236f210983804445895a662232737667d5b9c1a1a756"; + iv = "a1f9b914f51c2fc518fd4e1dc0cd9e20"; + plainText = "a9d85a3cab881046ec08dad7b67a35bd0574eaafaf644057ac1bfee853c787b5"; + cipherText = "ff834a29b9327682d47740d48790c2d6a87ef9d5bdb23746539da3f112ccf4a8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 159; + dataLen = 256; + combinedKey = "f355921856d81f1233201ad82d008adb3333443eb874ea25e3bb6a560daadfc4"; + iv = "4480165e94acc6b505aea96a248db153"; + plainText = "2c647fe94baff35d9a959b2dbae93bf96e03ca9a110990f39a6f2391cb279d13"; + cipherText = "3293052aab4957e2ba0da725643ad7836ffbf180eec23c6cb96dc383374a48fc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 160; + dataLen = 256; + combinedKey = "1a4cee08ecae3bbe396cb117973ac97af26f28c829a1f1fb6014bf4487b76748"; + iv = "a82332d44b621faa723c25c04ff78b18"; + plainText = "5b5d453697b9d6d300c6424390eeaf0dab87a1750a9117c88c22605ff1bd0aa7"; + cipherText = "2290a3a6d9fcf3c53f4eb8bdf5d4bc2871ea85a4feab8a5e619506a66c252196"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 161; + dataLen = 256; + combinedKey = "d90cfd2eba0a28ffea8ef2c3b4724c276b5e7eb326d35e5dc1f01a6410826760"; + iv = "d216fe8a649d360ee6f41e0a84f9b412"; + plainText = "2fa6e6aa438d1d450bd5ba279a886284fe048fc63b53815b29a8c5e9b830d298"; + cipherText = "205d6048869dea91a1c799fbcc907131a39f28592bbfdb35ae9bc1839ab7d671"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 162; + dataLen = 256; + combinedKey = "32c0a67f54d6dd70d89c0150455ab94aff12f2ea92becefd8125cbec0c93d78f"; + iv = "a39cf92f616655971829bb8a8e3b9a50"; + plainText = "9a22c80cdf832a4b4d74b1ece1858a3bb6f1269f7c4975b0d985fee5b6e3165d"; + cipherText = "a3ae25527c1bfe1951273c088140c40a2b8251e2fe6e9f7d2d0e89888643f254"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 163; + dataLen = 256; + combinedKey = "2b76066d453f38a0cc44ede9e0ec0dbb9144deed683324c6c8f28208febbb41c"; + iv = "3de8fe112175b3cea80eb0eb6658e81a"; + plainText = "ae33b068bf0bfb9ba4be59fd8dc086514d03296f338c34946921d623a07f86c0"; + cipherText = "e8684a34400f07358b93e34bad4e53e7fb109d12d039d0a1deca87ee352c6a74"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 164; + dataLen = 256; + combinedKey = "1af055188f7fd5da6a6c7ee99ef97a2295fdad2ea65baa2c5548117a0dd75984"; + iv = "d4c35df7239cad770fdc5bcd3af16aae"; + plainText = "b9bfe972829a5245b94111f0af264541edc6d18862f1a5cb5c19db19cd4e5832"; + cipherText = "8c7800b4f9afafce059273e420ab9295801249b0d1e0534eaf2cd4ccde982043"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 165; + dataLen = 256; + combinedKey = "f580f9de21574e590afed986d799bdc0f2be0e1bccc8dc63094831efbd580aa1"; + iv = "a66ddfee9ca403ff4c1ca6e45f5e1935"; + plainText = "f9ba39feda0770932737ed3c852d42424faef25e950d0308683e178c97beac95"; + cipherText = "b968ee9951a40ba83a3a9186a13043ecb9c811aad39af3192c53476cd0bfb597"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 166; + dataLen = 256; + combinedKey = "372e74a3faae8e542ae35b72af0c3d5aab74c00d271e0841ea9f99ebf61de426"; + iv = "fe9cadde37eae0c0fcd22dfd4702eb64"; + plainText = "db3426357ba84cde7773deb9824ab8c946a82b35f10ecf524c5e131c70a12c6e"; + cipherText = "3c52364ae04cef376f8a45a60ed7a257356c1fde848fd9966dd04f49a5a45b41"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 167; + dataLen = 256; + combinedKey = "328c716fb35f2ecd9b06f508d748bf6eaaa760e1b15338dd39803f8608865e8e"; + iv = "ec72bccdec634e52fe577eb01f94b8c4"; + plainText = "53afb290b590eb021f13983f8b2fdc81c860b00b7c49a66a63ec2e80b7857e7a"; + cipherText = "c57805f331ad8e258a6802cf4452564b22775f233fc3986b51dad90f088f90ce"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 168; + dataLen = 256; + combinedKey = "6cbb2b84ddae119bc3d7348616f5c4e6e6761573eca2b50c0dd0cc38f83552d1"; + iv = "7c39e0aa1571028239acf8a146a6171f"; + plainText = "f43b8b274e8c663e1dc67d3e2fb1130687f06cda32acf79654f63afd689659d2"; + cipherText = "15707ebaba24b5edc88b196e64a811fe26daaa98addd63ea95d94dde31251918"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 169; + dataLen = 256; + combinedKey = "0697a78949959e880bb0642dc9d20b1b4e111d9d0c5137e3b02509fe2dadee98"; + iv = "b5c9c886255c939a7783718abc98d0f5"; + plainText = "f30933e383fd28d2caaccab312121427444e2897866926644f32941186f842de"; + cipherText = "dca8a029f08d4605f2ff52d4a06c67f4a79c955288892db6bcfada530173c075"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 170; + dataLen = 256; + combinedKey = "14fb356f5a2750fe29eb541a917b82a74133316098bb2d3d5f44f9aa08d7c982"; + iv = "669a3152e5511028ab67e22d4c3d6c0f"; + plainText = "c21977b084b3338b2025194ebaa961a36bf1be1d879b31431d338bed698cb8f9"; + cipherText = "3794283e4d14645f4f21829df1eaf8281c89417c7ac5ee91aa0d1a1c068fccc3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 171; + dataLen = 256; + combinedKey = "e90be15f0803cc97096fdb065cf0c6d814d5d8c809d91ac252208af5575c4638"; + iv = "1b82d8540723fdf2356b2a7aea44942b"; + plainText = "07359f3446194255b462dc4b6588b93d8fd2be2bc266d539033e80f695c99050"; + cipherText = "705f20eaff14726b157c4bea1e0da2fc7457b93ca9b71d2d6af4bc00e2fa6082"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 172; + dataLen = 256; + combinedKey = "68546cd53bffd10c39de9e4a5e508824fc28e6b2a8072e7f997424634693db56"; + iv = "fc8cff998ca83046f912fd0555a1b439"; + plainText = "74acd5b9ff6af0bc26c5e5ecd99c7650018617e84c6ade4c7f0811532ba165a5"; + cipherText = "fe2cd465fd16c295dd31e3286401e3e6ad67b0abc6cd9fe7c74a09954944e190"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 173; + dataLen = 256; + combinedKey = "3e9921d44330dad2794cc8a62a26936e0721d15e987778bf8e03bce123ecebbb"; + iv = "b172688b348de5867f9b3f516319aa2c"; + plainText = "b55370d0816bf2021b0f5a8f993ab50de06184805ea2ebe41db8f4fc8aed40e2"; + cipherText = "7095ac3d612c4e95db2ef9c4279628bd763b56c5e3197606cb4e8c62cbe400af"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 174; + dataLen = 256; + combinedKey = "69720864b5e6b66964f27e8cd1c5160571c7396fe096b9fdfe0a442b1f3f39b9"; + iv = "cf6c57f85d2b9ce5512f39ce89945805"; + plainText = "b1f90e2fb206cc3b16efe6ddd7610f3c831e0aabd91ac14aa93ad03afb5a1e66"; + cipherText = "9017bbc0f50dd2a0ff9abd5ef3e75fab3d8a18baad81cc4eda6fb4f71739982b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 175; + dataLen = 256; + combinedKey = "3d9e46f24063030aad20769cf2946ad1d5627692827dcc678f9cea729ce1c524"; + iv = "6eb2e1f09ba7cf8d8407b2be460bb23d"; + plainText = "3a18c3a87f58f16e87584f60cc8b9fc595470bbe00b90b2cbdc5455b9de93606"; + cipherText = "fbef0c4744b0d6c317d0a05d0cce8b11eb2b58daaed818be8470a6002785f0e2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 176; + dataLen = 256; + combinedKey = "88040dbd3b437f159ba731bec440d15a1bdaa919f8e1c91a2b92b77b42ca187d"; + iv = "5459bf420e194bf33d07c53c9bfdd26a"; + plainText = "fa437b5d765f4cfe8bbd84eb7f0c65554be6f64ea9706e6024465f83512c8fd9"; + cipherText = "7f7efc731bd8cbfee383f0e7cacca4a8d4f086b996749fd7e590cf48e5a626fb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 177; + dataLen = 256; + combinedKey = "4048849c1bfba6bac2b87b82c22c52b3a59885dc83b23bb9ff7fae3a1f299813"; + iv = "34a078618e0d69bacb4b19b631686d5b"; + plainText = "0c9120c4393ad8124e9fe93a0a04ab2a9fcc07b1fc734e6e0922cbbcb1c6d056"; + cipherText = "cbd8ccb0896e7647deb88beb0688151858f1bbee6e70dfaf90cafc35f6c2a037"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 178; + dataLen = 256; + combinedKey = "dd26ae8af60c270e04114037007bcd2b4df9110dce28f1080d1ad8d7015819c1"; + iv = "c1e4da905712b5e999858a580735fe61"; + plainText = "04d53aa586b03e04ec375a3ff5e1829b89bd5f2171e187d8f33f26e4bae4bad6"; + cipherText = "ece10ba75a58ffb35185815112b53c62c5a57515b4b811e3157bd5d6acf59ba5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 179; + dataLen = 256; + combinedKey = "47cee261912713727f7e2031bc98c7f57faec23438667caf4d76cfadebc0563a"; + iv = "00410c09bc2516e7973b9e2c3e842764"; + plainText = "bc0db82db7727356edce2ac5a5761a4002a697fa1e3c3fee1960738213f6541a"; + cipherText = "0f4bb01371ed9ebe8d4665bd9251e0a10c5879febc790fe3a40407acc45422bc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 180; + dataLen = 256; + combinedKey = "b2ffe72136cfe6b61d81a215aadd2ff7c59663946fe79731d81decf24be926f1"; + iv = "b706cbc26ac6e101731441c2fa2cc8a1"; + plainText = "a3eefb4cfaad4c5d93a79dde4b7b7d3abe4eed4c702300558e6ec884d11492cb"; + cipherText = "997ab70bdd9059ca0eaf13f3e76045bdd101ed3063582668cc65e127a5143d48"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 181; + dataLen = 256; + combinedKey = "a3f410eba2dec862ef4c2b2966bcefef141a318dade1644b4d869113fb1187f5"; + iv = "fdee2ac34f54f1afd5c8cbdbc92d6b1c"; + plainText = "63999d19f106f7e549df4ed39fd7f9df288518fa548d2f91fe696973bd9f8a96"; + cipherText = "708dd39a3abeeb23ad2b68a9e3d7fbba5c29273d66cb22cbff6131b6790ff989"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 182; + dataLen = 256; + combinedKey = "7a60d4af523e8c8341741b858557f653e4ec680b2184fd3a7eebcfb501599b84"; + iv = "02dcb83b94125354eced55b8894378fd"; + plainText = "7c8d8bfd081e5f514915b5fcbac8848a5c6b617c54cd53f6feefd25169830c5b"; + cipherText = "1dd8629021b11316e155c7c6bdd5dac27e4a783cb2c0a722e90aec96e345a14d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 183; + dataLen = 256; + combinedKey = "84e39898c01a7583d63a89588d7f21678c662e69f7ceccfad8fe95aafb0c2722"; + iv = "18e70f3664884f72278efd16e9713873"; + plainText = "ef4c00e214a80cc414a7dc72bf24ba603754facef9777b9ebfb5d651837a3d03"; + cipherText = "9fd22135b2667597129f0894a283482899655307e07b47a2bf0e788587854d22"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 184; + dataLen = 256; + combinedKey = "e5783de37c5c2421f4d5afea7e2b6bc44390cc75a1534a39078908916025a592"; + iv = "4d824958dbf6ea151a481dda3881abeb"; + plainText = "6f7338f14613863e2d8b03e0250a0653210f7c29a5e8d5151c7f5c254d73c885"; + cipherText = "f845449e89be60016647cecc51ad023bb8b1d5f7081f69ddbb4bb540804196c9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 185; + dataLen = 256; + combinedKey = "6f56eb4f5f925daf0e71870a05b7866edf1ea425a03d294620aa0a11aa5ca32a"; + iv = "1271cfb272f070c29c51b4f6e5351c43"; + plainText = "65a0d1a91ce6438a92907c152804c7d10cacb9a40050a2f8665ced96dc749894"; + cipherText = "2466a1b111007f25672cfbf180d59d3456c769c28352a1af3d8ad43f8bf56c0e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 186; + dataLen = 256; + combinedKey = "5095097cd958ef09a1781c1e7969792e17e107f283d40f13efe1b82abac8e667"; + iv = "28b1d79c3f2e79922c159bf9c33ffa04"; + plainText = "6720b63cf0f58bc656cf51bc130e9ed39cade14b09e66f062efb9a8a5132ac99"; + cipherText = "d36fc5506d3175f29afed429f0197eed5b660467a877c96d80b6ea8a7ef82d24"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 187; + dataLen = 256; + combinedKey = "dd2d73be1cfd9ec197befb9dc519db73266ccd17ef146f1011f4c3c4186a6ab4"; + iv = "1a79f1dae544d630d9e0d69bb3a437d0"; + plainText = "9ac83550c2dee72878f183439db19c07b75828f73645cff270c55befc61fe9ee"; + cipherText = "bede927accc06fea11269dbd8277f4137f7d3cde0c8ebdcbcf6ceeb1d73079d4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 188; + dataLen = 256; + combinedKey = "d65f059c365cec0916ec7750546bd542b9b62864d60dc4446155a788104b04ce"; + iv = "18dbd1147d6d6b9ea3b09cc685c84aff"; + plainText = "16d47b6427570495c11e6b0913992429802f593c2fd73cd8be08a2dc0d7c190d"; + cipherText = "f923401cce5350b36bb515f6b2a222b3f0e0e944666eeb728869af5940921ef7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 189; + dataLen = 256; + combinedKey = "0ccb23bfd8bb00060d728a0c4286a4fe148a73019e18bc74020b482f9ba69593"; + iv = "cbc73c9074079e0b9a5d8242a3815a0b"; + plainText = "eab22af948e6818e8d6c6e22c46e9bb45ca704ff3d3f88c680dcd02ac0dea94f"; + cipherText = "1ed6cd529802a136ac4eadef8e873933f85e21f041ded59409cb35ce5770e888"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 190; + dataLen = 256; + combinedKey = "d6250ff8814fcf5c56b5cbc16b63872fe16d8216ece3443a015b31ddddcf9c10"; + iv = "8b01f97ea86f56ea25a520627591122f"; + plainText = "55e0e42e7e7a32830e890398d42de8a6bad5a4e35f06e708feddaca0496ff3c3"; + cipherText = "0bd4f2f7ff747bfa05139ebd4dde9f45578b4a68e61608875579239b280a2401"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 191; + dataLen = 256; + combinedKey = "e8fac0515e137e6f502ad4686a9485e9749e251164fc6b9a84b2bba8f8b535bd"; + iv = "71f71fc025baa3be5dba771dd10f26c0"; + plainText = "e5f7eabceeff50fdae6965945f79daecefdb5bad381f9a331f111b0764b4c39a"; + cipherText = "fdc1a0506fee2c1fb26f8da692a19bb6467db8e89573eb4b772110e2a0968cfa"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 192; + dataLen = 256; + combinedKey = "f55834c2c6bf0ca9675ed45a295ca1fc506fb1b6ce9f75ea1014ca03658f8b8b"; + iv = "c9567323a7d5952f3311a34a7a1f12f4"; + plainText = "037f595a8092a30b9b973a9320546581ce77191b66b59d4abe7ae313a53ecb59"; + cipherText = "dfc47a1e0f1ab4600b7454c1d6e03fa005e9e0c8f68297ad40441fb8aa36282a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 193; + dataLen = 256; + combinedKey = "77191695e30bdec01b8187dac706e2d93b9b695646164fa1c3e964b548f02aef"; + iv = "ec683efce4f936d6ec7b715a0ab1cebe"; + plainText = "eb16ef9d09db4d1a6382a2e1386cc5b6241e93b9f489fb1ecc80e5c4d0636b38"; + cipherText = "71dedda5c684b3fd651eaa76394a89a5da5088189a119bc7dd83049739e9efd0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 194; + dataLen = 256; + combinedKey = "56e785d82ab69daf5bc8d840ae55c76270daf8e5a30a06d19723371fe94fc137"; + iv = "3df4db3f1368402cd6f407be96a9c585"; + plainText = "bad8a12e48b1e5d481e793d4069e0f183d16545c28bcf65aed9f4a88ad269da7"; + cipherText = "13b76e3d2fbb067da7ada818e1d7c62d11f68c9830b1778a4e17d09e24dd25de"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 195; + dataLen = 256; + combinedKey = "cd717bd6709b2f5bb930cb4746ccfa58d2a3fc7cec5659251f62bebb7b0b2fbd"; + iv = "9c3957fd829514ba3961ea9149b527a3"; + plainText = "3002f2ee9e6c39a0b9dc14a36cd19ce2f6377ab60b8311dcf5d1845d509d5d6e"; + cipherText = "66849b4b41426fe8cc914338db6137446ac59a218cd335d880023043dedce07e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 196; + dataLen = 256; + combinedKey = "b620c1dad56964e070eafa7e0efc3ab4c38a0f5fefc09169b93890badc3fd2b1"; + iv = "9b8bb985f2469affc9d60332058d7fca"; + plainText = "c292e5e276bf28ade313ce2ffd1db6a943a386cc242ab7699df5a51bbaeab0d0"; + cipherText = "b7e3feae419608710cde65a67707b8bb91880545d3b9b3c494ad9be6c6a1ea0c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 197; + dataLen = 256; + combinedKey = "c927db32fbe3cc3d2f81fb6af9ac387679c0fe7d0105ade9bdb26ceaadb4a43c"; + iv = "ef5ba85e322a843c757a95ce47657bff"; + plainText = "d296c49a3b64395b81933818c68b5a38de22b23b8ed47e94b0dfd646c9ddb611"; + cipherText = "f9189c25cd7644615ac268db342ef7ee0a38c9efca6219cccc877c39f9302452"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 198; + dataLen = 256; + combinedKey = "70f39cb194b976a6fa56c01d8e79f73c21b785c70f6d3c7a5fce4eb014be4eb4"; + iv = "a49282dd9d82e517fdfa223e5e32d2ae"; + plainText = "8beb3486fae1978bcaf78dbfad311ced5fd500f9a10c3779048572dfc786f616"; + cipherText = "4fc195349b6797946c5506da2f5ed4ec61707736aa2bbbac9183a5bb3d0b02f6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 199; + dataLen = 256; + combinedKey = "5e3c6025a11678745c7c28ac3932dcc89ae3d90277ec3044742c5e35d4d073d1"; + iv = "0d473cdcd031285916593b3cae4cd7eb"; + plainText = "3b6fef42eb4788b4859b63dec4470585b86c366a5945ed7fdc9299895735d936"; + cipherText = "5ddb078085e07aabbb66ae09dcb27d98e5a4f667f0a64b56f81da1c19549ea71"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 200; + dataLen = 256; + combinedKey = "23694bae3f9d3d4870e34497c86500d5a97dfeb47c47552213e1f72f66d9770a"; + iv = "121a5c7d36e3c156a74512f8c0fe52f8"; + plainText = "968ce29ed9a126c1a531ce40aed453646d17f375fa69200b0523816ede9b1365"; + cipherText = "71ee6e7ba532898fb76c9d2828cc1e8ad826fb4a6d666f25c25f116780730107"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 201; + dataLen = 192; + combinedKey = "58dcd1be774595bf5f5b6880b4b123b8f2bf175d335aae07bb17302bb2c4443f"; + iv = "5f9d62baf3628f790afcd7964be504fe"; + plainText = "bb6e724e5343f4e1391262e39dd0975f7f82ff118a4d843a"; + cipherText = "96ab8de2934048158a78193baa893e671bae183a79fb7933"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 202; + dataLen = 192; + combinedKey = "e75e512b231efed91cd60438b0e213ae34b99f1d4fc9ad981117af53a40c9cb1"; + iv = "408094779056e4c612f1001ad4404793"; + plainText = "6a64ef535ee231498fc9212fda0b38254c86958dc8f09dad"; + cipherText = "7ce7d9d0515931b8ab84e8a4a6ba334c7374ded5df83d2cc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 203; + dataLen = 192; + combinedKey = "e733ca4c36e6174b55221b68ca76f2d40538c9d55b0a1011374a5843731906bf"; + iv = "fe36e49d0db2babea10731d391cdee12"; + plainText = "83d85b072b794ce4c6d2817103abb27b606e9db2b232994a"; + cipherText = "aa404725ae7a8b9ece9d406605be86c83c8798a3e0c209b4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 204; + dataLen = 192; + combinedKey = "8b4936d9fa250b59e181ec3d8073571124e166b1d1a0aa4557e3d297e860ac95"; + iv = "722e85866697b6360bc7f6beb9befa32"; + plainText = "c878a731c06d5281c70c6557c6281c4833baad19140aa6cb"; + cipherText = "bc59c2dbca762dffe83082c2cbb6e84634eabaed7c6b64b0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 205; + dataLen = 192; + combinedKey = "d036ed73522c1f32a75cb054143b87d086649abe6b26bd5610307ee0540d9c2d"; + iv = "9ddbdb685270f0b6717dde6317e2a099"; + plainText = "0ce23722d8eeafcdc8f5d3a5de187f499ccbd7ffbf6e89c2"; + cipherText = "a868ffb10d253449d0ad07b1716820c68e5da3a148db1a84"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 206; + dataLen = 192; + combinedKey = "d030ef0f358fc1c43a9b8c8654a8bf77fc7f335c89c4133f63c130f4a025f01b"; + iv = "b4337594524fe4b349f0088cc0b988de"; + plainText = "d5f569697b3afa39485a100eb5d58dcbd7b295e62d568f8e"; + cipherText = "5f929e3340b545836d7fe4ed1e8372cb222f5b053693c65e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 207; + dataLen = 192; + combinedKey = "84ea6dc7c780e71b158722d47a5b22e0ba7ed9a434fec1a310cda09879bd16d0"; + iv = "cfa31199d777a6be50fedc3d9b282244"; + plainText = "4b395ea31683f4d00434ceb66b4f76610ca05972887617e6"; + cipherText = "4e8b8a824946bfa0acf116038d2ddfd974e6aa5286ab8942"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 208; + dataLen = 192; + combinedKey = "a4e6557ea45523b2ce658d72763f2d616015aa029c89ec29029bab3849fd62df"; + iv = "93433ad27b4e265744424e7a511f2413"; + plainText = "128e41e0529f8d032c040acd2ddd126bc7ab53bfb1067d2e"; + cipherText = "3d989c699d40cc2480dda7f4f15e4ce66e8705651a6febaf"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 209; + dataLen = 192; + combinedKey = "64c2edb4b9164a4809ca52c3f7110d96bb37d577bdf2968d65f525c02c677f02"; + iv = "4d478f5f9cdfeab3059fb1c06e7a6002"; + plainText = "75508467bdf40bb822ceb17708ccc7d5adc29c6333fb0d3b"; + cipherText = "fa67e35d488db3dcc634000925bd231ff30c69287df23933"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 210; + dataLen = 192; + combinedKey = "2d12f1e7de982a20172091e1a30198f02c238f8adf82728a305585b0153dd1f8"; + iv = "ec98eba8f9f8c4b619e5e28f7c0ab03c"; + plainText = "a50b44cefedcddb6d224ffa041b8c56a9baf7963cc900b6c"; + cipherText = "48af0bd878a3398fadec0087c257d3859f4864ef2e26180b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 211; + dataLen = 192; + combinedKey = "60dca2cf0a8a6c6d4b5fc9a9d9c3f7bfdeb236b1752b3a713039d80cee0b586c"; + iv = "a0bc17cecc4b6e2a44a30bca6eb1e3fc"; + plainText = "0d701913397b8155fdeeaba6e25800dcb5aa40051a8e0ba0"; + cipherText = "831a6711ece4243e6cb5dd6aec6ff6e99ffa896d73b6c070"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 212; + dataLen = 192; + combinedKey = "119b3f064672b787c51ad4f791367b87c179c4575a4acf12c4ab97b395be5284"; + iv = "d5fb2fddac5730f46b63597f0b26e104"; + plainText = "1dde28834bb9f57eda926b2455e16ec5763b611db4dd1269"; + cipherText = "f715a9a58f1d88851d3b5e03b0d6d083e094500b21d87a56"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 213; + dataLen = 192; + combinedKey = "a52214318f7f38f2a234d7d07199929eb44a00851125012510588db2b1cf6149"; + iv = "8ba4aa93c8e2243b8b22c417876defb7"; + plainText = "54b9fa2b40ad9abbf7a7c60a6c16f4aa4b4ce8b5ad6ba60a"; + cipherText = "63abefd45e0f603622c5d5c4c399f91650709e2a2aa5c604"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 214; + dataLen = 192; + combinedKey = "5ae3e19ab5cd033cc36c46aac7d8864352d6edb80b63d3eb8e2f9ba0d0f9b199"; + iv = "2559e196e5415ac4b731d4a32acabcbe"; + plainText = "5a2972e0b83fb46447aef2d6addb4ab84c4ce36b6cf7c4ac"; + cipherText = "1ae7f962476191931ba374461531432053d943ca1628e877"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 215; + dataLen = 192; + combinedKey = "36a0cb3a4b69c6948ee71f742192cc7325d027876cac1b1077e06e0e5a23518b"; + iv = "413696e05473f82ce6116989f75e88e8"; + plainText = "d80eacb237627fa36d3f3feefbb1d16f919832eef20515e0"; + cipherText = "b1ab67e9c467679b3af57f03ced738475ca2fbbefe2e8004"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 216; + dataLen = 192; + combinedKey = "d4149d796074bb288bbb6978d16273e34f46cd1d0c67fbdbdc43a75f67682d48"; + iv = "5a2b3a4c004bd31d249d30cf879a3cd9"; + plainText = "616038cd825d0f5de8c9b6a88150d97df8e10f0221a3c251"; + cipherText = "d977d93e41d038ba2983be4c83869dd206ec8007b26ec06b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 217; + dataLen = 192; + combinedKey = "0507c4f687e5d67b1bf80c39bb9c825b8875b35742803233f20109bbea20820a"; + iv = "1ac6a10bbfe427608ffbbae687e748fb"; + plainText = "da3a23efde1a691b8b091f3ae6f6657b81ad4149eac3a102"; + cipherText = "8c41078f7d1a91e216a5ec4ecc2727ffaf70ae22666a3ffb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 218; + dataLen = 192; + combinedKey = "860daee1882b803f77b6c260fd2a3f3f84f1106ebe4f35e9a713e4c25e554396"; + iv = "6d028f6e284c883f93d572c0738a2468"; + plainText = "74f3a68dc5dbe3bbf91a344ef1be2b47198b3054d4fd6995"; + cipherText = "5875d4e29a2b76bf43a63c3f78d774985fa5f94ae2d94241"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 219; + dataLen = 192; + combinedKey = "2403bca495fa083bf329a31df41bd777698975301e19e1c07a3822b1c46e123d"; + iv = "2d540cca55594d659b9a8cf34ac48b3f"; + plainText = "5a2a4b6e6739f752ed807c9d251f9961c1ae2c6baa64976a"; + cipherText = "762ade540d34e38cf83973fd0113f7cd30e05a685758a490"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 220; + dataLen = 192; + combinedKey = "0b0f444c99bed94ff6eb730900f9f27ded92d7b9fc9e16aea4a3602fef1b8421"; + iv = "4cdcefe438ff1d2977b43bd24ffd3594"; + plainText = "6e1f19b74715540a45a918cd5099798099b1f6d11eb0b855"; + cipherText = "8a275fdd2f95752086cf70e9e2641192b198cbc1905a5707"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 221; + dataLen = 192; + combinedKey = "40989dd90f7e18431e0d09c3bc8f729ff00be9ab633a21fc9ca9bdc1da68636f"; + iv = "8f5376432a9d902e08a5004a4683a0ab"; + plainText = "fa5a7250d86c3e5c4ce1eb3ea0d20e45ef1b10b9ba9468a6"; + cipherText = "6861079119a67a07c6fee59cfe9f0b1452dc0ab6a5477c53"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 222; + dataLen = 192; + combinedKey = "880656e0cd40b169c3df7b45739c5c34374ca809a1e368422a0d558e236304db"; + iv = "ea2ff0db4c96222bc8f5d9615041489c"; + plainText = "ecae1943fab11e6dc113124582982da58220bad24f3885d9"; + cipherText = "aecff7c2f13e2c754d564d4f62346b7fb2490a1d1bb98625"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 223; + dataLen = 192; + combinedKey = "fabd574b0a82792013cc967b657b8206e6519a249c628c13a5d0505839feb86a"; + iv = "c6ff61a9a551d6b65ccf23e7b7a5e1aa"; + plainText = "07ab2158630d5f47ebc2e6cf236dc40ac16f120d579e438b"; + cipherText = "306bca44401ddf7d0531722e6123836137dfe2a7c3c8df21"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 224; + dataLen = 192; + combinedKey = "2984e3e85eecf101e9080bd2cd8de733dbd88fbd2b0770896be589ccdcc93a36"; + iv = "1dbdfc6499d2ff9ec4ce35046dd58d58"; + plainText = "6bf174de979249087f685eb36576f7f10cf6ad6e944e3587"; + cipherText = "de54080aee291808414e3df242ccc970a5ab2db3342fb131"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 225; + dataLen = 192; + combinedKey = "a8aca703c4a960dba946191fecb4125207bc70f339a4e4919ab10109185875d2"; + iv = "e1867d390ea90c54ff6ef7bd7e685ebd"; + plainText = "97b4511d1a2bfd1f31eb12abb05c96a89b10987c52fd5cf2"; + cipherText = "fb6d18af4eb2cdca7ca73aea236d6290559460fccef637b7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 226; + dataLen = 192; + combinedKey = "2b4953105b59f8ba271b3404cb24b6f4d863cc8b43a511f1d32cf1223bb9b8e4"; + iv = "2f9eefad143acabf60c893ae572008b1"; + plainText = "9d9406d7cea1ccb5fce2e5a6a6914c55e3a4637d0dfb8a70"; + cipherText = "ba1828567067ff15ccef8d4e71e7f2e24f88669bc9d854f7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 227; + dataLen = 192; + combinedKey = "fb0daec0d265db482a80daf6105a2d7c6dcc5f789ca96be0d7d49080f2192057"; + iv = "8e3152ce1d813d7c84bf449883553579"; + plainText = "74458376492cff5002dc826a5a1b94f121d1ca5b6c87709b"; + cipherText = "f7cd23b4e932bd05fbaa0f00cd0d575d37ec041e9ab5ba2d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 228; + dataLen = 192; + combinedKey = "8c23cc0515604dfdde10834f435a092c13ce1feb82b2642b9a35fcb849b272ba"; + iv = "53586f47f2529e347e06781bc5e0d1e9"; + plainText = "611682c4161238149812eb17ec5128a6eb1e937603033513"; + cipherText = "848750ed005a79ceeb2ccfee1ae4d4f07c7ae1d2ef46378b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 229; + dataLen = 192; + combinedKey = "78cec5f095b1181c42562133c3ddcabe6a58f46c2463c6f7c9674147106d5ef5"; + iv = "f1e1404292af1d99053483768222aacb"; + plainText = "4e13c5ba74ec8d4d8c494ad17edfad404618135f978b2c1f"; + cipherText = "6f6c69726afe9812e16b288cc4b3ef7d36b6a0d3e49bab5d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 230; + dataLen = 192; + combinedKey = "444bb1b5ae7e36bd0bafc396077bcfa3b2f7cbc56e35f337c531863b796160be"; + iv = "a3284513536815f0870b80fdc500192f"; + plainText = "ec7e5404deaa31235516aedadd98875a72ff255eec04814d"; + cipherText = "2e9d6e985618b1c01570a880e98281cebc3cdf98a6724333"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 231; + dataLen = 192; + combinedKey = "00cf714c2231a614f1701c0689daf99c31397a39c2c36191207fed34be45d176"; + iv = "6fe41af548268677b7fc0f4c8217cfb1"; + plainText = "1910cd1b79d646e865a11656681029b44d63926f372d6988"; + cipherText = "2ff1390e003620d8c7b24967c551466d97e7cf0acfa7302b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 232; + dataLen = 192; + combinedKey = "2a34cf27dad8d839b1e7a4e5cecb64d0989869bf3f0b58acb12e4abe8a576819"; + iv = "0613358d1f1945556b356bd1788e75c6"; + plainText = "46e61515b9e030f12c6a8c3b58b21046b2de55d6c084742c"; + cipherText = "52570d9a386822b3a5408cb7c90ef7baf11a3c03f00ce715"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 233; + dataLen = 192; + combinedKey = "5eb635e5a692204a55a942203c7f1b96d439f6856b68e05a0bab906c5e49e11e"; + iv = "674468f99ff80e595a9b28080d4d8d78"; + plainText = "c422bc317a81179874b3d7c1c2f50467047966b6c6611a16"; + cipherText = "76a0062b1d43c714946c42aa871f02715e9d6f87d1316500"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 234; + dataLen = 192; + combinedKey = "5ff616b84dc6cef762fab7796399b020cba4dcdcacc4799f6e32e79d4228097f"; + iv = "b30e9784cdce7c5da9332dba264a842f"; + plainText = "412f064bcbb1d388f78253bb3044ca2424f131ee323b7383"; + cipherText = "2f27ed530358f9d67ade6fb3c6352252118f5911ddbacc4a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 235; + dataLen = 192; + combinedKey = "75fbf194212c655cecd8331d010ff41f9ad59b47985e46bfb5421a7ccd8c7cfb"; + iv = "8befc7337153c8077fcce1c4abd3c4cc"; + plainText = "764fa204c2336770a89eb1a7018d7da35a702b7f186e27ba"; + cipherText = "1b339516c59bc48271b260ca56f218b5ed65c26c13ba3f21"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 236; + dataLen = 192; + combinedKey = "dc62f4dd2c532ddbfbbe3258a544d265ed9f6ca4e71332062775fc261d6b7e61"; + iv = "ecdb45751a8a61ed784697455ad0a87d"; + plainText = "59a55490efe6b34d2f92bed98c4250769ddffcf98f9048d4"; + cipherText = "1c89e43d4543ba1425d01878fa94b9464954d8ee671b72af"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 237; + dataLen = 192; + combinedKey = "81e160a14776a81a12b1fd6970738823a9161c1a3ee2da940fdf3d2c9e3b4b01"; + iv = "e168e98b72ec010d2e271e5e4fec5d98"; + plainText = "73ed9dd6b0e6827fd7e9986de56ebd676553241233ab5dfa"; + cipherText = "5e24e4c8925cad4417a41e7c5b52c4eace7b4b0c55a493f9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 238; + dataLen = 192; + combinedKey = "e33ce9c857a0287073aacc58bd461e52bb22cdcdb62b84ded6c9bab66d3dbfbb"; + iv = "2057c203c73b54b3fa860a88987ce613"; + plainText = "191b946dea6518c355a2420b4d313986af0f2c44d0bcba2a"; + cipherText = "aa6d132963a1f44d2817285aa96bc0d492899b58ec6ebc12"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 239; + dataLen = 192; + combinedKey = "83af2896547db2fcc4f2ad63a048da769f723dad00fd911405c0294717037e29"; + iv = "8586b1b992901e444bd72d01628da084"; + plainText = "c89a94442167d03d3461e11f88fc05e7909aba3ad189ddf4"; + cipherText = "bc30509a68bdeebb3ce651f4a409995cf143c1130d8208f5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 240; + dataLen = 192; + combinedKey = "479f9c4a2ee3c3cfd5158d50537ec441bcd31c9a820abe444d56fadd7bb7d749"; + iv = "b62ec0474b5b298f8108e307caf77b31"; + plainText = "8b43f4eca273e2fff394ce8134d29dd577fa290501a65d36"; + cipherText = "57d79669b0e0a327c343ffd519ef0adaacea04a04db936c2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 241; + dataLen = 192; + combinedKey = "b03b9408a6d961e0c43af57a4d734a59692e670a63122c9c7016e8d3f68a4aad"; + iv = "7a338a1933a5889db9ace3b640d66379"; + plainText = "5a9391d456d4ee9be29b4890e53242065ef2ac40992dc264"; + cipherText = "16f87e6dd594ba8b3879d71a256162742901af23225ad625"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 242; + dataLen = 192; + combinedKey = "c9be1e0c22d78b6fcbb658517bb8ef29aebe3b06b936f5b61b341f9775e13323"; + iv = "c929d36f34431592143222617a1eba31"; + plainText = "c184a47cd2ef4938c5cdb6e8dd0cd40b15cd5c18566382f5"; + cipherText = "177a6d918c084146eb24ea4fccb6ebe2e0e71d1c5e63d01f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 243; + dataLen = 192; + combinedKey = "83e51a46a6400803c20d82147f5163fe61aeb8356a11a5de132449f9344e4e8b"; + iv = "690fc52e36c22f175b175b9dc768085a"; + plainText = "37d39328e35b89208f60e16819fae98076559122a96051c5"; + cipherText = "230fcbb71cd9e9aed6c86cb3b2ac85d3014c45300d211f08"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 244; + dataLen = 192; + combinedKey = "959dd01eee7d22e047135142d1622edb7e53eda6a2acbe1f9d28d02690d2ae7b"; + iv = "e3bc6cafb639f6de6a8254bc6202fe34"; + plainText = "708093b85b527a45a578ffff999a3ce40eecb2ecf7c50210"; + cipherText = "e2c9833cd519e40f2bd6b13d834278af3673741c5beca103"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 245; + dataLen = 192; + combinedKey = "d2bb39424139bd98e2395b0b5017d40c262bc18f4c93e167914c04d755ad4e81"; + iv = "6124a472684c1dd1955bf8a8273e3e80"; + plainText = "e9e045ec762e9a8471d20a8c5fe5f7cd1a180feb214a763a"; + cipherText = "dc118d535950bce83b5bb425afceb3e9b5ecfc47e0ccdbaa"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 246; + dataLen = 192; + combinedKey = "a6f009bf5cdefd0605ae42a612ef4630c996c4cbd283c2ec1c517fb1e961ca33"; + iv = "5ab6fc1be86cd8a789606f157807e718"; + plainText = "a6c83a1e41d8c23ae46c9a43651d5c48a32f048f206eed65"; + cipherText = "c75717555bfbc045e059528771a46d182b3d0d9946cedf9a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 247; + dataLen = 192; + combinedKey = "c6006ec65920d564bbbb7af75c0def30904f67cb4267bb8ae59dea637818d803"; + iv = "a9319b84adeab56e938c6825d70b4a87"; + plainText = "f7f96a67d4699a3159fea6c8af8f89f1d1a7d11f53b75281"; + cipherText = "cd23ddd93bffb09f740da649fd394114c2e700d7a0770c02"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 248; + dataLen = 192; + combinedKey = "07c4fbc70b5f4ec54f4a0615ed0d02bc54054b512770d0ae15c6679995354485"; + iv = "dd8bac2d20235ba4088467adcfd156f4"; + plainText = "d502cf061e155267eb9f87291a2a65c3809a2f5e0aa64d02"; + cipherText = "e9c673a1e8daf26ff8d42d667e10d80e646baebc286c98d4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 249; + dataLen = 192; + combinedKey = "77fba954027a1298f76e277f67f75b7b832a054e5d1aef9c9a26748f6d0143fc"; + iv = "00db4597eae09665f43116ab384ba160"; + plainText = "cd282ef3c5f92c2a1d437982194278fe50ad85c4bf5461d2"; + cipherText = "c6aebec6c4965ce62fa2eb6524c1d018c95d221e5de1aaf7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 250; + dataLen = 192; + combinedKey = "b1c2c0a992e8aa4c8a8efcda185e8376b6f2a3c75b7311c81456ec38aa71c14c"; + iv = "46499c4df6e33198f57c641f71cef89c"; + plainText = "269cc20d7d1e78452facd9826f134fe0613ec0aced7ac5af"; + cipherText = "827e58370bca1e9a295dc5328bbde015a95ca3694c57c91e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 251; + dataLen = 192; + combinedKey = "554498f565d90b8add8282e21eb4f87645adcde0ddd2af3685403e84b28e5603"; + iv = "f6ad34d6d5e663c0f9c343eb18cb9ec3"; + plainText = "4d021db638a80a70f49548bd08ada14a6278ff53ec8b3c43"; + cipherText = "34f5c08ef5a179ab230f29281810248a8f9bd245e048ab94"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 252; + dataLen = 192; + combinedKey = "c731eb57c4b56be1131e1f91e03a2b766629cb14b666762d6b6689d33fcf6a87"; + iv = "0821831122c0bf7f72c2615832e7d4ad"; + plainText = "b082187850035fc5a802ce52f1f9f9d9baed6a61f59a4741"; + cipherText = "f4beabb93cade84dbab0f3bf9f5f989b89b1e65ed347c7c5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 253; + dataLen = 192; + combinedKey = "c9ad52aa28dbf6f3c214a2f3de2773c26383cee6233c158d70c5a2919622714e"; + iv = "282767ab166d1a7264e89d0705fa2141"; + plainText = "688602458c6468139a484920ace83fa24ad20d3542827199"; + cipherText = "28d2131b469e81a163d29add1c5463a1bd87113d4543d909"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 254; + dataLen = 192; + combinedKey = "2854f19670c1fd147ca9a8ded5d6cec44bedcc027f691893d82e0f7e2555f101"; + iv = "cda61b9757c608fa7f92e4ea5e6a01de"; + plainText = "0aed79a1ceb2072dd0a813ead4a00d2aec32d26b8b5c6a88"; + cipherText = "f293cdb7efbc2df99302223875a2a4f98c94260f18517b2d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 255; + dataLen = 192; + combinedKey = "1c8dc974539ac4045dbcd876113e085e3786d16acc1489473fa5d4f0300af31b"; + iv = "fc91bfd3ce811f02da3d42091dc3d391"; + plainText = "92a7b91170a3269515903868f83d0cc18d25c6c28cf0c8a7"; + cipherText = "fd8ae728f3d5a27e88bda8b36b126ec85d0ca842788a4baf"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 256; + dataLen = 192; + combinedKey = "5b8e02cf3fe0595aa7e3200bff6a2abcba8a85a154da4757ce9fdc15014d0c46"; + iv = "ea44c41b327f238cc69dd52cb5cffc13"; + plainText = "f96cf1885ada571e369de7a84556e540f798ff1bdc748cef"; + cipherText = "b9430408986a5b4f043d1d054ec472707ab1f4ef1f1b7add"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 257; + dataLen = 192; + combinedKey = "4428abe0c054f98c703dab8dd54cb0144e57f705bcf5d8674f87d094fd79f105"; + iv = "92d140c014671422dded741daa34f142"; + plainText = "a5064e5bb679127602d2ef1a0138f1026e351257cc9d929b"; + cipherText = "41a20a8c1941f44f71c516243ffb5b50eba4ec0b695878af"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 258; + dataLen = 192; + combinedKey = "e4ba3a2ce6e629801ba6e45691ffc95922886c2104f657d83ad151f9c5b60b57"; + iv = "369ffc3e4c2d2664b5db56384404d557"; + plainText = "5c7a5ad7bdd874d6dc7c72139690c44885d0c817cb897400"; + cipherText = "2e6712fb9fba53d8c176f4a4d8387682da8f4d3d7eff35ac"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 259; + dataLen = 192; + combinedKey = "7d4d49a02bb7d356edfb962653d0fd7582fc42156aefcfd56317c8e356304229"; + iv = "49966cdb0136dcd1bfa3a7ab5d74142c"; + plainText = "91ed05fe4c5e02998bb9318ade59963a8e81f01f48ebca64"; + cipherText = "4b063a75ae8eb225bdf5fc7308aa49391ccf968cc685ddba"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 260; + dataLen = 192; + combinedKey = "a74c21522d2fc8575d56aedc28f75c1d863401a576a9e6bb114cf5437b0843e5"; + iv = "b11709952a726aef4363663a9cb7de84"; + plainText = "74e725665519436f59b9ce6a813226650a6ed32921bed27c"; + cipherText = "d69875e881fcc4841865fed31d623e36f576bf7416759919"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 261; + dataLen = 192; + combinedKey = "754e034ef5a1a7daecb47b6d0adb386e1ffa9f253e0d0e859d35b1f08d812293"; + iv = "53ca1355e3d51814b318756dee865f63"; + plainText = "ccbd9c0579cda8455fb3aa2a0d8c6aa60dde3fc224c478ee"; + cipherText = "5d6c73280b0e07370a6c162c217781c522b679affc93c71e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 262; + dataLen = 192; + combinedKey = "8ec39e76a05d07405e5ebc0d1e8dcb0c12c3e9906d71132927d4b9265d577b71"; + iv = "3505382198f5e9ab011f3b0e861df633"; + plainText = "a53125b8d0b7c25fbedfb04b8bb5d82153b6de57c0b31edb"; + cipherText = "5ff7f2d4c722c8a228929013ae1e92af06b834b08b0b8d04"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 263; + dataLen = 192; + combinedKey = "e76226421749f0f793ba3beb05c8501de5c488f7fe6cfe2b3feca247e37d899d"; + iv = "5ae0dbe70fb112d24153accd8ecdefd2"; + plainText = "4ba61c42513be932b4cfd4c4e38ed4c3776a6132e5d5b7ea"; + cipherText = "6af72c4736ea63861f40c7258e89d72cb3ba1395f37ea025"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 264; + dataLen = 192; + combinedKey = "59a5a7e8297292df2697d823023a9d8446b2edf59a77d81e62a36846c737402c"; + iv = "6958af3b20f6aee0fcc62aae80506368"; + plainText = "f40765a38ad8eda342a08776a3d9d1d1876264e8330e2954"; + cipherText = "ad315bdbd64b6eb339b4bee2e8360381446ba1e2471bfaaf"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 265; + dataLen = 192; + combinedKey = "92a3e074db72e54902ca8cf5504fc46a63b583a5adb7b99f74d1fef051c3ed6a"; + iv = "ae0e5deb4bc9738b59eaba9b93a9e5fd"; + plainText = "38d15eb93b4b4e7956a0b17ec2d4d48db26d73348dd25935"; + cipherText = "8754232345522f4b592c0b42fd766ea0a8d5943fcb0186c8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 266; + dataLen = 192; + combinedKey = "e2abbafff6e5ecf3eedf5a36bd54a90a7294678f975271983bbc736038e9eb03"; + iv = "01c535c829628b39ff9f69ea30cf1653"; + plainText = "be55771576e9d661f0c2fc1478cbf81ecbae5643ca62493b"; + cipherText = "6cec891bf2d17e5372c5664d2085dd1d4de8ef489dfca2c8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 267; + dataLen = 192; + combinedKey = "ee7ea9b5f0e2ffe4ed9bae2f171121ba7163d4b2ae2ae442f0f4cb29920b9ee1"; + iv = "a1357f5351966bae3916e5ca4ace2040"; + plainText = "172539f3b1a195cccc6833713173700d2ff4e3f408203757"; + cipherText = "0af5cbc54e7c1fc276b9646ab474a2b33061e2c2e0e11f4f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 268; + dataLen = 192; + combinedKey = "5982b4a419a206bcc9201c392be22b60f4febf2ad1b7cb33968393a56f38f641"; + iv = "ef7319ae387ff4963d4580b5095899c9"; + plainText = "590d0acebfa088501227d51b59c9b2b19695bb89450107b8"; + cipherText = "f8eefa9d3ebcc70a028d172ff8a11ac9fbd6e68f79942054"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 269; + dataLen = 192; + combinedKey = "c161ec880ecf416d283896463c14acd8432d17e0bb0b28b0e961b5c4d48b18eb"; + iv = "8bc121db4d2e530e0bf9f6b771059ff7"; + plainText = "7aa7baebf96e2695055445c6fb64e9ab9bdcc0f2475b1ab6"; + cipherText = "7810261edba45688be33f87ddd09334ea5c51d8e8187b372"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 270; + dataLen = 192; + combinedKey = "50e4a004954ad740f4e9449e419ddf99df977ce956eaafa7d139e6c0a760d0b6"; + iv = "1386e16c78a1b63cc45779964dac59d2"; + plainText = "bad6de5f4c10b8391b86e169a94b75095d6011ba41d35616"; + cipherText = "44a56fada7887a9c11309d4f15b60f2086b6aad6f9af6fb6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 271; + dataLen = 192; + combinedKey = "672adfc4418ab5aca0b9aef6ac85bbc9a4f4d1701e67d844ebedf493430f712b"; + iv = "c80a9c7c80e563f68649f28100633efc"; + plainText = "8fcce65e3feb24f085f604cca1e7c6b709a4ffbf05e41b5f"; + cipherText = "a6e07ee9f1e3dae4adb3a28d69c8ac89f4fc620e6865620d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 272; + dataLen = 192; + combinedKey = "a7c2ee504cd4bb0b84b0399a7b85ec492e896ab9ae52ba3f06799aef9c8eeaf4"; + iv = "505191be00ee877f8aded6eb6d863bff"; + plainText = "3df7d778429a2f3fbee2e50aade8d4540678622860e04fb1"; + cipherText = "a0a1a7fb434487d0344aaee75020f82485cb266697606792"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 273; + dataLen = 192; + combinedKey = "ac8273705b9b948b713f511d0f380f96e61586874764053a4843fd6870fc7f37"; + iv = "536af19cd75c6eface2fb01a33a545a5"; + plainText = "e525895015718f71ee87dc8a60cb0cca2c63bb84efc7f9b2"; + cipherText = "71242b1e71b4d726871d1e050104465bb97742e00efde136"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 274; + dataLen = 192; + combinedKey = "abc99c4653a1ad75f50373166951f87e6b119f45ee8c98f129b79004398af844"; + iv = "b2687f07721671ed92ecb44ef09c2db3"; + plainText = "a5bc2bf156e1746b4704affc7339f8e3a6b787e52b8ee471"; + cipherText = "4c2dd14b495996698b5476fa94cde44b506bf054b4a4a63f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 275; + dataLen = 192; + combinedKey = "b47e98c44367332795e3a8fb725cb42c6372ec22f591a60456a7eb9922a93d26"; + iv = "d63df1ca8fa6ad10e592fa6aed70051f"; + plainText = "6aa116afb49827a3de11ee3e21b3afaf40dfd3c02cb52720"; + cipherText = "694341279e4e20c383a0d9b2fb69919b9231ded277cf160b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 276; + dataLen = 192; + combinedKey = "cfc73c32028663e260de49302228145594cdbc66550c6d4a4e21b24964c90e89"; + iv = "002aef62589f57e93b0d1a32ec178193"; + plainText = "8e43e11809e493a318ef3a98ff1f85d66d9bb1613b250334"; + cipherText = "2a254e09dae287364aa1bde30a805875ebaa7b8094b24e4d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 277; + dataLen = 192; + combinedKey = "4ee59c5c37d61a755bd4d305bf32771536930b208f353d4c423a6f8dbb5eca87"; + iv = "50594f7f6c06add1a4aee8b96589ec9c"; + plainText = "d596c504a65f5dc651f926d89b761f7b644095c3969f99a1"; + cipherText = "f807cdc23f9916c7ce88bb2447511a7591ab571a2fd0bfe2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 278; + dataLen = 192; + combinedKey = "3b601df82a93f7f88fe161a26b5d7ae32572e5ae8cfb0dfa93190eac99e74111"; + iv = "0b1ba26b8e74c0128f516ece51c5ea2f"; + plainText = "9d4b4339954de9fdbc4bdcb4b7ff4493eff049e079f75738"; + cipherText = "c1520a1404bc01e3d9afa7d84672e37c74a1b794da2ef156"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 279; + dataLen = 192; + combinedKey = "3fabd3370270910769d6dfc4ecba5b86cca84a9a167cde673ec4795b1e0a2758"; + iv = "c074acafadfc236fcaa62bec0d878911"; + plainText = "24c8b9b952b1cc9f1e8829bf43c0fcb9f57939e1a97bafa7"; + cipherText = "e0919ec788edf222896e24b04dafed729d790effe09f77c1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 280; + dataLen = 192; + combinedKey = "c9d06a81a355193e29ba49b893e021682cc6e5294c3cca2d1f34aeddb4643a61"; + iv = "5040847dd028fcd388b5d12998a1600f"; + plainText = "3c6d62fcd550679d24f1ecceab099a39168c8a8db6cf5a72"; + cipherText = "9ce83e974737845b95a6df55bc5d17a8455a613f0cc33484"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 281; + dataLen = 192; + combinedKey = "74ddca7f5b371cee11e1ae5b7e0ffd13caf97f30ed5c5c44391e8ba65752f338"; + iv = "dcb518f15b09aa4bc906291e4e1db422"; + plainText = "6d633684d8334aca001600a28b089bbea97ba619855dc925"; + cipherText = "191e8da0994d3d0960d1d090e1342b55281d4f6399a8d9aa"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 282; + dataLen = 192; + combinedKey = "04298fc4bea37160003adf498f1bc8f2fbe6c5454f7642c4a4dcc86cf781ade4"; + iv = "43c14419e232f327aaa88a612a11814b"; + plainText = "bad9d0de4afa7600f5d380351140632974dd8dbc34d155a0"; + cipherText = "485eb953a325697251f0b32374822bfb8d8f70206f2a2606"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 283; + dataLen = 192; + combinedKey = "88214fb598309bfb4d1bb22d5b442d248a8e2a07cf0a90d39bdc23854635ada5"; + iv = "d7fadc8b9493cc9f03cf2ed2b2c03478"; + plainText = "62accfbf5c5a178bbb6ecf124060eee3f985b2c5e89916f7"; + cipherText = "fd94e64e0ca7f87f6f10d5e4088da71066c49c065f542c39"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 284; + dataLen = 192; + combinedKey = "46885303da5cc733a7b1bd776c8129b5a4bb5ba0db28f4cfc0d25c35395416d0"; + iv = "ed955f6e5e2ee63fac8a7f6facf24dfc"; + plainText = "89f7e516bc869bf25f3e751f956061e8912e53ad0d9d8543"; + cipherText = "dcb1f7ee8231a27732725a92989c3fdf1fdf4aba4bcaee9c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 285; + dataLen = 192; + combinedKey = "b70f111000c670cb04ce89d63795a28584173495d16af2cfcc07774e9493f924"; + iv = "84a2bfd8fb29f28c86ab307dd676532c"; + plainText = "a029165375ff34493b1e898915b6790f3a79dc2ccf0adb96"; + cipherText = "137cba7f486038d0651aaf4991e79f1a6956916825c1caa9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 286; + dataLen = 192; + combinedKey = "53feb988c30c9f149816803f5cbf4b5939aa973242cec006577e76b2b2df3d24"; + iv = "0807a5be65b6b20b4ac91b9f6c09de04"; + plainText = "590337e3cee42f8bff8639fdd81879300fcaa00974836485"; + cipherText = "4856eeddcfc1fc40b6a266864a05aab8d915541890879d50"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 287; + dataLen = 192; + combinedKey = "694718f85dd85e327cff5cf51854fc30c787adce8de573698a076cbddd2a70d5"; + iv = "fef6bf2957967ed8aec1abb830a169ae"; + plainText = "5ee7d68d296b00b6f9b3c2b1157822b8fb867ba9491691c3"; + cipherText = "ff00b95423b7c16105eb81d037fadef5575e423f72f50a63"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 288; + dataLen = 192; + combinedKey = "978ea40886e79ad4d156c5f0d7006b09a21659a1007ace4552873ca92dba207e"; + iv = "82d2e6616a39ba906093a7909de03084"; + plainText = "5b1fdb5021aac75d3860dda19b438a65a2cee667c5b6a47d"; + cipherText = "b283a8429a209d824ce65d62da05a6274c4dffa1e23a5475"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 289; + dataLen = 192; + combinedKey = "a21832ff8c6d5310ea702f9f1c98fb2a85737d6bdfdb162417f37e225a6cb733"; + iv = "437fc74eaf80d456b90ab321ac86704b"; + plainText = "8040c4bb8d9e268871cb9a7fe0dc4feb00f88e5b83e2d518"; + cipherText = "c3a07f0306f1f9890412d221d633cc1b91230f12ffb0949e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 290; + dataLen = 192; + combinedKey = "08a38dad8f4c5c2ac97a9601341f3911a712b8b5ac259434357ae1d5d478f36a"; + iv = "7dec5ffefc14f5d31b1ce95ffda09b43"; + plainText = "5c1ecfb16b81d04386a0179da4adfb0f09cbb26dd2820fa5"; + cipherText = "b899083e1c2342e54f38aa635174a20da746b83a8ce07c2e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 291; + dataLen = 192; + combinedKey = "b21eb3c4253c88f6653ce8102860e570d748dc7ef5cf6f606fd289c746f71571"; + iv = "3ec99b802fcfd6562dceb70b8e0eee8c"; + plainText = "c42930210c6116a4b6b34324a514062b8d0487b5775cea40"; + cipherText = "16f68268ea6bce874b08c4890828acdb59791740a6dc07ce"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 292; + dataLen = 192; + combinedKey = "846fba38a117b22bfb84d0596471dd11503c8d5e7ba80b669a96655bea35b6e0"; + iv = "d8212784b3b77c9a663aef0858266899"; + plainText = "1966c23af2b2387ea7c4b70bdb00371f12412278a0b7c70d"; + cipherText = "e71f539b783407dd4983abe90a1068b394f0c15d43acdad8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 293; + dataLen = 192; + combinedKey = "f8bc88e83679dad11eb7e4afeb37d291aecd5578b56a6c2945a603cabc32bc13"; + iv = "f46a60052423ae39b10d7a459a11bc87"; + plainText = "fbc71eec2192d52f09bff2db10810cb9a40840d75ba0fd39"; + cipherText = "28460fef7eec76e056773e68277b13058096ca51763e51cb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 294; + dataLen = 192; + combinedKey = "57b4273325cd109e26304285e26e4d5361e0274488330c056b57c87ecc9624b3"; + iv = "3b908d77d4e7ca2af7617e67aa034b70"; + plainText = "2851ab889d3349575fb5345d63207d991c9dfc30887eada7"; + cipherText = "91e0874dd0357a3e43d753cf13b75cb8fe64b353de1c95eb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 295; + dataLen = 192; + combinedKey = "e0d7529f6e77a3a88725309da07be4891b48497653e3a58a15167eda911cda92"; + iv = "fdf2eb54938a3daa2419f6bb62e0c42d"; + plainText = "2dd6db0972fdf23ea927492785d86bb8a95611707682489f"; + cipherText = "66795f5b29cbaa74e16190336231c79f9e88e53c1d44aa4f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 296; + dataLen = 192; + combinedKey = "15dd3bc6ccd5bbcfbe5b0f8fffdbc86785190366888b8c1385f40854e86ba42d"; + iv = "ea67164de6b08cdb33debc9c4b5abc0a"; + plainText = "4ed7e1100463e67ca0ef177b282860c95f3df95c74cf0ea9"; + cipherText = "5c0f78416b809448b9da687d33b06b9971400c9ce7f53355"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 297; + dataLen = 192; + combinedKey = "0ec4ef2e750958a2b1bfd2f934a6ba4b1bf7a5e0f1135691a07dafdac38307c4"; + iv = "e29566668d501a6b5c598068534ef166"; + plainText = "3c3a470ab9b74c9a321edd055f347717d987f4a4c0ca521f"; + cipherText = "273724b9edbffe6f18255479ddafcfb38be6ca6f265b2f15"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 298; + dataLen = 192; + combinedKey = "c5669c3c55b602d4a396ea2e858963e24ff4f26b3d54f22628d436960f1f4bbb"; + iv = "53a7b5ab5b9d9637d86eedfc1c8381d4"; + plainText = "60ee0d601eee70a3f49314cdf751f003f17a9bc053af2fd9"; + cipherText = "c140a2422b1d16da0c88279755401490345e8518794f2d23"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 299; + dataLen = 192; + combinedKey = "775370f84eb869df06b5a2089bd779443c0b12524455d064d9d6c60b99c04424"; + iv = "6c45366eda54344b2f45e802cda36a48"; + plainText = "6aea3ec1cc8399cfb5254285fad19be0e2210c42fe018cca"; + cipherText = "7438cb679d0644f3ea5f8749d63a9b240b42e78ec1716736"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 300; + dataLen = 192; + combinedKey = "bb89e6108756e04339060dd642c842290c1a52cc416c3f60df7607e511fa79f0"; + iv = "6703f5dbe4af41c2dd4c82abe7c4dd6f"; + plainText = "144e50f2d6292e225a0baf8cb0aa3e4cb33359ced3572c15"; + cipherText = "1f17cc6968286c151dbf4aaab11c05105fcefcc7a8ae2979"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 301; + dataLen = 576; + combinedKey = "4f5ea01ac23120fd07d0494e0e395d420a14cd2043c0d3749dc783ac0c9122cd"; + iv = "010c3ae44f1140785f4b9e37304f03b7"; + plainText = "9ff385167b97be7a66783d3a9a9c631d3575839503e87fbda744ab8f7a32e1331df2490058c50f715abcd2214073565538a5f28c15894ac2a0f2665c307e08853133c00d2a02fd57"; + cipherText = "8f43529ef67cc5de025f306301dc379b785f097db95ffc5671d98c6da3a85347fd42efd679be3a602b2aad588143d7e4fbd371a87ce309a337761e0d4cf57533f46cdd34f0003bba"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 302; + dataLen = 576; + combinedKey = "78dee6a75cd5e0444d637316fde6f2fdceba1c5a9692cf3e569af8ffa15323d8"; + iv = "c17190d88f064914cd46215972f8223a"; + plainText = "68b457d0056c1d86804fbb5da40b786081279308c73de577632661fdb7f42d38347795919e5df5ce0b2d35fe9a195cd4cfef84a3ead7e992e15262408b1a07b1ea82a6a9a52028df"; + cipherText = "d2d7458ae2578162770b7391cb132ec962fc7d78b79b14ca537d3ec004bc58050dec70d0cc26e8eb1024ea8cc2a383ba93b306e81c9625de59e201dffa449ed54bcc298b478dde4f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 303; + dataLen = 576; + combinedKey = "92df22e03a41f4abf00b37137fff7631370e2f4924708fb7d1b5ed6fc869af0f"; + iv = "20bc327c12ae85090b103cc99a07b3c3"; + plainText = "5df90e16c440180e58a931541d771fe2e5117ff9228e1d678c729680f30958f795f3fe148149541484f187eccca970d9a39d19c76154be8c6b5d2220ec4fe437f0daccde0b05f082"; + cipherText = "4c57a6409d69a359d2fb43aea8ad09c87f10abf5517b9bd8f141921fb6cb95bee3b64c865f885181c078e37a08aff35a066060764237de79025e181433f52ea38c5d468db22e9ac0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 304; + dataLen = 576; + combinedKey = "fd5492006b8891d333963163246897a8ec225528d2114d35e4468ec704e67969"; + iv = "5c9836986eaac8bfb0d195e4203e7bd9"; + plainText = "0fbe3c7691516914c8fa67a21b611bb70df44a7434ebe9098e5d6d091fbdd91160645c985bd1f9eec2a394df785e05210ed5d8a0bea2a374acc8e263f42c0857c5acfd2d6edcfb0b"; + cipherText = "083966bc5a7e07d1450450c88d9f6e46a752f194005f5032c1f14e3ba1098e0987dba2bc467346f17c19db09e83d39d4ad6e6772c7266b393a4b12f941e5b31f85cddd3af5ac977f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 305; + dataLen = 576; + combinedKey = "e50840ec8f8cf588901966914c3f9286890c23c15a681db1246eca2b7b353518"; + iv = "18a0adb32c86c294b45e10d8460a25e1"; + plainText = "99b7233d25bc5464f61b8478ce0fde93cde99f1afe8a66ebadf6a0147406e0d818ce90cdbe77cfb64d31e0c41ce6ae5389b7f6ce2599c6245afc0e1fc0d32eaaadc1aa5f50ab7714"; + cipherText = "5e199949fc5c362387a514889d66be0a5e3d569f57025077579a168d89922c7946a2882e3c05996a1a30f3211805ca507c2078f20953177489e3d21ea84036b1ff241ba1fe8a05a9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 306; + dataLen = 576; + combinedKey = "d062354708ff28a89fea1ac431c93ec1bd3665e85f9f186d4b6b0bf32ec5de59"; + iv = "f42df1c0faed7e7f1c20c1416941afc4"; + plainText = "e0dd1a0dcc44ef74a97af533048af70527a1f0bf5623e3a3738109a65dbbfe1d163e930eb129a7e893bcf46f1c9f9a83ccdf7fc3b15f3d30bc2a37dad1418a31196fd4ecd1b86103"; + cipherText = "78c048a20b473410fba0006749be273f37c42bec661e2718f44ef0d3de55b3b74017f7877d62c6d9f0bdabc393ff5590d864245aa62f33e71692d23efadcc3d2b301946d3fe6ad37"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 307; + dataLen = 576; + combinedKey = "f94bf9199c2fd409241b4867c9616f0393ae91e613c9e75db3d542ffb60811e7"; + iv = "b8425eed3cc5b7ab272ee965eccc46f5"; + plainText = "c9301b6768dee7268d2ff23586e89a2bfd15f4e869d1b24f3322653ff8e93c012d9eeaa31edd0a167a0d8e6d724a84b3bb73f4accf22e933742ee50328f694c641032ad6be30b4e2"; + cipherText = "7c714f75b7edb36d1cd9134bb20034ea7bf82e04912a946d8091ee404bc4cb64da4b4bd9e4db15a33b885f51b64d22eca36724b92c7ff76c08a87aee3b0a5cf7a0d1cf60a450c595"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 308; + dataLen = 576; + combinedKey = "5a884bc3e0803388803a6a81111f5668fb4194b115b050238f665798e368b4c6"; + iv = "e3812527de170f8c973b514cff8c7a3c"; + plainText = "8f2464bab88b941efd3d5295e51e3ee5f4246716abbbd868183439a29d6b36a65f6f789ce924d2d3613235cd6d2c618c08ea8ff74f3f971a501f5088e0d2eae50fbe140a5f2d8df4"; + cipherText = "ff6058f83f32411a0cf88a0e0d2e9b387a889a0915dbfc51512a52375f85e5d75881a7ab1f4b356a809bd0fc0e62e26affdfa0f628d14c1a0c42d72f2a0292a3b19ddd77235f5f81"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 309; + dataLen = 576; + combinedKey = "116c72e4af91a8f1cce7eebc772a712b7ef58eee49f3c1d01c94d07227366665"; + iv = "23b0ebb89af01002b84039bf248aafc6"; + plainText = "d0d9d7c9e91a69148df12619889fda51407121a90bef151ed4db00a82a342858c6437b3b82d916890f27d4ad92f042d3cc94a2bb29083198735de1c2658447e93044869e895b5557"; + cipherText = "734744df1aa767b440fa1f55021cdaf11380f2848fd6f685a4acb6b62ca879c54472c58bb3534655f7e549e873ab4d2d2922757dd9015ab8a11472c77cff3e38173428f96b3342bd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 310; + dataLen = 576; + combinedKey = "3dc513adc70a8bc420156facfa7ea56a891a47c005c59f747747a5c8191041f4"; + iv = "87234f6483a299b34985a608218580b2"; + plainText = "4cb9048ee8dca2935a6ee4815c183c26bc4ccf73c0505724677ab4b4e4955de770e6bcd6dc96fa82a41b70302ad4a1d7c9e0ad950279cf15fbafebdc9d54afe439aaf1af6dbae465"; + cipherText = "9197a1bfe557852e4bb69d0f00b75c62bae9f2155dd1869dd721eaf0f82ef4eba387feb2a818845987cfc63d6b65b5c28faabc86595762f9050f0dd4e3bef363fb937a580c183cc4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 311; + dataLen = 576; + combinedKey = "a2be8628e22fcdc8248d18cdb89d867484b592f83a80a559af172a51107e5f24"; + iv = "551e423e4caad7ea2428a84e639fb70d"; + plainText = "782ed2aef970312199e3c9d368435981458f1a35eaf6e50586143a24afc024b338470b3e23c6c7d3c1edd86f01d577fc29a277d078ceac06d662d143571998564917c08195a05314"; + cipherText = "0b85212932badefde17179c81098eebe4ecd01a921133b6daca8364b48866c0030e5c35c4981b3610ca8a6167a8f62981d8c79fdfd8fba18ca0696d1e7b9d01ae61a8b76f6c1ed86"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 312; + dataLen = 576; + combinedKey = "2361677bcfe9e6ec35a708e1985ea7cc18bf02de06a0340d8bcdfd76fca171fe"; + iv = "3596b0fbd4410ebc34f3addce0acd0f9"; + plainText = "abfc00da8625472ebca1f95056de9c32085aa44dd3738f1e30037fa48f51f61589cc295300ef21840fb8dd8b9f5491985d53cb44574343f5997567a0057d7f8226642a0a0bb0dec6"; + cipherText = "fd56b3b4067029289a08b6d763f8d3754f5775b5f28be5bc8e6d51a7090314382ff527d311753e9476f04d01e8ce97cf82256ba9961531d547fc80e63cbcc256fc3627205ebfeab8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 313; + dataLen = 576; + combinedKey = "5eef3e1a3b4fbb552d187800e35a6b69dc5768914afb142b4ca5d43521cd03ee"; + iv = "f2da0ee1f3ea4f8e65553fe4aa3db479"; + plainText = "6faea810fa613ead15899825b745ada9c4f7037b9aca4b5d862b84c0bd3a0ac50f36e86680bef25772455fd7efa932d38eda1d42c6cb144c71a0b6f84a68a9468bad55831fd40b34"; + cipherText = "7a71edb37ef0070fead75c5e41e223b5c3fbdcae21924ac3b8384ae292fd33553849862b49e5045247e71f4a4159e8b5edfa3a347bb16ca118e0e9e9992d2bf6ef6d4416ff278842"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 314; + dataLen = 576; + combinedKey = "bfbfe981ff957bffbc4682e22c22d8d6412447579bb9ba4bdf0d9c879d1e1d17"; + iv = "068f9da2552bcf2d712406531b2a2ae0"; + plainText = "cabc637a64b054976330d1ad373d819bc5b9be5ea90c88a060c06c3578f3549f3895abc251fac031a3f0e4be9b7fa62b7ee9f72abefb00a2d0ba5f4b3759de1b2327ea965490e159"; + cipherText = "a55d0f50c12633c8291e0b59443ffdfdbc98b9c3aae6b58fae2e4041e4513aaea8e8b6ee60a987b1db1b7332646182ac26e9e9495c5647cf8da721685a530bb1dcec87e1a2a20537"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 315; + dataLen = 576; + combinedKey = "d2aae8dfd134023d4af3c87496a1e6c476bb46a9ffa50dd2c7f3eda3e30d6de2"; + iv = "1eabf1d099d8264073af0f6aade42eaf"; + plainText = "83abec4ea35d305e1d634e3b2fd680e7322fe05da3ab52005e1489aa3c93a4c459fe7f7b771807482df4b97e52dab75419ccac3dd08355d209584080e0804f2ca0ab9c000c2c84a4"; + cipherText = "c31eca980a5a23457f21f5ef41501c64e2ccca8ae5309bf445f56e7a588d80bc8e00ce66e12bd6c8319481952cd20c6e6bf2524a5d4cc886de82d20f896656ab56bd63d40b44f956"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 316; + dataLen = 576; + combinedKey = "39a9b5c74526b6314735a1dc16706897d0fbe23ba76f088b766661d271988998"; + iv = "e3ebbd8ab48996007256d9789e15bd68"; + plainText = "4603b9384eda5a3134468ce985403e35aeed85b3675776c4f4b6d7e9b1e624f0370835f1cde45489d6f3d2219458b03103fb0d264f3e623b06fae194a506117ffe045de923a864f6"; + cipherText = "427fff890cfae5c5069a1df38a14a94bc89dae71abeddf0a72de7e67793f23f5fc8055086c1f391f71cc945dce68ce0cd8f4a6c519f6968572ba5c39b15a041bc85aa4e56eae198d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 317; + dataLen = 576; + combinedKey = "1c61f6af52b4196feceec1c23476058e2fdb16064437134facb8b8d09e2f122c"; + iv = "3fc7211d288a726a48a62e87a2d463dc"; + plainText = "68626660cdb444e1bc873a019c65739d40d770cc3b0b64c7a61f3ec970cf06828252fdab0270b5dc238eeb914966a41da9f77020eb7aea8dc3882cf967de67eda91f3500ddf68472"; + cipherText = "62ab0b70a2183f0e2f7d7c9a78c93279e4b539bcb8234b03273bcb0ec52aed5e6f2445f250873e2ca54edc2932c2d7b1012e343cf4e243c003ad434b48aa1a90f49e054c12345b0a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 318; + dataLen = 576; + combinedKey = "b019486656f331fc3f5a9a35faf93b57521072f2bca4ad7f4014a888420a28ad"; + iv = "88e0e9f8bc5e53a5d8ed4fd7496c71ee"; + plainText = "bcc00bdbf525ef48ff0dccd78b3393de252e0724b4d2f42b9007778dcddae7530f9384df6a5ce5c268dcf861a1928a27ce117f1cab47b7d42657f4f264ec1b73f6469fb33655f233"; + cipherText = "908eeed952bbce591280c4ce701814c77486780beb99c4da49659d3772b1e27a3495b5526f1bf0a6bc12087c491f13d301464b27d4e47dcc7306b6e9740213730a49a68a110364fb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 319; + dataLen = 576; + combinedKey = "59ff4232505c6f5c6dcf6b80aee1d6621a674f16bd82dc9a8f26a17f16513bd6"; + iv = "822c794d99db4e588604adde02ae811d"; + plainText = "58615e3ca717aa49fde838f843d58e14d7f696ac8aea179989e10f6bd0cd9ec29dcdb757109e232a65c5903f2c252cd691128c8fa8cdbe42e8e53dfe4650e51607adff61aa42573f"; + cipherText = "c94b201698a88002d846b878f9e97b33f5ca0b273d6a273433a27e2f85be0a86540abc602e78c7908de717a81353b993f58febaf2942dbe6cc7c8f7920f0f73b4a0b16048c8789e8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 320; + dataLen = 576; + combinedKey = "57341022f4245ef0a0e1bc542df68975d2ab7ff6d91a8332901dca4b0040a26e"; + iv = "83408dd9f3c5865805f5870f03fa1df2"; + plainText = "97ee791349f08c6810ce2582f77518b48de1b01bb5c51ce5a1eccaa5baee924dfb5fa2f8f05808229ba117019abf51ba917ab4543e94e93d2bb822d6aa33e1cf24f631c10ac7eb54"; + cipherText = "1670ee14cba05c25573a062e019742a33ff1a7286c1326b6ea698d4fb7c62e8c9e3a06098e07e28b95a579f3193d7b47d5c8bc62f56eb4195855fd180fdc22042f1ea6d89e0e4ce0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 321; + dataLen = 576; + combinedKey = "f8d2899f35671d41ba261990a7d78722f6bf7a29a25d57c10f2b55e4d2c26adb"; + iv = "093d22f99aa8bc268c9ad7cccc98233a"; + plainText = "d1dec73593c36b9750553f4275e5acf395d66f2536e27909605c25e74070aab9198b288dbb8eecb18f0b88c46d33012098cdb45554503fbd437ebab7857e00539b72e3218042d006"; + cipherText = "1a0fa3472d11702c22c1fb468c14dcc8ce3c60ff31ca20b8250536dd8adba7673ab961550c49909abf6c56f824ae0dc069daa705029cef97fed4f83dac784b70465bcf648b91a3f3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 322; + dataLen = 576; + combinedKey = "17ec16ac72683144fbc30a22b5be83775f50289aa041013782ad400ec8a88688"; + iv = "50e8774c65e1618f5f50f148dda2a447"; + plainText = "b7434bcb325876252c5751da25bdf9676ec784b128e83967efe1ccd01ff1d5d94f6f4642095f4ddc3755a409fbb6e31c33b6f094ee253b73aae3f3bb094dadc3dd9286fd5fbb17bd"; + cipherText = "9c3c769683b7e7ea2a51fc7851a70d38e89bb94573458e65484e5ace6ff25fff18ce1f62cf1553ef9090c93648098c4cb70a2bf898835176581e2e7ae79a7a79cbb28734c1aa24ed"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 323; + dataLen = 576; + combinedKey = "a174aeea7c7aee4c3a38eccbb185f50e207edea8f9b214d177765f1b92c4eba3"; + iv = "04356ea681b370e867ff4350b831e11b"; + plainText = "fa76757d36b99c9ef234fad419620238bba91460343c111aec7c182c3ae59c9964c5ee4b133a0692718f308bec97947b58a71ac4b988776153e27cb8b8aa3a372c31aaeb39bab4ab"; + cipherText = "f743b17808f9d3fda6f507099223151582e338a27f4d884a0c7d2744a9522de0731b39991782e7f1828b451c406aae1b73cba0eecfef990116be787080097f5fe11f195ceec59496"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 324; + dataLen = 576; + combinedKey = "274abcbf08b5d47e52d86fb7802231272c5526fd3c293262e37df5df0424b77c"; + iv = "25604c8d5414026a6e2c7d303a98d2f2"; + plainText = "eff7ffed44fa1a3b236723fd7bd1bc1eb24859781110359b19b321411315b2df8775b031539e62b71d1a5d198593b93893e036bd92bdaf50c0f1587c4fb9ebb9fc65bca0e1e9b8b3"; + cipherText = "f77223ce5cdf33b4edf3c594d1f31fc648fc7b666651d1253e74ec5b12c593a9adef408c8540be179dd4e9d9d32e0879ee09f29a27204e6a95f8267ae9aee1259f2160359215d50f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 325; + dataLen = 576; + combinedKey = "6d8e9f9dba77490489aea7c602cb535d74726f07c176037473023b203e901edc"; + iv = "31855890540fdd9fac974f9de05a3025"; + plainText = "1142d175dfeb759e8ddc4d01032fd923f135fc0e7f0352d610696bbb438e1bc195ee8ab7fb649784d960d35c904031efd8c12e925db006c36d03de2c21c67264af921b07a29af7b2"; + cipherText = "6236d8fa0281decde5f74075cd8e45a920d15c3150ad10fce129e753217cc1fa8be30a66916d7e5f5c5b613c56a3417bdfa01511329cc68f2fc0775f233370a1c8f4a422dbdf72f8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 326; + dataLen = 576; + combinedKey = "2ddeacdde13574b269137de0cc713af34275e82dbd1b3f657a9d27bc5e1e9e8f"; + iv = "9eafe2b6aed2f10ae9b08aff5bd43121"; + plainText = "3edca2fac0bef7eabd4f2b87a5e54cdf1830643b9149edee4eee1dc6c4d0fff38e5a5553c6996b6072bbcce6b6a0423fce8a95e3a889d613f34903b91414cfd215d13d806b4499e8"; + cipherText = "7d826c0c87b5ed24b213f114d4fbc97f284cdc8103caca9c33a0e37d432f32af91ded655d07656043d80aefcec4f43611896d5ca954b00595411daf03be0f28a946e9ad1ce389334"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 327; + dataLen = 576; + combinedKey = "e5cfa31f408a198a552055a81f7b46645dcb43a01172009cb7ea23e58d01d873"; + iv = "cd04dae79b36bd850587645005d079fb"; + plainText = "8edf7214aaa56d6ca4b95b82c42f7a309c98c7b2690b83c2d8485da839a42c02a645556d399d4bc5cc7d8bed856cc2bc3323356a408135f929dcafc3d9724af223c30f8359df35e9"; + cipherText = "cc16b3aec7ea425de420a1be3a3981169c70f0468af2c3fd2db484bb0f82e8d0caef7835d97ac2db5f8a98c9eb4ebb064e9458e81e19217dbf77343330ba04a95252da03b8ecca7d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 328; + dataLen = 576; + combinedKey = "99c8c7753da988b27e44efbce638769f5b63866393dcccb95c0df6ca80eaf321"; + iv = "6efe2740345ceb51669dc39c92b20387"; + plainText = "6dfdff728f2933c7984423046ee3047cabe41f5fab881dc69c684182f154129f9a6aaf1437c28c282167277404b9daf7f82e03950bc7bfcf8f74ab194b01e401033cb3663f24a29d"; + cipherText = "b18f6598ef4a95b88b2b27becab6eb157946b5b3947cc585f02b3dc87671515064dfee802e15ca2a7cfc9031af78b17250d8790dc45f84c4259e667a061b4ee5ac401a26f51d29b5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 329; + dataLen = 576; + combinedKey = "19daf6b36621e584cad0c9d8d82cbc09ba0ab7b87dcc503dd63469555bf338c0"; + iv = "2c61a840cd1eaba11ce08cc33d686b1a"; + plainText = "0d9df5a391bc61ba81a6999d1f5d21aa587f41415a366b4aa40ceaf93485b586658efe4ebb9a270357a58b32cfd97e29d18865e15b7abae52ecfe4b4de2460198feeec02cc9c3633"; + cipherText = "64ed99281c0aebbd6c6f5884ad9796c7278a0b2028a93fdf817e3ff30197039cbe55b4cc6bc026eed5c9450622c3bd971379083169eb6f39a74ec1f9e010736db84bd10c1d946866"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 330; + dataLen = 576; + combinedKey = "7eec9786c049d89c8dde9d58007fe742758f0f04fdcf1985cd07f4c17ebdcedb"; + iv = "4d67f16c9ccab19db623a6f9c9e1251e"; + plainText = "812f9952dbb520acb47ed1e211991b2923a699436ebf710f40dbba5875ccb5f96942a4a46a9ba36da8cc5d86125b7137e78e3f07c8431c480bf3898ad86056113ae3e7125ab00030"; + cipherText = "3d49d59fdac533dde6ee1d767ec011dbac466cbd6fa5a1594703685f4e29812f9b957c1631ab43c60802de5f05bb796ceca51245f3d9180b29bf5753632f10f4aa0912856138371f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 331; + dataLen = 576; + combinedKey = "3cd34568498f6bfb1b91cc8cf6747a39a2b04d8f3f4f731ff7210bafa1bf00cb"; + iv = "ee95da77a88f2dd206f01f447d26a2d0"; + plainText = "1660393812c7c6b5b2b2e78fb4b6d7ab86ef7bb99a516f0c01c9f50ebcac870825af48ebf97719e23cd69988a6a35922dc160c03659c56e3e59dfd39afb263f5a384357b5aaeb0cd"; + cipherText = "f0f32363f3d29200e1b8b4cb903cc3b9a7f7f7a34925e18c6c2d7cee9687b462bc0b1ee72398cb200203717be59c5bc016146b03ac99f7b6485d4cdddbe379629ca72f3f174bc8cb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 332; + dataLen = 576; + combinedKey = "5be9b8709c66e41198066e25a4defa260d2c199b45fd84babdc936275b8c17dc"; + iv = "f0a8fe41d270dd19548458d3b5a3dbe4"; + plainText = "066df3a98b8ea09cd7c2cbc025734c2e9a0b639905febfc350a321b1e788a81c541eaa5bda5a7ff9ab0d2737b96d894c71806eb5cd1b8b2c62401005078a4267f162bb2a41604510"; + cipherText = "415e189ad8a92069fdd3f7b53fe3fe6058ccef7e9c7e5fc99cee28d49af23de39d1c8bcbe0a0a1dcb3f9db49a746f03532f5aa9969cfedc817d4c2c7687393f9a12997bde5f2c0fa"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 333; + dataLen = 576; + combinedKey = "5cb89453baca650f6aa6d11ea5a441d126109be5e9c0971b8fb2781e7f053b0b"; + iv = "de93053d96b192ecb917bc497c8ef78c"; + plainText = "2927e6a29b6ae771de7169c813702d24d603f7fbff8b7898c71f8547a71dda8bb2830fb80b9bef59e6abda5231559513b444f8a7c563c596491e3391834816c8be9058e2fb120276"; + cipherText = "b0af55295f0d383d24418856897b66c400a8475f705da935c5c4b3c9949ce79ed2ee0af657afcda9de3affbf56d4aefd8b5ced0b9fe80886db02d02f16bcb7b208e49b453d12ebdb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 334; + dataLen = 576; + combinedKey = "b4f41291870a357a73572692747de99d40a2bd61d23218b0eecc5897f7beae72"; + iv = "a0f450b3ea356fd43bd25026e692ef91"; + plainText = "a4e934d6d18d07969b4c9c50004d405ad8a8e3430d6af306e990754954f5e48d29aec432ff0afab73a694e644db90876340bdc129e1cc18754d151fdf7351fe13385c6c349dbb9cc"; + cipherText = "b7d605705a5a6e7285120867cd88104bf8f14069d489b8b5b7ec0723ee4f4de6c2a43a591781ce366d0f5b1c92f6d37c755766cbddd5064be8bfcd4e06d65a5e455f1a4e2bf41d39"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 335; + dataLen = 576; + combinedKey = "fa7a0e9972e0da08f3889d145756c973a4b278bf380568020af57743cf6c5cb7"; + iv = "95b1cb65297354fcb49c372983cf29d7"; + plainText = "eff218fcd33a3f2dcf8a836c6affc95f280b28efbf22c020e285ef359c6204d761d37ee239cb7238823158e0fe94ec351de0b5a0facd9953f4e90533180fdb1f2ecdb8021bb214d1"; + cipherText = "2549a0af1c4ab82eb08029637ce0585cfed57bd0a41e53b08a69a8a52c5b77d04ab5e4a49ad5854524c010bbed1e057179a77607cc4aced014b691518d0c5f947c2297197b6dfea2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 336; + dataLen = 576; + combinedKey = "907afb28d0dc90edda42163c7d8767f8bac4d5179a844796ce878f655a58524b"; + iv = "73158a059ad044905fbf18df21bb8369"; + plainText = "d3aafaeac2581b14b1470e19437173adebdc7444cfa131a2acec3a86a92e51c0a43df2e65eaf36c673eb15c1b797692153c25896a57466473de01218eaa7cb9e9f57840231754309"; + cipherText = "6cbb50219e814e8e7fe60f75a456cbf09856f49cbb820689748f0ebad3d20072f92a105263bf417990ff03db97658d04c87fab42996d8e08cc4ba6dcf6a553170a0596425a0e8244"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 337; + dataLen = 576; + combinedKey = "6038d4827490c58c6b8cbcea6beaef3db246da7b6b112b6239aabab17048e808"; + iv = "263ba18258c9993b27fed5131e8b82ec"; + plainText = "3a91677a03499b43de2a0c1b7b195535db9752e5efd27b661fb5564c62ecc426f70a72a327fb6a78b71b533b92f2b8f69d360fd553451c10f134319d7bbc9717188de9d99a5e3982"; + cipherText = "437b156f5928927fc716fa4d31bfb5ed35f8afae7478f0dd7f068531920876b37cd141211b440030ae2bd95cf9587ad97b4558871dfd4ad6e4d58e9e3e8614a2a75d58bc59049558"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 338; + dataLen = 576; + combinedKey = "875308694fb0f5a8930e3bf8a84faa90da67c2f18a8f62748c1fd947b9707373"; + iv = "42b1398e747745d7944764d73ebb7dad"; + plainText = "66198f2058aafb96080e6762c19a23f2c7cb9db6e9280dd4176edbfd1189e3422a5f3ddbfe4e9bc7a062bc242b11055a11abb872f9fcdc9961b658e0e8dd2c1633d3cb7b764f13b5"; + cipherText = "a585effb12dd35707f0a41c046df48492618cfe39e1c6031d026ff5d2a127f98530ab73b53b9c0f5bc2f838f967eecd8832bc602076f5521ff01d2d50c36d63d871a31dfd83b31c6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 339; + dataLen = 576; + combinedKey = "dd495e3d9b52b2d9763df08dd4bb947f35b1233f211efa94ab1304fef4a2ba04"; + iv = "321ca4607dd72e8ee2449db1fbf9a472"; + plainText = "50d17ee0fec807f1e6bb6db75f095dd4d6b37189b3c6c91748884d70b7e2c15b9a17231977cfd62fd32bfb800261e3a10ab5d5f58310a833ccc17c889c25eb31d8717d2a1f0a9408"; + cipherText = "33ee1c12c376d37c92faf38f102f5bb985b2163daedba53aab6cb66ecbd09ae426cb2f858404dfc43e0d0e5a208d98d5b9484da60f01eb479c5d9d0866ecdb1829ad89a90caf4fec"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 340; + dataLen = 576; + combinedKey = "a248c38a378944343128c6ac7c7929669c788eb8e94deee2419cc74b4c18e9e5"; + iv = "1518aaf329f57e350ed4f27e307582ba"; + plainText = "5d0073b99911c55374ebb546636bec67877f1ab14fd365665bc09db380c8b8a29596164a1ba1e60cf984cbb28326162809ebd6cebbfe13b48b4c4fe86ba1776c588f1a086d3399c5"; + cipherText = "f79d61d04cb3069218864800d83527b5733433d8cb3a173a119d8669a3220d817d3ea213acbd57a44cd8aeb6abffa9b1116006ebbd1c1522dd7e286d83b5e8eba34be38f3f129f92"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 341; + dataLen = 576; + combinedKey = "d6210dabcefc57111b5adf9351ae52bd7d776ea5147dd48b8f6a420fffea7dbb"; + iv = "1f735b21d45e10f8a28d93436ec6a54a"; + plainText = "f5073c457dccb9578ed1cf6aefa247967ec01bd1a2eae06f1ec1a3f6f7a0a2c20e6424b1c4abc5dbc2218bfea054f3098fb5a1c3bd97affb7506897367dc05601d2952b507e3d2b4"; + cipherText = "420a680adb78a523f6167f57d162f749a368f2df0a49c21721abbea1f06e9d4ed7b416ff05e6fa750dfb2e8966d83e250b00fd9577965ebfeee8ae290d0d1789da9542edbe8423f7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 342; + dataLen = 576; + combinedKey = "7fea0972af79094d08bb682406f52d4ea1741aef229a5dd490d49638f92ea88d"; + iv = "e6ec98d0cd55ed82cca2914fc83cb896"; + plainText = "ce43194e7dd06db25041edda0ac94a11869763a2b4ab23ee75ca77c6a8819621dd4a99d2acf68e1fedd7c1de26b0298df54847b1e6c774bf333e6ca8b1e62c77c915127cd95f27e7"; + cipherText = "67cdc158dce60094deb2d087526716832528e17b8b0ef419205104fcfbb3a40bd98facef51eef5dd209f8c5a642bd2a698861144e845109e1612e06dc5f2eb751c98095f5708f761"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 343; + dataLen = 576; + combinedKey = "912ae3cb364917f4b79bb56e338b90cf37cded3cf248068d7f46cc92dfa09d93"; + iv = "fed073bf57ed6eb9605a8328b304628d"; + plainText = "0459d719daae4be50c83306accc1cd371b1be4f25fbca999c999f9dd350c60169114071dcf03ecaa4fe8ef6c5093fb26389f37dbcb16c079ee4d9686e5836afcedb72d6d078529dd"; + cipherText = "83724b429c769d7d261ffba47fae4af2a9129716eb3661291d69a5816947ad2cadd4e9a871525fe6e3e5687c3fafd762ee5db2ada776c6ff79065912073565b6ca171d831e08714f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 344; + dataLen = 576; + combinedKey = "2fac207ab12e8590d7f778d59e15f6d68b7761df6504ba5157a86c09bcdc208a"; + iv = "91730a6c9c71e0e423e5129196ab92d0"; + plainText = "b688dfbf65be34078e019243c1ba80ef148b7df247955f80faf291f7b38fc79fb0a3e07b50c1abe0c4342aee4aca9ab39f4ebc2a37782d3b3d22027c33f107896e018f08648a4ae6"; + cipherText = "9ac799ab29d9b414b76306ea885e39aa4f6f24c236a9c3d7f7bd5ff6c3bca5d76f8cf0055a31f7cc84174650f9b19437fa1c192ee3a81a1114fb2accd50c0c62c753a21f6c4ff44c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 345; + dataLen = 576; + combinedKey = "5f7dcc600c3e92e50630390d10a9bd984a86a9f4f095cbb09860836c2c0bb3ee"; + iv = "ff4e555e13f15a6e56fa352795caf435"; + plainText = "6574b4d5525a2c80393ea2d63e287e2f77d643a29f543e047c50b423e6ecb6e596b700ade103ae2eca1e4c52058603c6fa9a5b75268932ec3ea40214987178fa4eefbd277c6837cf"; + cipherText = "981354c645bfb2f6bc09c0e966b2cb6d4fe757abc30916029e8ef49c6197687b56a5ad5edbfe17c97bd74cc7bdb041cffb5d447f6adec45ead7d2f74d2c2381ed2733655b231fee8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 346; + dataLen = 576; + combinedKey = "99f6a5249a44580cdcd0fd93f3a5cb528f2e50e6cc3edec4466cc49dc5bf9774"; + iv = "e932057a4b8df99de4c5a4ea17f2447c"; + plainText = "43831c1f0542e5a0e0f003e74887c5dccb8a57fa91714461e0ccd248993bdf7c04b1cca015b10220866279d02b01da31fcd98496e5ee766c9761829679f802b886f5ec40053c97c9"; + cipherText = "4ba5695e397c6f21ee82fc30e07825f52e854fcba14c30a3a738c1e8cabd2c95c0eb3a60498943906ca8fbdc27ae5fe6cc61bb6c59e82730420769afaece377ce23a44cb24636492"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 347; + dataLen = 576; + combinedKey = "f44c424531dd4f5551205c9daf042f610797100f5c79fb445fa43a18733de966"; + iv = "0e9fa39fa0f68955e0e21ddf9bfc47f5"; + plainText = "18247a0a43a79d0538cb98e76bb937ba55cdd255e00c86dde009b647be622641adf1b940c36120282ebe5fd86ad2f08cf0c10b790a0aa3cfb7e2078de791f4b6ad0bc909ba8328fa"; + cipherText = "353c6c78bf4b49cb785c8b5feb817300b305a0226aaf69d0198f74b84b5646a8e3d0883f8577f36ad9c48d7c7c9d98635d5b3aff83f2235a614fd3b7e6cfee17f028359c0d7de421"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 348; + dataLen = 576; + combinedKey = "a906271c57c5eb705ee0ff4bb2ce99c294b59964db17190abf904a86368a9a9e"; + iv = "42f611ffdface3338b32d88469b646ae"; + plainText = "0d05188676e6f0d678bffbd54061fc5a624c52c0c49351ae94d9b7a11fae89c0d4fd2f612d44dc143a798fb0359dd566c929ca641b7a6e2b44a30c7b8ec3497c489a9f1c98555770"; + cipherText = "71a2141d23adb12129cd9477b13f164ba14844f342f6a95174421f87136c50656711ed9152d6ebe8a17acb8a45c74d84572fbb9ce7d88297cd9462f7fd8389f14d7c45eb19eaf5e1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 349; + dataLen = 576; + combinedKey = "83a212964411ba3183cdcb24a7411ff5812608053ac84a962dbfc41e43bcbd1d"; + iv = "c46cc2105a920199153a912045f833d8"; + plainText = "a5c5316303f45b978dbf24433690ac43cd2dcb1bd11686fb1228ad6e87610566f6f9356a944c20bf92271aaf0e743dd30152046e592c69aaa6a351d728a92071e0301100d778f589"; + cipherText = "7786a8511236ec83b300d41bae7d27b4fa211f920c1f368247ede63aaf5064726a9df413ee303851e3fe553725717150cb93ec5d07833335f7cac22ec21887a76415ba445a100cf3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 350; + dataLen = 576; + combinedKey = "0c07fcef97015f2b4f76ef6e0a31e2c5b68767a86856e3e5f49ff3857d1f307d"; + iv = "9d620524c8f26d03c056bd828462bb5d"; + plainText = "244edf56d42b2f718458a883c06cc929c7ac3dfeb0f9ea3175fce716d7cf32dc14b1419e46fe0be62583f4ae906b3f54972da57470c3b0aadeb44b088ee19bc08de729ef4ebfffec"; + cipherText = "b3198ae5723ec031564028e5fb2d5161c76c5a7aa17ecbcde62b81cae1ca30d328a0bdb616d7d3bee4b119f8014dedbf942d8cbe3ec41a84026e8fc8fc00a3ae79162f8355451101"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 351; + dataLen = 576; + combinedKey = "f6f6c720caf8dbc7c8db4b84fa1419ece419b43ead8619e546d665c6e4a938b6"; + iv = "0b9266470dadf5b8b0278b4004ea5c99"; + plainText = "57479cf5ded62f3674fb506e2b036a34ca6cffe0c4f2e72cd387ed688f63daaba8673fe273bb386bdc2a0ddc975781ef97f54fb8f368ef12620b4a7bbecba969f015db9b3754f09d"; + cipherText = "efe05ff4ab043455d91ce02f4d52b9ee73a50cb3d8ea8c18fd5e7686894d3fd950af0461a8c345479c9adcdca944960f41681e1a27d4ca579f99804fd5be29bfd8455fdce647c23e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 352; + dataLen = 576; + combinedKey = "6e32cbe45b84cb3ec350a79880b5ae25099fa1805d030784ee5c2419b62a2c53"; + iv = "8508938423b92d003ae9b5f32ce5a7e6"; + plainText = "872970164c96f1bef9d35d8ee0e6589c88fb19772a9e157f8b1afbd33ab532f57ce45348556036f15b4d2d74d466e30d829482abedfe4e650c0de8b7cfb2357f471510348d20f19f"; + cipherText = "20844441a0f061eda2e464037000109d0142d366a69bd663c058f82e1cf38e4bd53e7af7f35c3db3346660f860e8d7605ade6c51980f7fe03db4da07c1a4d6e6299af462dc01bda8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 353; + dataLen = 576; + combinedKey = "13dad2909cc95a8761da0ab02fae8abcd9248ddda9b7ad662d905a46a25bd5b7"; + iv = "d908df39185b382400e9a9ca1acec233"; + plainText = "35d0252282eb70694bc198979a6969509d598eda776c944ef1334984f2651e2356167d21cd3481c9fda691bf8cd3c244a1d5d9f300ed851f26010260f6b38e71772062a488a500bf"; + cipherText = "fc93752d32c493ef2f2aab74bd58be3efb394aa204e001752f05acdb90149f0846980793b6dd8a52c3664edaddd033065cb9b379b90e07a023a4aa79115bd4b68a720554801b9cd1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 354; + dataLen = 576; + combinedKey = "2f87c97ca5f085c1e001cd6757cd459df058f068cdc4156d8079370c94b4f3f3"; + iv = "909f913cdb83d5bc46f28998556c35db"; + plainText = "43980213520c5d04a247cca3e64162a897d12eda1610710f5e985d9765c2f55c4b54d494b1d10992f2e38e2cf87594b8d4b33f2374b6e1f44d42f32b87cfe5de43c0560937a1034a"; + cipherText = "90615f63c3680ae6eed5b452849a44edf363861309333ae4e070c60f4c21f85b9c0abb9e822e70c88c1851fcc97ea0c36d088832d5b72b9c6d33bbe16a290bffb904bb5d0bd933c6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 355; + dataLen = 576; + combinedKey = "3ffbba8114cbd27c6b96de8d008e978cb7fff41e8662506b8d47353a1befc202"; + iv = "3ae1194ba907fbeabe51619774b6285a"; + plainText = "e594df29ade27756dfceec1ee1b583d6467727d6b1bf6ee38010d217f0ed6cc8f377699648494aa89e03d3111984eec3eedbe3572440345594f982f7ea12615fac564dc35c38c662"; + cipherText = "6c8f80a74a56842b339a9f309f79f194c31cecab323c478cf8945fbf99fd1495f430fecf1413a4c18b6e227a464ba989a1c4e22b84e2e9a719045b08aa9219a153534ccf43d7fb11"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 356; + dataLen = 576; + combinedKey = "617db49e4b9e101c15a53fd515a57529f968a6e5ea45a66364dd133cf863af8d"; + iv = "d34ee8dd37efd7d4d8835d93000f3770"; + plainText = "6a3e8fe8bdd29e03f6ebcc27f7b2ce5681cdc5d950594ad9b9e57b5ca022c97bad40742e9bc318cd224516d54e57671bcf79d51c84c0c8d9f1d2e85cdcff2ac5c971eadd568e19a7"; + cipherText = "a290201df16c822e9cc30a78fc62a9f317b4a2637cb156eeeebb19aca1d507bfd481ea14f9baa52c61a4d369500d0b8151af05ce4f42e8f035c7075456b91029e68e1ca8daf5181f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 357; + dataLen = 576; + combinedKey = "f8a772bf7d480355894d8abc31bdb970e7643de3c439089eb08275f4d4c02229"; + iv = "454ccf6145a2ac08047b55425332fe76"; + plainText = "e36658a89c5fdb2b181d1bc83589a564e0918c4f74a7eee3dddbdfd665ac0ad5e187395c997a512eeebd155d886d88da6f16a9f78ade62bd9a3f1c249c0a59757c73112fcc3b6f5f"; + cipherText = "5d275f1d497643429ca905b53e1e0c365c17eef2bdf2f86c2d57a6c8828e7742cc735142c934b837e56e1e4765745b860bb2776d0e5c3b4d4ff18d25d8bb3a2ae08a927e71bd4184"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 358; + dataLen = 576; + combinedKey = "6f8516a1b12eea2b2a4787d4a3eb8648c141bd505cdd18b9caaad3375d328bbf"; + iv = "d9403bc1d9b9086ffc3a779faa9bec02"; + plainText = "e41bfac05daad07779af5e6f23ff02ea9d149a3739feebd25e3f8c4cecb1c672d71b7f2739737a8f8e71342e5d276b1096d1866275173de47a4dc8ae0ffc7134c3b4fb5b61975047"; + cipherText = "a51caba460854a75c163a7020962aa07050f7b560ba3a83574982a1e5e6b41cb0c7f1878fe1c40211d99b5c12d1fca747e7c5ca5bf4e5a7c9039d11c84a568db9c281eb2178b26ed"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 359; + dataLen = 576; + combinedKey = "6e58b37d71c3bc5b5696ac3b17d683a816400d10eb05ae680f4a8a5c7196c5df"; + iv = "2dd53f312d09635b043ac61d5e6999cf"; + plainText = "50aaceb52bab382088c1300617f99dd5b6ffa3fde380438b573087c809be8dfeca8a716eec0b91f2b9b0dc2fbc102a34522743fe526b617c4d8df36863316aa959cf3107377a5e6e"; + cipherText = "82b85f9d9a76f9d83a90b0c4f70f6bdd139acc2d5600b37120d33bb7ba04393bb8e056f57fdf94bcd007d54286bf018528b9cb543407e354d6fdd2f17f17a31adc9220eca1287953"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 360; + dataLen = 576; + combinedKey = "82d054d0790efb1032c674354dba7866ee7d109644e2f74d82dbfdcbe0e1d17a"; + iv = "8c143b917d0bf4a44d85d4823af1a57c"; + plainText = "c6ec809dc32a385fb3beccfada36360ce2be82675593222b0a404617f75af400960a431d531de15b0831a072545000a32cf429b40d6ad4c49e75c1b54ac4b556d63033ffa137d97a"; + cipherText = "3db9b03162072747d57fdf8589707a9b519d39aacfd934966eb8c107d8377238b9bc2e20c558d3766d8d13c42c95c7927a492ff0df8dbe2c6dacf10f96caf35c654ca2cf8c1b87a5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 361; + dataLen = 576; + combinedKey = "7445415b7641f755517b8e8c4c3219fe7208e038f18b039108af6190486ed5c4"; + iv = "d061a5f7fed8ff8a79cb2dceb54f6b98"; + plainText = "1003c277b8491d626930a769a4319d8ba1681f854cf5d8eafe923abfe909898a46575f6e0bcd9b6d9b79edc4cc958f2d33958d636fa6d86bd7b0ab7760aa4ffe6a5b7b8e6e6af763"; + cipherText = "17d3901c61b299aff4e998b450d5ca0cbf009d0d3f5e3f04de49c93918935a6f2e950ef695efa029eae5864b7db79ffc3eb893255e68596e84c6f4691da6e9b75dd6cc39e6270ce7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 362; + dataLen = 576; + combinedKey = "b395747aa40e3a8c51c021152de4afa985df7d89a2891e0b7eed6a0b5d8a0652"; + iv = "5335262905dad8cd929b9477594e6a61"; + plainText = "0a18bb3300039564c56667ad20714fb7639632478c054f93fa323023d175e9872f9de139358f08c11901396db6e714a8e54c21b0d8ccbd595f3fd202fc46ddc62f487d3b840d3d38"; + cipherText = "20ac0354cda11d301b5a0fab1c1403c0bae5d01b43a5835e5fb6b93053537194d46f20bb04ef341f6e6559ac608f6606b0f7da6361530dc40787f25a307e5a22153b56aca222f6c1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 363; + dataLen = 576; + combinedKey = "63ce9bbb1d7f21fe21c3cc47a0fb80518afa36c418eedb6895dc110c80207879"; + iv = "dcbb011f8761f046d540f211bbe29130"; + plainText = "b22780fd7e7e8c1a0196932e3f04fb63afc2dcc9b2232cc639b6c1bdcb5bec8bcdc151ec894d63ebd9abe23eae8ad2d711be9f679978ab53df5aa06941fe6bc640b40fb0c5adf9b6"; + cipherText = "b58e4753e4703355679cc98fcacebc9fc942b8aa89dc13fd110e4405fced91f5f783ab31d36c487f77c0eb77e0a325f0405dad78b3cd1eff5eb4e0bdad2dedcf2758f322e8bd8878"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 364; + dataLen = 576; + combinedKey = "9c44cb344f240535f4ced7f104887ce1f61dda3a394f518d904b03e67d4b19a7"; + iv = "da3ad743549874b1157e50d5664daabd"; + plainText = "8420b26418e0430758f70411f96a1dd4ffc82e17699f2cce1f2b217b5e7b8dd4dad92ef3bd07fecf1c2e3b5ae54442d4879ee22fd0b6eed2350b0a4324a86092cbc2302c792952f2"; + cipherText = "6eb983ddacda54dba3935c449d400bb02c6c2c2ffefb215e4cac2844449c7b4f94663541b8eff068fafd03fa52fa86d71879ccdc561fe4bca2a5cb93f372797a823840cb87362e66"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 365; + dataLen = 576; + combinedKey = "3efaeeea272fde2688edbf8b7da0680be550ebd9858cb963e4423ec977978f24"; + iv = "bc6a033507613fc1652e06515dd4d76d"; + plainText = "5eed0619cdcc8981c36925ada442011ce2cd1fccc0aed7fa0e1d5feab99d88aa3d722ce6811673c630732649e5292c84b970455f9676ad21138c91d840e2e10f94c43a8285b68f43"; + cipherText = "a616e4733a0117b7b4f62674b726c6c0274cdf6bf1e8c8329c1ceed6bb79671b986088d50f9ac4bea347c4a88c3ac40326ba2f7f04521f522b97d117115a3edbc9ca7077abcd3df5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 366; + dataLen = 576; + combinedKey = "08667f326c023bc59c10e85367cb6650952389fc26a8b3ca88c1923faf629a70"; + iv = "207de90540145ea39d7748e647f794f1"; + plainText = "5206784b4a8a2779cd26769459b30fa0fb391ce9f49f2cd43c3796e5649cf31ef334bb4b87b0d2aaeaacf55609e6c267a5548c6a2f2a94ccf4d76056b04f9e1edb2400d52783aa5e"; + cipherText = "9b5da9b42069fa4e45b6dd722b29b82db117e76f09a2699e6336990eaad66fb26f6722c3661b91c36076c79efed4ba9d6f26928f1af15002c22418f3b3966a85701ec6e5b60352e7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 367; + dataLen = 576; + combinedKey = "0a34ec9ef2f01ba79a479b3a01ff1c5ba33a6a753be028473f775fe25fe60f67"; + iv = "087f3ec018a069abe29c2b75f30b15ac"; + plainText = "ae6274ed75d1833810a83e0b00e28d438b633bca6d5bc68fe14f4297e2e2117a3fac69174e8437db81a127f51d80128095c46edf8471f457119c4e7d14bd07b152e79ce380b605ac"; + cipherText = "9aa592a965a2cf00736e24820b6dd1018161503369f16f86a21136b9f267fe16e951092f837e341dc7bc6c7d75218dc2174b9f0b2e2ec35abcf239d7122110125d9e0da72784d4f4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 368; + dataLen = 576; + combinedKey = "f37f1c85cf4ed3b85119aa3a93fc06708d124abceea15a8e595bf1afb6e1604d"; + iv = "f57bd7928ccabaa5cc34edd49aaa2232"; + plainText = "e1544c99279f885289fe049ee50d14e2295abbe961c4b4a7742aba93353bbf3e6acc2ad14e4648c22444262abc372ffabc06ea6a8da20eaa563aa36b2dc6e38d7978e3e738ec43e0"; + cipherText = "2eb6252243bc82565d1dbd2d79be5069394a68fcaa1b416fc532e54d4f5753fe0fe0ddd6475c3c672b990b16320e5c12c7e093b7c13c8b92c34f6275e643d9c17a64a934e70f83f0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 369; + dataLen = 576; + combinedKey = "bff67f90d1e2bc0d1ca73a2975b6475204eb1d64672e1c3446347d1a5940d0e7"; + iv = "acd6b9459ae360571c7a29ae34d46029"; + plainText = "794d26d7b63969b6648c8312363ad1097bb5ad655ed5fc29d222db43d50347441b277e7face6a0fb21d545147fd8ab9bdd2494b3fe9b3aba4451ff8bf13b0bed8287b76b8bc9c17a"; + cipherText = "9bbbffad0656db5118cd89e2d62e3e3559b0d8fec7905a016cdb2d734fe4a8fec69285bd137a0f0af2f44e609ef4f02c174d19d684bdc62021938d7e049047dd20574df44ec7ffe7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 370; + dataLen = 576; + combinedKey = "7d16a5a9312d23131041c7cfa0018d90771de2c19de907b75a3d11a1f3d92779"; + iv = "0cb12bbe22544f0bad9cc1783ce2d693"; + plainText = "727005a6eb107fb67c46d51940c67867f56df2460094b67a5ae5471c4e2fe1abd62de505347c67a7fe3d6103e5088456694022778d02c8967732869cd807c9c12636001c83da1f93"; + cipherText = "3c810ef5231624e0e2bf363812dc5df17aee5ec81ecaa6cd05136258a77513e574746e8425e9e2eb2da07c9f7fad741fb6ad67397db6eea78feb7c43d724d87b54a31b75c0a5aa0b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 371; + dataLen = 576; + combinedKey = "efc3504546ff587d12c073f846fd4238d9ed539c3484b09ba368d97726d3441a"; + iv = "3b7d83c8dda449cfa6e8e48a4ce1fe78"; + plainText = "d8fbed361e7544a3e2bb464d8edc1ef6538aa4a0e079796791fe898df3c2afd6add2c6a47c6dd32855de11069756b569c4bb442594a1e908e9d23e9cde260cf4ee0a6e8d9a28da39"; + cipherText = "943d5e3d69472b73de794279222b1341f58b83eaf045fbd3c0c4240f23cd8d96f569ce837766f4c55e0b1f85e64b08248367ee36ac449a65ae5d13a871c3e66eca4ab2c558aa728b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 372; + dataLen = 576; + combinedKey = "c0f7d1710a7c706302409893fccfb6998b0493b47239c275f3c1a27aa0bab0ec"; + iv = "93c08a7f9f8bac23041ae115589d2a1c"; + plainText = "d78a3eac7d873deba7de3060c20cc3d0a9210df8a13dce5c377eabcb6bb2f6094a20981c833c03e68723f395dc9c99f37e414898e3d3f4c83e4557874e76b1a2b315a614771f2726"; + cipherText = "98c5c8987f67a7cb16dd702185476a0f08b839ce447940e3a96e204f6e0f383e4e0c623692db9de5654c4fdb113a8d44f0f827a38fde1ab526ca0a199ba599376d703d375b7601b3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 373; + dataLen = 576; + combinedKey = "adda2c00b6a83e0d6128f53d2d48a9f4f1712415eb1240e551c52ca45ba0abbe"; + iv = "47bb421c7c9d12c72e9559b111767ad4"; + plainText = "63af523338896e5c63bdd22173ee0a00de7a1976eaf43c33c0322007ccd936a6a545effcaabf588ac9cbfa26ad943b9139908182964695d645da0917715feff341ee19bd01304dd9"; + cipherText = "17d76992b75cc93788d48e4c46ad5e33105f1f0b6d54b39f00c348cb075e968972eba5b228aa04e08674a9e5ba67caf0a9876ef41c6e386a0b26c5fcfc7f0a0ca158f20afdf6f6f2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 374; + dataLen = 576; + combinedKey = "3721c22766104b49ed99044f194446edf92e7b725d8b761cf515ae8997047450"; + iv = "9f39150ea3eca7fb389c49ceb8bc3d45"; + plainText = "7eb240b4471c12da350144db17570306ef2d9d44a71f230934a16c9a2369a3f44b14f3b6bbb4dbf749fc63b2ee31cc8302c53c559abe312a8a9e89a3b42259df9159c479a434664a"; + cipherText = "791065209a4366947b849263a6e57d4dddf0901f5468fecde062516e2135b2d02cf5e9f5cc5fcf82e387860b7b357fff71767f033da4300de3e9799719797c771d0e4ebb1fce6797"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 375; + dataLen = 576; + combinedKey = "844569bbe1d19de8f1998978fc70b67a88b86b5da3f2acbf12e23a544d553931"; + iv = "f5ed19cbb12ec19fe09737691965bed0"; + plainText = "f8c94ae0455549d1bdcf34ead7df0ff8d414b7b0e98b3f6003307a9181b0345c926e8a573740f1948e0595f8c99aee1cd26d205942d69814786941679a7e902c1ec3575ce43f092f"; + cipherText = "2d4ee55374340bd96629ad94ae83fb8cb7ff04696135df53d6ed957f790f1ab473b14cef449e50d2029c9d24691b061b19b5c1fae63c0e0c38dcc9ea1e6806cec569a2359e78247f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 376; + dataLen = 576; + combinedKey = "14c82786ddbb7fa43935cc4324921f46c706eeffcce49eb40837bae142134d5f"; + iv = "49ab9dcd2c9344ef616fc9b7a3d6157b"; + plainText = "e70222b3c7cc5bbdb29c5d0ee4b7a289ff3b324c48f8a3356b6199a9acad0d486ca6ce0675b0bc407edce7e3a6f5ec0650270bdd42d947ef20be56f709c718e3d0158d999bb4bd32"; + cipherText = "ddbaeb3a52c7014492b44f60d8bb83eb00dffb735c7326f471f3be9cb2b27cef6ecf7093ea73581fcba705b0d3fd6a116e42484ce950318c1907398ad57682384693e15ff54ae91e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 377; + dataLen = 576; + combinedKey = "05e54c90057e5b73dfc8dcd3eaf2aa809724ff6546b4bcba6e6bd21a8951cead"; + iv = "356bf30ffa5b1df2fde72b89a8d4cae8"; + plainText = "3bb4424bcb219fe445dd70a42bda228a27d61152aae747a33b024b3dbe8a962834c0353716ef4348dad87204b7fc0323c12a683adbdcbccbf5a8f7c19492ec97151c65713a6336f9"; + cipherText = "a9c859205319ffc7393a641ceefba6d481efbe8d0f7e0024da6866e6291cde4aab8476b87a666ecb90ff1d80c63a9f06791d64e3c5c94b46d33c7ff40c6e3d039159c59f510729dd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 378; + dataLen = 576; + combinedKey = "1191b7c0734b75132eecb5c879603a4f4fbb4ad95ac3e1dbded1753e64d38962"; + iv = "186ee4e62221d225936dd3f5ecf4a84c"; + plainText = "c4c5d061a241657e9611276773c734224594a7475ef0d8658ad0514aa91e4443eedc1ff5d6be35c17862c5cb1e835c9af6d36a937e05c5bd9accaa5b1fb1cd3fdf8db46a4b446e91"; + cipherText = "066d258b65a5f51551b0504fd51c8f9cb09761ac4315b9bbfed43d6d10ce0281874be429b6c2afe14affaa002363f09189fada13eb7a1b5b5cc731e3b2f17f7355adcb3903aadef8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 379; + dataLen = 576; + combinedKey = "a612abc25067207ef7751252e392bc74fb9ab76f7b3f8442e3788409984a7e0e"; + iv = "fb734489601c732ee2f27d3c24f61e85"; + plainText = "8660e147324b71637d439ee84383f30890ccc3660dafe27ebea81a6726d48f214c668fa64f2743ca98d866fe6486b6a4eb72c9e28905b33a690c786f0d6ef6d9991fa7cadb593bf0"; + cipherText = "a87dc6f20ad1c57f58f362f5b1b3e3955e7700d27eabdf3ada810482fb55c6786cb41da71aa290862b2b4473120bbf67d1a070a199f2a059e3023feeb6f23de6cfb1d25d8ec08b62"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 380; + dataLen = 576; + combinedKey = "4b8265a707011ef558bba24b721443ca150a7023ee9db9c10e79bd9b90bae527"; + iv = "56f16bb691d2b24cdf6153d6377c2120"; + plainText = "b350dffeb39740b94ce5389845026795e1d98aac6a80cb0409ac97e96908becd4fd6573bb4bedc20fbe13c6671264081ac12e593d105cf4d74b194b0e9768a6c2f6b1e9da890cf1e"; + cipherText = "e4c468f0c846f2e4cbc62240771fe11a1899705862da4cf63d92e978a1b1f24e20c39f86f5861425f370a91be53880d78107f081478156b5b0dc4369342a33d0e00e9911a87443f4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 381; + dataLen = 576; + combinedKey = "f84ccdb7e9c9133d81d67ac1b6b5890162c030731478c2eb616a9f4af2592677"; + iv = "2c8759fd09859eb40fa992d9b79fa738"; + plainText = "e2aa126e469ece99e32831c02e7ce1b72b2b29388e0fdd9e849476affc6f35c5879f482458015a1537100ba24e01ce05e8ba0214997de2c8065d8f74c074b4728ae6186d7f33ce94"; + cipherText = "d4c0ed5e4efcf09e1628bd0b424e93a3ca3325e6835e6b541abe62bcfb7fa8e18f56ee40fc357d4d0493d876b10d79401fc6b2cb9cff4f2fcb8c6b94f7dd3f2708b9e925ead02ac3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 382; + dataLen = 576; + combinedKey = "8cbeb2d49426d05ef87922e37a4fc194c6cc214f0c3e0c5a9f09cfd626870c39"; + iv = "a9f45551d8ee931c3d599ab655283a54"; + plainText = "294d4726898ef808c1e650b034780a5706409068e742b8821055c431e21a51e1af82e97452750eae3fd6012fa6093fa4ed97ed910670cba64acdb25482e2d6c4ad0e22ef08458d11"; + cipherText = "cb5e46796b8ca9860249c539e63d3feca7868d6b3619b5e6424474c570bf95e1dee28dff6522b0d57a8ec024b5e43b27b3f0c30a15e8536917602345bafe57d070d9d7ed2386a352"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 383; + dataLen = 576; + combinedKey = "541aafb767d69ec7c557cc2067604c2a26dbc2d731bcaea1c6e63cfea5c6a4ea"; + iv = "2d27d9bb91e75d54bcea23d9dba9998d"; + plainText = "ac08278b5027b80e1c38300b571757e5d23c2a6746fe2c2450a2a5087095ae2ed97982ed1593bc2eeac339a3e530654595742c2fa1bd294c6f3621f99344381fbc56a69ba5ce469a"; + cipherText = "c98d6d7fbcc46bce7d98e83b732d96ab4f300b967ea6337738e941e578259d251453fc422c695dd3662a8332be55b82dba714093476df1a09c53a9a575ac4ed3e08f02216a7a63a4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 384; + dataLen = 576; + combinedKey = "4e3c7b5b0dc41af45a24cd48ef9c0d09e882066a481fadb96797f15fa83936ce"; + iv = "951b0f0112f64b3838b956a8d897cef1"; + plainText = "f7ea9ea14e7fee21b8868187934618dbcd1f3127ef2903f56c3bda9bda21c898162335121709e16f548905553123fb27d6cc995691647de80ec212d2cd3b7050a9da050403124565"; + cipherText = "b20139d0327a83072bff32bd0fb56c43409d20e3da11a343073155f18af26394f6110ecd7378712c022eaf55418d3945dc836ad1e72eb275b039b43fc4ab37f6a950c7029846d4d3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 385; + dataLen = 576; + combinedKey = "f7e51bc8aebda4a2415c5e75c986852642f591bfb88a07d065980cdd057245b4"; + iv = "72f52e2b5f1cb498538a955751aa5639"; + plainText = "dadbafbe7808baf838dc71cd75e400ca83365e713571bffeb8ae98d5439e0e9c0558e372391564822d607ea326a57caf0e7f61557ab02a799d48211aef661208fc386e3bb3ef5dc7"; + cipherText = "d63b32a6c8b3bf21cedc1b05f5766070a55a6ffe5d0bf19aa176a54afb9979574b242e4171a7abb8042279a35ce02c40d66696ca674f62ac0c2f52dd475883c82e9a03ff2a85c5b9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 386; + dataLen = 576; + combinedKey = "5e59d3739d8adda588a7b72139f52af68d514b5f5448f6caef298aeb97fe149c"; + iv = "5ff0597bbe36e07cb3977e597c40bb7d"; + plainText = "aaf549eca5869e97c9b5bd9b7b90cfcdfe4bedef59c9bdd8ea642bf0e56a8827b094fb103b68395536de804e67289b331ca41164c27859d77c3085c2be091c3465ba246a1abcef6f"; + cipherText = "2b81b97772131272910bde7cad82bc941e51dacba12c8184c2e28a4c89f29ae796a0d865b893307ec4f28bc6c4c6da83fb5be2db989525338c5d40afa02e20ef3f7a8ce4be88b0f0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 387; + dataLen = 576; + combinedKey = "78d00a685263cdf0cf2802ae1447a70a133eb8405bf92b6f9b79e0a31cb156cb"; + iv = "ba64385edb04b94b0e2a11aa351def42"; + plainText = "a33ecfa6f5efb8a2ed9b24c38a0d4d6c24b93f603400a940a082ce714263e3d531fa52df309ccf0320e16bab4ec812870699d4cef4d1156de3908ee68866ca9e4b7958668e3109fc"; + cipherText = "2023a6df9780a820d1faabe47b7d3f3fbe12888bbf16a630acb4d557a5817505ef47cb9ab8d072bc33cacc7fc8485a4a81c6a86b08dcee8acf96c3c0f18b9d586c2936415145ef4e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 388; + dataLen = 576; + combinedKey = "0cbd07f83f298a6e3bc5187693849b5f6cbec3c5993543781d4ec0c9a895af1d"; + iv = "90819e9c84f003397aaaa7dc73313c3d"; + plainText = "736b39ce3962aa77dce103207ad59562e3a50279c70a0753d2939fad61b055f28c168c560acf109c04d2def5d90c3baa2ba9c3e844b3cb238f61aa5c01c71dbcbb80313ea87d52e3"; + cipherText = "652e19e7ddffd6dde486475c7bbfaf087850f2b0dbfdad905a035546c53f5fae8ae81eb0f777c1ad172e9786a28c55d4f55df2359fd7498a59197d1fd1d4f40370abd7b0f1aec68a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 389; + dataLen = 576; + combinedKey = "b61ad016541230855f9a17ff17a5cbc1ad65de760ff35c6355ffc34580406c75"; + iv = "66e620b8cbf81a80adac4d9d936308d7"; + plainText = "53a9afab3bd2dfa8dfc746d83bb4babc74d8c436d3268c656ef5e388c404139a31139a481467762f95329c6a6b2637676ecfbd50e604e3f480da6deb8c833c6e8344a6fade4ac637"; + cipherText = "2065be7ecfc4276e5f3c39e2ba65e4fb96b83b89c5bf4b2212fc1439a4dfe99c4b7d4a5c96704e080ecf0ad557716df781d94e878968dbda222a05f49d8faaa2b96be3bc10613fdf"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 390; + dataLen = 576; + combinedKey = "09bbd53df772b094cdbf7d4825f00944dbdb19d15160f56ef32a28ca98e944bb"; + iv = "5a0aa763599245de7b8f3a79d533cf68"; + plainText = "122c4b3dee78abbd4025a860c8d822fc4fe18fa04aa29978fad1b4fd37605ee96295bbb5591d7e4233e06c51381a2eaf3d3d2caf4c3e7f04391fc471f78f746929997f05c5444498"; + cipherText = "3a883702d6f49917e81c22d041faef21a81e3056adafae768b3fd8427445ac6e8a00a1c784438bbafe5efc18130389772985f988db2e2af3f104f236c54a6b39e9899f87aebee7db"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 391; + dataLen = 576; + combinedKey = "f7fdd82388136a05f8f202dc908f3ec0311a5c5bce344c0515c7d105128f657a"; + iv = "abc5f1f1d3ff0e6f6f8de9c69028b340"; + plainText = "73be0cb974f597a6734e2b2083095b9cf26a18dfce2d48423906fac326d0ae866321cfb384ab491eda60cc5994b7df300a13620095eab6158396705909af234f11fb8b78c07af5d7"; + cipherText = "3700e3ab07faf1fe500a8fd396ea58a57338e02da4ff3aa2c36ad24dcfc5106d1ac7a4c80541b99339b9cb5cb791238ba9ea211a5ecdcd1087e182dabed66dcb5f3781954433586b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 392; + dataLen = 576; + combinedKey = "d9529ed7194842e14c2d207248147024db0551fdad6f15b003da3d36c429f1b2"; + iv = "80daacd7c9714fe28729bdc2f9cb7fe3"; + plainText = "5548304822e9f02435a2e88fac781fffc321b68004029cdc36d17786bb4978523bd0c73b4c84d8e2d12150139ac2d37f3536d27b783d7aa6e6a4554c40899be7b9e645f6819c0146"; + cipherText = "af6ceddd8a97f04a4729444ae5a06d2b5d2cd07ebd099b2ce369e0ea4abd7abe61e975e3465bae63084591c0a506037995e6d0ac687219a024e17ee9557eef0f278d2d1a6e587608"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 393; + dataLen = 576; + combinedKey = "8568dba21b5e96e0d87d52f4cfa202cdca87742943cbdbd6b5624e6c98a1457c"; + iv = "bf5435b813f2d925940e78bd385a5ee1"; + plainText = "668d41cad72a73a8bb58a1feb9d64f2085278f4ad814e6cb1c42b36b0fe9b3b6f89014870b557c1f5baa0e83881d8cf9bfdbaab3ca85373f16175430bf1ba14bf45c63411c60bd77"; + cipherText = "c4fe86386ae2d1e032ec4a0ede5421d0c85c6ccce6f006f1a88275a03a9a54109535568b6753a481301c533060993a77b62b9fcc54eca66495ca0008efa0ce81e24504afa82680cb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 394; + dataLen = 576; + combinedKey = "e198fd1acec6315f46ded41b52b7f230c3c3a77c149e6ec76ff343d36df93969"; + iv = "705e7802b1422c13ac3c038c4c4a656c"; + plainText = "2d130d9d3042fbfab5f565fa2a14b0e9ebda8d78a76500d97b2810f06976e90cd580cf61cd3525044aab93fdb43faf6013b889ee5262a6227a21ad67bd2c2f5a8936996830b61ad7"; + cipherText = "9c1e21a6e0ae8892978501019ef6b046b0e23fc16ae28690071db61c9af53359262a60c8e7ef0ad6371d6cbc96c8f942c207ffc10a7a04116753b8e59b3737612ab1212ccf564684"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 395; + dataLen = 576; + combinedKey = "589a8bde9acab1835077e3ffa32ea66494cdc7d21b8f06d4831da7f01e8bdf2f"; + iv = "572ac321197ea7a7924901e7de04f749"; + plainText = "73cbaddab96fd1ca9c7638662eb584ee72cf90ee30efae9f3d5566a6cf1658e6fe36e09fd9281c0544bb3b838fa2ccd3722e498e1ed1a37dedec69235d6eee64e6f804accecf66ab"; + cipherText = "20d0e366adeccff61bb2e541c0edab1bc80f9941a3d80a1e4948499eb01dd65d125a389299515a08f6051a826a12cf23fe8124886de5826b9d7defca91e9fa7600c67c6b8aed5c84"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 396; + dataLen = 576; + combinedKey = "18199900b93aaea8acfea41237ae0882093b39826fc500596e1cc0be1862b951"; + iv = "c8ff29287aae899b3889c40295a56d85"; + plainText = "4739cdc7c52546f968a8d485fcb528d51fd960c68ab09755ad1ac182d34e4ba90f6fff918e9512d10edcf3c6c5d1e023cca92c4bf5537cea0bb81f6400f34ea8f4eb24d1a5afad01"; + cipherText = "097411198b813f20c05809c734315d0aac720efbbeac4e392cb30acdaebaeb2b3e1a5976aed844b64d64da533c8e59a06da03949d90b6e784e8443a84d7f60af2eb2f3c088a7c793"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 397; + dataLen = 576; + combinedKey = "12955770a3dc6accac971c3e65e29c0558ad1703c5d4909338548fddbca49082"; + iv = "205c2f6ebf6c5bf186c59b5598e7202e"; + plainText = "012c8b3c72b5a6555ebb0a077d2475eeeabe35de72ee12e26f2c6e7146c67f5e19a59e7e7f3187a2922d654115b24425f7d4bbedbf35f1c7fb961692ac4de3fa3907f7a7d11a0028"; + cipherText = "daa492a9e52005517dfadde26f950433b6e5fa75e447023b77c7d1e537b48a072852df5daecd17acf0f03e7435e390641037f64c1004a421588786ce273ede267b9ad36b2878a16a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 398; + dataLen = 576; + combinedKey = "09034c6c1eac1ec34a3b27a87ff37d93abb34a0efd8a1f9e790608b41f8b7688"; + iv = "d7a028bd9523170c43f643454e056ac1"; + plainText = "1f997a2374d4f46ff53dceb86cbf38f0c9a9c0211e11768cbc0f973889f95c058a175a5e282129979aaa6c8fc05a5a035b501c05d3eb3f8af26827d666774e03ac5d1dd53a52215b"; + cipherText = "cff26b564cb7e5a66a9184b5e2d9480a57b602b6624b456fd1ec35197b039673799a944a263c92b6a58dbb8a3fc2436e18bb64901c8dea5dd7969e3d0d01d70c3b852b3d30cffd93"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 399; + dataLen = 576; + combinedKey = "ef8c15817473b4444bfc80bf962aa713f7e79f632e562ae3ee75b1807b3362b1"; + iv = "b7b684ba31e19b08ab2a6c82e5ea48fc"; + plainText = "45a25512893aae57f6bc8b7490ecd79ee2c1ebb9e9c28826194a508901d157de72e898fbeb0684d187c518840ce5d30bd167eedba0d9edbf7a5160edac9e931907273e12a289e3f9"; + cipherText = "399436cf867c714d9228300fe55e5cbb2dc4f18c8efc8d3b9d250c58d99cdeb739e2a1813eddce6066319d1d343332354b9bdd2dcd2a7c74233ce33e8a61ad31607f7915bb21fe13"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 400; + dataLen = 576; + combinedKey = "aa95e7e5cd36dded52a9b41377efebf35449c7e61c22eced52bf2f2bfc8d22f0"; + iv = "48c156dfd368f364d59240213ad1953a"; + plainText = "4fa8f5da57e80c3db271b923471cfb197dc9637910a4d16e2476ade359d5fefeef88c7be1a1b2a643968f27e354d33336bdf22cb88bf0924b151758dfe5efac9e82e2229e719a306"; + cipherText = "a731ba5282cea5d4ea19897cd3dba298cb60c144ff044e35727edba82d2404859a13ff4ed0619c7ae64ff0c16029a0da43946b9da69c384cf917e6c62ce4b575d62c91581fef83f9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 401; + dataLen = 4096; + combinedKey = "7743b833214e7b457a746b660774664c544d02c1125899efed80840197f88766"; + iv = "376ab22c89e4054351c664f625c4323f"; + plainText = "56ad02dbe33df5879e09f3a1a2bbc24f4c3cfa196e1a15f1ce87723f201fa3093f2d7340297f07c6bd8eac93c29a52563ff5c033b567404fd11701aff69fb597f46b4ef88f42f921319e64add4cedd83f6cc37514cf0df7fc2bea708f2d61680deb66a7962e8cb236e4933413eedb97015a7b7756e3da6c7fd2552e7fc766111d98080833a8f24f2981eee5fcd7c3b951794eba84cf2d339363373442efcde4431c1a06706c2f284de755b6ab973fd94082783b41f06c214f59364eab2719e8bfef8965527ca822dad52a9915fac45791bd207b49e6d185039ddbe199ef25fb5ef2c3a94ed345db752526801b564c1d4d638b9c2520c154e40e5fb9c86e57c15be89c9829a1d991252462c115716469cffe0a46e779c3dfaffc251a736430996185caa214423a54607d5d15f1b5cec61cfe364f355d910b5fdbba15dee3b771eb8d2ee3ef935b7d2e28003847a351826056254226dfe11b0795c25efd6e7228b45bec588e02bad9ab2c11201b3a02d5b9694ac0d07fed42c4a919f54e1b8df6e2df00b6a05ed23802fb6b25a5bd505a58152368d09304036801ce7eb86e975cba3e595a9c375847559e9b754f2195cfc597b58b28f6aa7d421e65f9c3290ecf3746a2e7746e04994196c611226fcaab252ca38600d2ef09f1a3911203fd8c3e1d6f4ab0afdafde8001da189147ff802ab603862ffe21a01f6c63eee6bf89f722"; + cipherText = "7c61c579914ed32161d277b6040ef2d53512322d8ed57fefb5437b9ff7d477f1231ee9ecce52add1eea02edf735d77234961ca2ae25422006111d7704c9518529cded3af7555fb24ffc1868fc1c8b17a1d55f1dedaf8ad89b555d9179c39d49158a2ac622b86f05fd8aa4ec06c574ae624e45e1258afe41de70c4845dba86b7ef45d693dc52557364784ca492cc6830e4c1d70dd4993bb87e8073ef048e7fcc103a6e465b24f23991000159e6570e82c916a3e935399b75e265a15d52f5824ef6595cb0c785d7b8f9f24ac45d9fbc82b5b75476e57bc2b7453aaf30bac5d083906a45d4d4e3d82099a6b014b12fc06e9e13db5cda66547eb4ef3d74ff1b9c05f73d6c94397636c11f438925dfc6375fd95c85bcb4e840bef9c89bc0948f2a055a542c67226c013331a33b559f8779cc6e7a4bb2e750918b7ae4e9798d45ed2ff8a223984e7baa52c58ffa042f2b5f1dec4466a2071f2c5ac013d4155d48edd4e18f68c06429fee5dec9d978a9a6a6955478d8fc05f8b9aa8962a63f33a90dc152af27168242bdc012863ddfd77515f9296f17c9ba81183668c052e7d54411da221894804df05a7c269c6915da8c8f0b3660df5bca23d3b3466ee4befb52b203cc7b8ff755dc76ddaa644732a3996c3caa7c7ba1ac358112219f4e9bc79c8e1719e0a0cd4a1fdc8b52a08d6b8c88b54bc5632581ceeac12d01d187e595f226c26"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 402; + dataLen = 4096; + combinedKey = "18e933f7f09c257a4f44c7019bbf8f1cee85a9c544c5ba3c0e89d530b9d63d1c"; + iv = "db59b8a85d388ed5391b3889afcac4ba"; + plainText = "15c2fa930ed46f0567d1d1841fe039cb5ea84c4d62bbdf33d3d698e802c88eb38a1521e12e744bd651b64546393d81bd2d20caa1666bd4998d0144c60477ff0e48a573fea340eac5514d6b02763d2f7c956a0f3f7617ce64fd180adf844d541a293604534785a892f95dd637e0a8f07fb51c5b0400f4ef230a4675e6af9126ec71aadbaabee71b822d71aa542335c3ef2b578d8e28b4b400b91a0b9e16753ca0fb647e76ad30413545b7bf89158427c8fcf0322010dc243aa3e2ed819a73f9eb1c9d0d744b46d62171de3bcaec8e0b48d29f09789abb3ed4f7bbcf1aa88d955cf8d1e55dbe4d0d0875f82b1f8df924bcb86fcca9d09d9e4a977d3c0d3753a93380d4fa0f842b0715957344f9eef0097250c23007c506aba3bc35e20dd7b94d213d359d27913c153f242171125d6ba80e214ff9b898e62407b5cbdd5878b4135acdc80fb8c829301e9701f8d71577a1f5cc5e7a9cfc55513f951137a1cb50d9e64462180752a3d36f26fbf837500ce315994ee324d1feb4d10473b6bef2acb5890c879c2a4ffe03f448b79cee113eb9411511cd77cb3d8ea6c50aaf6f5405cc56cf954aaae97afb34c13a1376b12efc63b7342db30eae18ff7507c662e4dc3ed1d1ac58941c553efe5339a19f77e6102eb2cb47ae08b48b66e4f611dc26a19c8ab9318d70a5d56fc9358ff4584ef607fadf372f7f3b0faa183700912021d83c49"; + cipherText = "bfb256833050f5e5eb3a730c1db348bdc73bf0c64f9b42cc4ba1279ed5d7bf980d34b575115e6fc933d1e10d27dd41003e57a345fe83b251c289abf3ce7203685b9c6db830466d0ff35f4387ad1a29277d03895a243181140f7fbd0a3d699dae76698f524cad8465ffc465d74a3aa27ee9b80d7b31616b15f4074f2ea5e002a40023a0ace49e8d02849cf3e93e0a1f120b5bc95459c5727afe8cbbe85b39ba53e9e1a3a46e7c127339abe4bf009ae24e8d03574542ea7fd917d26569827cb5d7ddaaf1c4e4a080843f43e229c60a9f0d405387cb9033ec43ab497a67ae7a1d6c6037353987984fe873a9d36e480e4bd8b6308b1e684cb08f41346f66e2a9ecff9fa1955a6fe005a3d954fd8fac71b44c1535cea00a953eccacfa998b356e593ef86459bcb3cbc24be4ba1e3b67def54ec0828c40636a56631312921c66d175554d737b56514173565b6e898be785ca593efc7211c0f35c7ec6bd3d41fe4f2e11964073e4cd9444a33056a16b57c0381e860488bcec1c4dc45b8f6022382b73bfe4ef0f62b4ce1b6b009b010bee2d9d7b2061049b967262c1fb87d02700a02d20fd080ce10768bf60e6b3f16facb3016a028badb061318f7c6867007fcba8be258a91a831838a44bf15a0e563caf13bd8f172fae12f1f2e33f0656302953b11212a0c52345ec033b754791bd016d1536b1040e099f6f43cbaf19023169b5439ed"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 403; + dataLen = 4096; + combinedKey = "693ce078657b15c4f851621770d72a7c1522d43e8e23faf7566d33008a937796"; + iv = "91728fca2dcbdd83200ec1c601855ba8"; + plainText = "6735b5cf29c39aa6820d254ac3c5f569a616f55146dc8ab8b1620d358139f4f4b9b6cb102abda523b4031ccd06bbd34a7284744d5f01b91a2acf51c030e30e94a1ec17032f3a9a8d6fd617d3f5ff3a969482fa0f63a2b24f2b5729303f92d56f5f102a0c34cff94e5ada45ff71648401dabecd579e523b1955c8b66ec3531720d26cce7db542ddfeac958f1c66785c208c31393bcf9dbb6f544909f2a7e88393c77b1850c046dcb63e7e87b2c9fcd8a9c0c607971e8067f54483339a4f71e99439bf121df7ee9299a42831c804a58219666db27d6b4bcb690d734168f20d4683647dd0dbaf53ae0e0ece337f816d589b847f08362ff9adb1fd25a6e4c77349ad15c575da02a350137b9007bd5a51e57579bd42acbf77714b92ac28c0308bf591591afd5ec32640e89e094c46a8ce7a375549986676f01d2592d2bdae4433bfd192fb46a4708e9b6220409443bfbe1eb847398dd37667a70aa3b5c50157f0d768d7cd146fa3ec98b1939817e352590897504f0b3d7294389a979385b99bbdf12a51a174992707742f27c48797fd4e964e3cb15f0259c663c62e50dbcf1c8ff63508730b9584ed9329348af8e1d16c910591adea82a66731de3b3dcaac4f8682098acd4e93fa9cee034214c10fbf8e9a7b9cc3bbdef9419990601fc3c22a84789bed03665935c3a24d95190b6266e5d1fdb0e6e7e95bc13305e4b04b0c677055b6"; + cipherText = "b3f70efb69128dddd467fd9852eaf06e743f469b49d35f1d6903a965d6923866bcc168955a7afc1ff771fcce894b127211e0e969aae68388731b8550630836c9137ba17c83a4e9f57983b3699db5e79551e254f8fe3ebe9691fd9009174e251c2711cae4b3f720ac9c9770e162334454899d0f945664e45e07423a2ad4dc634e5b5e3ae5e32172b9fed308004fd595174161565ab04a3a40abf5e4855bc02e08513312e454346f26d1a72b60ab0d16fbfb6482693ba2dc8d999e283981e12feaa575e62c9c6de045066a34016d4a02172974a50b25737b7e1ab5bfcdf8bcdd141b88c3ae154103c10404f70c4bd4cc5b0d2a734cd4f7e9f869e6e84da402ec2d1e174cc01733b7ba911c4a1b20928a64d53ac2e8cd238a7035f242bb35a2f6f287c343605ada2ee59c08720cb44f648c62a2ab94ffd23d9b8be64922ca75ea50d689f04211fedb1af04e2617cbf4810050831ffdeab86cbef8b75a30d60309887aca1260ee6a574933c6edd2fac40b9b2b853c25215b09c7db930e4437835fb1a05353d9d24bfaf20834037845ea10c3c8c4df6e77979ee035e980033325d00cd789800abaae0a2ba068c0f7e3720c9668943506689a26029eb68b294ee8af3216fdef8b3b2b458919ada348556a6cb3ff1d75841e2253cab82766046cbdfbe4e027a5ceca2908219d06868fbe4e159bb3803636e6c6f3320e0ec602c2f3ea66"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 404; + dataLen = 4096; + combinedKey = "c1ce5d459fd76290805cb3613851ab6b2a16369551c30e61df53f6097362f65d"; + iv = "a3c254e35e423ce67dbf81c96fc931d0"; + plainText = "9f373591fa3041663731f7e2641667f08d73ee5a8719b498a976bd986c319481422f0f789dbd691f3bb918159cf4093442d8f4f83bf8bd4542aa484d05ca0aef87497a26dcb6d127de21057763aca8f3bc652e841b9c89dffb0b7718c2e9c0730e870875ae78daac577c44f851f75c3481fdb6e0ec8bf09873b4fd1d1388428aaba8a82e9a80d13e13188f2228a20023d836d43fda0120bd207002f54e3630b18ccdcf1962a3b0eb404452e019058970c58eacdf41eae7a23afe4efd6373a97481bc11323e2af15d0d66959fcbbca962eb204614c569736d05cd02183ad652061f9c5915d26c67e4b4447d757d1ac89fba5ff47f34afce6e57c058a9284604edaaf43486d1149d4d081de2d4a46210f5793b8cf78880c3100edc08986a128109eaa9a75ec13dc6d43aeef452cc41fa0b2c796fe358c9bd80625ca1f178dbf3dd0a2a7c22491fff99dbe32ae2033fe808e70394ad730faf4e15c7b67e6808842465dd07e9410dbccde2ae5e16acbb7fa5d257332d3aafa6034b3edca2cc407b988fe8445347a09325b77a8c406ad84da8df4878cb384551cee359b45241236a9c8e4653e89eafe309ddba098202f78965493c1abfb9d2fece5a0281f6fa3ac0ea172b356f6c0522805ea9215d717b3cb3a41ef538b5dcd54456ded4c0add8dd4aa3a3064a46ec741bae265fe1a87486f7e0e4d7ce7a3e38abf6e965b536c5aca8"; + cipherText = "ca0ae211e0dee556c4477517436c8b229eb1abbea5e60070781bcc667f3ba91dfb57b58a54947c05774b3c7bf08c3e5ac45781f84984ab258a22cdbee78e06281364a5eb76f582a17c1d6174a5d1509bed042d3c8d5d98e88342398e34ccb6b0c8e9fdfbcb62f944645f10c89d6d4e21ab8c3e8760346b1fc2c082d20accf2f58c1321054043aef1b354eb7623c1f6dcd5c99c3e9b59cb41bad4727d5551d555cbf33b49395e7793a5b8fbc388d736b8bdf768c22e1df156ee5f1c6edb4137e84858d40f02deb7faf442f333375139b9e765e33966104fa81f2640796195e3db4d4eac31d51ce8c6f610409c49d4eebba2630f03e5b6e21834dfe34d1eb01887b9847d0d9738458964dfe02006c73cf5a6787cb246044b4128a8a143f013a2f389f93b0a0bc2765a2c0989f7ed05ea417786c6b933062a47bf7f1e612dde5550295519f548903b42dddb4d2d82e3b24a1878a361c2c49a2066b666d900192a297fdb239658e8dd618fd965c9abac270f823c7f0273def95b08bb8277b9117706fe2dc3fb54f4458bba754a3571ad7163fd8f26d5f18b75bcbb83fa803704a38f7d05961ed39345e52c0565ffd794689ddd72d198867b402462b28c394ed56f5ff012d2ae7265980d5d1b99f0cf390ec28364ca38b3d5ddc0d6b3baaf91d1b73aa6f2636df1ef08a4bc748b929ee902a43298adc34920a7605ea94b5b63c005cb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 405; + dataLen = 4096; + combinedKey = "d41b86f8ad9dbf726dff2b615b7c8dc6f921874c60dc6a3561b1d4c731ec45ae"; + iv = "c9693e01516be89749f4232be88720ad"; + plainText = "4a5ec7859aae98fa96f27830146937b05c2e5c98f3bb4e48fa4dcab65d141d5aac851b3f8b05dee295545708036b478eae1cae4c20d926b7fdc094d90fbced37ba82bb0ae46a030838ce6c4db1974b37c5ee04d92c03a3b352ff091af4144153e33e34eba5df30fe859860a160448f25d508ad6d9d67dc296e4854a9a5aba533def4043c9e08f0f662ed0245e67dbc28be3c23902143eba45202ad5b4d0737b9f6f7afd8419668ab5bbfdd6005596ee03e8a8daa0f7aed41d7849fbf5b65c656967d15de0f94b3f5550f0a6dceff95d1ec5d8e9a0dd7e1093eb37d9f2781dd23783b667171002c81fc3b9a4f35245ec63fdf866ba1e99d54a2d6c8a0807954efd1030de4c5139ba28ac6ac3833f58fca51829d752f72f770245dff047aa23fe5e6432452bfb46b972c7f39d9f1734355f0e89c6e0b553fd317d15cce43c6de6ee93aa455af43e8056e44b87359632f7ca155d41a4d03b2f391092ef67cfb1dafe70831936dcd6deb01930a646a8c01f422373c8ea0ba0a66bf1c3f633578d2b3f452a6bda2fcc8addbffa4d1b55ae37b9482370f7ed7ab9a179c21585db3db4ef1ef9d085a08d64be24539647390a5a1e46432eb10e483104166e377392baac5df07cb54e0c1dbf4f574cea57830c528697dda399d653e9a716b51a17fb901b4ede0b51d8f28c22cb9a37d710d98ed4bb3977973f8adae917bcceeaca12191cc"; + cipherText = "a3f836559dc6fa4525e0d3816c51d00dcb8816d6306742c9411e0dcb5aec59572bc50088c40730b0573e158a69c684cad66816f836cccfc292b1a73b3c56241028087f311faea07e462d89ffa38c89d31f7e5885f95a52b6db67c5f213dad38f452228b1047b47c7d6f210e44798bb2aef1de93e8a881eba019ac54545a38f93780683a704d415933ea8644dd2b7186b13257510f6f88ecb5d29a058f498f8d649f8c2b271f7c16ac3a62ee6d325fe7bb9349f59beb6bb3a4867d1e6a501ef77e75194d13c60c228b64fc2d272fa7da049a354b14451b3930758cef8214acc6e86fe2592cc94786ccd62c72608f04ce96dbc0b7027f887147c92346e055e2f7c9f3f581206bb36a80b40564e1d3f1229f3d1c90e14f49dabcfda6a79c59704cd218ecdcfe4e293a5995a1a93c8ad75d31cdb99e3551ad82a6f4d2e36c9b08ef20bb63e9710f67171e81c24a65f085be59a4b8aa6928896599a2904ba759113b60c1e41cf2cc992c0bd9fbdfc20e658fb4ff9ea35226c54ccb8055ab6f01cc963eede127ab8e5161652c20f5ee83accac4f1f574c9aaeb5d14a7a1b68c51668d9f9274726b41b1178d3c75c5d43dd9b0a5d7da7afb650a63b18aa972602f3092d42003f2f3a25ea5f07083326e1ad3d525b5a296d4c18f115d9bb380306923e71d7f8f16e7c0a75b553b79147f6ca25d60a152ebf18ee8d25489953e65b5f6114"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 406; + dataLen = 4096; + combinedKey = "b754261a58c8724054dae33eea0826185c3ca5bbf8afadd75cf1cd96fd00422b"; + iv = "d86e26d2526c172cfc4da0712f0408e4"; + plainText = "ac8703859310b30af8553dcc8ca4d78f81b0eda1f9eb1e59d6a68035ca64964b4eee2f3191e9a73993994baf958c018edeb190ff7e4cedc49afa711873212141f85d469ffdfabc1ee8ced2b975086b2270445be7dd1b92d33e5b3a820a96ae0b3d6f85e93e61e99f6edd4170c331e254fec71606cd1ce523332dc9350f882c49654122b3faa7bedfb9011732fe27049e52631452653563eedd26cea9df7e9829def7a8a08cc2402599bd864aa6f6284aef088bb4661722351bddf830ce223868938df008817d7806256f80e9c750776e5037647ec76b6c2e2744ca5c711ebd859793c4defc7964e0ab37836c20794d31b98cdf107711e929010e6bda216ebb32637ccc298b3634d7a2997529fdad34d1ce5df1dc684ede4432694c6ed12760a504f35c817a88c2163f5a9dca594d702a8a10991791e82bd23bf2c97ce1dda794a90808ae92167e127650942d0ff0c671d316b2e0d8f607fd1bd231e20d63e64386f891f2a5f701ab7b170917aec7223c94af1a68d0f04d455fa991edcf29a36641bed7dfafdaa11a75d13a763d29a58fdab50a8823c5e35e363adc2928551f8356641cb1e557c24c5e75dfc792db215f3102fc7946e0fe8a1d6d9689746aa1f26d4f45d10b2e2626dc34da285d72232410091a72d5aeea967333dc71520c4f556783400e19d7437a6805384ecab3c6799da21f8f459b3f2ac4fe410fce742dbe"; + cipherText = "7581fdf3533a24f9958c7e01e75e6ad750907780cf643e03ff4a2a9f871b218388f46304745573c875765fa613499beda7e93ccc92d843b855f46c795547092437d954b295dbcecaff9154703e5947cfe7ccf66ae0357aba9431fce48cd7e15bcdf46b742de2af96ccc55bca90234c6f517c96e5dc763c1956cabbf6fa7806f674ff3555bee8119b64d48e8e287d22f1c6647683f096f21faa204bf2bbc3fdd3b9e5a81dc6a102deface31839bad71c0f83d6482ca1a749c3d81492c367cd05ad4b752003ff3803d8febcc20ceb675172d537c999cc43420ad9e655707db9e037ffa09124840d877f1f16187c9811398aa7bcff064b64db78f0c59f8919ae24d38b1b3dac9d31bc0955f499614e102a83cf3c9738999e5ce4011d9057653a3fedfe48c2b77849f8cb3225f4cc8995f34311d77653eeecf84c7cb0e9f22be2b82251af26b54153d9d9f33a52f37d4627d2c9df8668fc2ec03f81ef02ba746ca57dfd5c737a4c6116e9f77163efe14c89d9d503218fb310ef4121c6278b795a4af8992cd6b3b5ab2b92adcea617942a008087293fe4e80c84e25949af32a356791229b7f7d8e52256c92c4c3b2d0955f8dea3d1f84fb0e4f7dc9ae8727eac77f97508ab97512adc847f787d2bdefaea2c690243715472883ca907ec992f0db1d2d4ec7b6663983fc3c9ac3f5528e78799645e3bba8eed66e85e934d8f8ac30c17f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 407; + dataLen = 4096; + combinedKey = "dcfae0b73c8878018de987ce1963ff1e1c5841caa0518b2ca00ea5fc320196d4"; + iv = "fa1223001c5aff1293e80cd4bc2f271e"; + plainText = "a2a47db3e14a4b732a3d57bda1dc0a4bd16c7adba339c38775ea1480ab2d531aff652f0785b07a85d35066f0addf6e2a93fd2c3ec492e6115de93ceb8275b18624e81a4ecf891b129fcebb2fd85fa55a5cde30f772783eced4926e4bf5612063c3668fc3011ef084b080cb2f1d116358f7306427d20db41d6a9dda12ebc61856d8b75ea77e5cf28121363289ff79bda3472ec6e1a56ec2c276ddff6f329de45e0ff9e528acdbd22b8e10af4468359759ec08653feadb0466c7a0b1795874d943746258c716718da001dd800e03554791d6f475ceb67d451ee6673d1ac72d7362fd37aa31d58fd439a6443c9912bbbb01aee8518d7db8a04eda0e78e586b43317bd16768c1065394980d0e3e3b084df353d1c4a912703c1a84a1d25511fda60debeddeba1c2e4cc47efd0a4366d168d73319f6e07342f53d9da5ee4600682407ec403e56640da8be9e9e80709896c17556dcefa4ada75db31747ab9e236fe77b4a3c88aadfc185bf424b5056f02873d8c1f98e01c44c9a09d7fa89b2733ca4cbfcd53454f4026f1302a2613862bcb3a7d2d2e354ad4a86d6fb7f7c79994b9f11ff8d847e1cf4ddc95e86b72f0afb968d3be207f49b9e8db2118e49aa10ae932dcaa9c983cc6a30a721d74a51dbb46a4794cfdb62fa857c900fe764c7aaca1bcd250cd6eab2a17941bde216de70f0583e402bede24dc0d2acce8bddfd650fb3523"; + cipherText = "e895904575592b2493539a7dafadfb7f4c0b94c084ea94f5d072329073ba7a3bf5e4cf3a21407091ef02c861715dc8efa4540e0ab2b864d4e3e6eaf6b6c30f2da155eecd79e71e57fd6a35c84d2d45837b96a967b117e89a533c316eacc00fa44677fcaf09eb57c438a0932d52dbd2624206a16c6eede3ff41b05504145a3640c2c361c4966b602cc299fdd4825aa41de37c660b691531220a2e50aad91e840980d7b04cb3069fd53ac95055a0c5e675dfb9b92e2b2395f8e5a1c6bc95aaa177a1676868bb9a0ad6c7596c33c993bbf37b345712b3eaf95d89062528a25fc96d676eeab60e299540fe39a063d8fa3983d9f9b2a60e0a28ea2b577f37cf3a0a30b68cea8761004719ec520f7dbdd9fc5e980ca9844898638bbe2fc4345ee8b8e2eedfd84d10ea08e1bdc7f4f96e174503da3e7c757d26f00086fd5b382e8bc1dcb25dc6135077ea84d4c259d983cc4b5c47e4fc787c97d4e4fe5ac02abdeb7a06c266984d19f3ddefe56167845105f061a710c5388e4698a50995d7c92865656210ad507f29cc282607258a8b771c1982fb37d4d1da5bd540e3e206ff41fcee1d0990c8b8907df0ef6313b2207ce503233ccb827917e3951a7c2609f7d00156e3d6d965ca281b0def5865687a5b423071ee585e444faf25c341a39c9786e5355a609c7fcaf4ee3e36a05105865bc35c3e7905ee5ca15e31e2f60710e47ed35dd4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 408; + dataLen = 4096; + combinedKey = "ceeaacc64af831f9153d3c1e0e664f1ef67bcc59a05685dd31bb8ff4e9959e09"; + iv = "2d8346dee39c0eebd14118bb0745c1d3"; + plainText = "28e8482d5ce77e5185c74b8940a0f9274cb0e4fdfd485829460c727efef34a43710dd39d0789a78292ba37e4fc80b1be7ab99c79aefbf50bb8550641eef3f1eb6d6cf1a400374e5b3be393e5f158213806fb064e17bdc2de31ccba4e538d48729cb734d9a5f48d2c2ab3e93d7df3e78c3f960ec466fa60527d4a41705abd3bec3b2bf368b32b363746873eee59c42cafe85cc5f3bbaae2baf7baa2cac322ad802ca6df45aa997bccbb8bd8498cafa513219a510bf66a075aad55dc814c4fc113e2f3aaf82944db97589dd1685c417bc6da58ad40485f675050affe50af18b1acf06d6b7a6121e498015dda77b7702caff8ba2e77edc5b17ced45dc020d5fc219c035f0ee4bc57db42bd8449f1f7ba1c3c21c0698cf4cde6a2d2f8cf83ef6f0eacf7abbfa7cca839c9d0b3ec864cff3f11482b469c76912f236161f67cc2952413002d13b4c93f3305fef5d093b4739da7b7e527d554a5c861af08b427a5bb593fb8f2d958d3f6c9376638e82fbb1f15ca06c33539ce65ba11a2f61dac4f2c38ae5e8f2c8499f721b87ba4f9d4d980030c2e9df096e864f8d2b88ea6f41c1ac97a5e4a2512125daf38c23dc51edbaea63f3a3c281a90c656dff52044eb37f2b2540ec0746e53a5bab8a2695b96e3a4f223930b87097b3b51e403b1494437eb9b4f3382cf290bfe373c1ed6152925805ade0ae1d3ffe745c815c5e36a3f2e1b6e3"; + cipherText = "bd8f3d0bc94483e7671ba4fd6ce10ce80f128b3d96d7e559789f46599a399f45fd763d58be0916e26236f04a19e1a1af3f73185bff2c0ce63d066fa8dc7f4cb8ad9b202d1bcb52906440af41abb55a59353566f6dde77aaeb089a70ae8cb46e45db346c54c239d792418a2f370f309c4d34e3817dd56f52067d3a553babb89bd9b9ed962c8442516fd8d15ebcff2f7790af2ba6b5be60c015203cef6e25d9ce941315b9a4263acfa3bf5dce8364e75ae1c20710e2ab507eb6e9a8a77997c4d07e04cd0d4fced6e75aac2f78de1c86153382177c1066df6fea074a2e2ea94425505373eb61ba184937f065643c5bac138552f21cf789afcbaf43dbecee23b8a85683677e2a883e615fdda775a5a18757b9e75af126fa51ecf2ba1b57a8957cf469bc43f8eda81b7c1fadfac5621ac5e69554c2a355e040097a399b96a1c1fde1a769c0ec7bb56f95870a252e8327a3bf5d98cb4293316c340a91f09bb881b6bcba496213f0d36118209d222c4018737d8f83911e8c41fa97779a0c20472d7da7d5f2da8342ca572560e06990972247d7bc23e475cdaf181ff46ef6c8b6b3220a161d76d81d2f52e12b7ea12ba484550cc9fde20f88df2b71588b405d92a972373b3544a43c257ead7a14ac613cb9f27951aa8035b3172a7e11e3fbc7efd5195d918aa266440763606b98166e79e3f25ebdc2159603517b9097184daf545de3797"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 409; + dataLen = 4096; + combinedKey = "0eb0cf1d0ca57c7e40ad3ffd80fecdab183681b53096f4e7d6d23ed91edd2ce9"; + iv = "18c95f7732f2ce6b0bbdaf8c2e8a3465"; + plainText = "0755ea622427e884025b7739e8fcdfa676fd176081822cf506c485743863d8b2a6c74435bd69a94753bee14d04a01bca8e1e3bddb7b77f3f1d3bc7d1d039a32053aaa4e1f1d3bfca4b50ad98cfc9c7d8607ce61a958c33d2d370221da0fde5aa2f07e6044a015221cb54a71441602f30114622b149556f004eafad4567c29958451a04d52cba70816281ef77de6aed35c45a8b551768f24543f506ad212782212dc2e6311a4fa5ba57c368f1836a605c585f63f0c5bdfe53b2a0e53ddf409305ef5cde83abeaab91ab19780fce818876c091e24ed0306a2e5ab528379263e34907b4a80a1fa5693a97ed9311b24124904bdea73667baf0fdae59eb629de112dfbfe7bb53a3663973a8037f7113bbc9bbe5be6d8a0cd4bb40cc10f6a9cf04969e6e5b3f5083bef5900d70ddd0f9cafc65b3645ea14344de19dd5639c8bb5f0c17fdd98b5c721bd54122503392ccac41bcfc6bd999ce59b8d6134e269b53ca385ddc011bc09c0f4d31c55e20f7259709cf9b0d50702b060ad7b0bf3f4d8bb0c5fd32f7089dfb335ed98143c4f22804897bd04355d22f574dbdba84268468831784dc5bb46b145208285ae000b33477d3b7c3083d79d078c4bc164f7f98b9c698a678310319a80ea490ec28058f1226f4d628be41502b781078ee72671c5835fc5d59652f87ab41ee4ca964ce120e5b2c8686d49fd6b9a5e5b73dded1d15f893194"; + cipherText = "a1650ff9b65f783d3ee3bf54983001e7b5168e653d9fb04fcb39e0c41c049e3c1142ef8f3286c53b52356470ab3772b7d10bde4913e165b259685c82673be1c81070f7baec8857644d076fb2babdb3e2a22f6a7c09e99882935131c1408870a2685d5be0e338c35823872b42c0cc8ee503cbd5fbe91dbc1f4bdb94925ea62aaf039b61a551dc86f9492b0a69e8e8b6c417f3e70c7eef99281f3a47253b9c4fb8d22abcd38c31cb09925e4135652f6e31e2db307a02903bb37f919c3ce5ce2c8c4664f98cd71a39096c862aeac7bf481fdc4b108082d59af272e9e68e62686796ff81ed3e5b3ee0bbc192b07d6c3a9f03206073b8639fb302d05ad999666bb3b928ce1a9859a527f766684e67b1b0c0a5b42a9382dd78ed8ef005f00929a1cfb643938ecf7b498ba4bf3762487b25b644e0f7d461787c688c58e4c1a69ddbcd188b2f0950dcf720c6f11adb7781beb23bba096f91b6b20629b0390e168b87db5790475fdbfe62bc2e4ead966e401c785537e6ca9b51139de789cb80244c3a67af3767aa5364fa556e03aa78b4ed0516559e966c3b4aa39ea2afb6ffb55bdeb2ac3d1d3b38d0ea78366f5422ac78bdf5910a06b3ea0b4e99a8268630f8e0d9073946cf7f7c4b95d912126d06d7b63f5fbb954e5808d079cc54bb51d9549b385ea76c05c0fdaf664f790c9efc8c0f4e70e1008b8907a9aeadeb1b347cad4787c592"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 410; + dataLen = 4096; + combinedKey = "c251b3bdeb338337062d608b3e204dcc84b91f11d3f04841b3dd286c6065a745"; + iv = "a228496b1a575b04027d768a218847f5"; + plainText = "f3df32541edd62a1872f269a11a8ec1fbc9178652078467006e1f1e1a1595224d7ae625c888d1c7349a9d1ef4c4bc60e4fd66d159e963b824e063d4348833c16ef57a5900c2f60496fafeecd540f165e310da1341ce999a3bbdf6f6c15904ce41885d48de3ff1bc7d102d283d03f976d9c9da83adefb4167ad4b79a2b46d5733287d334437d463ba55890dca8b3f61ebdeda543e826aa8bfb5749500fa2238bdad78e1da73afeee47b827ededfca9c1e664a850ea05353196441201c63b2c761d5ece82e4ce43727fbff0da0612d55265b929e70607d6503742ccbc0ef8e608100a02117e297a16944cd2e0b8df49381809390cf2c2df1ff016d992027fceb6d3adb0e52c94bdb406dee904d88792c2e7af72cfa2f861f16cc7c821c64f3cbb6e241a5cd4d86fe7a2f241d9c2d2034a66a56184d54601bf3d0f5137c2ec9f783a913d2fe03ad8761f0131e6173e573cd45a4a2573aefff812c9d870ce5256659a560901778cba2b54eaaf01be30b9c5bdef43e6b0d7c0af75480c2a00c0c38a8810356f73392bc40749982c3d5ec36a9b70fcebc48be72f952ce48a5550e482df9864b8ecb8aaf4f0c943fe11480e8c0d858a482628b30208b75abae7df5346c3f2b4235523fb6c03e1b170202532077072f57d73c22c77611e33515ce04018b61becd42f59fa4c6ca1bdca5bee7102ffe156508684964b17b7e899aa26545d2"; + cipherText = "8fda3538acd5676cfc25bd93020707f4ba74b90fc9d5e09716cd4d51d4b630fd2f08420aeb379f3a84c9cdee5d202f910964f2e03d1e1964a3b5471127a0737ec39f73d61d7b7e45bad543670ad541b12ef5468b5280511d995991da298b0ca9b711f1cde02efbb785f1a43ac498b6793d0837c51c5eae8d47f128077885407a2429dd141d63f056cbcf48c3387a8dc50ed136ea10dcac55006dd7a24a01e7835fc524955c70bf882ddb0069d7b96c7b08d9df913b7d3c25725e56e910441697712763df2f36548014fbf614e7889feba138dfdc648ab6dac01521348eb2c7a526264c11fa72eca504ec3137774e7a236facb948a40849422e0327b06fe36c20e817e12c6536779b77db5383cc0fdb3e4192f56f2f36c0b386da4596736958c3197beced7e79580a866511329778c4ba194683b852f524b64e4bbc3f43bf741b25c9ce58b13dc07197d0b871248a61c4a393469ef0081178b60a11d21fddfbfda5f0bf4698b073d6e387f5abddd5cf817a96d7a7e596e1c668c90921404407b834f852a2bf2120734be23d36c00d0c1dd7148520c92568e8e371ea144a5cfb1b3979c74322a44d5107a4b744815b1674cdc1528d8dae5cff85035d5ed491f06425675015908d67aa035cb2bc842e9b367760c291eb86196300dd869f5f08f9d44082cf577461897cf201afccb4e4921b42b0ba3c1d2f6e96b7294327b518cdb3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 411; + dataLen = 4096; + combinedKey = "f85abb76c72099d77a2c32e5456bb98d032f66623409b79f3a719f2b12c0edb8"; + iv = "23f2efddb471d7c3402a498614fc186a"; + plainText = "d6a158cda2e50bf147a64f48bc57d7511f853c216fd28520865012f17b79c7ebb320acec29b2f1dff58710ff223c5a929fd37ae85e9ef7a3c1dc3481ad6a3144eb4c329135cbe208553b358fd67d3ef4e22905bd101ef133d8e3299f6f83a0e58de00225b8a97efc43440a63a26ce6d26a85449c54eb7ce11fd4304c907c83e145c162c547cc2004be7abf9255b422d4fa3a5aa2dc8533743c31d30a9682e6cd153774b23101a55273db6187febf962f51428971a9dea1c39e82ca980ff5eb7c2d85715859acae53a21409883dce8a6ccc3fbb5d1a120d150838e451fd96805cd5bf03049e0ac1697347e870e8aa4472c06f02f7a4cad23eae22abb3f0f576345529b078737f924e62f1841935dfc1cc509bdf1ba6f3b0632bbfe7321bca559e035d311f97cfabed574da263d74c1f74efe85975da01cf467f8039803d574ed3121c4576d7c71c8b84c0ebb628712bd3be06351188b4b555ac0be7980e3dd56e3eea76471f641504c1f1db05d01084e2440a5d31e20a95c225001a193a6ba1ac9b041537cfd0fd6df3252a7a6dce7183d9b62f8a0ebba1e5e983c76bdc056adec03996b323f06869df3147c37839f40a37fac85ec749ffb9e9f6d94c2359f2be186411d7ed178f3ef17aefaa9271cefbcd1162e6ad44a8f5e205494ac8475f09edc108e6dd2ca0a386f3f7b053128a5f0c9646de342e95654b530843f2208f76"; + cipherText = "39f552b9cd3ce9c4821c74ac1cfb9802c06d93f7699bee0a38d6f3ddadb0c19111425fe6b78c7013403166de2df3b83aa904de0c1600a55d381eb1c1ccd6b5eb3b57124bd26fc2695c47369aafa6a580d4e1ab5fc9926e543cc89f4e8871a458bbd7e2a4e0e673e385f945ace945fd2b3aeb142e747bc1b550751fd67e7b7f2e2e0bbadb19482b70dd6d49725afb3562ea86f81cb416219b7505e07f77aac2df251eca180c40e65ed11a754086766b3fddcfa58074098021ba041ff63ac4494316936f61732b9feca94c953b7395dcd5c45a7f26720e4ff83766f0fbfb9548d621572f9ba14ee775135a50bb414b1baf8e502f492c682796ec49f3c2a39d16d529a2bf0bb3bfc292b9245a9b74d3026d90bfb5aa53ae72c616fd8bea503dc9012ebeed4c0030e06a22442a33df2e3f3cd944431db27ed598c0532c604e1b6ee95355a038f0ef382912d8c357f9a83015865cbd80c7e1a57a39635f4287103b5b2c780ce1f31738691f1123096a8633e963fbc74c9b4fd700f9428d7d23c7235c58c6ec165de7a88c6917147dae742bbf5d73e461e05778fe186043c7107f1c2b80d839a6c458a58c7d02c52fb8e2bd05df60094c76d99b6d61515f265ee87b07e2a711bdab76528e916cdb60239acc85edc598bc94f948ff81555ce76197b15ed9c7f1c2e3f4da9c174cdf2ee52ab03825432fab7b1052389326b82f04071669"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 412; + dataLen = 4096; + combinedKey = "5d416dec05f741b760a210763dd829de9d95d0d561735b096d84a2d8d9e8458a"; + iv = "8c99757cc8aa63488b7dd104448e1388"; + plainText = "940b4d1e035faeac494f6e2c7aecf4b67beed914f19245184d1232f88325bb1229c118092f9a5bab52f0377d51ee7669165db96bc70f10e60a625cfb4a9d8182ab9f066b135ac4149a45c321bdf5f7e494d3c8d7f4db9d0de91fa817e9de5b87f6d73a1ca22ea898ed5d10d3df23e7f72a220088785d46310b4c3b14dffe28911bed15721e271ac9b39fd4128fdf3fad060719d746e6fc4603b5b31e82e362aa44ac88825ed940873f8f13bbd8d19f335f0e981dd51da91c4b5def410c7b8c2a29677c54afb7dd1af0f9cf53c6df7f9bb2abc7e7789e5d04009dccf63a05d75c37472bd95dcaeb5ce6c5e750df5719f865d75decd555aafb7a1ab31ba05cdb2c92cf4e1841ed79b3c2341193076822dcd2b45600f8cd6360331afa3cd9679d1085e3bb4fb2032a4b71a6d5a49d81fc5f5bb478428e9b31323dd82d3c71ea2dd01a20a6425aa8a21541a8dcd4cec3542a8797af598c7e13d1048cf596471ea59d3df6e6064e0ae81c63cbb8ad3aaaebc48d315f218457a7b297e1219fdc015328b99fb4042cef7a86a2dcd75b4c7ef6cca2764c7e38d51fa7d147db4477fec3f063d8e1d0b74529375af41971245eafcffdb810fafb34fd0f99fddfebf1cf7aa491ba45a87e07bd0395604927acb796b9fa3de795e03e771241f9e93c36721e999064420efea7998749efbdcfa64b038eb59b7583452b419e62da000c9ac3484f"; + cipherText = "b719117870495b095778f17efa0221a33f0b1dc665899dd23c213621c99182b73e44ac526423060ca386d86d75b86bbc972fa4eeb9e1d3f3055580fde26796ec15787423d89132733c934408f8bcf7b20c105a647924319335a0b0d5aeda3a4cbfff6284b25889e98298984f6170af1a269b311936a2e75c00f4ef3be0a7f712b58dc63b7f6a3268ca8cf87ded14495597f8f105962917a854d02e593afd888f59673d785a3d2f0840108c02b8283b379b4a74927f70006f587686d80e13e276f7b62e1b338760fbae241d20aa324a64ec24f806d8109e8cb83e405917e9613e3b63227cd9c9df220992149580004c46737b31398e44f3aa01eea6c9f0674e551553ed3da577d3223513995b8ac491ce77e3f62dcca3d180e8ae28e1fe65e7a3fa7fa2c165c3bfb097249d60e0d535298570d77eacf08aa63865ff7573e71f38d435cb56da8bb737983d495894aa285bc44b62a26e230a6b46bc7c986baaf94a8e30f372a29ffbf16231d4ddea80e2757aa98e02014bf05fe3f55746d6ed98b1cda61703034b8b8bdc2943b893dd1afe2630bb7d203436496d5cdedf817791db74a5b346a83469a3c291b936844030cef9ddd689e3afa2a01551c3475e9737bf6f3a28dca6c7ec07cbfdc28d715445befd7fe4ee4111ebf5f6919cdfe515b69ecc872a5de512f082d1e7c230faeaacc2a7614404ea7a37ebbf2f86339aa7cb17"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 413; + dataLen = 4096; + combinedKey = "e41f1657f202cfb3c7fbe7dd8daf6b73c2aae4a38ced6f9b966efd8d9c241e56"; + iv = "6d5c80971cd19d2f57a2b7b97724a39e"; + plainText = "705e8d95fea2cbc9f35c1f603b9033c5a4c45033c8e937ffd162944ac8ad034c51c4882a2bfc9a5c9b895c929d7da554d531a2037f3635c10731c31379ec37af26cdeca3f687ca2eebc904185e97247c85df6aac0ea98f8ca74ea48772637b4bb83ff503a411db9c11fb986a0fb8e7d2b59249889669ca7a2770bc008487546150ac37a602a6f0801011569838f0c3b41fb1d21ecffb691159c0c2ead5f65861160b22787c7818ffadf1077a3feb7c504a09433a2935223a8d72b9f8a9ecb50d1751dc25b785ad7cf4658d9a7468bb2d4518ad0a6a175dddfddff95e50324946762bc9e83fd68c01326ad5ef47883dc334c5d29f4e44aa045e1f452559896a9fd035ae41ab5313b4fea882ffb82bbc78ebc02686726ca5b3375b4244423d2f46629b4f1fef06fcd5ddfe6430ed6cb578e66d41f6149a132f7f9c2c46a9fb63273dd97afb63e2dd73c73f4cecc3199576c3f281c9aaf01f548af45565d47a894027cecbdb3c419caee3e20d70e3c6ca77ced0bded243be35669902b1f25ef106706af4513417818720b15617c1ebc70cee6f3fb62970ee4001286e5e5801483a5fc07f62b77a301229e05a4e0c549a463f153e40e2daa2fe4dc1c6d2ac6e0c032c4c171d5f5fb2bedf62602f88db76a0e570e6e39dabe517751b7c6bddb31b74ccd1da920e36af7caf2095f750eb8164f7b51e6fd023bc18a4adb8f0aa41ab85b"; + cipherText = "1cb93d2e69c6b0817d1e26658754bfba40382a3c0bc73a613c9d14515808fb069f149ebe964a134fddd387a89ef149aa4e7fef33755fea6a15728ccbee27037b4263b7d4f4b8fd568376f8ca9f73d9cfebf318ef26c2e52f6a423cd366172a7cf3ff135f00a032fd74b11c116082255d2fa36d36a7eef75f078a680884f3dd9beb8ba74c71411372d78444201a73d420ad0577189ee2e6a94d6b9a10c4ec8b76de7995cd199aac6936ceb83b6991d7095d9d273cff6802755d7386f78b363cb4f4334fe953c71ebc80726cd5a7461d1b819df7262268c6ad1221310121ce5b9afad9986c7c42f97c8dae8261ed6b18b75f0a983c0538e68576d00187244354079389cda9232d75c3709f2c3135e2b9adf286c05b147bb348ab1f0b2a7ec87547d566415d2d95b27eddf9b7a611d33458988a3273bc0ea807993ee229bf573d93e901be360f1fc33414285e3e0ae837fe6ac44c7f86790e1e7203eedb6ad7e8b5084b8fa2c78165a7d2aeda63895524df159e4aedcefa257d5bddb7eaedc50e3a4ec89ad7d77a7d42edf30bdbed2c844863452fb634c0eb9fa4f7f71e84cbac633df1d042b5ae5283bf47eb4658365d4c8576671a0bb6033cd9aef1e924135a825ac8b7f5059da3aa6b4e97c1c48cd7f2b764e435bf15f09db514bef22829a65fd179a577b8bcc7b3e6b8601e235f51ce4d20d8938767a953c18c1ea120fb71e0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 414; + dataLen = 4096; + combinedKey = "c6be1cc30af42fc8689fac9f19f010ed4f1ce0d9de740dfeb84683861ac38cc6"; + iv = "2f3c153bebe6ad3af0355ed00943a8b8"; + plainText = "8a9af2bf69684ec243f3eba275832ade4b9fb83e72fd7c85a37261ec7547d1611cb6e58d041a5c7c394caae491ac1084bdf3fdc418f04f5cfe72c3d7cabfc5368105948d48ae788c379b75f670e5740f97c4a690310d24e3fd8a821e22e3670e11db55c7c775bf8783fde379e770e3ee9eba840b325e89ecb6d5125ebc2d73ade7eb68a2167f8318012f533e7b5694e07f377b10325da63a63d52e2761469674d16819b79a447bfedd5ef8f66b53468efb3b1b7778bf6c587d4c137e78b880e812dcfa4d26c2747848954600bed1b9c2ea406852bcfef6b9cb910ca0294f37d955a65db1e13263dda4c66961493960aa43858bd7dafb621410dc5479872a5703bf9da79fb610f67d5c130cf015d471575cf2b63d6e443c8862b8811c8fc5ecb810aeeb7fa91fad03d7e69caca77a232e2d21e152a4c9f2bd0639ca67669dbd05f18eb32adb090886c8e34340abe3e5b61b4a218904b95caa729c5711c41d97cdbee71434f2b4b58abaf0aec86be1838fdaf411ae6034fb6294401af6c53fb50bece5042b45b927a9041b2a8948ebac284095605a709838b974f4bfab4b89713072d2f7c746e5f75ae5800342247e57842f3b8d7b187e41a6671cfab420b085ce7b6c16d77bbe627be97a8de3b841e002d61f25263d47527cc829cb866c42cec7517c4b4fae40670589a638846ac5aa99cebb86835bbddd61f29ed8f004d2eff4"; + cipherText = "ec69b7f0075b10773796918b75191af62efc7b7c065faa2998a1305ce14f681ac4a63caf27ef93e96a1bb85b08df22b470b186bb6d35f563b1892a7872ef62b9b48ff0eb50184a5b615526a649e7dcef0052899f5829ebcbd8f0e4922c29b994990e0471a8466d924d3b96f2b57083e7a5f035daf9c9746b53d5dfdba7072a9e9d576443b4163d688f50d4959d23a4abc63cf8c7cfa420e016b30ffdaff524159f935de5bbefb96c599c3a161d44cd1fb75130b0e64f15d937c8cbeafb06fba09305c8b8aff882fe69c867fbab65d439bc885d1b4db0149bbb2b0d223abd15baa2a41673b5e5ee7fecb7e77646ee9c0f7999c9dfaf284227bc14d1db3e8eebce2d3be589f71d14ce1441bb5a5a44e3f2b8e549589ac77369f7d5dbf15b42fb8e357120437b4b3cba0e58ba36594b3908eddb846e3491dc2b330d0d259dc4d13f11c27b7c2c41a6b87eb052a07eac35149ee2ec9f220ab7805391035aee0e58d0c445b36aaa1312f6726011f3b4087c59da9f70d6f0cdfb6c031e6dba14ee3f4fae311d341af11e8ad260b44d3c0829fa7cb1109ffb6b7642160f438ce04bdab3d959dcabb2418cbb61b76d68d44602709a8e3e375d0150a16d3f49dca44e17ee5ee42c6dd2883b2c1db985d9571d1efe6cd838f0e6c6d6694abc30d1a3ec7db89bc063606c5249ab8537eb27b0f5d36768aec635ac4c9566c0c2c3b3f9eedc14"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 415; + dataLen = 4096; + combinedKey = "114ab485de4ca638ec8f13c267fbb44fc15eae1476c956253ed453271fc9d137"; + iv = "f067b8e98e03462432dc177cf6fabdd4"; + plainText = "28b90e27a189f3f13235c99010b8af2a24d0b79de895a5d8692f34b6a77ec101f0c6bbcb98cad87e98832a96938f4c5fdc5975f0aa4fcd2f28e397bea542b61ffeb5800d791919616108b1a9a0aefb419e091c788334ede7eee0dc3b79343058d40ae2c649fca91e40316daa6c0094a578eb82d2c3683fb53500ae6d2515392ef445eb37c3766240a859e18d218e81332b33e60d715b0ca42b201d589ae7398e792547a02c3f80b6f36ef719ec335d1b88edcdc0ffdd804e218ce3c2d80b28625079e130606d85a915d4cf1a34457883b7e689717b58ee89da4e445cd6575f76313d682243799695e280b9b6c4aa8f22b99e2b6b8efe83f7e7c0a49e4c21df15cf4fc2cffe06e1c06c5bf45880dec25d1a224696a6701fbeb292b2fbc708d96893536b358bef2e95cafdc5fc0aaa542efdf342122ba6f1266e3e13fee99dbe1c12c9a5aff5fea83b831e98fd6e49be1af26cae1e8d0a430d6ffaa42305590fcc97474010f7d21a9242e5e8f09bc786414dcfcf129114b058455016b74609bcc659a275337b73c582dea9bdeff7b44e7734b68921dcdc7b0a2c84686d0c42f6997240dcd31fd4e86d82d1e8f01e5625636fccdf5ce5f0106d1d088905444ca27602462adfc346079acd75c2d13b4f1db110dfdbd3a8c55641c13545dcf697935d331962eecf841522428f597c4826929b7bc2efe66b9bbcfca382fa0d745970d9"; + cipherText = "5f5e4dfd96a96e4aaf4c471ac68879bbc709af5c3ab88dea06387630b839ed6c7d068d1529dce9e8ab324c7a021378dd487162968fc4a1470b0394ebae5b870d1e4bb948c1167c4b9a11265baeff6c41c9fcb7b3e8e9c8eb62e1462a2d75d763ddaa4a06dce09ace871a76d25cee177cfda179e2953a2f236e28c502ed015ba1db6fd4fd1d7a2b53ccee511da1e1428249a40cfd591d4863057bbd064e58ad927beed072e45ffc53410e0a663151e4c6253aa2fcd54413aa5d9e956c1ff1e5856c487e53b908f63e2eb1e391f702253441a162db0da7794dc4060e657426acd08d06ad75190652ae5be2601b690986839c2a76b5c4f2b865b2100f918a254e74ac7332452727ad2310ce21e0dcde3775e92628c4e30bcb82e2d4f4a07a40b202f3e4a09003a178680f9c21de139a04b8c5f941cc89c60cce7fa91d5185e7ff8b3b6dc18a1d44b166cbffdc1bcf0ecee9009133aa93319628d3665b95648a3cb98601184f00c06b6efd3fde3b12271664e61f61c2c81173eb092824f679d62934d5b905f42773f7fcd04deb397cf7ab86c396f2bd6b508886927bcc31cdd9fa1c1eda2733540d65d48d16f500c25ad25c7cd75dddc1a98cdbc6eae24e1beb0d37264849db7a1b8cc26b8d4b5e6bd0e04d3f8484133b49e1764b66b083d4c532d8d5b3c190f359b34da04112a948e757e9fe191ddefbe8c5ff925e8863fa0808d8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 416; + dataLen = 4096; + combinedKey = "b8439084c248409b1c92689cde226dcc0f32500901371fe41271aec837adc644"; + iv = "2a84edb77b63268d8cf846c91613db64"; + plainText = "9cf200dfd2b5ac261e63db228b2c54513d68e28c88e4189bd0fe1175bd3341d646a0c7da12d0e5dda7a03ca4e0a3f4f3dc32983129a6ffc0270c7e07bd29b7476a213a9035315116e87410537586fdd1101d7ee58da7075518f7e84604e768cbe67dab4d9d5bbd67951119d7c8cd6d73eb185c296aa38ab63b10faeb234bc63c9581dc798a71cf4418af5d9da92cdf8065950fc3a530c4b9a21707b37af1f12cb0508853ff8fd127f79895b067161342041d1736192d7506505172e32eb5c9292db337a23fe60c462db603b0189be821716721ba22f1c29a029d9b060dbc8a8d82738491ab9beef4085359c16c83f46cd08503f767a3c872cc948512e56d36fa2a2f9a59c31dc129a50ac938cf1e3e056368024567f852fc4bc8ea3f89c269ea1af2947ea7814bbf9e5e51c39e5e07c726e02baf0d857c847ce67012bd0568613dbfee3649bd47fccdc1b4a425da749e6a7e8b3b65f4ee6869d859b56952b48fe2f35d7cd681ac44f8dda2dbada9a6415fcfc97bf3e47edf6d57715824a2525be6dd2db87c7a2956e99b9b7523237dc6d1b22a43e0d1e0d34a635e335a8104651a9efbc74f94b6bf05ec80b3df44d5bbf6c5191ab4fd866de56654419455e7cb0eaf3d4566898b4db3af1e6c8deff96c552a3767e0b1e5abc82eecb8fbb824199cbb495ad14d6b6426d9b9ae3873498234e9d179da988d66da73ab5e87276625"; + cipherText = "ae467cfde97e40e540a21b46cf7c35f0d66d3d9d054dbfd5bfe9ec8e41a85c4f0e64f3a1e17bfc8981123d124ddc631faeaff9273448524123c601875da896c77ddedee8bc592f9f10320db271ab9914b21b8c3839cd8988d02a1e5191a47eae2551915c9050477b0973be8be27775ad773897c098ff3cb345cd72299adae6edc03fd9b52fa755aa0a09e6d251a59931a498e1be3b71c4f0395d250d4ef70cf7dd2e525736407579d6893c614e9f37eda1fc3dd67edb5fd949f885a168d68ded6e8421bea32bb10ec28b703b9041762bb6f81b63d6bc2d8111445b36f436d6f2138e244a1b304ac2ebf16196c09a275d298aae7313109a96372d4184bd8463419aba369e0644913099391b4ef4157c8954ed94b0b88552fe600d396f0f9a0e937038f4b45a0692f52957160e80f96ee7935901e8dbe32fd1d0c239c95d21f8b445e150d802d3518c88767e342a365a7c874d7afdbf4dbc5add15bf572e45448716eae763b904a9c44f5f1605e6078d40aed4dc9d23acb301627d2cbf8663ab84a81f4eaa86d7b4474a41410fbecdf83d72ad6b97fdf7e114fdc9ad603ec20d8769e5c31ed754725aae46d56e76d1406e575a792a7d8dca732b9b1106cb33166607e3d8fe8f13bc3de972ac5c0ed1fb11e567a853f26ec77f63d6df6a050c35542484c28934836d906c84663e94d2a451482b2d9ff41affcee9b270919f03ec84"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 417; + dataLen = 4096; + combinedKey = "be3ca6a47c962518bb21d7e67f259fb278383eeb5d44b036e30794c3dcd2715f"; + iv = "05369aeb46ba48bd01a6ea7a4f5e6264"; + plainText = "c806120710b6434a55c593f5a11181ebe3e62983a4e41c6086e9db5bfdffda73b87af990357882bd8252ca55f44ed66835a2eeab7a9b9049a26646c323cfcb76a42075e585e609ba686628091ebde317252248a5264f5ad5d79930694b14f392a3cfed48a64a17e8cfb6905e168942060ae4520df582318fd1a3874a7fa3e5e7475088e752fb0a48bfbbbc4be9e2e9e332e2fa85df945481fa5991aaf389b51ef8566c29c9ca71c3a5dac261013c22adbf9462684c4539728e0615fd6cd64c167d47a20d299bbe8e23d0eb92ccc447f613c7794afa0f7942b18f3cdea193bc6245ebc7fc00560cbb8672a685f23511ba50c60931411eda0f3a6ec243d6bc7d8ad515008b206a33cadf6b69259cf1b3a174ce63c46297d3950830c696aac8fb11041638263249a6470350175a40f3a054581221fe9d87dfdc8ca24843f692955f0356640bf02aa7e7bd3a6a9e5b485ac25e9117dbe8da336ebf5e83efcbbcd20f96011f99989ee1d31779b72b18d3a203123024e291eb3379c73052c7ef1e1230bcd2a2d02e26dc2b6137bf5f92115f0eaa3c22128342a9779da36c9e67007479f01e5539748a8fd45a3825832b3a38030b7f2f3b099d1a1458d54035629981ffc161ab8f7a89859105c9ad561a2111bc42d430b4f418bce9c938b72e7dde1eee29c238400cb0dd3a52eb8ac175bf764374f125706c43eef80170d2fbe245da29"; + cipherText = "e18b69d617868a66fa54b624cf5f4ca9e9698890c5015dc3a489af6a482d9f3fa25ae2cd2fecd871ad84bc0b7f146a7e831e3567fbba17412c52e99e523192ce5a88f63bd479586c43c8d15efd96034bb83b10be7d1f41b59aac11a7d02c64aa358773a73963604646eac401fefe0c1eb009497589df01dc619da800ec56ed56015baf5a30240c8c0168e7d6464d2f25b9aa2d84a87c3d538f173e5113874345b3239a5ff78f3955791a0721812123b9d0c883ac3f6f0069384e43269b3c7bed07c91445d2852ce9957608c6a7e42f92bac993fcd87d73e1a8691287dc4e64d746800984b0e76eb0997290d1c9e4cfddb43531b56301ca88deb03c82d2b9df71d1f57f7a74142c5f818ada5f00a0f556cafcf12d40a6ee0b47d8c9474ab7457fb16960d874e73497e91977d7ecb9558ea079416d6af4e178b77c2dab4390e0ecaefc98bb783857086436e1ab394ec24333fce7eb771a180f532b638ea7fea8ccfa47cce11ce3adbba1894f695d339b946df7f87948b1c10f06ab85e6dba1df897665419cbfc7effdbc1aee51d4a7b554211b3d852feac2cfdc8a6f43c0433799b8c80ab94c7dd1e559f164e96b845accf46aa8984fa5ba64ac11293a22407dd2b4041a8b182dd6a39f8c7221f41c1d4d7789d7b2e386feea7c4c498cb083fbf08c0b0a92aaa15d921379790429bccab5beded9836f1b18980300a808da61211d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 418; + dataLen = 4096; + combinedKey = "58f12c5b13f854c7674682eb19b78c3da8dbe330c9175eec244cdc4cff8f9313"; + iv = "1d854ab2593cf694efcbf9e9fd5fda33"; + plainText = "9174285bcd5e7c992cf35b2cac68869ac1c0d70286defaee54cd69ef13946cdd7cb65fe365bd1833ff3b80ec1db8f084f9a0fdc6a55d1c54eac54c0028187c4657659dd1d7bd2fc8ca408342a1a957a709208af3ac611f2d88e3d34930cc510146a1e6da2f38b13a8ad39beae1cb497b3079302956516ecb7cbcb27237ca7e163966211d371ca8c4b42b012d68019d7b967ca11e5ed628d20cb47732d779a0835d8ef251242282066f5a202b7fa577f6244f2f1c9db9afecd5ea8418e2196fd4649255cb09eda2bd499ba88e06d9e08cb1164311b401c8920c3abcf67d1faa253c161bbe1fb89ddee7a630c779e5f4115ee708b7f15086669107576680e6eef88e6ea80b9a24d4eb0ff0cea5de1ddcbd1ac68977eae30c73b19a9d616c2af14fdb13bbe851d848f9ef3af7feb33b26c77e44a8aac3518c3a2ff0402fc05fc928dd1f6e586dcb54309d34dc5c35ff1e12439584a7f66d28032212903138763f9a38d57b1b2d80525fa68936423b11ac520be76f5b4bd41613e8cc9d7364d8cf0d0ff3b9dac1ea43b78fe1d77ceeb622f4516b1b4f216fd0de17b81b4ebd11d26d598a50c97dd5b104e0bba7bf5a312b1293f3379b3cfca4e6bfa9026faf5c66fa4596b38e45c3c783c65460d91ba18ef4b76cb0ab124fa9460f4955039b36fc68841bc82d5391ec13fad72f9e69648f69491bf1b32f73f2a83e86783b2aa507f0"; + cipherText = "8cd1c04e660c7975858cddc35c2e1ddd8b8c6ab84a3813d2f455ca4ac1990dbc52c9309bf020472220ad17a358395b6908b202a9ce489992a1c28b454ff4b69dd3a0271592c9b6f9f2102d0544e2968d507dc5fffa42abf5f6a090183f23f9a8f59daea46b9ca1c36196052a883003305c3873e36920a5178ac32a1885ac6453803907623590c31ed7ef12b10dde9f349415a75b3f5c70d02071e8526e32bc1aeaef34ef74735c7ba64a093d1dd8fe5467a8209157b85a1d09ffc492f638349a66769df233acd1e1247782f8c69ea9da116299525c7c5b4d1472ff43e94b88cf9b1c884a1f75df701dacd2d8b26e6222ad037b5405bd71ff63c51d16d2cc8da825ef49f6b254d2d8d59bf014e063f0103d908db4ac0da281ecbd96f0086ce4375505ca9221b8dfd4645975502caa87eb32be5899466cc5cfb9b1b92041bb46669ed0ce1df8e7fbc9064a70de94849b9f26f72b06a6a6d56786ff5ad2b30da9d90e3254d80a7619f2fade2476baea0e46615f6c155de32968ad91935c504b306dda17f6aa41eb1c8a18a4eb0f5eafa1e207c38f0a1c4366f6a4479fb92c50fa95c6558193e36006496cab04e66e207aba529dde83124826aa8ab4f5059960688b818dce918017372efadea7bff76204aa018fa381cd12874466e090dedc6d512331524e79a5de169e69523e265dc60f97d9d459106e21c220079dd67efb22b84b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 419; + dataLen = 4096; + combinedKey = "0ec04bb4d95f3827649c1f4704129aef136f7aa5e2cf719f88f93837feaf6b72"; + iv = "938e4f89c4654ec700cdbe5dcc6ff21c"; + plainText = "ebe3522bf0b8167fa4e7f2677c6c589d023f7c83e7d783be72c50bb36f7370dbd925f24ed484e1c5933acd2b07d6520930c4539a893f7f41a7ebe09b09e8b6e45ce0365640c36fb39b824ccf461c714d489181086631a84ba5a60c6dbfeafab1d14e4bb252554d3c6524dc149c1aa875afdf493042080675e3a23b0deff6286bafe3e83eda823ae8aebb35385e43d5aaa0bd73147b29892115b4daaa7069d8c5c4d0c29edef15402a7ad926e15680d52ab016de8db6601ecd1988e640cf35ce4491d6510e058954bbfbbb47d2c64880ab46b1f29be777f3dd897d4c852d3dc4454113cd777afc60dea1a2d4576c5a7f37a2abf63eb5dd3b4d8d34354f56b959e1fb5a6ce8f4c775acc37df7cd08e8d48f79e5c68245ae4944b934c942eea44bcf1d65d5575200f092c7029af2c907d2279bf1063a56206e5e1ff5da915a97879232ff37b5af5de70c0ae3bcbfcddace51ebe4a5216e459b696609998190a55b0387bd0076aa2802f88e474cbd85d5a444585deddf8703ba7c42ade353ac5184248055a57bea52e6d5f36de27be4952021de59452097ad8aef4bc2d19fd81dc7ac5841e29cf6a21e49f4d7b192ea5e98a6a4e754082c41d6b3eb07c99b05a68fd4711d472ac83f0be496f4e529330070ec334ca6cb3fb791e8c0a63bd5dc81140f28718d78ef037fd3ce41417564dfe9edde86163b508e4ea1c8834ca296407e4"; + cipherText = "1a16d2c7d802a7603c8879165233bac322f17e0a5d4ef516dcd13c348414db5b2bf92317760c598d63ad34e90ec2eb935ddad3e769ca15d925607aa2a2779b4dc8b1a1fc4a2ce801dfc0551a18d5c73fbde44a1996ecf088b1ade31fe64333778bc847ef383fb3689f941f300667c17032018626015f8ef498d2ab1144e6eac2f5ab9eea27d2bcbc22a84c5483d4c45dadd6c3e856bd4674a4fb06a79170de345f4c7cc4e2d5f5302cad2ec04ecd169e593ce93862d784e4a5cddadefdc078b87a50bcb73f83bb6d4bf610d4b692d6ae3510baa96536725b7fb73b281331c4a272983d1ec6bb54b7e3cdab2b7a6c90d56d500f279729c1c985f26606f8f97a34d8d2dd3e11e1cd8c6525f954a8b9d45534f0703eb2750a4aa137d8f7566549c3501f919ce8bb493446183e08abda8967da5429e795d3b8120c2332738fdd714e9af056003e4f3c6c8efef8acf2a4513920e056f7ed60528709444af7c3211089a4e1477a12aca0d5176a336cc50d87621dd72bcbbe8ec8c53c5c7344466efa652c0e85c1ae7018084a74ed9578f257f4d5d455c9a76697f7b061f99f7f7905ac6ed93755681bf43474e92f50bf0cf7f58eae3e0959a125368b7be1789ea630f4f781c7168564fc408c4f07b468c60fedb3eabb2d8e71651bf7e002c8a68c9a167d2e0a2c1fd9e39f31bdc5134c3ad83a22ddbd5830058ccf090fc511552aecb0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 420; + dataLen = 4096; + combinedKey = "75b04f2df5e54ed67f98b7c16be0310b379cf230a0e7e0e4e4a2b05a992bf4e8"; + iv = "5ec3ac82be25f05d80c60c6599eaa109"; + plainText = "b65f622f14bf6cafe65cc3cdd055466e26ef07ec74c1e96a51e668e72e1db664ee5b96994906923e1bcd37ece3a9687cca58c2d2492d77b2d4915d8404e9526b4d143dbf68a8bea9a8b5509808763ef2d8edb664f303111dfa5ababd62e8359a0b959e91d64db17feea6e2e321108e5f1bf5249726eeab7e567c7087e225b8175d49ee694bd3d18bfe3f807bf7131f855d5d8c5cc1c7b67cdb30825a57a5e340f6a9052c646c79a47526b06a59bf7b51bf6ff470205bdfd41eacaa5c1d25bf08d695c66643223edfdd53023233a9e391dbeeb391fc99a949c3c96b99cacf871cdb8017bdf806dbfa43744737c097f6f233d21d5d7b1c181c26b9d87735b40b3925e48462f79b9dbf5fc342b3ab698635f1fff82845a724b71df4777b19d2022cb06694acb0636da938205ab18d176dd28d8a7f33451f66155e30f55367d23c517f6a280de9a3fabc6c2507b40c2cd6b44e7d935f7cd49e7b3631bc2c1a0a2a7f6ea7d3dda91545b5af04b46daec723459050fc8ae5506d15287aac7677e186409dbc853e0da9af4fe727fb8b1c3af2afbc716b2777de379e2b3908e3bf457a90d47639e2306d2918b1676068178849ae1bf959b383f01017af6a89b3449ec54164f7578db861d5a5faaa3f05c88aa60af40f68194aaaa9e118b0af92d8a158765649812271bd11b54129b7cca6f37d67af3acacbeb85688e8c1298db37fa0105"; + cipherText = "1e409941c9622f0ec67e9f3d91670bf1c194fcb8e3d6435000307aa1e9607459442883f00a92162f97a3b3e6ef9dc5603eaeb6bd5b62623c318aa0187bc67c66222f14c77f6afdd732414e559748c67fd28eacf155cfb06a942bc0bf5dd28aeeaedf94070ef5e3beeb1de505700c210e7fdce1c1630f30ec01d4669934c808595f14dfc692fb900bf5072587c3e4fc8408bbeed540ba4f3ebd484d81b6520469abc7dafadbfc109f2354159d4a1ac6ec42c2e2825a3f7d4a3389f76c7050207b46f5a22f9a44710c45368fdb45d361bebb558a0e57ba0eda130f2c4943e064f69109b74c6de95f09331a81d66b3fd94dd66f89e23d548a0767e3b873dbcf265f1e4bc12080a75831c116240bc0d13ce5c0692a6e86e2051031271db3d4f9d422dcb03f1c678b95ce3b61914947d7ff279fc59e491a1d8e215cb72c6d0bfbab8edfd2ab5d822fdac84bc84fe4f620c85d26381e0b23bbf8bfa70875bf8c99cc00b782892eb329ffe1463812b6ee40553ffb2068be7423e45f58d9a53bb5a3457f098b10070f4a76edcf4e2dfe49aa00fb88de609c9fcb3fc16ca8d901430d3b5d0b24405b1e4b22640e924deb97c1e8805ff7c5c65e2cf98d9d052d11c77bad651de7ff7212778ac54e3c9f1688c15531c79e59bfd421270d031a5a336fe5e199633c1365310ce0f631c60359a3cefb1a24686cc409f2a911df7c97bb63f0dfea"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 421; + dataLen = 4096; + combinedKey = "e57c19c6d08a5e39ea71c0003db5ad72d79c7762415d0b71c2cef4bc458ddd2f"; + iv = "22208821eea8cde91fb47ac7f9f49348"; + plainText = "fc197329bd3265a73c5d8f97c0dd90308998186e95ccb7e85c0b40611a5a13c1cb5c1875d94c379739b26e312730beeeeb26e1fbc75cda3eeb1d02f29289044798be2ac0222be37ef4dd41fbfdb83705c6766759b17993e5b1177497fca71380bbbbdb125f8ca23ac3959d970fca7d16074c25bc516dd6808119a26dfe21551c4715769c7144598d4545e072cec194c52d81ffac219facc30f9445f067998e2febe911fc3b738ad5a94f56855781e8cd02e562ec3ca24f92aa6a4d03f1ef6532cb4f1a918e7e953206d58063924f0edf69bb2a2fb7d5e686bdea5e1f24df26ce2fd0c3bdc1cc91765f04e07c65f7e11fb62c05034be64379ec474ed20f39945e2ec34d6d51c7daa172015144128026a433004ff0c587ae8ee13c961d417716a6f2e2c6e1660331be986155038c284963f3f8ac9b08ccb037eba2bae46f7c514248ee7a5f07c7aac17a5f8ff4472668cc7ad0bd20af43f81a3d8b8d11a837b3512c29bb268b482e76b1f6142911274141dda000f16282964fae7a5f4c078fe1adbeb9153c465e7dc54b5030b0eeb675ab7822c295b198cf29da3799ffa52a397239c32880bd2234115af69fe85e71c458d6d9b8cc807e1026f73eff585fdb14c3980c9af939e442086c89b7f25dd07d112226d241d1c9f9379044349ee5a9154fa3f26fdd2b2348f4cc2a30f46d06429d918eb1e54a97354f6fcdd621221797cf"; + cipherText = "b5816b2f8312287676fe43d6c1fdd656fbc9383df2833c2d657552a9aa33c36a8a646d5ed6d2f414c42ef18674320492044a364e4b524b052172f83d3f97e5c4c563540bd1bbd212e9ca2fd84a47177b51f9a486e4a2462e48a0ae022aba3a3d5d601f498407ab5ebb625171870925814befbb935ce91f6c5bfb0c9ae0e6a5f46436448e96a0aca33d698553b17fa2b7dfb281a98136e0590286cc843ef2c13d56b359c4177f413cb8322d51d7dc0b6613f02a8a0e9809e26256a82489a1ec1386b281928af657368120ae7cde8cb8f4c52277c1bfabc57fe59a6f975d6f068796323a0d6851749dbfcb43e81c37f53be1668a86f8964e342dcf9219b57c9d87687c89c88e4455c55c16f2e2922e5e54b9f037c06d4ccd3fac10cf00b367785e1ae719d692e43b76a988ce95759a2a4c421a30aa816d6431938ea8e5139d43701eb3bb56bee06638e2e5dc4ae03a009cd298d2105cb8f5b6c68978062708e9c50bd8a8c1501323b5c5c7f7da6af56e5b47d155e77e1c3615da09aaf4668b06c06011ced4a0c239c0742c214367e54622b68e879e15b0927f5918535a789e07d29a1f038f56881dd6d02c5b16b9af898efec81cbcebd7cf61fc4344ebd64d3de4cfd1792d7a6e827961efedbdea5bf1924964ddeeca8b5b976e2455c7d1701e0b7cae12b9c82c77c49ff3032985140238d5586dee170dd9b556274142eec669c8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 422; + dataLen = 4096; + combinedKey = "8328e53caa5c13739f319dcfa80b88f66bff215f49e1501db317ee29e8f23dd2"; + iv = "34bcdc96cd2a76026e918d749bab04ac"; + plainText = "736cd778f421c9361dc3be55b290b645e4f31f48766c53e6b7c004c9f1f2c74c4e91671cc5cf8959c46e1bee2b8e4389641b9c82fd4e4a4d0a3ccb8d4dd000cc155f571ca627934104387539c4eb3ff33c8b3975601511117f66a6cf3006d3c0ed97d0864a885ff49f39d008f9f507fb1c984319f437cfd564b71da01c7d6df9386f28aa1b23baaa616eb1172b0638938d6658848557a330f8eb0ea852c8448efda483a67c4c5409c3cd2a17a9fa5d8ed9b9424806b41406351ba5b1e6c7eb0b44e8ab984b15ac3fc3bd15b6afd12a787687a79e33800581212231fba640272b349ffdc4c3d7b8c52684eaa30421a443b44b61d05bfee6bd89741caedbe00aff03283c265d6c4ac938fd7b521016e95039ca23c599e0a1bfe5b5a219eb1b2aab9f5cdb7c8f47cb082b516fdf19babeafc7131e53c59bb1af832b8a42e4b0c478365babab50e68122e1d21204a9265bec5da3f3d332017fc424814dea4a86c0d2557cd935f72d14bd6089e5825b48647ba3aae4a10eda09aa48be2dffd969fb14c651126aa02c7753650f967de21681d9b978fafeb1cfa6d2d918a83c1f31e20ed34a3b0a977490d0dffd326fb0a03bd51f97c22701181dd221e389b62708884a83fea01d7da3307eb0f98719711defa5995c93174df0700996052311a0ab829463bfdc1611838df75b7eda7b43816e09abb3e1e113ff95e4997a46e4e988ab10"; + cipherText = "66a4b42d1bfa63bfe4d47f29d306f84028934597952162b605167bfa11db5c57f61e45cd8c8b668cf00a1696bfcb468f3695bb08e758550f3d879880cc0da975daa5247febc2df87557db7b8b33e20974eb3e305504d66001b3fe52dcc606aac98faf064c5cda5d35b2b5f518131fbc2b0a88009658aaa145efaaa823141644ecf75744ec27bcff848f637ab1db89c6afbb9b931c0cf34e2bdf9f729ad49de1a9f27b11af2e5880c5ed6ded9dcf5dd1cf7f84d1d87c4b95e2eb0f9745166b97930174e9c1e3a1ecd5833cfce91075f13e011eb1be479ca8bd483371804bbd1cd02b600b630ba17e9fb81534c331ce068535d19532505cee60fbc5a6f43f858c7786fc82984a8b0816809503eab565f01b130ee9b97001c0287855c6428ef90f95d50c17ac73a75c5adbf80a26e99c62c7f1f321b8d8428ea9718b15edbf87e977a776c150ba3b96833115c076eef711798387c903a09e66082bc6b0db6f9706b591b1f49733239e6fcff53d7cfe525660123b9e2deb6b310ca435c3b7cd1437243c30eef1b4bcec2db6fb7c1e215d15f5d943c3bbe89e6409bc97038b59bcc4fda37058957b2cd08ea85c30c356adb5b6f7f562f77dddd7d735a3efc49c02f6d7af58bebfbd8dee9099cbbc0eebe5b8737deacbc3f93c33ca94bfd95d22ee1815733258389145ad1302d62ea886fb58ba5e05c2c9603e7d8a1cae0da8e9ee16e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 423; + dataLen = 4096; + combinedKey = "b160edb2e926099ad6baab267ee617b53986619100306f9612d4c5f00221c47a"; + iv = "8e3882d7da171f856165dcd66f9aaabb"; + plainText = "1391f31350cc345e8282f62a8d67e56e3c072931c81f4c22df281c5844435c2d8561af808435f9a5a4122f57e01327b8fc327120a279c084643724dd3dd49da7b20e5b0ecc650d1a6308e677894d0bc3d6a25bbf62cd98543d6d5fb96995b2c54eca558077381f64b9076bef5839ef83ce235fdc8d794220cb730213da9b946d395b2c1aefd5c31bbe79bfc9527c2583b2c689511a0e9b32e8c604cd116455af443e0d7ad2d9a4b2c2741e8b43c19f62b6fcd5188ed8872f460b70f5a55464d4afb216c1ac54882c05cc37848fb15cdd296c206b4e337c21e3b56b479ff27b2b410771faae995741f3982e2c205211f22d67c023c569beae700c65bd4cb040cfa68c1f1377429396e30165af614e13c0474f1b1f29a5959d0753567b6d7f0cfa9c6bb58890803859c754567487d653e19da9a3bc252efab879b0446033d17cb68484760fe890f6ebdef1adfef514a48b8a78e17eaa9e184e8fea9a3c26275ddf689a4171c4811ab36eee1815dc9cf17233ee8ba1db784d67e2405475d10ca5c18fe9edcad329e2890c239980c82ffbc1a81adeec660c8b14de34914a2970804d20ba0d21b8af110e390402bc69efb458fb1b0099990419994ebc3460c55a54999e6f16288fd6b47f1aceed5c930628e2999855b670a97f8c2ab39e562f96b408392a92f4007010fa0d56d6e1611745e87ab911ca10dbd5c6a61fd77461847040"; + cipherText = "7fb7aee347c6eaae17cf623c3f8d61eb3a7dc5c01137cd7af2f4a8f49d0f930948cbd6e8e725725c61aba499af1eec5662ac8d6cb398764eb8d15dc624edecee2899ad5cf6451567a9c1f8db13d7f8c3c6192f8915f1fc74afcf30e5180b0f3217957d23907a264ce365df468f4fba5e179d93adb7269d49501bcc7908c20bc813827a03056b80d8f501cfc2aded145c8a9e8f0d818d46c6c7feb0f7b071ab9cc361af97f6e1ffb1e82e3db68dc4c18d854d3cb7fabe87c0635357961d8d3db7f43dac484ef8741dc7d1c0947e30b569ea2dde73d7cc6e1be3f98509c0319a9da61dea006f0fea26dcaab57e0dcf5255e9f819589615e9d6733451067b9cbb248c9d5bc1fbc1504888f3399de85f11702ef281eb925746bb93a6bb0052e2ae7c044631998c35b491d416ec8d181f687e9aea755f0ae6589447f5aaabad9c2511471f1e4df2fb14901c7c0a18a44657e96b16bc3106d253a6412248c89fa0305a372a4a773be8e29750fb2e3070950c75e2cabeff7498e670b5d63146a90b61e7b3b4123d0aaf4689237f7abba36767d3c1c004f477c9b700d3fe227f41a42c561af0b5ed4df49a558a13be870b43c347f4fe45e90cf9368c69027aa60bafae385610214d0210d9395ec6d03440136dfb077d16bbdbc4c93a267f500d8f049c3886d4a4e549597dbedd68990db3b2bdef722f17bc9af14548cfb52384417b8bd9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 424; + dataLen = 4096; + combinedKey = "6451341f4cc584eaaaf013d39cfcfc71ab1126ad473cb2d2ba563412c6428912"; + iv = "1732c8e006aa61fc28d0ac4365ecd56b"; + plainText = "5abfcf609cea362c71056e2721757706c64d962301735b5a19d89ed14c389135db17b251704567b3d9fd9a3e1590dbca28cad2b0338af1fb08b518323934f801328389a563b14150b2c81f17c6adb907f7649dab907e65750bbe2e0876ab26a36739beb8bd53963e621bf63c33e762b19190e77d04dc34b1a3e62a5fe5bf9c1ec976225bb37fdcce9d4a5d8e5340e1307fc67bdd8b9ee51e9279860f6756c4e3758dfbba314ffa576a08e7f48843ff729f12dafd1331f5bb74d94f6810aa2f663b14f704e6dc8cb9067d6202bb16f160f4e52c4d766fc09533888957922479709efb4fe24f67848880bb28e31d0560d08f32455738f6f159dccb829827172ba8f75540694610f0ab06b54e1e3713917ebcfc8b6dd3c03ae8f467c2bd15cd377e66ba58992ca6e8d280efb592e27275a86643a92b9150c52a590a98c58315b88d26dd9c06870fae77e9d77b603f57748d5b9ba0ce77d809292d4f779b42729fef5c73e863e21c033bb5e1a6967dc6f127a44a79a86747e01dd29f89cb903e464dc55076831ef321e488632964c25f718673aca900eb5ae819f01bf3ed7d8922b11dee0a711697289bfb58833c0591d653c32bb761f6ef7d17761412a27adafdc153a555c9df4414e35e2c981c7eae3eedc082441f17f66af2280c7bdb5020452eb8fa9a5384908241ddf1133e69758275f4d77885a98726d6950733eba768156c"; + cipherText = "122d0a666d02661ba8fdac82d00a10f41b9f90e6768121040e745173aa4b8942f948af263bc39d0651b3d8b5fde62bd2e821c2912128f508f830973dad702c97f131930245be1410574fe67b7581fb6bbda50e7a4136a135b1a585c15a1be3dd16d8042422ab790c675efadba0eeb30749040c20269354dd7d8cf161d3ec4cd598be6216ae6d51b87c4c4ccb8f3255ea4630d9ed8ceac45373be540e11692410231214cc99390260aa5ce8f8978b6ec5df3420ae792be2cbe87888f44f3e9ca0f0ade5221bd8f997b6f7aa16fa6bc95c322925eadf1b7a0f33e82a1c6e469475de9d5a0a22f40e5d05b1603ead0c34b0e1236fd07a491292715ccc05f308d43253215f7c2fa696eab2cf00fc5b7184d4477e9cd34ec4cd1e3dc413499c2428064e71071b8ea6bfa6a4b6a3ac485824539b2297ac6f99dbb3eb94c37e84e553153ed6f8583a155f93b8b716dcc8ff0ec39c6932caf3fd754f0aad5ede346caf5c20990bd69c63c6fb72d18a64d941397e47023e27796f57f6dc068f1f68cfe4130c5b6f4e22726b1e6887b7c4dd7266a15fccd7bc9bc1ba519bfc94e00c774f3799ab81edd6dda124c428ed90b5deadf4c32e3769ebd960acd3bc0eef538da8f0bfbf07b98245a3095634b2cf9b3a229833a45b2dc7654c3ebfc7982163a3b11e98fafa0d3c4f4ec6ad1acf03764be738c3237075c01d0846d3f37f5d77a91fef"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 425; + dataLen = 4096; + combinedKey = "a45578a830acde5af10dfde30ee26f48a90fbc3a664a3b38bd609ce9907215cd"; + iv = "e29f0044fcdedeeba4e363391d0f3411"; + plainText = "1c7533d2a29e970210ff0fe19f53c5ee1c886e7fd3d57673ff48ecf80a51bc12343881af8c36abcef1c4d9e17b8b9b9e9612a192ca80d282b4dc7c011895c68de1d55585c8a89692ae1245602ebaebfa08bf48f32a04deac039dd12a936562edd023ec620a7b8995bde3dad7017af91e95bc56d75a326677deb974489d973231e14b171f72741faf0e0d81f0d4401b3115a212074e81ed4f2d23ca28f441120a0ba722949cad6ff217d70946069678e0d9d95963eaec1fbb6f6ed73e9e4a5769d1b582eea067ca5e1477ed2387df393abe1b21b50c0c16b5c2d2cae817a403571d609bd9ff3b9f27526032699ef153eed55657a867552ab2fe3bf9647b6decc17d19bc177c8cfd1704aa4a46ea3a86abd761e809cd549091b4d076b90c77ab17caeff124c7b3f0b8d1a46abc08a3b71269a469553413af71648f721fe9a8d7ab71e9954a6f020f7741029b7eba962083e67ea9fb08a1f94bb3153591836f6f8b97d1572c046f8152fae78707b92313c53f7dc1250baffee716487d41e6b7058af6e37b619eb445fb305b181da3eedc432732730cb5b6abe3093a69dfeb8a34e35203d815ad751adf27f3f0cf44213e1b263bd46dd6544cfc08c98457a317541dfad23ca0765f31f341c65ad12877d961258c91e6b98d081af8c8328afe8ada99daff14748f514363dc4f8c09693abec8914ca62613ad9b6efe0f98351228ffed"; + cipherText = "bd927fb1bc46b8daa2fe17e25243e3da4388662e849793c6c26a9cced21c94d2d25aca596766267719645c3a1012fa45070d9e3848b5507eb8fb7d640793eeb8f4dd2239b65f71e912f4718af3f67aea81905aa9b46e311bb0169df163598a0eed27e16295c584d7806a1f72dce818ea433272f52a11eda30410c99da24df1fcae9755d174c614e20a965a961282ce77a804c4c0db2ee136eb2138e39ac66b2101bdde02c936affe026e8fde1f153d1b7f905be1132f53832313a816644091b16fe569dd02377fdbe54b444d2afaf2a3e7764c00d61f822cda6f117819bbfafdc6a8a8c77aa3ed94e59da59b6994ed99a70fb5015504044d8c83a221a69884ee38d7e585dc487fa4ca64610f215c3459793dcc302eba9a41a9bfcdcca2da586fc353270fe7db134ef73bdd58cb84337d961c75fb7b98f9e0035ba231b3a57def6d16ceac64dca44689f511a5324b89ed9d2455d40889ada30ea3180b5de4276aec0c0f7c61a475f40eb7e582063dd1d285463d005511c1ee3d259e543bb7b7395437d202de1ea745abd38d3a0bd7fc7cd80bd68744ac0be621dcdba84cd5d08c089b3107b86b8a64e686c90bd8c2d885dbdd94d72516177dd7ebeca2f1e0321c67aa28d855cc6883f833b1f525253aa212a4d7d080029be98d0397a32039bcf48babca271d0bb7cbad6d6f9524863925e2cb5ea66cadfce300156f3e0148dc45"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 426; + dataLen = 4096; + combinedKey = "7c22e1b5e33ca660bc2c834c8b65d83b802cadc4aceaf23c70dd9a880a1ae171"; + iv = "0048299d5e93bbddc4c415a6f3546f31"; + plainText = "f4bf2dade50b15d84149197077f68b9d94e2bda4e02f84e6506fb4ad27660851f93e98b6ab19c28677eb361f794ca50c5e2c02338cad9de651306ca96bdbcd972dd3e30d472bcd0b416676f80e1538a4520f7ffd1ba53c3334dd87d8a67638c30eb515a6685e50c4af04dafac045a6af062bbf5980d859506acb7a103c840da2a75b4f9bec003d7e15e56199d522a825e8e25e77a11bef7fdaea942d3dd5e2e61a41eae8d4a7ebfb5f22c2ff66e637d43fc0b0b30fe6b89f57591092c77534c90c7acae28b9a38bb8af547fea1620039a8b3a1c64c3bec21378d9800624a07e72e8b45e7c6a1e43deaaf4b2867bf7ac2fc427369c2c7691ec0e02e8b9d437a349b3647c2e96fd50e30d2255023af69350e79af05688505137e668d5812d9d3aeaa14e869581a518981f4c1d0cfca73c0482fe4b3ca3998b244adae943afcd1511d0b12d0702222c92d1161ea45e1c3161ae24bc76399c9a18cc9be0aef3d159cbba24325db06ae8b76a4ca871b2aa4d94d7c7f2986dcef78c5254ea79b6ca12158916eb63e2bb647fe44d73c133c8e4b99d72441589b40e0d4347d80924e1ed45c4e2790e2adf1022ca4f7fb8e4a09929d925e5cea336707723829b95c62fb9eca6f4e2dddda8ee77c66bd0600bee8ea732984133f6771145545d45bce22bab9a5fecf7983080c6c15dc9dd63c9a25c0fe4c902e9e22234e146a83cd4cbc4b69"; + cipherText = "8c6a9e99223dc7d8e1f06d60341e4451f54ae591ccc7dd037a7459ee0eb7f1c5f71d5e1d084ec6fe9c5bb10191b280451ecceef178829652ac540507b5b407dbce9c95198aa8caeaaaacd678cc968429421c7b21d20a0236e3f31f78d482b5bbca02a4488d1d5be355f78cc1a36c858d61d86483e7867a73866b6db858660a29f3f77349c5396d79038ca7e495b72b4ad53ac8ca0068c48ebe1c9898462b31581e2fc3cfdaf84e83b422c0d7ef60ded451f5cbfddd8b6c8db0c9f7c96cf53266957618c095aea1b620bb531c41147e63092f000a2fdfd8d2b18f614fc7af44cb29eb09215a1ecfa90deeff59f2b2dcbb908ec125e0504c12f352495748842f716932d61bed7c8419593cc2e05c9be41a7083610820af79c5bc1f168eddf830931bf5d8b1aaae2c9f013ca4f6369c8eb4bc251ada4aa63de29621c2ef2c56375bb7e67923db5b0b0377f631c4d379509c49fdb279d826424e7fc91fd2cb0ade42668a6dafbd10ee5e24f374fddecbf042b35f3c76fc6cc7ad284a1e0e0d430d1c712d68897a4503cd74bab63f285a7ea0506d0b3f0e5e6e5efea6d614d831a89b98a7518124c7640ed7ec426b92617e60977d28af9fe32776648277b57b063c0b0b59fc91b79f88d1a4981ea5c34cd3962a142504c5fc68381b0f144f04b04e2c1aaa1ddc7684feab86e9be85d5601432a3d189bfcd82c572854045780d413028"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 427; + dataLen = 4096; + combinedKey = "4a350aa248ba36c6f4b511917681c983057089febc45ae8ba4b0f5a95ac7784d"; + iv = "9347b99f8bb354916aac1afa1c6bcab9"; + plainText = "11fb4b70a775c70e9a44475c7445f8c1e5ea00c08f557daa243bf0d4b69d75b3ae8c8eb23bf211e8f5f56d27257424d2304c417ffdfb1f069aacbde9136a124d44f88450c0e33ecee0d96373c711d4043f322f110bbdf9ad631c6e1c459d7361efb0ca6ef119a63f412807d8fb8873ee4358590a19f95631e192ba8a86150387eb40da4105121cef7a308f3d9bce64a0f085d8260562de6a859c8c69004b9247660c204d2fdb68afead28d8f91debc41d8c3bd5bd90c50d97fb91f3da60bc716ac383b657702c6785e11fd1271f4b214e91ae26f5cdefb0e94caf95910ac0176e5c9b68c42856788990fb5d5dc4f0f1275341405dc2868adde8ae5e6f3ab9b9f06f2d3ce04a301130d15a4091202c38c01fb6cd3dcf489a7beaed908229dc9f41068d1960816893bf8f4c1b43a2b275f51ee307e911227c66e4d4decd80fe3c066bf29461b6521661b7a6116bddd43d3427086b36b17293700e5ba0226e85fc61a30d24832d1d0ce75b4c9a1b77673e548add3fff4e93ee5c313546163757eb43a6698146404316dff06e76254eff8deddd0b4dfaa2f73e073b5f0e5a291a9c36c7a51c1ff77a66037bf5203888e97d16a6bc13150ce1afaeb188dd6dfaa3a41ac921fd5e7399a089bbd2fdc686701a559c73a4cf39c745aed7091020631a00bb1b030cef852a99d40bfd18faf0de2a29ef71c6c078d6995a3ed4cbe027de2c4"; + cipherText = "d69deda0ab7506ead59ff3c57864c16ac7b2b1d3d1231002264691ad39beae4ed795273ef53e6739e9b67942506b97aae043e1468386e9507e183fb658f7f23d2dd48a53873f301bdbc423fc18b84593e649a592c8c283c67b4e79668e4dd49e55a06300aa4c2772a5a5921871b3a5dd6d63ed41ddc6472952d24de56cd5fb4608331bd6c99c4402d93a9540abbe067dccf949e42a1391ff1d1e2dd9acc8769f757bb972eedabf43aa92d59be8f8c4401b9c89938e6320352ba66aafbe2c36d5032b36f3246fa11340c13ac2424b49d8da8384b307bbe748442ff5e7afd30b7a218cba971fd10d019a97c72595eb4a5c0ca0490ad7c72bd185241d15008005fdf187a268edf0973b4323b5f29c28c416b10714cf82eedad9d2805c01552f5d1d395ea4e9adbbcd23f623f380363b6a3f43b940055a16942d7b1c090d68e9c577ebed1437bbd0bb79f49678e073e8ff1dbfd69ed267a4d6ce2bd67281171e6cc74c82218dad8032502f402fb9a5a91da2b6a71dd2081c4758f21d3fa0f4ddb4cdb03655696a9f829340d926851311d215f81b29963802113ceb3315a6054e34a44a048e86f0f4655588636c8c3e3aa8fb56a6287bced2d574692be43b8cb658ea36ea069871bfbeebe03c18a06784d751ee33c82a57c438bb687e6cd471183eb5652eaffe3cf6af829961b245c03ed146aa662874fcba2db651e079095a2b53bc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 428; + dataLen = 4096; + combinedKey = "53f16c985f7dd214827debd92a3ae230001e6238d855ff2bc1327b9c053d553a"; + iv = "54975bd53c5eec2e290a20208b5e7d01"; + plainText = "35f8022c86534036ef659a63adaaa7e723aee2311f6c990679b8500e551f45f0bd14fefc2be28cd936b95ef47a1b4d15cdff64b215a699856952314350c1939d6c8a2c351c2f8bd42bf5624eefc41e076b8b42991410b345c8d95de48b1504eff335c5d804e38e83ec0e714e46eff715c23479e4456e30c1d180923527743e73c34f743368c6ce7175544f3cfef02866992f53da9d3f86d4eddf9e49f6abfff590cc154660b42acbb4f915696aaf4b01714a482bdf68bf881c0b5b44aa8d134e023c7d8a862c200ab1c19bb42bc45f68c9d41c0fb447b0d4f4895ba7bcc71705b25ae68b4be810f1495fcc7e116d737e15cc2cc9312f40eab6ec6e9e6744cf67546bf02aa81834ad42ad075dd352543c2528d39ffdf320d80c91297f7457c972765ece246bc1f305df8ad0eedba32532aba6139c1c5a7d5afdcc93617ea0b2f311f0ececc71e36079972cfe4aeb659a260f9607aad2000233648d363cddda7713296c63c9515d9ab8c5c4c1b29fc4d54233d64419b839c1f39e66e9b78ee523b77a99cc333e11d02b2bd7505d67d5a2c05747597c7e9b5fb64cf431eb4815ba3687ec45b66e1e4042646e2b766a1a5b59e6b1b0c59c2484a4078244373b16f75d99807c4c2bdb096d70f092c307ce3606581e3225d98f73e5bb8570e65956e3b8266d658107af0591963e88d4db23e37ed667a2562c28d31e2e3a73200ae2a4f"; + cipherText = "fa2581ec0c551514da740413a31332a75bf414b3bf59d8bf1b06593a856a8aafdce45e36ffa77b7cbe8a56c3e6dbe5bdba502a29ede89faae621e1667a036857794c82dae098df5be3b897125c46cf6dd04fe5b9fda1e2f6cfdba7f1153d0fbc06bfa788e32fac5f952fa12e29211778d1ed19b221af139cd398b052cf0e67141c9725aab946ea819bbb8475a2103a00f8e82bf14c59083bedebf8741eed8d6c8e97794a19ece8993182ae38cd35391efdba3e255ede9787822d5db9f6ceea24b4df59c5d95c74efd8405176ae1e28125843d27b846e3f39c4f78a76fac314b7eebf2f9630d92ef6897a282daed60a0fbf271c5cb135ebf396a474bbd5aa55b282f6ba3a1767fb2f410fca981357a201de7ef4ff04111a521a63055c6c2dd98d1d319755ec4ce053b27b43daa8a7be867973abc74ad2d48880528ee94222e16e09c18036e40fda22dbfda33a6d15ba418a7563bcb7e2e72bb33b44cbd3863752b46730329debfaeb2f69a4fa7a8c7368013b18463ee964ace927742c480ddd98ff4f8934fca849ed259724db0b6802ded75ed352df867665b65154923dbbb24316b0359dcc9aae990551f4382b4bde04b9006abe447aed6bc50697565e9f66b3fe7d867964cd69d96471c4fe2277399f7a32668a828deeeefd65a87f687fd34c9fd6d97f2a85ce0173db62377895f7dc63ad625dd1aab9a81ee29eb9b05aaa97"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 429; + dataLen = 4096; + combinedKey = "9d844fbf707f0649914a1b9f4344c0c0806d76883f115deeaefd7c3f43c16e82"; + iv = "3b79cfef91b4d2c269606bec579e0df5"; + plainText = "388515a934af34fff3e8e1e58e609b544bae7d5864d21ed36d695f5af64738395d1d73ff48341f8d6d7e880f3636cb77b117e3aa0073bc38ce800f17cb557a9d24906fb6635dc28ceabc4bdf4fe75f8c1e31be70ca2aec17ee1560bb729069f858edf7fbd23c87f9f684fa06bb3a22dd4ad4482f4c1f3e9b1847e370d97a90f5a666a95da134392b93e56ed643a6166a2f70956074e05344e362e8aefbac4d2790c5dceeeb4c2930722fdf7efdf142770fcae8f990d43ab5cfe1f322303acaea06896b7bf453e0c0c3f821e5ca9b74ccaeb37f60f1a3aea4e0c318b6139410593381497bfbda464f200d305d6a7c40d679a556893abfe235a6063d1e2e76c7b61d99672fc47c77d17fc0b3ad2ac9fbd86a6723cadb45b2dda598078648614caa14ff263cc1232493e81c09af5eca55763c1a973e4e9360598fcc9a13835e92e70ec04025b3afdacda324086c1c6c219cbb514b5e5fdd4caee99298178dbffecbb13d5f084104c7a4c5645e554da3738fefd89753c3f2dcc3a9180884054d162e8ec43bafdebc31e94315c364de8a204de323e660451a4690780d48d3aea6e11a3feb044249c8efea79a9d59caf688c0f2a1c2b804d38d246a6883fceb3e63bc5a17fb545ceca8b8ff48cc4b38e7400069af9fa12191142181c7c2d631aee6f97cbc63a1200ccdc60987ad36011ed98c75a04d3feb6e98f5a4f02dbf452cda269"; + cipherText = "3e0ed8e484442d75d2832d809808bc21fcb1240e5fbe62e42ecc8598e31f9f50c18588a065892f83faa923540e6ba24ecad4b1d1fbf12b95c364c0aeb0a238d217f3d4da687e0910f718a7c52a8a7f7a680b8a6cdca2488981a504bd3d0f8b0795ee651ce8a63ac22b8b1e9119207644cf78598afc0920fcd477123817b54dd9e40901191670ca68d662264ac241292df92085f8b733310ea2a732fc5d5d3c4582b3ca8d63809e098d490a520718d05853240c484fbed3ec12a281ea4e4b4312902cdb3b4e368519d2182a5edee7fd9b33e2753483c47346c7e03849b0e0ae3550d090ff67988964eb4c0e7d55158f92c6a96f89bf0e8f1fa408643cc24f6f05a38fb222d6084e5e8ea95f400e89e1b0ae9e9baa1ec8def1eeedb7e661a5c89e3fc0a5005f953b0d3cd94e973f6d7fbef1ecd4dbfa6ef022734d5f56538cb89a89c2ea28edaac6e546cb58ef95ad5bfb58b520607a1ffad7bbecaed62f163db8181ec5fb5422cebde704f8fa87355151f4c2cee7c28025af43ffcd0b6def8ef7dd995eedda063e50e982f2fc1457ce0b2dcd3bce5efee2e46f71cbec6d3e05f58d7cddb767b3351538ed80f5dd604efbb31e32d9aa7d03339e92e96df875b951ee904b01ee9bc0577e0ce393d5075101734f2afc33cd52c57000ccf63d8f478634adb2c05db0983a0e14ecdb68e30079e4de2150a090ac226dc5dafc09e7ec93"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 430; + dataLen = 4096; + combinedKey = "a18d6744d598dd5abc0ccc6f4bdbe9155ac76fa2bbd309d8e939c1ac40346377"; + iv = "58c054fdc3e2a4d51f912d8ea8b6fded"; + plainText = "56a4726a77390bcdfe467240ad0b9185dd25d97f49ed0f8c2c939a9428aae5f1e52075cabce91602ddd5fb372b2d11265dcf50bb243c1bbe2d960a0aad0cb762d7151c4afa8a708c6d4a36ef5d8e9cb29fa6cf30ef5b7b192489c1b9739178c7468b8e50e9f7095d19afd69a6bde8f8e9dfaa2626834b0ce145907ad13364f309d7fd09d8070c21cf4ba214f1798798702af508f9ab6164ee6158a06c9a04b17a01f705ec7b6e3a4a4ef00323dc88d2b2d8152224ac745808f1b283d139d926f59914a1000153ea12c7a52bd6e69253dd24f58b219b3d0f7411cdfc2bc051ce711d49659836788d7c8b911c7266b8d26582311bea44e9abdde020fbf227566de17481b5c0606a7dde12982d6c24e28cf27dc034e80479cde00a4c9552f14596b250fcf29b8673167da24226709d219d3f5d0624279894346eb170a36e674db2fe174bb7dd7b45f2fea242bd202bce9525207059ece9afb1bb390087abe85c111e4f9939dd857e09eda2324333b08ad2833d92273d411019fa2021f0aefcad135c435d5e44c638ed946197b2d78e87fb4823429b2ac0485a6ffd024d191af9a227623f69728227a9e2f6758a25df8b8dabdb36ead58507b9e356a2d55a1f0bb3899efb883f7b0980f131a1c3fa82a96f3c515f905b69ba46e9ded9736fe713cb654ec66b731faeb024530e45663e10eb288887b9dcc8330e53b3459d99ec3fd92"; + cipherText = "bb975061188941dd7496b59d3734379b8ade1c853fe73134510a4750277ad6078163b556402f87423ca49da2b3e4548dc8627c56a55005566777391a33777cf17fce110790ef879d857331a86785a65326180d5445b8b0d4185ff32b6d329bd8cc5a3418510ca4d97bb7f2dd0d4489efab2e6e9bd14fadbb5a5ef4c8a8cd642c77e945952c11db521705c5b184db3688b9d38567f9c6d56d3111a44a9a241bd920ba24f9e9f933fe1b1722b0b4c26be3ef7ba485f8bb5c4c8a584659a8eea225edfe26da0266714406fb89bbfe32b1d7ba8ce7598f1dd94f998c063753b94eb4705c3e0cd731cdc33c508c7d7f1f8248005ca2ed1a7f3c84cf67454699755ffb0b9682bd42bc614b315cd5d66824861c18455bb102f64151bfaf6ee683a7d38d84a62a9222ed4dabf17cae70767eccf24c8f2efee159db01e3c7e551a2225049e19d1131ef33bff8b8ab721f8fd14fc5bdada1f917840dfc901d632cc3962f78bbc134a10c05bf9cf4f4ddd8e521891c0c2e22fe2259e11241fcbc7d0b08a240c3d91c413d2b93bab4d09186721cda45c471a444527d7dbcef80734742c915dac117fa69102fe23fe23047d54b3f16fc92a8734d7611b636d1756b07ec1d3bd20b4e184406819c86cf0a3e7031a5a92fc52ec174723a0b6a28aba15993e50f300a6bc878dae3eeb16df05c89ef3d1f9fb36004c1cdc62b428743b90bb4598772"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 431; + dataLen = 4096; + combinedKey = "373b660406247b674fdc0d7e73c6f605002c45c6054d229f35c45bfd8554d9d3"; + iv = "0c7cbb5a2528bba11ec4f17d7d625e1e"; + plainText = "6be050fe1b5f72a4479daeaa920bbc5066f04c9c5e4c13aa807ea1f05044887021da615ce55155ae56aa9e3aa464b56d7875f5e53d7b30a02bcdda770a6bb2704e3c3e58581845727a390581f34056bfb81b7d94bf9fc2d23fdd9a85e057258bb866044faab7a34e18a9969a715db045c05cac5b604bfba3f8f56c563804a7950d1d3d594cb3c54a903f0eb8ae53d6588af7916d57300d3ba618f6d9f8181d7aad3a5f98f7b7a9d882cdd7706bb8ffd90ed9a406e273c1d1a62f5168e2b216b73e24b7221f90c92fab0ab957a09845f069de1d92e5a814309ad356d749f619f125321cd7be1b09655dd05f59efe0b36745beeb605763130598a88108a233f6bd6b4fb1ef25354197913589690b3db538099e47665309fe31ac6ef777c9745378c2fd4cc602534214e38512d92673d957e987cb610b1716202c0f8c2df7dd8cd8c0345b7be29c66f1b7e3119bb1335a952d5b33a0efc90d1120f1af861432f7c1c2b629a55cc3bd251e9e66aef96f3ba4c264be8137203946a316cd0ce805c39a349a1e1295f79b003bb8d31212a01f2f987dd564a38a7f467394d630010bdec52fb0729aba2d7957ccb9e938c836098464b9aa5e22fc1b7cc8317a72c4681623c3a1c2a36e56a9d11e32d42a964925642738b6142f36e8d5d3ea8e73aba227e9ec480d211a04afc71ef428bf11ab8f6546032eeb292df70f229d2eeb579382e4"; + cipherText = "9c2f5b8b72ff768bf37cee01f4c9ecd6f69fcc8864f9b56bc771daaf3a954a4f40fdabb5381273180334f70201aadab7f740da5a1406770fd220adc472b5847e4e5dc82d65ad554675b01cfd6c47c3eb480d13a4b85175e417c0c4de2ffb9e259121fcb0baa64cd676646751b25b3661cb6a3425b0d744945ea6ff559d74af5e92353b92352094eab723ce26533323175d73549497c41fe41c9c6416785497b04f92c5e4b0795aaa4d34d3ac08721044824ddf22a5eef1ca96ba1c3ac1e94809ea9b294968557f364c74a4f6dc0c3c6356381aaac6da5997255350ef648c1b7e526eef40e38707b5d08bdb7961d0ed0b80d67eae0a43175e059b6e5a7d47bbaf72b3fbf7d6c01341f0b509deeed5bbd04b229e6cfaf6da903b07276e93e8afc75e9da2e680f36e40ae704327c9a02ad4c16b9d1483cf949595e459404b21eee7ade818334b0fefd9eea68bebb79cd2f78bba0bf437b7c18c56ad1edee1f43b7b33516d986bfbf77feb4dcac518c5d58fa775bbb03ddd225930eddf69f6b5f9d88239332948885a6e5591c10f0230de9d7b6676610ef08bbb257b6814246bbfa680e73baae663171ec162f331df68be9cbc195c7948c96b33ae3a6bfd133c2d42afab998f44b73fe37e1bfd6fc47309d2dc9219baee77cc8b2b431e1fb3e8f85d7d6ee50caac41b36cfb5419cbcaa85bdd2696c4bc4043271cfe393765af3f931"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 432; + dataLen = 4096; + combinedKey = "66db75a1732442ccfd7c3dde1167ab2fcf92dad59f2b0f6cf153aa8cb7dca0b4"; + iv = "c1e92dec7e50e21c1a3ed9a842c479a9"; + plainText = "9fa17d7d5ec3a9cea1f7278e6cfc95146520c04fa905b5d21cb6738488457179359bb515be5303edb596811fce830a29cf646faa80999c6d28b994fcb3608340e2bf0c03db855b5662c405d2eed5a2fce332ad65551ff1ac39b0caa578bb58a48cf4dc1f5f3eda634726a877d9cef7f9bfcf1fa594314e78ec737dde24150f7f0b0f98b44ea88257da9a22607d4a2a89f4b052816ef64187740a34e50d2235bb67cb17f94caa4d67f3d5baace16f97a6df195613fc2ba6baa2f4fac281765429f127de0b2779436769522e07df597411e405d4ffcf693e2009574e8df84d9b1f9176e0cfd8f7ae0e362252786687a536e4cebc0a50857cc846fe9494d40e390938a9328ee542c68a3606702cf5bfd5dabfdeff434a77e32ecaa95e997914b19ee75a9cea2963b16806739301ec4d271dbe7d9a9b677b52c3a8cff6bef3273d048c1f53b42c4da269cc4afd91bae7e2f2257e71188901cacec2482d52b8b537a24d3745ad5fc4464fddbc9a48043a71795cb899ab4b936ac39a330a6c556785b87656ef234a6bb9fea60ec1f381d4c89f5df7ed931da6ca2012e87ab93ad224757fe1d8ed4b730cd71e75487bb5b40648e73daa0b8eb26061e33e99e6af8d73b10b68e970b7c2bac106e677c9abfcb03551a77ca6a737b5e87c80a4255e3f580e2e6bdae2f508df3aff512772ee9398f81cf5ccec868aede5377cc29e5aa7d568"; + cipherText = "d3faa6163310d7d7a66d05659619eacfdb26ed435abb75f050c86b43fe31b2cbd1a468ff123f13ec21984410a4cd317ae912ee50951b93a7dcfe6e78cb093228beaece1c3fb47ec7ffbb2f859fe3991580bb11611d8628407f24ff3c9d278be5baf5fc5297eb0fb8dd6f6a33f1fff436c00b3ce490504d77fa01baeeb8a73f759e7f98ca6db79610cae960f6c3248fe5d754babd620c47c2d101a7547bf485704fedfed2c642de93bc05528015b288d946359200811afa7c91c14e65a647da23127afee1403f8911329eac6a76bcbdc322bba99768d1b2ffc057c927f40e49fafc7f1f933413cfc182a9170bd0cffcfc6496c01afc6ff45e2d21444aa4f8623717edf595413a2e3b456503081706186ab65b28d8bbbfb47c89bd51ba3661eafe0d764ea592ecdeda69e3bf7b6c423d1e865d4f10d46d37be3ee49d8e7a8c62bdebed6a1bcc6850a686923292ce89d6483f0ca92960d010316dd2677312ea6c7c530f650f9c6cd9938c09d8a772433c2f6c74bf2bfb65f0ce454e675ecf4dda368d187a5494e128f232cacabee607a2af30aa564b6dd99b3ac9c97c6a61623e64453291c8f771b1f0b54c68dc4423da3c76eba8617e74b705fd1a8d422563b76ebe28eeb06a9e0e43b52b13f957b3fd0c50541140f51f3e00cff1f8932eb88c5618e4240d72bbf0ba71f8588c5c41ea1b6d6e6ced84567f2a8a937478572d117c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 433; + dataLen = 4096; + combinedKey = "d68ff4499838a47c4299a9074c42a314a0f71c3553d300a18c525d519f189828"; + iv = "d3303f38e42e44771106dea249fd5075"; + plainText = "044be5ab8ee320c5a8e3176c2c570bbea6e902ba08c455f9a1e142ea1a4581b312d4e987be387ef0ea20b7449aba263315fdecfa90144e04fada8ff9b520d1d769d9af109bd943be6d6eadb89c6079ca34f762c8bbf31d9807b77d8595125b795cd835823ba0407590bd71c3574e17e36ae094e97a8d17916c6b27d452a2918b1a79c7307cc62fbaad4d4acd5781c5508dc8333f2bdc7910eaa0fd1afb0114f2e8a7401850df8e0a99e962a2f2dd17d7492f95208215840b610cfeceb958c03c00156c2faa481c8fb6693f3c1780e67d5d5cddc0b102c7c4574492facdc85217ffa0fa3871fbf941062e7befa5c423222ed3fde6cba15fa4ba5d245075e2688597516e38d477c1971744fb6a47781da13844fdae1b8bd6642fe379dad3cf524981cbc602f807d55bf679c386619123412718d223db92f88738dfd3d93d065d329eef9249d93606c532fbf9ffd6af98b24529c152b3783d1ebd259a3e8c87caa4eb5e4378d5c808be1346eee78b8514d6ae8a382a81fc6112201260647d0cef4ff74f4f2070e81da1e644850ce74b40040792c89560e023e8a2dcfbc9342e8466c7b393901a08063056982306518b3e736012bd8569a31d71c194c8007749e8346c61f5d6eed25a68b906e20aa1a422c0fe2179018ab86413e2f0686999377d157a4544a6fd4d9b2d41d91e176a63a327636462aec3db82cd0810d68fd0fc8cff"; + cipherText = "037f69f8ce3cb419f5d86852cf5dc8dabdca4ca091f5c56e516ca1470a65e2d91161086c355e993e464f5c32985e34b586b0dfb265c77a1a09225c427ca61ce51ae32f4e70f6a253ad6e50f9b7a67228ab8ad126d1c6ad23e20b8c56ffb6279f6b37ca05e0a8012bee65a50b630e7eafdc5fa87f77c9561ab983efe04a79c6baa30f8ab48941744abcda4848a693cb7a6235ae2b8e09fb3f95b56d79df37ed859f645fad4836022dfcd8283631ba6de309dada889f334ac5a370a524568d75bf66d48e3f5f845bac72f8d06d6cf0079d8d4f35247a03b905003967ffb809386cdeee764e8e56a096c317e4def5fc6418e32c228b8c89fb4c3e96cdb3f0a25324f04e5c3122aa6a9e5218038fad495198ed9b14bfb2ca176c790f2712c8425a883e176887e6e6f75aaeeaf95e1b02b36989f9bb35d7a0a0d792001513a8e51445448c2f81e5c50db570ab326f0508fb682c599f78c049e4098c73b795f961dd8fe119967d831e134b35fde463a5df662101ec63ca09cc53ec990bf497cb7ecbb068788e95078d57af923bbcf3639fe1e24c99dd7e51076cc9fff095e414b5821776245709bab341b4911361ea331b4d224378fda692a9378be2c12d0fb6da09dc38eb7b5fa180ab28840cf40e350345e028e684280921d7bd85eb0f281fe68e9518605415dad83a18161aa6658ace328e5eb3137445b7182c8c98c08c62f5379a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 434; + dataLen = 4096; + combinedKey = "015142949fe4bb06046f36f84dbf899c222448d201fe223b7f37e70bacba5732"; + iv = "1df3e9bad4760ad3edde70b074e9957d"; + plainText = "1a52a6809a00d0576fb0e2fd570f162f763364df3c6cd5ce16e4b8f3e28cea3deb4d08ef58abe81d3133a809fa6a7193ac4f9cb0caa7c68c5c0813fd910c52570fec6b4cf3b79850e2fc58c4302ffb146bb6ce79f17009be6291ed514b47eb06ca0f6e94eec1ebac8fef649a4aa536e637aef288a701b9b3b70cc0e573ea34585ba87a28de79348203c1fc5132cfbf85d2047911bbbc97bf5015e3c2666d7567ef11adf43e069844aa3b1b2672e14052c1506ccdc414f790262d4f9254a3509d763b6a316a215919d9daebec75c7082369090466fe34a94ce03b156806575b925589633bc14751ce118007397f4d34fcb8eaa8e17ffe20c93394c33aab8db8a6b62e19bceaa5dd105f23b49afacdffb803a325e6cd84814ecbc063e1514fbeafd6d98b1d380c82e00f458606d3aac2ee48e983556a8d579b1e28ac2600a982bd3fe191ac6f5c238ac307ad4a5f3187d2502a41b5a4db9c75424fed463d8b80cea6cdd3fa9b4ccf47988559c0dd4c1f8c51520dbbb5d0f7db33072e957ec612ea2becbfeffa1c348b181c4c6338a03cf94699cd785d03f4128f5bab756def48e343ffec37a547cf692948c00a02b28f12d54055b32ea6ec7c3995015650dfc26769db9e93f36ea07169325488111344384ef89b0b693a5f5bc3b41670b608eb173820e6f54db292e0baec70901e1f936befe940418c7fd7ab90412691da2caf4e"; + cipherText = "55b32497e377ca6d717ea8280d5e0adc1c542baa52f44e00d6b542c9c9bad6944c7de8ea843bc49d52edf08a622a079eb55fba118c4ef0ea88b64af7a425a746df279624ce291beaaddf7fb732578ef6dc49e2bb5eb2959433df0c9f4ec27f8ecfd53f79bd2467f51cf91ab09ade12d13fe6c1e1143a6f885eaeb33c75f13a8a1f44509109316653397dda919daf92f29618df1200e20ca6fcd005de6df555485f51fe2955eacd899bb8d6809df6811d2a9553926f05358d3111d9b47cd8ff668a20784d5d6f72c2b125761d1e6af120c75d31bc3ba347a7264e02ee60aa831ab46edc8eaddcee8ca1d73baa6716b0999fc8f1c24be7495f114a16f66e8118f9d2b5569b3df7bbb063229beae67892f4810a41be3c90ead43d97302c5dc4e7532ef20c032c3b770b1d5bd35921836632337fe41ccc53d7c50d9677da04ca5f22848b635a01860c5c6d023b00988948acbe9f7b6f084256e613c443081a41c961d750d1646abdfb072b4678c0a63bb9b27f4104bae537ecf23d9b23363d0b5fce1b04dcc663ee3108963f477afe0cdeee4aefacdb504cc50c9aa86759d7f1094ca34b259d2380ba29e22fe8ed79e5892c12f3fee85f557fa68f16567cba3357b9dc1fc3c15a51b12b33f500bf4fea3d4fdf5d17a4b2ebfaf239a34f2b58742b74a83057dcb50b544ee9bd5f4e8fef19c2a053ccd87ed86b04f6c6d399e3861e77"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 435; + dataLen = 4096; + combinedKey = "fdb73e9aa1f85e351c8d3be49690567f1fa6a0e3681cb43ed9e52e342e7075c8"; + iv = "df9fba1b49b253f62bff31bf1781df58"; + plainText = "018fc8b5eb1a1d512d1dc6efcc04f9cd5d7165606c16540720726f74d4093fde67e8cf7dd093bab0e3ac90256b78a3df1206b7b709d6403303d6267b0ec737a1ebc9d95bccf225001ffbb2384fdf84136c06be23f304e6011667ebee6ab74e62ed4686ee6d478323f6df1f7fff1375a206b0254dd80afe4ecafca9b119b8070f39f48b6bad2823dd440221328a7b132f93825b70a011b396cd873de827ce058b71afc342bb933e87c926a420c4acdd56eae672e437bcef47e8e3512bb6ee90350ea0e4ac8192f290f4b9d1d4490a5d144f7f963cb37b88257c2d59f613264a8f4326571eea4e3689c4534509ce79a9e5a2cfef645373f5b5df351fee9736d8b885d9adcf38a76b524b86b96b49a81712ed3fc4d885c9481c2cf52e4379e4c8f0eb78d8ba53fdfe7a58baaec26e382056136786dd8484c0fdd19b6b72d6729f38fad5830814aef18f56fad548f61bd0f1cf56b2dc9f655161eac423bc5346467b7a19621c6a2dd047ac90e4b5b8e1cae6308401767911e2d326d22d8cbb603f19b0048c85cdd1dbc187c208acc662e24140bec79e7a3acb0126f7cbf9860d739a4adf61abe5b3331a57e6615b4a2c1dc00d4159e98357b8e21b731aef40f41551aa62c8a76bfd188a838d0df46dddc8dea96395a627cbd4ff06b66a2dd5d141c110f383f00561e35d646e6a1558b10c849592594782d11385a933614bc271a365"; + cipherText = "231fdabfea830c6d5bdac1395e69fafb9c733ce15e3600babae22657fb5a79155eac047c4e87fb80b0402d4d489cb41b8c5dcdc48dcdebe3f52038cee4becd2adcb71b6c82d616ae309fcc6e513eee49a1390b7ffadb984f17e5994ee70cd9182635120968f5f6d35b9e2d2c7a22eb0d4f6ea18fcb498a59f78b7ef6f52b66f37bcafed3faa66dc2fd1d2667db6249dbb0c584b514d3d209e47e93b92b3ddff1a2eeef7127408938159e32141d1e3255fa644e049c0c9e698acdb4f1b799689593af3d71d8dd1e6db68447c95fd0700833ac23b168165074cf2a63629f09dbb1a4b717b658922207d6f76c0d29b2b23d659b709b38a110e1383ccd436a3f50bd1c6561422d02ed8dd343be646edc29c24cb6a8e06added3030a6585bde58ef85f8c14b6d9033551a02d8ccc8d64190abfbe3029e29bd1e16eb522472a91ff113a389e2cb3fa4acbfaf91a537b96f5a1ac08d2ce76a1b0eec21260cecf367b2a90819626a1973c297530215b55144d7c707003c7610ddf92c325ff3accf2c9c77f4f2f01b7d88d26cbc3c7da9c6c4dcb946bcd1dc38f158da56fb41ebe4f323090f6a321f7937edfa5b29fc05c8b6c988b318bba45e391d9e59f456075dba967ff48166567fa65ed816ba21eb581626c09dc529c4759159659a09e35023452c75d72f1fc8fd6a8bd648c9b7d14d02f5c6a51999cb0e9bdf632619275a37f0d41a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 436; + dataLen = 4096; + combinedKey = "b37bececece411f62deab2fef5af60538c5060d7cf8b2c91fb1fd68c97a2d37c"; + iv = "7c3fd5b917be953c5064dbcba13a2561"; + plainText = "ad2694e79fda5ad122a5722c78f4c2f32376619ca15a67b43790ca65e9e8578523247c66ad2a030f7d8224a1fa283ca11994148d399f75d6fd103133d9677a62bc186b416881c10b990fad3648a731e0ba3d4720d155e146f551cb3a503c894b7512c8e9b4c566c35ef968237cfe2cac43960a8110d5753dec12baa4d04ef889b532a69792725bfce08d27d16dfa1c14a5c9a81d96dc4243de35e1cc3cb7ff54868a0fec480619c45ced03fdd6379a6e13039fdf02fc91299e49a5e9993a4ef81ac9b7e37de0eca3fb2d8105d41aabafc01501e255e144e656f60ede1ee5b7f79e2d6a3c3edb7c75fb8ab946c1946b8d6bd68ced53d929576b7fb48958cec96b5483ee9382675377544b2d112255407c67daf01011d44818bdae963938d59bfd3d722c6e8118fb9ca019bb29d1b94c7928f0cda60cae6471ff9c3fd9ecf44c9cfbfc8998485dcc258d15b88644c42e68c95115a24cfcc587da86a7b3d2e6e897d1ee67399977deb86710f7b2217b7129b2ffb99a89ee4ec52d8234ba35b5efc0f10e59d0a09402b1b76034ac93af4e68802ed198f3eb622ae479bf2481abff60490b645200a19548a6514c697622087b084634f0204d28285067f394e053bf7312af6221cdd711cf28d0a3194da994aa6d5852ed1c60ee1a4ada2a06dfc9c0199ed5d27f9b31796d132897f338eb3070e737135c00e40f09e13fe059525dbd25"; + cipherText = "c07e7e1a92d3f4864ed67d342df1eecde1bf28578991a78538fbd697537ed5312efda60c7dec2808f6c83eea492a8700595c3636a84176d654a69a4bb38010d58f148ea773b95d7ab2ee50482c231859b069802642d53fffa18709a0648f816cd63eb6204ca904c5016ab91c0626b505778150d92bd8af1dbc35206d715ee0c6f06eda7a614bee12e8309f356e6d3e5d012ced3e21ac3ede58fb76406ec45b5bb80fba80bc7a6b849426b398b0200c7c5aabf088cf2d96cd0a2978f47386261812fda53a752d59cd0a9ce9520618239063ec309e9a093035d1aae69a6a24bddd4d9a0705059d9f7334c8125adf29cf140ed0c32a7f434a1bac3aedea5afcabd4f62e89e1cf0257671cddc133f0be72a9b0087eec85110e015d7f4bb9fa28c4fc8147618b95e36d4e394432c0e58b6b660c0ddb1e6a497987bb831e765a21e84a35d13746895669c792c986562f96db748849d0d82a706db051c5fcfab1464aeaeb7d823e3823231a4b255e3c82df400232b8646e3bf9ef08638e1ebee7de4c92a1b6be9be145286e4440a718879df35c6f6e543b4722ab1bf5dbba0b503ec0a16be8d7082310962738cb817f791bbd63c843176d26b0f34573aefead7fc153ace8d8573a01b8f0a8e7432ef9a65c7ea02195a96892613abe8946b8bc76aee2b58ba44c258bc8cd528dcdf6e1512ef8cec2a93c5f947a1334012de912aa5c44a5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 437; + dataLen = 4096; + combinedKey = "cb48acdad38973f5c581d1d660a663a2adfa8cd55fb252da7949778a477db854"; + iv = "6f071e6600adec1acc2be6634ab537ee"; + plainText = "0546905429ee77b11f2ef1bb8df58afe20bb8627624f498e119ea58676d9c72d0b74ab30a516ab57f85dbcbfb1203bf76330783b2d79248e34fa5101636b959cb3457d19216f066b76bb2a2d792b1c452d9680b02b0c27d62e8169e80d46bb1103db9e9bba856bce9663dc25e61f9ad952e2cf6c9b65c98aaa888e6976ea0af5e3c2e0d24ac99ec3d0226128f872f19ae50b8842412b30e086d7a86182ebd621fb0b7e45d9e867a663b9a5b4c6190040f99f034001e12e3b127c979bc158895f44dba6d0bd53ac7eff5bf7d93cb50181c401c4e75b9c5b7d8c27c4905be1a349b6f0ff03808d820ea61fb6bc570f7f50af1717ab94319543c348b47fc9a0c246549a2e37cd52439fea7edfb741d4d74f24580ab7b383ca4d42d712ccd32a57745fefc735973ccd84378900b281e2a73f338ac823d1e498eee24c49935600da82b7ec788e93a95ba30db4eac6c4c8dfebbb4d1f76bf9de72e525485a49d34f7f60a05ef245184acb0b37ecb07fa90ca51e2346b3d5c38d51f21d3e4067c94cde9c4eea939b17efa8c49fe1c00e15dc7e2291256260064b5851c717d84eea539b20cac60769fa5ed79cb5520984584bc7df6d18334216f1c5db03a7735e8c658218f2935e3ab83bc6d1bbf610c27f08cfd464b464a379ce6a1612320c9d27f7712e4471f56745a960c23004de80df27f28216c973623df0e8a9d8ca3b8e30a5faa"; + cipherText = "0b3a0b4b3c1921b16b459d788270e14fb2ed2534a0bffda77798b1c1ce01d96d058e92099ab3361c63d456d00338ee3c3af1074a95ffa3e9843716a4b322e9bbcb554f0247908e49e5a522af2fb01a2ba56e6bf06745733d7a4e11f411b6fe459b84a3b25a0b78bb6f3be73c9d69381133dfe6d8fd6bedbd8400932f696a2e057f1410ffde3d732f7ab07375e648c36110ed0bbf0807bf291124337c72225dd6b42cc7968d7d88a3293bd01ecbc0a83ced66493af8b69d5e57ebdf6d260fd4574718c12931856d61ba8f80b2568186459c311fff824ba7e07c26b6d6d8302a9b72cdbdb3711dc523daaa2219949fc41fca0dc331b5d8d157569a884da6978627062cb04337bdfaf7c1782b53f1ac70cd1935bfd9e159e82da4310f89c0982a85fdbe26e07001d02242de6db020ace560a16903f275809c6bec49dd6ca305bcb56ba69cff653577def24e9b56772a0f50a3b4de52d5611c8555fe2b04b5d34de0420896fb1d9abba30ee58a07b323c9a9e01a9a580b81eca481e029097d713cd2b34825bac8f48b2d54333c9d030305b351af4f091360876d51e484f8830557997d18f358fd4f42b84cd8df2a7a1e088201361cafad33ea6f7ecdbafd44bbfdf4bf5adfdf4c41893463b04fde7de8a6aa010fa7985e36d74f22a1117b3558c81ac87d2afb53405cf32f6724a86ed8dde7a4d7f85e902d590aa853da096f169d22"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 438; + dataLen = 4096; + combinedKey = "4be787d53b2dfc4cf24c6213315b931c9f2cfe0a7a407bfd3283c51fd3e24c8f"; + iv = "83b66672148fa3b086c237387459b596"; + plainText = "260ccc4b46a4982bc4dfd630a1ef90481505e26a1347f92655846fc1417a79f98e7a26d817de2069f8997f194832cdf046cdf9de7b43dc69749c70d3ece9a2be75781fae957ad589c85840a5a87b5f77893528c5eff528d96a88974fd076a27fd76339744a1779765e1d649f08aebcda1e88ef818d89d3b54b7b18ca05a6cf50d166a25be5dbc3ec45828fbf7e251fa95524017e5bc37286e942fab6957de7d8b331be1788546234e1b88e386a4b28303e49c2e99aa86c30aa221953b89a4c80f8a1a98dc4f5b23bd7a2cc255458067901e72d03d08750072d75db390c96f6cac1171d6928d078fdb156a0f9f5a99aee6a6246033bd82a7f03b11e058812b6882b7f6b18ef472ae8285b41227bb297fa67d6f8b67d5f025935966214330f9f6aadd86db144ff21412df491b4e2565fa7703696a7406cc68fe3501ee94830c8e4bf3cb0f960dc223bbc4b2eb339a20ae3f6b678c6c40dc42d340092f4e817b6b5c175609f9f79b16733ce99e025c0eca777ac60fb7fbd3ade3376efbc465bca876499619c951b6e4682b7e57f7e0469f01e5492766c11a63b3127b145c68fa5c56324bac906ebd7be7deb565c7e1ac107fa454714c094af9c1902634f22f69ef778b515dc01619ff7a3a8e37f54da06ef4898f81f6cd0c7e7157a9c15b78d6ed0c501cd575005eda5e38bfeed1ea05b3eb0be15195186bb4fadd5776292ef0593"; + cipherText = "7e14cbc35c0f637b5b200293349ecc3e327d3985c5d188260ace9561cc5c2134373e217351f50153b59513be6fe43f1f8da4d1d13150bab9c133a335bbdc8252d989e4dc3d5584625d2379e6eed436ea42837552d1370d03cd2a10a5647ebb4b87af78056e914f5213cf18e12950b22824f8225f2d0c510359ce12e64b25f335fe14b10a10dcbb9cb99ad0b9f6b9a7dc72a7f3b621ab2307946bad071f627d42e2809d6102597f5581e2b1c28a9e43c2faf78f30a3d76daacb039260bda8075c885cb4ca5f2d81c6a73433d35af34f687b1a890a8bd1dbf375a6d23fd392c1aa18f96f6c42211c98aa8cd420ced38e62aa56ca2246b0bae0d20e3dad94bb6817a6345521fef8e5bdf7f2061ab61e7344a89c61d9267565a025b11909e43cf94fc7e67ae559c3d834ec45156afcd5fe292d846f166e259a3049749a350ed8c91be0ae253b1dcf5c087178b2721842c7606a4bf8ae9522b9f83e626a36b0d9f4ace36dc71a8319f4ccb5c7809a2e8993b578524890f0c9d378337af664b62860f6bffe4ffe3260d960d328b622bfe4efb995c05a2f4bfc08d6520d2635b9bf4cdc5eeaf151dabf31f95261020ea46e424c9561d9670c6edd6b245873df3037f6fb91d5db04c50f43460e81166133588d05c38b232d84e8e8d74a76f1800748e983cbe837d5374a306f72d411fd5a3689dfe982db87a3456419565e9aca5d19cccf"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 439; + dataLen = 4096; + combinedKey = "08f8850ad90db1951979b62acac4f85235ea05447ecf9d1f1c41987459c6dc1a"; + iv = "3428c435ffc654c45132428c8ed10281"; + plainText = "304139f3de6cbcf69fd1199efa11d1df665a4020cd7d40b3c199e724476aeb4f3ef67335ad3d14e48749f4dc0dcdd31dccdbb9479e9c6e1c4092b50e4e47082a07e20f88b225461c8cbef838848e2f8e3c7529c3eaa28bc617723ebeecd09bde3c393c493e7a822bc0ba082cb69282c9ecc86a5d844679da47ce8d752fad9ab212235808446a2cf498c4d5bbf3bf203ab17c5a93eb527b2e6767615033e3c72ca4ac4427446f5d61a903d633b0137e0edf4f95dcf1dc5961bce2ea120da1d7ff9cc3f3d0c5fe9dda78eacf10d87eac604b49cd9e783e138f817cc5ff550f17e11e9a56bf31617c6757f96916ff620bf8ee558b73ba752fb26e065076a320a68ba617922cc0f78efb3f2e8e25136a50b1235140e0a2ce2ff27464640629cd26ee6c963291cc8aff57cd9d101fb73afe22f38b92bea99f671bb23310695249e9ec7588c69fd845ef86e0f772ddfb1fafab9ddd2bf16231b8f93624706bb6b2a437c026b6fd2c44e735e9947c911f14d044efea856da1515af47ebf80e98ad724a677370b69e4cfe0221831a265fdddbff85e78db2196a7ae687173d63a6105d36bec9a738cd3b3abb6caae644bb938a8de536870add042753f1508cb824f45177f961e7cfb9c31abdb51bdc6e03a196a11aed8c5deb80c404d9d57a3bfc36c9733b93300df72310833b4768fb75e4fdcfafbc4a19c4f04d6cbf6cbe242551580b9"; + cipherText = "65bf012acedcd927407bedde0b86e59eb87a46374c5e783813a1eab7b9486b8c547e0c564e1145094948a4ba627c0a14d373ba33d5388ab6c5f7be6639008a6252d4ada41d207c12a16d3eea968d889d12a1bbab3fe11fcea6810d15d36172e06184ec4dfdbbf6ce9a4c751837a044fcbd1656267e5f0e2d3139ec0967445475e230591f1d151e40db2d5586092bdd2325148cd607e4ff94d212544318d173721202cf4109c426ca074c2ccb13dc9d81ab587091189191619b9b26954505bd362993b546f0436d2032d277e26d318ab0707362f9db69c10ca864b93a0a98da7a421b53b7649bbe907b35ba1c5cfba9f4fab7ee8f6a3c4d9abc3478ad1182fb1ab9126bc64705a40f8d932adc2bad39a5a9bb5d746952638e9edacb0efd6551dcba4935190a81af1d917705cd822dc58ff7cdf28d60fccd942b564af3b461c7896a7b61efd4af092c8e03498464f2094596e79120a148f9e219f43d6c16207db8976d9967f4fe84229703e3805a331fb72a7885a5e2ce75ca8e9784ddff6e55890bc1a2a45e6c688c03f31166ffa1ecb185923a9dafa2037b8fa078d7119aadcc2a23b08ee3663fb1a32dba1ef1ba964b5fb2e23565ae3764c9fb7996107695589b5419cfffa97b27b688cd2553a12cd3b5969b434546871cd56db7d72203a936b61e68a3943b40e38aefacaa2307a8e9efc1dceb1dd42f4116bed07fb61ef8eb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 440; + dataLen = 4096; + combinedKey = "e29e9af7690c5338e1c5dda5218893198c74512162f49fb18b14efa44a231c48"; + iv = "24cfba144cb3bf9c75ab6af92eb787cf"; + plainText = "1701bce6a9a11658a412bd4ab833d017af92fb694231c54f95e6f05c072ef8d0897e685e8a99cb496c06bc2821a72c27ceea5b1b82e90da31234e71b915cdc2f53731351f2a51f695d6e9b0af3475d768ddf8a568fe8583f51cd061a58cbfba678e77b99fdbfa6ef2a627114fd6fc100fa7dd398384586584eccec2056b1ad0acdad9be1b1a3065d64e6c14eb0168ea7d5d1ecf45b8ad98f4d245055e1023d7efb1b14f00b699298df30e6e2af0d67adc202a3dff5269b0e03b5dd3ba649f0cb740ed2b6bc0d1183117c2b0a0ac7918e238dcb91575b87ced7d79119a93b242af65f9a5cec4c9cb3fabe9ebf302819d1cdd86bf4a2d7264976ae96222c0d92957bb250cfdd0ae26ea6b1ea86fcec63582643ec8eebb223b5b9fcee680c92007ff31c4251b3a4020a912708106e490c9b54f53f62a2e4fe410f08b8c28a02f709c7f9b65672cf366187507a01766214329131f3f47bb563f97cad90dfd459a5bcb9bba9492ce698169c8212aff8386185d953eb954f32b3a52cdb9be3e36bd342a5d83e173261ce94a2bd8a6f5fbed4d98a8768ae3a77cff80250fc392559ecef23457fcae41fff2aa2f82a6827d11a2799c7af1f23e35ab2967f55b27d23640ea8504c7759c4bb4288b6b9000f78ea8882d89075e3604e5f40d9636ce6e5b6001813fee88836cc5fb9f93d3156ccc3b6988c929da32030c05eff2d122a4ce8bc"; + cipherText = "e2623526ebd1758dbadd4ab84ff9958ad337b9a3935ab36b23d4879977c87921bbc998c6df655aadcf388e93699094fca9bdbb504150e959e8eba1b7630ffed063c389808a2d441c3b3864e8ba1594c037218b4e4b8cfba934bf15858649d97a71ffe889e6716abaf7c7a904e346813b8310580ce80cfeb79326d1708cbfe1bfeb7417376c3c349698bbf4936aed294b42865b27e37594c5df0cb3c3c8dbc6dc406bdd65d4bd565b94cdff23814c444f4bebc229da23e8407b749899e85648d57e15f7c7d9d88c1feeab6df80d9b3a79a3aaa6eb79ae39a44c31064ba00e271e532b27d1850700342bcfac53a84df31346f72f0e22de4babe81115332c851827358198bbeb2b3af1eaf4f8c9a91db4f0f274a5f54f547395e239966566beeae969edbef0f56f6dc84a5d98668c128c3804adf2da4d90e3daad954f13d138fbf0b2df60fe29af828a9f778afa26ba85d539118964c5cf4d974f60d26fd0315269f7bd6a6356c6a0d3a9dc64007bc358cb961a694ecc0a43f46b604e9d204d2749c19ed07a7764163733c8eb7f2449c39bfc8ac8765aad59614d8977953265c6448ea2514e241af0795a90dcbb9ab58d75701f9a603260f444a0eda664eb0818f2a88d9fbef7479bfcf7572ce2aa48edc08a77ba60ec665e599db8491c38c214de5c4253cf8f1c011c8242194a9e9f6e231ec65acbd4ae2fd5641768b94acffa19"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 441; + dataLen = 4096; + combinedKey = "a90edbf292f563a37512173caa316d0ace0406c6a34526f785e42230b44228a7"; + iv = "c1e90acec7d67e9a2a90599de9613ae7"; + plainText = "b776bf0bd9a1453f3709bb8167f9f47ed83acde2a198e509fb5dfcd6b9db8d255ea080944b60ef60fbb02808cd3c34caa5f5cf0618d66f8eef7473db78fac737cd5a5d637f0e8eaf0fa3a115a2ad74459f46135c40c933634aa17804e60c4f0e77b4313325fd4650c41d7b3295513f1d6e1f95be9f121f73adebba7c198eef0a2ef3148cec1cafe90fec3b260f910057e49f5085e1e3db794eacae4e0893bfd88637e7442fdac9f74529c6947b9bf96084cf8a995ae366a1a82bad543d036c7b3f8a8e74da8b00b793ad35995fdbe1b552fffe8186cd7457d504cabd078919993bd4e191e5253a2a294aa27eae46ea5b5d9bd2f9253ff29fe4f6ed20500001ff114575fbf91b2f0b06687520dae4227b944ab4090d369cf5edf26ab0467daeaa56a547a18affdb2a89f3bf6cc84390fa388dafd9e480c97136b5050d6ab420aafb9f0576c3df849ce8e866a5a643267af216834271df29c5ce61053470f4f91cf146fab4aa2ded25f96356a7a7bb3e60dd8eed61ae32c793e6a4ed44e4eb7b7954db16ddc86f91f1b6424f7412b86c91457fd492d099d45cd6799eadb567cc9c04f69ee1190a4d24344f87e8de6088b5112167b65b9db8d584aa020b812ab09495c7aa0820cafbd8200c09774ef9159907c8592522ea669d042f1d628ceaaeebb319b71b5687abf903d2864addd652afcc429ccb99abeec4291581ae106c482e"; + cipherText = "34b166790e9d25f98162fea0f339dff919d9af2c360f5dd5ac6704e0b32008081888cfb096b2ef7e8210c27310ce32604fb892d61bf460a2b1783834cbf9817eace72a35a7a19cac38eeb1ace1133304e57662d2b7e10c07250974f9d85a5eae505f6bc8b77a0f6bf4277e17ec39f8ace38f6c7870671280530ef5fc9b321af91445dd34fae1b36ba3d854fb345bb3d82c0b4cd61d489e94b083837cd4b188e0f528b35006147c55617f4df41d3ea23995c9bf4797384633d3682b1b9033c2b9530daf91f1a80b50286e30b499cb7162d32a29c322f8baaaa29ea101580eefbbd6ec1ee28ba1fea91dd9714027664f30250fc0807c4b80e3f9a8fbc02fe2398e8e81685d039fda31525578023b8dd0834f7cacd7d8e316b1161187eec913226aedfc57c1570ef5180398f809196239e165a0fca5dab1e18969601534d1c3fe2f3a53999e0031d3e2ba0593035403d810c60309b766f16aa897d45cdaa8b0d6a2238814f35a435add535ea40a81f7065cd21c0286f82bc10cad6f9ffef01d51aff2419c4e100f5314e5022002a2f808a907a25c83734b1574c1d769e1ef19cb77b1e95ecd9e5af04e609163d5f08d45e01dc1d439b1004bffb0c7da8957c92efd21e3509e70094d15a00fabb1cd2e586ea439720ed631d6ac4fa0f63930c1685d7e27372aa58f3046e218c45afd376dc593039a90d517668bdf5935a907c46c74"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 442; + dataLen = 4096; + combinedKey = "3a270185d465c1fa4b80f4afcf69b3270f292ee14d446985e02f3f495f4e5b5a"; + iv = "bcbaa058d5cb6bbe8e261aa94cb90645"; + plainText = "427a61d7d84d3f704ccac763c128a7862605dc09be1913248521f07dbc01eb2c1376b2b0fe56f32c9155c1e6fe9fa08cddb9cadc38a8aa8d72146f607960100a74443648965c6171c17c1c1cd58a195e0f0820aac4b270f5beaaa45f60f03786e29e3d7ef543bdb0cfb77c875de6283ece7828614355a824729879c304f07415233457a2d23a8b1766674ec89ba494ef004895dbfcbbfa157d61d34c12008902a1efef45572d3f8c32edb8e7a9d5c562a71a8fcc55a26f3c18e98942cc07db413ee66e53623a95e6444729a0721ea28df015c14eeb243fc479bb789e57b98363f57b1d5647adb187884dc01d6048ee71a0c48a623758ba2245b1f9c09cc3746aace6670031f0f0b1a9d381a108f82bd3130ad792092909937995dc9314c61ddacd9e11a7866870c7f5680e1fdf03b45e57e9a5e2bc28669b4791d1c39d9f44d3e0ec7e511436458fe060cb33aa9882c23ab10687487d88ae9679f4a19e0a7f954828cd2f67f32f3f7b811c38f88de8d0fb6de633a20558bd6b135a30995adc471778b827ef5f4c648d70f35160f7879192d5995c631b05fe39ea2519c9bb003a42971ad6127b1a785e8155335aafe748795b7fd951a51310b90af093d8a8ca19acea2beafb5d40ebbee481ab32cd27541c29f3c9b85cb3bd789dd10f44f144300beaf9f04342e20cc8c8f22a128a19db0dec2be28bc323978ce52dce8975c870"; + cipherText = "196c410de2f99f01b750dbb9939b7c1ba248bef27c45eee4fbb0d3145e4a91d4a258a2ddedd1b8beeae1b6056f9b201b4e2772f19ffa060dd1e92719ee32c8b828204046910191b90f589d4ab6bb42d4e14000ae6ad0363d54fe547b80d96e75a8cdfc9bdc25dd8e48ca48d8ed1c88dd1743d136e1c00e1172ae4809915596a0fd2d81ce983bcaa0fa7aa68fca482d9b4283a1ac7fe618e5d816b91915ad4ac013d1721802183a6699e1628c44db266e69af309edc3625f3018ea4106c1d607f41ed2f893c3e79ec83039ebb755776a16f45413abcecc6e52fa89357edee1660bd09460cfa4f1b074e377ff3990f33f5324d0b42bff7ba97c2299679f91ee21481eebd41364d065ab835e56f058756bb3af26b8bf2b5a682ca1ddb75c22eb74d0ca47ece81aa0b19d8b948f0d2baa5435a0489b1005765d226b29e95e6bb174d5f45081ff0642f75e47a09b147937975149718b1f67bf98895c1977c6efb4f3e0fcd620af710934785cfce2907243e9f156341a5692ec2d629b70c9e28db2177e83017b8470b4ea3b361d59bfe0c4e91eaab29ee88772b439635016ea0d7bc7080293234264f224235ccd6649b0c6f3f57caa3e7424597d7b64ead9edd8b6826ef8e1019de0e447bbe09b3f1f643028af34ba43cf6b890fcc58d47c1b14e120541acd0252fea7f9ff5c971065ad3a8d646bae6f630cea53487ec7b1814cde600"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 443; + dataLen = 4096; + combinedKey = "199b8f1c07d9c467ce9eada768e2f84f4018cf7233ed745fa913e929084515a4"; + iv = "52e34dcf06efcfef127992d2bfc84b34"; + plainText = "8f602953c1e9900971868d0cc76acedfe69f76132d89416c8535289ee13ca4c07d09ae0d0a8ee4ec9342824874913bfc4e3d2d07da551117ad08ec03a39bc84e50ee028e790cae8f8cad1d822a0f1bac6cd097a93f44d535bc639f0713221bada96999f41727626dd5e4c2ec1cf80a827a623f70544c8fbdbc4131d2540f7620ac7234f65727c20804ede411395950bbc994d843207300e43836dc5fb3c1421d6af1de6063e04ff9d8aec198397e289ace3185c06b53f4421e67973ff2a42cd0e838222cddd217c8e6d423399bd5266f7cefa506632d4089895c900d5bf7ebf813d1a293ac0cdaf7974ede7f9b8f2f063f1fbad450f66a8d5cd7e63f236d9aefe7dba270cea72ca83ae3e85178be4842287c5a18d92830df97b6080bd46e6bca3600fc29684d56d933fe301c00d7b2555de17426723fef6f0a618ac5db1f21b86776b5d4da0d7657e29ae1fe1f07627e936233f81e85f9e6a08c8c2d8f941b513be4c3187c3a388f3223a0eabc02156a89bf37d42756c3f6e76d4a8a5a797a8f29e3b803a490f8c811ec73ebd43a794e4472dba0220d6695ccee16cc25aa1d284f89727b1985e197ee38648ec6fadba0429ebd46d70325ffe5a02c5f0efe1518d436b64bb277a2d2ebf0631a5676b515ce846a5a43e732eed1eff9af2839b3064de2d48151df093f87243abed97eecabaf78679007043839a344dbd374f8b0b9"; + cipherText = "244f725366a9e01a16163544dddd0b244c7d9ea28a1411e4f6a8966cbe873eed7a5d41bdaaf628073a6ccd9fc6eed14533496c078760d79c5219b9e7e3c09028949ac100803641fa26631d54c1a26511acd5b74ba1c04fe69aa3d3826ad2f5953e7f0d28cd0e74b0fb7aa055b6ecf33e9c40804e95d96e80e39b11e3e754459b999171aa6574e386faeb3d45eeeef19d23708186aeacf4ede84ca2f06f959f8590214b2256f6254b86a9c81e706e58902a4d9a2dc855d5b920df211e5924dc795a00b57dd7fe88f6dc8bbbed5ddb237614ca4b84792ccd3c51c4b089747a8e44af7ee96f477a67895f887530cb2f75de4366c9d7968eabbb3e534d7687a3c5c2a2771f1570aa163bf1ded81324cde3181bb60cc70d533b5f2f30a092db433c52fb3546a528214ac8c2a3d1bd74796f0267b30f5d2f1115e3dea5557f85d2474f52e87ab1872bba29733a841c6b988081d55ab68328ea0400d4eafd111f5f270e7549c44e8f029894da126a8c694e10db1f91357958636431f82139820d7d4f4500d0964fad73ff009a64dbdf71bde9c1d80d730c5cb78d6d67fe1c680502bbbf448c1003ceb007f036185d166fe3e6eb2e013731a6e9accf48871fb89ab8d84ed1c050c991102b6473a0e29a6175974bc3da254d263f7299228e9975e9a27635f771e09e02bf3a9df26299e016766f03fb99214ec5f0c98dc56a365e7cdc5ecf"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 444; + dataLen = 4096; + combinedKey = "123b0660c990331f1864a5f9d9cf4e5215ee478375c79795046efdcd59f2d2c4"; + iv = "97a250baa334c20a86b0e6357659c0c4"; + plainText = "9d8cf33748194efb7b5ae2c2f45fa18df202ac4f35dc28812a99b647b495a9413341a3603aceb655b6828246a943cd51f2765005db0aa6f16bc1709b64769ace58d615c93e63449b5049da0cf7d8a704bcf67682cae0c5f8b674cd62b4da2893922766b53c28b2da61fe6797bb1bf9c9460c18de6af4248a26b560143477dff0c81202bf2e2d2a83ffe401f3ed32cbd8b58bf05e679bb38c4176fc616583d5bee51aa1439f3642d6f9e8c84cd82c22b85706a87d056c939dee45945a6ca7438fc32d395da137260e3ed2420a3a2b96e65228348769ae417fad4ee35393ca6e039e7b911a91c76ab3018ec70bdfe4897fe38cc66c695099661c5cec3033b982767fdbe33ed5cb1f6fae2e6f675ba5913dec7d994555c66f719121be829124b9d081caa688865152736a2ca701bade316b7352c7d5506bad675a7c7d747807a3ea468e9f78464809037ea30161a34caa4206ce3a0d43bd5c9c2757a35d3f25b063f1774708b8f916cf9a01b72f3dab4fe96065f08281b3394b51852733261bc38b14cb5a67b3e49fa34a75fc07abb40d006502f6e627163aaa5ea7a36c064b3c42cb5fafe66e4979725e3e89290ff9d0ec8933a9e974977f2142080b3b220848db10fa3d12ae94f6d25f845d94666001fda26f7c085555120f110266d83c7283732dd41f36b90b549d5a89192e878e3f0dccd3ab9fe8c3a6f71db0a1a057263952"; + cipherText = "e1f83aa462078536b0858afde830c926f55bd648992b70bd462af86179ae3ee08b40e32568d7b696681f17f345f49b6599a6bde8187790091ff54071485eff546109f18b3ec40be3c0319f0132231d1fbc241cab244994244387d0f39bccc5679c7c7087d6e9533837f0c542bd40135d802c55d92a1354f279a497c3d7e0f613648d053f436fedf6bd6a732e7dbf0208e416aba16ebe481cf06e1709c567efeb2a87457f448dbd3ed6aed4ca354433e59646c610f7a035eb8741ff8ee3ee82ef6ef679a657410e5d08ebe345debaf38d4302100dfcb5bbcef3e41aeff86b6c4f855ec624042f44b90f3583d309b8537c7cea6999371de623e98c345c0f98b40ae6d0d3a324d3c9d138a88329cb4fde81638b9ad78aa829ec4c406f7f632366940e65c427f2e4bae966bce6dcc72bbefda32c545bc05594ec91fcb6a48c3b5bf0d67b1defb74cad01b3051493a6e05fb1daad9a3eec16d5d36d7d635517a73afc81c9e07f67b2d68bd3b85d7519acaec322351c4b2b7db15419aae882b5c68eef48053dae5d873f3f99402349e040ea6889809f67108f102ebe95c640b534e4ecb574da87663c6b7bdf777d796f5c2758826e7e54e33bfb24e1e715d6a3d7c3795d6d6b5d72c3ffc4152a53cca8839225d431980bd1f5917180f59b68f4865d21d482874bec0596908e32eee61c497eee3120108e5b1fc805424b379daef7ebf5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 445; + dataLen = 4096; + combinedKey = "63f36e9c397c6523c99f1644ecb1a5d9bc0f2f55fbe324444c390fae752ad4d7"; + iv = "cdb1bd3486f353cc160a840beadf0329"; + plainText = "9a0149888bf76160a81428bc9140eccd26ed18368e24d49b9cc512929a88ad1e66c763f4f56b63bb9dd9508c5d4df465ad98821482fc7194ee2354a3fadce92318548e8ce945208160497b9305d9ab1091ab41d1f09a0c7bfaf9f94fe7c8f1ea968f8f9a713acade18b68232106ffd6d4281e99e11d6a428b51653c0c7dde5a0f273e74ff015ce80277d7430f5daea8f7340645e0bec25f4040fa13c0b330693b10083a8b9bc108fe64f3a5b613cbb565aee2f09f5b204aee17228fe6531c70c0ec947d2a5147b45c51ac7dc8e85870387eb8db6251368368bf5f246b2957daff702e379022e99161749e6be8eb79d519799aae07c1831bd0ee72550b85333ab9e96a533e29725d7023d821abe1ce3a744be02e052568f84e6e3f74442bba50d02ad2d6ca58a691fd2439aa3af0c033a68c438b2d9a0a01d78c4f87c509fea0a435be71ba23706d6082dcba62625999ece09dfb3fcbe08ebb6f2151e2f12ebe8a5bf1162c259f202c1ba478b5f468a2869f1e76cf5ed38de53869adc83709e21b3f8dc13ba3d6aa7f6b0cfb3e5a43c2372e0ee60991ce1cad122a31d9397e30b921fd2f6ee696e6849aeee29e2b445c0fd9ade6556c3c069c5d60595abbdf5bae2ccc79a496e83ccab95740eb8e4f2925dbf7297a8c992756e62870edce98f6cba1aa0d5b86f092143b16da1441547d1d42b8006face695b03fdfae645f95bd6"; + cipherText = "0eeef28ca159b805f5c215610551678ab772f279374fb140ab550768db42cf6cb73637641934195ffc08cf5a9188b82b840a007d527239ea3f0d7dd1f25186ecae30877dada77f243cddb2c88e9904827d3e0982da0d13911d0e2dbbbb2d016cbe4d0676b1459da8c53a9145e83cf42f30112ca65d77c8934a26ee001f390ffcc18703662a8f71f9da0e7b68b1043c1cb52608cf0e69510d38c80fa00de43def984dff2f324ecf39894453d3e01b3d7b3bc057049d195c8eb93fe4d95a8300a5e60a7c89e40c691679fbcafad8eb418f8d1ff7b91175f8eb3c6ff2872d32ee4c57369e61b66d166fd0a43457478275fe14bf34638a9e4e1d25cc5a5f9e257e617adcdde65e2557405362c891e6546a6deeaa8fc03b122a55874d33e0a773523468325ec24d4faffb63c052c811a1c022bafccb97988b7e4567b247d4044b052ff73f4c671d27e052e2ebc72d0057cb217c5259b60950e3c8b3d9e3e7630f9ecbe548b9e36220f33c2b4568307cd0375bba1335e58bfbcde85cc84c9c9c1ce74f44b28ea1b697305bb6ba3b464e5ab74501293ef9152c0f5d3307d26a1f0741c5e5721a713d1b86c1808211f57aad09a950b68630afce4f0ad9f32e6769b5fe31929c446f7a3355f45884c748c9055415e637d9ad87d94c4657b1ad034cb14d9a72ea745fe52d7a711ba41ca035856a5a4489a4270bb30d5b63f49c0512fed4b4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 446; + dataLen = 4096; + combinedKey = "d329bddf0f65f9bd432d4b86fd4b759b0521ad22ed627f012ba461503c27b32c"; + iv = "efb13604cbad8ab531065200dd385b46"; + plainText = "333f807e923c021f3c8c9330da79c4f9961335b37ee8da768e9bfdab68c5a7eccf23f7430860a18e1d0b44d80e10cfa92d2eb33f376e2ab62ab271800a07648361e965be9716ef37d91a2a541b271ed3e2fb1b13eb01deddfa2cbec43951477b2daa568d8a8f84bd97fc098f052d50f8583fd47488cb6624c231461051e7f82ed3370aef8750156f75376646b4a1fae492f9ca1b02cb3249984c3be8a577e886ffb4c30d59df02b79307cd67c9a602d6529f0be432df86746c1f27e3e14a67ae2767b25f944caf686d757591e0073f847c389d8366a252a72cd6336618d1f2d8d7594eb28aafa3c315de45812df03674f5f8ec06a77ca182fa0c8b986aa6c8627bea313ac4e860710f25c8cccc55527bcb47547ac4fb200a75f29a2b2d95210b8f167fdc05f22581492f849c02afcbef8c3d71417fbabf500cea0d8d2bff0f1ae3dad53bfa878f720176f29c93eec3b30c4a98713863400d4359a8bdd003be8420cc1ca1eeeafecfe5f1e744883e2ecb004b6773ab6528d6817e4e36a8a4da812045adb5f5d8e9756d42ef6a8fd5a533b9d65e2158ce93fb19d124762dd93e44ea5d248094c7152242dfe2ebc0c6c9c6a03005e9c75424048a3ae9a21cb6d9d33a4801d86cbc8853b4882940e32f72ddacaf0b0bc1598ebf8d1ecbead72443b3298c9191978439c10c1d634a52ed4fe2232f3038d9ab057f22415cfd312f9073"; + cipherText = "a2e8212b9e9046018a54deeb7dc5579419aae24b0747759dba551e3313f8b772235bbc5c35f601033588c2b4a1dfde9ab1b1291a129571dcef6e9093876845331c5d08ccc6e7c028c21a77132ba04d5b98a64e9c99342bafc7fe67a690cf6092653ceefb4ee36af46d5448403c567af70af1c2a1e5142d34e2faf66cd6923a1a4551013efc8a251b194616ab7af2804dd0027493487a66f3a548c27bb4ac628c56f8513d291e7fb3aa01a9ffb6513322e09daba71ce47af7673422033ae365bf795c1a79f02ce953be0f07f3c37321c7e143a75092d65f18cb8da7c50893e82d1fd0db8bd63d21c7fe40197c46554ea26c624682c1d0d3f633d39bb4d1b5636199463bde21bcecfdef8155030fff0eb0b1d4880935c169097b6404dd833a9aff2bf6c5ed8a0d3d09d746f21a5db79483d4f941a6d07ee6d1c8b0d8248008b4988fd6996345f0eaf1484fd1aaa115a96aec8f7f24753991c6f8a19129d9e9de207e430e44d9ea32d10eb7f1d68446990ce01748e6c121301e611af708005fd828fe6118ed5bda775e246901e9202e54a4c1c28c91eda3501cc1cdbaf3d75364fb9e21f4444bdae5a9c6e0677e6e602872c3642f9b767f325a4573eb0e0b8980b79b7f36e83c53465361415719782c5b2d75feea722dd05ac013474921ccb9640413ff30b5388a73a2ef9f73aa21c540f45a1f4388432e4efbca6ef5f91644642f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 447; + dataLen = 4096; + combinedKey = "761e703527d5cb0e4d5d5ccaa7de80357d9d2427305f9324da52be65a629cda0"; + iv = "2c25a401c622815b0f4b02f80e4de3c0"; + plainText = "1b650ab23a53d31651223e78e73c436579754b510856ef97f936e39b681a2f481d5d024550347b9a4fa924bfb1c823d62837187b76767573dd3ce42603b907ef2e7a0ee8e380c3e56f8d8fd6a363c14bce305b5a33fbfb84039cf9ada37555a9a7672a57a0c5f2c97000c8c31a8a90fc8303f585d93e8d70459d728b00282e6bbf36487efdc11c413a5a57e9361998b1d6086b8cdb0885369c657e63cf6f907b5d3585f7020a6aab49b2ae35b7b57279ba01bae638af867f2005480de4b2f65890493cf1d3c8ff9cfb452d669917a78dbe255350a30960fdee1e1a7a1b93f6dc77802690808554489587fa48c417f9ff6866bd79a9a341fea71449749048bd62f92731e7f00b19d21eba07523c4a5f13503d47657336d582fa5d2d6f7cc4ec1dff8c035db0f81233e77d0fc3cb463189cd9e4730b6fe3a42c471f1c4392dfa743cd1d19add570ab78b12d8656b5af3970dd8dacead6699a977567b4f93e255b3ee5850bbcd8ecb3ef0f637b80832bbb1a4053809a17405bac95ae7d1c5c2672c687def6843e8c4263568074ed25feed513d689911f486ce81ba9eb514e5d70b1ce3071f5ae5fcefabe9279ce18acd12b79a337e241cd144126f169d837c37f6915841166ba51cdd5e4a3166e74cb8bd545218370be4e04928143a90f45720b2d094a219eec49c4d4a76b93a6f4c0d1db4a0aa7982228fb12030fad3c19733c50"; + cipherText = "d9d2b09aef911ce3e2c44e3ec6a3f08c54ea3f9218c77e42461f0831e01b6ddca1427f96a0be22412dfda024387afe8a611af66672337ffb5fc389f68b8ca4a5bb13d4f23f7ed182a76e8b2c4625da9a7bc79b8255d8789ae2fe6f6bbf057ab1f7dcec56713bbff8a2c9638ed3cc16a128b91dd3b6e39af9054f28d90c4a2ad81741f4c2a870715677366afaabd55ce764e137ee714fd8893b4ac4dfad97e64fd8270f8ad25c2cbcb686612827eb1f087fd4c8d3345314e4fc8269ba2d7dd021d44edc24c793e9da95aee88eac2b30d28cc4da7dd93d84ad109e5090d46f9d5ab892089a390ede5cac99ca9543315090c4cf8699bac9b7cb09f0657729354bfad77c1975370dbb41fd2720ac03b232ffa083b37b7906bdb5e460f69cc3678ba12a2a80a4cfac9f83a3fd0a20ce29b2542ccb8720ce791e521b7e0231ad3ac140bc37f5aac40248605ef4254bfac76ffcd805e4ad6971da7414e0ed9714a42a037f76d845f31fbab487e8c1ce863ae5c47053069b3e21f10416101c3f1b16d658ec8e7be35bb2b641fc07311c07557f57dcfca510a509e8fd5588de6116fbedae3cf2ebd2e27d02b1442ccac688200ad613b4bca1c788cc3570a1bacf26eb1662ad0ce3383b431f7887b997ecc2969b9a2f8dcfd1dc27815406b5ada7de4f35390110441a569e5466f21e44da300ea345c9a9a75c34ba8f5ab76c2b15f3c1838e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 448; + dataLen = 4096; + combinedKey = "5d2c9374ae9c7841298fd424cf4674792ac1cc87c682fa7a4300ed05e963aa6a"; + iv = "1a7ffc137b7e5e8dc7f5e85b5b71b9db"; + plainText = "8877a1be1107212ea60a8ed6eb90d11fbde9674c30a6b2048b1779785d9cbd9b5cb7474e9d4b1a5a90eccae78298aa9ec88f61424390eeae1574a5966c03cca83daead1d997728f8551917e2f5d904dedcc4b55129db2e50821ceedab8a0ef939a62e46f29d0fde273d5ad3ca64362726429957df35166beccc62a2c7ab00da68fe46f33c2726ad3eea4d9fdf36cf5c8f6d5a3efb120f8953cade6f0921f8d208f921e553c935012211fe3879ed9c80eead065849e10567977b9bc8cd20feb97ca5b9048e4ebce798e7d8598763175c11b48afe3b30c8d5e8569ed99643d7e932626c261ce4fdb59b17590cd23b224aabc48ce33519db10178bd03f1392e2f17396243699ae592598e6263ce26d7e7703ca89a38ca9787a0b529bf830fc3592a9f1da7e6064f9995e5c05fa87996526d51066548d7df644d96485bbe9ce4658a0b352a3223fb68e246388ebdf65d609ce8fe062fcc8eecd6809db8cbca34d460d2de5512b06f9d8ae76c155146d357af86a558a71052f167c035fe4bc8624b4bcf742a9836b3d963425075842734ed29306e1d6426606034f4fd72c3a3ee411d344e73bb88a6c0fffd6571f6184e34aef63564c46731514cad97303cd8e6db1d883edf5902533c036389d21697126e4caa7959816715ea2268d8a6e403b8c453e998f033b8f58a09b1a312f7f5810c84e629d267cf3fe9b762ee29ac9e58adea"; + cipherText = "14a7b4c349d55fb434ef5c1ae7b617ef06e17089eb4484e12c8d36dc69ab1fa725a0852c6d54b079fbf7cf7ac872ffa04699201868a4fe74c07fbe15fe9107d7c78dc3af21b1adac7b2c4dc82e11930e792c8ad8ac1582897bc1c337b4daabda7441bff04db274f1dfc09d1f9e9115f88487c7303d041f01c13b87162b55558018ec2c8917a2e1956425215663ecec3441047894bbc201430446e4324f757a4d2ec3cc07cef92633e3a52441426de90e544deb64c59b368c6ed0dc7c3247ba9ccb352d840198c43788853111527fbda0df3745d6e2a158617987eb2f16b06c9140608f29023201cfc6768a8a8d0cb43aa3c2b86d3cbba4dac5f89c30170424dab8359e37c7dbab81ca2f3f19c5bfcda3c85e5246207781a4fe5c61412cead9432ca010a79b4115c3c9af88a38b8bdd60326797a507345070082edc50bb0b45fbc639b41bf2c605388bd4c86a4a4572b91719b6a251966962a416afa2645299d2987883959da4d9204ae26c0fe327802bb4ed4490c991b60d6c29e1771ba3b94564d692a3d9db696666a20a776239e5db4c2aa74a32f1191e5c384001c66f295af94daa437baf492b4331872eb95038c4f807c4e0de729bf19ffb154c2a139fd77f9360b321f7f7e07deda0811b997c432484b23494dac0f5f5bc569712201f5b7d6f167f51907ee6ab92ce509ff01edb5a308a1e5ba213e95ee1d417acc0cfd4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 449; + dataLen = 4096; + combinedKey = "0ea29ddce38e5f3fa81c1711c1a4bede98c99f41f881553ab792afd5f2c770ef"; + iv = "0436d19307464047daac550478fc72e5"; + plainText = "a6e9cb68790d2604be0111dd3275e3c832c9cc5ad9e8b4e51c4a6a4c8037b71a10379745baef007344727b24cd385846cd3f8c083c4d3bb1dd6ddfb678c853ff274ebfed03cbda1a57ad0191259ecc928aa519a75086cc5e4c58ce8671f90981fb080a93d675054d62e302a4ec844034f66471e7c364e200c9fa99dc91ea0fb542b0bbdb823de9117b9dcb522264fa72baabcf277c51bcc9febf3acc00b4ac2939cc87bbcaf74ecd4441f0885c565721f3dbe758463e6b5f477e7ab337756b0ef339b73ad6bb392b941b75113044d0acb1299b4866c5196432a94999b9a03d2c9befbbdd877e4e4406923e4c2e910ba3398e0329b6f71a1c5d0a5c07d541b332ba1c5f7b8cee90344c9f19a13a50a2faa24d000c57f339677751cd16c7a1177d82b898e246ec71b5425f8b1ddeda09e355ad0ccfb4f83a3fc925da514bb3efa9fc70187d9e3306abeaa825232571dde735e4c465fd02d91d95660323c5e6d291c948e3a1c0b5024ccabbf18d7c5f1ec815ee377210a511f100df5ba56078ec1deb225dc2571138b312f1d94cdcfbed23cfef63e6d044a03e605df9da06a2ffb16fb76d2cf5f00a80cda5e7d2e62648d3a52acf71b6a52b67a89aad5958e9bf632c9ab826c5835e09a5d86e3ef7dc9a2ba432fcf7e14f0c820e99962e2ecbbe9459de1e88525f8f89b872e8be6e24d86500a815da93a69adafa743e1146cc542e"; + cipherText = "08992037c310e72fca400a2dbd7a16c698289b865c44dbb92cd6ab6644892a0fd6efd8926b76db155c826d41168565b2331fdf226aafb0e0ba3ef57848c3a572ba333385ac3c99c40583fa2ee4382faf6c7b71b22f753deef71a29e9da18f268bc344f0f581b14c90b6aeabc375083468449728a92515dd0a9011a575158c713456514671554a2460ff92ad14653bb08db1e99899495dac231d67174cfdcbcf003447cee88fd0f3f856e4b5c13fb4748a683d5f0a18d203839d2a8b451f378e8df3b29f0bd547a9a79ae49d22f3cdb422ff28b585d998702614e36afe266c22f90cf199c6866dab73ba166290059006dbee14309e72a1a2eda6ff5f3536ab6369259c6d89613f8c142616a2019f1d1e3f2c041ce620a85ad691c069a1acdf63e3e853a5b99308ef154fa97da85677b36ab14a8801b4e5f9326118caa4dbc4d696c094c375a845a02618aca6d7064fad2ce7a4ca986e4e564e24ecb431377ddacc7f2f342aa76ba9bad95240fa0179d6e9b29cbc849772586a2e8c96409c556fc44dcdeb25a6879f0d98962ae966f53eb074571b8a85668ae24637503e8514439c63ea8cedcdde9eff7b6ed3b848518ed84139d9a56047d49b50815ee79f4c62c09eba5fc8c16b2549af052c6b009564705fe075d00f6782c907d278e8f2550af2512244128d9654909da3a938af025661c627d2a7534b5e95b123555f2969857"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 450; + dataLen = 4096; + combinedKey = "58c14db27a299bffbdde0c0529ba2ac7fda1f84be1dcbf4eef58502c03c9c7f6"; + iv = "720020ad848ac85d0a5b43ac595fac17"; + plainText = "718e28848c324ed5dfd8dc9468468c12fc0a40b335de3c38268090643252489b836e9668c8ffa4df776dedce50ce87ddaab701b5339b268968adf959eff4d6da120234e2cb85c4dccb2bb23ddc48fc069b89962f1c81f0ce0f266f618b34391ea9a19061b85dad74661cf49aa0fbfc663d6395dba6749dc10a6459b8d089047a8793a2ea5721e2529280aa85b368bc430b7c9abbc1a0636dfe0cc553103c587c8cd5143aa59669d2fe22e9f11d863d002447001f577bcfc773e6d623f99d0cf601475622f0c8557de37590feb2a0be11c26956e3b6a9d6ff6a1a068f7cd85fed3b16d36582f00735909b20fb3015e3335a8cd4e94495dd4e342b1008e93648f65f0d2c23921c2121da259bec99d3c1936843766d39dd603c58a7d33d883e6742f592f4daff0d341ffcd871dd40ebdf6b16e375243e202741c2c4377f7e905d50751f07b47bfa0ff951343ed85cc968e1f3fee004edabfa1ac191f2a51c6b5c42ff6d466e34cc8f7268ab6b5c61e10f7c8dbc9a7ee04572f4352cc20bbc602d1251b541999dfdd270767cd5e7d9a25c21d4d2f42ad7f559104fb24d8f272faedf41955222cd663569df7f2510d21fba4782642b35f0b0cbe523b319866688107c9c1a72ec6d4ae908c954f0da0d0897b3ff3421d85078dd34ca2ae09aecc22a2bad46e2278132d63f86639286b69e4cde9a5e7dfc280cef5474bc3c6ce5d4b4d8"; + cipherText = "d7f04fb633d71e6083f3d1b74b958c2d2f60d53b0b6fcda8fb50d50dfd46a6212a823c378d37b50547cb339981c8c4978bfc896826a702138623bc96e5c15c07db44a2c10f2e1f054cd9382d236abb43affd23fe4fd08afd4a2c53166cd7a1f891b777a5a4d3e515eba0fb7fc66175c5a0eab5f81aee997d55221d668d63f1e8aed61719e306b464841e597f69cf451288a8ed69a6275625047e419f77137bc39f2052f597823a786036969297d0114e1fbd4378c66aae396aea952b72473c0e3527e8ad3c31991027a95d7158f74f760bb927eea8576809b453928f5895164964b77d2bd1041ced6d9f29389a94782d8a35078cf36262d3684d27531b111b3e8632920484897a9bd8e49a14e06902057875aa01761b56c0c6a6acc73a7f3c83397d44474a31be36844170f43b74bf3302221728bca25b4752d3784e38be0b23fdba97b07e47ee4c2b383b20bf27218b1409170eff778157a8db1a11bf3361a74748670a7bca160cd38279c62cd9c246fe93e1881230ad03b94a6534f2d9400b7d294dff95815e1fd42c36329b1bda3e1228a03d08b9c9970ed75c9b4faa17debeaf33fcb11de001771a7495f28ebcb484802f9980af20b9fff3f158daa03ac1d9ce842567716366a185d70d20039269ad5d010d40182db8b31a569966a1743eccd485314414dbb692c5d4fbecbdb44f682a7e2cafba122cff6615c7c9c913be"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 451; + dataLen = 4096; + combinedKey = "150749cce3e42afce1870a505160617289896208884e8a4c6274af0554dc1932"; + iv = "e59898eac7d4ca5dfbf7d925e05e5b60"; + plainText = "ae016a0d8c9e5a6eb99f6eee3b2410cac9d8854bcdee26323ba48fd7576782baf7f7d267b8eb19dacd66bce1b3782e09ddc2f2cbe42190d3145714491b953af1d97df4e6e5e9f9d072af492c665b817909d9b0ebbb32d82aa1a4546f7e46bd235d9a195ea2a0d0242f8588547b80c3dc92b9370d99ddf76b5b5b19ca5a383a3591e905729fba1dc9819ee926fe0dfe54ccde4f7b135ad026775bb8f283ddc11c6181550fb2bbaf7180bb7d3622c0f395e4eecc90f4fddc9196132a09c3ede1e2d30c597594ed86c6c0e224d06da043d2d204afb33c02d31eae39140dbe395a99fe5c4f837cca2f4ee7d65da874c8a4a6ff4809c651f951146b2ee690461d6167598f0f68873e6642530dd3c4d9f9f0b0f28c093fc70f32702fda30796ec617de02af942fba305ee3829a336f6971bd214eb5ed05fb34a31b2ed757bfb3222f16d7c2f83bb23868fb1630aef4a4547c04bc7c5fb748fcbb5c624a4403d16a9c04c8cc01674f07be17c58ee28ad3cc2f9b8c8d756e20dbfc8c8a448872a179760dd89f0d0835bc7c51ead1763e52affc043b97656ee878ab5d673c24fea366e7f0afd1bfc401f63c32f39eb7db151bc8d9044405320b1b2d7fa7ffc58d8cf9952dff99f43045f9b6aeb3190293b624ac7886ae90988a55a91aeb65eb5b50e8f8f56d30fdc6b4155cd456785374daeee280a907552e1f6c54e1564c9c55a0bae26a"; + cipherText = "e8056c813505871a3d6883a61de15bc587bb80b3a027168a1dd3398168585c7b7d711ffaba63e87bd0347949e299ad3441c29239ab38694917ff4b6c6dfa8217f12465a0d4a118b60964f1fb90a8f1971328f80614a344b6a2ca23ca7ef534495e3742beb0095bc52b2a3922464abbff46987d45c0e4b8ef3dab75437b933d4336b633ff6afa50b38f3630f9e721f4fc029f9ac0bdf69224f99d5fd6972d2cffdf84f1a5609f305b0fbc82ec30a59ea701172c9ec635d99cc3cad47bffc09f36b2e6d171de2f33cd1a15067d54832483bf0ec369001b25449404bde4a3cf108c8382399ef4df29a5fdb696d22aabba2e03edaf72d87c47103f6cd77421ffb50c5565a78846722c4ada563b00e27840e6dcae11a07a70bdec9a9ca9cd7968fe4241984c3aa69e8840b25f8ed2bad0672e2ecbe83ac20e023c3711a2fba4a9a057c35e7984d7a0c611864cf7c370af2ec9fad699c20bf7d2132f5671c530824042477568a7d09b8d6c476bd8ecb54b82d9cdd576718a00238c9147a57b9741a2f9cd56fd4ac084ea0c0130d22015ff7df2f2476145e88c41809b71b72db9a299c45494062295e18a6c6dc2babb9f408df4ba762ccbfa250bcbf3e84711222fadaad3ba228dacb814fa33fcb5788dcbe3b69931491044c8179bd9eba3f075bfbfa3b021b55da4b9201224d25e71debbe23cf3d20337efce6fbc3fff084d1a5cc52c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 452; + dataLen = 4096; + combinedKey = "4eca1c6d8f714d5a984c433e8ca111f1ecfb63d76fb0438165060a24449348f5"; + iv = "c81400d25fb8fc7a1afdefef25900755"; + plainText = "4982dd895c13936e25d5f297cd2d0883873b93b42cdf5bd31f488f48739dc0d2ed3b717ff8fb131cb7e49b211ef7b6b992f1f665f11f9262b60a580d8ad2157017d822a91fbe83054187b0e2ee0167227b419dc77bc9bd08d8255e70cb49e27f5cd70a341e81e25e91c844e14dfbf59a0bda33da7c341fa80728b7048981716d389c25348417b0eab25d926d144e1f9ddde66f139e23fbfcff0585de9de9861c869449c8e40a8e92bd544b7348cf01382cf73cf66bc631c029e1180dbf2bc1f2c0f9daa0cf4a337a6fadd73f90af9c1fd96ff9e1c77aac0146d3649bef25530f173060a560a106ae310101d7be096cb8998435ffbd7e71b751c4b906e7664b32ee3cec3a94dcf2347de60d58ca3d3c877b41cff0cb3f5ad402641796b89244dd28a1f301647716b6acee221281618b581b87861a55cac2e832ce8c5124b7eb7a5359642333f2e82885e46ec8533b05947dd8829a54257f97059d0fb0ce8756bd1b26a2203b1855afcb05303771b3932ab02b1916242ed6aa2aa8bb23cf03ef0736aa53653fc1186323451c21dafa4ef651a76757660a2cf16d88ba9935a3dc37b5995de59144bbbece36c37252149e69e8daf5e1ea53334e25c7e0c95542445cebc89ec09a53507a1a3491c8f3296e4f9175afee1f4f9aa8b50d7867f2a15341d60ce769913b283af5e4b1e0b7d0c762adafeb14b9d2d1a1cc9b0461375f53a1"; + cipherText = "080abe02695a811881e3279aec7f2831c74f3ecbf4d39161763b9cd7ea607df6e815610af8e70b82358c66eec734a59398a64d3b4bad11c35298dcea0631c48d0b330c9fc4960ceb252966a6cc1c49507bc63cd216e7c511b0072584b91b2576951d51302676a9ca564bdb207fe2482818ab471ae34bc885ba945e2274a1d736ed229f5182131135c98e1712d61001f464a7e0249a6ee0d31709b1bb907ff81c106ae5dc94fa5069bddb17b8d5b6f9dd1f69fbd482f63eb1e929f9ab0b3bed88619588fdd97bbf5b50b186d2e04e76dd4d4e610a750df1215534516c0bd673a7fa66be9fd6041ad3500656b6c12fc3894807c2bb43d298f9982762bcad2354b265711805d018155c6367bb7cebcb1025c00bc36d9ec4a1e446980323036b283386646697c87b333e09f232ed4c71d8eb613876be0ed0a1f8c6a63db168b866c365d6afdc6e557dfa5af9b098d28a0b133bb0f6e22f2b62e37bd0ba928c6131079a537bac0b0bea4edebcc79603344e163efe6bc287b7684f90445c89325a310d51080bae9c3c9075014c341e23265e43358953e1b104bbb48a83a96e04d5bc4e41c48d3104527b52d9913773d288bc7f9f1ffc2665e04eaf97b1d8855b53e5a7f5eced6fb63b582d6cd561463c23bfa7ed9bcf89a268b0d926c63df361d6486ce18b703203e251436e1d7569effd25bcb426faa2963ce28f18fa8f670bb3c36c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 453; + dataLen = 4096; + combinedKey = "9b19b51343ff130ac82fd0cdad6a336b3268e235970681bc583a0c2dff3292b7"; + iv = "1c746b49e20eef3ace544f1d03d9c376"; + plainText = "244717e3bcf60665394520ab142d4815c6168f5c5fb0165f680ea5d4fb0b5283c98af61e20ac68eed7b35b4e502fa638ebcee8492438595b8d34ebd59e98c2455c7db01ce6099be88a97e646f7183432541dd85e34e3480d7b1552a896c2f176f93359a8d78e20ce27193fa1fb3a0fee214c7ebe1f456b187e0caa3d4e7d8ab428e27776b751ed8f5e52e97dea116d889692772cc9a3e457ffa810bb4d527907b105e235b99fa6027735d7cf5cd6aac6c5835216cd61b0509c0d503723270dec5e87a3d6f17f7b856af4009ba0519db757935a158cdeb8fd44d6acd0c8dce64183d23244850d2e32a2027114cdd086b66017ba0062162c0f428a74320db5d7c128f14bb465cf541e436252d9d036d4cd5de6ec4445b232784be43258a826169e8b5a29027fa00c8f738bade9bdb0a493d6de7d2b4ac096691a3f44eb203f00ecbfe4f41783f73d5bdae6824ff17fd1325b2bf323484505612f241b4dd00e236884669d2836e02c6d33c10600a88632f9c4e913200a4dd5ab8f95a9e9e2678f7d2fe48bb408f6bbcae754ac6efac7132f4f72dd732d9349b4b63058e7e59ef4a9083ec804d3006b6a04ff8135b6610d60220e6b1a178357975e18525a8841f63f4cdfb2694ed6b2be2f0eae2cb93e67d0c23c8fd4350a3c86b63a33e601cd861de3d2d3847f2271a58977a912e443fe5bc890618764e8045f72e30ff7b988ea82"; + cipherText = "08e4762980117ab1d93af7bf715b45ff537381c1c137da5e6cb3c7044d3a9e381d2843045d8066fbda079c361701f5ea8f1e210f1344c5cce62cc3288070bfb2d5565d27b7eaf3bb6b49470258ddaaa797d1038f44bc04c344811a3fa4d5e130951bfa647b868c5301bf6fc1e6c41d930e8a110a9330e67cd9208ca59ab8773a5f644f9293886aea012a54bbb02c1f5f980a68adfe2e1e97ef27a037e27870535dd90eea1ff7422d67fe49ec9b8f3cd4674370101c8dbab657c662ba634ad418c4b2738bf14ab631cce9cef1cf928341ac200ba47ddf07f9f1de101eaabdd40c2e796639bd42761c25b042392d2b873ddf0eaeffe4fe57f748a9034098630286095fefa29d973c5928aac22ff4706092f71be896a42cefc34d57944e3bec209ed15f381cdaca7877a342c174dc1a3b786c51ff416a1bc89c5e3efcc381d7f639046c46a8fce73d994b62919cddb8b0bd5d192ed528db51116bf3c904f2dd464b4507eda343a5a762ed5d879e0bdbe7382071bd2d58e3683b4f353f1767808667a1595d53a50a1c897af48b72810243832d77f52efb6c2bf888d6eaff026897e8f97abcd749c74b1b976db6ee37aa12a41c8e52f9da88e87efcf520ec5d18d4ac22e6db94a7a2cdcd691f28f199983e07d1edab87c30299440fa363e0b8a4c17a470dbd03121190c7a3dd5b9949233fbf5f26dc5a9d35444ab6e7f3e1b2e671ed"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 454; + dataLen = 4096; + combinedKey = "620445ae99d4ea2d69bfdb15db5f1936e2e5f3282b5ece7b6d7ff2ed817d2a87"; + iv = "89131ff75b2182b8f5722a83211f95d1"; + plainText = "9aacb02b70641099a837d735183f9ab3941959a5b84d50e5a72a4ce06e2e28ff64f1d3cd287a96e0a2df56d7feacd2d08c991461dd3de814d87acfa4411f299c0c4893b8288eae0394bde34379e2f3958c5064b66de19601c8443f7917a7153b146636a97eafbd8fe9b3a2149241dc04d1b827563b50024eddea0e036e9b4ee048eada50894818d53ce7e808a018382cc1de29c46323e7d7e6e99d81236396eb2d899f447a6d658959b23c115f883e15c69f8867be3e9f0edf2fca6cfd8fe9b42434ab08174f6be037454f17a706387d567266ba6a075d2f2a21c5c0f4aed4ae125a3ea58a3ce4d69578da7a5a6ed9f1aa500a6d7db21908783515142d995aa391ca9556d327398efc91d79cdfb978b8d014caface2ea6fc09c4e73a71bf51941f64c26cea1236a3811437aadc32b12d1ff249706e6cb5cfc76e63a7e11dc257c3172bdbf2186641bb177c447caa879246975a2629d87d4c351784b7840e14f17c4e92c9e1bf13b9d974b06ed22d51f38b3dfb135cc1e4d5bc35740ae681dbc79425a91c687150b92e54f4c6b02391bf73386b9482c8ecd933ecac60d5b5c6ae18ef83627d6765f11881489b3038c102d0c3d0a6cc979a003bc7278fe6421623b0012f6a68c64c3a323572050f784c7fca24775173a724c5178b9d79764e7cd71477bd7a8653f32b438d257785676ef7d5baa3cbea61d98a767e24ed5e30e648"; + cipherText = "18e9e036bc18beb2f3dfbbfd2315cc8d29b779f3ac62b7c5d99c72d35fa474000558f42ecfdf23640e728dc33d154b165ea5d693e26ee9ec2d4c84fccd48ba3461f259f66f34b0971dd663d87935e6e203d308f0c377d059da59760fd349aca50fec188f83ef0b58b8c4c66381220fbd7c1d9e33d26dee44eeb1a93230b729e4216352137b62f7e9596fbd5d7771c573afc75cdee311c8ceb71fae2384ab2957bb46b6b2846c951d1b4910580cea3d8d035c081b23682cd14eaca82cc0d9332f9811a40467aa786f7460cdc3d065220c0ea4d78b9519e83e6f45cb7df6d7e3185c7275d809f23207459e3b00ca6fba649f15f7de4d70bab1dc084a2788f13e702ae5871a7a053c8f31c5127890ed8d14c0cff44d88bc757bd8e0b851682f2e277c27699aa1a0e4eb725ff549bbd7f0631579c2d3d99abc04f63fcf7c67f6d0f12a304792d707f22b6b550cb1bde8098456ef3260867a4212c0f4dfbdaedc512d3805c63ce975b8ac3e7d0ca185a7b0f03b9649dbe6d86d7bb74e09fa1c810c230904528bae2290996e66403b836f4fff4bf85b4ce0e86e86ee9be2e8da04b6d76ca3ef313a580d5bff465970559b3e319a97433d19a4ad5be710e32d02cad0b39b793cf8a4f7fb0e83fe9a0d57849aedc1ffd32877e7c17d157e3e51d488fd6a20853968acc98885534c2006ace509ebfa246010591a069b7136f8db13c5d644"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 455; + dataLen = 4096; + combinedKey = "0f192d24992d89dd39b84d75c0296222c04c5f0bd2509dc0f6cc661d601de6d5"; + iv = "3014ac0224ac8b5f67debefc86c7151b"; + plainText = "a4feb5b9be236b9a111b37feee5c2e35a36bcd445151bf63ad10e547c4f46d7701ae72adfdd1be3e16485d813a44db58ebc500d8dd9e6f2f2d720eb2090f4086bbf3d19ab0449c881ac0f07b08800f3cde46e381cfb4ac2d723ecafc18953697b0840a0548fc4c3a9fd6fdb5449559a8a6845b6fc848966055572dfc5df964482dce26c00b7ed25b7ea44783c352ef9ba784f0609012c7ba4179acb8b57c1d75ccd5fc0fd00bb25980317c63c5f07550619234c79740a620022234ee4bd68f068ec06acb49be998c81f11f7a10693f06a2b676699cf46f1d24f9b6a718e83f3b101fbcb55012607d249eccdb93f171ede327e207a52f9db43fe185e05b6425e03f77da25e2671dd85a4f716b218bc916f3f84495a959535ae58e6c8d5923298d1265487a5898913ccb6c9bec7cb83f7ba794db55128aa001406245979e79a86cc57700a250183c37700df7588661591776b8a33f1b4a2b17a1e0c7c671f2b309083cbab92f00b450db94103b38bbfd0f41b0975641245203703bf29bd9bf4b4b2d0c607ddf059f699fe0d38cbf79ca76d03eaae53aa37d64cc8f193533ddc125069245ecd62f425af8a80c193dc6c19928a18557ec73c74565f7ac5b65e76702e89cbedc6dbcd4fa37770fd72fede787706276351a5d5cc3d916c8c66fd2242baa8eeb16c94d93f723fd4ad42cad58a37f11310033df99f3a63c1cbeac4d0f2e"; + cipherText = "ba97fc946afcf0df8500937bcd5b05eafc287a9672dec7b007afca36454e193672b52340fa3fcc1030dae7bdfa781b4bc2e0b626f5c9114d61a548698f2fb70353c21b6a1d0fe11177cc7c0d68e8f57806cc9e1e4ccc4f75be918fb27993ec0f4e6b0ff7408da219f40cd2d3c7428f29e94d3b4714337379089dfa70fa98098ac6e9b71a11feda2508e572f2bea3b2142058b68ad42939d52d125f00960d8dfc8ea12572ea3bbe196d0f7e0fdf73973d66d8268f93045d51f0db7e3a2e23777f5909d02a24b65b6a4c92c5bf8e03d6f2ee8795a09112049f656a187a236d9fcf759f303ef7bdfa38521a69ee09b9d59f02d0b2630b147d56f675831db0c6aca786d187741ec51f63d3a37393d4edaf208518e80599ea390a1ec5f815d4171ca21316ca9f404917e6199b667ddc17b8986d061bfe9fea096042dbda3368236d6c29e3007248551359c82e9d24a50c7f911af8ca5bd79f03667c3ac26c8f92c2e911f5ce0617416383d28394949d81636c36f3cabadf3d4c39b291a5159502c9ca2b6821aeeaebdc4547ffbafa65403af21f829ba0dc4e22c72b90ba8cfb888c6a11445fa67200a8ad8b26d45609c709884269127cb5fe9c3cd42d2f9c37dc18e93993ab18387f079f442b4f79e357f3dac7a8030f1b0ca78a9d9845b02c72bbe5cbef500803094725a70c485d170a8950679295e9aeff99ee43b90a52771a40b5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 456; + dataLen = 4096; + combinedKey = "e359c727ab1b2f74b580e7f1ae7e289ef077394dec00dc507b4469c07f384e29"; + iv = "86b9960fafb71133aa154e44daa793f6"; + plainText = "aedf9e3dd2d63079ebcb75f9c8b58e6d99aeb56abf08173000dcda2698838e50a2cc3597df320c153e6c924e65bf6c06f64b81d679545ff7e74e75069c718af7310db41e245572278b0702e2e00dac02731fa09a15ddb153030f40fef4be17edccbd70d9250a10d6b4577d13beb13e16977dd72e4be13e9da9a1b885a5281d9fbadf98f024a41274e313ada52786880ea1732f6ee872e7f95c18b39d2f82cce69e4f2a6342af7923524a3ccdafc0742642e96d0545e9c9b8b4aad06d41d9e429b953e9e8642d7e13b96aa19112039caa1b524859915c69b464b511900aea286c2c70e4d2f2cfc1732690c00d60b29b24f4f9a94303855043ed294a43ea65051ea4f888dd9db95d5deabf2e09d4c7a5d087a7c629de898806ebc1eff9c174bb9cd34f53d0f50f1979d803b9ade73625745287d44c76bb515fb6d125a01ab1c6eceab5ad056834f56fc7fda94732acdd3bcc0f852977132db9224097d57c02941da5debf664e52aea46808fd3ea01df72b2ccb0d72a31a34c6fb0f82862b311a9e2742baa38ecb151086d2144a3d9058eeae4d6192cca796a33f2e533e4a95e2bc38169e464745f4199089afffa723215c16a1aaeba3ec2c573a333294f3c1363df53701247ce0172a328b11bbaf618ca2defc1cea9e7a5ffca479c68cc3b0c8b7fd2d69a6e581291b0fd492bcb86da8220eabfd9493d05a4f17db66ba2c64a621"; + cipherText = "e0c13b270a3836186c58af8b70ce490ef5e9ab70b3170dd6357656410cdf9170db0426f1c5140a0e552a5ca9a142a7208cfe457b9ff26b4fe91046c3507d60509b2fee525c0969a2c93c3763075b0b9f9aebf150e73564ca1f27fc3dd4734ed97acddfc31ad1cc80c01cb0e6c11b3e82fc15210c60524e0e362c855c54893940a62e808a3cacbffe16b4c9fb8167ace520b49a1c23267797e9c2b85c3bfceda3ccb4bd8c08d27b66c308b75f998def4a548b46421fd62d48a1817b5cacdf549bd91de0ed8d338eff9e60650976eca8054287ebf1e5830ae8e357153f91ee2b5c0f2d37c08e905d72bd6bc281eab034a349680563a6e843589085d27ca6a699418247ad4aa88b35cd0e217bbd329220d112d9db4ad30aaf849db12a6f81807a6b2124f92c53fdfcd8a87ee66a4d7a05dc46dc27e57133891a963c5cd96f7f8a5055ece23512c28343f23f6903c5ffe5935b4d48ba65f6ce22e0b9674c31d65d3b4468161b417cac25bc0de6ae7a86bd30c4213a0b85bfb14e52ff253cfb217287a878f50592e2ba846bc4f33e6ab45ea75b326a6cdb0b06af4590215f2126f30e3ab912f4e219b03b18c3768a0f30d5433db68b1ea7db4e2411dfca967383cf2d251bf3c629dff58ca413dd2cd4e7e67d2ff2c341a13204774c853a5cd527802217cc146967574e1f06489196e92b413c69406334f8e8fb9fea5f1bfa4f44ee39"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 457; + dataLen = 4096; + combinedKey = "29f18d0e40cd7ea737af3c9147cb97bfddf4eab5cc01246894182fdce042d521"; + iv = "b39a8af35dea9f7ad2741170d37335ad"; + plainText = "66a6e85e8760c8a64b977edf8765de15b51eb15aa55ff38048fb8a02c588fe091014857baedce5cba5ec1561d1a6e91391a7acf5516d3f4f5bb6595c90822b61a1addb823400744a3af34af4b5c6b7e2a6e85c39d51803da79e9385e79e1f44622aef6c0ea0642df08d0bf39e42177c2f309d8f55f6600151f5fa19deafc80a4b337bff7460ffd5936838f31c058dd90f1a46acb50d2bbdeb28144674b8dadfae367742b561d4903b8763101230cfb0753749f1c019dc37e511f8d2caff764d90be82f03c5ac3665ca9a1b2f994c3cf06ececeaa686d7c903ccd218212c7b11a88860e4c38447b004ea3e9a3cf73e16ac457f6ed8d545f338fec8f9d09495094069ba25cec6e97fd831ca07475209bd6e955845bb69784a6231a3f782443fa02015cd95372cef3d05d3f8659cb355f18d97be195ed73751ef3bf396df3cace1817e41013c7c7705073942029fc802446040a23a77d7a8a15955414db7b6180943fdd2b1c492c988a6e59ee56443114d063cfb1b10c7541bb282add7021c564812aa12f303434c9ccf666d9d4470d5532c6a45776fef52dceaf35daed096a2cfe4bb437b8e3d8d34062c870bbd35eda66cc26b5c842c8ceb27e531dad94ed7ce23108117f890156d02dca726e4b74e5ee09a374fc1d4109f669058f494e6a943fbb54bf784637c8b742195977a551c5ddf2a9d4eb8d8f57996f8de3c9be23545a"; + cipherText = "2edab1342662def2fdbd2e973f61cf9c65f5b9721dff09ea8d87c038978c202c4ffb6c1143c9c4b446889b0654b3cd2d4c3668acfe502d5473dc5761c15fabc88d7dbbd633c3eb454c096091e22c4a8418771bc7b75d38c469f35f0ea2ac2ebcaf52cdf6f4623b8494cb3c0c57732cd558c3a75853d5d0f4aca4322d846b750c80272169ab1adcc6fd8eae1ed97630d35c756d30abf7a8e3c59e4f426b33f00a8f85d60db4621a85669bb786cb84b38db6c314d0c9eb0830c49de8b8478f01c14fe9284d9cdec3fc092631311b6686f3210cdfa25b6c99a60a764034a66af0c3def5226ba82ca2237e8fede71eae281d847249241e8f66172518fe71d8e9e89b0a7bca6ba0b08f3782586370d518fe47a5af50e8d8052d7429998454e9c1a4a8c6315e9a499678be23afcd32db610128fe57cdb7a0167cf57cdf2be6fb883d1df58abf28f64f7ae5ef7c57e4581915215fa3d6216d5191a7db2eea11389a57c851775c7acd048825f624d648ee43dee47198e0643783d99a7fcb08a785623a95a0092a62615b3a68dacb893c3a141d601a8dc3df91c3baa87331e9e3115cd9cf3ccd287f1d401161fb217b3c95dfd3097bbcd8d529581a60b4203a96cd8488646e69c4a788f5e0dd9ddff4ea08a22ddebcfe7931a77b6363f838a17f75dbdc2d05ba2075fcb58f670ac38cd34a340c5c8216b4b8bc17041a09134bfb145e8a1e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 458; + dataLen = 4096; + combinedKey = "7034da88045bb0150fe101eac30e2257826660ed18b47defc4df7913f8cecfff"; + iv = "59fbf865b0463cab88d8f05b43a2bfab"; + plainText = "13ea3007a583109fb6acb80df19dcce132f5544787583f8bcc6f2d90a2cdeff745b4011f35f098bf63707e06b2cebd1b61477063087ef170d74503d0e2ee2c797f4529af88f4ac999eb33086d5c3906f5ed46e174ba4eded6cf84d63ccaf651f2dbec088c6ddb94bd0f999dfee955f4f623993dae1058fdeb563f3bf6a8c3331982dfdd212f06dc86481fa9a7ffec756a1bc4dec1a5829f98d50af73b80c2b3adc8764e78f4f2e050ab45ab4917f8fceb63cc57d0a6545a688d5fed3d8f54e94e463981dac9949a30ed23f8abdd8e5fa833017e1beff7dd4e77ebbad0fdcbefc5b3fcd88634053fd350bd1b1ac7ea11b6b6f9db222dac9d66a982447a7fd1d7b0d99f12049d9cf8822ab409c650d8b108c5dc107eb9cae9af95f35bdc79536f865b1af7887e663ab90f37b500bee1d5bcf3323f7e800cd84f7109a7e4ec2fa383937f1421e861359752f9993abe879d44aa1020bfd943f47d19d212402497ee0e3d709f53e489475dff179966a5c6cd3a759b449b2626c708fab24bcef9e5e3fa3cf181876a5c7192aaaa6a01da765d568674b2900d2c63f4c03022286ac8dd2e4877c2a1c928577073641de31b097479143c0cfdc4dfeef04b3fa60146b143ecc7e8088a41cf4017721dba440517e60c83b0c4aaff40e2dbbfdd5fd2122db674be78a2a0c908b97e914dc01ac76e2fceb944989ae154fde00243901dde3cdbf"; + cipherText = "53911a15353845b3ee467e0aad886c20bdbec21a1828eea0c733d216d812b1fb9c554c5aa85ead9e495b7162c23f7d0c053ceb98a5714b57f23ddb16d3474d9a43eb4666f0a419d89fcd3b4ceead2d38e9c963645a17b369234677f9a0a379023d4e34a1ff3625c6c353ac2054925b7776ad86635af9dc131a006fd6b99ea8f8176f7b80c867c6e67e66bbe996c4271a9e4fae716ccabcd82712c43959c28c10896fcb692f75908e677da35cbb31cbe9b69ec0b0777e9b7309890227a564de952b8c6d453c714e0cc6b65694ad1b58641de048a3590c78e70fe18f1dd384bb73e25d5c4696bd41f8bd3e0192c05b27c9caa77b06721153699ca8b08aee18cc44b6ae4f24c91b9576b2d40883627dd68b39792dc8736bc8e45bbb1f8d76d7662423af4d5bffc7c4aa7ef638dcdefc73b4481db8333d9ab099bd3bd5b95ac36169334875ae3b396a6a3f44bee88ff8fc93130504fca7faa70c967ac8fdabb2b594056dd785dcc015a6b568a382d897564f2718622d4f053ed5e9247ca6e3ced11bc591497b617c9ec2d53ce4cd6b9762756b8380453c81b49576e5df661c14b15c60397e875e44271d06397a3172182d56145ace1292cfcd25160662be4ed96d0928c47cd12bb7b163327513fb36d74b1864833612f93c3b17b1c7133dbd3dad7357ec2dba5835fb92ee5aa9b28cbfe831a423f29983a6c8e087326a7ade277d7b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 459; + dataLen = 4096; + combinedKey = "c91a6b17996dfd5cf72e48b7b46191aace9bf246320280d19be167ccb675ed7b"; + iv = "e0ed2dbcb03d60c213a2b9b51ded2ea9"; + plainText = "e7e9b510687bf5b7890e77b2fbb95cd55caddea201544d587dcb24ee88d494930e636a9465848419f8a048918204de2c5085b118fdcd55bb02a57aae6c7895e565197fede41cae889bc3b79113075623ee8cb9a895162b58920c80875ff98452918b556217bf417b7c3fbd2252f368e55f30a813c70f7e5a6d99e48c6c890912d55ffaa7ccd92e032cc9a4d4205e5a33dd6c44c2c0b26fa0a3c76ccda8ac6b3c46f009f2ee497a6c76937c5f52f258d177c5bcac2b23f768e62e35207bde5d5dc3b0840cb382b827ec2d76f5c120f4611e270e55e3884355304f55a73d08dca0f479a18b4a06af10bdf3d558db176937e19adf311f50818e8df92bf4335d2fdf6d35c0f6a2486f5999c624227404ca2a52c64e192c48e77f7140e87f6f9bc3195f4eda54360f836ade75c682c47a804962d4efc24559edc7875dc952ca7796a4ffeb5ceb6046e0e42a7dacaee7eb6e841235435ea6b05cf04e59710d804d21dca13a3b93f4e7af70d8441721c3c3b6564d6045b3adfc2e20bfae9e01d5ccd19afcb354f485c07d61cdee0d5734e1250211994f91ede415df6a72d2e569e3b79ae0b3cc77e7be6419b545c5f660cd1f63788162a109c4809ce302d764d83d796f1ea1572976e3561224943c0c7372e74f6e784b6d98a1d6275ac4f4ac36b8156ec3f728ead09e3e07518c2958ab0f339c0e7f2b4959e61400e3f1a7ea5495bb87"; + cipherText = "a4ca95acc878437c5521e18dda89c456e99d8e4f0da9bda9398ff9e8b147f8e707fa757ad7259493d19a6dddc232993810eb3cfa01fcb4e7751d4b21b44a251cb37840fb12f9cf892deaf01e39d65db6c7e7f9fdcc9014015031f856707225bd1894b2e6ea74468b3742b714610d99dbf79f52cce4e38ecf21a8bda075929dafc39d6652f812c1fae5c10210bc735123625928e685f38a440548acfb54ef64b76128714df56817606d8c8eddd98787f76496c7e690dfbaa1292130c85024448d644c195c25b457334636c6ebccfd0067d98fb11e86276ecea2f3915d3756673d8236f78436fbcb9020857cab2122db95f33fd916693f3c405b497fff7664fa129a9e2d29d803ccfacc9947294bff1c80a40493e93d8157928fc49862b17e4130b8b276ed1ca75004067f3dff86de1dfc4336b11f60e78c295adf78b4e46570a2e3d605c168a7e001cabe8e0e76c26f13564f54e7fd2813b7e7c95356102e43c4d9ae8e3459456e05daef01f01ab0e04a000f1e4cf7c5dccbfda7b4c811325cbc4ef2403af548aba2af058d25653f8521f34c89cd0da32dc13e5d2416dadd675914cf4fb14c16e4f0eea3d6998544f3d0b0b2c5f4f5f4310f6573af9b5bbbe785d265137afaf375cb39c7704cee3c0465b3bf35732da27e40d551d96fda98550a7257ea1417c1935cbfe5704fab0664430178b131c03634f8fb62f77705927fb0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 460; + dataLen = 4096; + combinedKey = "98a48b9948fb4d4d70edc4c96010d5e5d6d3cda3b91199cdc50ac4a48031cb81"; + iv = "c91b8605408a3e191cb033a02a3b2bda"; + plainText = "652509ea06b98060bea17630ee56f13e8e637a945d6365fe74b61628a3661307cfbd26a1da6746911cee8de6ac9e67a7e628db383c735884aad5bf6c5c88de26bfd3a354dfef6e9c0874182e20a9c884f5c9eed62147e98db8fafcb2822bc895b339da52a262323e6731ac2518267b9aaedcea14329b2a549bfd4989c4a1cc050497dd33e1cfa3c98a1b29c1c52b793d860edb56be298bf4a4736c75c2010d68f80a44f94b4d4403f77ab3031d5e3f1a2e3da58b26c381e0523abda43eb3cbe419a45adee7ae0abc78a1ada5d0dc603581afe5dbd90dbbf74608a80a0bb5dd332faf218b7342906a2715ed11e8cbc4fed61250e45dc2b30cd0bb5f12cd1e0848079cb5c944187eefd55908b3ce2bc4cf314a2dab5596ec11c81a769a2195d41e9312018729c0d21614c178871e8de7a825880fecdf564658084f08ccd7768803944c357a4ccd058335167471c01a68c664555b2d4369f320361713d02ce5a537c0cbabab99a9a6f505ac54cc005453357943df88b8fcfb7926d80413eea0488b36fcc9f24e5dfeb67cd5c51fffb6fc67a0c58db8d0549f5bac732c8badbfd28f949e0c84fa9598df9244630ac1849d53b0ca332763f42a4114a4927df22ff2c0761a6a5498d4c56f13ed75ed3cffc390323d6990d6f2d48e9e30f95ab5827bfeb74bec8c682ba3d9906d89cd6f9de5ec244defbeaf589f9b96547c0f4c608c82"; + cipherText = "8bd2a3c7127e9c9b4dc04cd8ddd1b1413acf6bd176eab6712ee98673a1fd29a705883419eb7d0ae7a82392cab969e277b8878c1b4581ec5bc282cd1927576490fc134cd96c237be3c50849d6c3092209054123d9cf98bdc1dd76b10a30e1da7935534b33b85c2af3b6d5f539ede89ddd8b9fb2eebea84f78cca087f97dde621b178255c9a4301af1aaba1a060946b788e5cdb98e6b155dc613c8e88f20aadf118d997d8b5473d2eec85eebf785ef39d50f1855b7445c69c524a12475096a3e720f80014f4f582ca8ab30776eb0fca55cbc9f4cb742bf9aeed29079a074291fe67432d9661086f576f671da3cc38be0fe94d01fd3137af7783ae0377cba33e0d738bbac5897bd4bdeb07720224f218f7fa3e13d8b0b698ae09d6b76b58673338656bc46957dc993d6b518345d3fd79bf8355d9d67321799637d4c142466f48b52c917a9a290fb3579f7320d01a7d106df5b92979bdbbd7a8c05ce7a4d412a5a8d326850f750ba68dbb12be2b9bf5271a4f4a58bc9f702475b6007de363393211288298cce5b4f17822cd94a3cc9949bbd26c402db0b83a35bed25f930ccf4fa5dcd3417b84b21d1a86cc9666e21239574cf0f60d59ac44acc4d2b83d5cb30ccfd19866e75449687966cbf05a56a3ed17aaf545c6f8727ac61ed24958d8743cdbad3bf97a3cf5d614c958b339c84523d58ac7acdb8c15a314b73223a5291c781f3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 461; + dataLen = 4096; + combinedKey = "f2e336f8aae1c52315971768e2670dd338f81d47774aabf801cf4c3aeead94f5"; + iv = "3367e6bc7f1fa378ce6180fb51da70e5"; + plainText = "0f496f6c39fc81b2080301018c9a03e9152674a3ba8e3b689640e758cfd037e5657220546214101efc9acfbf5c07042bcba69c31d4df43286a64e1e31d1c0fca1a9538b413577abd0529db6be777e8caf512bb86100a028088ba03209df481fd78c35486bb5b672d1aa0f4b6ae7ff4c5e4280b1d6d13df1acc65d7194eeb18883605090ba68160daf133320cb1131b3943b620778d9274f946cdfdd31675fbbe82b26988340416c25a3ce82520e6a61029709fda3fb8720a9c7a0db963a9d81977c4504703c55db86b2fdb626695bde21ebeadbeee1b910b0f2c8fc3bacf6c845ebfac4d797b1d3cde1fa2069b72a8ba9b2f0b18a50ec8b7d9e63ff895b98b66913cfaa9d249f8baa70d307300ab2c5386be73a4de829d803b8253c86b95c0e39386fffa3c23267687f40a76b4ba19b2510e21f286e22a0034671af0f1391bb31c8a9acae2aed876e955dedb01923f28a24c1fc2a3df8e1b35b19abe2b738b46a84a3c6f2e4f07a683a3df3db146b96235b4c08fcdf973fe72462f657292bfa305cdad65ac8fc8c73bdf39d8c6f2411979109e278b3a14cce20258b3bdbf906243d15bbc4ecff527e7ebdf2ba195ae3e83129a891316f459dd35e507625f16d271b09e98a61af7b8eeb6b709c34a9c1c72e1a2fac7d6f5ff67c967890e8c6a1b233f97e55c6692fd2189b301af9d52a29275249f31907ea122d2d2ea8145618a"; + cipherText = "d809ccbfe2906e537aeb2b4e742a27e8348609ac54ea2c84078ff07d5bf18f99f9d639c0f4d9112d65b25be184c22013c98b39ebd61c993979b656c1b35676bd675b778129958cc5f82c0300e55b6df8a8aa3188fb63cd6f804726581e28862c5d57861c5c417b026c62a7eb2dc966f6913fc398f7d4ac37f4e1641973c68f39c7f5969563bb0d14b8208c5205f9d11403ac754a4e932fa576337532cb8941ebcca0439518a5f18fc97cfb38332dccb82256412506516b5d9064778f4d40c27038971ebb1b25c4f84039b9dc42ad4fb8ca1a464c0654e1208eb4f68839b10465efcfe290c5ee43a02f0ae022f98662e0f155be11df2b48fca1c2997adcc7f557aa066ec1d647a6f6d735101c8fae57e07f9081302b3e899ed73757056ca53ca5e7e97e0756eb85f5fbf2b6e7daf3f3eb8f70c015286ebdaa6d2e8754e3c0b4ff445bc8cd911a2e97ae886ad254406b0cc0b97c9379cfb68fe18efeb89428fec500c5e8ff104e45c5385f32cca70fc4740b717077ee913853ce1624cdb0ab49de5053bfc61448a206bf22e05bf7e6f192c9b12f0fd37bb0ec66f8b6248ce688cec18409930056bdb0d9db95b4581552b865e88b93bf2d1fc15e47c5de8f4dc470289f0403118cd572e20f23d3007f95a4afb95589185c394dfcee0327be771e0fb539d8bbc0ac699162def97f9326df3f030ad140992b552e362a7d59bb9fb03d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 462; + dataLen = 4096; + combinedKey = "5a2a78a686aa1fa5fd6169736dee84ad6913a0ef9a5f4b5fe50bcf0c4499f718"; + iv = "30d463ac6ec4372d040c854d56c54feb"; + plainText = "4cbf47244029ad21f762e9c2ac15dacccb457e24307f7e104db4164abb30d23c9e0e94f4301bd2ebde9d9fc5335a779cbc337bc29dbbe540155dcf6c65a8476a91834f9df1ede769f90c187099a3915deef876cf229116edb93860c4ba2788748220d5e2839db9dd0bcb5d076d0f2012fe2406ff86927bfd52a6333a56dae0c353371ffc52b8d9998257c7cf907cea27564f0775b33cc94d54f221f128abf2d0ffd1157da0bfaed314fe122df175bf9fed97c21ebac9008fe92f775001d3aa80cf54f706f29ae7f77eabc22129e25fedbaaa7fb769ae943f1b4939ab9decfe8c6b5bad5a611395016c69409eca96d5cd524432dfa93ce457f6c470cef59b8e54ca28a17a660f9459b3e3838d84b1abc884fba1b28ce84b7239509ed4e9b457a1b9432239d957c310eec420465b9c2eafeadcddadf830c450f74c9fff0a6a9b14067d7ae50edca7836fb1bd74f498a0db362acb152ebd1ec80c6c129f2c50c2d8d8d1d61618cd6b149938b39f7a21cb298bd8a821851b9b573c0e3c1cf9ac52b200eced71b1321c4ddd3c4efa8545a4a929cc3100093c87c8fb5a8ad423994c76bea4e30948000cb5e93d6225f6e9e300d0094eb4fbc9e9299021662e9d4e8676c7ba0f3feb27ad06901d2753cf7ea82867e48a452af042e6f0347a1ef30d4aa84920617cab3390e5a22ee4020989c011aa62b09138586abb4fd658bb98b8be19"; + cipherText = "665eaefd4cb763ea46194c135501d1aebc69ada75b60547dd4d343ea4ba3a4dfabe0691396ad605a886124119b0dcad9c9144090c167bbafc5ea8125b01b6660c2438f07e0722b21d2fc59663f9972acaa8091143359bf58935148985518f0fff61492b27226b0b93c18be7f7be410fc66248e98e885dc5ebc9ae3142e8568a868c95e94d3933cbfe65af911bf44714be1d4dc054296ecbb7caeeb7beda56b976a8996ba7d90f5d3d21983d2becdb0de65e999efccaf089a1ee37444cc7a9d3c47bf0bc4cdfc0735f15c5ffac37778c2bf1c9cd58ec8031e7c7e5604efd66a309d499f097c668eee02e6e3cbfe83bcbc9bcb279e7582ec61a96a2623f718f61d5a2cf5f823e3c7ba28fd2523f54da898abc1209c0401f96b89a6995c0a7b860fd8e62a228a4b2b81adb9c238777322dc169a9301e457f7b3061267edbc7461956556acabe05c0b4dd6839a88e3d61ac1ec2e326ed6a986324207a8ce1dde5c45310ce2394687766c3d7155ba3837fdfd0bbfa089b77cf5488c92e08704dc21b417e5452ebd6bd21e1ba9758def7c8528ae15b6ac1fe7d33a7a026b1c132636fbfa64b3ac94f1dbd65fd171766007bec397e1e4f26c9b7a729653418504c1c65ce7a9e0116cd0d9df2c837cd016e0c7d38ee141a7c6488f0f5a14d1cfcd54c71f0d21d4229b60d4b2e9608ae930358850221059cb698e7441aba028a0541d8376"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 463; + dataLen = 4096; + combinedKey = "a5f95f844fc48b4db7afe018a8d5965dee6cf6b4124e4607c42781afb9ac3859"; + iv = "e82f8b9c4cc74f1163b0da9dabd20774"; + plainText = "0847e6f00794f8af29631501fa9c6019d8d2cb4f688104cc1336db54ad4ec07fa49ec5fdc8fae4585371e6e87cfb6bc19001ab11ee89d0c61c0defc453371f6bd25b14b26cbe144f3307821649db91a257dd8a658ed787aeeacc5cb268ea10822c69fa20369d476f15a37943d6f3628dc7fae3a314498bf4c08d6e6173ed412e0e1e6101f5cb354a2c82e5c3c3fb61d1c21c974924e9432f154cd3c840dfe7a6ef8d3ca912ba98a88ea807c2e085389f7856a0deada09ff58f051fec2cf52c960717f75a6b4229e02b2b4de14c0f26c2fe2322bc1ce0329db1edfac426391c12efadd82d8283acf527a605978410d563179064ad95dd07b89b2bbcb0f9ebc108492f9d73f53fb9947b2c055a46a0b666e8e4f2dbd454efd3cace8406f2e0aeada75488206475febc82775f9c224b1f0e3f0a1dda909eb46b53c573b18adc18ad1e2a206d45582777206c88f970779d145577f1f3c0ce63dc277840030ccde43e858343a6270aec7106c3b6754dc82dbd8ec9e39ae5dd3b52f8d796cd5c6817901acf50728c8e389211fd9f1134b46c2e1a922cd8ec61193a83a0a9def1e3a34961a3ba5dc550524f2beecdbef870567feaff2d9143446647b9509f5fbdfd65dd6dc7d996ef829a31c77ab375b7c3fdd6f12528837dd9c59b6032f4282e7f10f8e9bff4cbe77139b83a3cba11c291f99ebcc81647cd43dd871bca7f2c6fe1926b"; + cipherText = "f839b772fcd08229951a8d7411dd7c3a35a02a43602a94793ec52633f9ff8d0751959ab36746f753b860b84c417d0c2d4168aaaaa3288945f0d1bf4854503733801ba9e65d3095cdf0cc2a00e81cb287293c94513c1b6208c67bc9221890212aa6bc0b7726d40bb4e9ee527d7b065b0ab96b0a46d27b019a7b8c278b360a391262344629126cee89d8cf31c1af93e63a5799738e1d63d21bad2446793e81cb7f8b90e6fa2e93648fc149eafeab69f9a66c85cb3ef7500ea63972ea90a211f13a457a9671c29489ae7c12a322b006d66a009ce4c0ae63471b5dbce46fe32009ca0db0b737fb2790d9ebcf37fd27521765e7461a2f29290e516036757db15e02b19a39b8d9b751b9eabf76fa77b067b0e678187d0051fcbad4efa7cf7fb26f07bde7d9d374946245b6719cb40ed8e7ea57a0190770e63cd04059733729eab4a7ac122b3be16694bad4f281a341ab4760ce2187bb6112a6cd867f643093c27eb1e102cfc0ee68b0020162645162fb4022bc0ba52ec31111a8364a1ffa8f18067891f8ab0715144581e374fe6601eb7fdad945aec27513ff849cb7d0ad2f3d94f03e59ecc42b2dc6c909dd38b09fd7cac2a25476df18ef41ba361aae44bbb370a9e8f3d95d5dea1c306199a3a0552452fc59a0555a27a16b4eadf176625539047639f4ce22466455660fab5826ae348608dc9d83bb5452e397182469e82accc9f91e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 464; + dataLen = 4096; + combinedKey = "5ca371eb2caa563db0c2bdbc358fca1b2dee4d7630df45c9daa1d424c43b0fcb"; + iv = "ab0f8d65e716ff1351d93d36ba24e9ca"; + plainText = "7d6f9d8e65169b2f90da33bd0bd06876598b84d60e25307a38a337e8e583de58e66bcba09fa79c8dab6f14c91382e092c6047f196791774efb769409a8362d7674f790a6486ec0ae9c421aafcc42fcd8118bd3c66ca5e0ef305afebd6a8fbce48cf37f68c10f942bd544a1a4221480bcb901440b788a8b4ffbe158d6a19cbf70afeee7dd58866ab1d0eea76baaca109eb0de70de25077048bdca4d325f51451ccf639e1c65fa40d359a5ea852aa8794536c07bfb5a2cca28210673db0830298922e76a6f1fde3f31d389756d6bfa0a6f9862afc60f554c797e295b09d3eb9ed72e3858a08fa41adf6f03d1eafa212a81b725a1aadf424c461793dfa705ba36c536d4137f49c2c0a61aa3b1009c8672441c67d0ceebb8d4096546fd341a185700b3f83771d9bbffae3f7d5263184e2a16366d44c246dd8ee7d4118ab3bcb9b8c824949688d857f5c5b19dc6e667779cb0b064513d5b581aee237d4d48a7a60066ea674598e72186e05dac852bcf4e98a486269993566a0fbbffc817e13fe150f1142c7b0f6f1612096fd1ed7e2f43e34a911616b5aaae1bc21e0900abfc23bd35d7410bea5cfb891d819819872098f14e3ddaea22d8d18517fa5d099623f9c01496162fcc6376aa1f0f78be44cda6e23e1d022203720e71855c24c5441cda701140b7334f73ecda7e93f79ad05f9860df08c175d1808b6ff3c0c956baa45a1366"; + cipherText = "0fd7549899b307704c76d855165ea321f2280d0b857d6697810208fe66272650ddaec1f8af31f54af62ca4d919e118b1f36977e115ced849c89f7f9c744c0bba3f6088b9feac0722526513a0b082fbdb82cce185b2cfefdaf3f81603f4e6180f87186d039218a3214d56b8612f0e614996aa8359e138ac48ee7bdd05a5453b749ab533e137f8e82757c3ce9a18893d7de2dbe9b0f06da68e04926b0324716f9b27027cb86efc0477d46a655cfde8162630426d4312bbcb1eadb7087bb780a90754f1df5b9d5fb054b205d976c2da0318df31625326c89acf8ee6ab6b6e3670fee4939c22d89a91f8e69d7ac279e66011b1bd74ba4a2d602bba563e279c97a54d5704533258138519663fcf9f09d8d09d3ddc4b63e226cc40c8641ab91c62f0f1f9a1d4018cecf88ad7716f14d51605d2ade2f82abcdb0830e0643f40c718edcd04d6e3671774ac2a0994ca66c0f85bc10904d7feb43500d35b9def4104916ebb7c97566da260832372d96ad721523f777d1e6df2d5b96ffb1835ac60997e260650afb58f2dc24df113726732eaf3a149abca2f7ab4e3d04aef8c0d6641dd83a87c92f92459333e9178ccaf219392ca0342aa9ded6ab3c1c40a5f3fb7b76ddd5582218bf1d5b90b1bac7dca79bc11f07b17a491b916cdbf01ff1da8c556645e1b05257b56cd54e90e86663253ecfe7a0e8a4a37b2f2138fd2e626f2673221380f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 465; + dataLen = 4096; + combinedKey = "60a0ff7203f82b989471cf6bcd6bbf8a969de1e24760dcc05ffe8741566937d7"; + iv = "929ab70bb52d5ea5268ab3006160a273"; + plainText = "b3de47f0abcf8b416f364a1e9302dc94c796b44fd968af30495ef70f07bf6d360fc5efad46a2fa94c1cc4651b818944472563ab08e35c320f60f7b835f277545cdb4946090dde425adcd2e1cd74d5469ecd8fb25e598f7c92d370892b37e339ccf5af050e218742d4d866d9ab47bb23da258211181ecba7b2ad638fd152343a366d05de0298b49a11758cf41fea9812a38eea20c89bf78a427a8723d0b22ced2e805f9dea38e2437b996b9f162ce74cec514f961c48de6d6d2f199ff5df516d78097704d7c5e002f7e947ca3f82cfc90d06668ccbfba37c345748defbe4e1c98b68cadf93b420a227c0def8bbad4b154a5ae1c3ec6395a649976097cc8cc4fb6d87d4ad52b3ef5abe3d32fc99be736e1ce1c4c2b734ff231a201220e0d43decd16ad7b571a8a50274d783bde591232a353ca9a32a191eecceffbac395da44845728fde88d96ee56a6459eb8ee10936a730ffb391bd140d8512a7d381d11f3d65a57f4888fe7bbccf2edaf651416fabb7127d17f9a0b2c781d1f2ce8e6e8c4816e78ac84df8a61fad6808d340050fe18b89cb8efd901c138068b95b12a1bc314d1b707a5513135fde9a0f41eb71e561b6eb43b0f9baabd81e315f7680f1791310c0d3b8c040be0a3e6cf5c342137ec3620ee3cc6c386252d03e9fd17f97479b5bf8c26dca876e57b4a38fca20da6058f48b0cdbeb2de67ff1a07b188cc2f532f7"; + cipherText = "c58b5188cb69dbb138321ea4fa393236d00c00b987470e744ee907daa9b32e5f4de361a1e4ee516b8b10cf8b1c54bfdfa1cf0c0613e2dacbd3eea9174ff0c81dc2b836f025ba1ab9888464a7fb7da5c63372552d4033f2ec210ab0595b14bd37773a7f42a608162dc9120b1edc61dff5c9efb9337ade6b1e5fb7c188c8af457c1997e5b9208121e2472591aaba53101172877503a141aa691408d80716427be4d9bb8fb36f77fd26f54a23fae10517a6158e5e0239fcb704219b045e25f362111ee50c0230e78113ab17854aef224f1f80a0f5be3d533cc95c9475e6f76b6a00f5f0de6b8c08df1ebd943bf0dfbba57e5778ab81d8c299e3e18c6a34164fbf1ffc1124964f8806d48b9ce670d62939e93a5113c69dae64c21b08cea5e24daddebd739e3981b3a3b95a1d6cdb9ddb12e3f4aa3117c1338d2b1d36af6d55ffcb04194d42beb209bfb34aed2091ef29c667e40eaae45265671482f0f68b7911b1b154510f8dde68f8bf756db78e636d22681a914007d54513ddd60afe3b67a689b811b633b526cafdb4cf44af40bbef54887ee4ef63e6aa62b349892faf1c85c6483fff01ff66bbfa43a0693a7de2c7b5b7ddfe84b72a1ddfd379b744c2a34a73c331e47e75ff89a14271beb42b84fde4918db5dc1e0326a388d3b7802b9b895115572f12b7f01595143d59b2f38679cf8d73ca8ee76e3f8d8a76aa95765c1e2e53"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 466; + dataLen = 4096; + combinedKey = "c4bbc0ecc89841b34fe47f67574fdac5bbdf4aace86618367829a54f4196d22a"; + iv = "9da4fbaa4ec49009e2ee60a180798b6e"; + plainText = "741b927497f8410e8976b511ac2ecfdf0154341256869fe2769925c0c28b59994fd7cc1f6c0804d7d491c9cec1fa8c55ab249937094f7c688e3e0b4ab349950fd3d10689d21eee56eee92469b25fc987dd3bc97e8e43a245d17714501f02e380e9bef16e63716e7102514db79ddc092b4f312f024873d2d331ea4a86debd6faa1eb23fdc9e1f7165df6b6233e8710c7eb3a3cf81d7c04472a80b53f70550af427b4ff91a683112733f715c074a6ea8a4d57b9a52e70432f59efe7d175baa4aac1927387ad19d9e18aa1b03a326ebad2a5c7af0f99ccf452485ec84a3d7a82751802e326381ba8aa01b93db42db318795605a3b0ddaa08e3c6a5008fe2b8c35dba26fea47753bd99d083cbaad52bddaebcb8fb55099365ba85e3f6376387ff5768437db441b09823f34e8aae966f727ba6fde4fe6c6530c203914b3b53c334b2c1e962eb1a312d80b56b63e64a3ec51fbfa351c01285dac0439185c2240f7af4ab0143d2749b5a649132ae1d092219198c5b71718f121b9ba5b3ab3a104be8a665e83ec511afae7bf455ae32d3e69f9496cb01b1686f3e2fb8c325eec3a89c2d73410c3ed802b03e66d9fbca1e1917af5a8c1902871d746399fa4d3d0157f924ae0c106b2988da4a97dea4011e752363728929877b00c967c0fff56fff1710014412c267a764f992726de0f460d2c868a1f481fa8fc8a80df4d64f7749e156c85"; + cipherText = "0e513025100535827abd50fca35c9d9bd4ed98dac112d0fef4513423d9a336db9aa3054aced1e564929b807b8a0adc947c45a078961ae7ffd5ce289a786fb936c07aa32b3fbbfae76f90de76db0c56fe40527ba131946ecd9a63625dbb357f240b476d9cf85f43f20dfd8a7e14002d191ab577ccdd3c5016dc480fbe493e19b3dfa3c806163bd63fa448c754e7b0e56348b205c82756b1ce67c19545d2f187130c6c2026eb4f40d9a7341b7e6b1db897fad6e45242dc084fec97c8e7d4563e1e5b2b0290d1f8465c00bf5fcca441dfe59c125f40a50b91d12137c2f8b696fb571c628624795be2d2f2653bfcc0c84f729f5c4dd8dbbc3cf7d26f933b0c066b175266d93fc0cdad7f0e44b638179b79815a5484eb578d2a1dfc63e78900213dece9d3eb6093fddd046b8707c1c34022b9e9883003b65fcedb79d08b544a40120348f357c047e1afad851294afcafb2f54fd043548229c614611553e89e82007ed3fe11e8b992f5c54248567de59e3a99e5b305f3009d02c6242c3a1ac0db9dd8b54d1d0b7fc5c20e60f4e77c00e2bce983bb57d559cec2efeb3455ce5dbc44f878a6f268773fff56a97494c2f9e13448d8a5871bcaa1e7f7a2c76adc306b83c82d8cc669c7aaa9df54d753989b66d4aa8a208b9b04b762b64bcccab5b8c27348cbf4d40992748fc9f7ea5c619a90ab19743e9184a5574cf20df012dc7b3322d8a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 467; + dataLen = 4096; + combinedKey = "661b0afa2abca3b6cc03e7f659c05e5666fa2dfb7ba361b39a578f85aebee125"; + iv = "6ebeb177b44396fb6fa72baa3c4b2b53"; + plainText = "ef9413fd1127f785c8603caffd3e065c35c40fab5ef9a70a07d1c680fb411a1f69b9a3a59ecd12f30a43580dbc06fd859d23f7d9143a0bf7bf6b5794d46b5e7c2db85c5ccaaa90193d772788b54e965a580b1550a301740f1f405a1124b81b434b49ef1445fe97141b7a3d3bf5bb54a19fc42b4b66a25aac1981ba7aa485c7c91c34bd312121449dda8d7925cf6ce924862577c94a49394de1cb44ef4a48d6606b1b36d4915097dd3bb8202c58d65db9786e17857ec715db51ecd043bfc142de1bc23a7dc489738d54747337cc9ce0d17baceba752f7e38ef4b9e3f5678296b9437217c87b80f588f2b05ca3414daead1bf9e105e6503cc8b371ced78ed523c42f82b184fb961307ddb9d48195c1593b3e8280306b98c3bf02b96cba0c6287e0f7e3e72c471b1884146a999f0d0391a68f2b25b80f51ae024cce6af78489db73d15932f3a1ff39a41feadeebbf6219a3f43c0ba7c08600c5133a9f18b693dd2a91a7bb1e88ffae856055170a582ecdd444ebf7f7cd8d6616faef1510cba262e740d7608bd2bafd271b78a7f055f578fce7d7ea2116e567c76557118f32b42e881535b123ce3d9994356218d92e07a22917a83f51288a50c9c621416b7c0e48f54f6abcd54e07ca3ac96715d30d19227e44f55f352276f86cde1d826ad94afb666822aebf83837a0c932fb5082fd3b6000c7beb2788afb6646a4fc9e39b479206"; + cipherText = "48e90d2da2cf2408f969102afbeec5bce1c26a49284281468943275abd9892d02220cad6e3b995267ab265619cd6781a84f9e79aea95d703e71c6a6df562d8776193f12d8ec86b68dd365125033f6ad29f1986c80c6fd819a1d42c0558740a7a48fc151cd735312c648bac98dae6181d646d33f1953cc9e11c6a342afe2b51b31e25e635581d5a045d7017756cf853460fa926cc1e865c8585672c81f556b7709b9e80b60f942fe35bd0300410784cee3f798fc8be82da5945cd3e37828d847e9035caed78bb68a29348717ee1d17bdefe24e60064ff81865dc59f8cf9d3596814c23f50a476483e04d854e2b81d0eb8c76a37e399cefd0a96633d552978b1314b7de6774d5c85375f3fa93e2bc764481986d8256bc98098a9048e2b23293162ff08777280e931316d7f3659de1eb40bf487850ddc36a01208c7902547586ab5fa8d91ae42394d636f4bbedb0190481e63a6302f41e930344f83174418cd665d6e3b5d610ab17d126500b27a85f3469bdc0eca33644623f02373377ff15c77373dc40ec8eb3af9339b4cee0820d901860d87954d5103bfd157f852bd55fd20821c7a508dffb72f709f36cc425c1c26064121a8fc5c65cf3d9a9ef1570bb30f29279383211eacb52d62064a98263eee4c311d9b16fc04d6838d165ee91060ffc2ef34e0967b7285840a215ba1122837037d7fdfae8c9ce518bd90fa5d6dc4aeca"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 468; + dataLen = 4096; + combinedKey = "26f33405de629328d738b23b209f65a2e8f43de6c25ab469f4c4de13c2cacffe"; + iv = "f4bc9250acc14b8d07350cc230492ddc"; + plainText = "979700d146e4cf95cbef009eab5341f8c1d59139ac9dd8fff25340bd259be3127239b487a05b1ade1f020943c639f781a9cb0f8c4275ca6902b201f2c5bc5e7c31b4c71e9175383f3de5384e41d2a93384f8aaeb120bc894be10974105acbc9ebfeaf6b79ab8b3328159133a7ce1e950450915e48b7f4f24c16d4eb6dd2bcd1a307d05c202e5035fb9ade8eba3c02b680671b1dec7f86dc365ab5dfdd6f9d13bb422af9956369bfb919a734e366b1717e2436da96a45d74fa6a5ee103f6494a725b33d36e5c7fa076193d74f449877f98ac412d99cb6e41fb0231c76ac1cfd709b478e15c1e3b2a24e4df5942be8695bc989f61888d1316431d7b5c400303eb98dfdf198ea99b8f5d9ced319ccc164544fe3076abf1cd29814cb429e7f11b27af610d17d4881712ecb65223340e65f46c10cf3c29c4566d0c67e433a382a4308aef80d1fa0db40b7b5c80a251ab2fcfd94877053fec9c5adc4435145a3da3c6d4447c5b676662899044005b880227798db175b623928608bef879e0b2bd701ce39097ad709a48df01e28bebc9be8c5e4763f3ac32268fd31d47d0cf2f9b2aee9acc2ece384db6fc0491dc4e13026a17a7bec98d30f235a5b5176dab13fc5def0b2a52b7deb04160be8bd80abf63025c58f4a2e6c4a022054e30e2f98b1259135391def647331276ea37c401d7e30db862f1563ab587104cd52545058255e9ef5"; + cipherText = "bd6a72d59be34f4b359f9a9d9cb80647cca8b137d743fd0e4b871a724dafe8ad57bee490b5087b138506e05866e73a547b90fe305ac5a7a1bf85b284fd98be00c3bd7478d938c68d05174aca7e0558f3e0f49e44bdbdba5edb8fa0460228459b78b705db52c4ec4d5f61d4e0ba7b043940f23530709def865a8de2c04f8b16a9676559370b8227618c6e36f31b966839f7146f5c99d6737805768dcf640d8fb63c3496e35d23b14004940bef9ca7f2ef7830a92822ab927ad528e8af983884cfe8d86bd4554e14e6f44eace86b748078054fc31d0497d43f777bad23d11a9b9b837b57272ca6fce48f601be5485dcd2bf4dd88b560f72556dfb22f6f82a3124efc2477a29878cf7de06691303464cc1959c3440e54a3c5405508b5dbf1663a7b9bc23b989fd58dd1589b6e656934cc4ab822c3bf1c870e34d38f9df9c1c5902681ca2897ffaa92f23711bda65e953fca98bc3d315532460ebddb134856609432fe3ed88502c5cca9679018622616224c5a7c52e8c2900645fe9514054dd96301e1b307caf526bb2d6b168f6391c0e6be254dd6af2e31f96ca9d3756a2bad4e51e2cdab36c98f144fc6fe0c83c13338c1cb756bd6abbd78bb6bdbe3bb08dbcaabcb817bd3308ae779c831fc854b0814fcee64d92da01c110b80500aed3121b35615898718ce97b1547edae2171fbfe2de459e51a4fff476b879210bb6b8bdd6a3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 469; + dataLen = 4096; + combinedKey = "2d8b1d211c1d93ed0d249b41b124092e7491f2c7a80f2a3cfde091dd1224fe1d"; + iv = "89ca1de64ee3585ee4358723d45fde64"; + plainText = "ac8ab12e5af23678a9955ed0480e5c27fc697af2ff37d12aaf0ec321e525963aeed934b870ea6ce98b4c9c9df0ca85bf3c2eec6e867c86a87592272e6572114c519fc0cdf0f98cb6be98cf1b1fd014db2c97d67945c357bed44932f9351b09be2316a0ca441f445747c15c84ec20cf649670aaad7b39ead6b739565cfb1867b6570d905d845260dc63e970a3360cada0c144a791e9a45122e6a4b48bd9c3f6d174c97a77950c944726e3bebb8db53e2a90aeedfe9a69019423045e417ed46a0bbd12d98008cda2aa8aed04cab0a8b3e0e54e5633a6213a2767f1975286553972312371662e841f43fdeb83be3b9e4d390dd9d5388e5c0d1eb4cced12c76c8dc112086bb386b947e3dc95c3261fa24885b6deec69d49ef1204682bff05426c10366915e5bec532676f581128a5146025432a53c0b38052834741c51a2c70d29883eeffcdb43b3a9fa0cc7d55bc2c3681c6b44199ad82be1035f98d2ddf7eea5c9004222d4a3bfe58224ed8465bc78b7dd21b30c6b7030095838d99137a0a8bb05f35c9ba881cc3810443343a44a8b2ac3c69c7bb85633bbf6feb355a179f15d0415fb13a6269266f14106a6fb4a9719015a63d165d2f113aced1dd5bddb19bfcc9351b71972dee3289277628ff9155acd1f4195549d08518e78dced55d180dcf732143b97826bee4d8c8a0786ec0b59e9b6eada673d4cb94363e41049951996c8"; + cipherText = "4613490de986adab4d99b72bad96a5813f7c191a9431351c5fd72383d4e03cf183cc575ec1a3c06db4f6b869d579d0f945f7bfcca8a1795959b9382fc7190c3bea382f104a1ff337dcc0082259fa118b6f8fb09f37f6cd0de83c0232a56c25213a3b6e02fa9eff63f1c61a6c14e7bdc0b465aa20bf571a4a071a30bc8c880e23143e0dd464362a232ecbdbf3759c9df21b8af7cd9f1c039cd8fe6e1041f2b9f688c4967a6306d126cb285590abed7496151cbd23be7cb0d5468a26e201e65a0ed369b026ef3e272e33db67383bddb42df4feb0f4a86c4bc5d2f9c1e37e64816eee27d8c1031614660e1e5257b102e40950c1c6be0db15b0c7a123a49c4a902e8347be69eb990ed68d12558f5861ad57f146275e41eacfcb64caf506f30f8875bac7556e9badff7ce580a052bf4cb55758f979a04694f6cededb5ed2e0b0860348ae3c521963363626738cd3f1f0db69c07e61058bff7afbd9d4d24784751df2d35536006a2b93485d439894698ef005d6b17816c1d1e8ec4e1495ad6b4fc6aaa3432fae5caa47e9f7d7ccb0b66fd7f949af4da19d2d6489847c489c24bc145f1e1fc487c5292bf0463c8b9ca4de408fe14b530691c0566fa4885066a53d35eb8f16a4a90b83e972cb49545b031203270f0f097dec5009f68795a39fc0bc80b9d76be2ad3ccaab4d2b8b3bc0c04b9ecacb71be90ff92c27f8195ebb421cc7fe4c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 470; + dataLen = 4096; + combinedKey = "b198c2f2c002b593a2499203fd7efac30d12a148899c4ae66d6fd149ba3ecb2c"; + iv = "e6d6cd2615c9171420a02ae7d8f1ceb6"; + plainText = "ea45fb17ab98c441a5356554fb3cd6133a7b6ac6b381b8675ab1e74c287067a47f52a9757547091d0df14ee4d8fbbfe12c5d2539e676a1d3bb9b0433b7370dbc84202c14fa5fbc5ea92d6bffa96297fa9bff00ae6db1206082348dbc1a9c94b62533a6208406d9c242f1b8e59f4091e06c78124fd2c750dfc6d5dcd6601957146d03ffbe30cce514a8f5ebbe7665a2cd58f95e4eaee8f7c513822186961776e498203f0fb0a309ef323346b89fbf1048031f80e0927ebe297df989747a935e10599df29969240454bc138c81757a0f5fe43a304e3ea6779a8660cffea6f18b37cd4eadcc156face0126137c935f435970e02b56098a131951490909e4ce794e2f081ed7f7dee70e59223d2dcb07de798af9775cae770c80fd5a559bbc4b2dbd804ee8ea1719d9f80ed9e3897746a8febb79a80682843b4e4862202692bed96603cf2a948a524e6a4ace43b2096788f4e37fb65b04dab4dc0a590bdd7d9f53c9d009e9ebbc9d78d02c6b9b8e1597e4d494e5fd2d4bf780e15178174bfc4a2ccabc591946df10e8e7bc20779918a67caa5be01eadf9df45b6c20c713f767661c8f59823ed8247a1686a46862c43d3fc594ae4fe0277b03e16747ff2aa574c543620d2267aba3749f08bea5508e6679c3fa835657a1670e6e2ffb41ba0716a5d716ac6315b86aa3be68f741b8a794fc500abc8223749e6e9e1e72f994487288623e"; + cipherText = "bc49e9973944e4808750e144accd5c507ebd61595b506481d6a3faec4372f8ae65bd450647eb91d6914edb09d439c895369217fc2d5eae1e9dedcd5f0b1f0fadb0d7d9f91bf39426d37a8b3d596f78ad866fc61b783ee96c693578b3bc76f602e9ff20d8aee4b045f1326add610e609f1ba00aaa357a7478b8d9fbef17ce29bca6faa9d1a9e430942a24d206588fb5bc184275e9d15cbdcd0a72469cf1fab3f5aa41ea09e7d35f38cf26c4367ab511777debac0cbbe2d61a24fdcb86be15ca27d8ff62c1921c7dcb9ffac41afdc2cc7b2d063cb511aa080d3a37c0de947d7bcd3914390afbbf391f056ffd46954c069125036614d0a82ca4c8bb521dc1277bd74f734d88d42811b9b5264626037e136a2b5c8af996240badffea5768e5440bd9f7b84d19f37be4f960eb8dec3ffe7cbbbd2a25544701987919d7b637eb6d2c180cd9e204117115257aec8dd62328a00f43148329e51c11d943e8cf1acf22dd53c4199c8229365f3207d40ec3c32a00d7f310e8b50b12a6431af2a9f59f8e6f07f99bff1fc84fd82612558bdc5d4ad73aa919f56d962e6d9cfde7a91b9ede43787b1c8db0c51da87620eaa437d7680042b221b9c6a3ed816c8f464c9b678cc9ea82f2f3c6092dab2557cb215e8c0cdc6e6cf670b8208ff6b1218c4318320d6ac2b1aefe6551fa4b8b6486339902b5a4696238a0f430e5aae5208f5b1f8ef7a7c5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 471; + dataLen = 4096; + combinedKey = "144e8e52cd980dc4871ac94fbebe0203e534acadc7c52dcfc657e119f7a4e712"; + iv = "90530983c1b9cc6edbe3674ddbe0f0cf"; + plainText = "9dab237b451fe77e9ca9204550f5ae2e0f33d3c6ba67d96c1242f0e429057385656514e81fe8609521fd05c204d4921c1772f0dfe1136d8e0234d4e0b62c6e2581ddfcd81d5457e0cf64958fac4a49a0c2813a983e3a464d2d344fc8b449bfb199190f14a6a76ffc9b2e91062eaad9e56f8a05fd9a65560ae19281f882306e05d1f426fcad04d3495e2807efd9d3d111d8aba43fffbfcfb3666baae04d2e22d2ce497a3f115526d10ad1477a63d67a93f9ca1c4edbcc86bfdc892667dc0ec853f3f50871fc87ede7cc3d332ae53489e1aa1107b657bf5f37fca8debb36c370ea0aa0240a2b85e5eaa3af124f6f517178d7802a1a6580c60c1ce3532a529dff16a27b86066f8555b859eebac6ea102011127ab7c14441b051d6f59cc73c686b854d6489872b58a3b48a5c491cb6a3130025864afa9bcc27e107d6fe077c9f69adfefb00c8c2d489c49127364ef5bc57cecebe8a40e6acb5560772db3dd4d6642f5520562c5ebd0a4712b6f589ed6a6592aa800cd171b01c0f8ccbfb240b091bf0fb8efb0e100532f53716156691e6038d2f9eaf4982a1a24808eb2e8d6e9391c8474a6e0ea8abdc39a4d0609852d3284cfb6c1f235745bd2525796ec249757be8e16eb2f8b665e1b0ad273e6fa1991cf2b343f7f59c5d123b864a50255060f5ebe779378a0ae0b652ef8a2d90076934067127bcf31256c6170a3d09699c870b9e"; + cipherText = "656f93a2fa98768d0108f43f754e6fef89ed480bbb0f903b7c540649a397b7310170f86f9c1c634939392129ac6d22dfeba7b18f818a87399e31ce1a7c13c64c0c4ec7651d25cfe33de21c7a32cc5f47a034cefe30e8bb0324cc69c7e31d6f60e33bab707c1f59d2799c2fc4ca79c1862cf9fcfc003ee5d4f1737d1dbe97ff54f99f6520a9855531690eda75d97855820387e1cfb6962c3ba3a473f6def1b39f3308d30c57f210a240507e2498291588827081ffcf4b2e7394c61a890061f0d0fb63e759861acedb9978fda081d879ba1e24997b49efab532caaaa3d8bfaeb6ea2f13f83f09237fcb9bac65d4c634b3a4df94db66230da7880f362bbd9bdf7ce140f79f1450ae0366753e0c229f4ff07f5d06e6c16cbb5e38928e205a89ea64508cabac4434fceab65ece2a65405400971c48b8e40d0ed1481e076d541f35552b51ef570da92bfd1a6a79a165bc64e02c2e1179c7eb8751c6da60392a73e766c4a20bd99f6f6185a9de4687315b1a722b1f31343681e589b92394b08c3ca97511a5efc2732b4cda330a89afbde2bd3ca8406f805516bfa52e613370c0d24a2ddff89cb5e49de19bfdfbe191426fa140020ed7b45859cb502676ca56f4249cd1d09e1dd8e7085195fae9a1818b1b1e4907e9a3bdeb0ee4d6ba0864bc585ef26bb5d860837f9bad09cea4ba2ee6d31d28761417441e03a80514e81a601621c9b25"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 472; + dataLen = 4096; + combinedKey = "b04f8cef0b2038fe2f9014edfa083c7add861f0770c14150ae03b15a966003dd"; + iv = "019d3e3fd06dc207b6c44e76a6a67439"; + plainText = "6ca805ee740a56919d6d2fc5a898e865548ce3b005880090f26aab062809697137e34d338e10b520d855f044f75e36f49855d74b1711ce0d5546a4285b1104a486ab2c21c6fd2c33e371113e66e0572b2ba6af256dcf3b37f7530085cf05931eaee5b5fe7c9feb12d588427815546ff000c29648823f4cd6cfc9fa8f30fe8e1a91f860935c5bc0392b10407ad2a011ea766aa24ba469eeb3e0fbed67ab3a325f17c8f02d0029f5ddc36db5cbc3e00a98d7a8f2bb278d186c0da13823040633934b763a0abccc737cfac34e1b71458d97e8fe4491ed8890dee29ee31a698eb5a573db26eeae79250d65b079089481c09ee34bab428756097b3def9b0e724d824de19f218cfd39638c5fd0dd1ad523cee85cf7786cacbd8f216f88cc4a9d6b936b4821d8173338beace4885eea51108fb3112f429a7bd7a5f90ae236902ba1f82e60d6892fe3a09be1578f194f5620bff3fa575eb1cefa6d535dae308b947292cba3ac0f928f58a6f44340d52fdb6a31d355bf74238a1960e6fe5effa64aeb985dc61ca07c4765fcdc45ec356650ad2855202eca6b716ea670858ac77de1a6b3c154843c8363635de92fb4a8cca5f88e144c6b863efeb5e5cdc2279e323a410b1b80cc56392986a05c2db94a779ff2b6e6a7ef536538f5af5c51113696325639d51e3ee54938f0a835e813c529f8643302526148b6c84dd85885a1bf08de3152c9"; + cipherText = "98a919987e0e2adba93e8e55b00a7350133a357d06e809c9643ad672470024faebd8629657039cf5a8a1ba8fe3a71524dd235fa70ecd5f41cd8c2b51855e71e4d4108baac4b0e1fa6ae1721f32134007b47028986076050706292cd9d41ea15ea1f282627706e7d8634964b63448253b9bcb53302d8ee5f534f3790a7a42e998480ac60c358b40cffe589bd5b588d27f43eb864acaab080cd6d8fa61b2421cf4b817ce9795259767af47502b7906ce079f5f50cd02b5d89acffced20e976f1e1552b802628e2aca3cd742e0551cb38003e369b86c9deb58a9a8fa337e6ce6a1e329430424a698c396663edd7a63fc879f754bcbe22378f42b32e2345c2eeca02a1f2815dd98b80499956adfaaf369781d3f6d02ed8281681fae2fbb3274709bf312f0bcfa39a1c0bf4ed88bc7afcb59e5bac2f5701efdd0374acf77ab00eeb2b4f4ab4af17407207b921500abf0f75c639ee7945b6587e854643508df9bc58779b8705219e7caf632689fd3e372bee2c015610b7b202d972278fd7a18a122c94895ea3c3fae655e144f128ab245659fe3b96134b9afe5e52f494a15671333f5ae1d6ceeb6b1ecb2a99eba9ea7d0d2d58aa74cd6824a0647945e9d5ceb65c8b776b58e411ddc516b5a32ee0cc9ee242d43e189caf932a2751224fdde65e506ecf1542cb152b8388a8b36623492bcf33d16c75ff814e3df497d3229d6a8b41ce64"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 473; + dataLen = 4096; + combinedKey = "1800668bbe7c57bfea7ce18f3b710a8a668f1ce748bfbb3f40aae4ccd8cb8fb2"; + iv = "6ca2fea2bbab845f5a88822d22117d85"; + plainText = "67c0291ccce58e1fc0994918ff844352a70b5bfa222c3c4eedab6dcad473a5b507c50d6f805629b65a7c14443491fd1c6c05e6c46bc9e82532016cb98fdfeaefe4268614b3b9f0023175a4e4a42d8a3d8f0f0430e9eb4d252b871add3fddbcb9521c341f9c82725179125c686d75851bf50cffce8e5cbdf0aeb60447a7556afa85522ea49727355406b658d14e6d1355279b5d4d8e12ca74b84780835a2e5ab8fc4f76db207d328e54dbb0bda34ebdd64c4214e9a19ead40749a1bf9f0567d861c908183382abbd74e4538c4d28823c4894ecb8eb0022692aad96c1a59ff81975c712d0faa3a8fb6cd056ade0066dabdf74b214afe569b0658c1b42f6303d17e8ac25c1736424d2b097c2a1c252bdd24fcca13b519b9a89635ec1df4ebe021c43882771197fc4c78227c8a7f8b0bf04aa1cef18bdc64d574f8368fd0e8011da02465c0ab878bcf0d85759d6ce6dc6f8c0dc20d17b58072c00ecfdc02125fff0b2cd9156a32935196dd2489a83d4a01a76c52503a33a7c11415cb9800af75c4572d243b060a151d5a42bd9bba88b37f1d337f1ccfc5b38cffc201f17487e2ad39750f1aad62285e2c61e0f1303adcefcfd16e15f68f4c4cca4113958755a3a813948e35bc561e7da554bf91f91a6c2fbd337398936a1488424452776e5490cb4776ebf94ac75500ac457b2951257aacdae9777f08c2099aca0de9dfe78e310b96"; + cipherText = "633800accb2e245fde316be288c8c278659a35ade958b340e3ef18f24b9c46c2648a4d3751903e2665aa3337f58a1327194276521b7fa563b51f641984bae6591c4acb7b6fac49eee71a61aba502318676a2d9ae9246f4d4c98508b1f512f3012a48bb723b35a678c233ef5cadc3c42e0164dadf4a8721b81e89515927c0f99dd2f5b98d62f0be7e99cd8f6348bbc218a34c78f87071fa2f14fe0f540f47a581074e5f7f88da2015243acb20aa90390537afb31c6233a27fefb0e0e6bc61b8301ca45df498b412ee2d52574dc2b404602deb9369451211ea12fc5fc4014186bcc5ac822ce172d142c66b4e7c5f5629909f3c8d5aa921cc06aa32039654d6fe85c7cefe660cca9babffcd1550cc17ddff3d66682292a665b72bbf4822a61ab4972232d4bda36be04fa854e6c33256cac5d855247d477f8e877d4e34a447032012380884cd5619e8b2522b7d6a1dbef84706b4ca5604d3295a28284f8679a9f09d5dc6c2609a08e6fe23cc9995423588686391538824611e18ee45ff1391669ff02bd2756419021a503e450e08bd6818fd22164115990e4c7784845409ee5e9f973e7e6ae978b3396a1210a7774f2e44ac1d29dc8e2d9553054a4d5d618409bbf55da16e1307f932966153d6a5e50c40a01de94ba7121fc1f87d3dfda74cbab48123ca953870448d76597bacd19f25f48a2ba0fa91efbccc167917491339c7aabd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 474; + dataLen = 4096; + combinedKey = "49d09116beef570962f37bb8d70b543193217234e205629be479e134549dc41f"; + iv = "69ec6223e0940f38ba6bac29bed4d7f4"; + plainText = "fcf33228059eef843242b68965e300c029532315097331744611bf21551ee91b20e1ba4f979ac5b43ac74ea1105cae1557eb8cc789ec42cf485ec793a87c82fb8612752ef34962b237299c9204a9c6857fa2667aab2fbaccd8c117490931691e258f39b23cb1739c7adb83f4930d7db5005c850009aa4b39626a8786631c79b49e794da58d4ebf45c8fc2e50954542fb34f611aa717d6b923807948af0277651488ee00e210f76e0c6713c24d5336d30066b5d50ca094f298a35f4ff81ca1e7ac802f62a376543ebcc59de3e13b7495ea12ee9d18d132b55601cdf591d33ff32fbbf7f8a41a07b8db7c5e135b833fe77c8640e817803822c5ac273ca32d4faa5fbadb8682701e9417f66b9bcdf0807e10212954683606b6f4b849d440c4d9f97f60c1b1b2bceae860e301aea0bb9293a33c6b1077fd00012e07a65f3850bda1d330481d2f8480c5615571949a04edf8f898543f22ac070d96552de42013d1c92b1c458909dbc5bf1f1568fc7b0b1a9894d325f7da0da0797f9434a70c31b21b644bcdcf4fdee5a54710e96559b947b627522c7a99189a76ea766eb2f2f09fab00f61d3fb47d3416575b1f0a2cf3ad5aa8e5cfe74de518a2f56d862310df07ffc90dbcac967f60d51a291fc5c879435a3e7e0f22ec0653abf6585a969d28308b20012f96dd21c09fafc5b43637dc98101554235f06a9a42d2329c329fb05adfb3"; + cipherText = "4768ab7aa849283b80f991ca5f2281936cdeafe0c227ccf69d2a2c02a7f4837d2a56c67f656eed21f47c48c5a7dea793a044cb7baa374c937519ff858f40d9759392bafd0da91e1a23c088eedd72e1f8bb6eb488f17b0a0551ab8fbbf9e29c68f75d37e097f2f8c9b70796c6a517bb665995723a376aa75f7126b449d3adeb18ee105176fce738cde70b034f99e3d6a2ea304a486ebaaff0cf69784ac83c2b46732321758f77e40501e4ebe40ca9d4d0bd4dd22bc8f9f407e50d3a695f451d5c6e43d966963482bd33cba307f8c8cfb2a6bf495c1d1bafaafa39fbfafa1ae824d6fabfc889fa163b7e98b13374eea945bbf4875390e097d2575bd105e6c2dcf723a6aeea78c5cc9ae8d2658cdcb45d202afd9b8fb23f27633fb305ae0f196397fc242a533e3290d189ac5641d233caa1f7701a600c709355fcf486647b24ca8f16ad48f93063e160d9bf22e8c9a2da9e641ab9aee4ff3088b055fa6214efec41d82b2ac448f94d8482380d67cda4a3af561b555db0a1353795d8aeccbec85cc0f850bcd0de5be23a429fbcf0520a6f0fc1577b82b040ebaa0375bd391712d1232e80e6e2e679573a2bb2522a5fe781a36dd40717e66eb8fd0ef79ffd550993c3e5aa39abff22e63a46d05184b19753d72e9f06fdbd95b806c66b8456d00bff564fdc9182ea2e007d1b9265ca5aa22dc6d2280fb7d892b229f0d72d51835f5f6b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 475; + dataLen = 4096; + combinedKey = "483a5d4d4980240c84f0c4f4857d93020f88f78d5cf6ce130301544d84356c73"; + iv = "f1bc52802793b8bb1f28bb0b99325ce8"; + plainText = "05f26e4a927ac3f25d6d614d2c89c2124e21a327ce0a5b2aa484b18140bbf57bad57608757255a39e7fc927f44771c0b666d069be63fd67343065e018d158a15441a36958918df84d2e2724637675468aa791dd505eef5977c3822caab6374ff511bb6353700f52079fad2353487526bb7d4bb12c3f3191bbaebcc1ad89711c69f2c94e5ad0bc77c653699f7c7cb239574551af8fc1dfdd4a3501df499c606fc1ffa941ec6b671547a49e639d4074f34848c96609029abefd21c9dafbc62c11ca3b71919a1bd585e88c4a4ac9daffd17191c9ee1c473c249555d80a826f7426961f22fb8d36a4a2911c0dd856397fb8a646e71e410a53bfe3eebc68a869de1e9f6b079cfdefa0e91be91ea2059a5fc6610687658dbdee7aa5e5057bec4fce5bee7ad3aaa477001d18441b67f7d814ec0fc2e5fd6c531d517f4994b98cdbdbcb15b05e088984cae6f2728e82b0d39d5a69a42d66859d93be30c047de539912172877a62f01657252a29b221096a3d4b6e8898ce0f291685f4e84e86a95af3cecf051f1c60223d19fb6d69878386094cd5b423b6c767bab2b8775d848e23380f0722918b63bb8275c47f87a2b1832fafe4ead06b6c588121701c189a33d842305c02a2e04fababbe6431d82dc086a6c0a4a606d9806b95fae284f610c0808b02d513e14c543a6ca714de037b91e384855e9892fb903569a69d3e6a783047e98009"; + cipherText = "31451ffae917d73566f563705a764ae89281523fdb929113b8cb9ee4e1bd505eaabfe54e64ca17bf488c2ee565395dfeff25873e8340e29a7817e59d67c424216f37ad95c616c5254b47bf9c9ae258bc0134f7c767ea6f0c514b8de1d9e671a19da5e2decdc6a624f968f251b025a717f8c7732a130a3e1feb32b13fe99eb25f232d3b884e31e39052eaf67598ee1063b76d2df0208cefc21d06bcf1e0647fd79f8fcb4f2e3f8c7df2ea8da3217bb4ad8703ec647d2b2c3c1b80ba97438c920a4550880311ec945c4776636bd704c5357d5d7263d560d629ab1cb1990690ee2bcc399034c14b63eab15936ab5483a01f227dec8e1b34431102af11b6fed9b383928ddfab76acf34e7422d1dc7636653a294e786f7c48044f68605a71df287daea19a3d3da2e47ed77d4c268b15176edc3b486aa05858da17327633f6a1aadc1f6d5a9e4b073c19f83dd480df4e110b7ee504b8f0446e8fc032add28fba5167d9f085c8cd84197e542a765ff5418aab6583e4decb4b6dae3c74b454a1c8e518a3a566b7eea935591a2d09aae6f38db8644931f0e3f4c02952cb85c2836a8fac9e02bf692a225053de0341cf7f7f60ac0142be3ff1db5191ce4925123a70dc24221744be8862e53dac2b9bfdc3f68b1e17bb8a3d2110b9132465e319f56e62ced4b424e48b9c11ec17a1dfcd1f878d625232097988cca4e4eae980c55520e32a13"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 476; + dataLen = 4096; + combinedKey = "4b8b4a69c3c6aa3456811ac94d9974ba8c6ad4db272ece3e282169ada3a4f3b4"; + iv = "063e825a3c52111b162dea71003b2652"; + plainText = "72dc856d994daf32cd21069c88a359c3f5922854ce6fe37e65bf51afdfebdf8118d90dd572876881554f146a7348405e36a34b7e8d2ac7a3d1dd7b33bb99b41da661ae04a26ca0679dfb41995d7e87618ffe6f21dab970c108128cccd52519c18e6807d544c97367bcef8a4d35b24309843923f5b083d06f6b3cc4136d33e5ef9509979701eeec3d1b9b2d6bbdfee8f8c4f696dbc32d2c0c4d84617b7670cdd4d086fa85171b402f7bc8dd632ba7178f5a17c93337224528cbfe9a6fcd532324d6921e51dba9554610a0df032b8875c40c9cac98d658b8c72014fa20237558a6157f9ba4d05db6133b12928e37564ab9d2169fe1341d0a27774fe15c5ee15b69c9e3061d6c9dc23505bdef5579a6ad84af1e491102cd262f1cb345ece6d76f1fa6f25fddba93bbd33d38c4aee9fb96be3dae284a22870da273588785dc6327bf0025db92d3b8c6e2c0cfd04ff27ec7b949ec69321ef60fd22ab52b774e99f2670dcf6c564fd82ea94434acf572d6dd9de928bda5d6ce103af5cce21e12e97eadddaaa406fa93ba2598d3f2dca0b7b6042ef65047bc865fa4fadd32dbe936b36647128d2e140bd956454473d75956f74a30aee588291cd1729f3118b6f92e0e940ccb8ddaf44b7523b5fb023aa5ff3360669a518e8b2f380b87414db54dfee1506ed0f052415d22a3eebbfe442f61fc23f385a5f1cf2a0185814746b60aefcfca"; + cipherText = "fa8141cd3cf61538f79a306b876dfcd466e19aa1cfa60a6bb103fc2cf7c1d0483bff89f83534fc1936b74797ccfe5a0a5e659347bc0269973536b592ef14e0d842c86240d3493605f6c9b00226390248dec4e0308cc9a7264f9ef9e9d3ff3bbff1575abdecb13c2c6c0f77d93a0b057d512cb1860bd65aafeb77d5f9b015dc8fb381f1e8d3bce7645a6d22f719b25cc76bf4bebb233aa28aa0d74c45ab3f9ba66857ac09edf575120f5fe89ccfc366a3a736d5db3ea45f29d8e6102217ef405c6dba1301f02bb98a6ff8590ba66b5e338eeed75d083dffd3e74b8d926ca36b002d449d4458a9fa6bd8e5e3f12afcec43978908e36f4ebeefde1f2171691ef87d3e7dff761ee35dabfeed7743e71d5543d52efdec2364d86638cd778441c0d1138dde1e36fff75b7faf68d74cc28b74bb8c9dc2d710a6dcf2941078fdfc132f03536eca64e6d29af80681f5db0576358b70da46adeba137e02265f5bf9d84abdc9e5a4ff8f96b1d5ae39aec0006393d0b2334d264b49f8e4513af6fe570a6fbe59d78b7af6f811cb1aaedc0a6469fde0309caf58d639be41da66d0a888ca325494a7fa8e1703626c84d1e7e2aa764723115062efde3161235b72c9c961b6244b396aa52e361fcd9bf523bad1515741599f12d884ddf3804ceefe7eb88307725c23eb364532140413ec54f983cd7957b1e1db5b1a4cc5fd90061e10352ed35d980"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 477; + dataLen = 4096; + combinedKey = "a0debd395c9c20ef592a692052df0facb5cfc12f12ac5eacedf10b69db481560"; + iv = "f48bc54535d0cbca0b8fd3025ebd5642"; + plainText = "02a4e83f4e40dfdf6852619ab2e0c041424227b36a8927802521043df6c1eab345a4f22bed8f3837df3eac4c5b9b1bd7047353ff2b445a5153931c3aaa843f9a1507860b89af406db47580ebd6f8399cbc43be27f202e0f8f3f16a771533be99a10acd97fb30a27c0baac084cb68285eae8988cac3c464f89a0c288827632e41d647261a582d25950c1b8930e251075a37323732144c7a428bf4e34ed60383dfd1446b9d4b5ef5035cf0522cf691bc7406e80ddbf858eb7efc29cac75b9072d92c5dd9892c689908ea3e2507838f8de40c2de63e4b1caadc6444afa4453910eb99c3c5815a3bcd12423b1f04e1dc34f9b3b10ace175f3fdc2ba9c48c1bc1b61d528c76b0be1b16a766f73e2d8478581b76158e1e4a41809583fdd2bf42833c8803be58c5c9795f4137f0138dfaf865dead36d7e2a2ac3b8b1acbbafff240a385cbc6d1097190bc7f022bb34a536a059591a295fb53650b36cfd6c305d0c0a8318c5bb242f7ef35a8ab125564a9bdc0712e0d5e92867e075d615c3d7e10403cbdb3fa4bf0177d8f17b424ca1c3b4b9a52ab760ec104451861de22d905131b200e01c6bfef6edbbb650fe64d9abb6f25a2d6fe62d004fe5208930ed78e3bf06d4303ac8d190934750fb08da24c6053b3d62174f4c012f75a76324f60049a3975d1420426b93c49b36996999a0764024cebee5a4beca8a9828a9560a663b7cd2127"; + cipherText = "301c99cd1585b114c466f758feccb74419b39c9751500bf45c6c70cc158f1a87ca9f10300092cf227d24522107f34a2602bb3008e669963a4885738c327b9cd052404f992e607a50d2105c2aaea653a997cbe6520161ae701f9bd5f5c3253346960587293e846c98d2c4b35ada723229a080c85f433ebd68b5525d852fc55f78f54d3532bf3b8ac892aca5407d6857cb34a68114af3ab5c0231dbec99439a539aa3c2d68291b06eb130993d125e4b7990d7eb4e2a1dd9da28131e6f2ddece46338ad5a8fc68a5a51d04d9faf22a3bd9ac0ad3e8314fe5af36700efd690f2499c3bf04d1351bffdea08594ffd1352a254aa80320adb35d2590b73dfa8a3c112d3433ffc0218241462c91d956d37af0f5c45ffb43a761b4120650d04da48bbcbd5e34ffb55a571f409071294eb48b851b913aeaa3cd00dfe71e10f7c896157fded5b0ce65e82b429466d2b70e7889b42f87bc0457806e085dd66247358033737c30bc0de2be504a5989f0cb01812eec5b6d079e06cc81303128c43b9803c95856ccd915350dc9100a24be97a7aa1aba438dbcaabafbc0bf0f33eec8d4ddbf2421475391c64ad34628dc3539908c3bebb76a3c7fcbd8adec25c093f345cfe931d5d84330864913d32a40e69cba54654df0633031611157efbecaf4209f807e771180ece423867f91ca0c78a7076f835370697a0b8e47d0db222f4c8563b0ad5714e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 478; + dataLen = 4096; + combinedKey = "4199f855a3c75036caec90932f281aba5ad130218a7177ddcab5570f516c95ba"; + iv = "cfe26cdd38aa43c30a8ad21eba4ab78f"; + plainText = "bac1de9c944687b328e8e8de18c1501e28a201518a9b4e675854027c14448c4cc3416e34dbc2f58b9cf5f68b1490f04a5b1a692bfad891600c4830cccdf5b4cd44eb8bc27a1304442f684a40c54981ec6d3d0840b5170777e0071f549f0cb8368f89e32945eca21cc69046c62bea2b64853d420b591b35f8dbb6d1e134adc70556624ea369b0ad6a31716517bc46dafd967b9042caeeb1e7a67127f71eed651d7a77d0a842dd0743ec20a23348520c815319d7c697cfa81507bf1da649274c179afd478a4c95139cad2c59ee1f3988c00b74f5ba3652007fbcd6b6440e85c52fcd14786f5d489ab6ce0d51a58a20a9648b31155b0dc071f163bcf31769a562d8cfee157e1774bcf0dd09f0682a1b7a8be06b5f816202dfb78a33567e16d345fc9dfb157f2ff7946c0a1e98a529af3eab1babadb1dfad43bd86191459b73f3169e19f474f37f6d0678ef39b919afd5143c5d6f033a27e47996824400f78b715511b1557b13f9e362435e3e3b9903d6b8ac0d298130ad01f0da28c29ef967f8cde3e646d2ad01e8d9e3027d61ac6aa2aecabaf9b6ea0281e2c5a71fe56e2377bbd78b30e8791c314b12759b2343e78910918a54d049b2eb8916e4ac581811238cc50dd5dbe3fcddd4265490db064c4ccb8392f002af87be25c8c9e2a19c4b323da5d89487aa709163be02e98e47f4f6643375c96cfd34fc2f3295cdd32b6f8eaaf"; + cipherText = "7fb8f70b69b5c8bfe099dc8da4cc9dead439834a502fa73e00f51acc13b8d1953e765a84ad9efa3ed99aee6386e28fbfa63edcb6eec36201537f068e6aedb27c6de829d4d6bc4258b791aec814da5fbf13367440260edd1b1ad40f7bf63236f6272004b1d2c97d790d30215d2c3a98939602ea8adb8905e554828a997a0ebfec1106419b3d06e488822993c4eeabd59f32ca68b6b5d8c8e1b286061fb66cd2d38d3bb232f232311eff3899be07e3a5cb70fb534cbb42a73bf791b2641bcaf24e0c9834f3df4a10b4f96dc901d3c420b5fbb86ad95a162f6dd9ac77f640d022eba74ca91855e00c02ec491ce5d15710a41df1b5b574ebff17e97cb8e335c29449e54b8636d2c1d1028a9cb8897c360bb9b614481078d8a8b1f0192eba97bc8382e821b0cdbfffc815c5936c72840c5295d250e94f982877a41b0bf42ce6b4360214726387025999d9adcdaeebcf12a21f1e1fffd08b24ae8faa3d34890899fd7ffd1ad8d7d02adabe64c519a740af7835e722f93a4742ef3aff54aac4f73dba88e0de13be868bf1db6d3d9f1db94adcc288f5a3c157d2cf303429b008a24205dfad916f9321dc36458f1c00634eb1c1cd592ff3595ccfc2c1fc849fbf8543a6c4508bde620e9451583be9bf627afef716aa70bc700c163bd55054cc3828350b41e3cee25ba33b61064309926b319dee0aff561fb71d0922e073daf215d85be560"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 479; + dataLen = 4096; + combinedKey = "506f96f55d9e00a469dad4cd840724331146437f166b1ac707bf3a485a310c6e"; + iv = "c2adad773807fe8d46628f401ff23d57"; + plainText = "70a589854f002bd679250209b17e36059e95d615a849bf5eabafb56335d2130186308a8a44f688765d8e76ec0a4ff93195959a5c091d3f316340cbe560efbf9ec058b3700bf2827fc83534ef8bebbdc03a176bccbfea0e24eec9963afcabae661989c38d6123810bf2f44070a1339d853c02874e3445617de5831471aef4029aaa73a58768ebe06926327603851cef4078103f3f57871a238a4cad880c9d482c7186b6ab2c37139ce131f4d91be1ebcbf34b7ac3114cdd9573b75fd6ea5bd121dbeeeab99256d746f939b31213f0ac1bb6a28a86b80810d06e651e526a9683ccb65e646a97b47a570adee1454dffca12c131eabfa023dcd861cf2ad62e4285b87abfec4526b1445d72e1f16f344fb589442b9b93139928b721668f7fc49816dbdc557b11467553276b59c2fb3f5702da6f8ac6d1e5036d7aa1b0d49e1f113da8b67af2400c0bd29a7a58e376cbf20ae9f9173af75d543607f3c50dfeef8e063190ea0616067a8fd89b5526582ddef23bb2b3bab5b364aca85cb5e929c5340eeff15182ba24bb8c7dda96413a936a573027e8899fca5d2f0ce781c35ec8913292ef774ca6d298a7b541d2a3ac4307c7a349d9aab7eb21fde6204ddff9567365462995c4e44e121bc6f265d8bf0e2165f6295085b4cdb1e476e541e34cd8bf01f83cf283eb2e6fa0132647c8fdd283fc19bca6e48484212615d71269eeacba5e60"; + cipherText = "82f15216d25c9789d5483f9d0aabe216b86e1421d3b3bf3e9e4236db96c46e3ed9c219c034b90e46e7a09626c273e90886789ce68f90a648144422a460188b2e5e03369707c01a5bad393eb4691bc07fe4b62b5af611c74c969d622f0054d2420b5a437b8d74d4efffb2d2b2aba3d21b6acf8c05e7ddb34bff594145445ca1c557de9aebd2c88d348c8b8bcd08ec60f3f16baa9ff73c8eb415947876c6e1749e0d0b81cbe9ccbfc7430732e2bc9ce2b314debbf3babe7205813d5ce3d132cabc2b3ccf61c05cfa45e264f9ff882d0e4ccefda22b4ae13ffab37ef2535c87d16d1e10ed6d73ade686cd65b3a0237439b0af2a05f618fe53e74e2d68ea3bb0f4d73a6e1a51d19375bbc6fb952138644964bf9eec5946c45fd9ff050006462e28bcbd7b7ce9234ac6657d876f8c91c58d6f30ee3e33b567488157919ff61b46f1a5ce51ade2491319f0f1e7c0e6c4d43f0a819942bb7fb97838bd9234efe49cd2e49b0de8382cc1d475974a01ba430532da6f64f22a26072c013c42be8cc74d425d68a113fa4898e2bdb5cb47486e18f8dd3c04aa48511bd03dd41610a22757443c63d2f8c3ed56195efa6bfaf9fdbb72eff8de02d1a01e46716603281b23d4f3a9441aa62c0aaf0ce6354d50033b858e14fa5e8d9033c1c30450bc41d7da8f45a3dc39b4b5a5c4960be477bb8e29723b7fb54123db7699748f47843814ccbd4120"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 480; + dataLen = 4096; + combinedKey = "e89584bfe6323e1153eeddf1835b36a4a6f8a918e9bb6d783ae2a2f2fef40140"; + iv = "c95bdcdc106a991d0396f1b9bc4b2794"; + plainText = "5e892302064ac95dcc569a71e5e11ceb6c49795569c77a02ee105e31a87a5738a2f03380de128490ad8f7eb19aa69b87d953ddaac613d2c73df3fda89111145459daa39b47a66269878d4e6f3d8b80f380ea3949688b1371962ed7af8a391b6bad01f1a92852143ba17d202ff64f224baa64946d85df26ad18f57ec17dcb54d9b2c8229fedf1ccbeb97a4d38da7e0d925353b7881bf07e635b43f52d8dfd9822d0a7644f931c800b2c87682285ab44c91f8741daf210618bce62226d690b0b36397c4c00a64ca5f0de3c8341d5fcd931e49474bd072dd2d27e1ebd8c8248c813f4478c415adab796c8f5f3d5e175438690135ef8765cd5886836bd9b7c00787f4366bb8cef3481ca4f468fa19d3ff734c6d29ee69aa0e68aaba8c4808f640cac891fcc4c2f277bf3d2b75c55c71ab428024b1aa28cd519c9d90a66ec8c1b121190875ca7e657a5d7bbfd7c8c5be64eebbf17ac07bc1a3cd23ec47484d056cd25b39fdd3a54769c33375263b75611c37a620076c9c68df85eceacb698835e33675611e810c2c37cdde82ce9c3073d08156071f36d0e5496f34d5d4833f318e4bd334c193be80c4f2d2b206db7e2b125ad6f8f9592b8ce2f4fcc6be17389483a30fff528444635ce813a60b153d491510106cfeb0302ba31b12bfea57611cdb801c4582423e9f0fbc6a3f3dc73d15ff93ab541cef132a25dbbb64f99816faa0aff"; + cipherText = "8fc49e5957c421b9b75e5032aab52bc3f6127ed3f4387958a0970819e5dcbcc9a7e17cb9e09e7be6f532d27993fdc87c83468c7072fbcf5e268737e7207a37106d5661386c3e3e9e980718cada015a43ad617534f128012ceba6d0fe011b67f9dc0a51fdead23d87695087ea4420fd5819be4b8e10fcef9c252736a1e09307be80a442d9b0ab8bb2c91603af9103136bde88c7913792e38dcdf642d672dbd9be0276fffc3604272d68e2380b58cc06f7e0c89e5c7e284ea4df3e677d302fc59c48a003b4487b0a64ae2e34b2716c2d13888d824421e85e6b4f7a9a2fd33ca6bbb0f308635fa6a76b960e2dbfa935427c2e10b28520359771f5debd3487cf2ba6bb06cdd45c118c34d1323164a0bdacad20fa96627a56c895969a6135cc62793c1d5b5a0fae5d18892858dabfec7656124ed543d7efd0fbe6809ba1a89849111756e93d0c7993b9682bf5e1bd9ed5a40b95db2c4ec8dcbd933c18480f47cfdd853a0c9e8ce6e638f5650edd3ff8a7c52fbd57c514fb7cea0e160e606ef949a1ec7ac0ee6835039514b6842923b9597c8ca4f5c399729465511b51fb53debe8c38164db03378d4e55ced5be923e2bd5e99f889007e9e016e9484f2efd3d7895bb2187b9be1e036c4ffaafc83161db784cececab8b7aaabcef8a193c711be3aff052b837e71bd2f0e2137d33b7abd362c07fa822d6a0760cca362b4d0033154ab63"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 481; + dataLen = 4096; + combinedKey = "3632ea697a1731e0ec4e851463d4caa2f7a3dbac8a4d3b4e1fc7b620bb2fbc0f"; + iv = "997604e9ae26991c80a300e406df89b6"; + plainText = "c8764282273f94e731ea86a58935a308ffd49b7d7d9cf3fab204c806e3c8e709514d019f9165498bbe8f96ccc8507e30416fd0742fb78e971c7dbeec386946ba6aaa74c0f83a1ff951dbf6f577cfc066ffa2956b6a93fe0cb24b65fbd5172beca733d819868c53fe55aaeee6bd1a1c7f824010ed8debc29d48d91259ddb425fff69f8e7b60c7cd39fd72abe413d0d8672ef3b783c983793425022c94ea72a815dadf5a77ffd69aee816d28e3e0391a7ced0b802283bec0750a6090372d9d298b8c34cb95ca2024bdf71bbb3a8b649f8e4d282484feed6bc82309731cb2bfab6760752f39f7683b3f41b439346559a635ae51e54768f9355925517d46b2118e0682fae054175b3c0efc0e9901811a64b005bab35086c585e8a7c02e766e4e3572e8da373946e9aec27cc478a1625e0302a9d141683f75574b1d7034e2fd4b622f76c36ab4e227abf71a16790e3311e90b8d13f68b1d11fbd84364dcba2687e65ecdd16e0a8258673b60838fb1d9d3d40c366e698743513b7db04fa60ac35fbe4d8c85057900a6b67fb57e159fe0e3f02c900ce8b949e0ca6d528eeed73ebdaaf091aacb8c0fbde8c4e2f06fb6929cfec3b896af652d43d90e188b9a1335cfe329d1e10ebc2b6da97363c6a8d5aed658cfb2553b6922a7b25861bd03598712f3be21e6505c42e4a4b60021ca159370c4e1fdb71f538222d9f20ce214d5f4f746c7"; + cipherText = "4d35a5e72ab8a9782683494392052976e7b0df0366ffe828b5f6d2c2217fb813ec2306ace89a445484a741fd413de208f2184ea86f6f81a0350bcfc397a31d37bbcf875cf6e26350d05378123e549ea5f4fb9b33fa94151e79a675c198b89a60bb8e771511628a267b9ababfed2ea4969fb9dedaee868a47dae67c284694514ebcc68e8602d516fbb50a391d7e2ec7d34c50f68e0e9e197b5a76bbf35bffe4fe0a1d21a8d8d33e6e5aa00c7d40c4dedc72d9fa663c99e09bd8cf6ae7e710959d0350052d0b7322f710b8bc13ddd0409b2ae3cd86eb74b20827d2227a5d456c68c20a37f54e73e7177ddb3ccd48bb539b4928d0f692ecb65b66462a66d2a2505aad9d937c4428289a273be6802fd4d43b4b0003ccd1e21f9ffcb15c0abd927152e30e4a2cc4eb225bd60e49adf47abb07125d4654f036ac3f9d4b51c9f467d754ed40a2ee5fef6d401689c9b7001420c6c9b474e81614fd2570f58ee41e2474a9dcccebb90ed1ad58b92d1f591cf1ac583d43eb86325808b4a53716052ec8910e5adfb1fcb606a8f5447fc2083223699ddcfb94300fcb20448f15f469a3681d7f397090885667df4d70eb159d8a9e828b9c09c35fdacce009aa0aa851656512dfa04e5bb41730d0d91f81cbe2fe1252afcd78d0a0f3211e25ae6744f0c8f996322edafec4616d5cdbfc0889acca330adbc5da1ba602b3bddb936db6337354e049"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 482; + dataLen = 4096; + combinedKey = "1f6352f625aefea8129b32e7de76f9e526385e168a1180e843f910f23fd5fa20"; + iv = "af405133710c37c19032cd9ff2518843"; + plainText = "a853ac1bd296599ac76280530349bf32d38eab36a0d91d0e3ae092ec8d68481c5da27fed06498727df82ec8908efe62d434022493804eee4066474ca8a47336b2e8cd5c168a41a5503a0725ad7c8be6f8eb1f7af84f0a5b44513ddbd7384116b6675a0b0c1eaea7e3c2f515646e0548af3fb5809080998683cca21276e0f23f1f3bf9d66c4c43783077551a3f58f82ef0ee16348542c64f319e641b63f39f09e8232af6c77c54e727b7c1270e2f62cbb3d68e6e052aa9dc62bc1cb8b2fc4fd601a79438eccf218dae0e2382326a10c5ca0434f0d89990da35acc3dae5c6cb2be951b66d6bd584d2e06acdf1d0d04b9e442c9870568b1a0d5b6db4cdbc8056285eb09af48f389e83be9c3f18932f18481fe3f940f06d1ed53b835d3b99c7017976d6f9bc1b6342603c8174db1a96216ca9a224076d8e50b1298e280397a780bf99a44fef6679264c38930ceb239abb2c572ffb329e4321f0d2ec0fb9f42950524cbc701358538ca497d6d6c4229e8b0c62d85e02ee7b6355b7df7d8a691ac3d5df7b751b6b27a159c68db09a85e49a953317963d03e828651b048691eb1b3c7220195f1c0f06c22885ea2ea36da6a2d4fd92a68fc2f561845c63095530960cc5611d126f7a6fd162f1d7849624ad2679fe25f70f3bd817b8567cc2b8abc86da79052257f7c4ca3865d05322ea1e27960a29439a03e2aaf978f88a4513d9208c8a"; + cipherText = "1e232514d7e3b88de7f8068987a62c52b10bef587b83a6d0083dcca99d00adcc38956a077688b69429dfda72fb7e478496e98f552fa7ed59025338af558c089dec4f8e2f34d707655144a37e7d739106311220bea5949907ad3d77c133f7ca5b20aa3fa9e35271da0408338c2c88dfc22994d546f47ad2e7aea35cf64735b11a7c4cb70c6b10eb76485ec05844a8f2ca7e856141d056125c73783dec43f91fe7c132ad31796062682138b6f0ccb2bd09de05bc8fd1cad8d2f3d0f3ae5d0687475e92148e6ae226281ed44a75f1b9087a0aba65e987d5a5f06f74b566661fddf478ad5a94454bcddf8f94df5bd294018df428f448afc7408c5c977c42d8109ce11389885a1b30e75f219481bc752b2af1a4d9fba872aa8a3231a01ed764ff8734abe61f02bc87670dceabcb8d5ba5e2e6aee08d2f0cafef0b2d7702e648c2ba6579e900f87357db699059aa45bb32136f46402d45553a0833b49a58b209d0c605a006a33b5c400a4ed51858b47460ed2acc869b88b60fc3ecaeac526e0fe59febd918ebb32348fea656f42317a3d3e1543d3acfd36ca2d75b239475b22a7b910267b439d0ef73e13f284926b1f04410c195d2906180a7ce308057356688ec22c9812eae3c137f8bb7092e823eec2b40e31ee46ccdc827ef9a2f45b6d9a8c124743d9da974838ad1e76ed3efddfb9509b7d76f75a9ccc67c3cdc41746875dfffd8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 483; + dataLen = 4096; + combinedKey = "6641b2599462a4355e303b402f1f4a901dd6f10c21f58200f76cc037085e429e"; + iv = "1b921638360aa4b3860d4c2df03875e1"; + plainText = "d943b6213058d8ed1a3efe1083041f552913b7f7403a27b576ced9d97d34a45006dc86f4278d0f40f79de133118f3fef6233d32ffc991c24c67f736721fa1626aaa52680dc6f52a7afa62473ef2c0c5e735dd46c7aa3472e7dc23965485cc3177783f110be749c5f338d728d52ea05de07c635f260e948f3a01ca47a8f2b847a5e306591a68286ddcb353aaf48615061db321e702fc9b03b31a3b3711d9c5b40cd23503274a390a135e5cd1fe47ab034da51e03cbb66fd9ef6f756dbe66b9f9c240c8949a78fcb9bf702fa4c98be158338f32e5dc8921b373d4e34e39df98c827693cba67a49918f0f80f057b53509bd5305877daa9bf5089977a1f405648aa1946317360b01820cf99116f56b8e6b2dc5ce860712c7904c7015a99a0baa8510aebd4230cde0cac239392827ce872bc595f9c18fc870c87e5d1fd136e1fd1cb292442b041986c0bbea1423c1c2307f48ae799553a27c5763ce3cd3203a93f1397072885edb37fcb552931d97ac28a5d0d78ae3db7d6c35d78c042b42ca9d43894b714d87be0fe26aec7c55e902214ea3f07a1a773c255406532a9b49df9a56ec503f01986be5fd2c20731b5fe470651ec369534dfa57133e1b77707e1f4c639d3bc03bbfbd812995fbadcdb94aca0537dd4f94de8141168ceda92e42f0f39a817c8e42e5cfbd35cb2678cbaffac60c61fcc731cecbd3358cd08f0b79b05f45ac"; + cipherText = "6e18f6b095f6ca869149174f94e80deb7fe5d23a067accd3543837d56897094e2362f18861a851f0bd756bd80c1517c055ec2cd50ba438461d394d6aa2f8d5aaebeee14c78c5c8cac4b06718a9cd3d67ce707d6fb5326efe2146c15728f0c2f1aec8439976c70568300e64a365bc96ba2464f94877628f75ca074614ed69e47519161b04b7dacc8d86bd87034a37df3a56ff71a7bbe1e951fc94cade9a3f6b860c8fb39a7571bf1baab76724639d95e5c5f23016b9b69bc313cef69938b06e96a0e235f46b319e9d31d54168fc35170e7fa4b8ff2f996d4b91c58f1dadad82d2d5619baf13bc94a414b7369a704e4f1ba1c6e51f6938b945e35fccf5c505a676eb27e3cac796c80e4c4d8bbabd4e43c968552410e6686dc0548ce3debac4fe6e607afb27a6aaf70eb74dde71df692640d9d2fe974f252f1df290e2916abde08c48613a6a09fea7d2860f9433c6586b27df385ccfc342dabded3fe9b002d28df56bf9df68ab1cca91c5650fc5dcc19174e71202d8a082a8306e3d66f09fefdd1e698036e38dd69ab42e8398775216cc4e6f246730dd649318359eed6e53639c7c2a1bc6fe0f322e17e31d2ad9802d17714686a233b6a76782f4fbf4b5dba8afa9da937322c40b2ba2278334760ea4ec916a298b9cd6caf76af8c012dd93a0b9ebe8c7ba5098cc75d3c2077ef58861faba3ce24cfbccc6157a4c1d74ca5c07ca7c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 484; + dataLen = 4096; + combinedKey = "a1ac2aff4e4f6b1657611d227f713005d479937e46c9f0ff1ad71a3998b87753"; + iv = "8696f2b73b26011903ee7f5da968a953"; + plainText = "954c841c25daa17297120514b9781dcbb1d81fa1a76fe1ecf303fbd632ddaa8d4c12ce5a0a4287b984989e8bb5fed301cf91d8be38fb01832dc2b678e6d87d19e772add88bde12539e49367d1cef4b0b4ee37b26c2273cbdeda51f5ce89b6cafb409e9afd8017baba92b38786179f3b87356fdf68b229470064ec34497462801fde75bfcee93b668e130e8332c16e554c6ec91c28b1449e139c072356d3b4490b088f2a4e95a270c262739caa4a5cbafbd23d3fa9f6efdf2f6d77890b905be19e124af7a126baac2741e351f6f459bd5d4307a5035e67437859c1722d8d921e4719a00d0e0ccd8842fe5335544ac01565d43c62db3d8f32b55962c2308830c82cc357639ed7bb5fb4b3edde102d0c97afea624a8ea333e888e203430c7a396514ab76fd5ef5633bf2e9581265f6b20120a125a760c7a53ceb07f2ed4ebadf14f649538caf5e24328b8a199a1ae040c67146d7df0ec09cd52cac57e2d366a058dfbde8740f6023d3c7a9a083516a14f4cbedd4822b070549a122f0376d374f1d9d79f1ad9e0bee9cda30f79395f4724efcfcaff193f924cda75c91b8a79b435b256c7a4b1f1a24ff58fc59a9a8324541024f495826b8429eb4cfe2abdc7b9c7d7ec542bf7194efb496bcd84f7cd5d04befaaa1d9fb70f82d0dbf0f8ba24c29fc097908a62490afec0f8010e0f4e0b135e69fb48863ec6007fff68fa989c32ddeb"; + cipherText = "7934cfba6abe30c89a769d5d06efd25d0891466c82a93cb1c9e48dca6b2dd401099391875d63000064a9c4d0903a0669ed0e7825f25548a4b8cc8c4a460a54848e2a6851592c2fa2de17a8fb6468296733669a6939dcfffdb2c5eb4716d08a35a5405d5068b4608d82c5e27667895ec667ec91769159e089c05cf75945448451d8fab62517a754f70efda7d00d4612e5c4a926e59684fee67f4e17b5549b2109848dc858f00f98294540f92a7d27946f066e92d1bfb5c9ca6359c65e72ae0273df379c9803c9c3be8114836a39851529a378cb910c88465507d901dc1a559d48730f701d811dcb9180b2c3d026511f67269f6c626c86d400ba160856573f34d0ff30007f4bbeec944149b67840e635fc0dd4b6daaf0f2d054ce57dbcc628dd36accaad52061991338aa02b655fb81a3d9887e6a47b2f7613e70dcc9a6bf6d3f37ceefd4108d33e3647865430fe8defe887ffd5ff412d027da1412ebe0e78afbbdc100289b118af785d218b817cfbfd1f709297acdd45d728989a4c8ab6a02148e361a55bf4599873e3700e1e290d37e0d30fd2155fa70c16535b7d6ee45219b4c910bbfdcf4db621798796b03dc0bf94eba37c5528df5723c19e53a68ad753e73b9da8a9147675a733286027d9a2bfb05aef76480fcfb0d0a9db06504fb55ff30c15246148ddef30b0edf36164f02bee18ef5c4cb645f69fe64835e6787ac05c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 485; + dataLen = 4096; + combinedKey = "8a4c75f1dde8dcdd51b0895145c1d8c6c6b3a8d5fc1b0405f4f2edb1fe6bbeb1"; + iv = "ed06ad38a1fd44fc0d1c0a8ef3918eea"; + plainText = "03bea3e0a10b103e067c752c5f0e57812ed6599da511234873b514323f2a8614ac6c1285c293afecda5d6c19d09baf28a78894eb189d53dd152a3c0c6a903ab337e25a870e7980c2b2835394e960e2cb6813b04bedab800c04abf290d9aab8062c6a513a796160f92bf25391988c4bafdfe61187965b0fd1271a5a6d846b733d4386d24569a5e5812a3c84cbc841530bc8694b1adc1baaad61fc71436e7c7c135e0e5abdb113228497a30d309844d4a04acf4f50be2329bdef36d357cce70daa0e431462d1aea53c5c26ad8c87cbb831b33075650ade3a2479238239d075619f25c60a3a65440163c8dd3b9a33d14be084d1b8b445abc6a8a28e02c608351a90e55a076444bec8093ddb383172b1ad9154e217f362e882943783592f29f6ff43a57ed7bbd28295e0004024fb82be580fdba3d551afba932f5a785be0e366f026cc9ad72177a383e66cfb5add529070f123ca07bbc327a4e06985e9ed7b771e5b46704360f7b1b9b1c70df0a6cfb11bbc61f7025df1a22ac65aaf4757cc99329afc3d106583c66bd75d80a698e655e747c7e8df4a31ec26d5f592324b9a3e83a86ade026436e7b24b70a8cc3eff6b40ae5b753027a15d9ad20de3c890440ddddaaf86946a004c88b54a962f5c3ef6e9bf9c26da1dbcf24197e719aca98cd6cb571dc2d9e625f32d774a1cf220380f7acea77724ea47256101fa78d16b1c979555"; + cipherText = "e1b09cad16c0b01bbe81dd75af412760fc34196f4cd70d8a8c80db4ef0cd8eda7d5624c7cffec80f7132950a0eb049345c2c634d62f9715362bc0ab4418e3bad5596978ad83f2ac393d2956e3109c5e4c412b3c06339c0c5b3ca7206461a1a04c79f97650da69caf96ba9f89812a9a97f76763412bf9ac23aa8c0492b1c180a0ac8b748b0811b0e51440c8e5bb407a7dfc5a4cbd1a9f2f62e8f326e1eb0a11786c704cc67418ef19cddc19aa74cf913b9468f74f616d47c49e06078d39b6918df56442162ade8ba1988eae6338359972182511dd3584be83e338ea8e07e7538e6c30cef2049b386601629d4d111669c4eb2fd3d6cd1c1db54c4f007a3a6d698002ad3a74901ef77a0a100ec493831e949c3e59d25f632f6f887a71c5449d889e2aeb87e92155ad50bdb19dc9ef47ea4c9cd122893089680f67240cb83c8c170ea5c3a1c27b2e23a06bfd4c036cf6a9252c5ed2989b566129069d5b1a8f2738e17406407b7a00553a1f59d71115686955c1ac884eda3e7cef25500f7653a4c8965ee6c6afbfed6602582fff346ac6d3e1cd87d70775d37ddf1873a4d4b9a35c584841b5366ed00b2c36a58ef4f6fa7f11361fa3cc8fa9d0efe49072621f49a71437002bf1e1fcf4d3d93b3aa28a45953e244f5a7813377047492789ac1c6e2b84fbcb8450a9fc34db278c8fee33744b96cc13f694705a1d5b40ca45f0f7518788"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 486; + dataLen = 4096; + combinedKey = "c350d54d50e848d5fa5209ae545377e9bffee17b4df7c23e55faae751b4c39c9"; + iv = "c939e6df408f112b196ebcc37934b070"; + plainText = "978c1fdfca264fe98e64568f1c3647f0de5517facf78a6c3f5644faac2f216adef84e8dc99251dbc74d45cff1fe43e60f7c3617f35f7e1213cff602cf9b6e207dbb7a93a39c6daf76d5b6dce6edda8539e7ab5fd240d732c72b354d64a6eae91fd4eae90cb0a78c189d00014709631de2760b7aeb053af9f1280d49013991ec4194d4e8485915f12a03e1756183ccbcf09bf6f4174fca005c13b94d8f082744df280be9d731b90e13b48d6462eac99fb308e0ce201fccbdfcbdb5d78a655f3abd1a513e6b0bf2dbce7bbcf64bc3d6d1e7651eb2cc54a8683047f15e541a66c7bd5b71d52c569b9e7cfaad673a0a4fe9e9508189c98bf674bd1bfcc50d2d14f3e8d1c7c108e60e5bb962af68e698ff61025c9a0cbda7d9f499e60bf077ca224f8678c1b6ebcafe59de9aafde342ea683c311ae589fdab01838194c420110420c99b49e4b0921c7e147cdad13c31771b063ba2872735e03ba1d7d6c9604d3c28ed8e70928251fee2ac73b5acba4b2ee4ddf6f7817a4e191aa540e262c5f11ff455b2a2baa8435dfa307e4a8f78085662dd59eae6d1f965c6bb5fd5c8a99644832052d492d921140976bb4c09d48a58f0c08557ea34a1045e81908dbb14ddafd8fd75b0a8cb8f90c3c7aaa7e3124bed3b61ad14599afb1a152ec176ce6e91e3cf61c7eb3f8135200e7ef826cb83f97e6e3bae46190fe60058db41784ca8b034520b"; + cipherText = "eed61a1f841604f5896fd532bcaf176957830e1e3a27b460105c2dfb2a026adb55d1d9a65bc7e82e3ededb1ca5336c0911e7ff1c8e04db729bc52268f3873afcc1498b120e37313a50d194461a4b7fb6df386387ff47ce0a35fb3c42278cfcfa5eb2036878e013a322b54f49829940ed7c54f44c7557c32932f5f7f06420d408ba430e52e273e9edfe0f49c7056809a5fe98bea055d2244be8b2a1bae266ba3348a1eb72c01659a301585bfac6e29c57960e93c9ba1781376b90cf0972b9c08aa5a15194a8b790d5dc6c538c1b499f6335157fd08cdbd868bf7929b2bf486b3464a43a444477d489c6b323370b78e0eefdc703855a08689afadf227ce89097e8823d44cf224206e607ce6169af80e89ca5be5d76b797e0dbd65b5faf41699dcaf6fa04ad188a50b6c8f3e3a6607865d5748d821b32e47b108d12aac0475a71fbea47f3853d1b077818dc9bc877aa015b5c9cd69d18e4212f7fb544400a522c4b1aeda7b2d2d1e79d3796469834282ebbdc235907314406ad6a1dcc897d270ab397fdef40b57fc29abefad3739ad375efee1ae58eec9aa49417f191120f0a980cfab4a942d2d87cf364c36ce69dbae3a61bb178ff36130a6d968ca156e2a86277a08a844fe9c28122687b02334db449be4f0f4e1097080a214c12bc222ad922953f2df0b67fdadea5f7a5f6f78f8dc48db53db0556cac6689bb02135ae3aab0a8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 487; + dataLen = 4096; + combinedKey = "b150753da3969c79f2bd681d5652b0e0bf6dbe7c75a96ef80db7474adba41446"; + iv = "9f0b5a19d5e55727ed88a5c532fc4ea0"; + plainText = "7a7b38b7d1d3ef23c0225a9742beaf83bf3758680dfbee2d88021462f1dfc9b71871f9bfce8a6a847e2c5034c5a4184c15336e637a4ab43b4398399e15f7ca321d875af76c72289905a5029047988feb74adf281eaf250374e6107805fbe298ced78f05f9ee2069002a266f7045cbaf55a6e6372cde84418ea67273a3edb32292ebebbe707dde4bb354bacbc365cdf1f8db8b5b5e5760af4535ff893b1a31dc8a6e93c1a22facb7d9c18da25026f3bad1ff6569d1fbdc83694f77dbd78900f573b0ce3a90bf3978e1bd520374a881b4986275110b57248c6dfb6e97cd2a573777ded057f7d8c86e9b7967527a05567d66f1052dc2c39d5f81e73d6032a4909f537a8d2c89ae73d147e2857d63c99d66dc0250413f2e2048f02676cf98805b5e0d893d614f585697c23867dcbe0e5a2ee8389537d6e229642d0a3b6f8b6f6e15c03e5f10077558dec7f0ac9fb5eeb58997886ff8bec4cee85b194c403900573e661b585eb1ba984a18423430a063657be027592070d810a5fc77a6e36743a5b4e80e6c740473a5094358f22c106bb5dd4e478c48fb09e84da8fcac2eddf5eba5f95db9246e6f14b190b5115a086c6995a1b3e266dbfaf170045dd6a7a22e18b8da3f97a41144277d9d6a83688d16ef5c4d9b32161086cb5d40a66c7e644774b5d9388db38ec4a000c05444744916cb46743412d7ba6525cb3d791667b0c597de6"; + cipherText = "64c69900c8fcf20790bf62b9f6a49c39ed3068daeacfbb030a64679b332f457c51ca1100d98dc51fa5641cfe7274c4603a2c8a39eb33ed4c1d3e6768544777f1a803d968f793649bb7a5fe9e61249de813e413e1cdaf54b4b9578fa608458ee3e27193fa0863c743b5c8b3fea0a295758a168804efb6a5c57266bd5492a14744b00c97f909ee66b37961de39214f0659b7bd5164468feecf8800652e148a15d0fedc3ce2fef6b8035428a3a3782de00150366bf39045097fdffc2bc3c3acb603ac04f3314c2857ab3c8fdbf8ef584341c20b49294b2aac856f3ce9fd5bd19522d2d5def052e12d607a480be8aa1f720f244ee5da667437928ca90f5b5528948a212c2f66f1260b7975fdfb80a1ce2dc359777e455970e4c3873c397caead18068951a77d562889b5906d4291257cde3fb0a61ce9cda321f0436a082da51ed22f025f8e63d6d8d4bb37e1ea86ee47fe78b7ae6c6d6e3307c945bd62be002125aa2a452e2b2ce9410297f1aa399ae40d39161dfb109d5f54645454c6360d6b28c9a44bb1f1b531472c9acec596e9134fedbf362b6f83dce73413f42e463af9195130c868db5872ee5d0ccb3b5df0b1846cf9cf310ed389146aed1ae20ad653d453601bc7a7bfd8554a1c8183a4c3f02ada875dd767b3ab28f7bb30104d6d34cbae51c01f7a8b642fae70de25c0fb9f55cd3ce27bcf2f1466ec06278cc57a02b7b0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 488; + dataLen = 4096; + combinedKey = "627d80144e0025adeec127c33098475d8277c95cf1df814dd82860c9c320ffeb"; + iv = "6e7194140a1994cb0cc72a7b89b7fe0e"; + plainText = "416d6325d9d78cc2a3c501f9d2576151f9409e8505150d20fb42d48df8f5b681b5c49d8606bb4aed7e392e958e9a00fada59db1d77664e2d22b71e553494eb35f6c7dfe0e55313f9432f292e0adf1dc627da530e926848f29734ae1039b444c1f7bf44558917d58ce8a56a165a74a80f3ec0eca83bd61c254ee777d6c0c68ce730f6f7b34fec82a66f6cc01b2350589b3d3ab9e125674b6688a23076eb5dd7c2dc036acd1b083371b81bdfa6801d98ca5c517791df815ce8a1aa2777892ef15b51f16bc51a1e2fed565c7af60ab2e8528696cbfea6eff54c9aaa49e5773e1149fe28d75d4440e5e7502767d3758c3f7e25e025189c9afbe66e4aded782a6110cf106494ab6d513ef2378b6befd9db45d1bcb836e7cfe00bc8b2022e17f47e35ab3eaf7009a77f7261330d5b798be8623db7b6c7d78b08283a75bbf4bea3d8d8042062eaa5e0ca1aa74f67cfada103bf199fcb509335dcb5da11a4e28c91f8a785e6a1d92311e53f100716762b51738914699b322252423aaad3a7dd9dc22a53a3335ecb1d40c386482497126de9f7fd1cad82bf45412b8bdfdad049e75479c23f531d9f066e38ef1aa44539d5bf129a2d21f8e2c277f9955c1d7a8ac63d62f1fc7d42526b8bc7504de03e497cf55bf3e9dd4d2d9b0419761403d57b57f978aaca4fead80ba7212ccca08e1fe3e94a2e61677d4abfcac00e03dfd3fc79ddfe0ef"; + cipherText = "b2bcd4bf56694130ac93dc37f40a03c264061fe3aa4db2d5f9cd76bab3b3b187397e67b7c6b7a6dcada03ff61378c2fac212da984b1ff3ccef64aeac94db8b97a2175c1f24daac5aae2f05c9c8189559808d584853d6a61be740a5ca8f3de1668dea98fa579ee542c41a0ac529b73dc050040804710899a9b017941d3367beb7f743a36d84a2afb592124941540f428117bbe998130a6f70b6c688f71562ad11933576e708a6ff564d6a07de98c23cd8877746176101f0b8ba781dda2927625d082675c0d2650b2da4aa327adada4f5b33f8da8e53d51a284b9107196032f5c3d9681a6711a06ac2338a194c4454168d0daf2278ffac5f1cea97c4f2fb0576502b40adbd1d9ffccd8983309a4d1b5c58ce224f4a3388df1c3d0adbc4153b77e0b50b84556b777ce0b1569c12731c93ec1019c93b475a99ebdb03de361d1e055bbe0340ff2adf8a231812428793f1baf53952c9c7e23ebc0f4738941c1aa9d19824e413b3cd3d5811b2b165c4f5eb5574b7377b3d1fad2c542011e904ce253d876d612940ad065262c3612e213407178597b09a300aa1d3cef83f3568be9f8616af48d71470d8bc96f81cff6c54391e3327f827436ef6b5ec70d1cc8bedfa369ad2751720257a2a4b60e0ed9c4953aedab68b03304a539c83bb09105e440600c2f943381882c1240982fddb8473f5cd57ea25cffcb5514e27c6993e302a681109"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 489; + dataLen = 4096; + combinedKey = "6a6715630de9e29b34af235e98e2a973c12728add1e97567b0425a22f42b4225"; + iv = "37b261ab5062e3d4e3bcd97d532845bc"; + plainText = "0dec51d652af001c8532f0b0e6fab80fcfab130edbd8bb3737c63efb9c16d33f3fe5a62747505fcf713188678bfd470574e9c57e3d17565621cb47b7972cab615ddab87cf7e040444fd63b7f48b6a48c64aaeea9cff4d62c705f35f9540a58a594491bb1e4b4e0f15a83cdd6b272f51c6472f73ca26dd05fef6f14828b9125f69194e16a75350b23a778d885c9ab753154ca9da607c68acb02e56398b174ce2593e59da4b3bb5d83267391393485e6065b310b1e6037a0798d9fdc5f5e95787c46938898c0a528aad3779112a5315dd1107f236bb63c5bfc6e8cddb0498367e52511afec67e4aa9472d723048b2c8ee4e31abe1d89a5dc65389516ca6a0db420136ca8608955cdba4dc669f9177b21834842be9f5e45352cb9e54482219046d21b9d3da02a9bd14d326b269909d5cb8b494c11320ad82a459f362abb7ae3c6ad6d9a4e4fb78fdfbac902014268e977b1ef0e04f58efd82abbe6a3e019ec79ba062c599a15fe2454f0ba85ac00a3cc15051a523c0b38a1591a38164b92a1f4a21dd018300bd660f210cb8b78d80e2cad69d383f361a6112347eb4f4c0ef246ae747e9902af85b8290f5dddadd6dfd78c49ab81745f77e0fb53fd17ed5d2c26d49d93a9756fe542a94f88bd12f04cf0956ef3ee7e71da746b62e5750cd81b4139631446897f8ca197a3abfd7f40280bbd0ecd9564cc4e88e07eb7a84fe01e34a5d"; + cipherText = "1569e92827cbc6940ae71b90b3a5303ee6c46fffdf1d7c3c3e18a738381d805ec727ceca7e0aaed19a03e606fecd008b74c13a04ebfbfd75441d9da07842b5127ea7116d62d7ab7003568a31978a2acc73173e8f9c0bc914b8f6d58c9a5a7344c4c426084b685a8a015567f41d1cb2e58a3d4c0c6fbc386bf4c70e8410075f49606b07a2263af8e780110dde80bbefc8bd311a0b52c18c516e78365d5c30db0f2bef8e79d84faeba1879f8bdd6de4adc91afbea57fe73c507162590c82d6c657d229075b49e7353c56cfb0b7a705cb7008875d21a953226a477c6c857b4372bd71e893d8d214c94b5b323063643bedabb08adf53c4690af32b940fcce41fefcbac3ea19d0d6a3605c8b7f5147f1cadd0dbf00689b3c87a5a455f732033d1241c229513ec8d4fec743c2afdbab381d0c354addaae5ab852e33cd79fcd2979a5d7b943e8f195e3d79ac2031c97cf0f13961be2ce2a3fd4d9a17d8587dbd8caab845965477a5665c2608f56eb6ef6d7a0871f4c9e35595ed2353bbbaf6bdba61c74fa070759f710d9ef3d879b3be3498d87a1552d339331224a94d7c7cc6e8697af85628955920b627412219204aa8a450e911e449b640733ebef85f9b75725c61a7d4f86ee9c395f970b6c2d5c33d518033695b8a75914fec15a9cce8742803f241c4c143e32c0f93fcbf49732a4bc79897c4e55991af863913850a20f513b249a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 490; + dataLen = 4096; + combinedKey = "5e85a8ba6729cde15968279989e3792fe195f2adfe71defa76f6edc75e566997"; + iv = "f69d1d246f07898526a0c5dd7763efa4"; + plainText = "23e8e727eabd42ff10d33933ffa5ebf611e30640672ef7df5cc589de99f826226d5be4e2a0a6e077d385e92b27e8a460bf7e01d900a725ad9ad5ac1982fd5d6bbbd369fae515cb592a55bcaa3eaf4d1c94bf5a7976f3e5746bd0d7269bcc2aa723a28648b74747a77214e4f170d66ccbd4b0b9d4496bdb6a8d76844c6babc7098105f49dd77eb56bdbd4af170a1d3c0c4f419589d949482a95960f32df144f268002febef02225dc16ff81180c8aed7d6e30a897a2d3c0e9d44314b91d625c2955dcc55370a9da30c5260c25786c15416f47894fb5b39e58a1c38c126dc81e0f786e9365545835a3347d534774a8a7918e213b744073fbde1e2c78ca9c11d99f21d5e52392cf87451f263c12cf66d85a6567c5e39ae7f6990c1b9812337a19c2818bb9ecebdb6b9cf78af2aaa3c49a6fb1c66be94d92b00d1477fc096b29cfca19d6dfd3765905ea75d62b37291fd6825e86accd3993ce19a36c1b7c866cf49153fb08d96d8ed6c4597323715f103aac1d6a040956cec3ae7b54c88b5656a075030dbe1b25de4441ab6eac5006823c3857ab2a920e6a5aebc5f4694abfea66bdd3b00a2b338de0e9baa8fbf532693f6db58b9aa01656da84eb77d3c74845b91823083f643d23c4363216cf3ea866ea9228c1004c8d1193dbcbeb6cc65d72fb4a1b45d6d2aa0082eb0238980aac27cb0bbb0000e7e43a23a770eac182764c45ad"; + cipherText = "af7dd1f8e98373911141d5eae570959c516b0329ad74f1ce2d05506c98a98e1c3b65e8da915a23bd1a276d77dd81598862876dd75f753ce24986edb95f00aef9353a48b0340da9b9e26222c070d21e22dd4a6d80636990a339d2df0359bf10126b3928c168ec13ebe19f771d5d5f1c1c4bd4c8b1492755bc202e11544ee599ff2e85eba4f0193b6ee060ad4722ba391ba92499d890301fe2b3cd8966c584313a9a4f31b4344d12e731c327f207495b6a119c43e4aeb2ae9c23d3ae0ddbbd01c503c75ce2805715f62425b158bedfc79dc36a243a6d72c5dff780d3bbb6c59d256e14514db86dfd1f9317283ab5be8c89fd85974f7748342897daed5b33377cf549b3bbcdf4cfd3199b5c103a88f8eea8a78a73aa7b681caa6b30278e218ca89827619469fa799c001ee02f91bab004f98298c6e531002d60d41e37e31f19231a6f5c87d7b5547ae3510ba031c37333ff93bb8e20365633e836593108a7b36958fb62f80b5dba830829534b3d874d07af6780c8c9acc9bed525ff08e3bc9dad16299c9ebb3ce1451de0d90921de9cf7a4a571c3b9bba892f81ea68f711164246d157fa658f2d001b9e8eb5063f03a7eb9ab855306423dc4b0cef8c860d9c02eef0a90836b68a344a728e3c6859c894ff519fb28dc5814c26b0c30292e19b7d97944aaa9148325c17a2ce8613d10f3b063f080e42e40e1f242b81345f4ba830e08"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 491; + dataLen = 4096; + combinedKey = "58edaea9c8a2f42611719f98c6fbf3dbf6107cd4fc9faef328f87a47f95cc63b"; + iv = "ae11102d60e043c23c2cf486323cc836"; + plainText = "d6a0cb85a11d2335d7c314d184ddc50470df751bcc5a015e4911de24405b372fd56d17bc3cbf7b0411f40be3c9a6b2290be9f9845ceeecf3d7b6b134cbd8c1180bc9a9380ebe6d65aed2f0a793fda3686f4dabd5d716de7e579cc57a91f30e8cbc535920b1f3110b7e0e99ef76e39d7833f12b8a04549c9f372d44e3649c66ddddae3bc924158ae3f61e5605cb43e8725ccc124d124a9c672745462db88a8fce6c4286a8ac87d2819855b70c58f77bf76b485dc1b7d4991a8372e1f6a9149335ba0cb2069bb3200d015a2b3af6007622ccdfdcafaf1ee6b2a5734e8423e38168fa1eaae473999f9cd171bf0303fa71f1e4c659c0d864b816ed2611f2b283963b3c44e4a1b24b2e88558bb7171d3095d58de4390f7ffbedf3ffb67fa25c1f0e5546a3c6c1e1cf5db3bf0b9e5d859d4f68f7acbd358019095d997bf180d1048cd960feba9c75bbaa897065d68b2ba00e679a479bd0582044c7b8b213fcbd4c780d8749bdd08d4b773ca52419f6517dd4a2a7bdc162284ae9f236348f84b7436098c648732ed33ad47b82bb0164a974162cab9f8293c9b2db098941706bd64559b241074ca3884980e992f99bb5bc9374018a2020adc8fdb670c4f567a369601d4d609894dfd75460857e3a1adb1c24d725dd7f8eb40238307c24a109b1d5b133b5bebceca028b35181e8bfcca830122b2cb07f51d95d8d0eaceb7837e28063dcb4"; + cipherText = "b3d47290f9c068413773df35bcbfa880d537346613851e1b629cf790d10ff1a42052b0111b808a5cfdfef127e3dbc9855d114b4ef4114608a59700a1d0816f738eee47c2440cb1d05ea1f88b87cd7dd3a0b23c8df6b11694bfc2cbe4352bd936d04f2945e57741bec6410f84294e79d00c44de323f9dc3e9a585ed1e3e06c13b4629bba6f76976f022c031b8a2763f0e826b02e9b20c609b1634ea4b51dd2e4ea36d0e5bbe1ef5107e3d146f07677fd1bc73f183db5b1c1b0e4cb57d1b06ef796fe321b5fa9ca2580e798069f644f88b4cfffa443a35020c3f95b2811a943e80de1f9bf208ce72657a7604a5254a1fe12616824ddcd363bd76c81bc1e988a710a4f7dfb0b7117474cc8311948f795c29d416c39d56412486c61a5ab94db037da4c7b803a595e0ee286bf39e5ac98ba452aeedf9430f481f987c3aea40c96a9c3264ec6c297989d6c81c6d97bc4900d7bbf5825cae5d906b2b0363ffe99be06eef3965d97b8f761aa1bbd968808e381cca83bf9ac87680ff804832a08223f8b9cc328dd90b1b33a78e6a1bbb65a983af44794a06832fa6526996d24ac2b0ff08d9d516c153de6d1e9b42b3f27b112e5d70f0182f775353e508a4fe61d8a2387223d77005470c32ece482d1d04097aa09084c7d43d908235394c3c19020410ec4e470a1db1afb6df2078b762889ec285c4bffa3d1024428cd08e1894faa54026d8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 492; + dataLen = 4096; + combinedKey = "3fa5eab4835500bcbe72dfdc18ceb2c2f8fb8ddea4c5244f9f77afe8981d96ad"; + iv = "482a394df1392602f60b972f543c518e"; + plainText = "64fde316e46b5190cf4ccfb5e012aa59c31026187d87c56d66dc8bda913279f05734f4ed21262b5fc9d13d569a3b3824ae80ae30fdfa0c8849d78a7b349869d5e01668ba5dda0d9e24f2c38afb103ecca64d760f7c98ef29e07d2993bfc61228d2a2cc8f0bf05b8a1bfbef9bd1b7996a5964b287f54a2329e9c03118e35b801c161840fcca60e970147ba3533997c8c148299bad3581e63d23c2e8fc9f00f4da6d6fe51492a7257da48ba2d3a12b866e973f285604dfee8998c99263b50fd9e87e28bb46aacae976474446d7dd3c1d609d930e37dacdb27a406cefcaa62daf6a5344fc3167828c2e02776be7a483efc0a2d022fca6a62a531afdf7a459828c152d259e1ac4361c811f4a616fc9382d3a8ba49ad49208c6c6812346edfc7692b27f33ac10e7d130de67ee899571a113b546ffa0facb06c1a6a000235f73ecaadfe99157f3e4d7534d6ac69bc632c8a5c54e92c3ff67bc65a88de58f5f057a2b2d6975e38309984adf8f546f2fbc608222d3bc95db3e847f67be0ba64eb7dfcba9ea16cc9059f182f5391b8acb47e8ad02ae9684a0b9fa825dd926eecd7542ca351c0f03b79737573172c613c1354939f60d0bf2313e47ab847c3dd82120cb973f5e2b8bc6f502f79c0e8d7b347376b47cf4d62356bd3cca387c9569ce285afecef0b85cf5bb2ae81f47a0d5fe5d555374864b872c6c237ab66081cef717f5b6de"; + cipherText = "03dee9f52c16a00aa3b1e3eec26b1122ba48fbbce70a7a4ccd1fe92babd8c1aea7cff19a15ff9f57cf6a1c314a42a0ff8eb69c830c85d23be7aa13e393c50cc8111b4e7c2f664e7663db7ab1dcb0bb9341edcec7bd2996b01202fe4e9606d0d0e6d391c905945f1663b64f42706fdc54fd9552b0e6213561e217863321f268e267e28ddf40fa69ce5fe0a056cb82e719e6e0894aab67d2f46082e02136855c8ead50509655a50593ba8b5c633607666c64502e27410d435802a8c24552f77d3cae222f4da23e564e95c8662e08f19ebb326dcfe0320cd288f2b8973ae2c80f4784034807cd6389d15ac28777c07cc44c32458c8ea8429a7521e4b87b4b78f1f2c21d301e2ac0f0a9150344d2036b31418a5f1965c1963c68168487235383443578c5806db812f0f40a69e9e83cf46269ebd928fe8dcc63157e774f3ef3d9098c8cefb7b1857ba28b0bbd069f04999f0c52410612e0c241f7b08234f70d8f4047dbd38213852c65f26cd146d3cf0ff2b0c6d2f531274560f15573bd64772a7420d4b30e37ef4edd6f6d0993daa887704c78e117f35fca712883526c89fa49f9f015e741c55a995f81fdca8a6f54490e45296eecf0869d2d4f0311fb07803d69a185a113f7382161211e39a991d0df48e34aefcfcfbc3085e4060160f5517bab9eaddbb3372ec41fdba12f97142b1b040567334f0377c1de5683ca2e80354519bd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 493; + dataLen = 4096; + combinedKey = "1c21b198913a6fad46972fca208c5713e70a3c37651fdaff3c45eee9c20b7f19"; + iv = "5146c53378843aa0140ee51999b51ff4"; + plainText = "e0a38b519f51b9d16931df21fd476687381761886fd19e7085e89ca9ec2f9a1ad0ce43380d8c7555792ab44039647f70f502043daa05ed11601233fd43c7ed4018be1ce6a1dd3ee59b6fd8bb6eb83b95874d8ef3cfdc51886b8bf98d2e1171697ee460b8726c2274eaac7f85ee498e66ecb0b1e5a6bdd371281579d22e718c6e6ab4dfdda451eed19795177ef93f730f39ff04124b818544ada43a22955a21f372e8a51813b0628aeeeb6cd7a2575a346ebd512da1665e20ced92c0cb94fa7c0c7fb18026b48ca38c829f078f012513888afda039814cbef12a703b53db8d9094acab45fa80853fd838b373526d94e6f162e129527b775ebda60828bf08703713e6eb58c49427fc1beb8ec63b6cd9adcebbd0fd8fa02c79085ef14f42b079562d7df89e38a856b957fc6af983de985c6acecb3bc72269dc5fc45dd00e34538d428d107660928f0dfc5de5958b0db02db991a4d0161be110e978a69d5019ab51c0f90e31fff7563dd0ab2cc490cb1cfcb566435ffb5cef133a519df8f13a524277c8585a98021503ca80e823057c358c7d039a84fe181ce35bf059b54a2f46514ae7d03dfd9608a0f1fd8a1821e933147366097f8957ac268da1fed97d393b32a7ea412b44317c235f7e0e4174db9dcb797cfe37a666c4213ae94e33d84207bc1e909f45804588ccff9c838e7b5111502d78444348a78f3d2a08c57eab0d09ebc"; + cipherText = "7e6bafc409448348b1c11cfd661091e6afc648f98f1bdc06854afe06c49760bbb0e248cb3dcd17f21bfb0bf2ce238690038d65db30cedbd28e8513cb055ad9655df1cd49b68d17b1bc80c6f2736f94ef521de3d8a5d31231b08bb4426561d59d15cf0161e9e37b83c82f892ca227d6898ddee227559415dcc55262e5e23be98e36593995883c9ec22bafeb50154df2c7b824b2c0d6629f4d7b8fdfa7471ad173db5ea2c212a7e92587f649a1e39e28a6de9ee765aa990ff397a549265486a94a9e51eedd0cc46ad913dbb511bee7d02a0d10e8418994f9a2a79307b1fef054879e7f71df5d29924aeb235d3aed66e17e579de2939e53d7cb0c7215ff359dc5cdddce14ce222b9f8be863732dc01fd0213a8886f638bc00bccefb429731fa97cf02db3ed198dec95efcaa2c862a80ec643c680a0f06918e674fca37bdefdf03f8d9087ef3e02da8b7b97d731b746dd3835b525a0884227a37e04545625918217f5289a8779020e635a153e3ae7b2f44e1e35cd8076a13cb487f126926c0662591a62c4c62b4a35a0a256538864fe979531e0467a7f1da67df19c626f2cf3130f852cfc39b4ecee5d081b979ae7ddbc8a05a02741d6cce96555adaf477965f05577ed6980e4680e9e687e75878976cecf31495d6a0e82a6bd03387f56ccbf1bf8c2a0db777b27d442f6ab887587a2faeea4079bc4c0a159de9872380592c426dfa"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 494; + dataLen = 4096; + combinedKey = "147253c04ad58aa0d4b53b308ad14a0028399b6d21cdec97cd195f22945ca892"; + iv = "a51b21bf9786b02585dc871e4560566a"; + plainText = "d0a29d79490636e22c64b6f0e2398ef3b42e4cfa4064cf7d7ea8713fe17b8f141e2ca06e7c57b642cdf40302e338b6ade4ac193b54f711a850ba14871bfb67278deef1aff44302aaa183acbe0b5619289c6176227665066f87fb1bffa1e131e2e7e3a721e2a4961f705b29efa64b32d5eb0276d0a797ecf2e61c1791f1c7874be93e893834a3d304d24811ecbf3c99c201550fbfe4f8c9d2be41d02b0a15fe0cd3c8280b8cb8dc29339b68838c30543810be0a41fb24c7bbaf6d184ec70d5885206ed4753eb03927be0731734d1f01853808c71cc58b3655ee9c5ba536696deb3e2a3a958f4d7e8ae769526a2ab3cbf547fda1caf09ab69a94f5f3c289f715d662da8888cfe34d1c26f8b250c7ae0fa3eecc7f5799c80e9cbdbdfca6e2912b13e238f9efe978021ad08ca8ec6f816801c302d5cc3a435a7ab41315e7c83d84d6df2a5f001470f0c6f5f957579de322422a97699c196660befa6db1c7bab9d064a5021daae02c4c32a4c63ba8d688329d1f96517c3776b986daa5bf2e90716dbe8d749e7b5081916d27bf6d100e1954e68732e23d10b64ef3430bb8c1e5cf22e339bafd27a72eb04def5b2a5bce9d9bed18fbb74ce9a86ba84cee972ffd84713fce7d8df31ae6ff361280b4b044aa9655c88cd007593ca5e5bd2b9efa30095c395823021dd8a45372eb2e4ae59b523f70f08de8bc93a8d52a5be5e96e0223675e"; + cipherText = "b8ca233c918d22f030017f798514ee89185a4002c17b15a135b20cc5778b2771a53d314558eee8fe6f70df02c09569530580f0d0638fc93a604999d43d6bdedae0aae43e650ad12dae611ce5c804c66b07d4be2fb437ef06d0c2f4c19cbd0f4e8a05cf5807f0c1da020be7954019ce3cca6998fdfffd69ef74e32e147841e106aea6c445faaa9c93cbdc4eb000df4f61f19c05b2446dd49b31880ab14c7edb350f0e378e5c67d1fecbac7455cef913ad7972466f89cc2da49b4c70eecea0fad8cae4814f532c3c757da7d16b14c4b28e21c62788d5691c99abfd8b21b16fc8ef985066c2ae4dccefc3d9cf9d47a3dbfee6a279b6763ab841a7d393504ca0e85a5c6399fc1ef725236ec51b87cdbb94e025bcfe50f0f47db0ab4926c217f9ff8473c2601d3045589836938a076dd23765ca797cd9fe67158299dd10e81b202a1af4dc8d951c9fecf8e75e6d350c377a0f0398798e619ec0003266fdb3e6dff854ab863ec8c57448f691335e5f47ae0792cf322c15c2cad79f15dc631cb1070f91c3e8a831add85509b6155c0b2dbbfa635c342d69efb602f23f65da3d5c65bc8e199a1a46ac789ed143d689a6c1b4090860ff8d77b5299d8711c8eaa4a527fee0fbcb960c86073c3be2d855a6a6220d4f7e1c35f81c2aba824ad5bd595e575d02aa3700f787f9f57f6dc6eb52183965339e948b49c36d64db85d2625604a5c981"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 495; + dataLen = 4096; + combinedKey = "22c5b59653e2e52bb7883501aa801f38ca3ca1179fdd5ca37cc6c0c2078ed3b9"; + iv = "ce559fcb7181275a9440ba0a5eef53ca"; + plainText = "8e32bf8e380337915ea661b30292002e6308c5335d6cf1a780c207483af4508d7f9173979a9c3b12a74d7b015fb685bce2caf7bac5336f73f32da39f34148aa096327f38cdbb3f8b50c5fbf0564fea985ada1cba5990ba501ae3d1e5a87c228063de73fb1c27faf4ab97852622e7333c5ee83f41dfa9ae3166307296840d00387400d96d61d6b17375be0c95bd5e60a4485328036d6ebdf92ac9682f9698170e054ba5fd8ac557bc77663c0aeb1cf5c9c82880192d9d329f9424a8d182e609c87ed297ee64c10cd5b77053c3183dfc05f9934dad29637e043347346653046055e9b0041a98e8579f0abd2db6b5c58c3c9aa1d9e25841cc11a65c6540e5c7b2096978f058cebc819b41f4f39e7faeb894a2a9f196071193960569f9da1fc78fc74b3de2acb724448ae0c08414ba7953de318bd95eb6208ad5b9a005bcfe6ac6f65f4e246cbe75aa22b333fdca74886a66448526bbb32212fdd32be847432134a8924eba41616be5ff1d8b7e6d7d6f4e3341572a815e3cf0e4b347515128a47f5f83b74d32bc9338fdd51991d1acdd0f1982bf59898ca475e5f9d9347d5ef87eea7f007d9f0af3fe6fb7e1b30c7b5cee5101387b9fb974dfd8db10ec14ca17810f169c876bf3721cb815eda1a69f1962c1a28aa1483dc000714a31628e5b735ac4b2e2b23cbe2fa8f5c0f748e13fe480b9d8763592dba6aa20e48991564e22341b"; + cipherText = "53e76fc2fea65a29da72d8ea7cf36399a2b023129f2e1935b912bef249023194da34d41f7b68e82c669504e91aa9b4ba79f6a868774f89457f19e9773ed8fccc531b9d573bf8a9e9ce64f41ac868f9d7b2df951986a0887a95be393a350d5f47a053a5ae7512d9737f91351f46a6ac58147ff79ffbd6933b50eb06993f5403c48eeba03d7541b0344424ad5c43bc203edc21682433503253abb51b416864c78ca93eb930b1200f620bf42edd157d6fdfd5c5d3b3fcb10e1dc264d27a178a3446dfe5bae7a0d6c8f79b007ebadfda9a605e0e15c68e5a9c915b445571c168d80eb4219e9c41460a91998ff4ce9d9a12107ba76adc45b4eb4b9c13ffbd9a9c51da18a58748f2c4dab877e96e4787d6cd2a4a0c546e828ceed4dcd8070a6dae73b406d0d3b30db0df47d99a865a38ea59eec3d89367dbd02a09bab894f6b7f721abf859bb372a50f6d7ee7d997b58f5947ee1e5e5a1795b4b5c8075d456572830797de35b1d29436e2525c430fa5c698d732b7b38a95e03d375ec930c0e92791145fea2f13295b906d2d76be45cedad39a087a637268baa6d19d23055b213f984408f38d8c0e5274f6f2209082ec2f0b8546837154e9cc2fb1c73ab1ffb178119823c527d449f202209eab54ba2a7554c17674ce68e39cabc183f3da25515382932ec67f56b0f7bdc5b7c880e1d073a7b7a89ea72f84f4a5983b5eea3258863c2f6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 496; + dataLen = 4096; + combinedKey = "926355c5c5ef67fddf586f2e4883b8136c10664ac2368a0fb1611ab2286841a8"; + iv = "c65e24add9047ecea57e1773063f57ba"; + plainText = "3a0237a59c7848d45402ba2652f0494db78101ffd426fc212cea11304b5fa21494a6e7a9a0aa0230f166e3620a786b48568e913b14951b9e5e22f36c3f24998987a8764b9077cca7651ed0011f6696c817ad08e559b6951d5ac0f923c94da52642f9447878ec2d79df5e7b5e15d2a219d06a5342856e47f280409e88cbe87242cd3950503917b1f5764e8e346dc1b034a4c1dd767849379255435fdf2d83ea2e2a0a05074e3174fbd1bae040683044b2ef24613f1e47779cb168214d5a5a07976624ac4a5ff83223663eacc7136fe57b871b53366e5ac203d313b3021c10796ec1bcebd7b9edd6a14510e5ec3d1bc76cc2cfe474ce4fa23c14b2b924eac77d7bd2b26a6c5fd28a8f646b00e22194d6d2f23d7e55502d7f7302ab661ceb95182fe3a81e7a060238ad72e8f830772b35d8eb4378152296fd49c49e9379f3c2a1c9485d22bc0e3c6d21167e9392719bf36c76d25fe0429896b235e670cac7cdc029ddd909063a5c06b9887c66918a817b5cfc7431014f6c53a99ad3fa006f9b9693d77bde84cb81a115c87eb879007ce881fc5fb685a5b43cf15e672ede3efc19ea2683f4fe6a9308cb25534e0677e26ae65fc6d15ef0110dfb717f8b8cc069b74e7f7d403d412efb60854ce6bc5277ee44ba77c09394995a6db51f889ef5e6be15b6e2d3e43bddb4fb3f7628c61c4a3cacf5fb2bc585f9b4033dddbe88b935b449"; + cipherText = "2b64f9d6746361c7e5494f77b95735f6c5ac4a4c9e299adcbc465dcb30d6cfab7e92bd6de2f966ed3e471c884a97b25f77d5ec058036d84610a7c3d783b4432824ca82161ff0ab336fab66cad7b22cbe0c94c691c74b03614acc10edb01c34ba522dbff94dcb626cb5413c2a8ed406583607fde2f93617f51971b3eb5ebaafcfc460761880784b35b3bd1fdc657cc9f5d4eb3b23ab81c8181743d88302b88de364d123ed1a4f726e1ee4427614c59c8a25777f61bfae623833c2002f65381cf750799ce94667cf7ca7076ef3169aa9c04f387d8e8a1012adb807cb177ca7864e5e971ee7d3d53d3634bfe4e1348956a0031b0753bdceb358fe69220ae7e65717759b843863c17d52fce0a693b0bd677e7c56388aea1f5243c26de5ca03d79c6c93fc32b1d24d244630e4aa7c6dacbbc7cc88e3ee7a54ba5ad0c5896d72cd28a5ad8bca2b64cba813f7f3e01283d21db267a417412957acc80f980d345edd195600841cce87e18e24f1b57e65a4e9f88a51e0d5f7b5ff7a997531ed590702b91931d47ec2d60e7a940c152e528f6d71dab4e2210e325b117c22294847adbe9874bf8332244deb9b1761f856d25590e16f8547975d3182185077cdad00696c34a64de1627ea87c4738ee3ae7bb85dbc3acc89e5eee49f7b0e44aa54be425e28097bfb0e448a9e19dbf033593ba18fd38a162d755ae3d8d27258957bc5367a76d8b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 497; + dataLen = 4096; + combinedKey = "94d97b403d657fb51493e9b5913261303b27fe4e2d2988ecdb9e35f66a74ea97"; + iv = "92bde0206c98027da74579bec42084bc"; + plainText = "01f23eafe9bf1ee657d4454a23bf9c6833864582e6e8fe16d80451a18699d80f99269b5936e17a7c0ea0fbb503330e27db92c9461c5c46bd64f5fe13b5d1989c4beb8e86175ec9deb70b5fcbff74d64eb21380c3eabfc1804e1c5fdf5eaf2e6dda6b74ad2e96068435905a9a2635d1540872e38e29698b8e11bf4236c5e3edf228906f8dcee7d095f94bc53314d6ad9c860b4d8c5a411839d8f61ffb28a7dbddf73566a1dbf45d141cc3adfa260ba6ed50c5af5238759ae8adf3037169e71c73a70d7cffa2a60451426bbe7d638181ff2d58765bf164d9dd2e23ac557e5b0c7c5d51e21ea475f369f43320248e52c376c9df7b9485f71812f09cd6972a9c66d436d13209f60197a2793c8dce3b549c27e4463017dbca52f284fc9f767a9d397223c92da86d520fed152572e91973fd01268bfe16ebb1c0498db60b24e6417680c34b49e22b64496f240944c06a657fd78c7bc21d3a9a20f088883712ee5590173d6ec2da888a46ff1b89d637ea4e7360b3d97723ccc624f25af48ba16a05bcdfe33d9a08f38dcb981140e415bb366774ccd793c35a0b3f6e3fd4fe469784e89be1d047f4191d8055bf116ce5ba1e754d326ffafbe09b9773f646b9058749008fe57337f6acf4951f71e011d2a1f98663b96a42f27e1a72d1b74967d143c7b2837d023ffd7d07acdbec6e9705b1ad5c688726f4f9c1bb9e3acee1a8b0f38792d6"; + cipherText = "957774270ac16c75523a910a0efd035ce66adc6b24272d6a3af1ddad7899f1158e2bae85d8b673d2336fbf04ede7ca68fc52487fc1c8c3989a2dc3471a0aee5302fdfdd271ef61e932e10c102d1889d8fe59d010f15f5f4ad9ab5c10c30e6b555fcb736901a919a4d76ad1d16250e84434286c605fe52f0767085b0a32cd13ac1a5245ede8f264b6484926c7632e323fcb30975990c9f10bf03f0963760f9029607a6445f2378daa3f9c4e712e747742da73d2ba4753ecc11917bee1586f00f12560f5a15b9267ab9af071fc51f9fd5b016af785505e12dc75bbea354634ca10c3d9a8e964bd212fe6d2d878d1b86d14d00bd5406e5531cbbc94c2992e6839161987aee7bab2d7dcbb329105509db84c129c397cc3fa807802bccb343c5ea49ffabeccfde6a6fe4cad950bbff83a4723d9c86d52022f44495bf275c2ec79fd3b9d4b2d1a4521e7eeee2f48a0856d22120be84c4d63e9a714f781adc4a3f100a29ace3dd8e6e25df7f56ea8bd5902ba2061ee9efc017c5566460e12b6c1bd0df9afb8ed3326fdc11f6595f08c5dfc266d2c8b1e450b401520070091a0f47dafa56d885919f7ecd149efaf7cf68008a096d5fa8b89e62199e2fd70080ee29b28931e6720113b355ff4f992b33713adcbc726a23089c99bdd4f667df5105b5587973c9ebe52231b2d03febfba9049e6a0f3dbb05a26b7ac33ed64a981467a8a8e89"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 498; + dataLen = 4096; + combinedKey = "a96fe624320caa9af4cab7a86ab88570d85e7c404eca151859acb27bae067c2d"; + iv = "f5a7917dd191555f22aa6e798141a997"; + plainText = "e6aa287399d3d111471614c3198a6569f5d4958fcff47d1b8701a7ef0d2c31dd37c3272651624d989cdbbc4b7c5414a7b488d23fba0dc77dd8d7bb9b80ca7a8653223d053308a716740fa1f63ea30362f7f6d41d7c9c9e9473277102d35e23b131013796f15d351f2c30c622073600d02742faf9f33b24f84a0e0880bd9f7b99c09c005a762e1488ea79939221bd130addc961a3dce8359d26d81189eef4b93935018e0bce793e82f6fa04bb6b10f6af3780d119c674fb67fd2d2aa82aac5bc0ddea7cb64f38e5d6d0977f582a683027172b18175c1cd66a91c011562b379375bffe039f13c61ec372a597cd2a12f343192b83d93e16b3878d282dc3fec877f31c0d7b9a5e70ec915770cd711e8c8113f74461e47f67496d5794f50731a673d5002718f282267c2ed45afa5d2f1b84660620778fe0d497540c31f458424a21d425d64b5477cc626e8a6beedc42d7f50a733845461d2fe13fb46cea3b0fc2347b1f70142bf3a6eb040ed3b80903ab615ef6adafbd40157ad4f52e30fddcb15ac865fc595db65e79fec48909c195ae580ef61546b50e49e504962f6650832c2be773c7508dc258339143b81e3abd6ca7ea4921f07110427ace4a762726223936ebf439f94c199988ef44fce83c8a94355e617be8225991f497245fa5ff7d818b811975184f3ad54ddac051f8b346063260471fc2748143d2bb409cdfd3f55f4187"; + cipherText = "45c4f933a6ac901c3a6d8d17784d4758bd19cde363480c9467f1ad8c58f3605b3c6bf174ac926c66e194453ca5a5dac0d748bd603b3576681409f2e4c91557a0910ab88b8c898b9b9a6a170dce8951e7e042c9a4f471637327e23f7451228240447c0828d4cd2ff8c5a1179a2a7fc7623015cb642ea4649b13c2d47eaad05eaa81f7ff2d95175a8e2ab249f6b8f3345c61d6aa737ed777206e3fef5dc7f20bdba7923809b672c5c39e3ad952e538f643d879512ad58dacc7d0be927c98e2267786fa9307b1b0bc1f0166765363fb877bcae4d44423ec3a24817e59f6f9bedb6707402b2eaa379423071c8169419546ca33b00a8a5c6d4ea6e9e500c57163e530be61a2a2eae0434fb18ef12bd53ff4b42ca64feef98d44decbf58f1a54add6b7bc70f9988e554f34dd07a4a1e7b0b77bd27f5def9e3697fe28144b4255bdc10fcf08d9a7372f901b7a1e00255546ba79c0297662dbb18a3062ff547c12bba45ef9c1eba44a8b93771e88a058ab5f24d42ab5db5fbeb0c1c68d5417ab683886edc2365d5936bcfc5079d848bffc640d18961049adc6c2ffc451b8bebaa93342786995101b965f803c3a280c80caecb80fae985f5fd876a7b29d1635a61d673f15d774727747abc23d7cbb631d3148f4d44394961397614d5a8982a5c6eba2aabe303d37a7a37bbbc1a0108a2608c0490a6747763922efac8a075ef9c444aac038"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 499; + dataLen = 4096; + combinedKey = "c9efd992e96f27ef71165cd9db1ba628d7da0a1cd2cc85a8ad47d169a9d028c1"; + iv = "be3356b87021381f792b7f1b0fed71a1"; + plainText = "eeb9d19f81ee0c71d14ecefb78425c0d7ce0f3f79feaf2fb61a543b1d0802e9fc9f30507dcdb9c5edf6ffdeff52b072b12b108eeb1531c954ccd3d19c62334b7723670f02126b432e11ef289e0a38aad5f1e8dc7a64b63436599077379ed049bf543a28728ef4809da3c7e32ca63b716bcd63e68e3d3f4d0ae0a574ce77493b75dd7a4689dc8aad6f73297b74a90544f793e9553c9076a777293cbe2d574eeca41bb7cfe87e306655388085e4b0e74ffd19a91151a3daa9f451f43cf81af9e75ac8469bbfcdcb87c8fe7aebad86c6d1ae13ef54d2116a26b3419516f79992cec1f8df58427667caff18290463a929a89ccf9ae17cc6c0224ea8a8a7ce374277dc1c2db8a072e137e857f67e9e858e0fbc699d9da4c3d3bbbd668abf71f3b165fa9a5960342b5549405df373f28fcb59ffd9038e8575e446a5f02e52696b5628d5f9f8f05ce00a0647fded836aad1be0a010af79e208ca940a19dfb959a178e12b5e6d506cff70fef6ef1368cb1f8c64e835d57ef97599535a98a4ee773dc7090adc5765261ab171c3de55867066f8018a96755dc9e53605450d6c9fb7a349819354a558249c67b2d37bd42c20e70be34c4e804d7864c4cff3ccc223a47043f9da3cdd53ef2db03093e0b7f1116984641ed31f8b44cf7ccbf297034a869b71d2b8f068d58f52574ca5b33bfd27f4eeed6fe736159ba75055e51e5149d9cdf3f33"; + cipherText = "0778dd20b23e07b5764f8af0a1b117afbb928a791a4cffcd71b2892bacd49d45904b5782e8658fc3a25667d506a44314181fe8b62cb7b7b00bbb07fc104dc9241707548136c41c7ef3f39de6f8606220c5ec6ea20e260e316fd1c73927bd038332dd7e87dcfe6b08fd49a966f7cba7d59fb8c9f80a4bde0652dacf8420b43d3acc6d8b9db92fb8c12afe3690954f800efa6e6102d040b3c344f63781a16e808114df6e077c31849ca0bd93cd31206d39b7976c82ec0c29ffa982b6e4b1a8fc0131bd9f5298796f125463d017d7894d61e75ae1769c854aded4429523d1c1138f4ef7b226dd08db91b0b8bbeab9054e08ca076eba3e8592b96c8ad596a446d49246c7be1f2cec5cda888e1823ad5f998bab3bacba3c76ea8b6bd5b2715098254294acadbe80bfaf63b96db76b19614d5f4740510e2c6a594d2cca89bb5109957db32541847338fc4ce308777762c1c751e20a734f0258dec978372f2e9e10509e41d3b3b7cf301a4df15808d04832fe76e1b3af29ed74fe567f618b266df050f14aef3946cd47e03c4aaaa2bf2d43096a61485594cdfb47c16e3db9085e783e164157f833405a5262516af64dec07b0a25095c8eac46fb0ab4900d4955b727b1855c084abd2bda391d9147b14567df24ed1d79c422490faba7cb5e3ba142280ba4551833d53ec2b4bd290f956f71f8f845bea570ee58e368a944d08db61e2b4a6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 500; + dataLen = 4096; + combinedKey = "ada1b135b084f38e4afef1ac95fde93ea9f1b6fa9ec2f0c83e45c7363c4c0421"; + iv = "c112521197014739499e8e026c5e819c"; + plainText = "c5f9dc8266c677bf052357b0ff0c070b0ce680bb3e41dccd28e34b66bf55d69a036fe09ec6392ac45794534d83c0b0f2dd924b30ac1d991cc20ca036300d07ea907a2afb547cc259cd6e120199a9f8c213053dc7574dd8e9e038458930197e642a542b5ecd44167612c468b3c2bbf0f7418d0643f7b9b8218304299cfb0550cb57284658411af7f38fab795debe42429cf1d6a1d12480d8ebf19a8cd29f501bff3aa053c6b93a3bfd1d089283fdd0c2fef20cff29fd43430b11eb9d8edb412bba4f9562538b988ca1626b46fce67729f16c8d3b7dea6d3eaa942cb9bed81236a9bb272f285ad2ae9faf0d59224c45b08dea633d879ade132058f409f5b88ae961e704163d3e409b8a661d08a583897d27ed0da26893291e843302b4e4a556840017139d0b74b89b78258fa1d51e73d4b7cb390eef717f527bf03e8e435004560477981fb7ae39557c455af1a43f0c9d1022ac80cf27cef790d4bc72f981f4cdf1da896eb79e3d9fa8cff6404e38b270dc761f7ae43aae3e128eb5b59956f84fc19453baee21eeda3afc63f9e2c194d4b7fc56f52a99641dad332901be0f257910865a854e3d80272fbc87299d4b247de1b103d5af3b4aa25b87d0cb7b0fbe094171e489b78a8e1eeeacea861a8b7df08af6a7f44504d8e5334fd0ca8a60d6e6030dde961176a507ee352a33faab86ba2cb7e7f2e51dde49db1927aeeac7b04af"; + cipherText = "8916340006f92e1e104d89abd04da59c4c678325a0a9cad495e29ea05b6e8c2c99ce375f711c476cf9a33799530529f71ac623b56c1817b7e1a6f079f96f2cb96b67cba13f419f022b0c28e249cc2381df9f7a7fbad0a0ecc3f8582ff764b6c84e22c68ed8ae5dafdd8a60270ac93d6cb0ebc59da8db5908dc3b0e2899614c72ef104a00af23c921819534ada6e88da82f16490f30fca205f8ed1a3cdd460c3f3be8578b43f81d2168da8585b6c0a921f8154b7de88c88de087a278df38c527496c44f3ca7e21857a211aa0d6f9e2adb330ff239c4bcbd28775b158a941512a5331fc250958802c3b63f9b8238461e4c5e588aa8f17e422436c49da2cd5a519b5ddfeef4f21a87e0c4122c41bc579bc4a47ec4cf1e36e567d90924a0862bd753ff96911b1833c7253c39ff1cc156ed198a9c9c72016cba662f374a8da9667145cb12d57ee3271935d68b8c8bc788c9c27d545e101f6a68bcbf1a13bdce7feabf93c3170b267bc36e3cecf41acb22ec724e8893963de91c7bc56cc3e6d9be6ff58bf1f6de1b64a4bab87aa04b1e470fcb62cd17bc3b031a8f94cd064af6578b21aa37094f14ae7aa969c04a1c615f027236c91525ac1cb2eabc10ff9d72c2cd1fbfa2a4591ea83c7186bc0989c5ac13cdea37a6cf54084bac23fe52c1bc06b1a3308a5e91ad4da4fa3977ffaac3ce89da3dc3fe45df931127f30e471c3df3400f"; + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + + direction = DECRYPT; + + + caseNumber = 1; + dataLen = 128; + combinedKey = "2956cdf0462756d862b23d51d3409863adbc407ebc22cf098afad0fb578dbb08"; + iv = "620bb87ca0fd9492449bcd1ae257c2bf"; + cipherText = "ea6576bb37da365869ee51e56ed36813"; + plainText = "de3763aa76975d42c4939e737990fa7f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 2; + dataLen = 128; + combinedKey = "5e798fd9feeb8d966c4b59af575f669f785550c420f3b64a966824a7fce03f19"; + iv = "f6e2c65c2c1948d4d453c42d771c0985"; + cipherText = "c2846568de1ac62d42b7e2dc62fcabed"; + plainText = "8a255bd42d6604c16857a112a3f72dc7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 3; + dataLen = 128; + combinedKey = "14c836483a702e0021b9b9fc3febc27fe4fed2ff583934ad52a2872496e31e7b"; + iv = "db3ab77dffb2b93ba39750617378abfd"; + cipherText = "e6cd9433adae7c1cec59243526d558b7"; + plainText = "52ceacbe7c2c293ce5bf8e1fcf512d98"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 4; + dataLen = 128; + combinedKey = "c71fb2206a68a864f89a193feecf38ff9c76dc5fc6429a76681857cf65065247"; + iv = "7f8d21c36bf7ddd4049d7fda55906429"; + cipherText = "a338e0355098d6f4f9772142ee42f826"; + plainText = "247bab3951a51a5bd250e8c22c8614d3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 5; + dataLen = 128; + combinedKey = "c9037fe68164ce9f15fda4cfa9a9e7888d1c4817aa95c585043059cc932c1c4c"; + iv = "11b47506b1a4b8720115c9dcbbdba6ad"; + cipherText = "645e5dbe1fc1110ec667bd332ec847f6"; + plainText = "04d6f26ca30d9909d509396593cb0e8c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 6; + dataLen = 128; + combinedKey = "561884bf8936130ff3fff00eeae9d98fa01b1dabf529cb6c5872680e02315b86"; + iv = "7799bd66a61f5005ded41433add5011c"; + cipherText = "505ce7eeb143bf20131a480902a7c48a"; + plainText = "f5b7f15d73a3673ccd56c8ec1182b4ec"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 7; + dataLen = 128; + combinedKey = "d5f5a3893fcb87aaa54cf39f489963b0dabd2a158ca638a285e9284c19b2eb39"; + iv = "07e238828f0f75a1b41a1ccea9c8e049"; + cipherText = "11267e9a1739bed275913bab18e19463"; + plainText = "ab50c5869ebd40d8caf9c67a44238c99"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 8; + dataLen = 128; + combinedKey = "04ff37b093532fae21568d5e79f3c5da3bb9d6394ce7234ff9f215804ef14433"; + iv = "61618f6432c2259c1a781b5507280a92"; + cipherText = "6487e98598160f2ff50211a6314180f6"; + plainText = "4a012e9ce702431e4b0a7159f2760a9c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 9; + dataLen = 128; + combinedKey = "d8cb9506f97d2477a43984bbedc3a1ccb800b50f90e3c8bc6ee5b5f48daef522"; + iv = "65b6dd81fefe802119ad3ae5fc46a8a8"; + cipherText = "98444a4376196634c608b9515bb50eb7"; + plainText = "f02b0ddfd5178af6f905a65f81b8fd2a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 10; + dataLen = 128; + combinedKey = "6f9be68a5c84a70c60676cb6ed1d727fb87bc56596d31f1c1d04e6562a99162f"; + iv = "514d1309af897a30981d535c59f19e86"; + cipherText = "71148f3cc190d3f88864f5bc66736f7a"; + plainText = "743d0a05de8e8f0128f3def81cba8223"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 11; + dataLen = 128; + combinedKey = "f836901cc2fa7f67bfe8024c70f76a19680ddd2d9a122980b6c3822c32683dc6"; + iv = "a239202a2b4c42f464b470307eea712e"; + cipherText = "09ac07c0396ef394d7fd50eb13e1a147"; + plainText = "9f75c38a5b80b0d3c109a6c6fd343c3a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 12; + dataLen = 128; + combinedKey = "8bb5a71f8229e7277dbf3d59991b322988a70b9522bcf1722c29cf9da8363e1f"; + iv = "5aaef8905fbf5cc5bbc69664199c16b1"; + cipherText = "6b26927456e3e86b6747bcf04938a009"; + plainText = "8c89f6658fa2f0421763448023336870"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 13; + dataLen = 128; + combinedKey = "b7d493a31b8ed2d1bdd1943b009ae0992cb651a0254d2a74b1d6ba5ac08c332c"; + iv = "87d592932d30b8cf6f7ac67ca8b64929"; + cipherText = "384d5ef525aeee4ef7cee3833983c1a7"; + plainText = "c4755dbc8d510e5e1ab28772989d7223"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 14; + dataLen = 128; + combinedKey = "e857fde665a852be26f3e289132ce8ee5043254457c79f3db936850d72ad05f4"; + iv = "2c6afbbd7f8b56e6417cd7d5f68267d8"; + cipherText = "6e51e19e18b7bd0a8de0ee8c403135fc"; + plainText = "be907f21c216afd5e141038d935a5769"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 15; + dataLen = 128; + combinedKey = "80e5d75aa943f3a3207d10f5609e04e4e5e9732243371347a6f32fbb19fd94df"; + iv = "76bc2071b9c4518969bc84b2166ed5d7"; + cipherText = "d9ffa12e760ab28fba465936ab7dcfac"; + plainText = "4a5dc4d392fc5f1c45da75111fa77356"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 16; + dataLen = 128; + combinedKey = "fac9adaab6738bdc35eeac0493c4453ed22ff6f1dcea8c3cd4292e348d593042"; + iv = "63d891d68eb770a4e76f8368ec4deb91"; + cipherText = "1991a626b9e7daca316a56b26f82ea6f"; + plainText = "7ef299921fb634187ba7e0bbaf0c3ecd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 17; + dataLen = 128; + combinedKey = "59455366f996dd5750dec459f6183f4076d42c75682a7be55d1667b3bcf4b1e9"; + iv = "e2c19ee90091539a5c05532a57a91dab"; + cipherText = "d015ca69d2a24f72b75454738aaaf194"; + plainText = "2ff9a412338f4a7ca09a25f7ba905cb9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 18; + dataLen = 128; + combinedKey = "b32fa9b7a9282dfb7362f49b0091a8cb14cba26de8e09da96d3b090a39294c19"; + iv = "9868a1ead61792170833dfc66e110a37"; + cipherText = "9c48e9d632e9d3e1055de1f14ce119ef"; + plainText = "44903d058e0555c57f51f4beea200488"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 19; + dataLen = 128; + combinedKey = "556c2d36b4b09159d27089c8407040fe0197b9406b1bfef5d7241605b7c3ac9b"; + iv = "5a7c22b6caae54b23b68f8e9ef812eb1"; + cipherText = "3fc5c84d9ee78b762d41e037941abe76"; + plainText = "13906254cd4b7258209e185c45e022b2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 20; + dataLen = 128; + combinedKey = "47812e2e6f0ca9494a3c67fee4419fddabf4bc5dbddfc1250e64de0b1c224fa9"; + iv = "7b5fcec712eed0e65235b0b277ba69a4"; + cipherText = "8cb6965a87fe768c9c576fa6900220fe"; + plainText = "b865188771a1af5343468fbf3996fa2c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 21; + dataLen = 128; + combinedKey = "ed27ce42e7d3b6ceabb79a61642c6f3ff6a5a0d9a7498b085ebca3c88bb2fcdd"; + iv = "a623df0a4bc4eaf432754be760c6f761"; + cipherText = "f4f5b99a1af97497fcd6005941c52367"; + plainText = "7cecb88a37f3194fe206a9a3864dc1e7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 22; + dataLen = 128; + combinedKey = "7baf9bc3003826eb48f5ac711db1a2972c85ab868e64a7153b0330fc3154f6d4"; + iv = "89c6c6a2c57c884d9be6fe61d2d9e2a3"; + cipherText = "d6f889384f5f4d5077f5e9f75bd87355"; + plainText = "1e4410d5ea4200fd829b6e2cc306d0f3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 23; + dataLen = 128; + combinedKey = "04bedbdf82a56b090dcc5ee0035b10280bbb4fb05b19ce155a672907bdbaef39"; + iv = "6948ed770623580a4a09bb91c0cb549d"; + cipherText = "cf90f8b964a9edd2499926eab01f62dc"; + plainText = "ba5e20d4b8186712a199c80a1cc03947"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 24; + dataLen = 128; + combinedKey = "f9fd881be853868bc3d64f7a2dd7b221f00fd28e05f16d7acbdc63775fca4294"; + iv = "e3166e983a84e4583d04f7293ce217a1"; + cipherText = "20a9e3d83ae0f3c756594c8cb62164cd"; + plainText = "92a113b0a0b6577e2452d9b1f17d5eea"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 25; + dataLen = 128; + combinedKey = "8b1a7aefcef62a0a3449ceee135e9e2b080bfd0d69736ebe0da174556f821327"; + iv = "67508cc9dd8c1be7a64bde16b5935e5b"; + cipherText = "39130ed8621df9ca75d71524de39dea6"; + plainText = "ab4130ccf9b2ca4e9621c62b4e7c7018"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 26; + dataLen = 128; + combinedKey = "9e2a82903c27f9f6a0cb632fc2045fc49714832d9e16d233ee93382f3e02cdd1"; + iv = "69ac854fbba71f45a6602fc17197d826"; + cipherText = "9ca914a7424584fa5b6e05b26e2e8210"; + plainText = "a683c151f0eafd7aa4428cd86523c769"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 27; + dataLen = 128; + combinedKey = "31b2541a96cc6f1eeeeb1f6c115b6b55289a2581009b46b51c65c017d311377a"; + iv = "4dd6aac74805bcd9af69a11e84c99286"; + cipherText = "f397ecb15f511a0cb1254bc9af9549c2"; + plainText = "f0e180a0ff2eb8d18e65f3aad8a719b4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 28; + dataLen = 128; + combinedKey = "a04a8c93aa9599f272189707f1d4231e90f4100d8be39d66126e99b2a83bd9fd"; + iv = "db6c9268806d81243275fc965345851c"; + cipherText = "253f6d8ac3fce38050b37eba58ea948f"; + plainText = "5c5516e8d961b6a91023432c2363c504"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 29; + dataLen = 128; + combinedKey = "d3a954d1164472694953119419ad8d2102e2672f10831bb621de2fc3cd84ea20"; + iv = "ac61ca687ccadc9b7348a28a77b00a7c"; + cipherText = "a701350309cb70b971875ab9e4a60c18"; + plainText = "468595370e3c9a618019cd7ff17b154c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 30; + dataLen = 128; + combinedKey = "d444fb69b112ba9a9e6d73b1ded897434a83c2e9a1b21212007caaccf6b9dab7"; + iv = "fd8ceb7e850e53cce56a5d54fd752072"; + cipherText = "12045d797fc4a9ea222a416788b95f1c"; + plainText = "a88574b9777fe2bafd7743bac1a63131"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 31; + dataLen = 128; + combinedKey = "0b10f339a6758a535d201790799a16a9b889982ca25b4ac374d32f6799b9b927"; + iv = "f26d4b1cf2dfe1dab4bb76f059cb9459"; + cipherText = "d2b6939eea068f9ac1d37cea0265010f"; + plainText = "2997d4cf33035912caa2f7207a1cff74"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 32; + dataLen = 128; + combinedKey = "d0f3de5da1b72c6a5c1bfd47a94545d26f6b7ddc1d0fbd55bdadc5f9bd57bc43"; + iv = "ed90a9a88118f6bca8b25293143a77c2"; + cipherText = "427c68bb9cc6c20d4df50c3e1058a119"; + plainText = "b4d34be466d105436ba3d499e4dd874e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 33; + dataLen = 128; + combinedKey = "be34815a0d7bc117196c4f6e16d326494b19a2d2fd6e429323ec6f3e57216df7"; + iv = "27b23069c37659fffef9547939786ad1"; + cipherText = "c2f42d16998a97544acafcaafc0f86fd"; + plainText = "87cce6d9697f313c6add9507d0b08fd6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 34; + dataLen = 128; + combinedKey = "72da47dc206a1a04a2b5436fa05125dd625fbd78d2ffa2302eab5a78dd68cb8f"; + iv = "f2f41b9c98b0275474d24fde3cf16c17"; + cipherText = "1f58e5ac56f1606bc5c57bdb4c794367"; + plainText = "baa2da605e654fdaa6c1ea2e84ca1e28"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 35; + dataLen = 128; + combinedKey = "dade39568a19ea35d04e9685f4ef9dace551a580a26b0860dac6362bc1e20173"; + iv = "83934598b495cd7e8500120eb36842af"; + cipherText = "e74f00aa88700d072b294f46b51b55f7"; + plainText = "27dc95c41b52b62b60ae7f3ad9837f83"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 36; + dataLen = 128; + combinedKey = "289816605259e4d2043371f23595d41144c2e2bec5ff0d6e8a8d2bf7af47d077"; + iv = "f053091671fd0cb0d48a24901750362a"; + cipherText = "94a997aa94e70be9df27f9875ab7d55b"; + plainText = "be4f3a78c0387e0f7f7224cff5cac586"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 37; + dataLen = 128; + combinedKey = "3f5aee18e3d6f0281e3fe764feded959fff36716cec2fded1b49d5df7bd8507c"; + iv = "c13b63afd05a38f115d7d47dadfe8c58"; + cipherText = "f3d2a90bd5fc57085db4dfa1b894864c"; + plainText = "caed6f84bfff99752d58dc8240b13c94"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 38; + dataLen = 128; + combinedKey = "779c5c8cac314094b995ab434b1697516cac6c99afca05960a1a113fac813a34"; + iv = "f1ec2c192062f8358ea12eddb462505a"; + cipherText = "571e19a430f61c10d4f9fd2810761b94"; + plainText = "17b9ff76bb867bdf494211f8da770f15"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 39; + dataLen = 128; + combinedKey = "cd8f02aaf09be512727fa9848f1df760ebabe2667761b15cb440d7cb9b6c0961"; + iv = "5dd62d0468661796579dcc393dd108a8"; + cipherText = "a1e62d431589251ebd339b17e2dfed53"; + plainText = "82f7e2aac689cd7d3e3ca73a8cd089cb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 40; + dataLen = 128; + combinedKey = "3090b6c74698bf121a7b676a0b061cfdd0412baa65c05d9a4330c6cde9d76ac7"; + iv = "19021c7b4a50b3efcbd502782fef9273"; + cipherText = "64b1aa32880b410fe5e0b200b5d9ae7f"; + plainText = "718aefc5e91526ba338583db2a8fcece"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 41; + dataLen = 128; + combinedKey = "47bc92da0b28c128011f3b92d1931dbf3e6daeab86339596c894341f3a3ab59d"; + iv = "1a35e0dc5bc48dce4794dd2bc37f4973"; + cipherText = "0c17341c1917b813d80f4282fb31ef57"; + plainText = "7b33fa14b69f901fdc7399f6f006e499"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 42; + dataLen = 128; + combinedKey = "a539e990e11adcd6a21c5dd08eacc899208f855c023e29087c9a0d66d034915c"; + iv = "2d7bf84219b24f30c7dc665948d086d8"; + cipherText = "4d5bdf2a20587a087655b56f69eef502"; + plainText = "428e4201021db0991365d59b0bd048ec"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 43; + dataLen = 128; + combinedKey = "f95c129c224f4b0943763450e085e25037d1d706d15a1b93a75e820521df1306"; + iv = "5f2d2d1474795ae9f2a47fd239444240"; + cipherText = "24937e2d550fbcd4bef70c8721424e72"; + plainText = "01a035c9299b00a9e66d4c0914023393"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 44; + dataLen = 128; + combinedKey = "e9ce4f5f7be9473acf6928b87446dad667ccfbcd02ece4e5d7b20a0be834eea0"; + iv = "777902b66f7955428b7bbc882c3fe8a4"; + cipherText = "f31dde00b2d6ba4bf6d12f756faa5766"; + plainText = "db8c3a584606c5d33fdfb024c42c591e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 45; + dataLen = 128; + combinedKey = "422f0f3f92d667b7802e75c7786ae146d11c48f28d3507d40eafac00229f0522"; + iv = "16f75851e1d97b08345c60a9e086f8a6"; + cipherText = "0214c3ef8c1fd34df5823170b8c67d4f"; + plainText = "73a008fe65b5dd987f92dda68a7082fb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 46; + dataLen = 128; + combinedKey = "695d8a51cda1c5e71810defd629ddee6988fb60a702b808f21a0cfd8de4e2f71"; + iv = "c2748733475330c17cba921e4d81bc7d"; + cipherText = "23a13d752d416acbb175754c2b502f55"; + plainText = "2d2e1debfb430f10d08e94db522f5246"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 47; + dataLen = 128; + combinedKey = "7ad714e4f803ed8d69b0397bba36b2707ba5a025d8363140005a82e36ab5cdb5"; + iv = "7688bcd40307d017f440ba5118634eb2"; + cipherText = "e974900db1d2247f0fed1694739ac366"; + plainText = "52e66dbfab56e558da5a6a1adc117a6b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 48; + dataLen = 128; + combinedKey = "39cb565cefac3b5f27fe7dfe36555b85c348818d4aeae44645da14a0b9778320"; + iv = "dc96aae9a600c879ed0a5f4aa831cffe"; + cipherText = "088f88ee94479fd4b40c4171b6f39b87"; + plainText = "e08679e2d371712bc61a68d7ea1651b2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 49; + dataLen = 128; + combinedKey = "a4ccbfe4398ea36e218c5a04d7312c1cb5b8757932294c32ebb7f3c524adec04"; + iv = "699d2f5540b6c4693de9dd60d6839954"; + cipherText = "a6510aeeead61d4106f88b8645ea01db"; + plainText = "0828b712b1bfd1e3cda1a6427ac57282"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 50; + dataLen = 128; + combinedKey = "b2ff2a8dd76bb9e3f85ec9ce15379ece613b7b380141a7983b702117db0a9ee7"; + iv = "66ecc01f4ab114a77b63f974f2e218ac"; + cipherText = "1cb867c7e3df68e51e10ace08dae8bd0"; + plainText = "a1b57bd3f6559943b77fd5e04b83aa73"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 51; + dataLen = 128; + combinedKey = "07407688b0894fbb57e4f6133a0f544413db23944ede511e0c5ffea3c6264b03"; + iv = "abb64e0f1f392d639e2a7e9843a67043"; + cipherText = "aa6f7add7479a6638f5a0b412ddac2dc"; + plainText = "b4afda7933c65d44993a4a8bc6b889e2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 52; + dataLen = 128; + combinedKey = "ad1f6d7e6667066ccf32f74a2317c46d9f2b94baf71c7de999be843f43e76003"; + iv = "bf747d6f35d84770dffb6df105b084da"; + cipherText = "62137aa82029ab13505720b2ca712cb3"; + plainText = "5eef540cb1067c83dedc934d2bfe9668"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 53; + dataLen = 128; + combinedKey = "ce50527e35a9feddc4d202f95a1f800df18e13121a0fa4eaa921ad0f0032c875"; + iv = "83c33d56003726902c58dff4c579bb47"; + cipherText = "1967a1bd9fa4811792ab782e79807cf6"; + plainText = "403617d9bb3029dfa6fb924f28ead722"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 54; + dataLen = 128; + combinedKey = "78d0f928fa4061248eb473bdd1b5810246e3146ca638a06fde9ccf5c1cf3025b"; + iv = "c0b29cd87d346dbcecb0b83dd90449d0"; + cipherText = "5f985799a7f831cd180cd56be997f9eb"; + plainText = "f9702364be8da2238b02ce3abb595360"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 55; + dataLen = 128; + combinedKey = "a2b649ac8df362d187584107fd8ad6fd5dc54a2e7675e2de717be9ab70db8bc7"; + iv = "8eb5ce9536e9f3d547a35f7932a881b0"; + cipherText = "8b9204d9be5a04d38266eed278942935"; + plainText = "d351901195097b5e35bca09fed5ff666"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 56; + dataLen = 128; + combinedKey = "f5f7a89f8b5b6b3f7b85917dca85b248680d0b5a5cfcf1693105f621feb9d990"; + iv = "83e98330f2fd59a2f76948f7f09436f0"; + cipherText = "a6e46c331b751ceacbefafd5341e4a37"; + plainText = "ec67cff4031f2b8f91df44bd09898146"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 57; + dataLen = 128; + combinedKey = "b39e95b92f75f516428c9b0618d03725db69cae30ad7f43c98f7f9b334e8d4ce"; + iv = "1e47843de1d435b1fa7da097c574e41d"; + cipherText = "c9b7f91b723a451fbaa7af189a692904"; + plainText = "483fe6f6d82b55b0574c61308dd91627"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 58; + dataLen = 128; + combinedKey = "ccf2c4ab1753af90fc4c0b49efbd909eb00435f976d91ea9e8c9cc41ecb7c95d"; + iv = "cc864630724c9ea53fd8fd21e32e4045"; + cipherText = "5b3701b42f9f5c37a66b34c731bb0f13"; + plainText = "2599a9f13f429859dd415e04bbdb2e47"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 59; + dataLen = 128; + combinedKey = "ac3c8c186e914bf426ae3f3ddd4d425528aaf7deef57d382b05a5e37e334d901"; + iv = "78df6bcfdab6c169b7f3bca73c43bbdb"; + cipherText = "72c352a3060610bc884e2ea8a69d6162"; + plainText = "930ff6420ce6031df8d9e9043cbafe6f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 60; + dataLen = 128; + combinedKey = "9fe3d5b57ca90b2b209d215e44c677047ed02663e90aaf0a1026db3dd3c16f78"; + iv = "d92eacd547bbd808704d67e47fe2204c"; + cipherText = "e56562ecc68b0ab98581186eb51fb77d"; + plainText = "486cdf22464cd58f34e9d24f36032244"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 61; + dataLen = 128; + combinedKey = "116093256eaffddf72e92d1293fbb5390f58d02053186a4f23761dfe7fd01d7d"; + iv = "e0609c4fa1b035eb69abec0bd822c045"; + cipherText = "810d9b7e8dfbf48ca8eb2a87eaa6fb89"; + plainText = "4e155f4e0deca493224c144821d4b878"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 62; + dataLen = 128; + combinedKey = "15d890b1e263ddf514e211668f950d0035f02b4e0185579990e262f7fffa52e6"; + iv = "19ccde1d36e8b1ff92269e1df0a99496"; + cipherText = "1f80e1a6fb096632451a2ad0f2acc375"; + plainText = "37296689686ea00e5b9db21ec4e6dc93"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 63; + dataLen = 128; + combinedKey = "18b823984c34f6d5d472b6bd0b095890ae748e76228c2d702d53153927baa483"; + iv = "729790be1437e8d7ca9f71c93eb02092"; + cipherText = "65da064759d7b0cd102a2f36989d09e7"; + plainText = "50454afb87eb96488165a4bbd571d6d7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 64; + dataLen = 128; + combinedKey = "95db57d4bf1af7d635063ba2c456f6fcfea5400472cafedd49f0af506e41fdfc"; + iv = "26edc9a8eae428362c2f18b52673714b"; + cipherText = "cce884e6490c57da20cef7e7a1bd5a7e"; + plainText = "3dd067a8c4ada2f824cd2c9dfa6e67d0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 65; + dataLen = 128; + combinedKey = "4af83a212d52b39ff2db5286e4432a7a3bf71a980cf56baa0389db28695e3b16"; + iv = "72e493e04e77577d0ee398db761916d3"; + cipherText = "9e09f65d8ec358e8a8b75e255cf62d49"; + plainText = "8a001d33994022a0a8e4290153633ca6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 66; + dataLen = 128; + combinedKey = "8a810bf2bfa8d5070b3bc19a447422c0ef5a0ef2e27a77738465c6a5fae988ec"; + iv = "6dccf50f9dc807f12b7da0f2c43bbe8c"; + cipherText = "643cf9de685dff5d92296b91bc396cf3"; + plainText = "54777fb0b1dc7b12cda63b06d784d951"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 67; + dataLen = 128; + combinedKey = "b376761bc422a2ec3f106df07f1b007453cfc5258b07e3942bd618572a1bc42b"; + iv = "5c9ce9c0a9e0a54c9ec930001c52556e"; + cipherText = "363d29ce2e61aaa4077ab74b41cd71a7"; + plainText = "62f2207c8049ee99393490d7350b729d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 68; + dataLen = 128; + combinedKey = "ab3a5e94df11a7fe65a50a414514a8614030016cdaff7961f10daa03222fd75a"; + iv = "1b42dd979adaa545898eb00f196bbbe5"; + cipherText = "a74ba43bbb4a052f5eba62f11617d8bd"; + plainText = "340b6331be6238aeb5c092447859102f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 69; + dataLen = 128; + combinedKey = "edc7c4169a190cda3187e99ec9e913946ce7782ff550c564d28149e6da9940d5"; + iv = "4897bd8eeaf6f62f0b46361f6aabcc60"; + cipherText = "530a0da670fced3341b78b76f3373fc1"; + plainText = "31e68f28fb2d2f43c7a733f89a17a490"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 70; + dataLen = 128; + combinedKey = "90455661fda6d7164251c372962e4148affac9ba7076ce3777d0b0d542f81a51"; + iv = "1e18f988165866cbb9814d4eab56079d"; + cipherText = "e75584cd94375bd934bce3887c174946"; + plainText = "8df1052cb864fab3b3f55376a459628e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 71; + dataLen = 128; + combinedKey = "f0cce74b29bfa4a532ea78da2f70783a602c5af58ec3bd5eb4a4bbe155a6e57d"; + iv = "f2de5a37308f7b3c07e5f3e8237fb023"; + cipherText = "98c96ef0c3dc73ee0aaf8e7ffbbe7188"; + plainText = "87064feb9e2b4e949e89ad8ccd778862"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 72; + dataLen = 128; + combinedKey = "ed5985d52b5297c38d81e85b961a14b6eeecdc1340430bdb84735ca802ba5537"; + iv = "a104457b56cd7daa5389a0a37095c83c"; + cipherText = "9e8b72cefab7018100dda4bffc589dc5"; + plainText = "63230be7295776a99d592bb8f252f798"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 73; + dataLen = 128; + combinedKey = "bdcd0f9f187b43e5c59c501dadb6e2adac96707f40c926c0fbcc43742efc9cfd"; + iv = "8e908b9744b936d8078a3d50363c418b"; + cipherText = "bd3f5fc86276eef45f93fe1464de401f"; + plainText = "9f908501d677ae4b4ca591fb90d4411f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 74; + dataLen = 128; + combinedKey = "5239ce8c50df13b7ef0d8aae48703d014e2aa34258b7c9815af4dc8e57b2f6f7"; + iv = "64657a3c769175edb20cef05b3dc8260"; + cipherText = "88f0712d95f814ea843af958dfbc10ce"; + plainText = "e52e1be04b55d503f1f50cbc9ee364d7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 75; + dataLen = 128; + combinedKey = "c5a5e35a745ab49f3dbe31d95959e23d580a98c487b0f643c03b626598fcbc33"; + iv = "00827f90054938a80059e94c7dba693d"; + cipherText = "7f82603b8ad9fe898e97be65d8de2e97"; + plainText = "3fec7027ee8314d9fb387a5b0eaa684b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 76; + dataLen = 128; + combinedKey = "60ce7d7e1239b107a2d3b09c1ecae96215f515fddb2179e6d73fa9a6d61d8978"; + iv = "f5f5198c95711cd40dff00ce2d3dff0f"; + cipherText = "936bc3a8f638cf427e99dba3b3089898"; + plainText = "50518b3c78731ae3ece9a4b67a9fc13c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 77; + dataLen = 128; + combinedKey = "8bef72e621e79d8e3b476b2ac45b28ebb1516c1177e24317794f546205f629f7"; + iv = "520b4ee6e6dddaf48ec9ca274aa3a72d"; + cipherText = "c68d2d7413c2edbacd89290ccd48ffd3"; + plainText = "e29cf1e2de3bed6ccb267e02706e1d64"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 78; + dataLen = 128; + combinedKey = "707e80e2145b13a6d322c65201c511f3018567ad4bb7d0ca5e368923cb54db92"; + iv = "a7cfba407b0f4a58361f8987c0fec237"; + cipherText = "09730b060a73fef90d512ceaaa3e186d"; + plainText = "3f6a6ebc9fcfd3dd69d20e8faa433cb4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 79; + dataLen = 128; + combinedKey = "d5d18fa371ed56b0f9159274f6de72d2304b550305bd64cdcb2db85d0d3aa5a0"; + iv = "5c7d3b88016978254dcfd967d8c16bc2"; + cipherText = "68d968da85777cb9914594a221611e1f"; + plainText = "d4886867469d8c3e9f66f72495176da8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 80; + dataLen = 128; + combinedKey = "926295685037b1f7fa47013e041cc98feff8dbfa63f18c8c3a49c8ffe4ce5735"; + iv = "491ed094ca27d0b4f70754d4c10cb0c4"; + cipherText = "e6b1825c11694572b271f3c01b2a4812"; + plainText = "db6b092ad9b23463d8686c9342903b86"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 81; + dataLen = 128; + combinedKey = "ee3f40783897dddaddb5b5ebcc184069e38604cec88e0cc613c8724765c0d366"; + iv = "40b7e4ec3bc0f36523049aff9f58dd05"; + cipherText = "9b7b2a66cb40ded274c6c398efa577bb"; + plainText = "0e6507d5590b378993a448afbf6849b7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 82; + dataLen = 128; + combinedKey = "837cbdaace81c355ce81d957886d301a5425c1ec7df0da9606f489b3ee532857"; + iv = "0801ef7c707b6312502c4b0d8e6e1c48"; + cipherText = "a0bf81af49dc31adadebe60086f2117e"; + plainText = "64dae7510603bdd1059d35315984b5e6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 83; + dataLen = 128; + combinedKey = "9ab889c05e97c6c15c332714f3bfe000cbb8c7f999e0e6311f68cf337af67575"; + iv = "03d1df6a0baf35303cc9599b7d2535f2"; + cipherText = "bc229b99714591d609cc525ba5efc6f6"; + plainText = "21229ac8367b9e10f202ad155c0f24bd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 84; + dataLen = 128; + combinedKey = "17ef2b398f989c88972f0011c8ef105be025d9e0a07051bb0fcd985a6f12eec5"; + iv = "8320c6b025e661fcafe4b96142890919"; + cipherText = "6fd9b1486b6bfd3d7a56e046472aa548"; + plainText = "53f4960234ac1aee807f893ed142147b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 85; + dataLen = 128; + combinedKey = "ce74653c9d99c3d7d8c9a25a4a1b2ad1412de15d318ff7030115b7c242b92b87"; + iv = "b9d7f96d12fa429387f709d5cbefa3f5"; + cipherText = "23d5cd9fd34b9a2f1f04d04f5907e804"; + plainText = "0b7c6e9019521f72896678e7f503bbde"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 86; + dataLen = 128; + combinedKey = "9393e8126bf9a9f4a20d3f6d891d0492cc46a7882ea256ed7d2257493ed24306"; + iv = "38f3ac5a5af67a6dde0555bed2157225"; + cipherText = "056762073f5f62cd076b58d6a62bab63"; + plainText = "d015790a0daffceaf0e974f0f5c7d1fa"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 87; + dataLen = 128; + combinedKey = "a6b4d5b49976712b9cf5b9f3aa85263686e5d0f310ec7cc0b62faee6f5dc08f6"; + iv = "5d509f6817b3b0b420435a40441362ac"; + cipherText = "845a86b65591e0593903e3054ffb5eeb"; + plainText = "d7660e8c0a9f0f6a8346de8a1b73cb3c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 88; + dataLen = 128; + combinedKey = "f5a57b827619af7397227c3c5e266a389cab4fe7d7970bec095fe7a1b5bb3676"; + iv = "53e15b956f9e0ad1512475d819107ea6"; + cipherText = "2ad312a2db73ddf91501c20f6b86d94c"; + plainText = "4e407432e306e7b4b53a02fa37446fca"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 89; + dataLen = 128; + combinedKey = "8e4b66096ad03e9b5e17b65822011e002add4fc8de1031ea48dd68f6ee7e6f7f"; + iv = "9c8bdb6510d8feb5a7046b64a21a481e"; + cipherText = "c1708a8d0c18d7dd94a54c6a71cccff0"; + plainText = "3a74e62643e95255895e76c505691e0f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 90; + dataLen = 128; + combinedKey = "4e13a3de74f41874e7beddddc4f6339c8b204145fa9edc1e7d639686e9cd1218"; + iv = "a3cc068402b003dfee82f658d6f49399"; + cipherText = "810b6b690e23649f6ca8095bd2eeef4a"; + plainText = "5b67176d29120c61ae3c2ccfb682b02c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 91; + dataLen = 128; + combinedKey = "b7b719d5b12562b67d36f9b45de3c0eba05f674997db3a0af036613567a0e93d"; + iv = "9ea4040c1d0a1f4ff921d2cf3b5e8d4b"; + cipherText = "878e1331d9724322fa2980ba3fa1a706"; + plainText = "eec4333c9ef031c472fd9a74c0517ab4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 92; + dataLen = 128; + combinedKey = "c9f3f1c116698fdfe66eb867595d42b870b86454e9e5c514f47ba5e235d12cd8"; + iv = "ea80f2a55b3c289f2e730f1212515bfb"; + cipherText = "41919d26f63fd1d9e5ad44510b2affe9"; + plainText = "e1e7c54f748398d9a7070bf3b2f6a585"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 93; + dataLen = 128; + combinedKey = "be91758b90f19f1298430be8b1c8e7d87332469d8d94192e048d8da08931ce3a"; + iv = "8a3d0af9e42028fe45d8c22787d5a5f7"; + cipherText = "46507cb9d0bb90848335d10596269499"; + plainText = "133cf57142dc3d028111c4e19f2a8225"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 94; + dataLen = 128; + combinedKey = "c07d46ce9837c87f4a5c35a2585ed442d4092b4699736ee6e7eeb88f254ad381"; + iv = "774efc622f14f35fe6a14df73316f08c"; + cipherText = "909003d635a0800d3b18803810aca297"; + plainText = "4d357b71dd64b4c8d945b929f42e436b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 95; + dataLen = 128; + combinedKey = "9635bbd2abb86916bea1f0e52569f4f486ee562b4061b6a4b88d411cca9dfe84"; + iv = "c3b7f447f4fe6181b69ef32879d6638e"; + cipherText = "1f647b4e5a9386551d699ba024a22bf3"; + plainText = "134dc27ccc4f0ad79bed414ec902da86"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 96; + dataLen = 128; + combinedKey = "f2fc215b303ce9f49121177349795f5723828275bcabfb845148df1209effde3"; + iv = "9caf2e2d64053cee1df320ac70760eb0"; + cipherText = "6538b24da02f1bcd027fe4e32a821090"; + plainText = "bc7bbd41ddf1c681e4fca176dc874e76"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 97; + dataLen = 128; + combinedKey = "c717d145577e5c96e590a80f6870d00d5fbf8e082bf4e038f6fadce224caad81"; + iv = "0e0d6fc827512f47ce0415037f20a1fb"; + cipherText = "9ee999759d25ed4760fa113be0f2008b"; + plainText = "9b43f6273d433e24a47c78584168ff1a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 98; + dataLen = 128; + combinedKey = "1aa4e0abfaa28b68e67dbfb18fdb0153fd87aac75af632188d096916649dc592"; + iv = "56edcdd4d7c62beac285ff2c5b446a0d"; + cipherText = "99f9c5cc9b2db0a4de8a2ac13b21036c"; + plainText = "ec7363f3e14e8850b847f0d28c6af927"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 99; + dataLen = 128; + combinedKey = "33cc9daa91b2dc6ad46b1e02cbbb8851cc9b258007ca92db95922867f72219a3"; + iv = "11bfdaca0731799f6d96bf5c78e9ae34"; + cipherText = "e557d62ed9d4c764e28149a1d2be3577"; + plainText = "f32db1266c7401021aa2b826fa285d57"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 100; + dataLen = 128; + combinedKey = "5c063de0125df906164602d5d3d937bfc9e01efdc93357759d2376813f883d27"; + iv = "d468c22012801dcdd7c6484262988667"; + cipherText = "2b02e10caa57c7b03701be85d72c24dc"; + plainText = "cfd1109c43f6b3f1b3cd227f33f9c94d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 101; + dataLen = 256; + combinedKey = "db882f33c5048b302e92287fead0818a8fb76be6a99b4167e76ade1ed40c1d45"; + iv = "3479c6234db9abb731f8a80bee2bc62c"; + cipherText = "6d15522b64d3b74dbcb331e7aeaed912e2e9b44deb40bda33e21dbf7e66f3e51"; + plainText = "672b8aa47270df3bdc0ad6440e5fef31a8d296f16c01436302cc2cb3b123ed3b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 102; + dataLen = 256; + combinedKey = "3629c6634388091cdd60236e7506e757087f29f7e81247b073f4903495a4d671"; + iv = "073ad8369554092426c7c23657f7d780"; + cipherText = "a70e4ff0dfe2ec64473c45e3b916a6354c9d22cfef7ef7adff846c204a099fa0"; + plainText = "cf479bd77e5dcc72f91e92d61ad7876b7da3128b5f92c3f6aa4fd05dd70699cb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 103; + dataLen = 256; + combinedKey = "cb67aea9706482be9796e277498dc06129728cce5848dc195f607a35087d74cd"; + iv = "c5db4b647d4be26b35e3eff875db02eb"; + cipherText = "943e9b8ddd3c5b853b84f5990d0a709eabd29a9696d3919528cbb63d33033cf9"; + plainText = "ddf9a4e41ce58acbd1f7b7cbd1829c20f2d4f53b5ccf61c36acdba19a9a7de6f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 104; + dataLen = 256; + combinedKey = "abd8d249b6b4342489e161b91d37900cbef30a2b18ca1099d8f5ff76e60b5d87"; + iv = "ca00c3e00bdd618cc7440b7baf77c41f"; + cipherText = "3edb5b1bcb28db01f63ac368e0b2441a13ccaeeedc1b9db8179efd5869ab2e07"; + plainText = "dd602caf80f6137d7e31e263c084a0b5a0ddac60d9e8f8d6272d2db8d04305b3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 105; + dataLen = 256; + combinedKey = "314a38ec7a1311569f8b85ce5d76cf60803d54cc45a3dd92c526f331ce3fe08a"; + iv = "699fbb4c46977d86aeb770daac261e0c"; + cipherText = "ba6b212cefd95f10ae11cf8d01411b200f50d2ff2a6ea1d3dcd2b0733aa1614d"; + plainText = "1e5c06cd7eca14f7849ccb27b0553d2fc9bb922e0af2f9aa4cd94ad8a6bac0fd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 106; + dataLen = 256; + combinedKey = "af4b176ea92a4f1a28a6ba2ce522a2285afbc18ab722b62d58b208bd5aff3c27"; + iv = "971e3f13f6f6530cbfea748311d23972"; + cipherText = "2184419611074babd53a6ba28833c2e2e6e75595218bf0d11245fbe79d3cd266"; + plainText = "092be7eb5537378df439addeb147f6f6ecb0166e9f0aa0b885c7d61efbd32cea"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 107; + dataLen = 256; + combinedKey = "27a8892e33dcab8c29ee1899343a474c5cf1a7c535a5db210c44363c99b9d417"; + iv = "5a8505c9aa586f82f14985338280a411"; + cipherText = "12fbc52bf47e679f0b0e2c58043f0e265b4cdd3ab2f3c0425ae4d9bf2534bcc9"; + plainText = "f74e985eb1279af18bcc577f18c37d2404c2676bc0060763ff7d4046eab3e1a3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 108; + dataLen = 256; + combinedKey = "32c5bea7c180a41d92226610d8ce196445e358affebd5a3606bd4740875b450f"; + iv = "24f65b889b20fdc48a84302f95423b1b"; + cipherText = "792c35ef9e41ea19cd495d9096f6b6f386ab4dc5a4bcd4d71e37757a5690c7c0"; + plainText = "89e694d966a217d3d8e7dc57dda1ba141124c417186c815b6ff79cbdf7582c71"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 109; + dataLen = 256; + combinedKey = "e0400fed086464f3062ac911f8f986532e7d7ce18f56ba75924a3e59cbc1738b"; + iv = "1af5c26fdc4c172c07d5d63e6a1d40ed"; + cipherText = "10c4a5f189d08d57e621fe12d28b45893833214cdb712421f9e09e2233abe6a6"; + plainText = "b2e6d5a0816ce6bf297eb200b6132e28de12382a9b6fa4efe373fea7edec6c34"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 110; + dataLen = 256; + combinedKey = "fe2cc783829bd7a4af7ab774a106230f4ce9db1c553580ea8ade8d7261e035d8"; + iv = "ae23cc467889745817fc1a13badb7377"; + cipherText = "a1f673c3976391208df5a074bbe9876a1eeac10800eb5e2980594810318416f9"; + plainText = "020f6103e868a52e9fac6c33d488eef4d0c8ae4a3c980a83f8b93dee79d6f7e8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 111; + dataLen = 256; + combinedKey = "1bf2e5a326b5e410e59743ae2cc15415ccc42353fe25a8542ee00457f1e36697"; + iv = "e4b535f80022a8cd732baa923210dd3f"; + cipherText = "cddc2b03eef6866e9dc0168bcbd3f5807c6cfbbf31a481e349f49245e307ae97"; + plainText = "4dc2335c609d9edcfd37c503b53c874a18f7f3879304e026dc5eaaba4e0ef108"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 112; + dataLen = 256; + combinedKey = "70b2b1c785b3ab029d77befc615702dbaf235d693e54f067475b8e759a0483ff"; + iv = "ce1a0788291ed60b6f8084948f0d1533"; + cipherText = "ae8329ef0ac3dd8045f0c93a4adcb11a5248aaf18e288c04245fad29aada11f7"; + plainText = "bffac2c1c4fccb6e809013b56b0c55425590329901c2c0a8731d22f4907d60d9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 113; + dataLen = 256; + combinedKey = "1f1b9159f4085e981879d7b3902a98584857eadec887b08b252a3a26a3f6c79a"; + iv = "86bba567c2c1be5d310f439fdb932a12"; + cipherText = "01abb5fd533e769a471ec3fe0ea34ad34d6e12923842e57a8d3344456b231430"; + plainText = "a4817421d0abf19adee445be95586e3c15deeeff7114aa3ad2136ad40e47b29f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 114; + dataLen = 256; + combinedKey = "c7da49edddd2b79757f04ed70e751b8ca96af2f60d0c85abaf49dc298f2092b6"; + iv = "c2c0554b5982b54b3d3ea872bf3ce0d1"; + cipherText = "f3a3ff8a227bc50ca0e5c7f47bb405a008392b32eee1acc310e677c2a7f44eba"; + plainText = "f6d478b350e3445911c21b329c24bc11760da32f27eb2d3f39df9ad7062f4940"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 115; + dataLen = 256; + combinedKey = "f72e936f1d768d48bd889f82dfa4305ceb3a08ad1e0e417875942f5bf3afb613"; + iv = "885e119374b14c67753650383088b263"; + cipherText = "dbd78c7a8fc60d3d692e3bbd8ca4dab72631530778528864e52c70f71704d0b7"; + plainText = "2a27a8639e4b312eb30c2ee06572307b31981188970f57b6c34294f9229d80ea"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 116; + dataLen = 256; + combinedKey = "28f2e8188e6bd6ad9770282e9433596d2beb6a64a543f9e1d07b257482a84519"; + iv = "0386008a4b89a58baa8f2aa39c9d2295"; + cipherText = "e4a44b86765bf0e283b4c20b3013b18f3d9ea60982c196d25a7505c7cb11a8e6"; + plainText = "634abdf141f7b33e9b941fd50a6e4844c93f7d2b2b8c09e6cb4d0b7cfd2c038f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 117; + dataLen = 256; + combinedKey = "4cf969387e44a3eaa675112c3488566465efb41f0afe1a2a56569a0cef14b20d"; + iv = "75627c66582cc06c1126cd5abc04b445"; + cipherText = "be952ffb57694a454a2f42b5be880d38473e2c91f63df864d29eef3d776ea390"; + plainText = "d1e751c91151f35f69fccdfd06493e18d49a94bb7c8d02414a10f0347442b1f7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 118; + dataLen = 256; + combinedKey = "e6189e85075b5455f3b8e5ff51bfcb34dd3ebc464a071bff44fc3a076e134885"; + iv = "4de19bd56257d382c8669ffe68b03484"; + cipherText = "6c62434f4453d1b8cb78d4e5a78a348662b16bf20ac6677b08bd4629b3734786"; + plainText = "6d944f49bf0167c511a02f4a3df80d2f97f4e3ddce56f51026e8b224658e3ed5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 119; + dataLen = 256; + combinedKey = "47f8b323fad90a4b6e52bd3d2b0e4e73bee4c1f60e6a6f94139f2f91fde01806"; + iv = "de88056268f85a764965ea608e8e32f2"; + cipherText = "6d9ae349c620c0d57e46c850c8dbb70d47420f77eec23cadff00e6703d90f62c"; + plainText = "6462144ced42f21195c58d524ba2c8b87c3b1d4caae688bb1529107029fafbdf"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 120; + dataLen = 256; + combinedKey = "5fca4c210463b2e89fd7f9b7ffc46b1bb055d80fef823b06577b438ebe810def"; + iv = "dab87e267f45c06aca437391e3ef2b93"; + cipherText = "9010ea0db832e50761a68923ac7504b41ac99a23b5b33dc67162c7f5c1576a99"; + plainText = "7d8676a704699254f0bbe4c5a1a725d5fb01dbadab25fd997e2a2fe646fd5552"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 121; + dataLen = 256; + combinedKey = "efb54f29334e4ec475d7a92eea05b5e7c604bfca9d3a9c4eb731b3ae05eb7936"; + iv = "4965e8e50879c8ed10a43b347150747b"; + cipherText = "950746bba1b484dd928e23df3fe73a6a62f48b673862ace994a60306c3cb81d2"; + plainText = "2d1d5701394407c4a3a49580e2e1cea79c96a3e0b2b41e16c87fc3ed142ee973"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 122; + dataLen = 256; + combinedKey = "dc5b03495daf20bedf1f5e0d89a930f67b99605ea62d88611d6f6c1e015ff5bd"; + iv = "eaccaaf4a82550e669ec5279de391eff"; + cipherText = "8bfa700c1c5d7f69022de28763f955c2087a48689e9b5c83d0ca5a43354bd8d5"; + plainText = "0d4fc92a52952cbd4872ffe964f0ea6bf10b8adcb95e21bc85e2e40dc139d360"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 123; + dataLen = 256; + combinedKey = "27a57a419286e0b36fecf477597340c9d422e95934f52840e061dfcf8add5f9a"; + iv = "acf25408e9dd21a8a0a26f2edef2ab76"; + cipherText = "dc5d2261a9fd089a013a86babc20e2694dea999f75c2edf26c15acc061b35cda"; + plainText = "1f7dce6c5ac9c726dd0fa4fdcd71a47ef3e008aacefe7656aeebf85aa0094487"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 124; + dataLen = 256; + combinedKey = "80d6d26bbc08094a5d51483d25c4cca63d42ac49ebb93b5e2a6934c054081e39"; + iv = "70868d1d4dca4e4ce94647ac4dcc3e4d"; + cipherText = "04c77b0e67f3e5b5436d4e43d50909bb557ec6dfe9469258b4cb08e4aab2c882"; + plainText = "77337683681539ea9f7934f81ea555902862f0ae3ff4d9f20bf4c510db33d47c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 125; + dataLen = 256; + combinedKey = "0de30916d9fb46126f1fbb9bc8019fe5c8a2635f29c8c3ea5522f387ec0cf6e6"; + iv = "2cecbd08dff325874c1cf6cb4a4fe7b1"; + cipherText = "009a7788092a4d66b25ff9b036a74e7b43be22f60e316cc917888bc557a046ac"; + plainText = "03349e81523e4cd7b89825ff448cc047ad1eef5754e0d2af4d919084ca430d2c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 126; + dataLen = 256; + combinedKey = "505ce85fbee4e124641e56ef000ecdd4c2b42b1e8fa3dc57b01196b4dfbc95cd"; + iv = "969351c5f5900f54db1f8cfa134ede74"; + cipherText = "7c081dee4ff33f09b5a5e0dd682247ea80fa8e4ee1657917b5fe881c4538b41e"; + plainText = "7d7046654800fe8a0868394173abf29d6b2a692493006440d69ea92c3a2ed5e5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 127; + dataLen = 256; + combinedKey = "e1aea2f0f54c1f7e9302c15cfc69cd079d051087cae36b5a6e845b08bc5f6ba5"; + iv = "68f89e9f7dbe50c799324973930782ff"; + cipherText = "6654b4fce012422229cc4019de5be0b49f52614c979e2ab176d8fd1bf01bfaf3"; + plainText = "77a5da15c3379ea2ec857cb9c0e61198f0ae368c0739397f6295fa6321464433"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 128; + dataLen = 256; + combinedKey = "947d285340ea36493b19e1ea31d2bb4179659f16e5c1372f3f7249e881bd1aa2"; + iv = "02356d80f96dd0a824c8fc7724eaf673"; + cipherText = "1399dae7f93ce94484c83da87f383d43416dee3d54f9cb5e492b51d4beca110f"; + plainText = "6c118a6ad20f75f2fa642da939ce5e8dbc66c4407d8b094a01f8fa3558062f4e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 129; + dataLen = 256; + combinedKey = "3aac43a0de3f82bd0d8dd6b883b004ca7a397dadece44ca5be84d55ca63f16e5"; + iv = "d217aa37653de9ed3e2504786b6ce063"; + cipherText = "85a6c3de3001d33d3ccfe5e18debf6dbc40fba5e95d72e6fd9835075aade7ac1"; + plainText = "ec6876bec25bcf819a038257546a1c214d1e4259986287b510900939bdec083e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 130; + dataLen = 256; + combinedKey = "dbef2d5d802ceb83e686e0da778f2912af7265699e09b8fa545e4b817dc4cb98"; + iv = "22870871373ad5103d7c38c16a31eb45"; + cipherText = "b4009fbf8d412776eff67745619e6e3770c4c6c2f12413999b39a4b6a51c8d97"; + plainText = "306640e0177e42f897488ece20eac2859cd6cd4f71df312221231559bf5d5f86"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 131; + dataLen = 256; + combinedKey = "6553c29b5269597f55ddf999eeb9bdae696833b19dcfe7e6921ee6e51ec598df"; + iv = "3f421d41d9c8b8d5535e134a6f76125e"; + cipherText = "5d1d7b4cb00b07485b674bb0714ddff95b17a0143de25bd96ab6cb99a338a333"; + plainText = "5420619fad9c86a08f2c3816d034215e2dbf6a1538a61d8f9306da57fa0e8666"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 132; + dataLen = 256; + combinedKey = "b83b7f41d016873342aaa19704dae3670bc6762fca3ba2f3b2ac0e65df7dde79"; + iv = "59e85a50fbf198f7b608ede83363b418"; + cipherText = "fef7d8cfba8309823c8b1adc75ccb1002a651eaf0a18ec3998ba73f826380b17"; + plainText = "44a951f87ffd7a41368e71dfc7292fc28ee01ae40c0a2e199d0af73b57170627"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 133; + dataLen = 256; + combinedKey = "ac15ac23f8bf8fc9dee9f31ad4e2da126505f951eef973330cf0bc53ee8193b3"; + iv = "316a7b2cba81d0185be9412a1a2a3c0f"; + cipherText = "a284b8a9e3961bf602e647669743595d51541502fa4da833cdadc3a17d2144b0"; + plainText = "1910af89b0870a9179b1d9561de2bb16d30752187e002088dd1038d6a0f32c9e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 134; + dataLen = 256; + combinedKey = "b4bc88d80bcf2cf7f2ad08b5b1ac4d959c6c9894514f0b374a34d4c58f088b86"; + iv = "f5e999b76c4ea71d749622857afacba5"; + cipherText = "0680487ac3489e791e7813ed4bfe9ac65e436591522e824a495ba4d9a52845da"; + plainText = "d542862356cf95898da6216bdd6b8585714294144aac9825ad30416f261d925c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 135; + dataLen = 256; + combinedKey = "b077d5e1ef684c36937bcf7d79674ce247b1af7fd304cd4a64c9ddd892e62793"; + iv = "57b704d6cabf2e79deb8073d17712ab4"; + cipherText = "24e253f3113b7c193f8ef49b1b2441bba2f7c85c3db069a40d5dbb8ceefe466b"; + plainText = "22db96814e23e7a49c095b78036ae58de23c1912b41b10013451d24a29ec62c7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 136; + dataLen = 256; + combinedKey = "367bb476e69f2631ecc6bcec6e38f84d2de363fa86fa12a6aab286f4527dec67"; + iv = "dc92d0f74b809814f042b6d834fbe421"; + cipherText = "158046203a217f588d43efe8c0ac11f432722d91025fcaccf6bad57d41a02f9b"; + plainText = "99af3e28a84fe8dec69c1d2d44735779415b2dd9bc8324bc57f8f22379382c7d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 137; + dataLen = 256; + combinedKey = "12bce06529ccdf05d06e55940c1992100b0eaf8d80eac4aa2baeb4316f7c2cbd"; + iv = "b8339fba52ea6f0b3c8be9f7238b365f"; + cipherText = "189f15142560298b4d0597b5593ab5d1e244cf09b81018658133340204eb40bf"; + plainText = "8f28d2857173ef3e7684ff5da94a87239da4a947058247be24baacfd8af94df1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 138; + dataLen = 256; + combinedKey = "095e2a9a98e650e328c71ee67e6cec432cdde51c5c9131022a1e97ceae06e92b"; + iv = "19cd7102ae9665c82919b23348a405fd"; + cipherText = "8b4738d042c14fb77ad7b8b6e7da16febdd49f9fcd0f46e62ebfcd807198c864"; + plainText = "5807ecb939ec83fd4fba0093e0a34adb46482da3de537dcef1c18fe06ba96966"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 139; + dataLen = 256; + combinedKey = "181da4bd34c89e8a9fa19f412bfc8986fedd27abe2095d1e6592647b5c9f68df"; + iv = "b09f9c79c462d3bd99b166a0e3eddfed"; + cipherText = "c521859c4d9eab0ce19f2ad50f6d20c031043490fcdd3a8f4bb0146fdeecac98"; + plainText = "deee66ffd3e61e660b9502815e450d46087a27d222dea43759e2075ccbfb2d2b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 140; + dataLen = 256; + combinedKey = "90377582570833b2230f3800b306da21c6185632bd74892505c49516c07122d8"; + iv = "4eb8293c12137ecbd3fabd6f09403b88"; + cipherText = "f70e49e5875024dd0d8b1b2c2ceb504691ddfe807b1280e589d18087fc436efe"; + plainText = "078668f44d7f852b634948d73c77842bd8ff53d68972daf3f8cec766544b6187"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 141; + dataLen = 256; + combinedKey = "a1ca1c7bdc10a4da9287d4921cf022b24b1af6d286b8831361002e97fbd4a39c"; + iv = "e59408a24ed500946f0d754f864a0c47"; + cipherText = "dd43acdde862be0063d1a0071cd54f2505e0ab261490588c0249550d3cf960b1"; + plainText = "d19e365fc839aabf58893137f58d84011831c76e8405244c95ab23304b026cff"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 142; + dataLen = 256; + combinedKey = "5626e50b50447192d76c9e48b23bec15d323ef7ad4a52a642622deb7afd5abd1"; + iv = "c58efe82998b3011ddc107b22945d79b"; + cipherText = "b774ec0d8fbf162020244513d2760028df12a5e68a91e8fa686bdd795dd6c3be"; + plainText = "4a83cdc37d805c2dda665a26ce056115390f0c5862b73fe766fc5d7fa99839d8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 143; + dataLen = 256; + combinedKey = "a990ef727b1f9e94c73ce392d59343e8007c1f5c1e4ab1374e44000a11c9e16f"; + iv = "2fc764bc4084bc0535a8879318734018"; + cipherText = "0e2d8b64749e03536f181f4c4db6dcdc324233606c12522885fefe100bf91088"; + plainText = "f6808e12d8c05c5937fb0a8e06a2dcc1cf11741079088312ea8e530f18f5fbdc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 144; + dataLen = 256; + combinedKey = "d6f7265e4fbc2dbe49852fe9eac540b82edad6fd9d2998acb7a224e2baeacfb0"; + iv = "d51d1d1412a16ab48969464aae734915"; + cipherText = "e5bc23c6adce9f6bc9627b45ffeddc347f545f25b9aa540f62792cf3dbcad1f9"; + plainText = "8b493dde8328b746525acf13e9e1988e21623c5ce1b332deaf0f8ef3dfd48b19"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 145; + dataLen = 256; + combinedKey = "3e6f4e19a6202282e68ff8b7264521b2b1cb1f6914b7b354dbfe88670ae24746"; + iv = "b817f7e357214510cf62cf165a253180"; + cipherText = "0d5104dfa38fbd873ee832c6c1948f111d17d5879abb437010937cdf50e11ce0"; + plainText = "b8007c7ae42fb6e971e8c245ddf85e589a0faa5628c526d3563fdf49a6918ab4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 146; + dataLen = 256; + combinedKey = "30e4d3758e06ed8e7a6547f3d0baf5a4b77a55ad3d2ae8ff1b1817bee5c98cb2"; + iv = "1dcb50cb9e54afe949156b2d46961c58"; + cipherText = "3da9560e8b07ff853af1e15cab84aacb5ee6939031a1d360d4909ac46e574ae8"; + plainText = "81bebb7172bb0b3c9bab155426ce38eba7b22e17c71f09a73df893f179b25a51"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 147; + dataLen = 256; + combinedKey = "fc22b40352b66f8dbab0ef27c4109e38e17e0a007b162ab11369785661f6356a"; + iv = "c3ce421280b32a9fc3ab265f8d253ac7"; + cipherText = "25d710182c05542c28264bd68e2e7fd4f979692d086e77023dea3c3525abe11a"; + plainText = "bd04ccdf9708c8adbf7a3a12fbbd22816fd9537522f7aefb55ed5426722dbdce"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 148; + dataLen = 256; + combinedKey = "4066c651048c7529010e81614be36b4d0be7d0ddd4bea953fa50d1cc4f6b4e2d"; + iv = "43728e6cd43872a563e50c2104f28f32"; + cipherText = "531d73f8fc77cc3528f070bba471c11a1dc7f766524e337af98b1b2c3ad2c6bd"; + plainText = "5b444f98d8a6305e2b3032ae7c672db28dc264961863570eec9007b0225fa0d3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 149; + dataLen = 256; + combinedKey = "3d5f9b7f4f1d76a474b83dfed544bf7509aa39cdde7d29789370a2b310a1c678"; + iv = "849205e46a6f607e5896c3fbcd3a1cc3"; + cipherText = "5fc53b2f6e5533e70a0c2f9275356ec746bf8d6d06b65a495060e93c63a4bce7"; + plainText = "c2d51bb2340cf7c5176cddf4b41cb08e895fd2a24bffea6d8cad69f580174ae6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 150; + dataLen = 256; + combinedKey = "75bc63e7037a837e6ccdaa8e72afaac14b0712e3e72e26c7dc457406e8d97718"; + iv = "60e1512ff7ac3fd04cd8c9358b3a571f"; + cipherText = "ad53ea332ae4326df46160d2cd034326e904057a2e77a56d9c3c68a5d15c7f39"; + plainText = "29b0a87040535689888a2403d00d0d31ffa890d0e0a654822402a2096ef3003e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 151; + dataLen = 256; + combinedKey = "b020574ec5ce0bf7baa7d19a705cf88eca79f3d037e1f1930f0c8e5fdd2fef23"; + iv = "f7f575964afd1965e3abd58e5258934f"; + cipherText = "6298eb2270120f2ef908203dd8e3fbb60418bfa97a9a2f9cdb52b65962ec13fc"; + plainText = "71c3d3d6693a5950d7c421e035c5aeec7a492b7fd0ca6644a290eb66c0eaa3da"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 152; + dataLen = 256; + combinedKey = "d90e86e33d0c2f91d48b70abc672a01bbf67d1ec009d55cba4dcb9dd5b6bd055"; + iv = "644d45113f35c2f2623c756aa3290f23"; + cipherText = "c9786fa6bb5239a18924df6b0ce81fe97cc5dbb9e932ae64c67c37eaba90a6cf"; + plainText = "fa497ca68ce6593e4d49a680bb5b1ad4249ab1ce1376b6fde71b1c7708da5b74"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 153; + dataLen = 256; + combinedKey = "4b06b66b1486ad311be59c7c4b9fe9ad6f5f7433b1ed90aae80573551399c3f9"; + iv = "cad5601ef7ef95228a0efb80bb746946"; + cipherText = "cb4cdcb4939c29018ff2d263ab71b227896d3428e9c15387d54e395884081852"; + plainText = "9f7cb08698734b2b4c70fdaff032c3357abfc0cd1051b231838caa1fe580fe04"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 154; + dataLen = 256; + combinedKey = "dea54bb0f022414bdb8397ad23b31124f112ecf8339c49429bb1b2607a301413"; + iv = "f98040250b58279ac4e4d4cdaa35841e"; + cipherText = "fc65f6c581ca68fe7a39db8d4796e2185ab8fed4a82a9d9759c98a9d17576dc9"; + plainText = "d6cf5ca25194a5099150f1092f30f65741d598581310038279d8b2dbc92d9319"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 155; + dataLen = 256; + combinedKey = "d023c85f1f3a732d6fd4e9e67d9232cac61aafea4185daa1f2ac74af422c019f"; + iv = "a7a42dd98037cc68941c6f9e15b956d4"; + cipherText = "a14503ef6d3987e05c336ccf1012be14b18df2f3bfb2005981fb6c5fc14acd7d"; + plainText = "7fa7ee4af3ee5ca37c2da62a02bceb0d2006aa2b53b421209f8a7e400555bacc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 156; + dataLen = 256; + combinedKey = "ddc723b045383524589cf34efa23b2d48aca0174871d8fb3a84d9bb5d1d070b9"; + iv = "48e7379ad0551195d7591131111a3073"; + cipherText = "0c25b9bc86a03e6be12762cf17b25abb86c25f1d3bce92c71fd971e833897da9"; + plainText = "de491bc2f55f5ead3237c60c72335ac5ece473a371c02d9ccdde3ef02dd070d8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 157; + dataLen = 256; + combinedKey = "60239b3a1c609ab43fdadfb37580fcedcfc798cf0ff434e9fe959a3605a7713c"; + iv = "42a3ca8317cb52658f0c912172255c4f"; + cipherText = "9b6a194cf0796c5c23eec5435890b5cde3fa89302ff87128a1bc77e1bcb41cd9"; + plainText = "72103c480a46ee87b3abec48f81a736a6cf54c0b317870afda8075f6e5f9bfee"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 158; + dataLen = 256; + combinedKey = "363f867cfe07b2d547d8cd03219672a76f9ccf7f94e196199c8f9daf54f7eebb"; + iv = "b714e5a457493c5f1eb492051f85c574"; + cipherText = "f035e3dc0c9b8f70bd41f4a5bb43a07f839d8693c3d3894a6778714f1fcab22b"; + plainText = "17556339a11d731c100b125b04a2a6ff49af9e0b3c88ec75c9b9decc742b7ccd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 159; + dataLen = 256; + combinedKey = "a1f9dbcdfb3328a1825c88b3cbd34b4bfe65762472c473309b9de532e8eb5ed8"; + iv = "6537b71a73932878e8779da49185b3e0"; + cipherText = "b0533ef5f6f266bb7e72cbf0a59961ac0684b6cafd7c1e7033833d69b082c1c5"; + plainText = "6a546ca8b2e7aff8e69225158386be07602f8abf9ad60aadefa04a7ddc4b40a5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 160; + dataLen = 256; + combinedKey = "fe7eb772c48c6a80b9386499782ab6a28c2ffdc18b6f11edd8e266ce8237dc14"; + iv = "188df3a513a4244e9b0d158836d64c37"; + cipherText = "baa064d6271a69a88923d45fc5339d49611140823ea904edd16597002bb18e3b"; + plainText = "352652a2b16af379b09a9b32f1eb425124a078907d9405a7d88a2f8caa896275"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 161; + dataLen = 256; + combinedKey = "ef59993eb626f405d75ffa84aed8746540b1c07982f45237d0ebf2f9c60ecc71"; + iv = "344136a18c7372866cba27da4ae5e838"; + cipherText = "8cd223f9a143e6d740f5650cec2205bf1d471270776cc7b4e739517ac3c06606"; + plainText = "f0f7dc5de403c487272b05ec074c2d87e2c1ae5fd3427b8021581f3dde8f56a0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 162; + dataLen = 256; + combinedKey = "6425b4ba600c61dc30d4b968399f1a64b0bee9bcfb038c900e87e9c2f0172fc5"; + iv = "21af7ed62d89989c211ef9a16e54eb43"; + cipherText = "c3ad5364c9d9e85b9b26b66a4009f7f310fcf189a57429d37670270f0c6805e4"; + plainText = "16898f3ce68ab4a9f855493a8633fbe473d35b0a54e2c541b8604e9aab0757d5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 163; + dataLen = 256; + combinedKey = "b3ea2535243acd6d1f02cc380123c910117e6aa3ad7d48f1e022acb67fac0fda"; + iv = "778e4d4f16e9e9c9e6d677ab46e3816c"; + cipherText = "d5aa39520a8ce6f5257e83e7bc0ce525fffefc5210298787aaffdc6914f1b397"; + plainText = "50ece505815f08cc1f8397e557b5b1f7c7a1dd5e719e21dc8dbfdb21b51aac3b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 164; + dataLen = 256; + combinedKey = "767e977f0780a7432acf21ede2930b249bf0a63bb6a88d4459b1a0142b7de1b5"; + iv = "ec0d37199b8b55a9a37c2c98cf5e9182"; + cipherText = "807ad5e12a25fccc71aa913565f406fafbd7317ca61b6f14b297df99b71160bc"; + plainText = "9f427b755c3dda71d9c3d88771a92ab5e4d3ad3e36c638047d1e37b9b513f6e8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 165; + dataLen = 256; + combinedKey = "afca211742433571ebbe065c73aee533c09c352e80bd99430bd0a019e69f15e0"; + iv = "8dfd55800efc7db4ec1fd84412fad2eb"; + cipherText = "6556573bdfe5ad000f061a0c168214088a0f230dd798dab59bc450a577a3bad5"; + plainText = "1db1206ce1700d543949c10a6c1d92321b07dfe7f98f2fb5d32470df11e9d5d5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 166; + dataLen = 256; + combinedKey = "3e1f44d7993d0e78a467d2bf0064481fe0e904ab2d4fef5ba8b1678688766058"; + iv = "8e7ad323eaf134e38c202f8cd9bb5c08"; + cipherText = "c13e1150b43325fc2644c170c5492548fb2e0ae1d5b0bcb10ef3777930e7cb4a"; + plainText = "f4613cbfedbab97842c94682edccfb347084f21e39c05e9346f63b70e405c33b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 167; + dataLen = 256; + combinedKey = "c35b8ff3e415ce578abaf259ca5eb26392ad0741846ac0ba9e30cd3b7d304f1f"; + iv = "af4fd1d47c5609a325dd69bce96331d4"; + cipherText = "54cb90b1cfab48267234492ffc4ab50bc8e01abcbc121acd726e65e290e340e1"; + plainText = "e9232f2747ae28cd18ce1c0d9933711726dd26664a18d736ca946b69b7f560e2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 168; + dataLen = 256; + combinedKey = "66fb05de33435354d0b1828ee072c7f58c217957b15b164fefb75e6730d95ec2"; + iv = "2e5e98187ec53ebcf386df2a42b92bac"; + cipherText = "8fb501c7c0b118c9a65587289792aab15894f7e05dd9ec87312b25ed7145322a"; + plainText = "dca0f4ca594fe88223c2a9124165d0bec412d244d6700b44627531e5107430a2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 169; + dataLen = 256; + combinedKey = "86f8149ab118194d0802cee00e0e16b37858cf3f81b0ef157e5d974a70eba1c3"; + iv = "cb8bbc7123b194a595208b679cbe07b3"; + cipherText = "c917d70fa7ebca1b0d271abda72a955d39f312528c9ad4a79086715875a5e3d8"; + plainText = "ae9453f6a09e17e8ab92f7c379797a5f61900064202af702fbbfff8cacae07e5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 170; + dataLen = 256; + combinedKey = "a2feb7db5b8b8b43e8eeabdc708b33827bafbc287550c8b728b14e2e27ff7dec"; + iv = "df2111491b05020f123b817ff21d66ee"; + cipherText = "76c77d52559800ba5b7ac84f518cbf932e518f6542265a218179adc275d7da95"; + plainText = "b4e28480a4f5e7ab8ab5eb2d34fff263567ae383aa097b80c067b79440f7d2b0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 171; + dataLen = 256; + combinedKey = "f95351f5efcbed389f5f8e950498a770e79570924bb869cdf90c6c9801d02c38"; + iv = "de1c4ee200e47f28a65165b6eb5ffec9"; + cipherText = "5da9a49f793dfca75b93a8e370d108d3e97249a51f042ed19d6fea3cf7d2b3f3"; + plainText = "36127d1d61b62514ba16d8f0408ab521eb13b9a5a598b4711696b90d680512e5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 172; + dataLen = 256; + combinedKey = "711907b409dd75d1e3510cc4d98869af09a7268cfd9f755e5fb8c4f3ca2fe071"; + iv = "b27fa52899918de07f7d00d2b527da8f"; + cipherText = "a24d3f94604b3c7c5458876497c315bab18cd8c187869d5ae535d372420d5c13"; + plainText = "a96d515ade745f94afe3e0fa68032fb00f94c6008af41871c9ec7b95cb0e14ce"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 173; + dataLen = 256; + combinedKey = "9b94cbac1d07dd18799bdb7ba33ef22954cee7f997acc0310aaed438e2c13832"; + iv = "feacaf0702f7c96bd9f8411a288b7353"; + cipherText = "a96e751fc2b74757e2d95584ac47f564abf8425affcd591eb0e44169b559318f"; + plainText = "db9c227d0ede81b422537472942f7ee1264dc0cd917018514c5c22cb04bc3d9d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 174; + dataLen = 256; + combinedKey = "0655575af417a2a914b7e154cdca734c126a1cc8bd84fe7ad654facdbd580e01"; + iv = "b2f1e60733e2f0f9606e099207572ccb"; + cipherText = "2499102169d25ade39d59efc7d5cf1112c19b53369aae4d823eb2cc5e671a31a"; + plainText = "cc0039c9e5aaa3606c5ade32c63bea3509233f7ac6ac4c039ec5becfa3ab3813"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 175; + dataLen = 256; + combinedKey = "d243f73aa0ac21268a3829572c03c026bee04ccb6d7acf074c518c03bb72a061"; + iv = "cadc2ac4c72493194044a42127000628"; + cipherText = "cad6b1cc16b491178c75e6c461e4125c08eb089168cad01e749d17b422513edc"; + plainText = "3e64953496755317d1908054cfd72461459a7c31c9b89a46d095bfcb73b5c88e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 176; + dataLen = 256; + combinedKey = "3db87ef71178b4d7bccbcba412e7e84a8bd225d4173d4525ab036e8d5fd88a7b"; + iv = "f71e65efba52e47874b1bed59e9f656b"; + cipherText = "76d52cc26f84e5c3c0f86f9b0ad46b485fed6a6c3e6d913d00c33e10ef336879"; + plainText = "a09902679bdf1e8db67547faa5c3c3b3dfbf3c9804409c2093b29877960320f7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 177; + dataLen = 256; + combinedKey = "24ec7f7f783c5efb3dd67e64f4a25ec84caf191120ba8515f57eef4434038892"; + iv = "4bb82f22d2af2f639a5d21b3c1263ad9"; + cipherText = "2a12508f8e4a909601c6bc1e57db37566448af0b097524dcbffc7ceca2a2f362"; + plainText = "ca74b47e04620eb3ae8e0e896d5760489ad3e7177386eaa781afed90b8af8760"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 178; + dataLen = 256; + combinedKey = "30d5accff4b868b8fb433deac670604cc750a13f6afdf66d08cf8e8b5ddf999f"; + iv = "4be1d679ff32e03d720ee52558547b73"; + cipherText = "e38b3030c63b71c109700774b4727ec8163c8e6dd5c13182cd0d66584445ff5a"; + plainText = "fa0a8a12d86c7a6f166a1ca7183a358a40c95515b68b82b1222b1d13af597435"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 179; + dataLen = 256; + combinedKey = "edd716fd637f7dc48ceaac7f54385190f72f9d926a8694d80401f9543c2ea32d"; + iv = "6e262464c7e6deef93fb882230c4787b"; + cipherText = "a7df6645d58d7aa8dc313b31629d12d35ed3979c861ece544f7cbd807641a575"; + plainText = "c48210956d49a8fa645644467883dd59daa103d1e8de5e57f3fcc3c08da05c02"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 180; + dataLen = 256; + combinedKey = "7726142431321b04e66ef85817756ca865f9959fce7cfd3eea2b4e279ce13054"; + iv = "f2924e89d33a18743aeb14e7fea83a6a"; + cipherText = "782194cbfc42c60eff0b3040f66fba826170fb7253adee862ed8493099e703f1"; + plainText = "3a8941917fabdb2c766a9429cea6159405d5c4a1839ef67b9b2b0fef1d0300da"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 181; + dataLen = 256; + combinedKey = "25b69fc28297e7626578665e703ce2f4021ec6408ea9c5e0957d4efefad3e046"; + iv = "7c7a5bccc55b4f66fda53e8fa31df30b"; + cipherText = "f60eb1a7e79d58fbef3bed6e76ac435f2f79d113fdcc0d9aca6bf643b2b8b391"; + plainText = "b76b266d8e8143450a05c4f6cda9392b77a919f25b3c1f28a5e827fa52b34f33"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 182; + dataLen = 256; + combinedKey = "bfd0fc840590382cd469f9c82a62a46ac07c05f31060b83c87790716a5fc30eb"; + iv = "e541c2dd1c9e282468ef6503c4d77d4d"; + cipherText = "faf6fdd7e83abe05ef2a00d9ce455fcafde37d7fb6775b36de942a427abf274a"; + plainText = "3d096b200a8525da64c3a20610eff9b5b5177a3b879f802374a43d93692c82f3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 183; + dataLen = 256; + combinedKey = "e1f49e3f03de7cf3bc40f6cea304fadb2510dd2ca30304690634164441fbdf88"; + iv = "d562a86e3a359c5f7121e01e62e1eaa8"; + cipherText = "46be77a0083a9c4e7062b1e07903c86e51da6c96a1326f0b01c0dcb772623502"; + plainText = "d322df20f580b79d42ddd216717a50b37b8cb2c50e9d9ed9bc61313ea89809d1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 184; + dataLen = 256; + combinedKey = "8af5e3068800c5b79940542eb47e2894d8cb70516c758bcd8a666907044e5d14"; + iv = "969b68a94ed0b73440fc175bc91f5280"; + cipherText = "14e7932f869bbfc839a739be9d681e98d4f5dbe2f9b0d9b22663e6853cf013b8"; + plainText = "e3d8d85930315e79fced06735e7d6c8da3d558463dcad726c9a64e3bf13ad699"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 185; + dataLen = 256; + combinedKey = "d8ac76f14246bd9e32f345c4ca121eecab5b83311f650e86935c689ca5439249"; + iv = "9509c6dfff06003f7db13c9c0b1d54c1"; + cipherText = "b1228b57d48be870d10532b5ba801be3fcc963f9658e7a64a9da70e8b1b19cda"; + plainText = "7b769018f587ce3340a672dbe72723704bb188636feb893b9f84d3f055541681"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 186; + dataLen = 256; + combinedKey = "b429f55e39d6a8aa06afeaefb0f0da4c7e71b7027d3552316a848ac82dbf56f4"; + iv = "0ff19bb74c868c82404c63b39c1f03c0"; + cipherText = "af5eeb55e631dcd80b74c47af7184d21ec3ea27c15a9ce9c32cf17fb88ce68dd"; + plainText = "a742ba4aae2b0efdeb4fadf82911c3b7bc50c1440197b8fbacc697288492329b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 187; + dataLen = 256; + combinedKey = "509142f11c4ac3312da3d20e265db9c4f26672b97dfecdc6b7e86d7f14e4f646"; + iv = "ceeb9ac40ae7c7f82939476efbe26a49"; + cipherText = "22446490cb65f03e5048836c37ff17b72e04aeb0ce8748ce510c0f8acf6693f3"; + plainText = "263032f1f7ea647c218bca88ce3494b87269479cdc72b331588f758dc61d336d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 188; + dataLen = 256; + combinedKey = "55af7a97ab44138c3f8024b5f2c1714106ebae79a6e7c7ad94a0181975e1688e"; + iv = "9629a53e1a82f2528ac3a55a14af7a59"; + cipherText = "4cfc706fab291ffa23daf1ffa91c27e687a66cd8aa7b3636ea3e3f65056fd0f3"; + plainText = "7efc61b96181a550b4c334456b84b7a202d4618098e4b3c811a0b9d3af9670db"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 189; + dataLen = 256; + combinedKey = "ea7eb44003e9bf171f2ea5cabb6fd0dcf678d722fe230573e9bfe86978450dd3"; + iv = "cb96cb5dceebe78e0cb89a4813de1a2b"; + cipherText = "cd2b13835dcd4f0411ef8c007bd43709c4dc166bebcc72dbb24e6686c870411f"; + plainText = "eb93a60a1b0b5b7a490ce39685aae3d35b72219de9142cc89a9fffb566638682"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 190; + dataLen = 256; + combinedKey = "582de2e90d130812c3e9dde1425a97610b74a8982c4c4c3adb8a5abb7552c4cc"; + iv = "4434f2f90422dc47c400a8be0c5c61e8"; + cipherText = "baf7b87c2048328f092b925740f163c1d547aacc2d8fe38ca09da9fa91998dbc"; + plainText = "3b6372cedf430c3d2dbfe0108398a389c749ba2708cab2433c8037d4c95ee8b2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 191; + dataLen = 256; + combinedKey = "1dc8af9c078b9a92ab30573d97f57423daac1efc437d3f216517f640cd5f2542"; + iv = "3a3ddf40860f3c96f639c5c5c980d7e9"; + cipherText = "2542b38fff8adee346fd9dbdf591de775934952ee2d5e4213c834aad9185b7bb"; + plainText = "2a08ac707249da567ed0d7b7702806641f07b372c6f7e2ee1d71b06a15172784"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 192; + dataLen = 256; + combinedKey = "849718a7a4c60c58f4163083a8b340ad85f178f46af362fb5fd9f7787c1cd3a2"; + iv = "d7242fa38e10e2c1912386f5e4f57f0c"; + cipherText = "5e8e9f74d7e06400bbfeac1cfec88365ede305d6dde6e06b3bffab7d05b60069"; + plainText = "c515c6a929c77c9379842310e980f9e3f07c96834740e1f78278f45ab8432cac"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 193; + dataLen = 256; + combinedKey = "9baefa2fbd8f07cfad8f263b6f38d528d230a605f60ec4bb8ee05c1cfd0c48cf"; + iv = "03b38f313c631dcf1193ee02c9bb4f60"; + cipherText = "1a2089e9cb179d1ff6e1cebe0d6546bb976a6ba873e77b0e9f15299cb8ff9205"; + plainText = "0ea873a0a3c2c8227f0308e50a2632ebee97f9986085bc57c332c667076c9025"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 194; + dataLen = 256; + combinedKey = "d26bf9a7f6ea012f1dd26183038b60bb1481dc60b5b581216aa7427b7d018089"; + iv = "e335fd5c1d6b72887d13dcbe8d40cbaf"; + cipherText = "8399175f06b764b5b8c741442e2f9ff97b27055b987d13130b03366896fcfda9"; + plainText = "d836fdee9f32341eaa0783bc8f1a009897d11842f142e61d85d85edca5ab165b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 195; + dataLen = 256; + combinedKey = "bed8d860a510f1f7dafc07494d5c7aee51bcb215f21cfdc62226ddbd23d0d278"; + iv = "c7ce763661ee111af174a6c88888611c"; + cipherText = "5282bac88b3a0513a5ebba6f6b96399cb23780a987782b6991949f3c1d49baa7"; + plainText = "75002b3591a162a666050020bca798e35cbb6d5750028b76a0b89fd0bd818f20"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 196; + dataLen = 256; + combinedKey = "3aae4f7222142deab482b5d7b903c2d3c92f3dc4c8bb8be651de26bf5da08764"; + iv = "f575885839e1ea4021de37def7360e36"; + cipherText = "ca0eb48d2559e7b9f0297a79f3732bb569150632d97f4488a426453e63c0bf1a"; + plainText = "81600fefcfade51526ec8c97020bb7fc5752121a8133994686f3bfe3e6750f85"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 197; + dataLen = 256; + combinedKey = "a7011dd7ec5f9d57fe7a20cef2ac28a08f92779b5ef4402a2438f486554affc5"; + iv = "0168cb2c62ab43e353fb5f0dd78d435f"; + cipherText = "b6f22116ac2d70718b65551b4ee7a6932b0466e9b6d211330a07153050b4079e"; + plainText = "0162633fb7363e2396934ea0c30dd82c4a3ea795f5c12be0f7af1f78c45f7d0f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 198; + dataLen = 256; + combinedKey = "aacc20ac91b4dc4e440c44d89ad933dab73306ea5f365df14cd87118b86c1be7"; + iv = "b450eade08897042b87810153f275ad5"; + cipherText = "666f1a7c6da7a9f6527cf0fb19f15e15bf184caedf46f21f1cb09ba6ed99453a"; + plainText = "d04e0bbcf0de146fd3abe6c798b258c410c75921aa6c62b06e90f602a5a0e725"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 199; + dataLen = 256; + combinedKey = "05470a50a66d5d73ee966331c8a1a98fd3c9cc13c2a2d1daf8ed48f3304f84e3"; + iv = "87202dfbe46437d0b59bdf7ae23abbf8"; + cipherText = "d3240c09183aaddf37f4145389950760f9ca57bf38427727114098df02db0b00"; + plainText = "4997bc4347e23b9bbce6d248c826abede86d9f364afe0be817931e95f361909d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 200; + dataLen = 256; + combinedKey = "5c175e5c029bf737639e81dfd8dab089550e713f3b7413f637bca92e7ca11129"; + iv = "b6e8d522ea13d066c1a624fa110a4538"; + cipherText = "661964ccb235a3083528783dfa7939e24bde6a23e8864cac526909ca5476f094"; + plainText = "326b9afdf4f9fa1d8f4e7b1fbfaea9beaa6d7ed1fb241262778d9af44cc7bf97"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 201; + dataLen = 192; + combinedKey = "ad402199b1b0a479b54b3643f26d9cdf42f64d0cd72bef286f94b64ab9aa074a"; + iv = "3d8b17b42d776009e3f91c094074bafa"; + cipherText = "509de6cee075a82f96fb7db5fac03f38b1899843b3d06dec"; + plainText = "cc6fb25668ae8ab46a2f5206d92cb6672607b5d1be73e267"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 202; + dataLen = 192; + combinedKey = "f3a98f1ba8deeb23fa1c85a434df1481686d9a8febe74312adf32420246e1a86"; + iv = "a0603273dd6cbfb42ecc98a220ad177d"; + cipherText = "b1fe4eef4b8e1f2f121b044b8ce3a5a3a95da4751c12e0cc"; + plainText = "54ee0fcf90de79cc698ddee4d48fa6a33d1d9f9670aa83ec"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 203; + dataLen = 192; + combinedKey = "a5cfe2abc117be0f414eb52c6e4e57957e45283bfb6b6868dbd1ac1f225abb1c"; + iv = "8bdaae3b9af4f271d505d7727066292d"; + cipherText = "80f4c032e0a12f4ac8ceb248516bd1273f58706fd2e36fdc"; + plainText = "98831b69eb1c1e1f292c6b861518822335bea62c7c5ced5c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 204; + dataLen = 192; + combinedKey = "a66366c4ea2648bbba447f26c3ca0fb350930b4bf47e42b874cdde59fa27bea2"; + iv = "e337aacc060c182fa07054c20913461d"; + cipherText = "2cc85ab3aecbc38e2f7f240dea82a0ce9c60422f6f70171d"; + plainText = "a3418229d798ee7c3cfd38088cc9501fad69fa366d55450e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 205; + dataLen = 192; + combinedKey = "f885552ca2eb4781a3f59cb68df4700c54d62ca55fc49aa851b601964af6b5f1"; + iv = "bc27d6f5c348f79728369c7ab868cc61"; + cipherText = "0036d80a988a111de21226949c2db534660fcb8380b7b42f"; + plainText = "6fb728817ea6982941439c63fd418b41d8aff57380fed7a1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 206; + dataLen = 192; + combinedKey = "28c561d7ae3304a06c79f362f9312d7c5e67155675d2e10975b28d04046cf800"; + iv = "024c9288eebd0e423cfff85f5931ea1b"; + cipherText = "3ed59af6a8ad4084f4ad58c8aaae09d9f88fd16223baf2fd"; + plainText = "0710579eaba9746e71719a731e1d16fcb0dd146f798a109a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 207; + dataLen = 192; + combinedKey = "de496c73fc5cd657c978069d3be80827053074d267ca40e2745d4aa2a13b57f3"; + iv = "6e843c9036a0e7461d78663c35aece88"; + cipherText = "a911e9e6176e7fe27d1b20425e72d0bfa2d8e98adb87eda0"; + plainText = "61458d7dda5c9aba7afd74151e1acee026ebb6b8c47f4790"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 208; + dataLen = 192; + combinedKey = "f0b6688206bb4cf2d915f533f1fc73d2b64f94444220606d30baa0bd51116a61"; + iv = "a3235b7f415906ed4421ab7c42adfec9"; + cipherText = "f8af835862cf1d76776cbc5307e5603279d8398db608741d"; + plainText = "b99e2c1bf4578112bb625453b13f20c88400ded6e6caa138"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 209; + dataLen = 192; + combinedKey = "0a80d9c0a55cf70235c4ad60dd087c8a7718707ad47b352ab118edca14e55519"; + iv = "b338bce1226a496f69bb4e99344bffce"; + cipherText = "e25bdf1ee567f7de0ddaccb6d47637e9c5e89d5ac2114ae3"; + plainText = "f57811de52f1eaf2223de4fadfd97a3d2b7013a0c2127a81"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 210; + dataLen = 192; + combinedKey = "7045fcdd61a53f938d1826da842ab994bab0b1d6682be5a5899e4d09ea642fe4"; + iv = "98d8326e7fafa2c2abe4b58f6abd7d9a"; + cipherText = "d9b9350ca53463283c96a7e7936b7cdea00308fe096cf747"; + plainText = "2285d8863bb1101e0c6a33673f616b524daeb1343bc999ba"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 211; + dataLen = 192; + combinedKey = "e52d9ca2151e8945e21240188e0bf557e1dc155f22814399c590489d5f0b32e1"; + iv = "7c6f901bb81312d80acbb8f9265d6ff8"; + cipherText = "7fd2ec8427485f110527460410ecfe95c835cd69caa402a4"; + plainText = "d03158565858e0d56a147045481a4c2cb2bc1e8a52c96d14"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 212; + dataLen = 192; + combinedKey = "64afda92bb22e04a1460b92c06cdfea48ef6bb05e64ce652901aac0baad02d3b"; + iv = "30818c286d60de69610ae303da0bdd61"; + cipherText = "c599c7a8ce5427c1dfa753596855ef49f472035afaadb58c"; + plainText = "0bcf3c3022dc4352bb6fb955b75534e9354f9de1b7b2ddbf"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 213; + dataLen = 192; + combinedKey = "c7a1f079a7e4fc7941a0846bc3849cebb53c62f0ff7db9b44559f8d7ef15bd17"; + iv = "dee1b747e4df16eabdd6338eb653141b"; + cipherText = "fd11ba730bc2c646e3c81534df1512d34ef8a89eb299d165"; + plainText = "77b5f9025c6b6d73b7eb1a550e6c4ba731d432cdb86cc4a6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 214; + dataLen = 192; + combinedKey = "95154951cf85c2be7190776e30215f4df4687cf150421c24ef953b62d06e2b31"; + iv = "7d0b6063dbb2d66c0741c3a6eacb8e27"; + cipherText = "578c313bb9ec619dbdce89902d5ee88297d9d944cbc4be4c"; + plainText = "2c8fcc4162607a80bd1dd77251113355f39fb7ede2becebd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 215; + dataLen = 192; + combinedKey = "6dc75ef6aa0023af870754ee2b5becbe54cde77e526e2ea28f78f9250eb0cda8"; + iv = "f0e2a89d7fc58e53121a1cacc66bc3a5"; + cipherText = "c991fb40e24c06f9e9a8309d7122c0a3d8b36fae7f0d2ba1"; + plainText = "bdb81086afcff87606861ef449e8e317573d10714c7cbcc7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 216; + dataLen = 192; + combinedKey = "3afdb1553b1868c537617d2353fb582abed81750f3917a8adc7f9b84e17e8159"; + iv = "08fe618b8ba077979d0072d01decbd09"; + cipherText = "95a187bac1e5954806435141b31ad2348aaecb1699d3fa5b"; + plainText = "8bb5d31f18366c99ba2b8774bfa6f57532a547348832a09a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 217; + dataLen = 192; + combinedKey = "4dc48198aed7d1f3d9cfb036140f0578bca45b0484b6a5068fb415bdfeb47dbe"; + iv = "87ec7b2763727fb53e2fbbcc614a58dc"; + cipherText = "e354084304e47d2ff7b821e03c332e37dabd00f19b9aa06e"; + plainText = "8a4721342c754d89ab032ee0e00e0658634759f33b9a3fda"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 218; + dataLen = 192; + combinedKey = "b6d2b5a6825385e8b88624330b8c99e7966b08bfcaaadd40bbfb3ac4e6e6f2e2"; + iv = "09a1caebf99b8554d77e1224ca95acea"; + cipherText = "69915ced84b168712b6729fe87b6c9f7a32dda5d1d29e163"; + plainText = "27686b3c949101b60ae2028ff6acd404c737e28a9c07a133"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 219; + dataLen = 192; + combinedKey = "81b2d10f9462edd7a5c6621a056d0d7e630c57b60d1a21d8dffbbd58fa0712e2"; + iv = "d863189b6a1c195e42816a412cfd1a99"; + cipherText = "a88c57dff8f6bb4ee1f23d05db75e6c29242086d0494d001"; + plainText = "b6199c91b6ffc39731943976de167158a20e7dd83d4afcff"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 220; + dataLen = 192; + combinedKey = "cdf1deba386039c336e72fb9e6192aa07e1080a74ff337dd87be88bf47bc15d5"; + iv = "b770d940d0d1e050f30979dc08a556eb"; + cipherText = "9632eff040f1c1112e05c5e0774aa1ed1228098800c0c9e0"; + plainText = "04046f6b287bb96daa0f40811d9b7fb333bc9d12a6d9911a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 221; + dataLen = 192; + combinedKey = "814e5e6904bedd20ba656140ddd9b18a07702c933f61f1b78d1db8698491788b"; + iv = "4da80288be5336d8527170a9aa664f80"; + cipherText = "350a4e3378b4baf65e7e469ec37dfa001a9057f79f3fefcc"; + plainText = "36c4066bc713d2c4664d1c907712ee611de02d5aa936a7f4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 222; + dataLen = 192; + combinedKey = "922f86f5f3548b3fc76420929076a7e068f922dbfef637b8de531fabbbe1ac1a"; + iv = "50135901bbf25882617d25c0601c0ae0"; + cipherText = "60b463cc7e03998751d7e5bba215c151f63104ca5f4b8b3d"; + plainText = "0fc8c8742b10b8f93f39938a08861543801e25898f6cd67d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 223; + dataLen = 192; + combinedKey = "a349bacb5590a3e576e187083861144682451cb8fdf127e1684da7f9daac1f5f"; + iv = "89e6dddd6d57f441c94c11ba0833b4be"; + cipherText = "b4eb8bd39a69143b49c47e0153a46a32ee36c12339826783"; + plainText = "e66db19df660b0c1560f2ed6bb61ee105842031bc9bfc0f5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 224; + dataLen = 192; + combinedKey = "38a5eaeb563b05b9d639139742453ee0542b83ed37f742c816fd204b4d8dc150"; + iv = "9634c1600eab4bf1ffb4522b7d64819a"; + cipherText = "56aeb276a65efa8db15492c6705fa920467400765aa46ec7"; + plainText = "0d88e7230feda9f43a2e644ddeb86ef718e72333cbe163ea"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 225; + dataLen = 192; + combinedKey = "fe0aa4f84024cdae7ed25e6e3cde1d664de9ed6f82bc2e812a7d8ca4445a1c29"; + iv = "9a50f294d00e60893d93b0854228e433"; + cipherText = "d41862f403a130f243de0eb277d9687b3b0939a133efdbfd"; + plainText = "e52a058528f517c383bb2f291850af82f6658a6960745ed7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 226; + dataLen = 192; + combinedKey = "2e09fbbcab80e8c90697cd3b9cc27ba0a41c2f989c7878d0cfc32ded64c94c70"; + iv = "5bea661e231d4cd4e959b18e871ec21c"; + cipherText = "9e87abf1a4ae74095177f8a7c4888219594c410ec03bfd22"; + plainText = "f9314409f633f878c6636d327112a4b870906b3ea8c46d60"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 227; + dataLen = 192; + combinedKey = "fcc10301330bd4c7dd044b599f0e9502a423998ecd6ce749204ee78511422913"; + iv = "3a271389477a530f87f3f32efac05c15"; + cipherText = "d57018de06f673839c67fc980c971bc12838a9cab02799b5"; + plainText = "f352c5d3a25fb3e98f76becbcbcda70a176fdc9d1d678128"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 228; + dataLen = 192; + combinedKey = "5a78ecf8284ff5ccdaefc707d392ff19352460877dabdd24257b98ef36871c98"; + iv = "1478627ee06cfb615d12e2f35c524216"; + cipherText = "af8d75f1be37173bb286d5006b7a9f405ca53a10fef9e101"; + plainText = "2a40eef5bfa6c7386158550d7fa6f087d3826f63f900ff3c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 229; + dataLen = 192; + combinedKey = "d6e18cab44fd2539a77f2821639d4115e7c9595ab7b1531edcd706f239100ee8"; + iv = "b8808022f3ac4c7e08bf7420c765d343"; + cipherText = "5afef5e1f44998dd5f886516d9a46a254737ecf722b67d5e"; + plainText = "3e9de6158e86ef4badf981923195887b0250db005ee7b0ce"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 230; + dataLen = 192; + combinedKey = "19a168422a6d9635a6e9c4e90fe4341bfa50e0a542fdc4d2ae2fbf3447b85859"; + iv = "0bd5cd33237dcf5266fcbbddfab64a24"; + cipherText = "0b681731984a0e7d0a733670fcb6e9fca9e0bd924ae0db56"; + plainText = "1c064cff0448f17f3af699912b42820b9641f5033172a239"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 231; + dataLen = 192; + combinedKey = "0e5c7c0a384fa33887f3a14e576f89fe5ebadca31a043e25ccd0135a0cc0f6d5"; + iv = "7c669f6b8194a5977a3cc2cff83e8a07"; + cipherText = "d3798da1c1e3650f040ea61c9ede55d5a9e2eb7c2161b62c"; + plainText = "850b5b3d64ac70cf15e5b93579de09f87cb88666a77469fd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 232; + dataLen = 192; + combinedKey = "f5df7c36aa43c2a0754cf8c0fdf71b05b75b3833149f2ad4384dcdab5c379a60"; + iv = "9132c1e346d69bc8dbce42ae549e0212"; + cipherText = "c7fa084761c94b7d0069a5e08c6efd3de83e78b575933427"; + plainText = "0d25210c3e537ac814db2451d80732b971b29c3e265e3adc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 233; + dataLen = 192; + combinedKey = "d18aee6c4c922de9029ea18619f2cf0f0bcdbde76ceb04652b5f1d48ec1f71d6"; + iv = "9be9b4f5be5df98f729a26e101d65e31"; + cipherText = "b9aa24cbec375f66af35a8f703c45e620fa19a5dc09f7996"; + plainText = "f53facb4e5de76b2679521a3288e0dc160b797fb8d6e1917"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 234; + dataLen = 192; + combinedKey = "f4337f3c0cd23c97399bcaf8239e465ab1291b0d9c8efafd6d5ead3933cf3d79"; + iv = "00945540db52cca1ae44e9676ea32921"; + cipherText = "f6cf494908750d87518e78bccc19f9b85cb538d149028b16"; + plainText = "ad346eb800db283fd5dc87cda76e2c9e61c3cdbfb5c19ae4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 235; + dataLen = 192; + combinedKey = "7df720c967a1a33f4c21b267099e15e2b38289921cbf7e51c68debc62863fe2d"; + iv = "ca6948001c2273dfaf8273be8f44c587"; + cipherText = "d42dcc781dc0c2433c62b4f82ce286c7539a9686cd660877"; + plainText = "6c753ea2b9b96a9ca0b1d85138f8f6d4a1447c9d64a5cfea"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 236; + dataLen = 192; + combinedKey = "4bc1ae52f284e9dab4783949bfe2147d2cf6ca16cb244bddaf50bb0db5f93aaf"; + iv = "b274395b354f14451c42cad075b52547"; + cipherText = "40a655c99f0668131716047e20ef7ff825786eba902d5535"; + plainText = "266b58d675b9d34051f34155bf5366f0119fe1db589ffab5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 237; + dataLen = 192; + combinedKey = "c545f892e1119dd8264edeee9f8b6a869ebc5908954df37354e81aa2f1c1f7c0"; + iv = "c970beffd28ba86519f4709444fd7b22"; + cipherText = "4c6da9cf6dec8f21e7b83780dc5b6164dde9f2916d8dd89d"; + plainText = "254f2be7209fbcc428c0da9a9075109dc5bacded625d3109"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 238; + dataLen = 192; + combinedKey = "04eef3d3fb8d258a54c5053800c4811fb260f1fd7c38fe2421d09c01b91c8c62"; + iv = "2dbab7e04ec4ced492ad2f6725b85b04"; + cipherText = "6bec13704f0602f0077ef189864208b011cb9a3279e30fe0"; + plainText = "cd1b9aaf4612fcf48d284b67f5f83cb4ed52b4378a4f675b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 239; + dataLen = 192; + combinedKey = "2f950196bb190ca97dab458c2f1674e59eaf8f4f75634e9b1daa7373c45794ca"; + iv = "c37858b04bb23ec911c5b735838daece"; + cipherText = "fe26cdbeda67dfa728a555f01c2656ca2cab449cc4f23e8a"; + plainText = "d3b09af91cb70a2a43e31eaf82577b0b85ae87aa717ccce9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 240; + dataLen = 192; + combinedKey = "cacaec051f95a7c4e36dfebdb6e82e6cf8795fc22a11693d0a8a1888a1044e1f"; + iv = "9c261063c5d09841e588f39921147ef6"; + cipherText = "50726a85d6f0ca268d31b9d1c8fc6c018e0820996f390d64"; + plainText = "98b57900106916f455f214a5fc8ed2430082edf8098db385"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 241; + dataLen = 192; + combinedKey = "43a9191ade36d59bf18802c17a20e65ad51319c1e83c2568f9482b13e64cdc12"; + iv = "3985a633b344de5073d9a7c175f07664"; + cipherText = "44a775f3c3cadecc8b59b35628e5bae002c63720ba51cae2"; + plainText = "b2cc4d1ce682d355f8dae9b82368df138a8230b3fa163e04"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 242; + dataLen = 192; + combinedKey = "92778b45c8959b8ab21ed47cffb1155e59f4c9b07e850a1848fc9720a0a5d296"; + iv = "7c6ec0a8593591213195f51731525467"; + cipherText = "6001c5c20b5904f8f3f411867bef18be681273aaa7ed71d3"; + plainText = "eb660b12f22105ed2f9a35d1ace168cda9ea5a29493cdb95"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 243; + dataLen = 192; + combinedKey = "1c2d0745b7fb5f0ab0b3939d33828c73d96c0297c3568eaa15e2af008fbd2445"; + iv = "c8e9cc14629de3ebca3ab6154eb954bf"; + cipherText = "55fd57df44b57ed1467fe346ea569df90f73467c74fa5b92"; + plainText = "0eabd66ed2a57751a7437bc2514a4499587d43b5a674111a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 244; + dataLen = 192; + combinedKey = "f1a310530249c9ab1b0f0fc22fda48916a483743f98986f58c1bb394cf011317"; + iv = "887bb0e8019bb2d94845d6dd6654a111"; + cipherText = "b0b96ef52b2de944223cdd67cfe88f25f9439fbf74c0feb7"; + plainText = "4898415890ed58ffebaac11a77aa4131f5d4f2ef2cc53e89"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 245; + dataLen = 192; + combinedKey = "42f42af2af3a7bef1d659b9b98621c570c40b455bdfb2488cbc3e43e2e5d8746"; + iv = "82f843af20b9c1b41734ce81546d2d91"; + cipherText = "e7ffde5eddce1cd4198f920abc150ad31f7ca43a553cffdf"; + plainText = "06e569fad67663648c73fc0a32b011733b0720199bdd699e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 246; + dataLen = 192; + combinedKey = "78bb511b69f34547cc4ed24b61aa36e11068f64ecb838b675bc47cc950d86f48"; + iv = "f8386166321ab37e82b52accd718c588"; + cipherText = "0e0a079c0bfc2013ccca26e62289d88ae27fe1d81e79f819"; + plainText = "8559b133f68dcd86802d57525482b0a8e6005f3f7496be9e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 247; + dataLen = 192; + combinedKey = "dc5b217fb7c25383a2f03b7e565b552e38e66db51664e7403874f46378f5a662"; + iv = "c0d0938a0b16bc4e9ccb1aff6e9966a8"; + cipherText = "40e898e3184fbdabbeb20890e9ce95837a9b67d7356c8b20"; + plainText = "09cb6973b8bdcedfa3fcf35d0bee7c32d16d08111938caf7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 248; + dataLen = 192; + combinedKey = "37179c0d92764a913480e0d53a7825181953603b26561c31f736e93846454670"; + iv = "a2c95a2863220c18a40cd56e7f78ceab"; + cipherText = "ea22c0666ff1faff1cbfd10abea78cc8d0f3fb9a9a6482c6"; + plainText = "99f90218cd547e659a61e9335dbde18ef70bcd04422f966a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 249; + dataLen = 192; + combinedKey = "856e5aa0a6dd055afadcbc5d10dc0d453fd8c0cbc54fc9c3e2c2b61928b798c1"; + iv = "6ec307371052c5b1b4497b285b21b747"; + cipherText = "99bf7d9d8c14cbbe40da985bea19ffac56686dbbd13ed03c"; + plainText = "fff6ae06631004dc6feb0e52ea3ae00ee5e2a8ec4e5d39a1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 250; + dataLen = 192; + combinedKey = "dbf9911d271a2a1542f5bbadeb571bb5e5ad99a19611161b992e598649c9ee04"; + iv = "e3b5ec8e45c6eea261a3fbff7f7ff7cf"; + cipherText = "c90f8656bcb48d9bd9cbd4b3aae38e6dea673fffe2feee49"; + plainText = "286cb853533920f3d7379ae11a3e5ada23f670c81dc859b1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 251; + dataLen = 192; + combinedKey = "3c6539f385db825be41043258f6eeaf7ac7f4908999827b1664cc58c8f6fb4ca"; + iv = "54a9863f9553e84bb6821df71c25798d"; + cipherText = "cef73e9b6d063c90d030f50ab48368dc9c8519e492774b1b"; + plainText = "1b23fb980036b6f566dd4db2debddf6257400de0087f1b33"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 252; + dataLen = 192; + combinedKey = "506f93545d1c81faefd57b18cb9c95fbb502f3afeb098cc55f5a8027d7d5fe8c"; + iv = "7031715008661093a4e5b7e8cf5dc393"; + cipherText = "833f6f65c8b76e495b012392db993b3c1202cabf0c90d548"; + plainText = "de10773dd5e352b4fdb76434154ea167ef946add19265015"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 253; + dataLen = 192; + combinedKey = "2d9c4c89acfb1f88528df9227e2fc51adb27ba345e0438b2c9821b981cfcfac5"; + iv = "a8042cb86ca51dcee1e2c6b239c72637"; + cipherText = "bccd74df15590f5a5504185a97f05d56fe618493bfe103c4"; + plainText = "814d8e3fdbf096ef0df5fa632d18cfbbbea939207232ffc3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 254; + dataLen = 192; + combinedKey = "c6e1c64b5bb778abb80bc40343f712f633ad4a562730fbdaaa20f85713ddb4ba"; + iv = "52d99b089aada7e51a6de7d6c4a52b15"; + cipherText = "7cdd89b32160d75a078a40403f2b1c92ed854a353c4a0266"; + plainText = "00477a06522cad6b79efd7186eaacbc3bf2b2612ca42ddf5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 255; + dataLen = 192; + combinedKey = "22ad05f2c2cc63ac85f20b3083e014a8394e2b2294004ca847ddea2d95f32447"; + iv = "9d7aa7e1e1c6279b13a9b23bbcb9d6bf"; + cipherText = "aabbf784e41c0c88752e37cfcc6d0be9344ff0faf783528f"; + plainText = "9c357d6f471aeea88a08ca4a0add2e15bfa8b7c088f1c74e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 256; + dataLen = 192; + combinedKey = "c0823428d658cd7a91611e14e066d5ad6f0afac02d385e1d15751301e8b70209"; + iv = "0f1b9112ccdcbc77ff9c8a71f33bd206"; + cipherText = "e797ea64a27866d6c57cd6eafaa0a5551a26d52fa73847b6"; + plainText = "148a148418e65f782a3bdd7216d4268dec835ca5ef7f0475"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 257; + dataLen = 192; + combinedKey = "bebfbabe51b549df2dbe119e5028bea7fbced030925eb1b67844081587d3d128"; + iv = "fc960cad2edf36aea23dfdf850848e73"; + cipherText = "095e21cfff97f2734dea0de39dfb76b6b65cec9da516d135"; + plainText = "e6d43c497c45b38e9e7e31c4ea1f097ed048d438e73e0fc8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 258; + dataLen = 192; + combinedKey = "e6f9d5c3d38b9706f43414d2cf921f043d2e46c50c751aff983d32640267f680"; + iv = "a092c52d6b04b1a326252addf0ddf156"; + cipherText = "0cf63270cbf86d3351f2c30b197de522e782bdfc06f1e29e"; + plainText = "cf8f35dc290578c0d49a89ce39c67856a522a81a697177b9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 259; + dataLen = 192; + combinedKey = "33cd832ec2f51643490442b8d5ad4a24d42a78129c30e634e517417967b7917d"; + iv = "d6f3990e1725873b66a1f61aa8ae3aa7"; + cipherText = "3fe3bd9606394007bbda7825991253bfffd6953ea630b449"; + plainText = "59f6a782ce2a52987cde47961c27d4fdd91e691d0b263e04"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 260; + dataLen = 192; + combinedKey = "3b6af083a86066303c5343fd6263ef8c86665ebc0a9f2f9ea6f0d33cf4fcaf22"; + iv = "ac6f4174022a04ea8c8807f2b2a5d5f6"; + cipherText = "b35b67f6929c29cc6e01e4f2fec50ef85b988550a4b1c2f6"; + plainText = "ba98718e2db244235e9b02b6937ac07e08806322e9dc2e8d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 261; + dataLen = 192; + combinedKey = "b18e73a4ffcd0ea9c37dfe9c5d261aaabca3a62ed8a6a327e1982067da2016ab"; + iv = "e4344bffcb34ef91bc0c01f0e966a12d"; + cipherText = "d15a6cee8b071079d8ceeebfc5390f6dfda6435fdf7a2e20"; + plainText = "b3c99c099d4b7dee3163cc5ef76b5424c0d574f7ddd5ac0c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 262; + dataLen = 192; + combinedKey = "f021915b3047ded9a662db5a3df4a96e522a672ad2bc12b1fbfb6926e6872df4"; + iv = "8dbcf8f2eb311de320481766b2f7abf0"; + cipherText = "27a9266024a46c7f49af9db030d340bcabb4cbd751521e16"; + plainText = "4ba8050a53fb9c0c30a6312edb0a771cbdf6c4947b4fa186"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 263; + dataLen = 192; + combinedKey = "8e672b1d706266ecee52427826b6ac5ea7974f8fdd748640482d4beb2d7827eb"; + iv = "6f1f207a6ebdc885b908d0dc05241391"; + cipherText = "8bf44fea0006587899af41a95951afb5816c69fc9e9f1104"; + plainText = "576f6f30962d0603442b448bd092a97f7f2cb7d49f13ef74"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 264; + dataLen = 192; + combinedKey = "25f18bb1cc6c3b253ccdeef499d324438078518d93e7d78bc21b0925dabceba0"; + iv = "057be1fdad15d66e95434227a25fd1d3"; + cipherText = "8c28ba992d7bcb4a1757ff44a17754daa08c5aa99cbef8a7"; + plainText = "4af6742586ff69a5e470f0eaeae054726e0afa6bf6a1291f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 265; + dataLen = 192; + combinedKey = "05604be5a0d856c825190c24199eed707a6f56a7546becbd4002e4681772db55"; + iv = "4cc1847c96f9b4a23cc88d03bef691b7"; + cipherText = "cd350f1a27d82b69a28522f72d93eb629c2a7ad5b330283d"; + plainText = "1c210d54daddd673c3e26843085184a22d48f63103f135a0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 266; + dataLen = 192; + combinedKey = "b7282d5a5dc6ddb6b1fb412cdbcd2bf2344d3d83d3942dcf029043ec3b49e583"; + iv = "346e63977068b94be364d03ec221ba56"; + cipherText = "639faead01efbc42491837c947930d0d4e7c515e3c918a72"; + plainText = "e23444f9c1d94209ae914630481e7669a2b6eedb8a37ce9d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 267; + dataLen = 192; + combinedKey = "1f53e3737ccc9733d314201d794c39cb3fff8fb05e972a684fb3d2fa41209d06"; + iv = "9318bdbf25f7f97542ff0330ed299daa"; + cipherText = "8f71acecf0859280ad385bff0f1b615199ecc56be832ea14"; + plainText = "1a8643c7808e37ef7bd403d00342d6941f8f35ab26f196bb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 268; + dataLen = 192; + combinedKey = "4ab37e0e3ea876b86dbd21c7a19e019e144812a103e341e83ace81376542f1d2"; + iv = "8629a70eff99f3ba7e7f13abf434aeea"; + cipherText = "4b55b90dccf8905a4e5d4f6231984345c6311125d527b7ba"; + plainText = "04a7e41ccbcf467ef71a825fd7e6bb29ae535fdec10fadbc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 269; + dataLen = 192; + combinedKey = "ab2c68c3ac2763d1a2efda6d8259d4a376d67ba9a9c14a349185071c7a9bfd24"; + iv = "13ce994afdc6500f462a29b0f0f46bfd"; + cipherText = "dd0075b1b26f86e4592b08015f552caba558453492676750"; + plainText = "2ecb4f7ed8e126d65018483eb61753c894e79a0d8c1a78cf"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 270; + dataLen = 192; + combinedKey = "4319783ecc1e62b31da7eb15be41531fd322d66b1273a36e4112ac641590327f"; + iv = "d9da589806ec6793be675ec7061506a6"; + cipherText = "6b835e14371e0be2f7087877fc207d18f51d1bbbb33b78ea"; + plainText = "6a21d529f384fcd572b264fae57efa8710ac79cb01d87051"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 271; + dataLen = 192; + combinedKey = "a6d00774b77baaf33bbb771af277d350fcac3c1dfdb7d95b41cf1fee6f1c2005"; + iv = "d22b3c9809b3fa82e04891c628fb5d37"; + cipherText = "ad3a6eefc8e35bdc29c43cd956a11115d282d4a9562fc4dc"; + plainText = "ecae03c6709c405f04ceefbac46c774f99a05d4fb8176ada"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 272; + dataLen = 192; + combinedKey = "b93ef4998b8cdb33bf10819d1c9b169ddc58ae667cd164fab6b3a10bc695f7a2"; + iv = "f35dcd480274e972936ad7e96cf5b0a4"; + cipherText = "336d6d52cad7ce8ad6fba95ff4ab0448cc35d4b0a0c145fa"; + plainText = "77e8795efb97196e25f0b974a6d4d4f3bacd70aebb55eab8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 273; + dataLen = 192; + combinedKey = "2ef6ada69142746480e41d5c8493954f36856c6b4716c9372e009d78073d35d8"; + iv = "6d5226ff52d960c66f01b1c3891c49f9"; + cipherText = "4a1badc3e5db6bdd565cf06fe4283c92378bfbfa7510a644"; + plainText = "fbbbb4f0714c0e133e1a7283412ecefd3e6c990ac2b89259"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 274; + dataLen = 192; + combinedKey = "526bb360150a589ea0c78e3c5025763cfbf0d02d06d5fffdb21da24e3d63a0da"; + iv = "875bb9f444f5ebab3b7b7c3b076eb399"; + cipherText = "ddc2528026201652c98af5dee00ae1ae734cf53f26f71d25"; + plainText = "ca62f0b494926b4d2b527a766c3caf2c172614a95075d716"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 275; + dataLen = 192; + combinedKey = "6b4d093bf308c5699e8abbb2c9f8e302d71e66cc5016294115a4957246139afc"; + iv = "2a9ee71e5371293e7e891d8263c54bd3"; + cipherText = "4964d7464b4915d846b42e2d2a6cee9969ef5ca745e3ef2b"; + plainText = "9b9fc0c619eec605fb7dea62312cddbdef47618998999edb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 276; + dataLen = 192; + combinedKey = "3a25e50653f6b3c984f6626774e1ef8baa76ec4d88788fd1e34301a3779546d8"; + iv = "e3a11fc57cff9f098d54eb1f57f35328"; + cipherText = "6c94d84a1de1081a5334bcfa9e3b4a91b65b5c3ed5140d5c"; + plainText = "4821b000575b91c9217113a2ac1a68f10fdea52026b3ea3b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 277; + dataLen = 192; + combinedKey = "3c2261a5c8d6f3af03d49493860ea27ccceda8e8ef1cf0e6f02db08c6b533f5a"; + iv = "d7dbae835e5964861ca09f6741afd19a"; + cipherText = "9839972e4706f9beaec7ad67eb32a4bc0a6f7f95c88d07c2"; + plainText = "8707a1ba88df08a0e66635c1256478a8bef7660d0e6d6e29"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 278; + dataLen = 192; + combinedKey = "5bb878f9dac5cabd8165707aefdca901bd5ee221f315c225578fe53f21406f60"; + iv = "1a63d98e8d41309dd23e4d4ffd82c08f"; + cipherText = "a8fe6a1ca14a21661acd6440f78a155e93c68d290b19ed59"; + plainText = "50de80ee005e6c965bc0f4e06992fa7412ebdec7bce0b4ad"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 279; + dataLen = 192; + combinedKey = "8fe2bade3d6a3be15def160d78716e1e2b5384ab524437343341b7c49b09e503"; + iv = "7b9fbd958b0a4ebaac966b05de9de33c"; + cipherText = "b8e07dcecdb738fcd01eec36389e05eb581f800005ce7277"; + plainText = "60dbdf61fd4e8c39cecf2d4567dcbe906215bb4ac55f340d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 280; + dataLen = 192; + combinedKey = "bf908df02fbd434b64f6a2a06905f2c50b585bfbcc9869259137a015cb4ff0fe"; + iv = "a5971fb40dbdbc72dd4584ab2226b5b8"; + cipherText = "6aaed421014cf4fb0eaffa1a73e9ffa03202145e1349d8e4"; + plainText = "299771630de17bc6ca5b4a11b52c4e2a9211f3d48317cfc2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 281; + dataLen = 192; + combinedKey = "795f194094d6313a3096df84652f4997e4bc2e5dcfadc48db2df0e1d9d83794d"; + iv = "859d13fe4589c239e7a9c941581b9a86"; + cipherText = "0d20326d0d42dbb94a82e0f2227e013d7baa927fd6fead02"; + plainText = "f9ee01b670413e68561be53381b12ba0331c951d35320a3b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 282; + dataLen = 192; + combinedKey = "53dc82c517ee150447e4b8e4aae03c944a7f526ca7eaa46b0c6286edeea0b823"; + iv = "f6882d687f62f9469681025cb3393aff"; + cipherText = "f5026e6b88870cf63cef54039f8cfab79f38197bcb3d4400"; + plainText = "6eab0616182d1814d3664f4a6d08aeba7f9994dcf7393efb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 283; + dataLen = 192; + combinedKey = "8b7eeeb7a8174106c6b722bae9c15b6c02522b1002e4319c75b53cb3fbe4b2c9"; + iv = "56e3d925a3eb658c40d45a720737f521"; + cipherText = "400d7265bef4847a4f22799a4eddbd03a9ba853774009b32"; + plainText = "6110bb87f2c04fe3a6a27f72d69f4da7e1d59e3f3a41776a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 284; + dataLen = 192; + combinedKey = "50c967f2a28b9b8731caee3e3cd541804027aac598bdfe5d942aaa9b5ceed77c"; + iv = "1d69becf315931c19ce07e98e1213490"; + cipherText = "cfd1b4810ac8e1007e562490cc54d112af44880ff11d2607"; + plainText = "3b41ef3643412ce78d8f48a389458704c9921a4e426ad101"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 285; + dataLen = 192; + combinedKey = "81803f16b11117fe795391d257913ffa15ee6d7c7d7ad0ec220b87b0d3985c84"; + iv = "263fd129a2280686c7d020b8c362b579"; + cipherText = "80fa8d368ac6b54aa8fc7b02c4f47478e0731c130e0f67b7"; + plainText = "c677bc916b9b4918fea99fa323d855d2fe9c8554fa2ae6f0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 286; + dataLen = 192; + combinedKey = "d46717db33a711c0f83dce005a81119b256f18eb40ed386a1324ee0d045ee218"; + iv = "72fd3a84c389a7b6a7964857f0d27909"; + cipherText = "ae62f9d79da3c125d3cf129dfb9a24d0775396453a3d114e"; + plainText = "314b52cb70fc08b6e00e3329b423ab8220f4abe97a8ec66b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 287; + dataLen = 192; + combinedKey = "b874a4b4e1c89318a1378f252201e6071ac1f29cc51bdd0cf07e3837dba3b599"; + iv = "d4f2c48d2e6d2784e4553338a9a116ae"; + cipherText = "8a4b5fb8213d4fa10d880a6beca0fe02c222b18e36016098"; + plainText = "f62ad113c5119e362d9cd0c3db311f861c21306206b43105"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 288; + dataLen = 192; + combinedKey = "cdb34ebd3237a0f6a8f6fe8f597d096f40b28ff91537d8ec5b3028fccafc751e"; + iv = "cfe5ecd6cfdd68c6232dd507cc675c89"; + cipherText = "3182b46434a398e0d97bcbd3db0e67ea9eb4c189762c523c"; + plainText = "1c215f425d19bd155350a7b11e42629759d1d179f6924b64"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 289; + dataLen = 192; + combinedKey = "8da4b1757f9df68bb6649d8120a9a8a9e73d4feefc2d4604a197e8c7b7fc96ff"; + iv = "a243617f7975e2bd76a3dc2eac1fb10a"; + cipherText = "25c2899afbfdcbad01bcc6a3c0fd092e5e26d484ba82e043"; + plainText = "f5aba9675c3d634c8f4c25f6a568eb488e8822fd4b1390b5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 290; + dataLen = 192; + combinedKey = "fd9cab477e7da587d87f0140916c31438911e1f0b71559b2138cdc3c214f8f5b"; + iv = "e60797b45543aadccdb15dc4666dc01c"; + cipherText = "d38695569224e856ea32f643538690c2e26c74a12d774d3a"; + plainText = "f7dcdb3f80b938e058951f067b9ecbb952c8d0912eb5f2d0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 291; + dataLen = 192; + combinedKey = "3de3c8398322dc3cc1f2089a3d41deaca4c22f5b07f34619a7c9c6944228aaa7"; + iv = "d835925649886d37e54350e39db941d6"; + cipherText = "6990ac32da156ef05edfec2ece17d76632c007309dbec7f0"; + plainText = "a00a3486f8de88e2d742171ff37eb7faef4358ac3de6d5fc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 292; + dataLen = 192; + combinedKey = "85201be1944dd15245b28ac29667fae1ce4c75f7d87e35ebdc2a99251bc8cdc5"; + iv = "8b22a3c15383c833154c1f5871e72a91"; + cipherText = "5d4f04b881cc35bbcadb0349bc3cdb0c51714972961c0959"; + plainText = "7b58d9117c0462b236d02b0d7d88510eeeeffdd21f1b5c55"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 293; + dataLen = 192; + combinedKey = "3ce73e6e6cc9779e5db3e4186fdfbfcd55be742d0c5348731d18a51352aa555f"; + iv = "6c6e7250869f27dfaa99d2cfff348690"; + cipherText = "efaa81fd7505fffcb3b935c5c5c186daed5593c485b79cd4"; + plainText = "4e56c9a161dbf153d8fab1aae1a47f2de701fa1e4c4a022a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 294; + dataLen = 192; + combinedKey = "b0dcc402fada69896e4695b9e8099d78a33ac610b56e789a769c84fa3edc6168"; + iv = "5b8a86f776218a55ab82b72c4d3b298a"; + cipherText = "cf8b9adb920b412765d92912805e0a6288fbd898a7e74815"; + plainText = "e5bc70cc2cd0084c2c5fece9dcf7256bfcd0dec3d0ad17cb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 295; + dataLen = 192; + combinedKey = "2e025dbed06870b25f584705c71ef8a0acfd5efb83cb1af14cfe396325cfeda9"; + iv = "8375d05b66cee52a7da31135e086c4d5"; + cipherText = "bda725302abf13a0c478f0a9053a904cc02aacfeac74afc3"; + plainText = "8d923510a8db3db577c20054f03520db6f6c834f39077a1e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 296; + dataLen = 192; + combinedKey = "8be81b4cc24125e8f9f061abbd9524fae28c15504a9c2e74b605df23c3b74e2d"; + iv = "f842f8de268e27d6f16ba9d83cc79ecd"; + cipherText = "5af7fd98966967ef68b0df75f0a08f1efe91b0656263eb70"; + plainText = "05a953528696013cea5076908ad754a16be9bca565290190"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 297; + dataLen = 192; + combinedKey = "3dbf8db94912fbc2ad7154cf27ae417d414cf15d7b288370e967f8c2e13e6a89"; + iv = "495c1427487676c45b9b55b21e63953d"; + cipherText = "b58101f5d6ded0391409e6bd56d2d851b66e4c54d241d32c"; + plainText = "12b828f0f4554ef7d730f69b89b0bf048d83c475c525a44e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 298; + dataLen = 192; + combinedKey = "f061c5333c3b8a50586bb14f0fe3eee3bed44fbb4fefd4c0708c745be296e0bb"; + iv = "a992611806407b927de9607e8af35973"; + cipherText = "a5dd2cb2f2f88da6c6d733158861275da9f2e7602c1059d9"; + plainText = "837a76efc7fa2764e31839fdc0918c4d66bd65662e041066"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 299; + dataLen = 192; + combinedKey = "5c850ebada3491074a4a2c66e9c07ab1e045ec46a1302b38cba0bf5b783fd3e3"; + iv = "ab8c31d1e3eebb17216386c68f12db8c"; + cipherText = "eba7c9532843f94077711f80620f9be4c408b0fbf592cf88"; + plainText = "3179cfa3983a0ba0881926f60eab26cfe0606d536c0e62c6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 300; + dataLen = 192; + combinedKey = "aa30a1cd55cee59d725e92454f2a60ad311b0a84c21052fff288ef1111bd46e0"; + iv = "5952b74c1516d2e18cc2c66c81a82b7e"; + cipherText = "5931a9cafd4a99efd1e1add98f97a6a797ec360c8dccd34e"; + plainText = "95179e8bbd1c532e90c768f12975027ce3715d830de6002a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 301; + dataLen = 576; + combinedKey = "bcf42fb904c73bc69001aa68cac17057151c2a17127a2b0a7b5eefb7788c9998"; + iv = "5b06a729f8e7f0e7bf10cd505f37894c"; + cipherText = "329312ed259daf871a80bb617d788496ae4f9f6014fa2956d8fcaf5ebb1bb4c6cfa3a789cbb03272018b70d802282e84c023860bbe570bb4a2f85f3f57fe2ec0c5367a6256b40e8b"; + plainText = "f599ddeffd6743cfa0fafdd219007d926e1e165131e98e54bb049dfcf7b752911b059a415e6dc151630141424eaf41ef6e5cf0c68f65604b27f58e743ff5a83ec037bfdf931b575e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 302; + dataLen = 576; + combinedKey = "77ea2981e2a36a0453d4262a03b5f386018f8045e5814f24987f53ede7673427"; + iv = "2d0b2b82176700ce9b87e8932b41730a"; + cipherText = "41371eb8843db8f78bc7063d4f3d9010d3b8684c510574291b359b35e8d059c733d7780726770a4549feb874915d1d75390c7646689d99be99555903e568c1b1f77c101ff81ab756"; + plainText = "6f48c6f5edfc08d666fa7b6e226e1619a4b8b1b5a5552d4fae9dab207e28c67a2c5c7c3fbafa1f8dfaa4f58f32f4dfdebe68e258a39ae61ee3c647ab22c21c091bf7a913c48d6802"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 303; + dataLen = 576; + combinedKey = "e929edf18d457a59c3a3315733b02b0bfd76921fb11f39109688659f8029616a"; + iv = "2a6bf2be5e5c009e318cfadaf130689a"; + cipherText = "76e179b3ef398020ba3579bd000e5c3d65a62c8964778203e77d5f64954f6933e2af5dc100cd72c9c4f810265ba6d543d8658a1e721639f2615c46cff90a682bfafd14513e43fc58"; + plainText = "387e19aa685c6c4469b0260f03ff80853525d036a26fc3c68a678dd49c70a2c251edfb94dbcdc6e810fdae4159ccad49b43d09a22c16f021369c526b1ada0f4a3c5b3943324adf24"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 304; + dataLen = 576; + combinedKey = "0f4896fe264b57fb7d28265eb12cf01227dbe5ccf96085b022c7caa1c38a29e2"; + iv = "8e771908edcacf29b7d135a145ecf1f8"; + cipherText = "35ad466405071005400688897222cb7d3bc63d6b120559ec936cbf3e745928048c7ca815a7f051548d1f78e7a47e31fea7e88bf8ec8278bc76f20aedd9be3318d6852a7f7a5b2483"; + plainText = "350228b649cdb6e4c79681f92ffd2d702747b2714b959b7851f02ad2b71d8c2d4d7ab861e347af5ba4483cef6dc57ff981de6e90b24d01fd694d722fe7ee2c727aee2a00c081b1a3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 305; + dataLen = 576; + combinedKey = "c9d027b3762ddc063d0d19968cdaa28a4b73a140bab5a991133e2ebdad53b23e"; + iv = "a0b55d83accbedf9977cd1d73689c1ca"; + cipherText = "fc28e6e172c6f4528746429634db328a3a7376f3bef73228c5578a8135de61986e165f2d63ef2a73e7759a008b403eab71be5aee213d8cb6b38d2c95f6e9191bbb8000162f948c9f"; + plainText = "931d74b14304b7b1c3b5dc4033a24782ec14e08b107c1220f88f42a13a3d3dca7fa429635e71abe39dabb646d3ad121eea5989de79771cd61ad1f58227adc25cd5d4700d073646b0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 306; + dataLen = 576; + combinedKey = "8b23704b4b330fc9cc3934d4d993e88e6ad934da7d34a0b724dd1f8ded11e04f"; + iv = "a3cda7a6faa3ee0353db67548bef80d6"; + cipherText = "09403676929cf4cb52f5e2f7374a975182f10e2ebb1cebfa0e4d2f93ff5cd7d7c63c332361af48c69bd7d047b12cb192cf52b7b723e2c245188f4855cee23e7dd19640b8c658e599"; + plainText = "658e5227436713dda77295d31e6b09bf49a4cbdfbcb946ef7742e3d847827b5a5d4fe3e1ebc7f8cd2064af82b185186f7439c07832b38f8fbee4a331cd5e3e7a98d0440d80d32a42"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 307; + dataLen = 576; + combinedKey = "bccdd0d3abb476a932a5eb0d3cb18929d2ffaf5ff6aa27036e9329c3044f7518"; + iv = "9a742db1db3583e45a21cbfa824f51d5"; + cipherText = "471eaa265f9b0645665bb4cfb1c8c4edc31a329f102869e71ee5e82aea0238f5618301fac2ad0bd5bd31299c9e981bb5262dedd640a6451c438243223c3668cb44f3973f0d286793"; + plainText = "6ce12ba0973c798606e74f0155169423189dc79aef91ad534425fd4353b3c1dea154b1d58f48de2a6bc2bac3da483934319a380dee5e7b18d7b84a525717e2900c28cedad47479b2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 308; + dataLen = 576; + combinedKey = "ef75c1adea471dcf8cadec5ab88f764aad7d9acd24c42b60edd5e33c1d2c823b"; + iv = "818c9a65126be4d024a31945db64292c"; + cipherText = "3a9ebad7f73e9fbcf7527c04b6d0261f8efafc2e313e9c951843219b4484920f637eaa16aeea2bcebdb3a4f53f53bce8dfc67cccd941a8c037149a9467a7c58e36e44e3da7b8d566"; + plainText = "78427450f9a5c3d08e6755f69125820bae11e0ae734248a9c3bcc7b63ec79d481d5cc7ab25e420ec2447b1560eadb95909624de8e4993c06256be0ac262d15b889797c79bc96c80a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 309; + dataLen = 576; + combinedKey = "987ff0d9ead572bb969edeb0d2449639828facd94cbb8a7c88f2815b491f5e74"; + iv = "cd6f1e7bc89c6e173a4e84b63d5b381b"; + cipherText = "180022a51f3208f39fefff06965f6e9e6425d9ab251d83751b70753b7ad76aa6b5f8e435097a58fbad171054197c9c1527b664def4020897d8161a39d9b4fdaccd7e56b457beeeea"; + plainText = "c4cbc6ca953a09814c220d95d68267ffd6e3c14e84dd7f637f48afcd1a8fd7dfb56c1ccf26887eb794a19e7186c17028d0f7fb50982a031cf46813122c8fc6e064a550b993e43376"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 310; + dataLen = 576; + combinedKey = "30790c9dfeafa4eefb0f3d261fef5b963c9d88ce55766dfbc29403aea8b76c4e"; + iv = "24eefb2590c5860b4cc5205b07d6ae77"; + cipherText = "9f67126914bb26d677652710a9d404b7c7ebffe06f0e742029dbe6c6b2f05da7892b265c0286be400698b5d91bfab6efe67c6bd4e9d89e4ed2dcb71f5c3ff822fdd5176a5a31bcb1"; + plainText = "967b392d23dffb144e33e7ef791dd3438604eeefd87b613260ae219b07d773e3632c9dd017276e7cbe2c1e7827c2f28e2f4811cd825f434a0e2defa762379bce49356139a5e81822"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 311; + dataLen = 576; + combinedKey = "0dafc7fdb1814bd861724164baaa5d8843c9d8b7e9c895fb81c57319d5bad32e"; + iv = "a3afc7df23facf928958504ff985c8d8"; + cipherText = "055936d43399b6b0fcacb10c5cafa2e72cc8d109fdce1c4e3ffe80e47ffee5af7a2477e3f3bb991ef7896fcf46154e1f19fa30c780060624d423440533de41b8e6303b20e5387a4b"; + plainText = "e1f4c55fbd480ed648f31da9649061ad318d95920f0c6913fde69208702037e02eb0073d3ffd84998570c2631059e12ab62252aa7befcc66035941e89d5ec3882e5c162d987bdb5c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 312; + dataLen = 576; + combinedKey = "922246584dcc4f39a3c285fccbf8e5ddc6d029c69af77f88615663dc50efffe0"; + iv = "9320bf151ec21b8a8c76da7d544fb456"; + cipherText = "ee844134097c2787e2d12f65e63909f464b8471569947a22e0ea814b96b22e7c42e971803c256120f6121054c7d926de9e717ea69d48a951d64396169318f575787b1f6392f31fe4"; + plainText = "f3534512f03438b8c9e1a2abe65b8c4be8a66d899541e45a8ba9a663bfa21ecbfd12ff7bf29c358ab4015d6dba2a33502d6cafdacf425a865c547efe34ae3d30d872fc14107c52a1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 313; + dataLen = 576; + combinedKey = "74cb0bc610ed5c8bce1f67aac0589d4ff08d88928ed1400d62c4fab975b60172"; + iv = "209f05f227954594c6851bb7fd36cd5d"; + cipherText = "472687bd8e3ba91c5a5ff6225606adc417bdacdebfdc3aa1dda084aeb1a4af845c5250e70ae0faa272defb819f76b0aa17ed3adf9ca1f8ab4c867f0dda0195d4ef8873485d31bece"; + plainText = "5e47e7fe500c034b06325bebeeacf7c33bcf5b626af6c669bc94ef2fa13e09a57e24a1f85d82a7172acf9b6577fbb3904093bbb8f9e6838af04264fc4d39f5e0198aa155818861aa"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 314; + dataLen = 576; + combinedKey = "c2a844a8df93f8e3342682b4a7849f720cc43cbf92ef4f743ed11c8820248def"; + iv = "a0235eba43d8cdeafb5e2590285f14bf"; + cipherText = "2db824bce5ee05a7e62fbe1bca3d3b5e5771a9f247ee1a570f3a0efa2419069c4d8ddccc927e85b0c05dfa99efdff618394d817bd4ec09c9373ffc56a24220fa20385a34c6131689"; + plainText = "b7045bc70cffc7df5776f0130d5e779a3f4fdcc01c55874e1c2080458c0661a299dc6e039b2ed438d4b4c133eeb70be2a7610984d1e5bfa3c2be7e46f0144fab177e5944bf1ba062"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 315; + dataLen = 576; + combinedKey = "f4cd29ade21ed77a9eb4038377cd5f382abdb823ece445d4d5783061ca3e4114"; + iv = "5b8aa5f68fb10843f18e458ae67fbd3f"; + cipherText = "b006b51ce0d8474289bc14793fb0092026b71d5f16355ac54d995b1adeba927a35c65f85e3ea11fac433e13b2dc207d0ee6804f6062f793c0fa4198faa5558c60530fd6ba0d34d71"; + plainText = "1eedf0f151e604a80dd381825b06818b52e49e4516c358400a28ab960f6f1724ad85ec51714918db741327b9e1ad3041028b6fa5f7a01f998dc37295a696a95360f13e39575fa26c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 316; + dataLen = 576; + combinedKey = "6129a41b7c242b0ea263b469b5b78f1922674c5b64f16979225530e3882fe657"; + iv = "58b13c78609738bd451a77bf07d021d8"; + cipherText = "aec0dbfa8c1ce986d0e57bb4ea6b7004ca69ab22aa9f4782aba18c65a311533b2d6bc56daf2d891531eea6465074a53e58e897c0cbf2de1b691f70e07b39af2f197b5100a0d9a9dd"; + plainText = "0862b6098761d9843850837dccf11b0e86f5c466ebc3524b86ddfd9ee79e1cb5ab793c91d5ed59def3a28fddb76da9f306625d0419e4caa54da33781ca1ea6ce5ab32010af5f1158"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 317; + dataLen = 576; + combinedKey = "c401cbb2f5135de6266f0504a6d8bed99ff905e07f8630c112eb21badd2535d1"; + iv = "7231e28c8e371c799408e18b1da8250a"; + cipherText = "d5f78d7bd717e3504ae5d8bff6aba1a78a9e211359402d0ffa4e49d369769fef09c147b49fd6652f6b3fd5165330762ef02f0c1b13dbccadc6ffb7e997b8b5fa0e7bd8c029676856"; + plainText = "68762b8880a9f51a414dd8362a45fea5bd2383057f654c08f86194148b566f7a581371fcaa0d155144a7ed1d215276b11a5800a6b177f7bc7665675814b93527350920c73c536b3c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 318; + dataLen = 576; + combinedKey = "eb0f132a53b50c5e7587924cc267e34b087ef074361aed191db400974e9a1260"; + iv = "cd79046e51d782ddb8d8a2249fd9a052"; + cipherText = "846825caa2880ab8b59f50427962790ef3d6a61b3d1ae2bf9c52255d985f6431104e8efbfa12e138e0adf37face517715c8af74d4452f193381249ce7f3bf0650aec4e396e9f91a3"; + plainText = "cdf48fd5912ed7b1b0e9b45abf4ac6b25cd33ee0e987289a8ee88ae112db3d2ce7521abcca0191f79bde522048a2d76ca9628fa92f9e0b435bcacaff1c826541f4c0b77381d2a55e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 319; + dataLen = 576; + combinedKey = "461f7a2e70ca2c3a810f07f647ea50bed57c526d49e54d5b8372c6b08df61036"; + iv = "46bc8e6c71b5a832ce2bf37547772884"; + cipherText = "a4cf1d9d26d4eaa781cb0c049bdee7e850090130738601e4339a58403699b5663ffb7640812f9ded0e9db3ab31048b08b21e59dd1fd3991f5084b791f81ba60bf3d1338d3ca18068"; + plainText = "5e1a3272f3151a5d888430df32a52ec84cb330ed3c0eec971c6e648aaa83f32a079318c08370f04092992af5b4600d05dc2f757953ade96bf3a3794211a673fd23107cd74f922000"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 320; + dataLen = 576; + combinedKey = "708f3cec902d4009a850f44a56279b85228c7166f446369404bf3c97827f2344"; + iv = "ec7c0b9e337c85a4406ee073ea77e1ec"; + cipherText = "90b74ef194159e6ff81e6d84e2156de4763f8cb876d031dc66150ce260b1b8085c89766dfb02b7bed53de281db2b73e0a957e44648856f0f4e10af0c0ba1dbdb5ec6d5f33eb55e2c"; + plainText = "9ceb02f9e25207dc913d2eee0beacabc29277c68bd2bf8350b52b021e60d58860967198e0afea8d923b59a2febd0197c34eebcd4f71b4b6aed873e675198df902c88e43f7dde3b5d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 321; + dataLen = 576; + combinedKey = "b6f89c093a57ea199a0def1c5c8c70a0316ed35ce046983f1490fbd1801d68de"; + iv = "88bb7332d09af233158dc8d7811e07dd"; + cipherText = "1498ec1e5248763eb5bfce9c29c0699ef5ffad13f90eccfc5092bffd00032551c4368f0b0277ebc8115314619acb8f68e685f478419d1188e4c666046cb3ebcab730cfb2e4f339f5"; + plainText = "d1d2b06218ae7c450943e8f63326230afe8f0d87d96508db9a4ddb771965c22b650a0d9268d3938883e9d470c8cfcdb6f3eaaa8010c45a4aca81f227b0af49d35333f4cdc1c5a78f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 322; + dataLen = 576; + combinedKey = "cfb1cf5c31dec9d063a271af0680ebeaff2e70f0befa4674b93a8e1580d478d2"; + iv = "f7371176e9c06a0aad8355520d52942a"; + cipherText = "96b5a723a8851a90066711a7e8817eae615dfc45088eb4f7ea34d5fb07c88ad5c31f49913b38466550c80a0813dc56ee2dad2139821ba19a12b33a89388cbae825566988d52eac74"; + plainText = "85328a032a648aea45b04523f3a0f370a1904adc503a8c1949c47b6fe08d8af3ad89d9e8fde9445506f5efe180e30fd2f34371c33c346d939e21177ab8bfc7dcba44a75a995c678d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 323; + dataLen = 576; + combinedKey = "9fbd2fb54a9c59649602b8320fb21871b464d209f93e6376e27f1f2fff4c130a"; + iv = "34657fe6a14d4fd51a119cec1e248193"; + cipherText = "01222a1e952a578d35ddb068cd1987ea4022801f59c70103a3671c3798ab7b60fbafedf31b3c24eb1c4dfb3603ff9329039c37ff0d1b9f8aad46a470c297a8e62e58e6c7558ab808"; + plainText = "e298da15aeda25d76fb3524fb289ced3713ba2241d88dd512b2c0c135849cb311390f78fb8210525edd053949367e6914d4f7aff2b282a2a445221aeb6073d2f1b821a0f7201923d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 324; + dataLen = 576; + combinedKey = "0b192489c37be705688424fd1b42df1c231fc8c9b25fea29fb15dab134ae0b7e"; + iv = "6a06aa22da12e1cf0c495b74c795adc5"; + cipherText = "4ed24ce17dc32d2c7de69ac604972264bdc62555d7097229c48c845ca6823e631ceeed20d615d5dffd5f577db16f08964784d8df543f6b43d121911fd7624891da4a16f0ed1e8ebf"; + plainText = "00aba79df02c8ca6bb691bb99dfc2729828c8aaf5b6dd5a480811b8502e4c760960504552d2eb1786871966a6a91cba9611cb8af64760d0f616f23f6f64b94747be6f66742b8920f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 325; + dataLen = 576; + combinedKey = "1c8e490cf9cf800b12de03a9a5c44a23ea14cc273aa435fa9d1e854758babc35"; + iv = "095ce0316952957febfba48e56ac3c64"; + cipherText = "d53b1ab743b1f02704f0170295d7d95f687a9b6ac1a6dde66437345513c7ec106af4b16531cef4f8e879e538781a61ddb3f1fa6270c09fa9a8067865766e55d3e58120e2687d1f78"; + plainText = "33d6de76b76a78b9e8d78358ed84c038eeb818371da66a825a4f7261b6a211ed012505ce606fc87a39a02b462fe6262fc1bee680dec015c0c2f6696b1fb87490ea7224e29fa376e3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 326; + dataLen = 576; + combinedKey = "cd07d899111994023741df55ed3f550b28343259107bf38e17f931e19a201385"; + iv = "ae96cd17a80784170ff557637ad0f35f"; + cipherText = "c8ff167e812db113a1de71fcf4251257e82e248c0a31dc1fde5fe7c526e075787a8ec5b0c6139f7f33144c4ba41c66999fa28a5148bb40ac23edf67416de777f0400893d996bed5f"; + plainText = "374e77db4f145a5329dcb2b5fea69d06d02a51aa6dd6a9f2a3d9ae17aad0dbe5ebbba4be854221d1f51221529c7db2629ac61e57744e4b23f59045720b6021b9fd76f429377b2b80"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 327; + dataLen = 576; + combinedKey = "aa512d7463817dbdea1c27a7dc71d51cf26cba9f9d71b53d81b9e380bf274129"; + iv = "a72a6a5baf35a24a4dc5ce4afe7ff346"; + cipherText = "186f78d0b25650952941963190b81d1d55c2f8ae95e06eb02781f037d8b31c98349ef229c7419ff35a232e5384d68615f78fb604c52813eb7d73b16da50e3282d41f883c173d65ee"; + plainText = "b80665b2170d8e1d8888ca824602e05ed9ab2b23ec398b63941c697b303fdca877d4c30fd0a57a017ea6069d3060b95917fe04d437fd3f497b714481bdade9bc6d21a609162a56a8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 328; + dataLen = 576; + combinedKey = "0b5fa72cc6ee1c72144952698752953187e17743ffd471e558c5207f1db5d1d5"; + iv = "792d2b7143908e1924fe250aa20aae92"; + cipherText = "b4a1baa0eba4d38fae8aaeb37b29cf91d7c29f1b37bbd872c0126711273a2a164480065d79f8bb4c82dd9c18769ece01111662691cfc130146fdc2d277e2889efb095fc9fe05c146"; + plainText = "544a9f53379bfd4ba26b082e738cdf0c9cbb8de4d2fce999e839ba24f1ac536cfb177dd8e28af765345e047d4566eef8a525221709974c869743d1928cbcabcec0b49d160bdc9322"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 329; + dataLen = 576; + combinedKey = "a26cf061bdf852c68c2ce8df58de1c97bbcaac0c2e695ccaa2b12a7a16f32078"; + iv = "4c90cdd79e2b7cf6ad89c4c0ffe4aa76"; + cipherText = "9fa14f9f5e07214d9433f98a7d938d8e77be629e66b078f055a382369b8b1a8773bedc4ffe825902918dc1e88f63d5165662d1c9fb10dfe2e621c1a60a8f486fe898a0fb9c26d019"; + plainText = "20e97f66e0cb78af5f862682bd2a99e90170e309a733cc7254eb4d9785d23df61f6ce814dd5ae74d989f46955c126dd3abe7152f5b31b269df1bc7b338a5a31f978685498182f5a2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 330; + dataLen = 576; + combinedKey = "d8162252b2f2d732987d9bf168dc50bf93eb976c8cc4ce0a1e5c508ca8e99e91"; + iv = "c7ea1ab2e0ab0982127bc325f92b802f"; + cipherText = "fc825e8f5391ce9e40ca4e264f1df5074ccb5b2ebdefad3871b92c6d485095874d1ecfc7693ee33b39e621b905e3ef9084946c690553268a4b37d50eca3cf530d702dab720236653"; + plainText = "0a89a528022a8c71a3205abdb7c48b5231b82f826b599c329f68452b26c83915b68af93d6914cec30a2dd4b9ebf6269578284cb55faa68ae1ff071e9c7e7c00fe7ddcaed7b1811d1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 331; + dataLen = 576; + combinedKey = "76559b79421a91341e97b65717dbcfe7e60dee61cdc40a22b1e1ba60ea617681"; + iv = "ae51e6f0e5e1b67b6fafe8b8d7c1bb5d"; + cipherText = "5984476db6d231de5966220ccd8a7ad07703cbc3524b0db1c6f62e1767b7fb3bd459065396fd05d1e7c58a54c840a5754891f67c37cd7db2a4842a225c0bd6de14b138a6b8a47405"; + plainText = "2199c5447746de3dccc641ca1efe97517671f4e725d3fdd9e20d263d61f38157ac4d37dbd710bafe092848d1425adc9109fc731af9b1ff83db32176ddf2226cbbd5903381c3b3b9f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 332; + dataLen = 576; + combinedKey = "1e6ee76f10f64fa57df128e4abf850a2beae14e909e4565da4312c1ee28379f6"; + iv = "16117f0260fe03569023419384efadd3"; + cipherText = "da56b2088e17524bd9a41463540fac59774611ed168c70e559f8a32e9f78e7efc7c44759c62bef0cc9a1ab35252c5d75ce9d71fb130c15a523be1f71750dac5db9a4f55d93dad925"; + plainText = "940631b7cf794dfdc093427d9b42899cf735ee372f37c0bf200e6260aa1003c0b93578559b35d632b558c52f334aea02ca1960627c8a3dbeff99f06025716ff5fce37a32b4e62ca4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 333; + dataLen = 576; + combinedKey = "6fca6e665f1093e50cf4b3e414b96c42c788aae069b8cf553d8092c2ea5df3a3"; + iv = "5b309c8a242e71f42b203a86b71fa728"; + cipherText = "824ab6e7ce76fd217cd00a9f9de6ee23d8fc3c9b4ab62c1798c02241f6b857624b361deb9ed458ce507838d9d14cb55d7084129b8be3198d5881fae8887e5b5b35a3e4a2932b1f62"; + plainText = "ede565bda675340d2247826c38676e6eb127a05f91a2851244c89cc72f1b2dfbf777cfad379b32abb43d0d7067cba2f23af19e0ec1d723a81c01c42014fd78b902038b58e057dcf7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 334; + dataLen = 576; + combinedKey = "4ff83253b3de4e08ad805aeca7da442d132027c8e79a1f2960706c799f862f50"; + iv = "60b5312cf75e96be81a76a42eaf31a7b"; + cipherText = "586ae5331aa9df84501b291a1a32923860502e0e5f0aceb11014834514cf168bc8cf959ab61b9a7f616d6d2dc0d3b3b6b43cfb3803a5f5a04114812c8a754104dae7e062d109548d"; + plainText = "554d21e5a2d20d8371b6b83fbb0c346f894bd122efc53cebf2c2a5d26332bd38e0d3205a0aeb3013403d1c43cfe73af0e76ef50108e730be83b04935a362961a7050fae3c00a7616"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 335; + dataLen = 576; + combinedKey = "6803dbff60f18e5c404b234991f7602a045f9d633548176a2ff8a9c615941c1a"; + iv = "86c2e225c2fe46e3aa819d0cd4f9d423"; + cipherText = "e3cfa5f89f599cc476459c8af482054be07942bbf052350eee1c4e6532a1ac8cbe613582efd1bd305bf3d270957d6365ca024ebc2bbea773fecf908830b168fca9227ece08b2e489"; + plainText = "3d075bbf28614280d84884d87de7a984ba1fa0e963a0e380014237210d50f3eb91ede821c0bf0d3ff6dc7f064b93e189b14c23be2cd74395dfb89c4ba43c9ed487c2f814a22cb632"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 336; + dataLen = 576; + combinedKey = "0e383214c6ef9958bcb1e9eb3bdf56fce75b4398e10eced7be30a8b83d57ca30"; + iv = "f4ad594bb1407a9602d894116881e79c"; + cipherText = "eb387a3bb2c585d1e5cd3d7ef6fcd9c3ad867573c55aef56230ca853f3aaa14f27621a9668f62fe650a3d3ddff62fc07608db1edc81df3ebf6bda7d71fce30088c97b5517342d186"; + plainText = "d106a81994d2e3c0f04ed30b81b6a4068f4a4021a46617b0820116725092515e1c2577c9056948229356ae1c078caffbb002ebdef815dbf213a3bcd54b95b3ac91ffb5e5904487f0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 337; + dataLen = 576; + combinedKey = "110461ed446c20c3206edbe454811c996853c7cc2b37e3bcd489e3c231e6b9da"; + iv = "afd01668154622ef7b4d5a076da424c4"; + cipherText = "def2a8baaa97b6bfd01aefdb72bf5421b8b5a6cdc177597f01cfe184d9cf1abefeb4bcac52548fb8898710fe0be7d6aecf5f694d1d63a7d15c35697bc71be798a97a9754bce8ee8f"; + plainText = "a11ee20b3a22e8929f8c6d44ddc70d8085f92d1518b6af3beb1bef8a17daf568330bbed6c0911f5a1204019c509411267d5d36bb8bef9f5d66c599d85b4e41f78e6686f640e140a4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 338; + dataLen = 576; + combinedKey = "9bc3bad718331e918bd0ba558ebf60c387a15c88b9c58b6b094717a5531e4bbb"; + iv = "98935bda588eba99ae4178b0dfa987da"; + cipherText = "b7025ed55bad49f8771ea28bec835aeb2867ddd27261c939623f5aa119fc53f8bf838e24e9f3b7f59d3cf155312cfb6570ad8690ddcac95579c7cb3ff1c9b6a5ca23595fb5d5934b"; + plainText = "df13a7bc496825c51325d1e9060fe6729e0c723e33058cddaadcb5516fc171095d2ebe887298a2327f17a12f50e5f0af76ac0dbc3497a0987d9e8056979fa945922f7b7a21b43970"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 339; + dataLen = 576; + combinedKey = "fb2a748d21f819f65a01d9cee8a31e2ed1465afd7427cfbd64bb1c4e85fb2673"; + iv = "4614cbb08632c2e5aacbefe53fbc5857"; + cipherText = "d8794a2ae0204c2610d54afe93f5e59173697625bb0c2fcc21f8b1a93a8bfa776b69bd536479fbfbfdb0b06aa6e4b7edddb2f0bc1d82f95a9aa26bba9bad7f2f80532f6beab2144f"; + plainText = "5b668143728ebf782a5da82372bfef397c0a96e03b5359b518df177fb8734cd4a6c285abfa4852496256b0d392e59f9ea8c7dba0edd86894375bc3aaaefffef6402c18906c4278ac"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 340; + dataLen = 576; + combinedKey = "bdb536b82e4b8a8b034913f22de696c729b8ac2011a5c05a70d4da73c25c674f"; + iv = "7581488666e29cb0ae1ce7fccc32dbb0"; + cipherText = "6340d3488f452b719f6936c1b57e31505f3dc2aac31c21765956e64c2a952578c608225ea333011475734f4d144a29d23044b02c62da45d9352e08c0694ed74e179008f4b871a633"; + plainText = "36584ad92d2eb3e51d4e9d382784db7623cbbc77eb29941d3ee1fa918b5ee625f9b72e3d51d00db76959de34e96e167ec951e251d08da0e058a345e576e2804630488d8edbe36d0a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 341; + dataLen = 576; + combinedKey = "6ca2be1987caaf2fd10fb3df72c70a9b24e4dfe277c6c7357d8343afc6230a7d"; + iv = "b2c3d3fd84638c1a9bc3a45852f44ba2"; + cipherText = "ffe7cacc097dd818e5aa4ccbe7a5d22713456a423a69a61628238c028a0bbff21a9897e1fd4a47dda213780372e1d6c74ce719c02ea713c0f88ccec0f5c6eedc0c5eeee711887360"; + plainText = "9bc381c74588b96e7da728707ce95224866777ae8893004d6ef8544cd3e3505e60feb22bf70a30dabe5b2f22d17e3b8dcee1e30fcbe644eb63b0702ccba0d623063b7f242fdcf991"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 342; + dataLen = 576; + combinedKey = "69dfffddb975e916a287c39ba6e74c3c140aabb1ff7db46fa8215849197cdef2"; + iv = "2de9ef450dbba8f99398d041f8db5f01"; + cipherText = "49ba3511b85ccdcec866ff79a239f4672e35b8f3d5ef4910bbbd0ae6e88fbb12a8a83481322262c69e9ae9c799f73d20c0dd267abb79abacae092f809f37318dc2385e82312d1c4c"; + plainText = "e59d80b65d4ddd2cd24d166ec3d56e8763d967ff82d402371eebe6ed9bc8c8ee672d23a4167b88c1f5fa9798eeb347ca3d55d25cfa17fff509878b9e37c56aa4113dd52ccab177da"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 343; + dataLen = 576; + combinedKey = "59b4d0366488df9768611e784b5e2abf76ff6929419796947c75b1d15bd7bb1c"; + iv = "31c46b13f6df885b64e880eaef3250c7"; + cipherText = "6dcdf9b0ac2869dc8e4fa36bd7b3bbace15d5e877d3e29b67629eebaba4cc30450011ad5ccdea94ee6892fbf18131d7a68eabf50b6f7e2296613da601b79cda4400c11049eee63b5"; + plainText = "de39a13866bad463c140d2f33eefb26a6b87b3939c1bf0517a7e26955a0d2106cab8181891a9fc9c01685dff4a638b1c3ef97ebdc671d8f288f6bff33e3847b9b37cbed2d8c562dc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 344; + dataLen = 576; + combinedKey = "91109c2eb89817fa106f3d046976acd087b94b92a46aefccb8c18dc7f0673776"; + iv = "b54389f60294be59d427e83393a9f6c0"; + cipherText = "175790bf6ea1db26884fb92a54154a26448f7664c2a305f0e2350040f1e2c617896b89e49bb1da65d30e1a52b547ccbbe7f2bd67f5f840e00a305d1ad372aaf294f5adcf8cc7de79"; + plainText = "cf4501690814572b3423912a67646d2391faa75b2f9d8e09511ca7ff63343c7382923332b121b2b1254a0667431bb564d3eb2f9d6a4db1dc467e5da9baf99497d8888559acc2e5fe"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 345; + dataLen = 576; + combinedKey = "569a72bc49774e5303bf79bd64616be976da8f504a1df10f99caa9ee790d4818"; + iv = "1a859af30ccf7e9220699e07ec6bb287"; + cipherText = "7403fd607a50e996543ce8571a14c2d4fbb968c4fe0f64d93d98615a66bd7f9cd884a5ee8afa7391777b3c121759de2094db40ed91ea9cd8004c2d24f8dae40dbd00e8984d9ab052"; + plainText = "0e1432368879f1ebf70c51bf5a28d661aa92ef905dd47f1dec51cd4b02470b86c90ed1f3c09e1609e4a003617d1509f0a8aa0c9bac0e54ebf18c33449a0219c60c894d5aadf13c9b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 346; + dataLen = 576; + combinedKey = "05648c0cc1104f61a979abbcd0606b7c1573b9125148c9bffacd2b26f5ba3716"; + iv = "21d568b5fbf8fde85168ddc716cf6934"; + cipherText = "f29909b0468aecb05edf154b088eb51f5e8db9ec12896bea1e7da7617c25e8a32df5652c7430f946c1f53a43f25af2b4f88d65dfa3bc941095d24f13e05d99f907cf784ec4bd70d5"; + plainText = "327bf2d8bf2596ff145c07313aa73b93c12397dbb2c5df4c8ed208d3978f4e979a84b65697a9a33adcf90d2602d0edb79b2d3d3b0155fffc434064ca44bc2e70761bd8894d28fd7a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 347; + dataLen = 576; + combinedKey = "7ffa09ccff11ae24cc40f171340f213787d500e08c4617c1aac7f8f4987470bb"; + iv = "5e1edf107d8191f71e2ce63bd866a3bb"; + cipherText = "9318fec66ee5be264c08dd9d79d5ea713023405cb8248bf5cd84727e88c598288f30d7b424a6cd805b43218d85e42fdedc2dbdce37e409e73f2eade0208ba6e57ea75d9fba42d3d1"; + plainText = "196e8982d423979ac15bcc6beece6f222ba67f6d6fef68efae0ee40d825492d119ff1027c390593f6bc8f486251252c7843121aff9af9b09ce9f16a3b96076a1951cd6e3b61f2e49"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 348; + dataLen = 576; + combinedKey = "710550e4c6f6e5c6a919ffdaa6416825aa387a4a3012a718f7eafdbfb284d217"; + iv = "a6a4c2aec5b1f655083e64df89795b04"; + cipherText = "bc85c221fd23ec9ee4ae6592daef62a0a5d9601e6313830d5744b116aa92b4b2aafe0f28c597a43b1b2d058f3266ce3e4260dc8c234be744be3437201ec4f47c32c042616d5ef1a5"; + plainText = "f1b7dbfbcc0f855a3531f18dee8d246e095c51262abcfa4015750d3d989cf364c7f9e5a231588fe28c61758b4f58e74a60a52695750b10f02916282abb9440b7c591153540ded6eb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 349; + dataLen = 576; + combinedKey = "14e2349f2949921410e10167580c3c5544215296dea666e45b325d0e14ff96aa"; + iv = "18862240397cf9509ad76c2aac5407ea"; + cipherText = "7b60cbd9e91b738479965c0d1176eed0e2255a7cc0f30f3b25e1395a5e00ce660a57eb844f74c6dc525308ca4d83f6f5a1001a0f23f583857b7840df59c34e2d3be25f2c98ef9e95"; + plainText = "97b5162cdd558be7378bf02fbd245d40dd07eb83c2e8bbd10f655258c0f072ff8c3639c7f48bf548e9dc3d3621b78394c1df54e360731e748c366aa9f7cbc261ddcd9177b4e4054c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 350; + dataLen = 576; + combinedKey = "7d44e0e7879081dcb555e490a460f7ccccbcdf5cacf0499f7d76e327e5442698"; + iv = "3da9a735533628c87a45fd2560ccde62"; + cipherText = "a8db84f4e2ffb64e4319a320ef06defda7f46b238b96b1a074fe32cf81d11142477688e16b057054592124f9c3819c29313075375b8ba91cde85fedd0e3a6e6d8c6e016b5257d013"; + plainText = "2d447cac138cf21cdb55e1d8a62d6c9cd1e0bb6a3cc95be395a2452410b8eaac9e8b0be60f5ebd806d6d766dbc930390243af507e0dabe4b6b8c60e5e94a336565a77f927ef312af"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 351; + dataLen = 576; + combinedKey = "9d263872750ffa464bf608e84f0e58f656db816ebec28ece5c2a6d9e31e4e554"; + iv = "93d9e4e9a8708365078791cb37f9ec88"; + cipherText = "e52dc873646202636078eb38a2af5009a7c920d1f846f58713e7a5fecfad8c234b09b1848d2878c3cb016be240a7345770cae1f3abafa202b86f749b97ddd52a3c72c6916edbdbe2"; + plainText = "75346e966cb966d2ece4e0925ee1261e4799b94bd491e2735c37920c95f478e6dd4eb54327ad800e545112e18eb9c145f730ead34be0f2ff45ee30e36d7a225d4c0d756fcbac7f4d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 352; + dataLen = 576; + combinedKey = "7ad33a114cae2d71d1ff6b883b453558c2ccc86676644c257f8a7c4903184c14"; + iv = "25820571fe1af71ce6ad4546f8d99de6"; + cipherText = "96e82aa414fb084387a4bb445e5e01ccedee94e47a0aeac9d7e352c517c67337097155be1e9f4a8a7cb06a82e3fe071bdacd810a1403b2e5ddb728a6e06da01ce27e51ef33fa34fc"; + plainText = "79b74f135b39e8080d985950a6fb8340002c84bc0b18416a6d07e2b3a4ba6c512a0bf6c0c82e26f59f1b1f973d6082c59a0127559a39e58c5ef8130f77f91c389814ea1f6e96189f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 353; + dataLen = 576; + combinedKey = "1d98922e100977f206d9b4daae0f32050e04bdd523b5f90115ffb5646db6ba59"; + iv = "39119e542800a94ab93a385a420b4bf5"; + cipherText = "46301b4af578a9c79bb8aec98946475cd943f37c1014f7c5f8608c048714a64a0ff9151482a2b0ce421e59119d907f61c5af45d2021a52f702bac7b6130301db2c33206f78d2b8b8"; + plainText = "ed3afa7c46fed058fd7f1109bad873140b9512b80e9f109afd414fdccb5865948bfdc06bd839c6971f7e783dce93422d12976d17ee93a7769c66f10899304814ce24857ef12c80d1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 354; + dataLen = 576; + combinedKey = "4f42af899cdc035489a3f45d76aa4c931d7dc840f3be3ba5d431306601aadf5a"; + iv = "93851517f4ab3e4b278e15d2e4feb884"; + cipherText = "c1dc68846f70226f59785831074416398b048baa94eeaebf3f3cd914b1b394ac76718425599f676294b9f558bbe0b55c1030d294cbd55034fce9fb143b098092bb3ec4590e12b650"; + plainText = "4c5e35001b282d4d19f4b4e8addf60833a3b9fb8fe881e1689f16bbd591b0e1ef3db3169b95f0d85929177f3067daaae10cc51c4e94d19f424a138631811f56f5cde4704eb3242ea"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 355; + dataLen = 576; + combinedKey = "c33da4d4a6dbdf7519adf131c3782cfaecf323d37dfd424a2884f009245ef19f"; + iv = "8f8911e7723e8d9800a6dc912f197403"; + cipherText = "eded15831c8df898d501cb1c6d829df07f3ddcf50f90714610d88d58283f02d2483fa1d8e04283fa4e69cf098af839ecde3351449327e867bd64ba8f8400a999a24706aecb4d8488"; + plainText = "a417f899bcf7576db5ebb43b997cfe0d5d4d94f85a4b877c3030f4b21be804dc59cf6feb944b933c584aac413e02670a02b740fa19e7ec9e99390c36271f6022a0b60d85998795e4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 356; + dataLen = 576; + combinedKey = "8b6cfc4efb19fb1ade49b74a2fb1ea02920bb0c3117d376ab293c1402ea1d26c"; + iv = "035a666c55f9748d3be28df7a9c890c8"; + cipherText = "808dbc7e0655e71d4979a53a395aed4cdeae62b37ffa64b5128beb9a05f84313f8d681cadbb1f77312f5b01aa8d4f50f1ad72c872e25b88c1557e5c13f302200203d1f02479efe8b"; + plainText = "160f1893bced71d55f7af670003b33ab51d41bb9c450d043476f89fb7c08e5fbedaf3aefeb1df383e0e3d1e78957209e5ed4c89de1359cffca6f375510cb3db4b6a5b0ffbcfe27ad"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 357; + dataLen = 576; + combinedKey = "329f37c34574935ea07440cd916e5b8d02ccd6cfec7f3d8eef5b4509bc5f8c0a"; + iv = "16fe3cf5f9fa3be195e41f93edb49b6f"; + cipherText = "0819e067f21647d6008d51984157d35e3b516dec56782f22b1caa6a37526f1da88703ea42a9502e067762579b79ff87947c442b8841855048436c918c9162f0a0688d883798bbd07"; + plainText = "ee0ef0adb8bc99f9e9dbe85362d119f696cf1c04d190a8162e60aa87ce0b6491bdcbda5ccceb175a8b576ec7080d4fdf8cc13b19d7a026aa17c08cecd7391c487ff688342eec9a68"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 358; + dataLen = 576; + combinedKey = "6c41271b7257e620b8230b515b40b22f15f2b5737cbb7883293cd85121d66e9f"; + iv = "f2034224e7d426a05dc4d04b5997b5da"; + cipherText = "50e00e1cc7e632fd9f62345f89cf6afdd4dcfe3b31648463c8a2b2b6e28af07ea0dfef5f57b2f0ce154f578631e5bf9978b385eecdb08b29b565ec86d6c261487d986ca599cd4d24"; + plainText = "36eba1eb8bb12d8b039e286047839ce32a0d5f2fac24ec38d67fb82342e0049728c681c7bd1877fb4582085505d633265c2aaccf2cfeb7ea5fc8f88a7fcaf4061d077ec2c210275f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 359; + dataLen = 576; + combinedKey = "6cb9f8cd0427d861615cf00cba3c33443947c4fbde7120bf1016154c62fcc72b"; + iv = "961b75ebdff10dda9a98a933a74d35ad"; + cipherText = "b8b3b9d95588f41986cae7867e034f161e0fe183dc3066124b75519a2d70ffb0c068ee396e19fdcdf042f8e380a4c37db5c94d01efb5b9e82ef46812a562f4b2ea3d90730b995eb6"; + plainText = "9ec7ac4097e8b3cf65bab8b405c09c0f2700e5558b425d1b685129199daba912ecf25a949ac10a1ddb3fcd15b5c6a5e1fcdd9033dbd6b1bbc4d4c3ccf3cd7a30c8da57a2c3592893"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 360; + dataLen = 576; + combinedKey = "0749f81bf7014dc60ca894ceaf68c67a64a2b56d1f96d1b153bbf2961643c1ea"; + iv = "215616b14fe388a082b61d07bbe84953"; + cipherText = "e3668bd6cb453481dea1c7ccf6a589190f797a14be755737b8b3983c9f06bfccc1425c0b30f54dae205d79336b5e8da692cbfe769a1c3d2b8ac698d542f0aa6f2e08e6e910fdb23e"; + plainText = "d6b6f1c3a46be63426d466d93a7f508c4d004f36bbc5ffddda812e93f29fc8b93722010c3e3e5fb5158a0319b346d01db50aa175438801890b43d33ad54680cd3c3027b9b4479b7c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 361; + dataLen = 576; + combinedKey = "956bb3a59af77fcc69e3838e6ebd2415260e4127dec041a6eea1cf80b756e33a"; + iv = "7251bc0db5841f76f5e55b5532f273fb"; + cipherText = "dec5c78631e1dfec089e735adef9412a0454b1feab851a042010f2974060f8cfd8f29b41131332b8781f5c20759e94479b631ec60f057dff347d0e4b1d540aed55bcbdeb007e7abb"; + plainText = "10ff4faaea85b8e442d852a38a50a8271785e0cc094cf0ac935173a2caf944933277955b09e35443d734917d299627c2c85ba1090ac6a86efc8126517dac27b6fe40ce76988a6b58"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 362; + dataLen = 576; + combinedKey = "bb7299695d404ab15e4153eb20731222d08edf22974de6cb08fe4001d199c808"; + iv = "7f8cb19f665e97a3a7491397c3764317"; + cipherText = "6a6b6a4614ad5969ab5467f75cbf9bcfb07cac158928464a4a412a3744fdd734c324af2b4e17b7513f95c30774054f8eac857fa089606aff1fd8fc545e46287ed4d8e1f6cc69772b"; + plainText = "f0fae22ba38cd2bbef71456ed1e06ae9724bdc2e820930e0fae8bc1cf357e1b55ee89b7bcf8d69fb43b5f27c71c80108afef0ad1184e9bcf2618a1074fc870a2b6ea5d6eddbd3a89"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 363; + dataLen = 576; + combinedKey = "307c9350f03ee56a481a9ea8e174b4b32d5d784806ebc3daf5b051cf83c2044d"; + iv = "ec73b13a2b76c60074c1724d0f38c955"; + cipherText = "ae61f5ed99c1e18f4dd1f53fe2aa47825fe40cf52fd73b5b4a3c33611050d56f1b89c1344d0c13a503cb2645d38f3ab294cada601042df5d30be0acc65658ae6e30d712322d43d61"; + plainText = "4e650ecfab659e8320e9a8a5437d47d87c8f23ef79bdbf71c5911519bd307756c815e50ce62ce6f532b8952de296be6485574195a19bfb01c66be925079b14e6c3d06392c6792fb6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 364; + dataLen = 576; + combinedKey = "0d648075b087b2b0f14c8bd5f07dec240654197823c24f94aa59e4955f1f4a3b"; + iv = "bbf9ef7f879c4a4423a742ddaaa1dd16"; + cipherText = "7119803ad0cd37eccd468a36b478b7c90f38f4cd3c40adb1e783d1e6f2ba104f6b0b5cff19b55454594614f2d30f0133adbb27e365e8606922677de5815741f1b9573a327a7a0533"; + plainText = "d90873e7cba12716f6f134af9a17efb966e91cd8c757792821e9d58e0ef2979cb51605f081e566107bee9d754a2965bd417f1bc2fd3f0e17d140909ba65137facc2a7a45256c457e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 365; + dataLen = 576; + combinedKey = "a5d133c8eb083ac7460a88acce73c26a8a4a1789c157becfa36e7d49e1327b91"; + iv = "de9f27ba8f1f46d25ee9264e948d9f2b"; + cipherText = "5f0978c084b2ae420224fc393d99ee65fc28004d976982c6bc52ce6627ee807ea14b248f8c042683ad77c406eabddf610a2e5f3951fb587bfc2dd9b3283c5410738bd71c0a053ebb"; + plainText = "598487fb8fb6d69261e7d7c38127a4f0c04a40aa24119e70e79e39830398336b733d26fb3a00c42dac9898e92614d3b699b08a32e2e85d6b5f813d4adef3b3d43a4d2f00a9e13228"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 366; + dataLen = 576; + combinedKey = "36940bbc24aa2b7be09f2e305e6ed295d1a67b52199b6de52677e5af40737ccf"; + iv = "84d1c08caed0d195577e748096b280d7"; + cipherText = "998f1beccf77e8f59c5ca35651b2651039459fb9f3cd81bbda9d89eb856e33f8ca614cf8e924225336561e4ef74cfe2dc936218c3839a8fc92cbea8a2fef2c600d7077e0f5890d5e"; + plainText = "eb2bb447f1d4c30366485d2a8c379d7c31f3ced4be79736cfe6214b41952ca3c300f947918a91187b0b6e9c46520deb23a6d1d8ee969312e9b9a68ce103d0884c96408970de9e30a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 367; + dataLen = 576; + combinedKey = "6c9d1abf4dcb5f8705971e34a044331487005710429cf56b1e681dd972fd7e18"; + iv = "67c240a4bf7eb1cdd41f9749e34c9f42"; + cipherText = "118a03bb97fc89a6ec36f4b6c1b9648cb7972766fbff2aa58d5819e5e72f3b7d25620d775a7dbaee19f866fa1980360aa1f8f624d5fc54dc0830801adf0d43d73d4b8f39fc4b8ff6"; + plainText = "77c64f785c1d26e26c983acc376be33bfb56cb1ad6c09a8c64453dc30393b6ca310207989c49513c9e9ba66a293b85514eb42945654ee837da7f8efc52f3615aab091d65a2744a3b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 368; + dataLen = 576; + combinedKey = "5568ba75c1fc3e7e654019bfc1391918545e380781729c231b32900dce12bd8e"; + iv = "0aa2b015732a683ed735396cd85c102e"; + cipherText = "3b246ca3b756d8c4fbdbb45548c0d878d5de863f3f320ae586f8111ca294cdacbc9c0a2a6fd88966893e24f0ecaf61ecef3f6b2293cca78a9cfe27e5c2f8066f5630c3be0d0d07d9"; + plainText = "2b74c553dbb01ea8ec64e5fa0958cde34c243ff658300536ba5b1e23acc1784b16ccb4278e79c057fa465601e8f2b0dabf4c336b5965397fb4e9b5c884a54d42b901a78fbc8cea1d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 369; + dataLen = 576; + combinedKey = "50ff48c2ee0c49e9464675810f4cb75bb26b9169c66d351792a567461ed51cd9"; + iv = "e868532013731499dce0081a740b5b57"; + cipherText = "8c2ac69ca502708919e6167daff2e17db6a35d5ad4a4af11589c0ad094fd0c2d6e8db7c3cd05d66b54a5a56a8be0493aaa79ca26b882ca494358fab5eddab7b28c4ef509310bfefe"; + plainText = "f0c3ccf97ab67cc20d44ad0a4bc901f86f91013da52bd8d4a34967939b7f0a6360c1b8d53c0c318f7c2821719ce8a70ef487fe8c2fe60c177e42c56f16b936e1dd8065edb220cdf5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 370; + dataLen = 576; + combinedKey = "b773ce8db448b0a5e4da592ce5f29dc6ff3fb2970152c9a49810f086f6b5a6bf"; + iv = "9a3932b1694c751ea689b27d3343a650"; + cipherText = "4637f94f1619d865e065c713abcb1af2bf0fea96b6e900e197453b8444bad35ed98a158f5ee9901b61784deedc626841fdd3fe22aa9f15bf314fa97d8de1b36a54f2728164549864"; + plainText = "7a7f2650f40ddd9a4c5d5920abd5e024e9f66cdd6218174da81e914852f95a182e407f12a8abb476681d3cee448195a9c568be2fddb5d701ea26bffdd4faa554caf8e9fd69e554a9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 371; + dataLen = 576; + combinedKey = "ba663b9e101b918db1d909da26daf939fbbb345493efc4ef9c7119519451981f"; + iv = "83e57723ff1a8d8fd7bc633831f5616e"; + cipherText = "346c4d379b0c2141a374a248a74f5713da2bc60f391bf75c2c730c5899c3f94fbe0da36d441336965968ddac41a9ddf5dcbede3be1938e2f5e72ec662235d0dcae85ef2b29c02c02"; + plainText = "0e797dec7797ca1773763ab3106618b6ae9d2c48e7d81a4fe0ab658d7c8f1c883b232d8237d67c72ccec25704d5b48b0719c4c41a9789881822ddd9140b2d715a05b291d26023690"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 372; + dataLen = 576; + combinedKey = "bbaa56f38c0678dbf01f6ddae5e17a7b037b38930596e24c23655ecda4f3f05d"; + iv = "cffddfa7aa551dbdf6c4adcae555dbfd"; + cipherText = "161afaf8dd6b72f5ef753228590544ae2c8de22077c23c07151e2e7ce0e84df5571acfde60cd0033a1c57b380e76a07f6757f9a0bbbdbf03c2059bfe7abe572294f327597d202ca0"; + plainText = "8ba9bd231f88778330b6aa7f38a9860031aac6881f62f0b545c814d1187fc831e589755462608e15f81806733d07686e085f265d2b450d7d8b1abeca15390248e2a6eab083cd2491"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 373; + dataLen = 576; + combinedKey = "8c2a5b2f9e20ede8568986e427f962cac25ec3ebde943dbd34e766f65be2174a"; + iv = "8c7a6d86acfaececffc73bc4539d0a8e"; + cipherText = "02d69f924eed46ab3b0fe212805ac10428d2f05473572bb9afe26c9d7d195e3a6e76c5feb0706fe6876e70dfc44da44c2f5539e5b65db821296d3f036700d625bcc571c6a5dfa0fa"; + plainText = "813ecb8b05d5574e236d7d47b3b583d9fac90c4094abf0c72d09f43d1a4561f574dc522488f726d47482fc2e0e737904ed59cb4d8572f47c81d774a463479b05d1cf39d7a5645295"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 374; + dataLen = 576; + combinedKey = "f52914e4f9e414eac727a7b3f5ebc944c34968ce9b1838cf1ca0f5f0f4ddb331"; + iv = "6867979394b99eb0b8e632b30a18a243"; + cipherText = "cba098516938d7689983d65aa9323a542e59f92ea15e0654ccd0aa6b6d86a81888952c843185cb80150d592e84b4e39610757c95234c184f50ecfedb07c8e6d5c0711a66aefd77c6"; + plainText = "3426434a0846ff7a1610ddfc18868e8c1c92d4779ae15323a8dd6dd1da755d456d88adc2247c4b61b192af4e0b47e1238b8122684d2b81574c2ec9f0b42431fa434481e7fbaccd45"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 375; + dataLen = 576; + combinedKey = "6ffc86b76b0b715ce3e409ab7e978c5a00e96c5fdd8bc416859cbef47a6df681"; + iv = "d4f224ddacf748c61b6e742924e98eb0"; + cipherText = "ac39691a5d144329323bb4c88971d18b99108dffe31b1140dbd8652e651dbcb850e428f27e82563871de2614c63556ef2de289eae521dec3a8672e23fafbb020f5e0b959d13d4e17"; + plainText = "b4a6e44ce58b43a69a18256c7bf44de6c878d8af7dbbe6e16b018019d64306c5df6a04ee7c8138dd40fa563e21b86f4fc132d0f6682cc0fef87d59b7f46550f893a0a6575f48a1b6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 376; + dataLen = 576; + combinedKey = "26d703262ef514bc949fee1bc9b5e0bbe0b4ee03d7081eac8bcb8c1c77c4b249"; + iv = "909020e3b5810d7dc06503df6b2def0c"; + cipherText = "4dcf09a81aece5a13cddb01e0339dffbb7b362de6f250bb5782199a7d4686d5659479fc665e99fe5f626215dc4912c3b4678fec3ade10fb656f54bffd2b47e7c81ba609714a5e780"; + plainText = "5267ef2c0837800055d68a8df7bb8ca56f748f76c8838d4b0e9b10099992705e0ee46db4831669fd296f87a6d7a9fb8fc3a7a0f19fdc49b7ce1efd5104494bcfeecff841870281cf"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 377; + dataLen = 576; + combinedKey = "b440d50cb42218831b1f7c76ba44c9acc63e684b9a901ffa848b910041ba6d18"; + iv = "8e3d88ee9f8cc62fead3f8bf1074fec0"; + cipherText = "22dbbfabfe84487bbd13a7a98bb6973c1ec61dea09c8b0be719df0129f51464f072f61b6f98665e9501d011a179eedfb4ac2a6b8eeb8a1ffaa727278b958b1f0aa93e0bfc4c3d904"; + plainText = "300f0c014d45e2ab2ab207ca61930d86f9ffdb7d8ba3c5a34d33e4f0540b4ee4a3ee9206ed15b01ab1147815db9bfe2791a5982c174ceaa9b5b83465d50009a4fbc35e1cdc63f951"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 378; + dataLen = 576; + combinedKey = "a36346e3fb39e1d7160d04680e2af1d6ec0012e4b1464428a73d6932199ec82a"; + iv = "94f96e0aaf874917daa3b777676bfc7b"; + cipherText = "e63ecea73cc87a7d2a36142095ef9945a76db94fa464e4b6d2a1dee3a7439d308b8deb4386ab42e6618d1305bd4bbe0cc04dee61cf675d975bd7abc05ee28d194dc385258a6c4a53"; + plainText = "9da86c9bb56762e0c6facbb2a2809f45cecae12a6d739ce8c721f22355fec0fdab05a04b79fcde658ce89f8ae90adf9b11abaf40faf8a70993d846994943ed182fe0bd7a57c83a79"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 379; + dataLen = 576; + combinedKey = "f3b850ecde4a05d22399b27132334b7b2b6386d1b0da9df4aed252aa0e4466ac"; + iv = "765c5ae1f12e704f4adb7855251d8638"; + cipherText = "a94659332c83e0f1c9d30ae3248e6b00d107c6e84f45712f78415847a5af40c93369a26ca9b3147bb6f22fc82f65f866325266439219a28e613830319c952a76238f71460c76161c"; + plainText = "d514476e28bd7679bf48b39459ee81d0c9fcadeb86ee75b807807085aef3c16ec9251b7b04e71aa50563044ae3dfaf8ae270e13002fb6ed63f6e025c3472b7e89d20cc1716560e42"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 380; + dataLen = 576; + combinedKey = "1078d6af30d3121ef3c7599f3ae046b809cd53933372f4f7b1526baa46191cbc"; + iv = "9db3ca7d59a450f92c0d2c26e19af76c"; + cipherText = "ba4852df5f7484873a300f4aac734fd959de070d6cf36c87646349be4eb5d8401135f730ce583850f73a594ab99868cf268dffaf762e8f8480c2710417ed7dfd33c9ea51f9d23f7b"; + plainText = "577d682f4b9e0044c3ac4059b4b03af7986c766c7421c0cbf638a2a15084d0ea2667fe2e5c1028f7a3f4f1958382dc7abbb94612880b87d42676dc4cdeda58752a77cb31bd310c9b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 381; + dataLen = 576; + combinedKey = "cb664dbf3413bb5acd89c3623917e73a40f719c895f8a65f38aae916a40ee34c"; + iv = "8fdcf95aa5f7f538b0e03fdf51cc8a7d"; + cipherText = "a8b9d6621d6c9b98a0753b42af08617efebd9766ac2f963a6fb138630c75b1d2ae9623e571674290430c38d5d8e37b716377cab43bb2464e6caea53583fe9c901e096167b1fc8b84"; + plainText = "7166093ad8ef5ceca9dc2168005b618c9169ce66a081189e83fe986bdc92eb523c3ef9150cbe18c89f685730e63859fc7ae6bfd89171398efa811a45544b5c4e9ed0326579047e34"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 382; + dataLen = 576; + combinedKey = "89a01332e1579147f3b44b61bc607a281681473f37a44ea085b5254a37b31760"; + iv = "94815e3566c1b2d995f13308c0192dca"; + cipherText = "0573e189f695898b209350ea9a5017913c6efe6b8d162141e378be6d117ace6ea080e85831dfc60d9b25db7b9acbedc36a47686ea2d72fc83021df6a97ce91ae664d27678a241f87"; + plainText = "d3698d6eeccb2ae919ea47e9e659cbb0540e3a7ef48c0de63f3f1a8f3b598689c56a30be1c1c371d190da88034d427c088d70684bfdaece77d4406d1973b6766eb9d0f418bb689aa"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 383; + dataLen = 576; + combinedKey = "9756290aa95c942cf7ad9052b9d5b73c15c53b05415481bb685ef13a461ee1f4"; + iv = "add5d542dbef5c12f0505275143c963d"; + cipherText = "c716dd902548dd1bb5257eca07fe3af1e4b4e39b4225625636fc235280ccd8c22f2703b0893535e9115a38fe9fa6df0a64e4c93170f1078f9fb272f650e6490a699d8516a93f9a55"; + plainText = "ba5fc1de85d7c05f19a87bcc520bc38516d0cd0a5c76de4cd668999c2ebc84111503140ab476b2d4a0eb79063810f8f31f10ac93144cbbceb6442ca66965e71d40ddcead3b8f26f4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 384; + dataLen = 576; + combinedKey = "f69352569f832d73112dffb9d39aaf6de26216caea8643f24e9f13ca7e6b0832"; + iv = "0416d05a240d4b2f824a5f61d6b6c537"; + cipherText = "23b25ba5c93f0d004e7044b0ef413e6c01ed52f972661fbab4407bb433e26f146310c135f5af30bf6136b03dcafc74cbcd1cb1dadfeeaec71e500a4e5b7556b3eda224c4a9442a20"; + plainText = "9ee3b369c9d9893f6e1877b6643446f199d7e7b5b78ff2ed26a7c4fc2ec065cdf4e43a3da880e0921d4fcca8ef7ae5d18f90a2a4dae2bdbd77215b45b397e6a5cda05cd97e42e8cc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 385; + dataLen = 576; + combinedKey = "39a897aed3689dee285fbaaa565b2f4de5a2d19941faf75967a0d39f7e906c41"; + iv = "298a952f1c4ae5dad1f41f3ceb31b229"; + cipherText = "3ee4721535e3345efe92b7c826383b69acc1762971552dc1aae47bef1a2ff8f50d3a85dcd9118ddb2b2e3f05e5b3c80d29e1489b23819d55766e6204b63f64bbae61f84a7703fe59"; + plainText = "d5f475ea0e2c032da08cc54dab6bd0990e844032208f4d82ca313649430a8645563caec4bec406861f4bc8871cdd0b5131b7287bcbbde57717439a62fdbf33e97e45a444ef935e50"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 386; + dataLen = 576; + combinedKey = "f25658b4581bf57c290118c831562b2ba9bdd2386dfeeb2465e91db5d620f9d0"; + iv = "1543e5234bc3bbf924b80f8364440b10"; + cipherText = "731b22f69c19e226fc339810e1b43576acfcf96a2409f810df3af692728cc899160de2463246e03747a9db3b118f9dbcf9c6835e2038b16bca1f137f49c711db2fbd001e59cd76df"; + plainText = "b1dc804a94de10536f4bcfea104832b06c3861dd59a08d483a4d2e56596ff002739489995a69b45fd24599a9ac4bb87a482e6b7c7d89092d4f71bac7addd4780e63bd454e5907e49"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 387; + dataLen = 576; + combinedKey = "dc9f71bd12fea12a5888f64d558c14277f5809d6255131e624c2ed16421755e5"; + iv = "6f8c1d3e6e75b645d08c345e693e5ed9"; + cipherText = "f15100a35df3bcbccdaa862106236dbd8c67db033577a737d5bfd1b0a02a379a52ae3f43b5d28f00b7beb69718739a5b0e1f0fb48ee66417a89574651f60623367f14d8b28d57b7f"; + plainText = "4c1f501b80253f165e57044a4b65b062bce8594ac686e14b53686c257f35670aa06290c0d53baab086239bc793d073dc4936a565fd7a86e1f8698094a348516336faa2a1f8169aa1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 388; + dataLen = 576; + combinedKey = "aed58841eb72724cebb4ba7c92d532582b3274d170b33a5cc5df3e9680837fdb"; + iv = "5f32abbe7cec01f36b554c3b8f0e1634"; + cipherText = "e7056907e52627885a833312841f8b5a07bd33ee349c72adffe76459011901e906dca2f268ddce02916f867a8bb0d8e8aa8702491a039e2e49ef81b9310a668255ae1330522f34f8"; + plainText = "dd1f14e17247ee5f10962abc95eb8f2956d09e4b98837d53e0c995e962c0c3b408dd94f3bed6218818c8e76d2b9536ef7f6a5d02b833cd5f57560bac7a7c68afd7139b10fd03123d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 389; + dataLen = 576; + combinedKey = "b9cb591bb5083faa9c2b966fb9559f3e0558cee5aadb4ff528ee32541b5cb57c"; + iv = "364d522f6c33c7beea5869cf19dda258"; + cipherText = "a137b9c57392e0ba020fea87158f2ceac25634adc9bb581ab7914977d974609f31383a217500e79f3ef364645b9c84675389dc1bb0e4ef87842b31e77a2cda52cc772deb05a38a8b"; + plainText = "8c0ce884925d69110581fbce48092891f832481008a148ec99a73895785e5e0f57f7c2ed5cb814ac74dc58ca44974696cc3d6a5079991c7864d608bc483c4e5e97a520bc867283dc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 390; + dataLen = 576; + combinedKey = "e40f5b894f69ec2b34c41f379ebdfe169920fcc37a2b74e36999f4861426194d"; + iv = "c7f10524e0cc43fe5065e0dcc9f14f2f"; + cipherText = "63363fc7bded76e000e7ad526211caa4f64593174d48c49c404a4fa4083991ac392bd3771fe404ed88dee8234b6ea04abfbf55dddc288b8f61c6f9d519421947db7b438644b394d3"; + plainText = "52854c47b884c420de6eb2321e667d457c9f12227dbd3a93b9880962e79acca1a02adfc2ec20bfc198ace99771ad87954e050b8c256d1206ba149fc3f5de14c05f80e055c28710b3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 391; + dataLen = 576; + combinedKey = "5eb44144ea3886808bfe27a7c415b82e467387e1a74bac263871653ab87a9372"; + iv = "139ddec9246b41c16279cab6288dbcff"; + cipherText = "4caa8c0ca58192089ce44de5bb87c265f7d5b129a908af68875b2f948f562a4155bd8de61c9dc121ea23257e54083c8a6ee6cf9b0fd49173a5bfd5db8359cffff4566d197cbbd0cc"; + plainText = "abc1ab364621121e3ce48ab25d5c7bece857d7ee3914097b1ca18b452107a4c005641edcfe790a1ac1a01511623960eadbbc3cd0bef101d2dc33cfdab6ff2965fdbc9f51538de8d9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 392; + dataLen = 576; + combinedKey = "0f656728501d39ad22441dc1ea68b74788663dbf3bfc2d6f797ca9a7c1f149ae"; + iv = "82a0656ab2861bf91d54c4745f1c5795"; + cipherText = "fd2c927ee2adb6a4a5545f4b19737bedf45318ac36865e692a60a0b9d70a958ba6275d6e3ac062fff8c830fa285500418943c8ccd6d16e6246f2e60c86ddd0aab145c58e307cab65"; + plainText = "6c717fe2d7f1bc576104c5afa7949fd3052a49a6177297cb63161bf16e2bb5276da842f2803aef6c5509509c61195a07a8a4906f066d0db302df42e4413a1435a0d1cb08739fb347"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 393; + dataLen = 576; + combinedKey = "94d243615db4227e937bb0846b217da14b02c1caee95eb6ab972917a65972372"; + iv = "8395ea418a3b66c59108133f91dc7e1a"; + cipherText = "418fa88e3ce799f8dfd4ecb5656353240a2db08d334303798105f7edd188fb548565932c028b6138ade712377f96258a4cb735f563c5c045d17e4cd502bb070ab2400a0403db2504"; + plainText = "c2c79aa2c596777f6553d9aa5f13914b4039fbc41ad4b5f09d07ef79790361e8d89c3562089e93a828cb2ea7548d55e8f284ba0e9902a1f9ce842ce2b7fda5bb7eff232f4844a847"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 394; + dataLen = 576; + combinedKey = "c9be21480c24738100670b6653bf451cfe305c828aa4499d61741090c4e32184"; + iv = "8e238d0f860f5d9a7aba517b0f537db2"; + cipherText = "4e1aeba675dfa5fe5ea363064d66b256b1200dcc42e81a4f73d14c56fc6cc058dbe2c29e77881dce7adc44125ba428dd4217166861ceb7dab4b02364b7998ac359a972f04091b526"; + plainText = "07d8d290cb6eb6ca77949524c263334bed2de416b9f5760bcc194caed2ac259c9e8e54773f4f2ebf71215acd5a6100a19c1d6b0f47c2ed73ea96d0b4839149ce95e5e4ba710af4b6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 395; + dataLen = 576; + combinedKey = "3593b944ebb223a93f5a2f1174fee4d48bcf04a051e0ee55513c6b075b6b7a55"; + iv = "1cb2dbde93e5fb31d19a21aa5033044c"; + cipherText = "f12fae71bd2c60aac3d690c9f3429fab98d40dab7b9de3da3386d9fb086e8bc3198abc8912bee31f03644bd261576551daa80c834548e95c0ad8e306302d097be829057e08c1ea4b"; + plainText = "b6c29c98ef4675619d037acfea9936007d450f09848c2b06df348d8ebbda8d48fc4a55d3654de4a9f419029b34ecae653f884e51a219bf456086834199cfeb85198df824647cdd26"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 396; + dataLen = 576; + combinedKey = "4c3df4be3806210fc3ebae7e58cc4bfc090524b00df3846efa5bfe2b0695d45d"; + iv = "d86442ada2bf438046e7c7317c7c20c4"; + cipherText = "09f7e97ee99aaa9b888fbd2e4332b6ece31f806a387b08060c4b366ff25d5e00c29829f1d3fb39767c3b819183210ad96c60974fb54c5d44f8a52fc01a84e6a25e6afd5cb50f0cae"; + plainText = "cbdafb6727a7d3eb6a0bfc0b9a7004679a43805748427ab252054c9cf958a1d691d1b9abf85cb0cb094f82a5ff908b913e83406fea2f8b02870be08c3fdf8577c622578de40237bd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 397; + dataLen = 576; + combinedKey = "fe3e5ec641de89ec1aa37e447c1a996ff2744b8ff078ebe3e85a2b1879c61ed0"; + iv = "0ca43be41065b003278a9dc9440fd6f2"; + cipherText = "e4b00fbc4e3d2cbc9f1fc7ae9b49073bb251207bc1194636f07a63992f3850cf96e36234f149dccc30cc9d1321a41e5d4704f82afb95ee0c4a51a7be1b44a37b5f971df86f4de3a7"; + plainText = "779d4364028b81ad8af763b592050ee70f5f40ea22dfad1cce06897a983ae8845edf0487d0b80766ec5a7cb45b8b1de2e815f5c29af8c80d26859b5f356aa7a6da19a56b68a3bcfc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 398; + dataLen = 576; + combinedKey = "acbbf0d3dc81259d9a899e311504e28bc79cf437d3324802aa230efabfd30ac8"; + iv = "7f9320ea0b08a4b5e3a4714ce14a8c88"; + cipherText = "57c3e2eb6758beda22dd676fa8356e049f3198170ab0a77eba0b07bf667088399d17b7ab4694b0c66a59f2d7a7b212266018ef188158fa66a77c9b8a363abef0e63e923787700fcc"; + plainText = "8370464c0cd13cbb70cfbe8660dc3d929ad8ef7e53d242516fd4e964feb42966b346b3379602685cad29bcbd6abaeb98dd7daec691152c0ac086077d50cfbe1565ad38b5f7a7d2c8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 399; + dataLen = 576; + combinedKey = "1d6e3f24a6d5a956cae561dadb4efcf24c6a77e9efab3a9512899dea546fec55"; + iv = "5d417ceb9e6e3c22a44894d3caebc00b"; + cipherText = "4cdb282928f9f0e782dcdf14456bcfa839c6f94f516267feffc98d011bddd0df75490addf261fdad9faed3737beef02c27ad0c42416b72596419ccf18051e45690522ab4ea0fe6bf"; + plainText = "62a91e1d333671e9f3aa9c7afd18dce1d5d095e4c0239ad3aa4daaa291136f75f763582e32a132bd9b8a68e3254840fb46a612a4f1af2dcbb0cc99a8c5735120c5469ca063e52ceb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 400; + dataLen = 576; + combinedKey = "e3fb872306a0b6c34690950b1bb08838946b3a1609827a0899898d19acef8858"; + iv = "22515dd2642e85e13de8fc57d4098e7f"; + cipherText = "5f325b099d5b07347568f1f5120ede473bd50577daf3e9b7241839c3956380a1141271cda08cb3ca4092131eca2b33ea3d83c074245f5b796ddd66f0f25f298f19ebe700d6bb8a2c"; + plainText = "88a91152a37b3badb3a0664d82ad3e74d46871ce361c7460bb710360a64fdd6df5594f0ba43b9af80c2e6bfc75350605c23e7cddbb9a29f90dfd96d8370ee57d654463ee371d59c9"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 401; + dataLen = 4096; + combinedKey = "b6edaca686ee6be33c1f7ab6747569fdef8a3610bc3539022fcc344d2ce7499c"; + iv = "a254405123e2f368c371465ea0b2f361"; + cipherText = "414c7c6596504ace6ea0908b9580ee6da8664ebd93f44e2d7ec11368e9a2f9ada1506d574b5785c1385137da8f890caedab4968a9963f5697c5d4a94caab3758dfb53a5413bf97bb9576bc22adf1599673772007e9c5ab91695cb01b02d577bf28c6612eee008250da249c50923f8791e15735cdbf86096307e1ff4f411d32071cf1c2bba6b4e450d00d22c60d2c8985414a23524556d4b8ff3eb0ff395a8cc48fca5d2d4ec078aa2fe9a0a36447a5ece58d8380226791acbb991ebfc4bbe12b68d921f3d0ce7f24294e9f88c4ef181aa3d203fc60445586ca23d105bcd25deae303a144552611d726e481f313f9e892d54b2e583ef8ee4e49a9845d9ff6c4157efae53cc8f98472f8aedf6caf120ccc04c65fccce8ff4fc5cb8df52635e6a08c7d0b08384cd54fef3fcb0b7fcdb6f87af28ab6b32402ca2f540c9b3940100f4d3745777112a3f6d3493c9080a6b89aa69974d1f6ccc3d45b577da2f2ebeaffe9174b23917d367662fd0725821bf21bd12169bc3a687ba368749a81d19b3d7c40beb4b1ef01a5c1cee67c958aa196afd05a98d2332300e5a79761a710671ce6afacc7920a197fe2e6fae0312715cb7dee21453a650229763628c2855bdab3f59fca10c9f1a07b77aba0b5076df83f392662d7f8d1817da510d685e490029847658d4895ce0c7eaef99ba5f2b7060bf67d19c69dfb76ec4d90b59b2b9e32fc31c"; + plainText = "ba4319bcb9307914571c7d753938b202a58df948a8b64e69d64da27f1a5b5f0bc43936571cfe8ed27d9e7a7338bffcd395462c6c1f721c120a29c67183e2e452ff98d064e80815f12e0b6654e8a94fdef55c133f11f0f5768ab2f52566f05483e9f3317b3d064f8ce55bfaa7076ec2450fe030a9f4f67d7fa5d7a7395ad7d297c54914fea2fa813d912a7e023ef2aae34214da2b2098ec8bdc845bf351354d5c727e859e9e4bf90e9683f8dfd8d57415f1bd33a05a87f0279c58e77a7cdfe2fc3645b5d44fcfd5675122f73bb0b226d5e44539604b5ee98388f5dd6e4bde00de7101e0ae0cdc12ac13d55c0d9b684eab7c043091ad857fe6c02fe8ec51a5a80d3432a036ed3c2a4f49a133b30f42b37f19da69c5199fe040b0d5b7dd5012d18577d6be7db79cbc3377cb2a7dc9e8de02930eb997ae5b0adf11920d27bcc42bb1a0e5d4e42a99005110ff2a270f465b4b1d562194d0ee9ba4da967d50c3939227206d43dda7af01b0b084d3ee3ede638f145b83e2ea34dbae437136ab1d1281ca688142ef2aed60c76fbbbe9a937c8f631cc7bb14b62a31f0fd4af6591a487b56ec0f20ea11d83bfca2655cac95df7317cdb43424faee8ef74d3c249dbbd795a0a4d32e86ab39fa4ffd7c63dd7bd53a36ca4b869f5bf43e796808417df39977daadbede5ce7459ad2cc771abde445a588b4c3299ebaa8a7f0ed117f8d5aedb26b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 402; + dataLen = 4096; + combinedKey = "449ded836451bcc33bbbc96e3469a79b5382192b3e7de466d3d26601b4647505"; + iv = "48293056477319eb555d5e1b61afb09d"; + cipherText = "0222de83454ee8b3152860a6fbfac90c2aa2e4cbb05b240faa08d4a6a35c403f26e87c53d88382071d7f36ec61b41199255428e943f56cbb6baff7f0f2b0a742a52b8c189500d50fcfdd20a825f99399656a37bd279c562770e9fb9709fab317b902f1a34ae6f7b5ac018e21a93686555045792b4bcb181248dc9c941fff3322a3ca9a27f4bd06ef1337ade85a6c0393a7ebe3bbe7c75361f22ba7934b21cc392627da3cbf0f5ce11676c0830694e55308e0a6cf13d300bc0d3482d52be024f509f594cdba112a2a97d6b31e47f766a486172cd3f555a532cc6398a569ed3186cd8caeb8d391638050eca50731b21bdd18f310ee8cfa76eb0330d76e9fdec6cd1acc9a0b081d3b7d74e27beac132d715b728df47e6a2976c09571166ea99428b35ad65ffea19091b125d4219e0d6c607e42a0a9124f42b6afefddfe006e88009364b889a97fdcd011c5055e548190364627bb1c8a86c4a4f57f2fe15413b7650971267ff7d8973d4aead17e6bb570e11c69903e8f4336e92d9e422377474bed56baf57a8d9ba3f69391502cb96d56225ee7f54b93a31299698a864dcb61fa358f572ada55363a1149ba6909ee90127c6eaa45fb33971c54697f06f316b571207d06c57ccd8f04fcb2993c50c975fca8d5d2ea4f0350576a4d2d5c850e83ffef8cc692152b6743632153743b1c0ba92a69897eb40ec8c3854c26335ca1a281741"; + plainText = "3cd30cc616bf76c478c98cef4c21fda31d91bd1403499f074e9295c187b3bc7a73df437cb9ff23d8da90fa289e51ccb06dc8fd1c447cce81e7958807cb554313ee425727f3efb8c8ac0607569245f3d49aecbb681eccb74469ad8a02b3f693a403a9519a96a0fbbeba04adc26dd7df0986bf2c686cab4565b0378c1d670183eec3010c4982f85ae7b7402f74ffe6320bd1e1f2e8ddc877858ffc38c99133d832cbb825e29d7256f080bdf7c142f7f17b7ef4a5188cf1847ef55ada55eb37d84d3eefe46543deb96124cb88b040d198cb633e41f1aec667265b82561e34ef721f7292eeaeee3cc3f7862736085f573bddffb2abd568928c238173acef4f02d822b208b71d7c7f7ac610835bf4bf530b75d24ba062d942d5566e7fa0d5a5e8a97aacc7014f5ddb2dc972e8f3693dd6538b0f48f144a24119df8f32c3bdf2338da2cf45303191edfefbbdfad19e6feca43821551cd7d60d9f32cf2bb1a17b6494c16d51f8b736ac64583dda6e7f585fc6dd60c6b119071611df87ac7d8d38a6278580c0436825893e9ec3ea81679486e4576519bf33731519d3c1ce46cea80909914bbcfe8cc79901e5fb0e2d67c4a987e53a68b0b7dc88a57d8bc06b04470fca61614cc8d6b102610080164feb19548080f569167e628a2fe9a48996bf01fd29848e7972f683631e4d6485f35c2889e1cbf0cd0fc9778c2f83820bd4852f444437"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 403; + dataLen = 4096; + combinedKey = "91d8ec8b251bd8b014de2a62a9432630276c3589f8593e015ad819108eced10d"; + iv = "05335e961b2c0040bf9ead3c4f6676e8"; + cipherText = "0ea0a9c0dce07a785bd3122d9a230626f350bbfbc6ee84dec738a3b3c0a8e3d97c39ce800d003466d3458baba916bb3c33a42615e1fd8660e93acb847e1e4755d06875a62586df8296c312d9c2117c86d823cb962609fcc5721c6c4fba723776fd9aee66ed5792c0e3f21c066a31806eb28154cc2be956f349c97542584e61e811e63d776fb40f5e1c1163183e19fb823504ea17ad498c8258c6c752333743fc37b0eb434d825933387646774b76a248ca267a2c9458fa4697de89818defb38a575508da15d3b63faa4412d43a589330a45d38bb6ff7c2f82611e7068156faedabd9615195599b9606da557d1e471bdce3b368fc8202e78b13c7c364d00b5a924ff26a2f677d2b9674f7e162dac32a010950570a533fac09441613a1ca010174a98984218ddbf0ad854ddb4849a1bab4360744b9acad51288d04abec125024f7e91fed7514e70c901b7b1227c147ddf86d35a697760cf87fb0c3be7b3046b57c15a2d81dfe9604ecabf72bee8f7a501856656eccedeb5503a905f767c384ff1e83939f507ad1d6377423d3de12667b4ed71bb956f86a793a065176ba80b769c10ec4d5fedd79426d6e028567b32ac62ba68bca9bc225d3e98fa1bc3dec630b66637d933232a3780fe1c478a3e77a9153d0986d9625c2a31cc586e9af964e1f82569fccea876cb88a9e9ecd53012ac165bbf39d4ca585b5ff50011a74b4798f34"; + plainText = "faeb835b4d37f10ac69e2c66016a10122b4bb459ace2b70ec1500b88f81531ddecd878c33843f9cd456725f92c2daf720ebc31476b9ca86d00c8026052dd027b250e6f1756a8f83afa56acf3f42652302a0a05070217cd65ccb145c13630ec146d021162171baa0268ac9d796ddba41816186c336560962693aec784a8bd2b012bced36301f0fef07909e560c4a36b10b60053fe4096eb65c10d445d3f03036dcc5635388e94348ccf1234b91d3d21ccc64b73521eef219086ecf2821a2b5663ff17fcad6de75b88e86dec5beac490bd116efa4788910e86341e3d84cf49c546c327532897eaf3b66ee5765857f807f2f870cec1fcabf7cf6be68e8d699145925c55cd5aa03cc28aacd03fadb33cd2c9d41839df2e9ba5100526f01faf1f470fdf25aeff299b2ea7195ad3d2cad62c521f4f6318f31310050a6611bc319a326b575620e8f8e9e6de4810e5d008064d9b0c0eee77b720ee2e2c4f0f68660e37b53b4f245b3c877ccb740430dfdba093421d58d148b007d277259e71bc1a410ba55f50f3b0a7b7011723d1bab4233c2755bf469ad2f522c831f9f7021f301bdd7acd8febffc34702e25dac1be97e7f41177912ce303be94efcb7c99c68cc9e70e9ba6c3436d29cb759abc4ef11984fb27f72030535a04529c3d8031c30014c2774bdd1890ed60e47569a3969c3eff5d978b154f68276b87a2056fea16a231a5a84"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 404; + dataLen = 4096; + combinedKey = "a6a663f32d1c56eeed1ba50ac158dfcf06331013ede68d0209698bf54676a9f3"; + iv = "8cfbd1f7baec27824c47c980709f4860"; + cipherText = "802b3577d948c535dac371842441eac943d1a84f9531eff01124d7eb9ae9e5995664550161d468bdea32e9b789742b4e0f414dc16ae61ca3e002458bcc86798e307bc5845292aed69c8374b4a877170a3db8db8ac955b731bc977742c7faf3cf85061eaadeef7a6b8d54e352cd1125fa0d69bc429f05017c1cd9a2f7a5bf231a6e1b1e1dc2ac3606ba76534a68872af4ca27819ac2b17c789669c4121c32e84fdab3d2a71af2ee3634efa94a6522e7f5fcc3229f641c58fd460df7e2a383ee4f34a7b6f7424a186e6c17d9018c27685bfc431d0b3e313861837284ebcd73162e5839d7bcd479f12f5ecad3d6f3d4891e83cfb83ca843e6d929ed6831639ca01a84bb04e54ac19b3031a136cbf991822af0ee66cb1a80e764d03cb275e5ba2a6499fa3bceacc08f629ed4cf591993c9515e9dbff1f2269c194b696b72de5b61db3a9403986464e7c90071752b9912d46f7c3e1f4d4bf96c9d7611d0175641b5b0838c1eb2d52bf9b2bea7bfc06a63ee08db92e502da05e4f2fe89d69894847b7f0d572a133d4ea4ca0cca212a0ec5e0cd49f02de47752810d5d71f6defabd0317dc349d935ce97491a0535cce756b80e4d2b27fd236d1a18801334220ffb548081fe28481eedbb58b140c12351b49eeb320476b93adb1c963a7fcd90d2b886459d4d9cd5c458b126fcc817526e745029c908b99b752fd43ec4edd38a066ceb39b"; + plainText = "c15108636c53e25ea2466cbfb3a869624438ac155abe4ba1ae5df51c9b3561509083e1f6314d53b2efeaab4ade5add8bb5bac58f367b431ce8d0ef7d2cb85f864dd837d18a915865515a0b1f72576c96d892ccf1851dd2625b74800632941e3d2f5bce1804092a01446330a7b7c96427f1c1423f260c7b75ea65b08f6a5d191e9465b96a7d99e7fdb4eaa1a9ebd618b754532f3bf7d9038002ead2156ac0360dd60aebc6096eb370968de3c0acf1353539bafaa46df39d54481da77530c4ea6df591d291352bfd6262257c772f8f2e9dbe1a54f7cdb556d3a94caea9ff52252303515a9882bb70d107953f93263a4f82b8ff495f2411364ba1e10d2c4e654e376014b5130434444c5e6dc146c994ab990a0846c79228b6a16c3bff8dcf9566878ccd1be0a4d57cc32478b96ac33bc7d51e75f5fe4e74b9f9563abc72aa7a4439159e5ba16bf7d6df1aa497799b524e6aff76dce25df2ab058ba90008e58b1c4d4066e01769afdc8cf34206f9c25db3196e9afa7f30a4d9bb779d6bdcbbf2d56f42efb1da18b162947824ed95616fc73abc92adfe763e5d97956f7fa9b3a49251ed0d6cfbceb90f7c297a48fff55e08922935e5e24c63345f69d55d1c0b1fa2b3a3d2d45cf5905c578ebbfd2a8caff30034a1652969799a20439548cf21392453d70bcaac102224e136e853bf8231713942e21edc274172692bfe253a8e54b042"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 405; + dataLen = 4096; + combinedKey = "6766c79d788eb1d7b2ed628fc5778be1f19d5ea057e02eaf83c05507f67b1dca"; + iv = "7584a1ac1ea134814a64f49b0d1bf4d5"; + cipherText = "2b7cb06f53b1bdb5563e5def938f57fff305addb8f89eb35bfedb082d1c89d284719111313e05b5a611f78468d88ddc3a937fd78c334dfb96725037f39a4bd22fe88e35de89d4d66b91f0391644c95dbb66b1325facd6f19ea2af54b57486f773fe2514ed2caeeb78dd15c6973ca50f48e573d012196eac31239d8b48b18bba2112a8caa67ad441ce36a4ff88d782776328c8783c26ca0496637536a7b97ca5bf00ba8ad64fa198eff082fdaf9144fe450d51e45832d7cf52ee6cb24df7e3384189650bae2c24e24550c38e47bc39b6cb70ac9cba4a57a9e4ea193a0204e7dd766c47b61abc6a83b779f2f8aaf1046347a607b4c5cafaadbb57dccdc915332ce4ee6d36dad1f7c4c488d6d13d5cbd813964854daf14a849ff9552963e5730da55f89582c78c300050ed8f0383e664a8ade4eb92815309e75dad0d0f436b687b22c14cd156e091f4d6873b1b8d2946acbcbf488fc920a464ac8edd9f31231102a15689a9f5a2d3884bf19f84cc1fd4399fc8c2c2f3656e2e2d274afad2f2c661f6643da32359659e5bd58fde38810e7a2641b1660f01864aef5cc1da4594910dd5f8d12a14276beb296214d737eecb3670525bdc3254151cd93e48b9bf93a6012c66a343451b6e2c366b5d72efdb322323f6712b4e93804a10930f918260b13611c80f1ebdde89f84100467f063e1e9c385c654eb59777d50de4a26aea0f89233"; + plainText = "f73f90a57bac757be32c3087e0e9c7a960b5a6f4ae7c6838ad1db264fb25ecc17d629753732dbed8367781e77274a11bf965732e453f74e02a1e55ff83f10034ba13714c07ce33755d394fa7a75a71ebf31b57ff548deb4faf3fa07ac50521db2e48e7c1d881a91227182494199475065b8e96e5e8a53765a60abaa4d9af1956bbad9ad3cdd3778480780857d2d78b76ae3701488c026001d1e2d836f369232ffac679244f977df74f5ee73af362ffd60a918ec0745978450f7abe8499330fb7e97d860330b71f73cdea7413a5e3848088a59cfb98a056fa2406f0775d30edb51ed745b57c8878b83f5c6db88e495caaee4213c6ca024aae69c2e2ac75ef6685ecb4beabff423da89b5fe783b3e0ea75513275aba62b68ecbe5074c69e44c891cfb9ebf97a3e3a6e220f5a5781b45bd9c076e0546020ae7ae9c8e567baa685b7ba73ad189428754d19cd41c2bb80e327e7b89d5c6738d4c74d691c20bb061845c58515cbd15557ed2e2b4ec4a019443a3d5d6d7e571eff5caaf4f05e7c0d41eafafa473ed9d06cbbd99e621f5970a697b48819396e92ec8e8a2df5714311865b4fd985b05f3c27c293a5d5a8b325a66c5f4931ce279f4f24307961dfff933868eb448b769b615c78c094cd04eebf11ec0970cffbeb204a9a13f424eb56ef00e6532180b778cb56150a6065c2f45aaaae045e270bf8e5231fbee32e21bbabeb62"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 406; + dataLen = 4096; + combinedKey = "5437148e9daa40512b476a42b410b92d2c0850f87550a600096834e596e9b297"; + iv = "bb4e0ceafde081695deeece776d1ef4d"; + cipherText = "ec93b05534d1858c87f91be59cfcdfe904cbeaa0da3a770694f9c763ee72e6b45b52bb71b7e0fdc1f616c6baf29949ee5b3445fd72c57ac79265280f78a22aac554b1939a78bc32af322172fe758eb6feb924b9949a8de2f35ba1eaff1dc9eb96ad95d211b5e6e692b2a29a15301db57fccba3f4c7f5cef7a7a06fc56265d0458c6d4d3a633c854f87f37d218ef142eb21c16dc666fc714579002d3556b208bc0d348b5f72955a3d51b1713ed4905fd77f1847958f6d8c8a99c1e5eb75cf693059b3ef1380924817f3e635c2d683ce983ea60702e4bcb52fbec00384c570ea5a8dc427948408bb097d0b9e0be197b73d4050d845f46d73556eba6e37600e6e13ed42e6b3225b76b2859558109fbc7283c7afd6e21f9ea64e429e723afe5edb2645020ed50aa059dd12373529c8f018ff4497abb1917be301fe24d9f0054ed03d330ec142b1d43dd557f26fa388dc70e80fd762c9e97b60c62063336e3a5c07d473432797dc166c73eb5122185f7e620a0fbdc99245bf18f861b393054bb39e25a573738666a6e373458765a90742957218278ad118d9bf5315689116401c2c47c6643806c819decb3813ed6300f032ab6f531fd8b2968ed85351e87c488149c63d34265d2acbc5f623c51f7400a3f9be69ff9039574e9d80ae508e47451f24431901d26b4559b97c62058838a352cc5178e422f8201aad68a5c0f47673accd7b"; + plainText = "65ead426dc53fb4911c2902e8007560306850cb3b99a92dd5ce61be36ce9070dd8fd43f8949664a4a724d3f40d9c1ff23cbabf32c5445eb0cc61e756be25c10d857f333941e1045f2356891f34f124fca56e6c033d2100d922c4c8568b9e9e75967078903b54914564a830757a0d5501211312e8c114206023ea08c4e350dc5b368e3dccef080eb668025908011a3daffd2e2b619621a0ded7fe9674214d8d9b1edbbb6c05becc2895ce36061afea25c40af58d134e1a748f79eacdcec5589f8127e84f5836a7aab97f6e4fedbab4229b12d63c73ee8cac1b9b2629834647e816d924850626f1105c6e605fb50a508e754653cbf66d6b99e802fa4f97c509669dcdd8cfd32dfabceaa9b6a63a48fd4c88b917f514f27d2a405ee0192a13873765bc86c1a6ff669d8fc74f351addfea5f93d80910e6d08a9f93f41332ea5159eb7838488895d797a599eb43438adb59b5a2b5019a6e3ce93420cd9a198aa796b2e539846d69e7d66e017bf26a69ec76bee971e3baf57d0fae724145fff758cfa31f80ac01110521875f252e0c816154ac4bfb38199a5c506a496901e307cab380f3df5b8771c439a1639964b65843ebd402d82a550c397a485bdfb926c9fce1ddd4b6526a85da7cc2dd94c964c58b90342ee12de56f608650c38d5ea266a349183746bd9065555c73c0171a78417e6c560ff2e2b23c1ddd63d4b0bc95a5041a00"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 407; + dataLen = 4096; + combinedKey = "c1f6a9b439f5e824b470b5de7fafb57ebb98aa66f720849a3b9ba2c3d27edecc"; + iv = "24febe3c99a51dba8d7fb409c23b870b"; + cipherText = "6ed0f6ed80d5cf6aa6813a501bc72c9cb2b45100e7015cee5dd23ece61d0e19d5774a76c65270be82aeb9101d94e9b8fe717f8a72f6c3037508efe99b1489b7c63af31a01bc973d8e26077c6cdea6ef33564ac989e815909a985fe27665cc6bb143cdd81e8bea9ec31781c7c5d4067433525f4b43cb73820a03d14c21a6a94aa01036ee538b9a85a41565a7816dae2f9def3d1f1d67cb27a1b0a0445f2d91a2cfd1e2a55705856dde158e4cd9294b6f573eb546b1d4d2b541470068fb8ffd96958b66853558d61dc26732c7bad5168638cd629990a5c8cf1477e5f74996e6646c7e3f5156f79b1591df4d7fd0489ac3db7ed919a2f7e475a9506b2a13d7b23980d467991be4ba076371a7a56e33953227d0be2d3d746776ec035a7d45ff89afc4cecc5d1a6bc08a63ef4fb8efd6651299c3572494a9cf5d3abda49f29349415cf32f27937e1a57e27c29f14d69d92266d0767ca31becce0728260ef3c1da192b7f4fa53a86b0cce8e81c716028a6e2509b4b599c5bd29258113ae8638fccb2aa492b6cf8c2679b8bc53bc60fe03f32643dc5ddd61baffb2bdc9f5d619dc9369d16c1d4d6a1375435448675b270b187094d6339d5f798315e8120dd25af4f49f5cc58afa6a00f89fa00223f7552442c619029990f46f13e14ed270c73e360b67b28b468b99b9a8124af04ce1a91d8d60af2cee8a64891a5e22b5a49992c281e81"; + plainText = "7301505627d1b42842a85d74688b52407c1f9e20e9b0a94d8fdf1fc9561d804b85d8b50a9c5ec08ce4f0d9d8542e6ba2077840ec054cafe04a7440d5003903e455d8b39f53c940b365e573e5866d33f4cbb23b65f9119d89f60273dae20338f8048d7e921e4968b230044e287ab3d384481999dbfb9f457a91739b976969a7c43f6717281406011e68345233d4de936ff8d6b83dadaf3d11b3cd968d5d44a2e191631549d3ea5cf02aa021c5b2d52a269cb8ca4165c15a109ff60973c7f8fd3d630b03ddf6cf69254d2631863580a37bbf609af6690c3091cab385a7ea513405cb866cf7dcb7b8e8a1feeae975b043f117d777226d2bebdb585363e69c4fcd6e1e3c210a930ee289f0da6df6ce20f925f88f509ea2d6b2303e6cfa6fe63ef9b0ef5d5417b61799bc216cc5ba857834e31e312c0d1a19a3b2d6e4d871f26c9da8f713acc209368fdd555e304374d7c997a5425824e3253b9950271928e4145b041f1b60c59dcb114a916c28da46cbdc81949068dad28941446e6981a659346744afa001018bddb98039549e81be6f8742a2942db74676306107d75c7de44da4dec29c3a2703437b23d74399c63d436a79ddf1a1763bfd06617e8cc83347f586c68b2ea179d046ed30235820d073fb99404fd759a63fef4370d1420fdee7a8995e82ff4aa1ca14074b7306f60aca1e93f84a8f2b2eca3533a45a3f9eb58d9cfdc2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 408; + dataLen = 4096; + combinedKey = "e49c9c5389be5cdbe9e356b477192b3a689b2d590f798772c066b471f6c53f65"; + iv = "517a5162a1520ce58930d5bd25b040ac"; + cipherText = "43893c7e10b80be89bfaa9fb4fb9e896c541175107f8f797e9ae4d72c14fa0fb7bd47df6d79c869a218843cb083f8cf6e28bde65a1a6ac31a588472b324729cd2378c76fcd786a3c6dc30d4b8aaf136c921976cb023e6e464a2fb1075bed72cff9b5c32e0f54b7f5f5d26306f85bf96b14a9fe8800e6ed1d76938c5dd3021c180c3d283cda4d4a63912b7c7a74325ff8c3e72f80fd7c4724aa388a0d4bb9e8c52df3b244c396836118e6d30e8fc84f8471e9dc61df48d438b265408824f7ee6d341c44e19cb9defe3697b8cb8fe517be52eecc245b00bd9e3571d6f17e7299fbf5bd764b5335865cca332d949ddd07212ae356e07b9bc7018035193000b6b6464b89e22f3d193491bd76ba110fd5b88b3521b8a9b37e2111cad7f906446024cff2fcfd9c4785b046edf1ab27a7b2c179b7dd5be137600a9a9598d066cd3313baeb8edd2374c38ccf8fc09ab7f1ed23a3905e8a595e954fc0462589288a78f1e6b4799e34be57c719997d1eca1ff90877f35383701845d5e44b838fff5665592377b88b0c6792e07f0bd3da99fafde61952bd666d4ed03ab08bb2bcbf6273dda2f79e1d16af0e08af87e09db5f4852d23ad3d5666b5d363df436e9a885ef8ec7477331155862f4a875c426653eb27932edbebd8243aed3465a2de89d2047e272594da1df217b42d61a1c137afefd593d9db907c0e92edc7abbcaf4e995c77c947"; + plainText = "eee6d228a9ff82124efd5c8ac208df5b31675871ea014152f904a8bd26b24afc8bd525a9f74ab78b0c1b77a24ca0c69f483d0dc0c302f6cff10882b48bc075310809e661c534acc6d5c7e6cc6d6d22e8b9a69d85f86148f1dd4a9b492c25134b39412875d67e98ef552ef023993141c04d7e10dfabbad3891c34b8c777cef844a8df496b9a97127fd1c9b2a9c39a802e912270c4664c52f970da9404718c11e114ff9791b4990aec03ed6fd3bcb3e4cf2af3a8f36965306a84b1f77a5ce7c8c62ce5e5d0746bf76d9a95f0807abca8b4ab2c0fe6a87b8059698b04c77398099eaa201bf69029a96aa9b538cd5e09c550a18f943ec85397773929a32df84bd9a30cf7ba58984a131b4e3952e0be8331d5f4fe76d7577443f50fee73fdcf5a6ebb9477c03988568a9974d9339444b59bce222525b2ff61010797e20e28dddeeb6ebbaede46e693a409cf339dc05025d65679eb80b50e539a317bb886533c399d8ef59cf2cd33d9b0bdccdc781632229c4dc88a4c6b5c2574953118a7ce34897c619fc3f196038d1773e8d5e80000357ec96010a0e5d8dc7a4d3a2934f5469925772ed0db6226f3b8bbe84f1a45a424950992e6436b9bc8aeadb395e4866a94cf26ef6b891676414e25941af9d0a9fd696fa8548b26545c3113fd58d14989555c8ab0b937398dce10edb19cdb25556a4a9d07c8a989effe8cbfeffa499e354e6dfc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 409; + dataLen = 4096; + combinedKey = "05e9deddb073b8d8898a422c2864bedbbcf01f3588ba3b10f7dc06e33b78a5ae"; + iv = "72d7c8e450a05f1eb96ef4bb30e16508"; + cipherText = "06d4224bcf08748869c7a5008d0aea2d7056f0024ea4e027a3fad91b6c0b8356877e2451d99df85b9c3bdd99f5990846f8e1d4e83f2ac15b14995b9f22f5d432505a9fcf0985f08f3d34e26517b2361c01f97c06405a1f463b0cc0ce2c00be6018a640878f578b41985dce318c3df4dff4821e1d363c8fc2fa1396bc2dae53015b0379b741fb50fe7f83e1e025c9e819846bb38124c45dab88efce8451a639f36fe92cee8aecd1a3cfa78134bb3629f1469d3148d82bdf348a9cd13bfa29296f8ba5689be1bf4a873dacfe78d3c38546381230d17e9fa1255f3901fbb06d8c93973936f5df934ec980f63d43e94bd488c72fa9c8673e5692d3a39df904a13485cbe6877037492d041294fe93f1e889b4ff3f978dc8c592b12015b8200e87710b206ce9ca999d8d5f3e9a458bac29978108870d0a803748fafc9a976836be2a4ed39c6d0eccdea9bad9fc2ce2c717f2919e97b8772f28640001f07620ca514fb60acfbdfb18c4cdf6ff6e0a1e1f82fa12cb5099531efda3763a4a4290f22aeba4caa57aaabe6a03cf044234113d2b0b61d8bc60cd04946eed75dcee163c7c3f08658511f32244d31673aa4d97c48dc30e30af2aece91abd8dbda80ad076c41259ce01d42aed7da76968b81d658ad40c156628da62e3be2663c1a305ed8e9f921fbdd7a339b5d402076fdcd42ad527cc2845e4c7ba70fb8d943a2e86d42265d6dd"; + plainText = "c4da06c018c0f95ce7dbbe7d530a784ac6b12eb4408baa1facbfd441d24fdbb811f2bce87b1a770076ff1b75aa51b42d71b0779ad96f93914e97a5424ae6a8aaaf06829ec1fd5f49beb512611b776a4c15f5d86595eabd74aaf102d4530ed8b3cf2ae4711ecd89c35f550698b07c4e26bc4e5474dade1a0e5379f89044cd6b572a0518a831c36ba0ed74b2b89ebc87ee7b805370b596be6632a5202f69002b2408567bb2a4e6d290390ff5cf195b9310c88c6ebc1540b08acd2beffc4b2147d3266df7e26285ad3993ec38c02a6c188170206a321f53b92841878f2e19341350e944a3070ac2ecaf630065127ad0020c2bd1fce0a6ed33e90b5ec657b5db61388beef0d6a08b994468f2f50709f71747f801d6c339f8f282531fe7a740ffce3fde1ac319be8d89914d28a7bd07325f4979d78557089ea6caded3aeebca9d5ea66acf169ce708841789001335d2415de0cabf129a1198e4e6ab5d45a264106ef233e6029e0b10124bc191a5b852d01eba8a25d0ed383e3dd0c2494a863ffb83a9bae3e0bdd4ab3c2ea8a2c73a87cd5a75d0fc5835450a637811309f602146c4dcadeabe7cdbc0ed6b3db1109b8c8630ead691207d851c7b99ba7f39fe58d6979707c1292cfd74ef3966b669e23c51926e7a6753fc7f0f80223fb266fd663f6bc760b9f4b1d9dbf78d3f4d631457f66acfcc2c90fdbacf19a90dc5016ec8c984d3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 410; + dataLen = 4096; + combinedKey = "98a45f729bc7b8f58fa06b54923d961e25d1367cc73373c1aede039220b5ccf7"; + iv = "650ace9261b276f9567e0b1bfb5944ed"; + cipherText = "f0208448a7bd1322cc03d97416b3f6bed98dd447f97a2d269b9e95a885e64c7285389dfc58ec9db2ecb36394cfb74b3667fb71d3583d7baae55af03e5b1b38a5e8978ae52a03e161a3229992147b4afa7ca32a0cc8fa24d59787f206e71285a7703566dc231e63546970b92640d7f6262dbbf05a973346b2035c8113c4090f766add8e651e078d4f255b7e53355f3b92b90fdae4ab0a47a1285fa93ea5befeb5f5e85214870a328f33eccaf49a9f9dc2bc924032c9c16e6f39e5302b58e3ee17d4d2c569b41a3b4edaa60822e804f869e155b36e873704ec336502241e815ca8b3b83e128b39870168048151f5535bee36a7530f03d812de171b462db81f04018b2ef4aead73e044de49dafe5c45940bc95f4e88a6008e693538343e8285d0cdc959600f4c7cbb426ea2829d3653e8cb427960d2d22bb9db4750603beb33dbbe0a6cddb7a0627e5b813f1cf54690ebf3e4f601fd1a07848fc85c744f870086ce2be83e52ae25a841acf7148ba8063e78070e70ce6a884832c67a6f1f5f3874204d6d121e381f2df74045d2a0746f3c1379101d0837fb9728342a5ee1ee0a2164adc6b5931ea3aec16b1d75364cb929021c4b9fa5bfa6956d65fa28058fd308885e5c888c5dffb63825786f8f4ffceb662f163d45f2b4c41848ce80eaa276ff392ac6ca681b07971662b6047423a25dac2934f44413aa4cbd2708f662d96b53b1"; + plainText = "dd5df3e5f91849147b52b17269ca46efe2253e65784fe7274eb0bbeb2f96cbd2973540723b9c5e1bf4ab838a22a21823e8e71018c71ca4db843483b40fce7eef19725f473aed853e1cddcface5ac3352d4a88520f589b09de70e7c8498776284bceede06b0ce53aba6bab0f1fae6a2e74191f67c995891787e57152597ee926d41109f41dd0fc55230400e2971bb33dc4c30cf19b399b989f824575aac4ab710cfc123e7a7ea619ecc9a75bf3795ec44b952a08c0543e2ffffcb14ad9500b9d8aad828921e8f9c48f00415e6c26399259af0343067834bacb92a1d66a31ac9379dc354728e0cb18d0c69a63c751b3711f9a2fd609f4a55ace9706cabcb52f026058c21181c683de4a321279fcfa3080507526bf0517da8a0cd6ceb336dbb6ba30566e69b533b643a10dd2c05f4c71e7535f287e912ba51642d4c2d44b324e96d676e4592d7146ef360a5bbba34bd1fc4fbe903b34a02db2cae3599729b43bdddfc1f40e9e961a5ed73f5d4c251cda2fb44e6b711a3fd51f60423af7e9c3072618970940a3dca32928a79feac51a4d09397e0d57e98cc742ad611589c1dcdb7553d47e968a5fcdebf6a3a2d62b588d492b8d1362365c9cebdedd652da2581aaf8b889811692cc104ccc2f5f074b55ba31c43b6d32ebfec4b0675bf1ba7e60a0753f9321809d4018713de45d5395191a47a36c2efceef23e6c47627893e3f0527b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 411; + dataLen = 4096; + combinedKey = "d4d472255a8873c6469c75425981de0b09beb35ae7c431dd433319894fffec0f"; + iv = "dc6d784ff2e17cdf08e3cb5729a30e01"; + cipherText = "ea75e723c9bd96ebc1d25920a8a42e436a7c70c2816971aaa118fc9950b67bfe4c166f5f05026e20b86b118a3f45775c1e9841191f1b53f265a933271b389ea3d55bbc489af775a767d235368a98e0c30209727f9187617182df055579939de79396b75c4757e7302fd214dbcfde73982251fbbd16bac97689419cd88e9299528d8f371c00613d9a24347bed5d62f11f984e99184e8ab40c172c0e57dd519eed2454fa5f066c3dfb9a5cd683ba56cc2f523e05537d165e8345fb1a2f19dcfa279ee711cc793474c8cdc55bca1ddae5bed02cd925e7ac6dddda3eec4db2a663393a147af9cd047da296c2ae021a6ae156b5140febc440bb06ed56d6c4be9e3e7cecef423d236a00b50c87cc26bfcc3816469da6ad48fad433a1ee50dfde5886503ea5427a611e3b3b9a81ccf0cf17b951a4494057706881399ec060c6151ae3657b28be1873b50d48f83c15f6f52da59f76a2c6df2bc979e80efa90d2be05c9f8345f270db389879e1bf967204f47e318011fa0fc921c5264ae7a85244a96d6072a1772db74e9b2c038e934ab7d8f18de9af1979bcab3ecad2ff984e9ffaed473ceec530334a479392432838764a5d27503b65dc27358154d5a3786237e9561152853b2ef32db1c4da7379f24ee1eb77599dcbacaa0bd2d4482fb9d8472ead2a617d948587062e8dd55e37233aba842465996a90768886a3b98880bc7ecca4841"; + plainText = "61a59e05bc2f779c1682192c63373924d845360cc031e8588de238ab63f92c9a5d88a9f607633f1ad21a01ca2b6311846fdf3ad59a392b718314fe5c3b9535cb93025b457e5829fe14d859d909cfc7ec8a97e1e5613cb713375efd04fdcb244df48477bd7e148e1ace187f04d482e4b1b2ddcb76f1b3aa1c0b81ae40f020e72085277ef32b765c2977504a72d47f2fbfba77120bb5847cdd482cb2d0799b739aa2a150245e1bae94038b2d03b00aace3f951a80608086ce396dc939ebdd12ad8b1e22e9d747dcf30916022e99fc5b770507af4f43eba075844d270abdaa2d0146eac70b039836bccb14871acac18351e1ec49c062079b9ea4f8c6cfec57389015b03bc1266e279946e35a2fc530f4c22575c055c5d73b7d8f9a2977b072a38e2e4d4c712046e65d8b3572075bb9841a53305b6e53dc95c2fcace986f2e19e4aae4f25dc88a7fbe286b8eea9cedcbfcfd7df3be4861998f7f3083ddad258289f9532fdc6b1b9ec9e0dbec69d5eab7f1566007cb4be848e32265289c432e47666a76aba39a45850876888d670f37a41206fe35a6f8554be577d57f3659eabcc3d1e8aa4d2006bf2899c7420e4f756bec4eb5d0fcbd35e4c876eb35e8c5eb0ace2cd8b8d9baac125a1c4d7a77b5ade6a8b07309284a37743ffb4e6282d5fa59654d12f0942f890362a20bccf2b27611b921db52197f7ed2397b91e33405a34a4154"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 412; + dataLen = 4096; + combinedKey = "5d141972dd23d23bfece87a1b1bb5e46451b003b702b1d7eafdf6f8b96031899"; + iv = "a2277a33424852c65a69a4c3879e1554"; + cipherText = "44c3d5e0fefd2a0d298a2d74239fb600c80293c32da43baacf669d308b3e9424baa5bc83983c4d1cc35a37c4397fdba3e882f25fe82d7d376e8f843bad895d3a761e8c32bb0eb66b3beb78ddc7a33d6e61c4cbfa41b620b27623dded9362c5ddf569518bfee3b78e37605759bf73bac236b0e3766f698f0837ed46a8f4b921e2fe8e99d6ec6e3e68dd8be7b3396a72c5ddf24ea2c917af7032d1ce0de3eac8668327582a8dcd51acaa8392a5d2d223368d0e4e7b11500fd1ce9c24dcc65d01e6c7ec30719c38782048977df72124722c2c5b61be4e37e23c225693e8902f2576256a30a3b8d63f236eb192468d12ac4bc10f3f91e0530649eb4d58dab58a5e9a64dab7e711ab7c707dedc7df56e56bb0eaa7a8872adf9dd014c1e8b965a44c152e767a9eacebd2cd2619c72676d9209a3fa969cdc3a24d03a8d8f75bdcd55eba8b25af9784fc694c99035c6be7a4a659f7281f8506958e0bb3c80a7aad6e88809a2b6afb13a10c804b8013c6fe66845c3ab9faed16aa5eaa2192fb126a66a831893e99a60e11cf0a97302f49152cf68ef6082ebc6336fdb09fe7b87270fa14efbd1666ce9ca1d3226469a161ce5918050fd6bb73a30176b07a77b38a9ac3015ad8823bef9275d5cce740f5111b9bff3346c7796d7091b1129c310aa17a3c3e94fa9f36124af44733f02fd8792e5b223c48e400159e93cc4d0a539fe9ce105cb3"; + plainText = "38c841c74628937df1dbc1b6dbf5e9f660a86fb7abff1ffffd0e527fa627043cd7519c774cef991165ed55658d746a585b6942d15eee1746336588be61a46da2dbaf5640ecf0996c8f2a9a1cc2326da37c4773714a3a1eb56591fbecab45f2afb3ff1e6a74c1c5cd006d62508b76df145b7f6fcc2882df06e2cc135135820fd188223a0ec55cc9cffd1ca2b627d3cd047a34ae45184157bcda6fe83703d19c288e7f747fc35e9c9ddc9a3a9ba8a2abf66d941240ff70760782b2f0724aab5acfa2e092502a0a72e33d8db4891df3430faa07933ccd6b5201cf1458520ac2f7573fb7c5d06802db659fd07bd1a3c1ec942f975bac2fd2ff68e5417dabe63e45a70837f418cd251999e5e348d8f4076e6e17910d550975cc5acd01ccd9cca60db14a50cdc21d6c5b55f94d3bee3fc7563097e3ce07a0a30170df0bb960376fc7b98a07b2cd2fb23e333c3491def9fd214a62917849756a430645744260ccfc67d7aa6f8f703460226bba8329aeff8c48d72457c7355d9561ddf11736814b1ae13a3d18b272a955c26ac1a13ee19c170ca3cafd00ca1f23b944ceccfaa763f1a205d1af91631e1a65cdcde73912581b793ccaf2d18f58ce3c9b95117106a20264e18c504945ea5af7440bf59fd7d275da0210864804995098f827d8531d689639302905eecd655577399f6bc486a1eab02ae2348494299379c93caad8a874568f86"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 413; + dataLen = 4096; + combinedKey = "72ea7faefcb940e380e84933f26a2f342d91e417494b6328cdba202b636ec37d"; + iv = "f00e432ae06276dac9f72f004925042f"; + cipherText = "1b0bbe688d97c5fd14ec9552a2ca8ae4d43d32fb2a0f90073454fde0f9d2b34bc3539a93962e26e78af574bb5b2d6fac7e65f69305c671f7b317180495c5b2b4d91bdb10385c4af90565eee58d448daf68686603a460314a6807571c370f102da9213b04f82602202c17c6024cf06bf10731174c110c6d7f21e227531f7bd2b2bc135d3910d49fb733e42b3d94fa0627a8b0caf9133d1cc62faba41748d6bcfb1ffe7d961da1a2975c3135d1148eef53cdec9911ae8265fce293636dc61456cd11877d4684e5e2ea2799801c05f15e4f1903646212ec5044ebd8ebd642a1e97c2ed4f343bdb051a8ef0355a28e4e09c17e61161c429c661163e40f1af331ccaaf1e5bb35b3a09758ba9e02d106873dd530c2bfc59eb3677b6b4c478e55afed6a187b2d035dba8f4c758ced515af50511a03ba4c78dcbd22682933b58cc5b073852ac613cd1d809722382d0308ca274dbe2c8d4c3e7e9f17cef98d09953e851cd0bd103535fd5b6596fdfe3b25e4b6cb2e765c72617aa62c1a57fde631ff62d66d0d39475c8df451edb74c127854e1545c1961fad2c9d7fbc051c06b2d3dfb6b0c6c6e6545893f770cbde3bac1fa68836daac03e1d71677b609a11f091af71ab3a1e43722301beded836c183dedb67fe8861a088b0d42ea718bc685161d4d6591e6f4729a02dceef288d81025b88cea7c427a6881d16f6d60570779ce575b41f4"; + plainText = "77fb2f41218a03d8881a6b283b1aacc2a522f72f04fe3c491b35a34f04d8664aceac08d532add623313018643a359ef315281bc35c58ffede8559865e615170e2f7b42d2b17b8771d4454367ceef7d4a20560d87f06371dd112c0b7aee9b02b767f77074a4d3097cb0d7028ebbf6d5054f0335f4ab02dbc9c514882e1246c58a3b362c18edf1e3266d2d7446c05893908773644e94f195c56f01529aa674233d10bd316afaa15a0adbb2a809cb080bce2eedb62c7157c1f894e4d39ab7dacfa47dae3b7411de297cebc733a74e6e9026619896a12e524b8fb4b70c872766a2c64b55df9c940d6a932f8af2c7ab8921f330afc98bf7ade52379d5d7407198926e4477e6b12cbab9a86369713f96e02976d0b50ff42494b0762363a1284ab0d782bc2971ab700167781012afb1c716a76196609e95c61f954b8a37f8ff94811569bb211a2abd1c159321e684986d391917c084f2b082dad8c62815231e2f6cbe924440206df3caba63c82466d24279b714a34cf35b46a30246ff84264e1859a4d3e2298991846d9239736da584e435cdf7b183fbae86c03804fb41de9cd379ccf912c3a902219ea261d45052d684625858fb434ca31f923483f5ffb3ee1944867ecc71b3442524f91ea1675380e8fca16aa9a8bc815f77dee8615f2610f45b7c9e63fa9c2b23498fae26def794ef0e36dc2e51801c44c862b6360d1c6f4e5d801e"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 414; + dataLen = 4096; + combinedKey = "d9bc5729526a7531eabfaa25c5e4e35ce9c5ac09f398383ced72fae2a8dfa4fc"; + iv = "26b2cf04a74d2496d4513ec01c63811b"; + cipherText = "b03639245cc96d8ba830f7c37e6257c6521ec6eb84784ca07fd8d092059793e301400e0e2a142e90cd10446b8d7a79244af3ab375efb4bf968e110f89a0ed764da0f828413fef94c44810d19f8a3993ee00b19b04ce1ae879411770d7aef677fd5e3364e1400ca53396230e9cb24210cc7751a70ab528655be138bd47e5837f2ac0085a9515d81d8072f1d72c1cc8b982bbb8faf6359a455167549a4c3237aa69fe255189a14053310b7ce24b2b8339adb335185b5d61b64b9aaa113baa6e79655cf3f7caf730c185458b312e187ecb74db8030488469168edebe51f7a4df5556ad9b70056948e823935919bb25aa18254c7512ac83a934ccfda2a5c17c7a59dece342ddcb67b55c84ae93e950252048cf42c8bc4183dd0a71fa1b076a1647dd9a35cfebc39e25eb94014abaf959e9c2d9c4e4cbda243a13f281f2102e88abca98388b53c3984f6bb4481241efbc2065edcca758ca6e797099dab3281213d3f13cad99e1b3c2063064035392fe57f559009f1736e18e66367ed0e98e2b80ef93a02ee7f2167e7303495d6062a8456fd6ecd99dbd7c1a269a45c376760f699cb024d00ffa2db346837bb0b7468147fff0e7d79bca45fde1d0db075c39698b9deb768f28c7443d823bca37225529b39bdd7cc3c7d0cfa6cea3d7b56af7f328415a971bc94b9c2dbe43dc48c0cffb2f098bba816921c30e69756c11a1304fbeddb5"; + plainText = "6fc8c39a448ab3cf8c0061a10f75fcdd5b9df4a0aeb1b8b94eac79f4078e7b8c96e7eb6d80ae959c7fb75ec503a503934b6708fc1849be19e73baeaad1fc32656f08eb11ee4f99fa0f2600da92f1abb6ef07d9d36aa263c3fd86a6ef4c1dc95b5579b333d3e0e9e8011258caded11d1d63998eb3f7cc57f05a6b65b378e4fbc948a2847dc973397bd6c2ed849f2cd6f5c0f46c736bb7759761c81e6d90fc305931108e93b59d7fd9aff245f84c0233aa7f874ba855ecd3d42cdb722755edbc3d633f24123399c229d24afad9b07dc9b6fd63aa5ff215c57e1b7c6dec2313140b3c707c8a04042a7046c426b1618a344616016603b35fa4754ba77c77d52b266041cd562763af52f7d8fb1e834f1e884d0d364e62ffbdb4408d7cce963a576b45768fc5959588886b5ad18bef1a2b672c5873ac9d192237f6eabe90a7f956dcb0226c21c304710282ff401fd22b2374c36ff59f56ab58ac2c99eb88e50fd19f76714a6c148ad76903d173ef79a052ff7ff0cd4ad28e9dea04265511a8d2be0c3cdbbbea8d51a4f3b07876d466958f5521926d84ca3b784f352f0ccbd76e768ef6979f8acbf8da9e21918d93a6fb0731951652e039df293af44212e9e2575964b40cb3665a32d25329bedf260be5baa2d1173d4d2e53c8b8b5a0debe8b0bfbe79a68eefb97abea9244041ebe42630ba137cf9b404ca6098c309e6ef1ac98d26375"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 415; + dataLen = 4096; + combinedKey = "d2d5efaadeacc2e36882e32fa2bba6d1775cccd3fc4363180687cf2bf2033260"; + iv = "a4886c339910fad02430c78fe5529ada"; + cipherText = "7be58c0a4f1e9ede3f2275e5a1845c041863f1a64291c0f21299ab181c65a62512df0064625b5420b335bc1401e40a939fc3e201b1ddfd8aa7ec047ef1b253419f3c0eb5ce11cd098242ca3866521b2affa8173ae01a3d3a700b06d6ce1e0826d5a427659366b698821b2688971c3adb875c6ffb3dc73ca33c3b683c3e3e4eecfdbf263b0b1af8e1b14c82950d2cd897701033f0c76d180b90bcecf9863ca3403639e80bf02e3fa5eafd5466d6ccd04f128565ddc176ea293b09b8c1488b02306f1f2274c37115ed68ad0c4194b0bf0d9eefe6b293260febb99db89138af471a40f787c515dfc07f9de793beb7bfd90e5a5daa664157a4986c0a202225b25c6265b582e9b3cdac96fa9352c912c029401559ba34b339510a2d18e8acad0e57e3a68fd4a051e5fbc719bd947f63b8b5058787c04fc5961a8264d7c89a5a198ece28080f7c96109aae0aa770a973df888bead3cce59763c9c48f00fc9e80fe30cf82507f312e5bbf8871c9545a7aca23d00342c177bf367f99b0c39da17db148abeffed8cf8a46b68c70fb72ce017d708f3753055ef2cd74a180fc75015dd5e56a54fbb831a807f4868c368881cc32669f01ba0be662d020439c172a0c9b2c7a52bc1cad5d91e1184bf499723dcd2ae7c8424e01077ea88b3f3a477e08ccaaca022553add269c7c26b541da53b69ef71828782ed855815b9f2e5b271a61832e935"; + plainText = "65a21ec4d2b7b208bdc9b23f5de5f0a7c730cb9353ad1c5dc1293948041ca873d442178472973b6a560120142c55d09936619142498fcd4020d2322d0d3b97a9f04d7ec63abee8dc7db2fcb62b855bd79eccc3195f94694d95f48182abe10a82a11b0516450e3b5e847bd7b60831ad90b65469203518dceab8538a827f4cb653688dbdc75cb3a401d258cf61d5f61562586790e9b02f8ca5ae3314c798f88e9ba1ea0c2a50d8fb2fd071967dd8d72d0973bc219728205c885a792b35eddd1e7d702e70dd0284b155d2a4b4ecbeb3a60fadc125b6a43824727f212cac2acac094295193d5cd1d90bf53ab9d27cc05307499a94ef67d1bd9a15ad6a9919188c012a85221c4c0f5a3520c008638aeb33e99ea0de3b1c8049d800c19c630b4d239a8ceb65690b168f03bf170ca1cea3d189d168be0e258cd3c19894bccc8aea92ffc417d6ea50ef96a845c9ac521ac0b8bcff3b63d816507460895a248886cae55dc7eca731353eaa278d8dbc3d134c950ed47b79cc5a3ee1659fa48d88c11e25c587be1dd23d17a46a72f9024f574a43091d7da33cf197a057e52691786767b2ff5a55c673ce237d40b92c37fd3cd9c4b93364da090513c7b4e2104411b68053faea6b689a0fb3bc8b8cbb550fcdb7648d5a53155bb19f961deff1343cb44bfe5aa206dcf76051aaa51269da0c5c85ac6b2fa20cadeaab87a8d00c31b374939d719"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 416; + dataLen = 4096; + combinedKey = "4327d814b6240caef02ffe6c03fec130a1d4896d005f145acded67df014f18ad"; + iv = "266c48bce0e96200e07ca5c7bb1b0ed3"; + cipherText = "aa65a592851eb42d0ff5cdd051178e25bf4ae1a4602a78b61303f71b5a36b3299908741b59e05c1184696eaa95c446762d8ba0ff8dcd12c0c5db59a7595a239a26f894ab099dd1567a40e9e9a19a3ec12d67a3f3b51efbd8a8fb5d9b67102d7b09d796c640854c0a84b6b2b1c96bb393c80e2a7f2b588bbd2992d150c1f05ddfaf883e30493bd57242388c0749f5dc6ce59e23220540ced71b2b0fedf2ac91fc262537185867a0cfabbafda5c09b5b4a20d94440d1fc06b0042f0adfd05e1143abe94846e99f081099b3bb4bff21255d4b618c112eee40b07592151cd1d464df82b571674569f8c3c94c58f5f68fa84c6d463d55e15184512fedc2d6fa3903c8b507b9afbd0d18ba56e23e0352aac558f9bb6de8cc8cb32ef815ff326a321401fe22fcdfdc75345ec78922eb92262d835702bed2f98a81f8e18e1342ddd4e032bd095d5f4be0d438ccaa939e10beac868b5bdf1da973acb23fbbe3e56dbb3991510a8ba52797f391a49bfd9b2a439cb6f360142f6817614299e19b7b8dc489a9b929e0683caf1b7c361ba76a59ab601c21de8f4409214da28490bfbc5c5064e73fb44f77ddb81a5363e8d64db043891c3325062202b00bde3f627ab380babb271ed13811f568d06b5107442e17c8d1da4bd0e41ad7c5fa6907e0baa542fd750fd6e76f415e4c6cf79522c30acf58b88a2c5bc68200182bc0a54d5d871a5f947e"; + plainText = "49da49bb0e016af530ba9dd825a6673b83881dfc7152faed04c58d1b762a3f32d302abf2305ec8a5d2fcc605c899acaaeb76b68019cfa6644eb5005f8c1117b11053e01eb7439ddc2c72c8ad4935f7512362d2aa471223849d236f9dc2d9b263669d45b8c9462bd2dbb14d05176ab1f8e1291486e9ceabad2c45860af0c4f6f3bd084577075c259ba68f02fa50eaafaa42f56603edfad972cfdb0e56367592f8105f5d23f29df80afcb27da8970986527e8eb2a105d588cdeee03ba6acf311a215985d143a3fe5ac99fc004980e9fe45880defd8e158e53f2e7b93f313c018fc08189d814bd76555bbbc7e0f187d5397dcc3a01625a75f625649fc425dfa8ad5a36d35285108457142fa13193f4dfb6d2b4dcb0c03d16b5d315c353bad53e8e98dbfd6764f34f0979f5f18baeaf7eaad7def67d25489ab5b5f70a10df4e7f18ed4fa191fadabed4dc4aa599116bef6e7d6adb33ee889cb38da066fa7fa1f14895bb8fe6fc1f86f3eec41dcdb73aa47e69fcafb565d82382685337b5ba8b8183350b7ee6f04e5cbf76b06f412d41eb64e365bce1697cc5f33b484742b73674395e0c3fb95cc2863df0fb02499b11d7424d806f4d0b606a41743c7a256ebee06bde1ec0d36f3dce2430a78dcbd99d4a963aaa61526ecd17eceb5ff954d289669f9e6114a6f33604ea564f5ff85945abdef396f7dcac3c43b48cddafc665e83ea47"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 417; + dataLen = 4096; + combinedKey = "5b032dbc5c5e2e133f602db79260c36a0e16bb91fd2f7fab31847a9503e92178"; + iv = "ce55613b646dab22db297ab41b50a1d6"; + cipherText = "c10e9ba040d7f8fdd981c00546929db615fe0497bff9fa35c6cd8d15723054e3ad84bbccf8acaef11242a56789ebee81f712914720a28dbb0ac377ff67b1f9c0cf14b1662ec22e5d23924a047e7b74c0c581afc27c7ce76d66f8d09034b6b6d36e11589e7358b4a61e344bd08c0244fc468d1f86ad3bc8f4976e0669d3b4f59361456fbe29f9b0b595f6d954d5b492545f9e37342df2909fadf6adc26095b3217ba6897bd45d25371c6a54de4230c9ac2a571d65fd929016429fb208177b3de78843d5ca1d6c5a36c4e815a4fbab2d9ea614070c1e9659abde36a04dc15cc73fc62e2d16ce0c534cca66139428b8f7b1a9122a2558894bd0e46fe6b2cd7255310bd98e808cb362acce49a40d5989fdf9cae0d8d1ec41b1c6f092b85b023684b477eb91e0b0b0ece76f6331b69c233179e8116f2feb6adc0b3bf6fe3dc23e68f9118adcf57fe5bd24e6607db0e316e36c623c2dd2235dff84a1c18b01cfcc399201aa28d634d7f19e498d7a645754915257cd1683c799b7e62c9d7423af52ef06dc20b8b44024404f0d5fad6c54e5a2f472df53b70087980bb029397aa7a0b65f739834c7b9d6bf7c8887cef0c3da6ca074fdb15b20ab8a5e37fcd1ac175eb962a6d5564bfe369e0b0a9964c4f585f5bf2e084694a105d698f20e66ef88c7fe2e13b6632bb92675ca437d733358b27a2e3622f4cfb595548dd5e202203b809125"; + plainText = "3d40f51353816a3b46abee4b49f0408b514d46d82f857b3fd7e7479be3c5cade6404b2a10d85b57f16fbf5f513b4e275c7705d10791b7d842d542217a554129d238113fe0f07f7ec6eddbc40cb3ed354fd5d81878520cd7906b75d807f72dabaf32290c89db7b4187635e73b1a4a292b59df0be124e007773bc0ee2fb82fdc4102b72bf6f39e2e257e211c90f41443486d44f4abb63c31144674bc8d31516f1a5a656d8dfdd24cdfa4bb532d43f88dc9aed48b57f42ac04184931daa766d298aba7ba73f2869c1e7efa2d9f3645487576b0a412cdeb78150c42221fb9ada8cbbc5ae9c70b30311d85c22722565c6ac188bd6315363b5ca895d35ecb56770ba45e528990c81788a692dec152c8acf9957e2f37212ee81fc526f9b1c6e8867a10e130f15c0ce473af3b5c2c339c8de78eb1fe097327f0efa189da0ec3ef2ea3bafa65ac67d3e95356d1504df07ccce66a4392564e9e36bd54ca9f3b079f175193935a45042c984449388fb8072d21df8ef1ef921824268b42fd9114007517159a764d2b22e77a188ec8d2a5a7342ba221e526866538fc085db43ffc75d1a548c51736edc99d2b74fdfcde308f4131759723f28be466d0751d366109663ff072598e49792a2ddc83d25ff02f949547f0b0c449cd6078e83fe9c5305e5f63d94f30f5915cc4a9879f1d0042805a61544b7ecbeb8ceb36436280a30c92816345bd765"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 418; + dataLen = 4096; + combinedKey = "8f5b1b45c585fb12554542a283a3f0ac4e2f2342e9f11cb2319f73e8ee26e98d"; + iv = "a70a44912f7ce11472e9d002fc8f2a29"; + cipherText = "bcfed6fc78936f64efea842f7341f07052819e55662ca2e326d57ff049a818e6867cf405f47d7b2c6d09989b0d4ec3ad8bfa91a92fbe1a7aafe78307b22eb8f09d6b6758a256b1279ff15e1e5dedb76f35bae4eee762708a08e2a1e43b53b16727fdde1c8985aba4e98d16e92fb123f9a758980a105e044cfb917013232a30ef4711bd70d9d8a43eaae21a8c94d8614707954631777a262e5dc9030c9985754a6d35ad3b7e0b9662323684fefa2a4180662388b4723350d2cc77b324b51be35bd7bc91e8e1830c9ab083607e04c97b18c0c725498c7778e787b70d39e4816525c56be7890afd262345780347a52390098a81b3a3959b04dfdcc9a6312c218e570e7da3e1ef9fad9942b2e6b3e7c56626f99249c1ae4f3dbbc5dff7fa17c090174b45acd685ebd18b9708cfa6e7edcaa914b7bda7cf7354040425e54ae1ea06be6c8243e2163c86ed4e85b7cb305f292746fe3f87b2dcde36d19d5eafc8805b8a5e8b267f5bbcf9de1a5d4d2f98c2a65799a19d02f406052f0fb4f4c817b1eb133c122537b6f6421e78fefd55bd2be25c60c26443f82283663c0df1fe017786d5cdf062074a7a1b62bb55439e08aa6b7914d8b5e800dc26740f7f8b5c9bd92e8e27bb0df7cc0087f02b408d1447e7bf22f6061ba4ed6517e8b36319180ade3b49a85131d971b23b0a881589115e38d474e31e1c44dc14130f3341f8e34a5846a5"; + plainText = "0570b9f05b6fd2af17f9460ba691131ffa732861d119a0cbd585b96a3d72a4f601c713b089cb5086ceb6a24f9e73081f2d56c474abd92ee7d58989e803c0291e2bff684615cecb796687152af3596ee79c7137dff4cc0b48bb802fd0c3f88fc7c8a2248caa87944fd5bac67f0867d9cd6e22cd0abcf217ac8c4fa2cac32d6dcc92c7bc8558662db14e0ff9c815d03266afca22134b60e28dcde75f57e22ddee2fd14eeb5bd39f3e72d520cb9021bad38e57616534a04dfb30e6e27b479dac9644daead599eb1862be51b39f2abb4282f1b0c7f1889f57c361d3954eb8f9844cb7f06d1da7f838104ec5547369974cd6c0495326056b759d04b002064f4f46ae6d1640dce55ec53eb36d345967f96139664b7e2bbc5bb9c70f315522a10add39689bc73484d7ab6103ac35a14c4e02e2356d322212ec7701692bbba9b584eb76779255021846db222bb865f7e73264f303fb608b9abb890692287c0c12b125f65d289a0cbd62fe58f9e5e2cf629efcb799cd019b0ac117ab166df3c15a619d1c611d6316da39628b498d0e3c557adcfdc0ddaa6ddc61234763b91357de2fc7025df5ec35b422f24718d9fab270f342c0e899bd4f571b57430ee81b80df6710bc58403d20a1a1bdab068775fc3a6912bc33ee5791fbae1fc27e8868fed137fec39a6bd18498f38fc17754e0e5f5e31faa5d47db6fe3e77bc74e771307f16fdbc6c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 419; + dataLen = 4096; + combinedKey = "c306dbbef6adfd55422f0802c422f4812beea44812c5bfa0f1c48f0011a0186d"; + iv = "fda4a34af765b0518dd12edfe689cc16"; + cipherText = "5e25b254a32f09c010a31b7d4cae41839efcd6d48b7194d74f88d19d654332b7fea76391ab33e5ddada8913b222fbdb1a14a267302f3edd1a52a8f00b6f3e35b150858f585f32c5af2e351ef529fd1355bbb7cffbe3d555911316949379237d89d3206edf2df5bd21c4ca5024b2e8e9807ca9cfeb1ccd7c4f3e64e8a494414b6d70106eb34283077aec0d95efa46cc6d99554b7e0b8fd640076e2f7ecb24c367420433becd1d2e96c05395a6208271968d6e7be6136b55507cc9407f48dd1bf9780b66c980cc6b2c28358345826243a0fb221860172e24620d8d99ff30334d769c11995e3c14233cfc79298d9ad3bed5d02d3f3fbb149b911d61111c0f92d61ba82fe355fa40fce7f86a20d05af648fa58da36b7e4c9a5b07bce5e2379ace291bedd7cd3a23e3bd162cc8ca6c0019cc5c8f198c873b1215e94ef3cfc818ba7a66ef833093fe2aa40cf106afaa50daccb39b968a5d03ed0385f4c6beb6a31e777dd6cac7ba13568aae1d01bf46dc6e78e4fc22a3dcc86aab61c023dff26f559b6238c83da27264991c69ce36eb37f9ef1b3671402dffad4c3e93a5740340046bfbdb40edf5a1ded95b69069cdd9c58c668abf35d80a3d9b820520f6748069776eebce7974f929b51941445e8f89733e00e9aa23cf48edbd4c43f2d4fa0c676a2877fade20e0c210b8617b2c2892caeb71f94912d5394cbcf16e61c4b42ad17cdf"; + plainText = "378e1fd9072ff61ab7e802e3cbdd47ae47db82dda05195a8b11f7075d31b82728fba3bd61ce74442efaabcb3580f24724fc8733cb3fd49a2eba92fd3767cecc830b154be3ccc0767a987310b7f3db28c71f6bbbf76500814c190241613b92ce55e76ef222c1f9784a988dbe9af0bb19059bc6c64797b97618410870d3134fec99a517af8b3465d0c0befecd54826cd2f8f4dc32fb3f14bb1925200e3fcb135cc11d7fe5424f0b3f4b5942cb7e795077b8134e4184c3773fa1e5836a66fb167835f120ae41c47f8c1d57db93e8544b3998cc9586d4f483d068916e66ed7c662933d5fcf4753b6a268e4bc6c88a87072a5f5c7f20bdc1859c8026b0d9f8ecc3419c3a1f8764c72a3e024e9e2950b9e7165cc36fb5b33a4209f13101ca4d382d8b28bb6c7916370f26a76b46438e3bc5c6e9680f52b731b36764c27dc9c9f444a4dfba241f30c62c90d979e9386aab658cb5125c25d8c812990a42fae5d76a88f4b039ba5da22c4c8abda71c2836a45584750a995ce5e9db15d652730a042d286d389f0fe519d4573f0690bdc16e7c7095448478c85b0a7c6cdb5c64bd9f794d4afa9934e5bcb6290b9ad9866dd717e7324185ffe029bffb6d5cbed63b9a8907375c86030604f28bf50e15aaf638cfe33f26432e64eb18a8920b7666354f1225464498374f6fc723b592f763eb760374d7125661ef466fef85657c53b40d2ff8dcf"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 420; + dataLen = 4096; + combinedKey = "11b30f48ee2a5eff915f34322e1c1ec8a1232dc67b1c00de27e61edefd0341f0"; + iv = "e045b9a1ed7c9fe3ff8ddfa1e470eb52"; + cipherText = "91f0a7978364838edba62607f3ecdccbec828eadfd84780cc19f2c488f242eb4ef8056ff27ba9954e85a8a09571a15594360f2b929f8c9ca7d306d9b9bb131cd7c4b2a771a58f5fb5155e8f5d114f39725caf124fa5dc82031d88db2a35edff6a609735a5d684a8a33b5751501f36b94b732a99c81b415120d47f5193666a3a9d75b27bd2dac7e1c0e93b6cabadd75ba0c0188ba277a3e40c444e6be6d440a7bfd35288a0153e0aa8cb147767cbf22161c8835434fa2b6f9bd57f835cd82ed1cbfaee0dd0839a8942f4d3268bb6f27b30c5ab03edafd4841c07c749b3ad424051cb3d95febe198670197eba72c25e91307d7d71e888dbb9b6b0c84bfc236eff4305fa0f4b834b6c866f238aea9867bf41b6e2007aba4e7c14cf0bad62f9d6f033907c6f602f1bddf6086edb62482f45f75da0980ed513bc09cb1965ec1ed85d0c20d0388c3faf92c55754da0055254eb51146027ced9ce9c145f5adae7e55ee2beaad3a5020ba66d84b621903a894b927b1a0cc532880c0fbae2d059d267bca78d00233ef81749394b5f65d8fe549d51099b093c10823f7df3b0eb4a371c815f8773bf2ba00900e42fb5590f2247d2a4ac205575815092544cc3ada2491681a3d3bf11bb7a1d46265b7a5540a970411d1f91e377fca024fc9303f9c4a919180a150a584baefd50d6c2e445530db4ce60337912fd286bca98ff70835b5d5f8a63"; + plainText = "a0d21803f5ff48c5fa3eeea736f3e85ad92ac93584d568a27c67e92712f0fb35881bf73843a6dfb2368682098145125c8d143a50ee773c390c4b77957c0b0a3ee453a4890356cdc4bdb0f4218712a41ecfb51f86cc251254f45d4d3b30a478fa61641587199af0cacb4d6943e67eb951b5d804e0db15a09ed1bad33ee636ec86e19d1bc51e27c979934721f3f227dcd610f34af790f40d86d684ab6064455dff22813b34b959f20bd4fc152f748dbe43f90f23ab63e63be1bf717d35ffa742770b300d6c6060baf865f0155508e0ba2e6fc597632937eb846d0ab5f828439f72bb23ba301d43190fc48726d29a6d7e0347324be92711ec29a667bc381dbae91e7c62db4b1d18cac0fb38c44cfb8a2e49d7d462fbb44f805148946fac904b93351f7cd46c3153f344230f7c9a6be15739270ec4afe0eaff5c98c18fd0c6e12aedce735a7593c731182c9840415c0c3135958b94b2768e0d8ac266b0b916e4b8e856ac1a45c442b2a1ba81d555f2760143f47db0eec3d860dcc2db6697fe459760d9827dda8766a74df1fe0875475c5f642bfee72d9653076a339a22438d2f6c042f8cbf6bcc51ca85b97b0665a593fdf3d1747f6a1c2a10bcab7b1f4e0297d096505a2dfdeefa3e26e7048d21ab62453e344309463b9fcf34a2e230208f60c332f7cc0fb7f378af97e1debe4ea371347e1e08e148e808480220a721c1bd118164"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 421; + dataLen = 4096; + combinedKey = "6a7b3f1bb2ce5860db6bdde95d020fa5997dcd3f38d98d76380f501d1e9ef655"; + iv = "a7866ebccb0881b9d4ae1cac492959d9"; + cipherText = "7fe58564ddb897b795f2efd07f473dacc1c29cf4be4436d8364fb3671293eb8c82260c5fe73905577ad3be0df9ff66f01548ee2614f52d5103835c3d31e900305fe7e21e354b8bc584b32b9a45136dba642fab730aae211c5d35f9d60ff8fa240eae632ec16e793ffd077f8f02b8ad7efd31eb753e8ee18308a310934d5a767ff3f92dd9262cdde431bcc8e7b60ca7a974ed3aa395c9cc8eb72c114d7de09d6aafc2a2b843e7d92e50287c10ef053b6bab1e4d1eff31636ce60ef450514d441e03ca4e5ec5348e3d66aeb532bc92f55bcae578c371cea672b2afb7d764c0e4fdb716352de41d6d4439126bf3e89ac020882ad7607c127fc9959acb614f38f025958e90ee060796de7ff7a1d04fb41da20275fe9662b5c5fc163aa232846309234a05adaea275f5351c3418274526c7ff6d0bed73e601446dd6056b5a09a51dd94b4a23252b58a180bff1bf1777ebe0c534679fd664eeb8bcb59d5078297663805c744bd85fc4ff8f318dec03c8731b7bc4363af38e8931ad6d9610e0dfdd3109af99ed95460638bb7d2127738dc5596a61a2fa3d0392b0d3d35a65df9d01c2529cf461a273ddace2ccc1dd891b80e02f6f13e60ce1d49672942589bcf0f3f8d7108e07ecb9ae456db59c41f9bdda82c46af2c2ea7a37bd67a6756f148b97c988ab8588c157e98f3b888f7f674737e1a67cd9e8a214f9ec56925a6717f69cbeab"; + plainText = "495f315ac1fae79db1193f200810f00c476e7db32d9b6555621734ae7a731542fcc6d454968d38abafaac77a10e4bcbcb26df84a38002dd8257a52f80148ca3389dd71664bff86f126d2513fee439697975a3c9382844507bebbac736f0e76aa102842875635ad0451fa304961f9b2d4bbc8d8bf1d5ffaaf5c6f436028abdcfd866d8350ca0ccce2a07e4e5873a247595543efb39ff22b1c9b9001dbec5c7adf882faf80fb077ede6de8207785ce2fabc574edce78450a2ffc92c2a9c98db234b301eece115ca9ed483e6f222b2c3c4d46070687b6faead2d7fef5e91738ebbe7741f8ba4bb6162b6d78a1fb054443f05df87989e111f9f8cf313b140c653a103b0249da80f10d6e5d32138a944a744746fe7eb77f0a65096afd7fb5924da17fa66a42aa4786a23d78a7dd715ec1652049890dfd0e575900c4b2d1028c57a5a2cc0e1d55985f08c4c6a3ee2628ffc4aa7a832c6e83bb03f90d8c8920801083f4d2dffe3474890b46d6badbc366c02bb6e9ddbe3513a2b466908edc38b9ba1aedccc6927851c922b4a8b390c92a384cb662dbee67af0de4241b61a45d7ad5b07c36339fd2760b010274b6eefa13fb9d2fa08f5620ba87cfbd04dfb8dee5f23583bb7948a0b951847fd4f789fa7371020579ff8c5ec71166b8aa40e125acb3f9ddf22493304b569017a2b4496aac66b24d943a5b73119ebf9c367d4772d60a03b4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 422; + dataLen = 4096; + combinedKey = "b4a306bcf3971b7e6e1c67d8a18978c053bd8893ec5ecf05ad45cbae4c9894cb"; + iv = "044b649fe8a1370b77d43e2d009d86e5"; + cipherText = "704bf3d2b01690926d4e6cf187f8c82481d1d98cad44c8db9b871ab36489fe90aff5f21602038a744fbd4c26f49d5289a9cac6e67638013d6b7c9cc329aff98cd5cd81950a5ef624b8f3d03be268b808ccf90246f8b85c160e0dbbb2ee8d75ad0516da869f6e28994837bf95d868aea379928a88a072280afc39ee181506cc58adb9af433e8af164a7722525b1c9057d4f2cb8b442da783346ae002089b55d5ca93d2f57d35ab6ab241ee2100d8e669ceb1b68cb81a50456066e86a404b9c50a256559970d80c59bc5098e2e0b8b97d51878e697494106e6eae59b702ed84a9409076a1c175ba143cd5cd4b91ec6fe0c355dba6aee30b86b1007f673920ad1364ff19d0dcc3bafe0158108b1bb5417b47f0a5363ec8a7866d6eefffeff430400b6cf819270beff2dd9f6b8274e567bbad0071f9b124e39fcd5dc55800983dd4b5854b05321190045d4ddb278b9f51825fd047d249c4f2a1a36e8d3e9457fbdc948e436f3484fe386668320d0894d7397b5131f584a87995ddb09c24dc69e69defc33012bd03a2f25b20f1a50aa6227d805bb8ba68a649ce95f0e8918ac89d03683bc5fd727715228d39dfbe236f9f1cb1c141ca924bf27b707b5d8e9a508f76164e935fa23cbbbc22ccf558891a2e83d985b212215c719478d6797a3adb7723a3657f4696188c118f7a4b3b8d832adfad31eec8246a3c62d2e2181b4a9ded128"; + plainText = "a9df688cb61b1a37ef079afec1e87efaeb125af34392371421ab5923f4a6b7dc57b4b1342acca01329f97f7d111ca8d050148dfcd96d6ebf49306c032670d961a48449e30b0a5a0ee151edbc82d4bbc88f7c096a15a1b2b7eb718f59fa361dee9c722ebb61899f343a1a140def0bd4df0746f611257faf1eb3efe0dfe83952f2b480d73ab0bc318d5692ce8006c98e6f2e5073486c558996361ebf9419562f0cc044084f5dd56983e60dc88952445ce7193d2f858da0b43f417d7cefd2976a40bea96b014c123f44f61bc05abf7793ae963b386abbd518ef3c4485b8868789772736a6b788573049277d828add2c65ce9995cbc729249a0a8ce45b13d8fc82035a487fb8e2ea418702eaed0d0eb9b3f9ef39b72adabd8f550413a66f49566582ce540e4e41c1b5807bd1165adfe39af3ee8c77407f8a7b20fa871e58275a2c059c9fb8c8bfca4a28861c67a3e700212dde8011f4ce9b797487095c259728d156ca104162ff60cea918f5d0bcc71b0b7628a586ac71535a7377b99ebcfd53c5e0bd545a0b64ab7d195e4218204a2dea66ad2a1bd01de8f8a5ae6d3a2e031fccde45d1d8e623606a4d0ac54ceaacc02fe140a451e9cc38c970e2f17469d2bb2e7eae49e64768187963402f6a7da0975178a6ead18ec6b6305dde617920a1f711977fa85c2ae9c92e25625d2f69ab0a0d73c148deb10b213775b27625dd6009cec0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 423; + dataLen = 4096; + combinedKey = "0ddf0bccc321ed39c961f7c65f5dbb29cc90f93c894812688b091cbafe0b9c73"; + iv = "c0fe2ad041919b192164a99afec3a7f2"; + cipherText = "c87e141e646ff3a6c2ac591074a80bc8fc30e48c9d898b8cfff530bc5c765e2f6b886bf153b3acab8badb739e93ee0ab4fc6be014cd7df0e8630e4eac8f4b4d73f0937fcb7e22657e5e333143a795ce42ddb0f8b6d198a2baa3a205f49d3d91c5efd9720029f19d582ee5a05aae757ff4a79724a9cc4379b4c54056784c3ea0034538f702b07e72c18265b77decea83b9db89bf809033cd429da38e40b6d982d2ada1fa26d0d7f1f2282e189ac12b32139f9a93756ea9349c406d11b1340e603f5dfa5f520e5b622fa47fe0f02572e700401c4dce7b1aee5e334b74c091d38ada0a0b0936a13c07bf8c330f24a6b6d41a45e97ad61e102e3ac3a7708b0aa3107e51a67a7433a8a15dd9bf1dff124f0eeed399c8ccf4afc2719321c8f3a458e1539018cc88885c319ac66d2e552f0425f7f6a0956e8885c7c380035d051577194c52bb91ba39f493ce4e53f52d2a2d2256ca52f787bb44806dfbb88a8f5ab2c629f962664dccb1063bc589cc11a7f427ee5ae3f2e90d9b7e5d6edcfde924682f244236da43469b7a6ce9dedaa4cf14b08501d9ef1c674cd36d74a1cab28c68dd8bbdc0aeca52f90fcaff2688c062eaceec2246d5c4c1a418a7a506c35aebdc4a04d5f1af7d0df4d3d1798692a1d2d075cd1b8c54fdca559fdb91596fa4943a36d4df3a4f009148d11cd85d576b1b4714d6eaea6876e9b5535c2688a7dd99fbb70"; + plainText = "304d1ecb4ded131084c5aa183012a3d1cd2251794adceab6488a1a7e625f49678cbf4cf15642f28af0bb8c1b969d492f7f7428634aaab09c06e02d7903dafc5c3751fa58cca329359bb32e97d4321eff56a9b5c015192290208a14b52e71fc4b7174e3c7d6d776dde05a311955ea67faac848d95cc10d9afe3c2b78851b8515297a0e76ae4ca5dbb5272ee2092cb95e399fda423f200b42c7f589cfcd8596ab9b81f3bf6a0c2da0dead99a606135a0c8cc89ea92fc1258f4503a55585668e293f039de927e16b18711b2b32dab59e1a64245eeaacc627d573824973d7293ccef3cb2c1162f6d3e6c04d03f591f6d5d3e06d0c3ca8c3bc08b68aa8eb37c8dcc90518556973803ad84cc726873dc90704e6d1fce7e905a6479a9e1da19f2256acfa4e4b146bf70938298e4d803082ad7db841c04608c1d3c64dc55050185b8604f776a5faec45961169a59790a584f9ac9d881176f15cffab0f03fb0050c157cc86f63fc8615aabf2f2a8b2ecbd739e90f2f57f45cb9fcf2daf60e9b82b86957a4cc6c798a32b9c84e7aa5fb6d24a4ce0d80b8100afd943b671fa5204430a9d00bad22fe3f9ede6a2da87b9e3d220ada118b91b19b5a4c0c1dc2aafe351c224b649bacf4600d106d7229ba040f4d77e9ab55fbd92b4a857ecb13ea4437e159227cd1a45f273c76f6a915dc558b5d32b63c3e02b92282ecb227f6ec95d2eca0bd0b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 424; + dataLen = 4096; + combinedKey = "6e2f2469424cce439a9b39e81bc14ac624aa9ec12624948af10dcd14515923e1"; + iv = "d0ee55189cc4ab75a625a36861cf668d"; + cipherText = "f751fbdeed2375886d478edb94f3ad5df55835255c029a62a50ca8bc3a5d58decb6812dbb0743bffb335f4e9bacd7b81173f4b00920af3ca025f3e996156cdbef5a0d36ffc7ed05ea1d2cd405b95f5807658146c8a1585ab39771ae120f90e5eef2dec6fa0f54ebdf8f341db40433a7ce02866923765902b87115fe405eda977373e6919a7238cb487a1f7da005c938c0883f4d79f0fc422225734536567a82757bc039f714135f720172b450901d7153f4f9817df419515d8aa52289b5250d7cfc574ffc3e2587f910313d5214d4a46e2540ec9f8495e85a9322f6a9dcfaa5783b1f7104242e3c21e8f437b1555b41c4e88d786045ffd30b0563596c591ebd16563fcd267f05f9d792f82d671c98663e05b25dd26deb1b6eac89e8f3b4e5b656bed2ca95bf2f82cec5110c02530f4d7691ce0be80263f554eed80f0ed2af76dfe516370a481bb5692bb65c97cf8ff1af6011741b7e69a8637674c5150e4e8bee41a7c6d379bd91e0fddc592aa18bce16d4a6e57d881e00f5ed9329b3c58c9106a9592ea27f5aa567d17de2a7f1825ec7d7704e815ad679263e9f4b48e3a8231679eec0156854d39c459474136f0d0538b9242ac0dede52151ad9a584916c5b068255888728b54bc7cc97b67c392a2df6014568ea034e02b7453b543a509a20419d25a70cf7b2dae8dcf63d6bdc1487875ff9b2b9c2732fea4bce29aa2320463"; + plainText = "7a8e3f6bc093c5e36849998fcd460f5da037eeae3e53a398b034d97a885db3bece55a6608d1fcd70e5a8d3f096693a84dc81c55f7df6f6b97bc2fcb164678e48789faa3addf49506d21c261c798031733261d0b0a532fc14384099e2a0cc2cd3522ef638aefc214125340a4d81a15fef001d2c8c483b7e91f9db33f2704b3fd32b98d6a10b322941bbe5773b37b39a2fdb83d415c2422c75418fee2d981f5aee3a345c8cb257fc1fac9be4341d344ea12ba323796ddbc8082f65df7780a48c58ff24e742117a94a50225789d1bc7a804664ee844d8d18f8e7cb2ed472ae1f64945db4ba2a8a3cf20760bacf84c2eebcc048abea2bbc79c99bbbcc6ec0f7e9f950c088af305372eb6b02cce21f615ada168d345447f203c45702195fb7fb087e16d12a9111aca101b59629271322a42e1cf8c2d948a521268871504821a872337e11ba74590e7b61e1d4b187b3c1f653f49c68f33bbf83fbef268b8c5ab391580567b1c52352d9c651cce3349075fd5adc685c1f11ff6382fc8e21e9780c2f899aefbd95a2550636f028fa61a3d9543604328ab87f0d4222221e72b862f37416a41f962566aea7387aa5206863dc1c0886f6850e12aadb9a52f367daec2c4dbd1dd319044e69d7eabd5c53ea23c515fae68a5718707eceaac263beebd6e13a38f3f843b8a097d47c3517806ae4a9c9b38ae4d9e3617ed2ac081fb4e0e79a2e38f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 425; + dataLen = 4096; + combinedKey = "8f6dcb599241b2ef8b879d2c4c561c2ada465898b368cf06d40c437cfd3abbf8"; + iv = "8f72e54735b4cc30840baacc96658059"; + cipherText = "ba5a0fe55543e10d07c314fc02d6710af90edb7963c3728995bf87b3bff6e27fde7013a6d174c0fa3988f51a017713053831c67b16905f462fb6cc719a2dd731c10558080bff42404b8cbd10f99dea2290e8826dc9cd77143197501d40d194d190244a45758b40c0aaa5584ee3e5dab9a641a74642bc8682d734bc90678bdeb8740d06248edc54820ccc315c3d3ad0ebaa5c84c64bd76bed6ce6e6422c81c8a1764fd5e28aa632a7641a521edb9fdccedff5baf1a1fdc819250c5497db47094e5a0c8821127800c05c12543184f80e208d5422a36ce30d45e37b569332c771792d57565ffa8eb7f6ff375305b49f1bb916c176f0733cf9882d2bc66850a6254d30c6dcc6c517e11811effa464e3acd3f1bed6c50c5b670e6371bc34fa7be74df35d0522b1d6447f25106950d07fd648672139e10ba9858297eb0109ba50c002c9581e8e62b1d82586548caa21c228ad3d56e7ac2181c4f8bffb2c973bd7a580d85ad21ba33e68b867abb438ff51fb0e01f20e60f9f66805e0d795fefb9c4bb411df7879b1b8033d9c1321a85db771e28e61d558c2e5b4c2d6ea8909c2002b94195474a076f0659dee804c4a2d33a2f4a43465c55ed6805f454ce4430707008da2a8733ae48796d8db654b72674ede674583691a37e65110d600235c4c25a409049bfaa4b81090f2c944a864e7462bcc0b0c9f67aa1b9be337600be7df604b5b4"; + plainText = "f2c13038c9e3727bf80c8a22cdf0909263b75d7df880e39073918400a26a504b838285d94db153701cf6c2d38a517681e57b78dbc31d3a0354f2ae5b892789f11d1691f91d797e293edc39eb33342f25a333a5d82f45e6147cacf71db07132e9dad75498eb58927f1f55d05ae7d599bf81dec3ce0fe9d18b4935c3167c477d78108688589565873207a16707998a0eff5d369fe3ada33d1f3947516d1d9b6fe49665113cb3d9bf20131f234b9974fb1ef2ccf183a4ea80610cc1cab833a2e895b61d48673960199e6b3831c1ef0d8887a3af9a37894eed55eb50baa931a04788fd15c945f83255ae4f2e6a22b93e3145e0fcf886eb4df4fa45e6188766ce5139357b5aea42a3ed1c41368028a190c39ad87b359e6a86a811bacbe6c23f40e578a8876de37accefe442740ae4c0dd2e4addefed07382f127afeeb0fcb37679fb6b81c72facaf91ad98447a268649f7e4e60b789e50182f89342c339716cc00ac2120821c4a49675b8bdb1a892ebaaa30a52b00c56ea5f39b9659af64541c0cba0a2482009d7dc29857b74eb345b75299123fce7e010d705c5427df4a112bef9fd71be2215f57040080fa6d76e7e23bf620c9790f68f21be07c48e766d9c10c4f8cbd2670eb7e03ea1f439c98fa43e132937d125b064a2054639aa982bdc22d955482204ca46ce2d5a7c555559002285e33038fa58e3f3a2affff69fe88b278ea0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 426; + dataLen = 4096; + combinedKey = "357de13a4ea48aade3c1c60648ada956afa3406ef394e3549d1b05492bb72292"; + iv = "a5221e879af00e75a7c1278a176dbb3a"; + cipherText = "5cc8d43927bf768d4b37848dc383ff3cb5a518c53dc31ce115dc4455cf730cc5abb495e56eadc0afc9c8f65bb41de2b5da4dd3b2d79293c5cf21f10eb4c3b35de25ea923403dccd1628ba844125b4f71962a4ddd9d8325291c3d1b1b741eb4a54bc61c0ccd3f5f4eddd80a43f9241d4154b002d0c7795f59e32122855d49239f0874aa93595ec176333e424f093d7ea1088b5623b686c67fbe0f45a0162b6bdcbcd2cc3875dea3e7ed7a87b662b72db676c44387f8be756e71ec07092ae6b5e092229d2d95915799e0c1495e96fe217d39e3bf6f387dc08e92c14c35c75b4af2b5d4804af7af34e1f7063e9a7f2d5fb6c4201cdb72f86a20efba0c06bea70f98afe467ebbf4d948a483ecd117b8076c0d3f7b93c051b5e9c2bafe4b5dd882d87d5d2f6438c1235606eaabf2acfbc73fa45c6ebe10f7f6df13cce6f6b8fd4aac9cb3e073d86b2fea6ebbbdff3de2923fd12fa2a4e752642409fa414cdff9688850f7593859a0dd2636f0be70d457494b5937aa13ba6a5c3a43bb613b0e200bc9972f198887253a9befd0ebf0bd01638b69c5a2b6a80b29b3ff97b230ffe64e38a8639ef1b304a675c3cb12f0643940bdf2055aa091f0e210975022803a2da19488a52fbe0cf25458f6b617faed03ac8c6831d9a70075702c46273b016e655b4057328a13170971fef8ce217435f33d94ef064487502bd8204a680cb48be8611a6"; + plainText = "27d06c7208051a4d3e97bf143c4547d79f84dd1252307225e7a3f3d56d7266dd0ec007fff2c896dfadaa82a01799bd9e7f6f21b7764383a2edf6296d480ea55c0b217c6d7865ebb3fa1312138d4fada7fd3578fa49b152c309c3677c97653edd415100c7101eb234f607d78238daa88cb7c22b91706e2404a5f0b8c08d7c6033999946ddf91dadad1b9b676cfe3dadd085a7ae329484a8346e97b6202bc40dc8519e2ee416603d0d87d083811d1003f4a86ba42989485e40df1f798a3f4774c6d0504486b5421706fd31ba150432e5a10b2c7b85de2a017b12d7029023bc164bf8ecf8467e83529a1ea0c5426e7c631b4fad9cd320ff48f71022593fe3b977fd50ccb02ea67063754278fd431683635f1cbf2e302f2ff0f90fa9207d47fda0d89128acfcbae1da78776e2473376b3186cf3039d2d4729b0c420b9a4ab12dc10eb452ce8dac7109ef369db02124aca3698cb8579f433b5999cd2cafc47cb6ce85855f6fd8075a1564086b0905e94220289b7d1fdaf1575c560998fe159786a1985d33946860478f0f2864757341ac0c2e856b80004b5e1aab7f62a18a289dc5ae603b419443064d55ea6d5e202e0a1521f025ade00bf75260662558ef27b656d4ee5d62dbcaa06f2110126531b541c14c407e0872745ba51ed3d6a186c014d0c7a6bf213e92743265fd583714821e1b2504cc9e540482c9a1457f22f339c1d640"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 427; + dataLen = 4096; + combinedKey = "9e35dc5acbaa19cc17ab38d945b4750e5419ac91ac1608f14999d060d3863e10"; + iv = "3f32583112e99162059645d4f9f4dcd4"; + cipherText = "bf1475cea642a7d23bf6a3ae299f23ce19eeb4d66a0c3b1283df8968d7128cccc8915e6dacb878daa5c2b5ab6125b1d73336a72b95d4d9702556ca2fbab978eb6119c6c73bc928a9a805cd0fc4adbe1239707ac0c649707f9f30e9cbcdcdce0ea457abdccb9cc64630b029d20f632259c235dbcfe3a58857e51af5c954b7ccf72abb517453741104d0f4632c3af20d4efc6396a40b1db84eb799626ccc1f26df7a743ef905a078900b481de7b6bb63027b9be03402c37f9ba010c735549943d90748273483e105c6eaf64512c286681d45ff1a47019b05dc44af9ad155e909b7384c698b82117d0ffa8a1f9f1f797cd756f99e2bbbf0abc413af5704ed4168e4c96d5a0084dab4a354a4ae7e0dcd10a5dc85388fb2ffb059620ae5ec4c1a84016eca2c393a9232c157e85136971a8c997f12a0ca88df06ee2a68c28fa3ea5c9f4548d373c9235ae23a667cd1702b0fa9e2a506a3667ccb0e93f978a6812095a25a397137697c02963955fc684d11f8792e57aac0826a297220c5a1204a7a2adbdc1719dc1ea84fc154e404bce9f524bd0c1922b45c9606705a3d0f5e90a4d4cb9f2be8ca649a6fbdf5084c4febed0e6ac3aaf0867b8f19280bb939c04569b187b5e2beadd8fef19868c9af327d090f461b1637bdd8ef3c71d17c15c74cb54bd833c578a6bd6117543bc134c665a60c8f09da6a0e8bf6ef47e8f9b7f57000a350"; + plainText = "e3e33e4f5307e634d17ed9a7b2b11e86e959db3c77b6ab2ce4d38e1afad77277ef54964623e7883ecefca8d7ad4d8b3c1f3484df80d97a74b96a69fa3cb3173cf615bc20409b98c79ccd1ba544336e4607c799766f2e89f4936bc3501fc15802d56088b4862b0611ccb09ba68edff4707bcbfd63d535bde16fdd6c781f9ada242c4143333f92cfdd6dd610f1a915bd9203aeae67875bf79052d62775b96898e6281a70c21cb15b2c3b07a3d7f0cc76940167e078ab69acbb45ddafd9e7240bef0bc0c95d725e626a9dfdf7b15da30ef8e1f41e0abf0daa0c27616ee1a64c34112a153af67de03ec1f7d8c9f7f981482d781ec9157c7115c981eae563aaf89c0346b7f2da24908103302ad2644c234cd1d2a23b4a5944524a56368a0bb30f948791d880c0bc071cecbd3136ecd31849e02dd805f4084ac89c87b8cc7523c992ed58d00106a946dacb30e86553a98f9b7369f666a5e39420d8718a04ae591fd0cbe45e1f651b9c27f23123baa05bf7a5d03e2658d45292e18b1e21af38bd3365cc7c8b9b3f07a223fa63cf2e9dcb249032de4c5e7e1c4af264e6e51dd8fcb71e7f156fe804fea5e4698f90d12f9b362b79aecc271cd10b614fca323cf4f49fb54e68b08a46e4f7c36c0dae198b14f6217b5513123097c16ff09400933570c8285360a014b941baf2a7ff779994488504e230baa1178a6869bfea2ce94f2f719b78"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 428; + dataLen = 4096; + combinedKey = "40530d9a24fce5a0196100c327851a659b20475f272039e6a19572927984fec0"; + iv = "e66dd22ecc8ba0899b9ea023b2c80321"; + cipherText = "efdea21c4b917f7fd3969479084ecc709152404488a05ee82267797a3a02324495f9c07cbafbee631291f2ab1fd04e708b1668f95d7d8445381829cddb96c51dcfaa903ff6ac52e00fe230eeb85403f5fa66df7b7a4a04f0145f3b4b02b83eb923ffd8afc66cfad1d7796a4c80197abb9f8328f036514b5888e74761ba01c3747da2f5b5096cc2ef2e929e450ffc1da3df3de6651fc920e9a33cfbf624d94e84787e0bfe34261df86956cbdef31c4b765600850f969b4a55336ca456cbcfa81f00fcce4c2c4da1ee20b2ae34e07c97c07d13744ca70ae5b2339a7e648535e06e806707cdcfc465c48acda1d716773072144bada10ab7e7ee4c09b768103e35be354a94742c6582874cd06a06c9af65da05afa4fc80fcb946174c6a2d480efd4e72a86e66e88c152e5ed549281548d263cfe392bc8751d34194522c1f2356b025b21ec0898e9efbe9e83e12e71f77462d543430337e0556c3c4e639723167d0dfb60c768974df6a281808607e37791c61a2de3c6d483c719a2d01d5fc20deb7f1d89135c3107510c5972cb5bedee4463ddc76ba007cc31473e2f816d9b22328a080d25f223b38942db4d2305cc3dc8c89f4a609186418262edbd8d1efd6f8b35a284594bb7ada8a2907fe01a5d759d493dba6661ebc046e8fdcb7c0850083d78b65e82a248a12e932e53f81513335698b7d9d61e6f729616668f290331821d12d"; + plainText = "01c6e9b5cbf33b24b5449fbaac9967c536ab54bcb3609929d75c10f4f2638c58494c4afcfbc20ee808ec8fedba4f6f0d39b7263a35a117bd56e94dca696d60d08d928c7ae0c07e0a08f19ce2bcd52bb7b224b694b1698b412977b1a6a5f1d261a2e452b06a6c3fb55af316e7d2947cc28c3f1b55b96464430a32acfdc06658bd2cce756409905da9c39a3b6955f28cf5b1d709f1f386585bc39e3ce2ced8183dbe884d449d6ed1d8a28149bf468471c5a2d765f691039d6f22afd13b9e8e9d431d216919b654b3f537a83c45f36493372b35bebfb859988f3a3d38e94768b0e16727b1d8dad9b8716604814f9ddb015659d9bef57cadb349f0504d8b9ac6c8ac43dda579ce26941c14872a8ffe280b68f19c194630bf7076981de21ba9aff908f3fbf4bb26a322ae36c851211db2723f4ddab029cd976dd86ab7da758da1aaf864a69f072137309b751499ee0e3c7f6c1c45a9c3a3f1d0003682f9ba84d38c1cc437688304bcc499f0278d004dbd554c22a04ef2e96954eb90dcc7a2c35dce9269cb2ce81a7025e5f898b00068ae28ca38c520b8fb4bcc6e19fccc55c1f585f9e473b29c616cda9d0a85e525ffb24eb8f66d06add1d87fb05210c75f36b7aef4c274a42d97f7c6b0f3179ebc3791c2892b7bc8e901bbaacb6a6c75fa5e4ffcf30806c416e467fb6230c6f80df549c92c724ea24c0373296da68f02aa2fbfda73"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 429; + dataLen = 4096; + combinedKey = "286a9dbe7ca5d22da6109bf91e63dd0b765a36c99d81a4cb12b6cdc2db201053"; + iv = "e42fe6bb1f20bfabee11af9277e44676"; + cipherText = "7bd2b2404227cce3bb5af50bf062156fd579cc5461008754c6ecdd7000572e6154e1b9539dc862dedf0e62cc688587d4b3d18165fa6d2fcd83a48dca6b651fb621b3b7d616aac8849dce7276d10d7cb9322af54c4313b1817948de876aa71aaed40900c5cdc92848054b735071fd2bcf144c5e60f3734070bf20aa53b1a6b42db1f05f667868d61402a593a9f2dc5379f2f725a273a38719d36781fdf430b2958777716a53c7c481b3f51bd0003e68775d64a701fe9c24cb921896e01894923706fbab3f39d6ad89a511662186212e6b7564a9180e07cfecc6589c54588067482b23378118d482d590613d7f11a4babc15dcb14ad288ed80d7eb74ca52e3e60b0351cbace27950dd612a49af2ba31067e34f87b556f49aa222604296fb1493cb4481b178c69310432c6524c820f30cf464679700f672b2c38de54a66fb74dc66b6c9dfa698b337dfc19efc16f89c436c6f30cf5ee3e351b1a0850242296276b01125d020c803e4e1e8cd7dfc7938502590f5f24401ca393f6760debeefcc25a1fe4eb4df830f3f524c92ead566acdbfaa59a19fa174256200592dbf5d3fd73c113810e91a0cb172ce82f61598289500c8cf80a458e660b2cea12cd3ce6026857ed533f823d0ff99cbfa56b2e6f2c531ce6d14284369cc3cb0b2d6ad0a27a10b3c641804b8c6026c6058766cd21c799920dec377b9e77d9af8ab57d17ddf07cb6"; + plainText = "aa6eb6afa11d3e1914a09814129254171d9b7455ae80f59cb47dcfe695194c60a7892d74bede4e5136d4925960e85ca1634eb25e2d81aabbcac386989c82b489649ec184815cc8efcbe6947aececcf371a1941cc436a5eb850090694d67149704ceb028f413be495cd2b3115e7cc805845d97bb3806fb2f1ad785b1e55e658b33dbd22fb8c46b495785eb846be8e11b342abf92ffe2a97b826fb113c148875e5e6d02ffd65fcde46716ad49cd31b59a09feae0e04b097b5f190523a57e3b237d4a3765da02da58b3d7f1165cd7e8ebe680eed4491459e8cf8d2315d54022c916a4eb61a87c782c29f26ab5fea2bf6dc1c11c8ebf3f3c208e376bcb63cbe70234d37f29f0df4705d3252b2f6381ee1b25405710fe3fc2ebb7d500f29dda61accb8713350711a9a8205112a3db8d5e77be631eb25ada5bf43496312beeedc7de12750ddb123b5fab0fceeb526ca85757b4d3e20022dedb5bfb48b7022bca722150bf317012eb0740f157845c92373faf3e2676b8011e4ab6e58f3bbf8a1ccc365e24f42b5ae1bf1cc8d51014acf876b6299a3620846f95c68eba1afc61885d39d5ff7e62def9016c42ba4bd0e9bed70d37bf9e77fc86858a3bca96a64338e935c6f2e9065cca321778480f2192931a607e038aba2f556352fe5a82200ff78635c3d47a337b1d2aa753d746409b84d028c751818f1771d369dd0e2723e4c41c5d86"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 430; + dataLen = 4096; + combinedKey = "01e5da3273360cd87696e41f4920d417c3386a6e38f2086e9ed335655bac5d3f"; + iv = "a71024e4a153d64f957cb978bba6df87"; + cipherText = "f9c98f0bd80f62d0711f83049293e752ca036145ad5f693e2dc8690e5d48c6f4a136c6d232cf4d15221a4c00aff6f82ffee817acdcf5d97cadca85a25344bd348e4d7c70df3a2724aaa0c02dfd87d4a40389bf69ad635ccd8d8c4b6830c0029f0269d7f374e1c80ea844ffbaf4c6d273dedcf1ddfbd40ca315b9b1cc50ba8edb72b6a174cb4644a756bd59c0385df3a3e5984f580101707487795d9f644b8c72a2e08d3a727383c407bac65d201ecb0f45ee46fe1f3d0660619feb8a4c2049fb948d4b79f09512123f980b9f47b1e0a3d2a0978717658acc08a7298e12bf5b3946d44f702eb2d75dd95e50cc664d9592183506c6e416161332ad9283804b482ad0302dcc5d5273aaa8fbe4fb17c6f85e2fd1b41c75489287008b8746888101a076d5a09f89d3235b68b846e4e897f5695d8a22e3caffe2a1c32b067c6ea63592ba38e7c8db726c9a461aa410ff20e6c5d2189cbc9de6961866d8abcec94a7a622ee49a62f7241203a7a8de7eb2b920a962dd61950ec54090fc3b03cc1eb4430d10800b02ec12ef5355d818e36b9ec57d7b599500bea09dc655c076689b55d5fd36e0360cf3cef44e60dad194738e2ea83e4d185a07d02a9f40d8a9374a93630201a57bc297c59b463909c778c02695f6d70f7203d7b60ff5417f0e4f106fde216b67e226c69c4d67e822c815b8c7f3db31c95b3a402d04098cd414bd1c851782"; + plainText = "d341544b0765b43bfda663f14bc23281598bc4c9de5e7ce8a6b6b875833b77ae6009a4b0d7fddc5ef9570d17d5b3b07950c4e80b4ed684442ac96837ccb39407162639028568ba8ef56102dbd2af0ceb5971d4b1c97c0b16020db8e92d69ddb306599cd2cbabf3656bf70e843fab5a0aeacf8d6c97d96e20b2806133efe85e0ce223ab9e5a1253091c592d450a7c86f45c94bcae01ded17ab11545d6570ffaa2277352bba08230ea22f00a0127adfc8b5e76b4913736940458d5e30d9e8f17ae9419a7c28dd4f1324d42cb741aaa96d0921d47c02e152c7f23800b82c1ef89c6847bab7ac68a776469569c421ff0cee6cc3177df21e396d914db3eb2db238ba2889951967b10a81de45fbf98415ae24e144486309ec1487ad45b938fad853fc80df4e87e8175645cebe5d111556f401d4e0689b1c0277420bad30afb3cc058ab5f3dcd0516595a0a9efbba9b32b2b6736ac78cd7be1db978064c4f6d5ad4285327ebaf16cd86119bef81f6083db077e240ba833143563ca9d5a942a3efe0c14d68cc7af1ca2697a3a91f54c301bb58a40265c696a3e2aebd96017c2a10b9b741045ecfed14c46fb07770d629ee16a9f0515c729cd42aba2f81377be2bbf71979097d20b1ea0a8aea862e3a5d2c2a00d400aed4edcd049ca01f75414e1c4033914e786448deeb520ce48537d9476a66c10c801656e2c57e6e61c0ee91644e9522"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 431; + dataLen = 4096; + combinedKey = "64a28a3244894bd307ca18d50fc735f30e55fd75f26204838e7fc158d0021285"; + iv = "5ba74fe1cbf0c81025f7a1e4a37eb869"; + cipherText = "dfc9a861226c7c58159cd64d14eccb1156b2bbdb2ffd595d386b963eecfb52ee4811f5f1f54767b19afaba55a76ad313b8df1a952c58bdb0b676910d17a5671923a6422a4676a11f747a97ef9d2843faff31d35c0469833277c8077535af957bf0e1d965d62cdad45d90c6001e6ef1465d4f45aa3bd3caa3d44d732d7b56b7bc9e9a3158c4960642bb5528f738ab3a53c2ed13bd9a08f8a653e5516cf7b8c1065d6fc281321a110482da128d2bda87f3378519e20bf1b69a19346595c7b40638b8c6d97e2fadc0d816563cf7f653e99f2e9fc6ed4da99d435342ab0bf1b4465458bc86988ac0305bd2daf22e38b92522eb45175720959741637cc30f2aeadc8284254a0d0ec29280d2c6c9e3610b171c6493ddfa4168bab220d95d0e59d572d49efaabed3bf4f56e49c527cbb0f53a89eca862e6b32f0806658e3fa1ec9861969009036188dba8de30681ff894aa30524fb14b2acd13f79fcfbd383f6f6be0803fd1efaef32d018be14ba75743232e2e8fbdf3ba4102fbb5a38bc8028a865b875160af0a05f9e38591a76c372d81cbc69592d171600fb1d5f6bff217481d915d5af3b33da26514fbae3b8f5a7d2ab60a0d7d005404e679500c35f285c96cfa8f998340c4ab32ae3a2b051dbe7fbd780cabe98cea4d882cbe6a437c470836670725a2a92ddedd5bbf67e67b94a844d2147d465573c32bac347d8218ea953b8bd1"; + plainText = "9b60bb3a0dee7bca3542d4f6b343aab3680742db9a24ad4d6d9f51456c6af332513ee24108b8f8096493b08a73c2928b89701bbd591b0f65c8621ca19e5a1955834b45d7a2be425e400c75f66d40674e418548ecea6819abb80a1d20c251d9003c06d99dc93b8fae84a85deac837e9ba291d03b792bfe94e6066cacca5a064bd680306c57968289ec293e5cfb4b8a61d04b5a82f2b3b5fa8cd32196961592d2d185cd07fd51215f0bd393928a59032cc8391770d8617b3973cae547d2f5cc17d2d6f7f45d49a9f758b132f09ee519d002c8fac0685bdc1bbb111f46b0ec6b182e34964a99a5e3096167395198bb213ec0b1ec0c4e94e3d9fdc7401bd43ba2d54002ba0a17b2a2c0cd39f830cf97fa43600f6d13cc9e2577ee868922601a77516a6f77dc48e4eb1ddbdf2f6b356bce79b8d2b9370399cb147218aa891f89e711b74b7a5753a346993fc58121f3854af12f4e350bc2992437fe87040a681b8cd4a90fd882795ce194a2e1b5ff37916504427260acc06d862548d203c3cdb2e987e4ae610a4a798091e9e5f05ad0aceafdfd1985b76e31c2322a4956af044056c72da0e91e1c5aeb9c7e69d8f795b69e22091705c3d89acf2b155e83b9332580bbbe59544c8f591ebaf243be3d33e3213189f625e79362f19ababebae7a66ec0d9b300f034078cc49b1f35e2bb23d4d1a53ae4ad9682e779ff17dda731e654b0287"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 432; + dataLen = 4096; + combinedKey = "de709a7c7bd74868e030a94917db92c37aed8754376a2920b815b6d4d028cdbe"; + iv = "a17463d9c2fe55f2e3f423ae62c4ca15"; + cipherText = "5a3738a088f02c9429e0f95d9324657fadfe6edee89f685fff357da5649bce3326f4837547b10c7e84c1ea7a89cea4868172008995514f8a7aefc01c733dae7aec1c3cddbcacd3daa3b19717f0077843e15572fc696d7cab9c1f134be9d5b326d8244742bfe52e6c6f01a7a5967c928b82bc79d7e626e5b9e3f5a874a9199ae8f5a95989fb223b3b9973d128a66dce3adcd8ee0912d2eec183b32f8466c61a117a4279ea40ae6f2607d5c9116d11aa7cf1d83e02fda8b280a240ed523efc4016c9452f7e017fed79c67239c677f8d80a988e46398f5bfcd99f35497521ed72b4e068572c39a77cfb076bdad1ef1946fd97bbc8988ac7104d0cb1982c40e6bf4eef784c41296cdf9130a40b1e50caab87abf6811fb3dbacb96862f5f5298576856c9a24be62d89ebfca0f972ea228566c5ecc4536d7eb46766d0d5bbcacf3c6cd6281c65cb817e5daf2ffbf9e3350a31b3241ce3118d22519db99e97ac2675f616030b849c15d021bb9a4b0a635705e6c9ea7e6663e25b9e6af8535a002a9017b6d25d54ac1b8badd0ef3774b969e06fc6445eded1561a8a282f24204d02d825fcce531fcb0d84656290f4f45401c2fcdb033b2bac76d57b848af6eea361c0334172d30bfa3d4ff863819a774d3a38bedc87d1627f75e0f826a52041e33e79dd2d254a9c8928eef92a7095522335a68a3688e71a8b46af0d3d61535641296dfd7"; + plainText = "0e3ce042cf75362ad5ca88ee282c51b2c269cdbae2f3165bef5f228db97cc82a248e51a7005d4b34569fd0bb39b3ad02ad98602794197d0a8860b59aee57bd5dc5cd8e888dd8e5a8e29aeebe8a7bed266aa5a1dc45ca57f714b2990a4634e5931b58c7083d3d1153d01f67eec6318011963f985726ab98b30989ddb0dadd5f7876bb1bec15e89535a4cc01086f551d24fffebdc12430870d3193b92fa1a6f05b059117b4da7d9e47bd8aee4264ecf9755cdbb5e89db1d11e812d3e12a494a7f96c9ca1e5a3570dfa8f7cb9fd38d6a9766aa6402a70ccaac721c403f7b29455725a982f485c91a0c7b29be9dfb3a8e7a4df1a449d84f7fe06454f9829b76b5d34c9ea24e67fd1f5e397c8b7e93846745c82a87ab1c99d9e2cee871df384f7a095ac6943617a90e7299ecff08d8feffb8dc9ad4b21be2dafe9c8bba10100d9577c089c88f5e64906c1f1c87cb0023b24fc044383ada5aabef51df07c027232137d938bd042800d0db7519ddaa102c0e89978a7f7286bee48228b50c3c1f254057153fd5d50acf95d85f2dd5546980f8c2fd8079c4605ae7af1f1d4d24297813460af1e30014ba470fdd94cdc32d0b4308835d85ac08e412e73ad684555688301e761050d7d0c978d75a57319947679767e251eae2792ed554b4e9af735e6d675a4f2492122c378585ff7a61d473115ba1f38ed30aecbc9bfbcb00a7659fe218486"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 433; + dataLen = 4096; + combinedKey = "089f5dbf1f329f37d2c9adf1c5b61710386d22db3baecd5907b4f159335a4627"; + iv = "da29420e5572483836b8c5220665c7b9"; + cipherText = "246329d91cd775474194172c9ad353e0165a8b159630f7b377c9db580272451c2dd2ff9b2dfda61c51fdec3163851087e062c66dcf830a26258c7772599aa4b8d15705d579c1ffdd4ba472463f834d5df0ea7b66440372f3f86bd3c682ee52cf482e1dd9a0c5ac348299b180aeeaaa1625543365dc1eb81037af46f60f58eb3ec2f052db42413740ea5c65cc043acd08c610448b491d73c5ecc9dca99e0d8ea128e7db9520746de38b7271f756e4d4e9ab3af33d76be016b86bf54ff7a6e97691141ffc202cccccbec5e4e0be6be61d52bbdd01f62383f7b7382de4a4c09346ba10ba324fbbb5ffdbb09ce18e8d24ecaa8a02faa1e67d0570e4f2745612495c8511a14746290de6c081f6feadf8c0b996adc6b6770001adc1cc79c719b2fec6346f98d11eecbe5fe854d7471151bbfaac4aa3f77a7caa11ea2379a35171d1e640e8d5489a6ce427ee8b44ea1fd83be19ae1b61347fe01c3e2a9c9da89fc19f151ba943808cbe21b8c4708d5e94caf0bea83f618f17dd8aaf246e9b0414d2d352a645a64110a0543fc4c7f36a4ca6a51c48ba42405449b16f123da8219b21d15dfd413e89afbab4046a14da8bee51c1754aa98c0d7a471a48ba6e16675c0f81b542773208c5bdb40a0695341f53b03c590ea7e5aaea05b3419b81f9b7040b55a409d571c012dee6c55774df18ea293df21e69dab451918e8c845af418e6579a0e"; + plainText = "f1453298b75ffc1c866b30404f45f0d95ff92be512428b759385d56353264c0b24135e80a088ac711e660040809a3649d73518bda98e4ecc0d3c47bce9e89c4462d84442aa2f9bb58acd66106757415601b6a7c3240eac329979b5767c8c44cf0543b3ed17fed8938a0d326c9098c89aa893dbb3c8cf1618d09c05d8608a768f5ac3ad273f0b57c3d15d308bcc7437a300fb860071aa441c102410480df9ed344f8296756836efaaad13eba530a6e7fbd284c8a231ffd26acf1ee24dc086178ef747d1bc11cecf74412553a0c82347da9e545d8ba5c94c1bcb5668c2e0726129e3e925fc7dda0ed0fcbba68ff54ece6d69a368f90c8204fa9c4a38b15162b4da68a668a0ff98be85df2023a2411ba17944473aae9958f48333c57f5dcf3e4fc9677bebf29671777903fcff978d31db22d78e7dfc42eb3247b67536bf8b3fea06ae779c8885534404f648091d826cb81f4292c202cd84b5ed930b0557eee566275026c78eda4696e7d1502c40c57839c6ecc1b237f87b1e7b8188abbde9481e13aa84390b6c5416efec34716285e0690a6d0fea2ac9a7db238c1008529e3f72b56dfad17543a83e527727ef205763c5a721e18a35d358e1e0f7d0ae0f8604b532cd55ca0f3a2f0625bc8e0c771f3bd4927d33c3db571662f6af2c46e0c0b504f4cbd840dad0b45a6fecb16e6b5ac0b880c9aac8a5aeb75a1e5f6cf5dff2c412d4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 434; + dataLen = 4096; + combinedKey = "a34f9a5622a7b2373bbc802759c382a6752118c7d401a7a0f2f85f8ff4f9d0e2"; + iv = "9bdb962b6c189fd7bd738ea67a7053a1"; + cipherText = "5acd34594e56674b2167e69049a4d939a598f6ad32d48c8a38d41c826b7761e660dde307af126ae9b293e7ae10b48a58a6199cd00c89fbdae4368a625cc589f8af724a930d1fdd421a4378143d56cb65d65ee1f9f84c7df50c2615e6baceb247db84aecbc68f9677de4ae4d1c791d2ae13958c2b6b236ee4717cd16e7d79ba97fadb97a0ad30918e82b9781924072892756d72996fe2278327f32372d42f7ae58a8d0f534aa8c267f2ff0847c926d934a70d090078d53cc6d6943c436b5a59a236fde91c1037c4d933c451d4cc8d441ee81c3585547ea23d4d1b9ed8b5ef708a7ce2ab41124b81e279e94a087651cd91ae2efcc6a41a22dbc650ddf48d40083154357e974d3538b8a336a8a331b05c16736baf1a14f8c0522501e44efef6c30aed3c05ecebd5d45599aa9a957e5d187515b96fa8375935687f671be6d3e98cbc908142422b0d3b853c7bf913544930f5da49aaef1af40efdd75cca50e1997a82a7f0be5e9c242e243a545483ff2504bbbe06781bff654605787ba5ef50710c7884980132513c804657d860c9f31318737c6e3547652667636bf97aec91e326af24b1a8c7cbcd76e9747401a4ff04b34514e12db562c84359bc38f82f899220c7b1a59e33d736b1e1bdd175624cdcb883aa51cb0b61ead7cedcff4adb852ebde36aef415a48ca1a6dfaf259e9ed83fd72975c4737708663b2a4811f477b81a922"; + plainText = "826d0d1982467f5f51cc706074e04de3ebeae6d217f55f8466a11cb64ea304e99c11cfe7f0d598f786b5da9d7f3b0ac8f7da23d769275ff9757a6e2750abfd0dc0fea8e75b28041fe221900996196c50db985018832a28f5561db8b34c92bce6bc57ee7a05344e332c7743b3d4d02245ccb19c3e868b823f0395ccc89af3170c9fe27bdf1f93c10cc8d0b48aaf328ab6cf3b27740049808bf6f58fe6ca390aab112607ff82eecf0ca991317e4ed3ac338077db5a106ddee25d05e5fa94ba06b62dc4ce77732c4a5ce1512caec90da98d253013b1e773d77adb756db68be62dd4776b8d8a1d421c920d933850d804ac746602e2e57c91f09212c65371f4a83e76425929c0254982d404a2fae04781e58f24b5212aae90dd8fa7c969d5fb4cb44590c63cad7a34d54c5bff4e2f602639ea178aa01d34cf5559153b8405f85345fca45eb21765c7620db3d930b604196dcd96afa9cd19dd7cc5496daeeb9a3f003b802d03b5cfa758582fb774bbc2fe3abdf56e244452b582da7c529bd613776dba99496f793419dff2bc66c5b599d5bb410b4ab30ec3991e045d7a1698657fe2383c20a076e3d93e39bc05bf000f9235cc8ec817868bb011c38e5fbf06242d42602da5a8b5f5033899b98fd0cf064edc93a304a483e391d69a908b0b6c9ffbde5a10332350fecf04877542ec45ecd3d0312e39598a4f456084a08a878258258ee6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 435; + dataLen = 4096; + combinedKey = "ca72228c81b3beff323090f599cf3f6e1fc5cef36d918cd77e10fd604cf3b6bf"; + iv = "a2d4b024e3f8aa4fd9584dba99b4fbaf"; + cipherText = "188797b617c1e500ca7223a24127f9d25c16e58d4c597bb6d01a28fb42ecfd750ebd6c22ef6a57a398e41b26fd2bd9acc5dda7b4298562bac8f1e1077aa1bb6a288451c03d48f9d30c3029abed20a4096d8774c1c765fa12406a0a313a3bba76d51dad69edc13f7eb2706519fdd6731bde5463743b2ba75d792dbf6b73752098f7f5fafff0edeea67cb080877131e9d55b6290e789c9d9121676b75bc335106de149b60302d69c17154cab82356d1f06a7c94f1d31359d86ff5b4e7b40ab5550517fc202f7298cd4ea1966bc93395a26752e06a9723694da36fe1d115cf39e1c51db4c35899137443077f03cc37792e665ac6104b1efe37bc90e38e27d7c3d872ed74a64293e4cc5be86a10cf9521b640df72d31231deff8016ed88a022f12953d29ef71869b6418bd0c62f5ff735e568b86a41eb9e3ebf6cca4921edf6bcc254fe2560177053cd4812a8274ca4a887b404c5a487a745f72eda873e8551fff5ef4214d1fc058fa930dd22ea8ecb7902ed698d173449ede73aa737c109479474ce87fdfad756a88644e58dc4b08bae9f08fc0ab17a970a40f40f5f82aeb3aacf9d4f32c152dc5b65a4016eb8dd2b50d0d9132f662b9d5f757bb7c1109b86034ff205b57d1c9986856a016715373ee1c4f740c0ec6c884a60a90179045c2a8016a2ab62ef85ebbcbabbc5b6f32096487969971250ac1a890915018eb684540c151"; + plainText = "44cfa0e64be9a37c03e51aa78870780fa663807c1eafdcbb3a8578667f0c8be456f1b2a106ccdea9de78cc27b51ea8a611853b31ae0aa306f36a9d5eaaf9c0fbd0e1f2373e2964d35d138099b46eb5e956b334b142d363bfc6072bc646d7e95637cc82f91098e7516d1fa430cb87bb9249b4bdc4005608fbb6aa2020bc301cf2757703b197610d3884b928a5e27b4676a9258598b62aeb053745833da04bbad54155f0bc1a353712fa6d4ddefca1128ce4d4079e6d63dd3f873f7ab33fcd558fd0674071c67b6908cd64b8d9c916284560a52f7afdb2973d8e8394d406994b0b701b6bb2ff10e92efd181beddebdba05e809502894211978cc91dfde7832da1a31e98aa09692a4eaf593f769dacbc5fd495c6e5ad5ce220890e3e5e679bd78c2621f386adcb6b48071020dae7a9996d1bdaf38007359bde90f87d516fab1fbc1d19e580d53e8e0b19612c81bdb180cc0acfde3bd095aebb866261bdf41bbc672011d53689c55ace96df7dfc09ca37e4398e290cb047164d6cf632f98480de917c4e6e0a2f5d9a7db3b4d229be6fd626365166f2a913ee1cf352c8cc9917326fd2ca04a051651e9e02c47c78d347b21dd06aaf3c148b32f620e406a1618eb74288123f6d4274703637e3c8b8952ec15ec7155b32ce7baa38b697fa434fff4bbc8c2b5b40dc129dd046cbe57eadc9790d42348bf36c50b3680a49b13d1dd624dbb"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 436; + dataLen = 4096; + combinedKey = "3fc1305917cccdc9c2b4b20153a20cc56c1d30419b1463d455f00515020a5ec3"; + iv = "00ef086c4cc41d94674c2d31041abdba"; + cipherText = "6f729edc39cc3c7a59f2384e8a288f2d574e97985591b3a7634f15857812211022eb2989af1185f70162a528503eaf8bc173c8faaf542ae5349b3217910ba8771704d9c08c6541d60176e8b811cec4772e7539618d3136fbad8e392fdd827ad9c83aeb37ca32ebcde4998dd877a46c5beb1a13e15558906c82a75df8106583254bb538e542d40060b031ae43bed4abc8c8975bfe95ee22a7ce4699aa93392f671ea67050223ae10221fe93daff5d4eb41c308725fe63b25c61511c5f8fd9122aee36113d213f66a120462bde06d2fc581b63e00e066e8fff1daac16bdefc2710ed26bb455192f8a1c383b3787fee879828cf3c9db84cda195ae20ff850cd67b04be3c1150cc4ff8460af83e230708233dc97a19faef5aadd73d876bfdb511e739273975a7f8d740fd38aee79a07d6d104d21f6b5e07743a5fd975de9a774974313fe54129946822194849c4e9e6d23ca927ff9df93bb47f493ddbe8c290645267849dfb0b3241c134756ed9b20228dd692e540af69bc2e3f814d76f34c1d7be8ebcbf90300aec870548f03cc5a4f311262521368092495b086e5efa3efa2ab7cf64f1890942abb34004e3953a6d8444cb748d7c213e7c8aabd4e7bc9a3b85ed4e7c38ce4e617e0bbed38f72c1e22ea9c48c519cbe60e7a0ecd83865f8b7ff8263ab811f58262d83e5082b25d9f4858bf0430de84597aed59e0190713c7824c51"; + plainText = "9bd87b4d206cc150a61d65ff517a573bb6cc50dd19ce4e83e1a94600c8e70a54569f3c3eda0cca48c7de9cd6901435668c993a2e8662d700f24d5055cab8883700927ec545a6f65330c0883d601ea06617a600a7626116fd5a00f863faa18b67af752fe45849865150ce8072d61ba456a854292079f3497ca89c6ca604a32c2fe4e743afb32656294c58ffb635102ae03bb217add0ea430953c82d98395b4dbaa3c6cd46b6ed2b6fb7390a203d9f5014588b522643d61ad6f0c73e5761995494cf5b5a924a40e0530c95ceb969f3cf555631a5bddcad7aba03b92c0422cc2c9c6f9447c0b821d9543aa4fe7333a7cf91e17dc336d9a2caf1441dc647e3eca053db87be3bae5f5e7b3bdee7fad0e9e8d2bcb3c180ad3d88ef587343b90be4b1697f89cf1a476b05d10ac5e4540f0e7997715ce503b029aada359736b36093e559c337d2fd64543c681b74d728b36181f855accf454d5b81f4e9a8baa2b4a50363b6fa377f3dc4d517eeae50c37869d4943232d6fbe28eca0f7a86485b343b95102784aa08cb1b360530a14dc42461e7897168c3893d5540c0b572f3bc98085b5772bc8e70b00d8f66c60e5f24cde8ee1824052b41f2ecfde0138b5955f1632d03d9d4f4b354351a372fc6ea3813811eb6a7a61daf741025d0023430480e7a120fbb8d6d9f96bcdd48345ddfa60ec18b3dac3a562961eb1a239e3d6363961fcb0c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 437; + dataLen = 4096; + combinedKey = "679b34004990af1d2d04c7aedbd60688efb8d16f9e7aece61deb62eb1b964bb6"; + iv = "709359f074b740124538ad8ee67300b8"; + cipherText = "a9d16cbc0078f6b171b7ad1ea56779667652b2107e562f61d5a505220538d2b30048aa7375784fe0a54b19d36eff11628f1f3b868feb3d328b0d43626f7f5091ab0b10097b1ed4d047a1ec7596246871d4da1566c2717471124c956cebcce64bd9818c29cf13db46a62befdd14ca3992a9b51b8fad0d84919999fe2a6f234716a0158cd09c69201537de2f6ef4c22a9b9f7337aedb5f3752209948fe8b06e7fbbfdc91b4a7e665f2de09a5b91429f17925cc6da86fc72a71e542a501bc4f2fb941bfe2f6b33ca7bdddfde62ce28187454c6daa29afe749148457164768452eccb797691f0211016acbdb00e3b40c6d778bd021fbf4512697b61c250ae02a4718933dbdf15f46702f50b4fd150033f8c174fa058cffb506dd3a034f347bfffa7ae1c5f6653fe90d8713e723f177d30ca6a671128c61bf203bdee0abe4a85f22e3d3681fd22e21a6a19d042622e9da465ad5234c07482323f2f72c66ebd72ca6c9eb58ffc9bb24d4b2b30bf32b70ce481c2341aa6baf3544d804c9307bbc8a2ee270f1007cd055863dabdd843cdb449a5000465a31952d63bab5b54be94b6115da0a7b3c3433a4c333f2a36b72d548cceb084c158148def1124634f66867a9c7772818ee857d097869a44e76ff59b8854277aaaa4032519b41cc2e69f424fb15cfb5200ad7ceb0e90fbbf7dd7a9f93ed5384b360e3fb6d1ac16bfc028aceac178e"; + plainText = "368454fdaab99685a549d1aeb72a79ae9985abac1c73131b5f34abe99337cfc42608bd238d101dbd1bb9ea399da6caf1d8213c6563c88d47afe98003b5d5ddd3d25422148591c2ee45a8e45c44610a166ba0c80f15c8266e214356bfa8c9e64f3d31de606874c2e6f70bfb83d674187acd2d2c8b135da93a1aece76b8e002d32298bbbe207235db3aba24942d5c409990c59c11d8b141e92d2cf81a605f72de4012bb9e1b6a50bd019a59026f373c6aa9809210af3d0708002a10f771d7847302126fef01f9d1a5e031a82aafefa9c7578d82fae96394482ace1f3d76ffadbab5c80468d21f8cc3d26398839becdf5679ed854b657349553521ed64d51d1502dd40f9b9a9c0fd916f50e8a4c29a7696aeb5d226a70853ea4370cab7c86b4eb7e7f65cb06302784b6467036b9a9cb35cc05234f899cbbbe33544d5f7890abc32e384653dc07d52394cef18da20b7b3b506d57bd17b9f0e20f0911374cb63498e5bd0fe84bad7365b114ae7e48df9cafcff246bf4101caca5539d4343fdd161d6bd0b40cd95e92faa2950deb7a4297afd44bf00c7406f6623ce85785123d8bd6de70013e5d973e3412d9935924ced3638763a09ab1db0b6e980cd2f48037683d98fbae01d97d8f01137b2ce021d832f0434abf87e8128bcbe35344a72bd0917b1c97f6fc38ced25ff947de190b5ce5a00d25facdf3d7c9898ee01c1508363d0610"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 438; + dataLen = 4096; + combinedKey = "3990aeb1f629ae013e1d1bda0d885f2b9485c8a42a38506f365156e44abc1d62"; + iv = "fa79fd4217cf658fb8e195271d1cc7bd"; + cipherText = "d3e7347640adec2407e6eabedbd5d64c88e3d437947b49df7f997b49d78ff24a591044e8b6ccf5c4c844abac295a1df466c3e03e02351d97a2313f1c0ff1c24cafb17b63d87e8d94d540b39b6924de08d85ca795126a3b6246ab033deb1566369d2aea11aa18ea241ccbcb9816dde1872bc554e196f5286edaa4b8918b6d42efbd48a44bf5bed5a76bbbea66802fb90ed0732ac692c11c2514c6af382994fd4898d4fba7691063ee8c161a20d3777f5960c0e19dd21469a9fdf9799dfd86106af6892860cfe933117effd679c10f94a5cdd296f479f8915c989098a8a594726a5a7ddf36e589a68b9ad4f3b60f6a4c060ffdb8c51f11d90cf00ecea7efc60955e4e3f909ba6baf5838f436d21be78c86d011a9417793eec4c06ec868dd860e6e46d6918676a2139241de1cc6ad5f1d89e24c20c5978e68231622ee15ec658152d6ac2f62f5c3fb8c1f74bd47d4a82865c55677c0ccdbca3867b6e971dbb8b9fa71104ce1673ccd69c029b4ec745a4bcb3193db4b2afc7390cac5b6ad82bedf75ad49b007972dde3964b4b7a108883b26301b6361aa646bab5a71e72fa6677d75563d1a41137863e4f7321f03e826161ce371f73477b955847ec7404ed3b986fb686d2d5454a48e243a1cb7bb57216758f3b747d2981ae4b83f7afcef35b9337dfe5bc44f8d2b93ac5754a64591febd4c72cc2bb68bfb3855b9af6d9e2f42d1bc"; + plainText = "e68b5c91e0ac1cece1b4d4e3ed058b1c5e08a86ac46acacc043ca84b168cc1d08ee97b3a8934206102e43bc331f6fc73eef6d24493c0ccbaca58292f4b7e802e87355d956b8b530ab5641e5a3298a2719e861f0d099e36ba129589e30a01ea2370513fb33aa343942c767d9301289099acdd30c70473dac4d08c5204f3a935212a0aed57cacbe71d8b53899aa9c94e19ae5f3e8aaa5e12aade4c111d85dd3df0ef43f7305d315c858de5b3a8e836f414da22d03b57c18b2d9fdc6c40ce3a4384d2dff7fa46dd876a8fd991c1c19678f5ecbe06cb7fab1d24f96e246b63eb4f042709919561556a8ce3141dce144eda5339f512df64d25e701e9c6d49cb16d12229685643fd2a4500830f0a615303a0981014b5074b8cf834bc9d707f1e68b712fda9326a26896aa5aca2d9cd05a9c378ab90f08c5986aa7d9cbfe9d89ce78a0a1c5d0b5a394c084405a60d648bf2c2ff1584f6360fda4cbf4570a8e94fb47232efd6e184bb4339b90768d6819e4cdf872bae378f693bd355b823eba1d782c7fbd010901a8435a3bef17308fe740487581a5d8a2c3d4184a09c06d1624c40733d0adee9cdf2e9d6e543ce67e22775511ffbd18a860c55254626668525e94cc9b2798608afaa5988f3d5481a803ff8280a4e4992aca25f6ac47986f73ff6b7c43ce1ccbc6d7e19308c6969f983106e8703f4541550a1a7b097935b9ac0a20f8752"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 439; + dataLen = 4096; + combinedKey = "97b7987daf0625931f20502c9138ec335c2da147c6bbeb4197765ad1dd3767f6"; + iv = "2248a1e0a4cdf2965d3b19228e1b6168"; + cipherText = "79d5a875039100aafb54648fc529e63600d6f5e68ff6766f096d3d7de9be05de31ced45099ff1f93cb24baa0c72812166e2d1b7aaaa955afdf5ba4727ad1caa568b43a8f03044b45c7900f75a76c9ed05793fe43379a045d3b944313aaa2e5eaa1559b720e02d88c82d98f46ffad81b493f174f1a1c52a14c806c9d7cda1110d51c2da2e2a60b1f90418450562d36b12d3fce5e4a7e45c9bee297fab48e45e4de753fd925138e413215586e3fb525b5858ffae2f9346c89a8d40bf22a4fa5dba63940f74b3c894b2ec03eb73d08886485c11b246b72f838ec50e2ce129ef1256c8df8c4f5cb078f4a339cdcf00a55f04e5135eb090691c30056590a1791e36fedcf7ae7ab28cbf133f6e3939ec4e897a4a86060f901bb62a83292ed32245e6cb7ddd5f352a46070d9561748c64d15b61e7e742324fd4a7db4a71ddedd2d9d7f148de24398c1e11298022c8d885b2c17a8d9361499e2200943037ffccdda66562d9a59a37d4891c61439c82d24f2d159c048ff6c5e27371e2cad12080c0af500cf3fc204d9b167fdbe6a0759da675e1b78a58c205d87300f51edb8cd69ae1bb2122871cf35f1bfacbe0b1f3b505a4fa32aa1efe661b714a581c98f087c47884d606d0cafd9d14396b59ebd5ba02a60cac0c542eea278e93718ea069fc3ea99094788b7855c2f1e0cb246326a3a6ed83d3099d6bd032e5eaf4f23e26892fa034cb"; + plainText = "704ccf6e9c631f78b994fc3e0f8f8e19978a5e9ed4098c57a86ddbe576d6f0f35ad03b66f01769f3b16f4ceef26dec2b8d2e64073dbf47d99c26f8c378990674439456f89275ba00c693f89faf1058026837e09ae3066fde6ac44a7aea862fafd59dd99a3d6aba0ac5e187098999bc043e2980f0eba844b87d50f58a3484523a74f8f8b9a122bd267491ace56d4fdda45e847db2ff49a321ac9925c41553b158d3828dcddd73864369c66f5b528b45e5dcbd07d81af406d164f6141af200b31a1dcc78046527b103cd82ea90f56fa961ce825a2b60092732be66a86944fb062b8f4548b98dc850aee4133f78536b695282288397b47848f771fdb101207ded6e7472f7ef1e587f5c01cb462ac9e68cd0721c8b71bc29d09b70717bd238b51a20d677c3221f9ab40fa3f6b17e7ba6fe1b65b5db875a4fa1e830fbc0848377916d4449c6252392e6d94e97b57a0f12bb2538a7d211fcdb511b799e4e36b0a052316b9815c76739086c1992723b466550029a3c1bedeb059f1a0f5e969012151bbf88bb7f5bbd0e4f572abc5f2d30fd4863d8c226859380be6256fd8d39b8f3c4c32178f7c7d1c2f7d25a099779ffcf16fd2ae1e140888819715c66c8c80b6c39adea6267477f1741014dbb3dfd5eedd97bbe95311e8fe2bbe857ae211f96d4d8a8d7824afd9c6501833e696faa03a41ca04402d358a1ee316a17e70d3f5aaef8af"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 440; + dataLen = 4096; + combinedKey = "580a22ff06e08d0c95dca8501a78b9b68fae87ef5daf0607eead223815669b9a"; + iv = "6b272b1daec6cdb18f6b99b529f85050"; + cipherText = "c62e6b75799bc6f8b4932a13aa92bebd7d81701bff2d8d986c993fade14c075165a5b8314b1ebdfbfd436dfd02c91bf835a91444bc2dbd1edec9c203185950194f30762c0dd8258a891e6e99e344ae78b6d1f2dd74e26d169b9a86f73c6d6fec49d2d0a33c9fa538d40469daf56db32e7ef5df477ad0a38ef228a3d52480619003b8997e937c34f060d9a74c7fcae5c689b1d21faf09f5e6bbe4106170fff3bd3515fb8425e089b4507611418b352fdf01ffd329fc335180f2ced9c59b8a60d5a430d37e26cbefdf4dfa64351d8babc2cc892f56a72b52c206312b37e5e377419982ddfa57beac2ff6f1b007b8bf766360f98e17c0488ac505c7a8070640b8697b74f3f1721e4f54270940d84772391ca022390e9b598895fd19d8fc5ce8448c73e006c9c9228ca6de2920e3152fa79383ecc461a7b79bc4815aa4af96a67e3bce20a80aff20154ade3c2babbc531eb3b7c5bcb4c084460a8da0d4737e6c87a23baf952289f96092e40837a64382254ba7d09b7ff9b4a500a2cc9340a9bf8bc43d5f586f6841029da18b9d07d6ed5812b8f6cc2f3337030a3dcf5cef54409e2674acef0e5528b370c06c7eaf3ef4b5853971f457cf8a5a373f537a633ea3d517ba33ff3f0c1e2c8ed3d0d5f7b572864adc33abcabda80531174e0f4635b210e4e54c94dd9fd329ed907b9addb957626e3b2b40e2026b5827cb1fa62b89a3e378"; + plainText = "8ec1ce799e7940c736a352f37584957e506b844a2e92fcea550141125bf66f025b469dc3ee1ecfb2b46081330fab6dc175485a52b08432b30b4884d302e0443267be72ea0fd688c58e3824fcbbdee063686b596b039755f7192b88a1dfea693b4740fe887a3c854a7b80a8ca4d23b2e908241c5fd7ec26c668582e44f37134f80964e32e37e3cacb03e5b42aa3a2d84ed70e81b37a1392c4ff273e7b84a4f74d78f53d20e88b4c3a914dd63fdd5ad0ead66461eb1faafced1aa4e2f9d5293327d2b4c146125ef4ac11016c74eac94cb53a8c19d610fc4e7a5af198dcdd241e59ba2743b52c0f5ca14f5f8094323751b3e5ca4d37603d1cbd608dd21704d3d3e68637e31e77973f9a0e74c81db155b1d1dcaf704bf24d2b664811bae8d1a13df1caa24cac2a7df188d27f43e3d43a47124f8c4f1ee7510db962a25f429a0f8b6178be5212ffc762455a43b07f90923e01f57ba8ab1f795e93acece484e209f9757198bd9e8df400fa0c9680bc126ea59953cfe42270cb5bb529c6e94c5fddfdbce8c9873e7b8304f7b3c1bdd6b18a0cbd6ecd695dd48fd8c99fa044cb8dbdd80b070b10fe9746a7ee401386ee5e1fdd2ac414e282faa1c3a5d8a49482b27455aa0e81688a38674d9425d6d31806969b3dbbb3377530a4aeafb918ec767bede0e7ef99b8ae00550344e828cc30cf71bff7bc432ef89bc3ae269f80ae850e058b30"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 441; + dataLen = 4096; + combinedKey = "91e88a75159cc0714441fe4f239b7ced63c3b57b742ec1aa2d48529cd02536f4"; + iv = "eb803dd4355d5c860647c91aaa7d86be"; + cipherText = "27d9a57728cb859a837754a116c7ee402a4a17b4ddba5e3ea6b34bf986c61e3f5c40301989e4a4c71920c2810233187fdbe08f18c844296d9a9f59e714470118c26b81b848163f893e009e783e2d8f12356a1fe8de7c8aff525bc7888d3f461c4a5328bbb6f650da4820fca8a431a9174648f81837b32c92d0a13c244d9c10f2389b9f76a115aa60862120779f42e8b7db093d462b76e065c97464ec70e92a88f80ba1fc89e47dd42aa699b1cc9e0f9763e688640065564372367f495c5b58634639cb6c3c636b767dd91503e4108a62efc6b235082bd4a6647d14eb9331da06b3eb4acdae68f8b22ff556aaf57acf0e195751a3096c4fa220c2af0cd81544b8addf3adaa9fb2f5e06772c0229c7815bbcee4011ff277a7cf51aa80faa8fea39cae30d0368f78fef4c0eca64c1bb47351979ae79dc5729d7879871947f0bac7f357159e4f8716b5bbdcac686ba4c5616d2d57a20729fa10d3628ebd1df3633809042bf687f6e3690baf41968f331b20d7f363ca886ee6222058498929c1fc9c46b433ba4e885c93063a8ca877b525e23a734c6634d067c43c55a5061add5c882c46126a2189cfbecc87d7c7f7d2d16460cdd32e5d6a48d0a5e8e7233b4a0fbdcd310181f19ce181f3df8cbfacb3127b3acea1d4eafedc4493bf2bc3f285e7a83cc7738473b0f2719282d61c883a968b824687f9d86402329b5439e5b7b72ab37"; + plainText = "899c609c9d545013dfa0dba037fc854620ceca5d887895f6535d9462aa98fab157c9d05fa2505a0e5ebcf72c85b910bfa799b5de4b51f9f02229f2436c5b82d6c665db1e1f962db699f982bed48a2a1c7d24964110c1e74a498600338be10366f8e10c87a5a2acfae1fafd3dec898363b106eccc7eee472f1d0cbf27cd195b48439d4a43cce23f08478fe22a0eaad25b8fa7a6a6907147e512e08b3ed95c16d0a1049853356c4776b9c6b341aed6cb8439b84b29cf8da7083232ee2df70049590e4c9b1450ca8e00976b4c5d3ce2dd7cf7ed9e601ecbc9780ae0e1923610d7fedd702f57091af91a4b8886186c95d04a34132b720bfc9a5e6caca671413a702684c0cfa0e4123dee3af4ae2852bf76c2483006101ff5b1aaa26e6e52e737fcec5f4bd241d8756f92f7f3069142422f4ed2af3f690b208d41454dd39dcf1a16eb198bd1b9cce87b33c2ea33163b356bb8d6ab1dbee7ad144b9c13619fa79b7ecf8249c4c486b47004371e5095247498bffc4e0a3b292c73c08fd376b7c00341a46ce0ea109fb676b4d812b3852e2b9da444f4d51892f2a152ed70d9c2f83429204a81f9ea82941ceb1ebcb70355f1356aba60a57cd0100fb5dd9e0c2d7c2de6241a35a9880d566ffa6aba0ade86695432a161ae137ad19a8367f45b8e520203c6d8ed08891c038044966825775ae0d2734cdc2bbc15b2d8a47f3612caf3ef4a05"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 442; + dataLen = 4096; + combinedKey = "4971a00062e78c12091234fbf45754b7661a207d8fceced0c2e4533fa2609258"; + iv = "a1ac49f5a2432e2efcd8434a52a60c1a"; + cipherText = "a1a62cc2f302bef70e9e0386f3a6cd8f7c67a065e77f36b3b4e5ab9d25e16c9797342270942e4be6cb5a1ca265872f786d645452eac04db9c2c1b8f63a9625beede887c805ff49c7a3f6787cc804b9649a9ed8fe0504ac6fdc3fa6e9f64ec09218064033a0f18ed4ae5531a29aa7faa353cfa5dce24b9bda816f030a527064031cee39571d6f992ae3bd195b3e21bd124342baf47107d673285051d30c81374419bcdfd5b4a28184b2a0ac96953d1bf39f323c166df43f5f3ed8c04c02d4d85fd0e9f249e017000d4fc218a7ebb59c3abc0c2460a9c86c7add3240d126375d243496957ba8e8cc10669dfcc3f7684dc3f5dd1493364f7fe62e0dbf7d61211bdf0dee01dd8aa29d5d0b5ffde34227fbbe7532d70f931f7e19bf1f0d5633e57684b506bbd378acb963f9211f6115d8f82ce79a1573713c120936addeb79406a845c06613462fa2d1a698dd6a3792b8d6dd1f694cb02b21fe67487bae00977cc09ca5acf0863ecdbd7f645ea29047620906f80985ac4ba4e3881184051f3fa51e0747ea0522ff1abc3b80b611b20ba4bade9f5937e13f5550cc394e22a867e34864efdad4ff401cd0f7df933531ac24cb3ea6b1d5274effe09549d4470f1937722c0882d47f8dde55a136f86345842e0e4c8ba4849ce2cd65d84c243ec0c76ab43496005349726eff98662bb1239bcaebde0ffa4501bb17f5c838ad6d5f708774be"; + plainText = "ab1be0b2f9390ed739ee8158ac6ae2d37c8e10c832c16a79340ba63cec1fc532fe765bd5aa10fafdcc49a97e028692d4be1c50403f738db695e3d16c07b7f0ee93c57b0366b104ba7e74e5a57e8657dd9adf1ebe559c279c7f84c0f578c0d91247b546b1e334a26a167021ba94fc064039e4320f717bc202f495f5956d76edec2f1eebd54930b448e7c70772e63fa30d143d16eef475931c3ddc080c1e149fed9ab7e06147547c887bba863b38eb01613259b651f4c2c0e47bbd21fe32ba24e4cc5558656dd3144c439ef05699e539003790d6209efdae7b5bec61482feecfee601d1444d5fa0f4fd3401b1ef3215159c310b91ee9e2aa18cbc2eb36bb5cb4223f902524558e71a513c3e48fba2564a1efb0f7aa689fd8608e85c6eeba9ba3a9acaf280df7de1671aafa01fcb6d7534e517edf29d85bdd42b3e9f570d57f12585ac131ed05d85e9bc27fa7010a7e24a011c467462645eb48653379509c89da085d30599e98094a3c0192c66015eb9ca35740423713d40678f4d66d5a99496875429a0794f4370d98ecbc46a4bdc6c44529820aafdd12b528245d12b83d751e4f40942d78504c98acf3ba6f4aa6e9d6080545460658eee4870c3163033645d3dcaf8b70ee7f719aa8737028584476ad8283c1df30c27bf6ac4d1a1d8652588c41d7aea290df55c85bbdcdd47220c9a8954523007ffa0d69a55a7e2724263b3107"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 443; + dataLen = 4096; + combinedKey = "b721ea2f04b0bab738358240b55a5b8afb690f76a139bf64aa75536ec1d2fdb5"; + iv = "bf94a5b5bb7eaac46e4e8d9c3f133d39"; + cipherText = "c6c1235fd279fdaf368c055e575cee4300ae9ccd092f28355061a521422514fdc8ee7ae33f6e6b8c60463cf9f9ec129f57dc936d428bc68fe41b314c63b2b29fbdeefda999d6f36142fd9d64f246e02f128f82d41a9e915f679aa6c2963afe5cb4b03c71292b9ed74e4d989d90e150344fc6223e1584e62c62b1bcc3160bdace14ed3db5a1a78da2706f3545797989627d00c47b6f06d3a55baf970e9b579adaaa8018a52cedcf78c99fde97004a321b2445def9e2b9b12dcacd04ab3e0d89ad162cab14c3237e1fa56da052f92f5530d73110bde0a3913914946e22596b9662062364c680aec284bb337d0ac33383bfb5005ba065943382560d612d5281bdc4ae4586d63124b26bf910e58216ec27aff530ecd717588145fc875a755ef673def82e1309bbff82ed2f4fa0d4aec13a4b94bfcfe7f97816034a465c5a27652858a6cc7db98e880b4efde23845006bcb39ca73e94e400e4f95805854409c908bf734e7728abadb6797aee452f2aaaeb3aaed7ef0a9e83ce18cee1e659446ddd87369a3f48cbb7ba64f6fbb6354a5755178f0a67ff2d259cd4c98e97b8a5354b3c6574c93394f0ca312c7149da60842960561183f6928e7ff1af1931b5ae9287e86dd5b8d2ce839b6c315a478ca9dda9749189a3b689f7e7a7ba929cd1030f3168f01c6b649f32ec6e11fb6a71357f94acd91bd192bf30b42390fcab417e8a73539"; + plainText = "5d8899a12210655c04d954bb7fe5fe1815c583449ec6dd6b6385c1b3faa03c33c806dedc1c32ed5f37aa26408802a7120a92d487834ab548f3e85babf3bc00ec5e0f5ddac2d081d12914a933f95cf01e67075a1650522eed0ca32af662e41cc4e1e073287dbdd14da6b1826ff25c9c79884a9212841f7837746c6f5a258fcad35581432b93ab93868f814485dace1861f26e51b5a4103e4049c3744d4cca3a79176f76cdc06df80a7b4b09dd937e9f9a59faa59df3ab9ca24b678634cb3a3af97038522e4a51fecb90e9a1e5a9b14231d5fa3038f4924a80088ef50d7c01dab225454f12e89bed44b30616f195e3c91e6954ff38876cc411343f68b5877f845852e2585dce2b4ae5639ab9ab838c0983892d200ae10c3fe1f1910f3aca64588ad05c7cfe693eff276f72714a8b1855bf124fe1fc89404371cb0e28e3748a0217e503cfdd8bfad6f2d01117c2bfa974d48d9030df333b0a0356052a72b2fe089da5b75f6286a6c39073855838b732c26fbfab78d9492b76cf2c90c10c6d5f577dc23623e164eecce2cf3a35c995abf09e054deb24fcdbdea7cf99dc403cb479549e8dd560a995d8cb6d0a3f2e2c0763142c2a5bd5ecb439b832d99f416ca3a97745c284b27a41518efd9df6bf1f69ec4055748da9d8a7cb614df2004964faa004d3063c39fac9cd9ae616083426c270147d37f1eab720e798d8f30bd137864429"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 444; + dataLen = 4096; + combinedKey = "2c373ce4c66a87a5239aecd61bf10f01ec46ee05bee761b620804d30631e65f2"; + iv = "2a39aece2ea15c12f34d7ab89012f62f"; + cipherText = "709cacd7b100169df7e6b01662107a815d94763eb7c5c3b76a50f2ddada963c30a940b06cdf8f0c608a72081c75d7e7f23bd61e475c2dbbda195f20f0302b018b9464da0e2967b97fd80e2c0a1316407f5447ea3bbaad6c8197d55274b58a68d22ea4ef827119d0fb95d534096397acc1db57846621bae47aa26106fb8265d2dd9607ad4315a105415fb9379bcc7498f9a5cb81b1e3f00d696955f2208150bbec24fd253e94e10f3c053e21632824fc59cbe3aa8195f7505ac71658e7ab4f5033096e031e576bf1c535086684f5cfb1ce88338ee3c58063d4a10c3e42e5e7894e4325a14030c7ad2b396ed5e89cfb6eaf7d77097ac626585917df12de0406e3119bbbc2066b2df961731b4662954d9e41ca701c18b49fc2e2e5bb52ca2d0f5b5b179182c8dd7577dc59deb6ed918be452ec7b1801cb5bd8db70b179998ef53a3ae8aaa63c82f219b3814a131a14735244dc73bffd67974e97de92c52282eeb0e58e5ce452a055cad67f1985466edac23f62be4982d809e267cf0e069f1a893006668f64c9c31811c41d14473daa4e52abb36c48706290b5996dcf20b88a915f5718d830074bdb2e477c20c807d2f6eefa95c2d3b39d9796d070a703f9be61e065ea9150b717ffbbe6859e73ef1f5775de0d97f6c93482196ca4bdcd761b51ec0de603c9c609188c2107a15eccb6ece991d3ee1c24f0bc7f763e3c5c73384856c"; + plainText = "c32d097501fecb95d2e365d48e21fa68e004cf9754c64f85b318a9a2b337694ad5ac6c5a361273f11a51bf8c1a96d1860942f480080a26b773d9189438d1d50ab72bca16427c717d37487bebd5a069ba9da1c2a19496ca2e5dcf11276b2da40080f78a2da646b0cb658a2ce36771ab5821bb3fa11416a97e675080d8f3e9b9491a99cf45f9e77d7bb126e5aed5d27afaae303bc9784b2673eb23ca138aceb89009607d7a8f54c8baee283f18fc615f58f1ae6acc24925e97ff5f0a514efce3b0ee1c7099ae4e6d8da07939bb11436e99fe2b940efc6bb71275639fbdf178e517a0b4cc47e96d95dee1e3c42dfaea7965fc9881fd1dd2c140e87e6530adcc24c583f9e61edfad58fb951bf9060d56426adc78276c217a5659b321eca783309837dc96afb0372e820ea924e180b5e152ea779db300658bdbd714f71b1ac841516eb0b0ed10ce87694e41413a6c2621c64962e216a6c5e7c246b8a531ea1720616b9ffc4eed703cc0e00aa76a8f7d646952f0cc9987ab4da6e194feeaca2b2b15dd7d7897de2f5260a2fd98697086b4d0beb413571d0ef66985adc33c049b7c558dc018d5cab470b5af29034033c31aae9561a8bb317dbe64425f89c91c1be9c300ace7a5d611c4b1eef29daad8314375275f531f1509948009bba3a2b46da1eb09d7ff9424b480f40069078c6c4b6832764e32f2e603d8818d3bdb3fdcc41d4140"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 445; + dataLen = 4096; + combinedKey = "0d65367e1fbae0ae2ee910f36065a8233faeb8480813c88c69b2da0198b744fc"; + iv = "d00f578ee41269ffccb561b53f2b718e"; + cipherText = "434924d0a85ed8ca3c56311cc0d654d79e460c929006bf7a5e737e837194d04725dcb5671597f1d0d6e155667f47fcca8de0c53fd49ee606113a3ba9eb1caf35c9db3373f45d6b67c45d658fad68104dccd81b8ca69e1a055ff6b52b0a2cc50f955a6ca58d693316e3708b2f0088dfff3e81944c3d3b9da54c5ec4f73b26892eaec407955ad91e12952491439a227c8679fed08d2c0f31d74ff9f380e3bbcaef28474198b167afb8c6e9387f77e0c1b05a54ffbdd4ea2fd61c90ffe588b3056e99f407fc3821b54e090731655fe48e5cb21cbc545ca47b1670da248070cabdb57c3a6d4e234d88a9d3ad73c98a9dcd586651db478d2072365a339de8cb2a82b24753d21351cf1319c73abef34937de85b3c27328dc0aca2b1567a74f9a70a6ba3f7d8354a0734e2ba25966e19c1305272fe948ae03f96ee8368a142c727d1eec0464129d67b6bd46d2733eb40c96199b42fa810313ca3855d3ccae9266342c8177010a8ba2638a36d9535efaf8d6209baa6afbf9546ff3d4f08f422dec8cdb932ef9c1da0715d29c5ed7529014f15ccc0941b45f3bc7128b7f692fb19511783c3b38aa7b63ae5db92812b51a465b7ef3cfa0669b7dcc56e6d20de64d47e00b9240c7d9a37342e986de71c3ec41bdb658f4e3100d6a011de032f6d6f54bde46fa369591ef0001dfcf7982649acf3c16df73b8ff2bf84a23555a31e0608355bb70"; + plainText = "2c00216f2027b7f30d29cb6964fb25633d63b0e9222f6bb1c123f5db0bfa183d91c5d58b60ca0b4ef4639b4f87eb2ac58056dc8d4325b140c92bbfe75d144e33d0b51c91d5b0eca89fb4e06a7dd31a03b4c4bb16f1fb30b37b42e0f358aa8f5299bcfcf04df29fc7b42c54caeae0230e0b94ab80e1265782ed837aa41694e371487ca3dfc1f3df5481c7e1300fe5f450c63bbfa2019300182b2b855bbfe0f500c99975bef71056db0fcb3774d96eec423791e7ae19f1c7df6f07f27312af2f6b765e4451e2a909eee679f146a37f37eef171831d9ee3293a15b5d27cd7d29dd4dfe86f7a1760e611c3baeed2fa36701ff786fd192db74eb4a8bd88d3e837f33bac6a3d7cf2286a2a0c00054801dcce7fe3ea87665f4d8740687221d5158d95da2cbadf66d4a0d446ecf3e32771f5bf308b34baf668622365dad53e0d4d60afcfe218c9d508c34fa37ea45ece08eab23fb99dafc0cabda250c5b9d6000cb5028b3d06c94a8ff6317b47ec021112470e1c579260ca86cb90a1ba43cbf69c1ec76405bef414d5f540efcc37a4f0ae218215625f0b3f6fbb0d42a7b3f955d364536e02f1ad1b6ad0f3117fcd578a52a2dca9ce89c03fface5d8abbebff80b7053976e0b27cbd0e3d80cd6b287a2caaaadf5e31f24dcfaf6338d430d11819e8c403167222b62c7c95c2d795837c660da2c0b78a21991917b3deb2a17930201e0250ce"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 446; + dataLen = 4096; + combinedKey = "57efac7885a19c2d837d67f5dbd468ee04e6ec9aa86818088d28149259bbe957"; + iv = "16aec32c9703f4e08ce017f65ba8222e"; + cipherText = "24a3b68af81d2b93400d33598a1be352c359adf06612752878d6118b5fe56bef46babc511c4d408894178fd8af945e40898270e0ed77f500d0cb584c3b5f87f3cd8d83462a11bc230ef2d54106af6eefacb7e4532f176320372440f97d7e25259db15f9b078a7e14e99f5374020ae35e0705d80276bb656bb7ed48226a73066546bc10cef97fbdb783e2e1b648fefc1a58c95a010630ea7c86d638d056ab5ff3b0a31eebf5221a808fc5738e52bf85adf3f50e9be62c38700f72f637a30a7dd816040e75398a81152274efc4c670bdbf8a52c35a8eb37dc3cc486385048144474524f0fe7088839227e1e45e3a44545564eee043772925aa5398db27b628be899267155442dbc71c441ce2980d0c67c794070c256d2ea257a11120f281af23517d7138df3a4ae9765bbe83c3965fd8244989a8019b532bb7bd3e71541b1010e5c9511d886ab0c803d1e5c690a1059d3435ce9451e075ff6c3328fb8ff7a16bc3b2a70afb484737e46f185c62871e3ec6c0682be08cfe31bf62cc341b72debf62be146adccd5acfbe770495b77002bb849b84de0287bf2aeb3e70738eb078e49db02f03364c9011053e8a2171a420f9c2e3438eb2f4c799aa5524391f7315f38c2caee1d9aa5ed68ab8be263493eb54135ba20f9f25d90fc90441018306d4299af503d222c99e1ad7297c4d355ba2130dc0b77f0d3843ecde20905aeaa6d728d3"; + plainText = "a605339d3e17c3ee1e26fb56d280ab01bb1e7b8eb422843ffa765b80412b410ebffed21561b5838e7b4cce54ec5d8571b0c15341de966fd5085d392119212d966250a243a1c965388435da5f93921792aa7b1f3bfc3695c8c36b0a150bcd95a11678ebeaa33bf802de6ba698b1d7c019a59d5d0ebbd9ea0e0c997eaa067f61870802da5bd3fa4df5dc1258f3441c742e1e05e1c76f573e21219791a802e36c914ee73996078afc1bc32618431e28479557435b5ca971a407caefbccbfbe7eaf3d4344f3b94585dfba5222727f9993391aec0429861b0a947aa8e989ff81dbcefdf3e720c2c0375ee9c8b3eaeebe5cb166865f46bf4fe89a8be0068d6eb3b011493de03cf8fd2feb4b4dd8ca8262e86adcb86021230d929be40932c954d8f6f1090ae377adebec9b5fc2814d402e42ec0b3059b18ddcda24ea5ea22de898474d24ba372a5bbb9abd4d739db330c68f39936c8589610991dfecf3a58b309ff1617102d7c3cadb88ed97f845ef8731eb0e7cb976629dfe208d7f32826e90aefa2746d04b504515c38448c81b034218746fadcb024447f4f78d9670163e6ec98ced7800e8ea6e1db132f983c49d98768dd57cc1161c0c2a181380a407e4a705e846e790a1579f2ed6f02c21d6ccd1c1e0f9191857ec9889f1129df86739c03d17183f8f42a1debcc32b1e02f7da322e2747b7a8363d3589c9e6a293f94544c7d9f1d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 447; + dataLen = 4096; + combinedKey = "583da0aa0c6f4c6ee249a383dd738a6fac0a510374a5d152f5a1ab5c0dafc34e"; + iv = "f30fec13deade0413306a1a01d39535f"; + cipherText = "818d4aa39804fbc9550f18e3f2e77021cd1a866e49d0651823bf92432da45546be9b0575b72d8fc56c53ee6ae41f16cebc0d0f5d16d3c62158987c7d0ab28bc77d24966ac2f0e830d1adfacd6c9d3c0812d6078a735cf8e132d62d68553e12f9ef2d627a99bd87a0df3488493bc062daad0ca574fe00557c6c9812e02cef2ce43fdbca7d681f6777140e07eb5c9a729056550b0973470b27f7edadb2d05bd537f54186070ec1a94121e4db904bd258c6e967b75d266347cf7571aead0e2a0019ba5da8c116e7891e814ac7d247278dc9f975fbc36c21b10752e5828ee8164e06271d10bbe8e3349fbbc2a11caaf0526a0eae047cc6d62f6903db6182c0455aaa7f9e02c3933ddef708345d40d93637c816811442d2ab02a1fe01e417674d05826d6d10dc017fb58791f7b09f1fd94e046f3077b08abb6bb8e33978e962a84ed1ec1c850ce3e1f04c40ca589b9fc463e90209d302168be096bb7ba0c7723312f2db8051e9d5605c2eb8c2232b521e1aaa3a8a160240858420afe6638139dad78226df140f77f676085dfde05d07846d83b19cf575832a8cb4821fa34aed5ebd7c46c0df7ff49ae8de4edd7bfd304874609c2d3ac09cc68486ad5751fffc2433becf9f71134e041c56058fd35972169612cb2d6ab1bc4654e31fcc4f84ab0c7f647e9d0bfc03758c4156be4bcabe751b9ab982470fd00ae11867305bfb5827cde4"; + plainText = "97c0ed020f9c2480974c018c871b9078a3db0f2e90089e9b5eda3a55937938d25a20ede70bf18825091de0b4bc5d6033f346bf57e40929d46cc045457914ca74cb2d932954d4b1eeee72166dd80cee0c5349dc283cfeb6c39c1ac6ba773db214fe53e5769748e90aad163d8f68cbb0eed750db88c5ef1f806629321f8316fdc4a51a354ad4f10c4dbae1bd6084c3fa1b3702a7fac681565d835383c5a7341d90a609deceb1c38a1ede8b9b2bd5d3a18762423197a5eb5e77584244a1019698a46aa4c511c23036cbe5933fb485c1fde9aa8f9ec35f6dc87ff45e9d5ae9ce98fc09874b05ec2ec36a19e469fe9b6dd3618c939f3d4a62ae475d451a1ed57a427c7806307361c1d6e1eab43fb24306e2a4ff838409ba8c776907eb741d9d240dd7aa67d8670f568c44adf885b6d47d2ec7638440187c1e5a1ccfc8df377c6c86d33ee9fbb68edef6979b1530ae08e32b9de1eb8a659e001227c4ddaa294fb6c980430a7e14dd357a40fa2cd269f20c1855f7b57034b9f161d5bc386f8f98c0287d276365fac74f3697cda30db6bb519491b4d810a2edca1ed0959fc449f7d9c8d5c64090c5831ff665a2a778dd8bf07ace7d38b68699d70217e813b589c5db4f877f6dc7c4ad74aeeb8a57529a060a641b4f996fd6e2fe07beaac88f98df576709842f021ce50cae0ae08bbb9c01955b945437bb033b861f4ccd02edf5926d787b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 448; + dataLen = 4096; + combinedKey = "ee1f9fa8631b0c57098ffba378739cede014dd8cee9ba782c9a9cda96503e108"; + iv = "c80fa14994e93a0e5e10132c35c5dad1"; + cipherText = "1c9a70ff3e22b811b767962478f00e60b25d69e97eda443185d05b213c6283768666ef7255322c025fcf0fff3f4eff8c6efa29e6b7e7ddd15f77fe7bad0c8018e3416bb970f8fbfc8d71657d5ce372727f4795d7b88a734b44fbef15866f43c3f0635749e618ee37f9dc9438f6e4a3961c7bb5d9a54458e450ed1067e4a3e5fa0d24b7c2939acdc5db85b3c68b73157c859afd9be4aafc3d575243b4ca2b1bbef3b82dc3481f4f87de7fe1a1be279500b41d7791352bc3296053b3c5a9343eb960689424682236610632b5bedfd50a62c10814ad3e2adbc702d2d63e2fe9db8ab440f6db73a25837a72c03760fc2a4d7181655730a75bf9d26562338f1595bb4a7f6de4dd67e4e279cf300bb8ffe5379ac1b53fc412803c1cae443429cb00ad5c4bbdf4012f02a264da51f58b20bcc54230e5c7754871c061eb24ee3faa3041a3bf3d7fc0464fa2ef920def016274eb6db333a8165f9114d21fa0caf6e79e037ead777e978b45daaaaa4fec06c325e6aae82e8c4df231b5c056b2c114a7db1b690b6da7887d1a5a05a17d5a35ff95926ab1f1813aa6eae8ee39ff9b92a77dc886d4d7f282d17a70cde310651e02a3ab29503d459724cc9a92af19aef5853aa8dac94d928c76b4a488c7eb46a51897493235d9c705f33b91492f0d98584e3fb3fc74884d94df601e34e1ee3b255d8112cad1d0a04a1366eacded24a3677f68b18"; + plainText = "ab1189031f41bc7f8fe8a5907f5d74f32ea68890323387920bee3403abddf5c92be6612855a94dbedfa84665dedbd1e4d87904a3441a722b09e73b74b1b14d6ec6a9ad2b082899f3fd438e9c3e62e612d8f12bfd64d2fda4d6a3e0bf1eaaa65658b083bb4dff04c51af978b95f877502e1158e9084bce59a875812cf104d9d9be383bbe5613e9bacf7049d31ed9df0e18d9d4aa3cfabc5f2e27d06d9968ce619c785bcd703363fe59e3f1c8ca291bce9439f23f05baeb1751b8e5c2cec26d21caf10579676b90c8f6a8e73d334cd945c2a0d81542bfef44dd22e4d94e0a3ad1d2c7ae94913030aa5de5fb5cb71862190a96c3e83e421b27a0e650500c548c5d48c3ebccee4f75270d24517ef0d2f41f8ee694fbd8bc9754cb236d46a867da4ca06967d915bda898905f7db9ba514e64e66fd31fe8b7da324055485d110209fa1770b692f8c5dceb531037434b293b64359082dcd316b6fd3a6c75b6b26205aa3dc355f0dea916fc485724f9fff90ba70d3767c21d0fdf63f705082f5fbdefe616d20f20061d546fe2f6577ada9264c5842ac16a6a609c3d197da90e6e779e93b0c717395d7c4e6029c4679411ea639aae749dbd97cfbace4333b39419f3f417b63343f247784e0387fcc62f27f79220e73c8bfd8d042ecfdb2e848f3b88082cd776eb8a17a653f967effb16b7af261742a03bc8a765a2f6e5e66ec53f8d5fbb6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 449; + dataLen = 4096; + combinedKey = "17d63e24d12b87bfde473d05ece0d94e702b758fd6c40acd1a7b106038c3aa0b"; + iv = "b61d43f205b4ac9897ebe3b59e3b7c61"; + cipherText = "c51b3db014a74662b0a8b48e15d99f541a9e876c1f84c333d2fa37e4988c66098752e9304c2c26a8b48e2cf7c16f89b3ba9eaf4017cb0298f548655a595bd6c37dc49dba236d2d4633402061e56d468895672d9799a53cd43bbdaae583f9d13d9ce7d7a7e4318c76b990c9e3c946ae4888bbe1cd833337976047163657a3e56bccaeaa0ed8613b9a9f962e73a01813c1b9982592ea3de9288bd3499739ba0b39da9e49f9df30fee9b039d14466a3cd8e015b2465894808ddd5782fd7311bcf8d2b32d782d329f71ea06bc73b944b372a1f60e1774dcd022db860ce86a5ba5fa5b0bfabf019c5b47428e8661ce8d0de1a14d55bd254cc320a6189a712c68b0a1042666a520d8690e5191500ca9ee915d47dfcc19d7bd03be549cf52120051220e567ae78ac7a47c5b170590bf1255f8f7f34e42597e19e7012a28778b1c328f0df21855fb9be71d4a3457864fbd344a5c7365e01aafd5277cd9e79b79967bb486250eebd2bcd4e2f01667b45fa01bd76b679f40f003dfbe4ccd9fae47e601671f71830a91a6e4eac996d6c31db2488064c8d6d56f7ee0fcb16cf541552e6b17c2760147c5713beabd9e832c7dc8bf4df0669950c0e2d987bbecc03592c76333debee6d96057898140e448528ade1945c59479bbe72bf00b41e702661c0f3a1f1fbb1c9b7d9b0529801d55e22b2ab28d84d4441c193989d878b063d811b60d808f"; + plainText = "04d1ef28d37a544a37e4588afbb9697a12474cefc17b4ca37981e7cf1411b6975184f4657adc4ed7c6178526ddfbc793240a67149093ed2604dc2cfeec64c155fd2f1da57f2ad85ff134711028abe42c6c9461880f5817eb8f58ffe304c9433e9041a4dfa6e06e9737c64a03ee88b6fe6175ea2f2af6ac0f06d735df503d3e600eaffff35236834e0913d68a8e12136796204dee12fd25fd85a276399ac5a3bec607d8a46d67e48fa84517cdfda5b35abe4c21f66f48f23c5f03f6a4e90cf799f5254a67bf49ad359023dd924b2efa75b502adcc7270916df1a66aaa14eec8d5b4f472d7b9f0ddcdbf8b266eb707603249d0637f7acdba65801e3e27def2686dd6d5825cb95f273571d3b8ebfa086d79a7a24d1189fb6b0e95a57367f32547b0642904bdd92eba0d719ffc7b72cb8150108b150685e96a5120245e054bc4918e7cdbd6f4964bd3c51214df4e6885d32c8fb15d85a48bf7c3567f2ee3c09bf2172a1db3b2acdc59db984512eae261de996a6893bc06a02e64682a06da182aee4af1e96fb515cfa3319fd0f3d0f18e0fc6a8525a921bfdcced2271a87b458d10c5d34c379ae8d5a39966387eec77fd6f9b72326f98e134d73788bd2f536dd65f486cd0bd3cf83cc21a249324ef858f4067d2940f5ae465a80fd82142635def7628fa8faa4b6f5cd78635b14cc494aa6cb351766e33b405117ae6e71ade70ebc4b5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 450; + dataLen = 4096; + combinedKey = "9d121a0540a7be3122340afcc86d849a6cabcafeec49b788a06eff15ffe39cab"; + iv = "6e0f1ff2e9d8e157b95c1e3e41409528"; + cipherText = "af2c8b1fc641e61374637cc19f3221d36b54c3145fcb4024c3c3b301b366603bbc19ad60d66769d02b55548eab194812082f864f8b318ade17dd9c9ee1c56c8fd8d05f7e8a5d77a445bcec94bd4ff3d0bc0fddae2847cd4c83d4424ff6e7f7a36420453a58535a0408039fffcb25d5487392a537d667881335ea309e17d674ca59d0d35be5def49a7456bbd90fee7a480570437fba6e7fd1c074a14e3cfeb8f47717f7800a6063586b94d0efe5d1e07d3799641523fbfd2a070e8b3083dd5aab6ed956b3b424afc2397335ddb03aebd8aa334969fa181f66bfb7a847372cbf15c7ccb24537ea94bde56dcfa3b85043a05268187be1657d44ac1fe01f7c61cf5882849cdb56a2f034a37fb4651ff25b963f5dab62f8fb4fef3afa2e8c058d3cd50fcd700691160b3c21e1601a44cc082266053a7961cbece06fb7f5ddaff012d69495f4fa59eca30ffe411d38f66908aa3ce005186fa2ee6e80e79598b60a6510932cd3afa6b9407444a638753ce09c65939c49121b500521fc577f9b83a47215afc33de72d6e62885085f57fed069ca20202ddbfc4c8f537d06707a7e0204eba4fa4fb0b3bf84243fd56eabcdfa37e0b5423e39a27c0c0da3002e46fd9b841ea58b892e2d627349fe9e8486e58c814b96f9ce27fa4d7830ed0220d0db5bb5e6071be56559f93db43892dd43532c4e5765d5cc23ce7ca624edb8fca0e0c458f30"; + plainText = "05f2a4085e5a2e7c88e104ecf1772d18d73566f68456e9a0c1c46a301928a1c98b1777ae9910fac1907ac59e341d94e2349601c2994b524e500390bba1ef77c5abd42f1ddb17357e54aa662001f81cafe4e27370a6e7d6f78154196a18623803fe843a39d8731d129310d799e6ec9070e0fd020975f50926f89ea0362a7eba6cdb6e6dd68888dbb36261f85b5d45467583c3bfcce502f50476a84be35b8390ef07fbc842074897564d1f97321aa57b4fdde79f008ac11661ee78424b0f630b05a2e97e45412118cd6b34da446eece3447ce29397dc3b1f384cf20e6859540252227c25f15dd6270d804aaf295874edc156e144af335667f7460124afffb9104e0600a4c4b51d10f0941d7e54954d5ae9698176523a8b48dca3e23d1ebc33c974d29c60550bcc945e03075827fece647391e4cd765998aa40fdfbe0b0629db245032ee6daf82ab239faaf96cc90d6905a74369a86b0a9cd38edc1b0cad7800db01ed75188356836f24f0cfbbefd6775f8eeb8f426019b72793396b112bd87f3a9ff41af7c2c5ce1daa6e0b59d2a77721e551b4ebccb76dc91ce3a47aa59065566275a02f330a68ef77d19ea0da08e33c9a45e9b8f39e5de07c97d70daffc9af98fd96d28e5b72d05fa51c26ba87cee9be197ed604a23591ac7bfec987d2df7a4180550b39678d1005a5756fcd7f691dae0dde9b0cd3ef40048d369540d5e8fda3"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 451; + dataLen = 4096; + combinedKey = "2bb19eff0c3906d1b0f00bcfab74fb650debbf86ce4a27ccb3d1c8daa6b77b27"; + iv = "4c499703961b1df64b7488a1d6937d9f"; + cipherText = "5a11907b989c774927b962f5a206f25f2f7dd0a26d3bfaabc967c6433fa9f3363acbfb4e4e353a2fa2ad880fa7b83e943856e6347c4ddbcd37341b7503f26b031677321d7a87f88f737d6769050938a1e407805dc28c449219408b0342232d01df77915e4d0d72c806d70375eec2a7cabfe1ab0821ebe099f2d7b589cae910718cbc90f877b4f1b624462ba2ff1f47b4fecb01fa2c87d5ad461e697b5b224f530a7489b3c9e6d7459c0068cbf741cf7d3c2ca0430dc59a0353857a4925285f29f035c46878fdfa1894ed470e9c51fb457313d2394830f084e1e694656a382e9119970f8f9fb3fc14b1b8174d761427b3e03527d541e1416747c39503468a1fa62b755f796634237a8a6d425f186f0513f5d72c22f53edd9c16009cae5c1cd853b68c4b155f410db703b212be1ea6956ccf944e9971c0080462763aae13c151addaf440193e81ddc3ad0747a261df8fc754d185801a0094303c1d473d0be607eee513f2675fa1356936bdfec1862df74c43368b8d6dc73875b3a2d244ca9e45d500e0b894a66ff005f2c998cf3ab2aa278dfd81bea1139073f5bc0ab1f77bcb9836cdb5264021f0b3b28db0d77cfa127e9b671de51731a23e8cf9c1c7a47f9f33bc2e7f1f5486a201a27fe94f31e4d501f4d0778556ef7c1e7bc8c5142911f1f4a0d96d7f2e911bef27cb3aefa24cf6e516a7f277238e1afd1adff9c731c20364"; + plainText = "0a961b3b5ef16b22e7a6f4d4c593bc5c5d2c6057f2afd03360d7fdc47a915545ecf6aa5a75c83151bbc98bb39c0a03b700d02f7bd8be9c79eda24d9550af02c4c66395fad80d120e50d00c68d91b0dfda8ab2cdc91785e67da5f49d22212d59c30ef369f6389912e36b93010285f413aad80b988f99c82ace9459c886db1cdf46dcf5be86fe35046c897654e0db980a67a6726341a16612956bb1c9959769e99256d502975770c7bc2c558f398b4bfe229dbc9d15dbbc2afbdd878e77783eadd934d0e9da710130c243eb9e78dddce5f543b25ba70178fba43c1697375c2b94753e0eee4aa4403217ffa31c733a8c4699b06723c04963be8390320254097953f2796446dd04b658bfe7427a3378812d286a6a69a2f1c958d4470fbd87bd74fb1823af0caca5ab7f81a0aa7e4cad2b6b76caeb8fc911e366aa68f128d613cd3ea2e937a6ea28e0e1e0fe47e1d37c6f0bd36014a5dcff61b4264dc9ae9a8ff8bb45cea57463bf2389dc4cb15dc889ed61bd3220356a4350ccfb2003cd41aaedd50ad9ea9dc17bbd855b46611b29583969f850c2f36266a3ab32b2b4878049dfd436fa6dd783e5a5987e9eafc2e3f916ecf35e76d5f8db5d697dce26a17f343e5b4b50426812e147c4b0d9c412ab60f68ed089fb1b0a0b0f2f336ed27ff226ae032265d99429dff7be894c78e1d9cfc44a2e219b821c14f0730b4c1028822753d9b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 452; + dataLen = 4096; + combinedKey = "925ae4794fc1d6f52fe02712e42d5417ca2767377455b017d58e697778cad6a3"; + iv = "0eb7393422a4eaea20403cb7ccbb9b01"; + cipherText = "125c05b7dcfa3cd531b9ba12328133a6c0be54a2cff18a78e19f9efce24cb2eaa13b3ee7cdbfcaccbd76635a05035eb39a8bbd20715916e076e642095d0426cc146ef1fa8dd98ce3a82bf9a6f4c982a8f861c6c06633f29faca17610c82de6ccde89e409c576fd0e2b7302d6a2f9c92405817bb7600b14d39d5bd1e86798dc1aae864c6faf19d8c791d617b77d337d118402ff454e5738e15ca12ebe4e29507dfaea54239e561c29ab3e089e08dccdb9e8ae42ba98333cff34e323fa33ff1c5574616f12803b86940be8db257e821e8682a6e6e1d0a51e47f0433e400e126e75ffbf319404ccf8b4b9516fdf854ec2113acfc5dce6f02b2c3c1268374762949f7f88ff93304429c6796117855e5bb49151cad9b682d99f5cb44a04ac1fefd689e1d65f69f14ae0426a3015550718b6574f4478305d4606a7a77ee76d340a879e31b2ab6d5dad1f40a0d0edd950cb866e56f4e44a223ed566a8f3dbb71ea07485e29dc73ad04eb09de07d234f9c8db00b44b44b33d05dfa79482aa4c7ef406129b6979f4373e193b2facaf5931761dd956f5d200c88784151c5e1d6b23aab06f58c2f93cd4defc533c031939a6f389983c78abfc83baf7f5fe5d4405a0d33f69ecc6e4a12b2d13058eadf7abc93afe4f9e0027dec528780d4537b3cc38bf3d390fee18f7ad96755b0c73373ddd07d718eda05d104fb499822f12d25e9c8c43265"; + plainText = "00426f585405082d9dab223693908ab049d26d552cbf8c400c85cc0fd1b3059a84fc1e983b2f9ce2b83d67f5708f7ece117bdf39c715fc8a507e355746eb6f772ab461b4202ae325d7f4fe3600c14f044222582fa224e3d443fb5b45132ce14d2ec997feab68035b55ad40204e1ba83202df3510283f3aad73a0e7640bcae6490d9eb6260fa8f933d3847c84301a9f828b50370089f7461c7d3b7a73e99b55765a4c5294a74e1e5b363f87c46bee32f6ca8566ecdc7d036af11470344543c5ef3508502a9df054efdb63f983b39a4659a20413fb22f21e91ceb854d53f0d0a8a02bb1c8e8bad1c82a04a0c451cb7fbbd0db53822e80f78e262eef48794a6aee8273d91e81784e84166d2aa814f8a39e9e03efa11177f3ffcdb24f64fb8f48c73734a990574377de9680833411a7e26a655e79a10b3ca35cb52c6c09eb238f14e35aac1c8c1d9eb1f8003e209190dc622f1f833f21c81e82f32c401f4fccaa57a132279b521a7ade240ff69fb6f208836d875d10a091d67cf84cd2f32c6fddf05ab9e46111ec8798eb8448f2f0cdece07e2650278ddb6f28991eff503c16bb2351eee1270f3e60b3be8af15eebe1e9dfded7bac27c6d9fc216e371d031edcc37cabdb328879c0502e3b50480e24061bcbaa0c9f6d7a70f26d1b98cfb0eb5239cdfb6f83b10969b3186d8be1580ccea02653b8062c055d07bf6b86fb012bbe4bfe"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 453; + dataLen = 4096; + combinedKey = "20ce63b73b552a4b8b9cddffb1ea564deda7dbc775607386e9e01c6408051cb5"; + iv = "6430893dddc6be9f3d7ed2ced0cf69fd"; + cipherText = "20c6cc17359695f1a256f980bcd36d96f9850801d74bd6d4c57158796f1b5527cf9483f089c91407b0745db3e1a327c4617494db59dc1c851ba738e02e62d683af108c0b5c911ec7cc1280ea7e5aa86dd5952420f4703e82f58b883391a022af284327de495205ee7e59f1d383a3a230cbb069c225f4be3af4befbfefd8c7c4a7d65326ae65990c5df3cfd5c8986b02fd11b4cb1fc2be780a1c51a6189f66f90033c3c96e6e60a3947d41a5a86f6acb00994715feec07dd96d8d19194e12cc9dc306956f7e693960f89f6286a30db4bc0292b4bafffc98fbfd8078bccf2c164eeed2849751233658da5a6a238460e526dab54dc56e885e3bc8dc212b97d359e92ce48fd89f9b8d998eb571a63c4040906fb23a254f8250ab43be260199e4d3cacd61043e0ab06e1931bf16b0c8e6a32a522c8d85c24a68d6158432e41f9afb4188c502d07ea32d1e32e3c7b2abf944848b2649071bc8079f3a3362a30c33c3cb286c99c98ad99af296f8c262f32ea03aa49cd227f4cf1f06d5ba28e4d9e878263b93703a1561729d6657bcba799546fb68acd7cb0475f6b03e0302b758cda9c2a78b4558b86f19556ee0b86c134a4594268be28a735f2380d61fa9844ba61503acb2a10a8877d1cb98cc72b918cd8111c88b6cfd4d88bba5cc241b9620eb263bafe0ecb1a53f8a5b4d82fce151b0ff01e791e608ec81142c3adeb5140af406f7"; + plainText = "67a2be4dd962817cca7b2a6159aa6f3dabdf64bfdd6fe881fc2a2c3576271aa401474e810609fc6f2e6295eede52cc7bdbf024128a3e9a75dc1f18c6750b1c2b04706386f835ea537d55672e4149a38902e09c9a952d4e1070f9161a7fef5e2c45ad3cbf89ff7dd99bd1684cd9a7dba2df686c5f2728fe38b32f1fbbd7ea008de255d21516422d446cf62ce5bb54663be16eccc4b142ea18435279e44064839cb33bb9f9cfdb8c127c03ff12724fa5d25a4fb9e08762db1dcaa7bc0b91aedfcdccce017637b8be718b0d0303b04b87241cbea9ba2dac0680213dbfd05f11c2f3b9a5fd27b02bc5cefcaa635bc4608d8a8210cdbcfd92b325409c6a35091b7de308633beff1e3108713876066763c1e44e6ac0ed6a85f7ca2c60227a4c35fef960803851a76dceab21d7e2080a39491440ea3e844cff19d7476a13349378d342e9b4efefdc32bbdcc9bfaf8c8b372fd9002d9c05990cda8c661d113ab2d8d4af1e40545f3dcb649d30294cb25181978e36fc0aaefa7ea6f273763748ae7c2c56884070b03c41e166c5321d645a14d1f981dde2cecf48774d647562527ba679ed8d1bf1757a35a2578f0f21c01b7a14020218d8f3c01278cf25777a08f01d0dec95c5416017887c6e70aa51ce0414f5f09875be58c9c591d7614d118bdca1b9b94c3f26da1ed0dff3189f08048287de4ea82b77e9514cbce2544b721e57c1d5fb8"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 454; + dataLen = 4096; + combinedKey = "be9a144bf21056c143fe4b7944dce24ea338290c58c28d702c55555e6e768ff5"; + iv = "b6c68ea7fe34a2a6cdd54d5bc3473560"; + cipherText = "66d692046334887ba81b43acd1ce387a83a35126542b77914ebe72d00fb21b479f650ba2d84198f81051b882d18a9f130f352cb8fd0c4578392c22aa048bd72f3bfec03e63a105fd44b35e9b43c731f4bfa066e6761bc2e4b1c30e46ea9373b6e4386b7d4c0a2b8d4e82c30349c04caa909e1380533875cf7f11989f1b8106b42d4fb869f846ad672255ed929677b6e6021943c060e4e2800a701f96928bcb91ee49d4f676b7e19d75f1948456ec76b7708b5384709d1a866816e862fd5dee3ea0d9960957172d4f8d5f751bcf240a8649671dc102ab386c2c1e843e565bdf611b2fc3cdf16f5039276e292a170554550f787aea12e9240872240f4465d6fcff4c2a0efb82d09d3c603a4dfd05c5a9de46937330d930722dc41dcf4710a1cb39417686bca11d9352d20dcdfd499f30c6e4f01c0d7c4d6b54121f9e9abeb8c9921d447609686290ad1669112a54e245eae344b7528909f96206d37b89c036faab3e2a5d8b5047a7f259f0c96bf2867c4b825060b7a0c3dc74de7be9442ebc0d98876c2d4600fe02d4064635c132464ac1b795eb7f5e5fd4faccc6e5c175c319fb65673c18a060505b2fc087318685621b36e2973ec94e712f5f2a8c6d8f2c8137caa1ed9b14adf5ca898ac617fc0d49a0faf5339ba57394f1fe3e968e4f7d68c4311a9451c4a9a38db0c2b66109d4e8ebb56f9a6e13e7a30a69479b104bf48d50"; + plainText = "cd6c4df8f39ace16db661e6ee65d5b47b477e2173f422e28be0bc1d63b792dd678277b665982e4901e5fe104b6d2193872df38999cb668c82d0342ef22bfdc242976fcf98090b596e9d79af4173f714ff5974e9afdc80aa30c4151f4bc9e30f73e35ac3e5c49f8fb07b6ec7ab637e7c0092050785644b13bdf418ed7d33cb4eca6fbbd9d561adfa40027bee1667694f153df1735932883967a70d2a713dfa482f781b0fb8f3bb9a09b6eb89f3a2ed9ae4a7285bb3cc842dcb976b576c4c2da69361124c56473591872cfead44bbf6e86c3455dcfd7cfe308fdf218e8911ca2c6d7ce0f19aa4f15f6851cee839630aedf66936ae0ed3b0a9f3bc280b131d031f1a2ad19c4f7d87d6d212d04b80625448722a9a06aefb40db910cdd046b0fbad1dae99a936ca62df2d33364e76ab5c29d26aaab4ba054d9e724c7ee2acf6226132b28bfb79109262b2858ee4bbc7da8cfae9bda4d36bd14b3fef9bb8f95dccbfdba342712709c0669f5fb2b43665fe60f2a1fce6fdc612751675ef8c23a3db195ee9f6882c2ae2f62c63a32d5b34cb73eec36bacc502a3e43493c12daf76c7037d08ad8b52a423687b0417be0cc1f07c6f1ba6390c52afcbd324acc48a33b4ae855a69be1aa76ef573acd8440f8d10b5450ba8f22765b122650bddedb02fea7f2ddfb497e99f2e6de5bc5d1a7c8a95ce807d321d41544fb2e6842322e98eb976e1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 455; + dataLen = 4096; + combinedKey = "395d2678044c419c9971536cd905433ce43e5bee07dd31b56a2af9e769eda5cc"; + iv = "deba734ec4d3a55af04fef6cd3bb70cb"; + cipherText = "0788791221379f24847679ac8d215ffaf1210947b68ee6864babdf70bfb89dd6c1995badd806584c60348e333c32ac981410ded7415fe305e0f6ae4a3021014dbd74073a6fb66d376cde8c254b1a11a3d6a3fd74e7ddd376e8f8b38d28120429cb4c9967f19700884e224aae7d46ce7ddbfedaac9391542d278e650cbc8688c17ffb2df17948c5b75cdde7cf68c47ec92d41108f8c0448ac75b622436f8d0bb06421e8c2cddf42d92fdd7a790989b950e54ae0967005a959a6bed9f0cce267a11ec2cfd305f4033c8cc39e4139bacb49eb241972f934b2228e745ace6661cf236d2770979296b59d830f4de9bd4f679084e2f5d6f1ebb683249aa9357e59e88ca517f500bd721e36ec57b0be3af130b7e5fef7fe0ed0446f84b07f86f570eb3c4bda6fee2eb233ea530c9aa540c2528664e6b592cf617fed854e412eb3b4204949f7e50c9643ef2920966f386462f52c79cb43ad3738849e2c87267ab1d980232c22d61ba6297e3e3deeb8b33e4997dd4f34909aa675e05e8e985f21da990683b0092feadb0956aa5b0e7bd7abbcb9e489248778b9b58dbd212ade44aef99b9d1f68adc8a3dd6bec2002bcf9dd697d0c6a17b2bda11788842c4b2f73297dd41bfc1b871cfc89f8d6fb87655962aa7c5532472ee51d27737b81ca55f9a52508930b99507d9ec6a000f5b812b6d68b1232f01dfe0c20341ac45b250b6b2dc6daad"; + plainText = "23ed5cb5eae86ccee8c3cb3fe8e997125abaa3f58bfe4f7172117425eb9c409842d139f002f5632e63ec91c746d7a2fefde9cb09ab98c53d280cb7cb7a8830326c50f32ea7d05a84cdccf16b2cce149fdb54adf4bca45a72c4df6df11aca96026708671a6eb8c3b89daadd659d71fb529da5a521e5c94484902040a4c9004249d89bbef7d5df0cb85884d2d418dae6d9daab738005ebac9888338c4938dd3a296f908cbb67207e75bd54b839037dd685c599ce2919e4c5d3c10c1e225df9ddbfbc9ab11f5bb866f5525c9c1ada3588f9ea595e66b14c86a98d31ca3a5a13d27244d3a741677da87f04edaa5ef2ef02e8244bcda673eaaba72d449f3b036767bdbaa328209f458561a7cc2dad1b1ac110bd9562016169c4bf1b07f0f9b8da297a9d03475e88c537401d891852aa4fc2b11489e9e0d5865224737697aa32bce2fd0666c4049a31c981d6067633f9dd943d3804eba83fc0ae21b242662eae5f744c0e4c93285107d0a25e11274c41991029c41740fc64e657bf2164c5d9caf8c7989eb748b19151bc044ee5fb310de650fbaa407f976a6400b752c9c1d685d9f3c964cfe141b4fb1b78f03c582e18f6000e373e7bdd9bc71434877686adf5ac6dbf4ec0e05476457276cb3bbc3c91e3ac8364c5baf47e01d78c1c09b26e02b20699b2b999a887cadf82f78d58c5d9a44b2b5863430915a81e21bea40fe51ba609c0"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 456; + dataLen = 4096; + combinedKey = "85d618079c5a0554766b59e47070fb449fa1967303101d705da875efd1af9f87"; + iv = "88402d1cd26e254bcf58331ddb96f56c"; + cipherText = "81f23a71e129d0098159289b514d37d409d9e5949a6afd6ebca48c66604e19242302f79eb8c5cb8f8cd9156fec04adb44baefff066e3b728532a27939db50aa4e08c418b92d21491303da33359deacbb8d06cb2ca8f3e4fa65d5cf3f350f9467b92be9e242bbe3a7c968a8e6ed1937909dd06eeeec71e0b5acdf3181a48fae254684c377915c46c5ff793e90c9d832b13641555d77c19b757a7e3cbeb3a81fe75ce83d4cde567dc0847b7554786b2c9e413cf3e8b143b7246bed44d764c755248c1a684eea85bc4c7c231d4b17f2594b2a83b117dfec0fa3254615ea8087745bafd3f69d731932fa2cd3fe9e2021d8aa7ccc3c530d226dda90084e24aabd7d37d35dca0a4907a37809f34226658dc511c2109c115a28406f077b4e0f0fccdcf4b0d68874d16828f2e06743eb55cf77810f0ddd91f1434e502f7e7c50da360b1caad58d8207c6e8bc391d03df411c7fca5cafd9a79309175d29d69d1c75dbf2b8dd2b689d88c2ad728a1fa50e19e0e59d62934d0405a7767896d371b184d424f07ae8419a7119c2d77b8875f08d9e0c26e3c4529ba0b4193c25e7cb2a1e6adf3cd7f242d128491667446fe61d2aed819ed89822be3ceb37f5d5833394088d9e700e490fc6edbbc03ccd0b9bf921ab994fb1154e238e21d67ae1dd4575de090f42704bd8765f26fa95a77058b75690c9a8284111e07856da19fc8d11917ff4a0a5"; + plainText = "a4378c00f3c183b9062c4afe4855764f6047479aebb59a4429c1b05944a3533b01e6c6f2a37065a4c67d23d9ea39a8fee0c566a29ae4b3efc68a66c730811c0de818b5a6d65535444298d19f5c6d936b800947d1c696c7d2691e07551cb0342b6139982e2bffa58fdcd01cf89f4be7fb0e6a7d4a0f08b6ae112bcfddeca9d955a3a802af7c5b5701971b96bda118a4ee5f6b07f13aba8e19f77df144fb29b17aed2052e9e484ade536f3770e4e26bb1602c905aa4ff7abc60cd78b5cc28738083e767b336ff87ab7312bee9e543d972d2cce1b592acfdc073f50f231eed8aeb6977eb6cda20af9c34819220e00b3d5421c09619245bbff74bb15a2e95cb69e09912acbbc28ec858a92b96fa0d30fd145137186a5cf1d4b0cbabb6225a33ef71a69219ac45febc093a02417b99b2ad14e5fda6e28212a6567571e3559a8a9a0d07fc3621fe64ab28874497832c3793be57a965f840597679e4d3ec1261fa891bb2684b20a139ca9502bd9a3ea7a751d716a88948ea963d81b0818476318538d4b40c61815044e8eb0b55afa1218994e51035b1ce9435cc208a0e332229f79e5673a487d7e913cabce8cf2e3c59e36efc11e15cc097766b9567a1cf882ddb1afd61d17e6082b60d56c70a8b9800d889d62da256d93f679b1511396f7714b0dd8124a53caf2947e2df041a584b68bb199f4e17622f04571c2d1b832b612a51a80b2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 457; + dataLen = 4096; + combinedKey = "69aba8028a195f1219a3b961f05c33dc411eb99dc458e86cebb5c8d6af3b6664"; + iv = "dbd7392f87ede5b21a337df2f511dd9b"; + cipherText = "14528e9f22dc97a9231d7c75eb2cf029999930b229c8fd6f860e6c6ad217a319983061b2c06038fda32dc6fab7419ce3ec06837fe79313709d74e1d0dd5fe91dfff7c7514cb2995ad0a2b1ed45016b76566d8459fed1e12d8f2425c6646de42e29785017fc4c8fa470786d6ee6eb1accc3464545a182e45761a560613954cfa29fc0bf4b5a4490e9dc45a8ba3b23fd350f6931c40a0e453bdcc48a8af98cc7b691aaa4f614328c34bc0313b8e6d3d181c80cd909baf42c406c8232a556c2d0289d7eb907223dbbebb221007952c0906a44f8d76d3789308821db3df3a32a149e6e275be9e479110d5b2dcdf2a0b965e9c943c534d19c2e46b4da5fd531cbc0b36fc89e5275e5ca7ef45465fe5ce2b67b278f01d505fc7fab1660dd044f6886a0eb787a807d1957e1ca577f7ee760bafdc67e5d03595e6a8f099da45eac45135de6fa60734f41c44f22876654477e5592e0a5607388d8bfd544b42d391e719aed0526434e812ae458e0f2bd15ff85b2b3cbbc486d12bde0a13e440d96abbca42ed179e2b544d0cef8ddfce60585fd71c67136f0fc4c56bcdc79a507ba686c09b2011642340db294e75ad6565f4cd204487452c3fa23dbd73c72708b0e84f9c42fd992e3e63a953c28a6f439217d92dde27310042a14d3759087e6e07e11be038d2caabd042e07b01131897d90b15c3a7093426ada26ad90badacb17f76a5f8c33"; + plainText = "c93f4cc620ad48b06f637df4e1121246b86bee2aad63be533b7b3bb63c8f0bbaa61a5bdc9997bd7612310aac06e1517e2e6378d34062461300676ff300f463a0c7d2bb44bae3bd35fc70151e2cae23c3aebebda2cb69d43c73d531ebd50c118cbee536959b55a0bce94d000aa730aaea22f03f8507aeb29861f81796fe9e8800862d522e776a5ddf572e1253acf60f5fad98cde9edde77271df97cb89ce8fb4e517281af7767d7f9b4927755d7ed5fd705ac163b8f4e4c31792f986b45b75d3abd34fdbb20dee02ac47de7fff36bd83bfa557fa6006692f40040f0f96a8f487fc12b6809ca7c3e782bd072c24608e16790701eed02d401c6535d1da7dd2dcc1f0760ac5c895bbf70fed15850855b8c13517688d00b10f97aacd6d1d4e52dcf69a6b073c7a3ef4646097435a2153669449e1def8595e15add4aa37a838027c9a969c314b501d47faf83583f6066d16450727965b530a8a8c6ef1da7fbf398852f880810ab56063cd7aa7396971c0d0ba56fd081dc3e5524906226036b28639d943c328fdbca68b1639f66b2933b06896d9bd0d2e66f7fe42f8724383b63f2cfefa210c5c91a6f86b1cae7d7f8349f8b567846b19c118690c789d64e53a3665042206b20f2557bda9964a59a4cb659501c86da7d159251f970a4527c70091cb8ec33867681e86b665b12a52e02b8a5b4105256c30901e51e0572ba6e2e6e9c20a7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 458; + dataLen = 4096; + combinedKey = "40dcc8b399fe21e0a8737050130ab048b9d24255baab4e90b47faf2e7736f0a6"; + iv = "e184fcd5247bfbf6fb285c982505bae4"; + cipherText = "aa7b870e99440364cc0956d05b26194a9e869fb76524a831faf6268044de0e939ecb032e15ac7b3d795e5bc9b10434b230634ac101fdc78c45c1f79f0f0f6469a97a71e58f712778058d706f6cd1b5720b87c6c1d3cc8ed5e68b99c1b1b0276bad61af11ab2b72a4fc3a5642ad40b3e44459be8e36987a8927ddbb9b41438e8f62a0e7754dc6b503753bcda53a3e0a62dbad39067d6c66d30ab0c4f99bef1979509d302cd8f3f244a43113929a1e23625f8ef46f6a5925c044ff684afb681dbe0624733a3238b8c6439f011860992dd2205e991db2c073d076323031a00e71adb9f2ada3448aaf7480632a68a7155da73c0c271b61bfa8ab8914793c7c0521e48c5910e1bb2945dd04844d700b4bdbcf1ce2d017984914063f700911cff80be4388df0375f049cd0c973d1613d490504435ea0541ddc17b18f01ff2b3c71c18018fdb92248f4446e5179a785a1d0ed802bfb7bbd160cbdcda8c6604e4de4304dcbd21c4e35e96316c5ec635d7c3056e587b86f97cf6575470004f5304fca79a3b11eda9727d4f3fc11f6ad79ac983bdc23de9fd1a7ab22632c044c85a05e7d48558d24bb1250023e1fe772628e694c7a7befbbae6fb656dcfc2919e9d7dd4db415b2dc8132a41bd321815918108f277137b86b6143816a929e70a57d3138c51228dfb1a7274363441a7dafc70a1222f8e34222774abc91e430c434f47742795a"; + plainText = "396667f6983180f33f89391cd8aa0ad21379c049ef2857a98ede609aac5fea2a1cca15e9bb8af5843767357a3c8083ff8b66a234df8798b66934d8a7e296b1ba84c339030424f9b2d4c665c332d9b9297f930c7ffe71bca4e9bb97976d787cfbdb07f2e3840435b1bc8a2930a906ad6801f2d5ec6c7edbd80f5e1dc75f8bf8eaaf1978431143bd23659bc01ae964182bf7f99a67d9a0d6d87b357de8566d9f61949b0c635c13567f66dd4f808188dd16b85390ceb30dd9f8c4bcfb60d6bbb25b68b28f399fcec8364646b112241a19d2f3cc28974bfc9335dc1e701f645191c35db9eea4b9f442134309b5041ffdfb2a1b590dccd636fdc3a230005aba67369fb2150dbc2e55f05ce0abebac398826e884d941dbc9fd742a4691bce97517e19c45df250ea56da650fc5041d90137ece42111453556cb22361dcb242771256f9bdfeb7e1c5dbe4e7c7464a1fb0d1be1973b302c2dce1ea609bad420bcf13a3a21d8714442b299af59058a8c0c0501176ce5e686f1c841ad24637a28bf47f3e92c962eec398ca9ad00ddefe2995da92b5b96ee0c2c5f7e14fe6d87b18a63cafad3b6c3d2ec8c0bcab071d6d1e994148dc1de5d38e0edc72797fb1b0a45efbcb968d4c55f190587dc7d015d5ccd3083f0b12b03bbd4961833fee4fb9ad4e362db174bb6673bc7409dcdca82de66fb2a7fb34a1f94ab934250c14dc53f7b1f9d88a4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 459; + dataLen = 4096; + combinedKey = "3996e01aa945f478abfc95f64d87abf03c50e565dc6c87420655e647e559879f"; + iv = "7ed162be1294eabfcbe6363aa0e0d1ea"; + cipherText = "9705644d91b8a05a1fa4e44c71d1a84a94a658cf7838bf970cc5f4d3c66a77742d1100e0b9d425716e32cac0ec389bdd9cc68c6d6fc196525467c8555b69a9c6f0b34b4dfb4efc9ebe4a98499dabe63443507220077eee2255ce94edcf48b8bd03deb83b96af7cd20793f82214646208eb14dc2dcfbde68264f1317bc0d70205ea482e16a7d03b9283d4baae8b0a066b159deb2c1ca2952e500ce86b69118ca315311abba4c299804456a5d7152c92b04a252d7d46cedf6331677aaec5ef3d799832676a4e690208b1d14d4d282b612820c386589d25cd7e16f680ac5368af9bdc658a464ef96524e8007361a8ddc141844eac8d44fdc3a1db2cf5b18bb0d39c22823e3d4713675dfc119123ca0084a0e078d93084268e58a058e92cd99938f6ae38083d4285630a1a06c79eb1c1d0d9dce8babb272f72277f099b1cf630ee800dc95a00cf7ca469fd6c1e9b650a7dbe2c1881b8c0f655034f6d3c42c5b0aba7e1c50c7c83fc99018b1ef4c10a237422c946b4ad30c465afba2d5cabfb57664d0ec451bef89c13cbe5e32c3595fc136e9e381627e92fd6ffbfae1140855331cde3050368b14e42ce4f1bc4c5da72b2c1529fa4af3bb20d3308f4ce8683285565bed0ec7ab4e4ebc6f9d5d2ef160daf1babd5bfb8a33c36041228c05c2cd5dc590ee0a3181b411a3e7731b3f7f5554993199d16b8f9187fc70365aa089e746fcc"; + plainText = "26ba29e4b38476ddd5664161d3b0f8cc6e7414e9e29cab05cb1f32c59bf2256f76443253bbdc6fab5cc6219710971f7927e68b0ec29b240aa1ae68c5fad9399877c6728c9a9bb6b226dc74abd45fedf23692b1fb2114d44f1cd3faa7a60897cc548b4ad31f9c299930b5db9891edb8e1d966a9d11b11ed06f8347f020324c81745246160ac9bf68be36d1af2fd99ea5b89d16230ce7f7426de6e9b1efc12fff9a7188ec5af8fda7a4fe2fe582c9b6c4c3bbe4a40c5dfd822ee973bd0e456c1a3f642d097c1bbbfffd6260b6e1621cb02da7ffb4bde0180147077aadab232722b8f6e0b3950760c435baf95668cc3a64c170545229be15cce8cbbaf339abb42ca411f5990d1f56fc3f6c06799d5b7ff7522e68c586eb79ed7737059564a78a0ab449ff954c594b0b1396de13642c8c54c122e2efbd54a6806368cce67e78cc3bf6a7462ba0f37cab36ed292337a41988b9623e8cd1bbed5a74f78171c42a40def6bc8a3e4d4e754c00b056fe0221435798445ed3db2c8aaaf838cbd8a6975d0ae6b37b54a3ddb90ba45a0671f8fb4af81217be644c0a4d210b588781bbb550ee6cf28b40844afc58644d936ceb54bdd03be830400c4832e2613906a842ddf895156249605b49396c1dde39ca02898562cde69af653b2203834612714d61346960d6aebff220bb3d8578a69ef8712cfa1446eed63cd106ce244e1db1044e998a99"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 460; + dataLen = 4096; + combinedKey = "93610b15a88dbfd1abd7a8cc1355c1816850a3f786f7226db891e277bae6a228"; + iv = "d0a779ac785feb3a35626f19e158db76"; + cipherText = "1569e189cf201f26e8213704205c7765d1fcbdaf646a780c821d33e05fbb00b6ea8145a914c07f6b0831973a32602102fc392e928dda226165f1481f8cc49e28f7769fd0ffd8e611764496612d7f968c102c9d65d72b16b152238717efcdc26e44142587880626362842080539ee49d94ba531a7353a8e36b876555ad2ff232a73b0b6d082e4b6310e8c4ba61e5630e8b403068e3004fff2c199193f48f89b8534ca35fcec4ec6378082f2d40e04d2d3bba0253ef50fe5de7f611c49a21e0439a5c5960431991b26c1ac629ba619c5797799553a1a534ad8e89fd71914841768bf3a5b4dc78cab4db4dc724b154ac085fdc82a19bde1f4e5e83dd45519b701f4971a8e209641022fd58b15d35392dc0ec8b77a8c7f0321b22c18f0deca7b2a247143c2e8c70f05695f7494b626abf7b8950d33d37387c182774abca58f2324801acba84c23a0fa798e98815a5a306c8e9c93b6798081dbe2effcd48db4c3a58efc538e0a5b335de207f5b461c3edf8a0a8a7994b0e8e5e4d25b4ee3f31f14858fb5728cc3c5bf9bab7ab4e3c1ca3eec9dc70d2a6a8411031f92dc1d3e88c4fd49ae1e6889d5defa3f03c5865ad910b5d1455300a7502bb2ba623a06eefd1747d55ed466a7d519a07d7c32093ee46db3573a1c4df8aaf526eab178e411da7acb3c1305541044809d1b995d07d1d930e7052ec14e7989cf49c4dc183a5eec18eef"; + plainText = "34d4aff2be8dc87451aa7ca6a544e45efa9c78963cb0ed907d07c6ccc398b0e00f2c738af0f0abde808d1bf32849e89bd083b21892ef91d292bc32bf1ca7ac47cdb5d808ec332734d783d7c39e6d859f0e9ea72cfe03accd9dbf9e90ed9bdc17604f0594bb2ab2783e89cb348c138f49a4670285333f10230b5c8f208c2766da85c17b9f41d4eee238e9671d0dfaef57dbb37d24e64dc3e545f959054e04a8e9ef64e9d00b94856f881649f52dd060219a0f017a39a680a9052f347a858865756a5a76af5578c7d29bc781d16551f89c2fed6bdc8afe2b4daa89d23f0dd18072445e577d1f9bc6f943758d70534114d8abbc99c3bb8333667a340e2cf71527759e461466b96b87a86f905388779f097f025172f270c15a35133be8223d08af4f5b095507513c302e3b6a2d6cab9e603de19e6897098e1737ab4f4a2d6ea8de5cc4a28c1059a183fa4753aad7ad25039118e42cea45457d258fbb5ef53f093532443b1de4fc67c40f805a547e5daf41e040a4ba5b11af52fbed95196d1e8f1411fa40a2eaa14e5cb60eed54492af9eb21af9544fbfc4d4e1b8a54a54c4d9279b511911b364372a2b40e9b4cf4de8d27f3e42495ce35d203a17cb3d4bb7c4fa7d85826629d36e301d9daee445a2d52b734588928f36a4b5afa6731b1f21956735e26f444fe1ecdaaf40da2d1d16111113f8192d633956ac750aa8bd8d7bf4acb56"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 461; + dataLen = 4096; + combinedKey = "4621ef4da668b0000d863ad7974dfc6a06750fc6b18c57ee7b8109d78658034d"; + iv = "e40b22231b673cc685589188e225586a"; + cipherText = "c80ca764a221951bcf5da619161061401489b9758636eb37f4b10b7a3f139176955068988b739c5ddee22ba9e20f94ecad3958d6417019aca865a40b8b5f5fa3f04786bc1146738a02b9bf40761f49208aeafb04d0db82d607f5bd606f9cd73702a0f1b1c03e4021626a9cc0a1ebce01f6ee02d03b41156ea57c8b15e56bfcd89d8a1b23c0b059a3b288b28919732f2c111926c53c3e08d59257b8bd79c420fccaa5377e9ab3b7a2480d75ceb6fea3196ba2856003797366e5386b2d06a1814ad816d8be40e59572763c877e9bc6ae727a6d2b680d6be9f8ace190ad50d69233ef6b5caac6d8013f700ffd331f715ef64e418d3df91c65d5e86e1278eed12dad9c19d7b65899ebbb5e7dbc1430b5d16fa04e99f29a826b1d78146295e5e4fd52cc54795e42891fab6f912876344ddfa4a66c0636ca59e81bd97d61a0535cf0340811e3358ef3b5b83fa5307fb025b3894304e9ca33714d1f06c16e454d0311dfd789b82977494b399fa55736e8f8e7d5c6ad6e8a02ec49f80f0a2c2b16e63a94cb1086e2be0b5fe780be0c87a3ac87f2c91bf25723e01d221256af075bb1afed593a81963287024ace0ca8b7cfa6dd8bcb2e98a62d3999d1d27a1c7cdbae7a221115d14bae625d83fe5b0016cb5128e4e8cde0cedc1a1c786d435e3eb39d2647c252d3723055f662d494414bc0c1a932d074836cf81873edb83253b6d74837cc"; + plainText = "7769fbdf43df9a638dceb79d10c6d74259f289bf5d43103954d9205dd5b1869f8119a6ed39945e25fe9199f78b00dadbccad335ff228d18970bbbd83e36b07e19a180e9e6f20a2c93cf504c6cd91609f27301e63fb93a516f33b714fd7ac2ea9dbd4420e3bced280e8160fd8f5164d7b3583d80f6711bae83ffa50126522d99e6961a3cf2aecbfcf728fadc46d28740bb0cb1f1f347dc1c8a5a7f476e732ce8ba49a4033e93daea719c60d3f4ee58ea10ddbd1b18b20903844b0dc7cc86feaf1b437fd9d924f6dfa283651f30ffff480977d04b5ab45ffde20280f1bd0fab6f20f0afcc7822636618a9b8e7e0ba11ecd45236e4fa8e385afd8be947c99d73b4c827889806c04f27e20a168c2ed9a20ef22a21c37edcb2f5a8e8e0f6487582fb90ff8b894ce0fa3b2003b520a3378bf37c0cdc1ee51403fa6052a7992f48f7887085b854b9b0a5b1c30fef43552b48ffaa178cad977917f114bb300ef7d7e17d81cf0792c554644af035bd6180472cda17ed0b87b19e8e0487bbaf8315ce9b57b34fd1ab21103dc8b71db9af6e90e113fb304344a99a528fb123e26f709a80c9b03606c84b4dff7e755ab687beb60daab13dca485dd7d0d7c70425452d169468d293958d2ab2eda6143a9cd66a3f5ef58f91b7624421f4c2a655c7f3002c164c5e1bff974a1f9cc1490a66c0fcb5ac68ee9475444549286b3f605c574a1de743a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 462; + dataLen = 4096; + combinedKey = "8e51022b0f43a38a4412101015f36f656dfe24a465f496e45258250abf57bbb2"; + iv = "7563b78ef16f73b8c89c6f530d58e57b"; + cipherText = "ed9438a2bcbafab012dd7ada434c8b9088443647d7e95a27fd8286fcc103dad1d67382fb8de19d739c43285b5cbc3b87c0bdfda2253ef81aa951f69e2708d06b875322d3ab45d1fcfd27c87e16bf8294c21224efb9032c8daf9a8a4401f2c60467d69db6311a50306a6dffb23dfecd2a93722f2d4eabab34db7fbe660474a59600caa9420d1b46efc14ed23743ea51e7ed22c71b4a610a0f2a60b5094cebc26062ffba28e46016ea8f9257ec2465e0f2c9efbcf3fab3a830ab2a47300db4fc5d780e8cd1529f880f43c2ec3243b9d14c4942e901460e2dfec4fd8688ba96b2779b7c532cea9245ac6cc382ba1d4d6afdb8919f763c13e9e99c6c77dce14973b96383377cc6009e130f975bfe7b8709cd51ab1a49f97e83ff2ea96f757c43c5d9c1d5c963b3ecfcb70686950c6696d85b6f63d6b0def536b9eab922a4ffd335c06bf0971d26dee99e09c1b5cb168e05991da6d2d64a6304d1a65957d4f8aea348f6b7e59476061ab086ff86c6c5525f75f3ae95182db5232a1c61e0355dea750a7597a0dbdd0b4c0944be639eee8f3ae76d1e2beb63b899eaa7bef7fc5f86d16f4085632d4f1770015853922ff75148e824283d74bbbb1ff43b377936d1cec7dcf20fee34bd20c61f099295eff8d66542039988ab958db31f7036302466b97e4fa8fadd5c29aad30051735afb5def09ebd0a3f2c0bbb9da664819bc7e2f97403e"; + plainText = "0518b1a9594eadd0dbcb290b448bbe7760c6b9077cf1f824897ebfaa5f5cfe3e5bf7d10ba8b85f642c4fa2f3c8944a1b9d2e2bc7aa0401cbc16aa84612e5608bee6c434e537abd8283d4f3de04421dd07c0ef5e910a267038c571fb0a8d52b679d67754730e254aab1d8286fac0700172d3fa50b121a05abaf05ebb98e042bab4f7c2faf5f202437bff34bf4cf1b23ae72a23d164f28425aab2247f80210d75fed84213329838d601d047ae02f325cc743b246ef38ca2b8211f87dd8991cb44f589fcdae6c72a8e13c76358c1c31c09252c02ab81eb8be86d6911b714945795173af55f5ae7ce9199e99145e625fdfdb42bc73d8c67cc7a616d0fc8948200cc6509e4d500fc7aa75625a62f7b94c24d9663cde18fdb65ee6bdf31551e8d4271daf806ebe7d5338fea68a9dfe8821d1812678b029c376c9053bb53619f7c0d9901c7d5cbc7e96d733b9d11a892a6330b68795dc769de37a1a25399964ab0667231c61f3b91c5125909d8a3988ecfed17d9a2445ff7feec2d84da620382d73d713edf4421fa7ad5b5568ab1b242d7eec3f701f1c6e79888304b4f91fc612e1912d191118c3631d4b4e5668b0d54de30f890a4baa36147b37fe726c5c2e189eb33c26a27fa620ade19db8e7fd53aba382cd57ff6ad1681aab1295cf4ea5fc9d30223f3b130d687cbbe9fcd9fb2cecddd14e311a3244db7b0b51055d4c4d26eedf26"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 463; + dataLen = 4096; + combinedKey = "d3cc33816b25f4c16290bb6d7732b0f10a772e21aa52f3fbf98dcda4c79a80a9"; + iv = "26530bb2acf82d4abd726e07695839d6"; + cipherText = "4f283c05388226766b5abae0d41003131112774fa458b64e058fb548de5f0db9b6dd6f0e3f895887f6bfffe38439e11f94af25f1ef59c83f7fbc8ad29f19a450a52561eab60bce3d334490e87e662c17984526ca5a7ddd86deb9006d19fd2052cc66fbcc0ee3860ab5d6c2021026c9c7e7b5b0f572f0196d8b82ae30ae95a07eb63eed9ae11ccb7b8f4b40876f5decc618e2ce0057992812d3e4328d13b9e3e40ebf37f1ae64010bfdc028d69a1edb3927bd83da53b1a3f7b7717edd83b8bff3c7d7152733ebea892dc5d9dfa93686ec6a85f4110baa4821026893fc185040da5e39b3ee8e5a311b7510cde002713796b2ec50566958276f01da14cd4c82f72aea71172660c2debdd25767f23404e310861e93dd8b573f2f82be7676d31d498aca00516b353be2547f0947f09f499372ceff314bba5b90188997c404289c296bec9214a216e885886a9008d0c73aafdfbabf26afc6977b11fb3e2368ca3090b28d65c69fb42ea8a75d30322d5b9553bd3ece288e7179b9c4586d436fa45e24c1ac33543d28ddc387ed1625360a69a41820c085c37a6c6c579a04d171b81deaaaa1359fd16e5e80c8d2d557ccaf99e9d7c703b126323b81f7aba9110bec0ee2c65a67a0a5f3a24eee9396c40849a0b241456f72b114509570ae1865e4635ec557ba6449b9a1d2e02789dff36e59ecdf2e390ee8711b2a022a71b7fb3160268ee0"; + plainText = "ffd222eed6da99c36333d7ea3807fa7946d998f9f765a2ad1450619072a50d8f4762cd0750f9ff9e5463999a70c04d97a3b42a6cf050a941c985dc10e2eb150e319404ca334ade7e12df60cf20d9e0ce473d18d6af80f8c55b87781bd0ed5026ce936bc299f7b9ede0d7b113bd53a1dc3e533a40b1e8b5f0ed4869c154e0f13d039399d3cda683e440c906839e043fe2597acffdcbdac9cbd000618ceb06dfad80c205d6b7558c94b07de687f54e7910f4b32cf9ebd9f0e06533d343929bc85f5519244b8bb3f42248a5f57e4c4c1e08df8f1e99a011963266c3aff14fed44907fdb95aaa02419f896e8852626b6be935af6850027c78cfa44144c4e972a314182a253f490a9ac0eababd69309c546b079625e8685f9e9b0047a24f863a2f698652b88bd508b13b24a9b4f8896a9ecd46573d6a55b28bf3ef0f03469637e7ebfb47c03e795f3d6e05f3491276c37f2fdd896b80e585b9c97a474b485bdba60378149846410443a957a737bba811fe66db45dd8730d2a5a7c9e00f3bbb9d4412e9ac5ed39ccfaad071826537cd85c0e04b8ecf2ce30d1c3884894f4c4e28700da2ffe5dfb378b7c0449731bd177b273022da0f0012314d13044c066ef6f2988fd2a6b224b2df0144424f8dbb2f637e59aaa2a0cb8e4d2d7f9b7e2456ba5b1e4eb08f3eb991f2bc0295841dd0a9a5a548e554f42293865bc86c9a8967daeadc1f5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 464; + dataLen = 4096; + combinedKey = "9073c760011e2253790d9a2857d59622ea1b6df45f59ff51758232c2855bc059"; + iv = "63585913a74c3f00ad5486af44e8c37b"; + cipherText = "33a99370572577f535193a8ce63a868232806d95df84cad4501b8cbe00e2413335d72208106a780a0e7cafa204b59a284ddbe667eb95f7f62ab458fc65f8e00c05646f48945d7db8bb5fa7404c0aad94ae408268d6d59163f883476edc7d80b864046084680e1906126789b0b8c5835846745f2bf650c56ef9d5cc949e118d8c9fd531cac5f5e1ef9602d4588f0ed170af394996379738b5f87c97f8fcd79d9e49253a423737c1754e12758bd9ca9c1a774c5f823411b42065d433ce7b85987e04e80c0f149102f49cc2b80c8b2ef407af08c7e9f5ce67deef4259fc20a5a4bde284f76b1908ca9ce2cf56e48861fcde1b47706ef02af016ba3f958f2c3730321a9d53bd5d20013a514c884139facb18bfb987fe2749c7480368c03a8a921fdb5f07f0f8efc5ea27d5c6853ee545f84de1183ca8b49da6cbc5a25215b0d99db352d556b670c4230626a0cfd06c36b7606ad9cbc4fbc61114f1160ad1dab612157132784e62bda224167f59f7f000213623cd80f6d594983383563d80730275f425f2e921505f0438fe3e5e4670d8b4d5c81f097fa024029d7a2f7090123432420f503b7fa9091063890b5cff176bffa9fb39eab2a0ec7e721d5cca69e1b8744e2603777a966cf7ab03ae22e7a112afd34ea99d4468904d0f28466b3febf411f84ebb96e68940a6fa6b482999184032bb245d95b0a4baa84338646e8fafda30da"; + plainText = "3bc0160036336ec81982e9bb213441f1a7418d1d68fd36c5cf2ad43ecc491610909c7dc8f9fecf3c624ce68c08c422e57e85347800ce831c8f8b4fe07c2b3cdf5e628a380e440af516d7898c010075c70124cdaf1697fae0c06ff1cb0c34de0dd06183046d1a1b1767e129dc8502df8d48fe17c3a6f8604f3e18312e22deb195846709aa2e8d44c7a6de097d050512c00340e72bd13160c97b350019267090dd6016ce10b86ec548d0db936ba553208f28981577f5c429e48f4e57f4147d6c9b48e2f4455bd340f129277a7c566e94fdbaf42a180567d69fdb47ba65d8ee8f86195a775a62570ccc9abac762aef51c7520421fa40e7597454eaeb0a26506aa7ce5f9a939434fece777d9708e3a952ceca251b9d729e5c6b94daee16b673e1f737f7c72b8e2b2effc0be0a85ffa5490f75300b0702220c0dc9047a5d4f7cdc6fac0241470e0e350dac26ef03d22ff6b594c1e3077a86b232d17437515dcb255cf69b8f7508971a6b057409d324a516f0ae5b0c3a4fe57c0311a167bbc56ce486402b93135a8cd2c0c4bbdea2855447679967a680f8a40223fc0333332fd2f212dda05bed0a2c059a12b18b867ce35e4965dab2009b8c52e4bcac5f2ff676e7c8dda8316847fa3c82767778f68ca11c9ae3baf3656e53228e5e8147e65aab99a50c4f19d7da24ab628ad4754f3a43879cf024ab4531b0284c579d797fd70553010"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 465; + dataLen = 4096; + combinedKey = "e2703781032ccf1fd5b183b4c6ff1f27f36f2849a704cd4f2353ff6cc63bd747"; + iv = "94f6d548b3657d9a356d5c58ff24ef13"; + cipherText = "f25c2a1a3a1fedad9e3c5bb107e6525a6bd75b3562dd4e26daa32d7cb10379776ac5013729d67b101e95fbf9af234ed2ea0ae29c0e0c213ddd3172cb79d4dc62efb8bcc2efe71e1b28abaa7925baa9d8f73a9c36da5266ea72f4fdf3ad0ee19e455ce558d251e535c6da1925e36b2b471aec0e323d49e326c29937de66cddb3f846332d32744efaddbd21ff9994a60f4e16f6a6121b4b2907d40ae4c6c28adadf89ca21da34c9953359ed575ae4ad49ef9f151d00430ff4eb4afecdf884d7b5caaf6dab3950f53ed205b78538bdb261f649d7dec609c22ffb6924ce28631d8961ae70e24f486c5899c8d6c72e248ce6b4f3e30a46462a924f4cd5ddbc769d127e551a077e1a87d63055903ef25f4cc0ce367de8b8aad5b8360e27ecbe09bdfe26dd301363cda94edbb7208f216ff496b5096df306d9ca46ea00e19fd542dab10b5ddd564b8e9d3d6370bc7b416e5e20ac4048872ec66b9ec07b2c8d5845fef1b01c5d5082786000762b0e9124831a329983690cb2edd72011e9694526956f8b3ae74e0e01c9fb5fbe06fc638f3f7489fa4b7d377fcc5fb83b5c29e65f3d6092fbae33ceb974fdd6de0556612c59374ded6e71aa3597d66c6257461db2600d0cf96bbc85f9bc4dae60247d1c3fe976e23089d8ea1977edc04430fa32087de830f71579f87eb358701c530ad13f6825e2e9430a2213ec2a338529f56eeedfbe43f"; + plainText = "dedea2562c903def6d013810770184b235864cabfee80a3adaed1430ede25b018260b676efb66ac0d3b191301c381ba9068a89d34c20804da58098208df9670977242219acc9ec83cd43cea884388a01744592508e5aa2004144c7346cd55ae06c7862a168e3d63a2549a82f38ee221d5465d52753918681d9be409dde6edc8323c9a972e731e0343fca1047d08bb9510f9bb49cae26291b7573f34721a6300957b66ab72ffe58cdbe2b7f8e90bdd49ab3e05dac4386474ba1ea82552e2fcb5f2df8cde4b4ef8390f07285f84772bd7ef5709aac5f0f978c727816ca2ebb4142da8b04b2214703ff444c13b526c8dbfbeca4e679effa1cc28673a69df8f92820d52aefaf33fce5cc6fadf8884d1208888b283276ba5fa546e92083f74583f55028dd0c07d29c8b9c87bf362ad5b02b6831e9e3e7824be1f6941e27c6e0ab06789545ded2b5527b5e911ccb502e5573fff4e8afb42c2c67fa033ab9f52f2f38622e488e3a7778d1e256435dfd29426135ec4ff5341fa2d0b415255f1e43784cdfe5975a8d69aa1a1210d0537a4a6e24e22d2dcf7a4f3ecc146c8c9f35de8473ed5b50803d9c3745571ce0bb5a290dfb00df824761b6c43dc9b4fc33f0cd6b0782ddee1b7a12d05ea5a0508a97c140a4c5a78e0bcd78e8aa2fa332343e8aa14f857184355f15008ce8d6760721eed4a3abad295c755c46ae90b75d6397e7c72efa"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 466; + dataLen = 4096; + combinedKey = "8da6f43fc4e87d417759ad97deb5d6d077ff803aec336b55e72dd4bcf29dffc0"; + iv = "b9488128273d2e51df47208be9819e63"; + cipherText = "d99077cc9c27a08cd1765be2402bcba5db9070af9b3c03272645e03cb0ede839900cb9254156b3a38c5b7df9d00dea6fa84955558a37da7132290444c9e21bcb4b426ef8cb16a8ec66737c2e163a4ced216792c7e839c1c9a9633af581f0c8e365176c699edb884d86df30f47c34218c3eae72790daaf16a7487fb149a617f267247686eee2b40259ff1b3c875fd14d98da9cad727de76973ab2160874ba94789a09c5dc09f7e58e922650bd160644590daeea4675ff1ef39d52881142b4ec98ea658735439142a1010655c690e68fba61bc4fafa72897b01353c56f47dfa506051d5091277115d029385d16559a879b90ffcc3c3e7af8def62ffc09eeee712229a82fc13529822adf60d581e0169d3e84519965c18098caa3e3fa1b88709354eb0c41bc7fe55cf611809fd9902b640a2c231d436222b884086aaa095829a1bc892d0e4c3d9cb5b331b9974b0aabe75ef2c433ff2170e9674217b6fe880676ac668fed1d15c32b5f306d948cd3b1df6a8506992219413cb2fad373027a0bda80a30a2a5a0112100205d97c83f8c35f3ee640f39fcb94b5866c2d03284acd6149f9e18fa688df32a85162d71cac4a0df11b37547e9d60706c46fd7c7f4e4bc3572ce349b345fa1a481737042acee44d21c730159275aa5e41ecac8339d55a7348734f23c0ca5247c2618476ad460848127febc5af28268e6b452588c3d7eaeb62"; + plainText = "b10bde517763496a812aaa6547f33dff8e1ea7fe4b70e207ffd2d72131c45a2000ed52b84fc4ce7db20f8ee2a2a1cdae394a5754121d201637b60db0a21c5638a8721723ff1c9cd404031c96ccc41e4755615bd958732c849373fc247e26dd6b519b83c644aa0c070d56771f93887538c16a0badef448a5fbfdc384edf3d99cc59d210ba412aaafa110810c4fe29a720946b483fb7903e98a8a68b9b1c020fbfc6a4cf8f439f47cd240d3af56d3c6b8a81aa9ed73d144a784bc7241b17c250f3e1aa72f98bd03ac381857c3a7ba5a48180c4b1792660153f8f017a69f1f1b37909fbef843e91d348cdf7e0ad0400f883e5261c79c94caa934c513e8cdc72070409e4b869f0403fca35c21358f0b127177690c97cfb3210a4e53ff61ed531de56669f401667d020f56ea5db9192c945c97e26c2542ecc999bef63635fcd788e7aa6f27f1e6ce5698cb28af097aa70d74deaefe90ed9834dfbcc48ce5671e7cdb7dedc44c87a0c81f4b696f3cd67c81919e062cd204261b1905607afae5e6fcc7e4af26e56e7c7601822721828ad1c6676ad93eac392c781e52dd8b613eb6783a794a81595cecb9600d193d3a3cb35885a8c00e729613e0911c47034d79d2a4cbf7341bbc13dd0f991de5412d92129a1da7cdbec618640968e47a31063aa99d3ae12ed6bd473284755215187afa83f2c8d2bb6d323143ce6fc008aec231771d7d7"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 467; + dataLen = 4096; + combinedKey = "4c25aa88665574774f45e96de8bec4be18bd38fbd2e608ee9ec9f19b3f0cfae5"; + iv = "01b48c45866b1c18a325ad39260c627a"; + cipherText = "abaf75f6bc82a9543d26ebe41d94483a37b6d79ba692f98bceb5068ba43961c59775047a7395b030a0afc8c9103ddd310d48888b54ff6be65e498aa1aceb1ace2b2b25faae232780944f93491c2c98ab28c8ef056a8f020e585aff0a5759f56cf5ee5565ded31ebea90914d6fcd45c6185b4d31b8dc5e81b9175b3f77fa33ee58bf75393634f743e1a84d84cb7ed3c2877beeab0ec2302ba735ab3a0ab4e704d1251a5e43dc933761a7795d426cc0524c8030f3af2ab7b34d177fd1a30236b8cebf23ea9010520219bb64b5f714cfb3e6b148ff3d8288f8ae422f82a1a5688fa89a4dcfcb21a4eb7c884163593bd3c8dfadc7571a465ea86ab39552368f84b2806352030ca4971a9ba4a7f85a0e0a7793b3c950111ee811c9184d5a423c41cbcc205a96e70fb394fe6bd0ad9e94145fbac8a5e52d63aa8193d70268928b7d761eba7fbff1e6a1038ab45bf7c7a0eedbf17cbc7eac7cdc6c329880bf4e0b950e217e5868d96146cac1f2082945ee54dbdee5fe539abc4e730383f530fb0bd12515a22abc0fb3a7928ccee73cfe6756c84f9b9026e7c487be16c60f8d1aa64b2b5512b41335b734e99fc464b6258f7434147a4b6568f25ce86008f338884d494448995ce642404cf208deb4a415672f382da6613aa17af47e80c525cf97a8df4d3419cee2cb318d40b460a8d813d9b2137406558e221887bcb5e50ebb697d724b3"; + plainText = "57ac8a133188352a3b05c35d5d7d1f31a210fc7cbb83bbc67cfbb483e126fc964d67f28697f42f7499f7ba51264661216ec65685bc89d8a1deb23086e49c141c2592c8382b7e3f3bf46395243dbf85a7edb606fcdb3a7cfbcbf3646a4b3d27bf97c30ed3b85a2efb1cc052f95e4f5e00ecf19d7f120f7c4bc8b1b51b1391525110f066a96c5460ca219848a1d33e265a88fb770580fc93cfbb6c9aa409b48df91833add3b7b230793d69e5010af876d52d9bc1b2f935fb62d49234236c66d2a3e059d6a84919d49a68599863f863d6476c0ecf6ba0fba1e5c750a91bfd1b6179da48410a34cdccc5d98d4637dd38691a85c1c7194874abaf462c8461cc2836983eec7621d57fc1f79f6cff0507769ca94e30f32c91c78156365c1de2cfa6cedf60f4939b936b855679f9fbebe2536d54d9c5d36b98bb95d59bcc3b20e38095b94188981005b0e3c7b0854dda150936cf3e846881675e0f83ee42ceef6ec2411094480c1344c1fcd70ce22b47c38408c5140f487a2655ee259614be6f7c41b975bceba9f12c2e3331ade61eb410a3bd2dc29059421d2a979a9055286808b44d5fe5d06cb247ae7f1f59336dd2594bb6c98425d6b47faa72d20f734733bc83c25c6f5c3d6eb02a4293ba05072256c40368ac1b3a6b329c66c976d03c787e0ca23fb2713c0702696900b9e8756c5e9db70d6193ce1e367d841c41ac9d8baa8f235a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 468; + dataLen = 4096; + combinedKey = "8bc05e8cfaee9777af2afc5f22a7477311c9e57d8cd0659b8cf5631ac58e77b1"; + iv = "a62e692479ae168d3dbc002243fc9640"; + cipherText = "0609ed4c86a6868025e444a69e525643004d5e7c92e4fe37b9251c477d2347d4c2572c53aee0efff43a389d87c7b09201e9b995560f2c72e4e1a169a683ed9d28d356de237779d5c146249ea4672534a439eecd8c02b5442b8a6ef0f32aea0d610cd2f60cd58359fb82a819fdd198567f33aa3f31694b7ea05a89d1bb53c0c5c270ec126d4de3918ea6cd17c18072f512f28c7db1e1c8e575bba9c6b95bd92f9806e1f643c15518379e833b7a8d068b823fc7226c5f325831bf60046f122c76c0eb60491c97fb659fb116f54339f970fca9bcc0286ae513fa3b7c1ab5b08a315bde494a8d899e8adce07124e8bbb6dfed09230b0d44a67bd2f426236dff06252df7a7fff4b50b00568f4dece481c711cee075ea75ea9ac9dcff554c11759135c96e6876f86574f6b7b8a51af3ffd3904c0aadbb19cba1c66d9711fff3c9e6844a1955210e52f605d8b248080fe751d96a7ea0db385fcf9e00bac1b9843a1a3e906c382ec10bfb47762030cfffe316c498a829f2cb3f2cf6c18892348a500a298aee6de37129c732d8b37233b1c2f1d5c79cb5d7ae59d2bb5c8acca6c0f5dcc9ca98b829bb1f8d6de698c7ba817ab5fda9a2891859d964c55aa3e659455f6fbb6bf869194ccdd5982f58903373010b34232e2e2aa3c0f626d3572804b14f67c453e8a152a443fcb29f618c81c3d02b685abf6fa3bff9f6eedb8be7fc9251ba471"; + plainText = "390c6ae6e4efdea354ecc9cfca6f7c9f158fe5b2419489c5ac614320a2756fe80138ea50cd68c924e58f5c55bfd9bee297601fffb2c0af2bfcceb7d1f45a2b5ab3bb771f896a7b44754a558cfc4711d1478b82b9cbd9e154aa71bc6bf50e6c7275426ba69bfca27f87f6eef1d75df689127eec5184b69ad641dcf4c919e757476f394650c6aa25c0bebb7369afb9853c7b943b2850684fb661ac50f16c13fc9ff0a69db7c7cccdc8649116f53ad616b512a479cd5d33f22ca64f7d86f4dd0ec24ca58fa4f1cc25ec458d4f41d9afc11f8b337409152458875522a6fcd7002b41a89fbf01e5b509bc9285715704adb0e67e2806a2fd8e681aae5166210d4df8cb4a3507e2088723fdb0168fb25984cca995bb7124cf9f10fbaa120dc2c3d519f458d98bb09bb8b9a97c90b25adba858e44656f96c50197c5c3ad7da431fcd8f436e19717dcdbb1c333b51906c2df1af64ce4fbec654898d5729b1c43c485f1b5e595971782e23992dd94cb3ff81863e6bcc07e2e6a753208616000580d567e3df0fcc9695a78a12f70719702ac75fd9f87c9ba2aae213a4e817397c0ce434b99de9c621e1158a772dbb5d339a33bc5362e592f9d7624612c545a369c65d776621d6707b96b5660d578f83dee71769017a956a611f62cefcf71be719afb475cf77a3fd8596fe71105c07ef52f72e040cbef8d570ed100bec5a4153cfd9c8c1e8dc"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 469; + dataLen = 4096; + combinedKey = "77ef63d532c72ef5c37c27395edc16db0f079f19ab22174b1f6557dd91b5519a"; + iv = "8b620a90592fb5df64d0a0fb1822df8a"; + cipherText = "2a2d56ce673ebadc771dbc6f24ce900828e805f2fe79f4a0d1670f36c4e4b1487d2bb4c2489a584a9fbbbaf9d0f9ae29c135fe0949e9295197b509ffb66b065308aa5e3da86c7100eb82fc9851076eaf540134d971a21dce083ce315eebf54bef74e29add98bbffa24366c74cc2997fb1e9d090983114ccac7532b7b8124c5529a0bf1114d29de055f7ad9fd34a107f9c9bad8dced3e28e2adb09326b38f823577a912e1f52ec5455fd8b13d22c1589f3bc749d9d9bd276eb3d6557e0b3f3168a8271ddb9a7c368fc240a1c8c4f78de6fb9fd298ca72f4a881c7e9c8b2f54cab8da1d89058d532316c3312cb13664f925dd7cffae44b98f8ad1e445c2d72027a009de59204873e100871e79015475d5a0b3af9f05b61c29d9376234534d8a73aaca989aa7eb445575ee101b214036c00a0bb728be0018b4d1b8f4bb399e5c08340ca24e66809281fd9a4537f08551c0aa3eabcdd6cf745ef83a40f1e7a0a554218bb72c3955f158efe39a98f91a480e3771483e6acd07a6e1e954db3221db6f61e3214c7c7fe90916f9b9312c334ca12105669687704e7bab5554bf1d568e6f8b94625815627abd37812db2bc75cfdd4db8b9e50e8d22050b98c9d95aa0f774b716505194defd943c5b24369c6d630a97d542d87e4fcace85cf5ee7811d3cbf0b666d440389afc8a57ffbf60948b04602007edc14c54a67f97682a6b562c56e8"; + plainText = "a5e3d862cbb020c59c6af3a9d241bbfefdcae413c1e93d7226a169fcfb96bf6cc7c45d4052e1c9af8f8c81e90ec888e52e49be74a09290e6a25ff11c2296021b21d88c814285cf7babc49b441728c7d0fbb68f464887754695e4e70b2557052cb69934cd55c36a7720642bb9084b232ef46ad807b8d8a1e739177fa3e312350694651451fa9e83b29591c356c22d4c81360d032f136052eb7a3cf0d5e7c1330eeca70fddc24dc1a5c821d22e020983a1705b4e4744aa4511445926463643716d804fd3a9d93cfc298415c5de492ab6a8af875a5d65b032180b68814505e727c1bf5f17f00dae4531a522f52e600cd3ee57811640f0664423a2742a828607ef5595206d043f8582b1ca1f5d587083462c9358f5ab79cef28023cf7af2450f47f204ad051f43acd8cc1012b1bf67961c230eecf3d0e41bcc938bec175d35854e832faf280d2d56179256d2c3e5d51e024b7b1770b1d12591d442cf7f5c0cedbe9204e56ba660c71ad184697cc64f4c5667fdb2a4f4f8a528825c9f88e5327d642ea81e27690576af36adeee9e5c293efbb30d66055aa3b8ace5b8ff1ce3418ccd36f3529d43ea640692e20f09db8bb4b04436afb0a4e5e21b26ddcd283799a3be03ba768c37989ff5b0547a5b17209d78ef00458d029ebb9a3b5a0935a609336bc2b29a8ad6740ed6a1d40580fc4ee948eed7ab5903a97426670b76be4d352b393"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 470; + dataLen = 4096; + combinedKey = "fbcf5a4cf65c4c0f8167f5a5711a34b112bc489602f31e2cfa86981da9ff3524"; + iv = "06aafaaa6b1a4f3bd61eaa9b890a623a"; + cipherText = "13721b993bd7b9812ccb1f931de39ee18fe00934b155c58f45ded64b905a0a39a4b7735ec23efca4a88b3bd2ec33b9f63f93e30d4031cff0654f844ec4e865c191c499a2e10baf2f6032d97c971d77cca07d39a06c23ca1cda83272b0431b3d87d4a67514912853b9d757dcfe6ce8e8a3637c305abb271288c038ec14ad1b0207a8cc0c1f855643cc85c330a382e0f5167cbf934b49349761624b2938ba8f106d9bdfd762402e3e3e6c8108f6f0ce21404a8a80f3bc79c3cff83ad81c8a8ff4adcaed8f6b2eb2242e5289796720cb00004644e01442bb901ef7bc328a24a3615bd162c2b3bb745d2b2079b9631360ea31cda413b721fadf83d43e0cbf9c04e36233e16cae37800e05c11669d90c50a6c27d1050abb04bd5b927ff77043bf7b281222ff412b9022c231b5504d1a992901940413bf770d08e43e7600f2655d6131c46d81a990de79d59d6989ee808dacf93a32b0fce5340e732dbd0390d1138c9e850e04bd00ca1ced95c6f88ab78dbc860824f27a74851c55218004d3db5da20eeb386a072f327c25cdd5d1e6d5d91b82ef2f18c71f6322627a1b5b50182cf7ad2eeb525b4c77ebd09bfc630e4897fa76c5357168e49ea75bffeb285c473cddb6ac6dfc90b9f13d5301c4a43b06f7fe74f560aad802226fb928685973568709edc291bf4b879cf25628c2b900d4b25802e8fd1c80694cf551817d4017ff7157f4"; + plainText = "82a075bef2289cfb13cf6c05a27c7c56d1e5e845f009f845a06417852dc67bf380bacc56453898a23725328ea6823f917b70edaf05eb2de7a022997f311d33bc1ffa148e31adbb725dfe5bd7af37fd318eb2b4674dd508e113ec29f5f8d54716b12558c55e0057e683b4b6135ca257e18b9a962437b0621e8be8d392887a3db5fdac353fcd220603a2055af5160d64591f665919a28b2380cecb226eb1881b28932803f0a065e7d47e2c2188e5123fcf9a58627d799c14cacf1d98f3a51ad15beabbf9433cddcaa1665bc375637a134d01ef90470c09dd6658990e69e6ca2c673f11c7312e83b880457383f3dc379c73838b09b3992fe438a15e0923f4742c42795efd6077b730618109ce0f8fdfcc43db90d3385bed20ea95f2da95b7bf59ee170bceacbc86fcc20d808e120bca8a6d06d805ae19126ee07a88165432f90aa48d4bcd63c429aed0d740756089bd5bd84cb4d6781fc9d358b7f28ea06135690203846a4a1fe252e282c3ff047ac71ebfa9d3928e6e08642940c394770965bea09e53274f528cddffd9dd73c123e833811debec681d7cfca64c6fb1461e31f99c546d333cf4efe6d7faa810bc1e97e5221742df108c171d110e5b83132b32636527cc3a734c806b61dd8b48ad9d8bec63f8931abe6717b5fb5ae76497c776757963494ed20bf5c6d1a2dcba46abd1517848ed8fb75c2431105c958116efd49e9f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 471; + dataLen = 4096; + combinedKey = "9450dec98808f1b1bb8ea4bc6a612f11bf35ea6932953882a89d1ac5acd9b5fd"; + iv = "b7211a355aab6768d16a5824ca11de29"; + cipherText = "3ab65fe5bce36f019e52a03f97e10ca7ab7a5d564922079a059ba2f26617d9ffb8e623f5b81af1f0f7423f7503f18be441a6df5c7ecf2f76f8210d8c78502becca419af7000f15f2264e85a4034904b5e03dc63e6fddaa72b2cfd1a7bc98b2b3d7da7b4ad01dfbc37b700c4414b934b3b28bc3df0f5ea4bf3e8d085fe143a79486c2b341ddc2958fd4690df3f6c661f7dcbb715db8483e3280ead3d461dc68ac20dd2702a01cb478421db838722437b39427d4474aa4184d005fb0c258eba5493347fc6a957c7709e4fbdcfdf28dcc4974d32497814f45964cecd6d11a445eb8ccab852685af6c255bb5103f8ed43af98ba89bc77b1851732b6a749b9a21a40e2f43c05af0a0c7fa9cdfce52d82ebadffe4642ac8e1a946ae56d063539897a07032d1b5254afef6718f8081e6c2fc44131a2f5f7a266e2651deb75a99bafdfa85e2104ff5b1748661ae2f49a317955e1b2b9b3b9556c80a0392d7e7ed2270314e3bc630df923764bb25863cfa35d0222c0f953fbfe3c13849d2452bc8a5f1ac70b0092232e1db6325a6427d2b3456da058dc56758dbfb563d6416decba18c5e16a6aa33e445644b756fce502dc280da3879e145f4916a9119f308f7f5676589a6679f8690e91952670fd0ea68de527d5950230d6b583605c8c4eec7356167d8e7820f9ab174e6a9e50b777d10b1fe95a00ec5f915121d811ccec64b500e6b659"; + plainText = "1507fde6ebae2803194c17208ad0f8c0ef7cb035aa714a6873df5efdeffaf799488d7fc0b400de46429ac967f71cdb0dc96896c1274927c3773196d74cf5adb4276292b1bf22ffaf963c8c89acaecdfd36a79d8def6baf9e52990280d0815f705bb349f1f0df439f255e9a3747048836ee458117f3efd61ff691de180e5c1eeefe32e6a74906f8214f61e62b8b365c60113843829f57502e5d9d4bb58f1bc5a38398080aa281161de48601e9bc09ad146e7a78c6638ae9552fefb16ec4d12454c9ced56689ace6e43a6c0b43abf31c1dce332182c923436ee6b0c035fba2cacf7d5c0e37af35bac87ba549e6b81712782cb709be1364e0f82f643134319547b4205501e3467726e002d7de9be9dc05a54ce2e2936b121772cb7ed51c083f30819a5f7c59c15f88cea1ff5b34a06a704c83716e8fbc0b92cdd42805d62a720cfdafb2e6815a1ff7bc17ba1d55e72c0bbd3cc745746f1c225ea721321adee3fcfc2bad6cd8a46fc8ea30f79ee001975c29ddc1e92c6cdf75d5bd8f2b3ab230eebbb53a78e20731dbbd8de03ebd1606633a5ca9b2edaccc7c50e2380891a57de87d9732ff4068526cf60ae372251bfd5bccd6807e32c6b6cb2df15c5cf94a2a503848ee509d865769470f050973716c7d65a9c771550b9347fa909444d7eb0aa6dd7126a1e3c3d2f1b65c64a0985910c1d83dc13c7e52985df9012cfdab3e6c573c"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 472; + dataLen = 4096; + combinedKey = "8b125b26d59f1d53d1bfa87d603ba3c282a0f369f148d2078d6716699b7b1bbd"; + iv = "7adb0546de1b558bcbd886c8ddcc1b10"; + cipherText = "a12736f19531f5b80801484f1f781d742c5f09d515f8473de84264670bdbf80fbc13209e44f7aa72cadaae41262a9f13b10b03f4db0639c0065d35152087f2494e3ca9fcdcfa0252f489ba17293f29fc495db9a3fe745217660a136cce17dcfceb542d1b4356a3728a383aec8d7536735b6102f84890979785da0d8d7ae1044f94a0fbb441bbf55faa424a40ef2613aaab233a5d5f7167073da9b92c5cdce2e0ee5834d483ffe8b32010f0feda154aad49c3cbfa8d214271196482f1a7be995dd2647e2926401cc2d7ec9740d026602cee595ed51c81dd91f8067daa1cba350b82430376f13fa1857b016565d1f788f2636c2bd7d6fcc685b2ffdbe16510b9a072cb5b48c7abdb87f7337d97f4f6849c16a72a28044a596bf2ea934483a40c1d7ecc3820f7a98af34f633b1c65e88f515bf7ecf6183117a19e5049ae1c8e25b82989e816f38b0b5c2288b87c0d97e36aef16f425b257105f641b45f670b8cb8ea6cd5f2b5301be7ccf4aba50f55534126360c9d2fec5b62346f94951e4168cf3816f87819d5826fba91a0bb6f8ff0b9e2165ba31b11451fd1bc04689c339de1c75e26b35fe3de2388ae2b80c603bde516eba9166f5b32bf989e22e7bc72a34410890ae2fd9caadcad5fd7c02a25f7821f4fc672efc5c27070991302ef67188ca624abdcea1767521ea3ba65ff2081b065977132974caa9bfb17d71ee1805b3e2"; + plainText = "7ba9a79ad3e44f063b981fbd4ab925d7a4acab8454a0435a4e9c19480a0aed9fb5bc3919269b51256a836d9b7578ad15b7b67331f969c0e87c2b7c4df6fc8521a7116408a329d9aa51a52ce1faf94939081d971f69c79e60cfc1fe9c34bf1838dcbd27886a0390861eefea77b318463b90ac780ba1cda29cdcb2a3ef5dcb56b6332998df96edf3c79a2259469a4c922adb6f2c3b0ea143981424de120e747a33a7f1a147bd5d594bcf373859b28fcff42a45c61d9a3030127813cef8f1be3a16137259af771af9d2694f47a4cbe2691911bf615fc1671687b4b5eba18e5dd140cf8ce900a4640e908528e8d4a2c80509214afb0262de6dc9691cba9003628403fecdf0f6d12f6d81b6ac536b97e7482c5b9f1344823593cd5cb0d8cc97802ef3ede80601742eb92a639931d59a1bb4539434186e3ac221b7bb5d18fd9a89e2d8aba555b271b6373f584990850d7ceca29f99553b96143c46a5e80ed5af09d33c36387f02f87276e6e904de69c9144ac21f4ea65327b8ef30f81df053411f6de1611fa6e8db4215673937943ff5cf3fb107c9461a4d619f4d0c7eb79caab46cb4c0a147a1bdcca521a8365beb17af495c7ca00d7272406e473a3bcd839b13c77bc2d422c1353a60ab7554b82c4f029d152bc76ecfc874f19d064391ff77bc6d61d6fdb4751125c416bb1dc65bc1acc36064a5e791108256d76335efea48bd2cdd"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 473; + dataLen = 4096; + combinedKey = "45a3877fc117179cec5e3a11d3ac2764a2b1db2d3cb95ec8460cdfb77c53db11"; + iv = "f6b716337a9710b5221a461418d5a145"; + cipherText = "d00d7234ba80530b08472cb172f47eecb5e93e2b1428b059f7cd5b58eb4d96ddc06f7f829f0b2a9ceb2c5fb526d149b44917e302da311ea3232af7178deb678ad29753fb9ca066fb0544dfee37ab144e517a2045a993618e157b456d6b7923373da4faf10a437c541ff224d038197f341bde7821d022f5716d5668090c60b8a4ddc557afe3dbed8361b7c09069edf1e3ef4ac7cd3f5dfaa0c591f4a37388937d047e7f9d0862b2fadd402f7d684baac3e079c47579ba228ccae520f00077fb20e59d27f981c6c570276085d8952502631567f36ead0636ac4e241ea8588ea24ee54d46fec5399e834eab0363dbb31ce558870ad6e074a187a09e68a33c2b6891fdabc5305327e10edaa94de686fb9244fefc790d80fce2bf0eec4dc56f8b3394259ffaacc86bcbda8a4d3860dabf73d5e238f7ef2b2b5c994136db5197f24c318a3a4528307c45571e05506d56add9b109ae6acffa270e46c857e406470515df2127917bc5382a05e66aa4114e60879806c296a50addb26b06d1a35c10603d42a6e688a4639acfcf6c970e4dfd73aa24de08519c2c090d23db4f93023adce3df5c0539f84111c47821038191fd31e4a880dfb83da709b16fe1a07e0ddaa19944caf940dd609bf605426722260315a6c130b7ba254d3bc8b442ab7cf21a4419e124862f4eef0d7f8a6b2f2f3c004f48dda44ff9b5b081db00244db04b8ca9a16a"; + plainText = "9f7e8dcadea6e35728d2dba284edd35b505eeb61ed855f471cb464a5b0eb33b4e85d20043125ad535f698d72ba35b58265f099635fc4e0618f663ed28d7fe15d14a9a00894a26d972b81050aaf7f9f37074695bff003445af29a86a7426c3f1e4b6ed12601e9d151da6900be0f9c2d67cc88e99be065f449d588f13e5ec0feadad5cf0ee8b74c715850fb06e0d87b7897167b93d355812a6f61a743b336a9c8f2d7902b6f6a26e502cd21796700291c0216dc3771d69009dd6b76557a0b596fca8dceb0a7fe1c1e693b60b7a7aaff13a1fedf7846cda87031c2f245c07a528ea8223c1a1b67b1cdcf7f7664873769f5a18827a3688adf809595d637bcd8461e643ef2d76d4d83b18bbfa626ab795bedcb8c2bd1f2d75901928c105bd0c2ec6e7697cb034b2bc9869257857c7b5aa7ea31f9cdac3d4302776a69853fb9cba3e74471ebb2e208357ce634b0055d2eba3ffb4a9f38ef705b0063bf473a7ca787a1590dd06ac092eaab253683245fb88d58a2b40774a814eefa249179db97300b178a2b9a364804702e4d7599d38aa1735e8cb629e1d38a59b8087e9b19a70e70afc846f866670842f3de8c29f8b4ca8c5e8b28b308e0e1cc29137539278031d2d3927e0d529e4e22f100a260f23e2493dc874ee2c40d21a533c68f756f063aa46c0534cc136cbf2527bc278665bca3217cda1b39b20a151e5e70ba89abf404e5130"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 474; + dataLen = 4096; + combinedKey = "13d9e9a1180a2cb6df0f4a8fe8dccb636070acef9472a95e0198039afa995ad4"; + iv = "b3e841cb9a9c49e097bb0d83eb92692c"; + cipherText = "38e3997c3fc04230f55c195cddeda3c261169b7843d199fc503d3354c5acfc7ec39fe2b262fdc3dabc52b87c58bc62cae495973c555dd26b76000bccdde3a58812d334bbef102bb7bffb4d7d2221f835af4a76001727af021fdceebe02975f9eeb7ab8410546ef0db0eb19daef66e5199499b0e1f3173bf590926ec8223669b028839662ac12877211511a356539188fa433677ac646da87dd43aab3398143b19af66b5a6142796be4af96aaa4c04357aee8870a43377ffa0cf7142fa6dfff17912594b43dced7e487994012c6ee1b1816c54c7f3a2e05c5bf799c59724161d05a86ca7f1525407fc5216ebc26a7c2e3303c13f45e7369726cc62298dc773abc51eb8ffb4f42a2a8f3beb21eacdf8b2b00ee583587b6ef53563ebc382250c0c7a62921c150af3282cd842ee224580473e8a1b5d9e2b152556a34498f5411cd24caf5b3d9a2270f4b41ca257e19f813bfd08a48a50f56fb5de6d3a36f476af2db7fa5531b69033eaefc9396ed13d0c9b731258c81a93943a6636f9315f871446bc18a17aa5accc74e7f949cf3d85326c386335836367e5c4ad074f740970754639dfac3d9272501f48bda62147d45b548f001c06726037588e73aacf3d983374c0e8a75acc31a3ee5173500e8e63ac6ffc2d5b88c53b73192e2736e034961d7fe48bde59e9de8bb66fd95dabff0945202ee2924c7edceba64376ad5996cd5a58b"; + plainText = "682a58a5f5409142424f3defda73834d8b57cd15a60703eaa732f457cdbc17cff42bc50251db5f08511a7d9596e17a1fbda0204c723615dfbff2256f6961995e45e5361113c007c4252afe76226db68c7e8240164074c578966a81c92fcef1390cd5dbc181c33fa6368575c852cbb45274a3d6a2f302ee694cd95eddbe9ac7523c8abe641c5ca1633d159341f3af567ff9b378c63339e7a7eb547887b1c5a24e53d5f13fdc4bd504da059ce321bb65b5d223a91f04684c6bf28e2ff9140b915c92844efd9515515e610867db06262d7060d82663415c5974c3fa30aa9d064e7a1c85ba1c89ab44fd0c35f16efa331e0b416d24a35d1b8e156b1ea1c687bb214db908f698454470dacd07b1d5059b514e1cb84e617405a7892db164046e557130de3a8dc630f86a4cb0b847b528f4263f9fde3e7e3979ec990ea609097ffe587be79882ebcf8d55c2343242a10097f8c77de0a2ffa5d22ac710c3fd8c381fa409a8e478602b369a43d95caf11371091108a12f5175d297dede3f88003cbd3763665221849f55da907db43ff06c1d13159be4503b1fea111531897103b593864fc92a789582ae4f918f85356801eeb813e5f3567775bba4ee2763a32f7bc9c09ddbd98557dd40234438ac09e66060ba49fd0559cfd7542769ff928aa6f585b11d4afbe599aa0ae58cc06ddf32aae4aebe27c830a28d2f18c28ea14bb55b1a88657"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 475; + dataLen = 4096; + combinedKey = "40a384e06fbaea08b54c264fd7e5fadf64ef615dc4ddb4affa67d65c17c586bd"; + iv = "f1ac80934bcf35f8ca7e5a21d1a4e7e8"; + cipherText = "c56c0a66c9c2bd986fa1801626aefeedcdb9091920576c54dcb5749946a1108232491f860246831b7f09a886c18a536d3307d753f8926eb3520c7d37becce6e965ddc708f86024bd63e366417a04e78f295c45d838b4561de0eea7c1c1c568352a81fc8d9f8679b1bccb900f161bf39946124e35dfe3b5df0e614c9399e43f39e8e5501d09512830ea1a471a9f726a5df41e32b964d85ed8247b2c3e4bb19ea93cf38f9831959af9912a3459e01c32f0da946a8e79ed881a085876b3accbb9ce4b0eb58be66520d33631b0a9cfd1c75939b1f67dcbe3b53959046d66f425677dbd36a4dcded4a7fbfad8502bcf98cf014fadecfbd75052d61ba3ab19a16e6251440c2a25c81058950cb04aa123b855cd8db0e2c7591036930a0c5763864430b295d257b3287be68e007ed5c465571ab20808432006e35ff714252833f45be99df99dcdc4b7de5266f2193cee88b390b1e9674e93c921448a09c1be511c4c7c391ab1dffeb9bb58360d087be136734f3d7c13396f78486d270e12bba06f5d832f109893e5683703df487b4f9b64f566fcbe8550ffc459fad6051cc9c5ed03c587ac1f27fbf1743b17768d439adba302f25a5e54251e58144000bc3f0a5b44df0fd4b061a2e069a5dc426fc91fef5c5c52d1b9e2c2c741ad4211129fb40284de16b195c60734445cf418bdf0b0b3938e1147df219e0a27e6b4b9049f0361a1eb8f"; + plainText = "491777b00eb3873127f83ba784fde004558e42e39508b9143263a086377ee1efdb5e77216606b70cb67c4d50fdd22e4171853a817290238ec1e1fce71e1dbac9c72f15718042cbd3cb79ae15a660d218cc45669c9879c1846914c81a288c0e2cbe8698c8c6895a0f248cc8b3e0b24c78655a3dbc1cb2aaaa9a96570a7b9a0b229ea306d314506318a7ac89dfc6cf97961cb0ee9358a1bce3b65050234b60982ef6d66e03e9489575e8ce251e38191e130c92236d5b973f71a1ca8fd7633817a1a5da294e766219f601ee39f65788f3b9869a39ba79c88a2e33695fbdb36f77e8e917c0809e4dfca9e36db820434afbef1b6e37a63307f98382d6b9ff17c7fe2f61e5c3b12472e83849689f58d4f00a4615ddaf448bab7fd3f6e7537aefe85356a3a7329e2bec500f34bf8af62d95e70f3550c85f539f56f7efe7961ec11919842f10f6e961b07672baaafb828048c71f812ff125551ba221952ae2eb0c0e04cf32b18d2145e7ff2eb1f4165e248d555bc3b990de4c633f79174ac41b6712d9e856894befc27ce35b286b05325b005bb0e9f4415ebae3837d60590da26efa3137973e21beb2bb460462398d7d4d5bef79afd9623d88478ce3b35955e429ca625893913adf7d545ccaadda7b300f48dbf930bee1680caddd7ecf402de04ba168dafcc93b60e3cf4ead1486b5787262574a18547ef75e9c2356886bfd515930e4a6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 476; + dataLen = 4096; + combinedKey = "ff195c2bae8d8e8637a3e8160b0ce33006b3c0822a2f1b4b149c500159e24790"; + iv = "9c8f141474e6de023f5946e3087b412e"; + cipherText = "f87b2593b1b4fab18b9359bc544f4883b75688e6477cb40e783c284f9110587f476d5e5ef70a74b0e9086a50adac21449833e0e4d11109c8d3e7c123733321a0f01345635ebcdd9cc4bae80c6210fb672842ebd142ee9a066e59446db5d635d4a3d4b455e11a20634ccb13f3b4e729b82fdeb61e366db1fa68c47f93334eac3d0a9393f0b7831f539d8120287ba663883ae0c2fe82d169f19ac55063d9af0d5c9dc22463dca39235b76fc2dad86e66a386a50b35864ad80f9672b431386e703810bfc7b074e827137de82a9267e5166a686d9e20e808bd2654185342c24ea6916db3179906f5b16e5b859eab9a074b193b2f87261c9b5ed4cb88c9082a54f4b7e136276336532a563ae9cf6827359513f7b907de968ccad6459da21f422b88e3d61dc2e70723e9fb340f797727f74a1087e293640fc3c0db636d443d04a331a945a8d6419cc0a133e832d5d0ba60f02e98716b678d83c0fdaba4518922cb0ad5d650b1c776fb846618e62478be2be4f6968d6802426d460a4d7fab19db21ad26eccda09610c8ea0530721a58eb54b6944f9ba3afec3db0caf931199829a31b2d94fae1225829a77fd838691ba60aa2030874374ef56f21376ff27288c07c14e85405c9d3b9d8da97c58c5aa30c0e591509e21ad82d7d294a248e197d68943e4373a2acf92edca8d91b986a6ef2a16c06071f9e81c77f5b2e01e092cccc3dfb54"; + plainText = "0e5c0d5caf23f42965415b87c7a2789c920050919d64ee431b6a833974210774a3e58c12e29e74573978826bcc685168924beffe75a6aaf036f689fbe90b9abb7deed64b8bd1cdf52840b9a905e21e61bb82110e40a72575f71a5013848af9e96827502022e49952cdde1f9e445fdbddf96828890ad60dd8ff1a2fa2b996c6781330ece831c3aed94bea04fdc996d9436d240a05d05a14b6dadbc1f5778308ad59594024c62612f5d3d4df41d8abb38cd64fc880bc17bc05bec06cd8d1485d7103ed226c296b5fe435f869b4c435edc42fde41fc52d8ed84ac147932e0b6c47a938c85ad1b2a4c1d058388b517e5202f19aa76f921b4a4b5853db3ee613f5928f307136a5fc6ac8e0e7d88f19a3beae0d799a800d2fbdc77ea629a4d61dde91e4691a7720afa8111fe8e460e5f5163ecaa9e4f7804a3d3a72604efd5e220433c0d7f13291f697fff155561c94963a138048f208cbd85b4c89a0e59d8e6ca58a8ee34b6cc99c2f806cdd38e1ec1170779302ba3dca81cbc791f5d9aa4b911cde0fe8cfb2acbaaced41579618ee00bdbbc7898b1405614da5eeccbe497485987c10252e818e8985c3dd4978e3a247e327fb4829d4afc50f69682b404313b221df7e76ae23f45e9c0a4ee31001cfe4ff15d62ddfb880cd171a2e57df69453de30d8b5f258b42b57c10d7e442127c99d29e7898ba0bf318dac6f5e2546b561089bb6"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 477; + dataLen = 4096; + combinedKey = "0d5641fdabc0697bbbfbef488ab018445bf92cd20cb933258725e6909c69c6fb"; + iv = "9ebc0f75cbf4971a18f37e69ce8ac5cc"; + cipherText = "21334520d2bd9d333d04925930a0f9b5e2da27de3c9247e622470b32265d09379da5fa3ae83aea8452faad718cdb1bd85e5edca48d211e845d3ebd5adba6bc0e4276baa2c1fa78b59c65ee67b06617c633aa2c8cac8298a2b17b2d708b3f86a80e39c04f6d4ec5664482c58ed0b3ff401f43fb48c7e98a443bbc0482a53980bc32468ff98669f182815d06bc8ed7df2a97b077279f7f6bb10d3e72df016ef05dced7d0f0b11418784b1ae4d835ea1916e58a193d5aabf57a984451bd37c9e6e7ca8fbf6204d93bb9a89275b043aae70bd93c4a74260522ab6d59b395db23b69c0a728db1ee8a174ea43d7bb80abae7a3ed617a5b6ed1cb8b334ff1152889834fcd653908139395012883b8a10137d45c844d6c9f4523ab200cc45518c64098cc99875256f7a03ecb74166ba200a1071e02d2c3ce050a090991542b9a3deea3381db4369c118558dc86c5c526e7720a23cec4d6402df1050cbf6e7e0b4b444b1aff8676fa394d151936c38d8d86a76367b1034c71fd07d12253160d519b38fbc13f2b0bf8b6381ff984bad21c72d27501d02477a81304c2c3f3f0c6fc73f73ec34276fa847604ddaaf7b01655131f95dce4f9bfb4b24e7939828519e55021155809972c9437065118677011e49572e1f1a4402583726e9740963e72fdcf45037024df1582d250f992bb3fa127605a1abded0c34e21a0cebca2302991e11eb872e"; + plainText = "b4243d3d3fb60b62e42f127a3dfd811e5767ab22635cc39ab6d7138112c2c5a9beea5e8637f643b71ef11d8eaf717befd6365ba578495fd13c90075dc23d2bfcfcc3169d1819826a5c2cc3145a0d022347ea4ffd4db77a08dfc4ab8f78e34d33dc1ea02088710130f9677b8eb0f641a62b467069dea3f13034f42c5953cc4c6295c9d782575c0216beb5520f1c01d45bd9ae4896d6e17b080e8d36fa481734911abf7c4437eb6375919e05004b424a4b1c09c095f354e153b4d7556a181e6d599d5c57436bd791ecac85670e56ce9226d083b40b72a075db126468d0dc99d147435d597c83516bab2ef9c8dfead61f739203d5f82381b006ac1a58799bb0632add39aaa9cd2b43f95662480e359d633b995cfeedbae72d5d1b15e88d02c325a7d81dd2b1cebbe9cc286f22d0c7fb4bda00c9c3cff54da1f5732e85253747191664d20392928bdd2606decae4330a11c7cbdd1aeade95b181a9e700692d1262aabcd65e15047bffa58223616a7284c63a983386e5bb1babbb31900cdec39d213dfa7f177cea3b315617f2662c5d8297d78471b6e5960790b0b258888be3a5a48f6a7fadb7da4f8af112d0c09c39a340b2645a3bda9e94227e59905376f257caec812dbcccf6f3a395f857fd85418ede14656a133e5006dd328142a6370d4e060fc935c85e0fee81e911d24bf97b67e2c4b77cebcfae9076fdd0df0359bc3a0649"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 478; + dataLen = 4096; + combinedKey = "c505dadcdfa43719ab4cf5cc162546855fe9dfc269c1a5d2311307f678543ea6"; + iv = "ba2f13f6f342edfcdd4a071f21a3049a"; + cipherText = "23fe4abd9dc89a462c45ad57c17099fcea6959aff59542a969f9a17df45130c3298f33dfc322922c4c96298efe92f7a84b6b97f31c32da47569873518c99db97a67adf4396ec4e1c75ee904d8c4df9ea20371a16c2accd1064ded9472995565998e3e7dfa0cdf4742f35a8adbf02951fb28add16a0dae8149d730483650abe5bdc2f8f91b44356471f5a074cd80e104a4f0044e0fa221c0e53e2758f20432c8349502362b78781235058115ff96db62c3700b13bf3e0c3c6bce94616800312da108640560d03cf03113c090405bcb56b2f27395e517c31aa0932b0b402d4ed280a8d98369f661e69d766318a605bffca611eebbad0e2a02e9d5010fac523c0c78da0fd4aa8e9001d4ea7981b1ae9b3ca86ba87ded1624b4ff43c4ceaafc4d324029dc26416a3967dc135e1ac9eeec4e9c57e9d4230e61491f5f3d57a5285a68908958a9a578705c0b6b5242d41ed1b14883b7a22319054a01f40340ab5d952b74103d09424232940ad4417cbabb26aa5349eabea5797eab86a63ebdd83069c64df473ffbb72b606307fdbff5d4d6716c4124708d19882e0a18ede3bcb0ca6426933051ee00bb3e29b03e0f1ba25b38807b27c17c4d909c4d947d9da19bb3c2be7aae1b05ab1fbc7be824dcea2fa274e625fe016d09960c02082fa80b8cd4d1ea0c9380f08360d34018437cff0de5cc71386d9856884af876ae6dbde0443807b6"; + plainText = "cefb698cf504fba683ab8d128049ce86f82ad47ba0eadc76c7a0c08ffcd070a7048fe2f6361701ab2206cfd9c5cb725a2c1541ad9c5d630fd2e16853bf29587041c8ae634ac5dc3fce12114cad9178e99c07ccd283aab319812ab388bb596956e246a4235ced3f38626f554a5c3bda1dda940a45a4c7e615539f9afc82b5ffc34935d80d0d3b55f4282bd53fec00ecba079a394d711232af31dce09112f374f850db55c0889a74b2c0b74c0a907d6be7747031d960882b0d31767677497a29ff096754baab6c4ed7d7b1c850d0d6d43e1b0ba0ab4496052ce252af20f68698e54c960b99a9139d2e71273f3892d799cb8224520b1624440484eaf30bf1fdb7467fe3e20bda42a8f5cca6671fa67436cb75da43afa256bbdac85f8d8b30b166b324d520b66a1b77b55e76ffccfc66ba69b13f28de5642163c426af5ee0b5e1616d1038c777683749ef81798932dba4cf1313368c1fff642a032172726b58c9fa35ab8d47f09a577ff3702cab13b68fcc23e5eca91dd8222da04c944a63edde3e901c9ca186468f2234a87f22033ef92b66cf5025b27903188c5e5bdfc24c6cc890fe4b1669aa961d6a283a6fc24109be074f4582eea6fcb8b06b55a140097cf72e3765d75343fac5074702f6cea23b5d4f6e24b9ba964581b79a7890ad3261cf81cffcfa49be7bf4ea01e631e8758515c9a27031621e48623500b12c623196717"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 479; + dataLen = 4096; + combinedKey = "a3a579e2abb201b2ccb92102233cc646575d39ee3b21bc76e2649a1528ffd4f2"; + iv = "a86f6ac68a3b1a01020a98e5c5f5ba29"; + cipherText = "6ac15e5d72dac7e52107fe55b89b0ad6edf04722e037e18a9111763198039fceaab035a70d50397c9c3a5867a3a467cedc028182f1a87e89717624bfb598656c47a56f0e3de506fd0f6d9e72a922f5bead036131626a536eaf24dacfc5bece440ce144232edd74a7cbe883afad06959bf63ec8f67fda370d393942a20fbb4cecb5dbb0bc4ba48d225c54f2e26a9d807c827bbb6a5c0de7e1a0d321a274f80ffe527212c170a5c0e083c1d8f08b4fe3908a380d2346ee49a50c7faaa314694028a9eb55f6c52c59ecfe536e3cf0dd2279a374d8036ba3639091f9a50cbbf654114a65b935c43121ae3c90c078f95b64220a655b9e41307de4804b67c335c37335adb402f1621b220353b9cf4776b1089f0a164e7d75fa9b345edf147c1c9a8ef70a0516a7c012be6c1c1acb40d9b8f4c470f95acc11fc3883f3bd756ab07ae6b1587e1dfe2d9647fb25318d53c3b91a412f8989c7035a507c67ff2a5d1c9f1e1a523e77ce6299de2c25549bd75bb542e84e0c16e8356835768e838ea47e936d9570116e30e564d6d2be46b9f144540822a1178c381f46307b7fb138e8f59bffd4e719feaea89e08f49c38a874fa491c908597ee5f34f46695664d877481aa1edbfe50249a5140006d7e225e9ceeff567ddde941ea153c7260ab453946e9c173026bb0e0a1048fc872d122777ec38f8ad582cf0f017f2100c7875c2d551b1e1389"; + plainText = "1f76cb1c13667a504e8501f470a7c2219f10cf6ed8152d938331e58de916c16c0ccd8ee07e4276d3ba2bf07bc48272281113736d548fa8a7f89933b6af3f3610d504b7d893738e79a14780e790fddffdb5e7e2587aacec5660f9b212084130331e6f9c46db1c15917a7103dd13849eb3cb3d2156148f34e0269d277769e0ce184ddb1d6cd125f9125689a75d1335dcdb7aad1a480c6fe4d3b1bf55935ed694c340677fd1f3bf0d2196cf536beac68ddbbccb62023a1c94933957886b2b39d6ac176b425667b91fe3e11624ec8d43d793e16353af5ce186f4b9a0c779779c52a7afa987d79100b01c303d61287533899441740bf1f6ec17fd74110fe12534bcf54d90c3480e24613f42a3b449d7961da5310e27770429d2d1ceefdb5943e9946f78782552e7a61b05f35ae794a651a5646036575c31137874719e281d33853ada20e0c73c61114c8d804655ff89948e75b1fc0e4f6e86c72d2876ebe4c3d358daa39dd12777d4193c0060044460ddf2d945495bb3caa717af5d9691de711e26ee9458b99d8c7789ffd2e882a1f77d465b94fca6bc35b3e0380e99b5ec5b0d342a8ea77713785aea5e87139e4cb2310d65aa6be2e1e09983ea0111efceca80a2808f3e081f6b9a4d0a66440b078a899c507e59ce59b6392cbbbddfa208e4058e8e534884a9fa3f9bb83185eab97d2ea9216c8382294885486f331606463d92853a"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 480; + dataLen = 4096; + combinedKey = "eb8e10c5ffb43564d4b8acc1e74ec7077267cf9ffcbb0e5b4c93e09e049e2758"; + iv = "094fcb920863afc7bb9f1aaa19d49467"; + cipherText = "d2b35d7dc4013955449c7150cab41846c336080cef9dce4f3a9c635f574f1bb1b6fb1b1e537fa1e7681d1a0c57135f125ed644c693b67be7de8826e9616181945629d6dc779fcdcf7afc728dd96061051777aa2e229f0f9f7725f2d53fbff3a6271927af168949aa4a8a6d465e13ceb74fa3602a70005245f293de9010c79652ef5ad1711827d8639d7dfa9ed41f2431c03db91e944fa92d5ab736326916b2d2919e0b90ff9eed5e66fcd9f5bbd693e7217e49ee9e81a7aced86b6e5d9a0d769bd60cc3e4ebb659a3f7025ee6cc57c72873375d9ba2ee54af8dafbc6eb8efaab3b13ff1c487b465e4abbd77039000adbf183b036efb350dd7decb7392e2888578cc17ef4c3223438d5a5a4d2b796f4a64306a41c3bc4e3f667a20a024c1cd3f0d30bed960577442dbaf7e6e4293b89fd78eccb99769796704fd34fb99b1511158cd147035a1125eb93e1020ff2d2557e843c9cdaf8cf928c4cb3844abd90c6101059d7cec71aa4cf75146f09aade9e93eec41a3bddbef304c128438b5f95c02bbd521a451c81bfee414c9120febf0f77c16a465821205fb648926e2924d407da9b3ad69068818616601d712cd77faa50b0f663dc568228999a029f6d4385cb8a027ad8e827693c72dc38822e3690bb1ae57ee1d3c2fa9d991ae0702ebe7730d7da8791528b055b74c7fa5c50916f57908448486fe475dbd05c78146aad0bfc66"; + plainText = "eef51b48fcc2173c8c6da4c91d8ddb12d40237640b54cd8bb552ef214f8aee47d01a734b8a3294cdc7f00143a85402796a61825912d63325ecb0346add1534ec6929aea32cda0c899ff7983c4a1e60634ec1495409494300b4791307192dcb5da71e84c4e6dbf89b0a7b11fe766a329c103140867df746b6f8bc94d62df79e0425d4907913b38e118d6544a2b104273ed283b72a8bfcadf138da315f66f99d63fd94cc8da7152e7f8b935179d85bae655d34de448b0a1b56c7e9610782cf79521c26e5a48becbfdb37e47ce992262121d27b96af14fab84e7a9c3208a430ec41e72b69163d1c5eb7a23fa4f3c86bdaad8d949cd5e852f1168a81b9d3cfeac0b0224de160431da3ab7718be52ffb9a4baac56f51d4ce154626e4669d18b09000e19cbac2348b444e6a633dd32c925c367d9d45eb79b72aaf21c7abb92b9b734c939da610ff6297f449a5680215eade65ab5f5cd7ce36b13c1b417634c6100676539f50ada854a850a0fd51c26712c89bf3ae836cd954252b64ff996efac67c854cbb335ee5a6644877f688c2d67da6df7076af304fead865ea6ebc02360dc29a493bf4f1114b099f32ee6ca243ddfae4e9fd0402ff3ad1719f57f8ddf970a8388e46686b92f4f4a88c8f556f2e52774995abbd2dd7a3f64f91110db8617e8ff4ac03a21b38fcc30d8dd1dd88a34cbb186b572afc16c6c3c62f40193bbfa44cd35"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 481; + dataLen = 4096; + combinedKey = "51f3cbfd0497f914d1c27a0677d12f66844c5b771e341ebb833ceb206aeef877"; + iv = "c4b1ec2d8640ad1d705f65663626009e"; + cipherText = "289ec2a907353736416aebccb6a61612537654b51a3fd97b6726321a980c1c07bd790cad3a7e1dcc6f3150d6587cd96a712936e905faa12b0d83046c092cd2fa435004ea039521813dd08dd158ee65b87a124e1dd4091c7350d4e94036a72a15aebd6bccace14a64eac2a0111f7f99dab08d8b75c20f95d27a933465c23ea0c9d1d567cb82f3eda17603d992419599d666a17923b4ce340f6b67e5ee4993296b8a21a9211c8e5611933c0235b8b9f846881acd5aaf2ccd18ac1e761f6d40680415106aebbcbab9303e296221f8b6753f813544f841b9ae737e696f70ea0aafb457fda1c48cda10567abadccf33a35e2ce524504facb96665aaf119cd46f0218374d0c759af2a185aa8efdb4a5a898dbe639e091e56a01737f54c5e2936e790629e3a2fc5b48b5438020467b5554e2a20dd35550f300594bd5e0f27a6a9aae5c5296d6210efcd27ae43bd0498e1cfdd73da3b8c29d57edae3a04f616bfbe6646815ff0085487d1a2e5667bd850eb959d643129043e78c742b6475c33db7c89990ee5ee9edd53b241146c977d93af7b82ce8f3a2ad26fcc7164cfa83103b0b3db7655962e2df98126248566a0811cc778d36e68e2d967cbf8a1ea6846f978ca96c1ef34863f2172f9ee2c498ecd0011a7ebb1e065c16e16adf05652ee02d46ec5ca1061c4d2d26e120c1946561aae66d5670ebe40804859c5c270d49bc89d0a8e7"; + plainText = "9b1eb6dc214446ecbf1812461025fa9c268932d1d2ba945e766e84a134dcb6ebc794b22a7622d8c1eb374da281279501d06fd6241fba6c52bcc4d8c2eeba2029ce13f5472f362740dd98cae0205346da36db74d729d61cf44365a815d6961d13a95e7ebe1cc779f9cb4ebed806b827d43149a1953ca66b3a3a86ff1d9d5e8741bebcb6993a285f14d6b14c713895a2f3fde60ad09f2e8eb58dd6638e6ca9508da39078635a578be35d92873b271dd3e5014667644f29db6c5c7caad4ff1aef5068f2d2f4e0da5891747b16c87a8721c448c2d36c9d180e9927b5cbb9b915fe77b7c0ee68a9bc1c1f1f2746e803ff0f2ba17249fd2ad3cf7634608f8276f206e1c94b76482b14e4686254c1cc2ac65364675912767fda6e13e36bfd05d959173c6ad59595a3fb6d6111f024d251a820097a3cd39ba2fb391b55797c053e43def451eca7b32a0e94010a1b1e14ea615450bf0551ec6dcea44326a072daad266912bf86577269c6f5272d06c615e47d0d842bdd565838976ccada59253f6d8d23dbb0be2bea9a993ff169d6c8ddc7372d2bc120edad68aab0471d9d3404bf337fefc343744ba6428d7e85c23ef800d28a963ac0853375247c397c5f36a186f838c4c2993337cc139eb74541520b41c7b693806afcd5c4f7ddffa4327c6ef400dfddc42258ea1ea6e698a8eee51c0859a6be36a44637de0211b31a0faeb2326ecb73"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 482; + dataLen = 4096; + combinedKey = "e3ed136ba58349ddb3279169a3bcc795c26656aac5d87b33dd24316c1da12b95"; + iv = "51d0e4e4c424a15eb58d61668534516b"; + cipherText = "33ff298e8267932b3778b692fdaebaaf50deb33d610ce23a7af6f7f6c3b7b149e535b5064eef4851cd8723eb7c1e56eea7c7d22e3367756ca2fbf5d595c1c0922bfa4553f9c12a16de73857e74a8cfcfdbb1e3fd4628df3cbfc9b26b4ecc839e20164a6159bf8cddd6c222ce3f90901796ff33ae1536f62fcb26641b6419b8c51e8f098a59731cab8f0a4d366a708a0a5381790a45fd7a432150474976e8f9f2fecd6270c0177ee8007c2e8dc35f8ff0bf7a5315f8691c3394d26dc683b080cab113fb5ea60a8b74c179183e38e991a0b3ec3522d15255a38bd6d786e85444d242d0e684ce517a365f3ebfb4de6c2caca3455cf96407cbcbc755f733ff45d90d43ce3ff07c3a3a1bdb58fe911d2e571c27bb9967d44f9c6e68bc968b2c929b88316c4d14d9c44369d27730b3d3cfdfe519b0074ce66a1ed023ee6f0ad0125472710473dd23b2a971550a88879ea33ae8c691da5e7200873a1b79f2a91848b480fa7a19094ada12505c541ae4bca48c3f6fae6c09aaf60c2a95f82117944413c9fb1f6d0b2711170d266323dad6be63b67a88404e123346854c2df10ae4d6b55fbc0395a55254cb8133fddeb3b3ba6d2a2976dca2aeb5b6b2b56ee46dc1f529923b960b559947dd8012475f7be6476ccd6cf33ec578c861791e25bf8a4619168da8f8d772378ef47ee27d33e04b305d08f9f5c5a0c547a94a3c749031ebd61aa5"; + plainText = "f5b324240c150063002d4041a5d6dabc5a2c8d86e82ce9bc20f99c654a10bd87a1e559a7007adfed095ec1b701ec61192de1ef83f3aa7576923a706e677aaa061d2ef43d2da2fa4271a6238f95d809d73ef75cffd394f34604d7a7b8d284b19623c87ff13c4e82795e2b625b7b60ea89b00478964daefeb8eec2ea80c4b903c84f99cebdd2a1e616f7452d390fdc75b2c63de74138e81523b67cd157da7174eace6dc7d28ec967f4fa786bc8b466f13c9d6ec4d69c504147b33e7be48b0b65001fc7cb9f17a1414ebc16ad0780263b0a9f2e1f2a041a75c3982f129993ef670833d8cc2096e364278328925ed5a6ce9a2bd64bd6fd9165496d587e9de8e3437108e23bd238a24378927ba9f308114d469e57882a1f90f3645ec2eb4abf54817a980829e1a0708a806d8f1068024ce22c1d792e37fcdc8bd8a6b8e04634be337f240f1068c0a15538fffd07bf9cec0b63a92ae92a8e166cc130d2b78a4b1cb4102e3010675e5c9dae3a6c2c5de90bbbfdce822165082d6e0bf2261232c5116b9fb32e88d2fd518fab9cdc727fb9c3383670da29e7897124128d5c6e57d8398e16fa8c0c8a78d79c2199b8f587f7151f2991581d8d685bfbfbd3d19c0f48a90dfaaacc4cfbd7c52cfe55ddef2bc209c00354c77b7e445c08f05a518bdd54b1b43e4771a20e8af3ce72a9876ce2e33c8baaff5557ee465a6ea18321f13a0afad951"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 483; + dataLen = 4096; + combinedKey = "f13c1c9eba8ef928f46aa3f70dcc2baa0e6b20bd003b1a38761765e18414a307"; + iv = "6c44bf958ff9b513e318b68b5c7dadd6"; + cipherText = "3183d1a95602ab4b196b50efb81907308a986a10026ababb7bf75608d913ff0163d08cb0eb8c55fee4d8591bd6256c2a3bb2fd99ae0a3dd6e0aca3e19d7264625c7db860e42e0221990170a91d9b01880416e7aa1aae89d3b77a5fa5e81e810118a4c9cf13c4f40a9e1c7ba0f1e2e0ca76e0553a5e5fa01db70d82225b7bddca8285a9e03c315b432451eec23220c3f4fbcd3a2623da502b3a98d3e1ea5a9f60ddcf98104a7ad46679b9cbc51555d4bc4083f0147285ba6e0f56050a68b47beb1a1704451655d2732bc5c7c1a0805488b4e4c1279b2cb122ed3c57abefe382f17095992ac280f766fb3380bdd15f7c66374cbafc739661626f66c572ea63a7256fb8e1a28da2ab9d656250012157ce3fcfb7db741542383d822a151550c9f7ea04e8ab6b6c3bd9abfa14712dfef8cbc8da0e5f4ceb4856ce08d33cce313668a2b791fed1d5af91d4326753df668e88f5c2448213c8b41f39749739c1cbd47ce7a74e93ae4e8fd1a02a80903f65e6c6ecc401466038f4566085f023076d7fb628bd4946b8c28522a26d42c692ad1d2d45495baca6d9a3f35b857d4aac865cb1b229d888a18bc389a5ffa5eab8b44ff930a44c920ded84277459140f6662801ba4326f90461a0241ebb7d9bfbc3cb42bb23b71632a131046d9d3af5e6251c5dbf89856f59017e043124ce9221b9ec59c1547e2972b7e030769f8dd56326a7b5f35"; + plainText = "6700c7a1b99c1c7d33b773187e3be71df6eed7bf2c5c971a937285ae06acde4647f27a7a839b6ef7bd6f0e12cc612373eeed6f3c1cb5262386573b3e179b5d3d15b037dce50b71e52cd02e89158852d39fc9b14eebb96cacc4a2874972d56736f66cbfd2fa3e1a9e6a98eea4c540a093ad318f6b9d083a0a504c5a57768ba560d6a88ece4c94a30162351df40d6eab7837f01025986871e8806f177567a539c8a3f6e17953bd184aa8e1b139105e997c1fae3a1963f2af76a66119262256b6d2bd7186b1c6b2985c28a9708623daf0dd40fa24b832c6ed5262927f9dd728c38f8420413293bd7c712eed4b026c7cca73808d722bd786ba059abc382ce8ab93c4b4c9a2ef70888a1bf54921a24ab75d0af9d8d94440ed95d9ace4a079d14938c3d121021992f44446afb35c412ab93a578605e0ed00bd2d866e78c6183d3b955fe76f3ae68f508c6e31627e1f58c0f6ffbf7a13868f9c1c742fb0998c0acb513b3f0c4946c062a82acf03f227c2d6f43233806d0ae6cb828b28701dabf6d77a28b9a6076f3772753cfbd12dae5f6fd42c7485913284f698ceb5759d424234fa2834f29ba1feef0dbc2bfaab4eb71620334c5e4cb880715de5b52068de6ad97a652d367d40dc3d002020ef6ed275056c7d0904c6bd2588e730a030cbc0112090bf9b8f7eb5b411c7fcd3c10958b336ed910dc6999f15b183729333f3f50e56efa4"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 484; + dataLen = 4096; + combinedKey = "7fb0117b5886c1b927aeb07b6c15ce3ece5f52b064194ba6841eccaecc61a4ac"; + iv = "f001bb080d3109fe7a44719ab4f9bb54"; + cipherText = "81319a2d6c8864ea5fe82e5e362c594a5b399b90ba566aa957f5c73542bb3791ba25f919accfa12857d1f9dae4054f5ea27eb5e799412fa38cf3d71db97d5137887c1cb43c918870d06a4aaadf2f18f85d58049e2bd8fa800247dcd79fe54d773dff703f2866d6407b176519032f5967816ff1bc361cc1db1ff9926b8f92bf836c290b9883138aff20477e6a938be3248ca6d3291aeec01d6029b40398135c85dcd8ec08f192d060820e0a01c31498454f33a5d4ffcd234f9d485c33c19ad2a278d22ba6555b1b204675d65085e26216df05773ac2947352c25e23f36485ddf40baae37c66d8a7ccbaeb9667f4816af2ad00a3bfa20bf8b682aa46ca15d55f3d09cfdc1f26379b2bac199b83aba8b40693291dea0d9dffab41e4f3b2ee17777b1a7a4bcd16bbc5e86a56dc726e603e422bb7d2cfcdc71dca66d071fb4be5f9b628272dd73d593ecc2e8fe353aa6b6ca3981417ad3eafca2a2459bd39de7878439ea0a1085135ab6789067ce8bc08993af9ec96e84a2bf51a86c55e8b405f205b7b515680e2b1507a5459833f789ef6a2bdc2974ed6dfb2493c47b85dde343d0d30f4dd0aaa858d260557f7045f37723bec943e7e63945ed14a8ae37eaf4c5d136b77afb9ede5d0be0cd776779cebece4d31034bad00a7b0f3c725313d4ad9b96d259c8145eb9dbfb8b1efdf04db3ba06ca0093e040082a932d7cea9f42d6e49a"; + plainText = "09c80ed6e555e6cb0ce6eaf6738a8bc8d5547665566e1c3604f348fa02c519f45d0755673c58bef3851117b09471f4e1f658b2925c1a9a1870f6d67feaf4f441a888452f3809dd6308f2bc1a4b707c6154905571fdb7cd063b9d3209ab95d0fe82a5af9da5b133bbd145a66b9e0c6bed460296815629aa41a6c4fb3e2ea5b4e94a0108cc0aa4366b44f2853f0c26ed1af9edfbcdfae4a68673a7ffe22dc60110d431daea073357a9809888bd7651611f4ed34e986cca84907d0ee9568be98832bcd51892f3d4edf841a8baea3f08727358c68ff01543bd2d8351bfa348ff552b1d6083dc5773dea0d0f37b8bc579da847715feaeab149abe0c9b65a527cf80be3558c783caf69a44e137972bea026b7324822b1bc818372adc04e9970b6320a27ec123832aab38e32c6e4c9945f0ee280576240b06a75bdfb1d8fe6d5e5c958853a661c9fecfa74265bf8b0cef3b9028c9beafa44fe91cddc99ad8f8bf6c8325275a12de23f29afe5a0ee8f7f81aa997f2f33ae6ffb91e4e2f37b9a0b75c60231fa145256b64611fee8b969853470580d6228d4e9c3fa6440b45de82c2757e2ea0813973511d9df5a04bcbb40e2d2634e8c760415eea6e8f4f0034e484e5b0adb206f785844233c206e21c6fd6b5675d527c22d895451a204a6cf6df7a1971e32e6d6fdfe336b4ef0ff3ffdf8003bdb486c669eb3416d7ee584b92536c29e122"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 485; + dataLen = 4096; + combinedKey = "2f04c956015b9e45c1bfb657652a3cdfb04ea9f6c4928a16c6ac86c93d4dc6d3"; + iv = "1ca3f42d69053286ca5b65c55ca15535"; + cipherText = "22df67a1c263487d9d5a609c85edb94ffb8bc0d639bd0b2e6b6c67e05c7a2fb2f5142ce8d30a98de84b624211305c594a66d0a433a21c102a8d5947ac7b8bef7901282e827e12ce7bf4137b2300d3e71a479a9724395e6aeb0089a5134f3908eeec04567ada60e26fac02e576cc0140412823aebcbbdbf8e1f070850930e2c1926402949cf61b8e68803cd1304a5d218ff91c68a08cd2a1c042019e30580fdb4352f1b95c4f731fa84fcb63f151f194c03ddf5366aa206ce71899683ef363507e8c05e8b8e7d1f0c7f1dc233a7ca76d7415d826d41eb624e98583a55c82cd80835421e3a699de92391220ae4abd5985340730ed44ba39582d6b3f6461d986f241e79b4d9108d7981b36f9a54cf43a8228def2253e5fd0aa4639f4fa3052bc8d65d354a8f6b1597c70e267c214d25ce40e8efbea0e774777526ca01dd74d296085208006e68f8cf162a80d1db02fe72fb0b10c8db85466a8982882d5ea5d9bceb9dfeedbd698bbc2243dadf7814f88614b0d6561126181f76cc2b177616c46338180b0e7eee665c1b23fe3a1a2b7a7b12df30e69fbb77644227f2006d77d9b7213c085e2103d5dbdf930f2b6999954b74d2ca0f04bcc74a5fdcdee098cfaa623c3e2b77eef4d08d9547d09fde9898f75777c8dffab565f13114d3527e609d699a9b02de2cd00be7f62f6cf739baa2fe904d12a14fe0bb26713c3c5b38d7a56ff7"; + plainText = "932f9d808282beca376f0d8ecc77c500f35877715a88d132630d44191fda5fc9f0f7d505eb86141a297d092234818ffbb830821cccedb12c75dff0bfc3ec1e21aec78eb4973e37ec0fd387e5436daea2fed3135f5a17cd7a6112b0d6c249e7c78c44124309658564a4fee8e52fdb6c0ce2e708ac408f27d80a224575023f236ac46a881fa7896cbd8ea5546265c4cb4d59e42203dde0b2ccdaa05238e5caf551c910e9072f10e9d098bd5e265c8281be205bfe428687bc459f753e4e45e1e5333d591e068fbb2972f791d99df40e8d4325db609034f2cdb1e522e9bfaf52c2ff26e61b9f832825c570b2b7241a861356628f5d56ea3a99dab7996b9bc361300009de1e6372ceef46a21823d985e42a35c67e45719deaebd0e1e4ad538d8688a0f8df923d44bf37310ed9281e643d377e3345395e998d6d8089a226947b7d300a7d7f1e2c3abb8a91e9bcaedb0e40f9ea975205fd51c40780208e98fbf6c616d3fb714a6a2085f8ac82569973e2cd682ec896680d65ed6db7fa625ebf53bbdd711933607da7091dd556d4bedf71fcbbf3c7d89cdc28a5a0236945d004f2c97c2862fed5a6dba6a8bd05cb68aae72fd6ca25c296e0e851e5c5027664fa5a0369b89bf2127753cbbec672d7a9043355d22d0e9ac929bd27d43eafa5bbf730e3869395620c14ba500e71ab0e0612ef30de7b4cfcfa4b2779f3db83ffee84fd8e12ff"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 486; + dataLen = 4096; + combinedKey = "0508ac7b6b68fac12ce71b581519b61b377b4348096df0df876037adb77bd18e"; + iv = "292910480c1708f487b93d8171a930a1"; + cipherText = "d5a072fa6857ea7615cf678b722be7c6360e70e5c546ccdcccc5f5c1961efdf5c4bbfddfa67288c4348aa446882f3bdc121015ea4b02abbaa1894bc0342d53f8cdea86c3b2248e4dea5f5c7ac5ea320c1e4737369781fe49c9d710dccaab2dff07fdaa3f309fa28bac945bd7fd19eab1ce0e36ab1723b0757f8ec306e608dd4d1d5570eabb358fb2c993c0a40919524a420cd167cdd50d203d6e51a419885331d4306ca5c1301dc5426441221474b477b261132a75a5c559544693458e8d13516bc2f4c7515cd9a6e319ac677057a3a68bfaee1203e1118ec321b3761695e6f25debd324b9f13476c1f3182e17698f7dbe46a99c5e7bd411176355072ad423538c8448166d047b4d3ff8de3380ada8be88289949c530cccecfdc4f1d1ce114dd679dfd62e4efe1fa62ea82302ebac63750af284115ebd20843f3dfe4b388fb99d61e32d692461401b521f056c376e54f0c5f3e0d4aa752340438e6047814da9578eea486ef656509b16cfdfc30222c9d343c68763be72b463da4fbd0eb2c4afd73ace50017aecb086de18d28c7a358d4846f6a007d4b4abfda3b013ed7706781487a8c16e4b8e1d8f4df1ca0ab105686c12db624e87ee5d37f7f71cb05601571dd6457df4cdd4388769c19c1adaf3d5b8fe23be1ec7658a4d4602a3cfe7714b71853170433aac007f434cf84abbaea312309486787671a0c11ac7d18284749c6"; + plainText = "d489b08b54acc9a06b708757f07fa490ec72f7273e0f04f8b6258dbeaf38a9082b5b53aaa2b21d18bf102bc860133fa85d290f014c53b9269095c690edf438dc45d952d3220ad71102f08d47ffa9604b4ff334f95a44b2cfbc63a582614ab7d9bc524cf064d251809f59ea2c623cd699b96015c1bf31abe3b7d93e38507f7e62841bfe1f0ba222db3eaa660c44ade3f1f6f6e401d672a80e4d7a3dbf430ca97a30c40d379e83fa190d0539b0a785d83d2cd2f47cff6cdbcc2ee9ea5dd8ba80ad33d045c198775cbe9a8bb584911f92980238d1cd9be71978d615d0dc26771792b5c093b8967f898fcbbed1f81050f64c52c739fc2e4f2d299f14772f20a52bc474c80c245683420743a40488be09bb5bf6986fc271e892c19fb11fdcb8a09a5439777869aa412fae612b5c1f4c259e21937c27248fd6c08aee83cafc5e1337d3eac950ebdc732f31df9dd37274fa6ac6ea3d4102e18c74e5ebfa8c314b7dfbce78b9194e479555069d6561de5a9750d6928caa8b02c82da91b2ad599d0fcf3419b8cebfa9ebfc38e46712b4206d3fb2def2aa16d198d9b410f3bdd396a6e5c9e11a3ebfbe44856331cda8ea70eea09f5a7bb28141887672b18bd76b78ebda2c4750b7d7e431a596a583b8f9cec29ae4de13863e1963bd2e78ab2d0d7ed4e00696466fa45c1bfa9c2d67706949c0ba29b23a66c621582d2959b9f4921d3053478"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 487; + dataLen = 4096; + combinedKey = "8098ee94be761a6366dc142135af57de6daa672ab7444b1bb89715387c4c9c9c"; + iv = "e9f79eefb6783fd6990051d21719a0ec"; + cipherText = "a0090a7c79a07e83fcebcb6db1cbdae0d9751d4aec45c97f5a2e4875a8612c1b93c8eac9b3ddf82cc6f035315c6175621a287d42800371b1169069de2ecab80d86f412d9ef0da4a08205a85ee1a6b46091a73618d800bf15f119c4c284943c245572c0500b07e0a6a81ab6b5e1b27189cc9938b48ad2be4359fafddd71d5965d493b0a0308d973952917f9a69741d4928c180d9f64952a4d89c80566d6ec7b68c2fa1202f17726db18f93245cbe4bc4faff81c6e3197a78b8cdb6cf62b7baae724d7842db7a0ea52fbe53a60e49e23904f1071efa6301fefa8676a9c003581b370c724455fc8c2326f149b5abc94f7519e80deabfce3eb09fb0dc3a72050a4c43fd83260914ea75d763e782fe47e797534d736c582d68f0c779f4658b39b95598efc5983da2c00f4307d89576b48157076a58926da78090c19cb3f71027b6d819fe0e4bd1ccda1f045228ba2ebabc158ec55f424ff3a148f6ec2cbca3cad19e25d0cf7f4d0c67d187c66c8906718c5f08fa8b25cda1d27ded45cea50ab0a79ec66bb423c419b4399fb589812fe85e6b711443b1a505cc6a822448077448e4af49dcb270f6e6d4ee3d71f4e4986f606a92eb6294be2bc637909d17e4b0edd078d9ef479b2a610c69365345f28efb12054a0ae0f4424cdadd4df65201239be6249ae0c6f2f15e310c9f2decf36c9048fe45dad0f2f269f0fb066e4a71efe4bdf28"; + plainText = "affde635e843d673326da80912c88b6b2dd9ae7e1d2a75828fa9e801deab13bb87fe0832aedd872db000c494ff94fae0100c2141d91a03755b7c3f381258aae187dae25ecf5dddfbdd9fd31ecb47ce15ecb96f2deee03924481fb32bc75a0addd18a6f5a845cc0196988602867fc963d29adf384da3a3b48e2689f89b993d072f52930d2df2270adf37ec0a6a21094c34f30def0c41ceffda5cfdf3a5eb5f01fbcf819018fa6e9a75ed6c9e94ca93f25a8e1557a39452baa9e6d80a346070871586e73ae75eca8d9db86cc96d0e77277d388269c167df91eee75c80d08e066ba767cd98b369a6567633a206402d32cac42a9ef8b0c87183be6f9b459e981bb81cc9142669fe53bc857a727d58f448888525f7fd553a0586294ca1db89aa27a5d10a0991b17e276c5954f401635f6733a63dd570893885080b86dd0ad568e660e58a9b6438d7e9756934aba6b26b1a9dcb68ca88465f7ff4db51d027c28b9fd10310e5c8d16689839b8929d13b5d0aeacb673b9e5fb3b3a50c85f0b56f8cc3f01d68f2c9ec9aef97cf408ffa657feb3cfbdb3d871116cb3ce11de37c0f64433a9bca726f1423a42b3be201f7e4a5a9a7db376540d09f8b621ef338f06be35b8b8e65f7922c889424094ac28a245a6e5d7155c3c1d2a9d2b93d1b9c51d3bc3a933c125f6b61e7ceca61801b532f5b2155f246d26819dc050a235ace9e37b6bb11d"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 488; + dataLen = 4096; + combinedKey = "594958dc5ca1f46c873fe253cd8af04cf77ffae50c9409ededa4249c42f172a1"; + iv = "524f4d4d9986780c4058e851de45340f"; + cipherText = "0e6a6915c30258eec6e9afe94ba020ef7459debb2d79b88430e92074dd63e9607e81218deb2b2863047f1b1802afc776e55d4956f98199e9e07fa53be27744398b684416b7bdc7e90b1d9a2799e79d30c1800539544a87321a2811d005a7fa6026e523d6ce5104e337d79fa4abcb7b7e7ba53d78e2e153bc4bb6116b6059eba1997aa72c6bf426762cdffb3c8a96ec92dabf092d6397998a085b6a89ca7bcb363ee00d3385cbaca814501c0dd997536af09a299be55e21ca1284863d5d0e93161a58576b535f9c7b0ce4022bb7a7bc0b2dd330ed00a46bce0c9a2010d7fcf94bead96372b386f4b45e27ad270f7e2e58d86a08137439c58858c65c4517232c6b56533bdc7751d8b5d068fe5d7671f508f415f8b6c593620c5a56dbcb153aef693b90ac90f4686652c0dc7f1d852c681430186fa12080fa42d456ec4542f254a53b0f3b7a2147ec591f8be9d0b9fa424516e4721c62e7d83835cbe8d5b27c5fda55998b0be1f99084d759f3dfa86534b7a302a70c3879ff937f5f9111dad790d0d069827ff96696cce7c3a75cae37f120830a6ab03877b0ec0f597fc8cf28df7b76445e9d330d1bc7148cac488d9e9e264adfdeb77c8041796faecc630b268da91f16aee33c9f216db1aa4717dfd7ab38194f4872a2d2b6bcbefaef43f791594f91671a8ff92377edb1d4c0d65b181b399daf98263334b35d22e9a7d78219b36d"; + plainText = "5be06f7f89f901bdffa56ed223caa6f585b0ace5d4e65a6eb59b083d785f9a5cf85ff0a8bdab25cf12f65cdf58f8e7e710fbcebad6c94174746b5b103a7ae32a98e71e7f9369719aeb9ac971695306afac8b0596dad678ea3e2c291345272ec7f70d4f91ea630b8a8cd5bbb4cd1e186d0ed86fd93ee6c247f866ad5906684fd9574694c7773e417cb7f433e07bafee988494e610ab3537272e620e573600119b2db60d472d4805ea156d5f4008f02c79a3fca71ab5cfff8444d514a203ba716c77bdddbca62de803c110bb3a44a335ae804284c93511169141ff1514919a6fd2d4768588aadedd5dd0961603123c64a8bbccff9107b668add5b18ab39ae93d3678a8e10075ef93c7d3c965d1192d73bb1a449d4d39d91e127b776bf7139c15b6b64d81932ac0c57ebd16503a9c371d1027dad47e318c5d12f48672411fefb193cf50467de377f1bdc036eb4dc3029a28edfe71c000f178004f046df7b936398350ce52e8418b0ece3dd687078199a4920a3e84f7f5dd1dfb94e3b8b3fa3f5eee076fd277c7f8735e7f223f608c507b07d9b55ed2603cea878abcc9d7e656d88491eb17ef995980c7394c0df8e410c2fa3a91c9874fe873f77e7c852113755a613f6775bb7d573743fafbbda09625616d1b86d6a3c1b999b23336248a10de13b4546c5ef6593dd076a5e83524392d7eef86b24128e857dd206dae92d36646f094"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 489; + dataLen = 4096; + combinedKey = "c1e8b9d6aed40b74b5ff3fdec13999dec218459feb70343c7e8ed1283d2fc5c0"; + iv = "c2ae363e12534351c0a0cc8042e3c8d2"; + cipherText = "162d1143d79b8fde90eb85bd4bfe8442f3549b2f71b220c31e1432722490b82293f1fdfd30bccdf6ddde5a0c60e136343659da6b5ad04353775afbaba4f49354921675ce350e29f40a70eaca15f830a90d83983680143a0696514f667842abce28b4d706118644be0f7d8f2fb6deb4cd2fafcc350a2eeb8582107900887abc5975f2f12fa6297311ce6bb08f0acac3944af355197aadebe75aa6eae8cc25d2aa1e54520e1416ce09d5b2097d5051ac198e307b7a2d4aa47d8be9b37f659ed8eda297cbadd8180cca1c0622880544301c5fe898b5263564d7ce47f2c5eda28e9c7715c155111dd46855897c9a60e15500e905eab1d4149e912d59ef19cf13d211053245e60b8f97c613bdfc4f9a096523a4f48e4e4e81c5c77518fa4c3a4d16dd268750e623c8127b0f8576dbac53030010d1d264bf634fae38a2283235b664e1a2079f000c56463eb67f54fc6001838a82743d575b45cbe97f861c6176fff19b245d45297407bfa2e0b0219a1e2d1360b2452891415882f3374b27562d47261d6c7083007d5b55a14d8aa487d0290ee0b18d1032f70b03ccb41d0446fa24941821031e6ec068322e6dc1fe12419d4c046b9f5b1cdd57db999e820bc40096d27c01a01af0fe7f26043993570c8c295c0d6265270e018118d9036f679ebd9cf41b2c8248c70d0bededc609852158da1b550cbc6143cc2f43c11b23a017278782cf"; + plainText = "33e412b6f92cd34641d8f0427abd17f1163c60b9bd1d41ef512e3ad7f5891f8385e5ae411c35c1f3a8e8978fad841a5e3875b06e567b74c27e5b528dfbae6b9be5627729b350d7747c9b78ab59912c9d0e49189521b5e9ad5a74fd0510a976627ce578f5754b04ff5fc9d7833e795aeae6e3908cfdba4b17c300325d23496427673bf0a96d48615d9bb4fbbc167f857a36decaefe0060b5bb7aa3ba28a0802f24f11b73c493db64108d493856d0650e3b114921d23eb54d731aef6788cebe9f798d8ff191f27ee32fe398a9ff04d6882301a1287828957f300c406a04ba74f1bb8573624cc6a6c8112d8718bb7f7e1340950e44502dc77f2f98bcedfc3655b507bfb33b68511310c1601acb9a8aaa33812ac04eb9a9fa72b9c2391d6daafda835768f8480dd2216e38064f2a7fa27fcad96bbb817efcc8b4363615145bbc08f3ea0b2f18d6a7a43d586967e599b1e7263106635cfe5f1b2bd4f6e09a588046105efb8a16cb7d94de9a4e6310fa4664458adcc523d632688b8b200eec23509c1e8c21fa28f245c8ad0b6dbfee671682fdbfc33571a3eed1ffa8d00aeab22c8b0bb240b4f9a9e300249e1518a450119643f4a0e452d6a8df6da320020bb5916a8ccc92023c19f0036440d56fc7a4382b6caaafdad8a73add90b19bf11ad3540e707e7480028ff5c41fc7412b8256364a4b3c69c9376e2470c0bd8638037964bd9f"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 490; + dataLen = 4096; + combinedKey = "43feb5319da39d9b777d35797e5859133318cf92d4e08377512b8781560a05f3"; + iv = "2fca74ad7ff0741c26c5505bd75f2708"; + cipherText = "5dbc7747699bc0abe914c0f4065483ca2842c175227257dc82ae25804103562e0bb05a8d4344f6129181f600373cdf0a755aab02825ab6a95ff9ef7f38b985ced3e3bb802d00a63c006270bf12fb7b4e30b6a0df7e89441fe11ae760d346c326cc00d668c0d2e36a6803bf53b5b348af5267601490cfbbd1e7d7610501ff560d0c0b1fd5bc5c34e09ff6dfe9573000318530f5c382eaff6ddf331261cc519048e6404d83ee52c459bf68597221028479965270e5b2e884d834f4152fb298104b17e599e71896fb3ae273ac7327e82bb5975c1a918dc8297c9c3e96ae709b237005b80f8cbb8365759509516012dffead2d2157690e670053d00e70865801cee853509b2029422ab74b4c4065caeb8b5e86e2ae9dedf4f0398d467266ab3fec64170764bcee1b38260ac74fd689c18d784ce38d0e510347c3fbf83c212500eb28f1423ec1b4464091cded8c2ef89ca2752a905985581c88cc93892ce4d498b81ddfcba1ddc2594811af3199f3c6229c6753148c8828fd2b0e7e298f17dbee0e3f0cf93376b89377cc282b5d8224706b0e2c9f00edda831398033f1296f044f4247c225915644dfbf57f05748720140de72c36fe775eff6779f10bee2217eff9629f3a07c39610344decfbb36b885fe9ab44b0002d8bbc57c4d8fb04675dcbde2892ef2e139d67bf36f64d5e609ff6be36d80e4910eb5e9b7ce355f36a9a5aa5a5"; + plainText = "bca86f67ef2b9238c927956abd0880df8e6322a58f7deab7979169c8aaad1b41422e6ca744eea8a27da3e5579297fc0ffdae5d79d0ee8cdbf0ed976c03db46403389b73e56d8ecca1b6b038a67ac78a87ef00419d3d5b29b8890e11e8c92b1e454445cd30c326fb986c5abe73e8451b971acbb8d7144b00ed3e0dfcea5a17448a3dafa4347a33da422d6042be9dd28903ddd1eb2c741c06330900bad1d22fffbaf1e24a186f1098845f9226a39e93c8746d816e7fa432583fa07bea6522256cebae4968b8c825c635e4732fc4d0a89de2f37f4e8a6c0c80b6e8d316845442f61cda5375d886ac63bd1b60d0211b251370ba4fb774b816d07bd66f7a43e811f581d91db0da74b4d45d683af50a2fde17000a6f620ec63ef319daa6862d8da4a97b7cfd78d3384322d07cb087bb9f0e83231b9cba98e9097c5258b9374dd9b3c3fce3ccc8d1dca6ba0ce94ca577968d8944f17c94fe60ee814eb509e332b18d124458ad690bd8886463f16af4115d9d5c024da92879fcb35706fe729008ed67abb84008a93b708049efeeb7e157ff5dc53061f62740d5ac343ac5e6fadf5fc446d3308ddd0ee4c2735e4e607f41d545780be8bbddbcbf0cfdfdf0a2b18499be08d446515e67ab8115e536e9bf4d8944780c193c46c1fccf0e108a54fb539d61aaa672afed9087a8548f2c846426a2cd489cea8487cc4810b40c191e419b62b649b"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 491; + dataLen = 4096; + combinedKey = "7ef144de40295060488c348f224d6118d0dd08dc7679cd95b2aa88a4d763f9cd"; + iv = "a4a564eb6d1079742288c7336d422749"; + cipherText = "9702b144179fbc5d740a07be50e933c45d23b640b6b4404898fb5b59cae0655f1b6758428df96c70caba03b8daafa4202533ba4181191f1fc7181a621bb7a78fa5d565ff49116b1189809edb781e68cdd3f30aa5703bdaceb07162bada2bd5f52b40164ec6d89839900054220d80432d7dfae3aba24318af1d2d047712245ece6220173406077ec1ba0181d32fce588f45c6b6de211360b419e52849a7a464010bd5ff77296768d19a75588338950d7648914e1b037afc9c869ba13826b8d72be240f5f0bd608ebd599e03647607576537e74d6e4fa633c72a84d63b657d309de8c2e4afa53fa919bf89cc1af1b247e47f03c2a2615ac792e9ac359b6e13e03b4c25d3c5e0428ae6870d5d04115f868905c818242ad46e3e18220d3991e18608ed3bdf1881c1d83d35a9528d0db0a795ea67addcf346c0e12c1dd63a6528d40d05c6b7c0a6223950dcbde00cea9c7da8b3d3b3e795fa30da61be6aee72fc01a4c3b1266967e0214f372f3a64d45d8e1fabf127723e037f86897d95fc564a972de78a77d3953a9b23d02bfdebfc3c5a668001f1f0f48db4430482d1822811d6b9d7f1b7bb538cc791bac7415729631e30af675aa4609d1e96966b19a2cff30da259f835e71129c2e24f04f74d9e0b56c2de139e64a5af97a6b147e5df05eb774d2b3a52fb57119084b52e535d489cfabf3de55e0740d635f2f86566a3aab081af"; + plainText = "b53b93601aceea44f8bde7e18beb46a69fa7283c0d01ec95da344caf07547d0e84da2a02de876bb1e0100ef5954192a7768c8455cbe5408081c327c17f52a56582aa89bf14d08062828366176790e32486c92910eb82bf0aab9e5e308a575466ef4e1c51bfc7c6f0665a16738c8d97e425fc611a0c42160cde56f9af0eaa05cbcfc785200efa6cdabd2c58cb5d85bb05ace736586f3e7f1517a094e3aef137afebdff87b4dd3d341b3f83f6cd2da89001a913faca1b5f8c356d032b4316baabafcd6a03a3dff25179a16d5ae1d97c27279dac0df5213dc922e4ba014e9c54c6ee3a73529d73757ecb87953aed0db66b218f7bb9f8418e46320d19a05e62ccaa8ca6ec3abba392f43dfc739d0c7190f8aecab81015dceee65a7d2ae1dc15cacbab6392b159ea60079bf246f6bbc06df6108dd48b49841dbf5cb5f5d523bad08f6d26668348fab2d66d42891a76027d0a839e1b664b7a2952fdf9a4c5db8deff1b942115350adfb8bc0165b5edf8408cdf06c5998a0244169efb2fe44b3ebf8b6ed5a330e6695375ce7b453b589285b8fab45914214dc5473cb276e9a38d79a5997794355f4aa595b2f69b6d4636a00762af3a6e108abd0e9ca514bdc3a540290019aef97aaa1b1256182399caa24213edf6e89f775c2164e28c3283bda7e55e26b0c19d6be24d3278b7fe217bca8e74777a32c71c560b9d9b59b0363065e74d51"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 492; + dataLen = 4096; + combinedKey = "0e185134cba33a283a99a21d5b730649fda62ef8922dd302f953c5b7276d03cd"; + iv = "ab4f726c86bf3c084f1c8b8530703f26"; + cipherText = "d9da8c30ab7ad2a0b02775659f7ccff57f095fb0867bfb495b0c16d3bd1e3c6c2004c09931d0094bf54dbbe655f154d7f1d7c4aaaaae69d3c0c8ccac3a47ec1eae3fd6ba306a35f9dfefbe82cd013efada7c37f08603f5885bbb704696820a24e7fee698ad076f5a0e7f5d6f0aa78f54cdeca31dfd8a88deaa4fb58c3629ef28685fc54c90a404ba915e8d6be589fe0bca4606ccfdc0918bf60ea6665cd4cf994fe3d636463f918fe586dc18ee28ff92ea11f860ee2617cd4cb1b8c3dca8d42978e50c37c959248cf7c114c8ed586034b24ddec753620e84d3116a73a255e8a85fc1d71cfdaa7234ca6438d373c47df07aaa0cf9afdc5e4addb8d0557591c87f65bef469ff738f23283d540161379e3c9ee69d10810f0d71f766bc5651e4280c2197f62cc43300d46ebddcb1c1373b80d4ff8313d5052311d3e6422df60518bcc4801ecd9037aac028a6ba005358c9638f61de6df7aa78df4d55059f4dde32a60ad21293768dabb3d6acddfbd27b7c0761035c6e5ab8a3629a825c8175de21ff100610970a6f060c873d6a6d9e61031fa137450cd427e3670349572f65823b2ee5c026e3a9bd06f16db5f845535083ba9f195825d499fa04182eee0b7481353f4a3ed5737a54f1405ed82406419432ef945595bf63e2663d92420bb5f0ac4e02c02c2d725c89236638bf586dadc89106dfcfa50ff1bb18f3b37ccaf38aa6b3a2"; + plainText = "5421fd6a9b3b22c63013f7cd4ec7534ed979ccebfa393b71bae68b09c6f16a1c49f605be32c1b3b7785008bf69c7f27d284ef99344ca50e2105a1c72fbae0ca240946fdf693f1fe8fdff372a6a1510b65f65dc07696f587472b8e6b3d40e12b37bca4e8437619efc690d6d71dc4b3e4252a1bb5a10c68d36c31e36870b4b46a46be7afd80249c60751c42e734a4fb3b632ea21c8405fe71d09a1d49ea5d4d992d8854bc0ea4e860fb9939929d6c17d6e8fa9ffc1c6696a3ec91b29761be37e3ca3c80bd7ad2bfee425544186533a45f310f764962815590fc5b24ae35b0ad041c3e67d1248b1cc7daad861540059db2e16d5b913d31f2f47e26fc6c2b4d00fda551c448b345a503fc8c316215cb35882c52fa8a4fffe213617632eea8e9fcfe3404d75ae9fe30ad0cf0b61bc92bec04c1f592d4c0db83e4e87d96b73c6ce823dec3270e097d92b65f10e1302d1ab3688b666d5579dd1059d459c241a232becb8e41d4247c81e30c4d4f2dad28de0bee9bb62a5ad72a06c42e95efb8db5a6243c5e9eb2b5a747e24126f935da36d0d7d0428befc8b2869b6351d269014a6b8970b116ecb25c8f39ea606d9014c5812eb943e85eadc0ed5407e9ac483360b02ba54e4a4e815544eb8846ad7f42ddd277ceafb2b0857a3aceb45fbde7d9b0bb08b8e50d515102908b326d8a2367765d2c8dbacd806eb8d2004c3a1fec51e26ac2b2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 493; + dataLen = 4096; + combinedKey = "542cf1c7c6f4a1f2c06e3b04d66010e2c86be1e729d968d2d0f2e1a66a795a93"; + iv = "7cacdee720695232a27bd6150ac95ee6"; + cipherText = "df00fc2c79db45e92f6abe619ea5d29ebb5f3f637e1356d4dc1425cdd57c2c29deb21790f2c3cb5487629599c191a2550a6f0bf3d82347ea7d882862a3cf07ae61a98baa796821aa6db8093a87099e1cfc283ab381b25057f35cf67abcd95e170bf106999c5660beff08dd1bdbc8249801f0b0bb66b6bd355a9671eb53817c2af3d273427cefb79b044bf404151c0f5efb1b75e9ebc7fa1d1fca3dddd7aa3f19a078f221d5f8013e878899cf27b4c3d5972ae50df94215cf53085ea675ab11120df96dc71252a64e6257d31518043ef738afc95756d124a61d768fff6c2b523dce254569eee73a67aa7a2fe8605e3f6dc52f53914f4667d23c095dad733a835e68949a20743fa3e2d3c2adbbb06ae0e941e28de358560b1de21b3e0453771f767289dd1b6842766de2604829e1171c9953ff1858f668e3d55fb86d76c6bdcd6d37c483968322a015646f8df1871826d4d20a20bf6572c9eebad63baa1e8079fcc55abd2469f46a969565ca0c85c0881103355b4425557e25ee6e32612fda8352c1ce8eb87df95b86b3e82e1e15a0d2b5c36bd532b4d07bc5075f45aa7e06a50fe285e2a544b3648cec088b29a7f1e8b026ec7de82e79d93926d1187e1dd19ebadfa4c0464739dd395159bdcbc13017a70e732f394831ee0b7f2ed0e5cce318e2c941be8f29a6b50b418dddef592482048e8274785eb54c97f158ca26b7bedae6"; + plainText = "173ae7eb10a6278464639727d2a4cbdc86c088766a80db20eb20b793fca63c5de2d2d2c08697f4abb0762463ebe6d16bbf8ba7f2549bd50f921d7ef43d140afb86c6abc69162b75a7de7b3b081142fa093fd6406f75bda4bc83e6bc43f34a8a375c240fc63a7cc7ffcb8e7ed9288f306376a2a2a44edf4ab26821698b22eb4984b165eef836680fa3131154a4a119ffc9e0517462dfbe8553c4fff0be70a1674845ce3bf2e4b0e6ef560b899c225b1204a8bdc7201ac8e5e352630adb051b35c31c390f14d53d28013d65bb3359aef834a69ab0f2c446298d54f18e9689d5e18d0148a9ebe55158b45ba00b47427ca024579929577638cc3f46340f2b5e9edc4dbe4e4567add6f965a9d049049f62f90d7617107418d568db32ed1827e92aa08afa2748ca4f741de5346542cbe183098d9585f4cb3cb9afada6076dd29b5d5e5dc4b8e39629d6bd044fb919e88fd195d901983fd6626a4e54f31eed2cbf02b29e4751b99c42b01026182c2a4c3860bae566e844b9711ff8dacefc93f7ba810524469817e4b3926eb7df1a674caf0488094b863e59a0a8d2ca3f592e9f101ce0c05b9d6a45b9532801713730ddbf734d3dda8b75d896b13a2ce8861c1865a0607498a1d6fc658ea70494ebaf1917070edce1c7780d67f4d45684eaa5dad1d38478b22810a58e6b4a3e837037d754c158d145ff59cd5718fbf88c0453dc629c248"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 494; + dataLen = 4096; + combinedKey = "7a649d76930a91198fcb363dcce69a14522a861ce6b1d99c4aebd607ad63afe9"; + iv = "cbd0ca180dc0b8c704621a98db7d59c1"; + cipherText = "86c7265f461aa8086633c19528c1ee11c8a7011720da637e6e74bce4a34ad19778f660f68519aaaceab36e93cd7e7995d92f77d5d8f7bf058bf3f1e8bc68b8f7b0edba11598e5012da0c7404fd201c1c28ad5362ceaca08fdd68ad95f657760da8fc89da4e926be21dc8139a07378c7b7ba19640361978cfa51ad22cc9444266dd775c5e2ebefab7aa07d0608c96e5f257aff762a06f264a5b6b1cd68546144847c87acf6d72ad0258688956b2335e735fb521d27c33ab954dc858607bc7ac5c9e61c837906c081dfbda6b0153f7beb0746532871ad70d28507d12d22c937ffd17ea8966a565e6e35a59d094b246f7eb7a68ab37b1347f960ef12a4e5e0252d623b4bb486405c71f22b9681cdae84e50b28110a072d0ed9178d5552dfa82096bec6ab4685122bed356ec1a90641a6066ab4ebed86755ca7172fd53772e440c6f5654817882fc757f2c468f1a1d1f4c268b01e95ef1f7aae9b61abb497c182db72a1685dfca8f84e4609d5d58da60fed1c06c86a6a3fbf45268562d343352d08bad43b9897f432e133c4c07b8ca726049f82e4a914f8318e239bc3260cf04f29a93141f1fec92c1dc96af19a1b249c9a4c41e00d7b3ef1ac3331da3fd5fee47b4492c51ea027760173a52606cfafd5ae54eb64f8b3439a9d7aeab5a35fbbfa5836efd95a09468ec4542a411a43cedd2eb4af3b5e2e019a6b5979373ea6ae1358c"; + plainText = "758bb64af4cf4d966e3cc318172250c3b8cbaf1acfca7fee81fcc021888ba10466c5524466224cf838d91d30f48cdf417a8060b0ec6eaf59e031141c4bc8e7c251721a38509d8b427eff43ef7096badbb079e928d33c850540cd76c3017e1e72a793a630064c6695f89e6a44f85e14be4e01bbcaca5d7845c840b3b9e23cc192567c20a2d4c79c6da750a77f71d404dfc9fdba34b10b18801c06e432e2d78708ca9c19a148e0cbf930d1aa5ad479dcc67835bb40b564d583766a0eb09ff3b0370d2e1e1ce47c1f05cfc8bd8e0a8f77bd798c8cffbaaf79a9039b0cf0b9e03c580b3ed2c7a3a107a204e9a26db55fdc1e48228f5b22dd625c80f2a74bb7fb70342984c567b859fb8d33f4a995aefafd0644f96df6edbe6e8d9918cdd80862995877107dbc3e9f25c801efa1bf22c0688c2627b8c376176dd72198edc521eef3f9d65313ff50ac652bd798718d1d5d8e158f12811e462a23e3839a74776b075077fc9ece15df0c5728401100bb4f88c5030fdc558cc1220cb7ed43d38df06853fe390eaaae1d71643241835000a79ca80b387165e793e3eede10ae382dff5874660141aee239768feb1e4ecceada8b125d5ffd793e14704a303d738e1211de0ff5abe921c31f9cb51beaa651d8beda99733f7ab49a48a31af8158eaf9f3625c60b1eb0fd0ff653bf0bc5954fdcf76e44fd9aa15fae1ad080769e690b84d9701c78"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 495; + dataLen = 4096; + combinedKey = "33fab98e7dccfa592bba1c205dfda1392c17d33381878ea6c06bbfc675c4ca5d"; + iv = "91599b660246095bcba482ab527e0a59"; + cipherText = "e6aee2ff318e668567cd003d5173ac6fa633b04e70790864c9d2316b9b8443b85c8a416cdc1ac910530b1a08280a1dbf5c0eb84f50e8ccc036d0c33c489e241039b64b8242dd2ed0ec0ad38e59c6118cb97d05da83ca9f7ca48e055105a7e441c7e68a6108988497f334bb13458dea5e50cc4492ac51b79c9b449d1df230d481fe50b3553aea643200d304104ab76b314f8ab85b9fe031aa011ab6483f3139f8186f297e4962ce502d73d0286b8af7daa4795662e8a17584838d3cf7bd71caa8a5c06be958c8fc5356d7a2597c3828ea7807be3b735781f1ed2ee3e0fe268af5e79e93e507f25567a597a53ac15282e6941e8725109030ca3cba0bbb6ed125dc019c3d9f5a44e5dc6c244f053db958695a8140d2d0c3052d1905e5c675bacaaee1a60ba3e01899a7410e203050daec9319a14e5cd9311ccff8d79619d38d52e3a20150490156a18cf90b09aa64c763aaefeee52a62b484a7add07c53d316266d92d38f77d3ac5a374cb74f64e25595b678144f2aa3a9eaee845ddfc32a9df1b0d3a03301d7837299d6374f40d78b5f796b969c7bad3d84d153680b8dfbfe946cb441f33bb10aaec93866dcd858192c654c9e0cba397619779b048dd8808918d0c3ab33fa60e1d0bf8564364ef98fcefb32522ebb74c011eb8079be165126294a405198307f9d56b798ef677ede7c6d5405b496462cfc8f8b104159364af0edae"; + plainText = "c6f179fcc3961c1e423cf253e1f85676754ea98d026f6c84babf1baf2d76ef11ca7fcc42d7b5c16335af5c99b8cdfdd80db5354bddf1f2db03e8c95fdce20c773f740045d61b0afe2eabb7186ebd8846da2ce75d10a32909a3f38309bf29b9bb691fc8ecde0f433828e728feefddc1e7ba56a2f10d558af20348ec7a35dc9ff1b4eeadf89214a8dc1c14b71f21538fcd6b80c457d81fb09fc94e161dac2fe9b4f49a97659a63c9ad0a9b0ec0a3c3949a007d932e8fd490478bbffafe00ddc49a61dd178fb49322322544bc2dc0029496498f2d559ae4233a6425a36a4cd0b86ece3e4fd054a6cbcdff8ca66a020bdf3791ac67052f71234a7748d053e1e3918f5b2eaab88c08ef1fa9fabddfca9e7246a583585f5e41c1fd4539f46fc4656aaf44c671a1859d909cd8aa4da11107b855c0ca3ee49e3d3cc4595bde6ffb0ea6bd4e24b2368ba0a10f1ebbdee9323f0187dcd5254e674d46065c22c84e149cef8e72044a56389ee478701b1540cf116dabd8d2b110d941de983a02d019abafd5d6fceaac8e226f7ca8a1c823c6fb05b8398a42573f7b7c166b54ff47ac5308c7d23d79ef5534e6b748c9dc786f4b1834fc2a50976438cda619c03a14174dfd703775425cb8be45d1b6c7e5315e0b3ab128e80ad76ce3fce5ff41b369da638a21480fc71673bc40d098ed93a8a3150d7b249755740f3d27207e67976f7086764919"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 496; + dataLen = 4096; + combinedKey = "6899ec5a821a682067166d2331e7524c58a502105673b3e2372090f9e4db7a2e"; + iv = "31466925ad4956dd1ffcab9f1bc05096"; + cipherText = "d96f20c1a04f7b586f6471489405ecd923e6bd28ab3504626738afd3e8f6c66fbe5c396be92df50528f4e59c752a8d94fd3370bcfa9118ffc6d50aa8f98276ab41601aeee0edaeee3e2a075ffe979d30379a1836d85f0e7f69c73b289605f2499e37d70156d1e13a56062ff61249dad9c4a0dbbfbe00c2a062d506455bbd9638f94002ec2da1c2f42b79d8dfcccc34d8f1c6ce05f44012a8642fa12a751b7a163c781d73687d6715f05001ce002660059cdfbb3785756a79037d2e51dd4426774fa520426b08260466342495cdd35c89aefb55d24c3d9e8cdd1877ca4f763b3dda6ed0780b05bf2b1cb38db04c79d1c8028ec6f170bdd5d36aee5e127c666ce6cf5765669555a1b31e7d4781afe81ae7a61df57ea3ff52cf8c9a4aea7a6f48bec82d0f746efc35c169ba8e61590cb4c6c21e0901e8a211832de25db4e13c73fcd8be3303c99f5d0ba048a626ef2e84c3b093b5b8df986acaaa684571818b6a130d2b0f6b5afb8badd566654b5998839e9eff99d2e2e0f01f0b84a532cd058f94668a258e7c4c4cbe4adea3a8f0b40b81ed3c7b6a1389bb32f3ce7e91572206e9b96349f35a647fc60894af51a5f2be918524d997f166bb1f24db380c002e93da5e9ea523a1fc73661ea3159fc7351cbdb8745d76d72e2caef454b04d5049cf8202bbdce03f9be2df4544e290a582b702b242b6710366a1502c8857eecc7f608d"; + plainText = "a85f46594e831881d9b2f94ab7413c4953598a4a02aa26b3eba1d0ad4979318c019fee0327526255bbfb94af48cb63ea6ca52cc86b2eddd1f8f9683484229b04eb20bba3dd66a987ae25ea0de3d7f06ed7a37dd3e3e31b0eaf2250e5cd1d1dd5ebdd942f2fb0e43777eff8de0012c794ec4c847f0d3f889085c795e649c69156d0bf0639be452ea5e85d96bff4641382eee0903deb41a79a3f3fa3753331bc25b9cf72a367d913090f914a47c25d1eb3a6b5c78ed32e15684bcf70db8d33570c10ea65d2722b7879bdabcb3cc79806f5a7d18ab8100671104c226352a6e63671040350d1432fc0a4802155ed1dcf2dbdd9c7b2bd2bf7e1b05c9f679c50db434040f5af8e86d7891e722830af1889d51f681b6a7b40d7cfd82aff22888fca148301afdba07939242996a33debc67ffe6e1d6048c5ab71e5c04c84ef24bd6bd8bbf82b75bf2322d3fc286f841b1f1f5fb375cd0697647c6797af86c7b4b553ffd6ca37fff508fc1ef408731137a3c200562ef896f286376fa503f5af54ac28b2cf5c862a284660e4761e01cba34ab5ea40dd5ba0059d41e328148c6b197a032271f22fd0dc00cfaec84da30822d9e67bc548aa3eaa4cf51b83b4c878b5daa23ffa4ef4ffbc0ee458b4a060a2dce2144cebb5e3acd5014494a7d6b770a0c7b2e291d6df52411e3b4bbe5cdbe45da964a283d5457201fcfa83eb3521e4c32e9b61c5"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 497; + dataLen = 4096; + combinedKey = "2b850a053287d5e65a70767fc8ac0a38600cebb8e73cb906a0863a06e0cfc9a4"; + iv = "5c4063ec205c866750e038b66df7893c"; + cipherText = "1ffe6987cda60dfe462bd8a32bc1b64e70122872d3336766bf352d908d933de4239683e05394d144be91e201f27c9f15456b216a2d402f1737e70e8087499e23d6c63ad4d517e510a77374d5aef3f0986bee4826cd80b1759fd0672057d30289d82a6a273b4f5926df1e86b9e783d87f28be9145679fb14b1a096d53aeb59674dbed5b1ddd70c0da6963fbb11e6870f829ea7db5b6e17cc42d17aa34cbca15638b1688ed4a162390a456751c42e5f407940f0f8edf31484b5b147ded7e20b92744e0e61efcf7a73716ce5ca6228784e9d7195b9e698bf5e5c83ffd4100f1a3a9494774946055daaa6c2cd0563978a1f5ea0a3b16e786f91b96ff73ae68a1c92e160864704d759667d201ebd9015661a9323f817c79ffd92c0e7559a4f844637626de7fb0c2848c27a511134a558d5f9260e0e49ab0b230b81dc1deca488dc622d73490e8a0a0c974e101eb6093868eda06ec2174d9c34430348f546e34bf30e05694682791cf4445e448252f914ab0bdd997fd795f60ec8815bb00a59b8f8b7f25955fda656681db671bb07719cf729dd3b554a3706fab22b5386f9290081dc81f39da4786ef1924b77bc00f2674ef25a002e0750857295d79180a01af348daba4dd1e0fa2add89bbdee094f6f8237a84f927c37decbbfcb3602fc68e2b4c5e120b444dd76f71e70c973ce3bd6d3c9c44f93945d3931c60570adad58cced9aac"; + plainText = "bcdeef44d16969138c4fda1224136ce1e019ce8fed0102d4b83dc1998b61a4c80bc2db2914b9ba702150ad081c55529773fc01177cdbe34e70ce67758f90f0b7d39771b1e1e43b50f1706eac4fb6abe35b80211b8eea10d05bbcf23b74c4348eca6e9ba8f4ee214c1e2601489d480cd6cced6db384b8b432df03e810327f9c75d37df3f1b83dbc58cdc19a3864ce52304d36e7da1600342cebf48a618a46828d268e4e72f02ed5050a849643772f9ef765078818d5c4a1fd11898bc4608a39f12408bfa11a9fc20140931418b1f1bab1bce47add171be34b1bf2f2809e48f89a08424bf0896d87bd0524d8304ef6c455936e1cf918dc40a1b6d6e5d8f4f797d0aff1ecd6ff1b165014711988f0680c01e2758c5e4213fe2d2eca54cb454b33bc2eb1f9d8d57bd77167ec4359e99e4401445da8e784097bd19dfb2ccabc82142ce3a7fadd63e6ede8cfca157d9c7463ff774adf4c287925d71f2b38182f06962f3b9cc54341ded43f7aecf4e98d6f2aec6399e9b6392172fd4eb14f19b3a1ced2efd4820b9236a6cf22c0d5cfc6b415ce9448676f8d5ff8b3a51dbd60c64c4c2a5ccc2379d5753e9ffe56aa572b7d8d4196a6fcaa3d5655907519c039f92e2fd0a617702ded16449ba639cea90456abc8aaaad4241e7cf4fce4a1ab189fd8e53fe8476345f4c7bf6ceded09552a9f1ce4b782443caa9ec2d4d5eb44e9d8b4cfb2"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 498; + dataLen = 4096; + combinedKey = "fdfaa13b1e7d6ccc944a6cf296bbe610a238bfca37fd9fa689248d9006d21251"; + iv = "45ea5768788b455720c6a46aa09399ae"; + cipherText = "c06bc279f61f3b45b4dbfdd7fe4ed5e4180ba450288e3173126994b2e7605e59a4dc247a5805975c1c1cb489494c9925c97228d76e78abf5fb706cdff92c53683cb965c8d5733e29073a10b34c8125106bfd8369fdbe901c0f8546e147f0c9ebdcfd1cc00ad097abbb04313d38457b9bdbe607ae79c434344b7a3c342b3cd2966ca5d6332b5e5e159f12bb958b4640be969a9cdb756d24c7d18064643438809cf6864b3c9fecc7d3a3983a6d44d41dd577033bb13740e2dca56527404f8743599ca7cda4f5c57fd4d0ba6d611209ab5acdb4aba71121b97c8f2dd72b286ebb21dd8b685883478bcc01b7f11caaceaa12ffee8c1604280cf1b73457df14eca984e8051d7faaa2569136574a5064ba0c1584963a822155a56915ed10ef1d3787bb7fc6f697bebdc2ddfc9a99d518a66bec2ba28c1ed2608cef45664293b45ec60c3e656020871a5e80ed15f0ce017875989139b0ee0b8f66db7802e90253a3a4ca08ea8b100c8f0f5a355d4ca36d200337adb8fcad60e671be2f3a556667d636f84bc18d366bbf8897d5dc065b1a5134a3284f54777931b99455a7512d57c9a0f942f49f7d7b56126623ff6a575a21f374a7c287cce9d3c524da068a52f45a4ea19ea72b43ee3b4b4129ff012e1111c4477f747be2e731f21f7c4c690513990e59a5a0c4573a51bb7ec28268f36d4ed362a6393b9030b637b10553809f01fcb882"; + plainText = "8a5258bc0e300d26aec1d3bed13f77f1b3c79ab17333e0624459c959f56ef86efffb318b663491067fe4931fe5523ab2372d82d1b0bb4359a24fbb906d91f5d6d5a1bfbcd3ffd0726e2d609701fa7c9ec9795d31d48a09332ad57725a94b1dfc96b46fd49e387217562d0ef59181c46c2eeaf8eed3516c05f53b46951b279abbf657f0ea11145f79247c5893930fb16c4e531ab6ffc327657cfaa34cfd7f888b6088661ffc085a85174d4ab46b5277be9a07e617ea659e55cdd19c35462f88f6a775a2e1ddaa924a37d24d1f510707f88fdb371d08d0149bfec813b46ffba14317e738e14b437c34e6fd87d890d45acd00a5c295c64084edd29d86648e1436197997c50ed63c8b939d551c8781697994097a0c639e65bfecffe5268866d58c8691cdfa9bc802bd4033f21863f165707e8f7c97e9d9cc578264d1079580c25d4cf8c9cd78a6662da22c562d379e4360e7d05ce64bb6a391602a30152814dca5a0b805ea4f304c5b3b41e526cd0efc989f5b8f1d86ea76cef1a60940271062dac697e9fd3b35d364791b85f92090416414d4ee285ae12f7bd51aebde6f4dcc5b2a0cec39ea8f7e369f0cd5dee98f9cd5f0abc829eed816a6c46a4b9d51795b7893a7bbd87237500d03abac8f5257e2b495e789f29d671fcc09ff2d8afc12902a5244da7310b8eeb70643eba55d7db24a394c61e8f8109d83ae01e2cb685702f289"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 499; + dataLen = 4096; + combinedKey = "fd6058bbf1f3caa296afec24bf972da1b627e08547aebaec690f147204d324f1"; + iv = "b0c912bbc0c85646891470f564a8a71d"; + cipherText = "ebae2d62859409989ba0bc3801bf6592869b3e0b5a92d1322dc21a1dfc82cb387cf8c5b4e0b4d3f5b3aba0ccf0107492c6adc1dadd9582d6ac64a038fd5a0b073d47d7302570ad3c9b778770ef84b1a759fbb7f3f4d42f4428f08be012aed235d3104354f75faac53c72f4a1d07962803130d2034dae86c5a0464285fed6153e2ce7b9d198f18f954d9aa9487be1cf9b8191269aadd2f0ec08b16d10b466fff26063ebb7e7762b17a790cd3a16fa840054b6197f30295892e742d05f0fb326056f91c78a045f79d59257190248e81dd4d2d47c658f63782b3f90666555d03af36b3a25b921e63388e097355651c3b88de750351dfc10ee1c05ec75614d186625b59888155645781b962bf14a2e53d5a77efad71dec328bc99a8d330129d354d2ceb9e781975f69cc6476df9e2e8b150910e07f03a289f63c813707d277d167795624c98a80b68f6bff6144e946cff384df2b7797750448c7d4bc108a3eafc6101cfbb97f69cc8026d16744a073f47c8c441de0411065b462ec59619afe502b8e17e74876b706958035a3fd1a862d7c0827274dd9ade6962df211678a6cee34fd403431626b4eca05adf5865af005cdba5b2250b71933a2d8d67d8488dd014fb1825cbc8648fddffe512588fbcf7186c8acae8ecc0cfdcaae5d84dbb9fb749477ae4a52445b01971742cff6112f2ebb37ae6cbc082333b3e57c7a30c4c080491f"; + plainText = "a59436eb03f8e2d4a17f8a3020676fd6452827875fb1e0977ace07609d07d2d1eebfcc7bbc5e9544ea50d9ab2e804e78e1f4d1eb91027c2d3ed6e2964b5e142551c65e4d67f428dcb91a5cd699278c92821f676d0b3f3f4ddfcb02e79775c8194914846068530ed7dd5c3ef8ad33b71a1dbb4e4b69b47389308798d32d3b1e0b50bb5fcd4ebe7cb8f9c4c1e71beea8de6952525fd833f4610c78fdbd6c68840d37a10e230a383609a6634beb287ec13e006e882e40fddf013072a185ef2ba306a8ca2bc207a65f2183014cafda16ebfce401a4013b01faa2b6d6ea41c9892fbbc52bd75bc0f5770c90cf17852b8dc2fe5441ac9862fd0860ef177e002887044619cfc080038dd82aa838385dc3486c0cdfef4c9aa611e6bd78567d73402a48687461c70d23896ebdcec20f333e4126b94c630495afff9d73a6596f7285743314cddbc24d0069db5d102213265bc28eec212724080bba619a11781d7f7f78de1e42d5b7f15061d10a94853391451427ac5b656c11a7d0721371411245e0d58f6f8b251d15ae1d1532e232cd4323c3523b40a4f6472ada2688d9eb5b4e541cda5a3422453d05f4ce33fe757f72303ef18b63205ec27f1e1fceefbbcba0d46fb831e90b4d7c8310225fe566c583df2654a1af979d6affd70298e4d3422dbe234d79f57ad3eb37d8f569f3f4efaf4e9062585281ff9d82d99cf0dbdec6154be88612"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + caseNumber = 500; + dataLen = 4096; + combinedKey = "badfd2102e1e180a634204249c5a6933b2e5d93f9a1cb62ab1ecd419e399dc46"; + iv = "84c06c16c151007ca9ed9bb926e66eec"; + cipherText = "4b52b5e85aecaaaf886bd9e8805390c62e12e13357e4beb3b713e37d217c6f7a9e432a04f87bd8a4dd0ef79eb7bf41b5a2a27e63361d7cb7af7b3c9a8f0b56ae27dc9cfd6c10eb1a79c7be35d31c3965b8e7099775f7644029bd79321f5dd12c55280a30fabd1b95e27c2d4dec6ca4d8716f36e7abe3408f5120560b573e5495ae7aad668fa84d6a8a1156c231a5b6d983ece3e27d199a806dc629c1a60c08ccb0e4807d9fed88f28ce0f59583708f540f97110b2620b1679220abe13e3c4b727186b289794583b20154ce9a07a284df3e63572f462142cae8949d7dd6f2b26fb90d556ec75e93dd33b59d697883312af89e52945b9baedfebe28759cdba4dfbf6e6f201b087478642cf0b34f983593c68947e4ee05bd17716e6cfb7c74c876c0ba650f3979f5eceb72a71d0d46aac4474ae2048d2a9884aa12e292950c77b17de11e8d3e895e60b1c584b1c8d9edd40ba7917e396d1d3bfd1941923aa40213195e8b8f7f4d5ae1057cbecdf89c8959745d1fcece59115819dc661e7b097c132e8f98720a57a83469cb82c374fdebc97badd7cef8d160a7f27d50f35b7e4af6f1b78361828e32a55b25fd56efbc12f8fcb7e2e4f882afa0c7747a455a1fae00a561cbb878e01b32fafb23f397371a8b3441c8da654b902d8489383542188821859a44f0fb2b63a49835f8ba5f0231ff0f8f5fc3d5c812331b11e39bc03394e28"; + plainText = "9f1d65e6a345a2bad796cb1493395fb792a2273de720b9b1b62825eed5042af968c35b17eb2c655ba7b32760cac310ef8869d59b7938f5ed0d07f9988aa543f16e4d8031a07e112e67e8a77434a6a8321d0b1595b21bd459794d4d1dd4935b19b2efbed9b740c4b40c8409b9b83410a2e4f988c93d055d4c6770d71ea3f43024bd2187d6647fd3858521c900f6c8c61bf9cad2c31acdea49246ee15488cc8a066532539401a8a5d88f1fce836bad97948922fbe36c6c1d27f7e6203e601859527aefc655156a42606f159d19b2e03812f311bb0d3469f53e89be04d3dc75d6a1afef7a42ad8859b4e2ca6731e89923178f141c2324b2e52d18374f9c6df9e49c1c4faa4322b093d8ff37a1a11db17724000e58b08c47162614940a852e65ea1e6167721dd473e1e7a9596e1398d4196a7cb83672c93a01db4565056a25c57662f541efabd24d8f739db5c187718b5f78076a99d54bdf46314ce681721b68a02c5a0cbd566b9afecc0fc6f53299f722e7a58f29b374d3bd7b56525118b6f3502ac626e7445bdcf0ce7cfe88d05b04bd50416a3761500748c3cd4d9835a7e571d681a5c47e69b87761be168e9a5857d66ddbb385d6c9a28c11584f86f38e26febf2636fd51ebe5ff851810f73d032d84210f93f4327cd71aceec451ac91bd818f8feda2c365c77d4b6051fe6cdcd2a5816cd6c8cafdc8bd0b74eefd34531d4deb1"; + + + doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); + + return 0; +} +#endif + ADDED CCRegression/CommonCrypto/CommonCryptoSymZeroLength.c Index: CCRegression/CommonCrypto/CommonCryptoSymZeroLength.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoSymZeroLength.c @@ -0,0 +1,69 @@ +#include +#include +#include "CCCryptorTestFuncs.h" +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" + +#if (CCSYMZEROLEN == 0) +entryPoint(CommonCryptoSymZeroLength,"CommonCrypto Symmetric Zero-Length Testing") +#else + +static int kTestTestCount = 4; + + +int CommonCryptoSymZeroLength (int argc, char *const *argv) +{ + char *keyStr; + char *iv; + char *plainText; + char *cipherText; + int retval, accum = 0; + + plan_tests(kTestTestCount); + + /* Two Test cases - "" and NULL WITH an IV */ + + keyStr = "000102030405060708090a0b0c0d0e0f"; + iv = "0f0e0d0c0b0a09080706050403020100"; + + // 1 + plainText = ""; + cipherText = "efddc425a6fa0c5f25e444092eb0f503"; + retval = CCCryptTestCase(keyStr, iv, kCCAlgorithmAES128, kCCOptionPKCS7Padding, cipherText, plainText); + ok(retval == 0, "CBC Zero Length String, IV defined"); + accum += retval; + + + // 1 + plainText = NULL; + cipherText = "efddc425a6fa0c5f25e444092eb0f503"; + retval = CCCryptTestCase(keyStr, iv, kCCAlgorithmAES128, kCCOptionPKCS7Padding, cipherText, plainText); + ok(retval == 0, "CBC NULL String, IV defined"); + accum += retval; + + /* Two more Test cases - "" and NULL WITH IV=NULL */ + + keyStr = "000102030405060708090a0b0c0d0e0f"; + iv = NULL; + + // 1 + plainText = ""; + cipherText = "954f64f2e4e86e9eee82d20216684899"; + retval = CCCryptTestCase(keyStr, iv, kCCAlgorithmAES128, kCCOptionPKCS7Padding, cipherText, plainText); + ok(retval == 0, "CBC Zero Length String, IV NULL"); + accum += retval; + + + // 1 + plainText = NULL; + cipherText = "954f64f2e4e86e9eee82d20216684899"; + retval = CCCryptTestCase(keyStr, iv, kCCAlgorithmAES128, kCCOptionPKCS7Padding, cipherText, plainText); + //retval = 0; + ok(retval == 0, "CBC NULL String, IV NULL"); + accum += retval; + + return accum != 0; +} +#endif + ADDED CCRegression/CommonCrypto/CommonCryptoSymmetricWrap.c Index: CCRegression/CommonCrypto/CommonCryptoSymmetricWrap.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonCryptoSymmetricWrap.c @@ -0,0 +1,131 @@ +// +// CommonCryptoSymmetricWrap.c +// CCRegressions +// +// Created by Richard Murphy on 1/13/12. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#include +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" + +#if (CCSYMWRAP == 0) +entryPoint(CommonSymmetricWrap,"Symmetric Wrap") +#else + +#include + + +static int +wrapTest(char *kekstr, char *keystr, char *wrapped_keystr) +{ + byteBuffer kek, key, wrapped_key, bb; + + kek = hexStringToBytes(kekstr); + key = hexStringToBytes(keystr); + if(wrapped_keystr) wrapped_key = hexStringToBytes(wrapped_keystr); + else wrapped_key = hexStringToBytes("0x00"); + const uint8_t *iv = CCrfc3394_iv; + const size_t ivLen = CCrfc3394_ivLen; + size_t wrapped_size = CCSymmetricWrappedSize(kCCWRAPAES, key->len); + uint8_t wrapped[wrapped_size]; + + // printf("Wrapped Size %lu\n", wrapped_size); + + ok(CCSymmetricKeyWrap(kCCWRAPAES, iv , ivLen, kek->bytes, kek->len, key->bytes, key->len, wrapped, &wrapped_size) == 0, "function is successful"); + if(wrapped_keystr) { + bb = bytesToBytes(wrapped, wrapped_size); + if(!strcmp(wrapped_keystr, "")) printByteBuffer(bb, "Result: "); + ok(bytesAreEqual(bb, wrapped_key), "Equal to expected wrapping"); + // printByteBuffer(bb, "Result: "); + // printByteBuffer(wrapped_key, "Expected: "); + free(bb); + } + + size_t unwrapped_size = CCSymmetricUnwrappedSize(kCCWRAPAES, wrapped_size); + uint8_t unwrapped[unwrapped_size]; + + ok(CCSymmetricKeyUnwrap(kCCWRAPAES, iv, ivLen, kek->bytes, kek->len, wrapped, wrapped_size, unwrapped, &unwrapped_size) == 0, "function is successful"); + bb = bytesToBytes(unwrapped, unwrapped_size); + ok(bytesAreEqual(bb, key), "Equal to original key"); + free(bb); + free(kek); + free(key); + free(wrapped_key); + + return 0; +} + + + + + +static int kTestTestCount = 35; + +int +CommonSymmetricWrap(int argc, char *const *argv) +{ + char *kek, *key, *wrapped_key; + int accum = 0; + plan_tests(kTestTestCount); + + diag("Test 1"); + kek = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"; + key = "00112233445566778899aabbccddeeff000102030405060708090a0b0c0d0e0f"; + wrapped_key = "28C9F404C4B810F4CBCCB35CFB87F8263F5786E2D80ED326CBC7F0E71A99F43BFB988B9B7A02DD21"; + accum |= wrapTest(kek, key, wrapped_key); + + diag("Test 2"); + kek = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"; + key = "00112233445566778899aabbccddeeff00010203040506070"; + wrapped_key = "a8f9bc1612c68b3ff6e6f4fbe30e71e4769c8b80a32cb8958cd5d17d6b254da1"; + accum |= wrapTest(kek, key, wrapped_key); + + diag("Test 3"); + byteBuffer keybuf = mallocByteBuffer(2048); + for(int i=0; i<2048; i++) keybuf->bytes[i] = i%256; + key = bytesToHexString(keybuf); + accum |= wrapTest(kek, key, NULL); + + diag("Test Vectors from RFC 3394"); + diag("4.1 Wrap 128 bits of Key Data with a 128-bit KEK"); + kek = "000102030405060708090A0B0C0D0E0F"; + key = "00112233445566778899AABBCCDDEEFF"; + wrapped_key = "1FA68B0A8112B447AEF34BD8FB5A7B829D3E862371D2CFE5"; + accum |= wrapTest(kek, key, wrapped_key); + + diag("4.2 Wrap 128 bits of Key Data with a 192-bit KEK"); + kek = "000102030405060708090A0B0C0D0E0F1011121314151617"; + key = "00112233445566778899AABBCCDDEEFF"; + wrapped_key = "96778B25AE6CA435F92B5B97C050AED2468AB8A17AD84E5D"; + accum |= wrapTest(kek, key, wrapped_key); + + diag("4.3 Wrap 128 bits of Key Data with a 256-bit KEK"); + kek = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F"; + key = "00112233445566778899AABBCCDDEEFF"; + wrapped_key = "64E8C3F9CE0F5BA263E9777905818A2A93C8191E7D6E8AE7"; + accum |= wrapTest(kek, key, wrapped_key); + + diag("4.4 Wrap 192 bits of Key Data with a 192-bit KEK"); + kek = "000102030405060708090A0B0C0D0E0F1011121314151617"; + key = "00112233445566778899AABBCCDDEEFF0001020304050607"; + wrapped_key = "031D33264E15D33268F24EC260743EDCE1C6C7DDEE725A936BA814915C6762D2"; + accum |= wrapTest(kek, key, wrapped_key); + + diag("4.5 Wrap 192 bits of Key Data with a 256-bit KEK"); + kek = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F"; + key = "00112233445566778899AABBCCDDEEFF0001020304050607"; + wrapped_key = "A8F9BC1612C68B3FF6E6F4FBE30E71E4769C8B80A32CB8958CD5D17D6B254DA1"; + accum |= wrapTest(kek, key, wrapped_key); + + diag("4.6 Wrap 256 bits of Key Data with a 256-bit KEK"); + kek = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F"; + key = "00112233445566778899AABBCCDDEEFF000102030405060708090A0B0C0D0E0F"; + wrapped_key = "28C9F404C4B810F4CBCCB35CFB87F8263F5786E2D80ED326CBC7F0E71A99F43BFB988B9B7A02DD21"; + accum |= wrapTest(kek, key, wrapped_key); + + return 0; +} +#endif ADDED CCRegression/CommonCrypto/CommonDHtest.c Index: CCRegression/CommonCrypto/CommonDHtest.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonDHtest.c @@ -0,0 +1,60 @@ +#include +#include "capabilities.h" +#include "testmore.h" +#include "testbyteBuffer.h" + +#if (CCDH == 0) +entryPoint(CommonDH,"Diffie-Hellman Key Agreement") +#else + +#include "CommonDH.h" +static int kTestTestCount = 2; + +int CommonDH(int argc, char *const *argv) { + CCDHRef dh1, dh2; + + plan_tests(kTestTestCount); + + + dh1 = CCDHCreate(kCCDHRFC2409Group2); + ok(dh1 == NULL, "kCCDHRFC2409Group2 isn't implemented in corecrypto"); + + dh1 = CCDHCreate(kCCDHRFC3526Group5); + ok(dh1 != NULL, "got a DH ref"); + + dh2 = CCDHCreate(kCCDHRFC3526Group5); + ok(dh2 != NULL, "got a DH ref"); + + diag("CCDHRefs Created\n"); + + uint8_t pubkey1[4096], pubkey2[4096]; + size_t len1 = 4096, len2 = 4096; + int ret1 = CCDHGenerateKey(dh1, pubkey1, &len1); + int ret2 = CCDHGenerateKey(dh2, pubkey2, &len2); + + ok(ret1 != -1 && ret2 != -1, "pubkeys generated"); + + diag("Pubkeys Created\n"); + + uint8_t sharedkey1[4096], sharedkey2[4096]; + size_t slen1 = 4096, slen2 = 4096; + + int sret1 = CCDHComputeKey(sharedkey1, &slen1, pubkey2, len2, dh1); + int sret2 = CCDHComputeKey(sharedkey2, &slen2, pubkey1, len1, dh2); + + ok(sret1 != -1 && sret2 != -1, "shared keys generated"); + + ok(slen1 == slen2, "shared key lengths are equal"); + + ok(memcmp(sharedkey1, sharedkey2, slen1) == 0, "shared keys are equal"); + + + + CCDHRelease(dh1); + ok(1, "Didn't crash"); + + + return 0; +} + +#endif ADDED CCRegression/CommonCrypto/CommonDigest.c Index: CCRegression/CommonCrypto/CommonDigest.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonDigest.c @@ -0,0 +1,476 @@ +#include +#include "testbyteBuffer.h" +#include "capabilities.h" +#include "testmore.h" +#include + +#define COMMON_DIGEST_FOR_RFC_1321 +#include +#include +#include + +#ifdef CCDIGEST +#include +#endif + +#ifdef CCKEYDERIVATION +#include +#endif + +static char *digestName(CCDigestAlgorithm digestSelector) { + switch(digestSelector) { + default: return "None"; + case kCCDigestMD2: return "MD2"; + case kCCDigestMD4: return "MD4"; + case kCCDigestMD5: return "MD5"; + case kCCDigestRMD128: return "RMD128"; + case kCCDigestRMD160: return "RMD160"; + case kCCDigestRMD256: return "RMD256"; + case kCCDigestRMD320: return "RMD320"; + case kCCDigestSHA1: return "SHA1"; + case kCCDigestSHA224: return "SHA224"; + case kCCDigestSHA256: return "SHA256"; + case kCCDigestSHA384: return "SHA384"; + case kCCDigestSHA512: return "SHA512"; + case kCCDigestSkein128: return "Skein128"; + case kCCDigestSkein160: return "Skein160"; + case kCCDigestSkein224: return "Skein224"; + case kCCDigestSkein256: return "Skein256"; + case kCCDigestSkein384: return "Skein384"; + case kCCDigestSkein512: return "Skein512"; + } +} + +static size_t nullstrlen(const char *s) { + if(!s) return 0; + return strlen(s); +} + +#define MAX_DIGEST_SIZE CC_SHA512_DIGEST_LENGTH + +#if (CCKEYDERIVATION == 1) +static int +PBKDF2Test(char *password, uint8_t *salt, size_t saltlen, int rounds, CCDigestAlgorithm PRF, int dklen, char *expected) +{ + byteBuffer derivedKey; + byteBuffer expectedBytes; + char outbuf[80]; + int retval = 0; + + if(expected) expectedBytes = hexStringToBytes(expected); + derivedKey = mallocByteBuffer(dklen); + switch(PRF) { + case 0: CCKeyDerivationPBKDF(kCCPBKDF2, password, strlen(password), (uint8_t *) salt, saltlen, 0, rounds, derivedKey->bytes, derivedKey->len); break; + case kCCDigestSHA1: CCKeyDerivationPBKDF(kCCPBKDF2, password, strlen(password), salt, saltlen, kCCPRFHmacAlgSHA1, rounds, derivedKey->bytes, derivedKey->len); break; + case kCCDigestSHA224: CCKeyDerivationPBKDF(kCCPBKDF2, password, strlen(password), salt, saltlen, kCCPRFHmacAlgSHA224, rounds, derivedKey->bytes, derivedKey->len); break; + case kCCDigestSHA256: CCKeyDerivationPBKDF(kCCPBKDF2, password, strlen(password), salt, saltlen, kCCPRFHmacAlgSHA256, rounds, derivedKey->bytes, derivedKey->len); break; + case kCCDigestSHA384: CCKeyDerivationPBKDF(kCCPBKDF2, password, strlen(password), salt, saltlen, kCCPRFHmacAlgSHA384, rounds, derivedKey->bytes, derivedKey->len); break; + case kCCDigestSHA512: CCKeyDerivationPBKDF(kCCPBKDF2, password, strlen(password), salt, saltlen, kCCPRFHmacAlgSHA512, rounds, derivedKey->bytes, derivedKey->len); break; + default: return 1; + } + sprintf(outbuf, "PBKDF2-HMAC-%s test for %s", digestName(PRF), password); + + if(expected) { + ok(bytesAreEqual(derivedKey, expectedBytes), outbuf); + + if(!bytesAreEqual(derivedKey, expectedBytes)) { + diag("KEYDERIVE FAIL: PBKDF2-HMAC-%s(\"%s\")\n expected %s\n got %s\n", digestName(PRF), password, expected, bytesToHexString(derivedKey)); + retval = 1; + } else { + //printf("KEYDERIVE PASS: PBKDF2-HMAC-%s(\"%s\")\n", digestName(PRF), password); + } + free(expectedBytes); + } + free(derivedKey); + return retval; +} +#endif + +static byteBuffer mallocDigestBuffer(CCDigestAlgorithm digestSelector) { + size_t len; + switch(digestSelector) { + default: len = CCDigestGetOutputSize(digestSelector); break; + case kCCDigestMD2: len = CC_MD2_DIGEST_LENGTH; break; + case kCCDigestMD4: len = CC_MD4_DIGEST_LENGTH; break; + case kCCDigestMD5: len = CC_MD5_DIGEST_LENGTH; break; + case kCCDigestSHA1: len = CC_SHA1_DIGEST_LENGTH; break; + case kCCDigestSHA224: len = CC_SHA224_DIGEST_LENGTH; break; + case kCCDigestSHA256: len = CC_SHA256_DIGEST_LENGTH; break; + case kCCDigestSHA384: len = CC_SHA384_DIGEST_LENGTH; break; + case kCCDigestSHA512: len = CC_SHA512_DIGEST_LENGTH; break; + } + return mallocByteBuffer(len); +} + +static void +OneShotHmac(CCHmacAlgorithm hmacAlg, uint8_t *key, size_t keylen, const char *data, size_t datalen, uint8_t *output) +{ + CCHmacContext ctx; + + CCHmacInit(&ctx, hmacAlg, key, keylen); + CCHmacUpdate(&ctx, data, datalen); + CCHmacFinal(&ctx, output); +} + +static int +HMACTest(const char *input, char *keystr, CCDigestAlgorithm digestSelector, char *expected) +{ + CCHmacAlgorithm hmacAlg; + size_t inputLen = nullstrlen(input); + char outbuf[80]; + int retval = 0; + + byteBuffer expectedBytes = hexStringToBytes(expected); + byteBuffer keyBytes = hexStringToBytes(keystr); + byteBuffer mdBuf = mallocDigestBuffer(digestSelector); + switch(digestSelector) { + case kCCDigestMD5: hmacAlg = kCCHmacAlgMD5; break; + case kCCDigestSHA1: hmacAlg = kCCHmacAlgSHA1; break; + case kCCDigestSHA224: hmacAlg = kCCHmacAlgSHA224; break; + case kCCDigestSHA256: hmacAlg = kCCHmacAlgSHA256; break; + case kCCDigestSHA384: hmacAlg = kCCHmacAlgSHA384; break; + case kCCDigestSHA512: hmacAlg = kCCHmacAlgSHA512; break; + default: return 1; + } + CCHmac(hmacAlg, keyBytes->bytes, keyBytes->len, input, inputLen, mdBuf->bytes); + sprintf(outbuf, "Hmac-%s test for %s", digestName(digestSelector), input); + ok(bytesAreEqual(mdBuf, expectedBytes), outbuf); + if(!bytesAreEqual(mdBuf, expectedBytes)) { + diag("HMAC FAIL: HMAC-%s(\"%s\")\n expected %s\n got %s\n", digestName(digestSelector), input, expected, bytesToHexString(mdBuf)); + retval = 1; + } else { + // printf("HMAC PASS: HMAC-%s(\"%s\")\n", digestName(digestSelector), input); + } + OneShotHmac(hmacAlg, keyBytes->bytes, keyBytes->len, input, inputLen, mdBuf->bytes); + sprintf(outbuf, "Hmac-%s test for %s", digestName(digestSelector), input); + ok(bytesAreEqual(mdBuf, expectedBytes), outbuf); + if(!bytesAreEqual(mdBuf, expectedBytes)) { + diag("HMAC FAIL: HMAC-%s(\"%s\")\n expected %s\n got %s\n", digestName(digestSelector), input, expected, bytesToHexString(mdBuf)); + retval = 1; + } else { + //printf("HMAC PASS: HMAC-%s(\"%s\")\n", digestName(digestSelector), input); + } + free(mdBuf); + free(expectedBytes); + free(keyBytes); + return retval; +} + +#if (CCDIGEST == 1) + +static void OneShotDigest(CCDigestAlgorithm algorithm, const uint8_t *bytesToDigest, size_t numbytes, uint8_t *outbuf) +{ + CCDigestRef d; + *outbuf = 0; + if((d = CCDigestCreate(algorithm)) == NULL) return; + + size_t fromAlg = CCDigestGetOutputSize(algorithm); + size_t fromRef = CCDigestGetOutputSizeFromRef(d); + size_t fromOldRoutine = CCDigestOutputSize(d); + + ok(fromAlg == fromRef, "Size is the same from ref or alg"); + ok(fromAlg == fromOldRoutine, "Size is the same from ref or alg"); + if(CCDigestUpdate(d, bytesToDigest, numbytes)) return; + if(CCDigestFinal(d, outbuf)) return; + + uint8_t dupBuf[fromRef]; + CCDigestReset(d); + if(CCDigestUpdate(d, bytesToDigest, numbytes)) return; + if(CCDigestFinal(d, dupBuf)) return; + ok(memcmp(outbuf, dupBuf, fromRef) == 0, "result should be the same from recycled context"); + + CCDigestDestroy(d); + +} + + +static int +newHashTest(char *input, CCDigestAlgorithm digestSelector, char *expected) +{ + size_t inputLen = nullstrlen(input); + char outbuf[4096]; + int retval = 0; + + byteBuffer expectedBytes = hexStringToBytes(expected); + byteBuffer mdBuf = mallocByteBuffer(CCDigestGetOutputSize(digestSelector)); + + CCDigest(digestSelector, (const uint8_t *) input, inputLen, mdBuf->bytes); + sprintf(outbuf, "new interface %s test for %s", digestName(digestSelector), input); + ok(bytesAreEqual(mdBuf, expectedBytes), outbuf); + if(!bytesAreEqual(mdBuf, expectedBytes)) { + diag("Digestor FAIL: %s(\"%s\")\nexpected %s\ngot %s\n", digestName(digestSelector), input, expected, bytesToHexString(mdBuf)); + retval = 1; + } else { + // printf("Digestor PASS: %s(\"%s\")\n", digestName(digestSelector), input); + } + + printf("Digest is %s\n", digestName(digestSelector)); + OneShotDigest(digestSelector, (const uint8_t *) input, inputLen, mdBuf->bytes); + sprintf(outbuf, "composite interface %s test for %s", digestName(digestSelector), input); + ok(bytesAreEqual(mdBuf, expectedBytes), outbuf); + if(!bytesAreEqual(mdBuf, expectedBytes)) { + diag("Digestor FAIL: %s(\"%s\")\nexpected %s\ngot %s\n", digestName(digestSelector), input, expected, bytesToHexString(mdBuf)); + retval = 1; + } else { + // printf("Digestor PASS: %s(\"%s\")\n", digestName(digestSelector), input); + } + + free(mdBuf); + free(expectedBytes); + return retval; +} + +static int +unHashTest(CCDigestAlgorithm digestSelector) +{ + char *buf[128]; + int retval; + CCDigestRef retref; + + retval = CCDigest(digestSelector, (const uint8_t *) buf, 128, (uint8_t *) buf); + ok(retval == kCCUnimplemented, "Unsupported Digest returns kCCUnimplemented"); + retref = CCDigestCreate(digestSelector); + ok(retref == NULL, "Unsupported Digest returns NULL"); + return 0; +} +#endif + +#define CC_SHA224_CTX CC_SHA256_CTX +#define CC_SHA384_CTX CC_SHA512_CTX +#define OLD_ALL_IN_ONE_HASH(name,input,len,out) \ +{ \ + CC_##name##_CTX ctx; \ + ok(CC_##name##_Init(&ctx) == 1, "Old Hash init should result in 1\n"); \ + ok(CC_##name##_Update(&ctx, input, len) == 1, "Old Hash update should result in 1\n"); \ + ok(CC_##name##_Final(out, &ctx) == 1, "Old Hash final should result in 1\n"); \ +} \ +break + + +static int +hashTest(char *input, CCDigestAlgorithm digestSelector, char *expected) +{ + CC_LONG inputLen = (CC_LONG) nullstrlen(input); + char outbuf[4096]; + int retval = 0; + byteBuffer mdBuf = mallocDigestBuffer(digestSelector); + byteBuffer expectedBytes = hexStringToBytes(expected); + + switch(digestSelector) { + case kCCDigestMD2: CC_MD2(input, inputLen, mdBuf->bytes); break; + case kCCDigestMD4: CC_MD4(input, inputLen, mdBuf->bytes); break; + case kCCDigestMD5: CC_MD5(input, inputLen, mdBuf->bytes); break; + case kCCDigestSHA1: CC_SHA1(input, inputLen, mdBuf->bytes); break; + case kCCDigestSHA224: CC_SHA224(input, inputLen, mdBuf->bytes); break; + case kCCDigestSHA256: CC_SHA256(input, inputLen, mdBuf->bytes); break; + case kCCDigestSHA384: CC_SHA384(input, inputLen, mdBuf->bytes); break; + case kCCDigestSHA512: CC_SHA512(input, inputLen, mdBuf->bytes); break; + default: return 1; + } + sprintf(outbuf, "Legacy %s test for %s", digestName(digestSelector), input); + ok(bytesAreEqual(mdBuf, expectedBytes), outbuf); + + if(!bytesAreEqual(mdBuf, expectedBytes)) { + diag("Legacy FAIL: %s(\"%s\") expected %s got %s\n", digestName(digestSelector), input, expected, bytesToHexString(mdBuf)); + retval = 1; + } else { + // printf("Legacy PASS: %s(\"%s\")\n", digestName(digestSelector), input); + } + + switch(digestSelector) { + case kCCDigestMD2: OLD_ALL_IN_ONE_HASH(MD2, input, inputLen, mdBuf->bytes); + case kCCDigestMD4: OLD_ALL_IN_ONE_HASH(MD4, input, inputLen, mdBuf->bytes); + case kCCDigestMD5: OLD_ALL_IN_ONE_HASH(MD5, input, inputLen, mdBuf->bytes); + case kCCDigestSHA1: OLD_ALL_IN_ONE_HASH(SHA1, input, inputLen, mdBuf->bytes); + case kCCDigestSHA224: OLD_ALL_IN_ONE_HASH(SHA224, input, inputLen, mdBuf->bytes); + case kCCDigestSHA256: OLD_ALL_IN_ONE_HASH(SHA256, input, inputLen, mdBuf->bytes); + case kCCDigestSHA384: OLD_ALL_IN_ONE_HASH(SHA384, input, inputLen, mdBuf->bytes); + case kCCDigestSHA512: OLD_ALL_IN_ONE_HASH(SHA512, input, inputLen, mdBuf->bytes); + default: return 1; + } + sprintf(outbuf, "Legacy %s test for %s", digestName(digestSelector), input); + ok(bytesAreEqual(mdBuf, expectedBytes), outbuf); + + if(!bytesAreEqual(mdBuf, expectedBytes)) { + diag("Legacy FAIL: %s(\"%s\") expected %s got %s\n", digestName(digestSelector), input, expected, bytesToHexString(mdBuf)); + retval = 1; + } else { + // printf("Legacy PASS: %s(\"%s\")\n", digestName(digestSelector), input); + } + + free(mdBuf); + free(expectedBytes); + return retval; +} + +static int +rfc1321Test(char *input, char *expected) +{ + CC_LONG inputLen = (CC_LONG) nullstrlen(input); + char outbuf[80]; + int retval = 0; + MD5_CTX ctx; + byteBuffer expectedBytes = hexStringToBytes(expected); + byteBuffer mdBuf = mallocByteBuffer(CC_MD5_DIGEST_LENGTH); + + MD5Init(&ctx); + MD5Update(&ctx, input, inputLen); + MD5Final(mdBuf->bytes, &ctx); + + sprintf(outbuf, "Legacy MD5-1321 test for %s", input); + + ok(bytesAreEqual(mdBuf, expectedBytes), outbuf); + + if(!bytesAreEqual(mdBuf, expectedBytes)) { + diag("Legacy FAIL: MD5-1321(\"%s\") expected %s got %s\n", input, expected, bytesToHexString(mdBuf)); + retval = 1; + } else { + // printf("Legacy PASS: MD5-1321(\"%s\")\n", input); + } + free(mdBuf); + free(expectedBytes); + return retval; +} + + +static int kTestTestCount = 250; + +int CommonDigest(int argc, char *const *argv) { + char *strvalue, *keyvalue; + plan_tests(kTestTestCount); + int accum = 0; + + /* strvalue of NULL and strvalue of "" must end up the same */ + strvalue = NULL; + accum |= hashTest(strvalue, kCCDigestMD2, "8350e5a3e24c153df2275c9f80692773"); + accum |= hashTest(strvalue, kCCDigestMD4, "31d6cfe0d16ae931b73c59d7e0c089c0"); + accum |= hashTest(strvalue, kCCDigestMD5, "d41d8cd98f00b204e9800998ecf8427e"); + accum |= hashTest(strvalue, kCCDigestSHA1, "da39a3ee5e6b4b0d3255bfef95601890afd80709"); + accum |= hashTest(strvalue, kCCDigestSHA224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f"); + accum |= hashTest(strvalue, kCCDigestSHA256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); + accum |= hashTest(strvalue, kCCDigestSHA384, "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b"); + accum |= hashTest(strvalue, kCCDigestSHA512, "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"); +#if (CCDIGEST == 1) + accum |= newHashTest(strvalue, kCCDigestMD2, "8350e5a3e24c153df2275c9f80692773"); + accum |= newHashTest(strvalue, kCCDigestMD4, "31d6cfe0d16ae931b73c59d7e0c089c0"); + accum |= newHashTest(strvalue, kCCDigestMD5, "d41d8cd98f00b204e9800998ecf8427e"); + accum |= newHashTest(strvalue, kCCDigestSHA1, "da39a3ee5e6b4b0d3255bfef95601890afd80709"); + accum |= newHashTest(strvalue, kCCDigestSHA224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f"); + accum |= newHashTest(strvalue, kCCDigestSHA256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); + accum |= newHashTest(strvalue, kCCDigestSHA384, "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b"); + accum |= newHashTest(strvalue, kCCDigestSHA512, "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"); + accum |= newHashTest(strvalue, kCCDigestRMD128, "cdf26213a150dc3ecb610f18f6b38b46"); + accum |= newHashTest(strvalue, kCCDigestRMD160, "9c1185a5c5e9fc54612808977ee8f548b2258d31"); + accum |= newHashTest(strvalue, kCCDigestRMD256, "02ba4c4e5f8ecd1877fc52d64d30e37a2d9774fb1e5d026380ae0168e3c5522d"); + accum |= newHashTest(strvalue, kCCDigestRMD320, "22d65d5661536cdc75c1fdf5c6de7b41b9f27325ebc61e8557177d705a0ec880151c3a32a00899b8"); +#else + diag("No Testing of the new Digest Interfaces\n"); +#endif + + strvalue = ""; + accum |= hashTest(strvalue, kCCDigestMD2, "8350e5a3e24c153df2275c9f80692773"); + accum |= hashTest(strvalue, kCCDigestMD4, "31d6cfe0d16ae931b73c59d7e0c089c0"); + accum |= hashTest(strvalue, kCCDigestMD5, "d41d8cd98f00b204e9800998ecf8427e"); + accum |= hashTest(strvalue, kCCDigestSHA1, "da39a3ee5e6b4b0d3255bfef95601890afd80709"); + accum |= hashTest(strvalue, kCCDigestSHA224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f"); + accum |= hashTest(strvalue, kCCDigestSHA256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); + accum |= hashTest(strvalue, kCCDigestSHA384, "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b"); + accum |= hashTest(strvalue, kCCDigestSHA512, "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"); +#if (CCDIGEST == 1) + accum |= newHashTest(strvalue, kCCDigestMD2, "8350e5a3e24c153df2275c9f80692773"); + accum |= newHashTest(strvalue, kCCDigestMD4, "31d6cfe0d16ae931b73c59d7e0c089c0"); + accum |= newHashTest(strvalue, kCCDigestMD5, "d41d8cd98f00b204e9800998ecf8427e"); + accum |= newHashTest(strvalue, kCCDigestSHA1, "da39a3ee5e6b4b0d3255bfef95601890afd80709"); + accum |= newHashTest(strvalue, kCCDigestSHA224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f"); + accum |= newHashTest(strvalue, kCCDigestSHA256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); + accum |= newHashTest(strvalue, kCCDigestSHA384, "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b"); + accum |= newHashTest(strvalue, kCCDigestSHA512, "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"); + accum |= newHashTest(strvalue, kCCDigestRMD128, "cdf26213a150dc3ecb610f18f6b38b46"); + accum |= newHashTest(strvalue, kCCDigestRMD160, "9c1185a5c5e9fc54612808977ee8f548b2258d31"); + accum |= newHashTest(strvalue, kCCDigestRMD256, "02ba4c4e5f8ecd1877fc52d64d30e37a2d9774fb1e5d026380ae0168e3c5522d"); + accum |= newHashTest(strvalue, kCCDigestRMD320, "22d65d5661536cdc75c1fdf5c6de7b41b9f27325ebc61e8557177d705a0ec880151c3a32a00899b8"); +#if defined(TESTSKEIN) + + accum |= newHashTest(strvalue, kCCDigestSkein128, "030085a5c5e9fc54612808977ee8f548"); + accum |= newHashTest(strvalue, kCCDigestSkein160, "030085a5c5e9fc54612808977ee8f548b2258d31"); + accum |= newHashTest(strvalue, kCCDigestSkein224, "030085a5c5e9fc54612808977ee8f548b2258d31009b934ca495991b"); + accum |= newHashTest(strvalue, kCCDigestSkein256, "0900d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"); + accum |= newHashTest(strvalue, kCCDigestSkein384, "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + accum |= newHashTest(strvalue, kCCDigestSkein512, "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); +#else + accum |= unHashTest(kCCDigestSkein128); + accum |= unHashTest(kCCDigestSkein160); + accum |= unHashTest(kCCDigestSkein224); + accum |= unHashTest(kCCDigestSkein256); + accum |= unHashTest(kCCDigestSkein384); + accum |= unHashTest(kCCDigestSkein512); +#endif +#else + diag("No Testing of the new Digest Interfaces\n"); +#endif + + strvalue = "Test vector from febooti.com"; + accum |= hashTest(strvalue, kCCDigestMD2, "db128d6e0d20a1192a6bd1fade401150"); + accum |= hashTest(strvalue, kCCDigestMD4, "6578f2664bc56e0b5b3f85ed26ecc67b"); + accum |= hashTest(strvalue, kCCDigestMD5, "500ab6613c6db7fbd30c62f5ff573d0f"); + accum |= hashTest(strvalue, kCCDigestSHA1, "a7631795f6d59cd6d14ebd0058a6394a4b93d868"); + accum |= hashTest(strvalue, kCCDigestSHA224, "3628b402254caa96827e3c79c0a559e4558da8ee2b65f1496578137d"); + accum |= hashTest(strvalue, kCCDigestSHA256, "077b18fe29036ada4890bdec192186e10678597a67880290521df70df4bac9ab"); + accum |= hashTest(strvalue, kCCDigestSHA384, "388bb2d487de48740f45fcb44152b0b665428c49def1aaf7c7f09a40c10aff1cd7c3fe3325193c4dd35d4eaa032f49b0"); + accum |= hashTest(strvalue, kCCDigestSHA512, "09fb898bc97319a243a63f6971747f8e102481fb8d5346c55cb44855adc2e0e98f304e552b0db1d4eeba8a5c8779f6a3010f0e1a2beb5b9547a13b6edca11e8a"); + accum |= rfc1321Test(strvalue, "500ab6613c6db7fbd30c62f5ff573d0f"); + + +#if (CCDIGEST == 1) + accum |= newHashTest(strvalue, kCCDigestMD2, "db128d6e0d20a1192a6bd1fade401150"); + accum |= newHashTest(strvalue, kCCDigestMD4, "6578f2664bc56e0b5b3f85ed26ecc67b"); + accum |= newHashTest(strvalue, kCCDigestMD5, "500ab6613c6db7fbd30c62f5ff573d0f"); + accum |= newHashTest(strvalue, kCCDigestSHA1, "a7631795f6d59cd6d14ebd0058a6394a4b93d868"); + accum |= newHashTest(strvalue, kCCDigestSHA224, "3628b402254caa96827e3c79c0a559e4558da8ee2b65f1496578137d"); + accum |= newHashTest(strvalue, kCCDigestSHA256, "077b18fe29036ada4890bdec192186e10678597a67880290521df70df4bac9ab"); + accum |= newHashTest(strvalue, kCCDigestSHA384, "388bb2d487de48740f45fcb44152b0b665428c49def1aaf7c7f09a40c10aff1cd7c3fe3325193c4dd35d4eaa032f49b0"); + accum |= newHashTest(strvalue, kCCDigestSHA512, "09fb898bc97319a243a63f6971747f8e102481fb8d5346c55cb44855adc2e0e98f304e552b0db1d4eeba8a5c8779f6a3010f0e1a2beb5b9547a13b6edca11e8a"); +#if defined(TESTSKEIN) + accum |= newHashTest(strvalue, kCCDigestSkein128, "03000000000000700000000000000070"); + accum |= newHashTest(strvalue, kCCDigestSkein160, "0300000000000070000000000000007000000000"); + accum |= newHashTest(strvalue, kCCDigestSkein224, "030000000000007000000000000000700000000000000070ca030210"); + accum |= newHashTest(strvalue, kCCDigestSkein256, "0000000000000000000000000000000000000000000000000000000000000000"); + accum |= newHashTest(strvalue, kCCDigestSkein384, "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + accum |= newHashTest(strvalue, kCCDigestSkein512, "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); +#endif + +#else + diag("No Testing of the new Digest Interfaces\n"); +#endif + + // Test Case 1 http://www.faqs.org/rfcs/rfc4231.html + strvalue = "Hi There"; + keyvalue = "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; + accum |= HMACTest(strvalue, keyvalue, kCCDigestSHA224, "896fb1128abbdf196832107cd49df33f47b4b1169912ba4f53684b22"); + accum |= HMACTest(strvalue, keyvalue, kCCDigestSHA256, "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7"); + accum |= HMACTest(strvalue, keyvalue, kCCDigestSHA384, "afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6"); + accum |= HMACTest(strvalue, keyvalue, kCCDigestSHA512, "87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854"); + // Test Vector from http://www.faqs.org/rfcs/rfc2104.html + keyvalue = "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; + accum |= HMACTest(strvalue, keyvalue, kCCDigestMD5, "9294727a3638bb1c13f48ef8158bfc9d"); + +#if (CCKEYDERIVATION == 1) + // Test Case PBKDF2 - HMACSHA1 http://tools.ietf.org/html/draft-josefsson-pbkdf2-test-vectors-00 + accum |= PBKDF2Test("password", (uint8_t *) "salt", 4, 1, kCCDigestSHA1, 20, "0c60c80f961f0e71f3a9b524af6012062fe037a6"); + accum |= PBKDF2Test("password", (uint8_t *) "salt", 4, 2, kCCDigestSHA1, 20, "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957"); + accum |= PBKDF2Test("password", (uint8_t *) "salt", 4, 4096, kCCDigestSHA1, 20, "4b007901b765489abead49d926f721d065a429c1"); + + // This crashes + accum |= PBKDF2Test("password", (uint8_t *) "salt", 4, 1, 0, 20, NULL); +#else + diag("No Key Derivation Support Testing\n"); +#endif + + // Test from CC_SHA512_Init(),CC_SHA512_Update(),CC_SHA512_Final() gives wrong digest + strvalue = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; + accum |= hashTest(strvalue, kCCDigestSHA512, "8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909"); + accum |= newHashTest(strvalue, kCCDigestSHA512, "8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909"); + + return accum; + +} ADDED CCRegression/CommonCrypto/CommonEC.c Index: CCRegression/CommonCrypto/CommonEC.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonEC.c @@ -0,0 +1,114 @@ +#include +#include "capabilities.h" +#include "testmore.h" +#include "testbyteBuffer.h" + +#if (CCEC == 0) +entryPoint(CommonEC,"Elliptic Curve Cryptography") +#else + +#include + +static int kTestTestCount = 18; + +int CommonEC(int argc, char *const *argv) { + CCCryptorStatus retval; + size_t keysize; + CCECCryptorRef publicKey, privateKey; + CCECCryptorRef publicKey2; + // byteBuffer keydata, dekeydata; + byteBuffer hash; + char encryptedKey[8192]; + size_t encryptedKeyLen = 8192; + // char decryptedKey[8192]; + // size_t decryptedKeyLen = 8192; + char signature[8192]; + size_t signatureLen = 8192; + char importexport[8192]; + size_t importexportLen = 8192; + uint32_t valid; + int accum = 0; + int debug = 0; + + plan_tests(kTestTestCount); + + keysize = 256; + + retval = CCECCryptorGeneratePair(keysize, &publicKey, &privateKey); + if(debug) printf("Keys Generated\n"); + ok(retval == 0, "Generate an EC Key Pair"); + accum |= retval; + +#ifdef ECDH + keydata = hexStringToBytes("000102030405060708090a0b0c0d0e0f"); + + retval = CCECCryptorWrapKey(publicKey, keydata->bytes, keydata->len, encryptedKey, &encryptedKeyLen, kCCDigestSHA1); + + ok(retval == 0, "Wrap Key Data with EC Encryption - ccPKCS1Padding"); + accum |= retval; + + retval = CCECCryptorUnwrapKey(privateKey, encryptedKey, encryptedKeyLen, + decryptedKey, &decryptedKeyLen); + + ok(retval == 0, "Unwrap Key Data with EC Encryption - ccPKCS1Padding"); + accum |= retval; + + dekeydata = bytesToBytes(decryptedKey, decryptedKeyLen); + + ok(bytesAreEqual(dekeydata, keydata), "Round Trip CCECCryptorWrapKey/CCECCryptorUnwrapKey"); + accum |= retval; +#endif + + + hash = hexStringToBytes("000102030405060708090a0b0c0d0e0f"); + + retval = CCECCryptorSignHash(privateKey, + hash->bytes, hash->len, + signature, &signatureLen); + + ok(retval == 0, "EC Signing"); + valid = 0; + accum |= retval; + if(debug) printf("Signing Complete\n"); + + retval = CCECCryptorVerifyHash(publicKey, + hash->bytes, hash->len, + signature, signatureLen, &valid); + ok(retval == 0, "EC Verifying"); + accum |= retval; + ok(valid, "EC Validity"); + accum |= retval; + if(debug) printf("Verify Complete\n"); + + // Mess with the sig - see what happens + signature[signatureLen-3] += 3; + retval = CCECCryptorVerifyHash(publicKey, + hash->bytes, hash->len, + signature, signatureLen, &valid); + ok(retval == 0, "EC Verifying"); + accum |= retval; + ok(!valid, "EC Invalid Signature"); + accum |= retval; + + if(debug) printf("Verify2 Complete\n"); + + encryptedKeyLen = 8192; + retval = CCECCryptorExportPublicKey(publicKey, importexport, &importexportLen); + + ok(retval == 0, "EC Export Public Key"); + accum |= retval; + + retval = CCECCryptorImportPublicKey(importexport, importexportLen, &publicKey2); + + ok(retval == 0, "EC Import Public Key"); + accum |= retval; + + encryptedKeyLen = 8192; + retval = CCECCryptorComputeSharedSecret(privateKey, publicKey, encryptedKey, &encryptedKeyLen); + + ok(retval == 0, "EC Shared Secret"); + accum |= retval; + + return accum; +} +#endif /* CCEC */ ADDED CCRegression/CommonCrypto/CommonHMacClone.c Index: CCRegression/CommonCrypto/CommonHMacClone.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonHMacClone.c @@ -0,0 +1,325 @@ +/* + * ccHmacClone - test CommonCrypto's clone context for HMAC. + * + * Written 3/30/2006 by Doug Mitchell. + */ + +#include +#include +#include +#include +#include +#include +#include "testmore.h" +#include "testbyteBuffer.h" +#include "capabilities.h" + +#if (CCHMACCLONE == 0) +entryPoint(CommonHMacClone,"Common HMac Cloning") +#else + +/* + * Defaults. + */ +#define LOOPS_DEF 200 + +#define MIN_DATA_SIZE 8 +#define MAX_DATA_SIZE 10000 /* bytes */ +#define MIN_KEY_SIZE 1 +#define MAX_KEY_SIZE 256 /* bytes */ +#define LOOP_NOTIFY 20 + +/* + * Enumerate algs our own way to allow iteration. + */ +typedef enum { + ALG_MD5 = 1, + ALG_SHA1, + ALG_SHA224, + ALG_SHA256, + ALG_SHA384, + ALG_SHA512, +} HmacAlg; +#define ALG_FIRST ALG_MD5 +#define ALG_LAST ALG_SHA512 + +#define LOG_SIZE 0 +#if LOG_SIZE +#define logSize(s) diag(s) +#else +#define logSize(s) +#endif + +/* + * Given an initialized CCHmacContext, feed it some data and get the result. + */ +static void hmacRun( + CCHmacContext *ctx, + bool randomUpdates, + const unsigned char *ptext, + size_t ptextLen, + void *dataOut) +{ + while(ptextLen) { + size_t thisMoveIn; /* input to CCryptUpdate() */ + + if(randomUpdates) { + thisMoveIn = genRandomSize(1, ptextLen); + } + else { + thisMoveIn = ptextLen; + } + logSize(("###ptext segment (1) len %lu\n", (unsigned long)thisMoveIn)); + CCHmacUpdate(ctx, ptext, thisMoveIn); + ptext += thisMoveIn; + ptextLen -= thisMoveIn; + } + CCHmacFinal(ctx, dataOut); +} + + +#define MAX_HMAC_SIZE CC_SHA512_DIGEST_LENGTH + +static int doHMacCloneTest(const uint8_t *ptext, + size_t ptextLen, + CCHmacAlgorithm hmacAlg, + uint32_t keySizeInBytes, + bool stagedOrig, + bool stagedClone, + bool quiet, + bool verbose) +{ + uint8_t *keyBytes; + uint8_t hmacOrig[MAX_HMAC_SIZE]; + uint8_t hmacClone[MAX_HMAC_SIZE]; + int rtn = 1; + CCHmacContext ctxOrig; + CCHmacContext ctxClone; + unsigned die; /* 0..3 indicates when to clone */ + unsigned loopNum = 0; + size_t hmacLen; + bool didClone = false; + + switch(hmacAlg) { + case kCCHmacAlgSHA1: + if(verbose) diag("hmac-sha1\n"); + hmacLen = CC_SHA1_DIGEST_LENGTH; + break; + case kCCHmacAlgMD5: + if(verbose) diag("hmac-md5\n"); + hmacLen = CC_MD5_DIGEST_LENGTH; + break; + case kCCHmacAlgSHA224: + if(verbose) diag("hmac-sha224\n"); + hmacLen = CC_SHA224_DIGEST_LENGTH; + break; + case kCCHmacAlgSHA256: + if(verbose) diag("hmac-sha256\n"); + hmacLen = CC_SHA256_DIGEST_LENGTH; + break; + case kCCHmacAlgSHA384: + if(verbose) diag("hmac-sha384\n"); + hmacLen = CC_SHA384_DIGEST_LENGTH; + break; + case kCCHmacAlgSHA512: + if(verbose) diag("hmac-sha512\n"); + hmacLen = CC_SHA512_DIGEST_LENGTH; + break; + default: + if(verbose) diag("***BRRRZAP!\n"); + return 0; + } + + /* random key */ + byteBuffer keyBuffer = genRandomByteBuffer(keySizeInBytes, keySizeInBytes); + keyBytes = keyBuffer->bytes; + + /* cook up first context */ + CCHmacInit(&ctxOrig, hmacAlg, keyBytes, keySizeInBytes); + + /* roll the dice */ + die = (unsigned) genRandomSize(0, 3); + + /* + * In this loop we do updates to the ctxOrig up until we + * clone it, then we use hmacRun to finish both of them. + */ + while(ptextLen) { + if((die == loopNum) || !stagedOrig) { + /* make the clone now */ + if(verbose) { + diag(" ...cloning at loop %u\n", loopNum); + } + ctxClone = ctxOrig; + didClone = true; + if(memcmp(&ctxClone, &ctxOrig, CC_HMAC_CONTEXT_SIZE * sizeof(uint32_t))) { + if(verbose) diag("*** context miscompare\n"); + } else { + if(verbose) diag("*** context clone worked\n"); + } + + /* do all of the clone's updates and final here */ + hmacRun(&ctxClone, stagedClone, ptext, ptextLen, hmacClone); + + /* now do all remaining updates and final for original */ + hmacRun(&ctxOrig, stagedOrig, ptext, ptextLen, hmacOrig); + + /* we're all done, time to check the HMAC values */ + break; + } /* making clone */ + + /* feed some data into cryptorOrig */ + size_t thisMove; + if(stagedOrig) { + thisMove = genRandomSize(1, ptextLen); + } + else { + thisMove = ptextLen; + } + logSize(("###ptext segment (2) len %lu\n", (unsigned long)thisMove)); + CCHmacUpdate(&ctxOrig, ptext, thisMove); + ptext += thisMove; + ptextLen -= thisMove; + loopNum++; + } + + /* + * It's possible to get here without cloning or doing any finals, + * if we ran thru multiple updates and finished ptextLen for cryptorOrig + * before we hit the cloning spot. + */ + if(!didClone) { + if(verbose) { + diag("...ctxOrig finished before we cloned; skipping test\n"); + } + return 1; + } + if(memcmp(hmacOrig, hmacClone, hmacLen)) { + diag("***data miscompare\n"); + rtn = 0; + } else { + if(verbose) diag("*** clone worked\n"); + rtn = 1; + } + if(keyBuffer) free(keyBuffer); + + return rtn; +} + +static bool isBitSet(unsigned bit, unsigned word) +{ + if(bit > 31) { + diag("We don't have that many bits\n"); + return -1; + } + unsigned mask = 1 << bit; + return (word & mask) ? true : false; +} + + +static int kTestTestCount = 1200; + + +int CommonHMacClone(int argc, char *const *argv) +{ + unsigned loop; + uint8_t *ptext; + size_t ptextLen; + bool stagedOrig; + bool stagedClone; + const char *algStr; + CCHmacAlgorithm hmacAlg; + int currAlg; // ALG_xxx + uint32_t keySizeInBytes; + int rtn = 0; + + /* + * User-spec'd params + */ + bool keySizeSpec = false; // false: use rand key size + HmacAlg minAlg = ALG_FIRST; + HmacAlg maxAlg = ALG_LAST; + unsigned loops = LOOPS_DEF; + bool verbose = false; + size_t minPtextSize = MIN_DATA_SIZE; + size_t maxPtextSize = MAX_DATA_SIZE; + bool quiet = true; + bool stagedSpec = false; // true means caller fixed stagedOrig and stagedClone + + /* ptext length set in test loop */ + plan_tests(kTestTestCount); + + for(currAlg=minAlg; currAlg<=maxAlg; currAlg++) { + /* when zero, set size randomly or per user setting */ + switch(currAlg) { + case ALG_MD5: + hmacAlg = kCCHmacAlgMD5; + algStr = "HMACMD5"; + break; + case ALG_SHA1: + hmacAlg = kCCHmacAlgSHA1; + algStr = "HMACSHA1"; + break; + case ALG_SHA224: + hmacAlg = kCCHmacAlgSHA224; + algStr = "HMACSHA224"; + break; + case ALG_SHA256: + hmacAlg = kCCHmacAlgSHA256; + algStr = "HMACSHA256"; + break; + case ALG_SHA384: + hmacAlg = kCCHmacAlgSHA384; + algStr = "HMACSHA384"; + break; + case ALG_SHA512: + hmacAlg = kCCHmacAlgSHA512; + algStr = "HMACSHA512"; + break; + default: + diag("***BRRZAP!\n"); + return -1; + } + if(verbose) { + diag("Testing alg %s\n", algStr); + } + for(loop=0; loop < loops; loop++) { + byteBuffer bb = genRandomByteBuffer(minPtextSize, maxPtextSize); + ptextLen = bb->len; ptext = bb->bytes; + if(!keySizeSpec) { + keySizeInBytes = (uint32_t)genRandomSize(MIN_KEY_SIZE, MAX_KEY_SIZE); + } + + /* per-loop settings */ + if(!stagedSpec) { + stagedOrig = isBitSet(1, loop); + stagedClone = isBitSet(2, loop); + } + + if(!quiet) { + if(verbose || ((loop % LOOP_NOTIFY) == 0)) { + diag("..loop %d ptextLen %4lu keySize %3lu stagedOrig=%d " + "stagedClone=%d\n", + loop, (unsigned long)ptextLen, (unsigned long)keySizeInBytes, + (int)stagedOrig, (int)stagedClone); + } + } + + ok(doHMacCloneTest(ptext, ptextLen, hmacAlg, keySizeInBytes, stagedOrig, stagedClone, quiet, verbose), "HMacClone Test"); + if(loops && (loop == loops)) { + break; + } + free(bb); + } /* main loop */ + + } /* for algs */ + +testDone: + if((rtn != 0) && verbose) { + diag("%s test complete\n", argv[0]); + } + return rtn; +} + +#endif + ADDED CCRegression/CommonCrypto/CommonRSA.c Index: CCRegression/CommonCrypto/CommonRSA.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonRSA.c @@ -0,0 +1,402 @@ + +#include "testbyteBuffer.h" +#include "testmore.h" +#include "capabilities.h" + +#if (CCRSA == 0) +entryPoint(CommonRSA,"RSA Cryptography") +#else + +#include +static int kTestTestCount = 18; + +static bool +RSAVerifyTest(byteBuffer modulus, byteBuffer exponent, byteBuffer message, byteBuffer signature, CCDigestAlgorithm digestSelector, int verbose, CCAsymetricPadding padding) +{ + CCRSACryptorRef CAVPubKey; + CCCryptorStatus retval; + byteBuffer digestValue = mallocByteBuffer(1024); + byteBuffer decodedSignature = mallocByteBuffer(1024); + + retval = CCRSACryptorCreateFromData(ccRSAKeyPublic, modulus->bytes, modulus->len, exponent->bytes, exponent->len, + NULL, 0, NULL, 0, &CAVPubKey); + + ok(retval == 0, "Build a CAVS test public key using CCRSACryptorCreateFromData"); + + CCDigest(digestSelector, message->bytes, message->len, digestValue->bytes); + digestValue->len = CCDigestGetOutputSize(digestSelector); + + if(verbose) { + retval = CCRSACryptorCrypt(CAVPubKey, signature->bytes, 128, decodedSignature->bytes, &decodedSignature->len); + printf("retval = %d\n", retval); + printf("Decoded Signature %s\n", bytesToHexString(decodedSignature)); + printf("Digest of message %s\n\n\n", bytesToHexString(digestValue)); + } + // ccOAEPPadding ccPKCS1Padding ccX931Padding + retval = CCRSACryptorVerify(CAVPubKey, padding, digestValue->bytes, digestValue->len, digestSelector, 0, signature->bytes, signature->len); + printf("CCRSACryptorVerify returned %d\n", retval); + free(digestValue); + free(decodedSignature); + return retval == kCCSuccess; +} + + +static void +RSAX931BuildTest(uint32_t e, + char *xp1str, char *xp2str, char *xpstr, + char *xq1str, char *xq2str, char *xqstr, + char *pstr, char *qstr, char *mstr, char *dstr, + CCRSACryptorRef *retpublicKey, CCRSACryptorRef *retprivateKey) +{ + byteBuffer xp1, xp2, xp, xq1, xq2, xq, p, q, m, d; + int verbose = 1; + CCRSACryptorRef publicKey, privateKey; + + xp1 = hexStringToBytes(xp1str); + xp2 = hexStringToBytes(xp2str); + xp = hexStringToBytes(xpstr); + xq1 = hexStringToBytes(xq1str); + xq2 = hexStringToBytes(xq2str); + xq = hexStringToBytes(xqstr); + p = hexStringToBytes(pstr); + q = hexStringToBytes(qstr); + m = hexStringToBytes(mstr); + d = hexStringToBytes(dstr); + + uint8_t modulus[1024], exponent[1024], pval[1024], qval[1024]; + size_t modulusLength, exponentLength, pLength, qLength; + + modulusLength = exponentLength = pLength = qLength = 1024; + + CCRSACryptorCreatePairFromData(e, + xp1->bytes, xp1->len, xp2->bytes, xp2->len, xp->bytes, xp->len, + xq1->bytes, xq1->len, xq2->bytes, xq2->len, xq->bytes, xq->len, + &publicKey, &privateKey, + pval, &pLength, qval, &qLength, modulus, &modulusLength, exponent, &exponentLength); + /* + retval = CCRSAGetKeyComponents(privateKey, modulus, &modulusLength, exponent, &exponentLength, + pval, &pLength, qval, &qLength); + ok(retval == 0, "got private key components"); + */ + + byteBuffer retP = bytesToBytes(pval, pLength); + byteBuffer retQ = bytesToBytes(qval, qLength); + byteBuffer retD = bytesToBytes(exponent, exponentLength); + byteBuffer retM = bytesToBytes(modulus, modulusLength); + + if(bytesAreEqual(retP, q) && bytesAreEqual(retQ, p)) { + byteBuffer tmp = p; + p = q; + q = tmp; + printf("Swapped P and Q\n"); + } + + ok(bytesAreEqual(retP, p), "p is built correctly"); + ok(bytesAreEqual(retQ, q), "q is built correctly"); + ok(bytesAreEqual(retD, d), "n is built correctly"); + ok(bytesAreEqual(retM, m), "d is built correctly"); + + if(verbose) { + if(!bytesAreEqual(retP, p)) printf("P\nreturned: %s\nexpected: %s\n\n", bytesToHexString(retP), bytesToHexString(p)); + else printf("P is correct\n"); + if(!bytesAreEqual(retQ, q)) printf("Q\nreturned: %s\nexpected: %s\n\n", bytesToHexString(retQ), bytesToHexString(q)); + else printf("Q is correct\n"); + if(!bytesAreEqual(retD, d)) printf("D\nreturned: %s\nexpected: %s\n\n", bytesToHexString(retD), bytesToHexString(d)); + else printf("D is correct\n"); + if(!bytesAreEqual(retM, m)) printf("M\nreturned: %s\nexpected: %s\n\n", bytesToHexString(retM), bytesToHexString(m)); + else printf("M is correct\n"); + } + *retpublicKey = publicKey; + *retprivateKey = privateKey; +} + +int CommonRSA (int argc, char *const *argv) { + CCCryptorStatus retval; + size_t keysize; + CCRSACryptorRef publicKey, privateKey; + byteBuffer keydata, dekeydata, hash; + char encryptedKey[8192]; + size_t encryptedKeyLen = 8192; + char decryptedKey[8192]; + size_t decryptedKeyLen = 8192; + char signature[8192]; + size_t signatureLen = 8192; + // char importexport[8192]; + // size_t importexportLen = 8192; + char inputpadded[128], outputpadded[128]; + int accum = 0; + int debug = 0; + // int verbose = 1; + + + plan_tests(kTestTestCount); + + keysize = 1024; + + if(debug) printf("Keygen\n"); + retval = CCRSACryptorGeneratePair(keysize, 65537, &publicKey, &privateKey); + + ok(retval == 0, "Generate an RSA Key Pair"); + accum += retval; + + if(debug) printf("Encrypt/Decrypt\n"); + keydata = hexStringToBytes("000102030405060708090a0b0c0d0e0f"); + + retval = CCRSACryptorEncrypt(publicKey, ccPKCS1Padding, keydata->bytes, keydata->len, encryptedKey, &encryptedKeyLen, + "murf", 4, kCCDigestSHA1); + + ok(retval == 0, "Wrap Key Data with RSA Encryption - ccPKCS1Padding"); + accum += retval; + + retval = CCRSACryptorDecrypt(privateKey, ccPKCS1Padding, encryptedKey, encryptedKeyLen, + decryptedKey, &decryptedKeyLen,"murf", 4, kCCDigestSHA1); + + ok(retval == 0, "Unwrap Key Data with RSA Encryption - ccPKCS1Padding"); + accum += retval; + + dekeydata = bytesToBytes(decryptedKey, decryptedKeyLen); + + ok(bytesAreEqual(dekeydata, keydata), "Round Trip ccPKCS1Padding"); + accum += !bytesAreEqual(dekeydata, keydata); + + if(debug) printf("Encrypt/Decrypt 2\n"); + + encryptedKeyLen = 8192; + decryptedKeyLen = 8192; + + retval = CCRSACryptorEncrypt(publicKey, ccOAEPPadding, keydata->bytes, keydata->len, encryptedKey, &encryptedKeyLen, + "murf", 4, kCCDigestSHA1); + + ok(retval == 0, "Wrap Key Data with RSA Encryption - ccOAEPPadding"); + accum += retval; + + + retval = CCRSACryptorDecrypt(privateKey, ccOAEPPadding, encryptedKey, encryptedKeyLen, + decryptedKey, &decryptedKeyLen,"murf", 4, kCCDigestSHA1); + + ok(retval == 0, "Unwrap Key Data with RSA Encryption - ccOAEPPadding"); + accum += retval; + + dekeydata = bytesToBytes(decryptedKey, decryptedKeyLen); + + ok(bytesAreEqual(dekeydata, keydata), "Round Trip ccOAEPPadding"); + + if(debug) printf("Sign/Verify\n"); + hash = hexStringToBytes("000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f"); + + retval = CCRSACryptorSign(privateKey, ccPKCS1Padding, + hash->bytes, CCDigestGetOutputSize(kCCDigestSHA256), + kCCDigestSHA256, 16, + signature, &signatureLen); + + ok(retval == 0, "RSA Signing"); + accum += retval; + + retval = CCRSACryptorVerify(publicKey, ccPKCS1Padding, + hash->bytes, CCDigestGetOutputSize(kCCDigestSHA256), + kCCDigestSHA256, 16, + signature, signatureLen); + ok(retval == 0, "RSA Verifying"); + accum += retval; + signatureLen = 8192; + retval = CCRSACryptorSign(privateKey, ccOAEPPadding, + hash->bytes, CCDigestGetOutputSize(kCCDigestSHA1), + kCCDigestSHA1, 16, + signature, &signatureLen); + + ok(retval == 0, "RSA Signing OAEP"); + accum += retval; + + retval = CCRSACryptorVerify(publicKey, ccOAEPPadding, + hash->bytes, CCDigestGetOutputSize(kCCDigestSHA1), + kCCDigestSHA1, 16, + signature, signatureLen); + ok(retval == 0, "RSA Verifying OAEP"); + accum += retval; + +#ifdef NEVER + memset(signature, 5, 8192); + + retval = CCRSACryptorSign(privateKey, ccX931Padding, + hash->bytes, CCDigestGetOutputSize(kCCDigestSHA1), + kCCDigestSHA1, 16, + signature, &signatureLen); + + //diag("Signature retval = %d\n", retval); + + ok(retval == 0, "RSA Signing"); + accum += retval; + + retval = CCRSACryptorVerify(publicKey, ccX931Padding, + hash->bytes, CCDigestGetOutputSize(kCCDigestSHA1), + kCCDigestSHA1, 16, + signature, signatureLen); + ok(retval == 0, "RSA Verifying"); + accum += retval; + + retval = CCRSACryptorExport(publicKey, importexport, &importexportLen); + + ok(retval == 0, "RSA Export Public Key"); + accum += retval; + + retval = CCRSACryptorImport(importexport, importexportLen, &publicKey2); + + ok(retval == 0, "RSA Import Public Key"); + accum += retval; + + importexportLen = 8192; + retval = CCRSACryptorExport(privateKey, importexport, &importexportLen); + + ok(retval == 0, "RSA Export Private Key"); + accum += retval; + + retval = CCRSACryptorImport(importexport, importexportLen, &privateKey2); + + ok(retval == 0, "RSA Import Private Key"); + accum += retval; +#endif + + if(debug) printf("Starting to build key from data\n"); + uint32_t e = 3; + char *xp1, *xp2, *xp, *xq1, *xq2, *xq, *p, *q, *m, *d; + xp1 = "1eaa9ade4a0da46dd40824d814"; + xp2 = "17379044dc2c6105423da807f8"; + xp = "fd3f368d01a95944bc1578f8ae58a9b6c17f529da1599a8bcd361df6efede4176924944e30cbe5c2ddea5648019d2086b95c68588380b8725003b047db88f92a"; + xq1 = "1da08feb13d9fba526190d3756"; + xq2 = "10d93d84466d213a3e776c61f6"; + xq = "f67b5f051126a8956171561b62f572090cde4b09b13f73ee28a90bea2bfb4001fe7b16bd51266524684520e77941dddc56b892ae4bd09dd44acc08bf45dd0a58"; + + + p = "fd3f368d01a95944bc1578f8ae58a9b6c17f529da1599a8bcd361df6efede4176924944e30d114d4c767d573d1149e005267e6fe36c51d86968cf6f65afcb973"; + q = "f67b5f051126a8956171561b62f572090cde4b09b13f73ee28a90bea2bfb4001fe7b16bd5129f06dc6e1f8b4f739c7eb1eb8dcacca3b41cd484fc0c693367037"; + m = "f3d4c9ca2dca5d4b893919ae7bee0d174d1e7bd2190287f79a7db6f21366108e8b0aa37cc972989ff3730d629620076555884da0e895d4e426449c60e36fad1d0208dd4ade1c45fc90da5e76c9c89fd95d13ce76a97530ee83ea3cfbe96cf28f85c4756797cd0123683194b7b2fcd185c3ea984cb0ef90580f95d57a44b027b5"; + d = "28a376f707a1ba3741898447bf525783e22fbf4daed5c153ef14f3d3033bad6d172c7094cc3dc41aa8932ce5c3b0013b8e4162457c18f8d0b10b6f657b3d478482626149773760b0688ded3b1ebf16044273b2cd3924b068c2572dd9cceb4d13afb0cc64ae4da9facefbf66d271d11ef0dcc4e1af2a7dd80b2c984f4e3bf7fad"; + + + RSAX931BuildTest(e, xp1, xp2, xp, xq1, xq2, xq, p, q, m, d, &publicKey, &privateKey); + + e = 0x010001; + xp1 = "155e67ddb99eefb13e4b77a7f0"; + xp2 = "17044df236c14e8ec333e92506"; + xp = "d4f2b30f4f062ad2d05fc742e91bc20ca3ee8a2d126aff592c7de19edb3b884550ddd6f99b0a6b2b785617b46c0995bc112176dbae9a5b7f0bec678e84d6f44c"; + p = "d4f2b30f4f062ad2d05fc742e91bc20ca3ee8a2d126aff592c7de19edb3b884550ddd6f99b13e5dd56ffb2ac1867030f385597e712f65ac8dd1de502857c1a41"; + xq1 = "1e2923b103c935e3788ebd10e4"; + xq2 = "11a2ccec655a8b362b5ec5fcc4"; + xq = "f7c6a68cff2467f300b82591e5123b1d1256546d999a37f4b18fe4896464df6987e7cc80efee3ce4e2f5c7a3cc085bbe33e4d375ed59cbc591f2b3302bd823bc"; + q = "f7c6a68cff2467f300b82591e5123b1d1256546d999a37f4b18fe4896464df6987e7cc80efeeb4c59165f7d1aec9be2b34889dbe221147e7ceefb5c9bd5cb945"; + m = "ce1b6904ec27f4a8f420414860704f4797a202ed16a9a35f63a16511a31675ccb046b02b192ef121b328385922f5faa032113332d42f84c70d4323133e216b0f339ebaf672f6214d0d7c13bea301174485ec44f44fae0e8a7f8d3c81ced5df77723331816158c3added7dc55f1436a7e5f14730be22cf3bebab1b62915c80c85"; + d = "18d16522721b5793169e61ae08eacd291641ac6f8718933313c8a5e66b487393dbb00f5b89334556e4ff5555aa678b2fca07972e2a2db4a3d15d81b639f7852ffe71657918d0280ff1be2f8f5d90b3e68195ab35e5069a3053540958bc6d58489fecf8baab0981f4af7b4db43550bcf01114e5ecdcb18f228db1c617b5d09781"; + RSAX931BuildTest(e, xp1, xp2, xp, xq1, xq2, xq, p, q, m, d, &publicKey, &privateKey); + +#ifdef NEVER + e = 3; + xp1 = "1c36bd0874761109bb0575ee16"; + xp2 = "1777c33935db08546dd66b6d96"; + xp = "d040fa5fe5e32eab84bac6cab4c512dae938cbbe4a29f972b78b149b0b5f6a639e29c0830fa13ca140ac83dda18a1ea7b25122d3c39a10effe7afad4a8b4e77ba42c7912399fcd4f1592a3059188bff536788fe6807e0df8e3d1e7350cf5dd69"; + p = "d040fa5fe5e32eab84bac6cab4c512dae938cbbe4a29f972b78b149b0b5f6a639e29c0830fa13ca140ac83dda18a1ea7b25122d3c39a10effe7afad4a8b4e77ba42c791239acf889977037a0efe181d54b93279b7e46a2fdcf674039fb11e89b"; + xq1 = "14c70e475b12870bc6efd3b944"; + xq2 = "1432548a4959eed65b858cd316"; + xq = "e4d222daf062a01a3a9ddfc82a229613403b772ff05fa9fab1fc77de51744af98b65d47bdb2e8f5091af66002550b1d3ca446738450f8f670045f8465a952a8942079c1e048228c86291bb0ae7665146782021262c49143b5ea37ce400240372"; + q = "e4d222daf062a01a3a9ddfc82a229613403b772ff05fa9fab1fc77de51744af98b65d47bdb2e8f5091af66002550b1d3ca446738450f8f670045f8465a952a8942079c1e04937b7eb94b8d322faefd691b6fa2b0ef4a2333ed791afe8ac3ac41"; + m = "ba24d0a5878c01f6ad9140b6271b42309887a6815d5ef1bc3415a381b7b511a42b8d2b8d9df59faa0b69456ff908e24b4ccb835420404ce449c9ce4ca65dc4ae4eb6bb8403b809d530ef4b37e5b211c13a03e2a69afb8c748b90c97d52023ae9a24c1f1f4b3b87685eaa649f54e41b6439e29700543f0747f09658ed392f96ee568a50ad7b5441c88ad37c581526ff296b1c6cc87e352d4f921960b6b630f8f546f1077a7586b839ee07717de84e0a19cd52eceb358ff2c69387b13a83e5335b"; + d = "1f0622c641420053c7983573b12f35b2c4169bc03a3a7d9f5e039b404948d846074231ecefa8eff1ac918b92a9817b0c8ccc95e35ab562260c4c4d0cc664f61d0d1e7496009eac4e32d28c8950f302f589ab507119d49768c1ed76ea3855b47bfcded5a6137e49706fe2f50213aa1313ad67b8adaef390a46bd7ccbdfa0f5042dcd4749d181613a3c9694314626207c7a7c125ca139742296de412449dd1267d6574d30c5e8bb60844e1f21c76ca41cf3bb805c521553218ce71390055029a6b"; + RSAX931BuildTest(e, xp1, xp2, xp, xq1, xq2, xq, p, q, m, d, &publicKey, &privateKey); + + e = 3; + xp1 = "1408766e2cb2d47ebfee7ea614"; + xp2 = "16292b77507cffd2f798b7c9f2"; + xp = "f74435451a7ddaa163c8c8ad03dfde97fe066360dfee52e3a9d8f41310fdb484e92e302de0b88c6c698a0b4af99ae001758441bbeb74be9d8047d104a9edb60e9e127c5d0cfd5d170ab84b314f71cbeea22006a2916a1dbc66c5be0357def520fd38445d0815f5ac3099afeb6f2d48666d22da9e3c961949459ce399829719c1"; + p = "f74435451a7ddaa163c8c8ad03dfde97fe066360dfee52e3a9d8f41310fdb484e92e302de0b88c6c698a0b4af99ae001758441bbeb74be9d8047d104a9edb60e9e127c5d0cfd5d170ab84b314f71cbeea22006a2916a1dbc66c5be0357def520fd38445d081fbe68dd24e14f0711cc0351fec8641d8ea7d22c4709f233e6349b"; + xq1 = "161d77eb77c6f257d8f8a3b0ca"; + xq2 = "152f11dfc70b78f0fc6c9137b8"; + xq = "c4d3feeb0e561be3727fd83dedaeaaecba01c798e917dd8bb11a03ce07fcf08f6f006ac6137d021912dffffc1aee981c395366fef05718e38aef69f0abf64f8b2cb9750826b8ec854dab1e1280c403169e3497ee9af08bd6d2b53a0d9c49e034220506f7719041f0cced1cc846b853a090ac42af0f699c2c3174606e02800952"; + q = "c4d3feeb0e561be3727fd83dedaeaaecba01c798e917dd8bb11a03ce07fcf08f6f006ac6137d021912dffffc1aee981c395366fef05718e38aef69f0abf64f8b2cb9750826b8ec854dab1e1280c403169e3497ee9af08bd6d2b53a0d9c49e034220506f771942204f0890fb5e617c580aa98a7482b5457215badc119f23b21c3"; + m = "be1cfc39868d8e9a8239f504482be60c01071cbdab4355b03c10edafe85d9ca10689d86036b6d35829a364a8a2b69f28743e50e5e27ac6b6fe8962809e1c2e0765b2d7508d61bfa538085dfb685595c6965bc5e0855a6dd8807a83e2ee7fc50b5b48f2d232195b672f2c325eb6649dee9758ce76f690107f3b0d10afef427777fb0bac0a41e23717fc54d9194a344d1823bdc18fa364e5373da39a3e41bcc4d88a688a711b56c6387b669d37c4fd7878559b93473869ae8190c46605f03cf25038bf771246fb81a27bc9d44ba67bfce94a3051856511661dbe0803d220809695ad707022c4acd24d40e011eb3752e39568f66cdd2d90369a67295e19dadb0d11"; + d = "1faf7f5eebc2426f15b45380b6b1fbacaad684ca4735e39d5f58279d5164ef702bc1a410091e788eb19b3b717073c53168b50d7ba5bf211e7fc1906ac504b25690f323e2c23af546340164ff3c0e43a1190f4ba56b8f124ec0146b507d154b81e48c28785daee49132875dba73bb6fa7c3e42269291802bfdf2cd81d528b13e90a7de94f042d0ac33102095d0ec64b433c9e43c3a4651e215072c5ba3175aff6085efd3f868589487fd4c2fd72be000f1bcb51c20f6fa3d56b97872d6f0ed21e67a896478336340105e6672bf90bb250ac4f487e0973ca17161781f58763f58ac25ddb77b7297da53dddb02661b18dad920fd4dd7b7233f125336dd79e1ef3c9"; + RSAX931BuildTest(e, xp1, xp2, xp, xq1, xq2, xq, p, q, m, d, &publicKey, &privateKey); + + e = 3; + xp1 = "164511563871556a9babc022c8"; + xp2 = "1ae2a7a04f23efe080f48a24b0"; + xp = "db5c4ccf412b17041b6e20b7e0cb45d807ef4da8282428e05e26782fef3251ea2f613d00a134842c6070aa6ebd2c38bb2a28c0f457601b159ae1f5af94dc8c9812f9b4e031ed1f08c64fdb6ffca71c0d3fc93c63596100b2dbce1d6cbf34fae84bccb859397f700114b4bba2e56678360f79c9df784e5f21e995f84fb8622543a48351520012ff80144653efc08ed49e62e17050fa4fc1c98cdd8e40c68f9512e3c687b4cfcc55eb8caeaa3fd44ab8ad00a8389c288eac128c4ee82832e3d0bb"; + p = "db5c4ccf412b17041b6e20b7e0cb45d807ef4da8282428e05e26782fef3251ea2f613d00a134842c6070aa6ebd2c38bb2a28c0f457601b159ae1f5af94dc8c9812f9b4e031ed1f08c64fdb6ffca71c0d3fc93c63596100b2dbce1d6cbf34fae84bccb859397f700114b4bba2e56678360f79c9df784e5f21e995f84fb8622543a48351520012ff80144653efc08ed49e62e17050fa4fc1c98cdd8e40c68f9512e3c687b4d000a836a83d21ea810c683a30e79e5fc8626e78961f076aef2f89ab"; + xq1 = "18ab1ad30607288890b387858a"; + xq2 = "19975a38d9368fa99deda7e986"; + xq = "bd7cc6c56616fb5b41f35d8de2a5c61d1894895dfa46aa95c2de4ea5dfe370eb4543d6670898431d29a9efbbb034347cfaeb8a4c55bcb52dca553dd93ae81fa9ad2bc2b5e6a42c3d3b237648a3907d8a11e6db8b008016064f94168f50fddd791c3d72f729c21e811e68db7ae5400a0f02906462241a33e8faa1c20f48aa12253a80ce75f87a81b37a80079a9ecc42d378ee0e19e913769b738628a14b772673b0fcbf777c55be99f974e1eff5bd8c9d190abff776f246e6614b2f8d81ed812c"; + q = "bd7cc6c56616fb5b41f35d8de2a5c61d1894895dfa46aa95c2de4ea5dfe370eb4543d6670898431d29a9efbbb034347cfaeb8a4c55bcb52dca553dd93ae81fa9ad2bc2b5e6a42c3d3b237648a3907d8a11e6db8b008016064f94168f50fddd791c3d72f729c21e811e68db7ae5400a0f02906462241a33e8faa1c20f48aa12253a80ce75f87a81b37a80079a9ecc42d378ee0e19e913769b738628a14b772673b0fcbf777c640b3b2f869336b823710bb296f32aaba903f90af79239c3d97279"; + m = "a25e0fbcc06a40ac879bba988e78b9df8f88b800077d580b615e3f2f663c9ce631eb0229ee7a4d5166122378bd055f686dd382e63c1564c96127ec191c88d1ba02fcf90f1efcfe29bdfab0fd6413dcb4027512d15c2e337f7111e7acc7679cd1b96581461466ca63af5fbfc0579d322ca02413b75a6dce25c529d6475fafbc5d07504a29039c0f567cbb9dff2938687a6e6d4633f9ae46383536060dc7efb90ff99a6e97449e8f8ad24853f70726953b3f1dc82222f8407f98250f2060777cbd05d0b2ed6abb99d86ac30974df41da16bc1e3abd610df6bcff49a2be932baeedf163911eec026dcbd5937734b47ceb48db97c27bd2a35338f90332b75374ae4404913ae82caf14bba7410c638676a544046aed0b6605562186a4ba6b3695ab25f900899bd03a8f3e68d548b4eadbd9a348a142618954b1b9d73245926d6c57e26454db887c6272280c2d0efff1b856762da7c8be77a0006da3ea589b21ee5efec36574c041d8e506af55de52083225242642cafdcdadfa9663e4424a2bb937d3"; + d = "1b0fad4a2011b5721699f46ec269744fed417400013f8eac903a5fdd3bb4c4d10851d5b1a7bf0ce2e6585b3eca2b8fe6bcf895d10a0390cc3adbfcaeda16cd9f007f7ed7da7f7fb19fa9c82a3b58a4c8ab138322e4b25dea92d85147769144cd9ee6403658bbcc65f28ff54ab944ddb21ab0adf3e467a25ba0dc4e613a9d4a0f81380c5c2b44ad3914c9efaa86debc1467bce108a99d0bb408de5657a1529ed7feef126e8b6fc297230c0dfe813118df352fa15b05d40abfeeb0d7dababe94c9e77e9a8ecb3eebe9823aec87d9f8225aef4465f3dfc5db367a60cf517603a7596a1fbf9e8b08f115b73ecf81b684bfad73c093df30ebc07e434caa87c09d55ab0b674b3858afa1939ba249c7265fd747731f2384d75b5fe6b9e06bbd3110787618290fb73cd42aca08f3f2ee855e393a5e6e835aa77cafc7d329c1dde7655abeeb8d74a015f8d2d36a3bc8939864dfd60da40c63435f76ac1b411af42d5145e95d1b0798a8e8b2ee23edb188228061fa60760993399b16b0cb2246c63ec809f3"; + RSAX931BuildTest(e, xp1, xp2, xp, xq1, xq2, xq, p, q, m, d, &publicKey, &privateKey); + + + e = 3; + xp1 = "1a02a180a22a37d3ab4d5523fe"; + xp2 = "1179fc502dbe82ff9946c00392"; + xp = "d94a30017127e43b0005e99016c2f4efb8e0c91e61805b52478e35fddf3918e7a3a6e68013e5be75fa246981f222f5862ae79fdc67b3f7e849343ef1d0fb13301e314f267f862d33a66bae633a813b8b91518c95bb3dca18c2b6f02c30b0777cd253329cbcf4779d8d437fdff4c60f27738658f163081d08397e1353073f8df24675588ad215e4dc3615a59d2ad9b9815aeecb9a69fa37e036f36f115e909dbb02fd8a96cad3be182947e944e3a281c3cdf1ad35d4fd62c9417dcb0b3c8beffe8e558e6bab154b78ef43117c2808af1255f7c56dadf8e4ebe384f1eca918cae473e32caf7dc2d5250f6fe5ef00f68a997968dce7fbd2066da370a75aad1f7895"; + p = "d94a30017127e43b0005e99016c2f4efb8e0c91e61805b52478e35fddf3918e7a3a6e68013e5be75fa246981f222f5862ae79fdc67b3f7e849343ef1d0fb13301e314f267f862d33a66bae633a813b8b91518c95bb3dca18c2b6f02c30b0777cd253329cbcf4779d8d437fdff4c60f27738658f163081d08397e1353073f8df24675588ad215e4dc3615a59d2ad9b9815aeecb9a69fa37e036f36f115e909dbb02fd8a96cad3be182947e944e3a281c3cdf1ad35d4fd62c9417dcb0b3c8beffe8e558e6bab154b78ef43117c2808af1255f7c56dadf8e4ebe384f1eca918cae473e32caf7dd1126fd14c73ebcce310791625550d6582891713c38ac374993099"; + xq1 = "1fb621dce29cbb6a66cc3bf7d6"; + xq2 = "122325102c2e57c27d462e1e06"; + xq = "facc7f5f089ed9267363bc23c6c7b8f73208a36f61fa8ea8084ff777bc154107068061c4b9ead9788318eab4c3bf05729a4684f845ce9700aa70811530c50440d4ac19e47a47e5e78047e912996a79bbd9416fa10c3720174ccf8f65d32de16b0dd81187f1bee5b992792105f1d0fa191681cd305f3e113617f58b2d4a54c0cfd88db075c956c137e034fa5573fa71d67a8c076ee5e952a53369db3640438ab55e515e75a81861a99303dcc9c6efc7382cec83234742ccacc7b3e9485b002565c7af8351370aae57d26b2f2b93b7e2885429ab172c516593fb5c1b2b43957b273a2c87cf1d368e88c6f65b41815bac0d1cc9e6113d1d06a1f8ebdba6a1097343"; + q = "facc7f5f089ed9267363bc23c6c7b8f73208a36f61fa8ea8084ff777bc154107068061c4b9ead9788318eab4c3bf05729a4684f845ce9700aa70811530c50440d4ac19e47a47e5e78047e912996a79bbd9416fa10c3720174ccf8f65d32de16b0dd81187f1bee5b992792105f1d0fa191681cd305f3e113617f58b2d4a54c0cfd88db075c956c137e034fa5573fa71d67a8c076ee5e952a53369db3640438ab55e515e75a81861a99303dcc9c6efc7382cec83234742ccacc7b3e9485b002565c7af8351370aae57d26b2f2b93b7e2885429ab172c516593fb5c1b2b43957b273a2c87cf1d710fc707b5e6d58b6f3cb377b286466c4da41f592c749ebf97fca3"; + m = "d4e0061c2150cdf177232b89266af9153902cbd434a39cab549d997ed6dadcb4e84bbac6d49658428728a01bd7036bab4b0003f7e6ccf69df1effad985185c4ab0756237e4be92b2f42085d4388a29f461af98649c700d6dad5e0fe352513b578b3bff5f19b144e6304defe1b4fb43b37ecb4ed7c0e97377802d9e79c6d742837b3b71fd101fcf5ead4a114d9419af008a421d8a4c5efd4e6da8cc3c967502bd4cc1bda09e87bf7a1d0badaf0783a6dbef5c98359c59d6bda1cc9bacfaa962c841ddfa3670211e38a68998508ea1a2be519718a168d09cc0d2c1d0f8d56ca1d7199b0c4fc78ddb595f6681e5b1b96309251c0714bf134d46f58419a0273bfaab3328b59d75d8ada5e6e2745e816d17ded27b52f0b5632088ee6bf9675793adc52591abc3eacbf3ae4b59871ac9c94e98708801f534ad0a99791827e91cbacf7afbbd72e162698aeba0380f74462b8dd097fb576a99d70ad2117efee8f6ef51d6afd6fb8ce9b6c234ebf00d24d44ad505305e48af1a8037fed9a2a44235980d395bf69489309d37a04b66f236d223b1af759232ecf9d6556a71cd74c4936fc6d3efe6efb3311eea1574e0cebd657a9d36142f0719b95c98900bd32b9cdb6702ff92a7eefc5ec99c6f12709cb3a118cdaf56284dd195e0633dd689889924c42d3e6579e403bb3ecb08310128c673de301c3bea248f3bd0f63cab3f2545da9f8d6b"; + d = "237aabaf5ae2ccfd93db31ec3111d42e342b21f8b3709a1c8e1a443fce79cf737c0c9f21236e640b1686c559f92b3c9c8c8000a95122291a52fd5479962eba0c72be3b0950ca6dc87e056ba35ec1b1a8baf299661a12ace79ce502a5e30d89e3ec89ffe52ef2e0d1080cfd5048d48b489521e2794ad1933e955cefbef67935c09489e854d8054d3a723702e243599d2ac1b5af970cba7f8d1246ccb4c3be2b1f8ccaf4f01a6bf53f04d7479d2beb4679fd3a195e44b9a3ca45a219f229c6e5cc0afa545e680585097116eeb817c59b1fb843d9703c22c4cacdcaf82978e7704e8444820d4becf9e43a9115a648499081862f5683752de2367e40aef00689ff1c3a83010a2a02fd60bde977c71b5066fea69851107da6b3c26fc24ca84a0b8df91491bb3fda29e49ff7af5dd0adfbe3454739a4dac131bf48163de6a5af29c957017aac4e66c493f81440beaa685ff96c323c0f334dbb057055a96a8e7dd8297d229c9e915f2b3b7a4cb33cb5279df74b710e5b178eb456f56c07d64afb55f513df7dec96c388184208da0db6088d410e9aae8ffb46fdcc7b813d5c6a28c49a65ed1956711fb321b89ec38172747c0e09aee2ce756f84bc2f00703e8c35f9d2448a1b24dfea1c45c50d75ba01fb8eb4ae1cabcf8cc9ee5974fe9c14958958fbddc93c5d40daaa1c22e3ffcd00d9eca5d29d030c3491aacc2bb50d30fb4667bab3"; + RSAX931BuildTest(e, xp1, xp2, xp, xq1, xq2, xq, p, q, m, d, &publicKey, &privateKey); + +#endif + + bzero(inputpadded, 128); + bzero(outputpadded, 128); + bcopy(keydata->bytes, inputpadded, keydata->len); + decryptedKeyLen = 128; + retval = CCRSACryptorCrypt(privateKey, inputpadded, 128, encryptedKey, &encryptedKeyLen); + + ok(retval == 0, "RSA Raw Private Key Crypt"); + accum += retval; + + retval = CCRSACryptorCrypt(publicKey, encryptedKey, encryptedKeyLen, outputpadded, &decryptedKeyLen); + + ok(retval == 0, "RSA Raw Private Key Crypt"); + accum += retval; + bcopy(outputpadded, decryptedKey, keydata->len); + + dekeydata = bytesToBytes(decryptedKey, keydata->len); + ok(bytesAreEqual(dekeydata, keydata), "RSA Raw Encrypt/Decrypt Round-Trip"); + if(!bytesAreEqual(dekeydata, keydata)) { + diag("expected: %s\n", bytesToHexString(keydata)); + diag(" got: %s\n", bytesToHexString(dekeydata)); + diag("len = %d\n", (int) decryptedKeyLen); + } + + + static const uint8_t kAirTunesRSAPublicKey[] = + { + 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xE7, 0xD7, 0x44, 0xF2, 0xA2, 0xE2, 0x78, + 0x8B, 0x6C, 0x1F, 0x55, 0xA0, 0x8E, 0xB7, 0x05, 0x44, 0xA8, 0xFA, 0x79, 0x45, 0xAA, 0x8B, 0xE6, + 0xC6, 0x2C, 0xE5, 0xF5, 0x1C, 0xBD, 0xD4, 0xDC, 0x68, 0x42, 0xFE, 0x3D, 0x10, 0x83, 0xDD, 0x2E, + 0xDE, 0xC1, 0xBF, 0xD4, 0x25, 0x2D, 0xC0, 0x2E, 0x6F, 0x39, 0x8B, 0xDF, 0x0E, 0x61, 0x48, 0xEA, + 0x84, 0x85, 0x5E, 0x2E, 0x44, 0x2D, 0xA6, 0xD6, 0x26, 0x64, 0xF6, 0x74, 0xA1, 0xF3, 0x04, 0x92, + 0x9A, 0xDE, 0x4F, 0x68, 0x93, 0xEF, 0x2D, 0xF6, 0xE7, 0x11, 0xA8, 0xC7, 0x7A, 0x0D, 0x91, 0xC9, + 0xD9, 0x80, 0x82, 0x2E, 0x50, 0xD1, 0x29, 0x22, 0xAF, 0xEA, 0x40, 0xEA, 0x9F, 0x0E, 0x14, 0xC0, + 0xF7, 0x69, 0x38, 0xC5, 0xF3, 0x88, 0x2F, 0xC0, 0x32, 0x3D, 0xD9, 0xFE, 0x55, 0x15, 0x5F, 0x51, + 0xBB, 0x59, 0x21, 0xC2, 0x01, 0x62, 0x9F, 0xD7, 0x33, 0x52, 0xD5, 0xE2, 0xEF, 0xAA, 0xBF, 0x9B, + 0xA0, 0x48, 0xD7, 0xB8, 0x13, 0xA2, 0xB6, 0x76, 0x7F, 0x6C, 0x3C, 0xCF, 0x1E, 0xB4, 0xCE, 0x67, + 0x3D, 0x03, 0x7B, 0x0D, 0x2E, 0xA3, 0x0C, 0x5F, 0xFF, 0xEB, 0x06, 0xF8, 0xD0, 0x8A, 0xDD, 0xE4, + 0x09, 0x57, 0x1A, 0x9C, 0x68, 0x9F, 0xEF, 0x10, 0x72, 0x88, 0x55, 0xDD, 0x8C, 0xFB, 0x9A, 0x8B, + 0xEF, 0x5C, 0x89, 0x43, 0xEF, 0x3B, 0x5F, 0xAA, 0x15, 0xDD, 0xE6, 0x98, 0xBE, 0xDD, 0xF3, 0x59, + 0x96, 0x03, 0xEB, 0x3E, 0x6F, 0x61, 0x37, 0x2B, 0xB6, 0x28, 0xF6, 0x55, 0x9F, 0x59, 0x9A, 0x78, + 0xBF, 0x50, 0x06, 0x87, 0xAA, 0x7F, 0x49, 0x76, 0xC0, 0x56, 0x2D, 0x41, 0x29, 0x56, 0xF8, 0x98, + 0x9E, 0x18, 0xA6, 0x35, 0x5B, 0xD8, 0x15, 0x97, 0x82, 0x5E, 0x0F, 0xC8, 0x75, 0x34, 0x3E, 0xC7, + 0x82, 0x11, 0x76, 0x25, 0xCD, 0xBF, 0x98, 0x44, 0x7B, 0x02, 0x03, 0x01, 0x00, 0x01, 0xD4, 0x9D + }; + + CCRSACryptorRef key; + + retval = CCRSACryptorImport( kAirTunesRSAPublicKey, sizeof( kAirTunesRSAPublicKey ), &key ); + + ok(retval == kCCSuccess, "Imported Airport Key"); + accum += retval; + + return accum != 0; +} +#endif /* CCRSA */ + ADDED CCRegression/CommonCrypto/CommonRandom.c Index: CCRegression/CommonCrypto/CommonRandom.c ================================================================== --- /dev/null +++ CCRegression/CommonCrypto/CommonRandom.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * randomTest + * CommonCrypto + */ +#include "testmore.h" +#include "capabilities.h" +#include "testbyteBuffer.h" + +#if (CCRANDOM == 0) +entryPoint(CommonRandom,"Random Number Generation") +#else +#include + +static const int kTestTestCount = 1000; +static const int bufmax = kTestTestCount + 16; + +int CommonRandom(int argc, char *const *argv) +{ + int i; + uint8_t buf1[bufmax], buf2[bufmax], buf3[bufmax], buf4[bufmax], buf5[bufmax], buf6[bufmax]; + CCRandomRef rngref; + CCRNGStatus retval; + + plan_tests(kTestTestCount *3); + retval = CCRNGCreate(0, &rngref); + + struct ccrng_state *devRandom = ccDevRandomGetRngState(); + struct ccrng_state *drbg = ccDRBGGetRngState(); + for(i=0; i ADDED CCRegression/README Index: CCRegression/README ================================================================== --- /dev/null +++ CCRegression/README @@ -0,0 +1,207 @@ +regression test suite for security components. +by Michael Brouwer + + +GOALS +===== + +The goals of this test setup are to have something that required +0 configuration and setup and allows developers to quickly write +new standalone test cases. + + +USAGE +===== + +The tests are runnable from the top level Makefile by typing: + make test +or individually from the command line or with gdb. Tests will be +built into a directory called build by default or into LOCAL_BUILD_DIR +if you set that in your environment. + + +DIRECTORY LAYOUT +================ + +Currently there are subdirectories for a number of different parts +of the security stack. Each directory contains some of the unit +tests I've managed to find from radar and other places. + +The test programs output their results in a format called TAP. This +is described here: + http://search.cpan.org/~petdance/Test-Harness-2.46/lib/Test/Harness/TAP.pod +Because of this we can use Perl's Test::Harness to run the tests +and produce some nice looking output without the need to write an +entire test harness. + +Tests can be written in C, C++ or Objective-C or perl (using +Test::More in perl). + + +WRITING TESTS +============= + +To add a new test simply copy one of the existing ones and hack away. +Any file with a main() function in it will be built into a test +automatically by the top level Makefile (no configuration required). + +To use the testmore C "library" all you need to do is #include +"testmore.h" in your test program. + +Then in your main function you must call: + +plan_tests(NUMTESTS) where NUMTESTS is the number of test cases you +test program will run. After that you can start writing tests. +There are a couple of macros to help you get started: + +The following are ways to run an actual test case (as in they count +towards the NUMTESTS number above): + +ok(EXPR, NAME) + Evaluate EXPR if it's true the test passes if false it fails. + The second argument is a descriptive name of the test for debugging + purposes. + +is(EXPR, VALUE, NAME) + Evaluate EXPR if it's equal to VALUE the test passes otherwise + it fails. This is equivalent to ok(EXPR == VALUE, NAME) except + this produces nicer output in a failure case. + CAVEAT: Currently EXPR and VALUE must both be type int. + +isnt(EXPR, VALUE, NAME) + Opposite of is() above. + CAVEAT: Currently EXPR and VALUE must both be type int. + +cmp_ok(EXPR, OP, VALUE, NAME) + Succeeds if EXPR OP VALUE is true. Produces a diagnostic if not. + CAVEAT: Currently EXPR and VALUE must both be type int. + +ok_status(EXPR, NAME) + Evaluate EXPR, if it's 0 the test passes otherwise print a + diagnostic with the name and number of the error returned. + +is_status(EXPR, VALUE, NAME) + Evaluate EXPR, if the error returned equals VALUE the test + passes, otherwise print a diagnostic with the expected and + actual error returned. + +ok_unix(EXPR, NAME) + Evaluate EXPR, if it's >= 0 the test passes otherwise print a + diagnostic with the name and number of the errno. + +is_unix(EXPR, VALUE, NAME) + Evaluate EXPR, if the errno set by it equals VALUE the test + passes, otherwise print a diagnostic with the expected and + actual errno. + +Finally if you somehow can't express the success or failure of a +test using the macros above you can use pass(NAME) or fail(NAME) +explicitly. These are equivalent to ok(1, NAME) and ok(0, NAME) +respectively. + + +LEAKS +===== + +If you want to check for leaks in your test you can #include +"testleaks.h" in your program and call: + +ok_leaks(NAME) + Passes if there are no leaks in your program. + +is_leaks(VALUE, NAME) + Passes if there are exactly VALUE leaks in your program. Useful + if you are calling code that is known to leak and you can't fix + it. But you still want to make sure there are no new leaks in + your code. + + +C++ +=== + +For C++ programs you can #include "testcpp.h" which defines these +additional macros: +no_throw(EXPR, NAME) + Success if EXPR doesn't throw. + +does_throw(EXPR, NAME) + Success if EXPR does throw. + +is_throw(EXPR, CLASS, FUNC, VALUE, NAME) + Success if EXPR throws an exception of type CLASS and CLASS.FUNC == VALUE. + Example usage: + is_throw(CssmError::throwMe(42), CssmError, osStatus(), 42, "throwMe(42)"); + + +TODO and SKIP +============= + +Sometimes you write a test case that is known to fail (because you +found a bug). Rather than commenting out that test case you should +put it inside a TODO block. This will cause the test to run but +the failure will not be reported as an error. When the test starts +passing (presumably because someone fixed the bug) you can comment +out the TODO block and leave the test in place. + +The syntax for doing this looks like so: + + TODO: { + todo(" ER: AAPL target: $4,000,000/share"); + + cmp_ok(apple_stock_price(), >=, 4000000, "stock over 4M"); + } + +Sometimes you don't want to run a particular test case or set of +test cases because something in the environment is missing or you +are running on a different version of the OS than the test was +designed for. To achieve this you can use a SKIP block. + +The syntax for a SKIP block looks like so: + + SKIP: { + skip("only runs on Tiger and later", 4, os_version() >= os_tiger); + + ok(tiger_test1(), "test1"); + ok(tiger_test2(), "test2"); + ok(tiger_test3(), "test3"); + ok(tiger_test4(), "test4"); + } + +How it works is like so: If the third argument to skip evaluates +to false it breaks out of the SKIP block and reports N tests as +being skipped (where N is the second argument to skip) The reason +for the test being skipped is given as the first argument to skip. + + +Utility Functions +================= + +Anyone writing tests can add new utility functions. Currently there +is a pair called tests_begin and tests_end. To get them +#include "testenv.h". Calling them doesn't count as running a test +case, unless you wrap them in an ok() macro. tests_begin creates +a unique dir in /tmp and sets HOME in the environment to that dir. +tests_end cleans up the mess that tests_begin made. + +When writing your own utility functions you will probably want to use +the setup("task") macro so that any uses of ok() and other macros +don't count as actual test cases run, but do report errors when they +fail. Here is an example of how tests_end() does this: + +int +tests_end(int result) +{ + setup("tests_end"); + /* Restore previous cwd and remove scratch dir. */ + return (ok_unix(fchdir(current_dir), "fchdir") && + ok_unix(close(current_dir), "close") && + ok_unix(rmdir_recursive(scratch_dir), "rmdir_recursive")); +} + +Setup cases all tests unil the end of the current funtion to not count +against your test cases test count and they output nothing if they +succeed. + +There is also a simple utility header called "testcssm.h" which +currently defines cssm_attach and cssm_detach functions for loading +and initializing cssm and loading a module. ADDED CCRegression/inc/IPC/Run3.pm Index: CCRegression/inc/IPC/Run3.pm ================================================================== --- /dev/null +++ CCRegression/inc/IPC/Run3.pm @@ -0,0 +1,666 @@ +package IPC::Run3; + +$VERSION = 0.010; + +=head1 NAME + +IPC::Run3 - Run a subprocess in batch mode (a la system) on Unix, Win32, etc. + +=head1 SYNOPSIS + + use IPC::Run3; ## Exports run3() by default + use IPC::Run3 (); ## Don't pollute + + run3 \@cmd, \$in, \$out, \$err; + run3 \@cmd, \@in, \&out, \$err; + +=head1 DESCRIPTION + +This module allows you to run a subprocess and redirect stdin, stdout, +and/or stderr to files and perl data structures. It aims to satisfy 99% +of the need for using system()/qx``/open3() with a simple, extremely +Perlish API and none of the bloat and rarely used features of IPC::Run. + +Speed (of Perl code; which is often much slower than the kind of +buffered I/O that this module uses to spool input to and output from the +child command), simplicity, and portability are paramount. Disk space +is not. + +Note that passing in \undef explicitly redirects the associated file +descriptor for STDIN, STDOUT, or STDERR from or to the local equivalent +of /dev/null (this does I pass a closed filehandle). Passing in +"undef" (or not passing a redirection) allows the child to inherit the +corresponding STDIN, STDOUT, or STDERR from the parent. + +Because the redirects come last, this allows STDOUT and STDERR to +default to the parent's by just not specifying them; a common use +case. + +B: This means that: + + run3 \@cmd, undef, \$out; ## Pass on parent's STDIN + +B, it passes on the parent's. Use + + run3 \@cmd, \undef, \$out; ## Close child's STDIN + +for that. It's not ideal, but it does work. + +If the exact same value is passed for $stdout and $stderr, then +the child will write both to the same filehandle. In general, this +means that + + run3 \@cmd, \undef, "foo.txt", "foo.txt"; + run3 \@cmd, \undef, \$both, \$both; + +will DWYM and pass a single file handle to the child for both +STDOUT and STDERR, collecting all into $both. + +=head1 DEBUGGING + +To enable debugging use the IPCRUN3DEBUG environment variable to +a non-zero integer value: + + $ IPCRUN3DEBUG=1 myapp + +. + +=head1 PROFILING + +To enable profiling, set IPCRUN3PROFILE to a number to enable +emitting profile information to STDERR (1 to get timestamps, +2 to get a summary report at the END of the program, +3 to get mini reports after each run) or to a filename to +emit raw data to a file for later analysis. + +=head1 COMPARISON + +Here's how it stacks up to existing APIs: + +=over + +=item compared to system(), qx'', open "...|", open "|...": + +=over + +=item + redirects more than one file descriptor + +=item + returns TRUE on success, FALSE on failure + +=item + throws an error if problems occur in the parent process (or the +pre-exec child) + +=item + allows a very perlish interface to perl data structures and +subroutines + +=item + allows 1 word invocations to avoid the shell easily: + + run3 ["foo"]; ## does not invoke shell + +=item - does not return the exit code, leaves it in $? + +=back + +=item compared to open2(), open3(): + +=over + +=item + No lengthy, error prone polling / select loop needed + +=item + Hides OS dependancies + +=item + Allows SCALAR, ARRAY, and CODE references to source and sink I/O + +=item + I/O parameter order is like open3() (not like open2()). + +=item - Does not allow interaction with the subprocess + +=back + +=item compared to IPC::Run::run(): + +=over + +=item + Smaller, lower overhead, simpler, more portable + +=item + No select() loop portability issues + +=item + Does not fall prey to Perl closure leaks + +=item - Does not allow interaction with the subprocess (which +IPC::Run::run() allows by redirecting subroutines). + +=item - Lacks many features of IPC::Run::run() (filters, pipes, +redirects, pty support). + +=back + +=back + +=cut + +@EXPORT = qw( run3 ); +%EXPORT_TAGS = ( all => \@EXPORT ); +@ISA = qw( Exporter ); +use Exporter; + +use strict; +use constant debugging => $ENV{IPCRUN3DEBUG} || $ENV{IPCRUNDEBUG} || 0; +use constant profiling => $ENV{IPCRUN3PROFILE} || $ENV{IPCRUNPROFILE} || 0; +use constant is_win32 => 0 <= index $^O, "Win32"; + +BEGIN { + if ( is_win32 ) { + eval "use Win32 qw( GetOSName ); 1" or die $@; + } +} + +#use constant is_win2k => is_win32 && GetOSName() =~ /Win2000/i; +#use constant is_winXP => is_win32 && GetOSName() =~ /WinXP/i; + +use Carp qw( croak ); +use File::Temp qw( tempfile ); +use UNIVERSAL qw( isa ); +use POSIX qw( dup dup2 ); + +## We cache the handles of our temp files in order to +## keep from having to incur the (largish) overhead of File::Temp +my %fh_cache; + +my $profiler; + +sub _profiler { $profiler } ## test suite access + +BEGIN { + if ( profiling ) { + eval "use Time::HiRes qw( gettimeofday ); 1" or die $@; + if ( $ENV{IPCRUN3PROFILE} =~ /\A\d+\z/ ) { + require IPC::Run3::ProfPP; + $profiler = IPC::Run3::ProfPP->new( + Level => $ENV{IPCRUN3PROFILE}, + ); + } + else { + my ( $dest, undef, $class ) = + reverse split /(=)/, $ENV{IPCRUN3PROFILE}, 2; + $class = "IPC::Run3::ProfLogger" + unless defined $class && length $class; + unless ( eval "require $class" ) { + my $x = $@; + $class = "IPC::Run3::$class"; + eval "require IPC::Run3::$class" or die $x; + } + $profiler = $class->new( + Destination => $dest, + ); + } + $profiler->app_call( [ $0, @ARGV ], scalar gettimeofday() ); + } +} + + +END { + $profiler->app_exit( scalar gettimeofday() ) if profiling; +} + + +sub _spool_data_to_child { + my ( $type, $source, $binmode_it ) = @_; + + ## If undef (not \undef) passed, they want the child to inherit + ## the parent's STDIN. + return undef unless defined $source; + warn "binmode()ing STDIN\n" if is_win32 && debugging && $binmode_it; + + my $fh; + if ( ! $type ) { + local *FH; ## Do this the backcompat way + open FH, "<$source" or croak "$!: $source"; + $fh = *FH{IO}; + if ( is_win32 ) { + binmode ":raw"; ## Remove all layers + binmode ":crlf" unless $binmode_it; + } + warn "run3(): feeding file '$source' to child STDIN\n" + if debugging >= 2; + } + elsif ( $type eq "FH" ) { + $fh = $source; + warn "run3(): feeding filehandle '$source' to child STDIN\n" + if debugging >= 2; + } + else { + $fh = $fh_cache{in} ||= tempfile; + truncate $fh, 0; + seek $fh, 0, 0; + if ( is_win32 ) { + binmode $fh, ":raw"; ## Remove any previous layers + binmode $fh, ":crlf" unless $binmode_it; + } + my $seekit; + if ( $type eq "SCALAR" ) { + + ## When the run3()'s caller asks to feed an empty file + ## to the child's stdin, we want to pass a live file + ## descriptor to an empty file (like /dev/null) so that + ## they don't get surprised by invalid fd errors and get + ## normal EOF behaviors. + return $fh unless defined $$source; ## \undef passed + + warn "run3(): feeding SCALAR to child STDIN", + debugging >= 3 + ? ( ": '", $$source, "' (", length $$source, " chars)" ) + : (), + "\n" + if debugging >= 2; + + $seekit = length $$source; + print $fh $$source or die "$! writing to temp file"; + + } + elsif ( $type eq "ARRAY" ) { + warn "run3(): feeding ARRAY to child STDIN", + debugging >= 3 ? ( ": '", @$source, "'" ) : (), + "\n" + if debugging >= 2; + + print $fh @$source or die "$! writing to temp file"; + $seekit = grep length, @$source; + } + elsif ( $type eq "CODE" ) { + warn "run3(): feeding output of CODE ref '$source' to child STDIN\n" + if debugging >= 2; + my $parms = []; ## TODO: get these from $options + while (1) { + my $data = $source->( @$parms ); + last unless defined $data; + print $fh $data or die "$! writing to temp file"; + $seekit = length $data; + } + } + + seek $fh, 0, 0 or croak "$! seeking on temp file for child's stdin" + if $seekit; + } + + croak "run3() can't redirect $type to child stdin" + unless defined $fh; + + return $fh; +} + + +sub _fh_for_child_output { + my ( $what, $type, $dest, $binmode_it ) = @_; + + my $fh; + if ( $type eq "SCALAR" && $dest == \undef ) { + warn "run3(): redirecting child $what to oblivion\n" + if debugging >= 2; + + $fh = $fh_cache{nul} ||= do { + local *FH; + open FH, ">" . File::Spec->devnull; + *FH{IO}; + }; + } + elsif ( !$type ) { + warn "run3(): feeding child $what to file '$dest'\n" + if debugging >= 2; + + local *FH; + open FH, ">$dest" or croak "$!: $dest"; + $fh = *FH{IO}; + } + else { + warn "run3(): capturing child $what\n" + if debugging >= 2; + + $fh = $fh_cache{$what} ||= tempfile; + seek $fh, 0, 0; + truncate $fh, 0; + } + + if ( is_win32 ) { + warn "binmode()ing $what\n" if debugging && $binmode_it; + binmode $fh, ":raw"; + binmode $fh, ":crlf" unless $binmode_it; + } + return $fh; +} + + +sub _read_child_output_fh { + my ( $what, $type, $dest, $fh, $options ) = @_; + + return if $type eq "SCALAR" && $dest == \undef; + + seek $fh, 0, 0 or croak "$! seeking on temp file for child $what"; + + if ( $type eq "SCALAR" ) { + warn "run3(): reading child $what to SCALAR\n" + if debugging >= 3; + + ## two read()s are used instead of 1 so that the first will be + ## logged even it reads 0 bytes; the second won't. + my $count = read $fh, $$dest, 10_000; + while (1) { + croak "$! reading child $what from temp file" + unless defined $count; + + last unless $count; + + warn "run3(): read $count bytes from child $what", + debugging >= 3 ? ( ": '", substr( $$dest, -$count ), "'" ) : (), + "\n" + if debugging >= 2; + + $count = read $fh, $$dest, 10_000, length $$dest; + } + } + elsif ( $type eq "ARRAY" ) { + @$dest = <$fh>; + if ( debugging >= 2 ) { + my $count = 0; + $count += length for @$dest; + warn + "run3(): read ", + scalar @$dest, + " records, $count bytes from child $what", + debugging >= 3 ? ( ": '", @$dest, "'" ) : (), + "\n"; + } + } + elsif ( $type eq "CODE" ) { + warn "run3(): capturing child $what to CODE ref\n" + if debugging >= 3; + + local $_; + while ( <$fh> ) { + warn + "run3(): read ", + length, + " bytes from child $what", + debugging >= 3 ? ( ": '", $_, "'" ) : (), + "\n" + if debugging >= 2; + + $dest->( $_ ); + } + } + else { + croak "run3() can't redirect child $what to a $type"; + } + +# close $fh; +} + + +sub _type { + my ( $redir ) = @_; + return "FH" if isa $redir, "IO::Handle"; + my $type = ref $redir; + return $type eq "GLOB" ? "FH" : $type; +} + + +sub _max_fd { + my $fd = dup(0); + POSIX::close $fd; + return $fd; +} + +my $run_call_time; +my $sys_call_time; +my $sys_exit_time; + +sub run3 { + $run_call_time = gettimeofday() if profiling; + + my $options = @_ && ref $_[-1] eq "HASH" ? pop : {}; + + my ( $cmd, $stdin, $stdout, $stderr ) = @_; + + print STDERR "run3(): running ", + join( " ", map "'$_'", ref $cmd ? @$cmd : $cmd ), + "\n" + if debugging; + + if ( ref $cmd ) { + croak "run3(): empty command" unless @$cmd; + croak "run3(): undefined command" unless defined $cmd->[0]; + croak "run3(): command name ('')" unless length $cmd->[0]; + } + else { + croak "run3(): missing command" unless @_; + croak "run3(): undefined command" unless defined $cmd; + croak "run3(): command ('')" unless length $cmd; + } + + my $in_type = _type $stdin; + my $out_type = _type $stdout; + my $err_type = _type $stderr; + + ## This routine procedes in stages so that a failure in an early + ## stage prevents later stages from running, and thus from needing + ## cleanup. + + my $in_fh = _spool_data_to_child $in_type, $stdin, + $options->{binmode_stdin} if defined $stdin; + + my $out_fh = _fh_for_child_output "stdout", $out_type, $stdout, + $options->{binmode_stdout} if defined $stdout; + + my $tie_err_to_out = + defined $stderr && defined $stdout && $stderr eq $stdout; + + my $err_fh = $tie_err_to_out + ? $out_fh + : _fh_for_child_output "stderr", $err_type, $stderr, + $options->{binmode_stderr} if defined $stderr; + + ## this should make perl close these on exceptions + local *STDIN_SAVE; + local *STDOUT_SAVE; + local *STDERR_SAVE; + + my $saved_fd0 = dup( 0 ) if defined $in_fh; + +# open STDIN_SAVE, "<&STDIN"# or croak "run3(): $! saving STDIN" +# if defined $in_fh; + open STDOUT_SAVE, ">&STDOUT" or croak "run3(): $! saving STDOUT" + if defined $out_fh; + open STDERR_SAVE, ">&STDERR" or croak "run3(): $! saving STDERR" + if defined $err_fh; + + my $ok = eval { + ## The open() call here seems to not force fd 0 in some cases; + ## I ran in to trouble when using this in VCP, not sure why. + ## the dup2() seems to work. + dup2( fileno $in_fh, 0 ) +# open STDIN, "<&=" . fileno $in_fh + or croak "run3(): $! redirecting STDIN" + if defined $in_fh; + +# close $in_fh or croak "$! closing STDIN temp file" +# if ref $stdin; + + open STDOUT, ">&" . fileno $out_fh + or croak "run3(): $! redirecting STDOUT" + if defined $out_fh; + + open STDERR, ">&" . fileno $err_fh + or croak "run3(): $! redirecting STDERR" + if defined $err_fh; + + $sys_call_time = gettimeofday() if profiling; + + my $r = ref $cmd + ? system {$cmd->[0]} + is_win32 + ? map { + ## Probably need to offer a win32 escaping + ## option, every command may be different. + ( my $s = $_ ) =~ s/"/"""/g; + $s = qq{"$s"}; + $s; + } @$cmd + : @$cmd + : system $cmd; + + $sys_exit_time = gettimeofday() if profiling; + + unless ( defined $r ) { + if ( debugging ) { + my $err_fh = defined $err_fh ? \*STDERR_SAVE : \*STDERR; + print $err_fh "run3(): system() error $!\n" + } + die $!; + } + + if ( debugging ) { + my $err_fh = defined $err_fh ? \*STDERR_SAVE : \*STDERR; + print $err_fh "run3(): \$? is $?\n" + } + 1; + }; + my $x = $@; + + my @errs; + + if ( defined $saved_fd0 ) { + dup2( $saved_fd0, 0 ); + POSIX::close( $saved_fd0 ); + } + +# open STDIN, "<&STDIN_SAVE"# or push @errs, "run3(): $! restoring STDIN" +# if defined $in_fh; + open STDOUT, ">&STDOUT_SAVE" or push @errs, "run3(): $! restoring STDOUT" + if defined $out_fh; + open STDERR, ">&STDERR_SAVE" or push @errs, "run3(): $! restoring STDERR" + if defined $err_fh; + + croak join ", ", @errs if @errs; + + die $x unless $ok; + + _read_child_output_fh "stdout", $out_type, $stdout, $out_fh, $options + if defined $out_fh && $out_type && $out_type ne "FH"; + _read_child_output_fh "stderr", $err_type, $stderr, $err_fh, $options + if defined $err_fh && $err_type && $err_type ne "FH" && !$tie_err_to_out; + $profiler->run_exit( + $cmd, + $run_call_time, + $sys_call_time, + $sys_exit_time, + scalar gettimeofday + ) if profiling; + + return 1; +} + +my $in_fh; +my $in_fd; +my $out_fh; +my $out_fd; +my $err_fh; +my $err_fd; + $in_fh = tempfile; + $in_fd = fileno $in_fh; + $out_fh = tempfile; + $out_fd = fileno $out_fh; + $err_fh = tempfile; + $err_fd = fileno $err_fh; + my $saved_fd0 = dup 0; + my $saved_fd1 = dup 1; + my $saved_fd2 = dup 2; + my $r; + my ( $cmd, $stdin, $stdout, $stderr ); + +sub _run3 { + ( $cmd, $stdin, $stdout, $stderr ) = @_; + + truncate $in_fh, 0; + seek $in_fh, 0, 0; + + print $in_fh $$stdin or die "$! writing to temp file"; + seek $in_fh, 0, 0; + + seek $out_fh, 0, 0; + truncate $out_fh, 0; + + seek $err_fh, 0, 0; + truncate $err_fh, 0; + + dup2 $in_fd, 0 or croak "run3(): $! redirecting STDIN"; + dup2 $out_fd, 1 or croak "run3(): $! redirecting STDOUT"; + dup2 $err_fd, 2 or croak "run3(): $! redirecting STDERR"; + + $r = + system {$cmd->[0]} + is_win32 + ? map { + ## Probably need to offer a win32 escaping + ## option, every command is different. + ( my $s = $_ ) =~ s/"/"""/g; + $s = q{"$s"} if /[^\w.:\/\\'-]/; + $s; + } @$cmd + : @$cmd; + + die $! unless defined $r; + + dup2 $saved_fd0, 0; + dup2 $saved_fd1, 1; + dup2 $saved_fd2, 2; + + seek $out_fh, 0, 0 or croak "$! seeking on temp file for child output"; + + my $count = read $out_fh, $$stdout, 10_000; + while ( $count == 10_000 ) { + $count = read $out_fh, $$stdout, 10_000, length $$stdout; + } + croak "$! reading child output from temp file" + unless defined $count; + + seek $err_fh, 0, 0 or croak "$! seeking on temp file for child errput"; + + $count = read $err_fh, $$stderr, 10_000; + while ( $count == 10_000 ) { + $count = read $err_fh, $$stderr, 10_000, length $$stdout; + } + croak "$! reading child stderr from temp file" + unless defined $count; + + return 1; +} + +=cut + + +=head1 TODO + +pty support + +=head1 LIMITATIONS + +Often uses intermediate files (determined by File::Temp, and thus by the +File::Spec defaults and the TMPDIR env. variable) for speed, portability and +simplicity. + +=head1 COPYRIGHT + + Copyright 2003, R. Barrie Slaymaker, Jr., All Rights Reserved + +=head1 LICENSE + +You may use this module under the terms of the BSD, Artistic, or GPL licenses, +any version. + +=head1 AUTHOR + +Barrie Slaymaker + +=cut + +1; ADDED CCRegression/inc/MyHarness.pm Index: CCRegression/inc/MyHarness.pm ================================================================== --- /dev/null +++ CCRegression/inc/MyHarness.pm @@ -0,0 +1,29 @@ +use warnings; +use strict; + +package MyStraps; +use base qw( Test::Harness::Straps ); + +sub _command_line { + my $self = shift; + my $file = shift; + + $file = qq["$file"] if ($file =~ /\s/) && ($file !~ /^".*"$/); + my $line = "$file"; + + return $line; +} + +sub _default_inc { + return @INC; +} + +package MyHarness; +use base qw( Test::Harness ); + +#my $Strap = MyStraps->new(); +$Test::Harness::Strap = MyStraps->new(); + +sub strap { return $Test::Harness::Strap } + +1; ADDED CCRegression/main.c Index: CCRegression/main.c ================================================================== --- /dev/null +++ CCRegression/main.c @@ -0,0 +1,11 @@ +#include + + +#include "testenv.h" + +int main (int argc, char * const *argv) { + + printf("WARNING: If running those tests on a device with a passcode, DONT FORGET TO UNLOCK!!!\n"); + tests_begin(argc, argv); + return 0; +} ADDED CCRegression/runscript/security.pl Index: CCRegression/runscript/security.pl ================================================================== --- /dev/null +++ CCRegression/runscript/security.pl @@ -0,0 +1,68 @@ +#!/usr/bin/perl -w +# +# Copyright (c) 2006-2007 Apple Inc. All Rights Reserved. +# + +my $pid = $$; + +END { + return unless $$ == $pid; + rm_test($_) for @TOCLEAN; +} + +use strict; +use Test::More; +use IPC::Run3; + +sub plan_security { + + unless (1) { + plan skip_all => "security not installed"; + exit; + }; + plan @_; +} + +use Carp; +our @TOCLEAN; +END { + return unless $$ == $pid; + $SIG{__WARN__} = sub { 1 }; + cleanup_test($_) for @TOCLEAN; +} + +our $output = ''; + +sub build_test { + my $xd = "/tmp/test-$pid"; + my $security = 'security'; + $ENV{HOME} = $xd; + push @TOCLEAN, [$xd, $security]; + return ($xd, $security); +} + +sub rm_test { + my ($xd, $security) = @{+shift}; + #rmtree [$xd]; +} + +sub cleanup_test { + return unless $ENV{TEST_VERBOSE}; + my ($xd, $security) = @{+shift}; +} + +sub is_output { + my ($security, $cmd, $arg, $expected, $test) = @_; + $output = ''; + run3([$security, $cmd, @$arg], \undef, \$output, \$output); +# open(STDOUT, ">&STDERR") || die "couldn't dup strerr: $!"; +# open(my $out, '-|', $security, $cmd, @$arg); +# while (<$out>) { $output .= $_; } + + my $cmp = (grep {ref ($_) eq 'Regexp'} @$expected) + ? \&is_deeply_like : \&is_deeply; + @_ = ([sort split (/\r?\n/, $output)], [sort @$expected], $test || join(' ', $cmd, @$arg)); + goto &$cmp; +} + +1; ADDED CCRegression/test/00testtest.c Index: CCRegression/test/00testtest.c ================================================================== --- /dev/null +++ CCRegression/test/00testtest.c @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2006-2007 Apple Inc. All Rights Reserved. + */ + +#include + +#include "testmore.h" + +int main(int argc, char *const *argv) +{ + int rv = 1; + plan_tests(6); + + TODO: { + todo("ok 0 is supposed to fail"); + + rv = ok(0, "ok bad"); + if (!rv) + diag("ok bad not good today"); + } + rv &= ok(1, "ok ok"); +#if 0 + SKIP: { + skip("is bad will fail", 1, 0); + + if (!is(0, 4, "is bad")) + diag("is bad not good today"); + } + SKIP: { + skip("is ok should not be skipped", 1, 1); + + is(3, 3, "is ok"); + } +#endif + isnt(0, 4, "isnt ok"); + TODO: { + todo("isnt bad is supposed to fail"); + + isnt(3, 3, "isnt bad"); + } + TODO: { + todo("cmp_ok bad is supposed to fail"); + + cmp_ok(3, &&, 0, "cmp_ok bad"); + } + cmp_ok(3, &&, 3, "cmp_ok ok"); + + return 0; +} ADDED CCRegression/test/run_tests.sh Index: CCRegression/test/run_tests.sh ================================================================== --- /dev/null +++ CCRegression/test/run_tests.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +# run_tests.sh +# Security +# +# Created by Fabrice Gautier on 8/26/10. +# Modified for use with CommonCrypto on 3/10/11 +# Copyright 2011 Apple, Inc. All rights reserved. + + +# Run a command line tool on the sim or the device + +CMD=CCRegressions + +if [ "${PLATFORM_NAME}" == "iphoneos" ]; then + INSTALL_DIR= + SCP_URL=phone:${INSTALL_DIR} +#copy libcommonCrypto.dylib and CCRegressions program to the device, to /tmp +#this will not replace the system CommonCrypto. +#it is assumed that ssh is pre-setup on the device with pubkey authentication + export RSYNC_PASSWORD=alpine + echo "run_tests.sh:${LINENO}: note: Copying stuff to device" + # scp ${CONFIGURATION_BUILD_DIR}/libcommonCrypto.dylib ${SCP_URL} + scp ${CONFIGURATION_BUILD_DIR}/CCRegressions ${SCP_URL} + echo "run_tests.sh:${LINENO}: note: Running the test" + xcrun -sdk "$SDKROOT" PurpleExec --env "DYLD_FRAMEWORK_PATH=${INSTALL_DIR}" --cmd ${INSTALL_DIR}/${CMD} +else + echo "run_tests.sh:${LINENO}: note: Running test on simulator (${BUILT_PRODUCTS_DIR}/${CMD})" + export DYLD_ROOT_PATH="${SDKROOT}" + export DYLD_LIBRARY_PATH="${BUILT_PRODUCTS_DIR}" + export DYLD_FRAMEWORK_PATH="${BUILT_PRODUCTS_DIR}" + ${BUILT_PRODUCTS_DIR}/${CMD} +fi + + ADDED CCRegression/test/testcpp.h Index: CCRegression/test/testcpp.h ================================================================== --- /dev/null +++ CCRegression/test/testcpp.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + * + * testcpp.h + */ + +#ifndef _TESTCPP_H_ +#define _TESTCPP_H_ 1 + +#include "testmore.h" + +#ifdef __cplusplus + +#define no_throw(THIS, TESTNAME) \ +({ \ + bool _this; \ + try { THIS; _this = true; } catch (...) { _this = false; } \ + test_ok(_this, TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# got: \n" \ + "# expected: \n"); \ +}) +#define does_throw(THIS, TESTNAME) \ +({ \ + bool _this; \ + try { THIS; _this = false; } catch (...) { _this = true; } \ + test_ok(_this, TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# got: \n" \ + "# expected: \n"); \ +}) +#define is_throw(THIS, CLASS, METHOD, VALUE, TESTNAME) \ +({ \ + bool _this; \ + try \ + { \ + THIS; \ + _this = test_ok(false, TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# got: \n" \ + "# expected: %s.%s == %s\n", \ + #CLASS, #METHOD, #VALUE); \ + } \ + catch (const CLASS &_exception) \ + { \ + _this = test_ok(_exception.METHOD == (VALUE), TESTNAME, \ + test_directive, test_reason, __FILE__, __LINE__, \ + "# got: %d\n" \ + "# expected: %s.%s == %s\n", \ + _exception.METHOD, #CLASS, #METHOD, #VALUE); \ + } \ + catch (...) \ + { \ + _this = test_ok(false, TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# got: \n" \ + "# expected: %s.%s == %s\n", \ + #CLASS, #METHOD, #VALUE); \ + } \ + _this; \ +}) +#endif /* __cplusplus */ + +#endif /* !_TESTCPP_H_ */ ADDED CCRegression/test/testenv.c Index: CCRegression/test/testenv.c ================================================================== --- /dev/null +++ CCRegression/test/testenv.c @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2005-2007,2009-2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + * + * testenv.c + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "testmore.h" +#include "testenv.h" + +#if NO_SERVER +#include + +static int current_dir = -1; +static char scratch_dir[50]; +static char *home_var; +static bool keep_scratch_dir = false; + +static int +rmdir_recursive(const char *path) +{ + char command_buf[256]; + if (strlen(path) + 10 > sizeof(command_buf) || strchr(path, '\'')) + { + fprintf(stderr, "# rmdir_recursive: invalid path: %s", path); + return -1; + } + + sprintf(command_buf, "rm -rf '%s'", path); + return system(command_buf); +} +#endif + +static int tests_init(void) { + printf("[TEST] CommonCrypto\n"); +#if NO_SERVER + char preferences_dir[80]; + char library_dir[70]; + + securityd_init(); + + setup("tests_init"); + + /* Create scratch dir for tests to run in. */ + sprintf(scratch_dir, "/tmp/tst-%d", getpid()); + if (keep_scratch_dir) { + printf("running tests with HOME=%s\n", scratch_dir); + } + sprintf(library_dir, "%s/Library", scratch_dir); + sprintf(preferences_dir, "%s/Preferences", library_dir); + return (ok_unix(mkdir(scratch_dir, 0755), "mkdir") && + ok_unix(current_dir = open(".", O_RDONLY), "open") && + ok_unix(chdir(scratch_dir), "chdir") && + ok_unix(setenv("HOME", scratch_dir, 1), "setenv") && + /* @@@ Work around a bug that the prefs code in + libsecurity_keychain never creates the Library/Preferences + dir. */ + ok_unix(mkdir(library_dir, 0755), "mkdir") && + ok_unix(mkdir(preferences_dir, 0755), "mkdir") && + ok(home_var = getenv("HOME"), "getenv")); + +#else + return 0; +#endif +} + +static int +tests_end(void) +{ + printf("[SUMMARY]\n"); +#if NO_SERVER + setup("tests_end"); + /* Restore previous cwd and remove scratch dir. */ + int ok = ok_unix(fchdir(current_dir), "fchdir"); + if (ok) + ok = ok_unix(close(current_dir), "close"); + if (ok) { + if (!keep_scratch_dir) { + ok = ok_unix(rmdir_recursive(scratch_dir), "rmdir_recursive"); + } + } + + return ok; +#else + return 0; +#endif +} + +static void usage(const char *progname) +{ + fprintf(stderr, "usage: %s [-k][-w][testname [testargs] ...]\n", progname); + exit(1); +} + +static int tests_run_index(int i, int argc, char * const *argv) +{ + int verbose = 0; + int ch; + + while ((ch = getopt(argc, argv, "v")) != -1) + { + switch (ch) + { + case 'v': + verbose++; + break; + default: + usage(argv[0]); + } + } + + fprintf(stderr, "[BEGIN] %s\n", testlist[i].name); + + run_one_test(&testlist[i], argc, argv); + if(testlist[i].failed_tests) { + fprintf(stderr, "[FAIL] %s\n", testlist[i].name); + } else { + fprintf(stderr, "duration: %u ms\n", testlist[i].duration); + fprintf(stderr, "[PASS] %s\n", testlist[i].name); + } + + return 0; +} + +static int tests_named_index(const char *testcase) +{ + int i; + + for (i = 0; testlist[i].name; ++i) { + if (strcmp(testlist[i].name, testcase) == 0) { + return i; + } + } + + return -1; +} + +static int tests_run_all(int argc, char * const *argv) +{ + int curroptind = optind; + int i; + + for (i = 0; testlist[i].name; ++i) { + tests_run_index(i, argc, argv); + optind = curroptind; + } + + return 0; +} + +int +tests_begin(int argc, char * const *argv) +{ + const char *testcase = NULL; + bool initialized = false; + int testix = -1; + int ch; + + for (;;) { + while (!testcase && (ch = getopt(argc, argv, "kw")) != -1) + { + switch (ch) + { +#ifdef NO_SERVER + case 'k': + keep_scratch_dir = true; + break; +#endif + case 'w': + sleep(100); + break; + case '?': + default: + printf("invalid option %c\n",ch); + usage(argv[0]); + } + } + + if (optind < argc) { + testix = tests_named_index(argv[optind]); + if(testix<0) { + printf("invalid test %s\n",argv[optind]); + usage(argv[0]); + } + } + + if (testix < 0) { + if (!initialized) { + initialized = true; + tests_init(); + tests_run_all(argc, argv); + } + break; + } else { + if (!initialized) { + tests_init(); + initialized = true; + } + optind++; + tests_run_index(testix, argc, argv); + testix = -1; + } + } + + /* Cleanups */ + tests_end(); + + return 0; +} + ADDED CCRegression/test/testenv.h Index: CCRegression/test/testenv.h ================================================================== --- /dev/null +++ CCRegression/test/testenv.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + * + * testenv.h + */ + +#ifndef _TESTENV_H_ +#define _TESTENV_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +int tests_begin(int argc, char * const *argv); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* !_TESTENV_H_ */ ADDED CCRegression/test/testlist.c Index: CCRegression/test/testlist.c ================================================================== --- /dev/null +++ CCRegression/test/testlist.c @@ -0,0 +1,15 @@ +/* This file contains an array of all test functions, last element is NULL */ + +#include "testmore.h" +#include "testlist.h" + +#define ONE_TEST(x) {#x, x, 0 , 0, 0 }, +#define DISABLED_ONE_TEST(x) +struct one_test_s testlist[] = { +#include "testlistInc.h" + { NULL, NULL, 0, 0, 0}, +}; +#undef ONE_TEST +#undef DISABLED_ONE_TEST + + ADDED CCRegression/test/testlist.h Index: CCRegression/test/testlist.h ================================================================== --- /dev/null +++ CCRegression/test/testlist.h @@ -0,0 +1,15 @@ + +/* This file contains all the prototypes for all the test functions */ +#ifndef __TESTLIST_H__ +#define __TESTLIST_H__ + + +#define ONE_TEST(x) int x(int argc, char *const *argv); +#define DISABLED_ONE_TEST(x) ONE_TEST(x) +#include "testlistInc.h" +#undef ONE_TEST +#undef DISABLED_ONE_TEST + + +#endif /* __TESTLIST_H__ */ + ADDED CCRegression/test/testlistInc.h Index: CCRegression/test/testlistInc.h ================================================================== --- /dev/null +++ CCRegression/test/testlistInc.h @@ -0,0 +1,25 @@ +/* To add a test, just add it here */ + +ONE_TEST(CommonRandom) +ONE_TEST(CommonEC) +ONE_TEST(CommonRSA) +ONE_TEST(CommonHMacClone) +ONE_TEST(CommonCMac) +ONE_TEST(CommonCryptoSymCBC) +ONE_TEST(CommonCryptoSymOFB) +ONE_TEST(CommonCryptoSymGCM) +ONE_TEST(CommonCryptoSymCTR) +ONE_TEST(CommonCryptoSymXTS) +ONE_TEST(CommonCryptoSymRC2) +ONE_TEST(CommonCryptoSymRegression) +ONE_TEST(CommonCryptoSymOffset) +ONE_TEST(CommonCryptoSymZeroLength) +ONE_TEST(CommonCryptoSymCFB) +ONE_TEST(CommonCryptoCTSPadding) +ONE_TEST(CommonSymmetricWrap) +ONE_TEST(CommonDH) +ONE_TEST(CommonDigest) +ONE_TEST(CommonBaseEncoding) +ONE_TEST(CommonCryptoReset) +ONE_TEST(CommonBigNum) +ONE_TEST(CommonBigDigest) ADDED CCRegression/test/testmore.c Index: CCRegression/test/testmore.c ================================================================== --- /dev/null +++ CCRegression/test/testmore.c @@ -0,0 +1,317 @@ +/* + * Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + * + * testmore.c + */ + +#include +#include +#include +#include +#include +#include +#include +#include +// #include + +#include "testmore.h" + +static int test_num = 0; +static int test_fails = 0; +static int test_cases = 0; +static const char *test_plan_file; +static int test_plan_line=0; + +const char *test_directive = NULL; +const char *test_reason = NULL; + +void test_skip(const char *reason, int how_many, int unless) +{ + if (unless) + return; + + int done; + for (done = 0; done < how_many; ++done) + test_ok(1, NULL, "skip", reason, __FILE__, __LINE__, NULL); +} + +void test_bail_out(const char *reason, const char *file, unsigned line) +{ + printf("BAIL OUT! (%s at line %u) %s\n", file, line, reason); + fflush(stdout); + exit(255); +} + +void test_plan_skip_all(const char *reason) +{ + if (test_num > test_cases) + { + test_skip(reason, test_cases - test_num, 0); + exit(test_fails > 255 ? 255 : test_fails); + } +} + +static void test_plan_exit(void) +{ + int status = 0; + fflush(stdout); + + if (!test_num) + { + if (test_cases) + { + fprintf(stderr, "%s:%u: warning: No tests run!\n", test_plan_file, test_plan_line); + status = 255; + } + else + { + fprintf(stderr, "%s:%u: error: Looks like your test died before it could " + "output anything.\n", test_plan_file, test_plan_line); + status = 255; + } + } + else if (test_num < test_cases) + { + fprintf(stderr, "%s:%u: warning: Looks like you planned %d tests but only ran %d.\n", + test_plan_file, test_plan_line, test_cases, test_num); + status = test_fails + test_cases - test_num; + } + else if (test_num > test_cases) + { + fprintf(stderr, "%s:%u: warning: Looks like you planned %d tests but ran %d extra.\n", + test_plan_file, test_plan_line, test_cases, test_num - test_cases); + status = test_fails; + } + else if (test_fails) + { + fprintf(stderr, "%s:%u: error: Looks like you failed %d tests of %d.\n", + test_plan_file, test_plan_line, test_fails, test_cases); + status = test_fails; + } + + fflush(stderr); + + /* reset the test plan */ + test_num = 0; + test_fails = 0; + test_cases = 0; +} + +void test_plan_tests(int count, const char *file, unsigned line) +{ +#if 0 + if (atexit(test_plan_exit) < 0) + { + fprintf(stderr, "failed to setup atexit handler: %s\n", + strerror(errno)); + fflush(stderr); + exit(255); + } +#endif + + if (test_cases) + { + fprintf(stderr, + "%s:%u: error: You tried to plan twice!\n", + file, line); + + fflush(stderr); + exit(255); + } + else + { + if (!count) + { + fprintf(stderr, "%s:%u: warning: You said to run 0 tests! You've got to run " + "something.\n", file, line); + fflush(stderr); + exit(255); + } + + test_plan_file=file; + test_plan_line=line; + + test_cases = count; + fprintf(stderr, "%s:%u: note: 1..%d\n", file, line, test_cases); + fflush(stdout); + } +} + +int +test_diag(const char *directive, const char *reason, + const char *file, unsigned line, const char *fmt, ...) +{ + int is_todo = directive && !strcmp(directive, "TODO"); + va_list args; + + va_start(args, fmt); + + if (is_todo) + { + fputs("# ", stdout); + if (fmt) + vprintf(fmt, args); + fputs("\n", stdout); + fflush(stdout); + } + else + { + fflush(stdout); + fputs("# ", stderr); + if (fmt) + vfprintf(stderr, fmt, args); + fputs("\n", stderr); + fflush(stderr); + } + + va_end(args); + + return 1; +} + +int +test_ok(int passed, const char *description, const char *directive, + const char *reason, const char *file, unsigned line, + const char *fmt, ...) +{ + int is_todo = !passed && directive && !strcmp(directive, "TODO"); + int is_setup = directive && !is_todo && !strcmp(directive, "SETUP"); + + if (is_setup) + { + if (!passed) + { + fflush(stdout); + fprintf(stderr, "# SETUP not ok%s%s%s%s\n", + description ? " - " : "", + description ? description : "", + reason ? " - " : "", + reason ? reason : ""); + } + } + else + { + if (!test_cases) + { + atexit(test_plan_exit); + fprintf(stderr, "You tried to run a test without a plan! " + "Gotta have a plan. at %s line %u\n", file, line); + fflush(stderr); + exit(255); + } + + ++test_num; + if (test_num > test_cases || (!passed && !is_todo)) + ++test_fails; +/* We dont need to print this unless we want to */ +#if 0 + fprintf(stderr, "%s:%u: note: %sok %d%s%s%s%s%s%s\n", file, line, passed ? "" : "not ", test_num, + description ? " - " : "", + description ? description : "", + directive ? " # " : "", + directive ? directive : "", + reason ? " " : "", + reason ? reason : ""); +#endif + } + + if (passed) + fflush(stdout); + else + { + va_list args; + + va_start(args, fmt); + + if (is_todo) + { +/* Enable this to output TODO as warning */ +#if 0 + printf("%s:%d: warning: Failed (TODO) test\n", file, line); + if (fmt) + vprintf(fmt, args); +#endif + fflush(stdout); + } + else + { + fflush(stdout); + fprintf(stderr, "%s:%d: error: Failed test\n", file, line); + if (fmt) + vfprintf(stderr, fmt, args); + fflush(stderr); + } + + va_end(args); + } + + return passed; +} + + +const char * +sec_errstr(int err) +{ +#if 1 + static int bufnum = 0; + static char buf[2][20]; + bufnum = bufnum ? 0 : 1; + sprintf(buf[bufnum], "0x%X", err); + return buf[bufnum]; +#else /* !1 */ + if (err >= errSecErrnoBase && err <= errSecErrnoLimit) + return strerror(err - 100000); + +#ifdef MAC_OS_X_VERSION_10_4 + /* AvailabilityMacros.h would only define this if we are on a + Tiger or later machine. */ + extern const char *cssmErrorString(long); + return cssmErrorString(err); +#else /* !defined(MAC_OS_X_VERSION_10_4) */ + extern const char *_ZN8Security15cssmErrorStringEl(long); + return _ZN8Security15cssmErrorStringEl(err); +#endif /* MAC_OS_X_VERSION_10_4 */ +#endif /* !1 */ +} + +/* run one test, described by test, return info in test struct */ +int run_one_test(struct one_test_s *test, int argc, char * const *argv) +{ + struct timeval start, stop; + + if(test->entry==NULL) { + printf("%s:%d: error: wtf?\n", __FILE__, __LINE__); + return -1; + } + + gettimeofday(&start, NULL); + test->entry(argc, argv); + gettimeofday(&stop, NULL); + + test_plan_exit(); + + /* this may overflow... */ + test->duration=(unsigned int) (stop.tv_sec-start.tv_sec)*1000+(stop.tv_usec/1000)-(start.tv_usec/1000); + test->failed_tests=test_fails; + + return test_fails; +}; ADDED CCRegression/test/testmore.h Index: CCRegression/test/testmore.h ================================================================== --- /dev/null +++ CCRegression/test/testmore.h @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + * + * testmore.h + */ + +#ifndef _TESTMORE_H_ +#define _TESTMORE_H_ 1 + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* This is included here, because its already included by all the test case */ +#include "testlist.h" + +typedef int (*one_test_entry)(int argc, char *const *argv); + +#define ONE_TEST_ENTRY(x) int x(int argc, char *const *argv) + +struct one_test_s { + char *name; /* test name */ + one_test_entry entry; /* entry point */ + int sub_tests; /* number of subtests */ + int failed_tests; /* number of failed tests*/ + unsigned int duration; /* test duration in msecs */ + /* add more later: timing, etc... */ +}; + +extern struct one_test_s testlist[]; + +int run_one_test(struct one_test_s *test, int argc, char * const *argv); + +/* this test harnes rely on shadowing for TODO, SKIP and SETUP blocks */ +#pragma GCC diagnostic ignored "-Wshadow" + +#define ok(THIS, TESTNAME) \ + test_ok(!!(THIS), TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, NULL) +#define is(THIS, THAT, TESTNAME) \ +({ \ + __typeof__(THIS) _this = (THIS); \ + __typeof__(THAT) _that = (THAT); \ + test_ok((_this == _that), TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# got: '%d'\n" \ + "# expected: '%d'\n", \ + _this, _that); \ +}) +#define isnt(THIS, THAT, TESTNAME) \ + cmp_ok((THIS), !=, (THAT), (TESTNAME)) +#define diag(MSG, ARGS...) \ + test_diag(test_directive, test_reason, __FILE__, __LINE__, MSG, ## ARGS) +#define cmp_ok(THIS, OP, THAT, TESTNAME) \ +({ \ + __typeof__(THIS) _this = (THIS); \ + __typeof__(THAT) _that = (THAT); \ + test_ok((_this OP _that), TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# '%d'\n" \ + "# " #OP "\n" \ + "# '%d'\n", \ + _this, _that); \ +}) +#define eq_string(THIS, THAT, TESTNAME) \ +({ \ + const char *_this = (THIS); \ + const char *_that = (THAT); \ + test_ok(!strcmp(_this, _that), TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# '%s'\n" \ + "# eq\n" \ + "# '%s'\n", \ + _this, _that); \ +}) +#define eq_stringn(THIS, THISLEN, THAT, THATLEN, TESTNAME) \ +({ \ + __typeof__(THISLEN) _thislen = (THISLEN); \ + __typeof__(THATLEN) _thatlen = (THATLEN); \ + const char *_this = (THIS); \ + const char *_that = (THAT); \ + test_ok(_thislen == _thatlen && !strncmp(_this, _that, _thislen), \ + TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# '%.*s'\n" \ + "# eq\n" \ + "# '%.*s'\n", \ + (int)_thislen, _this, (int)_thatlen, _that); \ +}) +#define like(THIS, REGEXP, TESTNAME) like_not_yet_implemented() +#define unlike(THIS, REGEXP, TESTNAME) unlike_not_yet_implemented() +#define is_deeply(STRUCT1, STRUCT2, TESTNAME) is_deeply_not_yet_implemented() +#define TODO switch(0) default +#define SKIP switch(0) default +#define SETUP switch(0) default +#define todo(REASON) const char *test_directive __attribute__((unused)) = "TODO", \ + *test_reason __attribute__((unused)) = (REASON) +#define skip(WHY, HOW_MANY, UNLESS) if (!(UNLESS)) \ + { test_skip((WHY), (HOW_MANY), 0); break; } +#define setup(REASON) const char *test_directive = "SETUP", \ + *test_reason = (REASON) +#define pass(TESTNAME) ok(1, (TESTNAME)) +#define fail(TESTNAME) ok(0, (TESTNAME)) +#define BAIL_OUT(WHY) test_bail_out(WHY, __FILE__, __LINE__) +#define plan_skip_all(REASON) test_plan_skip_all(REASON) +#define plan_tests(COUNT) test_plan_tests(COUNT, __FILE__, __LINE__) + +#define ok_status(THIS, TESTNAME) \ +({ \ + OSStatus _this = (THIS); \ + test_ok(!_this, TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# status: %s(%ld)\n", \ + sec_errstr(_this), _this); \ +}) +#define is_status(THIS, THAT, TESTNAME) \ +({ \ + OSStatus _this = (THIS); \ + OSStatus _that = (THAT); \ + test_ok(_this == _that, TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# got: %s(%ld)\n" \ + "# expected: %s(%ld)\n", \ + sec_errstr(_this), _this, sec_errstr(_that), _that); \ +}) +#define ok_unix(THIS, TESTNAME) \ +({ \ + int _this = (THIS) < 0 ? errno : 0; \ + test_ok(!_this, TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# got: %s(%d)\n", \ + strerror(_this), _this); \ +}) +#define is_unix(THIS, THAT, TESTNAME) \ +({ \ + int _result = (THIS); \ + int _this = _result < 0 ? errno : 0; \ + int _that = (THAT); \ + _that && _result < 0 \ + ? test_ok(_this == _that, TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# got: %s(%d)\n" \ + "# expected: %s(%d)\n", \ + strerror(_this), _this, strerror(_that), _that) \ + : test_ok(_this == _that, TESTNAME, test_directive, test_reason, \ + __FILE__, __LINE__, \ + "# got: %d\n" \ + "# expected errno: %s(%d)\n", \ + _result, strerror(_that), _that); \ +}) + + +extern const char *test_directive; +extern const char *test_reason; + +void test_bail_out(const char *reason, const char *file, unsigned line); +int test_diag(const char *directive, const char *reason, + const char *file, unsigned line, const char *fmt, ...); +int test_ok(int passed, const char *description, const char *directive, + const char *reason, const char *file, unsigned line, const char *fmt, ...); +void test_plan_skip_all(const char *reason); +void test_plan_tests(int count, const char *file, unsigned line); +void test_skip(const char *reason, int how_many, int unless); + +const char *sec_errstr(int err); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* !_TESTMORE_H_ */ ADDED CCRegression/util/capabilities.h Index: CCRegression/util/capabilities.h ================================================================== --- /dev/null +++ CCRegression/util/capabilities.h @@ -0,0 +1,65 @@ +// +// capabilities.h +// CCRegress +// + +#include + +#ifndef __CAPABILITIES_H__ +#define __CAPABILITIES_H__ + +#define entryPoint(testname,supportname) \ +int testname(int argc, char *const *argv) { \ +char prString[80];\ +sprintf(prString, "No %s Support in this release\n", supportname);\ +plan_tests(1); \ +diag(prString); \ +ok(1, prString); \ +return 0; \ +} + + +#define _SNOWLEOPARD_ 1060 +#define _LION_ 1070 +#define _ZIN_ 1080 +#define _CAB_ 1090 +#define _NMOS_ 1091 + + + +#if __MAC_OS_X_VERSION_MAX_ALLOWED < _NMOS_ +#define CC_RMD128_DIGEST_LENGTH 16 +#define CC_RMD160_DIGEST_LENGTH 20 +#define CC_RMD256_DIGEST_LENGTH 32 +#define CC_RMD320_DIGEST_LENGTH 40 +#endif + + +#define CRYPTORWITHMODE 1 +#define CCDIGEST 1 +#define CCRANDOM 1 +#define CCKEYDERIVATION 1 +#define CCCMAC 1 +#define CCRSA 1 +#define CCEC 1 +#define CCDH 1 +#define CCBIGNUM 1 +#define CCRESET 1 +#define CCSYMREGRESSION 1 +#define CCSYMOFFSET 1 +#define CCSYMZEROLEN 1 +#define CCSYMCBC 1 +#define CCSYMOFB 1 +#define CCSYMCFB 1 +#define CCSYMGCM 1 +#define CCSYMXTS 1 +#define CCSYMRC2 1 +#define CCPADCTS 1 +#define CCHMACCLONE 1 +#define CCSELFTEST 0 +#define CCSYMWRAP 1 +#define CNENCODER 0 +#define CCBIGDIGEST 0 +#define CCSYMCTR 1 + +#endif /* __CAPABILITIES_H__ */ ADDED CCRegression/util/testbyteBuffer.c Index: CCRegression/util/testbyteBuffer.c ================================================================== --- /dev/null +++ CCRegression/util/testbyteBuffer.c @@ -0,0 +1,178 @@ +/* + * printByteBuffer.c + * byteutils + * + * Created by Richard Murphy on 3/7/10. + * Copyright 2010 McKenzie-Murphy. All rights reserved. + * + */ + +#include "testbyteBuffer.h" +#include + +void printBytes(uint8_t *buff, size_t len, char *name) +{ + int i; + printf("Dumping %d bytes from %s\n", (int) len, name); + for(i=0; i 0 && !(i%8)) putchar(' '); + if(i > 0 && !(i%64)) putchar('\n'); + printf("%02x", buff[i]); + } + putchar('\n'); +} + +void printByteBuffer(byteBuffer bb, char *name) +{ + printBytes(bb->bytes, bb->len, name); +} + + +byteBuffer +mallocByteBuffer(size_t len) +{ + byteBuffer retval; + if((retval = (byteBuffer) malloc(sizeof(byteBufferStruct) + len + 1)) == NULL) return NULL; + retval->len = len; + retval->bytes = (uint8_t *) (retval + 1) ; /* just past the byteBuffer in malloc'ed space */ + return retval; +} + +size_t +genRandomSize(size_t minSize, size_t maxSize) +{ + size_t randomInt; + + if(minSize == maxSize) return minSize; + + // make theSize > minSize < maxSize; + while(CCRandomCopyBytes(kCCRandomDefault, &randomInt, sizeof(uint32_t)) == -1) { + printf("got -1 from CCRandomCopyBytes\n"); + } + + randomInt = (randomInt % (maxSize - minSize)) + minSize; + return randomInt; +} + +byteBuffer +genRandomByteBuffer(size_t minSize, size_t maxSize) +{ + byteBuffer retval; + size_t randomInt; + CCCryptorStatus err; + + randomInt = genRandomSize(minSize, maxSize); + + retval = mallocByteBuffer(randomInt); + if(retval == NULL) return NULL; + + if(retval->len != randomInt) return NULL; + bzero(retval->bytes, retval->len); + + // fill bytes randomly + while((err = CCRandomCopyBytes(kCCRandomDefault, retval->bytes, retval->len)) != kCCSuccess) { + printf("got %d from CCRandomCopyBytes\n", err); + } + + return retval; +} + +/* utility function to convert hex character representation to their nibble (4 bit) values */ +static uint8_t +nibbleFromChar(char c) +{ + if(c >= '0' && c <= '9') return c - '0'; + if(c >= 'a' && c <= 'f') return c - 'a' + 10; + if(c >= 'A' && c <= 'F') return c - 'A' + 10; + return 255; +} + +/* Convert a string of characters representing a hex buffer into a series of bytes of that real value */ +byteBuffer +hexStringToBytes(char *inhex) +{ + byteBuffer retval; + uint8_t *p; + int len, i; + + len = (int) strlen(inhex) / 2; + if((retval = mallocByteBuffer(len)) == NULL) return NULL; + + for(i=0, p = (uint8_t *) inhex; ibytes[i] = (nibbleFromChar(*p) << 4) | nibbleFromChar(*(p+1)); + p += 2; + } + retval->bytes[len] = 0; + return retval; +} + + + +byteBuffer +bytesToBytes(void *bytes, size_t len) +{ + byteBuffer retval = mallocByteBuffer(len); + memcpy(retval->bytes, bytes, len); + return retval; +} + +int +bytesAreEqual(byteBuffer b1, byteBuffer b2) +{ + if(b1->len != b2->len) return 0; + return (memcmp(b1->bytes, b2->bytes, b1->len) == 0); +} + + +static char byteMap[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; +static int byteMapLen = sizeof(byteMap); + +/* Utility function to convert nibbles (4 bit values) into a hex character representation */ +static char +nibbleToChar(uint8_t nibble) +{ + if(nibble < byteMapLen) return byteMap[nibble]; + return '*'; +} + +/* Convert a buffer of binary values into a hex string representation */ +char +*bytesToHexString(byteBuffer bb) +{ + char *retval; + int i; + + retval = malloc(bb->len*2 + 1); + for(i=0; ilen; i++) { + retval[i*2] = nibbleToChar(bb->bytes[i] >> 4); + retval[i*2+1] = nibbleToChar(bb->bytes[i] & 0x0f); + } + retval[bb->len*2] = 0; + return retval; +} + +char +*bytesToHexStringWithSpaces(byteBuffer bb, int breaks) +{ + char *retval; + int i, j; + + if(breaks == 0) { + return bytesToHexString(bb); + } + + breaks /= 2; + retval = malloc(bb->len*2 + 1 + (bb->len*2 / breaks) + 10); + for(i=0, j=0; ilen; i++, j+=2) { + retval[j] = nibbleToChar(bb->bytes[i] >> 4); + retval[j+1] = nibbleToChar(bb->bytes[i] & 0x0f); + if(((i+1) % breaks) == 0) { + retval[j+2] = ' '; + retval[j+3] = 0; + j++; + } + } + return retval; +} + + ADDED CCRegression/util/testbyteBuffer.h Index: CCRegression/util/testbyteBuffer.h ================================================================== --- /dev/null +++ CCRegression/util/testbyteBuffer.h @@ -0,0 +1,51 @@ +/* + * printByteBuffer.h + * byteutils + * + */ + +#include +#include +#include +#include + +#ifndef _BYTEBUFFER_H_ +#define _BYTEBUFFER_H_ + +typedef struct byte_buf { + size_t len; + uint8_t *bytes; +} byteBufferStruct, *byteBuffer; + +void printByteBuffer(byteBuffer bb, char *name); + +void printBytes(uint8_t *buff, size_t len, char *name); + +byteBuffer +mallocByteBuffer(size_t len); + +byteBuffer +hexStringToBytes(char *inhex); + +byteBuffer +hexStringToBytesWithSpaces(char *inhex, int breaks); + +char +*bytesToHexStringWithSpaces(byteBuffer bb, int breaks); + +byteBuffer +bytesToBytes(void *bytes, size_t len); + +int +bytesAreEqual(byteBuffer b1, byteBuffer b2); + +char +*bytesToHexString(byteBuffer bytes); + +byteBuffer +genRandomByteBuffer(size_t minSize, size_t maxSize); + +size_t +genRandomSize(size_t minSize, size_t maxSize); + +#endif /* _BYTEBUFFER_H_ */ Index: CommonCrypto.xcodeproj/project.pbxproj ================================================================== --- CommonCrypto.xcodeproj/project.pbxproj +++ CommonCrypto.xcodeproj/project.pbxproj @@ -30,462 +30,271 @@ dependencies = ( ); name = "Copy Open Source Docs"; productName = "Copy Open Source Docs"; }; - 5DC876F710FFB6BC0012A390 /* Unit Test World */ = { + 4C99FCB61326E14F0040AD38 /* commonCryptoMacIOS */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 4C99FCB71326E14F0040AD38 /* Build configuration list for PBXAggregateTarget "commonCryptoMacIOS" */; + buildPhases = ( + ); + dependencies = ( + 4C58A28D13281C2100A17BAC /* PBXTargetDependency */, + ); + name = commonCryptoMacIOS; + productName = FIPSModeIOS; + }; + 4CA675141332C16C00C45A71 /* CommonCrypto_Sim */ = { isa = PBXAggregateTarget; - buildConfigurationList = 5DC876FB10FFB6DA0012A390 /* Build configuration list for PBXAggregateTarget "Unit Test World" */; + buildConfigurationList = 4CA675151332C16C00C45A71 /* Build configuration list for PBXAggregateTarget "CommonCrypto_Sim" */; buildPhases = ( + 4CA6751A1332C18C00C45A71 /* ShellScript */, ); dependencies = ( - 5DC8771110FFB7510012A390 /* PBXTargetDependency */, - 5DAD83D21279F6D500240B9A /* PBXTargetDependency */, + 4CA675191332C17900C45A71 /* PBXTargetDependency */, ); - name = "Unit Test World"; - productName = "Unit Test World"; + name = CommonCrypto_Sim; + productName = commonCryptoMacIOSSim; }; /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ 0511C47E0A37892C0028BFC3 /* CommonCrypto.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 05CE942C0A37850A007C91D6 /* CommonCrypto.txt */; }; - 0539DC2809D4919D00AB7F89 /* opensslDES.c in Sources */ = {isa = PBXBuildFile; fileRef = 0539DC2609D4919D00AB7F89 /* opensslDES.c */; }; 054BBECE05F6AA7200344873 /* CommonDigest.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBECD05F6AA7200344873 /* CommonDigest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 054BBEDE05F6AA8900344873 /* md2_dgst.c in Sources */ = {isa = PBXBuildFile; fileRef = 054BBED305F6AA8900344873 /* md2_dgst.c */; }; - 054BBEDF05F6AA8900344873 /* md4_dgst.c in Sources */ = {isa = PBXBuildFile; fileRef = 054BBED405F6AA8900344873 /* md4_dgst.c */; }; - 054BBEE005F6AA8900344873 /* md4_locl.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBED505F6AA8900344873 /* md4_locl.h */; }; - 054BBEE105F6AA8900344873 /* md5_dgst.c in Sources */ = {isa = PBXBuildFile; fileRef = 054BBED605F6AA8900344873 /* md5_dgst.c */; }; - 054BBEE205F6AA8900344873 /* md5_locl.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBED705F6AA8900344873 /* md5_locl.h */; }; - 054BBEE305F6AA8900344873 /* md32_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBED805F6AA8900344873 /* md32_common.h */; }; - 054BBEE505F6AA8900344873 /* sha_locl.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBEDA05F6AA8900344873 /* sha_locl.h */; }; - 054BBEE705F6AA8900344873 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 054BBEDC05F6AA8900344873 /* sha1.c */; }; - 0585FE1909DC9873001762F6 /* c_ecb.c in Sources */ = {isa = PBXBuildFile; fileRef = 0585FE1209DC9873001762F6 /* c_ecb.c */; }; - 0585FE1A09DC9873001762F6 /* c_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 0585FE1309DC9873001762F6 /* c_enc.c */; }; - 0585FE1B09DC9873001762F6 /* c_skey.c in Sources */ = {isa = PBXBuildFile; fileRef = 0585FE1409DC9873001762F6 /* c_skey.c */; }; - 0585FE1D09DC9873001762F6 /* cast_lcl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0585FE1609DC9873001762F6 /* cast_lcl.h */; }; - 0585FE1E09DC9873001762F6 /* cast_s.h in Headers */ = {isa = PBXBuildFile; fileRef = 0585FE1709DC9873001762F6 /* cast_s.h */; }; - 0585FE1F09DC9873001762F6 /* ccCast.c in Sources */ = {isa = PBXBuildFile; fileRef = 0585FE1809DC9873001762F6 /* ccCast.c */; }; - 05C4414409D49F28002066D1 /* des.h in Headers */ = {isa = PBXBuildFile; fileRef = 05ECA0E409D468E200CFE5CB /* des.h */; }; - 05C4414509D49F29002066D1 /* des_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 05ECA0E509D468E200CFE5CB /* des_enc.c */; }; - 05C4414609D49F29002066D1 /* des_locl.h in Headers */ = {isa = PBXBuildFile; fileRef = 05ECA0E609D468E200CFE5CB /* des_locl.h */; }; - 05C4416F09D4BACE002066D1 /* e_os2.h in Headers */ = {isa = PBXBuildFile; fileRef = 05C4416E09D4BACE002066D1 /* e_os2.h */; }; - 05C4417309D4BB0B002066D1 /* opensslconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 05C4417209D4BB0B002066D1 /* opensslconf.h */; }; - 05C70C5509D471C30004B8F4 /* spr.h in Headers */ = {isa = PBXBuildFile; fileRef = 05C70C5309D471C30004B8F4 /* spr.h */; }; 05CE942D0A37850A007C91D6 /* CommonCrypto.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 05CE942B0A37850A007C91D6 /* CommonCrypto.plist */; }; 05D8D97D09E411AB00E03504 /* CommonHMAC.h in Headers */ = {isa = PBXBuildFile; fileRef = 05D8D97C09E411AA00E03504 /* CommonHMAC.h */; settings = {ATTRIBUTES = (Public, ); }; }; 05D9F61909D85F4A00AD30A7 /* CommonCryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 05D9F61609D85F4A00AD30A7 /* CommonCryptor.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 05E319BD063890C100C4AD24 /* sha2.c in Sources */ = {isa = PBXBuildFile; fileRef = 05E319B7063890C100C4AD24 /* sha2.c */; }; - 05E319DD0638913700C4AD24 /* sha2Priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 05E319DC0638913700C4AD24 /* sha2Priv.h */; }; - 05ECA0EE09D469A100CFE5CB /* set_key.c in Sources */ = {isa = PBXBuildFile; fileRef = 05ECA0ED09D469A100CFE5CB /* set_key.c */; }; - 122ADC45121320D70027F302 /* sha256_nossse3.s in Sources */ = {isa = PBXBuildFile; fileRef = 122ADC43121320D70027F302 /* sha256_nossse3.s */; }; - 122ADC46121320D70027F302 /* sha256.s in Sources */ = {isa = PBXBuildFile; fileRef = 122ADC44121320D70027F302 /* sha256.s */; }; - 1235BCBF1207FAFC002BC892 /* libcommonCrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 054BBEC605F6A98900344873 /* libcommonCrypto.dylib */; }; - 1249340812270E8900F9C9E1 /* cfb8_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340112270E8900F9C9E1 /* cfb8_decrypt.c */; }; - 1249340912270E8900F9C9E1 /* cfb8_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340212270E8900F9C9E1 /* cfb8_descriptor.c */; }; - 1249340A12270E8900F9C9E1 /* cfb8_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340312270E8900F9C9E1 /* cfb8_done.c */; }; - 1249340B12270E8900F9C9E1 /* cfb8_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340412270E8900F9C9E1 /* cfb8_encrypt.c */; }; - 1249340C12270E8900F9C9E1 /* cfb8_getiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340512270E8900F9C9E1 /* cfb8_getiv.c */; }; - 1249340D12270E8900F9C9E1 /* cfb8_setiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340612270E8900F9C9E1 /* cfb8_setiv.c */; }; - 1249340E12270E8900F9C9E1 /* cfb8_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340712270E8900F9C9E1 /* cfb8_start.c */; }; - 125B78AF11FF877D008C1AD3 /* aesedpPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 125B78AE11FF877D008C1AD3 /* aesedpPriv.h */; }; - 125B795611FF925B008C1AD3 /* libcommonCrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 054BBEBE05F6A97700344873 /* libcommonCrypto.dylib */; }; - 125B796711FF92FC008C1AD3 /* crypto.c in Sources */ = {isa = PBXBuildFile; fileRef = 125B796011FF92FC008C1AD3 /* crypto.c */; }; - 125B796811FF92FC008C1AD3 /* hexString.c in Sources */ = {isa = PBXBuildFile; fileRef = 125B796111FF92FC008C1AD3 /* hexString.c */; }; - 125B796911FF92FC008C1AD3 /* printByteBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 125B796311FF92FC008C1AD3 /* printByteBuffer.c */; }; - 125B796A11FF92FC008C1AD3 /* xtsTestVectors.c in Sources */ = {isa = PBXBuildFile; fileRef = 125B796511FF92FC008C1AD3 /* xtsTestVectors.c */; }; - 12B5D56D11FF437500626A60 /* aesxts.c in Sources */ = {isa = PBXBuildFile; fileRef = 48B4B98C11ABA1B4001F1036 /* aesxts.c */; }; - 12B5D56E11FF437A00626A60 /* aesxts_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = 48B4B98D11ABA1B4001F1036 /* aesxts_asm.s */; }; - 12C3F7E6122AD1B100E09D9E /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12C3F7E5122AD1B100E09D9E /* SenTestingKit.framework */; }; - 12CC5DDA120373D1001B4FCE /* CBCTest.c in Sources */ = {isa = PBXBuildFile; fileRef = 12CC5DD9120373D1001B4FCE /* CBCTest.c */; }; 12FA0DB011F7962100917A4E /* CommonRandomSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 12FA0DAF11F7962100917A4E /* CommonRandomSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 12FA0DB211F7964700917A4E /* CommonRandom.c in Sources */ = {isa = PBXBuildFile; fileRef = 12FA0DB111F7964700917A4E /* CommonRandom.c */; }; - 12FA10CA11F7A01D00917A4E /* libcommonCrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 054BBEBE05F6A97700344873 /* libcommonCrypto.dylib */; }; + 48067F871362405D005DDEBC /* CommonCryptoAESShoefly.c in Sources */ = {isa = PBXBuildFile; fileRef = 48685586127B641800B88D39 /* CommonCryptoAESShoefly.c */; }; 48096B2311A5EF900043F67F /* CommonDigest.c in Sources */ = {isa = PBXBuildFile; fileRef = 48096B2211A5EF900043F67F /* CommonDigest.c */; }; - 480C9AD712077BCF002EC023 /* byteBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 480C9AD512077BCF002EC023 /* byteBuffer.c */; }; - 48161AFF11AF011B009A14CE /* AES.s in Sources */ = {isa = PBXBuildFile; fileRef = 48B4B99311ABA1B4001F1036 /* AES.s */; }; - 48161B0011AF0123009A14CE /* aes_crypt_hw.s in Sources */ = {isa = PBXBuildFile; fileRef = 48B4B99611ABA1B4001F1036 /* aes_crypt_hw.s */; }; - 48161B0111AF0124009A14CE /* aes_key_hw.s in Sources */ = {isa = PBXBuildFile; fileRef = 48B4B99511ABA1B4001F1036 /* aes_key_hw.s */; }; - 48161B0211AF0124009A14CE /* aes_modes_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = 48B4B98A11ABA1B4001F1036 /* aes_modes_asm.s */; }; - 48161B0311AF0125009A14CE /* aes_modes_hw.s in Sources */ = {isa = PBXBuildFile; fileRef = 48B4B98911ABA1B4001F1036 /* aes_modes_hw.s */; }; - 4836A41F11A5C94A00862178 /* rc2.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41811A5C94A00862178 /* rc2.h */; }; - 4836A42011A5C94A00862178 /* opensslDES.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41911A5C94A00862178 /* opensslDES.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48165CD9125AC5D50015A267 /* CommonDigest.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBECD05F6AA7200344873 /* CommonDigest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 48165CDA125AC5D50015A267 /* CommonCryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 05D9F61609D85F4A00AD30A7 /* CommonCryptor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 48165CDB125AC5D50015A267 /* CommonHMAC.h in Headers */ = {isa = PBXBuildFile; fileRef = 05D8D97C09E411AA00E03504 /* CommonHMAC.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 48165CDC125AC5D50015A267 /* CommonKeyDerivation.h in Headers */ = {isa = PBXBuildFile; fileRef = 4854F9C01116307500CAFA18 /* CommonKeyDerivation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 48165CDD125AC5D50015A267 /* CommonSymmetricKeywrap.h in Headers */ = {isa = PBXBuildFile; fileRef = 4854F9C11116307500CAFA18 /* CommonSymmetricKeywrap.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 48165CF0125AC5D50015A267 /* ccdebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 489D982D11A4E8C20004DB89 /* ccdebug.h */; }; + 48165CF1125AC5D50015A267 /* CommonCryptorSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4846CA5411A5C8B800E7DA82 /* CommonCryptorSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48165CF2125AC5D50015A267 /* CommonDigestSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4846CA5511A5C8B800E7DA82 /* CommonDigestSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48165CF3125AC5D50015A267 /* CommonCryptoPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41A11A5C94A00862178 /* CommonCryptoPriv.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48165CF4125AC5D50015A267 /* CommonCryptorPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A42C11A5CB4700862178 /* CommonCryptorPriv.h */; settings = {ATTRIBUTES = (); }; }; + 48165CF5125AC5D50015A267 /* CommonDigestPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A42D11A5CB4700862178 /* CommonDigestPriv.h */; }; + 48165CF7125AC5D50015A267 /* CommonRandomSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 12FA0DAF11F7962100917A4E /* CommonRandomSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48165D78125AC5D50015A267 /* ccdebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 489D982C11A4E8C20004DB89 /* ccdebug.c */; }; + 48165D79125AC5D50015A267 /* CommonCryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42B11A5CB4700862178 /* CommonCryptor.c */; }; + 48165D7A125AC5D50015A267 /* CommonHMAC.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42E11A5CB4700862178 /* CommonHMAC.c */; }; + 48165D7B125AC5D50015A267 /* CommonKeyDerivation.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42F11A5CB4700862178 /* CommonKeyDerivation.c */; }; + 48165D7C125AC5D50015A267 /* CommonSymmetricKeywrap.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A43111A5CB4700862178 /* CommonSymmetricKeywrap.c */; }; + 48165D7D125AC5D50015A267 /* CommonDigest.c in Sources */ = {isa = PBXBuildFile; fileRef = 48096B2211A5EF900043F67F /* CommonDigest.c */; }; + 48165DBC125AC5F20015A267 /* CommonDigest.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBECD05F6AA7200344873 /* CommonDigest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 48165DBD125AC5F20015A267 /* CommonCryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 05D9F61609D85F4A00AD30A7 /* CommonCryptor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 48165DBE125AC5F20015A267 /* CommonHMAC.h in Headers */ = {isa = PBXBuildFile; fileRef = 05D8D97C09E411AA00E03504 /* CommonHMAC.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 48165DBF125AC5F20015A267 /* CommonKeyDerivation.h in Headers */ = {isa = PBXBuildFile; fileRef = 4854F9C01116307500CAFA18 /* CommonKeyDerivation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 48165DC0125AC5F20015A267 /* CommonSymmetricKeywrap.h in Headers */ = {isa = PBXBuildFile; fileRef = 4854F9C11116307500CAFA18 /* CommonSymmetricKeywrap.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 48165DD3125AC5F20015A267 /* ccdebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 489D982D11A4E8C20004DB89 /* ccdebug.h */; }; + 48165DD4125AC5F20015A267 /* CommonCryptorSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4846CA5411A5C8B800E7DA82 /* CommonCryptorSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48165DD5125AC5F20015A267 /* CommonDigestSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4846CA5511A5C8B800E7DA82 /* CommonDigestSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48165DD6125AC5F20015A267 /* CommonCryptoPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41A11A5C94A00862178 /* CommonCryptoPriv.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48165DD7125AC5F20015A267 /* CommonCryptorPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A42C11A5CB4700862178 /* CommonCryptorPriv.h */; settings = {ATTRIBUTES = (); }; }; + 48165DD8125AC5F20015A267 /* CommonDigestPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A42D11A5CB4700862178 /* CommonDigestPriv.h */; }; + 48165DDA125AC5F20015A267 /* CommonRandomSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 12FA0DAF11F7962100917A4E /* CommonRandomSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48165E5B125AC5F20015A267 /* ccdebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 489D982C11A4E8C20004DB89 /* ccdebug.c */; }; + 48165E5C125AC5F20015A267 /* CommonCryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42B11A5CB4700862178 /* CommonCryptor.c */; }; + 48165E5D125AC5F20015A267 /* CommonHMAC.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42E11A5CB4700862178 /* CommonHMAC.c */; }; + 48165E5E125AC5F20015A267 /* CommonKeyDerivation.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42F11A5CB4700862178 /* CommonKeyDerivation.c */; }; + 48165E5F125AC5F20015A267 /* CommonSymmetricKeywrap.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A43111A5CB4700862178 /* CommonSymmetricKeywrap.c */; }; + 48165E60125AC5F20015A267 /* CommonDigest.c in Sources */ = {isa = PBXBuildFile; fileRef = 48096B2211A5EF900043F67F /* CommonDigest.c */; }; + 4823B0EA14C1013F008F689F /* CCCryptorTestFuncs.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0AE14C10022008F689F /* CCCryptorTestFuncs.c */; }; + 4823B0EC14C1013F008F689F /* CommonBaseEncoding.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B014C10022008F689F /* CommonBaseEncoding.c */; }; + 4823B0ED14C1013F008F689F /* CommonBigNum.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B114C10022008F689F /* CommonBigNum.c */; }; + 4823B0EE14C1013F008F689F /* CommonCMac.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B214C10022008F689F /* CommonCMac.c */; }; + 4823B0EF14C1013F008F689F /* CommonCryptoCTSPadding.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B314C10022008F689F /* CommonCryptoCTSPadding.c */; }; + 4823B0F014C1013F008F689F /* CommonCryptoSymCBC.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B414C10022008F689F /* CommonCryptoSymCBC.c */; }; + 4823B0F114C1013F008F689F /* CommonCryptoSymGCM.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B514C10022008F689F /* CommonCryptoSymGCM.c */; }; + 4823B0F214C1013F008F689F /* CommonCryptoSymmetricWrap.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B614C10022008F689F /* CommonCryptoSymmetricWrap.c */; }; + 4823B0F314C1013F008F689F /* CommonCryptoSymOFB.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B714C10022008F689F /* CommonCryptoSymOFB.c */; }; + 4823B0F414C1013F008F689F /* CommonCryptoSymOffset.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B814C10022008F689F /* CommonCryptoSymOffset.c */; }; + 4823B0F514C1013F008F689F /* CommonCryptoSymRC2.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B914C10022008F689F /* CommonCryptoSymRC2.c */; }; + 4823B0F614C1013F008F689F /* CommonCryptoSymRegression.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BA14C10022008F689F /* CommonCryptoSymRegression.c */; }; + 4823B0F714C1013F008F689F /* CommonCryptoSymXTS.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BB14C10022008F689F /* CommonCryptoSymXTS.c */; }; + 4823B0F814C1013F008F689F /* CommonCryptoSymZeroLength.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BC14C10022008F689F /* CommonCryptoSymZeroLength.c */; }; + 4823B0F914C1013F008F689F /* CommonDigest.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BD14C10022008F689F /* CommonDigest.c */; }; + 4823B0FA14C1013F008F689F /* CommonEC.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BE14C10022008F689F /* CommonEC.c */; }; + 4823B0FB14C1013F008F689F /* CommonHMacClone.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BF14C10022008F689F /* CommonHMacClone.c */; }; + 4823B0FC14C1013F008F689F /* CommonRandom.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0C014C10022008F689F /* CommonRandom.c */; }; + 4823B0FD14C1013F008F689F /* CommonRSA.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0C114C10022008F689F /* CommonRSA.c */; }; + 4823B0FF14C1013F008F689F /* CryptorPadFailure.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0C314C10022008F689F /* CryptorPadFailure.c */; }; + 4823B10014C10155008F689F /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0C814C10022008F689F /* main.c */; }; + 4823B10214C1016B008F689F /* testenv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0D014C10022008F689F /* testenv.c */; }; + 4823B10414C1016B008F689F /* testlist.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0D214C10022008F689F /* testlist.c */; }; + 4823B10714C1016B008F689F /* testmore.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0D514C10022008F689F /* testmore.c */; }; + 4823B10914C1017C008F689F /* testbyteBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0D814C10022008F689F /* testbyteBuffer.c */; }; + 4825AAF61314CDCD00413A64 /* CommonBigNum.h in Headers */ = {isa = PBXBuildFile; fileRef = 4825AAF31314CDCD00413A64 /* CommonBigNum.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 4825AAF71314CDCD00413A64 /* CommonBigNum.h in Headers */ = {isa = PBXBuildFile; fileRef = 4825AAF31314CDCD00413A64 /* CommonBigNum.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 4825AAF81314CDCD00413A64 /* CommonBigNum.h in Headers */ = {isa = PBXBuildFile; fileRef = 4825AAF31314CDCD00413A64 /* CommonBigNum.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 4834A85314F47A9400438E3D /* libcorecrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4834A85214F47A9400438E3D /* libcorecrypto.dylib */; }; + 4834A85814F47B6200438E3D /* testbyteBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0D814C10022008F689F /* testbyteBuffer.c */; }; + 4834A85C14F47B6200438E3D /* testenv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0D014C10022008F689F /* testenv.c */; }; + 4834A85E14F47B6200438E3D /* testlist.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0D214C10022008F689F /* testlist.c */; }; + 4834A86114F47B6200438E3D /* testmore.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0D514C10022008F689F /* testmore.c */; }; + 4834A86314F47B6200438E3D /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0C814C10022008F689F /* main.c */; }; + 4834A86414F47B6200438E3D /* CCCryptorTestFuncs.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0AE14C10022008F689F /* CCCryptorTestFuncs.c */; }; + 4834A86614F47B6200438E3D /* CommonBaseEncoding.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B014C10022008F689F /* CommonBaseEncoding.c */; }; + 4834A86714F47B6200438E3D /* CommonBigNum.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B114C10022008F689F /* CommonBigNum.c */; }; + 4834A86814F47B6200438E3D /* CommonCMac.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B214C10022008F689F /* CommonCMac.c */; }; + 4834A86914F47B6200438E3D /* CommonCryptoCTSPadding.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B314C10022008F689F /* CommonCryptoCTSPadding.c */; }; + 4834A86A14F47B6200438E3D /* CommonCryptoSymCBC.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B414C10022008F689F /* CommonCryptoSymCBC.c */; }; + 4834A86B14F47B6200438E3D /* CommonCryptoSymGCM.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B514C10022008F689F /* CommonCryptoSymGCM.c */; }; + 4834A86C14F47B6200438E3D /* CommonCryptoSymmetricWrap.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B614C10022008F689F /* CommonCryptoSymmetricWrap.c */; }; + 4834A86D14F47B6200438E3D /* CommonCryptoSymOFB.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B714C10022008F689F /* CommonCryptoSymOFB.c */; }; + 4834A86E14F47B6200438E3D /* CommonCryptoSymOffset.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B814C10022008F689F /* CommonCryptoSymOffset.c */; }; + 4834A86F14F47B6200438E3D /* CommonCryptoSymRC2.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0B914C10022008F689F /* CommonCryptoSymRC2.c */; }; + 4834A87014F47B6200438E3D /* CommonCryptoSymRegression.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BA14C10022008F689F /* CommonCryptoSymRegression.c */; }; + 4834A87114F47B6200438E3D /* CommonCryptoSymXTS.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BB14C10022008F689F /* CommonCryptoSymXTS.c */; }; + 4834A87214F47B6200438E3D /* CommonCryptoSymZeroLength.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BC14C10022008F689F /* CommonCryptoSymZeroLength.c */; }; + 4834A87314F47B6200438E3D /* CommonDigest.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BD14C10022008F689F /* CommonDigest.c */; }; + 4834A87414F47B6200438E3D /* CommonEC.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BE14C10022008F689F /* CommonEC.c */; }; + 4834A87514F47B6200438E3D /* CommonHMacClone.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0BF14C10022008F689F /* CommonHMacClone.c */; }; + 4834A87614F47B6200438E3D /* CommonRandom.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0C014C10022008F689F /* CommonRandom.c */; }; + 4834A87714F47B6200438E3D /* CommonRSA.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0C114C10022008F689F /* CommonRSA.c */; }; + 4834A87814F47B6200438E3D /* CryptorPadFailure.c in Sources */ = {isa = PBXBuildFile; fileRef = 4823B0C314C10022008F689F /* CryptorPadFailure.c */; }; + 4834A87914F47B6200438E3D /* CommonCryptoReset.c in Sources */ = {isa = PBXBuildFile; fileRef = 486BE17C14E6019B00346AC4 /* CommonCryptoReset.c */; }; + 4834A88214F47C9A00438E3D /* libcommonCrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 054BBEBE05F6A97700344873 /* libcommonCrypto.dylib */; }; 4836A42111A5C94A00862178 /* CommonCryptoPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41A11A5C94A00862178 /* CommonCryptoPriv.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 4836A42211A5C94A00862178 /* ccRC2.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41B11A5C94A00862178 /* ccRC2.h */; }; - 4836A42311A5C94A00862178 /* ccCast.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41C11A5C94A00862178 /* ccCast.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 4836A42411A5C94A00862178 /* cast.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41D11A5C94A00862178 /* cast.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4836A43211A5CB4700862178 /* CommonCryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42B11A5CB4700862178 /* CommonCryptor.c */; }; - 4836A43311A5CB4700862178 /* CommonCryptorPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A42C11A5CB4700862178 /* CommonCryptorPriv.h */; settings = {ATTRIBUTES = (); }; }; + 4836A43311A5CB4700862178 /* CommonCryptorPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A42C11A5CB4700862178 /* CommonCryptorPriv.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4836A43411A5CB4700862178 /* CommonDigestPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A42D11A5CB4700862178 /* CommonDigestPriv.h */; }; 4836A43511A5CB4700862178 /* CommonHMAC.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42E11A5CB4700862178 /* CommonHMAC.c */; }; 4836A43611A5CB4700862178 /* CommonKeyDerivation.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42F11A5CB4700862178 /* CommonKeyDerivation.c */; }; - 4836A43711A5CB4700862178 /* CommonKeyDerivationPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A43011A5CB4700862178 /* CommonKeyDerivationPriv.h */; }; 4836A43811A5CB4700862178 /* CommonSymmetricKeywrap.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A43111A5CB4700862178 /* CommonSymmetricKeywrap.c */; }; 4846CA5611A5C8B800E7DA82 /* CommonCryptorSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4846CA5411A5C8B800E7DA82 /* CommonCryptorSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4846CA5711A5C8B800E7DA82 /* CommonDigestSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4846CA5511A5C8B800E7DA82 /* CommonDigestSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 484D40FF14DC96A600C93734 /* libcorecrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 484D40FE14DC96A600C93734 /* libcorecrypto.dylib */; }; + 4852C24A1505F8CD00676BCC /* CommonCryptoSymCFB.c in Sources */ = {isa = PBXBuildFile; fileRef = 4852C2491505F8CD00676BCC /* CommonCryptoSymCFB.c */; }; + 4852C24B1505F8CD00676BCC /* CommonCryptoSymCFB.c in Sources */ = {isa = PBXBuildFile; fileRef = 4852C2491505F8CD00676BCC /* CommonCryptoSymCFB.c */; }; + 4854BAD6152177CC007B5B08 /* CommonCryptoSymCTR.c in Sources */ = {isa = PBXBuildFile; fileRef = 4854BAD5152177CC007B5B08 /* CommonCryptoSymCTR.c */; }; + 4854BAD7152177CC007B5B08 /* CommonCryptoSymCTR.c in Sources */ = {isa = PBXBuildFile; fileRef = 4854BAD5152177CC007B5B08 /* CommonCryptoSymCTR.c */; }; 4854F9C21116307500CAFA18 /* CommonKeyDerivation.h in Headers */ = {isa = PBXBuildFile; fileRef = 4854F9C01116307500CAFA18 /* CommonKeyDerivation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4854F9C31116307500CAFA18 /* CommonSymmetricKeywrap.h in Headers */ = {isa = PBXBuildFile; fileRef = 4854F9C11116307500CAFA18 /* CommonSymmetricKeywrap.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 485A566C11AE4BB2003DDC41 /* aesedp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F34A11A4E47B00B5DDB3 /* aesedp.c */; }; - 485A566D11AE4BB4003DDC41 /* aesedp.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F34B11A4E47B00B5DDB3 /* aesedp.h */; }; - 4862F09811BDA1D300946BBE /* skein_ltc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F09411BDA1D300946BBE /* skein_ltc.h */; }; - 4862F09911BDA1D300946BBE /* skein_ltc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F09511BDA1D300946BBE /* skein_ltc.c */; }; - 4862F0AB11BDA27200946BBE /* skein.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F09E11BDA27200946BBE /* skein.h */; }; - 4862F0AC11BDA27200946BBE /* skein.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F09F11BDA27200946BBE /* skein.c */; }; - 4862F0AD11BDA27200946BBE /* skein_port.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A011BDA27200946BBE /* skein_port.h */; }; - 4862F0AE11BDA27200946BBE /* skein_iv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A111BDA27200946BBE /* skein_iv.h */; }; - 4862F0AF11BDA27200946BBE /* skein_dropin.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A211BDA27200946BBE /* skein_dropin.h */; }; - 4862F0B011BDA27200946BBE /* skein_dropin.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F0A311BDA27200946BBE /* skein_dropin.c */; }; - 4862F0B111BDA27200946BBE /* skein_debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A411BDA27200946BBE /* skein_debug.h */; }; - 4862F0B211BDA27200946BBE /* skein_debug.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F0A511BDA27200946BBE /* skein_debug.c */; }; - 4862F0B311BDA27200946BBE /* skein_block.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F0A611BDA27200946BBE /* skein_block.c */; }; - 4862F0B411BDA27200946BBE /* SHA3api_ref.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A711BDA27200946BBE /* SHA3api_ref.h */; }; - 4862F0B511BDA27200946BBE /* SHA3api_ref.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F0A811BDA27200946BBE /* SHA3api_ref.c */; }; - 4862F0B611BDA27200946BBE /* brg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A911BDA27200946BBE /* brg_types.h */; }; - 4862F0B711BDA27200946BBE /* brg_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0AA11BDA27200946BBE /* brg_endian.h */; }; - 4873F40211A4E47B00B5DDB3 /* cast5.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35311A4E47B00B5DDB3 /* cast5.c */; }; - 4873F40311A4E47B00B5DDB3 /* des.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35411A4E47B00B5DDB3 /* des.c */; }; - 4873F40411A4E47B00B5DDB3 /* rc2.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35511A4E47B00B5DDB3 /* rc2.c */; }; - 4873F40511A4E47B00B5DDB3 /* rc4.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F35711A4E47B00B5DDB3 /* rc4.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 4873F40611A4E47B00B5DDB3 /* rc4_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35811A4E47B00B5DDB3 /* rc4_enc.c */; }; - 4873F40711A4E47B00B5DDB3 /* rc4_skey.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35911A4E47B00B5DDB3 /* rc4_skey.c */; }; - 4873F40811A4E47B00B5DDB3 /* rc5.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35A11A4E47B00B5DDB3 /* rc5.c */; }; - 4873F40911A4E47B00B5DDB3 /* hash_file.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35D11A4E47B00B5DDB3 /* hash_file.c */; }; - 4873F40A11A4E47B00B5DDB3 /* hash_filehandle.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35E11A4E47B00B5DDB3 /* hash_filehandle.c */; }; - 4873F40B11A4E47B00B5DDB3 /* hash_memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35F11A4E47B00B5DDB3 /* hash_memory.c */; }; - 4873F40C11A4E47B00B5DDB3 /* hash_memory_multi.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36011A4E47B00B5DDB3 /* hash_memory_multi.c */; }; - 4873F40D11A4E47B00B5DDB3 /* md2.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36111A4E47B00B5DDB3 /* md2.c */; }; - 4873F40E11A4E47B00B5DDB3 /* md4.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36211A4E47B00B5DDB3 /* md4.c */; }; - 4873F40F11A4E47B00B5DDB3 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36311A4E47B00B5DDB3 /* md5.c */; }; - 4873F41011A4E47B00B5DDB3 /* rmd128.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36411A4E47B00B5DDB3 /* rmd128.c */; }; - 4873F41111A4E47B00B5DDB3 /* rmd160.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36511A4E47B00B5DDB3 /* rmd160.c */; }; - 4873F41211A4E47B00B5DDB3 /* rmd256.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36611A4E47B00B5DDB3 /* rmd256.c */; }; - 4873F41311A4E47B00B5DDB3 /* rmd320.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36711A4E47B00B5DDB3 /* rmd320.c */; }; - 4873F41411A4E47B00B5DDB3 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36811A4E47B00B5DDB3 /* sha1.c */; }; - 4873F41611A4E47B00B5DDB3 /* sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36B11A4E47B00B5DDB3 /* sha256.c */; }; - 4873F41811A4E47B00B5DDB3 /* sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36D11A4E47B00B5DDB3 /* sha512.c */; }; - 4873F41911A4E47B00B5DDB3 /* tomcrypt.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F36F11A4E47B00B5DDB3 /* tomcrypt.h */; }; - 4873F41A11A4E47B00B5DDB3 /* tomcrypt_argchk.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37011A4E47B00B5DDB3 /* tomcrypt_argchk.h */; }; - 4873F41B11A4E47B00B5DDB3 /* tomcrypt_cfg.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37111A4E47B00B5DDB3 /* tomcrypt_cfg.h */; }; - 4873F41C11A4E47B00B5DDB3 /* tomcrypt_cipher.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37211A4E47B00B5DDB3 /* tomcrypt_cipher.h */; }; - 4873F41D11A4E47B00B5DDB3 /* tomcrypt_custom.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37311A4E47B00B5DDB3 /* tomcrypt_custom.h */; }; - 4873F41E11A4E47B00B5DDB3 /* tomcrypt_hash.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37411A4E47B00B5DDB3 /* tomcrypt_hash.h */; }; - 4873F41F11A4E47B00B5DDB3 /* tomcrypt_mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37511A4E47B00B5DDB3 /* tomcrypt_mac.h */; }; - 4873F42011A4E47B00B5DDB3 /* tomcrypt_macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37611A4E47B00B5DDB3 /* tomcrypt_macros.h */; }; - 4873F42111A4E47B00B5DDB3 /* tomcrypt_math.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37711A4E47B00B5DDB3 /* tomcrypt_math.h */; }; - 4873F42211A4E47B00B5DDB3 /* tomcrypt_misc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37811A4E47B00B5DDB3 /* tomcrypt_misc.h */; }; - 4873F42311A4E47B00B5DDB3 /* tomcrypt_mode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37911A4E47B00B5DDB3 /* tomcrypt_mode.h */; }; - 4873F42411A4E47B00B5DDB3 /* tomcrypt_pk.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37A11A4E47B00B5DDB3 /* tomcrypt_pk.h */; }; - 4873F42511A4E47B00B5DDB3 /* tomcrypt_pkcs.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37B11A4E47B00B5DDB3 /* tomcrypt_pkcs.h */; }; - 4873F42611A4E47B00B5DDB3 /* tomcrypt_prng.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37C11A4E47B00B5DDB3 /* tomcrypt_prng.h */; }; - 4873F42A11A4E47B00B5DDB3 /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38311A4E47B00B5DDB3 /* crypt.c */; }; - 4873F42B11A4E47B00B5DDB3 /* crypt_argchk.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38411A4E47B00B5DDB3 /* crypt_argchk.c */; }; - 4873F42C11A4E47B00B5DDB3 /* crypt_cipher_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38511A4E47B00B5DDB3 /* crypt_cipher_descriptor.c */; }; - 4873F42D11A4E47B00B5DDB3 /* crypt_cipher_is_valid.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38611A4E47B00B5DDB3 /* crypt_cipher_is_valid.c */; }; - 4873F42E11A4E47B00B5DDB3 /* crypt_find_cipher.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38711A4E47B00B5DDB3 /* crypt_find_cipher.c */; }; - 4873F42F11A4E47B00B5DDB3 /* crypt_find_cipher_any.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38811A4E47B00B5DDB3 /* crypt_find_cipher_any.c */; }; - 4873F43011A4E47B00B5DDB3 /* crypt_find_cipher_id.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38911A4E47B00B5DDB3 /* crypt_find_cipher_id.c */; }; - 4873F43111A4E47B00B5DDB3 /* crypt_find_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38A11A4E47B00B5DDB3 /* crypt_find_hash.c */; }; - 4873F43211A4E47B00B5DDB3 /* crypt_find_hash_any.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38B11A4E47B00B5DDB3 /* crypt_find_hash_any.c */; }; - 4873F43311A4E47B00B5DDB3 /* crypt_find_hash_id.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38C11A4E47B00B5DDB3 /* crypt_find_hash_id.c */; }; - 4873F43411A4E47B00B5DDB3 /* crypt_find_hash_oid.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38D11A4E47B00B5DDB3 /* crypt_find_hash_oid.c */; }; - 4873F43511A4E47B00B5DDB3 /* crypt_find_prng.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38E11A4E47B00B5DDB3 /* crypt_find_prng.c */; }; - 4873F43711A4E47B00B5DDB3 /* crypt_hash_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39011A4E47B00B5DDB3 /* crypt_hash_descriptor.c */; }; - 4873F43811A4E47B00B5DDB3 /* crypt_hash_is_valid.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39111A4E47B00B5DDB3 /* crypt_hash_is_valid.c */; }; - 4873F43911A4E47B00B5DDB3 /* crypt_ltc_mp_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39211A4E47B00B5DDB3 /* crypt_ltc_mp_descriptor.c */; }; - 4873F43A11A4E47B00B5DDB3 /* crypt_mode_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39311A4E47B00B5DDB3 /* crypt_mode_descriptor.c */; }; - 4873F43D11A4E47B00B5DDB3 /* crypt_register_cipher.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39611A4E47B00B5DDB3 /* crypt_register_cipher.c */; }; - 4873F43E11A4E47B00B5DDB3 /* crypt_register_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39711A4E47B00B5DDB3 /* crypt_register_hash.c */; }; - 4873F44011A4E47B00B5DDB3 /* crypt_unregister_cipher.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39911A4E47B00B5DDB3 /* crypt_unregister_cipher.c */; }; - 4873F44111A4E47B00B5DDB3 /* crypt_unregister_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39A11A4E47B00B5DDB3 /* crypt_unregister_hash.c */; }; - 4873F44311A4E47B00B5DDB3 /* error_to_string.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39C11A4E47B00B5DDB3 /* error_to_string.c */; }; - 4873F44611A4E47B00B5DDB3 /* zeromem.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A011A4E47B00B5DDB3 /* zeromem.c */; }; - 4873F44711A4E47B00B5DDB3 /* cbc_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A311A4E47B00B5DDB3 /* cbc_decrypt.c */; }; - 4873F44811A4E47B00B5DDB3 /* cbc_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A411A4E47B00B5DDB3 /* cbc_descriptor.c */; }; - 4873F44911A4E47B00B5DDB3 /* cbc_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A511A4E47B00B5DDB3 /* cbc_done.c */; }; - 4873F44A11A4E47B00B5DDB3 /* cbc_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A611A4E47B00B5DDB3 /* cbc_encrypt.c */; }; - 4873F44B11A4E47B00B5DDB3 /* cbc_getiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A711A4E47B00B5DDB3 /* cbc_getiv.c */; }; - 4873F44C11A4E47B00B5DDB3 /* cbc_setiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A811A4E47B00B5DDB3 /* cbc_setiv.c */; }; - 4873F44D11A4E47B00B5DDB3 /* cbc_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A911A4E47B00B5DDB3 /* cbc_start.c */; }; - 4873F44E11A4E47B00B5DDB3 /* cfb_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3AB11A4E47B00B5DDB3 /* cfb_decrypt.c */; }; - 4873F44F11A4E47B00B5DDB3 /* cfb_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3AC11A4E47B00B5DDB3 /* cfb_descriptor.c */; }; - 4873F45011A4E47B00B5DDB3 /* cfb_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3AD11A4E47B00B5DDB3 /* cfb_done.c */; }; - 4873F45111A4E47B00B5DDB3 /* cfb_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3AE11A4E47B00B5DDB3 /* cfb_encrypt.c */; }; - 4873F45211A4E47B00B5DDB3 /* cfb_getiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3AF11A4E47B00B5DDB3 /* cfb_getiv.c */; }; - 4873F45311A4E47B00B5DDB3 /* cfb_setiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B011A4E47B00B5DDB3 /* cfb_setiv.c */; }; - 4873F45411A4E47B00B5DDB3 /* cfb_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B111A4E47B00B5DDB3 /* cfb_start.c */; }; - 4873F45511A4E47B00B5DDB3 /* ctr_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B311A4E47B00B5DDB3 /* ctr_decrypt.c */; }; - 4873F45611A4E47B00B5DDB3 /* ctr_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B411A4E47B00B5DDB3 /* ctr_descriptor.c */; }; - 4873F45711A4E47B00B5DDB3 /* ctr_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B511A4E47B00B5DDB3 /* ctr_done.c */; }; - 4873F45811A4E47B00B5DDB3 /* ctr_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B611A4E47B00B5DDB3 /* ctr_encrypt.c */; }; - 4873F45911A4E47B00B5DDB3 /* ctr_getiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B711A4E47B00B5DDB3 /* ctr_getiv.c */; }; - 4873F45A11A4E47B00B5DDB3 /* ctr_setiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B811A4E47B00B5DDB3 /* ctr_setiv.c */; }; - 4873F45B11A4E47B00B5DDB3 /* ctr_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B911A4E47B00B5DDB3 /* ctr_start.c */; }; - 4873F45C11A4E47B00B5DDB3 /* ctr_test.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3BA11A4E47B00B5DDB3 /* ctr_test.c */; }; - 4873F45D11A4E47B00B5DDB3 /* ecb_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3BC11A4E47B00B5DDB3 /* ecb_decrypt.c */; }; - 4873F45E11A4E47B00B5DDB3 /* ecb_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3BD11A4E47B00B5DDB3 /* ecb_descriptor.c */; }; - 4873F45F11A4E47B00B5DDB3 /* ecb_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3BE11A4E47B00B5DDB3 /* ecb_done.c */; }; - 4873F46011A4E47B00B5DDB3 /* ecb_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3BF11A4E47B00B5DDB3 /* ecb_encrypt.c */; }; - 4873F46111A4E47B00B5DDB3 /* ecb_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3C011A4E47B00B5DDB3 /* ecb_start.c */; }; - 4873F47311A4E47B00B5DDB3 /* ofb_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3D511A4E47B00B5DDB3 /* ofb_decrypt.c */; }; - 4873F47411A4E47B00B5DDB3 /* ofb_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3D611A4E47B00B5DDB3 /* ofb_descriptor.c */; }; - 4873F47511A4E47B00B5DDB3 /* ofb_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3D711A4E47B00B5DDB3 /* ofb_done.c */; }; - 4873F47611A4E47B00B5DDB3 /* ofb_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3D811A4E47B00B5DDB3 /* ofb_encrypt.c */; }; - 4873F47711A4E47B00B5DDB3 /* ofb_getiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3D911A4E47B00B5DDB3 /* ofb_getiv.c */; }; - 4873F47811A4E47B00B5DDB3 /* ofb_setiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3DA11A4E47B00B5DDB3 /* ofb_setiv.c */; }; - 4873F47911A4E47B00B5DDB3 /* ofb_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3DB11A4E47B00B5DDB3 /* ofb_start.c */; }; - 4873F47A11A4E47B00B5DDB3 /* rc4_stream.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3DC11A4E47B00B5DDB3 /* rc4_stream.c */; }; - 4873F47B11A4E47B00B5DDB3 /* unimplemented.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3DD11A4E47B00B5DDB3 /* unimplemented.c */; }; - 4873F47C11A4E47B00B5DDB3 /* xts_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3DF11A4E47B00B5DDB3 /* xts_decrypt.c */; }; - 4873F47D11A4E47B00B5DDB3 /* xts_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E011A4E47B00B5DDB3 /* xts_descriptor.c */; }; - 4873F47E11A4E47B00B5DDB3 /* xts_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E111A4E47B00B5DDB3 /* xts_done.c */; }; - 4873F47F11A4E47B00B5DDB3 /* xts_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E211A4E47B00B5DDB3 /* xts_encrypt.c */; }; - 4873F48011A4E47B00B5DDB3 /* xts_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E311A4E47B00B5DDB3 /* xts_init.c */; }; - 4873F48111A4E47B00B5DDB3 /* xts_mult_x.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E411A4E47B00B5DDB3 /* xts_mult_x.c */; }; - 4873F48211A4E47B00B5DDB3 /* xts_test.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E511A4E47B00B5DDB3 /* xts_test.c */; }; - 4873F48311A4E47B00B5DDB3 /* ansi923pad.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E811A4E47B00B5DDB3 /* ansi923pad.c */; }; - 4873F48411A4E47B00B5DDB3 /* ansi923pad.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F3E911A4E47B00B5DDB3 /* ansi923pad.h */; }; - 4873F48511A4E47B00B5DDB3 /* iso10126pad.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3EB11A4E47B00B5DDB3 /* iso10126pad.c */; }; - 4873F48611A4E47B00B5DDB3 /* iso10126pad.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F3EC11A4E47B00B5DDB3 /* iso10126pad.h */; }; - 4873F48711A4E47B00B5DDB3 /* nopad.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3EE11A4E47B00B5DDB3 /* nopad.c */; }; - 4873F48811A4E47B00B5DDB3 /* nopad.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F3EF11A4E47B00B5DDB3 /* nopad.h */; }; - 4873F48911A4E47B00B5DDB3 /* pkcs7pad.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3F111A4E47B00B5DDB3 /* pkcs7pad.c */; }; - 4873F48A11A4E47B00B5DDB3 /* pkcs7pad.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F3F211A4E47B00B5DDB3 /* pkcs7pad.h */; }; + 485FED50131475A400FF0F82 /* CommonBigNumPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 485FED4A131475A400FF0F82 /* CommonBigNumPriv.h */; }; + 485FED51131475A400FF0F82 /* CommonBigNum.c in Sources */ = {isa = PBXBuildFile; fileRef = 485FED4B131475A400FF0F82 /* CommonBigNum.c */; }; + 485FED54131475A400FF0F82 /* CommonBigNumPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 485FED4A131475A400FF0F82 /* CommonBigNumPriv.h */; }; + 485FED55131475A400FF0F82 /* CommonBigNum.c in Sources */ = {isa = PBXBuildFile; fileRef = 485FED4B131475A400FF0F82 /* CommonBigNum.c */; }; + 485FED56131475A400FF0F82 /* CommonBigNumPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 485FED4A131475A400FF0F82 /* CommonBigNumPriv.h */; }; + 485FED57131475A400FF0F82 /* CommonBigNum.c in Sources */ = {isa = PBXBuildFile; fileRef = 485FED4B131475A400FF0F82 /* CommonBigNum.c */; }; + 48685584127B63F200B88D39 /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 48685583127B63F200B88D39 /* aes.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48685587127B641800B88D39 /* CommonCryptoAESShoefly.c in Sources */ = {isa = PBXBuildFile; fileRef = 48685586127B641800B88D39 /* CommonCryptoAESShoefly.c */; }; + 4868BB1414B7C7F300072488 /* corecryptoSymmetricBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 4868BB1314B7C7F300072488 /* corecryptoSymmetricBridge.h */; }; + 4868BB1514B7C7F300072488 /* corecryptoSymmetricBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 4868BB1314B7C7F300072488 /* corecryptoSymmetricBridge.h */; }; + 4868BB1614B7C7F300072488 /* corecryptoSymmetricBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 4868BB1314B7C7F300072488 /* corecryptoSymmetricBridge.h */; }; + 486BE17D14E6019B00346AC4 /* CommonCryptoReset.c in Sources */ = {isa = PBXBuildFile; fileRef = 486BE17C14E6019B00346AC4 /* CommonCryptoReset.c */; }; + 4873A7281445099D0011B4FA /* CommonCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873A7271445099D0011B4FA /* CommonCrypto.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4873A72A1445099D0011B4FA /* CommonCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873A7271445099D0011B4FA /* CommonCrypto.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4873A72B1445099D0011B4FA /* CommonCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873A7271445099D0011B4FA /* CommonCrypto.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 488FCCB3139D6DD7007F2FC4 /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 48685583127B63F200B88D39 /* aes.h */; settings = {ATTRIBUTES = (Private, ); }; }; 489D982E11A4E8C20004DB89 /* ccdebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 489D982C11A4E8C20004DB89 /* ccdebug.c */; }; 489D982F11A4E8C20004DB89 /* ccdebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 489D982D11A4E8C20004DB89 /* ccdebug.h */; }; - 48D5636811A652D7008EBBBF /* aesopt.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D5636611A652D7008EBBBF /* aesopt.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48D5636911A652D7008EBBBF /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D5636711A652D7008EBBBF /* aes.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48D5637111A652EB008EBBBF /* aescrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D5636B11A652EB008EBBBF /* aescrypt.c */; }; - 48D5637211A652EB008EBBBF /* aeskey.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D5636C11A652EB008EBBBF /* aeskey.c */; }; - 48D5637311A652EB008EBBBF /* aestab.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D5636D11A652EB008EBBBF /* aestab.c */; }; - 48D5637411A652EB008EBBBF /* aestab.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D5636E11A652EB008EBBBF /* aestab.h */; }; - 48D5637511A652EB008EBBBF /* ccNewGladman.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D5636F11A652EB008EBBBF /* ccNewGladman.c */; }; - 48D5638611A65316008EBBBF /* AES.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D5637711A65316008EBBBF /* AES.c */; }; - 48D5638711A65316008EBBBF /* AESAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D5637811A65316008EBBBF /* AESAssembly.h */; }; - 48D5638911A65316008EBBBF /* AES.s in Sources */ = {isa = PBXBuildFile; fileRef = 48D5637B11A65316008EBBBF /* AES.s */; }; - 48D5638B11A65316008EBBBF /* DecryptCBC.s in Sources */ = {isa = PBXBuildFile; fileRef = 48D5637D11A65316008EBBBF /* DecryptCBC.s */; }; - 48D5638C11A65316008EBBBF /* EncryptCBC.s in Sources */ = {isa = PBXBuildFile; fileRef = 48D5637E11A65316008EBBBF /* EncryptCBC.s */; }; - 48F7B00112F248C900E70774 /* CCCalibratePBKDF.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 48F7AFFF12F2488500E70774 /* CCCalibratePBKDF.3cc */; }; - 48F7B00212F248C900E70774 /* CCCommonKeyDerivation.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 48F7B00012F2488500E70774 /* CCCommonKeyDerivation.3cc */; }; - 48F7B00812F248E600E70774 /* CCKeyDerivationPBKDF.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 48F7B00312F248E600E70774 /* CCKeyDerivationPBKDF.3cc */; }; - 48F7B00912F248E600E70774 /* CCSymmetricKeyUnwrap.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 48F7B00412F248E600E70774 /* CCSymmetricKeyUnwrap.3cc */; }; - 48F7B00A12F248E600E70774 /* CCSymmetricKeyWrap.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 48F7B00512F248E600E70774 /* CCSymmetricKeyWrap.3cc */; }; - 48F7B00B12F248E700E70774 /* CCSymmetricUnwrappedSize.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 48F7B00612F248E600E70774 /* CCSymmetricUnwrappedSize.3cc */; }; - 48F7B00C12F248E700E70774 /* CCSymmetricWrappedSize.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 48F7B00712F248E600E70774 /* CCSymmetricWrappedSize.3cc */; }; - 48F7F29912B2EF6000AF4587 /* CommonDigest.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBECD05F6AA7200344873 /* CommonDigest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 48F7F29A12B2EF6000AF4587 /* md4_locl.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBED505F6AA8900344873 /* md4_locl.h */; }; - 48F7F29B12B2EF6000AF4587 /* md5_locl.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBED705F6AA8900344873 /* md5_locl.h */; }; - 48F7F29C12B2EF6000AF4587 /* md32_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBED805F6AA8900344873 /* md32_common.h */; }; - 48F7F29D12B2EF6000AF4587 /* sha_locl.h in Headers */ = {isa = PBXBuildFile; fileRef = 054BBEDA05F6AA8900344873 /* sha_locl.h */; }; - 48F7F29E12B2EF6000AF4587 /* sha2Priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 05E319DC0638913700C4AD24 /* sha2Priv.h */; }; - 48F7F29F12B2EF6000AF4587 /* spr.h in Headers */ = {isa = PBXBuildFile; fileRef = 05C70C5309D471C30004B8F4 /* spr.h */; }; - 48F7F2A012B2EF6000AF4587 /* des.h in Headers */ = {isa = PBXBuildFile; fileRef = 05ECA0E409D468E200CFE5CB /* des.h */; }; - 48F7F2A112B2EF6000AF4587 /* des_locl.h in Headers */ = {isa = PBXBuildFile; fileRef = 05ECA0E609D468E200CFE5CB /* des_locl.h */; }; - 48F7F2A212B2EF6000AF4587 /* e_os2.h in Headers */ = {isa = PBXBuildFile; fileRef = 05C4416E09D4BACE002066D1 /* e_os2.h */; }; - 48F7F2A312B2EF6000AF4587 /* opensslconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 05C4417209D4BB0B002066D1 /* opensslconf.h */; }; - 48F7F2A412B2EF6000AF4587 /* CommonCryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 05D9F61609D85F4A00AD30A7 /* CommonCryptor.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 48F7F2A512B2EF6000AF4587 /* cast_lcl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0585FE1609DC9873001762F6 /* cast_lcl.h */; }; - 48F7F2A612B2EF6000AF4587 /* cast_s.h in Headers */ = {isa = PBXBuildFile; fileRef = 0585FE1709DC9873001762F6 /* cast_s.h */; }; - 48F7F2A712B2EF6000AF4587 /* CommonHMAC.h in Headers */ = {isa = PBXBuildFile; fileRef = 05D8D97C09E411AA00E03504 /* CommonHMAC.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 48F7F2A812B2EF6000AF4587 /* CommonKeyDerivation.h in Headers */ = {isa = PBXBuildFile; fileRef = 4854F9C01116307500CAFA18 /* CommonKeyDerivation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 48F7F2A912B2EF6000AF4587 /* CommonSymmetricKeywrap.h in Headers */ = {isa = PBXBuildFile; fileRef = 4854F9C11116307500CAFA18 /* CommonSymmetricKeywrap.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 48F7F2AA12B2EF6000AF4587 /* rc4.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F35711A4E47B00B5DDB3 /* rc4.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48F7F2AB12B2EF6000AF4587 /* tomcrypt.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F36F11A4E47B00B5DDB3 /* tomcrypt.h */; }; - 48F7F2AC12B2EF6000AF4587 /* tomcrypt_argchk.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37011A4E47B00B5DDB3 /* tomcrypt_argchk.h */; }; - 48F7F2AD12B2EF6000AF4587 /* tomcrypt_cfg.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37111A4E47B00B5DDB3 /* tomcrypt_cfg.h */; }; - 48F7F2AE12B2EF6000AF4587 /* tomcrypt_cipher.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37211A4E47B00B5DDB3 /* tomcrypt_cipher.h */; }; - 48F7F2AF12B2EF6000AF4587 /* tomcrypt_custom.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37311A4E47B00B5DDB3 /* tomcrypt_custom.h */; }; - 48F7F2B012B2EF6000AF4587 /* tomcrypt_hash.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37411A4E47B00B5DDB3 /* tomcrypt_hash.h */; }; - 48F7F2B112B2EF6000AF4587 /* tomcrypt_mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37511A4E47B00B5DDB3 /* tomcrypt_mac.h */; }; - 48F7F2B212B2EF6000AF4587 /* tomcrypt_macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37611A4E47B00B5DDB3 /* tomcrypt_macros.h */; }; - 48F7F2B312B2EF6000AF4587 /* tomcrypt_math.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37711A4E47B00B5DDB3 /* tomcrypt_math.h */; }; - 48F7F2B412B2EF6000AF4587 /* tomcrypt_misc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37811A4E47B00B5DDB3 /* tomcrypt_misc.h */; }; - 48F7F2B512B2EF6000AF4587 /* tomcrypt_mode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37911A4E47B00B5DDB3 /* tomcrypt_mode.h */; }; - 48F7F2B612B2EF6000AF4587 /* tomcrypt_pk.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37A11A4E47B00B5DDB3 /* tomcrypt_pk.h */; }; - 48F7F2B712B2EF6000AF4587 /* tomcrypt_pkcs.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37B11A4E47B00B5DDB3 /* tomcrypt_pkcs.h */; }; - 48F7F2B812B2EF6000AF4587 /* tomcrypt_prng.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F37C11A4E47B00B5DDB3 /* tomcrypt_prng.h */; }; - 48F7F2B912B2EF6000AF4587 /* ansi923pad.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F3E911A4E47B00B5DDB3 /* ansi923pad.h */; }; - 48F7F2BA12B2EF6000AF4587 /* iso10126pad.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F3EC11A4E47B00B5DDB3 /* iso10126pad.h */; }; - 48F7F2BB12B2EF6000AF4587 /* nopad.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F3EF11A4E47B00B5DDB3 /* nopad.h */; }; - 48F7F2BC12B2EF6000AF4587 /* pkcs7pad.h in Headers */ = {isa = PBXBuildFile; fileRef = 4873F3F211A4E47B00B5DDB3 /* pkcs7pad.h */; }; - 48F7F2BD12B2EF6000AF4587 /* ccdebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 489D982D11A4E8C20004DB89 /* ccdebug.h */; }; - 48F7F2BE12B2EF6000AF4587 /* CommonCryptorSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4846CA5411A5C8B800E7DA82 /* CommonCryptorSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48F7F2BF12B2EF6000AF4587 /* CommonDigestSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4846CA5511A5C8B800E7DA82 /* CommonDigestSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48F7F2C012B2EF6000AF4587 /* rc2.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41811A5C94A00862178 /* rc2.h */; }; - 48F7F2C112B2EF6000AF4587 /* opensslDES.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41911A5C94A00862178 /* opensslDES.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48F7F2C212B2EF6000AF4587 /* CommonCryptoPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41A11A5C94A00862178 /* CommonCryptoPriv.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48F7F2C312B2EF6000AF4587 /* ccRC2.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41B11A5C94A00862178 /* ccRC2.h */; }; - 48F7F2C412B2EF6000AF4587 /* ccCast.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41C11A5C94A00862178 /* ccCast.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48F7F2C512B2EF6000AF4587 /* cast.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A41D11A5C94A00862178 /* cast.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48F7F2C612B2EF6000AF4587 /* CommonCryptorPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A42C11A5CB4700862178 /* CommonCryptorPriv.h */; settings = {ATTRIBUTES = (); }; }; - 48F7F2C712B2EF6000AF4587 /* CommonDigestPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A42D11A5CB4700862178 /* CommonDigestPriv.h */; }; - 48F7F2C812B2EF6000AF4587 /* CommonKeyDerivationPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4836A43011A5CB4700862178 /* CommonKeyDerivationPriv.h */; }; - 48F7F2C912B2EF6000AF4587 /* aesopt.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D5636611A652D7008EBBBF /* aesopt.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48F7F2CA12B2EF6000AF4587 /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D5636711A652D7008EBBBF /* aes.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48F7F2CB12B2EF6000AF4587 /* aestab.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D5636E11A652EB008EBBBF /* aestab.h */; }; - 48F7F2CC12B2EF6000AF4587 /* AESAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D5637811A65316008EBBBF /* AESAssembly.h */; }; - 48F7F2CE12B2EF6000AF4587 /* skein_ltc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F09411BDA1D300946BBE /* skein_ltc.h */; }; - 48F7F2CF12B2EF6000AF4587 /* skein.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F09E11BDA27200946BBE /* skein.h */; }; - 48F7F2D012B2EF6000AF4587 /* skein_port.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A011BDA27200946BBE /* skein_port.h */; }; - 48F7F2D112B2EF6000AF4587 /* skein_iv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A111BDA27200946BBE /* skein_iv.h */; }; - 48F7F2D212B2EF6000AF4587 /* skein_dropin.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A211BDA27200946BBE /* skein_dropin.h */; }; - 48F7F2D312B2EF6000AF4587 /* skein_debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A411BDA27200946BBE /* skein_debug.h */; }; - 48F7F2D412B2EF6000AF4587 /* SHA3api_ref.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A711BDA27200946BBE /* SHA3api_ref.h */; }; - 48F7F2D512B2EF6000AF4587 /* brg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0A911BDA27200946BBE /* brg_types.h */; }; - 48F7F2D612B2EF6000AF4587 /* brg_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = 4862F0AA11BDA27200946BBE /* brg_endian.h */; }; - 48F7F2D712B2EF6000AF4587 /* CommonRandomSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 12FA0DAF11F7962100917A4E /* CommonRandomSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 48F7F2DC12B2EF6000AF4587 /* md2_dgst.c in Sources */ = {isa = PBXBuildFile; fileRef = 054BBED305F6AA8900344873 /* md2_dgst.c */; }; - 48F7F2DD12B2EF6000AF4587 /* md4_dgst.c in Sources */ = {isa = PBXBuildFile; fileRef = 054BBED405F6AA8900344873 /* md4_dgst.c */; }; - 48F7F2DE12B2EF6000AF4587 /* md5_dgst.c in Sources */ = {isa = PBXBuildFile; fileRef = 054BBED605F6AA8900344873 /* md5_dgst.c */; }; - 48F7F2DF12B2EF6000AF4587 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 054BBEDC05F6AA8900344873 /* sha1.c */; }; - 48F7F2E012B2EF6000AF4587 /* sha2.c in Sources */ = {isa = PBXBuildFile; fileRef = 05E319B7063890C100C4AD24 /* sha2.c */; }; - 48F7F2E112B2EF6000AF4587 /* set_key.c in Sources */ = {isa = PBXBuildFile; fileRef = 05ECA0ED09D469A100CFE5CB /* set_key.c */; }; - 48F7F2E212B2EF6000AF4587 /* opensslDES.c in Sources */ = {isa = PBXBuildFile; fileRef = 0539DC2609D4919D00AB7F89 /* opensslDES.c */; }; - 48F7F2E312B2EF6000AF4587 /* des_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 05ECA0E509D468E200CFE5CB /* des_enc.c */; }; - 48F7F2E412B2EF6000AF4587 /* c_ecb.c in Sources */ = {isa = PBXBuildFile; fileRef = 0585FE1209DC9873001762F6 /* c_ecb.c */; }; - 48F7F2E512B2EF6000AF4587 /* c_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 0585FE1309DC9873001762F6 /* c_enc.c */; }; - 48F7F2E612B2EF6000AF4587 /* c_skey.c in Sources */ = {isa = PBXBuildFile; fileRef = 0585FE1409DC9873001762F6 /* c_skey.c */; }; - 48F7F2E712B2EF6000AF4587 /* ccCast.c in Sources */ = {isa = PBXBuildFile; fileRef = 0585FE1809DC9873001762F6 /* ccCast.c */; }; - 48F7F2E812B2EF6000AF4587 /* ccRC2.c in Sources */ = {isa = PBXBuildFile; fileRef = 795CA3FD0D34431400BAE6A2 /* ccRC2.c */; }; - 48F7F2E912B2EF6000AF4587 /* rc2.c in Sources */ = {isa = PBXBuildFile; fileRef = 795CA3FE0D34431400BAE6A2 /* rc2.c */; }; - 48F7F2EA12B2EF6000AF4587 /* cast5.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35311A4E47B00B5DDB3 /* cast5.c */; }; - 48F7F2EB12B2EF6000AF4587 /* des.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35411A4E47B00B5DDB3 /* des.c */; }; - 48F7F2EC12B2EF6000AF4587 /* rc2.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35511A4E47B00B5DDB3 /* rc2.c */; }; - 48F7F2ED12B2EF6000AF4587 /* rc4_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35811A4E47B00B5DDB3 /* rc4_enc.c */; }; - 48F7F2EE12B2EF6000AF4587 /* rc4_skey.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35911A4E47B00B5DDB3 /* rc4_skey.c */; }; - 48F7F2EF12B2EF6000AF4587 /* rc5.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35A11A4E47B00B5DDB3 /* rc5.c */; }; - 48F7F2F012B2EF6000AF4587 /* hash_file.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35D11A4E47B00B5DDB3 /* hash_file.c */; }; - 48F7F2F112B2EF6000AF4587 /* hash_filehandle.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35E11A4E47B00B5DDB3 /* hash_filehandle.c */; }; - 48F7F2F212B2EF6000AF4587 /* hash_memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F35F11A4E47B00B5DDB3 /* hash_memory.c */; }; - 48F7F2F312B2EF6000AF4587 /* hash_memory_multi.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36011A4E47B00B5DDB3 /* hash_memory_multi.c */; }; - 48F7F2F412B2EF6000AF4587 /* md2.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36111A4E47B00B5DDB3 /* md2.c */; }; - 48F7F2F512B2EF6000AF4587 /* md4.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36211A4E47B00B5DDB3 /* md4.c */; }; - 48F7F2F612B2EF6000AF4587 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36311A4E47B00B5DDB3 /* md5.c */; }; - 48F7F2F712B2EF6000AF4587 /* rmd128.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36411A4E47B00B5DDB3 /* rmd128.c */; }; - 48F7F2F812B2EF6000AF4587 /* rmd160.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36511A4E47B00B5DDB3 /* rmd160.c */; }; - 48F7F2F912B2EF6000AF4587 /* rmd256.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36611A4E47B00B5DDB3 /* rmd256.c */; }; - 48F7F2FA12B2EF6000AF4587 /* rmd320.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36711A4E47B00B5DDB3 /* rmd320.c */; }; - 48F7F2FB12B2EF6000AF4587 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36811A4E47B00B5DDB3 /* sha1.c */; }; - 48F7F2FC12B2EF6000AF4587 /* sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36B11A4E47B00B5DDB3 /* sha256.c */; }; - 48F7F2FD12B2EF6000AF4587 /* sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F36D11A4E47B00B5DDB3 /* sha512.c */; }; - 48F7F2FE12B2EF6000AF4587 /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38311A4E47B00B5DDB3 /* crypt.c */; }; - 48F7F2FF12B2EF6000AF4587 /* crypt_argchk.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38411A4E47B00B5DDB3 /* crypt_argchk.c */; }; - 48F7F30012B2EF6000AF4587 /* crypt_cipher_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38511A4E47B00B5DDB3 /* crypt_cipher_descriptor.c */; }; - 48F7F30112B2EF6000AF4587 /* crypt_cipher_is_valid.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38611A4E47B00B5DDB3 /* crypt_cipher_is_valid.c */; }; - 48F7F30212B2EF6000AF4587 /* crypt_find_cipher.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38711A4E47B00B5DDB3 /* crypt_find_cipher.c */; }; - 48F7F30312B2EF6000AF4587 /* crypt_find_cipher_any.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38811A4E47B00B5DDB3 /* crypt_find_cipher_any.c */; }; - 48F7F30412B2EF6000AF4587 /* crypt_find_cipher_id.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38911A4E47B00B5DDB3 /* crypt_find_cipher_id.c */; }; - 48F7F30512B2EF6000AF4587 /* crypt_find_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38A11A4E47B00B5DDB3 /* crypt_find_hash.c */; }; - 48F7F30612B2EF6000AF4587 /* crypt_find_hash_any.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38B11A4E47B00B5DDB3 /* crypt_find_hash_any.c */; }; - 48F7F30712B2EF6000AF4587 /* crypt_find_hash_id.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38C11A4E47B00B5DDB3 /* crypt_find_hash_id.c */; }; - 48F7F30812B2EF6000AF4587 /* crypt_find_hash_oid.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38D11A4E47B00B5DDB3 /* crypt_find_hash_oid.c */; }; - 48F7F30912B2EF6000AF4587 /* crypt_find_prng.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F38E11A4E47B00B5DDB3 /* crypt_find_prng.c */; }; - 48F7F30A12B2EF6000AF4587 /* crypt_hash_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39011A4E47B00B5DDB3 /* crypt_hash_descriptor.c */; }; - 48F7F30B12B2EF6000AF4587 /* crypt_hash_is_valid.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39111A4E47B00B5DDB3 /* crypt_hash_is_valid.c */; }; - 48F7F30C12B2EF6000AF4587 /* crypt_ltc_mp_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39211A4E47B00B5DDB3 /* crypt_ltc_mp_descriptor.c */; }; - 48F7F30D12B2EF6000AF4587 /* crypt_mode_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39311A4E47B00B5DDB3 /* crypt_mode_descriptor.c */; }; - 48F7F30E12B2EF6000AF4587 /* crypt_register_cipher.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39611A4E47B00B5DDB3 /* crypt_register_cipher.c */; }; - 48F7F30F12B2EF6000AF4587 /* crypt_register_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39711A4E47B00B5DDB3 /* crypt_register_hash.c */; }; - 48F7F31012B2EF6000AF4587 /* crypt_unregister_cipher.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39911A4E47B00B5DDB3 /* crypt_unregister_cipher.c */; }; - 48F7F31112B2EF6000AF4587 /* crypt_unregister_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39A11A4E47B00B5DDB3 /* crypt_unregister_hash.c */; }; - 48F7F31212B2EF6000AF4587 /* error_to_string.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F39C11A4E47B00B5DDB3 /* error_to_string.c */; }; - 48F7F31312B2EF6000AF4587 /* zeromem.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A011A4E47B00B5DDB3 /* zeromem.c */; }; - 48F7F31412B2EF6000AF4587 /* cbc_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A311A4E47B00B5DDB3 /* cbc_decrypt.c */; }; - 48F7F31512B2EF6000AF4587 /* cbc_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A411A4E47B00B5DDB3 /* cbc_descriptor.c */; }; - 48F7F31612B2EF6000AF4587 /* cbc_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A511A4E47B00B5DDB3 /* cbc_done.c */; }; - 48F7F31712B2EF6000AF4587 /* cbc_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A611A4E47B00B5DDB3 /* cbc_encrypt.c */; }; - 48F7F31812B2EF6000AF4587 /* cbc_getiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A711A4E47B00B5DDB3 /* cbc_getiv.c */; }; - 48F7F31912B2EF6000AF4587 /* cbc_setiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A811A4E47B00B5DDB3 /* cbc_setiv.c */; }; - 48F7F31A12B2EF6000AF4587 /* cbc_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3A911A4E47B00B5DDB3 /* cbc_start.c */; }; - 48F7F31B12B2EF6000AF4587 /* cfb_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3AB11A4E47B00B5DDB3 /* cfb_decrypt.c */; }; - 48F7F31C12B2EF6000AF4587 /* cfb_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3AC11A4E47B00B5DDB3 /* cfb_descriptor.c */; }; - 48F7F31D12B2EF6000AF4587 /* cfb_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3AD11A4E47B00B5DDB3 /* cfb_done.c */; }; - 48F7F31E12B2EF6000AF4587 /* cfb_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3AE11A4E47B00B5DDB3 /* cfb_encrypt.c */; }; - 48F7F31F12B2EF6000AF4587 /* cfb_getiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3AF11A4E47B00B5DDB3 /* cfb_getiv.c */; }; - 48F7F32012B2EF6000AF4587 /* cfb_setiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B011A4E47B00B5DDB3 /* cfb_setiv.c */; }; - 48F7F32112B2EF6000AF4587 /* cfb_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B111A4E47B00B5DDB3 /* cfb_start.c */; }; - 48F7F32212B2EF6000AF4587 /* ctr_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B311A4E47B00B5DDB3 /* ctr_decrypt.c */; }; - 48F7F32312B2EF6000AF4587 /* ctr_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B411A4E47B00B5DDB3 /* ctr_descriptor.c */; }; - 48F7F32412B2EF6000AF4587 /* ctr_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B511A4E47B00B5DDB3 /* ctr_done.c */; }; - 48F7F32512B2EF6000AF4587 /* ctr_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B611A4E47B00B5DDB3 /* ctr_encrypt.c */; }; - 48F7F32612B2EF6000AF4587 /* ctr_getiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B711A4E47B00B5DDB3 /* ctr_getiv.c */; }; - 48F7F32712B2EF6000AF4587 /* ctr_setiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B811A4E47B00B5DDB3 /* ctr_setiv.c */; }; - 48F7F32812B2EF6000AF4587 /* ctr_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3B911A4E47B00B5DDB3 /* ctr_start.c */; }; - 48F7F32912B2EF6000AF4587 /* ctr_test.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3BA11A4E47B00B5DDB3 /* ctr_test.c */; }; - 48F7F32A12B2EF6000AF4587 /* ecb_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3BC11A4E47B00B5DDB3 /* ecb_decrypt.c */; }; - 48F7F32B12B2EF6000AF4587 /* ecb_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3BD11A4E47B00B5DDB3 /* ecb_descriptor.c */; }; - 48F7F32C12B2EF6000AF4587 /* ecb_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3BE11A4E47B00B5DDB3 /* ecb_done.c */; }; - 48F7F32D12B2EF6000AF4587 /* ecb_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3BF11A4E47B00B5DDB3 /* ecb_encrypt.c */; }; - 48F7F32E12B2EF6000AF4587 /* ecb_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3C011A4E47B00B5DDB3 /* ecb_start.c */; }; - 48F7F32F12B2EF6000AF4587 /* ofb_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3D511A4E47B00B5DDB3 /* ofb_decrypt.c */; }; - 48F7F33012B2EF6000AF4587 /* ofb_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3D611A4E47B00B5DDB3 /* ofb_descriptor.c */; }; - 48F7F33112B2EF6000AF4587 /* ofb_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3D711A4E47B00B5DDB3 /* ofb_done.c */; }; - 48F7F33212B2EF6000AF4587 /* ofb_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3D811A4E47B00B5DDB3 /* ofb_encrypt.c */; }; - 48F7F33312B2EF6000AF4587 /* ofb_getiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3D911A4E47B00B5DDB3 /* ofb_getiv.c */; }; - 48F7F33412B2EF6000AF4587 /* ofb_setiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3DA11A4E47B00B5DDB3 /* ofb_setiv.c */; }; - 48F7F33512B2EF6000AF4587 /* ofb_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3DB11A4E47B00B5DDB3 /* ofb_start.c */; }; - 48F7F33612B2EF6000AF4587 /* rc4_stream.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3DC11A4E47B00B5DDB3 /* rc4_stream.c */; }; - 48F7F33712B2EF6000AF4587 /* unimplemented.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3DD11A4E47B00B5DDB3 /* unimplemented.c */; }; - 48F7F33812B2EF6000AF4587 /* xts_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3DF11A4E47B00B5DDB3 /* xts_decrypt.c */; }; - 48F7F33912B2EF6000AF4587 /* xts_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E011A4E47B00B5DDB3 /* xts_descriptor.c */; }; - 48F7F33A12B2EF6000AF4587 /* xts_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E111A4E47B00B5DDB3 /* xts_done.c */; }; - 48F7F33B12B2EF6000AF4587 /* xts_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E211A4E47B00B5DDB3 /* xts_encrypt.c */; }; - 48F7F33C12B2EF6000AF4587 /* xts_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E311A4E47B00B5DDB3 /* xts_init.c */; }; - 48F7F33D12B2EF6000AF4587 /* xts_mult_x.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E411A4E47B00B5DDB3 /* xts_mult_x.c */; }; - 48F7F33E12B2EF6000AF4587 /* xts_test.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E511A4E47B00B5DDB3 /* xts_test.c */; }; - 48F7F33F12B2EF6000AF4587 /* ansi923pad.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3E811A4E47B00B5DDB3 /* ansi923pad.c */; }; - 48F7F34012B2EF6000AF4587 /* iso10126pad.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3EB11A4E47B00B5DDB3 /* iso10126pad.c */; }; - 48F7F34112B2EF6000AF4587 /* nopad.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3EE11A4E47B00B5DDB3 /* nopad.c */; }; - 48F7F34212B2EF6000AF4587 /* pkcs7pad.c in Sources */ = {isa = PBXBuildFile; fileRef = 4873F3F111A4E47B00B5DDB3 /* pkcs7pad.c */; }; - 48F7F34312B2EF6000AF4587 /* ccdebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 489D982C11A4E8C20004DB89 /* ccdebug.c */; }; - 48F7F34412B2EF6000AF4587 /* CommonCryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42B11A5CB4700862178 /* CommonCryptor.c */; }; - 48F7F34512B2EF6000AF4587 /* CommonHMAC.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42E11A5CB4700862178 /* CommonHMAC.c */; }; - 48F7F34612B2EF6000AF4587 /* CommonKeyDerivation.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A42F11A5CB4700862178 /* CommonKeyDerivation.c */; }; - 48F7F34712B2EF6000AF4587 /* CommonSymmetricKeywrap.c in Sources */ = {isa = PBXBuildFile; fileRef = 4836A43111A5CB4700862178 /* CommonSymmetricKeywrap.c */; }; - 48F7F34812B2EF6000AF4587 /* CommonDigest.c in Sources */ = {isa = PBXBuildFile; fileRef = 48096B2211A5EF900043F67F /* CommonDigest.c */; }; - 48F7F34912B2EF6000AF4587 /* aescrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D5636B11A652EB008EBBBF /* aescrypt.c */; }; - 48F7F34A12B2EF6000AF4587 /* aeskey.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D5636C11A652EB008EBBBF /* aeskey.c */; }; - 48F7F34B12B2EF6000AF4587 /* aestab.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D5636D11A652EB008EBBBF /* aestab.c */; }; - 48F7F34C12B2EF6000AF4587 /* ccNewGladman.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D5636F11A652EB008EBBBF /* ccNewGladman.c */; }; - 48F7F34D12B2EF6000AF4587 /* AES.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D5637711A65316008EBBBF /* AES.c */; }; - 48F7F34E12B2EF6000AF4587 /* AES.s in Sources */ = {isa = PBXBuildFile; fileRef = 48D5637B11A65316008EBBBF /* AES.s */; }; - 48F7F34F12B2EF6000AF4587 /* DecryptCBC.s in Sources */ = {isa = PBXBuildFile; fileRef = 48D5637D11A65316008EBBBF /* DecryptCBC.s */; }; - 48F7F35012B2EF6000AF4587 /* EncryptCBC.s in Sources */ = {isa = PBXBuildFile; fileRef = 48D5637E11A65316008EBBBF /* EncryptCBC.s */; }; - 48F7F35712B2EF6000AF4587 /* skein_ltc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F09511BDA1D300946BBE /* skein_ltc.c */; }; - 48F7F35812B2EF6000AF4587 /* skein.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F09F11BDA27200946BBE /* skein.c */; }; - 48F7F35912B2EF6000AF4587 /* skein_dropin.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F0A311BDA27200946BBE /* skein_dropin.c */; }; - 48F7F35A12B2EF6000AF4587 /* skein_debug.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F0A511BDA27200946BBE /* skein_debug.c */; }; - 48F7F35B12B2EF6000AF4587 /* skein_block.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F0A611BDA27200946BBE /* skein_block.c */; }; - 48F7F35C12B2EF6000AF4587 /* SHA3api_ref.c in Sources */ = {isa = PBXBuildFile; fileRef = 4862F0A811BDA27200946BBE /* SHA3api_ref.c */; }; - 48F7F35D12B2EF6000AF4587 /* CommonRandom.c in Sources */ = {isa = PBXBuildFile; fileRef = 12FA0DB111F7964700917A4E /* CommonRandom.c */; }; - 48F7F36212B2EF6000AF4587 /* cfb8_decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340112270E8900F9C9E1 /* cfb8_decrypt.c */; }; - 48F7F36312B2EF6000AF4587 /* cfb8_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340212270E8900F9C9E1 /* cfb8_descriptor.c */; }; - 48F7F36412B2EF6000AF4587 /* cfb8_done.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340312270E8900F9C9E1 /* cfb8_done.c */; }; - 48F7F36512B2EF6000AF4587 /* cfb8_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340412270E8900F9C9E1 /* cfb8_encrypt.c */; }; - 48F7F36612B2EF6000AF4587 /* cfb8_getiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340512270E8900F9C9E1 /* cfb8_getiv.c */; }; - 48F7F36712B2EF6000AF4587 /* cfb8_setiv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340612270E8900F9C9E1 /* cfb8_setiv.c */; }; - 48F7F36812B2EF6000AF4587 /* cfb8_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 1249340712270E8900F9C9E1 /* cfb8_start.c */; }; - 48F7F37A12B2F05A00AF4587 /* aes.c in Sources */ = {isa = PBXBuildFile; fileRef = 48F7F37712B2F05A00AF4587 /* aes.c */; }; - 48F7F37B12B2F05A00AF4587 /* aes_tab.c in Sources */ = {isa = PBXBuildFile; fileRef = 48F7F37812B2F05A00AF4587 /* aes_tab.c */; }; - 48F7F37C12B2F05A00AF4587 /* ltc_aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 48F7F37912B2F05A00AF4587 /* ltc_aes.h */; }; - 5302E41F1343E367003037FA /* CommonCMAC.c in Sources */ = {isa = PBXBuildFile; fileRef = 53B9FDE81343DD0600CA1154 /* CommonCMAC.c */; }; - 5302E4201343E3CE003037FA /* CommonCMACSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 53B9FDED1343DDB700CA1154 /* CommonCMACSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 5D113BE01106452100B412A2 /* CommonCryptoUnitTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D113BD61106452100B412A2 /* CommonCryptoUnitTests.mm */; }; - 5DAD82CF1279DF2B00240B9A /* DigestTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D113BD81106452100B412A2 /* DigestTest.mm */; }; - 5DAD82D01279DF2B00240B9A /* EncryptionTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D113BDA1106452100B412A2 /* EncryptionTest.mm */; }; - 5DAD82D11279DF2B00240B9A /* HMACTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D113BDC1106452100B412A2 /* HMACTest.mm */; }; - 5DAD82D21279DF2B00240B9A /* RandomNumberService.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D113BDE1106452100B412A2 /* RandomNumberService.mm */; }; - 5DAD82D31279DF2B00240B9A /* PBKDFTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4882005C111AAD7A00798F94 /* PBKDFTest.mm */; }; - 5DAD82D41279DF2B00240B9A /* SymmetricWrapTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D57A808111B5DDE008CA573 /* SymmetricWrapTest.mm */; }; - 5DAD82E11279DF7A00240B9A /* libCommonCryptoUnitTest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DAD82CC1279DEF900240B9A /* libCommonCryptoUnitTest.a */; }; - 5DAD839F1279F22C00240B9A /* libCommonCryptoUnitTest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DAD82CC1279DEF900240B9A /* libCommonCryptoUnitTest.a */; }; - 5DAD83A11279F26700240B9A /* System.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4857A13011BDA737001F5A9A /* System.framework */; }; - 5DAD83A31279F29300240B9A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DAD83A21279F29300240B9A /* Foundation.framework */; }; - 5DAD83A61279F29800240B9A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DAD83A21279F29300240B9A /* Foundation.framework */; }; - 5DAD83AF1279F4C400240B9A /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5DAD83A71279F2B200240B9A /* main.mm */; }; - 795CA41E0D34459D00BAE6A2 /* ccRC2.c in Sources */ = {isa = PBXBuildFile; fileRef = 795CA3FD0D34431400BAE6A2 /* ccRC2.c */; }; - 795CA41F0D34459D00BAE6A2 /* rc2.c in Sources */ = {isa = PBXBuildFile; fileRef = 795CA3FE0D34431400BAE6A2 /* rc2.c */; }; - AAAF0B9E0DC7A3DA0044DA03 /* sha1edpBigEndian.s in Sources */ = {isa = PBXBuildFile; fileRef = AAB5CBCD0DC6AB6D0019E0E6 /* sha1edpBigEndian.s */; }; - AAAF0B9F0DC7A3DA0044DA03 /* sha1edpLittleEndian.s in Sources */ = {isa = PBXBuildFile; fileRef = AAB5CBCE0DC6AB6D0019E0E6 /* sha1edpLittleEndian.s */; }; + 489E06F914B7AB0900B0A282 /* corecryptoSymmetricBridge.c in Sources */ = {isa = PBXBuildFile; fileRef = 489E06F814B7AB0800B0A282 /* corecryptoSymmetricBridge.c */; }; + 489E06FA14B7AB0900B0A282 /* corecryptoSymmetricBridge.c in Sources */ = {isa = PBXBuildFile; fileRef = 489E06F814B7AB0800B0A282 /* corecryptoSymmetricBridge.c */; }; + 489E06FB14B7AB0900B0A282 /* corecryptoSymmetricBridge.c in Sources */ = {isa = PBXBuildFile; fileRef = 489E06F814B7AB0800B0A282 /* corecryptoSymmetricBridge.c */; }; + 489EECB1149809A800B44D5A /* asn1Types.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA2149809A800B44D5A /* asn1Types.h */; }; + 489EECB2149809A800B44D5A /* asn1Types.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA2149809A800B44D5A /* asn1Types.h */; }; + 489EECB3149809A800B44D5A /* asn1Types.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA2149809A800B44D5A /* asn1Types.h */; }; + 489EECB4149809A800B44D5A /* DER_CertCrl.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA3149809A800B44D5A /* DER_CertCrl.c */; }; + 489EECB5149809A800B44D5A /* DER_CertCrl.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA3149809A800B44D5A /* DER_CertCrl.c */; }; + 489EECB6149809A800B44D5A /* DER_CertCrl.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA3149809A800B44D5A /* DER_CertCrl.c */; }; + 489EECB7149809A800B44D5A /* DER_CertCrl.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA4149809A800B44D5A /* DER_CertCrl.h */; }; + 489EECB8149809A800B44D5A /* DER_CertCrl.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA4149809A800B44D5A /* DER_CertCrl.h */; }; + 489EECB9149809A800B44D5A /* DER_CertCrl.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA4149809A800B44D5A /* DER_CertCrl.h */; }; + 489EECBA149809A800B44D5A /* DER_Decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA5149809A800B44D5A /* DER_Decode.c */; }; + 489EECBB149809A800B44D5A /* DER_Decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA5149809A800B44D5A /* DER_Decode.c */; }; + 489EECBC149809A800B44D5A /* DER_Decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA5149809A800B44D5A /* DER_Decode.c */; }; + 489EECBD149809A800B44D5A /* DER_Decode.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA6149809A800B44D5A /* DER_Decode.h */; }; + 489EECBE149809A800B44D5A /* DER_Decode.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA6149809A800B44D5A /* DER_Decode.h */; }; + 489EECBF149809A800B44D5A /* DER_Decode.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA6149809A800B44D5A /* DER_Decode.h */; }; + 489EECC0149809A800B44D5A /* DER_Digest.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA7149809A800B44D5A /* DER_Digest.c */; }; + 489EECC1149809A800B44D5A /* DER_Digest.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA7149809A800B44D5A /* DER_Digest.c */; }; + 489EECC2149809A800B44D5A /* DER_Digest.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA7149809A800B44D5A /* DER_Digest.c */; }; + 489EECC3149809A800B44D5A /* DER_Digest.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA8149809A800B44D5A /* DER_Digest.h */; }; + 489EECC4149809A800B44D5A /* DER_Digest.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA8149809A800B44D5A /* DER_Digest.h */; }; + 489EECC5149809A800B44D5A /* DER_Digest.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECA8149809A800B44D5A /* DER_Digest.h */; }; + 489EECC6149809A800B44D5A /* DER_Encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA9149809A800B44D5A /* DER_Encode.c */; }; + 489EECC7149809A800B44D5A /* DER_Encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA9149809A800B44D5A /* DER_Encode.c */; }; + 489EECC8149809A800B44D5A /* DER_Encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECA9149809A800B44D5A /* DER_Encode.c */; }; + 489EECC9149809A800B44D5A /* DER_Encode.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAA149809A800B44D5A /* DER_Encode.h */; }; + 489EECCA149809A800B44D5A /* DER_Encode.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAA149809A800B44D5A /* DER_Encode.h */; }; + 489EECCB149809A800B44D5A /* DER_Encode.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAA149809A800B44D5A /* DER_Encode.h */; }; + 489EECCC149809A800B44D5A /* DER_Keys.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECAB149809A800B44D5A /* DER_Keys.c */; }; + 489EECCD149809A800B44D5A /* DER_Keys.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECAB149809A800B44D5A /* DER_Keys.c */; }; + 489EECCE149809A800B44D5A /* DER_Keys.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECAB149809A800B44D5A /* DER_Keys.c */; }; + 489EECCF149809A800B44D5A /* DER_Keys.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAC149809A800B44D5A /* DER_Keys.h */; }; + 489EECD0149809A800B44D5A /* DER_Keys.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAC149809A800B44D5A /* DER_Keys.h */; }; + 489EECD1149809A800B44D5A /* DER_Keys.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAC149809A800B44D5A /* DER_Keys.h */; }; + 489EECD2149809A800B44D5A /* libDER.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAD149809A800B44D5A /* libDER.h */; }; + 489EECD3149809A800B44D5A /* libDER.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAD149809A800B44D5A /* libDER.h */; }; + 489EECD4149809A800B44D5A /* libDER.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAD149809A800B44D5A /* libDER.h */; }; + 489EECD5149809A800B44D5A /* libDER_config.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAE149809A800B44D5A /* libDER_config.h */; }; + 489EECD6149809A800B44D5A /* libDER_config.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAE149809A800B44D5A /* libDER_config.h */; }; + 489EECD7149809A800B44D5A /* libDER_config.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECAE149809A800B44D5A /* libDER_config.h */; }; + 489EECD8149809A800B44D5A /* oids.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECAF149809A800B44D5A /* oids.c */; }; + 489EECD9149809A800B44D5A /* oids.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECAF149809A800B44D5A /* oids.c */; }; + 489EECDA149809A800B44D5A /* oids.c in Sources */ = {isa = PBXBuildFile; fileRef = 489EECAF149809A800B44D5A /* oids.c */; }; + 489EECDB149809A800B44D5A /* oids.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECB0149809A800B44D5A /* oids.h */; }; + 489EECDC149809A800B44D5A /* oids.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECB0149809A800B44D5A /* oids.h */; }; + 489EECDD149809A800B44D5A /* oids.h in Headers */ = {isa = PBXBuildFile; fileRef = 489EECB0149809A800B44D5A /* oids.h */; }; + 489F2442141AA3D0005E80FD /* CommonCMAC.c in Sources */ = {isa = PBXBuildFile; fileRef = 489F2441141AA3D0005E80FD /* CommonCMAC.c */; }; + 489F2444141AA3D0005E80FD /* CommonCMAC.c in Sources */ = {isa = PBXBuildFile; fileRef = 489F2441141AA3D0005E80FD /* CommonCMAC.c */; }; + 489F2445141AA3D0005E80FD /* CommonCMAC.c in Sources */ = {isa = PBXBuildFile; fileRef = 489F2441141AA3D0005E80FD /* CommonCMAC.c */; }; + 489FD30C13187B1D00ACB86D /* CommonHMacSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 489FD30B13187B1D00ACB86D /* CommonHMacSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 489FD30E13187B1D00ACB86D /* CommonHMacSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 489FD30B13187B1D00ACB86D /* CommonHMacSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 489FD30F13187B1D00ACB86D /* CommonHMacSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 489FD30B13187B1D00ACB86D /* CommonHMacSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48A5CBA2131EE096002A6E85 /* CommonGCMCryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 48A5CBA0131EE096002A6E85 /* CommonGCMCryptor.c */; }; + 48A5CBA6131EE096002A6E85 /* CommonGCMCryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 48A5CBA0131EE096002A6E85 /* CommonGCMCryptor.c */; }; + 48A5CBA8131EE096002A6E85 /* CommonGCMCryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 48A5CBA0131EE096002A6E85 /* CommonGCMCryptor.c */; }; + 48AC47CF1381EFDC00F584F5 /* byteBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 48AC47CD1381EFDC00F584F5 /* byteBuffer.c */; }; + 48AC47D11381EFDC00F584F5 /* byteBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 48AC47CD1381EFDC00F584F5 /* byteBuffer.c */; }; + 48AC47D21381EFDC00F584F5 /* byteBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 48AC47CD1381EFDC00F584F5 /* byteBuffer.c */; }; + 48AC47D51381EFDC00F584F5 /* byteBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 48AC47CE1381EFDC00F584F5 /* byteBuffer.h */; }; + 48AC47D71381EFDC00F584F5 /* byteBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 48AC47CE1381EFDC00F584F5 /* byteBuffer.h */; }; + 48AC47D81381EFDC00F584F5 /* byteBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 48AC47CE1381EFDC00F584F5 /* byteBuffer.h */; }; + 48B4651412848FB800311799 /* CommonRSACryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 48B4651112848FB800311799 /* CommonRSACryptor.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48B4651512848FB800311799 /* CommonRSACryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 48B4651112848FB800311799 /* CommonRSACryptor.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48B4651712848FB800311799 /* CommonRSACryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 48B4651112848FB800311799 /* CommonRSACryptor.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48B4651D1284907600311799 /* CommonRSACryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 48B4651B1284907600311799 /* CommonRSACryptor.c */; }; + 48B4651E1284907600311799 /* CommonRSACryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 48B4651B1284907600311799 /* CommonRSACryptor.c */; }; + 48B4651F1284907600311799 /* CommonRSACryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 48B4651B1284907600311799 /* CommonRSACryptor.c */; }; + 48C5CB9214FD747500F4472E /* CommonDHtest.c in Sources */ = {isa = PBXBuildFile; fileRef = 48C5CB9114FD747500F4472E /* CommonDHtest.c */; }; + 48C5CB9314FD747500F4472E /* CommonDHtest.c in Sources */ = {isa = PBXBuildFile; fileRef = 48C5CB9114FD747500F4472E /* CommonDHtest.c */; }; + 48CCD26514F6F189002B6043 /* CommonBigDigest.c in Sources */ = {isa = PBXBuildFile; fileRef = 48CCD26414F6F189002B6043 /* CommonBigDigest.c */; }; + 48CCD26614F6F1E1002B6043 /* CommonBigDigest.c in Sources */ = {isa = PBXBuildFile; fileRef = 48CCD26414F6F189002B6043 /* CommonBigDigest.c */; }; + 48D076C1130B2A510052D1AC /* CommonDH.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D076C0130B2A510052D1AC /* CommonDH.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48D076C3130B2A510052D1AC /* CommonDH.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D076C0130B2A510052D1AC /* CommonDH.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48D076C5130B2A510052D1AC /* CommonDH.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D076C0130B2A510052D1AC /* CommonDH.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48D076C8130B2A620052D1AC /* CommonECCryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D076C7130B2A620052D1AC /* CommonECCryptor.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48D076CA130B2A620052D1AC /* CommonECCryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D076C7130B2A620052D1AC /* CommonECCryptor.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48D076CC130B2A620052D1AC /* CommonECCryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D076C7130B2A620052D1AC /* CommonECCryptor.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48D076D0130B2A9C0052D1AC /* CommonDH.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D076CE130B2A9C0052D1AC /* CommonDH.c */; }; + 48D076D1130B2A9C0052D1AC /* CommonECCryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D076CF130B2A9C0052D1AC /* CommonECCryptor.c */; }; + 48D076D4130B2A9C0052D1AC /* CommonDH.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D076CE130B2A9C0052D1AC /* CommonDH.c */; }; + 48D076D5130B2A9C0052D1AC /* CommonECCryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D076CF130B2A9C0052D1AC /* CommonECCryptor.c */; }; + 48D076D8130B2A9C0052D1AC /* CommonDH.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D076CE130B2A9C0052D1AC /* CommonDH.c */; }; + 48D076D9130B2A9C0052D1AC /* CommonECCryptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 48D076CF130B2A9C0052D1AC /* CommonECCryptor.c */; }; + 48E93DCB136867F500B33DB8 /* CommonCMACSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 48E93DCA136867F500B33DB8 /* CommonCMACSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48E93DCC136867F500B33DB8 /* CommonCMACSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 48E93DCA136867F500B33DB8 /* CommonCMACSPI.h */; }; + 48E93DCD136867F500B33DB8 /* CommonCMACSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 48E93DCA136867F500B33DB8 /* CommonCMACSPI.h */; }; + 48F5355314902894000D2D1F /* CommonRandom.c in Sources */ = {isa = PBXBuildFile; fileRef = 48F5355214902894000D2D1F /* CommonRandom.c */; }; + 48F5355414902894000D2D1F /* CommonRandom.c in Sources */ = {isa = PBXBuildFile; fileRef = 48F5355214902894000D2D1F /* CommonRandom.c */; }; + 48FC4BD613959D0600DA4760 /* lionCompat.h in Headers */ = {isa = PBXBuildFile; fileRef = 48FC4BD513959D0600DA4760 /* lionCompat.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 48FC4BD81395ACE600DA4760 /* CommonCryptoCASTShoefly.c in Sources */ = {isa = PBXBuildFile; fileRef = 48FC4BD71395ACE600DA4760 /* CommonCryptoCASTShoefly.c */; }; + 48FD6C3A1354DD4000F55B8B /* ccErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 48FD6C371354DD4000F55B8B /* ccErrors.h */; }; + 48FD6C3B1354DD4000F55B8B /* ccMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 48FD6C381354DD4000F55B8B /* ccMemory.h */; }; + 48FD6C401354DD4000F55B8B /* ccErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 48FD6C371354DD4000F55B8B /* ccErrors.h */; }; + 48FD6C411354DD4000F55B8B /* ccMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 48FD6C381354DD4000F55B8B /* ccMemory.h */; }; + 48FD6C431354DD4000F55B8B /* ccErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 48FD6C371354DD4000F55B8B /* ccErrors.h */; }; + 48FD6C441354DD4000F55B8B /* ccMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 48FD6C381354DD4000F55B8B /* ccMemory.h */; }; + 4CDDFB7E133BD3BA00B4770F /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 48685583127B63F200B88D39 /* aes.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 4CF7820B1339B543004A56DF /* CommonCryptoAESShoefly.c in Sources */ = {isa = PBXBuildFile; fileRef = 48685586127B641800B88D39 /* CommonCryptoAESShoefly.c */; }; + 5DB80D3E14FC5CB3002C9A03 /* CommonRandom.c in Sources */ = {isa = PBXBuildFile; fileRef = 48F5355214902894000D2D1F /* CommonRandom.c */; }; D6658D950BD8178400D18063 /* CC_crypto.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 05DF6D1109CF2D7200D9A3E8 /* CC_crypto.3cc */; }; D6658D960BD8178400D18063 /* CC_MD2.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = D671B5B60BC6D67000878B42 /* CC_MD2.3cc */; }; D6658D970BD8178400D18063 /* CC_MD2_Final.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = D671B5B70BC6D67000878B42 /* CC_MD2_Final.3cc */; }; D6658D980BD8178400D18063 /* CC_MD2_Init.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = D671B5B80BC6D67000878B42 /* CC_MD2_Init.3cc */; }; D6658D990BD8178400D18063 /* CC_MD2_Update.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = D671B5B90BC6D67000878B42 /* CC_MD2_Update.3cc */; }; @@ -533,21 +342,38 @@ D6658DC30BD8178400D18063 /* CCryptorCreateFromData.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = D671B5E10BC6D67000878B42 /* CCryptorCreateFromData.3cc */; }; D6658DC40BD8178400D18063 /* Common Crypto.3cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = D671B5E20BC6D67000878B42 /* Common Crypto.3cc */; }; /* End PBXBuildFile section */ /* Begin PBXBuildRule section */ - 48F7F36912B2EF6000AF4587 /* PBXBuildRule */ = { + 48165DB5125AC5D50015A267 /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.gcc; + fileType = sourcecode.c; + isEditable = 1; + outputFiles = ( + ); + }; + 48165E98125AC5F20015A267 /* PBXBuildRule */ = { isa = PBXBuildRule; compilerSpec = com.apple.compilers.gcc; fileType = sourcecode.c; isEditable = 1; outputFiles = ( ); + }; + 48B5F5281361D6A500134C9F /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.llvmgcc42; + fileType = sourcecode.nasm; + isEditable = 1; + outputFiles = ( + ); + script = "$(DEVELOPER_BIN_DIR)/nasm\n"; }; B125268E0713742A00BB8157 /* PBXBuildRule */ = { isa = PBXBuildRule; - compilerSpec = com.apple.compilers.gcc; + compilerSpec = com.apple.compilers.llvmgcc42; fileType = sourcecode.c; isEditable = 1; outputFiles = ( ); }; @@ -559,60 +385,39 @@ containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; proxyType = 1; remoteGlobalIDString = 05CE94290A3784D4007C91D6; remoteInfo = "Copy Open Source Docs"; }; - 1228ADD612037B1000B83BF9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 054BBEBD05F6A97700344873; - remoteInfo = commonCrypto; - }; - 12F60BE912015A2600D17AF3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 054BBEBD05F6A97700344873; - remoteInfo = commonCrypto; - }; - 5D936FFA110E7FFF006855B0 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 054BBEBD05F6A97700344873; - remoteInfo = commonCrypto; - }; - 5DAD82DB1279DF6100240B9A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5DAD82CB1279DEF900240B9A; - remoteInfo = UnitTestLibrary; - }; - 5DAD839D1279F22000240B9A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5DAD82CB1279DEF900240B9A; - remoteInfo = UnitTestLibrary; - }; - 5DAD83D11279F6D500240B9A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5DAD83981279F1EC00240B9A; - remoteInfo = CommonCryptoTestTool; - }; - 5DC8771010FFB7510012A390 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5D735E4710FCDC04001AAD1E; - remoteInfo = CommonCryptoUnitTest; - }; - FC129BEC116AED0500D618D5 /* PBXContainerItemProxy */ = { + 4823B10C14C101CC008F689F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 054BBEBD05F6A97700344873; + remoteInfo = libCommonCryptoMacOSX; + }; + 4834A88314F47CA300438E3D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 48165CD7125AC5D50015A267; + remoteInfo = libCommonCryptoMacIOS; + }; + 4C58A28C13281C2100A17BAC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 48165CD7125AC5D50015A267; + remoteInfo = libCommonCryptoMacIOS; + }; + 4CA675181332C17900C45A71 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 48165DBA125AC5F20015A267; + remoteInfo = libCommonCryptoMacIOSSim; + }; + 5D936FFA110E7FFF006855B0 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 054BBEA605F6A8DE00344873 /* Project object */; proxyType = 1; remoteGlobalIDString = 054BBEBD05F6A97700344873; remoteInfo = commonCrypto; @@ -635,10 +440,28 @@ buildActionMask = 8; dstPath = /usr/local/OpenSourceLicenses/; dstSubfolderSpec = 0; files = ( 0511C47E0A37892C0028BFC3 /* CommonCrypto.txt in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; + 4823B0DE14C10064008F689F /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; + 4834A87C14F47B6200438E3D /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( ); runOnlyForDeploymentPostprocessing = 1; }; D6658DC80BD817B600D18063 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; @@ -692,330 +515,163 @@ D6658DC00BD8178400D18063 /* CCHmacFinal.3cc in CopyFiles */, D6658DC10BD8178400D18063 /* CCHmacInit.3cc in CopyFiles */, D6658DC20BD8178400D18063 /* CCHmacUpdate.3cc in CopyFiles */, D6658DC30BD8178400D18063 /* CCryptorCreateFromData.3cc in CopyFiles */, D6658DC40BD8178400D18063 /* Common Crypto.3cc in CopyFiles */, - 48F7B00112F248C900E70774 /* CCCalibratePBKDF.3cc in CopyFiles */, - 48F7B00212F248C900E70774 /* CCCommonKeyDerivation.3cc in CopyFiles */, - 48F7B00812F248E600E70774 /* CCKeyDerivationPBKDF.3cc in CopyFiles */, - 48F7B00912F248E600E70774 /* CCSymmetricKeyUnwrap.3cc in CopyFiles */, - 48F7B00A12F248E600E70774 /* CCSymmetricKeyWrap.3cc in CopyFiles */, - 48F7B00B12F248E700E70774 /* CCSymmetricUnwrappedSize.3cc in CopyFiles */, - 48F7B00C12F248E700E70774 /* CCSymmetricWrappedSize.3cc in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 1; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0539DC2609D4919D00AB7F89 /* opensslDES.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = opensslDES.c; sourceTree = ""; }; 054BBEBE05F6A97700344873 /* libcommonCrypto.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcommonCrypto.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 054BBEC605F6A98900344873 /* libcommonCrypto.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcommonCrypto.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 054BBECD05F6AA7200344873 /* CommonDigest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CommonDigest.h; sourceTree = ""; }; - 054BBED305F6AA8900344873 /* md2_dgst.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = md2_dgst.c; sourceTree = ""; }; - 054BBED405F6AA8900344873 /* md4_dgst.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = md4_dgst.c; sourceTree = ""; }; - 054BBED505F6AA8900344873 /* md4_locl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = md4_locl.h; sourceTree = ""; }; - 054BBED605F6AA8900344873 /* md5_dgst.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = md5_dgst.c; sourceTree = ""; }; - 054BBED705F6AA8900344873 /* md5_locl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = md5_locl.h; sourceTree = ""; }; - 054BBED805F6AA8900344873 /* md32_common.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = md32_common.h; sourceTree = ""; }; - 054BBEDA05F6AA8900344873 /* sha_locl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = sha_locl.h; sourceTree = ""; }; - 054BBEDC05F6AA8900344873 /* sha1.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = sha1.c; sourceTree = ""; }; - 0585FE1209DC9873001762F6 /* c_ecb.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = c_ecb.c; sourceTree = ""; }; - 0585FE1309DC9873001762F6 /* c_enc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = c_enc.c; sourceTree = ""; }; - 0585FE1409DC9873001762F6 /* c_skey.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = c_skey.c; sourceTree = ""; }; - 0585FE1609DC9873001762F6 /* cast_lcl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cast_lcl.h; sourceTree = ""; }; - 0585FE1709DC9873001762F6 /* cast_s.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cast_s.h; sourceTree = ""; }; - 0585FE1809DC9873001762F6 /* ccCast.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ccCast.c; sourceTree = ""; }; - 05C4416E09D4BACE002066D1 /* e_os2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = e_os2.h; sourceTree = ""; }; - 05C4417209D4BB0B002066D1 /* opensslconf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = opensslconf.h; sourceTree = ""; }; - 05C70C5309D471C30004B8F4 /* spr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = spr.h; sourceTree = ""; }; 05CE942B0A37850A007C91D6 /* CommonCrypto.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; name = CommonCrypto.plist; path = doc/CommonCrypto.plist; sourceTree = ""; }; 05CE942C0A37850A007C91D6 /* CommonCrypto.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = CommonCrypto.txt; path = doc/CommonCrypto.txt; sourceTree = ""; }; 05D8D97C09E411AA00E03504 /* CommonHMAC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonHMAC.h; sourceTree = ""; }; 05D9F61609D85F4A00AD30A7 /* CommonCryptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCryptor.h; sourceTree = ""; }; 05DF6D1109CF2D7200D9A3E8 /* CC_crypto.3cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = CC_crypto.3cc; path = doc/CC_crypto.3cc; sourceTree = ""; }; 05DF6D1209CF2D7200D9A3E8 /* CC_MD5.3cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = CC_MD5.3cc; path = doc/CC_MD5.3cc; sourceTree = ""; }; 05DF6D1309CF2D7200D9A3E8 /* CC_SHA.3cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = CC_SHA.3cc; path = doc/CC_SHA.3cc; sourceTree = ""; }; - 05E319B7063890C100C4AD24 /* sha2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = sha2.c; sourceTree = ""; }; - 05E319DC0638913700C4AD24 /* sha2Priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha2Priv.h; sourceTree = ""; }; - 05ECA0E409D468E200CFE5CB /* des.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = des.h; sourceTree = ""; }; - 05ECA0E509D468E200CFE5CB /* des_enc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = des_enc.c; sourceTree = ""; }; - 05ECA0E609D468E200CFE5CB /* des_locl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = des_locl.h; sourceTree = ""; }; - 05ECA0ED09D469A100CFE5CB /* set_key.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = set_key.c; sourceTree = ""; }; - 122ADC43121320D70027F302 /* sha256_nossse3.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = sha256_nossse3.s; sourceTree = ""; }; - 122ADC44121320D70027F302 /* sha256.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = sha256.s; sourceTree = ""; }; - 1249340112270E8900F9C9E1 /* cfb8_decrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb8_decrypt.c; sourceTree = ""; }; - 1249340212270E8900F9C9E1 /* cfb8_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb8_descriptor.c; sourceTree = ""; }; - 1249340312270E8900F9C9E1 /* cfb8_done.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb8_done.c; sourceTree = ""; }; - 1249340412270E8900F9C9E1 /* cfb8_encrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb8_encrypt.c; sourceTree = ""; }; - 1249340512270E8900F9C9E1 /* cfb8_getiv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb8_getiv.c; sourceTree = ""; }; - 1249340612270E8900F9C9E1 /* cfb8_setiv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb8_setiv.c; sourceTree = ""; }; - 1249340712270E8900F9C9E1 /* cfb8_start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb8_start.c; sourceTree = ""; }; - 125B78AE11FF877D008C1AD3 /* aesedpPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aesedpPriv.h; sourceTree = ""; }; - 125B795111FF923D008C1AD3 /* XTStest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = XTStest; sourceTree = BUILT_PRODUCTS_DIR; }; - 125B796011FF92FC008C1AD3 /* crypto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypto.c; sourceTree = ""; }; - 125B796111FF92FC008C1AD3 /* hexString.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hexString.c; sourceTree = ""; }; - 125B796211FF92FC008C1AD3 /* hexString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hexString.h; sourceTree = ""; }; - 125B796311FF92FC008C1AD3 /* printByteBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = printByteBuffer.c; sourceTree = ""; }; - 125B796411FF92FC008C1AD3 /* printByteBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = printByteBuffer.h; sourceTree = ""; }; - 125B796511FF92FC008C1AD3 /* xtsTestVectors.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xtsTestVectors.c; sourceTree = ""; }; - 125B796611FF92FC008C1AD3 /* xtsTestVectors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xtsTestVectors.h; sourceTree = ""; }; - 12790C7411F7C4BA0044EFE5 /* CommonCrypto_unittest_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CommonCrypto_unittest_deployment.xcconfig; path = Configurations/CommonCrypto_unittest_deployment.xcconfig; sourceTree = ""; }; - 12790C7511F7C4BA0044EFE5 /* CommonCrypto_unittest_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CommonCrypto_unittest_development.xcconfig; path = Configurations/CommonCrypto_unittest_development.xcconfig; sourceTree = ""; }; - 128881651203673C0050B2E9 /* CBCTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CBCTest; sourceTree = BUILT_PRODUCTS_DIR; }; - 12A1ADD71207419E000C30A4 /* CommonCrypto_localtest.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CommonCrypto_localtest.xcconfig; path = Configurations/CommonCrypto_localtest.xcconfig; sourceTree = ""; }; - 12C3F7E5122AD1B100E09D9E /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; - 12CC5DD8120373D1001B4FCE /* CBCTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBCTest.h; sourceTree = ""; }; - 12CC5DD9120373D1001B4FCE /* CBCTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CBCTest.c; sourceTree = ""; }; 12FA0DAF11F7962100917A4E /* CommonRandomSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonRandomSPI.h; sourceTree = ""; }; - 12FA0DB111F7964700917A4E /* CommonRandom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonRandom.c; sourceTree = ""; }; - 12FA10D011F7AACE00917A4E /* CommonCrypto_umbrellaMember_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CommonCrypto_umbrellaMember_deployment.xcconfig; path = Configurations/CommonCrypto_umbrellaMember_deployment.xcconfig; sourceTree = ""; }; - 12FA10D111F7AAE400917A4E /* CommonCrypto_umbrellaMember_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CommonCrypto_umbrellaMember_development.xcconfig; path = Configurations/CommonCrypto_umbrellaMember_development.xcconfig; sourceTree = ""; }; - 12FA10D211F7AB3E00917A4E /* CommonCrypto_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CommonCrypto_deployment.xcconfig; path = Configurations/CommonCrypto_deployment.xcconfig; sourceTree = ""; }; - 12FA10D311F7AB5000917A4E /* CommonCrypto_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CommonCrypto_development.xcconfig; path = Configurations/CommonCrypto_development.xcconfig; sourceTree = ""; }; - 12FA10D811F7ABCD00917A4E /* CommonCrypto_umbrellaMember.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CommonCrypto_umbrellaMember.xcconfig; path = Configurations/CommonCrypto_umbrellaMember.xcconfig; sourceTree = ""; }; - 12FBB0891238353000772329 /* CommonCrypto.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = CommonCrypto.exp; sourceTree = ""; }; 48096B2211A5EF900043F67F /* CommonDigest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonDigest.c; sourceTree = ""; }; - 480C9AD512077BCF002EC023 /* byteBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = byteBuffer.c; sourceTree = ""; }; - 480C9AD612077BCF002EC023 /* byteBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = byteBuffer.h; sourceTree = ""; }; - 4836A41811A5C94A00862178 /* rc2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = rc2.h; path = ../CommonCryptoSPI/rc2.h; sourceTree = ""; }; - 4836A41911A5C94A00862178 /* opensslDES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = opensslDES.h; path = ../CommonCryptoSPI/opensslDES.h; sourceTree = ""; }; + 48165DB9125AC5D50015A267 /* libcommonCrypto.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcommonCrypto.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 48165E9C125AC5F20015A267 /* libcommonCrypto_sim.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcommonCrypto_sim.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 4823B0AE14C10022008F689F /* CCCryptorTestFuncs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CCCryptorTestFuncs.c; sourceTree = ""; }; + 4823B0AF14C10022008F689F /* CCCryptorTestFuncs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCCryptorTestFuncs.h; sourceTree = ""; }; + 4823B0B014C10022008F689F /* CommonBaseEncoding.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonBaseEncoding.c; sourceTree = ""; }; + 4823B0B114C10022008F689F /* CommonBigNum.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonBigNum.c; sourceTree = ""; }; + 4823B0B214C10022008F689F /* CommonCMac.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonCMac.c; sourceTree = ""; }; + 4823B0B314C10022008F689F /* CommonCryptoCTSPadding.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonCryptoCTSPadding.c; sourceTree = ""; }; + 4823B0B414C10022008F689F /* CommonCryptoSymCBC.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonCryptoSymCBC.c; sourceTree = ""; }; + 4823B0B514C10022008F689F /* CommonCryptoSymGCM.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonCryptoSymGCM.c; sourceTree = ""; }; + 4823B0B614C10022008F689F /* CommonCryptoSymmetricWrap.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonCryptoSymmetricWrap.c; sourceTree = ""; }; + 4823B0B714C10022008F689F /* CommonCryptoSymOFB.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonCryptoSymOFB.c; sourceTree = ""; }; + 4823B0B814C10022008F689F /* CommonCryptoSymOffset.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonCryptoSymOffset.c; sourceTree = ""; }; + 4823B0B914C10022008F689F /* CommonCryptoSymRC2.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonCryptoSymRC2.c; sourceTree = ""; }; + 4823B0BA14C10022008F689F /* CommonCryptoSymRegression.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonCryptoSymRegression.c; sourceTree = ""; }; + 4823B0BB14C10022008F689F /* CommonCryptoSymXTS.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonCryptoSymXTS.c; sourceTree = ""; }; + 4823B0BC14C10022008F689F /* CommonCryptoSymZeroLength.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonCryptoSymZeroLength.c; sourceTree = ""; }; + 4823B0BD14C10022008F689F /* CommonDigest.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonDigest.c; sourceTree = ""; }; + 4823B0BE14C10022008F689F /* CommonEC.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonEC.c; sourceTree = ""; }; + 4823B0BF14C10022008F689F /* CommonHMacClone.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonHMacClone.c; sourceTree = ""; }; + 4823B0C014C10022008F689F /* CommonRandom.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonRandom.c; sourceTree = ""; }; + 4823B0C114C10022008F689F /* CommonRSA.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CommonRSA.c; sourceTree = ""; }; + 4823B0C314C10022008F689F /* CryptorPadFailure.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CryptorPadFailure.c; sourceTree = ""; }; + 4823B0C614C10022008F689F /* Run3.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = Run3.pm; sourceTree = ""; }; + 4823B0C714C10022008F689F /* MyHarness.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = MyHarness.pm; sourceTree = ""; }; + 4823B0C814C10022008F689F /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; + 4823B0C914C10022008F689F /* README */ = {isa = PBXFileReference; lastKnownFileType = text; path = README; sourceTree = ""; }; + 4823B0CB14C10022008F689F /* security.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = security.pl; sourceTree = ""; }; + 4823B0CD14C10022008F689F /* 00testtest.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = 00testtest.c; sourceTree = ""; }; + 4823B0CE14C10022008F689F /* run_tests.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = run_tests.sh; sourceTree = ""; }; + 4823B0CF14C10022008F689F /* testcpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = testcpp.h; sourceTree = ""; }; + 4823B0D014C10022008F689F /* testenv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testenv.c; sourceTree = ""; }; + 4823B0D114C10022008F689F /* testenv.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = testenv.h; sourceTree = ""; }; + 4823B0D214C10022008F689F /* testlist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testlist.c; sourceTree = ""; }; + 4823B0D314C10022008F689F /* testlist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = testlist.h; sourceTree = ""; }; + 4823B0D414C10022008F689F /* testlistInc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = testlistInc.h; sourceTree = ""; }; + 4823B0D514C10022008F689F /* testmore.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testmore.c; sourceTree = ""; }; + 4823B0D614C10022008F689F /* testmore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = testmore.h; sourceTree = ""; }; + 4823B0D814C10022008F689F /* testbyteBuffer.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testbyteBuffer.c; sourceTree = ""; }; + 4823B0D914C10022008F689F /* testbyteBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = testbyteBuffer.h; sourceTree = ""; }; + 4823B0DA14C10022008F689F /* capabilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = capabilities.h; sourceTree = ""; }; + 4823B0E014C10064008F689F /* CCRegression */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CCRegression; sourceTree = BUILT_PRODUCTS_DIR; }; + 4825AAF31314CDCD00413A64 /* CommonBigNum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonBigNum.h; sourceTree = ""; }; + 4834A85214F47A9400438E3D /* libcorecrypto.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcorecrypto.dylib; path = usr/lib/system/libcorecrypto.dylib; sourceTree = SDKROOT; }; + 4834A88014F47B6200438E3D /* CCRegression copy */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "CCRegression copy"; sourceTree = BUILT_PRODUCTS_DIR; }; 4836A41A11A5C94A00862178 /* CommonCryptoPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCryptoPriv.h; sourceTree = ""; }; - 4836A41B11A5C94A00862178 /* ccRC2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ccRC2.h; path = ../CommonCryptoSPI/ccRC2.h; sourceTree = ""; }; - 4836A41C11A5C94A00862178 /* ccCast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ccCast.h; path = ../CommonCryptoSPI/ccCast.h; sourceTree = ""; }; - 4836A41D11A5C94A00862178 /* cast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cast.h; path = ../CommonCryptoSPI/cast.h; sourceTree = ""; }; 4836A42B11A5CB4700862178 /* CommonCryptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonCryptor.c; sourceTree = ""; }; 4836A42C11A5CB4700862178 /* CommonCryptorPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCryptorPriv.h; sourceTree = ""; }; 4836A42D11A5CB4700862178 /* CommonDigestPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonDigestPriv.h; sourceTree = ""; }; 4836A42E11A5CB4700862178 /* CommonHMAC.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonHMAC.c; sourceTree = ""; }; 4836A42F11A5CB4700862178 /* CommonKeyDerivation.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonKeyDerivation.c; sourceTree = ""; }; - 4836A43011A5CB4700862178 /* CommonKeyDerivationPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonKeyDerivationPriv.h; sourceTree = ""; }; 4836A43111A5CB4700862178 /* CommonSymmetricKeywrap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonSymmetricKeywrap.c; sourceTree = ""; }; 4846CA5411A5C8B800E7DA82 /* CommonCryptorSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCryptorSPI.h; sourceTree = ""; }; 4846CA5511A5C8B800E7DA82 /* CommonDigestSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonDigestSPI.h; sourceTree = ""; }; + 484D40FE14DC96A600C93734 /* libcorecrypto.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcorecrypto.dylib; path = ../../../../../../usr/lib/system/libcorecrypto.dylib; sourceTree = ""; }; + 4852C2491505F8CD00676BCC /* CommonCryptoSymCFB.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonCryptoSymCFB.c; sourceTree = ""; }; + 4854BAD5152177CC007B5B08 /* CommonCryptoSymCTR.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonCryptoSymCTR.c; sourceTree = ""; }; 4854F9C01116307500CAFA18 /* CommonKeyDerivation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonKeyDerivation.h; sourceTree = ""; }; 4854F9C11116307500CAFA18 /* CommonSymmetricKeywrap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonSymmetricKeywrap.h; sourceTree = ""; }; 4857A12A11BDA6E0001F5A9A /* libSystem.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libSystem.dylib; path = usr/lib/libSystem.dylib; sourceTree = SDKROOT; }; 4857A13011BDA737001F5A9A /* System.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = System.framework; path = /System/Library/Frameworks/System.framework; sourceTree = ""; }; - 4862F09411BDA1D300946BBE /* skein_ltc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = skein_ltc.h; sourceTree = ""; }; - 4862F09511BDA1D300946BBE /* skein_ltc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = skein_ltc.c; sourceTree = ""; }; - 4862F09E11BDA27200946BBE /* skein.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = skein.h; sourceTree = ""; }; - 4862F09F11BDA27200946BBE /* skein.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = skein.c; sourceTree = ""; }; - 4862F0A011BDA27200946BBE /* skein_port.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = skein_port.h; sourceTree = ""; }; - 4862F0A111BDA27200946BBE /* skein_iv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = skein_iv.h; sourceTree = ""; }; - 4862F0A211BDA27200946BBE /* skein_dropin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = skein_dropin.h; sourceTree = ""; }; - 4862F0A311BDA27200946BBE /* skein_dropin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = skein_dropin.c; sourceTree = ""; }; - 4862F0A411BDA27200946BBE /* skein_debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = skein_debug.h; sourceTree = ""; }; - 4862F0A511BDA27200946BBE /* skein_debug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = skein_debug.c; sourceTree = ""; }; - 4862F0A611BDA27200946BBE /* skein_block.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = skein_block.c; sourceTree = ""; }; - 4862F0A711BDA27200946BBE /* SHA3api_ref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SHA3api_ref.h; sourceTree = ""; }; - 4862F0A811BDA27200946BBE /* SHA3api_ref.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SHA3api_ref.c; sourceTree = ""; }; - 4862F0A911BDA27200946BBE /* brg_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = brg_types.h; sourceTree = ""; }; - 4862F0AA11BDA27200946BBE /* brg_endian.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = brg_endian.h; sourceTree = ""; }; - 4873F33E11A4E47B00B5DDB3 /* footer.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = footer.html; sourceTree = ""; }; - 4873F33F11A4E47B00B5DDB3 /* header.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = header.html; sourceTree = ""; }; - 4873F34011A4E47B00B5DDB3 /* libTomCryptDoc.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = libTomCryptDoc.pdf; sourceTree = ""; }; - 4873F34A11A4E47B00B5DDB3 /* aesedp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aesedp.c; sourceTree = ""; }; - 4873F34B11A4E47B00B5DDB3 /* aesedp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aesedp.h; sourceTree = ""; }; - 4873F35311A4E47B00B5DDB3 /* cast5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cast5.c; sourceTree = ""; }; - 4873F35411A4E47B00B5DDB3 /* des.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = des.c; sourceTree = ""; }; - 4873F35511A4E47B00B5DDB3 /* rc2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rc2.c; sourceTree = ""; }; - 4873F35711A4E47B00B5DDB3 /* rc4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rc4.h; sourceTree = ""; }; - 4873F35811A4E47B00B5DDB3 /* rc4_enc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rc4_enc.c; sourceTree = ""; }; - 4873F35911A4E47B00B5DDB3 /* rc4_skey.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rc4_skey.c; sourceTree = ""; }; - 4873F35A11A4E47B00B5DDB3 /* rc5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rc5.c; sourceTree = ""; }; - 4873F35D11A4E47B00B5DDB3 /* hash_file.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hash_file.c; sourceTree = ""; }; - 4873F35E11A4E47B00B5DDB3 /* hash_filehandle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hash_filehandle.c; sourceTree = ""; }; - 4873F35F11A4E47B00B5DDB3 /* hash_memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hash_memory.c; sourceTree = ""; }; - 4873F36011A4E47B00B5DDB3 /* hash_memory_multi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hash_memory_multi.c; sourceTree = ""; }; - 4873F36111A4E47B00B5DDB3 /* md2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md2.c; sourceTree = ""; }; - 4873F36211A4E47B00B5DDB3 /* md4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md4.c; sourceTree = ""; }; - 4873F36311A4E47B00B5DDB3 /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5.c; sourceTree = ""; }; - 4873F36411A4E47B00B5DDB3 /* rmd128.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rmd128.c; sourceTree = ""; }; - 4873F36511A4E47B00B5DDB3 /* rmd160.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rmd160.c; sourceTree = ""; }; - 4873F36611A4E47B00B5DDB3 /* rmd256.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rmd256.c; sourceTree = ""; }; - 4873F36711A4E47B00B5DDB3 /* rmd320.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rmd320.c; sourceTree = ""; }; - 4873F36811A4E47B00B5DDB3 /* sha1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha1.c; sourceTree = ""; }; - 4873F36A11A4E47B00B5DDB3 /* sha224.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha224.c; sourceTree = ""; }; - 4873F36B11A4E47B00B5DDB3 /* sha256.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha256.c; sourceTree = ""; }; - 4873F36C11A4E47B00B5DDB3 /* sha384.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha384.c; sourceTree = ""; }; - 4873F36D11A4E47B00B5DDB3 /* sha512.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha512.c; sourceTree = ""; }; - 4873F36F11A4E47B00B5DDB3 /* tomcrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt.h; sourceTree = ""; }; - 4873F37011A4E47B00B5DDB3 /* tomcrypt_argchk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_argchk.h; sourceTree = ""; }; - 4873F37111A4E47B00B5DDB3 /* tomcrypt_cfg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_cfg.h; sourceTree = ""; }; - 4873F37211A4E47B00B5DDB3 /* tomcrypt_cipher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_cipher.h; sourceTree = ""; }; - 4873F37311A4E47B00B5DDB3 /* tomcrypt_custom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_custom.h; sourceTree = ""; }; - 4873F37411A4E47B00B5DDB3 /* tomcrypt_hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_hash.h; sourceTree = ""; }; - 4873F37511A4E47B00B5DDB3 /* tomcrypt_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_mac.h; sourceTree = ""; }; - 4873F37611A4E47B00B5DDB3 /* tomcrypt_macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_macros.h; sourceTree = ""; }; - 4873F37711A4E47B00B5DDB3 /* tomcrypt_math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_math.h; sourceTree = ""; }; - 4873F37811A4E47B00B5DDB3 /* tomcrypt_misc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_misc.h; sourceTree = ""; }; - 4873F37911A4E47B00B5DDB3 /* tomcrypt_mode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_mode.h; sourceTree = ""; }; - 4873F37A11A4E47B00B5DDB3 /* tomcrypt_pk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_pk.h; sourceTree = ""; }; - 4873F37B11A4E47B00B5DDB3 /* tomcrypt_pkcs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_pkcs.h; sourceTree = ""; }; - 4873F37C11A4E47B00B5DDB3 /* tomcrypt_prng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tomcrypt_prng.h; sourceTree = ""; }; - 4873F37F11A4E47B00B5DDB3 /* base64_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = base64_decode.c; sourceTree = ""; }; - 4873F38011A4E47B00B5DDB3 /* base64_encode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = base64_encode.c; sourceTree = ""; }; - 4873F38111A4E47B00B5DDB3 /* burn_stack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = burn_stack.c; sourceTree = ""; }; - 4873F38311A4E47B00B5DDB3 /* crypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt.c; sourceTree = ""; }; - 4873F38411A4E47B00B5DDB3 /* crypt_argchk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_argchk.c; sourceTree = ""; }; - 4873F38511A4E47B00B5DDB3 /* crypt_cipher_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_cipher_descriptor.c; sourceTree = ""; }; - 4873F38611A4E47B00B5DDB3 /* crypt_cipher_is_valid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_cipher_is_valid.c; sourceTree = ""; }; - 4873F38711A4E47B00B5DDB3 /* crypt_find_cipher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_find_cipher.c; sourceTree = ""; }; - 4873F38811A4E47B00B5DDB3 /* crypt_find_cipher_any.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_find_cipher_any.c; sourceTree = ""; }; - 4873F38911A4E47B00B5DDB3 /* crypt_find_cipher_id.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_find_cipher_id.c; sourceTree = ""; }; - 4873F38A11A4E47B00B5DDB3 /* crypt_find_hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_find_hash.c; sourceTree = ""; }; - 4873F38B11A4E47B00B5DDB3 /* crypt_find_hash_any.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_find_hash_any.c; sourceTree = ""; }; - 4873F38C11A4E47B00B5DDB3 /* crypt_find_hash_id.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_find_hash_id.c; sourceTree = ""; }; - 4873F38D11A4E47B00B5DDB3 /* crypt_find_hash_oid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_find_hash_oid.c; sourceTree = ""; }; - 4873F38E11A4E47B00B5DDB3 /* crypt_find_prng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_find_prng.c; sourceTree = ""; }; - 4873F38F11A4E47B00B5DDB3 /* crypt_fsa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_fsa.c; sourceTree = ""; }; - 4873F39011A4E47B00B5DDB3 /* crypt_hash_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_hash_descriptor.c; sourceTree = ""; }; - 4873F39111A4E47B00B5DDB3 /* crypt_hash_is_valid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_hash_is_valid.c; sourceTree = ""; }; - 4873F39211A4E47B00B5DDB3 /* crypt_ltc_mp_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_ltc_mp_descriptor.c; sourceTree = ""; }; - 4873F39311A4E47B00B5DDB3 /* crypt_mode_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_mode_descriptor.c; sourceTree = ""; }; - 4873F39411A4E47B00B5DDB3 /* crypt_prng_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_prng_descriptor.c; sourceTree = ""; }; - 4873F39511A4E47B00B5DDB3 /* crypt_prng_is_valid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_prng_is_valid.c; sourceTree = ""; }; - 4873F39611A4E47B00B5DDB3 /* crypt_register_cipher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_register_cipher.c; sourceTree = ""; }; - 4873F39711A4E47B00B5DDB3 /* crypt_register_hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_register_hash.c; sourceTree = ""; }; - 4873F39811A4E47B00B5DDB3 /* crypt_register_prng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_register_prng.c; sourceTree = ""; }; - 4873F39911A4E47B00B5DDB3 /* crypt_unregister_cipher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_unregister_cipher.c; sourceTree = ""; }; - 4873F39A11A4E47B00B5DDB3 /* crypt_unregister_hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_unregister_hash.c; sourceTree = ""; }; - 4873F39B11A4E47B00B5DDB3 /* crypt_unregister_prng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt_unregister_prng.c; sourceTree = ""; }; - 4873F39C11A4E47B00B5DDB3 /* error_to_string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error_to_string.c; sourceTree = ""; }; - 4873F39E11A4E47B00B5DDB3 /* pkcs_5_1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkcs_5_1.c; sourceTree = ""; }; - 4873F39F11A4E47B00B5DDB3 /* pkcs_5_2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkcs_5_2.c; sourceTree = ""; }; - 4873F3A011A4E47B00B5DDB3 /* zeromem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zeromem.c; sourceTree = ""; }; - 4873F3A311A4E47B00B5DDB3 /* cbc_decrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cbc_decrypt.c; sourceTree = ""; }; - 4873F3A411A4E47B00B5DDB3 /* cbc_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cbc_descriptor.c; sourceTree = ""; }; - 4873F3A511A4E47B00B5DDB3 /* cbc_done.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cbc_done.c; sourceTree = ""; }; - 4873F3A611A4E47B00B5DDB3 /* cbc_encrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cbc_encrypt.c; sourceTree = ""; }; - 4873F3A711A4E47B00B5DDB3 /* cbc_getiv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cbc_getiv.c; sourceTree = ""; }; - 4873F3A811A4E47B00B5DDB3 /* cbc_setiv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cbc_setiv.c; sourceTree = ""; }; - 4873F3A911A4E47B00B5DDB3 /* cbc_start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cbc_start.c; sourceTree = ""; }; - 4873F3AB11A4E47B00B5DDB3 /* cfb_decrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb_decrypt.c; sourceTree = ""; }; - 4873F3AC11A4E47B00B5DDB3 /* cfb_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb_descriptor.c; sourceTree = ""; }; - 4873F3AD11A4E47B00B5DDB3 /* cfb_done.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb_done.c; sourceTree = ""; }; - 4873F3AE11A4E47B00B5DDB3 /* cfb_encrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb_encrypt.c; sourceTree = ""; }; - 4873F3AF11A4E47B00B5DDB3 /* cfb_getiv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb_getiv.c; sourceTree = ""; }; - 4873F3B011A4E47B00B5DDB3 /* cfb_setiv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb_setiv.c; sourceTree = ""; }; - 4873F3B111A4E47B00B5DDB3 /* cfb_start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb_start.c; sourceTree = ""; }; - 4873F3B311A4E47B00B5DDB3 /* ctr_decrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ctr_decrypt.c; sourceTree = ""; }; - 4873F3B411A4E47B00B5DDB3 /* ctr_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ctr_descriptor.c; sourceTree = ""; }; - 4873F3B511A4E47B00B5DDB3 /* ctr_done.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ctr_done.c; sourceTree = ""; }; - 4873F3B611A4E47B00B5DDB3 /* ctr_encrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ctr_encrypt.c; sourceTree = ""; }; - 4873F3B711A4E47B00B5DDB3 /* ctr_getiv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ctr_getiv.c; sourceTree = ""; }; - 4873F3B811A4E47B00B5DDB3 /* ctr_setiv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ctr_setiv.c; sourceTree = ""; }; - 4873F3B911A4E47B00B5DDB3 /* ctr_start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ctr_start.c; sourceTree = ""; }; - 4873F3BA11A4E47B00B5DDB3 /* ctr_test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ctr_test.c; sourceTree = ""; }; - 4873F3BC11A4E47B00B5DDB3 /* ecb_decrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ecb_decrypt.c; sourceTree = ""; }; - 4873F3BD11A4E47B00B5DDB3 /* ecb_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ecb_descriptor.c; sourceTree = ""; }; - 4873F3BE11A4E47B00B5DDB3 /* ecb_done.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ecb_done.c; sourceTree = ""; }; - 4873F3BF11A4E47B00B5DDB3 /* ecb_encrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ecb_encrypt.c; sourceTree = ""; }; - 4873F3C011A4E47B00B5DDB3 /* ecb_start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ecb_start.c; sourceTree = ""; }; - 4873F3D511A4E47B00B5DDB3 /* ofb_decrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ofb_decrypt.c; sourceTree = ""; }; - 4873F3D611A4E47B00B5DDB3 /* ofb_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ofb_descriptor.c; sourceTree = ""; }; - 4873F3D711A4E47B00B5DDB3 /* ofb_done.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ofb_done.c; sourceTree = ""; }; - 4873F3D811A4E47B00B5DDB3 /* ofb_encrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ofb_encrypt.c; sourceTree = ""; }; - 4873F3D911A4E47B00B5DDB3 /* ofb_getiv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ofb_getiv.c; sourceTree = ""; }; - 4873F3DA11A4E47B00B5DDB3 /* ofb_setiv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ofb_setiv.c; sourceTree = ""; }; - 4873F3DB11A4E47B00B5DDB3 /* ofb_start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ofb_start.c; sourceTree = ""; }; - 4873F3DC11A4E47B00B5DDB3 /* rc4_stream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rc4_stream.c; sourceTree = ""; }; - 4873F3DD11A4E47B00B5DDB3 /* unimplemented.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unimplemented.c; sourceTree = ""; }; - 4873F3DF11A4E47B00B5DDB3 /* xts_decrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xts_decrypt.c; sourceTree = ""; }; - 4873F3E011A4E47B00B5DDB3 /* xts_descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xts_descriptor.c; sourceTree = ""; }; - 4873F3E111A4E47B00B5DDB3 /* xts_done.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xts_done.c; sourceTree = ""; }; - 4873F3E211A4E47B00B5DDB3 /* xts_encrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xts_encrypt.c; sourceTree = ""; }; - 4873F3E311A4E47B00B5DDB3 /* xts_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xts_init.c; sourceTree = ""; }; - 4873F3E411A4E47B00B5DDB3 /* xts_mult_x.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xts_mult_x.c; sourceTree = ""; }; - 4873F3E511A4E47B00B5DDB3 /* xts_test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xts_test.c; sourceTree = ""; }; - 4873F3E811A4E47B00B5DDB3 /* ansi923pad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ansi923pad.c; sourceTree = ""; }; - 4873F3E911A4E47B00B5DDB3 /* ansi923pad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ansi923pad.h; sourceTree = ""; }; - 4873F3EB11A4E47B00B5DDB3 /* iso10126pad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = iso10126pad.c; sourceTree = ""; }; - 4873F3EC11A4E47B00B5DDB3 /* iso10126pad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iso10126pad.h; sourceTree = ""; }; - 4873F3EE11A4E47B00B5DDB3 /* nopad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nopad.c; sourceTree = ""; }; - 4873F3EF11A4E47B00B5DDB3 /* nopad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nopad.h; sourceTree = ""; }; - 4873F3F111A4E47B00B5DDB3 /* pkcs7pad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkcs7pad.c; sourceTree = ""; }; - 4873F3F211A4E47B00B5DDB3 /* pkcs7pad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pkcs7pad.h; sourceTree = ""; }; - 4882005B111AAD7A00798F94 /* PBKDFTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PBKDFTest.h; path = UnitTestSource/PBKDFTest.h; sourceTree = ""; }; - 4882005C111AAD7A00798F94 /* PBKDFTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PBKDFTest.mm; path = UnitTestSource/PBKDFTest.mm; sourceTree = ""; }; + 485FED4A131475A400FF0F82 /* CommonBigNumPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonBigNumPriv.h; sourceTree = ""; }; + 485FED4B131475A400FF0F82 /* CommonBigNum.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonBigNum.c; sourceTree = ""; }; + 486130D7126681290036EA02 /* CC_base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_base.xcconfig; sourceTree = ""; }; + 486130D8126681290036EA02 /* CC_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_deployment.xcconfig; sourceTree = ""; }; + 486130D9126681290036EA02 /* CC_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_development.xcconfig; sourceTree = ""; }; + 486130DA126681290036EA02 /* CC_dynamic.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_dynamic.xcconfig; sourceTree = ""; }; + 486130DB126681290036EA02 /* CC_dynamic_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_dynamic_deployment.xcconfig; sourceTree = ""; }; + 486130DC126681290036EA02 /* CC_dynamic_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_dynamic_development.xcconfig; sourceTree = ""; }; + 486130DD126681290036EA02 /* CC_static.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_static.xcconfig; sourceTree = ""; }; + 486130DE126681290036EA02 /* CC_static_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_static_deployment.xcconfig; sourceTree = ""; }; + 486130DF126681290036EA02 /* CC_static_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_static_development.xcconfig; sourceTree = ""; }; + 486130E0126681290036EA02 /* CC_umbrellaMember.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_umbrellaMember.xcconfig; sourceTree = ""; }; + 486130E2126681290036EA02 /* CC_iOSClient.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_iOSClient.xcconfig; sourceTree = ""; }; + 486130E3126681290036EA02 /* CC_iOSClientSim.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_iOSClientSim.xcconfig; sourceTree = ""; }; + 486130E5126681290036EA02 /* CC_MacOSXClient.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_MacOSXClient.xcconfig; sourceTree = ""; }; + 486130E8126681290036EA02 /* CC_iOSClient_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_iOSClient_deployment.xcconfig; sourceTree = ""; }; + 486130E9126681290036EA02 /* CC_iOSClient_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_iOSClient_development.xcconfig; sourceTree = ""; }; + 486130EC126681290036EA02 /* CC_iOSSim_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_iOSSim_deployment.xcconfig; sourceTree = ""; }; + 486130ED126681290036EA02 /* CC_iOSSim_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_iOSSim_development.xcconfig; sourceTree = ""; }; + 486130EE126681290036EA02 /* CC_MacOSXClient_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_MacOSXClient_deployment.xcconfig; sourceTree = ""; }; + 486130EF126681290036EA02 /* CC_MacOSXClient_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_MacOSXClient_development.xcconfig; sourceTree = ""; }; + 486130F3126681290036EA02 /* CC_localtest.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_localtest.xcconfig; sourceTree = ""; }; + 486130F4126681290036EA02 /* CC_unittest_base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_unittest_base.xcconfig; sourceTree = ""; }; + 486130F5126681290036EA02 /* CC_unittest_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_unittest_deployment.xcconfig; sourceTree = ""; }; + 486130F6126681290036EA02 /* CC_unittest_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_unittest_development.xcconfig; sourceTree = ""; }; + 486130F7126681290036EA02 /* CC_unittest_dynamic_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_unittest_dynamic_deployment.xcconfig; sourceTree = ""; }; + 486130F8126681290036EA02 /* CC_unitTest_dynamic_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_unitTest_dynamic_development.xcconfig; sourceTree = ""; }; + 486130F9126681290036EA02 /* CC_unittest_static_deployment.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_unittest_static_deployment.xcconfig; sourceTree = ""; }; + 486130FA126681290036EA02 /* CC_unittest_static_development.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CC_unittest_static_development.xcconfig; sourceTree = ""; }; + 48685583127B63F200B88D39 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = ""; }; + 48685586127B641800B88D39 /* CommonCryptoAESShoefly.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonCryptoAESShoefly.c; sourceTree = ""; }; + 4868BB1314B7C7F300072488 /* corecryptoSymmetricBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = corecryptoSymmetricBridge.h; sourceTree = ""; }; + 486BE17C14E6019B00346AC4 /* CommonCryptoReset.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonCryptoReset.c; sourceTree = ""; }; + 4873A7271445099D0011B4FA /* CommonCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCrypto.h; sourceTree = ""; }; 489D982C11A4E8C20004DB89 /* ccdebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccdebug.c; sourceTree = ""; }; 489D982D11A4E8C20004DB89 /* ccdebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccdebug.h; sourceTree = ""; }; - 48B4B98911ABA1B4001F1036 /* aes_modes_hw.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = aes_modes_hw.s; sourceTree = ""; }; - 48B4B98A11ABA1B4001F1036 /* aes_modes_asm.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = aes_modes_asm.s; sourceTree = ""; }; - 48B4B98B11ABA1B4001F1036 /* aesxts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aesxts.h; sourceTree = ""; }; - 48B4B98C11ABA1B4001F1036 /* aesxts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aesxts.c; sourceTree = ""; }; - 48B4B98D11ABA1B4001F1036 /* aesxts_asm.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = aesxts_asm.s; sourceTree = ""; }; - 48B4B98E11ABA1B4001F1036 /* ExpandKeyForEncryption.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = ExpandKeyForEncryption.s; sourceTree = ""; }; - 48B4B98F11ABA1B4001F1036 /* ExpandKeyForDecryption.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = ExpandKeyForDecryption.s; sourceTree = ""; }; - 48B4B99011ABA1B4001F1036 /* EncryptDecrypt.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = EncryptDecrypt.s; sourceTree = ""; }; - 48B4B99111ABA1B4001F1036 /* Data.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = Data.s; sourceTree = ""; }; - 48B4B99211ABA1B4001F1036 /* Context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Context.h; sourceTree = ""; }; - 48B4B99311ABA1B4001F1036 /* AES.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = AES.s; sourceTree = ""; }; - 48B4B99511ABA1B4001F1036 /* aes_key_hw.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = aes_key_hw.s; sourceTree = ""; }; - 48B4B99611ABA1B4001F1036 /* aes_crypt_hw.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = aes_crypt_hw.s; sourceTree = ""; }; - 48D5636611A652D7008EBBBF /* aesopt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = aesopt.h; path = ../CommonCryptoSPI/aesopt.h; sourceTree = ""; }; - 48D5636711A652D7008EBBBF /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = aes.h; path = ../CommonCryptoSPI/aes.h; sourceTree = ""; }; - 48D5636B11A652EB008EBBBF /* aescrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aescrypt.c; sourceTree = ""; }; - 48D5636C11A652EB008EBBBF /* aeskey.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aeskey.c; sourceTree = ""; }; - 48D5636D11A652EB008EBBBF /* aestab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aestab.c; sourceTree = ""; }; - 48D5636E11A652EB008EBBBF /* aestab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aestab.h; sourceTree = ""; }; - 48D5636F11A652EB008EBBBF /* ccNewGladman.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccNewGladman.c; sourceTree = ""; }; - 48D5637011A652EB008EBBBF /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; - 48D5637711A65316008EBBBF /* AES.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = AES.c; sourceTree = ""; }; - 48D5637811A65316008EBBBF /* AESAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AESAssembly.h; sourceTree = ""; }; - 48D5637911A65316008EBBBF /* Data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Data.c; sourceTree = ""; }; - 48D5637B11A65316008EBBBF /* AES.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = AES.s; sourceTree = ""; }; - 48D5637C11A65316008EBBBF /* Data.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = Data.s; sourceTree = ""; }; - 48D5637D11A65316008EBBBF /* DecryptCBC.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = DecryptCBC.s; sourceTree = ""; }; - 48D5637E11A65316008EBBBF /* EncryptCBC.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = EncryptCBC.s; sourceTree = ""; }; - 48D5637F11A65316008EBBBF /* EncryptDecrypt.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = EncryptDecrypt.s; sourceTree = ""; }; - 48D5638011A65316008EBBBF /* ExpandKeyForDecryption.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = ExpandKeyForDecryption.s; sourceTree = ""; }; - 48D5638111A65316008EBBBF /* ExpandKeyForEncryption.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = ExpandKeyForEncryption.s; sourceTree = ""; }; - 48D5638211A65316008EBBBF /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadMe.txt; sourceTree = ""; }; - 48D5638311A65316008EBBBF /* MakeData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = MakeData.c; sourceTree = ""; }; - 48D5638411A65316008EBBBF /* makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = ""; }; - 48D5638511A65316008EBBBF /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadMe.txt; sourceTree = ""; }; - 48F7AFFF12F2488500E70774 /* CCCalibratePBKDF.3cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CCCalibratePBKDF.3cc; path = doc/CCCalibratePBKDF.3cc; sourceTree = ""; }; - 48F7B00012F2488500E70774 /* CCCommonKeyDerivation.3cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CCCommonKeyDerivation.3cc; path = doc/CCCommonKeyDerivation.3cc; sourceTree = ""; }; - 48F7B00312F248E600E70774 /* CCKeyDerivationPBKDF.3cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CCKeyDerivationPBKDF.3cc; path = doc/CCKeyDerivationPBKDF.3cc; sourceTree = ""; }; - 48F7B00412F248E600E70774 /* CCSymmetricKeyUnwrap.3cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CCSymmetricKeyUnwrap.3cc; path = doc/CCSymmetricKeyUnwrap.3cc; sourceTree = ""; }; - 48F7B00512F248E600E70774 /* CCSymmetricKeyWrap.3cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CCSymmetricKeyWrap.3cc; path = doc/CCSymmetricKeyWrap.3cc; sourceTree = ""; }; - 48F7B00612F248E600E70774 /* CCSymmetricUnwrappedSize.3cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CCSymmetricUnwrappedSize.3cc; path = doc/CCSymmetricUnwrappedSize.3cc; sourceTree = ""; }; - 48F7B00712F248E600E70774 /* CCSymmetricWrappedSize.3cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CCSymmetricWrappedSize.3cc; path = doc/CCSymmetricWrappedSize.3cc; sourceTree = ""; }; - 48F7F36D12B2EF6000AF4587 /* libcommonCrypto.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcommonCrypto.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 48F7F37712B2F05A00AF4587 /* aes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aes.c; sourceTree = ""; }; - 48F7F37812B2F05A00AF4587 /* aes_tab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aes_tab.c; sourceTree = ""; }; - 48F7F37912B2F05A00AF4587 /* ltc_aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ltc_aes.h; sourceTree = ""; }; - 53B9FDE81343DD0600CA1154 /* CommonCMAC.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonCMAC.c; sourceTree = ""; }; - 53B9FDED1343DDB700CA1154 /* CommonCMACSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCMACSPI.h; sourceTree = ""; }; - 5D113BC21106441E00B412A2 /* CommonCrypto_base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CommonCrypto_base.xcconfig; path = Configurations/CommonCrypto_base.xcconfig; sourceTree = ""; }; - 5D113BCB1106441E00B412A2 /* CommonCrypto_unittest_base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CommonCrypto_unittest_base.xcconfig; path = Configurations/CommonCrypto_unittest_base.xcconfig; sourceTree = ""; }; - 5D113BD41106452100B412A2 /* CommonCryptoUnitTests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "CommonCryptoUnitTests-Info.plist"; path = "UnitTestSource/CommonCryptoUnitTests-Info.plist"; sourceTree = ""; }; - 5D113BD51106452100B412A2 /* CommonCryptoUnitTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommonCryptoUnitTests.h; path = UnitTestSource/CommonCryptoUnitTests.h; sourceTree = ""; }; - 5D113BD61106452100B412A2 /* CommonCryptoUnitTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CommonCryptoUnitTests.mm; path = UnitTestSource/CommonCryptoUnitTests.mm; sourceTree = ""; }; - 5D113BD71106452100B412A2 /* DigestTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DigestTest.h; path = UnitTestSource/DigestTest.h; sourceTree = ""; }; - 5D113BD81106452100B412A2 /* DigestTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DigestTest.mm; path = UnitTestSource/DigestTest.mm; sourceTree = ""; }; - 5D113BD91106452100B412A2 /* EncryptionTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EncryptionTest.h; path = UnitTestSource/EncryptionTest.h; sourceTree = ""; }; - 5D113BDA1106452100B412A2 /* EncryptionTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = EncryptionTest.mm; path = UnitTestSource/EncryptionTest.mm; sourceTree = ""; }; - 5D113BDB1106452100B412A2 /* HMACTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HMACTest.h; path = UnitTestSource/HMACTest.h; sourceTree = ""; }; - 5D113BDC1106452100B412A2 /* HMACTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = HMACTest.mm; path = UnitTestSource/HMACTest.mm; sourceTree = ""; }; - 5D113BDD1106452100B412A2 /* RandomNumberService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RandomNumberService.h; path = UnitTestSource/RandomNumberService.h; sourceTree = ""; }; - 5D113BDE1106452100B412A2 /* RandomNumberService.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RandomNumberService.mm; path = UnitTestSource/RandomNumberService.mm; sourceTree = ""; }; - 5D57A807111B5DDE008CA573 /* SymmetricWrapTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SymmetricWrapTest.h; path = UnitTestSource/SymmetricWrapTest.h; sourceTree = ""; }; - 5D57A808111B5DDE008CA573 /* SymmetricWrapTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SymmetricWrapTest.mm; path = UnitTestSource/SymmetricWrapTest.mm; sourceTree = ""; }; - 5D735E4810FCDC04001AAD1E /* CommonCryptoUnitTest.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CommonCryptoUnitTest.octest; sourceTree = BUILT_PRODUCTS_DIR; }; - 5DAD82CC1279DEF900240B9A /* libCommonCryptoUnitTest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCommonCryptoUnitTest.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 5DAD82EC1279E04500240B9A /* TestToolProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestToolProtocol.h; path = UnitTestSource/TestToolProtocol.h; sourceTree = ""; }; - 5DAD83991279F1EC00240B9A /* CommonCryptoTestTool */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CommonCryptoTestTool; sourceTree = BUILT_PRODUCTS_DIR; }; - 5DAD83A21279F29300240B9A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 5DAD83A71279F2B200240B9A /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = main.mm; path = UnitTestSource/main.mm; sourceTree = ""; }; - 795CA3FD0D34431400BAE6A2 /* ccRC2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccRC2.c; sourceTree = ""; }; - 795CA3FE0D34431400BAE6A2 /* rc2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rc2.c; sourceTree = ""; }; - AAB5CBCC0DC6AB6D0019E0E6 /* sha1edp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha1edp.h; sourceTree = ""; }; - AAB5CBCD0DC6AB6D0019E0E6 /* sha1edpBigEndian.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = sha1edpBigEndian.s; sourceTree = ""; }; - AAB5CBCE0DC6AB6D0019E0E6 /* sha1edpLittleEndian.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = sha1edpLittleEndian.s; sourceTree = ""; }; + 489E06F814B7AB0800B0A282 /* corecryptoSymmetricBridge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = corecryptoSymmetricBridge.c; sourceTree = ""; }; + 489EECA2149809A800B44D5A /* asn1Types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn1Types.h; sourceTree = ""; }; + 489EECA3149809A800B44D5A /* DER_CertCrl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DER_CertCrl.c; sourceTree = ""; }; + 489EECA4149809A800B44D5A /* DER_CertCrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DER_CertCrl.h; sourceTree = ""; }; + 489EECA5149809A800B44D5A /* DER_Decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DER_Decode.c; sourceTree = ""; }; + 489EECA6149809A800B44D5A /* DER_Decode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DER_Decode.h; sourceTree = ""; }; + 489EECA7149809A800B44D5A /* DER_Digest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DER_Digest.c; sourceTree = ""; }; + 489EECA8149809A800B44D5A /* DER_Digest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DER_Digest.h; sourceTree = ""; }; + 489EECA9149809A800B44D5A /* DER_Encode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DER_Encode.c; sourceTree = ""; }; + 489EECAA149809A800B44D5A /* DER_Encode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DER_Encode.h; sourceTree = ""; }; + 489EECAB149809A800B44D5A /* DER_Keys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DER_Keys.c; sourceTree = ""; }; + 489EECAC149809A800B44D5A /* DER_Keys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DER_Keys.h; sourceTree = ""; }; + 489EECAD149809A800B44D5A /* libDER.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libDER.h; sourceTree = ""; }; + 489EECAE149809A800B44D5A /* libDER_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libDER_config.h; sourceTree = ""; }; + 489EECAF149809A800B44D5A /* oids.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = oids.c; sourceTree = ""; }; + 489EECB0149809A800B44D5A /* oids.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = oids.h; sourceTree = ""; }; + 489F2441141AA3D0005E80FD /* CommonCMAC.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonCMAC.c; sourceTree = ""; }; + 489FD30B13187B1D00ACB86D /* CommonHMacSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonHMacSPI.h; sourceTree = ""; }; + 48A5CBA0131EE096002A6E85 /* CommonGCMCryptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonGCMCryptor.c; sourceTree = ""; }; + 48AC47CD1381EFDC00F584F5 /* byteBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = byteBuffer.c; sourceTree = ""; }; + 48AC47CE1381EFDC00F584F5 /* byteBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = byteBuffer.h; sourceTree = ""; }; + 48B4651112848FB800311799 /* CommonRSACryptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonRSACryptor.h; sourceTree = ""; }; + 48B4651B1284907600311799 /* CommonRSACryptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonRSACryptor.c; sourceTree = ""; }; + 48C5CB9114FD747500F4472E /* CommonDHtest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonDHtest.c; sourceTree = ""; }; + 48CCD26414F6F189002B6043 /* CommonBigDigest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonBigDigest.c; sourceTree = ""; }; + 48D076C0130B2A510052D1AC /* CommonDH.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonDH.h; sourceTree = ""; }; + 48D076C7130B2A620052D1AC /* CommonECCryptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonECCryptor.h; sourceTree = ""; }; + 48D076CE130B2A9C0052D1AC /* CommonDH.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonDH.c; sourceTree = ""; }; + 48D076CF130B2A9C0052D1AC /* CommonECCryptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonECCryptor.c; sourceTree = ""; }; + 48E93DCA136867F500B33DB8 /* CommonCMACSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCMACSPI.h; sourceTree = ""; }; + 48F5355214902894000D2D1F /* CommonRandom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonRandom.c; sourceTree = ""; }; + 48FC4BD513959D0600DA4760 /* lionCompat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lionCompat.h; sourceTree = ""; }; + 48FC4BD71395ACE600DA4760 /* CommonCryptoCASTShoefly.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonCryptoCASTShoefly.c; sourceTree = ""; }; + 48FD6C371354DD4000F55B8B /* ccErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccErrors.h; sourceTree = ""; }; + 48FD6C381354DD4000F55B8B /* ccMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccMemory.h; sourceTree = ""; }; + 48FD6C631354E06A00F55B8B /* CommonCrypto.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = CommonCrypto.exp; sourceTree = ""; }; + 48FD6C641354E06A00F55B8B /* CommonCryptoIOS5.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = CommonCryptoIOS5.exp; sourceTree = ""; }; + 5D8037A514FECB5900E93214 /* libcorecrypto_sim.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcorecrypto_sim.dylib; path = Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/lib/system/libcorecrypto_sim.dylib; sourceTree = DEVELOPER_DIR; }; D671B5B60BC6D67000878B42 /* CC_MD2.3cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = CC_MD2.3cc; path = doc/CC_MD2.3cc; sourceTree = ""; }; D671B5B70BC6D67000878B42 /* CC_MD2_Final.3cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = CC_MD2_Final.3cc; path = doc/CC_MD2_Final.3cc; sourceTree = ""; }; D671B5B80BC6D67000878B42 /* CC_MD2_Init.3cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = CC_MD2_Init.3cc; path = doc/CC_MD2_Init.3cc; sourceTree = ""; }; D671B5B90BC6D67000878B42 /* CC_MD2_Update.3cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = CC_MD2_Update.3cc; path = doc/CC_MD2_Update.3cc; sourceTree = ""; }; D671B5BA0BC6D67000878B42 /* CC_MD4.3cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = CC_MD4.3cc; path = doc/CC_MD4.3cc; sourceTree = ""; }; @@ -1060,71 +716,66 @@ D671B5E10BC6D67000878B42 /* CCryptorCreateFromData.3cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = CCryptorCreateFromData.3cc; path = doc/CCryptorCreateFromData.3cc; sourceTree = ""; }; D671B5E20BC6D67000878B42 /* Common Crypto.3cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = "Common Crypto.3cc"; path = "doc/Common Crypto.3cc"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 125B794F11FF923D008C1AD3 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 125B795611FF925B008C1AD3 /* libcommonCrypto.dylib in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 128881631203673C0050B2E9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 1235BCBF1207FAFC002BC892 /* libcommonCrypto.dylib in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 5D735E4510FCDC04001AAD1E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 5DAD82E11279DF7A00240B9A /* libCommonCryptoUnitTest.a in Frameworks */, - 12FA10CA11F7A01D00917A4E /* libcommonCrypto.dylib in Frameworks */, - 12C3F7E6122AD1B100E09D9E /* SenTestingKit.framework in Frameworks */, - 5DAD83A31279F29300240B9A /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 5DAD82CA1279DEF900240B9A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 5DAD83971279F1EC00240B9A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 5DAD839F1279F22C00240B9A /* libCommonCryptoUnitTest.a in Frameworks */, - 5DAD83A61279F29800240B9A /* Foundation.framework in Frameworks */, - 5DAD83A11279F26700240B9A /* System.framework in Frameworks */, + 4823B0DD14C10064008F689F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4834A87A14F47B6200438E3D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4834A88214F47C9A00438E3D /* libcommonCrypto.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 48CCF15612FA99B600D6DAE9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4834A85314F47A9400438E3D /* libcorecrypto.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4CA674F41331747E00C45A71 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EEB70419131C5BCB007CF918 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 484D40FF14DC96A600C93734 /* libcorecrypto.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 054BBEA205F6A8DE00344873 = { isa = PBXGroup; children = ( - 4857A13011BDA737001F5A9A /* System.framework */, + 5D8037A514FECB5900E93214 /* libcorecrypto_sim.dylib */, + 4834A85214F47A9400438E3D /* libcorecrypto.dylib */, + 484D40FE14DC96A600C93734 /* libcorecrypto.dylib */, + 48FD6C621354E06A00F55B8B /* Exports */, 5DB4936310FBC4E200E45951 /* Configurations */, 054BBEB105F6A90E00344873 /* Public Headers */, 054BBEB405F6A91E00344873 /* Source */, 05DF6D0E09CF2D5B00D9A3E8 /* Doc */, - 5DB4940410FBE5A800E45951 /* UnitTestSource */, - 1210DF01120488B50054B6F9 /* TestTools */, + 4823B0AC14C10022008F689F /* CCRegression */, 054BBEBF05F6A97700344873 /* Products */, 4857A12A11BDA6E0001F5A9A /* libSystem.dylib */, - 12C3F7E5122AD1B100E09D9E /* SenTestingKit.framework */, - 5DAD83A21279F29300240B9A /* Foundation.framework */, + 4857A13011BDA737001F5A9A /* System.framework */, ); sourceTree = ""; }; 054BBEB105F6A90E00344873 /* Public Headers */ = { isa = PBXGroup; @@ -1132,90 +783,44 @@ 4854F9C01116307500CAFA18 /* CommonKeyDerivation.h */, 4854F9C11116307500CAFA18 /* CommonSymmetricKeywrap.h */, 054BBECD05F6AA7200344873 /* CommonDigest.h */, 05D9F61609D85F4A00AD30A7 /* CommonCryptor.h */, 05D8D97C09E411AA00E03504 /* CommonHMAC.h */, + 4873A7271445099D0011B4FA /* CommonCrypto.h */, ); name = "Public Headers"; path = CommonCrypto; sourceTree = ""; }; 054BBEB405F6A91E00344873 /* Source */ = { isa = PBXGroup; children = ( - 12FBB0891238353000772329 /* CommonCrypto.exp */, + 489EECA1149809A800B44D5A /* libDER */, + 48CA258512C149EF002330C4 /* descriptors */, 4836A42A11A5CB4700862178 /* API */, 4846CA5311A5C8B800E7DA82 /* SPI */, - 489D982B11A4E8C20004DB89 /* Utility */, - 4873F33C11A4E47B00B5DDB3 /* libtomcrypt */, - 1210DF02120489050054B6F9 /* Legacy */, + 489D982B11A4E8C20004DB89 /* ccUtilities */, ); path = Source; sourceTree = ""; }; 054BBEBF05F6A97700344873 /* Products */ = { isa = PBXGroup; children = ( 054BBEBE05F6A97700344873 /* libcommonCrypto.dylib */, 054BBEC605F6A98900344873 /* libcommonCrypto.dylib */, - 5D735E4810FCDC04001AAD1E /* CommonCryptoUnitTest.octest */, - 125B795111FF923D008C1AD3 /* XTStest */, - 128881651203673C0050B2E9 /* CBCTest */, - 5DAD82CC1279DEF900240B9A /* libCommonCryptoUnitTest.a */, - 5DAD83991279F1EC00240B9A /* CommonCryptoTestTool */, - 48F7F36D12B2EF6000AF4587 /* libcommonCrypto.dylib */, + 48165DB9125AC5D50015A267 /* libcommonCrypto.dylib */, + 48165E9C125AC5F20015A267 /* libcommonCrypto_sim.dylib */, + 4823B0E014C10064008F689F /* CCRegression */, + 4834A88014F47B6200438E3D /* CCRegression copy */, ); name = Products; - sourceTree = ""; - }; - 0585FE1109DC9850001762F6 /* CAST */ = { - isa = PBXGroup; - children = ( - 4836A41D11A5C94A00862178 /* cast.h */, - 4836A41C11A5C94A00862178 /* ccCast.h */, - 0585FE1209DC9873001762F6 /* c_ecb.c */, - 0585FE1309DC9873001762F6 /* c_enc.c */, - 0585FE1409DC9873001762F6 /* c_skey.c */, - 0585FE1609DC9873001762F6 /* cast_lcl.h */, - 0585FE1709DC9873001762F6 /* cast_s.h */, - 0585FE1809DC9873001762F6 /* ccCast.c */, - ); - path = CAST; - sourceTree = ""; - }; - 05D9F60109D85DA100AD30A7 /* Digest */ = { - isa = PBXGroup; - children = ( - 122ADC43121320D70027F302 /* sha256_nossse3.s */, - 122ADC44121320D70027F302 /* sha256.s */, - AAB5CBCC0DC6AB6D0019E0E6 /* sha1edp.h */, - AAB5CBCD0DC6AB6D0019E0E6 /* sha1edpBigEndian.s */, - AAB5CBCE0DC6AB6D0019E0E6 /* sha1edpLittleEndian.s */, - 054BBED305F6AA8900344873 /* md2_dgst.c */, - 054BBED405F6AA8900344873 /* md4_dgst.c */, - 054BBED505F6AA8900344873 /* md4_locl.h */, - 054BBED605F6AA8900344873 /* md5_dgst.c */, - 054BBED705F6AA8900344873 /* md5_locl.h */, - 054BBED805F6AA8900344873 /* md32_common.h */, - 054BBEDA05F6AA8900344873 /* sha_locl.h */, - 054BBEDC05F6AA8900344873 /* sha1.c */, - 05E319B7063890C100C4AD24 /* sha2.c */, - 05E319DC0638913700C4AD24 /* sha2Priv.h */, - ); - path = Digest; sourceTree = ""; }; 05DF6D0E09CF2D5B00D9A3E8 /* Doc */ = { isa = PBXGroup; children = ( - 48F7B00312F248E600E70774 /* CCKeyDerivationPBKDF.3cc */, - 48F7B00412F248E600E70774 /* CCSymmetricKeyUnwrap.3cc */, - 48F7B00512F248E600E70774 /* CCSymmetricKeyWrap.3cc */, - 48F7B00612F248E600E70774 /* CCSymmetricUnwrappedSize.3cc */, - 48F7B00712F248E600E70774 /* CCSymmetricWrappedSize.3cc */, - 48F7AFFF12F2488500E70774 /* CCCalibratePBKDF.3cc */, - 48F7B00012F2488500E70774 /* CCCommonKeyDerivation.3cc */, D671B5B60BC6D67000878B42 /* CC_MD2.3cc */, D671B5B70BC6D67000878B42 /* CC_MD2_Final.3cc */, D671B5B80BC6D67000878B42 /* CC_MD2_Init.3cc */, D671B5B90BC6D67000878B42 /* CC_MD2_Update.3cc */, D671B5BA0BC6D67000878B42 /* CC_MD4.3cc */, @@ -1266,904 +871,507 @@ 05DF6D1309CF2D7200D9A3E8 /* CC_SHA.3cc */, ); name = Doc; sourceTree = ""; }; - 05ECA0E309D468BF00CFE5CB /* ccOpenssl */ = { - isa = PBXGroup; - children = ( - 05ECA0E409D468E200CFE5CB /* des.h */, - 05C4417209D4BB0B002066D1 /* opensslconf.h */, - 05ECA0ED09D469A100CFE5CB /* set_key.c */, - 05ECA0E509D468E200CFE5CB /* des_enc.c */, - 4836A41911A5C94A00862178 /* opensslDES.h */, - 0539DC2609D4919D00AB7F89 /* opensslDES.c */, - 05C70C5309D471C30004B8F4 /* spr.h */, - 05ECA0E609D468E200CFE5CB /* des_locl.h */, - 05C4416E09D4BACE002066D1 /* e_os2.h */, - ); - path = ccOpenssl; - sourceTree = ""; - }; - 1210DF01120488B50054B6F9 /* TestTools */ = { - isa = PBXGroup; - children = ( - 480C9ABD12077B7D002EC023 /* testUtil */, - 1288816E120367F10050B2E9 /* CBCTest */, - 125B795F11FF92FC008C1AD3 /* XTSTest */, - ); - name = TestTools; - sourceTree = ""; - }; - 1210DF02120489050054B6F9 /* Legacy */ = { - isa = PBXGroup; - children = ( - 48D5636A11A652EB008EBBBF /* GladmanAES */, - 48D5637611A65316008EBBBF /* AESedp */, - 0585FE1109DC9850001762F6 /* CAST */, - 795CA3FC0D34431400BAE6A2 /* RC2 */, - 05D9F60109D85DA100AD30A7 /* Digest */, - 05ECA0E309D468BF00CFE5CB /* ccOpenssl */, - ); - name = Legacy; - sourceTree = ""; - }; - 1249340012270E8900F9C9E1 /* cfb8 */ = { - isa = PBXGroup; - children = ( - 1249340112270E8900F9C9E1 /* cfb8_decrypt.c */, - 1249340212270E8900F9C9E1 /* cfb8_descriptor.c */, - 1249340312270E8900F9C9E1 /* cfb8_done.c */, - 1249340412270E8900F9C9E1 /* cfb8_encrypt.c */, - 1249340512270E8900F9C9E1 /* cfb8_getiv.c */, - 1249340612270E8900F9C9E1 /* cfb8_setiv.c */, - 1249340712270E8900F9C9E1 /* cfb8_start.c */, - ); - path = cfb8; - sourceTree = ""; - }; - 125B795F11FF92FC008C1AD3 /* XTSTest */ = { - isa = PBXGroup; - children = ( - 125B796011FF92FC008C1AD3 /* crypto.c */, - 125B796111FF92FC008C1AD3 /* hexString.c */, - 125B796211FF92FC008C1AD3 /* hexString.h */, - 125B796311FF92FC008C1AD3 /* printByteBuffer.c */, - 125B796411FF92FC008C1AD3 /* printByteBuffer.h */, - 125B796511FF92FC008C1AD3 /* xtsTestVectors.c */, - 125B796611FF92FC008C1AD3 /* xtsTestVectors.h */, - ); - name = XTSTest; - path = LocalTests/XTSTest; - sourceTree = ""; - }; - 1288816E120367F10050B2E9 /* CBCTest */ = { - isa = PBXGroup; - children = ( - 12CC5DD8120373D1001B4FCE /* CBCTest.h */, - 12CC5DD9120373D1001B4FCE /* CBCTest.c */, - ); - name = CBCTest; - path = LocalTests/CBCTest; - sourceTree = ""; - }; - 480C9ABD12077B7D002EC023 /* testUtil */ = { - isa = PBXGroup; - children = ( - 480C9AD512077BCF002EC023 /* byteBuffer.c */, - 480C9AD612077BCF002EC023 /* byteBuffer.h */, - ); - name = testUtil; - path = LocalTests/testUtil; + 4823B0AC14C10022008F689F /* CCRegression */ = { + isa = PBXGroup; + children = ( + 4823B0AD14C10022008F689F /* CommonCrypto */, + 4823B0C414C10022008F689F /* inc */, + 4823B0C814C10022008F689F /* main.c */, + 4823B0C914C10022008F689F /* README */, + 4823B0CA14C10022008F689F /* runscript */, + 4823B0CC14C10022008F689F /* test */, + 4823B0D714C10022008F689F /* util */, + ); + path = CCRegression; + sourceTree = ""; + }; + 4823B0AD14C10022008F689F /* CommonCrypto */ = { + isa = PBXGroup; + children = ( + 4823B0AE14C10022008F689F /* CCCryptorTestFuncs.c */, + 4823B0AF14C10022008F689F /* CCCryptorTestFuncs.h */, + 4823B0B014C10022008F689F /* CommonBaseEncoding.c */, + 4823B0B114C10022008F689F /* CommonBigNum.c */, + 4823B0B214C10022008F689F /* CommonCMac.c */, + 4823B0B314C10022008F689F /* CommonCryptoCTSPadding.c */, + 4823B0B414C10022008F689F /* CommonCryptoSymCBC.c */, + 4823B0B514C10022008F689F /* CommonCryptoSymGCM.c */, + 4823B0B614C10022008F689F /* CommonCryptoSymmetricWrap.c */, + 4852C2491505F8CD00676BCC /* CommonCryptoSymCFB.c */, + 4823B0B714C10022008F689F /* CommonCryptoSymOFB.c */, + 4823B0B814C10022008F689F /* CommonCryptoSymOffset.c */, + 4823B0B914C10022008F689F /* CommonCryptoSymRC2.c */, + 4823B0BA14C10022008F689F /* CommonCryptoSymRegression.c */, + 486BE17C14E6019B00346AC4 /* CommonCryptoReset.c */, + 4823B0BB14C10022008F689F /* CommonCryptoSymXTS.c */, + 4823B0BC14C10022008F689F /* CommonCryptoSymZeroLength.c */, + 4823B0BD14C10022008F689F /* CommonDigest.c */, + 4823B0BE14C10022008F689F /* CommonEC.c */, + 4823B0BF14C10022008F689F /* CommonHMacClone.c */, + 4823B0C014C10022008F689F /* CommonRandom.c */, + 4823B0C114C10022008F689F /* CommonRSA.c */, + 4823B0C314C10022008F689F /* CryptorPadFailure.c */, + 48CCD26414F6F189002B6043 /* CommonBigDigest.c */, + 48C5CB9114FD747500F4472E /* CommonDHtest.c */, + 4854BAD5152177CC007B5B08 /* CommonCryptoSymCTR.c */, + ); + path = CommonCrypto; + sourceTree = ""; + }; + 4823B0C414C10022008F689F /* inc */ = { + isa = PBXGroup; + children = ( + 4823B0C514C10022008F689F /* IPC */, + 4823B0C714C10022008F689F /* MyHarness.pm */, + ); + path = inc; + sourceTree = ""; + }; + 4823B0C514C10022008F689F /* IPC */ = { + isa = PBXGroup; + children = ( + 4823B0C614C10022008F689F /* Run3.pm */, + ); + path = IPC; + sourceTree = ""; + }; + 4823B0CA14C10022008F689F /* runscript */ = { + isa = PBXGroup; + children = ( + 4823B0CB14C10022008F689F /* security.pl */, + ); + path = runscript; + sourceTree = ""; + }; + 4823B0CC14C10022008F689F /* test */ = { + isa = PBXGroup; + children = ( + 4823B0CD14C10022008F689F /* 00testtest.c */, + 4823B0CE14C10022008F689F /* run_tests.sh */, + 4823B0CF14C10022008F689F /* testcpp.h */, + 4823B0D014C10022008F689F /* testenv.c */, + 4823B0D114C10022008F689F /* testenv.h */, + 4823B0D214C10022008F689F /* testlist.c */, + 4823B0D314C10022008F689F /* testlist.h */, + 4823B0D414C10022008F689F /* testlistInc.h */, + 4823B0D514C10022008F689F /* testmore.c */, + 4823B0D614C10022008F689F /* testmore.h */, + ); + path = test; + sourceTree = ""; + }; + 4823B0D714C10022008F689F /* util */ = { + isa = PBXGroup; + children = ( + 4823B0D814C10022008F689F /* testbyteBuffer.c */, + 4823B0D914C10022008F689F /* testbyteBuffer.h */, + 4823B0DA14C10022008F689F /* capabilities.h */, + ); + path = util; sourceTree = ""; }; 4836A42A11A5CB4700862178 /* API */ = { isa = PBXGroup; children = ( - 12FA0DB111F7964700917A4E /* CommonRandom.c */, + 489F2441141AA3D0005E80FD /* CommonCMAC.c */, + 48A5CBA0131EE096002A6E85 /* CommonGCMCryptor.c */, + 48685586127B641800B88D39 /* CommonCryptoAESShoefly.c */, + 48FC4BD71395ACE600DA4760 /* CommonCryptoCASTShoefly.c */, 4836A42B11A5CB4700862178 /* CommonCryptor.c */, 4836A42C11A5CB4700862178 /* CommonCryptorPriv.h */, 4836A42E11A5CB4700862178 /* CommonHMAC.c */, 4836A42F11A5CB4700862178 /* CommonKeyDerivation.c */, - 4836A43011A5CB4700862178 /* CommonKeyDerivationPriv.h */, 4836A43111A5CB4700862178 /* CommonSymmetricKeywrap.c */, 4836A42D11A5CB4700862178 /* CommonDigestPriv.h */, 48096B2211A5EF900043F67F /* CommonDigest.c */, - 53B9FDE81343DD0600CA1154 /* CommonCMAC.c */, + 48B4651B1284907600311799 /* CommonRSACryptor.c */, + 48D076CF130B2A9C0052D1AC /* CommonECCryptor.c */, + 48D076CE130B2A9C0052D1AC /* CommonDH.c */, + 485FED4A131475A400FF0F82 /* CommonBigNumPriv.h */, + 485FED4B131475A400FF0F82 /* CommonBigNum.c */, + 48F5355214902894000D2D1F /* CommonRandom.c */, ); path = API; sourceTree = ""; }; 4846CA5311A5C8B800E7DA82 /* SPI */ = { isa = PBXGroup; children = ( - 12FA0DAF11F7962100917A4E /* CommonRandomSPI.h */, + 48FC4BD513959D0600DA4760 /* lionCompat.h */, + 48E93DCA136867F500B33DB8 /* CommonCMACSPI.h */, + 48685583127B63F200B88D39 /* aes.h */, 4836A41A11A5C94A00862178 /* CommonCryptoPriv.h */, 4846CA5411A5C8B800E7DA82 /* CommonCryptorSPI.h */, 4846CA5511A5C8B800E7DA82 /* CommonDigestSPI.h */, - 53B9FDED1343DDB700CA1154 /* CommonCMACSPI.h */, + 12FA0DAF11F7962100917A4E /* CommonRandomSPI.h */, + 48B4651112848FB800311799 /* CommonRSACryptor.h */, + 48D076C7130B2A620052D1AC /* CommonECCryptor.h */, + 48D076C0130B2A510052D1AC /* CommonDH.h */, + 489FD30B13187B1D00ACB86D /* CommonHMacSPI.h */, + 4825AAF31314CDCD00413A64 /* CommonBigNum.h */, ); name = SPI; path = CommonCryptoSPI; sourceTree = ""; }; - 4862F09611BDA1D300946BBE /* skein */ = { - isa = PBXGroup; - children = ( - 4862F09711BDA1D300946BBE /* Optimized_64bit */, - ); - path = skein; - sourceTree = ""; - }; - 4862F09711BDA1D300946BBE /* Optimized_64bit */ = { - isa = PBXGroup; - children = ( - 4862F09E11BDA27200946BBE /* skein.h */, - 4862F09F11BDA27200946BBE /* skein.c */, - 4862F0A011BDA27200946BBE /* skein_port.h */, - 4862F0A111BDA27200946BBE /* skein_iv.h */, - 4862F0A211BDA27200946BBE /* skein_dropin.h */, - 4862F0A311BDA27200946BBE /* skein_dropin.c */, - 4862F0A411BDA27200946BBE /* skein_debug.h */, - 4862F0A511BDA27200946BBE /* skein_debug.c */, - 4862F0A611BDA27200946BBE /* skein_block.c */, - 4862F0A711BDA27200946BBE /* SHA3api_ref.h */, - 4862F0A811BDA27200946BBE /* SHA3api_ref.c */, - 4862F0A911BDA27200946BBE /* brg_types.h */, - 4862F0AA11BDA27200946BBE /* brg_endian.h */, - ); - path = Optimized_64bit; - sourceTree = ""; - }; - 4873F33C11A4E47B00B5DDB3 /* libtomcrypt */ = { - isa = PBXGroup; - children = ( - 4873F33D11A4E47B00B5DDB3 /* doc */, - 4873F34111A4E47B00B5DDB3 /* src */, - ); - path = libtomcrypt; - sourceTree = ""; - }; - 4873F33D11A4E47B00B5DDB3 /* doc */ = { - isa = PBXGroup; - children = ( - 4873F33E11A4E47B00B5DDB3 /* footer.html */, - 4873F33F11A4E47B00B5DDB3 /* header.html */, - 4873F34011A4E47B00B5DDB3 /* libTomCryptDoc.pdf */, - ); - path = doc; - sourceTree = ""; - }; - 4873F34111A4E47B00B5DDB3 /* src */ = { - isa = PBXGroup; - children = ( - 4873F34211A4E47B00B5DDB3 /* ciphers */, - 4873F35B11A4E47B00B5DDB3 /* hashes */, - 4873F36E11A4E47B00B5DDB3 /* headers */, - 4873F37D11A4E47B00B5DDB3 /* misc */, - 4873F3A111A4E47B00B5DDB3 /* modes */, - 4873F3E611A4E47B00B5DDB3 /* padding */, - ); - path = src; - sourceTree = ""; - }; - 4873F34211A4E47B00B5DDB3 /* ciphers */ = { - isa = PBXGroup; - children = ( - 48F7F37612B2F05A00AF4587 /* ltc_aes */, - 4873F34311A4E47B00B5DDB3 /* aesedpport */, - 4873F35311A4E47B00B5DDB3 /* cast5.c */, - 4873F35411A4E47B00B5DDB3 /* des.c */, - 4873F35511A4E47B00B5DDB3 /* rc2.c */, - 4873F35611A4E47B00B5DDB3 /* RC4 */, - 4873F35A11A4E47B00B5DDB3 /* rc5.c */, - ); - path = ciphers; - sourceTree = ""; - }; - 4873F34311A4E47B00B5DDB3 /* aesedpport */ = { - isa = PBXGroup; - children = ( - 48B4B98911ABA1B4001F1036 /* aes_modes_hw.s */, - 48B4B98A11ABA1B4001F1036 /* aes_modes_asm.s */, - 48B4B98B11ABA1B4001F1036 /* aesxts.h */, - 48B4B98C11ABA1B4001F1036 /* aesxts.c */, - 48B4B98D11ABA1B4001F1036 /* aesxts_asm.s */, - 48B4B98E11ABA1B4001F1036 /* ExpandKeyForEncryption.s */, - 48B4B98F11ABA1B4001F1036 /* ExpandKeyForDecryption.s */, - 48B4B99011ABA1B4001F1036 /* EncryptDecrypt.s */, - 48B4B99111ABA1B4001F1036 /* Data.s */, - 48B4B99211ABA1B4001F1036 /* Context.h */, - 48B4B99311ABA1B4001F1036 /* AES.s */, - 48B4B99511ABA1B4001F1036 /* aes_key_hw.s */, - 48B4B99611ABA1B4001F1036 /* aes_crypt_hw.s */, - 4873F34A11A4E47B00B5DDB3 /* aesedp.c */, - 4873F34B11A4E47B00B5DDB3 /* aesedp.h */, - 125B78AE11FF877D008C1AD3 /* aesedpPriv.h */, - ); - path = aesedpport; - sourceTree = ""; - }; - 4873F35611A4E47B00B5DDB3 /* RC4 */ = { - isa = PBXGroup; - children = ( - 4873F35711A4E47B00B5DDB3 /* rc4.h */, - 4873F35811A4E47B00B5DDB3 /* rc4_enc.c */, - 4873F35911A4E47B00B5DDB3 /* rc4_skey.c */, - ); - path = RC4; - sourceTree = ""; - }; - 4873F35B11A4E47B00B5DDB3 /* hashes */ = { - isa = PBXGroup; - children = ( - 4862F09411BDA1D300946BBE /* skein_ltc.h */, - 4862F09511BDA1D300946BBE /* skein_ltc.c */, - 4862F09611BDA1D300946BBE /* skein */, - 4873F35C11A4E47B00B5DDB3 /* helper */, - 4873F36111A4E47B00B5DDB3 /* md2.c */, - 4873F36211A4E47B00B5DDB3 /* md4.c */, - 4873F36311A4E47B00B5DDB3 /* md5.c */, - 4873F36411A4E47B00B5DDB3 /* rmd128.c */, - 4873F36511A4E47B00B5DDB3 /* rmd160.c */, - 4873F36611A4E47B00B5DDB3 /* rmd256.c */, - 4873F36711A4E47B00B5DDB3 /* rmd320.c */, - 4873F36811A4E47B00B5DDB3 /* sha1.c */, - 4873F36911A4E47B00B5DDB3 /* sha2 */, - ); - path = hashes; - sourceTree = ""; - }; - 4873F35C11A4E47B00B5DDB3 /* helper */ = { - isa = PBXGroup; - children = ( - 4873F35D11A4E47B00B5DDB3 /* hash_file.c */, - 4873F35E11A4E47B00B5DDB3 /* hash_filehandle.c */, - 4873F35F11A4E47B00B5DDB3 /* hash_memory.c */, - 4873F36011A4E47B00B5DDB3 /* hash_memory_multi.c */, - ); - path = helper; - sourceTree = ""; - }; - 4873F36911A4E47B00B5DDB3 /* sha2 */ = { - isa = PBXGroup; - children = ( - 4873F36A11A4E47B00B5DDB3 /* sha224.c */, - 4873F36B11A4E47B00B5DDB3 /* sha256.c */, - 4873F36C11A4E47B00B5DDB3 /* sha384.c */, - 4873F36D11A4E47B00B5DDB3 /* sha512.c */, - ); - path = sha2; - sourceTree = ""; - }; - 4873F36E11A4E47B00B5DDB3 /* headers */ = { - isa = PBXGroup; - children = ( - 4873F36F11A4E47B00B5DDB3 /* tomcrypt.h */, - 4873F37011A4E47B00B5DDB3 /* tomcrypt_argchk.h */, - 4873F37111A4E47B00B5DDB3 /* tomcrypt_cfg.h */, - 4873F37211A4E47B00B5DDB3 /* tomcrypt_cipher.h */, - 4873F37311A4E47B00B5DDB3 /* tomcrypt_custom.h */, - 4873F37411A4E47B00B5DDB3 /* tomcrypt_hash.h */, - 4873F37511A4E47B00B5DDB3 /* tomcrypt_mac.h */, - 4873F37611A4E47B00B5DDB3 /* tomcrypt_macros.h */, - 4873F37711A4E47B00B5DDB3 /* tomcrypt_math.h */, - 4873F37811A4E47B00B5DDB3 /* tomcrypt_misc.h */, - 4873F37911A4E47B00B5DDB3 /* tomcrypt_mode.h */, - 4873F37A11A4E47B00B5DDB3 /* tomcrypt_pk.h */, - 4873F37B11A4E47B00B5DDB3 /* tomcrypt_pkcs.h */, - 4873F37C11A4E47B00B5DDB3 /* tomcrypt_prng.h */, - ); - path = headers; - sourceTree = ""; - }; - 4873F37D11A4E47B00B5DDB3 /* misc */ = { - isa = PBXGroup; - children = ( - 4873F37E11A4E47B00B5DDB3 /* base64 */, - 4873F38111A4E47B00B5DDB3 /* burn_stack.c */, - 4873F38211A4E47B00B5DDB3 /* crypt */, - 4873F39C11A4E47B00B5DDB3 /* error_to_string.c */, - 4873F39D11A4E47B00B5DDB3 /* pkcs5 */, - 4873F3A011A4E47B00B5DDB3 /* zeromem.c */, - ); - path = misc; - sourceTree = ""; - }; - 4873F37E11A4E47B00B5DDB3 /* base64 */ = { - isa = PBXGroup; - children = ( - 4873F37F11A4E47B00B5DDB3 /* base64_decode.c */, - 4873F38011A4E47B00B5DDB3 /* base64_encode.c */, - ); - path = base64; - sourceTree = ""; - }; - 4873F38211A4E47B00B5DDB3 /* crypt */ = { - isa = PBXGroup; - children = ( - 4873F38311A4E47B00B5DDB3 /* crypt.c */, - 4873F38411A4E47B00B5DDB3 /* crypt_argchk.c */, - 4873F38511A4E47B00B5DDB3 /* crypt_cipher_descriptor.c */, - 4873F38611A4E47B00B5DDB3 /* crypt_cipher_is_valid.c */, - 4873F38711A4E47B00B5DDB3 /* crypt_find_cipher.c */, - 4873F38811A4E47B00B5DDB3 /* crypt_find_cipher_any.c */, - 4873F38911A4E47B00B5DDB3 /* crypt_find_cipher_id.c */, - 4873F38A11A4E47B00B5DDB3 /* crypt_find_hash.c */, - 4873F38B11A4E47B00B5DDB3 /* crypt_find_hash_any.c */, - 4873F38C11A4E47B00B5DDB3 /* crypt_find_hash_id.c */, - 4873F38D11A4E47B00B5DDB3 /* crypt_find_hash_oid.c */, - 4873F38E11A4E47B00B5DDB3 /* crypt_find_prng.c */, - 4873F38F11A4E47B00B5DDB3 /* crypt_fsa.c */, - 4873F39011A4E47B00B5DDB3 /* crypt_hash_descriptor.c */, - 4873F39111A4E47B00B5DDB3 /* crypt_hash_is_valid.c */, - 4873F39211A4E47B00B5DDB3 /* crypt_ltc_mp_descriptor.c */, - 4873F39311A4E47B00B5DDB3 /* crypt_mode_descriptor.c */, - 4873F39411A4E47B00B5DDB3 /* crypt_prng_descriptor.c */, - 4873F39511A4E47B00B5DDB3 /* crypt_prng_is_valid.c */, - 4873F39611A4E47B00B5DDB3 /* crypt_register_cipher.c */, - 4873F39711A4E47B00B5DDB3 /* crypt_register_hash.c */, - 4873F39811A4E47B00B5DDB3 /* crypt_register_prng.c */, - 4873F39911A4E47B00B5DDB3 /* crypt_unregister_cipher.c */, - 4873F39A11A4E47B00B5DDB3 /* crypt_unregister_hash.c */, - 4873F39B11A4E47B00B5DDB3 /* crypt_unregister_prng.c */, - ); - path = crypt; - sourceTree = ""; - }; - 4873F39D11A4E47B00B5DDB3 /* pkcs5 */ = { - isa = PBXGroup; - children = ( - 4873F39E11A4E47B00B5DDB3 /* pkcs_5_1.c */, - 4873F39F11A4E47B00B5DDB3 /* pkcs_5_2.c */, - ); - path = pkcs5; - sourceTree = ""; - }; - 4873F3A111A4E47B00B5DDB3 /* modes */ = { - isa = PBXGroup; - children = ( - 1249340012270E8900F9C9E1 /* cfb8 */, - 4873F3A211A4E47B00B5DDB3 /* cbc */, - 4873F3AA11A4E47B00B5DDB3 /* cfb */, - 4873F3B211A4E47B00B5DDB3 /* ctr */, - 4873F3BB11A4E47B00B5DDB3 /* ecb */, - 4873F3D411A4E47B00B5DDB3 /* ofb */, - 4873F3DC11A4E47B00B5DDB3 /* rc4_stream.c */, - 4873F3DD11A4E47B00B5DDB3 /* unimplemented.c */, - 4873F3DE11A4E47B00B5DDB3 /* xts */, - ); - path = modes; - sourceTree = ""; - }; - 4873F3A211A4E47B00B5DDB3 /* cbc */ = { - isa = PBXGroup; - children = ( - 4873F3A311A4E47B00B5DDB3 /* cbc_decrypt.c */, - 4873F3A411A4E47B00B5DDB3 /* cbc_descriptor.c */, - 4873F3A511A4E47B00B5DDB3 /* cbc_done.c */, - 4873F3A611A4E47B00B5DDB3 /* cbc_encrypt.c */, - 4873F3A711A4E47B00B5DDB3 /* cbc_getiv.c */, - 4873F3A811A4E47B00B5DDB3 /* cbc_setiv.c */, - 4873F3A911A4E47B00B5DDB3 /* cbc_start.c */, - ); - path = cbc; - sourceTree = ""; - }; - 4873F3AA11A4E47B00B5DDB3 /* cfb */ = { - isa = PBXGroup; - children = ( - 4873F3AB11A4E47B00B5DDB3 /* cfb_decrypt.c */, - 4873F3AC11A4E47B00B5DDB3 /* cfb_descriptor.c */, - 4873F3AD11A4E47B00B5DDB3 /* cfb_done.c */, - 4873F3AE11A4E47B00B5DDB3 /* cfb_encrypt.c */, - 4873F3AF11A4E47B00B5DDB3 /* cfb_getiv.c */, - 4873F3B011A4E47B00B5DDB3 /* cfb_setiv.c */, - 4873F3B111A4E47B00B5DDB3 /* cfb_start.c */, - ); - path = cfb; - sourceTree = ""; - }; - 4873F3B211A4E47B00B5DDB3 /* ctr */ = { - isa = PBXGroup; - children = ( - 4873F3B311A4E47B00B5DDB3 /* ctr_decrypt.c */, - 4873F3B411A4E47B00B5DDB3 /* ctr_descriptor.c */, - 4873F3B511A4E47B00B5DDB3 /* ctr_done.c */, - 4873F3B611A4E47B00B5DDB3 /* ctr_encrypt.c */, - 4873F3B711A4E47B00B5DDB3 /* ctr_getiv.c */, - 4873F3B811A4E47B00B5DDB3 /* ctr_setiv.c */, - 4873F3B911A4E47B00B5DDB3 /* ctr_start.c */, - 4873F3BA11A4E47B00B5DDB3 /* ctr_test.c */, - ); - path = ctr; - sourceTree = ""; - }; - 4873F3BB11A4E47B00B5DDB3 /* ecb */ = { - isa = PBXGroup; - children = ( - 4873F3BC11A4E47B00B5DDB3 /* ecb_decrypt.c */, - 4873F3BD11A4E47B00B5DDB3 /* ecb_descriptor.c */, - 4873F3BE11A4E47B00B5DDB3 /* ecb_done.c */, - 4873F3BF11A4E47B00B5DDB3 /* ecb_encrypt.c */, - 4873F3C011A4E47B00B5DDB3 /* ecb_start.c */, - ); - path = ecb; - sourceTree = ""; - }; - 4873F3D411A4E47B00B5DDB3 /* ofb */ = { - isa = PBXGroup; - children = ( - 4873F3D511A4E47B00B5DDB3 /* ofb_decrypt.c */, - 4873F3D611A4E47B00B5DDB3 /* ofb_descriptor.c */, - 4873F3D711A4E47B00B5DDB3 /* ofb_done.c */, - 4873F3D811A4E47B00B5DDB3 /* ofb_encrypt.c */, - 4873F3D911A4E47B00B5DDB3 /* ofb_getiv.c */, - 4873F3DA11A4E47B00B5DDB3 /* ofb_setiv.c */, - 4873F3DB11A4E47B00B5DDB3 /* ofb_start.c */, - ); - path = ofb; - sourceTree = ""; - }; - 4873F3DE11A4E47B00B5DDB3 /* xts */ = { - isa = PBXGroup; - children = ( - 4873F3DF11A4E47B00B5DDB3 /* xts_decrypt.c */, - 4873F3E011A4E47B00B5DDB3 /* xts_descriptor.c */, - 4873F3E111A4E47B00B5DDB3 /* xts_done.c */, - 4873F3E211A4E47B00B5DDB3 /* xts_encrypt.c */, - 4873F3E311A4E47B00B5DDB3 /* xts_init.c */, - 4873F3E411A4E47B00B5DDB3 /* xts_mult_x.c */, - 4873F3E511A4E47B00B5DDB3 /* xts_test.c */, - ); - path = xts; - sourceTree = ""; - }; - 4873F3E611A4E47B00B5DDB3 /* padding */ = { - isa = PBXGroup; - children = ( - 4873F3E711A4E47B00B5DDB3 /* ansix923 */, - 4873F3EA11A4E47B00B5DDB3 /* iso10126 */, - 4873F3ED11A4E47B00B5DDB3 /* nopadding */, - 4873F3F011A4E47B00B5DDB3 /* pkcs7 */, - ); - path = padding; - sourceTree = ""; - }; - 4873F3E711A4E47B00B5DDB3 /* ansix923 */ = { - isa = PBXGroup; - children = ( - 4873F3E811A4E47B00B5DDB3 /* ansi923pad.c */, - 4873F3E911A4E47B00B5DDB3 /* ansi923pad.h */, - ); - path = ansix923; - sourceTree = ""; - }; - 4873F3EA11A4E47B00B5DDB3 /* iso10126 */ = { - isa = PBXGroup; - children = ( - 4873F3EB11A4E47B00B5DDB3 /* iso10126pad.c */, - 4873F3EC11A4E47B00B5DDB3 /* iso10126pad.h */, - ); - path = iso10126; - sourceTree = ""; - }; - 4873F3ED11A4E47B00B5DDB3 /* nopadding */ = { - isa = PBXGroup; - children = ( - 4873F3EE11A4E47B00B5DDB3 /* nopad.c */, - 4873F3EF11A4E47B00B5DDB3 /* nopad.h */, - ); - path = nopadding; - sourceTree = ""; - }; - 4873F3F011A4E47B00B5DDB3 /* pkcs7 */ = { - isa = PBXGroup; - children = ( - 4873F3F111A4E47B00B5DDB3 /* pkcs7pad.c */, - 4873F3F211A4E47B00B5DDB3 /* pkcs7pad.h */, - ); - path = pkcs7; - sourceTree = ""; - }; - 489D982B11A4E8C20004DB89 /* Utility */ = { - isa = PBXGroup; - children = ( + 486130D6126681290036EA02 /* components */ = { + isa = PBXGroup; + children = ( + 486130D7126681290036EA02 /* CC_base.xcconfig */, + 486130D8126681290036EA02 /* CC_deployment.xcconfig */, + 486130D9126681290036EA02 /* CC_development.xcconfig */, + 486130DA126681290036EA02 /* CC_dynamic.xcconfig */, + 486130DB126681290036EA02 /* CC_dynamic_deployment.xcconfig */, + 486130DC126681290036EA02 /* CC_dynamic_development.xcconfig */, + 486130DD126681290036EA02 /* CC_static.xcconfig */, + 486130DE126681290036EA02 /* CC_static_deployment.xcconfig */, + 486130DF126681290036EA02 /* CC_static_development.xcconfig */, + 486130E0126681290036EA02 /* CC_umbrellaMember.xcconfig */, + ); + name = components; + path = Configurations/components; + sourceTree = ""; + }; + 486130E1126681290036EA02 /* platforms */ = { + isa = PBXGroup; + children = ( + 486130E2126681290036EA02 /* CC_iOSClient.xcconfig */, + 486130E3126681290036EA02 /* CC_iOSClientSim.xcconfig */, + 486130E5126681290036EA02 /* CC_MacOSXClient.xcconfig */, + ); + name = platforms; + path = Configurations/platforms; + sourceTree = ""; + }; + 486130E7126681290036EA02 /* targets */ = { + isa = PBXGroup; + children = ( + 486130E8126681290036EA02 /* CC_iOSClient_deployment.xcconfig */, + 486130E9126681290036EA02 /* CC_iOSClient_development.xcconfig */, + 486130EC126681290036EA02 /* CC_iOSSim_deployment.xcconfig */, + 486130ED126681290036EA02 /* CC_iOSSim_development.xcconfig */, + 486130EE126681290036EA02 /* CC_MacOSXClient_deployment.xcconfig */, + 486130EF126681290036EA02 /* CC_MacOSXClient_development.xcconfig */, + ); + name = targets; + path = Configurations/targets; + sourceTree = ""; + }; + 486130F2126681290036EA02 /* tests */ = { + isa = PBXGroup; + children = ( + 486130F3126681290036EA02 /* CC_localtest.xcconfig */, + 486130F4126681290036EA02 /* CC_unittest_base.xcconfig */, + 486130F5126681290036EA02 /* CC_unittest_deployment.xcconfig */, + 486130F6126681290036EA02 /* CC_unittest_development.xcconfig */, + 486130F7126681290036EA02 /* CC_unittest_dynamic_deployment.xcconfig */, + 486130F8126681290036EA02 /* CC_unitTest_dynamic_development.xcconfig */, + 486130F9126681290036EA02 /* CC_unittest_static_deployment.xcconfig */, + 486130FA126681290036EA02 /* CC_unittest_static_development.xcconfig */, + ); + name = tests; + path = Configurations/tests; + sourceTree = ""; + }; + 489D982B11A4E8C20004DB89 /* ccUtilities */ = { + isa = PBXGroup; + children = ( + 48AC47CD1381EFDC00F584F5 /* byteBuffer.c */, + 48AC47CE1381EFDC00F584F5 /* byteBuffer.h */, + 48FD6C371354DD4000F55B8B /* ccErrors.h */, + 48FD6C381354DD4000F55B8B /* ccMemory.h */, 489D982C11A4E8C20004DB89 /* ccdebug.c */, 489D982D11A4E8C20004DB89 /* ccdebug.h */, ); - name = Utility; path = ccUtilities; sourceTree = ""; }; - 48D5636A11A652EB008EBBBF /* GladmanAES */ = { - isa = PBXGroup; - children = ( - 48D5636B11A652EB008EBBBF /* aescrypt.c */, - 48D5636C11A652EB008EBBBF /* aeskey.c */, - 48D5636D11A652EB008EBBBF /* aestab.c */, - 48D5636E11A652EB008EBBBF /* aestab.h */, - 48D5636F11A652EB008EBBBF /* ccNewGladman.c */, - 48D5637011A652EB008EBBBF /* README */, - ); - path = GladmanAES; - sourceTree = ""; - }; - 48D5637611A65316008EBBBF /* AESedp */ = { - isa = PBXGroup; - children = ( - 48D5636611A652D7008EBBBF /* aesopt.h */, - 48D5636711A652D7008EBBBF /* aes.h */, - 48D5637711A65316008EBBBF /* AES.c */, - 48D5637811A65316008EBBBF /* AESAssembly.h */, - 48D5637911A65316008EBBBF /* Data.c */, - 48D5637A11A65316008EBBBF /* Intel */, - 48D5638311A65316008EBBBF /* MakeData.c */, - 48D5638411A65316008EBBBF /* makefile */, - 48D5638511A65316008EBBBF /* ReadMe.txt */, - ); - path = AESedp; - sourceTree = ""; - }; - 48D5637A11A65316008EBBBF /* Intel */ = { - isa = PBXGroup; - children = ( - 48D5637B11A65316008EBBBF /* AES.s */, - 48D5637C11A65316008EBBBF /* Data.s */, - 48D5637D11A65316008EBBBF /* DecryptCBC.s */, - 48D5637E11A65316008EBBBF /* EncryptCBC.s */, - 48D5637F11A65316008EBBBF /* EncryptDecrypt.s */, - 48D5638011A65316008EBBBF /* ExpandKeyForDecryption.s */, - 48D5638111A65316008EBBBF /* ExpandKeyForEncryption.s */, - 48D5638211A65316008EBBBF /* ReadMe.txt */, - ); - path = Intel; - sourceTree = ""; - }; - 48F7F37612B2F05A00AF4587 /* ltc_aes */ = { - isa = PBXGroup; - children = ( - 48F7F37712B2F05A00AF4587 /* aes.c */, - 48F7F37812B2F05A00AF4587 /* aes_tab.c */, - 48F7F37912B2F05A00AF4587 /* ltc_aes.h */, - ); - path = ltc_aes; + 489EECA1149809A800B44D5A /* libDER */ = { + isa = PBXGroup; + children = ( + 489EECA2149809A800B44D5A /* asn1Types.h */, + 489EECA3149809A800B44D5A /* DER_CertCrl.c */, + 489EECA4149809A800B44D5A /* DER_CertCrl.h */, + 489EECA5149809A800B44D5A /* DER_Decode.c */, + 489EECA6149809A800B44D5A /* DER_Decode.h */, + 489EECA7149809A800B44D5A /* DER_Digest.c */, + 489EECA8149809A800B44D5A /* DER_Digest.h */, + 489EECA9149809A800B44D5A /* DER_Encode.c */, + 489EECAA149809A800B44D5A /* DER_Encode.h */, + 489EECAB149809A800B44D5A /* DER_Keys.c */, + 489EECAC149809A800B44D5A /* DER_Keys.h */, + 489EECAD149809A800B44D5A /* libDER.h */, + 489EECAE149809A800B44D5A /* libDER_config.h */, + 489EECAF149809A800B44D5A /* oids.c */, + 489EECB0149809A800B44D5A /* oids.h */, + ); + name = libDER; + path = libDER/libDER; + sourceTree = ""; + }; + 48CA258512C149EF002330C4 /* descriptors */ = { + isa = PBXGroup; + children = ( + 489E06F814B7AB0800B0A282 /* corecryptoSymmetricBridge.c */, + 4868BB1314B7C7F300072488 /* corecryptoSymmetricBridge.h */, + ); + path = descriptors; + sourceTree = ""; + }; + 48FD6C621354E06A00F55B8B /* Exports */ = { + isa = PBXGroup; + children = ( + 48FD6C631354E06A00F55B8B /* CommonCrypto.exp */, + 48FD6C641354E06A00F55B8B /* CommonCryptoIOS5.exp */, + ); + name = Exports; + path = Source/Exports; sourceTree = ""; }; 5DB4936310FBC4E200E45951 /* Configurations */ = { isa = PBXGroup; children = ( - 5D113BC21106441E00B412A2 /* CommonCrypto_base.xcconfig */, - 12FA10D211F7AB3E00917A4E /* CommonCrypto_deployment.xcconfig */, - 12FA10D311F7AB5000917A4E /* CommonCrypto_development.xcconfig */, - 12FA10D811F7ABCD00917A4E /* CommonCrypto_umbrellaMember.xcconfig */, - 12FA10D011F7AACE00917A4E /* CommonCrypto_umbrellaMember_deployment.xcconfig */, - 12FA10D111F7AAE400917A4E /* CommonCrypto_umbrellaMember_development.xcconfig */, - 5D113BCB1106441E00B412A2 /* CommonCrypto_unittest_base.xcconfig */, - 12790C7411F7C4BA0044EFE5 /* CommonCrypto_unittest_deployment.xcconfig */, - 12790C7511F7C4BA0044EFE5 /* CommonCrypto_unittest_development.xcconfig */, - 12A1ADD71207419E000C30A4 /* CommonCrypto_localtest.xcconfig */, + 486130D6126681290036EA02 /* components */, + 486130E1126681290036EA02 /* platforms */, + 486130E7126681290036EA02 /* targets */, + 486130F2126681290036EA02 /* tests */, ); name = Configurations; - sourceTree = ""; - }; - 5DB4940410FBE5A800E45951 /* UnitTestSource */ = { - isa = PBXGroup; - children = ( - 5D57A807111B5DDE008CA573 /* SymmetricWrapTest.h */, - 5D57A808111B5DDE008CA573 /* SymmetricWrapTest.mm */, - 4882005B111AAD7A00798F94 /* PBKDFTest.h */, - 4882005C111AAD7A00798F94 /* PBKDFTest.mm */, - 5D113BD41106452100B412A2 /* CommonCryptoUnitTests-Info.plist */, - 5D113BD51106452100B412A2 /* CommonCryptoUnitTests.h */, - 5D113BD61106452100B412A2 /* CommonCryptoUnitTests.mm */, - 5D113BD71106452100B412A2 /* DigestTest.h */, - 5D113BD81106452100B412A2 /* DigestTest.mm */, - 5D113BD91106452100B412A2 /* EncryptionTest.h */, - 5D113BDA1106452100B412A2 /* EncryptionTest.mm */, - 5D113BDB1106452100B412A2 /* HMACTest.h */, - 5D113BDC1106452100B412A2 /* HMACTest.mm */, - 5D113BDD1106452100B412A2 /* RandomNumberService.h */, - 5D113BDE1106452100B412A2 /* RandomNumberService.mm */, - 5DAD82EC1279E04500240B9A /* TestToolProtocol.h */, - 5DAD83A71279F2B200240B9A /* main.mm */, - ); - name = UnitTestSource; - sourceTree = ""; - }; - 795CA3FC0D34431400BAE6A2 /* RC2 */ = { - isa = PBXGroup; - children = ( - 4836A41811A5C94A00862178 /* rc2.h */, - 4836A41B11A5C94A00862178 /* ccRC2.h */, - 795CA3FD0D34431400BAE6A2 /* ccRC2.c */, - 795CA3FE0D34431400BAE6A2 /* rc2.c */, - ); - path = RC2; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 054BBEBA05F6A97700344873 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 054BBECE05F6AA7200344873 /* CommonDigest.h in Headers */, - 054BBEE005F6AA8900344873 /* md4_locl.h in Headers */, - 054BBEE205F6AA8900344873 /* md5_locl.h in Headers */, - 054BBEE305F6AA8900344873 /* md32_common.h in Headers */, - 054BBEE505F6AA8900344873 /* sha_locl.h in Headers */, - 05E319DD0638913700C4AD24 /* sha2Priv.h in Headers */, - 5302E4201343E3CE003037FA /* CommonCMACSPI.h in Headers */, - 05C70C5509D471C30004B8F4 /* spr.h in Headers */, - 05C4414409D49F28002066D1 /* des.h in Headers */, - 05C4414609D49F29002066D1 /* des_locl.h in Headers */, - 05C4416F09D4BACE002066D1 /* e_os2.h in Headers */, - 05C4417309D4BB0B002066D1 /* opensslconf.h in Headers */, - 05D9F61909D85F4A00AD30A7 /* CommonCryptor.h in Headers */, - 0585FE1D09DC9873001762F6 /* cast_lcl.h in Headers */, - 0585FE1E09DC9873001762F6 /* cast_s.h in Headers */, - 05D8D97D09E411AB00E03504 /* CommonHMAC.h in Headers */, - 4854F9C21116307500CAFA18 /* CommonKeyDerivation.h in Headers */, - 4854F9C31116307500CAFA18 /* CommonSymmetricKeywrap.h in Headers */, - 4873F40511A4E47B00B5DDB3 /* rc4.h in Headers */, - 4873F41911A4E47B00B5DDB3 /* tomcrypt.h in Headers */, - 4873F41A11A4E47B00B5DDB3 /* tomcrypt_argchk.h in Headers */, - 4873F41B11A4E47B00B5DDB3 /* tomcrypt_cfg.h in Headers */, - 4873F41C11A4E47B00B5DDB3 /* tomcrypt_cipher.h in Headers */, - 4873F41D11A4E47B00B5DDB3 /* tomcrypt_custom.h in Headers */, - 4873F41E11A4E47B00B5DDB3 /* tomcrypt_hash.h in Headers */, - 4873F41F11A4E47B00B5DDB3 /* tomcrypt_mac.h in Headers */, - 4873F42011A4E47B00B5DDB3 /* tomcrypt_macros.h in Headers */, - 4873F42111A4E47B00B5DDB3 /* tomcrypt_math.h in Headers */, - 4873F42211A4E47B00B5DDB3 /* tomcrypt_misc.h in Headers */, - 4873F42311A4E47B00B5DDB3 /* tomcrypt_mode.h in Headers */, - 4873F42411A4E47B00B5DDB3 /* tomcrypt_pk.h in Headers */, - 4873F42511A4E47B00B5DDB3 /* tomcrypt_pkcs.h in Headers */, - 4873F42611A4E47B00B5DDB3 /* tomcrypt_prng.h in Headers */, - 4873F48411A4E47B00B5DDB3 /* ansi923pad.h in Headers */, - 4873F48611A4E47B00B5DDB3 /* iso10126pad.h in Headers */, - 4873F48811A4E47B00B5DDB3 /* nopad.h in Headers */, - 4873F48A11A4E47B00B5DDB3 /* pkcs7pad.h in Headers */, - 489D982F11A4E8C20004DB89 /* ccdebug.h in Headers */, - 4846CA5611A5C8B800E7DA82 /* CommonCryptorSPI.h in Headers */, - 4846CA5711A5C8B800E7DA82 /* CommonDigestSPI.h in Headers */, - 4836A41F11A5C94A00862178 /* rc2.h in Headers */, - 4836A42011A5C94A00862178 /* opensslDES.h in Headers */, - 4836A42111A5C94A00862178 /* CommonCryptoPriv.h in Headers */, - 4836A42211A5C94A00862178 /* ccRC2.h in Headers */, - 4836A42311A5C94A00862178 /* ccCast.h in Headers */, - 4836A42411A5C94A00862178 /* cast.h in Headers */, - 4836A43311A5CB4700862178 /* CommonCryptorPriv.h in Headers */, - 4836A43411A5CB4700862178 /* CommonDigestPriv.h in Headers */, - 4836A43711A5CB4700862178 /* CommonKeyDerivationPriv.h in Headers */, - 48D5636811A652D7008EBBBF /* aesopt.h in Headers */, - 48D5636911A652D7008EBBBF /* aes.h in Headers */, - 48D5637411A652EB008EBBBF /* aestab.h in Headers */, - 48D5638711A65316008EBBBF /* AESAssembly.h in Headers */, - 485A566D11AE4BB4003DDC41 /* aesedp.h in Headers */, - 4862F09811BDA1D300946BBE /* skein_ltc.h in Headers */, - 4862F0AB11BDA27200946BBE /* skein.h in Headers */, - 4862F0AD11BDA27200946BBE /* skein_port.h in Headers */, - 4862F0AE11BDA27200946BBE /* skein_iv.h in Headers */, - 4862F0AF11BDA27200946BBE /* skein_dropin.h in Headers */, - 4862F0B111BDA27200946BBE /* skein_debug.h in Headers */, - 4862F0B411BDA27200946BBE /* SHA3api_ref.h in Headers */, - 4862F0B611BDA27200946BBE /* brg_types.h in Headers */, - 4862F0B711BDA27200946BBE /* brg_endian.h in Headers */, - 12FA0DB011F7962100917A4E /* CommonRandomSPI.h in Headers */, - 125B78AF11FF877D008C1AD3 /* aesedpPriv.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 48F7F29812B2EF6000AF4587 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 48F7F29912B2EF6000AF4587 /* CommonDigest.h in Headers */, - 48F7F29A12B2EF6000AF4587 /* md4_locl.h in Headers */, - 48F7F29B12B2EF6000AF4587 /* md5_locl.h in Headers */, - 48F7F29C12B2EF6000AF4587 /* md32_common.h in Headers */, - 48F7F29D12B2EF6000AF4587 /* sha_locl.h in Headers */, - 48F7F29E12B2EF6000AF4587 /* sha2Priv.h in Headers */, - 48F7F29F12B2EF6000AF4587 /* spr.h in Headers */, - 48F7F2A012B2EF6000AF4587 /* des.h in Headers */, - 48F7F2A112B2EF6000AF4587 /* des_locl.h in Headers */, - 48F7F2A212B2EF6000AF4587 /* e_os2.h in Headers */, - 48F7F2A312B2EF6000AF4587 /* opensslconf.h in Headers */, - 48F7F2A412B2EF6000AF4587 /* CommonCryptor.h in Headers */, - 48F7F2A512B2EF6000AF4587 /* cast_lcl.h in Headers */, - 48F7F2A612B2EF6000AF4587 /* cast_s.h in Headers */, - 48F7F2A712B2EF6000AF4587 /* CommonHMAC.h in Headers */, - 48F7F2A812B2EF6000AF4587 /* CommonKeyDerivation.h in Headers */, - 48F7F2A912B2EF6000AF4587 /* CommonSymmetricKeywrap.h in Headers */, - 48F7F2AA12B2EF6000AF4587 /* rc4.h in Headers */, - 48F7F2AB12B2EF6000AF4587 /* tomcrypt.h in Headers */, - 48F7F2AC12B2EF6000AF4587 /* tomcrypt_argchk.h in Headers */, - 48F7F2AD12B2EF6000AF4587 /* tomcrypt_cfg.h in Headers */, - 48F7F2AE12B2EF6000AF4587 /* tomcrypt_cipher.h in Headers */, - 48F7F2AF12B2EF6000AF4587 /* tomcrypt_custom.h in Headers */, - 48F7F2B012B2EF6000AF4587 /* tomcrypt_hash.h in Headers */, - 48F7F2B112B2EF6000AF4587 /* tomcrypt_mac.h in Headers */, - 48F7F2B212B2EF6000AF4587 /* tomcrypt_macros.h in Headers */, - 48F7F2B312B2EF6000AF4587 /* tomcrypt_math.h in Headers */, - 48F7F2B412B2EF6000AF4587 /* tomcrypt_misc.h in Headers */, - 48F7F2B512B2EF6000AF4587 /* tomcrypt_mode.h in Headers */, - 48F7F2B612B2EF6000AF4587 /* tomcrypt_pk.h in Headers */, - 48F7F2B712B2EF6000AF4587 /* tomcrypt_pkcs.h in Headers */, - 48F7F2B812B2EF6000AF4587 /* tomcrypt_prng.h in Headers */, - 48F7F2B912B2EF6000AF4587 /* ansi923pad.h in Headers */, - 48F7F2BA12B2EF6000AF4587 /* iso10126pad.h in Headers */, - 48F7F2BB12B2EF6000AF4587 /* nopad.h in Headers */, - 48F7F2BC12B2EF6000AF4587 /* pkcs7pad.h in Headers */, - 48F7F2BD12B2EF6000AF4587 /* ccdebug.h in Headers */, - 48F7F2BE12B2EF6000AF4587 /* CommonCryptorSPI.h in Headers */, - 48F7F2BF12B2EF6000AF4587 /* CommonDigestSPI.h in Headers */, - 48F7F2C012B2EF6000AF4587 /* rc2.h in Headers */, - 48F7F2C112B2EF6000AF4587 /* opensslDES.h in Headers */, - 48F7F2C212B2EF6000AF4587 /* CommonCryptoPriv.h in Headers */, - 48F7F2C312B2EF6000AF4587 /* ccRC2.h in Headers */, - 48F7F2C412B2EF6000AF4587 /* ccCast.h in Headers */, - 48F7F2C512B2EF6000AF4587 /* cast.h in Headers */, - 48F7F2C612B2EF6000AF4587 /* CommonCryptorPriv.h in Headers */, - 48F7F2C712B2EF6000AF4587 /* CommonDigestPriv.h in Headers */, - 48F7F2C812B2EF6000AF4587 /* CommonKeyDerivationPriv.h in Headers */, - 48F7F2C912B2EF6000AF4587 /* aesopt.h in Headers */, - 48F7F2CA12B2EF6000AF4587 /* aes.h in Headers */, - 48F7F2CB12B2EF6000AF4587 /* aestab.h in Headers */, - 48F7F2CC12B2EF6000AF4587 /* AESAssembly.h in Headers */, - 48F7F2CE12B2EF6000AF4587 /* skein_ltc.h in Headers */, - 48F7F2CF12B2EF6000AF4587 /* skein.h in Headers */, - 48F7F2D012B2EF6000AF4587 /* skein_port.h in Headers */, - 48F7F2D112B2EF6000AF4587 /* skein_iv.h in Headers */, - 48F7F2D212B2EF6000AF4587 /* skein_dropin.h in Headers */, - 48F7F2D312B2EF6000AF4587 /* skein_debug.h in Headers */, - 48F7F2D412B2EF6000AF4587 /* SHA3api_ref.h in Headers */, - 48F7F2D512B2EF6000AF4587 /* brg_types.h in Headers */, - 48F7F2D612B2EF6000AF4587 /* brg_endian.h in Headers */, - 48F7F2D712B2EF6000AF4587 /* CommonRandomSPI.h in Headers */, - 48F7F37C12B2F05A00AF4587 /* ltc_aes.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 5DAD82C81279DEF900240B9A /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( + 4873A7281445099D0011B4FA /* CommonCrypto.h in Headers */, + 054BBECE05F6AA7200344873 /* CommonDigest.h in Headers */, + 05D9F61909D85F4A00AD30A7 /* CommonCryptor.h in Headers */, + 05D8D97D09E411AB00E03504 /* CommonHMAC.h in Headers */, + 4854F9C21116307500CAFA18 /* CommonKeyDerivation.h in Headers */, + 4854F9C31116307500CAFA18 /* CommonSymmetricKeywrap.h in Headers */, + 489FD30E13187B1D00ACB86D /* CommonHMacSPI.h in Headers */, + 488FCCB3139D6DD7007F2FC4 /* aes.h in Headers */, + 4836A43311A5CB4700862178 /* CommonCryptorPriv.h in Headers */, + 4825AAF81314CDCD00413A64 /* CommonBigNum.h in Headers */, + 48E93DCB136867F500B33DB8 /* CommonCMACSPI.h in Headers */, + 48D076C3130B2A510052D1AC /* CommonDH.h in Headers */, + 48D076CA130B2A620052D1AC /* CommonECCryptor.h in Headers */, + 48B4651512848FB800311799 /* CommonRSACryptor.h in Headers */, + 48FC4BD613959D0600DA4760 /* lionCompat.h in Headers */, + 489D982F11A4E8C20004DB89 /* ccdebug.h in Headers */, + 4846CA5611A5C8B800E7DA82 /* CommonCryptorSPI.h in Headers */, + 4846CA5711A5C8B800E7DA82 /* CommonDigestSPI.h in Headers */, + 4836A42111A5C94A00862178 /* CommonCryptoPriv.h in Headers */, + 4836A43411A5CB4700862178 /* CommonDigestPriv.h in Headers */, + 12FA0DB011F7962100917A4E /* CommonRandomSPI.h in Headers */, + 485FED56131475A400FF0F82 /* CommonBigNumPriv.h in Headers */, + 48FD6C401354DD4000F55B8B /* ccErrors.h in Headers */, + 48FD6C411354DD4000F55B8B /* ccMemory.h in Headers */, + 48AC47D51381EFDC00F584F5 /* byteBuffer.h in Headers */, + 489EECB1149809A800B44D5A /* asn1Types.h in Headers */, + 489EECB7149809A800B44D5A /* DER_CertCrl.h in Headers */, + 489EECBD149809A800B44D5A /* DER_Decode.h in Headers */, + 489EECC3149809A800B44D5A /* DER_Digest.h in Headers */, + 489EECC9149809A800B44D5A /* DER_Encode.h in Headers */, + 489EECCF149809A800B44D5A /* DER_Keys.h in Headers */, + 489EECD2149809A800B44D5A /* libDER.h in Headers */, + 489EECD5149809A800B44D5A /* libDER_config.h in Headers */, + 489EECDB149809A800B44D5A /* oids.h in Headers */, + 4868BB1414B7C7F300072488 /* corecryptoSymmetricBridge.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 48165CD8125AC5D50015A267 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 4873A72A1445099D0011B4FA /* CommonCrypto.h in Headers */, + 48165CD9125AC5D50015A267 /* CommonDigest.h in Headers */, + 48165CDA125AC5D50015A267 /* CommonCryptor.h in Headers */, + 48165CDB125AC5D50015A267 /* CommonHMAC.h in Headers */, + 48165CDC125AC5D50015A267 /* CommonKeyDerivation.h in Headers */, + 48165CDD125AC5D50015A267 /* CommonSymmetricKeywrap.h in Headers */, + 48165CF0125AC5D50015A267 /* ccdebug.h in Headers */, + 48165CF1125AC5D50015A267 /* CommonCryptorSPI.h in Headers */, + 48165CF2125AC5D50015A267 /* CommonDigestSPI.h in Headers */, + 48165CF3125AC5D50015A267 /* CommonCryptoPriv.h in Headers */, + 48165CF4125AC5D50015A267 /* CommonCryptorPriv.h in Headers */, + 48165CF5125AC5D50015A267 /* CommonDigestPriv.h in Headers */, + 48165CF7125AC5D50015A267 /* CommonRandomSPI.h in Headers */, + 48685584127B63F200B88D39 /* aes.h in Headers */, + 48B4651412848FB800311799 /* CommonRSACryptor.h in Headers */, + 48D076C1130B2A510052D1AC /* CommonDH.h in Headers */, + 48D076C8130B2A620052D1AC /* CommonECCryptor.h in Headers */, + 489FD30C13187B1D00ACB86D /* CommonHMacSPI.h in Headers */, + 485FED54131475A400FF0F82 /* CommonBigNumPriv.h in Headers */, + 4825AAF61314CDCD00413A64 /* CommonBigNum.h in Headers */, + 48FD6C3A1354DD4000F55B8B /* ccErrors.h in Headers */, + 48FD6C3B1354DD4000F55B8B /* ccMemory.h in Headers */, + 48E93DCC136867F500B33DB8 /* CommonCMACSPI.h in Headers */, + 48AC47D71381EFDC00F584F5 /* byteBuffer.h in Headers */, + 489EECB2149809A800B44D5A /* asn1Types.h in Headers */, + 489EECB8149809A800B44D5A /* DER_CertCrl.h in Headers */, + 489EECBE149809A800B44D5A /* DER_Decode.h in Headers */, + 489EECC4149809A800B44D5A /* DER_Digest.h in Headers */, + 489EECCA149809A800B44D5A /* DER_Encode.h in Headers */, + 489EECD0149809A800B44D5A /* DER_Keys.h in Headers */, + 489EECD3149809A800B44D5A /* libDER.h in Headers */, + 489EECD6149809A800B44D5A /* libDER_config.h in Headers */, + 489EECDC149809A800B44D5A /* oids.h in Headers */, + 4868BB1514B7C7F300072488 /* corecryptoSymmetricBridge.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 48165DBB125AC5F20015A267 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 4873A72B1445099D0011B4FA /* CommonCrypto.h in Headers */, + 48165DBC125AC5F20015A267 /* CommonDigest.h in Headers */, + 48165DBD125AC5F20015A267 /* CommonCryptor.h in Headers */, + 48165DBE125AC5F20015A267 /* CommonHMAC.h in Headers */, + 48165DBF125AC5F20015A267 /* CommonKeyDerivation.h in Headers */, + 48165DC0125AC5F20015A267 /* CommonSymmetricKeywrap.h in Headers */, + 48165DD3125AC5F20015A267 /* ccdebug.h in Headers */, + 48165DD4125AC5F20015A267 /* CommonCryptorSPI.h in Headers */, + 48165DD5125AC5F20015A267 /* CommonDigestSPI.h in Headers */, + 48165DD6125AC5F20015A267 /* CommonCryptoPriv.h in Headers */, + 48165DD7125AC5F20015A267 /* CommonCryptorPriv.h in Headers */, + 48165DD8125AC5F20015A267 /* CommonDigestPriv.h in Headers */, + 48165DDA125AC5F20015A267 /* CommonRandomSPI.h in Headers */, + 48B4651712848FB800311799 /* CommonRSACryptor.h in Headers */, + 48D076C5130B2A510052D1AC /* CommonDH.h in Headers */, + 48D076CC130B2A620052D1AC /* CommonECCryptor.h in Headers */, + 489FD30F13187B1D00ACB86D /* CommonHMacSPI.h in Headers */, + 485FED50131475A400FF0F82 /* CommonBigNumPriv.h in Headers */, + 4825AAF71314CDCD00413A64 /* CommonBigNum.h in Headers */, + 4CDDFB7E133BD3BA00B4770F /* aes.h in Headers */, + 48FD6C431354DD4000F55B8B /* ccErrors.h in Headers */, + 48FD6C441354DD4000F55B8B /* ccMemory.h in Headers */, + 48E93DCD136867F500B33DB8 /* CommonCMACSPI.h in Headers */, + 48AC47D81381EFDC00F584F5 /* byteBuffer.h in Headers */, + 489EECB3149809A800B44D5A /* asn1Types.h in Headers */, + 489EECB9149809A800B44D5A /* DER_CertCrl.h in Headers */, + 489EECBF149809A800B44D5A /* DER_Decode.h in Headers */, + 489EECC5149809A800B44D5A /* DER_Digest.h in Headers */, + 489EECCB149809A800B44D5A /* DER_Encode.h in Headers */, + 489EECD1149809A800B44D5A /* DER_Keys.h in Headers */, + 489EECD4149809A800B44D5A /* libDER.h in Headers */, + 489EECD7149809A800B44D5A /* libDER_config.h in Headers */, + 489EECDD149809A800B44D5A /* oids.h in Headers */, + 4868BB1614B7C7F300072488 /* corecryptoSymmetricBridge.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 054BBEBD05F6A97700344873 /* commonCrypto */ = { - isa = PBXNativeTarget; - buildConfigurationList = C27AD07D0987FCDA001272E0 /* Build configuration list for PBXNativeTarget "commonCrypto" */; - buildPhases = ( - 054BBEBA05F6A97700344873 /* Headers */, - 054BBEBB05F6A97700344873 /* Sources */, - ); - buildRules = ( - B125268E0713742A00BB8157 /* PBXBuildRule */, - ); - dependencies = ( - ); - name = commonCrypto; - productName = commonCrypto; - productReference = 054BBEBE05F6A97700344873 /* libcommonCrypto.dylib */; - productType = "com.apple.product-type.library.dynamic"; - }; - 125B795011FF923D008C1AD3 /* XTStest */ = { - isa = PBXNativeTarget; - buildConfigurationList = 125B795711FF9279008C1AD3 /* Build configuration list for PBXNativeTarget "XTStest" */; - buildPhases = ( - 125B794E11FF923D008C1AD3 /* Sources */, - 125B794F11FF923D008C1AD3 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 12F60BEA12015A2600D17AF3 /* PBXTargetDependency */, - ); - name = XTStest; - productName = XTStest; - productReference = 125B795111FF923D008C1AD3 /* XTStest */; - productType = "com.apple.product-type.tool"; - }; - 128881641203673C0050B2E9 /* CBCTest */ = { - isa = PBXNativeTarget; - buildConfigurationList = 128881691203675B0050B2E9 /* Build configuration list for PBXNativeTarget "CBCTest" */; - buildPhases = ( - 128881621203673C0050B2E9 /* Sources */, - 128881631203673C0050B2E9 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 1228ADD712037B1000B83BF9 /* PBXTargetDependency */, - ); - name = CBCTest; - productName = CBCTest; - productReference = 128881651203673C0050B2E9 /* CBCTest */; - productType = "com.apple.product-type.tool"; - }; - 48F7F29712B2EF6000AF4587 /* commonCryptoOpenSource */ = { - isa = PBXNativeTarget; - buildConfigurationList = 48F7F36A12B2EF6000AF4587 /* Build configuration list for PBXNativeTarget "commonCryptoOpenSource" */; - buildPhases = ( - 48F7F29812B2EF6000AF4587 /* Headers */, - 48F7F2D912B2EF6000AF4587 /* Sources */, - ); - buildRules = ( - 48F7F36912B2EF6000AF4587 /* PBXBuildRule */, - ); - dependencies = ( - ); - name = commonCryptoOpenSource; - productName = commonCrypto; - productReference = 48F7F36D12B2EF6000AF4587 /* libcommonCrypto.dylib */; - productType = "com.apple.product-type.library.dynamic"; - }; - 5D735E4710FCDC04001AAD1E /* CommonCryptoUnitTest */ = { - isa = PBXNativeTarget; - buildConfigurationList = 5D735E4D10FCDC04001AAD1E /* Build configuration list for PBXNativeTarget "CommonCryptoUnitTest" */; - buildPhases = ( - 5D735E4410FCDC04001AAD1E /* Sources */, - 5D735E4510FCDC04001AAD1E /* Frameworks */, - 5D735E4610FCDC04001AAD1E /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - FC129BED116AED0500D618D5 /* PBXTargetDependency */, - 5DAD82DC1279DF6100240B9A /* PBXTargetDependency */, - ); - name = CommonCryptoUnitTest; - productName = CommonCryptoUnitTest; - productReference = 5D735E4810FCDC04001AAD1E /* CommonCryptoUnitTest.octest */; - productType = "com.apple.product-type.bundle"; - }; - 5DAD82CB1279DEF900240B9A /* UnitTestLibrary */ = { - isa = PBXNativeTarget; - buildConfigurationList = 5DAD82E61279DFA700240B9A /* Build configuration list for PBXNativeTarget "UnitTestLibrary" */; - buildPhases = ( - 5DAD82C81279DEF900240B9A /* Headers */, - 5DAD82C91279DEF900240B9A /* Sources */, - 5DAD82CA1279DEF900240B9A /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = UnitTestLibrary; - productName = UnitTestLibrary; - productReference = 5DAD82CC1279DEF900240B9A /* libCommonCryptoUnitTest.a */; - productType = "com.apple.product-type.library.static"; - }; - 5DAD83981279F1EC00240B9A /* CommonCryptoTestTool */ = { - isa = PBXNativeTarget; - buildConfigurationList = 5DAD83A01279F24B00240B9A /* Build configuration list for PBXNativeTarget "CommonCryptoTestTool" */; - buildPhases = ( - 5DAD83961279F1EC00240B9A /* Sources */, - 5DAD83971279F1EC00240B9A /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 5DAD839E1279F22000240B9A /* PBXTargetDependency */, - ); - name = CommonCryptoTestTool; - productName = CommonCryptoTestTool; - productReference = 5DAD83991279F1EC00240B9A /* CommonCryptoTestTool */; + 054BBEBD05F6A97700344873 /* libCommonCryptoMacOSX */ = { + isa = PBXNativeTarget; + buildConfigurationList = C27AD07D0987FCDA001272E0 /* Build configuration list for PBXNativeTarget "libCommonCryptoMacOSX" */; + buildPhases = ( + 054BBEBA05F6A97700344873 /* Headers */, + 054BBEBB05F6A97700344873 /* Sources */, + EEB70419131C5BCB007CF918 /* Frameworks */, + ); + buildRules = ( + 48B5F5281361D6A500134C9F /* PBXBuildRule */, + B125268E0713742A00BB8157 /* PBXBuildRule */, + ); + dependencies = ( + ); + name = libCommonCryptoMacOSX; + productName = commonCrypto; + productReference = 054BBEBE05F6A97700344873 /* libcommonCrypto.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 48165CD7125AC5D50015A267 /* libCommonCryptoMacIOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 48165DB6125AC5D50015A267 /* Build configuration list for PBXNativeTarget "libCommonCryptoMacIOS" */; + buildPhases = ( + 48165CD8125AC5D50015A267 /* Headers */, + 48165D30125AC5D50015A267 /* Sources */, + 48CCF15612FA99B600D6DAE9 /* Frameworks */, + ); + buildRules = ( + 48165DB5125AC5D50015A267 /* PBXBuildRule */, + ); + dependencies = ( + ); + name = libCommonCryptoMacIOS; + productName = commonCrypto; + productReference = 48165DB9125AC5D50015A267 /* libcommonCrypto.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 48165DBA125AC5F20015A267 /* libCommonCryptoMacIOSSim */ = { + isa = PBXNativeTarget; + buildConfigurationList = 48165E99125AC5F20015A267 /* Build configuration list for PBXNativeTarget "libCommonCryptoMacIOSSim" */; + buildPhases = ( + 48165DBB125AC5F20015A267 /* Headers */, + 48165E13125AC5F20015A267 /* Sources */, + 4CA674F41331747E00C45A71 /* Frameworks */, + ); + buildRules = ( + 48165E98125AC5F20015A267 /* PBXBuildRule */, + ); + dependencies = ( + ); + name = libCommonCryptoMacIOSSim; + productName = commonCrypto; + productReference = 48165E9C125AC5F20015A267 /* libcommonCrypto_sim.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 4823B0DF14C10064008F689F /* CCRegression */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4823B0E714C10064008F689F /* Build configuration list for PBXNativeTarget "CCRegression" */; + buildPhases = ( + 4823B0DC14C10064008F689F /* Sources */, + 4823B0DD14C10064008F689F /* Frameworks */, + 4823B0DE14C10064008F689F /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 4823B10D14C101CC008F689F /* PBXTargetDependency */, + ); + name = CCRegression; + productName = CCRegression; + productReference = 4823B0E014C10064008F689F /* CCRegression */; + productType = "com.apple.product-type.tool"; + }; + 4834A85414F47B6200438E3D /* CCRegressionIos */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4834A87D14F47B6200438E3D /* Build configuration list for PBXNativeTarget "CCRegressionIos" */; + buildPhases = ( + 4834A85714F47B6200438E3D /* Sources */, + 4834A87A14F47B6200438E3D /* Frameworks */, + 4834A87C14F47B6200438E3D /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 4834A88414F47CA300438E3D /* PBXTargetDependency */, + ); + name = CCRegressionIos; + productName = CCRegression; + productReference = 4834A88014F47B6200438E3D /* CCRegression copy */; productType = "com.apple.product-type.tool"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 054BBEA605F6A8DE00344873 /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 0440; + }; buildConfigurationList = C27AD0910987FCDA001272E0 /* Build configuration list for PBXProject "CommonCrypto" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( @@ -2176,377 +1384,198 @@ productRefGroup = 054BBEBF05F6A97700344873 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 054BBEB705F6A93300344873 /* world */, - 054BBEBD05F6A97700344873 /* commonCrypto */, + 4C99FCB61326E14F0040AD38 /* commonCryptoMacIOS */, + 4CA675141332C16C00C45A71 /* CommonCrypto_Sim */, 05CE94290A3784D4007C91D6 /* Copy Open Source Docs */, - 5D735E4710FCDC04001AAD1E /* CommonCryptoUnitTest */, - 5DC876F710FFB6BC0012A390 /* Unit Test World */, - 125B795011FF923D008C1AD3 /* XTStest */, - 128881641203673C0050B2E9 /* CBCTest */, - 5DAD82CB1279DEF900240B9A /* UnitTestLibrary */, - 5DAD83981279F1EC00240B9A /* CommonCryptoTestTool */, - 48F7F29712B2EF6000AF4587 /* commonCryptoOpenSource */, + 054BBEBD05F6A97700344873 /* libCommonCryptoMacOSX */, + 48165CD7125AC5D50015A267 /* libCommonCryptoMacIOS */, + 48165DBA125AC5F20015A267 /* libCommonCryptoMacIOSSim */, + 4823B0DF14C10064008F689F /* CCRegression */, + 4834A85414F47B6200438E3D /* CCRegressionIos */, ); }; /* End PBXProject section */ /* Begin PBXShellScriptBuildPhase section */ - 5D735E4610FCDC04001AAD1E /* ShellScript */ = { + 4CA6751A1332C18C00C45A71 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; + buildActionMask = 8; files = ( ); inputPaths = ( ); outputPaths = ( ); - runOnlyForDeploymentPostprocessing = 0; + runOnlyForDeploymentPostprocessing = 1; shellPath = /bin/sh; - shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; + shellScript = "set -x\ncd $DSTROOT\nmkdir -p ${SDKROOT#/}\ntar cf - usr | tar xvfC - ${SDKROOT#/}\nrm -rf usr"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 054BBEBB05F6A97700344873 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 5302E41F1343E367003037FA /* CommonCMAC.c in Sources */, - AAAF0B9E0DC7A3DA0044DA03 /* sha1edpBigEndian.s in Sources */, - AAAF0B9F0DC7A3DA0044DA03 /* sha1edpLittleEndian.s in Sources */, - 054BBEDE05F6AA8900344873 /* md2_dgst.c in Sources */, - 054BBEDF05F6AA8900344873 /* md4_dgst.c in Sources */, - 054BBEE105F6AA8900344873 /* md5_dgst.c in Sources */, - 054BBEE705F6AA8900344873 /* sha1.c in Sources */, - 05E319BD063890C100C4AD24 /* sha2.c in Sources */, - 05ECA0EE09D469A100CFE5CB /* set_key.c in Sources */, - 0539DC2809D4919D00AB7F89 /* opensslDES.c in Sources */, - 05C4414509D49F29002066D1 /* des_enc.c in Sources */, - 0585FE1909DC9873001762F6 /* c_ecb.c in Sources */, - 0585FE1A09DC9873001762F6 /* c_enc.c in Sources */, - 0585FE1B09DC9873001762F6 /* c_skey.c in Sources */, - 0585FE1F09DC9873001762F6 /* ccCast.c in Sources */, - 795CA41E0D34459D00BAE6A2 /* ccRC2.c in Sources */, - 795CA41F0D34459D00BAE6A2 /* rc2.c in Sources */, - 4873F40211A4E47B00B5DDB3 /* cast5.c in Sources */, - 4873F40311A4E47B00B5DDB3 /* des.c in Sources */, - 4873F40411A4E47B00B5DDB3 /* rc2.c in Sources */, - 4873F40611A4E47B00B5DDB3 /* rc4_enc.c in Sources */, - 4873F40711A4E47B00B5DDB3 /* rc4_skey.c in Sources */, - 4873F40811A4E47B00B5DDB3 /* rc5.c in Sources */, - 4873F40911A4E47B00B5DDB3 /* hash_file.c in Sources */, - 4873F40A11A4E47B00B5DDB3 /* hash_filehandle.c in Sources */, - 4873F40B11A4E47B00B5DDB3 /* hash_memory.c in Sources */, - 4873F40C11A4E47B00B5DDB3 /* hash_memory_multi.c in Sources */, - 4873F40D11A4E47B00B5DDB3 /* md2.c in Sources */, - 4873F40E11A4E47B00B5DDB3 /* md4.c in Sources */, - 4873F40F11A4E47B00B5DDB3 /* md5.c in Sources */, - 4873F41011A4E47B00B5DDB3 /* rmd128.c in Sources */, - 4873F41111A4E47B00B5DDB3 /* rmd160.c in Sources */, - 4873F41211A4E47B00B5DDB3 /* rmd256.c in Sources */, - 4873F41311A4E47B00B5DDB3 /* rmd320.c in Sources */, - 4873F41411A4E47B00B5DDB3 /* sha1.c in Sources */, - 4873F41611A4E47B00B5DDB3 /* sha256.c in Sources */, - 4873F41811A4E47B00B5DDB3 /* sha512.c in Sources */, - 4873F42A11A4E47B00B5DDB3 /* crypt.c in Sources */, - 4873F42B11A4E47B00B5DDB3 /* crypt_argchk.c in Sources */, - 4873F42C11A4E47B00B5DDB3 /* crypt_cipher_descriptor.c in Sources */, - 4873F42D11A4E47B00B5DDB3 /* crypt_cipher_is_valid.c in Sources */, - 4873F42E11A4E47B00B5DDB3 /* crypt_find_cipher.c in Sources */, - 4873F42F11A4E47B00B5DDB3 /* crypt_find_cipher_any.c in Sources */, - 4873F43011A4E47B00B5DDB3 /* crypt_find_cipher_id.c in Sources */, - 4873F43111A4E47B00B5DDB3 /* crypt_find_hash.c in Sources */, - 4873F43211A4E47B00B5DDB3 /* crypt_find_hash_any.c in Sources */, - 4873F43311A4E47B00B5DDB3 /* crypt_find_hash_id.c in Sources */, - 4873F43411A4E47B00B5DDB3 /* crypt_find_hash_oid.c in Sources */, - 4873F43511A4E47B00B5DDB3 /* crypt_find_prng.c in Sources */, - 4873F43711A4E47B00B5DDB3 /* crypt_hash_descriptor.c in Sources */, - 4873F43811A4E47B00B5DDB3 /* crypt_hash_is_valid.c in Sources */, - 4873F43911A4E47B00B5DDB3 /* crypt_ltc_mp_descriptor.c in Sources */, - 4873F43A11A4E47B00B5DDB3 /* crypt_mode_descriptor.c in Sources */, - 4873F43D11A4E47B00B5DDB3 /* crypt_register_cipher.c in Sources */, - 4873F43E11A4E47B00B5DDB3 /* crypt_register_hash.c in Sources */, - 4873F44011A4E47B00B5DDB3 /* crypt_unregister_cipher.c in Sources */, - 4873F44111A4E47B00B5DDB3 /* crypt_unregister_hash.c in Sources */, - 4873F44311A4E47B00B5DDB3 /* error_to_string.c in Sources */, - 4873F44611A4E47B00B5DDB3 /* zeromem.c in Sources */, - 4873F44711A4E47B00B5DDB3 /* cbc_decrypt.c in Sources */, - 4873F44811A4E47B00B5DDB3 /* cbc_descriptor.c in Sources */, - 4873F44911A4E47B00B5DDB3 /* cbc_done.c in Sources */, - 4873F44A11A4E47B00B5DDB3 /* cbc_encrypt.c in Sources */, - 4873F44B11A4E47B00B5DDB3 /* cbc_getiv.c in Sources */, - 4873F44C11A4E47B00B5DDB3 /* cbc_setiv.c in Sources */, - 4873F44D11A4E47B00B5DDB3 /* cbc_start.c in Sources */, - 4873F44E11A4E47B00B5DDB3 /* cfb_decrypt.c in Sources */, - 4873F44F11A4E47B00B5DDB3 /* cfb_descriptor.c in Sources */, - 4873F45011A4E47B00B5DDB3 /* cfb_done.c in Sources */, - 4873F45111A4E47B00B5DDB3 /* cfb_encrypt.c in Sources */, - 4873F45211A4E47B00B5DDB3 /* cfb_getiv.c in Sources */, - 4873F45311A4E47B00B5DDB3 /* cfb_setiv.c in Sources */, - 4873F45411A4E47B00B5DDB3 /* cfb_start.c in Sources */, - 4873F45511A4E47B00B5DDB3 /* ctr_decrypt.c in Sources */, - 4873F45611A4E47B00B5DDB3 /* ctr_descriptor.c in Sources */, - 4873F45711A4E47B00B5DDB3 /* ctr_done.c in Sources */, - 4873F45811A4E47B00B5DDB3 /* ctr_encrypt.c in Sources */, - 4873F45911A4E47B00B5DDB3 /* ctr_getiv.c in Sources */, - 4873F45A11A4E47B00B5DDB3 /* ctr_setiv.c in Sources */, - 4873F45B11A4E47B00B5DDB3 /* ctr_start.c in Sources */, - 4873F45C11A4E47B00B5DDB3 /* ctr_test.c in Sources */, - 4873F45D11A4E47B00B5DDB3 /* ecb_decrypt.c in Sources */, - 4873F45E11A4E47B00B5DDB3 /* ecb_descriptor.c in Sources */, - 4873F45F11A4E47B00B5DDB3 /* ecb_done.c in Sources */, - 4873F46011A4E47B00B5DDB3 /* ecb_encrypt.c in Sources */, - 4873F46111A4E47B00B5DDB3 /* ecb_start.c in Sources */, - 4873F47311A4E47B00B5DDB3 /* ofb_decrypt.c in Sources */, - 4873F47411A4E47B00B5DDB3 /* ofb_descriptor.c in Sources */, - 4873F47511A4E47B00B5DDB3 /* ofb_done.c in Sources */, - 4873F47611A4E47B00B5DDB3 /* ofb_encrypt.c in Sources */, - 4873F47711A4E47B00B5DDB3 /* ofb_getiv.c in Sources */, - 4873F47811A4E47B00B5DDB3 /* ofb_setiv.c in Sources */, - 4873F47911A4E47B00B5DDB3 /* ofb_start.c in Sources */, - 4873F47A11A4E47B00B5DDB3 /* rc4_stream.c in Sources */, - 4873F47B11A4E47B00B5DDB3 /* unimplemented.c in Sources */, - 4873F47C11A4E47B00B5DDB3 /* xts_decrypt.c in Sources */, - 4873F47D11A4E47B00B5DDB3 /* xts_descriptor.c in Sources */, - 4873F47E11A4E47B00B5DDB3 /* xts_done.c in Sources */, - 4873F47F11A4E47B00B5DDB3 /* xts_encrypt.c in Sources */, - 4873F48011A4E47B00B5DDB3 /* xts_init.c in Sources */, - 4873F48111A4E47B00B5DDB3 /* xts_mult_x.c in Sources */, - 4873F48211A4E47B00B5DDB3 /* xts_test.c in Sources */, - 4873F48311A4E47B00B5DDB3 /* ansi923pad.c in Sources */, - 4873F48511A4E47B00B5DDB3 /* iso10126pad.c in Sources */, - 4873F48711A4E47B00B5DDB3 /* nopad.c in Sources */, - 4873F48911A4E47B00B5DDB3 /* pkcs7pad.c in Sources */, + 48067F871362405D005DDEBC /* CommonCryptoAESShoefly.c in Sources */, 489D982E11A4E8C20004DB89 /* ccdebug.c in Sources */, 4836A43211A5CB4700862178 /* CommonCryptor.c in Sources */, 4836A43511A5CB4700862178 /* CommonHMAC.c in Sources */, 4836A43611A5CB4700862178 /* CommonKeyDerivation.c in Sources */, 4836A43811A5CB4700862178 /* CommonSymmetricKeywrap.c in Sources */, 48096B2311A5EF900043F67F /* CommonDigest.c in Sources */, - 48D5637111A652EB008EBBBF /* aescrypt.c in Sources */, - 48D5637211A652EB008EBBBF /* aeskey.c in Sources */, - 48D5637311A652EB008EBBBF /* aestab.c in Sources */, - 48D5637511A652EB008EBBBF /* ccNewGladman.c in Sources */, - 48D5638611A65316008EBBBF /* AES.c in Sources */, - 48D5638911A65316008EBBBF /* AES.s in Sources */, - 48D5638B11A65316008EBBBF /* DecryptCBC.s in Sources */, - 48D5638C11A65316008EBBBF /* EncryptCBC.s in Sources */, - 485A566C11AE4BB2003DDC41 /* aesedp.c in Sources */, - 48161AFF11AF011B009A14CE /* AES.s in Sources */, - 48161B0011AF0123009A14CE /* aes_crypt_hw.s in Sources */, - 48161B0111AF0124009A14CE /* aes_key_hw.s in Sources */, - 48161B0211AF0124009A14CE /* aes_modes_asm.s in Sources */, - 48161B0311AF0125009A14CE /* aes_modes_hw.s in Sources */, - 4862F09911BDA1D300946BBE /* skein_ltc.c in Sources */, - 4862F0AC11BDA27200946BBE /* skein.c in Sources */, - 4862F0B011BDA27200946BBE /* skein_dropin.c in Sources */, - 4862F0B211BDA27200946BBE /* skein_debug.c in Sources */, - 4862F0B311BDA27200946BBE /* skein_block.c in Sources */, - 4862F0B511BDA27200946BBE /* SHA3api_ref.c in Sources */, - 12FA0DB211F7964700917A4E /* CommonRandom.c in Sources */, - 12B5D56D11FF437500626A60 /* aesxts.c in Sources */, - 12B5D56E11FF437A00626A60 /* aesxts_asm.s in Sources */, - 122ADC45121320D70027F302 /* sha256_nossse3.s in Sources */, - 122ADC46121320D70027F302 /* sha256.s in Sources */, - 1249340812270E8900F9C9E1 /* cfb8_decrypt.c in Sources */, - 1249340912270E8900F9C9E1 /* cfb8_descriptor.c in Sources */, - 1249340A12270E8900F9C9E1 /* cfb8_done.c in Sources */, - 1249340B12270E8900F9C9E1 /* cfb8_encrypt.c in Sources */, - 1249340C12270E8900F9C9E1 /* cfb8_getiv.c in Sources */, - 1249340D12270E8900F9C9E1 /* cfb8_setiv.c in Sources */, - 1249340E12270E8900F9C9E1 /* cfb8_start.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 125B794E11FF923D008C1AD3 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 125B796711FF92FC008C1AD3 /* crypto.c in Sources */, - 125B796811FF92FC008C1AD3 /* hexString.c in Sources */, - 125B796911FF92FC008C1AD3 /* printByteBuffer.c in Sources */, - 125B796A11FF92FC008C1AD3 /* xtsTestVectors.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 128881621203673C0050B2E9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 12CC5DDA120373D1001B4FCE /* CBCTest.c in Sources */, - 480C9AD712077BCF002EC023 /* byteBuffer.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 48F7F2D912B2EF6000AF4587 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 48F7F2DC12B2EF6000AF4587 /* md2_dgst.c in Sources */, - 48F7F2DD12B2EF6000AF4587 /* md4_dgst.c in Sources */, - 48F7F2DE12B2EF6000AF4587 /* md5_dgst.c in Sources */, - 48F7F2DF12B2EF6000AF4587 /* sha1.c in Sources */, - 48F7F2E012B2EF6000AF4587 /* sha2.c in Sources */, - 48F7F2E112B2EF6000AF4587 /* set_key.c in Sources */, - 48F7F2E212B2EF6000AF4587 /* opensslDES.c in Sources */, - 48F7F2E312B2EF6000AF4587 /* des_enc.c in Sources */, - 48F7F2E412B2EF6000AF4587 /* c_ecb.c in Sources */, - 48F7F2E512B2EF6000AF4587 /* c_enc.c in Sources */, - 48F7F2E612B2EF6000AF4587 /* c_skey.c in Sources */, - 48F7F2E712B2EF6000AF4587 /* ccCast.c in Sources */, - 48F7F2E812B2EF6000AF4587 /* ccRC2.c in Sources */, - 48F7F2E912B2EF6000AF4587 /* rc2.c in Sources */, - 48F7F2EA12B2EF6000AF4587 /* cast5.c in Sources */, - 48F7F2EB12B2EF6000AF4587 /* des.c in Sources */, - 48F7F2EC12B2EF6000AF4587 /* rc2.c in Sources */, - 48F7F2ED12B2EF6000AF4587 /* rc4_enc.c in Sources */, - 48F7F2EE12B2EF6000AF4587 /* rc4_skey.c in Sources */, - 48F7F2EF12B2EF6000AF4587 /* rc5.c in Sources */, - 48F7F2F012B2EF6000AF4587 /* hash_file.c in Sources */, - 48F7F2F112B2EF6000AF4587 /* hash_filehandle.c in Sources */, - 48F7F2F212B2EF6000AF4587 /* hash_memory.c in Sources */, - 48F7F2F312B2EF6000AF4587 /* hash_memory_multi.c in Sources */, - 48F7F2F412B2EF6000AF4587 /* md2.c in Sources */, - 48F7F2F512B2EF6000AF4587 /* md4.c in Sources */, - 48F7F2F612B2EF6000AF4587 /* md5.c in Sources */, - 48F7F2F712B2EF6000AF4587 /* rmd128.c in Sources */, - 48F7F2F812B2EF6000AF4587 /* rmd160.c in Sources */, - 48F7F2F912B2EF6000AF4587 /* rmd256.c in Sources */, - 48F7F2FA12B2EF6000AF4587 /* rmd320.c in Sources */, - 48F7F2FB12B2EF6000AF4587 /* sha1.c in Sources */, - 48F7F2FC12B2EF6000AF4587 /* sha256.c in Sources */, - 48F7F2FD12B2EF6000AF4587 /* sha512.c in Sources */, - 48F7F2FE12B2EF6000AF4587 /* crypt.c in Sources */, - 48F7F2FF12B2EF6000AF4587 /* crypt_argchk.c in Sources */, - 48F7F30012B2EF6000AF4587 /* crypt_cipher_descriptor.c in Sources */, - 48F7F30112B2EF6000AF4587 /* crypt_cipher_is_valid.c in Sources */, - 48F7F30212B2EF6000AF4587 /* crypt_find_cipher.c in Sources */, - 48F7F30312B2EF6000AF4587 /* crypt_find_cipher_any.c in Sources */, - 48F7F30412B2EF6000AF4587 /* crypt_find_cipher_id.c in Sources */, - 48F7F30512B2EF6000AF4587 /* crypt_find_hash.c in Sources */, - 48F7F30612B2EF6000AF4587 /* crypt_find_hash_any.c in Sources */, - 48F7F30712B2EF6000AF4587 /* crypt_find_hash_id.c in Sources */, - 48F7F30812B2EF6000AF4587 /* crypt_find_hash_oid.c in Sources */, - 48F7F30912B2EF6000AF4587 /* crypt_find_prng.c in Sources */, - 48F7F30A12B2EF6000AF4587 /* crypt_hash_descriptor.c in Sources */, - 48F7F30B12B2EF6000AF4587 /* crypt_hash_is_valid.c in Sources */, - 48F7F30C12B2EF6000AF4587 /* crypt_ltc_mp_descriptor.c in Sources */, - 48F7F30D12B2EF6000AF4587 /* crypt_mode_descriptor.c in Sources */, - 48F7F30E12B2EF6000AF4587 /* crypt_register_cipher.c in Sources */, - 48F7F30F12B2EF6000AF4587 /* crypt_register_hash.c in Sources */, - 48F7F31012B2EF6000AF4587 /* crypt_unregister_cipher.c in Sources */, - 48F7F31112B2EF6000AF4587 /* crypt_unregister_hash.c in Sources */, - 48F7F31212B2EF6000AF4587 /* error_to_string.c in Sources */, - 48F7F31312B2EF6000AF4587 /* zeromem.c in Sources */, - 48F7F31412B2EF6000AF4587 /* cbc_decrypt.c in Sources */, - 48F7F31512B2EF6000AF4587 /* cbc_descriptor.c in Sources */, - 48F7F31612B2EF6000AF4587 /* cbc_done.c in Sources */, - 48F7F31712B2EF6000AF4587 /* cbc_encrypt.c in Sources */, - 48F7F31812B2EF6000AF4587 /* cbc_getiv.c in Sources */, - 48F7F31912B2EF6000AF4587 /* cbc_setiv.c in Sources */, - 48F7F31A12B2EF6000AF4587 /* cbc_start.c in Sources */, - 48F7F31B12B2EF6000AF4587 /* cfb_decrypt.c in Sources */, - 48F7F31C12B2EF6000AF4587 /* cfb_descriptor.c in Sources */, - 48F7F31D12B2EF6000AF4587 /* cfb_done.c in Sources */, - 48F7F31E12B2EF6000AF4587 /* cfb_encrypt.c in Sources */, - 48F7F31F12B2EF6000AF4587 /* cfb_getiv.c in Sources */, - 48F7F32012B2EF6000AF4587 /* cfb_setiv.c in Sources */, - 48F7F32112B2EF6000AF4587 /* cfb_start.c in Sources */, - 48F7F32212B2EF6000AF4587 /* ctr_decrypt.c in Sources */, - 48F7F32312B2EF6000AF4587 /* ctr_descriptor.c in Sources */, - 48F7F32412B2EF6000AF4587 /* ctr_done.c in Sources */, - 48F7F32512B2EF6000AF4587 /* ctr_encrypt.c in Sources */, - 48F7F32612B2EF6000AF4587 /* ctr_getiv.c in Sources */, - 48F7F32712B2EF6000AF4587 /* ctr_setiv.c in Sources */, - 48F7F32812B2EF6000AF4587 /* ctr_start.c in Sources */, - 48F7F32912B2EF6000AF4587 /* ctr_test.c in Sources */, - 48F7F32A12B2EF6000AF4587 /* ecb_decrypt.c in Sources */, - 48F7F32B12B2EF6000AF4587 /* ecb_descriptor.c in Sources */, - 48F7F32C12B2EF6000AF4587 /* ecb_done.c in Sources */, - 48F7F32D12B2EF6000AF4587 /* ecb_encrypt.c in Sources */, - 48F7F32E12B2EF6000AF4587 /* ecb_start.c in Sources */, - 48F7F32F12B2EF6000AF4587 /* ofb_decrypt.c in Sources */, - 48F7F33012B2EF6000AF4587 /* ofb_descriptor.c in Sources */, - 48F7F33112B2EF6000AF4587 /* ofb_done.c in Sources */, - 48F7F33212B2EF6000AF4587 /* ofb_encrypt.c in Sources */, - 48F7F33312B2EF6000AF4587 /* ofb_getiv.c in Sources */, - 48F7F33412B2EF6000AF4587 /* ofb_setiv.c in Sources */, - 48F7F33512B2EF6000AF4587 /* ofb_start.c in Sources */, - 48F7F33612B2EF6000AF4587 /* rc4_stream.c in Sources */, - 48F7F33712B2EF6000AF4587 /* unimplemented.c in Sources */, - 48F7F33812B2EF6000AF4587 /* xts_decrypt.c in Sources */, - 48F7F33912B2EF6000AF4587 /* xts_descriptor.c in Sources */, - 48F7F33A12B2EF6000AF4587 /* xts_done.c in Sources */, - 48F7F33B12B2EF6000AF4587 /* xts_encrypt.c in Sources */, - 48F7F33C12B2EF6000AF4587 /* xts_init.c in Sources */, - 48F7F33D12B2EF6000AF4587 /* xts_mult_x.c in Sources */, - 48F7F33E12B2EF6000AF4587 /* xts_test.c in Sources */, - 48F7F33F12B2EF6000AF4587 /* ansi923pad.c in Sources */, - 48F7F34012B2EF6000AF4587 /* iso10126pad.c in Sources */, - 48F7F34112B2EF6000AF4587 /* nopad.c in Sources */, - 48F7F34212B2EF6000AF4587 /* pkcs7pad.c in Sources */, - 48F7F34312B2EF6000AF4587 /* ccdebug.c in Sources */, - 48F7F34412B2EF6000AF4587 /* CommonCryptor.c in Sources */, - 48F7F34512B2EF6000AF4587 /* CommonHMAC.c in Sources */, - 48F7F34612B2EF6000AF4587 /* CommonKeyDerivation.c in Sources */, - 48F7F34712B2EF6000AF4587 /* CommonSymmetricKeywrap.c in Sources */, - 48F7F34812B2EF6000AF4587 /* CommonDigest.c in Sources */, - 48F7F34912B2EF6000AF4587 /* aescrypt.c in Sources */, - 48F7F34A12B2EF6000AF4587 /* aeskey.c in Sources */, - 48F7F34B12B2EF6000AF4587 /* aestab.c in Sources */, - 48F7F34C12B2EF6000AF4587 /* ccNewGladman.c in Sources */, - 48F7F34D12B2EF6000AF4587 /* AES.c in Sources */, - 48F7F34E12B2EF6000AF4587 /* AES.s in Sources */, - 48F7F34F12B2EF6000AF4587 /* DecryptCBC.s in Sources */, - 48F7F35012B2EF6000AF4587 /* EncryptCBC.s in Sources */, - 48F7F35712B2EF6000AF4587 /* skein_ltc.c in Sources */, - 48F7F35812B2EF6000AF4587 /* skein.c in Sources */, - 48F7F35912B2EF6000AF4587 /* skein_dropin.c in Sources */, - 48F7F35A12B2EF6000AF4587 /* skein_debug.c in Sources */, - 48F7F35B12B2EF6000AF4587 /* skein_block.c in Sources */, - 48F7F35C12B2EF6000AF4587 /* SHA3api_ref.c in Sources */, - 48F7F35D12B2EF6000AF4587 /* CommonRandom.c in Sources */, - 48F7F36212B2EF6000AF4587 /* cfb8_decrypt.c in Sources */, - 48F7F36312B2EF6000AF4587 /* cfb8_descriptor.c in Sources */, - 48F7F36412B2EF6000AF4587 /* cfb8_done.c in Sources */, - 48F7F36512B2EF6000AF4587 /* cfb8_encrypt.c in Sources */, - 48F7F36612B2EF6000AF4587 /* cfb8_getiv.c in Sources */, - 48F7F36712B2EF6000AF4587 /* cfb8_setiv.c in Sources */, - 48F7F36812B2EF6000AF4587 /* cfb8_start.c in Sources */, - 48F7F37A12B2F05A00AF4587 /* aes.c in Sources */, - 48F7F37B12B2F05A00AF4587 /* aes_tab.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 5D735E4410FCDC04001AAD1E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5D113BE01106452100B412A2 /* CommonCryptoUnitTests.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 5DAD82C91279DEF900240B9A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5DAD82CF1279DF2B00240B9A /* DigestTest.mm in Sources */, - 5DAD82D01279DF2B00240B9A /* EncryptionTest.mm in Sources */, - 5DAD82D11279DF2B00240B9A /* HMACTest.mm in Sources */, - 5DAD82D21279DF2B00240B9A /* RandomNumberService.mm in Sources */, - 5DAD82D31279DF2B00240B9A /* PBKDFTest.mm in Sources */, - 5DAD82D41279DF2B00240B9A /* SymmetricWrapTest.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 5DAD83961279F1EC00240B9A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5DAD83AF1279F4C400240B9A /* main.mm in Sources */, + 48B4651D1284907600311799 /* CommonRSACryptor.c in Sources */, + 48D076D4130B2A9C0052D1AC /* CommonDH.c in Sources */, + 48D076D5130B2A9C0052D1AC /* CommonECCryptor.c in Sources */, + 48A5CBA6131EE096002A6E85 /* CommonGCMCryptor.c in Sources */, + 485FED57131475A400FF0F82 /* CommonBigNum.c in Sources */, + 48AC47CF1381EFDC00F584F5 /* byteBuffer.c in Sources */, + 48FC4BD81395ACE600DA4760 /* CommonCryptoCASTShoefly.c in Sources */, + 489F2442141AA3D0005E80FD /* CommonCMAC.c in Sources */, + 48F5355314902894000D2D1F /* CommonRandom.c in Sources */, + 489EECB4149809A800B44D5A /* DER_CertCrl.c in Sources */, + 489EECBA149809A800B44D5A /* DER_Decode.c in Sources */, + 489EECC0149809A800B44D5A /* DER_Digest.c in Sources */, + 489EECC6149809A800B44D5A /* DER_Encode.c in Sources */, + 489EECCC149809A800B44D5A /* DER_Keys.c in Sources */, + 489EECD8149809A800B44D5A /* oids.c in Sources */, + 489E06F914B7AB0900B0A282 /* corecryptoSymmetricBridge.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 48165D30125AC5D50015A267 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 48165D78125AC5D50015A267 /* ccdebug.c in Sources */, + 48165D79125AC5D50015A267 /* CommonCryptor.c in Sources */, + 48165D7A125AC5D50015A267 /* CommonHMAC.c in Sources */, + 48165D7B125AC5D50015A267 /* CommonKeyDerivation.c in Sources */, + 48165D7C125AC5D50015A267 /* CommonSymmetricKeywrap.c in Sources */, + 48165D7D125AC5D50015A267 /* CommonDigest.c in Sources */, + 48685587127B641800B88D39 /* CommonCryptoAESShoefly.c in Sources */, + 48B4651E1284907600311799 /* CommonRSACryptor.c in Sources */, + 48D076D0130B2A9C0052D1AC /* CommonDH.c in Sources */, + 48D076D1130B2A9C0052D1AC /* CommonECCryptor.c in Sources */, + 48A5CBA2131EE096002A6E85 /* CommonGCMCryptor.c in Sources */, + 485FED55131475A400FF0F82 /* CommonBigNum.c in Sources */, + 48AC47D11381EFDC00F584F5 /* byteBuffer.c in Sources */, + 489F2444141AA3D0005E80FD /* CommonCMAC.c in Sources */, + 48F5355414902894000D2D1F /* CommonRandom.c in Sources */, + 489EECB5149809A800B44D5A /* DER_CertCrl.c in Sources */, + 489EECBB149809A800B44D5A /* DER_Decode.c in Sources */, + 489EECC1149809A800B44D5A /* DER_Digest.c in Sources */, + 489EECC7149809A800B44D5A /* DER_Encode.c in Sources */, + 489EECCD149809A800B44D5A /* DER_Keys.c in Sources */, + 489EECD9149809A800B44D5A /* oids.c in Sources */, + 489E06FA14B7AB0900B0A282 /* corecryptoSymmetricBridge.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 48165E13125AC5F20015A267 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 48165E5B125AC5F20015A267 /* ccdebug.c in Sources */, + 48165E5C125AC5F20015A267 /* CommonCryptor.c in Sources */, + 48165E5D125AC5F20015A267 /* CommonHMAC.c in Sources */, + 48165E5E125AC5F20015A267 /* CommonKeyDerivation.c in Sources */, + 48165E5F125AC5F20015A267 /* CommonSymmetricKeywrap.c in Sources */, + 48165E60125AC5F20015A267 /* CommonDigest.c in Sources */, + 48B4651F1284907600311799 /* CommonRSACryptor.c in Sources */, + 48D076D8130B2A9C0052D1AC /* CommonDH.c in Sources */, + 48D076D9130B2A9C0052D1AC /* CommonECCryptor.c in Sources */, + 48A5CBA8131EE096002A6E85 /* CommonGCMCryptor.c in Sources */, + 485FED51131475A400FF0F82 /* CommonBigNum.c in Sources */, + 4CF7820B1339B543004A56DF /* CommonCryptoAESShoefly.c in Sources */, + 48AC47D21381EFDC00F584F5 /* byteBuffer.c in Sources */, + 489F2445141AA3D0005E80FD /* CommonCMAC.c in Sources */, + 489EECB6149809A800B44D5A /* DER_CertCrl.c in Sources */, + 489EECBC149809A800B44D5A /* DER_Decode.c in Sources */, + 489EECC2149809A800B44D5A /* DER_Digest.c in Sources */, + 489EECC8149809A800B44D5A /* DER_Encode.c in Sources */, + 489EECCE149809A800B44D5A /* DER_Keys.c in Sources */, + 489EECDA149809A800B44D5A /* oids.c in Sources */, + 489E06FB14B7AB0900B0A282 /* corecryptoSymmetricBridge.c in Sources */, + 5DB80D3E14FC5CB3002C9A03 /* CommonRandom.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4823B0DC14C10064008F689F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4823B10914C1017C008F689F /* testbyteBuffer.c in Sources */, + 4823B10214C1016B008F689F /* testenv.c in Sources */, + 4823B10414C1016B008F689F /* testlist.c in Sources */, + 4823B10714C1016B008F689F /* testmore.c in Sources */, + 4823B10014C10155008F689F /* main.c in Sources */, + 4823B0EA14C1013F008F689F /* CCCryptorTestFuncs.c in Sources */, + 4823B0EC14C1013F008F689F /* CommonBaseEncoding.c in Sources */, + 4823B0ED14C1013F008F689F /* CommonBigNum.c in Sources */, + 4823B0EE14C1013F008F689F /* CommonCMac.c in Sources */, + 4823B0EF14C1013F008F689F /* CommonCryptoCTSPadding.c in Sources */, + 4823B0F014C1013F008F689F /* CommonCryptoSymCBC.c in Sources */, + 4823B0F114C1013F008F689F /* CommonCryptoSymGCM.c in Sources */, + 4823B0F214C1013F008F689F /* CommonCryptoSymmetricWrap.c in Sources */, + 4823B0F314C1013F008F689F /* CommonCryptoSymOFB.c in Sources */, + 4823B0F414C1013F008F689F /* CommonCryptoSymOffset.c in Sources */, + 4823B0F514C1013F008F689F /* CommonCryptoSymRC2.c in Sources */, + 4823B0F614C1013F008F689F /* CommonCryptoSymRegression.c in Sources */, + 4823B0F714C1013F008F689F /* CommonCryptoSymXTS.c in Sources */, + 4823B0F814C1013F008F689F /* CommonCryptoSymZeroLength.c in Sources */, + 4823B0F914C1013F008F689F /* CommonDigest.c in Sources */, + 4823B0FA14C1013F008F689F /* CommonEC.c in Sources */, + 4823B0FB14C1013F008F689F /* CommonHMacClone.c in Sources */, + 4823B0FC14C1013F008F689F /* CommonRandom.c in Sources */, + 4823B0FD14C1013F008F689F /* CommonRSA.c in Sources */, + 4823B0FF14C1013F008F689F /* CryptorPadFailure.c in Sources */, + 486BE17D14E6019B00346AC4 /* CommonCryptoReset.c in Sources */, + 48CCD26514F6F189002B6043 /* CommonBigDigest.c in Sources */, + 48C5CB9214FD747500F4472E /* CommonDHtest.c in Sources */, + 4852C24A1505F8CD00676BCC /* CommonCryptoSymCFB.c in Sources */, + 4854BAD6152177CC007B5B08 /* CommonCryptoSymCTR.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4834A85714F47B6200438E3D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 48CCD26614F6F1E1002B6043 /* CommonBigDigest.c in Sources */, + 4834A85814F47B6200438E3D /* testbyteBuffer.c in Sources */, + 4834A85C14F47B6200438E3D /* testenv.c in Sources */, + 4834A85E14F47B6200438E3D /* testlist.c in Sources */, + 4834A86114F47B6200438E3D /* testmore.c in Sources */, + 4834A86314F47B6200438E3D /* main.c in Sources */, + 4834A86414F47B6200438E3D /* CCCryptorTestFuncs.c in Sources */, + 4834A86614F47B6200438E3D /* CommonBaseEncoding.c in Sources */, + 4834A86714F47B6200438E3D /* CommonBigNum.c in Sources */, + 4834A86814F47B6200438E3D /* CommonCMac.c in Sources */, + 4834A86914F47B6200438E3D /* CommonCryptoCTSPadding.c in Sources */, + 4834A86A14F47B6200438E3D /* CommonCryptoSymCBC.c in Sources */, + 4834A86B14F47B6200438E3D /* CommonCryptoSymGCM.c in Sources */, + 4834A86C14F47B6200438E3D /* CommonCryptoSymmetricWrap.c in Sources */, + 4834A86D14F47B6200438E3D /* CommonCryptoSymOFB.c in Sources */, + 4834A86E14F47B6200438E3D /* CommonCryptoSymOffset.c in Sources */, + 4834A86F14F47B6200438E3D /* CommonCryptoSymRC2.c in Sources */, + 4834A87014F47B6200438E3D /* CommonCryptoSymRegression.c in Sources */, + 4834A87114F47B6200438E3D /* CommonCryptoSymXTS.c in Sources */, + 4834A87214F47B6200438E3D /* CommonCryptoSymZeroLength.c in Sources */, + 4834A87314F47B6200438E3D /* CommonDigest.c in Sources */, + 4834A87414F47B6200438E3D /* CommonEC.c in Sources */, + 4834A87514F47B6200438E3D /* CommonHMacClone.c in Sources */, + 4834A87614F47B6200438E3D /* CommonRandom.c in Sources */, + 4834A87714F47B6200438E3D /* CommonRSA.c in Sources */, + 4834A87814F47B6200438E3D /* CryptorPadFailure.c in Sources */, + 4834A87914F47B6200438E3D /* CommonCryptoReset.c in Sources */, + 48C5CB9314FD747500F4472E /* CommonDHtest.c in Sources */, + 4852C24B1505F8CD00676BCC /* CommonCryptoSymCFB.c in Sources */, + 4854BAD7152177CC007B5B08 /* CommonCryptoSymCTR.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ @@ -2554,50 +1583,35 @@ 0511C4630A3785340028BFC3 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 05CE94290A3784D4007C91D6 /* Copy Open Source Docs */; targetProxy = 0511C4620A3785340028BFC3 /* PBXContainerItemProxy */; }; - 1228ADD712037B1000B83BF9 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 054BBEBD05F6A97700344873 /* commonCrypto */; - targetProxy = 1228ADD612037B1000B83BF9 /* PBXContainerItemProxy */; - }; - 12F60BEA12015A2600D17AF3 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 054BBEBD05F6A97700344873 /* commonCrypto */; - targetProxy = 12F60BE912015A2600D17AF3 /* PBXContainerItemProxy */; + 4823B10D14C101CC008F689F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 054BBEBD05F6A97700344873 /* libCommonCryptoMacOSX */; + targetProxy = 4823B10C14C101CC008F689F /* PBXContainerItemProxy */; + }; + 4834A88414F47CA300438E3D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 48165CD7125AC5D50015A267 /* libCommonCryptoMacIOS */; + targetProxy = 4834A88314F47CA300438E3D /* PBXContainerItemProxy */; + }; + 4C58A28D13281C2100A17BAC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 48165CD7125AC5D50015A267 /* libCommonCryptoMacIOS */; + targetProxy = 4C58A28C13281C2100A17BAC /* PBXContainerItemProxy */; + }; + 4CA675191332C17900C45A71 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 48165DBA125AC5F20015A267 /* libCommonCryptoMacIOSSim */; + targetProxy = 4CA675181332C17900C45A71 /* PBXContainerItemProxy */; }; 5D936FFB110E7FFF006855B0 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 054BBEBD05F6A97700344873 /* commonCrypto */; + target = 054BBEBD05F6A97700344873 /* libCommonCryptoMacOSX */; targetProxy = 5D936FFA110E7FFF006855B0 /* PBXContainerItemProxy */; }; - 5DAD82DC1279DF6100240B9A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5DAD82CB1279DEF900240B9A /* UnitTestLibrary */; - targetProxy = 5DAD82DB1279DF6100240B9A /* PBXContainerItemProxy */; - }; - 5DAD839E1279F22000240B9A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5DAD82CB1279DEF900240B9A /* UnitTestLibrary */; - targetProxy = 5DAD839D1279F22000240B9A /* PBXContainerItemProxy */; - }; - 5DAD83D21279F6D500240B9A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5DAD83981279F1EC00240B9A /* CommonCryptoTestTool */; - targetProxy = 5DAD83D11279F6D500240B9A /* PBXContainerItemProxy */; - }; - 5DC8771110FFB7510012A390 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5D735E4710FCDC04001AAD1E /* CommonCryptoUnitTest */; - targetProxy = 5DC8771010FFB7510012A390 /* PBXContainerItemProxy */; - }; - FC129BED116AED0500D618D5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 054BBEBD05F6A97700344873 /* commonCrypto */; - targetProxy = FC129BEC116AED0500D618D5 /* PBXContainerItemProxy */; - }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ 05CE94320A37850A007C91D6 /* Release */ = { isa = XCBuildConfiguration; @@ -2607,87 +1621,23 @@ PRODUCT_NAME = "Copy Open Source Docs"; ZERO_LINK = NO; }; name = Release; }; - 125B795311FF923E008C1AD3 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12A1ADD71207419E000C30A4 /* CommonCrypto_localtest.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - INSTALL_PATH = /usr/local/bin; - ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; - PRODUCT_NAME = XTStest; - ZERO_LINK = NO; - }; - name = Release; - }; - 125B795411FF923E008C1AD3 /* Development */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12A1ADD71207419E000C30A4 /* CommonCrypto_localtest.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - INSTALL_PATH = /usr/local/bin; - ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; - PRODUCT_NAME = XTStest; - }; - name = Development; - }; - 128881671203673D0050B2E9 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12A1ADD71207419E000C30A4 /* CommonCrypto_localtest.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - INSTALL_PATH = /usr/local/bin; - PREBINDING = NO; - PRODUCT_NAME = CBCTest; - ZERO_LINK = NO; - }; - name = Release; - }; - 128881681203673D0050B2E9 /* Development */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12A1ADD71207419E000C30A4 /* CommonCrypto_localtest.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - INSTALL_PATH = /usr/local/bin; - PREBINDING = NO; - PRODUCT_NAME = CBCTest; - }; - name = Development; - }; - 12F25D8511F7BF8A0036BC8E /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Development; - }; - 12F25D8611F7BF8A0036BC8E /* Development */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12FA10D311F7AB5000917A4E /* CommonCrypto_development.xcconfig */; + 12F25D8511F7BF8A0036BC8E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + INFOPLIST_OUTPUT_FORMAT = binary; + SDKROOT = iphoneos.internal; + USER_HEADER_SEARCH_PATHS = "/Users/murf/BuildProducts/Build/Products/Debug/usr/local/include /Users/murf/BuildProducts/Build/Products/Debug/usr/include"; + }; + name = Debug; + }; + 12F25D8611F7BF8A0036BC8E /* Debug */ = { + isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; OTHER_REZFLAGS = ""; @@ -2697,187 +1647,271 @@ "-Wmost", "-Wno-four-char-constants", "-Wno-unknown-pragmas", ); }; - name = Development; + name = Debug; }; - 12F25D8711F7BF8A0036BC8E /* Development */ = { + 12F25D8711F7BF8A0036BC8E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 12FA10D111F7AAE400917A4E /* CommonCrypto_umbrellaMember_development.xcconfig */; + baseConfigurationReference = 486130EF126681290036EA02 /* CC_MacOSXClient_development.xcconfig */; buildSettings = { - EXPORTED_SYMBOLS_FILE = Source/CommonCrypto.exp; + EXPORTED_SYMBOLS_FILE = "$(SRCROOT)/Source/Exports/CommonCrypto.exp"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYMROOT)\"/**", + "\"$(SRCROOT)/../../BuildProducts/Products/Products/Debug\"", + /usr/lib/system, + ); OTHER_LDFLAGS = ""; SDKROOT = ""; }; - name = Development; + name = Debug; }; - 12F25D8811F7BF8A0036BC8E /* Development */ = { + 12F25D8811F7BF8A0036BC8E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; PRODUCT_NAME = "Copy Open Source Docs"; ZERO_LINK = NO; }; - name = Development; - }; - 12F25D8911F7BF8A0036BC8E /* Development */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12790C7511F7C4BA0044EFE5 /* CommonCrypto_unittest_development.xcconfig */; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(DEVELOPER_FRAMEWORKS_DIR)\"", - ); - GCC_ENABLE_OBJC_GC = supported; - LIBRARY_SEARCH_PATHS = ""; - }; - name = Development; - }; - 12F25D8A11F7BF8A0036BC8E /* Development */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12790C7511F7C4BA0044EFE5 /* CommonCrypto_unittest_development.xcconfig */; - buildSettings = { - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - PRODUCT_NAME = "Unit Test World"; - ZERO_LINK = NO; - }; - name = Development; - }; - 48F7F36B12B2EF6000AF4587 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12FA10D011F7AACE00917A4E /* CommonCrypto_umbrellaMember_deployment.xcconfig */; - buildSettings = { - EXPORTED_SYMBOLS_FILE = Source/CommonCrypto.exp; - OTHER_CFLAGS = ( - "-fstack-protector-all", - "-D__OPEN_SOURCE__", - "-Wstack-protector", - ); - OTHER_LDFLAGS = ""; - SDKROOT = ""; - }; - name = Release; - }; - 48F7F36C12B2EF6000AF4587 /* Development */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12FA10D111F7AAE400917A4E /* CommonCrypto_umbrellaMember_development.xcconfig */; - buildSettings = { - EXPORTED_SYMBOLS_FILE = Source/CommonCrypto.exp; - OTHER_CFLAGS = ( - "-fstack-protector-all", - "-D__OPEN_SOURCE__", - "-Wstack-protector", - ); - OTHER_LDFLAGS = ""; - SDKROOT = ""; - }; - name = Development; - }; - 5D735E4B10FCDC04001AAD1E /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12790C7411F7C4BA0044EFE5 /* CommonCrypto_unittest_deployment.xcconfig */; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(DEVELOPER_FRAMEWORKS_DIR)\"", - ); - GCC_ENABLE_OBJC_GC = supported; - LIBRARY_SEARCH_PATHS = ""; - }; - name = Release; - }; - 5DAD82CD1279DEFA00240B9A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12790C7411F7C4BA0044EFE5 /* CommonCrypto_unittest_deployment.xcconfig */; - buildSettings = { - GCC_ENABLE_OBJC_GC = supported; - }; - name = Release; - }; - 5DAD82CE1279DEFA00240B9A /* Development */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12790C7511F7C4BA0044EFE5 /* CommonCrypto_unittest_development.xcconfig */; - buildSettings = { - GCC_ENABLE_OBJC_GC = supported; - }; - name = Development; - }; - 5DAD839B1279F1ED00240B9A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12790C7411F7C4BA0044EFE5 /* CommonCrypto_unittest_deployment.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; - INSTALL_PATH = /usr/local/bin; - OTHER_LDFLAGS = ( - "-framework", - Foundation, - "-framework", - AppKit, - ); - PREBINDING = NO; - PRODUCT_NAME = CommonCryptoTestTool; - ZERO_LINK = NO; - }; - name = Release; - }; - 5DAD839C1279F1ED00240B9A /* Development */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12790C7511F7C4BA0044EFE5 /* CommonCrypto_unittest_development.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; - INSTALL_PATH = /usr/local/bin; - OTHER_LDFLAGS = ( - "-framework", - Foundation, - ); - PREBINDING = NO; - PRODUCT_NAME = CommonCryptoTestTool; - }; - name = Development; - }; - 5DC876F910FFB6BC0012A390 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12790C7411F7C4BA0044EFE5 /* CommonCrypto_unittest_deployment.xcconfig */; - buildSettings = { - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - PRODUCT_NAME = "Unit Test World"; - ZERO_LINK = NO; - }; - name = Release; - }; - C27AD07F0987FCDA001272E0 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 12FA10D011F7AACE00917A4E /* CommonCrypto_umbrellaMember_deployment.xcconfig */; - buildSettings = { - EXPORTED_SYMBOLS_FILE = Source/CommonCrypto.exp; + name = Debug; + }; + 48165DB7125AC5D50015A267 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 486130E8126681290036EA02 /* CC_iOSClient_deployment.xcconfig */; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; + EXPORTED_SYMBOLS_FILE = "$(SRCROOT)/Source/Exports/CommonCryptoIOS5.exp"; + GCC_ENABLE_CPP_EXCEPTIONS = YES; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = ""; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYMROOT)\"/**", + "\"$(SDKROOT)/usr/lib/system\"", + ); + ORDER_FILE = "$(SDKROOT)/AppleInternal/OrderFiles/libcommonCrypto.order"; + OTHER_LDFLAGS = ""; + SDKROOT = iphoneos.internal; + }; + name = Release; + }; + 48165DB8125AC5D50015A267 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 486130E9126681290036EA02 /* CC_iOSClient_development.xcconfig */; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; + EXPORTED_SYMBOLS_FILE = "$(SRCROOT)/Source/Exports/CommonCryptoIOS5.exp"; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = ""; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../BuildProducts/Release-iphoneos\"", + "\"$(SDKROOT)/usr/lib/system\"", + ); + ORDER_FILE = "$(SDKROOT)/AppleInternal/OrderFiles/libcommonCrypto.order"; + OTHER_LDFLAGS = ""; + SDKROOT = iphoneos.internal; + }; + name = Debug; + }; + 48165E9A125AC5F20015A267 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 486130EC126681290036EA02 /* CC_iOSSim_deployment.xcconfig */; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + DEAD_CODE_STRIPPING = NO; + EXPORTED_SYMBOLS_FILE = "$(SRCROOT)/Source/Exports/CommonCryptoIOS5.exp"; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = ""; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + LIBRARY_SEARCH_PATHS = ( + "\"$(SYMROOT)\"/**", + "\"$(SDKROOT)/usr/lib/system\"", + "\"$(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/lib/system\"", + ); + OTHER_LDFLAGS = "-lcorecrypto_sim"; + SDKROOT = iphoneos.internal; + VALID_ARCHS = "armv6 i386 x86_64"; + }; + name = Release; + }; + 48165E9B125AC5F20015A267 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 486130ED126681290036EA02 /* CC_iOSSim_development.xcconfig */; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + DEAD_CODE_STRIPPING = NO; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = ""; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SDKROOT)/usr/lib/system\"", + "\"$(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/lib/system\"", + ); + OTHER_LDFLAGS = "-lcorecrypto_sim"; + SDKROOT = iphoneos.internal; + }; + name = Debug; + }; + 4823B0E814C10064008F689F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = /usr/local/tests/CommonCrypto; + LIBRARY_SEARCH_PATHS = "$(CONFIGURATION_BUILD_DIR)"; + MACOSX_DEPLOYMENT_TARGET = 10.8; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = ""; + }; + name = Release; + }; + 4823B0E914C10064008F689F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = /usr/local/tests/CommonCrypto; + LIBRARY_SEARCH_PATHS = "$(CONFIGURATION_BUILD_DIR)"; + MACOSX_DEPLOYMENT_TARGET = 10.8; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = ""; + }; + name = Debug; + }; + 4834A87E14F47B6200438E3D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = ""; + PRODUCT_NAME = "CCRegression copy"; + SDKROOT = iphoneos.internal; + }; + name = Release; + }; + 4834A87F14F47B6200438E3D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = ""; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "CCRegression copy"; + SDKROOT = iphoneos.internal; + }; + name = Debug; + }; + 4C99FCB81326E14F0040AD38 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4C99FCB91326E14F0040AD38 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4CA675161332C16C00C45A71 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 486130EC126681290036EA02 /* CC_iOSSim_deployment.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4CA675171332C16C00C45A71 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 486130ED126681290036EA02 /* CC_iOSSim_development.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + C27AD07F0987FCDA001272E0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 486130EE126681290036EA02 /* CC_MacOSXClient_deployment.xcconfig */; + buildSettings = { + EXPORTED_SYMBOLS_FILE = "$(SRCROOT)/Source/Exports/CommonCrypto.exp"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYMROOT)\"/**", + "\"$(SRCROOT)/../../BuildProducts/Products/Products/Debug\"", + /usr/lib/system, + ); OTHER_LDFLAGS = ""; SDKROOT = ""; }; name = Release; }; C27AD08F0987FCDA001272E0 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 12FA10D211F7AB3E00917A4E /* CommonCrypto_deployment.xcconfig */; buildSettings = { COPY_PHASE_STRIP = YES; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; OTHER_REZFLAGS = ""; @@ -2893,10 +1927,15 @@ }; C27AD0930987FCDA001272E0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + INFOPLIST_OUTPUT_FORMAT = binary; + SDKROOT = iphoneos.internal; + USER_HEADER_SEARCH_PATHS = "/Users/murf/BuildProducts/Build/Products/Debug/usr/local/include /Users/murf/BuildProducts/Build/Products/Debug/usr/include"; }; name = Release; }; /* End XCBuildConfiguration section */ @@ -2903,104 +1942,95 @@ /* Begin XCConfigurationList section */ 05CE94300A37850A007C91D6 /* Build configuration list for PBXAggregateTarget "Copy Open Source Docs" */ = { isa = XCConfigurationList; buildConfigurations = ( 05CE94320A37850A007C91D6 /* Release */, - 12F25D8811F7BF8A0036BC8E /* Development */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 125B795711FF9279008C1AD3 /* Build configuration list for PBXNativeTarget "XTStest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 125B795311FF923E008C1AD3 /* Release */, - 125B795411FF923E008C1AD3 /* Development */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 128881691203675B0050B2E9 /* Build configuration list for PBXNativeTarget "CBCTest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 128881671203673D0050B2E9 /* Release */, - 128881681203673D0050B2E9 /* Development */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 48F7F36A12B2EF6000AF4587 /* Build configuration list for PBXNativeTarget "commonCryptoOpenSource" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 48F7F36B12B2EF6000AF4587 /* Release */, - 48F7F36C12B2EF6000AF4587 /* Development */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 5D735E4D10FCDC04001AAD1E /* Build configuration list for PBXNativeTarget "CommonCryptoUnitTest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 5D735E4B10FCDC04001AAD1E /* Release */, - 12F25D8911F7BF8A0036BC8E /* Development */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 5DAD82E61279DFA700240B9A /* Build configuration list for PBXNativeTarget "UnitTestLibrary" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 5DAD82CD1279DEFA00240B9A /* Release */, - 5DAD82CE1279DEFA00240B9A /* Development */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 5DAD83A01279F24B00240B9A /* Build configuration list for PBXNativeTarget "CommonCryptoTestTool" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 5DAD839B1279F1ED00240B9A /* Release */, - 5DAD839C1279F1ED00240B9A /* Development */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 5DC876FB10FFB6DA0012A390 /* Build configuration list for PBXAggregateTarget "Unit Test World" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 5DC876F910FFB6BC0012A390 /* Release */, - 12F25D8A11F7BF8A0036BC8E /* Development */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C27AD07D0987FCDA001272E0 /* Build configuration list for PBXNativeTarget "commonCrypto" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C27AD07F0987FCDA001272E0 /* Release */, - 12F25D8711F7BF8A0036BC8E /* Development */, + 12F25D8811F7BF8A0036BC8E /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 48165DB6125AC5D50015A267 /* Build configuration list for PBXNativeTarget "libCommonCryptoMacIOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 48165DB7125AC5D50015A267 /* Release */, + 48165DB8125AC5D50015A267 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 48165E99125AC5F20015A267 /* Build configuration list for PBXNativeTarget "libCommonCryptoMacIOSSim" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 48165E9A125AC5F20015A267 /* Release */, + 48165E9B125AC5F20015A267 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4823B0E714C10064008F689F /* Build configuration list for PBXNativeTarget "CCRegression" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4823B0E814C10064008F689F /* Release */, + 4823B0E914C10064008F689F /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4834A87D14F47B6200438E3D /* Build configuration list for PBXNativeTarget "CCRegressionIos" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4834A87E14F47B6200438E3D /* Release */, + 4834A87F14F47B6200438E3D /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4C99FCB71326E14F0040AD38 /* Build configuration list for PBXAggregateTarget "commonCryptoMacIOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4C99FCB81326E14F0040AD38 /* Release */, + 4C99FCB91326E14F0040AD38 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4CA675151332C16C00C45A71 /* Build configuration list for PBXAggregateTarget "CommonCrypto_Sim" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4CA675161332C16C00C45A71 /* Release */, + 4CA675171332C16C00C45A71 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C27AD07D0987FCDA001272E0 /* Build configuration list for PBXNativeTarget "libCommonCryptoMacOSX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C27AD07F0987FCDA001272E0 /* Release */, + 12F25D8711F7BF8A0036BC8E /* Debug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C27AD08D0987FCDA001272E0 /* Build configuration list for PBXAggregateTarget "world" */ = { isa = XCConfigurationList; buildConfigurations = ( C27AD08F0987FCDA001272E0 /* Release */, - 12F25D8611F7BF8A0036BC8E /* Development */, + 12F25D8611F7BF8A0036BC8E /* Debug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C27AD0910987FCDA001272E0 /* Build configuration list for PBXProject "CommonCrypto" */ = { isa = XCConfigurationList; buildConfigurations = ( C27AD0930987FCDA001272E0 /* Release */, - 12F25D8511F7BF8A0036BC8E /* Development */, + 12F25D8511F7BF8A0036BC8E /* Debug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 054BBEA605F6A8DE00344873 /* Project object */; } ADDED CommonCrypto.xcodeproj/project.xcworkspace/contents.xcworkspacedata Index: CommonCrypto.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + ADDED CommonCrypto.xcodeproj/project.xcworkspace/xcuserdata/jimmur.xcuserdatad/UserInterfaceState.xcuserstate Index: CommonCrypto.xcodeproj/project.xcworkspace/xcuserdata/jimmur.xcuserdatad/UserInterfaceState.xcuserstate ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/project.xcworkspace/xcuserdata/jimmur.xcuserdatad/UserInterfaceState.xcuserstate cannot compute difference between binary files ADDED CommonCrypto.xcodeproj/project.xcworkspace/xcuserdata/stripes.xcuserdatad/UserInterfaceState.xcuserstate Index: CommonCrypto.xcodeproj/project.xcworkspace/xcuserdata/stripes.xcuserdatad/UserInterfaceState.xcuserstate ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/project.xcworkspace/xcuserdata/stripes.xcuserdatad/UserInterfaceState.xcuserstate @@ -0,0 +1,12087 @@ + + + + + $archiver + NSKeyedArchiver + $objects + + $null + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 2 + + + CF$UID + 3 + + + CF$UID + 4 + + + CF$UID + 5 + + + CF$UID + 6 + + + NS.objects + + + CF$UID + 7 + + + CF$UID + 189 + + + CF$UID + 275 + + + CF$UID + 496 + + + CF$UID + 580 + + + + FE79318C-44C9-474C-AE48-2D54DF24FB3C + C0EB6D46-CA40-4273-BBB6-D70DA93459EB + FF0AEAD8-56E5-43F7-9BD9-6A8DE45B2FA1 + 86C9DD70-34EF-4367-9CF6-095B7923EAF8 + IDEWorkspaceDocument + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 8 + + + CF$UID + 9 + + + CF$UID + 10 + + + CF$UID + 11 + + + CF$UID + 12 + + + CF$UID + 13 + + + NS.objects + + + CF$UID + 2 + + + CF$UID + 14 + + + CF$UID + 16 + + + CF$UID + 12 + + + CF$UID + 17 + + + CF$UID + 188 + + + + IDEWorkspaceWindowControllerUniqueIdentifier + IDEOrderedWorkspaceTabControllers + IDEWindowToolbarIsVisible + IDEActiveWorkspaceTabController + IDEWorkspaceTabController_7F927AE8-22A4-4FB4-97A1-F7CAF85E217E + IDEWindowFrame + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 12 + + + + + $classes + + NSArray + NSObject + + $classname + NSArray + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 18 + + + CF$UID + 19 + + + CF$UID + 20 + + + CF$UID + 21 + + + CF$UID + 22 + + + CF$UID + 23 + + + CF$UID + 24 + + + CF$UID + 25 + + + NS.objects + + + CF$UID + 26 + + + CF$UID + 16 + + + CF$UID + 27 + + + CF$UID + 28 + + + CF$UID + 41 + + + CF$UID + 70 + + + CF$UID + 16 + + + CF$UID + 79 + + + + IDETabLabel + IDEShowNavigator + AssistantEditorsLayout + IDEWorkspaceTabControllerUtilityAreaSplitView + IDENavigatorArea + IDEWorkspaceTabControllerDesignAreaSplitView + IDEShowUtilities + IDEEditorArea + CommonDH.c + 0 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 30 + + + + DVTSplitViewItems + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 31 + + + CF$UID + 37 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 35 + + + + DVTIdentifier + DVTViewMagnitude + + 376 + + $classes + + NSDictionary + NSObject + + $classname + NSDictionary + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 38 + + + + 224 + + $classes + + NSMutableArray + NSArray + NSObject + + $classname + NSMutableArray + + + $classes + + NSMutableDictionary + NSDictionary + NSObject + + $classname + NSMutableDictionary + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 42 + + + CF$UID + 43 + + + CF$UID + 44 + + + NS.objects + + + CF$UID + 45 + + + CF$UID + 42 + + + CF$UID + 58 + + + + Xcode.IDEKit.Navigator.BatchFind + SelectedNavigator + Xcode.IDEKit.Navigator.Structure + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 46 + + + CF$UID + 47 + + + CF$UID + 48 + + + CF$UID + 49 + + + CF$UID + 50 + + + CF$UID + 51 + + + CF$UID + 52 + + + NS.objects + + + CF$UID + 27 + + + CF$UID + 16 + + + CF$UID + 34 + + + CF$UID + 53 + + + CF$UID + 54 + + + CF$UID + 27 + + + CF$UID + 56 + + + + IDEBatchFindNavigatorScrollPosition + IDEBatchFindNavigatorShowsOptions + IDEBatchFindNavigatorReplaceString + IDEBatchFindNavigatorFindString + IDEBatchFindNavigatorSelectedRowIndexes + IDEBatchFindNavigatorFindMode + IDEBatchFindNavigatorCollapsedGroups + diffie + + $class + + CF$UID + 55 + + NSRangeCount + 0 + + + $classes + + NSIndexSet + NSObject + + $classname + NSIndexSet + + + $class + + CF$UID + 57 + + NSRangeCount + 0 + + + $classes + + NSMutableIndexSet + NSIndexSet + NSObject + + $classname + NSMutableIndexSet + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 59 + + + CF$UID + 60 + + + CF$UID + 61 + + + CF$UID + 62 + + + CF$UID + 63 + + + CF$UID + 64 + + + CF$UID + 65 + + + NS.objects + + + CF$UID + 66 + + + CF$UID + 16 + + + CF$UID + 67 + + + CF$UID + 16 + + + CF$UID + 16 + + + CF$UID + 69 + + + CF$UID + 67 + + + + IDEVisibleRect + IDEUnsavedDocumentFilteringEnabled + IDENavigatorExpandedItemsBeforeFilteringSet + IDERecentDocumentFilteringEnabled + IDESCMStatusFilteringEnabled + IDESelectedObjects + IDEExpandedItemsSet + {{0, 0}, {259, 832}} + + $class + + CF$UID + 68 + + NS.objects + + + + $classes + + NSSet + NSObject + + $classname + NSSet + + + $class + + CF$UID + 15 + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 71 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 72 + + + CF$UID + 74 + + + CF$UID + 76 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 22 + + + CF$UID + 73 + + + + 260 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 25 + + + CF$UID + 75 + + + + 1140 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 77 + + + CF$UID + 78 + + + + IDEUtilitiesArea + 260 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 80 + + + CF$UID + 81 + + + CF$UID + 82 + + + CF$UID + 83 + + + CF$UID + 84 + + + CF$UID + 85 + + + CF$UID + 86 + + + CF$UID + 87 + + + NS.objects + + + CF$UID + 88 + + + CF$UID + 111 + + + CF$UID + 151 + + + CF$UID + 178 + + + CF$UID + 27 + + + CF$UID + 179 + + + CF$UID + 187 + + + CF$UID + 16 + + + + layoutTree + IDEEditorMode_Standard + IDEEDitorArea_DebugArea + IDEShowEditor + EditorMode + DebuggerSplitView + DefaultPersistentRepresentations + ShowDebuggerArea + + $class + + CF$UID + 110 + + geniusEditorContextNode + + CF$UID + 0 + + primaryEditorContextNode + + CF$UID + 89 + + rootLayoutTreeNode + + CF$UID + 107 + + + + $class + + CF$UID + 109 + + children + + CF$UID + 0 + + contentType + 1 + documentArchivableRepresentation + + CF$UID + 90 + + orientation + 0 + parent + + CF$UID + 107 + + + + $class + + CF$UID + 106 + + DocumentLocation + + CF$UID + 102 + + DomainIdentifier + + CF$UID + 91 + + IdentifierPath + + CF$UID + 92 + + IndexOfDocumentIdentifier + + CF$UID + 27 + + + Xcode.IDENavigableItemDomain.WorkspaceStructure + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 93 + + + CF$UID + 96 + + + CF$UID + 98 + + + CF$UID + 100 + + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 94 + + + CommonDH.c + + $classes + + IDEArchivableStringIndexPair + NSObject + + $classname + IDEArchivableStringIndexPair + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 97 + + + API + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 99 + + + Source + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 101 + + + CommonCrypto + + $class + + CF$UID + 105 + + documentURL + + CF$UID + 103 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/API/CommonDH.c + + + $classes + + NSMutableString + NSString + NSObject + + $classname + NSMutableString + + + $classes + + DVTDocumentLocation + NSObject + + $classname + DVTDocumentLocation + + + $classes + + IDENavigableItemArchivableRepresentation + NSObject + + $classname + IDENavigableItemArchivableRepresentation + + + $class + + CF$UID + 109 + + children + + CF$UID + 108 + + contentType + 0 + documentArchivableRepresentation + + CF$UID + 0 + + orientation + 0 + parent + + CF$UID + 0 + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 89 + + + + + $classes + + IDEWorkspaceTabControllerLayoutTreeNode + NSObject + + $classname + IDEWorkspaceTabControllerLayoutTreeNode + + + $classes + + IDEWorkspaceTabControllerLayoutTree + NSObject + + $classname + IDEWorkspaceTabControllerLayoutTree + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 112 + + + NS.objects + + + CF$UID + 113 + + + + EditorLayout_PersistentRepresentation + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 114 + + + NS.objects + + + CF$UID + 115 + + + + Main + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 116 + + + CF$UID + 117 + + + CF$UID + 118 + + + NS.objects + + + CF$UID + 119 + + + CF$UID + 27 + + + CF$UID + 149 + + + + EditorLayout_StateSavingStateDictionaries + EditorLayout_Selected + EditorLayout_Geometry + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 120 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 121 + + + CF$UID + 122 + + + CF$UID + 123 + + + CF$UID + 124 + + + CF$UID + 125 + + + CF$UID + 126 + + + CF$UID + 127 + + + NS.objects + + + CF$UID + 128 + + + CF$UID + 129 + + + CF$UID + 136 + + + CF$UID + 144 + + + CF$UID + 94 + + + CF$UID + 145 + + + CF$UID + 146 + + + + FileDataType + ArchivableRepresentation + EditorState + NavigableItemName + DocumentNavigableItemName + DocumentExtensionIdentifier + DocumentURL + public.c-source + + $class + + CF$UID + 106 + + DocumentLocation + + CF$UID + 102 + + DomainIdentifier + + CF$UID + 91 + + IdentifierPath + + CF$UID + 130 + + IndexOfDocumentIdentifier + + CF$UID + 27 + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 131 + + + CF$UID + 132 + + + CF$UID + 133 + + + CF$UID + 134 + + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 94 + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 97 + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 99 + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 135 + + + CommonCrypto + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 141 + + + CF$UID + 142 + + + CF$UID + 16 + + + CF$UID + 143 + + + + PrimaryDocumentTimestamp + PrimaryDocumentVisibleCharacterRange + HideAllIssues + PrimaryDocumentSelectedCharacterRange + 321991696.34177101 + {8061, 1028} + {8448, 79} + CCDHCreateParametersFromData() + Xcode.IDEKit.EditorDocument.SourceCode + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 147 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/API/CommonDH.c + + $classes + + NSURL + NSObject + + $classname + NSURL + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 150 + + + + {{0, 0}, {600, 600}} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 152 + + + CF$UID + 153 + + + CF$UID + 154 + + + CF$UID + 155 + + + CF$UID + 156 + + + CF$UID + 157 + + + NS.objects + + + CF$UID + 158 + + + CF$UID + 159 + + + CF$UID + 161 + + + CF$UID + 158 + + + CF$UID + 164 + + + CF$UID + 172 + + + + LayoutFocusMode + console + variables + LayoutMode + IDEDebugArea_SplitView + IDEDebuggerAreaSplitView + 1 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 160 + + + NS.objects + + + CF$UID + 27 + + + + ConsoleFilterMode + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 162 + + + NS.objects + + + CF$UID + 163 + + + + DBGVariablesViewFilterMode + 2 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 165 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 166 + + + CF$UID + 169 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 167 + + + CF$UID + 168 + + + + VariablesView + 298 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 170 + + + CF$UID + 171 + + + + ConsoleArea + 301 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 173 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 174 + + + CF$UID + 176 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 167 + + + CF$UID + 175 + + + + 298 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 170 + + + CF$UID + 177 + + + + 301 + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 180 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 181 + + + CF$UID + 184 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 182 + + + CF$UID + 183 + + + + IDEEditor + 203 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 185 + + + CF$UID + 186 + + + + IDEDebuggerArea + 115 + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + {{306, 400}, {600, 624}} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 190 + + + CF$UID + 9 + + + CF$UID + 10 + + + CF$UID + 11 + + + CF$UID + 13 + + + CF$UID + 8 + + + NS.objects + + + CF$UID + 191 + + + CF$UID + 273 + + + CF$UID + 16 + + + CF$UID + 190 + + + CF$UID + 274 + + + CF$UID + 3 + + + + IDEWorkspaceTabController_86BFD6C0-314A-4B54-A2FA-0163C861AB7A + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 18 + + + CF$UID + 19 + + + CF$UID + 20 + + + CF$UID + 21 + + + CF$UID + 22 + + + CF$UID + 23 + + + CF$UID + 24 + + + CF$UID + 25 + + + NS.objects + + + CF$UID + 192 + + + CF$UID + 16 + + + CF$UID + 27 + + + CF$UID + 193 + + + CF$UID + 199 + + + CF$UID + 206 + + + CF$UID + 16 + + + CF$UID + 214 + + + + CommonDH.h + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 194 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 195 + + + CF$UID + 197 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 196 + + + + 376 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 198 + + + + 224 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 42 + + + CF$UID + 43 + + + CF$UID + 44 + + + NS.objects + + + CF$UID + 200 + + + CF$UID + 42 + + + CF$UID + 203 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 46 + + + CF$UID + 47 + + + CF$UID + 48 + + + CF$UID + 49 + + + CF$UID + 50 + + + CF$UID + 51 + + + CF$UID + 52 + + + NS.objects + + + CF$UID + 27 + + + CF$UID + 16 + + + CF$UID + 34 + + + CF$UID + 53 + + + CF$UID + 201 + + + CF$UID + 27 + + + CF$UID + 202 + + + + + $class + + CF$UID + 55 + + NSRangeCount + 0 + + + $class + + CF$UID + 57 + + NSRangeCount + 0 + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 59 + + + CF$UID + 60 + + + CF$UID + 61 + + + CF$UID + 62 + + + CF$UID + 63 + + + CF$UID + 64 + + + CF$UID + 65 + + + NS.objects + + + CF$UID + 204 + + + CF$UID + 16 + + + CF$UID + 67 + + + CF$UID + 16 + + + CF$UID + 16 + + + CF$UID + 205 + + + CF$UID + 67 + + + + {{0, 0}, {259, 832}} + + $class + + CF$UID + 15 + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 207 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 208 + + + CF$UID + 210 + + + CF$UID + 212 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 22 + + + CF$UID + 209 + + + + 260 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 25 + + + CF$UID + 211 + + + + 1140 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 77 + + + CF$UID + 213 + + + + 260 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 80 + + + CF$UID + 81 + + + CF$UID + 82 + + + CF$UID + 83 + + + CF$UID + 84 + + + CF$UID + 85 + + + CF$UID + 86 + + + CF$UID + 87 + + + NS.objects + + + CF$UID + 215 + + + CF$UID + 230 + + + CF$UID + 251 + + + CF$UID + 178 + + + CF$UID + 27 + + + CF$UID + 266 + + + CF$UID + 272 + + + CF$UID + 16 + + + + + $class + + CF$UID + 110 + + geniusEditorContextNode + + CF$UID + 0 + + primaryEditorContextNode + + CF$UID + 216 + + rootLayoutTreeNode + + CF$UID + 228 + + + + $class + + CF$UID + 109 + + children + + CF$UID + 0 + + contentType + 1 + documentArchivableRepresentation + + CF$UID + 217 + + orientation + 0 + parent + + CF$UID + 228 + + + + $class + + CF$UID + 106 + + DocumentLocation + + CF$UID + 226 + + DomainIdentifier + + CF$UID + 91 + + IdentifierPath + + CF$UID + 218 + + IndexOfDocumentIdentifier + + CF$UID + 27 + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 219 + + + CF$UID + 221 + + + CF$UID + 223 + + + CF$UID + 224 + + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 220 + + + CommonDH.h + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 222 + + + SPI + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 99 + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 225 + + + CommonCrypto + + $class + + CF$UID + 105 + + documentURL + + CF$UID + 227 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/CommonCryptoSPI/CommonDH.h + + + $class + + CF$UID + 109 + + children + + CF$UID + 229 + + contentType + 0 + documentArchivableRepresentation + + CF$UID + 0 + + orientation + 0 + parent + + CF$UID + 0 + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 216 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 112 + + + NS.objects + + + CF$UID + 231 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 114 + + + NS.objects + + + CF$UID + 232 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 116 + + + CF$UID + 117 + + + CF$UID + 118 + + + NS.objects + + + CF$UID + 233 + + + CF$UID + 27 + + + CF$UID + 249 + + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 234 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 121 + + + CF$UID + 122 + + + CF$UID + 123 + + + CF$UID + 124 + + + CF$UID + 125 + + + CF$UID + 126 + + + CF$UID + 127 + + + NS.objects + + + CF$UID + 235 + + + CF$UID + 236 + + + CF$UID + 243 + + + CF$UID + 220 + + + CF$UID + 220 + + + CF$UID + 145 + + + CF$UID + 247 + + + + public.c-header + + $class + + CF$UID + 106 + + DocumentLocation + + CF$UID + 226 + + DomainIdentifier + + CF$UID + 91 + + IdentifierPath + + CF$UID + 237 + + IndexOfDocumentIdentifier + + CF$UID + 27 + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 238 + + + CF$UID + 239 + + + CF$UID + 240 + + + CF$UID + 241 + + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 220 + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 222 + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 99 + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 242 + + + CommonCrypto + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 244 + + + CF$UID + 245 + + + CF$UID + 16 + + + CF$UID + 246 + + + + 321991638.47215098 + {970, 1051} + {1383, 6} + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 248 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/CommonCryptoSPI/CommonDH.h + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 250 + + + + {{0, 0}, {600, 600}} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 152 + + + CF$UID + 153 + + + CF$UID + 154 + + + CF$UID + 155 + + + CF$UID + 156 + + + CF$UID + 157 + + + NS.objects + + + CF$UID + 158 + + + CF$UID + 252 + + + CF$UID + 253 + + + CF$UID + 158 + + + CF$UID + 254 + + + CF$UID + 260 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 160 + + + NS.objects + + + CF$UID + 27 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 162 + + + NS.objects + + + CF$UID + 163 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 255 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 256 + + + CF$UID + 258 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 167 + + + CF$UID + 257 + + + + 298 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 170 + + + CF$UID + 259 + + + + 301 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 261 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 262 + + + CF$UID + 264 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 167 + + + CF$UID + 263 + + + + 298 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 170 + + + CF$UID + 265 + + + + 301 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 267 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 268 + + + CF$UID + 270 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 182 + + + CF$UID + 269 + + + + 203 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 185 + + + CF$UID + 271 + + + + 115 + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 190 + + + + {{285, 423}, {600, 624}} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 276 + + + CF$UID + 9 + + + CF$UID + 10 + + + CF$UID + 11 + + + CF$UID + 13 + + + CF$UID + 8 + + + NS.objects + + + CF$UID + 277 + + + CF$UID + 494 + + + CF$UID + 178 + + + CF$UID + 276 + + + CF$UID + 495 + + + CF$UID + 4 + + + + IDEWorkspaceTabController_E2B35A66-B826-44B6-B949-D17A696CDCC0 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 20 + + + CF$UID + 19 + + + CF$UID + 18 + + + CF$UID + 21 + + + CF$UID + 22 + + + CF$UID + 23 + + + CF$UID + 24 + + + CF$UID + 25 + + + NS.objects + + + CF$UID + 27 + + + CF$UID + 178 + + + CF$UID + 278 + + + CF$UID + 279 + + + CF$UID + 285 + + + CF$UID + 329 + + + CF$UID + 16 + + + CF$UID + 337 + + + + CommonCrypto.xcodeproj + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 280 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 281 + + + CF$UID + 283 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 282 + + + + 874 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 284 + + + + 224 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 44 + + + CF$UID + 42 + + + CF$UID + 286 + + + CF$UID + 43 + + + CF$UID + 287 + + + NS.objects + + + CF$UID + 288 + + + CF$UID + 295 + + + CF$UID + 300 + + + CF$UID + 44 + + + CF$UID + 311 + + + + Xcode.IDEKit.Navigator.Symbol + Xcode.IDEKit.Navigator.Issues + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 59 + + + CF$UID + 60 + + + CF$UID + 61 + + + CF$UID + 62 + + + CF$UID + 63 + + + CF$UID + 64 + + + CF$UID + 65 + + + NS.objects + + + CF$UID + 289 + + + CF$UID + 16 + + + CF$UID + 67 + + + CF$UID + 16 + + + CF$UID + 16 + + + CF$UID + 290 + + + CF$UID + 293 + + + + {{0, 0}, {326, 1054}} + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 291 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 292 + + + + CommonCrypto + + $class + + CF$UID + 68 + + NS.objects + + + CF$UID + 294 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 292 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 46 + + + CF$UID + 47 + + + CF$UID + 48 + + + CF$UID + 49 + + + CF$UID + 50 + + + CF$UID + 51 + + + CF$UID + 52 + + + NS.objects + + + CF$UID + 296 + + + CF$UID + 16 + + + CF$UID + 34 + + + CF$UID + 297 + + + CF$UID + 298 + + + CF$UID + 27 + + + CF$UID + 299 + + + + 242 + rc5 + + $class + + CF$UID + 55 + + NSLength + 1 + NSLocation + 28 + NSRangeCount + 1 + + + $class + + CF$UID + 57 + + NSRangeCount + 0 + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 301 + + + CF$UID + 302 + + + CF$UID + 303 + + + CF$UID + 304 + + + CF$UID + 305 + + + CF$UID + 306 + + + CF$UID + 307 + + + NS.objects + + + CF$UID + 178 + + + CF$UID + 178 + + + CF$UID + 16 + + + CF$UID + 178 + + + CF$UID + 308 + + + CF$UID + 309 + + + CF$UID + 310 + + + + IDESymbolNavigatorShowWorkspaceOnly + IDESymbolNavigatorShowHierarchy + IDESymbolNavigatorShowContainersOnly + IDESymbolNavigatorShowClassesOnly + IDESymbolNamePatternString + IDESymbolNavigatorSelectedSymbols + IDEExpandedItems + + + $class + + CF$UID + 39 + + NS.objects + + + + $class + + CF$UID + 39 + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 312 + + + CF$UID + 313 + + + CF$UID + 314 + + + CF$UID + 315 + + + CF$UID + 316 + + + CF$UID + 317 + + + CF$UID + 318 + + + CF$UID + 319 + + + CF$UID + 320 + + + CF$UID + 321 + + + NS.objects + + + CF$UID + 16 + + + CF$UID + 322 + + + CF$UID + 323 + + + CF$UID + 325 + + + CF$UID + 326 + + + CF$UID + 16 + + + CF$UID + 16 + + + CF$UID + 327 + + + CF$UID + 16 + + + CF$UID + 328 + + + + IDEErrorFilteringEnabled + IDEVisibleRect + IDECollapsedFiles + IDEExpandedIssues + IDESelectedNavigables + IDEShowsByType + IDESchemeFilteringEnabled + IDECollapsedTypes + IDERecentFilteringEnabled + IDECollapsedGroups + {{0, 0}, {326, 1032}} + + $class + + CF$UID + 324 + + NS.objects + + + + $classes + + NSMutableSet + NSSet + NSObject + + $classname + NSMutableSet + + + $class + + CF$UID + 324 + + NS.objects + + + + $class + + CF$UID + 39 + + NS.objects + + + + $class + + CF$UID + 324 + + NS.objects + + + + $class + + CF$UID + 324 + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 330 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 331 + + + CF$UID + 333 + + + CF$UID + 335 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 22 + + + CF$UID + 332 + + + + 327 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 25 + + + CF$UID + 334 + + + + 1593 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 77 + + + CF$UID + 336 + + + + 260 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 80 + + + CF$UID + 81 + + + CF$UID + 82 + + + CF$UID + 83 + + + CF$UID + 84 + + + CF$UID + 85 + + + CF$UID + 86 + + + CF$UID + 338 + + + CF$UID + 87 + + + NS.objects + + + CF$UID + 339 + + + CF$UID + 351 + + + CF$UID + 415 + + + CF$UID + 178 + + + CF$UID + 27 + + + CF$UID + 430 + + + CF$UID + 436 + + + CF$UID + 437 + + + CF$UID + 16 + + + + IDEEditorMode_Genius + + $class + + CF$UID + 110 + + geniusEditorContextNode + + CF$UID + 0 + + primaryEditorContextNode + + CF$UID + 340 + + rootLayoutTreeNode + + CF$UID + 349 + + + + $class + + CF$UID + 109 + + children + + CF$UID + 0 + + contentType + 1 + documentArchivableRepresentation + + CF$UID + 341 + + orientation + 0 + parent + + CF$UID + 349 + + + + $class + + CF$UID + 106 + + DocumentLocation + + CF$UID + 347 + + DomainIdentifier + + CF$UID + 342 + + IdentifierPath + + CF$UID + 343 + + IndexOfDocumentIdentifier + + CF$UID + 346 + + + Xcode.IDENavigableItemDomain.WorkspaceStructure + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 344 + + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 345 + + + CommonCrypto + 9223372036854775807 + + $class + + CF$UID + 105 + + documentURL + + CF$UID + 348 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/CommonCrypto.xcodeproj/ + + + $class + + CF$UID + 109 + + children + + CF$UID + 350 + + contentType + 0 + documentArchivableRepresentation + + CF$UID + 0 + + orientation + 0 + parent + + CF$UID + 0 + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 340 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 112 + + + NS.objects + + + CF$UID + 352 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 114 + + + NS.objects + + + CF$UID + 353 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 116 + + + CF$UID + 117 + + + CF$UID + 118 + + + NS.objects + + + CF$UID + 354 + + + CF$UID + 27 + + + CF$UID + 413 + + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 355 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 121 + + + CF$UID + 122 + + + CF$UID + 123 + + + CF$UID + 124 + + + CF$UID + 125 + + + CF$UID + 126 + + + CF$UID + 127 + + + NS.objects + + + CF$UID + 356 + + + CF$UID + 357 + + + CF$UID + 362 + + + CF$UID + 409 + + + CF$UID + 409 + + + CF$UID + 410 + + + CF$UID + 411 + + + + com.apple.xcode.project + + $class + + CF$UID + 106 + + DocumentLocation + + CF$UID + 347 + + DomainIdentifier + + CF$UID + 342 + + IdentifierPath + + CF$UID + 358 + + IndexOfDocumentIdentifier + + CF$UID + 361 + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 359 + + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 360 + + + CommonCrypto + 9223372036854775807 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 363 + + + CF$UID + 364 + + + CF$UID + 365 + + + CF$UID + 366 + + + CF$UID + 367 + + + NS.objects + + + CF$UID + 368 + + + CF$UID + 369 + + + CF$UID + 375 + + + CF$UID + 376 + + + CF$UID + 389 + + + + Xcode3ProjectEditorPreviousProjectEditorClass + Xcode3ProjectEditor.sourceList.splitview + Xcode3ProjectEditorPreviousTargetEditorClass + Xcode3ProjectEditorSelectedDocumentLocations + Xcode3ProjectEditor_Xcode3BuildPhasesEditor + Xcode3ProjectInfoEditor + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 370 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 371 + + + CF$UID + 373 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 372 + + + + 267 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 374 + + + + 1326 + Xcode3BuildPhasesEditor + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 377 + + + + + $class + + CF$UID + 388 + + documentURL + + CF$UID + 378 + + selection + + CF$UID + 380 + + timestamp + + CF$UID + 379 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/CommonCrypto.xcodeproj/ + 322093384.14663303 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 381 + + + CF$UID + 382 + + + CF$UID + 383 + + + NS.objects + + + CF$UID + 384 + + + CF$UID + 385 + + + CF$UID + 386 + + + + Editor + Target + Xcode3BuildPhasesEditorLocations + Xcode3BuildPhasesEditor + commonCryptoMacIOSSim + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 387 + + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $classes + + Xcode3ProjectDocumentLocation + DVTDocumentLocation + NSObject + + $classname + Xcode3ProjectDocumentLocation + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 390 + + + CF$UID + 391 + + + CF$UID + 392 + + + CF$UID + 393 + + + CF$UID + 394 + + + CF$UID + 395 + + + CF$UID + 396 + + + CF$UID + 397 + + + NS.objects + + + CF$UID + 398 + + + CF$UID + 399 + + + CF$UID + 400 + + + CF$UID + 401 + + + CF$UID + 402 + + + CF$UID + 406 + + + CF$UID + 407 + + + CF$UID + 408 + + + + 48165E13125AC5F20015A267 + Xcode3BuildPhasesEditorFilterKey + 4CA674F41331747E00C45A71 + 48165DBA125AC5F20015A267 + Xcode3BuildPhasesEditorDisclosedNamesKey + 4CA674F61331856D00C45A71 + kXcode3BuildPhasesEditorScrollPointKey + 48165DBB125AC5F20015A267 + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 403 + + + CF$UID + 404 + + + CF$UID + 404 + + + CF$UID + 404 + + + CF$UID + 403 + + + CF$UID + 403 + + + CF$UID + 403 + + + CF$UID + 405 + + + + Link Binary With Libraries + Target Dependencies + Run Script + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + {0, 0} + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + CommonCrypto + Xcode.Xcode3ProjectSupport.EditorDocument.Xcode3Project + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 412 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/CommonCrypto.xcodeproj/ + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 414 + + + + {{0, 0}, {1593, 1098}} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 152 + + + CF$UID + 153 + + + CF$UID + 154 + + + CF$UID + 155 + + + CF$UID + 156 + + + CF$UID + 157 + + + NS.objects + + + CF$UID + 158 + + + CF$UID + 416 + + + CF$UID + 417 + + + CF$UID + 158 + + + CF$UID + 418 + + + CF$UID + 424 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 160 + + + NS.objects + + + CF$UID + 27 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 162 + + + NS.objects + + + CF$UID + 163 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 419 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 420 + + + CF$UID + 422 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 167 + + + CF$UID + 421 + + + + 280 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 170 + + + CF$UID + 423 + + + + 1312 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 425 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 426 + + + CF$UID + 428 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 167 + + + CF$UID + 427 + + + + 280 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 170 + + + CF$UID + 429 + + + + 1312 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 431 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 432 + + + CF$UID + 434 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 182 + + + CF$UID + 433 + + + + 203 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 185 + + + CF$UID + 435 + + + + 115 + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 438 + + + CF$UID + 112 + + + NS.objects + + + CF$UID + 439 + + + CF$UID + 440 + + + + SplitPosition + 0.49968612194061279 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 441 + + + CF$UID + 114 + + + NS.objects + + + CF$UID + 442 + + + CF$UID + 449 + + + + Alternate + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 116 + + + CF$UID + 117 + + + CF$UID + 118 + + + NS.objects + + + CF$UID + 443 + + + CF$UID + 158 + + + CF$UID + 446 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 444 + + + CF$UID + 445 + + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 447 + + + CF$UID + 448 + + + + {{0, 0}, {796, 549}} + {{0, 549}, {796, 549}} + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 116 + + + CF$UID + 117 + + + CF$UID + 118 + + + NS.objects + + + CF$UID + 450 + + + CF$UID + 27 + + + CF$UID + 492 + + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 451 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 121 + + + CF$UID + 122 + + + CF$UID + 123 + + + CF$UID + 124 + + + CF$UID + 125 + + + CF$UID + 126 + + + CF$UID + 127 + + + NS.objects + + + CF$UID + 356 + + + CF$UID + 452 + + + CF$UID + 459 + + + CF$UID + 409 + + + CF$UID + 409 + + + CF$UID + 410 + + + CF$UID + 490 + + + + + $class + + CF$UID + 106 + + DocumentLocation + + CF$UID + 457 + + DomainIdentifier + + CF$UID + 342 + + IdentifierPath + + CF$UID + 453 + + IndexOfDocumentIdentifier + + CF$UID + 456 + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 454 + + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 455 + + + CommonCrypto + 9223372036854775807 + + $class + + CF$UID + 105 + + documentURL + + CF$UID + 458 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/CommonCrypto.xcodeproj/ + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 363 + + + CF$UID + 364 + + + CF$UID + 365 + + + CF$UID + 366 + + + CF$UID + 460 + + + NS.objects + + + CF$UID + 461 + + + CF$UID + 462 + + + CF$UID + 468 + + + CF$UID + 469 + + + CF$UID + 479 + + + + Xcode3ProjectEditor_Xcode3BuildPhasesEditor + Xcode3ProjectInfoEditor + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 463 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 464 + + + CF$UID + 466 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 465 + + + + 267 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 467 + + + + 529 + Xcode3BuildPhasesEditor + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 470 + + + + + $class + + CF$UID + 388 + + documentURL + + CF$UID + 471 + + selection + + CF$UID + 473 + + timestamp + + CF$UID + 472 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/CommonCrypto.xcodeproj/ + 322003690.09011298 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 381 + + + CF$UID + 382 + + + CF$UID + 474 + + + NS.objects + + + CF$UID + 475 + + + CF$UID + 476 + + + CF$UID + 477 + + + + Xcode3BuildPhasesEditorLocations + Xcode3BuildPhasesEditor + libCommonCryptoMacIOS + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 478 + + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 480 + + + CF$UID + 391 + + + CF$UID + 394 + + + CF$UID + 481 + + + CF$UID + 482 + + + CF$UID + 483 + + + CF$UID + 396 + + + NS.objects + + + CF$UID + 484 + + + CF$UID + 399 + + + CF$UID + 485 + + + CF$UID + 487 + + + CF$UID + 488 + + + CF$UID + 489 + + + CF$UID + 407 + + + + 48165CD8125AC5D50015A267 + 48CCF15612FA99B600D6DAE9 + 48165CD7125AC5D50015A267 + 48165D30125AC5D50015A267 + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 486 + + + CF$UID + 486 + + + CF$UID + 486 + + + CF$UID + 486 + + + CF$UID + 486 + + + CF$UID + 486 + + + CF$UID + 486 + + + + Compile Sources + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 491 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/CommonCrypto.xcodeproj/ + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 493 + + + + {{0, 0}, {1593, 1098}} + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 276 + + + + {{0, 4}, {1920, 1174}} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 497 + + + CF$UID + 9 + + + CF$UID + 10 + + + CF$UID + 11 + + + CF$UID + 13 + + + CF$UID + 8 + + + NS.objects + + + CF$UID + 498 + + + CF$UID + 578 + + + CF$UID + 16 + + + CF$UID + 497 + + + CF$UID + 579 + + + CF$UID + 5 + + + + IDEWorkspaceTabController_CB5F2FA9-28EE-4EA2-A7FC-AC04C469D50C + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 18 + + + CF$UID + 19 + + + CF$UID + 20 + + + CF$UID + 21 + + + CF$UID + 22 + + + CF$UID + 23 + + + CF$UID + 24 + + + CF$UID + 25 + + + NS.objects + + + CF$UID + 499 + + + CF$UID + 16 + + + CF$UID + 27 + + + CF$UID + 500 + + + CF$UID + 506 + + + CF$UID + 514 + + + CF$UID + 16 + + + CF$UID + 522 + + + + ccALL.h + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 501 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 502 + + + CF$UID + 504 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 503 + + + + 389 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 505 + + + + 211 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 42 + + + CF$UID + 43 + + + CF$UID + 44 + + + NS.objects + + + CF$UID + 507 + + + CF$UID + 42 + + + CF$UID + 511 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 46 + + + CF$UID + 47 + + + CF$UID + 48 + + + CF$UID + 49 + + + CF$UID + 50 + + + CF$UID + 51 + + + CF$UID + 52 + + + NS.objects + + + CF$UID + 27 + + + CF$UID + 16 + + + CF$UID + 34 + + + CF$UID + 508 + + + CF$UID + 509 + + + CF$UID + 27 + + + CF$UID + 510 + + + + CC_iOS_SIM + + $class + + CF$UID + 55 + + NSRangeCount + 0 + + + $class + + CF$UID + 57 + + NSRangeCount + 0 + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 59 + + + CF$UID + 60 + + + CF$UID + 61 + + + CF$UID + 62 + + + CF$UID + 63 + + + CF$UID + 64 + + + CF$UID + 65 + + + NS.objects + + + CF$UID + 512 + + + CF$UID + 16 + + + CF$UID + 67 + + + CF$UID + 16 + + + CF$UID + 16 + + + CF$UID + 513 + + + CF$UID + 67 + + + + {{0, 0}, {259, 832}} + + $class + + CF$UID + 15 + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 515 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 516 + + + CF$UID + 518 + + + CF$UID + 520 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 22 + + + CF$UID + 517 + + + + 327 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 25 + + + CF$UID + 519 + + + + 1593 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 77 + + + CF$UID + 521 + + + + 260 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 80 + + + CF$UID + 81 + + + CF$UID + 82 + + + CF$UID + 83 + + + CF$UID + 84 + + + CF$UID + 85 + + + CF$UID + 86 + + + CF$UID + 87 + + + NS.objects + + + CF$UID + 523 + + + CF$UID + 537 + + + CF$UID + 556 + + + CF$UID + 178 + + + CF$UID + 27 + + + CF$UID + 571 + + + CF$UID + 577 + + + CF$UID + 16 + + + + + $class + + CF$UID + 110 + + geniusEditorContextNode + + CF$UID + 0 + + primaryEditorContextNode + + CF$UID + 524 + + rootLayoutTreeNode + + CF$UID + 535 + + + + $class + + CF$UID + 109 + + children + + CF$UID + 0 + + contentType + 1 + documentArchivableRepresentation + + CF$UID + 525 + + orientation + 0 + parent + + CF$UID + 535 + + + + $class + + CF$UID + 106 + + DocumentLocation + + CF$UID + 533 + + DomainIdentifier + + CF$UID + 91 + + IdentifierPath + + CF$UID + 526 + + IndexOfDocumentIdentifier + + CF$UID + 27 + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 527 + + + CF$UID + 529 + + + CF$UID + 531 + + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 528 + + + ccALL.h + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 530 + + + BuildHeaders + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 532 + + + CommonCrypto + + $class + + CF$UID + 105 + + documentURL + + CF$UID + 534 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/BuildHeaders/ccALL.h + + + $class + + CF$UID + 109 + + children + + CF$UID + 536 + + contentType + 0 + documentArchivableRepresentation + + CF$UID + 0 + + orientation + 0 + parent + + CF$UID + 0 + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 524 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 112 + + + NS.objects + + + CF$UID + 538 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 114 + + + NS.objects + + + CF$UID + 539 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 116 + + + CF$UID + 117 + + + CF$UID + 118 + + + NS.objects + + + CF$UID + 540 + + + CF$UID + 27 + + + CF$UID + 554 + + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 541 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 121 + + + CF$UID + 122 + + + CF$UID + 123 + + + CF$UID + 124 + + + CF$UID + 125 + + + CF$UID + 126 + + + CF$UID + 127 + + + NS.objects + + + CF$UID + 235 + + + CF$UID + 542 + + + CF$UID + 548 + + + CF$UID + 528 + + + CF$UID + 528 + + + CF$UID + 145 + + + CF$UID + 552 + + + + + $class + + CF$UID + 106 + + DocumentLocation + + CF$UID + 533 + + DomainIdentifier + + CF$UID + 91 + + IdentifierPath + + CF$UID + 543 + + IndexOfDocumentIdentifier + + CF$UID + 27 + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 544 + + + CF$UID + 545 + + + CF$UID + 546 + + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 528 + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 530 + + + + $class + + CF$UID + 95 + + Identifier + + CF$UID + 547 + + + CommonCrypto + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 549 + + + CF$UID + 550 + + + CF$UID + 16 + + + CF$UID + 551 + + + + 321998003.53554702 + {0, 1393} + {1271, 10} + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 553 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/BuildHeaders/ccALL.h + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 555 + + + + {{0, 0}, {600, 600}} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 152 + + + CF$UID + 153 + + + CF$UID + 154 + + + CF$UID + 155 + + + CF$UID + 156 + + + CF$UID + 157 + + + NS.objects + + + CF$UID + 158 + + + CF$UID + 557 + + + CF$UID + 558 + + + CF$UID + 158 + + + CF$UID + 559 + + + CF$UID + 565 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 160 + + + NS.objects + + + CF$UID + 27 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 162 + + + NS.objects + + + CF$UID + 163 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 560 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 561 + + + CF$UID + 563 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 167 + + + CF$UID + 562 + + + + 298 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 170 + + + CF$UID + 564 + + + + 301 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 566 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 567 + + + CF$UID + 569 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 167 + + + CF$UID + 568 + + + + 298 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 170 + + + CF$UID + 570 + + + + 301 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 572 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 573 + + + CF$UID + 575 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 182 + + + CF$UID + 574 + + + + 203 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 185 + + + CF$UID + 576 + + + + 115 + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 497 + + + + {{327, 377}, {600, 624}} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 581 + + + CF$UID + 582 + + + CF$UID + 583 + + + CF$UID + 584 + + + CF$UID + 585 + + + CF$UID + 586 + + + CF$UID + 587 + + + CF$UID + 588 + + + CF$UID + 589 + + + CF$UID + 590 + + + CF$UID + 591 + + + NS.objects + + + CF$UID + 178 + + + CF$UID + 592 + + + CF$UID + 27 + + + CF$UID + 793 + + + CF$UID + 798 + + + CF$UID + 801 + + + CF$UID + 813 + + + CF$UID + 814 + + + CF$UID + 846 + + + CF$UID + 16 + + + CF$UID + 16 + + + + BreakpointsActivated + DefaultEditorStatesForURLs + DebuggingWindowBehavior + ActiveRunDestination + ActiveScheme + DefaultEditorFrameSizeForURLs + DocumentWindows + LastCompletedPersistentSchemeBasedActivityReport + RecentEditorDocumentURLs + AppFocusInMiniDebugging + MiniDebuggingConsole + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 593 + + + CF$UID + 410 + + + CF$UID + 145 + + + NS.objects + + + CF$UID + 594 + + + CF$UID + 604 + + + CF$UID + 629 + + + + IDEQuickLookEditor.Editor + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 595 + + + NS.objects + + + CF$UID + 597 + + + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 596 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.Internal.sdk/usr/local/lib/libcorecrypto.a + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 598 + + + NS.objects + + + CF$UID + 599 + + + + SelectedDocumentLocations + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 600 + + + + + $class + + CF$UID + 603 + + IDEQuickLookPageNumber + + CF$UID + 27 + + documentURL + + CF$UID + 601 + + timestamp + + CF$UID + 602 + + + file://localhost/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.Internal.sdk/usr/local/lib/libcorecrypto.a + 321997859.96600503 + + $classes + + IDEQuickLookDocumentLocation + DVTDocumentLocation + NSObject + + $classname + IDEQuickLookDocumentLocation + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 605 + + + NS.objects + + + CF$UID + 606 + + + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 348 + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 363 + + + CF$UID + 364 + + + CF$UID + 365 + + + CF$UID + 366 + + + CF$UID + 367 + + + NS.objects + + + CF$UID + 607 + + + CF$UID + 608 + + + CF$UID + 614 + + + CF$UID + 615 + + + CF$UID + 623 + + + + Xcode3ProjectInfoEditor + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 29 + + + NS.objects + + + CF$UID + 609 + + + + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 610 + + + CF$UID + 612 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 611 + + + + 267 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 32 + + + CF$UID + 33 + + + NS.objects + + + CF$UID + 34 + + + CF$UID + 613 + + + + 1326 + Xcode3BuildPhasesEditor + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 616 + + + + + $class + + CF$UID + 388 + + documentURL + + CF$UID + 378 + + selection + + CF$UID + 618 + + timestamp + + CF$UID + 617 + + + 322093384.14397198 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 381 + + + CF$UID + 382 + + + CF$UID + 619 + + + NS.objects + + + CF$UID + 620 + + + CF$UID + 385 + + + CF$UID + 621 + + + + Xcode3BuildPhasesEditorLocations + Xcode3BuildPhasesEditor + + $class + + CF$UID + 15 + + NS.objects + + + CF$UID + 622 + + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 390 + + + CF$UID + 391 + + + CF$UID + 392 + + + CF$UID + 393 + + + CF$UID + 394 + + + CF$UID + 395 + + + CF$UID + 396 + + + CF$UID + 397 + + + NS.objects + + + CF$UID + 624 + + + CF$UID + 399 + + + CF$UID + 625 + + + CF$UID + 626 + + + CF$UID + 402 + + + CF$UID + 627 + + + CF$UID + 407 + + + CF$UID + 628 + + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 630 + + + CF$UID + 632 + + + CF$UID + 633 + + + CF$UID + 635 + + + CF$UID + 637 + + + CF$UID + 639 + + + CF$UID + 641 + + + CF$UID + 643 + + + CF$UID + 645 + + + CF$UID + 647 + + + CF$UID + 648 + + + CF$UID + 650 + + + CF$UID + 652 + + + CF$UID + 654 + + + CF$UID + 656 + + + CF$UID + 658 + + + CF$UID + 660 + + + CF$UID + 662 + + + CF$UID + 664 + + + CF$UID + 666 + + + CF$UID + 668 + + + CF$UID + 670 + + + CF$UID + 672 + + + CF$UID + 674 + + + CF$UID + 676 + + + CF$UID + 677 + + + CF$UID + 679 + + + CF$UID + 681 + + + CF$UID + 683 + + + NS.objects + + + CF$UID + 685 + + + CF$UID + 688 + + + CF$UID + 692 + + + CF$UID + 696 + + + CF$UID + 700 + + + CF$UID + 704 + + + CF$UID + 708 + + + CF$UID + 712 + + + CF$UID + 716 + + + CF$UID + 720 + + + CF$UID + 724 + + + CF$UID + 728 + + + CF$UID + 732 + + + CF$UID + 736 + + + CF$UID + 739 + + + CF$UID + 743 + + + CF$UID + 747 + + + CF$UID + 750 + + + CF$UID + 754 + + + CF$UID + 758 + + + CF$UID + 761 + + + CF$UID + 764 + + + CF$UID + 768 + + + CF$UID + 772 + + + CF$UID + 776 + + + CF$UID + 780 + + + CF$UID + 783 + + + CF$UID + 786 + + + CF$UID + 790 + + + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 631 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Configurations/platforms/CC_iOSClient.xcconfig + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 534 + + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 634 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 636 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/misc/crypt/crypt_register_hash.c + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 638 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/headers/tomcrypt_custom.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 640 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/BuildHeaders/ccIOSSim.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 642 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 644 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 646 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/misc/crypt/crypt_register_cipher.c + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 103 + + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 649 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/BuildHeaders/cciOS.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 651 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/BuildHeaders/ccMacOSXKext.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 653 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/cc_fips_test/fips_mode_file.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 655 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 657 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 659 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/ciphers/ltc_rc5/rc5.c + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 661 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/ciphers/aes/ios_hw_aes/ios_hw_aes.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 663 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/UnitTestSource/EncryptionTest.mm + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 665 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/headers/tomcrypt.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 667 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/cc_fips_test/DBRGSelfTest.c + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 669 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/ciphers/aes/ios_hw_aes/ios_hw_aes.c + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 671 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/misc/crypt/crypt.c + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 673 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/headers/tomcrypt_hash.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 675 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/headers/ltc_ciphers.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 227 + + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 678 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/headers/tomcrypt_cfg.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 680 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/headers/cc_implementation_info.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 682 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/headers/tomcrypt_cipher.h + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 684 + + + + $class + + CF$UID + 104 + + NS.string + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Configurations/platforms/CC_iOSClientSim.xcconfig + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 686 + + + CF$UID + 687 + + + CF$UID + 16 + + + CF$UID + 407 + + + + 321997115.630503 + {0, 283} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 689 + + + CF$UID + 690 + + + CF$UID + 16 + + + CF$UID + 691 + + + + 322003664.383874 + {0, 1502} + {1271, 10} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 693 + + + CF$UID + 694 + + + CF$UID + 16 + + + CF$UID + 695 + + + + 321995592.54224002 + {0, 2016} + {1502, 21} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 697 + + + CF$UID + 698 + + + CF$UID + 16 + + + CF$UID + 699 + + + + 321995738.884148 + {3, 2251} + {1532, 62} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 701 + + + CF$UID + 702 + + + CF$UID + 16 + + + CF$UID + 703 + + + + 322003982.90560102 + {3689, 1820} + {4520, 3} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 705 + + + CF$UID + 706 + + + CF$UID + 16 + + + CF$UID + 707 + + + + 321995036.47561997 + {0, 2104} + {2271, 0} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 709 + + + CF$UID + 710 + + + CF$UID + 16 + + + CF$UID + 711 + + + + 321996624.00251502 + {0, 2008} + {1514, 19} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 713 + + + CF$UID + 714 + + + CF$UID + 16 + + + CF$UID + 715 + + + + 321997758.80335301 + {0, 2249} + {1395, 21} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 717 + + + CF$UID + 718 + + + CF$UID + 16 + + + CF$UID + 719 + + + + 321995143.205181 + {0, 2316} + {1555, 21} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 721 + + + CF$UID + 722 + + + CF$UID + 16 + + + CF$UID + 723 + + + + 321994754.49462003 + {8432, 1638} + {8448, 79} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 725 + + + CF$UID + 726 + + + CF$UID + 16 + + + CF$UID + 727 + + + + 322003690.20025301 + {1159, 2514} + {2582, 17} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 729 + + + CF$UID + 730 + + + CF$UID + 16 + + + CF$UID + 731 + + + + 322003957.28929299 + {1257, 2248} + {2899, 3} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 733 + + + CF$UID + 734 + + + CF$UID + 16 + + + CF$UID + 735 + + + + 322003948.01873201 + {0, 1089} + {1040, 48} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 737 + + + CF$UID + 738 + + + CF$UID + 16 + + + CF$UID + 407 + + + + 321995739.40989101 + {0, 1767} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 740 + + + CF$UID + 741 + + + CF$UID + 16 + + + CF$UID + 742 + + + + 321995218.781003 + {0, 1766} + {1565, 21} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 744 + + + CF$UID + 745 + + + CF$UID + 16 + + + CF$UID + 746 + + + + 322004159.74724001 + {0, 2904} + {612, 0} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 748 + + + CF$UID + 749 + + + CF$UID + 16 + + + CF$UID + 407 + + + + 322007658.02435899 + {0, 2911} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 751 + + + CF$UID + 752 + + + CF$UID + 16 + + + CF$UID + 753 + + + + 322003963.03766203 + {0, 2062} + {1078, 3} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 755 + + + CF$UID + 756 + + + CF$UID + 16 + + + CF$UID + 757 + + + + 321996758.29607099 + {1851, 2253} + {3735, 4} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 759 + + + CF$UID + 760 + + + CF$UID + 16 + + + CF$UID + 407 + + + + 321997218.14901698 + {0, 1871} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 762 + + + CF$UID + 763 + + + CF$UID + 16 + + + CF$UID + 407 + + + + 322093379.03902 + {0, 2700} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 765 + + + CF$UID + 766 + + + CF$UID + 16 + + + CF$UID + 767 + + + + 322003961.75629997 + {0, 2031} + {1204, 3} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 769 + + + CF$UID + 770 + + + CF$UID + 16 + + + CF$UID + 771 + + + + 321996629.918064 + {1652, 2992} + {2951, 19} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 773 + + + CF$UID + 774 + + + CF$UID + 16 + + + CF$UID + 775 + + + + 322003969.24792498 + {0, 2078} + {1103, 3} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 777 + + + CF$UID + 778 + + + CF$UID + 16 + + + CF$UID + 779 + + + + 321991841.11940497 + {2026, 1852} + {3418, 0} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 781 + + + CF$UID + 782 + + + CF$UID + 16 + + + CF$UID + 407 + + + + 321996763.94170803 + {3543, 1452} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 784 + + + CF$UID + 785 + + + CF$UID + 16 + + + CF$UID + 407 + + + + 321995352.35290903 + {0, 1839} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 787 + + + CF$UID + 788 + + + CF$UID + 16 + + + CF$UID + 789 + + + + 321997993.50212801 + {0, 2878} + {1211, 0} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + NS.objects + + + CF$UID + 791 + + + CF$UID + 792 + + + CF$UID + 16 + + + CF$UID + 407 + + + + 321997144.27703601 + {0, 285} + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 794 + + + CF$UID + 795 + + + NS.objects + + + CF$UID + 796 + + + CF$UID + 797 + + + + IDEDeviceLocation + IDEDeviceArchitecture + dvtdevice-local-computer:localhost + x86_64 + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 799 + + + NS.objects + + + CF$UID + 800 + + + + IDENameString + libCommonCryptoMacIOS + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 647 + + + CF$UID + 676 + + + CF$UID + 632 + + + NS.objects + + + CF$UID + 802 + + + CF$UID + 807 + + + CF$UID + 810 + + + + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 803 + + + CF$UID + 804 + + + NS.objects + + + CF$UID + 805 + + + CF$UID + 806 + + + + width + height + 600 + 600 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 803 + + + CF$UID + 804 + + + NS.objects + + + CF$UID + 808 + + + CF$UID + 809 + + + + 600 + 600 + + $class + + CF$UID + 36 + + NS.keys + + + CF$UID + 803 + + + CF$UID + 804 + + + NS.objects + + + CF$UID + 811 + + + CF$UID + 812 + + + + 600 + 600 + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 4 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 815 + + + CF$UID + 816 + + + CF$UID + 817 + + + NS.objects + + + CF$UID + 818 + + + CF$UID + 844 + + + CF$UID + 845 + + + + IDEActivityReportCompletionSummaryStringSegments + IDEActivityReportOptions + IDEActivityReportTitle + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 819 + + + CF$UID + 826 + + + CF$UID + 830 + + + CF$UID + 835 + + + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 820 + + + CF$UID + 821 + + + CF$UID + 822 + + + NS.objects + + + CF$UID + 823 + + + CF$UID + 824 + + + CF$UID + 825 + + + + IDEActivityReportStringSegmentPriority + IDEActivityReportStringSegmentBackSeparator + IDEActivityReportStringSegmentStringValue + 2 + + Clean + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 820 + + + CF$UID + 821 + + + CF$UID + 822 + + + NS.objects + + + CF$UID + 827 + + + CF$UID + 828 + + + CF$UID + 829 + + + + 4 + : + libCommonCryptoMacIOS + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 820 + + + CF$UID + 821 + + + CF$UID + 822 + + + NS.objects + + + CF$UID + 831 + + + CF$UID + 832 + + + CF$UID + 833 + + + + 1 + │ + + $class + + CF$UID + 834 + + NS.data + + YnBsaXN0MDDUAQIDBAUGOzxYJHZlcnNpb25YJG9iamVjdHNZJGFy + Y2hpdmVyVCR0b3ASAAGGoK0HCA8QGhscJCUrMTQ3VSRudWxs0wkK + CwwNDlxOU0F0dHJpYnV0ZXNWJGNsYXNzWE5TU3RyaW5ngAOADIAC + WVN1Y2NlZWRlZNMKERITFBdXTlMua2V5c1pOUy5vYmplY3RzgAui + FRaABIAFohgZgAaACVZOU0ZvbnRXTlNDb2xvctQKHR4fICEiI1ZO + U05hbWVWTlNTaXplWE5TZkZsYWdzgAiAByNAJgAAAAAAABENEF8Q + EUx1Y2lkYUdyYW5kZS1Cb2xk0iYnKClaJGNsYXNzbmFtZVgkY2xh + c3Nlc1ZOU0ZvbnSiKCpYTlNPYmplY3TTCiwtLi8wXE5TQ29sb3JT + cGFjZVdOU1doaXRlgAoQA0IwANImJzIzV05TQ29sb3KiMirSJic1 + NlxOU0RpY3Rpb25hcnmiNSrSJic4OV8QEk5TQXR0cmlidXRlZFN0 + cmluZ6I6Kl8QEk5TQXR0cmlidXRlZFN0cmluZ18QD05TS2V5ZWRB + cmNoaXZlctE9PlRyb290gAEACAARABoAIwAtADIANwBFAEsAUgBf + AGYAbwBxAHMAdQB/AIYAjgCZAJsAngCgAKIApQCnAKkAsAC4AMEA + yADPANgA2gDcAOUA6AD8AQEBDAEVARwBHwEoAS8BPAFEAUYBSAFL + AVABWAFbAWABbQFwAXUBigGNAaIBtAG3AbwAAAAAAAACAQAAAAAA + AAA/AAAAAAAAAAAAAAAAAAABvg== + + + + $classes + + NSMutableData + NSData + NSObject + + $classname + NSMutableData + + + $class + + CF$UID + 40 + + NS.keys + + + CF$UID + 820 + + + CF$UID + 836 + + + CF$UID + 837 + + + CF$UID + 822 + + + CF$UID + 838 + + + CF$UID + 839 + + + NS.objects + + + CF$UID + 840 + + + CF$UID + 158 + + + CF$UID + 841 + + + CF$UID + 843 + + + CF$UID + 158 + + + CF$UID + 158 + + + + IDEActivityReportStringSegmentType + IDEActivityReportStringSegmentDate + IDEActivityReportStringSegmentDateStyle + IDEActivityReportStringSegmentTimeStyle + 3 + + $class + + CF$UID + 842 + + NS.time + 322008216.04143 + + + $classes + + NSDate + NSObject + + $classname + NSDate + + Yesterday at 3:43 PM + 106 + tommath + + $class + + CF$UID + 39 + + NS.objects + + + CF$UID + 847 + + + CF$UID + 848 + + + CF$UID + 850 + + + CF$UID + 852 + + + CF$UID + 854 + + + CF$UID + 856 + + + CF$UID + 858 + + + CF$UID + 860 + + + CF$UID + 862 + + + CF$UID + 864 + + + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 378 + + + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 849 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/ciphers/aes/ios_hw_aes/ios_hw_aes.c + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 851 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/ciphers/aes/ios_hw_aes/ios_hw_aes.h + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 853 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/ciphers/ltc_rc5/rc5.c + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 855 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/headers/tomcrypt_custom.h + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 857 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/headers/ltc_ciphers.h + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 859 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/UnitTestSource/EncryptionTest.mm + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 861 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/Source/libtomcrypt/src/misc/crypt/crypt.c + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 863 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/BuildHeaders/ccMacOSXKext.h + + $class + + CF$UID + 148 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 865 + + + file://localhost/Volumes/data/stripes/R/PR-9008520/CommonCrypto/cc_fips_test/fips_mode_file.h + + $top + + State + + CF$UID + 1 + + + $version + 100000 + + ADDED CommonCrypto.xcodeproj/project.xcworkspace/xcuserdata/stripes.xcuserdatad/WorkspaceSettings.xcsettings Index: CommonCrypto.xcodeproj/project.xcworkspace/xcuserdata/stripes.xcuserdatad/WorkspaceSettings.xcsettings ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/project.xcworkspace/xcuserdata/stripes.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + IDEWorkspaceUserSettings_BuildLocationStyle + 2 + + ADDED CommonCrypto.xcodeproj/xcshareddata/xcschemes/CCRegression.xcscheme Index: CommonCrypto.xcodeproj/xcshareddata/xcschemes/CCRegression.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcshareddata/xcschemes/CCRegression.xcscheme @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcshareddata/xcschemes/CCRegressionIos.xcscheme Index: CommonCrypto.xcodeproj/xcshareddata/xcschemes/CCRegressionIos.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcshareddata/xcschemes/CCRegressionIos.xcscheme @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcshareddata/xcschemes/Copy Open Source Docs.xcscheme Index: CommonCrypto.xcodeproj/xcshareddata/xcschemes/Copy Open Source Docs.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcshareddata/xcschemes/Copy Open Source Docs.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcshareddata/xcschemes/libCommonCryptoMacIOS.xcscheme Index: CommonCrypto.xcodeproj/xcshareddata/xcschemes/libCommonCryptoMacIOS.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcshareddata/xcschemes/libCommonCryptoMacIOS.xcscheme @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcshareddata/xcschemes/libCommonCryptoMacIOSSim.xcscheme Index: CommonCrypto.xcodeproj/xcshareddata/xcschemes/libCommonCryptoMacIOSSim.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcshareddata/xcschemes/libCommonCryptoMacIOSSim.xcscheme @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcshareddata/xcschemes/libCommonCryptoMacOSX.xcscheme Index: CommonCrypto.xcodeproj/xcshareddata/xcschemes/libCommonCryptoMacOSX.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcshareddata/xcschemes/libCommonCryptoMacOSX.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcshareddata/xcschemes/world.xcscheme Index: CommonCrypto.xcodeproj/xcshareddata/xcschemes/world.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcshareddata/xcschemes/world.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,5 @@ + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/CCRegression.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/CCRegression.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/CCRegression.xcscheme @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/CCRegressionIos.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/CCRegressionIos.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/CCRegressionIos.xcscheme @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/CommonCrypto_Sim.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/CommonCrypto_Sim.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/CommonCrypto_Sim.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/Copy Open Source Docs.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/Copy Open Source Docs.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/Copy Open Source Docs.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_fips_dbrg_test.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_fips_dbrg_test.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_fips_dbrg_test.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_fips_test.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_fips_test.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_fips_test.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_ios_tommath.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_ios_tommath.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_ios_tommath.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_macosx_tommath.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_macosx_tommath.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/cc_macosx_tommath.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/commonCryptoMacIOS.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/commonCryptoMacIOS.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/commonCryptoMacIOS.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/commonCryptoMacIOSKext.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/commonCryptoMacIOSKext.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/commonCryptoMacIOSKext.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/commonCryptoMacOSXKext.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/commonCryptoMacOSXKext.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/commonCryptoMacOSXKext.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacIOS.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacIOS.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacIOS.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacIOSSim.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacIOSSim.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacIOSSim.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacOSS.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacOSS.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacOSS.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacOSX.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacOSX.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/libCommonCryptoMacOSX.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/world.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/world.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/world.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/xcschememanagement.plist Index: CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/xcschememanagement.plist ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/jimmur.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,172 @@ + + + + + SchemeUserState + + CCRegression.xcscheme + + orderHint + 11 + + CCRegressionIos.xcscheme + + orderHint + 4 + + CommonCrypto_Sim.xcscheme + + orderHint + 13 + + Copy Open Source Docs.xcscheme + + orderHint + 21 + + cc_fips_dbrg_test.xcscheme + + orderHint + 30 + + cc_fips_test.xcscheme + + orderHint + 35 + + cc_ios_tommath.xcscheme + + orderHint + 29 + + cc_macosx_tommath.xcscheme + + orderHint + 31 + + commonCryptoMacIOS.xcscheme + + orderHint + 8 + + commonCryptoMacIOSKext.xcscheme + + orderHint + 33 + + commonCryptoMacOSXKext.xcscheme + + orderHint + 32 + + libCommonCryptoMacIOS.xcscheme + + orderHint + 7 + + libCommonCryptoMacIOSSim.xcscheme + + orderHint + 16 + + libCommonCryptoMacOSS.xcscheme + + orderHint + 34 + + libCommonCryptoMacOSX.xcscheme + + orderHint + 2 + + world.xcscheme + + orderHint + 20 + + + SuppressBuildableAutocreation + + 054BBEB705F6A93300344873 + + primary + + + 054BBEBD05F6A97700344873 + + primary + + + 05CE94290A3784D4007C91D6 + + primary + + + 48165CD7125AC5D50015A267 + + primary + + + 48165DBA125AC5F20015A267 + + primary + + + 48165E9D125AC6100015A267 + + primary + + + 48166063125AC64C0015A267 + + primary + + + 4823B0DF14C10064008F689F + + primary + + + 4834A85414F47B6200438E3D + + primary + + + 48CCEF5612FA879900D6DAE9 + + primary + + + 48FD68BF1354BCB900F55B8B + + primary + + + 4C3CAC17132066C700AA3D18 + + primary + + + 4C58A2511326F26000A17BAC + + primary + + + 4C99FCB61326E14F0040AD38 + + primary + + + 4CA675141332C16C00C45A71 + + primary + + + EEBECDF8125E691800034935 + + primary + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,5 @@ + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/CBCTest.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/CBCTest.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/CBCTest.xcscheme @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/Copy Open Source Docs.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/Copy Open Source Docs.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/Copy Open Source Docs.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/Unit Test World.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/Unit Test World.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/Unit Test World.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/XTStest.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/XTStest.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/XTStest.xcscheme @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/cc_fips_dbrg_test.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/cc_fips_dbrg_test.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/cc_fips_dbrg_test.xcscheme @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/cc_fips_test.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/cc_fips_test.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/cc_fips_test.xcscheme @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOS.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOS.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOS.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOSKext.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOSKext.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOSKext.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOSSim 2.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOSSim 2.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOSSim 2.xcscheme @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOSSim.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOSSim.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacIOSSim.xcscheme @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacOSS.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacOSS.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacOSS.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacOSX.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacOSX.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacOSX.xcscheme @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacOSXKext.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacOSXKext.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/commonCryptoMacOSXKext.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/libCommonCryptoMacIOS.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/libCommonCryptoMacIOS.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/libCommonCryptoMacIOS.xcscheme @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/tommath.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/tommath.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/tommath.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/world.xcscheme Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/world.xcscheme ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/world.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ADDED CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/xcschememanagement.plist Index: CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/xcschememanagement.plist ================================================================== --- /dev/null +++ CommonCrypto.xcodeproj/xcuserdata/stripes.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,187 @@ + + + + + SchemeUserState + + CBCTest.xcscheme + + orderHint + 12 + + Copy Open Source Docs.xcscheme + + orderHint + 2 + + Unit Test World.xcscheme + + orderHint + 8 + + XTStest.xcscheme + + orderHint + 13 + + cc_fips_dbrg_test.xcscheme + + orderHint + 5 + + cc_fips_test.xcscheme + + orderHint + 1 + + commonCryptoMacIOS.xcscheme + + orderHint + 9 + + commonCryptoMacIOSKext.xcscheme + + orderHint + 14 + + commonCryptoMacIOSSim 2.xcscheme + + orderHint + 15 + + commonCryptoMacIOSSim.xcscheme + + orderHint + 11 + + commonCryptoMacOSS.xcscheme + + orderHint + 4 + + commonCryptoMacOSX.xcscheme + + orderHint + 7 + + commonCryptoMacOSXKext.xcscheme + + orderHint + 6 + + libCommonCryptoMacIOS.xcscheme + + orderHint + 0 + + tommath.xcscheme + + orderHint + 3 + + world.xcscheme + + orderHint + 10 + + + SuppressBuildableAutocreation + + 054BBEB705F6A93300344873 + + primary + + + 054BBEBD05F6A97700344873 + + primary + + + 05CE94290A3784D4007C91D6 + + primary + + + 125B795011FF923D008C1AD3 + + primary + + + 128881641203673C0050B2E9 + + primary + + + 48165CD7125AC5D50015A267 + + primary + + + 48165DBA125AC5F20015A267 + + primary + + + 48165E9D125AC6100015A267 + + primary + + + 48166063125AC64C0015A267 + + primary + + + 48547171125B9465008158B1 + + primary + + + 48547185125B9483008158B1 + + primary + + + 48CCEF5612FA879900D6DAE9 + + primary + + + 4C3CAC17132066C700AA3D18 + + primary + + + 4C58A2511326F26000A17BAC + + primary + + + 4C99FCB61326E14F0040AD38 + + primary + + + 4CA675141332C16C00C45A71 + + primary + + + 5D735E4710FCDC04001AAD1E + + primary + + + 5DC876F710FFB6BC0012A390 + + primary + + + EEBECDF8125E691800034935 + + primary + + + + + ADDED CommonCrypto/CommonCrypto.h Index: CommonCrypto/CommonCrypto.h ================================================================== --- /dev/null +++ CommonCrypto/CommonCrypto.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2006-2012 Apple, Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef __COMMONCRYPTO_PUBLIC__ +#define __COMMONCRYPTO_PUBLIC__ + +#include +#include +#include +#include +#include + +#endif /* __COMMONCRYPTO_PUBLIC__ */ + Index: CommonCrypto/CommonCryptor.h ================================================================== --- CommonCrypto/CommonCryptor.h +++ CommonCrypto/CommonCryptor.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2006-2010 Apple, Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License @@ -20,612 +20,756 @@ * * @APPLE_LICENSE_HEADER_END@ */ /*! - @header CommonCryptor.h - @abstract Generic interface for symmetric encryption. - + @header CommonCryptor.h + @abstract Generic interface for symmetric encryption. + @discussion This interface provides access to a number of symmetric encryption algorithms. Symmetric encryption algorithms come in two "flavors" - block ciphers, and stream ciphers. Block ciphers process data (while both encrypting and decrypting) in discrete chunks of data called blocks; stream ciphers operate on arbitrary sized data. - - The object declared in this interface, CCCryptor, provides - access to both block ciphers and stream ciphers with the same - API; however some options are available for block ciphers that - do not apply to stream ciphers. - - The general operation of a CCCryptor is: initialize it - with raw key data and other optional fields with CCCryptorCreate(); - process input data via one or more calls to CCCryptorUpdate(), - each of which may result in output data being written to - caller-supplied memory; and obtain possible remaining output data - with CCCryptorFinal(). The CCCryptor is disposed of via - CCCryptorRelease(), or it can be reused (with the same key data - as provided to CCCryptorCreate()) by calling CCCryptorReset(). - - CCCryptors can be dynamically allocated by this module, or - their memory can be allocated by the caller. See discussion for - CCCryptorCreate() and CCCryptorCreateFromData() for information - on CCCryptor allocation. - - One option for block ciphers is padding, as defined in PKCS7; - when padding is enabled, the total amount of data encrypted - does not have to be an even multiple of the block size, and - the actual length of plaintext is calculated during decryption. - - Another option for block ciphers is Cipher Block Chaining, known - as CBC mode. When using CBC mode, an Initialization Vector (IV) - is provided along with the key when starting an encrypt - or decrypt operation. If CBC mode is selected and no IV is - provided, an IV of all zeroes will be used. - - CCCryptor also implements block bufferring, so that individual - calls to CCCryptorUpdate() do not have to provide data whose length - is aligned to the block size. (If padding is disabled, encrypting - with block ciphers does require that the *total* length of data - input to CCCryptorUpdate() call(s) be aligned to the block size.) - - A given CCCryptor can only be used by one thread at a time; - multiple threads can use safely different CCCryptors at the - same time. + + The object declared in this interface, CCCryptor, provides + access to both block ciphers and stream ciphers with the same + API; however some options are available for block ciphers that + do not apply to stream ciphers. + + The general operation of a CCCryptor is: initialize it + with raw key data and other optional fields with + CCCryptorCreate(); process input data via one or more calls to + CCCryptorUpdate(), each of which may result in output data + being written to caller-supplied memory; and obtain possible + remaining output data with CCCryptorFinal(). The CCCryptor is + disposed of via CCCryptorRelease(), or it can be reused (with + the same key data as provided to CCCryptorCreate()) by calling + CCCryptorReset(). + + CCCryptors can be dynamically allocated by this module, or + their memory can be allocated by the caller. See discussion for + CCCryptorCreate() and CCCryptorCreateFromData() for information + on CCCryptor allocation. + + One option for block ciphers is padding, as defined in PKCS7; + when padding is enabled, the total amount of data encrypted + does not have to be an even multiple of the block size, and + the actual length of plaintext is calculated during decryption. + + Another option for block ciphers is Cipher Block Chaining, known + as CBC mode. When using CBC mode, an Initialization Vector (IV) + is provided along with the key when starting an encrypt + or decrypt operation. If CBC mode is selected and no IV is + provided, an IV of all zeroes will be used. + + CCCryptor also implements block bufferring, so that individual + calls to CCCryptorUpdate() do not have to provide data whose + length is aligned to the block size. (If padding is disabled, + encrypting with block ciphers does require that the *total* + length of data input to CCCryptorUpdate() call(s) be aligned + to the block size.) + + A given CCCryptor can only be used by one thread at a time; + multiple threads can use safely different CCCryptors at the + same time. */ -#ifndef _CC_COMMON_CRYPTOR_ -#define _CC_COMMON_CRYPTOR_ +#ifndef _CC_COMMON_CRYPTOR_ +#define _CC_COMMON_CRYPTOR_ #include #include +#ifndef KERNEL #include +#endif /* KERNEL */ #include #ifdef __cplusplus extern "C" { #endif /*! - @typedef CCCryptorRef - @abstract Opaque reference to a CCCryptor object. + @typedef CCCryptorRef + @abstract Opaque reference to a CCCryptor object. */ typedef struct _CCCryptor *CCCryptorRef; /*! - @enum CCCryptorStatus - @abstract Return values from CommonCryptor operations. - - @constant kCCSuccess Operation completed normally. - @constant kCCParamError Illegal parameter value. + @enum CCCryptorStatus + @abstract Return values from CommonCryptor operations. + + @constant kCCSuccess Operation completed normally. + @constant kCCParamError Illegal parameter value. @constant kCCBufferTooSmall Insufficent buffer provided for specified operation. - @constant kCCMemoryFailure Memory allocation failure. - @constant kCCAlignmentError Input size was not aligned properly. + @constant kCCMemoryFailure Memory allocation failure. + @constant kCCAlignmentError Input size was not aligned properly. @constant kCCDecodeError Input data did not decode or decrypt properly. @constant kCCUnimplemented Function not implemented for the current algorithm. */ enum { - kCCSuccess = 0, - kCCParamError = -4300, - kCCBufferTooSmall = -4301, - kCCMemoryFailure = -4302, - kCCAlignmentError = -4303, - kCCDecodeError = -4304, - kCCUnimplemented = -4305 + kCCSuccess = 0, + kCCParamError = -4300, + kCCBufferTooSmall = -4301, + kCCMemoryFailure = -4302, + kCCAlignmentError = -4303, + kCCDecodeError = -4304, + kCCUnimplemented = -4305, + kCCOverflow = -4306 }; typedef int32_t CCCryptorStatus; /*! - @enum CCOperation - @abstract Operations that an CCCryptor can perform. - - @constant kCCEncrypt Symmetric encryption. - @constant kCCDecrypt Symmetric decryption. + @enum CCOperation + @abstract Operations that an CCCryptor can perform. + + @constant kCCEncrypt Symmetric encryption. + @constant kCCDecrypt Symmetric decryption. */ enum { - kCCEncrypt = 0, - kCCDecrypt, + kCCEncrypt = 0, + kCCDecrypt, }; typedef uint32_t CCOperation; /*! - @enum CCAlgorithm - @abstract Encryption algorithms implemented by this module. - - @constant kCCAlgorithmAES128 Advanced Encryption Standard, 128-bit block - @constant kCCAlgorithmDES Data Encryption Standard - @constant kCCAlgorithm3DES Triple-DES, three key, EDE configuration - @constant kCCAlgorithmCAST CAST - @constant kCCAlgorithmRC4 RC4 stream cipher + @enum CCAlgorithm + @abstract Encryption algorithms implemented by this module. + + @constant kCCAlgorithmAES128 Advanced Encryption Standard, 128-bit block + @constant kCCAlgorithmDES Data Encryption Standard + @constant kCCAlgorithm3DES Triple-DES, three key, EDE configuration + @constant kCCAlgorithmCAST CAST + @constant kCCAlgorithmRC4 RC4 stream cipher + @constant kCCAlgorithmBlowfish Blowfish block cipher */ enum { - kCCAlgorithmAES128 = 0, - kCCAlgorithmDES, - kCCAlgorithm3DES, - kCCAlgorithmCAST, - kCCAlgorithmRC4, - kCCAlgorithmRC2 + kCCAlgorithmAES128 = 0, + kCCAlgorithmDES, + kCCAlgorithm3DES, + kCCAlgorithmCAST, + kCCAlgorithmRC4, + kCCAlgorithmRC2, + kCCAlgorithmBlowfish }; typedef uint32_t CCAlgorithm; /*! - @enum CCOptions - @abstract Options flags, passed to CCCryptorCreate(). - - @constant kCCOptionPKCS7Padding Perform PKCS7 padding. - @constant kCCOptionECBMode Electronic Code Book Mode. - Default is CBC. + @enum CCOptions + @abstract Options flags, passed to CCCryptorCreate(). + + @constant kCCOptionPKCS7Padding Perform PKCS7 padding. + @constant kCCOptionECBMode Electronic Code Book Mode. + Default is CBC. */ enum { - /* options for block ciphers */ - kCCOptionPKCS7Padding = 0x0001, - kCCOptionECBMode = 0x0002 - /* stream ciphers currently have no options */ + /* options for block ciphers */ + kCCOptionPKCS7Padding = 0x0001, + kCCOptionECBMode = 0x0002 + /* stream ciphers currently have no options */ }; typedef uint32_t CCOptions; /*! - @enum Key sizes - - @discussion Key sizes, in bytes, for supported algorithms. - - @constant kCCKeySizeAES128 128 bit AES key size. - @constant kCCKeySizeAES192 192 bit AES key size. - @constant kCCKeySizeAES256 256 bit AES key size. - @constant kCCKeySizeDES DES key size. - @constant kCCKeySize3DES Triple DES key size. - @constant kCCKeySizeMinCAST CAST minimum key size. - @constant kCCKeySizeMaxCAST CAST maximum key size. - @constant kCCKeySizeMinRC4 RC4 minimum key size. - @constant kCCKeySizeMaxRC4 RC4 maximum key size. - - @discussion DES and TripleDES have fixed key sizes. - AES has three discrete key sizes. - CAST and RC4 have variable key sizes. -*/ -enum { - kCCKeySizeAES128 = 16, - kCCKeySizeAES192 = 24, - kCCKeySizeAES256 = 32, - kCCKeySizeDES = 8, - kCCKeySize3DES = 24, - kCCKeySizeMinCAST = 5, - kCCKeySizeMaxCAST = 16, - kCCKeySizeMinRC4 = 1, - kCCKeySizeMaxRC4 = 512, - kCCKeySizeMinRC2 = 1, - kCCKeySizeMaxRC2 = 128 -}; - -/*! - @enum Block sizes - - @discussion Block sizes, in bytes, for supported algorithms. - - @constant kCCBlockSizeAES128 AES block size (currently, only 128-bit - blocks are supported). - @constant kCCBlockSizeDES DES block size. - @constant kCCBlockSize3DES Triple DES block size. - @constant kCCBlockSizeCAST CAST block size. -*/ -enum { - /* AES */ - kCCBlockSizeAES128 = 16, - /* DES */ - kCCBlockSizeDES = 8, - /* 3DES */ - kCCBlockSize3DES = 8, - /* CAST */ - kCCBlockSizeCAST = 8, - kCCBlockSizeRC2 = 8, -}; - -/*! - @enum Minimum context sizes - @discussion Minimum context sizes, for caller-allocated CCCryptorRefs. - To minimize dynamic allocation memory, a caller can create - a CCCryptorRef by passing caller-supplied memory to the - CCCryptorCreateFromData() function. - - These constants define the minimum amount of memory, in - bytes, needed for CCCryptorRefs for each supported algorithm. - - Note: these constants are valid for the current version of - this library; they may change in subsequent releases, so - applications wishing to allocate their own memory for use - in creating CCCryptorRefs must be prepared to deal with - a kCCBufferTooSmall return from CCCryptorCreateFromData(). - See discussion for the CCCryptorCreateFromData() function. - + @enum Key sizes + + @discussion Key sizes, in bytes, for supported algorithms. + + @constant kCCKeySizeAES128 128 bit AES key size. + @constant kCCKeySizeAES192 192 bit AES key size. + @constant kCCKeySizeAES256 256 bit AES key size. + @constant kCCKeySizeDES DES key size. + @constant kCCKeySize3DES Triple DES key size. + @constant kCCKeySizeMinCAST CAST minimum key size. + @constant kCCKeySizeMaxCAST CAST maximum key size. + @constant kCCKeySizeMinRC4 RC4 minimum key size. + @constant kCCKeySizeMaxRC4 RC4 maximum key size. + + @discussion DES and TripleDES have fixed key sizes. + AES has three discrete key sizes. + CAST and RC4 have variable key sizes. +*/ +enum { + kCCKeySizeAES128 = 16, + kCCKeySizeAES192 = 24, + kCCKeySizeAES256 = 32, + kCCKeySizeDES = 8, + kCCKeySize3DES = 24, + kCCKeySizeMinCAST = 5, + kCCKeySizeMaxCAST = 16, + kCCKeySizeMinRC4 = 1, + kCCKeySizeMaxRC4 = 512, + kCCKeySizeMinRC2 = 1, + kCCKeySizeMaxRC2 = 128, + kCCKeySizeMinBlowfish = 8, + kCCKeySizeMaxBlowfish = 56, +}; + +/*! + @enum Block sizes + + @discussion Block sizes, in bytes, for supported algorithms. + + @constant kCCBlockSizeAES128 AES block size (currently, only 128-bit + blocks are supported). + @constant kCCBlockSizeDES DES block size. + @constant kCCBlockSize3DES Triple DES block size. + @constant kCCBlockSizeCAST CAST block size. +*/ +enum { + /* AES */ + kCCBlockSizeAES128 = 16, + /* DES */ + kCCBlockSizeDES = 8, + /* 3DES */ + kCCBlockSize3DES = 8, + /* CAST */ + kCCBlockSizeCAST = 8, + kCCBlockSizeRC2 = 8, + kCCBlockSizeBlowfish = 8, +}; + +/*! + @enum Minimum context sizes + @discussion Minimum context sizes, for caller-allocated CCCryptorRefs. + To minimize dynamic allocation memory, a caller can create + a CCCryptorRef by passing caller-supplied memory to the + CCCryptorCreateFromData() function. + + These constants define the minimum amount of memory, in + bytes, needed for CCCryptorRefs for each supported algorithm. + + Note: these constants are valid for the current version of + this library; they may change in subsequent releases, so + applications wishing to allocate their own memory for use + in creating CCCryptorRefs must be prepared to deal with + a kCCBufferTooSmall return from CCCryptorCreateFromData(). + See discussion for the CCCryptorCreateFromData() function. + @constant kCCContextSizeAES128 - Minimum context size for kCCAlgorithmAES128. @constant kCCContextSizeDES - Minimum context size for kCCAlgorithmDES. @constant kCCContextSize3DES - Minimum context size for kCCAlgorithm3DES. @constant kCCContextSizeCAST - Minimum context size for kCCAlgorithmCAST. @constant kCCContextSizeRC4 - Minimum context size for kCCAlgorithmRC4. */ enum { - kCCContextSizeGENERIC = 4096, - kCCContextSizeAES128 = 4096, - kCCContextSizeDES = 4096, - kCCContextSize3DES = 4096, - kCCContextSizeCAST = 4096, - kCCContextSizeRC4 = 4096 -}; - - - -/*! - @function CCCryptorCreate - @abstract Create a cryptographic context. - - @param op Defines the basic operation: kCCEncrypt or - kCCDecrypt. - - @param alg Defines the algorithm. - - @param options A word of flags defining options. See discussion - for the CCOptions type. - - @param key Raw key material, length keyLength bytes. - - @param keyLength Length of key material. Must be appropriate - for the selected operation and algorithm. Some - algorithms provide for varying key lengths. - - @param iv Initialization vector, optional. Used by - block ciphers when Cipher Block Chaining (CBC) - mode is enabled. If present, must be the same - length as the selected algorithm's block size. - If CBC mode is selected (by the absence of the - kCCOptionECBMode bit in the options flags) and no - IV is present, a NULL (all zeroes) IV will be used. - This parameter is ignored if ECB mode is used or - if a stream cipher algorithm is selected. - - @param cryptorRef A (required) pointer to the returned CCCryptorRef. - - @result Possible error returns are kCCParamError and kCCMemoryFailure. -*/ -CCCryptorStatus CCCryptorCreate( - CCOperation op, /* kCCEncrypt, etc. */ - CCAlgorithm alg, /* kCCAlgorithmDES, etc. */ - CCOptions options, /* kCCOptionPKCS7Padding, etc. */ - const void *key, /* raw key material */ - size_t keyLength, - const void *iv, /* optional initialization vector */ - CCCryptorRef *cryptorRef) /* RETURNED */ -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); - -/*! - @function CCCryptorCreateFromData - @abstract Create a cryptographic context using caller-supplied memory. - - @param op Defines the basic operation: kCCEncrypt or - kCCDecrypt. - - @param alg Defines the algorithm. - - @param options A word of flags defining options. See discussion - for the CCOptions type. - - @param key Raw key material, length keyLength bytes. - - @param keyLength Length of key material. Must be appropriate - for the selected operation and algorithm. Some - algorithms provide for varying key lengths. - - @param iv Initialization vector, optional. Used by - block ciphers when Cipher Block Chaining (CBC) - mode is enabled. If present, must be the same - length as the selected algorithm's block size. - If CBC mode is selected (by the absence of the - kCCOptionECBMode bit in the options flags) and no - IV is present, a NULL (all zeroes) IV will be used. - This parameter is ignored if ECB mode is used or - if a stream cipher algorithm is selected. - - @param data A pointer to caller-supplied memory from which the - CCCryptorRef will be created. - - @param dataLength The size of the caller-supplied memory in bytes. - - @param cryptorRef A (required) pointer to the returned CCCryptorRef. - - @param dataUsed Optional. If present, the actual number of bytes of - the caller-supplied memory which was consumed by - creation of the CCCryptorRef is returned here. Also, - if the supplied memory is of insufficent size to create - a CCCryptorRef, kCCBufferTooSmall is returned, and - the minimum required buffer size is returned via this - parameter if present. - - @result Possible error returns are kCCParamError and kCCBufferTooSmall. - - @discussion The CCCryptorRef created by this function *may* be disposed of - via CCCRyptorRelease; that call is not strictly necessary, but - if it's not performed, good security practice dictates that the - caller should zero the memory provided to create the CCCryptorRef - when the caller is finished using the CCCryptorRef. -*/ -CCCryptorStatus CCCryptorCreateFromData( - CCOperation op, /* kCCEncrypt, etc. */ - CCAlgorithm alg, /* kCCAlgorithmDES, etc. */ - CCOptions options, /* kCCOptionPKCS7Padding, etc. */ - const void *key, /* raw key material */ - size_t keyLength, - const void *iv, /* optional initialization vector */ - const void *data, /* caller-supplied memory */ - size_t dataLength, /* length of data in bytes */ - CCCryptorRef *cryptorRef, /* RETURNED */ - size_t *dataUsed) /* optional, RETURNED */ -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); - -/*! - @function CCCryptorRelease - @abstract Free a context created by CCCryptorCreate or - CCCryptorCreateFromData(). - - @param cryptorRef The CCCryptorRef to release. - - @result The only possible error return is kCCParamError resulting - from passing in a null CCCryptorRef. + kCCContextSizeAES128 = 404, + kCCContextSizeDES = 240, + kCCContextSize3DES = 496, + kCCContextSizeCAST = 240, + kCCContextSizeRC4 = 1072 +}; + + + +/*! + @function CCCryptorCreate + @abstract Create a cryptographic context. + + @param op Defines the basic operation: kCCEncrypt or + kCCDecrypt. + + @param alg Defines the algorithm. + + @param options A word of flags defining options. See discussion + for the CCOptions type. + + @param key Raw key material, length keyLength bytes. + + @param keyLength Length of key material. Must be appropriate + for the selected operation and algorithm. Some + algorithms provide for varying key lengths. + + @param iv Initialization vector, optional. Used by + block ciphers when Cipher Block Chaining (CBC) + mode is enabled. If present, must be the same + length as the selected algorithm's block size. + If CBC mode is selected (by the absence of the + kCCOptionECBMode bit in the options flags) and no + IV is present, a NULL (all zeroes) IV will be used. + This parameter is ignored if ECB mode is used or + if a stream cipher algorithm is selected. + + @param cryptorRef A (required) pointer to the returned CCCryptorRef. + + @result Possible error returns are kCCParamError and kCCMemoryFailure. +*/ +CCCryptorStatus CCCryptorCreate( + CCOperation op, /* kCCEncrypt, etc. */ + CCAlgorithm alg, /* kCCAlgorithmDES, etc. */ + CCOptions options, /* kCCOptionPKCS7Padding, etc. */ + const void *key, /* raw key material */ + size_t keyLength, + const void *iv, /* optional initialization vector */ + CCCryptorRef *cryptorRef) /* RETURNED */ +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_4_0); + +/*! + @function CCCryptorCreateFromData + @abstract Create a cryptographic context using caller-supplied memory. + + @param op Defines the basic operation: kCCEncrypt or + kCCDecrypt. + + @param alg Defines the algorithm. + + @param options A word of flags defining options. See discussion + for the CCOptions type. + + @param key Raw key material, length keyLength bytes. + + @param keyLength Length of key material. Must be appropriate + for the selected operation and algorithm. Some + algorithms provide for varying key lengths. + + @param iv Initialization vector, optional. Used by + block ciphers when Cipher Block Chaining (CBC) + mode is enabled. If present, must be the same + length as the selected algorithm's block size. + If CBC mode is selected (by the absence of the + kCCOptionECBMode bit in the options flags) and no + IV is present, a NULL (all zeroes) IV will be used. + This parameter is ignored if ECB mode is used or + if a stream cipher algorithm is selected. + + @param data A pointer to caller-supplied memory from which the + CCCryptorRef will be created. + + @param dataLength The size of the caller-supplied memory in bytes. + + @param cryptorRef A (required) pointer to the returned CCCryptorRef. + + @param dataUsed Optional. If present, the actual number of bytes of + the caller-supplied memory which was consumed by + creation of the CCCryptorRef is returned here. Also, + if the supplied memory is of insufficent size to create + a CCCryptorRef, kCCBufferTooSmall is returned, and + the minimum required buffer size is returned via this + parameter if present. + + @result Possible error returns are kCCParamError and kCCBufferTooSmall. + + @discussion The CCCryptorRef created by this function *may* be disposed of + via CCCRyptorRelease; that call is not strictly necessary, but + if it's not performed, good security practice dictates that the + caller should zero the memory provided to create the CCCryptorRef + when the caller is finished using the CCCryptorRef. +*/ +CCCryptorStatus CCCryptorCreateFromData( + CCOperation op, /* kCCEncrypt, etc. */ + CCAlgorithm alg, /* kCCAlgorithmDES, etc. */ + CCOptions options, /* kCCOptionPKCS7Padding, etc. */ + const void *key, /* raw key material */ + size_t keyLength, + const void *iv, /* optional initialization vector */ + const void *data, /* caller-supplied memory */ + size_t dataLength, /* length of data in bytes */ + CCCryptorRef *cryptorRef, /* RETURNED */ + size_t *dataUsed) /* optional, RETURNED */ +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_4_0); + +/*! + @function CCCryptorRelease + @abstract Free a context created by CCCryptorCreate or + CCCryptorCreateFromData(). + + @param cryptorRef The CCCryptorRef to release. + + @result The only possible error return is kCCParamError resulting + from passing in a null CCCryptorRef. */ CCCryptorStatus CCCryptorRelease( CCCryptorRef cryptorRef) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); - +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_4_0); + /*! - @function CCCryptorUpdate - @abstract Process (encrypt, decrypt) some data. The result, if any, - is written to a caller-provided buffer. - - @param cryptorRef A CCCryptorRef created via CCCryptorCreate() or - CCCryptorCreateFromData(). - @param dataIn Data to process, length dataInLength bytes. - @param dataInLength Length of data to process. - @param dataOut Result is written here. Allocated by caller. - Encryption and decryption can be performed - "in-place", with the same buffer used for - input and output. - @param dataOutAvailable The size of the dataOut buffer in bytes. - @param dataOutMoved On successful return, the number of bytes written - to dataOut. - - @result kCCBufferTooSmall indicates insufficent space in the dataOut - buffer. The caller can use CCCryptorGetOutputLength() - to determine the required output buffer size in this - case. The operation can be retried; no state is lost - when this is returned. - - @discussion This routine can be called multiple times. The caller does - not need to align input data lengths to block sizes; input is - bufferred as necessary for block ciphers. - - When performing symmetric encryption with block ciphers, - and padding is enabled via kCCOptionPKCS7Padding, the total - number of bytes provided by all the calls to this function - when encrypting can be arbitrary (i.e., the total number - of bytes does not have to be block aligned). However if - padding is disabled, or when decrypting, the total number - of bytes does have to be aligned to the block size; otherwise - CCCryptFinal() will return kCCAlignmentError. - - A general rule for the size of the output buffer which must be - provided by the caller is that for block ciphers, the output - length is never larger than the input length plus the block size. - For stream ciphers, the output length is always exactly the same - as the input length. See the discussion for CCCryptorGetOutputLength() - for more information on this topic. - - Generally, when all data has been processed, call CCCryptorFinal(). - In the following cases, the CCCryptorFinal() is superfluous as - it will not yield any data nor return an error: - 1. Encrypting or decrypting with a block cipher with padding - disabled, when the total amount of data provided to - CCCryptorUpdate() is an integral multiple of the block size. - 2. Encrypting or decrypting with a stream cipher. + @function CCCryptorUpdate + @abstract Process (encrypt, decrypt) some data. The result, if any, + is written to a caller-provided buffer. + + @param cryptorRef A CCCryptorRef created via CCCryptorCreate() or + CCCryptorCreateFromData(). + @param dataIn Data to process, length dataInLength bytes. + @param dataInLength Length of data to process. + @param dataOut Result is written here. Allocated by caller. + Encryption and decryption can be performed + "in-place", with the same buffer used for + input and output. + @param dataOutAvailable The size of the dataOut buffer in bytes. + @param dataOutMoved On successful return, the number of bytes + written to dataOut. + + @result kCCBufferTooSmall indicates insufficent space in the dataOut + buffer. The caller can use + CCCryptorGetOutputLength() to determine the + required output buffer size in this case. The + operation can be retried; no state is lost + when this is returned. + + @discussion This routine can be called multiple times. The caller does + not need to align input data lengths to block sizes; input is + bufferred as necessary for block ciphers. + + When performing symmetric encryption with block ciphers, + and padding is enabled via kCCOptionPKCS7Padding, the total + number of bytes provided by all the calls to this function + when encrypting can be arbitrary (i.e., the total number + of bytes does not have to be block aligned). However if + padding is disabled, or when decrypting, the total number + of bytes does have to be aligned to the block size; otherwise + CCCryptFinal() will return kCCAlignmentError. + + A general rule for the size of the output buffer which must be + provided by the caller is that for block ciphers, the output + length is never larger than the input length plus the block size. + For stream ciphers, the output length is always exactly the same + as the input length. See the discussion for + CCCryptorGetOutputLength() for more information on this topic. + + Generally, when all data has been processed, call + CCCryptorFinal(). + + In the following cases, the CCCryptorFinal() is superfluous as + it will not yield any data nor return an error: + 1. Encrypting or decrypting with a block cipher with padding + disabled, when the total amount of data provided to + CCCryptorUpdate() is an integral multiple of the block size. + 2. Encrypting or decrypting with a stream cipher. */ CCCryptorStatus CCCryptorUpdate( - CCCryptorRef cryptorRef, - const void *dataIn, - size_t dataInLength, - void *dataOut, /* data RETURNED here */ - size_t dataOutAvailable, + CCCryptorRef cryptorRef, + const void *dataIn, + size_t dataInLength, + void *dataOut, /* data RETURNED here */ + size_t dataOutAvailable, size_t *dataOutMoved) /* number of bytes written */ -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_4_0); /*! - @function CCCryptorFinal - @abstract Finish an encrypt or decrypt operation, and obtain the (possible) - final data output. - - @param cryptorRef A CCCryptorRef created via CCCryptorCreate() or - CCCryptorCreateFromData(). - @param dataOut Result is written here. Allocated by caller. - @param dataOutAvailable The size of the dataOut buffer in bytes. - @param dataOutMoved On successful return, the number of bytes written - to dataOut. - - @result kCCBufferTooSmall indicates insufficent space in the dataOut - buffer. The caller can use CCCryptorGetOutputLength() - to determine the required output buffer size in this - case. The operation can be retried; no state is lost - when this is returned. - kCCAlignmentError When decrypting, or when encrypting with a - block cipher with padding disabled, - kCCAlignmentError will be returned if the total - number of bytes provided to CCCryptUpdate() is - not an integral multiple of the current - algorithm's block size. - kCCDecodeError Indicates garbled ciphertext or the - wrong key during decryption. This can only - be returned while decrypting with padding - enabled. - - @discussion Except when kCCBufferTooSmall is returned, the CCCryptorRef - can no longer be used for subsequent operations unless - CCCryptorReset() is called on it. - - It is not necessary to call CCCryptorFinal() when performing - symmetric encryption or decryption if padding is disabled, or - when using a stream cipher. - - It is not necessary to call CCCryptorFinal() prior to - CCCryptorRelease() when aborting an operation. + @function CCCryptorFinal + @abstract Finish an encrypt or decrypt operation, and obtain the (possible) + final data output. + + @param cryptorRef A CCCryptorRef created via CCCryptorCreate() or + CCCryptorCreateFromData(). + @param dataOut Result is written here. Allocated by caller. + @param dataOutAvailable The size of the dataOut buffer in bytes. + @param dataOutMoved On successful return, the number of bytes + written to dataOut. + + @result kCCBufferTooSmall indicates insufficent space in the dataOut + buffer. The caller can use + CCCryptorGetOutputLength() to determine the + required output buffer size in this case. The + operation can be retried; no state is lost + when this is returned. + kCCAlignmentError When decrypting, or when encrypting with a + block cipher with padding disabled, + kCCAlignmentError will be returned if the total + number of bytes provided to CCCryptUpdate() is + not an integral multiple of the current + algorithm's block size. + kCCDecodeError Indicates garbled ciphertext or the + wrong key during decryption. This can only + be returned while decrypting with padding + enabled. + + @discussion Except when kCCBufferTooSmall is returned, the CCCryptorRef + can no longer be used for subsequent operations unless + CCCryptorReset() is called on it. + + It is not necessary to call CCCryptorFinal() when performing + symmetric encryption or decryption if padding is disabled, or + when using a stream cipher. + + It is not necessary to call CCCryptorFinal() prior to + CCCryptorRelease() when aborting an operation. */ CCCryptorStatus CCCryptorFinal( - CCCryptorRef cryptorRef, - void *dataOut, - size_t dataOutAvailable, + CCCryptorRef cryptorRef, + void *dataOut, + size_t dataOutAvailable, size_t *dataOutMoved) /* number of bytes written */ -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_4_0); /*! - @function CCCryptorGetOutputLength - @abstract Determine output buffer size required to process a given input size. - - @param cryptorRef A CCCryptorRef created via CCCryptorCreate() or - CCCryptorCreateFromData(). - @param inputLength The length of data which will be provided to - CCCryptorUpdate(). - @param final If false, the returned value will indicate the output - buffer space needed when 'inputLength' bytes are - provided to CCCryptorUpdate(). When 'final' is true, - the returned value will indicate the total combined - buffer space needed when 'inputLength' bytes are - provided to CCCryptorUpdate() and then CCCryptorFinal() - is called. - - @result The maximum buffer space need to perform CCCryptorUpdate() and optionally - CCCryptorFinal(). - - @discussion Some general rules apply that allow clients of this module to - know a priori how much output buffer space will be required - in a given situation. For stream ciphers, the output size is - always equal to the input size, and CCCryptorFinal() never - produces any data. For block ciphers, the output size will - always be less than or equal to the input size plus the size - of one block. For block ciphers, if the input size provided - to each call to CCCryptorUpdate() is is an integral multiple - of the block size, then the output size for each call to - CCCryptorUpdate() is less than or equal to the input size - for that call to CCCryptorUpdate(). CCCryptorFinal() only - produces output when using a block cipher with padding enabled. + @function CCCryptorGetOutputLength + @abstract Determine output buffer size required to process a given input + size. + + @param cryptorRef A CCCryptorRef created via CCCryptorCreate() or + CCCryptorCreateFromData(). + @param inputLength The length of data which will be provided to + CCCryptorUpdate(). + @param final If false, the returned value will indicate the + output buffer space needed when 'inputLength' + bytes are provided to CCCryptorUpdate(). When + 'final' is true, the returned value will indicate + the total combined buffer space needed when + 'inputLength' bytes are provided to + CCCryptorUpdate() and then CCCryptorFinal() is + called. + + @result The maximum buffer space need to perform CCCryptorUpdate() and + optionally CCCryptorFinal(). + + @discussion Some general rules apply that allow clients of this module to + know a priori how much output buffer space will be required + in a given situation. For stream ciphers, the output size is + always equal to the input size, and CCCryptorFinal() never + produces any data. For block ciphers, the output size will + always be less than or equal to the input size plus the size + of one block. For block ciphers, if the input size provided + to each call to CCCryptorUpdate() is is an integral multiple + of the block size, then the output size for each call to + CCCryptorUpdate() is less than or equal to the input size + for that call to CCCryptorUpdate(). CCCryptorFinal() only + produces output when using a block cipher with padding enabled. */ size_t CCCryptorGetOutputLength( - CCCryptorRef cryptorRef, - size_t inputLength, + CCCryptorRef cryptorRef, + size_t inputLength, bool final) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_4_0); - + /*! - @function CCCryptorReset - @abstract Reinitializes an existing CCCryptorRef with a (possibly) - new initialization vector. The CCCryptorRef's key is - unchanged. Not implemented for stream ciphers. - - @param cryptorRef A CCCryptorRef created via CCCryptorCreate() or - CCCryptorCreateFromData(). - @param iv Optional initialization vector; if present, must - be the same size as the current algorithm's block - size. - - @result The the only possible errors are kCCParamError and - kCCUnimplemented. - - @discussion This can be called on a CCCryptorRef with data pending (i.e. - in a padded mode operation before CCCryptFinal is called); - however any pending data will be lost in that case. + @function CCCryptorReset + @abstract Reinitializes an existing CCCryptorRef with a (possibly) + new initialization vector. The CCCryptorRef's key is + unchanged. Not implemented for stream ciphers. + + @param cryptorRef A CCCryptorRef created via CCCryptorCreate() or + CCCryptorCreateFromData(). + @param iv Optional initialization vector; if present, must + be the same size as the current algorithm's block + size. + + @result The the only possible errors are kCCParamError and + kCCUnimplemented. + + @discussion This can be called on a CCCryptorRef with data pending (i.e. + in a padded mode operation before CCCryptFinal is called); + however any pending data will be lost in that case. */ CCCryptorStatus CCCryptorReset( - CCCryptorRef cryptorRef, + CCCryptorRef cryptorRef, const void *iv) - __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); + __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_4_0); + + +/*! + @function CCCrypt + @abstract Stateless, one-shot encrypt or decrypt operation. + This basically performs a sequence of CCCrytorCreate(), + CCCryptorUpdate(), CCCryptorFinal(), and CCCryptorRelease(). + + @param alg Defines the encryption algorithm. + + + @param op Defines the basic operation: kCCEncrypt or + kCCDecrypt. + + @param options A word of flags defining options. See discussion + for the CCOptions type. + + @param key Raw key material, length keyLength bytes. + + @param keyLength Length of key material. Must be appropriate + for the select algorithm. Some algorithms may + provide for varying key lengths. + + @param iv Initialization vector, optional. Used for + Cipher Block Chaining (CBC) mode. If present, + must be the same length as the selected + algorithm's block size. If CBC mode is + selected (by the absence of any mode bits in + the options flags) and no IV is present, a + NULL (all zeroes) IV will be used. This is + ignored if ECB mode is used or if a stream + cipher algorithm is selected. + + @param dataIn Data to encrypt or decrypt, length dataInLength + bytes. + + @param dataInLength Length of data to encrypt or decrypt. + + @param dataOut Result is written here. Allocated by caller. + Encryption and decryption can be performed + "in-place", with the same buffer used for + input and output. + + @param dataOutAvailable The size of the dataOut buffer in bytes. + + @param dataOutMoved On successful return, the number of bytes + written to dataOut. If kCCBufferTooSmall is + returned as a result of insufficient buffer + space being provided, the required buffer space + is returned here. + + @result kCCBufferTooSmall indicates insufficent space in the dataOut + buffer. In this case, the *dataOutMoved + parameter will indicate the size of the buffer + needed to complete the operation. The + operation can be retried with minimal runtime + penalty. + kCCAlignmentError indicates that dataInLength was not properly + aligned. This can only be returned for block + ciphers, and then only when decrypting or when + encrypting with block with padding disabled. + kCCDecodeError Indicates improperly formatted ciphertext or + a "wrong key" error; occurs only during decrypt + operations. + */ + +CCCryptorStatus CCCrypt( + CCOperation op, /* kCCEncrypt, etc. */ + CCAlgorithm alg, /* kCCAlgorithmAES128, etc. */ + CCOptions options, /* kCCOptionPKCS7Padding, etc. */ + const void *key, + size_t keyLength, + const void *iv, /* optional initialization vector */ + const void *dataIn, /* optional per op and alg */ + size_t dataInLength, + void *dataOut, /* data RETURNED here */ + size_t dataOutAvailable, + size_t *dataOutMoved) + __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_4_0); + + +/*! + @enum Cipher Modes + @discussion These are the selections available for modes of operation for + use with block ciphers. If RC4 is selected as the cipher (a stream + cipher) the only correct mode is kCCModeRC4. + + @constant kCCModeECB - Electronic Code Book Mode. + @constant kCCModeCBC - Cipher Block Chaining Mode. + @constant kCCModeCFB - Cipher Feedback Mode. + @constant kCCModeOFB - Output Feedback Mode. + @constant kCCModeXTS - XEX-based Tweaked CodeBook Mode. + @constant kCCModeRC4 - RC4 as a streaming cipher is handled internally as a mode. + @constant kCCModeCFB8 - Cipher Feedback Mode producing 8 bits per round. +*/ + + +enum { + kCCModeECB = 1, + kCCModeCBC = 2, + kCCModeCFB = 3, + kCCModeCTR = 4, + kCCModeF8 = 5, // Unimplemented for now (not included) + kCCModeLRW = 6, // Unimplemented for now (not included) + kCCModeOFB = 7, + kCCModeXTS = 8, + kCCModeRC4 = 9, + kCCModeCFB8 = 10, +}; +typedef uint32_t CCMode; + +/*! + @enum Padding for Block Ciphers + @discussion These are the padding options available for block modes. + + @constant ccNoPadding - No padding. + @constant ccPKCS7Padding - PKCS7 Padding. +*/ + +enum { + ccNoPadding = 0, + ccPKCS7Padding = 1, +}; +typedef uint32_t CCPadding; + +/*! + @enum Mode options - so far only used for CTR mode + @discussion Values used to specify options for modes. + + @constant kCCModeOptionCTR_LE - CTR Mode Little Endian. + @constant kCCModeOptionCTR_BE - CTR Mode Big Endian. +*/ + +enum { + kCCModeOptionCTR_LE = 0x0001, + kCCModeOptionCTR_BE = 0x0002 +}; +typedef uint32_t CCModeOptions; /*! - @function CCCrypt - @abstract Stateless, one-shot encrypt or decrypt operation. - This basically performs a sequence of CCCrytorCreate(), - CCCryptorUpdate(), CCCryptorFinal(), and CCCryptorRelease(). - - @param alg Defines the encryption algorithm. - - - @param op Defines the basic operation: kCCEncrypt or kCCDecrypt. - - @param options A word of flags defining options. See discussion - for the CCOptions type. - - @param key Raw key material, length keyLength bytes. - - @param keyLength Length of key material. Must be appropriate - for the select algorithm. Some algorithms may - provide for varying key lengths. - - @param iv Initialization vector, optional. Used for - Cipher Block Chaining (CBC) mode. If present, - must be the same length as the selected - algorithm's block size. If CBC mode is - selected (by the absence of any mode bits in - the options flags) and no IV is present, a - NULL (all zeroes) IV will be used. This is - ignored if ECB mode is used or if a stream - cipher algorithm is selected. - - @param dataIn Data to encrypt or decrypt, length dataInLength - bytes. - - @param dataInLength Length of data to encrypt or decrypt. - - @param dataOut Result is written here. Allocated by caller. - Encryption and decryption can be performed - "in-place", with the same buffer used for - input and output. - - @param dataOutAvailable The size of the dataOut buffer in bytes. - - @param dataOutMoved On successful return, the number of bytes written - to dataOut. If kCCBufferTooSmall is returned as - a result of insufficient buffer space being - provided, the required buffer space is returned - here. - - @result kCCBufferTooSmall indicates insufficent space in the dataOut - buffer. In this case, the *dataOutMoved - parameter will indicate the size of the buffer - needed to complete the operation. The - operation can be retried with minimal runtime - penalty. - kCCAlignmentError indicates that dataInLength was not properly - aligned. This can only be returned for block - ciphers, and then only when decrypting or when - encrypting with block with padding disabled. - kCCDecodeError Indicates improperly formatted ciphertext or - a "wrong key" error; occurs only during decrypt - operations. + @function CCCryptorCreateWithMode + @abstract Create a cryptographic context. + + @param op Defines the basic operation: kCCEncrypt or + kCCDecrypt. + + @param mode Specifies the cipher mode to use for operations. + + @param alg Defines the algorithm. + + @param padding Specifies the padding to use. + + @param iv Initialization vector, optional. Used by + block ciphers with the following modes: + + Cipher Block Chaining (CBC) + Cipher Feedback (CFB and CFB8) + Output Feedback (OFB) + Counter (CTR) + + If present, must be the same length as the selected + algorithm's block size. If no IV is present, a NULL + (all zeroes) IV will be used. + + This parameter is ignored if ECB mode is used or + if a stream cipher algorithm is selected. + + @param key Raw key material, length keyLength bytes. + + @param keyLength Length of key material. Must be appropriate + for the selected operation and algorithm. Some + algorithms provide for varying key lengths. + + @param tweak Raw key material, length keyLength bytes. Used for the + tweak key in XEX-based Tweaked CodeBook (XTS) mode. + + @param tweakLength Length of tweak key material. Must be appropriate + for the selected operation and algorithm. Some + algorithms provide for varying key lengths. For XTS + this is the same length as the encryption key. + + @param numRounds The number of rounds of the cipher to use. 0 uses the default. + + @param options A word of flags defining options. See discussion + for the CCModeOptions type. + + @param cryptorRef A (required) pointer to the returned CCCryptorRef. + + @result Possible error returns are kCCParamError and kCCMemoryFailure. */ -CCCryptorStatus CCCrypt( - CCOperation op, /* kCCEncrypt, etc. */ - CCAlgorithm alg, /* kCCAlgorithmAES128, etc. */ - CCOptions options, /* kCCOptionPKCS7Padding, etc. */ - const void *key, - size_t keyLength, - const void *iv, /* optional initialization vector */ - const void *dataIn, /* optional per op and alg */ - size_t dataInLength, - void *dataOut, /* data RETURNED here */ - size_t dataOutAvailable, - size_t *dataOutMoved) - __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); - - + + +CCCryptorStatus CCCryptorCreateWithMode( + CCOperation op, /* kCCEncrypt, kCCEncrypt */ + CCMode mode, + CCAlgorithm alg, + CCPadding padding, + const void *iv, /* optional initialization vector */ + const void *key, /* raw key material */ + size_t keyLength, + const void *tweak, /* raw tweak material */ + size_t tweakLength, + int numRounds, /* 0 == default */ + CCModeOptions options, + CCCryptorRef *cryptorRef) /* RETURNED */ +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + #ifdef __cplusplus } #endif -#endif /* _CC_COMMON_CRYPTOR_ */ +#endif /* _CC_COMMON_CRYPTOR_ */ Index: CommonCrypto/CommonDigest.h ================================================================== --- CommonCrypto/CommonDigest.h +++ CommonCrypto/CommonDigest.h @@ -23,11 +23,11 @@ /* * CommonDigest.h - common digest routines: MD2, MD4, MD5, SHA1. */ -#ifndef _CC_COMMON_DIGEST_H_ +#ifndef _CC_COMMON_DIGEST_H_ #define _CC_COMMON_DIGEST_H_ #include #include @@ -49,203 +49,203 @@ * Unlike the opensssl counterparts, these one-shot functions require * a non-NULL md pointer. Passing in NULL for the md parameter * results in a NULL return and no digest calculation. */ -typedef uint32_t CC_LONG; /* 32 bit unsigned integer */ -typedef uint64_t CC_LONG64; /* 64 bit unsigned integer */ +typedef uint32_t CC_LONG; /* 32 bit unsigned integer */ +typedef uint64_t CC_LONG64; /* 64 bit unsigned integer */ /*** MD2 ***/ -#define CC_MD2_DIGEST_LENGTH 16 /* digest length in bytes */ -#define CC_MD2_BLOCK_BYTES 64 /* block size in bytes */ +#define CC_MD2_DIGEST_LENGTH 16 /* digest length in bytes */ +#define CC_MD2_BLOCK_BYTES 64 /* block size in bytes */ #define CC_MD2_BLOCK_LONG (CC_MD2_BLOCK_BYTES / sizeof(CC_LONG)) typedef struct CC_MD2state_st { int num; unsigned char data[CC_MD2_DIGEST_LENGTH]; CC_LONG cksm[CC_MD2_BLOCK_LONG]; - CC_LONG state[CC_MD2_BLOCK_LONG]; + CC_LONG state[CC_MD2_BLOCK_LONG]; } CC_MD2_CTX; extern int CC_MD2_Init(CC_MD2_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_MD2_Update(CC_MD2_CTX *c, const void *data, CC_LONG len) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_MD2_Final(unsigned char *md, CC_MD2_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern unsigned char *CC_MD2(const void *data, CC_LONG len, unsigned char *md) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); /*** MD4 ***/ -#define CC_MD4_DIGEST_LENGTH 16 /* digest length in bytes */ -#define CC_MD4_BLOCK_BYTES 64 /* block size in bytes */ +#define CC_MD4_DIGEST_LENGTH 16 /* digest length in bytes */ +#define CC_MD4_BLOCK_BYTES 64 /* block size in bytes */ #define CC_MD4_BLOCK_LONG (CC_MD4_BLOCK_BYTES / sizeof(CC_LONG)) typedef struct CC_MD4state_st { - CC_LONG A,B,C,D; - CC_LONG Nl,Nh; - CC_LONG data[CC_MD4_BLOCK_LONG]; - int num; + CC_LONG A,B,C,D; + CC_LONG Nl,Nh; + CC_LONG data[CC_MD4_BLOCK_LONG]; + uint32_t num; } CC_MD4_CTX; extern int CC_MD4_Init(CC_MD4_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_MD4_Update(CC_MD4_CTX *c, const void *data, CC_LONG len) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_MD4_Final(unsigned char *md, CC_MD4_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern unsigned char *CC_MD4(const void *data, CC_LONG len, unsigned char *md) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); /*** MD5 ***/ -#define CC_MD5_DIGEST_LENGTH 16 /* digest length in bytes */ -#define CC_MD5_BLOCK_BYTES 64 /* block size in bytes */ +#define CC_MD5_DIGEST_LENGTH 16 /* digest length in bytes */ +#define CC_MD5_BLOCK_BYTES 64 /* block size in bytes */ #define CC_MD5_BLOCK_LONG (CC_MD5_BLOCK_BYTES / sizeof(CC_LONG)) typedef struct CC_MD5state_st { - CC_LONG A,B,C,D; - CC_LONG Nl,Nh; - CC_LONG data[CC_MD5_BLOCK_LONG]; - int num; + CC_LONG A,B,C,D; + CC_LONG Nl,Nh; + CC_LONG data[CC_MD5_BLOCK_LONG]; + int num; } CC_MD5_CTX; extern int CC_MD5_Init(CC_MD5_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_MD5_Update(CC_MD5_CTX *c, const void *data, CC_LONG len) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_MD5_Final(unsigned char *md, CC_MD5_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern unsigned char *CC_MD5(const void *data, CC_LONG len, unsigned char *md) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); /*** SHA1 ***/ -#define CC_SHA1_DIGEST_LENGTH 20 /* digest length in bytes */ -#define CC_SHA1_BLOCK_BYTES 64 /* block size in bytes */ +#define CC_SHA1_DIGEST_LENGTH 20 /* digest length in bytes */ +#define CC_SHA1_BLOCK_BYTES 64 /* block size in bytes */ #define CC_SHA1_BLOCK_LONG (CC_SHA1_BLOCK_BYTES / sizeof(CC_LONG)) typedef struct CC_SHA1state_st { - CC_LONG h0,h1,h2,h3,h4; - CC_LONG Nl,Nh; - CC_LONG data[CC_SHA1_BLOCK_LONG]; - int num; + CC_LONG h0,h1,h2,h3,h4; + CC_LONG Nl,Nh; + CC_LONG data[CC_SHA1_BLOCK_LONG]; + int num; } CC_SHA1_CTX; extern int CC_SHA1_Init(CC_SHA1_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_SHA1_Update(CC_SHA1_CTX *c, const void *data, CC_LONG len) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_SHA1_Final(unsigned char *md, CC_SHA1_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern unsigned char *CC_SHA1(const void *data, CC_LONG len, unsigned char *md) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); /*** SHA224 ***/ -#define CC_SHA224_DIGEST_LENGTH 28 /* digest length in bytes */ -#define CC_SHA224_BLOCK_BYTES 64 /* block size in bytes */ +#define CC_SHA224_DIGEST_LENGTH 28 /* digest length in bytes */ +#define CC_SHA224_BLOCK_BYTES 64 /* block size in bytes */ /* same context struct is used for SHA224 and SHA256 */ typedef struct CC_SHA256state_st { CC_LONG count[2]; CC_LONG hash[8]; CC_LONG wbuf[16]; } CC_SHA256_CTX; extern int CC_SHA224_Init(CC_SHA256_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_SHA224_Update(CC_SHA256_CTX *c, const void *data, CC_LONG len) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_SHA224_Final(unsigned char *md, CC_SHA256_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern unsigned char *CC_SHA224(const void *data, CC_LONG len, unsigned char *md) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); /*** SHA256 ***/ -#define CC_SHA256_DIGEST_LENGTH 32 /* digest length in bytes */ -#define CC_SHA256_BLOCK_BYTES 64 /* block size in bytes */ +#define CC_SHA256_DIGEST_LENGTH 32 /* digest length in bytes */ +#define CC_SHA256_BLOCK_BYTES 64 /* block size in bytes */ extern int CC_SHA256_Init(CC_SHA256_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_SHA256_Update(CC_SHA256_CTX *c, const void *data, CC_LONG len) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_SHA256_Final(unsigned char *md, CC_SHA256_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern unsigned char *CC_SHA256(const void *data, CC_LONG len, unsigned char *md) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); /*** SHA384 ***/ -#define CC_SHA384_DIGEST_LENGTH 48 /* digest length in bytes */ -#define CC_SHA384_BLOCK_BYTES 128 /* block size in bytes */ +#define CC_SHA384_DIGEST_LENGTH 48 /* digest length in bytes */ +#define CC_SHA384_BLOCK_BYTES 128 /* block size in bytes */ /* same context struct is used for SHA384 and SHA512 */ typedef struct CC_SHA512state_st { CC_LONG64 count[2]; CC_LONG64 hash[8]; CC_LONG64 wbuf[16]; } CC_SHA512_CTX; extern int CC_SHA384_Init(CC_SHA512_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_SHA384_Update(CC_SHA512_CTX *c, const void *data, CC_LONG len) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_SHA384_Final(unsigned char *md, CC_SHA512_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern unsigned char *CC_SHA384(const void *data, CC_LONG len, unsigned char *md) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); /*** SHA512 ***/ -#define CC_SHA512_DIGEST_LENGTH 64 /* digest length in bytes */ -#define CC_SHA512_BLOCK_BYTES 128 /* block size in bytes */ +#define CC_SHA512_DIGEST_LENGTH 64 /* digest length in bytes */ +#define CC_SHA512_BLOCK_BYTES 128 /* block size in bytes */ extern int CC_SHA512_Init(CC_SHA512_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_SHA512_Update(CC_SHA512_CTX *c, const void *data, CC_LONG len) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern int CC_SHA512_Final(unsigned char *md, CC_SHA512_CTX *c) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); extern unsigned char *CC_SHA512(const void *data, CC_LONG len, unsigned char *md) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); /* * To use the above digest functions with existing code which uses * the corresponding openssl functions, #define the symbol * COMMON_DIGEST_FOR_OPENSSL in your client code (BEFORE including @@ -256,78 +256,78 @@ * type from the two implementations; i.e., if you do a CC_MD5_Init() * on a CC_MD5_CTX object, do not assume that you can do an openssl-style * MD5_Update() on that same context. */ -#ifdef COMMON_DIGEST_FOR_OPENSSL - -#define MD2_DIGEST_LENGTH CC_MD2_DIGEST_LENGTH -#define MD2_CTX CC_MD2_CTX -#define MD2_Init CC_MD2_Init -#define MD2_Update CC_MD2_Update -#define MD2_Final CC_MD2_Final - -#define MD4_DIGEST_LENGTH CC_MD4_DIGEST_LENGTH -#define MD4_CTX CC_MD4_CTX -#define MD4_Init CC_MD4_Init -#define MD4_Update CC_MD4_Update -#define MD4_Final CC_MD4_Final - -#define MD5_DIGEST_LENGTH CC_MD5_DIGEST_LENGTH -#define MD5_CTX CC_MD5_CTX -#define MD5_Init CC_MD5_Init -#define MD5_Update CC_MD5_Update -#define MD5_Final CC_MD5_Final - -#define SHA_DIGEST_LENGTH CC_SHA1_DIGEST_LENGTH -#define SHA_CTX CC_SHA1_CTX -#define SHA1_Init CC_SHA1_Init -#define SHA1_Update CC_SHA1_Update -#define SHA1_Final CC_SHA1_Final - -#define SHA224_DIGEST_LENGTH CC_SHA224_DIGEST_LENGTH -#define SHA256_CTX CC_SHA256_CTX -#define SHA224_Init CC_SHA224_Init -#define SHA224_Update CC_SHA224_Update -#define SHA224_Final CC_SHA224_Final - -#define SHA256_DIGEST_LENGTH CC_SHA256_DIGEST_LENGTH -#define SHA256_Init CC_SHA256_Init -#define SHA256_Update CC_SHA256_Update -#define SHA256_Final CC_SHA256_Final - -#define SHA384_DIGEST_LENGTH CC_SHA384_DIGEST_LENGTH -#define SHA512_CTX CC_SHA512_CTX -#define SHA384_Init CC_SHA384_Init -#define SHA384_Update CC_SHA384_Update -#define SHA384_Final CC_SHA384_Final - -#define SHA512_DIGEST_LENGTH CC_SHA512_DIGEST_LENGTH -#define SHA512_Init CC_SHA512_Init -#define SHA512_Update CC_SHA512_Update -#define SHA512_Final CC_SHA512_Final - - -#endif /* COMMON_DIGEST_FOR_OPENSSL */ +#ifdef COMMON_DIGEST_FOR_OPENSSL + +#define MD2_DIGEST_LENGTH CC_MD2_DIGEST_LENGTH +#define MD2_CTX CC_MD2_CTX +#define MD2_Init CC_MD2_Init +#define MD2_Update CC_MD2_Update +#define MD2_Final CC_MD2_Final + +#define MD4_DIGEST_LENGTH CC_MD4_DIGEST_LENGTH +#define MD4_CTX CC_MD4_CTX +#define MD4_Init CC_MD4_Init +#define MD4_Update CC_MD4_Update +#define MD4_Final CC_MD4_Final + +#define MD5_DIGEST_LENGTH CC_MD5_DIGEST_LENGTH +#define MD5_CTX CC_MD5_CTX +#define MD5_Init CC_MD5_Init +#define MD5_Update CC_MD5_Update +#define MD5_Final CC_MD5_Final + +#define SHA_DIGEST_LENGTH CC_SHA1_DIGEST_LENGTH +#define SHA_CTX CC_SHA1_CTX +#define SHA1_Init CC_SHA1_Init +#define SHA1_Update CC_SHA1_Update +#define SHA1_Final CC_SHA1_Final + +#define SHA224_DIGEST_LENGTH CC_SHA224_DIGEST_LENGTH +#define SHA256_CTX CC_SHA256_CTX +#define SHA224_Init CC_SHA224_Init +#define SHA224_Update CC_SHA224_Update +#define SHA224_Final CC_SHA224_Final + +#define SHA256_DIGEST_LENGTH CC_SHA256_DIGEST_LENGTH +#define SHA256_Init CC_SHA256_Init +#define SHA256_Update CC_SHA256_Update +#define SHA256_Final CC_SHA256_Final + +#define SHA384_DIGEST_LENGTH CC_SHA384_DIGEST_LENGTH +#define SHA512_CTX CC_SHA512_CTX +#define SHA384_Init CC_SHA384_Init +#define SHA384_Update CC_SHA384_Update +#define SHA384_Final CC_SHA384_Final + +#define SHA512_DIGEST_LENGTH CC_SHA512_DIGEST_LENGTH +#define SHA512_Init CC_SHA512_Init +#define SHA512_Update CC_SHA512_Update +#define SHA512_Final CC_SHA512_Final + + +#endif /* COMMON_DIGEST_FOR_OPENSSL */ /* * In a manner similar to that described above for openssl * compatibility, these macros can be used to provide compatiblity * with legacy implementations of MD5 using the interface defined * in RFC 1321. */ -#ifdef COMMON_DIGEST_FOR_RFC_1321 +#ifdef COMMON_DIGEST_FOR_RFC_1321 -#define MD5_CTX CC_MD5_CTX -#define MD5Init CC_MD5_Init -#define MD5Update CC_MD5_Update +#define MD5_CTX CC_MD5_CTX +#define MD5Init CC_MD5_Init +#define MD5Update CC_MD5_Update void MD5Final (unsigned char [16], MD5_CTX *) -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); -#endif /* COMMON_DIGEST_FOR_RFC_1321 */ +#endif /* COMMON_DIGEST_FOR_RFC_1321 */ #ifdef __cplusplus } #endif -#endif /* _CC_COMMON_DIGEST_H_ */ +#endif /* _CC_COMMON_DIGEST_H_ */ Index: CommonCrypto/CommonHMAC.h ================================================================== --- CommonCrypto/CommonHMAC.h +++ CommonCrypto/CommonHMAC.h @@ -20,15 +20,15 @@ * * @APPLE_LICENSE_HEADER_END@ */ /*! - @header CommonHMAC.h - @abstract Keyed Message Authentication Code (HMAC) functions. + @header CommonHMAC.h + @abstract Keyed Message Authentication Code (HMAC) functions. */ -#ifndef _CC_COMMON_HMAC_H_ +#ifndef _CC_COMMON_HMAC_H_ #define _CC_COMMON_HMAC_H_ #include #include #include @@ -36,107 +36,107 @@ #ifdef __cplusplus extern "C" { #endif /*! - @enum CCHmacAlgorithm - @abstract Algorithms implemented in this module. - - @constant kCCHmacAlgSHA1 HMAC with SHA1 digest - @constant kCCHmacAlgMD5 HMAC with MD5 digest - @constant kCCHmacAlgSHA256 HMAC with SHA256 digest - @constant kCCHmacAlgSHA384 HMAC with SHA384 digest - @constant kCCHmacAlgSHA512 HMAC with SHA512 digest - @constant kCCHmacAlgSHA224 HMAC with SHA224 digest + @enum CCHmacAlgorithm + @abstract Algorithms implemented in this module. + + @constant kCCHmacAlgSHA1 HMAC with SHA1 digest + @constant kCCHmacAlgMD5 HMAC with MD5 digest + @constant kCCHmacAlgSHA256 HMAC with SHA256 digest + @constant kCCHmacAlgSHA384 HMAC with SHA384 digest + @constant kCCHmacAlgSHA512 HMAC with SHA512 digest + @constant kCCHmacAlgSHA224 HMAC with SHA224 digest */ enum { - kCCHmacAlgSHA1, - kCCHmacAlgMD5, - kCCHmacAlgSHA256, - kCCHmacAlgSHA384, - kCCHmacAlgSHA512, - kCCHmacAlgSHA224 + kCCHmacAlgSHA1, + kCCHmacAlgMD5, + kCCHmacAlgSHA256, + kCCHmacAlgSHA384, + kCCHmacAlgSHA512, + kCCHmacAlgSHA224 }; typedef uint32_t CCHmacAlgorithm; /*! - @typedef CCHmacContext - @abstract HMAC context. + @typedef CCHmacContext + @abstract HMAC context. */ -#define CC_HMAC_CONTEXT_SIZE 96 +#define CC_HMAC_CONTEXT_SIZE 96 typedef struct { - uint32_t ctx[CC_HMAC_CONTEXT_SIZE]; + uint32_t ctx[CC_HMAC_CONTEXT_SIZE]; } CCHmacContext; /*! - @function CCHmacInit - @abstract Initialize an CCHmacContext with provided raw key bytes. - - @param ctx An HMAC context. - @param algorithm HMAC algorithm to perform. - @param key Raw key bytes. - @param keyLength Length of raw key bytes; can be any - length including zero. + @function CCHmacInit + @abstract Initialize an CCHmacContext with provided raw key bytes. + + @param ctx An HMAC context. + @param algorithm HMAC algorithm to perform. + @param key Raw key bytes. + @param keyLength Length of raw key bytes; can be any + length including zero. */ void CCHmacInit( - CCHmacContext *ctx, - CCHmacAlgorithm algorithm, - const void *key, + CCHmacContext *ctx, + CCHmacAlgorithm algorithm, + const void *key, size_t keyLength) - __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); + __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); - + /*! - @function CCHmacUpdate - @abstract Process some data. - - @param ctx An HMAC context. - @param data Data to process. - @param dataLength Length of data to process, in bytes. - - @discussion This can be called multiple times. + @function CCHmacUpdate + @abstract Process some data. + + @param ctx An HMAC context. + @param data Data to process. + @param dataLength Length of data to process, in bytes. + + @discussion This can be called multiple times. */ void CCHmacUpdate( - CCHmacContext *ctx, - const void *data, + CCHmacContext *ctx, + const void *data, size_t dataLength) - __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); + __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); - + /*! - @function CCHmacFinal - @abstract Obtain the final Message Authentication Code. - - @param ctx An HMAC context. - @param macOut Destination of MAC; allocated by caller. - - @discussion The length of the MAC written to *macOut is the same as - the digest length associated with the HMAC algorithm: - - kCCHmacSHA1 : CC_SHA1_DIGEST_LENGTH - - kCCHmacMD5 : CC_MD5_DIGEST_LENGTH + @function CCHmacFinal + @abstract Obtain the final Message Authentication Code. + + @param ctx An HMAC context. + @param macOut Destination of MAC; allocated by caller. + + @discussion The length of the MAC written to *macOut is the same as + the digest length associated with the HMAC algorithm: + + kCCHmacSHA1 : CC_SHA1_DIGEST_LENGTH + + kCCHmacMD5 : CC_MD5_DIGEST_LENGTH */ void CCHmacFinal( - CCHmacContext *ctx, + CCHmacContext *ctx, void *macOut) - __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); + __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); - + /* * Stateless, one-shot HMAC function. * Output is written to caller-supplied buffer, as in CCHmacFinal(). */ void CCHmac( - CCHmacAlgorithm algorithm, /* kCCHmacSHA1, kCCHmacMD5 */ - const void *key, - size_t keyLength, /* length of key in bytes */ - const void *data, - size_t dataLength, /* length of data in bytes */ + CCHmacAlgorithm algorithm, /* kCCHmacSHA1, kCCHmacMD5 */ + const void *key, + size_t keyLength, /* length of key in bytes */ + const void *data, + size_t dataLength, /* length of data in bytes */ void *macOut) /* MAC written here */ - __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA); + __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); #ifdef __cplusplus } #endif -#endif /* _CC_COMMON_HMAC_H_ */ +#endif /* _CC_COMMON_HMAC_H_ */ Index: CommonCrypto/CommonKeyDerivation.h ================================================================== --- CommonCrypto/CommonKeyDerivation.h +++ CommonCrypto/CommonKeyDerivation.h @@ -22,19 +22,19 @@ */ #ifndef _CC_PBKDF_H_ #define _CC_PBKDF_H_ -#include #include - #include +#include +#ifdef KERNEL +#include +#else #include #include - -#include - +#endif /* KERNEL */ #include #include #ifdef __cplusplus @@ -90,21 +90,22 @@ * kCCPRFHmacAlgSHA224 * kCCPRFHmacAlgSHA256 * kCCPRFHmacAlgSHA384 * kCCPRFHmacAlgSHA512 - @result kCCParamError can result from bad values for the password, salt, - and unwrapped key pointers as well as a bad value for the prf function. + @result kCCParamError can result from bad values for the password, salt, + and unwrapped key pointers as well as a bad value for the prf + function. */ int CCKeyDerivationPBKDF( CCPBKDFAlgorithm algorithm, const char *password, size_t passwordLen, const uint8_t *salt, size_t saltLen, CCPseudoRandomAlgorithm prf, uint rounds, uint8_t *derivedKey, size_t derivedKeyLen) - __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); + __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /* * All lengths are in bytes - not bits. */ @@ -127,12 +128,12 @@ */ uint CCCalibratePBKDF(CCPBKDFAlgorithm algorithm, size_t passwordLen, size_t saltLen, CCPseudoRandomAlgorithm prf, size_t derivedKeyLen, uint32_t msec) - __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); + __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); #ifdef __cplusplus } #endif #endif /* _CC_PBKDF_H_ */ Index: CommonCrypto/CommonSymmetricKeywrap.h ================================================================== --- CommonCrypto/CommonSymmetricKeywrap.h +++ CommonCrypto/CommonSymmetricKeywrap.h @@ -27,12 +27,16 @@ #include #include #include #include +#ifdef KERNEL +#include +#else #include #include +#endif /* KERNEL */ #include #ifdef __cplusplus extern "C" { @@ -40,12 +44,12 @@ enum { kCCWRAPAES = 1, }; -extern const uint8_t *CCrfc3394_iv __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); -extern const size_t CCrfc3394_ivLen __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +extern const uint8_t *CCrfc3394_iv __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_5_0); +extern const size_t CCrfc3394_ivLen __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_5_0); typedef uint32_t CCWrappingAlgorithm; /*! @function CCSymmetricKeyWrap @@ -80,11 +84,11 @@ CCSymmetricKeyWrap( CCWrappingAlgorithm algorithm, const uint8_t *iv, const size_t ivLen, const uint8_t *kek, size_t kekLen, const uint8_t *rawKey, size_t rawKeyLen, uint8_t *wrappedKey, size_t *wrappedKeyLen) - __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); + __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /*! @function CCSymmetricKeyUnwrap @abstract Unwrap a symmetric key with a Key Encryption Key (KEK). @@ -116,11 +120,11 @@ CCSymmetricKeyUnwrap( CCWrappingAlgorithm algorithm, const uint8_t *iv, const size_t ivLen, const uint8_t *kek, size_t kekLen, const uint8_t *wrappedKey, size_t wrappedKeyLen, uint8_t *rawKey, size_t *rawKeyLen) - __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); + __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /*! @function CCSymmetricWrappedSize @abstract Determine the buffer size required to hold a key wrapped with CCAESKeyWrap(). @@ -131,11 +135,11 @@ @result The length of the resulting wrapped key. */ size_t CCSymmetricWrappedSize( CCWrappingAlgorithm algorithm, size_t rawKeyLen) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /*! @function CCSymmetricUnwrappedSize @abstract Determine the buffer size required to hold a key unwrapped with CCAESKeyUnwrap(). @@ -146,12 +150,12 @@ @result The length of the resulting raw key. */ size_t CCSymmetricUnwrappedSize( CCWrappingAlgorithm algorithm, size_t wrappedKeyLen) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); #ifdef __cplusplus } #endif #endif /* _CC_SYMKEYWRAP_H_ */ DELETED Configurations/CommonCrypto_base.xcconfig Index: Configurations/CommonCrypto_base.xcconfig ================================================================== --- Configurations/CommonCrypto_base.xcconfig +++ /dev/null @@ -1,241 +0,0 @@ -// -// CommonCrypto_base.xcconfig -// CommonCrypto -// -// InfoSec Standard Configuration -// Copyright 2010 Apple Inc. All rights reserved. -// - -// This XCCONFIG file defines the shared settings for all targets of the -// CommonCrypto XCode Project - -// ************************************************************************** -// * Begin Project Section -// ************************************************************************** - -PRODUCT_NAME = commonCrypto - -ARCHS = $(NATIVE_ARCH) $(ARCHS_STANDARD_64_BIT) arm - -// Minimum OS version -MACOSX_DEPLOYMENT_TARGET = - -BUILD_VARIANTS = normal profile debug - -// -// Directory Names -// - -CC_PATH_BASE = $(PROJECT_DIR) -CC_PATH_XCCONFIGS = $(CC_PATH_BASE)/Configurations -CC_PATH_PUBLIC_HEADERS = $(CC_PATH_BASE)/CommonCrypto -CC_PATH_SOURCE = $(CC_PATH_BASE)/Source - -// This REALLY should come from an include from a truly global XCCONFIG file -// This can easily be retrofitted when we have more projects using this -// system - -CONFIGURATION_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION) - -PUBLIC_HEADERS_FOLDER_PATH = /usr/include/CommonCrypto -PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/CommonCrypto -HEADER_SEARCH_PATHS = -USER_HEADER_SEARCH_PATHS = $(CC_PATH_SOURCE) - -// Include user path in header search -ALWAYS_SEARCH_USER_PATHS = YES - -// Deal with "installation" This may not be necessary but it will not hurt either -INSTALL_PATH = /usr/lib/system -INSTALL_OWNER = root -INSTALL_GROUP = wheel - -// Deal with project versioning -CURRENT_PROJECT_VERSION = $(RC_ProjectSourceVersion) -VERSIONING_SYSTEM = apple-generic -VERSION_INFO_BUILDER = $(USER) - -DYLIB_COMPATIBILITY_VERSION = 1 -DYLIB_CURRENT_VERSION = $(RC_ProjectSourceVersion) - -EXECUTABLE_PREFIX = lib - -// ************************************************************************** -// * End Project Section -// ************************************************************************** - -// ************************************************************************** -// * Begin Code Signing Section -// ************************************************************************** - -CODE_SIGN_IDENTITY = -CODE_SIGN_RESOURCE_RULES_PATH = -OTHER_CODE_SIGN_FLAGS = - -// ************************************************************************** -// * End Code Signing Section -// ************************************************************************** - -// ************************************************************************** -// * Begin Compiler Section -// ************************************************************************** - -// Compiler version: I would LOVE to use CLANG but CLANG currently does -// not support C++ very well -GCC_VERSION = com.apple.compilers.llvmgcc42 - -GCC_C_LANGUAGE_STANDARD = gnu99 - -// Debugging information. -DEBUG_INFORMATION_FORMAT = dwarf-with-dsym - -// Tuning -GCC_MODEL_TUNING = G4 - -// GCC Flags -GCC_AUTO_VECTORIZATION = NO - -// Ensure position independent code generation -GCC_DYNAMIC_NO_PIC = NO -GCC_ENABLE_FIX_AND_CONTINUE = NO -GCC_ENABLE_KERNEL_DEVELOPMENT = NO -GCC_ENABLE_SSE3_EXTENSIONS = NO -GCC_ENABLE_SSE41_EXTENSIONS = NO -GCC_ENABLE_SSE42_EXTENSIONS = NO -GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = NO -GCC_ENABLE_SYMBOL_SEPARATION = NO -GCC_FAST_MATH = NO - -// Test Coverage -GCC_GENERATE_TEST_COVERAGE_FILES = NO -GCC_INLINES_ARE_PRIVATE_EXTERN = NO -GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO -GCC_MODEL_PPC64 = NO -GCC_NO_COMMON_BLOCKS = NO - -// Objective-C++ destructors -GCC_OBJC_CALL_CXX_CDTORS = NO -GCC_STRICT_ALIASING = NO -GCC_SYMBOLS_PRIVATE_EXTERN = YES -GCC_UNROLL_LOOPS = NO -GCC_FEEDBACK_DIRECTED_OPTIMIZATION = off - -GCC_FAST_OBJC_DISPATCH = YES -GCC_GENERATE_DEBUGGING_SYMBOLS = YES -GCC_REUSE_STRINGS = YES -GCC_THREADSAFE_STATICS = YES -GCC_DEBUGGING_SYMBOLS = default - -// Garbage collection -GCC_ENABLE_OBJC_GC = unsupported - -// Language Flags - -// Prefix file Should we have one of these? -GCC_PRECOMPILE_PREFIX_HEADER = NO -GCC_PREFIX_HEADER = - -GCC_ALTIVEC_EXTENSIONS = NO -GCC_CHAR_IS_UNSIGNED_CHAR = NO -GCC_CHECK_RETURN_VALUE_OF_OPERATOR_NEW = NO -GCC_ENABLE_FLOATING_POINT_LIBRARY_CALLS = NO -GCC_ENABLE_TRIGRAPHS = NO -GCC_FORCE_CPU_SUBTYPE_ALL = NO -GCC_INCREASE_PRECOMPILED_HEADER_SHARING = NO -GCC_ONE_BYTE_BOOL = NO -GCC_SHORT_ENUMS = NO -GCC_USE_INDIRECT_FUNCTION_CALLS = NO -GCC_USE_REGISTER_FUNCTION_CALLS = NO -GCC_CW_ASM_SYNTAX = YES -GCC_ENABLE_ASM_KEYWORD = YES -GCC_ENABLE_BUILTIN_FUNCTIONS = YES -GCC_ENABLE_CPP_EXCEPTIONS = YES -GCC_ENABLE_CPP_RTTI = YES -GCC_ENABLE_OBJC_EXCEPTIONS = YES -GCC_ENABLE_PASCAL_STRINGS = YES -GCC_LINK_WITH_DYNAMIC_LIBRARIES = YES -GCC_USE_STANDARD_INCLUDE_SEARCHING = YES - -// WARNINGS -// -// I am including most warnings in this list, If problems occur they can -// be commented out or changed to be NO - -WARNING_CFLAGS = -Wall - -GCC_TREAT_WARNINGS_AS_ERRORS = YES - -// Should any of these be YES? -GCC_WARN_PEDANTIC = NO - - -GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES -GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES -GCC_WARN_64_TO_32_BIT_CONVERSION = YES -GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES -GCC_WARN_ABOUT_MISSING_NEWLINE = YES -GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES -GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES -GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES -GCC_WARN_INHIBIT_ALL_WARNINGS = YES -GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES -GCC_WARN_MISSING_PARENTHESES = YES -GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES -GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES -GCC_WARN_PEDANTIC = YES -GCC_WARN_PROTOTYPE_CONVERSION = YES -GCC_WARN_SHADOW = YES -GCC_WARN_SIGN_COMPARE = YES -GCC_WARN_STRICT_SELECTOR_MATCH = YES -GCC_WARN_UNDECLARED_SELECTOR = YES -GCC_WARN_UNKNOWN_PRAGMAS = YES -GCC_WARN_UNUSED_PARAMETER = YES -GCC_WARN_UNUSED_VARIABLE = YES - -GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES -GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES -GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES -GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES -GCC_WARN_ABOUT_RETURN_TYPE = YES -GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES -GCC_WARN_CHECK_SWITCH_STATEMENTS = YES -GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES -GCC_WARN_UNINITIALIZED_AUTOS = YES -GCC_WARN_UNUSED_FUNCTION = YES -GCC_WARN_UNUSED_LABEL = YES - -OTHER_CFLAGS = -fstack-protector-all -Wstack-protector -DSHA256_USE_ASSEMBLY=1 - -GCC_PREPROCESSOR_DEFINITIONS = _FORTIFY_SOURCE=2 - -// ************************************************************************** -// * End Compiler Section -// ************************************************************************** - -// ************************************************************************** -// * Begin Linker Section -// ************************************************************************** - -// OTHER_LDFLAGS -// Set up a three tiered set of variables for linker flags -// This will allow for adding linker flags and not run into -// the XCCONFIG "bug" of not being able to set FOO = $(FOO) bar - - -DEAD_CODE_STRIPPING = YES -GENERATE_MASTER_OBJECT_FILE = NO -KEEP_PRIVATE_EXTERNS = NO - -// Should this be yes? -LD_GENERATE_MAP_FILE = NO - -LINKER_DISPLAYS_MANGLED_NAMES = NO -PRESERVE_DEAD_CODE_INITS_AND_TERMS = NO -SEPARATE_SYMBOL_EDIT = NO -LINK_WITH_STANDARD_LIBRARIES = YES -PREBINDING = NO - -// ************************************************************************** -// * End Linker Section -// ************************************************************************** - DELETED Configurations/CommonCrypto_deployment.xcconfig Index: Configurations/CommonCrypto_deployment.xcconfig ================================================================== --- Configurations/CommonCrypto_deployment.xcconfig +++ /dev/null @@ -1,20 +0,0 @@ -// -// CommonCrypto_deployment.xcconfig -// CommonCrypto -// -// InfoSec Standard Configuration -// Copyright 2010 Apple Inc. All rights reserved. -// - -// This XCCONFIG file defines the deployment settings for all targets - -#include "CommonCrypto_base.xcconfig" - -// Debug build set optimization level to s -GCC_OPTIMIZATION_LEVEL = s - -GCC_PREPROCESSOR_DEFINITIONS_PROJECT = NDEBUG - -COPY_PHASE_STRIP = YES - -WARNING_CFLAGS = -Wall DELETED Configurations/CommonCrypto_development.xcconfig Index: Configurations/CommonCrypto_development.xcconfig ================================================================== --- Configurations/CommonCrypto_development.xcconfig +++ /dev/null @@ -1,26 +0,0 @@ -// -// CommonCrypto_debug.xcconfig -// CommonCrypto -// -// InfoSec Standard Configuration -// Copyright 2010 Apple Inc. All rights reserved. -// - -// This XCCONFIG file defines the development settings for all targets - -#include "CommonCrypto_base.xcconfig" - -// Debug build set optimization level to 1 -GCC_OPTIMIZATION_LEVEL = 0 - -// This was at odds with the base defining GCC_PREPROCESSOR_DEFINITIONS - it got -// overidden by it. I copied the base value (_FORTIFY_SOURCE=2) and added DEBUG -// to create a debug level override for GCC_PREPROCESSOR_DEFINITIONS - -// GCC_PREPROCESSOR_DEFINITIONS_PROJECT = DEBUG -GCC_PREPROCESSOR_DEFINITIONS = _FORTIFY_SOURCE=2 DEBUG - -COPY_PHASE_STRIP = NO - -WARNING_CFLAGS = -Wall - DELETED Configurations/CommonCrypto_dynamic.xcconfig Index: Configurations/CommonCrypto_dynamic.xcconfig ================================================================== --- Configurations/CommonCrypto_dynamic.xcconfig +++ /dev/null @@ -1,15 +0,0 @@ -// -// CommonCrypto_dynamic.xcconfig -// CommonCrypto -// -// Created by Jim Murphy on 1/11/10. -// Copyright 2010 Apple. All rights reserved. -// - -// This XCCONFIG file defines settings that specific for dynamic libraries - -STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = Dynamic - -EXECUTABLE_EXTENSION = dylib - -LIBRARY_STYLE = Dynamic DELETED Configurations/CommonCrypto_dynamic_deployment.xcconfig Index: Configurations/CommonCrypto_dynamic_deployment.xcconfig ================================================================== --- Configurations/CommonCrypto_dynamic_deployment.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -// -// CommonCrypto_dynamic_deployment.xcconfig -// CommonCrypto -// -// Created by Jim Murphy on 1/11/10. -// Copyright 2010 Apple. All rights reserved. -// - -// This XCCONFIG file is for the deployment version of the dynamic CommonCrypto Library - -#include "CommonCrypto_deployment.xcconfig" -#include "CommonCrypto_dynamic.xcconfig" DELETED Configurations/CommonCrypto_dynamic_development.xcconfig Index: Configurations/CommonCrypto_dynamic_development.xcconfig ================================================================== --- Configurations/CommonCrypto_dynamic_development.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -// -// CommonCrypto_dynamic_development.xcconfig -// CommonCrypto -// -// Created by Jim Murphy on 1/11/10. -// Copyright 2010 Apple. All rights reserved. -// - -// This XCCONFIG file is for the development version of the dynamic CommonCrypto Library - -#include "CommonCrypto_development.xcconfig" -#include "CommonCrypto_dynamic.xcconfig" DELETED Configurations/CommonCrypto_localtest.xcconfig Index: Configurations/CommonCrypto_localtest.xcconfig ================================================================== --- Configurations/CommonCrypto_localtest.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -// -// CommonCrypto_unittest_base.xcconfig -// CommonCrypto -// -// InfoSec Standard Configuration -// Copyright 2010 Apple Inc. All rights reserved. -// - -ARCHS = $(NATIVE_ARCH) $(ARCHS_STANDARD_64_BIT) -GCC_OPTIMIZATION_LEVEL = s -GCC_PREPROCESSOR_DEFINITIONS = _FORTIFY_SOURCE=2 DEBUG -COPY_PHASE_STRIP = NO -WARNING_CFLAGS = -Wall DELETED Configurations/CommonCrypto_static.xcconfig Index: Configurations/CommonCrypto_static.xcconfig ================================================================== --- Configurations/CommonCrypto_static.xcconfig +++ /dev/null @@ -1,15 +0,0 @@ -// -// CommonCrypto_static.xcconfig -// CommonCrypto -// -// Created by Jim Murphy on 1/11/10. -// Copyright 2010 Apple. All rights reserved. -// - -// This XCCONFIG file defines settings that specific for static libraries - -STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = Dynamic - -EXECUTABLE_EXTENSION = a - -LIBRARY_STYLE = Static DELETED Configurations/CommonCrypto_static_deployment.xcconfig Index: Configurations/CommonCrypto_static_deployment.xcconfig ================================================================== --- Configurations/CommonCrypto_static_deployment.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -// -// CommonCrypto_static_deployment.xcconfig -// CommonCrypto -// -// Created by Jim Murphy on 1/11/10. -// Copyright 2010 Apple. All rights reserved. -// - -// This XCCONFIG file is for the deployment version of the static CommonCrypto Library - -#include "CommonCrypto_deployment.xcconfig" -#include "CommonCrypto_static.xcconfig" DELETED Configurations/CommonCrypto_static_development.xcconfig Index: Configurations/CommonCrypto_static_development.xcconfig ================================================================== --- Configurations/CommonCrypto_static_development.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -// -// CommonCrypto_static_development.xcconfig -// CommonCrypto -// -// Created by Jim Murphy on 1/11/10. -// Copyright 2010 Apple. All rights reserved. -// - -// This XCCONFIG file is for the development version of the static CommonCrypto Library - -#include "CommonCrypto_development.xcconfig" -#include "CommonCrypto_static.xcconfig" DELETED Configurations/CommonCrypto_umbrellaMember.xcconfig Index: Configurations/CommonCrypto_umbrellaMember.xcconfig ================================================================== --- Configurations/CommonCrypto_umbrellaMember.xcconfig +++ /dev/null @@ -1,17 +0,0 @@ -// -// CommonCrypto_umbrellaMember.xcconfig -// CommonCrypto -// -// InfoSec Standard Configuration -// Copyright 2010 Apple Inc. All rights reserved. -// - -// This XCCONFIG file defines settings that specific for umbrella member libraries - -OTHER_LDFLAGS = -Wl -umbrella System -allowable_client otest -allowable_client CommonCryptoUnitTest -allowable_client XTSTest -allowable_client CBCTest - -STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = Dynamic - -EXECUTABLE_EXTENSION = dylib - -LIBRARY_STYLE = Dynamic DELETED Configurations/CommonCrypto_umbrellaMember_deployment.xcconfig Index: Configurations/CommonCrypto_umbrellaMember_deployment.xcconfig ================================================================== --- Configurations/CommonCrypto_umbrellaMember_deployment.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -// -// CommonCrypto_umbrellaMember_deployment.xcconfig -// CommonCrypto -// -// InfoSec Standard Configuration -// Copyright 2010 Apple Inc. All rights reserved. -// - - -// This XCCONFIG file is for the deployment version of the umbrella member for System CommonCrypto Library - -#include "CommonCrypto_deployment.xcconfig" -#include "CommonCrypto_umbrellaMember.xcconfig" DELETED Configurations/CommonCrypto_umbrellaMember_development.xcconfig Index: Configurations/CommonCrypto_umbrellaMember_development.xcconfig ================================================================== --- Configurations/CommonCrypto_umbrellaMember_development.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -// -// CommonCrypto_umbrellaMember_development.xcconfig -// CommonCrypto -// -// InfoSec Standard Configuration -// Copyright 2010 Apple Inc. All rights reserved. -// - -// This XCCONFIG file is for the development version of the umbrella member for System CommonCrypto Library - -#include "CommonCrypto_development.xcconfig" -#include "CommonCrypto_umbrellaMember.xcconfig" DELETED Configurations/CommonCrypto_unitTest_dynamic_development.xcconfig Index: Configurations/CommonCrypto_unitTest_dynamic_development.xcconfig ================================================================== --- Configurations/CommonCrypto_unitTest_dynamic_development.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ -// -// CommonCrypto_unitTest_dynamic_development.xcconfig -// CommonCrypto -// -// Created by Jim Murphy on 1/13/10. -// Copyright 2010 Apple. All rights reserved. -// - -#include "CommonCrypto_unittest_development.xcconfig" - -LIBRARY_STYLE = Dynamic DELETED Configurations/CommonCrypto_unittest_base.xcconfig Index: Configurations/CommonCrypto_unittest_base.xcconfig ================================================================== --- Configurations/CommonCrypto_unittest_base.xcconfig +++ /dev/null @@ -1,39 +0,0 @@ -// -// CommonCrypto_unittest_base.xcconfig -// CommonCrypto -// -// InfoSec Standard Configuration -// Copyright 2010 Apple Inc. All rights reserved. -// - -// This XCCONFIG file defines the shared settings for all unit test targets of the -// CommonCrypto XCode Project - - -// ************************************************************************** -// * Begin Project Section -// ************************************************************************** - -CC_PATH_BASE = $(PROJECT_DIR) -CC_PATH_UNIT_TEST_SOURCE = $(CC_PATH_BASE)/UnitTestSource - -PRODUCT_NAME = CommonCryptoUnitTest - -ARCHS = $(NATIVE_ARCH) $(ARCHS_STANDARD_64_BIT) - -OTHER_LDFLAGS = -framework Cocoa -framework SenTestingKit - -WRAPPER_EXTENSION = octest - -FRAMEWORK_SEARCH_PATHS = $(DEVELOPER_FRAMEWORKS_DIR) - -GCC_PREFIX_HEADER = $(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h - -INFOPLIST_FILE = $(CC_PATH_UNIT_TEST_SOURCE)/CommonCryptoUnitTests-Info.plist - -OBJC_DISABLE_GC = NO - -// ************************************************************************** -// * End Project Section -// ************************************************************************** - DELETED Configurations/CommonCrypto_unittest_deployment.xcconfig Index: Configurations/CommonCrypto_unittest_deployment.xcconfig ================================================================== --- Configurations/CommonCrypto_unittest_deployment.xcconfig +++ /dev/null @@ -1,20 +0,0 @@ -// -// CommonCrypto_unittest_base.xcconfig -// CommonCrypto -// -// InfoSec Standard Configuration -// Copyright 2010 Apple Inc. All rights reserved. -// - -// This XCCONFIG file defines the deployment setting for unit test targets of the -// CommonCrypto XCode Project - -#include "CommonCrypto_unittest_base.xcconfig" - -GCC_OPTIMIZATION_LEVEL = s - -GCC_PREPROCESSOR_DEFINITIONS_PROJECT = NDEBUG - -COPY_PHASE_STRIP = YES - -WARNING_CFLAGS = -Wall DELETED Configurations/CommonCrypto_unittest_development.xcconfig Index: Configurations/CommonCrypto_unittest_development.xcconfig ================================================================== --- Configurations/CommonCrypto_unittest_development.xcconfig +++ /dev/null @@ -1,20 +0,0 @@ -// -// CommonCrypto_unittest_base.xcconfig -// CommonCrypto -// -// InfoSec Standard Configuration -// Copyright 2010 Apple Inc. All rights reserved. -// - -// This XCCONFIG file defines the development setting for unit test targets of the -// CommonCrypto XCode Project - -#include "CommonCrypto_unittest_base.xcconfig" - -GCC_OPTIMIZATION_LEVEL = 0 - -GCC_PREPROCESSOR_DEFINITIONS_PROJECT = DEBUG - -COPY_PHASE_STRIP = NO - -WARNING_CFLAGS = -Wall DELETED Configurations/CommonCrypto_unittest_dynamic_deployment.xcconfig Index: Configurations/CommonCrypto_unittest_dynamic_deployment.xcconfig ================================================================== --- Configurations/CommonCrypto_unittest_dynamic_deployment.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ -// -// CommonCrypto_unittest_dynamic_deployment.xcconfig -// CommonCrypto -// -// Created by Jim Murphy on 1/13/10. -// Copyright 2010 Apple. All rights reserved. -// - -#include "CommonCrypto_unittest_deployment.xcconfig" - -LIBRARY_STYLE = Dynamic DELETED Configurations/CommonCrypto_unittest_static_deployment.xcconfig Index: Configurations/CommonCrypto_unittest_static_deployment.xcconfig ================================================================== --- Configurations/CommonCrypto_unittest_static_deployment.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ -// -// CommonCrypto_unittest_static_deployment.xcconfig -// CommonCrypto -// -// Created by Jim Murphy on 1/13/10. -// Copyright 2010 Apple. All rights reserved. -// - -#include "CommonCrypto_unittest_deployment.xcconfig" - -LIBRARY_STYLE = Static DELETED Configurations/CommonCrypto_unittest_static_development.xcconfig Index: Configurations/CommonCrypto_unittest_static_development.xcconfig ================================================================== --- Configurations/CommonCrypto_unittest_static_development.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ -// -// CommonCrypto_unittest_static_development.xcconfig -// CommonCrypto -// -// Created by Jim Murphy on 1/13/10. -// Copyright 2010 Apple. All rights reserved. -// - -#include "CommonCrypto_unittest_development.xcconfig" - -LIBRARY_STYLE = Static ADDED Configurations/components/CC_base.xcconfig Index: Configurations/components/CC_base.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_base.xcconfig @@ -0,0 +1,237 @@ +// +// CommonCrypto_base.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +// This XCCONFIG file defines the shared settings for all targets of the +// CommonCrypto XCode Project + +// ************************************************************************** +// * Begin Project Section +// ************************************************************************** + + +ARCHS = $(NATIVE_ARCH) $(ARCHS_STANDARD_64_BIT) arm + +// Minimum OS version +MACOSX_DEPLOYMENT_TARGET = + +BUILD_VARIANTS = normal profile debug + +// +// Directory Names +// + +CC_PATH_BASE = $(PROJECT_DIR) +CC_PATH_XCCONFIGS = $(CC_PATH_BASE)/Configurations +CC_PATH_PUBLIC_HEADERS = $(CC_PATH_BASE)/CommonCrypto +CC_PATH_SOURCE = $(CC_PATH_BASE)/Source + +// This REALLY should come from an include from a truly global XCCONFIG file +// This can easily be retrofitted when we have more projects using this +// system + +CONFIGURATION_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION) + +PUBLIC_HEADERS_FOLDER_PATH = /usr/include/CommonCrypto +PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/CommonCrypto +HEADER_SEARCH_PATHS = +// USER_HEADER_SEARCH_PATHS = $(CC_PATH_SOURCE) + +// Include user path in header search +ALWAYS_SEARCH_USER_PATHS = YES + +// Deal with "installation" This may not be necessary but it will not hurt either +INSTALL_PATH = /usr/lib/system +INSTALL_OWNER = root +INSTALL_GROUP = wheel + +// Deal with project versioning +MYVERSION = 50000 +CURRENT_PROJECT_VERSION = $(MYVERSION) +VERSIONING_SYSTEM = apple-generic +VERSION_INFO_BUILDER = $(USER) + +DYLIB_COMPATIBILITY_VERSION = 1 +DYLIB_CURRENT_VERSION = $(MYVERSION) + +EXECUTABLE_PREFIX = lib + +// ************************************************************************** +// * End Project Section +// ************************************************************************** + +// ************************************************************************** +// * Begin Code Signing Section +// ************************************************************************** + +CODE_SIGN_IDENTITY = +CODE_SIGN_RESOURCE_RULES_PATH = +OTHER_CODE_SIGN_FLAGS = + +// ************************************************************************** +// * End Code Signing Section +// ************************************************************************** + +// ************************************************************************** +// * Begin Compiler Section +// ************************************************************************** + +// Compiler version: Unset - setting this can cause problems between build +// trains. +GCC_VERSION = com.apple.compilers.llvm.clang.1_0 + +// Debugging information. +DEBUG_INFORMATION_FORMAT = dwarf-with-dsym + +// Tuning +GCC_MODEL_TUNING = G4 + +// GCC Flags +GCC_AUTO_VECTORIZATION = NO + +// Ensure position independent code generation +GCC_DYNAMIC_NO_PIC = NO +GCC_ENABLE_FIX_AND_CONTINUE = NO +GCC_ENABLE_KERNEL_DEVELOPMENT = NO +GCC_ENABLE_SSE3_EXTENSIONS = NO +GCC_ENABLE_SSE41_EXTENSIONS = NO +GCC_ENABLE_SSE42_EXTENSIONS = NO +GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = NO +GCC_ENABLE_SYMBOL_SEPARATION = NO +GCC_FAST_MATH = NO + +// Test Coverage +GCC_GENERATE_TEST_COVERAGE_FILES = NO +GCC_INLINES_ARE_PRIVATE_EXTERN = NO +GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO +GCC_MODEL_PPC64 = NO +GCC_NO_COMMON_BLOCKS = NO + +// Objective-C++ destructors +GCC_OBJC_CALL_CXX_CDTORS = NO +GCC_STRICT_ALIASING = NO +GCC_SYMBOLS_PRIVATE_EXTERN = YES +GCC_UNROLL_LOOPS = NO +GCC_FEEDBACK_DIRECTED_OPTIMIZATION = off + +GCC_FAST_OBJC_DISPATCH = YES +GCC_GENERATE_DEBUGGING_SYMBOLS = YES +GCC_REUSE_STRINGS = YES +GCC_THREADSAFE_STATICS = YES +GCC_DEBUGGING_SYMBOLS = default + +// Garbage collection +GCC_ENABLE_OBJC_GC = unsupported + +// Language Flags + +// Prefix file Should we have one of these? +GCC_PRECOMPILE_PREFIX_HEADER = NO +GCC_PREFIX_HEADER = + +GCC_ALTIVEC_EXTENSIONS = NO +GCC_CHAR_IS_UNSIGNED_CHAR = NO +GCC_CHECK_RETURN_VALUE_OF_OPERATOR_NEW = NO +GCC_ENABLE_FLOATING_POINT_LIBRARY_CALLS = NO +GCC_ENABLE_TRIGRAPHS = NO +GCC_FORCE_CPU_SUBTYPE_ALL = NO +GCC_INCREASE_PRECOMPILED_HEADER_SHARING = NO +GCC_ONE_BYTE_BOOL = NO +GCC_SHORT_ENUMS = NO +GCC_USE_INDIRECT_FUNCTION_CALLS = NO +GCC_USE_REGISTER_FUNCTION_CALLS = NO +GCC_CW_ASM_SYNTAX = YES +GCC_ENABLE_ASM_KEYWORD = YES +GCC_ENABLE_BUILTIN_FUNCTIONS = YES +GCC_ENABLE_CPP_EXCEPTIONS = YES +GCC_ENABLE_CPP_RTTI = YES +GCC_ENABLE_OBJC_EXCEPTIONS = YES +GCC_ENABLE_PASCAL_STRINGS = YES +GCC_LINK_WITH_DYNAMIC_LIBRARIES = YES +GCC_USE_STANDARD_INCLUDE_SEARCHING = YES + +// WARNINGS +// +// I am including most warnings in this list, If problems occur they can +// be commented out or changed to be NO + +WARNING_CFLAGS = -Wall + +GCC_TREAT_WARNINGS_AS_ERRORS = YES + +// Should any of these be YES? +GCC_WARN_PEDANTIC = NO + + +GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES +GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES +GCC_WARN_64_TO_32_BIT_CONVERSION = YES +GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES +GCC_WARN_ABOUT_MISSING_NEWLINE = YES +GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES +GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES +GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES +GCC_WARN_INHIBIT_ALL_WARNINGS = YES +GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES +GCC_WARN_MISSING_PARENTHESES = YES +GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES +GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES +GCC_WARN_PROTOTYPE_CONVERSION = YES +GCC_WARN_SHADOW = YES +GCC_WARN_SIGN_COMPARE = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +GCC_WARN_UNDECLARED_SELECTOR = YES +GCC_WARN_UNKNOWN_PRAGMAS = YES +GCC_WARN_UNUSED_PARAMETER = YES +GCC_WARN_UNUSED_VARIABLE = YES + +GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES +GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES +GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES +GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES +GCC_WARN_ABOUT_RETURN_TYPE = YES +GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES +GCC_WARN_CHECK_SWITCH_STATEMENTS = YES +GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES +GCC_WARN_UNINITIALIZED_AUTOS = YES +GCC_WARN_UNUSED_FUNCTION = YES +GCC_WARN_UNUSED_LABEL = YES + + +GCC_PREPROCESSOR_DEFINITIONS = _FORTIFY_SOURCE=2 + +// ************************************************************************** +// * End Compiler Section +// ************************************************************************** + +// ************************************************************************** +// * Begin Linker Section +// ************************************************************************** + +// OTHER_LDFLAGS +// Set up a three tiered set of variables for linker flags +// This will allow for adding linker flags and not run into +// the XCCONFIG "bug" of not being able to set FOO = $(FOO) bar + + +DEAD_CODE_STRIPPING = YES +GENERATE_MASTER_OBJECT_FILE = NO +KEEP_PRIVATE_EXTERNS = NO + +// Should this be yes? +LD_GENERATE_MAP_FILE = NO + +LINKER_DISPLAYS_MANGLED_NAMES = NO +PRESERVE_DEAD_CODE_INITS_AND_TERMS = NO +SEPARATE_SYMBOL_EDIT = NO +LINK_WITH_STANDARD_LIBRARIES = YES +PREBINDING = NO + +// ************************************************************************** +// * End Linker Section +// ************************************************************************** + ADDED Configurations/components/CC_deployment.xcconfig Index: Configurations/components/CC_deployment.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_deployment.xcconfig @@ -0,0 +1,20 @@ +// +// CommonCrypto_deployment.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +// This XCCONFIG file defines the deployment settings for all targets + +#include "CC_base.xcconfig" + +// Debug build set optimization level to s +GCC_OPTIMIZATION_LEVEL = s + +GCC_PREPROCESSOR_DEFINITIONS_PROJECT = NDEBUG + +COPY_PHASE_STRIP = YES + +WARNING_CFLAGS = -Wall ADDED Configurations/components/CC_development.xcconfig Index: Configurations/components/CC_development.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_development.xcconfig @@ -0,0 +1,26 @@ +// +// CommonCrypto_debug.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +// This XCCONFIG file defines the development settings for all targets + +#include "CC_base.xcconfig" + +// Debug build set optimization level to 1 +GCC_OPTIMIZATION_LEVEL = 0 + +// This was at odds with the base defining GCC_PREPROCESSOR_DEFINITIONS - it got +// overidden by it. I copied the base value (_FORTIFY_SOURCE=2) and added DEBUG +// to create a debug level override for GCC_PREPROCESSOR_DEFINITIONS + +// GCC_PREPROCESSOR_DEFINITIONS_PROJECT = DEBUG +GCC_PREPROCESSOR_DEFINITIONS = _FORTIFY_SOURCE=2 DEBUG + +COPY_PHASE_STRIP = NO + +WARNING_CFLAGS = -Wall + ADDED Configurations/components/CC_dynamic.xcconfig Index: Configurations/components/CC_dynamic.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_dynamic.xcconfig @@ -0,0 +1,15 @@ +// +// CommonCrypto_dynamic.xcconfig +// CommonCrypto +// +// Created by Jim Murphy on 1/11/10. +// Copyright 2010 Apple. All rights reserved. +// + +// This XCCONFIG file defines settings that specific for dynamic libraries + +STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = Dynamic + +EXECUTABLE_EXTENSION = dylib + +LIBRARY_STYLE = Dynamic ADDED Configurations/components/CC_dynamic_deployment.xcconfig Index: Configurations/components/CC_dynamic_deployment.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_dynamic_deployment.xcconfig @@ -0,0 +1,12 @@ +// +// CC_dynamic_deployment.xcconfig +// CommonCrypto +// +// Created by Jim Murphy on 1/11/10. +// Copyright 2010 Apple. All rights reserved. +// + +// This XCCONFIG file is for the deployment version of the dynamic CommonCrypto Library + +#include "CC_deployment.xcconfig" +#include "CC_dynamic.xcconfig" ADDED Configurations/components/CC_dynamic_development.xcconfig Index: Configurations/components/CC_dynamic_development.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_dynamic_development.xcconfig @@ -0,0 +1,12 @@ +// +// CC_dynamic_development.xcconfig +// CommonCrypto +// +// Created by Jim Murphy on 1/11/10. +// Copyright 2010 Apple. All rights reserved. +// + +// This XCCONFIG file is for the development version of the dynamic CommonCrypto Library + +#include "CC_development.xcconfig" +#include "CC_dynamic.xcconfig" ADDED Configurations/components/CC_kernel.xcconfig Index: Configurations/components/CC_kernel.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_kernel.xcconfig @@ -0,0 +1,22 @@ +// +// CC_kernel_development.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +// This XCCONFIG file defines the settings for kernel kext targets + +GCC_ENABLE_KERNEL_DEVELOPMENT = YES +KERNEL_MODULE = YES +WRAPPER_EXTENSION = kext + +// GCC_WARN_PEDANTIC is a problem for non-ISO compliant kernel headers +GCC_WARN_PEDANTIC = NO +DEAD_CODE_STRIPPING = NO + +// Standard paths for kexts +INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions" +PRIVATE_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/PrivateHeaders/$(KEXT_FAMILY_NAME)" +PUBLIC_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/Headers/$(KEXT_FAMILY_NAME)" ADDED Configurations/components/CC_kernel_deployment.xcconfig Index: Configurations/components/CC_kernel_deployment.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_kernel_deployment.xcconfig @@ -0,0 +1,13 @@ +// +// CC_kernel_deployment.xcconfig +// CommonCrypto +// +// Created by Stacey Son on 10/20/10. +// Copyright 2010 Apple. All rights reserved. +// + +// This XCCONFIG file is for the deployment version of the kernel CommonCrypto kext. + +#include "CC_deployment.xcconfig" + +#include "CC_kernel.xcconfig" ADDED Configurations/components/CC_kernel_development.xcconfig Index: Configurations/components/CC_kernel_development.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_kernel_development.xcconfig @@ -0,0 +1,13 @@ +// +// CC_kernel_development.xcconfig +// CommonCrypto +// +// Created by Stacey Son on 10/20/10. +// Copyright 2010 Apple. All rights reserved. +// + +// This XCCONFIG file is for the development version of the kernel CommonCrypto kext. + +#include "CC_development.xcconfig" + +#include "CC_kernel.xcconfig" ADDED Configurations/components/CC_static.xcconfig Index: Configurations/components/CC_static.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_static.xcconfig @@ -0,0 +1,15 @@ +// +// CC_static.xcconfig +// CommonCrypto +// +// Created by Jim Murphy on 1/11/10. +// Copyright 2010 Apple. All rights reserved. +// + +// This XCCONFIG file defines settings that specific for static libraries + +STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = Dynamic + +EXECUTABLE_EXTENSION = a + +LIBRARY_STYLE = Static ADDED Configurations/components/CC_static_deployment.xcconfig Index: Configurations/components/CC_static_deployment.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_static_deployment.xcconfig @@ -0,0 +1,12 @@ +// +// CC_static_deployment.xcconfig +// CommonCrypto +// +// Created by Jim Murphy on 1/11/10. +// Copyright 2010 Apple. All rights reserved. +// + +// This XCCONFIG file is for the deployment version of the static CommonCrypto Library + +#include "CC_deployment.xcconfig" +#include "CC_static.xcconfig" ADDED Configurations/components/CC_static_development.xcconfig Index: Configurations/components/CC_static_development.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_static_development.xcconfig @@ -0,0 +1,12 @@ +// +// CC_static_development.xcconfig +// CommonCrypto +// +// Created by Jim Murphy on 1/11/10. +// Copyright 2010 Apple. All rights reserved. +// + +// This XCCONFIG file is for the development version of the static CommonCrypto Library + +#include "CC_development.xcconfig" +#include "CC_static.xcconfig" ADDED Configurations/components/CC_umbrellaMember.xcconfig Index: Configurations/components/CC_umbrellaMember.xcconfig ================================================================== --- /dev/null +++ Configurations/components/CC_umbrellaMember.xcconfig @@ -0,0 +1,17 @@ +// +// CC_umbrellaMember.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +// This XCCONFIG file defines settings that specific for umbrella member libraries + +OTHER_LDFLAGS = -Wl -umbrella System -allowable_client otest -allowable_client CommonCryptoUnitTest -allowable_client XTSTest -allowable_client CBCTest -allowable_client tcCryptoTool -allowable_client bigcbc + +STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = Dynamic + +EXECUTABLE_EXTENSION = dylib + +LIBRARY_STYLE = Dynamic ADDED Configurations/platforms/CC_MacOSXClient.xcconfig Index: Configurations/platforms/CC_MacOSXClient.xcconfig ================================================================== --- /dev/null +++ Configurations/platforms/CC_MacOSXClient.xcconfig @@ -0,0 +1,10 @@ +// +// MacOSXClient.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. + +SDKROOT = macosx10.6 +OTHER_CFLAGS = -fstack-protector-all -Wstack-protector -DSHA256_USE_ASSEMBLY=1 -DCC_MACOSX +PRODUCT_NAME = commonCrypto ADDED Configurations/platforms/CC_iOSClient.xcconfig Index: Configurations/platforms/CC_iOSClient.xcconfig ================================================================== --- /dev/null +++ Configurations/platforms/CC_iOSClient.xcconfig @@ -0,0 +1,10 @@ +// +// MacOSXClient.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. + +SDKROOT = iphoneos5.0.internal +OTHER_CFLAGS = -fstack-protector-all -Wstack-protector -DSHA256_USE_ASSEMBLY=1 -DCC_iOS +PRODUCT_NAME = commonCrypto ADDED Configurations/platforms/CC_iOSClientSim.xcconfig Index: Configurations/platforms/CC_iOSClientSim.xcconfig ================================================================== --- /dev/null +++ Configurations/platforms/CC_iOSClientSim.xcconfig @@ -0,0 +1,12 @@ +// +// MacOSXClient.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. + +//SDKROOT = iphonesimulator5.0 +OTHER_CFLAGS = -fstack-protector-all -Wstack-protector -DSHA256_USE_ASSEMBLY=1 -DCC_iOS_SIM +PRODUCT_NAME = commonCrypto_sim +PRIVATE_HEADERS_FOLDER_PATH = $(SDKROOT)/usr/local/include/CommonCrypto +PUBLIC_HEADERS_FOLDER_PATH = $(SDKROOT)/usr/include/CommonCrypto ADDED Configurations/targets/CC_MacOSXClient_deployment.xcconfig Index: Configurations/targets/CC_MacOSXClient_deployment.xcconfig ================================================================== --- /dev/null +++ Configurations/targets/CC_MacOSXClient_deployment.xcconfig @@ -0,0 +1,14 @@ +// +// CommonCrypto_MacOSXClient_deployment.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + + +// This XCCONFIG file is for the deployment version of the CommonCrypto umbrella member for System CommonCrypto Library for MacOSX + +#include "../components/CC_deployment.xcconfig" +#include "../components/CC_umbrellaMember.xcconfig" +#include "../platforms/CC_MacOSXClient.xcconfig" ADDED Configurations/targets/CC_MacOSXClient_development.xcconfig Index: Configurations/targets/CC_MacOSXClient_development.xcconfig ================================================================== --- /dev/null +++ Configurations/targets/CC_MacOSXClient_development.xcconfig @@ -0,0 +1,13 @@ +// +// CommonCrypto_MacOSXClient_development.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +// This XCCONFIG file is for the development version of the CommonCrypto umbrella member for System CommonCrypto Library for MacOSX + +#include "../components/CC_development.xcconfig" +#include "../components/CC_umbrellaMember.xcconfig" +#include "../platforms/CC_MacOSXClient.xcconfig" ADDED Configurations/targets/CC_iOSClient_deployment.xcconfig Index: Configurations/targets/CC_iOSClient_deployment.xcconfig ================================================================== --- /dev/null +++ Configurations/targets/CC_iOSClient_deployment.xcconfig @@ -0,0 +1,14 @@ +// +// CommonCrypto_MacOSXClient_deployment.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + + +// This XCCONFIG file is for the deployment version of the umbrella member for System CommonCrypto Library + +#include "../components/CC_deployment.xcconfig" +#include "../components/CC_umbrellaMember.xcconfig" +#include "../platforms/CC_iOSClient.xcconfig" ADDED Configurations/targets/CC_iOSClient_development.xcconfig Index: Configurations/targets/CC_iOSClient_development.xcconfig ================================================================== --- /dev/null +++ Configurations/targets/CC_iOSClient_development.xcconfig @@ -0,0 +1,13 @@ +// +// CC_MacOSXClient_development.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +// This XCCONFIG file is for the development version of the CommonCrypto umbrella member for System CommonCrypto Library for MacOSX + +#include "../components/CC_development.xcconfig" +#include "../components/CC_umbrellaMember.xcconfig" +#include "../platforms/CC_iOSClient.xcconfig" ADDED Configurations/targets/CC_iOSSim_deployment.xcconfig Index: Configurations/targets/CC_iOSSim_deployment.xcconfig ================================================================== --- /dev/null +++ Configurations/targets/CC_iOSSim_deployment.xcconfig @@ -0,0 +1,14 @@ +// +// CC_MacOSXClient_deployment.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + + +// This XCCONFIG file is for the deployment version of the umbrella member for System CommonCrypto Library + +#include "../components/CC_deployment.xcconfig" +#include "../components/CC_umbrellaMember.xcconfig" +#include "../platforms/CC_iOSClientSim.xcconfig" ADDED Configurations/targets/CC_iOSSim_development.xcconfig Index: Configurations/targets/CC_iOSSim_development.xcconfig ================================================================== --- /dev/null +++ Configurations/targets/CC_iOSSim_development.xcconfig @@ -0,0 +1,13 @@ +// +// CC_MacOSXClient_development.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +// This XCCONFIG file is for the development version of the CommonCrypto umbrella member for System CommonCrypto Library for MacOSX + +#include "../components/CC_development.xcconfig" +#include "../components/CC_umbrellaMember.xcconfig" +#include "../platforms/CC_iOSClientSim.xcconfig" ADDED Configurations/tests/CC_localtest.xcconfig Index: Configurations/tests/CC_localtest.xcconfig ================================================================== --- /dev/null +++ Configurations/tests/CC_localtest.xcconfig @@ -0,0 +1,13 @@ +// +// CommonCrypto_unittest_base.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +ARCHS = $(NATIVE_ARCH) $(ARCHS_STANDARD_64_BIT) arm +GCC_OPTIMIZATION_LEVEL = 0 +GCC_PREPROCESSOR_DEFINITIONS = _FORTIFY_SOURCE=2 DEBUG +COPY_PHASE_STRIP = NO +WARNING_CFLAGS = -Wall ADDED Configurations/tests/CC_unitTest_dynamic_development.xcconfig Index: Configurations/tests/CC_unitTest_dynamic_development.xcconfig ================================================================== --- /dev/null +++ Configurations/tests/CC_unitTest_dynamic_development.xcconfig @@ -0,0 +1,11 @@ +// +// CommonCrypto_unitTest_dynamic_development.xcconfig +// CommonCrypto +// +// Created by Jim Murphy on 1/13/10. +// Copyright 2010 Apple. All rights reserved. +// + +#include "CC_unittest_development.xcconfig" + +LIBRARY_STYLE = Dynamic ADDED Configurations/tests/CC_unittest_base.xcconfig Index: Configurations/tests/CC_unittest_base.xcconfig ================================================================== --- /dev/null +++ Configurations/tests/CC_unittest_base.xcconfig @@ -0,0 +1,39 @@ +// +// CommonCrypto_unittest_base.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +// This XCCONFIG file defines the shared settings for all unit test targets of the +// CommonCrypto XCode Project + + +// ************************************************************************** +// * Begin Project Section +// ************************************************************************** + +CC_PATH_BASE = $(PROJECT_DIR) +CC_PATH_UNIT_TEST_SOURCE = $(CC_PATH_BASE)/UnitTestSource + +PRODUCT_NAME = CommonCryptoUnitTest + +ARCHS = $(NATIVE_ARCH) $(ARCHS_STANDARD_64_BIT) arm + +OTHER_LDFLAGS = -framework Cocoa -framework SenTestingKit + +WRAPPER_EXTENSION = octest + +FRAMEWORK_SEARCH_PATHS = $(DEVELOPER_FRAMEWORKS_DIR) + +GCC_PREFIX_HEADER = $(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h + +INFOPLIST_FILE = $(CC_PATH_UNIT_TEST_SOURCE)/CommonCryptoUnitTests-Info.plist + +OBJC_DISABLE_GC = NO + +// ************************************************************************** +// * End Project Section +// ************************************************************************** + ADDED Configurations/tests/CC_unittest_deployment.xcconfig Index: Configurations/tests/CC_unittest_deployment.xcconfig ================================================================== --- /dev/null +++ Configurations/tests/CC_unittest_deployment.xcconfig @@ -0,0 +1,20 @@ +// +// CommonCrypto_unittest_base.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +// This XCCONFIG file defines the deployment setting for unit test targets of the +// CommonCrypto XCode Project + +#include "CC_unittest_base.xcconfig" + +GCC_OPTIMIZATION_LEVEL = s + +GCC_PREPROCESSOR_DEFINITIONS_PROJECT = NDEBUG + +COPY_PHASE_STRIP = YES + +WARNING_CFLAGS = -Wall ADDED Configurations/tests/CC_unittest_development.xcconfig Index: Configurations/tests/CC_unittest_development.xcconfig ================================================================== --- /dev/null +++ Configurations/tests/CC_unittest_development.xcconfig @@ -0,0 +1,20 @@ +// +// CommonCrypto_unittest_base.xcconfig +// CommonCrypto +// +// InfoSec Standard Configuration +// Copyright 2010 Apple Inc. All rights reserved. +// + +// This XCCONFIG file defines the development setting for unit test targets of the +// CommonCrypto XCode Project + +#include "CC_unittest_base.xcconfig" + +GCC_OPTIMIZATION_LEVEL = 0 + +GCC_PREPROCESSOR_DEFINITIONS_PROJECT = DEBUG + +COPY_PHASE_STRIP = NO + +WARNING_CFLAGS = -Wall ADDED Configurations/tests/CC_unittest_dynamic_deployment.xcconfig Index: Configurations/tests/CC_unittest_dynamic_deployment.xcconfig ================================================================== --- /dev/null +++ Configurations/tests/CC_unittest_dynamic_deployment.xcconfig @@ -0,0 +1,11 @@ +// +// CommonCrypto_unittest_dynamic_deployment.xcconfig +// CommonCrypto +// +// Created by Jim Murphy on 1/13/10. +// Copyright 2010 Apple. All rights reserved. +// + +#include "CC_unittest_deployment.xcconfig" + +LIBRARY_STYLE = Dynamic ADDED Configurations/tests/CC_unittest_static_deployment.xcconfig Index: Configurations/tests/CC_unittest_static_deployment.xcconfig ================================================================== --- /dev/null +++ Configurations/tests/CC_unittest_static_deployment.xcconfig @@ -0,0 +1,11 @@ +// +// CommonCrypto_unittest_static_deployment.xcconfig +// CommonCrypto +// +// Created by Jim Murphy on 1/13/10. +// Copyright 2010 Apple. All rights reserved. +// + +#include "CC_unittest_deployment.xcconfig" + +LIBRARY_STYLE = Static ADDED Configurations/tests/CC_unittest_static_development.xcconfig Index: Configurations/tests/CC_unittest_static_development.xcconfig ================================================================== --- /dev/null +++ Configurations/tests/CC_unittest_static_development.xcconfig @@ -0,0 +1,11 @@ +// +// CommonCrypto_unittest_static_development.xcconfig +// CommonCrypto +// +// Created by Jim Murphy on 1/13/10. +// Copyright 2010 Apple. All rights reserved. +// + +#include "CC_unittest_development.xcconfig" + +LIBRARY_STYLE = Static DELETED LocalTests/CBCTest/CBCTest.c Index: LocalTests/CBCTest/CBCTest.c ================================================================== --- LocalTests/CBCTest/CBCTest.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * CBCTest.c - * CommonCrypto - */ - -#include "CBCTest.h" - -static void -doCBCTestCase(int caseNumber, int direction, int dataLenBits, char *ivStr, char *cipherText, char *plainText, char *keyStr) -{ - char keyString[300]; - int ckLen, keyLength; - byteBuffer key, tweak, iv; - byteBuffer pt, ct; - CCCryptorRef encCryptorRef; - CCCryptorStatus retval; - char dataOut[4096]; - int passed = 0; - int dataLen; - size_t dataOutMoved; - - ckLen = strlen(keyStr); - strncpy(keyString, keyStr, ckLen); - keyString[ckLen] = 0; - - keyLength = ckLen/2; - - key = hexStringToBytes(keyString); - tweak = NULL; - iv = hexStringToBytes(ivStr); - - encCryptorRef = NULL; - - if(plainText) pt = hexStringToBytes(plainText); - else pt=NULL; - if(cipherText) ct = hexStringToBytes(cipherText); - else ct=NULL; - - - printf("\n\nKey %s\n", keyStr); - printf("IV %s\n", ivStr); - printf("Plaintext %s\n", plainText); - - if((retval = CCCryptorCreateWithMode(0, kCCModeCBC, kCCAlgorithmAES128, ccDefaultPadding, NULL, key->bytes, key->len, tweak, 0, 0, 0, &encCryptorRef)) == kCCSuccess) { - if(direction == ENCRYPT) { - dataLen = pt->len; - if((retval = CCCryptorEncryptDataBlock(encCryptorRef, iv->bytes, pt->bytes, dataLen, dataOut)) == kCCSuccess) { - byteBuffer bb = bytesToBytes(dataOut, dataLen); - if(!ct) { - printf("Output %s\n", bytesToHexString(bb)); - passed = 3; - } - else if (!bytesAreEqual(ct, bb)) - printf("Encrypt (%d) Output %s\nEncrypt (%d) Expect %s\n", dataLen, bytesToHexString(bb), dataLen, cipherText); - else - passed = 1; - } else printf("Failed to encrypt %d\n", retval); - } else { - dataLen = ct->len; - if((retval = CCCryptorDecryptDataBlock(encCryptorRef, iv->bytes, ct->bytes, dataLen, dataOut)) == kCCSuccess) { - byteBuffer bb = bytesToBytes(dataOut, dataLen); - if(!pt) { - printf("Output %s\n", bytesToHexString(bb)); - passed = 3; - } - else if (!bytesAreEqual(pt, bb)) - printf("Decrypt Output %s\nDecrypt Expect %s\n", bytesToHexString(bb), plainText); - else passed = 1; - } else printf("Failed to decrypt %d\n", retval); - } - - if((retval = CCCryptorFinal(encCryptorRef, dataOut, 0, &dataOutMoved)) != kCCSuccess) printf("Finalize failed\n"); - } else { - printf("Failed to create Cryptor\n"); - } - - - if(passed != 3) printf("Case %d Direction %s DataLen %d Test %s\n", caseNumber, (direction == ENCRYPT) ? "Encrypt": "Decrypt", dataLen, (passed) ? "Pass": "Fail"); - else printf("\n"); - free(pt); - free(ct); - free(key); - free(tweak); - free(iv); - -} - -int main (int argc, const char * argv[]) { - int direction; - int caseNumber; - int dataLen; - char *keyStr; - char *iv; - char *plainText; - char *cipherText; - - direction = DECRYPT; - caseNumber = 500; - dataLen = 8192; - keyStr = "badfd2102e1e180a634204249c5a6933"; - iv = "84c06c16c151007ca9ed9bb926e66eec"; - cipherText = "4b52b5e85aecaaaf886bd9e8805390c62e12e13357e4beb3b713e37d217c6f7a9e432a04f87bd8a4dd0ef79eb7bf41b5a2a27e63361d7cb7af7b3c9a8f0b56ae27dc9cfd6c10eb1a79c7be35d31c3965b8e7099775f7644029bd79321f5dd12c55280a30fabd1b95e27c2d4dec6ca4d8716f36e7abe3408f5120560b573e5495ae7aad668fa84d6a8a1156c231a5b6d983ece3e27d199a806dc629c1a60c08ccb0e4807d9fed88f28ce0f59583708f540f97110b2620b1679220abe13e3c4b727186b289794583b20154ce9a07a284df3e63572f462142cae8949d7dd6f2b26fb90d556ec75e93dd33b59d697883312af89e52945b9baedfebe28759cdba4dfbf6e6f201b087478642cf0b34f983593c68947e4ee05bd17716e6cfb7c74c876c0ba650f3979f5eceb72a71d0d46aac4474ae2048d2a9884aa12e292950c77b17de11e8d3e895e60b1c584b1c8d9edd40ba7917e396d1d3bfd1941923aa40213195e8b8f7f4d5ae1057cbecdf89c8959745d1fcece59115819dc661e7b097c132e8f98720a57a83469cb82c374fdebc97badd7cef8d160a7f27d50f35b7e4af6f1b78361828e32a55b25fd56efbc12f8fcb7e2e4f882afa0c7747a455a1fae00a561cbb878e01b32fafb23f397371a8b3441c8da654b902d8489383542188821859a44f0fb2b63a49835f8ba5f0231ff0f8f5fc3d5c812331b11e39bc03394e28"; - plainText = "fb58510beb65062c525a3de42d934d4b4ec433d600a1467142751886a10e7bf96f236c196d12dcf0698e09efc79a4bea072bc0830da8886674cf6174206cca2d4e9e543f0016ec4dcc602ffd0a417c722879e259497f89aee5ad99a4f65887058242250fbe44f61eab5e668adbb780a4cba97393f6ff152c13c39b57ed727bb94cf19d1b4a55f45cceb22b6c4f26f736d20a48cb6230578591c8d33d72b778d30b304818b20d918ef654cabeae1038f2a0db5170d2b4df38c6efc887bc1f837fba34e97daf8920414b748a909ad5ef56fb47fa53c680aae808f3e6065689339728251e18cd264f5385c969f87104099563a411cfe681d19134e9479e059d09b69f5010912291d0232f733a2688b3042ec4e82ce5163c384ee54a9f10e48a8ab46fd7147351dd8514bda5d8c4ce8babcc3ef82dbf44799fc59e37d8f3c99506d2168c84d8381f4f9a84cbce7bd0bb4bbbcdef0c626356d3ca126c8776e3a291881af518e23dbd067016c5898bed5f64d6e8f8acefba83f92b0c318ec7b905165fb6b81bc60528c0a0e3db38ab1ee6f37e56dbf270c0751674e0ddb1a6076d8f78084ce31f0d3673e638e0110575b16d9d9f151c1b9aca8d15d7a8111c0de5acf5ae3b307e8064c90329e421e3434a1ecd253b153447c21c79c9946666dae444c49a31b1f94da603a8377168dc4f874e98fff5ae89dd35d44e89df5748223b7a24"; - - - doCBCTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, keyStr); - - /* taken from the AES_KAT test file CBCVarKey128e.txt */ - printf("\nIV and Plaintext == 00000...\n"); - direction = ENCRYPT; - caseNumber = 3; - dataLen = 256; - keyStr = "f0000000000000000000000000000000"; - iv = "00000000000000000000000000000000"; - plainText = "00000000000000000000000000000000"; - cipherText = "970014d634e2b7650777e8e84d03ccd8"; - doCBCTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, keyStr); - - - /* taken from the AES_KAT test file CBCVarKey128e.txt */ - printf("\nIV == a0a0..\n"); - direction = ENCRYPT; - caseNumber = 3; - dataLen = 256; - keyStr = "f0000000000000000000000000000000"; - iv = "a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0"; - plainText = "00000000000000000000000000000000"; - cipherText = NULL; - doCBCTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, keyStr); - - /* taken from the AES_KAT test file CBCVarKey128e.txt */ - printf("\nplaintext == a0a0..\n"); - direction = ENCRYPT; - caseNumber = 3; - dataLen = 256; - keyStr = "f0000000000000000000000000000000"; - iv = "00000000000000000000000000000000"; - plainText = "a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0"; - cipherText = NULL; - doCBCTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, keyStr); - - printf("\nIV and Plaintext == 00 key is all F's\n"); - direction = ENCRYPT; - caseNumber = 3; - dataLen = 256; - keyStr = "ffffffffffffffffffffffffffffffff"; - iv = "00000000000000000000000000000000"; - plainText = "00000000000000000000000000000000"; - cipherText = NULL; - doCBCTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, keyStr); - - direction = ENCRYPT; - caseNumber = 3; - dataLen = 512; - keyStr = "ffffffffffffffffffffffffffffffff"; - iv = "00000000000000000000000000000000"; - plainText = "00000000000000000000000000000000a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0"; - cipherText = NULL; - doCBCTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, keyStr); - - direction = ENCRYPT; - caseNumber = 3; - dataLen = 512; - keyStr = "ffffffffffffffffffffffffffffffff"; - iv = "a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0"; - plainText = "00000000000000000000000000000000a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0"; - cipherText = NULL; - doCBCTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, keyStr); - return 0; -} DELETED LocalTests/CBCTest/CBCTest.h Index: LocalTests/CBCTest/CBCTest.h ================================================================== --- LocalTests/CBCTest/CBCTest.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * CBCTest.h - * CommonCrypto - */ - -#include -#include -#include -#include "byteBuffer.h" - -#ifndef _XXXX_H_ -#define _XXXX_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#define ENCRYPT 0 -#define DECRYPT 1 - - - - - -#ifdef __cplusplus -} -#endif - -#endif /* _XXXX_H_ */ - DELETED LocalTests/XTSTest/crypto.c Index: LocalTests/XTSTest/crypto.c ================================================================== --- LocalTests/XTSTest/crypto.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include - -static int keyLength = 16; -static int dataLength = 512; - - -int main (int argc, const char * argv[]) { - runAllVectors(); - return 0; -} DELETED LocalTests/XTSTest/hexString.c Index: LocalTests/XTSTest/hexString.c ================================================================== --- LocalTests/XTSTest/hexString.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * hexString.c - * byteutils - * - * Created by Richard Murphy on 3/7/10. - * Copyright 2010 McKenzie-Murphy. All rights reserved. - * - */ - -#include "hexString.h" - -/* utility function to convert hex character representation to their nibble (4 bit) values */ -static uint8_t -nibbleFromChar(char c) -{ - if(c >= '0' && c <= '9') return c - '0'; - if(c >= 'a' && c <= 'f') return c - 'a' + 10; - if(c >= 'A' && c <= 'F') return c - 'A' + 10; - return 255; -} - -/* Convert a string of characters representing a hex buffer into a series of bytes of that real value */ -uint8_t -*hexStringToBytes(char *inhex) -{ - uint8_t *retval; - uint8_t *p; - int len, i; - - len = strlen(inhex) / 2; - retval = malloc(len+1); - for(i=0, p = (uint8_t *) inhex; i> 4); - retval[i*2+1] = nibbleToChar(bytes[i] & 0x0f); - } - retval[i] = '\0'; - return retval; -} DELETED LocalTests/XTSTest/hexString.h Index: LocalTests/XTSTest/hexString.h ================================================================== --- LocalTests/XTSTest/hexString.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hexString.h - * byteutils - * - * Created by Richard Murphy on 3/7/10. - * Copyright 2010 McKenzie-Murphy. All rights reserved. - * - */ - -#include -#include -#include - -uint8_t -*hexStringToBytes(char *inhex); - -char -*bytesToHexString(uint8_t *bytes, size_t buflen); DELETED LocalTests/XTSTest/printByteBuffer.c Index: LocalTests/XTSTest/printByteBuffer.c ================================================================== --- LocalTests/XTSTest/printByteBuffer.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * printByteBuffer.c - * byteutils - * - * Created by Richard Murphy on 3/7/10. - * Copyright 2010 McKenzie-Murphy. All rights reserved. - * - */ - -#include "printByteBuffer.h" - -void printByteBuffer(uint8_t *buff, size_t len, char *name) -{ - int i; - printf("Dumping %d bytes from %s\n", len, name); - for(i=0; i 0 && !(i%8)) putchar(' '); - if(i > 0 && !(i%64)) putchar('\n'); - printf("%02x", buff[i]); - } - putchar('\n'); -} DELETED LocalTests/XTSTest/printByteBuffer.h Index: LocalTests/XTSTest/printByteBuffer.h ================================================================== --- LocalTests/XTSTest/printByteBuffer.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * printByteBuffer.h - * byteutils - * - * Created by Richard Murphy on 3/7/10. - * Copyright 2010 McKenzie-Murphy. All rights reserved. - * - */ - -#include -#include - -void printByteBuffer(uint8_t *buff, size_t len, char *name); - DELETED LocalTests/XTSTest/xtsTestVectors.c Index: LocalTests/XTSTest/xtsTestVectors.c ================================================================== --- LocalTests/XTSTest/xtsTestVectors.c +++ /dev/null @@ -1,10115 +0,0 @@ -/* - * xtsTestVectors.c - * XTSTest - * - * Created by Richard Murphy on 6/24/10. - * Copyright 2010 McKenzie-Murphy. All rights reserved. - * - */ - -#include -#include -#include -#include "xtsTestVectors.h"; -#include "hexstring.h" - -/* -# CAVS 9.0 -# XTSGen information for "sample"; -# State tested: Encrypt/Decrypt -# combinedKey Length: AES128 -# Data Unit Lengths Tested: 128 256 192 576 4096 -# Generated on Wed Mar 31 11:08:59 2010 -*/ - -#define ENCRYPT 0 -#define DECRYPT 1 - - -static void -doXTSTestCase(int caseNumber, int direction, int dataLenBits, char *ivStr, char *cipherText, char *plainText, char *combinedKey) -{ - char keyString[300], twkString[300]; - int ckLen, keyLength; - uint8_t *key, *tweak, *iv; - uint8_t *pt, *ct; - CCCryptorRef encCryptorRef; - CCCryptorStatus retval; - char dataOut[4096]; - int passed = 0; - int dataLen; - size_t dataOutMoved; - - dataLen = dataLenBits / 8; - ckLen = strlen(combinedKey)/2; - strncpy(keyString, combinedKey, ckLen); - keyString[ckLen] = 0; - strncpy(twkString, combinedKey+ckLen, ckLen); - twkString[ckLen] = 0; - - keyLength = ckLen/2; - - key = hexStringToBytes(keyString); - tweak = hexStringToBytes(twkString); - iv = hexStringToBytes(ivStr); - - pt = hexStringToBytes(plainText); - ct = hexStringToBytes(cipherText); - - if((retval = CCCryptorCreateWithMode(0, kCCModeXTS, kCCAlgorithmAES128, ccDefaultPadding, NULL, key, keyLength, tweak, keyLength, 0, 0, &encCryptorRef)) == kCCSuccess) { - if(direction == ENCRYPT) { - if((retval = CCCryptorEncryptDataBlock(encCryptorRef, iv, pt, dataLen, dataOut)) == kCCSuccess) { - if (memcmp(ct, dataOut, dataLen)) printf("Output %s\nExpect %s\n", bytesToHexString((uint8_t *) dataOut, dataLen), /*bytesToHexString(ct, dataLen)*/ cipherText); - else passed = 1; - } else printf("Failed to encrypt\n", retval); - } else { - if((retval = CCCryptorDecryptDataBlock(encCryptorRef, iv, ct, dataLen, dataOut)) == kCCSuccess) { - if (memcmp(pt, dataOut, dataLen)) printf("Output %s\nExpect %s\n", bytesToHexString((uint8_t *) dataOut, dataLen), /* bytesToHexString(pt, dataLen)*/ plainText); - else passed = 1; - } else printf("Failed to decrypt\n", retval); - } - - if((retval = CCCryptorFinal(encCryptorRef, dataOut, 0, &dataOutMoved)) != kCCSuccess) printf("Finalize failed\n"); - } else { - printf("Failed to create Cryptor\n"); - } - - - printf("Case %d Direction %s DataLen %d Test %s\n", caseNumber, (direction == ENCRYPT) ? "Encrypt": "Decrypt", dataLen, (passed) ? "Pass": "Fail"); - -#ifdef NEVER - printf("Combined key %s\n", combinedKey); - printf("KEY %s\n", keyString); - printf("key %s\n", bytesToHexString(key, keyLength)); - printf("TWK %s\n", twkString); - printf("twk %s\n", bytesToHexString(tweak, keyLength)); - printf("IV %s\n", ivStr); - printf("iv %s\n", bytesToHexString(iv, strlen(ivStr)/2)); -#endif - free(pt); - free(ct); - free(key); - free(tweak); - free(iv); - -} - - -void -runAllVectors() -{ - - int direction; - int caseNumber; - int dataLen; - char *combinedKey; - char *iv; - char *plainText; - char *cipherText; - - direction = ENCRYPT; - - caseNumber = 1; - dataLen = 128; - combinedKey = "46e6ed9ef42dcdb3c893093c28e1fc0f91f5caa3b6e0bc5a14e783215c1d5b61"; - iv = "72f3b054cbdc2f9e3c5bc551d44ddba0"; - plainText = "e3778d68e730ef945b4ae3bc5b936bdd"; - cipherText = "97409f1f71ae4521cb49a32973de4d05"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 2; - dataLen = 128; - combinedKey = "9356cdad251ab61114cec2c44a6092dde9f746cc65ae3bd4966864aa3626d188"; - iv = "68882783652436c4857a88c0c373417e"; - plainText = "ce176bdde339505ba15dea36d28ce87d"; - cipherText = "22f5f937dfb39e5b7425ed863d310be1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 3; - dataLen = 128; - combinedKey = "c3daa5a0b67699f781050478cbfb8e93f381f71663d4c17375df9112c46a1863"; - iv = "26be92ac9883cea1da85335f8c169edb"; - plainText = "d988cd5db0502786c519b71cb38f4c62"; - cipherText = "e90a71b4bcd1baf3eb1f51ffecc464a9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 4; - dataLen = 128; - combinedKey = "924d6e017be6ed2686f4b2b7f50629b860c5e0a51d40f0c57847fc3fd9e79c48"; - iv = "0f5a522a6d4bc6650531860ac6223471"; - plainText = "0d8e5ba22f3fedb14ab6ab2fce9b0f84"; - cipherText = "b80a22c1e6522c47844158774b55131e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 5; - dataLen = 128; - combinedKey = "5a7d8971136edc537e767135958c13fa7549c059cd14a2f19abaa86aad09b56c"; - iv = "4108e1a5e460b29a52f1d960f7d8541d"; - plainText = "9634a03111720ef421e6dd5a6a9869c3"; - cipherText = "8437d5973fae25c6e5f3fd6795e5ea7a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 6; - dataLen = 128; - combinedKey = "e70c3574ba7d4be13d944c87c94ec8c5bf7b7fb10e1bb34c326af55c2385cfc2"; - iv = "200fc1e13044c4d473f410b91a26402f"; - plainText = "109184aefa5ebade528f50f497819af9"; - cipherText = "1e4cccaf01de731a3b5d5882b2db3af6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 7; - dataLen = 128; - combinedKey = "aa94d75ee53206db4ebc4d0bd8b5c0aa7600677c620bbe2a6c08bde8d6b2ebc5"; - iv = "bafe6f820df92ae653e70fce03159093"; - plainText = "b425ce1c7d7524404d2a2be5de5c1c28"; - cipherText = "d2c2c145a71daf7bd3339596474439ba"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 8; - dataLen = 128; - combinedKey = "9bb0eaf85277f24f15a3d86aed6c9cc5a218531886efb7c98be7a864b8c1d365"; - iv = "d4d6ad1e9d90f44c08c30dd9216c984a"; - plainText = "ca212d69459d37e284b8e03cfc99c1ad"; - cipherText = "09d9be40648420ee46141d717654c569"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 9; - dataLen = 128; - combinedKey = "af558471cdedddf76da56c3428ec8977b812152d386ed35dcbc8f833a36cc612"; - iv = "6f19db800dc2f23642bbbf1348d8141c"; - plainText = "22590e7d9368bb8c3fbf543144704fec"; - cipherText = "a394535e6069737682389f44d29b1f04"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 10; - dataLen = 128; - combinedKey = "b193c8d188a759da598bf5cd2e2c18a714dfcc29d4872c379208769b3c24c754"; - iv = "985a005543fe821949ff374d14abac1f"; - plainText = "5c916b0688c37acc2d413d37e941becf"; - cipherText = "1b3dfebd87bca7e745bdd5969280e3b4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 11; - dataLen = 128; - combinedKey = "9eeb844d6133cc6250015374883d394d99756aa7c9ff87b263b2ed8623a343a1"; - iv = "ea49deb5767de58ac448ecd0870b1133"; - plainText = "e94be598b8b79af4a96b0a75eff1624c"; - cipherText = "de1bc0e8065f47725abcd960eb7b0007"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 12; - dataLen = 128; - combinedKey = "0b9272f968591908540cdc73bdc4e21e675afecea6b6ed11787f879a35ac8a76"; - iv = "ef8b4a7f6840d527139f27cd12d5b503"; - plainText = "26adc7c756b66b768c18ca524bc7eaf4"; - cipherText = "4910b9bf93e6f5396c6dc1fbca34ae93"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 13; - dataLen = 128; - combinedKey = "d1e5752b6d4edcba52c7cdc783d639deb4949b7c0fd49f7e990758e93d2427a7"; - iv = "999568ef48e3e5be3ee183d1cf6cadc6"; - plainText = "ebadc47d64132e5a947b2bbb6cb74de7"; - cipherText = "e12ec44d0a161af9a2f610d3d7ee80cb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 14; - dataLen = 128; - combinedKey = "8343d923672c7251dac3c0e2b4ba938ddda625d96d87f65728dbc1c7a19d7956"; - iv = "d2985181e51af64ca2fe258b0532f01e"; - plainText = "ea36ad6982084bae3dfb5da13a848bc9"; - cipherText = "5756b2c27e3759d8aac41c112ce46f1d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 15; - dataLen = 128; - combinedKey = "9bdea2cb7980cf3b6ad584aff48cd9b48bcaa04a22d2d285f987c7472ea26462"; - iv = "314b49ef42bead17d471edb4f7bd8249"; - plainText = "593fddd423b07dd305e6fa755646eb87"; - cipherText = "c4c90e697472d8654728e476686707b5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 16; - dataLen = 128; - combinedKey = "a9d1d6fc95145da71f855ca00987583a31dd2e8042b7f2cf18b401f73d50b455"; - iv = "02371d129cb6549113eae4fdb4f33a58"; - plainText = "a83389303b071ada2ad63fb022ce8185"; - cipherText = "fc007f02d048b0fd5ac1f4961ad371d4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 17; - dataLen = 128; - combinedKey = "e43aa519a45d3995f1ef7de5ffebb1ef953c1e725489dc6a79c44b8339cb4ede"; - iv = "6fdcc5d82dda465558ea491f2ee95965"; - plainText = "44f98b934211c32167e6ca984fa72f48"; - cipherText = "0e6b661c07514e535e154d4fece0efbb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 18; - dataLen = 128; - combinedKey = "05331feac8e26c7abf7b0199471b1b3156046f7d5d6366e0dfcd58d16b7fd7bb"; - iv = "3231245be6cdbf7ba62e72744d8d5d44"; - plainText = "5b0003774dedbee211b62b14389129f8"; - cipherText = "14fc9642efb9d7cbac1535f849c25329"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 19; - dataLen = 128; - combinedKey = "ebdb518a8fda4dc1626865f0152c874f0b939c2f5cff005c3ff73f40fefcccb6"; - iv = "dc88a417430c423d03fda7592b9dcfed"; - plainText = "f7c296278e13d62c8d7a6d0423897769"; - cipherText = "5c2331739d4719b4b17641732d1d507c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 20; - dataLen = 128; - combinedKey = "8562619696b172f713f292e4e1f6d8b70f786ff2ff737c259a14ae0f4e453235"; - iv = "4c3f1509a5913c01e008a90b16345199"; - plainText = "362357e4d3941c67f93510bc84eb87ef"; - cipherText = "d837806c7dc8568b196236499b901eab"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 21; - dataLen = 128; - combinedKey = "b9c8c973664be2404ff6b8939f0f43597b84f4bf3ac8a2c34586e37a12a55c8c"; - iv = "8f6543078cb5544cfdded59f997236c2"; - plainText = "e23581d57ad3da3338f89244f7e53226"; - cipherText = "003c2ef98b83e55e033a7d19baf07209"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 22; - dataLen = 128; - combinedKey = "a6fbbf745b5846556beea67b2e9cab498b7635b674b9e0c999bf66d09a7398d0"; - iv = "2b3fbde91758802b76a7c980d42b43a7"; - plainText = "2d804bf5cda27a0eb3f7e0de08637abe"; - cipherText = "48b2778badffa7bfff409c3671e2c231"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 23; - dataLen = 128; - combinedKey = "e345a20273cf591c5b8ac1078f4fc21c80b8a55d1b3d7c89c548b5ae133ad33d"; - iv = "09083e8b63955a9e7589f2fe426c3923"; - plainText = "8aafab9e4004337c4a25432829bfc64b"; - cipherText = "f4abb4567ee454ce8900207addb64255"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 24; - dataLen = 128; - combinedKey = "d9bb58abf817a3819de1f9019dbc419d54e017e0dde1f3e9362db83adeede286"; - iv = "b28fc90a246ad2e7b312b39521324566"; - plainText = "5ce6cb2cb0d7c47267daa31fb72645da"; - cipherText = "6a9429e36ad17e3ca724c0638022baa5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 25; - dataLen = 128; - combinedKey = "9dbd6ff6274013ec4899f545172533a536706d896f543086d125c7b89c745a3e"; - iv = "22f7ff47ee95c5a92699c670ee187ce2"; - plainText = "0eba4b729eddc6afe88b8023d70ce102"; - cipherText = "3fbf5577e484aaef548bb4caef1b23ef"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 26; - dataLen = 128; - combinedKey = "be1627c0dd8151c2598ba752c0088453c9a21a37b9f1089d089b2b196fd88e03"; - iv = "d45e2ece32961f017b325583e8ee464e"; - plainText = "d353fea07c903a8ff976812cf3e61413"; - cipherText = "27f2cb552e96fc9c2c5c35e3787a1b3b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 27; - dataLen = 128; - combinedKey = "2b94e2c5ced0d24e89b459a073c66b4b0dfd051217a07dd429661291ac4cedb3"; - iv = "8d3eb008b842709a6a243b350cc1a7de"; - plainText = "c3af28e1c47b04adff1320b479a944c7"; - cipherText = "4f32d026c8f7bf0ddca47e155ef207a7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 28; - dataLen = 128; - combinedKey = "5b2374e8a8a9b8236ae1738583aaad5461abbb80ea14fb8f143965f0c612fa90"; - iv = "22f9721dde3fbe8dc8ad24078249fb4d"; - plainText = "65708c99b1ef29119f39833f992b05d9"; - cipherText = "be21c7ce2f2969bd4c918fd847cf8c0e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 29; - dataLen = 128; - combinedKey = "7362e35382a84edcdf02a858d24c6e1239a4feefeb3840bc440cbc20b38d9ab1"; - iv = "b268a26206a4161e7f00bbe7d1de3aec"; - plainText = "3a9c8280677c9f00a9c8bfc5eb2b7552"; - cipherText = "1ecc638cb3f8cc1beaec26109973a313"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 30; - dataLen = 128; - combinedKey = "a0d42681a867aa924323c1dfef7ccbb9a8ec0885b2528f0ac86c942b39531a74"; - iv = "bd0d971dfdaa454acdafc8a992dbdd50"; - plainText = "ab4f20d49ae5579069044aa261875638"; - cipherText = "b9671ea04b324745bb1a0ebdb2e074f2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 31; - dataLen = 128; - combinedKey = "a0aa082c8ecfc68787fac6c0e78d7fe9c99bebe150300bacb74136b7cd9810e6"; - iv = "c9b3f621a1374e0eda23376ca2c26fd0"; - plainText = "1d9ede1aafa7af65da4b56bd65e95d18"; - cipherText = "072dc9fc2631552242253fccb7ff34d6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 32; - dataLen = 128; - combinedKey = "5f6710301f15c2a1e350db816a7dc2baea8038b1de58b23271f00e1bbdba291e"; - iv = "e83aed0175373f8110e5bc0cb0ed5ebe"; - plainText = "2f640069cd78d0c7433c126e7533d837"; - cipherText = "b147bfbbbafeefedd7fea3f985475c8c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 33; - dataLen = 128; - combinedKey = "e1f3b00669ef69c1a13cc3fc2612d69e59a817cdb147392c319a7e16fab86b73"; - iv = "b94b110641d6f9c9882b880dcf39477a"; - plainText = "5c11f78d35c075e69cc89c99f8e6ffeb"; - cipherText = "6bfaf03085a13d4bf791dd73377671a5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 34; - dataLen = 128; - combinedKey = "71c29ff5285aeca9778d4e3c2c189015aa1b809e9925920389ec02c05171352a"; - iv = "16413f69056a1d0cd00676f5c6006a0f"; - plainText = "c96302351d0b1f012033e48f61b34d54"; - cipherText = "03e93d77d1d87f80fe938135b1bafd55"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 35; - dataLen = 128; - combinedKey = "704e0bdf9bb04b45a77206875521d0389645761d17cf9e1d11e108775747f02b"; - iv = "a19f4719fda33bbe44f91bd595badb37"; - plainText = "80fc4ae7787a8295171ab7ab3bd60e53"; - cipherText = "aa5278853d472e1fbc6cf86cd83c34e9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 36; - dataLen = 128; - combinedKey = "832f3883c68141587892056f63fa07d8ac6828a065b4a7504b910d4a6ab7e1a2"; - iv = "850f6075d946c84ba3eb43045c73d9db"; - plainText = "6e3e792aee862cbbeb8d1e9379d6c5b9"; - cipherText = "b29ba178d9a3550c2a1fa6e8d62b3ad6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 37; - dataLen = 128; - combinedKey = "cca67d91764890c26b04ec62822b98b63879ce4dc6abdc680564660f2dcb6eb6"; - iv = "3d15f99e28819305095dcea7fd62efea"; - plainText = "f9a767fbd3f43ad79774140d56a3b544"; - cipherText = "f21615ca2cf2ab30e65c933dfe814dc8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 38; - dataLen = 128; - combinedKey = "0979ef8f8fc0ef73e6a51af3289e63bad7453d2f7c460deac6533f39a98194dc"; - iv = "a3c446f313ed8f05622a969c7c58ec03"; - plainText = "21fb484c68a9caf60fde8d22994751aa"; - cipherText = "b4965ff7237bec62268d98723a6b8d22"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 39; - dataLen = 128; - combinedKey = "8c1022158815a2072388dec097648836d300d8eb4c0fec669edd585a00b09461"; - iv = "b4e1d80d8009246e026b243ab8e21fc1"; - plainText = "e6e3d67a7e32dcda953b5c9aef6e2468"; - cipherText = "410d67bc7b0b9db8cd285027db2f142f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 40; - dataLen = 128; - combinedKey = "6805e0920fdc81817c16ff312042812d4d0fea04e97a0088d5ce033f77f57516"; - iv = "6782e9e185ee7c2dbd5f20739f7470b8"; - plainText = "32f03cab33cfe6870946d8ef9926d40f"; - cipherText = "0d44276de44fcc1a22c0a23f5947741a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 41; - dataLen = 128; - combinedKey = "13de7c37bc706262b3dd21e512f7a1c304b0b8a1a5ac990c0d7d44beb7c7c241"; - iv = "d283e9a36ce280bf92ad05b9d1070194"; - plainText = "de8369c5f7b7efaa5d693ccfbc1ceaa2"; - cipherText = "11a61b1439b00d4723957dcbd1d283c2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 42; - dataLen = 128; - combinedKey = "c6986f1ff45871a394fe42bb5f28bd1fe94587c0da5211a9da75b98fa38708cf"; - iv = "1c87714aae7220b31a97f7c158dbc414"; - plainText = "71fdf4428222172b949efb7d6b5b4b01"; - cipherText = "6fdab096ae06c8981ffddff8b924d4f3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 43; - dataLen = 128; - combinedKey = "0ddf33773e2aa3b1ae099bb3a7196af03808f9b4067c9352c895e4569908e279"; - iv = "cd2e892985428763375455ddde7aaea1"; - plainText = "b49af688227f7e370d419e4375d0934a"; - cipherText = "db905a71789d633bceaa95f91b3f79e2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 44; - dataLen = 128; - combinedKey = "c292b87b0420866b6cfdfd176a6ee3e53a16cf0c4714fd04c7415dd664957690"; - iv = "a1f87b4d8c7b5c39ba079b70f183074f"; - plainText = "2328fb489b22b4b641e9e220b8908ee5"; - cipherText = "3cb229bc84c14196e648ce4557e28aef"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 45; - dataLen = 128; - combinedKey = "c5e3f3a4602298c3b06ab95709fc75d1c6127f940732b8d7e19de13060c3c870"; - iv = "a691bd37bcbc1feb55dcbc0dd8741596"; - plainText = "3fc1ee7738d5327b10cbb6ba30163372"; - cipherText = "c410953aaa123407bb9cec43899d1afb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 46; - dataLen = 128; - combinedKey = "6cb9b7c3b70f882bf3d52b4438fedf6ea93470f4f333a0a9d2278de371c28470"; - iv = "9fa157f1c4dc9ed96b4003baf9bca591"; - plainText = "2a3728d273291c2ea36eff4e0284e304"; - cipherText = "c88c50df49d10fe6fa9fd2e06bd25683"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 47; - dataLen = 128; - combinedKey = "3f90966532aa543c112edb9fe44f84e54bfdc3f1b8c706e499e8838f3dbbffc7"; - iv = "d8184540b9f12055cec7eaf9f3654292"; - plainText = "f31df15bfa89416a45cb3a75dc00cbbb"; - cipherText = "a252bb4a094b1b9ce6078b1302c2fe46"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 48; - dataLen = 128; - combinedKey = "0e54eb8e1a4c86689f9251d5305cdf032ffea11f817c7b6ceba4420e5a405346"; - iv = "f247a2e183647843b38d6a2bfef5261a"; - plainText = "67a7407531c6c97f5789e6c8f5fba76f"; - cipherText = "cb0479e1af394846ed87265b2973ec62"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 49; - dataLen = 128; - combinedKey = "e391abf5c55268ec220e04afc56176abd8be2cbbc3e59781aada92559d1f75cc"; - iv = "ee5f726f0ffbdf1b74032c2edc610bfd"; - plainText = "99cba520cf1b6fef60cfc2ea5b925214"; - cipherText = "81510ac069d947a0ff083cbb8a710d21"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 50; - dataLen = 128; - combinedKey = "0bc73b1d487f0fa300c9fa391b9465ad3ac774de11d1c28f3caf05d612526f9d"; - iv = "d9d5248904c97fba325791d31c283236"; - plainText = "0331ef217d21e7d1a1225ead8c24e532"; - cipherText = "dac01da3abaf93d84cd488623d2f30db"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 51; - dataLen = 128; - combinedKey = "5eb1e3ed21073b30c4a86b800f5016063b4323e45e3960ea8f02e925a0e5028a"; - iv = "35134aa893fade41cce5166b187ecdae"; - plainText = "025f1b8d80affad53bd24f1b8549a1d4"; - cipherText = "d778d225b5b7f279af04505a603f6825"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 52; - dataLen = 128; - combinedKey = "f70c0d0607942bd86c9e0a10fec0764b810610b3db0480b2603d210f827a6c17"; - iv = "628e0b549af3631772ed9d6fb2e583a5"; - plainText = "bb20b8c6079b4031b0ca8167ebcc0bfe"; - cipherText = "71985d1264332ebac96d78acc22da238"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 53; - dataLen = 128; - combinedKey = "95907c8ab5ffcacd6edc0ed1653d0952f32712345e8d90e70e0a578e4fabe406"; - iv = "de3fceb65a26f8b7f733687e1449b33f"; - plainText = "51921ed1a94dc00848b1720b2c3b0a2e"; - cipherText = "7176d3cc65da80ddd31ee5a7e04e6da5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 54; - dataLen = 128; - combinedKey = "bde5cb87cc9d3f4f82080e24e7772505f8d120cc30914e10d8ca26ab351107ac"; - iv = "13dc996addc206f37faa1582f23cd988"; - plainText = "1096b53b6ee922d2118c3687041e11b5"; - cipherText = "0be8b71493abe873cbd4b0418fd54a07"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 55; - dataLen = 128; - combinedKey = "9574df5e0f2d41575692cc17fac224fe248536e14e3a77c96a0ca562ced70357"; - iv = "fa0dec91a79d9727795103e171c0945a"; - plainText = "c716d57bc533cd638083e0d000dd10c6"; - cipherText = "6fc24608851e700f555d76063ff3c532"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 56; - dataLen = 128; - combinedKey = "039e8bb0db225f832d14579ea186862ff141a91fcd791bfd238d3e74fc26e1dd"; - iv = "2b0468421fae752d6f092e48e4dfe616"; - plainText = "9fe68f428392a0a2b3e9324036a6c74f"; - cipherText = "6243f127847ce42adef3c7a97894971b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 57; - dataLen = 128; - combinedKey = "f01c0794bf1578bcdeeec7ce3343174f47d0cdafdff8fde019ea39c2d7836fff"; - iv = "ee2ca121a9e02418938774e6ad7f1d79"; - plainText = "a46eb1a762fb4ea048a15047f1e333f3"; - cipherText = "a975a6ac7de0a128db676dd973106448"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 58; - dataLen = 128; - combinedKey = "67207b23513be52bb908118bd9862b4e52bbafb601c24c342ffe018ec9cbe272"; - iv = "233c205982f614f2ee64bb937ad85be5"; - plainText = "99dbdf6ff5fc4450cef2f6fab860ba9c"; - cipherText = "47fca4290504c3df315d27ad95c7c7e4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 59; - dataLen = 128; - combinedKey = "aa30edb92a8d7e5b63bd7be9215fe12f426f2374d62369972acba999c60ad354"; - iv = "38aa14a2a214bd6c672b16638787f1ba"; - plainText = "4a0bc1a2cfc4757a37781614fd508aa2"; - cipherText = "6d542689ebeaf63188b247238a4f227d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 60; - dataLen = 128; - combinedKey = "4172acf17cd3a35e25f8f63f81925d2a280144306ae6a31ba3122f7a259b73ba"; - iv = "88ad8b3fa62c0859bbccbcbba00c6a7e"; - plainText = "110677671b17aa047be06aa8ecc3e4d1"; - cipherText = "ca0db6fbec082af5932ba15455d519cd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 61; - dataLen = 128; - combinedKey = "2151f570c4abaafb47c5e8202ae3b2d79e507f52f4b6d02f31a9e629377bdd43"; - iv = "155b4ab7c2c8834bb633a9bb5f5b2d17"; - plainText = "b29b5bce0684ae4118679363d3a9f7be"; - cipherText = "477c30645d8e09a1fa42be96c8315fbb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 62; - dataLen = 128; - combinedKey = "0d7e885a32ca4fdd91e175ca993330dc3d7ad2f2ad39896406bef6cb20c6b725"; - iv = "b7cfedeb9f34f2d21d291cff9d2d3fd3"; - plainText = "49bc8db5279a47ff8231479840eab25c"; - cipherText = "f852ebf7396e6a1bc29ec6fe62f0e88c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 63; - dataLen = 128; - combinedKey = "7aeabad799722b259b95757d3cfc6b5ca5bebef59e8892e9cbbd783803682554"; - iv = "834d045ce3c9fb95f5ef351c7b8dad02"; - plainText = "b855dcd03cc80de45b39031163911cd0"; - cipherText = "f7aa96945867bedd459c9702ec417410"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 64; - dataLen = 128; - combinedKey = "cff5c8a1cebee0e46c2f4151cf8830d0b57bafd715e2064beb4d6219a1f94276"; - iv = "491e35cd472072be033210ce2e1e46dd"; - plainText = "bf6a53fdfa4e325299bf1f0526617cd5"; - cipherText = "70737ac9d0739e07fe6d02700f956a8d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 65; - dataLen = 128; - combinedKey = "bc029f3cf23d7fc964a255eaecffbcb320e8942ea28ff4ec1a47f9e91cd0087f"; - iv = "6a8dfa2418fd8acb74fc7d0b38b736be"; - plainText = "51a835dda82e4b017056e44c928da4b1"; - cipherText = "22b823847488545d93177aa37b5d9b9a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 66; - dataLen = 128; - combinedKey = "a1c0787bf4de26b10053bf1c4615c1a602883d6566a7184baa11b2d39859b1d0"; - iv = "a0875430151f7d0a065966a3909e5339"; - plainText = "642c9617344156c4a3e259497c370382"; - cipherText = "04b86a5628cb39e39378c09d8a6c675b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 67; - dataLen = 128; - combinedKey = "f4c98233c56c9954bbdd23d9052e2ee5392807ff2f310eb5063a1f6da2bbfb63"; - iv = "07fdc8f424e6c0fbeba275c0cbff2661"; - plainText = "58b69bae6465fb3646bd0a561792fd37"; - cipherText = "05182e495d2c6efc8385d4c4a8e0b34a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 68; - dataLen = 128; - combinedKey = "ded3bc05f96c73bc19ff9e3b7924f6aeb99a808a40f529b8871c3ed1a91528ac"; - iv = "1e1e6d1eb7aeb8073c16e9fc40a1f6b3"; - plainText = "85cc116def8a2011c0e6cd87c074240f"; - cipherText = "3f5de8a874871e18820e49e122f08a09"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 69; - dataLen = 128; - combinedKey = "5efe21747bf4f1c1d40b78504773211c25ee89c9144d8d92f62ab7961830ceec"; - iv = "f15f589d6b539ae3b07fe17b65ebe8b0"; - plainText = "f688af4b8f7ba44e4598c85577784ba0"; - cipherText = "f8b9ee876bfa3b8a76b9e177e0f3c350"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 70; - dataLen = 128; - combinedKey = "459d9ca7a00b4a991c594b9d8811485338e3c778155f682292416aca9dfdde76"; - iv = "985a0997419d71c5fb44cb9cd919d9e9"; - plainText = "6d6640d6aef06a17b2f5234e968e1300"; - cipherText = "4002ea43561885a63ca623bfbb92b4d1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 71; - dataLen = 128; - combinedKey = "3b420ca90eb3164c7bae206c7c0b998dadd137ccfd8dae1e3e1982e157ffe54a"; - iv = "475fb55a3e2aedb247fac73a2911d5aa"; - plainText = "4ccbf906500a90ed0ca37d36dcdb94b9"; - cipherText = "2006e048d21ff72e207e99a1669f7e54"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 72; - dataLen = 128; - combinedKey = "49019a26481f3c4b96152fbee1cd6062db95585ce41f8c152412f3e80b9be04f"; - iv = "f742332f722cfd65d99eb7a41101c781"; - plainText = "064ff066318deb0456453344f8ecd2b2"; - cipherText = "eafae9829732af77fa7d15be007b9572"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 73; - dataLen = 128; - combinedKey = "f5565f09b164ffad67160cc6cc756fa206b628c8f217f9d88df26a50487be3e9"; - iv = "387de8be00c8c1247efa76a8de256f99"; - plainText = "2945847377fd128f974a35b88633615b"; - cipherText = "308ddfb2e666ae52ee2e335fe6c2e417"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 74; - dataLen = 128; - combinedKey = "892b137375e05b418e690871cb9e148346651fd17801025421a5beff77d866a6"; - iv = "af9bfc09932e51904cae248a81e3e423"; - plainText = "49d4da9feb315f53c51fcbd92a7df31c"; - cipherText = "4dc2fc3083a64a080be6bbbf75482542"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 75; - dataLen = 128; - combinedKey = "22e2cdb46071edebaf579ac87f76697c3039d7b24b732501f1760440ff2a945b"; - iv = "2b54feaa1089b4e211fc2b59ac504606"; - plainText = "89e6133f383c4846dde4c8884798714c"; - cipherText = "d37b188b6c28e308b78a71f15769cdfd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 76; - dataLen = 128; - combinedKey = "6b56792baaadcbfd9278e8a35f9ce05224bc932e5c2309142a739e0781827ba8"; - iv = "ef9237736e1c80ae0c4ff8ea4a18ee57"; - plainText = "fdb0ce22a0e20a38d59158a28f82a898"; - cipherText = "477bc6120c1001598d248b79e87ad1fd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 77; - dataLen = 128; - combinedKey = "5bde251c2ed13c163ee932bbb2d75f5c242d3ddb2b79dd09e2398bcad56e6148"; - iv = "e5b2793f1abe4eb4453ca9943132d0cd"; - plainText = "e064397bfd890f40c668cb70f8766eb6"; - cipherText = "bf4482c770d049a6a47e9c5fc4a83ab9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 78; - dataLen = 128; - combinedKey = "ea92fa8a37554b4236c0e26ebc58836715253b8370b270eccaf54f8ea1367ab1"; - iv = "fbfa557bbf11ab6995a11bdcf75a00b7"; - plainText = "ba5a69b64b8a0046238d882dfddd8519"; - cipherText = "04142c0e8153d293ee8231c5169e8e9e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 79; - dataLen = 128; - combinedKey = "eba364e12d39c43d66ae2044cd00aace61cfeb51729613ac655051b8d23d601e"; - iv = "c212065e39efc646a25f6f7c04713017"; - plainText = "09be2e4df15463335fa23da38bb15ee1"; - cipherText = "07a60189e3840c0e2e637950d31c427a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 80; - dataLen = 128; - combinedKey = "9ab67592094b580f4c744d5318a1abe84188a13c0e9a76735c7d04edb878110c"; - iv = "930e93300d03ba45c228707d86f6f132"; - plainText = "0d1d2d79804b5ced3f5ff416561cbd77"; - cipherText = "8c45a7067282f3f6e1cdd9a2d4ec4d1f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 81; - dataLen = 128; - combinedKey = "dd73892731abbb61a53e2a10b501ccd68fac3c847b70add43fc341e296bd1d33"; - iv = "118e9286d54eafeadd36c82fd1f0471d"; - plainText = "4b3c7a217cdabf7e09ceaa3dc7abde38"; - cipherText = "ec01c43a3f4fa9ba7609a47e3c13a9f2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 82; - dataLen = 128; - combinedKey = "8b54dc39148094a75c409545ed7561bc32e33590582fbcabd770d2cbac780af3"; - iv = "1bb8035e783930d4ee5f987444f32535"; - plainText = "044f7efffdf536b2981b317e72661317"; - cipherText = "cee7a05f00b273526fa71a87aa63980f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 83; - dataLen = 128; - combinedKey = "a1c32733e4099c2e523ec542b90fe47fb834b0c21d10d7f1575e5a7f9be63c03"; - iv = "574fbb893e52913d2187f7e9b36bb1b2"; - plainText = "6d11ba6c40fde736081a5c4f635f1004"; - cipherText = "5a1ba8a0c296fde62780bd3ab66889e2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 84; - dataLen = 128; - combinedKey = "948912a5453dc0641158039dd159d4e57058a7e4e3007d45b8ae0af8cbd80c82"; - iv = "6dd2af9c5727d65b745d29eb05827961"; - plainText = "bb0378abf90cde34f0f630db175fe345"; - cipherText = "cda72c110d1e11fba06c93f7a75cd6ac"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 85; - dataLen = 128; - combinedKey = "b59042a135e9fac74daa76d9a6cd2b752f47c3b79589023c537a522d187f674d"; - iv = "f49d7bd75460049350654e3ee28e85d6"; - plainText = "409173735af74af9a74ddbb6e00e72bd"; - cipherText = "59aa8122cc80d6e8b8188c5fff138c34"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 86; - dataLen = 128; - combinedKey = "7b417a0151266f1e76bc41238bf20647001556b9cfa1af9b7a6a4666e8f16395"; - iv = "1e62967ce97b5038437cd2054d9b7a53"; - plainText = "d5eb1acf5c4594809f83afe4b28dffb2"; - cipherText = "a3654e33ad5afe939e514502438ff26c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 87; - dataLen = 128; - combinedKey = "c6e1067dbb927b95b5a9810819e3379a7de05b13cbb403ebfdae8053c0256158"; - iv = "c7e42b26d7acd4d3797f423d305d8d81"; - plainText = "e47c0a19194be29220a1da312cc12607"; - cipherText = "b2b05f88075ab53903758193ff49ea55"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 88; - dataLen = 128; - combinedKey = "ce24a5004274e90a9b6501f9539615c287fa238b9019f98cd4c95af652ac0c2c"; - iv = "68c8cd9a82ca38a789baf9b53ff5c6c8"; - plainText = "4efa06f07b9acc0ee4ac524bdcb7495b"; - cipherText = "805d16c4010890fda3dcf0f511c36716"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 89; - dataLen = 128; - combinedKey = "2c66060d58339180ad03a9b45f8625994c68c916b639c45034776356119a18a9"; - iv = "53ca5b86394762089083adc9386fa0e7"; - plainText = "4b012fed344f187ea9562cfb6c4355cf"; - cipherText = "d612fda0371f4c2affca867b33c8abe3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 90; - dataLen = 128; - combinedKey = "da9539b1add00192323e104ae59a17a38ddd45a3e6e19b7c3f7ae2cc4927f8b7"; - iv = "cb50cc089c09d518d56f9282aa61b217"; - plainText = "22f755f2b50128cecea8108dc07573df"; - cipherText = "18e6c76d12abb7ef1fd7653a32d150a6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 91; - dataLen = 128; - combinedKey = "2d2036ad520a30fc8b656be3a339f0fffb2934b64afe1aa2ea91972096a93ab6"; - iv = "d2c1012df83b7ffd9b8515a0fc43e6d3"; - plainText = "9d6ecbd13728aa28f9987b14843ca5ff"; - cipherText = "d5669cb7b36f321ddf65ca667930b7c6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 92; - dataLen = 128; - combinedKey = "5b2d617a9c3634f7baa0c173e9cf77a5ee98c22709f7521d75db48fe608ae85d"; - iv = "b6220b0eef27fb45c5348242dd2eca6f"; - plainText = "157e07c77b7302428938889e7cfe054a"; - cipherText = "f6d0f0987b21970d12002e918fb8a137"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 93; - dataLen = 128; - combinedKey = "1cf728ffb420f5895afba534687a613bf7b525a1355438e8283a2e5f22209c9f"; - iv = "59b7cf637d51e1fce46bf04c4814f927"; - plainText = "98a67247d79b75274c0f6b26e893e158"; - cipherText = "07f0bcdc2ba2b6eb2db9ff4cff869cd1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 94; - dataLen = 128; - combinedKey = "6a1528a110baf8134c15e46dad1b206455d50b56861ea0b106a7ad84e9c4b607"; - iv = "c36c11d6c1786d4a9a066af6b8218699"; - plainText = "d14e1778109fe3b5cf83d5dd159c45c8"; - cipherText = "157628c394d91927de372bbc037fb7f1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 95; - dataLen = 128; - combinedKey = "71dfd80de7a706d60f76224cb813cc8c13170cf0c9fa0ccb9db77bafd8311776"; - iv = "0c9693bcf4d4346c430f021afb25de9e"; - plainText = "56dc37b6473882df2e6b89934f67463b"; - cipherText = "c0d60f4c7ebe08d1a87238df7497b295"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 96; - dataLen = 128; - combinedKey = "bb41248db8388b5c809728838d45d6b5ca536ef43860976345b0b1d64d4e1b46"; - iv = "0d7d53c6c3d46cad187f71b46f008a27"; - plainText = "606c97a5d698caabb76b3ff63ea82873"; - cipherText = "85330dabf5162ad8fdb01fe24c0fbeac"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 97; - dataLen = 128; - combinedKey = "a5654ff447d985078c267806ebc611d3fef0a119693e30d754a6835d57f1ec04"; - iv = "1715d4ece0455826b09ddaa745ca831e"; - plainText = "527b08c654cacb38106f2639aca980a3"; - cipherText = "eb425eccd25f12358a140aff19d74d46"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 98; - dataLen = 128; - combinedKey = "0a54f704753393e93d20c7a35322a5bde43daf418af1421c6d7a5ce94d18a9df"; - iv = "45984e9b2df2b80aa2826b1b751d4a4c"; - plainText = "8a8ae807266dda61304ac4ddcaf5dcbe"; - cipherText = "3ff1c17cb6461454c0f3f34b6bd157f9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 99; - dataLen = 128; - combinedKey = "f933a0b1742194c3c264084a763d2b7fc9cfa5f8d3954d20a1c62179b2748695"; - iv = "649429d48bedbef7de785de35ec68cb9"; - plainText = "a48be035a8421cac2c99d1eadc13975c"; - cipherText = "fcdd77570d7856e470bf60a81fd10732"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 100; - dataLen = 128; - combinedKey = "ec9abff0ebf84e10af5fe85e5783410db6e434dc4e56d2bef6716a1fb60def9e"; - iv = "340f40818f10b2b27121d4f42842bcea"; - plainText = "fa3208895cbe866b124b301a4b09751a"; - cipherText = "1efdb4b8a973ade739b73877697eb138"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 101; - dataLen = 256; - combinedKey = "c17c372b5626916d98c02629f5d276474557e3feaa75783634d55f154e0a8d18"; - iv = "dc052215ba655cce707e513d543a5085"; - plainText = "e9b9e29fdfa1af535a1ec50ed9204f75c62f40a9a19e5049cc1048e7047b8acb"; - cipherText = "b7b416a56cc32f753c259b943ea07a9dc030840c8055831e2231f7bfbd0a734b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 102; - dataLen = 256; - combinedKey = "8712dc338dc23f7db7e24a5615bcf7763906175650e8f7b958185b8aa8724c2b"; - iv = "0525e21ec21c95f840f99017c72f276e"; - plainText = "65046acef34bdaf401fb7427103ed25bac7cd09898bf9f6c07c8b99b51d6f3c1"; - cipherText = "ddb95bc391d4820d7655126cf11db4681bd2f1e1e42f20b479aae1fb3a8e3e39"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 103; - dataLen = 256; - combinedKey = "25f7bba87c5ea6d1907e16aeeab834422b447493f9fc4198e05eaa01c71a2ec1"; - iv = "86c0fd2de3dad674a741e20cdec7d7b2"; - plainText = "4e95911733d5b4e43e5efd875771b0bd574e7db6e19aed31622c08c7f1472bf5"; - cipherText = "0caa97270bb41f092cf649a70833a6424dd50fcf2e9f55f02e91976dcd2c2ff9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 104; - dataLen = 256; - combinedKey = "a6fd2e5ca44fba1cbbe368f3bf5c45857b7d13ef7998fd915a36b471efb3b73b"; - iv = "08a420e18abd36a969ae33ac59c3cb8f"; - plainText = "642b97b2ee7f12050461742c07d1154bceeb15c7cbe1228fe21a64b6ab5fe796"; - cipherText = "b427a817ee891f9e40a4ddcf8d78f9289c7ccfa244e8c5d3a72c8245e76646bb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 105; - dataLen = 256; - combinedKey = "ba4108734b283393922952d5e32ce539fbe675d94ab54f389559ce05c36a0f2c"; - iv = "5c36625dda1b2528db7bf7aeef95185d"; - plainText = "71c70aafe1b7e355aca682e322c0a1dca4411c0922029f895ccaa6bca9fc2583"; - cipherText = "5e3c5fdfc6714deb37ad1642e94ee96b4ccdc501626dd50d1369a3ca2898b84c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 106; - dataLen = 256; - combinedKey = "de347dc30cf773853def15df0a45fbdc657f0a433497d63382e0d409dbe88b91"; - iv = "a786b4d4f9139d56f6bc422658d2ef29"; - plainText = "214b3f186a58001800f74b38845665d5e8c15cba2516f4f4f615cfd59f3102c7"; - cipherText = "035f6e4cb86f7fa9fe8d28fc3c0943c5875c1b0ce69eb2b7933345080d0d95d5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 107; - dataLen = 256; - combinedKey = "7abf4b5cb9534b99e954f1c0fc52edab6a105664c54d59f5b12d7f9c01c63c50"; - iv = "40f4d9b5bb05b7409ee787dd299f1fb0"; - plainText = "c62c0f01fa8fce3a6b456743f655905995d3cef9f08dd94af51e6e76c9599efe"; - cipherText = "26df5ad6ec95a5f598f558ab179ab30979d5a8f66d59d114769a667fb8513b9e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 108; - dataLen = 256; - combinedKey = "dca0b4e2b30ddb8cc6a3c8fe5f32f32303d36aa48cce71f3dfdce8f1e40caf14"; - iv = "253aa216299fcd983e4f3ed90bcb8e01"; - plainText = "b0032714ee64789b7b4c23f0a5a19179f1ec5dc7a81a07c1d5e69a9ff9347187"; - cipherText = "3170763465743ce55eb4da71b27bb503cb63a8e668d5cfbaa48456650ad97187"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 109; - dataLen = 256; - combinedKey = "73e5b3d89a90df344f21c8d8c91b196e866c0368b57a843c04e95639c7ce2288"; - iv = "e8365f08da13e301d02a4cba18448124"; - plainText = "e83364b77fe97045f279e69a35781f28d62d5d0eb7ed51abf07d3525e401e73a"; - cipherText = "3c0e4ccdd867ef191ae59c6ea8584e65aa5f15e86f3ee06304c0c0e63e2b7643"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 110; - dataLen = 256; - combinedKey = "419f46458ba9ca86635003ca1406ccbb8fa8fff30b65ed595ea2fe4cd0c1dfad"; - iv = "809dbc7702f49db627be507e65be5fdc"; - plainText = "121540d511ed015770f02093e255ba0be6c1ea8ad0bdfe39414a11a5d61edd16"; - cipherText = "ac1fb064974950f3a60b7af3c7639ba59bc93b26ca33f8abd5bc1210e3473656"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 111; - dataLen = 256; - combinedKey = "54f7657fb97329f679d00f66be9f589b739e85371f84945ad0ad1bcddaa15529"; - iv = "8c23e7f4604d85c1ad1b588378864c37"; - plainText = "70a9b84698b9125c58d6b5f1962afcb83928324762804866c607f199412d0645"; - cipherText = "cc36dd360807fc92322cc4e74890e43663657fe79325c9eeeea1c476eec8fedb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 112; - dataLen = 256; - combinedKey = "160efe62676d0de0b7aed7eeaf064f4761937077122e3c9ad229350f599a4040"; - iv = "f3d95f6c23ed16fa618c764bffc581be"; - plainText = "a4b9c7c5badcdac11136e72bcee8bcf54d3f7a4fd0f9e1e563ac08b694b0ed90"; - cipherText = "d534ca942d918af061f05dd0cbac5f4f702ce2d2082c3751265fb728e56914fb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 113; - dataLen = 256; - combinedKey = "86a5ac4605ef1f878cecf5a9cf92a1b6192f8dab384cd75ccb84262bb4bc73cc"; - iv = "7653870a4e7b3699d0e8b71d7fb3c1c1"; - plainText = "7c0365cdb477aadbfdb26ed46efd0d2df6bd5883125b3305f3542857ef135b66"; - cipherText = "d6b1a9b4efc82cbd8abe4f5c35a951cb932fd4d0ad3ff686b78ceea26fa1f7a2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 114; - dataLen = 256; - combinedKey = "2357c1def609ff88b50ac23dce634df70f5cf9209ac851b4e2638dfc1e4351b6"; - iv = "2479ff2e39f851bc119d78df794191c7"; - plainText = "19c7ead499b1ab2f6a6946d2bec289bddfbe0a2e39dd9cca52429c65291f3229"; - cipherText = "f9ad4a526fb19b6d2c05d6dd5aa1445d04e55dc4cf8f4eea5847af90e25b4017"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 115; - dataLen = 256; - combinedKey = "63a77b6dd778fca13d0deea4fb66161b5652f04d3efe4c86dea02e1c08fac73c"; - iv = "50c8307d3ec80900a239b4f68863e787"; - plainText = "b0973852b8f692e6dfd1ce30b2e4311036a6df891ab0d5b3974c2a70b28d2e90"; - cipherText = "d1b2e1ffb86590aeb2d6608a6a5799ae154f2c21ecd2213db621ed72cee9c276"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 116; - dataLen = 256; - combinedKey = "3c557e959f555ee0de73dce8350e079490812bae4e902217bfc9690b61e2d9fd"; - iv = "e49c169831f792b4c2826f05eaaa24bd"; - plainText = "c2c072c7231318bc44abff3b84e8937779e0140adf2252fc3b1fbbd4ae50d4b0"; - cipherText = "caa4276ca7a9bbc1dab01fd550c7094e7560e3adb367ffbb92d163cf5a6c83ec"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 117; - dataLen = 256; - combinedKey = "84ba78b12227e29a501b4f6abc35c9b9a7c9b9cdff98af957e487ee130d4e116"; - iv = "24df05f1ff24fbc7853ac52761a6ec8c"; - plainText = "befd5682b64501b57e822da9874c789bd117b46e127813169304d69d224d9d0c"; - cipherText = "d0663c5a96097318885a732cf266e7edae01f3bf9a560051b03a976bb19ee88d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 118; - dataLen = 256; - combinedKey = "f58450c79e335ec7eb1706b7497cb7a2c55c0dfabe2f1a2708a789840e6a441e"; - iv = "26bf01918d9abf182ed62c95356f9bf7"; - plainText = "b8246768361ceb689c8dcee70833a495c2b019539bb6af2bf9fbed6001c7f567"; - cipherText = "fbf1bdd97a2655aaef9cde7cda9d1c2143b5913a371d2ac44c3e339f2e3af5e2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 119; - dataLen = 256; - combinedKey = "7da9b23985ff82f9e0b97b9e3ccb810ba10449b4ec4021d4378ed8b254d24f42"; - iv = "2eb0019fe6a51ccb4e9dc85750919027"; - plainText = "b2abe40e07ae6ca9aa112dc4e4145f1c2a21dee8d43d2a6be305c1fe8228723e"; - cipherText = "f5d5784fbf46d84c6cc56d88bc1ef58636d8a888f5065af91810fb8f2133fbac"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 120; - dataLen = 256; - combinedKey = "feaad2c51acad21b490be4b6855c0822a97af8271f5a2fdd7a4d2d5a0ab25fa0"; - iv = "49d5f8f501bc6817e566396c42ee234d"; - plainText = "2b2c080fca4b071374961a61a449b98b2fce6a8c4e1291eb8132e9f4a80b845d"; - cipherText = "98ff2ddbc71eec4374e916ef56b7c3da881f07930e7cfb79bd54f7b3dcf2d689"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 121; - dataLen = 256; - combinedKey = "1fe9f90a37e71431f505457ba7f90bf0598be1a59378c445aff75e8e458ec657"; - iv = "362a35f22dfb33ac208209acd878c027"; - plainText = "9efd492a3ab077a12a67a405d17553d23a8ec60c9de52e425b91c8031403d4d3"; - cipherText = "2e2062f7fb2bf70c4c37ebf9fa967cff665f2bea91dc9336ca293816de996170"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 122; - dataLen = 256; - combinedKey = "c9a844684c7e31347765b98a01ad672c3578a7cca73fdab032f7ecd10ada0689"; - iv = "03e90d5c02b6d040a872ccefb4ab38d2"; - plainText = "cbc6d2f141866dabccb850a34fb27c821f113c0429b4b73442fce7ca7f1300af"; - cipherText = "122a05473e5bb53614e6d68596bb27ee317590542efbc39dbca2c5523eed57cd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 123; - dataLen = 256; - combinedKey = "f220324197652ea93d97cd63becca9d5732683ef0569acb42ff9cba56fde3d73"; - iv = "3f40d9594e8b0d182589d8a0e6fecd17"; - plainText = "eb25def15641f80845392381f5c486698ad5355883809f1a99f7cf1ad8521d71"; - cipherText = "1afd1b88e62ac39d2895aa98ea5f1fe0f3ad48ec6271aeef0e4f4f61cd03dd7d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 124; - dataLen = 256; - combinedKey = "186d4ff1bd586a31efc153ac46ffa0bb4eaaccbb7ab6f21b40bd89ae3419c208"; - iv = "bdb0d4a2841a59aa125cc572fe3de5e4"; - plainText = "92a42a9f4aafd9a817ae5df2587035d30361c271793cf668399f194fb972dca3"; - cipherText = "f670b6a95aa854d187402fe15b72df586d10afd78b0d529a5954522fa8b1f248"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 125; - dataLen = 256; - combinedKey = "9eb927d686e5380cee80e4313dfc4a6fb7b93c67787060e84459850d305d0dad"; - iv = "a0a2d7a7d863282ebafbe0712bf298c6"; - plainText = "0d49c003942a76b9c97460d69309cd5c4d529b24c931683574992f95e9000257"; - cipherText = "555efb9e49b2961059563ed59ba0a2f49682599d7f3c1bbb4f8c5cdd517773e3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 126; - dataLen = 256; - combinedKey = "f5c9f118a1d0a27590d34b0e520a4632ef0b8ef49ac8d670edc346ead5ae88a8"; - iv = "542f3ef5b3027e03273b54077dff2a3e"; - plainText = "8d1472eeb26e2904ea1b5dff164b1441804a58bb39e7e99d4e324ca40d2895c7"; - cipherText = "ea1127a766df06cb5af5b7a25f16caa706b067372366b9f5f6ba3a4efa23c812"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 127; - dataLen = 256; - combinedKey = "6bb4ad6ced2b1d50a9ad5f66e1d16e2a821e563529697055e7ae3178b6814a68"; - iv = "bd16e5dc1fb18be7c47531ed1923234b"; - plainText = "48a0861ebe8179456cee8e3a412f5b85fbad124f6cf8355f9d0f70200c740672"; - cipherText = "0a378360a0eb0ab6835d01880c23b1931d22b06b8504b6a014bcab79d963ec53"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 128; - dataLen = 256; - combinedKey = "150d03c17da5fe7422dac51298287a5d4b30aebaed785ba66cebc1f1ab007fb1"; - iv = "fc3ed71740ae0aa909724d501f04ae91"; - plainText = "3d3eaddb3a73db2892d91caf8dae82545fcb836c2ab9c0329ef3e9b6c527a53e"; - cipherText = "c636d13577b37a68e823b6d0e87827a47c54d735483fe0b2487b48576574d465"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 129; - dataLen = 256; - combinedKey = "ffee0b5a65efeb42e538aeda73037d94bf9d36b8a6a9c2b145ba142a607c760c"; - iv = "199a0ced9c9fcaee9c0b38bbd06f6674"; - plainText = "cdc3d155ff05ea58512b25d705b162d9b22fed9b691e79dd581eefd71fc40e17"; - cipherText = "8405bc24cdea6eb7948e4f29d2c34cd344dee8bf71906048776ab2413e435dfc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 130; - dataLen = 256; - combinedKey = "9f33c089f3bd6c50c5f2332eb0a0d023696bc770d863b033879e7191f5f9655a"; - iv = "d3d4e8e95a42183e61ecfdbdb7b7260f"; - plainText = "e5819181143e83fd0c21e0d6d8e4edb8240fa13955a41ee18bf6d7fb3eb27888"; - cipherText = "7d4bcdb6fb84c8dfc03a5c07857896fab0aa3554cd2967fc6510be2eecd520fd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 131; - dataLen = 256; - combinedKey = "d2bd1f7f6584fab6d93659be4c72ef2c1e855b725b1c2f6e22e56595591a8c32"; - iv = "653f53b9e016b22ffbe0f70dd3d5e0cc"; - plainText = "f95d51444a01b6505d3cca7bec5050aef5951146a1ca11c743bd853bbbed48ff"; - cipherText = "95ffb2d80c8623b500243e31b7488632b279e3bf35c5b62d687976938b19f25d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 132; - dataLen = 256; - combinedKey = "fd16abcb0209b43993c1d1607682b8e9a6347087f39b3591a02d3fba49b35248"; - iv = "4518764a3a3d362132a65802373c88a0"; - plainText = "643d5c7bf3d6932233863f97869de49c7edf056a0570174a275a9d23a1681953"; - cipherText = "02cb12154b49f814d698d8e2cc475d8c703682f1cbd58cf264590192a57e15e8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 133; - dataLen = 256; - combinedKey = "cab9925ff7a83d3081a384bff6fd701c69e2d1fe14773cd882b6156f531fb4f6"; - iv = "a25bf3170e3441c11dc09b75e931209a"; - plainText = "e89fb9ee859a907c09b6a2bb0be8763b8d5ff78b2df416353b34fe7799e47d68"; - cipherText = "accef6b1e3c81551585dd9f0caa79051cbe711f29478914cf3edb40b89a3b459"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 134; - dataLen = 256; - combinedKey = "cd7ae924c7b16d69beb5f2bb49e63359ac0c1e85e6629356f20e61ad587beefb"; - iv = "babdb59861255627188b2baf855220f6"; - plainText = "ca586003ca561172fe12e88d1cc87e46a818d1c4345fcec600b1899c9872e94d"; - cipherText = "56fa3f1129afe29ffacdc23b96a1d0cb684cde37d7bdc865f119003bb35b1625"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 135; - dataLen = 256; - combinedKey = "ea86ecb69cb95379089af2282de2c1777bd045990805fec77af59a59a60e0973"; - iv = "3a2e81ea77e49c98d9b3348ec2e8c3bf"; - plainText = "42faa6457bb4d1b765a8d69213a881972e0e6f69f6aef8121c8b3229feb9a7d0"; - cipherText = "f76a933486daf9c18b11ccc56e4f06516c74dd4d859d6101b2321b264be4d988"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 136; - dataLen = 256; - combinedKey = "2bc8c8c2ede375f68342b85599aebe95053f9540ffb5c6dfd546d727b85866d3"; - iv = "a9c7a140749916169ab7d03ad69b09db"; - plainText = "2b880c706181778df9dbb149b5cc7332fce0c6f2396a62bea9f63d436b676f5d"; - cipherText = "e735c33c64c46833ae9004a3242ea8a4483a23446c8a30039bf1ce9e9aac648c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 137; - dataLen = 256; - combinedKey = "d2dcbbbd6dd4837fdf67cec26a2dac9a34f8f3155d912084913233fee995e0e6"; - iv = "b724fa1b5544987ee02507334eb4b403"; - plainText = "bbb881aa6cde8fffbafc60ebbb92f1408f62efa890a34165302d955a50d28a8f"; - cipherText = "543556475807367e29ecc9df9a3cf3e5c2bdcac2fb3a1a34880b428a77ef058e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 138; - dataLen = 256; - combinedKey = "e8890d22487499a7e9484aa5a2b907c7a74e6e4dd8acd6f8295f5fa8fb428fcf"; - iv = "3d39a8273577aa6f2cc77a825f008fb0"; - plainText = "7e9eae63331a1141796302f6f8faa4a1e57cf88c451aa9d0a197c604f39d6e73"; - cipherText = "a51059302f51dba607ae3a6c147d117026642a2141fdb7ec32063d66c7cb732f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 139; - dataLen = 256; - combinedKey = "8328bcee227cbebb333439fcb2f6a6983c1036d32acb876d5c497d0672a79f93"; - iv = "c156adc18410efed7e40e1f71d1c346a"; - plainText = "c5569bc57aa6335ef418a88f431e207df1344b7871519628dcffb3dd4014eed1"; - cipherText = "8a9759b7b861646cdc69d71899ce1b7945974ed5cf30fd7fa6522d0365b0a456"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 140; - dataLen = 256; - combinedKey = "b250c7ebb90ffaf586237b4ee2fb7a50a55be3b36240717d350677a8bec184ff"; - iv = "8aa8d620f4c7d912c1fcf8c9c4d97120"; - plainText = "436e79a7aa1ef3ea7711b50bce0a4b42d74262ede83285e2440105b6273555fb"; - cipherText = "1249c501c7c9d8738b44ea886aa937b51166d2f1d78b2bdeeb89a6f57c92ad84"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 141; - dataLen = 256; - combinedKey = "108d6aa5663f607ff23baa0a2df009c8ba66a961609e1ddb55ecd3e7c004843a"; - iv = "9e1bc5989069195701e463573fdb449d"; - plainText = "fe74b0bae73e63e14380acadad688813782b4e58c0a66dc0f5d4a0afa6ffead5"; - cipherText = "2a1278fd5b629a99e490ede424d60638a342a422c3724297e67e7655fa30ab33"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 142; - dataLen = 256; - combinedKey = "68e87481fbc1a6ad5212b5a90623a19259e815bc480c965218940935e719c2a8"; - iv = "c5a0c814d862dca858a8fde9349082b1"; - plainText = "0e51977754a6e12543987cd5c198f2b2d2fa557489554cf21d2d6475b368ad89"; - cipherText = "b5168def622240d072635fcdac76f53792e0911659f9164f462aff6393bc3230"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 143; - dataLen = 256; - combinedKey = "00aaaf503ff48e0b5e243c04e2964318e025515a3af61d17389924ecd7f5b78a"; - iv = "574c5546dfdbb250c65d7a1393535e38"; - plainText = "f0bfb5a2ee5bc76fa824a995cf21474cda83f7772b745029aa5db45efa2a5702"; - cipherText = "7b799a04b0b7523e6bf1780c92b0e00165c95db33cb1d6dae31b95fd1d06852e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 144; - dataLen = 256; - combinedKey = "fe67a19db571d11b510bcc68582f920c900bbbf1179f49fd165b8d43d22fd76b"; - iv = "fe1c65e0f7dcc447efc0b73f3eccb387"; - plainText = "e6a5ee6d2d7dac1d49e6dc729707d8629233ddd624a6e0f4e6f2f94da5b4a22e"; - cipherText = "2a084f60b0984284887fbceecb34dc06522501d49132b8c09953d8f1e7f92526"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 145; - dataLen = 256; - combinedKey = "1fbe68d25691e994174402172568270cd19bb73ae569f58bf416db2583cf3dfc"; - iv = "a24fa3f6ae4eff66987c3440fa970411"; - plainText = "b54e1a6cf7a25e1b28c83bfedda0bdb3dc2016c6934d9a46fb761552c2983e14"; - cipherText = "412f8d6f00e06749fe997839e355170fc226a30859035a2f5c8534c3eb75a305"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 146; - dataLen = 256; - combinedKey = "b3a64b061daf37b460aaff669ecfeaf9e1184e75979e3625a39a8f4efd224060"; - iv = "3508616ae6beecd711bef5bf36272b6a"; - plainText = "de2a2664734c2951bb379927bf1fbd59611389f062459aef1dc1785622bd3c7d"; - cipherText = "b1d4fa46e5ca6e1cff727defb393c0b6705ab20103dc5389e1e16510e7825043"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 147; - dataLen = 256; - combinedKey = "08b61fd53e44012c3e79439c5d70510dc397779e6eda447f4726bde244e54fc3"; - iv = "74d64e519f70f6a07cf78eb5bee0daf9"; - plainText = "54d0d71ee3150949a4a9e7ed5a2511b962284a72b19a5bcbfa2b374739679f74"; - cipherText = "93e047ca46b1c895be3d40b4e1a8ae7e2445b7e4b5b73096e8348d83de41a9f9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 148; - dataLen = 256; - combinedKey = "b0793620d1e0e70e09761ab823375f8254f6d9aa19c1b0e9b0e93537e4e9d273"; - iv = "171888926b3234a78f85a18699a78d66"; - plainText = "4967ed2f9b45c88c0fc4dbe62c5e60d3b869f442feff68235115eb721dc8f97b"; - cipherText = "d11da60d048b85951aa2c2a1904b1466b65b42d0a884af1babd52d819bde90ba"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 149; - dataLen = 256; - combinedKey = "914f0fa83fbf0672e2e8750eff6b63e76d995b92b8381cc0467583cf1383b753"; - iv = "c09411a193cda4fbc6b41cf311fbbfe3"; - plainText = "06c6d47114af28ff9552c25eeac02e063b073f1c805f0aacd7101e45a3e54335"; - cipherText = "d8a63140cb2193fda13c6e562dd478e53b947b5fe0ca986258f9545645ce7484"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 150; - dataLen = 256; - combinedKey = "79d81e8f16e131591c4478b2359629863d05e4cb8a8cc448029fc3dcf359136d"; - iv = "1c4d0b9bc104259141f8eba79b02c0e3"; - plainText = "a6abb3d0ad235cf19e2abb3f08419e46fc7f085df88d920c5ef6c2339f35d5a1"; - cipherText = "e27a9b1080c250b1ccfc29f156842851fbbbdfc1b0304df6f9113bafbfd4eaf0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 151; - dataLen = 256; - combinedKey = "db676f35d34d6cf87926320c9a5d176f5bfbe43ca3c086dd84d4523fc3dd286a"; - iv = "b76091a033157e2a8a6bdb0a41a3ceaa"; - plainText = "015ccf8269e7b550683a1d464a4af8de8d247dba5b522399a098873bca306f4e"; - cipherText = "921fc41eda0390ab6fd000dfd17a4e435dcfc3edee865ad6bc63e14e9be08cc2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 152; - dataLen = 256; - combinedKey = "c0ece3ca6208cdad6e80960f688bc6d44f667e63d2d2334809f5a56097108a70"; - iv = "5c02ea040a42ace63506ccf11bfc416a"; - plainText = "db6faf2b5c5b3405ac29c81f5f9a4226b78a47f6c5d88a84aca5f949464649a2"; - cipherText = "0e698e0b904eac5043067621c1c2e4d4d70e112ebe4bb0d36d9c7f98f5b11bbb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 153; - dataLen = 256; - combinedKey = "ec1ae252e67461610fdbc89430d5b86cdc742b137c98b522b748c9dd7b19d4c2"; - iv = "1760c4f448e9fd9f1a1ca87066e85357"; - plainText = "9878f297ca65cc5bdb75ce1aaa9cdcc606851be4c7102a2b1be93330610701be"; - cipherText = "16df0807260558ec9ead9546740b4a26fd18db929fac98bc626705e0353e575b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 154; - dataLen = 256; - combinedKey = "d490bcaa38f5dbfba1bda07766c89360a073ab286b08e1eb2313d20ae2c8bfd6"; - iv = "0781515a38152d9bd6ccc767fd8790c6"; - plainText = "033ebfd9307cb933d7f31bba686d12131aee098bbafc78e34432818945316e43"; - cipherText = "731c4518dad667ccfdaf9ca43687b0e7b229701bd424e13744b98c092edda272"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 155; - dataLen = 256; - combinedKey = "7c6a18620a938f9a7db57daf12228e3726b627885b64acc66663feac88723bc5"; - iv = "b711b097148cf15399798a797b32e40b"; - plainText = "1db63594d07288752e02e80c96a00a27b2622aefcf892d620d6af143842b685d"; - cipherText = "fd6fbeecb81fbe6a01a383bfb93821978496dc8e6e7cc849a5f303eaf991f44e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 156; - dataLen = 256; - combinedKey = "b3c5019d4a999f9867dc273e774004e52aa6e8f8ef30f111a8fa9f33caf911d1"; - iv = "1389912f693a91dd75c6abc8e3178f38"; - plainText = "d2a45db4fe4977f9eeffeab5c298672db54340acc7fd330a603a5d50ba094048"; - cipherText = "60a2b46f265a130bbe945c311487947be98f95dd94d07463f856e22e2f00ae10"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 157; - dataLen = 256; - combinedKey = "42ab6421bb941ae050265e2cba5428d2b8d809a4e8955b19e8f9bb6c2a506ab8"; - iv = "47b2af6be281dba549b5edda6013c33e"; - plainText = "a7b464c1a1d3e02ce6418e1aba07afea9e3b1875960425ade82c3a7d8e28ca20"; - cipherText = "a52dde23a7ef21c5b71baa35db4c866de399b2413c256ad27897ee3fb1fc3fc2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 158; - dataLen = 256; - combinedKey = "bb8c1ce52a26eff7891b236f210983804445895a662232737667d5b9c1a1a756"; - iv = "a1f9b914f51c2fc518fd4e1dc0cd9e20"; - plainText = "a9d85a3cab881046ec08dad7b67a35bd0574eaafaf644057ac1bfee853c787b5"; - cipherText = "ff834a29b9327682d47740d48790c2d6a87ef9d5bdb23746539da3f112ccf4a8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 159; - dataLen = 256; - combinedKey = "f355921856d81f1233201ad82d008adb3333443eb874ea25e3bb6a560daadfc4"; - iv = "4480165e94acc6b505aea96a248db153"; - plainText = "2c647fe94baff35d9a959b2dbae93bf96e03ca9a110990f39a6f2391cb279d13"; - cipherText = "3293052aab4957e2ba0da725643ad7836ffbf180eec23c6cb96dc383374a48fc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 160; - dataLen = 256; - combinedKey = "1a4cee08ecae3bbe396cb117973ac97af26f28c829a1f1fb6014bf4487b76748"; - iv = "a82332d44b621faa723c25c04ff78b18"; - plainText = "5b5d453697b9d6d300c6424390eeaf0dab87a1750a9117c88c22605ff1bd0aa7"; - cipherText = "2290a3a6d9fcf3c53f4eb8bdf5d4bc2871ea85a4feab8a5e619506a66c252196"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 161; - dataLen = 256; - combinedKey = "d90cfd2eba0a28ffea8ef2c3b4724c276b5e7eb326d35e5dc1f01a6410826760"; - iv = "d216fe8a649d360ee6f41e0a84f9b412"; - plainText = "2fa6e6aa438d1d450bd5ba279a886284fe048fc63b53815b29a8c5e9b830d298"; - cipherText = "205d6048869dea91a1c799fbcc907131a39f28592bbfdb35ae9bc1839ab7d671"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 162; - dataLen = 256; - combinedKey = "32c0a67f54d6dd70d89c0150455ab94aff12f2ea92becefd8125cbec0c93d78f"; - iv = "a39cf92f616655971829bb8a8e3b9a50"; - plainText = "9a22c80cdf832a4b4d74b1ece1858a3bb6f1269f7c4975b0d985fee5b6e3165d"; - cipherText = "a3ae25527c1bfe1951273c088140c40a2b8251e2fe6e9f7d2d0e89888643f254"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 163; - dataLen = 256; - combinedKey = "2b76066d453f38a0cc44ede9e0ec0dbb9144deed683324c6c8f28208febbb41c"; - iv = "3de8fe112175b3cea80eb0eb6658e81a"; - plainText = "ae33b068bf0bfb9ba4be59fd8dc086514d03296f338c34946921d623a07f86c0"; - cipherText = "e8684a34400f07358b93e34bad4e53e7fb109d12d039d0a1deca87ee352c6a74"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 164; - dataLen = 256; - combinedKey = "1af055188f7fd5da6a6c7ee99ef97a2295fdad2ea65baa2c5548117a0dd75984"; - iv = "d4c35df7239cad770fdc5bcd3af16aae"; - plainText = "b9bfe972829a5245b94111f0af264541edc6d18862f1a5cb5c19db19cd4e5832"; - cipherText = "8c7800b4f9afafce059273e420ab9295801249b0d1e0534eaf2cd4ccde982043"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 165; - dataLen = 256; - combinedKey = "f580f9de21574e590afed986d799bdc0f2be0e1bccc8dc63094831efbd580aa1"; - iv = "a66ddfee9ca403ff4c1ca6e45f5e1935"; - plainText = "f9ba39feda0770932737ed3c852d42424faef25e950d0308683e178c97beac95"; - cipherText = "b968ee9951a40ba83a3a9186a13043ecb9c811aad39af3192c53476cd0bfb597"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 166; - dataLen = 256; - combinedKey = "372e74a3faae8e542ae35b72af0c3d5aab74c00d271e0841ea9f99ebf61de426"; - iv = "fe9cadde37eae0c0fcd22dfd4702eb64"; - plainText = "db3426357ba84cde7773deb9824ab8c946a82b35f10ecf524c5e131c70a12c6e"; - cipherText = "3c52364ae04cef376f8a45a60ed7a257356c1fde848fd9966dd04f49a5a45b41"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 167; - dataLen = 256; - combinedKey = "328c716fb35f2ecd9b06f508d748bf6eaaa760e1b15338dd39803f8608865e8e"; - iv = "ec72bccdec634e52fe577eb01f94b8c4"; - plainText = "53afb290b590eb021f13983f8b2fdc81c860b00b7c49a66a63ec2e80b7857e7a"; - cipherText = "c57805f331ad8e258a6802cf4452564b22775f233fc3986b51dad90f088f90ce"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 168; - dataLen = 256; - combinedKey = "6cbb2b84ddae119bc3d7348616f5c4e6e6761573eca2b50c0dd0cc38f83552d1"; - iv = "7c39e0aa1571028239acf8a146a6171f"; - plainText = "f43b8b274e8c663e1dc67d3e2fb1130687f06cda32acf79654f63afd689659d2"; - cipherText = "15707ebaba24b5edc88b196e64a811fe26daaa98addd63ea95d94dde31251918"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 169; - dataLen = 256; - combinedKey = "0697a78949959e880bb0642dc9d20b1b4e111d9d0c5137e3b02509fe2dadee98"; - iv = "b5c9c886255c939a7783718abc98d0f5"; - plainText = "f30933e383fd28d2caaccab312121427444e2897866926644f32941186f842de"; - cipherText = "dca8a029f08d4605f2ff52d4a06c67f4a79c955288892db6bcfada530173c075"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 170; - dataLen = 256; - combinedKey = "14fb356f5a2750fe29eb541a917b82a74133316098bb2d3d5f44f9aa08d7c982"; - iv = "669a3152e5511028ab67e22d4c3d6c0f"; - plainText = "c21977b084b3338b2025194ebaa961a36bf1be1d879b31431d338bed698cb8f9"; - cipherText = "3794283e4d14645f4f21829df1eaf8281c89417c7ac5ee91aa0d1a1c068fccc3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 171; - dataLen = 256; - combinedKey = "e90be15f0803cc97096fdb065cf0c6d814d5d8c809d91ac252208af5575c4638"; - iv = "1b82d8540723fdf2356b2a7aea44942b"; - plainText = "07359f3446194255b462dc4b6588b93d8fd2be2bc266d539033e80f695c99050"; - cipherText = "705f20eaff14726b157c4bea1e0da2fc7457b93ca9b71d2d6af4bc00e2fa6082"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 172; - dataLen = 256; - combinedKey = "68546cd53bffd10c39de9e4a5e508824fc28e6b2a8072e7f997424634693db56"; - iv = "fc8cff998ca83046f912fd0555a1b439"; - plainText = "74acd5b9ff6af0bc26c5e5ecd99c7650018617e84c6ade4c7f0811532ba165a5"; - cipherText = "fe2cd465fd16c295dd31e3286401e3e6ad67b0abc6cd9fe7c74a09954944e190"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 173; - dataLen = 256; - combinedKey = "3e9921d44330dad2794cc8a62a26936e0721d15e987778bf8e03bce123ecebbb"; - iv = "b172688b348de5867f9b3f516319aa2c"; - plainText = "b55370d0816bf2021b0f5a8f993ab50de06184805ea2ebe41db8f4fc8aed40e2"; - cipherText = "7095ac3d612c4e95db2ef9c4279628bd763b56c5e3197606cb4e8c62cbe400af"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 174; - dataLen = 256; - combinedKey = "69720864b5e6b66964f27e8cd1c5160571c7396fe096b9fdfe0a442b1f3f39b9"; - iv = "cf6c57f85d2b9ce5512f39ce89945805"; - plainText = "b1f90e2fb206cc3b16efe6ddd7610f3c831e0aabd91ac14aa93ad03afb5a1e66"; - cipherText = "9017bbc0f50dd2a0ff9abd5ef3e75fab3d8a18baad81cc4eda6fb4f71739982b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 175; - dataLen = 256; - combinedKey = "3d9e46f24063030aad20769cf2946ad1d5627692827dcc678f9cea729ce1c524"; - iv = "6eb2e1f09ba7cf8d8407b2be460bb23d"; - plainText = "3a18c3a87f58f16e87584f60cc8b9fc595470bbe00b90b2cbdc5455b9de93606"; - cipherText = "fbef0c4744b0d6c317d0a05d0cce8b11eb2b58daaed818be8470a6002785f0e2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 176; - dataLen = 256; - combinedKey = "88040dbd3b437f159ba731bec440d15a1bdaa919f8e1c91a2b92b77b42ca187d"; - iv = "5459bf420e194bf33d07c53c9bfdd26a"; - plainText = "fa437b5d765f4cfe8bbd84eb7f0c65554be6f64ea9706e6024465f83512c8fd9"; - cipherText = "7f7efc731bd8cbfee383f0e7cacca4a8d4f086b996749fd7e590cf48e5a626fb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 177; - dataLen = 256; - combinedKey = "4048849c1bfba6bac2b87b82c22c52b3a59885dc83b23bb9ff7fae3a1f299813"; - iv = "34a078618e0d69bacb4b19b631686d5b"; - plainText = "0c9120c4393ad8124e9fe93a0a04ab2a9fcc07b1fc734e6e0922cbbcb1c6d056"; - cipherText = "cbd8ccb0896e7647deb88beb0688151858f1bbee6e70dfaf90cafc35f6c2a037"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 178; - dataLen = 256; - combinedKey = "dd26ae8af60c270e04114037007bcd2b4df9110dce28f1080d1ad8d7015819c1"; - iv = "c1e4da905712b5e999858a580735fe61"; - plainText = "04d53aa586b03e04ec375a3ff5e1829b89bd5f2171e187d8f33f26e4bae4bad6"; - cipherText = "ece10ba75a58ffb35185815112b53c62c5a57515b4b811e3157bd5d6acf59ba5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 179; - dataLen = 256; - combinedKey = "47cee261912713727f7e2031bc98c7f57faec23438667caf4d76cfadebc0563a"; - iv = "00410c09bc2516e7973b9e2c3e842764"; - plainText = "bc0db82db7727356edce2ac5a5761a4002a697fa1e3c3fee1960738213f6541a"; - cipherText = "0f4bb01371ed9ebe8d4665bd9251e0a10c5879febc790fe3a40407acc45422bc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 180; - dataLen = 256; - combinedKey = "b2ffe72136cfe6b61d81a215aadd2ff7c59663946fe79731d81decf24be926f1"; - iv = "b706cbc26ac6e101731441c2fa2cc8a1"; - plainText = "a3eefb4cfaad4c5d93a79dde4b7b7d3abe4eed4c702300558e6ec884d11492cb"; - cipherText = "997ab70bdd9059ca0eaf13f3e76045bdd101ed3063582668cc65e127a5143d48"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 181; - dataLen = 256; - combinedKey = "a3f410eba2dec862ef4c2b2966bcefef141a318dade1644b4d869113fb1187f5"; - iv = "fdee2ac34f54f1afd5c8cbdbc92d6b1c"; - plainText = "63999d19f106f7e549df4ed39fd7f9df288518fa548d2f91fe696973bd9f8a96"; - cipherText = "708dd39a3abeeb23ad2b68a9e3d7fbba5c29273d66cb22cbff6131b6790ff989"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 182; - dataLen = 256; - combinedKey = "7a60d4af523e8c8341741b858557f653e4ec680b2184fd3a7eebcfb501599b84"; - iv = "02dcb83b94125354eced55b8894378fd"; - plainText = "7c8d8bfd081e5f514915b5fcbac8848a5c6b617c54cd53f6feefd25169830c5b"; - cipherText = "1dd8629021b11316e155c7c6bdd5dac27e4a783cb2c0a722e90aec96e345a14d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 183; - dataLen = 256; - combinedKey = "84e39898c01a7583d63a89588d7f21678c662e69f7ceccfad8fe95aafb0c2722"; - iv = "18e70f3664884f72278efd16e9713873"; - plainText = "ef4c00e214a80cc414a7dc72bf24ba603754facef9777b9ebfb5d651837a3d03"; - cipherText = "9fd22135b2667597129f0894a283482899655307e07b47a2bf0e788587854d22"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 184; - dataLen = 256; - combinedKey = "e5783de37c5c2421f4d5afea7e2b6bc44390cc75a1534a39078908916025a592"; - iv = "4d824958dbf6ea151a481dda3881abeb"; - plainText = "6f7338f14613863e2d8b03e0250a0653210f7c29a5e8d5151c7f5c254d73c885"; - cipherText = "f845449e89be60016647cecc51ad023bb8b1d5f7081f69ddbb4bb540804196c9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 185; - dataLen = 256; - combinedKey = "6f56eb4f5f925daf0e71870a05b7866edf1ea425a03d294620aa0a11aa5ca32a"; - iv = "1271cfb272f070c29c51b4f6e5351c43"; - plainText = "65a0d1a91ce6438a92907c152804c7d10cacb9a40050a2f8665ced96dc749894"; - cipherText = "2466a1b111007f25672cfbf180d59d3456c769c28352a1af3d8ad43f8bf56c0e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 186; - dataLen = 256; - combinedKey = "5095097cd958ef09a1781c1e7969792e17e107f283d40f13efe1b82abac8e667"; - iv = "28b1d79c3f2e79922c159bf9c33ffa04"; - plainText = "6720b63cf0f58bc656cf51bc130e9ed39cade14b09e66f062efb9a8a5132ac99"; - cipherText = "d36fc5506d3175f29afed429f0197eed5b660467a877c96d80b6ea8a7ef82d24"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 187; - dataLen = 256; - combinedKey = "dd2d73be1cfd9ec197befb9dc519db73266ccd17ef146f1011f4c3c4186a6ab4"; - iv = "1a79f1dae544d630d9e0d69bb3a437d0"; - plainText = "9ac83550c2dee72878f183439db19c07b75828f73645cff270c55befc61fe9ee"; - cipherText = "bede927accc06fea11269dbd8277f4137f7d3cde0c8ebdcbcf6ceeb1d73079d4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 188; - dataLen = 256; - combinedKey = "d65f059c365cec0916ec7750546bd542b9b62864d60dc4446155a788104b04ce"; - iv = "18dbd1147d6d6b9ea3b09cc685c84aff"; - plainText = "16d47b6427570495c11e6b0913992429802f593c2fd73cd8be08a2dc0d7c190d"; - cipherText = "f923401cce5350b36bb515f6b2a222b3f0e0e944666eeb728869af5940921ef7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 189; - dataLen = 256; - combinedKey = "0ccb23bfd8bb00060d728a0c4286a4fe148a73019e18bc74020b482f9ba69593"; - iv = "cbc73c9074079e0b9a5d8242a3815a0b"; - plainText = "eab22af948e6818e8d6c6e22c46e9bb45ca704ff3d3f88c680dcd02ac0dea94f"; - cipherText = "1ed6cd529802a136ac4eadef8e873933f85e21f041ded59409cb35ce5770e888"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 190; - dataLen = 256; - combinedKey = "d6250ff8814fcf5c56b5cbc16b63872fe16d8216ece3443a015b31ddddcf9c10"; - iv = "8b01f97ea86f56ea25a520627591122f"; - plainText = "55e0e42e7e7a32830e890398d42de8a6bad5a4e35f06e708feddaca0496ff3c3"; - cipherText = "0bd4f2f7ff747bfa05139ebd4dde9f45578b4a68e61608875579239b280a2401"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 191; - dataLen = 256; - combinedKey = "e8fac0515e137e6f502ad4686a9485e9749e251164fc6b9a84b2bba8f8b535bd"; - iv = "71f71fc025baa3be5dba771dd10f26c0"; - plainText = "e5f7eabceeff50fdae6965945f79daecefdb5bad381f9a331f111b0764b4c39a"; - cipherText = "fdc1a0506fee2c1fb26f8da692a19bb6467db8e89573eb4b772110e2a0968cfa"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 192; - dataLen = 256; - combinedKey = "f55834c2c6bf0ca9675ed45a295ca1fc506fb1b6ce9f75ea1014ca03658f8b8b"; - iv = "c9567323a7d5952f3311a34a7a1f12f4"; - plainText = "037f595a8092a30b9b973a9320546581ce77191b66b59d4abe7ae313a53ecb59"; - cipherText = "dfc47a1e0f1ab4600b7454c1d6e03fa005e9e0c8f68297ad40441fb8aa36282a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 193; - dataLen = 256; - combinedKey = "77191695e30bdec01b8187dac706e2d93b9b695646164fa1c3e964b548f02aef"; - iv = "ec683efce4f936d6ec7b715a0ab1cebe"; - plainText = "eb16ef9d09db4d1a6382a2e1386cc5b6241e93b9f489fb1ecc80e5c4d0636b38"; - cipherText = "71dedda5c684b3fd651eaa76394a89a5da5088189a119bc7dd83049739e9efd0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 194; - dataLen = 256; - combinedKey = "56e785d82ab69daf5bc8d840ae55c76270daf8e5a30a06d19723371fe94fc137"; - iv = "3df4db3f1368402cd6f407be96a9c585"; - plainText = "bad8a12e48b1e5d481e793d4069e0f183d16545c28bcf65aed9f4a88ad269da7"; - cipherText = "13b76e3d2fbb067da7ada818e1d7c62d11f68c9830b1778a4e17d09e24dd25de"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 195; - dataLen = 256; - combinedKey = "cd717bd6709b2f5bb930cb4746ccfa58d2a3fc7cec5659251f62bebb7b0b2fbd"; - iv = "9c3957fd829514ba3961ea9149b527a3"; - plainText = "3002f2ee9e6c39a0b9dc14a36cd19ce2f6377ab60b8311dcf5d1845d509d5d6e"; - cipherText = "66849b4b41426fe8cc914338db6137446ac59a218cd335d880023043dedce07e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 196; - dataLen = 256; - combinedKey = "b620c1dad56964e070eafa7e0efc3ab4c38a0f5fefc09169b93890badc3fd2b1"; - iv = "9b8bb985f2469affc9d60332058d7fca"; - plainText = "c292e5e276bf28ade313ce2ffd1db6a943a386cc242ab7699df5a51bbaeab0d0"; - cipherText = "b7e3feae419608710cde65a67707b8bb91880545d3b9b3c494ad9be6c6a1ea0c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 197; - dataLen = 256; - combinedKey = "c927db32fbe3cc3d2f81fb6af9ac387679c0fe7d0105ade9bdb26ceaadb4a43c"; - iv = "ef5ba85e322a843c757a95ce47657bff"; - plainText = "d296c49a3b64395b81933818c68b5a38de22b23b8ed47e94b0dfd646c9ddb611"; - cipherText = "f9189c25cd7644615ac268db342ef7ee0a38c9efca6219cccc877c39f9302452"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 198; - dataLen = 256; - combinedKey = "70f39cb194b976a6fa56c01d8e79f73c21b785c70f6d3c7a5fce4eb014be4eb4"; - iv = "a49282dd9d82e517fdfa223e5e32d2ae"; - plainText = "8beb3486fae1978bcaf78dbfad311ced5fd500f9a10c3779048572dfc786f616"; - cipherText = "4fc195349b6797946c5506da2f5ed4ec61707736aa2bbbac9183a5bb3d0b02f6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 199; - dataLen = 256; - combinedKey = "5e3c6025a11678745c7c28ac3932dcc89ae3d90277ec3044742c5e35d4d073d1"; - iv = "0d473cdcd031285916593b3cae4cd7eb"; - plainText = "3b6fef42eb4788b4859b63dec4470585b86c366a5945ed7fdc9299895735d936"; - cipherText = "5ddb078085e07aabbb66ae09dcb27d98e5a4f667f0a64b56f81da1c19549ea71"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 200; - dataLen = 256; - combinedKey = "23694bae3f9d3d4870e34497c86500d5a97dfeb47c47552213e1f72f66d9770a"; - iv = "121a5c7d36e3c156a74512f8c0fe52f8"; - plainText = "968ce29ed9a126c1a531ce40aed453646d17f375fa69200b0523816ede9b1365"; - cipherText = "71ee6e7ba532898fb76c9d2828cc1e8ad826fb4a6d666f25c25f116780730107"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 201; - dataLen = 192; - combinedKey = "58dcd1be774595bf5f5b6880b4b123b8f2bf175d335aae07bb17302bb2c4443f"; - iv = "5f9d62baf3628f790afcd7964be504fe"; - plainText = "bb6e724e5343f4e1391262e39dd0975f7f82ff118a4d843a"; - cipherText = "96ab8de2934048158a78193baa893e671bae183a79fb7933"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 202; - dataLen = 192; - combinedKey = "e75e512b231efed91cd60438b0e213ae34b99f1d4fc9ad981117af53a40c9cb1"; - iv = "408094779056e4c612f1001ad4404793"; - plainText = "6a64ef535ee231498fc9212fda0b38254c86958dc8f09dad"; - cipherText = "7ce7d9d0515931b8ab84e8a4a6ba334c7374ded5df83d2cc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 203; - dataLen = 192; - combinedKey = "e733ca4c36e6174b55221b68ca76f2d40538c9d55b0a1011374a5843731906bf"; - iv = "fe36e49d0db2babea10731d391cdee12"; - plainText = "83d85b072b794ce4c6d2817103abb27b606e9db2b232994a"; - cipherText = "aa404725ae7a8b9ece9d406605be86c83c8798a3e0c209b4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 204; - dataLen = 192; - combinedKey = "8b4936d9fa250b59e181ec3d8073571124e166b1d1a0aa4557e3d297e860ac95"; - iv = "722e85866697b6360bc7f6beb9befa32"; - plainText = "c878a731c06d5281c70c6557c6281c4833baad19140aa6cb"; - cipherText = "bc59c2dbca762dffe83082c2cbb6e84634eabaed7c6b64b0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 205; - dataLen = 192; - combinedKey = "d036ed73522c1f32a75cb054143b87d086649abe6b26bd5610307ee0540d9c2d"; - iv = "9ddbdb685270f0b6717dde6317e2a099"; - plainText = "0ce23722d8eeafcdc8f5d3a5de187f499ccbd7ffbf6e89c2"; - cipherText = "a868ffb10d253449d0ad07b1716820c68e5da3a148db1a84"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 206; - dataLen = 192; - combinedKey = "d030ef0f358fc1c43a9b8c8654a8bf77fc7f335c89c4133f63c130f4a025f01b"; - iv = "b4337594524fe4b349f0088cc0b988de"; - plainText = "d5f569697b3afa39485a100eb5d58dcbd7b295e62d568f8e"; - cipherText = "5f929e3340b545836d7fe4ed1e8372cb222f5b053693c65e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 207; - dataLen = 192; - combinedKey = "84ea6dc7c780e71b158722d47a5b22e0ba7ed9a434fec1a310cda09879bd16d0"; - iv = "cfa31199d777a6be50fedc3d9b282244"; - plainText = "4b395ea31683f4d00434ceb66b4f76610ca05972887617e6"; - cipherText = "4e8b8a824946bfa0acf116038d2ddfd974e6aa5286ab8942"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 208; - dataLen = 192; - combinedKey = "a4e6557ea45523b2ce658d72763f2d616015aa029c89ec29029bab3849fd62df"; - iv = "93433ad27b4e265744424e7a511f2413"; - plainText = "128e41e0529f8d032c040acd2ddd126bc7ab53bfb1067d2e"; - cipherText = "3d989c699d40cc2480dda7f4f15e4ce66e8705651a6febaf"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 209; - dataLen = 192; - combinedKey = "64c2edb4b9164a4809ca52c3f7110d96bb37d577bdf2968d65f525c02c677f02"; - iv = "4d478f5f9cdfeab3059fb1c06e7a6002"; - plainText = "75508467bdf40bb822ceb17708ccc7d5adc29c6333fb0d3b"; - cipherText = "fa67e35d488db3dcc634000925bd231ff30c69287df23933"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 210; - dataLen = 192; - combinedKey = "2d12f1e7de982a20172091e1a30198f02c238f8adf82728a305585b0153dd1f8"; - iv = "ec98eba8f9f8c4b619e5e28f7c0ab03c"; - plainText = "a50b44cefedcddb6d224ffa041b8c56a9baf7963cc900b6c"; - cipherText = "48af0bd878a3398fadec0087c257d3859f4864ef2e26180b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 211; - dataLen = 192; - combinedKey = "60dca2cf0a8a6c6d4b5fc9a9d9c3f7bfdeb236b1752b3a713039d80cee0b586c"; - iv = "a0bc17cecc4b6e2a44a30bca6eb1e3fc"; - plainText = "0d701913397b8155fdeeaba6e25800dcb5aa40051a8e0ba0"; - cipherText = "831a6711ece4243e6cb5dd6aec6ff6e99ffa896d73b6c070"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 212; - dataLen = 192; - combinedKey = "119b3f064672b787c51ad4f791367b87c179c4575a4acf12c4ab97b395be5284"; - iv = "d5fb2fddac5730f46b63597f0b26e104"; - plainText = "1dde28834bb9f57eda926b2455e16ec5763b611db4dd1269"; - cipherText = "f715a9a58f1d88851d3b5e03b0d6d083e094500b21d87a56"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 213; - dataLen = 192; - combinedKey = "a52214318f7f38f2a234d7d07199929eb44a00851125012510588db2b1cf6149"; - iv = "8ba4aa93c8e2243b8b22c417876defb7"; - plainText = "54b9fa2b40ad9abbf7a7c60a6c16f4aa4b4ce8b5ad6ba60a"; - cipherText = "63abefd45e0f603622c5d5c4c399f91650709e2a2aa5c604"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 214; - dataLen = 192; - combinedKey = "5ae3e19ab5cd033cc36c46aac7d8864352d6edb80b63d3eb8e2f9ba0d0f9b199"; - iv = "2559e196e5415ac4b731d4a32acabcbe"; - plainText = "5a2972e0b83fb46447aef2d6addb4ab84c4ce36b6cf7c4ac"; - cipherText = "1ae7f962476191931ba374461531432053d943ca1628e877"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 215; - dataLen = 192; - combinedKey = "36a0cb3a4b69c6948ee71f742192cc7325d027876cac1b1077e06e0e5a23518b"; - iv = "413696e05473f82ce6116989f75e88e8"; - plainText = "d80eacb237627fa36d3f3feefbb1d16f919832eef20515e0"; - cipherText = "b1ab67e9c467679b3af57f03ced738475ca2fbbefe2e8004"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 216; - dataLen = 192; - combinedKey = "d4149d796074bb288bbb6978d16273e34f46cd1d0c67fbdbdc43a75f67682d48"; - iv = "5a2b3a4c004bd31d249d30cf879a3cd9"; - plainText = "616038cd825d0f5de8c9b6a88150d97df8e10f0221a3c251"; - cipherText = "d977d93e41d038ba2983be4c83869dd206ec8007b26ec06b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 217; - dataLen = 192; - combinedKey = "0507c4f687e5d67b1bf80c39bb9c825b8875b35742803233f20109bbea20820a"; - iv = "1ac6a10bbfe427608ffbbae687e748fb"; - plainText = "da3a23efde1a691b8b091f3ae6f6657b81ad4149eac3a102"; - cipherText = "8c41078f7d1a91e216a5ec4ecc2727ffaf70ae22666a3ffb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 218; - dataLen = 192; - combinedKey = "860daee1882b803f77b6c260fd2a3f3f84f1106ebe4f35e9a713e4c25e554396"; - iv = "6d028f6e284c883f93d572c0738a2468"; - plainText = "74f3a68dc5dbe3bbf91a344ef1be2b47198b3054d4fd6995"; - cipherText = "5875d4e29a2b76bf43a63c3f78d774985fa5f94ae2d94241"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 219; - dataLen = 192; - combinedKey = "2403bca495fa083bf329a31df41bd777698975301e19e1c07a3822b1c46e123d"; - iv = "2d540cca55594d659b9a8cf34ac48b3f"; - plainText = "5a2a4b6e6739f752ed807c9d251f9961c1ae2c6baa64976a"; - cipherText = "762ade540d34e38cf83973fd0113f7cd30e05a685758a490"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 220; - dataLen = 192; - combinedKey = "0b0f444c99bed94ff6eb730900f9f27ded92d7b9fc9e16aea4a3602fef1b8421"; - iv = "4cdcefe438ff1d2977b43bd24ffd3594"; - plainText = "6e1f19b74715540a45a918cd5099798099b1f6d11eb0b855"; - cipherText = "8a275fdd2f95752086cf70e9e2641192b198cbc1905a5707"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 221; - dataLen = 192; - combinedKey = "40989dd90f7e18431e0d09c3bc8f729ff00be9ab633a21fc9ca9bdc1da68636f"; - iv = "8f5376432a9d902e08a5004a4683a0ab"; - plainText = "fa5a7250d86c3e5c4ce1eb3ea0d20e45ef1b10b9ba9468a6"; - cipherText = "6861079119a67a07c6fee59cfe9f0b1452dc0ab6a5477c53"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 222; - dataLen = 192; - combinedKey = "880656e0cd40b169c3df7b45739c5c34374ca809a1e368422a0d558e236304db"; - iv = "ea2ff0db4c96222bc8f5d9615041489c"; - plainText = "ecae1943fab11e6dc113124582982da58220bad24f3885d9"; - cipherText = "aecff7c2f13e2c754d564d4f62346b7fb2490a1d1bb98625"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 223; - dataLen = 192; - combinedKey = "fabd574b0a82792013cc967b657b8206e6519a249c628c13a5d0505839feb86a"; - iv = "c6ff61a9a551d6b65ccf23e7b7a5e1aa"; - plainText = "07ab2158630d5f47ebc2e6cf236dc40ac16f120d579e438b"; - cipherText = "306bca44401ddf7d0531722e6123836137dfe2a7c3c8df21"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 224; - dataLen = 192; - combinedKey = "2984e3e85eecf101e9080bd2cd8de733dbd88fbd2b0770896be589ccdcc93a36"; - iv = "1dbdfc6499d2ff9ec4ce35046dd58d58"; - plainText = "6bf174de979249087f685eb36576f7f10cf6ad6e944e3587"; - cipherText = "de54080aee291808414e3df242ccc970a5ab2db3342fb131"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 225; - dataLen = 192; - combinedKey = "a8aca703c4a960dba946191fecb4125207bc70f339a4e4919ab10109185875d2"; - iv = "e1867d390ea90c54ff6ef7bd7e685ebd"; - plainText = "97b4511d1a2bfd1f31eb12abb05c96a89b10987c52fd5cf2"; - cipherText = "fb6d18af4eb2cdca7ca73aea236d6290559460fccef637b7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 226; - dataLen = 192; - combinedKey = "2b4953105b59f8ba271b3404cb24b6f4d863cc8b43a511f1d32cf1223bb9b8e4"; - iv = "2f9eefad143acabf60c893ae572008b1"; - plainText = "9d9406d7cea1ccb5fce2e5a6a6914c55e3a4637d0dfb8a70"; - cipherText = "ba1828567067ff15ccef8d4e71e7f2e24f88669bc9d854f7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 227; - dataLen = 192; - combinedKey = "fb0daec0d265db482a80daf6105a2d7c6dcc5f789ca96be0d7d49080f2192057"; - iv = "8e3152ce1d813d7c84bf449883553579"; - plainText = "74458376492cff5002dc826a5a1b94f121d1ca5b6c87709b"; - cipherText = "f7cd23b4e932bd05fbaa0f00cd0d575d37ec041e9ab5ba2d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 228; - dataLen = 192; - combinedKey = "8c23cc0515604dfdde10834f435a092c13ce1feb82b2642b9a35fcb849b272ba"; - iv = "53586f47f2529e347e06781bc5e0d1e9"; - plainText = "611682c4161238149812eb17ec5128a6eb1e937603033513"; - cipherText = "848750ed005a79ceeb2ccfee1ae4d4f07c7ae1d2ef46378b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 229; - dataLen = 192; - combinedKey = "78cec5f095b1181c42562133c3ddcabe6a58f46c2463c6f7c9674147106d5ef5"; - iv = "f1e1404292af1d99053483768222aacb"; - plainText = "4e13c5ba74ec8d4d8c494ad17edfad404618135f978b2c1f"; - cipherText = "6f6c69726afe9812e16b288cc4b3ef7d36b6a0d3e49bab5d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 230; - dataLen = 192; - combinedKey = "444bb1b5ae7e36bd0bafc396077bcfa3b2f7cbc56e35f337c531863b796160be"; - iv = "a3284513536815f0870b80fdc500192f"; - plainText = "ec7e5404deaa31235516aedadd98875a72ff255eec04814d"; - cipherText = "2e9d6e985618b1c01570a880e98281cebc3cdf98a6724333"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 231; - dataLen = 192; - combinedKey = "00cf714c2231a614f1701c0689daf99c31397a39c2c36191207fed34be45d176"; - iv = "6fe41af548268677b7fc0f4c8217cfb1"; - plainText = "1910cd1b79d646e865a11656681029b44d63926f372d6988"; - cipherText = "2ff1390e003620d8c7b24967c551466d97e7cf0acfa7302b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 232; - dataLen = 192; - combinedKey = "2a34cf27dad8d839b1e7a4e5cecb64d0989869bf3f0b58acb12e4abe8a576819"; - iv = "0613358d1f1945556b356bd1788e75c6"; - plainText = "46e61515b9e030f12c6a8c3b58b21046b2de55d6c084742c"; - cipherText = "52570d9a386822b3a5408cb7c90ef7baf11a3c03f00ce715"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 233; - dataLen = 192; - combinedKey = "5eb635e5a692204a55a942203c7f1b96d439f6856b68e05a0bab906c5e49e11e"; - iv = "674468f99ff80e595a9b28080d4d8d78"; - plainText = "c422bc317a81179874b3d7c1c2f50467047966b6c6611a16"; - cipherText = "76a0062b1d43c714946c42aa871f02715e9d6f87d1316500"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 234; - dataLen = 192; - combinedKey = "5ff616b84dc6cef762fab7796399b020cba4dcdcacc4799f6e32e79d4228097f"; - iv = "b30e9784cdce7c5da9332dba264a842f"; - plainText = "412f064bcbb1d388f78253bb3044ca2424f131ee323b7383"; - cipherText = "2f27ed530358f9d67ade6fb3c6352252118f5911ddbacc4a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 235; - dataLen = 192; - combinedKey = "75fbf194212c655cecd8331d010ff41f9ad59b47985e46bfb5421a7ccd8c7cfb"; - iv = "8befc7337153c8077fcce1c4abd3c4cc"; - plainText = "764fa204c2336770a89eb1a7018d7da35a702b7f186e27ba"; - cipherText = "1b339516c59bc48271b260ca56f218b5ed65c26c13ba3f21"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 236; - dataLen = 192; - combinedKey = "dc62f4dd2c532ddbfbbe3258a544d265ed9f6ca4e71332062775fc261d6b7e61"; - iv = "ecdb45751a8a61ed784697455ad0a87d"; - plainText = "59a55490efe6b34d2f92bed98c4250769ddffcf98f9048d4"; - cipherText = "1c89e43d4543ba1425d01878fa94b9464954d8ee671b72af"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 237; - dataLen = 192; - combinedKey = "81e160a14776a81a12b1fd6970738823a9161c1a3ee2da940fdf3d2c9e3b4b01"; - iv = "e168e98b72ec010d2e271e5e4fec5d98"; - plainText = "73ed9dd6b0e6827fd7e9986de56ebd676553241233ab5dfa"; - cipherText = "5e24e4c8925cad4417a41e7c5b52c4eace7b4b0c55a493f9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 238; - dataLen = 192; - combinedKey = "e33ce9c857a0287073aacc58bd461e52bb22cdcdb62b84ded6c9bab66d3dbfbb"; - iv = "2057c203c73b54b3fa860a88987ce613"; - plainText = "191b946dea6518c355a2420b4d313986af0f2c44d0bcba2a"; - cipherText = "aa6d132963a1f44d2817285aa96bc0d492899b58ec6ebc12"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 239; - dataLen = 192; - combinedKey = "83af2896547db2fcc4f2ad63a048da769f723dad00fd911405c0294717037e29"; - iv = "8586b1b992901e444bd72d01628da084"; - plainText = "c89a94442167d03d3461e11f88fc05e7909aba3ad189ddf4"; - cipherText = "bc30509a68bdeebb3ce651f4a409995cf143c1130d8208f5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 240; - dataLen = 192; - combinedKey = "479f9c4a2ee3c3cfd5158d50537ec441bcd31c9a820abe444d56fadd7bb7d749"; - iv = "b62ec0474b5b298f8108e307caf77b31"; - plainText = "8b43f4eca273e2fff394ce8134d29dd577fa290501a65d36"; - cipherText = "57d79669b0e0a327c343ffd519ef0adaacea04a04db936c2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 241; - dataLen = 192; - combinedKey = "b03b9408a6d961e0c43af57a4d734a59692e670a63122c9c7016e8d3f68a4aad"; - iv = "7a338a1933a5889db9ace3b640d66379"; - plainText = "5a9391d456d4ee9be29b4890e53242065ef2ac40992dc264"; - cipherText = "16f87e6dd594ba8b3879d71a256162742901af23225ad625"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 242; - dataLen = 192; - combinedKey = "c9be1e0c22d78b6fcbb658517bb8ef29aebe3b06b936f5b61b341f9775e13323"; - iv = "c929d36f34431592143222617a1eba31"; - plainText = "c184a47cd2ef4938c5cdb6e8dd0cd40b15cd5c18566382f5"; - cipherText = "177a6d918c084146eb24ea4fccb6ebe2e0e71d1c5e63d01f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 243; - dataLen = 192; - combinedKey = "83e51a46a6400803c20d82147f5163fe61aeb8356a11a5de132449f9344e4e8b"; - iv = "690fc52e36c22f175b175b9dc768085a"; - plainText = "37d39328e35b89208f60e16819fae98076559122a96051c5"; - cipherText = "230fcbb71cd9e9aed6c86cb3b2ac85d3014c45300d211f08"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 244; - dataLen = 192; - combinedKey = "959dd01eee7d22e047135142d1622edb7e53eda6a2acbe1f9d28d02690d2ae7b"; - iv = "e3bc6cafb639f6de6a8254bc6202fe34"; - plainText = "708093b85b527a45a578ffff999a3ce40eecb2ecf7c50210"; - cipherText = "e2c9833cd519e40f2bd6b13d834278af3673741c5beca103"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 245; - dataLen = 192; - combinedKey = "d2bb39424139bd98e2395b0b5017d40c262bc18f4c93e167914c04d755ad4e81"; - iv = "6124a472684c1dd1955bf8a8273e3e80"; - plainText = "e9e045ec762e9a8471d20a8c5fe5f7cd1a180feb214a763a"; - cipherText = "dc118d535950bce83b5bb425afceb3e9b5ecfc47e0ccdbaa"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 246; - dataLen = 192; - combinedKey = "a6f009bf5cdefd0605ae42a612ef4630c996c4cbd283c2ec1c517fb1e961ca33"; - iv = "5ab6fc1be86cd8a789606f157807e718"; - plainText = "a6c83a1e41d8c23ae46c9a43651d5c48a32f048f206eed65"; - cipherText = "c75717555bfbc045e059528771a46d182b3d0d9946cedf9a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 247; - dataLen = 192; - combinedKey = "c6006ec65920d564bbbb7af75c0def30904f67cb4267bb8ae59dea637818d803"; - iv = "a9319b84adeab56e938c6825d70b4a87"; - plainText = "f7f96a67d4699a3159fea6c8af8f89f1d1a7d11f53b75281"; - cipherText = "cd23ddd93bffb09f740da649fd394114c2e700d7a0770c02"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 248; - dataLen = 192; - combinedKey = "07c4fbc70b5f4ec54f4a0615ed0d02bc54054b512770d0ae15c6679995354485"; - iv = "dd8bac2d20235ba4088467adcfd156f4"; - plainText = "d502cf061e155267eb9f87291a2a65c3809a2f5e0aa64d02"; - cipherText = "e9c673a1e8daf26ff8d42d667e10d80e646baebc286c98d4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 249; - dataLen = 192; - combinedKey = "77fba954027a1298f76e277f67f75b7b832a054e5d1aef9c9a26748f6d0143fc"; - iv = "00db4597eae09665f43116ab384ba160"; - plainText = "cd282ef3c5f92c2a1d437982194278fe50ad85c4bf5461d2"; - cipherText = "c6aebec6c4965ce62fa2eb6524c1d018c95d221e5de1aaf7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 250; - dataLen = 192; - combinedKey = "b1c2c0a992e8aa4c8a8efcda185e8376b6f2a3c75b7311c81456ec38aa71c14c"; - iv = "46499c4df6e33198f57c641f71cef89c"; - plainText = "269cc20d7d1e78452facd9826f134fe0613ec0aced7ac5af"; - cipherText = "827e58370bca1e9a295dc5328bbde015a95ca3694c57c91e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 251; - dataLen = 192; - combinedKey = "554498f565d90b8add8282e21eb4f87645adcde0ddd2af3685403e84b28e5603"; - iv = "f6ad34d6d5e663c0f9c343eb18cb9ec3"; - plainText = "4d021db638a80a70f49548bd08ada14a6278ff53ec8b3c43"; - cipherText = "34f5c08ef5a179ab230f29281810248a8f9bd245e048ab94"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 252; - dataLen = 192; - combinedKey = "c731eb57c4b56be1131e1f91e03a2b766629cb14b666762d6b6689d33fcf6a87"; - iv = "0821831122c0bf7f72c2615832e7d4ad"; - plainText = "b082187850035fc5a802ce52f1f9f9d9baed6a61f59a4741"; - cipherText = "f4beabb93cade84dbab0f3bf9f5f989b89b1e65ed347c7c5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 253; - dataLen = 192; - combinedKey = "c9ad52aa28dbf6f3c214a2f3de2773c26383cee6233c158d70c5a2919622714e"; - iv = "282767ab166d1a7264e89d0705fa2141"; - plainText = "688602458c6468139a484920ace83fa24ad20d3542827199"; - cipherText = "28d2131b469e81a163d29add1c5463a1bd87113d4543d909"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 254; - dataLen = 192; - combinedKey = "2854f19670c1fd147ca9a8ded5d6cec44bedcc027f691893d82e0f7e2555f101"; - iv = "cda61b9757c608fa7f92e4ea5e6a01de"; - plainText = "0aed79a1ceb2072dd0a813ead4a00d2aec32d26b8b5c6a88"; - cipherText = "f293cdb7efbc2df99302223875a2a4f98c94260f18517b2d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 255; - dataLen = 192; - combinedKey = "1c8dc974539ac4045dbcd876113e085e3786d16acc1489473fa5d4f0300af31b"; - iv = "fc91bfd3ce811f02da3d42091dc3d391"; - plainText = "92a7b91170a3269515903868f83d0cc18d25c6c28cf0c8a7"; - cipherText = "fd8ae728f3d5a27e88bda8b36b126ec85d0ca842788a4baf"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 256; - dataLen = 192; - combinedKey = "5b8e02cf3fe0595aa7e3200bff6a2abcba8a85a154da4757ce9fdc15014d0c46"; - iv = "ea44c41b327f238cc69dd52cb5cffc13"; - plainText = "f96cf1885ada571e369de7a84556e540f798ff1bdc748cef"; - cipherText = "b9430408986a5b4f043d1d054ec472707ab1f4ef1f1b7add"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 257; - dataLen = 192; - combinedKey = "4428abe0c054f98c703dab8dd54cb0144e57f705bcf5d8674f87d094fd79f105"; - iv = "92d140c014671422dded741daa34f142"; - plainText = "a5064e5bb679127602d2ef1a0138f1026e351257cc9d929b"; - cipherText = "41a20a8c1941f44f71c516243ffb5b50eba4ec0b695878af"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 258; - dataLen = 192; - combinedKey = "e4ba3a2ce6e629801ba6e45691ffc95922886c2104f657d83ad151f9c5b60b57"; - iv = "369ffc3e4c2d2664b5db56384404d557"; - plainText = "5c7a5ad7bdd874d6dc7c72139690c44885d0c817cb897400"; - cipherText = "2e6712fb9fba53d8c176f4a4d8387682da8f4d3d7eff35ac"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 259; - dataLen = 192; - combinedKey = "7d4d49a02bb7d356edfb962653d0fd7582fc42156aefcfd56317c8e356304229"; - iv = "49966cdb0136dcd1bfa3a7ab5d74142c"; - plainText = "91ed05fe4c5e02998bb9318ade59963a8e81f01f48ebca64"; - cipherText = "4b063a75ae8eb225bdf5fc7308aa49391ccf968cc685ddba"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 260; - dataLen = 192; - combinedKey = "a74c21522d2fc8575d56aedc28f75c1d863401a576a9e6bb114cf5437b0843e5"; - iv = "b11709952a726aef4363663a9cb7de84"; - plainText = "74e725665519436f59b9ce6a813226650a6ed32921bed27c"; - cipherText = "d69875e881fcc4841865fed31d623e36f576bf7416759919"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 261; - dataLen = 192; - combinedKey = "754e034ef5a1a7daecb47b6d0adb386e1ffa9f253e0d0e859d35b1f08d812293"; - iv = "53ca1355e3d51814b318756dee865f63"; - plainText = "ccbd9c0579cda8455fb3aa2a0d8c6aa60dde3fc224c478ee"; - cipherText = "5d6c73280b0e07370a6c162c217781c522b679affc93c71e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 262; - dataLen = 192; - combinedKey = "8ec39e76a05d07405e5ebc0d1e8dcb0c12c3e9906d71132927d4b9265d577b71"; - iv = "3505382198f5e9ab011f3b0e861df633"; - plainText = "a53125b8d0b7c25fbedfb04b8bb5d82153b6de57c0b31edb"; - cipherText = "5ff7f2d4c722c8a228929013ae1e92af06b834b08b0b8d04"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 263; - dataLen = 192; - combinedKey = "e76226421749f0f793ba3beb05c8501de5c488f7fe6cfe2b3feca247e37d899d"; - iv = "5ae0dbe70fb112d24153accd8ecdefd2"; - plainText = "4ba61c42513be932b4cfd4c4e38ed4c3776a6132e5d5b7ea"; - cipherText = "6af72c4736ea63861f40c7258e89d72cb3ba1395f37ea025"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 264; - dataLen = 192; - combinedKey = "59a5a7e8297292df2697d823023a9d8446b2edf59a77d81e62a36846c737402c"; - iv = "6958af3b20f6aee0fcc62aae80506368"; - plainText = "f40765a38ad8eda342a08776a3d9d1d1876264e8330e2954"; - cipherText = "ad315bdbd64b6eb339b4bee2e8360381446ba1e2471bfaaf"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 265; - dataLen = 192; - combinedKey = "92a3e074db72e54902ca8cf5504fc46a63b583a5adb7b99f74d1fef051c3ed6a"; - iv = "ae0e5deb4bc9738b59eaba9b93a9e5fd"; - plainText = "38d15eb93b4b4e7956a0b17ec2d4d48db26d73348dd25935"; - cipherText = "8754232345522f4b592c0b42fd766ea0a8d5943fcb0186c8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 266; - dataLen = 192; - combinedKey = "e2abbafff6e5ecf3eedf5a36bd54a90a7294678f975271983bbc736038e9eb03"; - iv = "01c535c829628b39ff9f69ea30cf1653"; - plainText = "be55771576e9d661f0c2fc1478cbf81ecbae5643ca62493b"; - cipherText = "6cec891bf2d17e5372c5664d2085dd1d4de8ef489dfca2c8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 267; - dataLen = 192; - combinedKey = "ee7ea9b5f0e2ffe4ed9bae2f171121ba7163d4b2ae2ae442f0f4cb29920b9ee1"; - iv = "a1357f5351966bae3916e5ca4ace2040"; - plainText = "172539f3b1a195cccc6833713173700d2ff4e3f408203757"; - cipherText = "0af5cbc54e7c1fc276b9646ab474a2b33061e2c2e0e11f4f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 268; - dataLen = 192; - combinedKey = "5982b4a419a206bcc9201c392be22b60f4febf2ad1b7cb33968393a56f38f641"; - iv = "ef7319ae387ff4963d4580b5095899c9"; - plainText = "590d0acebfa088501227d51b59c9b2b19695bb89450107b8"; - cipherText = "f8eefa9d3ebcc70a028d172ff8a11ac9fbd6e68f79942054"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 269; - dataLen = 192; - combinedKey = "c161ec880ecf416d283896463c14acd8432d17e0bb0b28b0e961b5c4d48b18eb"; - iv = "8bc121db4d2e530e0bf9f6b771059ff7"; - plainText = "7aa7baebf96e2695055445c6fb64e9ab9bdcc0f2475b1ab6"; - cipherText = "7810261edba45688be33f87ddd09334ea5c51d8e8187b372"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 270; - dataLen = 192; - combinedKey = "50e4a004954ad740f4e9449e419ddf99df977ce956eaafa7d139e6c0a760d0b6"; - iv = "1386e16c78a1b63cc45779964dac59d2"; - plainText = "bad6de5f4c10b8391b86e169a94b75095d6011ba41d35616"; - cipherText = "44a56fada7887a9c11309d4f15b60f2086b6aad6f9af6fb6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 271; - dataLen = 192; - combinedKey = "672adfc4418ab5aca0b9aef6ac85bbc9a4f4d1701e67d844ebedf493430f712b"; - iv = "c80a9c7c80e563f68649f28100633efc"; - plainText = "8fcce65e3feb24f085f604cca1e7c6b709a4ffbf05e41b5f"; - cipherText = "a6e07ee9f1e3dae4adb3a28d69c8ac89f4fc620e6865620d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 272; - dataLen = 192; - combinedKey = "a7c2ee504cd4bb0b84b0399a7b85ec492e896ab9ae52ba3f06799aef9c8eeaf4"; - iv = "505191be00ee877f8aded6eb6d863bff"; - plainText = "3df7d778429a2f3fbee2e50aade8d4540678622860e04fb1"; - cipherText = "a0a1a7fb434487d0344aaee75020f82485cb266697606792"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 273; - dataLen = 192; - combinedKey = "ac8273705b9b948b713f511d0f380f96e61586874764053a4843fd6870fc7f37"; - iv = "536af19cd75c6eface2fb01a33a545a5"; - plainText = "e525895015718f71ee87dc8a60cb0cca2c63bb84efc7f9b2"; - cipherText = "71242b1e71b4d726871d1e050104465bb97742e00efde136"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 274; - dataLen = 192; - combinedKey = "abc99c4653a1ad75f50373166951f87e6b119f45ee8c98f129b79004398af844"; - iv = "b2687f07721671ed92ecb44ef09c2db3"; - plainText = "a5bc2bf156e1746b4704affc7339f8e3a6b787e52b8ee471"; - cipherText = "4c2dd14b495996698b5476fa94cde44b506bf054b4a4a63f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 275; - dataLen = 192; - combinedKey = "b47e98c44367332795e3a8fb725cb42c6372ec22f591a60456a7eb9922a93d26"; - iv = "d63df1ca8fa6ad10e592fa6aed70051f"; - plainText = "6aa116afb49827a3de11ee3e21b3afaf40dfd3c02cb52720"; - cipherText = "694341279e4e20c383a0d9b2fb69919b9231ded277cf160b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 276; - dataLen = 192; - combinedKey = "cfc73c32028663e260de49302228145594cdbc66550c6d4a4e21b24964c90e89"; - iv = "002aef62589f57e93b0d1a32ec178193"; - plainText = "8e43e11809e493a318ef3a98ff1f85d66d9bb1613b250334"; - cipherText = "2a254e09dae287364aa1bde30a805875ebaa7b8094b24e4d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 277; - dataLen = 192; - combinedKey = "4ee59c5c37d61a755bd4d305bf32771536930b208f353d4c423a6f8dbb5eca87"; - iv = "50594f7f6c06add1a4aee8b96589ec9c"; - plainText = "d596c504a65f5dc651f926d89b761f7b644095c3969f99a1"; - cipherText = "f807cdc23f9916c7ce88bb2447511a7591ab571a2fd0bfe2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 278; - dataLen = 192; - combinedKey = "3b601df82a93f7f88fe161a26b5d7ae32572e5ae8cfb0dfa93190eac99e74111"; - iv = "0b1ba26b8e74c0128f516ece51c5ea2f"; - plainText = "9d4b4339954de9fdbc4bdcb4b7ff4493eff049e079f75738"; - cipherText = "c1520a1404bc01e3d9afa7d84672e37c74a1b794da2ef156"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 279; - dataLen = 192; - combinedKey = "3fabd3370270910769d6dfc4ecba5b86cca84a9a167cde673ec4795b1e0a2758"; - iv = "c074acafadfc236fcaa62bec0d878911"; - plainText = "24c8b9b952b1cc9f1e8829bf43c0fcb9f57939e1a97bafa7"; - cipherText = "e0919ec788edf222896e24b04dafed729d790effe09f77c1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 280; - dataLen = 192; - combinedKey = "c9d06a81a355193e29ba49b893e021682cc6e5294c3cca2d1f34aeddb4643a61"; - iv = "5040847dd028fcd388b5d12998a1600f"; - plainText = "3c6d62fcd550679d24f1ecceab099a39168c8a8db6cf5a72"; - cipherText = "9ce83e974737845b95a6df55bc5d17a8455a613f0cc33484"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 281; - dataLen = 192; - combinedKey = "74ddca7f5b371cee11e1ae5b7e0ffd13caf97f30ed5c5c44391e8ba65752f338"; - iv = "dcb518f15b09aa4bc906291e4e1db422"; - plainText = "6d633684d8334aca001600a28b089bbea97ba619855dc925"; - cipherText = "191e8da0994d3d0960d1d090e1342b55281d4f6399a8d9aa"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 282; - dataLen = 192; - combinedKey = "04298fc4bea37160003adf498f1bc8f2fbe6c5454f7642c4a4dcc86cf781ade4"; - iv = "43c14419e232f327aaa88a612a11814b"; - plainText = "bad9d0de4afa7600f5d380351140632974dd8dbc34d155a0"; - cipherText = "485eb953a325697251f0b32374822bfb8d8f70206f2a2606"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 283; - dataLen = 192; - combinedKey = "88214fb598309bfb4d1bb22d5b442d248a8e2a07cf0a90d39bdc23854635ada5"; - iv = "d7fadc8b9493cc9f03cf2ed2b2c03478"; - plainText = "62accfbf5c5a178bbb6ecf124060eee3f985b2c5e89916f7"; - cipherText = "fd94e64e0ca7f87f6f10d5e4088da71066c49c065f542c39"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 284; - dataLen = 192; - combinedKey = "46885303da5cc733a7b1bd776c8129b5a4bb5ba0db28f4cfc0d25c35395416d0"; - iv = "ed955f6e5e2ee63fac8a7f6facf24dfc"; - plainText = "89f7e516bc869bf25f3e751f956061e8912e53ad0d9d8543"; - cipherText = "dcb1f7ee8231a27732725a92989c3fdf1fdf4aba4bcaee9c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 285; - dataLen = 192; - combinedKey = "b70f111000c670cb04ce89d63795a28584173495d16af2cfcc07774e9493f924"; - iv = "84a2bfd8fb29f28c86ab307dd676532c"; - plainText = "a029165375ff34493b1e898915b6790f3a79dc2ccf0adb96"; - cipherText = "137cba7f486038d0651aaf4991e79f1a6956916825c1caa9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 286; - dataLen = 192; - combinedKey = "53feb988c30c9f149816803f5cbf4b5939aa973242cec006577e76b2b2df3d24"; - iv = "0807a5be65b6b20b4ac91b9f6c09de04"; - plainText = "590337e3cee42f8bff8639fdd81879300fcaa00974836485"; - cipherText = "4856eeddcfc1fc40b6a266864a05aab8d915541890879d50"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 287; - dataLen = 192; - combinedKey = "694718f85dd85e327cff5cf51854fc30c787adce8de573698a076cbddd2a70d5"; - iv = "fef6bf2957967ed8aec1abb830a169ae"; - plainText = "5ee7d68d296b00b6f9b3c2b1157822b8fb867ba9491691c3"; - cipherText = "ff00b95423b7c16105eb81d037fadef5575e423f72f50a63"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 288; - dataLen = 192; - combinedKey = "978ea40886e79ad4d156c5f0d7006b09a21659a1007ace4552873ca92dba207e"; - iv = "82d2e6616a39ba906093a7909de03084"; - plainText = "5b1fdb5021aac75d3860dda19b438a65a2cee667c5b6a47d"; - cipherText = "b283a8429a209d824ce65d62da05a6274c4dffa1e23a5475"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 289; - dataLen = 192; - combinedKey = "a21832ff8c6d5310ea702f9f1c98fb2a85737d6bdfdb162417f37e225a6cb733"; - iv = "437fc74eaf80d456b90ab321ac86704b"; - plainText = "8040c4bb8d9e268871cb9a7fe0dc4feb00f88e5b83e2d518"; - cipherText = "c3a07f0306f1f9890412d221d633cc1b91230f12ffb0949e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 290; - dataLen = 192; - combinedKey = "08a38dad8f4c5c2ac97a9601341f3911a712b8b5ac259434357ae1d5d478f36a"; - iv = "7dec5ffefc14f5d31b1ce95ffda09b43"; - plainText = "5c1ecfb16b81d04386a0179da4adfb0f09cbb26dd2820fa5"; - cipherText = "b899083e1c2342e54f38aa635174a20da746b83a8ce07c2e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 291; - dataLen = 192; - combinedKey = "b21eb3c4253c88f6653ce8102860e570d748dc7ef5cf6f606fd289c746f71571"; - iv = "3ec99b802fcfd6562dceb70b8e0eee8c"; - plainText = "c42930210c6116a4b6b34324a514062b8d0487b5775cea40"; - cipherText = "16f68268ea6bce874b08c4890828acdb59791740a6dc07ce"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 292; - dataLen = 192; - combinedKey = "846fba38a117b22bfb84d0596471dd11503c8d5e7ba80b669a96655bea35b6e0"; - iv = "d8212784b3b77c9a663aef0858266899"; - plainText = "1966c23af2b2387ea7c4b70bdb00371f12412278a0b7c70d"; - cipherText = "e71f539b783407dd4983abe90a1068b394f0c15d43acdad8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 293; - dataLen = 192; - combinedKey = "f8bc88e83679dad11eb7e4afeb37d291aecd5578b56a6c2945a603cabc32bc13"; - iv = "f46a60052423ae39b10d7a459a11bc87"; - plainText = "fbc71eec2192d52f09bff2db10810cb9a40840d75ba0fd39"; - cipherText = "28460fef7eec76e056773e68277b13058096ca51763e51cb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 294; - dataLen = 192; - combinedKey = "57b4273325cd109e26304285e26e4d5361e0274488330c056b57c87ecc9624b3"; - iv = "3b908d77d4e7ca2af7617e67aa034b70"; - plainText = "2851ab889d3349575fb5345d63207d991c9dfc30887eada7"; - cipherText = "91e0874dd0357a3e43d753cf13b75cb8fe64b353de1c95eb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 295; - dataLen = 192; - combinedKey = "e0d7529f6e77a3a88725309da07be4891b48497653e3a58a15167eda911cda92"; - iv = "fdf2eb54938a3daa2419f6bb62e0c42d"; - plainText = "2dd6db0972fdf23ea927492785d86bb8a95611707682489f"; - cipherText = "66795f5b29cbaa74e16190336231c79f9e88e53c1d44aa4f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 296; - dataLen = 192; - combinedKey = "15dd3bc6ccd5bbcfbe5b0f8fffdbc86785190366888b8c1385f40854e86ba42d"; - iv = "ea67164de6b08cdb33debc9c4b5abc0a"; - plainText = "4ed7e1100463e67ca0ef177b282860c95f3df95c74cf0ea9"; - cipherText = "5c0f78416b809448b9da687d33b06b9971400c9ce7f53355"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 297; - dataLen = 192; - combinedKey = "0ec4ef2e750958a2b1bfd2f934a6ba4b1bf7a5e0f1135691a07dafdac38307c4"; - iv = "e29566668d501a6b5c598068534ef166"; - plainText = "3c3a470ab9b74c9a321edd055f347717d987f4a4c0ca521f"; - cipherText = "273724b9edbffe6f18255479ddafcfb38be6ca6f265b2f15"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 298; - dataLen = 192; - combinedKey = "c5669c3c55b602d4a396ea2e858963e24ff4f26b3d54f22628d436960f1f4bbb"; - iv = "53a7b5ab5b9d9637d86eedfc1c8381d4"; - plainText = "60ee0d601eee70a3f49314cdf751f003f17a9bc053af2fd9"; - cipherText = "c140a2422b1d16da0c88279755401490345e8518794f2d23"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 299; - dataLen = 192; - combinedKey = "775370f84eb869df06b5a2089bd779443c0b12524455d064d9d6c60b99c04424"; - iv = "6c45366eda54344b2f45e802cda36a48"; - plainText = "6aea3ec1cc8399cfb5254285fad19be0e2210c42fe018cca"; - cipherText = "7438cb679d0644f3ea5f8749d63a9b240b42e78ec1716736"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 300; - dataLen = 192; - combinedKey = "bb89e6108756e04339060dd642c842290c1a52cc416c3f60df7607e511fa79f0"; - iv = "6703f5dbe4af41c2dd4c82abe7c4dd6f"; - plainText = "144e50f2d6292e225a0baf8cb0aa3e4cb33359ced3572c15"; - cipherText = "1f17cc6968286c151dbf4aaab11c05105fcefcc7a8ae2979"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 301; - dataLen = 576; - combinedKey = "4f5ea01ac23120fd07d0494e0e395d420a14cd2043c0d3749dc783ac0c9122cd"; - iv = "010c3ae44f1140785f4b9e37304f03b7"; - plainText = "9ff385167b97be7a66783d3a9a9c631d3575839503e87fbda744ab8f7a32e1331df2490058c50f715abcd2214073565538a5f28c15894ac2a0f2665c307e08853133c00d2a02fd57"; - cipherText = "8f43529ef67cc5de025f306301dc379b785f097db95ffc5671d98c6da3a85347fd42efd679be3a602b2aad588143d7e4fbd371a87ce309a337761e0d4cf57533f46cdd34f0003bba"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 302; - dataLen = 576; - combinedKey = "78dee6a75cd5e0444d637316fde6f2fdceba1c5a9692cf3e569af8ffa15323d8"; - iv = "c17190d88f064914cd46215972f8223a"; - plainText = "68b457d0056c1d86804fbb5da40b786081279308c73de577632661fdb7f42d38347795919e5df5ce0b2d35fe9a195cd4cfef84a3ead7e992e15262408b1a07b1ea82a6a9a52028df"; - cipherText = "d2d7458ae2578162770b7391cb132ec962fc7d78b79b14ca537d3ec004bc58050dec70d0cc26e8eb1024ea8cc2a383ba93b306e81c9625de59e201dffa449ed54bcc298b478dde4f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 303; - dataLen = 576; - combinedKey = "92df22e03a41f4abf00b37137fff7631370e2f4924708fb7d1b5ed6fc869af0f"; - iv = "20bc327c12ae85090b103cc99a07b3c3"; - plainText = "5df90e16c440180e58a931541d771fe2e5117ff9228e1d678c729680f30958f795f3fe148149541484f187eccca970d9a39d19c76154be8c6b5d2220ec4fe437f0daccde0b05f082"; - cipherText = "4c57a6409d69a359d2fb43aea8ad09c87f10abf5517b9bd8f141921fb6cb95bee3b64c865f885181c078e37a08aff35a066060764237de79025e181433f52ea38c5d468db22e9ac0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 304; - dataLen = 576; - combinedKey = "fd5492006b8891d333963163246897a8ec225528d2114d35e4468ec704e67969"; - iv = "5c9836986eaac8bfb0d195e4203e7bd9"; - plainText = "0fbe3c7691516914c8fa67a21b611bb70df44a7434ebe9098e5d6d091fbdd91160645c985bd1f9eec2a394df785e05210ed5d8a0bea2a374acc8e263f42c0857c5acfd2d6edcfb0b"; - cipherText = "083966bc5a7e07d1450450c88d9f6e46a752f194005f5032c1f14e3ba1098e0987dba2bc467346f17c19db09e83d39d4ad6e6772c7266b393a4b12f941e5b31f85cddd3af5ac977f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 305; - dataLen = 576; - combinedKey = "e50840ec8f8cf588901966914c3f9286890c23c15a681db1246eca2b7b353518"; - iv = "18a0adb32c86c294b45e10d8460a25e1"; - plainText = "99b7233d25bc5464f61b8478ce0fde93cde99f1afe8a66ebadf6a0147406e0d818ce90cdbe77cfb64d31e0c41ce6ae5389b7f6ce2599c6245afc0e1fc0d32eaaadc1aa5f50ab7714"; - cipherText = "5e199949fc5c362387a514889d66be0a5e3d569f57025077579a168d89922c7946a2882e3c05996a1a30f3211805ca507c2078f20953177489e3d21ea84036b1ff241ba1fe8a05a9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 306; - dataLen = 576; - combinedKey = "d062354708ff28a89fea1ac431c93ec1bd3665e85f9f186d4b6b0bf32ec5de59"; - iv = "f42df1c0faed7e7f1c20c1416941afc4"; - plainText = "e0dd1a0dcc44ef74a97af533048af70527a1f0bf5623e3a3738109a65dbbfe1d163e930eb129a7e893bcf46f1c9f9a83ccdf7fc3b15f3d30bc2a37dad1418a31196fd4ecd1b86103"; - cipherText = "78c048a20b473410fba0006749be273f37c42bec661e2718f44ef0d3de55b3b74017f7877d62c6d9f0bdabc393ff5590d864245aa62f33e71692d23efadcc3d2b301946d3fe6ad37"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 307; - dataLen = 576; - combinedKey = "f94bf9199c2fd409241b4867c9616f0393ae91e613c9e75db3d542ffb60811e7"; - iv = "b8425eed3cc5b7ab272ee965eccc46f5"; - plainText = "c9301b6768dee7268d2ff23586e89a2bfd15f4e869d1b24f3322653ff8e93c012d9eeaa31edd0a167a0d8e6d724a84b3bb73f4accf22e933742ee50328f694c641032ad6be30b4e2"; - cipherText = "7c714f75b7edb36d1cd9134bb20034ea7bf82e04912a946d8091ee404bc4cb64da4b4bd9e4db15a33b885f51b64d22eca36724b92c7ff76c08a87aee3b0a5cf7a0d1cf60a450c595"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 308; - dataLen = 576; - combinedKey = "5a884bc3e0803388803a6a81111f5668fb4194b115b050238f665798e368b4c6"; - iv = "e3812527de170f8c973b514cff8c7a3c"; - plainText = "8f2464bab88b941efd3d5295e51e3ee5f4246716abbbd868183439a29d6b36a65f6f789ce924d2d3613235cd6d2c618c08ea8ff74f3f971a501f5088e0d2eae50fbe140a5f2d8df4"; - cipherText = "ff6058f83f32411a0cf88a0e0d2e9b387a889a0915dbfc51512a52375f85e5d75881a7ab1f4b356a809bd0fc0e62e26affdfa0f628d14c1a0c42d72f2a0292a3b19ddd77235f5f81"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 309; - dataLen = 576; - combinedKey = "116c72e4af91a8f1cce7eebc772a712b7ef58eee49f3c1d01c94d07227366665"; - iv = "23b0ebb89af01002b84039bf248aafc6"; - plainText = "d0d9d7c9e91a69148df12619889fda51407121a90bef151ed4db00a82a342858c6437b3b82d916890f27d4ad92f042d3cc94a2bb29083198735de1c2658447e93044869e895b5557"; - cipherText = "734744df1aa767b440fa1f55021cdaf11380f2848fd6f685a4acb6b62ca879c54472c58bb3534655f7e549e873ab4d2d2922757dd9015ab8a11472c77cff3e38173428f96b3342bd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 310; - dataLen = 576; - combinedKey = "3dc513adc70a8bc420156facfa7ea56a891a47c005c59f747747a5c8191041f4"; - iv = "87234f6483a299b34985a608218580b2"; - plainText = "4cb9048ee8dca2935a6ee4815c183c26bc4ccf73c0505724677ab4b4e4955de770e6bcd6dc96fa82a41b70302ad4a1d7c9e0ad950279cf15fbafebdc9d54afe439aaf1af6dbae465"; - cipherText = "9197a1bfe557852e4bb69d0f00b75c62bae9f2155dd1869dd721eaf0f82ef4eba387feb2a818845987cfc63d6b65b5c28faabc86595762f9050f0dd4e3bef363fb937a580c183cc4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 311; - dataLen = 576; - combinedKey = "a2be8628e22fcdc8248d18cdb89d867484b592f83a80a559af172a51107e5f24"; - iv = "551e423e4caad7ea2428a84e639fb70d"; - plainText = "782ed2aef970312199e3c9d368435981458f1a35eaf6e50586143a24afc024b338470b3e23c6c7d3c1edd86f01d577fc29a277d078ceac06d662d143571998564917c08195a05314"; - cipherText = "0b85212932badefde17179c81098eebe4ecd01a921133b6daca8364b48866c0030e5c35c4981b3610ca8a6167a8f62981d8c79fdfd8fba18ca0696d1e7b9d01ae61a8b76f6c1ed86"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 312; - dataLen = 576; - combinedKey = "2361677bcfe9e6ec35a708e1985ea7cc18bf02de06a0340d8bcdfd76fca171fe"; - iv = "3596b0fbd4410ebc34f3addce0acd0f9"; - plainText = "abfc00da8625472ebca1f95056de9c32085aa44dd3738f1e30037fa48f51f61589cc295300ef21840fb8dd8b9f5491985d53cb44574343f5997567a0057d7f8226642a0a0bb0dec6"; - cipherText = "fd56b3b4067029289a08b6d763f8d3754f5775b5f28be5bc8e6d51a7090314382ff527d311753e9476f04d01e8ce97cf82256ba9961531d547fc80e63cbcc256fc3627205ebfeab8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 313; - dataLen = 576; - combinedKey = "5eef3e1a3b4fbb552d187800e35a6b69dc5768914afb142b4ca5d43521cd03ee"; - iv = "f2da0ee1f3ea4f8e65553fe4aa3db479"; - plainText = "6faea810fa613ead15899825b745ada9c4f7037b9aca4b5d862b84c0bd3a0ac50f36e86680bef25772455fd7efa932d38eda1d42c6cb144c71a0b6f84a68a9468bad55831fd40b34"; - cipherText = "7a71edb37ef0070fead75c5e41e223b5c3fbdcae21924ac3b8384ae292fd33553849862b49e5045247e71f4a4159e8b5edfa3a347bb16ca118e0e9e9992d2bf6ef6d4416ff278842"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 314; - dataLen = 576; - combinedKey = "bfbfe981ff957bffbc4682e22c22d8d6412447579bb9ba4bdf0d9c879d1e1d17"; - iv = "068f9da2552bcf2d712406531b2a2ae0"; - plainText = "cabc637a64b054976330d1ad373d819bc5b9be5ea90c88a060c06c3578f3549f3895abc251fac031a3f0e4be9b7fa62b7ee9f72abefb00a2d0ba5f4b3759de1b2327ea965490e159"; - cipherText = "a55d0f50c12633c8291e0b59443ffdfdbc98b9c3aae6b58fae2e4041e4513aaea8e8b6ee60a987b1db1b7332646182ac26e9e9495c5647cf8da721685a530bb1dcec87e1a2a20537"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 315; - dataLen = 576; - combinedKey = "d2aae8dfd134023d4af3c87496a1e6c476bb46a9ffa50dd2c7f3eda3e30d6de2"; - iv = "1eabf1d099d8264073af0f6aade42eaf"; - plainText = "83abec4ea35d305e1d634e3b2fd680e7322fe05da3ab52005e1489aa3c93a4c459fe7f7b771807482df4b97e52dab75419ccac3dd08355d209584080e0804f2ca0ab9c000c2c84a4"; - cipherText = "c31eca980a5a23457f21f5ef41501c64e2ccca8ae5309bf445f56e7a588d80bc8e00ce66e12bd6c8319481952cd20c6e6bf2524a5d4cc886de82d20f896656ab56bd63d40b44f956"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 316; - dataLen = 576; - combinedKey = "39a9b5c74526b6314735a1dc16706897d0fbe23ba76f088b766661d271988998"; - iv = "e3ebbd8ab48996007256d9789e15bd68"; - plainText = "4603b9384eda5a3134468ce985403e35aeed85b3675776c4f4b6d7e9b1e624f0370835f1cde45489d6f3d2219458b03103fb0d264f3e623b06fae194a506117ffe045de923a864f6"; - cipherText = "427fff890cfae5c5069a1df38a14a94bc89dae71abeddf0a72de7e67793f23f5fc8055086c1f391f71cc945dce68ce0cd8f4a6c519f6968572ba5c39b15a041bc85aa4e56eae198d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 317; - dataLen = 576; - combinedKey = "1c61f6af52b4196feceec1c23476058e2fdb16064437134facb8b8d09e2f122c"; - iv = "3fc7211d288a726a48a62e87a2d463dc"; - plainText = "68626660cdb444e1bc873a019c65739d40d770cc3b0b64c7a61f3ec970cf06828252fdab0270b5dc238eeb914966a41da9f77020eb7aea8dc3882cf967de67eda91f3500ddf68472"; - cipherText = "62ab0b70a2183f0e2f7d7c9a78c93279e4b539bcb8234b03273bcb0ec52aed5e6f2445f250873e2ca54edc2932c2d7b1012e343cf4e243c003ad434b48aa1a90f49e054c12345b0a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 318; - dataLen = 576; - combinedKey = "b019486656f331fc3f5a9a35faf93b57521072f2bca4ad7f4014a888420a28ad"; - iv = "88e0e9f8bc5e53a5d8ed4fd7496c71ee"; - plainText = "bcc00bdbf525ef48ff0dccd78b3393de252e0724b4d2f42b9007778dcddae7530f9384df6a5ce5c268dcf861a1928a27ce117f1cab47b7d42657f4f264ec1b73f6469fb33655f233"; - cipherText = "908eeed952bbce591280c4ce701814c77486780beb99c4da49659d3772b1e27a3495b5526f1bf0a6bc12087c491f13d301464b27d4e47dcc7306b6e9740213730a49a68a110364fb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 319; - dataLen = 576; - combinedKey = "59ff4232505c6f5c6dcf6b80aee1d6621a674f16bd82dc9a8f26a17f16513bd6"; - iv = "822c794d99db4e588604adde02ae811d"; - plainText = "58615e3ca717aa49fde838f843d58e14d7f696ac8aea179989e10f6bd0cd9ec29dcdb757109e232a65c5903f2c252cd691128c8fa8cdbe42e8e53dfe4650e51607adff61aa42573f"; - cipherText = "c94b201698a88002d846b878f9e97b33f5ca0b273d6a273433a27e2f85be0a86540abc602e78c7908de717a81353b993f58febaf2942dbe6cc7c8f7920f0f73b4a0b16048c8789e8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 320; - dataLen = 576; - combinedKey = "57341022f4245ef0a0e1bc542df68975d2ab7ff6d91a8332901dca4b0040a26e"; - iv = "83408dd9f3c5865805f5870f03fa1df2"; - plainText = "97ee791349f08c6810ce2582f77518b48de1b01bb5c51ce5a1eccaa5baee924dfb5fa2f8f05808229ba117019abf51ba917ab4543e94e93d2bb822d6aa33e1cf24f631c10ac7eb54"; - cipherText = "1670ee14cba05c25573a062e019742a33ff1a7286c1326b6ea698d4fb7c62e8c9e3a06098e07e28b95a579f3193d7b47d5c8bc62f56eb4195855fd180fdc22042f1ea6d89e0e4ce0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 321; - dataLen = 576; - combinedKey = "f8d2899f35671d41ba261990a7d78722f6bf7a29a25d57c10f2b55e4d2c26adb"; - iv = "093d22f99aa8bc268c9ad7cccc98233a"; - plainText = "d1dec73593c36b9750553f4275e5acf395d66f2536e27909605c25e74070aab9198b288dbb8eecb18f0b88c46d33012098cdb45554503fbd437ebab7857e00539b72e3218042d006"; - cipherText = "1a0fa3472d11702c22c1fb468c14dcc8ce3c60ff31ca20b8250536dd8adba7673ab961550c49909abf6c56f824ae0dc069daa705029cef97fed4f83dac784b70465bcf648b91a3f3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 322; - dataLen = 576; - combinedKey = "17ec16ac72683144fbc30a22b5be83775f50289aa041013782ad400ec8a88688"; - iv = "50e8774c65e1618f5f50f148dda2a447"; - plainText = "b7434bcb325876252c5751da25bdf9676ec784b128e83967efe1ccd01ff1d5d94f6f4642095f4ddc3755a409fbb6e31c33b6f094ee253b73aae3f3bb094dadc3dd9286fd5fbb17bd"; - cipherText = "9c3c769683b7e7ea2a51fc7851a70d38e89bb94573458e65484e5ace6ff25fff18ce1f62cf1553ef9090c93648098c4cb70a2bf898835176581e2e7ae79a7a79cbb28734c1aa24ed"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 323; - dataLen = 576; - combinedKey = "a174aeea7c7aee4c3a38eccbb185f50e207edea8f9b214d177765f1b92c4eba3"; - iv = "04356ea681b370e867ff4350b831e11b"; - plainText = "fa76757d36b99c9ef234fad419620238bba91460343c111aec7c182c3ae59c9964c5ee4b133a0692718f308bec97947b58a71ac4b988776153e27cb8b8aa3a372c31aaeb39bab4ab"; - cipherText = "f743b17808f9d3fda6f507099223151582e338a27f4d884a0c7d2744a9522de0731b39991782e7f1828b451c406aae1b73cba0eecfef990116be787080097f5fe11f195ceec59496"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 324; - dataLen = 576; - combinedKey = "274abcbf08b5d47e52d86fb7802231272c5526fd3c293262e37df5df0424b77c"; - iv = "25604c8d5414026a6e2c7d303a98d2f2"; - plainText = "eff7ffed44fa1a3b236723fd7bd1bc1eb24859781110359b19b321411315b2df8775b031539e62b71d1a5d198593b93893e036bd92bdaf50c0f1587c4fb9ebb9fc65bca0e1e9b8b3"; - cipherText = "f77223ce5cdf33b4edf3c594d1f31fc648fc7b666651d1253e74ec5b12c593a9adef408c8540be179dd4e9d9d32e0879ee09f29a27204e6a95f8267ae9aee1259f2160359215d50f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 325; - dataLen = 576; - combinedKey = "6d8e9f9dba77490489aea7c602cb535d74726f07c176037473023b203e901edc"; - iv = "31855890540fdd9fac974f9de05a3025"; - plainText = "1142d175dfeb759e8ddc4d01032fd923f135fc0e7f0352d610696bbb438e1bc195ee8ab7fb649784d960d35c904031efd8c12e925db006c36d03de2c21c67264af921b07a29af7b2"; - cipherText = "6236d8fa0281decde5f74075cd8e45a920d15c3150ad10fce129e753217cc1fa8be30a66916d7e5f5c5b613c56a3417bdfa01511329cc68f2fc0775f233370a1c8f4a422dbdf72f8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 326; - dataLen = 576; - combinedKey = "2ddeacdde13574b269137de0cc713af34275e82dbd1b3f657a9d27bc5e1e9e8f"; - iv = "9eafe2b6aed2f10ae9b08aff5bd43121"; - plainText = "3edca2fac0bef7eabd4f2b87a5e54cdf1830643b9149edee4eee1dc6c4d0fff38e5a5553c6996b6072bbcce6b6a0423fce8a95e3a889d613f34903b91414cfd215d13d806b4499e8"; - cipherText = "7d826c0c87b5ed24b213f114d4fbc97f284cdc8103caca9c33a0e37d432f32af91ded655d07656043d80aefcec4f43611896d5ca954b00595411daf03be0f28a946e9ad1ce389334"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 327; - dataLen = 576; - combinedKey = "e5cfa31f408a198a552055a81f7b46645dcb43a01172009cb7ea23e58d01d873"; - iv = "cd04dae79b36bd850587645005d079fb"; - plainText = "8edf7214aaa56d6ca4b95b82c42f7a309c98c7b2690b83c2d8485da839a42c02a645556d399d4bc5cc7d8bed856cc2bc3323356a408135f929dcafc3d9724af223c30f8359df35e9"; - cipherText = "cc16b3aec7ea425de420a1be3a3981169c70f0468af2c3fd2db484bb0f82e8d0caef7835d97ac2db5f8a98c9eb4ebb064e9458e81e19217dbf77343330ba04a95252da03b8ecca7d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 328; - dataLen = 576; - combinedKey = "99c8c7753da988b27e44efbce638769f5b63866393dcccb95c0df6ca80eaf321"; - iv = "6efe2740345ceb51669dc39c92b20387"; - plainText = "6dfdff728f2933c7984423046ee3047cabe41f5fab881dc69c684182f154129f9a6aaf1437c28c282167277404b9daf7f82e03950bc7bfcf8f74ab194b01e401033cb3663f24a29d"; - cipherText = "b18f6598ef4a95b88b2b27becab6eb157946b5b3947cc585f02b3dc87671515064dfee802e15ca2a7cfc9031af78b17250d8790dc45f84c4259e667a061b4ee5ac401a26f51d29b5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 329; - dataLen = 576; - combinedKey = "19daf6b36621e584cad0c9d8d82cbc09ba0ab7b87dcc503dd63469555bf338c0"; - iv = "2c61a840cd1eaba11ce08cc33d686b1a"; - plainText = "0d9df5a391bc61ba81a6999d1f5d21aa587f41415a366b4aa40ceaf93485b586658efe4ebb9a270357a58b32cfd97e29d18865e15b7abae52ecfe4b4de2460198feeec02cc9c3633"; - cipherText = "64ed99281c0aebbd6c6f5884ad9796c7278a0b2028a93fdf817e3ff30197039cbe55b4cc6bc026eed5c9450622c3bd971379083169eb6f39a74ec1f9e010736db84bd10c1d946866"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 330; - dataLen = 576; - combinedKey = "7eec9786c049d89c8dde9d58007fe742758f0f04fdcf1985cd07f4c17ebdcedb"; - iv = "4d67f16c9ccab19db623a6f9c9e1251e"; - plainText = "812f9952dbb520acb47ed1e211991b2923a699436ebf710f40dbba5875ccb5f96942a4a46a9ba36da8cc5d86125b7137e78e3f07c8431c480bf3898ad86056113ae3e7125ab00030"; - cipherText = "3d49d59fdac533dde6ee1d767ec011dbac466cbd6fa5a1594703685f4e29812f9b957c1631ab43c60802de5f05bb796ceca51245f3d9180b29bf5753632f10f4aa0912856138371f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 331; - dataLen = 576; - combinedKey = "3cd34568498f6bfb1b91cc8cf6747a39a2b04d8f3f4f731ff7210bafa1bf00cb"; - iv = "ee95da77a88f2dd206f01f447d26a2d0"; - plainText = "1660393812c7c6b5b2b2e78fb4b6d7ab86ef7bb99a516f0c01c9f50ebcac870825af48ebf97719e23cd69988a6a35922dc160c03659c56e3e59dfd39afb263f5a384357b5aaeb0cd"; - cipherText = "f0f32363f3d29200e1b8b4cb903cc3b9a7f7f7a34925e18c6c2d7cee9687b462bc0b1ee72398cb200203717be59c5bc016146b03ac99f7b6485d4cdddbe379629ca72f3f174bc8cb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 332; - dataLen = 576; - combinedKey = "5be9b8709c66e41198066e25a4defa260d2c199b45fd84babdc936275b8c17dc"; - iv = "f0a8fe41d270dd19548458d3b5a3dbe4"; - plainText = "066df3a98b8ea09cd7c2cbc025734c2e9a0b639905febfc350a321b1e788a81c541eaa5bda5a7ff9ab0d2737b96d894c71806eb5cd1b8b2c62401005078a4267f162bb2a41604510"; - cipherText = "415e189ad8a92069fdd3f7b53fe3fe6058ccef7e9c7e5fc99cee28d49af23de39d1c8bcbe0a0a1dcb3f9db49a746f03532f5aa9969cfedc817d4c2c7687393f9a12997bde5f2c0fa"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 333; - dataLen = 576; - combinedKey = "5cb89453baca650f6aa6d11ea5a441d126109be5e9c0971b8fb2781e7f053b0b"; - iv = "de93053d96b192ecb917bc497c8ef78c"; - plainText = "2927e6a29b6ae771de7169c813702d24d603f7fbff8b7898c71f8547a71dda8bb2830fb80b9bef59e6abda5231559513b444f8a7c563c596491e3391834816c8be9058e2fb120276"; - cipherText = "b0af55295f0d383d24418856897b66c400a8475f705da935c5c4b3c9949ce79ed2ee0af657afcda9de3affbf56d4aefd8b5ced0b9fe80886db02d02f16bcb7b208e49b453d12ebdb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 334; - dataLen = 576; - combinedKey = "b4f41291870a357a73572692747de99d40a2bd61d23218b0eecc5897f7beae72"; - iv = "a0f450b3ea356fd43bd25026e692ef91"; - plainText = "a4e934d6d18d07969b4c9c50004d405ad8a8e3430d6af306e990754954f5e48d29aec432ff0afab73a694e644db90876340bdc129e1cc18754d151fdf7351fe13385c6c349dbb9cc"; - cipherText = "b7d605705a5a6e7285120867cd88104bf8f14069d489b8b5b7ec0723ee4f4de6c2a43a591781ce366d0f5b1c92f6d37c755766cbddd5064be8bfcd4e06d65a5e455f1a4e2bf41d39"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 335; - dataLen = 576; - combinedKey = "fa7a0e9972e0da08f3889d145756c973a4b278bf380568020af57743cf6c5cb7"; - iv = "95b1cb65297354fcb49c372983cf29d7"; - plainText = "eff218fcd33a3f2dcf8a836c6affc95f280b28efbf22c020e285ef359c6204d761d37ee239cb7238823158e0fe94ec351de0b5a0facd9953f4e90533180fdb1f2ecdb8021bb214d1"; - cipherText = "2549a0af1c4ab82eb08029637ce0585cfed57bd0a41e53b08a69a8a52c5b77d04ab5e4a49ad5854524c010bbed1e057179a77607cc4aced014b691518d0c5f947c2297197b6dfea2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 336; - dataLen = 576; - combinedKey = "907afb28d0dc90edda42163c7d8767f8bac4d5179a844796ce878f655a58524b"; - iv = "73158a059ad044905fbf18df21bb8369"; - plainText = "d3aafaeac2581b14b1470e19437173adebdc7444cfa131a2acec3a86a92e51c0a43df2e65eaf36c673eb15c1b797692153c25896a57466473de01218eaa7cb9e9f57840231754309"; - cipherText = "6cbb50219e814e8e7fe60f75a456cbf09856f49cbb820689748f0ebad3d20072f92a105263bf417990ff03db97658d04c87fab42996d8e08cc4ba6dcf6a553170a0596425a0e8244"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 337; - dataLen = 576; - combinedKey = "6038d4827490c58c6b8cbcea6beaef3db246da7b6b112b6239aabab17048e808"; - iv = "263ba18258c9993b27fed5131e8b82ec"; - plainText = "3a91677a03499b43de2a0c1b7b195535db9752e5efd27b661fb5564c62ecc426f70a72a327fb6a78b71b533b92f2b8f69d360fd553451c10f134319d7bbc9717188de9d99a5e3982"; - cipherText = "437b156f5928927fc716fa4d31bfb5ed35f8afae7478f0dd7f068531920876b37cd141211b440030ae2bd95cf9587ad97b4558871dfd4ad6e4d58e9e3e8614a2a75d58bc59049558"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 338; - dataLen = 576; - combinedKey = "875308694fb0f5a8930e3bf8a84faa90da67c2f18a8f62748c1fd947b9707373"; - iv = "42b1398e747745d7944764d73ebb7dad"; - plainText = "66198f2058aafb96080e6762c19a23f2c7cb9db6e9280dd4176edbfd1189e3422a5f3ddbfe4e9bc7a062bc242b11055a11abb872f9fcdc9961b658e0e8dd2c1633d3cb7b764f13b5"; - cipherText = "a585effb12dd35707f0a41c046df48492618cfe39e1c6031d026ff5d2a127f98530ab73b53b9c0f5bc2f838f967eecd8832bc602076f5521ff01d2d50c36d63d871a31dfd83b31c6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 339; - dataLen = 576; - combinedKey = "dd495e3d9b52b2d9763df08dd4bb947f35b1233f211efa94ab1304fef4a2ba04"; - iv = "321ca4607dd72e8ee2449db1fbf9a472"; - plainText = "50d17ee0fec807f1e6bb6db75f095dd4d6b37189b3c6c91748884d70b7e2c15b9a17231977cfd62fd32bfb800261e3a10ab5d5f58310a833ccc17c889c25eb31d8717d2a1f0a9408"; - cipherText = "33ee1c12c376d37c92faf38f102f5bb985b2163daedba53aab6cb66ecbd09ae426cb2f858404dfc43e0d0e5a208d98d5b9484da60f01eb479c5d9d0866ecdb1829ad89a90caf4fec"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 340; - dataLen = 576; - combinedKey = "a248c38a378944343128c6ac7c7929669c788eb8e94deee2419cc74b4c18e9e5"; - iv = "1518aaf329f57e350ed4f27e307582ba"; - plainText = "5d0073b99911c55374ebb546636bec67877f1ab14fd365665bc09db380c8b8a29596164a1ba1e60cf984cbb28326162809ebd6cebbfe13b48b4c4fe86ba1776c588f1a086d3399c5"; - cipherText = "f79d61d04cb3069218864800d83527b5733433d8cb3a173a119d8669a3220d817d3ea213acbd57a44cd8aeb6abffa9b1116006ebbd1c1522dd7e286d83b5e8eba34be38f3f129f92"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 341; - dataLen = 576; - combinedKey = "d6210dabcefc57111b5adf9351ae52bd7d776ea5147dd48b8f6a420fffea7dbb"; - iv = "1f735b21d45e10f8a28d93436ec6a54a"; - plainText = "f5073c457dccb9578ed1cf6aefa247967ec01bd1a2eae06f1ec1a3f6f7a0a2c20e6424b1c4abc5dbc2218bfea054f3098fb5a1c3bd97affb7506897367dc05601d2952b507e3d2b4"; - cipherText = "420a680adb78a523f6167f57d162f749a368f2df0a49c21721abbea1f06e9d4ed7b416ff05e6fa750dfb2e8966d83e250b00fd9577965ebfeee8ae290d0d1789da9542edbe8423f7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 342; - dataLen = 576; - combinedKey = "7fea0972af79094d08bb682406f52d4ea1741aef229a5dd490d49638f92ea88d"; - iv = "e6ec98d0cd55ed82cca2914fc83cb896"; - plainText = "ce43194e7dd06db25041edda0ac94a11869763a2b4ab23ee75ca77c6a8819621dd4a99d2acf68e1fedd7c1de26b0298df54847b1e6c774bf333e6ca8b1e62c77c915127cd95f27e7"; - cipherText = "67cdc158dce60094deb2d087526716832528e17b8b0ef419205104fcfbb3a40bd98facef51eef5dd209f8c5a642bd2a698861144e845109e1612e06dc5f2eb751c98095f5708f761"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 343; - dataLen = 576; - combinedKey = "912ae3cb364917f4b79bb56e338b90cf37cded3cf248068d7f46cc92dfa09d93"; - iv = "fed073bf57ed6eb9605a8328b304628d"; - plainText = "0459d719daae4be50c83306accc1cd371b1be4f25fbca999c999f9dd350c60169114071dcf03ecaa4fe8ef6c5093fb26389f37dbcb16c079ee4d9686e5836afcedb72d6d078529dd"; - cipherText = "83724b429c769d7d261ffba47fae4af2a9129716eb3661291d69a5816947ad2cadd4e9a871525fe6e3e5687c3fafd762ee5db2ada776c6ff79065912073565b6ca171d831e08714f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 344; - dataLen = 576; - combinedKey = "2fac207ab12e8590d7f778d59e15f6d68b7761df6504ba5157a86c09bcdc208a"; - iv = "91730a6c9c71e0e423e5129196ab92d0"; - plainText = "b688dfbf65be34078e019243c1ba80ef148b7df247955f80faf291f7b38fc79fb0a3e07b50c1abe0c4342aee4aca9ab39f4ebc2a37782d3b3d22027c33f107896e018f08648a4ae6"; - cipherText = "9ac799ab29d9b414b76306ea885e39aa4f6f24c236a9c3d7f7bd5ff6c3bca5d76f8cf0055a31f7cc84174650f9b19437fa1c192ee3a81a1114fb2accd50c0c62c753a21f6c4ff44c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 345; - dataLen = 576; - combinedKey = "5f7dcc600c3e92e50630390d10a9bd984a86a9f4f095cbb09860836c2c0bb3ee"; - iv = "ff4e555e13f15a6e56fa352795caf435"; - plainText = "6574b4d5525a2c80393ea2d63e287e2f77d643a29f543e047c50b423e6ecb6e596b700ade103ae2eca1e4c52058603c6fa9a5b75268932ec3ea40214987178fa4eefbd277c6837cf"; - cipherText = "981354c645bfb2f6bc09c0e966b2cb6d4fe757abc30916029e8ef49c6197687b56a5ad5edbfe17c97bd74cc7bdb041cffb5d447f6adec45ead7d2f74d2c2381ed2733655b231fee8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 346; - dataLen = 576; - combinedKey = "99f6a5249a44580cdcd0fd93f3a5cb528f2e50e6cc3edec4466cc49dc5bf9774"; - iv = "e932057a4b8df99de4c5a4ea17f2447c"; - plainText = "43831c1f0542e5a0e0f003e74887c5dccb8a57fa91714461e0ccd248993bdf7c04b1cca015b10220866279d02b01da31fcd98496e5ee766c9761829679f802b886f5ec40053c97c9"; - cipherText = "4ba5695e397c6f21ee82fc30e07825f52e854fcba14c30a3a738c1e8cabd2c95c0eb3a60498943906ca8fbdc27ae5fe6cc61bb6c59e82730420769afaece377ce23a44cb24636492"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 347; - dataLen = 576; - combinedKey = "f44c424531dd4f5551205c9daf042f610797100f5c79fb445fa43a18733de966"; - iv = "0e9fa39fa0f68955e0e21ddf9bfc47f5"; - plainText = "18247a0a43a79d0538cb98e76bb937ba55cdd255e00c86dde009b647be622641adf1b940c36120282ebe5fd86ad2f08cf0c10b790a0aa3cfb7e2078de791f4b6ad0bc909ba8328fa"; - cipherText = "353c6c78bf4b49cb785c8b5feb817300b305a0226aaf69d0198f74b84b5646a8e3d0883f8577f36ad9c48d7c7c9d98635d5b3aff83f2235a614fd3b7e6cfee17f028359c0d7de421"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 348; - dataLen = 576; - combinedKey = "a906271c57c5eb705ee0ff4bb2ce99c294b59964db17190abf904a86368a9a9e"; - iv = "42f611ffdface3338b32d88469b646ae"; - plainText = "0d05188676e6f0d678bffbd54061fc5a624c52c0c49351ae94d9b7a11fae89c0d4fd2f612d44dc143a798fb0359dd566c929ca641b7a6e2b44a30c7b8ec3497c489a9f1c98555770"; - cipherText = "71a2141d23adb12129cd9477b13f164ba14844f342f6a95174421f87136c50656711ed9152d6ebe8a17acb8a45c74d84572fbb9ce7d88297cd9462f7fd8389f14d7c45eb19eaf5e1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 349; - dataLen = 576; - combinedKey = "83a212964411ba3183cdcb24a7411ff5812608053ac84a962dbfc41e43bcbd1d"; - iv = "c46cc2105a920199153a912045f833d8"; - plainText = "a5c5316303f45b978dbf24433690ac43cd2dcb1bd11686fb1228ad6e87610566f6f9356a944c20bf92271aaf0e743dd30152046e592c69aaa6a351d728a92071e0301100d778f589"; - cipherText = "7786a8511236ec83b300d41bae7d27b4fa211f920c1f368247ede63aaf5064726a9df413ee303851e3fe553725717150cb93ec5d07833335f7cac22ec21887a76415ba445a100cf3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 350; - dataLen = 576; - combinedKey = "0c07fcef97015f2b4f76ef6e0a31e2c5b68767a86856e3e5f49ff3857d1f307d"; - iv = "9d620524c8f26d03c056bd828462bb5d"; - plainText = "244edf56d42b2f718458a883c06cc929c7ac3dfeb0f9ea3175fce716d7cf32dc14b1419e46fe0be62583f4ae906b3f54972da57470c3b0aadeb44b088ee19bc08de729ef4ebfffec"; - cipherText = "b3198ae5723ec031564028e5fb2d5161c76c5a7aa17ecbcde62b81cae1ca30d328a0bdb616d7d3bee4b119f8014dedbf942d8cbe3ec41a84026e8fc8fc00a3ae79162f8355451101"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 351; - dataLen = 576; - combinedKey = "f6f6c720caf8dbc7c8db4b84fa1419ece419b43ead8619e546d665c6e4a938b6"; - iv = "0b9266470dadf5b8b0278b4004ea5c99"; - plainText = "57479cf5ded62f3674fb506e2b036a34ca6cffe0c4f2e72cd387ed688f63daaba8673fe273bb386bdc2a0ddc975781ef97f54fb8f368ef12620b4a7bbecba969f015db9b3754f09d"; - cipherText = "efe05ff4ab043455d91ce02f4d52b9ee73a50cb3d8ea8c18fd5e7686894d3fd950af0461a8c345479c9adcdca944960f41681e1a27d4ca579f99804fd5be29bfd8455fdce647c23e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 352; - dataLen = 576; - combinedKey = "6e32cbe45b84cb3ec350a79880b5ae25099fa1805d030784ee5c2419b62a2c53"; - iv = "8508938423b92d003ae9b5f32ce5a7e6"; - plainText = "872970164c96f1bef9d35d8ee0e6589c88fb19772a9e157f8b1afbd33ab532f57ce45348556036f15b4d2d74d466e30d829482abedfe4e650c0de8b7cfb2357f471510348d20f19f"; - cipherText = "20844441a0f061eda2e464037000109d0142d366a69bd663c058f82e1cf38e4bd53e7af7f35c3db3346660f860e8d7605ade6c51980f7fe03db4da07c1a4d6e6299af462dc01bda8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 353; - dataLen = 576; - combinedKey = "13dad2909cc95a8761da0ab02fae8abcd9248ddda9b7ad662d905a46a25bd5b7"; - iv = "d908df39185b382400e9a9ca1acec233"; - plainText = "35d0252282eb70694bc198979a6969509d598eda776c944ef1334984f2651e2356167d21cd3481c9fda691bf8cd3c244a1d5d9f300ed851f26010260f6b38e71772062a488a500bf"; - cipherText = "fc93752d32c493ef2f2aab74bd58be3efb394aa204e001752f05acdb90149f0846980793b6dd8a52c3664edaddd033065cb9b379b90e07a023a4aa79115bd4b68a720554801b9cd1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 354; - dataLen = 576; - combinedKey = "2f87c97ca5f085c1e001cd6757cd459df058f068cdc4156d8079370c94b4f3f3"; - iv = "909f913cdb83d5bc46f28998556c35db"; - plainText = "43980213520c5d04a247cca3e64162a897d12eda1610710f5e985d9765c2f55c4b54d494b1d10992f2e38e2cf87594b8d4b33f2374b6e1f44d42f32b87cfe5de43c0560937a1034a"; - cipherText = "90615f63c3680ae6eed5b452849a44edf363861309333ae4e070c60f4c21f85b9c0abb9e822e70c88c1851fcc97ea0c36d088832d5b72b9c6d33bbe16a290bffb904bb5d0bd933c6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 355; - dataLen = 576; - combinedKey = "3ffbba8114cbd27c6b96de8d008e978cb7fff41e8662506b8d47353a1befc202"; - iv = "3ae1194ba907fbeabe51619774b6285a"; - plainText = "e594df29ade27756dfceec1ee1b583d6467727d6b1bf6ee38010d217f0ed6cc8f377699648494aa89e03d3111984eec3eedbe3572440345594f982f7ea12615fac564dc35c38c662"; - cipherText = "6c8f80a74a56842b339a9f309f79f194c31cecab323c478cf8945fbf99fd1495f430fecf1413a4c18b6e227a464ba989a1c4e22b84e2e9a719045b08aa9219a153534ccf43d7fb11"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 356; - dataLen = 576; - combinedKey = "617db49e4b9e101c15a53fd515a57529f968a6e5ea45a66364dd133cf863af8d"; - iv = "d34ee8dd37efd7d4d8835d93000f3770"; - plainText = "6a3e8fe8bdd29e03f6ebcc27f7b2ce5681cdc5d950594ad9b9e57b5ca022c97bad40742e9bc318cd224516d54e57671bcf79d51c84c0c8d9f1d2e85cdcff2ac5c971eadd568e19a7"; - cipherText = "a290201df16c822e9cc30a78fc62a9f317b4a2637cb156eeeebb19aca1d507bfd481ea14f9baa52c61a4d369500d0b8151af05ce4f42e8f035c7075456b91029e68e1ca8daf5181f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 357; - dataLen = 576; - combinedKey = "f8a772bf7d480355894d8abc31bdb970e7643de3c439089eb08275f4d4c02229"; - iv = "454ccf6145a2ac08047b55425332fe76"; - plainText = "e36658a89c5fdb2b181d1bc83589a564e0918c4f74a7eee3dddbdfd665ac0ad5e187395c997a512eeebd155d886d88da6f16a9f78ade62bd9a3f1c249c0a59757c73112fcc3b6f5f"; - cipherText = "5d275f1d497643429ca905b53e1e0c365c17eef2bdf2f86c2d57a6c8828e7742cc735142c934b837e56e1e4765745b860bb2776d0e5c3b4d4ff18d25d8bb3a2ae08a927e71bd4184"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 358; - dataLen = 576; - combinedKey = "6f8516a1b12eea2b2a4787d4a3eb8648c141bd505cdd18b9caaad3375d328bbf"; - iv = "d9403bc1d9b9086ffc3a779faa9bec02"; - plainText = "e41bfac05daad07779af5e6f23ff02ea9d149a3739feebd25e3f8c4cecb1c672d71b7f2739737a8f8e71342e5d276b1096d1866275173de47a4dc8ae0ffc7134c3b4fb5b61975047"; - cipherText = "a51caba460854a75c163a7020962aa07050f7b560ba3a83574982a1e5e6b41cb0c7f1878fe1c40211d99b5c12d1fca747e7c5ca5bf4e5a7c9039d11c84a568db9c281eb2178b26ed"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 359; - dataLen = 576; - combinedKey = "6e58b37d71c3bc5b5696ac3b17d683a816400d10eb05ae680f4a8a5c7196c5df"; - iv = "2dd53f312d09635b043ac61d5e6999cf"; - plainText = "50aaceb52bab382088c1300617f99dd5b6ffa3fde380438b573087c809be8dfeca8a716eec0b91f2b9b0dc2fbc102a34522743fe526b617c4d8df36863316aa959cf3107377a5e6e"; - cipherText = "82b85f9d9a76f9d83a90b0c4f70f6bdd139acc2d5600b37120d33bb7ba04393bb8e056f57fdf94bcd007d54286bf018528b9cb543407e354d6fdd2f17f17a31adc9220eca1287953"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 360; - dataLen = 576; - combinedKey = "82d054d0790efb1032c674354dba7866ee7d109644e2f74d82dbfdcbe0e1d17a"; - iv = "8c143b917d0bf4a44d85d4823af1a57c"; - plainText = "c6ec809dc32a385fb3beccfada36360ce2be82675593222b0a404617f75af400960a431d531de15b0831a072545000a32cf429b40d6ad4c49e75c1b54ac4b556d63033ffa137d97a"; - cipherText = "3db9b03162072747d57fdf8589707a9b519d39aacfd934966eb8c107d8377238b9bc2e20c558d3766d8d13c42c95c7927a492ff0df8dbe2c6dacf10f96caf35c654ca2cf8c1b87a5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 361; - dataLen = 576; - combinedKey = "7445415b7641f755517b8e8c4c3219fe7208e038f18b039108af6190486ed5c4"; - iv = "d061a5f7fed8ff8a79cb2dceb54f6b98"; - plainText = "1003c277b8491d626930a769a4319d8ba1681f854cf5d8eafe923abfe909898a46575f6e0bcd9b6d9b79edc4cc958f2d33958d636fa6d86bd7b0ab7760aa4ffe6a5b7b8e6e6af763"; - cipherText = "17d3901c61b299aff4e998b450d5ca0cbf009d0d3f5e3f04de49c93918935a6f2e950ef695efa029eae5864b7db79ffc3eb893255e68596e84c6f4691da6e9b75dd6cc39e6270ce7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 362; - dataLen = 576; - combinedKey = "b395747aa40e3a8c51c021152de4afa985df7d89a2891e0b7eed6a0b5d8a0652"; - iv = "5335262905dad8cd929b9477594e6a61"; - plainText = "0a18bb3300039564c56667ad20714fb7639632478c054f93fa323023d175e9872f9de139358f08c11901396db6e714a8e54c21b0d8ccbd595f3fd202fc46ddc62f487d3b840d3d38"; - cipherText = "20ac0354cda11d301b5a0fab1c1403c0bae5d01b43a5835e5fb6b93053537194d46f20bb04ef341f6e6559ac608f6606b0f7da6361530dc40787f25a307e5a22153b56aca222f6c1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 363; - dataLen = 576; - combinedKey = "63ce9bbb1d7f21fe21c3cc47a0fb80518afa36c418eedb6895dc110c80207879"; - iv = "dcbb011f8761f046d540f211bbe29130"; - plainText = "b22780fd7e7e8c1a0196932e3f04fb63afc2dcc9b2232cc639b6c1bdcb5bec8bcdc151ec894d63ebd9abe23eae8ad2d711be9f679978ab53df5aa06941fe6bc640b40fb0c5adf9b6"; - cipherText = "b58e4753e4703355679cc98fcacebc9fc942b8aa89dc13fd110e4405fced91f5f783ab31d36c487f77c0eb77e0a325f0405dad78b3cd1eff5eb4e0bdad2dedcf2758f322e8bd8878"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 364; - dataLen = 576; - combinedKey = "9c44cb344f240535f4ced7f104887ce1f61dda3a394f518d904b03e67d4b19a7"; - iv = "da3ad743549874b1157e50d5664daabd"; - plainText = "8420b26418e0430758f70411f96a1dd4ffc82e17699f2cce1f2b217b5e7b8dd4dad92ef3bd07fecf1c2e3b5ae54442d4879ee22fd0b6eed2350b0a4324a86092cbc2302c792952f2"; - cipherText = "6eb983ddacda54dba3935c449d400bb02c6c2c2ffefb215e4cac2844449c7b4f94663541b8eff068fafd03fa52fa86d71879ccdc561fe4bca2a5cb93f372797a823840cb87362e66"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 365; - dataLen = 576; - combinedKey = "3efaeeea272fde2688edbf8b7da0680be550ebd9858cb963e4423ec977978f24"; - iv = "bc6a033507613fc1652e06515dd4d76d"; - plainText = "5eed0619cdcc8981c36925ada442011ce2cd1fccc0aed7fa0e1d5feab99d88aa3d722ce6811673c630732649e5292c84b970455f9676ad21138c91d840e2e10f94c43a8285b68f43"; - cipherText = "a616e4733a0117b7b4f62674b726c6c0274cdf6bf1e8c8329c1ceed6bb79671b986088d50f9ac4bea347c4a88c3ac40326ba2f7f04521f522b97d117115a3edbc9ca7077abcd3df5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 366; - dataLen = 576; - combinedKey = "08667f326c023bc59c10e85367cb6650952389fc26a8b3ca88c1923faf629a70"; - iv = "207de90540145ea39d7748e647f794f1"; - plainText = "5206784b4a8a2779cd26769459b30fa0fb391ce9f49f2cd43c3796e5649cf31ef334bb4b87b0d2aaeaacf55609e6c267a5548c6a2f2a94ccf4d76056b04f9e1edb2400d52783aa5e"; - cipherText = "9b5da9b42069fa4e45b6dd722b29b82db117e76f09a2699e6336990eaad66fb26f6722c3661b91c36076c79efed4ba9d6f26928f1af15002c22418f3b3966a85701ec6e5b60352e7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 367; - dataLen = 576; - combinedKey = "0a34ec9ef2f01ba79a479b3a01ff1c5ba33a6a753be028473f775fe25fe60f67"; - iv = "087f3ec018a069abe29c2b75f30b15ac"; - plainText = "ae6274ed75d1833810a83e0b00e28d438b633bca6d5bc68fe14f4297e2e2117a3fac69174e8437db81a127f51d80128095c46edf8471f457119c4e7d14bd07b152e79ce380b605ac"; - cipherText = "9aa592a965a2cf00736e24820b6dd1018161503369f16f86a21136b9f267fe16e951092f837e341dc7bc6c7d75218dc2174b9f0b2e2ec35abcf239d7122110125d9e0da72784d4f4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 368; - dataLen = 576; - combinedKey = "f37f1c85cf4ed3b85119aa3a93fc06708d124abceea15a8e595bf1afb6e1604d"; - iv = "f57bd7928ccabaa5cc34edd49aaa2232"; - plainText = "e1544c99279f885289fe049ee50d14e2295abbe961c4b4a7742aba93353bbf3e6acc2ad14e4648c22444262abc372ffabc06ea6a8da20eaa563aa36b2dc6e38d7978e3e738ec43e0"; - cipherText = "2eb6252243bc82565d1dbd2d79be5069394a68fcaa1b416fc532e54d4f5753fe0fe0ddd6475c3c672b990b16320e5c12c7e093b7c13c8b92c34f6275e643d9c17a64a934e70f83f0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 369; - dataLen = 576; - combinedKey = "bff67f90d1e2bc0d1ca73a2975b6475204eb1d64672e1c3446347d1a5940d0e7"; - iv = "acd6b9459ae360571c7a29ae34d46029"; - plainText = "794d26d7b63969b6648c8312363ad1097bb5ad655ed5fc29d222db43d50347441b277e7face6a0fb21d545147fd8ab9bdd2494b3fe9b3aba4451ff8bf13b0bed8287b76b8bc9c17a"; - cipherText = "9bbbffad0656db5118cd89e2d62e3e3559b0d8fec7905a016cdb2d734fe4a8fec69285bd137a0f0af2f44e609ef4f02c174d19d684bdc62021938d7e049047dd20574df44ec7ffe7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 370; - dataLen = 576; - combinedKey = "7d16a5a9312d23131041c7cfa0018d90771de2c19de907b75a3d11a1f3d92779"; - iv = "0cb12bbe22544f0bad9cc1783ce2d693"; - plainText = "727005a6eb107fb67c46d51940c67867f56df2460094b67a5ae5471c4e2fe1abd62de505347c67a7fe3d6103e5088456694022778d02c8967732869cd807c9c12636001c83da1f93"; - cipherText = "3c810ef5231624e0e2bf363812dc5df17aee5ec81ecaa6cd05136258a77513e574746e8425e9e2eb2da07c9f7fad741fb6ad67397db6eea78feb7c43d724d87b54a31b75c0a5aa0b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 371; - dataLen = 576; - combinedKey = "efc3504546ff587d12c073f846fd4238d9ed539c3484b09ba368d97726d3441a"; - iv = "3b7d83c8dda449cfa6e8e48a4ce1fe78"; - plainText = "d8fbed361e7544a3e2bb464d8edc1ef6538aa4a0e079796791fe898df3c2afd6add2c6a47c6dd32855de11069756b569c4bb442594a1e908e9d23e9cde260cf4ee0a6e8d9a28da39"; - cipherText = "943d5e3d69472b73de794279222b1341f58b83eaf045fbd3c0c4240f23cd8d96f569ce837766f4c55e0b1f85e64b08248367ee36ac449a65ae5d13a871c3e66eca4ab2c558aa728b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 372; - dataLen = 576; - combinedKey = "c0f7d1710a7c706302409893fccfb6998b0493b47239c275f3c1a27aa0bab0ec"; - iv = "93c08a7f9f8bac23041ae115589d2a1c"; - plainText = "d78a3eac7d873deba7de3060c20cc3d0a9210df8a13dce5c377eabcb6bb2f6094a20981c833c03e68723f395dc9c99f37e414898e3d3f4c83e4557874e76b1a2b315a614771f2726"; - cipherText = "98c5c8987f67a7cb16dd702185476a0f08b839ce447940e3a96e204f6e0f383e4e0c623692db9de5654c4fdb113a8d44f0f827a38fde1ab526ca0a199ba599376d703d375b7601b3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 373; - dataLen = 576; - combinedKey = "adda2c00b6a83e0d6128f53d2d48a9f4f1712415eb1240e551c52ca45ba0abbe"; - iv = "47bb421c7c9d12c72e9559b111767ad4"; - plainText = "63af523338896e5c63bdd22173ee0a00de7a1976eaf43c33c0322007ccd936a6a545effcaabf588ac9cbfa26ad943b9139908182964695d645da0917715feff341ee19bd01304dd9"; - cipherText = "17d76992b75cc93788d48e4c46ad5e33105f1f0b6d54b39f00c348cb075e968972eba5b228aa04e08674a9e5ba67caf0a9876ef41c6e386a0b26c5fcfc7f0a0ca158f20afdf6f6f2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 374; - dataLen = 576; - combinedKey = "3721c22766104b49ed99044f194446edf92e7b725d8b761cf515ae8997047450"; - iv = "9f39150ea3eca7fb389c49ceb8bc3d45"; - plainText = "7eb240b4471c12da350144db17570306ef2d9d44a71f230934a16c9a2369a3f44b14f3b6bbb4dbf749fc63b2ee31cc8302c53c559abe312a8a9e89a3b42259df9159c479a434664a"; - cipherText = "791065209a4366947b849263a6e57d4dddf0901f5468fecde062516e2135b2d02cf5e9f5cc5fcf82e387860b7b357fff71767f033da4300de3e9799719797c771d0e4ebb1fce6797"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 375; - dataLen = 576; - combinedKey = "844569bbe1d19de8f1998978fc70b67a88b86b5da3f2acbf12e23a544d553931"; - iv = "f5ed19cbb12ec19fe09737691965bed0"; - plainText = "f8c94ae0455549d1bdcf34ead7df0ff8d414b7b0e98b3f6003307a9181b0345c926e8a573740f1948e0595f8c99aee1cd26d205942d69814786941679a7e902c1ec3575ce43f092f"; - cipherText = "2d4ee55374340bd96629ad94ae83fb8cb7ff04696135df53d6ed957f790f1ab473b14cef449e50d2029c9d24691b061b19b5c1fae63c0e0c38dcc9ea1e6806cec569a2359e78247f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 376; - dataLen = 576; - combinedKey = "14c82786ddbb7fa43935cc4324921f46c706eeffcce49eb40837bae142134d5f"; - iv = "49ab9dcd2c9344ef616fc9b7a3d6157b"; - plainText = "e70222b3c7cc5bbdb29c5d0ee4b7a289ff3b324c48f8a3356b6199a9acad0d486ca6ce0675b0bc407edce7e3a6f5ec0650270bdd42d947ef20be56f709c718e3d0158d999bb4bd32"; - cipherText = "ddbaeb3a52c7014492b44f60d8bb83eb00dffb735c7326f471f3be9cb2b27cef6ecf7093ea73581fcba705b0d3fd6a116e42484ce950318c1907398ad57682384693e15ff54ae91e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 377; - dataLen = 576; - combinedKey = "05e54c90057e5b73dfc8dcd3eaf2aa809724ff6546b4bcba6e6bd21a8951cead"; - iv = "356bf30ffa5b1df2fde72b89a8d4cae8"; - plainText = "3bb4424bcb219fe445dd70a42bda228a27d61152aae747a33b024b3dbe8a962834c0353716ef4348dad87204b7fc0323c12a683adbdcbccbf5a8f7c19492ec97151c65713a6336f9"; - cipherText = "a9c859205319ffc7393a641ceefba6d481efbe8d0f7e0024da6866e6291cde4aab8476b87a666ecb90ff1d80c63a9f06791d64e3c5c94b46d33c7ff40c6e3d039159c59f510729dd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 378; - dataLen = 576; - combinedKey = "1191b7c0734b75132eecb5c879603a4f4fbb4ad95ac3e1dbded1753e64d38962"; - iv = "186ee4e62221d225936dd3f5ecf4a84c"; - plainText = "c4c5d061a241657e9611276773c734224594a7475ef0d8658ad0514aa91e4443eedc1ff5d6be35c17862c5cb1e835c9af6d36a937e05c5bd9accaa5b1fb1cd3fdf8db46a4b446e91"; - cipherText = "066d258b65a5f51551b0504fd51c8f9cb09761ac4315b9bbfed43d6d10ce0281874be429b6c2afe14affaa002363f09189fada13eb7a1b5b5cc731e3b2f17f7355adcb3903aadef8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 379; - dataLen = 576; - combinedKey = "a612abc25067207ef7751252e392bc74fb9ab76f7b3f8442e3788409984a7e0e"; - iv = "fb734489601c732ee2f27d3c24f61e85"; - plainText = "8660e147324b71637d439ee84383f30890ccc3660dafe27ebea81a6726d48f214c668fa64f2743ca98d866fe6486b6a4eb72c9e28905b33a690c786f0d6ef6d9991fa7cadb593bf0"; - cipherText = "a87dc6f20ad1c57f58f362f5b1b3e3955e7700d27eabdf3ada810482fb55c6786cb41da71aa290862b2b4473120bbf67d1a070a199f2a059e3023feeb6f23de6cfb1d25d8ec08b62"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 380; - dataLen = 576; - combinedKey = "4b8265a707011ef558bba24b721443ca150a7023ee9db9c10e79bd9b90bae527"; - iv = "56f16bb691d2b24cdf6153d6377c2120"; - plainText = "b350dffeb39740b94ce5389845026795e1d98aac6a80cb0409ac97e96908becd4fd6573bb4bedc20fbe13c6671264081ac12e593d105cf4d74b194b0e9768a6c2f6b1e9da890cf1e"; - cipherText = "e4c468f0c846f2e4cbc62240771fe11a1899705862da4cf63d92e978a1b1f24e20c39f86f5861425f370a91be53880d78107f081478156b5b0dc4369342a33d0e00e9911a87443f4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 381; - dataLen = 576; - combinedKey = "f84ccdb7e9c9133d81d67ac1b6b5890162c030731478c2eb616a9f4af2592677"; - iv = "2c8759fd09859eb40fa992d9b79fa738"; - plainText = "e2aa126e469ece99e32831c02e7ce1b72b2b29388e0fdd9e849476affc6f35c5879f482458015a1537100ba24e01ce05e8ba0214997de2c8065d8f74c074b4728ae6186d7f33ce94"; - cipherText = "d4c0ed5e4efcf09e1628bd0b424e93a3ca3325e6835e6b541abe62bcfb7fa8e18f56ee40fc357d4d0493d876b10d79401fc6b2cb9cff4f2fcb8c6b94f7dd3f2708b9e925ead02ac3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 382; - dataLen = 576; - combinedKey = "8cbeb2d49426d05ef87922e37a4fc194c6cc214f0c3e0c5a9f09cfd626870c39"; - iv = "a9f45551d8ee931c3d599ab655283a54"; - plainText = "294d4726898ef808c1e650b034780a5706409068e742b8821055c431e21a51e1af82e97452750eae3fd6012fa6093fa4ed97ed910670cba64acdb25482e2d6c4ad0e22ef08458d11"; - cipherText = "cb5e46796b8ca9860249c539e63d3feca7868d6b3619b5e6424474c570bf95e1dee28dff6522b0d57a8ec024b5e43b27b3f0c30a15e8536917602345bafe57d070d9d7ed2386a352"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 383; - dataLen = 576; - combinedKey = "541aafb767d69ec7c557cc2067604c2a26dbc2d731bcaea1c6e63cfea5c6a4ea"; - iv = "2d27d9bb91e75d54bcea23d9dba9998d"; - plainText = "ac08278b5027b80e1c38300b571757e5d23c2a6746fe2c2450a2a5087095ae2ed97982ed1593bc2eeac339a3e530654595742c2fa1bd294c6f3621f99344381fbc56a69ba5ce469a"; - cipherText = "c98d6d7fbcc46bce7d98e83b732d96ab4f300b967ea6337738e941e578259d251453fc422c695dd3662a8332be55b82dba714093476df1a09c53a9a575ac4ed3e08f02216a7a63a4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 384; - dataLen = 576; - combinedKey = "4e3c7b5b0dc41af45a24cd48ef9c0d09e882066a481fadb96797f15fa83936ce"; - iv = "951b0f0112f64b3838b956a8d897cef1"; - plainText = "f7ea9ea14e7fee21b8868187934618dbcd1f3127ef2903f56c3bda9bda21c898162335121709e16f548905553123fb27d6cc995691647de80ec212d2cd3b7050a9da050403124565"; - cipherText = "b20139d0327a83072bff32bd0fb56c43409d20e3da11a343073155f18af26394f6110ecd7378712c022eaf55418d3945dc836ad1e72eb275b039b43fc4ab37f6a950c7029846d4d3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 385; - dataLen = 576; - combinedKey = "f7e51bc8aebda4a2415c5e75c986852642f591bfb88a07d065980cdd057245b4"; - iv = "72f52e2b5f1cb498538a955751aa5639"; - plainText = "dadbafbe7808baf838dc71cd75e400ca83365e713571bffeb8ae98d5439e0e9c0558e372391564822d607ea326a57caf0e7f61557ab02a799d48211aef661208fc386e3bb3ef5dc7"; - cipherText = "d63b32a6c8b3bf21cedc1b05f5766070a55a6ffe5d0bf19aa176a54afb9979574b242e4171a7abb8042279a35ce02c40d66696ca674f62ac0c2f52dd475883c82e9a03ff2a85c5b9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 386; - dataLen = 576; - combinedKey = "5e59d3739d8adda588a7b72139f52af68d514b5f5448f6caef298aeb97fe149c"; - iv = "5ff0597bbe36e07cb3977e597c40bb7d"; - plainText = "aaf549eca5869e97c9b5bd9b7b90cfcdfe4bedef59c9bdd8ea642bf0e56a8827b094fb103b68395536de804e67289b331ca41164c27859d77c3085c2be091c3465ba246a1abcef6f"; - cipherText = "2b81b97772131272910bde7cad82bc941e51dacba12c8184c2e28a4c89f29ae796a0d865b893307ec4f28bc6c4c6da83fb5be2db989525338c5d40afa02e20ef3f7a8ce4be88b0f0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 387; - dataLen = 576; - combinedKey = "78d00a685263cdf0cf2802ae1447a70a133eb8405bf92b6f9b79e0a31cb156cb"; - iv = "ba64385edb04b94b0e2a11aa351def42"; - plainText = "a33ecfa6f5efb8a2ed9b24c38a0d4d6c24b93f603400a940a082ce714263e3d531fa52df309ccf0320e16bab4ec812870699d4cef4d1156de3908ee68866ca9e4b7958668e3109fc"; - cipherText = "2023a6df9780a820d1faabe47b7d3f3fbe12888bbf16a630acb4d557a5817505ef47cb9ab8d072bc33cacc7fc8485a4a81c6a86b08dcee8acf96c3c0f18b9d586c2936415145ef4e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 388; - dataLen = 576; - combinedKey = "0cbd07f83f298a6e3bc5187693849b5f6cbec3c5993543781d4ec0c9a895af1d"; - iv = "90819e9c84f003397aaaa7dc73313c3d"; - plainText = "736b39ce3962aa77dce103207ad59562e3a50279c70a0753d2939fad61b055f28c168c560acf109c04d2def5d90c3baa2ba9c3e844b3cb238f61aa5c01c71dbcbb80313ea87d52e3"; - cipherText = "652e19e7ddffd6dde486475c7bbfaf087850f2b0dbfdad905a035546c53f5fae8ae81eb0f777c1ad172e9786a28c55d4f55df2359fd7498a59197d1fd1d4f40370abd7b0f1aec68a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 389; - dataLen = 576; - combinedKey = "b61ad016541230855f9a17ff17a5cbc1ad65de760ff35c6355ffc34580406c75"; - iv = "66e620b8cbf81a80adac4d9d936308d7"; - plainText = "53a9afab3bd2dfa8dfc746d83bb4babc74d8c436d3268c656ef5e388c404139a31139a481467762f95329c6a6b2637676ecfbd50e604e3f480da6deb8c833c6e8344a6fade4ac637"; - cipherText = "2065be7ecfc4276e5f3c39e2ba65e4fb96b83b89c5bf4b2212fc1439a4dfe99c4b7d4a5c96704e080ecf0ad557716df781d94e878968dbda222a05f49d8faaa2b96be3bc10613fdf"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 390; - dataLen = 576; - combinedKey = "09bbd53df772b094cdbf7d4825f00944dbdb19d15160f56ef32a28ca98e944bb"; - iv = "5a0aa763599245de7b8f3a79d533cf68"; - plainText = "122c4b3dee78abbd4025a860c8d822fc4fe18fa04aa29978fad1b4fd37605ee96295bbb5591d7e4233e06c51381a2eaf3d3d2caf4c3e7f04391fc471f78f746929997f05c5444498"; - cipherText = "3a883702d6f49917e81c22d041faef21a81e3056adafae768b3fd8427445ac6e8a00a1c784438bbafe5efc18130389772985f988db2e2af3f104f236c54a6b39e9899f87aebee7db"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 391; - dataLen = 576; - combinedKey = "f7fdd82388136a05f8f202dc908f3ec0311a5c5bce344c0515c7d105128f657a"; - iv = "abc5f1f1d3ff0e6f6f8de9c69028b340"; - plainText = "73be0cb974f597a6734e2b2083095b9cf26a18dfce2d48423906fac326d0ae866321cfb384ab491eda60cc5994b7df300a13620095eab6158396705909af234f11fb8b78c07af5d7"; - cipherText = "3700e3ab07faf1fe500a8fd396ea58a57338e02da4ff3aa2c36ad24dcfc5106d1ac7a4c80541b99339b9cb5cb791238ba9ea211a5ecdcd1087e182dabed66dcb5f3781954433586b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 392; - dataLen = 576; - combinedKey = "d9529ed7194842e14c2d207248147024db0551fdad6f15b003da3d36c429f1b2"; - iv = "80daacd7c9714fe28729bdc2f9cb7fe3"; - plainText = "5548304822e9f02435a2e88fac781fffc321b68004029cdc36d17786bb4978523bd0c73b4c84d8e2d12150139ac2d37f3536d27b783d7aa6e6a4554c40899be7b9e645f6819c0146"; - cipherText = "af6ceddd8a97f04a4729444ae5a06d2b5d2cd07ebd099b2ce369e0ea4abd7abe61e975e3465bae63084591c0a506037995e6d0ac687219a024e17ee9557eef0f278d2d1a6e587608"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 393; - dataLen = 576; - combinedKey = "8568dba21b5e96e0d87d52f4cfa202cdca87742943cbdbd6b5624e6c98a1457c"; - iv = "bf5435b813f2d925940e78bd385a5ee1"; - plainText = "668d41cad72a73a8bb58a1feb9d64f2085278f4ad814e6cb1c42b36b0fe9b3b6f89014870b557c1f5baa0e83881d8cf9bfdbaab3ca85373f16175430bf1ba14bf45c63411c60bd77"; - cipherText = "c4fe86386ae2d1e032ec4a0ede5421d0c85c6ccce6f006f1a88275a03a9a54109535568b6753a481301c533060993a77b62b9fcc54eca66495ca0008efa0ce81e24504afa82680cb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 394; - dataLen = 576; - combinedKey = "e198fd1acec6315f46ded41b52b7f230c3c3a77c149e6ec76ff343d36df93969"; - iv = "705e7802b1422c13ac3c038c4c4a656c"; - plainText = "2d130d9d3042fbfab5f565fa2a14b0e9ebda8d78a76500d97b2810f06976e90cd580cf61cd3525044aab93fdb43faf6013b889ee5262a6227a21ad67bd2c2f5a8936996830b61ad7"; - cipherText = "9c1e21a6e0ae8892978501019ef6b046b0e23fc16ae28690071db61c9af53359262a60c8e7ef0ad6371d6cbc96c8f942c207ffc10a7a04116753b8e59b3737612ab1212ccf564684"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 395; - dataLen = 576; - combinedKey = "589a8bde9acab1835077e3ffa32ea66494cdc7d21b8f06d4831da7f01e8bdf2f"; - iv = "572ac321197ea7a7924901e7de04f749"; - plainText = "73cbaddab96fd1ca9c7638662eb584ee72cf90ee30efae9f3d5566a6cf1658e6fe36e09fd9281c0544bb3b838fa2ccd3722e498e1ed1a37dedec69235d6eee64e6f804accecf66ab"; - cipherText = "20d0e366adeccff61bb2e541c0edab1bc80f9941a3d80a1e4948499eb01dd65d125a389299515a08f6051a826a12cf23fe8124886de5826b9d7defca91e9fa7600c67c6b8aed5c84"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 396; - dataLen = 576; - combinedKey = "18199900b93aaea8acfea41237ae0882093b39826fc500596e1cc0be1862b951"; - iv = "c8ff29287aae899b3889c40295a56d85"; - plainText = "4739cdc7c52546f968a8d485fcb528d51fd960c68ab09755ad1ac182d34e4ba90f6fff918e9512d10edcf3c6c5d1e023cca92c4bf5537cea0bb81f6400f34ea8f4eb24d1a5afad01"; - cipherText = "097411198b813f20c05809c734315d0aac720efbbeac4e392cb30acdaebaeb2b3e1a5976aed844b64d64da533c8e59a06da03949d90b6e784e8443a84d7f60af2eb2f3c088a7c793"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 397; - dataLen = 576; - combinedKey = "12955770a3dc6accac971c3e65e29c0558ad1703c5d4909338548fddbca49082"; - iv = "205c2f6ebf6c5bf186c59b5598e7202e"; - plainText = "012c8b3c72b5a6555ebb0a077d2475eeeabe35de72ee12e26f2c6e7146c67f5e19a59e7e7f3187a2922d654115b24425f7d4bbedbf35f1c7fb961692ac4de3fa3907f7a7d11a0028"; - cipherText = "daa492a9e52005517dfadde26f950433b6e5fa75e447023b77c7d1e537b48a072852df5daecd17acf0f03e7435e390641037f64c1004a421588786ce273ede267b9ad36b2878a16a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 398; - dataLen = 576; - combinedKey = "09034c6c1eac1ec34a3b27a87ff37d93abb34a0efd8a1f9e790608b41f8b7688"; - iv = "d7a028bd9523170c43f643454e056ac1"; - plainText = "1f997a2374d4f46ff53dceb86cbf38f0c9a9c0211e11768cbc0f973889f95c058a175a5e282129979aaa6c8fc05a5a035b501c05d3eb3f8af26827d666774e03ac5d1dd53a52215b"; - cipherText = "cff26b564cb7e5a66a9184b5e2d9480a57b602b6624b456fd1ec35197b039673799a944a263c92b6a58dbb8a3fc2436e18bb64901c8dea5dd7969e3d0d01d70c3b852b3d30cffd93"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 399; - dataLen = 576; - combinedKey = "ef8c15817473b4444bfc80bf962aa713f7e79f632e562ae3ee75b1807b3362b1"; - iv = "b7b684ba31e19b08ab2a6c82e5ea48fc"; - plainText = "45a25512893aae57f6bc8b7490ecd79ee2c1ebb9e9c28826194a508901d157de72e898fbeb0684d187c518840ce5d30bd167eedba0d9edbf7a5160edac9e931907273e12a289e3f9"; - cipherText = "399436cf867c714d9228300fe55e5cbb2dc4f18c8efc8d3b9d250c58d99cdeb739e2a1813eddce6066319d1d343332354b9bdd2dcd2a7c74233ce33e8a61ad31607f7915bb21fe13"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 400; - dataLen = 576; - combinedKey = "aa95e7e5cd36dded52a9b41377efebf35449c7e61c22eced52bf2f2bfc8d22f0"; - iv = "48c156dfd368f364d59240213ad1953a"; - plainText = "4fa8f5da57e80c3db271b923471cfb197dc9637910a4d16e2476ade359d5fefeef88c7be1a1b2a643968f27e354d33336bdf22cb88bf0924b151758dfe5efac9e82e2229e719a306"; - cipherText = "a731ba5282cea5d4ea19897cd3dba298cb60c144ff044e35727edba82d2404859a13ff4ed0619c7ae64ff0c16029a0da43946b9da69c384cf917e6c62ce4b575d62c91581fef83f9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 401; - dataLen = 4096; - combinedKey = "7743b833214e7b457a746b660774664c544d02c1125899efed80840197f88766"; - iv = "376ab22c89e4054351c664f625c4323f"; - plainText = "56ad02dbe33df5879e09f3a1a2bbc24f4c3cfa196e1a15f1ce87723f201fa3093f2d7340297f07c6bd8eac93c29a52563ff5c033b567404fd11701aff69fb597f46b4ef88f42f921319e64add4cedd83f6cc37514cf0df7fc2bea708f2d61680deb66a7962e8cb236e4933413eedb97015a7b7756e3da6c7fd2552e7fc766111d98080833a8f24f2981eee5fcd7c3b951794eba84cf2d339363373442efcde4431c1a06706c2f284de755b6ab973fd94082783b41f06c214f59364eab2719e8bfef8965527ca822dad52a9915fac45791bd207b49e6d185039ddbe199ef25fb5ef2c3a94ed345db752526801b564c1d4d638b9c2520c154e40e5fb9c86e57c15be89c9829a1d991252462c115716469cffe0a46e779c3dfaffc251a736430996185caa214423a54607d5d15f1b5cec61cfe364f355d910b5fdbba15dee3b771eb8d2ee3ef935b7d2e28003847a351826056254226dfe11b0795c25efd6e7228b45bec588e02bad9ab2c11201b3a02d5b9694ac0d07fed42c4a919f54e1b8df6e2df00b6a05ed23802fb6b25a5bd505a58152368d09304036801ce7eb86e975cba3e595a9c375847559e9b754f2195cfc597b58b28f6aa7d421e65f9c3290ecf3746a2e7746e04994196c611226fcaab252ca38600d2ef09f1a3911203fd8c3e1d6f4ab0afdafde8001da189147ff802ab603862ffe21a01f6c63eee6bf89f722"; - cipherText = "7c61c579914ed32161d277b6040ef2d53512322d8ed57fefb5437b9ff7d477f1231ee9ecce52add1eea02edf735d77234961ca2ae25422006111d7704c9518529cded3af7555fb24ffc1868fc1c8b17a1d55f1dedaf8ad89b555d9179c39d49158a2ac622b86f05fd8aa4ec06c574ae624e45e1258afe41de70c4845dba86b7ef45d693dc52557364784ca492cc6830e4c1d70dd4993bb87e8073ef048e7fcc103a6e465b24f23991000159e6570e82c916a3e935399b75e265a15d52f5824ef6595cb0c785d7b8f9f24ac45d9fbc82b5b75476e57bc2b7453aaf30bac5d083906a45d4d4e3d82099a6b014b12fc06e9e13db5cda66547eb4ef3d74ff1b9c05f73d6c94397636c11f438925dfc6375fd95c85bcb4e840bef9c89bc0948f2a055a542c67226c013331a33b559f8779cc6e7a4bb2e750918b7ae4e9798d45ed2ff8a223984e7baa52c58ffa042f2b5f1dec4466a2071f2c5ac013d4155d48edd4e18f68c06429fee5dec9d978a9a6a6955478d8fc05f8b9aa8962a63f33a90dc152af27168242bdc012863ddfd77515f9296f17c9ba81183668c052e7d54411da221894804df05a7c269c6915da8c8f0b3660df5bca23d3b3466ee4befb52b203cc7b8ff755dc76ddaa644732a3996c3caa7c7ba1ac358112219f4e9bc79c8e1719e0a0cd4a1fdc8b52a08d6b8c88b54bc5632581ceeac12d01d187e595f226c26"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 402; - dataLen = 4096; - combinedKey = "18e933f7f09c257a4f44c7019bbf8f1cee85a9c544c5ba3c0e89d530b9d63d1c"; - iv = "db59b8a85d388ed5391b3889afcac4ba"; - plainText = "15c2fa930ed46f0567d1d1841fe039cb5ea84c4d62bbdf33d3d698e802c88eb38a1521e12e744bd651b64546393d81bd2d20caa1666bd4998d0144c60477ff0e48a573fea340eac5514d6b02763d2f7c956a0f3f7617ce64fd180adf844d541a293604534785a892f95dd637e0a8f07fb51c5b0400f4ef230a4675e6af9126ec71aadbaabee71b822d71aa542335c3ef2b578d8e28b4b400b91a0b9e16753ca0fb647e76ad30413545b7bf89158427c8fcf0322010dc243aa3e2ed819a73f9eb1c9d0d744b46d62171de3bcaec8e0b48d29f09789abb3ed4f7bbcf1aa88d955cf8d1e55dbe4d0d0875f82b1f8df924bcb86fcca9d09d9e4a977d3c0d3753a93380d4fa0f842b0715957344f9eef0097250c23007c506aba3bc35e20dd7b94d213d359d27913c153f242171125d6ba80e214ff9b898e62407b5cbdd5878b4135acdc80fb8c829301e9701f8d71577a1f5cc5e7a9cfc55513f951137a1cb50d9e64462180752a3d36f26fbf837500ce315994ee324d1feb4d10473b6bef2acb5890c879c2a4ffe03f448b79cee113eb9411511cd77cb3d8ea6c50aaf6f5405cc56cf954aaae97afb34c13a1376b12efc63b7342db30eae18ff7507c662e4dc3ed1d1ac58941c553efe5339a19f77e6102eb2cb47ae08b48b66e4f611dc26a19c8ab9318d70a5d56fc9358ff4584ef607fadf372f7f3b0faa183700912021d83c49"; - cipherText = "bfb256833050f5e5eb3a730c1db348bdc73bf0c64f9b42cc4ba1279ed5d7bf980d34b575115e6fc933d1e10d27dd41003e57a345fe83b251c289abf3ce7203685b9c6db830466d0ff35f4387ad1a29277d03895a243181140f7fbd0a3d699dae76698f524cad8465ffc465d74a3aa27ee9b80d7b31616b15f4074f2ea5e002a40023a0ace49e8d02849cf3e93e0a1f120b5bc95459c5727afe8cbbe85b39ba53e9e1a3a46e7c127339abe4bf009ae24e8d03574542ea7fd917d26569827cb5d7ddaaf1c4e4a080843f43e229c60a9f0d405387cb9033ec43ab497a67ae7a1d6c6037353987984fe873a9d36e480e4bd8b6308b1e684cb08f41346f66e2a9ecff9fa1955a6fe005a3d954fd8fac71b44c1535cea00a953eccacfa998b356e593ef86459bcb3cbc24be4ba1e3b67def54ec0828c40636a56631312921c66d175554d737b56514173565b6e898be785ca593efc7211c0f35c7ec6bd3d41fe4f2e11964073e4cd9444a33056a16b57c0381e860488bcec1c4dc45b8f6022382b73bfe4ef0f62b4ce1b6b009b010bee2d9d7b2061049b967262c1fb87d02700a02d20fd080ce10768bf60e6b3f16facb3016a028badb061318f7c6867007fcba8be258a91a831838a44bf15a0e563caf13bd8f172fae12f1f2e33f0656302953b11212a0c52345ec033b754791bd016d1536b1040e099f6f43cbaf19023169b5439ed"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 403; - dataLen = 4096; - combinedKey = "693ce078657b15c4f851621770d72a7c1522d43e8e23faf7566d33008a937796"; - iv = "91728fca2dcbdd83200ec1c601855ba8"; - plainText = "6735b5cf29c39aa6820d254ac3c5f569a616f55146dc8ab8b1620d358139f4f4b9b6cb102abda523b4031ccd06bbd34a7284744d5f01b91a2acf51c030e30e94a1ec17032f3a9a8d6fd617d3f5ff3a969482fa0f63a2b24f2b5729303f92d56f5f102a0c34cff94e5ada45ff71648401dabecd579e523b1955c8b66ec3531720d26cce7db542ddfeac958f1c66785c208c31393bcf9dbb6f544909f2a7e88393c77b1850c046dcb63e7e87b2c9fcd8a9c0c607971e8067f54483339a4f71e99439bf121df7ee9299a42831c804a58219666db27d6b4bcb690d734168f20d4683647dd0dbaf53ae0e0ece337f816d589b847f08362ff9adb1fd25a6e4c77349ad15c575da02a350137b9007bd5a51e57579bd42acbf77714b92ac28c0308bf591591afd5ec32640e89e094c46a8ce7a375549986676f01d2592d2bdae4433bfd192fb46a4708e9b6220409443bfbe1eb847398dd37667a70aa3b5c50157f0d768d7cd146fa3ec98b1939817e352590897504f0b3d7294389a979385b99bbdf12a51a174992707742f27c48797fd4e964e3cb15f0259c663c62e50dbcf1c8ff63508730b9584ed9329348af8e1d16c910591adea82a66731de3b3dcaac4f8682098acd4e93fa9cee034214c10fbf8e9a7b9cc3bbdef9419990601fc3c22a84789bed03665935c3a24d95190b6266e5d1fdb0e6e7e95bc13305e4b04b0c677055b6"; - cipherText = "b3f70efb69128dddd467fd9852eaf06e743f469b49d35f1d6903a965d6923866bcc168955a7afc1ff771fcce894b127211e0e969aae68388731b8550630836c9137ba17c83a4e9f57983b3699db5e79551e254f8fe3ebe9691fd9009174e251c2711cae4b3f720ac9c9770e162334454899d0f945664e45e07423a2ad4dc634e5b5e3ae5e32172b9fed308004fd595174161565ab04a3a40abf5e4855bc02e08513312e454346f26d1a72b60ab0d16fbfb6482693ba2dc8d999e283981e12feaa575e62c9c6de045066a34016d4a02172974a50b25737b7e1ab5bfcdf8bcdd141b88c3ae154103c10404f70c4bd4cc5b0d2a734cd4f7e9f869e6e84da402ec2d1e174cc01733b7ba911c4a1b20928a64d53ac2e8cd238a7035f242bb35a2f6f287c343605ada2ee59c08720cb44f648c62a2ab94ffd23d9b8be64922ca75ea50d689f04211fedb1af04e2617cbf4810050831ffdeab86cbef8b75a30d60309887aca1260ee6a574933c6edd2fac40b9b2b853c25215b09c7db930e4437835fb1a05353d9d24bfaf20834037845ea10c3c8c4df6e77979ee035e980033325d00cd789800abaae0a2ba068c0f7e3720c9668943506689a26029eb68b294ee8af3216fdef8b3b2b458919ada348556a6cb3ff1d75841e2253cab82766046cbdfbe4e027a5ceca2908219d06868fbe4e159bb3803636e6c6f3320e0ec602c2f3ea66"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 404; - dataLen = 4096; - combinedKey = "c1ce5d459fd76290805cb3613851ab6b2a16369551c30e61df53f6097362f65d"; - iv = "a3c254e35e423ce67dbf81c96fc931d0"; - plainText = "9f373591fa3041663731f7e2641667f08d73ee5a8719b498a976bd986c319481422f0f789dbd691f3bb918159cf4093442d8f4f83bf8bd4542aa484d05ca0aef87497a26dcb6d127de21057763aca8f3bc652e841b9c89dffb0b7718c2e9c0730e870875ae78daac577c44f851f75c3481fdb6e0ec8bf09873b4fd1d1388428aaba8a82e9a80d13e13188f2228a20023d836d43fda0120bd207002f54e3630b18ccdcf1962a3b0eb404452e019058970c58eacdf41eae7a23afe4efd6373a97481bc11323e2af15d0d66959fcbbca962eb204614c569736d05cd02183ad652061f9c5915d26c67e4b4447d757d1ac89fba5ff47f34afce6e57c058a9284604edaaf43486d1149d4d081de2d4a46210f5793b8cf78880c3100edc08986a128109eaa9a75ec13dc6d43aeef452cc41fa0b2c796fe358c9bd80625ca1f178dbf3dd0a2a7c22491fff99dbe32ae2033fe808e70394ad730faf4e15c7b67e6808842465dd07e9410dbccde2ae5e16acbb7fa5d257332d3aafa6034b3edca2cc407b988fe8445347a09325b77a8c406ad84da8df4878cb384551cee359b45241236a9c8e4653e89eafe309ddba098202f78965493c1abfb9d2fece5a0281f6fa3ac0ea172b356f6c0522805ea9215d717b3cb3a41ef538b5dcd54456ded4c0add8dd4aa3a3064a46ec741bae265fe1a87486f7e0e4d7ce7a3e38abf6e965b536c5aca8"; - cipherText = "ca0ae211e0dee556c4477517436c8b229eb1abbea5e60070781bcc667f3ba91dfb57b58a54947c05774b3c7bf08c3e5ac45781f84984ab258a22cdbee78e06281364a5eb76f582a17c1d6174a5d1509bed042d3c8d5d98e88342398e34ccb6b0c8e9fdfbcb62f944645f10c89d6d4e21ab8c3e8760346b1fc2c082d20accf2f58c1321054043aef1b354eb7623c1f6dcd5c99c3e9b59cb41bad4727d5551d555cbf33b49395e7793a5b8fbc388d736b8bdf768c22e1df156ee5f1c6edb4137e84858d40f02deb7faf442f333375139b9e765e33966104fa81f2640796195e3db4d4eac31d51ce8c6f610409c49d4eebba2630f03e5b6e21834dfe34d1eb01887b9847d0d9738458964dfe02006c73cf5a6787cb246044b4128a8a143f013a2f389f93b0a0bc2765a2c0989f7ed05ea417786c6b933062a47bf7f1e612dde5550295519f548903b42dddb4d2d82e3b24a1878a361c2c49a2066b666d900192a297fdb239658e8dd618fd965c9abac270f823c7f0273def95b08bb8277b9117706fe2dc3fb54f4458bba754a3571ad7163fd8f26d5f18b75bcbb83fa803704a38f7d05961ed39345e52c0565ffd794689ddd72d198867b402462b28c394ed56f5ff012d2ae7265980d5d1b99f0cf390ec28364ca38b3d5ddc0d6b3baaf91d1b73aa6f2636df1ef08a4bc748b929ee902a43298adc34920a7605ea94b5b63c005cb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 405; - dataLen = 4096; - combinedKey = "d41b86f8ad9dbf726dff2b615b7c8dc6f921874c60dc6a3561b1d4c731ec45ae"; - iv = "c9693e01516be89749f4232be88720ad"; - plainText = "4a5ec7859aae98fa96f27830146937b05c2e5c98f3bb4e48fa4dcab65d141d5aac851b3f8b05dee295545708036b478eae1cae4c20d926b7fdc094d90fbced37ba82bb0ae46a030838ce6c4db1974b37c5ee04d92c03a3b352ff091af4144153e33e34eba5df30fe859860a160448f25d508ad6d9d67dc296e4854a9a5aba533def4043c9e08f0f662ed0245e67dbc28be3c23902143eba45202ad5b4d0737b9f6f7afd8419668ab5bbfdd6005596ee03e8a8daa0f7aed41d7849fbf5b65c656967d15de0f94b3f5550f0a6dceff95d1ec5d8e9a0dd7e1093eb37d9f2781dd23783b667171002c81fc3b9a4f35245ec63fdf866ba1e99d54a2d6c8a0807954efd1030de4c5139ba28ac6ac3833f58fca51829d752f72f770245dff047aa23fe5e6432452bfb46b972c7f39d9f1734355f0e89c6e0b553fd317d15cce43c6de6ee93aa455af43e8056e44b87359632f7ca155d41a4d03b2f391092ef67cfb1dafe70831936dcd6deb01930a646a8c01f422373c8ea0ba0a66bf1c3f633578d2b3f452a6bda2fcc8addbffa4d1b55ae37b9482370f7ed7ab9a179c21585db3db4ef1ef9d085a08d64be24539647390a5a1e46432eb10e483104166e377392baac5df07cb54e0c1dbf4f574cea57830c528697dda399d653e9a716b51a17fb901b4ede0b51d8f28c22cb9a37d710d98ed4bb3977973f8adae917bcceeaca12191cc"; - cipherText = "a3f836559dc6fa4525e0d3816c51d00dcb8816d6306742c9411e0dcb5aec59572bc50088c40730b0573e158a69c684cad66816f836cccfc292b1a73b3c56241028087f311faea07e462d89ffa38c89d31f7e5885f95a52b6db67c5f213dad38f452228b1047b47c7d6f210e44798bb2aef1de93e8a881eba019ac54545a38f93780683a704d415933ea8644dd2b7186b13257510f6f88ecb5d29a058f498f8d649f8c2b271f7c16ac3a62ee6d325fe7bb9349f59beb6bb3a4867d1e6a501ef77e75194d13c60c228b64fc2d272fa7da049a354b14451b3930758cef8214acc6e86fe2592cc94786ccd62c72608f04ce96dbc0b7027f887147c92346e055e2f7c9f3f581206bb36a80b40564e1d3f1229f3d1c90e14f49dabcfda6a79c59704cd218ecdcfe4e293a5995a1a93c8ad75d31cdb99e3551ad82a6f4d2e36c9b08ef20bb63e9710f67171e81c24a65f085be59a4b8aa6928896599a2904ba759113b60c1e41cf2cc992c0bd9fbdfc20e658fb4ff9ea35226c54ccb8055ab6f01cc963eede127ab8e5161652c20f5ee83accac4f1f574c9aaeb5d14a7a1b68c51668d9f9274726b41b1178d3c75c5d43dd9b0a5d7da7afb650a63b18aa972602f3092d42003f2f3a25ea5f07083326e1ad3d525b5a296d4c18f115d9bb380306923e71d7f8f16e7c0a75b553b79147f6ca25d60a152ebf18ee8d25489953e65b5f6114"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 406; - dataLen = 4096; - combinedKey = "b754261a58c8724054dae33eea0826185c3ca5bbf8afadd75cf1cd96fd00422b"; - iv = "d86e26d2526c172cfc4da0712f0408e4"; - plainText = "ac8703859310b30af8553dcc8ca4d78f81b0eda1f9eb1e59d6a68035ca64964b4eee2f3191e9a73993994baf958c018edeb190ff7e4cedc49afa711873212141f85d469ffdfabc1ee8ced2b975086b2270445be7dd1b92d33e5b3a820a96ae0b3d6f85e93e61e99f6edd4170c331e254fec71606cd1ce523332dc9350f882c49654122b3faa7bedfb9011732fe27049e52631452653563eedd26cea9df7e9829def7a8a08cc2402599bd864aa6f6284aef088bb4661722351bddf830ce223868938df008817d7806256f80e9c750776e5037647ec76b6c2e2744ca5c711ebd859793c4defc7964e0ab37836c20794d31b98cdf107711e929010e6bda216ebb32637ccc298b3634d7a2997529fdad34d1ce5df1dc684ede4432694c6ed12760a504f35c817a88c2163f5a9dca594d702a8a10991791e82bd23bf2c97ce1dda794a90808ae92167e127650942d0ff0c671d316b2e0d8f607fd1bd231e20d63e64386f891f2a5f701ab7b170917aec7223c94af1a68d0f04d455fa991edcf29a36641bed7dfafdaa11a75d13a763d29a58fdab50a8823c5e35e363adc2928551f8356641cb1e557c24c5e75dfc792db215f3102fc7946e0fe8a1d6d9689746aa1f26d4f45d10b2e2626dc34da285d72232410091a72d5aeea967333dc71520c4f556783400e19d7437a6805384ecab3c6799da21f8f459b3f2ac4fe410fce742dbe"; - cipherText = "7581fdf3533a24f9958c7e01e75e6ad750907780cf643e03ff4a2a9f871b218388f46304745573c875765fa613499beda7e93ccc92d843b855f46c795547092437d954b295dbcecaff9154703e5947cfe7ccf66ae0357aba9431fce48cd7e15bcdf46b742de2af96ccc55bca90234c6f517c96e5dc763c1956cabbf6fa7806f674ff3555bee8119b64d48e8e287d22f1c6647683f096f21faa204bf2bbc3fdd3b9e5a81dc6a102deface31839bad71c0f83d6482ca1a749c3d81492c367cd05ad4b752003ff3803d8febcc20ceb675172d537c999cc43420ad9e655707db9e037ffa09124840d877f1f16187c9811398aa7bcff064b64db78f0c59f8919ae24d38b1b3dac9d31bc0955f499614e102a83cf3c9738999e5ce4011d9057653a3fedfe48c2b77849f8cb3225f4cc8995f34311d77653eeecf84c7cb0e9f22be2b82251af26b54153d9d9f33a52f37d4627d2c9df8668fc2ec03f81ef02ba746ca57dfd5c737a4c6116e9f77163efe14c89d9d503218fb310ef4121c6278b795a4af8992cd6b3b5ab2b92adcea617942a008087293fe4e80c84e25949af32a356791229b7f7d8e52256c92c4c3b2d0955f8dea3d1f84fb0e4f7dc9ae8727eac77f97508ab97512adc847f787d2bdefaea2c690243715472883ca907ec992f0db1d2d4ec7b6663983fc3c9ac3f5528e78799645e3bba8eed66e85e934d8f8ac30c17f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 407; - dataLen = 4096; - combinedKey = "dcfae0b73c8878018de987ce1963ff1e1c5841caa0518b2ca00ea5fc320196d4"; - iv = "fa1223001c5aff1293e80cd4bc2f271e"; - plainText = "a2a47db3e14a4b732a3d57bda1dc0a4bd16c7adba339c38775ea1480ab2d531aff652f0785b07a85d35066f0addf6e2a93fd2c3ec492e6115de93ceb8275b18624e81a4ecf891b129fcebb2fd85fa55a5cde30f772783eced4926e4bf5612063c3668fc3011ef084b080cb2f1d116358f7306427d20db41d6a9dda12ebc61856d8b75ea77e5cf28121363289ff79bda3472ec6e1a56ec2c276ddff6f329de45e0ff9e528acdbd22b8e10af4468359759ec08653feadb0466c7a0b1795874d943746258c716718da001dd800e03554791d6f475ceb67d451ee6673d1ac72d7362fd37aa31d58fd439a6443c9912bbbb01aee8518d7db8a04eda0e78e586b43317bd16768c1065394980d0e3e3b084df353d1c4a912703c1a84a1d25511fda60debeddeba1c2e4cc47efd0a4366d168d73319f6e07342f53d9da5ee4600682407ec403e56640da8be9e9e80709896c17556dcefa4ada75db31747ab9e236fe77b4a3c88aadfc185bf424b5056f02873d8c1f98e01c44c9a09d7fa89b2733ca4cbfcd53454f4026f1302a2613862bcb3a7d2d2e354ad4a86d6fb7f7c79994b9f11ff8d847e1cf4ddc95e86b72f0afb968d3be207f49b9e8db2118e49aa10ae932dcaa9c983cc6a30a721d74a51dbb46a4794cfdb62fa857c900fe764c7aaca1bcd250cd6eab2a17941bde216de70f0583e402bede24dc0d2acce8bddfd650fb3523"; - cipherText = "e895904575592b2493539a7dafadfb7f4c0b94c084ea94f5d072329073ba7a3bf5e4cf3a21407091ef02c861715dc8efa4540e0ab2b864d4e3e6eaf6b6c30f2da155eecd79e71e57fd6a35c84d2d45837b96a967b117e89a533c316eacc00fa44677fcaf09eb57c438a0932d52dbd2624206a16c6eede3ff41b05504145a3640c2c361c4966b602cc299fdd4825aa41de37c660b691531220a2e50aad91e840980d7b04cb3069fd53ac95055a0c5e675dfb9b92e2b2395f8e5a1c6bc95aaa177a1676868bb9a0ad6c7596c33c993bbf37b345712b3eaf95d89062528a25fc96d676eeab60e299540fe39a063d8fa3983d9f9b2a60e0a28ea2b577f37cf3a0a30b68cea8761004719ec520f7dbdd9fc5e980ca9844898638bbe2fc4345ee8b8e2eedfd84d10ea08e1bdc7f4f96e174503da3e7c757d26f00086fd5b382e8bc1dcb25dc6135077ea84d4c259d983cc4b5c47e4fc787c97d4e4fe5ac02abdeb7a06c266984d19f3ddefe56167845105f061a710c5388e4698a50995d7c92865656210ad507f29cc282607258a8b771c1982fb37d4d1da5bd540e3e206ff41fcee1d0990c8b8907df0ef6313b2207ce503233ccb827917e3951a7c2609f7d00156e3d6d965ca281b0def5865687a5b423071ee585e444faf25c341a39c9786e5355a609c7fcaf4ee3e36a05105865bc35c3e7905ee5ca15e31e2f60710e47ed35dd4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 408; - dataLen = 4096; - combinedKey = "ceeaacc64af831f9153d3c1e0e664f1ef67bcc59a05685dd31bb8ff4e9959e09"; - iv = "2d8346dee39c0eebd14118bb0745c1d3"; - plainText = "28e8482d5ce77e5185c74b8940a0f9274cb0e4fdfd485829460c727efef34a43710dd39d0789a78292ba37e4fc80b1be7ab99c79aefbf50bb8550641eef3f1eb6d6cf1a400374e5b3be393e5f158213806fb064e17bdc2de31ccba4e538d48729cb734d9a5f48d2c2ab3e93d7df3e78c3f960ec466fa60527d4a41705abd3bec3b2bf368b32b363746873eee59c42cafe85cc5f3bbaae2baf7baa2cac322ad802ca6df45aa997bccbb8bd8498cafa513219a510bf66a075aad55dc814c4fc113e2f3aaf82944db97589dd1685c417bc6da58ad40485f675050affe50af18b1acf06d6b7a6121e498015dda77b7702caff8ba2e77edc5b17ced45dc020d5fc219c035f0ee4bc57db42bd8449f1f7ba1c3c21c0698cf4cde6a2d2f8cf83ef6f0eacf7abbfa7cca839c9d0b3ec864cff3f11482b469c76912f236161f67cc2952413002d13b4c93f3305fef5d093b4739da7b7e527d554a5c861af08b427a5bb593fb8f2d958d3f6c9376638e82fbb1f15ca06c33539ce65ba11a2f61dac4f2c38ae5e8f2c8499f721b87ba4f9d4d980030c2e9df096e864f8d2b88ea6f41c1ac97a5e4a2512125daf38c23dc51edbaea63f3a3c281a90c656dff52044eb37f2b2540ec0746e53a5bab8a2695b96e3a4f223930b87097b3b51e403b1494437eb9b4f3382cf290bfe373c1ed6152925805ade0ae1d3ffe745c815c5e36a3f2e1b6e3"; - cipherText = "bd8f3d0bc94483e7671ba4fd6ce10ce80f128b3d96d7e559789f46599a399f45fd763d58be0916e26236f04a19e1a1af3f73185bff2c0ce63d066fa8dc7f4cb8ad9b202d1bcb52906440af41abb55a59353566f6dde77aaeb089a70ae8cb46e45db346c54c239d792418a2f370f309c4d34e3817dd56f52067d3a553babb89bd9b9ed962c8442516fd8d15ebcff2f7790af2ba6b5be60c015203cef6e25d9ce941315b9a4263acfa3bf5dce8364e75ae1c20710e2ab507eb6e9a8a77997c4d07e04cd0d4fced6e75aac2f78de1c86153382177c1066df6fea074a2e2ea94425505373eb61ba184937f065643c5bac138552f21cf789afcbaf43dbecee23b8a85683677e2a883e615fdda775a5a18757b9e75af126fa51ecf2ba1b57a8957cf469bc43f8eda81b7c1fadfac5621ac5e69554c2a355e040097a399b96a1c1fde1a769c0ec7bb56f95870a252e8327a3bf5d98cb4293316c340a91f09bb881b6bcba496213f0d36118209d222c4018737d8f83911e8c41fa97779a0c20472d7da7d5f2da8342ca572560e06990972247d7bc23e475cdaf181ff46ef6c8b6b3220a161d76d81d2f52e12b7ea12ba484550cc9fde20f88df2b71588b405d92a972373b3544a43c257ead7a14ac613cb9f27951aa8035b3172a7e11e3fbc7efd5195d918aa266440763606b98166e79e3f25ebdc2159603517b9097184daf545de3797"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 409; - dataLen = 4096; - combinedKey = "0eb0cf1d0ca57c7e40ad3ffd80fecdab183681b53096f4e7d6d23ed91edd2ce9"; - iv = "18c95f7732f2ce6b0bbdaf8c2e8a3465"; - plainText = "0755ea622427e884025b7739e8fcdfa676fd176081822cf506c485743863d8b2a6c74435bd69a94753bee14d04a01bca8e1e3bddb7b77f3f1d3bc7d1d039a32053aaa4e1f1d3bfca4b50ad98cfc9c7d8607ce61a958c33d2d370221da0fde5aa2f07e6044a015221cb54a71441602f30114622b149556f004eafad4567c29958451a04d52cba70816281ef77de6aed35c45a8b551768f24543f506ad212782212dc2e6311a4fa5ba57c368f1836a605c585f63f0c5bdfe53b2a0e53ddf409305ef5cde83abeaab91ab19780fce818876c091e24ed0306a2e5ab528379263e34907b4a80a1fa5693a97ed9311b24124904bdea73667baf0fdae59eb629de112dfbfe7bb53a3663973a8037f7113bbc9bbe5be6d8a0cd4bb40cc10f6a9cf04969e6e5b3f5083bef5900d70ddd0f9cafc65b3645ea14344de19dd5639c8bb5f0c17fdd98b5c721bd54122503392ccac41bcfc6bd999ce59b8d6134e269b53ca385ddc011bc09c0f4d31c55e20f7259709cf9b0d50702b060ad7b0bf3f4d8bb0c5fd32f7089dfb335ed98143c4f22804897bd04355d22f574dbdba84268468831784dc5bb46b145208285ae000b33477d3b7c3083d79d078c4bc164f7f98b9c698a678310319a80ea490ec28058f1226f4d628be41502b781078ee72671c5835fc5d59652f87ab41ee4ca964ce120e5b2c8686d49fd6b9a5e5b73dded1d15f893194"; - cipherText = "a1650ff9b65f783d3ee3bf54983001e7b5168e653d9fb04fcb39e0c41c049e3c1142ef8f3286c53b52356470ab3772b7d10bde4913e165b259685c82673be1c81070f7baec8857644d076fb2babdb3e2a22f6a7c09e99882935131c1408870a2685d5be0e338c35823872b42c0cc8ee503cbd5fbe91dbc1f4bdb94925ea62aaf039b61a551dc86f9492b0a69e8e8b6c417f3e70c7eef99281f3a47253b9c4fb8d22abcd38c31cb09925e4135652f6e31e2db307a02903bb37f919c3ce5ce2c8c4664f98cd71a39096c862aeac7bf481fdc4b108082d59af272e9e68e62686796ff81ed3e5b3ee0bbc192b07d6c3a9f03206073b8639fb302d05ad999666bb3b928ce1a9859a527f766684e67b1b0c0a5b42a9382dd78ed8ef005f00929a1cfb643938ecf7b498ba4bf3762487b25b644e0f7d461787c688c58e4c1a69ddbcd188b2f0950dcf720c6f11adb7781beb23bba096f91b6b20629b0390e168b87db5790475fdbfe62bc2e4ead966e401c785537e6ca9b51139de789cb80244c3a67af3767aa5364fa556e03aa78b4ed0516559e966c3b4aa39ea2afb6ffb55bdeb2ac3d1d3b38d0ea78366f5422ac78bdf5910a06b3ea0b4e99a8268630f8e0d9073946cf7f7c4b95d912126d06d7b63f5fbb954e5808d079cc54bb51d9549b385ea76c05c0fdaf664f790c9efc8c0f4e70e1008b8907a9aeadeb1b347cad4787c592"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 410; - dataLen = 4096; - combinedKey = "c251b3bdeb338337062d608b3e204dcc84b91f11d3f04841b3dd286c6065a745"; - iv = "a228496b1a575b04027d768a218847f5"; - plainText = "f3df32541edd62a1872f269a11a8ec1fbc9178652078467006e1f1e1a1595224d7ae625c888d1c7349a9d1ef4c4bc60e4fd66d159e963b824e063d4348833c16ef57a5900c2f60496fafeecd540f165e310da1341ce999a3bbdf6f6c15904ce41885d48de3ff1bc7d102d283d03f976d9c9da83adefb4167ad4b79a2b46d5733287d334437d463ba55890dca8b3f61ebdeda543e826aa8bfb5749500fa2238bdad78e1da73afeee47b827ededfca9c1e664a850ea05353196441201c63b2c761d5ece82e4ce43727fbff0da0612d55265b929e70607d6503742ccbc0ef8e608100a02117e297a16944cd2e0b8df49381809390cf2c2df1ff016d992027fceb6d3adb0e52c94bdb406dee904d88792c2e7af72cfa2f861f16cc7c821c64f3cbb6e241a5cd4d86fe7a2f241d9c2d2034a66a56184d54601bf3d0f5137c2ec9f783a913d2fe03ad8761f0131e6173e573cd45a4a2573aefff812c9d870ce5256659a560901778cba2b54eaaf01be30b9c5bdef43e6b0d7c0af75480c2a00c0c38a8810356f73392bc40749982c3d5ec36a9b70fcebc48be72f952ce48a5550e482df9864b8ecb8aaf4f0c943fe11480e8c0d858a482628b30208b75abae7df5346c3f2b4235523fb6c03e1b170202532077072f57d73c22c77611e33515ce04018b61becd42f59fa4c6ca1bdca5bee7102ffe156508684964b17b7e899aa26545d2"; - cipherText = "8fda3538acd5676cfc25bd93020707f4ba74b90fc9d5e09716cd4d51d4b630fd2f08420aeb379f3a84c9cdee5d202f910964f2e03d1e1964a3b5471127a0737ec39f73d61d7b7e45bad543670ad541b12ef5468b5280511d995991da298b0ca9b711f1cde02efbb785f1a43ac498b6793d0837c51c5eae8d47f128077885407a2429dd141d63f056cbcf48c3387a8dc50ed136ea10dcac55006dd7a24a01e7835fc524955c70bf882ddb0069d7b96c7b08d9df913b7d3c25725e56e910441697712763df2f36548014fbf614e7889feba138dfdc648ab6dac01521348eb2c7a526264c11fa72eca504ec3137774e7a236facb948a40849422e0327b06fe36c20e817e12c6536779b77db5383cc0fdb3e4192f56f2f36c0b386da4596736958c3197beced7e79580a866511329778c4ba194683b852f524b64e4bbc3f43bf741b25c9ce58b13dc07197d0b871248a61c4a393469ef0081178b60a11d21fddfbfda5f0bf4698b073d6e387f5abddd5cf817a96d7a7e596e1c668c90921404407b834f852a2bf2120734be23d36c00d0c1dd7148520c92568e8e371ea144a5cfb1b3979c74322a44d5107a4b744815b1674cdc1528d8dae5cff85035d5ed491f06425675015908d67aa035cb2bc842e9b367760c291eb86196300dd869f5f08f9d44082cf577461897cf201afccb4e4921b42b0ba3c1d2f6e96b7294327b518cdb3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 411; - dataLen = 4096; - combinedKey = "f85abb76c72099d77a2c32e5456bb98d032f66623409b79f3a719f2b12c0edb8"; - iv = "23f2efddb471d7c3402a498614fc186a"; - plainText = "d6a158cda2e50bf147a64f48bc57d7511f853c216fd28520865012f17b79c7ebb320acec29b2f1dff58710ff223c5a929fd37ae85e9ef7a3c1dc3481ad6a3144eb4c329135cbe208553b358fd67d3ef4e22905bd101ef133d8e3299f6f83a0e58de00225b8a97efc43440a63a26ce6d26a85449c54eb7ce11fd4304c907c83e145c162c547cc2004be7abf9255b422d4fa3a5aa2dc8533743c31d30a9682e6cd153774b23101a55273db6187febf962f51428971a9dea1c39e82ca980ff5eb7c2d85715859acae53a21409883dce8a6ccc3fbb5d1a120d150838e451fd96805cd5bf03049e0ac1697347e870e8aa4472c06f02f7a4cad23eae22abb3f0f576345529b078737f924e62f1841935dfc1cc509bdf1ba6f3b0632bbfe7321bca559e035d311f97cfabed574da263d74c1f74efe85975da01cf467f8039803d574ed3121c4576d7c71c8b84c0ebb628712bd3be06351188b4b555ac0be7980e3dd56e3eea76471f641504c1f1db05d01084e2440a5d31e20a95c225001a193a6ba1ac9b041537cfd0fd6df3252a7a6dce7183d9b62f8a0ebba1e5e983c76bdc056adec03996b323f06869df3147c37839f40a37fac85ec749ffb9e9f6d94c2359f2be186411d7ed178f3ef17aefaa9271cefbcd1162e6ad44a8f5e205494ac8475f09edc108e6dd2ca0a386f3f7b053128a5f0c9646de342e95654b530843f2208f76"; - cipherText = "39f552b9cd3ce9c4821c74ac1cfb9802c06d93f7699bee0a38d6f3ddadb0c19111425fe6b78c7013403166de2df3b83aa904de0c1600a55d381eb1c1ccd6b5eb3b57124bd26fc2695c47369aafa6a580d4e1ab5fc9926e543cc89f4e8871a458bbd7e2a4e0e673e385f945ace945fd2b3aeb142e747bc1b550751fd67e7b7f2e2e0bbadb19482b70dd6d49725afb3562ea86f81cb416219b7505e07f77aac2df251eca180c40e65ed11a754086766b3fddcfa58074098021ba041ff63ac4494316936f61732b9feca94c953b7395dcd5c45a7f26720e4ff83766f0fbfb9548d621572f9ba14ee775135a50bb414b1baf8e502f492c682796ec49f3c2a39d16d529a2bf0bb3bfc292b9245a9b74d3026d90bfb5aa53ae72c616fd8bea503dc9012ebeed4c0030e06a22442a33df2e3f3cd944431db27ed598c0532c604e1b6ee95355a038f0ef382912d8c357f9a83015865cbd80c7e1a57a39635f4287103b5b2c780ce1f31738691f1123096a8633e963fbc74c9b4fd700f9428d7d23c7235c58c6ec165de7a88c6917147dae742bbf5d73e461e05778fe186043c7107f1c2b80d839a6c458a58c7d02c52fb8e2bd05df60094c76d99b6d61515f265ee87b07e2a711bdab76528e916cdb60239acc85edc598bc94f948ff81555ce76197b15ed9c7f1c2e3f4da9c174cdf2ee52ab03825432fab7b1052389326b82f04071669"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 412; - dataLen = 4096; - combinedKey = "5d416dec05f741b760a210763dd829de9d95d0d561735b096d84a2d8d9e8458a"; - iv = "8c99757cc8aa63488b7dd104448e1388"; - plainText = "940b4d1e035faeac494f6e2c7aecf4b67beed914f19245184d1232f88325bb1229c118092f9a5bab52f0377d51ee7669165db96bc70f10e60a625cfb4a9d8182ab9f066b135ac4149a45c321bdf5f7e494d3c8d7f4db9d0de91fa817e9de5b87f6d73a1ca22ea898ed5d10d3df23e7f72a220088785d46310b4c3b14dffe28911bed15721e271ac9b39fd4128fdf3fad060719d746e6fc4603b5b31e82e362aa44ac88825ed940873f8f13bbd8d19f335f0e981dd51da91c4b5def410c7b8c2a29677c54afb7dd1af0f9cf53c6df7f9bb2abc7e7789e5d04009dccf63a05d75c37472bd95dcaeb5ce6c5e750df5719f865d75decd555aafb7a1ab31ba05cdb2c92cf4e1841ed79b3c2341193076822dcd2b45600f8cd6360331afa3cd9679d1085e3bb4fb2032a4b71a6d5a49d81fc5f5bb478428e9b31323dd82d3c71ea2dd01a20a6425aa8a21541a8dcd4cec3542a8797af598c7e13d1048cf596471ea59d3df6e6064e0ae81c63cbb8ad3aaaebc48d315f218457a7b297e1219fdc015328b99fb4042cef7a86a2dcd75b4c7ef6cca2764c7e38d51fa7d147db4477fec3f063d8e1d0b74529375af41971245eafcffdb810fafb34fd0f99fddfebf1cf7aa491ba45a87e07bd0395604927acb796b9fa3de795e03e771241f9e93c36721e999064420efea7998749efbdcfa64b038eb59b7583452b419e62da000c9ac3484f"; - cipherText = "b719117870495b095778f17efa0221a33f0b1dc665899dd23c213621c99182b73e44ac526423060ca386d86d75b86bbc972fa4eeb9e1d3f3055580fde26796ec15787423d89132733c934408f8bcf7b20c105a647924319335a0b0d5aeda3a4cbfff6284b25889e98298984f6170af1a269b311936a2e75c00f4ef3be0a7f712b58dc63b7f6a3268ca8cf87ded14495597f8f105962917a854d02e593afd888f59673d785a3d2f0840108c02b8283b379b4a74927f70006f587686d80e13e276f7b62e1b338760fbae241d20aa324a64ec24f806d8109e8cb83e405917e9613e3b63227cd9c9df220992149580004c46737b31398e44f3aa01eea6c9f0674e551553ed3da577d3223513995b8ac491ce77e3f62dcca3d180e8ae28e1fe65e7a3fa7fa2c165c3bfb097249d60e0d535298570d77eacf08aa63865ff7573e71f38d435cb56da8bb737983d495894aa285bc44b62a26e230a6b46bc7c986baaf94a8e30f372a29ffbf16231d4ddea80e2757aa98e02014bf05fe3f55746d6ed98b1cda61703034b8b8bdc2943b893dd1afe2630bb7d203436496d5cdedf817791db74a5b346a83469a3c291b936844030cef9ddd689e3afa2a01551c3475e9737bf6f3a28dca6c7ec07cbfdc28d715445befd7fe4ee4111ebf5f6919cdfe515b69ecc872a5de512f082d1e7c230faeaacc2a7614404ea7a37ebbf2f86339aa7cb17"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 413; - dataLen = 4096; - combinedKey = "e41f1657f202cfb3c7fbe7dd8daf6b73c2aae4a38ced6f9b966efd8d9c241e56"; - iv = "6d5c80971cd19d2f57a2b7b97724a39e"; - plainText = "705e8d95fea2cbc9f35c1f603b9033c5a4c45033c8e937ffd162944ac8ad034c51c4882a2bfc9a5c9b895c929d7da554d531a2037f3635c10731c31379ec37af26cdeca3f687ca2eebc904185e97247c85df6aac0ea98f8ca74ea48772637b4bb83ff503a411db9c11fb986a0fb8e7d2b59249889669ca7a2770bc008487546150ac37a602a6f0801011569838f0c3b41fb1d21ecffb691159c0c2ead5f65861160b22787c7818ffadf1077a3feb7c504a09433a2935223a8d72b9f8a9ecb50d1751dc25b785ad7cf4658d9a7468bb2d4518ad0a6a175dddfddff95e50324946762bc9e83fd68c01326ad5ef47883dc334c5d29f4e44aa045e1f452559896a9fd035ae41ab5313b4fea882ffb82bbc78ebc02686726ca5b3375b4244423d2f46629b4f1fef06fcd5ddfe6430ed6cb578e66d41f6149a132f7f9c2c46a9fb63273dd97afb63e2dd73c73f4cecc3199576c3f281c9aaf01f548af45565d47a894027cecbdb3c419caee3e20d70e3c6ca77ced0bded243be35669902b1f25ef106706af4513417818720b15617c1ebc70cee6f3fb62970ee4001286e5e5801483a5fc07f62b77a301229e05a4e0c549a463f153e40e2daa2fe4dc1c6d2ac6e0c032c4c171d5f5fb2bedf62602f88db76a0e570e6e39dabe517751b7c6bddb31b74ccd1da920e36af7caf2095f750eb8164f7b51e6fd023bc18a4adb8f0aa41ab85b"; - cipherText = "1cb93d2e69c6b0817d1e26658754bfba40382a3c0bc73a613c9d14515808fb069f149ebe964a134fddd387a89ef149aa4e7fef33755fea6a15728ccbee27037b4263b7d4f4b8fd568376f8ca9f73d9cfebf318ef26c2e52f6a423cd366172a7cf3ff135f00a032fd74b11c116082255d2fa36d36a7eef75f078a680884f3dd9beb8ba74c71411372d78444201a73d420ad0577189ee2e6a94d6b9a10c4ec8b76de7995cd199aac6936ceb83b6991d7095d9d273cff6802755d7386f78b363cb4f4334fe953c71ebc80726cd5a7461d1b819df7262268c6ad1221310121ce5b9afad9986c7c42f97c8dae8261ed6b18b75f0a983c0538e68576d00187244354079389cda9232d75c3709f2c3135e2b9adf286c05b147bb348ab1f0b2a7ec87547d566415d2d95b27eddf9b7a611d33458988a3273bc0ea807993ee229bf573d93e901be360f1fc33414285e3e0ae837fe6ac44c7f86790e1e7203eedb6ad7e8b5084b8fa2c78165a7d2aeda63895524df159e4aedcefa257d5bddb7eaedc50e3a4ec89ad7d77a7d42edf30bdbed2c844863452fb634c0eb9fa4f7f71e84cbac633df1d042b5ae5283bf47eb4658365d4c8576671a0bb6033cd9aef1e924135a825ac8b7f5059da3aa6b4e97c1c48cd7f2b764e435bf15f09db514bef22829a65fd179a577b8bcc7b3e6b8601e235f51ce4d20d8938767a953c18c1ea120fb71e0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 414; - dataLen = 4096; - combinedKey = "c6be1cc30af42fc8689fac9f19f010ed4f1ce0d9de740dfeb84683861ac38cc6"; - iv = "2f3c153bebe6ad3af0355ed00943a8b8"; - plainText = "8a9af2bf69684ec243f3eba275832ade4b9fb83e72fd7c85a37261ec7547d1611cb6e58d041a5c7c394caae491ac1084bdf3fdc418f04f5cfe72c3d7cabfc5368105948d48ae788c379b75f670e5740f97c4a690310d24e3fd8a821e22e3670e11db55c7c775bf8783fde379e770e3ee9eba840b325e89ecb6d5125ebc2d73ade7eb68a2167f8318012f533e7b5694e07f377b10325da63a63d52e2761469674d16819b79a447bfedd5ef8f66b53468efb3b1b7778bf6c587d4c137e78b880e812dcfa4d26c2747848954600bed1b9c2ea406852bcfef6b9cb910ca0294f37d955a65db1e13263dda4c66961493960aa43858bd7dafb621410dc5479872a5703bf9da79fb610f67d5c130cf015d471575cf2b63d6e443c8862b8811c8fc5ecb810aeeb7fa91fad03d7e69caca77a232e2d21e152a4c9f2bd0639ca67669dbd05f18eb32adb090886c8e34340abe3e5b61b4a218904b95caa729c5711c41d97cdbee71434f2b4b58abaf0aec86be1838fdaf411ae6034fb6294401af6c53fb50bece5042b45b927a9041b2a8948ebac284095605a709838b974f4bfab4b89713072d2f7c746e5f75ae5800342247e57842f3b8d7b187e41a6671cfab420b085ce7b6c16d77bbe627be97a8de3b841e002d61f25263d47527cc829cb866c42cec7517c4b4fae40670589a638846ac5aa99cebb86835bbddd61f29ed8f004d2eff4"; - cipherText = "ec69b7f0075b10773796918b75191af62efc7b7c065faa2998a1305ce14f681ac4a63caf27ef93e96a1bb85b08df22b470b186bb6d35f563b1892a7872ef62b9b48ff0eb50184a5b615526a649e7dcef0052899f5829ebcbd8f0e4922c29b994990e0471a8466d924d3b96f2b57083e7a5f035daf9c9746b53d5dfdba7072a9e9d576443b4163d688f50d4959d23a4abc63cf8c7cfa420e016b30ffdaff524159f935de5bbefb96c599c3a161d44cd1fb75130b0e64f15d937c8cbeafb06fba09305c8b8aff882fe69c867fbab65d439bc885d1b4db0149bbb2b0d223abd15baa2a41673b5e5ee7fecb7e77646ee9c0f7999c9dfaf284227bc14d1db3e8eebce2d3be589f71d14ce1441bb5a5a44e3f2b8e549589ac77369f7d5dbf15b42fb8e357120437b4b3cba0e58ba36594b3908eddb846e3491dc2b330d0d259dc4d13f11c27b7c2c41a6b87eb052a07eac35149ee2ec9f220ab7805391035aee0e58d0c445b36aaa1312f6726011f3b4087c59da9f70d6f0cdfb6c031e6dba14ee3f4fae311d341af11e8ad260b44d3c0829fa7cb1109ffb6b7642160f438ce04bdab3d959dcabb2418cbb61b76d68d44602709a8e3e375d0150a16d3f49dca44e17ee5ee42c6dd2883b2c1db985d9571d1efe6cd838f0e6c6d6694abc30d1a3ec7db89bc063606c5249ab8537eb27b0f5d36768aec635ac4c9566c0c2c3b3f9eedc14"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 415; - dataLen = 4096; - combinedKey = "114ab485de4ca638ec8f13c267fbb44fc15eae1476c956253ed453271fc9d137"; - iv = "f067b8e98e03462432dc177cf6fabdd4"; - plainText = "28b90e27a189f3f13235c99010b8af2a24d0b79de895a5d8692f34b6a77ec101f0c6bbcb98cad87e98832a96938f4c5fdc5975f0aa4fcd2f28e397bea542b61ffeb5800d791919616108b1a9a0aefb419e091c788334ede7eee0dc3b79343058d40ae2c649fca91e40316daa6c0094a578eb82d2c3683fb53500ae6d2515392ef445eb37c3766240a859e18d218e81332b33e60d715b0ca42b201d589ae7398e792547a02c3f80b6f36ef719ec335d1b88edcdc0ffdd804e218ce3c2d80b28625079e130606d85a915d4cf1a34457883b7e689717b58ee89da4e445cd6575f76313d682243799695e280b9b6c4aa8f22b99e2b6b8efe83f7e7c0a49e4c21df15cf4fc2cffe06e1c06c5bf45880dec25d1a224696a6701fbeb292b2fbc708d96893536b358bef2e95cafdc5fc0aaa542efdf342122ba6f1266e3e13fee99dbe1c12c9a5aff5fea83b831e98fd6e49be1af26cae1e8d0a430d6ffaa42305590fcc97474010f7d21a9242e5e8f09bc786414dcfcf129114b058455016b74609bcc659a275337b73c582dea9bdeff7b44e7734b68921dcdc7b0a2c84686d0c42f6997240dcd31fd4e86d82d1e8f01e5625636fccdf5ce5f0106d1d088905444ca27602462adfc346079acd75c2d13b4f1db110dfdbd3a8c55641c13545dcf697935d331962eecf841522428f597c4826929b7bc2efe66b9bbcfca382fa0d745970d9"; - cipherText = "5f5e4dfd96a96e4aaf4c471ac68879bbc709af5c3ab88dea06387630b839ed6c7d068d1529dce9e8ab324c7a021378dd487162968fc4a1470b0394ebae5b870d1e4bb948c1167c4b9a11265baeff6c41c9fcb7b3e8e9c8eb62e1462a2d75d763ddaa4a06dce09ace871a76d25cee177cfda179e2953a2f236e28c502ed015ba1db6fd4fd1d7a2b53ccee511da1e1428249a40cfd591d4863057bbd064e58ad927beed072e45ffc53410e0a663151e4c6253aa2fcd54413aa5d9e956c1ff1e5856c487e53b908f63e2eb1e391f702253441a162db0da7794dc4060e657426acd08d06ad75190652ae5be2601b690986839c2a76b5c4f2b865b2100f918a254e74ac7332452727ad2310ce21e0dcde3775e92628c4e30bcb82e2d4f4a07a40b202f3e4a09003a178680f9c21de139a04b8c5f941cc89c60cce7fa91d5185e7ff8b3b6dc18a1d44b166cbffdc1bcf0ecee9009133aa93319628d3665b95648a3cb98601184f00c06b6efd3fde3b12271664e61f61c2c81173eb092824f679d62934d5b905f42773f7fcd04deb397cf7ab86c396f2bd6b508886927bcc31cdd9fa1c1eda2733540d65d48d16f500c25ad25c7cd75dddc1a98cdbc6eae24e1beb0d37264849db7a1b8cc26b8d4b5e6bd0e04d3f8484133b49e1764b66b083d4c532d8d5b3c190f359b34da04112a948e757e9fe191ddefbe8c5ff925e8863fa0808d8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 416; - dataLen = 4096; - combinedKey = "b8439084c248409b1c92689cde226dcc0f32500901371fe41271aec837adc644"; - iv = "2a84edb77b63268d8cf846c91613db64"; - plainText = "9cf200dfd2b5ac261e63db228b2c54513d68e28c88e4189bd0fe1175bd3341d646a0c7da12d0e5dda7a03ca4e0a3f4f3dc32983129a6ffc0270c7e07bd29b7476a213a9035315116e87410537586fdd1101d7ee58da7075518f7e84604e768cbe67dab4d9d5bbd67951119d7c8cd6d73eb185c296aa38ab63b10faeb234bc63c9581dc798a71cf4418af5d9da92cdf8065950fc3a530c4b9a21707b37af1f12cb0508853ff8fd127f79895b067161342041d1736192d7506505172e32eb5c9292db337a23fe60c462db603b0189be821716721ba22f1c29a029d9b060dbc8a8d82738491ab9beef4085359c16c83f46cd08503f767a3c872cc948512e56d36fa2a2f9a59c31dc129a50ac938cf1e3e056368024567f852fc4bc8ea3f89c269ea1af2947ea7814bbf9e5e51c39e5e07c726e02baf0d857c847ce67012bd0568613dbfee3649bd47fccdc1b4a425da749e6a7e8b3b65f4ee6869d859b56952b48fe2f35d7cd681ac44f8dda2dbada9a6415fcfc97bf3e47edf6d57715824a2525be6dd2db87c7a2956e99b9b7523237dc6d1b22a43e0d1e0d34a635e335a8104651a9efbc74f94b6bf05ec80b3df44d5bbf6c5191ab4fd866de56654419455e7cb0eaf3d4566898b4db3af1e6c8deff96c552a3767e0b1e5abc82eecb8fbb824199cbb495ad14d6b6426d9b9ae3873498234e9d179da988d66da73ab5e87276625"; - cipherText = "ae467cfde97e40e540a21b46cf7c35f0d66d3d9d054dbfd5bfe9ec8e41a85c4f0e64f3a1e17bfc8981123d124ddc631faeaff9273448524123c601875da896c77ddedee8bc592f9f10320db271ab9914b21b8c3839cd8988d02a1e5191a47eae2551915c9050477b0973be8be27775ad773897c098ff3cb345cd72299adae6edc03fd9b52fa755aa0a09e6d251a59931a498e1be3b71c4f0395d250d4ef70cf7dd2e525736407579d6893c614e9f37eda1fc3dd67edb5fd949f885a168d68ded6e8421bea32bb10ec28b703b9041762bb6f81b63d6bc2d8111445b36f436d6f2138e244a1b304ac2ebf16196c09a275d298aae7313109a96372d4184bd8463419aba369e0644913099391b4ef4157c8954ed94b0b88552fe600d396f0f9a0e937038f4b45a0692f52957160e80f96ee7935901e8dbe32fd1d0c239c95d21f8b445e150d802d3518c88767e342a365a7c874d7afdbf4dbc5add15bf572e45448716eae763b904a9c44f5f1605e6078d40aed4dc9d23acb301627d2cbf8663ab84a81f4eaa86d7b4474a41410fbecdf83d72ad6b97fdf7e114fdc9ad603ec20d8769e5c31ed754725aae46d56e76d1406e575a792a7d8dca732b9b1106cb33166607e3d8fe8f13bc3de972ac5c0ed1fb11e567a853f26ec77f63d6df6a050c35542484c28934836d906c84663e94d2a451482b2d9ff41affcee9b270919f03ec84"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 417; - dataLen = 4096; - combinedKey = "be3ca6a47c962518bb21d7e67f259fb278383eeb5d44b036e30794c3dcd2715f"; - iv = "05369aeb46ba48bd01a6ea7a4f5e6264"; - plainText = "c806120710b6434a55c593f5a11181ebe3e62983a4e41c6086e9db5bfdffda73b87af990357882bd8252ca55f44ed66835a2eeab7a9b9049a26646c323cfcb76a42075e585e609ba686628091ebde317252248a5264f5ad5d79930694b14f392a3cfed48a64a17e8cfb6905e168942060ae4520df582318fd1a3874a7fa3e5e7475088e752fb0a48bfbbbc4be9e2e9e332e2fa85df945481fa5991aaf389b51ef8566c29c9ca71c3a5dac261013c22adbf9462684c4539728e0615fd6cd64c167d47a20d299bbe8e23d0eb92ccc447f613c7794afa0f7942b18f3cdea193bc6245ebc7fc00560cbb8672a685f23511ba50c60931411eda0f3a6ec243d6bc7d8ad515008b206a33cadf6b69259cf1b3a174ce63c46297d3950830c696aac8fb11041638263249a6470350175a40f3a054581221fe9d87dfdc8ca24843f692955f0356640bf02aa7e7bd3a6a9e5b485ac25e9117dbe8da336ebf5e83efcbbcd20f96011f99989ee1d31779b72b18d3a203123024e291eb3379c73052c7ef1e1230bcd2a2d02e26dc2b6137bf5f92115f0eaa3c22128342a9779da36c9e67007479f01e5539748a8fd45a3825832b3a38030b7f2f3b099d1a1458d54035629981ffc161ab8f7a89859105c9ad561a2111bc42d430b4f418bce9c938b72e7dde1eee29c238400cb0dd3a52eb8ac175bf764374f125706c43eef80170d2fbe245da29"; - cipherText = "e18b69d617868a66fa54b624cf5f4ca9e9698890c5015dc3a489af6a482d9f3fa25ae2cd2fecd871ad84bc0b7f146a7e831e3567fbba17412c52e99e523192ce5a88f63bd479586c43c8d15efd96034bb83b10be7d1f41b59aac11a7d02c64aa358773a73963604646eac401fefe0c1eb009497589df01dc619da800ec56ed56015baf5a30240c8c0168e7d6464d2f25b9aa2d84a87c3d538f173e5113874345b3239a5ff78f3955791a0721812123b9d0c883ac3f6f0069384e43269b3c7bed07c91445d2852ce9957608c6a7e42f92bac993fcd87d73e1a8691287dc4e64d746800984b0e76eb0997290d1c9e4cfddb43531b56301ca88deb03c82d2b9df71d1f57f7a74142c5f818ada5f00a0f556cafcf12d40a6ee0b47d8c9474ab7457fb16960d874e73497e91977d7ecb9558ea079416d6af4e178b77c2dab4390e0ecaefc98bb783857086436e1ab394ec24333fce7eb771a180f532b638ea7fea8ccfa47cce11ce3adbba1894f695d339b946df7f87948b1c10f06ab85e6dba1df897665419cbfc7effdbc1aee51d4a7b554211b3d852feac2cfdc8a6f43c0433799b8c80ab94c7dd1e559f164e96b845accf46aa8984fa5ba64ac11293a22407dd2b4041a8b182dd6a39f8c7221f41c1d4d7789d7b2e386feea7c4c498cb083fbf08c0b0a92aaa15d921379790429bccab5beded9836f1b18980300a808da61211d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 418; - dataLen = 4096; - combinedKey = "58f12c5b13f854c7674682eb19b78c3da8dbe330c9175eec244cdc4cff8f9313"; - iv = "1d854ab2593cf694efcbf9e9fd5fda33"; - plainText = "9174285bcd5e7c992cf35b2cac68869ac1c0d70286defaee54cd69ef13946cdd7cb65fe365bd1833ff3b80ec1db8f084f9a0fdc6a55d1c54eac54c0028187c4657659dd1d7bd2fc8ca408342a1a957a709208af3ac611f2d88e3d34930cc510146a1e6da2f38b13a8ad39beae1cb497b3079302956516ecb7cbcb27237ca7e163966211d371ca8c4b42b012d68019d7b967ca11e5ed628d20cb47732d779a0835d8ef251242282066f5a202b7fa577f6244f2f1c9db9afecd5ea8418e2196fd4649255cb09eda2bd499ba88e06d9e08cb1164311b401c8920c3abcf67d1faa253c161bbe1fb89ddee7a630c779e5f4115ee708b7f15086669107576680e6eef88e6ea80b9a24d4eb0ff0cea5de1ddcbd1ac68977eae30c73b19a9d616c2af14fdb13bbe851d848f9ef3af7feb33b26c77e44a8aac3518c3a2ff0402fc05fc928dd1f6e586dcb54309d34dc5c35ff1e12439584a7f66d28032212903138763f9a38d57b1b2d80525fa68936423b11ac520be76f5b4bd41613e8cc9d7364d8cf0d0ff3b9dac1ea43b78fe1d77ceeb622f4516b1b4f216fd0de17b81b4ebd11d26d598a50c97dd5b104e0bba7bf5a312b1293f3379b3cfca4e6bfa9026faf5c66fa4596b38e45c3c783c65460d91ba18ef4b76cb0ab124fa9460f4955039b36fc68841bc82d5391ec13fad72f9e69648f69491bf1b32f73f2a83e86783b2aa507f0"; - cipherText = "8cd1c04e660c7975858cddc35c2e1ddd8b8c6ab84a3813d2f455ca4ac1990dbc52c9309bf020472220ad17a358395b6908b202a9ce489992a1c28b454ff4b69dd3a0271592c9b6f9f2102d0544e2968d507dc5fffa42abf5f6a090183f23f9a8f59daea46b9ca1c36196052a883003305c3873e36920a5178ac32a1885ac6453803907623590c31ed7ef12b10dde9f349415a75b3f5c70d02071e8526e32bc1aeaef34ef74735c7ba64a093d1dd8fe5467a8209157b85a1d09ffc492f638349a66769df233acd1e1247782f8c69ea9da116299525c7c5b4d1472ff43e94b88cf9b1c884a1f75df701dacd2d8b26e6222ad037b5405bd71ff63c51d16d2cc8da825ef49f6b254d2d8d59bf014e063f0103d908db4ac0da281ecbd96f0086ce4375505ca9221b8dfd4645975502caa87eb32be5899466cc5cfb9b1b92041bb46669ed0ce1df8e7fbc9064a70de94849b9f26f72b06a6a6d56786ff5ad2b30da9d90e3254d80a7619f2fade2476baea0e46615f6c155de32968ad91935c504b306dda17f6aa41eb1c8a18a4eb0f5eafa1e207c38f0a1c4366f6a4479fb92c50fa95c6558193e36006496cab04e66e207aba529dde83124826aa8ab4f5059960688b818dce918017372efadea7bff76204aa018fa381cd12874466e090dedc6d512331524e79a5de169e69523e265dc60f97d9d459106e21c220079dd67efb22b84b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 419; - dataLen = 4096; - combinedKey = "0ec04bb4d95f3827649c1f4704129aef136f7aa5e2cf719f88f93837feaf6b72"; - iv = "938e4f89c4654ec700cdbe5dcc6ff21c"; - plainText = "ebe3522bf0b8167fa4e7f2677c6c589d023f7c83e7d783be72c50bb36f7370dbd925f24ed484e1c5933acd2b07d6520930c4539a893f7f41a7ebe09b09e8b6e45ce0365640c36fb39b824ccf461c714d489181086631a84ba5a60c6dbfeafab1d14e4bb252554d3c6524dc149c1aa875afdf493042080675e3a23b0deff6286bafe3e83eda823ae8aebb35385e43d5aaa0bd73147b29892115b4daaa7069d8c5c4d0c29edef15402a7ad926e15680d52ab016de8db6601ecd1988e640cf35ce4491d6510e058954bbfbbb47d2c64880ab46b1f29be777f3dd897d4c852d3dc4454113cd777afc60dea1a2d4576c5a7f37a2abf63eb5dd3b4d8d34354f56b959e1fb5a6ce8f4c775acc37df7cd08e8d48f79e5c68245ae4944b934c942eea44bcf1d65d5575200f092c7029af2c907d2279bf1063a56206e5e1ff5da915a97879232ff37b5af5de70c0ae3bcbfcddace51ebe4a5216e459b696609998190a55b0387bd0076aa2802f88e474cbd85d5a444585deddf8703ba7c42ade353ac5184248055a57bea52e6d5f36de27be4952021de59452097ad8aef4bc2d19fd81dc7ac5841e29cf6a21e49f4d7b192ea5e98a6a4e754082c41d6b3eb07c99b05a68fd4711d472ac83f0be496f4e529330070ec334ca6cb3fb791e8c0a63bd5dc81140f28718d78ef037fd3ce41417564dfe9edde86163b508e4ea1c8834ca296407e4"; - cipherText = "1a16d2c7d802a7603c8879165233bac322f17e0a5d4ef516dcd13c348414db5b2bf92317760c598d63ad34e90ec2eb935ddad3e769ca15d925607aa2a2779b4dc8b1a1fc4a2ce801dfc0551a18d5c73fbde44a1996ecf088b1ade31fe64333778bc847ef383fb3689f941f300667c17032018626015f8ef498d2ab1144e6eac2f5ab9eea27d2bcbc22a84c5483d4c45dadd6c3e856bd4674a4fb06a79170de345f4c7cc4e2d5f5302cad2ec04ecd169e593ce93862d784e4a5cddadefdc078b87a50bcb73f83bb6d4bf610d4b692d6ae3510baa96536725b7fb73b281331c4a272983d1ec6bb54b7e3cdab2b7a6c90d56d500f279729c1c985f26606f8f97a34d8d2dd3e11e1cd8c6525f954a8b9d45534f0703eb2750a4aa137d8f7566549c3501f919ce8bb493446183e08abda8967da5429e795d3b8120c2332738fdd714e9af056003e4f3c6c8efef8acf2a4513920e056f7ed60528709444af7c3211089a4e1477a12aca0d5176a336cc50d87621dd72bcbbe8ec8c53c5c7344466efa652c0e85c1ae7018084a74ed9578f257f4d5d455c9a76697f7b061f99f7f7905ac6ed93755681bf43474e92f50bf0cf7f58eae3e0959a125368b7be1789ea630f4f781c7168564fc408c4f07b468c60fedb3eabb2d8e71651bf7e002c8a68c9a167d2e0a2c1fd9e39f31bdc5134c3ad83a22ddbd5830058ccf090fc511552aecb0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 420; - dataLen = 4096; - combinedKey = "75b04f2df5e54ed67f98b7c16be0310b379cf230a0e7e0e4e4a2b05a992bf4e8"; - iv = "5ec3ac82be25f05d80c60c6599eaa109"; - plainText = "b65f622f14bf6cafe65cc3cdd055466e26ef07ec74c1e96a51e668e72e1db664ee5b96994906923e1bcd37ece3a9687cca58c2d2492d77b2d4915d8404e9526b4d143dbf68a8bea9a8b5509808763ef2d8edb664f303111dfa5ababd62e8359a0b959e91d64db17feea6e2e321108e5f1bf5249726eeab7e567c7087e225b8175d49ee694bd3d18bfe3f807bf7131f855d5d8c5cc1c7b67cdb30825a57a5e340f6a9052c646c79a47526b06a59bf7b51bf6ff470205bdfd41eacaa5c1d25bf08d695c66643223edfdd53023233a9e391dbeeb391fc99a949c3c96b99cacf871cdb8017bdf806dbfa43744737c097f6f233d21d5d7b1c181c26b9d87735b40b3925e48462f79b9dbf5fc342b3ab698635f1fff82845a724b71df4777b19d2022cb06694acb0636da938205ab18d176dd28d8a7f33451f66155e30f55367d23c517f6a280de9a3fabc6c2507b40c2cd6b44e7d935f7cd49e7b3631bc2c1a0a2a7f6ea7d3dda91545b5af04b46daec723459050fc8ae5506d15287aac7677e186409dbc853e0da9af4fe727fb8b1c3af2afbc716b2777de379e2b3908e3bf457a90d47639e2306d2918b1676068178849ae1bf959b383f01017af6a89b3449ec54164f7578db861d5a5faaa3f05c88aa60af40f68194aaaa9e118b0af92d8a158765649812271bd11b54129b7cca6f37d67af3acacbeb85688e8c1298db37fa0105"; - cipherText = "1e409941c9622f0ec67e9f3d91670bf1c194fcb8e3d6435000307aa1e9607459442883f00a92162f97a3b3e6ef9dc5603eaeb6bd5b62623c318aa0187bc67c66222f14c77f6afdd732414e559748c67fd28eacf155cfb06a942bc0bf5dd28aeeaedf94070ef5e3beeb1de505700c210e7fdce1c1630f30ec01d4669934c808595f14dfc692fb900bf5072587c3e4fc8408bbeed540ba4f3ebd484d81b6520469abc7dafadbfc109f2354159d4a1ac6ec42c2e2825a3f7d4a3389f76c7050207b46f5a22f9a44710c45368fdb45d361bebb558a0e57ba0eda130f2c4943e064f69109b74c6de95f09331a81d66b3fd94dd66f89e23d548a0767e3b873dbcf265f1e4bc12080a75831c116240bc0d13ce5c0692a6e86e2051031271db3d4f9d422dcb03f1c678b95ce3b61914947d7ff279fc59e491a1d8e215cb72c6d0bfbab8edfd2ab5d822fdac84bc84fe4f620c85d26381e0b23bbf8bfa70875bf8c99cc00b782892eb329ffe1463812b6ee40553ffb2068be7423e45f58d9a53bb5a3457f098b10070f4a76edcf4e2dfe49aa00fb88de609c9fcb3fc16ca8d901430d3b5d0b24405b1e4b22640e924deb97c1e8805ff7c5c65e2cf98d9d052d11c77bad651de7ff7212778ac54e3c9f1688c15531c79e59bfd421270d031a5a336fe5e199633c1365310ce0f631c60359a3cefb1a24686cc409f2a911df7c97bb63f0dfea"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 421; - dataLen = 4096; - combinedKey = "e57c19c6d08a5e39ea71c0003db5ad72d79c7762415d0b71c2cef4bc458ddd2f"; - iv = "22208821eea8cde91fb47ac7f9f49348"; - plainText = "fc197329bd3265a73c5d8f97c0dd90308998186e95ccb7e85c0b40611a5a13c1cb5c1875d94c379739b26e312730beeeeb26e1fbc75cda3eeb1d02f29289044798be2ac0222be37ef4dd41fbfdb83705c6766759b17993e5b1177497fca71380bbbbdb125f8ca23ac3959d970fca7d16074c25bc516dd6808119a26dfe21551c4715769c7144598d4545e072cec194c52d81ffac219facc30f9445f067998e2febe911fc3b738ad5a94f56855781e8cd02e562ec3ca24f92aa6a4d03f1ef6532cb4f1a918e7e953206d58063924f0edf69bb2a2fb7d5e686bdea5e1f24df26ce2fd0c3bdc1cc91765f04e07c65f7e11fb62c05034be64379ec474ed20f39945e2ec34d6d51c7daa172015144128026a433004ff0c587ae8ee13c961d417716a6f2e2c6e1660331be986155038c284963f3f8ac9b08ccb037eba2bae46f7c514248ee7a5f07c7aac17a5f8ff4472668cc7ad0bd20af43f81a3d8b8d11a837b3512c29bb268b482e76b1f6142911274141dda000f16282964fae7a5f4c078fe1adbeb9153c465e7dc54b5030b0eeb675ab7822c295b198cf29da3799ffa52a397239c32880bd2234115af69fe85e71c458d6d9b8cc807e1026f73eff585fdb14c3980c9af939e442086c89b7f25dd07d112226d241d1c9f9379044349ee5a9154fa3f26fdd2b2348f4cc2a30f46d06429d918eb1e54a97354f6fcdd621221797cf"; - cipherText = "b5816b2f8312287676fe43d6c1fdd656fbc9383df2833c2d657552a9aa33c36a8a646d5ed6d2f414c42ef18674320492044a364e4b524b052172f83d3f97e5c4c563540bd1bbd212e9ca2fd84a47177b51f9a486e4a2462e48a0ae022aba3a3d5d601f498407ab5ebb625171870925814befbb935ce91f6c5bfb0c9ae0e6a5f46436448e96a0aca33d698553b17fa2b7dfb281a98136e0590286cc843ef2c13d56b359c4177f413cb8322d51d7dc0b6613f02a8a0e9809e26256a82489a1ec1386b281928af657368120ae7cde8cb8f4c52277c1bfabc57fe59a6f975d6f068796323a0d6851749dbfcb43e81c37f53be1668a86f8964e342dcf9219b57c9d87687c89c88e4455c55c16f2e2922e5e54b9f037c06d4ccd3fac10cf00b367785e1ae719d692e43b76a988ce95759a2a4c421a30aa816d6431938ea8e5139d43701eb3bb56bee06638e2e5dc4ae03a009cd298d2105cb8f5b6c68978062708e9c50bd8a8c1501323b5c5c7f7da6af56e5b47d155e77e1c3615da09aaf4668b06c06011ced4a0c239c0742c214367e54622b68e879e15b0927f5918535a789e07d29a1f038f56881dd6d02c5b16b9af898efec81cbcebd7cf61fc4344ebd64d3de4cfd1792d7a6e827961efedbdea5bf1924964ddeeca8b5b976e2455c7d1701e0b7cae12b9c82c77c49ff3032985140238d5586dee170dd9b556274142eec669c8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 422; - dataLen = 4096; - combinedKey = "8328e53caa5c13739f319dcfa80b88f66bff215f49e1501db317ee29e8f23dd2"; - iv = "34bcdc96cd2a76026e918d749bab04ac"; - plainText = "736cd778f421c9361dc3be55b290b645e4f31f48766c53e6b7c004c9f1f2c74c4e91671cc5cf8959c46e1bee2b8e4389641b9c82fd4e4a4d0a3ccb8d4dd000cc155f571ca627934104387539c4eb3ff33c8b3975601511117f66a6cf3006d3c0ed97d0864a885ff49f39d008f9f507fb1c984319f437cfd564b71da01c7d6df9386f28aa1b23baaa616eb1172b0638938d6658848557a330f8eb0ea852c8448efda483a67c4c5409c3cd2a17a9fa5d8ed9b9424806b41406351ba5b1e6c7eb0b44e8ab984b15ac3fc3bd15b6afd12a787687a79e33800581212231fba640272b349ffdc4c3d7b8c52684eaa30421a443b44b61d05bfee6bd89741caedbe00aff03283c265d6c4ac938fd7b521016e95039ca23c599e0a1bfe5b5a219eb1b2aab9f5cdb7c8f47cb082b516fdf19babeafc7131e53c59bb1af832b8a42e4b0c478365babab50e68122e1d21204a9265bec5da3f3d332017fc424814dea4a86c0d2557cd935f72d14bd6089e5825b48647ba3aae4a10eda09aa48be2dffd969fb14c651126aa02c7753650f967de21681d9b978fafeb1cfa6d2d918a83c1f31e20ed34a3b0a977490d0dffd326fb0a03bd51f97c22701181dd221e389b62708884a83fea01d7da3307eb0f98719711defa5995c93174df0700996052311a0ab829463bfdc1611838df75b7eda7b43816e09abb3e1e113ff95e4997a46e4e988ab10"; - cipherText = "66a4b42d1bfa63bfe4d47f29d306f84028934597952162b605167bfa11db5c57f61e45cd8c8b668cf00a1696bfcb468f3695bb08e758550f3d879880cc0da975daa5247febc2df87557db7b8b33e20974eb3e305504d66001b3fe52dcc606aac98faf064c5cda5d35b2b5f518131fbc2b0a88009658aaa145efaaa823141644ecf75744ec27bcff848f637ab1db89c6afbb9b931c0cf34e2bdf9f729ad49de1a9f27b11af2e5880c5ed6ded9dcf5dd1cf7f84d1d87c4b95e2eb0f9745166b97930174e9c1e3a1ecd5833cfce91075f13e011eb1be479ca8bd483371804bbd1cd02b600b630ba17e9fb81534c331ce068535d19532505cee60fbc5a6f43f858c7786fc82984a8b0816809503eab565f01b130ee9b97001c0287855c6428ef90f95d50c17ac73a75c5adbf80a26e99c62c7f1f321b8d8428ea9718b15edbf87e977a776c150ba3b96833115c076eef711798387c903a09e66082bc6b0db6f9706b591b1f49733239e6fcff53d7cfe525660123b9e2deb6b310ca435c3b7cd1437243c30eef1b4bcec2db6fb7c1e215d15f5d943c3bbe89e6409bc97038b59bcc4fda37058957b2cd08ea85c30c356adb5b6f7f562f77dddd7d735a3efc49c02f6d7af58bebfbd8dee9099cbbc0eebe5b8737deacbc3f93c33ca94bfd95d22ee1815733258389145ad1302d62ea886fb58ba5e05c2c9603e7d8a1cae0da8e9ee16e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 423; - dataLen = 4096; - combinedKey = "b160edb2e926099ad6baab267ee617b53986619100306f9612d4c5f00221c47a"; - iv = "8e3882d7da171f856165dcd66f9aaabb"; - plainText = "1391f31350cc345e8282f62a8d67e56e3c072931c81f4c22df281c5844435c2d8561af808435f9a5a4122f57e01327b8fc327120a279c084643724dd3dd49da7b20e5b0ecc650d1a6308e677894d0bc3d6a25bbf62cd98543d6d5fb96995b2c54eca558077381f64b9076bef5839ef83ce235fdc8d794220cb730213da9b946d395b2c1aefd5c31bbe79bfc9527c2583b2c689511a0e9b32e8c604cd116455af443e0d7ad2d9a4b2c2741e8b43c19f62b6fcd5188ed8872f460b70f5a55464d4afb216c1ac54882c05cc37848fb15cdd296c206b4e337c21e3b56b479ff27b2b410771faae995741f3982e2c205211f22d67c023c569beae700c65bd4cb040cfa68c1f1377429396e30165af614e13c0474f1b1f29a5959d0753567b6d7f0cfa9c6bb58890803859c754567487d653e19da9a3bc252efab879b0446033d17cb68484760fe890f6ebdef1adfef514a48b8a78e17eaa9e184e8fea9a3c26275ddf689a4171c4811ab36eee1815dc9cf17233ee8ba1db784d67e2405475d10ca5c18fe9edcad329e2890c239980c82ffbc1a81adeec660c8b14de34914a2970804d20ba0d21b8af110e390402bc69efb458fb1b0099990419994ebc3460c55a54999e6f16288fd6b47f1aceed5c930628e2999855b670a97f8c2ab39e562f96b408392a92f4007010fa0d56d6e1611745e87ab911ca10dbd5c6a61fd77461847040"; - cipherText = "7fb7aee347c6eaae17cf623c3f8d61eb3a7dc5c01137cd7af2f4a8f49d0f930948cbd6e8e725725c61aba499af1eec5662ac8d6cb398764eb8d15dc624edecee2899ad5cf6451567a9c1f8db13d7f8c3c6192f8915f1fc74afcf30e5180b0f3217957d23907a264ce365df468f4fba5e179d93adb7269d49501bcc7908c20bc813827a03056b80d8f501cfc2aded145c8a9e8f0d818d46c6c7feb0f7b071ab9cc361af97f6e1ffb1e82e3db68dc4c18d854d3cb7fabe87c0635357961d8d3db7f43dac484ef8741dc7d1c0947e30b569ea2dde73d7cc6e1be3f98509c0319a9da61dea006f0fea26dcaab57e0dcf5255e9f819589615e9d6733451067b9cbb248c9d5bc1fbc1504888f3399de85f11702ef281eb925746bb93a6bb0052e2ae7c044631998c35b491d416ec8d181f687e9aea755f0ae6589447f5aaabad9c2511471f1e4df2fb14901c7c0a18a44657e96b16bc3106d253a6412248c89fa0305a372a4a773be8e29750fb2e3070950c75e2cabeff7498e670b5d63146a90b61e7b3b4123d0aaf4689237f7abba36767d3c1c004f477c9b700d3fe227f41a42c561af0b5ed4df49a558a13be870b43c347f4fe45e90cf9368c69027aa60bafae385610214d0210d9395ec6d03440136dfb077d16bbdbc4c93a267f500d8f049c3886d4a4e549597dbedd68990db3b2bdef722f17bc9af14548cfb52384417b8bd9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 424; - dataLen = 4096; - combinedKey = "6451341f4cc584eaaaf013d39cfcfc71ab1126ad473cb2d2ba563412c6428912"; - iv = "1732c8e006aa61fc28d0ac4365ecd56b"; - plainText = "5abfcf609cea362c71056e2721757706c64d962301735b5a19d89ed14c389135db17b251704567b3d9fd9a3e1590dbca28cad2b0338af1fb08b518323934f801328389a563b14150b2c81f17c6adb907f7649dab907e65750bbe2e0876ab26a36739beb8bd53963e621bf63c33e762b19190e77d04dc34b1a3e62a5fe5bf9c1ec976225bb37fdcce9d4a5d8e5340e1307fc67bdd8b9ee51e9279860f6756c4e3758dfbba314ffa576a08e7f48843ff729f12dafd1331f5bb74d94f6810aa2f663b14f704e6dc8cb9067d6202bb16f160f4e52c4d766fc09533888957922479709efb4fe24f67848880bb28e31d0560d08f32455738f6f159dccb829827172ba8f75540694610f0ab06b54e1e3713917ebcfc8b6dd3c03ae8f467c2bd15cd377e66ba58992ca6e8d280efb592e27275a86643a92b9150c52a590a98c58315b88d26dd9c06870fae77e9d77b603f57748d5b9ba0ce77d809292d4f779b42729fef5c73e863e21c033bb5e1a6967dc6f127a44a79a86747e01dd29f89cb903e464dc55076831ef321e488632964c25f718673aca900eb5ae819f01bf3ed7d8922b11dee0a711697289bfb58833c0591d653c32bb761f6ef7d17761412a27adafdc153a555c9df4414e35e2c981c7eae3eedc082441f17f66af2280c7bdb5020452eb8fa9a5384908241ddf1133e69758275f4d77885a98726d6950733eba768156c"; - cipherText = "122d0a666d02661ba8fdac82d00a10f41b9f90e6768121040e745173aa4b8942f948af263bc39d0651b3d8b5fde62bd2e821c2912128f508f830973dad702c97f131930245be1410574fe67b7581fb6bbda50e7a4136a135b1a585c15a1be3dd16d8042422ab790c675efadba0eeb30749040c20269354dd7d8cf161d3ec4cd598be6216ae6d51b87c4c4ccb8f3255ea4630d9ed8ceac45373be540e11692410231214cc99390260aa5ce8f8978b6ec5df3420ae792be2cbe87888f44f3e9ca0f0ade5221bd8f997b6f7aa16fa6bc95c322925eadf1b7a0f33e82a1c6e469475de9d5a0a22f40e5d05b1603ead0c34b0e1236fd07a491292715ccc05f308d43253215f7c2fa696eab2cf00fc5b7184d4477e9cd34ec4cd1e3dc413499c2428064e71071b8ea6bfa6a4b6a3ac485824539b2297ac6f99dbb3eb94c37e84e553153ed6f8583a155f93b8b716dcc8ff0ec39c6932caf3fd754f0aad5ede346caf5c20990bd69c63c6fb72d18a64d941397e47023e27796f57f6dc068f1f68cfe4130c5b6f4e22726b1e6887b7c4dd7266a15fccd7bc9bc1ba519bfc94e00c774f3799ab81edd6dda124c428ed90b5deadf4c32e3769ebd960acd3bc0eef538da8f0bfbf07b98245a3095634b2cf9b3a229833a45b2dc7654c3ebfc7982163a3b11e98fafa0d3c4f4ec6ad1acf03764be738c3237075c01d0846d3f37f5d77a91fef"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 425; - dataLen = 4096; - combinedKey = "a45578a830acde5af10dfde30ee26f48a90fbc3a664a3b38bd609ce9907215cd"; - iv = "e29f0044fcdedeeba4e363391d0f3411"; - plainText = "1c7533d2a29e970210ff0fe19f53c5ee1c886e7fd3d57673ff48ecf80a51bc12343881af8c36abcef1c4d9e17b8b9b9e9612a192ca80d282b4dc7c011895c68de1d55585c8a89692ae1245602ebaebfa08bf48f32a04deac039dd12a936562edd023ec620a7b8995bde3dad7017af91e95bc56d75a326677deb974489d973231e14b171f72741faf0e0d81f0d4401b3115a212074e81ed4f2d23ca28f441120a0ba722949cad6ff217d70946069678e0d9d95963eaec1fbb6f6ed73e9e4a5769d1b582eea067ca5e1477ed2387df393abe1b21b50c0c16b5c2d2cae817a403571d609bd9ff3b9f27526032699ef153eed55657a867552ab2fe3bf9647b6decc17d19bc177c8cfd1704aa4a46ea3a86abd761e809cd549091b4d076b90c77ab17caeff124c7b3f0b8d1a46abc08a3b71269a469553413af71648f721fe9a8d7ab71e9954a6f020f7741029b7eba962083e67ea9fb08a1f94bb3153591836f6f8b97d1572c046f8152fae78707b92313c53f7dc1250baffee716487d41e6b7058af6e37b619eb445fb305b181da3eedc432732730cb5b6abe3093a69dfeb8a34e35203d815ad751adf27f3f0cf44213e1b263bd46dd6544cfc08c98457a317541dfad23ca0765f31f341c65ad12877d961258c91e6b98d081af8c8328afe8ada99daff14748f514363dc4f8c09693abec8914ca62613ad9b6efe0f98351228ffed"; - cipherText = "bd927fb1bc46b8daa2fe17e25243e3da4388662e849793c6c26a9cced21c94d2d25aca596766267719645c3a1012fa45070d9e3848b5507eb8fb7d640793eeb8f4dd2239b65f71e912f4718af3f67aea81905aa9b46e311bb0169df163598a0eed27e16295c584d7806a1f72dce818ea433272f52a11eda30410c99da24df1fcae9755d174c614e20a965a961282ce77a804c4c0db2ee136eb2138e39ac66b2101bdde02c936affe026e8fde1f153d1b7f905be1132f53832313a816644091b16fe569dd02377fdbe54b444d2afaf2a3e7764c00d61f822cda6f117819bbfafdc6a8a8c77aa3ed94e59da59b6994ed99a70fb5015504044d8c83a221a69884ee38d7e585dc487fa4ca64610f215c3459793dcc302eba9a41a9bfcdcca2da586fc353270fe7db134ef73bdd58cb84337d961c75fb7b98f9e0035ba231b3a57def6d16ceac64dca44689f511a5324b89ed9d2455d40889ada30ea3180b5de4276aec0c0f7c61a475f40eb7e582063dd1d285463d005511c1ee3d259e543bb7b7395437d202de1ea745abd38d3a0bd7fc7cd80bd68744ac0be621dcdba84cd5d08c089b3107b86b8a64e686c90bd8c2d885dbdd94d72516177dd7ebeca2f1e0321c67aa28d855cc6883f833b1f525253aa212a4d7d080029be98d0397a32039bcf48babca271d0bb7cbad6d6f9524863925e2cb5ea66cadfce300156f3e0148dc45"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 426; - dataLen = 4096; - combinedKey = "7c22e1b5e33ca660bc2c834c8b65d83b802cadc4aceaf23c70dd9a880a1ae171"; - iv = "0048299d5e93bbddc4c415a6f3546f31"; - plainText = "f4bf2dade50b15d84149197077f68b9d94e2bda4e02f84e6506fb4ad27660851f93e98b6ab19c28677eb361f794ca50c5e2c02338cad9de651306ca96bdbcd972dd3e30d472bcd0b416676f80e1538a4520f7ffd1ba53c3334dd87d8a67638c30eb515a6685e50c4af04dafac045a6af062bbf5980d859506acb7a103c840da2a75b4f9bec003d7e15e56199d522a825e8e25e77a11bef7fdaea942d3dd5e2e61a41eae8d4a7ebfb5f22c2ff66e637d43fc0b0b30fe6b89f57591092c77534c90c7acae28b9a38bb8af547fea1620039a8b3a1c64c3bec21378d9800624a07e72e8b45e7c6a1e43deaaf4b2867bf7ac2fc427369c2c7691ec0e02e8b9d437a349b3647c2e96fd50e30d2255023af69350e79af05688505137e668d5812d9d3aeaa14e869581a518981f4c1d0cfca73c0482fe4b3ca3998b244adae943afcd1511d0b12d0702222c92d1161ea45e1c3161ae24bc76399c9a18cc9be0aef3d159cbba24325db06ae8b76a4ca871b2aa4d94d7c7f2986dcef78c5254ea79b6ca12158916eb63e2bb647fe44d73c133c8e4b99d72441589b40e0d4347d80924e1ed45c4e2790e2adf1022ca4f7fb8e4a09929d925e5cea336707723829b95c62fb9eca6f4e2dddda8ee77c66bd0600bee8ea732984133f6771145545d45bce22bab9a5fecf7983080c6c15dc9dd63c9a25c0fe4c902e9e22234e146a83cd4cbc4b69"; - cipherText = "8c6a9e99223dc7d8e1f06d60341e4451f54ae591ccc7dd037a7459ee0eb7f1c5f71d5e1d084ec6fe9c5bb10191b280451ecceef178829652ac540507b5b407dbce9c95198aa8caeaaaacd678cc968429421c7b21d20a0236e3f31f78d482b5bbca02a4488d1d5be355f78cc1a36c858d61d86483e7867a73866b6db858660a29f3f77349c5396d79038ca7e495b72b4ad53ac8ca0068c48ebe1c9898462b31581e2fc3cfdaf84e83b422c0d7ef60ded451f5cbfddd8b6c8db0c9f7c96cf53266957618c095aea1b620bb531c41147e63092f000a2fdfd8d2b18f614fc7af44cb29eb09215a1ecfa90deeff59f2b2dcbb908ec125e0504c12f352495748842f716932d61bed7c8419593cc2e05c9be41a7083610820af79c5bc1f168eddf830931bf5d8b1aaae2c9f013ca4f6369c8eb4bc251ada4aa63de29621c2ef2c56375bb7e67923db5b0b0377f631c4d379509c49fdb279d826424e7fc91fd2cb0ade42668a6dafbd10ee5e24f374fddecbf042b35f3c76fc6cc7ad284a1e0e0d430d1c712d68897a4503cd74bab63f285a7ea0506d0b3f0e5e6e5efea6d614d831a89b98a7518124c7640ed7ec426b92617e60977d28af9fe32776648277b57b063c0b0b59fc91b79f88d1a4981ea5c34cd3962a142504c5fc68381b0f144f04b04e2c1aaa1ddc7684feab86e9be85d5601432a3d189bfcd82c572854045780d413028"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 427; - dataLen = 4096; - combinedKey = "4a350aa248ba36c6f4b511917681c983057089febc45ae8ba4b0f5a95ac7784d"; - iv = "9347b99f8bb354916aac1afa1c6bcab9"; - plainText = "11fb4b70a775c70e9a44475c7445f8c1e5ea00c08f557daa243bf0d4b69d75b3ae8c8eb23bf211e8f5f56d27257424d2304c417ffdfb1f069aacbde9136a124d44f88450c0e33ecee0d96373c711d4043f322f110bbdf9ad631c6e1c459d7361efb0ca6ef119a63f412807d8fb8873ee4358590a19f95631e192ba8a86150387eb40da4105121cef7a308f3d9bce64a0f085d8260562de6a859c8c69004b9247660c204d2fdb68afead28d8f91debc41d8c3bd5bd90c50d97fb91f3da60bc716ac383b657702c6785e11fd1271f4b214e91ae26f5cdefb0e94caf95910ac0176e5c9b68c42856788990fb5d5dc4f0f1275341405dc2868adde8ae5e6f3ab9b9f06f2d3ce04a301130d15a4091202c38c01fb6cd3dcf489a7beaed908229dc9f41068d1960816893bf8f4c1b43a2b275f51ee307e911227c66e4d4decd80fe3c066bf29461b6521661b7a6116bddd43d3427086b36b17293700e5ba0226e85fc61a30d24832d1d0ce75b4c9a1b77673e548add3fff4e93ee5c313546163757eb43a6698146404316dff06e76254eff8deddd0b4dfaa2f73e073b5f0e5a291a9c36c7a51c1ff77a66037bf5203888e97d16a6bc13150ce1afaeb188dd6dfaa3a41ac921fd5e7399a089bbd2fdc686701a559c73a4cf39c745aed7091020631a00bb1b030cef852a99d40bfd18faf0de2a29ef71c6c078d6995a3ed4cbe027de2c4"; - cipherText = "d69deda0ab7506ead59ff3c57864c16ac7b2b1d3d1231002264691ad39beae4ed795273ef53e6739e9b67942506b97aae043e1468386e9507e183fb658f7f23d2dd48a53873f301bdbc423fc18b84593e649a592c8c283c67b4e79668e4dd49e55a06300aa4c2772a5a5921871b3a5dd6d63ed41ddc6472952d24de56cd5fb4608331bd6c99c4402d93a9540abbe067dccf949e42a1391ff1d1e2dd9acc8769f757bb972eedabf43aa92d59be8f8c4401b9c89938e6320352ba66aafbe2c36d5032b36f3246fa11340c13ac2424b49d8da8384b307bbe748442ff5e7afd30b7a218cba971fd10d019a97c72595eb4a5c0ca0490ad7c72bd185241d15008005fdf187a268edf0973b4323b5f29c28c416b10714cf82eedad9d2805c01552f5d1d395ea4e9adbbcd23f623f380363b6a3f43b940055a16942d7b1c090d68e9c577ebed1437bbd0bb79f49678e073e8ff1dbfd69ed267a4d6ce2bd67281171e6cc74c82218dad8032502f402fb9a5a91da2b6a71dd2081c4758f21d3fa0f4ddb4cdb03655696a9f829340d926851311d215f81b29963802113ceb3315a6054e34a44a048e86f0f4655588636c8c3e3aa8fb56a6287bced2d574692be43b8cb658ea36ea069871bfbeebe03c18a06784d751ee33c82a57c438bb687e6cd471183eb5652eaffe3cf6af829961b245c03ed146aa662874fcba2db651e079095a2b53bc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 428; - dataLen = 4096; - combinedKey = "53f16c985f7dd214827debd92a3ae230001e6238d855ff2bc1327b9c053d553a"; - iv = "54975bd53c5eec2e290a20208b5e7d01"; - plainText = "35f8022c86534036ef659a63adaaa7e723aee2311f6c990679b8500e551f45f0bd14fefc2be28cd936b95ef47a1b4d15cdff64b215a699856952314350c1939d6c8a2c351c2f8bd42bf5624eefc41e076b8b42991410b345c8d95de48b1504eff335c5d804e38e83ec0e714e46eff715c23479e4456e30c1d180923527743e73c34f743368c6ce7175544f3cfef02866992f53da9d3f86d4eddf9e49f6abfff590cc154660b42acbb4f915696aaf4b01714a482bdf68bf881c0b5b44aa8d134e023c7d8a862c200ab1c19bb42bc45f68c9d41c0fb447b0d4f4895ba7bcc71705b25ae68b4be810f1495fcc7e116d737e15cc2cc9312f40eab6ec6e9e6744cf67546bf02aa81834ad42ad075dd352543c2528d39ffdf320d80c91297f7457c972765ece246bc1f305df8ad0eedba32532aba6139c1c5a7d5afdcc93617ea0b2f311f0ececc71e36079972cfe4aeb659a260f9607aad2000233648d363cddda7713296c63c9515d9ab8c5c4c1b29fc4d54233d64419b839c1f39e66e9b78ee523b77a99cc333e11d02b2bd7505d67d5a2c05747597c7e9b5fb64cf431eb4815ba3687ec45b66e1e4042646e2b766a1a5b59e6b1b0c59c2484a4078244373b16f75d99807c4c2bdb096d70f092c307ce3606581e3225d98f73e5bb8570e65956e3b8266d658107af0591963e88d4db23e37ed667a2562c28d31e2e3a73200ae2a4f"; - cipherText = "fa2581ec0c551514da740413a31332a75bf414b3bf59d8bf1b06593a856a8aafdce45e36ffa77b7cbe8a56c3e6dbe5bdba502a29ede89faae621e1667a036857794c82dae098df5be3b897125c46cf6dd04fe5b9fda1e2f6cfdba7f1153d0fbc06bfa788e32fac5f952fa12e29211778d1ed19b221af139cd398b052cf0e67141c9725aab946ea819bbb8475a2103a00f8e82bf14c59083bedebf8741eed8d6c8e97794a19ece8993182ae38cd35391efdba3e255ede9787822d5db9f6ceea24b4df59c5d95c74efd8405176ae1e28125843d27b846e3f39c4f78a76fac314b7eebf2f9630d92ef6897a282daed60a0fbf271c5cb135ebf396a474bbd5aa55b282f6ba3a1767fb2f410fca981357a201de7ef4ff04111a521a63055c6c2dd98d1d319755ec4ce053b27b43daa8a7be867973abc74ad2d48880528ee94222e16e09c18036e40fda22dbfda33a6d15ba418a7563bcb7e2e72bb33b44cbd3863752b46730329debfaeb2f69a4fa7a8c7368013b18463ee964ace927742c480ddd98ff4f8934fca849ed259724db0b6802ded75ed352df867665b65154923dbbb24316b0359dcc9aae990551f4382b4bde04b9006abe447aed6bc50697565e9f66b3fe7d867964cd69d96471c4fe2277399f7a32668a828deeeefd65a87f687fd34c9fd6d97f2a85ce0173db62377895f7dc63ad625dd1aab9a81ee29eb9b05aaa97"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 429; - dataLen = 4096; - combinedKey = "9d844fbf707f0649914a1b9f4344c0c0806d76883f115deeaefd7c3f43c16e82"; - iv = "3b79cfef91b4d2c269606bec579e0df5"; - plainText = "388515a934af34fff3e8e1e58e609b544bae7d5864d21ed36d695f5af64738395d1d73ff48341f8d6d7e880f3636cb77b117e3aa0073bc38ce800f17cb557a9d24906fb6635dc28ceabc4bdf4fe75f8c1e31be70ca2aec17ee1560bb729069f858edf7fbd23c87f9f684fa06bb3a22dd4ad4482f4c1f3e9b1847e370d97a90f5a666a95da134392b93e56ed643a6166a2f70956074e05344e362e8aefbac4d2790c5dceeeb4c2930722fdf7efdf142770fcae8f990d43ab5cfe1f322303acaea06896b7bf453e0c0c3f821e5ca9b74ccaeb37f60f1a3aea4e0c318b6139410593381497bfbda464f200d305d6a7c40d679a556893abfe235a6063d1e2e76c7b61d99672fc47c77d17fc0b3ad2ac9fbd86a6723cadb45b2dda598078648614caa14ff263cc1232493e81c09af5eca55763c1a973e4e9360598fcc9a13835e92e70ec04025b3afdacda324086c1c6c219cbb514b5e5fdd4caee99298178dbffecbb13d5f084104c7a4c5645e554da3738fefd89753c3f2dcc3a9180884054d162e8ec43bafdebc31e94315c364de8a204de323e660451a4690780d48d3aea6e11a3feb044249c8efea79a9d59caf688c0f2a1c2b804d38d246a6883fceb3e63bc5a17fb545ceca8b8ff48cc4b38e7400069af9fa12191142181c7c2d631aee6f97cbc63a1200ccdc60987ad36011ed98c75a04d3feb6e98f5a4f02dbf452cda269"; - cipherText = "3e0ed8e484442d75d2832d809808bc21fcb1240e5fbe62e42ecc8598e31f9f50c18588a065892f83faa923540e6ba24ecad4b1d1fbf12b95c364c0aeb0a238d217f3d4da687e0910f718a7c52a8a7f7a680b8a6cdca2488981a504bd3d0f8b0795ee651ce8a63ac22b8b1e9119207644cf78598afc0920fcd477123817b54dd9e40901191670ca68d662264ac241292df92085f8b733310ea2a732fc5d5d3c4582b3ca8d63809e098d490a520718d05853240c484fbed3ec12a281ea4e4b4312902cdb3b4e368519d2182a5edee7fd9b33e2753483c47346c7e03849b0e0ae3550d090ff67988964eb4c0e7d55158f92c6a96f89bf0e8f1fa408643cc24f6f05a38fb222d6084e5e8ea95f400e89e1b0ae9e9baa1ec8def1eeedb7e661a5c89e3fc0a5005f953b0d3cd94e973f6d7fbef1ecd4dbfa6ef022734d5f56538cb89a89c2ea28edaac6e546cb58ef95ad5bfb58b520607a1ffad7bbecaed62f163db8181ec5fb5422cebde704f8fa87355151f4c2cee7c28025af43ffcd0b6def8ef7dd995eedda063e50e982f2fc1457ce0b2dcd3bce5efee2e46f71cbec6d3e05f58d7cddb767b3351538ed80f5dd604efbb31e32d9aa7d03339e92e96df875b951ee904b01ee9bc0577e0ce393d5075101734f2afc33cd52c57000ccf63d8f478634adb2c05db0983a0e14ecdb68e30079e4de2150a090ac226dc5dafc09e7ec93"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 430; - dataLen = 4096; - combinedKey = "a18d6744d598dd5abc0ccc6f4bdbe9155ac76fa2bbd309d8e939c1ac40346377"; - iv = "58c054fdc3e2a4d51f912d8ea8b6fded"; - plainText = "56a4726a77390bcdfe467240ad0b9185dd25d97f49ed0f8c2c939a9428aae5f1e52075cabce91602ddd5fb372b2d11265dcf50bb243c1bbe2d960a0aad0cb762d7151c4afa8a708c6d4a36ef5d8e9cb29fa6cf30ef5b7b192489c1b9739178c7468b8e50e9f7095d19afd69a6bde8f8e9dfaa2626834b0ce145907ad13364f309d7fd09d8070c21cf4ba214f1798798702af508f9ab6164ee6158a06c9a04b17a01f705ec7b6e3a4a4ef00323dc88d2b2d8152224ac745808f1b283d139d926f59914a1000153ea12c7a52bd6e69253dd24f58b219b3d0f7411cdfc2bc051ce711d49659836788d7c8b911c7266b8d26582311bea44e9abdde020fbf227566de17481b5c0606a7dde12982d6c24e28cf27dc034e80479cde00a4c9552f14596b250fcf29b8673167da24226709d219d3f5d0624279894346eb170a36e674db2fe174bb7dd7b45f2fea242bd202bce9525207059ece9afb1bb390087abe85c111e4f9939dd857e09eda2324333b08ad2833d92273d411019fa2021f0aefcad135c435d5e44c638ed946197b2d78e87fb4823429b2ac0485a6ffd024d191af9a227623f69728227a9e2f6758a25df8b8dabdb36ead58507b9e356a2d55a1f0bb3899efb883f7b0980f131a1c3fa82a96f3c515f905b69ba46e9ded9736fe713cb654ec66b731faeb024530e45663e10eb288887b9dcc8330e53b3459d99ec3fd92"; - cipherText = "bb975061188941dd7496b59d3734379b8ade1c853fe73134510a4750277ad6078163b556402f87423ca49da2b3e4548dc8627c56a55005566777391a33777cf17fce110790ef879d857331a86785a65326180d5445b8b0d4185ff32b6d329bd8cc5a3418510ca4d97bb7f2dd0d4489efab2e6e9bd14fadbb5a5ef4c8a8cd642c77e945952c11db521705c5b184db3688b9d38567f9c6d56d3111a44a9a241bd920ba24f9e9f933fe1b1722b0b4c26be3ef7ba485f8bb5c4c8a584659a8eea225edfe26da0266714406fb89bbfe32b1d7ba8ce7598f1dd94f998c063753b94eb4705c3e0cd731cdc33c508c7d7f1f8248005ca2ed1a7f3c84cf67454699755ffb0b9682bd42bc614b315cd5d66824861c18455bb102f64151bfaf6ee683a7d38d84a62a9222ed4dabf17cae70767eccf24c8f2efee159db01e3c7e551a2225049e19d1131ef33bff8b8ab721f8fd14fc5bdada1f917840dfc901d632cc3962f78bbc134a10c05bf9cf4f4ddd8e521891c0c2e22fe2259e11241fcbc7d0b08a240c3d91c413d2b93bab4d09186721cda45c471a444527d7dbcef80734742c915dac117fa69102fe23fe23047d54b3f16fc92a8734d7611b636d1756b07ec1d3bd20b4e184406819c86cf0a3e7031a5a92fc52ec174723a0b6a28aba15993e50f300a6bc878dae3eeb16df05c89ef3d1f9fb36004c1cdc62b428743b90bb4598772"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 431; - dataLen = 4096; - combinedKey = "373b660406247b674fdc0d7e73c6f605002c45c6054d229f35c45bfd8554d9d3"; - iv = "0c7cbb5a2528bba11ec4f17d7d625e1e"; - plainText = "6be050fe1b5f72a4479daeaa920bbc5066f04c9c5e4c13aa807ea1f05044887021da615ce55155ae56aa9e3aa464b56d7875f5e53d7b30a02bcdda770a6bb2704e3c3e58581845727a390581f34056bfb81b7d94bf9fc2d23fdd9a85e057258bb866044faab7a34e18a9969a715db045c05cac5b604bfba3f8f56c563804a7950d1d3d594cb3c54a903f0eb8ae53d6588af7916d57300d3ba618f6d9f8181d7aad3a5f98f7b7a9d882cdd7706bb8ffd90ed9a406e273c1d1a62f5168e2b216b73e24b7221f90c92fab0ab957a09845f069de1d92e5a814309ad356d749f619f125321cd7be1b09655dd05f59efe0b36745beeb605763130598a88108a233f6bd6b4fb1ef25354197913589690b3db538099e47665309fe31ac6ef777c9745378c2fd4cc602534214e38512d92673d957e987cb610b1716202c0f8c2df7dd8cd8c0345b7be29c66f1b7e3119bb1335a952d5b33a0efc90d1120f1af861432f7c1c2b629a55cc3bd251e9e66aef96f3ba4c264be8137203946a316cd0ce805c39a349a1e1295f79b003bb8d31212a01f2f987dd564a38a7f467394d630010bdec52fb0729aba2d7957ccb9e938c836098464b9aa5e22fc1b7cc8317a72c4681623c3a1c2a36e56a9d11e32d42a964925642738b6142f36e8d5d3ea8e73aba227e9ec480d211a04afc71ef428bf11ab8f6546032eeb292df70f229d2eeb579382e4"; - cipherText = "9c2f5b8b72ff768bf37cee01f4c9ecd6f69fcc8864f9b56bc771daaf3a954a4f40fdabb5381273180334f70201aadab7f740da5a1406770fd220adc472b5847e4e5dc82d65ad554675b01cfd6c47c3eb480d13a4b85175e417c0c4de2ffb9e259121fcb0baa64cd676646751b25b3661cb6a3425b0d744945ea6ff559d74af5e92353b92352094eab723ce26533323175d73549497c41fe41c9c6416785497b04f92c5e4b0795aaa4d34d3ac08721044824ddf22a5eef1ca96ba1c3ac1e94809ea9b294968557f364c74a4f6dc0c3c6356381aaac6da5997255350ef648c1b7e526eef40e38707b5d08bdb7961d0ed0b80d67eae0a43175e059b6e5a7d47bbaf72b3fbf7d6c01341f0b509deeed5bbd04b229e6cfaf6da903b07276e93e8afc75e9da2e680f36e40ae704327c9a02ad4c16b9d1483cf949595e459404b21eee7ade818334b0fefd9eea68bebb79cd2f78bba0bf437b7c18c56ad1edee1f43b7b33516d986bfbf77feb4dcac518c5d58fa775bbb03ddd225930eddf69f6b5f9d88239332948885a6e5591c10f0230de9d7b6676610ef08bbb257b6814246bbfa680e73baae663171ec162f331df68be9cbc195c7948c96b33ae3a6bfd133c2d42afab998f44b73fe37e1bfd6fc47309d2dc9219baee77cc8b2b431e1fb3e8f85d7d6ee50caac41b36cfb5419cbcaa85bdd2696c4bc4043271cfe393765af3f931"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 432; - dataLen = 4096; - combinedKey = "66db75a1732442ccfd7c3dde1167ab2fcf92dad59f2b0f6cf153aa8cb7dca0b4"; - iv = "c1e92dec7e50e21c1a3ed9a842c479a9"; - plainText = "9fa17d7d5ec3a9cea1f7278e6cfc95146520c04fa905b5d21cb6738488457179359bb515be5303edb596811fce830a29cf646faa80999c6d28b994fcb3608340e2bf0c03db855b5662c405d2eed5a2fce332ad65551ff1ac39b0caa578bb58a48cf4dc1f5f3eda634726a877d9cef7f9bfcf1fa594314e78ec737dde24150f7f0b0f98b44ea88257da9a22607d4a2a89f4b052816ef64187740a34e50d2235bb67cb17f94caa4d67f3d5baace16f97a6df195613fc2ba6baa2f4fac281765429f127de0b2779436769522e07df597411e405d4ffcf693e2009574e8df84d9b1f9176e0cfd8f7ae0e362252786687a536e4cebc0a50857cc846fe9494d40e390938a9328ee542c68a3606702cf5bfd5dabfdeff434a77e32ecaa95e997914b19ee75a9cea2963b16806739301ec4d271dbe7d9a9b677b52c3a8cff6bef3273d048c1f53b42c4da269cc4afd91bae7e2f2257e71188901cacec2482d52b8b537a24d3745ad5fc4464fddbc9a48043a71795cb899ab4b936ac39a330a6c556785b87656ef234a6bb9fea60ec1f381d4c89f5df7ed931da6ca2012e87ab93ad224757fe1d8ed4b730cd71e75487bb5b40648e73daa0b8eb26061e33e99e6af8d73b10b68e970b7c2bac106e677c9abfcb03551a77ca6a737b5e87c80a4255e3f580e2e6bdae2f508df3aff512772ee9398f81cf5ccec868aede5377cc29e5aa7d568"; - cipherText = "d3faa6163310d7d7a66d05659619eacfdb26ed435abb75f050c86b43fe31b2cbd1a468ff123f13ec21984410a4cd317ae912ee50951b93a7dcfe6e78cb093228beaece1c3fb47ec7ffbb2f859fe3991580bb11611d8628407f24ff3c9d278be5baf5fc5297eb0fb8dd6f6a33f1fff436c00b3ce490504d77fa01baeeb8a73f759e7f98ca6db79610cae960f6c3248fe5d754babd620c47c2d101a7547bf485704fedfed2c642de93bc05528015b288d946359200811afa7c91c14e65a647da23127afee1403f8911329eac6a76bcbdc322bba99768d1b2ffc057c927f40e49fafc7f1f933413cfc182a9170bd0cffcfc6496c01afc6ff45e2d21444aa4f8623717edf595413a2e3b456503081706186ab65b28d8bbbfb47c89bd51ba3661eafe0d764ea592ecdeda69e3bf7b6c423d1e865d4f10d46d37be3ee49d8e7a8c62bdebed6a1bcc6850a686923292ce89d6483f0ca92960d010316dd2677312ea6c7c530f650f9c6cd9938c09d8a772433c2f6c74bf2bfb65f0ce454e675ecf4dda368d187a5494e128f232cacabee607a2af30aa564b6dd99b3ac9c97c6a61623e64453291c8f771b1f0b54c68dc4423da3c76eba8617e74b705fd1a8d422563b76ebe28eeb06a9e0e43b52b13f957b3fd0c50541140f51f3e00cff1f8932eb88c5618e4240d72bbf0ba71f8588c5c41ea1b6d6e6ced84567f2a8a937478572d117c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 433; - dataLen = 4096; - combinedKey = "d68ff4499838a47c4299a9074c42a314a0f71c3553d300a18c525d519f189828"; - iv = "d3303f38e42e44771106dea249fd5075"; - plainText = "044be5ab8ee320c5a8e3176c2c570bbea6e902ba08c455f9a1e142ea1a4581b312d4e987be387ef0ea20b7449aba263315fdecfa90144e04fada8ff9b520d1d769d9af109bd943be6d6eadb89c6079ca34f762c8bbf31d9807b77d8595125b795cd835823ba0407590bd71c3574e17e36ae094e97a8d17916c6b27d452a2918b1a79c7307cc62fbaad4d4acd5781c5508dc8333f2bdc7910eaa0fd1afb0114f2e8a7401850df8e0a99e962a2f2dd17d7492f95208215840b610cfeceb958c03c00156c2faa481c8fb6693f3c1780e67d5d5cddc0b102c7c4574492facdc85217ffa0fa3871fbf941062e7befa5c423222ed3fde6cba15fa4ba5d245075e2688597516e38d477c1971744fb6a47781da13844fdae1b8bd6642fe379dad3cf524981cbc602f807d55bf679c386619123412718d223db92f88738dfd3d93d065d329eef9249d93606c532fbf9ffd6af98b24529c152b3783d1ebd259a3e8c87caa4eb5e4378d5c808be1346eee78b8514d6ae8a382a81fc6112201260647d0cef4ff74f4f2070e81da1e644850ce74b40040792c89560e023e8a2dcfbc9342e8466c7b393901a08063056982306518b3e736012bd8569a31d71c194c8007749e8346c61f5d6eed25a68b906e20aa1a422c0fe2179018ab86413e2f0686999377d157a4544a6fd4d9b2d41d91e176a63a327636462aec3db82cd0810d68fd0fc8cff"; - cipherText = "037f69f8ce3cb419f5d86852cf5dc8dabdca4ca091f5c56e516ca1470a65e2d91161086c355e993e464f5c32985e34b586b0dfb265c77a1a09225c427ca61ce51ae32f4e70f6a253ad6e50f9b7a67228ab8ad126d1c6ad23e20b8c56ffb6279f6b37ca05e0a8012bee65a50b630e7eafdc5fa87f77c9561ab983efe04a79c6baa30f8ab48941744abcda4848a693cb7a6235ae2b8e09fb3f95b56d79df37ed859f645fad4836022dfcd8283631ba6de309dada889f334ac5a370a524568d75bf66d48e3f5f845bac72f8d06d6cf0079d8d4f35247a03b905003967ffb809386cdeee764e8e56a096c317e4def5fc6418e32c228b8c89fb4c3e96cdb3f0a25324f04e5c3122aa6a9e5218038fad495198ed9b14bfb2ca176c790f2712c8425a883e176887e6e6f75aaeeaf95e1b02b36989f9bb35d7a0a0d792001513a8e51445448c2f81e5c50db570ab326f0508fb682c599f78c049e4098c73b795f961dd8fe119967d831e134b35fde463a5df662101ec63ca09cc53ec990bf497cb7ecbb068788e95078d57af923bbcf3639fe1e24c99dd7e51076cc9fff095e414b5821776245709bab341b4911361ea331b4d224378fda692a9378be2c12d0fb6da09dc38eb7b5fa180ab28840cf40e350345e028e684280921d7bd85eb0f281fe68e9518605415dad83a18161aa6658ace328e5eb3137445b7182c8c98c08c62f5379a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 434; - dataLen = 4096; - combinedKey = "015142949fe4bb06046f36f84dbf899c222448d201fe223b7f37e70bacba5732"; - iv = "1df3e9bad4760ad3edde70b074e9957d"; - plainText = "1a52a6809a00d0576fb0e2fd570f162f763364df3c6cd5ce16e4b8f3e28cea3deb4d08ef58abe81d3133a809fa6a7193ac4f9cb0caa7c68c5c0813fd910c52570fec6b4cf3b79850e2fc58c4302ffb146bb6ce79f17009be6291ed514b47eb06ca0f6e94eec1ebac8fef649a4aa536e637aef288a701b9b3b70cc0e573ea34585ba87a28de79348203c1fc5132cfbf85d2047911bbbc97bf5015e3c2666d7567ef11adf43e069844aa3b1b2672e14052c1506ccdc414f790262d4f9254a3509d763b6a316a215919d9daebec75c7082369090466fe34a94ce03b156806575b925589633bc14751ce118007397f4d34fcb8eaa8e17ffe20c93394c33aab8db8a6b62e19bceaa5dd105f23b49afacdffb803a325e6cd84814ecbc063e1514fbeafd6d98b1d380c82e00f458606d3aac2ee48e983556a8d579b1e28ac2600a982bd3fe191ac6f5c238ac307ad4a5f3187d2502a41b5a4db9c75424fed463d8b80cea6cdd3fa9b4ccf47988559c0dd4c1f8c51520dbbb5d0f7db33072e957ec612ea2becbfeffa1c348b181c4c6338a03cf94699cd785d03f4128f5bab756def48e343ffec37a547cf692948c00a02b28f12d54055b32ea6ec7c3995015650dfc26769db9e93f36ea07169325488111344384ef89b0b693a5f5bc3b41670b608eb173820e6f54db292e0baec70901e1f936befe940418c7fd7ab90412691da2caf4e"; - cipherText = "55b32497e377ca6d717ea8280d5e0adc1c542baa52f44e00d6b542c9c9bad6944c7de8ea843bc49d52edf08a622a079eb55fba118c4ef0ea88b64af7a425a746df279624ce291beaaddf7fb732578ef6dc49e2bb5eb2959433df0c9f4ec27f8ecfd53f79bd2467f51cf91ab09ade12d13fe6c1e1143a6f885eaeb33c75f13a8a1f44509109316653397dda919daf92f29618df1200e20ca6fcd005de6df555485f51fe2955eacd899bb8d6809df6811d2a9553926f05358d3111d9b47cd8ff668a20784d5d6f72c2b125761d1e6af120c75d31bc3ba347a7264e02ee60aa831ab46edc8eaddcee8ca1d73baa6716b0999fc8f1c24be7495f114a16f66e8118f9d2b5569b3df7bbb063229beae67892f4810a41be3c90ead43d97302c5dc4e7532ef20c032c3b770b1d5bd35921836632337fe41ccc53d7c50d9677da04ca5f22848b635a01860c5c6d023b00988948acbe9f7b6f084256e613c443081a41c961d750d1646abdfb072b4678c0a63bb9b27f4104bae537ecf23d9b23363d0b5fce1b04dcc663ee3108963f477afe0cdeee4aefacdb504cc50c9aa86759d7f1094ca34b259d2380ba29e22fe8ed79e5892c12f3fee85f557fa68f16567cba3357b9dc1fc3c15a51b12b33f500bf4fea3d4fdf5d17a4b2ebfaf239a34f2b58742b74a83057dcb50b544ee9bd5f4e8fef19c2a053ccd87ed86b04f6c6d399e3861e77"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 435; - dataLen = 4096; - combinedKey = "fdb73e9aa1f85e351c8d3be49690567f1fa6a0e3681cb43ed9e52e342e7075c8"; - iv = "df9fba1b49b253f62bff31bf1781df58"; - plainText = "018fc8b5eb1a1d512d1dc6efcc04f9cd5d7165606c16540720726f74d4093fde67e8cf7dd093bab0e3ac90256b78a3df1206b7b709d6403303d6267b0ec737a1ebc9d95bccf225001ffbb2384fdf84136c06be23f304e6011667ebee6ab74e62ed4686ee6d478323f6df1f7fff1375a206b0254dd80afe4ecafca9b119b8070f39f48b6bad2823dd440221328a7b132f93825b70a011b396cd873de827ce058b71afc342bb933e87c926a420c4acdd56eae672e437bcef47e8e3512bb6ee90350ea0e4ac8192f290f4b9d1d4490a5d144f7f963cb37b88257c2d59f613264a8f4326571eea4e3689c4534509ce79a9e5a2cfef645373f5b5df351fee9736d8b885d9adcf38a76b524b86b96b49a81712ed3fc4d885c9481c2cf52e4379e4c8f0eb78d8ba53fdfe7a58baaec26e382056136786dd8484c0fdd19b6b72d6729f38fad5830814aef18f56fad548f61bd0f1cf56b2dc9f655161eac423bc5346467b7a19621c6a2dd047ac90e4b5b8e1cae6308401767911e2d326d22d8cbb603f19b0048c85cdd1dbc187c208acc662e24140bec79e7a3acb0126f7cbf9860d739a4adf61abe5b3331a57e6615b4a2c1dc00d4159e98357b8e21b731aef40f41551aa62c8a76bfd188a838d0df46dddc8dea96395a627cbd4ff06b66a2dd5d141c110f383f00561e35d646e6a1558b10c849592594782d11385a933614bc271a365"; - cipherText = "231fdabfea830c6d5bdac1395e69fafb9c733ce15e3600babae22657fb5a79155eac047c4e87fb80b0402d4d489cb41b8c5dcdc48dcdebe3f52038cee4becd2adcb71b6c82d616ae309fcc6e513eee49a1390b7ffadb984f17e5994ee70cd9182635120968f5f6d35b9e2d2c7a22eb0d4f6ea18fcb498a59f78b7ef6f52b66f37bcafed3faa66dc2fd1d2667db6249dbb0c584b514d3d209e47e93b92b3ddff1a2eeef7127408938159e32141d1e3255fa644e049c0c9e698acdb4f1b799689593af3d71d8dd1e6db68447c95fd0700833ac23b168165074cf2a63629f09dbb1a4b717b658922207d6f76c0d29b2b23d659b709b38a110e1383ccd436a3f50bd1c6561422d02ed8dd343be646edc29c24cb6a8e06added3030a6585bde58ef85f8c14b6d9033551a02d8ccc8d64190abfbe3029e29bd1e16eb522472a91ff113a389e2cb3fa4acbfaf91a537b96f5a1ac08d2ce76a1b0eec21260cecf367b2a90819626a1973c297530215b55144d7c707003c7610ddf92c325ff3accf2c9c77f4f2f01b7d88d26cbc3c7da9c6c4dcb946bcd1dc38f158da56fb41ebe4f323090f6a321f7937edfa5b29fc05c8b6c988b318bba45e391d9e59f456075dba967ff48166567fa65ed816ba21eb581626c09dc529c4759159659a09e35023452c75d72f1fc8fd6a8bd648c9b7d14d02f5c6a51999cb0e9bdf632619275a37f0d41a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 436; - dataLen = 4096; - combinedKey = "b37bececece411f62deab2fef5af60538c5060d7cf8b2c91fb1fd68c97a2d37c"; - iv = "7c3fd5b917be953c5064dbcba13a2561"; - plainText = "ad2694e79fda5ad122a5722c78f4c2f32376619ca15a67b43790ca65e9e8578523247c66ad2a030f7d8224a1fa283ca11994148d399f75d6fd103133d9677a62bc186b416881c10b990fad3648a731e0ba3d4720d155e146f551cb3a503c894b7512c8e9b4c566c35ef968237cfe2cac43960a8110d5753dec12baa4d04ef889b532a69792725bfce08d27d16dfa1c14a5c9a81d96dc4243de35e1cc3cb7ff54868a0fec480619c45ced03fdd6379a6e13039fdf02fc91299e49a5e9993a4ef81ac9b7e37de0eca3fb2d8105d41aabafc01501e255e144e656f60ede1ee5b7f79e2d6a3c3edb7c75fb8ab946c1946b8d6bd68ced53d929576b7fb48958cec96b5483ee9382675377544b2d112255407c67daf01011d44818bdae963938d59bfd3d722c6e8118fb9ca019bb29d1b94c7928f0cda60cae6471ff9c3fd9ecf44c9cfbfc8998485dcc258d15b88644c42e68c95115a24cfcc587da86a7b3d2e6e897d1ee67399977deb86710f7b2217b7129b2ffb99a89ee4ec52d8234ba35b5efc0f10e59d0a09402b1b76034ac93af4e68802ed198f3eb622ae479bf2481abff60490b645200a19548a6514c697622087b084634f0204d28285067f394e053bf7312af6221cdd711cf28d0a3194da994aa6d5852ed1c60ee1a4ada2a06dfc9c0199ed5d27f9b31796d132897f338eb3070e737135c00e40f09e13fe059525dbd25"; - cipherText = "c07e7e1a92d3f4864ed67d342df1eecde1bf28578991a78538fbd697537ed5312efda60c7dec2808f6c83eea492a8700595c3636a84176d654a69a4bb38010d58f148ea773b95d7ab2ee50482c231859b069802642d53fffa18709a0648f816cd63eb6204ca904c5016ab91c0626b505778150d92bd8af1dbc35206d715ee0c6f06eda7a614bee12e8309f356e6d3e5d012ced3e21ac3ede58fb76406ec45b5bb80fba80bc7a6b849426b398b0200c7c5aabf088cf2d96cd0a2978f47386261812fda53a752d59cd0a9ce9520618239063ec309e9a093035d1aae69a6a24bddd4d9a0705059d9f7334c8125adf29cf140ed0c32a7f434a1bac3aedea5afcabd4f62e89e1cf0257671cddc133f0be72a9b0087eec85110e015d7f4bb9fa28c4fc8147618b95e36d4e394432c0e58b6b660c0ddb1e6a497987bb831e765a21e84a35d13746895669c792c986562f96db748849d0d82a706db051c5fcfab1464aeaeb7d823e3823231a4b255e3c82df400232b8646e3bf9ef08638e1ebee7de4c92a1b6be9be145286e4440a718879df35c6f6e543b4722ab1bf5dbba0b503ec0a16be8d7082310962738cb817f791bbd63c843176d26b0f34573aefead7fc153ace8d8573a01b8f0a8e7432ef9a65c7ea02195a96892613abe8946b8bc76aee2b58ba44c258bc8cd528dcdf6e1512ef8cec2a93c5f947a1334012de912aa5c44a5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 437; - dataLen = 4096; - combinedKey = "cb48acdad38973f5c581d1d660a663a2adfa8cd55fb252da7949778a477db854"; - iv = "6f071e6600adec1acc2be6634ab537ee"; - plainText = "0546905429ee77b11f2ef1bb8df58afe20bb8627624f498e119ea58676d9c72d0b74ab30a516ab57f85dbcbfb1203bf76330783b2d79248e34fa5101636b959cb3457d19216f066b76bb2a2d792b1c452d9680b02b0c27d62e8169e80d46bb1103db9e9bba856bce9663dc25e61f9ad952e2cf6c9b65c98aaa888e6976ea0af5e3c2e0d24ac99ec3d0226128f872f19ae50b8842412b30e086d7a86182ebd621fb0b7e45d9e867a663b9a5b4c6190040f99f034001e12e3b127c979bc158895f44dba6d0bd53ac7eff5bf7d93cb50181c401c4e75b9c5b7d8c27c4905be1a349b6f0ff03808d820ea61fb6bc570f7f50af1717ab94319543c348b47fc9a0c246549a2e37cd52439fea7edfb741d4d74f24580ab7b383ca4d42d712ccd32a57745fefc735973ccd84378900b281e2a73f338ac823d1e498eee24c49935600da82b7ec788e93a95ba30db4eac6c4c8dfebbb4d1f76bf9de72e525485a49d34f7f60a05ef245184acb0b37ecb07fa90ca51e2346b3d5c38d51f21d3e4067c94cde9c4eea939b17efa8c49fe1c00e15dc7e2291256260064b5851c717d84eea539b20cac60769fa5ed79cb5520984584bc7df6d18334216f1c5db03a7735e8c658218f2935e3ab83bc6d1bbf610c27f08cfd464b464a379ce6a1612320c9d27f7712e4471f56745a960c23004de80df27f28216c973623df0e8a9d8ca3b8e30a5faa"; - cipherText = "0b3a0b4b3c1921b16b459d788270e14fb2ed2534a0bffda77798b1c1ce01d96d058e92099ab3361c63d456d00338ee3c3af1074a95ffa3e9843716a4b322e9bbcb554f0247908e49e5a522af2fb01a2ba56e6bf06745733d7a4e11f411b6fe459b84a3b25a0b78bb6f3be73c9d69381133dfe6d8fd6bedbd8400932f696a2e057f1410ffde3d732f7ab07375e648c36110ed0bbf0807bf291124337c72225dd6b42cc7968d7d88a3293bd01ecbc0a83ced66493af8b69d5e57ebdf6d260fd4574718c12931856d61ba8f80b2568186459c311fff824ba7e07c26b6d6d8302a9b72cdbdb3711dc523daaa2219949fc41fca0dc331b5d8d157569a884da6978627062cb04337bdfaf7c1782b53f1ac70cd1935bfd9e159e82da4310f89c0982a85fdbe26e07001d02242de6db020ace560a16903f275809c6bec49dd6ca305bcb56ba69cff653577def24e9b56772a0f50a3b4de52d5611c8555fe2b04b5d34de0420896fb1d9abba30ee58a07b323c9a9e01a9a580b81eca481e029097d713cd2b34825bac8f48b2d54333c9d030305b351af4f091360876d51e484f8830557997d18f358fd4f42b84cd8df2a7a1e088201361cafad33ea6f7ecdbafd44bbfdf4bf5adfdf4c41893463b04fde7de8a6aa010fa7985e36d74f22a1117b3558c81ac87d2afb53405cf32f6724a86ed8dde7a4d7f85e902d590aa853da096f169d22"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 438; - dataLen = 4096; - combinedKey = "4be787d53b2dfc4cf24c6213315b931c9f2cfe0a7a407bfd3283c51fd3e24c8f"; - iv = "83b66672148fa3b086c237387459b596"; - plainText = "260ccc4b46a4982bc4dfd630a1ef90481505e26a1347f92655846fc1417a79f98e7a26d817de2069f8997f194832cdf046cdf9de7b43dc69749c70d3ece9a2be75781fae957ad589c85840a5a87b5f77893528c5eff528d96a88974fd076a27fd76339744a1779765e1d649f08aebcda1e88ef818d89d3b54b7b18ca05a6cf50d166a25be5dbc3ec45828fbf7e251fa95524017e5bc37286e942fab6957de7d8b331be1788546234e1b88e386a4b28303e49c2e99aa86c30aa221953b89a4c80f8a1a98dc4f5b23bd7a2cc255458067901e72d03d08750072d75db390c96f6cac1171d6928d078fdb156a0f9f5a99aee6a6246033bd82a7f03b11e058812b6882b7f6b18ef472ae8285b41227bb297fa67d6f8b67d5f025935966214330f9f6aadd86db144ff21412df491b4e2565fa7703696a7406cc68fe3501ee94830c8e4bf3cb0f960dc223bbc4b2eb339a20ae3f6b678c6c40dc42d340092f4e817b6b5c175609f9f79b16733ce99e025c0eca777ac60fb7fbd3ade3376efbc465bca876499619c951b6e4682b7e57f7e0469f01e5492766c11a63b3127b145c68fa5c56324bac906ebd7be7deb565c7e1ac107fa454714c094af9c1902634f22f69ef778b515dc01619ff7a3a8e37f54da06ef4898f81f6cd0c7e7157a9c15b78d6ed0c501cd575005eda5e38bfeed1ea05b3eb0be15195186bb4fadd5776292ef0593"; - cipherText = "7e14cbc35c0f637b5b200293349ecc3e327d3985c5d188260ace9561cc5c2134373e217351f50153b59513be6fe43f1f8da4d1d13150bab9c133a335bbdc8252d989e4dc3d5584625d2379e6eed436ea42837552d1370d03cd2a10a5647ebb4b87af78056e914f5213cf18e12950b22824f8225f2d0c510359ce12e64b25f335fe14b10a10dcbb9cb99ad0b9f6b9a7dc72a7f3b621ab2307946bad071f627d42e2809d6102597f5581e2b1c28a9e43c2faf78f30a3d76daacb039260bda8075c885cb4ca5f2d81c6a73433d35af34f687b1a890a8bd1dbf375a6d23fd392c1aa18f96f6c42211c98aa8cd420ced38e62aa56ca2246b0bae0d20e3dad94bb6817a6345521fef8e5bdf7f2061ab61e7344a89c61d9267565a025b11909e43cf94fc7e67ae559c3d834ec45156afcd5fe292d846f166e259a3049749a350ed8c91be0ae253b1dcf5c087178b2721842c7606a4bf8ae9522b9f83e626a36b0d9f4ace36dc71a8319f4ccb5c7809a2e8993b578524890f0c9d378337af664b62860f6bffe4ffe3260d960d328b622bfe4efb995c05a2f4bfc08d6520d2635b9bf4cdc5eeaf151dabf31f95261020ea46e424c9561d9670c6edd6b245873df3037f6fb91d5db04c50f43460e81166133588d05c38b232d84e8e8d74a76f1800748e983cbe837d5374a306f72d411fd5a3689dfe982db87a3456419565e9aca5d19cccf"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 439; - dataLen = 4096; - combinedKey = "08f8850ad90db1951979b62acac4f85235ea05447ecf9d1f1c41987459c6dc1a"; - iv = "3428c435ffc654c45132428c8ed10281"; - plainText = "304139f3de6cbcf69fd1199efa11d1df665a4020cd7d40b3c199e724476aeb4f3ef67335ad3d14e48749f4dc0dcdd31dccdbb9479e9c6e1c4092b50e4e47082a07e20f88b225461c8cbef838848e2f8e3c7529c3eaa28bc617723ebeecd09bde3c393c493e7a822bc0ba082cb69282c9ecc86a5d844679da47ce8d752fad9ab212235808446a2cf498c4d5bbf3bf203ab17c5a93eb527b2e6767615033e3c72ca4ac4427446f5d61a903d633b0137e0edf4f95dcf1dc5961bce2ea120da1d7ff9cc3f3d0c5fe9dda78eacf10d87eac604b49cd9e783e138f817cc5ff550f17e11e9a56bf31617c6757f96916ff620bf8ee558b73ba752fb26e065076a320a68ba617922cc0f78efb3f2e8e25136a50b1235140e0a2ce2ff27464640629cd26ee6c963291cc8aff57cd9d101fb73afe22f38b92bea99f671bb23310695249e9ec7588c69fd845ef86e0f772ddfb1fafab9ddd2bf16231b8f93624706bb6b2a437c026b6fd2c44e735e9947c911f14d044efea856da1515af47ebf80e98ad724a677370b69e4cfe0221831a265fdddbff85e78db2196a7ae687173d63a6105d36bec9a738cd3b3abb6caae644bb938a8de536870add042753f1508cb824f45177f961e7cfb9c31abdb51bdc6e03a196a11aed8c5deb80c404d9d57a3bfc36c9733b93300df72310833b4768fb75e4fdcfafbc4a19c4f04d6cbf6cbe242551580b9"; - cipherText = "65bf012acedcd927407bedde0b86e59eb87a46374c5e783813a1eab7b9486b8c547e0c564e1145094948a4ba627c0a14d373ba33d5388ab6c5f7be6639008a6252d4ada41d207c12a16d3eea968d889d12a1bbab3fe11fcea6810d15d36172e06184ec4dfdbbf6ce9a4c751837a044fcbd1656267e5f0e2d3139ec0967445475e230591f1d151e40db2d5586092bdd2325148cd607e4ff94d212544318d173721202cf4109c426ca074c2ccb13dc9d81ab587091189191619b9b26954505bd362993b546f0436d2032d277e26d318ab0707362f9db69c10ca864b93a0a98da7a421b53b7649bbe907b35ba1c5cfba9f4fab7ee8f6a3c4d9abc3478ad1182fb1ab9126bc64705a40f8d932adc2bad39a5a9bb5d746952638e9edacb0efd6551dcba4935190a81af1d917705cd822dc58ff7cdf28d60fccd942b564af3b461c7896a7b61efd4af092c8e03498464f2094596e79120a148f9e219f43d6c16207db8976d9967f4fe84229703e3805a331fb72a7885a5e2ce75ca8e9784ddff6e55890bc1a2a45e6c688c03f31166ffa1ecb185923a9dafa2037b8fa078d7119aadcc2a23b08ee3663fb1a32dba1ef1ba964b5fb2e23565ae3764c9fb7996107695589b5419cfffa97b27b688cd2553a12cd3b5969b434546871cd56db7d72203a936b61e68a3943b40e38aefacaa2307a8e9efc1dceb1dd42f4116bed07fb61ef8eb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 440; - dataLen = 4096; - combinedKey = "e29e9af7690c5338e1c5dda5218893198c74512162f49fb18b14efa44a231c48"; - iv = "24cfba144cb3bf9c75ab6af92eb787cf"; - plainText = "1701bce6a9a11658a412bd4ab833d017af92fb694231c54f95e6f05c072ef8d0897e685e8a99cb496c06bc2821a72c27ceea5b1b82e90da31234e71b915cdc2f53731351f2a51f695d6e9b0af3475d768ddf8a568fe8583f51cd061a58cbfba678e77b99fdbfa6ef2a627114fd6fc100fa7dd398384586584eccec2056b1ad0acdad9be1b1a3065d64e6c14eb0168ea7d5d1ecf45b8ad98f4d245055e1023d7efb1b14f00b699298df30e6e2af0d67adc202a3dff5269b0e03b5dd3ba649f0cb740ed2b6bc0d1183117c2b0a0ac7918e238dcb91575b87ced7d79119a93b242af65f9a5cec4c9cb3fabe9ebf302819d1cdd86bf4a2d7264976ae96222c0d92957bb250cfdd0ae26ea6b1ea86fcec63582643ec8eebb223b5b9fcee680c92007ff31c4251b3a4020a912708106e490c9b54f53f62a2e4fe410f08b8c28a02f709c7f9b65672cf366187507a01766214329131f3f47bb563f97cad90dfd459a5bcb9bba9492ce698169c8212aff8386185d953eb954f32b3a52cdb9be3e36bd342a5d83e173261ce94a2bd8a6f5fbed4d98a8768ae3a77cff80250fc392559ecef23457fcae41fff2aa2f82a6827d11a2799c7af1f23e35ab2967f55b27d23640ea8504c7759c4bb4288b6b9000f78ea8882d89075e3604e5f40d9636ce6e5b6001813fee88836cc5fb9f93d3156ccc3b6988c929da32030c05eff2d122a4ce8bc"; - cipherText = "e2623526ebd1758dbadd4ab84ff9958ad337b9a3935ab36b23d4879977c87921bbc998c6df655aadcf388e93699094fca9bdbb504150e959e8eba1b7630ffed063c389808a2d441c3b3864e8ba1594c037218b4e4b8cfba934bf15858649d97a71ffe889e6716abaf7c7a904e346813b8310580ce80cfeb79326d1708cbfe1bfeb7417376c3c349698bbf4936aed294b42865b27e37594c5df0cb3c3c8dbc6dc406bdd65d4bd565b94cdff23814c444f4bebc229da23e8407b749899e85648d57e15f7c7d9d88c1feeab6df80d9b3a79a3aaa6eb79ae39a44c31064ba00e271e532b27d1850700342bcfac53a84df31346f72f0e22de4babe81115332c851827358198bbeb2b3af1eaf4f8c9a91db4f0f274a5f54f547395e239966566beeae969edbef0f56f6dc84a5d98668c128c3804adf2da4d90e3daad954f13d138fbf0b2df60fe29af828a9f778afa26ba85d539118964c5cf4d974f60d26fd0315269f7bd6a6356c6a0d3a9dc64007bc358cb961a694ecc0a43f46b604e9d204d2749c19ed07a7764163733c8eb7f2449c39bfc8ac8765aad59614d8977953265c6448ea2514e241af0795a90dcbb9ab58d75701f9a603260f444a0eda664eb0818f2a88d9fbef7479bfcf7572ce2aa48edc08a77ba60ec665e599db8491c38c214de5c4253cf8f1c011c8242194a9e9f6e231ec65acbd4ae2fd5641768b94acffa19"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 441; - dataLen = 4096; - combinedKey = "a90edbf292f563a37512173caa316d0ace0406c6a34526f785e42230b44228a7"; - iv = "c1e90acec7d67e9a2a90599de9613ae7"; - plainText = "b776bf0bd9a1453f3709bb8167f9f47ed83acde2a198e509fb5dfcd6b9db8d255ea080944b60ef60fbb02808cd3c34caa5f5cf0618d66f8eef7473db78fac737cd5a5d637f0e8eaf0fa3a115a2ad74459f46135c40c933634aa17804e60c4f0e77b4313325fd4650c41d7b3295513f1d6e1f95be9f121f73adebba7c198eef0a2ef3148cec1cafe90fec3b260f910057e49f5085e1e3db794eacae4e0893bfd88637e7442fdac9f74529c6947b9bf96084cf8a995ae366a1a82bad543d036c7b3f8a8e74da8b00b793ad35995fdbe1b552fffe8186cd7457d504cabd078919993bd4e191e5253a2a294aa27eae46ea5b5d9bd2f9253ff29fe4f6ed20500001ff114575fbf91b2f0b06687520dae4227b944ab4090d369cf5edf26ab0467daeaa56a547a18affdb2a89f3bf6cc84390fa388dafd9e480c97136b5050d6ab420aafb9f0576c3df849ce8e866a5a643267af216834271df29c5ce61053470f4f91cf146fab4aa2ded25f96356a7a7bb3e60dd8eed61ae32c793e6a4ed44e4eb7b7954db16ddc86f91f1b6424f7412b86c91457fd492d099d45cd6799eadb567cc9c04f69ee1190a4d24344f87e8de6088b5112167b65b9db8d584aa020b812ab09495c7aa0820cafbd8200c09774ef9159907c8592522ea669d042f1d628ceaaeebb319b71b5687abf903d2864addd652afcc429ccb99abeec4291581ae106c482e"; - cipherText = "34b166790e9d25f98162fea0f339dff919d9af2c360f5dd5ac6704e0b32008081888cfb096b2ef7e8210c27310ce32604fb892d61bf460a2b1783834cbf9817eace72a35a7a19cac38eeb1ace1133304e57662d2b7e10c07250974f9d85a5eae505f6bc8b77a0f6bf4277e17ec39f8ace38f6c7870671280530ef5fc9b321af91445dd34fae1b36ba3d854fb345bb3d82c0b4cd61d489e94b083837cd4b188e0f528b35006147c55617f4df41d3ea23995c9bf4797384633d3682b1b9033c2b9530daf91f1a80b50286e30b499cb7162d32a29c322f8baaaa29ea101580eefbbd6ec1ee28ba1fea91dd9714027664f30250fc0807c4b80e3f9a8fbc02fe2398e8e81685d039fda31525578023b8dd0834f7cacd7d8e316b1161187eec913226aedfc57c1570ef5180398f809196239e165a0fca5dab1e18969601534d1c3fe2f3a53999e0031d3e2ba0593035403d810c60309b766f16aa897d45cdaa8b0d6a2238814f35a435add535ea40a81f7065cd21c0286f82bc10cad6f9ffef01d51aff2419c4e100f5314e5022002a2f808a907a25c83734b1574c1d769e1ef19cb77b1e95ecd9e5af04e609163d5f08d45e01dc1d439b1004bffb0c7da8957c92efd21e3509e70094d15a00fabb1cd2e586ea439720ed631d6ac4fa0f63930c1685d7e27372aa58f3046e218c45afd376dc593039a90d517668bdf5935a907c46c74"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 442; - dataLen = 4096; - combinedKey = "3a270185d465c1fa4b80f4afcf69b3270f292ee14d446985e02f3f495f4e5b5a"; - iv = "bcbaa058d5cb6bbe8e261aa94cb90645"; - plainText = "427a61d7d84d3f704ccac763c128a7862605dc09be1913248521f07dbc01eb2c1376b2b0fe56f32c9155c1e6fe9fa08cddb9cadc38a8aa8d72146f607960100a74443648965c6171c17c1c1cd58a195e0f0820aac4b270f5beaaa45f60f03786e29e3d7ef543bdb0cfb77c875de6283ece7828614355a824729879c304f07415233457a2d23a8b1766674ec89ba494ef004895dbfcbbfa157d61d34c12008902a1efef45572d3f8c32edb8e7a9d5c562a71a8fcc55a26f3c18e98942cc07db413ee66e53623a95e6444729a0721ea28df015c14eeb243fc479bb789e57b98363f57b1d5647adb187884dc01d6048ee71a0c48a623758ba2245b1f9c09cc3746aace6670031f0f0b1a9d381a108f82bd3130ad792092909937995dc9314c61ddacd9e11a7866870c7f5680e1fdf03b45e57e9a5e2bc28669b4791d1c39d9f44d3e0ec7e511436458fe060cb33aa9882c23ab10687487d88ae9679f4a19e0a7f954828cd2f67f32f3f7b811c38f88de8d0fb6de633a20558bd6b135a30995adc471778b827ef5f4c648d70f35160f7879192d5995c631b05fe39ea2519c9bb003a42971ad6127b1a785e8155335aafe748795b7fd951a51310b90af093d8a8ca19acea2beafb5d40ebbee481ab32cd27541c29f3c9b85cb3bd789dd10f44f144300beaf9f04342e20cc8c8f22a128a19db0dec2be28bc323978ce52dce8975c870"; - cipherText = "196c410de2f99f01b750dbb9939b7c1ba248bef27c45eee4fbb0d3145e4a91d4a258a2ddedd1b8beeae1b6056f9b201b4e2772f19ffa060dd1e92719ee32c8b828204046910191b90f589d4ab6bb42d4e14000ae6ad0363d54fe547b80d96e75a8cdfc9bdc25dd8e48ca48d8ed1c88dd1743d136e1c00e1172ae4809915596a0fd2d81ce983bcaa0fa7aa68fca482d9b4283a1ac7fe618e5d816b91915ad4ac013d1721802183a6699e1628c44db266e69af309edc3625f3018ea4106c1d607f41ed2f893c3e79ec83039ebb755776a16f45413abcecc6e52fa89357edee1660bd09460cfa4f1b074e377ff3990f33f5324d0b42bff7ba97c2299679f91ee21481eebd41364d065ab835e56f058756bb3af26b8bf2b5a682ca1ddb75c22eb74d0ca47ece81aa0b19d8b948f0d2baa5435a0489b1005765d226b29e95e6bb174d5f45081ff0642f75e47a09b147937975149718b1f67bf98895c1977c6efb4f3e0fcd620af710934785cfce2907243e9f156341a5692ec2d629b70c9e28db2177e83017b8470b4ea3b361d59bfe0c4e91eaab29ee88772b439635016ea0d7bc7080293234264f224235ccd6649b0c6f3f57caa3e7424597d7b64ead9edd8b6826ef8e1019de0e447bbe09b3f1f643028af34ba43cf6b890fcc58d47c1b14e120541acd0252fea7f9ff5c971065ad3a8d646bae6f630cea53487ec7b1814cde600"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 443; - dataLen = 4096; - combinedKey = "199b8f1c07d9c467ce9eada768e2f84f4018cf7233ed745fa913e929084515a4"; - iv = "52e34dcf06efcfef127992d2bfc84b34"; - plainText = "8f602953c1e9900971868d0cc76acedfe69f76132d89416c8535289ee13ca4c07d09ae0d0a8ee4ec9342824874913bfc4e3d2d07da551117ad08ec03a39bc84e50ee028e790cae8f8cad1d822a0f1bac6cd097a93f44d535bc639f0713221bada96999f41727626dd5e4c2ec1cf80a827a623f70544c8fbdbc4131d2540f7620ac7234f65727c20804ede411395950bbc994d843207300e43836dc5fb3c1421d6af1de6063e04ff9d8aec198397e289ace3185c06b53f4421e67973ff2a42cd0e838222cddd217c8e6d423399bd5266f7cefa506632d4089895c900d5bf7ebf813d1a293ac0cdaf7974ede7f9b8f2f063f1fbad450f66a8d5cd7e63f236d9aefe7dba270cea72ca83ae3e85178be4842287c5a18d92830df97b6080bd46e6bca3600fc29684d56d933fe301c00d7b2555de17426723fef6f0a618ac5db1f21b86776b5d4da0d7657e29ae1fe1f07627e936233f81e85f9e6a08c8c2d8f941b513be4c3187c3a388f3223a0eabc02156a89bf37d42756c3f6e76d4a8a5a797a8f29e3b803a490f8c811ec73ebd43a794e4472dba0220d6695ccee16cc25aa1d284f89727b1985e197ee38648ec6fadba0429ebd46d70325ffe5a02c5f0efe1518d436b64bb277a2d2ebf0631a5676b515ce846a5a43e732eed1eff9af2839b3064de2d48151df093f87243abed97eecabaf78679007043839a344dbd374f8b0b9"; - cipherText = "244f725366a9e01a16163544dddd0b244c7d9ea28a1411e4f6a8966cbe873eed7a5d41bdaaf628073a6ccd9fc6eed14533496c078760d79c5219b9e7e3c09028949ac100803641fa26631d54c1a26511acd5b74ba1c04fe69aa3d3826ad2f5953e7f0d28cd0e74b0fb7aa055b6ecf33e9c40804e95d96e80e39b11e3e754459b999171aa6574e386faeb3d45eeeef19d23708186aeacf4ede84ca2f06f959f8590214b2256f6254b86a9c81e706e58902a4d9a2dc855d5b920df211e5924dc795a00b57dd7fe88f6dc8bbbed5ddb237614ca4b84792ccd3c51c4b089747a8e44af7ee96f477a67895f887530cb2f75de4366c9d7968eabbb3e534d7687a3c5c2a2771f1570aa163bf1ded81324cde3181bb60cc70d533b5f2f30a092db433c52fb3546a528214ac8c2a3d1bd74796f0267b30f5d2f1115e3dea5557f85d2474f52e87ab1872bba29733a841c6b988081d55ab68328ea0400d4eafd111f5f270e7549c44e8f029894da126a8c694e10db1f91357958636431f82139820d7d4f4500d0964fad73ff009a64dbdf71bde9c1d80d730c5cb78d6d67fe1c680502bbbf448c1003ceb007f036185d166fe3e6eb2e013731a6e9accf48871fb89ab8d84ed1c050c991102b6473a0e29a6175974bc3da254d263f7299228e9975e9a27635f771e09e02bf3a9df26299e016766f03fb99214ec5f0c98dc56a365e7cdc5ecf"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 444; - dataLen = 4096; - combinedKey = "123b0660c990331f1864a5f9d9cf4e5215ee478375c79795046efdcd59f2d2c4"; - iv = "97a250baa334c20a86b0e6357659c0c4"; - plainText = "9d8cf33748194efb7b5ae2c2f45fa18df202ac4f35dc28812a99b647b495a9413341a3603aceb655b6828246a943cd51f2765005db0aa6f16bc1709b64769ace58d615c93e63449b5049da0cf7d8a704bcf67682cae0c5f8b674cd62b4da2893922766b53c28b2da61fe6797bb1bf9c9460c18de6af4248a26b560143477dff0c81202bf2e2d2a83ffe401f3ed32cbd8b58bf05e679bb38c4176fc616583d5bee51aa1439f3642d6f9e8c84cd82c22b85706a87d056c939dee45945a6ca7438fc32d395da137260e3ed2420a3a2b96e65228348769ae417fad4ee35393ca6e039e7b911a91c76ab3018ec70bdfe4897fe38cc66c695099661c5cec3033b982767fdbe33ed5cb1f6fae2e6f675ba5913dec7d994555c66f719121be829124b9d081caa688865152736a2ca701bade316b7352c7d5506bad675a7c7d747807a3ea468e9f78464809037ea30161a34caa4206ce3a0d43bd5c9c2757a35d3f25b063f1774708b8f916cf9a01b72f3dab4fe96065f08281b3394b51852733261bc38b14cb5a67b3e49fa34a75fc07abb40d006502f6e627163aaa5ea7a36c064b3c42cb5fafe66e4979725e3e89290ff9d0ec8933a9e974977f2142080b3b220848db10fa3d12ae94f6d25f845d94666001fda26f7c085555120f110266d83c7283732dd41f36b90b549d5a89192e878e3f0dccd3ab9fe8c3a6f71db0a1a057263952"; - cipherText = "e1f83aa462078536b0858afde830c926f55bd648992b70bd462af86179ae3ee08b40e32568d7b696681f17f345f49b6599a6bde8187790091ff54071485eff546109f18b3ec40be3c0319f0132231d1fbc241cab244994244387d0f39bccc5679c7c7087d6e9533837f0c542bd40135d802c55d92a1354f279a497c3d7e0f613648d053f436fedf6bd6a732e7dbf0208e416aba16ebe481cf06e1709c567efeb2a87457f448dbd3ed6aed4ca354433e59646c610f7a035eb8741ff8ee3ee82ef6ef679a657410e5d08ebe345debaf38d4302100dfcb5bbcef3e41aeff86b6c4f855ec624042f44b90f3583d309b8537c7cea6999371de623e98c345c0f98b40ae6d0d3a324d3c9d138a88329cb4fde81638b9ad78aa829ec4c406f7f632366940e65c427f2e4bae966bce6dcc72bbefda32c545bc05594ec91fcb6a48c3b5bf0d67b1defb74cad01b3051493a6e05fb1daad9a3eec16d5d36d7d635517a73afc81c9e07f67b2d68bd3b85d7519acaec322351c4b2b7db15419aae882b5c68eef48053dae5d873f3f99402349e040ea6889809f67108f102ebe95c640b534e4ecb574da87663c6b7bdf777d796f5c2758826e7e54e33bfb24e1e715d6a3d7c3795d6d6b5d72c3ffc4152a53cca8839225d431980bd1f5917180f59b68f4865d21d482874bec0596908e32eee61c497eee3120108e5b1fc805424b379daef7ebf5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 445; - dataLen = 4096; - combinedKey = "63f36e9c397c6523c99f1644ecb1a5d9bc0f2f55fbe324444c390fae752ad4d7"; - iv = "cdb1bd3486f353cc160a840beadf0329"; - plainText = "9a0149888bf76160a81428bc9140eccd26ed18368e24d49b9cc512929a88ad1e66c763f4f56b63bb9dd9508c5d4df465ad98821482fc7194ee2354a3fadce92318548e8ce945208160497b9305d9ab1091ab41d1f09a0c7bfaf9f94fe7c8f1ea968f8f9a713acade18b68232106ffd6d4281e99e11d6a428b51653c0c7dde5a0f273e74ff015ce80277d7430f5daea8f7340645e0bec25f4040fa13c0b330693b10083a8b9bc108fe64f3a5b613cbb565aee2f09f5b204aee17228fe6531c70c0ec947d2a5147b45c51ac7dc8e85870387eb8db6251368368bf5f246b2957daff702e379022e99161749e6be8eb79d519799aae07c1831bd0ee72550b85333ab9e96a533e29725d7023d821abe1ce3a744be02e052568f84e6e3f74442bba50d02ad2d6ca58a691fd2439aa3af0c033a68c438b2d9a0a01d78c4f87c509fea0a435be71ba23706d6082dcba62625999ece09dfb3fcbe08ebb6f2151e2f12ebe8a5bf1162c259f202c1ba478b5f468a2869f1e76cf5ed38de53869adc83709e21b3f8dc13ba3d6aa7f6b0cfb3e5a43c2372e0ee60991ce1cad122a31d9397e30b921fd2f6ee696e6849aeee29e2b445c0fd9ade6556c3c069c5d60595abbdf5bae2ccc79a496e83ccab95740eb8e4f2925dbf7297a8c992756e62870edce98f6cba1aa0d5b86f092143b16da1441547d1d42b8006face695b03fdfae645f95bd6"; - cipherText = "0eeef28ca159b805f5c215610551678ab772f279374fb140ab550768db42cf6cb73637641934195ffc08cf5a9188b82b840a007d527239ea3f0d7dd1f25186ecae30877dada77f243cddb2c88e9904827d3e0982da0d13911d0e2dbbbb2d016cbe4d0676b1459da8c53a9145e83cf42f30112ca65d77c8934a26ee001f390ffcc18703662a8f71f9da0e7b68b1043c1cb52608cf0e69510d38c80fa00de43def984dff2f324ecf39894453d3e01b3d7b3bc057049d195c8eb93fe4d95a8300a5e60a7c89e40c691679fbcafad8eb418f8d1ff7b91175f8eb3c6ff2872d32ee4c57369e61b66d166fd0a43457478275fe14bf34638a9e4e1d25cc5a5f9e257e617adcdde65e2557405362c891e6546a6deeaa8fc03b122a55874d33e0a773523468325ec24d4faffb63c052c811a1c022bafccb97988b7e4567b247d4044b052ff73f4c671d27e052e2ebc72d0057cb217c5259b60950e3c8b3d9e3e7630f9ecbe548b9e36220f33c2b4568307cd0375bba1335e58bfbcde85cc84c9c9c1ce74f44b28ea1b697305bb6ba3b464e5ab74501293ef9152c0f5d3307d26a1f0741c5e5721a713d1b86c1808211f57aad09a950b68630afce4f0ad9f32e6769b5fe31929c446f7a3355f45884c748c9055415e637d9ad87d94c4657b1ad034cb14d9a72ea745fe52d7a711ba41ca035856a5a4489a4270bb30d5b63f49c0512fed4b4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 446; - dataLen = 4096; - combinedKey = "d329bddf0f65f9bd432d4b86fd4b759b0521ad22ed627f012ba461503c27b32c"; - iv = "efb13604cbad8ab531065200dd385b46"; - plainText = "333f807e923c021f3c8c9330da79c4f9961335b37ee8da768e9bfdab68c5a7eccf23f7430860a18e1d0b44d80e10cfa92d2eb33f376e2ab62ab271800a07648361e965be9716ef37d91a2a541b271ed3e2fb1b13eb01deddfa2cbec43951477b2daa568d8a8f84bd97fc098f052d50f8583fd47488cb6624c231461051e7f82ed3370aef8750156f75376646b4a1fae492f9ca1b02cb3249984c3be8a577e886ffb4c30d59df02b79307cd67c9a602d6529f0be432df86746c1f27e3e14a67ae2767b25f944caf686d757591e0073f847c389d8366a252a72cd6336618d1f2d8d7594eb28aafa3c315de45812df03674f5f8ec06a77ca182fa0c8b986aa6c8627bea313ac4e860710f25c8cccc55527bcb47547ac4fb200a75f29a2b2d95210b8f167fdc05f22581492f849c02afcbef8c3d71417fbabf500cea0d8d2bff0f1ae3dad53bfa878f720176f29c93eec3b30c4a98713863400d4359a8bdd003be8420cc1ca1eeeafecfe5f1e744883e2ecb004b6773ab6528d6817e4e36a8a4da812045adb5f5d8e9756d42ef6a8fd5a533b9d65e2158ce93fb19d124762dd93e44ea5d248094c7152242dfe2ebc0c6c9c6a03005e9c75424048a3ae9a21cb6d9d33a4801d86cbc8853b4882940e32f72ddacaf0b0bc1598ebf8d1ecbead72443b3298c9191978439c10c1d634a52ed4fe2232f3038d9ab057f22415cfd312f9073"; - cipherText = "a2e8212b9e9046018a54deeb7dc5579419aae24b0747759dba551e3313f8b772235bbc5c35f601033588c2b4a1dfde9ab1b1291a129571dcef6e9093876845331c5d08ccc6e7c028c21a77132ba04d5b98a64e9c99342bafc7fe67a690cf6092653ceefb4ee36af46d5448403c567af70af1c2a1e5142d34e2faf66cd6923a1a4551013efc8a251b194616ab7af2804dd0027493487a66f3a548c27bb4ac628c56f8513d291e7fb3aa01a9ffb6513322e09daba71ce47af7673422033ae365bf795c1a79f02ce953be0f07f3c37321c7e143a75092d65f18cb8da7c50893e82d1fd0db8bd63d21c7fe40197c46554ea26c624682c1d0d3f633d39bb4d1b5636199463bde21bcecfdef8155030fff0eb0b1d4880935c169097b6404dd833a9aff2bf6c5ed8a0d3d09d746f21a5db79483d4f941a6d07ee6d1c8b0d8248008b4988fd6996345f0eaf1484fd1aaa115a96aec8f7f24753991c6f8a19129d9e9de207e430e44d9ea32d10eb7f1d68446990ce01748e6c121301e611af708005fd828fe6118ed5bda775e246901e9202e54a4c1c28c91eda3501cc1cdbaf3d75364fb9e21f4444bdae5a9c6e0677e6e602872c3642f9b767f325a4573eb0e0b8980b79b7f36e83c53465361415719782c5b2d75feea722dd05ac013474921ccb9640413ff30b5388a73a2ef9f73aa21c540f45a1f4388432e4efbca6ef5f91644642f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 447; - dataLen = 4096; - combinedKey = "761e703527d5cb0e4d5d5ccaa7de80357d9d2427305f9324da52be65a629cda0"; - iv = "2c25a401c622815b0f4b02f80e4de3c0"; - plainText = "1b650ab23a53d31651223e78e73c436579754b510856ef97f936e39b681a2f481d5d024550347b9a4fa924bfb1c823d62837187b76767573dd3ce42603b907ef2e7a0ee8e380c3e56f8d8fd6a363c14bce305b5a33fbfb84039cf9ada37555a9a7672a57a0c5f2c97000c8c31a8a90fc8303f585d93e8d70459d728b00282e6bbf36487efdc11c413a5a57e9361998b1d6086b8cdb0885369c657e63cf6f907b5d3585f7020a6aab49b2ae35b7b57279ba01bae638af867f2005480de4b2f65890493cf1d3c8ff9cfb452d669917a78dbe255350a30960fdee1e1a7a1b93f6dc77802690808554489587fa48c417f9ff6866bd79a9a341fea71449749048bd62f92731e7f00b19d21eba07523c4a5f13503d47657336d582fa5d2d6f7cc4ec1dff8c035db0f81233e77d0fc3cb463189cd9e4730b6fe3a42c471f1c4392dfa743cd1d19add570ab78b12d8656b5af3970dd8dacead6699a977567b4f93e255b3ee5850bbcd8ecb3ef0f637b80832bbb1a4053809a17405bac95ae7d1c5c2672c687def6843e8c4263568074ed25feed513d689911f486ce81ba9eb514e5d70b1ce3071f5ae5fcefabe9279ce18acd12b79a337e241cd144126f169d837c37f6915841166ba51cdd5e4a3166e74cb8bd545218370be4e04928143a90f45720b2d094a219eec49c4d4a76b93a6f4c0d1db4a0aa7982228fb12030fad3c19733c50"; - cipherText = "d9d2b09aef911ce3e2c44e3ec6a3f08c54ea3f9218c77e42461f0831e01b6ddca1427f96a0be22412dfda024387afe8a611af66672337ffb5fc389f68b8ca4a5bb13d4f23f7ed182a76e8b2c4625da9a7bc79b8255d8789ae2fe6f6bbf057ab1f7dcec56713bbff8a2c9638ed3cc16a128b91dd3b6e39af9054f28d90c4a2ad81741f4c2a870715677366afaabd55ce764e137ee714fd8893b4ac4dfad97e64fd8270f8ad25c2cbcb686612827eb1f087fd4c8d3345314e4fc8269ba2d7dd021d44edc24c793e9da95aee88eac2b30d28cc4da7dd93d84ad109e5090d46f9d5ab892089a390ede5cac99ca9543315090c4cf8699bac9b7cb09f0657729354bfad77c1975370dbb41fd2720ac03b232ffa083b37b7906bdb5e460f69cc3678ba12a2a80a4cfac9f83a3fd0a20ce29b2542ccb8720ce791e521b7e0231ad3ac140bc37f5aac40248605ef4254bfac76ffcd805e4ad6971da7414e0ed9714a42a037f76d845f31fbab487e8c1ce863ae5c47053069b3e21f10416101c3f1b16d658ec8e7be35bb2b641fc07311c07557f57dcfca510a509e8fd5588de6116fbedae3cf2ebd2e27d02b1442ccac688200ad613b4bca1c788cc3570a1bacf26eb1662ad0ce3383b431f7887b997ecc2969b9a2f8dcfd1dc27815406b5ada7de4f35390110441a569e5466f21e44da300ea345c9a9a75c34ba8f5ab76c2b15f3c1838e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 448; - dataLen = 4096; - combinedKey = "5d2c9374ae9c7841298fd424cf4674792ac1cc87c682fa7a4300ed05e963aa6a"; - iv = "1a7ffc137b7e5e8dc7f5e85b5b71b9db"; - plainText = "8877a1be1107212ea60a8ed6eb90d11fbde9674c30a6b2048b1779785d9cbd9b5cb7474e9d4b1a5a90eccae78298aa9ec88f61424390eeae1574a5966c03cca83daead1d997728f8551917e2f5d904dedcc4b55129db2e50821ceedab8a0ef939a62e46f29d0fde273d5ad3ca64362726429957df35166beccc62a2c7ab00da68fe46f33c2726ad3eea4d9fdf36cf5c8f6d5a3efb120f8953cade6f0921f8d208f921e553c935012211fe3879ed9c80eead065849e10567977b9bc8cd20feb97ca5b9048e4ebce798e7d8598763175c11b48afe3b30c8d5e8569ed99643d7e932626c261ce4fdb59b17590cd23b224aabc48ce33519db10178bd03f1392e2f17396243699ae592598e6263ce26d7e7703ca89a38ca9787a0b529bf830fc3592a9f1da7e6064f9995e5c05fa87996526d51066548d7df644d96485bbe9ce4658a0b352a3223fb68e246388ebdf65d609ce8fe062fcc8eecd6809db8cbca34d460d2de5512b06f9d8ae76c155146d357af86a558a71052f167c035fe4bc8624b4bcf742a9836b3d963425075842734ed29306e1d6426606034f4fd72c3a3ee411d344e73bb88a6c0fffd6571f6184e34aef63564c46731514cad97303cd8e6db1d883edf5902533c036389d21697126e4caa7959816715ea2268d8a6e403b8c453e998f033b8f58a09b1a312f7f5810c84e629d267cf3fe9b762ee29ac9e58adea"; - cipherText = "14a7b4c349d55fb434ef5c1ae7b617ef06e17089eb4484e12c8d36dc69ab1fa725a0852c6d54b079fbf7cf7ac872ffa04699201868a4fe74c07fbe15fe9107d7c78dc3af21b1adac7b2c4dc82e11930e792c8ad8ac1582897bc1c337b4daabda7441bff04db274f1dfc09d1f9e9115f88487c7303d041f01c13b87162b55558018ec2c8917a2e1956425215663ecec3441047894bbc201430446e4324f757a4d2ec3cc07cef92633e3a52441426de90e544deb64c59b368c6ed0dc7c3247ba9ccb352d840198c43788853111527fbda0df3745d6e2a158617987eb2f16b06c9140608f29023201cfc6768a8a8d0cb43aa3c2b86d3cbba4dac5f89c30170424dab8359e37c7dbab81ca2f3f19c5bfcda3c85e5246207781a4fe5c61412cead9432ca010a79b4115c3c9af88a38b8bdd60326797a507345070082edc50bb0b45fbc639b41bf2c605388bd4c86a4a4572b91719b6a251966962a416afa2645299d2987883959da4d9204ae26c0fe327802bb4ed4490c991b60d6c29e1771ba3b94564d692a3d9db696666a20a776239e5db4c2aa74a32f1191e5c384001c66f295af94daa437baf492b4331872eb95038c4f807c4e0de729bf19ffb154c2a139fd77f9360b321f7f7e07deda0811b997c432484b23494dac0f5f5bc569712201f5b7d6f167f51907ee6ab92ce509ff01edb5a308a1e5ba213e95ee1d417acc0cfd4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 449; - dataLen = 4096; - combinedKey = "0ea29ddce38e5f3fa81c1711c1a4bede98c99f41f881553ab792afd5f2c770ef"; - iv = "0436d19307464047daac550478fc72e5"; - plainText = "a6e9cb68790d2604be0111dd3275e3c832c9cc5ad9e8b4e51c4a6a4c8037b71a10379745baef007344727b24cd385846cd3f8c083c4d3bb1dd6ddfb678c853ff274ebfed03cbda1a57ad0191259ecc928aa519a75086cc5e4c58ce8671f90981fb080a93d675054d62e302a4ec844034f66471e7c364e200c9fa99dc91ea0fb542b0bbdb823de9117b9dcb522264fa72baabcf277c51bcc9febf3acc00b4ac2939cc87bbcaf74ecd4441f0885c565721f3dbe758463e6b5f477e7ab337756b0ef339b73ad6bb392b941b75113044d0acb1299b4866c5196432a94999b9a03d2c9befbbdd877e4e4406923e4c2e910ba3398e0329b6f71a1c5d0a5c07d541b332ba1c5f7b8cee90344c9f19a13a50a2faa24d000c57f339677751cd16c7a1177d82b898e246ec71b5425f8b1ddeda09e355ad0ccfb4f83a3fc925da514bb3efa9fc70187d9e3306abeaa825232571dde735e4c465fd02d91d95660323c5e6d291c948e3a1c0b5024ccabbf18d7c5f1ec815ee377210a511f100df5ba56078ec1deb225dc2571138b312f1d94cdcfbed23cfef63e6d044a03e605df9da06a2ffb16fb76d2cf5f00a80cda5e7d2e62648d3a52acf71b6a52b67a89aad5958e9bf632c9ab826c5835e09a5d86e3ef7dc9a2ba432fcf7e14f0c820e99962e2ecbbe9459de1e88525f8f89b872e8be6e24d86500a815da93a69adafa743e1146cc542e"; - cipherText = "08992037c310e72fca400a2dbd7a16c698289b865c44dbb92cd6ab6644892a0fd6efd8926b76db155c826d41168565b2331fdf226aafb0e0ba3ef57848c3a572ba333385ac3c99c40583fa2ee4382faf6c7b71b22f753deef71a29e9da18f268bc344f0f581b14c90b6aeabc375083468449728a92515dd0a9011a575158c713456514671554a2460ff92ad14653bb08db1e99899495dac231d67174cfdcbcf003447cee88fd0f3f856e4b5c13fb4748a683d5f0a18d203839d2a8b451f378e8df3b29f0bd547a9a79ae49d22f3cdb422ff28b585d998702614e36afe266c22f90cf199c6866dab73ba166290059006dbee14309e72a1a2eda6ff5f3536ab6369259c6d89613f8c142616a2019f1d1e3f2c041ce620a85ad691c069a1acdf63e3e853a5b99308ef154fa97da85677b36ab14a8801b4e5f9326118caa4dbc4d696c094c375a845a02618aca6d7064fad2ce7a4ca986e4e564e24ecb431377ddacc7f2f342aa76ba9bad95240fa0179d6e9b29cbc849772586a2e8c96409c556fc44dcdeb25a6879f0d98962ae966f53eb074571b8a85668ae24637503e8514439c63ea8cedcdde9eff7b6ed3b848518ed84139d9a56047d49b50815ee79f4c62c09eba5fc8c16b2549af052c6b009564705fe075d00f6782c907d278e8f2550af2512244128d9654909da3a938af025661c627d2a7534b5e95b123555f2969857"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 450; - dataLen = 4096; - combinedKey = "58c14db27a299bffbdde0c0529ba2ac7fda1f84be1dcbf4eef58502c03c9c7f6"; - iv = "720020ad848ac85d0a5b43ac595fac17"; - plainText = "718e28848c324ed5dfd8dc9468468c12fc0a40b335de3c38268090643252489b836e9668c8ffa4df776dedce50ce87ddaab701b5339b268968adf959eff4d6da120234e2cb85c4dccb2bb23ddc48fc069b89962f1c81f0ce0f266f618b34391ea9a19061b85dad74661cf49aa0fbfc663d6395dba6749dc10a6459b8d089047a8793a2ea5721e2529280aa85b368bc430b7c9abbc1a0636dfe0cc553103c587c8cd5143aa59669d2fe22e9f11d863d002447001f577bcfc773e6d623f99d0cf601475622f0c8557de37590feb2a0be11c26956e3b6a9d6ff6a1a068f7cd85fed3b16d36582f00735909b20fb3015e3335a8cd4e94495dd4e342b1008e93648f65f0d2c23921c2121da259bec99d3c1936843766d39dd603c58a7d33d883e6742f592f4daff0d341ffcd871dd40ebdf6b16e375243e202741c2c4377f7e905d50751f07b47bfa0ff951343ed85cc968e1f3fee004edabfa1ac191f2a51c6b5c42ff6d466e34cc8f7268ab6b5c61e10f7c8dbc9a7ee04572f4352cc20bbc602d1251b541999dfdd270767cd5e7d9a25c21d4d2f42ad7f559104fb24d8f272faedf41955222cd663569df7f2510d21fba4782642b35f0b0cbe523b319866688107c9c1a72ec6d4ae908c954f0da0d0897b3ff3421d85078dd34ca2ae09aecc22a2bad46e2278132d63f86639286b69e4cde9a5e7dfc280cef5474bc3c6ce5d4b4d8"; - cipherText = "d7f04fb633d71e6083f3d1b74b958c2d2f60d53b0b6fcda8fb50d50dfd46a6212a823c378d37b50547cb339981c8c4978bfc896826a702138623bc96e5c15c07db44a2c10f2e1f054cd9382d236abb43affd23fe4fd08afd4a2c53166cd7a1f891b777a5a4d3e515eba0fb7fc66175c5a0eab5f81aee997d55221d668d63f1e8aed61719e306b464841e597f69cf451288a8ed69a6275625047e419f77137bc39f2052f597823a786036969297d0114e1fbd4378c66aae396aea952b72473c0e3527e8ad3c31991027a95d7158f74f760bb927eea8576809b453928f5895164964b77d2bd1041ced6d9f29389a94782d8a35078cf36262d3684d27531b111b3e8632920484897a9bd8e49a14e06902057875aa01761b56c0c6a6acc73a7f3c83397d44474a31be36844170f43b74bf3302221728bca25b4752d3784e38be0b23fdba97b07e47ee4c2b383b20bf27218b1409170eff778157a8db1a11bf3361a74748670a7bca160cd38279c62cd9c246fe93e1881230ad03b94a6534f2d9400b7d294dff95815e1fd42c36329b1bda3e1228a03d08b9c9970ed75c9b4faa17debeaf33fcb11de001771a7495f28ebcb484802f9980af20b9fff3f158daa03ac1d9ce842567716366a185d70d20039269ad5d010d40182db8b31a569966a1743eccd485314414dbb692c5d4fbecbdb44f682a7e2cafba122cff6615c7c9c913be"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 451; - dataLen = 4096; - combinedKey = "150749cce3e42afce1870a505160617289896208884e8a4c6274af0554dc1932"; - iv = "e59898eac7d4ca5dfbf7d925e05e5b60"; - plainText = "ae016a0d8c9e5a6eb99f6eee3b2410cac9d8854bcdee26323ba48fd7576782baf7f7d267b8eb19dacd66bce1b3782e09ddc2f2cbe42190d3145714491b953af1d97df4e6e5e9f9d072af492c665b817909d9b0ebbb32d82aa1a4546f7e46bd235d9a195ea2a0d0242f8588547b80c3dc92b9370d99ddf76b5b5b19ca5a383a3591e905729fba1dc9819ee926fe0dfe54ccde4f7b135ad026775bb8f283ddc11c6181550fb2bbaf7180bb7d3622c0f395e4eecc90f4fddc9196132a09c3ede1e2d30c597594ed86c6c0e224d06da043d2d204afb33c02d31eae39140dbe395a99fe5c4f837cca2f4ee7d65da874c8a4a6ff4809c651f951146b2ee690461d6167598f0f68873e6642530dd3c4d9f9f0b0f28c093fc70f32702fda30796ec617de02af942fba305ee3829a336f6971bd214eb5ed05fb34a31b2ed757bfb3222f16d7c2f83bb23868fb1630aef4a4547c04bc7c5fb748fcbb5c624a4403d16a9c04c8cc01674f07be17c58ee28ad3cc2f9b8c8d756e20dbfc8c8a448872a179760dd89f0d0835bc7c51ead1763e52affc043b97656ee878ab5d673c24fea366e7f0afd1bfc401f63c32f39eb7db151bc8d9044405320b1b2d7fa7ffc58d8cf9952dff99f43045f9b6aeb3190293b624ac7886ae90988a55a91aeb65eb5b50e8f8f56d30fdc6b4155cd456785374daeee280a907552e1f6c54e1564c9c55a0bae26a"; - cipherText = "e8056c813505871a3d6883a61de15bc587bb80b3a027168a1dd3398168585c7b7d711ffaba63e87bd0347949e299ad3441c29239ab38694917ff4b6c6dfa8217f12465a0d4a118b60964f1fb90a8f1971328f80614a344b6a2ca23ca7ef534495e3742beb0095bc52b2a3922464abbff46987d45c0e4b8ef3dab75437b933d4336b633ff6afa50b38f3630f9e721f4fc029f9ac0bdf69224f99d5fd6972d2cffdf84f1a5609f305b0fbc82ec30a59ea701172c9ec635d99cc3cad47bffc09f36b2e6d171de2f33cd1a15067d54832483bf0ec369001b25449404bde4a3cf108c8382399ef4df29a5fdb696d22aabba2e03edaf72d87c47103f6cd77421ffb50c5565a78846722c4ada563b00e27840e6dcae11a07a70bdec9a9ca9cd7968fe4241984c3aa69e8840b25f8ed2bad0672e2ecbe83ac20e023c3711a2fba4a9a057c35e7984d7a0c611864cf7c370af2ec9fad699c20bf7d2132f5671c530824042477568a7d09b8d6c476bd8ecb54b82d9cdd576718a00238c9147a57b9741a2f9cd56fd4ac084ea0c0130d22015ff7df2f2476145e88c41809b71b72db9a299c45494062295e18a6c6dc2babb9f408df4ba762ccbfa250bcbf3e84711222fadaad3ba228dacb814fa33fcb5788dcbe3b69931491044c8179bd9eba3f075bfbfa3b021b55da4b9201224d25e71debbe23cf3d20337efce6fbc3fff084d1a5cc52c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 452; - dataLen = 4096; - combinedKey = "4eca1c6d8f714d5a984c433e8ca111f1ecfb63d76fb0438165060a24449348f5"; - iv = "c81400d25fb8fc7a1afdefef25900755"; - plainText = "4982dd895c13936e25d5f297cd2d0883873b93b42cdf5bd31f488f48739dc0d2ed3b717ff8fb131cb7e49b211ef7b6b992f1f665f11f9262b60a580d8ad2157017d822a91fbe83054187b0e2ee0167227b419dc77bc9bd08d8255e70cb49e27f5cd70a341e81e25e91c844e14dfbf59a0bda33da7c341fa80728b7048981716d389c25348417b0eab25d926d144e1f9ddde66f139e23fbfcff0585de9de9861c869449c8e40a8e92bd544b7348cf01382cf73cf66bc631c029e1180dbf2bc1f2c0f9daa0cf4a337a6fadd73f90af9c1fd96ff9e1c77aac0146d3649bef25530f173060a560a106ae310101d7be096cb8998435ffbd7e71b751c4b906e7664b32ee3cec3a94dcf2347de60d58ca3d3c877b41cff0cb3f5ad402641796b89244dd28a1f301647716b6acee221281618b581b87861a55cac2e832ce8c5124b7eb7a5359642333f2e82885e46ec8533b05947dd8829a54257f97059d0fb0ce8756bd1b26a2203b1855afcb05303771b3932ab02b1916242ed6aa2aa8bb23cf03ef0736aa53653fc1186323451c21dafa4ef651a76757660a2cf16d88ba9935a3dc37b5995de59144bbbece36c37252149e69e8daf5e1ea53334e25c7e0c95542445cebc89ec09a53507a1a3491c8f3296e4f9175afee1f4f9aa8b50d7867f2a15341d60ce769913b283af5e4b1e0b7d0c762adafeb14b9d2d1a1cc9b0461375f53a1"; - cipherText = "080abe02695a811881e3279aec7f2831c74f3ecbf4d39161763b9cd7ea607df6e815610af8e70b82358c66eec734a59398a64d3b4bad11c35298dcea0631c48d0b330c9fc4960ceb252966a6cc1c49507bc63cd216e7c511b0072584b91b2576951d51302676a9ca564bdb207fe2482818ab471ae34bc885ba945e2274a1d736ed229f5182131135c98e1712d61001f464a7e0249a6ee0d31709b1bb907ff81c106ae5dc94fa5069bddb17b8d5b6f9dd1f69fbd482f63eb1e929f9ab0b3bed88619588fdd97bbf5b50b186d2e04e76dd4d4e610a750df1215534516c0bd673a7fa66be9fd6041ad3500656b6c12fc3894807c2bb43d298f9982762bcad2354b265711805d018155c6367bb7cebcb1025c00bc36d9ec4a1e446980323036b283386646697c87b333e09f232ed4c71d8eb613876be0ed0a1f8c6a63db168b866c365d6afdc6e557dfa5af9b098d28a0b133bb0f6e22f2b62e37bd0ba928c6131079a537bac0b0bea4edebcc79603344e163efe6bc287b7684f90445c89325a310d51080bae9c3c9075014c341e23265e43358953e1b104bbb48a83a96e04d5bc4e41c48d3104527b52d9913773d288bc7f9f1ffc2665e04eaf97b1d8855b53e5a7f5eced6fb63b582d6cd561463c23bfa7ed9bcf89a268b0d926c63df361d6486ce18b703203e251436e1d7569effd25bcb426faa2963ce28f18fa8f670bb3c36c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 453; - dataLen = 4096; - combinedKey = "9b19b51343ff130ac82fd0cdad6a336b3268e235970681bc583a0c2dff3292b7"; - iv = "1c746b49e20eef3ace544f1d03d9c376"; - plainText = "244717e3bcf60665394520ab142d4815c6168f5c5fb0165f680ea5d4fb0b5283c98af61e20ac68eed7b35b4e502fa638ebcee8492438595b8d34ebd59e98c2455c7db01ce6099be88a97e646f7183432541dd85e34e3480d7b1552a896c2f176f93359a8d78e20ce27193fa1fb3a0fee214c7ebe1f456b187e0caa3d4e7d8ab428e27776b751ed8f5e52e97dea116d889692772cc9a3e457ffa810bb4d527907b105e235b99fa6027735d7cf5cd6aac6c5835216cd61b0509c0d503723270dec5e87a3d6f17f7b856af4009ba0519db757935a158cdeb8fd44d6acd0c8dce64183d23244850d2e32a2027114cdd086b66017ba0062162c0f428a74320db5d7c128f14bb465cf541e436252d9d036d4cd5de6ec4445b232784be43258a826169e8b5a29027fa00c8f738bade9bdb0a493d6de7d2b4ac096691a3f44eb203f00ecbfe4f41783f73d5bdae6824ff17fd1325b2bf323484505612f241b4dd00e236884669d2836e02c6d33c10600a88632f9c4e913200a4dd5ab8f95a9e9e2678f7d2fe48bb408f6bbcae754ac6efac7132f4f72dd732d9349b4b63058e7e59ef4a9083ec804d3006b6a04ff8135b6610d60220e6b1a178357975e18525a8841f63f4cdfb2694ed6b2be2f0eae2cb93e67d0c23c8fd4350a3c86b63a33e601cd861de3d2d3847f2271a58977a912e443fe5bc890618764e8045f72e30ff7b988ea82"; - cipherText = "08e4762980117ab1d93af7bf715b45ff537381c1c137da5e6cb3c7044d3a9e381d2843045d8066fbda079c361701f5ea8f1e210f1344c5cce62cc3288070bfb2d5565d27b7eaf3bb6b49470258ddaaa797d1038f44bc04c344811a3fa4d5e130951bfa647b868c5301bf6fc1e6c41d930e8a110a9330e67cd9208ca59ab8773a5f644f9293886aea012a54bbb02c1f5f980a68adfe2e1e97ef27a037e27870535dd90eea1ff7422d67fe49ec9b8f3cd4674370101c8dbab657c662ba634ad418c4b2738bf14ab631cce9cef1cf928341ac200ba47ddf07f9f1de101eaabdd40c2e796639bd42761c25b042392d2b873ddf0eaeffe4fe57f748a9034098630286095fefa29d973c5928aac22ff4706092f71be896a42cefc34d57944e3bec209ed15f381cdaca7877a342c174dc1a3b786c51ff416a1bc89c5e3efcc381d7f639046c46a8fce73d994b62919cddb8b0bd5d192ed528db51116bf3c904f2dd464b4507eda343a5a762ed5d879e0bdbe7382071bd2d58e3683b4f353f1767808667a1595d53a50a1c897af48b72810243832d77f52efb6c2bf888d6eaff026897e8f97abcd749c74b1b976db6ee37aa12a41c8e52f9da88e87efcf520ec5d18d4ac22e6db94a7a2cdcd691f28f199983e07d1edab87c30299440fa363e0b8a4c17a470dbd03121190c7a3dd5b9949233fbf5f26dc5a9d35444ab6e7f3e1b2e671ed"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 454; - dataLen = 4096; - combinedKey = "620445ae99d4ea2d69bfdb15db5f1936e2e5f3282b5ece7b6d7ff2ed817d2a87"; - iv = "89131ff75b2182b8f5722a83211f95d1"; - plainText = "9aacb02b70641099a837d735183f9ab3941959a5b84d50e5a72a4ce06e2e28ff64f1d3cd287a96e0a2df56d7feacd2d08c991461dd3de814d87acfa4411f299c0c4893b8288eae0394bde34379e2f3958c5064b66de19601c8443f7917a7153b146636a97eafbd8fe9b3a2149241dc04d1b827563b50024eddea0e036e9b4ee048eada50894818d53ce7e808a018382cc1de29c46323e7d7e6e99d81236396eb2d899f447a6d658959b23c115f883e15c69f8867be3e9f0edf2fca6cfd8fe9b42434ab08174f6be037454f17a706387d567266ba6a075d2f2a21c5c0f4aed4ae125a3ea58a3ce4d69578da7a5a6ed9f1aa500a6d7db21908783515142d995aa391ca9556d327398efc91d79cdfb978b8d014caface2ea6fc09c4e73a71bf51941f64c26cea1236a3811437aadc32b12d1ff249706e6cb5cfc76e63a7e11dc257c3172bdbf2186641bb177c447caa879246975a2629d87d4c351784b7840e14f17c4e92c9e1bf13b9d974b06ed22d51f38b3dfb135cc1e4d5bc35740ae681dbc79425a91c687150b92e54f4c6b02391bf73386b9482c8ecd933ecac60d5b5c6ae18ef83627d6765f11881489b3038c102d0c3d0a6cc979a003bc7278fe6421623b0012f6a68c64c3a323572050f784c7fca24775173a724c5178b9d79764e7cd71477bd7a8653f32b438d257785676ef7d5baa3cbea61d98a767e24ed5e30e648"; - cipherText = "18e9e036bc18beb2f3dfbbfd2315cc8d29b779f3ac62b7c5d99c72d35fa474000558f42ecfdf23640e728dc33d154b165ea5d693e26ee9ec2d4c84fccd48ba3461f259f66f34b0971dd663d87935e6e203d308f0c377d059da59760fd349aca50fec188f83ef0b58b8c4c66381220fbd7c1d9e33d26dee44eeb1a93230b729e4216352137b62f7e9596fbd5d7771c573afc75cdee311c8ceb71fae2384ab2957bb46b6b2846c951d1b4910580cea3d8d035c081b23682cd14eaca82cc0d9332f9811a40467aa786f7460cdc3d065220c0ea4d78b9519e83e6f45cb7df6d7e3185c7275d809f23207459e3b00ca6fba649f15f7de4d70bab1dc084a2788f13e702ae5871a7a053c8f31c5127890ed8d14c0cff44d88bc757bd8e0b851682f2e277c27699aa1a0e4eb725ff549bbd7f0631579c2d3d99abc04f63fcf7c67f6d0f12a304792d707f22b6b550cb1bde8098456ef3260867a4212c0f4dfbdaedc512d3805c63ce975b8ac3e7d0ca185a7b0f03b9649dbe6d86d7bb74e09fa1c810c230904528bae2290996e66403b836f4fff4bf85b4ce0e86e86ee9be2e8da04b6d76ca3ef313a580d5bff465970559b3e319a97433d19a4ad5be710e32d02cad0b39b793cf8a4f7fb0e83fe9a0d57849aedc1ffd32877e7c17d157e3e51d488fd6a20853968acc98885534c2006ace509ebfa246010591a069b7136f8db13c5d644"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 455; - dataLen = 4096; - combinedKey = "0f192d24992d89dd39b84d75c0296222c04c5f0bd2509dc0f6cc661d601de6d5"; - iv = "3014ac0224ac8b5f67debefc86c7151b"; - plainText = "a4feb5b9be236b9a111b37feee5c2e35a36bcd445151bf63ad10e547c4f46d7701ae72adfdd1be3e16485d813a44db58ebc500d8dd9e6f2f2d720eb2090f4086bbf3d19ab0449c881ac0f07b08800f3cde46e381cfb4ac2d723ecafc18953697b0840a0548fc4c3a9fd6fdb5449559a8a6845b6fc848966055572dfc5df964482dce26c00b7ed25b7ea44783c352ef9ba784f0609012c7ba4179acb8b57c1d75ccd5fc0fd00bb25980317c63c5f07550619234c79740a620022234ee4bd68f068ec06acb49be998c81f11f7a10693f06a2b676699cf46f1d24f9b6a718e83f3b101fbcb55012607d249eccdb93f171ede327e207a52f9db43fe185e05b6425e03f77da25e2671dd85a4f716b218bc916f3f84495a959535ae58e6c8d5923298d1265487a5898913ccb6c9bec7cb83f7ba794db55128aa001406245979e79a86cc57700a250183c37700df7588661591776b8a33f1b4a2b17a1e0c7c671f2b309083cbab92f00b450db94103b38bbfd0f41b0975641245203703bf29bd9bf4b4b2d0c607ddf059f699fe0d38cbf79ca76d03eaae53aa37d64cc8f193533ddc125069245ecd62f425af8a80c193dc6c19928a18557ec73c74565f7ac5b65e76702e89cbedc6dbcd4fa37770fd72fede787706276351a5d5cc3d916c8c66fd2242baa8eeb16c94d93f723fd4ad42cad58a37f11310033df99f3a63c1cbeac4d0f2e"; - cipherText = "ba97fc946afcf0df8500937bcd5b05eafc287a9672dec7b007afca36454e193672b52340fa3fcc1030dae7bdfa781b4bc2e0b626f5c9114d61a548698f2fb70353c21b6a1d0fe11177cc7c0d68e8f57806cc9e1e4ccc4f75be918fb27993ec0f4e6b0ff7408da219f40cd2d3c7428f29e94d3b4714337379089dfa70fa98098ac6e9b71a11feda2508e572f2bea3b2142058b68ad42939d52d125f00960d8dfc8ea12572ea3bbe196d0f7e0fdf73973d66d8268f93045d51f0db7e3a2e23777f5909d02a24b65b6a4c92c5bf8e03d6f2ee8795a09112049f656a187a236d9fcf759f303ef7bdfa38521a69ee09b9d59f02d0b2630b147d56f675831db0c6aca786d187741ec51f63d3a37393d4edaf208518e80599ea390a1ec5f815d4171ca21316ca9f404917e6199b667ddc17b8986d061bfe9fea096042dbda3368236d6c29e3007248551359c82e9d24a50c7f911af8ca5bd79f03667c3ac26c8f92c2e911f5ce0617416383d28394949d81636c36f3cabadf3d4c39b291a5159502c9ca2b6821aeeaebdc4547ffbafa65403af21f829ba0dc4e22c72b90ba8cfb888c6a11445fa67200a8ad8b26d45609c709884269127cb5fe9c3cd42d2f9c37dc18e93993ab18387f079f442b4f79e357f3dac7a8030f1b0ca78a9d9845b02c72bbe5cbef500803094725a70c485d170a8950679295e9aeff99ee43b90a52771a40b5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 456; - dataLen = 4096; - combinedKey = "e359c727ab1b2f74b580e7f1ae7e289ef077394dec00dc507b4469c07f384e29"; - iv = "86b9960fafb71133aa154e44daa793f6"; - plainText = "aedf9e3dd2d63079ebcb75f9c8b58e6d99aeb56abf08173000dcda2698838e50a2cc3597df320c153e6c924e65bf6c06f64b81d679545ff7e74e75069c718af7310db41e245572278b0702e2e00dac02731fa09a15ddb153030f40fef4be17edccbd70d9250a10d6b4577d13beb13e16977dd72e4be13e9da9a1b885a5281d9fbadf98f024a41274e313ada52786880ea1732f6ee872e7f95c18b39d2f82cce69e4f2a6342af7923524a3ccdafc0742642e96d0545e9c9b8b4aad06d41d9e429b953e9e8642d7e13b96aa19112039caa1b524859915c69b464b511900aea286c2c70e4d2f2cfc1732690c00d60b29b24f4f9a94303855043ed294a43ea65051ea4f888dd9db95d5deabf2e09d4c7a5d087a7c629de898806ebc1eff9c174bb9cd34f53d0f50f1979d803b9ade73625745287d44c76bb515fb6d125a01ab1c6eceab5ad056834f56fc7fda94732acdd3bcc0f852977132db9224097d57c02941da5debf664e52aea46808fd3ea01df72b2ccb0d72a31a34c6fb0f82862b311a9e2742baa38ecb151086d2144a3d9058eeae4d6192cca796a33f2e533e4a95e2bc38169e464745f4199089afffa723215c16a1aaeba3ec2c573a333294f3c1363df53701247ce0172a328b11bbaf618ca2defc1cea9e7a5ffca479c68cc3b0c8b7fd2d69a6e581291b0fd492bcb86da8220eabfd9493d05a4f17db66ba2c64a621"; - cipherText = "e0c13b270a3836186c58af8b70ce490ef5e9ab70b3170dd6357656410cdf9170db0426f1c5140a0e552a5ca9a142a7208cfe457b9ff26b4fe91046c3507d60509b2fee525c0969a2c93c3763075b0b9f9aebf150e73564ca1f27fc3dd4734ed97acddfc31ad1cc80c01cb0e6c11b3e82fc15210c60524e0e362c855c54893940a62e808a3cacbffe16b4c9fb8167ace520b49a1c23267797e9c2b85c3bfceda3ccb4bd8c08d27b66c308b75f998def4a548b46421fd62d48a1817b5cacdf549bd91de0ed8d338eff9e60650976eca8054287ebf1e5830ae8e357153f91ee2b5c0f2d37c08e905d72bd6bc281eab034a349680563a6e843589085d27ca6a699418247ad4aa88b35cd0e217bbd329220d112d9db4ad30aaf849db12a6f81807a6b2124f92c53fdfcd8a87ee66a4d7a05dc46dc27e57133891a963c5cd96f7f8a5055ece23512c28343f23f6903c5ffe5935b4d48ba65f6ce22e0b9674c31d65d3b4468161b417cac25bc0de6ae7a86bd30c4213a0b85bfb14e52ff253cfb217287a878f50592e2ba846bc4f33e6ab45ea75b326a6cdb0b06af4590215f2126f30e3ab912f4e219b03b18c3768a0f30d5433db68b1ea7db4e2411dfca967383cf2d251bf3c629dff58ca413dd2cd4e7e67d2ff2c341a13204774c853a5cd527802217cc146967574e1f06489196e92b413c69406334f8e8fb9fea5f1bfa4f44ee39"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 457; - dataLen = 4096; - combinedKey = "29f18d0e40cd7ea737af3c9147cb97bfddf4eab5cc01246894182fdce042d521"; - iv = "b39a8af35dea9f7ad2741170d37335ad"; - plainText = "66a6e85e8760c8a64b977edf8765de15b51eb15aa55ff38048fb8a02c588fe091014857baedce5cba5ec1561d1a6e91391a7acf5516d3f4f5bb6595c90822b61a1addb823400744a3af34af4b5c6b7e2a6e85c39d51803da79e9385e79e1f44622aef6c0ea0642df08d0bf39e42177c2f309d8f55f6600151f5fa19deafc80a4b337bff7460ffd5936838f31c058dd90f1a46acb50d2bbdeb28144674b8dadfae367742b561d4903b8763101230cfb0753749f1c019dc37e511f8d2caff764d90be82f03c5ac3665ca9a1b2f994c3cf06ececeaa686d7c903ccd218212c7b11a88860e4c38447b004ea3e9a3cf73e16ac457f6ed8d545f338fec8f9d09495094069ba25cec6e97fd831ca07475209bd6e955845bb69784a6231a3f782443fa02015cd95372cef3d05d3f8659cb355f18d97be195ed73751ef3bf396df3cace1817e41013c7c7705073942029fc802446040a23a77d7a8a15955414db7b6180943fdd2b1c492c988a6e59ee56443114d063cfb1b10c7541bb282add7021c564812aa12f303434c9ccf666d9d4470d5532c6a45776fef52dceaf35daed096a2cfe4bb437b8e3d8d34062c870bbd35eda66cc26b5c842c8ceb27e531dad94ed7ce23108117f890156d02dca726e4b74e5ee09a374fc1d4109f669058f494e6a943fbb54bf784637c8b742195977a551c5ddf2a9d4eb8d8f57996f8de3c9be23545a"; - cipherText = "2edab1342662def2fdbd2e973f61cf9c65f5b9721dff09ea8d87c038978c202c4ffb6c1143c9c4b446889b0654b3cd2d4c3668acfe502d5473dc5761c15fabc88d7dbbd633c3eb454c096091e22c4a8418771bc7b75d38c469f35f0ea2ac2ebcaf52cdf6f4623b8494cb3c0c57732cd558c3a75853d5d0f4aca4322d846b750c80272169ab1adcc6fd8eae1ed97630d35c756d30abf7a8e3c59e4f426b33f00a8f85d60db4621a85669bb786cb84b38db6c314d0c9eb0830c49de8b8478f01c14fe9284d9cdec3fc092631311b6686f3210cdfa25b6c99a60a764034a66af0c3def5226ba82ca2237e8fede71eae281d847249241e8f66172518fe71d8e9e89b0a7bca6ba0b08f3782586370d518fe47a5af50e8d8052d7429998454e9c1a4a8c6315e9a499678be23afcd32db610128fe57cdb7a0167cf57cdf2be6fb883d1df58abf28f64f7ae5ef7c57e4581915215fa3d6216d5191a7db2eea11389a57c851775c7acd048825f624d648ee43dee47198e0643783d99a7fcb08a785623a95a0092a62615b3a68dacb893c3a141d601a8dc3df91c3baa87331e9e3115cd9cf3ccd287f1d401161fb217b3c95dfd3097bbcd8d529581a60b4203a96cd8488646e69c4a788f5e0dd9ddff4ea08a22ddebcfe7931a77b6363f838a17f75dbdc2d05ba2075fcb58f670ac38cd34a340c5c8216b4b8bc17041a09134bfb145e8a1e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 458; - dataLen = 4096; - combinedKey = "7034da88045bb0150fe101eac30e2257826660ed18b47defc4df7913f8cecfff"; - iv = "59fbf865b0463cab88d8f05b43a2bfab"; - plainText = "13ea3007a583109fb6acb80df19dcce132f5544787583f8bcc6f2d90a2cdeff745b4011f35f098bf63707e06b2cebd1b61477063087ef170d74503d0e2ee2c797f4529af88f4ac999eb33086d5c3906f5ed46e174ba4eded6cf84d63ccaf651f2dbec088c6ddb94bd0f999dfee955f4f623993dae1058fdeb563f3bf6a8c3331982dfdd212f06dc86481fa9a7ffec756a1bc4dec1a5829f98d50af73b80c2b3adc8764e78f4f2e050ab45ab4917f8fceb63cc57d0a6545a688d5fed3d8f54e94e463981dac9949a30ed23f8abdd8e5fa833017e1beff7dd4e77ebbad0fdcbefc5b3fcd88634053fd350bd1b1ac7ea11b6b6f9db222dac9d66a982447a7fd1d7b0d99f12049d9cf8822ab409c650d8b108c5dc107eb9cae9af95f35bdc79536f865b1af7887e663ab90f37b500bee1d5bcf3323f7e800cd84f7109a7e4ec2fa383937f1421e861359752f9993abe879d44aa1020bfd943f47d19d212402497ee0e3d709f53e489475dff179966a5c6cd3a759b449b2626c708fab24bcef9e5e3fa3cf181876a5c7192aaaa6a01da765d568674b2900d2c63f4c03022286ac8dd2e4877c2a1c928577073641de31b097479143c0cfdc4dfeef04b3fa60146b143ecc7e8088a41cf4017721dba440517e60c83b0c4aaff40e2dbbfdd5fd2122db674be78a2a0c908b97e914dc01ac76e2fceb944989ae154fde00243901dde3cdbf"; - cipherText = "53911a15353845b3ee467e0aad886c20bdbec21a1828eea0c733d216d812b1fb9c554c5aa85ead9e495b7162c23f7d0c053ceb98a5714b57f23ddb16d3474d9a43eb4666f0a419d89fcd3b4ceead2d38e9c963645a17b369234677f9a0a379023d4e34a1ff3625c6c353ac2054925b7776ad86635af9dc131a006fd6b99ea8f8176f7b80c867c6e67e66bbe996c4271a9e4fae716ccabcd82712c43959c28c10896fcb692f75908e677da35cbb31cbe9b69ec0b0777e9b7309890227a564de952b8c6d453c714e0cc6b65694ad1b58641de048a3590c78e70fe18f1dd384bb73e25d5c4696bd41f8bd3e0192c05b27c9caa77b06721153699ca8b08aee18cc44b6ae4f24c91b9576b2d40883627dd68b39792dc8736bc8e45bbb1f8d76d7662423af4d5bffc7c4aa7ef638dcdefc73b4481db8333d9ab099bd3bd5b95ac36169334875ae3b396a6a3f44bee88ff8fc93130504fca7faa70c967ac8fdabb2b594056dd785dcc015a6b568a382d897564f2718622d4f053ed5e9247ca6e3ced11bc591497b617c9ec2d53ce4cd6b9762756b8380453c81b49576e5df661c14b15c60397e875e44271d06397a3172182d56145ace1292cfcd25160662be4ed96d0928c47cd12bb7b163327513fb36d74b1864833612f93c3b17b1c7133dbd3dad7357ec2dba5835fb92ee5aa9b28cbfe831a423f29983a6c8e087326a7ade277d7b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 459; - dataLen = 4096; - combinedKey = "c91a6b17996dfd5cf72e48b7b46191aace9bf246320280d19be167ccb675ed7b"; - iv = "e0ed2dbcb03d60c213a2b9b51ded2ea9"; - plainText = "e7e9b510687bf5b7890e77b2fbb95cd55caddea201544d587dcb24ee88d494930e636a9465848419f8a048918204de2c5085b118fdcd55bb02a57aae6c7895e565197fede41cae889bc3b79113075623ee8cb9a895162b58920c80875ff98452918b556217bf417b7c3fbd2252f368e55f30a813c70f7e5a6d99e48c6c890912d55ffaa7ccd92e032cc9a4d4205e5a33dd6c44c2c0b26fa0a3c76ccda8ac6b3c46f009f2ee497a6c76937c5f52f258d177c5bcac2b23f768e62e35207bde5d5dc3b0840cb382b827ec2d76f5c120f4611e270e55e3884355304f55a73d08dca0f479a18b4a06af10bdf3d558db176937e19adf311f50818e8df92bf4335d2fdf6d35c0f6a2486f5999c624227404ca2a52c64e192c48e77f7140e87f6f9bc3195f4eda54360f836ade75c682c47a804962d4efc24559edc7875dc952ca7796a4ffeb5ceb6046e0e42a7dacaee7eb6e841235435ea6b05cf04e59710d804d21dca13a3b93f4e7af70d8441721c3c3b6564d6045b3adfc2e20bfae9e01d5ccd19afcb354f485c07d61cdee0d5734e1250211994f91ede415df6a72d2e569e3b79ae0b3cc77e7be6419b545c5f660cd1f63788162a109c4809ce302d764d83d796f1ea1572976e3561224943c0c7372e74f6e784b6d98a1d6275ac4f4ac36b8156ec3f728ead09e3e07518c2958ab0f339c0e7f2b4959e61400e3f1a7ea5495bb87"; - cipherText = "a4ca95acc878437c5521e18dda89c456e99d8e4f0da9bda9398ff9e8b147f8e707fa757ad7259493d19a6dddc232993810eb3cfa01fcb4e7751d4b21b44a251cb37840fb12f9cf892deaf01e39d65db6c7e7f9fdcc9014015031f856707225bd1894b2e6ea74468b3742b714610d99dbf79f52cce4e38ecf21a8bda075929dafc39d6652f812c1fae5c10210bc735123625928e685f38a440548acfb54ef64b76128714df56817606d8c8eddd98787f76496c7e690dfbaa1292130c85024448d644c195c25b457334636c6ebccfd0067d98fb11e86276ecea2f3915d3756673d8236f78436fbcb9020857cab2122db95f33fd916693f3c405b497fff7664fa129a9e2d29d803ccfacc9947294bff1c80a40493e93d8157928fc49862b17e4130b8b276ed1ca75004067f3dff86de1dfc4336b11f60e78c295adf78b4e46570a2e3d605c168a7e001cabe8e0e76c26f13564f54e7fd2813b7e7c95356102e43c4d9ae8e3459456e05daef01f01ab0e04a000f1e4cf7c5dccbfda7b4c811325cbc4ef2403af548aba2af058d25653f8521f34c89cd0da32dc13e5d2416dadd675914cf4fb14c16e4f0eea3d6998544f3d0b0b2c5f4f5f4310f6573af9b5bbbe785d265137afaf375cb39c7704cee3c0465b3bf35732da27e40d551d96fda98550a7257ea1417c1935cbfe5704fab0664430178b131c03634f8fb62f77705927fb0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 460; - dataLen = 4096; - combinedKey = "98a48b9948fb4d4d70edc4c96010d5e5d6d3cda3b91199cdc50ac4a48031cb81"; - iv = "c91b8605408a3e191cb033a02a3b2bda"; - plainText = "652509ea06b98060bea17630ee56f13e8e637a945d6365fe74b61628a3661307cfbd26a1da6746911cee8de6ac9e67a7e628db383c735884aad5bf6c5c88de26bfd3a354dfef6e9c0874182e20a9c884f5c9eed62147e98db8fafcb2822bc895b339da52a262323e6731ac2518267b9aaedcea14329b2a549bfd4989c4a1cc050497dd33e1cfa3c98a1b29c1c52b793d860edb56be298bf4a4736c75c2010d68f80a44f94b4d4403f77ab3031d5e3f1a2e3da58b26c381e0523abda43eb3cbe419a45adee7ae0abc78a1ada5d0dc603581afe5dbd90dbbf74608a80a0bb5dd332faf218b7342906a2715ed11e8cbc4fed61250e45dc2b30cd0bb5f12cd1e0848079cb5c944187eefd55908b3ce2bc4cf314a2dab5596ec11c81a769a2195d41e9312018729c0d21614c178871e8de7a825880fecdf564658084f08ccd7768803944c357a4ccd058335167471c01a68c664555b2d4369f320361713d02ce5a537c0cbabab99a9a6f505ac54cc005453357943df88b8fcfb7926d80413eea0488b36fcc9f24e5dfeb67cd5c51fffb6fc67a0c58db8d0549f5bac732c8badbfd28f949e0c84fa9598df9244630ac1849d53b0ca332763f42a4114a4927df22ff2c0761a6a5498d4c56f13ed75ed3cffc390323d6990d6f2d48e9e30f95ab5827bfeb74bec8c682ba3d9906d89cd6f9de5ec244defbeaf589f9b96547c0f4c608c82"; - cipherText = "8bd2a3c7127e9c9b4dc04cd8ddd1b1413acf6bd176eab6712ee98673a1fd29a705883419eb7d0ae7a82392cab969e277b8878c1b4581ec5bc282cd1927576490fc134cd96c237be3c50849d6c3092209054123d9cf98bdc1dd76b10a30e1da7935534b33b85c2af3b6d5f539ede89ddd8b9fb2eebea84f78cca087f97dde621b178255c9a4301af1aaba1a060946b788e5cdb98e6b155dc613c8e88f20aadf118d997d8b5473d2eec85eebf785ef39d50f1855b7445c69c524a12475096a3e720f80014f4f582ca8ab30776eb0fca55cbc9f4cb742bf9aeed29079a074291fe67432d9661086f576f671da3cc38be0fe94d01fd3137af7783ae0377cba33e0d738bbac5897bd4bdeb07720224f218f7fa3e13d8b0b698ae09d6b76b58673338656bc46957dc993d6b518345d3fd79bf8355d9d67321799637d4c142466f48b52c917a9a290fb3579f7320d01a7d106df5b92979bdbbd7a8c05ce7a4d412a5a8d326850f750ba68dbb12be2b9bf5271a4f4a58bc9f702475b6007de363393211288298cce5b4f17822cd94a3cc9949bbd26c402db0b83a35bed25f930ccf4fa5dcd3417b84b21d1a86cc9666e21239574cf0f60d59ac44acc4d2b83d5cb30ccfd19866e75449687966cbf05a56a3ed17aaf545c6f8727ac61ed24958d8743cdbad3bf97a3cf5d614c958b339c84523d58ac7acdb8c15a314b73223a5291c781f3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 461; - dataLen = 4096; - combinedKey = "f2e336f8aae1c52315971768e2670dd338f81d47774aabf801cf4c3aeead94f5"; - iv = "3367e6bc7f1fa378ce6180fb51da70e5"; - plainText = "0f496f6c39fc81b2080301018c9a03e9152674a3ba8e3b689640e758cfd037e5657220546214101efc9acfbf5c07042bcba69c31d4df43286a64e1e31d1c0fca1a9538b413577abd0529db6be777e8caf512bb86100a028088ba03209df481fd78c35486bb5b672d1aa0f4b6ae7ff4c5e4280b1d6d13df1acc65d7194eeb18883605090ba68160daf133320cb1131b3943b620778d9274f946cdfdd31675fbbe82b26988340416c25a3ce82520e6a61029709fda3fb8720a9c7a0db963a9d81977c4504703c55db86b2fdb626695bde21ebeadbeee1b910b0f2c8fc3bacf6c845ebfac4d797b1d3cde1fa2069b72a8ba9b2f0b18a50ec8b7d9e63ff895b98b66913cfaa9d249f8baa70d307300ab2c5386be73a4de829d803b8253c86b95c0e39386fffa3c23267687f40a76b4ba19b2510e21f286e22a0034671af0f1391bb31c8a9acae2aed876e955dedb01923f28a24c1fc2a3df8e1b35b19abe2b738b46a84a3c6f2e4f07a683a3df3db146b96235b4c08fcdf973fe72462f657292bfa305cdad65ac8fc8c73bdf39d8c6f2411979109e278b3a14cce20258b3bdbf906243d15bbc4ecff527e7ebdf2ba195ae3e83129a891316f459dd35e507625f16d271b09e98a61af7b8eeb6b709c34a9c1c72e1a2fac7d6f5ff67c967890e8c6a1b233f97e55c6692fd2189b301af9d52a29275249f31907ea122d2d2ea8145618a"; - cipherText = "d809ccbfe2906e537aeb2b4e742a27e8348609ac54ea2c84078ff07d5bf18f99f9d639c0f4d9112d65b25be184c22013c98b39ebd61c993979b656c1b35676bd675b778129958cc5f82c0300e55b6df8a8aa3188fb63cd6f804726581e28862c5d57861c5c417b026c62a7eb2dc966f6913fc398f7d4ac37f4e1641973c68f39c7f5969563bb0d14b8208c5205f9d11403ac754a4e932fa576337532cb8941ebcca0439518a5f18fc97cfb38332dccb82256412506516b5d9064778f4d40c27038971ebb1b25c4f84039b9dc42ad4fb8ca1a464c0654e1208eb4f68839b10465efcfe290c5ee43a02f0ae022f98662e0f155be11df2b48fca1c2997adcc7f557aa066ec1d647a6f6d735101c8fae57e07f9081302b3e899ed73757056ca53ca5e7e97e0756eb85f5fbf2b6e7daf3f3eb8f70c015286ebdaa6d2e8754e3c0b4ff445bc8cd911a2e97ae886ad254406b0cc0b97c9379cfb68fe18efeb89428fec500c5e8ff104e45c5385f32cca70fc4740b717077ee913853ce1624cdb0ab49de5053bfc61448a206bf22e05bf7e6f192c9b12f0fd37bb0ec66f8b6248ce688cec18409930056bdb0d9db95b4581552b865e88b93bf2d1fc15e47c5de8f4dc470289f0403118cd572e20f23d3007f95a4afb95589185c394dfcee0327be771e0fb539d8bbc0ac699162def97f9326df3f030ad140992b552e362a7d59bb9fb03d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 462; - dataLen = 4096; - combinedKey = "5a2a78a686aa1fa5fd6169736dee84ad6913a0ef9a5f4b5fe50bcf0c4499f718"; - iv = "30d463ac6ec4372d040c854d56c54feb"; - plainText = "4cbf47244029ad21f762e9c2ac15dacccb457e24307f7e104db4164abb30d23c9e0e94f4301bd2ebde9d9fc5335a779cbc337bc29dbbe540155dcf6c65a8476a91834f9df1ede769f90c187099a3915deef876cf229116edb93860c4ba2788748220d5e2839db9dd0bcb5d076d0f2012fe2406ff86927bfd52a6333a56dae0c353371ffc52b8d9998257c7cf907cea27564f0775b33cc94d54f221f128abf2d0ffd1157da0bfaed314fe122df175bf9fed97c21ebac9008fe92f775001d3aa80cf54f706f29ae7f77eabc22129e25fedbaaa7fb769ae943f1b4939ab9decfe8c6b5bad5a611395016c69409eca96d5cd524432dfa93ce457f6c470cef59b8e54ca28a17a660f9459b3e3838d84b1abc884fba1b28ce84b7239509ed4e9b457a1b9432239d957c310eec420465b9c2eafeadcddadf830c450f74c9fff0a6a9b14067d7ae50edca7836fb1bd74f498a0db362acb152ebd1ec80c6c129f2c50c2d8d8d1d61618cd6b149938b39f7a21cb298bd8a821851b9b573c0e3c1cf9ac52b200eced71b1321c4ddd3c4efa8545a4a929cc3100093c87c8fb5a8ad423994c76bea4e30948000cb5e93d6225f6e9e300d0094eb4fbc9e9299021662e9d4e8676c7ba0f3feb27ad06901d2753cf7ea82867e48a452af042e6f0347a1ef30d4aa84920617cab3390e5a22ee4020989c011aa62b09138586abb4fd658bb98b8be19"; - cipherText = "665eaefd4cb763ea46194c135501d1aebc69ada75b60547dd4d343ea4ba3a4dfabe0691396ad605a886124119b0dcad9c9144090c167bbafc5ea8125b01b6660c2438f07e0722b21d2fc59663f9972acaa8091143359bf58935148985518f0fff61492b27226b0b93c18be7f7be410fc66248e98e885dc5ebc9ae3142e8568a868c95e94d3933cbfe65af911bf44714be1d4dc054296ecbb7caeeb7beda56b976a8996ba7d90f5d3d21983d2becdb0de65e999efccaf089a1ee37444cc7a9d3c47bf0bc4cdfc0735f15c5ffac37778c2bf1c9cd58ec8031e7c7e5604efd66a309d499f097c668eee02e6e3cbfe83bcbc9bcb279e7582ec61a96a2623f718f61d5a2cf5f823e3c7ba28fd2523f54da898abc1209c0401f96b89a6995c0a7b860fd8e62a228a4b2b81adb9c238777322dc169a9301e457f7b3061267edbc7461956556acabe05c0b4dd6839a88e3d61ac1ec2e326ed6a986324207a8ce1dde5c45310ce2394687766c3d7155ba3837fdfd0bbfa089b77cf5488c92e08704dc21b417e5452ebd6bd21e1ba9758def7c8528ae15b6ac1fe7d33a7a026b1c132636fbfa64b3ac94f1dbd65fd171766007bec397e1e4f26c9b7a729653418504c1c65ce7a9e0116cd0d9df2c837cd016e0c7d38ee141a7c6488f0f5a14d1cfcd54c71f0d21d4229b60d4b2e9608ae930358850221059cb698e7441aba028a0541d8376"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 463; - dataLen = 4096; - combinedKey = "a5f95f844fc48b4db7afe018a8d5965dee6cf6b4124e4607c42781afb9ac3859"; - iv = "e82f8b9c4cc74f1163b0da9dabd20774"; - plainText = "0847e6f00794f8af29631501fa9c6019d8d2cb4f688104cc1336db54ad4ec07fa49ec5fdc8fae4585371e6e87cfb6bc19001ab11ee89d0c61c0defc453371f6bd25b14b26cbe144f3307821649db91a257dd8a658ed787aeeacc5cb268ea10822c69fa20369d476f15a37943d6f3628dc7fae3a314498bf4c08d6e6173ed412e0e1e6101f5cb354a2c82e5c3c3fb61d1c21c974924e9432f154cd3c840dfe7a6ef8d3ca912ba98a88ea807c2e085389f7856a0deada09ff58f051fec2cf52c960717f75a6b4229e02b2b4de14c0f26c2fe2322bc1ce0329db1edfac426391c12efadd82d8283acf527a605978410d563179064ad95dd07b89b2bbcb0f9ebc108492f9d73f53fb9947b2c055a46a0b666e8e4f2dbd454efd3cace8406f2e0aeada75488206475febc82775f9c224b1f0e3f0a1dda909eb46b53c573b18adc18ad1e2a206d45582777206c88f970779d145577f1f3c0ce63dc277840030ccde43e858343a6270aec7106c3b6754dc82dbd8ec9e39ae5dd3b52f8d796cd5c6817901acf50728c8e389211fd9f1134b46c2e1a922cd8ec61193a83a0a9def1e3a34961a3ba5dc550524f2beecdbef870567feaff2d9143446647b9509f5fbdfd65dd6dc7d996ef829a31c77ab375b7c3fdd6f12528837dd9c59b6032f4282e7f10f8e9bff4cbe77139b83a3cba11c291f99ebcc81647cd43dd871bca7f2c6fe1926b"; - cipherText = "f839b772fcd08229951a8d7411dd7c3a35a02a43602a94793ec52633f9ff8d0751959ab36746f753b860b84c417d0c2d4168aaaaa3288945f0d1bf4854503733801ba9e65d3095cdf0cc2a00e81cb287293c94513c1b6208c67bc9221890212aa6bc0b7726d40bb4e9ee527d7b065b0ab96b0a46d27b019a7b8c278b360a391262344629126cee89d8cf31c1af93e63a5799738e1d63d21bad2446793e81cb7f8b90e6fa2e93648fc149eafeab69f9a66c85cb3ef7500ea63972ea90a211f13a457a9671c29489ae7c12a322b006d66a009ce4c0ae63471b5dbce46fe32009ca0db0b737fb2790d9ebcf37fd27521765e7461a2f29290e516036757db15e02b19a39b8d9b751b9eabf76fa77b067b0e678187d0051fcbad4efa7cf7fb26f07bde7d9d374946245b6719cb40ed8e7ea57a0190770e63cd04059733729eab4a7ac122b3be16694bad4f281a341ab4760ce2187bb6112a6cd867f643093c27eb1e102cfc0ee68b0020162645162fb4022bc0ba52ec31111a8364a1ffa8f18067891f8ab0715144581e374fe6601eb7fdad945aec27513ff849cb7d0ad2f3d94f03e59ecc42b2dc6c909dd38b09fd7cac2a25476df18ef41ba361aae44bbb370a9e8f3d95d5dea1c306199a3a0552452fc59a0555a27a16b4eadf176625539047639f4ce22466455660fab5826ae348608dc9d83bb5452e397182469e82accc9f91e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 464; - dataLen = 4096; - combinedKey = "5ca371eb2caa563db0c2bdbc358fca1b2dee4d7630df45c9daa1d424c43b0fcb"; - iv = "ab0f8d65e716ff1351d93d36ba24e9ca"; - plainText = "7d6f9d8e65169b2f90da33bd0bd06876598b84d60e25307a38a337e8e583de58e66bcba09fa79c8dab6f14c91382e092c6047f196791774efb769409a8362d7674f790a6486ec0ae9c421aafcc42fcd8118bd3c66ca5e0ef305afebd6a8fbce48cf37f68c10f942bd544a1a4221480bcb901440b788a8b4ffbe158d6a19cbf70afeee7dd58866ab1d0eea76baaca109eb0de70de25077048bdca4d325f51451ccf639e1c65fa40d359a5ea852aa8794536c07bfb5a2cca28210673db0830298922e76a6f1fde3f31d389756d6bfa0a6f9862afc60f554c797e295b09d3eb9ed72e3858a08fa41adf6f03d1eafa212a81b725a1aadf424c461793dfa705ba36c536d4137f49c2c0a61aa3b1009c8672441c67d0ceebb8d4096546fd341a185700b3f83771d9bbffae3f7d5263184e2a16366d44c246dd8ee7d4118ab3bcb9b8c824949688d857f5c5b19dc6e667779cb0b064513d5b581aee237d4d48a7a60066ea674598e72186e05dac852bcf4e98a486269993566a0fbbffc817e13fe150f1142c7b0f6f1612096fd1ed7e2f43e34a911616b5aaae1bc21e0900abfc23bd35d7410bea5cfb891d819819872098f14e3ddaea22d8d18517fa5d099623f9c01496162fcc6376aa1f0f78be44cda6e23e1d022203720e71855c24c5441cda701140b7334f73ecda7e93f79ad05f9860df08c175d1808b6ff3c0c956baa45a1366"; - cipherText = "0fd7549899b307704c76d855165ea321f2280d0b857d6697810208fe66272650ddaec1f8af31f54af62ca4d919e118b1f36977e115ced849c89f7f9c744c0bba3f6088b9feac0722526513a0b082fbdb82cce185b2cfefdaf3f81603f4e6180f87186d039218a3214d56b8612f0e614996aa8359e138ac48ee7bdd05a5453b749ab533e137f8e82757c3ce9a18893d7de2dbe9b0f06da68e04926b0324716f9b27027cb86efc0477d46a655cfde8162630426d4312bbcb1eadb7087bb780a90754f1df5b9d5fb054b205d976c2da0318df31625326c89acf8ee6ab6b6e3670fee4939c22d89a91f8e69d7ac279e66011b1bd74ba4a2d602bba563e279c97a54d5704533258138519663fcf9f09d8d09d3ddc4b63e226cc40c8641ab91c62f0f1f9a1d4018cecf88ad7716f14d51605d2ade2f82abcdb0830e0643f40c718edcd04d6e3671774ac2a0994ca66c0f85bc10904d7feb43500d35b9def4104916ebb7c97566da260832372d96ad721523f777d1e6df2d5b96ffb1835ac60997e260650afb58f2dc24df113726732eaf3a149abca2f7ab4e3d04aef8c0d6641dd83a87c92f92459333e9178ccaf219392ca0342aa9ded6ab3c1c40a5f3fb7b76ddd5582218bf1d5b90b1bac7dca79bc11f07b17a491b916cdbf01ff1da8c556645e1b05257b56cd54e90e86663253ecfe7a0e8a4a37b2f2138fd2e626f2673221380f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 465; - dataLen = 4096; - combinedKey = "60a0ff7203f82b989471cf6bcd6bbf8a969de1e24760dcc05ffe8741566937d7"; - iv = "929ab70bb52d5ea5268ab3006160a273"; - plainText = "b3de47f0abcf8b416f364a1e9302dc94c796b44fd968af30495ef70f07bf6d360fc5efad46a2fa94c1cc4651b818944472563ab08e35c320f60f7b835f277545cdb4946090dde425adcd2e1cd74d5469ecd8fb25e598f7c92d370892b37e339ccf5af050e218742d4d866d9ab47bb23da258211181ecba7b2ad638fd152343a366d05de0298b49a11758cf41fea9812a38eea20c89bf78a427a8723d0b22ced2e805f9dea38e2437b996b9f162ce74cec514f961c48de6d6d2f199ff5df516d78097704d7c5e002f7e947ca3f82cfc90d06668ccbfba37c345748defbe4e1c98b68cadf93b420a227c0def8bbad4b154a5ae1c3ec6395a649976097cc8cc4fb6d87d4ad52b3ef5abe3d32fc99be736e1ce1c4c2b734ff231a201220e0d43decd16ad7b571a8a50274d783bde591232a353ca9a32a191eecceffbac395da44845728fde88d96ee56a6459eb8ee10936a730ffb391bd140d8512a7d381d11f3d65a57f4888fe7bbccf2edaf651416fabb7127d17f9a0b2c781d1f2ce8e6e8c4816e78ac84df8a61fad6808d340050fe18b89cb8efd901c138068b95b12a1bc314d1b707a5513135fde9a0f41eb71e561b6eb43b0f9baabd81e315f7680f1791310c0d3b8c040be0a3e6cf5c342137ec3620ee3cc6c386252d03e9fd17f97479b5bf8c26dca876e57b4a38fca20da6058f48b0cdbeb2de67ff1a07b188cc2f532f7"; - cipherText = "c58b5188cb69dbb138321ea4fa393236d00c00b987470e744ee907daa9b32e5f4de361a1e4ee516b8b10cf8b1c54bfdfa1cf0c0613e2dacbd3eea9174ff0c81dc2b836f025ba1ab9888464a7fb7da5c63372552d4033f2ec210ab0595b14bd37773a7f42a608162dc9120b1edc61dff5c9efb9337ade6b1e5fb7c188c8af457c1997e5b9208121e2472591aaba53101172877503a141aa691408d80716427be4d9bb8fb36f77fd26f54a23fae10517a6158e5e0239fcb704219b045e25f362111ee50c0230e78113ab17854aef224f1f80a0f5be3d533cc95c9475e6f76b6a00f5f0de6b8c08df1ebd943bf0dfbba57e5778ab81d8c299e3e18c6a34164fbf1ffc1124964f8806d48b9ce670d62939e93a5113c69dae64c21b08cea5e24daddebd739e3981b3a3b95a1d6cdb9ddb12e3f4aa3117c1338d2b1d36af6d55ffcb04194d42beb209bfb34aed2091ef29c667e40eaae45265671482f0f68b7911b1b154510f8dde68f8bf756db78e636d22681a914007d54513ddd60afe3b67a689b811b633b526cafdb4cf44af40bbef54887ee4ef63e6aa62b349892faf1c85c6483fff01ff66bbfa43a0693a7de2c7b5b7ddfe84b72a1ddfd379b744c2a34a73c331e47e75ff89a14271beb42b84fde4918db5dc1e0326a388d3b7802b9b895115572f12b7f01595143d59b2f38679cf8d73ca8ee76e3f8d8a76aa95765c1e2e53"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 466; - dataLen = 4096; - combinedKey = "c4bbc0ecc89841b34fe47f67574fdac5bbdf4aace86618367829a54f4196d22a"; - iv = "9da4fbaa4ec49009e2ee60a180798b6e"; - plainText = "741b927497f8410e8976b511ac2ecfdf0154341256869fe2769925c0c28b59994fd7cc1f6c0804d7d491c9cec1fa8c55ab249937094f7c688e3e0b4ab349950fd3d10689d21eee56eee92469b25fc987dd3bc97e8e43a245d17714501f02e380e9bef16e63716e7102514db79ddc092b4f312f024873d2d331ea4a86debd6faa1eb23fdc9e1f7165df6b6233e8710c7eb3a3cf81d7c04472a80b53f70550af427b4ff91a683112733f715c074a6ea8a4d57b9a52e70432f59efe7d175baa4aac1927387ad19d9e18aa1b03a326ebad2a5c7af0f99ccf452485ec84a3d7a82751802e326381ba8aa01b93db42db318795605a3b0ddaa08e3c6a5008fe2b8c35dba26fea47753bd99d083cbaad52bddaebcb8fb55099365ba85e3f6376387ff5768437db441b09823f34e8aae966f727ba6fde4fe6c6530c203914b3b53c334b2c1e962eb1a312d80b56b63e64a3ec51fbfa351c01285dac0439185c2240f7af4ab0143d2749b5a649132ae1d092219198c5b71718f121b9ba5b3ab3a104be8a665e83ec511afae7bf455ae32d3e69f9496cb01b1686f3e2fb8c325eec3a89c2d73410c3ed802b03e66d9fbca1e1917af5a8c1902871d746399fa4d3d0157f924ae0c106b2988da4a97dea4011e752363728929877b00c967c0fff56fff1710014412c267a764f992726de0f460d2c868a1f481fa8fc8a80df4d64f7749e156c85"; - cipherText = "0e513025100535827abd50fca35c9d9bd4ed98dac112d0fef4513423d9a336db9aa3054aced1e564929b807b8a0adc947c45a078961ae7ffd5ce289a786fb936c07aa32b3fbbfae76f90de76db0c56fe40527ba131946ecd9a63625dbb357f240b476d9cf85f43f20dfd8a7e14002d191ab577ccdd3c5016dc480fbe493e19b3dfa3c806163bd63fa448c754e7b0e56348b205c82756b1ce67c19545d2f187130c6c2026eb4f40d9a7341b7e6b1db897fad6e45242dc084fec97c8e7d4563e1e5b2b0290d1f8465c00bf5fcca441dfe59c125f40a50b91d12137c2f8b696fb571c628624795be2d2f2653bfcc0c84f729f5c4dd8dbbc3cf7d26f933b0c066b175266d93fc0cdad7f0e44b638179b79815a5484eb578d2a1dfc63e78900213dece9d3eb6093fddd046b8707c1c34022b9e9883003b65fcedb79d08b544a40120348f357c047e1afad851294afcafb2f54fd043548229c614611553e89e82007ed3fe11e8b992f5c54248567de59e3a99e5b305f3009d02c6242c3a1ac0db9dd8b54d1d0b7fc5c20e60f4e77c00e2bce983bb57d559cec2efeb3455ce5dbc44f878a6f268773fff56a97494c2f9e13448d8a5871bcaa1e7f7a2c76adc306b83c82d8cc669c7aaa9df54d753989b66d4aa8a208b9b04b762b64bcccab5b8c27348cbf4d40992748fc9f7ea5c619a90ab19743e9184a5574cf20df012dc7b3322d8a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 467; - dataLen = 4096; - combinedKey = "661b0afa2abca3b6cc03e7f659c05e5666fa2dfb7ba361b39a578f85aebee125"; - iv = "6ebeb177b44396fb6fa72baa3c4b2b53"; - plainText = "ef9413fd1127f785c8603caffd3e065c35c40fab5ef9a70a07d1c680fb411a1f69b9a3a59ecd12f30a43580dbc06fd859d23f7d9143a0bf7bf6b5794d46b5e7c2db85c5ccaaa90193d772788b54e965a580b1550a301740f1f405a1124b81b434b49ef1445fe97141b7a3d3bf5bb54a19fc42b4b66a25aac1981ba7aa485c7c91c34bd312121449dda8d7925cf6ce924862577c94a49394de1cb44ef4a48d6606b1b36d4915097dd3bb8202c58d65db9786e17857ec715db51ecd043bfc142de1bc23a7dc489738d54747337cc9ce0d17baceba752f7e38ef4b9e3f5678296b9437217c87b80f588f2b05ca3414daead1bf9e105e6503cc8b371ced78ed523c42f82b184fb961307ddb9d48195c1593b3e8280306b98c3bf02b96cba0c6287e0f7e3e72c471b1884146a999f0d0391a68f2b25b80f51ae024cce6af78489db73d15932f3a1ff39a41feadeebbf6219a3f43c0ba7c08600c5133a9f18b693dd2a91a7bb1e88ffae856055170a582ecdd444ebf7f7cd8d6616faef1510cba262e740d7608bd2bafd271b78a7f055f578fce7d7ea2116e567c76557118f32b42e881535b123ce3d9994356218d92e07a22917a83f51288a50c9c621416b7c0e48f54f6abcd54e07ca3ac96715d30d19227e44f55f352276f86cde1d826ad94afb666822aebf83837a0c932fb5082fd3b6000c7beb2788afb6646a4fc9e39b479206"; - cipherText = "48e90d2da2cf2408f969102afbeec5bce1c26a49284281468943275abd9892d02220cad6e3b995267ab265619cd6781a84f9e79aea95d703e71c6a6df562d8776193f12d8ec86b68dd365125033f6ad29f1986c80c6fd819a1d42c0558740a7a48fc151cd735312c648bac98dae6181d646d33f1953cc9e11c6a342afe2b51b31e25e635581d5a045d7017756cf853460fa926cc1e865c8585672c81f556b7709b9e80b60f942fe35bd0300410784cee3f798fc8be82da5945cd3e37828d847e9035caed78bb68a29348717ee1d17bdefe24e60064ff81865dc59f8cf9d3596814c23f50a476483e04d854e2b81d0eb8c76a37e399cefd0a96633d552978b1314b7de6774d5c85375f3fa93e2bc764481986d8256bc98098a9048e2b23293162ff08777280e931316d7f3659de1eb40bf487850ddc36a01208c7902547586ab5fa8d91ae42394d636f4bbedb0190481e63a6302f41e930344f83174418cd665d6e3b5d610ab17d126500b27a85f3469bdc0eca33644623f02373377ff15c77373dc40ec8eb3af9339b4cee0820d901860d87954d5103bfd157f852bd55fd20821c7a508dffb72f709f36cc425c1c26064121a8fc5c65cf3d9a9ef1570bb30f29279383211eacb52d62064a98263eee4c311d9b16fc04d6838d165ee91060ffc2ef34e0967b7285840a215ba1122837037d7fdfae8c9ce518bd90fa5d6dc4aeca"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 468; - dataLen = 4096; - combinedKey = "26f33405de629328d738b23b209f65a2e8f43de6c25ab469f4c4de13c2cacffe"; - iv = "f4bc9250acc14b8d07350cc230492ddc"; - plainText = "979700d146e4cf95cbef009eab5341f8c1d59139ac9dd8fff25340bd259be3127239b487a05b1ade1f020943c639f781a9cb0f8c4275ca6902b201f2c5bc5e7c31b4c71e9175383f3de5384e41d2a93384f8aaeb120bc894be10974105acbc9ebfeaf6b79ab8b3328159133a7ce1e950450915e48b7f4f24c16d4eb6dd2bcd1a307d05c202e5035fb9ade8eba3c02b680671b1dec7f86dc365ab5dfdd6f9d13bb422af9956369bfb919a734e366b1717e2436da96a45d74fa6a5ee103f6494a725b33d36e5c7fa076193d74f449877f98ac412d99cb6e41fb0231c76ac1cfd709b478e15c1e3b2a24e4df5942be8695bc989f61888d1316431d7b5c400303eb98dfdf198ea99b8f5d9ced319ccc164544fe3076abf1cd29814cb429e7f11b27af610d17d4881712ecb65223340e65f46c10cf3c29c4566d0c67e433a382a4308aef80d1fa0db40b7b5c80a251ab2fcfd94877053fec9c5adc4435145a3da3c6d4447c5b676662899044005b880227798db175b623928608bef879e0b2bd701ce39097ad709a48df01e28bebc9be8c5e4763f3ac32268fd31d47d0cf2f9b2aee9acc2ece384db6fc0491dc4e13026a17a7bec98d30f235a5b5176dab13fc5def0b2a52b7deb04160be8bd80abf63025c58f4a2e6c4a022054e30e2f98b1259135391def647331276ea37c401d7e30db862f1563ab587104cd52545058255e9ef5"; - cipherText = "bd6a72d59be34f4b359f9a9d9cb80647cca8b137d743fd0e4b871a724dafe8ad57bee490b5087b138506e05866e73a547b90fe305ac5a7a1bf85b284fd98be00c3bd7478d938c68d05174aca7e0558f3e0f49e44bdbdba5edb8fa0460228459b78b705db52c4ec4d5f61d4e0ba7b043940f23530709def865a8de2c04f8b16a9676559370b8227618c6e36f31b966839f7146f5c99d6737805768dcf640d8fb63c3496e35d23b14004940bef9ca7f2ef7830a92822ab927ad528e8af983884cfe8d86bd4554e14e6f44eace86b748078054fc31d0497d43f777bad23d11a9b9b837b57272ca6fce48f601be5485dcd2bf4dd88b560f72556dfb22f6f82a3124efc2477a29878cf7de06691303464cc1959c3440e54a3c5405508b5dbf1663a7b9bc23b989fd58dd1589b6e656934cc4ab822c3bf1c870e34d38f9df9c1c5902681ca2897ffaa92f23711bda65e953fca98bc3d315532460ebddb134856609432fe3ed88502c5cca9679018622616224c5a7c52e8c2900645fe9514054dd96301e1b307caf526bb2d6b168f6391c0e6be254dd6af2e31f96ca9d3756a2bad4e51e2cdab36c98f144fc6fe0c83c13338c1cb756bd6abbd78bb6bdbe3bb08dbcaabcb817bd3308ae779c831fc854b0814fcee64d92da01c110b80500aed3121b35615898718ce97b1547edae2171fbfe2de459e51a4fff476b879210bb6b8bdd6a3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 469; - dataLen = 4096; - combinedKey = "2d8b1d211c1d93ed0d249b41b124092e7491f2c7a80f2a3cfde091dd1224fe1d"; - iv = "89ca1de64ee3585ee4358723d45fde64"; - plainText = "ac8ab12e5af23678a9955ed0480e5c27fc697af2ff37d12aaf0ec321e525963aeed934b870ea6ce98b4c9c9df0ca85bf3c2eec6e867c86a87592272e6572114c519fc0cdf0f98cb6be98cf1b1fd014db2c97d67945c357bed44932f9351b09be2316a0ca441f445747c15c84ec20cf649670aaad7b39ead6b739565cfb1867b6570d905d845260dc63e970a3360cada0c144a791e9a45122e6a4b48bd9c3f6d174c97a77950c944726e3bebb8db53e2a90aeedfe9a69019423045e417ed46a0bbd12d98008cda2aa8aed04cab0a8b3e0e54e5633a6213a2767f1975286553972312371662e841f43fdeb83be3b9e4d390dd9d5388e5c0d1eb4cced12c76c8dc112086bb386b947e3dc95c3261fa24885b6deec69d49ef1204682bff05426c10366915e5bec532676f581128a5146025432a53c0b38052834741c51a2c70d29883eeffcdb43b3a9fa0cc7d55bc2c3681c6b44199ad82be1035f98d2ddf7eea5c9004222d4a3bfe58224ed8465bc78b7dd21b30c6b7030095838d99137a0a8bb05f35c9ba881cc3810443343a44a8b2ac3c69c7bb85633bbf6feb355a179f15d0415fb13a6269266f14106a6fb4a9719015a63d165d2f113aced1dd5bddb19bfcc9351b71972dee3289277628ff9155acd1f4195549d08518e78dced55d180dcf732143b97826bee4d8c8a0786ec0b59e9b6eada673d4cb94363e41049951996c8"; - cipherText = "4613490de986adab4d99b72bad96a5813f7c191a9431351c5fd72383d4e03cf183cc575ec1a3c06db4f6b869d579d0f945f7bfcca8a1795959b9382fc7190c3bea382f104a1ff337dcc0082259fa118b6f8fb09f37f6cd0de83c0232a56c25213a3b6e02fa9eff63f1c61a6c14e7bdc0b465aa20bf571a4a071a30bc8c880e23143e0dd464362a232ecbdbf3759c9df21b8af7cd9f1c039cd8fe6e1041f2b9f688c4967a6306d126cb285590abed7496151cbd23be7cb0d5468a26e201e65a0ed369b026ef3e272e33db67383bddb42df4feb0f4a86c4bc5d2f9c1e37e64816eee27d8c1031614660e1e5257b102e40950c1c6be0db15b0c7a123a49c4a902e8347be69eb990ed68d12558f5861ad57f146275e41eacfcb64caf506f30f8875bac7556e9badff7ce580a052bf4cb55758f979a04694f6cededb5ed2e0b0860348ae3c521963363626738cd3f1f0db69c07e61058bff7afbd9d4d24784751df2d35536006a2b93485d439894698ef005d6b17816c1d1e8ec4e1495ad6b4fc6aaa3432fae5caa47e9f7d7ccb0b66fd7f949af4da19d2d6489847c489c24bc145f1e1fc487c5292bf0463c8b9ca4de408fe14b530691c0566fa4885066a53d35eb8f16a4a90b83e972cb49545b031203270f0f097dec5009f68795a39fc0bc80b9d76be2ad3ccaab4d2b8b3bc0c04b9ecacb71be90ff92c27f8195ebb421cc7fe4c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 470; - dataLen = 4096; - combinedKey = "b198c2f2c002b593a2499203fd7efac30d12a148899c4ae66d6fd149ba3ecb2c"; - iv = "e6d6cd2615c9171420a02ae7d8f1ceb6"; - plainText = "ea45fb17ab98c441a5356554fb3cd6133a7b6ac6b381b8675ab1e74c287067a47f52a9757547091d0df14ee4d8fbbfe12c5d2539e676a1d3bb9b0433b7370dbc84202c14fa5fbc5ea92d6bffa96297fa9bff00ae6db1206082348dbc1a9c94b62533a6208406d9c242f1b8e59f4091e06c78124fd2c750dfc6d5dcd6601957146d03ffbe30cce514a8f5ebbe7665a2cd58f95e4eaee8f7c513822186961776e498203f0fb0a309ef323346b89fbf1048031f80e0927ebe297df989747a935e10599df29969240454bc138c81757a0f5fe43a304e3ea6779a8660cffea6f18b37cd4eadcc156face0126137c935f435970e02b56098a131951490909e4ce794e2f081ed7f7dee70e59223d2dcb07de798af9775cae770c80fd5a559bbc4b2dbd804ee8ea1719d9f80ed9e3897746a8febb79a80682843b4e4862202692bed96603cf2a948a524e6a4ace43b2096788f4e37fb65b04dab4dc0a590bdd7d9f53c9d009e9ebbc9d78d02c6b9b8e1597e4d494e5fd2d4bf780e15178174bfc4a2ccabc591946df10e8e7bc20779918a67caa5be01eadf9df45b6c20c713f767661c8f59823ed8247a1686a46862c43d3fc594ae4fe0277b03e16747ff2aa574c543620d2267aba3749f08bea5508e6679c3fa835657a1670e6e2ffb41ba0716a5d716ac6315b86aa3be68f741b8a794fc500abc8223749e6e9e1e72f994487288623e"; - cipherText = "bc49e9973944e4808750e144accd5c507ebd61595b506481d6a3faec4372f8ae65bd450647eb91d6914edb09d439c895369217fc2d5eae1e9dedcd5f0b1f0fadb0d7d9f91bf39426d37a8b3d596f78ad866fc61b783ee96c693578b3bc76f602e9ff20d8aee4b045f1326add610e609f1ba00aaa357a7478b8d9fbef17ce29bca6faa9d1a9e430942a24d206588fb5bc184275e9d15cbdcd0a72469cf1fab3f5aa41ea09e7d35f38cf26c4367ab511777debac0cbbe2d61a24fdcb86be15ca27d8ff62c1921c7dcb9ffac41afdc2cc7b2d063cb511aa080d3a37c0de947d7bcd3914390afbbf391f056ffd46954c069125036614d0a82ca4c8bb521dc1277bd74f734d88d42811b9b5264626037e136a2b5c8af996240badffea5768e5440bd9f7b84d19f37be4f960eb8dec3ffe7cbbbd2a25544701987919d7b637eb6d2c180cd9e204117115257aec8dd62328a00f43148329e51c11d943e8cf1acf22dd53c4199c8229365f3207d40ec3c32a00d7f310e8b50b12a6431af2a9f59f8e6f07f99bff1fc84fd82612558bdc5d4ad73aa919f56d962e6d9cfde7a91b9ede43787b1c8db0c51da87620eaa437d7680042b221b9c6a3ed816c8f464c9b678cc9ea82f2f3c6092dab2557cb215e8c0cdc6e6cf670b8208ff6b1218c4318320d6ac2b1aefe6551fa4b8b6486339902b5a4696238a0f430e5aae5208f5b1f8ef7a7c5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 471; - dataLen = 4096; - combinedKey = "144e8e52cd980dc4871ac94fbebe0203e534acadc7c52dcfc657e119f7a4e712"; - iv = "90530983c1b9cc6edbe3674ddbe0f0cf"; - plainText = "9dab237b451fe77e9ca9204550f5ae2e0f33d3c6ba67d96c1242f0e429057385656514e81fe8609521fd05c204d4921c1772f0dfe1136d8e0234d4e0b62c6e2581ddfcd81d5457e0cf64958fac4a49a0c2813a983e3a464d2d344fc8b449bfb199190f14a6a76ffc9b2e91062eaad9e56f8a05fd9a65560ae19281f882306e05d1f426fcad04d3495e2807efd9d3d111d8aba43fffbfcfb3666baae04d2e22d2ce497a3f115526d10ad1477a63d67a93f9ca1c4edbcc86bfdc892667dc0ec853f3f50871fc87ede7cc3d332ae53489e1aa1107b657bf5f37fca8debb36c370ea0aa0240a2b85e5eaa3af124f6f517178d7802a1a6580c60c1ce3532a529dff16a27b86066f8555b859eebac6ea102011127ab7c14441b051d6f59cc73c686b854d6489872b58a3b48a5c491cb6a3130025864afa9bcc27e107d6fe077c9f69adfefb00c8c2d489c49127364ef5bc57cecebe8a40e6acb5560772db3dd4d6642f5520562c5ebd0a4712b6f589ed6a6592aa800cd171b01c0f8ccbfb240b091bf0fb8efb0e100532f53716156691e6038d2f9eaf4982a1a24808eb2e8d6e9391c8474a6e0ea8abdc39a4d0609852d3284cfb6c1f235745bd2525796ec249757be8e16eb2f8b665e1b0ad273e6fa1991cf2b343f7f59c5d123b864a50255060f5ebe779378a0ae0b652ef8a2d90076934067127bcf31256c6170a3d09699c870b9e"; - cipherText = "656f93a2fa98768d0108f43f754e6fef89ed480bbb0f903b7c540649a397b7310170f86f9c1c634939392129ac6d22dfeba7b18f818a87399e31ce1a7c13c64c0c4ec7651d25cfe33de21c7a32cc5f47a034cefe30e8bb0324cc69c7e31d6f60e33bab707c1f59d2799c2fc4ca79c1862cf9fcfc003ee5d4f1737d1dbe97ff54f99f6520a9855531690eda75d97855820387e1cfb6962c3ba3a473f6def1b39f3308d30c57f210a240507e2498291588827081ffcf4b2e7394c61a890061f0d0fb63e759861acedb9978fda081d879ba1e24997b49efab532caaaa3d8bfaeb6ea2f13f83f09237fcb9bac65d4c634b3a4df94db66230da7880f362bbd9bdf7ce140f79f1450ae0366753e0c229f4ff07f5d06e6c16cbb5e38928e205a89ea64508cabac4434fceab65ece2a65405400971c48b8e40d0ed1481e076d541f35552b51ef570da92bfd1a6a79a165bc64e02c2e1179c7eb8751c6da60392a73e766c4a20bd99f6f6185a9de4687315b1a722b1f31343681e589b92394b08c3ca97511a5efc2732b4cda330a89afbde2bd3ca8406f805516bfa52e613370c0d24a2ddff89cb5e49de19bfdfbe191426fa140020ed7b45859cb502676ca56f4249cd1d09e1dd8e7085195fae9a1818b1b1e4907e9a3bdeb0ee4d6ba0864bc585ef26bb5d860837f9bad09cea4ba2ee6d31d28761417441e03a80514e81a601621c9b25"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 472; - dataLen = 4096; - combinedKey = "b04f8cef0b2038fe2f9014edfa083c7add861f0770c14150ae03b15a966003dd"; - iv = "019d3e3fd06dc207b6c44e76a6a67439"; - plainText = "6ca805ee740a56919d6d2fc5a898e865548ce3b005880090f26aab062809697137e34d338e10b520d855f044f75e36f49855d74b1711ce0d5546a4285b1104a486ab2c21c6fd2c33e371113e66e0572b2ba6af256dcf3b37f7530085cf05931eaee5b5fe7c9feb12d588427815546ff000c29648823f4cd6cfc9fa8f30fe8e1a91f860935c5bc0392b10407ad2a011ea766aa24ba469eeb3e0fbed67ab3a325f17c8f02d0029f5ddc36db5cbc3e00a98d7a8f2bb278d186c0da13823040633934b763a0abccc737cfac34e1b71458d97e8fe4491ed8890dee29ee31a698eb5a573db26eeae79250d65b079089481c09ee34bab428756097b3def9b0e724d824de19f218cfd39638c5fd0dd1ad523cee85cf7786cacbd8f216f88cc4a9d6b936b4821d8173338beace4885eea51108fb3112f429a7bd7a5f90ae236902ba1f82e60d6892fe3a09be1578f194f5620bff3fa575eb1cefa6d535dae308b947292cba3ac0f928f58a6f44340d52fdb6a31d355bf74238a1960e6fe5effa64aeb985dc61ca07c4765fcdc45ec356650ad2855202eca6b716ea670858ac77de1a6b3c154843c8363635de92fb4a8cca5f88e144c6b863efeb5e5cdc2279e323a410b1b80cc56392986a05c2db94a779ff2b6e6a7ef536538f5af5c51113696325639d51e3ee54938f0a835e813c529f8643302526148b6c84dd85885a1bf08de3152c9"; - cipherText = "98a919987e0e2adba93e8e55b00a7350133a357d06e809c9643ad672470024faebd8629657039cf5a8a1ba8fe3a71524dd235fa70ecd5f41cd8c2b51855e71e4d4108baac4b0e1fa6ae1721f32134007b47028986076050706292cd9d41ea15ea1f282627706e7d8634964b63448253b9bcb53302d8ee5f534f3790a7a42e998480ac60c358b40cffe589bd5b588d27f43eb864acaab080cd6d8fa61b2421cf4b817ce9795259767af47502b7906ce079f5f50cd02b5d89acffced20e976f1e1552b802628e2aca3cd742e0551cb38003e369b86c9deb58a9a8fa337e6ce6a1e329430424a698c396663edd7a63fc879f754bcbe22378f42b32e2345c2eeca02a1f2815dd98b80499956adfaaf369781d3f6d02ed8281681fae2fbb3274709bf312f0bcfa39a1c0bf4ed88bc7afcb59e5bac2f5701efdd0374acf77ab00eeb2b4f4ab4af17407207b921500abf0f75c639ee7945b6587e854643508df9bc58779b8705219e7caf632689fd3e372bee2c015610b7b202d972278fd7a18a122c94895ea3c3fae655e144f128ab245659fe3b96134b9afe5e52f494a15671333f5ae1d6ceeb6b1ecb2a99eba9ea7d0d2d58aa74cd6824a0647945e9d5ceb65c8b776b58e411ddc516b5a32ee0cc9ee242d43e189caf932a2751224fdde65e506ecf1542cb152b8388a8b36623492bcf33d16c75ff814e3df497d3229d6a8b41ce64"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 473; - dataLen = 4096; - combinedKey = "1800668bbe7c57bfea7ce18f3b710a8a668f1ce748bfbb3f40aae4ccd8cb8fb2"; - iv = "6ca2fea2bbab845f5a88822d22117d85"; - plainText = "67c0291ccce58e1fc0994918ff844352a70b5bfa222c3c4eedab6dcad473a5b507c50d6f805629b65a7c14443491fd1c6c05e6c46bc9e82532016cb98fdfeaefe4268614b3b9f0023175a4e4a42d8a3d8f0f0430e9eb4d252b871add3fddbcb9521c341f9c82725179125c686d75851bf50cffce8e5cbdf0aeb60447a7556afa85522ea49727355406b658d14e6d1355279b5d4d8e12ca74b84780835a2e5ab8fc4f76db207d328e54dbb0bda34ebdd64c4214e9a19ead40749a1bf9f0567d861c908183382abbd74e4538c4d28823c4894ecb8eb0022692aad96c1a59ff81975c712d0faa3a8fb6cd056ade0066dabdf74b214afe569b0658c1b42f6303d17e8ac25c1736424d2b097c2a1c252bdd24fcca13b519b9a89635ec1df4ebe021c43882771197fc4c78227c8a7f8b0bf04aa1cef18bdc64d574f8368fd0e8011da02465c0ab878bcf0d85759d6ce6dc6f8c0dc20d17b58072c00ecfdc02125fff0b2cd9156a32935196dd2489a83d4a01a76c52503a33a7c11415cb9800af75c4572d243b060a151d5a42bd9bba88b37f1d337f1ccfc5b38cffc201f17487e2ad39750f1aad62285e2c61e0f1303adcefcfd16e15f68f4c4cca4113958755a3a813948e35bc561e7da554bf91f91a6c2fbd337398936a1488424452776e5490cb4776ebf94ac75500ac457b2951257aacdae9777f08c2099aca0de9dfe78e310b96"; - cipherText = "633800accb2e245fde316be288c8c278659a35ade958b340e3ef18f24b9c46c2648a4d3751903e2665aa3337f58a1327194276521b7fa563b51f641984bae6591c4acb7b6fac49eee71a61aba502318676a2d9ae9246f4d4c98508b1f512f3012a48bb723b35a678c233ef5cadc3c42e0164dadf4a8721b81e89515927c0f99dd2f5b98d62f0be7e99cd8f6348bbc218a34c78f87071fa2f14fe0f540f47a581074e5f7f88da2015243acb20aa90390537afb31c6233a27fefb0e0e6bc61b8301ca45df498b412ee2d52574dc2b404602deb9369451211ea12fc5fc4014186bcc5ac822ce172d142c66b4e7c5f5629909f3c8d5aa921cc06aa32039654d6fe85c7cefe660cca9babffcd1550cc17ddff3d66682292a665b72bbf4822a61ab4972232d4bda36be04fa854e6c33256cac5d855247d477f8e877d4e34a447032012380884cd5619e8b2522b7d6a1dbef84706b4ca5604d3295a28284f8679a9f09d5dc6c2609a08e6fe23cc9995423588686391538824611e18ee45ff1391669ff02bd2756419021a503e450e08bd6818fd22164115990e4c7784845409ee5e9f973e7e6ae978b3396a1210a7774f2e44ac1d29dc8e2d9553054a4d5d618409bbf55da16e1307f932966153d6a5e50c40a01de94ba7121fc1f87d3dfda74cbab48123ca953870448d76597bacd19f25f48a2ba0fa91efbccc167917491339c7aabd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 474; - dataLen = 4096; - combinedKey = "49d09116beef570962f37bb8d70b543193217234e205629be479e134549dc41f"; - iv = "69ec6223e0940f38ba6bac29bed4d7f4"; - plainText = "fcf33228059eef843242b68965e300c029532315097331744611bf21551ee91b20e1ba4f979ac5b43ac74ea1105cae1557eb8cc789ec42cf485ec793a87c82fb8612752ef34962b237299c9204a9c6857fa2667aab2fbaccd8c117490931691e258f39b23cb1739c7adb83f4930d7db5005c850009aa4b39626a8786631c79b49e794da58d4ebf45c8fc2e50954542fb34f611aa717d6b923807948af0277651488ee00e210f76e0c6713c24d5336d30066b5d50ca094f298a35f4ff81ca1e7ac802f62a376543ebcc59de3e13b7495ea12ee9d18d132b55601cdf591d33ff32fbbf7f8a41a07b8db7c5e135b833fe77c8640e817803822c5ac273ca32d4faa5fbadb8682701e9417f66b9bcdf0807e10212954683606b6f4b849d440c4d9f97f60c1b1b2bceae860e301aea0bb9293a33c6b1077fd00012e07a65f3850bda1d330481d2f8480c5615571949a04edf8f898543f22ac070d96552de42013d1c92b1c458909dbc5bf1f1568fc7b0b1a9894d325f7da0da0797f9434a70c31b21b644bcdcf4fdee5a54710e96559b947b627522c7a99189a76ea766eb2f2f09fab00f61d3fb47d3416575b1f0a2cf3ad5aa8e5cfe74de518a2f56d862310df07ffc90dbcac967f60d51a291fc5c879435a3e7e0f22ec0653abf6585a969d28308b20012f96dd21c09fafc5b43637dc98101554235f06a9a42d2329c329fb05adfb3"; - cipherText = "4768ab7aa849283b80f991ca5f2281936cdeafe0c227ccf69d2a2c02a7f4837d2a56c67f656eed21f47c48c5a7dea793a044cb7baa374c937519ff858f40d9759392bafd0da91e1a23c088eedd72e1f8bb6eb488f17b0a0551ab8fbbf9e29c68f75d37e097f2f8c9b70796c6a517bb665995723a376aa75f7126b449d3adeb18ee105176fce738cde70b034f99e3d6a2ea304a486ebaaff0cf69784ac83c2b46732321758f77e40501e4ebe40ca9d4d0bd4dd22bc8f9f407e50d3a695f451d5c6e43d966963482bd33cba307f8c8cfb2a6bf495c1d1bafaafa39fbfafa1ae824d6fabfc889fa163b7e98b13374eea945bbf4875390e097d2575bd105e6c2dcf723a6aeea78c5cc9ae8d2658cdcb45d202afd9b8fb23f27633fb305ae0f196397fc242a533e3290d189ac5641d233caa1f7701a600c709355fcf486647b24ca8f16ad48f93063e160d9bf22e8c9a2da9e641ab9aee4ff3088b055fa6214efec41d82b2ac448f94d8482380d67cda4a3af561b555db0a1353795d8aeccbec85cc0f850bcd0de5be23a429fbcf0520a6f0fc1577b82b040ebaa0375bd391712d1232e80e6e2e679573a2bb2522a5fe781a36dd40717e66eb8fd0ef79ffd550993c3e5aa39abff22e63a46d05184b19753d72e9f06fdbd95b806c66b8456d00bff564fdc9182ea2e007d1b9265ca5aa22dc6d2280fb7d892b229f0d72d51835f5f6b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 475; - dataLen = 4096; - combinedKey = "483a5d4d4980240c84f0c4f4857d93020f88f78d5cf6ce130301544d84356c73"; - iv = "f1bc52802793b8bb1f28bb0b99325ce8"; - plainText = "05f26e4a927ac3f25d6d614d2c89c2124e21a327ce0a5b2aa484b18140bbf57bad57608757255a39e7fc927f44771c0b666d069be63fd67343065e018d158a15441a36958918df84d2e2724637675468aa791dd505eef5977c3822caab6374ff511bb6353700f52079fad2353487526bb7d4bb12c3f3191bbaebcc1ad89711c69f2c94e5ad0bc77c653699f7c7cb239574551af8fc1dfdd4a3501df499c606fc1ffa941ec6b671547a49e639d4074f34848c96609029abefd21c9dafbc62c11ca3b71919a1bd585e88c4a4ac9daffd17191c9ee1c473c249555d80a826f7426961f22fb8d36a4a2911c0dd856397fb8a646e71e410a53bfe3eebc68a869de1e9f6b079cfdefa0e91be91ea2059a5fc6610687658dbdee7aa5e5057bec4fce5bee7ad3aaa477001d18441b67f7d814ec0fc2e5fd6c531d517f4994b98cdbdbcb15b05e088984cae6f2728e82b0d39d5a69a42d66859d93be30c047de539912172877a62f01657252a29b221096a3d4b6e8898ce0f291685f4e84e86a95af3cecf051f1c60223d19fb6d69878386094cd5b423b6c767bab2b8775d848e23380f0722918b63bb8275c47f87a2b1832fafe4ead06b6c588121701c189a33d842305c02a2e04fababbe6431d82dc086a6c0a4a606d9806b95fae284f610c0808b02d513e14c543a6ca714de037b91e384855e9892fb903569a69d3e6a783047e98009"; - cipherText = "31451ffae917d73566f563705a764ae89281523fdb929113b8cb9ee4e1bd505eaabfe54e64ca17bf488c2ee565395dfeff25873e8340e29a7817e59d67c424216f37ad95c616c5254b47bf9c9ae258bc0134f7c767ea6f0c514b8de1d9e671a19da5e2decdc6a624f968f251b025a717f8c7732a130a3e1feb32b13fe99eb25f232d3b884e31e39052eaf67598ee1063b76d2df0208cefc21d06bcf1e0647fd79f8fcb4f2e3f8c7df2ea8da3217bb4ad8703ec647d2b2c3c1b80ba97438c920a4550880311ec945c4776636bd704c5357d5d7263d560d629ab1cb1990690ee2bcc399034c14b63eab15936ab5483a01f227dec8e1b34431102af11b6fed9b383928ddfab76acf34e7422d1dc7636653a294e786f7c48044f68605a71df287daea19a3d3da2e47ed77d4c268b15176edc3b486aa05858da17327633f6a1aadc1f6d5a9e4b073c19f83dd480df4e110b7ee504b8f0446e8fc032add28fba5167d9f085c8cd84197e542a765ff5418aab6583e4decb4b6dae3c74b454a1c8e518a3a566b7eea935591a2d09aae6f38db8644931f0e3f4c02952cb85c2836a8fac9e02bf692a225053de0341cf7f7f60ac0142be3ff1db5191ce4925123a70dc24221744be8862e53dac2b9bfdc3f68b1e17bb8a3d2110b9132465e319f56e62ced4b424e48b9c11ec17a1dfcd1f878d625232097988cca4e4eae980c55520e32a13"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 476; - dataLen = 4096; - combinedKey = "4b8b4a69c3c6aa3456811ac94d9974ba8c6ad4db272ece3e282169ada3a4f3b4"; - iv = "063e825a3c52111b162dea71003b2652"; - plainText = "72dc856d994daf32cd21069c88a359c3f5922854ce6fe37e65bf51afdfebdf8118d90dd572876881554f146a7348405e36a34b7e8d2ac7a3d1dd7b33bb99b41da661ae04a26ca0679dfb41995d7e87618ffe6f21dab970c108128cccd52519c18e6807d544c97367bcef8a4d35b24309843923f5b083d06f6b3cc4136d33e5ef9509979701eeec3d1b9b2d6bbdfee8f8c4f696dbc32d2c0c4d84617b7670cdd4d086fa85171b402f7bc8dd632ba7178f5a17c93337224528cbfe9a6fcd532324d6921e51dba9554610a0df032b8875c40c9cac98d658b8c72014fa20237558a6157f9ba4d05db6133b12928e37564ab9d2169fe1341d0a27774fe15c5ee15b69c9e3061d6c9dc23505bdef5579a6ad84af1e491102cd262f1cb345ece6d76f1fa6f25fddba93bbd33d38c4aee9fb96be3dae284a22870da273588785dc6327bf0025db92d3b8c6e2c0cfd04ff27ec7b949ec69321ef60fd22ab52b774e99f2670dcf6c564fd82ea94434acf572d6dd9de928bda5d6ce103af5cce21e12e97eadddaaa406fa93ba2598d3f2dca0b7b6042ef65047bc865fa4fadd32dbe936b36647128d2e140bd956454473d75956f74a30aee588291cd1729f3118b6f92e0e940ccb8ddaf44b7523b5fb023aa5ff3360669a518e8b2f380b87414db54dfee1506ed0f052415d22a3eebbfe442f61fc23f385a5f1cf2a0185814746b60aefcfca"; - cipherText = "fa8141cd3cf61538f79a306b876dfcd466e19aa1cfa60a6bb103fc2cf7c1d0483bff89f83534fc1936b74797ccfe5a0a5e659347bc0269973536b592ef14e0d842c86240d3493605f6c9b00226390248dec4e0308cc9a7264f9ef9e9d3ff3bbff1575abdecb13c2c6c0f77d93a0b057d512cb1860bd65aafeb77d5f9b015dc8fb381f1e8d3bce7645a6d22f719b25cc76bf4bebb233aa28aa0d74c45ab3f9ba66857ac09edf575120f5fe89ccfc366a3a736d5db3ea45f29d8e6102217ef405c6dba1301f02bb98a6ff8590ba66b5e338eeed75d083dffd3e74b8d926ca36b002d449d4458a9fa6bd8e5e3f12afcec43978908e36f4ebeefde1f2171691ef87d3e7dff761ee35dabfeed7743e71d5543d52efdec2364d86638cd778441c0d1138dde1e36fff75b7faf68d74cc28b74bb8c9dc2d710a6dcf2941078fdfc132f03536eca64e6d29af80681f5db0576358b70da46adeba137e02265f5bf9d84abdc9e5a4ff8f96b1d5ae39aec0006393d0b2334d264b49f8e4513af6fe570a6fbe59d78b7af6f811cb1aaedc0a6469fde0309caf58d639be41da66d0a888ca325494a7fa8e1703626c84d1e7e2aa764723115062efde3161235b72c9c961b6244b396aa52e361fcd9bf523bad1515741599f12d884ddf3804ceefe7eb88307725c23eb364532140413ec54f983cd7957b1e1db5b1a4cc5fd90061e10352ed35d980"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 477; - dataLen = 4096; - combinedKey = "a0debd395c9c20ef592a692052df0facb5cfc12f12ac5eacedf10b69db481560"; - iv = "f48bc54535d0cbca0b8fd3025ebd5642"; - plainText = "02a4e83f4e40dfdf6852619ab2e0c041424227b36a8927802521043df6c1eab345a4f22bed8f3837df3eac4c5b9b1bd7047353ff2b445a5153931c3aaa843f9a1507860b89af406db47580ebd6f8399cbc43be27f202e0f8f3f16a771533be99a10acd97fb30a27c0baac084cb68285eae8988cac3c464f89a0c288827632e41d647261a582d25950c1b8930e251075a37323732144c7a428bf4e34ed60383dfd1446b9d4b5ef5035cf0522cf691bc7406e80ddbf858eb7efc29cac75b9072d92c5dd9892c689908ea3e2507838f8de40c2de63e4b1caadc6444afa4453910eb99c3c5815a3bcd12423b1f04e1dc34f9b3b10ace175f3fdc2ba9c48c1bc1b61d528c76b0be1b16a766f73e2d8478581b76158e1e4a41809583fdd2bf42833c8803be58c5c9795f4137f0138dfaf865dead36d7e2a2ac3b8b1acbbafff240a385cbc6d1097190bc7f022bb34a536a059591a295fb53650b36cfd6c305d0c0a8318c5bb242f7ef35a8ab125564a9bdc0712e0d5e92867e075d615c3d7e10403cbdb3fa4bf0177d8f17b424ca1c3b4b9a52ab760ec104451861de22d905131b200e01c6bfef6edbbb650fe64d9abb6f25a2d6fe62d004fe5208930ed78e3bf06d4303ac8d190934750fb08da24c6053b3d62174f4c012f75a76324f60049a3975d1420426b93c49b36996999a0764024cebee5a4beca8a9828a9560a663b7cd2127"; - cipherText = "301c99cd1585b114c466f758feccb74419b39c9751500bf45c6c70cc158f1a87ca9f10300092cf227d24522107f34a2602bb3008e669963a4885738c327b9cd052404f992e607a50d2105c2aaea653a997cbe6520161ae701f9bd5f5c3253346960587293e846c98d2c4b35ada723229a080c85f433ebd68b5525d852fc55f78f54d3532bf3b8ac892aca5407d6857cb34a68114af3ab5c0231dbec99439a539aa3c2d68291b06eb130993d125e4b7990d7eb4e2a1dd9da28131e6f2ddece46338ad5a8fc68a5a51d04d9faf22a3bd9ac0ad3e8314fe5af36700efd690f2499c3bf04d1351bffdea08594ffd1352a254aa80320adb35d2590b73dfa8a3c112d3433ffc0218241462c91d956d37af0f5c45ffb43a761b4120650d04da48bbcbd5e34ffb55a571f409071294eb48b851b913aeaa3cd00dfe71e10f7c896157fded5b0ce65e82b429466d2b70e7889b42f87bc0457806e085dd66247358033737c30bc0de2be504a5989f0cb01812eec5b6d079e06cc81303128c43b9803c95856ccd915350dc9100a24be97a7aa1aba438dbcaabafbc0bf0f33eec8d4ddbf2421475391c64ad34628dc3539908c3bebb76a3c7fcbd8adec25c093f345cfe931d5d84330864913d32a40e69cba54654df0633031611157efbecaf4209f807e771180ece423867f91ca0c78a7076f835370697a0b8e47d0db222f4c8563b0ad5714e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 478; - dataLen = 4096; - combinedKey = "4199f855a3c75036caec90932f281aba5ad130218a7177ddcab5570f516c95ba"; - iv = "cfe26cdd38aa43c30a8ad21eba4ab78f"; - plainText = "bac1de9c944687b328e8e8de18c1501e28a201518a9b4e675854027c14448c4cc3416e34dbc2f58b9cf5f68b1490f04a5b1a692bfad891600c4830cccdf5b4cd44eb8bc27a1304442f684a40c54981ec6d3d0840b5170777e0071f549f0cb8368f89e32945eca21cc69046c62bea2b64853d420b591b35f8dbb6d1e134adc70556624ea369b0ad6a31716517bc46dafd967b9042caeeb1e7a67127f71eed651d7a77d0a842dd0743ec20a23348520c815319d7c697cfa81507bf1da649274c179afd478a4c95139cad2c59ee1f3988c00b74f5ba3652007fbcd6b6440e85c52fcd14786f5d489ab6ce0d51a58a20a9648b31155b0dc071f163bcf31769a562d8cfee157e1774bcf0dd09f0682a1b7a8be06b5f816202dfb78a33567e16d345fc9dfb157f2ff7946c0a1e98a529af3eab1babadb1dfad43bd86191459b73f3169e19f474f37f6d0678ef39b919afd5143c5d6f033a27e47996824400f78b715511b1557b13f9e362435e3e3b9903d6b8ac0d298130ad01f0da28c29ef967f8cde3e646d2ad01e8d9e3027d61ac6aa2aecabaf9b6ea0281e2c5a71fe56e2377bbd78b30e8791c314b12759b2343e78910918a54d049b2eb8916e4ac581811238cc50dd5dbe3fcddd4265490db064c4ccb8392f002af87be25c8c9e2a19c4b323da5d89487aa709163be02e98e47f4f6643375c96cfd34fc2f3295cdd32b6f8eaaf"; - cipherText = "7fb8f70b69b5c8bfe099dc8da4cc9dead439834a502fa73e00f51acc13b8d1953e765a84ad9efa3ed99aee6386e28fbfa63edcb6eec36201537f068e6aedb27c6de829d4d6bc4258b791aec814da5fbf13367440260edd1b1ad40f7bf63236f6272004b1d2c97d790d30215d2c3a98939602ea8adb8905e554828a997a0ebfec1106419b3d06e488822993c4eeabd59f32ca68b6b5d8c8e1b286061fb66cd2d38d3bb232f232311eff3899be07e3a5cb70fb534cbb42a73bf791b2641bcaf24e0c9834f3df4a10b4f96dc901d3c420b5fbb86ad95a162f6dd9ac77f640d022eba74ca91855e00c02ec491ce5d15710a41df1b5b574ebff17e97cb8e335c29449e54b8636d2c1d1028a9cb8897c360bb9b614481078d8a8b1f0192eba97bc8382e821b0cdbfffc815c5936c72840c5295d250e94f982877a41b0bf42ce6b4360214726387025999d9adcdaeebcf12a21f1e1fffd08b24ae8faa3d34890899fd7ffd1ad8d7d02adabe64c519a740af7835e722f93a4742ef3aff54aac4f73dba88e0de13be868bf1db6d3d9f1db94adcc288f5a3c157d2cf303429b008a24205dfad916f9321dc36458f1c00634eb1c1cd592ff3595ccfc2c1fc849fbf8543a6c4508bde620e9451583be9bf627afef716aa70bc700c163bd55054cc3828350b41e3cee25ba33b61064309926b319dee0aff561fb71d0922e073daf215d85be560"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 479; - dataLen = 4096; - combinedKey = "506f96f55d9e00a469dad4cd840724331146437f166b1ac707bf3a485a310c6e"; - iv = "c2adad773807fe8d46628f401ff23d57"; - plainText = "70a589854f002bd679250209b17e36059e95d615a849bf5eabafb56335d2130186308a8a44f688765d8e76ec0a4ff93195959a5c091d3f316340cbe560efbf9ec058b3700bf2827fc83534ef8bebbdc03a176bccbfea0e24eec9963afcabae661989c38d6123810bf2f44070a1339d853c02874e3445617de5831471aef4029aaa73a58768ebe06926327603851cef4078103f3f57871a238a4cad880c9d482c7186b6ab2c37139ce131f4d91be1ebcbf34b7ac3114cdd9573b75fd6ea5bd121dbeeeab99256d746f939b31213f0ac1bb6a28a86b80810d06e651e526a9683ccb65e646a97b47a570adee1454dffca12c131eabfa023dcd861cf2ad62e4285b87abfec4526b1445d72e1f16f344fb589442b9b93139928b721668f7fc49816dbdc557b11467553276b59c2fb3f5702da6f8ac6d1e5036d7aa1b0d49e1f113da8b67af2400c0bd29a7a58e376cbf20ae9f9173af75d543607f3c50dfeef8e063190ea0616067a8fd89b5526582ddef23bb2b3bab5b364aca85cb5e929c5340eeff15182ba24bb8c7dda96413a936a573027e8899fca5d2f0ce781c35ec8913292ef774ca6d298a7b541d2a3ac4307c7a349d9aab7eb21fde6204ddff9567365462995c4e44e121bc6f265d8bf0e2165f6295085b4cdb1e476e541e34cd8bf01f83cf283eb2e6fa0132647c8fdd283fc19bca6e48484212615d71269eeacba5e60"; - cipherText = "82f15216d25c9789d5483f9d0aabe216b86e1421d3b3bf3e9e4236db96c46e3ed9c219c034b90e46e7a09626c273e90886789ce68f90a648144422a460188b2e5e03369707c01a5bad393eb4691bc07fe4b62b5af611c74c969d622f0054d2420b5a437b8d74d4efffb2d2b2aba3d21b6acf8c05e7ddb34bff594145445ca1c557de9aebd2c88d348c8b8bcd08ec60f3f16baa9ff73c8eb415947876c6e1749e0d0b81cbe9ccbfc7430732e2bc9ce2b314debbf3babe7205813d5ce3d132cabc2b3ccf61c05cfa45e264f9ff882d0e4ccefda22b4ae13ffab37ef2535c87d16d1e10ed6d73ade686cd65b3a0237439b0af2a05f618fe53e74e2d68ea3bb0f4d73a6e1a51d19375bbc6fb952138644964bf9eec5946c45fd9ff050006462e28bcbd7b7ce9234ac6657d876f8c91c58d6f30ee3e33b567488157919ff61b46f1a5ce51ade2491319f0f1e7c0e6c4d43f0a819942bb7fb97838bd9234efe49cd2e49b0de8382cc1d475974a01ba430532da6f64f22a26072c013c42be8cc74d425d68a113fa4898e2bdb5cb47486e18f8dd3c04aa48511bd03dd41610a22757443c63d2f8c3ed56195efa6bfaf9fdbb72eff8de02d1a01e46716603281b23d4f3a9441aa62c0aaf0ce6354d50033b858e14fa5e8d9033c1c30450bc41d7da8f45a3dc39b4b5a5c4960be477bb8e29723b7fb54123db7699748f47843814ccbd4120"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 480; - dataLen = 4096; - combinedKey = "e89584bfe6323e1153eeddf1835b36a4a6f8a918e9bb6d783ae2a2f2fef40140"; - iv = "c95bdcdc106a991d0396f1b9bc4b2794"; - plainText = "5e892302064ac95dcc569a71e5e11ceb6c49795569c77a02ee105e31a87a5738a2f03380de128490ad8f7eb19aa69b87d953ddaac613d2c73df3fda89111145459daa39b47a66269878d4e6f3d8b80f380ea3949688b1371962ed7af8a391b6bad01f1a92852143ba17d202ff64f224baa64946d85df26ad18f57ec17dcb54d9b2c8229fedf1ccbeb97a4d38da7e0d925353b7881bf07e635b43f52d8dfd9822d0a7644f931c800b2c87682285ab44c91f8741daf210618bce62226d690b0b36397c4c00a64ca5f0de3c8341d5fcd931e49474bd072dd2d27e1ebd8c8248c813f4478c415adab796c8f5f3d5e175438690135ef8765cd5886836bd9b7c00787f4366bb8cef3481ca4f468fa19d3ff734c6d29ee69aa0e68aaba8c4808f640cac891fcc4c2f277bf3d2b75c55c71ab428024b1aa28cd519c9d90a66ec8c1b121190875ca7e657a5d7bbfd7c8c5be64eebbf17ac07bc1a3cd23ec47484d056cd25b39fdd3a54769c33375263b75611c37a620076c9c68df85eceacb698835e33675611e810c2c37cdde82ce9c3073d08156071f36d0e5496f34d5d4833f318e4bd334c193be80c4f2d2b206db7e2b125ad6f8f9592b8ce2f4fcc6be17389483a30fff528444635ce813a60b153d491510106cfeb0302ba31b12bfea57611cdb801c4582423e9f0fbc6a3f3dc73d15ff93ab541cef132a25dbbb64f99816faa0aff"; - cipherText = "8fc49e5957c421b9b75e5032aab52bc3f6127ed3f4387958a0970819e5dcbcc9a7e17cb9e09e7be6f532d27993fdc87c83468c7072fbcf5e268737e7207a37106d5661386c3e3e9e980718cada015a43ad617534f128012ceba6d0fe011b67f9dc0a51fdead23d87695087ea4420fd5819be4b8e10fcef9c252736a1e09307be80a442d9b0ab8bb2c91603af9103136bde88c7913792e38dcdf642d672dbd9be0276fffc3604272d68e2380b58cc06f7e0c89e5c7e284ea4df3e677d302fc59c48a003b4487b0a64ae2e34b2716c2d13888d824421e85e6b4f7a9a2fd33ca6bbb0f308635fa6a76b960e2dbfa935427c2e10b28520359771f5debd3487cf2ba6bb06cdd45c118c34d1323164a0bdacad20fa96627a56c895969a6135cc62793c1d5b5a0fae5d18892858dabfec7656124ed543d7efd0fbe6809ba1a89849111756e93d0c7993b9682bf5e1bd9ed5a40b95db2c4ec8dcbd933c18480f47cfdd853a0c9e8ce6e638f5650edd3ff8a7c52fbd57c514fb7cea0e160e606ef949a1ec7ac0ee6835039514b6842923b9597c8ca4f5c399729465511b51fb53debe8c38164db03378d4e55ced5be923e2bd5e99f889007e9e016e9484f2efd3d7895bb2187b9be1e036c4ffaafc83161db784cececab8b7aaabcef8a193c711be3aff052b837e71bd2f0e2137d33b7abd362c07fa822d6a0760cca362b4d0033154ab63"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 481; - dataLen = 4096; - combinedKey = "3632ea697a1731e0ec4e851463d4caa2f7a3dbac8a4d3b4e1fc7b620bb2fbc0f"; - iv = "997604e9ae26991c80a300e406df89b6"; - plainText = "c8764282273f94e731ea86a58935a308ffd49b7d7d9cf3fab204c806e3c8e709514d019f9165498bbe8f96ccc8507e30416fd0742fb78e971c7dbeec386946ba6aaa74c0f83a1ff951dbf6f577cfc066ffa2956b6a93fe0cb24b65fbd5172beca733d819868c53fe55aaeee6bd1a1c7f824010ed8debc29d48d91259ddb425fff69f8e7b60c7cd39fd72abe413d0d8672ef3b783c983793425022c94ea72a815dadf5a77ffd69aee816d28e3e0391a7ced0b802283bec0750a6090372d9d298b8c34cb95ca2024bdf71bbb3a8b649f8e4d282484feed6bc82309731cb2bfab6760752f39f7683b3f41b439346559a635ae51e54768f9355925517d46b2118e0682fae054175b3c0efc0e9901811a64b005bab35086c585e8a7c02e766e4e3572e8da373946e9aec27cc478a1625e0302a9d141683f75574b1d7034e2fd4b622f76c36ab4e227abf71a16790e3311e90b8d13f68b1d11fbd84364dcba2687e65ecdd16e0a8258673b60838fb1d9d3d40c366e698743513b7db04fa60ac35fbe4d8c85057900a6b67fb57e159fe0e3f02c900ce8b949e0ca6d528eeed73ebdaaf091aacb8c0fbde8c4e2f06fb6929cfec3b896af652d43d90e188b9a1335cfe329d1e10ebc2b6da97363c6a8d5aed658cfb2553b6922a7b25861bd03598712f3be21e6505c42e4a4b60021ca159370c4e1fdb71f538222d9f20ce214d5f4f746c7"; - cipherText = "4d35a5e72ab8a9782683494392052976e7b0df0366ffe828b5f6d2c2217fb813ec2306ace89a445484a741fd413de208f2184ea86f6f81a0350bcfc397a31d37bbcf875cf6e26350d05378123e549ea5f4fb9b33fa94151e79a675c198b89a60bb8e771511628a267b9ababfed2ea4969fb9dedaee868a47dae67c284694514ebcc68e8602d516fbb50a391d7e2ec7d34c50f68e0e9e197b5a76bbf35bffe4fe0a1d21a8d8d33e6e5aa00c7d40c4dedc72d9fa663c99e09bd8cf6ae7e710959d0350052d0b7322f710b8bc13ddd0409b2ae3cd86eb74b20827d2227a5d456c68c20a37f54e73e7177ddb3ccd48bb539b4928d0f692ecb65b66462a66d2a2505aad9d937c4428289a273be6802fd4d43b4b0003ccd1e21f9ffcb15c0abd927152e30e4a2cc4eb225bd60e49adf47abb07125d4654f036ac3f9d4b51c9f467d754ed40a2ee5fef6d401689c9b7001420c6c9b474e81614fd2570f58ee41e2474a9dcccebb90ed1ad58b92d1f591cf1ac583d43eb86325808b4a53716052ec8910e5adfb1fcb606a8f5447fc2083223699ddcfb94300fcb20448f15f469a3681d7f397090885667df4d70eb159d8a9e828b9c09c35fdacce009aa0aa851656512dfa04e5bb41730d0d91f81cbe2fe1252afcd78d0a0f3211e25ae6744f0c8f996322edafec4616d5cdbfc0889acca330adbc5da1ba602b3bddb936db6337354e049"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 482; - dataLen = 4096; - combinedKey = "1f6352f625aefea8129b32e7de76f9e526385e168a1180e843f910f23fd5fa20"; - iv = "af405133710c37c19032cd9ff2518843"; - plainText = "a853ac1bd296599ac76280530349bf32d38eab36a0d91d0e3ae092ec8d68481c5da27fed06498727df82ec8908efe62d434022493804eee4066474ca8a47336b2e8cd5c168a41a5503a0725ad7c8be6f8eb1f7af84f0a5b44513ddbd7384116b6675a0b0c1eaea7e3c2f515646e0548af3fb5809080998683cca21276e0f23f1f3bf9d66c4c43783077551a3f58f82ef0ee16348542c64f319e641b63f39f09e8232af6c77c54e727b7c1270e2f62cbb3d68e6e052aa9dc62bc1cb8b2fc4fd601a79438eccf218dae0e2382326a10c5ca0434f0d89990da35acc3dae5c6cb2be951b66d6bd584d2e06acdf1d0d04b9e442c9870568b1a0d5b6db4cdbc8056285eb09af48f389e83be9c3f18932f18481fe3f940f06d1ed53b835d3b99c7017976d6f9bc1b6342603c8174db1a96216ca9a224076d8e50b1298e280397a780bf99a44fef6679264c38930ceb239abb2c572ffb329e4321f0d2ec0fb9f42950524cbc701358538ca497d6d6c4229e8b0c62d85e02ee7b6355b7df7d8a691ac3d5df7b751b6b27a159c68db09a85e49a953317963d03e828651b048691eb1b3c7220195f1c0f06c22885ea2ea36da6a2d4fd92a68fc2f561845c63095530960cc5611d126f7a6fd162f1d7849624ad2679fe25f70f3bd817b8567cc2b8abc86da79052257f7c4ca3865d05322ea1e27960a29439a03e2aaf978f88a4513d9208c8a"; - cipherText = "1e232514d7e3b88de7f8068987a62c52b10bef587b83a6d0083dcca99d00adcc38956a077688b69429dfda72fb7e478496e98f552fa7ed59025338af558c089dec4f8e2f34d707655144a37e7d739106311220bea5949907ad3d77c133f7ca5b20aa3fa9e35271da0408338c2c88dfc22994d546f47ad2e7aea35cf64735b11a7c4cb70c6b10eb76485ec05844a8f2ca7e856141d056125c73783dec43f91fe7c132ad31796062682138b6f0ccb2bd09de05bc8fd1cad8d2f3d0f3ae5d0687475e92148e6ae226281ed44a75f1b9087a0aba65e987d5a5f06f74b566661fddf478ad5a94454bcddf8f94df5bd294018df428f448afc7408c5c977c42d8109ce11389885a1b30e75f219481bc752b2af1a4d9fba872aa8a3231a01ed764ff8734abe61f02bc87670dceabcb8d5ba5e2e6aee08d2f0cafef0b2d7702e648c2ba6579e900f87357db699059aa45bb32136f46402d45553a0833b49a58b209d0c605a006a33b5c400a4ed51858b47460ed2acc869b88b60fc3ecaeac526e0fe59febd918ebb32348fea656f42317a3d3e1543d3acfd36ca2d75b239475b22a7b910267b439d0ef73e13f284926b1f04410c195d2906180a7ce308057356688ec22c9812eae3c137f8bb7092e823eec2b40e31ee46ccdc827ef9a2f45b6d9a8c124743d9da974838ad1e76ed3efddfb9509b7d76f75a9ccc67c3cdc41746875dfffd8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 483; - dataLen = 4096; - combinedKey = "6641b2599462a4355e303b402f1f4a901dd6f10c21f58200f76cc037085e429e"; - iv = "1b921638360aa4b3860d4c2df03875e1"; - plainText = "d943b6213058d8ed1a3efe1083041f552913b7f7403a27b576ced9d97d34a45006dc86f4278d0f40f79de133118f3fef6233d32ffc991c24c67f736721fa1626aaa52680dc6f52a7afa62473ef2c0c5e735dd46c7aa3472e7dc23965485cc3177783f110be749c5f338d728d52ea05de07c635f260e948f3a01ca47a8f2b847a5e306591a68286ddcb353aaf48615061db321e702fc9b03b31a3b3711d9c5b40cd23503274a390a135e5cd1fe47ab034da51e03cbb66fd9ef6f756dbe66b9f9c240c8949a78fcb9bf702fa4c98be158338f32e5dc8921b373d4e34e39df98c827693cba67a49918f0f80f057b53509bd5305877daa9bf5089977a1f405648aa1946317360b01820cf99116f56b8e6b2dc5ce860712c7904c7015a99a0baa8510aebd4230cde0cac239392827ce872bc595f9c18fc870c87e5d1fd136e1fd1cb292442b041986c0bbea1423c1c2307f48ae799553a27c5763ce3cd3203a93f1397072885edb37fcb552931d97ac28a5d0d78ae3db7d6c35d78c042b42ca9d43894b714d87be0fe26aec7c55e902214ea3f07a1a773c255406532a9b49df9a56ec503f01986be5fd2c20731b5fe470651ec369534dfa57133e1b77707e1f4c639d3bc03bbfbd812995fbadcdb94aca0537dd4f94de8141168ceda92e42f0f39a817c8e42e5cfbd35cb2678cbaffac60c61fcc731cecbd3358cd08f0b79b05f45ac"; - cipherText = "6e18f6b095f6ca869149174f94e80deb7fe5d23a067accd3543837d56897094e2362f18861a851f0bd756bd80c1517c055ec2cd50ba438461d394d6aa2f8d5aaebeee14c78c5c8cac4b06718a9cd3d67ce707d6fb5326efe2146c15728f0c2f1aec8439976c70568300e64a365bc96ba2464f94877628f75ca074614ed69e47519161b04b7dacc8d86bd87034a37df3a56ff71a7bbe1e951fc94cade9a3f6b860c8fb39a7571bf1baab76724639d95e5c5f23016b9b69bc313cef69938b06e96a0e235f46b319e9d31d54168fc35170e7fa4b8ff2f996d4b91c58f1dadad82d2d5619baf13bc94a414b7369a704e4f1ba1c6e51f6938b945e35fccf5c505a676eb27e3cac796c80e4c4d8bbabd4e43c968552410e6686dc0548ce3debac4fe6e607afb27a6aaf70eb74dde71df692640d9d2fe974f252f1df290e2916abde08c48613a6a09fea7d2860f9433c6586b27df385ccfc342dabded3fe9b002d28df56bf9df68ab1cca91c5650fc5dcc19174e71202d8a082a8306e3d66f09fefdd1e698036e38dd69ab42e8398775216cc4e6f246730dd649318359eed6e53639c7c2a1bc6fe0f322e17e31d2ad9802d17714686a233b6a76782f4fbf4b5dba8afa9da937322c40b2ba2278334760ea4ec916a298b9cd6caf76af8c012dd93a0b9ebe8c7ba5098cc75d3c2077ef58861faba3ce24cfbccc6157a4c1d74ca5c07ca7c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 484; - dataLen = 4096; - combinedKey = "a1ac2aff4e4f6b1657611d227f713005d479937e46c9f0ff1ad71a3998b87753"; - iv = "8696f2b73b26011903ee7f5da968a953"; - plainText = "954c841c25daa17297120514b9781dcbb1d81fa1a76fe1ecf303fbd632ddaa8d4c12ce5a0a4287b984989e8bb5fed301cf91d8be38fb01832dc2b678e6d87d19e772add88bde12539e49367d1cef4b0b4ee37b26c2273cbdeda51f5ce89b6cafb409e9afd8017baba92b38786179f3b87356fdf68b229470064ec34497462801fde75bfcee93b668e130e8332c16e554c6ec91c28b1449e139c072356d3b4490b088f2a4e95a270c262739caa4a5cbafbd23d3fa9f6efdf2f6d77890b905be19e124af7a126baac2741e351f6f459bd5d4307a5035e67437859c1722d8d921e4719a00d0e0ccd8842fe5335544ac01565d43c62db3d8f32b55962c2308830c82cc357639ed7bb5fb4b3edde102d0c97afea624a8ea333e888e203430c7a396514ab76fd5ef5633bf2e9581265f6b20120a125a760c7a53ceb07f2ed4ebadf14f649538caf5e24328b8a199a1ae040c67146d7df0ec09cd52cac57e2d366a058dfbde8740f6023d3c7a9a083516a14f4cbedd4822b070549a122f0376d374f1d9d79f1ad9e0bee9cda30f79395f4724efcfcaff193f924cda75c91b8a79b435b256c7a4b1f1a24ff58fc59a9a8324541024f495826b8429eb4cfe2abdc7b9c7d7ec542bf7194efb496bcd84f7cd5d04befaaa1d9fb70f82d0dbf0f8ba24c29fc097908a62490afec0f8010e0f4e0b135e69fb48863ec6007fff68fa989c32ddeb"; - cipherText = "7934cfba6abe30c89a769d5d06efd25d0891466c82a93cb1c9e48dca6b2dd401099391875d63000064a9c4d0903a0669ed0e7825f25548a4b8cc8c4a460a54848e2a6851592c2fa2de17a8fb6468296733669a6939dcfffdb2c5eb4716d08a35a5405d5068b4608d82c5e27667895ec667ec91769159e089c05cf75945448451d8fab62517a754f70efda7d00d4612e5c4a926e59684fee67f4e17b5549b2109848dc858f00f98294540f92a7d27946f066e92d1bfb5c9ca6359c65e72ae0273df379c9803c9c3be8114836a39851529a378cb910c88465507d901dc1a559d48730f701d811dcb9180b2c3d026511f67269f6c626c86d400ba160856573f34d0ff30007f4bbeec944149b67840e635fc0dd4b6daaf0f2d054ce57dbcc628dd36accaad52061991338aa02b655fb81a3d9887e6a47b2f7613e70dcc9a6bf6d3f37ceefd4108d33e3647865430fe8defe887ffd5ff412d027da1412ebe0e78afbbdc100289b118af785d218b817cfbfd1f709297acdd45d728989a4c8ab6a02148e361a55bf4599873e3700e1e290d37e0d30fd2155fa70c16535b7d6ee45219b4c910bbfdcf4db621798796b03dc0bf94eba37c5528df5723c19e53a68ad753e73b9da8a9147675a733286027d9a2bfb05aef76480fcfb0d0a9db06504fb55ff30c15246148ddef30b0edf36164f02bee18ef5c4cb645f69fe64835e6787ac05c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 485; - dataLen = 4096; - combinedKey = "8a4c75f1dde8dcdd51b0895145c1d8c6c6b3a8d5fc1b0405f4f2edb1fe6bbeb1"; - iv = "ed06ad38a1fd44fc0d1c0a8ef3918eea"; - plainText = "03bea3e0a10b103e067c752c5f0e57812ed6599da511234873b514323f2a8614ac6c1285c293afecda5d6c19d09baf28a78894eb189d53dd152a3c0c6a903ab337e25a870e7980c2b2835394e960e2cb6813b04bedab800c04abf290d9aab8062c6a513a796160f92bf25391988c4bafdfe61187965b0fd1271a5a6d846b733d4386d24569a5e5812a3c84cbc841530bc8694b1adc1baaad61fc71436e7c7c135e0e5abdb113228497a30d309844d4a04acf4f50be2329bdef36d357cce70daa0e431462d1aea53c5c26ad8c87cbb831b33075650ade3a2479238239d075619f25c60a3a65440163c8dd3b9a33d14be084d1b8b445abc6a8a28e02c608351a90e55a076444bec8093ddb383172b1ad9154e217f362e882943783592f29f6ff43a57ed7bbd28295e0004024fb82be580fdba3d551afba932f5a785be0e366f026cc9ad72177a383e66cfb5add529070f123ca07bbc327a4e06985e9ed7b771e5b46704360f7b1b9b1c70df0a6cfb11bbc61f7025df1a22ac65aaf4757cc99329afc3d106583c66bd75d80a698e655e747c7e8df4a31ec26d5f592324b9a3e83a86ade026436e7b24b70a8cc3eff6b40ae5b753027a15d9ad20de3c890440ddddaaf86946a004c88b54a962f5c3ef6e9bf9c26da1dbcf24197e719aca98cd6cb571dc2d9e625f32d774a1cf220380f7acea77724ea47256101fa78d16b1c979555"; - cipherText = "e1b09cad16c0b01bbe81dd75af412760fc34196f4cd70d8a8c80db4ef0cd8eda7d5624c7cffec80f7132950a0eb049345c2c634d62f9715362bc0ab4418e3bad5596978ad83f2ac393d2956e3109c5e4c412b3c06339c0c5b3ca7206461a1a04c79f97650da69caf96ba9f89812a9a97f76763412bf9ac23aa8c0492b1c180a0ac8b748b0811b0e51440c8e5bb407a7dfc5a4cbd1a9f2f62e8f326e1eb0a11786c704cc67418ef19cddc19aa74cf913b9468f74f616d47c49e06078d39b6918df56442162ade8ba1988eae6338359972182511dd3584be83e338ea8e07e7538e6c30cef2049b386601629d4d111669c4eb2fd3d6cd1c1db54c4f007a3a6d698002ad3a74901ef77a0a100ec493831e949c3e59d25f632f6f887a71c5449d889e2aeb87e92155ad50bdb19dc9ef47ea4c9cd122893089680f67240cb83c8c170ea5c3a1c27b2e23a06bfd4c036cf6a9252c5ed2989b566129069d5b1a8f2738e17406407b7a00553a1f59d71115686955c1ac884eda3e7cef25500f7653a4c8965ee6c6afbfed6602582fff346ac6d3e1cd87d70775d37ddf1873a4d4b9a35c584841b5366ed00b2c36a58ef4f6fa7f11361fa3cc8fa9d0efe49072621f49a71437002bf1e1fcf4d3d93b3aa28a45953e244f5a7813377047492789ac1c6e2b84fbcb8450a9fc34db278c8fee33744b96cc13f694705a1d5b40ca45f0f7518788"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 486; - dataLen = 4096; - combinedKey = "c350d54d50e848d5fa5209ae545377e9bffee17b4df7c23e55faae751b4c39c9"; - iv = "c939e6df408f112b196ebcc37934b070"; - plainText = "978c1fdfca264fe98e64568f1c3647f0de5517facf78a6c3f5644faac2f216adef84e8dc99251dbc74d45cff1fe43e60f7c3617f35f7e1213cff602cf9b6e207dbb7a93a39c6daf76d5b6dce6edda8539e7ab5fd240d732c72b354d64a6eae91fd4eae90cb0a78c189d00014709631de2760b7aeb053af9f1280d49013991ec4194d4e8485915f12a03e1756183ccbcf09bf6f4174fca005c13b94d8f082744df280be9d731b90e13b48d6462eac99fb308e0ce201fccbdfcbdb5d78a655f3abd1a513e6b0bf2dbce7bbcf64bc3d6d1e7651eb2cc54a8683047f15e541a66c7bd5b71d52c569b9e7cfaad673a0a4fe9e9508189c98bf674bd1bfcc50d2d14f3e8d1c7c108e60e5bb962af68e698ff61025c9a0cbda7d9f499e60bf077ca224f8678c1b6ebcafe59de9aafde342ea683c311ae589fdab01838194c420110420c99b49e4b0921c7e147cdad13c31771b063ba2872735e03ba1d7d6c9604d3c28ed8e70928251fee2ac73b5acba4b2ee4ddf6f7817a4e191aa540e262c5f11ff455b2a2baa8435dfa307e4a8f78085662dd59eae6d1f965c6bb5fd5c8a99644832052d492d921140976bb4c09d48a58f0c08557ea34a1045e81908dbb14ddafd8fd75b0a8cb8f90c3c7aaa7e3124bed3b61ad14599afb1a152ec176ce6e91e3cf61c7eb3f8135200e7ef826cb83f97e6e3bae46190fe60058db41784ca8b034520b"; - cipherText = "eed61a1f841604f5896fd532bcaf176957830e1e3a27b460105c2dfb2a026adb55d1d9a65bc7e82e3ededb1ca5336c0911e7ff1c8e04db729bc52268f3873afcc1498b120e37313a50d194461a4b7fb6df386387ff47ce0a35fb3c42278cfcfa5eb2036878e013a322b54f49829940ed7c54f44c7557c32932f5f7f06420d408ba430e52e273e9edfe0f49c7056809a5fe98bea055d2244be8b2a1bae266ba3348a1eb72c01659a301585bfac6e29c57960e93c9ba1781376b90cf0972b9c08aa5a15194a8b790d5dc6c538c1b499f6335157fd08cdbd868bf7929b2bf486b3464a43a444477d489c6b323370b78e0eefdc703855a08689afadf227ce89097e8823d44cf224206e607ce6169af80e89ca5be5d76b797e0dbd65b5faf41699dcaf6fa04ad188a50b6c8f3e3a6607865d5748d821b32e47b108d12aac0475a71fbea47f3853d1b077818dc9bc877aa015b5c9cd69d18e4212f7fb544400a522c4b1aeda7b2d2d1e79d3796469834282ebbdc235907314406ad6a1dcc897d270ab397fdef40b57fc29abefad3739ad375efee1ae58eec9aa49417f191120f0a980cfab4a942d2d87cf364c36ce69dbae3a61bb178ff36130a6d968ca156e2a86277a08a844fe9c28122687b02334db449be4f0f4e1097080a214c12bc222ad922953f2df0b67fdadea5f7a5f6f78f8dc48db53db0556cac6689bb02135ae3aab0a8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 487; - dataLen = 4096; - combinedKey = "b150753da3969c79f2bd681d5652b0e0bf6dbe7c75a96ef80db7474adba41446"; - iv = "9f0b5a19d5e55727ed88a5c532fc4ea0"; - plainText = "7a7b38b7d1d3ef23c0225a9742beaf83bf3758680dfbee2d88021462f1dfc9b71871f9bfce8a6a847e2c5034c5a4184c15336e637a4ab43b4398399e15f7ca321d875af76c72289905a5029047988feb74adf281eaf250374e6107805fbe298ced78f05f9ee2069002a266f7045cbaf55a6e6372cde84418ea67273a3edb32292ebebbe707dde4bb354bacbc365cdf1f8db8b5b5e5760af4535ff893b1a31dc8a6e93c1a22facb7d9c18da25026f3bad1ff6569d1fbdc83694f77dbd78900f573b0ce3a90bf3978e1bd520374a881b4986275110b57248c6dfb6e97cd2a573777ded057f7d8c86e9b7967527a05567d66f1052dc2c39d5f81e73d6032a4909f537a8d2c89ae73d147e2857d63c99d66dc0250413f2e2048f02676cf98805b5e0d893d614f585697c23867dcbe0e5a2ee8389537d6e229642d0a3b6f8b6f6e15c03e5f10077558dec7f0ac9fb5eeb58997886ff8bec4cee85b194c403900573e661b585eb1ba984a18423430a063657be027592070d810a5fc77a6e36743a5b4e80e6c740473a5094358f22c106bb5dd4e478c48fb09e84da8fcac2eddf5eba5f95db9246e6f14b190b5115a086c6995a1b3e266dbfaf170045dd6a7a22e18b8da3f97a41144277d9d6a83688d16ef5c4d9b32161086cb5d40a66c7e644774b5d9388db38ec4a000c05444744916cb46743412d7ba6525cb3d791667b0c597de6"; - cipherText = "64c69900c8fcf20790bf62b9f6a49c39ed3068daeacfbb030a64679b332f457c51ca1100d98dc51fa5641cfe7274c4603a2c8a39eb33ed4c1d3e6768544777f1a803d968f793649bb7a5fe9e61249de813e413e1cdaf54b4b9578fa608458ee3e27193fa0863c743b5c8b3fea0a295758a168804efb6a5c57266bd5492a14744b00c97f909ee66b37961de39214f0659b7bd5164468feecf8800652e148a15d0fedc3ce2fef6b8035428a3a3782de00150366bf39045097fdffc2bc3c3acb603ac04f3314c2857ab3c8fdbf8ef584341c20b49294b2aac856f3ce9fd5bd19522d2d5def052e12d607a480be8aa1f720f244ee5da667437928ca90f5b5528948a212c2f66f1260b7975fdfb80a1ce2dc359777e455970e4c3873c397caead18068951a77d562889b5906d4291257cde3fb0a61ce9cda321f0436a082da51ed22f025f8e63d6d8d4bb37e1ea86ee47fe78b7ae6c6d6e3307c945bd62be002125aa2a452e2b2ce9410297f1aa399ae40d39161dfb109d5f54645454c6360d6b28c9a44bb1f1b531472c9acec596e9134fedbf362b6f83dce73413f42e463af9195130c868db5872ee5d0ccb3b5df0b1846cf9cf310ed389146aed1ae20ad653d453601bc7a7bfd8554a1c8183a4c3f02ada875dd767b3ab28f7bb30104d6d34cbae51c01f7a8b642fae70de25c0fb9f55cd3ce27bcf2f1466ec06278cc57a02b7b0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 488; - dataLen = 4096; - combinedKey = "627d80144e0025adeec127c33098475d8277c95cf1df814dd82860c9c320ffeb"; - iv = "6e7194140a1994cb0cc72a7b89b7fe0e"; - plainText = "416d6325d9d78cc2a3c501f9d2576151f9409e8505150d20fb42d48df8f5b681b5c49d8606bb4aed7e392e958e9a00fada59db1d77664e2d22b71e553494eb35f6c7dfe0e55313f9432f292e0adf1dc627da530e926848f29734ae1039b444c1f7bf44558917d58ce8a56a165a74a80f3ec0eca83bd61c254ee777d6c0c68ce730f6f7b34fec82a66f6cc01b2350589b3d3ab9e125674b6688a23076eb5dd7c2dc036acd1b083371b81bdfa6801d98ca5c517791df815ce8a1aa2777892ef15b51f16bc51a1e2fed565c7af60ab2e8528696cbfea6eff54c9aaa49e5773e1149fe28d75d4440e5e7502767d3758c3f7e25e025189c9afbe66e4aded782a6110cf106494ab6d513ef2378b6befd9db45d1bcb836e7cfe00bc8b2022e17f47e35ab3eaf7009a77f7261330d5b798be8623db7b6c7d78b08283a75bbf4bea3d8d8042062eaa5e0ca1aa74f67cfada103bf199fcb509335dcb5da11a4e28c91f8a785e6a1d92311e53f100716762b51738914699b322252423aaad3a7dd9dc22a53a3335ecb1d40c386482497126de9f7fd1cad82bf45412b8bdfdad049e75479c23f531d9f066e38ef1aa44539d5bf129a2d21f8e2c277f9955c1d7a8ac63d62f1fc7d42526b8bc7504de03e497cf55bf3e9dd4d2d9b0419761403d57b57f978aaca4fead80ba7212ccca08e1fe3e94a2e61677d4abfcac00e03dfd3fc79ddfe0ef"; - cipherText = "b2bcd4bf56694130ac93dc37f40a03c264061fe3aa4db2d5f9cd76bab3b3b187397e67b7c6b7a6dcada03ff61378c2fac212da984b1ff3ccef64aeac94db8b97a2175c1f24daac5aae2f05c9c8189559808d584853d6a61be740a5ca8f3de1668dea98fa579ee542c41a0ac529b73dc050040804710899a9b017941d3367beb7f743a36d84a2afb592124941540f428117bbe998130a6f70b6c688f71562ad11933576e708a6ff564d6a07de98c23cd8877746176101f0b8ba781dda2927625d082675c0d2650b2da4aa327adada4f5b33f8da8e53d51a284b9107196032f5c3d9681a6711a06ac2338a194c4454168d0daf2278ffac5f1cea97c4f2fb0576502b40adbd1d9ffccd8983309a4d1b5c58ce224f4a3388df1c3d0adbc4153b77e0b50b84556b777ce0b1569c12731c93ec1019c93b475a99ebdb03de361d1e055bbe0340ff2adf8a231812428793f1baf53952c9c7e23ebc0f4738941c1aa9d19824e413b3cd3d5811b2b165c4f5eb5574b7377b3d1fad2c542011e904ce253d876d612940ad065262c3612e213407178597b09a300aa1d3cef83f3568be9f8616af48d71470d8bc96f81cff6c54391e3327f827436ef6b5ec70d1cc8bedfa369ad2751720257a2a4b60e0ed9c4953aedab68b03304a539c83bb09105e440600c2f943381882c1240982fddb8473f5cd57ea25cffcb5514e27c6993e302a681109"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 489; - dataLen = 4096; - combinedKey = "6a6715630de9e29b34af235e98e2a973c12728add1e97567b0425a22f42b4225"; - iv = "37b261ab5062e3d4e3bcd97d532845bc"; - plainText = "0dec51d652af001c8532f0b0e6fab80fcfab130edbd8bb3737c63efb9c16d33f3fe5a62747505fcf713188678bfd470574e9c57e3d17565621cb47b7972cab615ddab87cf7e040444fd63b7f48b6a48c64aaeea9cff4d62c705f35f9540a58a594491bb1e4b4e0f15a83cdd6b272f51c6472f73ca26dd05fef6f14828b9125f69194e16a75350b23a778d885c9ab753154ca9da607c68acb02e56398b174ce2593e59da4b3bb5d83267391393485e6065b310b1e6037a0798d9fdc5f5e95787c46938898c0a528aad3779112a5315dd1107f236bb63c5bfc6e8cddb0498367e52511afec67e4aa9472d723048b2c8ee4e31abe1d89a5dc65389516ca6a0db420136ca8608955cdba4dc669f9177b21834842be9f5e45352cb9e54482219046d21b9d3da02a9bd14d326b269909d5cb8b494c11320ad82a459f362abb7ae3c6ad6d9a4e4fb78fdfbac902014268e977b1ef0e04f58efd82abbe6a3e019ec79ba062c599a15fe2454f0ba85ac00a3cc15051a523c0b38a1591a38164b92a1f4a21dd018300bd660f210cb8b78d80e2cad69d383f361a6112347eb4f4c0ef246ae747e9902af85b8290f5dddadd6dfd78c49ab81745f77e0fb53fd17ed5d2c26d49d93a9756fe542a94f88bd12f04cf0956ef3ee7e71da746b62e5750cd81b4139631446897f8ca197a3abfd7f40280bbd0ecd9564cc4e88e07eb7a84fe01e34a5d"; - cipherText = "1569e92827cbc6940ae71b90b3a5303ee6c46fffdf1d7c3c3e18a738381d805ec727ceca7e0aaed19a03e606fecd008b74c13a04ebfbfd75441d9da07842b5127ea7116d62d7ab7003568a31978a2acc73173e8f9c0bc914b8f6d58c9a5a7344c4c426084b685a8a015567f41d1cb2e58a3d4c0c6fbc386bf4c70e8410075f49606b07a2263af8e780110dde80bbefc8bd311a0b52c18c516e78365d5c30db0f2bef8e79d84faeba1879f8bdd6de4adc91afbea57fe73c507162590c82d6c657d229075b49e7353c56cfb0b7a705cb7008875d21a953226a477c6c857b4372bd71e893d8d214c94b5b323063643bedabb08adf53c4690af32b940fcce41fefcbac3ea19d0d6a3605c8b7f5147f1cadd0dbf00689b3c87a5a455f732033d1241c229513ec8d4fec743c2afdbab381d0c354addaae5ab852e33cd79fcd2979a5d7b943e8f195e3d79ac2031c97cf0f13961be2ce2a3fd4d9a17d8587dbd8caab845965477a5665c2608f56eb6ef6d7a0871f4c9e35595ed2353bbbaf6bdba61c74fa070759f710d9ef3d879b3be3498d87a1552d339331224a94d7c7cc6e8697af85628955920b627412219204aa8a450e911e449b640733ebef85f9b75725c61a7d4f86ee9c395f970b6c2d5c33d518033695b8a75914fec15a9cce8742803f241c4c143e32c0f93fcbf49732a4bc79897c4e55991af863913850a20f513b249a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 490; - dataLen = 4096; - combinedKey = "5e85a8ba6729cde15968279989e3792fe195f2adfe71defa76f6edc75e566997"; - iv = "f69d1d246f07898526a0c5dd7763efa4"; - plainText = "23e8e727eabd42ff10d33933ffa5ebf611e30640672ef7df5cc589de99f826226d5be4e2a0a6e077d385e92b27e8a460bf7e01d900a725ad9ad5ac1982fd5d6bbbd369fae515cb592a55bcaa3eaf4d1c94bf5a7976f3e5746bd0d7269bcc2aa723a28648b74747a77214e4f170d66ccbd4b0b9d4496bdb6a8d76844c6babc7098105f49dd77eb56bdbd4af170a1d3c0c4f419589d949482a95960f32df144f268002febef02225dc16ff81180c8aed7d6e30a897a2d3c0e9d44314b91d625c2955dcc55370a9da30c5260c25786c15416f47894fb5b39e58a1c38c126dc81e0f786e9365545835a3347d534774a8a7918e213b744073fbde1e2c78ca9c11d99f21d5e52392cf87451f263c12cf66d85a6567c5e39ae7f6990c1b9812337a19c2818bb9ecebdb6b9cf78af2aaa3c49a6fb1c66be94d92b00d1477fc096b29cfca19d6dfd3765905ea75d62b37291fd6825e86accd3993ce19a36c1b7c866cf49153fb08d96d8ed6c4597323715f103aac1d6a040956cec3ae7b54c88b5656a075030dbe1b25de4441ab6eac5006823c3857ab2a920e6a5aebc5f4694abfea66bdd3b00a2b338de0e9baa8fbf532693f6db58b9aa01656da84eb77d3c74845b91823083f643d23c4363216cf3ea866ea9228c1004c8d1193dbcbeb6cc65d72fb4a1b45d6d2aa0082eb0238980aac27cb0bbb0000e7e43a23a770eac182764c45ad"; - cipherText = "af7dd1f8e98373911141d5eae570959c516b0329ad74f1ce2d05506c98a98e1c3b65e8da915a23bd1a276d77dd81598862876dd75f753ce24986edb95f00aef9353a48b0340da9b9e26222c070d21e22dd4a6d80636990a339d2df0359bf10126b3928c168ec13ebe19f771d5d5f1c1c4bd4c8b1492755bc202e11544ee599ff2e85eba4f0193b6ee060ad4722ba391ba92499d890301fe2b3cd8966c584313a9a4f31b4344d12e731c327f207495b6a119c43e4aeb2ae9c23d3ae0ddbbd01c503c75ce2805715f62425b158bedfc79dc36a243a6d72c5dff780d3bbb6c59d256e14514db86dfd1f9317283ab5be8c89fd85974f7748342897daed5b33377cf549b3bbcdf4cfd3199b5c103a88f8eea8a78a73aa7b681caa6b30278e218ca89827619469fa799c001ee02f91bab004f98298c6e531002d60d41e37e31f19231a6f5c87d7b5547ae3510ba031c37333ff93bb8e20365633e836593108a7b36958fb62f80b5dba830829534b3d874d07af6780c8c9acc9bed525ff08e3bc9dad16299c9ebb3ce1451de0d90921de9cf7a4a571c3b9bba892f81ea68f711164246d157fa658f2d001b9e8eb5063f03a7eb9ab855306423dc4b0cef8c860d9c02eef0a90836b68a344a728e3c6859c894ff519fb28dc5814c26b0c30292e19b7d97944aaa9148325c17a2ce8613d10f3b063f080e42e40e1f242b81345f4ba830e08"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 491; - dataLen = 4096; - combinedKey = "58edaea9c8a2f42611719f98c6fbf3dbf6107cd4fc9faef328f87a47f95cc63b"; - iv = "ae11102d60e043c23c2cf486323cc836"; - plainText = "d6a0cb85a11d2335d7c314d184ddc50470df751bcc5a015e4911de24405b372fd56d17bc3cbf7b0411f40be3c9a6b2290be9f9845ceeecf3d7b6b134cbd8c1180bc9a9380ebe6d65aed2f0a793fda3686f4dabd5d716de7e579cc57a91f30e8cbc535920b1f3110b7e0e99ef76e39d7833f12b8a04549c9f372d44e3649c66ddddae3bc924158ae3f61e5605cb43e8725ccc124d124a9c672745462db88a8fce6c4286a8ac87d2819855b70c58f77bf76b485dc1b7d4991a8372e1f6a9149335ba0cb2069bb3200d015a2b3af6007622ccdfdcafaf1ee6b2a5734e8423e38168fa1eaae473999f9cd171bf0303fa71f1e4c659c0d864b816ed2611f2b283963b3c44e4a1b24b2e88558bb7171d3095d58de4390f7ffbedf3ffb67fa25c1f0e5546a3c6c1e1cf5db3bf0b9e5d859d4f68f7acbd358019095d997bf180d1048cd960feba9c75bbaa897065d68b2ba00e679a479bd0582044c7b8b213fcbd4c780d8749bdd08d4b773ca52419f6517dd4a2a7bdc162284ae9f236348f84b7436098c648732ed33ad47b82bb0164a974162cab9f8293c9b2db098941706bd64559b241074ca3884980e992f99bb5bc9374018a2020adc8fdb670c4f567a369601d4d609894dfd75460857e3a1adb1c24d725dd7f8eb40238307c24a109b1d5b133b5bebceca028b35181e8bfcca830122b2cb07f51d95d8d0eaceb7837e28063dcb4"; - cipherText = "b3d47290f9c068413773df35bcbfa880d537346613851e1b629cf790d10ff1a42052b0111b808a5cfdfef127e3dbc9855d114b4ef4114608a59700a1d0816f738eee47c2440cb1d05ea1f88b87cd7dd3a0b23c8df6b11694bfc2cbe4352bd936d04f2945e57741bec6410f84294e79d00c44de323f9dc3e9a585ed1e3e06c13b4629bba6f76976f022c031b8a2763f0e826b02e9b20c609b1634ea4b51dd2e4ea36d0e5bbe1ef5107e3d146f07677fd1bc73f183db5b1c1b0e4cb57d1b06ef796fe321b5fa9ca2580e798069f644f88b4cfffa443a35020c3f95b2811a943e80de1f9bf208ce72657a7604a5254a1fe12616824ddcd363bd76c81bc1e988a710a4f7dfb0b7117474cc8311948f795c29d416c39d56412486c61a5ab94db037da4c7b803a595e0ee286bf39e5ac98ba452aeedf9430f481f987c3aea40c96a9c3264ec6c297989d6c81c6d97bc4900d7bbf5825cae5d906b2b0363ffe99be06eef3965d97b8f761aa1bbd968808e381cca83bf9ac87680ff804832a08223f8b9cc328dd90b1b33a78e6a1bbb65a983af44794a06832fa6526996d24ac2b0ff08d9d516c153de6d1e9b42b3f27b112e5d70f0182f775353e508a4fe61d8a2387223d77005470c32ece482d1d04097aa09084c7d43d908235394c3c19020410ec4e470a1db1afb6df2078b762889ec285c4bffa3d1024428cd08e1894faa54026d8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 492; - dataLen = 4096; - combinedKey = "3fa5eab4835500bcbe72dfdc18ceb2c2f8fb8ddea4c5244f9f77afe8981d96ad"; - iv = "482a394df1392602f60b972f543c518e"; - plainText = "64fde316e46b5190cf4ccfb5e012aa59c31026187d87c56d66dc8bda913279f05734f4ed21262b5fc9d13d569a3b3824ae80ae30fdfa0c8849d78a7b349869d5e01668ba5dda0d9e24f2c38afb103ecca64d760f7c98ef29e07d2993bfc61228d2a2cc8f0bf05b8a1bfbef9bd1b7996a5964b287f54a2329e9c03118e35b801c161840fcca60e970147ba3533997c8c148299bad3581e63d23c2e8fc9f00f4da6d6fe51492a7257da48ba2d3a12b866e973f285604dfee8998c99263b50fd9e87e28bb46aacae976474446d7dd3c1d609d930e37dacdb27a406cefcaa62daf6a5344fc3167828c2e02776be7a483efc0a2d022fca6a62a531afdf7a459828c152d259e1ac4361c811f4a616fc9382d3a8ba49ad49208c6c6812346edfc7692b27f33ac10e7d130de67ee899571a113b546ffa0facb06c1a6a000235f73ecaadfe99157f3e4d7534d6ac69bc632c8a5c54e92c3ff67bc65a88de58f5f057a2b2d6975e38309984adf8f546f2fbc608222d3bc95db3e847f67be0ba64eb7dfcba9ea16cc9059f182f5391b8acb47e8ad02ae9684a0b9fa825dd926eecd7542ca351c0f03b79737573172c613c1354939f60d0bf2313e47ab847c3dd82120cb973f5e2b8bc6f502f79c0e8d7b347376b47cf4d62356bd3cca387c9569ce285afecef0b85cf5bb2ae81f47a0d5fe5d555374864b872c6c237ab66081cef717f5b6de"; - cipherText = "03dee9f52c16a00aa3b1e3eec26b1122ba48fbbce70a7a4ccd1fe92babd8c1aea7cff19a15ff9f57cf6a1c314a42a0ff8eb69c830c85d23be7aa13e393c50cc8111b4e7c2f664e7663db7ab1dcb0bb9341edcec7bd2996b01202fe4e9606d0d0e6d391c905945f1663b64f42706fdc54fd9552b0e6213561e217863321f268e267e28ddf40fa69ce5fe0a056cb82e719e6e0894aab67d2f46082e02136855c8ead50509655a50593ba8b5c633607666c64502e27410d435802a8c24552f77d3cae222f4da23e564e95c8662e08f19ebb326dcfe0320cd288f2b8973ae2c80f4784034807cd6389d15ac28777c07cc44c32458c8ea8429a7521e4b87b4b78f1f2c21d301e2ac0f0a9150344d2036b31418a5f1965c1963c68168487235383443578c5806db812f0f40a69e9e83cf46269ebd928fe8dcc63157e774f3ef3d9098c8cefb7b1857ba28b0bbd069f04999f0c52410612e0c241f7b08234f70d8f4047dbd38213852c65f26cd146d3cf0ff2b0c6d2f531274560f15573bd64772a7420d4b30e37ef4edd6f6d0993daa887704c78e117f35fca712883526c89fa49f9f015e741c55a995f81fdca8a6f54490e45296eecf0869d2d4f0311fb07803d69a185a113f7382161211e39a991d0df48e34aefcfcfbc3085e4060160f5517bab9eaddbb3372ec41fdba12f97142b1b040567334f0377c1de5683ca2e80354519bd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 493; - dataLen = 4096; - combinedKey = "1c21b198913a6fad46972fca208c5713e70a3c37651fdaff3c45eee9c20b7f19"; - iv = "5146c53378843aa0140ee51999b51ff4"; - plainText = "e0a38b519f51b9d16931df21fd476687381761886fd19e7085e89ca9ec2f9a1ad0ce43380d8c7555792ab44039647f70f502043daa05ed11601233fd43c7ed4018be1ce6a1dd3ee59b6fd8bb6eb83b95874d8ef3cfdc51886b8bf98d2e1171697ee460b8726c2274eaac7f85ee498e66ecb0b1e5a6bdd371281579d22e718c6e6ab4dfdda451eed19795177ef93f730f39ff04124b818544ada43a22955a21f372e8a51813b0628aeeeb6cd7a2575a346ebd512da1665e20ced92c0cb94fa7c0c7fb18026b48ca38c829f078f012513888afda039814cbef12a703b53db8d9094acab45fa80853fd838b373526d94e6f162e129527b775ebda60828bf08703713e6eb58c49427fc1beb8ec63b6cd9adcebbd0fd8fa02c79085ef14f42b079562d7df89e38a856b957fc6af983de985c6acecb3bc72269dc5fc45dd00e34538d428d107660928f0dfc5de5958b0db02db991a4d0161be110e978a69d5019ab51c0f90e31fff7563dd0ab2cc490cb1cfcb566435ffb5cef133a519df8f13a524277c8585a98021503ca80e823057c358c7d039a84fe181ce35bf059b54a2f46514ae7d03dfd9608a0f1fd8a1821e933147366097f8957ac268da1fed97d393b32a7ea412b44317c235f7e0e4174db9dcb797cfe37a666c4213ae94e33d84207bc1e909f45804588ccff9c838e7b5111502d78444348a78f3d2a08c57eab0d09ebc"; - cipherText = "7e6bafc409448348b1c11cfd661091e6afc648f98f1bdc06854afe06c49760bbb0e248cb3dcd17f21bfb0bf2ce238690038d65db30cedbd28e8513cb055ad9655df1cd49b68d17b1bc80c6f2736f94ef521de3d8a5d31231b08bb4426561d59d15cf0161e9e37b83c82f892ca227d6898ddee227559415dcc55262e5e23be98e36593995883c9ec22bafeb50154df2c7b824b2c0d6629f4d7b8fdfa7471ad173db5ea2c212a7e92587f649a1e39e28a6de9ee765aa990ff397a549265486a94a9e51eedd0cc46ad913dbb511bee7d02a0d10e8418994f9a2a79307b1fef054879e7f71df5d29924aeb235d3aed66e17e579de2939e53d7cb0c7215ff359dc5cdddce14ce222b9f8be863732dc01fd0213a8886f638bc00bccefb429731fa97cf02db3ed198dec95efcaa2c862a80ec643c680a0f06918e674fca37bdefdf03f8d9087ef3e02da8b7b97d731b746dd3835b525a0884227a37e04545625918217f5289a8779020e635a153e3ae7b2f44e1e35cd8076a13cb487f126926c0662591a62c4c62b4a35a0a256538864fe979531e0467a7f1da67df19c626f2cf3130f852cfc39b4ecee5d081b979ae7ddbc8a05a02741d6cce96555adaf477965f05577ed6980e4680e9e687e75878976cecf31495d6a0e82a6bd03387f56ccbf1bf8c2a0db777b27d442f6ab887587a2faeea4079bc4c0a159de9872380592c426dfa"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 494; - dataLen = 4096; - combinedKey = "147253c04ad58aa0d4b53b308ad14a0028399b6d21cdec97cd195f22945ca892"; - iv = "a51b21bf9786b02585dc871e4560566a"; - plainText = "d0a29d79490636e22c64b6f0e2398ef3b42e4cfa4064cf7d7ea8713fe17b8f141e2ca06e7c57b642cdf40302e338b6ade4ac193b54f711a850ba14871bfb67278deef1aff44302aaa183acbe0b5619289c6176227665066f87fb1bffa1e131e2e7e3a721e2a4961f705b29efa64b32d5eb0276d0a797ecf2e61c1791f1c7874be93e893834a3d304d24811ecbf3c99c201550fbfe4f8c9d2be41d02b0a15fe0cd3c8280b8cb8dc29339b68838c30543810be0a41fb24c7bbaf6d184ec70d5885206ed4753eb03927be0731734d1f01853808c71cc58b3655ee9c5ba536696deb3e2a3a958f4d7e8ae769526a2ab3cbf547fda1caf09ab69a94f5f3c289f715d662da8888cfe34d1c26f8b250c7ae0fa3eecc7f5799c80e9cbdbdfca6e2912b13e238f9efe978021ad08ca8ec6f816801c302d5cc3a435a7ab41315e7c83d84d6df2a5f001470f0c6f5f957579de322422a97699c196660befa6db1c7bab9d064a5021daae02c4c32a4c63ba8d688329d1f96517c3776b986daa5bf2e90716dbe8d749e7b5081916d27bf6d100e1954e68732e23d10b64ef3430bb8c1e5cf22e339bafd27a72eb04def5b2a5bce9d9bed18fbb74ce9a86ba84cee972ffd84713fce7d8df31ae6ff361280b4b044aa9655c88cd007593ca5e5bd2b9efa30095c395823021dd8a45372eb2e4ae59b523f70f08de8bc93a8d52a5be5e96e0223675e"; - cipherText = "b8ca233c918d22f030017f798514ee89185a4002c17b15a135b20cc5778b2771a53d314558eee8fe6f70df02c09569530580f0d0638fc93a604999d43d6bdedae0aae43e650ad12dae611ce5c804c66b07d4be2fb437ef06d0c2f4c19cbd0f4e8a05cf5807f0c1da020be7954019ce3cca6998fdfffd69ef74e32e147841e106aea6c445faaa9c93cbdc4eb000df4f61f19c05b2446dd49b31880ab14c7edb350f0e378e5c67d1fecbac7455cef913ad7972466f89cc2da49b4c70eecea0fad8cae4814f532c3c757da7d16b14c4b28e21c62788d5691c99abfd8b21b16fc8ef985066c2ae4dccefc3d9cf9d47a3dbfee6a279b6763ab841a7d393504ca0e85a5c6399fc1ef725236ec51b87cdbb94e025bcfe50f0f47db0ab4926c217f9ff8473c2601d3045589836938a076dd23765ca797cd9fe67158299dd10e81b202a1af4dc8d951c9fecf8e75e6d350c377a0f0398798e619ec0003266fdb3e6dff854ab863ec8c57448f691335e5f47ae0792cf322c15c2cad79f15dc631cb1070f91c3e8a831add85509b6155c0b2dbbfa635c342d69efb602f23f65da3d5c65bc8e199a1a46ac789ed143d689a6c1b4090860ff8d77b5299d8711c8eaa4a527fee0fbcb960c86073c3be2d855a6a6220d4f7e1c35f81c2aba824ad5bd595e575d02aa3700f787f9f57f6dc6eb52183965339e948b49c36d64db85d2625604a5c981"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 495; - dataLen = 4096; - combinedKey = "22c5b59653e2e52bb7883501aa801f38ca3ca1179fdd5ca37cc6c0c2078ed3b9"; - iv = "ce559fcb7181275a9440ba0a5eef53ca"; - plainText = "8e32bf8e380337915ea661b30292002e6308c5335d6cf1a780c207483af4508d7f9173979a9c3b12a74d7b015fb685bce2caf7bac5336f73f32da39f34148aa096327f38cdbb3f8b50c5fbf0564fea985ada1cba5990ba501ae3d1e5a87c228063de73fb1c27faf4ab97852622e7333c5ee83f41dfa9ae3166307296840d00387400d96d61d6b17375be0c95bd5e60a4485328036d6ebdf92ac9682f9698170e054ba5fd8ac557bc77663c0aeb1cf5c9c82880192d9d329f9424a8d182e609c87ed297ee64c10cd5b77053c3183dfc05f9934dad29637e043347346653046055e9b0041a98e8579f0abd2db6b5c58c3c9aa1d9e25841cc11a65c6540e5c7b2096978f058cebc819b41f4f39e7faeb894a2a9f196071193960569f9da1fc78fc74b3de2acb724448ae0c08414ba7953de318bd95eb6208ad5b9a005bcfe6ac6f65f4e246cbe75aa22b333fdca74886a66448526bbb32212fdd32be847432134a8924eba41616be5ff1d8b7e6d7d6f4e3341572a815e3cf0e4b347515128a47f5f83b74d32bc9338fdd51991d1acdd0f1982bf59898ca475e5f9d9347d5ef87eea7f007d9f0af3fe6fb7e1b30c7b5cee5101387b9fb974dfd8db10ec14ca17810f169c876bf3721cb815eda1a69f1962c1a28aa1483dc000714a31628e5b735ac4b2e2b23cbe2fa8f5c0f748e13fe480b9d8763592dba6aa20e48991564e22341b"; - cipherText = "53e76fc2fea65a29da72d8ea7cf36399a2b023129f2e1935b912bef249023194da34d41f7b68e82c669504e91aa9b4ba79f6a868774f89457f19e9773ed8fccc531b9d573bf8a9e9ce64f41ac868f9d7b2df951986a0887a95be393a350d5f47a053a5ae7512d9737f91351f46a6ac58147ff79ffbd6933b50eb06993f5403c48eeba03d7541b0344424ad5c43bc203edc21682433503253abb51b416864c78ca93eb930b1200f620bf42edd157d6fdfd5c5d3b3fcb10e1dc264d27a178a3446dfe5bae7a0d6c8f79b007ebadfda9a605e0e15c68e5a9c915b445571c168d80eb4219e9c41460a91998ff4ce9d9a12107ba76adc45b4eb4b9c13ffbd9a9c51da18a58748f2c4dab877e96e4787d6cd2a4a0c546e828ceed4dcd8070a6dae73b406d0d3b30db0df47d99a865a38ea59eec3d89367dbd02a09bab894f6b7f721abf859bb372a50f6d7ee7d997b58f5947ee1e5e5a1795b4b5c8075d456572830797de35b1d29436e2525c430fa5c698d732b7b38a95e03d375ec930c0e92791145fea2f13295b906d2d76be45cedad39a087a637268baa6d19d23055b213f984408f38d8c0e5274f6f2209082ec2f0b8546837154e9cc2fb1c73ab1ffb178119823c527d449f202209eab54ba2a7554c17674ce68e39cabc183f3da25515382932ec67f56b0f7bdc5b7c880e1d073a7b7a89ea72f84f4a5983b5eea3258863c2f6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 496; - dataLen = 4096; - combinedKey = "926355c5c5ef67fddf586f2e4883b8136c10664ac2368a0fb1611ab2286841a8"; - iv = "c65e24add9047ecea57e1773063f57ba"; - plainText = "3a0237a59c7848d45402ba2652f0494db78101ffd426fc212cea11304b5fa21494a6e7a9a0aa0230f166e3620a786b48568e913b14951b9e5e22f36c3f24998987a8764b9077cca7651ed0011f6696c817ad08e559b6951d5ac0f923c94da52642f9447878ec2d79df5e7b5e15d2a219d06a5342856e47f280409e88cbe87242cd3950503917b1f5764e8e346dc1b034a4c1dd767849379255435fdf2d83ea2e2a0a05074e3174fbd1bae040683044b2ef24613f1e47779cb168214d5a5a07976624ac4a5ff83223663eacc7136fe57b871b53366e5ac203d313b3021c10796ec1bcebd7b9edd6a14510e5ec3d1bc76cc2cfe474ce4fa23c14b2b924eac77d7bd2b26a6c5fd28a8f646b00e22194d6d2f23d7e55502d7f7302ab661ceb95182fe3a81e7a060238ad72e8f830772b35d8eb4378152296fd49c49e9379f3c2a1c9485d22bc0e3c6d21167e9392719bf36c76d25fe0429896b235e670cac7cdc029ddd909063a5c06b9887c66918a817b5cfc7431014f6c53a99ad3fa006f9b9693d77bde84cb81a115c87eb879007ce881fc5fb685a5b43cf15e672ede3efc19ea2683f4fe6a9308cb25534e0677e26ae65fc6d15ef0110dfb717f8b8cc069b74e7f7d403d412efb60854ce6bc5277ee44ba77c09394995a6db51f889ef5e6be15b6e2d3e43bddb4fb3f7628c61c4a3cacf5fb2bc585f9b4033dddbe88b935b449"; - cipherText = "2b64f9d6746361c7e5494f77b95735f6c5ac4a4c9e299adcbc465dcb30d6cfab7e92bd6de2f966ed3e471c884a97b25f77d5ec058036d84610a7c3d783b4432824ca82161ff0ab336fab66cad7b22cbe0c94c691c74b03614acc10edb01c34ba522dbff94dcb626cb5413c2a8ed406583607fde2f93617f51971b3eb5ebaafcfc460761880784b35b3bd1fdc657cc9f5d4eb3b23ab81c8181743d88302b88de364d123ed1a4f726e1ee4427614c59c8a25777f61bfae623833c2002f65381cf750799ce94667cf7ca7076ef3169aa9c04f387d8e8a1012adb807cb177ca7864e5e971ee7d3d53d3634bfe4e1348956a0031b0753bdceb358fe69220ae7e65717759b843863c17d52fce0a693b0bd677e7c56388aea1f5243c26de5ca03d79c6c93fc32b1d24d244630e4aa7c6dacbbc7cc88e3ee7a54ba5ad0c5896d72cd28a5ad8bca2b64cba813f7f3e01283d21db267a417412957acc80f980d345edd195600841cce87e18e24f1b57e65a4e9f88a51e0d5f7b5ff7a997531ed590702b91931d47ec2d60e7a940c152e528f6d71dab4e2210e325b117c22294847adbe9874bf8332244deb9b1761f856d25590e16f8547975d3182185077cdad00696c34a64de1627ea87c4738ee3ae7bb85dbc3acc89e5eee49f7b0e44aa54be425e28097bfb0e448a9e19dbf033593ba18fd38a162d755ae3d8d27258957bc5367a76d8b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 497; - dataLen = 4096; - combinedKey = "94d97b403d657fb51493e9b5913261303b27fe4e2d2988ecdb9e35f66a74ea97"; - iv = "92bde0206c98027da74579bec42084bc"; - plainText = "01f23eafe9bf1ee657d4454a23bf9c6833864582e6e8fe16d80451a18699d80f99269b5936e17a7c0ea0fbb503330e27db92c9461c5c46bd64f5fe13b5d1989c4beb8e86175ec9deb70b5fcbff74d64eb21380c3eabfc1804e1c5fdf5eaf2e6dda6b74ad2e96068435905a9a2635d1540872e38e29698b8e11bf4236c5e3edf228906f8dcee7d095f94bc53314d6ad9c860b4d8c5a411839d8f61ffb28a7dbddf73566a1dbf45d141cc3adfa260ba6ed50c5af5238759ae8adf3037169e71c73a70d7cffa2a60451426bbe7d638181ff2d58765bf164d9dd2e23ac557e5b0c7c5d51e21ea475f369f43320248e52c376c9df7b9485f71812f09cd6972a9c66d436d13209f60197a2793c8dce3b549c27e4463017dbca52f284fc9f767a9d397223c92da86d520fed152572e91973fd01268bfe16ebb1c0498db60b24e6417680c34b49e22b64496f240944c06a657fd78c7bc21d3a9a20f088883712ee5590173d6ec2da888a46ff1b89d637ea4e7360b3d97723ccc624f25af48ba16a05bcdfe33d9a08f38dcb981140e415bb366774ccd793c35a0b3f6e3fd4fe469784e89be1d047f4191d8055bf116ce5ba1e754d326ffafbe09b9773f646b9058749008fe57337f6acf4951f71e011d2a1f98663b96a42f27e1a72d1b74967d143c7b2837d023ffd7d07acdbec6e9705b1ad5c688726f4f9c1bb9e3acee1a8b0f38792d6"; - cipherText = "957774270ac16c75523a910a0efd035ce66adc6b24272d6a3af1ddad7899f1158e2bae85d8b673d2336fbf04ede7ca68fc52487fc1c8c3989a2dc3471a0aee5302fdfdd271ef61e932e10c102d1889d8fe59d010f15f5f4ad9ab5c10c30e6b555fcb736901a919a4d76ad1d16250e84434286c605fe52f0767085b0a32cd13ac1a5245ede8f264b6484926c7632e323fcb30975990c9f10bf03f0963760f9029607a6445f2378daa3f9c4e712e747742da73d2ba4753ecc11917bee1586f00f12560f5a15b9267ab9af071fc51f9fd5b016af785505e12dc75bbea354634ca10c3d9a8e964bd212fe6d2d878d1b86d14d00bd5406e5531cbbc94c2992e6839161987aee7bab2d7dcbb329105509db84c129c397cc3fa807802bccb343c5ea49ffabeccfde6a6fe4cad950bbff83a4723d9c86d52022f44495bf275c2ec79fd3b9d4b2d1a4521e7eeee2f48a0856d22120be84c4d63e9a714f781adc4a3f100a29ace3dd8e6e25df7f56ea8bd5902ba2061ee9efc017c5566460e12b6c1bd0df9afb8ed3326fdc11f6595f08c5dfc266d2c8b1e450b401520070091a0f47dafa56d885919f7ecd149efaf7cf68008a096d5fa8b89e62199e2fd70080ee29b28931e6720113b355ff4f992b33713adcbc726a23089c99bdd4f667df5105b5587973c9ebe52231b2d03febfba9049e6a0f3dbb05a26b7ac33ed64a981467a8a8e89"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 498; - dataLen = 4096; - combinedKey = "a96fe624320caa9af4cab7a86ab88570d85e7c404eca151859acb27bae067c2d"; - iv = "f5a7917dd191555f22aa6e798141a997"; - plainText = "e6aa287399d3d111471614c3198a6569f5d4958fcff47d1b8701a7ef0d2c31dd37c3272651624d989cdbbc4b7c5414a7b488d23fba0dc77dd8d7bb9b80ca7a8653223d053308a716740fa1f63ea30362f7f6d41d7c9c9e9473277102d35e23b131013796f15d351f2c30c622073600d02742faf9f33b24f84a0e0880bd9f7b99c09c005a762e1488ea79939221bd130addc961a3dce8359d26d81189eef4b93935018e0bce793e82f6fa04bb6b10f6af3780d119c674fb67fd2d2aa82aac5bc0ddea7cb64f38e5d6d0977f582a683027172b18175c1cd66a91c011562b379375bffe039f13c61ec372a597cd2a12f343192b83d93e16b3878d282dc3fec877f31c0d7b9a5e70ec915770cd711e8c8113f74461e47f67496d5794f50731a673d5002718f282267c2ed45afa5d2f1b84660620778fe0d497540c31f458424a21d425d64b5477cc626e8a6beedc42d7f50a733845461d2fe13fb46cea3b0fc2347b1f70142bf3a6eb040ed3b80903ab615ef6adafbd40157ad4f52e30fddcb15ac865fc595db65e79fec48909c195ae580ef61546b50e49e504962f6650832c2be773c7508dc258339143b81e3abd6ca7ea4921f07110427ace4a762726223936ebf439f94c199988ef44fce83c8a94355e617be8225991f497245fa5ff7d818b811975184f3ad54ddac051f8b346063260471fc2748143d2bb409cdfd3f55f4187"; - cipherText = "45c4f933a6ac901c3a6d8d17784d4758bd19cde363480c9467f1ad8c58f3605b3c6bf174ac926c66e194453ca5a5dac0d748bd603b3576681409f2e4c91557a0910ab88b8c898b9b9a6a170dce8951e7e042c9a4f471637327e23f7451228240447c0828d4cd2ff8c5a1179a2a7fc7623015cb642ea4649b13c2d47eaad05eaa81f7ff2d95175a8e2ab249f6b8f3345c61d6aa737ed777206e3fef5dc7f20bdba7923809b672c5c39e3ad952e538f643d879512ad58dacc7d0be927c98e2267786fa9307b1b0bc1f0166765363fb877bcae4d44423ec3a24817e59f6f9bedb6707402b2eaa379423071c8169419546ca33b00a8a5c6d4ea6e9e500c57163e530be61a2a2eae0434fb18ef12bd53ff4b42ca64feef98d44decbf58f1a54add6b7bc70f9988e554f34dd07a4a1e7b0b77bd27f5def9e3697fe28144b4255bdc10fcf08d9a7372f901b7a1e00255546ba79c0297662dbb18a3062ff547c12bba45ef9c1eba44a8b93771e88a058ab5f24d42ab5db5fbeb0c1c68d5417ab683886edc2365d5936bcfc5079d848bffc640d18961049adc6c2ffc451b8bebaa93342786995101b965f803c3a280c80caecb80fae985f5fd876a7b29d1635a61d673f15d774727747abc23d7cbb631d3148f4d44394961397614d5a8982a5c6eba2aabe303d37a7a37bbbc1a0108a2608c0490a6747763922efac8a075ef9c444aac038"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 499; - dataLen = 4096; - combinedKey = "c9efd992e96f27ef71165cd9db1ba628d7da0a1cd2cc85a8ad47d169a9d028c1"; - iv = "be3356b87021381f792b7f1b0fed71a1"; - plainText = "eeb9d19f81ee0c71d14ecefb78425c0d7ce0f3f79feaf2fb61a543b1d0802e9fc9f30507dcdb9c5edf6ffdeff52b072b12b108eeb1531c954ccd3d19c62334b7723670f02126b432e11ef289e0a38aad5f1e8dc7a64b63436599077379ed049bf543a28728ef4809da3c7e32ca63b716bcd63e68e3d3f4d0ae0a574ce77493b75dd7a4689dc8aad6f73297b74a90544f793e9553c9076a777293cbe2d574eeca41bb7cfe87e306655388085e4b0e74ffd19a91151a3daa9f451f43cf81af9e75ac8469bbfcdcb87c8fe7aebad86c6d1ae13ef54d2116a26b3419516f79992cec1f8df58427667caff18290463a929a89ccf9ae17cc6c0224ea8a8a7ce374277dc1c2db8a072e137e857f67e9e858e0fbc699d9da4c3d3bbbd668abf71f3b165fa9a5960342b5549405df373f28fcb59ffd9038e8575e446a5f02e52696b5628d5f9f8f05ce00a0647fded836aad1be0a010af79e208ca940a19dfb959a178e12b5e6d506cff70fef6ef1368cb1f8c64e835d57ef97599535a98a4ee773dc7090adc5765261ab171c3de55867066f8018a96755dc9e53605450d6c9fb7a349819354a558249c67b2d37bd42c20e70be34c4e804d7864c4cff3ccc223a47043f9da3cdd53ef2db03093e0b7f1116984641ed31f8b44cf7ccbf297034a869b71d2b8f068d58f52574ca5b33bfd27f4eeed6fe736159ba75055e51e5149d9cdf3f33"; - cipherText = "0778dd20b23e07b5764f8af0a1b117afbb928a791a4cffcd71b2892bacd49d45904b5782e8658fc3a25667d506a44314181fe8b62cb7b7b00bbb07fc104dc9241707548136c41c7ef3f39de6f8606220c5ec6ea20e260e316fd1c73927bd038332dd7e87dcfe6b08fd49a966f7cba7d59fb8c9f80a4bde0652dacf8420b43d3acc6d8b9db92fb8c12afe3690954f800efa6e6102d040b3c344f63781a16e808114df6e077c31849ca0bd93cd31206d39b7976c82ec0c29ffa982b6e4b1a8fc0131bd9f5298796f125463d017d7894d61e75ae1769c854aded4429523d1c1138f4ef7b226dd08db91b0b8bbeab9054e08ca076eba3e8592b96c8ad596a446d49246c7be1f2cec5cda888e1823ad5f998bab3bacba3c76ea8b6bd5b2715098254294acadbe80bfaf63b96db76b19614d5f4740510e2c6a594d2cca89bb5109957db32541847338fc4ce308777762c1c751e20a734f0258dec978372f2e9e10509e41d3b3b7cf301a4df15808d04832fe76e1b3af29ed74fe567f618b266df050f14aef3946cd47e03c4aaaa2bf2d43096a61485594cdfb47c16e3db9085e783e164157f833405a5262516af64dec07b0a25095c8eac46fb0ab4900d4955b727b1855c084abd2bda391d9147b14567df24ed1d79c422490faba7cb5e3ba142280ba4551833d53ec2b4bd290f956f71f8f845bea570ee58e368a944d08db61e2b4a6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 500; - dataLen = 4096; - combinedKey = "ada1b135b084f38e4afef1ac95fde93ea9f1b6fa9ec2f0c83e45c7363c4c0421"; - iv = "c112521197014739499e8e026c5e819c"; - plainText = "c5f9dc8266c677bf052357b0ff0c070b0ce680bb3e41dccd28e34b66bf55d69a036fe09ec6392ac45794534d83c0b0f2dd924b30ac1d991cc20ca036300d07ea907a2afb547cc259cd6e120199a9f8c213053dc7574dd8e9e038458930197e642a542b5ecd44167612c468b3c2bbf0f7418d0643f7b9b8218304299cfb0550cb57284658411af7f38fab795debe42429cf1d6a1d12480d8ebf19a8cd29f501bff3aa053c6b93a3bfd1d089283fdd0c2fef20cff29fd43430b11eb9d8edb412bba4f9562538b988ca1626b46fce67729f16c8d3b7dea6d3eaa942cb9bed81236a9bb272f285ad2ae9faf0d59224c45b08dea633d879ade132058f409f5b88ae961e704163d3e409b8a661d08a583897d27ed0da26893291e843302b4e4a556840017139d0b74b89b78258fa1d51e73d4b7cb390eef717f527bf03e8e435004560477981fb7ae39557c455af1a43f0c9d1022ac80cf27cef790d4bc72f981f4cdf1da896eb79e3d9fa8cff6404e38b270dc761f7ae43aae3e128eb5b59956f84fc19453baee21eeda3afc63f9e2c194d4b7fc56f52a99641dad332901be0f257910865a854e3d80272fbc87299d4b247de1b103d5af3b4aa25b87d0cb7b0fbe094171e489b78a8e1eeeacea861a8b7df08af6a7f44504d8e5334fd0ca8a60d6e6030dde961176a507ee352a33faab86ba2cb7e7f2e51dde49db1927aeeac7b04af"; - cipherText = "8916340006f92e1e104d89abd04da59c4c678325a0a9cad495e29ea05b6e8c2c99ce375f711c476cf9a33799530529f71ac623b56c1817b7e1a6f079f96f2cb96b67cba13f419f022b0c28e249cc2381df9f7a7fbad0a0ecc3f8582ff764b6c84e22c68ed8ae5dafdd8a60270ac93d6cb0ebc59da8db5908dc3b0e2899614c72ef104a00af23c921819534ada6e88da82f16490f30fca205f8ed1a3cdd460c3f3be8578b43f81d2168da8585b6c0a921f8154b7de88c88de087a278df38c527496c44f3ca7e21857a211aa0d6f9e2adb330ff239c4bcbd28775b158a941512a5331fc250958802c3b63f9b8238461e4c5e588aa8f17e422436c49da2cd5a519b5ddfeef4f21a87e0c4122c41bc579bc4a47ec4cf1e36e567d90924a0862bd753ff96911b1833c7253c39ff1cc156ed198a9c9c72016cba662f374a8da9667145cb12d57ee3271935d68b8c8bc788c9c27d545e101f6a68bcbf1a13bdce7feabf93c3170b267bc36e3cecf41acb22ec724e8893963de91c7bc56cc3e6d9be6ff58bf1f6de1b64a4bab87aa04b1e470fcb62cd17bc3b031a8f94cd064af6578b21aa37094f14ae7aa969c04a1c615f027236c91525ac1cb2eabc10ff9d72c2cd1fbfa2a4591ea83c7186bc0989c5ac13cdea37a6cf54084bac23fe52c1bc06b1a3308a5e91ad4da4fa3977ffaac3ce89da3dc3fe45df931127f30e471c3df3400f"; - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - - direction = DECRYPT; - - - caseNumber = 1; - dataLen = 128; - combinedKey = "2956cdf0462756d862b23d51d3409863adbc407ebc22cf098afad0fb578dbb08"; - iv = "620bb87ca0fd9492449bcd1ae257c2bf"; - cipherText = "ea6576bb37da365869ee51e56ed36813"; - plainText = "de3763aa76975d42c4939e737990fa7f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 2; - dataLen = 128; - combinedKey = "5e798fd9feeb8d966c4b59af575f669f785550c420f3b64a966824a7fce03f19"; - iv = "f6e2c65c2c1948d4d453c42d771c0985"; - cipherText = "c2846568de1ac62d42b7e2dc62fcabed"; - plainText = "8a255bd42d6604c16857a112a3f72dc7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 3; - dataLen = 128; - combinedKey = "14c836483a702e0021b9b9fc3febc27fe4fed2ff583934ad52a2872496e31e7b"; - iv = "db3ab77dffb2b93ba39750617378abfd"; - cipherText = "e6cd9433adae7c1cec59243526d558b7"; - plainText = "52ceacbe7c2c293ce5bf8e1fcf512d98"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 4; - dataLen = 128; - combinedKey = "c71fb2206a68a864f89a193feecf38ff9c76dc5fc6429a76681857cf65065247"; - iv = "7f8d21c36bf7ddd4049d7fda55906429"; - cipherText = "a338e0355098d6f4f9772142ee42f826"; - plainText = "247bab3951a51a5bd250e8c22c8614d3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 5; - dataLen = 128; - combinedKey = "c9037fe68164ce9f15fda4cfa9a9e7888d1c4817aa95c585043059cc932c1c4c"; - iv = "11b47506b1a4b8720115c9dcbbdba6ad"; - cipherText = "645e5dbe1fc1110ec667bd332ec847f6"; - plainText = "04d6f26ca30d9909d509396593cb0e8c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 6; - dataLen = 128; - combinedKey = "561884bf8936130ff3fff00eeae9d98fa01b1dabf529cb6c5872680e02315b86"; - iv = "7799bd66a61f5005ded41433add5011c"; - cipherText = "505ce7eeb143bf20131a480902a7c48a"; - plainText = "f5b7f15d73a3673ccd56c8ec1182b4ec"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 7; - dataLen = 128; - combinedKey = "d5f5a3893fcb87aaa54cf39f489963b0dabd2a158ca638a285e9284c19b2eb39"; - iv = "07e238828f0f75a1b41a1ccea9c8e049"; - cipherText = "11267e9a1739bed275913bab18e19463"; - plainText = "ab50c5869ebd40d8caf9c67a44238c99"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 8; - dataLen = 128; - combinedKey = "04ff37b093532fae21568d5e79f3c5da3bb9d6394ce7234ff9f215804ef14433"; - iv = "61618f6432c2259c1a781b5507280a92"; - cipherText = "6487e98598160f2ff50211a6314180f6"; - plainText = "4a012e9ce702431e4b0a7159f2760a9c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 9; - dataLen = 128; - combinedKey = "d8cb9506f97d2477a43984bbedc3a1ccb800b50f90e3c8bc6ee5b5f48daef522"; - iv = "65b6dd81fefe802119ad3ae5fc46a8a8"; - cipherText = "98444a4376196634c608b9515bb50eb7"; - plainText = "f02b0ddfd5178af6f905a65f81b8fd2a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 10; - dataLen = 128; - combinedKey = "6f9be68a5c84a70c60676cb6ed1d727fb87bc56596d31f1c1d04e6562a99162f"; - iv = "514d1309af897a30981d535c59f19e86"; - cipherText = "71148f3cc190d3f88864f5bc66736f7a"; - plainText = "743d0a05de8e8f0128f3def81cba8223"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 11; - dataLen = 128; - combinedKey = "f836901cc2fa7f67bfe8024c70f76a19680ddd2d9a122980b6c3822c32683dc6"; - iv = "a239202a2b4c42f464b470307eea712e"; - cipherText = "09ac07c0396ef394d7fd50eb13e1a147"; - plainText = "9f75c38a5b80b0d3c109a6c6fd343c3a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 12; - dataLen = 128; - combinedKey = "8bb5a71f8229e7277dbf3d59991b322988a70b9522bcf1722c29cf9da8363e1f"; - iv = "5aaef8905fbf5cc5bbc69664199c16b1"; - cipherText = "6b26927456e3e86b6747bcf04938a009"; - plainText = "8c89f6658fa2f0421763448023336870"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 13; - dataLen = 128; - combinedKey = "b7d493a31b8ed2d1bdd1943b009ae0992cb651a0254d2a74b1d6ba5ac08c332c"; - iv = "87d592932d30b8cf6f7ac67ca8b64929"; - cipherText = "384d5ef525aeee4ef7cee3833983c1a7"; - plainText = "c4755dbc8d510e5e1ab28772989d7223"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 14; - dataLen = 128; - combinedKey = "e857fde665a852be26f3e289132ce8ee5043254457c79f3db936850d72ad05f4"; - iv = "2c6afbbd7f8b56e6417cd7d5f68267d8"; - cipherText = "6e51e19e18b7bd0a8de0ee8c403135fc"; - plainText = "be907f21c216afd5e141038d935a5769"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 15; - dataLen = 128; - combinedKey = "80e5d75aa943f3a3207d10f5609e04e4e5e9732243371347a6f32fbb19fd94df"; - iv = "76bc2071b9c4518969bc84b2166ed5d7"; - cipherText = "d9ffa12e760ab28fba465936ab7dcfac"; - plainText = "4a5dc4d392fc5f1c45da75111fa77356"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 16; - dataLen = 128; - combinedKey = "fac9adaab6738bdc35eeac0493c4453ed22ff6f1dcea8c3cd4292e348d593042"; - iv = "63d891d68eb770a4e76f8368ec4deb91"; - cipherText = "1991a626b9e7daca316a56b26f82ea6f"; - plainText = "7ef299921fb634187ba7e0bbaf0c3ecd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 17; - dataLen = 128; - combinedKey = "59455366f996dd5750dec459f6183f4076d42c75682a7be55d1667b3bcf4b1e9"; - iv = "e2c19ee90091539a5c05532a57a91dab"; - cipherText = "d015ca69d2a24f72b75454738aaaf194"; - plainText = "2ff9a412338f4a7ca09a25f7ba905cb9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 18; - dataLen = 128; - combinedKey = "b32fa9b7a9282dfb7362f49b0091a8cb14cba26de8e09da96d3b090a39294c19"; - iv = "9868a1ead61792170833dfc66e110a37"; - cipherText = "9c48e9d632e9d3e1055de1f14ce119ef"; - plainText = "44903d058e0555c57f51f4beea200488"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 19; - dataLen = 128; - combinedKey = "556c2d36b4b09159d27089c8407040fe0197b9406b1bfef5d7241605b7c3ac9b"; - iv = "5a7c22b6caae54b23b68f8e9ef812eb1"; - cipherText = "3fc5c84d9ee78b762d41e037941abe76"; - plainText = "13906254cd4b7258209e185c45e022b2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 20; - dataLen = 128; - combinedKey = "47812e2e6f0ca9494a3c67fee4419fddabf4bc5dbddfc1250e64de0b1c224fa9"; - iv = "7b5fcec712eed0e65235b0b277ba69a4"; - cipherText = "8cb6965a87fe768c9c576fa6900220fe"; - plainText = "b865188771a1af5343468fbf3996fa2c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 21; - dataLen = 128; - combinedKey = "ed27ce42e7d3b6ceabb79a61642c6f3ff6a5a0d9a7498b085ebca3c88bb2fcdd"; - iv = "a623df0a4bc4eaf432754be760c6f761"; - cipherText = "f4f5b99a1af97497fcd6005941c52367"; - plainText = "7cecb88a37f3194fe206a9a3864dc1e7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 22; - dataLen = 128; - combinedKey = "7baf9bc3003826eb48f5ac711db1a2972c85ab868e64a7153b0330fc3154f6d4"; - iv = "89c6c6a2c57c884d9be6fe61d2d9e2a3"; - cipherText = "d6f889384f5f4d5077f5e9f75bd87355"; - plainText = "1e4410d5ea4200fd829b6e2cc306d0f3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 23; - dataLen = 128; - combinedKey = "04bedbdf82a56b090dcc5ee0035b10280bbb4fb05b19ce155a672907bdbaef39"; - iv = "6948ed770623580a4a09bb91c0cb549d"; - cipherText = "cf90f8b964a9edd2499926eab01f62dc"; - plainText = "ba5e20d4b8186712a199c80a1cc03947"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 24; - dataLen = 128; - combinedKey = "f9fd881be853868bc3d64f7a2dd7b221f00fd28e05f16d7acbdc63775fca4294"; - iv = "e3166e983a84e4583d04f7293ce217a1"; - cipherText = "20a9e3d83ae0f3c756594c8cb62164cd"; - plainText = "92a113b0a0b6577e2452d9b1f17d5eea"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 25; - dataLen = 128; - combinedKey = "8b1a7aefcef62a0a3449ceee135e9e2b080bfd0d69736ebe0da174556f821327"; - iv = "67508cc9dd8c1be7a64bde16b5935e5b"; - cipherText = "39130ed8621df9ca75d71524de39dea6"; - plainText = "ab4130ccf9b2ca4e9621c62b4e7c7018"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 26; - dataLen = 128; - combinedKey = "9e2a82903c27f9f6a0cb632fc2045fc49714832d9e16d233ee93382f3e02cdd1"; - iv = "69ac854fbba71f45a6602fc17197d826"; - cipherText = "9ca914a7424584fa5b6e05b26e2e8210"; - plainText = "a683c151f0eafd7aa4428cd86523c769"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 27; - dataLen = 128; - combinedKey = "31b2541a96cc6f1eeeeb1f6c115b6b55289a2581009b46b51c65c017d311377a"; - iv = "4dd6aac74805bcd9af69a11e84c99286"; - cipherText = "f397ecb15f511a0cb1254bc9af9549c2"; - plainText = "f0e180a0ff2eb8d18e65f3aad8a719b4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 28; - dataLen = 128; - combinedKey = "a04a8c93aa9599f272189707f1d4231e90f4100d8be39d66126e99b2a83bd9fd"; - iv = "db6c9268806d81243275fc965345851c"; - cipherText = "253f6d8ac3fce38050b37eba58ea948f"; - plainText = "5c5516e8d961b6a91023432c2363c504"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 29; - dataLen = 128; - combinedKey = "d3a954d1164472694953119419ad8d2102e2672f10831bb621de2fc3cd84ea20"; - iv = "ac61ca687ccadc9b7348a28a77b00a7c"; - cipherText = "a701350309cb70b971875ab9e4a60c18"; - plainText = "468595370e3c9a618019cd7ff17b154c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 30; - dataLen = 128; - combinedKey = "d444fb69b112ba9a9e6d73b1ded897434a83c2e9a1b21212007caaccf6b9dab7"; - iv = "fd8ceb7e850e53cce56a5d54fd752072"; - cipherText = "12045d797fc4a9ea222a416788b95f1c"; - plainText = "a88574b9777fe2bafd7743bac1a63131"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 31; - dataLen = 128; - combinedKey = "0b10f339a6758a535d201790799a16a9b889982ca25b4ac374d32f6799b9b927"; - iv = "f26d4b1cf2dfe1dab4bb76f059cb9459"; - cipherText = "d2b6939eea068f9ac1d37cea0265010f"; - plainText = "2997d4cf33035912caa2f7207a1cff74"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 32; - dataLen = 128; - combinedKey = "d0f3de5da1b72c6a5c1bfd47a94545d26f6b7ddc1d0fbd55bdadc5f9bd57bc43"; - iv = "ed90a9a88118f6bca8b25293143a77c2"; - cipherText = "427c68bb9cc6c20d4df50c3e1058a119"; - plainText = "b4d34be466d105436ba3d499e4dd874e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 33; - dataLen = 128; - combinedKey = "be34815a0d7bc117196c4f6e16d326494b19a2d2fd6e429323ec6f3e57216df7"; - iv = "27b23069c37659fffef9547939786ad1"; - cipherText = "c2f42d16998a97544acafcaafc0f86fd"; - plainText = "87cce6d9697f313c6add9507d0b08fd6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 34; - dataLen = 128; - combinedKey = "72da47dc206a1a04a2b5436fa05125dd625fbd78d2ffa2302eab5a78dd68cb8f"; - iv = "f2f41b9c98b0275474d24fde3cf16c17"; - cipherText = "1f58e5ac56f1606bc5c57bdb4c794367"; - plainText = "baa2da605e654fdaa6c1ea2e84ca1e28"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 35; - dataLen = 128; - combinedKey = "dade39568a19ea35d04e9685f4ef9dace551a580a26b0860dac6362bc1e20173"; - iv = "83934598b495cd7e8500120eb36842af"; - cipherText = "e74f00aa88700d072b294f46b51b55f7"; - plainText = "27dc95c41b52b62b60ae7f3ad9837f83"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 36; - dataLen = 128; - combinedKey = "289816605259e4d2043371f23595d41144c2e2bec5ff0d6e8a8d2bf7af47d077"; - iv = "f053091671fd0cb0d48a24901750362a"; - cipherText = "94a997aa94e70be9df27f9875ab7d55b"; - plainText = "be4f3a78c0387e0f7f7224cff5cac586"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 37; - dataLen = 128; - combinedKey = "3f5aee18e3d6f0281e3fe764feded959fff36716cec2fded1b49d5df7bd8507c"; - iv = "c13b63afd05a38f115d7d47dadfe8c58"; - cipherText = "f3d2a90bd5fc57085db4dfa1b894864c"; - plainText = "caed6f84bfff99752d58dc8240b13c94"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 38; - dataLen = 128; - combinedKey = "779c5c8cac314094b995ab434b1697516cac6c99afca05960a1a113fac813a34"; - iv = "f1ec2c192062f8358ea12eddb462505a"; - cipherText = "571e19a430f61c10d4f9fd2810761b94"; - plainText = "17b9ff76bb867bdf494211f8da770f15"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 39; - dataLen = 128; - combinedKey = "cd8f02aaf09be512727fa9848f1df760ebabe2667761b15cb440d7cb9b6c0961"; - iv = "5dd62d0468661796579dcc393dd108a8"; - cipherText = "a1e62d431589251ebd339b17e2dfed53"; - plainText = "82f7e2aac689cd7d3e3ca73a8cd089cb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 40; - dataLen = 128; - combinedKey = "3090b6c74698bf121a7b676a0b061cfdd0412baa65c05d9a4330c6cde9d76ac7"; - iv = "19021c7b4a50b3efcbd502782fef9273"; - cipherText = "64b1aa32880b410fe5e0b200b5d9ae7f"; - plainText = "718aefc5e91526ba338583db2a8fcece"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 41; - dataLen = 128; - combinedKey = "47bc92da0b28c128011f3b92d1931dbf3e6daeab86339596c894341f3a3ab59d"; - iv = "1a35e0dc5bc48dce4794dd2bc37f4973"; - cipherText = "0c17341c1917b813d80f4282fb31ef57"; - plainText = "7b33fa14b69f901fdc7399f6f006e499"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 42; - dataLen = 128; - combinedKey = "a539e990e11adcd6a21c5dd08eacc899208f855c023e29087c9a0d66d034915c"; - iv = "2d7bf84219b24f30c7dc665948d086d8"; - cipherText = "4d5bdf2a20587a087655b56f69eef502"; - plainText = "428e4201021db0991365d59b0bd048ec"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 43; - dataLen = 128; - combinedKey = "f95c129c224f4b0943763450e085e25037d1d706d15a1b93a75e820521df1306"; - iv = "5f2d2d1474795ae9f2a47fd239444240"; - cipherText = "24937e2d550fbcd4bef70c8721424e72"; - plainText = "01a035c9299b00a9e66d4c0914023393"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 44; - dataLen = 128; - combinedKey = "e9ce4f5f7be9473acf6928b87446dad667ccfbcd02ece4e5d7b20a0be834eea0"; - iv = "777902b66f7955428b7bbc882c3fe8a4"; - cipherText = "f31dde00b2d6ba4bf6d12f756faa5766"; - plainText = "db8c3a584606c5d33fdfb024c42c591e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 45; - dataLen = 128; - combinedKey = "422f0f3f92d667b7802e75c7786ae146d11c48f28d3507d40eafac00229f0522"; - iv = "16f75851e1d97b08345c60a9e086f8a6"; - cipherText = "0214c3ef8c1fd34df5823170b8c67d4f"; - plainText = "73a008fe65b5dd987f92dda68a7082fb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 46; - dataLen = 128; - combinedKey = "695d8a51cda1c5e71810defd629ddee6988fb60a702b808f21a0cfd8de4e2f71"; - iv = "c2748733475330c17cba921e4d81bc7d"; - cipherText = "23a13d752d416acbb175754c2b502f55"; - plainText = "2d2e1debfb430f10d08e94db522f5246"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 47; - dataLen = 128; - combinedKey = "7ad714e4f803ed8d69b0397bba36b2707ba5a025d8363140005a82e36ab5cdb5"; - iv = "7688bcd40307d017f440ba5118634eb2"; - cipherText = "e974900db1d2247f0fed1694739ac366"; - plainText = "52e66dbfab56e558da5a6a1adc117a6b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 48; - dataLen = 128; - combinedKey = "39cb565cefac3b5f27fe7dfe36555b85c348818d4aeae44645da14a0b9778320"; - iv = "dc96aae9a600c879ed0a5f4aa831cffe"; - cipherText = "088f88ee94479fd4b40c4171b6f39b87"; - plainText = "e08679e2d371712bc61a68d7ea1651b2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 49; - dataLen = 128; - combinedKey = "a4ccbfe4398ea36e218c5a04d7312c1cb5b8757932294c32ebb7f3c524adec04"; - iv = "699d2f5540b6c4693de9dd60d6839954"; - cipherText = "a6510aeeead61d4106f88b8645ea01db"; - plainText = "0828b712b1bfd1e3cda1a6427ac57282"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 50; - dataLen = 128; - combinedKey = "b2ff2a8dd76bb9e3f85ec9ce15379ece613b7b380141a7983b702117db0a9ee7"; - iv = "66ecc01f4ab114a77b63f974f2e218ac"; - cipherText = "1cb867c7e3df68e51e10ace08dae8bd0"; - plainText = "a1b57bd3f6559943b77fd5e04b83aa73"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 51; - dataLen = 128; - combinedKey = "07407688b0894fbb57e4f6133a0f544413db23944ede511e0c5ffea3c6264b03"; - iv = "abb64e0f1f392d639e2a7e9843a67043"; - cipherText = "aa6f7add7479a6638f5a0b412ddac2dc"; - plainText = "b4afda7933c65d44993a4a8bc6b889e2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 52; - dataLen = 128; - combinedKey = "ad1f6d7e6667066ccf32f74a2317c46d9f2b94baf71c7de999be843f43e76003"; - iv = "bf747d6f35d84770dffb6df105b084da"; - cipherText = "62137aa82029ab13505720b2ca712cb3"; - plainText = "5eef540cb1067c83dedc934d2bfe9668"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 53; - dataLen = 128; - combinedKey = "ce50527e35a9feddc4d202f95a1f800df18e13121a0fa4eaa921ad0f0032c875"; - iv = "83c33d56003726902c58dff4c579bb47"; - cipherText = "1967a1bd9fa4811792ab782e79807cf6"; - plainText = "403617d9bb3029dfa6fb924f28ead722"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 54; - dataLen = 128; - combinedKey = "78d0f928fa4061248eb473bdd1b5810246e3146ca638a06fde9ccf5c1cf3025b"; - iv = "c0b29cd87d346dbcecb0b83dd90449d0"; - cipherText = "5f985799a7f831cd180cd56be997f9eb"; - plainText = "f9702364be8da2238b02ce3abb595360"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 55; - dataLen = 128; - combinedKey = "a2b649ac8df362d187584107fd8ad6fd5dc54a2e7675e2de717be9ab70db8bc7"; - iv = "8eb5ce9536e9f3d547a35f7932a881b0"; - cipherText = "8b9204d9be5a04d38266eed278942935"; - plainText = "d351901195097b5e35bca09fed5ff666"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 56; - dataLen = 128; - combinedKey = "f5f7a89f8b5b6b3f7b85917dca85b248680d0b5a5cfcf1693105f621feb9d990"; - iv = "83e98330f2fd59a2f76948f7f09436f0"; - cipherText = "a6e46c331b751ceacbefafd5341e4a37"; - plainText = "ec67cff4031f2b8f91df44bd09898146"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 57; - dataLen = 128; - combinedKey = "b39e95b92f75f516428c9b0618d03725db69cae30ad7f43c98f7f9b334e8d4ce"; - iv = "1e47843de1d435b1fa7da097c574e41d"; - cipherText = "c9b7f91b723a451fbaa7af189a692904"; - plainText = "483fe6f6d82b55b0574c61308dd91627"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 58; - dataLen = 128; - combinedKey = "ccf2c4ab1753af90fc4c0b49efbd909eb00435f976d91ea9e8c9cc41ecb7c95d"; - iv = "cc864630724c9ea53fd8fd21e32e4045"; - cipherText = "5b3701b42f9f5c37a66b34c731bb0f13"; - plainText = "2599a9f13f429859dd415e04bbdb2e47"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 59; - dataLen = 128; - combinedKey = "ac3c8c186e914bf426ae3f3ddd4d425528aaf7deef57d382b05a5e37e334d901"; - iv = "78df6bcfdab6c169b7f3bca73c43bbdb"; - cipherText = "72c352a3060610bc884e2ea8a69d6162"; - plainText = "930ff6420ce6031df8d9e9043cbafe6f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 60; - dataLen = 128; - combinedKey = "9fe3d5b57ca90b2b209d215e44c677047ed02663e90aaf0a1026db3dd3c16f78"; - iv = "d92eacd547bbd808704d67e47fe2204c"; - cipherText = "e56562ecc68b0ab98581186eb51fb77d"; - plainText = "486cdf22464cd58f34e9d24f36032244"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 61; - dataLen = 128; - combinedKey = "116093256eaffddf72e92d1293fbb5390f58d02053186a4f23761dfe7fd01d7d"; - iv = "e0609c4fa1b035eb69abec0bd822c045"; - cipherText = "810d9b7e8dfbf48ca8eb2a87eaa6fb89"; - plainText = "4e155f4e0deca493224c144821d4b878"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 62; - dataLen = 128; - combinedKey = "15d890b1e263ddf514e211668f950d0035f02b4e0185579990e262f7fffa52e6"; - iv = "19ccde1d36e8b1ff92269e1df0a99496"; - cipherText = "1f80e1a6fb096632451a2ad0f2acc375"; - plainText = "37296689686ea00e5b9db21ec4e6dc93"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 63; - dataLen = 128; - combinedKey = "18b823984c34f6d5d472b6bd0b095890ae748e76228c2d702d53153927baa483"; - iv = "729790be1437e8d7ca9f71c93eb02092"; - cipherText = "65da064759d7b0cd102a2f36989d09e7"; - plainText = "50454afb87eb96488165a4bbd571d6d7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 64; - dataLen = 128; - combinedKey = "95db57d4bf1af7d635063ba2c456f6fcfea5400472cafedd49f0af506e41fdfc"; - iv = "26edc9a8eae428362c2f18b52673714b"; - cipherText = "cce884e6490c57da20cef7e7a1bd5a7e"; - plainText = "3dd067a8c4ada2f824cd2c9dfa6e67d0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 65; - dataLen = 128; - combinedKey = "4af83a212d52b39ff2db5286e4432a7a3bf71a980cf56baa0389db28695e3b16"; - iv = "72e493e04e77577d0ee398db761916d3"; - cipherText = "9e09f65d8ec358e8a8b75e255cf62d49"; - plainText = "8a001d33994022a0a8e4290153633ca6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 66; - dataLen = 128; - combinedKey = "8a810bf2bfa8d5070b3bc19a447422c0ef5a0ef2e27a77738465c6a5fae988ec"; - iv = "6dccf50f9dc807f12b7da0f2c43bbe8c"; - cipherText = "643cf9de685dff5d92296b91bc396cf3"; - plainText = "54777fb0b1dc7b12cda63b06d784d951"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 67; - dataLen = 128; - combinedKey = "b376761bc422a2ec3f106df07f1b007453cfc5258b07e3942bd618572a1bc42b"; - iv = "5c9ce9c0a9e0a54c9ec930001c52556e"; - cipherText = "363d29ce2e61aaa4077ab74b41cd71a7"; - plainText = "62f2207c8049ee99393490d7350b729d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 68; - dataLen = 128; - combinedKey = "ab3a5e94df11a7fe65a50a414514a8614030016cdaff7961f10daa03222fd75a"; - iv = "1b42dd979adaa545898eb00f196bbbe5"; - cipherText = "a74ba43bbb4a052f5eba62f11617d8bd"; - plainText = "340b6331be6238aeb5c092447859102f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 69; - dataLen = 128; - combinedKey = "edc7c4169a190cda3187e99ec9e913946ce7782ff550c564d28149e6da9940d5"; - iv = "4897bd8eeaf6f62f0b46361f6aabcc60"; - cipherText = "530a0da670fced3341b78b76f3373fc1"; - plainText = "31e68f28fb2d2f43c7a733f89a17a490"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 70; - dataLen = 128; - combinedKey = "90455661fda6d7164251c372962e4148affac9ba7076ce3777d0b0d542f81a51"; - iv = "1e18f988165866cbb9814d4eab56079d"; - cipherText = "e75584cd94375bd934bce3887c174946"; - plainText = "8df1052cb864fab3b3f55376a459628e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 71; - dataLen = 128; - combinedKey = "f0cce74b29bfa4a532ea78da2f70783a602c5af58ec3bd5eb4a4bbe155a6e57d"; - iv = "f2de5a37308f7b3c07e5f3e8237fb023"; - cipherText = "98c96ef0c3dc73ee0aaf8e7ffbbe7188"; - plainText = "87064feb9e2b4e949e89ad8ccd778862"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 72; - dataLen = 128; - combinedKey = "ed5985d52b5297c38d81e85b961a14b6eeecdc1340430bdb84735ca802ba5537"; - iv = "a104457b56cd7daa5389a0a37095c83c"; - cipherText = "9e8b72cefab7018100dda4bffc589dc5"; - plainText = "63230be7295776a99d592bb8f252f798"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 73; - dataLen = 128; - combinedKey = "bdcd0f9f187b43e5c59c501dadb6e2adac96707f40c926c0fbcc43742efc9cfd"; - iv = "8e908b9744b936d8078a3d50363c418b"; - cipherText = "bd3f5fc86276eef45f93fe1464de401f"; - plainText = "9f908501d677ae4b4ca591fb90d4411f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 74; - dataLen = 128; - combinedKey = "5239ce8c50df13b7ef0d8aae48703d014e2aa34258b7c9815af4dc8e57b2f6f7"; - iv = "64657a3c769175edb20cef05b3dc8260"; - cipherText = "88f0712d95f814ea843af958dfbc10ce"; - plainText = "e52e1be04b55d503f1f50cbc9ee364d7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 75; - dataLen = 128; - combinedKey = "c5a5e35a745ab49f3dbe31d95959e23d580a98c487b0f643c03b626598fcbc33"; - iv = "00827f90054938a80059e94c7dba693d"; - cipherText = "7f82603b8ad9fe898e97be65d8de2e97"; - plainText = "3fec7027ee8314d9fb387a5b0eaa684b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 76; - dataLen = 128; - combinedKey = "60ce7d7e1239b107a2d3b09c1ecae96215f515fddb2179e6d73fa9a6d61d8978"; - iv = "f5f5198c95711cd40dff00ce2d3dff0f"; - cipherText = "936bc3a8f638cf427e99dba3b3089898"; - plainText = "50518b3c78731ae3ece9a4b67a9fc13c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 77; - dataLen = 128; - combinedKey = "8bef72e621e79d8e3b476b2ac45b28ebb1516c1177e24317794f546205f629f7"; - iv = "520b4ee6e6dddaf48ec9ca274aa3a72d"; - cipherText = "c68d2d7413c2edbacd89290ccd48ffd3"; - plainText = "e29cf1e2de3bed6ccb267e02706e1d64"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 78; - dataLen = 128; - combinedKey = "707e80e2145b13a6d322c65201c511f3018567ad4bb7d0ca5e368923cb54db92"; - iv = "a7cfba407b0f4a58361f8987c0fec237"; - cipherText = "09730b060a73fef90d512ceaaa3e186d"; - plainText = "3f6a6ebc9fcfd3dd69d20e8faa433cb4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 79; - dataLen = 128; - combinedKey = "d5d18fa371ed56b0f9159274f6de72d2304b550305bd64cdcb2db85d0d3aa5a0"; - iv = "5c7d3b88016978254dcfd967d8c16bc2"; - cipherText = "68d968da85777cb9914594a221611e1f"; - plainText = "d4886867469d8c3e9f66f72495176da8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 80; - dataLen = 128; - combinedKey = "926295685037b1f7fa47013e041cc98feff8dbfa63f18c8c3a49c8ffe4ce5735"; - iv = "491ed094ca27d0b4f70754d4c10cb0c4"; - cipherText = "e6b1825c11694572b271f3c01b2a4812"; - plainText = "db6b092ad9b23463d8686c9342903b86"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 81; - dataLen = 128; - combinedKey = "ee3f40783897dddaddb5b5ebcc184069e38604cec88e0cc613c8724765c0d366"; - iv = "40b7e4ec3bc0f36523049aff9f58dd05"; - cipherText = "9b7b2a66cb40ded274c6c398efa577bb"; - plainText = "0e6507d5590b378993a448afbf6849b7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 82; - dataLen = 128; - combinedKey = "837cbdaace81c355ce81d957886d301a5425c1ec7df0da9606f489b3ee532857"; - iv = "0801ef7c707b6312502c4b0d8e6e1c48"; - cipherText = "a0bf81af49dc31adadebe60086f2117e"; - plainText = "64dae7510603bdd1059d35315984b5e6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 83; - dataLen = 128; - combinedKey = "9ab889c05e97c6c15c332714f3bfe000cbb8c7f999e0e6311f68cf337af67575"; - iv = "03d1df6a0baf35303cc9599b7d2535f2"; - cipherText = "bc229b99714591d609cc525ba5efc6f6"; - plainText = "21229ac8367b9e10f202ad155c0f24bd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 84; - dataLen = 128; - combinedKey = "17ef2b398f989c88972f0011c8ef105be025d9e0a07051bb0fcd985a6f12eec5"; - iv = "8320c6b025e661fcafe4b96142890919"; - cipherText = "6fd9b1486b6bfd3d7a56e046472aa548"; - plainText = "53f4960234ac1aee807f893ed142147b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 85; - dataLen = 128; - combinedKey = "ce74653c9d99c3d7d8c9a25a4a1b2ad1412de15d318ff7030115b7c242b92b87"; - iv = "b9d7f96d12fa429387f709d5cbefa3f5"; - cipherText = "23d5cd9fd34b9a2f1f04d04f5907e804"; - plainText = "0b7c6e9019521f72896678e7f503bbde"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 86; - dataLen = 128; - combinedKey = "9393e8126bf9a9f4a20d3f6d891d0492cc46a7882ea256ed7d2257493ed24306"; - iv = "38f3ac5a5af67a6dde0555bed2157225"; - cipherText = "056762073f5f62cd076b58d6a62bab63"; - plainText = "d015790a0daffceaf0e974f0f5c7d1fa"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 87; - dataLen = 128; - combinedKey = "a6b4d5b49976712b9cf5b9f3aa85263686e5d0f310ec7cc0b62faee6f5dc08f6"; - iv = "5d509f6817b3b0b420435a40441362ac"; - cipherText = "845a86b65591e0593903e3054ffb5eeb"; - plainText = "d7660e8c0a9f0f6a8346de8a1b73cb3c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 88; - dataLen = 128; - combinedKey = "f5a57b827619af7397227c3c5e266a389cab4fe7d7970bec095fe7a1b5bb3676"; - iv = "53e15b956f9e0ad1512475d819107ea6"; - cipherText = "2ad312a2db73ddf91501c20f6b86d94c"; - plainText = "4e407432e306e7b4b53a02fa37446fca"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 89; - dataLen = 128; - combinedKey = "8e4b66096ad03e9b5e17b65822011e002add4fc8de1031ea48dd68f6ee7e6f7f"; - iv = "9c8bdb6510d8feb5a7046b64a21a481e"; - cipherText = "c1708a8d0c18d7dd94a54c6a71cccff0"; - plainText = "3a74e62643e95255895e76c505691e0f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 90; - dataLen = 128; - combinedKey = "4e13a3de74f41874e7beddddc4f6339c8b204145fa9edc1e7d639686e9cd1218"; - iv = "a3cc068402b003dfee82f658d6f49399"; - cipherText = "810b6b690e23649f6ca8095bd2eeef4a"; - plainText = "5b67176d29120c61ae3c2ccfb682b02c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 91; - dataLen = 128; - combinedKey = "b7b719d5b12562b67d36f9b45de3c0eba05f674997db3a0af036613567a0e93d"; - iv = "9ea4040c1d0a1f4ff921d2cf3b5e8d4b"; - cipherText = "878e1331d9724322fa2980ba3fa1a706"; - plainText = "eec4333c9ef031c472fd9a74c0517ab4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 92; - dataLen = 128; - combinedKey = "c9f3f1c116698fdfe66eb867595d42b870b86454e9e5c514f47ba5e235d12cd8"; - iv = "ea80f2a55b3c289f2e730f1212515bfb"; - cipherText = "41919d26f63fd1d9e5ad44510b2affe9"; - plainText = "e1e7c54f748398d9a7070bf3b2f6a585"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 93; - dataLen = 128; - combinedKey = "be91758b90f19f1298430be8b1c8e7d87332469d8d94192e048d8da08931ce3a"; - iv = "8a3d0af9e42028fe45d8c22787d5a5f7"; - cipherText = "46507cb9d0bb90848335d10596269499"; - plainText = "133cf57142dc3d028111c4e19f2a8225"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 94; - dataLen = 128; - combinedKey = "c07d46ce9837c87f4a5c35a2585ed442d4092b4699736ee6e7eeb88f254ad381"; - iv = "774efc622f14f35fe6a14df73316f08c"; - cipherText = "909003d635a0800d3b18803810aca297"; - plainText = "4d357b71dd64b4c8d945b929f42e436b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 95; - dataLen = 128; - combinedKey = "9635bbd2abb86916bea1f0e52569f4f486ee562b4061b6a4b88d411cca9dfe84"; - iv = "c3b7f447f4fe6181b69ef32879d6638e"; - cipherText = "1f647b4e5a9386551d699ba024a22bf3"; - plainText = "134dc27ccc4f0ad79bed414ec902da86"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 96; - dataLen = 128; - combinedKey = "f2fc215b303ce9f49121177349795f5723828275bcabfb845148df1209effde3"; - iv = "9caf2e2d64053cee1df320ac70760eb0"; - cipherText = "6538b24da02f1bcd027fe4e32a821090"; - plainText = "bc7bbd41ddf1c681e4fca176dc874e76"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 97; - dataLen = 128; - combinedKey = "c717d145577e5c96e590a80f6870d00d5fbf8e082bf4e038f6fadce224caad81"; - iv = "0e0d6fc827512f47ce0415037f20a1fb"; - cipherText = "9ee999759d25ed4760fa113be0f2008b"; - plainText = "9b43f6273d433e24a47c78584168ff1a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 98; - dataLen = 128; - combinedKey = "1aa4e0abfaa28b68e67dbfb18fdb0153fd87aac75af632188d096916649dc592"; - iv = "56edcdd4d7c62beac285ff2c5b446a0d"; - cipherText = "99f9c5cc9b2db0a4de8a2ac13b21036c"; - plainText = "ec7363f3e14e8850b847f0d28c6af927"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 99; - dataLen = 128; - combinedKey = "33cc9daa91b2dc6ad46b1e02cbbb8851cc9b258007ca92db95922867f72219a3"; - iv = "11bfdaca0731799f6d96bf5c78e9ae34"; - cipherText = "e557d62ed9d4c764e28149a1d2be3577"; - plainText = "f32db1266c7401021aa2b826fa285d57"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 100; - dataLen = 128; - combinedKey = "5c063de0125df906164602d5d3d937bfc9e01efdc93357759d2376813f883d27"; - iv = "d468c22012801dcdd7c6484262988667"; - cipherText = "2b02e10caa57c7b03701be85d72c24dc"; - plainText = "cfd1109c43f6b3f1b3cd227f33f9c94d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 101; - dataLen = 256; - combinedKey = "db882f33c5048b302e92287fead0818a8fb76be6a99b4167e76ade1ed40c1d45"; - iv = "3479c6234db9abb731f8a80bee2bc62c"; - cipherText = "6d15522b64d3b74dbcb331e7aeaed912e2e9b44deb40bda33e21dbf7e66f3e51"; - plainText = "672b8aa47270df3bdc0ad6440e5fef31a8d296f16c01436302cc2cb3b123ed3b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 102; - dataLen = 256; - combinedKey = "3629c6634388091cdd60236e7506e757087f29f7e81247b073f4903495a4d671"; - iv = "073ad8369554092426c7c23657f7d780"; - cipherText = "a70e4ff0dfe2ec64473c45e3b916a6354c9d22cfef7ef7adff846c204a099fa0"; - plainText = "cf479bd77e5dcc72f91e92d61ad7876b7da3128b5f92c3f6aa4fd05dd70699cb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 103; - dataLen = 256; - combinedKey = "cb67aea9706482be9796e277498dc06129728cce5848dc195f607a35087d74cd"; - iv = "c5db4b647d4be26b35e3eff875db02eb"; - cipherText = "943e9b8ddd3c5b853b84f5990d0a709eabd29a9696d3919528cbb63d33033cf9"; - plainText = "ddf9a4e41ce58acbd1f7b7cbd1829c20f2d4f53b5ccf61c36acdba19a9a7de6f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 104; - dataLen = 256; - combinedKey = "abd8d249b6b4342489e161b91d37900cbef30a2b18ca1099d8f5ff76e60b5d87"; - iv = "ca00c3e00bdd618cc7440b7baf77c41f"; - cipherText = "3edb5b1bcb28db01f63ac368e0b2441a13ccaeeedc1b9db8179efd5869ab2e07"; - plainText = "dd602caf80f6137d7e31e263c084a0b5a0ddac60d9e8f8d6272d2db8d04305b3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 105; - dataLen = 256; - combinedKey = "314a38ec7a1311569f8b85ce5d76cf60803d54cc45a3dd92c526f331ce3fe08a"; - iv = "699fbb4c46977d86aeb770daac261e0c"; - cipherText = "ba6b212cefd95f10ae11cf8d01411b200f50d2ff2a6ea1d3dcd2b0733aa1614d"; - plainText = "1e5c06cd7eca14f7849ccb27b0553d2fc9bb922e0af2f9aa4cd94ad8a6bac0fd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 106; - dataLen = 256; - combinedKey = "af4b176ea92a4f1a28a6ba2ce522a2285afbc18ab722b62d58b208bd5aff3c27"; - iv = "971e3f13f6f6530cbfea748311d23972"; - cipherText = "2184419611074babd53a6ba28833c2e2e6e75595218bf0d11245fbe79d3cd266"; - plainText = "092be7eb5537378df439addeb147f6f6ecb0166e9f0aa0b885c7d61efbd32cea"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 107; - dataLen = 256; - combinedKey = "27a8892e33dcab8c29ee1899343a474c5cf1a7c535a5db210c44363c99b9d417"; - iv = "5a8505c9aa586f82f14985338280a411"; - cipherText = "12fbc52bf47e679f0b0e2c58043f0e265b4cdd3ab2f3c0425ae4d9bf2534bcc9"; - plainText = "f74e985eb1279af18bcc577f18c37d2404c2676bc0060763ff7d4046eab3e1a3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 108; - dataLen = 256; - combinedKey = "32c5bea7c180a41d92226610d8ce196445e358affebd5a3606bd4740875b450f"; - iv = "24f65b889b20fdc48a84302f95423b1b"; - cipherText = "792c35ef9e41ea19cd495d9096f6b6f386ab4dc5a4bcd4d71e37757a5690c7c0"; - plainText = "89e694d966a217d3d8e7dc57dda1ba141124c417186c815b6ff79cbdf7582c71"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 109; - dataLen = 256; - combinedKey = "e0400fed086464f3062ac911f8f986532e7d7ce18f56ba75924a3e59cbc1738b"; - iv = "1af5c26fdc4c172c07d5d63e6a1d40ed"; - cipherText = "10c4a5f189d08d57e621fe12d28b45893833214cdb712421f9e09e2233abe6a6"; - plainText = "b2e6d5a0816ce6bf297eb200b6132e28de12382a9b6fa4efe373fea7edec6c34"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 110; - dataLen = 256; - combinedKey = "fe2cc783829bd7a4af7ab774a106230f4ce9db1c553580ea8ade8d7261e035d8"; - iv = "ae23cc467889745817fc1a13badb7377"; - cipherText = "a1f673c3976391208df5a074bbe9876a1eeac10800eb5e2980594810318416f9"; - plainText = "020f6103e868a52e9fac6c33d488eef4d0c8ae4a3c980a83f8b93dee79d6f7e8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 111; - dataLen = 256; - combinedKey = "1bf2e5a326b5e410e59743ae2cc15415ccc42353fe25a8542ee00457f1e36697"; - iv = "e4b535f80022a8cd732baa923210dd3f"; - cipherText = "cddc2b03eef6866e9dc0168bcbd3f5807c6cfbbf31a481e349f49245e307ae97"; - plainText = "4dc2335c609d9edcfd37c503b53c874a18f7f3879304e026dc5eaaba4e0ef108"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 112; - dataLen = 256; - combinedKey = "70b2b1c785b3ab029d77befc615702dbaf235d693e54f067475b8e759a0483ff"; - iv = "ce1a0788291ed60b6f8084948f0d1533"; - cipherText = "ae8329ef0ac3dd8045f0c93a4adcb11a5248aaf18e288c04245fad29aada11f7"; - plainText = "bffac2c1c4fccb6e809013b56b0c55425590329901c2c0a8731d22f4907d60d9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 113; - dataLen = 256; - combinedKey = "1f1b9159f4085e981879d7b3902a98584857eadec887b08b252a3a26a3f6c79a"; - iv = "86bba567c2c1be5d310f439fdb932a12"; - cipherText = "01abb5fd533e769a471ec3fe0ea34ad34d6e12923842e57a8d3344456b231430"; - plainText = "a4817421d0abf19adee445be95586e3c15deeeff7114aa3ad2136ad40e47b29f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 114; - dataLen = 256; - combinedKey = "c7da49edddd2b79757f04ed70e751b8ca96af2f60d0c85abaf49dc298f2092b6"; - iv = "c2c0554b5982b54b3d3ea872bf3ce0d1"; - cipherText = "f3a3ff8a227bc50ca0e5c7f47bb405a008392b32eee1acc310e677c2a7f44eba"; - plainText = "f6d478b350e3445911c21b329c24bc11760da32f27eb2d3f39df9ad7062f4940"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 115; - dataLen = 256; - combinedKey = "f72e936f1d768d48bd889f82dfa4305ceb3a08ad1e0e417875942f5bf3afb613"; - iv = "885e119374b14c67753650383088b263"; - cipherText = "dbd78c7a8fc60d3d692e3bbd8ca4dab72631530778528864e52c70f71704d0b7"; - plainText = "2a27a8639e4b312eb30c2ee06572307b31981188970f57b6c34294f9229d80ea"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 116; - dataLen = 256; - combinedKey = "28f2e8188e6bd6ad9770282e9433596d2beb6a64a543f9e1d07b257482a84519"; - iv = "0386008a4b89a58baa8f2aa39c9d2295"; - cipherText = "e4a44b86765bf0e283b4c20b3013b18f3d9ea60982c196d25a7505c7cb11a8e6"; - plainText = "634abdf141f7b33e9b941fd50a6e4844c93f7d2b2b8c09e6cb4d0b7cfd2c038f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 117; - dataLen = 256; - combinedKey = "4cf969387e44a3eaa675112c3488566465efb41f0afe1a2a56569a0cef14b20d"; - iv = "75627c66582cc06c1126cd5abc04b445"; - cipherText = "be952ffb57694a454a2f42b5be880d38473e2c91f63df864d29eef3d776ea390"; - plainText = "d1e751c91151f35f69fccdfd06493e18d49a94bb7c8d02414a10f0347442b1f7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 118; - dataLen = 256; - combinedKey = "e6189e85075b5455f3b8e5ff51bfcb34dd3ebc464a071bff44fc3a076e134885"; - iv = "4de19bd56257d382c8669ffe68b03484"; - cipherText = "6c62434f4453d1b8cb78d4e5a78a348662b16bf20ac6677b08bd4629b3734786"; - plainText = "6d944f49bf0167c511a02f4a3df80d2f97f4e3ddce56f51026e8b224658e3ed5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 119; - dataLen = 256; - combinedKey = "47f8b323fad90a4b6e52bd3d2b0e4e73bee4c1f60e6a6f94139f2f91fde01806"; - iv = "de88056268f85a764965ea608e8e32f2"; - cipherText = "6d9ae349c620c0d57e46c850c8dbb70d47420f77eec23cadff00e6703d90f62c"; - plainText = "6462144ced42f21195c58d524ba2c8b87c3b1d4caae688bb1529107029fafbdf"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 120; - dataLen = 256; - combinedKey = "5fca4c210463b2e89fd7f9b7ffc46b1bb055d80fef823b06577b438ebe810def"; - iv = "dab87e267f45c06aca437391e3ef2b93"; - cipherText = "9010ea0db832e50761a68923ac7504b41ac99a23b5b33dc67162c7f5c1576a99"; - plainText = "7d8676a704699254f0bbe4c5a1a725d5fb01dbadab25fd997e2a2fe646fd5552"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 121; - dataLen = 256; - combinedKey = "efb54f29334e4ec475d7a92eea05b5e7c604bfca9d3a9c4eb731b3ae05eb7936"; - iv = "4965e8e50879c8ed10a43b347150747b"; - cipherText = "950746bba1b484dd928e23df3fe73a6a62f48b673862ace994a60306c3cb81d2"; - plainText = "2d1d5701394407c4a3a49580e2e1cea79c96a3e0b2b41e16c87fc3ed142ee973"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 122; - dataLen = 256; - combinedKey = "dc5b03495daf20bedf1f5e0d89a930f67b99605ea62d88611d6f6c1e015ff5bd"; - iv = "eaccaaf4a82550e669ec5279de391eff"; - cipherText = "8bfa700c1c5d7f69022de28763f955c2087a48689e9b5c83d0ca5a43354bd8d5"; - plainText = "0d4fc92a52952cbd4872ffe964f0ea6bf10b8adcb95e21bc85e2e40dc139d360"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 123; - dataLen = 256; - combinedKey = "27a57a419286e0b36fecf477597340c9d422e95934f52840e061dfcf8add5f9a"; - iv = "acf25408e9dd21a8a0a26f2edef2ab76"; - cipherText = "dc5d2261a9fd089a013a86babc20e2694dea999f75c2edf26c15acc061b35cda"; - plainText = "1f7dce6c5ac9c726dd0fa4fdcd71a47ef3e008aacefe7656aeebf85aa0094487"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 124; - dataLen = 256; - combinedKey = "80d6d26bbc08094a5d51483d25c4cca63d42ac49ebb93b5e2a6934c054081e39"; - iv = "70868d1d4dca4e4ce94647ac4dcc3e4d"; - cipherText = "04c77b0e67f3e5b5436d4e43d50909bb557ec6dfe9469258b4cb08e4aab2c882"; - plainText = "77337683681539ea9f7934f81ea555902862f0ae3ff4d9f20bf4c510db33d47c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 125; - dataLen = 256; - combinedKey = "0de30916d9fb46126f1fbb9bc8019fe5c8a2635f29c8c3ea5522f387ec0cf6e6"; - iv = "2cecbd08dff325874c1cf6cb4a4fe7b1"; - cipherText = "009a7788092a4d66b25ff9b036a74e7b43be22f60e316cc917888bc557a046ac"; - plainText = "03349e81523e4cd7b89825ff448cc047ad1eef5754e0d2af4d919084ca430d2c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 126; - dataLen = 256; - combinedKey = "505ce85fbee4e124641e56ef000ecdd4c2b42b1e8fa3dc57b01196b4dfbc95cd"; - iv = "969351c5f5900f54db1f8cfa134ede74"; - cipherText = "7c081dee4ff33f09b5a5e0dd682247ea80fa8e4ee1657917b5fe881c4538b41e"; - plainText = "7d7046654800fe8a0868394173abf29d6b2a692493006440d69ea92c3a2ed5e5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 127; - dataLen = 256; - combinedKey = "e1aea2f0f54c1f7e9302c15cfc69cd079d051087cae36b5a6e845b08bc5f6ba5"; - iv = "68f89e9f7dbe50c799324973930782ff"; - cipherText = "6654b4fce012422229cc4019de5be0b49f52614c979e2ab176d8fd1bf01bfaf3"; - plainText = "77a5da15c3379ea2ec857cb9c0e61198f0ae368c0739397f6295fa6321464433"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 128; - dataLen = 256; - combinedKey = "947d285340ea36493b19e1ea31d2bb4179659f16e5c1372f3f7249e881bd1aa2"; - iv = "02356d80f96dd0a824c8fc7724eaf673"; - cipherText = "1399dae7f93ce94484c83da87f383d43416dee3d54f9cb5e492b51d4beca110f"; - plainText = "6c118a6ad20f75f2fa642da939ce5e8dbc66c4407d8b094a01f8fa3558062f4e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 129; - dataLen = 256; - combinedKey = "3aac43a0de3f82bd0d8dd6b883b004ca7a397dadece44ca5be84d55ca63f16e5"; - iv = "d217aa37653de9ed3e2504786b6ce063"; - cipherText = "85a6c3de3001d33d3ccfe5e18debf6dbc40fba5e95d72e6fd9835075aade7ac1"; - plainText = "ec6876bec25bcf819a038257546a1c214d1e4259986287b510900939bdec083e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 130; - dataLen = 256; - combinedKey = "dbef2d5d802ceb83e686e0da778f2912af7265699e09b8fa545e4b817dc4cb98"; - iv = "22870871373ad5103d7c38c16a31eb45"; - cipherText = "b4009fbf8d412776eff67745619e6e3770c4c6c2f12413999b39a4b6a51c8d97"; - plainText = "306640e0177e42f897488ece20eac2859cd6cd4f71df312221231559bf5d5f86"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 131; - dataLen = 256; - combinedKey = "6553c29b5269597f55ddf999eeb9bdae696833b19dcfe7e6921ee6e51ec598df"; - iv = "3f421d41d9c8b8d5535e134a6f76125e"; - cipherText = "5d1d7b4cb00b07485b674bb0714ddff95b17a0143de25bd96ab6cb99a338a333"; - plainText = "5420619fad9c86a08f2c3816d034215e2dbf6a1538a61d8f9306da57fa0e8666"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 132; - dataLen = 256; - combinedKey = "b83b7f41d016873342aaa19704dae3670bc6762fca3ba2f3b2ac0e65df7dde79"; - iv = "59e85a50fbf198f7b608ede83363b418"; - cipherText = "fef7d8cfba8309823c8b1adc75ccb1002a651eaf0a18ec3998ba73f826380b17"; - plainText = "44a951f87ffd7a41368e71dfc7292fc28ee01ae40c0a2e199d0af73b57170627"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 133; - dataLen = 256; - combinedKey = "ac15ac23f8bf8fc9dee9f31ad4e2da126505f951eef973330cf0bc53ee8193b3"; - iv = "316a7b2cba81d0185be9412a1a2a3c0f"; - cipherText = "a284b8a9e3961bf602e647669743595d51541502fa4da833cdadc3a17d2144b0"; - plainText = "1910af89b0870a9179b1d9561de2bb16d30752187e002088dd1038d6a0f32c9e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 134; - dataLen = 256; - combinedKey = "b4bc88d80bcf2cf7f2ad08b5b1ac4d959c6c9894514f0b374a34d4c58f088b86"; - iv = "f5e999b76c4ea71d749622857afacba5"; - cipherText = "0680487ac3489e791e7813ed4bfe9ac65e436591522e824a495ba4d9a52845da"; - plainText = "d542862356cf95898da6216bdd6b8585714294144aac9825ad30416f261d925c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 135; - dataLen = 256; - combinedKey = "b077d5e1ef684c36937bcf7d79674ce247b1af7fd304cd4a64c9ddd892e62793"; - iv = "57b704d6cabf2e79deb8073d17712ab4"; - cipherText = "24e253f3113b7c193f8ef49b1b2441bba2f7c85c3db069a40d5dbb8ceefe466b"; - plainText = "22db96814e23e7a49c095b78036ae58de23c1912b41b10013451d24a29ec62c7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 136; - dataLen = 256; - combinedKey = "367bb476e69f2631ecc6bcec6e38f84d2de363fa86fa12a6aab286f4527dec67"; - iv = "dc92d0f74b809814f042b6d834fbe421"; - cipherText = "158046203a217f588d43efe8c0ac11f432722d91025fcaccf6bad57d41a02f9b"; - plainText = "99af3e28a84fe8dec69c1d2d44735779415b2dd9bc8324bc57f8f22379382c7d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 137; - dataLen = 256; - combinedKey = "12bce06529ccdf05d06e55940c1992100b0eaf8d80eac4aa2baeb4316f7c2cbd"; - iv = "b8339fba52ea6f0b3c8be9f7238b365f"; - cipherText = "189f15142560298b4d0597b5593ab5d1e244cf09b81018658133340204eb40bf"; - plainText = "8f28d2857173ef3e7684ff5da94a87239da4a947058247be24baacfd8af94df1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 138; - dataLen = 256; - combinedKey = "095e2a9a98e650e328c71ee67e6cec432cdde51c5c9131022a1e97ceae06e92b"; - iv = "19cd7102ae9665c82919b23348a405fd"; - cipherText = "8b4738d042c14fb77ad7b8b6e7da16febdd49f9fcd0f46e62ebfcd807198c864"; - plainText = "5807ecb939ec83fd4fba0093e0a34adb46482da3de537dcef1c18fe06ba96966"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 139; - dataLen = 256; - combinedKey = "181da4bd34c89e8a9fa19f412bfc8986fedd27abe2095d1e6592647b5c9f68df"; - iv = "b09f9c79c462d3bd99b166a0e3eddfed"; - cipherText = "c521859c4d9eab0ce19f2ad50f6d20c031043490fcdd3a8f4bb0146fdeecac98"; - plainText = "deee66ffd3e61e660b9502815e450d46087a27d222dea43759e2075ccbfb2d2b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 140; - dataLen = 256; - combinedKey = "90377582570833b2230f3800b306da21c6185632bd74892505c49516c07122d8"; - iv = "4eb8293c12137ecbd3fabd6f09403b88"; - cipherText = "f70e49e5875024dd0d8b1b2c2ceb504691ddfe807b1280e589d18087fc436efe"; - plainText = "078668f44d7f852b634948d73c77842bd8ff53d68972daf3f8cec766544b6187"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 141; - dataLen = 256; - combinedKey = "a1ca1c7bdc10a4da9287d4921cf022b24b1af6d286b8831361002e97fbd4a39c"; - iv = "e59408a24ed500946f0d754f864a0c47"; - cipherText = "dd43acdde862be0063d1a0071cd54f2505e0ab261490588c0249550d3cf960b1"; - plainText = "d19e365fc839aabf58893137f58d84011831c76e8405244c95ab23304b026cff"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 142; - dataLen = 256; - combinedKey = "5626e50b50447192d76c9e48b23bec15d323ef7ad4a52a642622deb7afd5abd1"; - iv = "c58efe82998b3011ddc107b22945d79b"; - cipherText = "b774ec0d8fbf162020244513d2760028df12a5e68a91e8fa686bdd795dd6c3be"; - plainText = "4a83cdc37d805c2dda665a26ce056115390f0c5862b73fe766fc5d7fa99839d8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 143; - dataLen = 256; - combinedKey = "a990ef727b1f9e94c73ce392d59343e8007c1f5c1e4ab1374e44000a11c9e16f"; - iv = "2fc764bc4084bc0535a8879318734018"; - cipherText = "0e2d8b64749e03536f181f4c4db6dcdc324233606c12522885fefe100bf91088"; - plainText = "f6808e12d8c05c5937fb0a8e06a2dcc1cf11741079088312ea8e530f18f5fbdc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 144; - dataLen = 256; - combinedKey = "d6f7265e4fbc2dbe49852fe9eac540b82edad6fd9d2998acb7a224e2baeacfb0"; - iv = "d51d1d1412a16ab48969464aae734915"; - cipherText = "e5bc23c6adce9f6bc9627b45ffeddc347f545f25b9aa540f62792cf3dbcad1f9"; - plainText = "8b493dde8328b746525acf13e9e1988e21623c5ce1b332deaf0f8ef3dfd48b19"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 145; - dataLen = 256; - combinedKey = "3e6f4e19a6202282e68ff8b7264521b2b1cb1f6914b7b354dbfe88670ae24746"; - iv = "b817f7e357214510cf62cf165a253180"; - cipherText = "0d5104dfa38fbd873ee832c6c1948f111d17d5879abb437010937cdf50e11ce0"; - plainText = "b8007c7ae42fb6e971e8c245ddf85e589a0faa5628c526d3563fdf49a6918ab4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 146; - dataLen = 256; - combinedKey = "30e4d3758e06ed8e7a6547f3d0baf5a4b77a55ad3d2ae8ff1b1817bee5c98cb2"; - iv = "1dcb50cb9e54afe949156b2d46961c58"; - cipherText = "3da9560e8b07ff853af1e15cab84aacb5ee6939031a1d360d4909ac46e574ae8"; - plainText = "81bebb7172bb0b3c9bab155426ce38eba7b22e17c71f09a73df893f179b25a51"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 147; - dataLen = 256; - combinedKey = "fc22b40352b66f8dbab0ef27c4109e38e17e0a007b162ab11369785661f6356a"; - iv = "c3ce421280b32a9fc3ab265f8d253ac7"; - cipherText = "25d710182c05542c28264bd68e2e7fd4f979692d086e77023dea3c3525abe11a"; - plainText = "bd04ccdf9708c8adbf7a3a12fbbd22816fd9537522f7aefb55ed5426722dbdce"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 148; - dataLen = 256; - combinedKey = "4066c651048c7529010e81614be36b4d0be7d0ddd4bea953fa50d1cc4f6b4e2d"; - iv = "43728e6cd43872a563e50c2104f28f32"; - cipherText = "531d73f8fc77cc3528f070bba471c11a1dc7f766524e337af98b1b2c3ad2c6bd"; - plainText = "5b444f98d8a6305e2b3032ae7c672db28dc264961863570eec9007b0225fa0d3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 149; - dataLen = 256; - combinedKey = "3d5f9b7f4f1d76a474b83dfed544bf7509aa39cdde7d29789370a2b310a1c678"; - iv = "849205e46a6f607e5896c3fbcd3a1cc3"; - cipherText = "5fc53b2f6e5533e70a0c2f9275356ec746bf8d6d06b65a495060e93c63a4bce7"; - plainText = "c2d51bb2340cf7c5176cddf4b41cb08e895fd2a24bffea6d8cad69f580174ae6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 150; - dataLen = 256; - combinedKey = "75bc63e7037a837e6ccdaa8e72afaac14b0712e3e72e26c7dc457406e8d97718"; - iv = "60e1512ff7ac3fd04cd8c9358b3a571f"; - cipherText = "ad53ea332ae4326df46160d2cd034326e904057a2e77a56d9c3c68a5d15c7f39"; - plainText = "29b0a87040535689888a2403d00d0d31ffa890d0e0a654822402a2096ef3003e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 151; - dataLen = 256; - combinedKey = "b020574ec5ce0bf7baa7d19a705cf88eca79f3d037e1f1930f0c8e5fdd2fef23"; - iv = "f7f575964afd1965e3abd58e5258934f"; - cipherText = "6298eb2270120f2ef908203dd8e3fbb60418bfa97a9a2f9cdb52b65962ec13fc"; - plainText = "71c3d3d6693a5950d7c421e035c5aeec7a492b7fd0ca6644a290eb66c0eaa3da"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 152; - dataLen = 256; - combinedKey = "d90e86e33d0c2f91d48b70abc672a01bbf67d1ec009d55cba4dcb9dd5b6bd055"; - iv = "644d45113f35c2f2623c756aa3290f23"; - cipherText = "c9786fa6bb5239a18924df6b0ce81fe97cc5dbb9e932ae64c67c37eaba90a6cf"; - plainText = "fa497ca68ce6593e4d49a680bb5b1ad4249ab1ce1376b6fde71b1c7708da5b74"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 153; - dataLen = 256; - combinedKey = "4b06b66b1486ad311be59c7c4b9fe9ad6f5f7433b1ed90aae80573551399c3f9"; - iv = "cad5601ef7ef95228a0efb80bb746946"; - cipherText = "cb4cdcb4939c29018ff2d263ab71b227896d3428e9c15387d54e395884081852"; - plainText = "9f7cb08698734b2b4c70fdaff032c3357abfc0cd1051b231838caa1fe580fe04"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 154; - dataLen = 256; - combinedKey = "dea54bb0f022414bdb8397ad23b31124f112ecf8339c49429bb1b2607a301413"; - iv = "f98040250b58279ac4e4d4cdaa35841e"; - cipherText = "fc65f6c581ca68fe7a39db8d4796e2185ab8fed4a82a9d9759c98a9d17576dc9"; - plainText = "d6cf5ca25194a5099150f1092f30f65741d598581310038279d8b2dbc92d9319"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 155; - dataLen = 256; - combinedKey = "d023c85f1f3a732d6fd4e9e67d9232cac61aafea4185daa1f2ac74af422c019f"; - iv = "a7a42dd98037cc68941c6f9e15b956d4"; - cipherText = "a14503ef6d3987e05c336ccf1012be14b18df2f3bfb2005981fb6c5fc14acd7d"; - plainText = "7fa7ee4af3ee5ca37c2da62a02bceb0d2006aa2b53b421209f8a7e400555bacc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 156; - dataLen = 256; - combinedKey = "ddc723b045383524589cf34efa23b2d48aca0174871d8fb3a84d9bb5d1d070b9"; - iv = "48e7379ad0551195d7591131111a3073"; - cipherText = "0c25b9bc86a03e6be12762cf17b25abb86c25f1d3bce92c71fd971e833897da9"; - plainText = "de491bc2f55f5ead3237c60c72335ac5ece473a371c02d9ccdde3ef02dd070d8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 157; - dataLen = 256; - combinedKey = "60239b3a1c609ab43fdadfb37580fcedcfc798cf0ff434e9fe959a3605a7713c"; - iv = "42a3ca8317cb52658f0c912172255c4f"; - cipherText = "9b6a194cf0796c5c23eec5435890b5cde3fa89302ff87128a1bc77e1bcb41cd9"; - plainText = "72103c480a46ee87b3abec48f81a736a6cf54c0b317870afda8075f6e5f9bfee"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 158; - dataLen = 256; - combinedKey = "363f867cfe07b2d547d8cd03219672a76f9ccf7f94e196199c8f9daf54f7eebb"; - iv = "b714e5a457493c5f1eb492051f85c574"; - cipherText = "f035e3dc0c9b8f70bd41f4a5bb43a07f839d8693c3d3894a6778714f1fcab22b"; - plainText = "17556339a11d731c100b125b04a2a6ff49af9e0b3c88ec75c9b9decc742b7ccd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 159; - dataLen = 256; - combinedKey = "a1f9dbcdfb3328a1825c88b3cbd34b4bfe65762472c473309b9de532e8eb5ed8"; - iv = "6537b71a73932878e8779da49185b3e0"; - cipherText = "b0533ef5f6f266bb7e72cbf0a59961ac0684b6cafd7c1e7033833d69b082c1c5"; - plainText = "6a546ca8b2e7aff8e69225158386be07602f8abf9ad60aadefa04a7ddc4b40a5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 160; - dataLen = 256; - combinedKey = "fe7eb772c48c6a80b9386499782ab6a28c2ffdc18b6f11edd8e266ce8237dc14"; - iv = "188df3a513a4244e9b0d158836d64c37"; - cipherText = "baa064d6271a69a88923d45fc5339d49611140823ea904edd16597002bb18e3b"; - plainText = "352652a2b16af379b09a9b32f1eb425124a078907d9405a7d88a2f8caa896275"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 161; - dataLen = 256; - combinedKey = "ef59993eb626f405d75ffa84aed8746540b1c07982f45237d0ebf2f9c60ecc71"; - iv = "344136a18c7372866cba27da4ae5e838"; - cipherText = "8cd223f9a143e6d740f5650cec2205bf1d471270776cc7b4e739517ac3c06606"; - plainText = "f0f7dc5de403c487272b05ec074c2d87e2c1ae5fd3427b8021581f3dde8f56a0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 162; - dataLen = 256; - combinedKey = "6425b4ba600c61dc30d4b968399f1a64b0bee9bcfb038c900e87e9c2f0172fc5"; - iv = "21af7ed62d89989c211ef9a16e54eb43"; - cipherText = "c3ad5364c9d9e85b9b26b66a4009f7f310fcf189a57429d37670270f0c6805e4"; - plainText = "16898f3ce68ab4a9f855493a8633fbe473d35b0a54e2c541b8604e9aab0757d5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 163; - dataLen = 256; - combinedKey = "b3ea2535243acd6d1f02cc380123c910117e6aa3ad7d48f1e022acb67fac0fda"; - iv = "778e4d4f16e9e9c9e6d677ab46e3816c"; - cipherText = "d5aa39520a8ce6f5257e83e7bc0ce525fffefc5210298787aaffdc6914f1b397"; - plainText = "50ece505815f08cc1f8397e557b5b1f7c7a1dd5e719e21dc8dbfdb21b51aac3b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 164; - dataLen = 256; - combinedKey = "767e977f0780a7432acf21ede2930b249bf0a63bb6a88d4459b1a0142b7de1b5"; - iv = "ec0d37199b8b55a9a37c2c98cf5e9182"; - cipherText = "807ad5e12a25fccc71aa913565f406fafbd7317ca61b6f14b297df99b71160bc"; - plainText = "9f427b755c3dda71d9c3d88771a92ab5e4d3ad3e36c638047d1e37b9b513f6e8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 165; - dataLen = 256; - combinedKey = "afca211742433571ebbe065c73aee533c09c352e80bd99430bd0a019e69f15e0"; - iv = "8dfd55800efc7db4ec1fd84412fad2eb"; - cipherText = "6556573bdfe5ad000f061a0c168214088a0f230dd798dab59bc450a577a3bad5"; - plainText = "1db1206ce1700d543949c10a6c1d92321b07dfe7f98f2fb5d32470df11e9d5d5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 166; - dataLen = 256; - combinedKey = "3e1f44d7993d0e78a467d2bf0064481fe0e904ab2d4fef5ba8b1678688766058"; - iv = "8e7ad323eaf134e38c202f8cd9bb5c08"; - cipherText = "c13e1150b43325fc2644c170c5492548fb2e0ae1d5b0bcb10ef3777930e7cb4a"; - plainText = "f4613cbfedbab97842c94682edccfb347084f21e39c05e9346f63b70e405c33b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 167; - dataLen = 256; - combinedKey = "c35b8ff3e415ce578abaf259ca5eb26392ad0741846ac0ba9e30cd3b7d304f1f"; - iv = "af4fd1d47c5609a325dd69bce96331d4"; - cipherText = "54cb90b1cfab48267234492ffc4ab50bc8e01abcbc121acd726e65e290e340e1"; - plainText = "e9232f2747ae28cd18ce1c0d9933711726dd26664a18d736ca946b69b7f560e2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 168; - dataLen = 256; - combinedKey = "66fb05de33435354d0b1828ee072c7f58c217957b15b164fefb75e6730d95ec2"; - iv = "2e5e98187ec53ebcf386df2a42b92bac"; - cipherText = "8fb501c7c0b118c9a65587289792aab15894f7e05dd9ec87312b25ed7145322a"; - plainText = "dca0f4ca594fe88223c2a9124165d0bec412d244d6700b44627531e5107430a2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 169; - dataLen = 256; - combinedKey = "86f8149ab118194d0802cee00e0e16b37858cf3f81b0ef157e5d974a70eba1c3"; - iv = "cb8bbc7123b194a595208b679cbe07b3"; - cipherText = "c917d70fa7ebca1b0d271abda72a955d39f312528c9ad4a79086715875a5e3d8"; - plainText = "ae9453f6a09e17e8ab92f7c379797a5f61900064202af702fbbfff8cacae07e5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 170; - dataLen = 256; - combinedKey = "a2feb7db5b8b8b43e8eeabdc708b33827bafbc287550c8b728b14e2e27ff7dec"; - iv = "df2111491b05020f123b817ff21d66ee"; - cipherText = "76c77d52559800ba5b7ac84f518cbf932e518f6542265a218179adc275d7da95"; - plainText = "b4e28480a4f5e7ab8ab5eb2d34fff263567ae383aa097b80c067b79440f7d2b0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 171; - dataLen = 256; - combinedKey = "f95351f5efcbed389f5f8e950498a770e79570924bb869cdf90c6c9801d02c38"; - iv = "de1c4ee200e47f28a65165b6eb5ffec9"; - cipherText = "5da9a49f793dfca75b93a8e370d108d3e97249a51f042ed19d6fea3cf7d2b3f3"; - plainText = "36127d1d61b62514ba16d8f0408ab521eb13b9a5a598b4711696b90d680512e5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 172; - dataLen = 256; - combinedKey = "711907b409dd75d1e3510cc4d98869af09a7268cfd9f755e5fb8c4f3ca2fe071"; - iv = "b27fa52899918de07f7d00d2b527da8f"; - cipherText = "a24d3f94604b3c7c5458876497c315bab18cd8c187869d5ae535d372420d5c13"; - plainText = "a96d515ade745f94afe3e0fa68032fb00f94c6008af41871c9ec7b95cb0e14ce"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 173; - dataLen = 256; - combinedKey = "9b94cbac1d07dd18799bdb7ba33ef22954cee7f997acc0310aaed438e2c13832"; - iv = "feacaf0702f7c96bd9f8411a288b7353"; - cipherText = "a96e751fc2b74757e2d95584ac47f564abf8425affcd591eb0e44169b559318f"; - plainText = "db9c227d0ede81b422537472942f7ee1264dc0cd917018514c5c22cb04bc3d9d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 174; - dataLen = 256; - combinedKey = "0655575af417a2a914b7e154cdca734c126a1cc8bd84fe7ad654facdbd580e01"; - iv = "b2f1e60733e2f0f9606e099207572ccb"; - cipherText = "2499102169d25ade39d59efc7d5cf1112c19b53369aae4d823eb2cc5e671a31a"; - plainText = "cc0039c9e5aaa3606c5ade32c63bea3509233f7ac6ac4c039ec5becfa3ab3813"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 175; - dataLen = 256; - combinedKey = "d243f73aa0ac21268a3829572c03c026bee04ccb6d7acf074c518c03bb72a061"; - iv = "cadc2ac4c72493194044a42127000628"; - cipherText = "cad6b1cc16b491178c75e6c461e4125c08eb089168cad01e749d17b422513edc"; - plainText = "3e64953496755317d1908054cfd72461459a7c31c9b89a46d095bfcb73b5c88e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 176; - dataLen = 256; - combinedKey = "3db87ef71178b4d7bccbcba412e7e84a8bd225d4173d4525ab036e8d5fd88a7b"; - iv = "f71e65efba52e47874b1bed59e9f656b"; - cipherText = "76d52cc26f84e5c3c0f86f9b0ad46b485fed6a6c3e6d913d00c33e10ef336879"; - plainText = "a09902679bdf1e8db67547faa5c3c3b3dfbf3c9804409c2093b29877960320f7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 177; - dataLen = 256; - combinedKey = "24ec7f7f783c5efb3dd67e64f4a25ec84caf191120ba8515f57eef4434038892"; - iv = "4bb82f22d2af2f639a5d21b3c1263ad9"; - cipherText = "2a12508f8e4a909601c6bc1e57db37566448af0b097524dcbffc7ceca2a2f362"; - plainText = "ca74b47e04620eb3ae8e0e896d5760489ad3e7177386eaa781afed90b8af8760"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 178; - dataLen = 256; - combinedKey = "30d5accff4b868b8fb433deac670604cc750a13f6afdf66d08cf8e8b5ddf999f"; - iv = "4be1d679ff32e03d720ee52558547b73"; - cipherText = "e38b3030c63b71c109700774b4727ec8163c8e6dd5c13182cd0d66584445ff5a"; - plainText = "fa0a8a12d86c7a6f166a1ca7183a358a40c95515b68b82b1222b1d13af597435"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 179; - dataLen = 256; - combinedKey = "edd716fd637f7dc48ceaac7f54385190f72f9d926a8694d80401f9543c2ea32d"; - iv = "6e262464c7e6deef93fb882230c4787b"; - cipherText = "a7df6645d58d7aa8dc313b31629d12d35ed3979c861ece544f7cbd807641a575"; - plainText = "c48210956d49a8fa645644467883dd59daa103d1e8de5e57f3fcc3c08da05c02"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 180; - dataLen = 256; - combinedKey = "7726142431321b04e66ef85817756ca865f9959fce7cfd3eea2b4e279ce13054"; - iv = "f2924e89d33a18743aeb14e7fea83a6a"; - cipherText = "782194cbfc42c60eff0b3040f66fba826170fb7253adee862ed8493099e703f1"; - plainText = "3a8941917fabdb2c766a9429cea6159405d5c4a1839ef67b9b2b0fef1d0300da"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 181; - dataLen = 256; - combinedKey = "25b69fc28297e7626578665e703ce2f4021ec6408ea9c5e0957d4efefad3e046"; - iv = "7c7a5bccc55b4f66fda53e8fa31df30b"; - cipherText = "f60eb1a7e79d58fbef3bed6e76ac435f2f79d113fdcc0d9aca6bf643b2b8b391"; - plainText = "b76b266d8e8143450a05c4f6cda9392b77a919f25b3c1f28a5e827fa52b34f33"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 182; - dataLen = 256; - combinedKey = "bfd0fc840590382cd469f9c82a62a46ac07c05f31060b83c87790716a5fc30eb"; - iv = "e541c2dd1c9e282468ef6503c4d77d4d"; - cipherText = "faf6fdd7e83abe05ef2a00d9ce455fcafde37d7fb6775b36de942a427abf274a"; - plainText = "3d096b200a8525da64c3a20610eff9b5b5177a3b879f802374a43d93692c82f3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 183; - dataLen = 256; - combinedKey = "e1f49e3f03de7cf3bc40f6cea304fadb2510dd2ca30304690634164441fbdf88"; - iv = "d562a86e3a359c5f7121e01e62e1eaa8"; - cipherText = "46be77a0083a9c4e7062b1e07903c86e51da6c96a1326f0b01c0dcb772623502"; - plainText = "d322df20f580b79d42ddd216717a50b37b8cb2c50e9d9ed9bc61313ea89809d1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 184; - dataLen = 256; - combinedKey = "8af5e3068800c5b79940542eb47e2894d8cb70516c758bcd8a666907044e5d14"; - iv = "969b68a94ed0b73440fc175bc91f5280"; - cipherText = "14e7932f869bbfc839a739be9d681e98d4f5dbe2f9b0d9b22663e6853cf013b8"; - plainText = "e3d8d85930315e79fced06735e7d6c8da3d558463dcad726c9a64e3bf13ad699"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 185; - dataLen = 256; - combinedKey = "d8ac76f14246bd9e32f345c4ca121eecab5b83311f650e86935c689ca5439249"; - iv = "9509c6dfff06003f7db13c9c0b1d54c1"; - cipherText = "b1228b57d48be870d10532b5ba801be3fcc963f9658e7a64a9da70e8b1b19cda"; - plainText = "7b769018f587ce3340a672dbe72723704bb188636feb893b9f84d3f055541681"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 186; - dataLen = 256; - combinedKey = "b429f55e39d6a8aa06afeaefb0f0da4c7e71b7027d3552316a848ac82dbf56f4"; - iv = "0ff19bb74c868c82404c63b39c1f03c0"; - cipherText = "af5eeb55e631dcd80b74c47af7184d21ec3ea27c15a9ce9c32cf17fb88ce68dd"; - plainText = "a742ba4aae2b0efdeb4fadf82911c3b7bc50c1440197b8fbacc697288492329b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 187; - dataLen = 256; - combinedKey = "509142f11c4ac3312da3d20e265db9c4f26672b97dfecdc6b7e86d7f14e4f646"; - iv = "ceeb9ac40ae7c7f82939476efbe26a49"; - cipherText = "22446490cb65f03e5048836c37ff17b72e04aeb0ce8748ce510c0f8acf6693f3"; - plainText = "263032f1f7ea647c218bca88ce3494b87269479cdc72b331588f758dc61d336d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 188; - dataLen = 256; - combinedKey = "55af7a97ab44138c3f8024b5f2c1714106ebae79a6e7c7ad94a0181975e1688e"; - iv = "9629a53e1a82f2528ac3a55a14af7a59"; - cipherText = "4cfc706fab291ffa23daf1ffa91c27e687a66cd8aa7b3636ea3e3f65056fd0f3"; - plainText = "7efc61b96181a550b4c334456b84b7a202d4618098e4b3c811a0b9d3af9670db"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 189; - dataLen = 256; - combinedKey = "ea7eb44003e9bf171f2ea5cabb6fd0dcf678d722fe230573e9bfe86978450dd3"; - iv = "cb96cb5dceebe78e0cb89a4813de1a2b"; - cipherText = "cd2b13835dcd4f0411ef8c007bd43709c4dc166bebcc72dbb24e6686c870411f"; - plainText = "eb93a60a1b0b5b7a490ce39685aae3d35b72219de9142cc89a9fffb566638682"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 190; - dataLen = 256; - combinedKey = "582de2e90d130812c3e9dde1425a97610b74a8982c4c4c3adb8a5abb7552c4cc"; - iv = "4434f2f90422dc47c400a8be0c5c61e8"; - cipherText = "baf7b87c2048328f092b925740f163c1d547aacc2d8fe38ca09da9fa91998dbc"; - plainText = "3b6372cedf430c3d2dbfe0108398a389c749ba2708cab2433c8037d4c95ee8b2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 191; - dataLen = 256; - combinedKey = "1dc8af9c078b9a92ab30573d97f57423daac1efc437d3f216517f640cd5f2542"; - iv = "3a3ddf40860f3c96f639c5c5c980d7e9"; - cipherText = "2542b38fff8adee346fd9dbdf591de775934952ee2d5e4213c834aad9185b7bb"; - plainText = "2a08ac707249da567ed0d7b7702806641f07b372c6f7e2ee1d71b06a15172784"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 192; - dataLen = 256; - combinedKey = "849718a7a4c60c58f4163083a8b340ad85f178f46af362fb5fd9f7787c1cd3a2"; - iv = "d7242fa38e10e2c1912386f5e4f57f0c"; - cipherText = "5e8e9f74d7e06400bbfeac1cfec88365ede305d6dde6e06b3bffab7d05b60069"; - plainText = "c515c6a929c77c9379842310e980f9e3f07c96834740e1f78278f45ab8432cac"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 193; - dataLen = 256; - combinedKey = "9baefa2fbd8f07cfad8f263b6f38d528d230a605f60ec4bb8ee05c1cfd0c48cf"; - iv = "03b38f313c631dcf1193ee02c9bb4f60"; - cipherText = "1a2089e9cb179d1ff6e1cebe0d6546bb976a6ba873e77b0e9f15299cb8ff9205"; - plainText = "0ea873a0a3c2c8227f0308e50a2632ebee97f9986085bc57c332c667076c9025"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 194; - dataLen = 256; - combinedKey = "d26bf9a7f6ea012f1dd26183038b60bb1481dc60b5b581216aa7427b7d018089"; - iv = "e335fd5c1d6b72887d13dcbe8d40cbaf"; - cipherText = "8399175f06b764b5b8c741442e2f9ff97b27055b987d13130b03366896fcfda9"; - plainText = "d836fdee9f32341eaa0783bc8f1a009897d11842f142e61d85d85edca5ab165b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 195; - dataLen = 256; - combinedKey = "bed8d860a510f1f7dafc07494d5c7aee51bcb215f21cfdc62226ddbd23d0d278"; - iv = "c7ce763661ee111af174a6c88888611c"; - cipherText = "5282bac88b3a0513a5ebba6f6b96399cb23780a987782b6991949f3c1d49baa7"; - plainText = "75002b3591a162a666050020bca798e35cbb6d5750028b76a0b89fd0bd818f20"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 196; - dataLen = 256; - combinedKey = "3aae4f7222142deab482b5d7b903c2d3c92f3dc4c8bb8be651de26bf5da08764"; - iv = "f575885839e1ea4021de37def7360e36"; - cipherText = "ca0eb48d2559e7b9f0297a79f3732bb569150632d97f4488a426453e63c0bf1a"; - plainText = "81600fefcfade51526ec8c97020bb7fc5752121a8133994686f3bfe3e6750f85"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 197; - dataLen = 256; - combinedKey = "a7011dd7ec5f9d57fe7a20cef2ac28a08f92779b5ef4402a2438f486554affc5"; - iv = "0168cb2c62ab43e353fb5f0dd78d435f"; - cipherText = "b6f22116ac2d70718b65551b4ee7a6932b0466e9b6d211330a07153050b4079e"; - plainText = "0162633fb7363e2396934ea0c30dd82c4a3ea795f5c12be0f7af1f78c45f7d0f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 198; - dataLen = 256; - combinedKey = "aacc20ac91b4dc4e440c44d89ad933dab73306ea5f365df14cd87118b86c1be7"; - iv = "b450eade08897042b87810153f275ad5"; - cipherText = "666f1a7c6da7a9f6527cf0fb19f15e15bf184caedf46f21f1cb09ba6ed99453a"; - plainText = "d04e0bbcf0de146fd3abe6c798b258c410c75921aa6c62b06e90f602a5a0e725"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 199; - dataLen = 256; - combinedKey = "05470a50a66d5d73ee966331c8a1a98fd3c9cc13c2a2d1daf8ed48f3304f84e3"; - iv = "87202dfbe46437d0b59bdf7ae23abbf8"; - cipherText = "d3240c09183aaddf37f4145389950760f9ca57bf38427727114098df02db0b00"; - plainText = "4997bc4347e23b9bbce6d248c826abede86d9f364afe0be817931e95f361909d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 200; - dataLen = 256; - combinedKey = "5c175e5c029bf737639e81dfd8dab089550e713f3b7413f637bca92e7ca11129"; - iv = "b6e8d522ea13d066c1a624fa110a4538"; - cipherText = "661964ccb235a3083528783dfa7939e24bde6a23e8864cac526909ca5476f094"; - plainText = "326b9afdf4f9fa1d8f4e7b1fbfaea9beaa6d7ed1fb241262778d9af44cc7bf97"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 201; - dataLen = 192; - combinedKey = "ad402199b1b0a479b54b3643f26d9cdf42f64d0cd72bef286f94b64ab9aa074a"; - iv = "3d8b17b42d776009e3f91c094074bafa"; - cipherText = "509de6cee075a82f96fb7db5fac03f38b1899843b3d06dec"; - plainText = "cc6fb25668ae8ab46a2f5206d92cb6672607b5d1be73e267"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 202; - dataLen = 192; - combinedKey = "f3a98f1ba8deeb23fa1c85a434df1481686d9a8febe74312adf32420246e1a86"; - iv = "a0603273dd6cbfb42ecc98a220ad177d"; - cipherText = "b1fe4eef4b8e1f2f121b044b8ce3a5a3a95da4751c12e0cc"; - plainText = "54ee0fcf90de79cc698ddee4d48fa6a33d1d9f9670aa83ec"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 203; - dataLen = 192; - combinedKey = "a5cfe2abc117be0f414eb52c6e4e57957e45283bfb6b6868dbd1ac1f225abb1c"; - iv = "8bdaae3b9af4f271d505d7727066292d"; - cipherText = "80f4c032e0a12f4ac8ceb248516bd1273f58706fd2e36fdc"; - plainText = "98831b69eb1c1e1f292c6b861518822335bea62c7c5ced5c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 204; - dataLen = 192; - combinedKey = "a66366c4ea2648bbba447f26c3ca0fb350930b4bf47e42b874cdde59fa27bea2"; - iv = "e337aacc060c182fa07054c20913461d"; - cipherText = "2cc85ab3aecbc38e2f7f240dea82a0ce9c60422f6f70171d"; - plainText = "a3418229d798ee7c3cfd38088cc9501fad69fa366d55450e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 205; - dataLen = 192; - combinedKey = "f885552ca2eb4781a3f59cb68df4700c54d62ca55fc49aa851b601964af6b5f1"; - iv = "bc27d6f5c348f79728369c7ab868cc61"; - cipherText = "0036d80a988a111de21226949c2db534660fcb8380b7b42f"; - plainText = "6fb728817ea6982941439c63fd418b41d8aff57380fed7a1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 206; - dataLen = 192; - combinedKey = "28c561d7ae3304a06c79f362f9312d7c5e67155675d2e10975b28d04046cf800"; - iv = "024c9288eebd0e423cfff85f5931ea1b"; - cipherText = "3ed59af6a8ad4084f4ad58c8aaae09d9f88fd16223baf2fd"; - plainText = "0710579eaba9746e71719a731e1d16fcb0dd146f798a109a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 207; - dataLen = 192; - combinedKey = "de496c73fc5cd657c978069d3be80827053074d267ca40e2745d4aa2a13b57f3"; - iv = "6e843c9036a0e7461d78663c35aece88"; - cipherText = "a911e9e6176e7fe27d1b20425e72d0bfa2d8e98adb87eda0"; - plainText = "61458d7dda5c9aba7afd74151e1acee026ebb6b8c47f4790"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 208; - dataLen = 192; - combinedKey = "f0b6688206bb4cf2d915f533f1fc73d2b64f94444220606d30baa0bd51116a61"; - iv = "a3235b7f415906ed4421ab7c42adfec9"; - cipherText = "f8af835862cf1d76776cbc5307e5603279d8398db608741d"; - plainText = "b99e2c1bf4578112bb625453b13f20c88400ded6e6caa138"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 209; - dataLen = 192; - combinedKey = "0a80d9c0a55cf70235c4ad60dd087c8a7718707ad47b352ab118edca14e55519"; - iv = "b338bce1226a496f69bb4e99344bffce"; - cipherText = "e25bdf1ee567f7de0ddaccb6d47637e9c5e89d5ac2114ae3"; - plainText = "f57811de52f1eaf2223de4fadfd97a3d2b7013a0c2127a81"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 210; - dataLen = 192; - combinedKey = "7045fcdd61a53f938d1826da842ab994bab0b1d6682be5a5899e4d09ea642fe4"; - iv = "98d8326e7fafa2c2abe4b58f6abd7d9a"; - cipherText = "d9b9350ca53463283c96a7e7936b7cdea00308fe096cf747"; - plainText = "2285d8863bb1101e0c6a33673f616b524daeb1343bc999ba"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 211; - dataLen = 192; - combinedKey = "e52d9ca2151e8945e21240188e0bf557e1dc155f22814399c590489d5f0b32e1"; - iv = "7c6f901bb81312d80acbb8f9265d6ff8"; - cipherText = "7fd2ec8427485f110527460410ecfe95c835cd69caa402a4"; - plainText = "d03158565858e0d56a147045481a4c2cb2bc1e8a52c96d14"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 212; - dataLen = 192; - combinedKey = "64afda92bb22e04a1460b92c06cdfea48ef6bb05e64ce652901aac0baad02d3b"; - iv = "30818c286d60de69610ae303da0bdd61"; - cipherText = "c599c7a8ce5427c1dfa753596855ef49f472035afaadb58c"; - plainText = "0bcf3c3022dc4352bb6fb955b75534e9354f9de1b7b2ddbf"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 213; - dataLen = 192; - combinedKey = "c7a1f079a7e4fc7941a0846bc3849cebb53c62f0ff7db9b44559f8d7ef15bd17"; - iv = "dee1b747e4df16eabdd6338eb653141b"; - cipherText = "fd11ba730bc2c646e3c81534df1512d34ef8a89eb299d165"; - plainText = "77b5f9025c6b6d73b7eb1a550e6c4ba731d432cdb86cc4a6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 214; - dataLen = 192; - combinedKey = "95154951cf85c2be7190776e30215f4df4687cf150421c24ef953b62d06e2b31"; - iv = "7d0b6063dbb2d66c0741c3a6eacb8e27"; - cipherText = "578c313bb9ec619dbdce89902d5ee88297d9d944cbc4be4c"; - plainText = "2c8fcc4162607a80bd1dd77251113355f39fb7ede2becebd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 215; - dataLen = 192; - combinedKey = "6dc75ef6aa0023af870754ee2b5becbe54cde77e526e2ea28f78f9250eb0cda8"; - iv = "f0e2a89d7fc58e53121a1cacc66bc3a5"; - cipherText = "c991fb40e24c06f9e9a8309d7122c0a3d8b36fae7f0d2ba1"; - plainText = "bdb81086afcff87606861ef449e8e317573d10714c7cbcc7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 216; - dataLen = 192; - combinedKey = "3afdb1553b1868c537617d2353fb582abed81750f3917a8adc7f9b84e17e8159"; - iv = "08fe618b8ba077979d0072d01decbd09"; - cipherText = "95a187bac1e5954806435141b31ad2348aaecb1699d3fa5b"; - plainText = "8bb5d31f18366c99ba2b8774bfa6f57532a547348832a09a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 217; - dataLen = 192; - combinedKey = "4dc48198aed7d1f3d9cfb036140f0578bca45b0484b6a5068fb415bdfeb47dbe"; - iv = "87ec7b2763727fb53e2fbbcc614a58dc"; - cipherText = "e354084304e47d2ff7b821e03c332e37dabd00f19b9aa06e"; - plainText = "8a4721342c754d89ab032ee0e00e0658634759f33b9a3fda"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 218; - dataLen = 192; - combinedKey = "b6d2b5a6825385e8b88624330b8c99e7966b08bfcaaadd40bbfb3ac4e6e6f2e2"; - iv = "09a1caebf99b8554d77e1224ca95acea"; - cipherText = "69915ced84b168712b6729fe87b6c9f7a32dda5d1d29e163"; - plainText = "27686b3c949101b60ae2028ff6acd404c737e28a9c07a133"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 219; - dataLen = 192; - combinedKey = "81b2d10f9462edd7a5c6621a056d0d7e630c57b60d1a21d8dffbbd58fa0712e2"; - iv = "d863189b6a1c195e42816a412cfd1a99"; - cipherText = "a88c57dff8f6bb4ee1f23d05db75e6c29242086d0494d001"; - plainText = "b6199c91b6ffc39731943976de167158a20e7dd83d4afcff"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 220; - dataLen = 192; - combinedKey = "cdf1deba386039c336e72fb9e6192aa07e1080a74ff337dd87be88bf47bc15d5"; - iv = "b770d940d0d1e050f30979dc08a556eb"; - cipherText = "9632eff040f1c1112e05c5e0774aa1ed1228098800c0c9e0"; - plainText = "04046f6b287bb96daa0f40811d9b7fb333bc9d12a6d9911a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 221; - dataLen = 192; - combinedKey = "814e5e6904bedd20ba656140ddd9b18a07702c933f61f1b78d1db8698491788b"; - iv = "4da80288be5336d8527170a9aa664f80"; - cipherText = "350a4e3378b4baf65e7e469ec37dfa001a9057f79f3fefcc"; - plainText = "36c4066bc713d2c4664d1c907712ee611de02d5aa936a7f4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 222; - dataLen = 192; - combinedKey = "922f86f5f3548b3fc76420929076a7e068f922dbfef637b8de531fabbbe1ac1a"; - iv = "50135901bbf25882617d25c0601c0ae0"; - cipherText = "60b463cc7e03998751d7e5bba215c151f63104ca5f4b8b3d"; - plainText = "0fc8c8742b10b8f93f39938a08861543801e25898f6cd67d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 223; - dataLen = 192; - combinedKey = "a349bacb5590a3e576e187083861144682451cb8fdf127e1684da7f9daac1f5f"; - iv = "89e6dddd6d57f441c94c11ba0833b4be"; - cipherText = "b4eb8bd39a69143b49c47e0153a46a32ee36c12339826783"; - plainText = "e66db19df660b0c1560f2ed6bb61ee105842031bc9bfc0f5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 224; - dataLen = 192; - combinedKey = "38a5eaeb563b05b9d639139742453ee0542b83ed37f742c816fd204b4d8dc150"; - iv = "9634c1600eab4bf1ffb4522b7d64819a"; - cipherText = "56aeb276a65efa8db15492c6705fa920467400765aa46ec7"; - plainText = "0d88e7230feda9f43a2e644ddeb86ef718e72333cbe163ea"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 225; - dataLen = 192; - combinedKey = "fe0aa4f84024cdae7ed25e6e3cde1d664de9ed6f82bc2e812a7d8ca4445a1c29"; - iv = "9a50f294d00e60893d93b0854228e433"; - cipherText = "d41862f403a130f243de0eb277d9687b3b0939a133efdbfd"; - plainText = "e52a058528f517c383bb2f291850af82f6658a6960745ed7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 226; - dataLen = 192; - combinedKey = "2e09fbbcab80e8c90697cd3b9cc27ba0a41c2f989c7878d0cfc32ded64c94c70"; - iv = "5bea661e231d4cd4e959b18e871ec21c"; - cipherText = "9e87abf1a4ae74095177f8a7c4888219594c410ec03bfd22"; - plainText = "f9314409f633f878c6636d327112a4b870906b3ea8c46d60"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 227; - dataLen = 192; - combinedKey = "fcc10301330bd4c7dd044b599f0e9502a423998ecd6ce749204ee78511422913"; - iv = "3a271389477a530f87f3f32efac05c15"; - cipherText = "d57018de06f673839c67fc980c971bc12838a9cab02799b5"; - plainText = "f352c5d3a25fb3e98f76becbcbcda70a176fdc9d1d678128"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 228; - dataLen = 192; - combinedKey = "5a78ecf8284ff5ccdaefc707d392ff19352460877dabdd24257b98ef36871c98"; - iv = "1478627ee06cfb615d12e2f35c524216"; - cipherText = "af8d75f1be37173bb286d5006b7a9f405ca53a10fef9e101"; - plainText = "2a40eef5bfa6c7386158550d7fa6f087d3826f63f900ff3c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 229; - dataLen = 192; - combinedKey = "d6e18cab44fd2539a77f2821639d4115e7c9595ab7b1531edcd706f239100ee8"; - iv = "b8808022f3ac4c7e08bf7420c765d343"; - cipherText = "5afef5e1f44998dd5f886516d9a46a254737ecf722b67d5e"; - plainText = "3e9de6158e86ef4badf981923195887b0250db005ee7b0ce"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 230; - dataLen = 192; - combinedKey = "19a168422a6d9635a6e9c4e90fe4341bfa50e0a542fdc4d2ae2fbf3447b85859"; - iv = "0bd5cd33237dcf5266fcbbddfab64a24"; - cipherText = "0b681731984a0e7d0a733670fcb6e9fca9e0bd924ae0db56"; - plainText = "1c064cff0448f17f3af699912b42820b9641f5033172a239"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 231; - dataLen = 192; - combinedKey = "0e5c7c0a384fa33887f3a14e576f89fe5ebadca31a043e25ccd0135a0cc0f6d5"; - iv = "7c669f6b8194a5977a3cc2cff83e8a07"; - cipherText = "d3798da1c1e3650f040ea61c9ede55d5a9e2eb7c2161b62c"; - plainText = "850b5b3d64ac70cf15e5b93579de09f87cb88666a77469fd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 232; - dataLen = 192; - combinedKey = "f5df7c36aa43c2a0754cf8c0fdf71b05b75b3833149f2ad4384dcdab5c379a60"; - iv = "9132c1e346d69bc8dbce42ae549e0212"; - cipherText = "c7fa084761c94b7d0069a5e08c6efd3de83e78b575933427"; - plainText = "0d25210c3e537ac814db2451d80732b971b29c3e265e3adc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 233; - dataLen = 192; - combinedKey = "d18aee6c4c922de9029ea18619f2cf0f0bcdbde76ceb04652b5f1d48ec1f71d6"; - iv = "9be9b4f5be5df98f729a26e101d65e31"; - cipherText = "b9aa24cbec375f66af35a8f703c45e620fa19a5dc09f7996"; - plainText = "f53facb4e5de76b2679521a3288e0dc160b797fb8d6e1917"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 234; - dataLen = 192; - combinedKey = "f4337f3c0cd23c97399bcaf8239e465ab1291b0d9c8efafd6d5ead3933cf3d79"; - iv = "00945540db52cca1ae44e9676ea32921"; - cipherText = "f6cf494908750d87518e78bccc19f9b85cb538d149028b16"; - plainText = "ad346eb800db283fd5dc87cda76e2c9e61c3cdbfb5c19ae4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 235; - dataLen = 192; - combinedKey = "7df720c967a1a33f4c21b267099e15e2b38289921cbf7e51c68debc62863fe2d"; - iv = "ca6948001c2273dfaf8273be8f44c587"; - cipherText = "d42dcc781dc0c2433c62b4f82ce286c7539a9686cd660877"; - plainText = "6c753ea2b9b96a9ca0b1d85138f8f6d4a1447c9d64a5cfea"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 236; - dataLen = 192; - combinedKey = "4bc1ae52f284e9dab4783949bfe2147d2cf6ca16cb244bddaf50bb0db5f93aaf"; - iv = "b274395b354f14451c42cad075b52547"; - cipherText = "40a655c99f0668131716047e20ef7ff825786eba902d5535"; - plainText = "266b58d675b9d34051f34155bf5366f0119fe1db589ffab5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 237; - dataLen = 192; - combinedKey = "c545f892e1119dd8264edeee9f8b6a869ebc5908954df37354e81aa2f1c1f7c0"; - iv = "c970beffd28ba86519f4709444fd7b22"; - cipherText = "4c6da9cf6dec8f21e7b83780dc5b6164dde9f2916d8dd89d"; - plainText = "254f2be7209fbcc428c0da9a9075109dc5bacded625d3109"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 238; - dataLen = 192; - combinedKey = "04eef3d3fb8d258a54c5053800c4811fb260f1fd7c38fe2421d09c01b91c8c62"; - iv = "2dbab7e04ec4ced492ad2f6725b85b04"; - cipherText = "6bec13704f0602f0077ef189864208b011cb9a3279e30fe0"; - plainText = "cd1b9aaf4612fcf48d284b67f5f83cb4ed52b4378a4f675b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 239; - dataLen = 192; - combinedKey = "2f950196bb190ca97dab458c2f1674e59eaf8f4f75634e9b1daa7373c45794ca"; - iv = "c37858b04bb23ec911c5b735838daece"; - cipherText = "fe26cdbeda67dfa728a555f01c2656ca2cab449cc4f23e8a"; - plainText = "d3b09af91cb70a2a43e31eaf82577b0b85ae87aa717ccce9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 240; - dataLen = 192; - combinedKey = "cacaec051f95a7c4e36dfebdb6e82e6cf8795fc22a11693d0a8a1888a1044e1f"; - iv = "9c261063c5d09841e588f39921147ef6"; - cipherText = "50726a85d6f0ca268d31b9d1c8fc6c018e0820996f390d64"; - plainText = "98b57900106916f455f214a5fc8ed2430082edf8098db385"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 241; - dataLen = 192; - combinedKey = "43a9191ade36d59bf18802c17a20e65ad51319c1e83c2568f9482b13e64cdc12"; - iv = "3985a633b344de5073d9a7c175f07664"; - cipherText = "44a775f3c3cadecc8b59b35628e5bae002c63720ba51cae2"; - plainText = "b2cc4d1ce682d355f8dae9b82368df138a8230b3fa163e04"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 242; - dataLen = 192; - combinedKey = "92778b45c8959b8ab21ed47cffb1155e59f4c9b07e850a1848fc9720a0a5d296"; - iv = "7c6ec0a8593591213195f51731525467"; - cipherText = "6001c5c20b5904f8f3f411867bef18be681273aaa7ed71d3"; - plainText = "eb660b12f22105ed2f9a35d1ace168cda9ea5a29493cdb95"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 243; - dataLen = 192; - combinedKey = "1c2d0745b7fb5f0ab0b3939d33828c73d96c0297c3568eaa15e2af008fbd2445"; - iv = "c8e9cc14629de3ebca3ab6154eb954bf"; - cipherText = "55fd57df44b57ed1467fe346ea569df90f73467c74fa5b92"; - plainText = "0eabd66ed2a57751a7437bc2514a4499587d43b5a674111a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 244; - dataLen = 192; - combinedKey = "f1a310530249c9ab1b0f0fc22fda48916a483743f98986f58c1bb394cf011317"; - iv = "887bb0e8019bb2d94845d6dd6654a111"; - cipherText = "b0b96ef52b2de944223cdd67cfe88f25f9439fbf74c0feb7"; - plainText = "4898415890ed58ffebaac11a77aa4131f5d4f2ef2cc53e89"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 245; - dataLen = 192; - combinedKey = "42f42af2af3a7bef1d659b9b98621c570c40b455bdfb2488cbc3e43e2e5d8746"; - iv = "82f843af20b9c1b41734ce81546d2d91"; - cipherText = "e7ffde5eddce1cd4198f920abc150ad31f7ca43a553cffdf"; - plainText = "06e569fad67663648c73fc0a32b011733b0720199bdd699e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 246; - dataLen = 192; - combinedKey = "78bb511b69f34547cc4ed24b61aa36e11068f64ecb838b675bc47cc950d86f48"; - iv = "f8386166321ab37e82b52accd718c588"; - cipherText = "0e0a079c0bfc2013ccca26e62289d88ae27fe1d81e79f819"; - plainText = "8559b133f68dcd86802d57525482b0a8e6005f3f7496be9e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 247; - dataLen = 192; - combinedKey = "dc5b217fb7c25383a2f03b7e565b552e38e66db51664e7403874f46378f5a662"; - iv = "c0d0938a0b16bc4e9ccb1aff6e9966a8"; - cipherText = "40e898e3184fbdabbeb20890e9ce95837a9b67d7356c8b20"; - plainText = "09cb6973b8bdcedfa3fcf35d0bee7c32d16d08111938caf7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 248; - dataLen = 192; - combinedKey = "37179c0d92764a913480e0d53a7825181953603b26561c31f736e93846454670"; - iv = "a2c95a2863220c18a40cd56e7f78ceab"; - cipherText = "ea22c0666ff1faff1cbfd10abea78cc8d0f3fb9a9a6482c6"; - plainText = "99f90218cd547e659a61e9335dbde18ef70bcd04422f966a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 249; - dataLen = 192; - combinedKey = "856e5aa0a6dd055afadcbc5d10dc0d453fd8c0cbc54fc9c3e2c2b61928b798c1"; - iv = "6ec307371052c5b1b4497b285b21b747"; - cipherText = "99bf7d9d8c14cbbe40da985bea19ffac56686dbbd13ed03c"; - plainText = "fff6ae06631004dc6feb0e52ea3ae00ee5e2a8ec4e5d39a1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 250; - dataLen = 192; - combinedKey = "dbf9911d271a2a1542f5bbadeb571bb5e5ad99a19611161b992e598649c9ee04"; - iv = "e3b5ec8e45c6eea261a3fbff7f7ff7cf"; - cipherText = "c90f8656bcb48d9bd9cbd4b3aae38e6dea673fffe2feee49"; - plainText = "286cb853533920f3d7379ae11a3e5ada23f670c81dc859b1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 251; - dataLen = 192; - combinedKey = "3c6539f385db825be41043258f6eeaf7ac7f4908999827b1664cc58c8f6fb4ca"; - iv = "54a9863f9553e84bb6821df71c25798d"; - cipherText = "cef73e9b6d063c90d030f50ab48368dc9c8519e492774b1b"; - plainText = "1b23fb980036b6f566dd4db2debddf6257400de0087f1b33"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 252; - dataLen = 192; - combinedKey = "506f93545d1c81faefd57b18cb9c95fbb502f3afeb098cc55f5a8027d7d5fe8c"; - iv = "7031715008661093a4e5b7e8cf5dc393"; - cipherText = "833f6f65c8b76e495b012392db993b3c1202cabf0c90d548"; - plainText = "de10773dd5e352b4fdb76434154ea167ef946add19265015"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 253; - dataLen = 192; - combinedKey = "2d9c4c89acfb1f88528df9227e2fc51adb27ba345e0438b2c9821b981cfcfac5"; - iv = "a8042cb86ca51dcee1e2c6b239c72637"; - cipherText = "bccd74df15590f5a5504185a97f05d56fe618493bfe103c4"; - plainText = "814d8e3fdbf096ef0df5fa632d18cfbbbea939207232ffc3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 254; - dataLen = 192; - combinedKey = "c6e1c64b5bb778abb80bc40343f712f633ad4a562730fbdaaa20f85713ddb4ba"; - iv = "52d99b089aada7e51a6de7d6c4a52b15"; - cipherText = "7cdd89b32160d75a078a40403f2b1c92ed854a353c4a0266"; - plainText = "00477a06522cad6b79efd7186eaacbc3bf2b2612ca42ddf5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 255; - dataLen = 192; - combinedKey = "22ad05f2c2cc63ac85f20b3083e014a8394e2b2294004ca847ddea2d95f32447"; - iv = "9d7aa7e1e1c6279b13a9b23bbcb9d6bf"; - cipherText = "aabbf784e41c0c88752e37cfcc6d0be9344ff0faf783528f"; - plainText = "9c357d6f471aeea88a08ca4a0add2e15bfa8b7c088f1c74e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 256; - dataLen = 192; - combinedKey = "c0823428d658cd7a91611e14e066d5ad6f0afac02d385e1d15751301e8b70209"; - iv = "0f1b9112ccdcbc77ff9c8a71f33bd206"; - cipherText = "e797ea64a27866d6c57cd6eafaa0a5551a26d52fa73847b6"; - plainText = "148a148418e65f782a3bdd7216d4268dec835ca5ef7f0475"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 257; - dataLen = 192; - combinedKey = "bebfbabe51b549df2dbe119e5028bea7fbced030925eb1b67844081587d3d128"; - iv = "fc960cad2edf36aea23dfdf850848e73"; - cipherText = "095e21cfff97f2734dea0de39dfb76b6b65cec9da516d135"; - plainText = "e6d43c497c45b38e9e7e31c4ea1f097ed048d438e73e0fc8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 258; - dataLen = 192; - combinedKey = "e6f9d5c3d38b9706f43414d2cf921f043d2e46c50c751aff983d32640267f680"; - iv = "a092c52d6b04b1a326252addf0ddf156"; - cipherText = "0cf63270cbf86d3351f2c30b197de522e782bdfc06f1e29e"; - plainText = "cf8f35dc290578c0d49a89ce39c67856a522a81a697177b9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 259; - dataLen = 192; - combinedKey = "33cd832ec2f51643490442b8d5ad4a24d42a78129c30e634e517417967b7917d"; - iv = "d6f3990e1725873b66a1f61aa8ae3aa7"; - cipherText = "3fe3bd9606394007bbda7825991253bfffd6953ea630b449"; - plainText = "59f6a782ce2a52987cde47961c27d4fdd91e691d0b263e04"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 260; - dataLen = 192; - combinedKey = "3b6af083a86066303c5343fd6263ef8c86665ebc0a9f2f9ea6f0d33cf4fcaf22"; - iv = "ac6f4174022a04ea8c8807f2b2a5d5f6"; - cipherText = "b35b67f6929c29cc6e01e4f2fec50ef85b988550a4b1c2f6"; - plainText = "ba98718e2db244235e9b02b6937ac07e08806322e9dc2e8d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 261; - dataLen = 192; - combinedKey = "b18e73a4ffcd0ea9c37dfe9c5d261aaabca3a62ed8a6a327e1982067da2016ab"; - iv = "e4344bffcb34ef91bc0c01f0e966a12d"; - cipherText = "d15a6cee8b071079d8ceeebfc5390f6dfda6435fdf7a2e20"; - plainText = "b3c99c099d4b7dee3163cc5ef76b5424c0d574f7ddd5ac0c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 262; - dataLen = 192; - combinedKey = "f021915b3047ded9a662db5a3df4a96e522a672ad2bc12b1fbfb6926e6872df4"; - iv = "8dbcf8f2eb311de320481766b2f7abf0"; - cipherText = "27a9266024a46c7f49af9db030d340bcabb4cbd751521e16"; - plainText = "4ba8050a53fb9c0c30a6312edb0a771cbdf6c4947b4fa186"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 263; - dataLen = 192; - combinedKey = "8e672b1d706266ecee52427826b6ac5ea7974f8fdd748640482d4beb2d7827eb"; - iv = "6f1f207a6ebdc885b908d0dc05241391"; - cipherText = "8bf44fea0006587899af41a95951afb5816c69fc9e9f1104"; - plainText = "576f6f30962d0603442b448bd092a97f7f2cb7d49f13ef74"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 264; - dataLen = 192; - combinedKey = "25f18bb1cc6c3b253ccdeef499d324438078518d93e7d78bc21b0925dabceba0"; - iv = "057be1fdad15d66e95434227a25fd1d3"; - cipherText = "8c28ba992d7bcb4a1757ff44a17754daa08c5aa99cbef8a7"; - plainText = "4af6742586ff69a5e470f0eaeae054726e0afa6bf6a1291f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 265; - dataLen = 192; - combinedKey = "05604be5a0d856c825190c24199eed707a6f56a7546becbd4002e4681772db55"; - iv = "4cc1847c96f9b4a23cc88d03bef691b7"; - cipherText = "cd350f1a27d82b69a28522f72d93eb629c2a7ad5b330283d"; - plainText = "1c210d54daddd673c3e26843085184a22d48f63103f135a0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 266; - dataLen = 192; - combinedKey = "b7282d5a5dc6ddb6b1fb412cdbcd2bf2344d3d83d3942dcf029043ec3b49e583"; - iv = "346e63977068b94be364d03ec221ba56"; - cipherText = "639faead01efbc42491837c947930d0d4e7c515e3c918a72"; - plainText = "e23444f9c1d94209ae914630481e7669a2b6eedb8a37ce9d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 267; - dataLen = 192; - combinedKey = "1f53e3737ccc9733d314201d794c39cb3fff8fb05e972a684fb3d2fa41209d06"; - iv = "9318bdbf25f7f97542ff0330ed299daa"; - cipherText = "8f71acecf0859280ad385bff0f1b615199ecc56be832ea14"; - plainText = "1a8643c7808e37ef7bd403d00342d6941f8f35ab26f196bb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 268; - dataLen = 192; - combinedKey = "4ab37e0e3ea876b86dbd21c7a19e019e144812a103e341e83ace81376542f1d2"; - iv = "8629a70eff99f3ba7e7f13abf434aeea"; - cipherText = "4b55b90dccf8905a4e5d4f6231984345c6311125d527b7ba"; - plainText = "04a7e41ccbcf467ef71a825fd7e6bb29ae535fdec10fadbc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 269; - dataLen = 192; - combinedKey = "ab2c68c3ac2763d1a2efda6d8259d4a376d67ba9a9c14a349185071c7a9bfd24"; - iv = "13ce994afdc6500f462a29b0f0f46bfd"; - cipherText = "dd0075b1b26f86e4592b08015f552caba558453492676750"; - plainText = "2ecb4f7ed8e126d65018483eb61753c894e79a0d8c1a78cf"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 270; - dataLen = 192; - combinedKey = "4319783ecc1e62b31da7eb15be41531fd322d66b1273a36e4112ac641590327f"; - iv = "d9da589806ec6793be675ec7061506a6"; - cipherText = "6b835e14371e0be2f7087877fc207d18f51d1bbbb33b78ea"; - plainText = "6a21d529f384fcd572b264fae57efa8710ac79cb01d87051"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 271; - dataLen = 192; - combinedKey = "a6d00774b77baaf33bbb771af277d350fcac3c1dfdb7d95b41cf1fee6f1c2005"; - iv = "d22b3c9809b3fa82e04891c628fb5d37"; - cipherText = "ad3a6eefc8e35bdc29c43cd956a11115d282d4a9562fc4dc"; - plainText = "ecae03c6709c405f04ceefbac46c774f99a05d4fb8176ada"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 272; - dataLen = 192; - combinedKey = "b93ef4998b8cdb33bf10819d1c9b169ddc58ae667cd164fab6b3a10bc695f7a2"; - iv = "f35dcd480274e972936ad7e96cf5b0a4"; - cipherText = "336d6d52cad7ce8ad6fba95ff4ab0448cc35d4b0a0c145fa"; - plainText = "77e8795efb97196e25f0b974a6d4d4f3bacd70aebb55eab8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 273; - dataLen = 192; - combinedKey = "2ef6ada69142746480e41d5c8493954f36856c6b4716c9372e009d78073d35d8"; - iv = "6d5226ff52d960c66f01b1c3891c49f9"; - cipherText = "4a1badc3e5db6bdd565cf06fe4283c92378bfbfa7510a644"; - plainText = "fbbbb4f0714c0e133e1a7283412ecefd3e6c990ac2b89259"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 274; - dataLen = 192; - combinedKey = "526bb360150a589ea0c78e3c5025763cfbf0d02d06d5fffdb21da24e3d63a0da"; - iv = "875bb9f444f5ebab3b7b7c3b076eb399"; - cipherText = "ddc2528026201652c98af5dee00ae1ae734cf53f26f71d25"; - plainText = "ca62f0b494926b4d2b527a766c3caf2c172614a95075d716"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 275; - dataLen = 192; - combinedKey = "6b4d093bf308c5699e8abbb2c9f8e302d71e66cc5016294115a4957246139afc"; - iv = "2a9ee71e5371293e7e891d8263c54bd3"; - cipherText = "4964d7464b4915d846b42e2d2a6cee9969ef5ca745e3ef2b"; - plainText = "9b9fc0c619eec605fb7dea62312cddbdef47618998999edb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 276; - dataLen = 192; - combinedKey = "3a25e50653f6b3c984f6626774e1ef8baa76ec4d88788fd1e34301a3779546d8"; - iv = "e3a11fc57cff9f098d54eb1f57f35328"; - cipherText = "6c94d84a1de1081a5334bcfa9e3b4a91b65b5c3ed5140d5c"; - plainText = "4821b000575b91c9217113a2ac1a68f10fdea52026b3ea3b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 277; - dataLen = 192; - combinedKey = "3c2261a5c8d6f3af03d49493860ea27ccceda8e8ef1cf0e6f02db08c6b533f5a"; - iv = "d7dbae835e5964861ca09f6741afd19a"; - cipherText = "9839972e4706f9beaec7ad67eb32a4bc0a6f7f95c88d07c2"; - plainText = "8707a1ba88df08a0e66635c1256478a8bef7660d0e6d6e29"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 278; - dataLen = 192; - combinedKey = "5bb878f9dac5cabd8165707aefdca901bd5ee221f315c225578fe53f21406f60"; - iv = "1a63d98e8d41309dd23e4d4ffd82c08f"; - cipherText = "a8fe6a1ca14a21661acd6440f78a155e93c68d290b19ed59"; - plainText = "50de80ee005e6c965bc0f4e06992fa7412ebdec7bce0b4ad"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 279; - dataLen = 192; - combinedKey = "8fe2bade3d6a3be15def160d78716e1e2b5384ab524437343341b7c49b09e503"; - iv = "7b9fbd958b0a4ebaac966b05de9de33c"; - cipherText = "b8e07dcecdb738fcd01eec36389e05eb581f800005ce7277"; - plainText = "60dbdf61fd4e8c39cecf2d4567dcbe906215bb4ac55f340d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 280; - dataLen = 192; - combinedKey = "bf908df02fbd434b64f6a2a06905f2c50b585bfbcc9869259137a015cb4ff0fe"; - iv = "a5971fb40dbdbc72dd4584ab2226b5b8"; - cipherText = "6aaed421014cf4fb0eaffa1a73e9ffa03202145e1349d8e4"; - plainText = "299771630de17bc6ca5b4a11b52c4e2a9211f3d48317cfc2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 281; - dataLen = 192; - combinedKey = "795f194094d6313a3096df84652f4997e4bc2e5dcfadc48db2df0e1d9d83794d"; - iv = "859d13fe4589c239e7a9c941581b9a86"; - cipherText = "0d20326d0d42dbb94a82e0f2227e013d7baa927fd6fead02"; - plainText = "f9ee01b670413e68561be53381b12ba0331c951d35320a3b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 282; - dataLen = 192; - combinedKey = "53dc82c517ee150447e4b8e4aae03c944a7f526ca7eaa46b0c6286edeea0b823"; - iv = "f6882d687f62f9469681025cb3393aff"; - cipherText = "f5026e6b88870cf63cef54039f8cfab79f38197bcb3d4400"; - plainText = "6eab0616182d1814d3664f4a6d08aeba7f9994dcf7393efb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 283; - dataLen = 192; - combinedKey = "8b7eeeb7a8174106c6b722bae9c15b6c02522b1002e4319c75b53cb3fbe4b2c9"; - iv = "56e3d925a3eb658c40d45a720737f521"; - cipherText = "400d7265bef4847a4f22799a4eddbd03a9ba853774009b32"; - plainText = "6110bb87f2c04fe3a6a27f72d69f4da7e1d59e3f3a41776a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 284; - dataLen = 192; - combinedKey = "50c967f2a28b9b8731caee3e3cd541804027aac598bdfe5d942aaa9b5ceed77c"; - iv = "1d69becf315931c19ce07e98e1213490"; - cipherText = "cfd1b4810ac8e1007e562490cc54d112af44880ff11d2607"; - plainText = "3b41ef3643412ce78d8f48a389458704c9921a4e426ad101"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 285; - dataLen = 192; - combinedKey = "81803f16b11117fe795391d257913ffa15ee6d7c7d7ad0ec220b87b0d3985c84"; - iv = "263fd129a2280686c7d020b8c362b579"; - cipherText = "80fa8d368ac6b54aa8fc7b02c4f47478e0731c130e0f67b7"; - plainText = "c677bc916b9b4918fea99fa323d855d2fe9c8554fa2ae6f0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 286; - dataLen = 192; - combinedKey = "d46717db33a711c0f83dce005a81119b256f18eb40ed386a1324ee0d045ee218"; - iv = "72fd3a84c389a7b6a7964857f0d27909"; - cipherText = "ae62f9d79da3c125d3cf129dfb9a24d0775396453a3d114e"; - plainText = "314b52cb70fc08b6e00e3329b423ab8220f4abe97a8ec66b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 287; - dataLen = 192; - combinedKey = "b874a4b4e1c89318a1378f252201e6071ac1f29cc51bdd0cf07e3837dba3b599"; - iv = "d4f2c48d2e6d2784e4553338a9a116ae"; - cipherText = "8a4b5fb8213d4fa10d880a6beca0fe02c222b18e36016098"; - plainText = "f62ad113c5119e362d9cd0c3db311f861c21306206b43105"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 288; - dataLen = 192; - combinedKey = "cdb34ebd3237a0f6a8f6fe8f597d096f40b28ff91537d8ec5b3028fccafc751e"; - iv = "cfe5ecd6cfdd68c6232dd507cc675c89"; - cipherText = "3182b46434a398e0d97bcbd3db0e67ea9eb4c189762c523c"; - plainText = "1c215f425d19bd155350a7b11e42629759d1d179f6924b64"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 289; - dataLen = 192; - combinedKey = "8da4b1757f9df68bb6649d8120a9a8a9e73d4feefc2d4604a197e8c7b7fc96ff"; - iv = "a243617f7975e2bd76a3dc2eac1fb10a"; - cipherText = "25c2899afbfdcbad01bcc6a3c0fd092e5e26d484ba82e043"; - plainText = "f5aba9675c3d634c8f4c25f6a568eb488e8822fd4b1390b5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 290; - dataLen = 192; - combinedKey = "fd9cab477e7da587d87f0140916c31438911e1f0b71559b2138cdc3c214f8f5b"; - iv = "e60797b45543aadccdb15dc4666dc01c"; - cipherText = "d38695569224e856ea32f643538690c2e26c74a12d774d3a"; - plainText = "f7dcdb3f80b938e058951f067b9ecbb952c8d0912eb5f2d0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 291; - dataLen = 192; - combinedKey = "3de3c8398322dc3cc1f2089a3d41deaca4c22f5b07f34619a7c9c6944228aaa7"; - iv = "d835925649886d37e54350e39db941d6"; - cipherText = "6990ac32da156ef05edfec2ece17d76632c007309dbec7f0"; - plainText = "a00a3486f8de88e2d742171ff37eb7faef4358ac3de6d5fc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 292; - dataLen = 192; - combinedKey = "85201be1944dd15245b28ac29667fae1ce4c75f7d87e35ebdc2a99251bc8cdc5"; - iv = "8b22a3c15383c833154c1f5871e72a91"; - cipherText = "5d4f04b881cc35bbcadb0349bc3cdb0c51714972961c0959"; - plainText = "7b58d9117c0462b236d02b0d7d88510eeeeffdd21f1b5c55"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 293; - dataLen = 192; - combinedKey = "3ce73e6e6cc9779e5db3e4186fdfbfcd55be742d0c5348731d18a51352aa555f"; - iv = "6c6e7250869f27dfaa99d2cfff348690"; - cipherText = "efaa81fd7505fffcb3b935c5c5c186daed5593c485b79cd4"; - plainText = "4e56c9a161dbf153d8fab1aae1a47f2de701fa1e4c4a022a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 294; - dataLen = 192; - combinedKey = "b0dcc402fada69896e4695b9e8099d78a33ac610b56e789a769c84fa3edc6168"; - iv = "5b8a86f776218a55ab82b72c4d3b298a"; - cipherText = "cf8b9adb920b412765d92912805e0a6288fbd898a7e74815"; - plainText = "e5bc70cc2cd0084c2c5fece9dcf7256bfcd0dec3d0ad17cb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 295; - dataLen = 192; - combinedKey = "2e025dbed06870b25f584705c71ef8a0acfd5efb83cb1af14cfe396325cfeda9"; - iv = "8375d05b66cee52a7da31135e086c4d5"; - cipherText = "bda725302abf13a0c478f0a9053a904cc02aacfeac74afc3"; - plainText = "8d923510a8db3db577c20054f03520db6f6c834f39077a1e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 296; - dataLen = 192; - combinedKey = "8be81b4cc24125e8f9f061abbd9524fae28c15504a9c2e74b605df23c3b74e2d"; - iv = "f842f8de268e27d6f16ba9d83cc79ecd"; - cipherText = "5af7fd98966967ef68b0df75f0a08f1efe91b0656263eb70"; - plainText = "05a953528696013cea5076908ad754a16be9bca565290190"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 297; - dataLen = 192; - combinedKey = "3dbf8db94912fbc2ad7154cf27ae417d414cf15d7b288370e967f8c2e13e6a89"; - iv = "495c1427487676c45b9b55b21e63953d"; - cipherText = "b58101f5d6ded0391409e6bd56d2d851b66e4c54d241d32c"; - plainText = "12b828f0f4554ef7d730f69b89b0bf048d83c475c525a44e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 298; - dataLen = 192; - combinedKey = "f061c5333c3b8a50586bb14f0fe3eee3bed44fbb4fefd4c0708c745be296e0bb"; - iv = "a992611806407b927de9607e8af35973"; - cipherText = "a5dd2cb2f2f88da6c6d733158861275da9f2e7602c1059d9"; - plainText = "837a76efc7fa2764e31839fdc0918c4d66bd65662e041066"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 299; - dataLen = 192; - combinedKey = "5c850ebada3491074a4a2c66e9c07ab1e045ec46a1302b38cba0bf5b783fd3e3"; - iv = "ab8c31d1e3eebb17216386c68f12db8c"; - cipherText = "eba7c9532843f94077711f80620f9be4c408b0fbf592cf88"; - plainText = "3179cfa3983a0ba0881926f60eab26cfe0606d536c0e62c6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 300; - dataLen = 192; - combinedKey = "aa30a1cd55cee59d725e92454f2a60ad311b0a84c21052fff288ef1111bd46e0"; - iv = "5952b74c1516d2e18cc2c66c81a82b7e"; - cipherText = "5931a9cafd4a99efd1e1add98f97a6a797ec360c8dccd34e"; - plainText = "95179e8bbd1c532e90c768f12975027ce3715d830de6002a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 301; - dataLen = 576; - combinedKey = "bcf42fb904c73bc69001aa68cac17057151c2a17127a2b0a7b5eefb7788c9998"; - iv = "5b06a729f8e7f0e7bf10cd505f37894c"; - cipherText = "329312ed259daf871a80bb617d788496ae4f9f6014fa2956d8fcaf5ebb1bb4c6cfa3a789cbb03272018b70d802282e84c023860bbe570bb4a2f85f3f57fe2ec0c5367a6256b40e8b"; - plainText = "f599ddeffd6743cfa0fafdd219007d926e1e165131e98e54bb049dfcf7b752911b059a415e6dc151630141424eaf41ef6e5cf0c68f65604b27f58e743ff5a83ec037bfdf931b575e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 302; - dataLen = 576; - combinedKey = "77ea2981e2a36a0453d4262a03b5f386018f8045e5814f24987f53ede7673427"; - iv = "2d0b2b82176700ce9b87e8932b41730a"; - cipherText = "41371eb8843db8f78bc7063d4f3d9010d3b8684c510574291b359b35e8d059c733d7780726770a4549feb874915d1d75390c7646689d99be99555903e568c1b1f77c101ff81ab756"; - plainText = "6f48c6f5edfc08d666fa7b6e226e1619a4b8b1b5a5552d4fae9dab207e28c67a2c5c7c3fbafa1f8dfaa4f58f32f4dfdebe68e258a39ae61ee3c647ab22c21c091bf7a913c48d6802"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 303; - dataLen = 576; - combinedKey = "e929edf18d457a59c3a3315733b02b0bfd76921fb11f39109688659f8029616a"; - iv = "2a6bf2be5e5c009e318cfadaf130689a"; - cipherText = "76e179b3ef398020ba3579bd000e5c3d65a62c8964778203e77d5f64954f6933e2af5dc100cd72c9c4f810265ba6d543d8658a1e721639f2615c46cff90a682bfafd14513e43fc58"; - plainText = "387e19aa685c6c4469b0260f03ff80853525d036a26fc3c68a678dd49c70a2c251edfb94dbcdc6e810fdae4159ccad49b43d09a22c16f021369c526b1ada0f4a3c5b3943324adf24"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 304; - dataLen = 576; - combinedKey = "0f4896fe264b57fb7d28265eb12cf01227dbe5ccf96085b022c7caa1c38a29e2"; - iv = "8e771908edcacf29b7d135a145ecf1f8"; - cipherText = "35ad466405071005400688897222cb7d3bc63d6b120559ec936cbf3e745928048c7ca815a7f051548d1f78e7a47e31fea7e88bf8ec8278bc76f20aedd9be3318d6852a7f7a5b2483"; - plainText = "350228b649cdb6e4c79681f92ffd2d702747b2714b959b7851f02ad2b71d8c2d4d7ab861e347af5ba4483cef6dc57ff981de6e90b24d01fd694d722fe7ee2c727aee2a00c081b1a3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 305; - dataLen = 576; - combinedKey = "c9d027b3762ddc063d0d19968cdaa28a4b73a140bab5a991133e2ebdad53b23e"; - iv = "a0b55d83accbedf9977cd1d73689c1ca"; - cipherText = "fc28e6e172c6f4528746429634db328a3a7376f3bef73228c5578a8135de61986e165f2d63ef2a73e7759a008b403eab71be5aee213d8cb6b38d2c95f6e9191bbb8000162f948c9f"; - plainText = "931d74b14304b7b1c3b5dc4033a24782ec14e08b107c1220f88f42a13a3d3dca7fa429635e71abe39dabb646d3ad121eea5989de79771cd61ad1f58227adc25cd5d4700d073646b0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 306; - dataLen = 576; - combinedKey = "8b23704b4b330fc9cc3934d4d993e88e6ad934da7d34a0b724dd1f8ded11e04f"; - iv = "a3cda7a6faa3ee0353db67548bef80d6"; - cipherText = "09403676929cf4cb52f5e2f7374a975182f10e2ebb1cebfa0e4d2f93ff5cd7d7c63c332361af48c69bd7d047b12cb192cf52b7b723e2c245188f4855cee23e7dd19640b8c658e599"; - plainText = "658e5227436713dda77295d31e6b09bf49a4cbdfbcb946ef7742e3d847827b5a5d4fe3e1ebc7f8cd2064af82b185186f7439c07832b38f8fbee4a331cd5e3e7a98d0440d80d32a42"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 307; - dataLen = 576; - combinedKey = "bccdd0d3abb476a932a5eb0d3cb18929d2ffaf5ff6aa27036e9329c3044f7518"; - iv = "9a742db1db3583e45a21cbfa824f51d5"; - cipherText = "471eaa265f9b0645665bb4cfb1c8c4edc31a329f102869e71ee5e82aea0238f5618301fac2ad0bd5bd31299c9e981bb5262dedd640a6451c438243223c3668cb44f3973f0d286793"; - plainText = "6ce12ba0973c798606e74f0155169423189dc79aef91ad534425fd4353b3c1dea154b1d58f48de2a6bc2bac3da483934319a380dee5e7b18d7b84a525717e2900c28cedad47479b2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 308; - dataLen = 576; - combinedKey = "ef75c1adea471dcf8cadec5ab88f764aad7d9acd24c42b60edd5e33c1d2c823b"; - iv = "818c9a65126be4d024a31945db64292c"; - cipherText = "3a9ebad7f73e9fbcf7527c04b6d0261f8efafc2e313e9c951843219b4484920f637eaa16aeea2bcebdb3a4f53f53bce8dfc67cccd941a8c037149a9467a7c58e36e44e3da7b8d566"; - plainText = "78427450f9a5c3d08e6755f69125820bae11e0ae734248a9c3bcc7b63ec79d481d5cc7ab25e420ec2447b1560eadb95909624de8e4993c06256be0ac262d15b889797c79bc96c80a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 309; - dataLen = 576; - combinedKey = "987ff0d9ead572bb969edeb0d2449639828facd94cbb8a7c88f2815b491f5e74"; - iv = "cd6f1e7bc89c6e173a4e84b63d5b381b"; - cipherText = "180022a51f3208f39fefff06965f6e9e6425d9ab251d83751b70753b7ad76aa6b5f8e435097a58fbad171054197c9c1527b664def4020897d8161a39d9b4fdaccd7e56b457beeeea"; - plainText = "c4cbc6ca953a09814c220d95d68267ffd6e3c14e84dd7f637f48afcd1a8fd7dfb56c1ccf26887eb794a19e7186c17028d0f7fb50982a031cf46813122c8fc6e064a550b993e43376"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 310; - dataLen = 576; - combinedKey = "30790c9dfeafa4eefb0f3d261fef5b963c9d88ce55766dfbc29403aea8b76c4e"; - iv = "24eefb2590c5860b4cc5205b07d6ae77"; - cipherText = "9f67126914bb26d677652710a9d404b7c7ebffe06f0e742029dbe6c6b2f05da7892b265c0286be400698b5d91bfab6efe67c6bd4e9d89e4ed2dcb71f5c3ff822fdd5176a5a31bcb1"; - plainText = "967b392d23dffb144e33e7ef791dd3438604eeefd87b613260ae219b07d773e3632c9dd017276e7cbe2c1e7827c2f28e2f4811cd825f434a0e2defa762379bce49356139a5e81822"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 311; - dataLen = 576; - combinedKey = "0dafc7fdb1814bd861724164baaa5d8843c9d8b7e9c895fb81c57319d5bad32e"; - iv = "a3afc7df23facf928958504ff985c8d8"; - cipherText = "055936d43399b6b0fcacb10c5cafa2e72cc8d109fdce1c4e3ffe80e47ffee5af7a2477e3f3bb991ef7896fcf46154e1f19fa30c780060624d423440533de41b8e6303b20e5387a4b"; - plainText = "e1f4c55fbd480ed648f31da9649061ad318d95920f0c6913fde69208702037e02eb0073d3ffd84998570c2631059e12ab62252aa7befcc66035941e89d5ec3882e5c162d987bdb5c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 312; - dataLen = 576; - combinedKey = "922246584dcc4f39a3c285fccbf8e5ddc6d029c69af77f88615663dc50efffe0"; - iv = "9320bf151ec21b8a8c76da7d544fb456"; - cipherText = "ee844134097c2787e2d12f65e63909f464b8471569947a22e0ea814b96b22e7c42e971803c256120f6121054c7d926de9e717ea69d48a951d64396169318f575787b1f6392f31fe4"; - plainText = "f3534512f03438b8c9e1a2abe65b8c4be8a66d899541e45a8ba9a663bfa21ecbfd12ff7bf29c358ab4015d6dba2a33502d6cafdacf425a865c547efe34ae3d30d872fc14107c52a1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 313; - dataLen = 576; - combinedKey = "74cb0bc610ed5c8bce1f67aac0589d4ff08d88928ed1400d62c4fab975b60172"; - iv = "209f05f227954594c6851bb7fd36cd5d"; - cipherText = "472687bd8e3ba91c5a5ff6225606adc417bdacdebfdc3aa1dda084aeb1a4af845c5250e70ae0faa272defb819f76b0aa17ed3adf9ca1f8ab4c867f0dda0195d4ef8873485d31bece"; - plainText = "5e47e7fe500c034b06325bebeeacf7c33bcf5b626af6c669bc94ef2fa13e09a57e24a1f85d82a7172acf9b6577fbb3904093bbb8f9e6838af04264fc4d39f5e0198aa155818861aa"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 314; - dataLen = 576; - combinedKey = "c2a844a8df93f8e3342682b4a7849f720cc43cbf92ef4f743ed11c8820248def"; - iv = "a0235eba43d8cdeafb5e2590285f14bf"; - cipherText = "2db824bce5ee05a7e62fbe1bca3d3b5e5771a9f247ee1a570f3a0efa2419069c4d8ddccc927e85b0c05dfa99efdff618394d817bd4ec09c9373ffc56a24220fa20385a34c6131689"; - plainText = "b7045bc70cffc7df5776f0130d5e779a3f4fdcc01c55874e1c2080458c0661a299dc6e039b2ed438d4b4c133eeb70be2a7610984d1e5bfa3c2be7e46f0144fab177e5944bf1ba062"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 315; - dataLen = 576; - combinedKey = "f4cd29ade21ed77a9eb4038377cd5f382abdb823ece445d4d5783061ca3e4114"; - iv = "5b8aa5f68fb10843f18e458ae67fbd3f"; - cipherText = "b006b51ce0d8474289bc14793fb0092026b71d5f16355ac54d995b1adeba927a35c65f85e3ea11fac433e13b2dc207d0ee6804f6062f793c0fa4198faa5558c60530fd6ba0d34d71"; - plainText = "1eedf0f151e604a80dd381825b06818b52e49e4516c358400a28ab960f6f1724ad85ec51714918db741327b9e1ad3041028b6fa5f7a01f998dc37295a696a95360f13e39575fa26c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 316; - dataLen = 576; - combinedKey = "6129a41b7c242b0ea263b469b5b78f1922674c5b64f16979225530e3882fe657"; - iv = "58b13c78609738bd451a77bf07d021d8"; - cipherText = "aec0dbfa8c1ce986d0e57bb4ea6b7004ca69ab22aa9f4782aba18c65a311533b2d6bc56daf2d891531eea6465074a53e58e897c0cbf2de1b691f70e07b39af2f197b5100a0d9a9dd"; - plainText = "0862b6098761d9843850837dccf11b0e86f5c466ebc3524b86ddfd9ee79e1cb5ab793c91d5ed59def3a28fddb76da9f306625d0419e4caa54da33781ca1ea6ce5ab32010af5f1158"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 317; - dataLen = 576; - combinedKey = "c401cbb2f5135de6266f0504a6d8bed99ff905e07f8630c112eb21badd2535d1"; - iv = "7231e28c8e371c799408e18b1da8250a"; - cipherText = "d5f78d7bd717e3504ae5d8bff6aba1a78a9e211359402d0ffa4e49d369769fef09c147b49fd6652f6b3fd5165330762ef02f0c1b13dbccadc6ffb7e997b8b5fa0e7bd8c029676856"; - plainText = "68762b8880a9f51a414dd8362a45fea5bd2383057f654c08f86194148b566f7a581371fcaa0d155144a7ed1d215276b11a5800a6b177f7bc7665675814b93527350920c73c536b3c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 318; - dataLen = 576; - combinedKey = "eb0f132a53b50c5e7587924cc267e34b087ef074361aed191db400974e9a1260"; - iv = "cd79046e51d782ddb8d8a2249fd9a052"; - cipherText = "846825caa2880ab8b59f50427962790ef3d6a61b3d1ae2bf9c52255d985f6431104e8efbfa12e138e0adf37face517715c8af74d4452f193381249ce7f3bf0650aec4e396e9f91a3"; - plainText = "cdf48fd5912ed7b1b0e9b45abf4ac6b25cd33ee0e987289a8ee88ae112db3d2ce7521abcca0191f79bde522048a2d76ca9628fa92f9e0b435bcacaff1c826541f4c0b77381d2a55e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 319; - dataLen = 576; - combinedKey = "461f7a2e70ca2c3a810f07f647ea50bed57c526d49e54d5b8372c6b08df61036"; - iv = "46bc8e6c71b5a832ce2bf37547772884"; - cipherText = "a4cf1d9d26d4eaa781cb0c049bdee7e850090130738601e4339a58403699b5663ffb7640812f9ded0e9db3ab31048b08b21e59dd1fd3991f5084b791f81ba60bf3d1338d3ca18068"; - plainText = "5e1a3272f3151a5d888430df32a52ec84cb330ed3c0eec971c6e648aaa83f32a079318c08370f04092992af5b4600d05dc2f757953ade96bf3a3794211a673fd23107cd74f922000"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 320; - dataLen = 576; - combinedKey = "708f3cec902d4009a850f44a56279b85228c7166f446369404bf3c97827f2344"; - iv = "ec7c0b9e337c85a4406ee073ea77e1ec"; - cipherText = "90b74ef194159e6ff81e6d84e2156de4763f8cb876d031dc66150ce260b1b8085c89766dfb02b7bed53de281db2b73e0a957e44648856f0f4e10af0c0ba1dbdb5ec6d5f33eb55e2c"; - plainText = "9ceb02f9e25207dc913d2eee0beacabc29277c68bd2bf8350b52b021e60d58860967198e0afea8d923b59a2febd0197c34eebcd4f71b4b6aed873e675198df902c88e43f7dde3b5d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 321; - dataLen = 576; - combinedKey = "b6f89c093a57ea199a0def1c5c8c70a0316ed35ce046983f1490fbd1801d68de"; - iv = "88bb7332d09af233158dc8d7811e07dd"; - cipherText = "1498ec1e5248763eb5bfce9c29c0699ef5ffad13f90eccfc5092bffd00032551c4368f0b0277ebc8115314619acb8f68e685f478419d1188e4c666046cb3ebcab730cfb2e4f339f5"; - plainText = "d1d2b06218ae7c450943e8f63326230afe8f0d87d96508db9a4ddb771965c22b650a0d9268d3938883e9d470c8cfcdb6f3eaaa8010c45a4aca81f227b0af49d35333f4cdc1c5a78f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 322; - dataLen = 576; - combinedKey = "cfb1cf5c31dec9d063a271af0680ebeaff2e70f0befa4674b93a8e1580d478d2"; - iv = "f7371176e9c06a0aad8355520d52942a"; - cipherText = "96b5a723a8851a90066711a7e8817eae615dfc45088eb4f7ea34d5fb07c88ad5c31f49913b38466550c80a0813dc56ee2dad2139821ba19a12b33a89388cbae825566988d52eac74"; - plainText = "85328a032a648aea45b04523f3a0f370a1904adc503a8c1949c47b6fe08d8af3ad89d9e8fde9445506f5efe180e30fd2f34371c33c346d939e21177ab8bfc7dcba44a75a995c678d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 323; - dataLen = 576; - combinedKey = "9fbd2fb54a9c59649602b8320fb21871b464d209f93e6376e27f1f2fff4c130a"; - iv = "34657fe6a14d4fd51a119cec1e248193"; - cipherText = "01222a1e952a578d35ddb068cd1987ea4022801f59c70103a3671c3798ab7b60fbafedf31b3c24eb1c4dfb3603ff9329039c37ff0d1b9f8aad46a470c297a8e62e58e6c7558ab808"; - plainText = "e298da15aeda25d76fb3524fb289ced3713ba2241d88dd512b2c0c135849cb311390f78fb8210525edd053949367e6914d4f7aff2b282a2a445221aeb6073d2f1b821a0f7201923d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 324; - dataLen = 576; - combinedKey = "0b192489c37be705688424fd1b42df1c231fc8c9b25fea29fb15dab134ae0b7e"; - iv = "6a06aa22da12e1cf0c495b74c795adc5"; - cipherText = "4ed24ce17dc32d2c7de69ac604972264bdc62555d7097229c48c845ca6823e631ceeed20d615d5dffd5f577db16f08964784d8df543f6b43d121911fd7624891da4a16f0ed1e8ebf"; - plainText = "00aba79df02c8ca6bb691bb99dfc2729828c8aaf5b6dd5a480811b8502e4c760960504552d2eb1786871966a6a91cba9611cb8af64760d0f616f23f6f64b94747be6f66742b8920f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 325; - dataLen = 576; - combinedKey = "1c8e490cf9cf800b12de03a9a5c44a23ea14cc273aa435fa9d1e854758babc35"; - iv = "095ce0316952957febfba48e56ac3c64"; - cipherText = "d53b1ab743b1f02704f0170295d7d95f687a9b6ac1a6dde66437345513c7ec106af4b16531cef4f8e879e538781a61ddb3f1fa6270c09fa9a8067865766e55d3e58120e2687d1f78"; - plainText = "33d6de76b76a78b9e8d78358ed84c038eeb818371da66a825a4f7261b6a211ed012505ce606fc87a39a02b462fe6262fc1bee680dec015c0c2f6696b1fb87490ea7224e29fa376e3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 326; - dataLen = 576; - combinedKey = "cd07d899111994023741df55ed3f550b28343259107bf38e17f931e19a201385"; - iv = "ae96cd17a80784170ff557637ad0f35f"; - cipherText = "c8ff167e812db113a1de71fcf4251257e82e248c0a31dc1fde5fe7c526e075787a8ec5b0c6139f7f33144c4ba41c66999fa28a5148bb40ac23edf67416de777f0400893d996bed5f"; - plainText = "374e77db4f145a5329dcb2b5fea69d06d02a51aa6dd6a9f2a3d9ae17aad0dbe5ebbba4be854221d1f51221529c7db2629ac61e57744e4b23f59045720b6021b9fd76f429377b2b80"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 327; - dataLen = 576; - combinedKey = "aa512d7463817dbdea1c27a7dc71d51cf26cba9f9d71b53d81b9e380bf274129"; - iv = "a72a6a5baf35a24a4dc5ce4afe7ff346"; - cipherText = "186f78d0b25650952941963190b81d1d55c2f8ae95e06eb02781f037d8b31c98349ef229c7419ff35a232e5384d68615f78fb604c52813eb7d73b16da50e3282d41f883c173d65ee"; - plainText = "b80665b2170d8e1d8888ca824602e05ed9ab2b23ec398b63941c697b303fdca877d4c30fd0a57a017ea6069d3060b95917fe04d437fd3f497b714481bdade9bc6d21a609162a56a8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 328; - dataLen = 576; - combinedKey = "0b5fa72cc6ee1c72144952698752953187e17743ffd471e558c5207f1db5d1d5"; - iv = "792d2b7143908e1924fe250aa20aae92"; - cipherText = "b4a1baa0eba4d38fae8aaeb37b29cf91d7c29f1b37bbd872c0126711273a2a164480065d79f8bb4c82dd9c18769ece01111662691cfc130146fdc2d277e2889efb095fc9fe05c146"; - plainText = "544a9f53379bfd4ba26b082e738cdf0c9cbb8de4d2fce999e839ba24f1ac536cfb177dd8e28af765345e047d4566eef8a525221709974c869743d1928cbcabcec0b49d160bdc9322"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 329; - dataLen = 576; - combinedKey = "a26cf061bdf852c68c2ce8df58de1c97bbcaac0c2e695ccaa2b12a7a16f32078"; - iv = "4c90cdd79e2b7cf6ad89c4c0ffe4aa76"; - cipherText = "9fa14f9f5e07214d9433f98a7d938d8e77be629e66b078f055a382369b8b1a8773bedc4ffe825902918dc1e88f63d5165662d1c9fb10dfe2e621c1a60a8f486fe898a0fb9c26d019"; - plainText = "20e97f66e0cb78af5f862682bd2a99e90170e309a733cc7254eb4d9785d23df61f6ce814dd5ae74d989f46955c126dd3abe7152f5b31b269df1bc7b338a5a31f978685498182f5a2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 330; - dataLen = 576; - combinedKey = "d8162252b2f2d732987d9bf168dc50bf93eb976c8cc4ce0a1e5c508ca8e99e91"; - iv = "c7ea1ab2e0ab0982127bc325f92b802f"; - cipherText = "fc825e8f5391ce9e40ca4e264f1df5074ccb5b2ebdefad3871b92c6d485095874d1ecfc7693ee33b39e621b905e3ef9084946c690553268a4b37d50eca3cf530d702dab720236653"; - plainText = "0a89a528022a8c71a3205abdb7c48b5231b82f826b599c329f68452b26c83915b68af93d6914cec30a2dd4b9ebf6269578284cb55faa68ae1ff071e9c7e7c00fe7ddcaed7b1811d1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 331; - dataLen = 576; - combinedKey = "76559b79421a91341e97b65717dbcfe7e60dee61cdc40a22b1e1ba60ea617681"; - iv = "ae51e6f0e5e1b67b6fafe8b8d7c1bb5d"; - cipherText = "5984476db6d231de5966220ccd8a7ad07703cbc3524b0db1c6f62e1767b7fb3bd459065396fd05d1e7c58a54c840a5754891f67c37cd7db2a4842a225c0bd6de14b138a6b8a47405"; - plainText = "2199c5447746de3dccc641ca1efe97517671f4e725d3fdd9e20d263d61f38157ac4d37dbd710bafe092848d1425adc9109fc731af9b1ff83db32176ddf2226cbbd5903381c3b3b9f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 332; - dataLen = 576; - combinedKey = "1e6ee76f10f64fa57df128e4abf850a2beae14e909e4565da4312c1ee28379f6"; - iv = "16117f0260fe03569023419384efadd3"; - cipherText = "da56b2088e17524bd9a41463540fac59774611ed168c70e559f8a32e9f78e7efc7c44759c62bef0cc9a1ab35252c5d75ce9d71fb130c15a523be1f71750dac5db9a4f55d93dad925"; - plainText = "940631b7cf794dfdc093427d9b42899cf735ee372f37c0bf200e6260aa1003c0b93578559b35d632b558c52f334aea02ca1960627c8a3dbeff99f06025716ff5fce37a32b4e62ca4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 333; - dataLen = 576; - combinedKey = "6fca6e665f1093e50cf4b3e414b96c42c788aae069b8cf553d8092c2ea5df3a3"; - iv = "5b309c8a242e71f42b203a86b71fa728"; - cipherText = "824ab6e7ce76fd217cd00a9f9de6ee23d8fc3c9b4ab62c1798c02241f6b857624b361deb9ed458ce507838d9d14cb55d7084129b8be3198d5881fae8887e5b5b35a3e4a2932b1f62"; - plainText = "ede565bda675340d2247826c38676e6eb127a05f91a2851244c89cc72f1b2dfbf777cfad379b32abb43d0d7067cba2f23af19e0ec1d723a81c01c42014fd78b902038b58e057dcf7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 334; - dataLen = 576; - combinedKey = "4ff83253b3de4e08ad805aeca7da442d132027c8e79a1f2960706c799f862f50"; - iv = "60b5312cf75e96be81a76a42eaf31a7b"; - cipherText = "586ae5331aa9df84501b291a1a32923860502e0e5f0aceb11014834514cf168bc8cf959ab61b9a7f616d6d2dc0d3b3b6b43cfb3803a5f5a04114812c8a754104dae7e062d109548d"; - plainText = "554d21e5a2d20d8371b6b83fbb0c346f894bd122efc53cebf2c2a5d26332bd38e0d3205a0aeb3013403d1c43cfe73af0e76ef50108e730be83b04935a362961a7050fae3c00a7616"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 335; - dataLen = 576; - combinedKey = "6803dbff60f18e5c404b234991f7602a045f9d633548176a2ff8a9c615941c1a"; - iv = "86c2e225c2fe46e3aa819d0cd4f9d423"; - cipherText = "e3cfa5f89f599cc476459c8af482054be07942bbf052350eee1c4e6532a1ac8cbe613582efd1bd305bf3d270957d6365ca024ebc2bbea773fecf908830b168fca9227ece08b2e489"; - plainText = "3d075bbf28614280d84884d87de7a984ba1fa0e963a0e380014237210d50f3eb91ede821c0bf0d3ff6dc7f064b93e189b14c23be2cd74395dfb89c4ba43c9ed487c2f814a22cb632"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 336; - dataLen = 576; - combinedKey = "0e383214c6ef9958bcb1e9eb3bdf56fce75b4398e10eced7be30a8b83d57ca30"; - iv = "f4ad594bb1407a9602d894116881e79c"; - cipherText = "eb387a3bb2c585d1e5cd3d7ef6fcd9c3ad867573c55aef56230ca853f3aaa14f27621a9668f62fe650a3d3ddff62fc07608db1edc81df3ebf6bda7d71fce30088c97b5517342d186"; - plainText = "d106a81994d2e3c0f04ed30b81b6a4068f4a4021a46617b0820116725092515e1c2577c9056948229356ae1c078caffbb002ebdef815dbf213a3bcd54b95b3ac91ffb5e5904487f0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 337; - dataLen = 576; - combinedKey = "110461ed446c20c3206edbe454811c996853c7cc2b37e3bcd489e3c231e6b9da"; - iv = "afd01668154622ef7b4d5a076da424c4"; - cipherText = "def2a8baaa97b6bfd01aefdb72bf5421b8b5a6cdc177597f01cfe184d9cf1abefeb4bcac52548fb8898710fe0be7d6aecf5f694d1d63a7d15c35697bc71be798a97a9754bce8ee8f"; - plainText = "a11ee20b3a22e8929f8c6d44ddc70d8085f92d1518b6af3beb1bef8a17daf568330bbed6c0911f5a1204019c509411267d5d36bb8bef9f5d66c599d85b4e41f78e6686f640e140a4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 338; - dataLen = 576; - combinedKey = "9bc3bad718331e918bd0ba558ebf60c387a15c88b9c58b6b094717a5531e4bbb"; - iv = "98935bda588eba99ae4178b0dfa987da"; - cipherText = "b7025ed55bad49f8771ea28bec835aeb2867ddd27261c939623f5aa119fc53f8bf838e24e9f3b7f59d3cf155312cfb6570ad8690ddcac95579c7cb3ff1c9b6a5ca23595fb5d5934b"; - plainText = "df13a7bc496825c51325d1e9060fe6729e0c723e33058cddaadcb5516fc171095d2ebe887298a2327f17a12f50e5f0af76ac0dbc3497a0987d9e8056979fa945922f7b7a21b43970"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 339; - dataLen = 576; - combinedKey = "fb2a748d21f819f65a01d9cee8a31e2ed1465afd7427cfbd64bb1c4e85fb2673"; - iv = "4614cbb08632c2e5aacbefe53fbc5857"; - cipherText = "d8794a2ae0204c2610d54afe93f5e59173697625bb0c2fcc21f8b1a93a8bfa776b69bd536479fbfbfdb0b06aa6e4b7edddb2f0bc1d82f95a9aa26bba9bad7f2f80532f6beab2144f"; - plainText = "5b668143728ebf782a5da82372bfef397c0a96e03b5359b518df177fb8734cd4a6c285abfa4852496256b0d392e59f9ea8c7dba0edd86894375bc3aaaefffef6402c18906c4278ac"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 340; - dataLen = 576; - combinedKey = "bdb536b82e4b8a8b034913f22de696c729b8ac2011a5c05a70d4da73c25c674f"; - iv = "7581488666e29cb0ae1ce7fccc32dbb0"; - cipherText = "6340d3488f452b719f6936c1b57e31505f3dc2aac31c21765956e64c2a952578c608225ea333011475734f4d144a29d23044b02c62da45d9352e08c0694ed74e179008f4b871a633"; - plainText = "36584ad92d2eb3e51d4e9d382784db7623cbbc77eb29941d3ee1fa918b5ee625f9b72e3d51d00db76959de34e96e167ec951e251d08da0e058a345e576e2804630488d8edbe36d0a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 341; - dataLen = 576; - combinedKey = "6ca2be1987caaf2fd10fb3df72c70a9b24e4dfe277c6c7357d8343afc6230a7d"; - iv = "b2c3d3fd84638c1a9bc3a45852f44ba2"; - cipherText = "ffe7cacc097dd818e5aa4ccbe7a5d22713456a423a69a61628238c028a0bbff21a9897e1fd4a47dda213780372e1d6c74ce719c02ea713c0f88ccec0f5c6eedc0c5eeee711887360"; - plainText = "9bc381c74588b96e7da728707ce95224866777ae8893004d6ef8544cd3e3505e60feb22bf70a30dabe5b2f22d17e3b8dcee1e30fcbe644eb63b0702ccba0d623063b7f242fdcf991"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 342; - dataLen = 576; - combinedKey = "69dfffddb975e916a287c39ba6e74c3c140aabb1ff7db46fa8215849197cdef2"; - iv = "2de9ef450dbba8f99398d041f8db5f01"; - cipherText = "49ba3511b85ccdcec866ff79a239f4672e35b8f3d5ef4910bbbd0ae6e88fbb12a8a83481322262c69e9ae9c799f73d20c0dd267abb79abacae092f809f37318dc2385e82312d1c4c"; - plainText = "e59d80b65d4ddd2cd24d166ec3d56e8763d967ff82d402371eebe6ed9bc8c8ee672d23a4167b88c1f5fa9798eeb347ca3d55d25cfa17fff509878b9e37c56aa4113dd52ccab177da"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 343; - dataLen = 576; - combinedKey = "59b4d0366488df9768611e784b5e2abf76ff6929419796947c75b1d15bd7bb1c"; - iv = "31c46b13f6df885b64e880eaef3250c7"; - cipherText = "6dcdf9b0ac2869dc8e4fa36bd7b3bbace15d5e877d3e29b67629eebaba4cc30450011ad5ccdea94ee6892fbf18131d7a68eabf50b6f7e2296613da601b79cda4400c11049eee63b5"; - plainText = "de39a13866bad463c140d2f33eefb26a6b87b3939c1bf0517a7e26955a0d2106cab8181891a9fc9c01685dff4a638b1c3ef97ebdc671d8f288f6bff33e3847b9b37cbed2d8c562dc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 344; - dataLen = 576; - combinedKey = "91109c2eb89817fa106f3d046976acd087b94b92a46aefccb8c18dc7f0673776"; - iv = "b54389f60294be59d427e83393a9f6c0"; - cipherText = "175790bf6ea1db26884fb92a54154a26448f7664c2a305f0e2350040f1e2c617896b89e49bb1da65d30e1a52b547ccbbe7f2bd67f5f840e00a305d1ad372aaf294f5adcf8cc7de79"; - plainText = "cf4501690814572b3423912a67646d2391faa75b2f9d8e09511ca7ff63343c7382923332b121b2b1254a0667431bb564d3eb2f9d6a4db1dc467e5da9baf99497d8888559acc2e5fe"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 345; - dataLen = 576; - combinedKey = "569a72bc49774e5303bf79bd64616be976da8f504a1df10f99caa9ee790d4818"; - iv = "1a859af30ccf7e9220699e07ec6bb287"; - cipherText = "7403fd607a50e996543ce8571a14c2d4fbb968c4fe0f64d93d98615a66bd7f9cd884a5ee8afa7391777b3c121759de2094db40ed91ea9cd8004c2d24f8dae40dbd00e8984d9ab052"; - plainText = "0e1432368879f1ebf70c51bf5a28d661aa92ef905dd47f1dec51cd4b02470b86c90ed1f3c09e1609e4a003617d1509f0a8aa0c9bac0e54ebf18c33449a0219c60c894d5aadf13c9b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 346; - dataLen = 576; - combinedKey = "05648c0cc1104f61a979abbcd0606b7c1573b9125148c9bffacd2b26f5ba3716"; - iv = "21d568b5fbf8fde85168ddc716cf6934"; - cipherText = "f29909b0468aecb05edf154b088eb51f5e8db9ec12896bea1e7da7617c25e8a32df5652c7430f946c1f53a43f25af2b4f88d65dfa3bc941095d24f13e05d99f907cf784ec4bd70d5"; - plainText = "327bf2d8bf2596ff145c07313aa73b93c12397dbb2c5df4c8ed208d3978f4e979a84b65697a9a33adcf90d2602d0edb79b2d3d3b0155fffc434064ca44bc2e70761bd8894d28fd7a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 347; - dataLen = 576; - combinedKey = "7ffa09ccff11ae24cc40f171340f213787d500e08c4617c1aac7f8f4987470bb"; - iv = "5e1edf107d8191f71e2ce63bd866a3bb"; - cipherText = "9318fec66ee5be264c08dd9d79d5ea713023405cb8248bf5cd84727e88c598288f30d7b424a6cd805b43218d85e42fdedc2dbdce37e409e73f2eade0208ba6e57ea75d9fba42d3d1"; - plainText = "196e8982d423979ac15bcc6beece6f222ba67f6d6fef68efae0ee40d825492d119ff1027c390593f6bc8f486251252c7843121aff9af9b09ce9f16a3b96076a1951cd6e3b61f2e49"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 348; - dataLen = 576; - combinedKey = "710550e4c6f6e5c6a919ffdaa6416825aa387a4a3012a718f7eafdbfb284d217"; - iv = "a6a4c2aec5b1f655083e64df89795b04"; - cipherText = "bc85c221fd23ec9ee4ae6592daef62a0a5d9601e6313830d5744b116aa92b4b2aafe0f28c597a43b1b2d058f3266ce3e4260dc8c234be744be3437201ec4f47c32c042616d5ef1a5"; - plainText = "f1b7dbfbcc0f855a3531f18dee8d246e095c51262abcfa4015750d3d989cf364c7f9e5a231588fe28c61758b4f58e74a60a52695750b10f02916282abb9440b7c591153540ded6eb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 349; - dataLen = 576; - combinedKey = "14e2349f2949921410e10167580c3c5544215296dea666e45b325d0e14ff96aa"; - iv = "18862240397cf9509ad76c2aac5407ea"; - cipherText = "7b60cbd9e91b738479965c0d1176eed0e2255a7cc0f30f3b25e1395a5e00ce660a57eb844f74c6dc525308ca4d83f6f5a1001a0f23f583857b7840df59c34e2d3be25f2c98ef9e95"; - plainText = "97b5162cdd558be7378bf02fbd245d40dd07eb83c2e8bbd10f655258c0f072ff8c3639c7f48bf548e9dc3d3621b78394c1df54e360731e748c366aa9f7cbc261ddcd9177b4e4054c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 350; - dataLen = 576; - combinedKey = "7d44e0e7879081dcb555e490a460f7ccccbcdf5cacf0499f7d76e327e5442698"; - iv = "3da9a735533628c87a45fd2560ccde62"; - cipherText = "a8db84f4e2ffb64e4319a320ef06defda7f46b238b96b1a074fe32cf81d11142477688e16b057054592124f9c3819c29313075375b8ba91cde85fedd0e3a6e6d8c6e016b5257d013"; - plainText = "2d447cac138cf21cdb55e1d8a62d6c9cd1e0bb6a3cc95be395a2452410b8eaac9e8b0be60f5ebd806d6d766dbc930390243af507e0dabe4b6b8c60e5e94a336565a77f927ef312af"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 351; - dataLen = 576; - combinedKey = "9d263872750ffa464bf608e84f0e58f656db816ebec28ece5c2a6d9e31e4e554"; - iv = "93d9e4e9a8708365078791cb37f9ec88"; - cipherText = "e52dc873646202636078eb38a2af5009a7c920d1f846f58713e7a5fecfad8c234b09b1848d2878c3cb016be240a7345770cae1f3abafa202b86f749b97ddd52a3c72c6916edbdbe2"; - plainText = "75346e966cb966d2ece4e0925ee1261e4799b94bd491e2735c37920c95f478e6dd4eb54327ad800e545112e18eb9c145f730ead34be0f2ff45ee30e36d7a225d4c0d756fcbac7f4d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 352; - dataLen = 576; - combinedKey = "7ad33a114cae2d71d1ff6b883b453558c2ccc86676644c257f8a7c4903184c14"; - iv = "25820571fe1af71ce6ad4546f8d99de6"; - cipherText = "96e82aa414fb084387a4bb445e5e01ccedee94e47a0aeac9d7e352c517c67337097155be1e9f4a8a7cb06a82e3fe071bdacd810a1403b2e5ddb728a6e06da01ce27e51ef33fa34fc"; - plainText = "79b74f135b39e8080d985950a6fb8340002c84bc0b18416a6d07e2b3a4ba6c512a0bf6c0c82e26f59f1b1f973d6082c59a0127559a39e58c5ef8130f77f91c389814ea1f6e96189f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 353; - dataLen = 576; - combinedKey = "1d98922e100977f206d9b4daae0f32050e04bdd523b5f90115ffb5646db6ba59"; - iv = "39119e542800a94ab93a385a420b4bf5"; - cipherText = "46301b4af578a9c79bb8aec98946475cd943f37c1014f7c5f8608c048714a64a0ff9151482a2b0ce421e59119d907f61c5af45d2021a52f702bac7b6130301db2c33206f78d2b8b8"; - plainText = "ed3afa7c46fed058fd7f1109bad873140b9512b80e9f109afd414fdccb5865948bfdc06bd839c6971f7e783dce93422d12976d17ee93a7769c66f10899304814ce24857ef12c80d1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 354; - dataLen = 576; - combinedKey = "4f42af899cdc035489a3f45d76aa4c931d7dc840f3be3ba5d431306601aadf5a"; - iv = "93851517f4ab3e4b278e15d2e4feb884"; - cipherText = "c1dc68846f70226f59785831074416398b048baa94eeaebf3f3cd914b1b394ac76718425599f676294b9f558bbe0b55c1030d294cbd55034fce9fb143b098092bb3ec4590e12b650"; - plainText = "4c5e35001b282d4d19f4b4e8addf60833a3b9fb8fe881e1689f16bbd591b0e1ef3db3169b95f0d85929177f3067daaae10cc51c4e94d19f424a138631811f56f5cde4704eb3242ea"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 355; - dataLen = 576; - combinedKey = "c33da4d4a6dbdf7519adf131c3782cfaecf323d37dfd424a2884f009245ef19f"; - iv = "8f8911e7723e8d9800a6dc912f197403"; - cipherText = "eded15831c8df898d501cb1c6d829df07f3ddcf50f90714610d88d58283f02d2483fa1d8e04283fa4e69cf098af839ecde3351449327e867bd64ba8f8400a999a24706aecb4d8488"; - plainText = "a417f899bcf7576db5ebb43b997cfe0d5d4d94f85a4b877c3030f4b21be804dc59cf6feb944b933c584aac413e02670a02b740fa19e7ec9e99390c36271f6022a0b60d85998795e4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 356; - dataLen = 576; - combinedKey = "8b6cfc4efb19fb1ade49b74a2fb1ea02920bb0c3117d376ab293c1402ea1d26c"; - iv = "035a666c55f9748d3be28df7a9c890c8"; - cipherText = "808dbc7e0655e71d4979a53a395aed4cdeae62b37ffa64b5128beb9a05f84313f8d681cadbb1f77312f5b01aa8d4f50f1ad72c872e25b88c1557e5c13f302200203d1f02479efe8b"; - plainText = "160f1893bced71d55f7af670003b33ab51d41bb9c450d043476f89fb7c08e5fbedaf3aefeb1df383e0e3d1e78957209e5ed4c89de1359cffca6f375510cb3db4b6a5b0ffbcfe27ad"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 357; - dataLen = 576; - combinedKey = "329f37c34574935ea07440cd916e5b8d02ccd6cfec7f3d8eef5b4509bc5f8c0a"; - iv = "16fe3cf5f9fa3be195e41f93edb49b6f"; - cipherText = "0819e067f21647d6008d51984157d35e3b516dec56782f22b1caa6a37526f1da88703ea42a9502e067762579b79ff87947c442b8841855048436c918c9162f0a0688d883798bbd07"; - plainText = "ee0ef0adb8bc99f9e9dbe85362d119f696cf1c04d190a8162e60aa87ce0b6491bdcbda5ccceb175a8b576ec7080d4fdf8cc13b19d7a026aa17c08cecd7391c487ff688342eec9a68"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 358; - dataLen = 576; - combinedKey = "6c41271b7257e620b8230b515b40b22f15f2b5737cbb7883293cd85121d66e9f"; - iv = "f2034224e7d426a05dc4d04b5997b5da"; - cipherText = "50e00e1cc7e632fd9f62345f89cf6afdd4dcfe3b31648463c8a2b2b6e28af07ea0dfef5f57b2f0ce154f578631e5bf9978b385eecdb08b29b565ec86d6c261487d986ca599cd4d24"; - plainText = "36eba1eb8bb12d8b039e286047839ce32a0d5f2fac24ec38d67fb82342e0049728c681c7bd1877fb4582085505d633265c2aaccf2cfeb7ea5fc8f88a7fcaf4061d077ec2c210275f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 359; - dataLen = 576; - combinedKey = "6cb9f8cd0427d861615cf00cba3c33443947c4fbde7120bf1016154c62fcc72b"; - iv = "961b75ebdff10dda9a98a933a74d35ad"; - cipherText = "b8b3b9d95588f41986cae7867e034f161e0fe183dc3066124b75519a2d70ffb0c068ee396e19fdcdf042f8e380a4c37db5c94d01efb5b9e82ef46812a562f4b2ea3d90730b995eb6"; - plainText = "9ec7ac4097e8b3cf65bab8b405c09c0f2700e5558b425d1b685129199daba912ecf25a949ac10a1ddb3fcd15b5c6a5e1fcdd9033dbd6b1bbc4d4c3ccf3cd7a30c8da57a2c3592893"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 360; - dataLen = 576; - combinedKey = "0749f81bf7014dc60ca894ceaf68c67a64a2b56d1f96d1b153bbf2961643c1ea"; - iv = "215616b14fe388a082b61d07bbe84953"; - cipherText = "e3668bd6cb453481dea1c7ccf6a589190f797a14be755737b8b3983c9f06bfccc1425c0b30f54dae205d79336b5e8da692cbfe769a1c3d2b8ac698d542f0aa6f2e08e6e910fdb23e"; - plainText = "d6b6f1c3a46be63426d466d93a7f508c4d004f36bbc5ffddda812e93f29fc8b93722010c3e3e5fb5158a0319b346d01db50aa175438801890b43d33ad54680cd3c3027b9b4479b7c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 361; - dataLen = 576; - combinedKey = "956bb3a59af77fcc69e3838e6ebd2415260e4127dec041a6eea1cf80b756e33a"; - iv = "7251bc0db5841f76f5e55b5532f273fb"; - cipherText = "dec5c78631e1dfec089e735adef9412a0454b1feab851a042010f2974060f8cfd8f29b41131332b8781f5c20759e94479b631ec60f057dff347d0e4b1d540aed55bcbdeb007e7abb"; - plainText = "10ff4faaea85b8e442d852a38a50a8271785e0cc094cf0ac935173a2caf944933277955b09e35443d734917d299627c2c85ba1090ac6a86efc8126517dac27b6fe40ce76988a6b58"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 362; - dataLen = 576; - combinedKey = "bb7299695d404ab15e4153eb20731222d08edf22974de6cb08fe4001d199c808"; - iv = "7f8cb19f665e97a3a7491397c3764317"; - cipherText = "6a6b6a4614ad5969ab5467f75cbf9bcfb07cac158928464a4a412a3744fdd734c324af2b4e17b7513f95c30774054f8eac857fa089606aff1fd8fc545e46287ed4d8e1f6cc69772b"; - plainText = "f0fae22ba38cd2bbef71456ed1e06ae9724bdc2e820930e0fae8bc1cf357e1b55ee89b7bcf8d69fb43b5f27c71c80108afef0ad1184e9bcf2618a1074fc870a2b6ea5d6eddbd3a89"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 363; - dataLen = 576; - combinedKey = "307c9350f03ee56a481a9ea8e174b4b32d5d784806ebc3daf5b051cf83c2044d"; - iv = "ec73b13a2b76c60074c1724d0f38c955"; - cipherText = "ae61f5ed99c1e18f4dd1f53fe2aa47825fe40cf52fd73b5b4a3c33611050d56f1b89c1344d0c13a503cb2645d38f3ab294cada601042df5d30be0acc65658ae6e30d712322d43d61"; - plainText = "4e650ecfab659e8320e9a8a5437d47d87c8f23ef79bdbf71c5911519bd307756c815e50ce62ce6f532b8952de296be6485574195a19bfb01c66be925079b14e6c3d06392c6792fb6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 364; - dataLen = 576; - combinedKey = "0d648075b087b2b0f14c8bd5f07dec240654197823c24f94aa59e4955f1f4a3b"; - iv = "bbf9ef7f879c4a4423a742ddaaa1dd16"; - cipherText = "7119803ad0cd37eccd468a36b478b7c90f38f4cd3c40adb1e783d1e6f2ba104f6b0b5cff19b55454594614f2d30f0133adbb27e365e8606922677de5815741f1b9573a327a7a0533"; - plainText = "d90873e7cba12716f6f134af9a17efb966e91cd8c757792821e9d58e0ef2979cb51605f081e566107bee9d754a2965bd417f1bc2fd3f0e17d140909ba65137facc2a7a45256c457e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 365; - dataLen = 576; - combinedKey = "a5d133c8eb083ac7460a88acce73c26a8a4a1789c157becfa36e7d49e1327b91"; - iv = "de9f27ba8f1f46d25ee9264e948d9f2b"; - cipherText = "5f0978c084b2ae420224fc393d99ee65fc28004d976982c6bc52ce6627ee807ea14b248f8c042683ad77c406eabddf610a2e5f3951fb587bfc2dd9b3283c5410738bd71c0a053ebb"; - plainText = "598487fb8fb6d69261e7d7c38127a4f0c04a40aa24119e70e79e39830398336b733d26fb3a00c42dac9898e92614d3b699b08a32e2e85d6b5f813d4adef3b3d43a4d2f00a9e13228"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 366; - dataLen = 576; - combinedKey = "36940bbc24aa2b7be09f2e305e6ed295d1a67b52199b6de52677e5af40737ccf"; - iv = "84d1c08caed0d195577e748096b280d7"; - cipherText = "998f1beccf77e8f59c5ca35651b2651039459fb9f3cd81bbda9d89eb856e33f8ca614cf8e924225336561e4ef74cfe2dc936218c3839a8fc92cbea8a2fef2c600d7077e0f5890d5e"; - plainText = "eb2bb447f1d4c30366485d2a8c379d7c31f3ced4be79736cfe6214b41952ca3c300f947918a91187b0b6e9c46520deb23a6d1d8ee969312e9b9a68ce103d0884c96408970de9e30a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 367; - dataLen = 576; - combinedKey = "6c9d1abf4dcb5f8705971e34a044331487005710429cf56b1e681dd972fd7e18"; - iv = "67c240a4bf7eb1cdd41f9749e34c9f42"; - cipherText = "118a03bb97fc89a6ec36f4b6c1b9648cb7972766fbff2aa58d5819e5e72f3b7d25620d775a7dbaee19f866fa1980360aa1f8f624d5fc54dc0830801adf0d43d73d4b8f39fc4b8ff6"; - plainText = "77c64f785c1d26e26c983acc376be33bfb56cb1ad6c09a8c64453dc30393b6ca310207989c49513c9e9ba66a293b85514eb42945654ee837da7f8efc52f3615aab091d65a2744a3b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 368; - dataLen = 576; - combinedKey = "5568ba75c1fc3e7e654019bfc1391918545e380781729c231b32900dce12bd8e"; - iv = "0aa2b015732a683ed735396cd85c102e"; - cipherText = "3b246ca3b756d8c4fbdbb45548c0d878d5de863f3f320ae586f8111ca294cdacbc9c0a2a6fd88966893e24f0ecaf61ecef3f6b2293cca78a9cfe27e5c2f8066f5630c3be0d0d07d9"; - plainText = "2b74c553dbb01ea8ec64e5fa0958cde34c243ff658300536ba5b1e23acc1784b16ccb4278e79c057fa465601e8f2b0dabf4c336b5965397fb4e9b5c884a54d42b901a78fbc8cea1d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 369; - dataLen = 576; - combinedKey = "50ff48c2ee0c49e9464675810f4cb75bb26b9169c66d351792a567461ed51cd9"; - iv = "e868532013731499dce0081a740b5b57"; - cipherText = "8c2ac69ca502708919e6167daff2e17db6a35d5ad4a4af11589c0ad094fd0c2d6e8db7c3cd05d66b54a5a56a8be0493aaa79ca26b882ca494358fab5eddab7b28c4ef509310bfefe"; - plainText = "f0c3ccf97ab67cc20d44ad0a4bc901f86f91013da52bd8d4a34967939b7f0a6360c1b8d53c0c318f7c2821719ce8a70ef487fe8c2fe60c177e42c56f16b936e1dd8065edb220cdf5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 370; - dataLen = 576; - combinedKey = "b773ce8db448b0a5e4da592ce5f29dc6ff3fb2970152c9a49810f086f6b5a6bf"; - iv = "9a3932b1694c751ea689b27d3343a650"; - cipherText = "4637f94f1619d865e065c713abcb1af2bf0fea96b6e900e197453b8444bad35ed98a158f5ee9901b61784deedc626841fdd3fe22aa9f15bf314fa97d8de1b36a54f2728164549864"; - plainText = "7a7f2650f40ddd9a4c5d5920abd5e024e9f66cdd6218174da81e914852f95a182e407f12a8abb476681d3cee448195a9c568be2fddb5d701ea26bffdd4faa554caf8e9fd69e554a9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 371; - dataLen = 576; - combinedKey = "ba663b9e101b918db1d909da26daf939fbbb345493efc4ef9c7119519451981f"; - iv = "83e57723ff1a8d8fd7bc633831f5616e"; - cipherText = "346c4d379b0c2141a374a248a74f5713da2bc60f391bf75c2c730c5899c3f94fbe0da36d441336965968ddac41a9ddf5dcbede3be1938e2f5e72ec662235d0dcae85ef2b29c02c02"; - plainText = "0e797dec7797ca1773763ab3106618b6ae9d2c48e7d81a4fe0ab658d7c8f1c883b232d8237d67c72ccec25704d5b48b0719c4c41a9789881822ddd9140b2d715a05b291d26023690"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 372; - dataLen = 576; - combinedKey = "bbaa56f38c0678dbf01f6ddae5e17a7b037b38930596e24c23655ecda4f3f05d"; - iv = "cffddfa7aa551dbdf6c4adcae555dbfd"; - cipherText = "161afaf8dd6b72f5ef753228590544ae2c8de22077c23c07151e2e7ce0e84df5571acfde60cd0033a1c57b380e76a07f6757f9a0bbbdbf03c2059bfe7abe572294f327597d202ca0"; - plainText = "8ba9bd231f88778330b6aa7f38a9860031aac6881f62f0b545c814d1187fc831e589755462608e15f81806733d07686e085f265d2b450d7d8b1abeca15390248e2a6eab083cd2491"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 373; - dataLen = 576; - combinedKey = "8c2a5b2f9e20ede8568986e427f962cac25ec3ebde943dbd34e766f65be2174a"; - iv = "8c7a6d86acfaececffc73bc4539d0a8e"; - cipherText = "02d69f924eed46ab3b0fe212805ac10428d2f05473572bb9afe26c9d7d195e3a6e76c5feb0706fe6876e70dfc44da44c2f5539e5b65db821296d3f036700d625bcc571c6a5dfa0fa"; - plainText = "813ecb8b05d5574e236d7d47b3b583d9fac90c4094abf0c72d09f43d1a4561f574dc522488f726d47482fc2e0e737904ed59cb4d8572f47c81d774a463479b05d1cf39d7a5645295"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 374; - dataLen = 576; - combinedKey = "f52914e4f9e414eac727a7b3f5ebc944c34968ce9b1838cf1ca0f5f0f4ddb331"; - iv = "6867979394b99eb0b8e632b30a18a243"; - cipherText = "cba098516938d7689983d65aa9323a542e59f92ea15e0654ccd0aa6b6d86a81888952c843185cb80150d592e84b4e39610757c95234c184f50ecfedb07c8e6d5c0711a66aefd77c6"; - plainText = "3426434a0846ff7a1610ddfc18868e8c1c92d4779ae15323a8dd6dd1da755d456d88adc2247c4b61b192af4e0b47e1238b8122684d2b81574c2ec9f0b42431fa434481e7fbaccd45"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 375; - dataLen = 576; - combinedKey = "6ffc86b76b0b715ce3e409ab7e978c5a00e96c5fdd8bc416859cbef47a6df681"; - iv = "d4f224ddacf748c61b6e742924e98eb0"; - cipherText = "ac39691a5d144329323bb4c88971d18b99108dffe31b1140dbd8652e651dbcb850e428f27e82563871de2614c63556ef2de289eae521dec3a8672e23fafbb020f5e0b959d13d4e17"; - plainText = "b4a6e44ce58b43a69a18256c7bf44de6c878d8af7dbbe6e16b018019d64306c5df6a04ee7c8138dd40fa563e21b86f4fc132d0f6682cc0fef87d59b7f46550f893a0a6575f48a1b6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 376; - dataLen = 576; - combinedKey = "26d703262ef514bc949fee1bc9b5e0bbe0b4ee03d7081eac8bcb8c1c77c4b249"; - iv = "909020e3b5810d7dc06503df6b2def0c"; - cipherText = "4dcf09a81aece5a13cddb01e0339dffbb7b362de6f250bb5782199a7d4686d5659479fc665e99fe5f626215dc4912c3b4678fec3ade10fb656f54bffd2b47e7c81ba609714a5e780"; - plainText = "5267ef2c0837800055d68a8df7bb8ca56f748f76c8838d4b0e9b10099992705e0ee46db4831669fd296f87a6d7a9fb8fc3a7a0f19fdc49b7ce1efd5104494bcfeecff841870281cf"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 377; - dataLen = 576; - combinedKey = "b440d50cb42218831b1f7c76ba44c9acc63e684b9a901ffa848b910041ba6d18"; - iv = "8e3d88ee9f8cc62fead3f8bf1074fec0"; - cipherText = "22dbbfabfe84487bbd13a7a98bb6973c1ec61dea09c8b0be719df0129f51464f072f61b6f98665e9501d011a179eedfb4ac2a6b8eeb8a1ffaa727278b958b1f0aa93e0bfc4c3d904"; - plainText = "300f0c014d45e2ab2ab207ca61930d86f9ffdb7d8ba3c5a34d33e4f0540b4ee4a3ee9206ed15b01ab1147815db9bfe2791a5982c174ceaa9b5b83465d50009a4fbc35e1cdc63f951"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 378; - dataLen = 576; - combinedKey = "a36346e3fb39e1d7160d04680e2af1d6ec0012e4b1464428a73d6932199ec82a"; - iv = "94f96e0aaf874917daa3b777676bfc7b"; - cipherText = "e63ecea73cc87a7d2a36142095ef9945a76db94fa464e4b6d2a1dee3a7439d308b8deb4386ab42e6618d1305bd4bbe0cc04dee61cf675d975bd7abc05ee28d194dc385258a6c4a53"; - plainText = "9da86c9bb56762e0c6facbb2a2809f45cecae12a6d739ce8c721f22355fec0fdab05a04b79fcde658ce89f8ae90adf9b11abaf40faf8a70993d846994943ed182fe0bd7a57c83a79"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 379; - dataLen = 576; - combinedKey = "f3b850ecde4a05d22399b27132334b7b2b6386d1b0da9df4aed252aa0e4466ac"; - iv = "765c5ae1f12e704f4adb7855251d8638"; - cipherText = "a94659332c83e0f1c9d30ae3248e6b00d107c6e84f45712f78415847a5af40c93369a26ca9b3147bb6f22fc82f65f866325266439219a28e613830319c952a76238f71460c76161c"; - plainText = "d514476e28bd7679bf48b39459ee81d0c9fcadeb86ee75b807807085aef3c16ec9251b7b04e71aa50563044ae3dfaf8ae270e13002fb6ed63f6e025c3472b7e89d20cc1716560e42"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 380; - dataLen = 576; - combinedKey = "1078d6af30d3121ef3c7599f3ae046b809cd53933372f4f7b1526baa46191cbc"; - iv = "9db3ca7d59a450f92c0d2c26e19af76c"; - cipherText = "ba4852df5f7484873a300f4aac734fd959de070d6cf36c87646349be4eb5d8401135f730ce583850f73a594ab99868cf268dffaf762e8f8480c2710417ed7dfd33c9ea51f9d23f7b"; - plainText = "577d682f4b9e0044c3ac4059b4b03af7986c766c7421c0cbf638a2a15084d0ea2667fe2e5c1028f7a3f4f1958382dc7abbb94612880b87d42676dc4cdeda58752a77cb31bd310c9b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 381; - dataLen = 576; - combinedKey = "cb664dbf3413bb5acd89c3623917e73a40f719c895f8a65f38aae916a40ee34c"; - iv = "8fdcf95aa5f7f538b0e03fdf51cc8a7d"; - cipherText = "a8b9d6621d6c9b98a0753b42af08617efebd9766ac2f963a6fb138630c75b1d2ae9623e571674290430c38d5d8e37b716377cab43bb2464e6caea53583fe9c901e096167b1fc8b84"; - plainText = "7166093ad8ef5ceca9dc2168005b618c9169ce66a081189e83fe986bdc92eb523c3ef9150cbe18c89f685730e63859fc7ae6bfd89171398efa811a45544b5c4e9ed0326579047e34"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 382; - dataLen = 576; - combinedKey = "89a01332e1579147f3b44b61bc607a281681473f37a44ea085b5254a37b31760"; - iv = "94815e3566c1b2d995f13308c0192dca"; - cipherText = "0573e189f695898b209350ea9a5017913c6efe6b8d162141e378be6d117ace6ea080e85831dfc60d9b25db7b9acbedc36a47686ea2d72fc83021df6a97ce91ae664d27678a241f87"; - plainText = "d3698d6eeccb2ae919ea47e9e659cbb0540e3a7ef48c0de63f3f1a8f3b598689c56a30be1c1c371d190da88034d427c088d70684bfdaece77d4406d1973b6766eb9d0f418bb689aa"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 383; - dataLen = 576; - combinedKey = "9756290aa95c942cf7ad9052b9d5b73c15c53b05415481bb685ef13a461ee1f4"; - iv = "add5d542dbef5c12f0505275143c963d"; - cipherText = "c716dd902548dd1bb5257eca07fe3af1e4b4e39b4225625636fc235280ccd8c22f2703b0893535e9115a38fe9fa6df0a64e4c93170f1078f9fb272f650e6490a699d8516a93f9a55"; - plainText = "ba5fc1de85d7c05f19a87bcc520bc38516d0cd0a5c76de4cd668999c2ebc84111503140ab476b2d4a0eb79063810f8f31f10ac93144cbbceb6442ca66965e71d40ddcead3b8f26f4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 384; - dataLen = 576; - combinedKey = "f69352569f832d73112dffb9d39aaf6de26216caea8643f24e9f13ca7e6b0832"; - iv = "0416d05a240d4b2f824a5f61d6b6c537"; - cipherText = "23b25ba5c93f0d004e7044b0ef413e6c01ed52f972661fbab4407bb433e26f146310c135f5af30bf6136b03dcafc74cbcd1cb1dadfeeaec71e500a4e5b7556b3eda224c4a9442a20"; - plainText = "9ee3b369c9d9893f6e1877b6643446f199d7e7b5b78ff2ed26a7c4fc2ec065cdf4e43a3da880e0921d4fcca8ef7ae5d18f90a2a4dae2bdbd77215b45b397e6a5cda05cd97e42e8cc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 385; - dataLen = 576; - combinedKey = "39a897aed3689dee285fbaaa565b2f4de5a2d19941faf75967a0d39f7e906c41"; - iv = "298a952f1c4ae5dad1f41f3ceb31b229"; - cipherText = "3ee4721535e3345efe92b7c826383b69acc1762971552dc1aae47bef1a2ff8f50d3a85dcd9118ddb2b2e3f05e5b3c80d29e1489b23819d55766e6204b63f64bbae61f84a7703fe59"; - plainText = "d5f475ea0e2c032da08cc54dab6bd0990e844032208f4d82ca313649430a8645563caec4bec406861f4bc8871cdd0b5131b7287bcbbde57717439a62fdbf33e97e45a444ef935e50"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 386; - dataLen = 576; - combinedKey = "f25658b4581bf57c290118c831562b2ba9bdd2386dfeeb2465e91db5d620f9d0"; - iv = "1543e5234bc3bbf924b80f8364440b10"; - cipherText = "731b22f69c19e226fc339810e1b43576acfcf96a2409f810df3af692728cc899160de2463246e03747a9db3b118f9dbcf9c6835e2038b16bca1f137f49c711db2fbd001e59cd76df"; - plainText = "b1dc804a94de10536f4bcfea104832b06c3861dd59a08d483a4d2e56596ff002739489995a69b45fd24599a9ac4bb87a482e6b7c7d89092d4f71bac7addd4780e63bd454e5907e49"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 387; - dataLen = 576; - combinedKey = "dc9f71bd12fea12a5888f64d558c14277f5809d6255131e624c2ed16421755e5"; - iv = "6f8c1d3e6e75b645d08c345e693e5ed9"; - cipherText = "f15100a35df3bcbccdaa862106236dbd8c67db033577a737d5bfd1b0a02a379a52ae3f43b5d28f00b7beb69718739a5b0e1f0fb48ee66417a89574651f60623367f14d8b28d57b7f"; - plainText = "4c1f501b80253f165e57044a4b65b062bce8594ac686e14b53686c257f35670aa06290c0d53baab086239bc793d073dc4936a565fd7a86e1f8698094a348516336faa2a1f8169aa1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 388; - dataLen = 576; - combinedKey = "aed58841eb72724cebb4ba7c92d532582b3274d170b33a5cc5df3e9680837fdb"; - iv = "5f32abbe7cec01f36b554c3b8f0e1634"; - cipherText = "e7056907e52627885a833312841f8b5a07bd33ee349c72adffe76459011901e906dca2f268ddce02916f867a8bb0d8e8aa8702491a039e2e49ef81b9310a668255ae1330522f34f8"; - plainText = "dd1f14e17247ee5f10962abc95eb8f2956d09e4b98837d53e0c995e962c0c3b408dd94f3bed6218818c8e76d2b9536ef7f6a5d02b833cd5f57560bac7a7c68afd7139b10fd03123d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 389; - dataLen = 576; - combinedKey = "b9cb591bb5083faa9c2b966fb9559f3e0558cee5aadb4ff528ee32541b5cb57c"; - iv = "364d522f6c33c7beea5869cf19dda258"; - cipherText = "a137b9c57392e0ba020fea87158f2ceac25634adc9bb581ab7914977d974609f31383a217500e79f3ef364645b9c84675389dc1bb0e4ef87842b31e77a2cda52cc772deb05a38a8b"; - plainText = "8c0ce884925d69110581fbce48092891f832481008a148ec99a73895785e5e0f57f7c2ed5cb814ac74dc58ca44974696cc3d6a5079991c7864d608bc483c4e5e97a520bc867283dc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 390; - dataLen = 576; - combinedKey = "e40f5b894f69ec2b34c41f379ebdfe169920fcc37a2b74e36999f4861426194d"; - iv = "c7f10524e0cc43fe5065e0dcc9f14f2f"; - cipherText = "63363fc7bded76e000e7ad526211caa4f64593174d48c49c404a4fa4083991ac392bd3771fe404ed88dee8234b6ea04abfbf55dddc288b8f61c6f9d519421947db7b438644b394d3"; - plainText = "52854c47b884c420de6eb2321e667d457c9f12227dbd3a93b9880962e79acca1a02adfc2ec20bfc198ace99771ad87954e050b8c256d1206ba149fc3f5de14c05f80e055c28710b3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 391; - dataLen = 576; - combinedKey = "5eb44144ea3886808bfe27a7c415b82e467387e1a74bac263871653ab87a9372"; - iv = "139ddec9246b41c16279cab6288dbcff"; - cipherText = "4caa8c0ca58192089ce44de5bb87c265f7d5b129a908af68875b2f948f562a4155bd8de61c9dc121ea23257e54083c8a6ee6cf9b0fd49173a5bfd5db8359cffff4566d197cbbd0cc"; - plainText = "abc1ab364621121e3ce48ab25d5c7bece857d7ee3914097b1ca18b452107a4c005641edcfe790a1ac1a01511623960eadbbc3cd0bef101d2dc33cfdab6ff2965fdbc9f51538de8d9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 392; - dataLen = 576; - combinedKey = "0f656728501d39ad22441dc1ea68b74788663dbf3bfc2d6f797ca9a7c1f149ae"; - iv = "82a0656ab2861bf91d54c4745f1c5795"; - cipherText = "fd2c927ee2adb6a4a5545f4b19737bedf45318ac36865e692a60a0b9d70a958ba6275d6e3ac062fff8c830fa285500418943c8ccd6d16e6246f2e60c86ddd0aab145c58e307cab65"; - plainText = "6c717fe2d7f1bc576104c5afa7949fd3052a49a6177297cb63161bf16e2bb5276da842f2803aef6c5509509c61195a07a8a4906f066d0db302df42e4413a1435a0d1cb08739fb347"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 393; - dataLen = 576; - combinedKey = "94d243615db4227e937bb0846b217da14b02c1caee95eb6ab972917a65972372"; - iv = "8395ea418a3b66c59108133f91dc7e1a"; - cipherText = "418fa88e3ce799f8dfd4ecb5656353240a2db08d334303798105f7edd188fb548565932c028b6138ade712377f96258a4cb735f563c5c045d17e4cd502bb070ab2400a0403db2504"; - plainText = "c2c79aa2c596777f6553d9aa5f13914b4039fbc41ad4b5f09d07ef79790361e8d89c3562089e93a828cb2ea7548d55e8f284ba0e9902a1f9ce842ce2b7fda5bb7eff232f4844a847"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 394; - dataLen = 576; - combinedKey = "c9be21480c24738100670b6653bf451cfe305c828aa4499d61741090c4e32184"; - iv = "8e238d0f860f5d9a7aba517b0f537db2"; - cipherText = "4e1aeba675dfa5fe5ea363064d66b256b1200dcc42e81a4f73d14c56fc6cc058dbe2c29e77881dce7adc44125ba428dd4217166861ceb7dab4b02364b7998ac359a972f04091b526"; - plainText = "07d8d290cb6eb6ca77949524c263334bed2de416b9f5760bcc194caed2ac259c9e8e54773f4f2ebf71215acd5a6100a19c1d6b0f47c2ed73ea96d0b4839149ce95e5e4ba710af4b6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 395; - dataLen = 576; - combinedKey = "3593b944ebb223a93f5a2f1174fee4d48bcf04a051e0ee55513c6b075b6b7a55"; - iv = "1cb2dbde93e5fb31d19a21aa5033044c"; - cipherText = "f12fae71bd2c60aac3d690c9f3429fab98d40dab7b9de3da3386d9fb086e8bc3198abc8912bee31f03644bd261576551daa80c834548e95c0ad8e306302d097be829057e08c1ea4b"; - plainText = "b6c29c98ef4675619d037acfea9936007d450f09848c2b06df348d8ebbda8d48fc4a55d3654de4a9f419029b34ecae653f884e51a219bf456086834199cfeb85198df824647cdd26"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 396; - dataLen = 576; - combinedKey = "4c3df4be3806210fc3ebae7e58cc4bfc090524b00df3846efa5bfe2b0695d45d"; - iv = "d86442ada2bf438046e7c7317c7c20c4"; - cipherText = "09f7e97ee99aaa9b888fbd2e4332b6ece31f806a387b08060c4b366ff25d5e00c29829f1d3fb39767c3b819183210ad96c60974fb54c5d44f8a52fc01a84e6a25e6afd5cb50f0cae"; - plainText = "cbdafb6727a7d3eb6a0bfc0b9a7004679a43805748427ab252054c9cf958a1d691d1b9abf85cb0cb094f82a5ff908b913e83406fea2f8b02870be08c3fdf8577c622578de40237bd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 397; - dataLen = 576; - combinedKey = "fe3e5ec641de89ec1aa37e447c1a996ff2744b8ff078ebe3e85a2b1879c61ed0"; - iv = "0ca43be41065b003278a9dc9440fd6f2"; - cipherText = "e4b00fbc4e3d2cbc9f1fc7ae9b49073bb251207bc1194636f07a63992f3850cf96e36234f149dccc30cc9d1321a41e5d4704f82afb95ee0c4a51a7be1b44a37b5f971df86f4de3a7"; - plainText = "779d4364028b81ad8af763b592050ee70f5f40ea22dfad1cce06897a983ae8845edf0487d0b80766ec5a7cb45b8b1de2e815f5c29af8c80d26859b5f356aa7a6da19a56b68a3bcfc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 398; - dataLen = 576; - combinedKey = "acbbf0d3dc81259d9a899e311504e28bc79cf437d3324802aa230efabfd30ac8"; - iv = "7f9320ea0b08a4b5e3a4714ce14a8c88"; - cipherText = "57c3e2eb6758beda22dd676fa8356e049f3198170ab0a77eba0b07bf667088399d17b7ab4694b0c66a59f2d7a7b212266018ef188158fa66a77c9b8a363abef0e63e923787700fcc"; - plainText = "8370464c0cd13cbb70cfbe8660dc3d929ad8ef7e53d242516fd4e964feb42966b346b3379602685cad29bcbd6abaeb98dd7daec691152c0ac086077d50cfbe1565ad38b5f7a7d2c8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 399; - dataLen = 576; - combinedKey = "1d6e3f24a6d5a956cae561dadb4efcf24c6a77e9efab3a9512899dea546fec55"; - iv = "5d417ceb9e6e3c22a44894d3caebc00b"; - cipherText = "4cdb282928f9f0e782dcdf14456bcfa839c6f94f516267feffc98d011bddd0df75490addf261fdad9faed3737beef02c27ad0c42416b72596419ccf18051e45690522ab4ea0fe6bf"; - plainText = "62a91e1d333671e9f3aa9c7afd18dce1d5d095e4c0239ad3aa4daaa291136f75f763582e32a132bd9b8a68e3254840fb46a612a4f1af2dcbb0cc99a8c5735120c5469ca063e52ceb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 400; - dataLen = 576; - combinedKey = "e3fb872306a0b6c34690950b1bb08838946b3a1609827a0899898d19acef8858"; - iv = "22515dd2642e85e13de8fc57d4098e7f"; - cipherText = "5f325b099d5b07347568f1f5120ede473bd50577daf3e9b7241839c3956380a1141271cda08cb3ca4092131eca2b33ea3d83c074245f5b796ddd66f0f25f298f19ebe700d6bb8a2c"; - plainText = "88a91152a37b3badb3a0664d82ad3e74d46871ce361c7460bb710360a64fdd6df5594f0ba43b9af80c2e6bfc75350605c23e7cddbb9a29f90dfd96d8370ee57d654463ee371d59c9"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 401; - dataLen = 4096; - combinedKey = "b6edaca686ee6be33c1f7ab6747569fdef8a3610bc3539022fcc344d2ce7499c"; - iv = "a254405123e2f368c371465ea0b2f361"; - cipherText = "414c7c6596504ace6ea0908b9580ee6da8664ebd93f44e2d7ec11368e9a2f9ada1506d574b5785c1385137da8f890caedab4968a9963f5697c5d4a94caab3758dfb53a5413bf97bb9576bc22adf1599673772007e9c5ab91695cb01b02d577bf28c6612eee008250da249c50923f8791e15735cdbf86096307e1ff4f411d32071cf1c2bba6b4e450d00d22c60d2c8985414a23524556d4b8ff3eb0ff395a8cc48fca5d2d4ec078aa2fe9a0a36447a5ece58d8380226791acbb991ebfc4bbe12b68d921f3d0ce7f24294e9f88c4ef181aa3d203fc60445586ca23d105bcd25deae303a144552611d726e481f313f9e892d54b2e583ef8ee4e49a9845d9ff6c4157efae53cc8f98472f8aedf6caf120ccc04c65fccce8ff4fc5cb8df52635e6a08c7d0b08384cd54fef3fcb0b7fcdb6f87af28ab6b32402ca2f540c9b3940100f4d3745777112a3f6d3493c9080a6b89aa69974d1f6ccc3d45b577da2f2ebeaffe9174b23917d367662fd0725821bf21bd12169bc3a687ba368749a81d19b3d7c40beb4b1ef01a5c1cee67c958aa196afd05a98d2332300e5a79761a710671ce6afacc7920a197fe2e6fae0312715cb7dee21453a650229763628c2855bdab3f59fca10c9f1a07b77aba0b5076df83f392662d7f8d1817da510d685e490029847658d4895ce0c7eaef99ba5f2b7060bf67d19c69dfb76ec4d90b59b2b9e32fc31c"; - plainText = "ba4319bcb9307914571c7d753938b202a58df948a8b64e69d64da27f1a5b5f0bc43936571cfe8ed27d9e7a7338bffcd395462c6c1f721c120a29c67183e2e452ff98d064e80815f12e0b6654e8a94fdef55c133f11f0f5768ab2f52566f05483e9f3317b3d064f8ce55bfaa7076ec2450fe030a9f4f67d7fa5d7a7395ad7d297c54914fea2fa813d912a7e023ef2aae34214da2b2098ec8bdc845bf351354d5c727e859e9e4bf90e9683f8dfd8d57415f1bd33a05a87f0279c58e77a7cdfe2fc3645b5d44fcfd5675122f73bb0b226d5e44539604b5ee98388f5dd6e4bde00de7101e0ae0cdc12ac13d55c0d9b684eab7c043091ad857fe6c02fe8ec51a5a80d3432a036ed3c2a4f49a133b30f42b37f19da69c5199fe040b0d5b7dd5012d18577d6be7db79cbc3377cb2a7dc9e8de02930eb997ae5b0adf11920d27bcc42bb1a0e5d4e42a99005110ff2a270f465b4b1d562194d0ee9ba4da967d50c3939227206d43dda7af01b0b084d3ee3ede638f145b83e2ea34dbae437136ab1d1281ca688142ef2aed60c76fbbbe9a937c8f631cc7bb14b62a31f0fd4af6591a487b56ec0f20ea11d83bfca2655cac95df7317cdb43424faee8ef74d3c249dbbd795a0a4d32e86ab39fa4ffd7c63dd7bd53a36ca4b869f5bf43e796808417df39977daadbede5ce7459ad2cc771abde445a588b4c3299ebaa8a7f0ed117f8d5aedb26b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 402; - dataLen = 4096; - combinedKey = "449ded836451bcc33bbbc96e3469a79b5382192b3e7de466d3d26601b4647505"; - iv = "48293056477319eb555d5e1b61afb09d"; - cipherText = "0222de83454ee8b3152860a6fbfac90c2aa2e4cbb05b240faa08d4a6a35c403f26e87c53d88382071d7f36ec61b41199255428e943f56cbb6baff7f0f2b0a742a52b8c189500d50fcfdd20a825f99399656a37bd279c562770e9fb9709fab317b902f1a34ae6f7b5ac018e21a93686555045792b4bcb181248dc9c941fff3322a3ca9a27f4bd06ef1337ade85a6c0393a7ebe3bbe7c75361f22ba7934b21cc392627da3cbf0f5ce11676c0830694e55308e0a6cf13d300bc0d3482d52be024f509f594cdba112a2a97d6b31e47f766a486172cd3f555a532cc6398a569ed3186cd8caeb8d391638050eca50731b21bdd18f310ee8cfa76eb0330d76e9fdec6cd1acc9a0b081d3b7d74e27beac132d715b728df47e6a2976c09571166ea99428b35ad65ffea19091b125d4219e0d6c607e42a0a9124f42b6afefddfe006e88009364b889a97fdcd011c5055e548190364627bb1c8a86c4a4f57f2fe15413b7650971267ff7d8973d4aead17e6bb570e11c69903e8f4336e92d9e422377474bed56baf57a8d9ba3f69391502cb96d56225ee7f54b93a31299698a864dcb61fa358f572ada55363a1149ba6909ee90127c6eaa45fb33971c54697f06f316b571207d06c57ccd8f04fcb2993c50c975fca8d5d2ea4f0350576a4d2d5c850e83ffef8cc692152b6743632153743b1c0ba92a69897eb40ec8c3854c26335ca1a281741"; - plainText = "3cd30cc616bf76c478c98cef4c21fda31d91bd1403499f074e9295c187b3bc7a73df437cb9ff23d8da90fa289e51ccb06dc8fd1c447cce81e7958807cb554313ee425727f3efb8c8ac0607569245f3d49aecbb681eccb74469ad8a02b3f693a403a9519a96a0fbbeba04adc26dd7df0986bf2c686cab4565b0378c1d670183eec3010c4982f85ae7b7402f74ffe6320bd1e1f2e8ddc877858ffc38c99133d832cbb825e29d7256f080bdf7c142f7f17b7ef4a5188cf1847ef55ada55eb37d84d3eefe46543deb96124cb88b040d198cb633e41f1aec667265b82561e34ef721f7292eeaeee3cc3f7862736085f573bddffb2abd568928c238173acef4f02d822b208b71d7c7f7ac610835bf4bf530b75d24ba062d942d5566e7fa0d5a5e8a97aacc7014f5ddb2dc972e8f3693dd6538b0f48f144a24119df8f32c3bdf2338da2cf45303191edfefbbdfad19e6feca43821551cd7d60d9f32cf2bb1a17b6494c16d51f8b736ac64583dda6e7f585fc6dd60c6b119071611df87ac7d8d38a6278580c0436825893e9ec3ea81679486e4576519bf33731519d3c1ce46cea80909914bbcfe8cc79901e5fb0e2d67c4a987e53a68b0b7dc88a57d8bc06b04470fca61614cc8d6b102610080164feb19548080f569167e628a2fe9a48996bf01fd29848e7972f683631e4d6485f35c2889e1cbf0cd0fc9778c2f83820bd4852f444437"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 403; - dataLen = 4096; - combinedKey = "91d8ec8b251bd8b014de2a62a9432630276c3589f8593e015ad819108eced10d"; - iv = "05335e961b2c0040bf9ead3c4f6676e8"; - cipherText = "0ea0a9c0dce07a785bd3122d9a230626f350bbfbc6ee84dec738a3b3c0a8e3d97c39ce800d003466d3458baba916bb3c33a42615e1fd8660e93acb847e1e4755d06875a62586df8296c312d9c2117c86d823cb962609fcc5721c6c4fba723776fd9aee66ed5792c0e3f21c066a31806eb28154cc2be956f349c97542584e61e811e63d776fb40f5e1c1163183e19fb823504ea17ad498c8258c6c752333743fc37b0eb434d825933387646774b76a248ca267a2c9458fa4697de89818defb38a575508da15d3b63faa4412d43a589330a45d38bb6ff7c2f82611e7068156faedabd9615195599b9606da557d1e471bdce3b368fc8202e78b13c7c364d00b5a924ff26a2f677d2b9674f7e162dac32a010950570a533fac09441613a1ca010174a98984218ddbf0ad854ddb4849a1bab4360744b9acad51288d04abec125024f7e91fed7514e70c901b7b1227c147ddf86d35a697760cf87fb0c3be7b3046b57c15a2d81dfe9604ecabf72bee8f7a501856656eccedeb5503a905f767c384ff1e83939f507ad1d6377423d3de12667b4ed71bb956f86a793a065176ba80b769c10ec4d5fedd79426d6e028567b32ac62ba68bca9bc225d3e98fa1bc3dec630b66637d933232a3780fe1c478a3e77a9153d0986d9625c2a31cc586e9af964e1f82569fccea876cb88a9e9ecd53012ac165bbf39d4ca585b5ff50011a74b4798f34"; - plainText = "faeb835b4d37f10ac69e2c66016a10122b4bb459ace2b70ec1500b88f81531ddecd878c33843f9cd456725f92c2daf720ebc31476b9ca86d00c8026052dd027b250e6f1756a8f83afa56acf3f42652302a0a05070217cd65ccb145c13630ec146d021162171baa0268ac9d796ddba41816186c336560962693aec784a8bd2b012bced36301f0fef07909e560c4a36b10b60053fe4096eb65c10d445d3f03036dcc5635388e94348ccf1234b91d3d21ccc64b73521eef219086ecf2821a2b5663ff17fcad6de75b88e86dec5beac490bd116efa4788910e86341e3d84cf49c546c327532897eaf3b66ee5765857f807f2f870cec1fcabf7cf6be68e8d699145925c55cd5aa03cc28aacd03fadb33cd2c9d41839df2e9ba5100526f01faf1f470fdf25aeff299b2ea7195ad3d2cad62c521f4f6318f31310050a6611bc319a326b575620e8f8e9e6de4810e5d008064d9b0c0eee77b720ee2e2c4f0f68660e37b53b4f245b3c877ccb740430dfdba093421d58d148b007d277259e71bc1a410ba55f50f3b0a7b7011723d1bab4233c2755bf469ad2f522c831f9f7021f301bdd7acd8febffc34702e25dac1be97e7f41177912ce303be94efcb7c99c68cc9e70e9ba6c3436d29cb759abc4ef11984fb27f72030535a04529c3d8031c30014c2774bdd1890ed60e47569a3969c3eff5d978b154f68276b87a2056fea16a231a5a84"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 404; - dataLen = 4096; - combinedKey = "a6a663f32d1c56eeed1ba50ac158dfcf06331013ede68d0209698bf54676a9f3"; - iv = "8cfbd1f7baec27824c47c980709f4860"; - cipherText = "802b3577d948c535dac371842441eac943d1a84f9531eff01124d7eb9ae9e5995664550161d468bdea32e9b789742b4e0f414dc16ae61ca3e002458bcc86798e307bc5845292aed69c8374b4a877170a3db8db8ac955b731bc977742c7faf3cf85061eaadeef7a6b8d54e352cd1125fa0d69bc429f05017c1cd9a2f7a5bf231a6e1b1e1dc2ac3606ba76534a68872af4ca27819ac2b17c789669c4121c32e84fdab3d2a71af2ee3634efa94a6522e7f5fcc3229f641c58fd460df7e2a383ee4f34a7b6f7424a186e6c17d9018c27685bfc431d0b3e313861837284ebcd73162e5839d7bcd479f12f5ecad3d6f3d4891e83cfb83ca843e6d929ed6831639ca01a84bb04e54ac19b3031a136cbf991822af0ee66cb1a80e764d03cb275e5ba2a6499fa3bceacc08f629ed4cf591993c9515e9dbff1f2269c194b696b72de5b61db3a9403986464e7c90071752b9912d46f7c3e1f4d4bf96c9d7611d0175641b5b0838c1eb2d52bf9b2bea7bfc06a63ee08db92e502da05e4f2fe89d69894847b7f0d572a133d4ea4ca0cca212a0ec5e0cd49f02de47752810d5d71f6defabd0317dc349d935ce97491a0535cce756b80e4d2b27fd236d1a18801334220ffb548081fe28481eedbb58b140c12351b49eeb320476b93adb1c963a7fcd90d2b886459d4d9cd5c458b126fcc817526e745029c908b99b752fd43ec4edd38a066ceb39b"; - plainText = "c15108636c53e25ea2466cbfb3a869624438ac155abe4ba1ae5df51c9b3561509083e1f6314d53b2efeaab4ade5add8bb5bac58f367b431ce8d0ef7d2cb85f864dd837d18a915865515a0b1f72576c96d892ccf1851dd2625b74800632941e3d2f5bce1804092a01446330a7b7c96427f1c1423f260c7b75ea65b08f6a5d191e9465b96a7d99e7fdb4eaa1a9ebd618b754532f3bf7d9038002ead2156ac0360dd60aebc6096eb370968de3c0acf1353539bafaa46df39d54481da77530c4ea6df591d291352bfd6262257c772f8f2e9dbe1a54f7cdb556d3a94caea9ff52252303515a9882bb70d107953f93263a4f82b8ff495f2411364ba1e10d2c4e654e376014b5130434444c5e6dc146c994ab990a0846c79228b6a16c3bff8dcf9566878ccd1be0a4d57cc32478b96ac33bc7d51e75f5fe4e74b9f9563abc72aa7a4439159e5ba16bf7d6df1aa497799b524e6aff76dce25df2ab058ba90008e58b1c4d4066e01769afdc8cf34206f9c25db3196e9afa7f30a4d9bb779d6bdcbbf2d56f42efb1da18b162947824ed95616fc73abc92adfe763e5d97956f7fa9b3a49251ed0d6cfbceb90f7c297a48fff55e08922935e5e24c63345f69d55d1c0b1fa2b3a3d2d45cf5905c578ebbfd2a8caff30034a1652969799a20439548cf21392453d70bcaac102224e136e853bf8231713942e21edc274172692bfe253a8e54b042"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 405; - dataLen = 4096; - combinedKey = "6766c79d788eb1d7b2ed628fc5778be1f19d5ea057e02eaf83c05507f67b1dca"; - iv = "7584a1ac1ea134814a64f49b0d1bf4d5"; - cipherText = "2b7cb06f53b1bdb5563e5def938f57fff305addb8f89eb35bfedb082d1c89d284719111313e05b5a611f78468d88ddc3a937fd78c334dfb96725037f39a4bd22fe88e35de89d4d66b91f0391644c95dbb66b1325facd6f19ea2af54b57486f773fe2514ed2caeeb78dd15c6973ca50f48e573d012196eac31239d8b48b18bba2112a8caa67ad441ce36a4ff88d782776328c8783c26ca0496637536a7b97ca5bf00ba8ad64fa198eff082fdaf9144fe450d51e45832d7cf52ee6cb24df7e3384189650bae2c24e24550c38e47bc39b6cb70ac9cba4a57a9e4ea193a0204e7dd766c47b61abc6a83b779f2f8aaf1046347a607b4c5cafaadbb57dccdc915332ce4ee6d36dad1f7c4c488d6d13d5cbd813964854daf14a849ff9552963e5730da55f89582c78c300050ed8f0383e664a8ade4eb92815309e75dad0d0f436b687b22c14cd156e091f4d6873b1b8d2946acbcbf488fc920a464ac8edd9f31231102a15689a9f5a2d3884bf19f84cc1fd4399fc8c2c2f3656e2e2d274afad2f2c661f6643da32359659e5bd58fde38810e7a2641b1660f01864aef5cc1da4594910dd5f8d12a14276beb296214d737eecb3670525bdc3254151cd93e48b9bf93a6012c66a343451b6e2c366b5d72efdb322323f6712b4e93804a10930f918260b13611c80f1ebdde89f84100467f063e1e9c385c654eb59777d50de4a26aea0f89233"; - plainText = "f73f90a57bac757be32c3087e0e9c7a960b5a6f4ae7c6838ad1db264fb25ecc17d629753732dbed8367781e77274a11bf965732e453f74e02a1e55ff83f10034ba13714c07ce33755d394fa7a75a71ebf31b57ff548deb4faf3fa07ac50521db2e48e7c1d881a91227182494199475065b8e96e5e8a53765a60abaa4d9af1956bbad9ad3cdd3778480780857d2d78b76ae3701488c026001d1e2d836f369232ffac679244f977df74f5ee73af362ffd60a918ec0745978450f7abe8499330fb7e97d860330b71f73cdea7413a5e3848088a59cfb98a056fa2406f0775d30edb51ed745b57c8878b83f5c6db88e495caaee4213c6ca024aae69c2e2ac75ef6685ecb4beabff423da89b5fe783b3e0ea75513275aba62b68ecbe5074c69e44c891cfb9ebf97a3e3a6e220f5a5781b45bd9c076e0546020ae7ae9c8e567baa685b7ba73ad189428754d19cd41c2bb80e327e7b89d5c6738d4c74d691c20bb061845c58515cbd15557ed2e2b4ec4a019443a3d5d6d7e571eff5caaf4f05e7c0d41eafafa473ed9d06cbbd99e621f5970a697b48819396e92ec8e8a2df5714311865b4fd985b05f3c27c293a5d5a8b325a66c5f4931ce279f4f24307961dfff933868eb448b769b615c78c094cd04eebf11ec0970cffbeb204a9a13f424eb56ef00e6532180b778cb56150a6065c2f45aaaae045e270bf8e5231fbee32e21bbabeb62"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 406; - dataLen = 4096; - combinedKey = "5437148e9daa40512b476a42b410b92d2c0850f87550a600096834e596e9b297"; - iv = "bb4e0ceafde081695deeece776d1ef4d"; - cipherText = "ec93b05534d1858c87f91be59cfcdfe904cbeaa0da3a770694f9c763ee72e6b45b52bb71b7e0fdc1f616c6baf29949ee5b3445fd72c57ac79265280f78a22aac554b1939a78bc32af322172fe758eb6feb924b9949a8de2f35ba1eaff1dc9eb96ad95d211b5e6e692b2a29a15301db57fccba3f4c7f5cef7a7a06fc56265d0458c6d4d3a633c854f87f37d218ef142eb21c16dc666fc714579002d3556b208bc0d348b5f72955a3d51b1713ed4905fd77f1847958f6d8c8a99c1e5eb75cf693059b3ef1380924817f3e635c2d683ce983ea60702e4bcb52fbec00384c570ea5a8dc427948408bb097d0b9e0be197b73d4050d845f46d73556eba6e37600e6e13ed42e6b3225b76b2859558109fbc7283c7afd6e21f9ea64e429e723afe5edb2645020ed50aa059dd12373529c8f018ff4497abb1917be301fe24d9f0054ed03d330ec142b1d43dd557f26fa388dc70e80fd762c9e97b60c62063336e3a5c07d473432797dc166c73eb5122185f7e620a0fbdc99245bf18f861b393054bb39e25a573738666a6e373458765a90742957218278ad118d9bf5315689116401c2c47c6643806c819decb3813ed6300f032ab6f531fd8b2968ed85351e87c488149c63d34265d2acbc5f623c51f7400a3f9be69ff9039574e9d80ae508e47451f24431901d26b4559b97c62058838a352cc5178e422f8201aad68a5c0f47673accd7b"; - plainText = "65ead426dc53fb4911c2902e8007560306850cb3b99a92dd5ce61be36ce9070dd8fd43f8949664a4a724d3f40d9c1ff23cbabf32c5445eb0cc61e756be25c10d857f333941e1045f2356891f34f124fca56e6c033d2100d922c4c8568b9e9e75967078903b54914564a830757a0d5501211312e8c114206023ea08c4e350dc5b368e3dccef080eb668025908011a3daffd2e2b619621a0ded7fe9674214d8d9b1edbbb6c05becc2895ce36061afea25c40af58d134e1a748f79eacdcec5589f8127e84f5836a7aab97f6e4fedbab4229b12d63c73ee8cac1b9b2629834647e816d924850626f1105c6e605fb50a508e754653cbf66d6b99e802fa4f97c509669dcdd8cfd32dfabceaa9b6a63a48fd4c88b917f514f27d2a405ee0192a13873765bc86c1a6ff669d8fc74f351addfea5f93d80910e6d08a9f93f41332ea5159eb7838488895d797a599eb43438adb59b5a2b5019a6e3ce93420cd9a198aa796b2e539846d69e7d66e017bf26a69ec76bee971e3baf57d0fae724145fff758cfa31f80ac01110521875f252e0c816154ac4bfb38199a5c506a496901e307cab380f3df5b8771c439a1639964b65843ebd402d82a550c397a485bdfb926c9fce1ddd4b6526a85da7cc2dd94c964c58b90342ee12de56f608650c38d5ea266a349183746bd9065555c73c0171a78417e6c560ff2e2b23c1ddd63d4b0bc95a5041a00"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 407; - dataLen = 4096; - combinedKey = "c1f6a9b439f5e824b470b5de7fafb57ebb98aa66f720849a3b9ba2c3d27edecc"; - iv = "24febe3c99a51dba8d7fb409c23b870b"; - cipherText = "6ed0f6ed80d5cf6aa6813a501bc72c9cb2b45100e7015cee5dd23ece61d0e19d5774a76c65270be82aeb9101d94e9b8fe717f8a72f6c3037508efe99b1489b7c63af31a01bc973d8e26077c6cdea6ef33564ac989e815909a985fe27665cc6bb143cdd81e8bea9ec31781c7c5d4067433525f4b43cb73820a03d14c21a6a94aa01036ee538b9a85a41565a7816dae2f9def3d1f1d67cb27a1b0a0445f2d91a2cfd1e2a55705856dde158e4cd9294b6f573eb546b1d4d2b541470068fb8ffd96958b66853558d61dc26732c7bad5168638cd629990a5c8cf1477e5f74996e6646c7e3f5156f79b1591df4d7fd0489ac3db7ed919a2f7e475a9506b2a13d7b23980d467991be4ba076371a7a56e33953227d0be2d3d746776ec035a7d45ff89afc4cecc5d1a6bc08a63ef4fb8efd6651299c3572494a9cf5d3abda49f29349415cf32f27937e1a57e27c29f14d69d92266d0767ca31becce0728260ef3c1da192b7f4fa53a86b0cce8e81c716028a6e2509b4b599c5bd29258113ae8638fccb2aa492b6cf8c2679b8bc53bc60fe03f32643dc5ddd61baffb2bdc9f5d619dc9369d16c1d4d6a1375435448675b270b187094d6339d5f798315e8120dd25af4f49f5cc58afa6a00f89fa00223f7552442c619029990f46f13e14ed270c73e360b67b28b468b99b9a8124af04ce1a91d8d60af2cee8a64891a5e22b5a49992c281e81"; - plainText = "7301505627d1b42842a85d74688b52407c1f9e20e9b0a94d8fdf1fc9561d804b85d8b50a9c5ec08ce4f0d9d8542e6ba2077840ec054cafe04a7440d5003903e455d8b39f53c940b365e573e5866d33f4cbb23b65f9119d89f60273dae20338f8048d7e921e4968b230044e287ab3d384481999dbfb9f457a91739b976969a7c43f6717281406011e68345233d4de936ff8d6b83dadaf3d11b3cd968d5d44a2e191631549d3ea5cf02aa021c5b2d52a269cb8ca4165c15a109ff60973c7f8fd3d630b03ddf6cf69254d2631863580a37bbf609af6690c3091cab385a7ea513405cb866cf7dcb7b8e8a1feeae975b043f117d777226d2bebdb585363e69c4fcd6e1e3c210a930ee289f0da6df6ce20f925f88f509ea2d6b2303e6cfa6fe63ef9b0ef5d5417b61799bc216cc5ba857834e31e312c0d1a19a3b2d6e4d871f26c9da8f713acc209368fdd555e304374d7c997a5425824e3253b9950271928e4145b041f1b60c59dcb114a916c28da46cbdc81949068dad28941446e6981a659346744afa001018bddb98039549e81be6f8742a2942db74676306107d75c7de44da4dec29c3a2703437b23d74399c63d436a79ddf1a1763bfd06617e8cc83347f586c68b2ea179d046ed30235820d073fb99404fd759a63fef4370d1420fdee7a8995e82ff4aa1ca14074b7306f60aca1e93f84a8f2b2eca3533a45a3f9eb58d9cfdc2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 408; - dataLen = 4096; - combinedKey = "e49c9c5389be5cdbe9e356b477192b3a689b2d590f798772c066b471f6c53f65"; - iv = "517a5162a1520ce58930d5bd25b040ac"; - cipherText = "43893c7e10b80be89bfaa9fb4fb9e896c541175107f8f797e9ae4d72c14fa0fb7bd47df6d79c869a218843cb083f8cf6e28bde65a1a6ac31a588472b324729cd2378c76fcd786a3c6dc30d4b8aaf136c921976cb023e6e464a2fb1075bed72cff9b5c32e0f54b7f5f5d26306f85bf96b14a9fe8800e6ed1d76938c5dd3021c180c3d283cda4d4a63912b7c7a74325ff8c3e72f80fd7c4724aa388a0d4bb9e8c52df3b244c396836118e6d30e8fc84f8471e9dc61df48d438b265408824f7ee6d341c44e19cb9defe3697b8cb8fe517be52eecc245b00bd9e3571d6f17e7299fbf5bd764b5335865cca332d949ddd07212ae356e07b9bc7018035193000b6b6464b89e22f3d193491bd76ba110fd5b88b3521b8a9b37e2111cad7f906446024cff2fcfd9c4785b046edf1ab27a7b2c179b7dd5be137600a9a9598d066cd3313baeb8edd2374c38ccf8fc09ab7f1ed23a3905e8a595e954fc0462589288a78f1e6b4799e34be57c719997d1eca1ff90877f35383701845d5e44b838fff5665592377b88b0c6792e07f0bd3da99fafde61952bd666d4ed03ab08bb2bcbf6273dda2f79e1d16af0e08af87e09db5f4852d23ad3d5666b5d363df436e9a885ef8ec7477331155862f4a875c426653eb27932edbebd8243aed3465a2de89d2047e272594da1df217b42d61a1c137afefd593d9db907c0e92edc7abbcaf4e995c77c947"; - plainText = "eee6d228a9ff82124efd5c8ac208df5b31675871ea014152f904a8bd26b24afc8bd525a9f74ab78b0c1b77a24ca0c69f483d0dc0c302f6cff10882b48bc075310809e661c534acc6d5c7e6cc6d6d22e8b9a69d85f86148f1dd4a9b492c25134b39412875d67e98ef552ef023993141c04d7e10dfabbad3891c34b8c777cef844a8df496b9a97127fd1c9b2a9c39a802e912270c4664c52f970da9404718c11e114ff9791b4990aec03ed6fd3bcb3e4cf2af3a8f36965306a84b1f77a5ce7c8c62ce5e5d0746bf76d9a95f0807abca8b4ab2c0fe6a87b8059698b04c77398099eaa201bf69029a96aa9b538cd5e09c550a18f943ec85397773929a32df84bd9a30cf7ba58984a131b4e3952e0be8331d5f4fe76d7577443f50fee73fdcf5a6ebb9477c03988568a9974d9339444b59bce222525b2ff61010797e20e28dddeeb6ebbaede46e693a409cf339dc05025d65679eb80b50e539a317bb886533c399d8ef59cf2cd33d9b0bdccdc781632229c4dc88a4c6b5c2574953118a7ce34897c619fc3f196038d1773e8d5e80000357ec96010a0e5d8dc7a4d3a2934f5469925772ed0db6226f3b8bbe84f1a45a424950992e6436b9bc8aeadb395e4866a94cf26ef6b891676414e25941af9d0a9fd696fa8548b26545c3113fd58d14989555c8ab0b937398dce10edb19cdb25556a4a9d07c8a989effe8cbfeffa499e354e6dfc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 409; - dataLen = 4096; - combinedKey = "05e9deddb073b8d8898a422c2864bedbbcf01f3588ba3b10f7dc06e33b78a5ae"; - iv = "72d7c8e450a05f1eb96ef4bb30e16508"; - cipherText = "06d4224bcf08748869c7a5008d0aea2d7056f0024ea4e027a3fad91b6c0b8356877e2451d99df85b9c3bdd99f5990846f8e1d4e83f2ac15b14995b9f22f5d432505a9fcf0985f08f3d34e26517b2361c01f97c06405a1f463b0cc0ce2c00be6018a640878f578b41985dce318c3df4dff4821e1d363c8fc2fa1396bc2dae53015b0379b741fb50fe7f83e1e025c9e819846bb38124c45dab88efce8451a639f36fe92cee8aecd1a3cfa78134bb3629f1469d3148d82bdf348a9cd13bfa29296f8ba5689be1bf4a873dacfe78d3c38546381230d17e9fa1255f3901fbb06d8c93973936f5df934ec980f63d43e94bd488c72fa9c8673e5692d3a39df904a13485cbe6877037492d041294fe93f1e889b4ff3f978dc8c592b12015b8200e87710b206ce9ca999d8d5f3e9a458bac29978108870d0a803748fafc9a976836be2a4ed39c6d0eccdea9bad9fc2ce2c717f2919e97b8772f28640001f07620ca514fb60acfbdfb18c4cdf6ff6e0a1e1f82fa12cb5099531efda3763a4a4290f22aeba4caa57aaabe6a03cf044234113d2b0b61d8bc60cd04946eed75dcee163c7c3f08658511f32244d31673aa4d97c48dc30e30af2aece91abd8dbda80ad076c41259ce01d42aed7da76968b81d658ad40c156628da62e3be2663c1a305ed8e9f921fbdd7a339b5d402076fdcd42ad527cc2845e4c7ba70fb8d943a2e86d42265d6dd"; - plainText = "c4da06c018c0f95ce7dbbe7d530a784ac6b12eb4408baa1facbfd441d24fdbb811f2bce87b1a770076ff1b75aa51b42d71b0779ad96f93914e97a5424ae6a8aaaf06829ec1fd5f49beb512611b776a4c15f5d86595eabd74aaf102d4530ed8b3cf2ae4711ecd89c35f550698b07c4e26bc4e5474dade1a0e5379f89044cd6b572a0518a831c36ba0ed74b2b89ebc87ee7b805370b596be6632a5202f69002b2408567bb2a4e6d290390ff5cf195b9310c88c6ebc1540b08acd2beffc4b2147d3266df7e26285ad3993ec38c02a6c188170206a321f53b92841878f2e19341350e944a3070ac2ecaf630065127ad0020c2bd1fce0a6ed33e90b5ec657b5db61388beef0d6a08b994468f2f50709f71747f801d6c339f8f282531fe7a740ffce3fde1ac319be8d89914d28a7bd07325f4979d78557089ea6caded3aeebca9d5ea66acf169ce708841789001335d2415de0cabf129a1198e4e6ab5d45a264106ef233e6029e0b10124bc191a5b852d01eba8a25d0ed383e3dd0c2494a863ffb83a9bae3e0bdd4ab3c2ea8a2c73a87cd5a75d0fc5835450a637811309f602146c4dcadeabe7cdbc0ed6b3db1109b8c8630ead691207d851c7b99ba7f39fe58d6979707c1292cfd74ef3966b669e23c51926e7a6753fc7f0f80223fb266fd663f6bc760b9f4b1d9dbf78d3f4d631457f66acfcc2c90fdbacf19a90dc5016ec8c984d3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 410; - dataLen = 4096; - combinedKey = "98a45f729bc7b8f58fa06b54923d961e25d1367cc73373c1aede039220b5ccf7"; - iv = "650ace9261b276f9567e0b1bfb5944ed"; - cipherText = "f0208448a7bd1322cc03d97416b3f6bed98dd447f97a2d269b9e95a885e64c7285389dfc58ec9db2ecb36394cfb74b3667fb71d3583d7baae55af03e5b1b38a5e8978ae52a03e161a3229992147b4afa7ca32a0cc8fa24d59787f206e71285a7703566dc231e63546970b92640d7f6262dbbf05a973346b2035c8113c4090f766add8e651e078d4f255b7e53355f3b92b90fdae4ab0a47a1285fa93ea5befeb5f5e85214870a328f33eccaf49a9f9dc2bc924032c9c16e6f39e5302b58e3ee17d4d2c569b41a3b4edaa60822e804f869e155b36e873704ec336502241e815ca8b3b83e128b39870168048151f5535bee36a7530f03d812de171b462db81f04018b2ef4aead73e044de49dafe5c45940bc95f4e88a6008e693538343e8285d0cdc959600f4c7cbb426ea2829d3653e8cb427960d2d22bb9db4750603beb33dbbe0a6cddb7a0627e5b813f1cf54690ebf3e4f601fd1a07848fc85c744f870086ce2be83e52ae25a841acf7148ba8063e78070e70ce6a884832c67a6f1f5f3874204d6d121e381f2df74045d2a0746f3c1379101d0837fb9728342a5ee1ee0a2164adc6b5931ea3aec16b1d75364cb929021c4b9fa5bfa6956d65fa28058fd308885e5c888c5dffb63825786f8f4ffceb662f163d45f2b4c41848ce80eaa276ff392ac6ca681b07971662b6047423a25dac2934f44413aa4cbd2708f662d96b53b1"; - plainText = "dd5df3e5f91849147b52b17269ca46efe2253e65784fe7274eb0bbeb2f96cbd2973540723b9c5e1bf4ab838a22a21823e8e71018c71ca4db843483b40fce7eef19725f473aed853e1cddcface5ac3352d4a88520f589b09de70e7c8498776284bceede06b0ce53aba6bab0f1fae6a2e74191f67c995891787e57152597ee926d41109f41dd0fc55230400e2971bb33dc4c30cf19b399b989f824575aac4ab710cfc123e7a7ea619ecc9a75bf3795ec44b952a08c0543e2ffffcb14ad9500b9d8aad828921e8f9c48f00415e6c26399259af0343067834bacb92a1d66a31ac9379dc354728e0cb18d0c69a63c751b3711f9a2fd609f4a55ace9706cabcb52f026058c21181c683de4a321279fcfa3080507526bf0517da8a0cd6ceb336dbb6ba30566e69b533b643a10dd2c05f4c71e7535f287e912ba51642d4c2d44b324e96d676e4592d7146ef360a5bbba34bd1fc4fbe903b34a02db2cae3599729b43bdddfc1f40e9e961a5ed73f5d4c251cda2fb44e6b711a3fd51f60423af7e9c3072618970940a3dca32928a79feac51a4d09397e0d57e98cc742ad611589c1dcdb7553d47e968a5fcdebf6a3a2d62b588d492b8d1362365c9cebdedd652da2581aaf8b889811692cc104ccc2f5f074b55ba31c43b6d32ebfec4b0675bf1ba7e60a0753f9321809d4018713de45d5395191a47a36c2efceef23e6c47627893e3f0527b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 411; - dataLen = 4096; - combinedKey = "d4d472255a8873c6469c75425981de0b09beb35ae7c431dd433319894fffec0f"; - iv = "dc6d784ff2e17cdf08e3cb5729a30e01"; - cipherText = "ea75e723c9bd96ebc1d25920a8a42e436a7c70c2816971aaa118fc9950b67bfe4c166f5f05026e20b86b118a3f45775c1e9841191f1b53f265a933271b389ea3d55bbc489af775a767d235368a98e0c30209727f9187617182df055579939de79396b75c4757e7302fd214dbcfde73982251fbbd16bac97689419cd88e9299528d8f371c00613d9a24347bed5d62f11f984e99184e8ab40c172c0e57dd519eed2454fa5f066c3dfb9a5cd683ba56cc2f523e05537d165e8345fb1a2f19dcfa279ee711cc793474c8cdc55bca1ddae5bed02cd925e7ac6dddda3eec4db2a663393a147af9cd047da296c2ae021a6ae156b5140febc440bb06ed56d6c4be9e3e7cecef423d236a00b50c87cc26bfcc3816469da6ad48fad433a1ee50dfde5886503ea5427a611e3b3b9a81ccf0cf17b951a4494057706881399ec060c6151ae3657b28be1873b50d48f83c15f6f52da59f76a2c6df2bc979e80efa90d2be05c9f8345f270db389879e1bf967204f47e318011fa0fc921c5264ae7a85244a96d6072a1772db74e9b2c038e934ab7d8f18de9af1979bcab3ecad2ff984e9ffaed473ceec530334a479392432838764a5d27503b65dc27358154d5a3786237e9561152853b2ef32db1c4da7379f24ee1eb77599dcbacaa0bd2d4482fb9d8472ead2a617d948587062e8dd55e37233aba842465996a90768886a3b98880bc7ecca4841"; - plainText = "61a59e05bc2f779c1682192c63373924d845360cc031e8588de238ab63f92c9a5d88a9f607633f1ad21a01ca2b6311846fdf3ad59a392b718314fe5c3b9535cb93025b457e5829fe14d859d909cfc7ec8a97e1e5613cb713375efd04fdcb244df48477bd7e148e1ace187f04d482e4b1b2ddcb76f1b3aa1c0b81ae40f020e72085277ef32b765c2977504a72d47f2fbfba77120bb5847cdd482cb2d0799b739aa2a150245e1bae94038b2d03b00aace3f951a80608086ce396dc939ebdd12ad8b1e22e9d747dcf30916022e99fc5b770507af4f43eba075844d270abdaa2d0146eac70b039836bccb14871acac18351e1ec49c062079b9ea4f8c6cfec57389015b03bc1266e279946e35a2fc530f4c22575c055c5d73b7d8f9a2977b072a38e2e4d4c712046e65d8b3572075bb9841a53305b6e53dc95c2fcace986f2e19e4aae4f25dc88a7fbe286b8eea9cedcbfcfd7df3be4861998f7f3083ddad258289f9532fdc6b1b9ec9e0dbec69d5eab7f1566007cb4be848e32265289c432e47666a76aba39a45850876888d670f37a41206fe35a6f8554be577d57f3659eabcc3d1e8aa4d2006bf2899c7420e4f756bec4eb5d0fcbd35e4c876eb35e8c5eb0ace2cd8b8d9baac125a1c4d7a77b5ade6a8b07309284a37743ffb4e6282d5fa59654d12f0942f890362a20bccf2b27611b921db52197f7ed2397b91e33405a34a4154"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 412; - dataLen = 4096; - combinedKey = "5d141972dd23d23bfece87a1b1bb5e46451b003b702b1d7eafdf6f8b96031899"; - iv = "a2277a33424852c65a69a4c3879e1554"; - cipherText = "44c3d5e0fefd2a0d298a2d74239fb600c80293c32da43baacf669d308b3e9424baa5bc83983c4d1cc35a37c4397fdba3e882f25fe82d7d376e8f843bad895d3a761e8c32bb0eb66b3beb78ddc7a33d6e61c4cbfa41b620b27623dded9362c5ddf569518bfee3b78e37605759bf73bac236b0e3766f698f0837ed46a8f4b921e2fe8e99d6ec6e3e68dd8be7b3396a72c5ddf24ea2c917af7032d1ce0de3eac8668327582a8dcd51acaa8392a5d2d223368d0e4e7b11500fd1ce9c24dcc65d01e6c7ec30719c38782048977df72124722c2c5b61be4e37e23c225693e8902f2576256a30a3b8d63f236eb192468d12ac4bc10f3f91e0530649eb4d58dab58a5e9a64dab7e711ab7c707dedc7df56e56bb0eaa7a8872adf9dd014c1e8b965a44c152e767a9eacebd2cd2619c72676d9209a3fa969cdc3a24d03a8d8f75bdcd55eba8b25af9784fc694c99035c6be7a4a659f7281f8506958e0bb3c80a7aad6e88809a2b6afb13a10c804b8013c6fe66845c3ab9faed16aa5eaa2192fb126a66a831893e99a60e11cf0a97302f49152cf68ef6082ebc6336fdb09fe7b87270fa14efbd1666ce9ca1d3226469a161ce5918050fd6bb73a30176b07a77b38a9ac3015ad8823bef9275d5cce740f5111b9bff3346c7796d7091b1129c310aa17a3c3e94fa9f36124af44733f02fd8792e5b223c48e400159e93cc4d0a539fe9ce105cb3"; - plainText = "38c841c74628937df1dbc1b6dbf5e9f660a86fb7abff1ffffd0e527fa627043cd7519c774cef991165ed55658d746a585b6942d15eee1746336588be61a46da2dbaf5640ecf0996c8f2a9a1cc2326da37c4773714a3a1eb56591fbecab45f2afb3ff1e6a74c1c5cd006d62508b76df145b7f6fcc2882df06e2cc135135820fd188223a0ec55cc9cffd1ca2b627d3cd047a34ae45184157bcda6fe83703d19c288e7f747fc35e9c9ddc9a3a9ba8a2abf66d941240ff70760782b2f0724aab5acfa2e092502a0a72e33d8db4891df3430faa07933ccd6b5201cf1458520ac2f7573fb7c5d06802db659fd07bd1a3c1ec942f975bac2fd2ff68e5417dabe63e45a70837f418cd251999e5e348d8f4076e6e17910d550975cc5acd01ccd9cca60db14a50cdc21d6c5b55f94d3bee3fc7563097e3ce07a0a30170df0bb960376fc7b98a07b2cd2fb23e333c3491def9fd214a62917849756a430645744260ccfc67d7aa6f8f703460226bba8329aeff8c48d72457c7355d9561ddf11736814b1ae13a3d18b272a955c26ac1a13ee19c170ca3cafd00ca1f23b944ceccfaa763f1a205d1af91631e1a65cdcde73912581b793ccaf2d18f58ce3c9b95117106a20264e18c504945ea5af7440bf59fd7d275da0210864804995098f827d8531d689639302905eecd655577399f6bc486a1eab02ae2348494299379c93caad8a874568f86"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 413; - dataLen = 4096; - combinedKey = "72ea7faefcb940e380e84933f26a2f342d91e417494b6328cdba202b636ec37d"; - iv = "f00e432ae06276dac9f72f004925042f"; - cipherText = "1b0bbe688d97c5fd14ec9552a2ca8ae4d43d32fb2a0f90073454fde0f9d2b34bc3539a93962e26e78af574bb5b2d6fac7e65f69305c671f7b317180495c5b2b4d91bdb10385c4af90565eee58d448daf68686603a460314a6807571c370f102da9213b04f82602202c17c6024cf06bf10731174c110c6d7f21e227531f7bd2b2bc135d3910d49fb733e42b3d94fa0627a8b0caf9133d1cc62faba41748d6bcfb1ffe7d961da1a2975c3135d1148eef53cdec9911ae8265fce293636dc61456cd11877d4684e5e2ea2799801c05f15e4f1903646212ec5044ebd8ebd642a1e97c2ed4f343bdb051a8ef0355a28e4e09c17e61161c429c661163e40f1af331ccaaf1e5bb35b3a09758ba9e02d106873dd530c2bfc59eb3677b6b4c478e55afed6a187b2d035dba8f4c758ced515af50511a03ba4c78dcbd22682933b58cc5b073852ac613cd1d809722382d0308ca274dbe2c8d4c3e7e9f17cef98d09953e851cd0bd103535fd5b6596fdfe3b25e4b6cb2e765c72617aa62c1a57fde631ff62d66d0d39475c8df451edb74c127854e1545c1961fad2c9d7fbc051c06b2d3dfb6b0c6c6e6545893f770cbde3bac1fa68836daac03e1d71677b609a11f091af71ab3a1e43722301beded836c183dedb67fe8861a088b0d42ea718bc685161d4d6591e6f4729a02dceef288d81025b88cea7c427a6881d16f6d60570779ce575b41f4"; - plainText = "77fb2f41218a03d8881a6b283b1aacc2a522f72f04fe3c491b35a34f04d8664aceac08d532add623313018643a359ef315281bc35c58ffede8559865e615170e2f7b42d2b17b8771d4454367ceef7d4a20560d87f06371dd112c0b7aee9b02b767f77074a4d3097cb0d7028ebbf6d5054f0335f4ab02dbc9c514882e1246c58a3b362c18edf1e3266d2d7446c05893908773644e94f195c56f01529aa674233d10bd316afaa15a0adbb2a809cb080bce2eedb62c7157c1f894e4d39ab7dacfa47dae3b7411de297cebc733a74e6e9026619896a12e524b8fb4b70c872766a2c64b55df9c940d6a932f8af2c7ab8921f330afc98bf7ade52379d5d7407198926e4477e6b12cbab9a86369713f96e02976d0b50ff42494b0762363a1284ab0d782bc2971ab700167781012afb1c716a76196609e95c61f954b8a37f8ff94811569bb211a2abd1c159321e684986d391917c084f2b082dad8c62815231e2f6cbe924440206df3caba63c82466d24279b714a34cf35b46a30246ff84264e1859a4d3e2298991846d9239736da584e435cdf7b183fbae86c03804fb41de9cd379ccf912c3a902219ea261d45052d684625858fb434ca31f923483f5ffb3ee1944867ecc71b3442524f91ea1675380e8fca16aa9a8bc815f77dee8615f2610f45b7c9e63fa9c2b23498fae26def794ef0e36dc2e51801c44c862b6360d1c6f4e5d801e"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 414; - dataLen = 4096; - combinedKey = "d9bc5729526a7531eabfaa25c5e4e35ce9c5ac09f398383ced72fae2a8dfa4fc"; - iv = "26b2cf04a74d2496d4513ec01c63811b"; - cipherText = "b03639245cc96d8ba830f7c37e6257c6521ec6eb84784ca07fd8d092059793e301400e0e2a142e90cd10446b8d7a79244af3ab375efb4bf968e110f89a0ed764da0f828413fef94c44810d19f8a3993ee00b19b04ce1ae879411770d7aef677fd5e3364e1400ca53396230e9cb24210cc7751a70ab528655be138bd47e5837f2ac0085a9515d81d8072f1d72c1cc8b982bbb8faf6359a455167549a4c3237aa69fe255189a14053310b7ce24b2b8339adb335185b5d61b64b9aaa113baa6e79655cf3f7caf730c185458b312e187ecb74db8030488469168edebe51f7a4df5556ad9b70056948e823935919bb25aa18254c7512ac83a934ccfda2a5c17c7a59dece342ddcb67b55c84ae93e950252048cf42c8bc4183dd0a71fa1b076a1647dd9a35cfebc39e25eb94014abaf959e9c2d9c4e4cbda243a13f281f2102e88abca98388b53c3984f6bb4481241efbc2065edcca758ca6e797099dab3281213d3f13cad99e1b3c2063064035392fe57f559009f1736e18e66367ed0e98e2b80ef93a02ee7f2167e7303495d6062a8456fd6ecd99dbd7c1a269a45c376760f699cb024d00ffa2db346837bb0b7468147fff0e7d79bca45fde1d0db075c39698b9deb768f28c7443d823bca37225529b39bdd7cc3c7d0cfa6cea3d7b56af7f328415a971bc94b9c2dbe43dc48c0cffb2f098bba816921c30e69756c11a1304fbeddb5"; - plainText = "6fc8c39a448ab3cf8c0061a10f75fcdd5b9df4a0aeb1b8b94eac79f4078e7b8c96e7eb6d80ae959c7fb75ec503a503934b6708fc1849be19e73baeaad1fc32656f08eb11ee4f99fa0f2600da92f1abb6ef07d9d36aa263c3fd86a6ef4c1dc95b5579b333d3e0e9e8011258caded11d1d63998eb3f7cc57f05a6b65b378e4fbc948a2847dc973397bd6c2ed849f2cd6f5c0f46c736bb7759761c81e6d90fc305931108e93b59d7fd9aff245f84c0233aa7f874ba855ecd3d42cdb722755edbc3d633f24123399c229d24afad9b07dc9b6fd63aa5ff215c57e1b7c6dec2313140b3c707c8a04042a7046c426b1618a344616016603b35fa4754ba77c77d52b266041cd562763af52f7d8fb1e834f1e884d0d364e62ffbdb4408d7cce963a576b45768fc5959588886b5ad18bef1a2b672c5873ac9d192237f6eabe90a7f956dcb0226c21c304710282ff401fd22b2374c36ff59f56ab58ac2c99eb88e50fd19f76714a6c148ad76903d173ef79a052ff7ff0cd4ad28e9dea04265511a8d2be0c3cdbbbea8d51a4f3b07876d466958f5521926d84ca3b784f352f0ccbd76e768ef6979f8acbf8da9e21918d93a6fb0731951652e039df293af44212e9e2575964b40cb3665a32d25329bedf260be5baa2d1173d4d2e53c8b8b5a0debe8b0bfbe79a68eefb97abea9244041ebe42630ba137cf9b404ca6098c309e6ef1ac98d26375"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 415; - dataLen = 4096; - combinedKey = "d2d5efaadeacc2e36882e32fa2bba6d1775cccd3fc4363180687cf2bf2033260"; - iv = "a4886c339910fad02430c78fe5529ada"; - cipherText = "7be58c0a4f1e9ede3f2275e5a1845c041863f1a64291c0f21299ab181c65a62512df0064625b5420b335bc1401e40a939fc3e201b1ddfd8aa7ec047ef1b253419f3c0eb5ce11cd098242ca3866521b2affa8173ae01a3d3a700b06d6ce1e0826d5a427659366b698821b2688971c3adb875c6ffb3dc73ca33c3b683c3e3e4eecfdbf263b0b1af8e1b14c82950d2cd897701033f0c76d180b90bcecf9863ca3403639e80bf02e3fa5eafd5466d6ccd04f128565ddc176ea293b09b8c1488b02306f1f2274c37115ed68ad0c4194b0bf0d9eefe6b293260febb99db89138af471a40f787c515dfc07f9de793beb7bfd90e5a5daa664157a4986c0a202225b25c6265b582e9b3cdac96fa9352c912c029401559ba34b339510a2d18e8acad0e57e3a68fd4a051e5fbc719bd947f63b8b5058787c04fc5961a8264d7c89a5a198ece28080f7c96109aae0aa770a973df888bead3cce59763c9c48f00fc9e80fe30cf82507f312e5bbf8871c9545a7aca23d00342c177bf367f99b0c39da17db148abeffed8cf8a46b68c70fb72ce017d708f3753055ef2cd74a180fc75015dd5e56a54fbb831a807f4868c368881cc32669f01ba0be662d020439c172a0c9b2c7a52bc1cad5d91e1184bf499723dcd2ae7c8424e01077ea88b3f3a477e08ccaaca022553add269c7c26b541da53b69ef71828782ed855815b9f2e5b271a61832e935"; - plainText = "65a21ec4d2b7b208bdc9b23f5de5f0a7c730cb9353ad1c5dc1293948041ca873d442178472973b6a560120142c55d09936619142498fcd4020d2322d0d3b97a9f04d7ec63abee8dc7db2fcb62b855bd79eccc3195f94694d95f48182abe10a82a11b0516450e3b5e847bd7b60831ad90b65469203518dceab8538a827f4cb653688dbdc75cb3a401d258cf61d5f61562586790e9b02f8ca5ae3314c798f88e9ba1ea0c2a50d8fb2fd071967dd8d72d0973bc219728205c885a792b35eddd1e7d702e70dd0284b155d2a4b4ecbeb3a60fadc125b6a43824727f212cac2acac094295193d5cd1d90bf53ab9d27cc05307499a94ef67d1bd9a15ad6a9919188c012a85221c4c0f5a3520c008638aeb33e99ea0de3b1c8049d800c19c630b4d239a8ceb65690b168f03bf170ca1cea3d189d168be0e258cd3c19894bccc8aea92ffc417d6ea50ef96a845c9ac521ac0b8bcff3b63d816507460895a248886cae55dc7eca731353eaa278d8dbc3d134c950ed47b79cc5a3ee1659fa48d88c11e25c587be1dd23d17a46a72f9024f574a43091d7da33cf197a057e52691786767b2ff5a55c673ce237d40b92c37fd3cd9c4b93364da090513c7b4e2104411b68053faea6b689a0fb3bc8b8cbb550fcdb7648d5a53155bb19f961deff1343cb44bfe5aa206dcf76051aaa51269da0c5c85ac6b2fa20cadeaab87a8d00c31b374939d719"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 416; - dataLen = 4096; - combinedKey = "4327d814b6240caef02ffe6c03fec130a1d4896d005f145acded67df014f18ad"; - iv = "266c48bce0e96200e07ca5c7bb1b0ed3"; - cipherText = "aa65a592851eb42d0ff5cdd051178e25bf4ae1a4602a78b61303f71b5a36b3299908741b59e05c1184696eaa95c446762d8ba0ff8dcd12c0c5db59a7595a239a26f894ab099dd1567a40e9e9a19a3ec12d67a3f3b51efbd8a8fb5d9b67102d7b09d796c640854c0a84b6b2b1c96bb393c80e2a7f2b588bbd2992d150c1f05ddfaf883e30493bd57242388c0749f5dc6ce59e23220540ced71b2b0fedf2ac91fc262537185867a0cfabbafda5c09b5b4a20d94440d1fc06b0042f0adfd05e1143abe94846e99f081099b3bb4bff21255d4b618c112eee40b07592151cd1d464df82b571674569f8c3c94c58f5f68fa84c6d463d55e15184512fedc2d6fa3903c8b507b9afbd0d18ba56e23e0352aac558f9bb6de8cc8cb32ef815ff326a321401fe22fcdfdc75345ec78922eb92262d835702bed2f98a81f8e18e1342ddd4e032bd095d5f4be0d438ccaa939e10beac868b5bdf1da973acb23fbbe3e56dbb3991510a8ba52797f391a49bfd9b2a439cb6f360142f6817614299e19b7b8dc489a9b929e0683caf1b7c361ba76a59ab601c21de8f4409214da28490bfbc5c5064e73fb44f77ddb81a5363e8d64db043891c3325062202b00bde3f627ab380babb271ed13811f568d06b5107442e17c8d1da4bd0e41ad7c5fa6907e0baa542fd750fd6e76f415e4c6cf79522c30acf58b88a2c5bc68200182bc0a54d5d871a5f947e"; - plainText = "49da49bb0e016af530ba9dd825a6673b83881dfc7152faed04c58d1b762a3f32d302abf2305ec8a5d2fcc605c899acaaeb76b68019cfa6644eb5005f8c1117b11053e01eb7439ddc2c72c8ad4935f7512362d2aa471223849d236f9dc2d9b263669d45b8c9462bd2dbb14d05176ab1f8e1291486e9ceabad2c45860af0c4f6f3bd084577075c259ba68f02fa50eaafaa42f56603edfad972cfdb0e56367592f8105f5d23f29df80afcb27da8970986527e8eb2a105d588cdeee03ba6acf311a215985d143a3fe5ac99fc004980e9fe45880defd8e158e53f2e7b93f313c018fc08189d814bd76555bbbc7e0f187d5397dcc3a01625a75f625649fc425dfa8ad5a36d35285108457142fa13193f4dfb6d2b4dcb0c03d16b5d315c353bad53e8e98dbfd6764f34f0979f5f18baeaf7eaad7def67d25489ab5b5f70a10df4e7f18ed4fa191fadabed4dc4aa599116bef6e7d6adb33ee889cb38da066fa7fa1f14895bb8fe6fc1f86f3eec41dcdb73aa47e69fcafb565d82382685337b5ba8b8183350b7ee6f04e5cbf76b06f412d41eb64e365bce1697cc5f33b484742b73674395e0c3fb95cc2863df0fb02499b11d7424d806f4d0b606a41743c7a256ebee06bde1ec0d36f3dce2430a78dcbd99d4a963aaa61526ecd17eceb5ff954d289669f9e6114a6f33604ea564f5ff85945abdef396f7dcac3c43b48cddafc665e83ea47"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 417; - dataLen = 4096; - combinedKey = "5b032dbc5c5e2e133f602db79260c36a0e16bb91fd2f7fab31847a9503e92178"; - iv = "ce55613b646dab22db297ab41b50a1d6"; - cipherText = "c10e9ba040d7f8fdd981c00546929db615fe0497bff9fa35c6cd8d15723054e3ad84bbccf8acaef11242a56789ebee81f712914720a28dbb0ac377ff67b1f9c0cf14b1662ec22e5d23924a047e7b74c0c581afc27c7ce76d66f8d09034b6b6d36e11589e7358b4a61e344bd08c0244fc468d1f86ad3bc8f4976e0669d3b4f59361456fbe29f9b0b595f6d954d5b492545f9e37342df2909fadf6adc26095b3217ba6897bd45d25371c6a54de4230c9ac2a571d65fd929016429fb208177b3de78843d5ca1d6c5a36c4e815a4fbab2d9ea614070c1e9659abde36a04dc15cc73fc62e2d16ce0c534cca66139428b8f7b1a9122a2558894bd0e46fe6b2cd7255310bd98e808cb362acce49a40d5989fdf9cae0d8d1ec41b1c6f092b85b023684b477eb91e0b0b0ece76f6331b69c233179e8116f2feb6adc0b3bf6fe3dc23e68f9118adcf57fe5bd24e6607db0e316e36c623c2dd2235dff84a1c18b01cfcc399201aa28d634d7f19e498d7a645754915257cd1683c799b7e62c9d7423af52ef06dc20b8b44024404f0d5fad6c54e5a2f472df53b70087980bb029397aa7a0b65f739834c7b9d6bf7c8887cef0c3da6ca074fdb15b20ab8a5e37fcd1ac175eb962a6d5564bfe369e0b0a9964c4f585f5bf2e084694a105d698f20e66ef88c7fe2e13b6632bb92675ca437d733358b27a2e3622f4cfb595548dd5e202203b809125"; - plainText = "3d40f51353816a3b46abee4b49f0408b514d46d82f857b3fd7e7479be3c5cade6404b2a10d85b57f16fbf5f513b4e275c7705d10791b7d842d542217a554129d238113fe0f07f7ec6eddbc40cb3ed354fd5d81878520cd7906b75d807f72dabaf32290c89db7b4187635e73b1a4a292b59df0be124e007773bc0ee2fb82fdc4102b72bf6f39e2e257e211c90f41443486d44f4abb63c31144674bc8d31516f1a5a656d8dfdd24cdfa4bb532d43f88dc9aed48b57f42ac04184931daa766d298aba7ba73f2869c1e7efa2d9f3645487576b0a412cdeb78150c42221fb9ada8cbbc5ae9c70b30311d85c22722565c6ac188bd6315363b5ca895d35ecb56770ba45e528990c81788a692dec152c8acf9957e2f37212ee81fc526f9b1c6e8867a10e130f15c0ce473af3b5c2c339c8de78eb1fe097327f0efa189da0ec3ef2ea3bafa65ac67d3e95356d1504df07ccce66a4392564e9e36bd54ca9f3b079f175193935a45042c984449388fb8072d21df8ef1ef921824268b42fd9114007517159a764d2b22e77a188ec8d2a5a7342ba221e526866538fc085db43ffc75d1a548c51736edc99d2b74fdfcde308f4131759723f28be466d0751d366109663ff072598e49792a2ddc83d25ff02f949547f0b0c449cd6078e83fe9c5305e5f63d94f30f5915cc4a9879f1d0042805a61544b7ecbeb8ceb36436280a30c92816345bd765"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 418; - dataLen = 4096; - combinedKey = "8f5b1b45c585fb12554542a283a3f0ac4e2f2342e9f11cb2319f73e8ee26e98d"; - iv = "a70a44912f7ce11472e9d002fc8f2a29"; - cipherText = "bcfed6fc78936f64efea842f7341f07052819e55662ca2e326d57ff049a818e6867cf405f47d7b2c6d09989b0d4ec3ad8bfa91a92fbe1a7aafe78307b22eb8f09d6b6758a256b1279ff15e1e5dedb76f35bae4eee762708a08e2a1e43b53b16727fdde1c8985aba4e98d16e92fb123f9a758980a105e044cfb917013232a30ef4711bd70d9d8a43eaae21a8c94d8614707954631777a262e5dc9030c9985754a6d35ad3b7e0b9662323684fefa2a4180662388b4723350d2cc77b324b51be35bd7bc91e8e1830c9ab083607e04c97b18c0c725498c7778e787b70d39e4816525c56be7890afd262345780347a52390098a81b3a3959b04dfdcc9a6312c218e570e7da3e1ef9fad9942b2e6b3e7c56626f99249c1ae4f3dbbc5dff7fa17c090174b45acd685ebd18b9708cfa6e7edcaa914b7bda7cf7354040425e54ae1ea06be6c8243e2163c86ed4e85b7cb305f292746fe3f87b2dcde36d19d5eafc8805b8a5e8b267f5bbcf9de1a5d4d2f98c2a65799a19d02f406052f0fb4f4c817b1eb133c122537b6f6421e78fefd55bd2be25c60c26443f82283663c0df1fe017786d5cdf062074a7a1b62bb55439e08aa6b7914d8b5e800dc26740f7f8b5c9bd92e8e27bb0df7cc0087f02b408d1447e7bf22f6061ba4ed6517e8b36319180ade3b49a85131d971b23b0a881589115e38d474e31e1c44dc14130f3341f8e34a5846a5"; - plainText = "0570b9f05b6fd2af17f9460ba691131ffa732861d119a0cbd585b96a3d72a4f601c713b089cb5086ceb6a24f9e73081f2d56c474abd92ee7d58989e803c0291e2bff684615cecb796687152af3596ee79c7137dff4cc0b48bb802fd0c3f88fc7c8a2248caa87944fd5bac67f0867d9cd6e22cd0abcf217ac8c4fa2cac32d6dcc92c7bc8558662db14e0ff9c815d03266afca22134b60e28dcde75f57e22ddee2fd14eeb5bd39f3e72d520cb9021bad38e57616534a04dfb30e6e27b479dac9644daead599eb1862be51b39f2abb4282f1b0c7f1889f57c361d3954eb8f9844cb7f06d1da7f838104ec5547369974cd6c0495326056b759d04b002064f4f46ae6d1640dce55ec53eb36d345967f96139664b7e2bbc5bb9c70f315522a10add39689bc73484d7ab6103ac35a14c4e02e2356d322212ec7701692bbba9b584eb76779255021846db222bb865f7e73264f303fb608b9abb890692287c0c12b125f65d289a0cbd62fe58f9e5e2cf629efcb799cd019b0ac117ab166df3c15a619d1c611d6316da39628b498d0e3c557adcfdc0ddaa6ddc61234763b91357de2fc7025df5ec35b422f24718d9fab270f342c0e899bd4f571b57430ee81b80df6710bc58403d20a1a1bdab068775fc3a6912bc33ee5791fbae1fc27e8868fed137fec39a6bd18498f38fc17754e0e5f5e31faa5d47db6fe3e77bc74e771307f16fdbc6c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 419; - dataLen = 4096; - combinedKey = "c306dbbef6adfd55422f0802c422f4812beea44812c5bfa0f1c48f0011a0186d"; - iv = "fda4a34af765b0518dd12edfe689cc16"; - cipherText = "5e25b254a32f09c010a31b7d4cae41839efcd6d48b7194d74f88d19d654332b7fea76391ab33e5ddada8913b222fbdb1a14a267302f3edd1a52a8f00b6f3e35b150858f585f32c5af2e351ef529fd1355bbb7cffbe3d555911316949379237d89d3206edf2df5bd21c4ca5024b2e8e9807ca9cfeb1ccd7c4f3e64e8a494414b6d70106eb34283077aec0d95efa46cc6d99554b7e0b8fd640076e2f7ecb24c367420433becd1d2e96c05395a6208271968d6e7be6136b55507cc9407f48dd1bf9780b66c980cc6b2c28358345826243a0fb221860172e24620d8d99ff30334d769c11995e3c14233cfc79298d9ad3bed5d02d3f3fbb149b911d61111c0f92d61ba82fe355fa40fce7f86a20d05af648fa58da36b7e4c9a5b07bce5e2379ace291bedd7cd3a23e3bd162cc8ca6c0019cc5c8f198c873b1215e94ef3cfc818ba7a66ef833093fe2aa40cf106afaa50daccb39b968a5d03ed0385f4c6beb6a31e777dd6cac7ba13568aae1d01bf46dc6e78e4fc22a3dcc86aab61c023dff26f559b6238c83da27264991c69ce36eb37f9ef1b3671402dffad4c3e93a5740340046bfbdb40edf5a1ded95b69069cdd9c58c668abf35d80a3d9b820520f6748069776eebce7974f929b51941445e8f89733e00e9aa23cf48edbd4c43f2d4fa0c676a2877fade20e0c210b8617b2c2892caeb71f94912d5394cbcf16e61c4b42ad17cdf"; - plainText = "378e1fd9072ff61ab7e802e3cbdd47ae47db82dda05195a8b11f7075d31b82728fba3bd61ce74442efaabcb3580f24724fc8733cb3fd49a2eba92fd3767cecc830b154be3ccc0767a987310b7f3db28c71f6bbbf76500814c190241613b92ce55e76ef222c1f9784a988dbe9af0bb19059bc6c64797b97618410870d3134fec99a517af8b3465d0c0befecd54826cd2f8f4dc32fb3f14bb1925200e3fcb135cc11d7fe5424f0b3f4b5942cb7e795077b8134e4184c3773fa1e5836a66fb167835f120ae41c47f8c1d57db93e8544b3998cc9586d4f483d068916e66ed7c662933d5fcf4753b6a268e4bc6c88a87072a5f5c7f20bdc1859c8026b0d9f8ecc3419c3a1f8764c72a3e024e9e2950b9e7165cc36fb5b33a4209f13101ca4d382d8b28bb6c7916370f26a76b46438e3bc5c6e9680f52b731b36764c27dc9c9f444a4dfba241f30c62c90d979e9386aab658cb5125c25d8c812990a42fae5d76a88f4b039ba5da22c4c8abda71c2836a45584750a995ce5e9db15d652730a042d286d389f0fe519d4573f0690bdc16e7c7095448478c85b0a7c6cdb5c64bd9f794d4afa9934e5bcb6290b9ad9866dd717e7324185ffe029bffb6d5cbed63b9a8907375c86030604f28bf50e15aaf638cfe33f26432e64eb18a8920b7666354f1225464498374f6fc723b592f763eb760374d7125661ef466fef85657c53b40d2ff8dcf"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 420; - dataLen = 4096; - combinedKey = "11b30f48ee2a5eff915f34322e1c1ec8a1232dc67b1c00de27e61edefd0341f0"; - iv = "e045b9a1ed7c9fe3ff8ddfa1e470eb52"; - cipherText = "91f0a7978364838edba62607f3ecdccbec828eadfd84780cc19f2c488f242eb4ef8056ff27ba9954e85a8a09571a15594360f2b929f8c9ca7d306d9b9bb131cd7c4b2a771a58f5fb5155e8f5d114f39725caf124fa5dc82031d88db2a35edff6a609735a5d684a8a33b5751501f36b94b732a99c81b415120d47f5193666a3a9d75b27bd2dac7e1c0e93b6cabadd75ba0c0188ba277a3e40c444e6be6d440a7bfd35288a0153e0aa8cb147767cbf22161c8835434fa2b6f9bd57f835cd82ed1cbfaee0dd0839a8942f4d3268bb6f27b30c5ab03edafd4841c07c749b3ad424051cb3d95febe198670197eba72c25e91307d7d71e888dbb9b6b0c84bfc236eff4305fa0f4b834b6c866f238aea9867bf41b6e2007aba4e7c14cf0bad62f9d6f033907c6f602f1bddf6086edb62482f45f75da0980ed513bc09cb1965ec1ed85d0c20d0388c3faf92c55754da0055254eb51146027ced9ce9c145f5adae7e55ee2beaad3a5020ba66d84b621903a894b927b1a0cc532880c0fbae2d059d267bca78d00233ef81749394b5f65d8fe549d51099b093c10823f7df3b0eb4a371c815f8773bf2ba00900e42fb5590f2247d2a4ac205575815092544cc3ada2491681a3d3bf11bb7a1d46265b7a5540a970411d1f91e377fca024fc9303f9c4a919180a150a584baefd50d6c2e445530db4ce60337912fd286bca98ff70835b5d5f8a63"; - plainText = "a0d21803f5ff48c5fa3eeea736f3e85ad92ac93584d568a27c67e92712f0fb35881bf73843a6dfb2368682098145125c8d143a50ee773c390c4b77957c0b0a3ee453a4890356cdc4bdb0f4218712a41ecfb51f86cc251254f45d4d3b30a478fa61641587199af0cacb4d6943e67eb951b5d804e0db15a09ed1bad33ee636ec86e19d1bc51e27c979934721f3f227dcd610f34af790f40d86d684ab6064455dff22813b34b959f20bd4fc152f748dbe43f90f23ab63e63be1bf717d35ffa742770b300d6c6060baf865f0155508e0ba2e6fc597632937eb846d0ab5f828439f72bb23ba301d43190fc48726d29a6d7e0347324be92711ec29a667bc381dbae91e7c62db4b1d18cac0fb38c44cfb8a2e49d7d462fbb44f805148946fac904b93351f7cd46c3153f344230f7c9a6be15739270ec4afe0eaff5c98c18fd0c6e12aedce735a7593c731182c9840415c0c3135958b94b2768e0d8ac266b0b916e4b8e856ac1a45c442b2a1ba81d555f2760143f47db0eec3d860dcc2db6697fe459760d9827dda8766a74df1fe0875475c5f642bfee72d9653076a339a22438d2f6c042f8cbf6bcc51ca85b97b0665a593fdf3d1747f6a1c2a10bcab7b1f4e0297d096505a2dfdeefa3e26e7048d21ab62453e344309463b9fcf34a2e230208f60c332f7cc0fb7f378af97e1debe4ea371347e1e08e148e808480220a721c1bd118164"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 421; - dataLen = 4096; - combinedKey = "6a7b3f1bb2ce5860db6bdde95d020fa5997dcd3f38d98d76380f501d1e9ef655"; - iv = "a7866ebccb0881b9d4ae1cac492959d9"; - cipherText = "7fe58564ddb897b795f2efd07f473dacc1c29cf4be4436d8364fb3671293eb8c82260c5fe73905577ad3be0df9ff66f01548ee2614f52d5103835c3d31e900305fe7e21e354b8bc584b32b9a45136dba642fab730aae211c5d35f9d60ff8fa240eae632ec16e793ffd077f8f02b8ad7efd31eb753e8ee18308a310934d5a767ff3f92dd9262cdde431bcc8e7b60ca7a974ed3aa395c9cc8eb72c114d7de09d6aafc2a2b843e7d92e50287c10ef053b6bab1e4d1eff31636ce60ef450514d441e03ca4e5ec5348e3d66aeb532bc92f55bcae578c371cea672b2afb7d764c0e4fdb716352de41d6d4439126bf3e89ac020882ad7607c127fc9959acb614f38f025958e90ee060796de7ff7a1d04fb41da20275fe9662b5c5fc163aa232846309234a05adaea275f5351c3418274526c7ff6d0bed73e601446dd6056b5a09a51dd94b4a23252b58a180bff1bf1777ebe0c534679fd664eeb8bcb59d5078297663805c744bd85fc4ff8f318dec03c8731b7bc4363af38e8931ad6d9610e0dfdd3109af99ed95460638bb7d2127738dc5596a61a2fa3d0392b0d3d35a65df9d01c2529cf461a273ddace2ccc1dd891b80e02f6f13e60ce1d49672942589bcf0f3f8d7108e07ecb9ae456db59c41f9bdda82c46af2c2ea7a37bd67a6756f148b97c988ab8588c157e98f3b888f7f674737e1a67cd9e8a214f9ec56925a6717f69cbeab"; - plainText = "495f315ac1fae79db1193f200810f00c476e7db32d9b6555621734ae7a731542fcc6d454968d38abafaac77a10e4bcbcb26df84a38002dd8257a52f80148ca3389dd71664bff86f126d2513fee439697975a3c9382844507bebbac736f0e76aa102842875635ad0451fa304961f9b2d4bbc8d8bf1d5ffaaf5c6f436028abdcfd866d8350ca0ccce2a07e4e5873a247595543efb39ff22b1c9b9001dbec5c7adf882faf80fb077ede6de8207785ce2fabc574edce78450a2ffc92c2a9c98db234b301eece115ca9ed483e6f222b2c3c4d46070687b6faead2d7fef5e91738ebbe7741f8ba4bb6162b6d78a1fb054443f05df87989e111f9f8cf313b140c653a103b0249da80f10d6e5d32138a944a744746fe7eb77f0a65096afd7fb5924da17fa66a42aa4786a23d78a7dd715ec1652049890dfd0e575900c4b2d1028c57a5a2cc0e1d55985f08c4c6a3ee2628ffc4aa7a832c6e83bb03f90d8c8920801083f4d2dffe3474890b46d6badbc366c02bb6e9ddbe3513a2b466908edc38b9ba1aedccc6927851c922b4a8b390c92a384cb662dbee67af0de4241b61a45d7ad5b07c36339fd2760b010274b6eefa13fb9d2fa08f5620ba87cfbd04dfb8dee5f23583bb7948a0b951847fd4f789fa7371020579ff8c5ec71166b8aa40e125acb3f9ddf22493304b569017a2b4496aac66b24d943a5b73119ebf9c367d4772d60a03b4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 422; - dataLen = 4096; - combinedKey = "b4a306bcf3971b7e6e1c67d8a18978c053bd8893ec5ecf05ad45cbae4c9894cb"; - iv = "044b649fe8a1370b77d43e2d009d86e5"; - cipherText = "704bf3d2b01690926d4e6cf187f8c82481d1d98cad44c8db9b871ab36489fe90aff5f21602038a744fbd4c26f49d5289a9cac6e67638013d6b7c9cc329aff98cd5cd81950a5ef624b8f3d03be268b808ccf90246f8b85c160e0dbbb2ee8d75ad0516da869f6e28994837bf95d868aea379928a88a072280afc39ee181506cc58adb9af433e8af164a7722525b1c9057d4f2cb8b442da783346ae002089b55d5ca93d2f57d35ab6ab241ee2100d8e669ceb1b68cb81a50456066e86a404b9c50a256559970d80c59bc5098e2e0b8b97d51878e697494106e6eae59b702ed84a9409076a1c175ba143cd5cd4b91ec6fe0c355dba6aee30b86b1007f673920ad1364ff19d0dcc3bafe0158108b1bb5417b47f0a5363ec8a7866d6eefffeff430400b6cf819270beff2dd9f6b8274e567bbad0071f9b124e39fcd5dc55800983dd4b5854b05321190045d4ddb278b9f51825fd047d249c4f2a1a36e8d3e9457fbdc948e436f3484fe386668320d0894d7397b5131f584a87995ddb09c24dc69e69defc33012bd03a2f25b20f1a50aa6227d805bb8ba68a649ce95f0e8918ac89d03683bc5fd727715228d39dfbe236f9f1cb1c141ca924bf27b707b5d8e9a508f76164e935fa23cbbbc22ccf558891a2e83d985b212215c719478d6797a3adb7723a3657f4696188c118f7a4b3b8d832adfad31eec8246a3c62d2e2181b4a9ded128"; - plainText = "a9df688cb61b1a37ef079afec1e87efaeb125af34392371421ab5923f4a6b7dc57b4b1342acca01329f97f7d111ca8d050148dfcd96d6ebf49306c032670d961a48449e30b0a5a0ee151edbc82d4bbc88f7c096a15a1b2b7eb718f59fa361dee9c722ebb61899f343a1a140def0bd4df0746f611257faf1eb3efe0dfe83952f2b480d73ab0bc318d5692ce8006c98e6f2e5073486c558996361ebf9419562f0cc044084f5dd56983e60dc88952445ce7193d2f858da0b43f417d7cefd2976a40bea96b014c123f44f61bc05abf7793ae963b386abbd518ef3c4485b8868789772736a6b788573049277d828add2c65ce9995cbc729249a0a8ce45b13d8fc82035a487fb8e2ea418702eaed0d0eb9b3f9ef39b72adabd8f550413a66f49566582ce540e4e41c1b5807bd1165adfe39af3ee8c77407f8a7b20fa871e58275a2c059c9fb8c8bfca4a28861c67a3e700212dde8011f4ce9b797487095c259728d156ca104162ff60cea918f5d0bcc71b0b7628a586ac71535a7377b99ebcfd53c5e0bd545a0b64ab7d195e4218204a2dea66ad2a1bd01de8f8a5ae6d3a2e031fccde45d1d8e623606a4d0ac54ceaacc02fe140a451e9cc38c970e2f17469d2bb2e7eae49e64768187963402f6a7da0975178a6ead18ec6b6305dde617920a1f711977fa85c2ae9c92e25625d2f69ab0a0d73c148deb10b213775b27625dd6009cec0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 423; - dataLen = 4096; - combinedKey = "0ddf0bccc321ed39c961f7c65f5dbb29cc90f93c894812688b091cbafe0b9c73"; - iv = "c0fe2ad041919b192164a99afec3a7f2"; - cipherText = "c87e141e646ff3a6c2ac591074a80bc8fc30e48c9d898b8cfff530bc5c765e2f6b886bf153b3acab8badb739e93ee0ab4fc6be014cd7df0e8630e4eac8f4b4d73f0937fcb7e22657e5e333143a795ce42ddb0f8b6d198a2baa3a205f49d3d91c5efd9720029f19d582ee5a05aae757ff4a79724a9cc4379b4c54056784c3ea0034538f702b07e72c18265b77decea83b9db89bf809033cd429da38e40b6d982d2ada1fa26d0d7f1f2282e189ac12b32139f9a93756ea9349c406d11b1340e603f5dfa5f520e5b622fa47fe0f02572e700401c4dce7b1aee5e334b74c091d38ada0a0b0936a13c07bf8c330f24a6b6d41a45e97ad61e102e3ac3a7708b0aa3107e51a67a7433a8a15dd9bf1dff124f0eeed399c8ccf4afc2719321c8f3a458e1539018cc88885c319ac66d2e552f0425f7f6a0956e8885c7c380035d051577194c52bb91ba39f493ce4e53f52d2a2d2256ca52f787bb44806dfbb88a8f5ab2c629f962664dccb1063bc589cc11a7f427ee5ae3f2e90d9b7e5d6edcfde924682f244236da43469b7a6ce9dedaa4cf14b08501d9ef1c674cd36d74a1cab28c68dd8bbdc0aeca52f90fcaff2688c062eaceec2246d5c4c1a418a7a506c35aebdc4a04d5f1af7d0df4d3d1798692a1d2d075cd1b8c54fdca559fdb91596fa4943a36d4df3a4f009148d11cd85d576b1b4714d6eaea6876e9b5535c2688a7dd99fbb70"; - plainText = "304d1ecb4ded131084c5aa183012a3d1cd2251794adceab6488a1a7e625f49678cbf4cf15642f28af0bb8c1b969d492f7f7428634aaab09c06e02d7903dafc5c3751fa58cca329359bb32e97d4321eff56a9b5c015192290208a14b52e71fc4b7174e3c7d6d776dde05a311955ea67faac848d95cc10d9afe3c2b78851b8515297a0e76ae4ca5dbb5272ee2092cb95e399fda423f200b42c7f589cfcd8596ab9b81f3bf6a0c2da0dead99a606135a0c8cc89ea92fc1258f4503a55585668e293f039de927e16b18711b2b32dab59e1a64245eeaacc627d573824973d7293ccef3cb2c1162f6d3e6c04d03f591f6d5d3e06d0c3ca8c3bc08b68aa8eb37c8dcc90518556973803ad84cc726873dc90704e6d1fce7e905a6479a9e1da19f2256acfa4e4b146bf70938298e4d803082ad7db841c04608c1d3c64dc55050185b8604f776a5faec45961169a59790a584f9ac9d881176f15cffab0f03fb0050c157cc86f63fc8615aabf2f2a8b2ecbd739e90f2f57f45cb9fcf2daf60e9b82b86957a4cc6c798a32b9c84e7aa5fb6d24a4ce0d80b8100afd943b671fa5204430a9d00bad22fe3f9ede6a2da87b9e3d220ada118b91b19b5a4c0c1dc2aafe351c224b649bacf4600d106d7229ba040f4d77e9ab55fbd92b4a857ecb13ea4437e159227cd1a45f273c76f6a915dc558b5d32b63c3e02b92282ecb227f6ec95d2eca0bd0b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 424; - dataLen = 4096; - combinedKey = "6e2f2469424cce439a9b39e81bc14ac624aa9ec12624948af10dcd14515923e1"; - iv = "d0ee55189cc4ab75a625a36861cf668d"; - cipherText = "f751fbdeed2375886d478edb94f3ad5df55835255c029a62a50ca8bc3a5d58decb6812dbb0743bffb335f4e9bacd7b81173f4b00920af3ca025f3e996156cdbef5a0d36ffc7ed05ea1d2cd405b95f5807658146c8a1585ab39771ae120f90e5eef2dec6fa0f54ebdf8f341db40433a7ce02866923765902b87115fe405eda977373e6919a7238cb487a1f7da005c938c0883f4d79f0fc422225734536567a82757bc039f714135f720172b450901d7153f4f9817df419515d8aa52289b5250d7cfc574ffc3e2587f910313d5214d4a46e2540ec9f8495e85a9322f6a9dcfaa5783b1f7104242e3c21e8f437b1555b41c4e88d786045ffd30b0563596c591ebd16563fcd267f05f9d792f82d671c98663e05b25dd26deb1b6eac89e8f3b4e5b656bed2ca95bf2f82cec5110c02530f4d7691ce0be80263f554eed80f0ed2af76dfe516370a481bb5692bb65c97cf8ff1af6011741b7e69a8637674c5150e4e8bee41a7c6d379bd91e0fddc592aa18bce16d4a6e57d881e00f5ed9329b3c58c9106a9592ea27f5aa567d17de2a7f1825ec7d7704e815ad679263e9f4b48e3a8231679eec0156854d39c459474136f0d0538b9242ac0dede52151ad9a584916c5b068255888728b54bc7cc97b67c392a2df6014568ea034e02b7453b543a509a20419d25a70cf7b2dae8dcf63d6bdc1487875ff9b2b9c2732fea4bce29aa2320463"; - plainText = "7a8e3f6bc093c5e36849998fcd460f5da037eeae3e53a398b034d97a885db3bece55a6608d1fcd70e5a8d3f096693a84dc81c55f7df6f6b97bc2fcb164678e48789faa3addf49506d21c261c798031733261d0b0a532fc14384099e2a0cc2cd3522ef638aefc214125340a4d81a15fef001d2c8c483b7e91f9db33f2704b3fd32b98d6a10b322941bbe5773b37b39a2fdb83d415c2422c75418fee2d981f5aee3a345c8cb257fc1fac9be4341d344ea12ba323796ddbc8082f65df7780a48c58ff24e742117a94a50225789d1bc7a804664ee844d8d18f8e7cb2ed472ae1f64945db4ba2a8a3cf20760bacf84c2eebcc048abea2bbc79c99bbbcc6ec0f7e9f950c088af305372eb6b02cce21f615ada168d345447f203c45702195fb7fb087e16d12a9111aca101b59629271322a42e1cf8c2d948a521268871504821a872337e11ba74590e7b61e1d4b187b3c1f653f49c68f33bbf83fbef268b8c5ab391580567b1c52352d9c651cce3349075fd5adc685c1f11ff6382fc8e21e9780c2f899aefbd95a2550636f028fa61a3d9543604328ab87f0d4222221e72b862f37416a41f962566aea7387aa5206863dc1c0886f6850e12aadb9a52f367daec2c4dbd1dd319044e69d7eabd5c53ea23c515fae68a5718707eceaac263beebd6e13a38f3f843b8a097d47c3517806ae4a9c9b38ae4d9e3617ed2ac081fb4e0e79a2e38f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 425; - dataLen = 4096; - combinedKey = "8f6dcb599241b2ef8b879d2c4c561c2ada465898b368cf06d40c437cfd3abbf8"; - iv = "8f72e54735b4cc30840baacc96658059"; - cipherText = "ba5a0fe55543e10d07c314fc02d6710af90edb7963c3728995bf87b3bff6e27fde7013a6d174c0fa3988f51a017713053831c67b16905f462fb6cc719a2dd731c10558080bff42404b8cbd10f99dea2290e8826dc9cd77143197501d40d194d190244a45758b40c0aaa5584ee3e5dab9a641a74642bc8682d734bc90678bdeb8740d06248edc54820ccc315c3d3ad0ebaa5c84c64bd76bed6ce6e6422c81c8a1764fd5e28aa632a7641a521edb9fdccedff5baf1a1fdc819250c5497db47094e5a0c8821127800c05c12543184f80e208d5422a36ce30d45e37b569332c771792d57565ffa8eb7f6ff375305b49f1bb916c176f0733cf9882d2bc66850a6254d30c6dcc6c517e11811effa464e3acd3f1bed6c50c5b670e6371bc34fa7be74df35d0522b1d6447f25106950d07fd648672139e10ba9858297eb0109ba50c002c9581e8e62b1d82586548caa21c228ad3d56e7ac2181c4f8bffb2c973bd7a580d85ad21ba33e68b867abb438ff51fb0e01f20e60f9f66805e0d795fefb9c4bb411df7879b1b8033d9c1321a85db771e28e61d558c2e5b4c2d6ea8909c2002b94195474a076f0659dee804c4a2d33a2f4a43465c55ed6805f454ce4430707008da2a8733ae48796d8db654b72674ede674583691a37e65110d600235c4c25a409049bfaa4b81090f2c944a864e7462bcc0b0c9f67aa1b9be337600be7df604b5b4"; - plainText = "f2c13038c9e3727bf80c8a22cdf0909263b75d7df880e39073918400a26a504b838285d94db153701cf6c2d38a517681e57b78dbc31d3a0354f2ae5b892789f11d1691f91d797e293edc39eb33342f25a333a5d82f45e6147cacf71db07132e9dad75498eb58927f1f55d05ae7d599bf81dec3ce0fe9d18b4935c3167c477d78108688589565873207a16707998a0eff5d369fe3ada33d1f3947516d1d9b6fe49665113cb3d9bf20131f234b9974fb1ef2ccf183a4ea80610cc1cab833a2e895b61d48673960199e6b3831c1ef0d8887a3af9a37894eed55eb50baa931a04788fd15c945f83255ae4f2e6a22b93e3145e0fcf886eb4df4fa45e6188766ce5139357b5aea42a3ed1c41368028a190c39ad87b359e6a86a811bacbe6c23f40e578a8876de37accefe442740ae4c0dd2e4addefed07382f127afeeb0fcb37679fb6b81c72facaf91ad98447a268649f7e4e60b789e50182f89342c339716cc00ac2120821c4a49675b8bdb1a892ebaaa30a52b00c56ea5f39b9659af64541c0cba0a2482009d7dc29857b74eb345b75299123fce7e010d705c5427df4a112bef9fd71be2215f57040080fa6d76e7e23bf620c9790f68f21be07c48e766d9c10c4f8cbd2670eb7e03ea1f439c98fa43e132937d125b064a2054639aa982bdc22d955482204ca46ce2d5a7c555559002285e33038fa58e3f3a2affff69fe88b278ea0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 426; - dataLen = 4096; - combinedKey = "357de13a4ea48aade3c1c60648ada956afa3406ef394e3549d1b05492bb72292"; - iv = "a5221e879af00e75a7c1278a176dbb3a"; - cipherText = "5cc8d43927bf768d4b37848dc383ff3cb5a518c53dc31ce115dc4455cf730cc5abb495e56eadc0afc9c8f65bb41de2b5da4dd3b2d79293c5cf21f10eb4c3b35de25ea923403dccd1628ba844125b4f71962a4ddd9d8325291c3d1b1b741eb4a54bc61c0ccd3f5f4eddd80a43f9241d4154b002d0c7795f59e32122855d49239f0874aa93595ec176333e424f093d7ea1088b5623b686c67fbe0f45a0162b6bdcbcd2cc3875dea3e7ed7a87b662b72db676c44387f8be756e71ec07092ae6b5e092229d2d95915799e0c1495e96fe217d39e3bf6f387dc08e92c14c35c75b4af2b5d4804af7af34e1f7063e9a7f2d5fb6c4201cdb72f86a20efba0c06bea70f98afe467ebbf4d948a483ecd117b8076c0d3f7b93c051b5e9c2bafe4b5dd882d87d5d2f6438c1235606eaabf2acfbc73fa45c6ebe10f7f6df13cce6f6b8fd4aac9cb3e073d86b2fea6ebbbdff3de2923fd12fa2a4e752642409fa414cdff9688850f7593859a0dd2636f0be70d457494b5937aa13ba6a5c3a43bb613b0e200bc9972f198887253a9befd0ebf0bd01638b69c5a2b6a80b29b3ff97b230ffe64e38a8639ef1b304a675c3cb12f0643940bdf2055aa091f0e210975022803a2da19488a52fbe0cf25458f6b617faed03ac8c6831d9a70075702c46273b016e655b4057328a13170971fef8ce217435f33d94ef064487502bd8204a680cb48be8611a6"; - plainText = "27d06c7208051a4d3e97bf143c4547d79f84dd1252307225e7a3f3d56d7266dd0ec007fff2c896dfadaa82a01799bd9e7f6f21b7764383a2edf6296d480ea55c0b217c6d7865ebb3fa1312138d4fada7fd3578fa49b152c309c3677c97653edd415100c7101eb234f607d78238daa88cb7c22b91706e2404a5f0b8c08d7c6033999946ddf91dadad1b9b676cfe3dadd085a7ae329484a8346e97b6202bc40dc8519e2ee416603d0d87d083811d1003f4a86ba42989485e40df1f798a3f4774c6d0504486b5421706fd31ba150432e5a10b2c7b85de2a017b12d7029023bc164bf8ecf8467e83529a1ea0c5426e7c631b4fad9cd320ff48f71022593fe3b977fd50ccb02ea67063754278fd431683635f1cbf2e302f2ff0f90fa9207d47fda0d89128acfcbae1da78776e2473376b3186cf3039d2d4729b0c420b9a4ab12dc10eb452ce8dac7109ef369db02124aca3698cb8579f433b5999cd2cafc47cb6ce85855f6fd8075a1564086b0905e94220289b7d1fdaf1575c560998fe159786a1985d33946860478f0f2864757341ac0c2e856b80004b5e1aab7f62a18a289dc5ae603b419443064d55ea6d5e202e0a1521f025ade00bf75260662558ef27b656d4ee5d62dbcaa06f2110126531b541c14c407e0872745ba51ed3d6a186c014d0c7a6bf213e92743265fd583714821e1b2504cc9e540482c9a1457f22f339c1d640"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 427; - dataLen = 4096; - combinedKey = "9e35dc5acbaa19cc17ab38d945b4750e5419ac91ac1608f14999d060d3863e10"; - iv = "3f32583112e99162059645d4f9f4dcd4"; - cipherText = "bf1475cea642a7d23bf6a3ae299f23ce19eeb4d66a0c3b1283df8968d7128cccc8915e6dacb878daa5c2b5ab6125b1d73336a72b95d4d9702556ca2fbab978eb6119c6c73bc928a9a805cd0fc4adbe1239707ac0c649707f9f30e9cbcdcdce0ea457abdccb9cc64630b029d20f632259c235dbcfe3a58857e51af5c954b7ccf72abb517453741104d0f4632c3af20d4efc6396a40b1db84eb799626ccc1f26df7a743ef905a078900b481de7b6bb63027b9be03402c37f9ba010c735549943d90748273483e105c6eaf64512c286681d45ff1a47019b05dc44af9ad155e909b7384c698b82117d0ffa8a1f9f1f797cd756f99e2bbbf0abc413af5704ed4168e4c96d5a0084dab4a354a4ae7e0dcd10a5dc85388fb2ffb059620ae5ec4c1a84016eca2c393a9232c157e85136971a8c997f12a0ca88df06ee2a68c28fa3ea5c9f4548d373c9235ae23a667cd1702b0fa9e2a506a3667ccb0e93f978a6812095a25a397137697c02963955fc684d11f8792e57aac0826a297220c5a1204a7a2adbdc1719dc1ea84fc154e404bce9f524bd0c1922b45c9606705a3d0f5e90a4d4cb9f2be8ca649a6fbdf5084c4febed0e6ac3aaf0867b8f19280bb939c04569b187b5e2beadd8fef19868c9af327d090f461b1637bdd8ef3c71d17c15c74cb54bd833c578a6bd6117543bc134c665a60c8f09da6a0e8bf6ef47e8f9b7f57000a350"; - plainText = "e3e33e4f5307e634d17ed9a7b2b11e86e959db3c77b6ab2ce4d38e1afad77277ef54964623e7883ecefca8d7ad4d8b3c1f3484df80d97a74b96a69fa3cb3173cf615bc20409b98c79ccd1ba544336e4607c799766f2e89f4936bc3501fc15802d56088b4862b0611ccb09ba68edff4707bcbfd63d535bde16fdd6c781f9ada242c4143333f92cfdd6dd610f1a915bd9203aeae67875bf79052d62775b96898e6281a70c21cb15b2c3b07a3d7f0cc76940167e078ab69acbb45ddafd9e7240bef0bc0c95d725e626a9dfdf7b15da30ef8e1f41e0abf0daa0c27616ee1a64c34112a153af67de03ec1f7d8c9f7f981482d781ec9157c7115c981eae563aaf89c0346b7f2da24908103302ad2644c234cd1d2a23b4a5944524a56368a0bb30f948791d880c0bc071cecbd3136ecd31849e02dd805f4084ac89c87b8cc7523c992ed58d00106a946dacb30e86553a98f9b7369f666a5e39420d8718a04ae591fd0cbe45e1f651b9c27f23123baa05bf7a5d03e2658d45292e18b1e21af38bd3365cc7c8b9b3f07a223fa63cf2e9dcb249032de4c5e7e1c4af264e6e51dd8fcb71e7f156fe804fea5e4698f90d12f9b362b79aecc271cd10b614fca323cf4f49fb54e68b08a46e4f7c36c0dae198b14f6217b5513123097c16ff09400933570c8285360a014b941baf2a7ff779994488504e230baa1178a6869bfea2ce94f2f719b78"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 428; - dataLen = 4096; - combinedKey = "40530d9a24fce5a0196100c327851a659b20475f272039e6a19572927984fec0"; - iv = "e66dd22ecc8ba0899b9ea023b2c80321"; - cipherText = "efdea21c4b917f7fd3969479084ecc709152404488a05ee82267797a3a02324495f9c07cbafbee631291f2ab1fd04e708b1668f95d7d8445381829cddb96c51dcfaa903ff6ac52e00fe230eeb85403f5fa66df7b7a4a04f0145f3b4b02b83eb923ffd8afc66cfad1d7796a4c80197abb9f8328f036514b5888e74761ba01c3747da2f5b5096cc2ef2e929e450ffc1da3df3de6651fc920e9a33cfbf624d94e84787e0bfe34261df86956cbdef31c4b765600850f969b4a55336ca456cbcfa81f00fcce4c2c4da1ee20b2ae34e07c97c07d13744ca70ae5b2339a7e648535e06e806707cdcfc465c48acda1d716773072144bada10ab7e7ee4c09b768103e35be354a94742c6582874cd06a06c9af65da05afa4fc80fcb946174c6a2d480efd4e72a86e66e88c152e5ed549281548d263cfe392bc8751d34194522c1f2356b025b21ec0898e9efbe9e83e12e71f77462d543430337e0556c3c4e639723167d0dfb60c768974df6a281808607e37791c61a2de3c6d483c719a2d01d5fc20deb7f1d89135c3107510c5972cb5bedee4463ddc76ba007cc31473e2f816d9b22328a080d25f223b38942db4d2305cc3dc8c89f4a609186418262edbd8d1efd6f8b35a284594bb7ada8a2907fe01a5d759d493dba6661ebc046e8fdcb7c0850083d78b65e82a248a12e932e53f81513335698b7d9d61e6f729616668f290331821d12d"; - plainText = "01c6e9b5cbf33b24b5449fbaac9967c536ab54bcb3609929d75c10f4f2638c58494c4afcfbc20ee808ec8fedba4f6f0d39b7263a35a117bd56e94dca696d60d08d928c7ae0c07e0a08f19ce2bcd52bb7b224b694b1698b412977b1a6a5f1d261a2e452b06a6c3fb55af316e7d2947cc28c3f1b55b96464430a32acfdc06658bd2cce756409905da9c39a3b6955f28cf5b1d709f1f386585bc39e3ce2ced8183dbe884d449d6ed1d8a28149bf468471c5a2d765f691039d6f22afd13b9e8e9d431d216919b654b3f537a83c45f36493372b35bebfb859988f3a3d38e94768b0e16727b1d8dad9b8716604814f9ddb015659d9bef57cadb349f0504d8b9ac6c8ac43dda579ce26941c14872a8ffe280b68f19c194630bf7076981de21ba9aff908f3fbf4bb26a322ae36c851211db2723f4ddab029cd976dd86ab7da758da1aaf864a69f072137309b751499ee0e3c7f6c1c45a9c3a3f1d0003682f9ba84d38c1cc437688304bcc499f0278d004dbd554c22a04ef2e96954eb90dcc7a2c35dce9269cb2ce81a7025e5f898b00068ae28ca38c520b8fb4bcc6e19fccc55c1f585f9e473b29c616cda9d0a85e525ffb24eb8f66d06add1d87fb05210c75f36b7aef4c274a42d97f7c6b0f3179ebc3791c2892b7bc8e901bbaacb6a6c75fa5e4ffcf30806c416e467fb6230c6f80df549c92c724ea24c0373296da68f02aa2fbfda73"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 429; - dataLen = 4096; - combinedKey = "286a9dbe7ca5d22da6109bf91e63dd0b765a36c99d81a4cb12b6cdc2db201053"; - iv = "e42fe6bb1f20bfabee11af9277e44676"; - cipherText = "7bd2b2404227cce3bb5af50bf062156fd579cc5461008754c6ecdd7000572e6154e1b9539dc862dedf0e62cc688587d4b3d18165fa6d2fcd83a48dca6b651fb621b3b7d616aac8849dce7276d10d7cb9322af54c4313b1817948de876aa71aaed40900c5cdc92848054b735071fd2bcf144c5e60f3734070bf20aa53b1a6b42db1f05f667868d61402a593a9f2dc5379f2f725a273a38719d36781fdf430b2958777716a53c7c481b3f51bd0003e68775d64a701fe9c24cb921896e01894923706fbab3f39d6ad89a511662186212e6b7564a9180e07cfecc6589c54588067482b23378118d482d590613d7f11a4babc15dcb14ad288ed80d7eb74ca52e3e60b0351cbace27950dd612a49af2ba31067e34f87b556f49aa222604296fb1493cb4481b178c69310432c6524c820f30cf464679700f672b2c38de54a66fb74dc66b6c9dfa698b337dfc19efc16f89c436c6f30cf5ee3e351b1a0850242296276b01125d020c803e4e1e8cd7dfc7938502590f5f24401ca393f6760debeefcc25a1fe4eb4df830f3f524c92ead566acdbfaa59a19fa174256200592dbf5d3fd73c113810e91a0cb172ce82f61598289500c8cf80a458e660b2cea12cd3ce6026857ed533f823d0ff99cbfa56b2e6f2c531ce6d14284369cc3cb0b2d6ad0a27a10b3c641804b8c6026c6058766cd21c799920dec377b9e77d9af8ab57d17ddf07cb6"; - plainText = "aa6eb6afa11d3e1914a09814129254171d9b7455ae80f59cb47dcfe695194c60a7892d74bede4e5136d4925960e85ca1634eb25e2d81aabbcac386989c82b489649ec184815cc8efcbe6947aececcf371a1941cc436a5eb850090694d67149704ceb028f413be495cd2b3115e7cc805845d97bb3806fb2f1ad785b1e55e658b33dbd22fb8c46b495785eb846be8e11b342abf92ffe2a97b826fb113c148875e5e6d02ffd65fcde46716ad49cd31b59a09feae0e04b097b5f190523a57e3b237d4a3765da02da58b3d7f1165cd7e8ebe680eed4491459e8cf8d2315d54022c916a4eb61a87c782c29f26ab5fea2bf6dc1c11c8ebf3f3c208e376bcb63cbe70234d37f29f0df4705d3252b2f6381ee1b25405710fe3fc2ebb7d500f29dda61accb8713350711a9a8205112a3db8d5e77be631eb25ada5bf43496312beeedc7de12750ddb123b5fab0fceeb526ca85757b4d3e20022dedb5bfb48b7022bca722150bf317012eb0740f157845c92373faf3e2676b8011e4ab6e58f3bbf8a1ccc365e24f42b5ae1bf1cc8d51014acf876b6299a3620846f95c68eba1afc61885d39d5ff7e62def9016c42ba4bd0e9bed70d37bf9e77fc86858a3bca96a64338e935c6f2e9065cca321778480f2192931a607e038aba2f556352fe5a82200ff78635c3d47a337b1d2aa753d746409b84d028c751818f1771d369dd0e2723e4c41c5d86"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 430; - dataLen = 4096; - combinedKey = "01e5da3273360cd87696e41f4920d417c3386a6e38f2086e9ed335655bac5d3f"; - iv = "a71024e4a153d64f957cb978bba6df87"; - cipherText = "f9c98f0bd80f62d0711f83049293e752ca036145ad5f693e2dc8690e5d48c6f4a136c6d232cf4d15221a4c00aff6f82ffee817acdcf5d97cadca85a25344bd348e4d7c70df3a2724aaa0c02dfd87d4a40389bf69ad635ccd8d8c4b6830c0029f0269d7f374e1c80ea844ffbaf4c6d273dedcf1ddfbd40ca315b9b1cc50ba8edb72b6a174cb4644a756bd59c0385df3a3e5984f580101707487795d9f644b8c72a2e08d3a727383c407bac65d201ecb0f45ee46fe1f3d0660619feb8a4c2049fb948d4b79f09512123f980b9f47b1e0a3d2a0978717658acc08a7298e12bf5b3946d44f702eb2d75dd95e50cc664d9592183506c6e416161332ad9283804b482ad0302dcc5d5273aaa8fbe4fb17c6f85e2fd1b41c75489287008b8746888101a076d5a09f89d3235b68b846e4e897f5695d8a22e3caffe2a1c32b067c6ea63592ba38e7c8db726c9a461aa410ff20e6c5d2189cbc9de6961866d8abcec94a7a622ee49a62f7241203a7a8de7eb2b920a962dd61950ec54090fc3b03cc1eb4430d10800b02ec12ef5355d818e36b9ec57d7b599500bea09dc655c076689b55d5fd36e0360cf3cef44e60dad194738e2ea83e4d185a07d02a9f40d8a9374a93630201a57bc297c59b463909c778c02695f6d70f7203d7b60ff5417f0e4f106fde216b67e226c69c4d67e822c815b8c7f3db31c95b3a402d04098cd414bd1c851782"; - plainText = "d341544b0765b43bfda663f14bc23281598bc4c9de5e7ce8a6b6b875833b77ae6009a4b0d7fddc5ef9570d17d5b3b07950c4e80b4ed684442ac96837ccb39407162639028568ba8ef56102dbd2af0ceb5971d4b1c97c0b16020db8e92d69ddb306599cd2cbabf3656bf70e843fab5a0aeacf8d6c97d96e20b2806133efe85e0ce223ab9e5a1253091c592d450a7c86f45c94bcae01ded17ab11545d6570ffaa2277352bba08230ea22f00a0127adfc8b5e76b4913736940458d5e30d9e8f17ae9419a7c28dd4f1324d42cb741aaa96d0921d47c02e152c7f23800b82c1ef89c6847bab7ac68a776469569c421ff0cee6cc3177df21e396d914db3eb2db238ba2889951967b10a81de45fbf98415ae24e144486309ec1487ad45b938fad853fc80df4e87e8175645cebe5d111556f401d4e0689b1c0277420bad30afb3cc058ab5f3dcd0516595a0a9efbba9b32b2b6736ac78cd7be1db978064c4f6d5ad4285327ebaf16cd86119bef81f6083db077e240ba833143563ca9d5a942a3efe0c14d68cc7af1ca2697a3a91f54c301bb58a40265c696a3e2aebd96017c2a10b9b741045ecfed14c46fb07770d629ee16a9f0515c729cd42aba2f81377be2bbf71979097d20b1ea0a8aea862e3a5d2c2a00d400aed4edcd049ca01f75414e1c4033914e786448deeb520ce48537d9476a66c10c801656e2c57e6e61c0ee91644e9522"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 431; - dataLen = 4096; - combinedKey = "64a28a3244894bd307ca18d50fc735f30e55fd75f26204838e7fc158d0021285"; - iv = "5ba74fe1cbf0c81025f7a1e4a37eb869"; - cipherText = "dfc9a861226c7c58159cd64d14eccb1156b2bbdb2ffd595d386b963eecfb52ee4811f5f1f54767b19afaba55a76ad313b8df1a952c58bdb0b676910d17a5671923a6422a4676a11f747a97ef9d2843faff31d35c0469833277c8077535af957bf0e1d965d62cdad45d90c6001e6ef1465d4f45aa3bd3caa3d44d732d7b56b7bc9e9a3158c4960642bb5528f738ab3a53c2ed13bd9a08f8a653e5516cf7b8c1065d6fc281321a110482da128d2bda87f3378519e20bf1b69a19346595c7b40638b8c6d97e2fadc0d816563cf7f653e99f2e9fc6ed4da99d435342ab0bf1b4465458bc86988ac0305bd2daf22e38b92522eb45175720959741637cc30f2aeadc8284254a0d0ec29280d2c6c9e3610b171c6493ddfa4168bab220d95d0e59d572d49efaabed3bf4f56e49c527cbb0f53a89eca862e6b32f0806658e3fa1ec9861969009036188dba8de30681ff894aa30524fb14b2acd13f79fcfbd383f6f6be0803fd1efaef32d018be14ba75743232e2e8fbdf3ba4102fbb5a38bc8028a865b875160af0a05f9e38591a76c372d81cbc69592d171600fb1d5f6bff217481d915d5af3b33da26514fbae3b8f5a7d2ab60a0d7d005404e679500c35f285c96cfa8f998340c4ab32ae3a2b051dbe7fbd780cabe98cea4d882cbe6a437c470836670725a2a92ddedd5bbf67e67b94a844d2147d465573c32bac347d8218ea953b8bd1"; - plainText = "9b60bb3a0dee7bca3542d4f6b343aab3680742db9a24ad4d6d9f51456c6af332513ee24108b8f8096493b08a73c2928b89701bbd591b0f65c8621ca19e5a1955834b45d7a2be425e400c75f66d40674e418548ecea6819abb80a1d20c251d9003c06d99dc93b8fae84a85deac837e9ba291d03b792bfe94e6066cacca5a064bd680306c57968289ec293e5cfb4b8a61d04b5a82f2b3b5fa8cd32196961592d2d185cd07fd51215f0bd393928a59032cc8391770d8617b3973cae547d2f5cc17d2d6f7f45d49a9f758b132f09ee519d002c8fac0685bdc1bbb111f46b0ec6b182e34964a99a5e3096167395198bb213ec0b1ec0c4e94e3d9fdc7401bd43ba2d54002ba0a17b2a2c0cd39f830cf97fa43600f6d13cc9e2577ee868922601a77516a6f77dc48e4eb1ddbdf2f6b356bce79b8d2b9370399cb147218aa891f89e711b74b7a5753a346993fc58121f3854af12f4e350bc2992437fe87040a681b8cd4a90fd882795ce194a2e1b5ff37916504427260acc06d862548d203c3cdb2e987e4ae610a4a798091e9e5f05ad0aceafdfd1985b76e31c2322a4956af044056c72da0e91e1c5aeb9c7e69d8f795b69e22091705c3d89acf2b155e83b9332580bbbe59544c8f591ebaf243be3d33e3213189f625e79362f19ababebae7a66ec0d9b300f034078cc49b1f35e2bb23d4d1a53ae4ad9682e779ff17dda731e654b0287"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 432; - dataLen = 4096; - combinedKey = "de709a7c7bd74868e030a94917db92c37aed8754376a2920b815b6d4d028cdbe"; - iv = "a17463d9c2fe55f2e3f423ae62c4ca15"; - cipherText = "5a3738a088f02c9429e0f95d9324657fadfe6edee89f685fff357da5649bce3326f4837547b10c7e84c1ea7a89cea4868172008995514f8a7aefc01c733dae7aec1c3cddbcacd3daa3b19717f0077843e15572fc696d7cab9c1f134be9d5b326d8244742bfe52e6c6f01a7a5967c928b82bc79d7e626e5b9e3f5a874a9199ae8f5a95989fb223b3b9973d128a66dce3adcd8ee0912d2eec183b32f8466c61a117a4279ea40ae6f2607d5c9116d11aa7cf1d83e02fda8b280a240ed523efc4016c9452f7e017fed79c67239c677f8d80a988e46398f5bfcd99f35497521ed72b4e068572c39a77cfb076bdad1ef1946fd97bbc8988ac7104d0cb1982c40e6bf4eef784c41296cdf9130a40b1e50caab87abf6811fb3dbacb96862f5f5298576856c9a24be62d89ebfca0f972ea228566c5ecc4536d7eb46766d0d5bbcacf3c6cd6281c65cb817e5daf2ffbf9e3350a31b3241ce3118d22519db99e97ac2675f616030b849c15d021bb9a4b0a635705e6c9ea7e6663e25b9e6af8535a002a9017b6d25d54ac1b8badd0ef3774b969e06fc6445eded1561a8a282f24204d02d825fcce531fcb0d84656290f4f45401c2fcdb033b2bac76d57b848af6eea361c0334172d30bfa3d4ff863819a774d3a38bedc87d1627f75e0f826a52041e33e79dd2d254a9c8928eef92a7095522335a68a3688e71a8b46af0d3d61535641296dfd7"; - plainText = "0e3ce042cf75362ad5ca88ee282c51b2c269cdbae2f3165bef5f228db97cc82a248e51a7005d4b34569fd0bb39b3ad02ad98602794197d0a8860b59aee57bd5dc5cd8e888dd8e5a8e29aeebe8a7bed266aa5a1dc45ca57f714b2990a4634e5931b58c7083d3d1153d01f67eec6318011963f985726ab98b30989ddb0dadd5f7876bb1bec15e89535a4cc01086f551d24fffebdc12430870d3193b92fa1a6f05b059117b4da7d9e47bd8aee4264ecf9755cdbb5e89db1d11e812d3e12a494a7f96c9ca1e5a3570dfa8f7cb9fd38d6a9766aa6402a70ccaac721c403f7b29455725a982f485c91a0c7b29be9dfb3a8e7a4df1a449d84f7fe06454f9829b76b5d34c9ea24e67fd1f5e397c8b7e93846745c82a87ab1c99d9e2cee871df384f7a095ac6943617a90e7299ecff08d8feffb8dc9ad4b21be2dafe9c8bba10100d9577c089c88f5e64906c1f1c87cb0023b24fc044383ada5aabef51df07c027232137d938bd042800d0db7519ddaa102c0e89978a7f7286bee48228b50c3c1f254057153fd5d50acf95d85f2dd5546980f8c2fd8079c4605ae7af1f1d4d24297813460af1e30014ba470fdd94cdc32d0b4308835d85ac08e412e73ad684555688301e761050d7d0c978d75a57319947679767e251eae2792ed554b4e9af735e6d675a4f2492122c378585ff7a61d473115ba1f38ed30aecbc9bfbcb00a7659fe218486"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 433; - dataLen = 4096; - combinedKey = "089f5dbf1f329f37d2c9adf1c5b61710386d22db3baecd5907b4f159335a4627"; - iv = "da29420e5572483836b8c5220665c7b9"; - cipherText = "246329d91cd775474194172c9ad353e0165a8b159630f7b377c9db580272451c2dd2ff9b2dfda61c51fdec3163851087e062c66dcf830a26258c7772599aa4b8d15705d579c1ffdd4ba472463f834d5df0ea7b66440372f3f86bd3c682ee52cf482e1dd9a0c5ac348299b180aeeaaa1625543365dc1eb81037af46f60f58eb3ec2f052db42413740ea5c65cc043acd08c610448b491d73c5ecc9dca99e0d8ea128e7db9520746de38b7271f756e4d4e9ab3af33d76be016b86bf54ff7a6e97691141ffc202cccccbec5e4e0be6be61d52bbdd01f62383f7b7382de4a4c09346ba10ba324fbbb5ffdbb09ce18e8d24ecaa8a02faa1e67d0570e4f2745612495c8511a14746290de6c081f6feadf8c0b996adc6b6770001adc1cc79c719b2fec6346f98d11eecbe5fe854d7471151bbfaac4aa3f77a7caa11ea2379a35171d1e640e8d5489a6ce427ee8b44ea1fd83be19ae1b61347fe01c3e2a9c9da89fc19f151ba943808cbe21b8c4708d5e94caf0bea83f618f17dd8aaf246e9b0414d2d352a645a64110a0543fc4c7f36a4ca6a51c48ba42405449b16f123da8219b21d15dfd413e89afbab4046a14da8bee51c1754aa98c0d7a471a48ba6e16675c0f81b542773208c5bdb40a0695341f53b03c590ea7e5aaea05b3419b81f9b7040b55a409d571c012dee6c55774df18ea293df21e69dab451918e8c845af418e6579a0e"; - plainText = "f1453298b75ffc1c866b30404f45f0d95ff92be512428b759385d56353264c0b24135e80a088ac711e660040809a3649d73518bda98e4ecc0d3c47bce9e89c4462d84442aa2f9bb58acd66106757415601b6a7c3240eac329979b5767c8c44cf0543b3ed17fed8938a0d326c9098c89aa893dbb3c8cf1618d09c05d8608a768f5ac3ad273f0b57c3d15d308bcc7437a300fb860071aa441c102410480df9ed344f8296756836efaaad13eba530a6e7fbd284c8a231ffd26acf1ee24dc086178ef747d1bc11cecf74412553a0c82347da9e545d8ba5c94c1bcb5668c2e0726129e3e925fc7dda0ed0fcbba68ff54ece6d69a368f90c8204fa9c4a38b15162b4da68a668a0ff98be85df2023a2411ba17944473aae9958f48333c57f5dcf3e4fc9677bebf29671777903fcff978d31db22d78e7dfc42eb3247b67536bf8b3fea06ae779c8885534404f648091d826cb81f4292c202cd84b5ed930b0557eee566275026c78eda4696e7d1502c40c57839c6ecc1b237f87b1e7b8188abbde9481e13aa84390b6c5416efec34716285e0690a6d0fea2ac9a7db238c1008529e3f72b56dfad17543a83e527727ef205763c5a721e18a35d358e1e0f7d0ae0f8604b532cd55ca0f3a2f0625bc8e0c771f3bd4927d33c3db571662f6af2c46e0c0b504f4cbd840dad0b45a6fecb16e6b5ac0b880c9aac8a5aeb75a1e5f6cf5dff2c412d4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 434; - dataLen = 4096; - combinedKey = "a34f9a5622a7b2373bbc802759c382a6752118c7d401a7a0f2f85f8ff4f9d0e2"; - iv = "9bdb962b6c189fd7bd738ea67a7053a1"; - cipherText = "5acd34594e56674b2167e69049a4d939a598f6ad32d48c8a38d41c826b7761e660dde307af126ae9b293e7ae10b48a58a6199cd00c89fbdae4368a625cc589f8af724a930d1fdd421a4378143d56cb65d65ee1f9f84c7df50c2615e6baceb247db84aecbc68f9677de4ae4d1c791d2ae13958c2b6b236ee4717cd16e7d79ba97fadb97a0ad30918e82b9781924072892756d72996fe2278327f32372d42f7ae58a8d0f534aa8c267f2ff0847c926d934a70d090078d53cc6d6943c436b5a59a236fde91c1037c4d933c451d4cc8d441ee81c3585547ea23d4d1b9ed8b5ef708a7ce2ab41124b81e279e94a087651cd91ae2efcc6a41a22dbc650ddf48d40083154357e974d3538b8a336a8a331b05c16736baf1a14f8c0522501e44efef6c30aed3c05ecebd5d45599aa9a957e5d187515b96fa8375935687f671be6d3e98cbc908142422b0d3b853c7bf913544930f5da49aaef1af40efdd75cca50e1997a82a7f0be5e9c242e243a545483ff2504bbbe06781bff654605787ba5ef50710c7884980132513c804657d860c9f31318737c6e3547652667636bf97aec91e326af24b1a8c7cbcd76e9747401a4ff04b34514e12db562c84359bc38f82f899220c7b1a59e33d736b1e1bdd175624cdcb883aa51cb0b61ead7cedcff4adb852ebde36aef415a48ca1a6dfaf259e9ed83fd72975c4737708663b2a4811f477b81a922"; - plainText = "826d0d1982467f5f51cc706074e04de3ebeae6d217f55f8466a11cb64ea304e99c11cfe7f0d598f786b5da9d7f3b0ac8f7da23d769275ff9757a6e2750abfd0dc0fea8e75b28041fe221900996196c50db985018832a28f5561db8b34c92bce6bc57ee7a05344e332c7743b3d4d02245ccb19c3e868b823f0395ccc89af3170c9fe27bdf1f93c10cc8d0b48aaf328ab6cf3b27740049808bf6f58fe6ca390aab112607ff82eecf0ca991317e4ed3ac338077db5a106ddee25d05e5fa94ba06b62dc4ce77732c4a5ce1512caec90da98d253013b1e773d77adb756db68be62dd4776b8d8a1d421c920d933850d804ac746602e2e57c91f09212c65371f4a83e76425929c0254982d404a2fae04781e58f24b5212aae90dd8fa7c969d5fb4cb44590c63cad7a34d54c5bff4e2f602639ea178aa01d34cf5559153b8405f85345fca45eb21765c7620db3d930b604196dcd96afa9cd19dd7cc5496daeeb9a3f003b802d03b5cfa758582fb774bbc2fe3abdf56e244452b582da7c529bd613776dba99496f793419dff2bc66c5b599d5bb410b4ab30ec3991e045d7a1698657fe2383c20a076e3d93e39bc05bf000f9235cc8ec817868bb011c38e5fbf06242d42602da5a8b5f5033899b98fd0cf064edc93a304a483e391d69a908b0b6c9ffbde5a10332350fecf04877542ec45ecd3d0312e39598a4f456084a08a878258258ee6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 435; - dataLen = 4096; - combinedKey = "ca72228c81b3beff323090f599cf3f6e1fc5cef36d918cd77e10fd604cf3b6bf"; - iv = "a2d4b024e3f8aa4fd9584dba99b4fbaf"; - cipherText = "188797b617c1e500ca7223a24127f9d25c16e58d4c597bb6d01a28fb42ecfd750ebd6c22ef6a57a398e41b26fd2bd9acc5dda7b4298562bac8f1e1077aa1bb6a288451c03d48f9d30c3029abed20a4096d8774c1c765fa12406a0a313a3bba76d51dad69edc13f7eb2706519fdd6731bde5463743b2ba75d792dbf6b73752098f7f5fafff0edeea67cb080877131e9d55b6290e789c9d9121676b75bc335106de149b60302d69c17154cab82356d1f06a7c94f1d31359d86ff5b4e7b40ab5550517fc202f7298cd4ea1966bc93395a26752e06a9723694da36fe1d115cf39e1c51db4c35899137443077f03cc37792e665ac6104b1efe37bc90e38e27d7c3d872ed74a64293e4cc5be86a10cf9521b640df72d31231deff8016ed88a022f12953d29ef71869b6418bd0c62f5ff735e568b86a41eb9e3ebf6cca4921edf6bcc254fe2560177053cd4812a8274ca4a887b404c5a487a745f72eda873e8551fff5ef4214d1fc058fa930dd22ea8ecb7902ed698d173449ede73aa737c109479474ce87fdfad756a88644e58dc4b08bae9f08fc0ab17a970a40f40f5f82aeb3aacf9d4f32c152dc5b65a4016eb8dd2b50d0d9132f662b9d5f757bb7c1109b86034ff205b57d1c9986856a016715373ee1c4f740c0ec6c884a60a90179045c2a8016a2ab62ef85ebbcbabbc5b6f32096487969971250ac1a890915018eb684540c151"; - plainText = "44cfa0e64be9a37c03e51aa78870780fa663807c1eafdcbb3a8578667f0c8be456f1b2a106ccdea9de78cc27b51ea8a611853b31ae0aa306f36a9d5eaaf9c0fbd0e1f2373e2964d35d138099b46eb5e956b334b142d363bfc6072bc646d7e95637cc82f91098e7516d1fa430cb87bb9249b4bdc4005608fbb6aa2020bc301cf2757703b197610d3884b928a5e27b4676a9258598b62aeb053745833da04bbad54155f0bc1a353712fa6d4ddefca1128ce4d4079e6d63dd3f873f7ab33fcd558fd0674071c67b6908cd64b8d9c916284560a52f7afdb2973d8e8394d406994b0b701b6bb2ff10e92efd181beddebdba05e809502894211978cc91dfde7832da1a31e98aa09692a4eaf593f769dacbc5fd495c6e5ad5ce220890e3e5e679bd78c2621f386adcb6b48071020dae7a9996d1bdaf38007359bde90f87d516fab1fbc1d19e580d53e8e0b19612c81bdb180cc0acfde3bd095aebb866261bdf41bbc672011d53689c55ace96df7dfc09ca37e4398e290cb047164d6cf632f98480de917c4e6e0a2f5d9a7db3b4d229be6fd626365166f2a913ee1cf352c8cc9917326fd2ca04a051651e9e02c47c78d347b21dd06aaf3c148b32f620e406a1618eb74288123f6d4274703637e3c8b8952ec15ec7155b32ce7baa38b697fa434fff4bbc8c2b5b40dc129dd046cbe57eadc9790d42348bf36c50b3680a49b13d1dd624dbb"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 436; - dataLen = 4096; - combinedKey = "3fc1305917cccdc9c2b4b20153a20cc56c1d30419b1463d455f00515020a5ec3"; - iv = "00ef086c4cc41d94674c2d31041abdba"; - cipherText = "6f729edc39cc3c7a59f2384e8a288f2d574e97985591b3a7634f15857812211022eb2989af1185f70162a528503eaf8bc173c8faaf542ae5349b3217910ba8771704d9c08c6541d60176e8b811cec4772e7539618d3136fbad8e392fdd827ad9c83aeb37ca32ebcde4998dd877a46c5beb1a13e15558906c82a75df8106583254bb538e542d40060b031ae43bed4abc8c8975bfe95ee22a7ce4699aa93392f671ea67050223ae10221fe93daff5d4eb41c308725fe63b25c61511c5f8fd9122aee36113d213f66a120462bde06d2fc581b63e00e066e8fff1daac16bdefc2710ed26bb455192f8a1c383b3787fee879828cf3c9db84cda195ae20ff850cd67b04be3c1150cc4ff8460af83e230708233dc97a19faef5aadd73d876bfdb511e739273975a7f8d740fd38aee79a07d6d104d21f6b5e07743a5fd975de9a774974313fe54129946822194849c4e9e6d23ca927ff9df93bb47f493ddbe8c290645267849dfb0b3241c134756ed9b20228dd692e540af69bc2e3f814d76f34c1d7be8ebcbf90300aec870548f03cc5a4f311262521368092495b086e5efa3efa2ab7cf64f1890942abb34004e3953a6d8444cb748d7c213e7c8aabd4e7bc9a3b85ed4e7c38ce4e617e0bbed38f72c1e22ea9c48c519cbe60e7a0ecd83865f8b7ff8263ab811f58262d83e5082b25d9f4858bf0430de84597aed59e0190713c7824c51"; - plainText = "9bd87b4d206cc150a61d65ff517a573bb6cc50dd19ce4e83e1a94600c8e70a54569f3c3eda0cca48c7de9cd6901435668c993a2e8662d700f24d5055cab8883700927ec545a6f65330c0883d601ea06617a600a7626116fd5a00f863faa18b67af752fe45849865150ce8072d61ba456a854292079f3497ca89c6ca604a32c2fe4e743afb32656294c58ffb635102ae03bb217add0ea430953c82d98395b4dbaa3c6cd46b6ed2b6fb7390a203d9f5014588b522643d61ad6f0c73e5761995494cf5b5a924a40e0530c95ceb969f3cf555631a5bddcad7aba03b92c0422cc2c9c6f9447c0b821d9543aa4fe7333a7cf91e17dc336d9a2caf1441dc647e3eca053db87be3bae5f5e7b3bdee7fad0e9e8d2bcb3c180ad3d88ef587343b90be4b1697f89cf1a476b05d10ac5e4540f0e7997715ce503b029aada359736b36093e559c337d2fd64543c681b74d728b36181f855accf454d5b81f4e9a8baa2b4a50363b6fa377f3dc4d517eeae50c37869d4943232d6fbe28eca0f7a86485b343b95102784aa08cb1b360530a14dc42461e7897168c3893d5540c0b572f3bc98085b5772bc8e70b00d8f66c60e5f24cde8ee1824052b41f2ecfde0138b5955f1632d03d9d4f4b354351a372fc6ea3813811eb6a7a61daf741025d0023430480e7a120fbb8d6d9f96bcdd48345ddfa60ec18b3dac3a562961eb1a239e3d6363961fcb0c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 437; - dataLen = 4096; - combinedKey = "679b34004990af1d2d04c7aedbd60688efb8d16f9e7aece61deb62eb1b964bb6"; - iv = "709359f074b740124538ad8ee67300b8"; - cipherText = "a9d16cbc0078f6b171b7ad1ea56779667652b2107e562f61d5a505220538d2b30048aa7375784fe0a54b19d36eff11628f1f3b868feb3d328b0d43626f7f5091ab0b10097b1ed4d047a1ec7596246871d4da1566c2717471124c956cebcce64bd9818c29cf13db46a62befdd14ca3992a9b51b8fad0d84919999fe2a6f234716a0158cd09c69201537de2f6ef4c22a9b9f7337aedb5f3752209948fe8b06e7fbbfdc91b4a7e665f2de09a5b91429f17925cc6da86fc72a71e542a501bc4f2fb941bfe2f6b33ca7bdddfde62ce28187454c6daa29afe749148457164768452eccb797691f0211016acbdb00e3b40c6d778bd021fbf4512697b61c250ae02a4718933dbdf15f46702f50b4fd150033f8c174fa058cffb506dd3a034f347bfffa7ae1c5f6653fe90d8713e723f177d30ca6a671128c61bf203bdee0abe4a85f22e3d3681fd22e21a6a19d042622e9da465ad5234c07482323f2f72c66ebd72ca6c9eb58ffc9bb24d4b2b30bf32b70ce481c2341aa6baf3544d804c9307bbc8a2ee270f1007cd055863dabdd843cdb449a5000465a31952d63bab5b54be94b6115da0a7b3c3433a4c333f2a36b72d548cceb084c158148def1124634f66867a9c7772818ee857d097869a44e76ff59b8854277aaaa4032519b41cc2e69f424fb15cfb5200ad7ceb0e90fbbf7dd7a9f93ed5384b360e3fb6d1ac16bfc028aceac178e"; - plainText = "368454fdaab99685a549d1aeb72a79ae9985abac1c73131b5f34abe99337cfc42608bd238d101dbd1bb9ea399da6caf1d8213c6563c88d47afe98003b5d5ddd3d25422148591c2ee45a8e45c44610a166ba0c80f15c8266e214356bfa8c9e64f3d31de606874c2e6f70bfb83d674187acd2d2c8b135da93a1aece76b8e002d32298bbbe207235db3aba24942d5c409990c59c11d8b141e92d2cf81a605f72de4012bb9e1b6a50bd019a59026f373c6aa9809210af3d0708002a10f771d7847302126fef01f9d1a5e031a82aafefa9c7578d82fae96394482ace1f3d76ffadbab5c80468d21f8cc3d26398839becdf5679ed854b657349553521ed64d51d1502dd40f9b9a9c0fd916f50e8a4c29a7696aeb5d226a70853ea4370cab7c86b4eb7e7f65cb06302784b6467036b9a9cb35cc05234f899cbbbe33544d5f7890abc32e384653dc07d52394cef18da20b7b3b506d57bd17b9f0e20f0911374cb63498e5bd0fe84bad7365b114ae7e48df9cafcff246bf4101caca5539d4343fdd161d6bd0b40cd95e92faa2950deb7a4297afd44bf00c7406f6623ce85785123d8bd6de70013e5d973e3412d9935924ced3638763a09ab1db0b6e980cd2f48037683d98fbae01d97d8f01137b2ce021d832f0434abf87e8128bcbe35344a72bd0917b1c97f6fc38ced25ff947de190b5ce5a00d25facdf3d7c9898ee01c1508363d0610"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 438; - dataLen = 4096; - combinedKey = "3990aeb1f629ae013e1d1bda0d885f2b9485c8a42a38506f365156e44abc1d62"; - iv = "fa79fd4217cf658fb8e195271d1cc7bd"; - cipherText = "d3e7347640adec2407e6eabedbd5d64c88e3d437947b49df7f997b49d78ff24a591044e8b6ccf5c4c844abac295a1df466c3e03e02351d97a2313f1c0ff1c24cafb17b63d87e8d94d540b39b6924de08d85ca795126a3b6246ab033deb1566369d2aea11aa18ea241ccbcb9816dde1872bc554e196f5286edaa4b8918b6d42efbd48a44bf5bed5a76bbbea66802fb90ed0732ac692c11c2514c6af382994fd4898d4fba7691063ee8c161a20d3777f5960c0e19dd21469a9fdf9799dfd86106af6892860cfe933117effd679c10f94a5cdd296f479f8915c989098a8a594726a5a7ddf36e589a68b9ad4f3b60f6a4c060ffdb8c51f11d90cf00ecea7efc60955e4e3f909ba6baf5838f436d21be78c86d011a9417793eec4c06ec868dd860e6e46d6918676a2139241de1cc6ad5f1d89e24c20c5978e68231622ee15ec658152d6ac2f62f5c3fb8c1f74bd47d4a82865c55677c0ccdbca3867b6e971dbb8b9fa71104ce1673ccd69c029b4ec745a4bcb3193db4b2afc7390cac5b6ad82bedf75ad49b007972dde3964b4b7a108883b26301b6361aa646bab5a71e72fa6677d75563d1a41137863e4f7321f03e826161ce371f73477b955847ec7404ed3b986fb686d2d5454a48e243a1cb7bb57216758f3b747d2981ae4b83f7afcef35b9337dfe5bc44f8d2b93ac5754a64591febd4c72cc2bb68bfb3855b9af6d9e2f42d1bc"; - plainText = "e68b5c91e0ac1cece1b4d4e3ed058b1c5e08a86ac46acacc043ca84b168cc1d08ee97b3a8934206102e43bc331f6fc73eef6d24493c0ccbaca58292f4b7e802e87355d956b8b530ab5641e5a3298a2719e861f0d099e36ba129589e30a01ea2370513fb33aa343942c767d9301289099acdd30c70473dac4d08c5204f3a935212a0aed57cacbe71d8b53899aa9c94e19ae5f3e8aaa5e12aade4c111d85dd3df0ef43f7305d315c858de5b3a8e836f414da22d03b57c18b2d9fdc6c40ce3a4384d2dff7fa46dd876a8fd991c1c19678f5ecbe06cb7fab1d24f96e246b63eb4f042709919561556a8ce3141dce144eda5339f512df64d25e701e9c6d49cb16d12229685643fd2a4500830f0a615303a0981014b5074b8cf834bc9d707f1e68b712fda9326a26896aa5aca2d9cd05a9c378ab90f08c5986aa7d9cbfe9d89ce78a0a1c5d0b5a394c084405a60d648bf2c2ff1584f6360fda4cbf4570a8e94fb47232efd6e184bb4339b90768d6819e4cdf872bae378f693bd355b823eba1d782c7fbd010901a8435a3bef17308fe740487581a5d8a2c3d4184a09c06d1624c40733d0adee9cdf2e9d6e543ce67e22775511ffbd18a860c55254626668525e94cc9b2798608afaa5988f3d5481a803ff8280a4e4992aca25f6ac47986f73ff6b7c43ce1ccbc6d7e19308c6969f983106e8703f4541550a1a7b097935b9ac0a20f8752"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 439; - dataLen = 4096; - combinedKey = "97b7987daf0625931f20502c9138ec335c2da147c6bbeb4197765ad1dd3767f6"; - iv = "2248a1e0a4cdf2965d3b19228e1b6168"; - cipherText = "79d5a875039100aafb54648fc529e63600d6f5e68ff6766f096d3d7de9be05de31ced45099ff1f93cb24baa0c72812166e2d1b7aaaa955afdf5ba4727ad1caa568b43a8f03044b45c7900f75a76c9ed05793fe43379a045d3b944313aaa2e5eaa1559b720e02d88c82d98f46ffad81b493f174f1a1c52a14c806c9d7cda1110d51c2da2e2a60b1f90418450562d36b12d3fce5e4a7e45c9bee297fab48e45e4de753fd925138e413215586e3fb525b5858ffae2f9346c89a8d40bf22a4fa5dba63940f74b3c894b2ec03eb73d08886485c11b246b72f838ec50e2ce129ef1256c8df8c4f5cb078f4a339cdcf00a55f04e5135eb090691c30056590a1791e36fedcf7ae7ab28cbf133f6e3939ec4e897a4a86060f901bb62a83292ed32245e6cb7ddd5f352a46070d9561748c64d15b61e7e742324fd4a7db4a71ddedd2d9d7f148de24398c1e11298022c8d885b2c17a8d9361499e2200943037ffccdda66562d9a59a37d4891c61439c82d24f2d159c048ff6c5e27371e2cad12080c0af500cf3fc204d9b167fdbe6a0759da675e1b78a58c205d87300f51edb8cd69ae1bb2122871cf35f1bfacbe0b1f3b505a4fa32aa1efe661b714a581c98f087c47884d606d0cafd9d14396b59ebd5ba02a60cac0c542eea278e93718ea069fc3ea99094788b7855c2f1e0cb246326a3a6ed83d3099d6bd032e5eaf4f23e26892fa034cb"; - plainText = "704ccf6e9c631f78b994fc3e0f8f8e19978a5e9ed4098c57a86ddbe576d6f0f35ad03b66f01769f3b16f4ceef26dec2b8d2e64073dbf47d99c26f8c378990674439456f89275ba00c693f89faf1058026837e09ae3066fde6ac44a7aea862fafd59dd99a3d6aba0ac5e187098999bc043e2980f0eba844b87d50f58a3484523a74f8f8b9a122bd267491ace56d4fdda45e847db2ff49a321ac9925c41553b158d3828dcddd73864369c66f5b528b45e5dcbd07d81af406d164f6141af200b31a1dcc78046527b103cd82ea90f56fa961ce825a2b60092732be66a86944fb062b8f4548b98dc850aee4133f78536b695282288397b47848f771fdb101207ded6e7472f7ef1e587f5c01cb462ac9e68cd0721c8b71bc29d09b70717bd238b51a20d677c3221f9ab40fa3f6b17e7ba6fe1b65b5db875a4fa1e830fbc0848377916d4449c6252392e6d94e97b57a0f12bb2538a7d211fcdb511b799e4e36b0a052316b9815c76739086c1992723b466550029a3c1bedeb059f1a0f5e969012151bbf88bb7f5bbd0e4f572abc5f2d30fd4863d8c226859380be6256fd8d39b8f3c4c32178f7c7d1c2f7d25a099779ffcf16fd2ae1e140888819715c66c8c80b6c39adea6267477f1741014dbb3dfd5eedd97bbe95311e8fe2bbe857ae211f96d4d8a8d7824afd9c6501833e696faa03a41ca04402d358a1ee316a17e70d3f5aaef8af"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 440; - dataLen = 4096; - combinedKey = "580a22ff06e08d0c95dca8501a78b9b68fae87ef5daf0607eead223815669b9a"; - iv = "6b272b1daec6cdb18f6b99b529f85050"; - cipherText = "c62e6b75799bc6f8b4932a13aa92bebd7d81701bff2d8d986c993fade14c075165a5b8314b1ebdfbfd436dfd02c91bf835a91444bc2dbd1edec9c203185950194f30762c0dd8258a891e6e99e344ae78b6d1f2dd74e26d169b9a86f73c6d6fec49d2d0a33c9fa538d40469daf56db32e7ef5df477ad0a38ef228a3d52480619003b8997e937c34f060d9a74c7fcae5c689b1d21faf09f5e6bbe4106170fff3bd3515fb8425e089b4507611418b352fdf01ffd329fc335180f2ced9c59b8a60d5a430d37e26cbefdf4dfa64351d8babc2cc892f56a72b52c206312b37e5e377419982ddfa57beac2ff6f1b007b8bf766360f98e17c0488ac505c7a8070640b8697b74f3f1721e4f54270940d84772391ca022390e9b598895fd19d8fc5ce8448c73e006c9c9228ca6de2920e3152fa79383ecc461a7b79bc4815aa4af96a67e3bce20a80aff20154ade3c2babbc531eb3b7c5bcb4c084460a8da0d4737e6c87a23baf952289f96092e40837a64382254ba7d09b7ff9b4a500a2cc9340a9bf8bc43d5f586f6841029da18b9d07d6ed5812b8f6cc2f3337030a3dcf5cef54409e2674acef0e5528b370c06c7eaf3ef4b5853971f457cf8a5a373f537a633ea3d517ba33ff3f0c1e2c8ed3d0d5f7b572864adc33abcabda80531174e0f4635b210e4e54c94dd9fd329ed907b9addb957626e3b2b40e2026b5827cb1fa62b89a3e378"; - plainText = "8ec1ce799e7940c736a352f37584957e506b844a2e92fcea550141125bf66f025b469dc3ee1ecfb2b46081330fab6dc175485a52b08432b30b4884d302e0443267be72ea0fd688c58e3824fcbbdee063686b596b039755f7192b88a1dfea693b4740fe887a3c854a7b80a8ca4d23b2e908241c5fd7ec26c668582e44f37134f80964e32e37e3cacb03e5b42aa3a2d84ed70e81b37a1392c4ff273e7b84a4f74d78f53d20e88b4c3a914dd63fdd5ad0ead66461eb1faafced1aa4e2f9d5293327d2b4c146125ef4ac11016c74eac94cb53a8c19d610fc4e7a5af198dcdd241e59ba2743b52c0f5ca14f5f8094323751b3e5ca4d37603d1cbd608dd21704d3d3e68637e31e77973f9a0e74c81db155b1d1dcaf704bf24d2b664811bae8d1a13df1caa24cac2a7df188d27f43e3d43a47124f8c4f1ee7510db962a25f429a0f8b6178be5212ffc762455a43b07f90923e01f57ba8ab1f795e93acece484e209f9757198bd9e8df400fa0c9680bc126ea59953cfe42270cb5bb529c6e94c5fddfdbce8c9873e7b8304f7b3c1bdd6b18a0cbd6ecd695dd48fd8c99fa044cb8dbdd80b070b10fe9746a7ee401386ee5e1fdd2ac414e282faa1c3a5d8a49482b27455aa0e81688a38674d9425d6d31806969b3dbbb3377530a4aeafb918ec767bede0e7ef99b8ae00550344e828cc30cf71bff7bc432ef89bc3ae269f80ae850e058b30"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 441; - dataLen = 4096; - combinedKey = "91e88a75159cc0714441fe4f239b7ced63c3b57b742ec1aa2d48529cd02536f4"; - iv = "eb803dd4355d5c860647c91aaa7d86be"; - cipherText = "27d9a57728cb859a837754a116c7ee402a4a17b4ddba5e3ea6b34bf986c61e3f5c40301989e4a4c71920c2810233187fdbe08f18c844296d9a9f59e714470118c26b81b848163f893e009e783e2d8f12356a1fe8de7c8aff525bc7888d3f461c4a5328bbb6f650da4820fca8a431a9174648f81837b32c92d0a13c244d9c10f2389b9f76a115aa60862120779f42e8b7db093d462b76e065c97464ec70e92a88f80ba1fc89e47dd42aa699b1cc9e0f9763e688640065564372367f495c5b58634639cb6c3c636b767dd91503e4108a62efc6b235082bd4a6647d14eb9331da06b3eb4acdae68f8b22ff556aaf57acf0e195751a3096c4fa220c2af0cd81544b8addf3adaa9fb2f5e06772c0229c7815bbcee4011ff277a7cf51aa80faa8fea39cae30d0368f78fef4c0eca64c1bb47351979ae79dc5729d7879871947f0bac7f357159e4f8716b5bbdcac686ba4c5616d2d57a20729fa10d3628ebd1df3633809042bf687f6e3690baf41968f331b20d7f363ca886ee6222058498929c1fc9c46b433ba4e885c93063a8ca877b525e23a734c6634d067c43c55a5061add5c882c46126a2189cfbecc87d7c7f7d2d16460cdd32e5d6a48d0a5e8e7233b4a0fbdcd310181f19ce181f3df8cbfacb3127b3acea1d4eafedc4493bf2bc3f285e7a83cc7738473b0f2719282d61c883a968b824687f9d86402329b5439e5b7b72ab37"; - plainText = "899c609c9d545013dfa0dba037fc854620ceca5d887895f6535d9462aa98fab157c9d05fa2505a0e5ebcf72c85b910bfa799b5de4b51f9f02229f2436c5b82d6c665db1e1f962db699f982bed48a2a1c7d24964110c1e74a498600338be10366f8e10c87a5a2acfae1fafd3dec898363b106eccc7eee472f1d0cbf27cd195b48439d4a43cce23f08478fe22a0eaad25b8fa7a6a6907147e512e08b3ed95c16d0a1049853356c4776b9c6b341aed6cb8439b84b29cf8da7083232ee2df70049590e4c9b1450ca8e00976b4c5d3ce2dd7cf7ed9e601ecbc9780ae0e1923610d7fedd702f57091af91a4b8886186c95d04a34132b720bfc9a5e6caca671413a702684c0cfa0e4123dee3af4ae2852bf76c2483006101ff5b1aaa26e6e52e737fcec5f4bd241d8756f92f7f3069142422f4ed2af3f690b208d41454dd39dcf1a16eb198bd1b9cce87b33c2ea33163b356bb8d6ab1dbee7ad144b9c13619fa79b7ecf8249c4c486b47004371e5095247498bffc4e0a3b292c73c08fd376b7c00341a46ce0ea109fb676b4d812b3852e2b9da444f4d51892f2a152ed70d9c2f83429204a81f9ea82941ceb1ebcb70355f1356aba60a57cd0100fb5dd9e0c2d7c2de6241a35a9880d566ffa6aba0ade86695432a161ae137ad19a8367f45b8e520203c6d8ed08891c038044966825775ae0d2734cdc2bbc15b2d8a47f3612caf3ef4a05"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 442; - dataLen = 4096; - combinedKey = "4971a00062e78c12091234fbf45754b7661a207d8fceced0c2e4533fa2609258"; - iv = "a1ac49f5a2432e2efcd8434a52a60c1a"; - cipherText = "a1a62cc2f302bef70e9e0386f3a6cd8f7c67a065e77f36b3b4e5ab9d25e16c9797342270942e4be6cb5a1ca265872f786d645452eac04db9c2c1b8f63a9625beede887c805ff49c7a3f6787cc804b9649a9ed8fe0504ac6fdc3fa6e9f64ec09218064033a0f18ed4ae5531a29aa7faa353cfa5dce24b9bda816f030a527064031cee39571d6f992ae3bd195b3e21bd124342baf47107d673285051d30c81374419bcdfd5b4a28184b2a0ac96953d1bf39f323c166df43f5f3ed8c04c02d4d85fd0e9f249e017000d4fc218a7ebb59c3abc0c2460a9c86c7add3240d126375d243496957ba8e8cc10669dfcc3f7684dc3f5dd1493364f7fe62e0dbf7d61211bdf0dee01dd8aa29d5d0b5ffde34227fbbe7532d70f931f7e19bf1f0d5633e57684b506bbd378acb963f9211f6115d8f82ce79a1573713c120936addeb79406a845c06613462fa2d1a698dd6a3792b8d6dd1f694cb02b21fe67487bae00977cc09ca5acf0863ecdbd7f645ea29047620906f80985ac4ba4e3881184051f3fa51e0747ea0522ff1abc3b80b611b20ba4bade9f5937e13f5550cc394e22a867e34864efdad4ff401cd0f7df933531ac24cb3ea6b1d5274effe09549d4470f1937722c0882d47f8dde55a136f86345842e0e4c8ba4849ce2cd65d84c243ec0c76ab43496005349726eff98662bb1239bcaebde0ffa4501bb17f5c838ad6d5f708774be"; - plainText = "ab1be0b2f9390ed739ee8158ac6ae2d37c8e10c832c16a79340ba63cec1fc532fe765bd5aa10fafdcc49a97e028692d4be1c50403f738db695e3d16c07b7f0ee93c57b0366b104ba7e74e5a57e8657dd9adf1ebe559c279c7f84c0f578c0d91247b546b1e334a26a167021ba94fc064039e4320f717bc202f495f5956d76edec2f1eebd54930b448e7c70772e63fa30d143d16eef475931c3ddc080c1e149fed9ab7e06147547c887bba863b38eb01613259b651f4c2c0e47bbd21fe32ba24e4cc5558656dd3144c439ef05699e539003790d6209efdae7b5bec61482feecfee601d1444d5fa0f4fd3401b1ef3215159c310b91ee9e2aa18cbc2eb36bb5cb4223f902524558e71a513c3e48fba2564a1efb0f7aa689fd8608e85c6eeba9ba3a9acaf280df7de1671aafa01fcb6d7534e517edf29d85bdd42b3e9f570d57f12585ac131ed05d85e9bc27fa7010a7e24a011c467462645eb48653379509c89da085d30599e98094a3c0192c66015eb9ca35740423713d40678f4d66d5a99496875429a0794f4370d98ecbc46a4bdc6c44529820aafdd12b528245d12b83d751e4f40942d78504c98acf3ba6f4aa6e9d6080545460658eee4870c3163033645d3dcaf8b70ee7f719aa8737028584476ad8283c1df30c27bf6ac4d1a1d8652588c41d7aea290df55c85bbdcdd47220c9a8954523007ffa0d69a55a7e2724263b3107"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 443; - dataLen = 4096; - combinedKey = "b721ea2f04b0bab738358240b55a5b8afb690f76a139bf64aa75536ec1d2fdb5"; - iv = "bf94a5b5bb7eaac46e4e8d9c3f133d39"; - cipherText = "c6c1235fd279fdaf368c055e575cee4300ae9ccd092f28355061a521422514fdc8ee7ae33f6e6b8c60463cf9f9ec129f57dc936d428bc68fe41b314c63b2b29fbdeefda999d6f36142fd9d64f246e02f128f82d41a9e915f679aa6c2963afe5cb4b03c71292b9ed74e4d989d90e150344fc6223e1584e62c62b1bcc3160bdace14ed3db5a1a78da2706f3545797989627d00c47b6f06d3a55baf970e9b579adaaa8018a52cedcf78c99fde97004a321b2445def9e2b9b12dcacd04ab3e0d89ad162cab14c3237e1fa56da052f92f5530d73110bde0a3913914946e22596b9662062364c680aec284bb337d0ac33383bfb5005ba065943382560d612d5281bdc4ae4586d63124b26bf910e58216ec27aff530ecd717588145fc875a755ef673def82e1309bbff82ed2f4fa0d4aec13a4b94bfcfe7f97816034a465c5a27652858a6cc7db98e880b4efde23845006bcb39ca73e94e400e4f95805854409c908bf734e7728abadb6797aee452f2aaaeb3aaed7ef0a9e83ce18cee1e659446ddd87369a3f48cbb7ba64f6fbb6354a5755178f0a67ff2d259cd4c98e97b8a5354b3c6574c93394f0ca312c7149da60842960561183f6928e7ff1af1931b5ae9287e86dd5b8d2ce839b6c315a478ca9dda9749189a3b689f7e7a7ba929cd1030f3168f01c6b649f32ec6e11fb6a71357f94acd91bd192bf30b42390fcab417e8a73539"; - plainText = "5d8899a12210655c04d954bb7fe5fe1815c583449ec6dd6b6385c1b3faa03c33c806dedc1c32ed5f37aa26408802a7120a92d487834ab548f3e85babf3bc00ec5e0f5ddac2d081d12914a933f95cf01e67075a1650522eed0ca32af662e41cc4e1e073287dbdd14da6b1826ff25c9c79884a9212841f7837746c6f5a258fcad35581432b93ab93868f814485dace1861f26e51b5a4103e4049c3744d4cca3a79176f76cdc06df80a7b4b09dd937e9f9a59faa59df3ab9ca24b678634cb3a3af97038522e4a51fecb90e9a1e5a9b14231d5fa3038f4924a80088ef50d7c01dab225454f12e89bed44b30616f195e3c91e6954ff38876cc411343f68b5877f845852e2585dce2b4ae5639ab9ab838c0983892d200ae10c3fe1f1910f3aca64588ad05c7cfe693eff276f72714a8b1855bf124fe1fc89404371cb0e28e3748a0217e503cfdd8bfad6f2d01117c2bfa974d48d9030df333b0a0356052a72b2fe089da5b75f6286a6c39073855838b732c26fbfab78d9492b76cf2c90c10c6d5f577dc23623e164eecce2cf3a35c995abf09e054deb24fcdbdea7cf99dc403cb479549e8dd560a995d8cb6d0a3f2e2c0763142c2a5bd5ecb439b832d99f416ca3a97745c284b27a41518efd9df6bf1f69ec4055748da9d8a7cb614df2004964faa004d3063c39fac9cd9ae616083426c270147d37f1eab720e798d8f30bd137864429"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 444; - dataLen = 4096; - combinedKey = "2c373ce4c66a87a5239aecd61bf10f01ec46ee05bee761b620804d30631e65f2"; - iv = "2a39aece2ea15c12f34d7ab89012f62f"; - cipherText = "709cacd7b100169df7e6b01662107a815d94763eb7c5c3b76a50f2ddada963c30a940b06cdf8f0c608a72081c75d7e7f23bd61e475c2dbbda195f20f0302b018b9464da0e2967b97fd80e2c0a1316407f5447ea3bbaad6c8197d55274b58a68d22ea4ef827119d0fb95d534096397acc1db57846621bae47aa26106fb8265d2dd9607ad4315a105415fb9379bcc7498f9a5cb81b1e3f00d696955f2208150bbec24fd253e94e10f3c053e21632824fc59cbe3aa8195f7505ac71658e7ab4f5033096e031e576bf1c535086684f5cfb1ce88338ee3c58063d4a10c3e42e5e7894e4325a14030c7ad2b396ed5e89cfb6eaf7d77097ac626585917df12de0406e3119bbbc2066b2df961731b4662954d9e41ca701c18b49fc2e2e5bb52ca2d0f5b5b179182c8dd7577dc59deb6ed918be452ec7b1801cb5bd8db70b179998ef53a3ae8aaa63c82f219b3814a131a14735244dc73bffd67974e97de92c52282eeb0e58e5ce452a055cad67f1985466edac23f62be4982d809e267cf0e069f1a893006668f64c9c31811c41d14473daa4e52abb36c48706290b5996dcf20b88a915f5718d830074bdb2e477c20c807d2f6eefa95c2d3b39d9796d070a703f9be61e065ea9150b717ffbbe6859e73ef1f5775de0d97f6c93482196ca4bdcd761b51ec0de603c9c609188c2107a15eccb6ece991d3ee1c24f0bc7f763e3c5c73384856c"; - plainText = "c32d097501fecb95d2e365d48e21fa68e004cf9754c64f85b318a9a2b337694ad5ac6c5a361273f11a51bf8c1a96d1860942f480080a26b773d9189438d1d50ab72bca16427c717d37487bebd5a069ba9da1c2a19496ca2e5dcf11276b2da40080f78a2da646b0cb658a2ce36771ab5821bb3fa11416a97e675080d8f3e9b9491a99cf45f9e77d7bb126e5aed5d27afaae303bc9784b2673eb23ca138aceb89009607d7a8f54c8baee283f18fc615f58f1ae6acc24925e97ff5f0a514efce3b0ee1c7099ae4e6d8da07939bb11436e99fe2b940efc6bb71275639fbdf178e517a0b4cc47e96d95dee1e3c42dfaea7965fc9881fd1dd2c140e87e6530adcc24c583f9e61edfad58fb951bf9060d56426adc78276c217a5659b321eca783309837dc96afb0372e820ea924e180b5e152ea779db300658bdbd714f71b1ac841516eb0b0ed10ce87694e41413a6c2621c64962e216a6c5e7c246b8a531ea1720616b9ffc4eed703cc0e00aa76a8f7d646952f0cc9987ab4da6e194feeaca2b2b15dd7d7897de2f5260a2fd98697086b4d0beb413571d0ef66985adc33c049b7c558dc018d5cab470b5af29034033c31aae9561a8bb317dbe64425f89c91c1be9c300ace7a5d611c4b1eef29daad8314375275f531f1509948009bba3a2b46da1eb09d7ff9424b480f40069078c6c4b6832764e32f2e603d8818d3bdb3fdcc41d4140"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 445; - dataLen = 4096; - combinedKey = "0d65367e1fbae0ae2ee910f36065a8233faeb8480813c88c69b2da0198b744fc"; - iv = "d00f578ee41269ffccb561b53f2b718e"; - cipherText = "434924d0a85ed8ca3c56311cc0d654d79e460c929006bf7a5e737e837194d04725dcb5671597f1d0d6e155667f47fcca8de0c53fd49ee606113a3ba9eb1caf35c9db3373f45d6b67c45d658fad68104dccd81b8ca69e1a055ff6b52b0a2cc50f955a6ca58d693316e3708b2f0088dfff3e81944c3d3b9da54c5ec4f73b26892eaec407955ad91e12952491439a227c8679fed08d2c0f31d74ff9f380e3bbcaef28474198b167afb8c6e9387f77e0c1b05a54ffbdd4ea2fd61c90ffe588b3056e99f407fc3821b54e090731655fe48e5cb21cbc545ca47b1670da248070cabdb57c3a6d4e234d88a9d3ad73c98a9dcd586651db478d2072365a339de8cb2a82b24753d21351cf1319c73abef34937de85b3c27328dc0aca2b1567a74f9a70a6ba3f7d8354a0734e2ba25966e19c1305272fe948ae03f96ee8368a142c727d1eec0464129d67b6bd46d2733eb40c96199b42fa810313ca3855d3ccae9266342c8177010a8ba2638a36d9535efaf8d6209baa6afbf9546ff3d4f08f422dec8cdb932ef9c1da0715d29c5ed7529014f15ccc0941b45f3bc7128b7f692fb19511783c3b38aa7b63ae5db92812b51a465b7ef3cfa0669b7dcc56e6d20de64d47e00b9240c7d9a37342e986de71c3ec41bdb658f4e3100d6a011de032f6d6f54bde46fa369591ef0001dfcf7982649acf3c16df73b8ff2bf84a23555a31e0608355bb70"; - plainText = "2c00216f2027b7f30d29cb6964fb25633d63b0e9222f6bb1c123f5db0bfa183d91c5d58b60ca0b4ef4639b4f87eb2ac58056dc8d4325b140c92bbfe75d144e33d0b51c91d5b0eca89fb4e06a7dd31a03b4c4bb16f1fb30b37b42e0f358aa8f5299bcfcf04df29fc7b42c54caeae0230e0b94ab80e1265782ed837aa41694e371487ca3dfc1f3df5481c7e1300fe5f450c63bbfa2019300182b2b855bbfe0f500c99975bef71056db0fcb3774d96eec423791e7ae19f1c7df6f07f27312af2f6b765e4451e2a909eee679f146a37f37eef171831d9ee3293a15b5d27cd7d29dd4dfe86f7a1760e611c3baeed2fa36701ff786fd192db74eb4a8bd88d3e837f33bac6a3d7cf2286a2a0c00054801dcce7fe3ea87665f4d8740687221d5158d95da2cbadf66d4a0d446ecf3e32771f5bf308b34baf668622365dad53e0d4d60afcfe218c9d508c34fa37ea45ece08eab23fb99dafc0cabda250c5b9d6000cb5028b3d06c94a8ff6317b47ec021112470e1c579260ca86cb90a1ba43cbf69c1ec76405bef414d5f540efcc37a4f0ae218215625f0b3f6fbb0d42a7b3f955d364536e02f1ad1b6ad0f3117fcd578a52a2dca9ce89c03fface5d8abbebff80b7053976e0b27cbd0e3d80cd6b287a2caaaadf5e31f24dcfaf6338d430d11819e8c403167222b62c7c95c2d795837c660da2c0b78a21991917b3deb2a17930201e0250ce"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 446; - dataLen = 4096; - combinedKey = "57efac7885a19c2d837d67f5dbd468ee04e6ec9aa86818088d28149259bbe957"; - iv = "16aec32c9703f4e08ce017f65ba8222e"; - cipherText = "24a3b68af81d2b93400d33598a1be352c359adf06612752878d6118b5fe56bef46babc511c4d408894178fd8af945e40898270e0ed77f500d0cb584c3b5f87f3cd8d83462a11bc230ef2d54106af6eefacb7e4532f176320372440f97d7e25259db15f9b078a7e14e99f5374020ae35e0705d80276bb656bb7ed48226a73066546bc10cef97fbdb783e2e1b648fefc1a58c95a010630ea7c86d638d056ab5ff3b0a31eebf5221a808fc5738e52bf85adf3f50e9be62c38700f72f637a30a7dd816040e75398a81152274efc4c670bdbf8a52c35a8eb37dc3cc486385048144474524f0fe7088839227e1e45e3a44545564eee043772925aa5398db27b628be899267155442dbc71c441ce2980d0c67c794070c256d2ea257a11120f281af23517d7138df3a4ae9765bbe83c3965fd8244989a8019b532bb7bd3e71541b1010e5c9511d886ab0c803d1e5c690a1059d3435ce9451e075ff6c3328fb8ff7a16bc3b2a70afb484737e46f185c62871e3ec6c0682be08cfe31bf62cc341b72debf62be146adccd5acfbe770495b77002bb849b84de0287bf2aeb3e70738eb078e49db02f03364c9011053e8a2171a420f9c2e3438eb2f4c799aa5524391f7315f38c2caee1d9aa5ed68ab8be263493eb54135ba20f9f25d90fc90441018306d4299af503d222c99e1ad7297c4d355ba2130dc0b77f0d3843ecde20905aeaa6d728d3"; - plainText = "a605339d3e17c3ee1e26fb56d280ab01bb1e7b8eb422843ffa765b80412b410ebffed21561b5838e7b4cce54ec5d8571b0c15341de966fd5085d392119212d966250a243a1c965388435da5f93921792aa7b1f3bfc3695c8c36b0a150bcd95a11678ebeaa33bf802de6ba698b1d7c019a59d5d0ebbd9ea0e0c997eaa067f61870802da5bd3fa4df5dc1258f3441c742e1e05e1c76f573e21219791a802e36c914ee73996078afc1bc32618431e28479557435b5ca971a407caefbccbfbe7eaf3d4344f3b94585dfba5222727f9993391aec0429861b0a947aa8e989ff81dbcefdf3e720c2c0375ee9c8b3eaeebe5cb166865f46bf4fe89a8be0068d6eb3b011493de03cf8fd2feb4b4dd8ca8262e86adcb86021230d929be40932c954d8f6f1090ae377adebec9b5fc2814d402e42ec0b3059b18ddcda24ea5ea22de898474d24ba372a5bbb9abd4d739db330c68f39936c8589610991dfecf3a58b309ff1617102d7c3cadb88ed97f845ef8731eb0e7cb976629dfe208d7f32826e90aefa2746d04b504515c38448c81b034218746fadcb024447f4f78d9670163e6ec98ced7800e8ea6e1db132f983c49d98768dd57cc1161c0c2a181380a407e4a705e846e790a1579f2ed6f02c21d6ccd1c1e0f9191857ec9889f1129df86739c03d17183f8f42a1debcc32b1e02f7da322e2747b7a8363d3589c9e6a293f94544c7d9f1d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 447; - dataLen = 4096; - combinedKey = "583da0aa0c6f4c6ee249a383dd738a6fac0a510374a5d152f5a1ab5c0dafc34e"; - iv = "f30fec13deade0413306a1a01d39535f"; - cipherText = "818d4aa39804fbc9550f18e3f2e77021cd1a866e49d0651823bf92432da45546be9b0575b72d8fc56c53ee6ae41f16cebc0d0f5d16d3c62158987c7d0ab28bc77d24966ac2f0e830d1adfacd6c9d3c0812d6078a735cf8e132d62d68553e12f9ef2d627a99bd87a0df3488493bc062daad0ca574fe00557c6c9812e02cef2ce43fdbca7d681f6777140e07eb5c9a729056550b0973470b27f7edadb2d05bd537f54186070ec1a94121e4db904bd258c6e967b75d266347cf7571aead0e2a0019ba5da8c116e7891e814ac7d247278dc9f975fbc36c21b10752e5828ee8164e06271d10bbe8e3349fbbc2a11caaf0526a0eae047cc6d62f6903db6182c0455aaa7f9e02c3933ddef708345d40d93637c816811442d2ab02a1fe01e417674d05826d6d10dc017fb58791f7b09f1fd94e046f3077b08abb6bb8e33978e962a84ed1ec1c850ce3e1f04c40ca589b9fc463e90209d302168be096bb7ba0c7723312f2db8051e9d5605c2eb8c2232b521e1aaa3a8a160240858420afe6638139dad78226df140f77f676085dfde05d07846d83b19cf575832a8cb4821fa34aed5ebd7c46c0df7ff49ae8de4edd7bfd304874609c2d3ac09cc68486ad5751fffc2433becf9f71134e041c56058fd35972169612cb2d6ab1bc4654e31fcc4f84ab0c7f647e9d0bfc03758c4156be4bcabe751b9ab982470fd00ae11867305bfb5827cde4"; - plainText = "97c0ed020f9c2480974c018c871b9078a3db0f2e90089e9b5eda3a55937938d25a20ede70bf18825091de0b4bc5d6033f346bf57e40929d46cc045457914ca74cb2d932954d4b1eeee72166dd80cee0c5349dc283cfeb6c39c1ac6ba773db214fe53e5769748e90aad163d8f68cbb0eed750db88c5ef1f806629321f8316fdc4a51a354ad4f10c4dbae1bd6084c3fa1b3702a7fac681565d835383c5a7341d90a609deceb1c38a1ede8b9b2bd5d3a18762423197a5eb5e77584244a1019698a46aa4c511c23036cbe5933fb485c1fde9aa8f9ec35f6dc87ff45e9d5ae9ce98fc09874b05ec2ec36a19e469fe9b6dd3618c939f3d4a62ae475d451a1ed57a427c7806307361c1d6e1eab43fb24306e2a4ff838409ba8c776907eb741d9d240dd7aa67d8670f568c44adf885b6d47d2ec7638440187c1e5a1ccfc8df377c6c86d33ee9fbb68edef6979b1530ae08e32b9de1eb8a659e001227c4ddaa294fb6c980430a7e14dd357a40fa2cd269f20c1855f7b57034b9f161d5bc386f8f98c0287d276365fac74f3697cda30db6bb519491b4d810a2edca1ed0959fc449f7d9c8d5c64090c5831ff665a2a778dd8bf07ace7d38b68699d70217e813b589c5db4f877f6dc7c4ad74aeeb8a57529a060a641b4f996fd6e2fe07beaac88f98df576709842f021ce50cae0ae08bbb9c01955b945437bb033b861f4ccd02edf5926d787b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 448; - dataLen = 4096; - combinedKey = "ee1f9fa8631b0c57098ffba378739cede014dd8cee9ba782c9a9cda96503e108"; - iv = "c80fa14994e93a0e5e10132c35c5dad1"; - cipherText = "1c9a70ff3e22b811b767962478f00e60b25d69e97eda443185d05b213c6283768666ef7255322c025fcf0fff3f4eff8c6efa29e6b7e7ddd15f77fe7bad0c8018e3416bb970f8fbfc8d71657d5ce372727f4795d7b88a734b44fbef15866f43c3f0635749e618ee37f9dc9438f6e4a3961c7bb5d9a54458e450ed1067e4a3e5fa0d24b7c2939acdc5db85b3c68b73157c859afd9be4aafc3d575243b4ca2b1bbef3b82dc3481f4f87de7fe1a1be279500b41d7791352bc3296053b3c5a9343eb960689424682236610632b5bedfd50a62c10814ad3e2adbc702d2d63e2fe9db8ab440f6db73a25837a72c03760fc2a4d7181655730a75bf9d26562338f1595bb4a7f6de4dd67e4e279cf300bb8ffe5379ac1b53fc412803c1cae443429cb00ad5c4bbdf4012f02a264da51f58b20bcc54230e5c7754871c061eb24ee3faa3041a3bf3d7fc0464fa2ef920def016274eb6db333a8165f9114d21fa0caf6e79e037ead777e978b45daaaaa4fec06c325e6aae82e8c4df231b5c056b2c114a7db1b690b6da7887d1a5a05a17d5a35ff95926ab1f1813aa6eae8ee39ff9b92a77dc886d4d7f282d17a70cde310651e02a3ab29503d459724cc9a92af19aef5853aa8dac94d928c76b4a488c7eb46a51897493235d9c705f33b91492f0d98584e3fb3fc74884d94df601e34e1ee3b255d8112cad1d0a04a1366eacded24a3677f68b18"; - plainText = "ab1189031f41bc7f8fe8a5907f5d74f32ea68890323387920bee3403abddf5c92be6612855a94dbedfa84665dedbd1e4d87904a3441a722b09e73b74b1b14d6ec6a9ad2b082899f3fd438e9c3e62e612d8f12bfd64d2fda4d6a3e0bf1eaaa65658b083bb4dff04c51af978b95f877502e1158e9084bce59a875812cf104d9d9be383bbe5613e9bacf7049d31ed9df0e18d9d4aa3cfabc5f2e27d06d9968ce619c785bcd703363fe59e3f1c8ca291bce9439f23f05baeb1751b8e5c2cec26d21caf10579676b90c8f6a8e73d334cd945c2a0d81542bfef44dd22e4d94e0a3ad1d2c7ae94913030aa5de5fb5cb71862190a96c3e83e421b27a0e650500c548c5d48c3ebccee4f75270d24517ef0d2f41f8ee694fbd8bc9754cb236d46a867da4ca06967d915bda898905f7db9ba514e64e66fd31fe8b7da324055485d110209fa1770b692f8c5dceb531037434b293b64359082dcd316b6fd3a6c75b6b26205aa3dc355f0dea916fc485724f9fff90ba70d3767c21d0fdf63f705082f5fbdefe616d20f20061d546fe2f6577ada9264c5842ac16a6a609c3d197da90e6e779e93b0c717395d7c4e6029c4679411ea639aae749dbd97cfbace4333b39419f3f417b63343f247784e0387fcc62f27f79220e73c8bfd8d042ecfdb2e848f3b88082cd776eb8a17a653f967effb16b7af261742a03bc8a765a2f6e5e66ec53f8d5fbb6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 449; - dataLen = 4096; - combinedKey = "17d63e24d12b87bfde473d05ece0d94e702b758fd6c40acd1a7b106038c3aa0b"; - iv = "b61d43f205b4ac9897ebe3b59e3b7c61"; - cipherText = "c51b3db014a74662b0a8b48e15d99f541a9e876c1f84c333d2fa37e4988c66098752e9304c2c26a8b48e2cf7c16f89b3ba9eaf4017cb0298f548655a595bd6c37dc49dba236d2d4633402061e56d468895672d9799a53cd43bbdaae583f9d13d9ce7d7a7e4318c76b990c9e3c946ae4888bbe1cd833337976047163657a3e56bccaeaa0ed8613b9a9f962e73a01813c1b9982592ea3de9288bd3499739ba0b39da9e49f9df30fee9b039d14466a3cd8e015b2465894808ddd5782fd7311bcf8d2b32d782d329f71ea06bc73b944b372a1f60e1774dcd022db860ce86a5ba5fa5b0bfabf019c5b47428e8661ce8d0de1a14d55bd254cc320a6189a712c68b0a1042666a520d8690e5191500ca9ee915d47dfcc19d7bd03be549cf52120051220e567ae78ac7a47c5b170590bf1255f8f7f34e42597e19e7012a28778b1c328f0df21855fb9be71d4a3457864fbd344a5c7365e01aafd5277cd9e79b79967bb486250eebd2bcd4e2f01667b45fa01bd76b679f40f003dfbe4ccd9fae47e601671f71830a91a6e4eac996d6c31db2488064c8d6d56f7ee0fcb16cf541552e6b17c2760147c5713beabd9e832c7dc8bf4df0669950c0e2d987bbecc03592c76333debee6d96057898140e448528ade1945c59479bbe72bf00b41e702661c0f3a1f1fbb1c9b7d9b0529801d55e22b2ab28d84d4441c193989d878b063d811b60d808f"; - plainText = "04d1ef28d37a544a37e4588afbb9697a12474cefc17b4ca37981e7cf1411b6975184f4657adc4ed7c6178526ddfbc793240a67149093ed2604dc2cfeec64c155fd2f1da57f2ad85ff134711028abe42c6c9461880f5817eb8f58ffe304c9433e9041a4dfa6e06e9737c64a03ee88b6fe6175ea2f2af6ac0f06d735df503d3e600eaffff35236834e0913d68a8e12136796204dee12fd25fd85a276399ac5a3bec607d8a46d67e48fa84517cdfda5b35abe4c21f66f48f23c5f03f6a4e90cf799f5254a67bf49ad359023dd924b2efa75b502adcc7270916df1a66aaa14eec8d5b4f472d7b9f0ddcdbf8b266eb707603249d0637f7acdba65801e3e27def2686dd6d5825cb95f273571d3b8ebfa086d79a7a24d1189fb6b0e95a57367f32547b0642904bdd92eba0d719ffc7b72cb8150108b150685e96a5120245e054bc4918e7cdbd6f4964bd3c51214df4e6885d32c8fb15d85a48bf7c3567f2ee3c09bf2172a1db3b2acdc59db984512eae261de996a6893bc06a02e64682a06da182aee4af1e96fb515cfa3319fd0f3d0f18e0fc6a8525a921bfdcced2271a87b458d10c5d34c379ae8d5a39966387eec77fd6f9b72326f98e134d73788bd2f536dd65f486cd0bd3cf83cc21a249324ef858f4067d2940f5ae465a80fd82142635def7628fa8faa4b6f5cd78635b14cc494aa6cb351766e33b405117ae6e71ade70ebc4b5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 450; - dataLen = 4096; - combinedKey = "9d121a0540a7be3122340afcc86d849a6cabcafeec49b788a06eff15ffe39cab"; - iv = "6e0f1ff2e9d8e157b95c1e3e41409528"; - cipherText = "af2c8b1fc641e61374637cc19f3221d36b54c3145fcb4024c3c3b301b366603bbc19ad60d66769d02b55548eab194812082f864f8b318ade17dd9c9ee1c56c8fd8d05f7e8a5d77a445bcec94bd4ff3d0bc0fddae2847cd4c83d4424ff6e7f7a36420453a58535a0408039fffcb25d5487392a537d667881335ea309e17d674ca59d0d35be5def49a7456bbd90fee7a480570437fba6e7fd1c074a14e3cfeb8f47717f7800a6063586b94d0efe5d1e07d3799641523fbfd2a070e8b3083dd5aab6ed956b3b424afc2397335ddb03aebd8aa334969fa181f66bfb7a847372cbf15c7ccb24537ea94bde56dcfa3b85043a05268187be1657d44ac1fe01f7c61cf5882849cdb56a2f034a37fb4651ff25b963f5dab62f8fb4fef3afa2e8c058d3cd50fcd700691160b3c21e1601a44cc082266053a7961cbece06fb7f5ddaff012d69495f4fa59eca30ffe411d38f66908aa3ce005186fa2ee6e80e79598b60a6510932cd3afa6b9407444a638753ce09c65939c49121b500521fc577f9b83a47215afc33de72d6e62885085f57fed069ca20202ddbfc4c8f537d06707a7e0204eba4fa4fb0b3bf84243fd56eabcdfa37e0b5423e39a27c0c0da3002e46fd9b841ea58b892e2d627349fe9e8486e58c814b96f9ce27fa4d7830ed0220d0db5bb5e6071be56559f93db43892dd43532c4e5765d5cc23ce7ca624edb8fca0e0c458f30"; - plainText = "05f2a4085e5a2e7c88e104ecf1772d18d73566f68456e9a0c1c46a301928a1c98b1777ae9910fac1907ac59e341d94e2349601c2994b524e500390bba1ef77c5abd42f1ddb17357e54aa662001f81cafe4e27370a6e7d6f78154196a18623803fe843a39d8731d129310d799e6ec9070e0fd020975f50926f89ea0362a7eba6cdb6e6dd68888dbb36261f85b5d45467583c3bfcce502f50476a84be35b8390ef07fbc842074897564d1f97321aa57b4fdde79f008ac11661ee78424b0f630b05a2e97e45412118cd6b34da446eece3447ce29397dc3b1f384cf20e6859540252227c25f15dd6270d804aaf295874edc156e144af335667f7460124afffb9104e0600a4c4b51d10f0941d7e54954d5ae9698176523a8b48dca3e23d1ebc33c974d29c60550bcc945e03075827fece647391e4cd765998aa40fdfbe0b0629db245032ee6daf82ab239faaf96cc90d6905a74369a86b0a9cd38edc1b0cad7800db01ed75188356836f24f0cfbbefd6775f8eeb8f426019b72793396b112bd87f3a9ff41af7c2c5ce1daa6e0b59d2a77721e551b4ebccb76dc91ce3a47aa59065566275a02f330a68ef77d19ea0da08e33c9a45e9b8f39e5de07c97d70daffc9af98fd96d28e5b72d05fa51c26ba87cee9be197ed604a23591ac7bfec987d2df7a4180550b39678d1005a5756fcd7f691dae0dde9b0cd3ef40048d369540d5e8fda3"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 451; - dataLen = 4096; - combinedKey = "2bb19eff0c3906d1b0f00bcfab74fb650debbf86ce4a27ccb3d1c8daa6b77b27"; - iv = "4c499703961b1df64b7488a1d6937d9f"; - cipherText = "5a11907b989c774927b962f5a206f25f2f7dd0a26d3bfaabc967c6433fa9f3363acbfb4e4e353a2fa2ad880fa7b83e943856e6347c4ddbcd37341b7503f26b031677321d7a87f88f737d6769050938a1e407805dc28c449219408b0342232d01df77915e4d0d72c806d70375eec2a7cabfe1ab0821ebe099f2d7b589cae910718cbc90f877b4f1b624462ba2ff1f47b4fecb01fa2c87d5ad461e697b5b224f530a7489b3c9e6d7459c0068cbf741cf7d3c2ca0430dc59a0353857a4925285f29f035c46878fdfa1894ed470e9c51fb457313d2394830f084e1e694656a382e9119970f8f9fb3fc14b1b8174d761427b3e03527d541e1416747c39503468a1fa62b755f796634237a8a6d425f186f0513f5d72c22f53edd9c16009cae5c1cd853b68c4b155f410db703b212be1ea6956ccf944e9971c0080462763aae13c151addaf440193e81ddc3ad0747a261df8fc754d185801a0094303c1d473d0be607eee513f2675fa1356936bdfec1862df74c43368b8d6dc73875b3a2d244ca9e45d500e0b894a66ff005f2c998cf3ab2aa278dfd81bea1139073f5bc0ab1f77bcb9836cdb5264021f0b3b28db0d77cfa127e9b671de51731a23e8cf9c1c7a47f9f33bc2e7f1f5486a201a27fe94f31e4d501f4d0778556ef7c1e7bc8c5142911f1f4a0d96d7f2e911bef27cb3aefa24cf6e516a7f277238e1afd1adff9c731c20364"; - plainText = "0a961b3b5ef16b22e7a6f4d4c593bc5c5d2c6057f2afd03360d7fdc47a915545ecf6aa5a75c83151bbc98bb39c0a03b700d02f7bd8be9c79eda24d9550af02c4c66395fad80d120e50d00c68d91b0dfda8ab2cdc91785e67da5f49d22212d59c30ef369f6389912e36b93010285f413aad80b988f99c82ace9459c886db1cdf46dcf5be86fe35046c897654e0db980a67a6726341a16612956bb1c9959769e99256d502975770c7bc2c558f398b4bfe229dbc9d15dbbc2afbdd878e77783eadd934d0e9da710130c243eb9e78dddce5f543b25ba70178fba43c1697375c2b94753e0eee4aa4403217ffa31c733a8c4699b06723c04963be8390320254097953f2796446dd04b658bfe7427a3378812d286a6a69a2f1c958d4470fbd87bd74fb1823af0caca5ab7f81a0aa7e4cad2b6b76caeb8fc911e366aa68f128d613cd3ea2e937a6ea28e0e1e0fe47e1d37c6f0bd36014a5dcff61b4264dc9ae9a8ff8bb45cea57463bf2389dc4cb15dc889ed61bd3220356a4350ccfb2003cd41aaedd50ad9ea9dc17bbd855b46611b29583969f850c2f36266a3ab32b2b4878049dfd436fa6dd783e5a5987e9eafc2e3f916ecf35e76d5f8db5d697dce26a17f343e5b4b50426812e147c4b0d9c412ab60f68ed089fb1b0a0b0f2f336ed27ff226ae032265d99429dff7be894c78e1d9cfc44a2e219b821c14f0730b4c1028822753d9b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 452; - dataLen = 4096; - combinedKey = "925ae4794fc1d6f52fe02712e42d5417ca2767377455b017d58e697778cad6a3"; - iv = "0eb7393422a4eaea20403cb7ccbb9b01"; - cipherText = "125c05b7dcfa3cd531b9ba12328133a6c0be54a2cff18a78e19f9efce24cb2eaa13b3ee7cdbfcaccbd76635a05035eb39a8bbd20715916e076e642095d0426cc146ef1fa8dd98ce3a82bf9a6f4c982a8f861c6c06633f29faca17610c82de6ccde89e409c576fd0e2b7302d6a2f9c92405817bb7600b14d39d5bd1e86798dc1aae864c6faf19d8c791d617b77d337d118402ff454e5738e15ca12ebe4e29507dfaea54239e561c29ab3e089e08dccdb9e8ae42ba98333cff34e323fa33ff1c5574616f12803b86940be8db257e821e8682a6e6e1d0a51e47f0433e400e126e75ffbf319404ccf8b4b9516fdf854ec2113acfc5dce6f02b2c3c1268374762949f7f88ff93304429c6796117855e5bb49151cad9b682d99f5cb44a04ac1fefd689e1d65f69f14ae0426a3015550718b6574f4478305d4606a7a77ee76d340a879e31b2ab6d5dad1f40a0d0edd950cb866e56f4e44a223ed566a8f3dbb71ea07485e29dc73ad04eb09de07d234f9c8db00b44b44b33d05dfa79482aa4c7ef406129b6979f4373e193b2facaf5931761dd956f5d200c88784151c5e1d6b23aab06f58c2f93cd4defc533c031939a6f389983c78abfc83baf7f5fe5d4405a0d33f69ecc6e4a12b2d13058eadf7abc93afe4f9e0027dec528780d4537b3cc38bf3d390fee18f7ad96755b0c73373ddd07d718eda05d104fb499822f12d25e9c8c43265"; - plainText = "00426f585405082d9dab223693908ab049d26d552cbf8c400c85cc0fd1b3059a84fc1e983b2f9ce2b83d67f5708f7ece117bdf39c715fc8a507e355746eb6f772ab461b4202ae325d7f4fe3600c14f044222582fa224e3d443fb5b45132ce14d2ec997feab68035b55ad40204e1ba83202df3510283f3aad73a0e7640bcae6490d9eb6260fa8f933d3847c84301a9f828b50370089f7461c7d3b7a73e99b55765a4c5294a74e1e5b363f87c46bee32f6ca8566ecdc7d036af11470344543c5ef3508502a9df054efdb63f983b39a4659a20413fb22f21e91ceb854d53f0d0a8a02bb1c8e8bad1c82a04a0c451cb7fbbd0db53822e80f78e262eef48794a6aee8273d91e81784e84166d2aa814f8a39e9e03efa11177f3ffcdb24f64fb8f48c73734a990574377de9680833411a7e26a655e79a10b3ca35cb52c6c09eb238f14e35aac1c8c1d9eb1f8003e209190dc622f1f833f21c81e82f32c401f4fccaa57a132279b521a7ade240ff69fb6f208836d875d10a091d67cf84cd2f32c6fddf05ab9e46111ec8798eb8448f2f0cdece07e2650278ddb6f28991eff503c16bb2351eee1270f3e60b3be8af15eebe1e9dfded7bac27c6d9fc216e371d031edcc37cabdb328879c0502e3b50480e24061bcbaa0c9f6d7a70f26d1b98cfb0eb5239cdfb6f83b10969b3186d8be1580ccea02653b8062c055d07bf6b86fb012bbe4bfe"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 453; - dataLen = 4096; - combinedKey = "20ce63b73b552a4b8b9cddffb1ea564deda7dbc775607386e9e01c6408051cb5"; - iv = "6430893dddc6be9f3d7ed2ced0cf69fd"; - cipherText = "20c6cc17359695f1a256f980bcd36d96f9850801d74bd6d4c57158796f1b5527cf9483f089c91407b0745db3e1a327c4617494db59dc1c851ba738e02e62d683af108c0b5c911ec7cc1280ea7e5aa86dd5952420f4703e82f58b883391a022af284327de495205ee7e59f1d383a3a230cbb069c225f4be3af4befbfefd8c7c4a7d65326ae65990c5df3cfd5c8986b02fd11b4cb1fc2be780a1c51a6189f66f90033c3c96e6e60a3947d41a5a86f6acb00994715feec07dd96d8d19194e12cc9dc306956f7e693960f89f6286a30db4bc0292b4bafffc98fbfd8078bccf2c164eeed2849751233658da5a6a238460e526dab54dc56e885e3bc8dc212b97d359e92ce48fd89f9b8d998eb571a63c4040906fb23a254f8250ab43be260199e4d3cacd61043e0ab06e1931bf16b0c8e6a32a522c8d85c24a68d6158432e41f9afb4188c502d07ea32d1e32e3c7b2abf944848b2649071bc8079f3a3362a30c33c3cb286c99c98ad99af296f8c262f32ea03aa49cd227f4cf1f06d5ba28e4d9e878263b93703a1561729d6657bcba799546fb68acd7cb0475f6b03e0302b758cda9c2a78b4558b86f19556ee0b86c134a4594268be28a735f2380d61fa9844ba61503acb2a10a8877d1cb98cc72b918cd8111c88b6cfd4d88bba5cc241b9620eb263bafe0ecb1a53f8a5b4d82fce151b0ff01e791e608ec81142c3adeb5140af406f7"; - plainText = "67a2be4dd962817cca7b2a6159aa6f3dabdf64bfdd6fe881fc2a2c3576271aa401474e810609fc6f2e6295eede52cc7bdbf024128a3e9a75dc1f18c6750b1c2b04706386f835ea537d55672e4149a38902e09c9a952d4e1070f9161a7fef5e2c45ad3cbf89ff7dd99bd1684cd9a7dba2df686c5f2728fe38b32f1fbbd7ea008de255d21516422d446cf62ce5bb54663be16eccc4b142ea18435279e44064839cb33bb9f9cfdb8c127c03ff12724fa5d25a4fb9e08762db1dcaa7bc0b91aedfcdccce017637b8be718b0d0303b04b87241cbea9ba2dac0680213dbfd05f11c2f3b9a5fd27b02bc5cefcaa635bc4608d8a8210cdbcfd92b325409c6a35091b7de308633beff1e3108713876066763c1e44e6ac0ed6a85f7ca2c60227a4c35fef960803851a76dceab21d7e2080a39491440ea3e844cff19d7476a13349378d342e9b4efefdc32bbdcc9bfaf8c8b372fd9002d9c05990cda8c661d113ab2d8d4af1e40545f3dcb649d30294cb25181978e36fc0aaefa7ea6f273763748ae7c2c56884070b03c41e166c5321d645a14d1f981dde2cecf48774d647562527ba679ed8d1bf1757a35a2578f0f21c01b7a14020218d8f3c01278cf25777a08f01d0dec95c5416017887c6e70aa51ce0414f5f09875be58c9c591d7614d118bdca1b9b94c3f26da1ed0dff3189f08048287de4ea82b77e9514cbce2544b721e57c1d5fb8"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 454; - dataLen = 4096; - combinedKey = "be9a144bf21056c143fe4b7944dce24ea338290c58c28d702c55555e6e768ff5"; - iv = "b6c68ea7fe34a2a6cdd54d5bc3473560"; - cipherText = "66d692046334887ba81b43acd1ce387a83a35126542b77914ebe72d00fb21b479f650ba2d84198f81051b882d18a9f130f352cb8fd0c4578392c22aa048bd72f3bfec03e63a105fd44b35e9b43c731f4bfa066e6761bc2e4b1c30e46ea9373b6e4386b7d4c0a2b8d4e82c30349c04caa909e1380533875cf7f11989f1b8106b42d4fb869f846ad672255ed929677b6e6021943c060e4e2800a701f96928bcb91ee49d4f676b7e19d75f1948456ec76b7708b5384709d1a866816e862fd5dee3ea0d9960957172d4f8d5f751bcf240a8649671dc102ab386c2c1e843e565bdf611b2fc3cdf16f5039276e292a170554550f787aea12e9240872240f4465d6fcff4c2a0efb82d09d3c603a4dfd05c5a9de46937330d930722dc41dcf4710a1cb39417686bca11d9352d20dcdfd499f30c6e4f01c0d7c4d6b54121f9e9abeb8c9921d447609686290ad1669112a54e245eae344b7528909f96206d37b89c036faab3e2a5d8b5047a7f259f0c96bf2867c4b825060b7a0c3dc74de7be9442ebc0d98876c2d4600fe02d4064635c132464ac1b795eb7f5e5fd4faccc6e5c175c319fb65673c18a060505b2fc087318685621b36e2973ec94e712f5f2a8c6d8f2c8137caa1ed9b14adf5ca898ac617fc0d49a0faf5339ba57394f1fe3e968e4f7d68c4311a9451c4a9a38db0c2b66109d4e8ebb56f9a6e13e7a30a69479b104bf48d50"; - plainText = "cd6c4df8f39ace16db661e6ee65d5b47b477e2173f422e28be0bc1d63b792dd678277b665982e4901e5fe104b6d2193872df38999cb668c82d0342ef22bfdc242976fcf98090b596e9d79af4173f714ff5974e9afdc80aa30c4151f4bc9e30f73e35ac3e5c49f8fb07b6ec7ab637e7c0092050785644b13bdf418ed7d33cb4eca6fbbd9d561adfa40027bee1667694f153df1735932883967a70d2a713dfa482f781b0fb8f3bb9a09b6eb89f3a2ed9ae4a7285bb3cc842dcb976b576c4c2da69361124c56473591872cfead44bbf6e86c3455dcfd7cfe308fdf218e8911ca2c6d7ce0f19aa4f15f6851cee839630aedf66936ae0ed3b0a9f3bc280b131d031f1a2ad19c4f7d87d6d212d04b80625448722a9a06aefb40db910cdd046b0fbad1dae99a936ca62df2d33364e76ab5c29d26aaab4ba054d9e724c7ee2acf6226132b28bfb79109262b2858ee4bbc7da8cfae9bda4d36bd14b3fef9bb8f95dccbfdba342712709c0669f5fb2b43665fe60f2a1fce6fdc612751675ef8c23a3db195ee9f6882c2ae2f62c63a32d5b34cb73eec36bacc502a3e43493c12daf76c7037d08ad8b52a423687b0417be0cc1f07c6f1ba6390c52afcbd324acc48a33b4ae855a69be1aa76ef573acd8440f8d10b5450ba8f22765b122650bddedb02fea7f2ddfb497e99f2e6de5bc5d1a7c8a95ce807d321d41544fb2e6842322e98eb976e1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 455; - dataLen = 4096; - combinedKey = "395d2678044c419c9971536cd905433ce43e5bee07dd31b56a2af9e769eda5cc"; - iv = "deba734ec4d3a55af04fef6cd3bb70cb"; - cipherText = "0788791221379f24847679ac8d215ffaf1210947b68ee6864babdf70bfb89dd6c1995badd806584c60348e333c32ac981410ded7415fe305e0f6ae4a3021014dbd74073a6fb66d376cde8c254b1a11a3d6a3fd74e7ddd376e8f8b38d28120429cb4c9967f19700884e224aae7d46ce7ddbfedaac9391542d278e650cbc8688c17ffb2df17948c5b75cdde7cf68c47ec92d41108f8c0448ac75b622436f8d0bb06421e8c2cddf42d92fdd7a790989b950e54ae0967005a959a6bed9f0cce267a11ec2cfd305f4033c8cc39e4139bacb49eb241972f934b2228e745ace6661cf236d2770979296b59d830f4de9bd4f679084e2f5d6f1ebb683249aa9357e59e88ca517f500bd721e36ec57b0be3af130b7e5fef7fe0ed0446f84b07f86f570eb3c4bda6fee2eb233ea530c9aa540c2528664e6b592cf617fed854e412eb3b4204949f7e50c9643ef2920966f386462f52c79cb43ad3738849e2c87267ab1d980232c22d61ba6297e3e3deeb8b33e4997dd4f34909aa675e05e8e985f21da990683b0092feadb0956aa5b0e7bd7abbcb9e489248778b9b58dbd212ade44aef99b9d1f68adc8a3dd6bec2002bcf9dd697d0c6a17b2bda11788842c4b2f73297dd41bfc1b871cfc89f8d6fb87655962aa7c5532472ee51d27737b81ca55f9a52508930b99507d9ec6a000f5b812b6d68b1232f01dfe0c20341ac45b250b6b2dc6daad"; - plainText = "23ed5cb5eae86ccee8c3cb3fe8e997125abaa3f58bfe4f7172117425eb9c409842d139f002f5632e63ec91c746d7a2fefde9cb09ab98c53d280cb7cb7a8830326c50f32ea7d05a84cdccf16b2cce149fdb54adf4bca45a72c4df6df11aca96026708671a6eb8c3b89daadd659d71fb529da5a521e5c94484902040a4c9004249d89bbef7d5df0cb85884d2d418dae6d9daab738005ebac9888338c4938dd3a296f908cbb67207e75bd54b839037dd685c599ce2919e4c5d3c10c1e225df9ddbfbc9ab11f5bb866f5525c9c1ada3588f9ea595e66b14c86a98d31ca3a5a13d27244d3a741677da87f04edaa5ef2ef02e8244bcda673eaaba72d449f3b036767bdbaa328209f458561a7cc2dad1b1ac110bd9562016169c4bf1b07f0f9b8da297a9d03475e88c537401d891852aa4fc2b11489e9e0d5865224737697aa32bce2fd0666c4049a31c981d6067633f9dd943d3804eba83fc0ae21b242662eae5f744c0e4c93285107d0a25e11274c41991029c41740fc64e657bf2164c5d9caf8c7989eb748b19151bc044ee5fb310de650fbaa407f976a6400b752c9c1d685d9f3c964cfe141b4fb1b78f03c582e18f6000e373e7bdd9bc71434877686adf5ac6dbf4ec0e05476457276cb3bbc3c91e3ac8364c5baf47e01d78c1c09b26e02b20699b2b999a887cadf82f78d58c5d9a44b2b5863430915a81e21bea40fe51ba609c0"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 456; - dataLen = 4096; - combinedKey = "85d618079c5a0554766b59e47070fb449fa1967303101d705da875efd1af9f87"; - iv = "88402d1cd26e254bcf58331ddb96f56c"; - cipherText = "81f23a71e129d0098159289b514d37d409d9e5949a6afd6ebca48c66604e19242302f79eb8c5cb8f8cd9156fec04adb44baefff066e3b728532a27939db50aa4e08c418b92d21491303da33359deacbb8d06cb2ca8f3e4fa65d5cf3f350f9467b92be9e242bbe3a7c968a8e6ed1937909dd06eeeec71e0b5acdf3181a48fae254684c377915c46c5ff793e90c9d832b13641555d77c19b757a7e3cbeb3a81fe75ce83d4cde567dc0847b7554786b2c9e413cf3e8b143b7246bed44d764c755248c1a684eea85bc4c7c231d4b17f2594b2a83b117dfec0fa3254615ea8087745bafd3f69d731932fa2cd3fe9e2021d8aa7ccc3c530d226dda90084e24aabd7d37d35dca0a4907a37809f34226658dc511c2109c115a28406f077b4e0f0fccdcf4b0d68874d16828f2e06743eb55cf77810f0ddd91f1434e502f7e7c50da360b1caad58d8207c6e8bc391d03df411c7fca5cafd9a79309175d29d69d1c75dbf2b8dd2b689d88c2ad728a1fa50e19e0e59d62934d0405a7767896d371b184d424f07ae8419a7119c2d77b8875f08d9e0c26e3c4529ba0b4193c25e7cb2a1e6adf3cd7f242d128491667446fe61d2aed819ed89822be3ceb37f5d5833394088d9e700e490fc6edbbc03ccd0b9bf921ab994fb1154e238e21d67ae1dd4575de090f42704bd8765f26fa95a77058b75690c9a8284111e07856da19fc8d11917ff4a0a5"; - plainText = "a4378c00f3c183b9062c4afe4855764f6047479aebb59a4429c1b05944a3533b01e6c6f2a37065a4c67d23d9ea39a8fee0c566a29ae4b3efc68a66c730811c0de818b5a6d65535444298d19f5c6d936b800947d1c696c7d2691e07551cb0342b6139982e2bffa58fdcd01cf89f4be7fb0e6a7d4a0f08b6ae112bcfddeca9d955a3a802af7c5b5701971b96bda118a4ee5f6b07f13aba8e19f77df144fb29b17aed2052e9e484ade536f3770e4e26bb1602c905aa4ff7abc60cd78b5cc28738083e767b336ff87ab7312bee9e543d972d2cce1b592acfdc073f50f231eed8aeb6977eb6cda20af9c34819220e00b3d5421c09619245bbff74bb15a2e95cb69e09912acbbc28ec858a92b96fa0d30fd145137186a5cf1d4b0cbabb6225a33ef71a69219ac45febc093a02417b99b2ad14e5fda6e28212a6567571e3559a8a9a0d07fc3621fe64ab28874497832c3793be57a965f840597679e4d3ec1261fa891bb2684b20a139ca9502bd9a3ea7a751d716a88948ea963d81b0818476318538d4b40c61815044e8eb0b55afa1218994e51035b1ce9435cc208a0e332229f79e5673a487d7e913cabce8cf2e3c59e36efc11e15cc097766b9567a1cf882ddb1afd61d17e6082b60d56c70a8b9800d889d62da256d93f679b1511396f7714b0dd8124a53caf2947e2df041a584b68bb199f4e17622f04571c2d1b832b612a51a80b2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 457; - dataLen = 4096; - combinedKey = "69aba8028a195f1219a3b961f05c33dc411eb99dc458e86cebb5c8d6af3b6664"; - iv = "dbd7392f87ede5b21a337df2f511dd9b"; - cipherText = "14528e9f22dc97a9231d7c75eb2cf029999930b229c8fd6f860e6c6ad217a319983061b2c06038fda32dc6fab7419ce3ec06837fe79313709d74e1d0dd5fe91dfff7c7514cb2995ad0a2b1ed45016b76566d8459fed1e12d8f2425c6646de42e29785017fc4c8fa470786d6ee6eb1accc3464545a182e45761a560613954cfa29fc0bf4b5a4490e9dc45a8ba3b23fd350f6931c40a0e453bdcc48a8af98cc7b691aaa4f614328c34bc0313b8e6d3d181c80cd909baf42c406c8232a556c2d0289d7eb907223dbbebb221007952c0906a44f8d76d3789308821db3df3a32a149e6e275be9e479110d5b2dcdf2a0b965e9c943c534d19c2e46b4da5fd531cbc0b36fc89e5275e5ca7ef45465fe5ce2b67b278f01d505fc7fab1660dd044f6886a0eb787a807d1957e1ca577f7ee760bafdc67e5d03595e6a8f099da45eac45135de6fa60734f41c44f22876654477e5592e0a5607388d8bfd544b42d391e719aed0526434e812ae458e0f2bd15ff85b2b3cbbc486d12bde0a13e440d96abbca42ed179e2b544d0cef8ddfce60585fd71c67136f0fc4c56bcdc79a507ba686c09b2011642340db294e75ad6565f4cd204487452c3fa23dbd73c72708b0e84f9c42fd992e3e63a953c28a6f439217d92dde27310042a14d3759087e6e07e11be038d2caabd042e07b01131897d90b15c3a7093426ada26ad90badacb17f76a5f8c33"; - plainText = "c93f4cc620ad48b06f637df4e1121246b86bee2aad63be533b7b3bb63c8f0bbaa61a5bdc9997bd7612310aac06e1517e2e6378d34062461300676ff300f463a0c7d2bb44bae3bd35fc70151e2cae23c3aebebda2cb69d43c73d531ebd50c118cbee536959b55a0bce94d000aa730aaea22f03f8507aeb29861f81796fe9e8800862d522e776a5ddf572e1253acf60f5fad98cde9edde77271df97cb89ce8fb4e517281af7767d7f9b4927755d7ed5fd705ac163b8f4e4c31792f986b45b75d3abd34fdbb20dee02ac47de7fff36bd83bfa557fa6006692f40040f0f96a8f487fc12b6809ca7c3e782bd072c24608e16790701eed02d401c6535d1da7dd2dcc1f0760ac5c895bbf70fed15850855b8c13517688d00b10f97aacd6d1d4e52dcf69a6b073c7a3ef4646097435a2153669449e1def8595e15add4aa37a838027c9a969c314b501d47faf83583f6066d16450727965b530a8a8c6ef1da7fbf398852f880810ab56063cd7aa7396971c0d0ba56fd081dc3e5524906226036b28639d943c328fdbca68b1639f66b2933b06896d9bd0d2e66f7fe42f8724383b63f2cfefa210c5c91a6f86b1cae7d7f8349f8b567846b19c118690c789d64e53a3665042206b20f2557bda9964a59a4cb659501c86da7d159251f970a4527c70091cb8ec33867681e86b665b12a52e02b8a5b4105256c30901e51e0572ba6e2e6e9c20a7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 458; - dataLen = 4096; - combinedKey = "40dcc8b399fe21e0a8737050130ab048b9d24255baab4e90b47faf2e7736f0a6"; - iv = "e184fcd5247bfbf6fb285c982505bae4"; - cipherText = "aa7b870e99440364cc0956d05b26194a9e869fb76524a831faf6268044de0e939ecb032e15ac7b3d795e5bc9b10434b230634ac101fdc78c45c1f79f0f0f6469a97a71e58f712778058d706f6cd1b5720b87c6c1d3cc8ed5e68b99c1b1b0276bad61af11ab2b72a4fc3a5642ad40b3e44459be8e36987a8927ddbb9b41438e8f62a0e7754dc6b503753bcda53a3e0a62dbad39067d6c66d30ab0c4f99bef1979509d302cd8f3f244a43113929a1e23625f8ef46f6a5925c044ff684afb681dbe0624733a3238b8c6439f011860992dd2205e991db2c073d076323031a00e71adb9f2ada3448aaf7480632a68a7155da73c0c271b61bfa8ab8914793c7c0521e48c5910e1bb2945dd04844d700b4bdbcf1ce2d017984914063f700911cff80be4388df0375f049cd0c973d1613d490504435ea0541ddc17b18f01ff2b3c71c18018fdb92248f4446e5179a785a1d0ed802bfb7bbd160cbdcda8c6604e4de4304dcbd21c4e35e96316c5ec635d7c3056e587b86f97cf6575470004f5304fca79a3b11eda9727d4f3fc11f6ad79ac983bdc23de9fd1a7ab22632c044c85a05e7d48558d24bb1250023e1fe772628e694c7a7befbbae6fb656dcfc2919e9d7dd4db415b2dc8132a41bd321815918108f277137b86b6143816a929e70a57d3138c51228dfb1a7274363441a7dafc70a1222f8e34222774abc91e430c434f47742795a"; - plainText = "396667f6983180f33f89391cd8aa0ad21379c049ef2857a98ede609aac5fea2a1cca15e9bb8af5843767357a3c8083ff8b66a234df8798b66934d8a7e296b1ba84c339030424f9b2d4c665c332d9b9297f930c7ffe71bca4e9bb97976d787cfbdb07f2e3840435b1bc8a2930a906ad6801f2d5ec6c7edbd80f5e1dc75f8bf8eaaf1978431143bd23659bc01ae964182bf7f99a67d9a0d6d87b357de8566d9f61949b0c635c13567f66dd4f808188dd16b85390ceb30dd9f8c4bcfb60d6bbb25b68b28f399fcec8364646b112241a19d2f3cc28974bfc9335dc1e701f645191c35db9eea4b9f442134309b5041ffdfb2a1b590dccd636fdc3a230005aba67369fb2150dbc2e55f05ce0abebac398826e884d941dbc9fd742a4691bce97517e19c45df250ea56da650fc5041d90137ece42111453556cb22361dcb242771256f9bdfeb7e1c5dbe4e7c7464a1fb0d1be1973b302c2dce1ea609bad420bcf13a3a21d8714442b299af59058a8c0c0501176ce5e686f1c841ad24637a28bf47f3e92c962eec398ca9ad00ddefe2995da92b5b96ee0c2c5f7e14fe6d87b18a63cafad3b6c3d2ec8c0bcab071d6d1e994148dc1de5d38e0edc72797fb1b0a45efbcb968d4c55f190587dc7d015d5ccd3083f0b12b03bbd4961833fee4fb9ad4e362db174bb6673bc7409dcdca82de66fb2a7fb34a1f94ab934250c14dc53f7b1f9d88a4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 459; - dataLen = 4096; - combinedKey = "3996e01aa945f478abfc95f64d87abf03c50e565dc6c87420655e647e559879f"; - iv = "7ed162be1294eabfcbe6363aa0e0d1ea"; - cipherText = "9705644d91b8a05a1fa4e44c71d1a84a94a658cf7838bf970cc5f4d3c66a77742d1100e0b9d425716e32cac0ec389bdd9cc68c6d6fc196525467c8555b69a9c6f0b34b4dfb4efc9ebe4a98499dabe63443507220077eee2255ce94edcf48b8bd03deb83b96af7cd20793f82214646208eb14dc2dcfbde68264f1317bc0d70205ea482e16a7d03b9283d4baae8b0a066b159deb2c1ca2952e500ce86b69118ca315311abba4c299804456a5d7152c92b04a252d7d46cedf6331677aaec5ef3d799832676a4e690208b1d14d4d282b612820c386589d25cd7e16f680ac5368af9bdc658a464ef96524e8007361a8ddc141844eac8d44fdc3a1db2cf5b18bb0d39c22823e3d4713675dfc119123ca0084a0e078d93084268e58a058e92cd99938f6ae38083d4285630a1a06c79eb1c1d0d9dce8babb272f72277f099b1cf630ee800dc95a00cf7ca469fd6c1e9b650a7dbe2c1881b8c0f655034f6d3c42c5b0aba7e1c50c7c83fc99018b1ef4c10a237422c946b4ad30c465afba2d5cabfb57664d0ec451bef89c13cbe5e32c3595fc136e9e381627e92fd6ffbfae1140855331cde3050368b14e42ce4f1bc4c5da72b2c1529fa4af3bb20d3308f4ce8683285565bed0ec7ab4e4ebc6f9d5d2ef160daf1babd5bfb8a33c36041228c05c2cd5dc590ee0a3181b411a3e7731b3f7f5554993199d16b8f9187fc70365aa089e746fcc"; - plainText = "26ba29e4b38476ddd5664161d3b0f8cc6e7414e9e29cab05cb1f32c59bf2256f76443253bbdc6fab5cc6219710971f7927e68b0ec29b240aa1ae68c5fad9399877c6728c9a9bb6b226dc74abd45fedf23692b1fb2114d44f1cd3faa7a60897cc548b4ad31f9c299930b5db9891edb8e1d966a9d11b11ed06f8347f020324c81745246160ac9bf68be36d1af2fd99ea5b89d16230ce7f7426de6e9b1efc12fff9a7188ec5af8fda7a4fe2fe582c9b6c4c3bbe4a40c5dfd822ee973bd0e456c1a3f642d097c1bbbfffd6260b6e1621cb02da7ffb4bde0180147077aadab232722b8f6e0b3950760c435baf95668cc3a64c170545229be15cce8cbbaf339abb42ca411f5990d1f56fc3f6c06799d5b7ff7522e68c586eb79ed7737059564a78a0ab449ff954c594b0b1396de13642c8c54c122e2efbd54a6806368cce67e78cc3bf6a7462ba0f37cab36ed292337a41988b9623e8cd1bbed5a74f78171c42a40def6bc8a3e4d4e754c00b056fe0221435798445ed3db2c8aaaf838cbd8a6975d0ae6b37b54a3ddb90ba45a0671f8fb4af81217be644c0a4d210b588781bbb550ee6cf28b40844afc58644d936ceb54bdd03be830400c4832e2613906a842ddf895156249605b49396c1dde39ca02898562cde69af653b2203834612714d61346960d6aebff220bb3d8578a69ef8712cfa1446eed63cd106ce244e1db1044e998a99"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 460; - dataLen = 4096; - combinedKey = "93610b15a88dbfd1abd7a8cc1355c1816850a3f786f7226db891e277bae6a228"; - iv = "d0a779ac785feb3a35626f19e158db76"; - cipherText = "1569e189cf201f26e8213704205c7765d1fcbdaf646a780c821d33e05fbb00b6ea8145a914c07f6b0831973a32602102fc392e928dda226165f1481f8cc49e28f7769fd0ffd8e611764496612d7f968c102c9d65d72b16b152238717efcdc26e44142587880626362842080539ee49d94ba531a7353a8e36b876555ad2ff232a73b0b6d082e4b6310e8c4ba61e5630e8b403068e3004fff2c199193f48f89b8534ca35fcec4ec6378082f2d40e04d2d3bba0253ef50fe5de7f611c49a21e0439a5c5960431991b26c1ac629ba619c5797799553a1a534ad8e89fd71914841768bf3a5b4dc78cab4db4dc724b154ac085fdc82a19bde1f4e5e83dd45519b701f4971a8e209641022fd58b15d35392dc0ec8b77a8c7f0321b22c18f0deca7b2a247143c2e8c70f05695f7494b626abf7b8950d33d37387c182774abca58f2324801acba84c23a0fa798e98815a5a306c8e9c93b6798081dbe2effcd48db4c3a58efc538e0a5b335de207f5b461c3edf8a0a8a7994b0e8e5e4d25b4ee3f31f14858fb5728cc3c5bf9bab7ab4e3c1ca3eec9dc70d2a6a8411031f92dc1d3e88c4fd49ae1e6889d5defa3f03c5865ad910b5d1455300a7502bb2ba623a06eefd1747d55ed466a7d519a07d7c32093ee46db3573a1c4df8aaf526eab178e411da7acb3c1305541044809d1b995d07d1d930e7052ec14e7989cf49c4dc183a5eec18eef"; - plainText = "34d4aff2be8dc87451aa7ca6a544e45efa9c78963cb0ed907d07c6ccc398b0e00f2c738af0f0abde808d1bf32849e89bd083b21892ef91d292bc32bf1ca7ac47cdb5d808ec332734d783d7c39e6d859f0e9ea72cfe03accd9dbf9e90ed9bdc17604f0594bb2ab2783e89cb348c138f49a4670285333f10230b5c8f208c2766da85c17b9f41d4eee238e9671d0dfaef57dbb37d24e64dc3e545f959054e04a8e9ef64e9d00b94856f881649f52dd060219a0f017a39a680a9052f347a858865756a5a76af5578c7d29bc781d16551f89c2fed6bdc8afe2b4daa89d23f0dd18072445e577d1f9bc6f943758d70534114d8abbc99c3bb8333667a340e2cf71527759e461466b96b87a86f905388779f097f025172f270c15a35133be8223d08af4f5b095507513c302e3b6a2d6cab9e603de19e6897098e1737ab4f4a2d6ea8de5cc4a28c1059a183fa4753aad7ad25039118e42cea45457d258fbb5ef53f093532443b1de4fc67c40f805a547e5daf41e040a4ba5b11af52fbed95196d1e8f1411fa40a2eaa14e5cb60eed54492af9eb21af9544fbfc4d4e1b8a54a54c4d9279b511911b364372a2b40e9b4cf4de8d27f3e42495ce35d203a17cb3d4bb7c4fa7d85826629d36e301d9daee445a2d52b734588928f36a4b5afa6731b1f21956735e26f444fe1ecdaaf40da2d1d16111113f8192d633956ac750aa8bd8d7bf4acb56"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 461; - dataLen = 4096; - combinedKey = "4621ef4da668b0000d863ad7974dfc6a06750fc6b18c57ee7b8109d78658034d"; - iv = "e40b22231b673cc685589188e225586a"; - cipherText = "c80ca764a221951bcf5da619161061401489b9758636eb37f4b10b7a3f139176955068988b739c5ddee22ba9e20f94ecad3958d6417019aca865a40b8b5f5fa3f04786bc1146738a02b9bf40761f49208aeafb04d0db82d607f5bd606f9cd73702a0f1b1c03e4021626a9cc0a1ebce01f6ee02d03b41156ea57c8b15e56bfcd89d8a1b23c0b059a3b288b28919732f2c111926c53c3e08d59257b8bd79c420fccaa5377e9ab3b7a2480d75ceb6fea3196ba2856003797366e5386b2d06a1814ad816d8be40e59572763c877e9bc6ae727a6d2b680d6be9f8ace190ad50d69233ef6b5caac6d8013f700ffd331f715ef64e418d3df91c65d5e86e1278eed12dad9c19d7b65899ebbb5e7dbc1430b5d16fa04e99f29a826b1d78146295e5e4fd52cc54795e42891fab6f912876344ddfa4a66c0636ca59e81bd97d61a0535cf0340811e3358ef3b5b83fa5307fb025b3894304e9ca33714d1f06c16e454d0311dfd789b82977494b399fa55736e8f8e7d5c6ad6e8a02ec49f80f0a2c2b16e63a94cb1086e2be0b5fe780be0c87a3ac87f2c91bf25723e01d221256af075bb1afed593a81963287024ace0ca8b7cfa6dd8bcb2e98a62d3999d1d27a1c7cdbae7a221115d14bae625d83fe5b0016cb5128e4e8cde0cedc1a1c786d435e3eb39d2647c252d3723055f662d494414bc0c1a932d074836cf81873edb83253b6d74837cc"; - plainText = "7769fbdf43df9a638dceb79d10c6d74259f289bf5d43103954d9205dd5b1869f8119a6ed39945e25fe9199f78b00dadbccad335ff228d18970bbbd83e36b07e19a180e9e6f20a2c93cf504c6cd91609f27301e63fb93a516f33b714fd7ac2ea9dbd4420e3bced280e8160fd8f5164d7b3583d80f6711bae83ffa50126522d99e6961a3cf2aecbfcf728fadc46d28740bb0cb1f1f347dc1c8a5a7f476e732ce8ba49a4033e93daea719c60d3f4ee58ea10ddbd1b18b20903844b0dc7cc86feaf1b437fd9d924f6dfa283651f30ffff480977d04b5ab45ffde20280f1bd0fab6f20f0afcc7822636618a9b8e7e0ba11ecd45236e4fa8e385afd8be947c99d73b4c827889806c04f27e20a168c2ed9a20ef22a21c37edcb2f5a8e8e0f6487582fb90ff8b894ce0fa3b2003b520a3378bf37c0cdc1ee51403fa6052a7992f48f7887085b854b9b0a5b1c30fef43552b48ffaa178cad977917f114bb300ef7d7e17d81cf0792c554644af035bd6180472cda17ed0b87b19e8e0487bbaf8315ce9b57b34fd1ab21103dc8b71db9af6e90e113fb304344a99a528fb123e26f709a80c9b03606c84b4dff7e755ab687beb60daab13dca485dd7d0d7c70425452d169468d293958d2ab2eda6143a9cd66a3f5ef58f91b7624421f4c2a655c7f3002c164c5e1bff974a1f9cc1490a66c0fcb5ac68ee9475444549286b3f605c574a1de743a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 462; - dataLen = 4096; - combinedKey = "8e51022b0f43a38a4412101015f36f656dfe24a465f496e45258250abf57bbb2"; - iv = "7563b78ef16f73b8c89c6f530d58e57b"; - cipherText = "ed9438a2bcbafab012dd7ada434c8b9088443647d7e95a27fd8286fcc103dad1d67382fb8de19d739c43285b5cbc3b87c0bdfda2253ef81aa951f69e2708d06b875322d3ab45d1fcfd27c87e16bf8294c21224efb9032c8daf9a8a4401f2c60467d69db6311a50306a6dffb23dfecd2a93722f2d4eabab34db7fbe660474a59600caa9420d1b46efc14ed23743ea51e7ed22c71b4a610a0f2a60b5094cebc26062ffba28e46016ea8f9257ec2465e0f2c9efbcf3fab3a830ab2a47300db4fc5d780e8cd1529f880f43c2ec3243b9d14c4942e901460e2dfec4fd8688ba96b2779b7c532cea9245ac6cc382ba1d4d6afdb8919f763c13e9e99c6c77dce14973b96383377cc6009e130f975bfe7b8709cd51ab1a49f97e83ff2ea96f757c43c5d9c1d5c963b3ecfcb70686950c6696d85b6f63d6b0def536b9eab922a4ffd335c06bf0971d26dee99e09c1b5cb168e05991da6d2d64a6304d1a65957d4f8aea348f6b7e59476061ab086ff86c6c5525f75f3ae95182db5232a1c61e0355dea750a7597a0dbdd0b4c0944be639eee8f3ae76d1e2beb63b899eaa7bef7fc5f86d16f4085632d4f1770015853922ff75148e824283d74bbbb1ff43b377936d1cec7dcf20fee34bd20c61f099295eff8d66542039988ab958db31f7036302466b97e4fa8fadd5c29aad30051735afb5def09ebd0a3f2c0bbb9da664819bc7e2f97403e"; - plainText = "0518b1a9594eadd0dbcb290b448bbe7760c6b9077cf1f824897ebfaa5f5cfe3e5bf7d10ba8b85f642c4fa2f3c8944a1b9d2e2bc7aa0401cbc16aa84612e5608bee6c434e537abd8283d4f3de04421dd07c0ef5e910a267038c571fb0a8d52b679d67754730e254aab1d8286fac0700172d3fa50b121a05abaf05ebb98e042bab4f7c2faf5f202437bff34bf4cf1b23ae72a23d164f28425aab2247f80210d75fed84213329838d601d047ae02f325cc743b246ef38ca2b8211f87dd8991cb44f589fcdae6c72a8e13c76358c1c31c09252c02ab81eb8be86d6911b714945795173af55f5ae7ce9199e99145e625fdfdb42bc73d8c67cc7a616d0fc8948200cc6509e4d500fc7aa75625a62f7b94c24d9663cde18fdb65ee6bdf31551e8d4271daf806ebe7d5338fea68a9dfe8821d1812678b029c376c9053bb53619f7c0d9901c7d5cbc7e96d733b9d11a892a6330b68795dc769de37a1a25399964ab0667231c61f3b91c5125909d8a3988ecfed17d9a2445ff7feec2d84da620382d73d713edf4421fa7ad5b5568ab1b242d7eec3f701f1c6e79888304b4f91fc612e1912d191118c3631d4b4e5668b0d54de30f890a4baa36147b37fe726c5c2e189eb33c26a27fa620ade19db8e7fd53aba382cd57ff6ad1681aab1295cf4ea5fc9d30223f3b130d687cbbe9fcd9fb2cecddd14e311a3244db7b0b51055d4c4d26eedf26"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 463; - dataLen = 4096; - combinedKey = "d3cc33816b25f4c16290bb6d7732b0f10a772e21aa52f3fbf98dcda4c79a80a9"; - iv = "26530bb2acf82d4abd726e07695839d6"; - cipherText = "4f283c05388226766b5abae0d41003131112774fa458b64e058fb548de5f0db9b6dd6f0e3f895887f6bfffe38439e11f94af25f1ef59c83f7fbc8ad29f19a450a52561eab60bce3d334490e87e662c17984526ca5a7ddd86deb9006d19fd2052cc66fbcc0ee3860ab5d6c2021026c9c7e7b5b0f572f0196d8b82ae30ae95a07eb63eed9ae11ccb7b8f4b40876f5decc618e2ce0057992812d3e4328d13b9e3e40ebf37f1ae64010bfdc028d69a1edb3927bd83da53b1a3f7b7717edd83b8bff3c7d7152733ebea892dc5d9dfa93686ec6a85f4110baa4821026893fc185040da5e39b3ee8e5a311b7510cde002713796b2ec50566958276f01da14cd4c82f72aea71172660c2debdd25767f23404e310861e93dd8b573f2f82be7676d31d498aca00516b353be2547f0947f09f499372ceff314bba5b90188997c404289c296bec9214a216e885886a9008d0c73aafdfbabf26afc6977b11fb3e2368ca3090b28d65c69fb42ea8a75d30322d5b9553bd3ece288e7179b9c4586d436fa45e24c1ac33543d28ddc387ed1625360a69a41820c085c37a6c6c579a04d171b81deaaaa1359fd16e5e80c8d2d557ccaf99e9d7c703b126323b81f7aba9110bec0ee2c65a67a0a5f3a24eee9396c40849a0b241456f72b114509570ae1865e4635ec557ba6449b9a1d2e02789dff36e59ecdf2e390ee8711b2a022a71b7fb3160268ee0"; - plainText = "ffd222eed6da99c36333d7ea3807fa7946d998f9f765a2ad1450619072a50d8f4762cd0750f9ff9e5463999a70c04d97a3b42a6cf050a941c985dc10e2eb150e319404ca334ade7e12df60cf20d9e0ce473d18d6af80f8c55b87781bd0ed5026ce936bc299f7b9ede0d7b113bd53a1dc3e533a40b1e8b5f0ed4869c154e0f13d039399d3cda683e440c906839e043fe2597acffdcbdac9cbd000618ceb06dfad80c205d6b7558c94b07de687f54e7910f4b32cf9ebd9f0e06533d343929bc85f5519244b8bb3f42248a5f57e4c4c1e08df8f1e99a011963266c3aff14fed44907fdb95aaa02419f896e8852626b6be935af6850027c78cfa44144c4e972a314182a253f490a9ac0eababd69309c546b079625e8685f9e9b0047a24f863a2f698652b88bd508b13b24a9b4f8896a9ecd46573d6a55b28bf3ef0f03469637e7ebfb47c03e795f3d6e05f3491276c37f2fdd896b80e585b9c97a474b485bdba60378149846410443a957a737bba811fe66db45dd8730d2a5a7c9e00f3bbb9d4412e9ac5ed39ccfaad071826537cd85c0e04b8ecf2ce30d1c3884894f4c4e28700da2ffe5dfb378b7c0449731bd177b273022da0f0012314d13044c066ef6f2988fd2a6b224b2df0144424f8dbb2f637e59aaa2a0cb8e4d2d7f9b7e2456ba5b1e4eb08f3eb991f2bc0295841dd0a9a5a548e554f42293865bc86c9a8967daeadc1f5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 464; - dataLen = 4096; - combinedKey = "9073c760011e2253790d9a2857d59622ea1b6df45f59ff51758232c2855bc059"; - iv = "63585913a74c3f00ad5486af44e8c37b"; - cipherText = "33a99370572577f535193a8ce63a868232806d95df84cad4501b8cbe00e2413335d72208106a780a0e7cafa204b59a284ddbe667eb95f7f62ab458fc65f8e00c05646f48945d7db8bb5fa7404c0aad94ae408268d6d59163f883476edc7d80b864046084680e1906126789b0b8c5835846745f2bf650c56ef9d5cc949e118d8c9fd531cac5f5e1ef9602d4588f0ed170af394996379738b5f87c97f8fcd79d9e49253a423737c1754e12758bd9ca9c1a774c5f823411b42065d433ce7b85987e04e80c0f149102f49cc2b80c8b2ef407af08c7e9f5ce67deef4259fc20a5a4bde284f76b1908ca9ce2cf56e48861fcde1b47706ef02af016ba3f958f2c3730321a9d53bd5d20013a514c884139facb18bfb987fe2749c7480368c03a8a921fdb5f07f0f8efc5ea27d5c6853ee545f84de1183ca8b49da6cbc5a25215b0d99db352d556b670c4230626a0cfd06c36b7606ad9cbc4fbc61114f1160ad1dab612157132784e62bda224167f59f7f000213623cd80f6d594983383563d80730275f425f2e921505f0438fe3e5e4670d8b4d5c81f097fa024029d7a2f7090123432420f503b7fa9091063890b5cff176bffa9fb39eab2a0ec7e721d5cca69e1b8744e2603777a966cf7ab03ae22e7a112afd34ea99d4468904d0f28466b3febf411f84ebb96e68940a6fa6b482999184032bb245d95b0a4baa84338646e8fafda30da"; - plainText = "3bc0160036336ec81982e9bb213441f1a7418d1d68fd36c5cf2ad43ecc491610909c7dc8f9fecf3c624ce68c08c422e57e85347800ce831c8f8b4fe07c2b3cdf5e628a380e440af516d7898c010075c70124cdaf1697fae0c06ff1cb0c34de0dd06183046d1a1b1767e129dc8502df8d48fe17c3a6f8604f3e18312e22deb195846709aa2e8d44c7a6de097d050512c00340e72bd13160c97b350019267090dd6016ce10b86ec548d0db936ba553208f28981577f5c429e48f4e57f4147d6c9b48e2f4455bd340f129277a7c566e94fdbaf42a180567d69fdb47ba65d8ee8f86195a775a62570ccc9abac762aef51c7520421fa40e7597454eaeb0a26506aa7ce5f9a939434fece777d9708e3a952ceca251b9d729e5c6b94daee16b673e1f737f7c72b8e2b2effc0be0a85ffa5490f75300b0702220c0dc9047a5d4f7cdc6fac0241470e0e350dac26ef03d22ff6b594c1e3077a86b232d17437515dcb255cf69b8f7508971a6b057409d324a516f0ae5b0c3a4fe57c0311a167bbc56ce486402b93135a8cd2c0c4bbdea2855447679967a680f8a40223fc0333332fd2f212dda05bed0a2c059a12b18b867ce35e4965dab2009b8c52e4bcac5f2ff676e7c8dda8316847fa3c82767778f68ca11c9ae3baf3656e53228e5e8147e65aab99a50c4f19d7da24ab628ad4754f3a43879cf024ab4531b0284c579d797fd70553010"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 465; - dataLen = 4096; - combinedKey = "e2703781032ccf1fd5b183b4c6ff1f27f36f2849a704cd4f2353ff6cc63bd747"; - iv = "94f6d548b3657d9a356d5c58ff24ef13"; - cipherText = "f25c2a1a3a1fedad9e3c5bb107e6525a6bd75b3562dd4e26daa32d7cb10379776ac5013729d67b101e95fbf9af234ed2ea0ae29c0e0c213ddd3172cb79d4dc62efb8bcc2efe71e1b28abaa7925baa9d8f73a9c36da5266ea72f4fdf3ad0ee19e455ce558d251e535c6da1925e36b2b471aec0e323d49e326c29937de66cddb3f846332d32744efaddbd21ff9994a60f4e16f6a6121b4b2907d40ae4c6c28adadf89ca21da34c9953359ed575ae4ad49ef9f151d00430ff4eb4afecdf884d7b5caaf6dab3950f53ed205b78538bdb261f649d7dec609c22ffb6924ce28631d8961ae70e24f486c5899c8d6c72e248ce6b4f3e30a46462a924f4cd5ddbc769d127e551a077e1a87d63055903ef25f4cc0ce367de8b8aad5b8360e27ecbe09bdfe26dd301363cda94edbb7208f216ff496b5096df306d9ca46ea00e19fd542dab10b5ddd564b8e9d3d6370bc7b416e5e20ac4048872ec66b9ec07b2c8d5845fef1b01c5d5082786000762b0e9124831a329983690cb2edd72011e9694526956f8b3ae74e0e01c9fb5fbe06fc638f3f7489fa4b7d377fcc5fb83b5c29e65f3d6092fbae33ceb974fdd6de0556612c59374ded6e71aa3597d66c6257461db2600d0cf96bbc85f9bc4dae60247d1c3fe976e23089d8ea1977edc04430fa32087de830f71579f87eb358701c530ad13f6825e2e9430a2213ec2a338529f56eeedfbe43f"; - plainText = "dedea2562c903def6d013810770184b235864cabfee80a3adaed1430ede25b018260b676efb66ac0d3b191301c381ba9068a89d34c20804da58098208df9670977242219acc9ec83cd43cea884388a01744592508e5aa2004144c7346cd55ae06c7862a168e3d63a2549a82f38ee221d5465d52753918681d9be409dde6edc8323c9a972e731e0343fca1047d08bb9510f9bb49cae26291b7573f34721a6300957b66ab72ffe58cdbe2b7f8e90bdd49ab3e05dac4386474ba1ea82552e2fcb5f2df8cde4b4ef8390f07285f84772bd7ef5709aac5f0f978c727816ca2ebb4142da8b04b2214703ff444c13b526c8dbfbeca4e679effa1cc28673a69df8f92820d52aefaf33fce5cc6fadf8884d1208888b283276ba5fa546e92083f74583f55028dd0c07d29c8b9c87bf362ad5b02b6831e9e3e7824be1f6941e27c6e0ab06789545ded2b5527b5e911ccb502e5573fff4e8afb42c2c67fa033ab9f52f2f38622e488e3a7778d1e256435dfd29426135ec4ff5341fa2d0b415255f1e43784cdfe5975a8d69aa1a1210d0537a4a6e24e22d2dcf7a4f3ecc146c8c9f35de8473ed5b50803d9c3745571ce0bb5a290dfb00df824761b6c43dc9b4fc33f0cd6b0782ddee1b7a12d05ea5a0508a97c140a4c5a78e0bcd78e8aa2fa332343e8aa14f857184355f15008ce8d6760721eed4a3abad295c755c46ae90b75d6397e7c72efa"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 466; - dataLen = 4096; - combinedKey = "8da6f43fc4e87d417759ad97deb5d6d077ff803aec336b55e72dd4bcf29dffc0"; - iv = "b9488128273d2e51df47208be9819e63"; - cipherText = "d99077cc9c27a08cd1765be2402bcba5db9070af9b3c03272645e03cb0ede839900cb9254156b3a38c5b7df9d00dea6fa84955558a37da7132290444c9e21bcb4b426ef8cb16a8ec66737c2e163a4ced216792c7e839c1c9a9633af581f0c8e365176c699edb884d86df30f47c34218c3eae72790daaf16a7487fb149a617f267247686eee2b40259ff1b3c875fd14d98da9cad727de76973ab2160874ba94789a09c5dc09f7e58e922650bd160644590daeea4675ff1ef39d52881142b4ec98ea658735439142a1010655c690e68fba61bc4fafa72897b01353c56f47dfa506051d5091277115d029385d16559a879b90ffcc3c3e7af8def62ffc09eeee712229a82fc13529822adf60d581e0169d3e84519965c18098caa3e3fa1b88709354eb0c41bc7fe55cf611809fd9902b640a2c231d436222b884086aaa095829a1bc892d0e4c3d9cb5b331b9974b0aabe75ef2c433ff2170e9674217b6fe880676ac668fed1d15c32b5f306d948cd3b1df6a8506992219413cb2fad373027a0bda80a30a2a5a0112100205d97c83f8c35f3ee640f39fcb94b5866c2d03284acd6149f9e18fa688df32a85162d71cac4a0df11b37547e9d60706c46fd7c7f4e4bc3572ce349b345fa1a481737042acee44d21c730159275aa5e41ecac8339d55a7348734f23c0ca5247c2618476ad460848127febc5af28268e6b452588c3d7eaeb62"; - plainText = "b10bde517763496a812aaa6547f33dff8e1ea7fe4b70e207ffd2d72131c45a2000ed52b84fc4ce7db20f8ee2a2a1cdae394a5754121d201637b60db0a21c5638a8721723ff1c9cd404031c96ccc41e4755615bd958732c849373fc247e26dd6b519b83c644aa0c070d56771f93887538c16a0badef448a5fbfdc384edf3d99cc59d210ba412aaafa110810c4fe29a720946b483fb7903e98a8a68b9b1c020fbfc6a4cf8f439f47cd240d3af56d3c6b8a81aa9ed73d144a784bc7241b17c250f3e1aa72f98bd03ac381857c3a7ba5a48180c4b1792660153f8f017a69f1f1b37909fbef843e91d348cdf7e0ad0400f883e5261c79c94caa934c513e8cdc72070409e4b869f0403fca35c21358f0b127177690c97cfb3210a4e53ff61ed531de56669f401667d020f56ea5db9192c945c97e26c2542ecc999bef63635fcd788e7aa6f27f1e6ce5698cb28af097aa70d74deaefe90ed9834dfbcc48ce5671e7cdb7dedc44c87a0c81f4b696f3cd67c81919e062cd204261b1905607afae5e6fcc7e4af26e56e7c7601822721828ad1c6676ad93eac392c781e52dd8b613eb6783a794a81595cecb9600d193d3a3cb35885a8c00e729613e0911c47034d79d2a4cbf7341bbc13dd0f991de5412d92129a1da7cdbec618640968e47a31063aa99d3ae12ed6bd473284755215187afa83f2c8d2bb6d323143ce6fc008aec231771d7d7"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 467; - dataLen = 4096; - combinedKey = "4c25aa88665574774f45e96de8bec4be18bd38fbd2e608ee9ec9f19b3f0cfae5"; - iv = "01b48c45866b1c18a325ad39260c627a"; - cipherText = "abaf75f6bc82a9543d26ebe41d94483a37b6d79ba692f98bceb5068ba43961c59775047a7395b030a0afc8c9103ddd310d48888b54ff6be65e498aa1aceb1ace2b2b25faae232780944f93491c2c98ab28c8ef056a8f020e585aff0a5759f56cf5ee5565ded31ebea90914d6fcd45c6185b4d31b8dc5e81b9175b3f77fa33ee58bf75393634f743e1a84d84cb7ed3c2877beeab0ec2302ba735ab3a0ab4e704d1251a5e43dc933761a7795d426cc0524c8030f3af2ab7b34d177fd1a30236b8cebf23ea9010520219bb64b5f714cfb3e6b148ff3d8288f8ae422f82a1a5688fa89a4dcfcb21a4eb7c884163593bd3c8dfadc7571a465ea86ab39552368f84b2806352030ca4971a9ba4a7f85a0e0a7793b3c950111ee811c9184d5a423c41cbcc205a96e70fb394fe6bd0ad9e94145fbac8a5e52d63aa8193d70268928b7d761eba7fbff1e6a1038ab45bf7c7a0eedbf17cbc7eac7cdc6c329880bf4e0b950e217e5868d96146cac1f2082945ee54dbdee5fe539abc4e730383f530fb0bd12515a22abc0fb3a7928ccee73cfe6756c84f9b9026e7c487be16c60f8d1aa64b2b5512b41335b734e99fc464b6258f7434147a4b6568f25ce86008f338884d494448995ce642404cf208deb4a415672f382da6613aa17af47e80c525cf97a8df4d3419cee2cb318d40b460a8d813d9b2137406558e221887bcb5e50ebb697d724b3"; - plainText = "57ac8a133188352a3b05c35d5d7d1f31a210fc7cbb83bbc67cfbb483e126fc964d67f28697f42f7499f7ba51264661216ec65685bc89d8a1deb23086e49c141c2592c8382b7e3f3bf46395243dbf85a7edb606fcdb3a7cfbcbf3646a4b3d27bf97c30ed3b85a2efb1cc052f95e4f5e00ecf19d7f120f7c4bc8b1b51b1391525110f066a96c5460ca219848a1d33e265a88fb770580fc93cfbb6c9aa409b48df91833add3b7b230793d69e5010af876d52d9bc1b2f935fb62d49234236c66d2a3e059d6a84919d49a68599863f863d6476c0ecf6ba0fba1e5c750a91bfd1b6179da48410a34cdccc5d98d4637dd38691a85c1c7194874abaf462c8461cc2836983eec7621d57fc1f79f6cff0507769ca94e30f32c91c78156365c1de2cfa6cedf60f4939b936b855679f9fbebe2536d54d9c5d36b98bb95d59bcc3b20e38095b94188981005b0e3c7b0854dda150936cf3e846881675e0f83ee42ceef6ec2411094480c1344c1fcd70ce22b47c38408c5140f487a2655ee259614be6f7c41b975bceba9f12c2e3331ade61eb410a3bd2dc29059421d2a979a9055286808b44d5fe5d06cb247ae7f1f59336dd2594bb6c98425d6b47faa72d20f734733bc83c25c6f5c3d6eb02a4293ba05072256c40368ac1b3a6b329c66c976d03c787e0ca23fb2713c0702696900b9e8756c5e9db70d6193ce1e367d841c41ac9d8baa8f235a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 468; - dataLen = 4096; - combinedKey = "8bc05e8cfaee9777af2afc5f22a7477311c9e57d8cd0659b8cf5631ac58e77b1"; - iv = "a62e692479ae168d3dbc002243fc9640"; - cipherText = "0609ed4c86a6868025e444a69e525643004d5e7c92e4fe37b9251c477d2347d4c2572c53aee0efff43a389d87c7b09201e9b995560f2c72e4e1a169a683ed9d28d356de237779d5c146249ea4672534a439eecd8c02b5442b8a6ef0f32aea0d610cd2f60cd58359fb82a819fdd198567f33aa3f31694b7ea05a89d1bb53c0c5c270ec126d4de3918ea6cd17c18072f512f28c7db1e1c8e575bba9c6b95bd92f9806e1f643c15518379e833b7a8d068b823fc7226c5f325831bf60046f122c76c0eb60491c97fb659fb116f54339f970fca9bcc0286ae513fa3b7c1ab5b08a315bde494a8d899e8adce07124e8bbb6dfed09230b0d44a67bd2f426236dff06252df7a7fff4b50b00568f4dece481c711cee075ea75ea9ac9dcff554c11759135c96e6876f86574f6b7b8a51af3ffd3904c0aadbb19cba1c66d9711fff3c9e6844a1955210e52f605d8b248080fe751d96a7ea0db385fcf9e00bac1b9843a1a3e906c382ec10bfb47762030cfffe316c498a829f2cb3f2cf6c18892348a500a298aee6de37129c732d8b37233b1c2f1d5c79cb5d7ae59d2bb5c8acca6c0f5dcc9ca98b829bb1f8d6de698c7ba817ab5fda9a2891859d964c55aa3e659455f6fbb6bf869194ccdd5982f58903373010b34232e2e2aa3c0f626d3572804b14f67c453e8a152a443fcb29f618c81c3d02b685abf6fa3bff9f6eedb8be7fc9251ba471"; - plainText = "390c6ae6e4efdea354ecc9cfca6f7c9f158fe5b2419489c5ac614320a2756fe80138ea50cd68c924e58f5c55bfd9bee297601fffb2c0af2bfcceb7d1f45a2b5ab3bb771f896a7b44754a558cfc4711d1478b82b9cbd9e154aa71bc6bf50e6c7275426ba69bfca27f87f6eef1d75df689127eec5184b69ad641dcf4c919e757476f394650c6aa25c0bebb7369afb9853c7b943b2850684fb661ac50f16c13fc9ff0a69db7c7cccdc8649116f53ad616b512a479cd5d33f22ca64f7d86f4dd0ec24ca58fa4f1cc25ec458d4f41d9afc11f8b337409152458875522a6fcd7002b41a89fbf01e5b509bc9285715704adb0e67e2806a2fd8e681aae5166210d4df8cb4a3507e2088723fdb0168fb25984cca995bb7124cf9f10fbaa120dc2c3d519f458d98bb09bb8b9a97c90b25adba858e44656f96c50197c5c3ad7da431fcd8f436e19717dcdbb1c333b51906c2df1af64ce4fbec654898d5729b1c43c485f1b5e595971782e23992dd94cb3ff81863e6bcc07e2e6a753208616000580d567e3df0fcc9695a78a12f70719702ac75fd9f87c9ba2aae213a4e817397c0ce434b99de9c621e1158a772dbb5d339a33bc5362e592f9d7624612c545a369c65d776621d6707b96b5660d578f83dee71769017a956a611f62cefcf71be719afb475cf77a3fd8596fe71105c07ef52f72e040cbef8d570ed100bec5a4153cfd9c8c1e8dc"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 469; - dataLen = 4096; - combinedKey = "77ef63d532c72ef5c37c27395edc16db0f079f19ab22174b1f6557dd91b5519a"; - iv = "8b620a90592fb5df64d0a0fb1822df8a"; - cipherText = "2a2d56ce673ebadc771dbc6f24ce900828e805f2fe79f4a0d1670f36c4e4b1487d2bb4c2489a584a9fbbbaf9d0f9ae29c135fe0949e9295197b509ffb66b065308aa5e3da86c7100eb82fc9851076eaf540134d971a21dce083ce315eebf54bef74e29add98bbffa24366c74cc2997fb1e9d090983114ccac7532b7b8124c5529a0bf1114d29de055f7ad9fd34a107f9c9bad8dced3e28e2adb09326b38f823577a912e1f52ec5455fd8b13d22c1589f3bc749d9d9bd276eb3d6557e0b3f3168a8271ddb9a7c368fc240a1c8c4f78de6fb9fd298ca72f4a881c7e9c8b2f54cab8da1d89058d532316c3312cb13664f925dd7cffae44b98f8ad1e445c2d72027a009de59204873e100871e79015475d5a0b3af9f05b61c29d9376234534d8a73aaca989aa7eb445575ee101b214036c00a0bb728be0018b4d1b8f4bb399e5c08340ca24e66809281fd9a4537f08551c0aa3eabcdd6cf745ef83a40f1e7a0a554218bb72c3955f158efe39a98f91a480e3771483e6acd07a6e1e954db3221db6f61e3214c7c7fe90916f9b9312c334ca12105669687704e7bab5554bf1d568e6f8b94625815627abd37812db2bc75cfdd4db8b9e50e8d22050b98c9d95aa0f774b716505194defd943c5b24369c6d630a97d542d87e4fcace85cf5ee7811d3cbf0b666d440389afc8a57ffbf60948b04602007edc14c54a67f97682a6b562c56e8"; - plainText = "a5e3d862cbb020c59c6af3a9d241bbfefdcae413c1e93d7226a169fcfb96bf6cc7c45d4052e1c9af8f8c81e90ec888e52e49be74a09290e6a25ff11c2296021b21d88c814285cf7babc49b441728c7d0fbb68f464887754695e4e70b2557052cb69934cd55c36a7720642bb9084b232ef46ad807b8d8a1e739177fa3e312350694651451fa9e83b29591c356c22d4c81360d032f136052eb7a3cf0d5e7c1330eeca70fddc24dc1a5c821d22e020983a1705b4e4744aa4511445926463643716d804fd3a9d93cfc298415c5de492ab6a8af875a5d65b032180b68814505e727c1bf5f17f00dae4531a522f52e600cd3ee57811640f0664423a2742a828607ef5595206d043f8582b1ca1f5d587083462c9358f5ab79cef28023cf7af2450f47f204ad051f43acd8cc1012b1bf67961c230eecf3d0e41bcc938bec175d35854e832faf280d2d56179256d2c3e5d51e024b7b1770b1d12591d442cf7f5c0cedbe9204e56ba660c71ad184697cc64f4c5667fdb2a4f4f8a528825c9f88e5327d642ea81e27690576af36adeee9e5c293efbb30d66055aa3b8ace5b8ff1ce3418ccd36f3529d43ea640692e20f09db8bb4b04436afb0a4e5e21b26ddcd283799a3be03ba768c37989ff5b0547a5b17209d78ef00458d029ebb9a3b5a0935a609336bc2b29a8ad6740ed6a1d40580fc4ee948eed7ab5903a97426670b76be4d352b393"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 470; - dataLen = 4096; - combinedKey = "fbcf5a4cf65c4c0f8167f5a5711a34b112bc489602f31e2cfa86981da9ff3524"; - iv = "06aafaaa6b1a4f3bd61eaa9b890a623a"; - cipherText = "13721b993bd7b9812ccb1f931de39ee18fe00934b155c58f45ded64b905a0a39a4b7735ec23efca4a88b3bd2ec33b9f63f93e30d4031cff0654f844ec4e865c191c499a2e10baf2f6032d97c971d77cca07d39a06c23ca1cda83272b0431b3d87d4a67514912853b9d757dcfe6ce8e8a3637c305abb271288c038ec14ad1b0207a8cc0c1f855643cc85c330a382e0f5167cbf934b49349761624b2938ba8f106d9bdfd762402e3e3e6c8108f6f0ce21404a8a80f3bc79c3cff83ad81c8a8ff4adcaed8f6b2eb2242e5289796720cb00004644e01442bb901ef7bc328a24a3615bd162c2b3bb745d2b2079b9631360ea31cda413b721fadf83d43e0cbf9c04e36233e16cae37800e05c11669d90c50a6c27d1050abb04bd5b927ff77043bf7b281222ff412b9022c231b5504d1a992901940413bf770d08e43e7600f2655d6131c46d81a990de79d59d6989ee808dacf93a32b0fce5340e732dbd0390d1138c9e850e04bd00ca1ced95c6f88ab78dbc860824f27a74851c55218004d3db5da20eeb386a072f327c25cdd5d1e6d5d91b82ef2f18c71f6322627a1b5b50182cf7ad2eeb525b4c77ebd09bfc630e4897fa76c5357168e49ea75bffeb285c473cddb6ac6dfc90b9f13d5301c4a43b06f7fe74f560aad802226fb928685973568709edc291bf4b879cf25628c2b900d4b25802e8fd1c80694cf551817d4017ff7157f4"; - plainText = "82a075bef2289cfb13cf6c05a27c7c56d1e5e845f009f845a06417852dc67bf380bacc56453898a23725328ea6823f917b70edaf05eb2de7a022997f311d33bc1ffa148e31adbb725dfe5bd7af37fd318eb2b4674dd508e113ec29f5f8d54716b12558c55e0057e683b4b6135ca257e18b9a962437b0621e8be8d392887a3db5fdac353fcd220603a2055af5160d64591f665919a28b2380cecb226eb1881b28932803f0a065e7d47e2c2188e5123fcf9a58627d799c14cacf1d98f3a51ad15beabbf9433cddcaa1665bc375637a134d01ef90470c09dd6658990e69e6ca2c673f11c7312e83b880457383f3dc379c73838b09b3992fe438a15e0923f4742c42795efd6077b730618109ce0f8fdfcc43db90d3385bed20ea95f2da95b7bf59ee170bceacbc86fcc20d808e120bca8a6d06d805ae19126ee07a88165432f90aa48d4bcd63c429aed0d740756089bd5bd84cb4d6781fc9d358b7f28ea06135690203846a4a1fe252e282c3ff047ac71ebfa9d3928e6e08642940c394770965bea09e53274f528cddffd9dd73c123e833811debec681d7cfca64c6fb1461e31f99c546d333cf4efe6d7faa810bc1e97e5221742df108c171d110e5b83132b32636527cc3a734c806b61dd8b48ad9d8bec63f8931abe6717b5fb5ae76497c776757963494ed20bf5c6d1a2dcba46abd1517848ed8fb75c2431105c958116efd49e9f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 471; - dataLen = 4096; - combinedKey = "9450dec98808f1b1bb8ea4bc6a612f11bf35ea6932953882a89d1ac5acd9b5fd"; - iv = "b7211a355aab6768d16a5824ca11de29"; - cipherText = "3ab65fe5bce36f019e52a03f97e10ca7ab7a5d564922079a059ba2f26617d9ffb8e623f5b81af1f0f7423f7503f18be441a6df5c7ecf2f76f8210d8c78502becca419af7000f15f2264e85a4034904b5e03dc63e6fddaa72b2cfd1a7bc98b2b3d7da7b4ad01dfbc37b700c4414b934b3b28bc3df0f5ea4bf3e8d085fe143a79486c2b341ddc2958fd4690df3f6c661f7dcbb715db8483e3280ead3d461dc68ac20dd2702a01cb478421db838722437b39427d4474aa4184d005fb0c258eba5493347fc6a957c7709e4fbdcfdf28dcc4974d32497814f45964cecd6d11a445eb8ccab852685af6c255bb5103f8ed43af98ba89bc77b1851732b6a749b9a21a40e2f43c05af0a0c7fa9cdfce52d82ebadffe4642ac8e1a946ae56d063539897a07032d1b5254afef6718f8081e6c2fc44131a2f5f7a266e2651deb75a99bafdfa85e2104ff5b1748661ae2f49a317955e1b2b9b3b9556c80a0392d7e7ed2270314e3bc630df923764bb25863cfa35d0222c0f953fbfe3c13849d2452bc8a5f1ac70b0092232e1db6325a6427d2b3456da058dc56758dbfb563d6416decba18c5e16a6aa33e445644b756fce502dc280da3879e145f4916a9119f308f7f5676589a6679f8690e91952670fd0ea68de527d5950230d6b583605c8c4eec7356167d8e7820f9ab174e6a9e50b777d10b1fe95a00ec5f915121d811ccec64b500e6b659"; - plainText = "1507fde6ebae2803194c17208ad0f8c0ef7cb035aa714a6873df5efdeffaf799488d7fc0b400de46429ac967f71cdb0dc96896c1274927c3773196d74cf5adb4276292b1bf22ffaf963c8c89acaecdfd36a79d8def6baf9e52990280d0815f705bb349f1f0df439f255e9a3747048836ee458117f3efd61ff691de180e5c1eeefe32e6a74906f8214f61e62b8b365c60113843829f57502e5d9d4bb58f1bc5a38398080aa281161de48601e9bc09ad146e7a78c6638ae9552fefb16ec4d12454c9ced56689ace6e43a6c0b43abf31c1dce332182c923436ee6b0c035fba2cacf7d5c0e37af35bac87ba549e6b81712782cb709be1364e0f82f643134319547b4205501e3467726e002d7de9be9dc05a54ce2e2936b121772cb7ed51c083f30819a5f7c59c15f88cea1ff5b34a06a704c83716e8fbc0b92cdd42805d62a720cfdafb2e6815a1ff7bc17ba1d55e72c0bbd3cc745746f1c225ea721321adee3fcfc2bad6cd8a46fc8ea30f79ee001975c29ddc1e92c6cdf75d5bd8f2b3ab230eebbb53a78e20731dbbd8de03ebd1606633a5ca9b2edaccc7c50e2380891a57de87d9732ff4068526cf60ae372251bfd5bccd6807e32c6b6cb2df15c5cf94a2a503848ee509d865769470f050973716c7d65a9c771550b9347fa909444d7eb0aa6dd7126a1e3c3d2f1b65c64a0985910c1d83dc13c7e52985df9012cfdab3e6c573c"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 472; - dataLen = 4096; - combinedKey = "8b125b26d59f1d53d1bfa87d603ba3c282a0f369f148d2078d6716699b7b1bbd"; - iv = "7adb0546de1b558bcbd886c8ddcc1b10"; - cipherText = "a12736f19531f5b80801484f1f781d742c5f09d515f8473de84264670bdbf80fbc13209e44f7aa72cadaae41262a9f13b10b03f4db0639c0065d35152087f2494e3ca9fcdcfa0252f489ba17293f29fc495db9a3fe745217660a136cce17dcfceb542d1b4356a3728a383aec8d7536735b6102f84890979785da0d8d7ae1044f94a0fbb441bbf55faa424a40ef2613aaab233a5d5f7167073da9b92c5cdce2e0ee5834d483ffe8b32010f0feda154aad49c3cbfa8d214271196482f1a7be995dd2647e2926401cc2d7ec9740d026602cee595ed51c81dd91f8067daa1cba350b82430376f13fa1857b016565d1f788f2636c2bd7d6fcc685b2ffdbe16510b9a072cb5b48c7abdb87f7337d97f4f6849c16a72a28044a596bf2ea934483a40c1d7ecc3820f7a98af34f633b1c65e88f515bf7ecf6183117a19e5049ae1c8e25b82989e816f38b0b5c2288b87c0d97e36aef16f425b257105f641b45f670b8cb8ea6cd5f2b5301be7ccf4aba50f55534126360c9d2fec5b62346f94951e4168cf3816f87819d5826fba91a0bb6f8ff0b9e2165ba31b11451fd1bc04689c339de1c75e26b35fe3de2388ae2b80c603bde516eba9166f5b32bf989e22e7bc72a34410890ae2fd9caadcad5fd7c02a25f7821f4fc672efc5c27070991302ef67188ca624abdcea1767521ea3ba65ff2081b065977132974caa9bfb17d71ee1805b3e2"; - plainText = "7ba9a79ad3e44f063b981fbd4ab925d7a4acab8454a0435a4e9c19480a0aed9fb5bc3919269b51256a836d9b7578ad15b7b67331f969c0e87c2b7c4df6fc8521a7116408a329d9aa51a52ce1faf94939081d971f69c79e60cfc1fe9c34bf1838dcbd27886a0390861eefea77b318463b90ac780ba1cda29cdcb2a3ef5dcb56b6332998df96edf3c79a2259469a4c922adb6f2c3b0ea143981424de120e747a33a7f1a147bd5d594bcf373859b28fcff42a45c61d9a3030127813cef8f1be3a16137259af771af9d2694f47a4cbe2691911bf615fc1671687b4b5eba18e5dd140cf8ce900a4640e908528e8d4a2c80509214afb0262de6dc9691cba9003628403fecdf0f6d12f6d81b6ac536b97e7482c5b9f1344823593cd5cb0d8cc97802ef3ede80601742eb92a639931d59a1bb4539434186e3ac221b7bb5d18fd9a89e2d8aba555b271b6373f584990850d7ceca29f99553b96143c46a5e80ed5af09d33c36387f02f87276e6e904de69c9144ac21f4ea65327b8ef30f81df053411f6de1611fa6e8db4215673937943ff5cf3fb107c9461a4d619f4d0c7eb79caab46cb4c0a147a1bdcca521a8365beb17af495c7ca00d7272406e473a3bcd839b13c77bc2d422c1353a60ab7554b82c4f029d152bc76ecfc874f19d064391ff77bc6d61d6fdb4751125c416bb1dc65bc1acc36064a5e791108256d76335efea48bd2cdd"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 473; - dataLen = 4096; - combinedKey = "45a3877fc117179cec5e3a11d3ac2764a2b1db2d3cb95ec8460cdfb77c53db11"; - iv = "f6b716337a9710b5221a461418d5a145"; - cipherText = "d00d7234ba80530b08472cb172f47eecb5e93e2b1428b059f7cd5b58eb4d96ddc06f7f829f0b2a9ceb2c5fb526d149b44917e302da311ea3232af7178deb678ad29753fb9ca066fb0544dfee37ab144e517a2045a993618e157b456d6b7923373da4faf10a437c541ff224d038197f341bde7821d022f5716d5668090c60b8a4ddc557afe3dbed8361b7c09069edf1e3ef4ac7cd3f5dfaa0c591f4a37388937d047e7f9d0862b2fadd402f7d684baac3e079c47579ba228ccae520f00077fb20e59d27f981c6c570276085d8952502631567f36ead0636ac4e241ea8588ea24ee54d46fec5399e834eab0363dbb31ce558870ad6e074a187a09e68a33c2b6891fdabc5305327e10edaa94de686fb9244fefc790d80fce2bf0eec4dc56f8b3394259ffaacc86bcbda8a4d3860dabf73d5e238f7ef2b2b5c994136db5197f24c318a3a4528307c45571e05506d56add9b109ae6acffa270e46c857e406470515df2127917bc5382a05e66aa4114e60879806c296a50addb26b06d1a35c10603d42a6e688a4639acfcf6c970e4dfd73aa24de08519c2c090d23db4f93023adce3df5c0539f84111c47821038191fd31e4a880dfb83da709b16fe1a07e0ddaa19944caf940dd609bf605426722260315a6c130b7ba254d3bc8b442ab7cf21a4419e124862f4eef0d7f8a6b2f2f3c004f48dda44ff9b5b081db00244db04b8ca9a16a"; - plainText = "9f7e8dcadea6e35728d2dba284edd35b505eeb61ed855f471cb464a5b0eb33b4e85d20043125ad535f698d72ba35b58265f099635fc4e0618f663ed28d7fe15d14a9a00894a26d972b81050aaf7f9f37074695bff003445af29a86a7426c3f1e4b6ed12601e9d151da6900be0f9c2d67cc88e99be065f449d588f13e5ec0feadad5cf0ee8b74c715850fb06e0d87b7897167b93d355812a6f61a743b336a9c8f2d7902b6f6a26e502cd21796700291c0216dc3771d69009dd6b76557a0b596fca8dceb0a7fe1c1e693b60b7a7aaff13a1fedf7846cda87031c2f245c07a528ea8223c1a1b67b1cdcf7f7664873769f5a18827a3688adf809595d637bcd8461e643ef2d76d4d83b18bbfa626ab795bedcb8c2bd1f2d75901928c105bd0c2ec6e7697cb034b2bc9869257857c7b5aa7ea31f9cdac3d4302776a69853fb9cba3e74471ebb2e208357ce634b0055d2eba3ffb4a9f38ef705b0063bf473a7ca787a1590dd06ac092eaab253683245fb88d58a2b40774a814eefa249179db97300b178a2b9a364804702e4d7599d38aa1735e8cb629e1d38a59b8087e9b19a70e70afc846f866670842f3de8c29f8b4ca8c5e8b28b308e0e1cc29137539278031d2d3927e0d529e4e22f100a260f23e2493dc874ee2c40d21a533c68f756f063aa46c0534cc136cbf2527bc278665bca3217cda1b39b20a151e5e70ba89abf404e5130"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 474; - dataLen = 4096; - combinedKey = "13d9e9a1180a2cb6df0f4a8fe8dccb636070acef9472a95e0198039afa995ad4"; - iv = "b3e841cb9a9c49e097bb0d83eb92692c"; - cipherText = "38e3997c3fc04230f55c195cddeda3c261169b7843d199fc503d3354c5acfc7ec39fe2b262fdc3dabc52b87c58bc62cae495973c555dd26b76000bccdde3a58812d334bbef102bb7bffb4d7d2221f835af4a76001727af021fdceebe02975f9eeb7ab8410546ef0db0eb19daef66e5199499b0e1f3173bf590926ec8223669b028839662ac12877211511a356539188fa433677ac646da87dd43aab3398143b19af66b5a6142796be4af96aaa4c04357aee8870a43377ffa0cf7142fa6dfff17912594b43dced7e487994012c6ee1b1816c54c7f3a2e05c5bf799c59724161d05a86ca7f1525407fc5216ebc26a7c2e3303c13f45e7369726cc62298dc773abc51eb8ffb4f42a2a8f3beb21eacdf8b2b00ee583587b6ef53563ebc382250c0c7a62921c150af3282cd842ee224580473e8a1b5d9e2b152556a34498f5411cd24caf5b3d9a2270f4b41ca257e19f813bfd08a48a50f56fb5de6d3a36f476af2db7fa5531b69033eaefc9396ed13d0c9b731258c81a93943a6636f9315f871446bc18a17aa5accc74e7f949cf3d85326c386335836367e5c4ad074f740970754639dfac3d9272501f48bda62147d45b548f001c06726037588e73aacf3d983374c0e8a75acc31a3ee5173500e8e63ac6ffc2d5b88c53b73192e2736e034961d7fe48bde59e9de8bb66fd95dabff0945202ee2924c7edceba64376ad5996cd5a58b"; - plainText = "682a58a5f5409142424f3defda73834d8b57cd15a60703eaa732f457cdbc17cff42bc50251db5f08511a7d9596e17a1fbda0204c723615dfbff2256f6961995e45e5361113c007c4252afe76226db68c7e8240164074c578966a81c92fcef1390cd5dbc181c33fa6368575c852cbb45274a3d6a2f302ee694cd95eddbe9ac7523c8abe641c5ca1633d159341f3af567ff9b378c63339e7a7eb547887b1c5a24e53d5f13fdc4bd504da059ce321bb65b5d223a91f04684c6bf28e2ff9140b915c92844efd9515515e610867db06262d7060d82663415c5974c3fa30aa9d064e7a1c85ba1c89ab44fd0c35f16efa331e0b416d24a35d1b8e156b1ea1c687bb214db908f698454470dacd07b1d5059b514e1cb84e617405a7892db164046e557130de3a8dc630f86a4cb0b847b528f4263f9fde3e7e3979ec990ea609097ffe587be79882ebcf8d55c2343242a10097f8c77de0a2ffa5d22ac710c3fd8c381fa409a8e478602b369a43d95caf11371091108a12f5175d297dede3f88003cbd3763665221849f55da907db43ff06c1d13159be4503b1fea111531897103b593864fc92a789582ae4f918f85356801eeb813e5f3567775bba4ee2763a32f7bc9c09ddbd98557dd40234438ac09e66060ba49fd0559cfd7542769ff928aa6f585b11d4afbe599aa0ae58cc06ddf32aae4aebe27c830a28d2f18c28ea14bb55b1a88657"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 475; - dataLen = 4096; - combinedKey = "40a384e06fbaea08b54c264fd7e5fadf64ef615dc4ddb4affa67d65c17c586bd"; - iv = "f1ac80934bcf35f8ca7e5a21d1a4e7e8"; - cipherText = "c56c0a66c9c2bd986fa1801626aefeedcdb9091920576c54dcb5749946a1108232491f860246831b7f09a886c18a536d3307d753f8926eb3520c7d37becce6e965ddc708f86024bd63e366417a04e78f295c45d838b4561de0eea7c1c1c568352a81fc8d9f8679b1bccb900f161bf39946124e35dfe3b5df0e614c9399e43f39e8e5501d09512830ea1a471a9f726a5df41e32b964d85ed8247b2c3e4bb19ea93cf38f9831959af9912a3459e01c32f0da946a8e79ed881a085876b3accbb9ce4b0eb58be66520d33631b0a9cfd1c75939b1f67dcbe3b53959046d66f425677dbd36a4dcded4a7fbfad8502bcf98cf014fadecfbd75052d61ba3ab19a16e6251440c2a25c81058950cb04aa123b855cd8db0e2c7591036930a0c5763864430b295d257b3287be68e007ed5c465571ab20808432006e35ff714252833f45be99df99dcdc4b7de5266f2193cee88b390b1e9674e93c921448a09c1be511c4c7c391ab1dffeb9bb58360d087be136734f3d7c13396f78486d270e12bba06f5d832f109893e5683703df487b4f9b64f566fcbe8550ffc459fad6051cc9c5ed03c587ac1f27fbf1743b17768d439adba302f25a5e54251e58144000bc3f0a5b44df0fd4b061a2e069a5dc426fc91fef5c5c52d1b9e2c2c741ad4211129fb40284de16b195c60734445cf418bdf0b0b3938e1147df219e0a27e6b4b9049f0361a1eb8f"; - plainText = "491777b00eb3873127f83ba784fde004558e42e39508b9143263a086377ee1efdb5e77216606b70cb67c4d50fdd22e4171853a817290238ec1e1fce71e1dbac9c72f15718042cbd3cb79ae15a660d218cc45669c9879c1846914c81a288c0e2cbe8698c8c6895a0f248cc8b3e0b24c78655a3dbc1cb2aaaa9a96570a7b9a0b229ea306d314506318a7ac89dfc6cf97961cb0ee9358a1bce3b65050234b60982ef6d66e03e9489575e8ce251e38191e130c92236d5b973f71a1ca8fd7633817a1a5da294e766219f601ee39f65788f3b9869a39ba79c88a2e33695fbdb36f77e8e917c0809e4dfca9e36db820434afbef1b6e37a63307f98382d6b9ff17c7fe2f61e5c3b12472e83849689f58d4f00a4615ddaf448bab7fd3f6e7537aefe85356a3a7329e2bec500f34bf8af62d95e70f3550c85f539f56f7efe7961ec11919842f10f6e961b07672baaafb828048c71f812ff125551ba221952ae2eb0c0e04cf32b18d2145e7ff2eb1f4165e248d555bc3b990de4c633f79174ac41b6712d9e856894befc27ce35b286b05325b005bb0e9f4415ebae3837d60590da26efa3137973e21beb2bb460462398d7d4d5bef79afd9623d88478ce3b35955e429ca625893913adf7d545ccaadda7b300f48dbf930bee1680caddd7ecf402de04ba168dafcc93b60e3cf4ead1486b5787262574a18547ef75e9c2356886bfd515930e4a6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 476; - dataLen = 4096; - combinedKey = "ff195c2bae8d8e8637a3e8160b0ce33006b3c0822a2f1b4b149c500159e24790"; - iv = "9c8f141474e6de023f5946e3087b412e"; - cipherText = "f87b2593b1b4fab18b9359bc544f4883b75688e6477cb40e783c284f9110587f476d5e5ef70a74b0e9086a50adac21449833e0e4d11109c8d3e7c123733321a0f01345635ebcdd9cc4bae80c6210fb672842ebd142ee9a066e59446db5d635d4a3d4b455e11a20634ccb13f3b4e729b82fdeb61e366db1fa68c47f93334eac3d0a9393f0b7831f539d8120287ba663883ae0c2fe82d169f19ac55063d9af0d5c9dc22463dca39235b76fc2dad86e66a386a50b35864ad80f9672b431386e703810bfc7b074e827137de82a9267e5166a686d9e20e808bd2654185342c24ea6916db3179906f5b16e5b859eab9a074b193b2f87261c9b5ed4cb88c9082a54f4b7e136276336532a563ae9cf6827359513f7b907de968ccad6459da21f422b88e3d61dc2e70723e9fb340f797727f74a1087e293640fc3c0db636d443d04a331a945a8d6419cc0a133e832d5d0ba60f02e98716b678d83c0fdaba4518922cb0ad5d650b1c776fb846618e62478be2be4f6968d6802426d460a4d7fab19db21ad26eccda09610c8ea0530721a58eb54b6944f9ba3afec3db0caf931199829a31b2d94fae1225829a77fd838691ba60aa2030874374ef56f21376ff27288c07c14e85405c9d3b9d8da97c58c5aa30c0e591509e21ad82d7d294a248e197d68943e4373a2acf92edca8d91b986a6ef2a16c06071f9e81c77f5b2e01e092cccc3dfb54"; - plainText = "0e5c0d5caf23f42965415b87c7a2789c920050919d64ee431b6a833974210774a3e58c12e29e74573978826bcc685168924beffe75a6aaf036f689fbe90b9abb7deed64b8bd1cdf52840b9a905e21e61bb82110e40a72575f71a5013848af9e96827502022e49952cdde1f9e445fdbddf96828890ad60dd8ff1a2fa2b996c6781330ece831c3aed94bea04fdc996d9436d240a05d05a14b6dadbc1f5778308ad59594024c62612f5d3d4df41d8abb38cd64fc880bc17bc05bec06cd8d1485d7103ed226c296b5fe435f869b4c435edc42fde41fc52d8ed84ac147932e0b6c47a938c85ad1b2a4c1d058388b517e5202f19aa76f921b4a4b5853db3ee613f5928f307136a5fc6ac8e0e7d88f19a3beae0d799a800d2fbdc77ea629a4d61dde91e4691a7720afa8111fe8e460e5f5163ecaa9e4f7804a3d3a72604efd5e220433c0d7f13291f697fff155561c94963a138048f208cbd85b4c89a0e59d8e6ca58a8ee34b6cc99c2f806cdd38e1ec1170779302ba3dca81cbc791f5d9aa4b911cde0fe8cfb2acbaaced41579618ee00bdbbc7898b1405614da5eeccbe497485987c10252e818e8985c3dd4978e3a247e327fb4829d4afc50f69682b404313b221df7e76ae23f45e9c0a4ee31001cfe4ff15d62ddfb880cd171a2e57df69453de30d8b5f258b42b57c10d7e442127c99d29e7898ba0bf318dac6f5e2546b561089bb6"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 477; - dataLen = 4096; - combinedKey = "0d5641fdabc0697bbbfbef488ab018445bf92cd20cb933258725e6909c69c6fb"; - iv = "9ebc0f75cbf4971a18f37e69ce8ac5cc"; - cipherText = "21334520d2bd9d333d04925930a0f9b5e2da27de3c9247e622470b32265d09379da5fa3ae83aea8452faad718cdb1bd85e5edca48d211e845d3ebd5adba6bc0e4276baa2c1fa78b59c65ee67b06617c633aa2c8cac8298a2b17b2d708b3f86a80e39c04f6d4ec5664482c58ed0b3ff401f43fb48c7e98a443bbc0482a53980bc32468ff98669f182815d06bc8ed7df2a97b077279f7f6bb10d3e72df016ef05dced7d0f0b11418784b1ae4d835ea1916e58a193d5aabf57a984451bd37c9e6e7ca8fbf6204d93bb9a89275b043aae70bd93c4a74260522ab6d59b395db23b69c0a728db1ee8a174ea43d7bb80abae7a3ed617a5b6ed1cb8b334ff1152889834fcd653908139395012883b8a10137d45c844d6c9f4523ab200cc45518c64098cc99875256f7a03ecb74166ba200a1071e02d2c3ce050a090991542b9a3deea3381db4369c118558dc86c5c526e7720a23cec4d6402df1050cbf6e7e0b4b444b1aff8676fa394d151936c38d8d86a76367b1034c71fd07d12253160d519b38fbc13f2b0bf8b6381ff984bad21c72d27501d02477a81304c2c3f3f0c6fc73f73ec34276fa847604ddaaf7b01655131f95dce4f9bfb4b24e7939828519e55021155809972c9437065118677011e49572e1f1a4402583726e9740963e72fdcf45037024df1582d250f992bb3fa127605a1abded0c34e21a0cebca2302991e11eb872e"; - plainText = "b4243d3d3fb60b62e42f127a3dfd811e5767ab22635cc39ab6d7138112c2c5a9beea5e8637f643b71ef11d8eaf717befd6365ba578495fd13c90075dc23d2bfcfcc3169d1819826a5c2cc3145a0d022347ea4ffd4db77a08dfc4ab8f78e34d33dc1ea02088710130f9677b8eb0f641a62b467069dea3f13034f42c5953cc4c6295c9d782575c0216beb5520f1c01d45bd9ae4896d6e17b080e8d36fa481734911abf7c4437eb6375919e05004b424a4b1c09c095f354e153b4d7556a181e6d599d5c57436bd791ecac85670e56ce9226d083b40b72a075db126468d0dc99d147435d597c83516bab2ef9c8dfead61f739203d5f82381b006ac1a58799bb0632add39aaa9cd2b43f95662480e359d633b995cfeedbae72d5d1b15e88d02c325a7d81dd2b1cebbe9cc286f22d0c7fb4bda00c9c3cff54da1f5732e85253747191664d20392928bdd2606decae4330a11c7cbdd1aeade95b181a9e700692d1262aabcd65e15047bffa58223616a7284c63a983386e5bb1babbb31900cdec39d213dfa7f177cea3b315617f2662c5d8297d78471b6e5960790b0b258888be3a5a48f6a7fadb7da4f8af112d0c09c39a340b2645a3bda9e94227e59905376f257caec812dbcccf6f3a395f857fd85418ede14656a133e5006dd328142a6370d4e060fc935c85e0fee81e911d24bf97b67e2c4b77cebcfae9076fdd0df0359bc3a0649"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 478; - dataLen = 4096; - combinedKey = "c505dadcdfa43719ab4cf5cc162546855fe9dfc269c1a5d2311307f678543ea6"; - iv = "ba2f13f6f342edfcdd4a071f21a3049a"; - cipherText = "23fe4abd9dc89a462c45ad57c17099fcea6959aff59542a969f9a17df45130c3298f33dfc322922c4c96298efe92f7a84b6b97f31c32da47569873518c99db97a67adf4396ec4e1c75ee904d8c4df9ea20371a16c2accd1064ded9472995565998e3e7dfa0cdf4742f35a8adbf02951fb28add16a0dae8149d730483650abe5bdc2f8f91b44356471f5a074cd80e104a4f0044e0fa221c0e53e2758f20432c8349502362b78781235058115ff96db62c3700b13bf3e0c3c6bce94616800312da108640560d03cf03113c090405bcb56b2f27395e517c31aa0932b0b402d4ed280a8d98369f661e69d766318a605bffca611eebbad0e2a02e9d5010fac523c0c78da0fd4aa8e9001d4ea7981b1ae9b3ca86ba87ded1624b4ff43c4ceaafc4d324029dc26416a3967dc135e1ac9eeec4e9c57e9d4230e61491f5f3d57a5285a68908958a9a578705c0b6b5242d41ed1b14883b7a22319054a01f40340ab5d952b74103d09424232940ad4417cbabb26aa5349eabea5797eab86a63ebdd83069c64df473ffbb72b606307fdbff5d4d6716c4124708d19882e0a18ede3bcb0ca6426933051ee00bb3e29b03e0f1ba25b38807b27c17c4d909c4d947d9da19bb3c2be7aae1b05ab1fbc7be824dcea2fa274e625fe016d09960c02082fa80b8cd4d1ea0c9380f08360d34018437cff0de5cc71386d9856884af876ae6dbde0443807b6"; - plainText = "cefb698cf504fba683ab8d128049ce86f82ad47ba0eadc76c7a0c08ffcd070a7048fe2f6361701ab2206cfd9c5cb725a2c1541ad9c5d630fd2e16853bf29587041c8ae634ac5dc3fce12114cad9178e99c07ccd283aab319812ab388bb596956e246a4235ced3f38626f554a5c3bda1dda940a45a4c7e615539f9afc82b5ffc34935d80d0d3b55f4282bd53fec00ecba079a394d711232af31dce09112f374f850db55c0889a74b2c0b74c0a907d6be7747031d960882b0d31767677497a29ff096754baab6c4ed7d7b1c850d0d6d43e1b0ba0ab4496052ce252af20f68698e54c960b99a9139d2e71273f3892d799cb8224520b1624440484eaf30bf1fdb7467fe3e20bda42a8f5cca6671fa67436cb75da43afa256bbdac85f8d8b30b166b324d520b66a1b77b55e76ffccfc66ba69b13f28de5642163c426af5ee0b5e1616d1038c777683749ef81798932dba4cf1313368c1fff642a032172726b58c9fa35ab8d47f09a577ff3702cab13b68fcc23e5eca91dd8222da04c944a63edde3e901c9ca186468f2234a87f22033ef92b66cf5025b27903188c5e5bdfc24c6cc890fe4b1669aa961d6a283a6fc24109be074f4582eea6fcb8b06b55a140097cf72e3765d75343fac5074702f6cea23b5d4f6e24b9ba964581b79a7890ad3261cf81cffcfa49be7bf4ea01e631e8758515c9a27031621e48623500b12c623196717"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 479; - dataLen = 4096; - combinedKey = "a3a579e2abb201b2ccb92102233cc646575d39ee3b21bc76e2649a1528ffd4f2"; - iv = "a86f6ac68a3b1a01020a98e5c5f5ba29"; - cipherText = "6ac15e5d72dac7e52107fe55b89b0ad6edf04722e037e18a9111763198039fceaab035a70d50397c9c3a5867a3a467cedc028182f1a87e89717624bfb598656c47a56f0e3de506fd0f6d9e72a922f5bead036131626a536eaf24dacfc5bece440ce144232edd74a7cbe883afad06959bf63ec8f67fda370d393942a20fbb4cecb5dbb0bc4ba48d225c54f2e26a9d807c827bbb6a5c0de7e1a0d321a274f80ffe527212c170a5c0e083c1d8f08b4fe3908a380d2346ee49a50c7faaa314694028a9eb55f6c52c59ecfe536e3cf0dd2279a374d8036ba3639091f9a50cbbf654114a65b935c43121ae3c90c078f95b64220a655b9e41307de4804b67c335c37335adb402f1621b220353b9cf4776b1089f0a164e7d75fa9b345edf147c1c9a8ef70a0516a7c012be6c1c1acb40d9b8f4c470f95acc11fc3883f3bd756ab07ae6b1587e1dfe2d9647fb25318d53c3b91a412f8989c7035a507c67ff2a5d1c9f1e1a523e77ce6299de2c25549bd75bb542e84e0c16e8356835768e838ea47e936d9570116e30e564d6d2be46b9f144540822a1178c381f46307b7fb138e8f59bffd4e719feaea89e08f49c38a874fa491c908597ee5f34f46695664d877481aa1edbfe50249a5140006d7e225e9ceeff567ddde941ea153c7260ab453946e9c173026bb0e0a1048fc872d122777ec38f8ad582cf0f017f2100c7875c2d551b1e1389"; - plainText = "1f76cb1c13667a504e8501f470a7c2219f10cf6ed8152d938331e58de916c16c0ccd8ee07e4276d3ba2bf07bc48272281113736d548fa8a7f89933b6af3f3610d504b7d893738e79a14780e790fddffdb5e7e2587aacec5660f9b212084130331e6f9c46db1c15917a7103dd13849eb3cb3d2156148f34e0269d277769e0ce184ddb1d6cd125f9125689a75d1335dcdb7aad1a480c6fe4d3b1bf55935ed694c340677fd1f3bf0d2196cf536beac68ddbbccb62023a1c94933957886b2b39d6ac176b425667b91fe3e11624ec8d43d793e16353af5ce186f4b9a0c779779c52a7afa987d79100b01c303d61287533899441740bf1f6ec17fd74110fe12534bcf54d90c3480e24613f42a3b449d7961da5310e27770429d2d1ceefdb5943e9946f78782552e7a61b05f35ae794a651a5646036575c31137874719e281d33853ada20e0c73c61114c8d804655ff89948e75b1fc0e4f6e86c72d2876ebe4c3d358daa39dd12777d4193c0060044460ddf2d945495bb3caa717af5d9691de711e26ee9458b99d8c7789ffd2e882a1f77d465b94fca6bc35b3e0380e99b5ec5b0d342a8ea77713785aea5e87139e4cb2310d65aa6be2e1e09983ea0111efceca80a2808f3e081f6b9a4d0a66440b078a899c507e59ce59b6392cbbbddfa208e4058e8e534884a9fa3f9bb83185eab97d2ea9216c8382294885486f331606463d92853a"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 480; - dataLen = 4096; - combinedKey = "eb8e10c5ffb43564d4b8acc1e74ec7077267cf9ffcbb0e5b4c93e09e049e2758"; - iv = "094fcb920863afc7bb9f1aaa19d49467"; - cipherText = "d2b35d7dc4013955449c7150cab41846c336080cef9dce4f3a9c635f574f1bb1b6fb1b1e537fa1e7681d1a0c57135f125ed644c693b67be7de8826e9616181945629d6dc779fcdcf7afc728dd96061051777aa2e229f0f9f7725f2d53fbff3a6271927af168949aa4a8a6d465e13ceb74fa3602a70005245f293de9010c79652ef5ad1711827d8639d7dfa9ed41f2431c03db91e944fa92d5ab736326916b2d2919e0b90ff9eed5e66fcd9f5bbd693e7217e49ee9e81a7aced86b6e5d9a0d769bd60cc3e4ebb659a3f7025ee6cc57c72873375d9ba2ee54af8dafbc6eb8efaab3b13ff1c487b465e4abbd77039000adbf183b036efb350dd7decb7392e2888578cc17ef4c3223438d5a5a4d2b796f4a64306a41c3bc4e3f667a20a024c1cd3f0d30bed960577442dbaf7e6e4293b89fd78eccb99769796704fd34fb99b1511158cd147035a1125eb93e1020ff2d2557e843c9cdaf8cf928c4cb3844abd90c6101059d7cec71aa4cf75146f09aade9e93eec41a3bddbef304c128438b5f95c02bbd521a451c81bfee414c9120febf0f77c16a465821205fb648926e2924d407da9b3ad69068818616601d712cd77faa50b0f663dc568228999a029f6d4385cb8a027ad8e827693c72dc38822e3690bb1ae57ee1d3c2fa9d991ae0702ebe7730d7da8791528b055b74c7fa5c50916f57908448486fe475dbd05c78146aad0bfc66"; - plainText = "eef51b48fcc2173c8c6da4c91d8ddb12d40237640b54cd8bb552ef214f8aee47d01a734b8a3294cdc7f00143a85402796a61825912d63325ecb0346add1534ec6929aea32cda0c899ff7983c4a1e60634ec1495409494300b4791307192dcb5da71e84c4e6dbf89b0a7b11fe766a329c103140867df746b6f8bc94d62df79e0425d4907913b38e118d6544a2b104273ed283b72a8bfcadf138da315f66f99d63fd94cc8da7152e7f8b935179d85bae655d34de448b0a1b56c7e9610782cf79521c26e5a48becbfdb37e47ce992262121d27b96af14fab84e7a9c3208a430ec41e72b69163d1c5eb7a23fa4f3c86bdaad8d949cd5e852f1168a81b9d3cfeac0b0224de160431da3ab7718be52ffb9a4baac56f51d4ce154626e4669d18b09000e19cbac2348b444e6a633dd32c925c367d9d45eb79b72aaf21c7abb92b9b734c939da610ff6297f449a5680215eade65ab5f5cd7ce36b13c1b417634c6100676539f50ada854a850a0fd51c26712c89bf3ae836cd954252b64ff996efac67c854cbb335ee5a6644877f688c2d67da6df7076af304fead865ea6ebc02360dc29a493bf4f1114b099f32ee6ca243ddfae4e9fd0402ff3ad1719f57f8ddf970a8388e46686b92f4f4a88c8f556f2e52774995abbd2dd7a3f64f91110db8617e8ff4ac03a21b38fcc30d8dd1dd88a34cbb186b572afc16c6c3c62f40193bbfa44cd35"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 481; - dataLen = 4096; - combinedKey = "51f3cbfd0497f914d1c27a0677d12f66844c5b771e341ebb833ceb206aeef877"; - iv = "c4b1ec2d8640ad1d705f65663626009e"; - cipherText = "289ec2a907353736416aebccb6a61612537654b51a3fd97b6726321a980c1c07bd790cad3a7e1dcc6f3150d6587cd96a712936e905faa12b0d83046c092cd2fa435004ea039521813dd08dd158ee65b87a124e1dd4091c7350d4e94036a72a15aebd6bccace14a64eac2a0111f7f99dab08d8b75c20f95d27a933465c23ea0c9d1d567cb82f3eda17603d992419599d666a17923b4ce340f6b67e5ee4993296b8a21a9211c8e5611933c0235b8b9f846881acd5aaf2ccd18ac1e761f6d40680415106aebbcbab9303e296221f8b6753f813544f841b9ae737e696f70ea0aafb457fda1c48cda10567abadccf33a35e2ce524504facb96665aaf119cd46f0218374d0c759af2a185aa8efdb4a5a898dbe639e091e56a01737f54c5e2936e790629e3a2fc5b48b5438020467b5554e2a20dd35550f300594bd5e0f27a6a9aae5c5296d6210efcd27ae43bd0498e1cfdd73da3b8c29d57edae3a04f616bfbe6646815ff0085487d1a2e5667bd850eb959d643129043e78c742b6475c33db7c89990ee5ee9edd53b241146c977d93af7b82ce8f3a2ad26fcc7164cfa83103b0b3db7655962e2df98126248566a0811cc778d36e68e2d967cbf8a1ea6846f978ca96c1ef34863f2172f9ee2c498ecd0011a7ebb1e065c16e16adf05652ee02d46ec5ca1061c4d2d26e120c1946561aae66d5670ebe40804859c5c270d49bc89d0a8e7"; - plainText = "9b1eb6dc214446ecbf1812461025fa9c268932d1d2ba945e766e84a134dcb6ebc794b22a7622d8c1eb374da281279501d06fd6241fba6c52bcc4d8c2eeba2029ce13f5472f362740dd98cae0205346da36db74d729d61cf44365a815d6961d13a95e7ebe1cc779f9cb4ebed806b827d43149a1953ca66b3a3a86ff1d9d5e8741bebcb6993a285f14d6b14c713895a2f3fde60ad09f2e8eb58dd6638e6ca9508da39078635a578be35d92873b271dd3e5014667644f29db6c5c7caad4ff1aef5068f2d2f4e0da5891747b16c87a8721c448c2d36c9d180e9927b5cbb9b915fe77b7c0ee68a9bc1c1f1f2746e803ff0f2ba17249fd2ad3cf7634608f8276f206e1c94b76482b14e4686254c1cc2ac65364675912767fda6e13e36bfd05d959173c6ad59595a3fb6d6111f024d251a820097a3cd39ba2fb391b55797c053e43def451eca7b32a0e94010a1b1e14ea615450bf0551ec6dcea44326a072daad266912bf86577269c6f5272d06c615e47d0d842bdd565838976ccada59253f6d8d23dbb0be2bea9a993ff169d6c8ddc7372d2bc120edad68aab0471d9d3404bf337fefc343744ba6428d7e85c23ef800d28a963ac0853375247c397c5f36a186f838c4c2993337cc139eb74541520b41c7b693806afcd5c4f7ddffa4327c6ef400dfddc42258ea1ea6e698a8eee51c0859a6be36a44637de0211b31a0faeb2326ecb73"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 482; - dataLen = 4096; - combinedKey = "e3ed136ba58349ddb3279169a3bcc795c26656aac5d87b33dd24316c1da12b95"; - iv = "51d0e4e4c424a15eb58d61668534516b"; - cipherText = "33ff298e8267932b3778b692fdaebaaf50deb33d610ce23a7af6f7f6c3b7b149e535b5064eef4851cd8723eb7c1e56eea7c7d22e3367756ca2fbf5d595c1c0922bfa4553f9c12a16de73857e74a8cfcfdbb1e3fd4628df3cbfc9b26b4ecc839e20164a6159bf8cddd6c222ce3f90901796ff33ae1536f62fcb26641b6419b8c51e8f098a59731cab8f0a4d366a708a0a5381790a45fd7a432150474976e8f9f2fecd6270c0177ee8007c2e8dc35f8ff0bf7a5315f8691c3394d26dc683b080cab113fb5ea60a8b74c179183e38e991a0b3ec3522d15255a38bd6d786e85444d242d0e684ce517a365f3ebfb4de6c2caca3455cf96407cbcbc755f733ff45d90d43ce3ff07c3a3a1bdb58fe911d2e571c27bb9967d44f9c6e68bc968b2c929b88316c4d14d9c44369d27730b3d3cfdfe519b0074ce66a1ed023ee6f0ad0125472710473dd23b2a971550a88879ea33ae8c691da5e7200873a1b79f2a91848b480fa7a19094ada12505c541ae4bca48c3f6fae6c09aaf60c2a95f82117944413c9fb1f6d0b2711170d266323dad6be63b67a88404e123346854c2df10ae4d6b55fbc0395a55254cb8133fddeb3b3ba6d2a2976dca2aeb5b6b2b56ee46dc1f529923b960b559947dd8012475f7be6476ccd6cf33ec578c861791e25bf8a4619168da8f8d772378ef47ee27d33e04b305d08f9f5c5a0c547a94a3c749031ebd61aa5"; - plainText = "f5b324240c150063002d4041a5d6dabc5a2c8d86e82ce9bc20f99c654a10bd87a1e559a7007adfed095ec1b701ec61192de1ef83f3aa7576923a706e677aaa061d2ef43d2da2fa4271a6238f95d809d73ef75cffd394f34604d7a7b8d284b19623c87ff13c4e82795e2b625b7b60ea89b00478964daefeb8eec2ea80c4b903c84f99cebdd2a1e616f7452d390fdc75b2c63de74138e81523b67cd157da7174eace6dc7d28ec967f4fa786bc8b466f13c9d6ec4d69c504147b33e7be48b0b65001fc7cb9f17a1414ebc16ad0780263b0a9f2e1f2a041a75c3982f129993ef670833d8cc2096e364278328925ed5a6ce9a2bd64bd6fd9165496d587e9de8e3437108e23bd238a24378927ba9f308114d469e57882a1f90f3645ec2eb4abf54817a980829e1a0708a806d8f1068024ce22c1d792e37fcdc8bd8a6b8e04634be337f240f1068c0a15538fffd07bf9cec0b63a92ae92a8e166cc130d2b78a4b1cb4102e3010675e5c9dae3a6c2c5de90bbbfdce822165082d6e0bf2261232c5116b9fb32e88d2fd518fab9cdc727fb9c3383670da29e7897124128d5c6e57d8398e16fa8c0c8a78d79c2199b8f587f7151f2991581d8d685bfbfbd3d19c0f48a90dfaaacc4cfbd7c52cfe55ddef2bc209c00354c77b7e445c08f05a518bdd54b1b43e4771a20e8af3ce72a9876ce2e33c8baaff5557ee465a6ea18321f13a0afad951"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 483; - dataLen = 4096; - combinedKey = "f13c1c9eba8ef928f46aa3f70dcc2baa0e6b20bd003b1a38761765e18414a307"; - iv = "6c44bf958ff9b513e318b68b5c7dadd6"; - cipherText = "3183d1a95602ab4b196b50efb81907308a986a10026ababb7bf75608d913ff0163d08cb0eb8c55fee4d8591bd6256c2a3bb2fd99ae0a3dd6e0aca3e19d7264625c7db860e42e0221990170a91d9b01880416e7aa1aae89d3b77a5fa5e81e810118a4c9cf13c4f40a9e1c7ba0f1e2e0ca76e0553a5e5fa01db70d82225b7bddca8285a9e03c315b432451eec23220c3f4fbcd3a2623da502b3a98d3e1ea5a9f60ddcf98104a7ad46679b9cbc51555d4bc4083f0147285ba6e0f56050a68b47beb1a1704451655d2732bc5c7c1a0805488b4e4c1279b2cb122ed3c57abefe382f17095992ac280f766fb3380bdd15f7c66374cbafc739661626f66c572ea63a7256fb8e1a28da2ab9d656250012157ce3fcfb7db741542383d822a151550c9f7ea04e8ab6b6c3bd9abfa14712dfef8cbc8da0e5f4ceb4856ce08d33cce313668a2b791fed1d5af91d4326753df668e88f5c2448213c8b41f39749739c1cbd47ce7a74e93ae4e8fd1a02a80903f65e6c6ecc401466038f4566085f023076d7fb628bd4946b8c28522a26d42c692ad1d2d45495baca6d9a3f35b857d4aac865cb1b229d888a18bc389a5ffa5eab8b44ff930a44c920ded84277459140f6662801ba4326f90461a0241ebb7d9bfbc3cb42bb23b71632a131046d9d3af5e6251c5dbf89856f59017e043124ce9221b9ec59c1547e2972b7e030769f8dd56326a7b5f35"; - plainText = "6700c7a1b99c1c7d33b773187e3be71df6eed7bf2c5c971a937285ae06acde4647f27a7a839b6ef7bd6f0e12cc612373eeed6f3c1cb5262386573b3e179b5d3d15b037dce50b71e52cd02e89158852d39fc9b14eebb96cacc4a2874972d56736f66cbfd2fa3e1a9e6a98eea4c540a093ad318f6b9d083a0a504c5a57768ba560d6a88ece4c94a30162351df40d6eab7837f01025986871e8806f177567a539c8a3f6e17953bd184aa8e1b139105e997c1fae3a1963f2af76a66119262256b6d2bd7186b1c6b2985c28a9708623daf0dd40fa24b832c6ed5262927f9dd728c38f8420413293bd7c712eed4b026c7cca73808d722bd786ba059abc382ce8ab93c4b4c9a2ef70888a1bf54921a24ab75d0af9d8d94440ed95d9ace4a079d14938c3d121021992f44446afb35c412ab93a578605e0ed00bd2d866e78c6183d3b955fe76f3ae68f508c6e31627e1f58c0f6ffbf7a13868f9c1c742fb0998c0acb513b3f0c4946c062a82acf03f227c2d6f43233806d0ae6cb828b28701dabf6d77a28b9a6076f3772753cfbd12dae5f6fd42c7485913284f698ceb5759d424234fa2834f29ba1feef0dbc2bfaab4eb71620334c5e4cb880715de5b52068de6ad97a652d367d40dc3d002020ef6ed275056c7d0904c6bd2588e730a030cbc0112090bf9b8f7eb5b411c7fcd3c10958b336ed910dc6999f15b183729333f3f50e56efa4"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 484; - dataLen = 4096; - combinedKey = "7fb0117b5886c1b927aeb07b6c15ce3ece5f52b064194ba6841eccaecc61a4ac"; - iv = "f001bb080d3109fe7a44719ab4f9bb54"; - cipherText = "81319a2d6c8864ea5fe82e5e362c594a5b399b90ba566aa957f5c73542bb3791ba25f919accfa12857d1f9dae4054f5ea27eb5e799412fa38cf3d71db97d5137887c1cb43c918870d06a4aaadf2f18f85d58049e2bd8fa800247dcd79fe54d773dff703f2866d6407b176519032f5967816ff1bc361cc1db1ff9926b8f92bf836c290b9883138aff20477e6a938be3248ca6d3291aeec01d6029b40398135c85dcd8ec08f192d060820e0a01c31498454f33a5d4ffcd234f9d485c33c19ad2a278d22ba6555b1b204675d65085e26216df05773ac2947352c25e23f36485ddf40baae37c66d8a7ccbaeb9667f4816af2ad00a3bfa20bf8b682aa46ca15d55f3d09cfdc1f26379b2bac199b83aba8b40693291dea0d9dffab41e4f3b2ee17777b1a7a4bcd16bbc5e86a56dc726e603e422bb7d2cfcdc71dca66d071fb4be5f9b628272dd73d593ecc2e8fe353aa6b6ca3981417ad3eafca2a2459bd39de7878439ea0a1085135ab6789067ce8bc08993af9ec96e84a2bf51a86c55e8b405f205b7b515680e2b1507a5459833f789ef6a2bdc2974ed6dfb2493c47b85dde343d0d30f4dd0aaa858d260557f7045f37723bec943e7e63945ed14a8ae37eaf4c5d136b77afb9ede5d0be0cd776779cebece4d31034bad00a7b0f3c725313d4ad9b96d259c8145eb9dbfb8b1efdf04db3ba06ca0093e040082a932d7cea9f42d6e49a"; - plainText = "09c80ed6e555e6cb0ce6eaf6738a8bc8d5547665566e1c3604f348fa02c519f45d0755673c58bef3851117b09471f4e1f658b2925c1a9a1870f6d67feaf4f441a888452f3809dd6308f2bc1a4b707c6154905571fdb7cd063b9d3209ab95d0fe82a5af9da5b133bbd145a66b9e0c6bed460296815629aa41a6c4fb3e2ea5b4e94a0108cc0aa4366b44f2853f0c26ed1af9edfbcdfae4a68673a7ffe22dc60110d431daea073357a9809888bd7651611f4ed34e986cca84907d0ee9568be98832bcd51892f3d4edf841a8baea3f08727358c68ff01543bd2d8351bfa348ff552b1d6083dc5773dea0d0f37b8bc579da847715feaeab149abe0c9b65a527cf80be3558c783caf69a44e137972bea026b7324822b1bc818372adc04e9970b6320a27ec123832aab38e32c6e4c9945f0ee280576240b06a75bdfb1d8fe6d5e5c958853a661c9fecfa74265bf8b0cef3b9028c9beafa44fe91cddc99ad8f8bf6c8325275a12de23f29afe5a0ee8f7f81aa997f2f33ae6ffb91e4e2f37b9a0b75c60231fa145256b64611fee8b969853470580d6228d4e9c3fa6440b45de82c2757e2ea0813973511d9df5a04bcbb40e2d2634e8c760415eea6e8f4f0034e484e5b0adb206f785844233c206e21c6fd6b5675d527c22d895451a204a6cf6df7a1971e32e6d6fdfe336b4ef0ff3ffdf8003bdb486c669eb3416d7ee584b92536c29e122"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 485; - dataLen = 4096; - combinedKey = "2f04c956015b9e45c1bfb657652a3cdfb04ea9f6c4928a16c6ac86c93d4dc6d3"; - iv = "1ca3f42d69053286ca5b65c55ca15535"; - cipherText = "22df67a1c263487d9d5a609c85edb94ffb8bc0d639bd0b2e6b6c67e05c7a2fb2f5142ce8d30a98de84b624211305c594a66d0a433a21c102a8d5947ac7b8bef7901282e827e12ce7bf4137b2300d3e71a479a9724395e6aeb0089a5134f3908eeec04567ada60e26fac02e576cc0140412823aebcbbdbf8e1f070850930e2c1926402949cf61b8e68803cd1304a5d218ff91c68a08cd2a1c042019e30580fdb4352f1b95c4f731fa84fcb63f151f194c03ddf5366aa206ce71899683ef363507e8c05e8b8e7d1f0c7f1dc233a7ca76d7415d826d41eb624e98583a55c82cd80835421e3a699de92391220ae4abd5985340730ed44ba39582d6b3f6461d986f241e79b4d9108d7981b36f9a54cf43a8228def2253e5fd0aa4639f4fa3052bc8d65d354a8f6b1597c70e267c214d25ce40e8efbea0e774777526ca01dd74d296085208006e68f8cf162a80d1db02fe72fb0b10c8db85466a8982882d5ea5d9bceb9dfeedbd698bbc2243dadf7814f88614b0d6561126181f76cc2b177616c46338180b0e7eee665c1b23fe3a1a2b7a7b12df30e69fbb77644227f2006d77d9b7213c085e2103d5dbdf930f2b6999954b74d2ca0f04bcc74a5fdcdee098cfaa623c3e2b77eef4d08d9547d09fde9898f75777c8dffab565f13114d3527e609d699a9b02de2cd00be7f62f6cf739baa2fe904d12a14fe0bb26713c3c5b38d7a56ff7"; - plainText = "932f9d808282beca376f0d8ecc77c500f35877715a88d132630d44191fda5fc9f0f7d505eb86141a297d092234818ffbb830821cccedb12c75dff0bfc3ec1e21aec78eb4973e37ec0fd387e5436daea2fed3135f5a17cd7a6112b0d6c249e7c78c44124309658564a4fee8e52fdb6c0ce2e708ac408f27d80a224575023f236ac46a881fa7896cbd8ea5546265c4cb4d59e42203dde0b2ccdaa05238e5caf551c910e9072f10e9d098bd5e265c8281be205bfe428687bc459f753e4e45e1e5333d591e068fbb2972f791d99df40e8d4325db609034f2cdb1e522e9bfaf52c2ff26e61b9f832825c570b2b7241a861356628f5d56ea3a99dab7996b9bc361300009de1e6372ceef46a21823d985e42a35c67e45719deaebd0e1e4ad538d8688a0f8df923d44bf37310ed9281e643d377e3345395e998d6d8089a226947b7d300a7d7f1e2c3abb8a91e9bcaedb0e40f9ea975205fd51c40780208e98fbf6c616d3fb714a6a2085f8ac82569973e2cd682ec896680d65ed6db7fa625ebf53bbdd711933607da7091dd556d4bedf71fcbbf3c7d89cdc28a5a0236945d004f2c97c2862fed5a6dba6a8bd05cb68aae72fd6ca25c296e0e851e5c5027664fa5a0369b89bf2127753cbbec672d7a9043355d22d0e9ac929bd27d43eafa5bbf730e3869395620c14ba500e71ab0e0612ef30de7b4cfcfa4b2779f3db83ffee84fd8e12ff"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 486; - dataLen = 4096; - combinedKey = "0508ac7b6b68fac12ce71b581519b61b377b4348096df0df876037adb77bd18e"; - iv = "292910480c1708f487b93d8171a930a1"; - cipherText = "d5a072fa6857ea7615cf678b722be7c6360e70e5c546ccdcccc5f5c1961efdf5c4bbfddfa67288c4348aa446882f3bdc121015ea4b02abbaa1894bc0342d53f8cdea86c3b2248e4dea5f5c7ac5ea320c1e4737369781fe49c9d710dccaab2dff07fdaa3f309fa28bac945bd7fd19eab1ce0e36ab1723b0757f8ec306e608dd4d1d5570eabb358fb2c993c0a40919524a420cd167cdd50d203d6e51a419885331d4306ca5c1301dc5426441221474b477b261132a75a5c559544693458e8d13516bc2f4c7515cd9a6e319ac677057a3a68bfaee1203e1118ec321b3761695e6f25debd324b9f13476c1f3182e17698f7dbe46a99c5e7bd411176355072ad423538c8448166d047b4d3ff8de3380ada8be88289949c530cccecfdc4f1d1ce114dd679dfd62e4efe1fa62ea82302ebac63750af284115ebd20843f3dfe4b388fb99d61e32d692461401b521f056c376e54f0c5f3e0d4aa752340438e6047814da9578eea486ef656509b16cfdfc30222c9d343c68763be72b463da4fbd0eb2c4afd73ace50017aecb086de18d28c7a358d4846f6a007d4b4abfda3b013ed7706781487a8c16e4b8e1d8f4df1ca0ab105686c12db624e87ee5d37f7f71cb05601571dd6457df4cdd4388769c19c1adaf3d5b8fe23be1ec7658a4d4602a3cfe7714b71853170433aac007f434cf84abbaea312309486787671a0c11ac7d18284749c6"; - plainText = "d489b08b54acc9a06b708757f07fa490ec72f7273e0f04f8b6258dbeaf38a9082b5b53aaa2b21d18bf102bc860133fa85d290f014c53b9269095c690edf438dc45d952d3220ad71102f08d47ffa9604b4ff334f95a44b2cfbc63a582614ab7d9bc524cf064d251809f59ea2c623cd699b96015c1bf31abe3b7d93e38507f7e62841bfe1f0ba222db3eaa660c44ade3f1f6f6e401d672a80e4d7a3dbf430ca97a30c40d379e83fa190d0539b0a785d83d2cd2f47cff6cdbcc2ee9ea5dd8ba80ad33d045c198775cbe9a8bb584911f92980238d1cd9be71978d615d0dc26771792b5c093b8967f898fcbbed1f81050f64c52c739fc2e4f2d299f14772f20a52bc474c80c245683420743a40488be09bb5bf6986fc271e892c19fb11fdcb8a09a5439777869aa412fae612b5c1f4c259e21937c27248fd6c08aee83cafc5e1337d3eac950ebdc732f31df9dd37274fa6ac6ea3d4102e18c74e5ebfa8c314b7dfbce78b9194e479555069d6561de5a9750d6928caa8b02c82da91b2ad599d0fcf3419b8cebfa9ebfc38e46712b4206d3fb2def2aa16d198d9b410f3bdd396a6e5c9e11a3ebfbe44856331cda8ea70eea09f5a7bb28141887672b18bd76b78ebda2c4750b7d7e431a596a583b8f9cec29ae4de13863e1963bd2e78ab2d0d7ed4e00696466fa45c1bfa9c2d67706949c0ba29b23a66c621582d2959b9f4921d3053478"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 487; - dataLen = 4096; - combinedKey = "8098ee94be761a6366dc142135af57de6daa672ab7444b1bb89715387c4c9c9c"; - iv = "e9f79eefb6783fd6990051d21719a0ec"; - cipherText = "a0090a7c79a07e83fcebcb6db1cbdae0d9751d4aec45c97f5a2e4875a8612c1b93c8eac9b3ddf82cc6f035315c6175621a287d42800371b1169069de2ecab80d86f412d9ef0da4a08205a85ee1a6b46091a73618d800bf15f119c4c284943c245572c0500b07e0a6a81ab6b5e1b27189cc9938b48ad2be4359fafddd71d5965d493b0a0308d973952917f9a69741d4928c180d9f64952a4d89c80566d6ec7b68c2fa1202f17726db18f93245cbe4bc4faff81c6e3197a78b8cdb6cf62b7baae724d7842db7a0ea52fbe53a60e49e23904f1071efa6301fefa8676a9c003581b370c724455fc8c2326f149b5abc94f7519e80deabfce3eb09fb0dc3a72050a4c43fd83260914ea75d763e782fe47e797534d736c582d68f0c779f4658b39b95598efc5983da2c00f4307d89576b48157076a58926da78090c19cb3f71027b6d819fe0e4bd1ccda1f045228ba2ebabc158ec55f424ff3a148f6ec2cbca3cad19e25d0cf7f4d0c67d187c66c8906718c5f08fa8b25cda1d27ded45cea50ab0a79ec66bb423c419b4399fb589812fe85e6b711443b1a505cc6a822448077448e4af49dcb270f6e6d4ee3d71f4e4986f606a92eb6294be2bc637909d17e4b0edd078d9ef479b2a610c69365345f28efb12054a0ae0f4424cdadd4df65201239be6249ae0c6f2f15e310c9f2decf36c9048fe45dad0f2f269f0fb066e4a71efe4bdf28"; - plainText = "affde635e843d673326da80912c88b6b2dd9ae7e1d2a75828fa9e801deab13bb87fe0832aedd872db000c494ff94fae0100c2141d91a03755b7c3f381258aae187dae25ecf5dddfbdd9fd31ecb47ce15ecb96f2deee03924481fb32bc75a0addd18a6f5a845cc0196988602867fc963d29adf384da3a3b48e2689f89b993d072f52930d2df2270adf37ec0a6a21094c34f30def0c41ceffda5cfdf3a5eb5f01fbcf819018fa6e9a75ed6c9e94ca93f25a8e1557a39452baa9e6d80a346070871586e73ae75eca8d9db86cc96d0e77277d388269c167df91eee75c80d08e066ba767cd98b369a6567633a206402d32cac42a9ef8b0c87183be6f9b459e981bb81cc9142669fe53bc857a727d58f448888525f7fd553a0586294ca1db89aa27a5d10a0991b17e276c5954f401635f6733a63dd570893885080b86dd0ad568e660e58a9b6438d7e9756934aba6b26b1a9dcb68ca88465f7ff4db51d027c28b9fd10310e5c8d16689839b8929d13b5d0aeacb673b9e5fb3b3a50c85f0b56f8cc3f01d68f2c9ec9aef97cf408ffa657feb3cfbdb3d871116cb3ce11de37c0f64433a9bca726f1423a42b3be201f7e4a5a9a7db376540d09f8b621ef338f06be35b8b8e65f7922c889424094ac28a245a6e5d7155c3c1d2a9d2b93d1b9c51d3bc3a933c125f6b61e7ceca61801b532f5b2155f246d26819dc050a235ace9e37b6bb11d"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 488; - dataLen = 4096; - combinedKey = "594958dc5ca1f46c873fe253cd8af04cf77ffae50c9409ededa4249c42f172a1"; - iv = "524f4d4d9986780c4058e851de45340f"; - cipherText = "0e6a6915c30258eec6e9afe94ba020ef7459debb2d79b88430e92074dd63e9607e81218deb2b2863047f1b1802afc776e55d4956f98199e9e07fa53be27744398b684416b7bdc7e90b1d9a2799e79d30c1800539544a87321a2811d005a7fa6026e523d6ce5104e337d79fa4abcb7b7e7ba53d78e2e153bc4bb6116b6059eba1997aa72c6bf426762cdffb3c8a96ec92dabf092d6397998a085b6a89ca7bcb363ee00d3385cbaca814501c0dd997536af09a299be55e21ca1284863d5d0e93161a58576b535f9c7b0ce4022bb7a7bc0b2dd330ed00a46bce0c9a2010d7fcf94bead96372b386f4b45e27ad270f7e2e58d86a08137439c58858c65c4517232c6b56533bdc7751d8b5d068fe5d7671f508f415f8b6c593620c5a56dbcb153aef693b90ac90f4686652c0dc7f1d852c681430186fa12080fa42d456ec4542f254a53b0f3b7a2147ec591f8be9d0b9fa424516e4721c62e7d83835cbe8d5b27c5fda55998b0be1f99084d759f3dfa86534b7a302a70c3879ff937f5f9111dad790d0d069827ff96696cce7c3a75cae37f120830a6ab03877b0ec0f597fc8cf28df7b76445e9d330d1bc7148cac488d9e9e264adfdeb77c8041796faecc630b268da91f16aee33c9f216db1aa4717dfd7ab38194f4872a2d2b6bcbefaef43f791594f91671a8ff92377edb1d4c0d65b181b399daf98263334b35d22e9a7d78219b36d"; - plainText = "5be06f7f89f901bdffa56ed223caa6f585b0ace5d4e65a6eb59b083d785f9a5cf85ff0a8bdab25cf12f65cdf58f8e7e710fbcebad6c94174746b5b103a7ae32a98e71e7f9369719aeb9ac971695306afac8b0596dad678ea3e2c291345272ec7f70d4f91ea630b8a8cd5bbb4cd1e186d0ed86fd93ee6c247f866ad5906684fd9574694c7773e417cb7f433e07bafee988494e610ab3537272e620e573600119b2db60d472d4805ea156d5f4008f02c79a3fca71ab5cfff8444d514a203ba716c77bdddbca62de803c110bb3a44a335ae804284c93511169141ff1514919a6fd2d4768588aadedd5dd0961603123c64a8bbccff9107b668add5b18ab39ae93d3678a8e10075ef93c7d3c965d1192d73bb1a449d4d39d91e127b776bf7139c15b6b64d81932ac0c57ebd16503a9c371d1027dad47e318c5d12f48672411fefb193cf50467de377f1bdc036eb4dc3029a28edfe71c000f178004f046df7b936398350ce52e8418b0ece3dd687078199a4920a3e84f7f5dd1dfb94e3b8b3fa3f5eee076fd277c7f8735e7f223f608c507b07d9b55ed2603cea878abcc9d7e656d88491eb17ef995980c7394c0df8e410c2fa3a91c9874fe873f77e7c852113755a613f6775bb7d573743fafbbda09625616d1b86d6a3c1b999b23336248a10de13b4546c5ef6593dd076a5e83524392d7eef86b24128e857dd206dae92d36646f094"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 489; - dataLen = 4096; - combinedKey = "c1e8b9d6aed40b74b5ff3fdec13999dec218459feb70343c7e8ed1283d2fc5c0"; - iv = "c2ae363e12534351c0a0cc8042e3c8d2"; - cipherText = "162d1143d79b8fde90eb85bd4bfe8442f3549b2f71b220c31e1432722490b82293f1fdfd30bccdf6ddde5a0c60e136343659da6b5ad04353775afbaba4f49354921675ce350e29f40a70eaca15f830a90d83983680143a0696514f667842abce28b4d706118644be0f7d8f2fb6deb4cd2fafcc350a2eeb8582107900887abc5975f2f12fa6297311ce6bb08f0acac3944af355197aadebe75aa6eae8cc25d2aa1e54520e1416ce09d5b2097d5051ac198e307b7a2d4aa47d8be9b37f659ed8eda297cbadd8180cca1c0622880544301c5fe898b5263564d7ce47f2c5eda28e9c7715c155111dd46855897c9a60e15500e905eab1d4149e912d59ef19cf13d211053245e60b8f97c613bdfc4f9a096523a4f48e4e4e81c5c77518fa4c3a4d16dd268750e623c8127b0f8576dbac53030010d1d264bf634fae38a2283235b664e1a2079f000c56463eb67f54fc6001838a82743d575b45cbe97f861c6176fff19b245d45297407bfa2e0b0219a1e2d1360b2452891415882f3374b27562d47261d6c7083007d5b55a14d8aa487d0290ee0b18d1032f70b03ccb41d0446fa24941821031e6ec068322e6dc1fe12419d4c046b9f5b1cdd57db999e820bc40096d27c01a01af0fe7f26043993570c8c295c0d6265270e018118d9036f679ebd9cf41b2c8248c70d0bededc609852158da1b550cbc6143cc2f43c11b23a017278782cf"; - plainText = "33e412b6f92cd34641d8f0427abd17f1163c60b9bd1d41ef512e3ad7f5891f8385e5ae411c35c1f3a8e8978fad841a5e3875b06e567b74c27e5b528dfbae6b9be5627729b350d7747c9b78ab59912c9d0e49189521b5e9ad5a74fd0510a976627ce578f5754b04ff5fc9d7833e795aeae6e3908cfdba4b17c300325d23496427673bf0a96d48615d9bb4fbbc167f857a36decaefe0060b5bb7aa3ba28a0802f24f11b73c493db64108d493856d0650e3b114921d23eb54d731aef6788cebe9f798d8ff191f27ee32fe398a9ff04d6882301a1287828957f300c406a04ba74f1bb8573624cc6a6c8112d8718bb7f7e1340950e44502dc77f2f98bcedfc3655b507bfb33b68511310c1601acb9a8aaa33812ac04eb9a9fa72b9c2391d6daafda835768f8480dd2216e38064f2a7fa27fcad96bbb817efcc8b4363615145bbc08f3ea0b2f18d6a7a43d586967e599b1e7263106635cfe5f1b2bd4f6e09a588046105efb8a16cb7d94de9a4e6310fa4664458adcc523d632688b8b200eec23509c1e8c21fa28f245c8ad0b6dbfee671682fdbfc33571a3eed1ffa8d00aeab22c8b0bb240b4f9a9e300249e1518a450119643f4a0e452d6a8df6da320020bb5916a8ccc92023c19f0036440d56fc7a4382b6caaafdad8a73add90b19bf11ad3540e707e7480028ff5c41fc7412b8256364a4b3c69c9376e2470c0bd8638037964bd9f"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 490; - dataLen = 4096; - combinedKey = "43feb5319da39d9b777d35797e5859133318cf92d4e08377512b8781560a05f3"; - iv = "2fca74ad7ff0741c26c5505bd75f2708"; - cipherText = "5dbc7747699bc0abe914c0f4065483ca2842c175227257dc82ae25804103562e0bb05a8d4344f6129181f600373cdf0a755aab02825ab6a95ff9ef7f38b985ced3e3bb802d00a63c006270bf12fb7b4e30b6a0df7e89441fe11ae760d346c326cc00d668c0d2e36a6803bf53b5b348af5267601490cfbbd1e7d7610501ff560d0c0b1fd5bc5c34e09ff6dfe9573000318530f5c382eaff6ddf331261cc519048e6404d83ee52c459bf68597221028479965270e5b2e884d834f4152fb298104b17e599e71896fb3ae273ac7327e82bb5975c1a918dc8297c9c3e96ae709b237005b80f8cbb8365759509516012dffead2d2157690e670053d00e70865801cee853509b2029422ab74b4c4065caeb8b5e86e2ae9dedf4f0398d467266ab3fec64170764bcee1b38260ac74fd689c18d784ce38d0e510347c3fbf83c212500eb28f1423ec1b4464091cded8c2ef89ca2752a905985581c88cc93892ce4d498b81ddfcba1ddc2594811af3199f3c6229c6753148c8828fd2b0e7e298f17dbee0e3f0cf93376b89377cc282b5d8224706b0e2c9f00edda831398033f1296f044f4247c225915644dfbf57f05748720140de72c36fe775eff6779f10bee2217eff9629f3a07c39610344decfbb36b885fe9ab44b0002d8bbc57c4d8fb04675dcbde2892ef2e139d67bf36f64d5e609ff6be36d80e4910eb5e9b7ce355f36a9a5aa5a5"; - plainText = "bca86f67ef2b9238c927956abd0880df8e6322a58f7deab7979169c8aaad1b41422e6ca744eea8a27da3e5579297fc0ffdae5d79d0ee8cdbf0ed976c03db46403389b73e56d8ecca1b6b038a67ac78a87ef00419d3d5b29b8890e11e8c92b1e454445cd30c326fb986c5abe73e8451b971acbb8d7144b00ed3e0dfcea5a17448a3dafa4347a33da422d6042be9dd28903ddd1eb2c741c06330900bad1d22fffbaf1e24a186f1098845f9226a39e93c8746d816e7fa432583fa07bea6522256cebae4968b8c825c635e4732fc4d0a89de2f37f4e8a6c0c80b6e8d316845442f61cda5375d886ac63bd1b60d0211b251370ba4fb774b816d07bd66f7a43e811f581d91db0da74b4d45d683af50a2fde17000a6f620ec63ef319daa6862d8da4a97b7cfd78d3384322d07cb087bb9f0e83231b9cba98e9097c5258b9374dd9b3c3fce3ccc8d1dca6ba0ce94ca577968d8944f17c94fe60ee814eb509e332b18d124458ad690bd8886463f16af4115d9d5c024da92879fcb35706fe729008ed67abb84008a93b708049efeeb7e157ff5dc53061f62740d5ac343ac5e6fadf5fc446d3308ddd0ee4c2735e4e607f41d545780be8bbddbcbf0cfdfdf0a2b18499be08d446515e67ab8115e536e9bf4d8944780c193c46c1fccf0e108a54fb539d61aaa672afed9087a8548f2c846426a2cd489cea8487cc4810b40c191e419b62b649b"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 491; - dataLen = 4096; - combinedKey = "7ef144de40295060488c348f224d6118d0dd08dc7679cd95b2aa88a4d763f9cd"; - iv = "a4a564eb6d1079742288c7336d422749"; - cipherText = "9702b144179fbc5d740a07be50e933c45d23b640b6b4404898fb5b59cae0655f1b6758428df96c70caba03b8daafa4202533ba4181191f1fc7181a621bb7a78fa5d565ff49116b1189809edb781e68cdd3f30aa5703bdaceb07162bada2bd5f52b40164ec6d89839900054220d80432d7dfae3aba24318af1d2d047712245ece6220173406077ec1ba0181d32fce588f45c6b6de211360b419e52849a7a464010bd5ff77296768d19a75588338950d7648914e1b037afc9c869ba13826b8d72be240f5f0bd608ebd599e03647607576537e74d6e4fa633c72a84d63b657d309de8c2e4afa53fa919bf89cc1af1b247e47f03c2a2615ac792e9ac359b6e13e03b4c25d3c5e0428ae6870d5d04115f868905c818242ad46e3e18220d3991e18608ed3bdf1881c1d83d35a9528d0db0a795ea67addcf346c0e12c1dd63a6528d40d05c6b7c0a6223950dcbde00cea9c7da8b3d3b3e795fa30da61be6aee72fc01a4c3b1266967e0214f372f3a64d45d8e1fabf127723e037f86897d95fc564a972de78a77d3953a9b23d02bfdebfc3c5a668001f1f0f48db4430482d1822811d6b9d7f1b7bb538cc791bac7415729631e30af675aa4609d1e96966b19a2cff30da259f835e71129c2e24f04f74d9e0b56c2de139e64a5af97a6b147e5df05eb774d2b3a52fb57119084b52e535d489cfabf3de55e0740d635f2f86566a3aab081af"; - plainText = "b53b93601aceea44f8bde7e18beb46a69fa7283c0d01ec95da344caf07547d0e84da2a02de876bb1e0100ef5954192a7768c8455cbe5408081c327c17f52a56582aa89bf14d08062828366176790e32486c92910eb82bf0aab9e5e308a575466ef4e1c51bfc7c6f0665a16738c8d97e425fc611a0c42160cde56f9af0eaa05cbcfc785200efa6cdabd2c58cb5d85bb05ace736586f3e7f1517a094e3aef137afebdff87b4dd3d341b3f83f6cd2da89001a913faca1b5f8c356d032b4316baabafcd6a03a3dff25179a16d5ae1d97c27279dac0df5213dc922e4ba014e9c54c6ee3a73529d73757ecb87953aed0db66b218f7bb9f8418e46320d19a05e62ccaa8ca6ec3abba392f43dfc739d0c7190f8aecab81015dceee65a7d2ae1dc15cacbab6392b159ea60079bf246f6bbc06df6108dd48b49841dbf5cb5f5d523bad08f6d26668348fab2d66d42891a76027d0a839e1b664b7a2952fdf9a4c5db8deff1b942115350adfb8bc0165b5edf8408cdf06c5998a0244169efb2fe44b3ebf8b6ed5a330e6695375ce7b453b589285b8fab45914214dc5473cb276e9a38d79a5997794355f4aa595b2f69b6d4636a00762af3a6e108abd0e9ca514bdc3a540290019aef97aaa1b1256182399caa24213edf6e89f775c2164e28c3283bda7e55e26b0c19d6be24d3278b7fe217bca8e74777a32c71c560b9d9b59b0363065e74d51"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 492; - dataLen = 4096; - combinedKey = "0e185134cba33a283a99a21d5b730649fda62ef8922dd302f953c5b7276d03cd"; - iv = "ab4f726c86bf3c084f1c8b8530703f26"; - cipherText = "d9da8c30ab7ad2a0b02775659f7ccff57f095fb0867bfb495b0c16d3bd1e3c6c2004c09931d0094bf54dbbe655f154d7f1d7c4aaaaae69d3c0c8ccac3a47ec1eae3fd6ba306a35f9dfefbe82cd013efada7c37f08603f5885bbb704696820a24e7fee698ad076f5a0e7f5d6f0aa78f54cdeca31dfd8a88deaa4fb58c3629ef28685fc54c90a404ba915e8d6be589fe0bca4606ccfdc0918bf60ea6665cd4cf994fe3d636463f918fe586dc18ee28ff92ea11f860ee2617cd4cb1b8c3dca8d42978e50c37c959248cf7c114c8ed586034b24ddec753620e84d3116a73a255e8a85fc1d71cfdaa7234ca6438d373c47df07aaa0cf9afdc5e4addb8d0557591c87f65bef469ff738f23283d540161379e3c9ee69d10810f0d71f766bc5651e4280c2197f62cc43300d46ebddcb1c1373b80d4ff8313d5052311d3e6422df60518bcc4801ecd9037aac028a6ba005358c9638f61de6df7aa78df4d55059f4dde32a60ad21293768dabb3d6acddfbd27b7c0761035c6e5ab8a3629a825c8175de21ff100610970a6f060c873d6a6d9e61031fa137450cd427e3670349572f65823b2ee5c026e3a9bd06f16db5f845535083ba9f195825d499fa04182eee0b7481353f4a3ed5737a54f1405ed82406419432ef945595bf63e2663d92420bb5f0ac4e02c02c2d725c89236638bf586dadc89106dfcfa50ff1bb18f3b37ccaf38aa6b3a2"; - plainText = "5421fd6a9b3b22c63013f7cd4ec7534ed979ccebfa393b71bae68b09c6f16a1c49f605be32c1b3b7785008bf69c7f27d284ef99344ca50e2105a1c72fbae0ca240946fdf693f1fe8fdff372a6a1510b65f65dc07696f587472b8e6b3d40e12b37bca4e8437619efc690d6d71dc4b3e4252a1bb5a10c68d36c31e36870b4b46a46be7afd80249c60751c42e734a4fb3b632ea21c8405fe71d09a1d49ea5d4d992d8854bc0ea4e860fb9939929d6c17d6e8fa9ffc1c6696a3ec91b29761be37e3ca3c80bd7ad2bfee425544186533a45f310f764962815590fc5b24ae35b0ad041c3e67d1248b1cc7daad861540059db2e16d5b913d31f2f47e26fc6c2b4d00fda551c448b345a503fc8c316215cb35882c52fa8a4fffe213617632eea8e9fcfe3404d75ae9fe30ad0cf0b61bc92bec04c1f592d4c0db83e4e87d96b73c6ce823dec3270e097d92b65f10e1302d1ab3688b666d5579dd1059d459c241a232becb8e41d4247c81e30c4d4f2dad28de0bee9bb62a5ad72a06c42e95efb8db5a6243c5e9eb2b5a747e24126f935da36d0d7d0428befc8b2869b6351d269014a6b8970b116ecb25c8f39ea606d9014c5812eb943e85eadc0ed5407e9ac483360b02ba54e4a4e815544eb8846ad7f42ddd277ceafb2b0857a3aceb45fbde7d9b0bb08b8e50d515102908b326d8a2367765d2c8dbacd806eb8d2004c3a1fec51e26ac2b2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 493; - dataLen = 4096; - combinedKey = "542cf1c7c6f4a1f2c06e3b04d66010e2c86be1e729d968d2d0f2e1a66a795a93"; - iv = "7cacdee720695232a27bd6150ac95ee6"; - cipherText = "df00fc2c79db45e92f6abe619ea5d29ebb5f3f637e1356d4dc1425cdd57c2c29deb21790f2c3cb5487629599c191a2550a6f0bf3d82347ea7d882862a3cf07ae61a98baa796821aa6db8093a87099e1cfc283ab381b25057f35cf67abcd95e170bf106999c5660beff08dd1bdbc8249801f0b0bb66b6bd355a9671eb53817c2af3d273427cefb79b044bf404151c0f5efb1b75e9ebc7fa1d1fca3dddd7aa3f19a078f221d5f8013e878899cf27b4c3d5972ae50df94215cf53085ea675ab11120df96dc71252a64e6257d31518043ef738afc95756d124a61d768fff6c2b523dce254569eee73a67aa7a2fe8605e3f6dc52f53914f4667d23c095dad733a835e68949a20743fa3e2d3c2adbbb06ae0e941e28de358560b1de21b3e0453771f767289dd1b6842766de2604829e1171c9953ff1858f668e3d55fb86d76c6bdcd6d37c483968322a015646f8df1871826d4d20a20bf6572c9eebad63baa1e8079fcc55abd2469f46a969565ca0c85c0881103355b4425557e25ee6e32612fda8352c1ce8eb87df95b86b3e82e1e15a0d2b5c36bd532b4d07bc5075f45aa7e06a50fe285e2a544b3648cec088b29a7f1e8b026ec7de82e79d93926d1187e1dd19ebadfa4c0464739dd395159bdcbc13017a70e732f394831ee0b7f2ed0e5cce318e2c941be8f29a6b50b418dddef592482048e8274785eb54c97f158ca26b7bedae6"; - plainText = "173ae7eb10a6278464639727d2a4cbdc86c088766a80db20eb20b793fca63c5de2d2d2c08697f4abb0762463ebe6d16bbf8ba7f2549bd50f921d7ef43d140afb86c6abc69162b75a7de7b3b081142fa093fd6406f75bda4bc83e6bc43f34a8a375c240fc63a7cc7ffcb8e7ed9288f306376a2a2a44edf4ab26821698b22eb4984b165eef836680fa3131154a4a119ffc9e0517462dfbe8553c4fff0be70a1674845ce3bf2e4b0e6ef560b899c225b1204a8bdc7201ac8e5e352630adb051b35c31c390f14d53d28013d65bb3359aef834a69ab0f2c446298d54f18e9689d5e18d0148a9ebe55158b45ba00b47427ca024579929577638cc3f46340f2b5e9edc4dbe4e4567add6f965a9d049049f62f90d7617107418d568db32ed1827e92aa08afa2748ca4f741de5346542cbe183098d9585f4cb3cb9afada6076dd29b5d5e5dc4b8e39629d6bd044fb919e88fd195d901983fd6626a4e54f31eed2cbf02b29e4751b99c42b01026182c2a4c3860bae566e844b9711ff8dacefc93f7ba810524469817e4b3926eb7df1a674caf0488094b863e59a0a8d2ca3f592e9f101ce0c05b9d6a45b9532801713730ddbf734d3dda8b75d896b13a2ce8861c1865a0607498a1d6fc658ea70494ebaf1917070edce1c7780d67f4d45684eaa5dad1d38478b22810a58e6b4a3e837037d754c158d145ff59cd5718fbf88c0453dc629c248"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 494; - dataLen = 4096; - combinedKey = "7a649d76930a91198fcb363dcce69a14522a861ce6b1d99c4aebd607ad63afe9"; - iv = "cbd0ca180dc0b8c704621a98db7d59c1"; - cipherText = "86c7265f461aa8086633c19528c1ee11c8a7011720da637e6e74bce4a34ad19778f660f68519aaaceab36e93cd7e7995d92f77d5d8f7bf058bf3f1e8bc68b8f7b0edba11598e5012da0c7404fd201c1c28ad5362ceaca08fdd68ad95f657760da8fc89da4e926be21dc8139a07378c7b7ba19640361978cfa51ad22cc9444266dd775c5e2ebefab7aa07d0608c96e5f257aff762a06f264a5b6b1cd68546144847c87acf6d72ad0258688956b2335e735fb521d27c33ab954dc858607bc7ac5c9e61c837906c081dfbda6b0153f7beb0746532871ad70d28507d12d22c937ffd17ea8966a565e6e35a59d094b246f7eb7a68ab37b1347f960ef12a4e5e0252d623b4bb486405c71f22b9681cdae84e50b28110a072d0ed9178d5552dfa82096bec6ab4685122bed356ec1a90641a6066ab4ebed86755ca7172fd53772e440c6f5654817882fc757f2c468f1a1d1f4c268b01e95ef1f7aae9b61abb497c182db72a1685dfca8f84e4609d5d58da60fed1c06c86a6a3fbf45268562d343352d08bad43b9897f432e133c4c07b8ca726049f82e4a914f8318e239bc3260cf04f29a93141f1fec92c1dc96af19a1b249c9a4c41e00d7b3ef1ac3331da3fd5fee47b4492c51ea027760173a52606cfafd5ae54eb64f8b3439a9d7aeab5a35fbbfa5836efd95a09468ec4542a411a43cedd2eb4af3b5e2e019a6b5979373ea6ae1358c"; - plainText = "758bb64af4cf4d966e3cc318172250c3b8cbaf1acfca7fee81fcc021888ba10466c5524466224cf838d91d30f48cdf417a8060b0ec6eaf59e031141c4bc8e7c251721a38509d8b427eff43ef7096badbb079e928d33c850540cd76c3017e1e72a793a630064c6695f89e6a44f85e14be4e01bbcaca5d7845c840b3b9e23cc192567c20a2d4c79c6da750a77f71d404dfc9fdba34b10b18801c06e432e2d78708ca9c19a148e0cbf930d1aa5ad479dcc67835bb40b564d583766a0eb09ff3b0370d2e1e1ce47c1f05cfc8bd8e0a8f77bd798c8cffbaaf79a9039b0cf0b9e03c580b3ed2c7a3a107a204e9a26db55fdc1e48228f5b22dd625c80f2a74bb7fb70342984c567b859fb8d33f4a995aefafd0644f96df6edbe6e8d9918cdd80862995877107dbc3e9f25c801efa1bf22c0688c2627b8c376176dd72198edc521eef3f9d65313ff50ac652bd798718d1d5d8e158f12811e462a23e3839a74776b075077fc9ece15df0c5728401100bb4f88c5030fdc558cc1220cb7ed43d38df06853fe390eaaae1d71643241835000a79ca80b387165e793e3eede10ae382dff5874660141aee239768feb1e4ecceada8b125d5ffd793e14704a303d738e1211de0ff5abe921c31f9cb51beaa651d8beda99733f7ab49a48a31af8158eaf9f3625c60b1eb0fd0ff653bf0bc5954fdcf76e44fd9aa15fae1ad080769e690b84d9701c78"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 495; - dataLen = 4096; - combinedKey = "33fab98e7dccfa592bba1c205dfda1392c17d33381878ea6c06bbfc675c4ca5d"; - iv = "91599b660246095bcba482ab527e0a59"; - cipherText = "e6aee2ff318e668567cd003d5173ac6fa633b04e70790864c9d2316b9b8443b85c8a416cdc1ac910530b1a08280a1dbf5c0eb84f50e8ccc036d0c33c489e241039b64b8242dd2ed0ec0ad38e59c6118cb97d05da83ca9f7ca48e055105a7e441c7e68a6108988497f334bb13458dea5e50cc4492ac51b79c9b449d1df230d481fe50b3553aea643200d304104ab76b314f8ab85b9fe031aa011ab6483f3139f8186f297e4962ce502d73d0286b8af7daa4795662e8a17584838d3cf7bd71caa8a5c06be958c8fc5356d7a2597c3828ea7807be3b735781f1ed2ee3e0fe268af5e79e93e507f25567a597a53ac15282e6941e8725109030ca3cba0bbb6ed125dc019c3d9f5a44e5dc6c244f053db958695a8140d2d0c3052d1905e5c675bacaaee1a60ba3e01899a7410e203050daec9319a14e5cd9311ccff8d79619d38d52e3a20150490156a18cf90b09aa64c763aaefeee52a62b484a7add07c53d316266d92d38f77d3ac5a374cb74f64e25595b678144f2aa3a9eaee845ddfc32a9df1b0d3a03301d7837299d6374f40d78b5f796b969c7bad3d84d153680b8dfbfe946cb441f33bb10aaec93866dcd858192c654c9e0cba397619779b048dd8808918d0c3ab33fa60e1d0bf8564364ef98fcefb32522ebb74c011eb8079be165126294a405198307f9d56b798ef677ede7c6d5405b496462cfc8f8b104159364af0edae"; - plainText = "c6f179fcc3961c1e423cf253e1f85676754ea98d026f6c84babf1baf2d76ef11ca7fcc42d7b5c16335af5c99b8cdfdd80db5354bddf1f2db03e8c95fdce20c773f740045d61b0afe2eabb7186ebd8846da2ce75d10a32909a3f38309bf29b9bb691fc8ecde0f433828e728feefddc1e7ba56a2f10d558af20348ec7a35dc9ff1b4eeadf89214a8dc1c14b71f21538fcd6b80c457d81fb09fc94e161dac2fe9b4f49a97659a63c9ad0a9b0ec0a3c3949a007d932e8fd490478bbffafe00ddc49a61dd178fb49322322544bc2dc0029496498f2d559ae4233a6425a36a4cd0b86ece3e4fd054a6cbcdff8ca66a020bdf3791ac67052f71234a7748d053e1e3918f5b2eaab88c08ef1fa9fabddfca9e7246a583585f5e41c1fd4539f46fc4656aaf44c671a1859d909cd8aa4da11107b855c0ca3ee49e3d3cc4595bde6ffb0ea6bd4e24b2368ba0a10f1ebbdee9323f0187dcd5254e674d46065c22c84e149cef8e72044a56389ee478701b1540cf116dabd8d2b110d941de983a02d019abafd5d6fceaac8e226f7ca8a1c823c6fb05b8398a42573f7b7c166b54ff47ac5308c7d23d79ef5534e6b748c9dc786f4b1834fc2a50976438cda619c03a14174dfd703775425cb8be45d1b6c7e5315e0b3ab128e80ad76ce3fce5ff41b369da638a21480fc71673bc40d098ed93a8a3150d7b249755740f3d27207e67976f7086764919"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 496; - dataLen = 4096; - combinedKey = "6899ec5a821a682067166d2331e7524c58a502105673b3e2372090f9e4db7a2e"; - iv = "31466925ad4956dd1ffcab9f1bc05096"; - cipherText = "d96f20c1a04f7b586f6471489405ecd923e6bd28ab3504626738afd3e8f6c66fbe5c396be92df50528f4e59c752a8d94fd3370bcfa9118ffc6d50aa8f98276ab41601aeee0edaeee3e2a075ffe979d30379a1836d85f0e7f69c73b289605f2499e37d70156d1e13a56062ff61249dad9c4a0dbbfbe00c2a062d506455bbd9638f94002ec2da1c2f42b79d8dfcccc34d8f1c6ce05f44012a8642fa12a751b7a163c781d73687d6715f05001ce002660059cdfbb3785756a79037d2e51dd4426774fa520426b08260466342495cdd35c89aefb55d24c3d9e8cdd1877ca4f763b3dda6ed0780b05bf2b1cb38db04c79d1c8028ec6f170bdd5d36aee5e127c666ce6cf5765669555a1b31e7d4781afe81ae7a61df57ea3ff52cf8c9a4aea7a6f48bec82d0f746efc35c169ba8e61590cb4c6c21e0901e8a211832de25db4e13c73fcd8be3303c99f5d0ba048a626ef2e84c3b093b5b8df986acaaa684571818b6a130d2b0f6b5afb8badd566654b5998839e9eff99d2e2e0f01f0b84a532cd058f94668a258e7c4c4cbe4adea3a8f0b40b81ed3c7b6a1389bb32f3ce7e91572206e9b96349f35a647fc60894af51a5f2be918524d997f166bb1f24db380c002e93da5e9ea523a1fc73661ea3159fc7351cbdb8745d76d72e2caef454b04d5049cf8202bbdce03f9be2df4544e290a582b702b242b6710366a1502c8857eecc7f608d"; - plainText = "a85f46594e831881d9b2f94ab7413c4953598a4a02aa26b3eba1d0ad4979318c019fee0327526255bbfb94af48cb63ea6ca52cc86b2eddd1f8f9683484229b04eb20bba3dd66a987ae25ea0de3d7f06ed7a37dd3e3e31b0eaf2250e5cd1d1dd5ebdd942f2fb0e43777eff8de0012c794ec4c847f0d3f889085c795e649c69156d0bf0639be452ea5e85d96bff4641382eee0903deb41a79a3f3fa3753331bc25b9cf72a367d913090f914a47c25d1eb3a6b5c78ed32e15684bcf70db8d33570c10ea65d2722b7879bdabcb3cc79806f5a7d18ab8100671104c226352a6e63671040350d1432fc0a4802155ed1dcf2dbdd9c7b2bd2bf7e1b05c9f679c50db434040f5af8e86d7891e722830af1889d51f681b6a7b40d7cfd82aff22888fca148301afdba07939242996a33debc67ffe6e1d6048c5ab71e5c04c84ef24bd6bd8bbf82b75bf2322d3fc286f841b1f1f5fb375cd0697647c6797af86c7b4b553ffd6ca37fff508fc1ef408731137a3c200562ef896f286376fa503f5af54ac28b2cf5c862a284660e4761e01cba34ab5ea40dd5ba0059d41e328148c6b197a032271f22fd0dc00cfaec84da30822d9e67bc548aa3eaa4cf51b83b4c878b5daa23ffa4ef4ffbc0ee458b4a060a2dce2144cebb5e3acd5014494a7d6b770a0c7b2e291d6df52411e3b4bbe5cdbe45da964a283d5457201fcfa83eb3521e4c32e9b61c5"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 497; - dataLen = 4096; - combinedKey = "2b850a053287d5e65a70767fc8ac0a38600cebb8e73cb906a0863a06e0cfc9a4"; - iv = "5c4063ec205c866750e038b66df7893c"; - cipherText = "1ffe6987cda60dfe462bd8a32bc1b64e70122872d3336766bf352d908d933de4239683e05394d144be91e201f27c9f15456b216a2d402f1737e70e8087499e23d6c63ad4d517e510a77374d5aef3f0986bee4826cd80b1759fd0672057d30289d82a6a273b4f5926df1e86b9e783d87f28be9145679fb14b1a096d53aeb59674dbed5b1ddd70c0da6963fbb11e6870f829ea7db5b6e17cc42d17aa34cbca15638b1688ed4a162390a456751c42e5f407940f0f8edf31484b5b147ded7e20b92744e0e61efcf7a73716ce5ca6228784e9d7195b9e698bf5e5c83ffd4100f1a3a9494774946055daaa6c2cd0563978a1f5ea0a3b16e786f91b96ff73ae68a1c92e160864704d759667d201ebd9015661a9323f817c79ffd92c0e7559a4f844637626de7fb0c2848c27a511134a558d5f9260e0e49ab0b230b81dc1deca488dc622d73490e8a0a0c974e101eb6093868eda06ec2174d9c34430348f546e34bf30e05694682791cf4445e448252f914ab0bdd997fd795f60ec8815bb00a59b8f8b7f25955fda656681db671bb07719cf729dd3b554a3706fab22b5386f9290081dc81f39da4786ef1924b77bc00f2674ef25a002e0750857295d79180a01af348daba4dd1e0fa2add89bbdee094f6f8237a84f927c37decbbfcb3602fc68e2b4c5e120b444dd76f71e70c973ce3bd6d3c9c44f93945d3931c60570adad58cced9aac"; - plainText = "bcdeef44d16969138c4fda1224136ce1e019ce8fed0102d4b83dc1998b61a4c80bc2db2914b9ba702150ad081c55529773fc01177cdbe34e70ce67758f90f0b7d39771b1e1e43b50f1706eac4fb6abe35b80211b8eea10d05bbcf23b74c4348eca6e9ba8f4ee214c1e2601489d480cd6cced6db384b8b432df03e810327f9c75d37df3f1b83dbc58cdc19a3864ce52304d36e7da1600342cebf48a618a46828d268e4e72f02ed5050a849643772f9ef765078818d5c4a1fd11898bc4608a39f12408bfa11a9fc20140931418b1f1bab1bce47add171be34b1bf2f2809e48f89a08424bf0896d87bd0524d8304ef6c455936e1cf918dc40a1b6d6e5d8f4f797d0aff1ecd6ff1b165014711988f0680c01e2758c5e4213fe2d2eca54cb454b33bc2eb1f9d8d57bd77167ec4359e99e4401445da8e784097bd19dfb2ccabc82142ce3a7fadd63e6ede8cfca157d9c7463ff774adf4c287925d71f2b38182f06962f3b9cc54341ded43f7aecf4e98d6f2aec6399e9b6392172fd4eb14f19b3a1ced2efd4820b9236a6cf22c0d5cfc6b415ce9448676f8d5ff8b3a51dbd60c64c4c2a5ccc2379d5753e9ffe56aa572b7d8d4196a6fcaa3d5655907519c039f92e2fd0a617702ded16449ba639cea90456abc8aaaad4241e7cf4fce4a1ab189fd8e53fe8476345f4c7bf6ceded09552a9f1ce4b782443caa9ec2d4d5eb44e9d8b4cfb2"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 498; - dataLen = 4096; - combinedKey = "fdfaa13b1e7d6ccc944a6cf296bbe610a238bfca37fd9fa689248d9006d21251"; - iv = "45ea5768788b455720c6a46aa09399ae"; - cipherText = "c06bc279f61f3b45b4dbfdd7fe4ed5e4180ba450288e3173126994b2e7605e59a4dc247a5805975c1c1cb489494c9925c97228d76e78abf5fb706cdff92c53683cb965c8d5733e29073a10b34c8125106bfd8369fdbe901c0f8546e147f0c9ebdcfd1cc00ad097abbb04313d38457b9bdbe607ae79c434344b7a3c342b3cd2966ca5d6332b5e5e159f12bb958b4640be969a9cdb756d24c7d18064643438809cf6864b3c9fecc7d3a3983a6d44d41dd577033bb13740e2dca56527404f8743599ca7cda4f5c57fd4d0ba6d611209ab5acdb4aba71121b97c8f2dd72b286ebb21dd8b685883478bcc01b7f11caaceaa12ffee8c1604280cf1b73457df14eca984e8051d7faaa2569136574a5064ba0c1584963a822155a56915ed10ef1d3787bb7fc6f697bebdc2ddfc9a99d518a66bec2ba28c1ed2608cef45664293b45ec60c3e656020871a5e80ed15f0ce017875989139b0ee0b8f66db7802e90253a3a4ca08ea8b100c8f0f5a355d4ca36d200337adb8fcad60e671be2f3a556667d636f84bc18d366bbf8897d5dc065b1a5134a3284f54777931b99455a7512d57c9a0f942f49f7d7b56126623ff6a575a21f374a7c287cce9d3c524da068a52f45a4ea19ea72b43ee3b4b4129ff012e1111c4477f747be2e731f21f7c4c690513990e59a5a0c4573a51bb7ec28268f36d4ed362a6393b9030b637b10553809f01fcb882"; - plainText = "8a5258bc0e300d26aec1d3bed13f77f1b3c79ab17333e0624459c959f56ef86efffb318b663491067fe4931fe5523ab2372d82d1b0bb4359a24fbb906d91f5d6d5a1bfbcd3ffd0726e2d609701fa7c9ec9795d31d48a09332ad57725a94b1dfc96b46fd49e387217562d0ef59181c46c2eeaf8eed3516c05f53b46951b279abbf657f0ea11145f79247c5893930fb16c4e531ab6ffc327657cfaa34cfd7f888b6088661ffc085a85174d4ab46b5277be9a07e617ea659e55cdd19c35462f88f6a775a2e1ddaa924a37d24d1f510707f88fdb371d08d0149bfec813b46ffba14317e738e14b437c34e6fd87d890d45acd00a5c295c64084edd29d86648e1436197997c50ed63c8b939d551c8781697994097a0c639e65bfecffe5268866d58c8691cdfa9bc802bd4033f21863f165707e8f7c97e9d9cc578264d1079580c25d4cf8c9cd78a6662da22c562d379e4360e7d05ce64bb6a391602a30152814dca5a0b805ea4f304c5b3b41e526cd0efc989f5b8f1d86ea76cef1a60940271062dac697e9fd3b35d364791b85f92090416414d4ee285ae12f7bd51aebde6f4dcc5b2a0cec39ea8f7e369f0cd5dee98f9cd5f0abc829eed816a6c46a4b9d51795b7893a7bbd87237500d03abac8f5257e2b495e789f29d671fcc09ff2d8afc12902a5244da7310b8eeb70643eba55d7db24a394c61e8f8109d83ae01e2cb685702f289"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 499; - dataLen = 4096; - combinedKey = "fd6058bbf1f3caa296afec24bf972da1b627e08547aebaec690f147204d324f1"; - iv = "b0c912bbc0c85646891470f564a8a71d"; - cipherText = "ebae2d62859409989ba0bc3801bf6592869b3e0b5a92d1322dc21a1dfc82cb387cf8c5b4e0b4d3f5b3aba0ccf0107492c6adc1dadd9582d6ac64a038fd5a0b073d47d7302570ad3c9b778770ef84b1a759fbb7f3f4d42f4428f08be012aed235d3104354f75faac53c72f4a1d07962803130d2034dae86c5a0464285fed6153e2ce7b9d198f18f954d9aa9487be1cf9b8191269aadd2f0ec08b16d10b466fff26063ebb7e7762b17a790cd3a16fa840054b6197f30295892e742d05f0fb326056f91c78a045f79d59257190248e81dd4d2d47c658f63782b3f90666555d03af36b3a25b921e63388e097355651c3b88de750351dfc10ee1c05ec75614d186625b59888155645781b962bf14a2e53d5a77efad71dec328bc99a8d330129d354d2ceb9e781975f69cc6476df9e2e8b150910e07f03a289f63c813707d277d167795624c98a80b68f6bff6144e946cff384df2b7797750448c7d4bc108a3eafc6101cfbb97f69cc8026d16744a073f47c8c441de0411065b462ec59619afe502b8e17e74876b706958035a3fd1a862d7c0827274dd9ade6962df211678a6cee34fd403431626b4eca05adf5865af005cdba5b2250b71933a2d8d67d8488dd014fb1825cbc8648fddffe512588fbcf7186c8acae8ecc0cfdcaae5d84dbb9fb749477ae4a52445b01971742cff6112f2ebb37ae6cbc082333b3e57c7a30c4c080491f"; - plainText = "a59436eb03f8e2d4a17f8a3020676fd6452827875fb1e0977ace07609d07d2d1eebfcc7bbc5e9544ea50d9ab2e804e78e1f4d1eb91027c2d3ed6e2964b5e142551c65e4d67f428dcb91a5cd699278c92821f676d0b3f3f4ddfcb02e79775c8194914846068530ed7dd5c3ef8ad33b71a1dbb4e4b69b47389308798d32d3b1e0b50bb5fcd4ebe7cb8f9c4c1e71beea8de6952525fd833f4610c78fdbd6c68840d37a10e230a383609a6634beb287ec13e006e882e40fddf013072a185ef2ba306a8ca2bc207a65f2183014cafda16ebfce401a4013b01faa2b6d6ea41c9892fbbc52bd75bc0f5770c90cf17852b8dc2fe5441ac9862fd0860ef177e002887044619cfc080038dd82aa838385dc3486c0cdfef4c9aa611e6bd78567d73402a48687461c70d23896ebdcec20f333e4126b94c630495afff9d73a6596f7285743314cddbc24d0069db5d102213265bc28eec212724080bba619a11781d7f7f78de1e42d5b7f15061d10a94853391451427ac5b656c11a7d0721371411245e0d58f6f8b251d15ae1d1532e232cd4323c3523b40a4f6472ada2688d9eb5b4e541cda5a3422453d05f4ce33fe757f72303ef18b63205ec27f1e1fceefbbcba0d46fb831e90b4d7c8310225fe566c583df2654a1af979d6affd70298e4d3422dbe234d79f57ad3eb37d8f569f3f4efaf4e9062585281ff9d82d99cf0dbdec6154be88612"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - - caseNumber = 500; - dataLen = 4096; - combinedKey = "badfd2102e1e180a634204249c5a6933b2e5d93f9a1cb62ab1ecd419e399dc46"; - iv = "84c06c16c151007ca9ed9bb926e66eec"; - cipherText = "4b52b5e85aecaaaf886bd9e8805390c62e12e13357e4beb3b713e37d217c6f7a9e432a04f87bd8a4dd0ef79eb7bf41b5a2a27e63361d7cb7af7b3c9a8f0b56ae27dc9cfd6c10eb1a79c7be35d31c3965b8e7099775f7644029bd79321f5dd12c55280a30fabd1b95e27c2d4dec6ca4d8716f36e7abe3408f5120560b573e5495ae7aad668fa84d6a8a1156c231a5b6d983ece3e27d199a806dc629c1a60c08ccb0e4807d9fed88f28ce0f59583708f540f97110b2620b1679220abe13e3c4b727186b289794583b20154ce9a07a284df3e63572f462142cae8949d7dd6f2b26fb90d556ec75e93dd33b59d697883312af89e52945b9baedfebe28759cdba4dfbf6e6f201b087478642cf0b34f983593c68947e4ee05bd17716e6cfb7c74c876c0ba650f3979f5eceb72a71d0d46aac4474ae2048d2a9884aa12e292950c77b17de11e8d3e895e60b1c584b1c8d9edd40ba7917e396d1d3bfd1941923aa40213195e8b8f7f4d5ae1057cbecdf89c8959745d1fcece59115819dc661e7b097c132e8f98720a57a83469cb82c374fdebc97badd7cef8d160a7f27d50f35b7e4af6f1b78361828e32a55b25fd56efbc12f8fcb7e2e4f882afa0c7747a455a1fae00a561cbb878e01b32fafb23f397371a8b3441c8da654b902d8489383542188821859a44f0fb2b63a49835f8ba5f0231ff0f8f5fc3d5c812331b11e39bc03394e28"; - plainText = "9f1d65e6a345a2bad796cb1493395fb792a2273de720b9b1b62825eed5042af968c35b17eb2c655ba7b32760cac310ef8869d59b7938f5ed0d07f9988aa543f16e4d8031a07e112e67e8a77434a6a8321d0b1595b21bd459794d4d1dd4935b19b2efbed9b740c4b40c8409b9b83410a2e4f988c93d055d4c6770d71ea3f43024bd2187d6647fd3858521c900f6c8c61bf9cad2c31acdea49246ee15488cc8a066532539401a8a5d88f1fce836bad97948922fbe36c6c1d27f7e6203e601859527aefc655156a42606f159d19b2e03812f311bb0d3469f53e89be04d3dc75d6a1afef7a42ad8859b4e2ca6731e89923178f141c2324b2e52d18374f9c6df9e49c1c4faa4322b093d8ff37a1a11db17724000e58b08c47162614940a852e65ea1e6167721dd473e1e7a9596e1398d4196a7cb83672c93a01db4565056a25c57662f541efabd24d8f739db5c187718b5f78076a99d54bdf46314ce681721b68a02c5a0cbd566b9afecc0fc6f53299f722e7a58f29b374d3bd7b56525118b6f3502ac626e7445bdcf0ce7cfe88d05b04bd50416a3761500748c3cd4d9835a7e571d681a5c47e69b87761be168e9a5857d66ddbb385d6c9a28c11584f86f38e26febf2636fd51ebe5ff851810f73d032d84210f93f4327cd71aceec451ac91bd818f8feda2c365c77d4b6051fe6cdcd2a5816cd6c8cafdc8bd0b74eefd34531d4deb1"; - - - doXTSTestCase(caseNumber, direction, dataLen, iv, cipherText, plainText, combinedKey); - -} DELETED LocalTests/XTSTest/xtsTestVectors.h Index: LocalTests/XTSTest/xtsTestVectors.h ================================================================== --- LocalTests/XTSTest/xtsTestVectors.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * xtsTestVectors.h - * XTSTest - * - * Created by Richard Murphy on 6/24/10. - * Copyright 2010 McKenzie-Murphy. All rights reserved. - * - */ - DELETED LocalTests/ccSymTest.cpp Index: LocalTests/ccSymTest.cpp ================================================================== --- LocalTests/ccSymTest.cpp +++ /dev/null @@ -1,780 +0,0 @@ -/* Copyright 2006 Apple Computer, Inc. - * - * ccSymTest.c - test CommonCrypto symmetric encrypt/decrypt. - */ -#include -#include -#include -#include -#include -#include -#include "common.h" - -/* - * Defaults. - */ -#define LOOPS_DEF 500 -#define MIN_DATA_SIZE 8 -#define MAX_DATA_SIZE 10000 /* bytes */ -#define MAX_KEY_SIZE kCCKeySizeMaxRC4 /* bytes */ -#define MAX_BLOCK_SIZE kCCBlockSizeAES128 /* bytes */ -#define LOOP_NOTIFY 250 - -/* - * Enumerate algs our own way to allow iteration. - */ -typedef enum { - ALG_AES_128 = 1, /* 128 bit block, 128 bit key */ - ALG_AES_192, /* 128 bit block, 192 bit key */ - ALG_AES_256, /* 128 bit block, 256 bit key */ - ALG_DES, - ALG_3DES, - ALG_CAST, - ALG_RC4, - /* these aren't in CommonCrypto (yet?) */ - ALG_RC2, - ALG_RC5, - ALG_BFISH, - ALG_ASC, - ALG_NULL /* normally not used */ -} SymAlg; -#define ALG_FIRST ALG_AES_128 -#define ALG_LAST ALG_RC4 - - -#define LOG_SIZE 0 -#if LOG_SIZE -#define logSize(s) printf s -#else -#define logSize(s) -#endif - -static void usage(char **argv) -{ - printf("usage: %s [options]\n", argv[0]); - printf(" Options:\n"); - printf(" a=algorithm (d=DES; 3=3DES; a=AES128; n=AES192; A=AES256; \n"); - printf(" c=CAST; 4=RC4; default=all)\n"); - printf(" l=loops (default=%d; 0=forever)\n", LOOPS_DEF); - printf(" m=maxPtextSize (default=%d)\n", MAX_DATA_SIZE); - printf(" n=minPtextSize (default=%d)\n", MIN_DATA_SIZE); - printf(" k=keySizeInBytes\n"); - printf(" p=pauseInterval (default=0, no pause)\n"); - printf(" o (no padding, well-aligned plaintext)\n"); - printf(" e (ECB only)\n"); - printf(" E (CBC only, no ECB)\n"); - printf(" u (no multi-update ops)\n"); - printf(" U (only multi-update ops)\n"); - printf(" x (always allocate context)\n"); - printf(" X (never allocate context)\n"); - printf(" v(erbose)\n"); - printf(" q(uiet)\n"); - printf(" h(elp)\n"); - exit(1); -} - -static void printCCError(const char *str, CCCryptorStatus crtn) -{ - const char *errStr; - char unknownStr[200]; - - switch(crtn) { - case kCCSuccess: errStr = "kCCSuccess"; break; - case kCCParamError: errStr = "kCCParamError"; break; - case kCCBufferTooSmall: errStr = "kCCBufferTooSmall"; break; - case kCCMemoryFailure: errStr = "kCCMemoryFailure"; break; - case kCCAlignmentError: errStr = "kCCAlignmentError"; break; - case kCCDecodeError: errStr = "kCCDecodeError"; break; - case kCCUnimplemented: errStr = "kCCUnimplemented"; break; - default: - sprintf(unknownStr, "Unknown(%ld)\n", (long)crtn); - errStr = unknownStr; - break; - } - printf("***%s returned %s\n", str, errStr); -} - -/* max context size */ -#define CC_MAX_CTX_SIZE kCCContextSizeRC4 - -/* - * We write a marker at end of expected output and at end of caller-allocated - * CCCryptorRef, and check at the end to make sure they weren't written - */ -#define MARKER_LENGTH 8 -#define MARKER_BYTE 0x7e - -/* - * Test harness for CCCryptor with lots of options. - */ -CCCryptorStatus doCCCrypt( - bool forEncrypt, - CCAlgorithm encrAlg, - bool doCbc, - bool doPadding, - const void *keyBytes, size_t keyLen, - const void *iv, - bool randUpdates, - bool inPlace, /* !doPadding only */ - size_t ctxSize, /* if nonzero, we allocate ctx */ - bool askOutSize, - const uint8_t *inText, size_t inTextLen, - uint8_t **outText, size_t *outTextLen) /* both returned, WE malloc */ -{ - CCCryptorRef cryptor = NULL; - CCCryptorStatus crtn; - CCOperation op = forEncrypt ? kCCEncrypt : kCCDecrypt; - CCOptions options = 0; - uint8_t *outBuf = NULL; /* mallocd output buffer */ - uint8_t *outp; /* running ptr into outBuf */ - const uint8 *inp; /* running ptr into inText */ - size_t outLen; /* bytes remaining in outBuf */ - size_t toMove; /* bytes remaining in inText */ - size_t thisMoveOut; /* output from CCCryptUpdate()/CCCryptFinal() */ - size_t outBytes; /* total bytes actually produced in outBuf */ - char ctx[CC_MAX_CTX_SIZE]; /* for CCCryptorCreateFromData() */ - uint8_t *textMarker = NULL; /* 8 bytes of marker here after expected end of - * output */ - char *ctxMarker = NULL; /* ditto for caller-provided context */ - unsigned dex; - size_t askedOutSize; /* from the lib */ - size_t thisOutLen; /* dataOutAvailable we use */ - - if(ctxSize > CC_MAX_CTX_SIZE) { - printf("***HEY! Adjust CC_MAX_CTX_SIZE!\n"); - exit(1); - } - if(!doCbc) { - options |= kCCOptionECBMode; - } - if(doPadding) { - options |= kCCOptionPKCS7Padding; - } - - /* just hack this one */ - outLen = inTextLen; - if(forEncrypt) { - outLen += MAX_BLOCK_SIZE; - } - - outBuf = (uint8_t *)malloc(outLen + MARKER_LENGTH); - memset(outBuf, 0xEE, outLen + MARKER_LENGTH); - - /* library should not touch this memory */ - textMarker = outBuf + outLen; - memset(textMarker, MARKER_BYTE, MARKER_LENGTH); - - /* subsequent errors to errOut: */ - - if(inPlace) { - memmove(outBuf, inText, inTextLen); - inp = outBuf; - } - else { - inp = inText; - } - - if(!randUpdates) { - /* one shot */ - if(askOutSize) { - crtn = CCCrypt(op, encrAlg, options, - keyBytes, keyLen, iv, - inp, inTextLen, - outBuf, 0, &askedOutSize); - if(crtn != kCCBufferTooSmall) { - printf("***Did not get kCCBufferTooSmall as expected\n"); - printf(" alg %d inTextLen %lu cbc %d padding %d keyLen %lu\n", - (int)encrAlg, (unsigned long)inTextLen, (int)doCbc, (int)doPadding, - (unsigned long)keyLen); - printCCError("CCCrypt", crtn); - crtn = -1; - goto errOut; - } - outLen = askedOutSize; - } - crtn = CCCrypt(op, encrAlg, options, - keyBytes, keyLen, iv, - inp, inTextLen, - outBuf, outLen, &outLen); - if(crtn) { - printCCError("CCCrypt", crtn); - goto errOut; - } - *outText = outBuf; - *outTextLen = outLen; - goto errOut; - } - - /* random multi updates */ - if(ctxSize) { - size_t ctxSizeCreated; - - if(askOutSize) { - crtn = CCCryptorCreateFromData(op, encrAlg, options, - keyBytes, keyLen, iv, - ctx, 0 /* ctxSize */, - &cryptor, &askedOutSize); - if(crtn != kCCBufferTooSmall) { - printf("***Did not get kCCBufferTooSmall as expected\n"); - printCCError("CCCryptorCreateFromData", crtn); - crtn = -1; - goto errOut; - } - ctxSize = askedOutSize; - } - crtn = CCCryptorCreateFromData(op, encrAlg, options, - keyBytes, keyLen, iv, - ctx, ctxSize, &cryptor, &ctxSizeCreated); - if(crtn) { - printCCError("CCCryptorCreateFromData", crtn); - return crtn; - } - ctxMarker = ctx + ctxSizeCreated; - memset(ctxMarker, MARKER_BYTE, MARKER_LENGTH); - } - else { - crtn = CCCryptorCreate(op, encrAlg, options, - keyBytes, keyLen, iv, - &cryptor); - if(crtn) { - printCCError("CCCryptorCreate", crtn); - return crtn; - } - } - - toMove = inTextLen; /* total to go */ - outp = outBuf; - outBytes = 0; /* bytes actually produced in outBuf */ - - while(toMove) { - uint32 thisMoveIn; /* input to CCryptUpdate() */ - - thisMoveIn = genRand(1, toMove); - logSize(("###ptext segment len %lu\n", (unsigned long)thisMoveIn)); - if(askOutSize) { - thisOutLen = CCCryptorGetOutputLength(cryptor, thisMoveIn, false); - } - else { - thisOutLen = outLen; - } - crtn = CCCryptorUpdate(cryptor, inp, thisMoveIn, - outp, thisOutLen, &thisMoveOut); - if(crtn) { - printCCError("CCCryptorUpdate", crtn); - goto errOut; - } - inp += thisMoveIn; - toMove -= thisMoveIn; - outp += thisMoveOut; - outLen -= thisMoveOut; - outBytes += thisMoveOut; - } - - if(doPadding) { - /* Final is not needed if padding is disabled */ - if(askOutSize) { - thisOutLen = CCCryptorGetOutputLength(cryptor, 0, true); - } - else { - thisOutLen = outLen; - } - crtn = CCCryptorFinal(cryptor, outp, thisOutLen, &thisMoveOut); - } - else { - thisMoveOut = 0; - crtn = kCCSuccess; - } - - if(crtn) { - printCCError("CCCryptorFinal", crtn); - goto errOut; - } - - outBytes += thisMoveOut; - *outText = outBuf; - *outTextLen = outBytes; - crtn = kCCSuccess; - - for(dex=0; dex 31) { - printf("We don't have that many bits\n"); - exit(1); - } - unsigned mask = 1 << bit; - return (word & mask) ? true : false; -} - -int main(int argc, char **argv) -{ - int arg; - char *argp; - unsigned loop; - uint8 *ptext; - size_t ptextLen; - bool stagedEncr = false; - bool stagedDecr = false; - bool doPadding; - bool doCbc = false; - bool nullIV; - const char *algStr; - CCAlgorithm encrAlg; - int i; - int currAlg; // ALG_xxx - uint32 minKeySizeInBytes; - uint32 maxKeySizeInBytes; - uint32 keySizeInBytes = 0; - int rtn = 0; - uint32 blockSize; // for noPadding case - size_t ctxSize; // always set per alg - size_t ctxSizeUsed; // passed to doTest - bool askOutSize; // inquire output size each op - - /* - * User-spec'd params - */ - bool keySizeSpec = false; // false: use rand key size - SymAlg minAlg = ALG_FIRST; - SymAlg maxAlg = ALG_LAST; - unsigned loops = LOOPS_DEF; - bool verbose = false; - size_t minPtextSize = MIN_DATA_SIZE; - size_t maxPtextSize = MAX_DATA_SIZE; - bool quiet = false; - unsigned pauseInterval = 0; - bool paddingSpec = false; // true: user calls doPadding, const - bool cbcSpec = false; // ditto for doCbc - bool stagedSpec = false; // ditto for stagedEncr and stagedDecr - bool inPlace = false; // en/decrypt in place for ECB - bool allocCtxSpec = false; // use allocCtx - bool allocCtx = false; // allocate context ourself - - for(arg=1; arg ALG_LAST) { - /* we left them in the switch but we can't use them */ - usage(argv); - } - break; - case 'l': - loops = atoi(&argp[2]); - break; - case 'n': - minPtextSize = atoi(&argp[2]); - break; - case 'm': - maxPtextSize = atoi(&argp[2]); - break; - case 'k': - minKeySizeInBytes = maxKeySizeInBytes = atoi(&argp[2]); - keySizeSpec = true; - break; - case 'x': - allocCtxSpec = true; - allocCtx = true; - break; - case 'X': - allocCtxSpec = true; - allocCtx = false; - break; - case 'v': - verbose = true; - break; - case 'q': - quiet = true; - break; - case 'p': - pauseInterval = atoi(&argp[2]);; - break; - case 'o': - doPadding = false; - paddingSpec = true; - break; - case 'e': - doCbc = false; - cbcSpec = true; - break; - case 'E': - doCbc = true; - cbcSpec = true; - break; - case 'u': - stagedEncr = false; - stagedDecr = false; - stagedSpec = true; - break; - case 'U': - stagedEncr = true; - stagedDecr = true; - stagedSpec = true; - break; - case 'h': - default: - usage(argv); - } - } - ptext = (uint8 *)malloc(maxPtextSize); - if(ptext == NULL) { - printf("Insufficient heap space\n"); - exit(1); - } - /* ptext length set in test loop */ - - printf("Starting ccSymTest; args: "); - for(i=1; i 0 && !(i%8)) putchar(' '); - if(i > 0 && !(i%64)) putchar('\n'); - printf("%02x", buff[i]); - } - putchar('\n'); -} - -void printByteBuffer(byteBuffer bb, char *name) -{ - printBytes(bb->bytes, bb->len, name); -} - - -byteBuffer -mallocByteBuffer(size_t len) -{ - byteBuffer retval; - if((retval = (byteBuffer) malloc(sizeof(byteBufferStruct) + len + 1)) == NULL) return NULL; - retval->len = len; - retval->bytes = (uint8_t *) (retval + 1) ; /* just past the byteBuffer in malloc'ed space */ - return retval; -} - -/* utility function to convert hex character representation to their nibble (4 bit) values */ -static uint8_t -nibbleFromChar(char c) -{ - if(c >= '0' && c <= '9') return c - '0'; - if(c >= 'a' && c <= 'f') return c - 'a' + 10; - if(c >= 'A' && c <= 'F') return c - 'A' + 10; - return 255; -} - -/* Convert a string of characters representing a hex buffer into a series of bytes of that real value */ -byteBuffer -hexStringToBytes(char *inhex) -{ - byteBuffer retval; - uint8_t *p; - int len, i; - - len = strlen(inhex) / 2; - if((retval = mallocByteBuffer(len)) == NULL) return NULL; - - for(i=0, p = (uint8_t *) inhex; ibytes[i] = (nibbleFromChar(*p) << 4) | nibbleFromChar(*(p+1)); - p += 2; - } - retval->bytes[len] = 0; - return retval; -} - -byteBuffer -bytesToBytes(void *bytes, size_t len) -{ - byteBuffer retval = mallocByteBuffer(len); - memcpy(retval->bytes, bytes, len); - return retval; -} - -int -bytesAreEqual(byteBuffer b1, byteBuffer b2) -{ - if(b1->len != b2->len) return 0; - return (memcmp(b1->bytes, b2->bytes, b1->len) == 0); -} - - -static char byteMap[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; -static int byteMapLen = sizeof(byteMap); - -/* Utility function to convert nibbles (4 bit values) into a hex character representation */ -static char -nibbleToChar(uint8_t nibble) -{ - if(nibble < byteMapLen) return byteMap[nibble]; - return '*'; -} - -/* Convert a buffer of binary values into a hex string representation */ -char -*bytesToHexString(byteBuffer bb) -{ - char *retval; - int i; - - retval = malloc(bb->len*2 + 1); - for(i=0; ilen; i++) { - retval[i*2] = nibbleToChar(bb->bytes[i] >> 4); - retval[i*2+1] = nibbleToChar(bb->bytes[i] & 0x0f); - } - retval[bb->len*2] = 0; - return retval; -} - DELETED LocalTests/testUtil/byteBuffer.h Index: LocalTests/testUtil/byteBuffer.h ================================================================== --- LocalTests/testUtil/byteBuffer.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * printByteBuffer.h - * byteutils - * - */ - -#include -#include -#include -#include - -#ifndef _BYTEBUFFER_H_ -#define _BYTEBUFFER_H_ - -typedef struct byte_buf { - size_t len; - uint8_t *bytes; -} byteBufferStruct, *byteBuffer; - -void printByteBuffer(byteBuffer bb, char *name); - -void printBytes(uint8_t *buff, size_t len, char *name); - -byteBuffer -mallocByteBuffer(size_t len); - -byteBuffer -hexStringToBytes(char *inhex); - -byteBuffer -bytesToBytes(void *bytes, size_t len); - -int -bytesAreEqual(byteBuffer b1, byteBuffer b2); - -char -*bytesToHexString(byteBuffer bytes); - -#endif _BYTEBUFFER_H_ DELETED LocalTests/utilLib/Makefile Index: LocalTests/utilLib/Makefile ================================================================== --- LocalTests/utilLib/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# name of executable to build -EXECUTABLE=libcsputils.a -# C++ source (with .cpp extension) -CPSOURCE= commonCpp.cpp nssAppUtils.cpp ssleayUtils.cpp -# C source (.c extension) -CSOURCE= common.c cspwrap.c fileIo.c bsafeUtils.c t_stdlib.c rijndael-alg-ref.c \ - rijndaelApi.c cputime.c - -# -# project-specific libraries, e.g., -lstdc++ -# -PROJ_LIBS= -# -# Optional lib search paths -# -PROJ_LIBPATH= -# -# choose one for cc -# -VERBOSE= -#VERBOSE=-v - -# -# Other files to remove at 'make clean' time -# -OTHER_TO_CLEAN= - -# -# non-standard frameworks (e.g., -framework foo) -# -PROJ_FRAMEWORKS= - -# -# project-specific includes, with leading -I -# -PROJ_INCLUDES= - -# -# Optional C flags (warnings, optimizations, etc.) -# -#PROJ_CFLAGS= -Os -PROJ_CFLAGS= - -# -# Optional link flags (using cc, not ld) -# -PROJ_LDFLAGS= - -# -# Optional dependencies -# -PROJ_DEPENDS= - -include ../Makefile.lib - -# Special case for this object file...normally we ignore header dependencies, but -# this header is auto generated on a regular basis. -$(OBJROOT)/commonCpp.o: commonCpp.cpp cssmErrorStrings.h - $(CC) $(ALL_CFLAGS) -c -o $(OBJROOT)/commonCpp.o commonCpp.cpp DELETED LocalTests/utilLib/boxes-ref.h Index: LocalTests/utilLib/boxes-ref.h ================================================================== --- LocalTests/utilLib/boxes-ref.h +++ /dev/null @@ -1,85 +0,0 @@ -static const word8 Logtable[256] = { - 0, 0, 25, 1, 50, 2, 26, 198, 75, 199, 27, 104, 51, 238, 223, 3, -100, 4, 224, 14, 52, 141, 129, 239, 76, 113, 8, 200, 248, 105, 28, 193, -125, 194, 29, 181, 249, 185, 39, 106, 77, 228, 166, 114, 154, 201, 9, 120, -101, 47, 138, 5, 33, 15, 225, 36, 18, 240, 130, 69, 53, 147, 218, 142, -150, 143, 219, 189, 54, 208, 206, 148, 19, 92, 210, 241, 64, 70, 131, 56, -102, 221, 253, 48, 191, 6, 139, 98, 179, 37, 226, 152, 34, 136, 145, 16, -126, 110, 72, 195, 163, 182, 30, 66, 58, 107, 40, 84, 250, 133, 61, 186, - 43, 121, 10, 21, 155, 159, 94, 202, 78, 212, 172, 229, 243, 115, 167, 87, -175, 88, 168, 80, 244, 234, 214, 116, 79, 174, 233, 213, 231, 230, 173, 232, - 44, 215, 117, 122, 235, 22, 11, 245, 89, 203, 95, 176, 156, 169, 81, 160, -127, 12, 246, 111, 23, 196, 73, 236, 216, 67, 31, 45, 164, 118, 123, 183, -204, 187, 62, 90, 251, 96, 177, 134, 59, 82, 161, 108, 170, 85, 41, 157, -151, 178, 135, 144, 97, 190, 220, 252, 188, 149, 207, 205, 55, 63, 91, 209, - 83, 57, 132, 60, 65, 162, 109, 71, 20, 42, 158, 93, 86, 242, 211, 171, - 68, 17, 146, 217, 35, 32, 46, 137, 180, 124, 184, 38, 119, 153, 227, 165, -103, 74, 237, 222, 197, 49, 254, 24, 13, 99, 140, 128, 192, 247, 112, 7, -}; - -static const word8 Alogtable[256] = { - 1, 3, 5, 15, 17, 51, 85, 255, 26, 46, 114, 150, 161, 248, 19, 53, - 95, 225, 56, 72, 216, 115, 149, 164, 247, 2, 6, 10, 30, 34, 102, 170, -229, 52, 92, 228, 55, 89, 235, 38, 106, 190, 217, 112, 144, 171, 230, 49, - 83, 245, 4, 12, 20, 60, 68, 204, 79, 209, 104, 184, 211, 110, 178, 205, - 76, 212, 103, 169, 224, 59, 77, 215, 98, 166, 241, 8, 24, 40, 120, 136, -131, 158, 185, 208, 107, 189, 220, 127, 129, 152, 179, 206, 73, 219, 118, 154, -181, 196, 87, 249, 16, 48, 80, 240, 11, 29, 39, 105, 187, 214, 97, 163, -254, 25, 43, 125, 135, 146, 173, 236, 47, 113, 147, 174, 233, 32, 96, 160, -251, 22, 58, 78, 210, 109, 183, 194, 93, 231, 50, 86, 250, 21, 63, 65, -195, 94, 226, 61, 71, 201, 64, 192, 91, 237, 44, 116, 156, 191, 218, 117, -159, 186, 213, 100, 172, 239, 42, 126, 130, 157, 188, 223, 122, 142, 137, 128, -155, 182, 193, 88, 232, 35, 101, 175, 234, 37, 111, 177, 200, 67, 197, 84, -252, 31, 33, 99, 165, 244, 7, 9, 27, 45, 119, 153, 176, 203, 70, 202, - 69, 207, 74, 222, 121, 139, 134, 145, 168, 227, 62, 66, 198, 81, 243, 14, - 18, 54, 90, 238, 41, 123, 141, 140, 143, 138, 133, 148, 167, 242, 13, 23, - 57, 75, 221, 124, 132, 151, 162, 253, 28, 36, 108, 180, 199, 82, 246, 1, -}; - -static const word8 S[256] = { - 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, -202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, -183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, - 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, - 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, - 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, -208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, - 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, -205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, - 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, -224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, -231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, -186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, -112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, -225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, -140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22, -}; - -static const word8 Si[256] = { - 82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, -124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, - 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, - 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, -114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, -108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, -144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, -208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, - 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, -150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, - 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, -252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, - 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, - 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, -160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, - 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125, -}; - -static const word8 iG[4][4] = { -{ 0x0e, 0x09, 0x0d, 0x0b }, -{ 0x0b, 0x0e, 0x09, 0x0d }, -{ 0x0d, 0x0b, 0x0e, 0x09 }, -{ 0x09, 0x0d, 0x0b, 0x0e } -}; - -static const word32 rcon[30] = { - 0x01,0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, }; DELETED LocalTests/utilLib/bsafeUtils.c Index: LocalTests/utilLib/bsafeUtils.c ================================================================== --- LocalTests/utilLib/bsafeUtils.c +++ /dev/null @@ -1,980 +0,0 @@ -/* - * bsafeUtils.c - common routines for CDSA/BSAFE compatibility testing - */ - -#include -#include -#include -#include -#include -#include -#include "bsafeUtils.h" -#include -#include "common.h" - -/* - * Convert between BSAFE ITEM and CSSM_DATA - */ -static inline void buItemToCssmData( - const ITEM *item, - CSSM_DATA_PTR cdata) -{ - cdata->Data = item->data; - cdata->Length = item->len; -} - -static inline void buCssmDataToItem( - const CSSM_DATA *cdata, - ITEM *item) -{ - item->data = cdata->Data; - item->len = cdata->Length; -} - -/* - * BSafe's Chooser table - all we'll ever need. - */ -/*static*/ B_ALGORITHM_METHOD *BSAFE_ALGORITHM_CHOOSER[] = { - // digests - &AM_SHA, - &AM_MD5, - &AM_MD2, - - // organizational - &AM_CBC_ENCRYPT, - &AM_CBC_DECRYPT, - &AM_ECB_ENCRYPT, - &AM_ECB_DECRYPT, - &AM_OFB_ENCRYPT, - &AM_OFB_DECRYPT, - - // DES & variants - &AM_DES_ENCRYPT, - &AM_DES_DECRYPT, - &AM_DESX_ENCRYPT, - &AM_DESX_DECRYPT, - &AM_DES_EDE_ENCRYPT, - &AM_DES_EDE_DECRYPT, - - // RCn stuff - &AM_RC2_CBC_ENCRYPT, - &AM_RC2_CBC_DECRYPT, - &AM_RC2_ENCRYPT, - &AM_RC2_DECRYPT, - &AM_RC4_ENCRYPT, - &AM_RC4_DECRYPT, - &AM_RC5_ENCRYPT, - &AM_RC5_DECRYPT, - &AM_RC5_CBC_ENCRYPT, - &AM_RC5_CBC_DECRYPT, - - // RSA - &AM_RSA_STRONG_KEY_GEN, - &AM_RSA_KEY_GEN, - &AM_RSA_CRT_ENCRYPT_BLIND, - &AM_RSA_CRT_DECRYPT_BLIND, - &AM_RSA_ENCRYPT, - &AM_RSA_DECRYPT, - - // DSA - &AM_DSA_PARAM_GEN, - &AM_DSA_KEY_GEN, - - // signatures - &AM_DSA_SIGN, - &AM_DSA_VERIFY, - - // random number generation - &AM_MD5_RANDOM, - &AM_SHA_RANDOM, - - // sentinel - (B_ALGORITHM_METHOD *)NULL_PTR -}; - -/* - * Convert a BSAFE return to a CSSM error and optionally print the error msg with - * the op in which the error occurred. - */ -static CSSM_RETURN buBsafeErrToCssm( - int brtn, - const char *op) -{ - char *errStr = NULL; - CSSM_RETURN crtn; - - switch (brtn) { - case 0: - return CSSM_OK; - case BE_ALLOC: - crtn = CSSMERR_CSSM_MEMORY_ERROR; - errStr = "BE_ALLOC"; - break; - case BE_SIGNATURE: - crtn = CSSMERR_CSP_VERIFY_FAILED; - errStr = "BE_SIGNATURE"; - break; - case BE_OUTPUT_LEN: - crtn = CSSMERR_CSP_OUTPUT_LENGTH_ERROR; - errStr = "BE_OUTPUT_LEN"; - break; - case BE_INPUT_LEN: - crtn = CSSMERR_CSP_INPUT_LENGTH_ERROR; - errStr = "BE_INPUT_LEN"; - break; - case BE_EXPONENT_EVEN: - crtn = CSSMERR_CSP_INVALID_KEY; - errStr = "BE_EXPONENT_EVEN"; - break; - case BE_EXPONENT_LEN: - crtn = CSSMERR_CSP_INVALID_KEY; - errStr = "BE_EXPONENT_LEN"; - break; - case BE_EXPONENT_ONE: - crtn = CSSMERR_CSP_INVALID_KEY; - errStr = "BE_EXPONENT_ONE"; - break; - case BE_DATA: - crtn = CSSMERR_CSP_INVALID_DATA; - errStr = "BE_DATA"; - break; - case BE_INPUT_DATA: - crtn = CSSMERR_CSP_INVALID_DATA; - errStr = "BE_INPUT_DATA"; - break; - case BE_WRONG_KEY_INFO: - crtn = CSSMERR_CSP_INVALID_KEY; - errStr = "BE_WRONG_KEY_INFO"; - break; - default: - //@@@ translate BSafe errors intelligently - crtn = CSSM_ERRCODE_INTERNAL_ERROR; - errStr = "Other BSAFE error"; - break; - } - if(op != NULL) { - printf("%s: BSAFE error %d (%s)\n", op, brtn, errStr); - } - return crtn; -} - -/* - * Non-thread-safe global random B_ALGORITHM_OBJ and a reusable init for it. - */ -static B_ALGORITHM_OBJ bsafeRng = NULL; -#define BSAFE_RANDSIZE 64 - -static B_ALGORITHM_OBJ buGetRng() -{ - int brtn; - uint8 seed[BSAFE_RANDSIZE]; - - if(bsafeRng != NULL) { - return bsafeRng; - } - brtn = B_CreateAlgorithmObject(&bsafeRng); - if(brtn) { - buBsafeErrToCssm(brtn, "B_CreateAlgorithmObject(&bsafeRng)"); - return NULL; - } - brtn = B_SetAlgorithmInfo(bsafeRng, AI_X962Random_V0, NULL_PTR); - if(brtn) { - buBsafeErrToCssm(brtn, "B_SetAlgorithmInfo(bsafeRng)"); - return NULL; - } - brtn = B_RandomInit(bsafeRng, BSAFE_ALGORITHM_CHOOSER, NULL); - if(brtn) { - buBsafeErrToCssm(brtn, "B_SetAlgorithmInfo(bsafeRng)"); - return NULL; - } - appGetRandomBytes(seed, BSAFE_RANDSIZE); - brtn = B_RandomUpdate(bsafeRng, seed, BSAFE_RANDSIZE, NULL); - if(brtn) { - buBsafeErrToCssm(brtn, "B_RandomUpdate"); - return NULL; - } - return bsafeRng; -} - -/* - * Create a symmetric key. - */ -CSSM_RETURN buGenSymKey( - uint32 keySizeInBits, - const CSSM_DATA *keyData, - BU_KEY *key) // RETURNED -{ - int brtn; - B_KEY_OBJ bkey = NULL; - ITEM item; - unsigned keyBytes = (keySizeInBits + 7) / 8; - - if(keyBytes > keyData->Length) { - /* note it's OK to give us too much key data */ - printf("***buGenSymKey: Insufficient keyData\n"); - return CSSM_ERRCODE_INTERNAL_ERROR; - } - - /* create a BSAFE key */ - brtn = B_CreateKeyObject(&bkey); - if(brtn) { - return buBsafeErrToCssm(brtn, "B_CreateKeyObject"); - } - - /* assign data to the key */ - item.data = keyData->Data; - item.len = keyBytes; - brtn = B_SetKeyInfo(bkey, KI_Item, (POINTER)&item); - if(brtn) { - return buBsafeErrToCssm(brtn, "B_SetKeyInfo"); - } - else { - *key = bkey; - return CSSM_OK; - } -} - -/* - * Create asymmetric key pair. - * FIXME - additional params (e.g. DSA params, RSA exponent)? - */ -CSSM_RETURN buGenKeyPair( - uint32 keySizeInBits, - CSSM_ALGORITHMS keyAlg, // CSSM_ALGID_{RSA,DSA} - BU_KEY *pubKey, // RETURNED - BU_KEY *privKey) // RETURNED -{ - int brtn; - B_KEY_OBJ bPubkey = NULL; - B_KEY_OBJ bPrivkey = NULL; - B_ALGORITHM_OBJ keypairGen = NULL; - char *op = NULL; - A_RSA_KEY_GEN_PARAMS params; - unsigned char exp[1] = { 3 }; - B_ALGORITHM_OBJ genDsaAlg = NULL; - B_ALGORITHM_OBJ dsaResult = NULL; - B_DSA_PARAM_GEN_PARAMS dsaParams; - A_DSA_PARAMS *kParams = NULL; - - /* create algorithm object */ - brtn = B_CreateAlgorithmObject(&keypairGen); - if(brtn) { - return CSSMERR_CSSM_MEMORY_ERROR; - } - - /* create two BSAFE keys */ - brtn = B_CreateKeyObject(&bPubkey); - if(brtn) { - op ="B_CreateKeyObject"; - goto abort; - } - brtn = B_CreateKeyObject(&bPrivkey); - if(brtn) { - op ="B_CreateKeyObject"; - goto abort; - } - switch(keyAlg) { - case CSSM_ALGID_RSA: - { - /* set RSA-specific params */ - params.modulusBits = keySizeInBits; - /* hack - parameterize? */ - params.publicExponent.data = exp; - params.publicExponent.len = 1; - brtn = B_SetAlgorithmInfo(keypairGen, AI_RSAKeyGen, - (POINTER)¶ms); - if(brtn) { - op ="B_SetAlgorithmInfo(AI_RSAKeyGen)"; - } - break; - } - case CSSM_ALGID_DSA: - { - /* jump through hoops generating parameters */ - brtn = B_CreateAlgorithmObject(&genDsaAlg); - if(brtn) { - op ="B_CreateAlgorithmObject"; - break; - } - dsaParams.primeBits = keySizeInBits; - brtn = B_SetAlgorithmInfo(genDsaAlg, AI_DSAParamGen, (POINTER)&dsaParams); - if(brtn) { - op = "B_SetAlgorithmInfo(AI_DSAParamGen)"; - break; - } - brtn = B_GenerateInit(genDsaAlg, BSAFE_ALGORITHM_CHOOSER, NULL); - if(brtn) { - op = "B_GenerateInit(AI_DSAParamGen)"; - break; - } - brtn = B_CreateAlgorithmObject(&dsaResult); - if(brtn) { - op = "B_CreateAlgorithmObject"; - break; - } - brtn = B_GenerateParameters(genDsaAlg, dsaResult, buGetRng(), NULL); - if(brtn) { - op = "B_GenerateParameters"; - break; - } - - /* dsaResult now has the parameters, which we must extract and then - * apply to the keypairGen object. Cool, huh? */ - brtn = B_GetAlgorithmInfo((POINTER *)&kParams, dsaResult, AI_DSAKeyGen); - if(brtn) { - op = "B_GetAlgorithmInfo(AI_DSAKeyGen)"; - break; - } - brtn = B_SetAlgorithmInfo(keypairGen, AI_DSAKeyGen, (POINTER)kParams); - if(brtn) { - op ="B_SetAlgorithmInfo(AI_DSAKeyGen)"; - } - break; - } - default: - printf("buGenKeyPair: algorithm not supported\n"); - return CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED; - } - if(brtn) { - goto abort; - } - - /* keypairGen all set to go. */ - brtn = B_GenerateInit(keypairGen, - BSAFE_ALGORITHM_CHOOSER, - (A_SURRENDER_CTX *)NULL); - if(brtn) { - op = "B_GenerateInit"; - goto abort; - } - brtn = B_GenerateKeypair(keypairGen, - bPubkey, - bPrivkey, - buGetRng(), - NULL); - if(brtn) { - op = "B_GenerateInit"; - } -abort: - B_DestroyAlgorithmObject(&keypairGen); - B_DestroyAlgorithmObject(&genDsaAlg); - B_DestroyAlgorithmObject(&dsaResult); - if(brtn) { - B_DestroyKeyObject(&bPubkey); - B_DestroyKeyObject(&bPrivkey); - return buBsafeErrToCssm(brtn, op); - } - else { - *pubKey = bPubkey; - *privKey = bPrivkey; - return CSSM_OK; - } -} - -/* - * Free a key created in buGenSymKey or buGenKeyPair - */ -CSSM_RETURN buFreeKey( - BU_KEY key) -{ - B_KEY_OBJ bkey = (B_KEY_OBJ)key; - B_DestroyKeyObject(&bkey); - return CSSM_OK; -} - -/* - * encrypt/decrypt - */ -CSSM_RETURN buEncryptDecrypt( - BU_KEY key, - CSSM_BOOL forEncrypt, - CSSM_ALGORITHMS encrAlg, - CSSM_ENCRYPT_MODE mode, // CSSM_ALGMODE_CBC, etc. - const CSSM_DATA *iv, //Êoptional per mode - uint32 effectiveKeyBits, // optional per key alg (actually just RC2) - // for RSA, key size in bits - uint32 rounds, // optional, RC5 only - const CSSM_DATA *inData, - CSSM_DATA_PTR outData) // mallocd and RETURNED -{ - B_ALGORITHM_OBJ alg; - int brtn; - char fbCipher = 1; - uint32 blockSize = 0; - unsigned outBufLen; - unsigned bytesMoved; - CSSM_RETURN crtn; - char useIv; - - // these variables are used in the switch below and need to - // live until after setAlgorithm() - ITEM bsIv; - B_BLK_CIPHER_W_FEEDBACK_PARAMS spec; - A_RC5_PARAMS rc5Params; - A_RC2_PARAMS rc2Params; - - brtn = B_CreateAlgorithmObject(&alg); - if(brtn) { - return buBsafeErrToCssm(brtn, "B_CreateAlgorithmObject"); - } - - /* per-alg setup */ - switch(encrAlg) { - case CSSM_ALGID_RC4: - /* the easy one */ - brtn = B_SetAlgorithmInfo(alg, AI_RC4, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_SetAlgorithmInfo"); - goto abort; - } - fbCipher = 0; - break; - - case CSSM_ALGID_RSA: - /* assume encrypt via publicm decrypt via private */ - if(forEncrypt) { - brtn = B_SetAlgorithmInfo(alg, AI_PKCS_RSAPublic, NULL); - } - else { - brtn = B_SetAlgorithmInfo(alg, AI_PKCS_RSAPrivate, NULL); - } - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_SetAlgorithmInfo(RSA)"); - goto abort; - } - blockSize = (effectiveKeyBits + 7) / 8; - fbCipher = 0; - break; - - /* common code using AI_FeebackCipher */ - case CSSM_ALGID_DES: - spec.encryptionMethodName = (POINTER)"des"; - blockSize = 8; - break; - case CSSM_ALGID_DESX: - spec.encryptionMethodName = (POINTER)"desx"; - blockSize = 8; - break; - case CSSM_ALGID_3DES_3KEY_EDE: - spec.encryptionMethodName = (POINTER)"des_ede"; - blockSize = 8; - break; - case CSSM_ALGID_RC5: - spec.encryptionMethodName = (POINTER)"rc5"; - spec.encryptionParams = (POINTER)&rc5Params; - rc5Params.version = 0x10; - rc5Params.rounds = rounds; - rc5Params.wordSizeInBits = 32; - blockSize = 8; - break; - case CSSM_ALGID_RC2: - spec.encryptionMethodName = (POINTER)"rc2"; - spec.encryptionParams = (POINTER)&rc2Params; - rc2Params.effectiveKeyBits = effectiveKeyBits; - blockSize = 8; - break; - /* add other non-AI_FeebackCipher algorithms here */ - default: - printf("buEncryptDecrypt: unknown algorithm\n"); - return CSSM_ERRCODE_INTERNAL_ERROR; - } - if(fbCipher) { - useIv = 1; // default, except for ECB - switch(mode) { - case CSSM_ALGMODE_CBCPadIV8: - spec.feedbackMethodName = (POINTER)"cbc"; - spec.paddingMethodName = (POINTER)"pad"; - break; - case CSSM_ALGMODE_CBC_IV8: - spec.feedbackMethodName = (POINTER)"cbc"; - spec.paddingMethodName = (POINTER)"nopad"; - break; - case CSSM_ALGMODE_OFB_IV8: - spec.feedbackMethodName = (POINTER)"cbc"; - spec.paddingMethodName = (POINTER)"nopad"; - break; - case CSSM_ALGMODE_ECB: - /* this does not seem to work yet - need info from - * RSA. Specify block size as the feedbackParams (per manual) - * and get a memmove error trying to copy from address 8; specify - * an IV and get BSAFE error 524 (BE_INPUT_DATA) error on the - * EncryptInit. - */ - spec.feedbackMethodName = (POINTER)"ecb"; - spec.paddingMethodName = (POINTER)"nopad"; - //useIv = 0; - //spec.feedbackParams = (POINTER)8; - break; - default: - printf("buEncryptDecrypt: unknown mode\n"); - return CSSM_ERRCODE_INTERNAL_ERROR; - } - if(useIv && (iv != NULL)) { - buCssmDataToItem(iv, &bsIv); - spec.feedbackParams = (POINTER)&bsIv; - } - - brtn = B_SetAlgorithmInfo(alg, AI_FeedbackCipher, (POINTER)&spec); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_SetAlgorithmInfo"); - goto abort; - } - } - - /* - * OK, one way or another we have an algorithm object. Set up - * output buffer. - */ - if(forEncrypt) { - outBufLen = inData->Length + blockSize; - } - else { - outBufLen = inData->Length; - } - outData->Length = 0; - outData->Data = NULL; - crtn = appSetupCssmData(outData, outBufLen); - if(crtn) { - goto abort; - } - if(forEncrypt) { - brtn = B_EncryptInit(alg, - (B_KEY_OBJ)key, - BSAFE_ALGORITHM_CHOOSER, - (A_SURRENDER_CTX *)NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_EncryptInit"); - goto abort; - } - brtn = B_EncryptUpdate(alg, - outData->Data, - &bytesMoved, - outBufLen, - inData->Data, - inData->Length, - buGetRng(), // randAlg - NULL); // surrender - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_EncryptInit"); - goto abort; - } - outData->Length = bytesMoved; - brtn = B_EncryptFinal(alg, - outData->Data + bytesMoved, - &bytesMoved, - outBufLen - outData->Length, - buGetRng(), // randAlg - NULL); // surrender - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_EncryptFinal"); - goto abort; - } - outData->Length += bytesMoved; - crtn = CSSM_OK; - } - else { - brtn = B_DecryptInit(alg, - (B_KEY_OBJ)key, - BSAFE_ALGORITHM_CHOOSER, - (A_SURRENDER_CTX *)NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_DecryptInit"); - goto abort; - } - brtn = B_DecryptUpdate(alg, - outData->Data, - &bytesMoved, - outBufLen, - inData->Data, - inData->Length, - NULL, // randAlg - NULL); // surrender - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_DecryptUpdate"); - goto abort; - } - outData->Length = bytesMoved; - brtn = B_DecryptFinal(alg, - outData->Data + bytesMoved, - &bytesMoved, - outBufLen - outData->Length, - NULL, // randAlg - NULL); // surrender - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_DecryptFinal"); - goto abort; - } - outData->Length += bytesMoved; - crtn = CSSM_OK; - } -abort: - B_DestroyAlgorithmObject(&alg); - return crtn; -} - -/* CSSM sig alg --> B_INFO_TYPE */ -static CSSM_RETURN cssmSigAlgToInfoType( - CSSM_ALGORITHMS cssmAlg, - B_INFO_TYPE *infoType) -{ - switch(cssmAlg) { - case CSSM_ALGID_SHA1WithRSA: - *infoType = AI_SHA1WithRSAEncryption; - break; - case CSSM_ALGID_MD5WithRSA: - *infoType = AI_MD5WithRSAEncryption; - break; - case CSSM_ALGID_SHA1WithDSA: - *infoType = AI_DSAWithSHA1; - break; - default: - printf("cssmSigAlgToInfoType: unknown algorithm\n"); - return CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED; - } - return CSSM_OK; -} - -/* - * Sign/verify - */ -CSSM_RETURN buSign( - BU_KEY key, - CSSM_ALGORITHMS sigAlg, - const CSSM_DATA *ptext, - uint32 keySizeInBits, // to set up sig - CSSM_DATA_PTR sig) // mallocd and RETURNED -{ - B_ALGORITHM_OBJ alg = NULL; - int brtn; - B_INFO_TYPE infoType; - CSSM_RETURN crtn; - unsigned sigBytes; - - brtn = B_CreateAlgorithmObject(&alg); - if(brtn) { - return buBsafeErrToCssm(brtn, "B_CreateAlgorithmObject"); - } - crtn = cssmSigAlgToInfoType(sigAlg, &infoType); - if(crtn) { - return crtn; - } - brtn = B_SetAlgorithmInfo(alg, infoType, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_SetAlgorithmInfo"); - goto abort; - } - brtn = B_SignInit(alg, (B_KEY_OBJ)key, BSAFE_ALGORITHM_CHOOSER, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_SignInit"); - goto abort; - } - brtn = B_SignUpdate(alg, ptext->Data, ptext->Length, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_SignUpdate"); - goto abort; - } - - /* prepare for sig, size of key */ - sigBytes = (keySizeInBits + 7) / 8; - sig->Data = (uint8 *)CSSM_MALLOC(sigBytes); - sig->Length = sigBytes; - - brtn = B_SignFinal(alg, sig->Data, &sigBytes, sigBytes, buGetRng(), NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_SignFinal"); - goto abort; - } - sig->Length = sigBytes; - crtn = CSSM_OK; -abort: - B_DestroyAlgorithmObject(&alg); - return crtn; -} - -CSSM_RETURN buVerify( - BU_KEY key, - CSSM_ALGORITHMS sigAlg, - const CSSM_DATA *ptext, - const CSSM_DATA *sig) // mallocd and RETURNED -{ - B_ALGORITHM_OBJ alg = NULL; - int brtn; - B_INFO_TYPE infoType; - CSSM_RETURN crtn; - - brtn = B_CreateAlgorithmObject(&alg); - if(brtn) { - return buBsafeErrToCssm(brtn, "B_CreateAlgorithmObject"); - } - crtn = cssmSigAlgToInfoType(sigAlg, &infoType); - if(crtn) { - return crtn; - } - brtn = B_SetAlgorithmInfo(alg, infoType, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_SetAlgorithmInfo"); - goto abort; - } - brtn = B_VerifyInit(alg, (B_KEY_OBJ)key, BSAFE_ALGORITHM_CHOOSER, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_VerifyInit"); - goto abort; - } - brtn = B_VerifyUpdate(alg, ptext->Data, ptext->Length, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_VerifyUpdate"); - goto abort; - } - brtn = B_VerifyFinal(alg, sig->Data, sig->Length, buGetRng(), NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_VerifyFinal"); - goto abort; - } - crtn = CSSM_OK; -abort: - B_DestroyAlgorithmObject(&alg); - return crtn; -} - -/* - * generate MAC either one update (updateSizes == NULL) or - * specified set of update sizes. - */ -#define MAX_MAC_SIZE 20 - -CSSM_RETURN buGenMac( - BU_KEY key, // any key, any size - CSSM_ALGORITHMS macAlg, // only CSSM_ALGID_SHA1HMAC for now - const CSSM_DATA *ptext, - unsigned *updateSizes, // NULL --> random updates - // else null-terminated list of sizes - CSSM_DATA_PTR mac) // mallocd and RETURNED -{ - B_ALGORITHM_OBJ alg = NULL; - int brtn; - CSSM_RETURN crtn; - B_DIGEST_SPECIFIER digestInfo; - B_INFO_TYPE infoType; - unsigned macBytes; - - brtn = B_CreateAlgorithmObject(&alg); - if(brtn) { - return buBsafeErrToCssm(brtn, "B_CreateAlgorithmObject"); - } - switch(macAlg) { - case CSSM_ALGID_SHA1HMAC: - case CSSM_ALGID_SHA1HMAC_LEGACY: - digestInfo.digestInfoType = AI_SHA1; - infoType = AI_HMAC; - break; - default: - printf("buGenMac: alg not supported\n"); - return CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED; - } - digestInfo.digestInfoParams = NULL; - brtn = B_SetAlgorithmInfo(alg, infoType, (POINTER)&digestInfo); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_SetAlgorithmInfo"); - goto abort; - } - brtn = B_DigestInit(alg, (B_KEY_OBJ)key, BSAFE_ALGORITHM_CHOOSER, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_DigestInit"); - goto abort; - } - if(updateSizes) { - uint8 *currData = ptext->Data; - while(*updateSizes) { - brtn = B_DigestUpdate(alg, currData, *updateSizes, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_DigestUpdate"); - goto abort; - } - currData += *updateSizes; - updateSizes++; - } - } - else { - /* one-shot */ - brtn = B_DigestUpdate(alg, ptext->Data, ptext->Length, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_DigestUpdate"); - goto abort; - } - } - /* prepare for mac, magically gleaned max size */ - macBytes = MAX_MAC_SIZE; - mac->Data = (uint8 *)CSSM_MALLOC(macBytes); - mac->Length = macBytes; - - brtn = B_DigestFinal(alg, mac->Data, &macBytes, macBytes, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_DigestFinal"); - goto abort; - } - mac->Length = macBytes; - crtn = CSSM_OK; -abort: - B_DestroyAlgorithmObject(&alg); - return crtn; - -} - -/* generate digest */ -#define MAX_DIGEST_SIZE 20 - -CSSM_RETURN buGenDigest( - CSSM_ALGORITHMS macAlg, // CSSM_ALGID_SHA1, etc. */ - const CSSM_DATA *ptext, - CSSM_DATA_PTR digest) // mallocd and RETURNED -{ - B_ALGORITHM_OBJ alg = NULL; - int brtn; - CSSM_RETURN crtn; - B_INFO_TYPE infoType; - unsigned hashBytes; - - brtn = B_CreateAlgorithmObject(&alg); - if(brtn) { - return buBsafeErrToCssm(brtn, "B_CreateAlgorithmObject"); - } - switch(macAlg) { - case CSSM_ALGID_SHA1: - infoType = AI_SHA1; - break; - case CSSM_ALGID_MD5: - infoType = AI_MD5; - break; - case CSSM_ALGID_MD2: - infoType = AI_MD2; - break; - default: - printf("buGenDigest: alg not supported\n"); - return CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED; - } - brtn = B_SetAlgorithmInfo(alg, infoType, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_SetAlgorithmInfo"); - goto abort; - } - brtn = B_DigestInit(alg, NULL, BSAFE_ALGORITHM_CHOOSER, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_DigestInit"); - goto abort; - } - brtn = B_DigestUpdate(alg, ptext->Data, ptext->Length, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_DigestUpdate"); - goto abort; - } - - /* prepare for digest, magically gleaned max size */ - hashBytes = MAX_DIGEST_SIZE; - digest->Data = (uint8 *)CSSM_MALLOC(hashBytes); - digest->Length = hashBytes; - - brtn = B_DigestFinal(alg, digest->Data, &hashBytes, hashBytes, NULL); - if(brtn) { - crtn = buBsafeErrToCssm(brtn, "B_DigestFinal"); - goto abort; - } - digest->Length = hashBytes; - crtn = CSSM_OK; -abort: - B_DestroyAlgorithmObject(&alg); - return crtn; - -} - -/* - * Convert between BSAFE and CDSA private keys - */ -CSSM_RETURN buBsafePrivKeyToCdsa( - CSSM_ALGORITHMS keyAlg, - uint32 keySizeInBits, - BU_KEY bsafePrivKey, - CSSM_KEY_PTR cdsaPrivKey) -{ - B_INFO_TYPE infoType; - ITEM *keyBlob; - int brtn; - CSSM_KEYBLOB_FORMAT format; - CSSM_KEYHEADER_PTR hdr = &cdsaPrivKey->KeyHeader; - - /* what kind of info? */ - switch(keyAlg) { - case CSSM_ALGID_RSA: - infoType = KI_PKCS_RSAPrivateBER; - format = CSSM_KEYBLOB_RAW_FORMAT_PKCS8; - break; - case CSSM_ALGID_DSA: - infoType = KI_DSAPrivateBER; - format = CSSM_KEYBLOB_RAW_FORMAT_FIPS186; - break; - default: - printf("***buBsafePrivKeyToCdsa: bogus keyAlg\n"); - return CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED; - } - - /* get the blob */ - brtn = B_GetKeyInfo((POINTER *)&keyBlob, - (B_KEY_OBJ)bsafePrivKey, - infoType); - if(brtn) { - return buBsafeErrToCssm(brtn, "B_GetKeyInfo"); - } - - /* copy blob to CDSA key */ - cdsaPrivKey->KeyData.Data = (uint8 *)CSSM_MALLOC(keyBlob->len); - cdsaPrivKey->KeyData.Length = keyBlob->len; - memmove(cdsaPrivKey->KeyData.Data, keyBlob->data, keyBlob->len); - - /* set up CSSM key header */ - memset(hdr, 0, sizeof(CSSM_KEYHEADER)); - hdr->HeaderVersion = CSSM_KEYHEADER_VERSION; - hdr->BlobType = CSSM_KEYBLOB_RAW; - hdr->Format = format; - hdr->AlgorithmId = keyAlg; - hdr->KeyClass = CSSM_KEYCLASS_PRIVATE_KEY; - hdr->LogicalKeySizeInBits = keySizeInBits; - hdr->KeyAttr = CSSM_KEYATTR_EXTRACTABLE; - hdr->KeyUsage = CSSM_KEYUSE_ANY; - return CSSM_OK; -} - -CSSM_RETURN buCdsaPrivKeyToBsafe( - CSSM_KEY_PTR cdsaPrivKey, - BU_KEY *bsafePrivKey) -{ - int brtn; - B_KEY_OBJ privKey = NULL; - ITEM keyBlob; - B_INFO_TYPE infoType; - - /* what kind of info? */ - switch(cdsaPrivKey->KeyHeader.AlgorithmId) { - case CSSM_ALGID_RSA: - infoType = KI_PKCS_RSAPrivateBER; - break; - case CSSM_ALGID_DSA: - infoType = KI_DSAPrivateBER; - break; - default: - printf("***buCdsaPrivKeyToCssm: bogus keyAlg\n"); - return CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED; - } - - /* create caller's key, assign blob to it */ - brtn = B_CreateKeyObject(&privKey); - if(brtn) { - return buBsafeErrToCssm(brtn, "B_CreateKeyObject"); - } - buCssmDataToItem(&cdsaPrivKey->KeyData, &keyBlob); - brtn = B_SetKeyInfo(privKey, infoType, (POINTER)&keyBlob); - if(brtn) { - return buBsafeErrToCssm(brtn, "B_SetKeyInfo"); - } - *bsafePrivKey = privKey; - return CSSM_OK; -} - DELETED LocalTests/utilLib/bsafeUtils.h Index: LocalTests/utilLib/bsafeUtils.h ================================================================== --- LocalTests/utilLib/bsafeUtils.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * bsafeUtils.h - common routines for CDSA/BSAFE compatibility testing - */ - -/* - * Clients of this module do not need to know about or see anything from the - * BSAFE headers. - */ -#ifndef _BSAFE_UTILS_H_ -#define _BSAFE_UTILS_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Actually the same as a B_KEY_OBJ, but our callers don't need to know that */ -typedef void *BU_KEY; - -/* - * Create a symmetric key. - */ -CSSM_RETURN buGenSymKey( - uint32 keySizeInBits, - const CSSM_DATA *keyData, - BU_KEY *key); // RETURNED - -/* - * Create asymmetric key pair. - * FIXME - additional params (e.g. DSA params, RSA exponent)? - */ -CSSM_RETURN buGenKeyPair( - uint32 keySizeInBits, - CSSM_ALGORITHMS keyAlg, // CSSM_ALGID_{RSA,DSA} - BU_KEY *pubKey, // RETURNED - BU_KEY *privKey); // RETURNED - -/* - * Free a key created in buGenSymKey or buGenKeyPair - */ -CSSM_RETURN buFreeKey( - BU_KEY key); - -/* - * encrypt/decrypt - */ -CSSM_RETURN buEncryptDecrypt( - BU_KEY key, - CSSM_BOOL forEncrypt, - CSSM_ALGORITHMS encrAlg, - CSSM_ENCRYPT_MODE mode, // CSSM_ALGMODE_CBC, etc. - const CSSM_DATA *iv, //Êoptional per mode - uint32 effectiveKeyBits, // optional per key alg (actually just RC2) - // for RSA, key size in bits - uint32 rounds, // optional, RC5 only - const CSSM_DATA *inData, - CSSM_DATA_PTR outData); // mallocd and RETURNED - -/* - * Sign/verify - */ -CSSM_RETURN buSign( - BU_KEY key, - CSSM_ALGORITHMS sigAlg, - const CSSM_DATA *ptext, - uint32 keySizeInBits, // to set up sig - CSSM_DATA_PTR sig); // mallocd and RETURNED - -CSSM_RETURN buVerify( - BU_KEY key, - CSSM_ALGORITHMS sigAlg, - const CSSM_DATA *ptext, - const CSSM_DATA *sig); // mallocd and RETURNED - -/* - * generate MAC either one update (updateSizes == NULL) or - * specified set of update sizes. - */ -CSSM_RETURN buGenMac( - BU_KEY key, // any key, any size - CSSM_ALGORITHMS macAlg, // only CSSM_ALGID_SHA1HMAC for now - const CSSM_DATA *ptext, - unsigned *updateSizes, // NULL --> random updates - // else null-terminated list of sizes - CSSM_DATA_PTR mac); // mallocd and RETURNED - -/* generate digest */ -CSSM_RETURN buGenDigest( - CSSM_ALGORITHMS macAlg, // CSSM_ALGID_SHA1, etc. */ - const CSSM_DATA *ptext, - CSSM_DATA_PTR digest); // mallocd and RETURNED - -/* - * Convert between BSAFE and CDSA private keys - */ -CSSM_RETURN buBsafePrivKeyToCdsa( - CSSM_ALGORITHMS keyAlg, - uint32 keySizeInBits, - BU_KEY bsafePrivKey, - CSSM_KEY_PTR cdsaPrivKey); -CSSM_RETURN buCdsaPrivKeyToBsafe( - CSSM_KEY_PTR cdsaPrivKey, - BU_KEY *bsafePrivKey); - -#ifdef __cplusplus -} -#endif - -#endif /* _BSAFE_UTILS_H_ */ DELETED LocalTests/utilLib/common.c Index: LocalTests/utilLib/common.c ================================================================== --- LocalTests/utilLib/common.c +++ /dev/null @@ -1,626 +0,0 @@ -/* Copyright 1997 Apple Computer, Inc. - * - * common.c - Common CSP test code - * - * Revision History - * ---------------- - * 4 May 2000 Doug Mitchell - * Ported to X/CDSA2. - * 6 Jul 1998 Doug Mitchell at Apple - * Added clStartup(). - * 12 Aug 1997 Doug Mitchell at Apple - * Created. - */ - -#include -#include -#include -#include -#include "common.h" -#include /* apple, not intel */ -#include - -static CSSM_VERSION vers = {2, 0}; -//const static uint32 guidPrefix = 0xFADE; -const CSSM_GUID testGuid = { 0xFADE, 0, 0, { 1,2,3,4,5,6,7,0 }}; - -/* - * We can't enable this until all of these are fixed and integrated: - * 2890978 CSP - * 2927474 CSPDL - * 2928357 TP - */ -#define DETECT_MALLOC_ABUSE 1 - -#if DETECT_MALLOC_ABUSE - -/* - * This set of allocator functions detects when we free something - * which was mallocd by CDSA or a plugin using something other than - * our callback malloc/realloc/calloc. With proper runtime support - * (which is present in Jaguar 6C35), the reverse is also detected - * by malloc (i.e., we malloc something and CDSA or a plugin frees - * it). - */ -#define APP_MALLOC_MAGIC 'Util' - -void * appMalloc (CSSM_SIZE size, void *allocRef) { - void *ptr; - - /* scribble magic number in first four bytes */ - ptr = malloc(size + 4); - *(uint32 *)ptr = APP_MALLOC_MAGIC; - ptr = (char *)ptr + 4; - - return ptr; -} - -void appFree (void *ptr, void *allocRef) { - if(ptr == NULL) { - return; - } - ptr = (char *)ptr - 4; - if(*(uint32 *)ptr != APP_MALLOC_MAGIC) { - printf("ERROR: appFree() freeing a block that we didn't allocate!\n"); - return; // this free is not safe - } - *(uint32 *)ptr = 0; - free(ptr); -} - -/* Realloc - adjust both original pointer and size */ -void * appRealloc (void *ptr, CSSM_SIZE size, void *allocRef) { - if(ptr == NULL) { - /* no ptr, no existing magic number */ - return appMalloc(size, allocRef); - } - ptr = (char *)ptr - 4; - if(*(uint32 *)ptr != APP_MALLOC_MAGIC) { - printf("ERROR: appRealloc() on a block that we didn't allocate!\n"); - } - *(uint32 *)ptr = 0; - ptr = realloc(ptr, size + 4); - *(uint32 *)ptr = APP_MALLOC_MAGIC; - ptr = (char *)ptr + 4; - return ptr; -} - -/* Have to do this manually */ -void * appCalloc (uint32 num, CSSM_SIZE size, void *allocRef) { - uint32 memSize = num * size; - - void *ptr = appMalloc(memSize, allocRef); - memset(ptr, 0, memSize); - return ptr; -} - -#else /* DETECT_MALLOC_ABUSE */ -/* - * Standard app-level memory functions required by CDSA. - */ -void * appMalloc (CSSM_SIZE size, void *allocRef) { - return( malloc(size) ); -} -void appFree (void *mem_ptr, void *allocRef) { - free(mem_ptr); - return; -} -void * appRealloc (void *ptr, CSSM_SIZE size, void *allocRef) { - return( realloc( ptr, size ) ); -} -void * appCalloc (uint32 num, CSSM_SIZE size, void *allocRef) { - return( calloc( num, size ) ); -} -#endif /* DETECT_MALLOC_ABUSE */ - -static CSSM_API_MEMORY_FUNCS memFuncs = { - appMalloc, - appFree, - appRealloc, - appCalloc, - NULL - }; - -/* - * Init CSSM; returns CSSM_FALSE on error. Reusable. - */ -static CSSM_BOOL cssmInitd = CSSM_FALSE; - -CSSM_BOOL cssmStartup() -{ - CSSM_RETURN crtn; - CSSM_PVC_MODE pvcPolicy = CSSM_PVC_NONE; - - if(cssmInitd) { - return CSSM_TRUE; - } - crtn = CSSM_Init (&vers, - CSSM_PRIVILEGE_SCOPE_NONE, - &testGuid, - CSSM_KEY_HIERARCHY_NONE, - &pvcPolicy, - NULL /* reserved */); - if(crtn != CSSM_OK) - { - printError("CSSM_Init", crtn); - return CSSM_FALSE; - } - else { - cssmInitd = CSSM_TRUE; - return CSSM_TRUE; - } -} - -/* - * Init CSSM and establish a session with the Apple CSP. - */ -CSSM_CSP_HANDLE cspStartup() -{ - return cspDlDbStartup(CSSM_TRUE, NULL); -} - -/* like cspStartup, but also returns DB handle. If incoming dbHandPtr - * is NULL, no DB startup. */ -CSSM_CSP_HANDLE cspDbStartup( - CSSM_DB_HANDLE *dbHandPtr) -{ - return cspDlDbStartup(CSSM_TRUE, NULL); -} - -CSSM_CSP_HANDLE cspDlDbStartup( - CSSM_BOOL bareCsp, // true ==> CSP, false ==> CSP/DL - CSSM_DB_HANDLE *dbHandPtr) // optional - TO BE DELETED -{ - CSSM_CSP_HANDLE cspHand; - CSSM_RETURN crtn; - const CSSM_GUID *guid; - char *modName; - - if(dbHandPtr) { - *dbHandPtr = 0; - } - if(cssmStartup() == CSSM_FALSE) { - return 0; - } - if(bareCsp) { - guid = &gGuidAppleCSP; - modName = (char*) "AppleCSP"; - } - else { - guid = &gGuidAppleCSPDL; - modName = (char *) "AppleCSPDL"; - } - crtn = CSSM_ModuleLoad(guid, - CSSM_KEY_HIERARCHY_NONE, - NULL, // eventHandler - NULL); // AppNotifyCallbackCtx - if(crtn) { - char outStr[100]; - sprintf(outStr, "CSSM_ModuleLoad(%s)", modName); - printError(outStr, crtn); - return 0; - } - crtn = CSSM_ModuleAttach (guid, - &vers, - &memFuncs, // memFuncs - 0, // SubserviceID - CSSM_SERVICE_CSP, - 0, // AttachFlags - CSSM_KEY_HIERARCHY_NONE, - NULL, // FunctionTable - 0, // NumFuncTable - NULL, // reserved - &cspHand); - if(crtn) { - char outStr[100]; - sprintf(outStr, "CSSM_ModuleAttach(%s)", modName); - printError(outStr, crtn); - return 0; - } - return cspHand; -} - -/* - * Detach and unload from a CSP. - */ -CSSM_RETURN cspShutdown( - CSSM_CSP_HANDLE cspHand, - CSSM_BOOL bareCsp) // true ==> CSP, false ==> CSP/DL -{ - CSSM_RETURN crtn; - const CSSM_GUID *guid; - char *modName; - - if(bareCsp) { - guid = &gGuidAppleCSP; - modName = (char *) "AppleCSP"; - } - else { - guid = &gGuidAppleCSPDL; - modName = (char *) "AppleCSPDL"; - } - crtn = CSSM_ModuleDetach(cspHand); - if(crtn) { - printf("Error detaching from %s\n", modName); - printError("CSSM_ModuleDetach", crtn); - return crtn; - } - crtn = CSSM_ModuleUnload(guid, NULL, NULL); - if(crtn) { - printf("Error unloading %s\n", modName); - printError("CSSM_ModuleUnload", crtn); - } - return crtn; -} - -/* Attach to DL side of CSPDL */ -CSSM_DL_HANDLE dlStartup() -{ - CSSM_DL_HANDLE dlHand = 0; - CSSM_RETURN crtn; - - if(cssmStartup() == CSSM_FALSE) { - return 0; - } - crtn = CSSM_ModuleLoad(&gGuidAppleCSPDL, - CSSM_KEY_HIERARCHY_NONE, - NULL, // eventHandler - NULL); // AppNotifyCallbackCtx - if(crtn) { - printError("CSSM_ModuleLoad(Apple CSPDL)", crtn); - return 0; - } - crtn = CSSM_ModuleAttach (&gGuidAppleCSPDL, - &vers, - &memFuncs, // memFuncs - 0, // SubserviceID - CSSM_SERVICE_DL, - 0, // AttachFlags - CSSM_KEY_HIERARCHY_NONE, - NULL, // FunctionTable - 0, // NumFuncTable - NULL, // reserved - &dlHand); - if(crtn) { - printError("CSSM_ModuleAttach(Apple CSPDL)", crtn); - return 0; - } - return dlHand; -} - -/* - * Delete a DB. - */ -#define DELETE_WITH_AUTHENT 0 -CSSM_RETURN dbDelete( - CSSM_DL_HANDLE dlHand, // from dlStartup() - const char *dbName) -{ - return CSSM_DL_DbDelete(dlHand, dbName, NULL, NULL); -} - -/* - * open a DB, ensure it's empty. - */ -CSSM_DB_HANDLE dbStartup( - CSSM_DL_HANDLE dlHand, // from dlStartup() - const char *dbName) -{ - CSSM_DB_HANDLE dbHand = 0; - - CSSM_RETURN crtn = dbCreateOpen(dlHand, dbName, - CSSM_TRUE, // create - CSSM_TRUE, // delete - NULL, // pwd - &dbHand); - if(crtn == CSSM_OK) { - return dbHand; - } - else { - return 0; - } -} - -#if 0 -/* - * Attach to existing DB or create an empty new one. - */ -CSSM_DB_HANDLE dbStartupByName(CSSM_DL_HANDLE dlHand, - char *dbName, - CSSM_BOOL doCreate) -{ - CSSM_RETURN crtn; - CSSM_DB_HANDLE dbHand; - - /* try to open existing DB in either case */ - - crtn = CSSM_DL_DbOpen(dlHand, - dbName, - NULL, // DbLocation - CSSM_DB_ACCESS_READ | CSSM_DB_ACCESS_WRITE, - NULL, // CSSM_ACCESS_CREDENTIALS *AccessCred - NULL, // void *OpenParameters - &dbHand); - if(dbHand != 0) { - return dbHand; - } - if(!doCreate) { - printf("***no such data base (%s)\n", dbName); - printError("CSSM_DL_DbOpen", crtn); - return 0; - } - /* have to create one */ - return dbStartup(dlHand, dbName); -} -#endif - -/* - * routines which convert various types to untyped byte arrays. - */ -void intToBytes(unsigned i, unsigned char *buf) -{ - *buf++ = (unsigned char)((i >> 24) & 0xff); - *buf++ = (unsigned char)((i >> 16) & 0xff); - *buf++ = (unsigned char)((i >> 8) & 0xff); - *buf = (unsigned char)(i & 0xff); -} -void shortToBytes(unsigned short s, unsigned char *buf) -{ - *buf++ = (unsigned char)((s >> 8) & 0xff); - *buf = (unsigned char)(s & 0xff); -} -unsigned bytesToInt(const unsigned char *buf) { - unsigned result; - result = (((unsigned)buf[0] << 24) & 0xff000000) | - (((unsigned)buf[1] << 16) & 0x00ff0000) | - (((unsigned)buf[2] << 8) & 0xff00) | - (((unsigned)buf[3]) & 0xff); - return result; -} -unsigned short bytesToShort(const unsigned char *buf) { - unsigned short result; - result = (((unsigned short)buf[0] << 8) & 0xff00) | - (((unsigned short)buf[1]) & 0xff); - return result; -} - -/* - * Given a context specified via a CSSM_CC_HANDLE, add a new - * CSSM_CONTEXT_ATTRIBUTE to the context as specified by AttributeType, - * AttributeLength, and an untyped pointer. - * - * This is currently used to add a second CSSM_KEY attribute when performing - * ops with algorithm CSSM_ALGID_FEED and CSSM_ALGID_FEECFILE. - */ -CSSM_RETURN AddContextAttribute(CSSM_CC_HANDLE CCHandle, - uint32 AttributeType, - uint32 AttributeLength, - ContextAttrType attrType, - /* specify exactly one of these */ - const void *AttributePtr, - uint32 attributeInt) -{ - CSSM_CONTEXT_ATTRIBUTE newAttr; - CSSM_RETURN crtn; - - newAttr.AttributeType = AttributeType; - newAttr.AttributeLength = AttributeLength; - if(attrType == CAT_Uint32) { - newAttr.Attribute.Uint32 = attributeInt; - } - else { - newAttr.Attribute.Data = (CSSM_DATA_PTR)AttributePtr; - } - crtn = CSSM_UpdateContextAttributes(CCHandle, 1, &newAttr); - if(crtn) { - printError("CSSM_UpdateContextAttributes", crtn); - } - return crtn; -} - -/* - * Set up a CSSM data. - */ -CSSM_RETURN appSetupCssmData( - CSSM_DATA_PTR data, - uint32 numBytes) -{ - if(data == NULL) { - printf("Hey! appSetupCssmData with NULL Data!\n"); - return CSSMERR_CSSM_INTERNAL_ERROR; - } - data->Data = (uint8 *)CSSM_MALLOC(numBytes); - if(data->Data == NULL) { - return CSSMERR_CSSM_MEMORY_ERROR; - } - data->Length = numBytes; - return CSSM_OK; -} - -/* - * Free the data referenced by a CSSM data, and optionally, the struct itself. - */ -void appFreeCssmData(CSSM_DATA_PTR data, - CSSM_BOOL freeStruct) -{ - if(data == NULL) { - return; - } - if(data->Length != 0) { - CSSM_FREE(data->Data); - } - if(freeStruct) { - CSSM_FREE(data); - } - else { - data->Length = 0; - data->Data = NULL; - } -} - -/* - * Copy src to dst, mallocing dst. - */ -CSSM_RETURN appCopyCssmData(const CSSM_DATA *src, - CSSM_DATA_PTR dst) -{ - return appCopyData(src->Data, src->Length, dst); -} - -/* copy raw data to a CSSM_DATA, mallocing dst. */ -CSSM_RETURN appCopyData(const void *src, - uint32 len, - CSSM_DATA_PTR dst) -{ - dst->Length = 0; - if(len == 0) { - dst->Data = NULL; - return CSSM_OK; - } - dst->Data = (uint8 *)CSSM_MALLOC(len); - if(dst->Data == NULL) { - return CSSM_ERRCODE_MEMORY_ERROR; - } - dst->Length = len; - memcpy(dst->Data, src, len); - return CSSM_OK; -} - -CSSM_BOOL appCompareCssmData(const CSSM_DATA *d1, - const CSSM_DATA *d2) -{ - if(d1->Length != d2->Length) { - return CSSM_FALSE; - } - if(memcmp(d1->Data, d2->Data, d1->Length)) { - return CSSM_FALSE; - } - return CSSM_TRUE; -} - -/* min <= return <= max */ -unsigned genRand(unsigned min, unsigned max) -{ - unsigned i; - if(min == max) { - return min; - } - appGetRandomBytes(&i, 4); - return (min + (i % (max - min + 1))); -} - -void simpleGenData(CSSM_DATA_PTR dbuf, unsigned minBufSize, unsigned maxBufSize) -{ - unsigned len = genRand(minBufSize, maxBufSize); - appGetRandomBytes(dbuf->Data, len); - dbuf->Length = len; -} - -#define MIN_OFFSET 0 -#define MAX_OFFSET 99 -#define MIN_ASCII 'a' -#define MAX_ASCII 'z' - -/* - * Calculate random data size, fill dataPool with that many random bytes. - * - * (10**minExp + MIN_OFFSET) <= size <= (10**maxExp + MAX_OFFSET) - */ -unsigned genData(unsigned char *dataPool, - unsigned minExp, - unsigned maxExp, - dataType type) -{ - int exp; - int offset; - int size; - char *cp; - int i; - char ac; - - /* - * Calculate "random" size : (10 ** (random exponent)) + random offset - */ - exp = genRand(minExp, maxExp); - offset = genRand(MIN_OFFSET, MAX_OFFSET); - size = 1; - while(exp--) { // size = 10 ** exp - size *= 10; - } - size += offset; - switch(type) { - case DT_Zero: - bzero(dataPool, size); - break; - case DT_Increment: - { - int i; - for(i=0; i MAX_ASCII) { - ac = MIN_ASCII; - } - } - break; - case DT_Random: - appGetRandomBytes(dataPool, size); - break; - } - return size; -} - -void dumpBuffer( - const char *bufName, // optional - unsigned char *buf, - unsigned len) -{ - unsigned i; - - if(bufName) { - printf("%s\n", bufName); - } - printf(" "); - for(i=0; i - -#ifdef __cplusplus -extern "C" { -#endif - -#undef COMMON_CSSM_MEMORY -#define COMMON_CSSM_MEMORY 0 - -#if COMMON_CSSM_MEMORY -#define CSSM_MALLOC(size) CSSM_Malloc(size) -#define CSSM_FREE(ptr) CSSM_Free(ptr) -#define CSSM_CALLOC(num, size) CSSM_Calloc(num, size) -#define CSSM_REALLOC(ptr, newSize) CSSM_Realloc(ptr, newSize) -/* used in cspwrap when allocating memory on app's behalf */ -#define appMalloc(size, allocRef) CSSM_Malloc(size) - -#else /* !COMMON_CSSM_MEMORY */ - -void * appMalloc (CSSM_SIZE size, void *allocRef); -void appFree (void *mem_ptr, void *allocRef); -void * appRealloc (void *ptr, CSSM_SIZE size, void *allocRef); -void * appCalloc (uint32 num, CSSM_SIZE size, void *allocRef); - -#define CSSM_MALLOC(size) appMalloc(size, NULL) -#define CSSM_FREE(ptr) appFree(ptr, NULL) -#define CSSM_CALLOC(num, size) appCalloc(num, size, NULL) -#define CSSM_REALLOC(ptr, newSize) appRealloc(ptr, newSize, NULL) - -#endif /* COMMON_CSSM_MEMORY */ - -/* - * As of 23 March 1999, there is no longer a "default DB" available for - * generating keys. This is the standard DB handle created when - * calling cspStartup(). - */ -extern CSSM_DB_HANDLE commonDb; - -/* - * Init CSSM; returns CSSM_FALSE on error. Reusable. - */ -extern CSSM_BOOL cssmStartup(); - -/* various flavors of "start up the CSP with optional DB open" */ -CSSM_CSP_HANDLE cspStartup(); // bare bones CSP -CSSM_CSP_HANDLE cspDbStartup( // bare bones CSP, DB open - CSSM_DB_HANDLE *dbHandPtr); -CSSM_DL_HANDLE dlStartup(); -CSSM_CSP_HANDLE cspDlDbStartup( // one size fits all - CSSM_BOOL bareCsp, // true ==> CSP, false ==> CSP/DL - CSSM_DB_HANDLE *dbHandPtr); // optional -CSSM_RETURN cspShutdown( - CSSM_CSP_HANDLE cspHand, - CSSM_BOOL bareCsp); // true ==> CSP, false ==> CSP/DL -CSSM_RETURN dbDelete( - CSSM_DL_HANDLE dlHand, // from dlStartup() - const char *dbName); -CSSM_DB_HANDLE dbStartup( - CSSM_DL_HANDLE dlHand, // from dlStartup() - const char *dbName); -CSSM_RETURN dbCreateOpen( - CSSM_DL_HANDLE dlHand, // from dlStartup() - const char *dbName, - CSSM_BOOL doCreate, // if false, must already exist - CSSM_BOOL deleteExist, - const char *pwd, // optional - CSSM_DB_HANDLE *dbHand); - -extern void intToBytes(unsigned i, unsigned char *buf); -void shortToBytes(unsigned short s, unsigned char *buf); -unsigned bytesToInt(const unsigned char *buf); -unsigned short bytesToShort(const unsigned char *buf); - -/* specify either 32-bit integer or a pointer as an added attribute value */ -typedef enum { - CAT_Uint32, - CAT_Ptr -} ContextAttrType; - -CSSM_RETURN AddContextAttribute(CSSM_CC_HANDLE CCHandle, - uint32 AttributeType, - uint32 AttributeLength, - ContextAttrType attrType, - /* specify exactly one of these */ - const void *AttributePtr, - uint32 attributeInt); -void printError(const char *op, CSSM_RETURN err); -CSSM_RETURN appSetupCssmData( - CSSM_DATA_PTR data, - uint32 numBytes); -void appFreeCssmData(CSSM_DATA_PTR data, - CSSM_BOOL freeStruct); -CSSM_RETURN appCopyCssmData(const CSSM_DATA *src, - CSSM_DATA_PTR dst); -/* copy raw data to a CSSM_DATAm mallocing dst. */ -CSSM_RETURN appCopyData(const void *src, - uint32 len, - CSSM_DATA_PTR dst); - -/* returns CSSM_TRUE on success, else CSSM_FALSE */ -CSSM_BOOL appCompareCssmData(const CSSM_DATA *d1, - const CSSM_DATA *d2); - -const char *cssmErrToStr(CSSM_RETURN err); - -/* - * Calculate random data size, fill dataPool with that many random bytes. - */ -typedef enum { - DT_Random, - DT_Increment, - DT_Zero, - DT_ASCII -} dataType; - -unsigned genData(unsigned char *dataPool, - unsigned minExp, - unsigned maxExp, - dataType type); -void simpleGenData(CSSM_DATA_PTR dbuf, unsigned minBufSize, unsigned maxBufSize); -unsigned genRand(unsigned min, unsigned max); -extern void appGetRandomBytes(void *buf, unsigned len); - -void dumpBuffer( - const char *bufName, // optional - unsigned char *buf, - unsigned len); - -int testError(CSSM_BOOL quiet); - -void testStartBanner( - char *testName, - int argc, - char **argv); - -#ifdef __cplusplus -} - -#endif -#endif /* _UTIL_LIB_COMMON_H_*/ - - DELETED LocalTests/utilLib/commonCpp.cpp Index: LocalTests/utilLib/commonCpp.cpp ================================================================== --- LocalTests/utilLib/commonCpp.cpp +++ /dev/null @@ -1,160 +0,0 @@ -// -// throw C++-dependent stuff in here -// -#include -#include -#include "common.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "cssmErrorStrings.h" /* generated error string table */ - -/* - * Log CSSM error. - */ -void printError(const char *op, CSSM_RETURN err) -{ - cssmPerror(op, err); -} - -const char *cssmErrToStr(CSSM_RETURN err) -{ - const ErrString *esp; - - for(esp=errStrings; esp->errStr!=NULL; esp++) { - if(esp->errCode == err) { - return esp->errStr; - } - } - - static char outbuf[512]; - sprintf(outbuf, "UNKNOWN ERROR CODE %d", (int)err); - return outbuf; -} - - -/* - * Open a DB, optionally: - * - * -- ensuring it's empty - * -- creating it - * -- Specifying optional password to avoid SecurityAgent UI. - */ -CSSM_RETURN dbCreateOpen( - CSSM_DL_HANDLE dlHand, // from dlStartup() - const char *dbName, - CSSM_BOOL doCreate, // if false, must already exist - CSSM_BOOL deleteExist, - const char *pwd, // optional - CSSM_DB_HANDLE *dbHand) -{ - CSSM_RETURN crtn; - CSSM_DBINFO dbInfo; - - if(deleteExist) { - /* first delete possible existing DB, ignore error */ - crtn = dbDelete(dlHand, dbName); - switch(crtn) { - /* only allowed error is "no such file" */ - case CSSM_OK: - case CSSMERR_DL_DATASTORE_DOESNOT_EXIST: - break; - default: - printError("CSSM_DL_DbDelete", crtn); - return crtn; - } - if(!doCreate) { - printf("***Hey! dbCreateOpen with deleteExist and !doCreate\n"); - exit(1); - } - } - else { - /* - * Try to open existing DB. This does not have a means - * to specify password (yet). - */ - crtn = CSSM_DL_DbOpen(dlHand, - dbName, - NULL, // DbLocation - CSSM_DB_ACCESS_READ | CSSM_DB_ACCESS_WRITE, - NULL, // CSSM_ACCESS_CREDENTIALS *AccessCred - NULL, // void *OpenParameters - dbHand); - if(crtn == CSSM_OK) { - return crtn; - } - if(!doCreate) { - printError("CSSM_DL_DbOpen", crtn); - printf("Error opening %s\n", dbName); - return crtn; - } - } - memset(&dbInfo, 0, sizeof(CSSM_DBINFO)); - - /* now create it */ - if(pwd) { - /* - * This glorious code copied from crlRefresh. I didn't pretend - * to understand it when I put it there either. - */ - Allocator &alloc = Allocator::standard(); - CssmClient::AclFactory::PasswordChangeCredentials - pCreds((StringData(pwd)), alloc); - const AccessCredentials* aa = pCreds; - TypedList subject(alloc, CSSM_ACL_SUBJECT_TYPE_ANY); - AclEntryPrototype protoType(subject); - AuthorizationGroup &authGroup = protoType.authorization(); - CSSM_ACL_AUTHORIZATION_TAG tag = CSSM_ACL_AUTHORIZATION_ANY; - authGroup.NumberOfAuthTags = 1; - authGroup.AuthTags = &tag; - - const ResourceControlContext rcc(protoType, - const_cast(aa)); - - crtn = CSSM_DL_DbCreate(dlHand, - dbName, - NULL, // DbLocation - &dbInfo, - // &Security::KeychainCore::Schema::DBInfo, - CSSM_DB_ACCESS_PRIVILEGED, - &rcc, // CredAndAclEntry - NULL, // OpenParameters - dbHand); - } - else { - crtn = CSSM_DL_DbCreate(dlHand, - dbName, - NULL, // DbLocation - &dbInfo, - // &Security::KeychainCore::Schema::DBInfo, - CSSM_DB_ACCESS_PRIVILEGED, - NULL, // CredAndAclEntry - NULL, // OpenParameters - dbHand); - } - if(crtn) { - printError("CSSM_DL_DbCreate", crtn); - } - return crtn; -} - -/* - * *The* way for all tests to get random data. - */ -void appGetRandomBytes(void *buf, unsigned len) -{ - try { - Security::DevRandomGenerator devRand(false); - devRand.random(buf, len); - } - catch(...) { - printf("***Hey! DevRandomGenerator threw an exception!\n"); - /* Yes, exit - I'd really like to catch one of these */ - exit(1); - } -} DELETED LocalTests/utilLib/cputime.c Index: LocalTests/utilLib/cputime.c ================================================================== --- LocalTests/utilLib/cputime.c +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include -#include -#include -#include "cputime.h" - -/* - * This returns the frequency of the TBR in cycles per second. - */ -static double GetTBRFreq(void) { - mach_timebase_info_data_t tinfo; - mach_timebase_info(&tinfo); - - double machRatio = (double)tinfo.numer / (double)tinfo.denom; - return machRatio; -} - -/* - * Return TBR Frequency, getting it lazily once. May not be thread safe. - */ -static double TbrFreqLocal = 0.0; // ration for NANOSECONDS -static double tbrFreq() -{ - if(TbrFreqLocal == 0.0) { - TbrFreqLocal = GetTBRFreq(); - printf("machRatio %e\n", TbrFreqLocal); - } - return TbrFreqLocal; -} - -// seconds -double CPUTimeDeltaSec(CPUTime from, CPUTime to) -{ - CPUTime delta = to - from; - return (double)delta * (tbrFreq() * (double)1e-9); -} - -// milliseconds -double CPUTimeDeltaMs(CPUTime from, CPUTime to) -{ - CPUTime delta = to - from; - return (double)delta * (tbrFreq() * (double)1e-6); -} - -// microseconds -double CPUTimeDeltaUs(CPUTime from, CPUTime to) -{ - CPUTime delta = to - from; - return (double)delta * (tbrFreq() * (double)1e-3); -} - -/* - * Calculate the average of an array of doubles. The lowest and highest values - * are discarded if there are more than two samples. Typically used to get an - * average of a set of values returned from CPUTimeDelta*(). - */ -double CPUTimeAvg( - const double *array, - unsigned arraySize) -{ - double sum = 0; - double lowest = array[0]; - double highest = array[0]; - - unsigned dex; - for(dex=0; dex highest) { - highest = curr; - } - } - if(arraySize > 2) { - sum -= lowest; - sum -= highest; - arraySize -= 2; - } - return sum / (double)arraySize; -} DELETED LocalTests/utilLib/cputime.h Index: LocalTests/utilLib/cputime.h ================================================================== --- LocalTests/utilLib/cputime.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2003 Apple Computer, Inc. All Rights Reserved. - * - * The contents of this file constitute Original Code as defined in and are - * subject to the Apple Public Source License Version 1.2 (the 'License'). - * You may not use this file except in compliance with the License. Please - * obtain a copy of the License at http://www.apple.com/publicsource and - * read it before using this file. - * - * This Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - */ - -/* - * cputime.h - high resolution timing module - * - * This module uses a highly machine-dependent mechanism to get timestamps - * directly from CPU registers, without the overhead of a system call. The - * timestamps are exported as type CPUTime and you should not concern yourself - * with exactly what that is. - * - * We provide routines to convert a difference between two CPUTimes as a double, - * in seconds, milliseconds, and microseconds. Th - * - * The cost (time) of getting a timestamp (via CPUTimeRead()) generally takes - * two or fewer times the resolution period, i.e., less than 80 ns on a 100 MHz - * bus machine, often 40 ns. - * - * The general usage of this module is as follows: - * - * { - * set up test scenario; - * CPUTime startTime = CPUTimeRead(); - * ...critical timed code here... - * CPUTime endTime = CPUTimeRead(); - * double elapsedMilliseconds = CPUTimeDeltaMs(startTime, endTime); - * } - * - * It's crucial to place the CPUTimeDelta*() call OUTSIDE of the critical timed - * area. It's really cheap to snag the timestamps, but it's not at all cheap - * to convert the difference between two timestamps to a double. - */ - -#ifndef _CPUTIME_H_ -#define _CPUTIME_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - - -typedef uint64_t CPUTime; - -/* - * Obtain machine-dependent, high resolution, cheap-to-read timestamp. - */ -#define CPUTimeRead() mach_absolute_time() - -/* - * Convert difference between two CPUTimes into various units. - * Implemented as separate functions to preserve as much precision as possible - * before required machine-dependent "divide by clock frequency". - */ -extern double CPUTimeDeltaSec(CPUTime from, CPUTime to); // seconds -extern double CPUTimeDeltaMs(CPUTime from, CPUTime to); // milliseconds -extern double CPUTimeDeltaUs(CPUTime from, CPUTime to); // microseconds - -/* - * Calculate the average of an array of doubles. The lowest and highest values - * are discarded if there are more than two samples. Typically used to get an - * average of a set of values returned from CPUTimeDelta*(). - */ -double CPUTimeAvg( - const double *array, - unsigned arraySize); - -#ifdef __cplusplus -} -#endif - -#endif /* _CPUTIME_H_ */ - DELETED LocalTests/utilLib/cspdlTesting.h Index: LocalTests/utilLib/cspdlTesting.h ================================================================== --- LocalTests/utilLib/cspdlTesting.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * cspdlTesting.h - workaround flags for testing CSPDL using CSP-oriented tests. - */ - -#ifndef _CSPDL_TESTING_H_ -#define _CSPDL_TESTING_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * All generated keys must be reference keys. - */ -#define CSPDL_ALL_KEYS_ARE_REF 1 - -/* - * 2nd/public key in two-key FEE ops must be raw. This is because the Security - * Server doesn't go in and deal with ref keys which are only found in a - * Context. - */ -#define CSPDL_2ND_PUB_KEY_IS_RAW 1 - -/* - * Ease off on restriction of ptext size == ctext size in case of symmetric - * en/decrypt with no padding. The sizes will be equal, but we can't ensure - * that by mallocing exactly the right amount after because CSPDL doesn't - * give an exact (proper) outputSize in this case (yet). - */ -#define CSPDL_NOPAD_ENFORCE_SIZE 1 - -/* - * CSPDL can't do SHA1HMAC_LEGACY with bug-for-bug compatibility with - * BSAFE (sinceÊthe bug-for-bug feature involves doing actual HMAC updates - * exactly as the app presents them). - */ -#define CSPDL_SHA1HMAC_LEGACY_ENABLE 0 - -/* - * CSPDL does not support DSA GenerateAlgorithmParameters. Let the secure CSP - * do it implicitly during key gen. - */ -#define CSPDL_DSA_GEN_PARAMS 0 - -/* - * Can't generate keys with CSSM_KEYATTR_PRIVATE. Is this a bug or a feature? - * Nobody pays any attention to this except the CSP, which rejects it. Shouldn't - * either CSPDL or SS look at this and strip it off before sending the request - * down to the CSP? - */ -#define CSPDL_KEYATTR_PRIVATE 0 - -/* - * ObtainPrivateKeyFromPublic key not implemented yet (if ever). - */ -#define CSPDL_OBTAIN_PRIV_FROM_PUB 0 - -/*** Workarounds for badattr test only ***/ - -/* - * Munged header fields in a ref key should result in CSP_INVALID_KEY_REFERENCE, - * but work fine. - */ -#define CSPDL_MUNGE_HEADER_CHECK 0 - -/* - * ALWAYS_SENSITIVE, NEVER_EXTRACTABLE are ignored, should result in - * CSP_INVALID_KEYATTR_MASK at key gen time. - * FIXED per Radar 2879872. - */ -#define CSPDL_ALWAYS_SENSITIVE_CHECK 1 -#define CSPDL_NEVER_EXTRACTABLE_CHECK 1 - -/*** end of badattr workarounds ***/ - -/* - * certtool can't generate keypair - * - * Until this is fixed - actually the underlying problem is in securityd - - * CSPDL can not generate a key pair without private and public both being - * PERMANENT. - */ -#define CSPDL_ALL_KEYS_ARE_PERMANENT 0 - - -/*** - *** Other differences/bugs/oddities. - ***/ - -/* - * 1. SS wraps (encrypt) public keys when encoding them, thus the CSP has to allow - * wrapping of public keys. This may not be what we really want. See - * AppleCSP/AppleCSP/wrapKey.cpp for workaround per ALLOW_PUB_KEY_WRAP. - */ - -#ifdef __cplusplus -} -#endif - -#endif /* _CSPDL_TESTING_H_ */ DELETED LocalTests/utilLib/cspwrap.c Index: LocalTests/utilLib/cspwrap.c ================================================================== --- LocalTests/utilLib/cspwrap.c +++ /dev/null @@ -1,3192 +0,0 @@ -/* Copyright 1997 Apple Computer, Inc. - * - * cspwrap.c - wrappers to simplify access to CDSA - * - * Revision History - * ---------------- - * 3 May 2000 Doug Mitchell - * Ported to X/CDSA2. - * 12 Aug 1997 Doug Mitchell at Apple - * Created. - */ - -#include -#include -#include "cspwrap.h" -#include "common.h" -#include -#include -#include -/* MCF hack */ -// #include -#include -/* end MCF */ - -#ifndef NULL -#define NULL ((void *)0) -#endif /* NULL */ -#ifndef MAX -#define MAX(a,b) ((a > b) ? a : b) -#define MIN(a,b) ((a < b) ? a : b) -#endif - -#pragma mark --------- Key Generation --------- - -/* - * Key generation - */ -#define FEE_PRIV_DATA_SIZE 20 -/* - * Debug/test only. BsafeCSP only (long since disabled, in Puma). - * This results in quicker but less secure RSA key generation. - */ -#define RSA_WEAK_KEYS 0 - -/* - * Force bad data in KeyData prior to generating, deriving, or - * wrapping key to ensure that the CSP ignores incoming - * KeyData. - */ -static void setBadKeyData( - CSSM_KEY_PTR key) -{ - key->KeyData.Data = (uint8 *)0xeaaaeaaa; // bad ptr - key->KeyData.Length = 1; // no key can fit here -} - -/* - * Generate key pair of arbitrary algorithm. - * FEE keys will have random private data. - */ -CSSM_RETURN cspGenKeyPair(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, - const char *keyLabel, - unsigned keyLabelLen, - uint32 keySize, // in bits - CSSM_KEY_PTR pubKey, // mallocd by caller - CSSM_BOOL pubIsRef, // true - reference key, false - data - uint32 pubKeyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - CSSM_KEYBLOB_FORMAT pubFormat, // Optional. Specify 0 or CSSM_KEYBLOB_RAW_FORMAT_NONE - // to get the default format. - CSSM_KEY_PTR privKey, // mallocd by caller - CSSM_BOOL privIsRef, // true - reference key, false - data - uint32 privKeyUsage, // CSSM_KEYUSE_DECRYPT, etc. - CSSM_KEYBLOB_FORMAT privFormat, // optional 0 ==> default - CSSM_BOOL genSeed) // FEE only. True: we generate seed and CSP - // will hash it. False: CSP generates random - // seed. -{ - CSSM_RETURN crtn; - CSSM_CC_HANDLE ccHand; - CSSM_DATA privData = {0, NULL}; // mallocd for FEE - CSSM_CRYPTO_DATA privCData; - CSSM_CRYPTO_DATA_PTR privCDataPtr = NULL; - CSSM_DATA keyLabelData; - uint32 pubAttr; - uint32 privAttr; - CSSM_RETURN ocrtn = CSSM_OK; - - /* pre-context-create algorithm-specific stuff */ - switch(algorithm) { - case CSSM_ALGID_FEE: - if(genSeed) { - /* cook up random privData */ - privData.Data = (uint8 *)CSSM_MALLOC(FEE_PRIV_DATA_SIZE); - privData.Length = FEE_PRIV_DATA_SIZE; - appGetRandomBytes(privData.Data, FEE_PRIV_DATA_SIZE); - privCData.Param = privData; - privCData.Callback = NULL; - privCDataPtr = &privCData; - } - /* else CSP generates random seed/key */ - - if(keySize == CSP_KEY_SIZE_DEFAULT) { - keySize = CSP_FEE_KEY_SIZE_DEFAULT; - } - break; - case CSSM_ALGID_RSA: - if(keySize == CSP_KEY_SIZE_DEFAULT) { - keySize = CSP_RSA_KEY_SIZE_DEFAULT; - } - break; - case CSSM_ALGID_DSA: - if(keySize == CSP_KEY_SIZE_DEFAULT) { - keySize = CSP_DSA_KEY_SIZE_DEFAULT; - } - break; - default: - printf("cspGenKeyPair: Unknown algorithm\n"); - /* but what the hey */ - privCDataPtr = NULL; - break; - } - keyLabelData.Data = (uint8 *)keyLabel, - keyLabelData.Length = keyLabelLen; - memset(pubKey, 0, sizeof(CSSM_KEY)); - memset(privKey, 0, sizeof(CSSM_KEY)); - setBadKeyData(pubKey); - setBadKeyData(privKey); - - crtn = CSSM_CSP_CreateKeyGenContext(cspHand, - algorithm, - keySize, - privCDataPtr, // Seed - NULL, // Salt - NULL, // StartDate - NULL, // EndDate - NULL, // Params - &ccHand); - if(crtn) { - printError("CSSM_CSP_CreateKeyGenContext", crtn); - ocrtn = crtn; - goto abort; - } - /* cook up attribute bits */ - if(pubIsRef) { - pubAttr = CSSM_KEYATTR_RETURN_REF | CSSM_KEYATTR_EXTRACTABLE; - } - else { - pubAttr = CSSM_KEYATTR_RETURN_DATA | CSSM_KEYATTR_EXTRACTABLE; - } - if(privIsRef) { - privAttr = CSSM_KEYATTR_RETURN_REF | CSSM_KEYATTR_EXTRACTABLE; - } - else { - privAttr = CSSM_KEYATTR_RETURN_DATA | CSSM_KEYATTR_EXTRACTABLE; - } - - /* post-context-create algorithm-specific stuff */ - switch(algorithm) { - case CSSM_ALGID_RSA: - - #if RSA_WEAK_KEYS - { - /* for testing, speed up key gen by using the - * undocumented "CUSTOM" key gen mode. This - * results in the CSP using AI_RsaKeyGen instead of - * AI_RSAStrongKeyGen. - */ - crtn = AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_MODE, - sizeof(uint32), - CAT_Uint32, - NULL, - CSSM_ALGMODE_CUSTOM); - if(crtn) { - printError("CSSM_UpdateContextAttributes", crtn); - return crtn; - } - } - #endif // RSA_WEAK_KEYS - break; - - case CSSM_ALGID_DSA: - /* - * extra step - generate params - this just adds some - * info to the context - */ - { - CSSM_DATA dummy = {0, NULL}; - crtn = CSSM_GenerateAlgorithmParams(ccHand, - keySize, &dummy); - if(crtn) { - printError("CSSM_GenerateAlgorithmParams", crtn); - return crtn; - } - appFreeCssmData(&dummy, CSSM_FALSE); - } - break; - default: - break; - } - - /* optional format specifiers */ - if(!pubIsRef && (pubFormat != CSSM_KEYBLOB_RAW_FORMAT_NONE)) { - crtn = AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_PUBLIC_KEY_FORMAT, - sizeof(uint32), - CAT_Uint32, - NULL, - pubFormat); - if(crtn) { - printError("AddContextAttribute(CSSM_ATTRIBUTE_PUBLIC_KEY_FORMAT)", crtn); - return crtn; - } - } - if(!privIsRef && (privFormat != CSSM_KEYBLOB_RAW_FORMAT_NONE)) { - crtn = AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_PRIVATE_KEY_FORMAT, - sizeof(uint32), // currently sizeof CSSM_DATA - CAT_Uint32, - NULL, - privFormat); - if(crtn) { - printError("AddContextAttribute(CSSM_ATTRIBUTE_PRIVATE_KEY_FORMAT)", crtn); - return crtn; - } - } - crtn = CSSM_GenerateKeyPair(ccHand, - pubKeyUsage, - pubAttr, - &keyLabelData, - pubKey, - privKeyUsage, - privAttr, - &keyLabelData, // same labels - NULL, // CredAndAclEntry - privKey); - if(crtn) { - printError("CSSM_GenerateKeyPair", crtn); - ocrtn = crtn; - goto abort; - } - /* basic checks...*/ - if(privIsRef) { - if(privKey->KeyHeader.BlobType != CSSM_KEYBLOB_REFERENCE) { - printf("privKey blob type: exp %u got %u\n", - CSSM_KEYBLOB_REFERENCE, (unsigned)privKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } - else { - switch(privKey->KeyHeader.BlobType) { - case CSSM_KEYBLOB_RAW: - break; - default: - printf("privKey blob type: exp raw, got %u\n", - (unsigned)privKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } - if(pubIsRef) { - if(pubKey->KeyHeader.BlobType != CSSM_KEYBLOB_REFERENCE) { - printf("pubKey blob type: exp %u got %u\n", - CSSM_KEYBLOB_REFERENCE, (unsigned)pubKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } - else { - switch(pubKey->KeyHeader.BlobType) { - case CSSM_KEYBLOB_RAW: - break; - default: - printf("pubKey blob type: exp raw or raw_berder, got %u\n", - (unsigned)pubKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } -abort: - if(ccHand != 0) { - crtn = CSSM_DeleteContext(ccHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - } - } - if(privData.Data != NULL) { - CSSM_FREE(privData.Data); - } - return ocrtn; -} - -/* - * Generate FEE key pair with optional primeType, curveType, and seed (password) data. - */ -CSSM_RETURN cspGenFEEKeyPair(CSSM_CSP_HANDLE cspHand, - const char *keyLabel, - unsigned keyLabelLen, - uint32 keySize, // in bits - uint32 primeType, // CSSM_FEE_PRIME_TYPE_MERSENNE, etc. - uint32 curveType, // CSSM_FEE_CURVE_TYPE_MONTGOMERY, etc. - CSSM_KEY_PTR pubKey, // mallocd by caller - CSSM_BOOL pubIsRef, // true - reference key, false - data - uint32 pubKeyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - CSSM_KEYBLOB_FORMAT pubFormat, // Optional. Specify 0 or CSSM_KEYBLOB_RAW_FORMAT_NONE - // to get the default format. - CSSM_KEY_PTR privKey, // mallocd by caller - CSSM_BOOL privIsRef, // true - reference key, false - data - uint32 privKeyUsage, // CSSM_KEYUSE_DECRYPT, etc. - CSSM_KEYBLOB_FORMAT privFormat, // optional 0 ==> default - const CSSM_DATA *seedData) // Present: CSP will hash this for private data. - // NULL: CSP generates random seed. -{ - CSSM_RETURN crtn; - CSSM_CC_HANDLE ccHand; - CSSM_CRYPTO_DATA privCData; - CSSM_CRYPTO_DATA_PTR privCDataPtr = NULL; - CSSM_DATA keyLabelData; - uint32 pubAttr; - uint32 privAttr; - CSSM_RETURN ocrtn = CSSM_OK; - - /* pre-context-create algorithm-specific stuff */ - if(seedData) { - privCData.Param = *((CSSM_DATA_PTR)seedData); - privCData.Callback = NULL; - privCDataPtr = &privCData; - } - /* else CSP generates random seed/key */ - - if(keySize == CSP_KEY_SIZE_DEFAULT) { - keySize = CSP_FEE_KEY_SIZE_DEFAULT; - } - - keyLabelData.Data = (uint8 *)keyLabel, - keyLabelData.Length = keyLabelLen; - memset(pubKey, 0, sizeof(CSSM_KEY)); - memset(privKey, 0, sizeof(CSSM_KEY)); - setBadKeyData(pubKey); - setBadKeyData(privKey); - - crtn = CSSM_CSP_CreateKeyGenContext(cspHand, - CSSM_ALGID_FEE, - keySize, - privCDataPtr, // Seed - NULL, // Salt - NULL, // StartDate - NULL, // EndDate - NULL, // Params - &ccHand); - if(crtn) { - printError("CSSM_CSP_CreateKeyGenContext", crtn); - ocrtn = crtn; - goto abort; - } - /* cook up attribute bits */ - if(pubIsRef) { - pubAttr = CSSM_KEYATTR_RETURN_REF | CSSM_KEYATTR_EXTRACTABLE; - } - else { - pubAttr = CSSM_KEYATTR_RETURN_DATA | CSSM_KEYATTR_EXTRACTABLE; - } - if(privIsRef) { - privAttr = CSSM_KEYATTR_RETURN_REF | CSSM_KEYATTR_EXTRACTABLE; - } - else { - privAttr = CSSM_KEYATTR_RETURN_DATA | CSSM_KEYATTR_EXTRACTABLE; - } - - /* optional post-context-create stuff */ - if(primeType != CSSM_FEE_PRIME_TYPE_DEFAULT) { - crtn = AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_FEE_PRIME_TYPE, - sizeof(uint32), - CAT_Uint32, - NULL, - primeType); - if(crtn) { - printError("AddContextAttribute(CSSM_ATTRIBUTE_FEE_PRIME_TYPE)", crtn); - return crtn; - } - } - if(curveType != CSSM_FEE_CURVE_TYPE_DEFAULT) { - crtn = AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_FEE_CURVE_TYPE, - sizeof(uint32), - CAT_Uint32, - NULL, - curveType); - if(crtn) { - printError("AddContextAttribute(CSSM_ATTRIBUTE_FEE_CURVE_TYPE)", crtn); - return crtn; - } - } - - if(pubFormat != CSSM_KEYBLOB_RAW_FORMAT_NONE) { - crtn = AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_PUBLIC_KEY_FORMAT, - sizeof(uint32), - CAT_Uint32, - NULL, - pubFormat); - if(crtn) { - printError("AddContextAttribute(CSSM_ATTRIBUTE_PUBLIC_KEY_FORMAT)", crtn); - return crtn; - } - } - if(privFormat != CSSM_KEYBLOB_RAW_FORMAT_NONE) { - crtn = AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_PRIVATE_KEY_FORMAT, - sizeof(uint32), // currently sizeof CSSM_DATA - CAT_Uint32, - NULL, - pubFormat); - if(crtn) { - printError("AddContextAttribute(CSSM_ATTRIBUTE_PRIVATE_KEY_FORMAT)", crtn); - return crtn; - } - } - crtn = CSSM_GenerateKeyPair(ccHand, - pubKeyUsage, - pubAttr, - &keyLabelData, - pubKey, - privKeyUsage, - privAttr, - &keyLabelData, // same labels - NULL, // CredAndAclEntry - privKey); - if(crtn) { - printError("CSSM_GenerateKeyPair", crtn); - ocrtn = crtn; - goto abort; - } - /* basic checks...*/ - if(privIsRef) { - if(privKey->KeyHeader.BlobType != CSSM_KEYBLOB_REFERENCE) { - printf("privKey blob type: exp %u got %u\n", - CSSM_KEYBLOB_REFERENCE, (unsigned)privKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } - else { - switch(privKey->KeyHeader.BlobType) { - case CSSM_KEYBLOB_RAW: - break; - default: - printf("privKey blob type: exp raw, got %u\n", - (unsigned)privKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } - if(pubIsRef) { - if(pubKey->KeyHeader.BlobType != CSSM_KEYBLOB_REFERENCE) { - printf("pubKey blob type: exp %u got %u\n", - CSSM_KEYBLOB_REFERENCE, (unsigned)pubKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } - else { - switch(pubKey->KeyHeader.BlobType) { - case CSSM_KEYBLOB_RAW: - break; - default: - printf("pubKey blob type: exp raw or raw_berder, got %u\n", - (unsigned)pubKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } -abort: - if(ccHand != 0) { - crtn = CSSM_DeleteContext(ccHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - } - } - return ocrtn; -} - -/* - * Generate DSA key pair with optional generateAlgParams and optional - * incoming parameters. - */ -CSSM_RETURN cspGenDSAKeyPair(CSSM_CSP_HANDLE cspHand, - const char *keyLabel, - unsigned keyLabelLen, - uint32 keySize, // in bits - CSSM_KEY_PTR pubKey, // mallocd by caller - CSSM_BOOL pubIsRef, // true - reference key, false - data - uint32 pubKeyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - CSSM_KEYBLOB_FORMAT pubFormat, // Optional. Specify 0 or CSSM_KEYBLOB_RAW_FORMAT_NONE - // to get the default format. - CSSM_KEY_PTR privKey, // mallocd by caller - CSSM_BOOL privIsRef, // true - reference key, false - data - uint32 privKeyUsage, // CSSM_KEYUSE_DECRYPT, etc. - CSSM_KEYBLOB_FORMAT privFormat, // Optional. Specify 0 or CSSM_KEYBLOB_RAW_FORMAT_NONE - // to get the default format. - CSSM_BOOL genParams, - CSSM_DATA_PTR paramData) // optional -{ - CSSM_RETURN crtn; - CSSM_CC_HANDLE ccHand; - CSSM_DATA keyLabelData; - uint32 pubAttr; - uint32 privAttr; - CSSM_RETURN ocrtn = CSSM_OK; - - if(keySize == CSP_KEY_SIZE_DEFAULT) { - keySize = CSP_DSA_KEY_SIZE_DEFAULT; - } - keyLabelData.Data = (uint8 *)keyLabel, - keyLabelData.Length = keyLabelLen; - memset(pubKey, 0, sizeof(CSSM_KEY)); - memset(privKey, 0, sizeof(CSSM_KEY)); - setBadKeyData(pubKey); - setBadKeyData(privKey); - - crtn = CSSM_CSP_CreateKeyGenContext(cspHand, - CSSM_ALGID_DSA, - keySize, - NULL, // Seed - NULL, // Salt - NULL, // StartDate - NULL, // EndDate - paramData, - &ccHand); - if(crtn) { - printError("CSSM_CSP_CreateKeyGenContext", crtn); - ocrtn = crtn; - goto abort; - } - - /* cook up attribute bits */ - if(pubIsRef) { - pubAttr = CSSM_KEYATTR_RETURN_REF | CSSM_KEYATTR_EXTRACTABLE; - } - else { - pubAttr = CSSM_KEYATTR_RETURN_DATA | CSSM_KEYATTR_EXTRACTABLE; - } - if(privIsRef) { - privAttr = CSSM_KEYATTR_RETURN_REF | CSSM_KEYATTR_EXTRACTABLE; - } - else { - privAttr = CSSM_KEYATTR_RETURN_DATA | CSSM_KEYATTR_EXTRACTABLE; - } - - if(genParams) { - /* - * extra step - generate params - this just adds some - * info to the context - */ - CSSM_DATA dummy = {0, NULL}; - crtn = CSSM_GenerateAlgorithmParams(ccHand, - keySize, &dummy); - if(crtn) { - printError("CSSM_GenerateAlgorithmParams", crtn); - return crtn; - } - appFreeCssmData(&dummy, CSSM_FALSE); - } - - /* optional format specifiers */ - if(!pubIsRef && (pubFormat != CSSM_KEYBLOB_RAW_FORMAT_NONE)) { - crtn = AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_PUBLIC_KEY_FORMAT, - sizeof(uint32), - CAT_Uint32, - NULL, - pubFormat); - if(crtn) { - printError("AddContextAttribute(CSSM_ATTRIBUTE_PUBLIC_KEY_FORMAT)", crtn); - return crtn; - } - } - if(!privIsRef && (privFormat != CSSM_KEYBLOB_RAW_FORMAT_NONE)) { - crtn = AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_PRIVATE_KEY_FORMAT, - sizeof(uint32), // currently sizeof CSSM_DATA - CAT_Uint32, - NULL, - privFormat); - if(crtn) { - printError("AddContextAttribute(CSSM_ATTRIBUTE_PRIVATE_KEY_FORMAT)", crtn); - return crtn; - } - } - - crtn = CSSM_GenerateKeyPair(ccHand, - pubKeyUsage, - pubAttr, - &keyLabelData, - pubKey, - privKeyUsage, - privAttr, - &keyLabelData, // same labels - NULL, // CredAndAclEntry - privKey); - if(crtn) { - printError("CSSM_GenerateKeyPair", crtn); - ocrtn = crtn; - goto abort; - } - /* basic checks...*/ - if(privIsRef) { - if(privKey->KeyHeader.BlobType != CSSM_KEYBLOB_REFERENCE) { - printf("privKey blob type: exp %u got %u\n", - CSSM_KEYBLOB_REFERENCE, (unsigned)privKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } - else { - switch(privKey->KeyHeader.BlobType) { - case CSSM_KEYBLOB_RAW: - break; - default: - printf("privKey blob type: exp raw, got %u\n", - (unsigned)privKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } - if(pubIsRef) { - if(pubKey->KeyHeader.BlobType != CSSM_KEYBLOB_REFERENCE) { - printf("pubKey blob type: exp %u got %u\n", - CSSM_KEYBLOB_REFERENCE, (unsigned)pubKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } - else { - switch(pubKey->KeyHeader.BlobType) { - case CSSM_KEYBLOB_RAW: - break; - default: - printf("pubKey blob type: exp raw or raw_berder, got %u\n", - (unsigned)pubKey->KeyHeader.BlobType); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - goto abort; - } - } -abort: - if(ccHand != 0) { - crtn = CSSM_DeleteContext(ccHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = CSSM_ERRCODE_INTERNAL_ERROR; - } - } - return ocrtn; -} - - -uint32 cspDefaultKeySize(uint32 alg) -{ - uint32 keySizeInBits; - switch(alg) { - case CSSM_ALGID_DES: - keySizeInBits = CSP_DES_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_3DES_3KEY: - case CSSM_ALGID_DESX: - keySizeInBits = CSP_DES3_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_RC2: - keySizeInBits = CSP_RC2_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_RC4: - keySizeInBits = CSP_RC4_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_RC5: - keySizeInBits = CSP_RC5_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_ASC: - keySizeInBits = CSP_ASC_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_BLOWFISH: - keySizeInBits = CSP_BFISH_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_CAST: - keySizeInBits = CSP_CAST_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_IDEA: - keySizeInBits = CSP_IDEA_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_AES: - keySizeInBits = CSP_AES_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_SHA1HMAC: - keySizeInBits = CSP_HMAC_SHA_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_MD5HMAC: - keySizeInBits = CSP_HMAC_MD5_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_FEE: - keySizeInBits = CSP_FEE_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_RSA: - keySizeInBits = CSP_RSA_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_DSA: - keySizeInBits = CSP_DSA_KEY_SIZE_DEFAULT; - break; - case CSSM_ALGID_NONE: - keySizeInBits = CSP_NULL_CRYPT_KEY_SIZE_DEF; - break; - default: - printf("***cspDefaultKeySize: Unknown symmetric algorithm\n"); - keySizeInBits = 0; - break; - } - return keySizeInBits; -} - -/* - * Create a random symmetric key. - */ -CSSM_KEY_PTR cspGenSymKey(CSSM_CSP_HANDLE cspHand, - uint32 alg, - const char *keyLabel, - unsigned keyLabelLen, - uint32 keyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - uint32 keySizeInBits, - CSSM_BOOL refKey) -{ - CSSM_KEY_PTR symKey = (CSSM_KEY_PTR)CSSM_MALLOC(sizeof(CSSM_KEY)); - CSSM_RETURN crtn; - CSSM_CC_HANDLE ccHand; - uint32 keyAttr; - CSSM_DATA dummyLabel; - - if(symKey == NULL) { - printf("Insufficient heap space\n"); - return NULL; - } - memset(symKey, 0, sizeof(CSSM_KEY)); - setBadKeyData(symKey); - if(keySizeInBits == CSP_KEY_SIZE_DEFAULT) { - keySizeInBits = cspDefaultKeySize(alg); - } - crtn = CSSM_CSP_CreateKeyGenContext(cspHand, - alg, - keySizeInBits, // keySizeInBits - NULL, // Seed - NULL, // Salt - NULL, // StartDate - NULL, // EndDate - NULL, // Params - &ccHand); - if(crtn) { - printError("CSSM_CSP_CreateKeyGenContext", crtn); - goto errorOut; - } - if(refKey) { - keyAttr = CSSM_KEYATTR_RETURN_REF | CSSM_KEYATTR_EXTRACTABLE; - } - else { - keyAttr = CSSM_KEYATTR_RETURN_DATA | CSSM_KEYATTR_EXTRACTABLE; - } - dummyLabel.Length = keyLabelLen; - dummyLabel.Data = (uint8 *)keyLabel; - - crtn = CSSM_GenerateKey(ccHand, - keyUsage, - keyAttr, - &dummyLabel, - NULL, // ACL - symKey); - if(crtn) { - printError("CSSM_GenerateKey", crtn); - goto errorOut; - } - crtn = CSSM_DeleteContext(ccHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - goto errorOut; - } - return symKey; -errorOut: - CSSM_FREE(symKey); - return NULL; -} - -/* - * Derive symmetric key. - * Note in the X CSP, we never return an IV. - */ -CSSM_KEY_PTR cspDeriveKey(CSSM_CSP_HANDLE cspHand, - uint32 deriveAlg, // CSSM_ALGID_PKCS5_PBKDF2, etc. - uint32 keyAlg, // CSSM_ALGID_RC5, etc. - const char *keyLabel, - unsigned keyLabelLen, - uint32 keyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - uint32 keySizeInBits, - CSSM_BOOL isRefKey, - CSSM_DATA_PTR password, // in PKCS-5 lingo - CSSM_DATA_PTR salt, // ditto - uint32 iterationCnt, // ditto - CSSM_DATA_PTR initVector) // mallocd & RETURNED -{ - CSSM_KEY_PTR symKey = (CSSM_KEY_PTR) - CSSM_MALLOC(sizeof(CSSM_KEY)); - CSSM_RETURN crtn; - CSSM_CC_HANDLE ccHand; - uint32 keyAttr; - CSSM_DATA dummyLabel; - CSSM_PKCS5_PBKDF2_PARAMS pbeParams; - CSSM_DATA pbeData; - CSSM_ACCESS_CREDENTIALS creds; - - if(symKey == NULL) { - printf("Insufficient heap space\n"); - return NULL; - } - memset(symKey, 0, sizeof(CSSM_KEY)); - setBadKeyData(symKey); - memset(&creds, 0, sizeof(CSSM_ACCESS_CREDENTIALS)); - if(keySizeInBits == CSP_KEY_SIZE_DEFAULT) { - keySizeInBits = cspDefaultKeySize(keyAlg); - } - crtn = CSSM_CSP_CreateDeriveKeyContext(cspHand, - deriveAlg, - keyAlg, - keySizeInBits, - &creds, - NULL, // BaseKey - iterationCnt, - salt, - NULL, // seed - &ccHand); - if(crtn) { - printError("CSSM_CSP_CreateDeriveKeyContext", crtn); - goto errorOut; - } - keyAttr = CSSM_KEYATTR_EXTRACTABLE; - if(isRefKey) { - keyAttr |= (CSSM_KEYATTR_RETURN_REF | CSSM_KEYATTR_SENSITIVE); - } - else { - keyAttr |= CSSM_KEYATTR_RETURN_DATA; - } - dummyLabel.Length = keyLabelLen; - dummyLabel.Data = (uint8 *)keyLabel; - - /* passing in password is pretty strange....*/ - pbeParams.Passphrase = *password; - pbeParams.PseudoRandomFunction = - CSSM_PKCS5_PBKDF2_PRF_HMAC_SHA1; - pbeData.Data = (uint8 *)&pbeParams; - pbeData.Length = sizeof(pbeParams); - crtn = CSSM_DeriveKey(ccHand, - &pbeData, - keyUsage, - keyAttr, - &dummyLabel, - NULL, // cred and acl - symKey); - if(crtn) { - printError("CSSM_DeriveKey", crtn); - goto errorOut; - } - /* copy IV back to caller */ - /* Nope, not supported */ - #if 0 - if(pbeParams.InitVector.Data != NULL) { - if(initVector->Data != NULL) { - if(initVector->Length < pbeParams.InitVector.Length) { - printf("***Insufficient InitVector\n"); - goto errorOut; - } - } - else { - initVector->Data = - (uint8 *)CSSM_MALLOC(pbeParams.InitVector.Length); - } - memmove(initVector->Data, pbeParams.InitVector.Data, - pbeParams.InitVector.Length); - initVector->Length = pbeParams.InitVector.Length; - CSSM_FREE(pbeParams.InitVector.Data); - } - else { - printf("***Warning: CSSM_DeriveKey, no InitVector\n"); - } - #endif - crtn = CSSM_DeleteContext(ccHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - goto errorOut; - } - return symKey; -errorOut: - CSSM_FREE(symKey); - return NULL; -} - -/* - * Cook up a symmetric key with specified key bits and other - * params. Currently the CSPDL can only deal with reference keys except when - * doing wrap/unwrap, so we manually cook up a raw key, then we null-unwrap it. - */ -CSSM_RETURN cspGenSymKeyWithBits( - CSSM_CSP_HANDLE cspHand, - CSSM_ALGORITHMS keyAlg, - CSSM_KEYUSE keyUsage, - const CSSM_DATA *keyBits, - unsigned keySizeInBytes, - CSSM_KEY_PTR refKey) // init'd and RETURNED -{ - CSSM_KEY rawKey; - CSSM_KEYHEADER_PTR hdr = &rawKey.KeyHeader; - CSSM_RETURN crtn; - - /* set up a raw key the CSP will accept */ - memset(&rawKey, 0, sizeof(CSSM_KEY)); - hdr->HeaderVersion = CSSM_KEYHEADER_VERSION; - hdr->BlobType = CSSM_KEYBLOB_RAW; - hdr->Format = CSSM_KEYBLOB_RAW_FORMAT_OCTET_STRING; - hdr->AlgorithmId = keyAlg; - hdr->KeyClass = CSSM_KEYCLASS_SESSION_KEY; - hdr->LogicalKeySizeInBits = keySizeInBytes * 8; - hdr->KeyAttr = CSSM_KEYATTR_EXTRACTABLE; - hdr->KeyUsage = keyUsage; - appSetupCssmData(&rawKey.KeyData, keySizeInBytes); - memmove(rawKey.KeyData.Data, keyBits->Data, keySizeInBytes); - - /* convert to a ref key */ - crtn = cspRawKeyToRef(cspHand, &rawKey, refKey); - appFreeCssmData(&rawKey.KeyData, CSSM_FALSE); - return crtn; -} - -/* - * Free a key. This frees a CSP's resources associated with the key if - * the key is a reference key. It also frees key->KeyData. The CSSM_KEY - * struct itself is not freed. - * Note this has no effect on the CSP or DL cached keys unless the incoming - * key is a reference key. - */ -CSSM_RETURN cspFreeKey(CSSM_CSP_HANDLE cspHand, - CSSM_KEY_PTR key) -{ - CSSM_RETURN crtn; - crtn = CSSM_FreeKey(cspHand, - NULL, // access cred - key, - CSSM_FALSE); // delete - OK? maybe should parameterize? - if(crtn) { - printError("CSSM_FreeKey", crtn); - } - return crtn; -} - -/* generate a random and reasonable key size in bits for specified CSSM algorithm */ -uint32 randKeySizeBits(uint32 alg, - opType op) // OT_Encrypt, etc. -{ - uint32 minSize; - uint32 maxSize; - uint32 size; - - switch(alg) { - case CSSM_ALGID_DES: - return CSP_DES_KEY_SIZE_DEFAULT; - case CSSM_ALGID_3DES_3KEY: - case CSSM_ALGID_DESX: - return CSP_DES3_KEY_SIZE_DEFAULT; - case CSSM_ALGID_ASC: - case CSSM_ALGID_RC2: - case CSSM_ALGID_RC4: - case CSSM_ALGID_RC5: - minSize = 5 * 8; - maxSize = MAX_KEY_SIZE_RC245_BYTES * 8 ; // somewhat arbitrary - break; - case CSSM_ALGID_BLOWFISH: - minSize = 32; - maxSize = 448; - break; - case CSSM_ALGID_CAST: - minSize = 40; - maxSize = 128; - break; - case CSSM_ALGID_IDEA: - return CSP_IDEA_KEY_SIZE_DEFAULT; - case CSSM_ALGID_RSA: - minSize = CSP_RSA_KEY_SIZE_DEFAULT; - maxSize = 1024; - break; - case CSSM_ALGID_DSA: - /* signature only, no export restriction */ - minSize = 512; - maxSize = 1024; - break; - case CSSM_ALGID_SHA1HMAC: - minSize = 20 * 8; - maxSize = 256 * 8; - break; - case CSSM_ALGID_MD5HMAC: - minSize = 16 * 8; - maxSize = 256 * 8; - break; - case CSSM_ALGID_FEE: - case CSSM_ALGID_ECDSA: - case CSSM_ALGID_SHA1WithECDSA: - /* FEE, ECDSA require discrete sizes */ - size = genRand(1,3); - switch(size) { - case 1: - return 31; - case 2: - if(alg == CSSM_ALGID_FEE) { - return 127; - } - else { - return 128; - } - case 3: - return 161; - case 5: - return 192; - default: - printf("randKeySizeBits: internal error\n"); - return 0; - } - case CSSM_ALGID_AES: - size = genRand(1, 3); - switch(size) { - case 1: - return 128; - case 2: - return 192; - case 3: - return 256; - } - case CSSM_ALGID_NONE: - return CSP_NULL_CRYPT_KEY_SIZE_DEF; - default: - printf("randKeySizeBits: unknown alg\n"); - return CSP_KEY_SIZE_DEFAULT; - } - size = genRand(minSize, maxSize); - - /* per-alg postprocessing.... */ - if(alg != CSSM_ALGID_RC2) { - size &= ~0x7; - } - switch(alg) { - case CSSM_ALGID_RSA: - // new for X - strong keys */ - size &= ~(16 - 1); - break; - case CSSM_ALGID_DSA: - /* size mod 64 == 0 */ - size &= ~(64 - 1); - break; - default: - break; - } - return size; -} - -#pragma mark --------- Encrypt/Decrypt --------- - -/* - * Encrypt/Decrypt - */ -/* - * Common routine for encrypt/decrypt - cook up an appropriate context handle - */ -/* - * When true, effectiveKeySizeInBits is passed down via the Params argument. - * Otherwise, we add a customized context attribute. - * Setting this true works with the stock Intel CSSM; this may well change. - * Note this overloading prevent us from specifying RC5 rounds.... - */ -#define EFFECTIVE_SIZE_VIA_PARAMS 0 -CSSM_CC_HANDLE genCryptHandle(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEED, etc. - uint32 mode, // CSSM_ALGMODE_CBC, etc. - only for symmetric algs - CSSM_PADDING padding, // CSSM_PADDING_PKCS1, etc. - const CSSM_KEY *key0, - const CSSM_KEY *key1, // for CSSM_ALGID_FEED only - must be the - // public key - const CSSM_DATA *iv, // optional - uint32 effectiveKeySizeInBits, // 0 means skip this attribute - uint32 rounds) // ditto -{ - CSSM_CC_HANDLE cryptHand = 0; - uint32 params; - CSSM_RETURN crtn; - CSSM_ACCESS_CREDENTIALS creds; - - memset(&creds, 0, sizeof(CSSM_ACCESS_CREDENTIALS)); - #if EFFECTIVE_SIZE_VIA_PARAMS - params = effectiveKeySizeInBits; - #else - params = 0; - #endif - switch(algorithm) { - case CSSM_ALGID_DES: - case CSSM_ALGID_3DES_3KEY_EDE: - case CSSM_ALGID_DESX: - case CSSM_ALGID_ASC: - case CSSM_ALGID_RC2: - case CSSM_ALGID_RC4: - case CSSM_ALGID_RC5: - case CSSM_ALGID_AES: - case CSSM_ALGID_BLOWFISH: - case CSSM_ALGID_CAST: - case CSSM_ALGID_IDEA: - case CSSM_ALGID_NONE: // used for wrapKey() - crtn = CSSM_CSP_CreateSymmetricContext(cspHand, - algorithm, - mode, - NULL, // access cred - key0, - iv, // InitVector - padding, - NULL, // Params - &cryptHand); - if(crtn) { - printError("CSSM_CSP_CreateSymmetricContext", crtn); - return 0; - } - break; - case CSSM_ALGID_FEED: - case CSSM_ALGID_FEEDEXP: - case CSSM_ALGID_FEECFILE: - case CSSM_ALGID_RSA: - crtn = CSSM_CSP_CreateAsymmetricContext(cspHand, - algorithm, - &creds, // access - key0, - padding, - &cryptHand); - if(crtn) { - printError("CSSM_CSP_CreateAsymmetricContext", crtn); - return 0; - } - if(key1 != NULL) { - /* - * FEED, some CFILE. Add (non-standard) second key attribute. - */ - crtn = AddContextAttribute(cryptHand, - CSSM_ATTRIBUTE_PUBLIC_KEY, - sizeof(CSSM_KEY), // currently sizeof CSSM_DATA - CAT_Ptr, - key1, - 0); - if(crtn) { - printError("AddContextAttribute", crtn); - return 0; - } - } - if(mode != CSSM_ALGMODE_NONE) { - /* special case, e.g., CSSM_ALGMODE_PUBLIC_KEY */ - crtn = AddContextAttribute(cryptHand, - CSSM_ATTRIBUTE_MODE, - sizeof(uint32), - CAT_Uint32, - NULL, - mode); - if(crtn) { - printError("AddContextAttribute", crtn); - return 0; - } - } - break; - default: - printf("genCryptHandle: bogus algorithm\n"); - return 0; - } - #if !EFFECTIVE_SIZE_VIA_PARAMS - /* add optional EffectiveKeySizeInBits and rounds attributes */ - if(effectiveKeySizeInBits != 0) { - CSSM_CONTEXT_ATTRIBUTE attr; - attr.AttributeType = CSSM_ATTRIBUTE_EFFECTIVE_BITS; - attr.AttributeLength = sizeof(uint32); - attr.Attribute.Uint32 = effectiveKeySizeInBits; - crtn = CSSM_UpdateContextAttributes( - cryptHand, - 1, - &attr); - if(crtn) { - printError("CSSM_UpdateContextAttributes", crtn); - return crtn; - } - } - #endif - - if(rounds != 0) { - CSSM_CONTEXT_ATTRIBUTE attr; - attr.AttributeType = CSSM_ATTRIBUTE_ROUNDS; - attr.AttributeLength = sizeof(uint32); - attr.Attribute.Uint32 = rounds; - crtn = CSSM_UpdateContextAttributes( - cryptHand, - 1, - &attr); - if(crtn) { - printError("CSSM_UpdateContextAttributes", crtn); - return crtn; - } - } - - return cryptHand; -} - -CSSM_RETURN cspEncrypt(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEED, etc. - uint32 mode, // CSSM_ALGMODE_CBC, etc. - only for symmetric algs - CSSM_PADDING padding, // CSSM_PADDING_PKCS1, etc. - const CSSM_KEY *key, // public or session key - const CSSM_KEY *pubKey, // for CSSM_ALGID_FEED, CSSM_ALGID_FEECFILE only - uint32 effectiveKeySizeInBits, // 0 means skip this attribute - uint32 rounds, // ditto - const CSSM_DATA *iv, // init vector, optional - const CSSM_DATA *ptext, - CSSM_DATA_PTR ctext, // RETURNED - CSSM_BOOL mallocCtext) // if true, and ctext empty, malloc - // by getting size from CSP -{ - CSSM_CC_HANDLE cryptHand; - CSSM_RETURN crtn; - CSSM_SIZE bytesEncrypted; - CSSM_DATA remData = {0, NULL}; - CSSM_RETURN ocrtn = CSSM_OK; - unsigned origCtextLen; // the amount we malloc, if any - CSSM_RETURN savedErr = CSSM_OK; - CSSM_BOOL restoreErr = CSSM_FALSE; - - cryptHand = genCryptHandle(cspHand, - algorithm, - mode, - padding, - key, - pubKey, - iv, - effectiveKeySizeInBits, - rounds); - if(cryptHand == 0) { - return CSSMERR_CSSM_INTERNAL_ERROR; - } - if(mallocCtext && (ctext->Length == 0)) { - CSSM_QUERY_SIZE_DATA querySize; - querySize.SizeInputBlock = ptext->Length; - crtn = CSSM_QuerySize(cryptHand, - CSSM_TRUE, // encrypt - 1, - &querySize); - if(crtn) { - printError("CSSM_QuerySize", crtn); - ocrtn = crtn; - goto abort; - } - if(querySize.SizeOutputBlock == 0) { - /* CSP couldn't figure this out; skip our malloc */ - printf("***cspEncrypt: warning: cipherTextSize unknown; " - "skipping malloc\n"); - origCtextLen = 0; - } - else { - ctext->Data = (uint8 *) - appMalloc(querySize.SizeOutputBlock, NULL); - if(ctext->Data == NULL) { - printf("Insufficient heap space\n"); - ocrtn = CSSM_ERRCODE_MEMORY_ERROR; - goto abort; - } - ctext->Length = origCtextLen = querySize.SizeOutputBlock; - memset(ctext->Data, 0, ctext->Length); - } - } - else { - origCtextLen = ctext->Length; - } - crtn = CSSM_EncryptData(cryptHand, - ptext, - 1, - ctext, - 1, - &bytesEncrypted, - &remData); - if(crtn == CSSM_OK) { - /* - * Deal with remData - its contents are included in bytesEncrypted. - */ - if((remData.Length != 0) && mallocCtext) { - /* shouldn't happen - right? */ - if(bytesEncrypted > origCtextLen) { - /* malloc and copy a new one */ - uint8 *newCdata = (uint8 *)appMalloc(bytesEncrypted, NULL); - printf("**Warning: app malloced cipherBuf, but got nonzero " - "remData!\n"); - if(newCdata == NULL) { - printf("Insufficient heap space\n"); - ocrtn = CSSM_ERRCODE_MEMORY_ERROR; - goto abort; - } - memmove(newCdata, ctext->Data, ctext->Length); - memmove(newCdata+ctext->Length, remData.Data, remData.Length); - CSSM_FREE(ctext->Data); - ctext->Data = newCdata; - } - else { - /* there's room left over */ - memmove(ctext->Data+ctext->Length, remData.Data, remData.Length); - } - ctext->Length = bytesEncrypted; - } - // NOTE: We return the proper length in ctext.... - ctext->Length = bytesEncrypted; - } - else { - savedErr = crtn; - restoreErr = CSSM_TRUE; - printError("CSSM_EncryptData", crtn); - } -abort: - crtn = CSSM_DeleteContext(cryptHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - if(restoreErr) { - ocrtn = savedErr; - } - return ocrtn; -} - -#define PAD_IMPLIES_RAND_PTEXTSIZE 1 -#define LOG_STAGED_OPS 0 -#if LOG_STAGED_OPS -#define soprintf(s) printf s -#else -#define soprintf(s) -#endif - -CSSM_RETURN cspStagedEncrypt(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEED, etc. - uint32 mode, // CSSM_ALGMODE_CBC, etc. - only for symmetric algs - CSSM_PADDING padding, // CSSM_PADDING_PKCS1, etc. - const CSSM_KEY *key, // public or session key - const CSSM_KEY *pubKey, // for CSSM_ALGID_FEED, CSSM_ALGID_FEECFILE only - uint32 effectiveKeySizeInBits, // 0 means skip this attribute - uint32 cipherBlockSize, // ditto - uint32 rounds, // ditto - const CSSM_DATA *iv, // init vector, optional - const CSSM_DATA *ptext, - CSSM_DATA_PTR ctext, // RETURNED, we malloc - CSSM_BOOL multiUpdates) // false:single update, true:multi updates -{ - CSSM_CC_HANDLE cryptHand; - CSSM_RETURN crtn; - CSSM_SIZE bytesEncrypted; // per update - CSSM_SIZE bytesEncryptedTotal = 0; - CSSM_RETURN ocrtn = CSSM_OK; // 'our' crtn - unsigned toMove; // remaining - unsigned thisMove; // bytes to encrypt on this update - CSSM_DATA thisPtext; // running ptr into ptext - CSSM_DATA ctextWork; // per update, mallocd by CSP - CSSM_QUERY_SIZE_DATA querySize; - uint8 *origCtext; // initial ctext->Data - unsigned origCtextLen; // amount we mallocd - CSSM_BOOL restoreErr = CSSM_FALSE; - CSSM_RETURN savedErr = CSSM_OK; - - - cryptHand = genCryptHandle(cspHand, - algorithm, - mode, - padding, - key, - pubKey, - iv, - effectiveKeySizeInBits, - rounds); - if(cryptHand == 0) { - return CSSMERR_CSP_INTERNAL_ERROR; - } - if(cipherBlockSize) { - crtn = AddContextAttribute(cryptHand, - CSSM_ATTRIBUTE_BLOCK_SIZE, - sizeof(uint32), - CAT_Uint32, - NULL, - cipherBlockSize); - if(crtn) { - printError("CSSM_UpdateContextAttributes", crtn); - goto abort; - } - } - - /* obtain total required ciphertext size and block size */ - querySize.SizeInputBlock = ptext->Length; - crtn = CSSM_QuerySize(cryptHand, - CSSM_TRUE, // encrypt - 1, - &querySize); - if(crtn) { - printError("CSSM_QuerySize(1)", crtn); - ocrtn = CSSMERR_CSP_INTERNAL_ERROR; - goto abort; - } - if(querySize.SizeOutputBlock == 0) { - /* CSP couldn't figure this out; skip our malloc - caller is taking its - * chances */ - printf("***cspStagedEncrypt: warning: cipherTextSize unknown; aborting\n"); - ocrtn = CSSMERR_CSP_INTERNAL_ERROR; - goto abort; - } - else { - origCtextLen = querySize.SizeOutputBlock; - if(algorithm == CSSM_ALGID_ASC) { - /* ASC is weird - the more chunks we do, the bigger the - * resulting ctext...*/ - origCtextLen *= 2; - } - ctext->Length = origCtextLen; - ctext->Data = origCtext = (uint8 *)appMalloc(origCtextLen, NULL); - if(ctext->Data == NULL) { - printf("Insufficient heap space\n"); - ocrtn = CSSMERR_CSP_MEMORY_ERROR; - goto abort; - } - memset(ctext->Data, 0, ctext->Length); - } - - crtn = CSSM_EncryptDataInit(cryptHand); - if(crtn) { - printError("CSSM_EncryptDataInit", crtn); - ocrtn = crtn; - goto abort; - } - - toMove = ptext->Length; - thisPtext.Data = ptext->Data; - while(toMove) { - if(multiUpdates) { - thisMove = genRand(1, toMove); - } - else { - /* just do one pass thru this loop */ - thisMove = toMove; - } - thisPtext.Length = thisMove; - /* let CSP do the individual mallocs */ - ctextWork.Data = NULL; - ctextWork.Length = 0; - soprintf(("*** EncryptDataUpdate: ptextLen 0x%x\n", thisMove)); - crtn = CSSM_EncryptDataUpdate(cryptHand, - &thisPtext, - 1, - &ctextWork, - 1, - &bytesEncrypted); - if(crtn) { - printError("CSSM_EncryptDataUpdate", crtn); - ocrtn = crtn; - goto abort; - } - // NOTE: We return the proper length in ctext.... - ctextWork.Length = bytesEncrypted; - soprintf(("*** EncryptDataUpdate: ptextLen 0x%x bytesEncrypted 0x%x\n", - thisMove, bytesEncrypted)); - thisPtext.Data += thisMove; - toMove -= thisMove; - if(bytesEncrypted > ctext->Length) { - printf("cspStagedEncrypt: ctext overflow!\n"); - ocrtn = crtn; - goto abort; - } - if(bytesEncrypted != 0) { - memmove(ctext->Data, ctextWork.Data, bytesEncrypted); - bytesEncryptedTotal += bytesEncrypted; - ctext->Data += bytesEncrypted; - ctext->Length -= bytesEncrypted; - } - if(ctextWork.Data != NULL) { - CSSM_FREE(ctextWork.Data); - } - } - /* OK, one more */ - ctextWork.Data = NULL; - ctextWork.Length = 0; - crtn = CSSM_EncryptDataFinal(cryptHand, &ctextWork); - if(crtn) { - printError("CSSM_EncryptDataFinal", crtn); - savedErr = crtn; - restoreErr = CSSM_TRUE; - goto abort; - } - if(ctextWork.Length != 0) { - bytesEncryptedTotal += ctextWork.Length; - if(ctextWork.Length > ctext->Length) { - printf("cspStagedEncrypt: ctext overflow (2)!\n"); - ocrtn = CSSMERR_CSP_INTERNAL_ERROR; - goto abort; - } - memmove(ctext->Data, ctextWork.Data, ctextWork.Length); - } - if(ctextWork.Data) { - /* this could have gotten mallocd and Length still be zero */ - CSSM_FREE(ctextWork.Data); - } - - /* retweeze ctext */ - ctext->Data = origCtext; - ctext->Length = bytesEncryptedTotal; -abort: - crtn = CSSM_DeleteContext(cryptHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - if(restoreErr) { - /* give caller the error from the encrypt */ - ocrtn = savedErr; - } - return ocrtn; -} - -CSSM_RETURN cspDecrypt(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEED, etc. - uint32 mode, // CSSM_ALGMODE_CBC, etc. - only for symmetric algs - CSSM_PADDING padding, // CSSM_PADDING_PKCS1, etc. - const CSSM_KEY *key, // public or session key - const CSSM_KEY *pubKey, // for CSSM_ALGID_FEED, CSSM_ALGID_FEECFILE only - uint32 effectiveKeySizeInBits, // 0 means skip this attribute - uint32 rounds, // ditto - const CSSM_DATA *iv, // init vector, optional - const CSSM_DATA *ctext, - CSSM_DATA_PTR ptext, // RETURNED - CSSM_BOOL mallocPtext) // if true and ptext->Length = 0, - // we'll malloc -{ - CSSM_CC_HANDLE cryptHand; - CSSM_RETURN crtn; - CSSM_RETURN ocrtn = CSSM_OK; - CSSM_SIZE bytesDecrypted; - CSSM_DATA remData = {0, NULL}; - unsigned origPtextLen; // the amount we malloc, if any - - cryptHand = genCryptHandle(cspHand, - algorithm, - mode, - padding, - key, - pubKey, - iv, - effectiveKeySizeInBits, - rounds); - if(cryptHand == 0) { - return CSSMERR_CSP_INTERNAL_ERROR; - } - if(mallocPtext && (ptext->Length == 0)) { - CSSM_QUERY_SIZE_DATA querySize; - querySize.SizeInputBlock = ctext->Length; - crtn = CSSM_QuerySize(cryptHand, - CSSM_FALSE, // encrypt - 1, - &querySize); - if(crtn) { - printError("CSSM_QuerySize", crtn); - ocrtn = crtn; - goto abort; - } - if(querySize.SizeOutputBlock == 0) { - /* CSP couldn't figure this one out; skip our malloc */ - printf("***cspDecrypt: warning: plainTextSize unknown; " - "skipping malloc\n"); - origPtextLen = 0; - } - else { - ptext->Data = - (uint8 *)appMalloc(querySize.SizeOutputBlock, NULL); - if(ptext->Data == NULL) { - printf("Insufficient heap space\n"); - ocrtn = CSSMERR_CSP_MEMORY_ERROR; - goto abort; - } - ptext->Length = origPtextLen = querySize.SizeOutputBlock; - memset(ptext->Data, 0, ptext->Length); - } - } - else { - origPtextLen = ptext->Length; - } - crtn = CSSM_DecryptData(cryptHand, - ctext, - 1, - ptext, - 1, - &bytesDecrypted, - &remData); - if(crtn == CSSM_OK) { - /* - * Deal with remData - its contents are included in bytesDecrypted. - */ - if((remData.Length != 0) && mallocPtext) { - /* shouldn't happen - right? */ - if(bytesDecrypted > origPtextLen) { - /* malloc and copy a new one */ - uint8 *newPdata = (uint8 *)appMalloc(bytesDecrypted, NULL); - printf("**Warning: app malloced ClearBuf, but got nonzero " - "remData!\n"); - if(newPdata == NULL) { - printf("Insufficient heap space\n"); - ocrtn = CSSMERR_CSP_MEMORY_ERROR; - goto abort; - } - memmove(newPdata, ptext->Data, ptext->Length); - memmove(newPdata + ptext->Length, - remData.Data, remData.Length); - CSSM_FREE(ptext->Data); - ptext->Data = newPdata; - } - else { - /* there's room left over */ - memmove(ptext->Data + ptext->Length, - remData.Data, remData.Length); - } - ptext->Length = bytesDecrypted; - } - // NOTE: We return the proper length in ptext.... - ptext->Length = bytesDecrypted; - - // FIXME - sometimes get mallocd RemData here, but never any valid data - // there...side effect of CSPFullPluginSession's buffer handling logic; - // but will we ever actually see valid data in RemData? So far we never - // have.... - if(remData.Data != NULL) { - appFree(remData.Data, NULL); - } - } - else { - printError("CSSM_DecryptData", crtn); - ocrtn = crtn; - } -abort: - crtn = CSSM_DeleteContext(cryptHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - return ocrtn; -} - -CSSM_RETURN cspStagedDecrypt(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEED, etc. - uint32 mode, // CSSM_ALGMODE_CBC, etc. - only for symmetric algs - CSSM_PADDING padding, // CSSM_PADDING_PKCS1, etc. - const CSSM_KEY *key, // public or session key - const CSSM_KEY *pubKey, // for CSSM_ALGID_FEED, CSSM_ALGID_FEECFILE only - uint32 effectiveKeySizeInBits, // 0 means skip this attribute - uint32 cipherBlockSize, // ditto - uint32 rounds, // ditto - const CSSM_DATA *iv, // init vector, optional - const CSSM_DATA *ctext, - CSSM_DATA_PTR ptext, // RETURNED, we malloc - CSSM_BOOL multiUpdates) // false:single update, true:multi updates -{ - CSSM_CC_HANDLE cryptHand; - CSSM_RETURN crtn; - CSSM_SIZE bytesDecrypted; // per update - CSSM_SIZE bytesDecryptedTotal = 0; - CSSM_RETURN ocrtn = CSSM_OK; // 'our' crtn - unsigned toMove; // remaining - unsigned thisMove; // bytes to encrypt on this update - CSSM_DATA thisCtext; // running ptr into ptext - CSSM_DATA ptextWork; // per update, mallocd by CSP - CSSM_QUERY_SIZE_DATA querySize; - uint8 *origPtext; // initial ptext->Data - unsigned origPtextLen; // amount we mallocd - - cryptHand = genCryptHandle(cspHand, - algorithm, - mode, - padding, - key, - pubKey, - iv, - effectiveKeySizeInBits, - rounds); - if(cryptHand == 0) { - return CSSMERR_CSP_INTERNAL_ERROR; - } - if(cipherBlockSize) { - crtn = AddContextAttribute(cryptHand, - CSSM_ATTRIBUTE_BLOCK_SIZE, - sizeof(uint32), - CAT_Uint32, - NULL, - cipherBlockSize); - if(crtn) { - printError("CSSM_UpdateContextAttributes", crtn); - goto abort; - } - } - - /* obtain total required ciphertext size and block size */ - querySize.SizeInputBlock = ctext->Length; - crtn = CSSM_QuerySize(cryptHand, - CSSM_FALSE, // encrypt - 1, - &querySize); - if(crtn) { - printError("CSSM_QuerySize(1)", crtn); - ocrtn = crtn; - goto abort; - } - - /* required ptext size should be independent of number of chunks */ - if(querySize.SizeOutputBlock == 0) { - printf("***warning: cspStagedDecrypt: plainTextSize unknown; aborting\n"); - ocrtn = CSSMERR_CSP_INTERNAL_ERROR; - goto abort; - } - else { - // until exit, ptext->Length indicates remaining bytes of usable data in - // ptext->Data - ptext->Length = origPtextLen = querySize.SizeOutputBlock; - ptext->Data = origPtext = - (uint8 *)appMalloc(origPtextLen, NULL); - if(ptext->Data == NULL) { - printf("Insufficient heap space\n"); - ocrtn = CSSMERR_CSP_INTERNAL_ERROR; - goto abort; - } - memset(ptext->Data, 0, ptext->Length); - } - - crtn = CSSM_DecryptDataInit(cryptHand); - if(crtn) { - printError("CSSM_DecryptDataInit", crtn); - ocrtn = crtn; - goto abort; - } - toMove = ctext->Length; - thisCtext.Data = ctext->Data; - while(toMove) { - if(multiUpdates) { - thisMove = genRand(1, toMove); - } - else { - /* just do one pass thru this loop */ - thisMove = toMove; - } - thisCtext.Length = thisMove; - /* let CSP do the individual mallocs */ - ptextWork.Data = NULL; - ptextWork.Length = 0; - soprintf(("*** DecryptDataUpdate: ctextLen 0x%x\n", thisMove)); - crtn = CSSM_DecryptDataUpdate(cryptHand, - &thisCtext, - 1, - &ptextWork, - 1, - &bytesDecrypted); - if(crtn) { - printError("CSSM_DecryptDataUpdate", crtn); - ocrtn = crtn; - goto abort; - } - // - // NOTE: We return the proper length in ptext.... - ptextWork.Length = bytesDecrypted; - thisCtext.Data += thisMove; - toMove -= thisMove; - if(bytesDecrypted > ptext->Length) { - printf("cspStagedDecrypt: ptext overflow!\n"); - ocrtn = CSSMERR_CSP_INTERNAL_ERROR; - goto abort; - } - if(bytesDecrypted != 0) { - memmove(ptext->Data, ptextWork.Data, bytesDecrypted); - bytesDecryptedTotal += bytesDecrypted; - ptext->Data += bytesDecrypted; - ptext->Length -= bytesDecrypted; - } - if(ptextWork.Data != NULL) { - CSSM_FREE(ptextWork.Data); - } - } - /* OK, one more */ - ptextWork.Data = NULL; - ptextWork.Length = 0; - crtn = CSSM_DecryptDataFinal(cryptHand, &ptextWork); - if(crtn) { - printError("CSSM_DecryptDataFinal", crtn); - ocrtn = crtn; - goto abort; - } - if(ptextWork.Length != 0) { - bytesDecryptedTotal += ptextWork.Length; - if(ptextWork.Length > ptext->Length) { - printf("cspStagedDecrypt: ptext overflow (2)!\n"); - ocrtn = CSSMERR_CSP_INTERNAL_ERROR; - goto abort; - } - memmove(ptext->Data, ptextWork.Data, ptextWork.Length); - } - if(ptextWork.Data) { - /* this could have gotten mallocd and Length still be zero */ - CSSM_FREE(ptextWork.Data); - } - - /* retweeze ptext */ - ptext->Data = origPtext; - ptext->Length = bytesDecryptedTotal; -abort: - crtn = CSSM_DeleteContext(cryptHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - return ocrtn; -} - -#pragma mark --------- sign/verify/MAC --------- - -/* - * Signature routines - * This all-in-one sign op has a special case for RSA keys. If the requested - * alg is MD5 or SHA1, we'll do a manual digest op followed by raw RSA sign. - * Likewise, if it's CSSM_ALGID_DSA, we'll do manual SHA1 digest followed by - * raw DSA sign. - */ - -CSSM_RETURN cspSign(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // private key - const CSSM_DATA *text, - CSSM_DATA_PTR sig) // RETURNED -{ - CSSM_CC_HANDLE sigHand; - CSSM_RETURN crtn; - CSSM_RETURN ocrtn = CSSM_OK; - const CSSM_DATA *ptext; - CSSM_DATA digest = {0, NULL}; - CSSM_ALGORITHMS digestAlg = CSSM_ALGID_NONE; - - /* handle special cases for raw sign */ - switch(algorithm) { - case CSSM_ALGID_SHA1: - digestAlg = CSSM_ALGID_SHA1; - algorithm = CSSM_ALGID_RSA; - break; - case CSSM_ALGID_MD5: - digestAlg = CSSM_ALGID_MD5; - algorithm = CSSM_ALGID_RSA; - break; - case CSSM_ALGID_DSA: - digestAlg = CSSM_ALGID_SHA1; - algorithm = CSSM_ALGID_DSA; - break; - default: - break; - } - if(digestAlg != CSSM_ALGID_NONE) { - crtn = cspDigest(cspHand, - digestAlg, - CSSM_FALSE, // mallocDigest - text, - &digest); - if(crtn) { - return crtn; - } - /* sign digest with raw RSA/DSA */ - ptext = &digest; - } - else { - ptext = text; - } - crtn = CSSM_CSP_CreateSignatureContext(cspHand, - algorithm, - NULL, // passPhrase - key, - &sigHand); - if(crtn) { - printError("CSSM_CSP_CreateSignatureContext (1)", crtn); - return crtn; - } - crtn = CSSM_SignData(sigHand, - ptext, - 1, - digestAlg, - sig); - if(crtn) { - printError("CSSM_SignData", crtn); - ocrtn = crtn; - } - crtn = CSSM_DeleteContext(sigHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - if(digest.Data != NULL) { - CSSM_FREE(digest.Data); - } - return ocrtn; -} - -/* - * Staged sign. Each update does a random number of bytes 'till through. - */ -CSSM_RETURN cspStagedSign(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // private key - const CSSM_DATA *text, - CSSM_BOOL multiUpdates, // false:single update, true:multi updates - CSSM_DATA_PTR sig) // RETURNED -{ - CSSM_CC_HANDLE sigHand; - CSSM_RETURN crtn; - CSSM_RETURN ocrtn = CSSM_OK; - unsigned thisMove; // this update - unsigned toMove; // total to go - CSSM_DATA thisText; // actaully passed to update - crtn = CSSM_CSP_CreateSignatureContext(cspHand, - algorithm, - NULL, // passPhrase - key, - &sigHand); - if(crtn) { - printError("CSSM_CSP_CreateSignatureContext (1)", crtn); - return crtn; - } - crtn = CSSM_SignDataInit(sigHand); - if(crtn) { - printError("CSSM_SignDataInit", crtn); - ocrtn = crtn; - goto abort; - } - toMove = text->Length; - thisText.Data = text->Data; - while(toMove) { - if(multiUpdates) { - thisMove = genRand(1, toMove); - } - else { - thisMove = toMove; - } - thisText.Length = thisMove; - crtn = CSSM_SignDataUpdate(sigHand, - &thisText, - 1); - if(crtn) { - printError("CSSM_SignDataUpdate", crtn); - ocrtn = crtn; - goto abort; - } - thisText.Data += thisMove; - toMove -= thisMove; - } - crtn = CSSM_SignDataFinal(sigHand, sig); - if(crtn) { - printError("CSSM_SignDataFinal", crtn); - ocrtn = crtn; - goto abort; - } -abort: - crtn = CSSM_DeleteContext(sigHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - return ocrtn; -} - -/* - * This all-in-one verify op has a special case for RSA keys. If the requested - * alg is MD5 or SHA1, we'll do a manual digest op followed by raw RSA verify. - * Likewise, if it's CSSM_ALGID_DSA, we'll do manual SHA1 digest followed by - * raw DSA sign. - */ - -CSSM_RETURN cspSigVerify(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // public key - const CSSM_DATA *text, - const CSSM_DATA *sig, - CSSM_RETURN expectResult) // expected result is verify failure - // CSSM_OK - expect success -{ - CSSM_CC_HANDLE sigHand; - CSSM_RETURN ocrtn = CSSM_OK; - CSSM_RETURN crtn; - const CSSM_DATA *ptext; - CSSM_DATA digest = {0, NULL}; - CSSM_ALGORITHMS digestAlg = CSSM_ALGID_NONE; - - /* handle special cases for raw sign */ - switch(algorithm) { - case CSSM_ALGID_SHA1: - digestAlg = CSSM_ALGID_SHA1; - algorithm = CSSM_ALGID_RSA; - break; - case CSSM_ALGID_MD5: - digestAlg = CSSM_ALGID_MD5; - algorithm = CSSM_ALGID_RSA; - break; - case CSSM_ALGID_DSA: - digestAlg = CSSM_ALGID_SHA1; - algorithm = CSSM_ALGID_DSA; - break; - default: - break; - } - if(digestAlg != CSSM_ALGID_NONE) { - crtn = cspDigest(cspHand, - digestAlg, - CSSM_FALSE, // mallocDigest - text, - &digest); - if(crtn) { - return crtn; - } - /* sign digest with raw RSA/DSA */ - ptext = &digest; - } - else { - ptext = text; - } - crtn = CSSM_CSP_CreateSignatureContext(cspHand, - algorithm, - NULL, // passPhrase - key, - &sigHand); - if(crtn) { - printError("CSSM_CSP_CreateSignatureContext (3)", crtn); - return crtn; - } - - crtn = CSSM_VerifyData(sigHand, - ptext, - 1, - digestAlg, - sig); - if(crtn != expectResult) { - if(!crtn) { - printf("Unexpected good Sig Verify\n"); - } - else { - printError("CSSM_VerifyData", crtn); - } - ocrtn = CSSMERR_CSSM_INTERNAL_ERROR; - } - crtn = CSSM_DeleteContext(sigHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - if(digest.Data != NULL) { - CSSM_FREE(digest.Data); - } - return ocrtn; -} - -/* - * Staged verify. Each update does a random number of bytes 'till through. - */ -CSSM_RETURN cspStagedSigVerify(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // private key - const CSSM_DATA *text, - const CSSM_DATA *sig, - CSSM_BOOL multiUpdates, // false:single update, true:multi updates - CSSM_RETURN expectResult) // expected result is verify failure - // CSSM_TRUE - expect success -{ - CSSM_CC_HANDLE sigHand; - CSSM_RETURN crtn; - CSSM_RETURN ocrtn = CSSM_OK; - unsigned thisMove; // this update - unsigned toMove; // total to go - CSSM_DATA thisText; // actaully passed to update - crtn = CSSM_CSP_CreateSignatureContext(cspHand, - algorithm, - NULL, // passPhrase - key, - &sigHand); - if(crtn) { - printError("CSSM_CSP_CreateSignatureContext (4)", crtn); - return crtn; - } - crtn = CSSM_VerifyDataInit(sigHand); - if(crtn) { - printError("CSSM_VerifyDataInit", crtn); - ocrtn = crtn; - goto abort; - } - toMove = text->Length; - thisText.Data = text->Data; - while(toMove) { - if(multiUpdates) { - thisMove = genRand(1, toMove); - } - else { - thisMove = toMove; - } - thisText.Length = thisMove; - crtn = CSSM_VerifyDataUpdate(sigHand, - &thisText, - 1); - if(crtn) { - printError("CSSM_VerifyDataUpdate", crtn); - ocrtn = crtn; - goto abort; - } - thisText.Data += thisMove; - toMove -= thisMove; - } - crtn = CSSM_VerifyDataFinal(sigHand, sig); - if(crtn != expectResult) { - if(crtn) { - printError("CSSM_VerifyDataFinal", crtn); - } - else { - printf("Unexpected good Staged Sig Verify\n"); - } - ocrtn = CSSMERR_CSSM_INTERNAL_ERROR; - } -abort: - crtn = CSSM_DeleteContext(sigHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - return ocrtn; -} - -/* - * MAC routines - */ -CSSM_RETURN cspGenMac(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // session key - const CSSM_DATA *text, - CSSM_DATA_PTR mac) // RETURNED -{ - CSSM_CC_HANDLE macHand; - CSSM_RETURN crtn; - CSSM_RETURN ocrtn = CSSM_OK; - crtn = CSSM_CSP_CreateMacContext(cspHand, - algorithm, - key, - &macHand); - if(crtn) { - printError("CSSM_CSP_CreateMacContext (1)", crtn); - return crtn; - } - crtn = CSSM_GenerateMac(macHand, - text, - 1, - mac); - if(crtn) { - printError("CSSM_GenerateMac", crtn); - ocrtn = crtn; - } - crtn = CSSM_DeleteContext(macHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - return ocrtn; -} - -/* - * Staged generate mac. - */ -CSSM_RETURN cspStagedGenMac(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // private key - const CSSM_DATA *text, - CSSM_BOOL mallocMac, // if true and digest->Length = 0, we'll - // malloc - CSSM_BOOL multiUpdates, // false:single update, true:multi updates - CSSM_DATA_PTR mac) // RETURNED -{ - CSSM_CC_HANDLE macHand; - CSSM_RETURN crtn; - CSSM_RETURN ocrtn = CSSM_OK; - unsigned thisMove; // this update - unsigned toMove; // total to go - CSSM_DATA thisText; // actaully passed to update - - crtn = CSSM_CSP_CreateMacContext(cspHand, - algorithm, - key, - &macHand); - if(crtn) { - printError("CSSM_CSP_CreateMacContext (2)", crtn); - return crtn; - } - - if(mallocMac && (mac->Length == 0)) { - /* malloc mac - ask CSP for size */ - CSSM_QUERY_SIZE_DATA querySize = {0, 0}; - crtn = CSSM_QuerySize(macHand, - CSSM_TRUE, // encrypt - 1, - &querySize); - if(crtn) { - printError("CSSM_QuerySize(mac)", crtn); - ocrtn = crtn; - goto abort; - } - if(querySize.SizeOutputBlock == 0) { - printf("Unknown mac size\n"); - ocrtn = CSSMERR_CSSM_INTERNAL_ERROR; - goto abort; - } - mac->Data = (uint8 *)appMalloc(querySize.SizeOutputBlock, NULL); - if(mac->Data == NULL) { - printf("malloc failure\n"); - ocrtn = CSSMERR_CSSM_MEMORY_ERROR; - goto abort; - } - mac->Length = querySize.SizeOutputBlock; - } - - crtn = CSSM_GenerateMacInit(macHand); - if(crtn) { - printError("CSSM_GenerateMacInit", crtn); - ocrtn = crtn; - goto abort; - } - toMove = text->Length; - thisText.Data = text->Data; - - while(toMove) { - if(multiUpdates) { - thisMove = genRand(1, toMove); - } - else { - thisMove = toMove; - } - thisText.Length = thisMove; - crtn = CSSM_GenerateMacUpdate(macHand, - &thisText, - 1); - if(crtn) { - printError("CSSM_GenerateMacUpdate", crtn); - ocrtn = crtn; - goto abort; - } - thisText.Data += thisMove; - toMove -= thisMove; - } - crtn = CSSM_GenerateMacFinal(macHand, mac); - if(crtn) { - printError("CSSM_GenerateMacFinal", crtn); - ocrtn = crtn; - goto abort; - } -abort: - crtn = CSSM_DeleteContext(macHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - return ocrtn; -} - -CSSM_RETURN cspMacVerify(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // public key - const CSSM_DATA *text, - const CSSM_DATA_PTR mac, - CSSM_RETURN expectResult) // expected result - // CSSM_OK - expect success -{ - CSSM_CC_HANDLE macHand; - CSSM_RETURN ocrtn = CSSM_OK; - CSSM_RETURN crtn; - crtn = CSSM_CSP_CreateMacContext(cspHand, - algorithm, - key, - &macHand); - if(crtn) { - printError("CSSM_CSP_CreateMacContext (3)", crtn); - return crtn; - } - crtn = CSSM_VerifyMac(macHand, - text, - 1, - mac); - if(crtn != expectResult) { - if(crtn) { - printError("CSSM_VerifyMac", crtn); - } - else { - printf("Unexpected good Mac Verify\n"); - } - ocrtn = CSSMERR_CSSM_INTERNAL_ERROR; - } - crtn = CSSM_DeleteContext(macHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - return ocrtn; -} - -/* - * Staged mac verify. Each update does a random number of bytes 'till through. - */ -CSSM_RETURN cspStagedMacVerify(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // private key - const CSSM_DATA *text, - const CSSM_DATA_PTR mac, - CSSM_BOOL multiUpdates, // false:single update, true:multi updates - CSSM_RETURN expectResult) // expected result is verify failure - // CSSM_OK - expect success -{ - CSSM_CC_HANDLE macHand; - CSSM_RETURN crtn; - CSSM_RETURN ocrtn = CSSM_OK; - unsigned thisMove; // this update - unsigned toMove; // total to go - CSSM_DATA thisText; // actaully passed to update - - crtn = CSSM_CSP_CreateMacContext(cspHand, - algorithm, - key, - &macHand); - if(crtn) { - printError("CSSM_CSP_CreateMacContext (4)", crtn); - return crtn; - } - crtn = CSSM_VerifyMacInit(macHand); - if(crtn) { - printError("CSSM_VerifyMacInit", crtn); - ocrtn = crtn; - goto abort; - } - toMove = text->Length; - thisText.Data = text->Data; - - while(toMove) { - if(multiUpdates) { - thisMove = genRand(1, toMove); - } - else { - thisMove = toMove; - } - thisText.Length = thisMove; - crtn = CSSM_VerifyMacUpdate(macHand, - &thisText, - 1); - if(crtn) { - printError("CSSM_VerifyMacUpdate", crtn); - ocrtn = crtn; - goto abort; - } - thisText.Data += thisMove; - toMove -= thisMove; - } - crtn = CSSM_VerifyMacFinal(macHand, mac); - if(crtn != expectResult) { - if(crtn) { - printError("CSSM_VerifyMacFinal", crtn); - } - else { - printf("Unexpected good Staged Mac Verify\n"); - } - ocrtn = CSSMERR_CSSM_INTERNAL_ERROR; - } -abort: - crtn = CSSM_DeleteContext(macHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - return ocrtn; -} - -#pragma mark --------- Digest --------- - -/* - * Digest functions - */ -CSSM_RETURN cspDigest(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_MD5, etc. - CSSM_BOOL mallocDigest, // if true and digest->Length = 0, we'll malloc - const CSSM_DATA *text, - CSSM_DATA_PTR digest) -{ - CSSM_CC_HANDLE digestHand; - CSSM_RETURN crtn; - CSSM_RETURN ocrtn = CSSM_OK; - - crtn = CSSM_CSP_CreateDigestContext(cspHand, - algorithm, - &digestHand); - if(crtn) { - printError("CSSM_CSP_CreateDIgestContext (1)", crtn); - return crtn; - } - if(mallocDigest && (digest->Length == 0)) { - /* malloc digest - ask CSP for size */ - CSSM_QUERY_SIZE_DATA querySize = {0, 0}; - crtn = CSSM_QuerySize(digestHand, - CSSM_FALSE, // encrypt - 1, - &querySize); - if(crtn) { - printError("CSSM_QuerySize(3)", crtn); - ocrtn = crtn; - goto abort; - } - if(querySize.SizeOutputBlock == 0) { - printf("Unknown digest size\n"); - ocrtn = CSSMERR_CSSM_INTERNAL_ERROR; - goto abort; - } - digest->Data = (uint8 *)appMalloc(querySize.SizeOutputBlock, NULL); - if(digest->Data == NULL) { - printf("malloc failure\n"); - ocrtn = CSSMERR_CSSM_MEMORY_ERROR; - goto abort; - } - digest->Length = querySize.SizeOutputBlock; - } - crtn = CSSM_DigestData(digestHand, - text, - 1, - digest); - if(crtn) { - printError("CSSM_DigestData", crtn); - ocrtn = crtn; - } -abort: - crtn = CSSM_DeleteContext(digestHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - return ocrtn; -} - -CSSM_RETURN cspStagedDigest(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_MD5, etc. - CSSM_BOOL mallocDigest, // if true and digest->Length = 0, we'll - // malloc - CSSM_BOOL multiUpdates, // false:single update, true:multi updates - const CSSM_DATA *text, - CSSM_DATA_PTR digest) -{ - CSSM_CC_HANDLE digestHand; - CSSM_RETURN crtn; - CSSM_RETURN ocrtn = CSSM_OK; - unsigned thisMove; // this update - unsigned toMove; // total to go - CSSM_DATA thisText; // actually passed to update - - crtn = CSSM_CSP_CreateDigestContext(cspHand, - algorithm, - &digestHand); - if(crtn) { - printError("CSSM_CSP_CreateDigestContext (2)", crtn); - return crtn; - } - if(mallocDigest && (digest->Length == 0)) { - /* malloc digest - ask CSP for size */ - CSSM_QUERY_SIZE_DATA querySize = {0, 0}; - crtn = CSSM_QuerySize(digestHand, - CSSM_FALSE, // encrypt - 1, - &querySize); - if(crtn) { - printError("CSSM_QuerySize(4)", crtn); - ocrtn = crtn; - goto abort; - } - if(querySize.SizeOutputBlock == 0) { - printf("Unknown digest size\n"); - ocrtn = CSSMERR_CSSM_INTERNAL_ERROR; - goto abort; - } - digest->Data = (uint8 *)appMalloc(querySize.SizeOutputBlock, NULL); - if(digest->Data == NULL) { - printf("malloc failure\n"); - ocrtn = CSSMERR_CSSM_MEMORY_ERROR; - goto abort; - } - digest->Length = querySize.SizeOutputBlock; - } - crtn = CSSM_DigestDataInit(digestHand); - if(crtn) { - printError("CSSM_DigestDataInit", crtn); - ocrtn = crtn; - goto abort; - } - toMove = text->Length; - thisText.Data = text->Data; - while(toMove) { - if(multiUpdates) { - thisMove = genRand(1, toMove); - } - else { - thisMove = toMove; - } - thisText.Length = thisMove; - crtn = CSSM_DigestDataUpdate(digestHand, - &thisText, - 1); - if(crtn) { - printError("CSSM_DigestDataUpdate", crtn); - ocrtn = crtn; - goto abort; - } - thisText.Data += thisMove; - toMove -= thisMove; - } - crtn = CSSM_DigestDataFinal(digestHand, digest); - if(crtn) { - printError("CSSM_DigestDataFinal", crtn); - ocrtn = crtn; - goto abort; - } -abort: - crtn = CSSM_DeleteContext(digestHand); - if(crtn) { - printError("CSSM_DeleteContext", crtn); - ocrtn = crtn; - } - return ocrtn; -} - -#pragma mark --------- wrap/unwrap --------- - -/* wrap key function. */ -CSSM_RETURN cspWrapKey(CSSM_CSP_HANDLE cspHand, - const CSSM_KEY *unwrappedKey, - const CSSM_KEY *wrappingKey, - CSSM_ALGORITHMS wrapAlg, - CSSM_ENCRYPT_MODE wrapMode, - CSSM_KEYBLOB_FORMAT wrapFormat, // NONE, PKCS7, PKCS8 - CSSM_PADDING wrapPad, - CSSM_DATA_PTR initVector, // for some wrapping algs - CSSM_DATA_PTR descrData, // optional - CSSM_KEY_PTR wrappedKey) // RETURNED -{ - CSSM_CC_HANDLE ccHand; - CSSM_RETURN crtn; - CSSM_ACCESS_CREDENTIALS creds; - - memset(wrappedKey, 0, sizeof(CSSM_KEY)); - setBadKeyData(wrappedKey); - memset(&creds, 0, sizeof(CSSM_ACCESS_CREDENTIALS)); - /* special case for NULL wrap - no wrapping key */ - if((wrappingKey == NULL) || - (wrappingKey->KeyHeader.KeyClass == CSSM_KEYCLASS_SESSION_KEY)) { - crtn = CSSM_CSP_CreateSymmetricContext(cspHand, - wrapAlg, - wrapMode, - &creds, // passPhrase, - wrappingKey, - initVector, - wrapPad, // Padding - 0, // Params - &ccHand); - } - else { - crtn = CSSM_CSP_CreateAsymmetricContext(cspHand, - wrapAlg, - &creds, - wrappingKey, - wrapPad, // padding - &ccHand); - if(crtn) { - printError("cspWrapKey/CreateContext", crtn); - return crtn; - } - if(initVector) { - /* manually add IV for CMS. The actual low-level encrypt doesn't - * use it (and must ignore it). */ - crtn = AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_INIT_VECTOR, - sizeof(CSSM_DATA), - CAT_Ptr, - initVector, - 0); - if(crtn) { - printError("CSSM_UpdateContextAttributes", crtn); - return crtn; - } - } - } - if(crtn) { - printError("cspWrapKey/CreateContext", crtn); - return crtn; - } - if(wrapFormat != CSSM_KEYBLOB_WRAPPED_FORMAT_NONE) { - /* only add this attribute if it's not the default */ - CSSM_CONTEXT_ATTRIBUTE attr; - attr.AttributeType = CSSM_ATTRIBUTE_WRAPPED_KEY_FORMAT; - attr.AttributeLength = sizeof(uint32); - attr.Attribute.Uint32 = wrapFormat; - crtn = CSSM_UpdateContextAttributes( - ccHand, - 1, - &attr); - if(crtn) { - printError("CSSM_UpdateContextAttributes", crtn); - return crtn; - } - } - crtn = CSSM_WrapKey(ccHand, - &creds, - unwrappedKey, - descrData, // DescriptiveData - wrappedKey); - if(crtn != CSSM_OK) { - printError("CSSM_WrapKey", crtn); - } - if(CSSM_DeleteContext(ccHand)) { - printf("CSSM_DeleteContext failure\n"); - } - return crtn; -} - -/* unwrap key function. */ -CSSM_RETURN cspUnwrapKey(CSSM_CSP_HANDLE cspHand, - const CSSM_KEY *wrappedKey, - const CSSM_KEY *unwrappingKey, - CSSM_ALGORITHMS unwrapAlg, - CSSM_ENCRYPT_MODE unwrapMode, - CSSM_PADDING unwrapPad, - CSSM_DATA_PTR initVector, // for some wrapping algs - CSSM_KEY_PTR unwrappedKey, // RETURNED - CSSM_DATA_PTR descrData, // required - const char *keyLabel, - unsigned keyLabelLen) -{ - CSSM_CC_HANDLE ccHand; - CSSM_RETURN crtn; - CSSM_DATA labelData; - uint32 keyAttr; - CSSM_ACCESS_CREDENTIALS creds; - - memset(unwrappedKey, 0, sizeof(CSSM_KEY)); - setBadKeyData(unwrappedKey); - memset(&creds, 0, sizeof(CSSM_ACCESS_CREDENTIALS)); - if((unwrappingKey == NULL) || - (unwrappingKey->KeyHeader.KeyClass == CSSM_KEYCLASS_SESSION_KEY)) { - crtn = CSSM_CSP_CreateSymmetricContext(cspHand, - unwrapAlg, - unwrapMode, - &creds, - unwrappingKey, - initVector, - unwrapPad, - 0, // Params - &ccHand); - } - else { - crtn = CSSM_CSP_CreateAsymmetricContext(cspHand, - unwrapAlg, - &creds, // passPhrase, - unwrappingKey, - unwrapPad, // Padding - &ccHand); - if(crtn) { - printError("cspUnwrapKey/CreateContext", crtn); - return crtn; - } - if(initVector) { - /* manually add IV for CMS. The actual low-level encrypt doesn't - * use it (and must ignore it). */ - crtn = AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_INIT_VECTOR, - sizeof(CSSM_DATA), - CAT_Ptr, - initVector, - 0); - if(crtn) { - printError("CSSM_UpdateContextAttributes", crtn); - return crtn; - } - } - } - if(crtn) { - printError("cspUnwrapKey/CreateContext", crtn); - return crtn; - } - labelData.Data = (uint8 *)keyLabel; - labelData.Length = keyLabelLen; - - /* - * New keyAttr - clear some old bits, make sure we ask for ref key - */ - keyAttr = wrappedKey->KeyHeader.KeyAttr; - keyAttr &= ~(CSSM_KEYATTR_ALWAYS_SENSITIVE | CSSM_KEYATTR_NEVER_EXTRACTABLE); - keyAttr |= CSSM_KEYATTR_RETURN_REF; - crtn = CSSM_UnwrapKey(ccHand, - NULL, // PublicKey - wrappedKey, - wrappedKey->KeyHeader.KeyUsage, - keyAttr, - &labelData, - NULL, // CredAndAclEntry - unwrappedKey, - descrData); // required - if(crtn != CSSM_OK) { - printError("CSSM_UnwrapKey", crtn); - } - if(CSSM_DeleteContext(ccHand)) { - printf("CSSM_DeleteContext failure\n"); - } - return crtn; -} - -/* - * Simple NULL wrap to convert a reference key to a raw key. - */ -CSSM_RETURN cspRefKeyToRaw( - CSSM_CSP_HANDLE cspHand, - const CSSM_KEY *refKey, - CSSM_KEY_PTR rawKey) // init'd and RETURNED -{ - CSSM_DATA descData = {0, 0}; - - memset(rawKey, 0, sizeof(CSSM_KEY)); - return cspWrapKey(cspHand, - refKey, - NULL, // unwrappingKey - CSSM_ALGID_NONE, - CSSM_ALGMODE_NONE, - CSSM_KEYBLOB_WRAPPED_FORMAT_NONE, - CSSM_PADDING_NONE, - NULL, // IV - &descData, - rawKey); -} - -/* unwrap raw key --> ref */ -CSSM_RETURN cspRawKeyToRef( - CSSM_CSP_HANDLE cspHand, - const CSSM_KEY *rawKey, - CSSM_KEY_PTR refKey) // init'd and RETURNED -{ - CSSM_DATA descData = {0, 0}; - - memset(refKey, 0, sizeof(CSSM_KEY)); - return cspUnwrapKey(cspHand, - rawKey, - NULL, // unwrappingKey - CSSM_ALGID_NONE, - CSSM_ALGMODE_NONE, - CSSM_PADDING_NONE, - NULL, // init vector - refKey, - &descData, - "noLabel", - 7); -} - - -#pragma mark --------- FEE key/curve support --------- - -/* - * Generate random key size, primeType, curveType for FEE key for specified op. - * - * First just enumerate the curves we know about, with ECDSA-INcapable first - */ - -typedef struct { - uint32 keySizeInBits; - uint32 primeType; // CSSM_FEE_PRIME_TYPE_xxx - uint32 curveType; // CSSM_FEE_CURVE_TYPE_xxx -} feeCurveParams; - -#define FEE_PROTOTYPE_CURVES 0 -#if FEE_PROTOTYPE_CURVES -/* obsolete as of 4/9/2001 */ -static feeCurveParams feeCurves[] = { - { 31, CSSM_FEE_PRIME_TYPE_MERSENNE, CSSM_FEE_CURVE_TYPE_MONTGOMERY }, - { 127, CSSM_FEE_PRIME_TYPE_MERSENNE, CSSM_FEE_CURVE_TYPE_MONTGOMERY }, - { 127, CSSM_FEE_PRIME_TYPE_GENERAL, CSSM_FEE_CURVE_TYPE_MONTGOMERY }, - #define NUM_NON_ECDSA_CURVES 3 - - /* start of Weierstrass, IEEE P1363-capable curves */ - { 31, CSSM_FEE_PRIME_TYPE_MERSENNE, CSSM_FEE_CURVE_TYPE_WEIERSTRASS }, - { 40, CSSM_FEE_PRIME_TYPE_FEE, CSSM_FEE_CURVE_TYPE_WEIERSTRASS }, - { 127, CSSM_FEE_PRIME_TYPE_MERSENNE, CSSM_FEE_CURVE_TYPE_WEIERSTRASS }, - { 160, CSSM_FEE_PRIME_TYPE_FEE, CSSM_FEE_CURVE_TYPE_WEIERSTRASS }, - { 160, CSSM_FEE_PRIME_TYPE_GENERAL, CSSM_FEE_CURVE_TYPE_WEIERSTRASS }, - { 192, CSSM_FEE_PRIME_TYPE_FEE, CSSM_FEE_CURVE_TYPE_WEIERSTRASS }, -}; -#else /* FEE_PROTOTYPE_CURVES */ -static feeCurveParams feeCurves[] = { - { 31, CSSM_FEE_PRIME_TYPE_MERSENNE, CSSM_FEE_CURVE_TYPE_MONTGOMERY }, - { 127, CSSM_FEE_PRIME_TYPE_MERSENNE, CSSM_FEE_CURVE_TYPE_MONTGOMERY }, - #define NUM_NON_ECDSA_CURVES 2 - - /* start of Weierstrass, IEEE P1363-capable curves */ - { 31, CSSM_FEE_PRIME_TYPE_MERSENNE, CSSM_FEE_CURVE_TYPE_WEIERSTRASS }, - { 128, CSSM_FEE_PRIME_TYPE_FEE, CSSM_FEE_CURVE_TYPE_WEIERSTRASS }, - { 161, CSSM_FEE_PRIME_TYPE_FEE, CSSM_FEE_CURVE_TYPE_WEIERSTRASS }, - { 161, CSSM_FEE_PRIME_TYPE_GENERAL, CSSM_FEE_CURVE_TYPE_WEIERSTRASS }, - { 192, CSSM_FEE_PRIME_TYPE_GENERAL, CSSM_FEE_CURVE_TYPE_WEIERSTRASS }, -}; -#endif /* FEE_PROTOTYPE_CURVES */ -#define NUM_FEE_CURVES (sizeof(feeCurves) / sizeof(feeCurveParams)) - -void randFeeKeyParams( - CSSM_ALGORITHMS alg, // ALGID_FEED, CSSM_ALGID_FEE_MD5, etc. - uint32 *keySizeInBits, // RETURNED - uint32 *primeType, // CSSM_FEE_PRIME_TYPE_xxx, RETURNED - uint32 *curveType) // CSSM_FEE_CURVE_TYPE_xxx, RETURNED -{ - unsigned minParams; - unsigned die; - feeCurveParams *feeParams; - - switch(alg) { - case CSSM_ALGID_SHA1WithECDSA: - minParams = NUM_NON_ECDSA_CURVES; - break; - default: - minParams = 0; - break; - } - die = genRand(minParams, (NUM_FEE_CURVES - 1)); - feeParams = &feeCurves[die]; - *keySizeInBits = feeParams->keySizeInBits; - *primeType = feeParams->primeType; - *curveType = feeParams->curveType; -} - -/* - * Obtain strings for primeType and curveType. - */ -const char *primeTypeStr(uint32 primeType) -{ - const char *p; - switch(primeType) { - case CSSM_FEE_PRIME_TYPE_MERSENNE: - p = "Mersenne"; - break; - case CSSM_FEE_PRIME_TYPE_FEE: - p = "FEE"; - break; - case CSSM_FEE_PRIME_TYPE_GENERAL: - p = "General"; - break; - case CSSM_FEE_PRIME_TYPE_DEFAULT: - p = "Default"; - break; - default: - p = "***UNKNOWN***"; - break; - } - return p; -} - -const char *curveTypeStr(uint32 curveType) -{ - const char *c; - switch(curveType) { - case CSSM_FEE_CURVE_TYPE_DEFAULT: - c = "Default"; - break; - case CSSM_FEE_CURVE_TYPE_MONTGOMERY: - c = "Montgomery"; - break; - case CSSM_FEE_CURVE_TYPE_WEIERSTRASS: - c = "Weierstrass"; - break; - default: - c = "***UNKNOWN***"; - break; - } - return c; -} - -/* - * Perform FEE Key exchange via CSSM_DeriveKey. - */ -#if 0 -/* Not implemented in OS X */ -CSSM_RETURN cspFeeKeyExchange(CSSM_CSP_HANDLE cspHand, - CSSM_KEY_PTR privKey, - CSSM_KEY_PTR pubKey, - CSSM_KEY_PTR derivedKey, // mallocd by caller - - /* remaining fields apply to derivedKey */ - uint32 keyAlg, - const char *keyLabel, - unsigned keyLabelLen, - uint32 keyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - uint32 keySizeInBits) -{ - CSSM_CC_HANDLE dkHand; - CSSM_RETURN crtn; - CSSM_DATA labelData; - - if(derivedKey == NULL) { - printf("cspFeeKeyExchange: no derivedKey\n"); - return CSSMERR_CSSM_INTERNAL_ERROR; - } - if((pubKey == NULL) || - (pubKey->KeyHeader.KeyClass != CSSM_KEYCLASS_PUBLIC_KEY) || - (pubKey->KeyHeader.BlobType != CSSM_KEYBLOB_RAW)) { - printf("cspFeeKeyExchange: bad pubKey\n"); - return CSSMERR_CSSM_INTERNAL_ERROR; - } - if((privKey == NULL) || - (privKey->KeyHeader.KeyClass != CSSM_KEYCLASS_PRIVATE_KEY) || - (privKey->KeyHeader.BlobType != CSSM_KEYBLOB_REFERENCE)) { - printf("cspFeeKeyExchange: bad privKey\n"); - return CSSMERR_CSSM_INTERNAL_ERROR; - } - memset(derivedKey, 0, sizeof(CSSM_KEY)); - - crtn = CSSM_CSP_CreateDeriveKeyContext(cspHand, - CSSM_ALGID_FEE_KEYEXCH, // AlgorithmID - keyAlg, // alg of the derived key - keySizeInBits, - NULL, // access creds - // FIXME - 0, // IterationCount - NULL, // Salt - NULL, // Seed - NULL); // PassPhrase - if(dkHand == 0) { - printError("CSSM_CSP_CreateDeriveKeyContext"); - return CSSM_FAIL; - } - labelData.Length = keyLabelLen; - labelData.Data = (uint8 *)keyLabel; - crtn = CSSM_DeriveKey(dkHand, - privKey, - &pubKey->KeyData, // Param - pub key blob - keyUsage, - CSSM_KEYATTR_RETURN_REF | CSSM_KEYATTR_EXTRACTABLE | - CSSM_KEYATTR_SENSITIVE, - &labelData, - derivedKey); - - /* FIXME - save/restore error */ - CSSM_DeleteContext(dkHand); - if(crtn) { - printError("CSSM_DeriveKey"); - } - return crtn; -} -#endif - -#pragma mark --------- Key/DL/DB support --------- - -/* - * Add a DL/DB handle to a crypto context. - */ -CSSM_RETURN cspAddDlDbToContext( - CSSM_CC_HANDLE ccHand, - CSSM_DL_HANDLE dlHand, - CSSM_DB_HANDLE dbHand) -{ - CSSM_DL_DB_HANDLE dlDb = { dlHand, dbHand }; - return AddContextAttribute(ccHand, - CSSM_ATTRIBUTE_DL_DB_HANDLE, - sizeof(CSSM_ATTRIBUTE_DL_DB_HANDLE), - CAT_Ptr, - &dlDb, - 0); -} - -/* - * Common routine to do a basic DB lookup by label and key type. - * Query is aborted prior to exit. - */ -static CSSM_DB_UNIQUE_RECORD_PTR dlLookup( - CSSM_DL_DB_HANDLE dlDbHand, - const CSSM_DATA *keyLabel, - CT_KeyType keyType, - CSSM_HANDLE *resultHand, // RETURNED - CSSM_DATA_PTR theData, // RETURED - CSSM_DB_RECORDTYPE *recordType) // RETURNED -{ - CSSM_QUERY query; - CSSM_SELECTION_PREDICATE predicate; - CSSM_DB_UNIQUE_RECORD_PTR record = NULL; - CSSM_RETURN crtn; - - switch(keyType) { - case CKT_Public: - query.RecordType = *recordType = CSSM_DL_DB_RECORD_PUBLIC_KEY; - break; - case CKT_Private: - query.RecordType = *recordType = CSSM_DL_DB_RECORD_PRIVATE_KEY; - break; - case CKT_Session: - query.RecordType = *recordType = CSSM_DL_DB_RECORD_SYMMETRIC_KEY; - break; - default: - printf("Hey bozo! Give me a valid key type!\n"); - return NULL; - } - query.Conjunctive = CSSM_DB_NONE; - query.NumSelectionPredicates = 1; - predicate.DbOperator = CSSM_DB_EQUAL; - - predicate.Attribute.Info.AttributeNameFormat = - CSSM_DB_ATTRIBUTE_NAME_AS_STRING; - predicate.Attribute.Info.Label.AttributeName = (char *) "Label"; - predicate.Attribute.Info.AttributeFormat = CSSM_DB_ATTRIBUTE_FORMAT_BLOB; - /* hope this cast is OK */ - predicate.Attribute.Value = (CSSM_DATA_PTR)keyLabel; - query.SelectionPredicate = &predicate; - - query.QueryLimits.TimeLimit = 0; // FIXME - meaningful? - query.QueryLimits.SizeLimit = 1; // FIXME - meaningful? - query.QueryFlags = CSSM_QUERY_RETURN_DATA; // FIXME - used? - - crtn = CSSM_DL_DataGetFirst(dlDbHand, - &query, - resultHand, - NULL, - theData, - &record); - /* abort only on success */ - if(crtn == CSSM_OK) { - crtn = CSSM_DL_DataAbortQuery(dlDbHand, *resultHand); - if(crtn) { - printError("CSSM_DL_AbortQuery", crtn); - return NULL; - } - } - return record; -} - -/* - * Look up a key by label and type. - */ -CSSM_KEY_PTR cspLookUpKeyByLabel( - CSSM_DL_HANDLE dlHand, - CSSM_DB_HANDLE dbHand, - const CSSM_DATA *labelData, - CT_KeyType keyType) -{ - CSSM_DB_UNIQUE_RECORD_PTR record; - CSSM_HANDLE resultHand; - CSSM_DATA theData; - CSSM_KEY_PTR key; - CSSM_DB_RECORDTYPE recordType; - CSSM_DL_DB_HANDLE dlDbHand; - - dlDbHand.DLHandle = dlHand; - dlDbHand.DBHandle = dbHand; - - theData.Length = 0; - theData.Data = NULL; - - record = dlLookup(dlDbHand, - labelData, - keyType, - &resultHand, - &theData, - &recordType); - if(record == NULL) { - //printf("cspLookUpKeyByLabel: key not found\n"); - return NULL; - } - key = (CSSM_KEY_PTR)theData.Data; - CSSM_DL_FreeUniqueRecord(dlDbHand, record); - return key; -} - -/* - * Delete and free a key - */ -CSSM_RETURN cspDeleteKey( - CSSM_CSP_HANDLE cspHand, // for free - CSSM_DL_HANDLE dlHand, // for delete - CSSM_DB_HANDLE dbHand, // ditto - const CSSM_DATA *labelData, - CSSM_KEY_PTR key) -{ - CSSM_DB_UNIQUE_RECORD_PTR record; - CSSM_HANDLE resultHand; - CT_KeyType keyType; - CSSM_RETURN crtn = CSSM_OK; - CSSM_DB_RECORDTYPE recordType; - CSSM_DL_DB_HANDLE dlDbHand; - - if(key->KeyHeader.KeyAttr & CSSM_KEYATTR_PERMANENT) { - /* first do a lookup based in this key's fields */ - switch(key->KeyHeader.KeyClass) { - case CSSM_KEYCLASS_PUBLIC_KEY: - keyType = CKT_Public; - break; - case CSSM_KEYCLASS_PRIVATE_KEY: - keyType = CKT_Private; - break; - case CSSM_KEYCLASS_SESSION_KEY: - keyType = CKT_Session; - break; - default: - printf("Hey bozo! Give me a valid key type!\n"); - return -1; - } - - dlDbHand.DLHandle = dlHand; - dlDbHand.DBHandle = dbHand; - - record = dlLookup(dlDbHand, - labelData, - keyType, - &resultHand, - NULL, // don't want actual data - &recordType); - if(record == NULL) { - printf("cspDeleteKey: key not found in DL\n"); - return CSSMERR_DL_RECORD_NOT_FOUND; - } - - /* OK, nuke it */ - crtn = CSSM_DL_DataDelete(dlDbHand, record); - if(crtn) { - printError("CSSM_DL_DataDelete", crtn); - } - CSSM_DL_FreeUniqueRecord(dlDbHand, record); - } - - /* CSSM_FreeKey() should fail due to the delete, but it will - * still free KeyData.... - * FIXME - we should be able to do this in this one single call - right? - */ - CSSM_FreeKey(cspHand, NULL, key, CSSM_FALSE); - - return crtn; -} - -/* - * Given any key in either blob or reference format, - * obtain the associated SHA-1 hash. - */ -CSSM_RETURN cspKeyHash( - CSSM_CSP_HANDLE cspHand, - const CSSM_KEY_PTR key, /* public key */ - CSSM_DATA_PTR *hashData) /* hash mallocd and RETURNED here */ -{ - CSSM_CC_HANDLE ccHand; - CSSM_RETURN crtn; - CSSM_DATA_PTR dp; - - *hashData = NULL; - - /* validate input params */ - if((key == NULL) || - (hashData == NULL)) { - printf("cspKeyHash: bogus args\n"); - return CSSMERR_CSSM_INTERNAL_ERROR; - } - - /* cook up a context for a passthrough op */ - crtn = CSSM_CSP_CreatePassThroughContext(cspHand, - key, - &ccHand); - if(ccHand == 0) { - printError("CSSM_CSP_CreatePassThroughContext", crtn); - return crtn; - } - - /* now it's up to the CSP */ - crtn = CSSM_CSP_PassThrough(ccHand, - CSSM_APPLECSP_KEYDIGEST, - NULL, - (void **)&dp); - if(crtn) { - printError("CSSM_CSP_PassThrough(PUBKEYHASH)", crtn); - } - else { - *hashData = dp; - crtn = CSSM_OK; - } - CSSM_DeleteContext(ccHand); - return crtn; -} - DELETED LocalTests/utilLib/cspwrap.h Index: LocalTests/utilLib/cspwrap.h ================================================================== --- LocalTests/utilLib/cspwrap.h +++ /dev/null @@ -1,445 +0,0 @@ -/* Copyright 1997 Apple Computer, Inc. - * - * cspwrap.h - wrappers to simplify access to CDSA - * - * Revision History - * ---------------- - * 3 May 2000 Doug Mitchell - * Ported to X/CDSA2. - * 12 Aug 1997 Doug Mitchell at Apple - * Created. - */ - -#ifndef _CSPWRAP_H_ -#define _CSPWRAP_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Bug/feature workaround flags - */ - -/* - * Doing a WrapKey requires Access Creds, which should be - * optional. Looks like this is not a bug. - */ -#define WRAP_KEY_REQUIRES_CREDS 1 - -/* - * encrypt/decrypt - cook up a context handle - */ -CSSM_CC_HANDLE genCryptHandle(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEED, etc. - uint32 mode, // CSSM_ALGMODE_CBC, etc. - only for symmetric algs - CSSM_PADDING padding, // CSSM_PADDING_PKCS1, etc. - const CSSM_KEY *key0, - const CSSM_KEY *key1, // for CSSM_ALGID_FEED only - must be the - // public key - const CSSM_DATA *iv, // optional - uint32 effectiveKeySizeInBits, // 0 means skip this attribute - uint32 rounds); // ditto -/* - * Key generation - */ -/* - * Specifying a keySize of CSP_KEY_SIZE_DEFAULT results in using the default - * key size for the specified algorithm. - */ -#define CSP_KEY_SIZE_DEFAULT 0 - -/* symmetric key sizes in bits */ -#define CSP_ASC_KEY_SIZE_DEFAULT (16 * 8) -#define CSP_DES_KEY_SIZE_DEFAULT (8 * 8) -#define CSP_DES3_KEY_SIZE_DEFAULT (24 * 8) -#define CSP_RC2_KEY_SIZE_DEFAULT (10 * 8) -#define CSP_RC4_KEY_SIZE_DEFAULT (10 * 8) -#define CSP_RC5_KEY_SIZE_DEFAULT (10 * 8) -#define CSP_AES_KEY_SIZE_DEFAULT 128 -#define CSP_BFISH_KEY_SIZE_DEFAULT 128 -#define CSP_CAST_KEY_SIZE_DEFAULT 128 -#define CSP_IDEA_KEY_SIZE_DEFAULT 128 /* fixed */ -#define CSP_HMAC_SHA_KEY_SIZE_DEFAULT (20 * 8) -#define CSP_HMAC_MD5_KEY_SIZE_DEFAULT (16 * 8) -#define CSP_NULL_CRYPT_KEY_SIZE_DEF (16 * 8) - -/* asymmetric key sizes in bits */ -/* note: we now use AI_RSAStrongKeyGen for RSA key pair - * generate; this requires at least 512 bits and also that - * the key size be a multiple of 16. */ -#define CSP_FEE_KEY_SIZE_DEFAULT 128 - -#define CSP_RSA_KEY_SIZE_DEFAULT 1024 /* min for SHA512/RSA */ -#define CSP_DSA_KEY_SIZE_DEFAULT 512 - -/* - * Generate key pair of arbitrary algorithm. - */ -extern CSSM_RETURN cspGenKeyPair(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, - const char *keyLabel, - unsigned keyLabelLen, - uint32 keySizeInBits, - CSSM_KEY_PTR pubKey, // mallocd by caller - CSSM_BOOL pubIsRef, // true - reference key, false - data - uint32 pubKeyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - CSSM_KEYBLOB_FORMAT pubFormat, // Optional. Specify 0 or CSSM_KEYBLOB_RAW_FORMAT_NONE - // to get the default format. - CSSM_KEY_PTR privKey, // mallocd by caller - always returned as ref - CSSM_BOOL privIsRef, // true - reference key, false - data - uint32 privKeyUsage, // CSSM_KEYUSE_DECRYPT, etc. - CSSM_KEYBLOB_FORMAT privFormat, // optional 0 ==> default - CSSM_BOOL genSeed); // FEE only. True: we generate seed and CSP - // will hash it. False: CSP generates random - // seed. - -/* - * Generate FEE key pair with optional primeType, curveType, and seed (password) data. - */ -extern CSSM_RETURN cspGenFEEKeyPair(CSSM_CSP_HANDLE cspHand, - const char *keyLabel, - unsigned keyLabelLen, - uint32 keySize, // in bits - uint32 primeType, // CSSM_FEE_PRIME_TYPE_MERSENNE, etc. - uint32 curveType, // CSSM_FEE_CURVE_TYPE_MONTGOMERY, etc. - CSSM_KEY_PTR pubKey, // mallocd by caller - CSSM_BOOL pubIsRef, // true - reference key, false - data - uint32 pubKeyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - CSSM_KEYBLOB_FORMAT pubFormat, // Optional. Specify 0 or CSSM_KEYBLOB_RAW_FORMAT_NONE - // to get the default format. - CSSM_KEY_PTR privKey, // mallocd by caller - CSSM_BOOL privIsRef, // true - reference key, false - data - uint32 privKeyUsage, // CSSM_KEYUSE_DECRYPT, etc. - CSSM_KEYBLOB_FORMAT privFormat, // optional 0 ==> default - const CSSM_DATA *seedData); // Present: CSP will hash this for private data. - // NULL: CSP generates random seed. - -/* - * Generate DSA key pair with optional generateAlgParams. - */ -extern CSSM_RETURN cspGenDSAKeyPair(CSSM_CSP_HANDLE cspHand, - const char *keyLabel, - unsigned keyLabelLen, - uint32 keySize, // in bits - CSSM_KEY_PTR pubKey, // mallocd by caller - CSSM_BOOL pubIsRef, // true - reference key, false - data - uint32 pubKeyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - CSSM_KEYBLOB_FORMAT pubFormat, // Optional. Specify 0 or CSSM_KEYBLOB_RAW_FORMAT_NONE - // to get the default format. - CSSM_KEY_PTR privKey, // mallocd by caller - CSSM_BOOL privIsRef, // true - reference key, false - data - uint32 privKeyUsage, // CSSM_KEYUSE_DECRYPT, etc. - CSSM_KEYBLOB_FORMAT privFormat, // Optional. Specify 0 or CSSM_KEYBLOB_RAW_FORMAT_NONE - // to get the default format. - CSSM_BOOL genParams, - CSSM_DATA_PTR paramData); // optional - -/* - * Create a symmetric key. - */ -extern CSSM_KEY_PTR cspGenSymKey(CSSM_CSP_HANDLE cspHand, - uint32 alg, - const char *keyLabel, - unsigned keyLabelLen, - uint32 keyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - uint32 keySizeInBits, - CSSM_BOOL refKey); // true - reference key, false - data - -/* - * Derive symmetric key using PBE. - */ -CSSM_KEY_PTR cspDeriveKey(CSSM_CSP_HANDLE cspHand, - uint32 deriveAlg, // CSSM_ALGID_MD5_PBE, etc. - uint32 keyAlg, // CSSM_ALGID_RC5, etc. - const char *keyLabel, - unsigned keyLabelLen, - uint32 keyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - uint32 keySizeInBits, - CSSM_BOOL isRefKey, - CSSM_DATA_PTR password, // in PKCS-5 lingo - CSSM_DATA_PTR salt, // ditto - uint32 iterationCnt, // ditto - CSSM_DATA_PTR initVector); // mallocd & RETURNED - -/* - * Encrypt/Decrypt - these work for both symmetric and asymmetric algorithms. - */ -CSSM_RETURN cspEncrypt(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEED, etc. - uint32 mode, // CSSM_ALGMODE_CBC, etc. - only for - // symmetric algs - CSSM_PADDING padding, // CSSM_PADDING_PKCS1, etc. - const CSSM_KEY *key, // public or session key - const CSSM_KEY *pubKey, // for CSSM_ALGID_{FEED,FEECFILE} only - uint32 effectiveKeySizeInBits, // 0 means skip this attribute - uint32 rounds, // ditto - const CSSM_DATA *iv, // init vector, optional - const CSSM_DATA *ptext, - CSSM_DATA_PTR ctext, // RETURNED - CSSM_BOOL mallocCtext); - -CSSM_RETURN cspStagedEncrypt(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEED, etc. - uint32 mode, // CSSM_ALGMODE_CBC, etc. - only for - // symmetric algs - CSSM_PADDING padding, // CSSM_PADDING_PKCS1, etc. - const CSSM_KEY *key, // public or session key - const CSSM_KEY *pubKey, // for CSSM_ALGID_{FEED,FEECFILE} only - uint32 effectiveKeySizeInBits, // 0 means skip this attribute - uint32 cipherBlockSize, // ditto, block size in bytes - uint32 rounds, // ditto - const CSSM_DATA *iv, // init vector, optional - const CSSM_DATA *ptext, - CSSM_DATA_PTR ctext, // RETURNED, we malloc - CSSM_BOOL multiUpdates); // false:single update, true:multi updates - -CSSM_RETURN cspDecrypt(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEED, etc. - uint32 mode, // CSSM_ALGMODE_CBC, etc. - only for - // symmetric algs - CSSM_PADDING padding, // CSSM_PADDING_PKCS1, etc. - const CSSM_KEY *key, // private or session key - const CSSM_KEY *pubKey, // for CSSM_ALGID_{FEED,FEECFILE} only - uint32 effectiveKeySizeInBits, // 0 means skip this attribute - uint32 rounds, // ditto - const CSSM_DATA *iv, // init vector, optional - const CSSM_DATA *ctext, - CSSM_DATA_PTR ptext, // RETURNED - CSSM_BOOL mallocPtext); - -CSSM_RETURN cspStagedDecrypt(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEED, etc. - uint32 mode, // CSSM_ALGMODE_CBC, etc. - only for - // symmetric algs - CSSM_PADDING padding, // CSSM_PADDING_PKCS1, etc. - const CSSM_KEY *key, // private or session key - const CSSM_KEY *pubKey, // for CSSM_ALGID_{FEED,FEECFILE} only - uint32 effectiveKeySizeInBits, // 0 means skip this attribute - uint32 cipherBlockSize, // ditto, block size in bytes - uint32 rounds, // ditto - const CSSM_DATA *iv, // init vector, optional - const CSSM_DATA *ctext, - CSSM_DATA_PTR ptext, // RETURNED, we malloc - CSSM_BOOL multiUpdates); // false:single update, true:multi updates - -/* - * Signature routines - */ -CSSM_RETURN cspSign(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // private key - const CSSM_DATA *text, - CSSM_DATA_PTR sig); // RETURNED -CSSM_RETURN cspStagedSign(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // private key - const CSSM_DATA *text, - CSSM_BOOL multiUpdates, // false:single update, true:multi updates - CSSM_DATA_PTR sig); // RETURNED -CSSM_RETURN cspSigVerify(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // public key - const CSSM_DATA *text, - const CSSM_DATA *sig, - CSSM_RETURN expectResult); // expected result is verify failure - // CSSM_OK - expect success -CSSM_RETURN cspStagedSigVerify(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // private key - const CSSM_DATA *text, - const CSSM_DATA *sig, - CSSM_BOOL multiUpdates, // false:single update, true:multi updates - CSSM_RETURN expectResult); // expected result is verify failure - // CSSM_OK - expect success - -/* - * MAC routines - */ -CSSM_RETURN cspGenMac(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_DES, etc. - CSSM_KEY_PTR key, // session key - const CSSM_DATA *text, - CSSM_DATA_PTR mac); // RETURNED -CSSM_RETURN cspStagedGenMac(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_FEE_MD5, etc. - CSSM_KEY_PTR key, // private key - const CSSM_DATA *text, - CSSM_BOOL mallocMac, // if true and digest->Length = 0, we'll - // malloc - CSSM_BOOL multiUpdates, // false:single update, true:multi updates - CSSM_DATA_PTR mac); // RETURNED -CSSM_RETURN cspMacVerify(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, - CSSM_KEY_PTR key, // public key - const CSSM_DATA *text, - const CSSM_DATA_PTR mac, - CSSM_RETURN expectResult); -CSSM_RETURN cspStagedMacVerify(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, - CSSM_KEY_PTR key, // private key - const CSSM_DATA *text, - const CSSM_DATA_PTR mac, - CSSM_BOOL multiUpdates, // false:single update, true:multi updates - CSSM_RETURN expectResult); - -/* - * Digest functions - */ -CSSM_RETURN cspDigest(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_MD5, etc. - CSSM_BOOL mallocDigest, // if true and digest->Length = 0, we'll malloc - const CSSM_DATA *text, - CSSM_DATA_PTR digest); -CSSM_RETURN cspStagedDigest(CSSM_CSP_HANDLE cspHand, - uint32 algorithm, // CSSM_ALGID_MD5, etc. - CSSM_BOOL mallocDigest, // if true and digest->Length = 0, we'll malloc - CSSM_BOOL multiUpdates, // false:single update, true:multi updates - const CSSM_DATA *text, - CSSM_DATA_PTR digest); -CSSM_RETURN cspFreeKey(CSSM_CSP_HANDLE cspHand, - CSSM_KEY_PTR key); - -/* - * Perform FEE Key exchange via CSSM_DeriveKey. - */ -CSSM_RETURN cspFeeKeyExchange(CSSM_CSP_HANDLE cspHand, - CSSM_KEY_PTR privKey, - CSSM_KEY_PTR pubKey, - CSSM_KEY_PTR derivedKey, // mallocd by caller - - /* remaining fields apply to derivedKey */ - uint32 keyAlg, - const char *keyLabel, - unsigned keyLabelLen, - uint32 keyUsage, // CSSM_KEYUSE_ENCRYPT, etc. - uint32 keySizeInBits); - -/* - * wrap/unwrap key functions. - */ -CSSM_RETURN cspWrapKey(CSSM_CSP_HANDLE cspHand, - const CSSM_KEY *unwrappedKey, - const CSSM_KEY *wrappingKey, - CSSM_ALGORITHMS wrapAlg, - CSSM_ENCRYPT_MODE wrapMode, - CSSM_KEYBLOB_FORMAT wrapFormat, // NONE, PKCS7, PKCS8 - CSSM_PADDING wrapPad, - CSSM_DATA_PTR initVector, // for some wrapping algs - CSSM_DATA_PTR descrData, // optional - CSSM_KEY_PTR wrappedKey); // RETURNED -CSSM_RETURN cspUnwrapKey(CSSM_CSP_HANDLE cspHand, - const CSSM_KEY *wrappedKey, - const CSSM_KEY *unwrappingKey, - CSSM_ALGORITHMS unwrapAlg, - CSSM_ENCRYPT_MODE unwrapMode, - CSSM_PADDING unwrapPad, - CSSM_DATA_PTR initVector, // for some wrapping algs - CSSM_KEY_PTR unwrappedKey, // RETURNED - CSSM_DATA_PTR descrData, // required - const char *keyLabel, - unsigned keyLabelLen); - -/* generate a random and reasonable key size in bits for specified CSSM algorithm */ -typedef enum { - OT_Sign, - OT_Encrypt, - OT_KeyExch -} opType; - -#define MAX_KEY_SIZE_RC245_BYTES 64 /* max bytes, RC2, RC4, RC5 */ - -uint32 randKeySizeBits(uint32 alg, opType op); -uint32 cspDefaultKeySize(uint32 alg); - -/* - * Generate random key size, primeType, curveType for FEE key for specified op. - */ -void randFeeKeyParams( - CSSM_ALGORITHMS alg, // ALGID_FEED, CSSM_ALGID_FEE_MD5, etc. - uint32 *keySizeInBits, // RETURNED - uint32 *primeType, // CSSM_FEE_PRIME_TYPE_xxx, RETURNED - uint32 *curveType); // CSSM_FEE_CURVE_TYPE_xxx, RETURNED - -/* - * Obtain strings for primeType and curveType. - */ -const char *primeTypeStr(uint32 primeType); -const char *curveTypeStr(uint32 curveType); - -/* - * Given any key in either blob or reference format, - * obtain the associated SHA-1 hash. - */ -CSSM_RETURN cspKeyHash( - CSSM_CSP_HANDLE cspHand, - const CSSM_KEY_PTR key, /* public key */ - CSSM_DATA_PTR *hashData); /* hash mallocd and RETURNED here */ - -/* wrap ref key --> raw key */ -CSSM_RETURN cspRefKeyToRaw( - CSSM_CSP_HANDLE cspHand, - const CSSM_KEY *refKey, - CSSM_KEY_PTR rawKey); // init'd and RETURNED - -/* unwrap raw key --> ref */ -CSSM_RETURN cspRawKeyToRef( - CSSM_CSP_HANDLE cspHand, - const CSSM_KEY *rawKey, - CSSM_KEY_PTR refKey); // init'd and RETURNED - -/* - * Cook up a symmetric key with specified key bits and other - * params. Currently the CSPDL can only deal with reference keys except when - * doing wrap/unwrap, so we manually cook up a raw key, then we null-unwrap it. - */ -CSSM_RETURN cspGenSymKeyWithBits( - CSSM_CSP_HANDLE cspHand, - CSSM_ALGORITHMS keyAlg, - CSSM_KEYUSE keyUsage, - const CSSM_DATA *keyBits, - unsigned keySizeInBytes, - CSSM_KEY_PTR refKey); // init'd and RETURNED - -/* - * Add a DL/DB handle to a crypto context. - */ -CSSM_RETURN cspAddDlDbToContext( - CSSM_CC_HANDLE ccHand, - CSSM_DL_HANDLE dlHand, - CSSM_DB_HANDLE dbHand); - -/* - * Look up a key by label and type. - */ -typedef enum { - CKT_Public = 1, - CKT_Private = 2, - CKT_Session = 3 - /* any others? */ -} CT_KeyType; - -CSSM_KEY_PTR cspLookUpKeyByLabel( - CSSM_DL_HANDLE dlHand, - CSSM_DB_HANDLE dbHand, - const CSSM_DATA *labelData, - CT_KeyType keyType); - -/* - * Delete and free a key - */ -CSSM_RETURN cspDeleteKey( - CSSM_CSP_HANDLE cspHand, // for free - CSSM_DL_HANDLE dlHand, // for delete - CSSM_DB_HANDLE dbHand, // ditto - const CSSM_DATA *labelData, - CSSM_KEY_PTR key); - -// temp hack -#define CSSM_ALGID_FEECFILE (CSSM_ALGID_VENDOR_DEFINED + 102) - -#ifdef __cplusplus -} -#endif -#endif /* _CSPWRAP_H_ */ DELETED LocalTests/utilLib/cssmErrorStrings.h Index: LocalTests/utilLib/cssmErrorStrings.h ================================================================== --- LocalTests/utilLib/cssmErrorStrings.h +++ /dev/null @@ -1,532 +0,0 @@ -/* - * This file autogenerated by genErrorStrings. Do not edit. - */ - -#include - -typedef struct { - CSSM_RETURN errCode; - const char *errStr; -} ErrString; - -static const ErrString errStrings[] = { - { CSSM_OK,"CSSM_OK"}, - /* Error codes from cssmerr.h */ - { CSSMERR_CSSM_INVALID_ADDIN_HANDLE,"CSSMERR_CSSM_INVALID_ADDIN_HANDLE"}, - { CSSMERR_CSSM_NOT_INITIALIZED,"CSSMERR_CSSM_NOT_INITIALIZED"}, - { CSSMERR_CSSM_INVALID_HANDLE_USAGE,"CSSMERR_CSSM_INVALID_HANDLE_USAGE"}, - { CSSMERR_CSSM_PVC_REFERENT_NOT_FOUND,"CSSMERR_CSSM_PVC_REFERENT_NOT_FOUND"}, - { CSSMERR_CSSM_FUNCTION_INTEGRITY_FAIL,"CSSMERR_CSSM_FUNCTION_INTEGRITY_FAIL"}, - { CSSMERR_CSSM_INTERNAL_ERROR,"CSSMERR_CSSM_INTERNAL_ERROR"}, - { CSSMERR_CSSM_MEMORY_ERROR,"CSSMERR_CSSM_MEMORY_ERROR"}, - { CSSMERR_CSSM_MDS_ERROR,"CSSMERR_CSSM_MDS_ERROR"}, - { CSSMERR_CSSM_INVALID_POINTER,"CSSMERR_CSSM_INVALID_POINTER"}, - { CSSMERR_CSSM_INVALID_INPUT_POINTER,"CSSMERR_CSSM_INVALID_INPUT_POINTER"}, - { CSSMERR_CSSM_INVALID_OUTPUT_POINTER,"CSSMERR_CSSM_INVALID_OUTPUT_POINTER"}, - { CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED,"CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED"}, - { CSSMERR_CSSM_SELF_CHECK_FAILED,"CSSMERR_CSSM_SELF_CHECK_FAILED"}, - { CSSMERR_CSSM_OS_ACCESS_DENIED,"CSSMERR_CSSM_OS_ACCESS_DENIED"}, - { CSSMERR_CSSM_FUNCTION_FAILED,"CSSMERR_CSSM_FUNCTION_FAILED"}, - { CSSMERR_CSSM_MODULE_MANIFEST_VERIFY_FAILED,"CSSMERR_CSSM_MODULE_MANIFEST_VERIFY_FAILED"}, - { CSSMERR_CSSM_INVALID_GUID,"CSSMERR_CSSM_INVALID_GUID"}, - { CSSMERR_CSSM_INVALID_CONTEXT_HANDLE,"CSSMERR_CSSM_INVALID_CONTEXT_HANDLE"}, - { CSSMERR_CSSM_INCOMPATIBLE_VERSION,"CSSMERR_CSSM_INCOMPATIBLE_VERSION"}, - { CSSMERR_CSSM_PRIVILEGE_NOT_GRANTED,"CSSMERR_CSSM_PRIVILEGE_NOT_GRANTED"}, - { CSSMERR_CSSM_SCOPE_NOT_SUPPORTED,"CSSMERR_CSSM_SCOPE_NOT_SUPPORTED"}, - { CSSMERR_CSSM_PVC_ALREADY_CONFIGURED,"CSSMERR_CSSM_PVC_ALREADY_CONFIGURED"}, - { CSSMERR_CSSM_INVALID_PVC,"CSSMERR_CSSM_INVALID_PVC"}, - { CSSMERR_CSSM_EMM_LOAD_FAILED,"CSSMERR_CSSM_EMM_LOAD_FAILED"}, - { CSSMERR_CSSM_EMM_UNLOAD_FAILED,"CSSMERR_CSSM_EMM_UNLOAD_FAILED"}, - { CSSMERR_CSSM_ADDIN_LOAD_FAILED,"CSSMERR_CSSM_ADDIN_LOAD_FAILED"}, - { CSSMERR_CSSM_INVALID_KEY_HIERARCHY,"CSSMERR_CSSM_INVALID_KEY_HIERARCHY"}, - { CSSMERR_CSSM_ADDIN_UNLOAD_FAILED,"CSSMERR_CSSM_ADDIN_UNLOAD_FAILED"}, - { CSSMERR_CSSM_LIB_REF_NOT_FOUND,"CSSMERR_CSSM_LIB_REF_NOT_FOUND"}, - { CSSMERR_CSSM_INVALID_ADDIN_FUNCTION_TABLE,"CSSMERR_CSSM_INVALID_ADDIN_FUNCTION_TABLE"}, - { CSSMERR_CSSM_EMM_AUTHENTICATE_FAILED,"CSSMERR_CSSM_EMM_AUTHENTICATE_FAILED"}, - { CSSMERR_CSSM_ADDIN_AUTHENTICATE_FAILED,"CSSMERR_CSSM_ADDIN_AUTHENTICATE_FAILED"}, - { CSSMERR_CSSM_INVALID_SERVICE_MASK,"CSSMERR_CSSM_INVALID_SERVICE_MASK"}, - { CSSMERR_CSSM_MODULE_NOT_LOADED,"CSSMERR_CSSM_MODULE_NOT_LOADED"}, - { CSSMERR_CSSM_INVALID_SUBSERVICEID,"CSSMERR_CSSM_INVALID_SUBSERVICEID"}, - { CSSMERR_CSSM_BUFFER_TOO_SMALL,"CSSMERR_CSSM_BUFFER_TOO_SMALL"}, - { CSSMERR_CSSM_INVALID_ATTRIBUTE,"CSSMERR_CSSM_INVALID_ATTRIBUTE"}, - { CSSMERR_CSSM_ATTRIBUTE_NOT_IN_CONTEXT,"CSSMERR_CSSM_ATTRIBUTE_NOT_IN_CONTEXT"}, - { CSSMERR_CSSM_MODULE_MANAGER_INITIALIZE_FAIL,"CSSMERR_CSSM_MODULE_MANAGER_INITIALIZE_FAIL"}, - { CSSMERR_CSSM_MODULE_MANAGER_NOT_FOUND,"CSSMERR_CSSM_MODULE_MANAGER_NOT_FOUND"}, - { CSSMERR_CSSM_EVENT_NOTIFICATION_CALLBACK_NOT_FOUND,"CSSMERR_CSSM_EVENT_NOTIFICATION_CALLBACK_NOT_FOUND"}, - { CSSMERR_CSP_INTERNAL_ERROR,"CSSMERR_CSP_INTERNAL_ERROR"}, - { CSSMERR_CSP_MEMORY_ERROR,"CSSMERR_CSP_MEMORY_ERROR"}, - { CSSMERR_CSP_MDS_ERROR,"CSSMERR_CSP_MDS_ERROR"}, - { CSSMERR_CSP_INVALID_POINTER,"CSSMERR_CSP_INVALID_POINTER"}, - { CSSMERR_CSP_INVALID_INPUT_POINTER,"CSSMERR_CSP_INVALID_INPUT_POINTER"}, - { CSSMERR_CSP_INVALID_OUTPUT_POINTER,"CSSMERR_CSP_INVALID_OUTPUT_POINTER"}, - { CSSMERR_CSP_FUNCTION_NOT_IMPLEMENTED,"CSSMERR_CSP_FUNCTION_NOT_IMPLEMENTED"}, - { CSSMERR_CSP_SELF_CHECK_FAILED,"CSSMERR_CSP_SELF_CHECK_FAILED"}, - { CSSMERR_CSP_OS_ACCESS_DENIED,"CSSMERR_CSP_OS_ACCESS_DENIED"}, - { CSSMERR_CSP_FUNCTION_FAILED,"CSSMERR_CSP_FUNCTION_FAILED"}, - { CSSMERR_CSP_OPERATION_AUTH_DENIED,"CSSMERR_CSP_OPERATION_AUTH_DENIED"}, - { CSSMERR_CSP_OBJECT_USE_AUTH_DENIED,"CSSMERR_CSP_OBJECT_USE_AUTH_DENIED"}, - { CSSMERR_CSP_OBJECT_MANIP_AUTH_DENIED,"CSSMERR_CSP_OBJECT_MANIP_AUTH_DENIED"}, - { CSSMERR_CSP_OBJECT_ACL_NOT_SUPPORTED,"CSSMERR_CSP_OBJECT_ACL_NOT_SUPPORTED"}, - { CSSMERR_CSP_OBJECT_ACL_REQUIRED,"CSSMERR_CSP_OBJECT_ACL_REQUIRED"}, - { CSSMERR_CSP_INVALID_ACCESS_CREDENTIALS,"CSSMERR_CSP_INVALID_ACCESS_CREDENTIALS"}, - { CSSMERR_CSP_INVALID_ACL_BASE_CERTS,"CSSMERR_CSP_INVALID_ACL_BASE_CERTS"}, - { CSSMERR_CSP_ACL_BASE_CERTS_NOT_SUPPORTED,"CSSMERR_CSP_ACL_BASE_CERTS_NOT_SUPPORTED"}, - { CSSMERR_CSP_INVALID_SAMPLE_VALUE,"CSSMERR_CSP_INVALID_SAMPLE_VALUE"}, - { CSSMERR_CSP_SAMPLE_VALUE_NOT_SUPPORTED,"CSSMERR_CSP_SAMPLE_VALUE_NOT_SUPPORTED"}, - { CSSMERR_CSP_INVALID_ACL_SUBJECT_VALUE,"CSSMERR_CSP_INVALID_ACL_SUBJECT_VALUE"}, - { CSSMERR_CSP_ACL_SUBJECT_TYPE_NOT_SUPPORTED,"CSSMERR_CSP_ACL_SUBJECT_TYPE_NOT_SUPPORTED"}, - { CSSMERR_CSP_INVALID_ACL_CHALLENGE_CALLBACK,"CSSMERR_CSP_INVALID_ACL_CHALLENGE_CALLBACK"}, - { CSSMERR_CSP_ACL_CHALLENGE_CALLBACK_FAILED,"CSSMERR_CSP_ACL_CHALLENGE_CALLBACK_FAILED"}, - { CSSMERR_CSP_INVALID_ACL_ENTRY_TAG,"CSSMERR_CSP_INVALID_ACL_ENTRY_TAG"}, - { CSSMERR_CSP_ACL_ENTRY_TAG_NOT_FOUND,"CSSMERR_CSP_ACL_ENTRY_TAG_NOT_FOUND"}, - { CSSMERR_CSP_INVALID_ACL_EDIT_MODE,"CSSMERR_CSP_INVALID_ACL_EDIT_MODE"}, - { CSSMERR_CSP_ACL_CHANGE_FAILED,"CSSMERR_CSP_ACL_CHANGE_FAILED"}, - { CSSMERR_CSP_INVALID_NEW_ACL_ENTRY,"CSSMERR_CSP_INVALID_NEW_ACL_ENTRY"}, - { CSSMERR_CSP_INVALID_NEW_ACL_OWNER,"CSSMERR_CSP_INVALID_NEW_ACL_OWNER"}, - { CSSMERR_CSP_ACL_DELETE_FAILED,"CSSMERR_CSP_ACL_DELETE_FAILED"}, - { CSSMERR_CSP_ACL_REPLACE_FAILED,"CSSMERR_CSP_ACL_REPLACE_FAILED"}, - { CSSMERR_CSP_ACL_ADD_FAILED,"CSSMERR_CSP_ACL_ADD_FAILED"}, - { CSSMERR_CSP_INVALID_CONTEXT_HANDLE,"CSSMERR_CSP_INVALID_CONTEXT_HANDLE"}, - { CSSMERR_CSP_PRIVILEGE_NOT_GRANTED,"CSSMERR_CSP_PRIVILEGE_NOT_GRANTED"}, - { CSSMERR_CSP_INVALID_DATA,"CSSMERR_CSP_INVALID_DATA"}, - { CSSMERR_CSP_INVALID_PASSTHROUGH_ID,"CSSMERR_CSP_INVALID_PASSTHROUGH_ID"}, - { CSSMERR_CSP_INVALID_CRYPTO_DATA,"CSSMERR_CSP_INVALID_CRYPTO_DATA"}, - { CSSMERR_CSP_INPUT_LENGTH_ERROR,"CSSMERR_CSP_INPUT_LENGTH_ERROR"}, - { CSSMERR_CSP_OUTPUT_LENGTH_ERROR,"CSSMERR_CSP_OUTPUT_LENGTH_ERROR"}, - { CSSMERR_CSP_PRIVILEGE_NOT_SUPPORTED,"CSSMERR_CSP_PRIVILEGE_NOT_SUPPORTED"}, - { CSSMERR_CSP_DEVICE_ERROR,"CSSMERR_CSP_DEVICE_ERROR"}, - { CSSMERR_CSP_DEVICE_MEMORY_ERROR,"CSSMERR_CSP_DEVICE_MEMORY_ERROR"}, - { CSSMERR_CSP_ATTACH_HANDLE_BUSY,"CSSMERR_CSP_ATTACH_HANDLE_BUSY"}, - { CSSMERR_CSP_NOT_LOGGED_IN,"CSSMERR_CSP_NOT_LOGGED_IN"}, - { CSSMERR_CSP_INVALID_KEY,"CSSMERR_CSP_INVALID_KEY"}, - { CSSMERR_CSP_INVALID_KEY_REFERENCE,"CSSMERR_CSP_INVALID_KEY_REFERENCE"}, - { CSSMERR_CSP_INVALID_KEY_CLASS,"CSSMERR_CSP_INVALID_KEY_CLASS"}, - { CSSMERR_CSP_ALGID_MISMATCH,"CSSMERR_CSP_ALGID_MISMATCH"}, - { CSSMERR_CSP_KEY_USAGE_INCORRECT,"CSSMERR_CSP_KEY_USAGE_INCORRECT"}, - { CSSMERR_CSP_KEY_BLOB_TYPE_INCORRECT,"CSSMERR_CSP_KEY_BLOB_TYPE_INCORRECT"}, - { CSSMERR_CSP_KEY_HEADER_INCONSISTENT,"CSSMERR_CSP_KEY_HEADER_INCONSISTENT"}, - { CSSMERR_CSP_UNSUPPORTED_KEY_FORMAT,"CSSMERR_CSP_UNSUPPORTED_KEY_FORMAT"}, - { CSSMERR_CSP_UNSUPPORTED_KEY_SIZE,"CSSMERR_CSP_UNSUPPORTED_KEY_SIZE"}, - { CSSMERR_CSP_INVALID_KEY_POINTER,"CSSMERR_CSP_INVALID_KEY_POINTER"}, - { CSSMERR_CSP_INVALID_KEYUSAGE_MASK,"CSSMERR_CSP_INVALID_KEYUSAGE_MASK"}, - { CSSMERR_CSP_UNSUPPORTED_KEYUSAGE_MASK,"CSSMERR_CSP_UNSUPPORTED_KEYUSAGE_MASK"}, - { CSSMERR_CSP_INVALID_KEYATTR_MASK,"CSSMERR_CSP_INVALID_KEYATTR_MASK"}, - { CSSMERR_CSP_UNSUPPORTED_KEYATTR_MASK,"CSSMERR_CSP_UNSUPPORTED_KEYATTR_MASK"}, - { CSSMERR_CSP_INVALID_KEY_LABEL,"CSSMERR_CSP_INVALID_KEY_LABEL"}, - { CSSMERR_CSP_UNSUPPORTED_KEY_LABEL,"CSSMERR_CSP_UNSUPPORTED_KEY_LABEL"}, - { CSSMERR_CSP_INVALID_KEY_FORMAT,"CSSMERR_CSP_INVALID_KEY_FORMAT"}, - { CSSMERR_CSP_INVALID_DATA_COUNT,"CSSMERR_CSP_INVALID_DATA_COUNT"}, - { CSSMERR_CSP_VECTOR_OF_BUFS_UNSUPPORTED,"CSSMERR_CSP_VECTOR_OF_BUFS_UNSUPPORTED"}, - { CSSMERR_CSP_INVALID_INPUT_VECTOR,"CSSMERR_CSP_INVALID_INPUT_VECTOR"}, - { CSSMERR_CSP_INVALID_OUTPUT_VECTOR,"CSSMERR_CSP_INVALID_OUTPUT_VECTOR"}, - { CSSMERR_CSP_INVALID_CONTEXT,"CSSMERR_CSP_INVALID_CONTEXT"}, - { CSSMERR_CSP_INVALID_ALGORITHM,"CSSMERR_CSP_INVALID_ALGORITHM"}, - { CSSMERR_CSP_INVALID_ATTR_KEY,"CSSMERR_CSP_INVALID_ATTR_KEY"}, - { CSSMERR_CSP_MISSING_ATTR_KEY,"CSSMERR_CSP_MISSING_ATTR_KEY"}, - { CSSMERR_CSP_INVALID_ATTR_INIT_VECTOR,"CSSMERR_CSP_INVALID_ATTR_INIT_VECTOR"}, - { CSSMERR_CSP_MISSING_ATTR_INIT_VECTOR,"CSSMERR_CSP_MISSING_ATTR_INIT_VECTOR"}, - { CSSMERR_CSP_INVALID_ATTR_SALT,"CSSMERR_CSP_INVALID_ATTR_SALT"}, - { CSSMERR_CSP_MISSING_ATTR_SALT,"CSSMERR_CSP_MISSING_ATTR_SALT"}, - { CSSMERR_CSP_INVALID_ATTR_PADDING,"CSSMERR_CSP_INVALID_ATTR_PADDING"}, - { CSSMERR_CSP_MISSING_ATTR_PADDING,"CSSMERR_CSP_MISSING_ATTR_PADDING"}, - { CSSMERR_CSP_INVALID_ATTR_RANDOM,"CSSMERR_CSP_INVALID_ATTR_RANDOM"}, - { CSSMERR_CSP_MISSING_ATTR_RANDOM,"CSSMERR_CSP_MISSING_ATTR_RANDOM"}, - { CSSMERR_CSP_INVALID_ATTR_SEED,"CSSMERR_CSP_INVALID_ATTR_SEED"}, - { CSSMERR_CSP_MISSING_ATTR_SEED,"CSSMERR_CSP_MISSING_ATTR_SEED"}, - { CSSMERR_CSP_INVALID_ATTR_PASSPHRASE,"CSSMERR_CSP_INVALID_ATTR_PASSPHRASE"}, - { CSSMERR_CSP_MISSING_ATTR_PASSPHRASE,"CSSMERR_CSP_MISSING_ATTR_PASSPHRASE"}, - { CSSMERR_CSP_INVALID_ATTR_KEY_LENGTH,"CSSMERR_CSP_INVALID_ATTR_KEY_LENGTH"}, - { CSSMERR_CSP_MISSING_ATTR_KEY_LENGTH,"CSSMERR_CSP_MISSING_ATTR_KEY_LENGTH"}, - { CSSMERR_CSP_INVALID_ATTR_BLOCK_SIZE,"CSSMERR_CSP_INVALID_ATTR_BLOCK_SIZE"}, - { CSSMERR_CSP_MISSING_ATTR_BLOCK_SIZE,"CSSMERR_CSP_MISSING_ATTR_BLOCK_SIZE"}, - { CSSMERR_CSP_INVALID_ATTR_OUTPUT_SIZE,"CSSMERR_CSP_INVALID_ATTR_OUTPUT_SIZE"}, - { CSSMERR_CSP_MISSING_ATTR_OUTPUT_SIZE,"CSSMERR_CSP_MISSING_ATTR_OUTPUT_SIZE"}, - { CSSMERR_CSP_INVALID_ATTR_ROUNDS,"CSSMERR_CSP_INVALID_ATTR_ROUNDS"}, - { CSSMERR_CSP_MISSING_ATTR_ROUNDS,"CSSMERR_CSP_MISSING_ATTR_ROUNDS"}, - { CSSMERR_CSP_INVALID_ATTR_ALG_PARAMS,"CSSMERR_CSP_INVALID_ATTR_ALG_PARAMS"}, - { CSSMERR_CSP_MISSING_ATTR_ALG_PARAMS,"CSSMERR_CSP_MISSING_ATTR_ALG_PARAMS"}, - { CSSMERR_CSP_INVALID_ATTR_LABEL,"CSSMERR_CSP_INVALID_ATTR_LABEL"}, - { CSSMERR_CSP_MISSING_ATTR_LABEL,"CSSMERR_CSP_MISSING_ATTR_LABEL"}, - { CSSMERR_CSP_INVALID_ATTR_KEY_TYPE,"CSSMERR_CSP_INVALID_ATTR_KEY_TYPE"}, - { CSSMERR_CSP_MISSING_ATTR_KEY_TYPE,"CSSMERR_CSP_MISSING_ATTR_KEY_TYPE"}, - { CSSMERR_CSP_INVALID_ATTR_MODE,"CSSMERR_CSP_INVALID_ATTR_MODE"}, - { CSSMERR_CSP_MISSING_ATTR_MODE,"CSSMERR_CSP_MISSING_ATTR_MODE"}, - { CSSMERR_CSP_INVALID_ATTR_EFFECTIVE_BITS,"CSSMERR_CSP_INVALID_ATTR_EFFECTIVE_BITS"}, - { CSSMERR_CSP_MISSING_ATTR_EFFECTIVE_BITS,"CSSMERR_CSP_MISSING_ATTR_EFFECTIVE_BITS"}, - { CSSMERR_CSP_INVALID_ATTR_START_DATE,"CSSMERR_CSP_INVALID_ATTR_START_DATE"}, - { CSSMERR_CSP_MISSING_ATTR_START_DATE,"CSSMERR_CSP_MISSING_ATTR_START_DATE"}, - { CSSMERR_CSP_INVALID_ATTR_END_DATE,"CSSMERR_CSP_INVALID_ATTR_END_DATE"}, - { CSSMERR_CSP_MISSING_ATTR_END_DATE,"CSSMERR_CSP_MISSING_ATTR_END_DATE"}, - { CSSMERR_CSP_INVALID_ATTR_VERSION,"CSSMERR_CSP_INVALID_ATTR_VERSION"}, - { CSSMERR_CSP_MISSING_ATTR_VERSION,"CSSMERR_CSP_MISSING_ATTR_VERSION"}, - { CSSMERR_CSP_INVALID_ATTR_PRIME,"CSSMERR_CSP_INVALID_ATTR_PRIME"}, - { CSSMERR_CSP_MISSING_ATTR_PRIME,"CSSMERR_CSP_MISSING_ATTR_PRIME"}, - { CSSMERR_CSP_INVALID_ATTR_BASE,"CSSMERR_CSP_INVALID_ATTR_BASE"}, - { CSSMERR_CSP_MISSING_ATTR_BASE,"CSSMERR_CSP_MISSING_ATTR_BASE"}, - { CSSMERR_CSP_INVALID_ATTR_SUBPRIME,"CSSMERR_CSP_INVALID_ATTR_SUBPRIME"}, - { CSSMERR_CSP_MISSING_ATTR_SUBPRIME,"CSSMERR_CSP_MISSING_ATTR_SUBPRIME"}, - { CSSMERR_CSP_INVALID_ATTR_ITERATION_COUNT,"CSSMERR_CSP_INVALID_ATTR_ITERATION_COUNT"}, - { CSSMERR_CSP_MISSING_ATTR_ITERATION_COUNT,"CSSMERR_CSP_MISSING_ATTR_ITERATION_COUNT"}, - { CSSMERR_CSP_INVALID_ATTR_DL_DB_HANDLE,"CSSMERR_CSP_INVALID_ATTR_DL_DB_HANDLE"}, - { CSSMERR_CSP_MISSING_ATTR_DL_DB_HANDLE,"CSSMERR_CSP_MISSING_ATTR_DL_DB_HANDLE"}, - { CSSMERR_CSP_INVALID_ATTR_ACCESS_CREDENTIALS,"CSSMERR_CSP_INVALID_ATTR_ACCESS_CREDENTIALS"}, - { CSSMERR_CSP_MISSING_ATTR_ACCESS_CREDENTIALS,"CSSMERR_CSP_MISSING_ATTR_ACCESS_CREDENTIALS"}, - { CSSMERR_CSP_INVALID_ATTR_PUBLIC_KEY_FORMAT,"CSSMERR_CSP_INVALID_ATTR_PUBLIC_KEY_FORMAT"}, - { CSSMERR_CSP_MISSING_ATTR_PUBLIC_KEY_FORMAT,"CSSMERR_CSP_MISSING_ATTR_PUBLIC_KEY_FORMAT"}, - { CSSMERR_CSP_INVALID_ATTR_PRIVATE_KEY_FORMAT,"CSSMERR_CSP_INVALID_ATTR_PRIVATE_KEY_FORMAT"}, - { CSSMERR_CSP_MISSING_ATTR_PRIVATE_KEY_FORMAT,"CSSMERR_CSP_MISSING_ATTR_PRIVATE_KEY_FORMAT"}, - { CSSMERR_CSP_INVALID_ATTR_SYMMETRIC_KEY_FORMAT,"CSSMERR_CSP_INVALID_ATTR_SYMMETRIC_KEY_FORMAT"}, - { CSSMERR_CSP_MISSING_ATTR_SYMMETRIC_KEY_FORMAT,"CSSMERR_CSP_MISSING_ATTR_SYMMETRIC_KEY_FORMAT"}, - { CSSMERR_CSP_INVALID_ATTR_WRAPPED_KEY_FORMAT,"CSSMERR_CSP_INVALID_ATTR_WRAPPED_KEY_FORMAT"}, - { CSSMERR_CSP_MISSING_ATTR_WRAPPED_KEY_FORMAT,"CSSMERR_CSP_MISSING_ATTR_WRAPPED_KEY_FORMAT"}, - { CSSMERR_CSP_STAGED_OPERATION_IN_PROGRESS,"CSSMERR_CSP_STAGED_OPERATION_IN_PROGRESS"}, - { CSSMERR_CSP_STAGED_OPERATION_NOT_STARTED,"CSSMERR_CSP_STAGED_OPERATION_NOT_STARTED"}, - { CSSMERR_CSP_VERIFY_FAILED,"CSSMERR_CSP_VERIFY_FAILED"}, - { CSSMERR_CSP_INVALID_SIGNATURE,"CSSMERR_CSP_INVALID_SIGNATURE"}, - { CSSMERR_CSP_QUERY_SIZE_UNKNOWN,"CSSMERR_CSP_QUERY_SIZE_UNKNOWN"}, - { CSSMERR_CSP_BLOCK_SIZE_MISMATCH,"CSSMERR_CSP_BLOCK_SIZE_MISMATCH"}, - { CSSMERR_CSP_PRIVATE_KEY_NOT_FOUND,"CSSMERR_CSP_PRIVATE_KEY_NOT_FOUND"}, - { CSSMERR_CSP_PUBLIC_KEY_INCONSISTENT,"CSSMERR_CSP_PUBLIC_KEY_INCONSISTENT"}, - { CSSMERR_CSP_DEVICE_VERIFY_FAILED,"CSSMERR_CSP_DEVICE_VERIFY_FAILED"}, - { CSSMERR_CSP_INVALID_LOGIN_NAME,"CSSMERR_CSP_INVALID_LOGIN_NAME"}, - { CSSMERR_CSP_ALREADY_LOGGED_IN,"CSSMERR_CSP_ALREADY_LOGGED_IN"}, - { CSSMERR_CSP_PRIVATE_KEY_ALREADY_EXISTS,"CSSMERR_CSP_PRIVATE_KEY_ALREADY_EXISTS"}, - { CSSMERR_CSP_KEY_LABEL_ALREADY_EXISTS,"CSSMERR_CSP_KEY_LABEL_ALREADY_EXISTS"}, - { CSSMERR_CSP_INVALID_DIGEST_ALGORITHM,"CSSMERR_CSP_INVALID_DIGEST_ALGORITHM"}, - { CSSMERR_CSP_CRYPTO_DATA_CALLBACK_FAILED,"CSSMERR_CSP_CRYPTO_DATA_CALLBACK_FAILED"}, - { CSSMERR_TP_INTERNAL_ERROR,"CSSMERR_TP_INTERNAL_ERROR"}, - { CSSMERR_TP_MEMORY_ERROR,"CSSMERR_TP_MEMORY_ERROR"}, - { CSSMERR_TP_MDS_ERROR,"CSSMERR_TP_MDS_ERROR"}, - { CSSMERR_TP_INVALID_POINTER,"CSSMERR_TP_INVALID_POINTER"}, - { CSSMERR_TP_INVALID_INPUT_POINTER,"CSSMERR_TP_INVALID_INPUT_POINTER"}, - { CSSMERR_TP_INVALID_OUTPUT_POINTER,"CSSMERR_TP_INVALID_OUTPUT_POINTER"}, - { CSSMERR_TP_FUNCTION_NOT_IMPLEMENTED,"CSSMERR_TP_FUNCTION_NOT_IMPLEMENTED"}, - { CSSMERR_TP_SELF_CHECK_FAILED,"CSSMERR_TP_SELF_CHECK_FAILED"}, - { CSSMERR_TP_OS_ACCESS_DENIED,"CSSMERR_TP_OS_ACCESS_DENIED"}, - { CSSMERR_TP_FUNCTION_FAILED,"CSSMERR_TP_FUNCTION_FAILED"}, - { CSSMERR_TP_INVALID_CONTEXT_HANDLE,"CSSMERR_TP_INVALID_CONTEXT_HANDLE"}, - { CSSMERR_TP_INVALID_DATA,"CSSMERR_TP_INVALID_DATA"}, - { CSSMERR_TP_INVALID_DB_LIST,"CSSMERR_TP_INVALID_DB_LIST"}, - { CSSMERR_TP_INVALID_CERTGROUP_POINTER,"CSSMERR_TP_INVALID_CERTGROUP_POINTER"}, - { CSSMERR_TP_INVALID_CERT_POINTER,"CSSMERR_TP_INVALID_CERT_POINTER"}, - { CSSMERR_TP_INVALID_CRL_POINTER,"CSSMERR_TP_INVALID_CRL_POINTER"}, - { CSSMERR_TP_INVALID_FIELD_POINTER,"CSSMERR_TP_INVALID_FIELD_POINTER"}, - { CSSMERR_TP_INVALID_NETWORK_ADDR,"CSSMERR_TP_INVALID_NETWORK_ADDR"}, - { CSSMERR_TP_CRL_ALREADY_SIGNED,"CSSMERR_TP_CRL_ALREADY_SIGNED"}, - { CSSMERR_TP_INVALID_NUMBER_OF_FIELDS,"CSSMERR_TP_INVALID_NUMBER_OF_FIELDS"}, - { CSSMERR_TP_VERIFICATION_FAILURE,"CSSMERR_TP_VERIFICATION_FAILURE"}, - { CSSMERR_TP_INVALID_DB_HANDLE,"CSSMERR_TP_INVALID_DB_HANDLE"}, - { CSSMERR_TP_UNKNOWN_FORMAT,"CSSMERR_TP_UNKNOWN_FORMAT"}, - { CSSMERR_TP_UNKNOWN_TAG,"CSSMERR_TP_UNKNOWN_TAG"}, - { CSSMERR_TP_INVALID_PASSTHROUGH_ID,"CSSMERR_TP_INVALID_PASSTHROUGH_ID"}, - { CSSMERR_TP_INVALID_CSP_HANDLE,"CSSMERR_TP_INVALID_CSP_HANDLE"}, - { CSSMERR_TP_INVALID_DL_HANDLE,"CSSMERR_TP_INVALID_DL_HANDLE"}, - { CSSMERR_TP_INVALID_CL_HANDLE,"CSSMERR_TP_INVALID_CL_HANDLE"}, - { CSSMERR_TP_INVALID_DB_LIST_POINTER,"CSSMERR_TP_INVALID_DB_LIST_POINTER"}, - { CSSMERR_TP_INVALID_CALLERAUTH_CONTEXT_POINTER,"CSSMERR_TP_INVALID_CALLERAUTH_CONTEXT_POINTER"}, - { CSSMERR_TP_INVALID_IDENTIFIER_POINTER,"CSSMERR_TP_INVALID_IDENTIFIER_POINTER"}, - { CSSMERR_TP_INVALID_KEYCACHE_HANDLE,"CSSMERR_TP_INVALID_KEYCACHE_HANDLE"}, - { CSSMERR_TP_INVALID_CERTGROUP,"CSSMERR_TP_INVALID_CERTGROUP"}, - { CSSMERR_TP_INVALID_CRLGROUP,"CSSMERR_TP_INVALID_CRLGROUP"}, - { CSSMERR_TP_INVALID_CRLGROUP_POINTER,"CSSMERR_TP_INVALID_CRLGROUP_POINTER"}, - { CSSMERR_TP_AUTHENTICATION_FAILED,"CSSMERR_TP_AUTHENTICATION_FAILED"}, - { CSSMERR_TP_CERTGROUP_INCOMPLETE,"CSSMERR_TP_CERTGROUP_INCOMPLETE"}, - { CSSMERR_TP_CERTIFICATE_CANT_OPERATE,"CSSMERR_TP_CERTIFICATE_CANT_OPERATE"}, - { CSSMERR_TP_CERT_EXPIRED,"CSSMERR_TP_CERT_EXPIRED"}, - { CSSMERR_TP_CERT_NOT_VALID_YET,"CSSMERR_TP_CERT_NOT_VALID_YET"}, - { CSSMERR_TP_CERT_REVOKED,"CSSMERR_TP_CERT_REVOKED"}, - { CSSMERR_TP_CERT_SUSPENDED,"CSSMERR_TP_CERT_SUSPENDED"}, - { CSSMERR_TP_INSUFFICIENT_CREDENTIALS,"CSSMERR_TP_INSUFFICIENT_CREDENTIALS"}, - { CSSMERR_TP_INVALID_ACTION,"CSSMERR_TP_INVALID_ACTION"}, - { CSSMERR_TP_INVALID_ACTION_DATA,"CSSMERR_TP_INVALID_ACTION_DATA"}, - { CSSMERR_TP_INVALID_ANCHOR_CERT,"CSSMERR_TP_INVALID_ANCHOR_CERT"}, - { CSSMERR_TP_INVALID_AUTHORITY,"CSSMERR_TP_INVALID_AUTHORITY"}, - { CSSMERR_TP_VERIFY_ACTION_FAILED,"CSSMERR_TP_VERIFY_ACTION_FAILED"}, - { CSSMERR_TP_INVALID_CERTIFICATE,"CSSMERR_TP_INVALID_CERTIFICATE"}, - { CSSMERR_TP_INVALID_CERT_AUTHORITY,"CSSMERR_TP_INVALID_CERT_AUTHORITY"}, - { CSSMERR_TP_INVALID_CRL_AUTHORITY,"CSSMERR_TP_INVALID_CRL_AUTHORITY"}, - { CSSMERR_TP_INVALID_CRL_ENCODING,"CSSMERR_TP_INVALID_CRL_ENCODING"}, - { CSSMERR_TP_INVALID_CRL_TYPE,"CSSMERR_TP_INVALID_CRL_TYPE"}, - { CSSMERR_TP_INVALID_CRL,"CSSMERR_TP_INVALID_CRL"}, - { CSSMERR_TP_INVALID_FORM_TYPE,"CSSMERR_TP_INVALID_FORM_TYPE"}, - { CSSMERR_TP_INVALID_ID,"CSSMERR_TP_INVALID_ID"}, - { CSSMERR_TP_INVALID_IDENTIFIER,"CSSMERR_TP_INVALID_IDENTIFIER"}, - { CSSMERR_TP_INVALID_INDEX,"CSSMERR_TP_INVALID_INDEX"}, - { CSSMERR_TP_INVALID_NAME,"CSSMERR_TP_INVALID_NAME"}, - { CSSMERR_TP_INVALID_POLICY_IDENTIFIERS,"CSSMERR_TP_INVALID_POLICY_IDENTIFIERS"}, - { CSSMERR_TP_INVALID_TIMESTRING,"CSSMERR_TP_INVALID_TIMESTRING"}, - { CSSMERR_TP_INVALID_REASON,"CSSMERR_TP_INVALID_REASON"}, - { CSSMERR_TP_INVALID_REQUEST_INPUTS,"CSSMERR_TP_INVALID_REQUEST_INPUTS"}, - { CSSMERR_TP_INVALID_RESPONSE_VECTOR,"CSSMERR_TP_INVALID_RESPONSE_VECTOR"}, - { CSSMERR_TP_INVALID_SIGNATURE,"CSSMERR_TP_INVALID_SIGNATURE"}, - { CSSMERR_TP_INVALID_STOP_ON_POLICY,"CSSMERR_TP_INVALID_STOP_ON_POLICY"}, - { CSSMERR_TP_INVALID_CALLBACK,"CSSMERR_TP_INVALID_CALLBACK"}, - { CSSMERR_TP_INVALID_TUPLE,"CSSMERR_TP_INVALID_TUPLE"}, - { CSSMERR_TP_NOT_SIGNER,"CSSMERR_TP_NOT_SIGNER"}, - { CSSMERR_TP_NOT_TRUSTED,"CSSMERR_TP_NOT_TRUSTED"}, - { CSSMERR_TP_NO_DEFAULT_AUTHORITY,"CSSMERR_TP_NO_DEFAULT_AUTHORITY"}, - { CSSMERR_TP_REJECTED_FORM,"CSSMERR_TP_REJECTED_FORM"}, - { CSSMERR_TP_REQUEST_LOST,"CSSMERR_TP_REQUEST_LOST"}, - { CSSMERR_TP_REQUEST_REJECTED,"CSSMERR_TP_REQUEST_REJECTED"}, - { CSSMERR_TP_UNSUPPORTED_ADDR_TYPE,"CSSMERR_TP_UNSUPPORTED_ADDR_TYPE"}, - { CSSMERR_TP_UNSUPPORTED_SERVICE,"CSSMERR_TP_UNSUPPORTED_SERVICE"}, - { CSSMERR_TP_INVALID_TUPLEGROUP_POINTER,"CSSMERR_TP_INVALID_TUPLEGROUP_POINTER"}, - { CSSMERR_TP_INVALID_TUPLEGROUP,"CSSMERR_TP_INVALID_TUPLEGROUP"}, - { CSSMERR_AC_INTERNAL_ERROR,"CSSMERR_AC_INTERNAL_ERROR"}, - { CSSMERR_AC_MEMORY_ERROR,"CSSMERR_AC_MEMORY_ERROR"}, - { CSSMERR_AC_MDS_ERROR,"CSSMERR_AC_MDS_ERROR"}, - { CSSMERR_AC_INVALID_POINTER,"CSSMERR_AC_INVALID_POINTER"}, - { CSSMERR_AC_INVALID_INPUT_POINTER,"CSSMERR_AC_INVALID_INPUT_POINTER"}, - { CSSMERR_AC_INVALID_OUTPUT_POINTER,"CSSMERR_AC_INVALID_OUTPUT_POINTER"}, - { CSSMERR_AC_FUNCTION_NOT_IMPLEMENTED,"CSSMERR_AC_FUNCTION_NOT_IMPLEMENTED"}, - { CSSMERR_AC_SELF_CHECK_FAILED,"CSSMERR_AC_SELF_CHECK_FAILED"}, - { CSSMERR_AC_OS_ACCESS_DENIED,"CSSMERR_AC_OS_ACCESS_DENIED"}, - { CSSMERR_AC_FUNCTION_FAILED,"CSSMERR_AC_FUNCTION_FAILED"}, - { CSSMERR_AC_INVALID_CONTEXT_HANDLE,"CSSMERR_AC_INVALID_CONTEXT_HANDLE"}, - { CSSMERR_AC_INVALID_DATA,"CSSMERR_AC_INVALID_DATA"}, - { CSSMERR_AC_INVALID_DB_LIST,"CSSMERR_AC_INVALID_DB_LIST"}, - { CSSMERR_AC_INVALID_PASSTHROUGH_ID,"CSSMERR_AC_INVALID_PASSTHROUGH_ID"}, - { CSSMERR_AC_INVALID_DL_HANDLE,"CSSMERR_AC_INVALID_DL_HANDLE"}, - { CSSMERR_AC_INVALID_CL_HANDLE,"CSSMERR_AC_INVALID_CL_HANDLE"}, - { CSSMERR_AC_INVALID_TP_HANDLE,"CSSMERR_AC_INVALID_TP_HANDLE"}, - { CSSMERR_AC_INVALID_DB_HANDLE,"CSSMERR_AC_INVALID_DB_HANDLE"}, - { CSSMERR_AC_INVALID_DB_LIST_POINTER,"CSSMERR_AC_INVALID_DB_LIST_POINTER"}, - { CSSMERR_AC_INVALID_BASE_ACLS,"CSSMERR_AC_INVALID_BASE_ACLS"}, - { CSSMERR_AC_INVALID_TUPLE_CREDENTIALS,"CSSMERR_AC_INVALID_TUPLE_CREDENTIALS"}, - { CSSMERR_AC_INVALID_ENCODING,"CSSMERR_AC_INVALID_ENCODING"}, - { CSSMERR_AC_INVALID_VALIDITY_PERIOD,"CSSMERR_AC_INVALID_VALIDITY_PERIOD"}, - { CSSMERR_AC_INVALID_REQUESTOR,"CSSMERR_AC_INVALID_REQUESTOR"}, - { CSSMERR_AC_INVALID_REQUEST_DESCRIPTOR,"CSSMERR_AC_INVALID_REQUEST_DESCRIPTOR"}, - { CSSMERR_CL_INTERNAL_ERROR,"CSSMERR_CL_INTERNAL_ERROR"}, - { CSSMERR_CL_MEMORY_ERROR,"CSSMERR_CL_MEMORY_ERROR"}, - { CSSMERR_CL_MDS_ERROR,"CSSMERR_CL_MDS_ERROR"}, - { CSSMERR_CL_INVALID_POINTER,"CSSMERR_CL_INVALID_POINTER"}, - { CSSMERR_CL_INVALID_INPUT_POINTER,"CSSMERR_CL_INVALID_INPUT_POINTER"}, - { CSSMERR_CL_INVALID_OUTPUT_POINTER,"CSSMERR_CL_INVALID_OUTPUT_POINTER"}, - { CSSMERR_CL_FUNCTION_NOT_IMPLEMENTED,"CSSMERR_CL_FUNCTION_NOT_IMPLEMENTED"}, - { CSSMERR_CL_SELF_CHECK_FAILED,"CSSMERR_CL_SELF_CHECK_FAILED"}, - { CSSMERR_CL_OS_ACCESS_DENIED,"CSSMERR_CL_OS_ACCESS_DENIED"}, - { CSSMERR_CL_FUNCTION_FAILED,"CSSMERR_CL_FUNCTION_FAILED"}, - { CSSMERR_CL_INVALID_CONTEXT_HANDLE,"CSSMERR_CL_INVALID_CONTEXT_HANDLE"}, - { CSSMERR_CL_INVALID_CERTGROUP_POINTER,"CSSMERR_CL_INVALID_CERTGROUP_POINTER"}, - { CSSMERR_CL_INVALID_CERT_POINTER,"CSSMERR_CL_INVALID_CERT_POINTER"}, - { CSSMERR_CL_INVALID_CRL_POINTER,"CSSMERR_CL_INVALID_CRL_POINTER"}, - { CSSMERR_CL_INVALID_FIELD_POINTER,"CSSMERR_CL_INVALID_FIELD_POINTER"}, - { CSSMERR_CL_INVALID_DATA,"CSSMERR_CL_INVALID_DATA"}, - { CSSMERR_CL_CRL_ALREADY_SIGNED,"CSSMERR_CL_CRL_ALREADY_SIGNED"}, - { CSSMERR_CL_INVALID_NUMBER_OF_FIELDS,"CSSMERR_CL_INVALID_NUMBER_OF_FIELDS"}, - { CSSMERR_CL_VERIFICATION_FAILURE,"CSSMERR_CL_VERIFICATION_FAILURE"}, - { CSSMERR_CL_UNKNOWN_FORMAT,"CSSMERR_CL_UNKNOWN_FORMAT"}, - { CSSMERR_CL_UNKNOWN_TAG,"CSSMERR_CL_UNKNOWN_TAG"}, - { CSSMERR_CL_INVALID_PASSTHROUGH_ID,"CSSMERR_CL_INVALID_PASSTHROUGH_ID"}, - { CSSMERR_CL_INVALID_BUNDLE_POINTER,"CSSMERR_CL_INVALID_BUNDLE_POINTER"}, - { CSSMERR_CL_INVALID_CACHE_HANDLE,"CSSMERR_CL_INVALID_CACHE_HANDLE"}, - { CSSMERR_CL_INVALID_RESULTS_HANDLE,"CSSMERR_CL_INVALID_RESULTS_HANDLE"}, - { CSSMERR_CL_INVALID_BUNDLE_INFO,"CSSMERR_CL_INVALID_BUNDLE_INFO"}, - { CSSMERR_CL_INVALID_CRL_INDEX,"CSSMERR_CL_INVALID_CRL_INDEX"}, - { CSSMERR_CL_INVALID_SCOPE,"CSSMERR_CL_INVALID_SCOPE"}, - { CSSMERR_CL_NO_FIELD_VALUES,"CSSMERR_CL_NO_FIELD_VALUES"}, - { CSSMERR_CL_SCOPE_NOT_SUPPORTED,"CSSMERR_CL_SCOPE_NOT_SUPPORTED"}, - { CSSMERR_DL_INTERNAL_ERROR,"CSSMERR_DL_INTERNAL_ERROR"}, - { CSSMERR_DL_MEMORY_ERROR,"CSSMERR_DL_MEMORY_ERROR"}, - { CSSMERR_DL_MDS_ERROR,"CSSMERR_DL_MDS_ERROR"}, - { CSSMERR_DL_INVALID_POINTER,"CSSMERR_DL_INVALID_POINTER"}, - { CSSMERR_DL_INVALID_INPUT_POINTER,"CSSMERR_DL_INVALID_INPUT_POINTER"}, - { CSSMERR_DL_INVALID_OUTPUT_POINTER,"CSSMERR_DL_INVALID_OUTPUT_POINTER"}, - { CSSMERR_DL_FUNCTION_NOT_IMPLEMENTED,"CSSMERR_DL_FUNCTION_NOT_IMPLEMENTED"}, - { CSSMERR_DL_SELF_CHECK_FAILED,"CSSMERR_DL_SELF_CHECK_FAILED"}, - { CSSMERR_DL_OS_ACCESS_DENIED,"CSSMERR_DL_OS_ACCESS_DENIED"}, - { CSSMERR_DL_FUNCTION_FAILED,"CSSMERR_DL_FUNCTION_FAILED"}, - { CSSMERR_DL_INVALID_CSP_HANDLE,"CSSMERR_DL_INVALID_CSP_HANDLE"}, - { CSSMERR_DL_INVALID_DL_HANDLE,"CSSMERR_DL_INVALID_DL_HANDLE"}, - { CSSMERR_DL_INVALID_CL_HANDLE,"CSSMERR_DL_INVALID_CL_HANDLE"}, - { CSSMERR_DL_INVALID_DB_LIST_POINTER,"CSSMERR_DL_INVALID_DB_LIST_POINTER"}, - { CSSMERR_DL_OPERATION_AUTH_DENIED,"CSSMERR_DL_OPERATION_AUTH_DENIED"}, - { CSSMERR_DL_OBJECT_USE_AUTH_DENIED,"CSSMERR_DL_OBJECT_USE_AUTH_DENIED"}, - { CSSMERR_DL_OBJECT_MANIP_AUTH_DENIED,"CSSMERR_DL_OBJECT_MANIP_AUTH_DENIED"}, - { CSSMERR_DL_OBJECT_ACL_NOT_SUPPORTED,"CSSMERR_DL_OBJECT_ACL_NOT_SUPPORTED"}, - { CSSMERR_DL_OBJECT_ACL_REQUIRED,"CSSMERR_DL_OBJECT_ACL_REQUIRED"}, - { CSSMERR_DL_INVALID_ACCESS_CREDENTIALS,"CSSMERR_DL_INVALID_ACCESS_CREDENTIALS"}, - { CSSMERR_DL_INVALID_ACL_BASE_CERTS,"CSSMERR_DL_INVALID_ACL_BASE_CERTS"}, - { CSSMERR_DL_ACL_BASE_CERTS_NOT_SUPPORTED,"CSSMERR_DL_ACL_BASE_CERTS_NOT_SUPPORTED"}, - { CSSMERR_DL_INVALID_SAMPLE_VALUE,"CSSMERR_DL_INVALID_SAMPLE_VALUE"}, - { CSSMERR_DL_SAMPLE_VALUE_NOT_SUPPORTED,"CSSMERR_DL_SAMPLE_VALUE_NOT_SUPPORTED"}, - { CSSMERR_DL_INVALID_ACL_SUBJECT_VALUE,"CSSMERR_DL_INVALID_ACL_SUBJECT_VALUE"}, - { CSSMERR_DL_ACL_SUBJECT_TYPE_NOT_SUPPORTED,"CSSMERR_DL_ACL_SUBJECT_TYPE_NOT_SUPPORTED"}, - { CSSMERR_DL_INVALID_ACL_CHALLENGE_CALLBACK,"CSSMERR_DL_INVALID_ACL_CHALLENGE_CALLBACK"}, - { CSSMERR_DL_ACL_CHALLENGE_CALLBACK_FAILED,"CSSMERR_DL_ACL_CHALLENGE_CALLBACK_FAILED"}, - { CSSMERR_DL_INVALID_ACL_ENTRY_TAG,"CSSMERR_DL_INVALID_ACL_ENTRY_TAG"}, - { CSSMERR_DL_ACL_ENTRY_TAG_NOT_FOUND,"CSSMERR_DL_ACL_ENTRY_TAG_NOT_FOUND"}, - { CSSMERR_DL_INVALID_ACL_EDIT_MODE,"CSSMERR_DL_INVALID_ACL_EDIT_MODE"}, - { CSSMERR_DL_ACL_CHANGE_FAILED,"CSSMERR_DL_ACL_CHANGE_FAILED"}, - { CSSMERR_DL_INVALID_NEW_ACL_ENTRY,"CSSMERR_DL_INVALID_NEW_ACL_ENTRY"}, - { CSSMERR_DL_INVALID_NEW_ACL_OWNER,"CSSMERR_DL_INVALID_NEW_ACL_OWNER"}, - { CSSMERR_DL_ACL_DELETE_FAILED,"CSSMERR_DL_ACL_DELETE_FAILED"}, - { CSSMERR_DL_ACL_REPLACE_FAILED,"CSSMERR_DL_ACL_REPLACE_FAILED"}, - { CSSMERR_DL_ACL_ADD_FAILED,"CSSMERR_DL_ACL_ADD_FAILED"}, - { CSSMERR_DL_INVALID_DB_HANDLE,"CSSMERR_DL_INVALID_DB_HANDLE"}, - { CSSMERR_DL_INVALID_PASSTHROUGH_ID,"CSSMERR_DL_INVALID_PASSTHROUGH_ID"}, - { CSSMERR_DL_INVALID_NETWORK_ADDR,"CSSMERR_DL_INVALID_NETWORK_ADDR"}, - { CSSMERR_DL_DATABASE_CORRUPT,"CSSMERR_DL_DATABASE_CORRUPT"}, - { CSSMERR_DL_INVALID_RECORD_INDEX,"CSSMERR_DL_INVALID_RECORD_INDEX"}, - { CSSMERR_DL_INVALID_RECORDTYPE,"CSSMERR_DL_INVALID_RECORDTYPE"}, - { CSSMERR_DL_INVALID_FIELD_NAME,"CSSMERR_DL_INVALID_FIELD_NAME"}, - { CSSMERR_DL_UNSUPPORTED_FIELD_FORMAT,"CSSMERR_DL_UNSUPPORTED_FIELD_FORMAT"}, - { CSSMERR_DL_UNSUPPORTED_INDEX_INFO,"CSSMERR_DL_UNSUPPORTED_INDEX_INFO"}, - { CSSMERR_DL_UNSUPPORTED_LOCALITY,"CSSMERR_DL_UNSUPPORTED_LOCALITY"}, - { CSSMERR_DL_UNSUPPORTED_NUM_ATTRIBUTES,"CSSMERR_DL_UNSUPPORTED_NUM_ATTRIBUTES"}, - { CSSMERR_DL_UNSUPPORTED_NUM_INDEXES,"CSSMERR_DL_UNSUPPORTED_NUM_INDEXES"}, - { CSSMERR_DL_UNSUPPORTED_NUM_RECORDTYPES,"CSSMERR_DL_UNSUPPORTED_NUM_RECORDTYPES"}, - { CSSMERR_DL_UNSUPPORTED_RECORDTYPE,"CSSMERR_DL_UNSUPPORTED_RECORDTYPE"}, - { CSSMERR_DL_FIELD_SPECIFIED_MULTIPLE,"CSSMERR_DL_FIELD_SPECIFIED_MULTIPLE"}, - { CSSMERR_DL_INCOMPATIBLE_FIELD_FORMAT,"CSSMERR_DL_INCOMPATIBLE_FIELD_FORMAT"}, - { CSSMERR_DL_INVALID_PARSING_MODULE,"CSSMERR_DL_INVALID_PARSING_MODULE"}, - { CSSMERR_DL_INVALID_DB_NAME,"CSSMERR_DL_INVALID_DB_NAME"}, - { CSSMERR_DL_DATASTORE_DOESNOT_EXIST,"CSSMERR_DL_DATASTORE_DOESNOT_EXIST"}, - { CSSMERR_DL_DATASTORE_ALREADY_EXISTS,"CSSMERR_DL_DATASTORE_ALREADY_EXISTS"}, - { CSSMERR_DL_DB_LOCKED,"CSSMERR_DL_DB_LOCKED"}, - { CSSMERR_DL_DATASTORE_IS_OPEN,"CSSMERR_DL_DATASTORE_IS_OPEN"}, - { CSSMERR_DL_RECORD_NOT_FOUND,"CSSMERR_DL_RECORD_NOT_FOUND"}, - { CSSMERR_DL_MISSING_VALUE,"CSSMERR_DL_MISSING_VALUE"}, - { CSSMERR_DL_UNSUPPORTED_QUERY,"CSSMERR_DL_UNSUPPORTED_QUERY"}, - { CSSMERR_DL_UNSUPPORTED_QUERY_LIMITS,"CSSMERR_DL_UNSUPPORTED_QUERY_LIMITS"}, - { CSSMERR_DL_UNSUPPORTED_NUM_SELECTION_PREDS,"CSSMERR_DL_UNSUPPORTED_NUM_SELECTION_PREDS"}, - { CSSMERR_DL_UNSUPPORTED_OPERATOR,"CSSMERR_DL_UNSUPPORTED_OPERATOR"}, - { CSSMERR_DL_INVALID_RESULTS_HANDLE,"CSSMERR_DL_INVALID_RESULTS_HANDLE"}, - { CSSMERR_DL_INVALID_DB_LOCATION,"CSSMERR_DL_INVALID_DB_LOCATION"}, - { CSSMERR_DL_INVALID_ACCESS_REQUEST,"CSSMERR_DL_INVALID_ACCESS_REQUEST"}, - { CSSMERR_DL_INVALID_INDEX_INFO,"CSSMERR_DL_INVALID_INDEX_INFO"}, - { CSSMERR_DL_INVALID_SELECTION_TAG,"CSSMERR_DL_INVALID_SELECTION_TAG"}, - { CSSMERR_DL_INVALID_NEW_OWNER,"CSSMERR_DL_INVALID_NEW_OWNER"}, - { CSSMERR_DL_INVALID_RECORD_UID,"CSSMERR_DL_INVALID_RECORD_UID"}, - { CSSMERR_DL_INVALID_UNIQUE_INDEX_DATA,"CSSMERR_DL_INVALID_UNIQUE_INDEX_DATA"}, - { CSSMERR_DL_INVALID_MODIFY_MODE,"CSSMERR_DL_INVALID_MODIFY_MODE"}, - { CSSMERR_DL_INVALID_OPEN_PARAMETERS,"CSSMERR_DL_INVALID_OPEN_PARAMETERS"}, - { CSSMERR_DL_RECORD_MODIFIED,"CSSMERR_DL_RECORD_MODIFIED"}, - { CSSMERR_DL_ENDOFDATA,"CSSMERR_DL_ENDOFDATA"}, - { CSSMERR_DL_INVALID_QUERY,"CSSMERR_DL_INVALID_QUERY"}, - { CSSMERR_DL_INVALID_VALUE,"CSSMERR_DL_INVALID_VALUE"}, - { CSSMERR_DL_MULTIPLE_VALUES_UNSUPPORTED,"CSSMERR_DL_MULTIPLE_VALUES_UNSUPPORTED"}, - { CSSMERR_DL_STALE_UNIQUE_RECORD,"CSSMERR_DL_STALE_UNIQUE_RECORD"}, - /* Error codes from cssmapple.h */ - { CSSMERR_CSSM_NO_USER_INTERACTION,"CSSMERR_CSSM_NO_USER_INTERACTION"}, - { CSSMERR_AC_NO_USER_INTERACTION,"CSSMERR_AC_NO_USER_INTERACTION"}, - { CSSMERR_CSP_NO_USER_INTERACTION,"CSSMERR_CSP_NO_USER_INTERACTION"}, - { CSSMERR_CL_NO_USER_INTERACTION,"CSSMERR_CL_NO_USER_INTERACTION"}, - { CSSMERR_DL_NO_USER_INTERACTION,"CSSMERR_DL_NO_USER_INTERACTION"}, - { CSSMERR_TP_NO_USER_INTERACTION,"CSSMERR_TP_NO_USER_INTERACTION"}, - { CSSMERR_CSSM_USER_CANCELED,"CSSMERR_CSSM_USER_CANCELED"}, - { CSSMERR_AC_USER_CANCELED,"CSSMERR_AC_USER_CANCELED"}, - { CSSMERR_CSP_USER_CANCELED,"CSSMERR_CSP_USER_CANCELED"}, - { CSSMERR_CL_USER_CANCELED,"CSSMERR_CL_USER_CANCELED"}, - { CSSMERR_DL_USER_CANCELED,"CSSMERR_DL_USER_CANCELED"}, - { CSSMERR_TP_USER_CANCELED,"CSSMERR_TP_USER_CANCELED"}, - { CSSMERR_CSSM_SERVICE_NOT_AVAILABLE,"CSSMERR_CSSM_SERVICE_NOT_AVAILABLE"}, - { CSSMERR_AC_SERVICE_NOT_AVAILABLE,"CSSMERR_AC_SERVICE_NOT_AVAILABLE"}, - { CSSMERR_CSP_SERVICE_NOT_AVAILABLE,"CSSMERR_CSP_SERVICE_NOT_AVAILABLE"}, - { CSSMERR_CL_SERVICE_NOT_AVAILABLE,"CSSMERR_CL_SERVICE_NOT_AVAILABLE"}, - { CSSMERR_DL_SERVICE_NOT_AVAILABLE,"CSSMERR_DL_SERVICE_NOT_AVAILABLE"}, - { CSSMERR_TP_SERVICE_NOT_AVAILABLE,"CSSMERR_TP_SERVICE_NOT_AVAILABLE"}, - { CSSMERR_CSSM_INSUFFICIENT_CLIENT_IDENTIFICATION,"CSSMERR_CSSM_INSUFFICIENT_CLIENT_IDENTIFICATION"}, - { CSSMERR_AC_INSUFFICIENT_CLIENT_IDENTIFICATION,"CSSMERR_AC_INSUFFICIENT_CLIENT_IDENTIFICATION"}, - { CSSMERR_CSP_INSUFFICIENT_CLIENT_IDENTIFICATION,"CSSMERR_CSP_INSUFFICIENT_CLIENT_IDENTIFICATION"}, - { CSSMERR_CL_INSUFFICIENT_CLIENT_IDENTIFICATION,"CSSMERR_CL_INSUFFICIENT_CLIENT_IDENTIFICATION"}, - { CSSMERR_DL_INSUFFICIENT_CLIENT_IDENTIFICATION,"CSSMERR_DL_INSUFFICIENT_CLIENT_IDENTIFICATION"}, - { CSSMERR_TP_INSUFFICIENT_CLIENT_IDENTIFICATION,"CSSMERR_TP_INSUFFICIENT_CLIENT_IDENTIFICATION"}, - { CSSMERR_CSSM_DEVICE_RESET,"CSSMERR_CSSM_DEVICE_RESET"}, - { CSSMERR_AC_DEVICE_RESET,"CSSMERR_AC_DEVICE_RESET"}, - { CSSMERR_CSP_DEVICE_RESET,"CSSMERR_CSP_DEVICE_RESET"}, - { CSSMERR_CL_DEVICE_RESET,"CSSMERR_CL_DEVICE_RESET"}, - { CSSMERR_DL_DEVICE_RESET,"CSSMERR_DL_DEVICE_RESET"}, - { CSSMERR_TP_DEVICE_RESET,"CSSMERR_TP_DEVICE_RESET"}, - { CSSMERR_CSSM_DEVICE_FAILED,"CSSMERR_CSSM_DEVICE_FAILED"}, - { CSSMERR_AC_DEVICE_FAILED,"CSSMERR_AC_DEVICE_FAILED"}, - { CSSMERR_CSP_DEVICE_FAILED,"CSSMERR_CSP_DEVICE_FAILED"}, - { CSSMERR_CL_DEVICE_FAILED,"CSSMERR_CL_DEVICE_FAILED"}, - { CSSMERR_DL_DEVICE_FAILED,"CSSMERR_DL_DEVICE_FAILED"}, - { CSSMERR_TP_DEVICE_FAILED,"CSSMERR_TP_DEVICE_FAILED"}, - { CSSMERR_CSP_APPLE_ADD_APPLICATION_ACL_SUBJECT,"CSSMERR_CSP_APPLE_ADD_APPLICATION_ACL_SUBJECT"}, - { CSSMERR_CSP_APPLE_PUBLIC_KEY_INCOMPLETE,"CSSMERR_CSP_APPLE_PUBLIC_KEY_INCOMPLETE"}, - { CSSMERR_CSP_APPLE_SIGNATURE_MISMATCH,"CSSMERR_CSP_APPLE_SIGNATURE_MISMATCH"}, - { CSSMERR_CSP_APPLE_INVALID_KEY_START_DATE,"CSSMERR_CSP_APPLE_INVALID_KEY_START_DATE"}, - { CSSMERR_CSP_APPLE_INVALID_KEY_END_DATE,"CSSMERR_CSP_APPLE_INVALID_KEY_END_DATE"}, - { CSSMERR_CSPDL_APPLE_DL_CONVERSION_ERROR,"CSSMERR_CSPDL_APPLE_DL_CONVERSION_ERROR"}, - { CSSMERR_CSP_APPLE_SSLv2_ROLLBACK,"CSSMERR_CSP_APPLE_SSLv2_ROLLBACK"}, - { CSSMERR_APPLEDL_INVALID_OPEN_PARAMETERS,"CSSMERR_APPLEDL_INVALID_OPEN_PARAMETERS"}, - { CSSMERR_APPLEDL_DISK_FULL,"CSSMERR_APPLEDL_DISK_FULL"}, - { CSSMERR_APPLEDL_QUOTA_EXCEEDED,"CSSMERR_APPLEDL_QUOTA_EXCEEDED"}, - { CSSMERR_APPLEDL_FILE_TOO_BIG,"CSSMERR_APPLEDL_FILE_TOO_BIG"}, - { CSSMERR_APPLEDL_INVALID_DATABASE_BLOB,"CSSMERR_APPLEDL_INVALID_DATABASE_BLOB"}, - { CSSMERR_APPLEDL_INVALID_KEY_BLOB,"CSSMERR_APPLEDL_INVALID_KEY_BLOB"}, - { CSSMERR_APPLEDL_INCOMPATIBLE_DATABASE_BLOB,"CSSMERR_APPLEDL_INCOMPATIBLE_DATABASE_BLOB"}, - { CSSMERR_APPLEDL_INCOMPATIBLE_KEY_BLOB,"CSSMERR_APPLEDL_INCOMPATIBLE_KEY_BLOB"}, - { CSSMERR_APPLETP_HOSTNAME_MISMATCH,"CSSMERR_APPLETP_HOSTNAME_MISMATCH"}, - { CSSMERR_APPLETP_UNKNOWN_CRITICAL_EXTEN,"CSSMERR_APPLETP_UNKNOWN_CRITICAL_EXTEN"}, - { CSSMERR_APPLETP_NO_BASIC_CONSTRAINTS,"CSSMERR_APPLETP_NO_BASIC_CONSTRAINTS"}, - { CSSMERR_APPLETP_INVALID_CA,"CSSMERR_APPLETP_INVALID_CA"}, - { CSSMERR_APPLETP_INVALID_AUTHORITY_ID,"CSSMERR_APPLETP_INVALID_AUTHORITY_ID"}, - { CSSMERR_APPLETP_INVALID_SUBJECT_ID,"CSSMERR_APPLETP_INVALID_SUBJECT_ID"}, - { CSSMERR_APPLETP_INVALID_KEY_USAGE,"CSSMERR_APPLETP_INVALID_KEY_USAGE"}, - { CSSMERR_APPLETP_INVALID_EXTENDED_KEY_USAGE,"CSSMERR_APPLETP_INVALID_EXTENDED_KEY_USAGE"}, - { CSSMERR_APPLETP_INVALID_ID_LINKAGE,"CSSMERR_APPLETP_INVALID_ID_LINKAGE"}, - { CSSMERR_APPLETP_PATH_LEN_CONSTRAINT,"CSSMERR_APPLETP_PATH_LEN_CONSTRAINT"}, - { CSSMERR_APPLETP_INVALID_ROOT,"CSSMERR_APPLETP_INVALID_ROOT"}, - { CSSMERR_APPLETP_CRL_EXPIRED,"CSSMERR_APPLETP_CRL_EXPIRED"}, - { CSSMERR_APPLETP_CRL_NOT_VALID_YET,"CSSMERR_APPLETP_CRL_NOT_VALID_YET"}, - { CSSMERR_APPLETP_CRL_NOT_FOUND,"CSSMERR_APPLETP_CRL_NOT_FOUND"}, - { CSSMERR_APPLETP_CRL_SERVER_DOWN,"CSSMERR_APPLETP_CRL_SERVER_DOWN"}, - { CSSMERR_APPLETP_CRL_BAD_URI,"CSSMERR_APPLETP_CRL_BAD_URI"}, - { CSSMERR_APPLETP_UNKNOWN_CERT_EXTEN,"CSSMERR_APPLETP_UNKNOWN_CERT_EXTEN"}, - { CSSMERR_APPLETP_UNKNOWN_CRL_EXTEN,"CSSMERR_APPLETP_UNKNOWN_CRL_EXTEN"}, - { CSSMERR_APPLETP_CRL_NOT_TRUSTED,"CSSMERR_APPLETP_CRL_NOT_TRUSTED"}, - { CSSMERR_APPLETP_CRL_INVALID_ANCHOR_CERT,"CSSMERR_APPLETP_CRL_INVALID_ANCHOR_CERT"}, - { CSSMERR_APPLETP_CRL_POLICY_FAIL,"CSSMERR_APPLETP_CRL_POLICY_FAIL"}, - { CSSMERR_APPLETP_IDP_FAIL,"CSSMERR_APPLETP_IDP_FAIL"}, - { CSSMERR_APPLETP_CERT_NOT_FOUND_FROM_ISSUER,"CSSMERR_APPLETP_CERT_NOT_FOUND_FROM_ISSUER"}, - { CSSMERR_APPLETP_BAD_CERT_FROM_ISSUER,"CSSMERR_APPLETP_BAD_CERT_FROM_ISSUER"}, - { CSSMERR_APPLETP_SMIME_EMAIL_ADDRS_NOT_FOUND,"CSSMERR_APPLETP_SMIME_EMAIL_ADDRS_NOT_FOUND"}, - { CSSMERR_APPLETP_SMIME_BAD_EXT_KEY_USE,"CSSMERR_APPLETP_SMIME_BAD_EXT_KEY_USE"}, - { CSSMERR_APPLETP_SMIME_BAD_KEY_USE,"CSSMERR_APPLETP_SMIME_BAD_KEY_USE"}, - { CSSMERR_APPLETP_SMIME_KEYUSAGE_NOT_CRITICAL,"CSSMERR_APPLETP_SMIME_KEYUSAGE_NOT_CRITICAL"}, - { CSSMERR_APPLETP_SMIME_NO_EMAIL_ADDRS,"CSSMERR_APPLETP_SMIME_NO_EMAIL_ADDRS"}, - { CSSMERR_APPLETP_SMIME_SUBJ_ALT_NAME_NOT_CRIT,"CSSMERR_APPLETP_SMIME_SUBJ_ALT_NAME_NOT_CRIT"}, - { CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE,"CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE"}, - { CSSMERR_APPLETP_OCSP_BAD_RESPONSE,"CSSMERR_APPLETP_OCSP_BAD_RESPONSE"}, - { CSSMERR_APPLETP_OCSP_BAD_REQUEST,"CSSMERR_APPLETP_OCSP_BAD_REQUEST"}, - { CSSMERR_APPLETP_OCSP_UNAVAILABLE,"CSSMERR_APPLETP_OCSP_UNAVAILABLE"}, - { CSSMERR_APPLETP_OCSP_STATUS_UNRECOGNIZED,"CSSMERR_APPLETP_OCSP_STATUS_UNRECOGNIZED"}, - { CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK,"CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK"}, - { CSSMERR_APPLETP_NETWORK_FAILURE,"CSSMERR_APPLETP_NETWORK_FAILURE"}, - { CSSMERR_APPLETP_OCSP_NOT_TRUSTED,"CSSMERR_APPLETP_OCSP_NOT_TRUSTED"}, - { CSSMERR_APPLETP_OCSP_INVALID_ANCHOR_CERT,"CSSMERR_APPLETP_OCSP_INVALID_ANCHOR_CERT"}, - { CSSMERR_APPLETP_OCSP_SIG_ERROR,"CSSMERR_APPLETP_OCSP_SIG_ERROR"}, - { CSSMERR_APPLETP_OCSP_NO_SIGNER,"CSSMERR_APPLETP_OCSP_NO_SIGNER"}, - { CSSMERR_APPLETP_OCSP_RESP_MALFORMED_REQ,"CSSMERR_APPLETP_OCSP_RESP_MALFORMED_REQ"}, - { CSSMERR_APPLETP_OCSP_RESP_INTERNAL_ERR,"CSSMERR_APPLETP_OCSP_RESP_INTERNAL_ERR"}, - { CSSMERR_APPLETP_OCSP_RESP_TRY_LATER,"CSSMERR_APPLETP_OCSP_RESP_TRY_LATER"}, - { CSSMERR_APPLETP_OCSP_RESP_SIG_REQUIRED,"CSSMERR_APPLETP_OCSP_RESP_SIG_REQUIRED"}, - { CSSMERR_APPLETP_OCSP_RESP_UNAUTHORIZED,"CSSMERR_APPLETP_OCSP_RESP_UNAUTHORIZED"}, - { CSSMERR_APPLETP_OCSP_NONCE_MISMATCH,"CSSMERR_APPLETP_OCSP_NONCE_MISMATCH"}, - { CSSMERR_APPLETP_CS_BAD_CERT_CHAIN_LENGTH,"CSSMERR_APPLETP_CS_BAD_CERT_CHAIN_LENGTH"}, - { CSSMERR_APPLETP_CS_NO_BASIC_CONSTRAINTS,"CSSMERR_APPLETP_CS_NO_BASIC_CONSTRAINTS"}, - { CSSMERR_APPLETP_CS_BAD_PATH_LENGTH,"CSSMERR_APPLETP_CS_BAD_PATH_LENGTH"}, - { CSSMERR_APPLETP_CS_NO_EXTENDED_KEY_USAGE,"CSSMERR_APPLETP_CS_NO_EXTENDED_KEY_USAGE"}, - { CSSMERR_APPLETP_CODE_SIGN_DEVELOPMENT,"CSSMERR_APPLETP_CODE_SIGN_DEVELOPMENT"}, - { CSSMERR_APPLETP_RS_BAD_CERT_CHAIN_LENGTH,"CSSMERR_APPLETP_RS_BAD_CERT_CHAIN_LENGTH"}, - { CSSMERR_APPLETP_RS_BAD_EXTENDED_KEY_USAGE,"CSSMERR_APPLETP_RS_BAD_EXTENDED_KEY_USAGE"}, - { CSSMERR_APPLETP_TRUST_SETTING_DENY,"CSSMERR_APPLETP_TRUST_SETTING_DENY"}, - { CSSMERR_APPLETP_INVALID_EMPTY_SUBJECT,"CSSMERR_APPLETP_INVALID_EMPTY_SUBJECT"}, - { CSSMERR_APPLETP_UNKNOWN_QUAL_CERT_STATEMENT,"CSSMERR_APPLETP_UNKNOWN_QUAL_CERT_STATEMENT"}, - { CSSMERR_APPLE_DOTMAC_REQ_QUEUED,"CSSMERR_APPLE_DOTMAC_REQ_QUEUED"}, - { CSSMERR_APPLE_DOTMAC_REQ_REDIRECT,"CSSMERR_APPLE_DOTMAC_REQ_REDIRECT"}, - { CSSMERR_APPLE_DOTMAC_REQ_SERVER_ERR,"CSSMERR_APPLE_DOTMAC_REQ_SERVER_ERR"}, - { CSSMERR_APPLE_DOTMAC_REQ_SERVER_PARAM,"CSSMERR_APPLE_DOTMAC_REQ_SERVER_PARAM"}, - { CSSMERR_APPLE_DOTMAC_REQ_SERVER_AUTH,"CSSMERR_APPLE_DOTMAC_REQ_SERVER_AUTH"}, - { CSSMERR_APPLE_DOTMAC_REQ_SERVER_UNIMPL,"CSSMERR_APPLE_DOTMAC_REQ_SERVER_UNIMPL"}, - { CSSMERR_APPLE_DOTMAC_REQ_SERVER_NOT_AVAIL,"CSSMERR_APPLE_DOTMAC_REQ_SERVER_NOT_AVAIL"}, - { CSSMERR_APPLE_DOTMAC_REQ_SERVER_ALREADY_EXIST,"CSSMERR_APPLE_DOTMAC_REQ_SERVER_ALREADY_EXIST"}, - { CSSMERR_APPLE_DOTMAC_REQ_SERVER_SERVICE_ERROR,"CSSMERR_APPLE_DOTMAC_REQ_SERVER_SERVICE_ERROR"}, - { CSSMERR_APPLE_DOTMAC_REQ_IS_PENDING,"CSSMERR_APPLE_DOTMAC_REQ_IS_PENDING"}, - { CSSMERR_APPLE_DOTMAC_NO_REQ_PENDING,"CSSMERR_APPLE_DOTMAC_NO_REQ_PENDING"}, - {0, NULL} -}; DELETED LocalTests/utilLib/fileIo.c Index: LocalTests/utilLib/fileIo.c ================================================================== --- LocalTests/utilLib/fileIo.c +++ /dev/null @@ -1,128 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "fileIo.h" - -int cspWriteFile( - const char *fileName, - const unsigned char *bytes, - unsigned numBytes) -{ - int rtn; - int fd; - - fd = open(fileName, O_RDWR | O_CREAT | O_TRUNC, 0600); - if(fd <= 0) { - return errno; - } - rtn = lseek(fd, 0, SEEK_SET); - if(rtn < 0) { - return errno; - } - rtn = write(fd, bytes, (size_t)numBytes); - if(rtn != (int)numBytes) { - if(rtn >= 0) { - printf("writeFile: short write\n"); - } - rtn = EIO; - } - else { - rtn = 0; - } - close(fd); - return rtn; -} - -/* - * Read entire file. - */ -int cspReadFile( - const char *fileName, - unsigned char **bytes, // mallocd and returned - unsigned *numBytes) // returned -{ - int ourRtn = 0; - int fd; - char *buf; - char *thisBuf; - struct stat sb; - unsigned size; - size_t toMove; - ssize_t thisMoved; - int irtn; - off_t lrtn = 0; - - *numBytes = 0; - *bytes = NULL; - fd = open(fileName, O_RDONLY, 0); - if(fd <= 0) { - perror("open"); - return errno; - } - irtn = fstat(fd, &sb); - if(irtn) { - ourRtn = errno; - if(ourRtn == 0) { - fprintf(stderr, "***Bogus zero error on fstat\n"); - ourRtn = -1; - } - else { - perror("fstat"); - } - goto errOut; - } - size = sb.st_size; - buf = thisBuf = (char *)malloc(size); - if(buf == NULL) { - ourRtn = ENOMEM; - goto errOut; - } - lrtn = lseek(fd, 0, SEEK_SET); - if(lrtn < 0) { - ourRtn = errno; - if(ourRtn == 0) { - fprintf(stderr, "***Bogus zero error on lseek\n"); - ourRtn = -1; - } - else { - perror("lseek"); - } - goto errOut; - } - toMove = size; - - /* - * On ppc this read ALWAYS returns the entire file. On i386, not so. - */ - do { - thisMoved = read(fd, thisBuf, toMove); - if(thisMoved == 0) { - /* reading empty file: done */ - break; - } - else if(thisMoved < 0) { - ourRtn = errno; - perror("read"); - break; - } - size_t uThisMoved = (size_t)thisMoved; - if(uThisMoved != toMove) { - fprintf(stderr, "===Short read: asked for %ld, got %lu\n", - toMove, uThisMoved); - } - toMove -= thisMoved; - thisBuf += thisMoved; - } while(toMove); - - if(ourRtn == 0) { - *bytes = (unsigned char *)buf; - *numBytes = size; - } -errOut: - close(fd); - return ourRtn; -} DELETED LocalTests/utilLib/fileIo.h Index: LocalTests/utilLib/fileIo.h ================================================================== --- LocalTests/utilLib/fileIo.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Read entire file. - */ -#ifdef __cplusplus -extern "C" { -#endif - -int cspReadFile( - const char *fileName, - unsigned char **bytes, // mallocd and returned - unsigned *numBytes); // returned - -int cspWriteFile( - const char *fileName, - const unsigned char *bytes, - unsigned numBytes); - -#ifdef __cplusplus -} -#endif DELETED LocalTests/utilLib/nssAppUtils.cpp Index: LocalTests/utilLib/nssAppUtils.cpp ================================================================== --- LocalTests/utilLib/nssAppUtils.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2003 Apple Computer, Inc. All Rights Reserved. - * - * The contents of this file constitute Original Code as defined in and are - * subject to the Apple Public Source License Version 1.2 (the 'License'). - * You may not use this file except in compliance with the License. Please - * obtain a copy of the License at http://www.apple.com/publicsource and - * read it before using this file. - * - * This Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - */ -/* - * nssAppUtils.cpp - */ - -#include "nssAppUtils.h" -#include "common.h" -#include "cspwrap.h" -#include -#include -#include -#include -#include - -/* - * Create pubKeyPartial as copy of pubKey without the DSA params. - * Returned partial key is RAW. Incoming key can be raw or ref. - */ -CSSM_RETURN extractDsaPartial( - CSSM_CSP_HANDLE cspHand, - const CSSM_KEY *pubKey, - CSSM_KEY_PTR pubKeyPartial) -{ - const CSSM_KEY *thePubKey = pubKey; - CSSM_KEY rawPubKey; - CSSM_RETURN crtn; - - if(pubKey->KeyHeader.BlobType == CSSM_KEYBLOB_REFERENCE) { - /* first get this in raw form */ - crtn = cspRefKeyToRaw(cspHand, pubKey, &rawPubKey); - if(crtn) { - return crtn; - } - thePubKey = &rawPubKey; - } - - /* decode raw public key */ - NSS_DSAPublicKeyX509 nssPub; - SecAsn1CoderRef coder; - - OSStatus ortn = SecAsn1CoderCreate(&coder); - if(ortn) { - cssmPerror("SecAsn1CoderCreate", ortn); - return ortn; - } - memset(&nssPub, 0, sizeof(nssPub)); - if(SecAsn1DecodeData(coder, &thePubKey->KeyData, kSecAsn1DSAPublicKeyX509Template, - &nssPub)) { - printf("***Error decoding DSA public key. Aborting.\n"); - return 1; - } - - /* zero out the params and reencode */ - nssPub.dsaAlg.params = NULL; - CSSM_DATA newKey = {0, NULL}; - if(SecAsn1EncodeItem(coder, &nssPub, kSecAsn1DSAPublicKeyX509Template, - &newKey)) { - printf("***Error reencoding DSA pub key\n"); - return 1; - } - - /* copy - newKey is in coder space */ - *pubKeyPartial = *thePubKey; - appCopyCssmData(&newKey, &pubKeyPartial->KeyData); - - if(pubKey->KeyHeader.BlobType == CSSM_KEYBLOB_REFERENCE) { - /* free the KeyData mallocd by cspRefKeyToRaw */ - CSSM_FREE(thePubKey->KeyData.Data); - pubKeyPartial->KeyHeader.BlobType = CSSM_KEYBLOB_RAW; - } - pubKeyPartial->KeyHeader.KeyAttr |= CSSM_KEYATTR_PARTIAL; - SecAsn1CoderRelease(coder); - return CSSM_OK; -} DELETED LocalTests/utilLib/nssAppUtils.h Index: LocalTests/utilLib/nssAppUtils.h ================================================================== --- LocalTests/utilLib/nssAppUtils.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2003 Apple Computer, Inc. All Rights Reserved. - * - * The contents of this file constitute Original Code as defined in and are - * subject to the Apple Public Source License Version 1.2 (the 'License'). - * You may not use this file except in compliance with the License. Please - * obtain a copy of the License at http://www.apple.com/publicsource and - * read it before using this file. - * - * This Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - */ -/* - * nssAppUtils.h - */ - -#ifndef _NSS_APP_UTILS_H_ -#define _NSS_APP_UTILS_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -CSSM_RETURN extractDsaPartial( - CSSM_CSP_HANDLE cspHand, - const CSSM_KEY *pubKey, - CSSM_KEY_PTR pubKeyPartial); - -#ifdef __cplusplus -} -#endif - -#endif /* _NSS_APP_UTILS_H_ */ - DELETED LocalTests/utilLib/rijndael-alg-ref.c Index: LocalTests/utilLib/rijndael-alg-ref.c ================================================================== --- LocalTests/utilLib/rijndael-alg-ref.c +++ /dev/null @@ -1,373 +0,0 @@ -/* rijndael-alg-ref.c v2.0 August '99 - * Reference ANSI C code - * authors: Paulo Barreto - * Vincent Rijmen - */ - -#include -#include - -#include "rijndael-alg-ref.h" - -#define SC ((BC - 4) >> 1) - -#include "boxes-ref.h" - -static const word8 shifts[3][4][2] = { - { { 0, 0 }, - { 1, 3 }, - { 2, 2 }, - { 3, 1 } - }, - { { 0, 0 }, - { 1, 5 }, - { 2, 4 }, - { 3, 3 } - }, - { { 0, 0 }, - { 1, 7 }, - { 3, 5 }, - { 4, 4 } - } -}; - - -static word8 mul(word8 a, word8 b) { - /* multiply two elements of GF(2^m) - * needed for MixColumn and InvMixColumn - */ - if (a && b) return Alogtable[(Logtable[a] + Logtable[b])%255]; - else return 0; -} - -static void KeyAddition(word8 a[4][MAXBC], word8 rk[4][MAXBC], word8 BC) { - /* Exor corresponding text input and round key input bytes - */ - int i, j; - - for(i = 0; i < 4; i++) - for(j = 0; j < BC; j++) a[i][j] ^= rk[i][j]; -} - -static void ShiftRow(word8 a[4][MAXBC], word8 d, word8 BC) { - /* Row 0 remains unchanged - * The other three rows are shifted a variable amount - */ - word8 tmp[MAXBC]; - int i, j; - - for(i = 1; i < 4; i++) { - for(j = 0; j < BC; j++) tmp[j] = a[i][(j + shifts[SC][i][d]) % BC]; - for(j = 0; j < BC; j++) a[i][j] = tmp[j]; - } -} - -static void Substitution(word8 a[4][MAXBC], const word8 box[256], word8 BC) { - /* Replace every byte of the input by the byte at that place - * in the nonlinear S-box - */ - int i, j; - - for(i = 0; i < 4; i++) - for(j = 0; j < BC; j++) a[i][j] = box[a[i][j]] ; -} - -static void MixColumn(word8 a[4][MAXBC], word8 BC) { - /* Mix the four bytes of every column in a linear way - */ - word8 b[4][MAXBC]; - int i, j; - - for(j = 0; j < BC; j++) - for(i = 0; i < 4; i++) - b[i][j] = mul(2,a[i][j]) - ^ mul(3,a[(i + 1) % 4][j]) - ^ a[(i + 2) % 4][j] - ^ a[(i + 3) % 4][j]; - for(i = 0; i < 4; i++) - for(j = 0; j < BC; j++) a[i][j] = b[i][j]; -} - -static void InvMixColumn(word8 a[4][MAXBC], word8 BC) { - /* Mix the four bytes of every column in a linear way - * This is the opposite operation of Mixcolumn - */ - word8 b[4][MAXBC]; - int i, j; - - for(j = 0; j < BC; j++) - for(i = 0; i < 4; i++) - b[i][j] = mul(0xe,a[i][j]) - ^ mul(0xb,a[(i + 1) % 4][j]) - ^ mul(0xd,a[(i + 2) % 4][j]) - ^ mul(0x9,a[(i + 3) % 4][j]); - for(i = 0; i < 4; i++) - for(j = 0; j < BC; j++) a[i][j] = b[i][j]; -} - -int _rijndaelKeySched (word8 k[4][MAXKC], int keyBits, int blockBits, word8 W[MAXROUNDS+1][4][MAXBC]) { - /* Calculate the necessary round keys - * The number of calculations depends on keyBits and blockBits - */ - int KC, BC, ROUNDS; - int i, j, t, rconpointer = 0; - word8 tk[4][MAXKC]; - - switch (keyBits) { - case 128: KC = 4; break; - case 192: KC = 6; break; - case 256: KC = 8; break; - default : return (-1); - } - - switch (blockBits) { - case 128: BC = 4; break; - case 192: BC = 6; break; - case 256: BC = 8; break; - default : return (-2); - } - - switch (keyBits >= blockBits ? keyBits : blockBits) { - case 128: ROUNDS = 10; break; - case 192: ROUNDS = 12; break; - case 256: ROUNDS = 14; break; - default : return (-3); /* this cannot happen */ - } - - - for(j = 0; j < KC; j++) - for(i = 0; i < 4; i++) - tk[i][j] = k[i][j]; - t = 0; - /* copy values into round key array */ - for(j = 0; (j < KC) && (t < (ROUNDS+1)*BC); j++, t++) - for(i = 0; i < 4; i++) W[t / BC][i][t % BC] = tk[i][j]; - - while (t < (ROUNDS+1)*BC) { /* while not enough round key material calculated */ - /* calculate new values */ - for(i = 0; i < 4; i++) - tk[i][0] ^= S[tk[(i+1)%4][KC-1]]; - tk[0][0] ^= rcon[rconpointer++]; - - if (KC != 8) - for(j = 1; j < KC; j++) - for(i = 0; i < 4; i++) tk[i][j] ^= tk[i][j-1]; - else { - for(j = 1; j < KC/2; j++) - for(i = 0; i < 4; i++) tk[i][j] ^= tk[i][j-1]; - for(i = 0; i < 4; i++) tk[i][KC/2] ^= S[tk[i][KC/2 - 1]]; - for(j = KC/2 + 1; j < KC; j++) - for(i = 0; i < 4; i++) tk[i][j] ^= tk[i][j-1]; - } - /* copy values into round key array */ - for(j = 0; (j < KC) && (t < (ROUNDS+1)*BC); j++, t++) - for(i = 0; i < 4; i++) W[t / BC][i][t % BC] = tk[i][j]; - } - - return 0; -} - -int _rijndaelEncrypt (word8 a[4][MAXBC], int keyBits, int blockBits, word8 rk[MAXROUNDS+1][4][MAXBC]) -{ - /* Encryption of one block. - */ - int r, BC, ROUNDS; - - switch (blockBits) { - case 128: BC = 4; break; - case 192: BC = 6; break; - case 256: BC = 8; break; - default : return (-2); - } - - switch (keyBits >= blockBits ? keyBits : blockBits) { - case 128: ROUNDS = 10; break; - case 192: ROUNDS = 12; break; - case 256: ROUNDS = 14; break; - default : return (-3); /* this cannot happen */ - } - - /* begin with a key addition - */ - KeyAddition(a,rk[0],BC); - - /* ROUNDS-1 ordinary rounds - */ - for(r = 1; r < ROUNDS; r++) { - Substitution(a,S,BC); - ShiftRow(a,0,BC); - MixColumn(a,BC); - KeyAddition(a,rk[r],BC); - } - - /* Last round is special: there is no MixColumn - */ - Substitution(a,S,BC); - ShiftRow(a,0,BC); - KeyAddition(a,rk[ROUNDS],BC); - - return 0; -} - - -#ifndef __APPLE__ - -int rijndaelEncryptRound (word8 a[4][MAXBC], int keyBits, int blockBits, - word8 rk[MAXROUNDS+1][4][MAXBC], int rounds) -/* Encrypt only a certain number of rounds. - * Only used in the Intermediate Value Known Answer Test. - */ -{ - int r, BC, ROUNDS; - - switch (blockBits) { - case 128: BC = 4; break; - case 192: BC = 6; break; - case 256: BC = 8; break; - default : return (-2); - } - - switch (keyBits >= blockBits ? keyBits : blockBits) { - case 128: ROUNDS = 10; break; - case 192: ROUNDS = 12; break; - case 256: ROUNDS = 14; break; - default : return (-3); /* this cannot happen */ - } - - /* make number of rounds sane */ - if (rounds > ROUNDS) rounds = ROUNDS; - - /* begin with a key addition - */ - KeyAddition(a,rk[0],BC); - - /* at most ROUNDS-1 ordinary rounds - */ - for(r = 1; (r <= rounds) && (r < ROUNDS); r++) { - Substitution(a,S,BC); - ShiftRow(a,0,BC); - MixColumn(a,BC); - KeyAddition(a,rk[r],BC); - } - - /* if necessary, do the last, special, round: - */ - if (rounds == ROUNDS) { - Substitution(a,S,BC); - ShiftRow(a,0,BC); - KeyAddition(a,rk[ROUNDS],BC); - } - - return 0; -} -#endif /* __APPLE__ */ - -int _rijndaelDecrypt (word8 a[4][MAXBC], int keyBits, int blockBits, word8 rk[MAXROUNDS+1][4][MAXBC]) -{ - int r, BC, ROUNDS; - - switch (blockBits) { - case 128: BC = 4; break; - case 192: BC = 6; break; - case 256: BC = 8; break; - default : return (-2); - } - - switch (keyBits >= blockBits ? keyBits : blockBits) { - case 128: ROUNDS = 10; break; - case 192: ROUNDS = 12; break; - case 256: ROUNDS = 14; break; - default : return (-3); /* this cannot happen */ - } - - /* To decrypt: apply the inverse operations of the encrypt routine, - * in opposite order - * - * (KeyAddition is an involution: it 's equal to its inverse) - * (the inverse of Substitution with table S is Substitution with the inverse table of S) - * (the inverse of Shiftrow is Shiftrow over a suitable distance) - */ - - /* First the special round: - * without InvMixColumn - * with extra KeyAddition - */ - KeyAddition(a,rk[ROUNDS],BC); - Substitution(a,Si,BC); - ShiftRow(a,1,BC); - - /* ROUNDS-1 ordinary rounds - */ - for(r = ROUNDS-1; r > 0; r--) { - KeyAddition(a,rk[r],BC); - InvMixColumn(a,BC); - Substitution(a,Si,BC); - ShiftRow(a,1,BC); - } - - /* End with the extra key addition - */ - - KeyAddition(a,rk[0],BC); - - return 0; -} - -#ifndef __APPLE__ - -int rijndaelDecryptRound (word8 a[4][MAXBC], int keyBits, int blockBits, - word8 rk[MAXROUNDS+1][4][MAXBC], int rounds) -/* Decrypt only a certain number of rounds. - * Only used in the Intermediate Value Known Answer Test. - * Operations rearranged such that the intermediate values - * of decryption correspond with the intermediate values - * of encryption. - */ -{ - int r, BC, ROUNDS; - - switch (blockBits) { - case 128: BC = 4; break; - case 192: BC = 6; break; - case 256: BC = 8; break; - default : return (-2); - } - - switch (keyBits >= blockBits ? keyBits : blockBits) { - case 128: ROUNDS = 10; break; - case 192: ROUNDS = 12; break; - case 256: ROUNDS = 14; break; - default : return (-3); /* this cannot happen */ - } - - - /* make number of rounds sane */ - if (rounds > ROUNDS) rounds = ROUNDS; - - /* First the special round: - * without InvMixColumn - * with extra KeyAddition - */ - KeyAddition(a,rk[ROUNDS],BC); - Substitution(a,Si,BC); - ShiftRow(a,1,BC); - - /* ROUNDS-1 ordinary rounds - */ - for(r = ROUNDS-1; r > rounds; r--) { - KeyAddition(a,rk[r],BC); - InvMixColumn(a,BC); - Substitution(a,Si,BC); - ShiftRow(a,1,BC); - } - - if (rounds == 0) { - /* End with the extra key addition - */ - KeyAddition(a,rk[0],BC); - } - - return 0; -} - -#endif /* __APPLE__ */ DELETED LocalTests/utilLib/rijndael-alg-ref.h Index: LocalTests/utilLib/rijndael-alg-ref.h ================================================================== --- LocalTests/utilLib/rijndael-alg-ref.h +++ /dev/null @@ -1,53 +0,0 @@ -/* rijndael-alg-ref.h v2.0 August '99 - * Reference ANSI C code - * authors: Paulo Barreto - * Vincent Rijmen - */ -#ifndef __RIJNDAEL_ALG_H -#define __RIJNDAEL_ALG_H - -#ifdef __APPLE__ -#define MIN_AES_KEY_BITS 128 -#define MID_AES_KEY_BITS 192 -#define MAX_AES_KEY_BITS 256 -#define MAX_AES_KEY_BYTES (MAX_AES_KEY_BITS / 8) - -#define MIN_AES_BLOCK_BITS 128 -#define MID_AES_BLOCK_BITS 192 -#define MAX_AES_BLOCK_BITS 256 -#define MIN_AES_BLOCK_BYTES (MIN_AES_BLOCK_BITS / 8) - -#endif -#define MAXBC (MAX_AES_BLOCK_BITS/32) -#define MAXKC (MAX_AES_KEY_BITS/32) -#define MAXROUNDS 14 - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned char word8; -typedef unsigned short word16; -typedef unsigned long word32; - - -int _rijndaelKeySched (word8 k[4][MAXKC], int keyBits, int blockBits, - word8 rk[MAXROUNDS+1][4][MAXBC]); -int _rijndaelEncrypt (word8 a[4][MAXBC], int keyBits, int blockBits, - word8 rk[MAXROUNDS+1][4][MAXBC]); -#ifndef __APPLE__ -int rijndaelEncryptRound (word8 a[4][MAXBC], int keyBits, int blockBits, - word8 rk[MAXROUNDS+1][4][MAXBC], int rounds); -#endif -int _rijndaelDecrypt (word8 a[4][MAXBC], int keyBits, int blockBits, - word8 rk[MAXROUNDS+1][4][MAXBC]); -#ifndef __APPLE__ -int rijndaelDecryptRound (word8 a[4][MAXBC], int keyBits, int blockBits, - word8 rk[MAXROUNDS+1][4][MAXBC], int rounds); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __RIJNDAEL_ALG_H */ DELETED LocalTests/utilLib/rijndaelApi.c Index: LocalTests/utilLib/rijndaelApi.c ================================================================== --- LocalTests/utilLib/rijndaelApi.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - * rijndaelApi.c - AES API layer - * - * Based on rijndael-api-ref.h v2.0 written by Paulo Barreto - * and Vincent Rijmen - */ -#include -#include - -#include "rijndael-alg-ref.h" -#include "rijndaelApi.h" - -#define CBC_DEBUG 0 -#if CBC_DEBUG -static void dumpChainBuf(cipherInstance *cipher, char *op) -{ - int t,j; - int columns = cipher->blockLen / 32; - - printf("chainBuf %s: ", op); - for (j = 0; j < columns; j++) { - for(t = 0; t < 4; t++) { - printf("%02x ", cipher->chainBlock[t][j]); - } - } - printf("\n"); -} -#else -#define dumpChainBuf(c, o) -#endif - -int _makeKey( keyInstance *key, - BYTE direction, - int keyLen, // in BITS - int blockLen, // in BITS - BYTE *keyMaterial) -{ - word8 k[4][MAXKC]; - unsigned keyBytes; - unsigned i; - - if (key == NULL) { - return BAD_KEY_INSTANCE; - } - if(keyMaterial == NULL) { - return BAD_KEY_MAT; - } - if ((direction == DIR_ENCRYPT) || (direction == DIR_DECRYPT)) { - key->direction = direction; - } else { - return BAD_KEY_DIR; - } - - if ((keyLen == 128) || (keyLen == 192) || (keyLen == 256)) { - key->keyLen = keyLen; - } else { - return BAD_KEY_MAT; - } - key->blockLen = blockLen; - - /* initialize key schedule: */ - keyBytes = keyLen / 8; - for(i = 0; i < keyBytes; i++) { - k[i % 4][i / 4] = keyMaterial[i]; - } - _rijndaelKeySched (k, key->keyLen, key->blockLen, key->keySched); - memset(k, 0, 4 * MAXKC); - return TRUE; -} - -int _cipherInit( cipherInstance *cipher, - BYTE mode, - int blockLen, // in BITS - BYTE *IV) -{ - int t, j; - int columns = blockLen / 32; - - /* MODE_CFB1 not supported */ - if ((mode == MODE_ECB) || (mode == MODE_CBC)) { - cipher->mode = mode; - } else { - return BAD_CIPHER_MODE; - } - cipher->blockLen = blockLen; - - if (IV != NULL) { - /* Save IV in rectangular block format */ - for (j = 0; j < columns; j++) { - for(t = 0; t < 4; t++) { - /* parse initial value into rectangular array */ - cipher->chainBlock[t][j] = IV[t+4*j]; - } - } - } - dumpChainBuf(cipher, "init "); - return TRUE; -} - - -int _blockEncrypt(cipherInstance *cipher, - keyInstance *key, BYTE *input, int inputLen, BYTE *outBuffer) -{ - int i, j, t, numBlocks; - unsigned blockSizeBytes; - int columns; - - /* check parameter consistency: */ - if (key == NULL || - key->direction != DIR_ENCRYPT || - (key->keyLen != 128 && key->keyLen != 192 && key->keyLen != 256)) { - return BAD_KEY_MAT; - } - if (cipher == NULL || - (cipher->mode != MODE_ECB && cipher->mode != MODE_CBC) || - (cipher->blockLen != 128 && cipher->blockLen != 192 && cipher->blockLen != 256)) { - return BAD_CIPHER_STATE; - } - - numBlocks = inputLen/cipher->blockLen; - blockSizeBytes = cipher->blockLen / 8; - columns = cipher->blockLen / 32; - - switch (cipher->mode) { - case MODE_ECB: - for (i = 0; i < numBlocks; i++) { - for (j = 0; j < columns; j++) { - for(t = 0; t < 4; t++) - /* parse input stream into rectangular array */ - cipher->chainBlock[t][j] = input[4*j+t]; - } - _rijndaelEncrypt (cipher->chainBlock, key->keyLen, cipher->blockLen, key->keySched); - for (j = 0; j < columns; j++) { - /* parse rectangular array into output ciphertext bytes */ - for(t = 0; t < 4; t++) - outBuffer[4*j+t] = (BYTE) cipher->chainBlock[t][j]; - } - input += blockSizeBytes; - outBuffer += blockSizeBytes; - dumpChainBuf(cipher, "encr ECB"); - } - break; - - case MODE_CBC: - for (i = 0; i < numBlocks; i++) { - for (j = 0; j < columns; j++) { - for(t = 0; t < 4; t++) - /* parse input stream into rectangular array and exor with - IV or the previous ciphertext */ - cipher->chainBlock[t][j] ^= input[4*j+t]; - } - _rijndaelEncrypt (cipher->chainBlock, key->keyLen, cipher->blockLen, key->keySched); - for (j = 0; j < columns; j++) { - /* parse rectangular array into output ciphertext bytes */ - for(t = 0; t < 4; t++) - outBuffer[4*j+t] = (BYTE) cipher->chainBlock[t][j]; - } - /* Hey! This code was broken for multi-block ops! */ - input += blockSizeBytes; - outBuffer += blockSizeBytes; - dumpChainBuf(cipher, "encr CBC"); - } - break; - - default: return BAD_CIPHER_STATE; - } - - return numBlocks*cipher->blockLen; -} - -int _blockDecrypt(cipherInstance *cipher, - keyInstance *key, BYTE *input, int inputLen, BYTE *outBuffer) -{ - int i, j, t, numBlocks; - word8 block[4][MAXBC]; // working memory: encrypt/decrypt in place here - unsigned blockSizeBytes; - word8 cblock[4][MAXBC]; // saved ciphertext - int columns; - - if (cipher == NULL || - key == NULL || - key->direction == DIR_ENCRYPT || - cipher->blockLen != key->blockLen) { - return BAD_CIPHER_STATE; - } - - /* check parameter consistency: */ - if (key == NULL || - key->direction != DIR_DECRYPT || - (key->keyLen != 128 && key->keyLen != 192 && key->keyLen != 256)) { - return BAD_KEY_MAT; - } - if (cipher == NULL || - (cipher->mode != MODE_ECB && cipher->mode != MODE_CBC) || - (cipher->blockLen != 128 && cipher->blockLen != 192 && cipher->blockLen != 256)) { - return BAD_CIPHER_STATE; - } - - numBlocks = inputLen/cipher->blockLen; - blockSizeBytes = cipher->blockLen / 8; - columns = cipher->blockLen / 32; - - switch (cipher->mode) { - case MODE_ECB: - for (i = 0; i < numBlocks; i++) { - for (j = 0; j < columns; j++) { - for(t = 0; t < 4; t++) - /* parse input stream into rectangular array */ - block[t][j] = input[4*j+t]; - } - _rijndaelDecrypt (block, key->keyLen, cipher->blockLen, key->keySched); - for (j = 0; j < columns; j++) { - /* parse rectangular array into output ciphertext bytes */ - for(t = 0; t < 4; t++) - outBuffer[4*j+t] = (BYTE) block[t][j]; - } - input += blockSizeBytes; - outBuffer += blockSizeBytes; - dumpChainBuf(cipher, "decr ECB"); - } - break; - - case MODE_CBC: - for (i = 0; i < numBlocks; i++) { - for (j = 0; j < columns; j++) { - for(t = 0; t < 4; t++) - /* parse input stream into rectangular array */ - block[t][j] = input[4*j+t]; - } - - /* save a copoy of incoming ciphertext for later chain; decrypt */ - memmove(cblock, block, 4*MAXBC); - _rijndaelDecrypt (block, key->keyLen, cipher->blockLen, key->keySched); - - /* - * exor with last ciphertext --> plaintext out - * save this ciphertext in lastBlock - * FIXME - we can optimize this by avoiding the copy into - * lastBlock on all but last time thru... - */ - for (j = 0; j < columns; j++) { - for(t = 0; t < 4; t++) { - outBuffer[4*j+t] = (block[t][j] ^ cipher->chainBlock[t][j]); - } - } - memmove(cipher->chainBlock, cblock, 4 * MAXBC); - input += blockSizeBytes; - outBuffer += blockSizeBytes; - dumpChainBuf(cipher, "decr CBC"); - } - break; - - default: return BAD_CIPHER_STATE; - } - memset(block, 0, 4 * MAXBC); - memset(cblock, 0, 4 * MAXBC); - return numBlocks*cipher->blockLen; -} - -/* - * Apple addenda 3/28/2001: simplified single-block encrypt/decrypt. - * Used when chaining and padding is done in elsewhere. - */ -#define AES_CONSISTENCY_CHECK 1 - -int _rijndaelBlockEncrypt( - cipherInstance *cipher, - keyInstance *key, - BYTE *input, - BYTE *outBuffer) -{ - int j, t; - unsigned blockSizeBytes; - int columns; - - #if AES_CONSISTENCY_CHECK - /* check parameter consistency: */ - if (key == NULL || - key->direction != DIR_ENCRYPT || - (key->keyLen != 128 && key->keyLen != 192 && key->keyLen != 256)) { - return BAD_KEY_MAT; - } - if (cipher == NULL || - (cipher->mode != MODE_ECB && cipher->mode != MODE_CBC) || - (cipher->blockLen != 128 && cipher->blockLen != 192 && cipher->blockLen != 256)) { - return BAD_CIPHER_STATE; - } - #endif /* AES_CONSISTENCY_CHECK */ - - blockSizeBytes = cipher->blockLen >> 3; /* was / 8; should just save in cipher */ - columns = cipher->blockLen >> 5; /* was / 32; ditto */ - - for (j = 0; j < columns; j++) { - for(t = 0; t < 4; t++) - /* parse input stream into rectangular array */ - cipher->chainBlock[t][j] = input[4*j+t]; - } - _rijndaelEncrypt (cipher->chainBlock, key->keyLen, cipher->blockLen, - key->keySched); - for (j = 0; j < columns; j++) { - /* parse rectangular array into output ciphertext bytes */ - for(t = 0; t < 4; t++) - outBuffer[4*j+t] = (BYTE) cipher->chainBlock[t][j]; - } - return cipher->blockLen; -} - -int _rijndaelBlockDecrypt( - cipherInstance *cipher, - keyInstance *key, - BYTE *input, - BYTE *outBuffer) -{ - int j, t; - word8 block[4][MAXBC]; // working memory: encrypt/decrypt in place here - unsigned blockSizeBytes; - int columns; - - #if AES_CONSISTENCY_CHECK - if (cipher == NULL || - key == NULL || - key->direction == DIR_ENCRYPT || - cipher->blockLen != key->blockLen) { - return BAD_CIPHER_STATE; - } - - /* check parameter consistency: */ - if (key == NULL || - key->direction != DIR_DECRYPT || - (key->keyLen != 128 && key->keyLen != 192 && key->keyLen != 256)) { - return BAD_KEY_MAT; - } - if (cipher == NULL || - (cipher->mode != MODE_ECB && cipher->mode != MODE_CBC) || - (cipher->blockLen != 128 && cipher->blockLen != 192 && cipher->blockLen != 256)) { - return BAD_CIPHER_STATE; - } - #endif /* AES_CONSISTENCY_CHECK */ - - blockSizeBytes = cipher->blockLen >> 3; /* was / 8; should just save in cipher */ - columns = cipher->blockLen >> 5; /* was / 32; ditto */ - - for (j = 0; j < columns; j++) { - for(t = 0; t < 4; t++) - /* parse input stream into rectangular array */ - block[t][j] = input[4*j+t]; - } - _rijndaelDecrypt (block, key->keyLen, cipher->blockLen, key->keySched); - for (j = 0; j < columns; j++) { - /* parse rectangular array into output ciphertext bytes */ - for(t = 0; t < 4; t++) - outBuffer[4*j+t] = (BYTE) block[t][j]; - } - - return cipher->blockLen; -} - DELETED LocalTests/utilLib/rijndaelApi.h Index: LocalTests/utilLib/rijndaelApi.h ================================================================== --- LocalTests/utilLib/rijndaelApi.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * rijndaelApi.h - AES API layer - * - * Based on rijndael-api-ref.h v2.0 written by Paulo Barreto - * and Vincent Rijmen - */ - -#ifndef _RIJNDAEL_API_REF_H_ -#define _RIJNDAEL_API_REF_H_ - -#include -#include "rijndael-alg-ref.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define DIR_ENCRYPT 0 /* Are we encrpyting? */ -#define DIR_DECRYPT 1 /* Are we decrpyting? */ -#define MODE_ECB 1 /* Are we ciphering in ECB mode? */ -#define MODE_CBC 2 /* Are we ciphering in CBC mode? */ - -#define TRUE 1 -#define FALSE 0 - -/* Error Codes */ -#define BAD_KEY_DIR -1 /* Key direction is invalid, e.g., - unknown value */ -#define BAD_KEY_MAT -2 /* Key material not of correct - length */ -#define BAD_KEY_INSTANCE -3 /* Key passed is not valid */ -#define BAD_CIPHER_MODE -4 /* Params struct passed to - cipherInit invalid */ -#define BAD_CIPHER_STATE -5 /* Cipher in wrong state (e.g., not - initialized) */ -#define BAD_CIPHER_INSTANCE -7 - -#define MAX_AES_KEY_SIZE (MAX_AES_KEY_BITS / 8) -#define MAX_AES_BLOCK_SIZE (MAX_AES_BLOCK_BITS / 8) -#define MAX_AES_IV_SIZE MAX_AES_BLOCK_SIZE - -typedef unsigned char BYTE; - -/* The structure for key information */ -typedef struct { - BYTE direction; /* Key used for encrypting or decrypting? */ - int keyLen; /* Length of the key in bits */ - int blockLen; /* Length of block in bits */ - word8 keySched[MAXROUNDS+1][4][MAXBC]; /* key schedule */ - } keyInstance; - -/* The structure for cipher information */ -typedef struct { - BYTE mode; /* MODE_ECB, MODE_CBC, or MODE_CFB1 */ - word8 chainBlock[4][MAXBC]; - int blockLen; /* block length in bits */ - } cipherInstance; - - -int _makeKey( - keyInstance *key, - BYTE direction, - int keyLen, // in BITS - int blockLen, // in BITS - BYTE *keyMaterial); - -int _cipherInit( - cipherInstance *cipher, - BYTE mode, - int blockLen, // in BITS - BYTE *IV); - -int _blockEncrypt( - cipherInstance *cipher, - keyInstance *key, - BYTE *input, - int inputLen, // in BITS - BYTE *outBuffer); - -int _blockDecrypt( - cipherInstance *cipher, - keyInstance *key, - BYTE *input, - int inputLen, // in BITS - BYTE *outBuffer); - -/* - * Apple addenda 3/28/2001: simplified single-block encrypt/decrypt. - * Used when chaining and padding is done in elsewhere. - */ -int _rijndaelBlockEncrypt( - cipherInstance *cipher, - keyInstance *key, - BYTE *input, - BYTE *outBuffer); -int _rijndaelBlockDecrypt( - cipherInstance *cipher, - keyInstance *key, - BYTE *input, - BYTE *outBuffer); - -#ifdef __cplusplus -} -#endif // cplusplus - -#endif // RIJNDAEL_API_REF - - DELETED LocalTests/utilLib/ssleayUtils.cpp Index: LocalTests/utilLib/ssleayUtils.cpp ================================================================== --- LocalTests/utilLib/ssleayUtils.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* - * ssleayUtils.c - common routines for CDSA/openssl compatibility testing - */ - -#include -#include -#include -#include -#include -#include -#include "ssleayUtils.h" -#include -#include "common.h" - -/* - * Caller sees EAY_KEY, we see a pointer to this. - */ -typedef struct { - CSSM_ALGORITHMS alg; - union { - BF_KEY bf; // blowfish - CAST_KEY cast; - } key; -} EayKeyPriv; - -/* - * Create a symmetric key. - */ -CSSM_RETURN eayGenSymKey( - CSSM_ALGORITHMS alg, - CSSM_BOOL forEncr, - const CSSM_DATA *keyData, - EAY_KEY *key) // RETURNED -{ - EayKeyPriv *ekp = (EayKeyPriv *)malloc(sizeof(EayKeyPriv)); - memset(ekp, 0, sizeof(*ekp)); - switch(alg) { - case CSSM_ALGID_BLOWFISH: - BF_set_key(&ekp->key.bf, keyData->Length, keyData->Data); - break; - case CSSM_ALGID_CAST: // cast128 only - CAST_set_key(&ekp->key.cast, keyData->Length, keyData->Data); - break; - default: - printf("***eayGenSymKey: bad alg\n"); - return -1; - } - ekp->alg = alg; - *key = (EAY_KEY)ekp; - return CSSM_OK; -} - -/* - * Free a key created in eayGenSymKey - */ -CSSM_RETURN eayFreeKey( - EAY_KEY key) -{ - memset(key, 0, sizeof(EayKeyPriv)); - free(key); - return CSSM_OK; -} - -/* - * encrypt/decrypt - */ -CSSM_RETURN eayEncryptDecrypt( - EAY_KEY key, - CSSM_BOOL forEncrypt, - CSSM_ALGORITHMS encrAlg, - CSSM_ENCRYPT_MODE mode, // CSSM_ALGMODE_CBC ONLY! - const CSSM_DATA *iv, //Êoptional per mode - const CSSM_DATA *inData, - CSSM_DATA_PTR outData) // CSSM_MALLOCd and RETURNED -{ - EayKeyPriv *ekp = (EayKeyPriv *)key; - if((mode != CSSM_ALGMODE_CBC_IV8) && (mode != CSSM_ALGMODE_ECB)) { - printf("***eayEncryptDecrypt only does CBC_IV8, ECB\n"); - return -1; - } - - bool cbc = (mode == CSSM_ALGMODE_ECB) ? false : true; - - outData->Data = (uint8 *)CSSM_MALLOC(inData->Length); - outData->Length = inData->Length; - - /* BF_cbc_encrypt actually writes to IV */ - CSSM_DATA ivc = {0, NULL}; - if(cbc) { - ivc.Data = (uint8 *)malloc(iv->Length); - ivc.Length = iv->Length; - memmove(ivc.Data, iv->Data, ivc.Length); - } - switch(encrAlg) { - case CSSM_ALGID_BLOWFISH: - if(cbc) { - BF_cbc_encrypt(inData->Data, - outData->Data, - inData->Length, - &ekp->key.bf, - ivc.Data, - forEncrypt ? BF_ENCRYPT : BF_DECRYPT); - } - else { - CSSM_DATA intext = *inData; - CSSM_DATA outtext = *outData; - while(intext.Length) { - BF_ecb_encrypt(intext.Data, - outtext.Data, - &ekp->key.bf, - forEncrypt ? BF_ENCRYPT : BF_DECRYPT); - intext.Data += 8; - outtext.Data += 8; - intext.Length -= 8; - } - } - break; - case CSSM_ALGID_CAST: // cast128 only - CAST_cbc_encrypt(inData->Data, - outData->Data, - inData->Length, - &ekp->key.cast, - ivc.Data, - forEncrypt ? CAST_ENCRYPT : CAST_DECRYPT); - break; - default: - printf("***eayEncryptDecrypt: bad alg\n"); - return -1; - } - if(ivc.Data) { - free(ivc.Data); - } - return CSSM_OK; -} - -/*** EVP-based encrypt/decrypt ***/ - -int evpEncryptDecrypt( - CSSM_ALGORITHMS alg, // AES 128 only for now - CSSM_BOOL forEncr, - const CSSM_DATA *keyData, // may be larger than the key size we use - unsigned keyLengthInBits, - CSSM_ENCRYPT_MODE mode, // CSSM_ALGMODE_CBC_IV8, ECB, always padding - const CSSM_DATA *iv, // optional per mode - const CSSM_DATA *inData, - CSSM_DATA_PTR outData) // CSSM_MALLOCd and RETURNED -{ - EVP_CIPHER_CTX ctx; - const EVP_CIPHER *cipher; - unsigned blockSize; - unsigned outLen = inData->Length; - bool noPad = false; - - switch(alg) { - case CSSM_ALGID_AES: - switch(mode) { - case CSSM_ALGMODE_CBCPadIV8: - switch(keyLengthInBits) { - case 128: - cipher = EVP_aes_128_cbc(); - break; - case 192: - cipher = EVP_aes_192_cbc(); - break; - case 256: - cipher = EVP_aes_256_cbc(); - break; - default: - printf("***Bad AES key length (%u)\n", keyLengthInBits); - return -1; - } - break; - case CSSM_ALGMODE_ECB: - switch(keyLengthInBits) { - case 128: - cipher = EVP_aes_128_ecb(); - break; - case 192: - cipher = EVP_aes_192_ecb(); - break; - case 256: - cipher = EVP_aes_256_ecb(); - break; - default: - printf("***Bad AES key length (%u)\n", keyLengthInBits); - return -1; - } - noPad = true; - break; - default: - printf("***evpEncryptDecrypt only does CBC and ECB for now\n"); - return -1; - } - blockSize = 16; - break; - case CSSM_ALGID_DES: - switch(mode) { - case CSSM_ALGMODE_CBCPadIV8: - cipher = EVP_des_cbc(); - break; - case CSSM_ALGMODE_ECB: - cipher = EVP_des_ecb(); - noPad = true; - break; - default: - printf("***evpEncryptDecrypt only does CBC and ECB for now\n"); - return -1; - } - blockSize = 8; - break; - default: - printf("***evpEncryptDecrypt only does DES and AES 128 for now\n"); - return -1; - } - outLen += blockSize; - unsigned char *outp = (uint8 *)CSSM_MALLOC(outLen); - int outl = outLen; - outData->Data = outp; - - if(forEncr) { - int rtn = EVP_EncryptInit(&ctx, cipher, keyData->Data, iv ? iv->Data : NULL); - if(!rtn) { - printf("EVP_EncryptInit error\n"); - return -1; - } - if(noPad) { - EVP_CIPHER_CTX_set_padding(&ctx, 0); - } - if(!EVP_EncryptUpdate(&ctx, outp, &outl, inData->Data, inData->Length)) { - printf("EVP_EncryptUpdate error\n"); - return -1; - } - } - else { - int rtn = EVP_DecryptInit(&ctx, cipher, keyData->Data, iv ? iv->Data : NULL); - if(!rtn) { - printf("EVP_DecryptInit error\n"); - return -1; - } - if(noPad) { - EVP_CIPHER_CTX_set_padding(&ctx, 0); - } - - if(!EVP_DecryptUpdate(&ctx, outp, &outl, inData->Data, inData->Length)) { - printf("EVP_DecryptUpdate error\n"); - return -1; - } - } - outData->Length = outl; - outp += outl; - outl = outLen - outl; - if(forEncr) { - if(!EVP_EncryptFinal(&ctx, outp, &outl)) { - printf("EVP_EncryptFinal error\n"); - return -1; - } - } - else { - if(!EVP_DecryptFinal(&ctx, outp, &outl)) { - printf("EVP_DecryptFinal error\n"); - return -1; - } - } - outData->Length += outl; - return 0; -} DELETED LocalTests/utilLib/ssleayUtils.h Index: LocalTests/utilLib/ssleayUtils.h ================================================================== --- LocalTests/utilLib/ssleayUtils.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ssleayUtils.h - common routines for CDSA/openssl compatibility testing - */ - -/* - * Clients of this module do not need to know about or see anything from the - * libcrypt headers. - */ -#ifndef _SSLEAY_UTILS_H_ -#define _SSLEAY_UTILS_H_ -#include - -typedef void *EAY_KEY; - -/* - * Create a symmetric key. - */ -CSSM_RETURN eayGenSymKey( - CSSM_ALGORITHMS alg, - CSSM_BOOL forEncr, - const CSSM_DATA *keyData, - EAY_KEY *key); // RETURNED - -/* - * Free a key created in eayGenSymKey - */ -CSSM_RETURN eayFreeKey( - EAY_KEY key); - -/* - * encrypt/decrypt - */ -CSSM_RETURN eayEncryptDecrypt( - EAY_KEY key, - CSSM_BOOL forEncrypt, - CSSM_ALGORITHMS encrAlg, - CSSM_ENCRYPT_MODE mode, // CSSM_ALGMODE_CBC ONLY! - const CSSM_DATA *iv, //Êoptional per mode - const CSSM_DATA *inData, - CSSM_DATA_PTR outData); // mallocd and RETURNED - -/*** EVP-based encrypt/decrypt ***/ - -int evpEncryptDecrypt( - CSSM_ALGORITHMS alg, // AES 128 only for now - CSSM_BOOL forEncr, - const CSSM_DATA *keyData, // may be larger than the key size we use - unsigned keyLengthInBits, - CSSM_ENCRYPT_MODE mode, // CSSM_ALGMODE_CBC_IV8, ECB, always padding - const CSSM_DATA *iv, // optional per mode - const CSSM_DATA *inData, - CSSM_DATA_PTR outData); // CSSM_MALLOCd and RETURNED - -#endif /* _EAY_UTILS_H_ */ DELETED LocalTests/utilLib/t_stdlib.c Index: LocalTests/utilLib/t_stdlib.c ================================================================== --- LocalTests/utilLib/t_stdlib.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include -#include - -void T_free(POINTER block) -{ - if (block != NULL_PTR) { - free(block); - } -} - -POINTER T_malloc(unsigned int len) -{ - return (POINTER) malloc(len ? len : 1); -} - -/* these are not needed - they are in system.c in security_bsafe */ -#if 0 -int T_memcmp(POINTER firstBlock, POINTER secondBlock, unsigned int len) -{ - if (len == 0) { - return 0; - } - return memcmp(firstBlock, secondBlock, len); -} - -void T_memcpy(POINTER output, POINTER input, unsigned int len) -{ - if (len != 0) { - memcpy(output, input, len); - } -} - -void T_memmove(POINTER output, POINTER input, unsigned int len) -{ - if (len != 0) { - memmove(output, input, len); - } -} - -void T_memset(POINTER output, int value, unsigned int len) -{ - if (len != 0) { - memset(output, value, len); - } -} -#endif - -POINTER T_realloc(POINTER block, unsigned int len) -{ - if (block == NULL_PTR) - return (POINTER) malloc(len ? len : 1); - - return (POINTER)realloc(block, len); -} DELETED Source/AESedp/AES.c Index: Source/AESedp/AES.c ================================================================== --- Source/AESedp/AES.c +++ /dev/null @@ -1,608 +0,0 @@ -#include "AESAssembly.h" - -// Generate object code iff this implementation is requested. -#if defined UseAESedp - - -/* This module must not be compiled with -fstrict-aliasing. - - We are forced to do some aliasing in this module, because we must conform - to an external API but need to do four-byte word manipulations for - efficiency. For example, chainBuf in the aes_cc_ctx structure is an array - of char, but we operate in units of four-byte words (or bigger). -*/ - - -#if defined UseAESedp_GeneralC - - -static void XorBlock(AESData *a, const AESData *b, const AESData *c) -{ - a->w[0] = b->w[0] ^ c->w[0]; - a->w[1] = b->w[1] ^ c->w[1]; - a->w[2] = b->w[2] ^ c->w[2]; - a->w[3] = b->w[3] ^ c->w[3]; -} - - -/* The code inside this preprocessor conditional clause is retained as an - illustration of how the assembly implementation works. For the most part, - the code here implements AES in the same way the accompanying Intel - assembly code does. - - While the assembly implementation performs well on an Intel processor, the - code GCC generates for this C code is not particularly fast. - - Key expansion differs somewhat from the assembly implementation. AES - presents an Inverse Cipher for decryption that is not immediately suitable - to table implementation. AES also offers an Equivalent Inverse Cipher - which is suitable for table implementation. In the Equivalent Inverse - Cipher, the InvMixColumn operation is switched with an XOR with the key. - Fortunately, InvMixColumn distributes over XOR (it is a linear combination - of its operands in a Galois field the AES defines, and the XOR is an - addition in the field), so the swap can be made by applying InvMixColumn to - the blocks of the key that will be used in the swapped operations. - - In the C code, InvMixColumn is applied in a separate step after expanded - the key, in a for-loop inside the aes_cc_set_key routine. In the assembly - code, InvMixColumn is integrated into the key expansion code. -*/ - - -#include "Data.c" // Include tables with precalculated AES functions. - - -/* This implements the InvMixColumn operation of the AES algorithm. It is - needed as a separate function during key expansion for decryption. -*/ -static Word InvMixColumn(Word w) -{ - union { Word w; Byte b[4]; } b = { w }; - Byte - s0 = b.b[0], - s1 = b.b[1], - s2 = b.b[2], - s3 = b.b[3]; - - return - AESInvMixColumnTable[0][s0] - ^ AESInvMixColumnTable[1][s1] - ^ AESInvMixColumnTable[2][s2] - ^ AESInvMixColumnTable[3][s3]; -} - - -// Expand the user's cipher key according to the AES key schedule. -static void AESExpandKey(Word *ExpandedKey, const AESKey *Key, long Nk) -{ - const Word (*T)[256] = AESSubBytesWordTable; - const Byte *R = AESRcon; - - Word * const E = ExpandedKey; - - switch (Nk) - { - default: - case 4: - { - const int Nr = 10; - - // The first words are just copies of the key. - Word - e0 = E[0] = Key->w[0], - e1 = E[1] = Key->w[1], - e2 = E[2] = Key->w[2], - e3 = E[3] = Key->w[3]; - - for (int i = Nk; i < Nb * (Nr + 1); i += Nk) - { - Word temp; - { - Byte * const b = (Byte *) &e3; - - Byte b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - temp = T[0][b1] ^ T[1][b2] ^ T[2][b3] ^ T[3][b0]; - } - temp ^= *++R; - E[i+0] = e0 ^= temp; - E[i+1] = e1 ^= e0; - E[i+2] = e2 ^= e1; - E[i+3] = e3 ^= e2; - } - break; - } - case 6: - { - const int Nr = 12; - - // The first words are just copies of the key. - for (int i = 0; i < Nk; ++i) - E[i] = Key->w[i]; - - Word temp = E[Nk-1]; - for (int i = Nk; 1; i += Nk) - { - { - Byte * const b = (Byte *) &temp; - - Byte b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - temp = T[0][b1] ^ T[1][b2] ^ T[2][b3] ^ T[3][b0]; - temp ^= *++R; - } - E[i+0] = temp ^= E[i+0-Nk]; - E[i+1] = temp ^= E[i+1-Nk]; - E[i+2] = temp ^= E[i+2-Nk]; - E[i+3] = temp ^= E[i+3-Nk]; - - if (Nb * Nr <= i) - break; - - E[i+4] = temp ^= E[i+4-Nk]; - E[i+5] = temp ^= E[i+5-Nk]; - } - break; - } - case 8: - { - const int Nr = 14; - - // The first words are just copies of the key. - for (int i = 0; i < Nk; ++i) - E[i] = Key->w[i]; - - Word temp = E[Nk-1]; - for (int i = Nk; 1; i += Nk) - { - { - Byte * const b = (Byte *) &temp; - - Byte b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - temp = T[0][b1] ^ T[1][b2] ^ T[2][b3] ^ T[3][b0]; - temp ^= *++R; - } - E[i+0] = temp ^= E[i+0-Nk]; - E[i+1] = temp ^= E[i+1-Nk]; - E[i+2] = temp ^= E[i+2-Nk]; - E[i+3] = temp ^= E[i+3-Nk]; - - if (Nb * Nr <= i) - break; - - { - Byte * const b = (Byte *) &temp; - - Byte b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - temp = T[0][b0] ^ T[1][b1] ^ T[2][b2] ^ T[3][b3]; - } - E[i+4] = temp ^= E[i+4-Nk]; - E[i+5] = temp ^= E[i+5-Nk]; - E[i+6] = temp ^= E[i+6-Nk]; - E[i+7] = temp ^= E[i+7-Nk]; - } - break; - } - } -} - - -// This is the main encryption routine. -static void AESEncryptWithExpandedKey(Byte *Ciphertext, const Byte *Plaintext, - const AESData *ExpandedKey, long Nr) -{ - AESData State; - - XorBlock(&State, (const AESData *) Plaintext, &ExpandedKey[0]); - - { - const Word (*T)[256] = AESEncryptTable; - - for (int round = 1; round < Nr; ++round) - { - const AESData *Key = &ExpandedKey[round]; - - const union { Word w; Byte b[4]; } - w0 = { State.w[0] }, - w1 = { State.w[1] }, - w2 = { State.w[2] }, - w3 = { State.w[3] }; - - State.w[0] = Key->w[0] - ^ T[0][w0.b[0]] ^ T[1][w1.b[1]] ^ T[2][w2.b[2]] ^ T[3][w3.b[3]]; - State.w[1] = Key->w[1] - ^ T[0][w1.b[0]] ^ T[1][w2.b[1]] ^ T[2][w3.b[2]] ^ T[3][w0.b[3]]; - State.w[2] = Key->w[2] - ^ T[0][w2.b[0]] ^ T[1][w3.b[1]] ^ T[2][w0.b[2]] ^ T[3][w1.b[3]]; - State.w[3] = Key->w[3] - ^ T[0][w3.b[0]] ^ T[1][w0.b[1]] ^ T[2][w1.b[2]] ^ T[3][w2.b[3]]; - } - } - - { - const Word (*T)[256] = AESSubBytesWordTable; - - const AESData *Key = &ExpandedKey[Nr]; - - const union { Word w; Byte b[4]; } - w0 = { State.w[0] }, - w1 = { State.w[1] }, - w2 = { State.w[2] }, - w3 = { State.w[3] }; - - State.w[0] = Key->w[0] - ^ T[0][w0.b[0]] ^ T[1][w1.b[1]] ^ T[2][w2.b[2]] ^ T[3][w3.b[3]]; - State.w[1] = Key->w[1] - ^ T[0][w1.b[0]] ^ T[1][w2.b[1]] ^ T[2][w3.b[2]] ^ T[3][w0.b[3]]; - State.w[2] = Key->w[2] - ^ T[0][w2.b[0]] ^ T[1][w3.b[1]] ^ T[2][w0.b[2]] ^ T[3][w1.b[3]]; - State.w[3] = Key->w[3] - ^ T[0][w3.b[0]] ^ T[1][w0.b[1]] ^ T[2][w1.b[2]] ^ T[3][w2.b[3]]; - } - - * (AESData *) Ciphertext = State; -} - - -// This is the main decryption routine. -static void AESDecryptWithExpandedKey(Byte *Plaintext, const Byte *Ciphertext, - const AESData *ExpandedKey, long Nr) -{ - AESData State; - - XorBlock(&State, (const AESData *) Ciphertext, &ExpandedKey[Nr]); - - { - const Word (*T)[256] = AESDecryptTable; - - for (int round = Nr-1; 0 < round; --round) - { - const AESData *Key = &ExpandedKey[round]; - - const union { Word w; Byte b[4]; } - w0 = { State.w[0] }, - w1 = { State.w[1] }, - w2 = { State.w[2] }, - w3 = { State.w[3] }; - - State.w[0] = Key->w[0] - ^ T[0][w0.b[0]] ^ T[1][w3.b[1]] ^ T[2][w2.b[2]] ^ T[3][w1.b[3]]; - State.w[1] = Key->w[1] - ^ T[0][w1.b[0]] ^ T[1][w0.b[1]] ^ T[2][w3.b[2]] ^ T[3][w2.b[3]]; - State.w[2] = Key->w[2] - ^ T[0][w2.b[0]] ^ T[1][w1.b[1]] ^ T[2][w0.b[2]] ^ T[3][w3.b[3]]; - State.w[3] = Key->w[3] - ^ T[0][w3.b[0]] ^ T[1][w2.b[1]] ^ T[2][w1.b[2]] ^ T[3][w0.b[3]]; - } - } - - { - const Word (*T)[256] = AESInvSubBytesWordTable; - - const AESData *Key = &ExpandedKey[0]; - - const union { Word w; Byte b[4]; } - w0 = { State.w[0] }, - w1 = { State.w[1] }, - w2 = { State.w[2] }, - w3 = { State.w[3] }; - - State.w[0] = Key->w[0] - ^ T[0][w0.b[0]] ^ T[1][w3.b[1]] ^ T[2][w2.b[2]] ^ T[3][w1.b[3]]; - State.w[1] = Key->w[1] - ^ T[0][w1.b[0]] ^ T[1][w0.b[1]] ^ T[2][w3.b[2]] ^ T[3][w2.b[3]]; - State.w[2] = Key->w[2] - ^ T[0][w2.b[0]] ^ T[1][w1.b[1]] ^ T[2][w0.b[2]] ^ T[3][w3.b[3]]; - State.w[3] = Key->w[3] - ^ T[0][w3.b[0]] ^ T[1][w2.b[1]] ^ T[2][w1.b[2]] ^ T[3][w0.b[3]]; - } - - * (AESData *) Plaintext = State; -} - - -#else // defined UseAESedp_GeneralC - - // Declare routines implemented elsewhere. - void AESExpandKeyForEncryption(Word *ExpandedKey, const AESKey *Key, - long Nk); - void AESExpandKeyForDecryption(Word *ExpandedKey, const AESKey *Key, - long Nk); - void AESEncryptWithExpandedKey(Byte *OutputText, const Byte *InputText, - const AESData *ExpandedKey, long Nr); - void AESDecryptWithExpandedKey(Byte *OutputText, const Byte *InputText, - const AESData *ExpandedKey, long Nr); - void AESEncryptCBC(void *Output, const void *Input, - void *ChainBuffer, void *Key, long Blocks, long Rounds); - void AESDecryptCBC(void *Output, const void *Input, - void *ChainBuffer, void *Key, long Blocks, long Rounds); - -#endif // defined UseAESedp_GeneralC - - -/* Expand a key and store the expansion in the cryptor context. - - CommonCrypto calls this routine. -*/ -int aes_cc_set_key( - aes_cc_ctx *Context, // Cryptor context. - const void *Key, // Key. - aes_32t KeyLength, // Number of bytes in key. - int ForEncryption // True for encryption, false for decryption. - ) -{ - // Test for invalid key length. - if (KeyLength != 16 && KeyLength != 24 && KeyLength != 32) - return -1; - - // Set Nk to number of four-byte words in key. - const int Nk = KeyLength / 4; - - // Remember the number of rounds. - Context->encrypt.rn = Nk + 6; - - #if defined UseAESedp_GeneralC - - AESExpandKey(Context->encrypt.ks, Key, Nk); - - if (!ForEncryption) - { - - /* Change the expanded key so we can swap the InvMixColumns and - XorBlock operations during decryption. - */ - Word *E = Context->encrypt.ks; - int Nr = Context->encrypt.rn; - for (int i = Nb; i < Nr * Nb; ++i) - E[i] = InvMixColumn(E[i]); - } - - #else // defined UseAESedp_GeneralC - - if (ForEncryption) - AESExpandKeyForEncryption(Context->encrypt.ks, Key, Nk); - else - AESExpandKeyForDecryption(Context->encrypt.ks, Key, Nk); - - #endif // defined UseAESedp_GeneralC - - // Indicate there is no initial value stored. - Context->encrypt.cbcEnable = 0; - - return 0; -} - - -#include // For memcpy. - - -/* Store an initial value (or lack thereof) in the cryptor context. - - CommonCrypto calls this routine. -*/ -void aes_cc_set_iv(aes_cc_ctx *Context, int ForEncryption, const void *IV) -{ - if (IV == 0) - // Indicate there is no initial value stored. - Context->encrypt.cbcEnable = 0; - else - { - // Indicate there is an initial value stored. - Context->encrypt.cbcEnable = 1; - memcpy(Context->encrypt.chainBuf, IV, sizeof Context->encrypt.chainBuf); - } -} - - -/* Encrypt blocks of data. - - CommonCrypto calls this routine. -*/ -void aes_cc_encrypt( - aes_cc_ctx *Context, // Cryptor context. - const void *Input, // Input. - aes_32t Blocks, // Number of 16-byte blocks to process. - void *Output // Output. - ) -{ - // Alias to more convenient pointers for referring to blocks. - const AESData *I = Input; - AESData *O = Output; - - // If we have an initial value, use Cipher Block Chaining (CBC) mode. - if (Context->encrypt.cbcEnable) - { - #if defined UseAESedp_GeneralC - // Get chain value. - AESData State = * (AESData *) Context->encrypt.chainBuf; - - // Chain and encrypt. - while (Blocks--) - { - XorBlock(&State, &State, I++); - AESEncryptWithExpandedKey(State.b, State.b, - (const void *) Context->encrypt.ks, - Context->encrypt.rn); - *O++ = State; - } - - // Save updated chain value. - * (AESData *) Context->encrypt.chainBuf = State; - #else // defined UseAESedp_GeneralC - AESEncryptCBC(O, I, Context->encrypt.chainBuf, - Context->encrypt.ks, Blocks, Context->encrypt.rn); - #endif // defined UseAESedp_GeneralC - } - - // If we have no initial value, use Electronic Code Book (ECB) mode. - else - { - aes_32t i; - for (i = 0; i < Blocks; ++i) - AESEncryptWithExpandedKey(O[i].b, I[i].b, - (const void *) Context->encrypt.ks, Context->encrypt.rn); - } -} - - -/* Alternate interface to encryption, same as aes_cc_encrypt, except that if - InitialValue is non-null, it points to an initial value which is used for - CBC mode, regardless of the cbcEnable flag and the initial/chain value in - the context structure. The updated chain value is written to written to - the context structure. -*/ -aes_rval aes_encrypt_cbc( - const unsigned char *Input, - const unsigned char *InitialValue, - unsigned int Blocks, - unsigned char *Output, - aes_encrypt_ctx *Context) -{ - // Alias to more convenient pointers for referring to blocks. - const AESData *I = (const AESData *) Input; - AESData *O = ( AESData *) Output; - - // If we have an initial value, use Cipher Block Chaining (CBC) mode. - if (Context->cbcEnable || InitialValue) - { - #if defined UseAESedp_GeneralC - // Get chain value. - AESData State = InitialValue - ? * (const AESData *) InitialValue - : * (const AESData *) Context->chainBuf; - - // Chain and encrypt. - while (Blocks--) - { - XorBlock(&State, &State, I++); - AESEncryptWithExpandedKey(State.b, State.b, - (const void *) Context->ks, - Context->rn); - *O++ = State; - } - - // Save updated chain value. - * (AESData *) Context->chainBuf = State; - #else // defined UseAESedp_GeneralC - AESEncryptCBC(O, I, Context->chainBuf, - Context->ks, Blocks, Context->rn); - #endif // defined UseAESedp_GeneralC - } - - // If we have no initial value, use Electronic Code Book (ECB) mode. - else - { - aes_32t i; - for (i = 0; i < Blocks; ++i) - AESEncryptWithExpandedKey(O[i].b, I[i].b, - (const void *) Context->ks, Context->rn); - } -} - - -/* Decrypt blocks of data. - - CommonCrypto calls this routine. -*/ -void aes_cc_decrypt( - aes_cc_ctx *Context, // Cryptor context. - const void *Input, // Input. - aes_32t Blocks, // Number of 16-byte blocks to process. - void *Output // Output. - ) -{ - // Alias to more convenient pointers for referring to blocks. - const AESData *I = Input; - AESData *O = Output; - - // If we have an initial value, use Cipher Block Chaining (CBC) mode. - if (Context->encrypt.cbcEnable) - { - #if defined UseAESedp_GeneralC - // Get chain value. - AESData NextChainValue = * (AESData *) Context->encrypt.chainBuf; - - // Decrypt and chain. - while (Blocks--) - { - AESData ChainValue = NextChainValue, State; - NextChainValue = *I++; - AESDecryptWithExpandedKey(State.b, NextChainValue.b, - (const void *) Context->encrypt.ks, Context->encrypt.rn); - XorBlock(O++, &State, &ChainValue); - } - - // Save updated chain value. - * (AESData *) Context->encrypt.chainBuf = NextChainValue; - #else // defined UseAESedp_GeneralC - AESDecryptCBC(O, I, Context->encrypt.chainBuf, - Context->encrypt.ks, Blocks, Context->encrypt.rn); - #endif // defined UseAESedp_GeneralC - } - - // If we have no initial value, use Electronic Code Book (ECB) mode. - else - { - aes_32t i; - for (i = 0; i < Blocks; ++i) - AESDecryptWithExpandedKey(O[i].b, I[i].b, - (const void *) Context->encrypt.ks, Context->encrypt.rn); - } -} - - -/* Alternate interface to decryption, same as aes_cc_decrypt, except that if - InitialValue is non-null, it points to an initial value which is used for - CBC mode, regardless of the cbcEnable flag and the initial/chain value in - the context structure. The updated chain value is written to written to - the context structure. -*/ -aes_rval aes_decrypt_cbc( - const unsigned char *Input, - const unsigned char *InitialValue, - unsigned int Blocks, - unsigned char *Output, - aes_decrypt_ctx *Context) -{ - // Alias to more convenient pointers for referring to blocks. - const AESData *I = (const AESData *) Input; - AESData *O = ( AESData *) Output; - - // If we have an initial value, use Cipher Block Chaining (CBC) mode. - if (Context->cbcEnable || InitialValue) - { - #if defined UseAESedp_GeneralC - // Get chain value. - AESData NextChainValue = InitialValue - ? * (const AESData *) InitialValue - : * (const AESData *) Context->chainBuf; - - // Decrypt and chain. - while (Blocks--) - { - AESData ChainValue = NextChainValue, State; - NextChainValue = *I++; - AESDecryptWithExpandedKey(State.b, NextChainValue.b, - (const void *) Context->ks, Context->rn); - XorBlock(O++, &State, &ChainValue); - } - - // Save updated chain value. - * (AESData *) Context->chainBuf = NextChainValue; - #else // defined UseAESedp_GeneralC - AESDecryptCBC(O, I, Context->chainBuf, - Context->ks, Blocks, Context->rn); - #endif // defined UseAESedp_GeneralC - } - - // If we have no initial value, use Electronic Code Book (ECB) mode. - else - { - aes_32t i; - for (i = 0; i < Blocks; ++i) - AESDecryptWithExpandedKey(O[i].b, I[i].b, - (const void *) Context->ks, Context->rn); - } -} - - - -#endif // defined UseAESedp DELETED Source/AESedp/AESAssembly.h Index: Source/AESedp/AESAssembly.h ================================================================== --- Source/AESedp/AESAssembly.h +++ /dev/null @@ -1,72 +0,0 @@ -#if !defined AES_h -#define AES_h - - -// Include aesopt.h to get the UseAESedp symbol. We use nothing else from it. -#include - - -// Generate object code iff UseAESedp is defined. -#if defined UseAESedp - - -// Select which implementation to use. -#if 1 - #define UseAESedp_IntelAssembly -#else - #define UseAESedp_GeneralC -#endif - - -/* MaxNb is the maximum value of Nb, the number of four-byte words in one data - block. -*/ -#define MaxNb 4 - -/* Nb is the number of four-byte words in one data block. AES fixes Nb at 4, - although Rijndael allows up to 8. -*/ -#define Nb 4 - -/* MaxNk is the maximum value of Nk, the number of four-byte words in a key. - AES and Rijndael allow up to 8. -*/ -#define MaxNk 8 - -/* Nk is not defined here because different key sizes are supported - dynamically. -*/ - -/* MaxRcon is the maximum number of round constants that might be needed. - The number needed is (Nb*(Nr+1)-1) / Nk + 1. For AES, Nr is Nk + 6. (For - Rijndael, Nr is max(Nk, Nb) + 6.) For AES, we have: - - (Nb*(Nr+1)-1) / Nk + 1. - (Nb*(Nk+6+1)-1) / Nk + 1. - (Nb*Nk + Nb*7 - 1) / Nk + 1. - Nb + (Nb*7-1)/Nk + 1. - - Clearly this is greatest when Nk is smallest. Nk is at least 4. In AES, - Nb is 4, so we have 4 + 27/4 + 1 = 11. - - (In Rijndael, the maximum is 30, occurring when Nb is 8 and Nk is 4.) -*/ -#define MaxRcon 11 - - -#if !__ASSEMBLER__ - - #include - - typedef uint8_t Byte; - typedef uint32_t Word; - typedef union { Byte b[MaxNb*4]; Word w[MaxNb]; } AESData; - typedef union { Byte b[MaxNk*4]; Word w[MaxNk]; } AESKey ; - -#endif - - -#endif // defined UseAESedp - - -#endif // !defined AES_h DELETED Source/AESedp/Data.c Index: Source/AESedp/Data.c ================================================================== --- Source/AESedp/Data.c +++ /dev/null @@ -1,5211 +0,0 @@ -// This file was generated by MakeData.c. - - -#include "AESAssembly.h" - - -// Round constants. -const Byte AESRcon[] = -{ - 0, // Not used, included for indexing simplicity. - 0x01, - 0x02, - 0x04, - 0x08, - 0x10, - 0x20, - 0x40, - 0x80, - 0x1b, - 0x36, -}; - - -// Tables for InvMixColumn. -const Word AESInvMixColumnTable[4][256] = -{ - { - 0x00000000, - 0x0b0d090e, - 0x161a121c, - 0x1d171b12, - 0x2c342438, - 0x27392d36, - 0x3a2e3624, - 0x31233f2a, - 0x58684870, - 0x5365417e, - 0x4e725a6c, - 0x457f5362, - 0x745c6c48, - 0x7f516546, - 0x62467e54, - 0x694b775a, - 0xb0d090e0, - 0xbbdd99ee, - 0xa6ca82fc, - 0xadc78bf2, - 0x9ce4b4d8, - 0x97e9bdd6, - 0x8afea6c4, - 0x81f3afca, - 0xe8b8d890, - 0xe3b5d19e, - 0xfea2ca8c, - 0xf5afc382, - 0xc48cfca8, - 0xcf81f5a6, - 0xd296eeb4, - 0xd99be7ba, - 0x7bbb3bdb, - 0x70b632d5, - 0x6da129c7, - 0x66ac20c9, - 0x578f1fe3, - 0x5c8216ed, - 0x41950dff, - 0x4a9804f1, - 0x23d373ab, - 0x28de7aa5, - 0x35c961b7, - 0x3ec468b9, - 0x0fe75793, - 0x04ea5e9d, - 0x19fd458f, - 0x12f04c81, - 0xcb6bab3b, - 0xc066a235, - 0xdd71b927, - 0xd67cb029, - 0xe75f8f03, - 0xec52860d, - 0xf1459d1f, - 0xfa489411, - 0x9303e34b, - 0x980eea45, - 0x8519f157, - 0x8e14f859, - 0xbf37c773, - 0xb43ace7d, - 0xa92dd56f, - 0xa220dc61, - 0xf66d76ad, - 0xfd607fa3, - 0xe07764b1, - 0xeb7a6dbf, - 0xda595295, - 0xd1545b9b, - 0xcc434089, - 0xc74e4987, - 0xae053edd, - 0xa50837d3, - 0xb81f2cc1, - 0xb31225cf, - 0x82311ae5, - 0x893c13eb, - 0x942b08f9, - 0x9f2601f7, - 0x46bde64d, - 0x4db0ef43, - 0x50a7f451, - 0x5baafd5f, - 0x6a89c275, - 0x6184cb7b, - 0x7c93d069, - 0x779ed967, - 0x1ed5ae3d, - 0x15d8a733, - 0x08cfbc21, - 0x03c2b52f, - 0x32e18a05, - 0x39ec830b, - 0x24fb9819, - 0x2ff69117, - 0x8dd64d76, - 0x86db4478, - 0x9bcc5f6a, - 0x90c15664, - 0xa1e2694e, - 0xaaef6040, - 0xb7f87b52, - 0xbcf5725c, - 0xd5be0506, - 0xdeb30c08, - 0xc3a4171a, - 0xc8a91e14, - 0xf98a213e, - 0xf2872830, - 0xef903322, - 0xe49d3a2c, - 0x3d06dd96, - 0x360bd498, - 0x2b1ccf8a, - 0x2011c684, - 0x1132f9ae, - 0x1a3ff0a0, - 0x0728ebb2, - 0x0c25e2bc, - 0x656e95e6, - 0x6e639ce8, - 0x737487fa, - 0x78798ef4, - 0x495ab1de, - 0x4257b8d0, - 0x5f40a3c2, - 0x544daacc, - 0xf7daec41, - 0xfcd7e54f, - 0xe1c0fe5d, - 0xeacdf753, - 0xdbeec879, - 0xd0e3c177, - 0xcdf4da65, - 0xc6f9d36b, - 0xafb2a431, - 0xa4bfad3f, - 0xb9a8b62d, - 0xb2a5bf23, - 0x83868009, - 0x888b8907, - 0x959c9215, - 0x9e919b1b, - 0x470a7ca1, - 0x4c0775af, - 0x51106ebd, - 0x5a1d67b3, - 0x6b3e5899, - 0x60335197, - 0x7d244a85, - 0x7629438b, - 0x1f6234d1, - 0x146f3ddf, - 0x097826cd, - 0x02752fc3, - 0x335610e9, - 0x385b19e7, - 0x254c02f5, - 0x2e410bfb, - 0x8c61d79a, - 0x876cde94, - 0x9a7bc586, - 0x9176cc88, - 0xa055f3a2, - 0xab58faac, - 0xb64fe1be, - 0xbd42e8b0, - 0xd4099fea, - 0xdf0496e4, - 0xc2138df6, - 0xc91e84f8, - 0xf83dbbd2, - 0xf330b2dc, - 0xee27a9ce, - 0xe52aa0c0, - 0x3cb1477a, - 0x37bc4e74, - 0x2aab5566, - 0x21a65c68, - 0x10856342, - 0x1b886a4c, - 0x069f715e, - 0x0d927850, - 0x64d90f0a, - 0x6fd40604, - 0x72c31d16, - 0x79ce1418, - 0x48ed2b32, - 0x43e0223c, - 0x5ef7392e, - 0x55fa3020, - 0x01b79aec, - 0x0aba93e2, - 0x17ad88f0, - 0x1ca081fe, - 0x2d83bed4, - 0x268eb7da, - 0x3b99acc8, - 0x3094a5c6, - 0x59dfd29c, - 0x52d2db92, - 0x4fc5c080, - 0x44c8c98e, - 0x75ebf6a4, - 0x7ee6ffaa, - 0x63f1e4b8, - 0x68fcedb6, - 0xb1670a0c, - 0xba6a0302, - 0xa77d1810, - 0xac70111e, - 0x9d532e34, - 0x965e273a, - 0x8b493c28, - 0x80443526, - 0xe90f427c, - 0xe2024b72, - 0xff155060, - 0xf418596e, - 0xc53b6644, - 0xce366f4a, - 0xd3217458, - 0xd82c7d56, - 0x7a0ca137, - 0x7101a839, - 0x6c16b32b, - 0x671bba25, - 0x5638850f, - 0x5d358c01, - 0x40229713, - 0x4b2f9e1d, - 0x2264e947, - 0x2969e049, - 0x347efb5b, - 0x3f73f255, - 0x0e50cd7f, - 0x055dc471, - 0x184adf63, - 0x1347d66d, - 0xcadc31d7, - 0xc1d138d9, - 0xdcc623cb, - 0xd7cb2ac5, - 0xe6e815ef, - 0xede51ce1, - 0xf0f207f3, - 0xfbff0efd, - 0x92b479a7, - 0x99b970a9, - 0x84ae6bbb, - 0x8fa362b5, - 0xbe805d9f, - 0xb58d5491, - 0xa89a4f83, - 0xa397468d, - }, - { - 0x00000000, - 0x0d090e0b, - 0x1a121c16, - 0x171b121d, - 0x3424382c, - 0x392d3627, - 0x2e36243a, - 0x233f2a31, - 0x68487058, - 0x65417e53, - 0x725a6c4e, - 0x7f536245, - 0x5c6c4874, - 0x5165467f, - 0x467e5462, - 0x4b775a69, - 0xd090e0b0, - 0xdd99eebb, - 0xca82fca6, - 0xc78bf2ad, - 0xe4b4d89c, - 0xe9bdd697, - 0xfea6c48a, - 0xf3afca81, - 0xb8d890e8, - 0xb5d19ee3, - 0xa2ca8cfe, - 0xafc382f5, - 0x8cfca8c4, - 0x81f5a6cf, - 0x96eeb4d2, - 0x9be7bad9, - 0xbb3bdb7b, - 0xb632d570, - 0xa129c76d, - 0xac20c966, - 0x8f1fe357, - 0x8216ed5c, - 0x950dff41, - 0x9804f14a, - 0xd373ab23, - 0xde7aa528, - 0xc961b735, - 0xc468b93e, - 0xe757930f, - 0xea5e9d04, - 0xfd458f19, - 0xf04c8112, - 0x6bab3bcb, - 0x66a235c0, - 0x71b927dd, - 0x7cb029d6, - 0x5f8f03e7, - 0x52860dec, - 0x459d1ff1, - 0x489411fa, - 0x03e34b93, - 0x0eea4598, - 0x19f15785, - 0x14f8598e, - 0x37c773bf, - 0x3ace7db4, - 0x2dd56fa9, - 0x20dc61a2, - 0x6d76adf6, - 0x607fa3fd, - 0x7764b1e0, - 0x7a6dbfeb, - 0x595295da, - 0x545b9bd1, - 0x434089cc, - 0x4e4987c7, - 0x053eddae, - 0x0837d3a5, - 0x1f2cc1b8, - 0x1225cfb3, - 0x311ae582, - 0x3c13eb89, - 0x2b08f994, - 0x2601f79f, - 0xbde64d46, - 0xb0ef434d, - 0xa7f45150, - 0xaafd5f5b, - 0x89c2756a, - 0x84cb7b61, - 0x93d0697c, - 0x9ed96777, - 0xd5ae3d1e, - 0xd8a73315, - 0xcfbc2108, - 0xc2b52f03, - 0xe18a0532, - 0xec830b39, - 0xfb981924, - 0xf691172f, - 0xd64d768d, - 0xdb447886, - 0xcc5f6a9b, - 0xc1566490, - 0xe2694ea1, - 0xef6040aa, - 0xf87b52b7, - 0xf5725cbc, - 0xbe0506d5, - 0xb30c08de, - 0xa4171ac3, - 0xa91e14c8, - 0x8a213ef9, - 0x872830f2, - 0x903322ef, - 0x9d3a2ce4, - 0x06dd963d, - 0x0bd49836, - 0x1ccf8a2b, - 0x11c68420, - 0x32f9ae11, - 0x3ff0a01a, - 0x28ebb207, - 0x25e2bc0c, - 0x6e95e665, - 0x639ce86e, - 0x7487fa73, - 0x798ef478, - 0x5ab1de49, - 0x57b8d042, - 0x40a3c25f, - 0x4daacc54, - 0xdaec41f7, - 0xd7e54ffc, - 0xc0fe5de1, - 0xcdf753ea, - 0xeec879db, - 0xe3c177d0, - 0xf4da65cd, - 0xf9d36bc6, - 0xb2a431af, - 0xbfad3fa4, - 0xa8b62db9, - 0xa5bf23b2, - 0x86800983, - 0x8b890788, - 0x9c921595, - 0x919b1b9e, - 0x0a7ca147, - 0x0775af4c, - 0x106ebd51, - 0x1d67b35a, - 0x3e58996b, - 0x33519760, - 0x244a857d, - 0x29438b76, - 0x6234d11f, - 0x6f3ddf14, - 0x7826cd09, - 0x752fc302, - 0x5610e933, - 0x5b19e738, - 0x4c02f525, - 0x410bfb2e, - 0x61d79a8c, - 0x6cde9487, - 0x7bc5869a, - 0x76cc8891, - 0x55f3a2a0, - 0x58faacab, - 0x4fe1beb6, - 0x42e8b0bd, - 0x099fead4, - 0x0496e4df, - 0x138df6c2, - 0x1e84f8c9, - 0x3dbbd2f8, - 0x30b2dcf3, - 0x27a9ceee, - 0x2aa0c0e5, - 0xb1477a3c, - 0xbc4e7437, - 0xab55662a, - 0xa65c6821, - 0x85634210, - 0x886a4c1b, - 0x9f715e06, - 0x9278500d, - 0xd90f0a64, - 0xd406046f, - 0xc31d1672, - 0xce141879, - 0xed2b3248, - 0xe0223c43, - 0xf7392e5e, - 0xfa302055, - 0xb79aec01, - 0xba93e20a, - 0xad88f017, - 0xa081fe1c, - 0x83bed42d, - 0x8eb7da26, - 0x99acc83b, - 0x94a5c630, - 0xdfd29c59, - 0xd2db9252, - 0xc5c0804f, - 0xc8c98e44, - 0xebf6a475, - 0xe6ffaa7e, - 0xf1e4b863, - 0xfcedb668, - 0x670a0cb1, - 0x6a0302ba, - 0x7d1810a7, - 0x70111eac, - 0x532e349d, - 0x5e273a96, - 0x493c288b, - 0x44352680, - 0x0f427ce9, - 0x024b72e2, - 0x155060ff, - 0x18596ef4, - 0x3b6644c5, - 0x366f4ace, - 0x217458d3, - 0x2c7d56d8, - 0x0ca1377a, - 0x01a83971, - 0x16b32b6c, - 0x1bba2567, - 0x38850f56, - 0x358c015d, - 0x22971340, - 0x2f9e1d4b, - 0x64e94722, - 0x69e04929, - 0x7efb5b34, - 0x73f2553f, - 0x50cd7f0e, - 0x5dc47105, - 0x4adf6318, - 0x47d66d13, - 0xdc31d7ca, - 0xd138d9c1, - 0xc623cbdc, - 0xcb2ac5d7, - 0xe815efe6, - 0xe51ce1ed, - 0xf207f3f0, - 0xff0efdfb, - 0xb479a792, - 0xb970a999, - 0xae6bbb84, - 0xa362b58f, - 0x805d9fbe, - 0x8d5491b5, - 0x9a4f83a8, - 0x97468da3, - }, - { - 0x00000000, - 0x090e0b0d, - 0x121c161a, - 0x1b121d17, - 0x24382c34, - 0x2d362739, - 0x36243a2e, - 0x3f2a3123, - 0x48705868, - 0x417e5365, - 0x5a6c4e72, - 0x5362457f, - 0x6c48745c, - 0x65467f51, - 0x7e546246, - 0x775a694b, - 0x90e0b0d0, - 0x99eebbdd, - 0x82fca6ca, - 0x8bf2adc7, - 0xb4d89ce4, - 0xbdd697e9, - 0xa6c48afe, - 0xafca81f3, - 0xd890e8b8, - 0xd19ee3b5, - 0xca8cfea2, - 0xc382f5af, - 0xfca8c48c, - 0xf5a6cf81, - 0xeeb4d296, - 0xe7bad99b, - 0x3bdb7bbb, - 0x32d570b6, - 0x29c76da1, - 0x20c966ac, - 0x1fe3578f, - 0x16ed5c82, - 0x0dff4195, - 0x04f14a98, - 0x73ab23d3, - 0x7aa528de, - 0x61b735c9, - 0x68b93ec4, - 0x57930fe7, - 0x5e9d04ea, - 0x458f19fd, - 0x4c8112f0, - 0xab3bcb6b, - 0xa235c066, - 0xb927dd71, - 0xb029d67c, - 0x8f03e75f, - 0x860dec52, - 0x9d1ff145, - 0x9411fa48, - 0xe34b9303, - 0xea45980e, - 0xf1578519, - 0xf8598e14, - 0xc773bf37, - 0xce7db43a, - 0xd56fa92d, - 0xdc61a220, - 0x76adf66d, - 0x7fa3fd60, - 0x64b1e077, - 0x6dbfeb7a, - 0x5295da59, - 0x5b9bd154, - 0x4089cc43, - 0x4987c74e, - 0x3eddae05, - 0x37d3a508, - 0x2cc1b81f, - 0x25cfb312, - 0x1ae58231, - 0x13eb893c, - 0x08f9942b, - 0x01f79f26, - 0xe64d46bd, - 0xef434db0, - 0xf45150a7, - 0xfd5f5baa, - 0xc2756a89, - 0xcb7b6184, - 0xd0697c93, - 0xd967779e, - 0xae3d1ed5, - 0xa73315d8, - 0xbc2108cf, - 0xb52f03c2, - 0x8a0532e1, - 0x830b39ec, - 0x981924fb, - 0x91172ff6, - 0x4d768dd6, - 0x447886db, - 0x5f6a9bcc, - 0x566490c1, - 0x694ea1e2, - 0x6040aaef, - 0x7b52b7f8, - 0x725cbcf5, - 0x0506d5be, - 0x0c08deb3, - 0x171ac3a4, - 0x1e14c8a9, - 0x213ef98a, - 0x2830f287, - 0x3322ef90, - 0x3a2ce49d, - 0xdd963d06, - 0xd498360b, - 0xcf8a2b1c, - 0xc6842011, - 0xf9ae1132, - 0xf0a01a3f, - 0xebb20728, - 0xe2bc0c25, - 0x95e6656e, - 0x9ce86e63, - 0x87fa7374, - 0x8ef47879, - 0xb1de495a, - 0xb8d04257, - 0xa3c25f40, - 0xaacc544d, - 0xec41f7da, - 0xe54ffcd7, - 0xfe5de1c0, - 0xf753eacd, - 0xc879dbee, - 0xc177d0e3, - 0xda65cdf4, - 0xd36bc6f9, - 0xa431afb2, - 0xad3fa4bf, - 0xb62db9a8, - 0xbf23b2a5, - 0x80098386, - 0x8907888b, - 0x9215959c, - 0x9b1b9e91, - 0x7ca1470a, - 0x75af4c07, - 0x6ebd5110, - 0x67b35a1d, - 0x58996b3e, - 0x51976033, - 0x4a857d24, - 0x438b7629, - 0x34d11f62, - 0x3ddf146f, - 0x26cd0978, - 0x2fc30275, - 0x10e93356, - 0x19e7385b, - 0x02f5254c, - 0x0bfb2e41, - 0xd79a8c61, - 0xde94876c, - 0xc5869a7b, - 0xcc889176, - 0xf3a2a055, - 0xfaacab58, - 0xe1beb64f, - 0xe8b0bd42, - 0x9fead409, - 0x96e4df04, - 0x8df6c213, - 0x84f8c91e, - 0xbbd2f83d, - 0xb2dcf330, - 0xa9ceee27, - 0xa0c0e52a, - 0x477a3cb1, - 0x4e7437bc, - 0x55662aab, - 0x5c6821a6, - 0x63421085, - 0x6a4c1b88, - 0x715e069f, - 0x78500d92, - 0x0f0a64d9, - 0x06046fd4, - 0x1d1672c3, - 0x141879ce, - 0x2b3248ed, - 0x223c43e0, - 0x392e5ef7, - 0x302055fa, - 0x9aec01b7, - 0x93e20aba, - 0x88f017ad, - 0x81fe1ca0, - 0xbed42d83, - 0xb7da268e, - 0xacc83b99, - 0xa5c63094, - 0xd29c59df, - 0xdb9252d2, - 0xc0804fc5, - 0xc98e44c8, - 0xf6a475eb, - 0xffaa7ee6, - 0xe4b863f1, - 0xedb668fc, - 0x0a0cb167, - 0x0302ba6a, - 0x1810a77d, - 0x111eac70, - 0x2e349d53, - 0x273a965e, - 0x3c288b49, - 0x35268044, - 0x427ce90f, - 0x4b72e202, - 0x5060ff15, - 0x596ef418, - 0x6644c53b, - 0x6f4ace36, - 0x7458d321, - 0x7d56d82c, - 0xa1377a0c, - 0xa8397101, - 0xb32b6c16, - 0xba25671b, - 0x850f5638, - 0x8c015d35, - 0x97134022, - 0x9e1d4b2f, - 0xe9472264, - 0xe0492969, - 0xfb5b347e, - 0xf2553f73, - 0xcd7f0e50, - 0xc471055d, - 0xdf63184a, - 0xd66d1347, - 0x31d7cadc, - 0x38d9c1d1, - 0x23cbdcc6, - 0x2ac5d7cb, - 0x15efe6e8, - 0x1ce1ede5, - 0x07f3f0f2, - 0x0efdfbff, - 0x79a792b4, - 0x70a999b9, - 0x6bbb84ae, - 0x62b58fa3, - 0x5d9fbe80, - 0x5491b58d, - 0x4f83a89a, - 0x468da397, - }, - { - 0x00000000, - 0x0e0b0d09, - 0x1c161a12, - 0x121d171b, - 0x382c3424, - 0x3627392d, - 0x243a2e36, - 0x2a31233f, - 0x70586848, - 0x7e536541, - 0x6c4e725a, - 0x62457f53, - 0x48745c6c, - 0x467f5165, - 0x5462467e, - 0x5a694b77, - 0xe0b0d090, - 0xeebbdd99, - 0xfca6ca82, - 0xf2adc78b, - 0xd89ce4b4, - 0xd697e9bd, - 0xc48afea6, - 0xca81f3af, - 0x90e8b8d8, - 0x9ee3b5d1, - 0x8cfea2ca, - 0x82f5afc3, - 0xa8c48cfc, - 0xa6cf81f5, - 0xb4d296ee, - 0xbad99be7, - 0xdb7bbb3b, - 0xd570b632, - 0xc76da129, - 0xc966ac20, - 0xe3578f1f, - 0xed5c8216, - 0xff41950d, - 0xf14a9804, - 0xab23d373, - 0xa528de7a, - 0xb735c961, - 0xb93ec468, - 0x930fe757, - 0x9d04ea5e, - 0x8f19fd45, - 0x8112f04c, - 0x3bcb6bab, - 0x35c066a2, - 0x27dd71b9, - 0x29d67cb0, - 0x03e75f8f, - 0x0dec5286, - 0x1ff1459d, - 0x11fa4894, - 0x4b9303e3, - 0x45980eea, - 0x578519f1, - 0x598e14f8, - 0x73bf37c7, - 0x7db43ace, - 0x6fa92dd5, - 0x61a220dc, - 0xadf66d76, - 0xa3fd607f, - 0xb1e07764, - 0xbfeb7a6d, - 0x95da5952, - 0x9bd1545b, - 0x89cc4340, - 0x87c74e49, - 0xddae053e, - 0xd3a50837, - 0xc1b81f2c, - 0xcfb31225, - 0xe582311a, - 0xeb893c13, - 0xf9942b08, - 0xf79f2601, - 0x4d46bde6, - 0x434db0ef, - 0x5150a7f4, - 0x5f5baafd, - 0x756a89c2, - 0x7b6184cb, - 0x697c93d0, - 0x67779ed9, - 0x3d1ed5ae, - 0x3315d8a7, - 0x2108cfbc, - 0x2f03c2b5, - 0x0532e18a, - 0x0b39ec83, - 0x1924fb98, - 0x172ff691, - 0x768dd64d, - 0x7886db44, - 0x6a9bcc5f, - 0x6490c156, - 0x4ea1e269, - 0x40aaef60, - 0x52b7f87b, - 0x5cbcf572, - 0x06d5be05, - 0x08deb30c, - 0x1ac3a417, - 0x14c8a91e, - 0x3ef98a21, - 0x30f28728, - 0x22ef9033, - 0x2ce49d3a, - 0x963d06dd, - 0x98360bd4, - 0x8a2b1ccf, - 0x842011c6, - 0xae1132f9, - 0xa01a3ff0, - 0xb20728eb, - 0xbc0c25e2, - 0xe6656e95, - 0xe86e639c, - 0xfa737487, - 0xf478798e, - 0xde495ab1, - 0xd04257b8, - 0xc25f40a3, - 0xcc544daa, - 0x41f7daec, - 0x4ffcd7e5, - 0x5de1c0fe, - 0x53eacdf7, - 0x79dbeec8, - 0x77d0e3c1, - 0x65cdf4da, - 0x6bc6f9d3, - 0x31afb2a4, - 0x3fa4bfad, - 0x2db9a8b6, - 0x23b2a5bf, - 0x09838680, - 0x07888b89, - 0x15959c92, - 0x1b9e919b, - 0xa1470a7c, - 0xaf4c0775, - 0xbd51106e, - 0xb35a1d67, - 0x996b3e58, - 0x97603351, - 0x857d244a, - 0x8b762943, - 0xd11f6234, - 0xdf146f3d, - 0xcd097826, - 0xc302752f, - 0xe9335610, - 0xe7385b19, - 0xf5254c02, - 0xfb2e410b, - 0x9a8c61d7, - 0x94876cde, - 0x869a7bc5, - 0x889176cc, - 0xa2a055f3, - 0xacab58fa, - 0xbeb64fe1, - 0xb0bd42e8, - 0xead4099f, - 0xe4df0496, - 0xf6c2138d, - 0xf8c91e84, - 0xd2f83dbb, - 0xdcf330b2, - 0xceee27a9, - 0xc0e52aa0, - 0x7a3cb147, - 0x7437bc4e, - 0x662aab55, - 0x6821a65c, - 0x42108563, - 0x4c1b886a, - 0x5e069f71, - 0x500d9278, - 0x0a64d90f, - 0x046fd406, - 0x1672c31d, - 0x1879ce14, - 0x3248ed2b, - 0x3c43e022, - 0x2e5ef739, - 0x2055fa30, - 0xec01b79a, - 0xe20aba93, - 0xf017ad88, - 0xfe1ca081, - 0xd42d83be, - 0xda268eb7, - 0xc83b99ac, - 0xc63094a5, - 0x9c59dfd2, - 0x9252d2db, - 0x804fc5c0, - 0x8e44c8c9, - 0xa475ebf6, - 0xaa7ee6ff, - 0xb863f1e4, - 0xb668fced, - 0x0cb1670a, - 0x02ba6a03, - 0x10a77d18, - 0x1eac7011, - 0x349d532e, - 0x3a965e27, - 0x288b493c, - 0x26804435, - 0x7ce90f42, - 0x72e2024b, - 0x60ff1550, - 0x6ef41859, - 0x44c53b66, - 0x4ace366f, - 0x58d32174, - 0x56d82c7d, - 0x377a0ca1, - 0x397101a8, - 0x2b6c16b3, - 0x25671bba, - 0x0f563885, - 0x015d358c, - 0x13402297, - 0x1d4b2f9e, - 0x472264e9, - 0x492969e0, - 0x5b347efb, - 0x553f73f2, - 0x7f0e50cd, - 0x71055dc4, - 0x63184adf, - 0x6d1347d6, - 0xd7cadc31, - 0xd9c1d138, - 0xcbdcc623, - 0xc5d7cb2a, - 0xefe6e815, - 0xe1ede51c, - 0xf3f0f207, - 0xfdfbff0e, - 0xa792b479, - 0xa999b970, - 0xbb84ae6b, - 0xb58fa362, - 0x9fbe805d, - 0x91b58d54, - 0x83a89a4f, - 0x8da39746, - }, -}; - - -// Tables for main encryption iterations. -const Word AESEncryptTable[4][256] = -{ - { - 0xa56363c6, - 0x847c7cf8, - 0x997777ee, - 0x8d7b7bf6, - 0x0df2f2ff, - 0xbd6b6bd6, - 0xb16f6fde, - 0x54c5c591, - 0x50303060, - 0x03010102, - 0xa96767ce, - 0x7d2b2b56, - 0x19fefee7, - 0x62d7d7b5, - 0xe6abab4d, - 0x9a7676ec, - 0x45caca8f, - 0x9d82821f, - 0x40c9c989, - 0x877d7dfa, - 0x15fafaef, - 0xeb5959b2, - 0xc947478e, - 0x0bf0f0fb, - 0xecadad41, - 0x67d4d4b3, - 0xfda2a25f, - 0xeaafaf45, - 0xbf9c9c23, - 0xf7a4a453, - 0x967272e4, - 0x5bc0c09b, - 0xc2b7b775, - 0x1cfdfde1, - 0xae93933d, - 0x6a26264c, - 0x5a36366c, - 0x413f3f7e, - 0x02f7f7f5, - 0x4fcccc83, - 0x5c343468, - 0xf4a5a551, - 0x34e5e5d1, - 0x08f1f1f9, - 0x937171e2, - 0x73d8d8ab, - 0x53313162, - 0x3f15152a, - 0x0c040408, - 0x52c7c795, - 0x65232346, - 0x5ec3c39d, - 0x28181830, - 0xa1969637, - 0x0f05050a, - 0xb59a9a2f, - 0x0907070e, - 0x36121224, - 0x9b80801b, - 0x3de2e2df, - 0x26ebebcd, - 0x6927274e, - 0xcdb2b27f, - 0x9f7575ea, - 0x1b090912, - 0x9e83831d, - 0x742c2c58, - 0x2e1a1a34, - 0x2d1b1b36, - 0xb26e6edc, - 0xee5a5ab4, - 0xfba0a05b, - 0xf65252a4, - 0x4d3b3b76, - 0x61d6d6b7, - 0xceb3b37d, - 0x7b292952, - 0x3ee3e3dd, - 0x712f2f5e, - 0x97848413, - 0xf55353a6, - 0x68d1d1b9, - 0x00000000, - 0x2cededc1, - 0x60202040, - 0x1ffcfce3, - 0xc8b1b179, - 0xed5b5bb6, - 0xbe6a6ad4, - 0x46cbcb8d, - 0xd9bebe67, - 0x4b393972, - 0xde4a4a94, - 0xd44c4c98, - 0xe85858b0, - 0x4acfcf85, - 0x6bd0d0bb, - 0x2aefefc5, - 0xe5aaaa4f, - 0x16fbfbed, - 0xc5434386, - 0xd74d4d9a, - 0x55333366, - 0x94858511, - 0xcf45458a, - 0x10f9f9e9, - 0x06020204, - 0x817f7ffe, - 0xf05050a0, - 0x443c3c78, - 0xba9f9f25, - 0xe3a8a84b, - 0xf35151a2, - 0xfea3a35d, - 0xc0404080, - 0x8a8f8f05, - 0xad92923f, - 0xbc9d9d21, - 0x48383870, - 0x04f5f5f1, - 0xdfbcbc63, - 0xc1b6b677, - 0x75dadaaf, - 0x63212142, - 0x30101020, - 0x1affffe5, - 0x0ef3f3fd, - 0x6dd2d2bf, - 0x4ccdcd81, - 0x140c0c18, - 0x35131326, - 0x2fececc3, - 0xe15f5fbe, - 0xa2979735, - 0xcc444488, - 0x3917172e, - 0x57c4c493, - 0xf2a7a755, - 0x827e7efc, - 0x473d3d7a, - 0xac6464c8, - 0xe75d5dba, - 0x2b191932, - 0x957373e6, - 0xa06060c0, - 0x98818119, - 0xd14f4f9e, - 0x7fdcdca3, - 0x66222244, - 0x7e2a2a54, - 0xab90903b, - 0x8388880b, - 0xca46468c, - 0x29eeeec7, - 0xd3b8b86b, - 0x3c141428, - 0x79dedea7, - 0xe25e5ebc, - 0x1d0b0b16, - 0x76dbdbad, - 0x3be0e0db, - 0x56323264, - 0x4e3a3a74, - 0x1e0a0a14, - 0xdb494992, - 0x0a06060c, - 0x6c242448, - 0xe45c5cb8, - 0x5dc2c29f, - 0x6ed3d3bd, - 0xefacac43, - 0xa66262c4, - 0xa8919139, - 0xa4959531, - 0x37e4e4d3, - 0x8b7979f2, - 0x32e7e7d5, - 0x43c8c88b, - 0x5937376e, - 0xb76d6dda, - 0x8c8d8d01, - 0x64d5d5b1, - 0xd24e4e9c, - 0xe0a9a949, - 0xb46c6cd8, - 0xfa5656ac, - 0x07f4f4f3, - 0x25eaeacf, - 0xaf6565ca, - 0x8e7a7af4, - 0xe9aeae47, - 0x18080810, - 0xd5baba6f, - 0x887878f0, - 0x6f25254a, - 0x722e2e5c, - 0x241c1c38, - 0xf1a6a657, - 0xc7b4b473, - 0x51c6c697, - 0x23e8e8cb, - 0x7cdddda1, - 0x9c7474e8, - 0x211f1f3e, - 0xdd4b4b96, - 0xdcbdbd61, - 0x868b8b0d, - 0x858a8a0f, - 0x907070e0, - 0x423e3e7c, - 0xc4b5b571, - 0xaa6666cc, - 0xd8484890, - 0x05030306, - 0x01f6f6f7, - 0x120e0e1c, - 0xa36161c2, - 0x5f35356a, - 0xf95757ae, - 0xd0b9b969, - 0x91868617, - 0x58c1c199, - 0x271d1d3a, - 0xb99e9e27, - 0x38e1e1d9, - 0x13f8f8eb, - 0xb398982b, - 0x33111122, - 0xbb6969d2, - 0x70d9d9a9, - 0x898e8e07, - 0xa7949433, - 0xb69b9b2d, - 0x221e1e3c, - 0x92878715, - 0x20e9e9c9, - 0x49cece87, - 0xff5555aa, - 0x78282850, - 0x7adfdfa5, - 0x8f8c8c03, - 0xf8a1a159, - 0x80898909, - 0x170d0d1a, - 0xdabfbf65, - 0x31e6e6d7, - 0xc6424284, - 0xb86868d0, - 0xc3414182, - 0xb0999929, - 0x772d2d5a, - 0x110f0f1e, - 0xcbb0b07b, - 0xfc5454a8, - 0xd6bbbb6d, - 0x3a16162c, - }, - { - 0x6363c6a5, - 0x7c7cf884, - 0x7777ee99, - 0x7b7bf68d, - 0xf2f2ff0d, - 0x6b6bd6bd, - 0x6f6fdeb1, - 0xc5c59154, - 0x30306050, - 0x01010203, - 0x6767cea9, - 0x2b2b567d, - 0xfefee719, - 0xd7d7b562, - 0xabab4de6, - 0x7676ec9a, - 0xcaca8f45, - 0x82821f9d, - 0xc9c98940, - 0x7d7dfa87, - 0xfafaef15, - 0x5959b2eb, - 0x47478ec9, - 0xf0f0fb0b, - 0xadad41ec, - 0xd4d4b367, - 0xa2a25ffd, - 0xafaf45ea, - 0x9c9c23bf, - 0xa4a453f7, - 0x7272e496, - 0xc0c09b5b, - 0xb7b775c2, - 0xfdfde11c, - 0x93933dae, - 0x26264c6a, - 0x36366c5a, - 0x3f3f7e41, - 0xf7f7f502, - 0xcccc834f, - 0x3434685c, - 0xa5a551f4, - 0xe5e5d134, - 0xf1f1f908, - 0x7171e293, - 0xd8d8ab73, - 0x31316253, - 0x15152a3f, - 0x0404080c, - 0xc7c79552, - 0x23234665, - 0xc3c39d5e, - 0x18183028, - 0x969637a1, - 0x05050a0f, - 0x9a9a2fb5, - 0x07070e09, - 0x12122436, - 0x80801b9b, - 0xe2e2df3d, - 0xebebcd26, - 0x27274e69, - 0xb2b27fcd, - 0x7575ea9f, - 0x0909121b, - 0x83831d9e, - 0x2c2c5874, - 0x1a1a342e, - 0x1b1b362d, - 0x6e6edcb2, - 0x5a5ab4ee, - 0xa0a05bfb, - 0x5252a4f6, - 0x3b3b764d, - 0xd6d6b761, - 0xb3b37dce, - 0x2929527b, - 0xe3e3dd3e, - 0x2f2f5e71, - 0x84841397, - 0x5353a6f5, - 0xd1d1b968, - 0x00000000, - 0xededc12c, - 0x20204060, - 0xfcfce31f, - 0xb1b179c8, - 0x5b5bb6ed, - 0x6a6ad4be, - 0xcbcb8d46, - 0xbebe67d9, - 0x3939724b, - 0x4a4a94de, - 0x4c4c98d4, - 0x5858b0e8, - 0xcfcf854a, - 0xd0d0bb6b, - 0xefefc52a, - 0xaaaa4fe5, - 0xfbfbed16, - 0x434386c5, - 0x4d4d9ad7, - 0x33336655, - 0x85851194, - 0x45458acf, - 0xf9f9e910, - 0x02020406, - 0x7f7ffe81, - 0x5050a0f0, - 0x3c3c7844, - 0x9f9f25ba, - 0xa8a84be3, - 0x5151a2f3, - 0xa3a35dfe, - 0x404080c0, - 0x8f8f058a, - 0x92923fad, - 0x9d9d21bc, - 0x38387048, - 0xf5f5f104, - 0xbcbc63df, - 0xb6b677c1, - 0xdadaaf75, - 0x21214263, - 0x10102030, - 0xffffe51a, - 0xf3f3fd0e, - 0xd2d2bf6d, - 0xcdcd814c, - 0x0c0c1814, - 0x13132635, - 0xececc32f, - 0x5f5fbee1, - 0x979735a2, - 0x444488cc, - 0x17172e39, - 0xc4c49357, - 0xa7a755f2, - 0x7e7efc82, - 0x3d3d7a47, - 0x6464c8ac, - 0x5d5dbae7, - 0x1919322b, - 0x7373e695, - 0x6060c0a0, - 0x81811998, - 0x4f4f9ed1, - 0xdcdca37f, - 0x22224466, - 0x2a2a547e, - 0x90903bab, - 0x88880b83, - 0x46468cca, - 0xeeeec729, - 0xb8b86bd3, - 0x1414283c, - 0xdedea779, - 0x5e5ebce2, - 0x0b0b161d, - 0xdbdbad76, - 0xe0e0db3b, - 0x32326456, - 0x3a3a744e, - 0x0a0a141e, - 0x494992db, - 0x06060c0a, - 0x2424486c, - 0x5c5cb8e4, - 0xc2c29f5d, - 0xd3d3bd6e, - 0xacac43ef, - 0x6262c4a6, - 0x919139a8, - 0x959531a4, - 0xe4e4d337, - 0x7979f28b, - 0xe7e7d532, - 0xc8c88b43, - 0x37376e59, - 0x6d6ddab7, - 0x8d8d018c, - 0xd5d5b164, - 0x4e4e9cd2, - 0xa9a949e0, - 0x6c6cd8b4, - 0x5656acfa, - 0xf4f4f307, - 0xeaeacf25, - 0x6565caaf, - 0x7a7af48e, - 0xaeae47e9, - 0x08081018, - 0xbaba6fd5, - 0x7878f088, - 0x25254a6f, - 0x2e2e5c72, - 0x1c1c3824, - 0xa6a657f1, - 0xb4b473c7, - 0xc6c69751, - 0xe8e8cb23, - 0xdddda17c, - 0x7474e89c, - 0x1f1f3e21, - 0x4b4b96dd, - 0xbdbd61dc, - 0x8b8b0d86, - 0x8a8a0f85, - 0x7070e090, - 0x3e3e7c42, - 0xb5b571c4, - 0x6666ccaa, - 0x484890d8, - 0x03030605, - 0xf6f6f701, - 0x0e0e1c12, - 0x6161c2a3, - 0x35356a5f, - 0x5757aef9, - 0xb9b969d0, - 0x86861791, - 0xc1c19958, - 0x1d1d3a27, - 0x9e9e27b9, - 0xe1e1d938, - 0xf8f8eb13, - 0x98982bb3, - 0x11112233, - 0x6969d2bb, - 0xd9d9a970, - 0x8e8e0789, - 0x949433a7, - 0x9b9b2db6, - 0x1e1e3c22, - 0x87871592, - 0xe9e9c920, - 0xcece8749, - 0x5555aaff, - 0x28285078, - 0xdfdfa57a, - 0x8c8c038f, - 0xa1a159f8, - 0x89890980, - 0x0d0d1a17, - 0xbfbf65da, - 0xe6e6d731, - 0x424284c6, - 0x6868d0b8, - 0x414182c3, - 0x999929b0, - 0x2d2d5a77, - 0x0f0f1e11, - 0xb0b07bcb, - 0x5454a8fc, - 0xbbbb6dd6, - 0x16162c3a, - }, - { - 0x63c6a563, - 0x7cf8847c, - 0x77ee9977, - 0x7bf68d7b, - 0xf2ff0df2, - 0x6bd6bd6b, - 0x6fdeb16f, - 0xc59154c5, - 0x30605030, - 0x01020301, - 0x67cea967, - 0x2b567d2b, - 0xfee719fe, - 0xd7b562d7, - 0xab4de6ab, - 0x76ec9a76, - 0xca8f45ca, - 0x821f9d82, - 0xc98940c9, - 0x7dfa877d, - 0xfaef15fa, - 0x59b2eb59, - 0x478ec947, - 0xf0fb0bf0, - 0xad41ecad, - 0xd4b367d4, - 0xa25ffda2, - 0xaf45eaaf, - 0x9c23bf9c, - 0xa453f7a4, - 0x72e49672, - 0xc09b5bc0, - 0xb775c2b7, - 0xfde11cfd, - 0x933dae93, - 0x264c6a26, - 0x366c5a36, - 0x3f7e413f, - 0xf7f502f7, - 0xcc834fcc, - 0x34685c34, - 0xa551f4a5, - 0xe5d134e5, - 0xf1f908f1, - 0x71e29371, - 0xd8ab73d8, - 0x31625331, - 0x152a3f15, - 0x04080c04, - 0xc79552c7, - 0x23466523, - 0xc39d5ec3, - 0x18302818, - 0x9637a196, - 0x050a0f05, - 0x9a2fb59a, - 0x070e0907, - 0x12243612, - 0x801b9b80, - 0xe2df3de2, - 0xebcd26eb, - 0x274e6927, - 0xb27fcdb2, - 0x75ea9f75, - 0x09121b09, - 0x831d9e83, - 0x2c58742c, - 0x1a342e1a, - 0x1b362d1b, - 0x6edcb26e, - 0x5ab4ee5a, - 0xa05bfba0, - 0x52a4f652, - 0x3b764d3b, - 0xd6b761d6, - 0xb37dceb3, - 0x29527b29, - 0xe3dd3ee3, - 0x2f5e712f, - 0x84139784, - 0x53a6f553, - 0xd1b968d1, - 0x00000000, - 0xedc12ced, - 0x20406020, - 0xfce31ffc, - 0xb179c8b1, - 0x5bb6ed5b, - 0x6ad4be6a, - 0xcb8d46cb, - 0xbe67d9be, - 0x39724b39, - 0x4a94de4a, - 0x4c98d44c, - 0x58b0e858, - 0xcf854acf, - 0xd0bb6bd0, - 0xefc52aef, - 0xaa4fe5aa, - 0xfbed16fb, - 0x4386c543, - 0x4d9ad74d, - 0x33665533, - 0x85119485, - 0x458acf45, - 0xf9e910f9, - 0x02040602, - 0x7ffe817f, - 0x50a0f050, - 0x3c78443c, - 0x9f25ba9f, - 0xa84be3a8, - 0x51a2f351, - 0xa35dfea3, - 0x4080c040, - 0x8f058a8f, - 0x923fad92, - 0x9d21bc9d, - 0x38704838, - 0xf5f104f5, - 0xbc63dfbc, - 0xb677c1b6, - 0xdaaf75da, - 0x21426321, - 0x10203010, - 0xffe51aff, - 0xf3fd0ef3, - 0xd2bf6dd2, - 0xcd814ccd, - 0x0c18140c, - 0x13263513, - 0xecc32fec, - 0x5fbee15f, - 0x9735a297, - 0x4488cc44, - 0x172e3917, - 0xc49357c4, - 0xa755f2a7, - 0x7efc827e, - 0x3d7a473d, - 0x64c8ac64, - 0x5dbae75d, - 0x19322b19, - 0x73e69573, - 0x60c0a060, - 0x81199881, - 0x4f9ed14f, - 0xdca37fdc, - 0x22446622, - 0x2a547e2a, - 0x903bab90, - 0x880b8388, - 0x468cca46, - 0xeec729ee, - 0xb86bd3b8, - 0x14283c14, - 0xdea779de, - 0x5ebce25e, - 0x0b161d0b, - 0xdbad76db, - 0xe0db3be0, - 0x32645632, - 0x3a744e3a, - 0x0a141e0a, - 0x4992db49, - 0x060c0a06, - 0x24486c24, - 0x5cb8e45c, - 0xc29f5dc2, - 0xd3bd6ed3, - 0xac43efac, - 0x62c4a662, - 0x9139a891, - 0x9531a495, - 0xe4d337e4, - 0x79f28b79, - 0xe7d532e7, - 0xc88b43c8, - 0x376e5937, - 0x6ddab76d, - 0x8d018c8d, - 0xd5b164d5, - 0x4e9cd24e, - 0xa949e0a9, - 0x6cd8b46c, - 0x56acfa56, - 0xf4f307f4, - 0xeacf25ea, - 0x65caaf65, - 0x7af48e7a, - 0xae47e9ae, - 0x08101808, - 0xba6fd5ba, - 0x78f08878, - 0x254a6f25, - 0x2e5c722e, - 0x1c38241c, - 0xa657f1a6, - 0xb473c7b4, - 0xc69751c6, - 0xe8cb23e8, - 0xdda17cdd, - 0x74e89c74, - 0x1f3e211f, - 0x4b96dd4b, - 0xbd61dcbd, - 0x8b0d868b, - 0x8a0f858a, - 0x70e09070, - 0x3e7c423e, - 0xb571c4b5, - 0x66ccaa66, - 0x4890d848, - 0x03060503, - 0xf6f701f6, - 0x0e1c120e, - 0x61c2a361, - 0x356a5f35, - 0x57aef957, - 0xb969d0b9, - 0x86179186, - 0xc19958c1, - 0x1d3a271d, - 0x9e27b99e, - 0xe1d938e1, - 0xf8eb13f8, - 0x982bb398, - 0x11223311, - 0x69d2bb69, - 0xd9a970d9, - 0x8e07898e, - 0x9433a794, - 0x9b2db69b, - 0x1e3c221e, - 0x87159287, - 0xe9c920e9, - 0xce8749ce, - 0x55aaff55, - 0x28507828, - 0xdfa57adf, - 0x8c038f8c, - 0xa159f8a1, - 0x89098089, - 0x0d1a170d, - 0xbf65dabf, - 0xe6d731e6, - 0x4284c642, - 0x68d0b868, - 0x4182c341, - 0x9929b099, - 0x2d5a772d, - 0x0f1e110f, - 0xb07bcbb0, - 0x54a8fc54, - 0xbb6dd6bb, - 0x162c3a16, - }, - { - 0xc6a56363, - 0xf8847c7c, - 0xee997777, - 0xf68d7b7b, - 0xff0df2f2, - 0xd6bd6b6b, - 0xdeb16f6f, - 0x9154c5c5, - 0x60503030, - 0x02030101, - 0xcea96767, - 0x567d2b2b, - 0xe719fefe, - 0xb562d7d7, - 0x4de6abab, - 0xec9a7676, - 0x8f45caca, - 0x1f9d8282, - 0x8940c9c9, - 0xfa877d7d, - 0xef15fafa, - 0xb2eb5959, - 0x8ec94747, - 0xfb0bf0f0, - 0x41ecadad, - 0xb367d4d4, - 0x5ffda2a2, - 0x45eaafaf, - 0x23bf9c9c, - 0x53f7a4a4, - 0xe4967272, - 0x9b5bc0c0, - 0x75c2b7b7, - 0xe11cfdfd, - 0x3dae9393, - 0x4c6a2626, - 0x6c5a3636, - 0x7e413f3f, - 0xf502f7f7, - 0x834fcccc, - 0x685c3434, - 0x51f4a5a5, - 0xd134e5e5, - 0xf908f1f1, - 0xe2937171, - 0xab73d8d8, - 0x62533131, - 0x2a3f1515, - 0x080c0404, - 0x9552c7c7, - 0x46652323, - 0x9d5ec3c3, - 0x30281818, - 0x37a19696, - 0x0a0f0505, - 0x2fb59a9a, - 0x0e090707, - 0x24361212, - 0x1b9b8080, - 0xdf3de2e2, - 0xcd26ebeb, - 0x4e692727, - 0x7fcdb2b2, - 0xea9f7575, - 0x121b0909, - 0x1d9e8383, - 0x58742c2c, - 0x342e1a1a, - 0x362d1b1b, - 0xdcb26e6e, - 0xb4ee5a5a, - 0x5bfba0a0, - 0xa4f65252, - 0x764d3b3b, - 0xb761d6d6, - 0x7dceb3b3, - 0x527b2929, - 0xdd3ee3e3, - 0x5e712f2f, - 0x13978484, - 0xa6f55353, - 0xb968d1d1, - 0x00000000, - 0xc12ceded, - 0x40602020, - 0xe31ffcfc, - 0x79c8b1b1, - 0xb6ed5b5b, - 0xd4be6a6a, - 0x8d46cbcb, - 0x67d9bebe, - 0x724b3939, - 0x94de4a4a, - 0x98d44c4c, - 0xb0e85858, - 0x854acfcf, - 0xbb6bd0d0, - 0xc52aefef, - 0x4fe5aaaa, - 0xed16fbfb, - 0x86c54343, - 0x9ad74d4d, - 0x66553333, - 0x11948585, - 0x8acf4545, - 0xe910f9f9, - 0x04060202, - 0xfe817f7f, - 0xa0f05050, - 0x78443c3c, - 0x25ba9f9f, - 0x4be3a8a8, - 0xa2f35151, - 0x5dfea3a3, - 0x80c04040, - 0x058a8f8f, - 0x3fad9292, - 0x21bc9d9d, - 0x70483838, - 0xf104f5f5, - 0x63dfbcbc, - 0x77c1b6b6, - 0xaf75dada, - 0x42632121, - 0x20301010, - 0xe51affff, - 0xfd0ef3f3, - 0xbf6dd2d2, - 0x814ccdcd, - 0x18140c0c, - 0x26351313, - 0xc32fecec, - 0xbee15f5f, - 0x35a29797, - 0x88cc4444, - 0x2e391717, - 0x9357c4c4, - 0x55f2a7a7, - 0xfc827e7e, - 0x7a473d3d, - 0xc8ac6464, - 0xbae75d5d, - 0x322b1919, - 0xe6957373, - 0xc0a06060, - 0x19988181, - 0x9ed14f4f, - 0xa37fdcdc, - 0x44662222, - 0x547e2a2a, - 0x3bab9090, - 0x0b838888, - 0x8cca4646, - 0xc729eeee, - 0x6bd3b8b8, - 0x283c1414, - 0xa779dede, - 0xbce25e5e, - 0x161d0b0b, - 0xad76dbdb, - 0xdb3be0e0, - 0x64563232, - 0x744e3a3a, - 0x141e0a0a, - 0x92db4949, - 0x0c0a0606, - 0x486c2424, - 0xb8e45c5c, - 0x9f5dc2c2, - 0xbd6ed3d3, - 0x43efacac, - 0xc4a66262, - 0x39a89191, - 0x31a49595, - 0xd337e4e4, - 0xf28b7979, - 0xd532e7e7, - 0x8b43c8c8, - 0x6e593737, - 0xdab76d6d, - 0x018c8d8d, - 0xb164d5d5, - 0x9cd24e4e, - 0x49e0a9a9, - 0xd8b46c6c, - 0xacfa5656, - 0xf307f4f4, - 0xcf25eaea, - 0xcaaf6565, - 0xf48e7a7a, - 0x47e9aeae, - 0x10180808, - 0x6fd5baba, - 0xf0887878, - 0x4a6f2525, - 0x5c722e2e, - 0x38241c1c, - 0x57f1a6a6, - 0x73c7b4b4, - 0x9751c6c6, - 0xcb23e8e8, - 0xa17cdddd, - 0xe89c7474, - 0x3e211f1f, - 0x96dd4b4b, - 0x61dcbdbd, - 0x0d868b8b, - 0x0f858a8a, - 0xe0907070, - 0x7c423e3e, - 0x71c4b5b5, - 0xccaa6666, - 0x90d84848, - 0x06050303, - 0xf701f6f6, - 0x1c120e0e, - 0xc2a36161, - 0x6a5f3535, - 0xaef95757, - 0x69d0b9b9, - 0x17918686, - 0x9958c1c1, - 0x3a271d1d, - 0x27b99e9e, - 0xd938e1e1, - 0xeb13f8f8, - 0x2bb39898, - 0x22331111, - 0xd2bb6969, - 0xa970d9d9, - 0x07898e8e, - 0x33a79494, - 0x2db69b9b, - 0x3c221e1e, - 0x15928787, - 0xc920e9e9, - 0x8749cece, - 0xaaff5555, - 0x50782828, - 0xa57adfdf, - 0x038f8c8c, - 0x59f8a1a1, - 0x09808989, - 0x1a170d0d, - 0x65dabfbf, - 0xd731e6e6, - 0x84c64242, - 0xd0b86868, - 0x82c34141, - 0x29b09999, - 0x5a772d2d, - 0x1e110f0f, - 0x7bcbb0b0, - 0xa8fc5454, - 0x6dd6bbbb, - 0x2c3a1616, - }, -}; - - -// Tables for main decryption iterations. -const Word AESDecryptTable[4][256] = -{ - { - 0x50a7f451, - 0x5365417e, - 0xc3a4171a, - 0x965e273a, - 0xcb6bab3b, - 0xf1459d1f, - 0xab58faac, - 0x9303e34b, - 0x55fa3020, - 0xf66d76ad, - 0x9176cc88, - 0x254c02f5, - 0xfcd7e54f, - 0xd7cb2ac5, - 0x80443526, - 0x8fa362b5, - 0x495ab1de, - 0x671bba25, - 0x980eea45, - 0xe1c0fe5d, - 0x02752fc3, - 0x12f04c81, - 0xa397468d, - 0xc6f9d36b, - 0xe75f8f03, - 0x959c9215, - 0xeb7a6dbf, - 0xda595295, - 0x2d83bed4, - 0xd3217458, - 0x2969e049, - 0x44c8c98e, - 0x6a89c275, - 0x78798ef4, - 0x6b3e5899, - 0xdd71b927, - 0xb64fe1be, - 0x17ad88f0, - 0x66ac20c9, - 0xb43ace7d, - 0x184adf63, - 0x82311ae5, - 0x60335197, - 0x457f5362, - 0xe07764b1, - 0x84ae6bbb, - 0x1ca081fe, - 0x942b08f9, - 0x58684870, - 0x19fd458f, - 0x876cde94, - 0xb7f87b52, - 0x23d373ab, - 0xe2024b72, - 0x578f1fe3, - 0x2aab5566, - 0x0728ebb2, - 0x03c2b52f, - 0x9a7bc586, - 0xa50837d3, - 0xf2872830, - 0xb2a5bf23, - 0xba6a0302, - 0x5c8216ed, - 0x2b1ccf8a, - 0x92b479a7, - 0xf0f207f3, - 0xa1e2694e, - 0xcdf4da65, - 0xd5be0506, - 0x1f6234d1, - 0x8afea6c4, - 0x9d532e34, - 0xa055f3a2, - 0x32e18a05, - 0x75ebf6a4, - 0x39ec830b, - 0xaaef6040, - 0x069f715e, - 0x51106ebd, - 0xf98a213e, - 0x3d06dd96, - 0xae053edd, - 0x46bde64d, - 0xb58d5491, - 0x055dc471, - 0x6fd40604, - 0xff155060, - 0x24fb9819, - 0x97e9bdd6, - 0xcc434089, - 0x779ed967, - 0xbd42e8b0, - 0x888b8907, - 0x385b19e7, - 0xdbeec879, - 0x470a7ca1, - 0xe90f427c, - 0xc91e84f8, - 0x00000000, - 0x83868009, - 0x48ed2b32, - 0xac70111e, - 0x4e725a6c, - 0xfbff0efd, - 0x5638850f, - 0x1ed5ae3d, - 0x27392d36, - 0x64d90f0a, - 0x21a65c68, - 0xd1545b9b, - 0x3a2e3624, - 0xb1670a0c, - 0x0fe75793, - 0xd296eeb4, - 0x9e919b1b, - 0x4fc5c080, - 0xa220dc61, - 0x694b775a, - 0x161a121c, - 0x0aba93e2, - 0xe52aa0c0, - 0x43e0223c, - 0x1d171b12, - 0x0b0d090e, - 0xadc78bf2, - 0xb9a8b62d, - 0xc8a91e14, - 0x8519f157, - 0x4c0775af, - 0xbbdd99ee, - 0xfd607fa3, - 0x9f2601f7, - 0xbcf5725c, - 0xc53b6644, - 0x347efb5b, - 0x7629438b, - 0xdcc623cb, - 0x68fcedb6, - 0x63f1e4b8, - 0xcadc31d7, - 0x10856342, - 0x40229713, - 0x2011c684, - 0x7d244a85, - 0xf83dbbd2, - 0x1132f9ae, - 0x6da129c7, - 0x4b2f9e1d, - 0xf330b2dc, - 0xec52860d, - 0xd0e3c177, - 0x6c16b32b, - 0x99b970a9, - 0xfa489411, - 0x2264e947, - 0xc48cfca8, - 0x1a3ff0a0, - 0xd82c7d56, - 0xef903322, - 0xc74e4987, - 0xc1d138d9, - 0xfea2ca8c, - 0x360bd498, - 0xcf81f5a6, - 0x28de7aa5, - 0x268eb7da, - 0xa4bfad3f, - 0xe49d3a2c, - 0x0d927850, - 0x9bcc5f6a, - 0x62467e54, - 0xc2138df6, - 0xe8b8d890, - 0x5ef7392e, - 0xf5afc382, - 0xbe805d9f, - 0x7c93d069, - 0xa92dd56f, - 0xb31225cf, - 0x3b99acc8, - 0xa77d1810, - 0x6e639ce8, - 0x7bbb3bdb, - 0x097826cd, - 0xf418596e, - 0x01b79aec, - 0xa89a4f83, - 0x656e95e6, - 0x7ee6ffaa, - 0x08cfbc21, - 0xe6e815ef, - 0xd99be7ba, - 0xce366f4a, - 0xd4099fea, - 0xd67cb029, - 0xafb2a431, - 0x31233f2a, - 0x3094a5c6, - 0xc066a235, - 0x37bc4e74, - 0xa6ca82fc, - 0xb0d090e0, - 0x15d8a733, - 0x4a9804f1, - 0xf7daec41, - 0x0e50cd7f, - 0x2ff69117, - 0x8dd64d76, - 0x4db0ef43, - 0x544daacc, - 0xdf0496e4, - 0xe3b5d19e, - 0x1b886a4c, - 0xb81f2cc1, - 0x7f516546, - 0x04ea5e9d, - 0x5d358c01, - 0x737487fa, - 0x2e410bfb, - 0x5a1d67b3, - 0x52d2db92, - 0x335610e9, - 0x1347d66d, - 0x8c61d79a, - 0x7a0ca137, - 0x8e14f859, - 0x893c13eb, - 0xee27a9ce, - 0x35c961b7, - 0xede51ce1, - 0x3cb1477a, - 0x59dfd29c, - 0x3f73f255, - 0x79ce1418, - 0xbf37c773, - 0xeacdf753, - 0x5baafd5f, - 0x146f3ddf, - 0x86db4478, - 0x81f3afca, - 0x3ec468b9, - 0x2c342438, - 0x5f40a3c2, - 0x72c31d16, - 0x0c25e2bc, - 0x8b493c28, - 0x41950dff, - 0x7101a839, - 0xdeb30c08, - 0x9ce4b4d8, - 0x90c15664, - 0x6184cb7b, - 0x70b632d5, - 0x745c6c48, - 0x4257b8d0, - }, - { - 0xa7f45150, - 0x65417e53, - 0xa4171ac3, - 0x5e273a96, - 0x6bab3bcb, - 0x459d1ff1, - 0x58faacab, - 0x03e34b93, - 0xfa302055, - 0x6d76adf6, - 0x76cc8891, - 0x4c02f525, - 0xd7e54ffc, - 0xcb2ac5d7, - 0x44352680, - 0xa362b58f, - 0x5ab1de49, - 0x1bba2567, - 0x0eea4598, - 0xc0fe5de1, - 0x752fc302, - 0xf04c8112, - 0x97468da3, - 0xf9d36bc6, - 0x5f8f03e7, - 0x9c921595, - 0x7a6dbfeb, - 0x595295da, - 0x83bed42d, - 0x217458d3, - 0x69e04929, - 0xc8c98e44, - 0x89c2756a, - 0x798ef478, - 0x3e58996b, - 0x71b927dd, - 0x4fe1beb6, - 0xad88f017, - 0xac20c966, - 0x3ace7db4, - 0x4adf6318, - 0x311ae582, - 0x33519760, - 0x7f536245, - 0x7764b1e0, - 0xae6bbb84, - 0xa081fe1c, - 0x2b08f994, - 0x68487058, - 0xfd458f19, - 0x6cde9487, - 0xf87b52b7, - 0xd373ab23, - 0x024b72e2, - 0x8f1fe357, - 0xab55662a, - 0x28ebb207, - 0xc2b52f03, - 0x7bc5869a, - 0x0837d3a5, - 0x872830f2, - 0xa5bf23b2, - 0x6a0302ba, - 0x8216ed5c, - 0x1ccf8a2b, - 0xb479a792, - 0xf207f3f0, - 0xe2694ea1, - 0xf4da65cd, - 0xbe0506d5, - 0x6234d11f, - 0xfea6c48a, - 0x532e349d, - 0x55f3a2a0, - 0xe18a0532, - 0xebf6a475, - 0xec830b39, - 0xef6040aa, - 0x9f715e06, - 0x106ebd51, - 0x8a213ef9, - 0x06dd963d, - 0x053eddae, - 0xbde64d46, - 0x8d5491b5, - 0x5dc47105, - 0xd406046f, - 0x155060ff, - 0xfb981924, - 0xe9bdd697, - 0x434089cc, - 0x9ed96777, - 0x42e8b0bd, - 0x8b890788, - 0x5b19e738, - 0xeec879db, - 0x0a7ca147, - 0x0f427ce9, - 0x1e84f8c9, - 0x00000000, - 0x86800983, - 0xed2b3248, - 0x70111eac, - 0x725a6c4e, - 0xff0efdfb, - 0x38850f56, - 0xd5ae3d1e, - 0x392d3627, - 0xd90f0a64, - 0xa65c6821, - 0x545b9bd1, - 0x2e36243a, - 0x670a0cb1, - 0xe757930f, - 0x96eeb4d2, - 0x919b1b9e, - 0xc5c0804f, - 0x20dc61a2, - 0x4b775a69, - 0x1a121c16, - 0xba93e20a, - 0x2aa0c0e5, - 0xe0223c43, - 0x171b121d, - 0x0d090e0b, - 0xc78bf2ad, - 0xa8b62db9, - 0xa91e14c8, - 0x19f15785, - 0x0775af4c, - 0xdd99eebb, - 0x607fa3fd, - 0x2601f79f, - 0xf5725cbc, - 0x3b6644c5, - 0x7efb5b34, - 0x29438b76, - 0xc623cbdc, - 0xfcedb668, - 0xf1e4b863, - 0xdc31d7ca, - 0x85634210, - 0x22971340, - 0x11c68420, - 0x244a857d, - 0x3dbbd2f8, - 0x32f9ae11, - 0xa129c76d, - 0x2f9e1d4b, - 0x30b2dcf3, - 0x52860dec, - 0xe3c177d0, - 0x16b32b6c, - 0xb970a999, - 0x489411fa, - 0x64e94722, - 0x8cfca8c4, - 0x3ff0a01a, - 0x2c7d56d8, - 0x903322ef, - 0x4e4987c7, - 0xd138d9c1, - 0xa2ca8cfe, - 0x0bd49836, - 0x81f5a6cf, - 0xde7aa528, - 0x8eb7da26, - 0xbfad3fa4, - 0x9d3a2ce4, - 0x9278500d, - 0xcc5f6a9b, - 0x467e5462, - 0x138df6c2, - 0xb8d890e8, - 0xf7392e5e, - 0xafc382f5, - 0x805d9fbe, - 0x93d0697c, - 0x2dd56fa9, - 0x1225cfb3, - 0x99acc83b, - 0x7d1810a7, - 0x639ce86e, - 0xbb3bdb7b, - 0x7826cd09, - 0x18596ef4, - 0xb79aec01, - 0x9a4f83a8, - 0x6e95e665, - 0xe6ffaa7e, - 0xcfbc2108, - 0xe815efe6, - 0x9be7bad9, - 0x366f4ace, - 0x099fead4, - 0x7cb029d6, - 0xb2a431af, - 0x233f2a31, - 0x94a5c630, - 0x66a235c0, - 0xbc4e7437, - 0xca82fca6, - 0xd090e0b0, - 0xd8a73315, - 0x9804f14a, - 0xdaec41f7, - 0x50cd7f0e, - 0xf691172f, - 0xd64d768d, - 0xb0ef434d, - 0x4daacc54, - 0x0496e4df, - 0xb5d19ee3, - 0x886a4c1b, - 0x1f2cc1b8, - 0x5165467f, - 0xea5e9d04, - 0x358c015d, - 0x7487fa73, - 0x410bfb2e, - 0x1d67b35a, - 0xd2db9252, - 0x5610e933, - 0x47d66d13, - 0x61d79a8c, - 0x0ca1377a, - 0x14f8598e, - 0x3c13eb89, - 0x27a9ceee, - 0xc961b735, - 0xe51ce1ed, - 0xb1477a3c, - 0xdfd29c59, - 0x73f2553f, - 0xce141879, - 0x37c773bf, - 0xcdf753ea, - 0xaafd5f5b, - 0x6f3ddf14, - 0xdb447886, - 0xf3afca81, - 0xc468b93e, - 0x3424382c, - 0x40a3c25f, - 0xc31d1672, - 0x25e2bc0c, - 0x493c288b, - 0x950dff41, - 0x01a83971, - 0xb30c08de, - 0xe4b4d89c, - 0xc1566490, - 0x84cb7b61, - 0xb632d570, - 0x5c6c4874, - 0x57b8d042, - }, - { - 0xf45150a7, - 0x417e5365, - 0x171ac3a4, - 0x273a965e, - 0xab3bcb6b, - 0x9d1ff145, - 0xfaacab58, - 0xe34b9303, - 0x302055fa, - 0x76adf66d, - 0xcc889176, - 0x02f5254c, - 0xe54ffcd7, - 0x2ac5d7cb, - 0x35268044, - 0x62b58fa3, - 0xb1de495a, - 0xba25671b, - 0xea45980e, - 0xfe5de1c0, - 0x2fc30275, - 0x4c8112f0, - 0x468da397, - 0xd36bc6f9, - 0x8f03e75f, - 0x9215959c, - 0x6dbfeb7a, - 0x5295da59, - 0xbed42d83, - 0x7458d321, - 0xe0492969, - 0xc98e44c8, - 0xc2756a89, - 0x8ef47879, - 0x58996b3e, - 0xb927dd71, - 0xe1beb64f, - 0x88f017ad, - 0x20c966ac, - 0xce7db43a, - 0xdf63184a, - 0x1ae58231, - 0x51976033, - 0x5362457f, - 0x64b1e077, - 0x6bbb84ae, - 0x81fe1ca0, - 0x08f9942b, - 0x48705868, - 0x458f19fd, - 0xde94876c, - 0x7b52b7f8, - 0x73ab23d3, - 0x4b72e202, - 0x1fe3578f, - 0x55662aab, - 0xebb20728, - 0xb52f03c2, - 0xc5869a7b, - 0x37d3a508, - 0x2830f287, - 0xbf23b2a5, - 0x0302ba6a, - 0x16ed5c82, - 0xcf8a2b1c, - 0x79a792b4, - 0x07f3f0f2, - 0x694ea1e2, - 0xda65cdf4, - 0x0506d5be, - 0x34d11f62, - 0xa6c48afe, - 0x2e349d53, - 0xf3a2a055, - 0x8a0532e1, - 0xf6a475eb, - 0x830b39ec, - 0x6040aaef, - 0x715e069f, - 0x6ebd5110, - 0x213ef98a, - 0xdd963d06, - 0x3eddae05, - 0xe64d46bd, - 0x5491b58d, - 0xc471055d, - 0x06046fd4, - 0x5060ff15, - 0x981924fb, - 0xbdd697e9, - 0x4089cc43, - 0xd967779e, - 0xe8b0bd42, - 0x8907888b, - 0x19e7385b, - 0xc879dbee, - 0x7ca1470a, - 0x427ce90f, - 0x84f8c91e, - 0x00000000, - 0x80098386, - 0x2b3248ed, - 0x111eac70, - 0x5a6c4e72, - 0x0efdfbff, - 0x850f5638, - 0xae3d1ed5, - 0x2d362739, - 0x0f0a64d9, - 0x5c6821a6, - 0x5b9bd154, - 0x36243a2e, - 0x0a0cb167, - 0x57930fe7, - 0xeeb4d296, - 0x9b1b9e91, - 0xc0804fc5, - 0xdc61a220, - 0x775a694b, - 0x121c161a, - 0x93e20aba, - 0xa0c0e52a, - 0x223c43e0, - 0x1b121d17, - 0x090e0b0d, - 0x8bf2adc7, - 0xb62db9a8, - 0x1e14c8a9, - 0xf1578519, - 0x75af4c07, - 0x99eebbdd, - 0x7fa3fd60, - 0x01f79f26, - 0x725cbcf5, - 0x6644c53b, - 0xfb5b347e, - 0x438b7629, - 0x23cbdcc6, - 0xedb668fc, - 0xe4b863f1, - 0x31d7cadc, - 0x63421085, - 0x97134022, - 0xc6842011, - 0x4a857d24, - 0xbbd2f83d, - 0xf9ae1132, - 0x29c76da1, - 0x9e1d4b2f, - 0xb2dcf330, - 0x860dec52, - 0xc177d0e3, - 0xb32b6c16, - 0x70a999b9, - 0x9411fa48, - 0xe9472264, - 0xfca8c48c, - 0xf0a01a3f, - 0x7d56d82c, - 0x3322ef90, - 0x4987c74e, - 0x38d9c1d1, - 0xca8cfea2, - 0xd498360b, - 0xf5a6cf81, - 0x7aa528de, - 0xb7da268e, - 0xad3fa4bf, - 0x3a2ce49d, - 0x78500d92, - 0x5f6a9bcc, - 0x7e546246, - 0x8df6c213, - 0xd890e8b8, - 0x392e5ef7, - 0xc382f5af, - 0x5d9fbe80, - 0xd0697c93, - 0xd56fa92d, - 0x25cfb312, - 0xacc83b99, - 0x1810a77d, - 0x9ce86e63, - 0x3bdb7bbb, - 0x26cd0978, - 0x596ef418, - 0x9aec01b7, - 0x4f83a89a, - 0x95e6656e, - 0xffaa7ee6, - 0xbc2108cf, - 0x15efe6e8, - 0xe7bad99b, - 0x6f4ace36, - 0x9fead409, - 0xb029d67c, - 0xa431afb2, - 0x3f2a3123, - 0xa5c63094, - 0xa235c066, - 0x4e7437bc, - 0x82fca6ca, - 0x90e0b0d0, - 0xa73315d8, - 0x04f14a98, - 0xec41f7da, - 0xcd7f0e50, - 0x91172ff6, - 0x4d768dd6, - 0xef434db0, - 0xaacc544d, - 0x96e4df04, - 0xd19ee3b5, - 0x6a4c1b88, - 0x2cc1b81f, - 0x65467f51, - 0x5e9d04ea, - 0x8c015d35, - 0x87fa7374, - 0x0bfb2e41, - 0x67b35a1d, - 0xdb9252d2, - 0x10e93356, - 0xd66d1347, - 0xd79a8c61, - 0xa1377a0c, - 0xf8598e14, - 0x13eb893c, - 0xa9ceee27, - 0x61b735c9, - 0x1ce1ede5, - 0x477a3cb1, - 0xd29c59df, - 0xf2553f73, - 0x141879ce, - 0xc773bf37, - 0xf753eacd, - 0xfd5f5baa, - 0x3ddf146f, - 0x447886db, - 0xafca81f3, - 0x68b93ec4, - 0x24382c34, - 0xa3c25f40, - 0x1d1672c3, - 0xe2bc0c25, - 0x3c288b49, - 0x0dff4195, - 0xa8397101, - 0x0c08deb3, - 0xb4d89ce4, - 0x566490c1, - 0xcb7b6184, - 0x32d570b6, - 0x6c48745c, - 0xb8d04257, - }, - { - 0x5150a7f4, - 0x7e536541, - 0x1ac3a417, - 0x3a965e27, - 0x3bcb6bab, - 0x1ff1459d, - 0xacab58fa, - 0x4b9303e3, - 0x2055fa30, - 0xadf66d76, - 0x889176cc, - 0xf5254c02, - 0x4ffcd7e5, - 0xc5d7cb2a, - 0x26804435, - 0xb58fa362, - 0xde495ab1, - 0x25671bba, - 0x45980eea, - 0x5de1c0fe, - 0xc302752f, - 0x8112f04c, - 0x8da39746, - 0x6bc6f9d3, - 0x03e75f8f, - 0x15959c92, - 0xbfeb7a6d, - 0x95da5952, - 0xd42d83be, - 0x58d32174, - 0x492969e0, - 0x8e44c8c9, - 0x756a89c2, - 0xf478798e, - 0x996b3e58, - 0x27dd71b9, - 0xbeb64fe1, - 0xf017ad88, - 0xc966ac20, - 0x7db43ace, - 0x63184adf, - 0xe582311a, - 0x97603351, - 0x62457f53, - 0xb1e07764, - 0xbb84ae6b, - 0xfe1ca081, - 0xf9942b08, - 0x70586848, - 0x8f19fd45, - 0x94876cde, - 0x52b7f87b, - 0xab23d373, - 0x72e2024b, - 0xe3578f1f, - 0x662aab55, - 0xb20728eb, - 0x2f03c2b5, - 0x869a7bc5, - 0xd3a50837, - 0x30f28728, - 0x23b2a5bf, - 0x02ba6a03, - 0xed5c8216, - 0x8a2b1ccf, - 0xa792b479, - 0xf3f0f207, - 0x4ea1e269, - 0x65cdf4da, - 0x06d5be05, - 0xd11f6234, - 0xc48afea6, - 0x349d532e, - 0xa2a055f3, - 0x0532e18a, - 0xa475ebf6, - 0x0b39ec83, - 0x40aaef60, - 0x5e069f71, - 0xbd51106e, - 0x3ef98a21, - 0x963d06dd, - 0xddae053e, - 0x4d46bde6, - 0x91b58d54, - 0x71055dc4, - 0x046fd406, - 0x60ff1550, - 0x1924fb98, - 0xd697e9bd, - 0x89cc4340, - 0x67779ed9, - 0xb0bd42e8, - 0x07888b89, - 0xe7385b19, - 0x79dbeec8, - 0xa1470a7c, - 0x7ce90f42, - 0xf8c91e84, - 0x00000000, - 0x09838680, - 0x3248ed2b, - 0x1eac7011, - 0x6c4e725a, - 0xfdfbff0e, - 0x0f563885, - 0x3d1ed5ae, - 0x3627392d, - 0x0a64d90f, - 0x6821a65c, - 0x9bd1545b, - 0x243a2e36, - 0x0cb1670a, - 0x930fe757, - 0xb4d296ee, - 0x1b9e919b, - 0x804fc5c0, - 0x61a220dc, - 0x5a694b77, - 0x1c161a12, - 0xe20aba93, - 0xc0e52aa0, - 0x3c43e022, - 0x121d171b, - 0x0e0b0d09, - 0xf2adc78b, - 0x2db9a8b6, - 0x14c8a91e, - 0x578519f1, - 0xaf4c0775, - 0xeebbdd99, - 0xa3fd607f, - 0xf79f2601, - 0x5cbcf572, - 0x44c53b66, - 0x5b347efb, - 0x8b762943, - 0xcbdcc623, - 0xb668fced, - 0xb863f1e4, - 0xd7cadc31, - 0x42108563, - 0x13402297, - 0x842011c6, - 0x857d244a, - 0xd2f83dbb, - 0xae1132f9, - 0xc76da129, - 0x1d4b2f9e, - 0xdcf330b2, - 0x0dec5286, - 0x77d0e3c1, - 0x2b6c16b3, - 0xa999b970, - 0x11fa4894, - 0x472264e9, - 0xa8c48cfc, - 0xa01a3ff0, - 0x56d82c7d, - 0x22ef9033, - 0x87c74e49, - 0xd9c1d138, - 0x8cfea2ca, - 0x98360bd4, - 0xa6cf81f5, - 0xa528de7a, - 0xda268eb7, - 0x3fa4bfad, - 0x2ce49d3a, - 0x500d9278, - 0x6a9bcc5f, - 0x5462467e, - 0xf6c2138d, - 0x90e8b8d8, - 0x2e5ef739, - 0x82f5afc3, - 0x9fbe805d, - 0x697c93d0, - 0x6fa92dd5, - 0xcfb31225, - 0xc83b99ac, - 0x10a77d18, - 0xe86e639c, - 0xdb7bbb3b, - 0xcd097826, - 0x6ef41859, - 0xec01b79a, - 0x83a89a4f, - 0xe6656e95, - 0xaa7ee6ff, - 0x2108cfbc, - 0xefe6e815, - 0xbad99be7, - 0x4ace366f, - 0xead4099f, - 0x29d67cb0, - 0x31afb2a4, - 0x2a31233f, - 0xc63094a5, - 0x35c066a2, - 0x7437bc4e, - 0xfca6ca82, - 0xe0b0d090, - 0x3315d8a7, - 0xf14a9804, - 0x41f7daec, - 0x7f0e50cd, - 0x172ff691, - 0x768dd64d, - 0x434db0ef, - 0xcc544daa, - 0xe4df0496, - 0x9ee3b5d1, - 0x4c1b886a, - 0xc1b81f2c, - 0x467f5165, - 0x9d04ea5e, - 0x015d358c, - 0xfa737487, - 0xfb2e410b, - 0xb35a1d67, - 0x9252d2db, - 0xe9335610, - 0x6d1347d6, - 0x9a8c61d7, - 0x377a0ca1, - 0x598e14f8, - 0xeb893c13, - 0xceee27a9, - 0xb735c961, - 0xe1ede51c, - 0x7a3cb147, - 0x9c59dfd2, - 0x553f73f2, - 0x1879ce14, - 0x73bf37c7, - 0x53eacdf7, - 0x5f5baafd, - 0xdf146f3d, - 0x7886db44, - 0xca81f3af, - 0xb93ec468, - 0x382c3424, - 0xc25f40a3, - 0x1672c31d, - 0xbc0c25e2, - 0x288b493c, - 0xff41950d, - 0x397101a8, - 0x08deb30c, - 0xd89ce4b4, - 0x6490c156, - 0x7b6184cb, - 0xd570b632, - 0x48745c6c, - 0xd04257b8, - }, -}; - - -// SubBytes embedded in words tables. -const Word AESSubBytesWordTable[4][256] = -{ - { - 0x00000063, - 0x0000007c, - 0x00000077, - 0x0000007b, - 0x000000f2, - 0x0000006b, - 0x0000006f, - 0x000000c5, - 0x00000030, - 0x00000001, - 0x00000067, - 0x0000002b, - 0x000000fe, - 0x000000d7, - 0x000000ab, - 0x00000076, - 0x000000ca, - 0x00000082, - 0x000000c9, - 0x0000007d, - 0x000000fa, - 0x00000059, - 0x00000047, - 0x000000f0, - 0x000000ad, - 0x000000d4, - 0x000000a2, - 0x000000af, - 0x0000009c, - 0x000000a4, - 0x00000072, - 0x000000c0, - 0x000000b7, - 0x000000fd, - 0x00000093, - 0x00000026, - 0x00000036, - 0x0000003f, - 0x000000f7, - 0x000000cc, - 0x00000034, - 0x000000a5, - 0x000000e5, - 0x000000f1, - 0x00000071, - 0x000000d8, - 0x00000031, - 0x00000015, - 0x00000004, - 0x000000c7, - 0x00000023, - 0x000000c3, - 0x00000018, - 0x00000096, - 0x00000005, - 0x0000009a, - 0x00000007, - 0x00000012, - 0x00000080, - 0x000000e2, - 0x000000eb, - 0x00000027, - 0x000000b2, - 0x00000075, - 0x00000009, - 0x00000083, - 0x0000002c, - 0x0000001a, - 0x0000001b, - 0x0000006e, - 0x0000005a, - 0x000000a0, - 0x00000052, - 0x0000003b, - 0x000000d6, - 0x000000b3, - 0x00000029, - 0x000000e3, - 0x0000002f, - 0x00000084, - 0x00000053, - 0x000000d1, - 0x00000000, - 0x000000ed, - 0x00000020, - 0x000000fc, - 0x000000b1, - 0x0000005b, - 0x0000006a, - 0x000000cb, - 0x000000be, - 0x00000039, - 0x0000004a, - 0x0000004c, - 0x00000058, - 0x000000cf, - 0x000000d0, - 0x000000ef, - 0x000000aa, - 0x000000fb, - 0x00000043, - 0x0000004d, - 0x00000033, - 0x00000085, - 0x00000045, - 0x000000f9, - 0x00000002, - 0x0000007f, - 0x00000050, - 0x0000003c, - 0x0000009f, - 0x000000a8, - 0x00000051, - 0x000000a3, - 0x00000040, - 0x0000008f, - 0x00000092, - 0x0000009d, - 0x00000038, - 0x000000f5, - 0x000000bc, - 0x000000b6, - 0x000000da, - 0x00000021, - 0x00000010, - 0x000000ff, - 0x000000f3, - 0x000000d2, - 0x000000cd, - 0x0000000c, - 0x00000013, - 0x000000ec, - 0x0000005f, - 0x00000097, - 0x00000044, - 0x00000017, - 0x000000c4, - 0x000000a7, - 0x0000007e, - 0x0000003d, - 0x00000064, - 0x0000005d, - 0x00000019, - 0x00000073, - 0x00000060, - 0x00000081, - 0x0000004f, - 0x000000dc, - 0x00000022, - 0x0000002a, - 0x00000090, - 0x00000088, - 0x00000046, - 0x000000ee, - 0x000000b8, - 0x00000014, - 0x000000de, - 0x0000005e, - 0x0000000b, - 0x000000db, - 0x000000e0, - 0x00000032, - 0x0000003a, - 0x0000000a, - 0x00000049, - 0x00000006, - 0x00000024, - 0x0000005c, - 0x000000c2, - 0x000000d3, - 0x000000ac, - 0x00000062, - 0x00000091, - 0x00000095, - 0x000000e4, - 0x00000079, - 0x000000e7, - 0x000000c8, - 0x00000037, - 0x0000006d, - 0x0000008d, - 0x000000d5, - 0x0000004e, - 0x000000a9, - 0x0000006c, - 0x00000056, - 0x000000f4, - 0x000000ea, - 0x00000065, - 0x0000007a, - 0x000000ae, - 0x00000008, - 0x000000ba, - 0x00000078, - 0x00000025, - 0x0000002e, - 0x0000001c, - 0x000000a6, - 0x000000b4, - 0x000000c6, - 0x000000e8, - 0x000000dd, - 0x00000074, - 0x0000001f, - 0x0000004b, - 0x000000bd, - 0x0000008b, - 0x0000008a, - 0x00000070, - 0x0000003e, - 0x000000b5, - 0x00000066, - 0x00000048, - 0x00000003, - 0x000000f6, - 0x0000000e, - 0x00000061, - 0x00000035, - 0x00000057, - 0x000000b9, - 0x00000086, - 0x000000c1, - 0x0000001d, - 0x0000009e, - 0x000000e1, - 0x000000f8, - 0x00000098, - 0x00000011, - 0x00000069, - 0x000000d9, - 0x0000008e, - 0x00000094, - 0x0000009b, - 0x0000001e, - 0x00000087, - 0x000000e9, - 0x000000ce, - 0x00000055, - 0x00000028, - 0x000000df, - 0x0000008c, - 0x000000a1, - 0x00000089, - 0x0000000d, - 0x000000bf, - 0x000000e6, - 0x00000042, - 0x00000068, - 0x00000041, - 0x00000099, - 0x0000002d, - 0x0000000f, - 0x000000b0, - 0x00000054, - 0x000000bb, - 0x00000016, - }, - { - 0x00006300, - 0x00007c00, - 0x00007700, - 0x00007b00, - 0x0000f200, - 0x00006b00, - 0x00006f00, - 0x0000c500, - 0x00003000, - 0x00000100, - 0x00006700, - 0x00002b00, - 0x0000fe00, - 0x0000d700, - 0x0000ab00, - 0x00007600, - 0x0000ca00, - 0x00008200, - 0x0000c900, - 0x00007d00, - 0x0000fa00, - 0x00005900, - 0x00004700, - 0x0000f000, - 0x0000ad00, - 0x0000d400, - 0x0000a200, - 0x0000af00, - 0x00009c00, - 0x0000a400, - 0x00007200, - 0x0000c000, - 0x0000b700, - 0x0000fd00, - 0x00009300, - 0x00002600, - 0x00003600, - 0x00003f00, - 0x0000f700, - 0x0000cc00, - 0x00003400, - 0x0000a500, - 0x0000e500, - 0x0000f100, - 0x00007100, - 0x0000d800, - 0x00003100, - 0x00001500, - 0x00000400, - 0x0000c700, - 0x00002300, - 0x0000c300, - 0x00001800, - 0x00009600, - 0x00000500, - 0x00009a00, - 0x00000700, - 0x00001200, - 0x00008000, - 0x0000e200, - 0x0000eb00, - 0x00002700, - 0x0000b200, - 0x00007500, - 0x00000900, - 0x00008300, - 0x00002c00, - 0x00001a00, - 0x00001b00, - 0x00006e00, - 0x00005a00, - 0x0000a000, - 0x00005200, - 0x00003b00, - 0x0000d600, - 0x0000b300, - 0x00002900, - 0x0000e300, - 0x00002f00, - 0x00008400, - 0x00005300, - 0x0000d100, - 0x00000000, - 0x0000ed00, - 0x00002000, - 0x0000fc00, - 0x0000b100, - 0x00005b00, - 0x00006a00, - 0x0000cb00, - 0x0000be00, - 0x00003900, - 0x00004a00, - 0x00004c00, - 0x00005800, - 0x0000cf00, - 0x0000d000, - 0x0000ef00, - 0x0000aa00, - 0x0000fb00, - 0x00004300, - 0x00004d00, - 0x00003300, - 0x00008500, - 0x00004500, - 0x0000f900, - 0x00000200, - 0x00007f00, - 0x00005000, - 0x00003c00, - 0x00009f00, - 0x0000a800, - 0x00005100, - 0x0000a300, - 0x00004000, - 0x00008f00, - 0x00009200, - 0x00009d00, - 0x00003800, - 0x0000f500, - 0x0000bc00, - 0x0000b600, - 0x0000da00, - 0x00002100, - 0x00001000, - 0x0000ff00, - 0x0000f300, - 0x0000d200, - 0x0000cd00, - 0x00000c00, - 0x00001300, - 0x0000ec00, - 0x00005f00, - 0x00009700, - 0x00004400, - 0x00001700, - 0x0000c400, - 0x0000a700, - 0x00007e00, - 0x00003d00, - 0x00006400, - 0x00005d00, - 0x00001900, - 0x00007300, - 0x00006000, - 0x00008100, - 0x00004f00, - 0x0000dc00, - 0x00002200, - 0x00002a00, - 0x00009000, - 0x00008800, - 0x00004600, - 0x0000ee00, - 0x0000b800, - 0x00001400, - 0x0000de00, - 0x00005e00, - 0x00000b00, - 0x0000db00, - 0x0000e000, - 0x00003200, - 0x00003a00, - 0x00000a00, - 0x00004900, - 0x00000600, - 0x00002400, - 0x00005c00, - 0x0000c200, - 0x0000d300, - 0x0000ac00, - 0x00006200, - 0x00009100, - 0x00009500, - 0x0000e400, - 0x00007900, - 0x0000e700, - 0x0000c800, - 0x00003700, - 0x00006d00, - 0x00008d00, - 0x0000d500, - 0x00004e00, - 0x0000a900, - 0x00006c00, - 0x00005600, - 0x0000f400, - 0x0000ea00, - 0x00006500, - 0x00007a00, - 0x0000ae00, - 0x00000800, - 0x0000ba00, - 0x00007800, - 0x00002500, - 0x00002e00, - 0x00001c00, - 0x0000a600, - 0x0000b400, - 0x0000c600, - 0x0000e800, - 0x0000dd00, - 0x00007400, - 0x00001f00, - 0x00004b00, - 0x0000bd00, - 0x00008b00, - 0x00008a00, - 0x00007000, - 0x00003e00, - 0x0000b500, - 0x00006600, - 0x00004800, - 0x00000300, - 0x0000f600, - 0x00000e00, - 0x00006100, - 0x00003500, - 0x00005700, - 0x0000b900, - 0x00008600, - 0x0000c100, - 0x00001d00, - 0x00009e00, - 0x0000e100, - 0x0000f800, - 0x00009800, - 0x00001100, - 0x00006900, - 0x0000d900, - 0x00008e00, - 0x00009400, - 0x00009b00, - 0x00001e00, - 0x00008700, - 0x0000e900, - 0x0000ce00, - 0x00005500, - 0x00002800, - 0x0000df00, - 0x00008c00, - 0x0000a100, - 0x00008900, - 0x00000d00, - 0x0000bf00, - 0x0000e600, - 0x00004200, - 0x00006800, - 0x00004100, - 0x00009900, - 0x00002d00, - 0x00000f00, - 0x0000b000, - 0x00005400, - 0x0000bb00, - 0x00001600, - }, - { - 0x00630000, - 0x007c0000, - 0x00770000, - 0x007b0000, - 0x00f20000, - 0x006b0000, - 0x006f0000, - 0x00c50000, - 0x00300000, - 0x00010000, - 0x00670000, - 0x002b0000, - 0x00fe0000, - 0x00d70000, - 0x00ab0000, - 0x00760000, - 0x00ca0000, - 0x00820000, - 0x00c90000, - 0x007d0000, - 0x00fa0000, - 0x00590000, - 0x00470000, - 0x00f00000, - 0x00ad0000, - 0x00d40000, - 0x00a20000, - 0x00af0000, - 0x009c0000, - 0x00a40000, - 0x00720000, - 0x00c00000, - 0x00b70000, - 0x00fd0000, - 0x00930000, - 0x00260000, - 0x00360000, - 0x003f0000, - 0x00f70000, - 0x00cc0000, - 0x00340000, - 0x00a50000, - 0x00e50000, - 0x00f10000, - 0x00710000, - 0x00d80000, - 0x00310000, - 0x00150000, - 0x00040000, - 0x00c70000, - 0x00230000, - 0x00c30000, - 0x00180000, - 0x00960000, - 0x00050000, - 0x009a0000, - 0x00070000, - 0x00120000, - 0x00800000, - 0x00e20000, - 0x00eb0000, - 0x00270000, - 0x00b20000, - 0x00750000, - 0x00090000, - 0x00830000, - 0x002c0000, - 0x001a0000, - 0x001b0000, - 0x006e0000, - 0x005a0000, - 0x00a00000, - 0x00520000, - 0x003b0000, - 0x00d60000, - 0x00b30000, - 0x00290000, - 0x00e30000, - 0x002f0000, - 0x00840000, - 0x00530000, - 0x00d10000, - 0x00000000, - 0x00ed0000, - 0x00200000, - 0x00fc0000, - 0x00b10000, - 0x005b0000, - 0x006a0000, - 0x00cb0000, - 0x00be0000, - 0x00390000, - 0x004a0000, - 0x004c0000, - 0x00580000, - 0x00cf0000, - 0x00d00000, - 0x00ef0000, - 0x00aa0000, - 0x00fb0000, - 0x00430000, - 0x004d0000, - 0x00330000, - 0x00850000, - 0x00450000, - 0x00f90000, - 0x00020000, - 0x007f0000, - 0x00500000, - 0x003c0000, - 0x009f0000, - 0x00a80000, - 0x00510000, - 0x00a30000, - 0x00400000, - 0x008f0000, - 0x00920000, - 0x009d0000, - 0x00380000, - 0x00f50000, - 0x00bc0000, - 0x00b60000, - 0x00da0000, - 0x00210000, - 0x00100000, - 0x00ff0000, - 0x00f30000, - 0x00d20000, - 0x00cd0000, - 0x000c0000, - 0x00130000, - 0x00ec0000, - 0x005f0000, - 0x00970000, - 0x00440000, - 0x00170000, - 0x00c40000, - 0x00a70000, - 0x007e0000, - 0x003d0000, - 0x00640000, - 0x005d0000, - 0x00190000, - 0x00730000, - 0x00600000, - 0x00810000, - 0x004f0000, - 0x00dc0000, - 0x00220000, - 0x002a0000, - 0x00900000, - 0x00880000, - 0x00460000, - 0x00ee0000, - 0x00b80000, - 0x00140000, - 0x00de0000, - 0x005e0000, - 0x000b0000, - 0x00db0000, - 0x00e00000, - 0x00320000, - 0x003a0000, - 0x000a0000, - 0x00490000, - 0x00060000, - 0x00240000, - 0x005c0000, - 0x00c20000, - 0x00d30000, - 0x00ac0000, - 0x00620000, - 0x00910000, - 0x00950000, - 0x00e40000, - 0x00790000, - 0x00e70000, - 0x00c80000, - 0x00370000, - 0x006d0000, - 0x008d0000, - 0x00d50000, - 0x004e0000, - 0x00a90000, - 0x006c0000, - 0x00560000, - 0x00f40000, - 0x00ea0000, - 0x00650000, - 0x007a0000, - 0x00ae0000, - 0x00080000, - 0x00ba0000, - 0x00780000, - 0x00250000, - 0x002e0000, - 0x001c0000, - 0x00a60000, - 0x00b40000, - 0x00c60000, - 0x00e80000, - 0x00dd0000, - 0x00740000, - 0x001f0000, - 0x004b0000, - 0x00bd0000, - 0x008b0000, - 0x008a0000, - 0x00700000, - 0x003e0000, - 0x00b50000, - 0x00660000, - 0x00480000, - 0x00030000, - 0x00f60000, - 0x000e0000, - 0x00610000, - 0x00350000, - 0x00570000, - 0x00b90000, - 0x00860000, - 0x00c10000, - 0x001d0000, - 0x009e0000, - 0x00e10000, - 0x00f80000, - 0x00980000, - 0x00110000, - 0x00690000, - 0x00d90000, - 0x008e0000, - 0x00940000, - 0x009b0000, - 0x001e0000, - 0x00870000, - 0x00e90000, - 0x00ce0000, - 0x00550000, - 0x00280000, - 0x00df0000, - 0x008c0000, - 0x00a10000, - 0x00890000, - 0x000d0000, - 0x00bf0000, - 0x00e60000, - 0x00420000, - 0x00680000, - 0x00410000, - 0x00990000, - 0x002d0000, - 0x000f0000, - 0x00b00000, - 0x00540000, - 0x00bb0000, - 0x00160000, - }, - { - 0x63000000, - 0x7c000000, - 0x77000000, - 0x7b000000, - 0xf2000000, - 0x6b000000, - 0x6f000000, - 0xc5000000, - 0x30000000, - 0x01000000, - 0x67000000, - 0x2b000000, - 0xfe000000, - 0xd7000000, - 0xab000000, - 0x76000000, - 0xca000000, - 0x82000000, - 0xc9000000, - 0x7d000000, - 0xfa000000, - 0x59000000, - 0x47000000, - 0xf0000000, - 0xad000000, - 0xd4000000, - 0xa2000000, - 0xaf000000, - 0x9c000000, - 0xa4000000, - 0x72000000, - 0xc0000000, - 0xb7000000, - 0xfd000000, - 0x93000000, - 0x26000000, - 0x36000000, - 0x3f000000, - 0xf7000000, - 0xcc000000, - 0x34000000, - 0xa5000000, - 0xe5000000, - 0xf1000000, - 0x71000000, - 0xd8000000, - 0x31000000, - 0x15000000, - 0x04000000, - 0xc7000000, - 0x23000000, - 0xc3000000, - 0x18000000, - 0x96000000, - 0x05000000, - 0x9a000000, - 0x07000000, - 0x12000000, - 0x80000000, - 0xe2000000, - 0xeb000000, - 0x27000000, - 0xb2000000, - 0x75000000, - 0x09000000, - 0x83000000, - 0x2c000000, - 0x1a000000, - 0x1b000000, - 0x6e000000, - 0x5a000000, - 0xa0000000, - 0x52000000, - 0x3b000000, - 0xd6000000, - 0xb3000000, - 0x29000000, - 0xe3000000, - 0x2f000000, - 0x84000000, - 0x53000000, - 0xd1000000, - 0x00000000, - 0xed000000, - 0x20000000, - 0xfc000000, - 0xb1000000, - 0x5b000000, - 0x6a000000, - 0xcb000000, - 0xbe000000, - 0x39000000, - 0x4a000000, - 0x4c000000, - 0x58000000, - 0xcf000000, - 0xd0000000, - 0xef000000, - 0xaa000000, - 0xfb000000, - 0x43000000, - 0x4d000000, - 0x33000000, - 0x85000000, - 0x45000000, - 0xf9000000, - 0x02000000, - 0x7f000000, - 0x50000000, - 0x3c000000, - 0x9f000000, - 0xa8000000, - 0x51000000, - 0xa3000000, - 0x40000000, - 0x8f000000, - 0x92000000, - 0x9d000000, - 0x38000000, - 0xf5000000, - 0xbc000000, - 0xb6000000, - 0xda000000, - 0x21000000, - 0x10000000, - 0xff000000, - 0xf3000000, - 0xd2000000, - 0xcd000000, - 0x0c000000, - 0x13000000, - 0xec000000, - 0x5f000000, - 0x97000000, - 0x44000000, - 0x17000000, - 0xc4000000, - 0xa7000000, - 0x7e000000, - 0x3d000000, - 0x64000000, - 0x5d000000, - 0x19000000, - 0x73000000, - 0x60000000, - 0x81000000, - 0x4f000000, - 0xdc000000, - 0x22000000, - 0x2a000000, - 0x90000000, - 0x88000000, - 0x46000000, - 0xee000000, - 0xb8000000, - 0x14000000, - 0xde000000, - 0x5e000000, - 0x0b000000, - 0xdb000000, - 0xe0000000, - 0x32000000, - 0x3a000000, - 0x0a000000, - 0x49000000, - 0x06000000, - 0x24000000, - 0x5c000000, - 0xc2000000, - 0xd3000000, - 0xac000000, - 0x62000000, - 0x91000000, - 0x95000000, - 0xe4000000, - 0x79000000, - 0xe7000000, - 0xc8000000, - 0x37000000, - 0x6d000000, - 0x8d000000, - 0xd5000000, - 0x4e000000, - 0xa9000000, - 0x6c000000, - 0x56000000, - 0xf4000000, - 0xea000000, - 0x65000000, - 0x7a000000, - 0xae000000, - 0x08000000, - 0xba000000, - 0x78000000, - 0x25000000, - 0x2e000000, - 0x1c000000, - 0xa6000000, - 0xb4000000, - 0xc6000000, - 0xe8000000, - 0xdd000000, - 0x74000000, - 0x1f000000, - 0x4b000000, - 0xbd000000, - 0x8b000000, - 0x8a000000, - 0x70000000, - 0x3e000000, - 0xb5000000, - 0x66000000, - 0x48000000, - 0x03000000, - 0xf6000000, - 0x0e000000, - 0x61000000, - 0x35000000, - 0x57000000, - 0xb9000000, - 0x86000000, - 0xc1000000, - 0x1d000000, - 0x9e000000, - 0xe1000000, - 0xf8000000, - 0x98000000, - 0x11000000, - 0x69000000, - 0xd9000000, - 0x8e000000, - 0x94000000, - 0x9b000000, - 0x1e000000, - 0x87000000, - 0xe9000000, - 0xce000000, - 0x55000000, - 0x28000000, - 0xdf000000, - 0x8c000000, - 0xa1000000, - 0x89000000, - 0x0d000000, - 0xbf000000, - 0xe6000000, - 0x42000000, - 0x68000000, - 0x41000000, - 0x99000000, - 0x2d000000, - 0x0f000000, - 0xb0000000, - 0x54000000, - 0xbb000000, - 0x16000000, - }, -}; - - -// InvSubBytes embedded in words tables. -const Word AESInvSubBytesWordTable[4][256] = -{ - { - 0x00000052, - 0x00000009, - 0x0000006a, - 0x000000d5, - 0x00000030, - 0x00000036, - 0x000000a5, - 0x00000038, - 0x000000bf, - 0x00000040, - 0x000000a3, - 0x0000009e, - 0x00000081, - 0x000000f3, - 0x000000d7, - 0x000000fb, - 0x0000007c, - 0x000000e3, - 0x00000039, - 0x00000082, - 0x0000009b, - 0x0000002f, - 0x000000ff, - 0x00000087, - 0x00000034, - 0x0000008e, - 0x00000043, - 0x00000044, - 0x000000c4, - 0x000000de, - 0x000000e9, - 0x000000cb, - 0x00000054, - 0x0000007b, - 0x00000094, - 0x00000032, - 0x000000a6, - 0x000000c2, - 0x00000023, - 0x0000003d, - 0x000000ee, - 0x0000004c, - 0x00000095, - 0x0000000b, - 0x00000042, - 0x000000fa, - 0x000000c3, - 0x0000004e, - 0x00000008, - 0x0000002e, - 0x000000a1, - 0x00000066, - 0x00000028, - 0x000000d9, - 0x00000024, - 0x000000b2, - 0x00000076, - 0x0000005b, - 0x000000a2, - 0x00000049, - 0x0000006d, - 0x0000008b, - 0x000000d1, - 0x00000025, - 0x00000072, - 0x000000f8, - 0x000000f6, - 0x00000064, - 0x00000086, - 0x00000068, - 0x00000098, - 0x00000016, - 0x000000d4, - 0x000000a4, - 0x0000005c, - 0x000000cc, - 0x0000005d, - 0x00000065, - 0x000000b6, - 0x00000092, - 0x0000006c, - 0x00000070, - 0x00000048, - 0x00000050, - 0x000000fd, - 0x000000ed, - 0x000000b9, - 0x000000da, - 0x0000005e, - 0x00000015, - 0x00000046, - 0x00000057, - 0x000000a7, - 0x0000008d, - 0x0000009d, - 0x00000084, - 0x00000090, - 0x000000d8, - 0x000000ab, - 0x00000000, - 0x0000008c, - 0x000000bc, - 0x000000d3, - 0x0000000a, - 0x000000f7, - 0x000000e4, - 0x00000058, - 0x00000005, - 0x000000b8, - 0x000000b3, - 0x00000045, - 0x00000006, - 0x000000d0, - 0x0000002c, - 0x0000001e, - 0x0000008f, - 0x000000ca, - 0x0000003f, - 0x0000000f, - 0x00000002, - 0x000000c1, - 0x000000af, - 0x000000bd, - 0x00000003, - 0x00000001, - 0x00000013, - 0x0000008a, - 0x0000006b, - 0x0000003a, - 0x00000091, - 0x00000011, - 0x00000041, - 0x0000004f, - 0x00000067, - 0x000000dc, - 0x000000ea, - 0x00000097, - 0x000000f2, - 0x000000cf, - 0x000000ce, - 0x000000f0, - 0x000000b4, - 0x000000e6, - 0x00000073, - 0x00000096, - 0x000000ac, - 0x00000074, - 0x00000022, - 0x000000e7, - 0x000000ad, - 0x00000035, - 0x00000085, - 0x000000e2, - 0x000000f9, - 0x00000037, - 0x000000e8, - 0x0000001c, - 0x00000075, - 0x000000df, - 0x0000006e, - 0x00000047, - 0x000000f1, - 0x0000001a, - 0x00000071, - 0x0000001d, - 0x00000029, - 0x000000c5, - 0x00000089, - 0x0000006f, - 0x000000b7, - 0x00000062, - 0x0000000e, - 0x000000aa, - 0x00000018, - 0x000000be, - 0x0000001b, - 0x000000fc, - 0x00000056, - 0x0000003e, - 0x0000004b, - 0x000000c6, - 0x000000d2, - 0x00000079, - 0x00000020, - 0x0000009a, - 0x000000db, - 0x000000c0, - 0x000000fe, - 0x00000078, - 0x000000cd, - 0x0000005a, - 0x000000f4, - 0x0000001f, - 0x000000dd, - 0x000000a8, - 0x00000033, - 0x00000088, - 0x00000007, - 0x000000c7, - 0x00000031, - 0x000000b1, - 0x00000012, - 0x00000010, - 0x00000059, - 0x00000027, - 0x00000080, - 0x000000ec, - 0x0000005f, - 0x00000060, - 0x00000051, - 0x0000007f, - 0x000000a9, - 0x00000019, - 0x000000b5, - 0x0000004a, - 0x0000000d, - 0x0000002d, - 0x000000e5, - 0x0000007a, - 0x0000009f, - 0x00000093, - 0x000000c9, - 0x0000009c, - 0x000000ef, - 0x000000a0, - 0x000000e0, - 0x0000003b, - 0x0000004d, - 0x000000ae, - 0x0000002a, - 0x000000f5, - 0x000000b0, - 0x000000c8, - 0x000000eb, - 0x000000bb, - 0x0000003c, - 0x00000083, - 0x00000053, - 0x00000099, - 0x00000061, - 0x00000017, - 0x0000002b, - 0x00000004, - 0x0000007e, - 0x000000ba, - 0x00000077, - 0x000000d6, - 0x00000026, - 0x000000e1, - 0x00000069, - 0x00000014, - 0x00000063, - 0x00000055, - 0x00000021, - 0x0000000c, - 0x0000007d, - }, - { - 0x00005200, - 0x00000900, - 0x00006a00, - 0x0000d500, - 0x00003000, - 0x00003600, - 0x0000a500, - 0x00003800, - 0x0000bf00, - 0x00004000, - 0x0000a300, - 0x00009e00, - 0x00008100, - 0x0000f300, - 0x0000d700, - 0x0000fb00, - 0x00007c00, - 0x0000e300, - 0x00003900, - 0x00008200, - 0x00009b00, - 0x00002f00, - 0x0000ff00, - 0x00008700, - 0x00003400, - 0x00008e00, - 0x00004300, - 0x00004400, - 0x0000c400, - 0x0000de00, - 0x0000e900, - 0x0000cb00, - 0x00005400, - 0x00007b00, - 0x00009400, - 0x00003200, - 0x0000a600, - 0x0000c200, - 0x00002300, - 0x00003d00, - 0x0000ee00, - 0x00004c00, - 0x00009500, - 0x00000b00, - 0x00004200, - 0x0000fa00, - 0x0000c300, - 0x00004e00, - 0x00000800, - 0x00002e00, - 0x0000a100, - 0x00006600, - 0x00002800, - 0x0000d900, - 0x00002400, - 0x0000b200, - 0x00007600, - 0x00005b00, - 0x0000a200, - 0x00004900, - 0x00006d00, - 0x00008b00, - 0x0000d100, - 0x00002500, - 0x00007200, - 0x0000f800, - 0x0000f600, - 0x00006400, - 0x00008600, - 0x00006800, - 0x00009800, - 0x00001600, - 0x0000d400, - 0x0000a400, - 0x00005c00, - 0x0000cc00, - 0x00005d00, - 0x00006500, - 0x0000b600, - 0x00009200, - 0x00006c00, - 0x00007000, - 0x00004800, - 0x00005000, - 0x0000fd00, - 0x0000ed00, - 0x0000b900, - 0x0000da00, - 0x00005e00, - 0x00001500, - 0x00004600, - 0x00005700, - 0x0000a700, - 0x00008d00, - 0x00009d00, - 0x00008400, - 0x00009000, - 0x0000d800, - 0x0000ab00, - 0x00000000, - 0x00008c00, - 0x0000bc00, - 0x0000d300, - 0x00000a00, - 0x0000f700, - 0x0000e400, - 0x00005800, - 0x00000500, - 0x0000b800, - 0x0000b300, - 0x00004500, - 0x00000600, - 0x0000d000, - 0x00002c00, - 0x00001e00, - 0x00008f00, - 0x0000ca00, - 0x00003f00, - 0x00000f00, - 0x00000200, - 0x0000c100, - 0x0000af00, - 0x0000bd00, - 0x00000300, - 0x00000100, - 0x00001300, - 0x00008a00, - 0x00006b00, - 0x00003a00, - 0x00009100, - 0x00001100, - 0x00004100, - 0x00004f00, - 0x00006700, - 0x0000dc00, - 0x0000ea00, - 0x00009700, - 0x0000f200, - 0x0000cf00, - 0x0000ce00, - 0x0000f000, - 0x0000b400, - 0x0000e600, - 0x00007300, - 0x00009600, - 0x0000ac00, - 0x00007400, - 0x00002200, - 0x0000e700, - 0x0000ad00, - 0x00003500, - 0x00008500, - 0x0000e200, - 0x0000f900, - 0x00003700, - 0x0000e800, - 0x00001c00, - 0x00007500, - 0x0000df00, - 0x00006e00, - 0x00004700, - 0x0000f100, - 0x00001a00, - 0x00007100, - 0x00001d00, - 0x00002900, - 0x0000c500, - 0x00008900, - 0x00006f00, - 0x0000b700, - 0x00006200, - 0x00000e00, - 0x0000aa00, - 0x00001800, - 0x0000be00, - 0x00001b00, - 0x0000fc00, - 0x00005600, - 0x00003e00, - 0x00004b00, - 0x0000c600, - 0x0000d200, - 0x00007900, - 0x00002000, - 0x00009a00, - 0x0000db00, - 0x0000c000, - 0x0000fe00, - 0x00007800, - 0x0000cd00, - 0x00005a00, - 0x0000f400, - 0x00001f00, - 0x0000dd00, - 0x0000a800, - 0x00003300, - 0x00008800, - 0x00000700, - 0x0000c700, - 0x00003100, - 0x0000b100, - 0x00001200, - 0x00001000, - 0x00005900, - 0x00002700, - 0x00008000, - 0x0000ec00, - 0x00005f00, - 0x00006000, - 0x00005100, - 0x00007f00, - 0x0000a900, - 0x00001900, - 0x0000b500, - 0x00004a00, - 0x00000d00, - 0x00002d00, - 0x0000e500, - 0x00007a00, - 0x00009f00, - 0x00009300, - 0x0000c900, - 0x00009c00, - 0x0000ef00, - 0x0000a000, - 0x0000e000, - 0x00003b00, - 0x00004d00, - 0x0000ae00, - 0x00002a00, - 0x0000f500, - 0x0000b000, - 0x0000c800, - 0x0000eb00, - 0x0000bb00, - 0x00003c00, - 0x00008300, - 0x00005300, - 0x00009900, - 0x00006100, - 0x00001700, - 0x00002b00, - 0x00000400, - 0x00007e00, - 0x0000ba00, - 0x00007700, - 0x0000d600, - 0x00002600, - 0x0000e100, - 0x00006900, - 0x00001400, - 0x00006300, - 0x00005500, - 0x00002100, - 0x00000c00, - 0x00007d00, - }, - { - 0x00520000, - 0x00090000, - 0x006a0000, - 0x00d50000, - 0x00300000, - 0x00360000, - 0x00a50000, - 0x00380000, - 0x00bf0000, - 0x00400000, - 0x00a30000, - 0x009e0000, - 0x00810000, - 0x00f30000, - 0x00d70000, - 0x00fb0000, - 0x007c0000, - 0x00e30000, - 0x00390000, - 0x00820000, - 0x009b0000, - 0x002f0000, - 0x00ff0000, - 0x00870000, - 0x00340000, - 0x008e0000, - 0x00430000, - 0x00440000, - 0x00c40000, - 0x00de0000, - 0x00e90000, - 0x00cb0000, - 0x00540000, - 0x007b0000, - 0x00940000, - 0x00320000, - 0x00a60000, - 0x00c20000, - 0x00230000, - 0x003d0000, - 0x00ee0000, - 0x004c0000, - 0x00950000, - 0x000b0000, - 0x00420000, - 0x00fa0000, - 0x00c30000, - 0x004e0000, - 0x00080000, - 0x002e0000, - 0x00a10000, - 0x00660000, - 0x00280000, - 0x00d90000, - 0x00240000, - 0x00b20000, - 0x00760000, - 0x005b0000, - 0x00a20000, - 0x00490000, - 0x006d0000, - 0x008b0000, - 0x00d10000, - 0x00250000, - 0x00720000, - 0x00f80000, - 0x00f60000, - 0x00640000, - 0x00860000, - 0x00680000, - 0x00980000, - 0x00160000, - 0x00d40000, - 0x00a40000, - 0x005c0000, - 0x00cc0000, - 0x005d0000, - 0x00650000, - 0x00b60000, - 0x00920000, - 0x006c0000, - 0x00700000, - 0x00480000, - 0x00500000, - 0x00fd0000, - 0x00ed0000, - 0x00b90000, - 0x00da0000, - 0x005e0000, - 0x00150000, - 0x00460000, - 0x00570000, - 0x00a70000, - 0x008d0000, - 0x009d0000, - 0x00840000, - 0x00900000, - 0x00d80000, - 0x00ab0000, - 0x00000000, - 0x008c0000, - 0x00bc0000, - 0x00d30000, - 0x000a0000, - 0x00f70000, - 0x00e40000, - 0x00580000, - 0x00050000, - 0x00b80000, - 0x00b30000, - 0x00450000, - 0x00060000, - 0x00d00000, - 0x002c0000, - 0x001e0000, - 0x008f0000, - 0x00ca0000, - 0x003f0000, - 0x000f0000, - 0x00020000, - 0x00c10000, - 0x00af0000, - 0x00bd0000, - 0x00030000, - 0x00010000, - 0x00130000, - 0x008a0000, - 0x006b0000, - 0x003a0000, - 0x00910000, - 0x00110000, - 0x00410000, - 0x004f0000, - 0x00670000, - 0x00dc0000, - 0x00ea0000, - 0x00970000, - 0x00f20000, - 0x00cf0000, - 0x00ce0000, - 0x00f00000, - 0x00b40000, - 0x00e60000, - 0x00730000, - 0x00960000, - 0x00ac0000, - 0x00740000, - 0x00220000, - 0x00e70000, - 0x00ad0000, - 0x00350000, - 0x00850000, - 0x00e20000, - 0x00f90000, - 0x00370000, - 0x00e80000, - 0x001c0000, - 0x00750000, - 0x00df0000, - 0x006e0000, - 0x00470000, - 0x00f10000, - 0x001a0000, - 0x00710000, - 0x001d0000, - 0x00290000, - 0x00c50000, - 0x00890000, - 0x006f0000, - 0x00b70000, - 0x00620000, - 0x000e0000, - 0x00aa0000, - 0x00180000, - 0x00be0000, - 0x001b0000, - 0x00fc0000, - 0x00560000, - 0x003e0000, - 0x004b0000, - 0x00c60000, - 0x00d20000, - 0x00790000, - 0x00200000, - 0x009a0000, - 0x00db0000, - 0x00c00000, - 0x00fe0000, - 0x00780000, - 0x00cd0000, - 0x005a0000, - 0x00f40000, - 0x001f0000, - 0x00dd0000, - 0x00a80000, - 0x00330000, - 0x00880000, - 0x00070000, - 0x00c70000, - 0x00310000, - 0x00b10000, - 0x00120000, - 0x00100000, - 0x00590000, - 0x00270000, - 0x00800000, - 0x00ec0000, - 0x005f0000, - 0x00600000, - 0x00510000, - 0x007f0000, - 0x00a90000, - 0x00190000, - 0x00b50000, - 0x004a0000, - 0x000d0000, - 0x002d0000, - 0x00e50000, - 0x007a0000, - 0x009f0000, - 0x00930000, - 0x00c90000, - 0x009c0000, - 0x00ef0000, - 0x00a00000, - 0x00e00000, - 0x003b0000, - 0x004d0000, - 0x00ae0000, - 0x002a0000, - 0x00f50000, - 0x00b00000, - 0x00c80000, - 0x00eb0000, - 0x00bb0000, - 0x003c0000, - 0x00830000, - 0x00530000, - 0x00990000, - 0x00610000, - 0x00170000, - 0x002b0000, - 0x00040000, - 0x007e0000, - 0x00ba0000, - 0x00770000, - 0x00d60000, - 0x00260000, - 0x00e10000, - 0x00690000, - 0x00140000, - 0x00630000, - 0x00550000, - 0x00210000, - 0x000c0000, - 0x007d0000, - }, - { - 0x52000000, - 0x09000000, - 0x6a000000, - 0xd5000000, - 0x30000000, - 0x36000000, - 0xa5000000, - 0x38000000, - 0xbf000000, - 0x40000000, - 0xa3000000, - 0x9e000000, - 0x81000000, - 0xf3000000, - 0xd7000000, - 0xfb000000, - 0x7c000000, - 0xe3000000, - 0x39000000, - 0x82000000, - 0x9b000000, - 0x2f000000, - 0xff000000, - 0x87000000, - 0x34000000, - 0x8e000000, - 0x43000000, - 0x44000000, - 0xc4000000, - 0xde000000, - 0xe9000000, - 0xcb000000, - 0x54000000, - 0x7b000000, - 0x94000000, - 0x32000000, - 0xa6000000, - 0xc2000000, - 0x23000000, - 0x3d000000, - 0xee000000, - 0x4c000000, - 0x95000000, - 0x0b000000, - 0x42000000, - 0xfa000000, - 0xc3000000, - 0x4e000000, - 0x08000000, - 0x2e000000, - 0xa1000000, - 0x66000000, - 0x28000000, - 0xd9000000, - 0x24000000, - 0xb2000000, - 0x76000000, - 0x5b000000, - 0xa2000000, - 0x49000000, - 0x6d000000, - 0x8b000000, - 0xd1000000, - 0x25000000, - 0x72000000, - 0xf8000000, - 0xf6000000, - 0x64000000, - 0x86000000, - 0x68000000, - 0x98000000, - 0x16000000, - 0xd4000000, - 0xa4000000, - 0x5c000000, - 0xcc000000, - 0x5d000000, - 0x65000000, - 0xb6000000, - 0x92000000, - 0x6c000000, - 0x70000000, - 0x48000000, - 0x50000000, - 0xfd000000, - 0xed000000, - 0xb9000000, - 0xda000000, - 0x5e000000, - 0x15000000, - 0x46000000, - 0x57000000, - 0xa7000000, - 0x8d000000, - 0x9d000000, - 0x84000000, - 0x90000000, - 0xd8000000, - 0xab000000, - 0x00000000, - 0x8c000000, - 0xbc000000, - 0xd3000000, - 0x0a000000, - 0xf7000000, - 0xe4000000, - 0x58000000, - 0x05000000, - 0xb8000000, - 0xb3000000, - 0x45000000, - 0x06000000, - 0xd0000000, - 0x2c000000, - 0x1e000000, - 0x8f000000, - 0xca000000, - 0x3f000000, - 0x0f000000, - 0x02000000, - 0xc1000000, - 0xaf000000, - 0xbd000000, - 0x03000000, - 0x01000000, - 0x13000000, - 0x8a000000, - 0x6b000000, - 0x3a000000, - 0x91000000, - 0x11000000, - 0x41000000, - 0x4f000000, - 0x67000000, - 0xdc000000, - 0xea000000, - 0x97000000, - 0xf2000000, - 0xcf000000, - 0xce000000, - 0xf0000000, - 0xb4000000, - 0xe6000000, - 0x73000000, - 0x96000000, - 0xac000000, - 0x74000000, - 0x22000000, - 0xe7000000, - 0xad000000, - 0x35000000, - 0x85000000, - 0xe2000000, - 0xf9000000, - 0x37000000, - 0xe8000000, - 0x1c000000, - 0x75000000, - 0xdf000000, - 0x6e000000, - 0x47000000, - 0xf1000000, - 0x1a000000, - 0x71000000, - 0x1d000000, - 0x29000000, - 0xc5000000, - 0x89000000, - 0x6f000000, - 0xb7000000, - 0x62000000, - 0x0e000000, - 0xaa000000, - 0x18000000, - 0xbe000000, - 0x1b000000, - 0xfc000000, - 0x56000000, - 0x3e000000, - 0x4b000000, - 0xc6000000, - 0xd2000000, - 0x79000000, - 0x20000000, - 0x9a000000, - 0xdb000000, - 0xc0000000, - 0xfe000000, - 0x78000000, - 0xcd000000, - 0x5a000000, - 0xf4000000, - 0x1f000000, - 0xdd000000, - 0xa8000000, - 0x33000000, - 0x88000000, - 0x07000000, - 0xc7000000, - 0x31000000, - 0xb1000000, - 0x12000000, - 0x10000000, - 0x59000000, - 0x27000000, - 0x80000000, - 0xec000000, - 0x5f000000, - 0x60000000, - 0x51000000, - 0x7f000000, - 0xa9000000, - 0x19000000, - 0xb5000000, - 0x4a000000, - 0x0d000000, - 0x2d000000, - 0xe5000000, - 0x7a000000, - 0x9f000000, - 0x93000000, - 0xc9000000, - 0x9c000000, - 0xef000000, - 0xa0000000, - 0xe0000000, - 0x3b000000, - 0x4d000000, - 0xae000000, - 0x2a000000, - 0xf5000000, - 0xb0000000, - 0xc8000000, - 0xeb000000, - 0xbb000000, - 0x3c000000, - 0x83000000, - 0x53000000, - 0x99000000, - 0x61000000, - 0x17000000, - 0x2b000000, - 0x04000000, - 0x7e000000, - 0xba000000, - 0x77000000, - 0xd6000000, - 0x26000000, - 0xe1000000, - 0x69000000, - 0x14000000, - 0x63000000, - 0x55000000, - 0x21000000, - 0x0c000000, - 0x7d000000, - }, -}; DELETED Source/AESedp/Intel/AES.s Index: Source/AESedp/Intel/AES.s ================================================================== --- Source/AESedp/Intel/AES.s +++ /dev/null @@ -1,136 +0,0 @@ -#include "../AESAssembly.h" - - -// Generate object code only if this implementation has been requested. -#if defined UseAESedp_IntelAssembly - - -/* AES.s -- Core AES routines for Intel processors. - - Written by Eric Postpischil, December 13, 2007. -*/ - - -/* We build these AES routines as a single module because the routines refer - to labels in Data.s and it is easier and faster to refer to them as local - labels. - - A local label can be referred to with position-independent assembler - expressions such as "label-base(register)", where is a local label - whose address has been loaded into . (On i386, this is typically - done with the idiom of a call to the next instrution and a pop of that - return address into a register.) Without local labels, the references must - be done using spaces for addresses "lazy symbols" that are filled in by the - dynamic loader and loaded by the code that wants the address. - - So the various routines in other files are assembled here via #include - directives. -*/ -#include "Data.s" - - -#define TableSize (256*4) - /* Each of the arrays defined in Data.s except for the round constants - in _AESRcon is composed of four tables of 256 entries of four bytes - each. TableSize is the number of bytes in one of those four tables. - */ - - -/* Define a macro to select a value based on architecture. This reduces - some of the architecture conditionalization later in the source. -*/ -#if defined __i386__ - #define Arch(i386, x86_64) i386 -#elif defined __x86_64__ - #define Arch(i386, x86_64) x86_64 -#endif - - -// Define an instruction for moving pointers. -#define movp Arch(movd, movd) - // Latter argument should be "movq", but the assembler uses "movd". - - -/* Rename the general registers. This makes it easier to keep track of them - and provides names for the "whole register" that are uniform between i386 - and x86_64. -*/ -#if defined __i386__ - #define r0 %eax // Available for any use. - #define r1 %ecx // Available for any use, some special purposes (loop). - #define r2 %edx // Available for any use. - #define r3 %ebx // Must be preserved by called routine. - #define r4 %esp // Stack pointer. - #define r5 %ebp // Frame pointer, must preserve, no bare indirect. - #define r6 %esi // Must be preserved by called routine. - #define r7 %edi // Must be preserved by called routine. -#elif defined __x86_64__ - #define r0 %rax // Available for any use. - #define r1 %rcx // Available for any use. - #define r2 %rdx // Available for any use. - #define r3 %rbx // Must be preserved by called routine. - #define r4 %rsp // Stack pointer. - #define r5 %rbp // Frame pointer. Must be preserved by called routine. - #define r6 %rsi // Available for any use. - #define r7 %rdi // Available for any use. - #define r8 %r8 // Available for any use. - #define r9 %r9 // Available for any use. - #define r10 %r10 // Available for any use. - #define r11 %r11 // Available for any use. - #define r12 %r12 // Must be preserved by called routine. - #define r13 %r13 // Must be preserved by called routine. - #define r14 %r14 // Must be preserved by called routine. - #define r15 %r15 // Must be preserved by called routine. -#else - #error "Unknown architecture." -#endif - -// Define names for parts of registers. - -#define r0d %eax // Low 32 bits of r0. -#define r1d %ecx // Low 32 bits of r1. -#define r2d %edx // Low 32 bits of r2. -#define r3d %ebx // Low 32 bits of r3. -#define r5d %ebp // Low 32 bits of r5. -#define r6d %esi // Low 32 bits of r6. -#define r7d %edi // Low 32 bits of r7. -#define r8d %r8d // Low 32 bits of r8. -#define r9d %r9d // Low 32 bits of r9. -#define r11d %r11d // Low 32 bits of r11. - -#define r0l %al // Low byte of r0. -#define r1l %cl // Low byte of r1. -#define r2l %dl // Low byte of r2. -#define r3l %bl // Low byte of r3. -#define r5l %bpl // Low byte of r5. - -#define r0h %ah // Second lowest byte of r0. -#define r1h %ch // Second lowest byte of r1. -#define r2h %dh // Second lowest byte of r2. -#define r3h %bh // Second lowest byte of r3. - - - .text - - -// Define encryption routine, _AESEncryptWithExpandedKey -#define Select 0 -#include "EncryptDecrypt.s" -#undef Select - - -// Define decryption routine, _AESDecryptWithExpandedKey -#define Select 1 -#include "EncryptDecrypt.s" -#undef Select - - -// Define key expansion routine for encryption, _AESExpandKeyForEncryption. -#include "ExpandKeyForEncryption.s" - - -// Define key expansion for decryption routine, _AESExpandKeyForDecryption. -#include "ExpandKeyForDecryption.s" - - -#endif // defined UseAESedp_IntelAssembly DELETED Source/AESedp/Intel/Data.s Index: Source/AESedp/Intel/Data.s ================================================================== --- Source/AESedp/Intel/Data.s +++ /dev/null @@ -1,5196 +0,0 @@ -// This file was generated by MakeData.c. - - - .const - - -// Round constants. - .globl _OLDAESRcon - .private_extern _OLDAESRcon -_OLDAESRcon: - .byte 0 // Not used, included for indexing simplicity. - .byte 0x01 - .byte 0x02 - .byte 0x04 - .byte 0x08 - .byte 0x10 - .byte 0x20 - .byte 0x40 - .byte 0x80 - .byte 0x1b - .byte 0x36 - - -// Tables for InvMixColumn. - .globl _OLDAESInvMixColumnTable - .private_extern _OLDAESInvMixColumnTable - .align 2 -_OLDAESInvMixColumnTable: - // Table 0. - .long 0x00000000 - .long 0x0b0d090e - .long 0x161a121c - .long 0x1d171b12 - .long 0x2c342438 - .long 0x27392d36 - .long 0x3a2e3624 - .long 0x31233f2a - .long 0x58684870 - .long 0x5365417e - .long 0x4e725a6c - .long 0x457f5362 - .long 0x745c6c48 - .long 0x7f516546 - .long 0x62467e54 - .long 0x694b775a - .long 0xb0d090e0 - .long 0xbbdd99ee - .long 0xa6ca82fc - .long 0xadc78bf2 - .long 0x9ce4b4d8 - .long 0x97e9bdd6 - .long 0x8afea6c4 - .long 0x81f3afca - .long 0xe8b8d890 - .long 0xe3b5d19e - .long 0xfea2ca8c - .long 0xf5afc382 - .long 0xc48cfca8 - .long 0xcf81f5a6 - .long 0xd296eeb4 - .long 0xd99be7ba - .long 0x7bbb3bdb - .long 0x70b632d5 - .long 0x6da129c7 - .long 0x66ac20c9 - .long 0x578f1fe3 - .long 0x5c8216ed - .long 0x41950dff - .long 0x4a9804f1 - .long 0x23d373ab - .long 0x28de7aa5 - .long 0x35c961b7 - .long 0x3ec468b9 - .long 0x0fe75793 - .long 0x04ea5e9d - .long 0x19fd458f - .long 0x12f04c81 - .long 0xcb6bab3b - .long 0xc066a235 - .long 0xdd71b927 - .long 0xd67cb029 - .long 0xe75f8f03 - .long 0xec52860d - .long 0xf1459d1f - .long 0xfa489411 - .long 0x9303e34b - .long 0x980eea45 - .long 0x8519f157 - .long 0x8e14f859 - .long 0xbf37c773 - .long 0xb43ace7d - .long 0xa92dd56f - .long 0xa220dc61 - .long 0xf66d76ad - .long 0xfd607fa3 - .long 0xe07764b1 - .long 0xeb7a6dbf - .long 0xda595295 - .long 0xd1545b9b - .long 0xcc434089 - .long 0xc74e4987 - .long 0xae053edd - .long 0xa50837d3 - .long 0xb81f2cc1 - .long 0xb31225cf - .long 0x82311ae5 - .long 0x893c13eb - .long 0x942b08f9 - .long 0x9f2601f7 - .long 0x46bde64d - .long 0x4db0ef43 - .long 0x50a7f451 - .long 0x5baafd5f - .long 0x6a89c275 - .long 0x6184cb7b - .long 0x7c93d069 - .long 0x779ed967 - .long 0x1ed5ae3d - .long 0x15d8a733 - .long 0x08cfbc21 - .long 0x03c2b52f - .long 0x32e18a05 - .long 0x39ec830b - .long 0x24fb9819 - .long 0x2ff69117 - .long 0x8dd64d76 - .long 0x86db4478 - .long 0x9bcc5f6a - .long 0x90c15664 - .long 0xa1e2694e - .long 0xaaef6040 - .long 0xb7f87b52 - .long 0xbcf5725c - .long 0xd5be0506 - .long 0xdeb30c08 - .long 0xc3a4171a - .long 0xc8a91e14 - .long 0xf98a213e - .long 0xf2872830 - .long 0xef903322 - .long 0xe49d3a2c - .long 0x3d06dd96 - .long 0x360bd498 - .long 0x2b1ccf8a - .long 0x2011c684 - .long 0x1132f9ae - .long 0x1a3ff0a0 - .long 0x0728ebb2 - .long 0x0c25e2bc - .long 0x656e95e6 - .long 0x6e639ce8 - .long 0x737487fa - .long 0x78798ef4 - .long 0x495ab1de - .long 0x4257b8d0 - .long 0x5f40a3c2 - .long 0x544daacc - .long 0xf7daec41 - .long 0xfcd7e54f - .long 0xe1c0fe5d - .long 0xeacdf753 - .long 0xdbeec879 - .long 0xd0e3c177 - .long 0xcdf4da65 - .long 0xc6f9d36b - .long 0xafb2a431 - .long 0xa4bfad3f - .long 0xb9a8b62d - .long 0xb2a5bf23 - .long 0x83868009 - .long 0x888b8907 - .long 0x959c9215 - .long 0x9e919b1b - .long 0x470a7ca1 - .long 0x4c0775af - .long 0x51106ebd - .long 0x5a1d67b3 - .long 0x6b3e5899 - .long 0x60335197 - .long 0x7d244a85 - .long 0x7629438b - .long 0x1f6234d1 - .long 0x146f3ddf - .long 0x097826cd - .long 0x02752fc3 - .long 0x335610e9 - .long 0x385b19e7 - .long 0x254c02f5 - .long 0x2e410bfb - .long 0x8c61d79a - .long 0x876cde94 - .long 0x9a7bc586 - .long 0x9176cc88 - .long 0xa055f3a2 - .long 0xab58faac - .long 0xb64fe1be - .long 0xbd42e8b0 - .long 0xd4099fea - .long 0xdf0496e4 - .long 0xc2138df6 - .long 0xc91e84f8 - .long 0xf83dbbd2 - .long 0xf330b2dc - .long 0xee27a9ce - .long 0xe52aa0c0 - .long 0x3cb1477a - .long 0x37bc4e74 - .long 0x2aab5566 - .long 0x21a65c68 - .long 0x10856342 - .long 0x1b886a4c - .long 0x069f715e - .long 0x0d927850 - .long 0x64d90f0a - .long 0x6fd40604 - .long 0x72c31d16 - .long 0x79ce1418 - .long 0x48ed2b32 - .long 0x43e0223c - .long 0x5ef7392e - .long 0x55fa3020 - .long 0x01b79aec - .long 0x0aba93e2 - .long 0x17ad88f0 - .long 0x1ca081fe - .long 0x2d83bed4 - .long 0x268eb7da - .long 0x3b99acc8 - .long 0x3094a5c6 - .long 0x59dfd29c - .long 0x52d2db92 - .long 0x4fc5c080 - .long 0x44c8c98e - .long 0x75ebf6a4 - .long 0x7ee6ffaa - .long 0x63f1e4b8 - .long 0x68fcedb6 - .long 0xb1670a0c - .long 0xba6a0302 - .long 0xa77d1810 - .long 0xac70111e - .long 0x9d532e34 - .long 0x965e273a - .long 0x8b493c28 - .long 0x80443526 - .long 0xe90f427c - .long 0xe2024b72 - .long 0xff155060 - .long 0xf418596e - .long 0xc53b6644 - .long 0xce366f4a - .long 0xd3217458 - .long 0xd82c7d56 - .long 0x7a0ca137 - .long 0x7101a839 - .long 0x6c16b32b - .long 0x671bba25 - .long 0x5638850f - .long 0x5d358c01 - .long 0x40229713 - .long 0x4b2f9e1d - .long 0x2264e947 - .long 0x2969e049 - .long 0x347efb5b - .long 0x3f73f255 - .long 0x0e50cd7f - .long 0x055dc471 - .long 0x184adf63 - .long 0x1347d66d - .long 0xcadc31d7 - .long 0xc1d138d9 - .long 0xdcc623cb - .long 0xd7cb2ac5 - .long 0xe6e815ef - .long 0xede51ce1 - .long 0xf0f207f3 - .long 0xfbff0efd - .long 0x92b479a7 - .long 0x99b970a9 - .long 0x84ae6bbb - .long 0x8fa362b5 - .long 0xbe805d9f - .long 0xb58d5491 - .long 0xa89a4f83 - .long 0xa397468d - // Table 1. - .long 0x00000000 - .long 0x0d090e0b - .long 0x1a121c16 - .long 0x171b121d - .long 0x3424382c - .long 0x392d3627 - .long 0x2e36243a - .long 0x233f2a31 - .long 0x68487058 - .long 0x65417e53 - .long 0x725a6c4e - .long 0x7f536245 - .long 0x5c6c4874 - .long 0x5165467f - .long 0x467e5462 - .long 0x4b775a69 - .long 0xd090e0b0 - .long 0xdd99eebb - .long 0xca82fca6 - .long 0xc78bf2ad - .long 0xe4b4d89c - .long 0xe9bdd697 - .long 0xfea6c48a - .long 0xf3afca81 - .long 0xb8d890e8 - .long 0xb5d19ee3 - .long 0xa2ca8cfe - .long 0xafc382f5 - .long 0x8cfca8c4 - .long 0x81f5a6cf - .long 0x96eeb4d2 - .long 0x9be7bad9 - .long 0xbb3bdb7b - .long 0xb632d570 - .long 0xa129c76d - .long 0xac20c966 - .long 0x8f1fe357 - .long 0x8216ed5c - .long 0x950dff41 - .long 0x9804f14a - .long 0xd373ab23 - .long 0xde7aa528 - .long 0xc961b735 - .long 0xc468b93e - .long 0xe757930f - .long 0xea5e9d04 - .long 0xfd458f19 - .long 0xf04c8112 - .long 0x6bab3bcb - .long 0x66a235c0 - .long 0x71b927dd - .long 0x7cb029d6 - .long 0x5f8f03e7 - .long 0x52860dec - .long 0x459d1ff1 - .long 0x489411fa - .long 0x03e34b93 - .long 0x0eea4598 - .long 0x19f15785 - .long 0x14f8598e - .long 0x37c773bf - .long 0x3ace7db4 - .long 0x2dd56fa9 - .long 0x20dc61a2 - .long 0x6d76adf6 - .long 0x607fa3fd - .long 0x7764b1e0 - .long 0x7a6dbfeb - .long 0x595295da - .long 0x545b9bd1 - .long 0x434089cc - .long 0x4e4987c7 - .long 0x053eddae - .long 0x0837d3a5 - .long 0x1f2cc1b8 - .long 0x1225cfb3 - .long 0x311ae582 - .long 0x3c13eb89 - .long 0x2b08f994 - .long 0x2601f79f - .long 0xbde64d46 - .long 0xb0ef434d - .long 0xa7f45150 - .long 0xaafd5f5b - .long 0x89c2756a - .long 0x84cb7b61 - .long 0x93d0697c - .long 0x9ed96777 - .long 0xd5ae3d1e - .long 0xd8a73315 - .long 0xcfbc2108 - .long 0xc2b52f03 - .long 0xe18a0532 - .long 0xec830b39 - .long 0xfb981924 - .long 0xf691172f - .long 0xd64d768d - .long 0xdb447886 - .long 0xcc5f6a9b - .long 0xc1566490 - .long 0xe2694ea1 - .long 0xef6040aa - .long 0xf87b52b7 - .long 0xf5725cbc - .long 0xbe0506d5 - .long 0xb30c08de - .long 0xa4171ac3 - .long 0xa91e14c8 - .long 0x8a213ef9 - .long 0x872830f2 - .long 0x903322ef - .long 0x9d3a2ce4 - .long 0x06dd963d - .long 0x0bd49836 - .long 0x1ccf8a2b - .long 0x11c68420 - .long 0x32f9ae11 - .long 0x3ff0a01a - .long 0x28ebb207 - .long 0x25e2bc0c - .long 0x6e95e665 - .long 0x639ce86e - .long 0x7487fa73 - .long 0x798ef478 - .long 0x5ab1de49 - .long 0x57b8d042 - .long 0x40a3c25f - .long 0x4daacc54 - .long 0xdaec41f7 - .long 0xd7e54ffc - .long 0xc0fe5de1 - .long 0xcdf753ea - .long 0xeec879db - .long 0xe3c177d0 - .long 0xf4da65cd - .long 0xf9d36bc6 - .long 0xb2a431af - .long 0xbfad3fa4 - .long 0xa8b62db9 - .long 0xa5bf23b2 - .long 0x86800983 - .long 0x8b890788 - .long 0x9c921595 - .long 0x919b1b9e - .long 0x0a7ca147 - .long 0x0775af4c - .long 0x106ebd51 - .long 0x1d67b35a - .long 0x3e58996b - .long 0x33519760 - .long 0x244a857d - .long 0x29438b76 - .long 0x6234d11f - .long 0x6f3ddf14 - .long 0x7826cd09 - .long 0x752fc302 - .long 0x5610e933 - .long 0x5b19e738 - .long 0x4c02f525 - .long 0x410bfb2e - .long 0x61d79a8c - .long 0x6cde9487 - .long 0x7bc5869a - .long 0x76cc8891 - .long 0x55f3a2a0 - .long 0x58faacab - .long 0x4fe1beb6 - .long 0x42e8b0bd - .long 0x099fead4 - .long 0x0496e4df - .long 0x138df6c2 - .long 0x1e84f8c9 - .long 0x3dbbd2f8 - .long 0x30b2dcf3 - .long 0x27a9ceee - .long 0x2aa0c0e5 - .long 0xb1477a3c - .long 0xbc4e7437 - .long 0xab55662a - .long 0xa65c6821 - .long 0x85634210 - .long 0x886a4c1b - .long 0x9f715e06 - .long 0x9278500d - .long 0xd90f0a64 - .long 0xd406046f - .long 0xc31d1672 - .long 0xce141879 - .long 0xed2b3248 - .long 0xe0223c43 - .long 0xf7392e5e - .long 0xfa302055 - .long 0xb79aec01 - .long 0xba93e20a - .long 0xad88f017 - .long 0xa081fe1c - .long 0x83bed42d - .long 0x8eb7da26 - .long 0x99acc83b - .long 0x94a5c630 - .long 0xdfd29c59 - .long 0xd2db9252 - .long 0xc5c0804f - .long 0xc8c98e44 - .long 0xebf6a475 - .long 0xe6ffaa7e - .long 0xf1e4b863 - .long 0xfcedb668 - .long 0x670a0cb1 - .long 0x6a0302ba - .long 0x7d1810a7 - .long 0x70111eac - .long 0x532e349d - .long 0x5e273a96 - .long 0x493c288b - .long 0x44352680 - .long 0x0f427ce9 - .long 0x024b72e2 - .long 0x155060ff - .long 0x18596ef4 - .long 0x3b6644c5 - .long 0x366f4ace - .long 0x217458d3 - .long 0x2c7d56d8 - .long 0x0ca1377a - .long 0x01a83971 - .long 0x16b32b6c - .long 0x1bba2567 - .long 0x38850f56 - .long 0x358c015d - .long 0x22971340 - .long 0x2f9e1d4b - .long 0x64e94722 - .long 0x69e04929 - .long 0x7efb5b34 - .long 0x73f2553f - .long 0x50cd7f0e - .long 0x5dc47105 - .long 0x4adf6318 - .long 0x47d66d13 - .long 0xdc31d7ca - .long 0xd138d9c1 - .long 0xc623cbdc - .long 0xcb2ac5d7 - .long 0xe815efe6 - .long 0xe51ce1ed - .long 0xf207f3f0 - .long 0xff0efdfb - .long 0xb479a792 - .long 0xb970a999 - .long 0xae6bbb84 - .long 0xa362b58f - .long 0x805d9fbe - .long 0x8d5491b5 - .long 0x9a4f83a8 - .long 0x97468da3 - // Table 2. - .long 0x00000000 - .long 0x090e0b0d - .long 0x121c161a - .long 0x1b121d17 - .long 0x24382c34 - .long 0x2d362739 - .long 0x36243a2e - .long 0x3f2a3123 - .long 0x48705868 - .long 0x417e5365 - .long 0x5a6c4e72 - .long 0x5362457f - .long 0x6c48745c - .long 0x65467f51 - .long 0x7e546246 - .long 0x775a694b - .long 0x90e0b0d0 - .long 0x99eebbdd - .long 0x82fca6ca - .long 0x8bf2adc7 - .long 0xb4d89ce4 - .long 0xbdd697e9 - .long 0xa6c48afe - .long 0xafca81f3 - .long 0xd890e8b8 - .long 0xd19ee3b5 - .long 0xca8cfea2 - .long 0xc382f5af - .long 0xfca8c48c - .long 0xf5a6cf81 - .long 0xeeb4d296 - .long 0xe7bad99b - .long 0x3bdb7bbb - .long 0x32d570b6 - .long 0x29c76da1 - .long 0x20c966ac - .long 0x1fe3578f - .long 0x16ed5c82 - .long 0x0dff4195 - .long 0x04f14a98 - .long 0x73ab23d3 - .long 0x7aa528de - .long 0x61b735c9 - .long 0x68b93ec4 - .long 0x57930fe7 - .long 0x5e9d04ea - .long 0x458f19fd - .long 0x4c8112f0 - .long 0xab3bcb6b - .long 0xa235c066 - .long 0xb927dd71 - .long 0xb029d67c - .long 0x8f03e75f - .long 0x860dec52 - .long 0x9d1ff145 - .long 0x9411fa48 - .long 0xe34b9303 - .long 0xea45980e - .long 0xf1578519 - .long 0xf8598e14 - .long 0xc773bf37 - .long 0xce7db43a - .long 0xd56fa92d - .long 0xdc61a220 - .long 0x76adf66d - .long 0x7fa3fd60 - .long 0x64b1e077 - .long 0x6dbfeb7a - .long 0x5295da59 - .long 0x5b9bd154 - .long 0x4089cc43 - .long 0x4987c74e - .long 0x3eddae05 - .long 0x37d3a508 - .long 0x2cc1b81f - .long 0x25cfb312 - .long 0x1ae58231 - .long 0x13eb893c - .long 0x08f9942b - .long 0x01f79f26 - .long 0xe64d46bd - .long 0xef434db0 - .long 0xf45150a7 - .long 0xfd5f5baa - .long 0xc2756a89 - .long 0xcb7b6184 - .long 0xd0697c93 - .long 0xd967779e - .long 0xae3d1ed5 - .long 0xa73315d8 - .long 0xbc2108cf - .long 0xb52f03c2 - .long 0x8a0532e1 - .long 0x830b39ec - .long 0x981924fb - .long 0x91172ff6 - .long 0x4d768dd6 - .long 0x447886db - .long 0x5f6a9bcc - .long 0x566490c1 - .long 0x694ea1e2 - .long 0x6040aaef - .long 0x7b52b7f8 - .long 0x725cbcf5 - .long 0x0506d5be - .long 0x0c08deb3 - .long 0x171ac3a4 - .long 0x1e14c8a9 - .long 0x213ef98a - .long 0x2830f287 - .long 0x3322ef90 - .long 0x3a2ce49d - .long 0xdd963d06 - .long 0xd498360b - .long 0xcf8a2b1c - .long 0xc6842011 - .long 0xf9ae1132 - .long 0xf0a01a3f - .long 0xebb20728 - .long 0xe2bc0c25 - .long 0x95e6656e - .long 0x9ce86e63 - .long 0x87fa7374 - .long 0x8ef47879 - .long 0xb1de495a - .long 0xb8d04257 - .long 0xa3c25f40 - .long 0xaacc544d - .long 0xec41f7da - .long 0xe54ffcd7 - .long 0xfe5de1c0 - .long 0xf753eacd - .long 0xc879dbee - .long 0xc177d0e3 - .long 0xda65cdf4 - .long 0xd36bc6f9 - .long 0xa431afb2 - .long 0xad3fa4bf - .long 0xb62db9a8 - .long 0xbf23b2a5 - .long 0x80098386 - .long 0x8907888b - .long 0x9215959c - .long 0x9b1b9e91 - .long 0x7ca1470a - .long 0x75af4c07 - .long 0x6ebd5110 - .long 0x67b35a1d - .long 0x58996b3e - .long 0x51976033 - .long 0x4a857d24 - .long 0x438b7629 - .long 0x34d11f62 - .long 0x3ddf146f - .long 0x26cd0978 - .long 0x2fc30275 - .long 0x10e93356 - .long 0x19e7385b - .long 0x02f5254c - .long 0x0bfb2e41 - .long 0xd79a8c61 - .long 0xde94876c - .long 0xc5869a7b - .long 0xcc889176 - .long 0xf3a2a055 - .long 0xfaacab58 - .long 0xe1beb64f - .long 0xe8b0bd42 - .long 0x9fead409 - .long 0x96e4df04 - .long 0x8df6c213 - .long 0x84f8c91e - .long 0xbbd2f83d - .long 0xb2dcf330 - .long 0xa9ceee27 - .long 0xa0c0e52a - .long 0x477a3cb1 - .long 0x4e7437bc - .long 0x55662aab - .long 0x5c6821a6 - .long 0x63421085 - .long 0x6a4c1b88 - .long 0x715e069f - .long 0x78500d92 - .long 0x0f0a64d9 - .long 0x06046fd4 - .long 0x1d1672c3 - .long 0x141879ce - .long 0x2b3248ed - .long 0x223c43e0 - .long 0x392e5ef7 - .long 0x302055fa - .long 0x9aec01b7 - .long 0x93e20aba - .long 0x88f017ad - .long 0x81fe1ca0 - .long 0xbed42d83 - .long 0xb7da268e - .long 0xacc83b99 - .long 0xa5c63094 - .long 0xd29c59df - .long 0xdb9252d2 - .long 0xc0804fc5 - .long 0xc98e44c8 - .long 0xf6a475eb - .long 0xffaa7ee6 - .long 0xe4b863f1 - .long 0xedb668fc - .long 0x0a0cb167 - .long 0x0302ba6a - .long 0x1810a77d - .long 0x111eac70 - .long 0x2e349d53 - .long 0x273a965e - .long 0x3c288b49 - .long 0x35268044 - .long 0x427ce90f - .long 0x4b72e202 - .long 0x5060ff15 - .long 0x596ef418 - .long 0x6644c53b - .long 0x6f4ace36 - .long 0x7458d321 - .long 0x7d56d82c - .long 0xa1377a0c - .long 0xa8397101 - .long 0xb32b6c16 - .long 0xba25671b - .long 0x850f5638 - .long 0x8c015d35 - .long 0x97134022 - .long 0x9e1d4b2f - .long 0xe9472264 - .long 0xe0492969 - .long 0xfb5b347e - .long 0xf2553f73 - .long 0xcd7f0e50 - .long 0xc471055d - .long 0xdf63184a - .long 0xd66d1347 - .long 0x31d7cadc - .long 0x38d9c1d1 - .long 0x23cbdcc6 - .long 0x2ac5d7cb - .long 0x15efe6e8 - .long 0x1ce1ede5 - .long 0x07f3f0f2 - .long 0x0efdfbff - .long 0x79a792b4 - .long 0x70a999b9 - .long 0x6bbb84ae - .long 0x62b58fa3 - .long 0x5d9fbe80 - .long 0x5491b58d - .long 0x4f83a89a - .long 0x468da397 - // Table 3. - .long 0x00000000 - .long 0x0e0b0d09 - .long 0x1c161a12 - .long 0x121d171b - .long 0x382c3424 - .long 0x3627392d - .long 0x243a2e36 - .long 0x2a31233f - .long 0x70586848 - .long 0x7e536541 - .long 0x6c4e725a - .long 0x62457f53 - .long 0x48745c6c - .long 0x467f5165 - .long 0x5462467e - .long 0x5a694b77 - .long 0xe0b0d090 - .long 0xeebbdd99 - .long 0xfca6ca82 - .long 0xf2adc78b - .long 0xd89ce4b4 - .long 0xd697e9bd - .long 0xc48afea6 - .long 0xca81f3af - .long 0x90e8b8d8 - .long 0x9ee3b5d1 - .long 0x8cfea2ca - .long 0x82f5afc3 - .long 0xa8c48cfc - .long 0xa6cf81f5 - .long 0xb4d296ee - .long 0xbad99be7 - .long 0xdb7bbb3b - .long 0xd570b632 - .long 0xc76da129 - .long 0xc966ac20 - .long 0xe3578f1f - .long 0xed5c8216 - .long 0xff41950d - .long 0xf14a9804 - .long 0xab23d373 - .long 0xa528de7a - .long 0xb735c961 - .long 0xb93ec468 - .long 0x930fe757 - .long 0x9d04ea5e - .long 0x8f19fd45 - .long 0x8112f04c - .long 0x3bcb6bab - .long 0x35c066a2 - .long 0x27dd71b9 - .long 0x29d67cb0 - .long 0x03e75f8f - .long 0x0dec5286 - .long 0x1ff1459d - .long 0x11fa4894 - .long 0x4b9303e3 - .long 0x45980eea - .long 0x578519f1 - .long 0x598e14f8 - .long 0x73bf37c7 - .long 0x7db43ace - .long 0x6fa92dd5 - .long 0x61a220dc - .long 0xadf66d76 - .long 0xa3fd607f - .long 0xb1e07764 - .long 0xbfeb7a6d - .long 0x95da5952 - .long 0x9bd1545b - .long 0x89cc4340 - .long 0x87c74e49 - .long 0xddae053e - .long 0xd3a50837 - .long 0xc1b81f2c - .long 0xcfb31225 - .long 0xe582311a - .long 0xeb893c13 - .long 0xf9942b08 - .long 0xf79f2601 - .long 0x4d46bde6 - .long 0x434db0ef - .long 0x5150a7f4 - .long 0x5f5baafd - .long 0x756a89c2 - .long 0x7b6184cb - .long 0x697c93d0 - .long 0x67779ed9 - .long 0x3d1ed5ae - .long 0x3315d8a7 - .long 0x2108cfbc - .long 0x2f03c2b5 - .long 0x0532e18a - .long 0x0b39ec83 - .long 0x1924fb98 - .long 0x172ff691 - .long 0x768dd64d - .long 0x7886db44 - .long 0x6a9bcc5f - .long 0x6490c156 - .long 0x4ea1e269 - .long 0x40aaef60 - .long 0x52b7f87b - .long 0x5cbcf572 - .long 0x06d5be05 - .long 0x08deb30c - .long 0x1ac3a417 - .long 0x14c8a91e - .long 0x3ef98a21 - .long 0x30f28728 - .long 0x22ef9033 - .long 0x2ce49d3a - .long 0x963d06dd - .long 0x98360bd4 - .long 0x8a2b1ccf - .long 0x842011c6 - .long 0xae1132f9 - .long 0xa01a3ff0 - .long 0xb20728eb - .long 0xbc0c25e2 - .long 0xe6656e95 - .long 0xe86e639c - .long 0xfa737487 - .long 0xf478798e - .long 0xde495ab1 - .long 0xd04257b8 - .long 0xc25f40a3 - .long 0xcc544daa - .long 0x41f7daec - .long 0x4ffcd7e5 - .long 0x5de1c0fe - .long 0x53eacdf7 - .long 0x79dbeec8 - .long 0x77d0e3c1 - .long 0x65cdf4da - .long 0x6bc6f9d3 - .long 0x31afb2a4 - .long 0x3fa4bfad - .long 0x2db9a8b6 - .long 0x23b2a5bf - .long 0x09838680 - .long 0x07888b89 - .long 0x15959c92 - .long 0x1b9e919b - .long 0xa1470a7c - .long 0xaf4c0775 - .long 0xbd51106e - .long 0xb35a1d67 - .long 0x996b3e58 - .long 0x97603351 - .long 0x857d244a - .long 0x8b762943 - .long 0xd11f6234 - .long 0xdf146f3d - .long 0xcd097826 - .long 0xc302752f - .long 0xe9335610 - .long 0xe7385b19 - .long 0xf5254c02 - .long 0xfb2e410b - .long 0x9a8c61d7 - .long 0x94876cde - .long 0x869a7bc5 - .long 0x889176cc - .long 0xa2a055f3 - .long 0xacab58fa - .long 0xbeb64fe1 - .long 0xb0bd42e8 - .long 0xead4099f - .long 0xe4df0496 - .long 0xf6c2138d - .long 0xf8c91e84 - .long 0xd2f83dbb - .long 0xdcf330b2 - .long 0xceee27a9 - .long 0xc0e52aa0 - .long 0x7a3cb147 - .long 0x7437bc4e - .long 0x662aab55 - .long 0x6821a65c - .long 0x42108563 - .long 0x4c1b886a - .long 0x5e069f71 - .long 0x500d9278 - .long 0x0a64d90f - .long 0x046fd406 - .long 0x1672c31d - .long 0x1879ce14 - .long 0x3248ed2b - .long 0x3c43e022 - .long 0x2e5ef739 - .long 0x2055fa30 - .long 0xec01b79a - .long 0xe20aba93 - .long 0xf017ad88 - .long 0xfe1ca081 - .long 0xd42d83be - .long 0xda268eb7 - .long 0xc83b99ac - .long 0xc63094a5 - .long 0x9c59dfd2 - .long 0x9252d2db - .long 0x804fc5c0 - .long 0x8e44c8c9 - .long 0xa475ebf6 - .long 0xaa7ee6ff - .long 0xb863f1e4 - .long 0xb668fced - .long 0x0cb1670a - .long 0x02ba6a03 - .long 0x10a77d18 - .long 0x1eac7011 - .long 0x349d532e - .long 0x3a965e27 - .long 0x288b493c - .long 0x26804435 - .long 0x7ce90f42 - .long 0x72e2024b - .long 0x60ff1550 - .long 0x6ef41859 - .long 0x44c53b66 - .long 0x4ace366f - .long 0x58d32174 - .long 0x56d82c7d - .long 0x377a0ca1 - .long 0x397101a8 - .long 0x2b6c16b3 - .long 0x25671bba - .long 0x0f563885 - .long 0x015d358c - .long 0x13402297 - .long 0x1d4b2f9e - .long 0x472264e9 - .long 0x492969e0 - .long 0x5b347efb - .long 0x553f73f2 - .long 0x7f0e50cd - .long 0x71055dc4 - .long 0x63184adf - .long 0x6d1347d6 - .long 0xd7cadc31 - .long 0xd9c1d138 - .long 0xcbdcc623 - .long 0xc5d7cb2a - .long 0xefe6e815 - .long 0xe1ede51c - .long 0xf3f0f207 - .long 0xfdfbff0e - .long 0xa792b479 - .long 0xa999b970 - .long 0xbb84ae6b - .long 0xb58fa362 - .long 0x9fbe805d - .long 0x91b58d54 - .long 0x83a89a4f - .long 0x8da39746 - - -// Tables for main encryption iterations. - .globl _OLDAESEncryptTable - .private_extern _OLDAESEncryptTable - .align 2 -_OLDAESEncryptTable: - // Table 0. - .long 0xa56363c6 - .long 0x847c7cf8 - .long 0x997777ee - .long 0x8d7b7bf6 - .long 0x0df2f2ff - .long 0xbd6b6bd6 - .long 0xb16f6fde - .long 0x54c5c591 - .long 0x50303060 - .long 0x03010102 - .long 0xa96767ce - .long 0x7d2b2b56 - .long 0x19fefee7 - .long 0x62d7d7b5 - .long 0xe6abab4d - .long 0x9a7676ec - .long 0x45caca8f - .long 0x9d82821f - .long 0x40c9c989 - .long 0x877d7dfa - .long 0x15fafaef - .long 0xeb5959b2 - .long 0xc947478e - .long 0x0bf0f0fb - .long 0xecadad41 - .long 0x67d4d4b3 - .long 0xfda2a25f - .long 0xeaafaf45 - .long 0xbf9c9c23 - .long 0xf7a4a453 - .long 0x967272e4 - .long 0x5bc0c09b - .long 0xc2b7b775 - .long 0x1cfdfde1 - .long 0xae93933d - .long 0x6a26264c - .long 0x5a36366c - .long 0x413f3f7e - .long 0x02f7f7f5 - .long 0x4fcccc83 - .long 0x5c343468 - .long 0xf4a5a551 - .long 0x34e5e5d1 - .long 0x08f1f1f9 - .long 0x937171e2 - .long 0x73d8d8ab - .long 0x53313162 - .long 0x3f15152a - .long 0x0c040408 - .long 0x52c7c795 - .long 0x65232346 - .long 0x5ec3c39d - .long 0x28181830 - .long 0xa1969637 - .long 0x0f05050a - .long 0xb59a9a2f - .long 0x0907070e - .long 0x36121224 - .long 0x9b80801b - .long 0x3de2e2df - .long 0x26ebebcd - .long 0x6927274e - .long 0xcdb2b27f - .long 0x9f7575ea - .long 0x1b090912 - .long 0x9e83831d - .long 0x742c2c58 - .long 0x2e1a1a34 - .long 0x2d1b1b36 - .long 0xb26e6edc - .long 0xee5a5ab4 - .long 0xfba0a05b - .long 0xf65252a4 - .long 0x4d3b3b76 - .long 0x61d6d6b7 - .long 0xceb3b37d - .long 0x7b292952 - .long 0x3ee3e3dd - .long 0x712f2f5e - .long 0x97848413 - .long 0xf55353a6 - .long 0x68d1d1b9 - .long 0x00000000 - .long 0x2cededc1 - .long 0x60202040 - .long 0x1ffcfce3 - .long 0xc8b1b179 - .long 0xed5b5bb6 - .long 0xbe6a6ad4 - .long 0x46cbcb8d - .long 0xd9bebe67 - .long 0x4b393972 - .long 0xde4a4a94 - .long 0xd44c4c98 - .long 0xe85858b0 - .long 0x4acfcf85 - .long 0x6bd0d0bb - .long 0x2aefefc5 - .long 0xe5aaaa4f - .long 0x16fbfbed - .long 0xc5434386 - .long 0xd74d4d9a - .long 0x55333366 - .long 0x94858511 - .long 0xcf45458a - .long 0x10f9f9e9 - .long 0x06020204 - .long 0x817f7ffe - .long 0xf05050a0 - .long 0x443c3c78 - .long 0xba9f9f25 - .long 0xe3a8a84b - .long 0xf35151a2 - .long 0xfea3a35d - .long 0xc0404080 - .long 0x8a8f8f05 - .long 0xad92923f - .long 0xbc9d9d21 - .long 0x48383870 - .long 0x04f5f5f1 - .long 0xdfbcbc63 - .long 0xc1b6b677 - .long 0x75dadaaf - .long 0x63212142 - .long 0x30101020 - .long 0x1affffe5 - .long 0x0ef3f3fd - .long 0x6dd2d2bf - .long 0x4ccdcd81 - .long 0x140c0c18 - .long 0x35131326 - .long 0x2fececc3 - .long 0xe15f5fbe - .long 0xa2979735 - .long 0xcc444488 - .long 0x3917172e - .long 0x57c4c493 - .long 0xf2a7a755 - .long 0x827e7efc - .long 0x473d3d7a - .long 0xac6464c8 - .long 0xe75d5dba - .long 0x2b191932 - .long 0x957373e6 - .long 0xa06060c0 - .long 0x98818119 - .long 0xd14f4f9e - .long 0x7fdcdca3 - .long 0x66222244 - .long 0x7e2a2a54 - .long 0xab90903b - .long 0x8388880b - .long 0xca46468c - .long 0x29eeeec7 - .long 0xd3b8b86b - .long 0x3c141428 - .long 0x79dedea7 - .long 0xe25e5ebc - .long 0x1d0b0b16 - .long 0x76dbdbad - .long 0x3be0e0db - .long 0x56323264 - .long 0x4e3a3a74 - .long 0x1e0a0a14 - .long 0xdb494992 - .long 0x0a06060c - .long 0x6c242448 - .long 0xe45c5cb8 - .long 0x5dc2c29f - .long 0x6ed3d3bd - .long 0xefacac43 - .long 0xa66262c4 - .long 0xa8919139 - .long 0xa4959531 - .long 0x37e4e4d3 - .long 0x8b7979f2 - .long 0x32e7e7d5 - .long 0x43c8c88b - .long 0x5937376e - .long 0xb76d6dda - .long 0x8c8d8d01 - .long 0x64d5d5b1 - .long 0xd24e4e9c - .long 0xe0a9a949 - .long 0xb46c6cd8 - .long 0xfa5656ac - .long 0x07f4f4f3 - .long 0x25eaeacf - .long 0xaf6565ca - .long 0x8e7a7af4 - .long 0xe9aeae47 - .long 0x18080810 - .long 0xd5baba6f - .long 0x887878f0 - .long 0x6f25254a - .long 0x722e2e5c - .long 0x241c1c38 - .long 0xf1a6a657 - .long 0xc7b4b473 - .long 0x51c6c697 - .long 0x23e8e8cb - .long 0x7cdddda1 - .long 0x9c7474e8 - .long 0x211f1f3e - .long 0xdd4b4b96 - .long 0xdcbdbd61 - .long 0x868b8b0d - .long 0x858a8a0f - .long 0x907070e0 - .long 0x423e3e7c - .long 0xc4b5b571 - .long 0xaa6666cc - .long 0xd8484890 - .long 0x05030306 - .long 0x01f6f6f7 - .long 0x120e0e1c - .long 0xa36161c2 - .long 0x5f35356a - .long 0xf95757ae - .long 0xd0b9b969 - .long 0x91868617 - .long 0x58c1c199 - .long 0x271d1d3a - .long 0xb99e9e27 - .long 0x38e1e1d9 - .long 0x13f8f8eb - .long 0xb398982b - .long 0x33111122 - .long 0xbb6969d2 - .long 0x70d9d9a9 - .long 0x898e8e07 - .long 0xa7949433 - .long 0xb69b9b2d - .long 0x221e1e3c - .long 0x92878715 - .long 0x20e9e9c9 - .long 0x49cece87 - .long 0xff5555aa - .long 0x78282850 - .long 0x7adfdfa5 - .long 0x8f8c8c03 - .long 0xf8a1a159 - .long 0x80898909 - .long 0x170d0d1a - .long 0xdabfbf65 - .long 0x31e6e6d7 - .long 0xc6424284 - .long 0xb86868d0 - .long 0xc3414182 - .long 0xb0999929 - .long 0x772d2d5a - .long 0x110f0f1e - .long 0xcbb0b07b - .long 0xfc5454a8 - .long 0xd6bbbb6d - .long 0x3a16162c - // Table 1. - .long 0x6363c6a5 - .long 0x7c7cf884 - .long 0x7777ee99 - .long 0x7b7bf68d - .long 0xf2f2ff0d - .long 0x6b6bd6bd - .long 0x6f6fdeb1 - .long 0xc5c59154 - .long 0x30306050 - .long 0x01010203 - .long 0x6767cea9 - .long 0x2b2b567d - .long 0xfefee719 - .long 0xd7d7b562 - .long 0xabab4de6 - .long 0x7676ec9a - .long 0xcaca8f45 - .long 0x82821f9d - .long 0xc9c98940 - .long 0x7d7dfa87 - .long 0xfafaef15 - .long 0x5959b2eb - .long 0x47478ec9 - .long 0xf0f0fb0b - .long 0xadad41ec - .long 0xd4d4b367 - .long 0xa2a25ffd - .long 0xafaf45ea - .long 0x9c9c23bf - .long 0xa4a453f7 - .long 0x7272e496 - .long 0xc0c09b5b - .long 0xb7b775c2 - .long 0xfdfde11c - .long 0x93933dae - .long 0x26264c6a - .long 0x36366c5a - .long 0x3f3f7e41 - .long 0xf7f7f502 - .long 0xcccc834f - .long 0x3434685c - .long 0xa5a551f4 - .long 0xe5e5d134 - .long 0xf1f1f908 - .long 0x7171e293 - .long 0xd8d8ab73 - .long 0x31316253 - .long 0x15152a3f - .long 0x0404080c - .long 0xc7c79552 - .long 0x23234665 - .long 0xc3c39d5e - .long 0x18183028 - .long 0x969637a1 - .long 0x05050a0f - .long 0x9a9a2fb5 - .long 0x07070e09 - .long 0x12122436 - .long 0x80801b9b - .long 0xe2e2df3d - .long 0xebebcd26 - .long 0x27274e69 - .long 0xb2b27fcd - .long 0x7575ea9f - .long 0x0909121b - .long 0x83831d9e - .long 0x2c2c5874 - .long 0x1a1a342e - .long 0x1b1b362d - .long 0x6e6edcb2 - .long 0x5a5ab4ee - .long 0xa0a05bfb - .long 0x5252a4f6 - .long 0x3b3b764d - .long 0xd6d6b761 - .long 0xb3b37dce - .long 0x2929527b - .long 0xe3e3dd3e - .long 0x2f2f5e71 - .long 0x84841397 - .long 0x5353a6f5 - .long 0xd1d1b968 - .long 0x00000000 - .long 0xededc12c - .long 0x20204060 - .long 0xfcfce31f - .long 0xb1b179c8 - .long 0x5b5bb6ed - .long 0x6a6ad4be - .long 0xcbcb8d46 - .long 0xbebe67d9 - .long 0x3939724b - .long 0x4a4a94de - .long 0x4c4c98d4 - .long 0x5858b0e8 - .long 0xcfcf854a - .long 0xd0d0bb6b - .long 0xefefc52a - .long 0xaaaa4fe5 - .long 0xfbfbed16 - .long 0x434386c5 - .long 0x4d4d9ad7 - .long 0x33336655 - .long 0x85851194 - .long 0x45458acf - .long 0xf9f9e910 - .long 0x02020406 - .long 0x7f7ffe81 - .long 0x5050a0f0 - .long 0x3c3c7844 - .long 0x9f9f25ba - .long 0xa8a84be3 - .long 0x5151a2f3 - .long 0xa3a35dfe - .long 0x404080c0 - .long 0x8f8f058a - .long 0x92923fad - .long 0x9d9d21bc - .long 0x38387048 - .long 0xf5f5f104 - .long 0xbcbc63df - .long 0xb6b677c1 - .long 0xdadaaf75 - .long 0x21214263 - .long 0x10102030 - .long 0xffffe51a - .long 0xf3f3fd0e - .long 0xd2d2bf6d - .long 0xcdcd814c - .long 0x0c0c1814 - .long 0x13132635 - .long 0xececc32f - .long 0x5f5fbee1 - .long 0x979735a2 - .long 0x444488cc - .long 0x17172e39 - .long 0xc4c49357 - .long 0xa7a755f2 - .long 0x7e7efc82 - .long 0x3d3d7a47 - .long 0x6464c8ac - .long 0x5d5dbae7 - .long 0x1919322b - .long 0x7373e695 - .long 0x6060c0a0 - .long 0x81811998 - .long 0x4f4f9ed1 - .long 0xdcdca37f - .long 0x22224466 - .long 0x2a2a547e - .long 0x90903bab - .long 0x88880b83 - .long 0x46468cca - .long 0xeeeec729 - .long 0xb8b86bd3 - .long 0x1414283c - .long 0xdedea779 - .long 0x5e5ebce2 - .long 0x0b0b161d - .long 0xdbdbad76 - .long 0xe0e0db3b - .long 0x32326456 - .long 0x3a3a744e - .long 0x0a0a141e - .long 0x494992db - .long 0x06060c0a - .long 0x2424486c - .long 0x5c5cb8e4 - .long 0xc2c29f5d - .long 0xd3d3bd6e - .long 0xacac43ef - .long 0x6262c4a6 - .long 0x919139a8 - .long 0x959531a4 - .long 0xe4e4d337 - .long 0x7979f28b - .long 0xe7e7d532 - .long 0xc8c88b43 - .long 0x37376e59 - .long 0x6d6ddab7 - .long 0x8d8d018c - .long 0xd5d5b164 - .long 0x4e4e9cd2 - .long 0xa9a949e0 - .long 0x6c6cd8b4 - .long 0x5656acfa - .long 0xf4f4f307 - .long 0xeaeacf25 - .long 0x6565caaf - .long 0x7a7af48e - .long 0xaeae47e9 - .long 0x08081018 - .long 0xbaba6fd5 - .long 0x7878f088 - .long 0x25254a6f - .long 0x2e2e5c72 - .long 0x1c1c3824 - .long 0xa6a657f1 - .long 0xb4b473c7 - .long 0xc6c69751 - .long 0xe8e8cb23 - .long 0xdddda17c - .long 0x7474e89c - .long 0x1f1f3e21 - .long 0x4b4b96dd - .long 0xbdbd61dc - .long 0x8b8b0d86 - .long 0x8a8a0f85 - .long 0x7070e090 - .long 0x3e3e7c42 - .long 0xb5b571c4 - .long 0x6666ccaa - .long 0x484890d8 - .long 0x03030605 - .long 0xf6f6f701 - .long 0x0e0e1c12 - .long 0x6161c2a3 - .long 0x35356a5f - .long 0x5757aef9 - .long 0xb9b969d0 - .long 0x86861791 - .long 0xc1c19958 - .long 0x1d1d3a27 - .long 0x9e9e27b9 - .long 0xe1e1d938 - .long 0xf8f8eb13 - .long 0x98982bb3 - .long 0x11112233 - .long 0x6969d2bb - .long 0xd9d9a970 - .long 0x8e8e0789 - .long 0x949433a7 - .long 0x9b9b2db6 - .long 0x1e1e3c22 - .long 0x87871592 - .long 0xe9e9c920 - .long 0xcece8749 - .long 0x5555aaff - .long 0x28285078 - .long 0xdfdfa57a - .long 0x8c8c038f - .long 0xa1a159f8 - .long 0x89890980 - .long 0x0d0d1a17 - .long 0xbfbf65da - .long 0xe6e6d731 - .long 0x424284c6 - .long 0x6868d0b8 - .long 0x414182c3 - .long 0x999929b0 - .long 0x2d2d5a77 - .long 0x0f0f1e11 - .long 0xb0b07bcb - .long 0x5454a8fc - .long 0xbbbb6dd6 - .long 0x16162c3a - // Table 2. - .long 0x63c6a563 - .long 0x7cf8847c - .long 0x77ee9977 - .long 0x7bf68d7b - .long 0xf2ff0df2 - .long 0x6bd6bd6b - .long 0x6fdeb16f - .long 0xc59154c5 - .long 0x30605030 - .long 0x01020301 - .long 0x67cea967 - .long 0x2b567d2b - .long 0xfee719fe - .long 0xd7b562d7 - .long 0xab4de6ab - .long 0x76ec9a76 - .long 0xca8f45ca - .long 0x821f9d82 - .long 0xc98940c9 - .long 0x7dfa877d - .long 0xfaef15fa - .long 0x59b2eb59 - .long 0x478ec947 - .long 0xf0fb0bf0 - .long 0xad41ecad - .long 0xd4b367d4 - .long 0xa25ffda2 - .long 0xaf45eaaf - .long 0x9c23bf9c - .long 0xa453f7a4 - .long 0x72e49672 - .long 0xc09b5bc0 - .long 0xb775c2b7 - .long 0xfde11cfd - .long 0x933dae93 - .long 0x264c6a26 - .long 0x366c5a36 - .long 0x3f7e413f - .long 0xf7f502f7 - .long 0xcc834fcc - .long 0x34685c34 - .long 0xa551f4a5 - .long 0xe5d134e5 - .long 0xf1f908f1 - .long 0x71e29371 - .long 0xd8ab73d8 - .long 0x31625331 - .long 0x152a3f15 - .long 0x04080c04 - .long 0xc79552c7 - .long 0x23466523 - .long 0xc39d5ec3 - .long 0x18302818 - .long 0x9637a196 - .long 0x050a0f05 - .long 0x9a2fb59a - .long 0x070e0907 - .long 0x12243612 - .long 0x801b9b80 - .long 0xe2df3de2 - .long 0xebcd26eb - .long 0x274e6927 - .long 0xb27fcdb2 - .long 0x75ea9f75 - .long 0x09121b09 - .long 0x831d9e83 - .long 0x2c58742c - .long 0x1a342e1a - .long 0x1b362d1b - .long 0x6edcb26e - .long 0x5ab4ee5a - .long 0xa05bfba0 - .long 0x52a4f652 - .long 0x3b764d3b - .long 0xd6b761d6 - .long 0xb37dceb3 - .long 0x29527b29 - .long 0xe3dd3ee3 - .long 0x2f5e712f - .long 0x84139784 - .long 0x53a6f553 - .long 0xd1b968d1 - .long 0x00000000 - .long 0xedc12ced - .long 0x20406020 - .long 0xfce31ffc - .long 0xb179c8b1 - .long 0x5bb6ed5b - .long 0x6ad4be6a - .long 0xcb8d46cb - .long 0xbe67d9be - .long 0x39724b39 - .long 0x4a94de4a - .long 0x4c98d44c - .long 0x58b0e858 - .long 0xcf854acf - .long 0xd0bb6bd0 - .long 0xefc52aef - .long 0xaa4fe5aa - .long 0xfbed16fb - .long 0x4386c543 - .long 0x4d9ad74d - .long 0x33665533 - .long 0x85119485 - .long 0x458acf45 - .long 0xf9e910f9 - .long 0x02040602 - .long 0x7ffe817f - .long 0x50a0f050 - .long 0x3c78443c - .long 0x9f25ba9f - .long 0xa84be3a8 - .long 0x51a2f351 - .long 0xa35dfea3 - .long 0x4080c040 - .long 0x8f058a8f - .long 0x923fad92 - .long 0x9d21bc9d - .long 0x38704838 - .long 0xf5f104f5 - .long 0xbc63dfbc - .long 0xb677c1b6 - .long 0xdaaf75da - .long 0x21426321 - .long 0x10203010 - .long 0xffe51aff - .long 0xf3fd0ef3 - .long 0xd2bf6dd2 - .long 0xcd814ccd - .long 0x0c18140c - .long 0x13263513 - .long 0xecc32fec - .long 0x5fbee15f - .long 0x9735a297 - .long 0x4488cc44 - .long 0x172e3917 - .long 0xc49357c4 - .long 0xa755f2a7 - .long 0x7efc827e - .long 0x3d7a473d - .long 0x64c8ac64 - .long 0x5dbae75d - .long 0x19322b19 - .long 0x73e69573 - .long 0x60c0a060 - .long 0x81199881 - .long 0x4f9ed14f - .long 0xdca37fdc - .long 0x22446622 - .long 0x2a547e2a - .long 0x903bab90 - .long 0x880b8388 - .long 0x468cca46 - .long 0xeec729ee - .long 0xb86bd3b8 - .long 0x14283c14 - .long 0xdea779de - .long 0x5ebce25e - .long 0x0b161d0b - .long 0xdbad76db - .long 0xe0db3be0 - .long 0x32645632 - .long 0x3a744e3a - .long 0x0a141e0a - .long 0x4992db49 - .long 0x060c0a06 - .long 0x24486c24 - .long 0x5cb8e45c - .long 0xc29f5dc2 - .long 0xd3bd6ed3 - .long 0xac43efac - .long 0x62c4a662 - .long 0x9139a891 - .long 0x9531a495 - .long 0xe4d337e4 - .long 0x79f28b79 - .long 0xe7d532e7 - .long 0xc88b43c8 - .long 0x376e5937 - .long 0x6ddab76d - .long 0x8d018c8d - .long 0xd5b164d5 - .long 0x4e9cd24e - .long 0xa949e0a9 - .long 0x6cd8b46c - .long 0x56acfa56 - .long 0xf4f307f4 - .long 0xeacf25ea - .long 0x65caaf65 - .long 0x7af48e7a - .long 0xae47e9ae - .long 0x08101808 - .long 0xba6fd5ba - .long 0x78f08878 - .long 0x254a6f25 - .long 0x2e5c722e - .long 0x1c38241c - .long 0xa657f1a6 - .long 0xb473c7b4 - .long 0xc69751c6 - .long 0xe8cb23e8 - .long 0xdda17cdd - .long 0x74e89c74 - .long 0x1f3e211f - .long 0x4b96dd4b - .long 0xbd61dcbd - .long 0x8b0d868b - .long 0x8a0f858a - .long 0x70e09070 - .long 0x3e7c423e - .long 0xb571c4b5 - .long 0x66ccaa66 - .long 0x4890d848 - .long 0x03060503 - .long 0xf6f701f6 - .long 0x0e1c120e - .long 0x61c2a361 - .long 0x356a5f35 - .long 0x57aef957 - .long 0xb969d0b9 - .long 0x86179186 - .long 0xc19958c1 - .long 0x1d3a271d - .long 0x9e27b99e - .long 0xe1d938e1 - .long 0xf8eb13f8 - .long 0x982bb398 - .long 0x11223311 - .long 0x69d2bb69 - .long 0xd9a970d9 - .long 0x8e07898e - .long 0x9433a794 - .long 0x9b2db69b - .long 0x1e3c221e - .long 0x87159287 - .long 0xe9c920e9 - .long 0xce8749ce - .long 0x55aaff55 - .long 0x28507828 - .long 0xdfa57adf - .long 0x8c038f8c - .long 0xa159f8a1 - .long 0x89098089 - .long 0x0d1a170d - .long 0xbf65dabf - .long 0xe6d731e6 - .long 0x4284c642 - .long 0x68d0b868 - .long 0x4182c341 - .long 0x9929b099 - .long 0x2d5a772d - .long 0x0f1e110f - .long 0xb07bcbb0 - .long 0x54a8fc54 - .long 0xbb6dd6bb - .long 0x162c3a16 - // Table 3. - .long 0xc6a56363 - .long 0xf8847c7c - .long 0xee997777 - .long 0xf68d7b7b - .long 0xff0df2f2 - .long 0xd6bd6b6b - .long 0xdeb16f6f - .long 0x9154c5c5 - .long 0x60503030 - .long 0x02030101 - .long 0xcea96767 - .long 0x567d2b2b - .long 0xe719fefe - .long 0xb562d7d7 - .long 0x4de6abab - .long 0xec9a7676 - .long 0x8f45caca - .long 0x1f9d8282 - .long 0x8940c9c9 - .long 0xfa877d7d - .long 0xef15fafa - .long 0xb2eb5959 - .long 0x8ec94747 - .long 0xfb0bf0f0 - .long 0x41ecadad - .long 0xb367d4d4 - .long 0x5ffda2a2 - .long 0x45eaafaf - .long 0x23bf9c9c - .long 0x53f7a4a4 - .long 0xe4967272 - .long 0x9b5bc0c0 - .long 0x75c2b7b7 - .long 0xe11cfdfd - .long 0x3dae9393 - .long 0x4c6a2626 - .long 0x6c5a3636 - .long 0x7e413f3f - .long 0xf502f7f7 - .long 0x834fcccc - .long 0x685c3434 - .long 0x51f4a5a5 - .long 0xd134e5e5 - .long 0xf908f1f1 - .long 0xe2937171 - .long 0xab73d8d8 - .long 0x62533131 - .long 0x2a3f1515 - .long 0x080c0404 - .long 0x9552c7c7 - .long 0x46652323 - .long 0x9d5ec3c3 - .long 0x30281818 - .long 0x37a19696 - .long 0x0a0f0505 - .long 0x2fb59a9a - .long 0x0e090707 - .long 0x24361212 - .long 0x1b9b8080 - .long 0xdf3de2e2 - .long 0xcd26ebeb - .long 0x4e692727 - .long 0x7fcdb2b2 - .long 0xea9f7575 - .long 0x121b0909 - .long 0x1d9e8383 - .long 0x58742c2c - .long 0x342e1a1a - .long 0x362d1b1b - .long 0xdcb26e6e - .long 0xb4ee5a5a - .long 0x5bfba0a0 - .long 0xa4f65252 - .long 0x764d3b3b - .long 0xb761d6d6 - .long 0x7dceb3b3 - .long 0x527b2929 - .long 0xdd3ee3e3 - .long 0x5e712f2f - .long 0x13978484 - .long 0xa6f55353 - .long 0xb968d1d1 - .long 0x00000000 - .long 0xc12ceded - .long 0x40602020 - .long 0xe31ffcfc - .long 0x79c8b1b1 - .long 0xb6ed5b5b - .long 0xd4be6a6a - .long 0x8d46cbcb - .long 0x67d9bebe - .long 0x724b3939 - .long 0x94de4a4a - .long 0x98d44c4c - .long 0xb0e85858 - .long 0x854acfcf - .long 0xbb6bd0d0 - .long 0xc52aefef - .long 0x4fe5aaaa - .long 0xed16fbfb - .long 0x86c54343 - .long 0x9ad74d4d - .long 0x66553333 - .long 0x11948585 - .long 0x8acf4545 - .long 0xe910f9f9 - .long 0x04060202 - .long 0xfe817f7f - .long 0xa0f05050 - .long 0x78443c3c - .long 0x25ba9f9f - .long 0x4be3a8a8 - .long 0xa2f35151 - .long 0x5dfea3a3 - .long 0x80c04040 - .long 0x058a8f8f - .long 0x3fad9292 - .long 0x21bc9d9d - .long 0x70483838 - .long 0xf104f5f5 - .long 0x63dfbcbc - .long 0x77c1b6b6 - .long 0xaf75dada - .long 0x42632121 - .long 0x20301010 - .long 0xe51affff - .long 0xfd0ef3f3 - .long 0xbf6dd2d2 - .long 0x814ccdcd - .long 0x18140c0c - .long 0x26351313 - .long 0xc32fecec - .long 0xbee15f5f - .long 0x35a29797 - .long 0x88cc4444 - .long 0x2e391717 - .long 0x9357c4c4 - .long 0x55f2a7a7 - .long 0xfc827e7e - .long 0x7a473d3d - .long 0xc8ac6464 - .long 0xbae75d5d - .long 0x322b1919 - .long 0xe6957373 - .long 0xc0a06060 - .long 0x19988181 - .long 0x9ed14f4f - .long 0xa37fdcdc - .long 0x44662222 - .long 0x547e2a2a - .long 0x3bab9090 - .long 0x0b838888 - .long 0x8cca4646 - .long 0xc729eeee - .long 0x6bd3b8b8 - .long 0x283c1414 - .long 0xa779dede - .long 0xbce25e5e - .long 0x161d0b0b - .long 0xad76dbdb - .long 0xdb3be0e0 - .long 0x64563232 - .long 0x744e3a3a - .long 0x141e0a0a - .long 0x92db4949 - .long 0x0c0a0606 - .long 0x486c2424 - .long 0xb8e45c5c - .long 0x9f5dc2c2 - .long 0xbd6ed3d3 - .long 0x43efacac - .long 0xc4a66262 - .long 0x39a89191 - .long 0x31a49595 - .long 0xd337e4e4 - .long 0xf28b7979 - .long 0xd532e7e7 - .long 0x8b43c8c8 - .long 0x6e593737 - .long 0xdab76d6d - .long 0x018c8d8d - .long 0xb164d5d5 - .long 0x9cd24e4e - .long 0x49e0a9a9 - .long 0xd8b46c6c - .long 0xacfa5656 - .long 0xf307f4f4 - .long 0xcf25eaea - .long 0xcaaf6565 - .long 0xf48e7a7a - .long 0x47e9aeae - .long 0x10180808 - .long 0x6fd5baba - .long 0xf0887878 - .long 0x4a6f2525 - .long 0x5c722e2e - .long 0x38241c1c - .long 0x57f1a6a6 - .long 0x73c7b4b4 - .long 0x9751c6c6 - .long 0xcb23e8e8 - .long 0xa17cdddd - .long 0xe89c7474 - .long 0x3e211f1f - .long 0x96dd4b4b - .long 0x61dcbdbd - .long 0x0d868b8b - .long 0x0f858a8a - .long 0xe0907070 - .long 0x7c423e3e - .long 0x71c4b5b5 - .long 0xccaa6666 - .long 0x90d84848 - .long 0x06050303 - .long 0xf701f6f6 - .long 0x1c120e0e - .long 0xc2a36161 - .long 0x6a5f3535 - .long 0xaef95757 - .long 0x69d0b9b9 - .long 0x17918686 - .long 0x9958c1c1 - .long 0x3a271d1d - .long 0x27b99e9e - .long 0xd938e1e1 - .long 0xeb13f8f8 - .long 0x2bb39898 - .long 0x22331111 - .long 0xd2bb6969 - .long 0xa970d9d9 - .long 0x07898e8e - .long 0x33a79494 - .long 0x2db69b9b - .long 0x3c221e1e - .long 0x15928787 - .long 0xc920e9e9 - .long 0x8749cece - .long 0xaaff5555 - .long 0x50782828 - .long 0xa57adfdf - .long 0x038f8c8c - .long 0x59f8a1a1 - .long 0x09808989 - .long 0x1a170d0d - .long 0x65dabfbf - .long 0xd731e6e6 - .long 0x84c64242 - .long 0xd0b86868 - .long 0x82c34141 - .long 0x29b09999 - .long 0x5a772d2d - .long 0x1e110f0f - .long 0x7bcbb0b0 - .long 0xa8fc5454 - .long 0x6dd6bbbb - .long 0x2c3a1616 - - -// Tables for main decryption iterations. - .globl _OLDAESDecryptTable - .private_extern _OLDAESDecryptTable - .align 2 -_OLDAESDecryptTable: - // Table 0. - .long 0x50a7f451 - .long 0x5365417e - .long 0xc3a4171a - .long 0x965e273a - .long 0xcb6bab3b - .long 0xf1459d1f - .long 0xab58faac - .long 0x9303e34b - .long 0x55fa3020 - .long 0xf66d76ad - .long 0x9176cc88 - .long 0x254c02f5 - .long 0xfcd7e54f - .long 0xd7cb2ac5 - .long 0x80443526 - .long 0x8fa362b5 - .long 0x495ab1de - .long 0x671bba25 - .long 0x980eea45 - .long 0xe1c0fe5d - .long 0x02752fc3 - .long 0x12f04c81 - .long 0xa397468d - .long 0xc6f9d36b - .long 0xe75f8f03 - .long 0x959c9215 - .long 0xeb7a6dbf - .long 0xda595295 - .long 0x2d83bed4 - .long 0xd3217458 - .long 0x2969e049 - .long 0x44c8c98e - .long 0x6a89c275 - .long 0x78798ef4 - .long 0x6b3e5899 - .long 0xdd71b927 - .long 0xb64fe1be - .long 0x17ad88f0 - .long 0x66ac20c9 - .long 0xb43ace7d - .long 0x184adf63 - .long 0x82311ae5 - .long 0x60335197 - .long 0x457f5362 - .long 0xe07764b1 - .long 0x84ae6bbb - .long 0x1ca081fe - .long 0x942b08f9 - .long 0x58684870 - .long 0x19fd458f - .long 0x876cde94 - .long 0xb7f87b52 - .long 0x23d373ab - .long 0xe2024b72 - .long 0x578f1fe3 - .long 0x2aab5566 - .long 0x0728ebb2 - .long 0x03c2b52f - .long 0x9a7bc586 - .long 0xa50837d3 - .long 0xf2872830 - .long 0xb2a5bf23 - .long 0xba6a0302 - .long 0x5c8216ed - .long 0x2b1ccf8a - .long 0x92b479a7 - .long 0xf0f207f3 - .long 0xa1e2694e - .long 0xcdf4da65 - .long 0xd5be0506 - .long 0x1f6234d1 - .long 0x8afea6c4 - .long 0x9d532e34 - .long 0xa055f3a2 - .long 0x32e18a05 - .long 0x75ebf6a4 - .long 0x39ec830b - .long 0xaaef6040 - .long 0x069f715e - .long 0x51106ebd - .long 0xf98a213e - .long 0x3d06dd96 - .long 0xae053edd - .long 0x46bde64d - .long 0xb58d5491 - .long 0x055dc471 - .long 0x6fd40604 - .long 0xff155060 - .long 0x24fb9819 - .long 0x97e9bdd6 - .long 0xcc434089 - .long 0x779ed967 - .long 0xbd42e8b0 - .long 0x888b8907 - .long 0x385b19e7 - .long 0xdbeec879 - .long 0x470a7ca1 - .long 0xe90f427c - .long 0xc91e84f8 - .long 0x00000000 - .long 0x83868009 - .long 0x48ed2b32 - .long 0xac70111e - .long 0x4e725a6c - .long 0xfbff0efd - .long 0x5638850f - .long 0x1ed5ae3d - .long 0x27392d36 - .long 0x64d90f0a - .long 0x21a65c68 - .long 0xd1545b9b - .long 0x3a2e3624 - .long 0xb1670a0c - .long 0x0fe75793 - .long 0xd296eeb4 - .long 0x9e919b1b - .long 0x4fc5c080 - .long 0xa220dc61 - .long 0x694b775a - .long 0x161a121c - .long 0x0aba93e2 - .long 0xe52aa0c0 - .long 0x43e0223c - .long 0x1d171b12 - .long 0x0b0d090e - .long 0xadc78bf2 - .long 0xb9a8b62d - .long 0xc8a91e14 - .long 0x8519f157 - .long 0x4c0775af - .long 0xbbdd99ee - .long 0xfd607fa3 - .long 0x9f2601f7 - .long 0xbcf5725c - .long 0xc53b6644 - .long 0x347efb5b - .long 0x7629438b - .long 0xdcc623cb - .long 0x68fcedb6 - .long 0x63f1e4b8 - .long 0xcadc31d7 - .long 0x10856342 - .long 0x40229713 - .long 0x2011c684 - .long 0x7d244a85 - .long 0xf83dbbd2 - .long 0x1132f9ae - .long 0x6da129c7 - .long 0x4b2f9e1d - .long 0xf330b2dc - .long 0xec52860d - .long 0xd0e3c177 - .long 0x6c16b32b - .long 0x99b970a9 - .long 0xfa489411 - .long 0x2264e947 - .long 0xc48cfca8 - .long 0x1a3ff0a0 - .long 0xd82c7d56 - .long 0xef903322 - .long 0xc74e4987 - .long 0xc1d138d9 - .long 0xfea2ca8c - .long 0x360bd498 - .long 0xcf81f5a6 - .long 0x28de7aa5 - .long 0x268eb7da - .long 0xa4bfad3f - .long 0xe49d3a2c - .long 0x0d927850 - .long 0x9bcc5f6a - .long 0x62467e54 - .long 0xc2138df6 - .long 0xe8b8d890 - .long 0x5ef7392e - .long 0xf5afc382 - .long 0xbe805d9f - .long 0x7c93d069 - .long 0xa92dd56f - .long 0xb31225cf - .long 0x3b99acc8 - .long 0xa77d1810 - .long 0x6e639ce8 - .long 0x7bbb3bdb - .long 0x097826cd - .long 0xf418596e - .long 0x01b79aec - .long 0xa89a4f83 - .long 0x656e95e6 - .long 0x7ee6ffaa - .long 0x08cfbc21 - .long 0xe6e815ef - .long 0xd99be7ba - .long 0xce366f4a - .long 0xd4099fea - .long 0xd67cb029 - .long 0xafb2a431 - .long 0x31233f2a - .long 0x3094a5c6 - .long 0xc066a235 - .long 0x37bc4e74 - .long 0xa6ca82fc - .long 0xb0d090e0 - .long 0x15d8a733 - .long 0x4a9804f1 - .long 0xf7daec41 - .long 0x0e50cd7f - .long 0x2ff69117 - .long 0x8dd64d76 - .long 0x4db0ef43 - .long 0x544daacc - .long 0xdf0496e4 - .long 0xe3b5d19e - .long 0x1b886a4c - .long 0xb81f2cc1 - .long 0x7f516546 - .long 0x04ea5e9d - .long 0x5d358c01 - .long 0x737487fa - .long 0x2e410bfb - .long 0x5a1d67b3 - .long 0x52d2db92 - .long 0x335610e9 - .long 0x1347d66d - .long 0x8c61d79a - .long 0x7a0ca137 - .long 0x8e14f859 - .long 0x893c13eb - .long 0xee27a9ce - .long 0x35c961b7 - .long 0xede51ce1 - .long 0x3cb1477a - .long 0x59dfd29c - .long 0x3f73f255 - .long 0x79ce1418 - .long 0xbf37c773 - .long 0xeacdf753 - .long 0x5baafd5f - .long 0x146f3ddf - .long 0x86db4478 - .long 0x81f3afca - .long 0x3ec468b9 - .long 0x2c342438 - .long 0x5f40a3c2 - .long 0x72c31d16 - .long 0x0c25e2bc - .long 0x8b493c28 - .long 0x41950dff - .long 0x7101a839 - .long 0xdeb30c08 - .long 0x9ce4b4d8 - .long 0x90c15664 - .long 0x6184cb7b - .long 0x70b632d5 - .long 0x745c6c48 - .long 0x4257b8d0 - // Table 1. - .long 0xa7f45150 - .long 0x65417e53 - .long 0xa4171ac3 - .long 0x5e273a96 - .long 0x6bab3bcb - .long 0x459d1ff1 - .long 0x58faacab - .long 0x03e34b93 - .long 0xfa302055 - .long 0x6d76adf6 - .long 0x76cc8891 - .long 0x4c02f525 - .long 0xd7e54ffc - .long 0xcb2ac5d7 - .long 0x44352680 - .long 0xa362b58f - .long 0x5ab1de49 - .long 0x1bba2567 - .long 0x0eea4598 - .long 0xc0fe5de1 - .long 0x752fc302 - .long 0xf04c8112 - .long 0x97468da3 - .long 0xf9d36bc6 - .long 0x5f8f03e7 - .long 0x9c921595 - .long 0x7a6dbfeb - .long 0x595295da - .long 0x83bed42d - .long 0x217458d3 - .long 0x69e04929 - .long 0xc8c98e44 - .long 0x89c2756a - .long 0x798ef478 - .long 0x3e58996b - .long 0x71b927dd - .long 0x4fe1beb6 - .long 0xad88f017 - .long 0xac20c966 - .long 0x3ace7db4 - .long 0x4adf6318 - .long 0x311ae582 - .long 0x33519760 - .long 0x7f536245 - .long 0x7764b1e0 - .long 0xae6bbb84 - .long 0xa081fe1c - .long 0x2b08f994 - .long 0x68487058 - .long 0xfd458f19 - .long 0x6cde9487 - .long 0xf87b52b7 - .long 0xd373ab23 - .long 0x024b72e2 - .long 0x8f1fe357 - .long 0xab55662a - .long 0x28ebb207 - .long 0xc2b52f03 - .long 0x7bc5869a - .long 0x0837d3a5 - .long 0x872830f2 - .long 0xa5bf23b2 - .long 0x6a0302ba - .long 0x8216ed5c - .long 0x1ccf8a2b - .long 0xb479a792 - .long 0xf207f3f0 - .long 0xe2694ea1 - .long 0xf4da65cd - .long 0xbe0506d5 - .long 0x6234d11f - .long 0xfea6c48a - .long 0x532e349d - .long 0x55f3a2a0 - .long 0xe18a0532 - .long 0xebf6a475 - .long 0xec830b39 - .long 0xef6040aa - .long 0x9f715e06 - .long 0x106ebd51 - .long 0x8a213ef9 - .long 0x06dd963d - .long 0x053eddae - .long 0xbde64d46 - .long 0x8d5491b5 - .long 0x5dc47105 - .long 0xd406046f - .long 0x155060ff - .long 0xfb981924 - .long 0xe9bdd697 - .long 0x434089cc - .long 0x9ed96777 - .long 0x42e8b0bd - .long 0x8b890788 - .long 0x5b19e738 - .long 0xeec879db - .long 0x0a7ca147 - .long 0x0f427ce9 - .long 0x1e84f8c9 - .long 0x00000000 - .long 0x86800983 - .long 0xed2b3248 - .long 0x70111eac - .long 0x725a6c4e - .long 0xff0efdfb - .long 0x38850f56 - .long 0xd5ae3d1e - .long 0x392d3627 - .long 0xd90f0a64 - .long 0xa65c6821 - .long 0x545b9bd1 - .long 0x2e36243a - .long 0x670a0cb1 - .long 0xe757930f - .long 0x96eeb4d2 - .long 0x919b1b9e - .long 0xc5c0804f - .long 0x20dc61a2 - .long 0x4b775a69 - .long 0x1a121c16 - .long 0xba93e20a - .long 0x2aa0c0e5 - .long 0xe0223c43 - .long 0x171b121d - .long 0x0d090e0b - .long 0xc78bf2ad - .long 0xa8b62db9 - .long 0xa91e14c8 - .long 0x19f15785 - .long 0x0775af4c - .long 0xdd99eebb - .long 0x607fa3fd - .long 0x2601f79f - .long 0xf5725cbc - .long 0x3b6644c5 - .long 0x7efb5b34 - .long 0x29438b76 - .long 0xc623cbdc - .long 0xfcedb668 - .long 0xf1e4b863 - .long 0xdc31d7ca - .long 0x85634210 - .long 0x22971340 - .long 0x11c68420 - .long 0x244a857d - .long 0x3dbbd2f8 - .long 0x32f9ae11 - .long 0xa129c76d - .long 0x2f9e1d4b - .long 0x30b2dcf3 - .long 0x52860dec - .long 0xe3c177d0 - .long 0x16b32b6c - .long 0xb970a999 - .long 0x489411fa - .long 0x64e94722 - .long 0x8cfca8c4 - .long 0x3ff0a01a - .long 0x2c7d56d8 - .long 0x903322ef - .long 0x4e4987c7 - .long 0xd138d9c1 - .long 0xa2ca8cfe - .long 0x0bd49836 - .long 0x81f5a6cf - .long 0xde7aa528 - .long 0x8eb7da26 - .long 0xbfad3fa4 - .long 0x9d3a2ce4 - .long 0x9278500d - .long 0xcc5f6a9b - .long 0x467e5462 - .long 0x138df6c2 - .long 0xb8d890e8 - .long 0xf7392e5e - .long 0xafc382f5 - .long 0x805d9fbe - .long 0x93d0697c - .long 0x2dd56fa9 - .long 0x1225cfb3 - .long 0x99acc83b - .long 0x7d1810a7 - .long 0x639ce86e - .long 0xbb3bdb7b - .long 0x7826cd09 - .long 0x18596ef4 - .long 0xb79aec01 - .long 0x9a4f83a8 - .long 0x6e95e665 - .long 0xe6ffaa7e - .long 0xcfbc2108 - .long 0xe815efe6 - .long 0x9be7bad9 - .long 0x366f4ace - .long 0x099fead4 - .long 0x7cb029d6 - .long 0xb2a431af - .long 0x233f2a31 - .long 0x94a5c630 - .long 0x66a235c0 - .long 0xbc4e7437 - .long 0xca82fca6 - .long 0xd090e0b0 - .long 0xd8a73315 - .long 0x9804f14a - .long 0xdaec41f7 - .long 0x50cd7f0e - .long 0xf691172f - .long 0xd64d768d - .long 0xb0ef434d - .long 0x4daacc54 - .long 0x0496e4df - .long 0xb5d19ee3 - .long 0x886a4c1b - .long 0x1f2cc1b8 - .long 0x5165467f - .long 0xea5e9d04 - .long 0x358c015d - .long 0x7487fa73 - .long 0x410bfb2e - .long 0x1d67b35a - .long 0xd2db9252 - .long 0x5610e933 - .long 0x47d66d13 - .long 0x61d79a8c - .long 0x0ca1377a - .long 0x14f8598e - .long 0x3c13eb89 - .long 0x27a9ceee - .long 0xc961b735 - .long 0xe51ce1ed - .long 0xb1477a3c - .long 0xdfd29c59 - .long 0x73f2553f - .long 0xce141879 - .long 0x37c773bf - .long 0xcdf753ea - .long 0xaafd5f5b - .long 0x6f3ddf14 - .long 0xdb447886 - .long 0xf3afca81 - .long 0xc468b93e - .long 0x3424382c - .long 0x40a3c25f - .long 0xc31d1672 - .long 0x25e2bc0c - .long 0x493c288b - .long 0x950dff41 - .long 0x01a83971 - .long 0xb30c08de - .long 0xe4b4d89c - .long 0xc1566490 - .long 0x84cb7b61 - .long 0xb632d570 - .long 0x5c6c4874 - .long 0x57b8d042 - // Table 2. - .long 0xf45150a7 - .long 0x417e5365 - .long 0x171ac3a4 - .long 0x273a965e - .long 0xab3bcb6b - .long 0x9d1ff145 - .long 0xfaacab58 - .long 0xe34b9303 - .long 0x302055fa - .long 0x76adf66d - .long 0xcc889176 - .long 0x02f5254c - .long 0xe54ffcd7 - .long 0x2ac5d7cb - .long 0x35268044 - .long 0x62b58fa3 - .long 0xb1de495a - .long 0xba25671b - .long 0xea45980e - .long 0xfe5de1c0 - .long 0x2fc30275 - .long 0x4c8112f0 - .long 0x468da397 - .long 0xd36bc6f9 - .long 0x8f03e75f - .long 0x9215959c - .long 0x6dbfeb7a - .long 0x5295da59 - .long 0xbed42d83 - .long 0x7458d321 - .long 0xe0492969 - .long 0xc98e44c8 - .long 0xc2756a89 - .long 0x8ef47879 - .long 0x58996b3e - .long 0xb927dd71 - .long 0xe1beb64f - .long 0x88f017ad - .long 0x20c966ac - .long 0xce7db43a - .long 0xdf63184a - .long 0x1ae58231 - .long 0x51976033 - .long 0x5362457f - .long 0x64b1e077 - .long 0x6bbb84ae - .long 0x81fe1ca0 - .long 0x08f9942b - .long 0x48705868 - .long 0x458f19fd - .long 0xde94876c - .long 0x7b52b7f8 - .long 0x73ab23d3 - .long 0x4b72e202 - .long 0x1fe3578f - .long 0x55662aab - .long 0xebb20728 - .long 0xb52f03c2 - .long 0xc5869a7b - .long 0x37d3a508 - .long 0x2830f287 - .long 0xbf23b2a5 - .long 0x0302ba6a - .long 0x16ed5c82 - .long 0xcf8a2b1c - .long 0x79a792b4 - .long 0x07f3f0f2 - .long 0x694ea1e2 - .long 0xda65cdf4 - .long 0x0506d5be - .long 0x34d11f62 - .long 0xa6c48afe - .long 0x2e349d53 - .long 0xf3a2a055 - .long 0x8a0532e1 - .long 0xf6a475eb - .long 0x830b39ec - .long 0x6040aaef - .long 0x715e069f - .long 0x6ebd5110 - .long 0x213ef98a - .long 0xdd963d06 - .long 0x3eddae05 - .long 0xe64d46bd - .long 0x5491b58d - .long 0xc471055d - .long 0x06046fd4 - .long 0x5060ff15 - .long 0x981924fb - .long 0xbdd697e9 - .long 0x4089cc43 - .long 0xd967779e - .long 0xe8b0bd42 - .long 0x8907888b - .long 0x19e7385b - .long 0xc879dbee - .long 0x7ca1470a - .long 0x427ce90f - .long 0x84f8c91e - .long 0x00000000 - .long 0x80098386 - .long 0x2b3248ed - .long 0x111eac70 - .long 0x5a6c4e72 - .long 0x0efdfbff - .long 0x850f5638 - .long 0xae3d1ed5 - .long 0x2d362739 - .long 0x0f0a64d9 - .long 0x5c6821a6 - .long 0x5b9bd154 - .long 0x36243a2e - .long 0x0a0cb167 - .long 0x57930fe7 - .long 0xeeb4d296 - .long 0x9b1b9e91 - .long 0xc0804fc5 - .long 0xdc61a220 - .long 0x775a694b - .long 0x121c161a - .long 0x93e20aba - .long 0xa0c0e52a - .long 0x223c43e0 - .long 0x1b121d17 - .long 0x090e0b0d - .long 0x8bf2adc7 - .long 0xb62db9a8 - .long 0x1e14c8a9 - .long 0xf1578519 - .long 0x75af4c07 - .long 0x99eebbdd - .long 0x7fa3fd60 - .long 0x01f79f26 - .long 0x725cbcf5 - .long 0x6644c53b - .long 0xfb5b347e - .long 0x438b7629 - .long 0x23cbdcc6 - .long 0xedb668fc - .long 0xe4b863f1 - .long 0x31d7cadc - .long 0x63421085 - .long 0x97134022 - .long 0xc6842011 - .long 0x4a857d24 - .long 0xbbd2f83d - .long 0xf9ae1132 - .long 0x29c76da1 - .long 0x9e1d4b2f - .long 0xb2dcf330 - .long 0x860dec52 - .long 0xc177d0e3 - .long 0xb32b6c16 - .long 0x70a999b9 - .long 0x9411fa48 - .long 0xe9472264 - .long 0xfca8c48c - .long 0xf0a01a3f - .long 0x7d56d82c - .long 0x3322ef90 - .long 0x4987c74e - .long 0x38d9c1d1 - .long 0xca8cfea2 - .long 0xd498360b - .long 0xf5a6cf81 - .long 0x7aa528de - .long 0xb7da268e - .long 0xad3fa4bf - .long 0x3a2ce49d - .long 0x78500d92 - .long 0x5f6a9bcc - .long 0x7e546246 - .long 0x8df6c213 - .long 0xd890e8b8 - .long 0x392e5ef7 - .long 0xc382f5af - .long 0x5d9fbe80 - .long 0xd0697c93 - .long 0xd56fa92d - .long 0x25cfb312 - .long 0xacc83b99 - .long 0x1810a77d - .long 0x9ce86e63 - .long 0x3bdb7bbb - .long 0x26cd0978 - .long 0x596ef418 - .long 0x9aec01b7 - .long 0x4f83a89a - .long 0x95e6656e - .long 0xffaa7ee6 - .long 0xbc2108cf - .long 0x15efe6e8 - .long 0xe7bad99b - .long 0x6f4ace36 - .long 0x9fead409 - .long 0xb029d67c - .long 0xa431afb2 - .long 0x3f2a3123 - .long 0xa5c63094 - .long 0xa235c066 - .long 0x4e7437bc - .long 0x82fca6ca - .long 0x90e0b0d0 - .long 0xa73315d8 - .long 0x04f14a98 - .long 0xec41f7da - .long 0xcd7f0e50 - .long 0x91172ff6 - .long 0x4d768dd6 - .long 0xef434db0 - .long 0xaacc544d - .long 0x96e4df04 - .long 0xd19ee3b5 - .long 0x6a4c1b88 - .long 0x2cc1b81f - .long 0x65467f51 - .long 0x5e9d04ea - .long 0x8c015d35 - .long 0x87fa7374 - .long 0x0bfb2e41 - .long 0x67b35a1d - .long 0xdb9252d2 - .long 0x10e93356 - .long 0xd66d1347 - .long 0xd79a8c61 - .long 0xa1377a0c - .long 0xf8598e14 - .long 0x13eb893c - .long 0xa9ceee27 - .long 0x61b735c9 - .long 0x1ce1ede5 - .long 0x477a3cb1 - .long 0xd29c59df - .long 0xf2553f73 - .long 0x141879ce - .long 0xc773bf37 - .long 0xf753eacd - .long 0xfd5f5baa - .long 0x3ddf146f - .long 0x447886db - .long 0xafca81f3 - .long 0x68b93ec4 - .long 0x24382c34 - .long 0xa3c25f40 - .long 0x1d1672c3 - .long 0xe2bc0c25 - .long 0x3c288b49 - .long 0x0dff4195 - .long 0xa8397101 - .long 0x0c08deb3 - .long 0xb4d89ce4 - .long 0x566490c1 - .long 0xcb7b6184 - .long 0x32d570b6 - .long 0x6c48745c - .long 0xb8d04257 - // Table 3. - .long 0x5150a7f4 - .long 0x7e536541 - .long 0x1ac3a417 - .long 0x3a965e27 - .long 0x3bcb6bab - .long 0x1ff1459d - .long 0xacab58fa - .long 0x4b9303e3 - .long 0x2055fa30 - .long 0xadf66d76 - .long 0x889176cc - .long 0xf5254c02 - .long 0x4ffcd7e5 - .long 0xc5d7cb2a - .long 0x26804435 - .long 0xb58fa362 - .long 0xde495ab1 - .long 0x25671bba - .long 0x45980eea - .long 0x5de1c0fe - .long 0xc302752f - .long 0x8112f04c - .long 0x8da39746 - .long 0x6bc6f9d3 - .long 0x03e75f8f - .long 0x15959c92 - .long 0xbfeb7a6d - .long 0x95da5952 - .long 0xd42d83be - .long 0x58d32174 - .long 0x492969e0 - .long 0x8e44c8c9 - .long 0x756a89c2 - .long 0xf478798e - .long 0x996b3e58 - .long 0x27dd71b9 - .long 0xbeb64fe1 - .long 0xf017ad88 - .long 0xc966ac20 - .long 0x7db43ace - .long 0x63184adf - .long 0xe582311a - .long 0x97603351 - .long 0x62457f53 - .long 0xb1e07764 - .long 0xbb84ae6b - .long 0xfe1ca081 - .long 0xf9942b08 - .long 0x70586848 - .long 0x8f19fd45 - .long 0x94876cde - .long 0x52b7f87b - .long 0xab23d373 - .long 0x72e2024b - .long 0xe3578f1f - .long 0x662aab55 - .long 0xb20728eb - .long 0x2f03c2b5 - .long 0x869a7bc5 - .long 0xd3a50837 - .long 0x30f28728 - .long 0x23b2a5bf - .long 0x02ba6a03 - .long 0xed5c8216 - .long 0x8a2b1ccf - .long 0xa792b479 - .long 0xf3f0f207 - .long 0x4ea1e269 - .long 0x65cdf4da - .long 0x06d5be05 - .long 0xd11f6234 - .long 0xc48afea6 - .long 0x349d532e - .long 0xa2a055f3 - .long 0x0532e18a - .long 0xa475ebf6 - .long 0x0b39ec83 - .long 0x40aaef60 - .long 0x5e069f71 - .long 0xbd51106e - .long 0x3ef98a21 - .long 0x963d06dd - .long 0xddae053e - .long 0x4d46bde6 - .long 0x91b58d54 - .long 0x71055dc4 - .long 0x046fd406 - .long 0x60ff1550 - .long 0x1924fb98 - .long 0xd697e9bd - .long 0x89cc4340 - .long 0x67779ed9 - .long 0xb0bd42e8 - .long 0x07888b89 - .long 0xe7385b19 - .long 0x79dbeec8 - .long 0xa1470a7c - .long 0x7ce90f42 - .long 0xf8c91e84 - .long 0x00000000 - .long 0x09838680 - .long 0x3248ed2b - .long 0x1eac7011 - .long 0x6c4e725a - .long 0xfdfbff0e - .long 0x0f563885 - .long 0x3d1ed5ae - .long 0x3627392d - .long 0x0a64d90f - .long 0x6821a65c - .long 0x9bd1545b - .long 0x243a2e36 - .long 0x0cb1670a - .long 0x930fe757 - .long 0xb4d296ee - .long 0x1b9e919b - .long 0x804fc5c0 - .long 0x61a220dc - .long 0x5a694b77 - .long 0x1c161a12 - .long 0xe20aba93 - .long 0xc0e52aa0 - .long 0x3c43e022 - .long 0x121d171b - .long 0x0e0b0d09 - .long 0xf2adc78b - .long 0x2db9a8b6 - .long 0x14c8a91e - .long 0x578519f1 - .long 0xaf4c0775 - .long 0xeebbdd99 - .long 0xa3fd607f - .long 0xf79f2601 - .long 0x5cbcf572 - .long 0x44c53b66 - .long 0x5b347efb - .long 0x8b762943 - .long 0xcbdcc623 - .long 0xb668fced - .long 0xb863f1e4 - .long 0xd7cadc31 - .long 0x42108563 - .long 0x13402297 - .long 0x842011c6 - .long 0x857d244a - .long 0xd2f83dbb - .long 0xae1132f9 - .long 0xc76da129 - .long 0x1d4b2f9e - .long 0xdcf330b2 - .long 0x0dec5286 - .long 0x77d0e3c1 - .long 0x2b6c16b3 - .long 0xa999b970 - .long 0x11fa4894 - .long 0x472264e9 - .long 0xa8c48cfc - .long 0xa01a3ff0 - .long 0x56d82c7d - .long 0x22ef9033 - .long 0x87c74e49 - .long 0xd9c1d138 - .long 0x8cfea2ca - .long 0x98360bd4 - .long 0xa6cf81f5 - .long 0xa528de7a - .long 0xda268eb7 - .long 0x3fa4bfad - .long 0x2ce49d3a - .long 0x500d9278 - .long 0x6a9bcc5f - .long 0x5462467e - .long 0xf6c2138d - .long 0x90e8b8d8 - .long 0x2e5ef739 - .long 0x82f5afc3 - .long 0x9fbe805d - .long 0x697c93d0 - .long 0x6fa92dd5 - .long 0xcfb31225 - .long 0xc83b99ac - .long 0x10a77d18 - .long 0xe86e639c - .long 0xdb7bbb3b - .long 0xcd097826 - .long 0x6ef41859 - .long 0xec01b79a - .long 0x83a89a4f - .long 0xe6656e95 - .long 0xaa7ee6ff - .long 0x2108cfbc - .long 0xefe6e815 - .long 0xbad99be7 - .long 0x4ace366f - .long 0xead4099f - .long 0x29d67cb0 - .long 0x31afb2a4 - .long 0x2a31233f - .long 0xc63094a5 - .long 0x35c066a2 - .long 0x7437bc4e - .long 0xfca6ca82 - .long 0xe0b0d090 - .long 0x3315d8a7 - .long 0xf14a9804 - .long 0x41f7daec - .long 0x7f0e50cd - .long 0x172ff691 - .long 0x768dd64d - .long 0x434db0ef - .long 0xcc544daa - .long 0xe4df0496 - .long 0x9ee3b5d1 - .long 0x4c1b886a - .long 0xc1b81f2c - .long 0x467f5165 - .long 0x9d04ea5e - .long 0x015d358c - .long 0xfa737487 - .long 0xfb2e410b - .long 0xb35a1d67 - .long 0x9252d2db - .long 0xe9335610 - .long 0x6d1347d6 - .long 0x9a8c61d7 - .long 0x377a0ca1 - .long 0x598e14f8 - .long 0xeb893c13 - .long 0xceee27a9 - .long 0xb735c961 - .long 0xe1ede51c - .long 0x7a3cb147 - .long 0x9c59dfd2 - .long 0x553f73f2 - .long 0x1879ce14 - .long 0x73bf37c7 - .long 0x53eacdf7 - .long 0x5f5baafd - .long 0xdf146f3d - .long 0x7886db44 - .long 0xca81f3af - .long 0xb93ec468 - .long 0x382c3424 - .long 0xc25f40a3 - .long 0x1672c31d - .long 0xbc0c25e2 - .long 0x288b493c - .long 0xff41950d - .long 0x397101a8 - .long 0x08deb30c - .long 0xd89ce4b4 - .long 0x6490c156 - .long 0x7b6184cb - .long 0xd570b632 - .long 0x48745c6c - .long 0xd04257b8 - - -// SubBytes embedded in words tables. - .globl _OLDAESSubBytesWordTable - .private_extern _OLDAESSubBytesWordTable - .align 2 -_OLDAESSubBytesWordTable: - // Table 0. - .long 0x00000063 - .long 0x0000007c - .long 0x00000077 - .long 0x0000007b - .long 0x000000f2 - .long 0x0000006b - .long 0x0000006f - .long 0x000000c5 - .long 0x00000030 - .long 0x00000001 - .long 0x00000067 - .long 0x0000002b - .long 0x000000fe - .long 0x000000d7 - .long 0x000000ab - .long 0x00000076 - .long 0x000000ca - .long 0x00000082 - .long 0x000000c9 - .long 0x0000007d - .long 0x000000fa - .long 0x00000059 - .long 0x00000047 - .long 0x000000f0 - .long 0x000000ad - .long 0x000000d4 - .long 0x000000a2 - .long 0x000000af - .long 0x0000009c - .long 0x000000a4 - .long 0x00000072 - .long 0x000000c0 - .long 0x000000b7 - .long 0x000000fd - .long 0x00000093 - .long 0x00000026 - .long 0x00000036 - .long 0x0000003f - .long 0x000000f7 - .long 0x000000cc - .long 0x00000034 - .long 0x000000a5 - .long 0x000000e5 - .long 0x000000f1 - .long 0x00000071 - .long 0x000000d8 - .long 0x00000031 - .long 0x00000015 - .long 0x00000004 - .long 0x000000c7 - .long 0x00000023 - .long 0x000000c3 - .long 0x00000018 - .long 0x00000096 - .long 0x00000005 - .long 0x0000009a - .long 0x00000007 - .long 0x00000012 - .long 0x00000080 - .long 0x000000e2 - .long 0x000000eb - .long 0x00000027 - .long 0x000000b2 - .long 0x00000075 - .long 0x00000009 - .long 0x00000083 - .long 0x0000002c - .long 0x0000001a - .long 0x0000001b - .long 0x0000006e - .long 0x0000005a - .long 0x000000a0 - .long 0x00000052 - .long 0x0000003b - .long 0x000000d6 - .long 0x000000b3 - .long 0x00000029 - .long 0x000000e3 - .long 0x0000002f - .long 0x00000084 - .long 0x00000053 - .long 0x000000d1 - .long 0x00000000 - .long 0x000000ed - .long 0x00000020 - .long 0x000000fc - .long 0x000000b1 - .long 0x0000005b - .long 0x0000006a - .long 0x000000cb - .long 0x000000be - .long 0x00000039 - .long 0x0000004a - .long 0x0000004c - .long 0x00000058 - .long 0x000000cf - .long 0x000000d0 - .long 0x000000ef - .long 0x000000aa - .long 0x000000fb - .long 0x00000043 - .long 0x0000004d - .long 0x00000033 - .long 0x00000085 - .long 0x00000045 - .long 0x000000f9 - .long 0x00000002 - .long 0x0000007f - .long 0x00000050 - .long 0x0000003c - .long 0x0000009f - .long 0x000000a8 - .long 0x00000051 - .long 0x000000a3 - .long 0x00000040 - .long 0x0000008f - .long 0x00000092 - .long 0x0000009d - .long 0x00000038 - .long 0x000000f5 - .long 0x000000bc - .long 0x000000b6 - .long 0x000000da - .long 0x00000021 - .long 0x00000010 - .long 0x000000ff - .long 0x000000f3 - .long 0x000000d2 - .long 0x000000cd - .long 0x0000000c - .long 0x00000013 - .long 0x000000ec - .long 0x0000005f - .long 0x00000097 - .long 0x00000044 - .long 0x00000017 - .long 0x000000c4 - .long 0x000000a7 - .long 0x0000007e - .long 0x0000003d - .long 0x00000064 - .long 0x0000005d - .long 0x00000019 - .long 0x00000073 - .long 0x00000060 - .long 0x00000081 - .long 0x0000004f - .long 0x000000dc - .long 0x00000022 - .long 0x0000002a - .long 0x00000090 - .long 0x00000088 - .long 0x00000046 - .long 0x000000ee - .long 0x000000b8 - .long 0x00000014 - .long 0x000000de - .long 0x0000005e - .long 0x0000000b - .long 0x000000db - .long 0x000000e0 - .long 0x00000032 - .long 0x0000003a - .long 0x0000000a - .long 0x00000049 - .long 0x00000006 - .long 0x00000024 - .long 0x0000005c - .long 0x000000c2 - .long 0x000000d3 - .long 0x000000ac - .long 0x00000062 - .long 0x00000091 - .long 0x00000095 - .long 0x000000e4 - .long 0x00000079 - .long 0x000000e7 - .long 0x000000c8 - .long 0x00000037 - .long 0x0000006d - .long 0x0000008d - .long 0x000000d5 - .long 0x0000004e - .long 0x000000a9 - .long 0x0000006c - .long 0x00000056 - .long 0x000000f4 - .long 0x000000ea - .long 0x00000065 - .long 0x0000007a - .long 0x000000ae - .long 0x00000008 - .long 0x000000ba - .long 0x00000078 - .long 0x00000025 - .long 0x0000002e - .long 0x0000001c - .long 0x000000a6 - .long 0x000000b4 - .long 0x000000c6 - .long 0x000000e8 - .long 0x000000dd - .long 0x00000074 - .long 0x0000001f - .long 0x0000004b - .long 0x000000bd - .long 0x0000008b - .long 0x0000008a - .long 0x00000070 - .long 0x0000003e - .long 0x000000b5 - .long 0x00000066 - .long 0x00000048 - .long 0x00000003 - .long 0x000000f6 - .long 0x0000000e - .long 0x00000061 - .long 0x00000035 - .long 0x00000057 - .long 0x000000b9 - .long 0x00000086 - .long 0x000000c1 - .long 0x0000001d - .long 0x0000009e - .long 0x000000e1 - .long 0x000000f8 - .long 0x00000098 - .long 0x00000011 - .long 0x00000069 - .long 0x000000d9 - .long 0x0000008e - .long 0x00000094 - .long 0x0000009b - .long 0x0000001e - .long 0x00000087 - .long 0x000000e9 - .long 0x000000ce - .long 0x00000055 - .long 0x00000028 - .long 0x000000df - .long 0x0000008c - .long 0x000000a1 - .long 0x00000089 - .long 0x0000000d - .long 0x000000bf - .long 0x000000e6 - .long 0x00000042 - .long 0x00000068 - .long 0x00000041 - .long 0x00000099 - .long 0x0000002d - .long 0x0000000f - .long 0x000000b0 - .long 0x00000054 - .long 0x000000bb - .long 0x00000016 - // Table 1. - .long 0x00006300 - .long 0x00007c00 - .long 0x00007700 - .long 0x00007b00 - .long 0x0000f200 - .long 0x00006b00 - .long 0x00006f00 - .long 0x0000c500 - .long 0x00003000 - .long 0x00000100 - .long 0x00006700 - .long 0x00002b00 - .long 0x0000fe00 - .long 0x0000d700 - .long 0x0000ab00 - .long 0x00007600 - .long 0x0000ca00 - .long 0x00008200 - .long 0x0000c900 - .long 0x00007d00 - .long 0x0000fa00 - .long 0x00005900 - .long 0x00004700 - .long 0x0000f000 - .long 0x0000ad00 - .long 0x0000d400 - .long 0x0000a200 - .long 0x0000af00 - .long 0x00009c00 - .long 0x0000a400 - .long 0x00007200 - .long 0x0000c000 - .long 0x0000b700 - .long 0x0000fd00 - .long 0x00009300 - .long 0x00002600 - .long 0x00003600 - .long 0x00003f00 - .long 0x0000f700 - .long 0x0000cc00 - .long 0x00003400 - .long 0x0000a500 - .long 0x0000e500 - .long 0x0000f100 - .long 0x00007100 - .long 0x0000d800 - .long 0x00003100 - .long 0x00001500 - .long 0x00000400 - .long 0x0000c700 - .long 0x00002300 - .long 0x0000c300 - .long 0x00001800 - .long 0x00009600 - .long 0x00000500 - .long 0x00009a00 - .long 0x00000700 - .long 0x00001200 - .long 0x00008000 - .long 0x0000e200 - .long 0x0000eb00 - .long 0x00002700 - .long 0x0000b200 - .long 0x00007500 - .long 0x00000900 - .long 0x00008300 - .long 0x00002c00 - .long 0x00001a00 - .long 0x00001b00 - .long 0x00006e00 - .long 0x00005a00 - .long 0x0000a000 - .long 0x00005200 - .long 0x00003b00 - .long 0x0000d600 - .long 0x0000b300 - .long 0x00002900 - .long 0x0000e300 - .long 0x00002f00 - .long 0x00008400 - .long 0x00005300 - .long 0x0000d100 - .long 0x00000000 - .long 0x0000ed00 - .long 0x00002000 - .long 0x0000fc00 - .long 0x0000b100 - .long 0x00005b00 - .long 0x00006a00 - .long 0x0000cb00 - .long 0x0000be00 - .long 0x00003900 - .long 0x00004a00 - .long 0x00004c00 - .long 0x00005800 - .long 0x0000cf00 - .long 0x0000d000 - .long 0x0000ef00 - .long 0x0000aa00 - .long 0x0000fb00 - .long 0x00004300 - .long 0x00004d00 - .long 0x00003300 - .long 0x00008500 - .long 0x00004500 - .long 0x0000f900 - .long 0x00000200 - .long 0x00007f00 - .long 0x00005000 - .long 0x00003c00 - .long 0x00009f00 - .long 0x0000a800 - .long 0x00005100 - .long 0x0000a300 - .long 0x00004000 - .long 0x00008f00 - .long 0x00009200 - .long 0x00009d00 - .long 0x00003800 - .long 0x0000f500 - .long 0x0000bc00 - .long 0x0000b600 - .long 0x0000da00 - .long 0x00002100 - .long 0x00001000 - .long 0x0000ff00 - .long 0x0000f300 - .long 0x0000d200 - .long 0x0000cd00 - .long 0x00000c00 - .long 0x00001300 - .long 0x0000ec00 - .long 0x00005f00 - .long 0x00009700 - .long 0x00004400 - .long 0x00001700 - .long 0x0000c400 - .long 0x0000a700 - .long 0x00007e00 - .long 0x00003d00 - .long 0x00006400 - .long 0x00005d00 - .long 0x00001900 - .long 0x00007300 - .long 0x00006000 - .long 0x00008100 - .long 0x00004f00 - .long 0x0000dc00 - .long 0x00002200 - .long 0x00002a00 - .long 0x00009000 - .long 0x00008800 - .long 0x00004600 - .long 0x0000ee00 - .long 0x0000b800 - .long 0x00001400 - .long 0x0000de00 - .long 0x00005e00 - .long 0x00000b00 - .long 0x0000db00 - .long 0x0000e000 - .long 0x00003200 - .long 0x00003a00 - .long 0x00000a00 - .long 0x00004900 - .long 0x00000600 - .long 0x00002400 - .long 0x00005c00 - .long 0x0000c200 - .long 0x0000d300 - .long 0x0000ac00 - .long 0x00006200 - .long 0x00009100 - .long 0x00009500 - .long 0x0000e400 - .long 0x00007900 - .long 0x0000e700 - .long 0x0000c800 - .long 0x00003700 - .long 0x00006d00 - .long 0x00008d00 - .long 0x0000d500 - .long 0x00004e00 - .long 0x0000a900 - .long 0x00006c00 - .long 0x00005600 - .long 0x0000f400 - .long 0x0000ea00 - .long 0x00006500 - .long 0x00007a00 - .long 0x0000ae00 - .long 0x00000800 - .long 0x0000ba00 - .long 0x00007800 - .long 0x00002500 - .long 0x00002e00 - .long 0x00001c00 - .long 0x0000a600 - .long 0x0000b400 - .long 0x0000c600 - .long 0x0000e800 - .long 0x0000dd00 - .long 0x00007400 - .long 0x00001f00 - .long 0x00004b00 - .long 0x0000bd00 - .long 0x00008b00 - .long 0x00008a00 - .long 0x00007000 - .long 0x00003e00 - .long 0x0000b500 - .long 0x00006600 - .long 0x00004800 - .long 0x00000300 - .long 0x0000f600 - .long 0x00000e00 - .long 0x00006100 - .long 0x00003500 - .long 0x00005700 - .long 0x0000b900 - .long 0x00008600 - .long 0x0000c100 - .long 0x00001d00 - .long 0x00009e00 - .long 0x0000e100 - .long 0x0000f800 - .long 0x00009800 - .long 0x00001100 - .long 0x00006900 - .long 0x0000d900 - .long 0x00008e00 - .long 0x00009400 - .long 0x00009b00 - .long 0x00001e00 - .long 0x00008700 - .long 0x0000e900 - .long 0x0000ce00 - .long 0x00005500 - .long 0x00002800 - .long 0x0000df00 - .long 0x00008c00 - .long 0x0000a100 - .long 0x00008900 - .long 0x00000d00 - .long 0x0000bf00 - .long 0x0000e600 - .long 0x00004200 - .long 0x00006800 - .long 0x00004100 - .long 0x00009900 - .long 0x00002d00 - .long 0x00000f00 - .long 0x0000b000 - .long 0x00005400 - .long 0x0000bb00 - .long 0x00001600 - // Table 2. - .long 0x00630000 - .long 0x007c0000 - .long 0x00770000 - .long 0x007b0000 - .long 0x00f20000 - .long 0x006b0000 - .long 0x006f0000 - .long 0x00c50000 - .long 0x00300000 - .long 0x00010000 - .long 0x00670000 - .long 0x002b0000 - .long 0x00fe0000 - .long 0x00d70000 - .long 0x00ab0000 - .long 0x00760000 - .long 0x00ca0000 - .long 0x00820000 - .long 0x00c90000 - .long 0x007d0000 - .long 0x00fa0000 - .long 0x00590000 - .long 0x00470000 - .long 0x00f00000 - .long 0x00ad0000 - .long 0x00d40000 - .long 0x00a20000 - .long 0x00af0000 - .long 0x009c0000 - .long 0x00a40000 - .long 0x00720000 - .long 0x00c00000 - .long 0x00b70000 - .long 0x00fd0000 - .long 0x00930000 - .long 0x00260000 - .long 0x00360000 - .long 0x003f0000 - .long 0x00f70000 - .long 0x00cc0000 - .long 0x00340000 - .long 0x00a50000 - .long 0x00e50000 - .long 0x00f10000 - .long 0x00710000 - .long 0x00d80000 - .long 0x00310000 - .long 0x00150000 - .long 0x00040000 - .long 0x00c70000 - .long 0x00230000 - .long 0x00c30000 - .long 0x00180000 - .long 0x00960000 - .long 0x00050000 - .long 0x009a0000 - .long 0x00070000 - .long 0x00120000 - .long 0x00800000 - .long 0x00e20000 - .long 0x00eb0000 - .long 0x00270000 - .long 0x00b20000 - .long 0x00750000 - .long 0x00090000 - .long 0x00830000 - .long 0x002c0000 - .long 0x001a0000 - .long 0x001b0000 - .long 0x006e0000 - .long 0x005a0000 - .long 0x00a00000 - .long 0x00520000 - .long 0x003b0000 - .long 0x00d60000 - .long 0x00b30000 - .long 0x00290000 - .long 0x00e30000 - .long 0x002f0000 - .long 0x00840000 - .long 0x00530000 - .long 0x00d10000 - .long 0x00000000 - .long 0x00ed0000 - .long 0x00200000 - .long 0x00fc0000 - .long 0x00b10000 - .long 0x005b0000 - .long 0x006a0000 - .long 0x00cb0000 - .long 0x00be0000 - .long 0x00390000 - .long 0x004a0000 - .long 0x004c0000 - .long 0x00580000 - .long 0x00cf0000 - .long 0x00d00000 - .long 0x00ef0000 - .long 0x00aa0000 - .long 0x00fb0000 - .long 0x00430000 - .long 0x004d0000 - .long 0x00330000 - .long 0x00850000 - .long 0x00450000 - .long 0x00f90000 - .long 0x00020000 - .long 0x007f0000 - .long 0x00500000 - .long 0x003c0000 - .long 0x009f0000 - .long 0x00a80000 - .long 0x00510000 - .long 0x00a30000 - .long 0x00400000 - .long 0x008f0000 - .long 0x00920000 - .long 0x009d0000 - .long 0x00380000 - .long 0x00f50000 - .long 0x00bc0000 - .long 0x00b60000 - .long 0x00da0000 - .long 0x00210000 - .long 0x00100000 - .long 0x00ff0000 - .long 0x00f30000 - .long 0x00d20000 - .long 0x00cd0000 - .long 0x000c0000 - .long 0x00130000 - .long 0x00ec0000 - .long 0x005f0000 - .long 0x00970000 - .long 0x00440000 - .long 0x00170000 - .long 0x00c40000 - .long 0x00a70000 - .long 0x007e0000 - .long 0x003d0000 - .long 0x00640000 - .long 0x005d0000 - .long 0x00190000 - .long 0x00730000 - .long 0x00600000 - .long 0x00810000 - .long 0x004f0000 - .long 0x00dc0000 - .long 0x00220000 - .long 0x002a0000 - .long 0x00900000 - .long 0x00880000 - .long 0x00460000 - .long 0x00ee0000 - .long 0x00b80000 - .long 0x00140000 - .long 0x00de0000 - .long 0x005e0000 - .long 0x000b0000 - .long 0x00db0000 - .long 0x00e00000 - .long 0x00320000 - .long 0x003a0000 - .long 0x000a0000 - .long 0x00490000 - .long 0x00060000 - .long 0x00240000 - .long 0x005c0000 - .long 0x00c20000 - .long 0x00d30000 - .long 0x00ac0000 - .long 0x00620000 - .long 0x00910000 - .long 0x00950000 - .long 0x00e40000 - .long 0x00790000 - .long 0x00e70000 - .long 0x00c80000 - .long 0x00370000 - .long 0x006d0000 - .long 0x008d0000 - .long 0x00d50000 - .long 0x004e0000 - .long 0x00a90000 - .long 0x006c0000 - .long 0x00560000 - .long 0x00f40000 - .long 0x00ea0000 - .long 0x00650000 - .long 0x007a0000 - .long 0x00ae0000 - .long 0x00080000 - .long 0x00ba0000 - .long 0x00780000 - .long 0x00250000 - .long 0x002e0000 - .long 0x001c0000 - .long 0x00a60000 - .long 0x00b40000 - .long 0x00c60000 - .long 0x00e80000 - .long 0x00dd0000 - .long 0x00740000 - .long 0x001f0000 - .long 0x004b0000 - .long 0x00bd0000 - .long 0x008b0000 - .long 0x008a0000 - .long 0x00700000 - .long 0x003e0000 - .long 0x00b50000 - .long 0x00660000 - .long 0x00480000 - .long 0x00030000 - .long 0x00f60000 - .long 0x000e0000 - .long 0x00610000 - .long 0x00350000 - .long 0x00570000 - .long 0x00b90000 - .long 0x00860000 - .long 0x00c10000 - .long 0x001d0000 - .long 0x009e0000 - .long 0x00e10000 - .long 0x00f80000 - .long 0x00980000 - .long 0x00110000 - .long 0x00690000 - .long 0x00d90000 - .long 0x008e0000 - .long 0x00940000 - .long 0x009b0000 - .long 0x001e0000 - .long 0x00870000 - .long 0x00e90000 - .long 0x00ce0000 - .long 0x00550000 - .long 0x00280000 - .long 0x00df0000 - .long 0x008c0000 - .long 0x00a10000 - .long 0x00890000 - .long 0x000d0000 - .long 0x00bf0000 - .long 0x00e60000 - .long 0x00420000 - .long 0x00680000 - .long 0x00410000 - .long 0x00990000 - .long 0x002d0000 - .long 0x000f0000 - .long 0x00b00000 - .long 0x00540000 - .long 0x00bb0000 - .long 0x00160000 - // Table 3. - .long 0x63000000 - .long 0x7c000000 - .long 0x77000000 - .long 0x7b000000 - .long 0xf2000000 - .long 0x6b000000 - .long 0x6f000000 - .long 0xc5000000 - .long 0x30000000 - .long 0x01000000 - .long 0x67000000 - .long 0x2b000000 - .long 0xfe000000 - .long 0xd7000000 - .long 0xab000000 - .long 0x76000000 - .long 0xca000000 - .long 0x82000000 - .long 0xc9000000 - .long 0x7d000000 - .long 0xfa000000 - .long 0x59000000 - .long 0x47000000 - .long 0xf0000000 - .long 0xad000000 - .long 0xd4000000 - .long 0xa2000000 - .long 0xaf000000 - .long 0x9c000000 - .long 0xa4000000 - .long 0x72000000 - .long 0xc0000000 - .long 0xb7000000 - .long 0xfd000000 - .long 0x93000000 - .long 0x26000000 - .long 0x36000000 - .long 0x3f000000 - .long 0xf7000000 - .long 0xcc000000 - .long 0x34000000 - .long 0xa5000000 - .long 0xe5000000 - .long 0xf1000000 - .long 0x71000000 - .long 0xd8000000 - .long 0x31000000 - .long 0x15000000 - .long 0x04000000 - .long 0xc7000000 - .long 0x23000000 - .long 0xc3000000 - .long 0x18000000 - .long 0x96000000 - .long 0x05000000 - .long 0x9a000000 - .long 0x07000000 - .long 0x12000000 - .long 0x80000000 - .long 0xe2000000 - .long 0xeb000000 - .long 0x27000000 - .long 0xb2000000 - .long 0x75000000 - .long 0x09000000 - .long 0x83000000 - .long 0x2c000000 - .long 0x1a000000 - .long 0x1b000000 - .long 0x6e000000 - .long 0x5a000000 - .long 0xa0000000 - .long 0x52000000 - .long 0x3b000000 - .long 0xd6000000 - .long 0xb3000000 - .long 0x29000000 - .long 0xe3000000 - .long 0x2f000000 - .long 0x84000000 - .long 0x53000000 - .long 0xd1000000 - .long 0x00000000 - .long 0xed000000 - .long 0x20000000 - .long 0xfc000000 - .long 0xb1000000 - .long 0x5b000000 - .long 0x6a000000 - .long 0xcb000000 - .long 0xbe000000 - .long 0x39000000 - .long 0x4a000000 - .long 0x4c000000 - .long 0x58000000 - .long 0xcf000000 - .long 0xd0000000 - .long 0xef000000 - .long 0xaa000000 - .long 0xfb000000 - .long 0x43000000 - .long 0x4d000000 - .long 0x33000000 - .long 0x85000000 - .long 0x45000000 - .long 0xf9000000 - .long 0x02000000 - .long 0x7f000000 - .long 0x50000000 - .long 0x3c000000 - .long 0x9f000000 - .long 0xa8000000 - .long 0x51000000 - .long 0xa3000000 - .long 0x40000000 - .long 0x8f000000 - .long 0x92000000 - .long 0x9d000000 - .long 0x38000000 - .long 0xf5000000 - .long 0xbc000000 - .long 0xb6000000 - .long 0xda000000 - .long 0x21000000 - .long 0x10000000 - .long 0xff000000 - .long 0xf3000000 - .long 0xd2000000 - .long 0xcd000000 - .long 0x0c000000 - .long 0x13000000 - .long 0xec000000 - .long 0x5f000000 - .long 0x97000000 - .long 0x44000000 - .long 0x17000000 - .long 0xc4000000 - .long 0xa7000000 - .long 0x7e000000 - .long 0x3d000000 - .long 0x64000000 - .long 0x5d000000 - .long 0x19000000 - .long 0x73000000 - .long 0x60000000 - .long 0x81000000 - .long 0x4f000000 - .long 0xdc000000 - .long 0x22000000 - .long 0x2a000000 - .long 0x90000000 - .long 0x88000000 - .long 0x46000000 - .long 0xee000000 - .long 0xb8000000 - .long 0x14000000 - .long 0xde000000 - .long 0x5e000000 - .long 0x0b000000 - .long 0xdb000000 - .long 0xe0000000 - .long 0x32000000 - .long 0x3a000000 - .long 0x0a000000 - .long 0x49000000 - .long 0x06000000 - .long 0x24000000 - .long 0x5c000000 - .long 0xc2000000 - .long 0xd3000000 - .long 0xac000000 - .long 0x62000000 - .long 0x91000000 - .long 0x95000000 - .long 0xe4000000 - .long 0x79000000 - .long 0xe7000000 - .long 0xc8000000 - .long 0x37000000 - .long 0x6d000000 - .long 0x8d000000 - .long 0xd5000000 - .long 0x4e000000 - .long 0xa9000000 - .long 0x6c000000 - .long 0x56000000 - .long 0xf4000000 - .long 0xea000000 - .long 0x65000000 - .long 0x7a000000 - .long 0xae000000 - .long 0x08000000 - .long 0xba000000 - .long 0x78000000 - .long 0x25000000 - .long 0x2e000000 - .long 0x1c000000 - .long 0xa6000000 - .long 0xb4000000 - .long 0xc6000000 - .long 0xe8000000 - .long 0xdd000000 - .long 0x74000000 - .long 0x1f000000 - .long 0x4b000000 - .long 0xbd000000 - .long 0x8b000000 - .long 0x8a000000 - .long 0x70000000 - .long 0x3e000000 - .long 0xb5000000 - .long 0x66000000 - .long 0x48000000 - .long 0x03000000 - .long 0xf6000000 - .long 0x0e000000 - .long 0x61000000 - .long 0x35000000 - .long 0x57000000 - .long 0xb9000000 - .long 0x86000000 - .long 0xc1000000 - .long 0x1d000000 - .long 0x9e000000 - .long 0xe1000000 - .long 0xf8000000 - .long 0x98000000 - .long 0x11000000 - .long 0x69000000 - .long 0xd9000000 - .long 0x8e000000 - .long 0x94000000 - .long 0x9b000000 - .long 0x1e000000 - .long 0x87000000 - .long 0xe9000000 - .long 0xce000000 - .long 0x55000000 - .long 0x28000000 - .long 0xdf000000 - .long 0x8c000000 - .long 0xa1000000 - .long 0x89000000 - .long 0x0d000000 - .long 0xbf000000 - .long 0xe6000000 - .long 0x42000000 - .long 0x68000000 - .long 0x41000000 - .long 0x99000000 - .long 0x2d000000 - .long 0x0f000000 - .long 0xb0000000 - .long 0x54000000 - .long 0xbb000000 - .long 0x16000000 - - -// InvSubBytes embedded in words tables. - .globl _OLDAESInvSubBytesWordTable - .private_extern _OLDAESInvSubBytesWordTable - .align 2 -_OLDAESInvSubBytesWordTable: - // Table 0. - .long 0x00000052 - .long 0x00000009 - .long 0x0000006a - .long 0x000000d5 - .long 0x00000030 - .long 0x00000036 - .long 0x000000a5 - .long 0x00000038 - .long 0x000000bf - .long 0x00000040 - .long 0x000000a3 - .long 0x0000009e - .long 0x00000081 - .long 0x000000f3 - .long 0x000000d7 - .long 0x000000fb - .long 0x0000007c - .long 0x000000e3 - .long 0x00000039 - .long 0x00000082 - .long 0x0000009b - .long 0x0000002f - .long 0x000000ff - .long 0x00000087 - .long 0x00000034 - .long 0x0000008e - .long 0x00000043 - .long 0x00000044 - .long 0x000000c4 - .long 0x000000de - .long 0x000000e9 - .long 0x000000cb - .long 0x00000054 - .long 0x0000007b - .long 0x00000094 - .long 0x00000032 - .long 0x000000a6 - .long 0x000000c2 - .long 0x00000023 - .long 0x0000003d - .long 0x000000ee - .long 0x0000004c - .long 0x00000095 - .long 0x0000000b - .long 0x00000042 - .long 0x000000fa - .long 0x000000c3 - .long 0x0000004e - .long 0x00000008 - .long 0x0000002e - .long 0x000000a1 - .long 0x00000066 - .long 0x00000028 - .long 0x000000d9 - .long 0x00000024 - .long 0x000000b2 - .long 0x00000076 - .long 0x0000005b - .long 0x000000a2 - .long 0x00000049 - .long 0x0000006d - .long 0x0000008b - .long 0x000000d1 - .long 0x00000025 - .long 0x00000072 - .long 0x000000f8 - .long 0x000000f6 - .long 0x00000064 - .long 0x00000086 - .long 0x00000068 - .long 0x00000098 - .long 0x00000016 - .long 0x000000d4 - .long 0x000000a4 - .long 0x0000005c - .long 0x000000cc - .long 0x0000005d - .long 0x00000065 - .long 0x000000b6 - .long 0x00000092 - .long 0x0000006c - .long 0x00000070 - .long 0x00000048 - .long 0x00000050 - .long 0x000000fd - .long 0x000000ed - .long 0x000000b9 - .long 0x000000da - .long 0x0000005e - .long 0x00000015 - .long 0x00000046 - .long 0x00000057 - .long 0x000000a7 - .long 0x0000008d - .long 0x0000009d - .long 0x00000084 - .long 0x00000090 - .long 0x000000d8 - .long 0x000000ab - .long 0x00000000 - .long 0x0000008c - .long 0x000000bc - .long 0x000000d3 - .long 0x0000000a - .long 0x000000f7 - .long 0x000000e4 - .long 0x00000058 - .long 0x00000005 - .long 0x000000b8 - .long 0x000000b3 - .long 0x00000045 - .long 0x00000006 - .long 0x000000d0 - .long 0x0000002c - .long 0x0000001e - .long 0x0000008f - .long 0x000000ca - .long 0x0000003f - .long 0x0000000f - .long 0x00000002 - .long 0x000000c1 - .long 0x000000af - .long 0x000000bd - .long 0x00000003 - .long 0x00000001 - .long 0x00000013 - .long 0x0000008a - .long 0x0000006b - .long 0x0000003a - .long 0x00000091 - .long 0x00000011 - .long 0x00000041 - .long 0x0000004f - .long 0x00000067 - .long 0x000000dc - .long 0x000000ea - .long 0x00000097 - .long 0x000000f2 - .long 0x000000cf - .long 0x000000ce - .long 0x000000f0 - .long 0x000000b4 - .long 0x000000e6 - .long 0x00000073 - .long 0x00000096 - .long 0x000000ac - .long 0x00000074 - .long 0x00000022 - .long 0x000000e7 - .long 0x000000ad - .long 0x00000035 - .long 0x00000085 - .long 0x000000e2 - .long 0x000000f9 - .long 0x00000037 - .long 0x000000e8 - .long 0x0000001c - .long 0x00000075 - .long 0x000000df - .long 0x0000006e - .long 0x00000047 - .long 0x000000f1 - .long 0x0000001a - .long 0x00000071 - .long 0x0000001d - .long 0x00000029 - .long 0x000000c5 - .long 0x00000089 - .long 0x0000006f - .long 0x000000b7 - .long 0x00000062 - .long 0x0000000e - .long 0x000000aa - .long 0x00000018 - .long 0x000000be - .long 0x0000001b - .long 0x000000fc - .long 0x00000056 - .long 0x0000003e - .long 0x0000004b - .long 0x000000c6 - .long 0x000000d2 - .long 0x00000079 - .long 0x00000020 - .long 0x0000009a - .long 0x000000db - .long 0x000000c0 - .long 0x000000fe - .long 0x00000078 - .long 0x000000cd - .long 0x0000005a - .long 0x000000f4 - .long 0x0000001f - .long 0x000000dd - .long 0x000000a8 - .long 0x00000033 - .long 0x00000088 - .long 0x00000007 - .long 0x000000c7 - .long 0x00000031 - .long 0x000000b1 - .long 0x00000012 - .long 0x00000010 - .long 0x00000059 - .long 0x00000027 - .long 0x00000080 - .long 0x000000ec - .long 0x0000005f - .long 0x00000060 - .long 0x00000051 - .long 0x0000007f - .long 0x000000a9 - .long 0x00000019 - .long 0x000000b5 - .long 0x0000004a - .long 0x0000000d - .long 0x0000002d - .long 0x000000e5 - .long 0x0000007a - .long 0x0000009f - .long 0x00000093 - .long 0x000000c9 - .long 0x0000009c - .long 0x000000ef - .long 0x000000a0 - .long 0x000000e0 - .long 0x0000003b - .long 0x0000004d - .long 0x000000ae - .long 0x0000002a - .long 0x000000f5 - .long 0x000000b0 - .long 0x000000c8 - .long 0x000000eb - .long 0x000000bb - .long 0x0000003c - .long 0x00000083 - .long 0x00000053 - .long 0x00000099 - .long 0x00000061 - .long 0x00000017 - .long 0x0000002b - .long 0x00000004 - .long 0x0000007e - .long 0x000000ba - .long 0x00000077 - .long 0x000000d6 - .long 0x00000026 - .long 0x000000e1 - .long 0x00000069 - .long 0x00000014 - .long 0x00000063 - .long 0x00000055 - .long 0x00000021 - .long 0x0000000c - .long 0x0000007d - // Table 1. - .long 0x00005200 - .long 0x00000900 - .long 0x00006a00 - .long 0x0000d500 - .long 0x00003000 - .long 0x00003600 - .long 0x0000a500 - .long 0x00003800 - .long 0x0000bf00 - .long 0x00004000 - .long 0x0000a300 - .long 0x00009e00 - .long 0x00008100 - .long 0x0000f300 - .long 0x0000d700 - .long 0x0000fb00 - .long 0x00007c00 - .long 0x0000e300 - .long 0x00003900 - .long 0x00008200 - .long 0x00009b00 - .long 0x00002f00 - .long 0x0000ff00 - .long 0x00008700 - .long 0x00003400 - .long 0x00008e00 - .long 0x00004300 - .long 0x00004400 - .long 0x0000c400 - .long 0x0000de00 - .long 0x0000e900 - .long 0x0000cb00 - .long 0x00005400 - .long 0x00007b00 - .long 0x00009400 - .long 0x00003200 - .long 0x0000a600 - .long 0x0000c200 - .long 0x00002300 - .long 0x00003d00 - .long 0x0000ee00 - .long 0x00004c00 - .long 0x00009500 - .long 0x00000b00 - .long 0x00004200 - .long 0x0000fa00 - .long 0x0000c300 - .long 0x00004e00 - .long 0x00000800 - .long 0x00002e00 - .long 0x0000a100 - .long 0x00006600 - .long 0x00002800 - .long 0x0000d900 - .long 0x00002400 - .long 0x0000b200 - .long 0x00007600 - .long 0x00005b00 - .long 0x0000a200 - .long 0x00004900 - .long 0x00006d00 - .long 0x00008b00 - .long 0x0000d100 - .long 0x00002500 - .long 0x00007200 - .long 0x0000f800 - .long 0x0000f600 - .long 0x00006400 - .long 0x00008600 - .long 0x00006800 - .long 0x00009800 - .long 0x00001600 - .long 0x0000d400 - .long 0x0000a400 - .long 0x00005c00 - .long 0x0000cc00 - .long 0x00005d00 - .long 0x00006500 - .long 0x0000b600 - .long 0x00009200 - .long 0x00006c00 - .long 0x00007000 - .long 0x00004800 - .long 0x00005000 - .long 0x0000fd00 - .long 0x0000ed00 - .long 0x0000b900 - .long 0x0000da00 - .long 0x00005e00 - .long 0x00001500 - .long 0x00004600 - .long 0x00005700 - .long 0x0000a700 - .long 0x00008d00 - .long 0x00009d00 - .long 0x00008400 - .long 0x00009000 - .long 0x0000d800 - .long 0x0000ab00 - .long 0x00000000 - .long 0x00008c00 - .long 0x0000bc00 - .long 0x0000d300 - .long 0x00000a00 - .long 0x0000f700 - .long 0x0000e400 - .long 0x00005800 - .long 0x00000500 - .long 0x0000b800 - .long 0x0000b300 - .long 0x00004500 - .long 0x00000600 - .long 0x0000d000 - .long 0x00002c00 - .long 0x00001e00 - .long 0x00008f00 - .long 0x0000ca00 - .long 0x00003f00 - .long 0x00000f00 - .long 0x00000200 - .long 0x0000c100 - .long 0x0000af00 - .long 0x0000bd00 - .long 0x00000300 - .long 0x00000100 - .long 0x00001300 - .long 0x00008a00 - .long 0x00006b00 - .long 0x00003a00 - .long 0x00009100 - .long 0x00001100 - .long 0x00004100 - .long 0x00004f00 - .long 0x00006700 - .long 0x0000dc00 - .long 0x0000ea00 - .long 0x00009700 - .long 0x0000f200 - .long 0x0000cf00 - .long 0x0000ce00 - .long 0x0000f000 - .long 0x0000b400 - .long 0x0000e600 - .long 0x00007300 - .long 0x00009600 - .long 0x0000ac00 - .long 0x00007400 - .long 0x00002200 - .long 0x0000e700 - .long 0x0000ad00 - .long 0x00003500 - .long 0x00008500 - .long 0x0000e200 - .long 0x0000f900 - .long 0x00003700 - .long 0x0000e800 - .long 0x00001c00 - .long 0x00007500 - .long 0x0000df00 - .long 0x00006e00 - .long 0x00004700 - .long 0x0000f100 - .long 0x00001a00 - .long 0x00007100 - .long 0x00001d00 - .long 0x00002900 - .long 0x0000c500 - .long 0x00008900 - .long 0x00006f00 - .long 0x0000b700 - .long 0x00006200 - .long 0x00000e00 - .long 0x0000aa00 - .long 0x00001800 - .long 0x0000be00 - .long 0x00001b00 - .long 0x0000fc00 - .long 0x00005600 - .long 0x00003e00 - .long 0x00004b00 - .long 0x0000c600 - .long 0x0000d200 - .long 0x00007900 - .long 0x00002000 - .long 0x00009a00 - .long 0x0000db00 - .long 0x0000c000 - .long 0x0000fe00 - .long 0x00007800 - .long 0x0000cd00 - .long 0x00005a00 - .long 0x0000f400 - .long 0x00001f00 - .long 0x0000dd00 - .long 0x0000a800 - .long 0x00003300 - .long 0x00008800 - .long 0x00000700 - .long 0x0000c700 - .long 0x00003100 - .long 0x0000b100 - .long 0x00001200 - .long 0x00001000 - .long 0x00005900 - .long 0x00002700 - .long 0x00008000 - .long 0x0000ec00 - .long 0x00005f00 - .long 0x00006000 - .long 0x00005100 - .long 0x00007f00 - .long 0x0000a900 - .long 0x00001900 - .long 0x0000b500 - .long 0x00004a00 - .long 0x00000d00 - .long 0x00002d00 - .long 0x0000e500 - .long 0x00007a00 - .long 0x00009f00 - .long 0x00009300 - .long 0x0000c900 - .long 0x00009c00 - .long 0x0000ef00 - .long 0x0000a000 - .long 0x0000e000 - .long 0x00003b00 - .long 0x00004d00 - .long 0x0000ae00 - .long 0x00002a00 - .long 0x0000f500 - .long 0x0000b000 - .long 0x0000c800 - .long 0x0000eb00 - .long 0x0000bb00 - .long 0x00003c00 - .long 0x00008300 - .long 0x00005300 - .long 0x00009900 - .long 0x00006100 - .long 0x00001700 - .long 0x00002b00 - .long 0x00000400 - .long 0x00007e00 - .long 0x0000ba00 - .long 0x00007700 - .long 0x0000d600 - .long 0x00002600 - .long 0x0000e100 - .long 0x00006900 - .long 0x00001400 - .long 0x00006300 - .long 0x00005500 - .long 0x00002100 - .long 0x00000c00 - .long 0x00007d00 - // Table 2. - .long 0x00520000 - .long 0x00090000 - .long 0x006a0000 - .long 0x00d50000 - .long 0x00300000 - .long 0x00360000 - .long 0x00a50000 - .long 0x00380000 - .long 0x00bf0000 - .long 0x00400000 - .long 0x00a30000 - .long 0x009e0000 - .long 0x00810000 - .long 0x00f30000 - .long 0x00d70000 - .long 0x00fb0000 - .long 0x007c0000 - .long 0x00e30000 - .long 0x00390000 - .long 0x00820000 - .long 0x009b0000 - .long 0x002f0000 - .long 0x00ff0000 - .long 0x00870000 - .long 0x00340000 - .long 0x008e0000 - .long 0x00430000 - .long 0x00440000 - .long 0x00c40000 - .long 0x00de0000 - .long 0x00e90000 - .long 0x00cb0000 - .long 0x00540000 - .long 0x007b0000 - .long 0x00940000 - .long 0x00320000 - .long 0x00a60000 - .long 0x00c20000 - .long 0x00230000 - .long 0x003d0000 - .long 0x00ee0000 - .long 0x004c0000 - .long 0x00950000 - .long 0x000b0000 - .long 0x00420000 - .long 0x00fa0000 - .long 0x00c30000 - .long 0x004e0000 - .long 0x00080000 - .long 0x002e0000 - .long 0x00a10000 - .long 0x00660000 - .long 0x00280000 - .long 0x00d90000 - .long 0x00240000 - .long 0x00b20000 - .long 0x00760000 - .long 0x005b0000 - .long 0x00a20000 - .long 0x00490000 - .long 0x006d0000 - .long 0x008b0000 - .long 0x00d10000 - .long 0x00250000 - .long 0x00720000 - .long 0x00f80000 - .long 0x00f60000 - .long 0x00640000 - .long 0x00860000 - .long 0x00680000 - .long 0x00980000 - .long 0x00160000 - .long 0x00d40000 - .long 0x00a40000 - .long 0x005c0000 - .long 0x00cc0000 - .long 0x005d0000 - .long 0x00650000 - .long 0x00b60000 - .long 0x00920000 - .long 0x006c0000 - .long 0x00700000 - .long 0x00480000 - .long 0x00500000 - .long 0x00fd0000 - .long 0x00ed0000 - .long 0x00b90000 - .long 0x00da0000 - .long 0x005e0000 - .long 0x00150000 - .long 0x00460000 - .long 0x00570000 - .long 0x00a70000 - .long 0x008d0000 - .long 0x009d0000 - .long 0x00840000 - .long 0x00900000 - .long 0x00d80000 - .long 0x00ab0000 - .long 0x00000000 - .long 0x008c0000 - .long 0x00bc0000 - .long 0x00d30000 - .long 0x000a0000 - .long 0x00f70000 - .long 0x00e40000 - .long 0x00580000 - .long 0x00050000 - .long 0x00b80000 - .long 0x00b30000 - .long 0x00450000 - .long 0x00060000 - .long 0x00d00000 - .long 0x002c0000 - .long 0x001e0000 - .long 0x008f0000 - .long 0x00ca0000 - .long 0x003f0000 - .long 0x000f0000 - .long 0x00020000 - .long 0x00c10000 - .long 0x00af0000 - .long 0x00bd0000 - .long 0x00030000 - .long 0x00010000 - .long 0x00130000 - .long 0x008a0000 - .long 0x006b0000 - .long 0x003a0000 - .long 0x00910000 - .long 0x00110000 - .long 0x00410000 - .long 0x004f0000 - .long 0x00670000 - .long 0x00dc0000 - .long 0x00ea0000 - .long 0x00970000 - .long 0x00f20000 - .long 0x00cf0000 - .long 0x00ce0000 - .long 0x00f00000 - .long 0x00b40000 - .long 0x00e60000 - .long 0x00730000 - .long 0x00960000 - .long 0x00ac0000 - .long 0x00740000 - .long 0x00220000 - .long 0x00e70000 - .long 0x00ad0000 - .long 0x00350000 - .long 0x00850000 - .long 0x00e20000 - .long 0x00f90000 - .long 0x00370000 - .long 0x00e80000 - .long 0x001c0000 - .long 0x00750000 - .long 0x00df0000 - .long 0x006e0000 - .long 0x00470000 - .long 0x00f10000 - .long 0x001a0000 - .long 0x00710000 - .long 0x001d0000 - .long 0x00290000 - .long 0x00c50000 - .long 0x00890000 - .long 0x006f0000 - .long 0x00b70000 - .long 0x00620000 - .long 0x000e0000 - .long 0x00aa0000 - .long 0x00180000 - .long 0x00be0000 - .long 0x001b0000 - .long 0x00fc0000 - .long 0x00560000 - .long 0x003e0000 - .long 0x004b0000 - .long 0x00c60000 - .long 0x00d20000 - .long 0x00790000 - .long 0x00200000 - .long 0x009a0000 - .long 0x00db0000 - .long 0x00c00000 - .long 0x00fe0000 - .long 0x00780000 - .long 0x00cd0000 - .long 0x005a0000 - .long 0x00f40000 - .long 0x001f0000 - .long 0x00dd0000 - .long 0x00a80000 - .long 0x00330000 - .long 0x00880000 - .long 0x00070000 - .long 0x00c70000 - .long 0x00310000 - .long 0x00b10000 - .long 0x00120000 - .long 0x00100000 - .long 0x00590000 - .long 0x00270000 - .long 0x00800000 - .long 0x00ec0000 - .long 0x005f0000 - .long 0x00600000 - .long 0x00510000 - .long 0x007f0000 - .long 0x00a90000 - .long 0x00190000 - .long 0x00b50000 - .long 0x004a0000 - .long 0x000d0000 - .long 0x002d0000 - .long 0x00e50000 - .long 0x007a0000 - .long 0x009f0000 - .long 0x00930000 - .long 0x00c90000 - .long 0x009c0000 - .long 0x00ef0000 - .long 0x00a00000 - .long 0x00e00000 - .long 0x003b0000 - .long 0x004d0000 - .long 0x00ae0000 - .long 0x002a0000 - .long 0x00f50000 - .long 0x00b00000 - .long 0x00c80000 - .long 0x00eb0000 - .long 0x00bb0000 - .long 0x003c0000 - .long 0x00830000 - .long 0x00530000 - .long 0x00990000 - .long 0x00610000 - .long 0x00170000 - .long 0x002b0000 - .long 0x00040000 - .long 0x007e0000 - .long 0x00ba0000 - .long 0x00770000 - .long 0x00d60000 - .long 0x00260000 - .long 0x00e10000 - .long 0x00690000 - .long 0x00140000 - .long 0x00630000 - .long 0x00550000 - .long 0x00210000 - .long 0x000c0000 - .long 0x007d0000 - // Table 3. - .long 0x52000000 - .long 0x09000000 - .long 0x6a000000 - .long 0xd5000000 - .long 0x30000000 - .long 0x36000000 - .long 0xa5000000 - .long 0x38000000 - .long 0xbf000000 - .long 0x40000000 - .long 0xa3000000 - .long 0x9e000000 - .long 0x81000000 - .long 0xf3000000 - .long 0xd7000000 - .long 0xfb000000 - .long 0x7c000000 - .long 0xe3000000 - .long 0x39000000 - .long 0x82000000 - .long 0x9b000000 - .long 0x2f000000 - .long 0xff000000 - .long 0x87000000 - .long 0x34000000 - .long 0x8e000000 - .long 0x43000000 - .long 0x44000000 - .long 0xc4000000 - .long 0xde000000 - .long 0xe9000000 - .long 0xcb000000 - .long 0x54000000 - .long 0x7b000000 - .long 0x94000000 - .long 0x32000000 - .long 0xa6000000 - .long 0xc2000000 - .long 0x23000000 - .long 0x3d000000 - .long 0xee000000 - .long 0x4c000000 - .long 0x95000000 - .long 0x0b000000 - .long 0x42000000 - .long 0xfa000000 - .long 0xc3000000 - .long 0x4e000000 - .long 0x08000000 - .long 0x2e000000 - .long 0xa1000000 - .long 0x66000000 - .long 0x28000000 - .long 0xd9000000 - .long 0x24000000 - .long 0xb2000000 - .long 0x76000000 - .long 0x5b000000 - .long 0xa2000000 - .long 0x49000000 - .long 0x6d000000 - .long 0x8b000000 - .long 0xd1000000 - .long 0x25000000 - .long 0x72000000 - .long 0xf8000000 - .long 0xf6000000 - .long 0x64000000 - .long 0x86000000 - .long 0x68000000 - .long 0x98000000 - .long 0x16000000 - .long 0xd4000000 - .long 0xa4000000 - .long 0x5c000000 - .long 0xcc000000 - .long 0x5d000000 - .long 0x65000000 - .long 0xb6000000 - .long 0x92000000 - .long 0x6c000000 - .long 0x70000000 - .long 0x48000000 - .long 0x50000000 - .long 0xfd000000 - .long 0xed000000 - .long 0xb9000000 - .long 0xda000000 - .long 0x5e000000 - .long 0x15000000 - .long 0x46000000 - .long 0x57000000 - .long 0xa7000000 - .long 0x8d000000 - .long 0x9d000000 - .long 0x84000000 - .long 0x90000000 - .long 0xd8000000 - .long 0xab000000 - .long 0x00000000 - .long 0x8c000000 - .long 0xbc000000 - .long 0xd3000000 - .long 0x0a000000 - .long 0xf7000000 - .long 0xe4000000 - .long 0x58000000 - .long 0x05000000 - .long 0xb8000000 - .long 0xb3000000 - .long 0x45000000 - .long 0x06000000 - .long 0xd0000000 - .long 0x2c000000 - .long 0x1e000000 - .long 0x8f000000 - .long 0xca000000 - .long 0x3f000000 - .long 0x0f000000 - .long 0x02000000 - .long 0xc1000000 - .long 0xaf000000 - .long 0xbd000000 - .long 0x03000000 - .long 0x01000000 - .long 0x13000000 - .long 0x8a000000 - .long 0x6b000000 - .long 0x3a000000 - .long 0x91000000 - .long 0x11000000 - .long 0x41000000 - .long 0x4f000000 - .long 0x67000000 - .long 0xdc000000 - .long 0xea000000 - .long 0x97000000 - .long 0xf2000000 - .long 0xcf000000 - .long 0xce000000 - .long 0xf0000000 - .long 0xb4000000 - .long 0xe6000000 - .long 0x73000000 - .long 0x96000000 - .long 0xac000000 - .long 0x74000000 - .long 0x22000000 - .long 0xe7000000 - .long 0xad000000 - .long 0x35000000 - .long 0x85000000 - .long 0xe2000000 - .long 0xf9000000 - .long 0x37000000 - .long 0xe8000000 - .long 0x1c000000 - .long 0x75000000 - .long 0xdf000000 - .long 0x6e000000 - .long 0x47000000 - .long 0xf1000000 - .long 0x1a000000 - .long 0x71000000 - .long 0x1d000000 - .long 0x29000000 - .long 0xc5000000 - .long 0x89000000 - .long 0x6f000000 - .long 0xb7000000 - .long 0x62000000 - .long 0x0e000000 - .long 0xaa000000 - .long 0x18000000 - .long 0xbe000000 - .long 0x1b000000 - .long 0xfc000000 - .long 0x56000000 - .long 0x3e000000 - .long 0x4b000000 - .long 0xc6000000 - .long 0xd2000000 - .long 0x79000000 - .long 0x20000000 - .long 0x9a000000 - .long 0xdb000000 - .long 0xc0000000 - .long 0xfe000000 - .long 0x78000000 - .long 0xcd000000 - .long 0x5a000000 - .long 0xf4000000 - .long 0x1f000000 - .long 0xdd000000 - .long 0xa8000000 - .long 0x33000000 - .long 0x88000000 - .long 0x07000000 - .long 0xc7000000 - .long 0x31000000 - .long 0xb1000000 - .long 0x12000000 - .long 0x10000000 - .long 0x59000000 - .long 0x27000000 - .long 0x80000000 - .long 0xec000000 - .long 0x5f000000 - .long 0x60000000 - .long 0x51000000 - .long 0x7f000000 - .long 0xa9000000 - .long 0x19000000 - .long 0xb5000000 - .long 0x4a000000 - .long 0x0d000000 - .long 0x2d000000 - .long 0xe5000000 - .long 0x7a000000 - .long 0x9f000000 - .long 0x93000000 - .long 0xc9000000 - .long 0x9c000000 - .long 0xef000000 - .long 0xa0000000 - .long 0xe0000000 - .long 0x3b000000 - .long 0x4d000000 - .long 0xae000000 - .long 0x2a000000 - .long 0xf5000000 - .long 0xb0000000 - .long 0xc8000000 - .long 0xeb000000 - .long 0xbb000000 - .long 0x3c000000 - .long 0x83000000 - .long 0x53000000 - .long 0x99000000 - .long 0x61000000 - .long 0x17000000 - .long 0x2b000000 - .long 0x04000000 - .long 0x7e000000 - .long 0xba000000 - .long 0x77000000 - .long 0xd6000000 - .long 0x26000000 - .long 0xe1000000 - .long 0x69000000 - .long 0x14000000 - .long 0x63000000 - .long 0x55000000 - .long 0x21000000 - .long 0x0c000000 - .long 0x7d000000 DELETED Source/AESedp/Intel/DecryptCBC.s Index: Source/AESedp/Intel/DecryptCBC.s ================================================================== --- Source/AESedp/Intel/DecryptCBC.s +++ /dev/null @@ -1,294 +0,0 @@ -#include "../AESAssembly.h" - - -// Generate object code only if this implementation has been requested. -#if defined UseAESedp_IntelAssembly - - -/* AESDecryptCBC.s -- Decrypt blocks with AES in Cipher Block Chaining mode. - - Written by Eric Postpischil, January 24, 2008. -*/ - - -/* Define a macro to select a value based on architecture. This reduces - some of the architecture conditionalization later in the source. -*/ -#if defined __i386__ - #define Arch(i386, x86_64) i386 -#elif defined __x86_64__ - #define Arch(i386, x86_64) x86_64 -#endif - - -/* Rename the general registers. This makes it easier to keep track of them - and provides names for the "whole register" that are uniform between i386 - and x86_64. -*/ -#if defined __i386__ - #define r0 %eax // Available for any use. - #define r1 %ecx // Available for any use, some special purposes (loop). - #define r2 %edx // Available for any use. - #define r3 %ebx // Must be preserved by called routine. - #define r4 %esp // Stack pointer. - #define r5 %ebp // Frame pointer, must preserve, no bare indirect. - #define r6 %esi // Must be preserved by called routine. - #define r7 %edi // Must be preserved by called routine. -#elif defined __x86_64__ - #define r0 %rax // Available for any use. - #define r1 %rcx // Available for any use. - #define r2 %rdx // Available for any use. - #define r3 %rbx // Must be preserved by called routine. - #define r4 %rsp // Stack pointer. - #define r5 %rbp // Frame pointer. Must be preserved by called routine. - #define r6 %rsi // Available for any use. - #define r7 %rdi // Available for any use. - #define r8 %r8 // Available for any use. - #define r9 %r9 // Available for any use. - #define r10 %r10 // Available for any use. - #define r11 %r11 // Available for any use. - #define r12 %r12 // Must be preserved by called routine. - #define r13 %r13 // Must be preserved by called routine. - #define r14 %r14 // Must be preserved by called routine. - #define r15 %r15 // Must be preserved by called routine. -#else - #error "Unknown architecture." -#endif - - -/* Routine: - - _AESDecryptCBC. - - Function: - - This routine uses _AESDecryptWithExpandedKey to decrypt blocks in - Cipher Block Chaining mode, which requires chaining the AES state - from block to block. In CBC mode, each output block is (after the - underlying decryption) XORed with the previous input block. On the - first iteration, the previous input block is supplied from a chain - buffer. - - Input: - - void *O // Output - const void *I // Input - void *ChainBuffer // Chain buffer / initial value. - void *Key // Expanded Key. - long Blocks // Number of 16-byte blocks to process. - long Rounds // Number of rounds. - - Output: - - Decrypted text is written to *O. - - The final input block is written to *ChainBuffer. -*/ - .globl _AESDecryptCBC - .private_extern _AESDecryptCBC -_AESDecryptCBC: - - // Push new stack frame. - push r5 - - // Save registers. - push r3 - #if defined __i386__ - push r6 - push r7 - #define RegisterSaveSize (3*4) - #elif defined __x86_64__ - push r12 - push r13 - push r14 - push r15 - #define RegisterSaveSize (5*8) - #endif - -/* B is the number of bytes from the top of stack just before the instruction - that called this routine to the top of stack after we push the frame - pointer and other registers. It provides information needed to align our - stack frame. -*/ -#define B (RegisterSaveSize + 2*Arch(4, 8)) - -/* Allocate space on the stack for 16 bytes for the AES state, 16 bytes to - save the chain value, and, on i386, 16 bytes for four four-byte arguments, - and padding needed to produce 16-byte alignment. -*/ -#define LocalsSize ((16*2 + Arch(16, 0) + B + 15 & -16) - B) -#define StackFrame (LocalsSize + B) - -/* LocalState is the offset from the stack pointer to where we store the AES - state. -*/ -#define LocalState Arch(16, 0) -#define SavedChain Arch(32, 16) // Offset to saved chain value. - - #if 0 < LocalsSize - sub $LocalsSize, r4 // Allocate space on stack. - #endif - -// Non-volatile registers. -#define I r3 -#define O r5 -#define Blocks Arch(r6, r12) -#define ChainBuffer Arch(r7, r13) -#define Rounds Arch(Not used, r14) -#define Key Arch(Not used, r15) - -// Volatile registers. -#define t0 r0 -#define v0 %xmm0 -#define vState0 %xmm4 - -// Arguments passed to us. -#if defined __i386__ - // Define location of argument i. - #define Argument(i) StackFrame+4*(i)(r4) -#endif -#define ArgO Arch(Argument(0), r7) -#define ArgI Arch(Argument(1), r6) -#define ArgChainBuffer Arch(Argument(2), r2) -#define ArgKey Arch(Argument(3), r1) -#define ArgBlocks Arch(Argument(4), r8) -#define ArgRounds Arch(Argument(5), r9) - - /* Get some arguments. We need to move these from the stack (on i386) - or volatile registers (on x86_64) to non-volatile registers where we - can use them and keep them during calls to a subroutine. - */ - mov ArgO, O - mov ArgI, I - mov ArgChainBuffer, ChainBuffer - mov ArgBlocks, Blocks - - // Convert Blocks from number of blocks to displacement in bytes. - imul $16, Blocks - je done // Leave if we were given zero blocks. - - // Save last input block to write to ChainBuffer later. - movupd -16(I, Blocks), v0 - movapd v0, SavedChain(r4) - - #if defined __i386__ - - // Put arguments we will pass on stack. - mov ArgRounds, t0 - mov t0, 3*4(r4) - - mov ArgKey, t0 - mov t0, 2*4(r4) - - lea LocalState(r4), t0 - mov t0, 0*4(r4) - - #else - - // Put arguments we will pass into non-volatile registers. - mov ArgRounds, Rounds - mov ArgKey, Key - - #endif - - add $-16, Blocks - - jle 2f // Skip main loop if there was only one block. - -// Main loop. -1: - #if defined __i386__ - - // Pass address of current input block. - lea (I, Blocks), t0 - mov t0, 1*4(r4) - - #else - - // Pass arguments to subroutine. - #define PassedRounds r1 - #define PassedKey r2 - #define PassedInput r6 - #define PassedOutput r7 - mov Rounds, PassedRounds - mov Key, PassedKey - lea (I, Blocks), PassedInput - lea LocalState(r4), PassedOutput - - #endif - - // Decrypt state. - call _AESDecryptWithExpandedKey - - // XOR decrypted block with previous chain value. - movapd LocalState(r4), vState0 - movupd -16(I, Blocks), v0 - pxor v0, vState0 - - // Write to output. - movupd vState0, 0*4(O, Blocks) - - add $-16, Blocks - - jg 1b -2: - -/* First block is separate because it gets chain value from ChainBuffer - rather than from the input stream. -*/ - #if defined __i386__ - - // Pass address of current input block. - lea (I, Blocks), t0 - mov t0, 1*4(r4) - - #else - - // Pass arguments to subroutine. - #define PassedRounds r1 - #define PassedKey r2 - #define PassedInput r6 - #define PassedOutput r7 - mov Rounds, PassedRounds - mov Key, PassedKey - lea (I, Blocks), PassedInput - lea LocalState(r4), PassedOutput - - #endif - - // Decrypt state. - call _AESDecryptWithExpandedKey - - // XOR decrypted block with previous chain value. - movapd LocalState(r4), vState0 - movupd (ChainBuffer), v0 - pxor v0, vState0 - - // Write to output. - movupd vState0, 0*4(O, Blocks) - - // Save state for chaining in future calls. - movapd SavedChain(r4), v0 - movupd v0, (ChainBuffer) - -done: - // Pop stack and restore registers. - #if 0 < LocalsSize - add $LocalsSize, r4 - #endif - #if defined __i386__ - pop r7 - pop r6 - #elif defined __x86_64__ - pop r15 - pop r14 - pop r13 - pop r12 - #endif - pop r3 - pop r5 - - ret - - -#endif // defined UseAESedp_IntelAssembly DELETED Source/AESedp/Intel/EncryptCBC.s Index: Source/AESedp/Intel/EncryptCBC.s ================================================================== --- Source/AESedp/Intel/EncryptCBC.s +++ /dev/null @@ -1,298 +0,0 @@ -#include "../AESAssembly.h" - - -// Generate object code only if this implementation has been requested. -#if defined UseAESedp_IntelAssembly - - -/* AESEncryptCBC.s -- Encrypt blocks with AES in Cipher Block Chaining mode. - - Written by Eric Postpischil, January 24, 2008. -*/ - - -/* Define a macro to select a value based on architecture. This reduces - some of the architecture conditionalization later in the source. -*/ -#if defined __i386__ - #define Arch(i386, x86_64) i386 -#elif defined __x86_64__ - #define Arch(i386, x86_64) x86_64 -#endif - - -/* Rename the general registers. This makes it easier to keep track of them - and provides names for the "whole register" that are uniform between i386 - and x86_64. -*/ -#if defined __i386__ - #define r0 %eax // Available for any use. - #define r1 %ecx // Available for any use, some special purposes (loop). - #define r2 %edx // Available for any use. - #define r3 %ebx // Must be preserved by called routine. - #define r4 %esp // Stack pointer. - #define r5 %ebp // Frame pointer, must preserve, no bare indirect. - #define r6 %esi // Must be preserved by called routine. - #define r7 %edi // Must be preserved by called routine. -#elif defined __x86_64__ - #define r0 %rax // Available for any use. - #define r1 %rcx // Available for any use. - #define r2 %rdx // Available for any use. - #define r3 %rbx // Must be preserved by called routine. - #define r4 %rsp // Stack pointer. - #define r5 %rbp // Frame pointer. Must be preserved by called routine. - #define r6 %rsi // Available for any use. - #define r7 %rdi // Available for any use. - #define r8 %r8 // Available for any use. - #define r9 %r9 // Available for any use. - #define r10 %r10 // Available for any use. - #define r11 %r11 // Available for any use. - #define r12 %r12 // Must be preserved by called routine. - #define r13 %r13 // Must be preserved by called routine. - #define r14 %r14 // Must be preserved by called routine. - #define r15 %r15 // Must be preserved by called routine. -#else - #error "Unknown architecture." -#endif - - -/* Routine: - - _AESEncryptCBC. - - Function: - - This routine uses _AESEncryptWithExpandedKey to encrypt blocks in - Cipher Block Chaining mode, which requires chaining the AES state - from block to block. In CBC mode, an initial block is XORed with the - first input block, and then each output block is XORed with the next - input block. - - Input: - - void *O // Output - const void *I // Input - void *ChainBuffer // Chain buffer / initial value. - void *Key // Expanded Key. - long Blocks // Number of 16-byte blocks to process. - long Rounds // Number of rounds. - - Output: - - Encrypted text is written to *O. - - The final output block is written to *ChainBuffer. -*/ - .globl _AESEncryptCBC - .private_extern _AESEncryptCBC -_AESEncryptCBC: - - // Push new stack frame. - push r5 - - // Save registers. - push r3 - #if defined __i386__ - push r6 - push r7 - #define RegisterSaveSize (3*4) - #elif defined __x86_64__ - push r12 - push r13 - push r14 - push r15 - #define RegisterSaveSize (5*8) - #endif - -/* B is the number of bytes from the top of stack just before the instruction - that called this routine to the top of stack after we push the frame - pointer and other registers. It provides information needed to align our - stack frame. -*/ -#define B (RegisterSaveSize + 2*Arch(4, 8)) - -/* Allocate space on the stack for 16 bytes for the AES state and, on i386, - 16 bytes for four four-byte arguments, and padding needed to produce - 16-byte alignment. -*/ -#define LocalsSize ((16 + Arch(16, 0) + B + 15 & -16) - B) -#define StackFrame (LocalsSize + B) - -/* LocalState is the offset from the stack pointer to where we store the AES - state. -*/ -#define LocalState Arch(16, 0) - - #if 0 < LocalsSize - sub $LocalsSize, r4 // Allocate space on stack. - #endif - -// Non-volatile registers. -#define I r3 -#define O r5 -#define Blocks Arch(r6, r12) -#define ChainBuffer Arch(r7, r13) -#define Rounds Arch(Not used, r14) -#define Key Arch(Not used, r15) - -// Volatile registers. -#define t0 r0 -#define v0 %xmm0 -#define v1 %xmm1 -#define v2 %xmm2 -#define v3 %xmm3 -#define vState0 %xmm4 -#define vState1 %xmm5 -#define vState2 %xmm6 -#define vState3 %xmm7 - -// Arguments passed to us. -#if defined __i386__ - // Define location of argument i. - #define Argument(i) StackFrame+4*(i)(r4) -#endif -#define ArgO Arch(Argument(0), r7) -#define ArgI Arch(Argument(1), r6) -#define ArgChainBuffer Arch(Argument(2), r2) -#define ArgKey Arch(Argument(3), r1) -#define ArgBlocks Arch(Argument(4), r8) -#define ArgRounds Arch(Argument(5), r9) - - /* Get some arguments. We need to move these from the stack (on i386) - or volatile registers (on x86_64) to non-volatile registers where we - can use them and keep them during calls to a subroutine. - */ - mov ArgO, O - mov ArgI, I - mov ArgChainBuffer, ChainBuffer - mov ArgBlocks, Blocks - - // Read the initial value from the chain buffer. - movd 0*4(ChainBuffer), vState0 - movd 1*4(ChainBuffer), vState1 - movd 2*4(ChainBuffer), vState2 - movd 3*4(ChainBuffer), vState3 - - /* Convert Blocks from number of blocks to displacement in bytes from - end of input to current input location. (We will increment it from - iteration to iteration. When it reaches zero, we are done.) - */ - imul $-16, Blocks - je done // Leave if we were given zero blocks. - - // Adjust input and output pointers to use ends as base addresses. - sub Blocks, I - sub Blocks, O - - #if defined __i386__ - - // Put arguments we will pass on stack. - mov ArgRounds, t0 - mov t0, 3*4(r4) - - mov ArgKey, t0 - mov t0, 2*4(r4) - - lea LocalState(r4), t0 - mov t0, 1*4(r4) - mov t0, 0*4(r4) - - #else - - // Put arguments we will pass into non-volatile registers. - mov ArgRounds, Rounds - mov ArgKey, Key - - #endif - -1: - // Read next input block. - movd 0*4(I, Blocks), v0 - movd 1*4(I, Blocks), v1 - movd 2*4(I, Blocks), v2 - movd 3*4(I, Blocks), v3 - - // Chain block with state. - pxor v0, vState0 - pxor v1, vState1 - pxor v2, vState2 - pxor v3, vState3 - - // Store state for passing to encryption routine. - movd vState0, 0*4+LocalState(r4) - movd vState1, 1*4+LocalState(r4) - movd vState2, 2*4+LocalState(r4) - movd vState3, 3*4+LocalState(r4) - - #if defined __x86_64__ - - // Pass arguments to subroutine. - #define PassedRounds r1 - #define PassedKey r2 - #define PassedInput r6 - #define PassedOutput r7 - mov Rounds, PassedRounds - mov Key, PassedKey - lea LocalState(r4), PassedInput - lea (O, Blocks), PassedOutput - - #endif - - // Encrypt state. - call _AESEncryptWithExpandedKey - - #if defined __i386__ - - // Get encrypted state. - movd 0*4+LocalState(r4), vState0 - movd 1*4+LocalState(r4), vState1 - movd 2*4+LocalState(r4), vState2 - movd 3*4+LocalState(r4), vState3 - - // Write to output. - movd vState0, 0*4(O, Blocks) - movd vState1, 1*4(O, Blocks) - movd vState2, 2*4(O, Blocks) - movd vState3, 3*4(O, Blocks) - - #else - - // Get output for chaining. - movd 0*4(O, Blocks), vState0 - movd 1*4(O, Blocks), vState1 - movd 2*4(O, Blocks), vState2 - movd 3*4(O, Blocks), vState3 - - #endif - - add $16, Blocks - - jl 1b - - // Save state for chaining in future calls. - movd vState0, 0*4(ChainBuffer) - movd vState1, 1*4(ChainBuffer) - movd vState2, 2*4(ChainBuffer) - movd vState3, 3*4(ChainBuffer) - -done: - // Pop stack and restore registers. - #if 0 < LocalsSize - add $LocalsSize, r4 - #endif - #if defined __i386__ - pop r7 - pop r6 - #elif defined __x86_64__ - pop r15 - pop r14 - pop r13 - pop r12 - #endif - pop r3 - pop r5 - - ret - - -#endif // defined UseAESedp_IntelAssembly DELETED Source/AESedp/Intel/EncryptDecrypt.s Index: Source/AESedp/Intel/EncryptDecrypt.s ================================================================== --- Source/AESedp/Intel/EncryptDecrypt.s +++ /dev/null @@ -1,505 +0,0 @@ -/* This file defines _AESEncryptWithExpandedKey or _AESDecryptWithExpandedKey, - according to the value of the Select preprocessor symbol. This file is - designed to be included in another assembly file using the preprocessor - #include directive, to benefit from some assembly-time calculations. - - These two routines are nearly identical. They differ only in the tables - they use, the direction they iterate through the key, and the permutation - performed on part of the state. - - Written by Eric Postpischil, January 2008. -*/ - - -#if Select == 0 - #define Name _AESEncryptWithExpandedKey // Routine name. - #define MTable _OLDAESEncryptTable // Main table. - #define FTable _OLDAESSubBytesWordTable // Final table. - #define P0 S0 // State permutation. - #define P1 S1 - #define P2 S2 - #define P3 S3 - #define Increment +16 // ExpandedKey increment. -#elif Select == 1 - #define Name _AESDecryptWithExpandedKey // Routine name. - #define MTable _OLDAESDecryptTable // Main table. - #define FTable _OLDAESInvSubBytesWordTable // Final table. - #define P0 S2 // State permutation. - #define P1 S3 - #define P2 S0 - #define P3 S1 - #define Increment -16 // ExpandedKey increment. -#endif // Select - - -/* Routine: - - _AESEncryptWithExpandedKey (if Select is 0) or - _AESDecryptWithExpandedKey (if Select is 1). - - Function: - - Perform the AES cipher or its inverse as defined in Federal Information - Processing Standards Publication 197 (FIPS-197), November 26, 2001. - - The inverse cipher here is the "Equivalent Inverse Cipher" in FIPS-197. - - Input: - - Constant data: - - For encryption: - - The following names must be locally defined so the assembler - can calculate certain offsets. - - static const Word _OLDAESEncryptTable[4][256]. - - _OLDAESEncryptTable[i] contains the tables T[i] defined in AES - Proposal: Rijndael, version 2, 03/09/99, by Joan Daemen and - Vincent Rijmen, section 5.2.1, page 18. These tables - combine the SubBytes and MixColumns operations. - - static const Word _OLDAESSubBytesWordTable[256]. - - _OLDAESSubBytesWordTable[i][j] = SubBytes(j) << 8*i, where - SubBytes is defined in FIPS-197. _OLDAESSubBytesWordTable - differs from _OLDAESEncryptTable in that it does not include - the MixColumn operation. It is used in performing the last - round, which differs fromm the previous rounds in that it - does not include the MixColumn operation. - - For decryption: - - static const Word _OLDAESDecryptTable[4][256]. - - The analog of _OLDAESEncryptTable for decryption. - - static const Word _OLDAESSubBytesWordTable[256]. - - _OLDAESInvSubBytesWordTable[i][j] = InvSubBytes(j) << 8*i, - where InvSubBytes is defined in FIPS-197. - _OLDAESInvSubBytesWordTable differs from _OLDAESDecryptTable in - that it does not include the InvMixColumn operation. It is - used in performing the last round, which differs fromm the - previous rounds in that it does not include the - InvMixColumn operation. - - Arguments: - - Byte *OutputText. - - Address of output, 16 bytes. Best if four-byte aligned. - - const Byte *InputText. - - Address of input, 16 bytes. Best if four-byte aligned. - - const Byte *ExpandedKey. - - Address of expanded key, which has 4 * (Nr+1) bytes. Best if - four-byte aligned. - - int Nr - - Number of rounds. - - Output: - - Encrypted or decrypted data is written to *OutputText. -*/ - .globl Name - .private_extern Name -Name: - - // Push new stack frame. - push r5 - - // Save registers and set RegisterSave size to the number of bytes used. - push r3 - #if defined __i386__ - push r6 - push r7 - #define RegisterSaveSize (3*4) - #elif defined __x86_64__ - #define RegisterSaveSize (1*8) - #endif - -#define LocalsSize Arch(4, 0) // Number of bytes used for local variables. - - #if 0 < LocalsSize - sub $LocalsSize, r4 // Allocate space on stack. - #endif - -// Number of bytes from the stack pointer to the return address. -#define StackFrame (LocalsSize+RegisterSaveSize) - -#if defined __i386__ - - // Define location of argument i (presuming 4-byte arguments). - #define Argument(i) StackFrame+8+4*(i)(%esp) - - #define ArgOutputText Argument(0) - #define ArgInputText Argument(1) - #define ArgExpandedKey Argument(2) - #define ArgNr Argument(3) - -#elif defined __x86_64__ - - // Arguments. - #define OutputText r7 // Needed near end of routine. - #define InputText r6 // Used early then overwritten for other use. - #define ArgExpandedKey r2 - #define ArgNr r1 - /* The arguments passed in r1 and r2 overlaps registers we need for - other work, so they must be moved early in the routine. - */ - -#endif - -#define BaseP Arch(r7, r9) // Base pointer for addressing global data. -#define ExpandedKey Arch(t0, r10) // Address of expanded key. - -/* The Work registers defined below are used to hold parts of the AES state - while we dissect or assemble it. They must be assigned to the A, B, C, and - D registers so that we can access the bytes in %al, %ah, and so on. -*/ -#define Work0d r0d -#define Work0l r0l -#define Work0h r0h -#define Work1d r3d -#define Work1l r3l -#define Work1h r3h -#define Work2d r1d -#define Work2l r1l -#define Work2h r1h -#define Work3d r2d -#define Work3l r2l -#define Work3h r2h - -#define t0 r5 -#define t0d r5d // Low 32 bits of t0. -#define t0l r5l // Low byte of t0. - -#define t1 r6 - -/* S0, S1, S2, and S3 are where we assemble the new AES state when computing - a regular round. S1, S2, and S3 are assigned to the Work registers, but - S0 needs to go somewhere else because Work0 holds part of the old state. -*/ -#define S0 Arch(t1, r8d) -#define S1 Work1d -#define S2 Work2d -#define S3 Work3d - -/* These XMM registers are used as holding space, because it is faster to - spill to these registers than to the stack. (On x86_64, we do not need - to spill, because there are additional general registers available. - However, using more general registers requires saving them to the stack - and restoring them. I timed it, and no time was saved.) -*/ -#define vS1 %xmm1 -#define vS2 %xmm2 -#define vS3 %xmm3 -#if defined __i386__ - #define vExpandedKey %xmm4 - #define vIncrement %xmm5 -#endif - - // Get argument. - mov ArgExpandedKey, ExpandedKey - -// Store sentinel value of ExpandedKey on stack on i386, a register on x86_64. -#define ExpandedKeyEnd Arch((r4), r11) - - /* Convert ArgNr from rounds to number of bytes to move through expanded - key to get to (but not beyond) last 16-byte block. - */ - mov ArgNr, r0 - shl $4, r0 - - #if Select == 0 - // For encryption, prepare to iterate forward through expanded key. - add ExpandedKey, r0 - mov r0, ExpandedKeyEnd - #else - // For decryption, prepare to iterate backward through expanded key. - mov ExpandedKey, ExpandedKeyEnd - add r0, ExpandedKey - #endif - - // Initialize State from input text. - #if defined __i386__ - mov ArgInputText, BaseP - #define InputText BaseP - #endif - mov 0*4(InputText), Work0d - mov 1*4(InputText), S1 - mov 2*4(InputText), S2 - mov 3*4(InputText), S3 -#undef InputText // Register is reused after this for other purposes. - - // Add round key and save results. - xor 0*4(ExpandedKey), Work0d // S0 is in dissection register. - xor 1*4(ExpandedKey), S1 - movd S1, vS1 // Save S1 to S3 in vector registers. - xor 2*4(ExpandedKey), S2 - movd S2, vS2 - xor 3*4(ExpandedKey), S3 - movd S3, vS3 - - add $Increment, ExpandedKey // Advance to next round key. - - #if defined __i386__ - // Save expanded key address and increment in vector registers. - mov $Increment, t1 - movp ExpandedKey, vExpandedKey - movp t1, vIncrement - #endif - - // Set up relative addressing. - #if defined __i386__ - - // Get address of 0 in BaseP. - call 0f // Push program counter onto stack. - 0: - pop BaseP // Get program counter. - - // Define macros to help address data. -#define LookupM(table, index) MTable-0b+(table)*TableSize(BaseP, index, 4) -#define LookupF(table, index) FTable-0b+(table)*TableSize(BaseP, index, 4) - - #elif defined __x86_64__ - - lea MTable(%rip), BaseP - - // Define macros to help address data. - #define LookupM(table, index) (table)*TableSize(BaseP, index, 4) - #define LookupF(table, index) (table)*TableSize(BaseP, index, 4) - -/* With these definitions of LookupM and LookupF, BaseP must be loaded with - the address of the table at the point where it is used. So we need an - instruction to change BaseP after we are done with MTable and before we - start using FTable. I would prefer to use something like: - - .set FMinusM, FTable - MTable - #define LookupF(table, index) \ - FMinusM+(table)*TableSize(BaseP, index, 4) - - Then BaseP would not need to change. However, this fails due to an - assembler/linker bug, . -*/ - - #endif - - // Get round key. - mov 0*4(ExpandedKey), S0 - mov 1*4(ExpandedKey), S1 - mov 2*4(ExpandedKey), S2 - mov 3*4(ExpandedKey), S3 - -1: - /* Word 0 of the current state must be in Work0 now, and the next round - key must be in S0 to S3. - */ - - // Process previous S0. - movzx Work0l, t0 - xor LookupM(0, t0), S0 - movzx Work0h, t0d - xor LookupM(1, t0), P3 - shr $16, Work0d - movzx Work0l, t0d - xor LookupM(2, t0), S2 - movzx Work0h, t0d - xor LookupM(3, t0), P1 - - // Process previous S1. - movd vS1, Work0d - movzx Work0l, t0d - xor LookupM(0, t0), S1 - movzx Work0h, t0d - xor LookupM(1, t0), P0 - shr $16, Work0d - movzx Work0l, t0d - xor LookupM(2, t0), S3 - movzx Work0h, t0d - xor LookupM(3, t0), P2 - - // Process previous S2. - movd vS2, Work0d - movzx Work0l, t0d - xor LookupM(0, t0), S2 - movzx Work0h, t0d - xor LookupM(1, t0), P1 - shr $16, Work0d - movzx Work0l, t0d - xor LookupM(2, t0), S0 - movzx Work0h, t0d - xor LookupM(3, t0), P3 - - // Process previous S3. - movd vS3, Work0d - movzx Work0l, t0d - xor LookupM(0, t0), S3 - movzx Work0h, t0d - xor LookupM(1, t0), P2 - shr $16, Work0d - movzx Work0l, t0d - xor LookupM(2, t0), S1 - movzx Work0h, t0d - xor LookupM(3, t0), P0 - - #if defined __i386__ - paddd vIncrement, vExpandedKey - movp vExpandedKey, ExpandedKey - #else - add $Increment, ExpandedKey - #endif - - // Save state for next iteration and load next round key. - mov S0, Work0d - mov 0*4(ExpandedKey), S0 - movd S1, vS1 - mov 1*4(ExpandedKey), S1 - movd S2, vS2 - mov 2*4(ExpandedKey), S2 - movd S3, vS3 - mov 3*4(ExpandedKey), S3 - - cmp ExpandedKeyEnd, ExpandedKey - jne 1b - - /* Word 0 of the current state must be in Work0 now, and the next round - key must be in S0 to S3. - */ - - // Work around assembler bug. See comments above about Radar 5683882. - #if defined __x86_64__ - lea FTable(%rip), BaseP - #endif - - // Process previous S0. - movzx Work0l, t0 - xor LookupF(0, t0), S0 - movzx Work0h, t0d - xor LookupF(1, t0), P3 - shr $16, Work0d - movzx Work0l, t0d - xor LookupF(2, t0), S2 - movzx Work0h, t0d - xor LookupF(3, t0), P1 - - // Process previous S1. - movd vS1, Work0d - movzx Work0l, t0d - xor LookupF(0, t0), S1 - movzx Work0h, t0d - xor LookupF(1, t0), P0 - shr $16, Work0d - movzx Work0l, t0d - xor LookupF(2, t0), S3 - movzx Work0h, t0d - xor LookupF(3, t0), P2 - - // Process previous S2. - movd vS2, Work0d - movzx Work0l, t0d - xor LookupF(0, t0), S2 - movzx Work0h, t0d - xor LookupF(1, t0), P1 - shr $16, Work0d - movzx Work0l, t0d - xor LookupF(2, t0), S0 - movzx Work0h, t0d - xor LookupF(3, t0), P3 - - // Process previous S3. - movd vS3, Work0d - movzx Work0l, t0d - xor LookupF(0, t0), S3 - movzx Work0h, t0d - xor LookupF(1, t0), P2 - shr $16, Work0d - movzx Work0l, t0d - xor LookupF(2, t0), S1 - movzx Work0h, t0d - xor LookupF(3, t0), P0 - - #if defined __i386__ // Architecture. - // Get OutputText address. - #define OutputText BaseP - mov ArgOutputText, OutputText - #endif // Architecture. - - // Write output. - mov S0, 0*4(OutputText) - mov S1, 1*4(OutputText) - mov S2, 2*4(OutputText) - mov S3, 3*4(OutputText) - - // Pop stack and restore registers. - #if 0 < LocalsSize - add $LocalsSize, r4 - #endif - #if defined __i386__ - pop r7 - pop r6 - #elif defined __x86_64__ - #endif - pop r3 - pop r5 - - ret - - -#undef ArgExpandedKey -#undef ArgInputText -#undef ArgNr -#undef ArgOutputText -#undef Argument -#undef BaseP -#undef ExpandedKey -#undef ExpandedKeyEnd -#undef FTable -#undef InputText -#undef LocalsSize -#undef LookupM -#undef LookupF -#undef MTable -#undef OutputText -#undef RegisterSaveSize -#undef S0 -#undef S1 -#undef S2 -#undef S3 -#undef StackFrame -#undef Work0d -#undef Work0h -#undef Work0l -#undef Work1d -#undef Work1h -#undef Work1l -#undef Work2d -#undef Work2h -#undef Work2l -#undef Work3d -#undef Work3h -#undef Work3l -#undef t0 -#undef t0d -#undef t0l -#undef t1 -#undef vExpandedKey -#undef vS1 -#undef vS2 -#undef vS3 - -#undef Name -#undef MTable -#undef FTable -#undef P0 -#undef P1 -#undef P2 -#undef P3 -#undef Increment DELETED Source/AESedp/Intel/ExpandKeyForDecryption.s Index: Source/AESedp/Intel/ExpandKeyForDecryption.s ================================================================== --- Source/AESedp/Intel/ExpandKeyForDecryption.s +++ /dev/null @@ -1,914 +0,0 @@ -/* This file defines _AESExpandKeyForDecryption. It is designed to be - included in another assembly file with the preprocessor #include directive, - to benefit from some assembly-time calculations. - - Written by Eric Postpischil, January 2008. - - The comments here do not say much about the algorithm; the code just - follows the FIPS-197 specification. I recommend reading the specification - before working with this code or examining the C code in the parent - directory that illustrates key expansion. - - One complication is that this routine both expands the key and applies - InvMixColumn to most of the words in the expanded key. This modifies the - key for use with the Equivalent Inverse Cipher. - - During key expansion, there are sequences of four or six words that are - produced like this: - - E[i+0] = E[i+0-Nk] ^ f(E[i-1]), where f is some function. - E[i+1] = E[i+1-Nk] ^ E[i+0]. - E[i+2] = E[i+2-Nk] ^ E[i+1]. - E[i+3] = E[i+3-Nk] ^ E[i+2]. - - When Nk is four or eight, the sequence stops there. When it is six, it - goes on for two more words. Let I be the InvMixColumn function. for the - Equivalent Inverse Cipher, we want to store I(E[i+0]), I(E[i+1]), - I(E[i+2]), I(E[i+3]) (and two more when Nk is six). However, we do not - need to calculate I four times. In AES' finite field, I is a linear - combination of the four bytes of its input. The ^ operation on the bits - that represent field elements is an addition in the Galois field. So - I(a ^ b) = I(a) ^ I(b). Then we have: - - I(E[i+0]) = I(E[i+0-Nk] ^ f(E[i-1])) = I(E[i+0-Nk]) ^ I(f(E[i-1])). - I(E[i+1]) = I(E[i+1-Nk]) ^ I(E[i+0]). - I(E[i+2]) = I(E[i+2-Nk]) ^ I(E[i+1]). - I(E[i+3]) = I(E[i+3-Nk]) ^ I(E[i+2]). - - To compute this, we compute I(f(E[i-1])) and XOR it with the previously - stored E[i+0-Nk])) to get I(E[i+0])). Then we XOR that with the previously - stored E[i+1-Nk])) to get I(E[i+1])), and so on. - - Note that to compute I(f(E[i-1])), we need to have E[i-1]. So we have to - compute the pre-InvMixColumn words of the expanded key; it is not - sufficient to have the post-InvMixColumn words. -*/ - - -/* Routine: - - _AESExpandKeyForDecryption. - - Function: - - Expand the user's cipher key into the key schedule, as defined in - Federal Information Processing Standards Publication 197 (FIPS-197), - November 26, 2001. - - For decryption, the key is modified as shown in Figure 15 in FIPS-197, - to support the Equivalent Inverse Cipher. - - Input: - - Constant data: - - The following names must be locally defined so the assembler - can calculate certain offsets. - - static const Word _OLDAESSubBytesWordTable[4][256]. - - _OLDAESSubBytesWordTable[i][j] = SubBytes(j) << 8*i, where - SubBytes is defined in FIPS-197. _OLDAESSubBytesWordTable - differs from _OLDAESEncryptTable in that it does not include - the MixColumn operation. It is used in performing the last - round, which differs fromm the previous rounds in that it - does not include the MixColumn operation. - - static const Word _AESSInvMixColumnTable[4][256]. - - _OLDAESInvMixColumnTable[i][j] contains the contribution of byte - j to element i of the InvMixColumn operation. - - The four bytes of the word _OLDAESInvMixColumnTable[0][j] are: - - {0xe}*{j}, {0x9}*{j}, {0xd}*{j}, {0xb}*{j}, - - listed in increasing address order, where multiplication is - performed in the Galois field. {j} designates the element of - the Galois field represented by j. _AESInvMixColumn[i][j] has - the same bytes, rotated right in the order shown above. - - static const Byte _OLDAESRcon[]. - - Round constants, beginning with OLDAESRcon[1] for the first round - (OLDAESRcon[0] is padding.) - - Arguments: - - Word *ExpandedKey - - Address of output. - - const AESKey *Key - - Address of user's cipher key. - - long Nk - - Number of four-byte words in user's cipher key. - - Output: - - The expanded key is written to *ExpandedKey. -*/ - -#define dr r0d // Dissection register. -#define drl r0l // Low 8 bits of dissection register. -#define drh r0h // Second-lowest 8 bits of dissection register. - -#define t0 r1 -#define t0d r1d // Low 32 bits of t0. - -#define STable r2 // Address of SubBytes table. Overlaps Nk. -#define ITable r3 // Address of InvMixColumn table. -#define offset r5 // Address offset and loop sentinel. - -#define R r6 // Address of round constant. -#define K r6 // User key pointer, second x86_64 argument. - // R and K overlap. - -#define E r7 // Expanded key pointer, first x86_64 argument. - -#define ve0 %xmm0 -#define ve1 %xmm1 -#define ve2 %xmm2 -#define ve3 %xmm3 -#define ve4 %xmm4 -#define ve5 %xmm5 -#define vt1 %xmm6 -#define vt0 %xmm7 - -#define LookupS(table, index) (table)*TableSize(STable, index, 4) -#define LookupI(table, index) (table)*TableSize(ITable, index, 4) - - -/* InvMixColumn puts InvMixColumn(dr) into vt0. This is a non-standard - subroutine. It does not conform to the ABI. It is an integral part of - _ExpandKeyForDecryption and shares register use with it. -*/ -InvMixColumn: - movzx drl, t0 - movd LookupI(0, t0), vt0 // Look up byte 0 in table 0. - movzx drh, t0d - movd LookupI(1, t0), vt1 // Look up byte 1 in table 1. - pxor vt1, vt0 - shr $16, dr - movzx drl, t0d - movd LookupI(2, t0), vt1 // Look up byte 2 in table 2. - pxor vt1, vt0 - movzx drh, t0d - movd LookupI(3, t0), vt1 // Look up byte 3 in table 3. - pxor vt1, vt0 - ret - - - // SubWordRotWord adds (XORs) SubWord(RotWord(dr)) to vt0. - .macro SubWordRotWord - movzx drl, t0 - movd LookupS(3, t0), vt1 // Look up byte 0 in table 3. - pxor vt1, vt0 - movzx drh, t0d - movd LookupS(0, t0), vt1 // Look up byte 1 in table 0. - pxor vt1, vt0 - shr $$16, dr - movzx drl, t0d - movd LookupS(1, t0), vt1 // Look up byte 2 in table 1. - pxor vt1, vt0 - movzx drh, t0d - movd LookupS(2, t0), vt1 // Look up byte 3 in table 2. - pxor vt1, vt0 - .endmacro - - - // SubWord puts SubWord(dr) into vt0. - .macro SubWord - movzx drl, t0 - movd LookupS(0, t0), vt0 // Look up byte 0 in table 0. - movzx drh, t0d - movd LookupS(1, t0), vt1 // Look up byte 1 in table 1. - pxor vt1,vt0 - shr $$16, dr - movzx drl, t0d - movd LookupS(2, t0), vt1 // Look up byte 2 in table 2. - pxor vt1,vt0 - movzx drh, t0d - movd LookupS(3, t0), vt1 // Look up byte 3 in table 3. - pxor vt1,vt0 - .endmacro - - - .globl _AESExpandKeyForDecryption - .private_extern _AESExpandKeyForDecryption -_AESExpandKeyForDecryption: - - // Push new stack frame. - push r5 - - // Save registers. - push r3 - #if defined __i386__ - push r6 - push r7 - #define RegisterSaveSize (3*4) - #elif defined __x86_64__ - #define RegisterSaveSize (1*8) - // Add pushes of r12 to r15 if used. - #endif - -#define LocalsSize 0 -#define StackFrame (LocalsSize+RegisterSaveSize) - // Locals plus the registers we pushed after the new stack frame. - -/* Define stack offset to storage space for local data. This is in the red - zone. We point far enough down to allow space for eight four-byte words - plus a return address (4 or 8 bytes on i386 or x86_64) for our internal - subroutine calls. -*/ -#define Local (-8*4-8) - -#if defined __i386__ - - // Define location of argument i. - #define Argument(i) StackFrame+8+4*(i)(r4) - - // Load arguments. - mov Argument(0), E - mov Argument(1), K - #define Nk Argument(2) - -#elif defined __x86_64__ - - #define Nk r2 // Number of words in key. Overlaps STable. - -#endif - - cmp $6, Nk - - #if 0 < LocalsSize - sub $LocalsSize, r4 // Allocate space on stack. - #endif - - // First words of expanded key are copied from user key. - movd 0*4(K), ve0 - movd 1*4(K), ve1 - movd 2*4(K), ve2 - movd 3*4(K), ve3 - je DKeyHas6Words - jg DKeyHas8Words - // Fall through to DKeyHas4Words. - -DKeyHas4Words: - - // K cannot be used after we write to R, since they use the same register. - - #if defined __i386__ - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: - pop STable // Get program counter. - - lea _OLDAESRcon-0b(STable), R - lea _OLDAESInvMixColumnTable-0b(STable), ITable - lea _OLDAESSubBytesWordTable-0b(STable), STable - - #elif defined __x86_64__ - - lea _OLDAESRcon(%rip), R - lea _OLDAESInvMixColumnTable(%rip), ITable - lea _OLDAESSubBytesWordTable(%rip), STable - - #endif - - /* With a four-word key, there are ten rounds (eleven 16-byte key blocks), - nine of which have InvMixColumn applied. - */ - mov $-9*4*4, offset - sub offset, E - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 0*4(E, offset) - movd ve1, 1*4(E, offset) - movd ve2, 2*4(E, offset) - movd ve3, 3*4(E, offset) - -/* Here is the first iteration of the key expansion. It is separate from the - main loop below because we need to apply InvMixColumn to each of the - outputs, in ve0 through ve3. In the main loop, the technique described at - the top of this file is used to compute the proper outputs while using - InvMixColumn only once. -*/ - add $1, R // Advance pointer. - movd ve3, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - pxor ve0, ve1 - pxor ve1, ve2 - pxor ve2, ve3 - - add $4*4, offset - - /* Apply InvMixColumn to each word. The transformed values are stored in - the expanded key. The original values are retained in registers for - further computation. - */ - movd ve0, dr - call InvMixColumn - movd vt0, 0*4(E, offset) - - movd ve1, dr - call InvMixColumn - movd vt0, 1*4(E, offset) - - movd ve2, dr - call InvMixColumn - movd vt0, 2*4(E, offset) - - movd ve3, dr - call InvMixColumn - movd vt0, 3*4(E, offset) - -// Here is the main loop. -1: - add $1, R // Advance pointer. - movd ve3, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - pxor ve0, ve1 - pxor ve1, ve2 - pxor ve2, ve3 - /* Dr. Brian Gladman uses a technique with a single XOR here instead - of the previous four. There is some periodic behavior in the key - expansion, and Gladman maintains E[4*i+3] for the latest four - values of i. XORing the value in vt0 with one of these yields its - replacement. However, using this technique requires additional - instructions before the loop (to initialize the values) and after - it (to extract the final values to be stored) and either some way - to rotate or index four values in the loop or a four-fold unrolling - of the loop to provide the indexing. Experiment suggests the - former is not worthwhile. Unrolling the loop might give a small - gain, at the cost of increased use of instruction cache, increased - instructions loads the first time the routine is executed, and - increased code complexity, so I decided against it. - */ - - // Apply InvMixColumn to the difference. - movd vt0, dr - call InvMixColumn - - add $4*4, offset - - // Chain the transformed difference to previously transformed outputs. - movd (0-4)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 0*4(E, offset) - - movd (1-4)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 1*4(E, offset) - - movd (2-4)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 2*4(E, offset) - - movd (3-4)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 3*4(E, offset) - - jl 1b - -// Here is the final iteration, which does not perform InvMixColumn. - - movd ve3, dr // Put previous word into work register. - movzx 1(R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - movd ve0, 4*4(E, offset) - pxor ve0, ve1 - movd ve1, 5*4(E, offset) - pxor ve1, ve2 - movd ve2, 6*4(E, offset) - pxor ve2, ve3 - movd ve3, 7*4(E, offset) - - // Pop stack and restore registers. - #if 0 < LocalsSize - add $LocalsSize, r4 - #endif - #if defined __i386__ - // Add pops of r15 to r12 if used. - pop r7 - pop r6 - #elif defined __x86_64__ - #endif - pop r3 - pop r5 - - ret - - -DKeyHas6Words: - movd 4*4(K), ve4 - movd 5*4(K), ve5 - - // K cannot be used after we write to R, since they use the same register. - - #if defined __i386__ - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: - pop STable // Get program counter. - - lea _OLDAESRcon-0b(STable), R - lea _OLDAESInvMixColumnTable-0b(STable), ITable - lea _OLDAESSubBytesWordTable-0b(STable), STable - - #elif defined __x86_64__ - - lea _OLDAESRcon(%rip), R - lea _OLDAESInvMixColumnTable(%rip), ITable - lea _OLDAESSubBytesWordTable(%rip), STable - - #endif - - /* With a six-word key, there are twelve rounds (thirteen 16-byte key - blocks), eleven of which have InvMixColumn applied. The key expansion - proceeds in iterations of six four-byte words, so the termination - condition is a bit complicated. We set offset to the negative of 10 - four four-byte words, and the loop branch does another iteration if - offset is less than or equal to zero, meaning the number of iterations - performed so far is less than or equal to 10. Thus, after ten - iterations, it branches again. After the eleventh iteration, it - stops. Code after the end of the loop computes the twelfth key block, - which does not have InvMixColumn applied. - */ - mov $-10*4*4, offset - sub offset, E - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 0*4(E, offset) - movd ve1, 1*4(E, offset) - movd ve2, 2*4(E, offset) - movd ve3, 3*4(E, offset) - - /* The first four words are stored untransformed. After that, words in - the expanded key are transformed by InvMixColumn. - */ - movd ve4, dr - call InvMixColumn - movd vt0, 4*4(E, offset) - - movd ve5, dr - call InvMixColumn - movd vt0, 5*4(E, offset) - -/* Here is the first iteration of the key expansion. It is separate from the - main loop below because we need to apply InvMixColumn to each of the - outputs, in ve0 through ve5. In the main loop, the technique described at - the top of this file is used to compute the proper outputs while using - InvMixColumn only once. -*/ - add $1, R // Advance pointer. - movd ve5, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - pxor ve0, ve1 - pxor ve1, ve2 - pxor ve2, ve3 - pxor ve3, ve4 - pxor ve4, ve5 - - add $6*4, offset - - /* Apply InvMixColumn to each word. The transformed values are stored in - the expanded key. The original values are retained in registers for - further computation. - */ - movd ve0, dr - call InvMixColumn - movd vt0, 0*4(E, offset) - - movd ve1, dr - call InvMixColumn - movd vt0, 1*4(E, offset) - - movd ve2, dr - call InvMixColumn - movd vt0, 2*4(E, offset) - - movd ve3, dr - call InvMixColumn - movd vt0, 3*4(E, offset) - - movd (4-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 4*4(E, offset) - - movd (5-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 5*4(E, offset) - -// Here is the main loop. -1: - add $1, R // Advance pointer. - movd ve5, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - pxor ve0, ve1 - pxor ve1, ve2 - pxor ve2, ve3 - pxor ve3, ve4 - pxor ve4, ve5 - - // Apply InvMixColumn to the difference. - movd vt0, dr - call InvMixColumn - - add $6*4, offset - - // Chain the transformed difference to previously transformed outputs. - movd (0-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 0*4(E, offset) - - movd (1-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 1*4(E, offset) - - movd (2-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 2*4(E, offset) - - movd (3-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 3*4(E, offset) - - movd (4-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 4*4(E, offset) - - movd (5-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 5*4(E, offset) - - jle 1b - -// Here is the final iteration, which does not perform InvMixColumn. - - movd ve5, dr // Put previous word into work register. - movzx 1(R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - movd ve0, 6*4(E, offset) - pxor ve0, ve1 - movd ve1, 7*4(E, offset) - pxor ve1, ve2 - movd ve2, 8*4(E, offset) - pxor ve2, ve3 - movd ve3, 9*4(E, offset) - - // Pop stack and restore registers. - #if 0 < LocalsSize - add $LocalsSize, r4 - #endif - #if defined __i386__ - // Add pops of r15 to r12 if used. - pop r7 - pop r6 - #elif defined __x86_64__ - #endif - pop r3 - pop r5 - - ret - - -DKeyHas8Words: - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 0*4(E) - movd ve1, 1*4(E) - movd ve2, 2*4(E) - movd ve3, 3*4(E) - movd 4*4(K), ve0 - movd 5*4(K), ve1 - movd 6*4(K), ve2 - movd 7*4(K), ve3 - - // K cannot be used after we write to R, since they use the same register. - - #if defined __i386__ - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: - pop STable // Get program counter. - - lea _OLDAESRcon-0b(STable), R - lea _OLDAESInvMixColumnTable-0b(STable), ITable - lea _OLDAESSubBytesWordTable-0b(STable), STable - - #elif defined __x86_64__ - - lea _OLDAESRcon(%rip), R - lea _OLDAESInvMixColumnTable(%rip), ITable - lea _OLDAESSubBytesWordTable(%rip), STable - - #endif - - /* With an eight-word key, there are fourteen rounds (fifteen 16-byte key - blocks), thirteen of which have InvMixColumn applied. - */ - mov $-12*4*4, offset - sub offset, E - - // Save untransformed values in stack area. - movd ve0, 4*4+Local(r4) - movd ve1, 5*4+Local(r4) - movd ve2, 6*4+Local(r4) - movd ve3, 7*4+Local(r4) - - /* Apply InvMixColumn to words 4 through 7. The transformed values are - stored in the expanded key. The original values are saved in the stack - area for further computation. - */ - movd ve0, dr - call InvMixColumn - movd vt0, 4*4(E, offset) - - movd ve1, dr - call InvMixColumn - movd vt0, 5*4(E, offset) - - movd ve2, dr - call InvMixColumn - movd vt0, 6*4(E, offset) - - movd ve3, dr - call InvMixColumn - movd vt0, 7*4(E, offset) - -/* Here is the first iteration of the key expansion. It is separate from the - main loop below because we need to apply InvMixColumn to each of the - outputs, in ve0 through ve3. In the main loop, the technique described at - the top of this file is used to compute the proper outputs while using - InvMixColumn only once. -*/ - add $1, R // Advance pointer. - movd ve3, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - - add $8*4, offset - - movd (0-8)*4(E, offset), ve0 // Get old word. - pxor vt0, ve0 - movd ve0, 0*4+Local(r4) // Save on stack. - movd ve0, dr - call InvMixColumn - movd vt0, 0*4(E, offset) // Write to expanded key. - - /* Chain to successive words and apply InvMixColumn to each word. The - transformed values are stored in the expanded key. The original - values are retained in local data for further computation. - */ - movd (1-8)*4(E, offset), ve1 // Get old word. - pxor ve0, ve1 // Chain. - movd ve1, 1*4+Local(r4) // Save on stack. - movd ve1, dr - call InvMixColumn - movd vt0, 1*4(E, offset) // Write to expanded key. - - movd (2-8)*4(E, offset), ve2 // Get old word. - pxor ve1, ve2 // Chain. - movd ve2, 2*4+Local(r4) // Save on stack. - movd ve2, dr - call InvMixColumn - movd vt0, 2*4(E, offset) // Write to expanded key. - - movd (3-8)*4(E, offset), ve3 // Get old word. - pxor ve2, ve3 // Chain. - movd ve3, 3*4+Local(r4) // Save on stack. - movd ve3, dr - call InvMixColumn - movd vt0, 3*4(E, offset) // Write to expanded key. - - movd ve3, dr // Put previous word into work register. - SubWord - - movd 4*4+Local(r4), ve0 // Get old word. - pxor vt0, ve0 // Chain. - movd ve0, 4*4+Local(r4) // Save on stack. - - movd 5*4+Local(r4), ve1 // Get old word. - pxor ve0, ve1 // Chain. - movd ve1, 5*4+Local(r4) // Save on stack. - - movd 6*4+Local(r4), ve2 // Get old word. - pxor ve1, ve2 // Chain. - movd ve2, 6*4+Local(r4) // Save on stack. - - movd 7*4+Local(r4), ve3 // Get old word. - pxor ve2, ve3 // Chain. - movd ve3, 7*4+Local(r4) // Save on stack. - - movd vt0, dr // Move change to work register. - call InvMixColumn - - movd (4-8)*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, 4*4(E, offset) // Write new word to expanded key. - - movd (5-8)*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, 5*4(E, offset) // Write new word to expanded key. - - movd (6-8)*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, 6*4(E, offset) // Write new word to expanded key. - - movd (7-8)*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, 7*4(E, offset) // Write new word to expanded key. - -// Here is the main loop. -1: - add $1, R // Advance pointer. - movd ve3, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - - movd 0*4+Local(r4), ve0 // Get old word. - pxor vt0, ve0 - movd ve0, 0*4+Local(r4) // Save on stack. - - // Chain to successive words. - movd 1*4+Local(r4), ve1 // Get old word. - pxor ve0, ve1 // Chain. - movd ve1, 1*4+Local(r4) // Save on stack. - - movd 2*4+Local(r4), ve2 // Get old word. - pxor ve1, ve2 // Chain. - movd ve2, 2*4+Local(r4) // Save on stack. - - movd 3*4+Local(r4), ve3 // Get old word. - pxor ve2, ve3 // Chain. - movd ve3, 3*4+Local(r4) // Save on stack. - - movd vt0, dr // Move change to work register. - call InvMixColumn - - movd 0*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (0+8)*4(E, offset) // Write new word to expanded key. - - movd 1*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (1+8)*4(E, offset) // Write new word to expanded key. - - movd 2*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (2+8)*4(E, offset) // Write new word to expanded key. - - movd 3*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (3+8)*4(E, offset) // Write new word to expanded key. - - movd ve3, dr // Put previous word into work register. - SubWord - - movd 4*4+Local(r4), ve0 // Get old word. - pxor vt0, ve0 // Chain. - movd ve0, 4*4+Local(r4) // Save on stack. - - movd 5*4+Local(r4), ve1 // Get old word. - pxor ve0, ve1 // Chain. - movd ve1, 5*4+Local(r4) // Save on stack. - - movd 6*4+Local(r4), ve2 // Get old word. - pxor ve1, ve2 // Chain. - movd ve2, 6*4+Local(r4) // Save on stack. - - movd 7*4+Local(r4), ve3 // Get old word. - pxor ve2, ve3 // Chain. - movd ve3, 7*4+Local(r4) // Save on stack. - - movd vt0, dr // Move change to work register. - call InvMixColumn - - movd 4*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (4+8)*4(E, offset) // Write new word to expanded key. - - movd 5*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (5+8)*4(E, offset) // Write new word to expanded key. - - movd 6*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (6+8)*4(E, offset) // Write new word to expanded key. - - movd 7*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (7+8)*4(E, offset) // Write new word to expanded key. - - add $8*4, offset - - jl 1b - - movd ve3, dr // Put previous word into work register. - movzx 1(R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - - movd 0*4+Local(r4), ve0 // Get old word. - pxor vt0, ve0 // Chain. - movd ve0, (0+8)*4(E, offset) - - // Chain to successive words. - movd 1*4+Local(r4), ve1 // Get old word. - pxor ve0, ve1 // Chain. - movd ve1, (1+8)*4(E, offset) - - movd 2*4+Local(r4), ve2 // Get old word. - pxor ve1, ve2 // Chain. - movd ve2, (2+8)*4(E, offset) - - movd 3*4+Local(r4), ve3 // Get old word. - pxor ve2, ve3 // Chain. - movd ve3, (3+8)*4(E, offset) - - // Pop stack and restore registers. - #if 0 < LocalsSize - add $LocalsSize, r4 - #endif - #if defined __i386__ - // Add pops of r15 to r12 if used. - pop r7 - pop r6 - #elif defined __x86_64__ - #endif - pop r3 - pop r5 - - ret - - -#undef Address -#undef Argument -#undef E -#undef ITable -#undef K -#undef LocalsSize -#undef LookupI -#undef LookupS -#undef Nk -#undef R -#undef RegisterSaveSize -#undef STable -#undef StackFrame -#undef dr -#undef drh -#undef drl -#undef offset -#undef t0 -#undef t0d -#undef ve0 -#undef ve1 -#undef ve2 -#undef ve3 -#undef ve4 -#undef ve5 -#undef vt0 -#undef vt1 DELETED Source/AESedp/Intel/ExpandKeyForEncryption.s Index: Source/AESedp/Intel/ExpandKeyForEncryption.s ================================================================== --- Source/AESedp/Intel/ExpandKeyForEncryption.s +++ /dev/null @@ -1,496 +0,0 @@ -/* This file defines _AESExpandKeyForEncryption. It is designed to be - included in another assembly file with the preprocessor #include directive, - to benefit from some assembly-time calculations. - - Written by Eric Postpischil, January 2008. - - The comments here do not say much about the algorithm; the code just - follows the FIPS-197 specification. I recommend reading the specification - before working with this code or examining the C code in the parent - directory that illustrates key expansion. -*/ - - -/* Routine: - - _AESExpandKeyForEncryption. - - Function: - - Expand the user's cipher key into the key schedule, as defined in - Federal Information Processing Standards Publication 197 (FIPS-197), - November 26, 2001. - - Input: - - Constant data: - - The following names must be locally defined so the assembler - can calculate certain offsets. - - static const Word _OLDAESSubBytesWordTable[4][256]. - - _OLDAESSubBytesWordTable[i][j] = SubBytes(j) << 8*i, where - SubBytes is defined in FIPS-197. _OLDAESSubBytesWordTable - differs from _OLDAESEncryptTable in that it does not include - the MixColumn operation. It is used in performing the last - round, which differs fromm the previous rounds in that it - does not include the MixColumn operation. - - static const Byte _OLDAESRcon[]. - - Round constants, beginning with OLDAESRcon[1] for the first round - (OLDAESRcon[0] is padding.) - - Arguments: - - Word *ExpandedKey - - Address of output. - - const AESKey *Key - - Address of user's cipher key. - - long Nk - - Number of four-byte words in user's cipher key. - - Output: - - The expanded key is written to *ExpandedKey. -*/ - .globl _AESExpandKeyForEncryption - .private_extern _AESExpandKeyForEncryption -_AESExpandKeyForEncryption: - -#define dr r0d // Dissection register. -#define drl r0l // Low 8 bits of dissection register. -#define drh r0h // Second-lowest 8 bits of dissection register. - -#define t0 r1 -#define t0d r1d // Low 32 bits of t0. - -#define offset r5 // Address offset and loop sentinel. - -#define R r6 // Address of round constant. -#define K r6 // User key pointer, second x86_64 argument. - // R and K overlap. - -#define E r7 // Expanded key pointer, first x86_64 argument. - -#define ve0 %xmm0 -#define ve1 %xmm1 -#define ve2 %xmm2 -#define ve3 %xmm3 -#define vt3 %xmm4 -#define vt2 %xmm5 -#define vt1 %xmm6 -#define vt0 %xmm7 - -#define LookupS(table, index) (table)*TableSize(STable, index, 4) - - // Push new stack frame. - push r5 - - // Save registers. - #if defined __i386__ - push r6 - push r7 - #define RegisterSaveSize (2*4) - #elif defined __x86_64__ - #define RegisterSaveSize (0*8) - // Add pushes of r12 to r15 if used. - #endif - -#define LocalsSize 0 -#define StackFrame (LocalsSize+RegisterSaveSize) - // Locals plus the registers we pushed after the new stack frame. - -#if defined __i386__ - - // Define location of argument i. - #define Argument(i) StackFrame+8+4*(i)(r4) - - // Load arguments. - mov Argument(0), E - mov Argument(1), K - #define Nk Argument(2) - -#elif defined __x86_64__ - - #define Nk r2 // Number of words in key. Overlaps STable. - -#endif - - cmp $6, Nk -// Stop using r2 for Nk and start using it for STable. -#undef Nk -#define STable r2 - - #if 0 < LocalsSize - sub $LocalsSize, r4 // Allocate space on stack. - #endif - - // First words of expanded key are copied from user key. - movd 0*4(K), ve0 - movd 1*4(K), ve1 - movd 2*4(K), ve2 - movd 3*4(K), ve3 - je EKeyHas6Words - jg EKeyHas8Words - // Fall through to EKeyHas4Words. - -EKeyHas4Words: - - // K cannot be used after we write to R, since they use the same register. - - #if defined __i386__ - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: - pop STable // Get program counter. - - lea _OLDAESRcon-0b(STable), R - lea _OLDAESSubBytesWordTable-0b(STable), STable - - #elif defined __x86_64__ - - lea _OLDAESRcon(%rip), R - lea _OLDAESSubBytesWordTable(%rip), STable - - #endif - - // With a four-word key, there are ten rounds (eleven 16-byte key blocks). - mov $-10*4*4, offset - sub offset, E - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 0*4(E, offset) - movd ve1, 1*4(E, offset) - movd ve2, 2*4(E, offset) - movd ve3, 3*4(E, offset) - -1: - add $1, R // Advance pointer. - movd ve3, dr // Put previous word into dissection register. - movzx (R), t0d // Get round constant. - movd t0d, vt3 - pxor vt3, ve0 // XOR with word from four words back. - - // Perform SubWord(RotWord(dr)). - movzx drl, t0 - movd LookupS(3, t0), vt0 // Look up byte 0 in table 3. - movzx drh, t0d - movd LookupS(0, t0), vt1 // Look up byte 1 in table 0. - shr $16, dr - movzx drl, t0d - movd LookupS(1, t0), vt2 // Look up byte 2 in table 1. - movzx drh, t0d - movd LookupS(2, t0), vt3 // Look up byte 3 in table 2. - pxor vt1, vt0 - pxor vt3, vt2 - pxor vt0, ve0 - pxor vt2, ve0 - - add $4*4, offset - - // Chain to successive words. - movd ve0, 0*4(E, offset) - pxor ve0, ve1 - movd ve1, 1*4(E, offset) - pxor ve1, ve2 - movd ve2, 2*4(E, offset) - pxor ve2, ve3 - movd ve3, 3*4(E, offset) - - jne 1b - - // Pop stack and restore registers. - #if 0 < LocalsSize - add $LocalsSize, r4 - #endif - #if defined __i386__ - // Add pops of r15 to r12 if used. - pop r7 - pop r6 - #elif defined __x86_64 - #endif - pop r5 - - ret - - -// Reset definitions for next case. -#undef vt3 -#undef vt2 -#define ve4 %xmm4 -#define ve5 %xmm5 - - -EKeyHas6Words: - movd 4*4(K), ve4 - movd 5*4(K), ve5 - - // K cannot be used after we write to R, since they use the same register. - - #if defined __i386__ - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: - pop STable // Get program counter. - - lea _OLDAESRcon-0b(STable), R - lea _OLDAESSubBytesWordTable-0b(STable), STable - - #elif defined __x86_64__ - - lea _OLDAESRcon(%rip), R - lea _OLDAESSubBytesWordTable(%rip), STable - - #endif - - /* With a six-word key, there are twelve rounds (thirteen 16-byte key - blocks). - */ - mov $-12*4*4, offset - sub offset, E - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 0*4(E, offset) - movd ve1, 1*4(E, offset) - movd ve2, 2*4(E, offset) - movd ve3, 3*4(E, offset) - movd ve4, 4*4(E, offset) - movd ve5, 5*4(E, offset) - -/* Jump into loop body. The key expansion processes six four-byte words per - iteration. 52 are needed in the key. So only four are needed in the last - iteration. -*/ - jmp 2f -1: - // Continue chaining to successive words. - pxor ve3, ve4 - movd ve4, 4*4(E, offset) - pxor ve4, ve5 - movd ve5, 5*4(E, offset) -2: - add $1, R // Advance pointer. - movd ve5, dr // Put previous word into dissection register. - movzx (R), t0 // Get round constant. - movd t0d, vt1 - pxor vt1, ve0 // XOR with word from six words back. - - // Perform SubWord(RotWord(dr)). - movzx drl, t0d - movd LookupS(3, t0), vt0 // Look up byte 0 in table 3. - movzx drh, t0d - movd LookupS(0, t0), vt1 // Look up byte 1 in table 0. - shr $16, dr - movzx drl, t0d - pxor vt1, vt0 - pxor vt0, ve0 - movd LookupS(1, t0), vt0 // Look up byte 2 in table 1. - movzx drh, t0d - movd LookupS(2, t0), vt1 // Look up byte 3 in table 2. - pxor vt1, vt0 - pxor vt0, ve0 - - add $6*4, offset - - // Chain to successive words. - movd ve0, 0*4(E, offset) - pxor ve0, ve1 - movd ve1, 1*4(E, offset) - pxor ve1, ve2 - movd ve2, 2*4(E, offset) - pxor ve2, ve3 - movd ve3, 3*4(E, offset) - - jne 1b - - // Pop stack and restore registers. - #if 0 < LocalsSize - add $LocalsSize, r4 - #endif - #if defined __i386__ - // Add pops of r15 to r12 if used. - pop r7 - pop r6 - #elif defined __x86_64 - #endif - pop r5 - - ret - - -// Reset definitions for next case. -#undef ve4 -#undef ve5 -#define vt3 %xmm4 -#define vt2 %xmm5 - - -EKeyHas8Words: - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 0*4(E) - movd ve1, 1*4(E) - movd ve2, 2*4(E) - movd ve3, 3*4(E) - movd 4*4(K), ve0 - movd 5*4(K), ve1 - movd 6*4(K), ve2 - movd 7*4(K), ve3 - - // K cannot be used after we write to R, since they use the same register. - - #if defined __i386__ - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: - pop STable // Get program counter. - - lea _OLDAESRcon-0b(STable), R - lea _OLDAESSubBytesWordTable-0b(STable), STable - - #elif defined __x86_64__ - - lea _OLDAESRcon(%rip), R - lea _OLDAESSubBytesWordTable(%rip), STable - - #endif - - /* With an eight-word key, there are fourteen rounds (fifteen 16-byte key - blocks). - */ - mov $-14*4*4, offset - sub offset, E - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 4*4(E, offset) - movd ve1, 5*4(E, offset) - movd ve2, 6*4(E, offset) - movd ve3, 7*4(E, offset) - -/* Jump into loop body. The key expansion processes eight four-byte words per - iteration. 60 are needed in the key. So only four are needed in the last - iteration. -*/ - jmp 2f -1: - movd ve3, dr // Put previous word into dissection register. - - /* Get word from eight words back (it is four words back from where E - currently points, and we use it to prepare the value to be stored - four words beyond where E currently points). - */ - movd -4*4(E, offset), ve0 - - // Perform SubWord(dr). - movzx drl, t0 - movd LookupS(0, t0), vt0 // Look up byte 0 in table 0. - movzx drh, t0d - movd LookupS(1, t0), vt1 // Look up byte 1 in table 1. - shr $16, dr - movzx drl, t0d - movd LookupS(2, t0), vt2 // Look up byte 2 in table 2. - movzx drh, t0d - movd LookupS(3, t0), vt3 // Look up byte 3 in table 3. - pxor vt1, vt0 - pxor vt3, vt2 - pxor vt0, ve0 - pxor vt2, ve0 - - movd -3*4(E, offset), ve1 // Get words from eight words back. - movd -2*4(E, offset), ve2 - movd -1*4(E, offset), ve3 - - // Chain to successive words. - movd ve0, 4*4(E, offset) - pxor ve0, ve1 - movd ve1, 5*4(E, offset) - pxor ve1, ve2 - movd ve2, 6*4(E, offset) - pxor ve2, ve3 - movd ve3, 7*4(E, offset) - -2: - add $1, R // Advance pointer. - movd ve3, dr // Put previous word into dissection register. - movzx (R), t0d // Get round constant. - movd t0d, vt1 - movd 0*4(E, offset), ve0 // Get word from eight words back. - pxor vt1, ve0 - - // Perform SubWord(RotWord(dr)). - movzx drl, t0 - movd LookupS(3, t0), vt0 // Look up byte 0 in table 3. - movzx drh, t0d - movd LookupS(0, t0), vt1 // Look up byte 1 in table 0. - shr $16, dr - movzx drl, t0d - movd LookupS(1, t0), vt2 // Look up byte 2 in table 1. - movzx drh, t0d - movd LookupS(2, t0), vt3 // Look up byte 3 in table 2. - pxor vt1, vt0 - pxor vt3, vt2 - pxor vt0, ve0 - pxor vt2, ve0 - - movd 1*4(E, offset), ve1 - movd 2*4(E, offset), ve2 - movd 3*4(E, offset), ve3 - - add $8*4, offset - - // Chain to successive words. - movd ve0, 0*4(E, offset) - pxor ve0, ve1 - movd ve1, 1*4(E, offset) - pxor ve1, ve2 - movd ve2, 2*4(E, offset) - pxor ve2, ve3 - movd ve3, 3*4(E, offset) - - jne 1b - - // Pop stack and restore registers. - #if 0 < LocalsSize - add $LocalsSize, r4 - #endif - #if defined __i386__ - // Add pops of r15 to r12 if used. - pop r7 - pop r6 - #elif defined __x86_64 - #endif - pop r5 - - ret - - -#undef Address -#undef Argument -#undef E -#undef LocalsSize -#undef LookupS -#undef R -#undef RegisterSaveSize -#undef STable -#undef StackFrame -#undef dr -#undef drh -#undef drl -#undef offset -#undef t0 -#undef t0d -#undef ve0 -#undef ve1 -#undef ve2 -#undef ve3 -#undef vt0 -#undef vt1 -#undef vt2 -#undef vt3 DELETED Source/AESedp/Intel/ReadMe.txt Index: Source/AESedp/Intel/ReadMe.txt ================================================================== --- Source/AESedp/Intel/ReadMe.txt +++ /dev/null @@ -1,4 +0,0 @@ -This directory contains implementations of core AES routines (the actual -encryption, decryption, and key expansion) for the i386 (IA-32) and x86_64 -(EMT64) architectures. These routines are intended to be called by routines -in the parent directory. DELETED Source/AESedp/MakeData.c Index: Source/AESedp/MakeData.c ================================================================== --- Source/AESedp/MakeData.c +++ /dev/null @@ -1,513 +0,0 @@ -#include -#include -#include - -#define UseAESedp // Tell AES.h to define things for AESedp. -#include "AES.h" - - -/* In comments below, {n} designates the Galois field element represented by - the byte n. See notes about Galois field multiplication in ReadMe.txt. - - So 3+5 is addition of ordinary integers, and 3+5 == 8, while {3}+{5} is - addition in the field, and {3} + {5} = {3 XOR 5} = {6}.) -*/ - - -// Define constants for languages. -typedef enum { C, IntelAssembly } Language; - - -/* LogBase3[i] will contain the base-three logarithm of i in the 256-element - Galois field defined by AES. That is, {3}**LogBase3[i] == {3}**i. -*/ -static Byte LogBase3[256]; - -/* AntilogBase3[i] will contain {3}**i in the 256-element Galois field defined - by AES. It contains extra elements so that the antilog of a+b can be found - by looking up a+b directly, without having to reduce modulo the period, for - 0 <= a, b < 255. - - (254 is the greatest value we encounter. Each a or b we use is the - base-three logarithm of some element. As a primitive root, the powers of - three cycle through all non-zero elements of the field, of which there are - 255, so the exponents cover 0 to 254 before the powers repeat.) -*/ -static Byte AntilogBase3[254+254+1]; - - -static void InitializeLogTables(void) -{ - // log({1}) is zero, so start {p} (power) at {1} and l (logarithm) at 0. - Byte p = 1; - int l = 0; - do - { - // Record table entries. - LogBase3[p] = l; - AntilogBase3[l] = p; - - /* Observe that {2}*{p} is {p << 1 ^ (a & 0x80 ? 0x1b : 0)}, per notes - in ReadMe.txt. We produce {3}*{p}: - - {3}*{p} - = {1}*{p} + {2}*{p} - = {1}*{p} + {p << 1 ^ (a & 0x80 ? 0x1b : 0)} - = {p ^ p << 1 ^ (p & 0x80 ? 0x1b : 0)}. - */ - p ^= p << 1 ^ (p & 0x80 ? 0x1b : 0); - ++l; - - } while (p != 1); // Stop when we have gone around completely. - - /* The antilogarithms are periodic with a period of 255, and we want to - look up elements as high as 254+254 (the largest that a sum of two - logarithms could be), so we replicate the table beyond the first - period. - */ - for (l = 255; l < 254+254; ++l) - AntilogBase3[l] = AntilogBase3[l-255]; -} - - -/* MultiplyByte(Byte b, Byte c) returns {b}*{c}. It requires tables that must - be initialized before this routine is used. -*/ -static Byte MultiplyByte(Byte b, Byte c) -{ - // Calculate product by adding logarithms, but avoid logarithms of zero. - return b == 0 || c == 0 ? 0 : AntilogBase3[LogBase3[b] + LogBase3[c]]; -} - - -// Return {0} if {b} is {0} and the multiplicative inverse of {b} otherwise. -static Byte InverseByte(Byte b) -{ - return b == 0 ? 0 : AntilogBase3[255 - LogBase3[b]]; -} - - -// Perform AES' SubBytes operation on a single byte. -static Byte SubByte(Byte b) -{ - unsigned int r = InverseByte(b); - - // Duplicate r as a proxy for a rotate operation. - r = r | r<<8; - - // Apply the standard's affine transformation. - return r ^ r>>4 ^ r>>5 ^ r>>6 ^ r>>7 ^ 0x63; -} - - -// Define and populate tables for the SubBytes and InvSubBytes operations. -static Byte SubBytesTable[256]; -static Byte InvSubBytesTable[256]; - - -static void InitializeSubBytesTable(void) -{ - for (int i = 0; i < 256; ++i) - SubBytesTable[i] = SubByte((Byte) i); -} - - -static void InitializeInvSubBytesTable(void) -{ - for (int i = 0; i < 256; ++i) - InvSubBytesTable[SubByte((Byte) i)] = i; -} - - -/* Print tables for SubBytes function providing the output byte embedded in - various places in a word, so that the table entries can be used with - fewer byte manipulations. -*/ -static void PrintSubBytesWordTable(Language language) -{ - switch (language) - { - case C: - printf("\n\n" - "// SubBytes embedded in words tables.\n" - "const Word AESSubBytesWordTable[4][256] =\n" - "{\n"); - for (int j = 0; j < 4; ++j) - { - printf("\t{\n"); - for (int i = 0; i < 256; ++i) - printf("\t\t0x%08x,\n", SubBytesTable[i] << j*8); - printf("\t},\n"); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// SubBytes embedded in words tables.\n" - "\t.globl\t_AESSubBytesWordTable\n" - "\t.private_extern\t_AESSubBytesWordTable\n" - "\t.align\t2\n" - "_AESSubBytesWordTable:\n"); - for (int j = 0; j < 4; ++j) - { - printf("\t// Table %d.\n", j); - for (int i = 0; i < 256; ++i) - printf("\t.long\t0x%08x\n", SubBytesTable[i] << j*8); - } - break; - } -} - - -/* Print tables for InvSubBytes function providing the output byte embedded in - various places in a word, so that the table entries can be used with - fewer byte manipulations. -*/ -static void PrintInvSubBytesWordTable(Language language) -{ - switch (language) - { - case C: - printf("\n\n" - "// InvSubBytes embedded in words tables.\n" - "const Word AESInvSubBytesWordTable[4][256] =\n" - "{\n"); - for (int j = 0; j < 4; ++j) - { - printf("\t{\n"); - for (int i = 0; i < 256; ++i) - printf("\t\t0x%08x,\n", InvSubBytesTable[i] << j*8); - printf("\t},\n"); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// InvSubBytes embedded in words tables.\n" - "\t.globl\t_AESInvSubBytesWordTable\n" - "\t.private_extern\t_AESInvSubBytesWordTable\n" - "\t.align\t2\n" - "_AESInvSubBytesWordTable:\n"); - for (int j = 0; j < 4; ++j) - { - printf("\t// Table %d.\n", j); - for (int i = 0; i < 256; ++i) - printf("\t.long\t0x%08x\n", InvSubBytesTable[i] << j*8); - } - break; - } -} - - -// Print the round constants. -static void PrintRcon(Language language) -{ - union { Byte c[4]; Word w; } t = { { 1, 0, 0, 0 } }; - - switch (language) - { - case C: - printf("\n\n" - "// Round constants.\n" - "const Byte AESRcon[] =\n" - "{\n" - "\t0,\t// Not used, included for indexing simplicity.\n"); - for (int i = 1; i < MaxRcon; ++i) - { - printf("\t0x%02x,\n", t.w); - t.c[0] = MultiplyByte(0x2, t.c[0]); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// Round constants.\n" - "\t.globl\t_AESRcon\n" - "\t.private_extern\t_AESRcon\n" - "_AESRcon:\n" - "\t.byte\t0\t// Not used, included for indexing simplicity.\n"); - for (int i = 1; i < MaxRcon; ++i) - { - printf("\t.byte\t0x%02x\n", t.w); - t.c[0] = MultiplyByte(0x2, t.c[0]); - } - break; - } -} - - -// Print tables for the InvMixColumn operation. -static void PrintInvMixColumnTable(Language language) -{ - Word T[4][256]; - - for (int i = 0; i < 256; ++i) - { - union { Byte b[4]; Word w; } c; - - Byte s9 = MultiplyByte(0x9, i); - Byte sb = MultiplyByte(0xb, i); - Byte sd = MultiplyByte(0xd, i); - Byte se = MultiplyByte(0xe, i); - - c.b[0] = se; - c.b[1] = s9; - c.b[2] = sd; - c.b[3] = sb; - T[0][i] = c.w; - - c.b[0] = sb; - c.b[1] = se; - c.b[2] = s9; - c.b[3] = sd; - T[1][i] = c.w; - - c.b[0] = sd; - c.b[1] = sb; - c.b[2] = se; - c.b[3] = s9; - T[2][i] = c.w; - - c.b[0] = s9; - c.b[1] = sd; - c.b[2] = sb; - c.b[3] = se; - T[3][i] = c.w; - } - - switch (language) - { - case C: - printf("\n\n" - "// Tables for InvMixColumn.\n" - "const Word AESInvMixColumnTable[4][256] =\n" - "{\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t{\n"); - for (int j = 0; j < 256; ++j) - printf("\t\t0x%08x,\n", T[i][j]); - printf("\t},\n"); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// Tables for InvMixColumn.\n" - "\t.globl\t_AESInvMixColumnTable\n" - "\t.private_extern\t_AESInvMixColumnTable\n" - "\t.align\t2\n" - "_AESInvMixColumnTable:\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t// Table %d.\n", i); - for (int j = 0; j < 256; ++j) - printf("\t.long\t0x%08x\n", T[i][j]); - } - break; - } -} - - -/* Print the tables defined AES Proposal: Rijndael, amended, 9/04/2003, - section 5.2.1. These combine the MixColumn and SubBytes operations. -*/ -static void PrintEncryptTable(Language language) -{ - Word T[4][256]; - - for (int i = 0; i < 256; ++i) - { - union { Byte b[4]; Word w; } c; - - Byte s1 = SubBytesTable[i]; - Byte s2 = MultiplyByte(0x2, s1); - Byte s3 = s1 ^ s2; - - c.b[0] = s2; - c.b[1] = s1; - c.b[2] = s1; - c.b[3] = s3; - T[0][i] = c.w; - - c.b[0] = s3; - c.b[1] = s2; - //c.b[2] = s1; - c.b[3] = s1; - T[1][i] = c.w; - - c.b[0] = s1; - c.b[1] = s3; - c.b[2] = s2; - //c.b[3] = s1; - T[2][i] = c.w; - - //c.b[0] = s1; - c.b[1] = s1; - c.b[2] = s3; - c.b[3] = s2; - T[3][i] = c.w; - } - - switch (language) - { - case C: - printf("\n\n" - "// Tables for main encryption iterations.\n" - "const Word AESEncryptTable[4][256] =\n" - "{\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t{\n"); - for (int j = 0; j < 256; ++j) - printf("\t\t0x%08x,\n", T[i][j]); - printf("\t},\n"); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// Tables for main encryption iterations.\n" - "\t.globl\t_AESEncryptTable\n" - "\t.private_extern\t_AESEncryptTable\n" - "\t.align\t2\n" - "_AESEncryptTable:\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t// Table %d.\n", i); - for (int j = 0; j < 256; ++j) - printf("\t.long\t0x%08x\n", T[i][j]); - } - break; - } -} - - -/* Print the inverse tables. These correspond to the tables above, but for - decyrption. These combine the InvSubBytes and InvMixColumn operations. -*/ -static void PrintDecryptTable(Language language) -{ - Word T[4][256]; - - for (int i = 0; i < 256; ++i) - { - union { Byte b[4]; Word w; } c; - - Byte si = InvSubBytesTable[i]; - - Byte s9 = MultiplyByte(0x9, si); - Byte sb = MultiplyByte(0xb, si); - Byte sd = MultiplyByte(0xd, si); - Byte se = MultiplyByte(0xe, si); - - c.b[0] = se; - c.b[1] = s9; - c.b[2] = sd; - c.b[3] = sb; - T[0][i] = c.w; - - c.b[0] = sb; - c.b[1] = se; - c.b[2] = s9; - c.b[3] = sd; - T[1][i] = c.w; - - c.b[0] = sd; - c.b[1] = sb; - c.b[2] = se; - c.b[3] = s9; - T[2][i] = c.w; - - c.b[0] = s9; - c.b[1] = sd; - c.b[2] = sb; - c.b[3] = se; - T[3][i] = c.w; - } - - switch (language) - { - case C: - printf("\n\n" - "// Tables for main decryption iterations.\n" - "const Word AESDecryptTable[4][256] =\n" - "{\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t{\n"); - for (int j = 0; j < 256; ++j) - printf("\t\t0x%08x,\n", T[i][j]); - printf("\t},\n"); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// Tables for main decryption iterations.\n" - "\t.globl\t_AESDecryptTable\n" - "\t.private_extern\t_AESDecryptTable\n" - "\t.align\t2\n" - "_AESDecryptTable:\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t// Table %d.\n", i); - for (int j = 0; j < 256; ++j) - printf("\t.long\t0x%08x\n", T[i][j]); - } - break; - } -} - - -static void Usage(const char *ProgramName) -{ - fprintf(stderr, - "%s: This program must have exactly one argument, \"C\" to generate\n" - "C or \"Intel\" to generate GCC i386/x86_64 assembly.\n", ProgramName); - exit(EXIT_FAILURE); -} - - -int main(int argc, char *argv[]) -{ - if (argc != 2) - Usage(argv[0]); - - Language language; - - // Figure out which language to generate, C or Intel assembly. - if (0 == strcmp(argv[1], "C")) - language = C; - else if (0 == strcmp(argv[1], "Intel")) - language = IntelAssembly; - else - Usage(argv[0]); - - printf("// This file was generated by " __FILE__ ".\n"); - - if (language == C) - printf("\n\n#include \"AES.h\"\n"); - - if (language == IntelAssembly) - printf("\n\n\t.const\n"); - - InitializeLogTables(); - InitializeSubBytesTable(); - InitializeInvSubBytesTable(); - - PrintRcon(language); - PrintInvMixColumnTable(language); - PrintEncryptTable(language); - PrintDecryptTable(language); - PrintSubBytesWordTable(language); - PrintInvSubBytesWordTable(language); - - return 0; -} DELETED Source/AESedp/ReadMe.txt Index: Source/AESedp/ReadMe.txt ================================================================== --- Source/AESedp/ReadMe.txt +++ /dev/null @@ -1,54 +0,0 @@ -This directory contains an implementation of AES intended to plug into the -CommonCrypto interface. This main directory contains a C implementation which -is not particularly fast but which works and illustrates the techniques used. -The Intel subdirectory contains routines providing a fast implementation for -the i386 (IA-32) and x86_64 (EMT64) architectures. The Intel routines replace -certain routines in AES.c when UseAESedp_IntelAssembly is defined in AES.h and -UseAESedp_GeneralC is not defined. - -Below is a summary of some of the arithmetic used in AES. This is not an -introduction to AES, just a note about why we use bitwise XOR for "addition" of -AES elements and various expressions for "multiplication." - -AES defines a 256-element Galois field over the integers modulo 2 modulo the -polynomial p(x) = x**8 + x**4 + x**3 + x + 1. This means: - - Only the residues modulo 2 of the coefficients are relevant, so each - coefficient is effectively either 0 or 1. 1+1 yields zero. - - Only the residues modulo p(x) of the polynomials are relevant, so each - polynomial is effectively a degree-seven or less polynomial. (Any result, - say from multiplication, that yields a polynomial with a term x**8 or - greater is reduced by dividing it by p(x).) - - Each element of the field is a polynomial with eight coefficients (for - each power of x from x**7 to x**0), and each coefficients is a single bit. - So we can represent an element in an eight-bit byte. - - XORing two bytes is the same as adding two polynomials. - - To multiply a polynomial by x, shift the byte left one bit. If the x**8 - bit is on, then subtract p(x), which is represented by 0x11b. (No more - than one subtraction is needed, because the x**8 coefficient is at most - one.) Equivalently: - - unsigned char MultiplyByX(unsigned char b) - { return b << 1 ^ (b & 0x80 ? 0x1b : 0); } - - Two polynomials can be multiplied by using the above operations to - multiply by powers of x and add appropriate powers. - -AES defines another field with polynomials whose coefficients are elements in -the previous Galois field. This larger field has a characteristic polynomial -of x**4 + 1. This means: - - Elements in this field have four coefficients, each of which can be - represented by a byte. - - Elements are added by adding their coefficients, which are adding by XORing - their byte representations. So an XOR of two four-byte words containing - the representations of two elements is the sum of the two elements. - - Because the characteristic polynomial is x**4 + 1 and b == -b in this - field, multiplying a polynomial by x effectively rotates the four bytes - that represent it left one byte. DELETED Source/AESedp/makefile Index: Source/AESedp/makefile ================================================================== --- Source/AESedp/makefile +++ /dev/null @@ -1,29 +0,0 @@ -default: - @echo This makefile builds Data.c and Intel/Data.s, which contain constant - @echo data for the AES implementation. These files do not normally need to - @echo be rebuilt, so they are checked into the source code repository. They - @echo should be changed only when the implementation changes and needs - @echo data in a different format. - @echo - @echo To rebuild the files, execute "make all". - -.PHONY: all clean -Targets = Data.c Intel/Data.s -all: $(Targets) - -CFLAGS += -O3 -std=c99 -Wmost -Werror - -.INTERMEDIATE: MakeData -MakeData: MakeData.c - -# Do not leave bad output files if the build fails. -.DELETE_ON_ERROR: $(Targets) - -Data.c: MakeData - ./$< >$@ C - -Intel/Data.s: MakeData - ./$< >$@ Intel - -clean: - -rm $(Targets) ADDED Source/API/CommonBigNum.c Index: Source/API/CommonBigNum.c ================================================================== --- /dev/null +++ Source/API/CommonBigNum.c @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2012 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +// #define COMMON_BIGNUM_FUNCTIONS +#include "CommonBigNum.h" +#include "CommonBigNumPriv.h" +#include "CommonRandomSPI.h" +#include "ccMemory.h" +#include "ccErrors.h" +#include "ccdebug.h" +#include +#include /* For ccn_sizeof(). */ +#include /* For CC_LOAD32_BE. */ + + +static void * +cc_alloc(void *ctx CC_UNUSED, size_t size) { + return malloc(size); +} + +static void +cc_free(void *ctx CC_UNUSED, size_t oldsize, void *p) { + cc_zero(oldsize, p); + free(p); +} + +static void * +cc_realloc(void *ctx CC_UNUSED, size_t oldsize, + void *p, size_t newsize) { + void *r = malloc(newsize); + memcpy(r, p, oldsize); + cc_zero(oldsize, p); + free(p); + return r; +} + +struct ccz_class ccz_c = { + .ctx = 0, + .ccz_alloc = cc_alloc, + .ccz_realloc = cc_realloc, + .ccz_free = cc_free +}; + +CCBigNumRef +CCCreateBigNum(CCStatus *status) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz *r = malloc(ccz_size(&ccz_c)); + if (status) + *status = r ? kCCSuccess : kCCMemoryFailure; + if (r) + ccz_init(&ccz_c, r); + if(!r) printf("Bad Create\n"); + return (CCBigNumRef)r; +} + +CCStatus +CCBigNumClear(CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz *r = (ccz *)bn; + ccz_zero(r); + return kCCSuccess; +} + +void +CCBigNumFree(CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz *r = (ccz *)bn; + ccz_free(r); + free(r); +} + +CCBigNumRef +CCBigNumCopy(CCStatus *status, const CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + const ccz *s = (ccz *)bn; + ccz *r = (ccz *)CCCreateBigNum(status); + if (r) + ccz_set(r, s); + return (CCBigNumRef)r; +} + +uint32_t +CCBigNumBitCount(const CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + const ccz *s = (ccz *)bn; + return ccz_bitlen(s); +} + +uint32_t +CCBigNumZeroLSBCount(const CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + const ccz *s = (ccz *)bn; + return ccz_trailing_zeros(s); +} + +uint32_t +CCBigNumByteCount(const CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + const ccz *s = (ccz *)bn; + return ccz_write_uint_size(s); +} + +CCBigNumRef +CCBigNumFromData(CCStatus *status, const void *s, size_t len) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz *r = (ccz *)CCCreateBigNum(status); + if (r) { + ccz_read_uint(r, len, s); + } + return (CCBigNumRef)r; +} + +size_t +CCBigNumToData(CCStatus *status, const CCBigNumRef bn, void *to) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + const ccz *s = (ccz *)bn; + size_t to_size = ccz_write_uint_size(s); + ccz_write_uint(s, to_size, to); + return to_size; +} + +CCBigNumRef +CCBigNumFromHexString(CCStatus *status, const char *in) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz *r = (ccz *)CCCreateBigNum(status); + if (r) { + if (ccz_read_radix(r, strlen(in), in, 16)) { + ccz_zero(r); + if (status) + *status = kCCDecodeError; + return NULL; + } + } + return (CCBigNumRef)r; +} + +char * +CCBigNumToHexString(CCStatus *status, const CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + const ccz *s = (ccz *)bn; + size_t to_size = ccz_write_radix_size(s, 16); + char *to = malloc(to_size+1); + ccz_write_radix(s, to_size, to, 16); + to[to_size] = 0; + return to; +} + +int +CCBigNumCompare(const CCBigNumRef bn1, const CCBigNumRef bn2) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + const ccz *s = (const ccz *)bn1; + const ccz *t = (const ccz *)bn2; + return ccz_cmp(s, t); +} + +int +CCBigNumCompareI(const CCBigNumRef bn1, const uint32_t num) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + const ccz *s = (const ccz *)bn1; + return ccz_cmpi(s, num); +} + +CCStatus +CCBigNumSetNegative(CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz *r = (ccz *)bn; + ccz_neg(r); + return kCCSuccess; +} + +CCStatus +CCBigNumSetI(CCBigNumRef bn, uint64_t num) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz *r = (ccz *)bn; + ccz_seti(r, num); + return kCCSuccess; +} + +uint32_t +CCBigNumGetI(CCStatus *status, const CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + /* TODO: This could be done more efficiently if we pushed a ccz_readi and + ccn_readi routine all the way down into corecrypto. */ + ccz *s = (const ccz *)bn; + uint32_t v = 0; + if(ccz_write_int_size(s) > sizeof(v)) { + *status = kCCOverflow; + return 0; + } + + uint8_t to[sizeof(v)]; + ccz_write_uint(s, sizeof(v), to); + CC_LOAD32_BE(v, to); + + if (status) + *status = kCCSuccess; + return v; +} + +CCBigNumRef +CCBigNumCreateRandom(CCStatus *status, int bits, int top, int bottom) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + struct ccrng_state *rng = ccDRBGGetRngState(); + ccz *r = (ccz *)CCCreateBigNum(status); + if (r && top > 0) { + /* TODO: Use the #if 0'd code once CommonCrypto has a native ccrng handle to use. */ +#if 1 + do { + ccz_random_bits(r, top, rng); + } while(ccz_bitlen(r) - ccz_trailing_zeros(r) < bottom); +#else + size_t data_size = ccn_sizeof(top); + uint8_t data[data_size]; + CCStatus st; + do { + st = CCRandomCopyBytes(kCCRandomDefault, data, data_size); + if (st) { + break; + } + if (top & 7) + data[0] &= 0xff >> 8 - (top & 7); + + ccz_read_uint(r, data_size, data); + } while(ccz_bitlen(r) - ccz_trailing_zeros(r) < bottom); + memset(data, 0, data_size); + if (st) { + if (status) + *status = st; + CCBigNumFree(r); + r = NULL; + } +#endif + } + return (CCBigNumRef)r; +} + +CCStatus +CCBigNumAdd(CCBigNumRef res, const CCBigNumRef a, const CCBigNumRef b) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz *r = (ccz *)res; + ccz *s = (const ccz *)a; + ccz *t = (const ccz *)b; + ccz_add(r, s, t); + return kCCSuccess; +} + +CCStatus +CCBigNumAddI(CCBigNumRef res, const CCBigNumRef a, const uint32_t b) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz *r = (ccz *)res; + ccz *s = (const ccz *)a; + ccz_addi(r, s, b); + return kCCSuccess; +} + +CCStatus +CCBigNumSub(CCBigNumRef res, const CCBigNumRef a, const CCBigNumRef b) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz *r = (ccz *)res; + ccz *s = (const ccz *)a; + ccz *t = (const ccz *)b; + ccz_sub(r, s, t); + return kCCSuccess; +} + +CCStatus +CCBigNumSubI(CCBigNumRef res, const CCBigNumRef a, const uint32_t b) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz *r = (ccz *)res; + ccz *s = (const ccz *)a; + ccz_subi(r, s, b); + return kCCSuccess; +} + +CCStatus +CCBigNumMul(CCBigNumRef res, const CCBigNumRef a, const CCBigNumRef b) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_mul(res, a, b); + return kCCSuccess; +} + +CCStatus +CCBigNumMulI(CCBigNumRef res, const CCBigNumRef a, const uint32_t b) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_muli(res, a, b); + return kCCSuccess; +} + +CCStatus +CCBigNumDiv(CCBigNumRef quotient, CCBigNumRef remainder, const CCBigNumRef a, const CCBigNumRef b) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_divmod(quotient, remainder, a, b); + return kCCSuccess; +} + +CCStatus +CCBigNumDiv2(CCBigNumRef res, const CCBigNumRef a) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_div2(res, a); + return kCCSuccess; +} + +CCStatus +CCBigNumMod(CCBigNumRef res, CCBigNumRef dividend, CCBigNumRef modulus) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_mod(res, dividend, modulus); + return kCCSuccess; +} + +CCStatus +CCBigNumModI(uint32_t *res, CCBigNumRef dividend, uint32_t modulus) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CCStatus status = 0; + CCBigNumRef r = CCCreateBigNum(&status); + if(!r) goto err; + CCBigNumRef mod = CCCreateBigNum(&status); + if(!mod) goto err; + status = CCBigNumSetI(mod, modulus); + ccz_mod(r, dividend, mod); + + *res = CCBigNumGetI(&status, r); +err: + if(r) CCBigNumFree(r); + if(mod) CCBigNumFree(mod); + return status; +} + +CCStatus +CCBigNumSquare(CCBigNumRef res, const CCBigNumRef a) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_sqr(res, a); + return kCCSuccess; +} + +CCStatus +CCBigNumGCD(CCBigNumRef res, const CCBigNumRef a, const CCBigNumRef b) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_gcd(res, a, b); + return kCCSuccess; +} + +CCStatus +CCBigNumLCM(CCBigNumRef res, const CCBigNumRef a, const CCBigNumRef b) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_lcm(res, a, b); + return kCCSuccess; +} + +CCStatus +CCBigNumMulMod(CCBigNumRef res, const CCBigNumRef a, const CCBigNumRef b, const CCBigNumRef modulus) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_mulmod(res, a, b, modulus); + return kCCSuccess; +} + +CCStatus +CCBigNumSquareMod(CCBigNumRef res, const CCBigNumRef a, const CCBigNumRef modulus) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_sqrmod(res, a, modulus); + return kCCSuccess; +} + +CCStatus +CCBigNumInverseMod(CCBigNumRef res, const CCBigNumRef a, const CCBigNumRef modulus) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_invmod(res, a, modulus); + return kCCSuccess; +} + +CCStatus +CCBigNumModExp(CCBigNumRef res, const CCBigNumRef a, const CCBigNumRef power, const CCBigNumRef modulus) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_expmod(res, a, power, modulus); + return kCCSuccess; +} + +CCStatus +CCBigNumLeftShift(CCBigNumRef res, const CCBigNumRef a, const uint32_t digits) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_lsl(res, a, digits); + return kCCSuccess; +} + +CCStatus +CCBigNumRightShift(CCBigNumRef res, const CCBigNumRef a, const uint32_t digits) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccz_lsr(res, a, digits); + return kCCSuccess; +} + +CCStatus +CCBigNumMontgomerySetup(CCBigNumRef num, uint32_t *rho) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return kCCUnimplemented; // ccLTCErr(mp_montgomery_setup(num, rho)); +} + +CCStatus +CCBigNumMontgomeryNormalization(CCBigNumRef a, CCBigNumRef b) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return kCCUnimplemented; // ccLTCErr(mp_montgomery_normalization(a, b)); +} + +CCStatus +CCBigNumMontgomeryReduce(CCBigNumRef x, CCBigNumRef n, uint32_t rho) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return kCCUnimplemented; // ccLTCErr(mp_montgomery_reduce(x, n, rho)); +} + +bool +CCBigNumIsPrime(CCStatus *status, const CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if (status) + *status = kCCSuccess; + + /* TODO: Figure out right number of rounds (or depth). */ + return ccz_is_prime(bn, 16); +} + +bool +CCBigNumIsOdd(CCStatus *status, const CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if (status) + *status = kCCSuccess; + + return ccz_is_odd(bn); +} + +bool +CCBigNumIsZero(CCStatus *status, const CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if (status) + *status = kCCSuccess; + + return ccz_is_zero(bn); +} + +bool +CCBigNumIsNegative(CCStatus *status, const CCBigNumRef bn) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if (status) + *status = kCCSuccess; + + return ccz_is_negative(bn); +} ADDED Source/API/CommonBigNumPriv.h Index: Source/API/CommonBigNumPriv.h ================================================================== --- /dev/null +++ Source/API/CommonBigNumPriv.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef _CC_BIGNUM_PRIV_H_ +#define _CC_BIGNUM_PRIV_H_ + +#include +/* Uses the tomcrypt math structure to harness math libraries */ +/* we probably want to convert this to a CCRandomRef later */ +typedef void prng_state; +#define LTC_SOURCE + +// #include "tomcrypt_math.h" + +typedef void ccBigNum; + +typedef ccBigNum *CCBigNumber; + + +#endif /* _CC_BIGNUM_PRIV_H_ */ Index: Source/API/CommonCMAC.c ================================================================== --- Source/API/CommonCMAC.c +++ Source/API/CommonCMAC.c @@ -19,24 +19,26 @@ * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ +// #define COMMON_CMAC_FUNCTIONS + #include "CommonCMACSPI.h" +#include "CommonCryptorPriv.h" +#include +#include "ccdebug.h" -#include -#include -#include -#include -#include /* Internal functions to support one-shot */ -uint8_t const_Rb[16] = { +const uint8_t const_Rb[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87 }; + + void leftshift_onebit(uint8_t *input, uint8_t *output) { int i; uint8_t overflow = 0; @@ -54,20 +56,20 @@ int i; for (i=0;i<16; i++) out[i] = a[i] ^ b[i]; } -void ccGenAESSubKey(const void *key, void *key1, void *key2) +void ccGenAESSubKey(struct ccmode_ecb *aesmode, ccecb_ctx *ctx, void *key1, void *key2) { uint8_t L[16]; uint8_t Z[16]; uint8_t tmp[16]; size_t moved = 0; memset(Z, 0, 16); - CCCrypt(kCCEncrypt, kCCAlgorithmAES128, kCCOptionECBMode, key, 16, NULL, Z, 16, L, 16, &moved); + aesmode->ecb(ctx, 1, Z, L); if ( (L[0] & 0x80) == 0 ) { /* If MSB(L) = 0, then K1 = L << 1 */ leftshift_onebit(L, key1); } else { /* Else K1 = ( L << 1 ) (+) Rb */ leftshift_onebit(L, tmp); @@ -104,14 +106,20 @@ { uint8_t X[16],Y[16], M_last[16], padded[16]; uint8_t K1[16], K2[16]; int n, i, flag; size_t moved = 0; - + struct ccmode_ecb *aesmode = getCipherMode(kCCAlgorithmAES128, kCCModeECB, kCCEncrypt).ecb; + ccecb_ctx_decl(aesmode->size, ctx); + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + // CMacInit - ccGenAESSubKey(key,K1,K2); + aesmode->init(aesmode, &ctx, 16, key); + aesmode->ecb(&ctx, 1, Y, X); + ccGenAESSubKey(aesmode, &ctx, K1, K2); // CMacUpdates (all in this case) n = (dataLength+15) / 16; /* n is number of rounds */ @@ -131,15 +139,15 @@ } memset(X, 0, 16); for ( i=0; iecb(&ctx, 1, Y, X); } // CMacFinal xor_128(X,M_last,Y); - CCCrypt(kCCEncrypt, kCCAlgorithmAES128, kCCOptionECBMode, key, 16, NULL, Y, 16, X, 16, &moved); + aesmode->ecb(&ctx, 1, Y, X); memcpy(macOut, X, 16); } ADDED Source/API/CommonCryptoAESShoefly.c Index: Source/API/CommonCryptoAESShoefly.c ================================================================== --- /dev/null +++ Source/API/CommonCryptoAESShoefly.c @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * CommonCryptoAESShoefly.c + * CommonCrypto + * + * Shim for Diskimages to bridge to a non-hw based aes-cbc + * + */ + +// #define COMMON_AESSHOEFLY_FUNCTIONS +#define CC_Building +#include "aes.h" + +#include "ccdebug.h" + + +void aes_encrypt_key128(const unsigned char *in_key, aes_encrypt_ctx cx[1]) +{ + CCCryptorRef encCryptorRef; + aes_encrypt_ctx *ctx = cx; + size_t dataUsed; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + + (void) CCCryptorCreateFromDataWithMode(kCCEncrypt, kCCModeCBC, kCCAlgorithmAES128NoHardware, ccNoPadding, NULL, in_key, 16, NULL, 0, 0, 0, + &ctx->ctx, kCCContextSizeGENERIC, &ctx->cref, &dataUsed); +} + +void aes_encrypt_key256(const unsigned char *in_key, aes_encrypt_ctx cx[1]) +{ + CCCryptorRef encCryptorRef; + aes_encrypt_ctx *ctx = cx; + size_t dataUsed; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + (void) CCCryptorCreateFromDataWithMode(kCCEncrypt, kCCModeCBC, kCCAlgorithmAES128NoHardware, ccNoPadding, NULL, in_key, 32, NULL, 0, 0, 0, + &ctx->ctx, kCCContextSizeGENERIC, &ctx->cref, &dataUsed); +} + +void aes_decrypt_key128(const unsigned char *in_key, aes_decrypt_ctx cx[1]) +{ + CCCryptorRef encCryptorRef; + aes_encrypt_ctx *ctx = cx; + size_t dataUsed; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + (void) CCCryptorCreateFromDataWithMode(kCCDecrypt, kCCModeCBC, kCCAlgorithmAES128NoHardware, ccNoPadding, NULL, in_key, 16, NULL, 0, 0, 0, + &ctx->ctx, kCCContextSizeGENERIC, &ctx->cref, &dataUsed); +} + +void aes_decrypt_key256(const unsigned char *in_key, aes_decrypt_ctx cx[1]) +{ + CCCryptorRef encCryptorRef; + aes_encrypt_ctx *ctx = cx; + size_t dataUsed; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + (void) CCCryptorCreateFromDataWithMode(kCCDecrypt, kCCModeCBC, kCCAlgorithmAES128NoHardware, ccNoPadding, NULL, in_key, 32, NULL, 0, 0, 0, + &ctx->ctx, kCCContextSizeGENERIC, &ctx->cref, &dataUsed); +} + + +void aes_encrypt_cbc(const unsigned char *in_blk, const unsigned char *in_iv, unsigned int num_blk, + unsigned char *out_blk, aes_encrypt_ctx cx[1]) +{ + aes_encrypt_ctx *ctx = cx; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + (void) CCCryptorEncryptDataBlock(ctx->cref, in_iv, in_blk, num_blk * AES_BLOCK_SIZE, out_blk); +} + + +void aes_decrypt_cbc(const unsigned char *in_blk, const unsigned char *in_iv, unsigned int num_blk, + unsigned char *out_blk, aes_decrypt_ctx cx[1]) +{ + aes_encrypt_ctx *ctx = cx; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + (void) CCCryptorDecryptDataBlock(ctx->cref, in_iv, in_blk, num_blk * AES_BLOCK_SIZE, out_blk); +} + ADDED Source/API/CommonCryptoCASTShoefly.c Index: Source/API/CommonCryptoCASTShoefly.c ================================================================== --- /dev/null +++ Source/API/CommonCryptoCASTShoefly.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2012 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +// #define COMMON_CASTSHOEFLY_FUNCTIONS + +#include +#include "lionCompat.h" +#include "CommonCryptorSPI.h" +#define DIAGNOSTIC + +#include "ccdebug.h" + +void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data) +{ + CCCryptorRef *encCryptorRef; + size_t dataUsed; + + encCryptorRef = key->cref; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + (void) CCCryptorCreateWithMode(kCCBoth, kCCModeECB, kCCAlgorithmCAST, ccNoPadding, NULL, data, len, NULL, 0, 0, 0, encCryptorRef); +} + +void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out, CAST_KEY *key, int enc) +{ + size_t moved; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering Op: %d\n", enc); + if(enc) + CCCryptorEncryptDataBlock(key->cref, NULL, in, kCCBlockSizeCAST, out); + else + CCCryptorDecryptDataBlock(key->cref, NULL, in, kCCBlockSizeCAST, out); + +} + Index: Source/API/CommonCryptor.c ================================================================== --- Source/API/CommonCryptor.c +++ Source/API/CommonCryptor.c @@ -1,7 +1,7 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. +/* + * Copyright (c) 2012 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License @@ -24,132 +24,342 @@ /* * CommonCryptor.c - common crypto context. * */ +// #define COMMON_CRYPTOR_FUNCTIONS + +#include "ccMemory.h" +#include "ccdebug.h" #include "CommonCryptor.h" #include "CommonCryptorSPI.h" #include "CommonCryptorPriv.h" -#include -#include -#include -#include /* for offsetof() */ -#include "tomcrypt.h" -#include "rc4.h" -#include "pkcs7pad.h" -#include "ccdebug.h" +#include +#include /* * CommonCryptor's portion of a CCCryptorRef. */ -#define DEFAULT_CRYPTOR_MALLOC 4096 - -#define OPENCRYPT "Encrypt" -#define OPDECRYPT "Decrypt" - -#define NOPADDING "OFF" -#define PKCS7PADDING "PKCS7" - -/* - * Convert a CommonCrypto alg into an LTC index, register LTC alg as a side-effect. - */ - -static int -ccGetAlgorithm(CCAlgorithm alg) -{ - switch(alg) { - case kCCAlgorithmAES128: - if(register_cipher(&aesedp_desc) == -1) return -1; - return find_cipher("aesedp"); - case kCCAlgorithmDES: - if(register_cipher(&des_desc) == -1) return -1; - return find_cipher("des"); - case kCCAlgorithm3DES: - if(register_cipher(&des3_desc) == -1) return -1; - return find_cipher("3des"); - case kCCAlgorithmCAST: - if(register_cipher(&cast5_desc) == -1) return -1; - return find_cipher("cast5"); - case kCCAlgorithmRC2: - if(register_cipher(&rc2_desc) == -1) return -1; - return find_cipher("rc2"); - default: - return -1; - } -} - - -static CCCryptorStatus -ccLTCErr(uint32_t err) -{ - switch(err) { - case CRYPT_OK: return kCCSuccess; - case CRYPT_ERROR: return -1; - case CRYPT_NOP: return kCCSuccess; - - case CRYPT_INVALID_KEYSIZE: return kCCParamError; - case CRYPT_INVALID_ROUNDS: return kCCParamError; - case CRYPT_FAIL_TESTVECTOR: return -1; - - case CRYPT_BUFFER_OVERFLOW: return kCCBufferTooSmall; - case CRYPT_INVALID_PACKET: return kCCParamError; - - case CRYPT_INVALID_PRNGSIZE: return kCCParamError; - case CRYPT_ERROR_READPRNG: return kCCParamError; - - case CRYPT_INVALID_CIPHER: return kCCParamError; - case CRYPT_INVALID_HASH: return kCCParamError; - case CRYPT_INVALID_PRNG: return kCCParamError; - - case CRYPT_MEM: return kCCBufferTooSmall; - - case CRYPT_PK_TYPE_MISMATCH: return kCCParamError; - case CRYPT_PK_NOT_PRIVATE: return kCCParamError; - - case CRYPT_INVALID_ARG: return kCCParamError; - case CRYPT_FILE_NOTFOUND: return kCCParamError; - - case CRYPT_PK_INVALID_TYPE: return kCCParamError; - case CRYPT_PK_INVALID_SYSTEM: return kCCParamError; - case CRYPT_PK_DUP: return kCCParamError; - case CRYPT_PK_NOT_FOUND: return kCCParamError; - case CRYPT_PK_INVALID_SIZE: return kCCParamError; - - case CRYPT_INVALID_PRIME_SIZE: return kCCParamError; - case CRYPT_PK_INVALID_PADDING: return kCCParamError; - - case CRYPT_HASH_OVERFLOW: return kCCParamError; - default: return -1; - } -} - - -/* - Generally IVs are the same size as the blocksize of the cipher in use. - This routine will use that value unless it's going to blow past the end - of the cryptor IV buffer. This is just a safety measure in case some - upper level code is blindly triggering an IV reset for a cipher/mode - combo that really wouldn't use the IV and may have a huge blocksize. - */ - -#define CC_XZEROMEM(p, n) memset((p), 0, (n)) -#define CC_XMEMCPY(s1, s2, n) memcpy((s1), (s2), (n)) - -static void -ccSetIV(CCCryptor *cryptor, void *iv) -{ - uint32_t ivSize; - - ivSize = (cryptor->blocksize > CCMAXBUFFERSIZE) ? CCMAXBUFFERSIZE: cryptor->blocksize; - if(iv == NULL) { - CC_XZEROMEM(cryptor->iv, ivSize); - } else { - CC_XMEMCPY(cryptor->iv, iv, ivSize); - } -} +typedef struct cipherMode_t { + dispatch_once_t init; + struct ccmode_ecb* ecb; + struct ccmode_cbc* cbc; + struct ccmode_cfb* cfb; + struct ccmode_cfb8* cfb8; + struct ccmode_ctr* ctr; + struct ccmode_ofb* ofb; + struct ccmode_xts* xts; + struct ccmode_gcm* gcm; +} cipherMode; + +static cipherMode cipherModeTab[7][2]; + +static inline size_t ccGetCipherBlockSize(CCCryptor *ref) +{ + switch(ref->cipher) { + case kCCAlgorithmAES128: return kCCBlockSizeAES128; + case kCCAlgorithmDES: return kCCBlockSizeDES; + case kCCAlgorithm3DES: return kCCBlockSize3DES; + case kCCAlgorithmCAST: return kCCBlockSizeCAST; + case kCCAlgorithmRC4: return 1; + case kCCAlgorithmRC2: return kCCBlockSizeRC2; + case kCCAlgorithmBlowfish: return kCCBlockSizeBlowfish; + default: return kCCBlockSizeAES128; + } +} + + +corecryptoMode getCipherMode(CCAlgorithm cipher, CCMode mode, CCOperation direction) +{ + for(int i = 0; i<2; i++) { + dispatch_once(&(cipherModeTab[cipher][i].init), ^{ + cipherModeTab[cipher][i].ecb = ccmodeList[cipher][i].ecb(); + cipherModeTab[cipher][i].cbc = ccmodeList[cipher][i].cbc(); + cipherModeTab[cipher][i].cfb = ccmodeList[cipher][i].cfb(); + cipherModeTab[cipher][i].cfb8 = ccmodeList[cipher][i].cfb8(); + cipherModeTab[cipher][i].ctr = ccmodeList[cipher][i].ctr(); + cipherModeTab[cipher][i].ofb = ccmodeList[cipher][i].ofb(); +#if defined(__i386__) || defined(__x86_64__) + cipherModeTab[cipher][i].xts = ccmodeList[cipher][i].xts(); +#else + cipherModeTab[cipher][i].xts = NULL; +#endif + cipherModeTab[cipher][i].gcm = ccmodeList[cipher][i].gcm(); + }); + } + // printf("%lu Size %lu Blocksize\n\n", cipherModeTab[cipher][direction].ecb->size, cipherModeTab[cipher][direction].ecb->block_size); + switch(mode) { + case kCCModeECB: return (corecryptoMode) cipherModeTab[cipher][direction].ecb; + case kCCModeCBC: return (corecryptoMode) cipherModeTab[cipher][direction].cbc; + case kCCModeCFB: return (corecryptoMode) cipherModeTab[cipher][direction].cfb; + case kCCModeCFB8: return (corecryptoMode) cipherModeTab[cipher][direction].cfb8; + case kCCModeCTR: return (corecryptoMode) cipherModeTab[cipher][direction].ctr; + case kCCModeOFB: return (corecryptoMode) cipherModeTab[cipher][direction].ofb; + case kCCModeXTS: return (corecryptoMode) cipherModeTab[cipher][direction].xts; + case kCCModeGCM: return (corecryptoMode) cipherModeTab[cipher][direction].gcm; + } + return (corecryptoMode) (struct ccmode_ecb*) NULL; +} + +static CCCryptorStatus setCryptorCipherMode(CCCryptor *ref, CCAlgorithm cipher, CCMode mode, CCOperation direction) +{ + switch(mode) { + case kCCModeECB: if((ref->symMode[direction].ecb = getCipherMode(cipher, mode, direction).ecb) == NULL) return kCCUnimplemented; + ref->modeDesc = &ccecb_mode; break; + case kCCModeCBC: if((ref->symMode[direction].cbc = getCipherMode(cipher, mode, direction).cbc) == NULL) return kCCUnimplemented; + ref->modeDesc = &cccbc_mode; break; + case kCCModeCFB: if((ref->symMode[direction].cfb = getCipherMode(cipher, mode, direction).cfb) == NULL) return kCCUnimplemented; + ref->modeDesc = &cccfb_mode; break; + case kCCModeCFB8: if((ref->symMode[direction].cfb8 = getCipherMode(cipher, mode, direction).cfb8) == NULL) return kCCUnimplemented; + ref->modeDesc = &cccfb8_mode; break; + case kCCModeCTR: if((ref->symMode[direction].ctr = getCipherMode(cipher, mode, direction).ctr) == NULL) return kCCUnimplemented; + ref->modeDesc = &ccctr_mode; break; + case kCCModeOFB: if((ref->symMode[direction].ofb = getCipherMode(cipher, mode, direction).ofb) == NULL) return kCCUnimplemented; + ref->modeDesc = &ccofb_mode; break; + case kCCModeXTS: if((ref->symMode[direction].xts = getCipherMode(cipher, mode, direction).xts) == NULL) return kCCUnimplemented; + ref->modeDesc = &ccxts_mode; break; + case kCCModeGCM: if((ref->symMode[direction].gcm = getCipherMode(cipher, mode, direction).gcm) == NULL) return kCCUnimplemented; + ref->modeDesc = &ccgcm_mode; break; + default: return kCCParamError; + } + return kCCSuccess; + +} + + +static inline CCCryptorStatus ccSetupCryptor(CCCryptor *ref, CCAlgorithm cipher, CCMode mode, CCOperation direction, CCPadding padding) +{ + CCCryptorStatus retval; + + if(cipher > 6) return kCCParamError; + if(direction > kCCBoth) return kCCParamError; + if(cipher == kCCAlgorithmRC4) mode = kCCModeOFB; + + ref->mode = mode; + CCOperation op = direction; + if(ref->mode == kCCModeXTS || ref->mode == kCCModeECB || ref->mode == kCCModeCBC) op = kCCBoth; + + // printf("Cryptor setup - cipher %d mode %d direction %d padding %d\n", cipher, mode, direction, padding); + switch(op) { + case kCCEncrypt: + case kCCDecrypt: + if((retval = setCryptorCipherMode(ref, cipher, mode, op)) != kCCSuccess) return retval; + if((ref->ctx[op].data = CC_XMALLOC(ref->modeDesc->mode_get_ctx_size(ref->symMode[op]))) == NULL) return kCCMemoryFailure; + break; + case kCCBoth: + if((retval = setCryptorCipherMode(ref, cipher, mode, kCCEncrypt)) != kCCSuccess) return retval; + if((ref->ctx[kCCEncrypt].data = CC_XMALLOC(ref->modeDesc->mode_get_ctx_size(ref->symMode[kCCEncrypt]))) == NULL) return kCCMemoryFailure; + if((retval = setCryptorCipherMode(ref, cipher, mode, kCCDecrypt)) != kCCSuccess) return retval; + if((ref->ctx[kCCDecrypt].data = CC_XMALLOC(ref->modeDesc->mode_get_ctx_size(ref->symMode[kCCDecrypt]))) == NULL) return kCCMemoryFailure; + break; + } + + switch(padding) { + case ccNoPadding: + ref->padptr = &ccnopad_pad; + break; + case ccPKCS7Padding: + if(mode == kCCModeCBC) + ref->padptr = &ccpkcs7_pad; + else + ref->padptr = &ccpkcs7_ecb_pad; + break; + case ccCBCCTS1: + ref->padptr = &cccts1_pad; + break; + case ccCBCCTS2: + ref->padptr = &cccts2_pad; + break; + case ccCBCCTS3: + ref->padptr = &cccts3_pad; + break; + default: + ref->padptr = &ccnopad_pad; + } + ref->cipher = cipher; + ref->cipherBlocksize = ccGetCipherBlockSize(ref); + ref->op = direction; + ref->bufferPos = 0; + ref->bytesProcessed = 0; + return kCCSuccess; +} + +#define OP4INFO(X) (((X)->op == 3) ? 0: (X)->op) + +static inline size_t ccGetBlockSize(CCCryptor *ref) +{ + return ref->modeDesc->mode_get_block_size(ref->symMode[OP4INFO(ref)]); +} + +static inline bool ccIsStreaming(CCCryptor *ref) +{ + + return ref->modeDesc->mode_get_block_size(ref->symMode[ref->op]) == 1; +} + +static inline CCCryptorStatus ccInitCryptor(CCCryptor *ref, const void *key, unsigned long key_len, + const void *tweak_key, + const void *iv) +{ + size_t blocksize = ccGetCipherBlockSize(ref); + if(!ref->modeDesc) return kCCParamError; + uint8_t defaultIV[blocksize]; + + if(iv == NULL) { + CC_XZEROMEM(defaultIV, blocksize); + iv = defaultIV; + } + + CCOperation op = ref->op; + + // This will create both sides of the context/mode pairs for now. + if(ref->mode == kCCModeXTS || ref->mode == kCCModeECB || ref->mode == kCCModeCBC) op = kCCBoth; + + switch(op) { + case kCCEncrypt: + case kCCDecrypt: + ref->modeDesc->mode_setup(ref->symMode[ref->op], iv, key, key_len, tweak_key, 0, 0, ref->ctx[ref->op]); + break; + case kCCBoth: + ref->modeDesc->mode_setup(ref->symMode[kCCEncrypt], iv, key, key_len, tweak_key, 0, 0, ref->ctx[kCCEncrypt]); + ref->modeDesc->mode_setup(ref->symMode[kCCDecrypt], iv, key, key_len, tweak_key, 0, 0, ref->ctx[kCCDecrypt]); + break; + } + return kCCSuccess; +} + +static inline CCCryptorStatus ccDoEnCrypt(CCCryptor *ref, const void *dataIn, size_t dataInLength, void *dataOut) +{ + if(!ref->modeDesc->mode_encrypt) return kCCParamError; + ref->modeDesc->mode_encrypt(ref->symMode[kCCEncrypt], dataIn, dataOut, dataInLength, ref->ctx[kCCEncrypt]); + return kCCSuccess; +} + +static inline CCCryptorStatus ccDoDeCrypt(CCCryptor *ref, const void *dataIn, size_t dataInLength, void *dataOut) +{ + if(!ref->modeDesc->mode_decrypt) return kCCParamError; + ref->modeDesc->mode_decrypt(ref->symMode[kCCDecrypt], dataIn, dataOut, dataInLength, ref->ctx[kCCDecrypt]); + return kCCSuccess; +} + +static inline CCCryptorStatus ccDoEnCryptTweaked(CCCryptor *ref, const void *dataIn, size_t dataInLength, void *dataOut, const void *tweak) +{ + if(!ref->modeDesc->mode_encrypt_tweaked) return kCCParamError; + ref->modeDesc->mode_encrypt_tweaked(ref->symMode[kCCEncrypt], dataIn, dataOut, dataInLength, tweak, ref->ctx[kCCEncrypt]); + return kCCSuccess; +} + +static inline CCCryptorStatus ccDoDeCryptTweaked(CCCryptor *ref, const void *dataIn, size_t dataInLength, void *dataOut, const void *tweak) +{ + if(!ref->modeDesc->mode_decrypt_tweaked) return kCCParamError; + ref->modeDesc->mode_decrypt_tweaked(ref->symMode[kCCDecrypt], dataIn, dataOut, dataInLength, tweak, ref->ctx[kCCDecrypt]); + return kCCSuccess; +} + + + +static inline CCCryptorStatus ccGetIV(CCCryptor *ref, void *iv, size_t *ivLen) +{ + if(ref->modeDesc->mode_getiv == NULL) return kCCParamError; + if(ref->modeDesc->mode_getiv(ref->symMode[OP4INFO(ref)], iv, ivLen, ref->ctx[OP4INFO(ref)]) != 0) return kCCMemoryFailure; + return kCCSuccess; +} + +static inline CCCryptorStatus ccSetIV(CCCryptor *ref, void *iv, size_t ivLen) +{ + if(ref->modeDesc->mode_setiv == NULL) return kCCParamError; + if(ref->modeDesc->mode_setiv(ref->symMode[OP4INFO(ref)], iv, ivLen, ref->ctx[OP4INFO(ref)]) != 0) return kCCMemoryFailure; + return kCCSuccess; +} + + + +static inline void ccClearCryptor(CCCryptor *ref) +{ + CC_XZEROMEM(ref->buffptr, sizeof(ref->buffptr)); + CCOperation op = ref->op; + + // This will clear both sides of the context/mode pairs for now. + if(ref->mode == kCCModeXTS || ref->mode == kCCModeECB || ref->mode == kCCModeCBC) op = kCCBoth; + switch(op) { + case kCCEncrypt: + case kCCDecrypt: + CC_XZEROMEM(ref->ctx[ref->op].data, ref->modeDesc->mode_get_ctx_size(ref->symMode[ref->op])); + CC_XFREE(ref->ctx[ref->op].data, ref->modeDesc->mode_get_ctx_size(ref->symMode[ref->op])); + break; + case kCCBoth: + for(int i = 0; i<2; i++) { + CC_XZEROMEM(ref->ctx[i].data, ref->modeDesc->mode_get_ctx_size(ref->symMode[i])); + CC_XFREE(ref->ctx[i].data, ref->modeDesc->mode_get_ctx_size(ref->symMode[i])); + } + break; + } + ref->cipher = 0; + ref->mode = 0; + ref->op = 0; + ref->bufferPos = 0; + ref->bytesProcessed = 0; +} + +static inline CCCryptorStatus ccEncryptPad(CCCryptor *cryptor, void *buf, size_t *moved) +{ + if(cryptor->padptr->encrypt_pad(cryptor->ctx[cryptor->op], cryptor->modeDesc, cryptor->symMode[cryptor->op], cryptor->buffptr, cryptor->bufferPos, buf, moved)) return kCCDecodeError; + return kCCSuccess; +} + +static inline CCCryptorStatus ccDecryptPad(CCCryptor *cryptor, void *buf, size_t *moved) +{ + if(cryptor->padptr->decrypt_pad(cryptor->ctx[cryptor->op], cryptor->modeDesc, cryptor->symMode[cryptor->op], cryptor->buffptr, cryptor->bufferPos, buf, moved)) return kCCDecodeError; + return kCCSuccess; +} + +static inline size_t ccGetReserve(CCCryptor *cryptor) +{ + return cryptor->padptr->padreserve(cryptor->op == kCCEncrypt, cryptor->modeDesc, cryptor->symMode[cryptor->op]); +} + +static inline size_t ccGetPadlen(CCCryptor *cryptor) +{ + return cryptor->padptr->padlen(cryptor->op == kCCEncrypt, cryptor->modeDesc, cryptor->symMode[cryptor->op], cryptor->buffptr); +} + + + +static uint8_t * +ccGetBytesAligned64(uint8_t *fromptr, uint32_t *bytesused) +{ + uint8_t *retval; + + retval = fromptr; + if((uintptr_t) fromptr % 8) retval = (uint8_t *)(((uintptr_t) fromptr / 8) * 8 + 8); + *bytesused = retval - fromptr; + return retval; +} + + + + + + + + + + + + + + +static int ccAddBuff(CCCryptor *cryptor, const void *dataIn, size_t dataInLength) +{ + CC_XMEMCPY((char *) cryptor->buffptr + cryptor->bufferPos, dataIn, dataInLength); + cryptor->bufferPos += dataInLength; + return dataInLength; +} + + CCCryptorStatus CCCryptorCreate( CCOperation op, /* kCCEncrypt, etc. */ CCAlgorithm alg, /* kCCAlgorithmDES, etc. */ CCOptions options, /* kCCOptionPKCS7Padding, etc. */ @@ -160,13 +370,14 @@ { CCCryptorStatus err; CCCompatCryptor *compat_cryptor = NULL; size_t dataUsed = 0; - if((compat_cryptor = (CCCompatCryptor *)malloc(sizeof(CCCompatCryptor))) == NULL) return kCCMemoryFailure; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if((compat_cryptor = (CCCompatCryptor *)CC_XMALLOC(sizeof(CCCompatCryptor))) == NULL) return kCCMemoryFailure; err = CCCryptorCreateFromData( op, alg, options, key, keyLength, iv, compat_cryptor, sizeof(CCCompatCryptor), cryptorRef, &dataUsed); - if(err != kCCSuccess) free(compat_cryptor); + if(err != kCCSuccess) CC_XFREE(compat_cryptor, sizeof(CCCompatCryptor)); else compat_cryptor->weMallocd = true; return err; } CCCryptorStatus CCCryptorCreateFromData( @@ -186,23 +397,23 @@ const void *tweak; size_t tweakLength; int numRounds; CCModeOptions modeOptions; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); /* Determine mode from options - old call only supported ECB and CBC - we treat RC4 as a "mode" in that it's the only streaming cipher - currently supported - */ - - mode = kCCModeCBC; + we treat RC4 as a "mode" in that it's the only streaming cipher + currently supported + */ if(alg == kCCAlgorithmRC4) mode = kCCModeRC4; else if(options & kCCOptionECBMode) mode = kCCModeECB; + else mode = kCCModeCBC; /* Determine padding from options - only PKCS7 was available */ - padding = ccDefaultPadding; + padding = ccNoPadding; if(options & kCCOptionPKCS7Padding) padding = ccPKCS7Padding; - + /* No tweak was ever used */ tweak = NULL; tweakLength = 0; /* default rounds */ @@ -210,208 +421,390 @@ /* No mode options needed */ modeOptions = 0; return CCCryptorCreateFromDataWithMode(op, mode, alg, padding, iv, key, keyLength, tweak, tweakLength, numRounds, modeOptions, data, dataLength, cryptorRef, dataUsed); +} + +/* This version mallocs the CCCryptorRef */ + +CCCryptorStatus CCCryptorCreateWithMode( + CCOperation op, /* kCCEncrypt, kCCEncrypt, kCCBoth (default for BlockMode) */ + CCMode mode, + CCAlgorithm alg, + CCPadding padding, + const void *iv, /* optional initialization vector */ + const void *key, /* raw key material */ + size_t keyLength, + const void *tweak, /* raw tweak material */ + size_t tweakLength, + int numRounds, /* 0 == default */ + CCModeOptions options, + CCCryptorRef *cryptorRef) /* RETURNED */ +{ + CCCryptorStatus err; + CCCompatCryptor *compat_cryptor = NULL; + size_t dataUsed = 0; - } + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if((compat_cryptor = (CCCompatCryptor *)CC_XMALLOC(sizeof(CCCompatCryptor))) == NULL) return kCCMemoryFailure; + err = CCCryptorCreateFromDataWithMode( op, mode, alg, padding, iv, key, keyLength, tweak, tweakLength, numRounds, options, compat_cryptor, DEFAULT_CRYPTOR_MALLOC, cryptorRef, &dataUsed); + if(err != kCCSuccess) CC_XFREE(compat_cryptor, sizeof(CCCompatCryptor)); + else compat_cryptor->weMallocd = true; + return err; +} + +#define KEYALIGNMENT (sizeof(int)-1) + +CCCryptorStatus CCCryptorCreateFromDataWithMode( + CCOperation op, /* kCCEncrypt, kCCEncrypt, kCCBoth (default for BlockMode) */ + CCMode mode, + CCAlgorithm alg, + CCPadding padding, + const void *iv, /* optional initialization vector */ + const void *key, /* raw key material */ + size_t keyLength, + const void *tweak, /* raw tweak material */ + size_t tweakLength, + int numRounds, + CCModeOptions options, + const void *data, /* caller-supplied memory */ + size_t dataLength, /* length of data in bytes */ + CCCryptorRef *cryptorRef, /* RETURNED */ + size_t *dataUsed) /* optional, RETURNED */ +{ + CCCryptorStatus retval = kCCSuccess; + CCCryptor *cryptor = NULL; + CCCompatCryptor *compat_cryptor = NULL; + int needed, needed2aligncryptor; + uint8_t *alignedKey = NULL; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering Op: %d Mode: %d Cipher: %d Padding: %d\n", op, mode, alg, padding); + + // For now we're mapping these two AES selectors to the stock one. + if(alg == kCCAlgorithmAES128NoHardware || alg == kCCAlgorithmAES128WithHardware) + alg = kCCAlgorithmAES128; + + /* corecrypto only implements CTR_BE. No use of CTR_LE was found so we're marking + this as unimplemented for now. Also in Lion this was defined in reverse order. + See */ + + if(mode == kCCModeCTR && options != kCCModeOptionCTR_BE) { + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Mode is CTR, but options isn't BE\n", op, mode, alg, padding); + return kCCUnimplemented; + } + + // validate pointers + if((data == NULL) || (cryptorRef == NULL) || (key == NULL)) { + CC_DEBUG_LOG(ASL_LEVEL_ERR, "bad arguments\n", 0); + return kCCParamError; + } + + /* + * Some implementations are sensitive to keys not being 4 byte aligned. + * We'll move the key into an aligned buffer for the call to setup + * the key schedule. + */ + + if((intptr_t) key & KEYALIGNMENT) { + if((alignedKey = CC_XMALLOC(keyLength)) == NULL) { + return kCCMemoryFailure; + } + CC_XMEMCPY(alignedKey, key, keyLength); + key = alignedKey; + } + + + /* Get Space for Cryptor Structure */ + compat_cryptor = (CCCompatCryptor *) ccGetBytesAligned64((uint8_t *)data, &needed2aligncryptor); + needed = needed2aligncryptor + sizeof(CCCompatCryptor); + if(dataUsed != NULL) *dataUsed = needed; + + if (needed > dataLength) { + if(dataUsed != NULL) *dataUsed += 16; /* in case it's not on a doubleword boundary */ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Needed %d Have %d\n", needed, dataLength); + retval = kCCBufferTooSmall; + goto out; + } + compat_cryptor->weMallocd = false; + + if((cryptor = (CCCryptor *)CC_XMALLOC(DEFAULT_CRYPTOR_MALLOC)) == NULL) { + retval = kCCMemoryFailure; + goto out; + } + compat_cryptor->cryptor = cryptor; + + *cryptorRef = compat_cryptor; + + if((retval = ccSetupCryptor(cryptor, alg, mode, op, padding)) != kCCSuccess) { + printf("Failed to setup Cryptor struct with alg/mode %d\n", retval); + goto out; + } + + if((retval = ccInitCryptor(cryptor, key, keyLength, tweak, iv)) != kCCSuccess) { + printf("Failed to init Cryptor %d\n", retval); + goto out; + } + + +out: + // Things to destroy if setup failed + if(retval) { + *cryptorRef = NULL; + if(compat_cryptor) compat_cryptor->cryptor = NULL; + if(cryptor) { + CC_XZEROMEM(cryptor, DEFAULT_CRYPTOR_MALLOC); + CC_XFREE(cryptor, DEFAULT_CRYPTOR_MALLOC); + } + } else { + // printf("Blocksize = %d mode = %d pad = %d\n", ccGetBlockSize(cryptor), cryptor->mode, padding); + } + + // Things to destroy all the time + if(alignedKey) { + CC_XZEROMEM(alignedKey, keyLength); + CC_XFREE(alignedKey, keyLength); + } + + return retval; +} + + + + CCCryptorStatus CCCryptorRelease( CCCryptorRef cryptorRef) { uint32_t err; CCCompatCryptor *compat_cryptor = cryptorRef; CCCryptor *cryptor; uint32_t weMallocd; - if(cryptorRef == NULL) return kCCSuccess; - cryptor = compat_cryptor->cryptor; - weMallocd = compat_cryptor->weMallocd; - - if(cryptor->modeptr->mode_done) cryptor->modeptr->mode_done(cryptor->ctx); - - memset(cryptor, 0, CCCRYPTOR_SIZE); - free(cryptor); - if(weMallocd) free(compat_cryptor); - - return kCCSuccess; - } - - -CCCryptorStatus CCCryptorUpdate(CCCryptorRef cryptorRef, const void *dataIn, size_t dataInLength, void *dataOut, size_t dataOutAvailable, size_t *dataOutMoved) -{ - CCCryptorStatus retval; - char *inp, *outp, *bufp; - size_t inlen, outlen, movecnt, blocksize; - int willneed; - int done = 0; - CCCompatCryptor *compat_cryptor = cryptorRef; - CCCryptor *cryptor; - - if(compat_cryptor == NULL) return kCCParamError; - cryptor = compat_cryptor->cryptor; - - if(cryptor == NULL) return kCCParamError; - void *checkedDataIn = dataIn; - if (checkedDataIn == NULL) checkedDataIn = ""; - if(cryptor->bufStrat == ccStreaming) { - if(dataOutAvailable < dataInLength) return kCCBufferTooSmall; - if(cryptor->op == kCCEncrypt) { - if((retval = ccLTCErr(cryptor->modeptr->mode_encrypt(dataIn, dataOut, dataInLength, cryptor->ctx))) != kCCSuccess) return retval; - } else { - if((retval = ccLTCErr(cryptor->modeptr->mode_decrypt(dataIn, dataOut, dataInLength, cryptor->ctx))) != kCCSuccess) return retval; - } - cryptor->bytesProcessed += dataInLength; - if(dataOutMoved) *dataOutMoved = dataInLength; - return kCCSuccess; -} - - if(!(cryptor->bufStrat & ccStreamMode)) { - return kCCParamError; // ZZZ Need an invalid mode error before this goes public. - } - - blocksize = cryptor->blocksize; - willneed = ((cryptor->bufferPos + dataInLength) / blocksize) * blocksize; - if(cryptor->padding == ccPKCS7Padding) willneed -= blocksize; - if(willneed < 0) willneed = 0; - if(dataOutAvailable < willneed) { - ccdebug(ASL_LEVEL_ERR, "Pos %d InLength %d Needed %d Provided %d\n", cryptor->bufferPos, dataInLength, willneed, dataOutAvailable); - return kCCBufferTooSmall; - } - - inp = (char *) dataIn; - outp = (char *) dataOut; - inlen = dataInLength; - outlen = 0; - bufp = cryptor->buffptr; - - if(cryptor->bufferPos == 0 && cryptor->padding != ccPKCS7Padding - /* && (((size_t) dataIn % 4) == 0) && (((size_t) dataOut % 4) == 0) */ ) { - // No Padding, not buffering, aligned pointers don't appear necessary for the entry into the x86 optimized routines. */ - - size_t chunklen; - - chunklen = (dataInLength / cryptor->blocksize) * cryptor->blocksize; - - if(chunklen) { - if(cryptor->op == kCCEncrypt) { - if((retval = ccLTCErr(cryptor->modeptr->mode_encrypt(inp, outp, chunklen, cryptor->ctx))) != kCCSuccess) return retval; - } else { - if((retval = ccLTCErr(cryptor->modeptr->mode_decrypt(inp, outp, chunklen, cryptor->ctx))) != kCCSuccess) return retval; - } - inp += chunklen; - outp += chunklen; - inlen -= chunklen; - outlen += chunklen; - done = (inlen == 0); - } - if(done) { - *dataOutMoved = outlen; - return kCCSuccess; - } - } - - /* fprintf(stderr, "CRYPTORUPDATE BufferPos %d Padding is %s dataIn %16llx dataOut %16llx %lld\n", - (int) cryptor->bufferPos, (cryptor->padding != ccPKCS7Padding) ? "None": "PKCS7", - (unsigned long) dataIn, (unsigned long) dataOut, - (unsigned long) dataInLength); */ - - - while(!done) { - // determine how much to move to fill buffer - - movecnt = blocksize - cryptor->bufferPos; - if(movecnt > inlen) movecnt = inlen; - - if(movecnt || cryptor->bufferPos == blocksize) { - memmove(bufp + cryptor->bufferPos, inp, movecnt); - inp += movecnt; - inlen -= movecnt; - cryptor->bufferPos += movecnt; - - if(cryptor->op == kCCEncrypt) { - if(cryptor->bufferPos == blocksize) { - if((retval = ccLTCErr(cryptor->modeptr->mode_encrypt(bufp, outp, blocksize, cryptor->ctx))) != kCCSuccess) return retval; - cryptor->bytesProcessed += blocksize; - cryptor->bufferPos = 0; - outp += blocksize; - outlen += blocksize; - dataOutAvailable -= blocksize; - } else { - done = 1; - } - } else { - if(cryptor->bufferPos == blocksize) { - /* Need to delay by one block to know when we're processing a padded block if padding is enabled */ - if(cryptor->padding == ccPKCS7Padding && inlen == 0) done = 1; - else { - if((retval = ccLTCErr(cryptor->modeptr->mode_decrypt(bufp, outp, blocksize, cryptor->ctx))) != kCCSuccess) return retval; - cryptor->bytesProcessed += blocksize; - cryptor->bufferPos = 0; - outp += blocksize; - outlen += blocksize; - dataOutAvailable -= blocksize; - } - } -} - } else done = 1; - } - *dataOutMoved = outlen; - return kCCSuccess; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(cryptorRef == NULL) return kCCSuccess; + cryptor = compat_cryptor->cryptor; + weMallocd = compat_cryptor->weMallocd; + + ccClearCryptor(cryptor); + + CC_XMEMSET(cryptor, 0, CCCRYPTOR_SIZE); + CC_XFREE(cryptor, DEFAULT_CRYPTOR_MALLOC); + if(weMallocd) CC_XFREE(compat_cryptor, sizeof(CCCompatCryptor)); + return kCCSuccess; +} + +#define FULLBLOCKSIZE(X,BLOCKSIZE) (((X)/(BLOCKSIZE))*BLOCKSIZE) +#define FULLBLOCKREMAINDER(X,BLOCKSIZE) ((X)%(BLOCKSIZE)) + +static CCCryptorStatus ccSimpleUpdate(CCCryptor *cryptor, const void *dataIn, size_t dataInLength, void **dataOut, size_t *dataOutAvailable, size_t *dataOutMoved) +{ + CCCryptorStatus retval; + if(dataOutAvailable < dataInLength) return kCCBufferTooSmall; + if(cryptor->op == kCCEncrypt) { + if((retval = ccDoEnCrypt(cryptor, dataIn, dataInLength, *dataOut)) != kCCSuccess) return retval; + } else { + if((retval = ccDoDeCrypt(cryptor, dataIn, dataInLength, *dataOut)) != kCCSuccess) return retval; + } + + cryptor->bytesProcessed += dataInLength; + if(dataOutMoved) *dataOutMoved += dataInLength; + *dataOut += dataInLength; + *dataOutAvailable -= dataInLength; + + return kCCSuccess; +} + + +static CCCryptorStatus ccBlockUpdate(CCCryptor *cryptor, const void *dataIn, size_t dataInLength, void *dataOut, size_t *dataOutAvailable, size_t *dataOutMoved) +{ + CCCryptorStatus retval; + uint32_t encrypting = (cryptor->op == kCCEncrypt); + size_t blocksize = ccGetCipherBlockSize(cryptor); + size_t reserve = ccGetReserve(cryptor); + size_t buffsize = (reserve) ? reserve: blocksize; /* minimum buffering is a block */ + size_t dataCount = cryptor->bufferPos + dataInLength; /* Total amount of data we have "in hand" to process now. */ + size_t dataCountToHold, dataCountToProcess; + size_t remainder, movecnt; + + /* This is a simple optimization */ + if(reserve == 0 && cryptor->bufferPos == 0 && (dataInLength % blocksize) == 0) { // No Padding, not buffering, even blocks + // printf("simple processing\n"); + return ccSimpleUpdate(cryptor, dataIn, dataInLength, &dataOut, &dataOutAvailable, dataOutMoved); + } + + /* From this point on we're dealing with a Block Cipher with Block oriented I/O + + We always fallback to buffering once we're processing non-block aligned data. + If the data inputs result in data becoming block aligned once again we can + move back to block aligned I/O - even if it's only for partial processing + of the data supplied to this routine. + + */ + + if(dataCount <= reserve) { + dataCountToHold = dataCount; + } else { + remainder = FULLBLOCKREMAINDER(dataCount, blocksize); + dataCountToHold = buffsize - blocksize + remainder; + dataCountToHold = (remainder) ? dataCountToHold: reserve; + } + + dataCountToProcess = dataCount - dataCountToHold; + // printf("DataCount %d Processing %d Holding %d\n", dataCount, dataCountToProcess, dataCountToHold); + + if(dataCountToProcess > 0) { + if(cryptor->bufferPos == 0) { + // printf("CCCryptorUpdate checkpoint 0\n"); + /* nothing to do yet */ + } else if(cryptor->bufferPos < dataCountToProcess) { + // printf("CCCryptorUpdate checkpoint 1\n"); + movecnt = blocksize - (cryptor->bufferPos % blocksize); + ccAddBuff(cryptor, dataIn, movecnt); + dataIn += movecnt; dataInLength -= movecnt; + + // printf("CCCryptorUpdate checkpoint 1.1 bufpos = %d\n", (int) cryptor->bufferPos); + if((retval = ccSimpleUpdate(cryptor, cryptor->buffptr, cryptor->bufferPos, &dataOut, &dataOutAvailable, dataOutMoved)) != kCCSuccess) { + return retval; + } + // printf("CCCryptorUpdate checkpoint 1.2\n"); + + dataCountToProcess -= cryptor->bufferPos; + cryptor->bufferPos = 0; + } else if(cryptor->bufferPos == dataCountToProcess) { + // printf("CCCryptorUpdate checkpoint 2\n"); + if((retval = ccSimpleUpdate(cryptor, cryptor->buffptr, cryptor->bufferPos, &dataOut, &dataOutAvailable, dataOutMoved)) != kCCSuccess) { + return retval; + } + dataCountToProcess -= cryptor->bufferPos; + cryptor->bufferPos = 0; + } else /* (cryptor->bufferPos > dataCountToProcess) */ { + // printf("CCCryptorUpdate checkpoint 3\n"); + if(dataCountToHold) { + // printf("CCCryptorUpdate bad calculation 1\n"); + return kCCDecodeError; + } + if((retval = ccSimpleUpdate(cryptor, cryptor->buffptr, dataCountToProcess, &dataOut, &dataOutAvailable, dataOutMoved)) != kCCSuccess) { + return retval; + } + cryptor->bufferPos = reserve - dataCountToProcess; + memmove(cryptor->buffptr, ((uint8_t *) cryptor->buffptr)+ dataCountToProcess, cryptor->bufferPos); + return kCCSuccess; + } + + if(dataCountToProcess > 0) { + // printf("CCCryptorUpdate checkpoint 4\n"); + movecnt = FULLBLOCKREMAINDER(dataCountToProcess, blocksize); + if(movecnt) { + // printf("CCCryptorUpdate bad calculation 2\n"); + return kCCDecodeError; + } + if((retval = ccSimpleUpdate(cryptor, dataIn, dataCountToProcess, &dataOut, &dataOutAvailable, dataOutMoved)) != kCCSuccess) return retval; + dataIn += dataCountToProcess; dataInLength -= dataCountToProcess; + } + } + + if(dataCountToHold) { + // printf("CCCryptorUpdate checkpoint 1\n"); + movecnt = dataCountToHold - cryptor->bufferPos; + if(movecnt) { + if(movecnt != dataInLength) { + // printf("CCCryptorUpdate bad calculation 3\n"); + return kCCDecodeError; + } + ccAddBuff(cryptor, dataIn, movecnt); + dataIn += movecnt; dataInLength -= movecnt; + } + } + + if(dataInLength) { + // printf("CCCryptorUpdate bad calculation 4\n"); + return kCCDecodeError; + } + return kCCSuccess; + +} + +CCCryptorStatus CCCryptorUpdate(CCCryptorRef cryptorRef, const void *dataIn, size_t dataInLength, void *dataOut, size_t dataOutAvailable, size_t *dataOutMoved) +{ + CCCryptorStatus retval; + CCCompatCryptor *compat_cryptor = cryptorRef; + CCCryptor *cryptor; + + + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(dataOutMoved) *dataOutMoved = 0; + if(compat_cryptor == NULL) return kCCParamError; + cryptor = compat_cryptor->cryptor; + + if(dataInLength == 0) return kCCSuccess; + + if(ccIsStreaming(cryptor)) { + return ccSimpleUpdate(cryptor, dataIn, dataInLength, &dataOut, &dataOutAvailable, dataOutMoved); + } + + retval = ccBlockUpdate(cryptor, dataIn, dataInLength, dataOut, dataOutAvailable, dataOutMoved); + + return retval; } CCCryptorStatus CCCryptorFinal( CCCryptorRef cryptorRef, - void *dataOut, /* data RETURNED here */ + void *dataOut, /* data RETURNED here */ size_t dataOutAvailable, size_t *dataOutMoved) /* number of bytes written */ { - CCCryptorStatus retval; - char *bufp; - size_t blocksize, moved; - uint8_t padval; - char tmpbuf[ccMaxCipherBlockSize]; CCCompatCryptor *compat_cryptor = cryptorRef; - CCCryptor *cryptor; - + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); if(compat_cryptor == NULL) return kCCParamError; - cryptor = compat_cryptor->cryptor; - if(cryptor == NULL) return kCCParamError; + CCCryptor *cryptor = compat_cryptor->cryptor; + if(cryptor == NULL) return kCCSuccess; // Some old behavior .. CDSA? has zapped the Cryptor. + + + CCCryptorStatus retval; + int encrypting = (cryptor->op == kCCEncrypt); + uint8_t *bufp = cryptor->buffptr; + uint32_t blocksize = ccGetCipherBlockSize(cryptor); + + size_t moved; + uint8_t padval; + char tmpbuf[blocksize*2]; + + + if(dataOutMoved) *dataOutMoved = 0; - if(cryptor->bufStrat == ccStreaming) return kCCSuccess; - - blocksize = cryptor->blocksize; - bufp = cryptor->buffptr; - - if(cryptor->op == kCCEncrypt) { - if(cryptor->padding == ccPKCS7Padding) { - padval = pkcs7_pad(bufp, blocksize, cryptor->bufferPos); - moved = cryptor->bufferPos + padval; - if(dataOutAvailable < moved) return kCCBufferTooSmall; - if((retval = ccLTCErr(cryptor->modeptr->mode_encrypt(bufp, (char *) dataOut, moved, cryptor->ctx))) != kCCSuccess) return retval; - *dataOutMoved = moved; - cryptor->bytesProcessed += moved; - } + + if(ccIsStreaming(cryptor)) return kCCSuccess; + + if(encrypting) { + retval = ccEncryptPad(cryptor, tmpbuf, &moved); + if(retval != kCCSuccess) return retval; + if(dataOutAvailable < moved) { + return kCCBufferTooSmall; + } + if(dataOut) { + CC_XMEMCPY(dataOut, tmpbuf, moved); + if(dataOutMoved) *dataOutMoved = moved; + } cryptor->bufferPos = 0; - } else if(cryptor->op == kCCDecrypt) { - if(cryptor->padding == ccPKCS7Padding) { - if(cryptor->bufferPos != blocksize) { - return kCCAlignmentError; - } - if((retval = ccLTCErr(cryptor->modeptr->mode_decrypt(bufp, tmpbuf, blocksize, cryptor->ctx))) != kCCSuccess) return retval; - if((moved = pkcs7_unpadlen(tmpbuf, blocksize)) == -1) { - return kCCAlignmentError; - } - if(dataOutAvailable < moved) return kCCBufferTooSmall; - *dataOutMoved = moved; + } else { + if(ccGetReserve(cryptor) != 0) { + retval = ccDecryptPad(cryptor, tmpbuf, &moved); + if(retval != kCCSuccess) return retval; + if(dataOutAvailable < moved) { + return kCCBufferTooSmall; + } + if(dataOut) { + CC_XMEMCPY(dataOut, tmpbuf, moved); + if(dataOutMoved) *dataOutMoved = moved; + } cryptor->bytesProcessed += *dataOutMoved; - memmove((char *) dataOut, tmpbuf, *dataOutMoved); - } - } else /* Block I/O */ { - // Nothing for now. Block I/O will go here. + cryptor->bufferPos = 0; + } } return kCCSuccess; } size_t CCCryptorGetOutputLength( @@ -418,54 +811,83 @@ CCCryptorRef cryptorRef, size_t inputLength, bool final) { size_t retval; - size_t totallength; CCCompatCryptor *compat_cryptor = cryptorRef; CCCryptor *cryptor; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); if(compat_cryptor == NULL) return kCCParamError; cryptor = compat_cryptor->cryptor; - - if(cryptor == NULL) return kCCParamError; - totallength = cryptor->bufferPos + inputLength; - if((cryptor->bufStrat == ccStreaming) || (cryptor->padding == 0)) retval = totallength; - else if(cryptor->op == kCCEncrypt) retval = (totallength/cryptor->blocksize + 1) * cryptor->blocksize; - else retval = totallength; - ccdebug(ASL_LEVEL_ERR, " InputLength %d Final is %s OutputLength %d\n", inputLength, (final = true) ? "TRUE": "FALSE", retval); - return retval; -} - -/* - * This routine needs to reset both the buffer position and the IV. - * If the IV isn't used, don't attempt to reset it (RC4 is an example). - */ - + + retval = cryptor->bufferPos + inputLength; + + if(ccIsStreaming(cryptor)) + return retval; + + if(cryptor->op == kCCEncrypt) { + retval = FULLBLOCKSIZE(retval, ccGetCipherBlockSize(cryptor)); + if(final) retval += ccGetPadlen(cryptor); + return retval; + } else { + if(final) return retval; + else return FULLBLOCKSIZE(retval, ccGetCipherBlockSize(cryptor)); + } +} + CCCryptorStatus CCCryptorReset( CCCryptorRef cryptorRef, const void *iv) { CCCompatCryptor *compat_cryptor = cryptorRef; CCCryptor *cryptor; + CCCryptorStatus retval; + + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(compat_cryptor == NULL) return kCCParamError; + cryptor = compat_cryptor->cryptor; + /* + This routine resets all buffering and sets or clears the IV. It is + documented to throw away any in-flight buffer data. + */ + + cryptor->bytesProcessed = cryptor->bufferPos = 0; + + /* + Call the common routine to reset the IV - this will copy in the new + value. There is now always space for an IV in the cryptor. + */ + + if(iv) { + retval = ccSetIV(cryptor, iv, ccGetCipherBlockSize(cryptor)); + } else { + uint8_t ivzero[ccGetCipherBlockSize(cryptor)]; + CC_XZEROMEM(ivzero, ccGetCipherBlockSize(cryptor)); + retval = ccSetIV(cryptor, ivzero, ccGetCipherBlockSize(cryptor)); + } + if(retval == kCCParamError) return kCCSuccess; + return retval; +} + +CCCryptorStatus +CCCryptorGetIV(CCCryptorRef cryptorRef, void *iv) +{ + uint32_t blocklen; + CCCompatCryptor *compat_cryptor = cryptorRef; + CCCryptor *cryptor; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); if(compat_cryptor == NULL) return kCCParamError; cryptor = compat_cryptor->cryptor; - /* need to reset buffering position. */ - cryptor->bufferPos = 0; - cryptor->bytesProcessed = 0; - /* (and others) Don't reset the IV if a streaming cipher is being used. */ - if(cryptor->blocksize == 1) return CRYPT_OK; // RC4 - ccSetIV(cryptor, iv); - - /* Make sure the mode has a "setter" for the IV - if not, we're done. */ - if(cryptor->modeptr->mode_setiv == NULL) - return kCCSuccess; - - return ccLTCErr(cryptor->modeptr->mode_setiv(cryptor->iv, cryptor->ctx->cbcContext.blocklen, cryptor->ctx)); -} + if(ccIsStreaming(cryptor)) return kCCParamError; + return ccGetIV(cryptor, iv, ccGetCipherBlockSize(cryptor)); +} + /* * One-shot is mostly service provider independent, except for the * dataOutLength check. @@ -483,166 +905,45 @@ size_t dataOutAvailable, size_t *dataOutMoved) { CCCryptorRef cryptor = NULL; CCCryptorStatus retval; - uint8_t *outp; size_t outputSize; size_t used = 0; size_t moved; - + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); if(retval = CCCryptorCreate(op, alg, options, key, keyLength, iv, &cryptor)) { return retval; } - - if((outputSize = CCCryptorGetOutputLength(cryptor, dataInLength, false)) > dataOutAvailable) { + + if((outputSize = CCCryptorGetOutputLength(cryptor, dataInLength, true)) > dataOutAvailable) { CCCryptorRelease(cryptor); if(dataOutMoved != NULL) *dataOutMoved = outputSize; return kCCBufferTooSmall; } - - outp = (uint8_t *) dataOut; - - if(retval = CCCryptorUpdate(cryptor, dataIn, dataInLength, outp, dataOutAvailable, &moved)) { + + if(retval = CCCryptorUpdate(cryptor, dataIn, dataInLength, dataOut, dataOutAvailable, &moved)) { CCCryptorRelease(cryptor); return retval; } - outp += moved; + dataOut += moved; used += moved; dataOutAvailable -= moved; - if(retval = CCCryptorFinal(cryptor, outp, dataOutAvailable, &moved)) { - ccdebug(ASL_LEVEL_ERR, "Final Error\n", 0); + + if(retval = CCCryptorFinal(cryptor, dataOut, dataOutAvailable, &moved)) { + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Final Error\n", 0); + // printf("Failing on final\n"); } else { used += moved; if(dataOutMoved != NULL) *dataOutMoved = used; } - + CCCryptorRelease(cryptor); return retval; } - - -CCCryptorStatus CCCryptorCreateFromDataWithMode( - CCOperation op, /* kCCEncrypt, kCCEncrypt, kCCBoth (default for BlockMode) */ - CCMode mode, - CCAlgorithm alg, - CCPadding padding, - const void *iv, /* optional initialization vector */ - const void *key, /* raw key material */ - size_t keyLength, - const void *tweak, /* raw tweak material */ - size_t tweakLength, - int numRounds, - CCModeOptions options, - const void *data, /* caller-supplied memory */ - size_t dataLength, /* length of data in bytes */ - CCCryptorRef *cryptorRef, /* RETURNED */ - size_t *dataUsed) /* optional, RETURNED */ -{ - CCCompatCryptor *compat_cryptor = NULL; - CCCryptor *cryptor = NULL; - uint32_t err; - size_t needed; - - /* validate pointers */ - if((data == NULL) || (cryptorRef == NULL) || (key == NULL)) { - ccdebug(ASL_LEVEL_ERR, "bad arguments\n", 0); - return kCCParamError; - } - - if((size_t)data % 4) return kCCAlignmentError; - - compat_cryptor = data; - - needed = sizeof(CCCompatCryptor); - if(dataUsed != NULL) *dataUsed = needed; - - if(needed > dataLength) { - return kCCBufferTooSmall; - } - - compat_cryptor->weMallocd = false; - if((cryptor = (CCCryptor *)malloc(DEFAULT_CRYPTOR_MALLOC)) == NULL) return kCCMemoryFailure; - compat_cryptor->cryptor = cryptor; - - cryptor->mode = mode; - cryptor->modeptr = mode_descriptor[cryptor->mode]; - - cryptor->ctx = (mode_context *) cryptor->modeContext; - - ccdebug(ASL_LEVEL_ERR, "Entered - data (%016llx) cryptor (%016llx) ctx (%016llx)\n", (uint64_t) data, (uint64_t) cryptor, (uint64_t) cryptor->ctx); - - /* Setup the easy parts of the Cryptor - some will be used in other APIs */ - cryptor->op = op; - cryptor->mallocAddress = NULL; - cryptor->cipher = alg; - cryptor->bytesProcessed = cryptor->bufferPos = 0; - cryptor->bufferPos = 0; - - cryptor->padding = padding; - - if(alg == kCCAlgorithmRC4) { // Only pure streaming algorithm currently supported. - cryptor->blocksize = 1; - cryptor->bufStrat = ccStreaming; - cryptor->ltcAlgIndex = -1; - } else { - if((cryptor->ltcAlgIndex = ccGetAlgorithm(alg)) == -1) return kCCParamError; - if(cipher_descriptor[cryptor->ltcAlgIndex].keysize && - cipher_descriptor[cryptor->ltcAlgIndex].keysize(&keyLength) != CRYPT_OK) - return kCCParamError; - cryptor->blocksize = cipher_descriptor[cryptor->ltcAlgIndex].block_length; - cryptor->bufStrat = ccStreaming; - if(cryptor->mode == kCCModeECB) cryptor->bufStrat = ccBlockMode | ccStreamMode; - if(cryptor->mode == kCCModeCBC) cryptor->bufStrat = ccBlockMode | ccStreamMode; - if(cryptor->mode == kCCModeXTS) cryptor->bufStrat = ccBlockMode; - } - - ccSetIV(cryptor, iv); - *cryptorRef = compat_cryptor; - - /* once the cryptor is all setup - initialize the context */ - - if(cryptor->modeptr->mode_setup) { - err = cryptor->modeptr->mode_setup(cryptor->ltcAlgIndex, cryptor->iv, - key, keyLength, tweak, tweakLength, - numRounds, options, cryptor->ctx); - } else { - /* There *should* be no cases where this occurs. */ - return kCCUnimplemented; - } - - return ccLTCErr(err); - } - -/* This version mallocs the CCCryptorRef */ - -CCCryptorStatus CCCryptorCreateWithMode( - CCOperation op, /* kCCEncrypt, kCCEncrypt, kCCBoth (default for BlockMode) */ - CCMode mode, - CCAlgorithm alg, - CCPadding padding, - const void *iv, /* optional initialization vector */ - const void *key, /* raw key material */ - size_t keyLength, - const void *tweak, /* raw tweak material */ - size_t tweakLength, - int numRounds, /* 0 == default */ - CCModeOptions options, - CCCryptorRef *cryptorRef) /* RETURNED */ -{ - CCCryptorStatus err; - CCCompatCryptor *compat_cryptor = NULL; - size_t dataUsed = 0; - - if((compat_cryptor = (CCCompatCryptor *)malloc(sizeof(CCCompatCryptor))) == NULL) return kCCMemoryFailure; - err = CCCryptorCreateFromDataWithMode( op, mode, alg, padding, iv, key, keyLength, tweak, tweakLength, numRounds, options, compat_cryptor, DEFAULT_CRYPTOR_MALLOC, cryptorRef, &dataUsed); - if(err != kCCSuccess) free(compat_cryptor); - else compat_cryptor->weMallocd = true; - return err; - } - CCCryptorStatus CCCryptorEncryptDataBlock( CCCryptorRef cryptorRef, const void *iv, const void *dataIn, size_t dataInLength, @@ -649,22 +950,17 @@ void *dataOut) { CCCompatCryptor *compat_cryptor = cryptorRef; CCCryptor *cryptor; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); if(compat_cryptor == NULL) return kCCParamError; cryptor = compat_cryptor->cryptor; - if((cryptor->bufStrat & ccBlockMode) == 0) return kCCParamError; - - if(iv && cryptor->modeptr->mode_encrypt_tweaked != NULL && cryptor->modeptr->mode_encrypt_tweaked != unimp_mode_encrypt_tweaked) - return ccLTCErr(cryptor->modeptr->mode_encrypt_tweaked(dataIn, dataInLength, dataOut, (const unsigned char *) iv, cryptor->ctx)); - - if(cryptor->modeptr->mode_encrypt != NULL && cryptor->modeptr->mode_encrypt != unimp_mode_encrypt) - return ccLTCErr(cryptor->modeptr->mode_encrypt(dataIn, dataOut, dataInLength, cryptor->ctx)); - - return kCCUnimplemented; + if(ccIsStreaming(cryptor)) return kCCParamError; + if(!iv) return ccDoEnCrypt(cryptor, dataIn, dataInLength, dataOut); + return ccDoEnCryptTweaked(cryptor, dataIn, dataInLength, dataOut, iv); } CCCryptorStatus CCCryptorDecryptDataBlock( CCCryptorRef cryptorRef, @@ -674,20 +970,64 @@ void *dataOut) { CCCompatCryptor *compat_cryptor = cryptorRef; CCCryptor *cryptor; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); if(compat_cryptor == NULL) return kCCParamError; cryptor = compat_cryptor->cryptor; - - if((cryptor->bufStrat & ccBlockMode) == 0) return kCCParamError; - - if(iv && cryptor->modeptr->mode_decrypt_tweaked != NULL && cryptor->modeptr->mode_decrypt_tweaked != unimp_mode_decrypt_tweaked) - return ccLTCErr(cryptor->modeptr->mode_decrypt_tweaked(dataIn, dataInLength, dataOut, (const unsigned char *) iv, cryptor->ctx)); - - if(cryptor->modeptr->mode_decrypt != NULL && cryptor->modeptr->mode_decrypt != unimp_mode_decrypt) - return ccLTCErr(cryptor->modeptr->mode_decrypt(dataIn, dataOut, dataInLength, cryptor->ctx)); - - return kCCUnimplemented; + + if(ccIsStreaming(cryptor)) return kCCParamError; + if(!iv) return ccDoDeCrypt(cryptor, dataIn, dataInLength, dataOut); + return ccDoDeCryptTweaked(cryptor, dataIn, dataInLength, dataOut, iv); +} + + +CCCryptorStatus CCDesIsWeakKey( void *key, size_t length) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return ccdes_key_is_weak(key, length); +} + +void CCDesSetOddParity(void *key, size_t Length) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccdes_key_set_odd_parity(key, Length); +} + +uint32_t CCDesCBCCksum(void *in, void *out, size_t length, + void *key, size_t keylen, void *ivec) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return ccdes_cbc_cksum(in, out, length, key, keylen, ivec); +} + +// Legacy SPI +#include + +typedef struct current_rc4_key_st +{ + uint32_t x,y; + uint32_t data[256]; +} RC4_KEY; + +#ifndef NDEBUG +#define ASSERT(s) +#else +#define ASSERT(s) assert(s) +#endif + +void CC_RC4_set_key(void *ctx, int len, const unsigned char *data) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ASSERT(sizeof(RC4_KEY) == ccrc4_eay.size); + ccrc4_eay.init(ctx, len, data); +} + +void CC_RC4(void *ctx, unsigned long len, const unsigned char *indata, + unsigned char *outdata) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccrc4_eay.crypt(ctx, len, indata, outdata); } Index: Source/API/CommonCryptorPriv.h ================================================================== --- Source/API/CommonCryptorPriv.h +++ Source/API/CommonCryptorPriv.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2006-2010 Apple, Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License @@ -21,70 +21,61 @@ * @APPLE_LICENSE_HEADER_END@ */ /* * CommonCryptorPriv.h - interface between CommonCryptor and operation- and - * algorithm-specific service providers. + * algorithm-specific service providers. */ -#ifndef _CC_COMMON_CRYPTOR_PRIV_ -#define _CC_COMMON_CRYPTOR_PRIV_ +#ifndef _CC_COMMON_CRYPTOR_PRIV_ +#define _CC_COMMON_CRYPTOR_PRIV_ #include "CommonCryptor.h" #include "CommonCryptorSPI.h" -#include "tomcrypt.h" -#include "rc4.h" -#include "pkcs7pad.h" +#include +#include "corecryptoSymmetricBridge.h" #ifdef __cplusplus extern "C" { #endif - -static enum { - ccStreaming = 0x00000001, - ccStreamMode = 0x00000002, - ccBlockMode = 0x00000004 -}; -typedef uint32_t CCBufStrat; - -#define CCMAXBUFFERSIZE 128 -#define CCMAXCONTEXTSIZE 1032 - -static uint32_t ccMaxCipherBlockSize = CCMAXBUFFERSIZE; // rc2/rc5 max blocksize -static uint32_t ccDefaultRounds = 0; - -typedef struct _CCCryptor { - char buffptr[CCMAXBUFFERSIZE]; - char iv[CCMAXBUFFERSIZE]; - - CCOperation op; // kCCEncrypt, kCCDecrypt, or kCCBoth - CCAlgorithm cipher; // encryption algorithm - CCMode mode; // one of pre-defined modes - mode_descriptor_ptr modeptr; - CCBufStrat bufStrat; - CCPadding padding; // padding to use 0 (default) or kCCOptionPKCS7Padding - int32_t ltcAlgIndex; // LibTomCrypt cipher index - uint32_t blocksize; - uint32_t bufferPos; - uint32_t bytesProcessed; - mode_context *ctx; // largest size context in use - void* mallocAddress; // if Not NULL, we mallocd this and must free it in CCCryptorRelease() - uint32_t modeContext[CCMAXCONTEXTSIZE/4]; -} CCCryptor; -static uint32_t cryptorSize = sizeof(struct _CCCryptor); - - + + /* Byte-Size Constants */ +#define CCMAXBUFFERSIZE 128 /* RC2/RC5 Max blocksize */ +#define DEFAULT_CRYPTOR_MALLOC 4096 +#define CC_STREAMKEYSCHED 2048 +#define CC_MODEKEYSCHED 2048 +#define CC_MAXBLOCKSIZE 128 + +typedef struct _CCCryptor { + uint8_t buffptr[32]; + uint32_t bufferPos; + uint32_t bytesProcessed; + uint32_t cipherBlocksize; + + CCAlgorithm cipher; + CCMode mode; + CCOperation op; /* kCCEncrypt, kCCDecrypt, or kCCBoth */ + + corecryptoMode symMode[2]; + cc2CCModeDescriptor *modeDesc; + modeCtx ctx[2]; + cc2CCPaddingDescriptor *padptr; +} CCCryptor; + + typedef struct _CCCompat { uint32_t weMallocd; CCCryptor *cryptor; } CCCompatCryptor; - + #define CCCRYPTOR_SIZE sizeof(struct _CCCryptor) #define kCCContextSizeGENERIC (sizeof(CCCompatCryptor)) + corecryptoMode getCipherMode(CCAlgorithm cipher, CCMode mode, CCOperation direction); + #ifdef __cplusplus } #endif -#endif /* _CC_COMMON_CRYPTOR_PRIV_ */ +#endif /* _CC_COMMON_CRYPTOR_PRIV_ */ ADDED Source/API/CommonDH.c Index: Source/API/CommonDH.c ================================================================== --- /dev/null +++ Source/API/CommonDH.c @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2012 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +// #define COMMON_DH_FUNCTIONS +#include "CommonDH.h" +#include "CommonRandomSPI.h" +#include +#include +#include +#include +#include +#include "ccMemory.h" +#include "ccErrors.h" +#include "ccdebug.h" + +typedef struct CCDHParameters_s { + ccdh_const_gp_t gp; + size_t malloced; +} CCDHParmSetstruct, *CCDHParmSet; + +typedef struct DH_ { + CCDHParmSet parms; + ccdh_full_ctx_t ctx; +} CCDHstruct, *CCDH; + + +static struct CCDHParameters_s gp2; +static struct CCDHParameters_s gp5; +CCDHParameters kCCDHRFC2409Group2 = &gp2; +CCDHParameters kCCDHRFC3526Group5 = &gp5; + +// = ccdh_gp_rfc3526group05(void); +static void +ccdhInitGPs() { + static dispatch_once_t dhgpinit; + dispatch_once(&dhgpinit, ^{ + kCCDHRFC3526Group5->malloced = 0; + kCCDHRFC3526Group5->gp = ccdh_gp_rfc3526group05(); + }); +} + + +CCDHRef +CCDHCreate(CCDHParameters dhParameter) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CC_NONULLPARM(dhParameter); + if(dhParameter == kCCDHRFC2409Group2) return NULL; // no corecrypto group yet for this. + ccdhInitGPs(); + + CCDHParmSet CCDHParm = (CCDHParmSet) dhParameter; + + CCDH retval = CC_XMALLOC(sizeof(CCDHstruct)); + if(retval == NULL) return retval; + + retval->ctx._full = CC_XMALLOC(ccdh_full_ctx_size(ccdh_ccn_size(CCDHParm->gp))); + + + + if(retval->ctx._full == NULL) { + CC_XFREE(retval, sizeof(CCDHstruct)); + return NULL; + } + + ccdh_ctx_init(CCDHParm->gp, retval->ctx); + retval->parms = CCDHParm; + + return retval; +} + +void +CCDHRelease(CCDHRef ref) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(ref == NULL) return; + CCDH keyref = (CCDH) ref; + if(keyref->ctx._full) + CC_XFREE(keyref->ctx._full, ccdh_full_ctx_size(ccdh_ccn_size(keyref->parms->gp))); + keyref->ctx._full = keyref->parms = NULL; + CC_XFREE(keyref, sizeof(CCDHstruct)); +} + +int +CCDHGenerateKey(CCDHRef ref, void *output, size_t *outputLength) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CC_NONULLPARM(ref); + CC_NONULLPARM(output); + CC_NONULLPARM(outputLength); + + CCDH keyref = (CCDH) ref; + + if(ccdh_generate_key(keyref->parms->gp, ccDRBGGetRngState(), keyref->ctx.pub)) + return -1; + + size_t size_needed = ccdh_export_pub_size(keyref->ctx); + if(size_needed > *outputLength) { + *outputLength = size_needed; + return -1; + } + + *outputLength = size_needed; + ccdh_export_pub(keyref->ctx, output); + return 0; +} + + +int +CCDHComputeKey(unsigned char *sharedKey, size_t *sharedKeyLen, const void *peerPubKey, size_t peerPubKeyLen, CCDHRef ref) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CC_NONULLPARM(sharedKey); + CC_NONULLPARM(sharedKeyLen); + CC_NONULLPARM(peerPubKey); + CC_NONULLPARM(ref); + + CCDH keyref = (CCDH) ref; + ccdh_pub_ctx_decl_gp(keyref->parms->gp, peer_pub); + cc_size n = ccdh_ctx_n(keyref->ctx); + cc_unit skey[n]; + + if(ccdh_import_pub(keyref->parms->gp, peerPubKeyLen, peerPubKey, + peer_pub)) + return -1; + + if(ccdh_compute_key(keyref->ctx, peer_pub, skey)) + return -1; + + size_t size_needed = ccn_write_uint_size(n, skey); + if(size_needed > *sharedKeyLen) { + *sharedKeyLen = size_needed; + return -1; + } + *sharedKeyLen = size_needed; + (void) ccn_write_uint_padded(n, skey, *sharedKeyLen, sharedKey); + + return 0; + +} + +CCDHParameters +CCDHParametersCreateFromData(const void *p, size_t pLen, const void *g, size_t gLen, size_t l) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CC_NONULLPARM(p); + CC_NONULLPARM(g); + + cc_size psize = ccn_nof_size(pLen); + cc_size gsize = ccn_nof_size(gLen); + cc_size n = (psize > gsize) ? psize: gsize; + cc_unit pval[n], gval[n]; + + CCDHParmSet retval = CC_XMALLOC(sizeof(CCDHParmSetstruct)); + if(retval == NULL) return NULL; + + retval->malloced = ccdh_gp_size(n); + retval->gp.gp = (ccdh_gp *) CC_XMALLOC(retval->malloced); + if(retval->gp.gp == NULL) { + retval->malloced = 0; + CC_XFREE(retval, sizeof(CCDHParmSetstruct)); + return NULL; + } + + if(ccdh_init_gp(retval->gp._ncgp, n, pval, gval, (cc_size) l)) + return NULL; + return retval; + +} + +void +CCDHParametersRelease(CCDHParameters parameters) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(parameters == NULL) return; + if(parameters == kCCDHRFC2409Group2) return; + if(parameters == kCCDHRFC3526Group5) return; + + CCDHParmSet CCDHParm = (CCDHParmSet) parameters; + if(CCDHParm->malloced) + CC_XFREE(CCDHParm->gp.gp, retval->malloced); + CCDHParm->malloced = 0; + CCDHParm->gp.gp = NULL; + CC_XFREE(CCDHParm, sizeof(CCDHParmSetstruct)); +} + +// TODO - needs PKCS3 in/out +CCDHParameters +CCDHParametersCreateFromPKCS3(const void *data, size_t len) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CC_NONULLPARM(data); + return NULL; +} + +size_t +CCDHParametersPKCS3EncodeLength(CCDHParameters parms) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return 0; +} + +size_t +CCDHParametersPKCS3Encode(CCDHParameters parms, void *data, size_t dataAvailable) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return 0; +} + Index: Source/API/CommonDigest.c ================================================================== --- Source/API/CommonDigest.c +++ Source/API/CommonDigest.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * Copyright (c) 2012 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License @@ -19,133 +19,641 @@ * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ +// #define COMMON_DIGEST_FUNCTIONS +#define COMMON_DIGEST_FOR_RFC_1321 + #include "CommonDigest.h" #include "CommonDigestPriv.h" #include "CommonDigestSPI.h" -#include "tomcrypt.h" -#include "skein_ltc.h" - -#define SELECT_HASH(X,Y,Z) case X: \ - ptr->hashIndex = register_hash(&Y); \ - break - - -int -CCDigestInit(CCDigestAlg algorithm, CCDigestRef ctx) -{ - CCDigestCtxPtr ptr = (CCDigestCtxPtr) ctx; - - switch(algorithm) { - SELECT_HASH(kCCDigestMD2,md2_desc,7); - SELECT_HASH(kCCDigestMD4,md4_desc,6); - SELECT_HASH(kCCDigestMD5,ltc_md5_desc,3); - SELECT_HASH(kCCDigestRMD128,rmd128_desc,8); - SELECT_HASH(kCCDigestRMD160,rmd160_desc,9); - SELECT_HASH(kCCDigestRMD256,rmd256_desc,11); - SELECT_HASH(kCCDigestRMD320,rmd320_desc,12); - SELECT_HASH(kCCDigestSHA1,sha1_desc,2); - SELECT_HASH(kCCDigestSHA224,sha224_desc,10); - SELECT_HASH(kCCDigestSHA256,sha256_desc,0); - SELECT_HASH(kCCDigestSHA384,sha384_desc,4); - SELECT_HASH(kCCDigestSHA512,sha512_desc,5); - SELECT_HASH(kCCDigestSkein128,skein512_128_desc,SKEIN512_128_LTC_TAG); - SELECT_HASH(kCCDigestSkein160,skein512_160_desc,SKEIN512_160_LTC_TAG); - SELECT_HASH(kCCDigestSkein224,skein512_224_desc,SKEIN512_224_LTC_TAG); - SELECT_HASH(kCCDigestSkein256,skein512_256_desc,SKEIN512_256_LTC_TAG); - SELECT_HASH(kCCDigestSkein384,skein512_384_desc,SKEIN512_384_LTC_TAG); - SELECT_HASH(kCCDigestSkein512,skein512_512_desc,SKEIN512_512_LTC_TAG); - default: return -1; - } - return hash_descriptor[ptr->hashIndex].init(&ptr->md); -} - -int -CCDigestUpdate(CCDigestRef ctx, const void *data, size_t len) -{ - CCDigestCtxPtr ptr = (CCDigestCtxPtr) ctx; - uint8_t* checkedData = (const uint8_t *)data; - if (checkedData == NULL) { - checkedData = ""; - } - return hash_descriptor[ptr->hashIndex].process(&ptr->md, checkedData, len); -} - -int -CCDigestFinal(CCDigestRef ctx, uint8_t *output) -{ - CCDigestCtxPtr ptr = (CCDigestCtxPtr) ctx; - return hash_descriptor[ptr->hashIndex].done(&ptr->md, output); -} - -int -CCDigest(CCDigestAlg algorithm, const uint8_t *data, size_t length, uint8_t *output) +#include "ccErrors.h" +#include "ccMemory.h" +#include "ccdebug.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define NDEBUG +#ifndef NDEBUG +#define ASSERT(s) +#else +#define ASSERT(s) assert(s) +#endif + +static const size_t diMax = kCCDigestSkein512+1; +static struct ccdigest_info *di[diMax]; + +// This returns a pointer to the corecrypto "di" structure for a digest. +// It's used for all functions that need a di (HMac, Key Derivation, etc). + +struct ccdigest_info * +CCDigestGetDigestInfo(CCDigestAlgorithm algorithm) { + static dispatch_once_t di_init; + + dispatch_once(&di_init, ^{ + di[kCCDigestNone] = NULL; + di[kCCDigestMD2] = &ccmd2_di; + di[kCCDigestMD4] = &ccmd4_di; + di[kCCDigestMD5] = ccmd5_di(); + di[kCCDigestRMD128] = &ccrmd128_di; + di[kCCDigestRMD160] = &ccrmd160_di; + di[kCCDigestRMD256] = &ccrmd256_di; + di[kCCDigestRMD320] = &ccrmd320_di; + di[kCCDigestSHA1] = ccsha1_di(); + di[kCCDigestSHA224] = ccsha224_di(); + di[kCCDigestSHA256] = ccsha256_di(); + di[kCCDigestSHA384] = ccsha384_di(); + di[kCCDigestSHA512] = ccsha512_di(); + di[kCCDigestSkein128] = NULL; + di[kCCDigestSkein160] = NULL; + di[15] = NULL; // gap + di[kCCDigestSkein224] = NULL; + di[kCCDigestSkein256] = NULL; + di[kCCDigestSkein384] = NULL; + di[kCCDigestSkein512] = NULL; + }); + return di[algorithm]; +} + + +int +CCDigestInit(CCDigestAlgorithm alg, CCDigestRef c) +{ + if(alg == 0 || alg >= diMax) return kCCParamError; + if(!c) return kCCParamError; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering Algorithm: %d\n", alg); + CCDigestCtxPtr p = (CCDigestCtxPtr) c; + + if(p->di = CCDigestGetDigestInfo(alg)) { + ccdigest_init(p->di, (struct ccdigest_ctx *) p->md); + return 0; + } else { + return kCCUnimplemented; + } +} + +int +CCDigestUpdate(CCDigestRef c, const void *data, size_t len) +{ + // CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(c == NULL) return kCCParamError; + if(len == 0) return kCCSuccess; + if(data == NULL) return kCCParamError; /* this is only a problem if len > 0 */ + CCDigestCtxPtr p = (CCDigestCtxPtr) c; + if(p->di) { + ccdigest_update(p->di, (struct ccdigest_ctx *) p->md, len, data); + return kCCSuccess; + } + return kCCUnimplemented; +} + +int +CCDigestFinal(CCDigestRef c, uint8_t *out) +{ + // CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(c == NULL || out == NULL) return kCCParamError; + CCDigestCtxPtr p = (CCDigestCtxPtr) c; + if(p->di) { + ccdigest_final(p->di, (struct ccdigest_ctx *) p->md, out); + return 0; + } + return kCCUnimplemented; +} + +int +CCDigest(CCDigestAlgorithm alg, const uint8_t *data, size_t len, uint8_t *out) { CCDigestCtx_t c; - CCDigestCtxPtr ptr = &c; - CCDigestInit(algorithm, ptr); - uint8_t* checkedData = data; - if (checkedData == NULL) { - checkedData = ""; - } - hash_descriptor[ptr->hashIndex].process(&ptr->md, checkedData, length); - return hash_descriptor[ptr->hashIndex].done(&ptr->md, output); + int retval; + struct ccdigest_info *di; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering Algorithm: %d\n", alg); + if(di = CCDigestGetDigestInfo(alg)) { + ccdigest(di, len, data, out); + return 0; + } + return kCCUnimplemented; +} + +size_t +CCDigestGetBlockSize(CCDigestAlgorithm algorithm) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering Algorithm: %d\n", algorithm); + struct ccdigest_info *di = CCDigestGetDigestInfo(algorithm); + if(di) return di->block_size; + return kCCUnimplemented; +} + +size_t +CCDigestGetOutputSize(CCDigestAlgorithm algorithm) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering Algorithm: %d\n", algorithm); + struct ccdigest_info *di = CCDigestGetDigestInfo(algorithm); + if(di) return di->output_size; + return kCCUnimplemented; +} + +size_t +CCDigestGetBlockSizeFromRef(CCDigestRef ctx) +{ + // CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CCDigestCtxPtr p = (CCDigestCtxPtr) ctx; + if(p->di) return p->di->block_size; + return kCCUnimplemented; +} + +size_t +CCDigestBlockSize(CCDigestRef ctx) +{ + // CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return CCDigestGetBlockSizeFromRef(ctx); +} + +size_t +CCDigestOutputSize(CCDigestRef ctx) +{ + // CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return CCDigestGetOutputSizeFromRef(ctx); +} + +size_t +CCDigestGetOutputSizeFromRef(CCDigestRef ctx) +{ + // CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CCDigestCtxPtr p = (CCDigestCtxPtr) ctx; + if(p->di) return p->di->output_size; + return kCCUnimplemented; +} + + + + + +CCDigestRef +CCDigestCreate(CCDigestAlgorithm alg) +{ + CCDigestCtxPtr retval = CC_XMALLOC(sizeof(CCDigestCtx_t)); + + // CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!retval) return NULL; + if(CCDigestInit(alg, retval)) { + CC_XFREE(retval, sizeof(CCDigestCtx_t)); + return NULL; + } + return retval; +} + + +uint8_t * +CCDigestOID(CCDigestRef ctx) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CCDigestCtxPtr p = (CCDigestCtxPtr) ctx; + return p->di->oid; +} + +size_t +CCDigestOIDLen(CCDigestRef ctx) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CCDigestCtxPtr p = (CCDigestCtxPtr) ctx; + return p->di->oid_size; } CCDigestRef -CCDigestCreate(CCDigestAlg algorithm) -{ - CCDigestRef ctx; - - if(!(ctx = (CCDigestCtx *) malloc(CC_DIGEST_SIZE))) { - return NULL; - } - if(CCDigestInit(algorithm, ctx) != 0) { - free(ctx); - return NULL; - } - return ctx; -} - -void -CCDigestDestroy(CCDigestRef ctx) -{ - bzero(ctx, sizeof(CCDigestCtx)); - free(ctx); +CCDigestCreateByOID(uint8_t *OID, size_t OIDlen) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + for(int i=kCCDigestMD2; ioid_size) && (CC_XMEMCMP(OID, di->oid, OIDlen) == 0)) + return CCDigestCreate(i); + } + return NULL; } void CCDigestReset(CCDigestRef ctx) { - CCDigestCtxPtr ptr = (CCDigestCtxPtr) ctx; - hash_descriptor[ptr->hashIndex].init(&ptr->md); + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CCDigestCtxPtr p = (CCDigestCtxPtr) ctx; + if(p->di) ccdigest_init(p->di, (struct ccdigest_ctx *) p->md); +} + + +void +CCDigestDestroy(CCDigestRef ctx) +{ + // CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(ctx) { + CC_XZEROMEM(ctx, sizeof(CCDigestCtx_t)); + CC_XFREE(ctx, sizeof(CCDigestCtx_t)); + } +} +/* + * Legacy CommonDigest API shims. + */ + +#define CC_COMPAT_DIGEST_RETURN 1 + +#define DIGEST_SHIMS(_name_,_constant_) \ +\ +static size_t CC_##_name_##_Len = 0; \ +static size_t CC_##_name_##_Ctr = 0; \ +\ +int CC_##_name_##_Init(CC_##_name_##_CTX *c) { \ + struct ccdigest_info *di = CCDigestGetDigestInfo(_constant_); \ + ASSERT(sizeof(CC_##_name_##_CTX) <= ccdigest_di_size(di)); \ + ccdigest_init(CCDigestGetDigestInfo(_constant_), (struct ccdigest_ctx *) c); \ + return 1; \ +} \ + \ +int \ +CC_##_name_##_Update(CC_##_name_##_CTX *c, const void *data, CC_LONG len) \ +{ \ + CC_##_name_##_Len += len; \ + ccdigest_update(CCDigestGetDigestInfo(_constant_), (struct ccdigest_ctx *) c, len, data); \ + return 1; \ +} \ + \ +int \ +CC_##_name_##_Final(unsigned char *md, CC_##_name_##_CTX *c) \ +{ \ + if(((++CC_##_name_##_Ctr) % 50) == 0) CC_DEBUG_LOG(ASL_LEVEL_ERR, "Len = %lu\n", CC_##_name_##_Len); \ + ccdigest_final(CCDigestGetDigestInfo(_constant_), (struct ccdigest_ctx *) c, md); \ + return 1; \ +} \ + \ +unsigned char * \ +CC_##_name_ (const void *data, CC_LONG len, unsigned char *md) \ +{ \ + (void) CCDigest(_constant_, data, len, md); \ + return md; \ +} + + +#define DIGEST_FINAL_SHIMS(_name_,_constant_) \ +unsigned char * \ +CC_##_name_ (const void *data, CC_LONG len, unsigned char *md) \ +{ \ +(void) CCDigest(_constant_, data, len, md); \ +return md; \ +} + + + +DIGEST_FINAL_SHIMS(MD2, kCCDigestMD2) +DIGEST_SHIMS(MD4, kCCDigestMD4) +DIGEST_SHIMS(MD5, kCCDigestMD5) +DIGEST_SHIMS(SHA1, kCCDigestSHA1) +DIGEST_FINAL_SHIMS(SHA224, kCCDigestSHA224) +DIGEST_FINAL_SHIMS(SHA256, kCCDigestSHA256) +DIGEST_FINAL_SHIMS(SHA384, kCCDigestSHA384) +DIGEST_FINAL_SHIMS(SHA512, kCCDigestSHA512) + + +#define MD5_CTX CC_MD5_CTX +void MD5Final(unsigned char md[16], MD5_CTX *c) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + (void) CC_MD5_Final(md, c); +} + +static void +ccdigest_process(struct ccdigest_info *di, uint8_t *bufptr, ccdigest_state_t state, + uint64_t curlen, size_t len, uint8_t *data) +{ + while(len) { + if (curlen == 0 && len >= di->block_size) { + uint64_t fullblocks = len / di->block_size; + di->compress(state, fullblocks, data); + uint64_t nbytes = fullblocks * di->block_size; + len -= nbytes; data += nbytes; + } else { + uint64_t n = CC_XMIN(len, (di->block_size - curlen)); + CC_XMEMCPY(bufptr + curlen, data, n); + curlen += n; len -= n; data += n; + if (curlen == di->block_size) { + di->compress(state, 1, bufptr); + curlen = 0; + } + } + } +} + +static void +ccdigest_finalize(struct ccdigest_info *di, uint8_t *bufptr, ccdigest_state_t state, + uint64_t curlen, uint64_t totalLen) +{ + bufptr[curlen++] = (unsigned char)0x80; + int reserve = 8; + if(di->block_size == 128) reserve = 16; // SHA384/512 reserves 16 bytes below. + + /* if the length is currently above block_size - reserve bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + + if (curlen > (di->block_size - reserve)) { + while (curlen < di->block_size) bufptr[curlen++] = (unsigned char)0; + di->compress(state, 1, bufptr); + curlen = 0; + } + + /* pad out with zeros, but store length in last 8 bytes (sizeof uint64_t) */ + while (curlen < (di->block_size - 8)) bufptr[curlen++] = (unsigned char)0; + totalLen *= 8; // size in bits + CC_XSTORE64H(totalLen, bufptr+(di->block_size - 8)); + di->compress(state, 1, bufptr); +} + +/* + #define CC_MD2_DIGEST_LENGTH 16 + #define CC_MD2_BLOCK_BYTES 64 + #define CC_MD2_BLOCK_LONG (CC_MD2_BLOCK_BYTES / sizeof(CC_LONG)) + + + typedef struct CC_MD2state_st + { + int num; + unsigned char data[CC_MD2_DIGEST_LENGTH]; + CC_LONG cksm[CC_MD2_BLOCK_LONG]; + CC_LONG state[CC_MD2_BLOCK_LONG]; + } CC_MD2_CTX; + */ + +static inline void md2in(struct ccdigest_info *di, ccdigest_ctx_t ctx, CC_MD2_CTX *c) +{ + CC_XMEMCPY(ccdigest_state_u8(di, ctx)+48, c->cksm, CC_MD2_BLOCK_LONG); + CC_XMEMCPY(ccdigest_state_u8(di, ctx), c->state, CC_MD2_BLOCK_LONG); + CC_XMEMCPY(ccdigest_data(di, ctx), c->data, CC_MD2_DIGEST_LENGTH); + ccdigest_num(di, ctx) = c->num; +} + +static inline void md2out(struct ccdigest_info *di, CC_MD2_CTX *c, ccdigest_ctx_t ctx) +{ + CC_XMEMCPY(c->cksm, ccdigest_state_u8(di, ctx)+48, CC_MD2_BLOCK_LONG); + CC_XMEMCPY(c->state, ccdigest_state_u8(di, ctx), CC_MD2_BLOCK_LONG); + CC_XMEMCPY(c->data, ccdigest_data(di, ctx), CC_MD2_DIGEST_LENGTH); + c->num = (int) ccdigest_num(di, ctx); +} + +int CC_MD2_Init(CC_MD2_CTX *c) +{ + struct ccdigest_info *di = CCDigestGetDigestInfo(kCCDigestMD2); + ccdigest_di_decl(di, ctx); + ccdigest_init(di, ctx); + md2out(di, c, ctx); + return CC_COMPAT_DIGEST_RETURN; +} + +int CC_MD2_Update(CC_MD2_CTX *c, const void *data, CC_LONG len) +{ + struct ccdigest_info *di = CCDigestGetDigestInfo(kCCDigestMD2); + ccdigest_di_decl(di, ctx); + md2in(di, ctx, c); + ccdigest_update(di, ctx, len, data); + md2out(di, c, ctx); + return CC_COMPAT_DIGEST_RETURN; +} + +extern int CC_MD2_Final(unsigned char *md, CC_MD2_CTX *c) +{ + struct ccdigest_info *di = CCDigestGetDigestInfo(kCCDigestMD2); + ccdigest_di_decl(di, ctx); + md2in(di, ctx, c); + ccdigest_final(di, ctx, md); + md2out(di, c, ctx); + return CC_COMPAT_DIGEST_RETURN; +} + + + + + +/* + typedef struct CC_SHA256state_st + { + CC_LONG count[2]; + CC_LONG hash[8]; + CC_LONG wbuf[16]; + } CC_SHA256_CTX; + + */ + +typedef struct CC_SHA256state_x +{ + uint64_t count; + uint32_t hash[8]; + uint32_t wbuf[16]; +} CC_SHA256_CTX_X; + + + +int +CC_SHA256_Init(CC_SHA256_CTX *x) +{ + CC_SHA256_CTX_X *c = (CC_SHA256_CTX_X *) x; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ASSERT(sizeof(CC_SHA256_CTX) == sizeof(CC_SHA256_CTX_X)); + struct ccdigest_info *di = CCDigestGetDigestInfo(kCCDigestSHA256); + ASSERT(di->state_size == CC_SHA256_DIGEST_LENGTH); + CC_XZEROMEM(c->hash, CC_SHA256_DIGEST_LENGTH); + ASSERT(di->block_size == CC_SHA256_BLOCK_BYTES); + CC_XZEROMEM(c->wbuf, CC_SHA256_BLOCK_BYTES); + c->count = 0; + CC_XMEMCPY(c->hash, di->initial_state, di->state_size); + return CC_COMPAT_DIGEST_RETURN; +} + +int +CC_SHA256_Update(CC_SHA256_CTX *x, const void *data, CC_LONG len) +{ + struct ccdigest_info *di = CCDigestGetDigestInfo(kCCDigestSHA256); + CC_SHA256_CTX_X *c = (CC_SHA256_CTX_X *) x; + uint64_t totalLen = c->count; + uint64_t curlen = totalLen % di->block_size; + uint8_t *bufptr = (uint8_t *) c->wbuf; + struct ccdigest_state *state = c->hash; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!len || !data) return CC_COMPAT_DIGEST_RETURN; + c->count += len; + + ccdigest_process(di, bufptr, state, curlen, len, data); + + return CC_COMPAT_DIGEST_RETURN; +} + +int +CC_SHA256_Final(unsigned char *md, CC_SHA256_CTX *x) +{ + struct ccdigest_info *di = CCDigestGetDigestInfo(kCCDigestSHA256); + CC_SHA256_CTX_X *c = (CC_SHA256_CTX_X *) x; + uint64_t totalLen = c->count; + uint64_t curlen = totalLen % di->block_size; + uint8_t *bufptr = (uint8_t *) c->wbuf; + struct ccdigest_state *state = c->hash; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!md) return CC_COMPAT_DIGEST_RETURN; + + ccdigest_finalize(di, bufptr, state, curlen, totalLen); + + /* copy output */ + for (int i = 0; i < 8; i++) CC_XSTORE32H(c->hash[i], md+(4*i)); + + return CC_COMPAT_DIGEST_RETURN; +} + + +/* +typedef struct CC_SHA512state_st +{ CC_LONG64 count[2]; + CC_LONG64 hash[8]; + CC_LONG64 wbuf[16]; +} CC_SHA512_CTX; +*/ + +typedef struct CC_SHA512state_x +{ + uint64_t count; + uint64_t countx; + uint64_t hash[8]; + uint64_t wbuf[16]; +} CC_SHA512_CTX_X; + + +int +CC_SHA512_Init(CC_SHA512_CTX *x) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + struct ccdigest_info *di = CCDigestGetDigestInfo(kCCDigestSHA512); + CC_SHA512_CTX_X *c = (CC_SHA512_CTX_X *) x; + ASSERT(di->state_size == CC_SHA512_DIGEST_LENGTH); + CC_XZEROMEM(c->hash, CC_SHA512_DIGEST_LENGTH); + ASSERT(di->block_size == CC_SHA512_BLOCK_BYTES); + CC_XZEROMEM(c->wbuf, CC_SHA512_BLOCK_BYTES); + c->count = 0; + CC_XMEMCPY(c->hash, di->initial_state, di->state_size); + return CC_COMPAT_DIGEST_RETURN; +} + +int +CC_SHA512_Update(CC_SHA512_CTX *x, const void *data, CC_LONG len) +{ + struct ccdigest_info *di = CCDigestGetDigestInfo(kCCDigestSHA512); + CC_SHA512_CTX_X *c = (CC_SHA512_CTX_X *) x; + uint64_t totalLen = c->count; + uint64_t curlen = totalLen % di->block_size; + uint8_t *bufptr = (uint8_t *) c->wbuf; + struct ccdigest_state *state = c->hash; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + + if(!len || !data) return CC_COMPAT_DIGEST_RETURN; + + c->count += len; + ccdigest_process(di, bufptr, state, curlen, len, data); + return CC_COMPAT_DIGEST_RETURN; +} + +int +CC_SHA512_Final(unsigned char *md, CC_SHA512_CTX *x) +{ + struct ccdigest_info *di = CCDigestGetDigestInfo(kCCDigestSHA512); + CC_SHA512_CTX_X *c = (CC_SHA512_CTX_X *) x; + uint64_t totalLen = c->count; + uint64_t curlen = totalLen % di->block_size; + uint8_t *bufptr = (uint8_t *) c->wbuf; + struct ccdigest_state *state = c->hash; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!md) return CC_COMPAT_DIGEST_RETURN; + + ccdigest_finalize(di, bufptr, state, curlen, totalLen); + + /* copy output */ + for (int i = 0; i < di->output_size/8; i++) CC_XSTORE64H(c->hash[i], md+(8*i)); + + return CC_COMPAT_DIGEST_RETURN; +} + +/* + * Dependent sets of routines (SHA224 and SHA384) + */ + +int +CC_SHA224_Init(CC_SHA256_CTX *c) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + struct ccdigest_info *di = CCDigestGetDigestInfo(kCCDigestSHA224); + ASSERT(di->state_size == CC_SHA256_DIGEST_LENGTH); + CC_XZEROMEM(c->hash, CC_SHA256_DIGEST_LENGTH); + ASSERT(di->block_size == CC_SHA256_BLOCK_BYTES); + CC_XZEROMEM(c->wbuf, CC_SHA256_BLOCK_BYTES); + c->count[0] = c->count[1] = 0; + CC_XMEMCPY(c->hash, di->initial_state, di->state_size); + return CC_COMPAT_DIGEST_RETURN; +} + +int +CC_SHA224_Update(CC_SHA256_CTX *c, const void *data, CC_LONG len) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return CC_SHA256_Update(c, data, len); +} + +int +CC_SHA224_Final(unsigned char *md, CC_SHA256_CTX *c) +{ + uint32_t buf[CC_SHA256_DIGEST_LENGTH/4]; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + + CC_SHA256_Final(buf, c); + CC_XMEMCPY(md, buf, CC_SHA224_DIGEST_LENGTH); + return CC_COMPAT_DIGEST_RETURN; +} + + +int +CC_SHA384_Init(CC_SHA512_CTX *c) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + struct ccdigest_info *di = CCDigestGetDigestInfo(kCCDigestSHA384); + ASSERT(di->state_size == CC_SHA512_DIGEST_LENGTH); + CC_XZEROMEM(c->hash, CC_SHA512_DIGEST_LENGTH); + ASSERT(di->block_size == CC_SHA512_BLOCK_BYTES); + CC_XZEROMEM(c->wbuf, CC_SHA512_BLOCK_BYTES); + c->count[0] = c->count[1] = 0; + CC_XMEMCPY(c->hash, di->initial_state, di->state_size); + return CC_COMPAT_DIGEST_RETURN; +} + + +int +CC_SHA384_Update(CC_SHA512_CTX *c, const void *data, CC_LONG len) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return CC_SHA512_Update(c, data, len); } int -CCDigestInterrimResult(CCDigestRef ctx, uint8_t *output) -{ - CCDigestCtx tmp; - - memcpy(&tmp, ctx, CC_DIGEST_SIZE); - return CCDigestFinal(&tmp, output); -} - -size_t -CCDigestBlockSize(CCDigestRef ctx) -{ - size_t retval = 0; - CCDigestCtxPtr ptr = (CCDigestCtxPtr) ctx; - if(ptr) retval = hash_descriptor[ptr->hashIndex].blocksize; - return retval; -} - -size_t -CCDigestOutputSize(CCDigestRef ctx) -{ - size_t retval = 0; - CCDigestCtxPtr ptr = (CCDigestCtxPtr) ctx; - if(ptr) retval = hash_descriptor[ptr->hashIndex].hashsize; - return retval; +CC_SHA384_Final(unsigned char *md, CC_SHA512_CTX *c) +{ + uint64_t buf[CC_SHA512_DIGEST_LENGTH/8]; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + CC_SHA512_Final(buf, c); + CC_XMEMCPY(md, buf, CC_SHA384_DIGEST_LENGTH); + return CC_COMPAT_DIGEST_RETURN; } Index: Source/API/CommonDigestPriv.h ================================================================== --- Source/API/CommonDigestPriv.h +++ Source/API/CommonDigestPriv.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2004-2010 Apple, Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License @@ -26,65 +26,21 @@ */ #ifndef _COMMON_DIGEST_PRIV_H_ #define _COMMON_DIGEST_PRIV_H_ -#include -#include -#include "tomcrypt.h" - -/* MD2 */ - -#define MD2_DIGEST_LENGTH CC_MD2_DIGEST_LENGTH -#define MD2_BLOCK CC_MD2_BLOCK_LONG -typedef CC_MD2_CTX MD2_CTX; -typedef CC_LONG MD2_INT; - -/* MD4 */ - -#define MD4_DIGEST_LENGTH CC_MD4_DIGEST_LENGTH -#define MD4_CBLOCK CC_MD4_BLOCK_BYTES -#define MD4_LBLOCK (MD4_CBLOCK/4) -#define MD4_LONG_LOG2 3 -typedef CC_MD4_CTX MD4_CTX; -typedef CC_LONG MD4_LONG; - -/* MD5 */ - -#define MD5_DIGEST_LENGTH CC_MD5_DIGEST_LENGTH -#define MD5_CBLOCK CC_MD5_BLOCK_BYTES -#define MD5_LBLOCK (MD5_CBLOCK/4) -typedef CC_MD5_CTX MD5_CTX; -typedef CC_LONG MD5_LONG; - -/* SHA1 */ - -#define SHA_DIGEST_LENGTH CC_SHA1_DIGEST_LENGTH -#define SHA_CBLOCK CC_SHA1_BLOCK_BYTES -#define SHA_LBLOCK CC_SHA1_BLOCK_LONG -#define SHA_LONG_LOG2 2 -#define SHA_LAST_BLOCK (SHA_CBLOCK-8) -typedef CC_SHA1_CTX SHA_CTX; -typedef CC_LONG SHA_LONG; - -/* - * Macro to make an algorithm-specific one shot. - */ -#define CC_DIGEST_ONE_SHOT(fcnName, ctxName, initFcn, updateFcn, finalFcn) \ -unsigned char * fcnName (const void *data, CC_LONG len, unsigned char *md) \ -{ \ - ctxName ctx; \ - if(md == NULL) { \ - return NULL; \ - } \ - initFcn(&ctx); \ - updateFcn(&ctx, data, len); \ - finalFcn(md, &ctx); \ - return md; \ -} - -typedef struct ccDigest_s { - hash_state md; - int hashIndex; -} CCDigestCtx_t, *CCDigestCtxPtr; +#include +#include + +// This has to fit in 1032 bytes for static context clients - until we move them. +typedef struct ccDigest_s { + struct ccdigest_info *di; + uint8_t md[512]; +} CCDigestCtx_t, *CCDigestCtxPtr; + + +// This should remain internal only. This bridges the CommonCrypto->corecrypto structures + +struct ccdigest_info * +CCDigestGetDigestInfo(CCDigestAlgorithm algorithm); #endif /* _COMMON_DIGEST_PRIV_H_ */ ADDED Source/API/CommonECCryptor.c Index: Source/API/CommonECCryptor.c ================================================================== --- /dev/null +++ Source/API/CommonECCryptor.c @@ -0,0 +1,462 @@ +/* + * Copyright (c) 2012 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +// #define COMMON_EC_FUNCTIONS +#include "CommonECCryptor.h" +#include "CommonDigest.h" +#include "CommonDigestPriv.h" +#include "CommonRandomSPI.h" +#include "ccMemory.h" +#import +#include +#include "ccdebug.h" + + +#pragma mark Internal Structures and Functions + +typedef struct _CCECCryptor { + union { + ccec_full_ctx *private; + ccec_pub_ctx *public; + uint8_t *bytes; + } ecKey; + size_t keySize; + CCECKeyType keyType; +} CCECCryptor; + + +static CCECCryptor * +ccMallocECCryptor(size_t nbits, CCECKeyType keyType) +{ + CCECCryptor *retval; + size_t ctxSize = 0; + + + if(!ccec_keysize_is_supported(nbits)) return kCCParamError; + ccec_const_cp_t cp = ccec_get_cp(nbits); + size_t len = ccec_cp_prime_size(cp); + + if((retval = CC_XMALLOC(sizeof(CCECCryptor))) == NULL) return NULL; + + retval->keySize = nbits; + retval->ecKey.bytes = NULL; + + switch(keyType) { + case ccECKeyPublic: + retval->keyType = ccECBlankPublicKey; + ctxSize = ccec_pub_ctx_size(len); + break; + case ccECKeyPrivate: + retval->keyType = ccECBlankPrivateKey; + ctxSize = ccec_full_ctx_size(len); + break; + default: + retval = kCCParamError; + goto errOut; + } + + if((retval->ecKey.bytes = CC_XMALLOC(ctxSize)) == NULL) goto errOut; + ccec_ctx_init(cp, retval->ecKey.public); + + return retval; +errOut: + if(retval) { + CC_XFREE(retval, sizeof(CCECCryptor)); + } + return retval; +} + +static void +ccECCryptorClear(CCECCryptor *theKey) +{ + size_t nbits = theKey->keySize; + size_t ctxSize = 0; + + if(!ccec_keysize_is_supported(nbits)) return ; //kCCParamError; + ccec_const_cp_t cp = ccec_get_cp(nbits); + size_t len = ccec_cp_prime_size(cp); + + CCECCryptor *key = (CCECCryptor *) theKey; + if(!key) return; + + switch(key->keyType) { + case ccECKeyPublic: + case ccECBlankPublicKey: + ctxSize = ccec_pub_ctx_size(len); + break; + case ccECKeyPrivate: + case ccECBlankPrivateKey: + ctxSize = ccec_full_ctx_size(len); + break; + default: + break; + } + + if(ctxSize && key->ecKey.bytes) { + CC_XZEROMEM(key->ecKey.bytes, ctxSize); + CC_XFREE(key->ecKey.bytes, ctxSize); + } + +errOut: + CC_XZEROMEM(key, sizeof(CCECCryptor)); + CC_XFREE(key, sizeof(CCECCryptor)); +} + +static bool +ccECpairwiseConsistencyCheck(CCECCryptorRef privateKey, CCECCryptorRef publicKey) +{ + CCCryptorStatus status = kCCSuccess; + uint8_t digestBuffer[CC_SHA1_DIGEST_LENGTH]; + size_t signedDataLen = 4096; + uint8_t signedData[4096]; + uint32_t isValid = 0; + + CC_XMEMSET(digestBuffer, 0x0a, CC_SHA1_DIGEST_LENGTH); + + status = CCECCryptorSignHash(privateKey, + digestBuffer, CC_SHA1_DIGEST_LENGTH, + signedData, &signedDataLen); + + if (kCCSuccess != status) return false; + + status = CCECCryptorVerifyHash(publicKey, + digestBuffer, CC_SHA1_DIGEST_LENGTH, + signedData, signedDataLen, &isValid); + + if (kCCSuccess != status || isValid != 1) return false; + return true; +} + + +#pragma mark API (SPI for now) + + +CCCryptorStatus +CCECCryptorGeneratePair(size_t nbits, CCECCryptorRef *publicKey, CCECCryptorRef *privateKey) +{ + CCCryptorStatus retval; + CCECCryptor *privateCryptor = NULL; + CCECCryptor *publicCryptor = NULL; + struct ccrng_state *theRng = ccDRBGGetRngState(); + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!ccec_keysize_is_supported(nbits)) return kCCParamError; + ccec_const_cp_t cp = ccec_get_cp(nbits); + cc_size n = ccec_cp_n(cp); + __Require_Action((privateCryptor = ccMallocECCryptor(nbits, ccECKeyPrivate)) != NULL, errOut, retval = kCCMemoryFailure); + privateCryptor->keySize = nbits; + + __Require_Action((ccec_generate_key(cp, theRng, privateCryptor->ecKey.private) == 0), errOut, retval = kCCDecodeError); + + privateCryptor->keyType = ccECKeyPrivate; + + __Require_Action((publicCryptor = CCECCryptorGetPublicKeyFromPrivateKey(privateCryptor)) != NULL, errOut, retval = kCCMemoryFailure); + + __Require_Action(ccECpairwiseConsistencyCheck(privateCryptor, publicCryptor) == true, errOut, retval = kCCDecodeError); + + *publicKey = publicCryptor; + *privateKey = privateCryptor; + + return kCCSuccess; + +errOut: + if(privateCryptor) ccECCryptorClear(privateCryptor); + if(publicCryptor) ccECCryptorClear(publicCryptor); + *publicKey = *privateKey = NULL; + return kCCDecodeError; + +} + +CCECCryptorRef +CCECCryptorGetPublicKeyFromPrivateKey(CCECCryptorRef privateKey) +{ + CCECCryptor *publicCryptor = NULL; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + __Require((publicCryptor = ccMallocECCryptor(privateKey->keySize, ccECKeyPublic)) != NULL, errOut); + if(!ccec_keysize_is_supported(privateKey->keySize)) return kCCParamError; + ccec_const_cp_t cp = ccec_get_cp(privateKey->keySize); + size_t ctx_size = ccec_pub_ctx_size(ccec_cp_prime_size(cp)); + CC_XMEMCPY(publicCryptor->ecKey.public, privateKey->ecKey.public, ctx_size); + publicCryptor->keySize = privateKey->keySize; + publicCryptor->keyType = ccECKeyPublic; + + if(ccECpairwiseConsistencyCheck(privateKey, publicCryptor) == false) goto errOut; + return publicCryptor; + +errOut: + if(publicCryptor) ccECCryptorClear(publicCryptor); + return NULL; + +} + + +CCCryptorStatus +CCECCryptorGetKeyComponents(CCECCryptorRef ecKey, size_t *keySize, + uint8_t *qX, size_t *qXLength, + uint8_t *qY, size_t *qYLength, + uint8_t *d, size_t *dLength) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + switch(ecKey->keyType) { + case ccECKeyPublic: + if(ccec_get_pubkey_components(ecKey->ecKey.public, keySize, + qX, qXLength, + qY, qYLength)) return kCCMemoryFailure; + break; + case ccECKeyPrivate: + if(ccec_get_fullkey_components(ecKey->ecKey.private, keySize, + qX, qXLength, + qY, qYLength, + d, dLength)) return kCCMemoryFailure; + break; + default: return kCCParamError; + } + return kCCSuccess; +} + +CCCryptorStatus +CCECCryptorCreateFromData(size_t nbits, + uint8_t *qX, size_t qXLength, + uint8_t *qY, size_t qYLength, + CCECCryptorRef *ref) +{ + CCECCryptor *publicCryptor; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + *ref = NULL; + if((publicCryptor = ccMallocECCryptor(nbits, ccECKeyPublic)) == NULL) return kCCMemoryFailure; + if(ccec_make_pub(nbits, qXLength, qX, qYLength, qY, publicCryptor->ecKey.public)) { + ccECCryptorClear(publicCryptor); + return kCCDecodeError; + } + publicCryptor->keyType = ccECKeyPublic; + + *ref = publicCryptor; + return kCCSuccess; +} + +CCECKeyType CCECGetKeyType(CCECCryptorRef key) +{ + CCECCryptor *cryptor = key; + CCECKeyType retval; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(key == NULL) return ccECBlankPublicKey; + retval = cryptor->keyType; + if(retval != ccECKeyPublic && retval != ccECKeyPrivate) return ccECBadKey; + return retval; +} + +int CCECGetKeySize(CCECCryptorRef key) +{ + CCECCryptor *cryptor = key; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(key == NULL) return kCCParamError; + return key->keySize; +} + +void +CCECCryptorRelease(CCECCryptorRef key) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccECCryptorClear(key); +} + +CCCryptorStatus CCECCryptorImportPublicKey(void *keyPackage, size_t keyPackageLen, CCECCryptorRef *key) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return CCECCryptorImportKey(kCCImportKeyBinary, keyPackage, keyPackageLen, ccECKeyPublic, key); +} + + +CCCryptorStatus CCECCryptorImportKey(CCECKeyExternalFormat format, void *keyPackage, size_t keyPackageLen, CCECKeyType keyType, CCECCryptorRef *key) +{ + CCECCryptor *cryptor = NULL; + CCCryptorStatus retval = kCCSuccess; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(keyPackage == NULL) return kCCParamError; + + switch(format) { + case kCCImportKeyBinary: + if(keyType == ccECKeyPrivate) { + size_t nbits = ccec_x963_import_priv_size(keyPackageLen); + if((cryptor = ccMallocECCryptor(nbits, ccECKeyPrivate)) == NULL) return kCCMemoryFailure; + ccec_const_cp_t cp = ccec_get_cp(nbits); + __Require_Action(ccec_x963_import_priv(cp, keyPackageLen, keyPackage, cryptor->ecKey.private) == 0, errOut, retval = kCCDecodeError); + cryptor->keySize = nbits; + } else if(keyType == ccECKeyPublic) { + size_t nbits = ccec_x963_import_pub_size(keyPackageLen); + if((cryptor = ccMallocECCryptor(nbits, ccECKeyPublic)) == NULL) return kCCMemoryFailure; + ccec_const_cp_t cp = ccec_get_cp(nbits); + __Require_Action(ccec_x963_import_pub(cp, keyPackageLen, keyPackage, cryptor->ecKey.public) == 0, errOut, retval = kCCDecodeError); + cryptor->keySize = nbits; + } else return kCCParamError; + + cryptor->keyType = keyType; + *key = cryptor; + break; + case kCCImportKeyDER: + retval = kCCUnimplemented; + break; + default: + retval = kCCParamError; + break; + } + + +errOut: + if(retval) { + *key = NULL; + if(cryptor) ccECCryptorClear(cryptor); + } + + return retval; +} + + +CCCryptorStatus CCECCryptorExportPublicKey(CCECCryptorRef key, void *out, size_t *outLen) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(key == NULL) return kCCParamError; + if(out == NULL) return kCCParamError; + + return CCECCryptorExportKey(kCCImportKeyBinary, out, outLen, ccECKeyPublic, key); +} + +CCCryptorStatus CCECCryptorExportKey(CCECKeyExternalFormat format, void *keyPackage, size_t *keyPackageLen, CCECKeyType keyType, CCECCryptorRef key) +{ + CCCryptorStatus retval = kCCSuccess; + unsigned long len = *keyPackageLen; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(key == NULL) return kCCParamError; + if(keyPackage == NULL) return kCCParamError; + + switch(format) { + case kCCImportKeyBinary: { + CCECCryptorRef tmpkey; + size_t len = ccec_x963_export_size(keyType == ccECKeyPrivate, key->ecKey.private); + + if(len > *keyPackageLen) { + *keyPackageLen = len; + return kCCMemoryFailure; + } + *keyPackageLen = len; + + ccec_x963_export(keyType == ccECKeyPrivate, keyPackage, key->ecKey.private); + break; + } + case kCCImportKeyDER: + retval = kCCUnimplemented; + break; + default: + retval = kCCParamError; + break; + } + + return retval; +} + + + +CCCryptorStatus +CCECCryptorSignHash(CCECCryptorRef privateKey, + const void *hashToSign, size_t hashSignLen, + void *signedData, size_t *signedDataLen) +{ + CCCryptorStatus retval = kCCSuccess; + CCECCryptor *privateCryptor = privateKey; + + // CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(privateKey == NULL || hashToSign == NULL || signedData == NULL || signedDataLen == NULL) return kCCParamError; + + struct ccrng_state *therng = ccDRBGGetRngState(); + + if(ccec_sign(privateKey->ecKey.private, hashSignLen, hashToSign, signedDataLen, signedData, therng) != 0) + retval = kCCDecodeError; + return retval; +} + + + +CCCryptorStatus +CCECCryptorVerifyHash(CCECCryptorRef publicKey, + const void *hash, size_t hashLen, + const void *signedData, size_t signedDataLen, uint32_t *valid) +{ + CCCryptorStatus retval = kCCSuccess; + bool stat = 0; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(publicKey == NULL || hash == NULL || signedData == NULL) return kCCParamError; + + if(ccec_verify(publicKey->ecKey.public, hashLen, hash, + signedDataLen, signedData, &stat)) retval = kCCDecodeError; + *valid = stat; + return retval; +} + + +#pragma mark API for ECDH - needs corecrypto key import / export capability (SPI for now) + + +CCCryptorStatus +CCECCryptorWrapKey(CCECCryptorRef publicKey, + const void *plainText, size_t plainTextLen, + void *cipherText, size_t *cipherTextLen, + CCDigestAlg digestType) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return kCCUnimplemented; +} + + +CCCryptorStatus +CCECCryptorUnwrapKey(CCECCryptorRef privateKey, + const void *cipherText, size_t cipherTextLen, + void *plainText, size_t *plainTextLen) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return kCCUnimplemented; +} + + +CCCryptorStatus +CCECCryptorComputeSharedSecret(CCECCryptorRef privateKey, CCECCryptorRef publicKey, + void *out, size_t *outLen) +{ + CCCryptorStatus retval = kCCSuccess; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(privateKey == NULL || publicKey == NULL) return kCCParamError; + if(out == NULL) return kCCParamError; + + if(ccec_compute_key(privateKey->ecKey.private, publicKey->ecKey.public, + outLen, out)) return kCCDecodeError; + + return retval; +} + + ADDED Source/API/CommonGCMCryptor.c Index: Source/API/CommonGCMCryptor.c ================================================================== --- /dev/null +++ Source/API/CommonGCMCryptor.c @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2012 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +// #define COMMON_GCM_FUNCTIONS +#include "ccMemory.h" +#include "ccdebug.h" +#include "CommonCryptor.h" +#include "CommonCryptorSPI.h" +#include "CommonCryptorPriv.h" +#include + + +CCCryptorStatus +CCCryptorGCMAddIV(CCCryptorRef cryptorRef, + const void *iv, + size_t ivLen) +{ + CCCompatCryptor *compat_cryptor = cryptorRef; + CCCryptor *cryptor; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(compat_cryptor == NULL) return kCCParamError; + cryptor = compat_cryptor->cryptor; + ccmode_gcm_set_iv(cryptor->ctx[cryptor->op].gcm, ivLen, iv); + return kCCSuccess; +} + + +CCCryptorStatus +CCCryptorGCMAddAAD(CCCryptorRef cryptorRef, + const void *aData, + size_t aDataLen) +{ + CCCompatCryptor *compat_cryptor = cryptorRef; + CCCryptor *cryptor; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(compat_cryptor == NULL) return kCCParamError; + cryptor = compat_cryptor->cryptor; + + ccmode_gcm_gmac(cryptor->ctx[cryptor->op].gcm, aDataLen, aData); + return kCCSuccess; +} + +// This is for old iOS5 clients +CCCryptorStatus +CCCryptorGCMAddADD(CCCryptorRef cryptorRef, + const void *aData, + size_t aDataLen) +{ + return CCCryptorGCMAddAAD(cryptorRef, aData, aDataLen); +} + +// This was a temp mistake in MacOSX8 +CCCryptorStatus +CCCryptorGCMaddAAD(CCCryptorRef cryptorRef, + const void *aData, + size_t aDataLen) +{ + return CCCryptorGCMAddAAD(cryptorRef, aData, aDataLen); +} + + + +CCCryptorStatus CCCryptorGCMEncrypt( + CCCryptorRef cryptorRef, + const void *dataIn, + size_t dataInLength, + void *dataOut) +{ + CCCompatCryptor *compat_cryptor = cryptorRef; + CCCryptor *cryptor; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(compat_cryptor == NULL) return kCCParamError; + cryptor = compat_cryptor->cryptor; + if(dataIn == NULL || dataOut == NULL) return kCCParamError; + + ccmode_gcm_encrypt(cryptor->ctx[cryptor->op].gcm, dataInLength, dataIn, dataOut); + return kCCSuccess; +} + + + +CCCryptorStatus CCCryptorGCMDecrypt( + CCCryptorRef cryptorRef, + const void *dataIn, + size_t dataInLength, + void *dataOut) +{ + CCCompatCryptor *compat_cryptor = cryptorRef; + CCCryptor *cryptor; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(compat_cryptor == NULL) return kCCParamError; + cryptor = compat_cryptor->cryptor; + if(dataIn == NULL || dataOut == NULL) return kCCParamError; + + ccmode_gcm_decrypt(cryptor->ctx[cryptor->op].gcm, dataInLength, dataIn, dataOut); + return kCCSuccess; +} + + + +CCCryptorStatus CCCryptorGCMFinal( + CCCryptorRef cryptorRef, + const void *tag, + size_t *tagLength) +{ + CCCompatCryptor *compat_cryptor = cryptorRef; + CCCryptor *cryptor; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(compat_cryptor == NULL) return kCCParamError; + cryptor = compat_cryptor->cryptor; + if(tag == NULL || tagLength == NULL) return kCCParamError; + + ccmode_gcm_finalize(cryptor->ctx[cryptor->op].gcm, tagLength, tag); + return kCCSuccess; +} + + + +CCCryptorStatus CCCryptorGCMReset( + CCCryptorRef cryptorRef) +{ + CCCompatCryptor *compat_cryptor = cryptorRef; + CCCryptor *cryptor; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(compat_cryptor == NULL) return kCCParamError; + cryptor = compat_cryptor->cryptor; + ccmode_gcm_reset(cryptor->ctx[cryptor->op].gcm); + return kCCSuccess; +} + + + +CCCryptorStatus CCCryptorGCM( + CCOperation op, /* kCCEncrypt, kCCDecrypt */ + CCAlgorithm alg, + const void *key, /* raw key material */ + size_t keyLength, + const void *iv, + size_t ivLen, + const void *aData, + size_t aDataLen, + const void *dataIn, + size_t dataInLength, + void *dataOut, + const void *tag, + size_t *tagLength) +{ + CCCryptorRef cryptorRef; + CCCryptorStatus retval; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering Op: %d Cipher: %d\n", op, alg); + + retval = CCCryptorCreateWithMode(op, kCCModeGCM, alg, 0, NULL, key, keyLength, + NULL, 0, 0, 0, &cryptorRef); + if(retval) return retval; + + // IV is optional + if(ivLen) { + retval = CCCryptorGCMAddIV(cryptorRef, iv, ivLen); + if(retval) return retval; + } + + // This must always be called - even with no aData. + retval = CCCryptorGCMaddAAD(cryptorRef, aData, aDataLen); + if(retval) return retval; + + if(op == kCCEncrypt) + retval = CCCryptorGCMEncrypt(cryptorRef, dataIn, dataInLength, dataOut); + else if(op == kCCDecrypt) + retval = CCCryptorGCMDecrypt(cryptorRef, dataIn, dataInLength, dataOut); + else return kCCParamError; + if(retval) return retval; + + retval = CCCryptorGCMFinal(cryptorRef, tag, tagLength); + CCCryptorRelease(cryptorRef); + + return retval; +} + + Index: Source/API/CommonHMAC.c ================================================================== --- Source/API/CommonHMAC.c +++ Source/API/CommonHMAC.c @@ -1,7 +1,7 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. +/* + * Copyright (c) 2012 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License @@ -19,196 +19,198 @@ * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ -/* - * CommonHMAC.h - Keyed Message Authentication Code (HMAC) functions. - * - * Created 3/27/2006 by Doug Mitchell. - */ - -#include -#include -#include -#include +// #define COMMON_HMAC_FUNCTIONS +#include "CommonHMAC.h" +#include "CommonHmacSPI.h" +#include "CommonDigest.h" +#include "CommonDigestSPI.h" +#include "CommonDigestPriv.h" +#include +#include "ccMemory.h" +#include "ccdebug.h" #ifndef NDEBUG #define ASSERT(s) #else #define ASSERT(s) assert(s) #endif -/* - * Callouts for digest ops. - * The void *ctx pointers are needed to accommodate different underlying - * digest context types. - */ -typedef void (*ccDigestInit)(void *ctx); -typedef void (*ccDigestUpdate)(void *ctx, const void *data, CC_LONG len); -typedef void (*ccDigestFinal)(unsigned char *md, void *ctx); - -#define HMAC_MAX_BLOCK_SIZE CC_SHA512_BLOCK_BYTES -#define HMAC_MAX_DIGEST_SIZE CC_SHA512_DIGEST_LENGTH +#define HMAC_MAX_BLOCK_SIZE CC_SHA512_BLOCK_BYTES +#define HMAC_MAX_DIGEST_SIZE CC_SHA512_DIGEST_LENGTH /* * This is what a CCHmacContext actually points to. + * we have 384 bytes to work with */ + +typedef struct { + struct ccdigest_info *di; + cchmac_ctx_decl(HMAC_MAX_BLOCK_SIZE, HMAC_MAX_DIGEST_SIZE, ctx); +} _NewHmacContext; + + typedef struct { - uint32_t digestLen; - uint32_t blockLen; - union { - CC_MD5_CTX md5Ctx; - CC_SHA1_CTX sha1Ctx; - CC_SHA256_CTX sha256Ctx; - CC_SHA512_CTX sha512Ctx; - } digest; - uint8_t k_opad[HMAC_MAX_BLOCK_SIZE]; /* max block size */ - - ccDigestInit digestInit; - ccDigestUpdate digestUpdate; - ccDigestFinal digestFinal; -} _CCHmacContext; + CCHmacAlgorithm ccHmacValue; + CCDigestAlgorithm ccDigestAlg; + const char *ccDigestName; +} ccHmac2DigestConversion; + + +const ccHmac2DigestConversion ccconversionTable[] = { + { kCCHmacAlgSHA1, kCCDigestSHA1, "sha1" }, + { kCCHmacAlgMD5, kCCDigestMD5, "md5" }, + { kCCHmacAlgSHA224, kCCDigestSHA224, "sha224" }, + { kCCHmacAlgSHA256, kCCDigestSHA256, "sha256" }, + { kCCHmacAlgSHA384, kCCDigestSHA384, "sha384" }, + { kCCHmacAlgSHA512, kCCDigestSHA512, "sha512" }, +}; + +const static int ccHmacConversionTableLength = sizeof(ccconversionTable) / sizeof(ccHmac2DigestConversion); + +static struct ccdigest_info * +convertccHmacSelector(CCHmacAlgorithm oldSelector) +{ + int i; + + for(i=0; idigestCtx; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering Algorithm: %d\n", algorithm); + - /* if this fails, it's time to adjust CC_HMAC_CONTEXT_SIZE */ - ASSERT(sizeof(_CCHmacContext) < sizeof(CCHmacContext)); + ASSERT(sizeof(_NewHmacContext) < sizeof(CCHmacContext)); if(hmacCtx == NULL) { - return; - } - - memset(hmacCtx, 0, sizeof(*hmacCtx)); - - switch(algorithm) { - case kCCHmacAlgMD5: - hmacCtx->digestLen = CC_MD5_DIGEST_LENGTH; - hmacCtx->blockLen = CC_MD5_BLOCK_BYTES; - hmacCtx->digestInit = (void *)CC_MD5_Init; - hmacCtx->digestUpdate = (void *)CC_MD5_Update; - hmacCtx->digestFinal = (void *)CC_MD5_Final; - break; - case kCCHmacAlgSHA1: - hmacCtx->digestLen = CC_SHA1_DIGEST_LENGTH; - hmacCtx->blockLen = CC_SHA1_BLOCK_BYTES; - hmacCtx->digestInit = (void *)CC_SHA1_Init; - hmacCtx->digestUpdate = (void *)CC_SHA1_Update; - hmacCtx->digestFinal = (void *)CC_SHA1_Final; - break; - case kCCHmacAlgSHA224: - hmacCtx->digestLen = CC_SHA224_DIGEST_LENGTH; - hmacCtx->blockLen = CC_SHA224_BLOCK_BYTES; - hmacCtx->digestInit = (void *)CC_SHA224_Init; - hmacCtx->digestUpdate = (void *)CC_SHA224_Update; - hmacCtx->digestFinal = (void *)CC_SHA224_Final; - break; - case kCCHmacAlgSHA256: - hmacCtx->digestLen = CC_SHA256_DIGEST_LENGTH; - hmacCtx->blockLen = CC_SHA256_BLOCK_BYTES; - hmacCtx->digestInit = (void *)CC_SHA256_Init; - hmacCtx->digestUpdate = (void *)CC_SHA256_Update; - hmacCtx->digestFinal = (void *)CC_SHA256_Final; - break; - case kCCHmacAlgSHA384: - hmacCtx->digestLen = CC_SHA384_DIGEST_LENGTH; - hmacCtx->blockLen = CC_SHA384_BLOCK_BYTES; - hmacCtx->digestInit = (void *)CC_SHA384_Init; - hmacCtx->digestUpdate = (void *)CC_SHA384_Update; - hmacCtx->digestFinal = (void *)CC_SHA384_Final; - break; - case kCCHmacAlgSHA512: - hmacCtx->digestLen = CC_SHA512_DIGEST_LENGTH; - hmacCtx->blockLen = CC_SHA512_BLOCK_BYTES; - hmacCtx->digestInit = (void *)CC_SHA512_Init; - hmacCtx->digestUpdate = (void *)CC_SHA512_Update; - hmacCtx->digestFinal = (void *)CC_SHA512_Final; - break; - default: - return; - } - - hmacCtx->digestInit(&hmacCtx->digest); - - /* If the key is longer than block size, reset it to key=digest(key) */ - if (keyLength <= hmacCtx->blockLen) - keyP = (uint8_t *)key; - else { - hmacCtx->digestUpdate(&hmacCtx->digest, key, keyLength); - hmacCtx->digestFinal(tk, &hmacCtx->digest); - keyP = tk; - keyLength = hmacCtx->digestLen; - hmacCtx->digestInit(&hmacCtx->digest); - } - - /* The HMAC_ transform looks like: - (K XOR opad || (K XOR ipad || text)) - Where K is a n byte key - ipad is the byte 0x36 repeated 64 times. - opad is the byte 0x5c repeated 64 times. - text is the data being protected. - */ - /* Copy the key into k_ipad and k_opad while doing the XOR. */ - for (byte = 0; byte < keyLength; byte++) - { - k_ipad[byte] = keyP[byte] ^ 0x36; - hmacCtx->k_opad[byte] = keyP[byte] ^ 0x5c; - } - /* Fill the remainder of k_ipad and k_opad with 0 XORed with the appropriate value. */ - if (keyLength < hmacCtx->blockLen) - { - memset (k_ipad + keyLength, 0x36, hmacCtx->blockLen - keyLength); - memset (hmacCtx->k_opad + keyLength, 0x5c, hmacCtx->blockLen - keyLength); - } - hmacCtx->digestUpdate(&hmacCtx->digest, k_ipad, hmacCtx->blockLen); + CC_DEBUG_LOG(CC_DEBUG, "NULL Context passed in\n"); + return; + } + + if(key == NULL) { + CC_DEBUG_LOG(CC_DEBUG, "NULL Context passed in\n"); + return; + } + + CC_XZEROMEM(hmacCtx, sizeof(_NewHmacContext)); + + if((hmacCtx->di = convertccHmacSelector(algorithm)) == NULL) { + CC_DEBUG_LOG(CC_DEBUG, "CCHMac Unknown Digest %d\n", algorithm); + return; + } + + cchmac_init(hmacCtx->di, hmacCtx->ctx, keyLength, key); + + } void CCHmacUpdate( - CCHmacContext *ctx, - const void *dataIn, - size_t dataInLength) /* length of data in bytes */ + CCHmacContext *ctx, + const void *dataIn, + size_t dataInLength) /* length of data in bytes */ { - _CCHmacContext *hmacCtx = (_CCHmacContext *)ctx; - hmacCtx->digestUpdate(&hmacCtx->digest, dataIn, dataInLength); + _NewHmacContext *hmacCtx = (_NewHmacContext *)ctx; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + cchmac_update(hmacCtx->di, hmacCtx->ctx, dataInLength, dataIn); } void CCHmacFinal( - CCHmacContext *ctx, - void *macOut) -{ - _CCHmacContext *hmacCtx = (_CCHmacContext *)ctx; - hmacCtx->digestFinal(macOut, &hmacCtx->digest); - hmacCtx->digestInit(&hmacCtx->digest); - /* Perform outer digest */ - hmacCtx->digestUpdate(&hmacCtx->digest, hmacCtx->k_opad, hmacCtx->blockLen); - hmacCtx->digestUpdate(&hmacCtx->digest, macOut, hmacCtx->digestLen); - hmacCtx->digestFinal(macOut, &hmacCtx->digest); -} + CCHmacContext *ctx, + void *macOut) +{ + _NewHmacContext *hmacCtx = (_NewHmacContext *)ctx; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + cchmac_final(hmacCtx->di, hmacCtx->ctx, macOut); +} + +void +CCHmacDestroy(CCHmacContextRef ctx) +{ + CC_XZEROMEM(ctx, sizeof(_NewHmacContext)); + CC_XFREE(ctx, sizeof(_NewHmacContext)); +} + + +size_t +CCHmacOutputSizeFromRef(CCHmacContextRef ctx) +{ + _NewHmacContext *hmacCtx = (_NewHmacContext *)ctx; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return hmacCtx->di->output_size; +} + + +size_t +CCHmacOutputSize(CCDigestAlg alg) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + return CCDigestGetOutputSize(alg); +} + /* * Stateless, one-shot HMAC function. - * Output is written to caller-spullied buffer, as in CCHmacFinal(). + * Output is written to caller-supplied buffer, as in CCHmacFinal(). */ void CCHmac( - CCHmacAlgorithm algorithm, /* kCCHmacSHA1, kCCHmacMD5 */ - const void *key, - size_t keyLength, /* length of key in bytes */ - const void *data, - size_t dataLength, /* length of data in bytes */ - void *macOut) /* MAC written here */ -{ - CCHmacContext ctx; - - CCHmacInit(&ctx, algorithm, key, keyLength); - CCHmacUpdate(&ctx, data, dataLength); - CCHmacFinal(&ctx, macOut); -} + CCHmacAlgorithm algorithm, /* kCCHmacSHA1, kCCHmacMD5 */ + const void *key, + size_t keyLength, /* length of key in bytes */ + const void *data, + size_t dataLength, /* length of data in bytes */ + void *macOut) /* MAC written here */ +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering Algorithm: %d\n", algorithm); + cchmac(convertccHmacSelector(algorithm), keyLength, key, dataLength, data, macOut); +} + + + +CCHmacContextRef +CCHmacCreate(CCDigestAlg alg, const void *key, size_t keyLength) +{ + _NewHmacContext *hmacCtx; + uint8_t tk[HMAC_MAX_DIGEST_SIZE]; + const uint8_t *keyP; + uint32_t byte; + uint8_t k_ipad[HMAC_MAX_BLOCK_SIZE]; + size_t digestLen = CCDigestGetOutputSize(alg); + size_t blockLen = CCDigestGetBlockSize(alg); + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + /* if this fails, it's time to adjust CC_HMAC_CONTEXT_SIZE */ + if((hmacCtx = CC_XMALLOC(sizeof(_NewHmacContext))) == NULL) return NULL; + + CC_XZEROMEM(hmacCtx, sizeof(_NewHmacContext)); + + if((hmacCtx->di = CCDigestGetDigestInfo(alg)) == NULL) { + CC_DEBUG_LOG(CC_DEBUG, "CCHMac Unknown Digest %d\n"); + return NULL; + } + + cchmac_init(hmacCtx->di, hmacCtx->ctx, keyLength, key); + return hmacCtx; +} + Index: Source/API/CommonKeyDerivation.c ================================================================== --- Source/API/CommonKeyDerivation.c +++ Source/API/CommonKeyDerivation.c @@ -1,238 +1,76 @@ -/* $OpenBSD: pbkdf2.c,v 1.1 2008/06/14 06:28:27 djm Exp $ */ -/* - * This version was derived by generalizing the original code by Damien Bergamini - * for use with alternate pseudo-random functions. - */ - -/*- - * Copyright (c) 2008 Damien Bergamini - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include "CommonKeyDerivation.h" -#include "CommonKeyDerivationPriv.h" - -#define kCCPRFHmacAlgSHA1hlen CC_SHA1_DIGEST_LENGTH -#define kCCPRFHmacAlgSHA224hlen CC_SHA224_DIGEST_LENGTH -#define kCCPRFHmacAlgSHA256hlen CC_SHA256_DIGEST_LENGTH -#define kCCPRFHmacAlgSHA384hlen CC_SHA384_DIGEST_LENGTH -#define kCCPRFHmacAlgSHA512hlen CC_SHA512_DIGEST_LENGTH - -#if defined(USE_DIGEST_PRF) -#define kCCPRFSHA1hlen CC_SHA1_DIGEST_LENGTH -#define kCCPRFSHA224hlen CC_SHA224_DIGEST_LENGTH -#define kCCPRFSHA256hlen CC_SHA256_DIGEST_LENGTH -#define kCCPRFSHA384hlen CC_SHA384_DIGEST_LENGTH -#define kCCPRFSHA512hlen CC_SHA512_DIGEST_LENGTH -#define kCCPRFSkeinhlen CC_SHA512_DIGEST_LENGTH -#define kCCPRFSHA3hlen CC_SHA512_DIGEST_LENGTH -#endif /* USE_DIGEST_PRF */ - -// This is for the scratchspace - it's twice the size of the max PRF buffer + 4 to work within the pbkdf2 code we currently -// have. - -#define CC_MAX_PRF_WORKSPACE 128+4 - -static size_t -getPRFhlen(CCPseudoRandomAlgorithm prf) -{ - switch(prf) { - case kCCPRFHmacAlgSHA1: return kCCPRFHmacAlgSHA1hlen; - case kCCPRFHmacAlgSHA224: return kCCPRFHmacAlgSHA224hlen; - case kCCPRFHmacAlgSHA256: return kCCPRFHmacAlgSHA256hlen; - case kCCPRFHmacAlgSHA384: return kCCPRFHmacAlgSHA384hlen; - case kCCPRFHmacAlgSHA512: return kCCPRFHmacAlgSHA512hlen; -#if defined(USE_DIGEST_PRF) - case kCCPRFSHA1: return kCCPRFSHA1hlen; - case kCCPRFSHA224: return kCCPRFSHA224hlen; - case kCCPRFSHA256: return kCCPRFSHA256hlen; - case kCCPRFSHA384: return kCCPRFSHA384hlen; - case kCCPRFSHA512: return kCCPRFSHA512hlen; -#endif /* USE_DIGEST_PRF */ - default: return 0; - } -} - -#if defined(USE_DIGEST_PRF) -static u_int8_t * -prefixSalt(const char *password, size_t passwordLen, u_int8_t *salt, size_t saltLen, u_int8_t *output) -{ - memcpy(output, salt, saltLen); - memcpy(output+saltLen, password, passwordLen); - return output; -} -#endif /* USE_DIGEST_PRF */ - - -static void -PRF(CCPseudoRandomAlgorithm prf, const char *password, size_t passwordLen, u_int8_t *salt, size_t saltLen, u_int8_t *output) -{ - u_int8_t tmpbuf[1024]; // ZZZfor now - - switch(prf) { - case kCCPRFHmacAlgSHA1: - CCHmac(kCCHmacAlgSHA1, password, passwordLen, salt, saltLen, output); - break; - case kCCPRFHmacAlgSHA224: - CCHmac(kCCHmacAlgSHA224, password, passwordLen, salt, saltLen, output); - break; - case kCCPRFHmacAlgSHA256: - CCHmac(kCCHmacAlgSHA256, password, passwordLen, salt, saltLen, output); - break; - case kCCPRFHmacAlgSHA384: - CCHmac(kCCHmacAlgSHA384, password, passwordLen, salt, saltLen, output); - break; - case kCCPRFHmacAlgSHA512: - CCHmac(kCCHmacAlgSHA512, password, passwordLen, salt, saltLen, output); - break; -#if defined(USE_DIGEST_PRF) - case kCCPRFSHA1: - CC_SHA1(prefixSalt(password, passwordLen, salt, saltLen, tmpbuf), saltLen+passwordLen, output); - break; - case kCCPRFSHA224: - CC_SHA224(prefixSalt(password, passwordLen, salt, saltLen, tmpbuf), saltLen+passwordLen, output); - break; - case kCCPRFSHA256: - CC_SHA256(prefixSalt(password, passwordLen, salt, saltLen, tmpbuf), saltLen+passwordLen, output); - break; - case kCCPRFSHA384: - CC_SHA384(prefixSalt(password, passwordLen, salt, saltLen, tmpbuf), saltLen+passwordLen, output); - break; - case kCCPRFSHA512: - CC_SHA512(prefixSalt(password, passwordLen, salt, saltLen, tmpbuf), saltLen+passwordLen, output); - break; -#endif /* USE_DIGEST_PRF */ - - } -} +/* + * Copyright (c) 2012 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +// #define COMMON_KEYDERIVATION_FUNCTIONS + +#include "CommonKeyDerivation.h" +#include +#include "CommonDigestPriv.h" +#include "CommonDigestSPI.h" +#include "ccdebug.h" int CCKeyDerivationPBKDF( CCPBKDFAlgorithm algorithm, const char *password, size_t passwordLen, const uint8_t *salt, size_t saltLen, CCPseudoRandomAlgorithm prf, uint rounds, uint8_t *derivedKey, size_t derivedKeyLen) { - u_int8_t oldbuffer[CC_MAX_PRF_WORKSPACE], newbuffer[CC_MAX_PRF_WORKSPACE], - saltCopy[CC_MAX_PRF_WORKSPACE+4], collector[CC_MAX_PRF_WORKSPACE]; - int rawblock, i, j, r, nblocks; - size_t hlen, offset; - - if(algorithm != kCCPBKDF2) return -1; - - /* - * Check initial parameters - */ - - if (rounds < 1 || derivedKeyLen == 0) - return -1; // bad parameters - if (saltLen == 0 || saltLen > CC_MAX_PRF_WORKSPACE) - return -1; // out of bounds parameters - - hlen = getPRFhlen(prf); - - /* - * FromSpec: Let l be the number of hLen-octet blocks in the derived key, rounding up, - * and let r be the number of octets in the last block: - */ - - nblocks = (derivedKeyLen+hlen-1)/hlen; // in the spec nblocks is referred to as l - r = derivedKeyLen % hlen; - r = (r) ? r: hlen; - - /* - * Make a copy of the salt buffer so we can concatenate the - * block counter for each series of rounds. - */ - - memcpy(saltCopy, salt, saltLen); - bzero(derivedKey, derivedKeyLen); - - /* - * FromSpec: - * - * For each block of the derived key apply the function F defined below to the password P, - * the salt S, the iteration count c, and the block index to compute the block: - * - * F(P,S,c,i)=U1 \xorU2 \xorâ‹…â‹…â‹…\xorUc - * - * where - * U1 =PRF(P,S||INT (i)), - * U2 =PRF(P,U1), - * ... - * Uc = PRF (P, Uc-1) . - */ - - for(rawblock = 0; rawblock < nblocks; rawblock++) { - int block = rawblock+1; - int copyLen; - - offset = rawblock * hlen; - copyLen = (block != nblocks) ? hlen: r; - - /* - * FromSpec: Here, INT (i) is a four-octet encoding of the integer i, most significant octet first. - */ - - for(i=0; i<4; i++) saltCopy[saltLen+i] = (block >> 8*(3-i)) & 0xff; - - PRF(prf, password, passwordLen, saltCopy, saltLen+4, oldbuffer); // Initial PRF with the modified salt - - memcpy(collector, oldbuffer, hlen); // Initial value for this block of the derived key. - - for(i = 1; i < rounds; i++) { - PRF(prf, password, passwordLen, oldbuffer, hlen, newbuffer); // Subsequent PRF with the previous result as the salt - memcpy(oldbuffer, newbuffer, hlen); - for(j = 0; j < hlen; j++) collector[j] ^= newbuffer[j]; // Xoring the round into the collector - } - memcpy(derivedKey+offset, collector, copyLen); - } - - /* - * Clear temp buffers. - */ - - bzero(oldbuffer, CC_MAX_PRF_WORKSPACE); - bzero(newbuffer, CC_MAX_PRF_WORKSPACE); - bzero(collector, CC_MAX_PRF_WORKSPACE); - bzero(saltCopy, CC_MAX_PRF_WORKSPACE+4); - - return 0; -} - -#ifndef KERNEL + const struct ccdigest_info *di; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "PasswordLen %lu SaltLen %lU PRF %d Rounds %u DKLen %lu\n", passwordLen, saltLen, prf, rounds, derivedKeyLen); + if(algorithm != kCCPBKDF2) return -1; + switch(prf) { + case kCCPRFHmacAlgSHA1: di = CCDigestGetDigestInfo(kCCDigestSHA1); break; + case kCCPRFHmacAlgSHA224: di = CCDigestGetDigestInfo(kCCDigestSHA224); break; + case kCCPRFHmacAlgSHA256: di = CCDigestGetDigestInfo(kCCDigestSHA256); break; + case kCCPRFHmacAlgSHA384: di = CCDigestGetDigestInfo(kCCDigestSHA384); break; + case kCCPRFHmacAlgSHA512: di = CCDigestGetDigestInfo(kCCDigestSHA512); break; + default: return -1; + } + if(!password || !salt || !derivedKey || (derivedKeyLen == 0) || (rounds == 0)) return -1; + + ccpbkdf2_hmac(di, passwordLen, password, saltLen, salt, rounds, derivedKeyLen, derivedKey); + return 0; +} + #include #include #define ROUNDMEASURE 100000 +// This is for the scratchspace - it's twice the size of the max PRF buffer + 4 to work within the pbkdf2 code we currently +// have. + +#define CC_MAX_PRF_WORKSPACE 128+4 + + static uint64_t timer() { static mach_timebase_info_data_t sTimebaseInfo; uint64_t timeNano; - + if ( sTimebaseInfo.denom == 0 ) { (void) mach_timebase_info(&sTimebaseInfo); } timeNano = mach_absolute_time(); @@ -246,34 +84,35 @@ char *password; uint8_t *salt; uint64_t startTime, endTime, elapsedTime; uint8_t *derivedKey; int i; - + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); if (derivedKeyLen == 0) return -1; // bad parameters if (saltLen == 0 || saltLen > CC_MAX_PRF_WORKSPACE) return -1; // out of bounds parameters - if (passwordLen == 0 ) return -1; // out of bounds parameters + if (passwordLen == 0 ) passwordLen = 1; if(algorithm != kCCPBKDF2) return -1; if((password = malloc(passwordLen)) == NULL) return -1; for(i=0; i +#include +#include + +#include "asn1Types.h" +#include "DER_Keys.h" +#include "DER_Encode.h" + + +#include "ccErrors.h" +#include "ccMemory.h" +// #include "ccCoreCryptoInterface.h" +#include "ccdebug.h" +#include + +#pragma mark internal + +#define kCCMaximumRSAKeyBits 4096 +#define kCCMaximumRSAKeyBytes ccn_sizeof(kCCMaximumRSAKeyBits) +#define kCCRSAKeyContextSize ccrsa_full_ctx_size(kCCMaximumRSAKeyBytes) +#define RSA_PKCS1_PAD_ENCRYPT 0x02 + + +typedef struct _CCRSACryptor { + union { + ccrsa_full_ctx *full; + ccrsa_priv_ctx *private; + ccrsa_pub_ctx *public; + uint8_t *bytes; + } rsaKey; + size_t keySize; + size_t ctxSize; + CCRSAKeyType keyType; +} CCRSACryptor; + +static CCRSACryptor * +ccMallocRSACryptor(size_t nbits, CCRSAKeyType keyType) +{ + CCRSACryptor *retval; + size_t ctxSize = 0; + cc_size n = ccn_nof(nbits); + + if((retval = CC_XMALLOC(sizeof(CCRSACryptor))) == NULL) return NULL; + + retval->keySize = nbits; + retval->rsaKey.bytes = NULL; + + switch(keyType) { + case ccRSAKeyPublic: + retval->keyType = ccRSABlankPublicKey; + retval->ctxSize = ccrsa_pub_ctx_size(ccn_sizeof(nbits)); + break; + case ccRSAKeyPrivate: + retval->keyType = ccRSABlankPrivateKey; + retval->ctxSize = ccrsa_full_ctx_size(ccn_sizeof(nbits)); + break; + default: + retval = kCCParamError; + goto errOut; + } + + if((retval->rsaKey.bytes = CC_XMALLOC(retval->ctxSize)) == NULL) goto errOut; + ccrsa_ctx_n(retval->rsaKey.full) = n; + + return retval; +errOut: + if(retval) { + CC_XFREE(retval, sizeof(CCRSACryptor)); + } + return retval; +} + +static void +ccRSACryptorClear(CCRSACryptorRef theKey) +{ + size_t nbits; + size_t ctxSize = 0; + + CCRSACryptor *key = (CCRSACryptor *) theKey; + if(!key) return; + + if(ctxSize && key->rsaKey.bytes) { + CC_XZEROMEM(key->rsaKey.bytes, key->ctxSize); + CC_XFREE(key->rsaKey.bytes, key->ctxSize); + } + + CC_XZEROMEM(key, sizeof(CCRSACryptor)); + CC_XFREE(key, sizeof(CCRSACryptor)); +} + +/* + + This is done for FIPS. Basically we make sure that the two keys will work to encrypt/decrypt + each other's data. This will test up to 4K bit keys. + +*/ + +#define MAXKEYTEST 512 + +static bool +ccRSApairwiseConsistencyCheck(CCRSACryptorRef privateKey, CCRSACryptorRef publicKey) +{ + CCCryptorStatus status = kCCSuccess; + uint8_t digestBuffer[CC_SHA1_DIGEST_LENGTH]; + size_t theDataLen = MAXKEYTEST, resultLen, recoveryLen; + uint8_t theData[MAXKEYTEST]; + uint8_t theResult[MAXKEYTEST]; + uint8_t theRecovered[MAXKEYTEST]; + + /* + + the RSA keysize had better be equal - we convert keysizes to bytes since we need to + work with the appropriate size data buffers for tests. + + */ + + theDataLen = CCRSAGetKeySize(privateKey) / 8; + if(theDataLen > MAXKEYTEST || theDataLen != (CCRSAGetKeySize(publicKey) / 8)) { + return false; + } + + /* Fill the input buffer for the test */ + + CC_XMEMSET(theData, 0x0a, theDataLen); + + /* Encrypt the buffer with the private key then be sure the output isn't the same as the input */ + resultLen = theDataLen; + status = CCRSACryptorCrypt(privateKey, theData, theDataLen, theResult, &resultLen); + + if (kCCSuccess != status) { + return false; + } + + if(CC_XMEMCMP(theData, theResult, theDataLen) == 0) { + return false; + } + + /* Decrypt the buffer with the public key and be sure the output matches the original input */ + + recoveryLen = theDataLen; + status = CCRSACryptorCrypt(publicKey, theResult, resultLen, theRecovered, &recoveryLen); + + if (kCCSuccess != status) { + return false; + } + + if(recoveryLen != theDataLen) { + return false; + } + + if(CC_XMEMCMP(theData, theRecovered, theDataLen) != 0) { + return false; + } + + /* Cleanup and leave */ + + CC_XZEROMEM(theData, MAXKEYTEST); + CC_XZEROMEM(theResult, MAXKEYTEST); + CC_XZEROMEM(theRecovered, MAXKEYTEST); + + return true; +} + + +#pragma mark APIDone + +CCCryptorStatus +CCRSACryptorGeneratePair(size_t keysize, uint32_t e, CCRSACryptorRef *publicKey, CCRSACryptorRef *privateKey) +{ + CCCryptorStatus retval; + CCRSACryptor *privateCryptor = NULL; + CCRSACryptor *publicCryptor = NULL; + struct ccrng_state *theRng1 = ccDRBGGetRngState(); + struct ccrng_state *theRng2 = ccDevRandomGetRngState(); + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + // ccrsa_generate_key() requires the exponent as length / pointer to bytes + cc_unit cc_unit_e = (cc_unit) e; + + size_t eSize = ccn_write_int_size(1, &cc_unit_e); + uint8_t eBytes[eSize]; + ccn_write_int(1, &cc_unit_e, eSize, eBytes); + + *publicKey = *privateKey = NULL; + + __Require_Action((privateCryptor = ccMallocRSACryptor(keysize, ccRSAKeyPrivate)) != NULL, errOut, retval = kCCMemoryFailure); + + // __Require_Action((ccrsa_generate_key(keysize, privateCryptor->rsaKey.full, sizeof(e), &e, theRng) == 0), errOut, retval = kCCDecodeError); + __Require_Action((ccrsa_generate_931_key(keysize, privateCryptor->rsaKey.full, eSize, eBytes, theRng1, theRng2) == 0), errOut, retval = kCCDecodeError); + + privateCryptor->keyType = ccRSAKeyPrivate; + + __Require_Action((publicCryptor = CCRSACryptorGetPublicKeyFromPrivateKey(privateCryptor)) != NULL, errOut, retval = kCCMemoryFailure); + + *publicKey = publicCryptor; + *privateKey = privateCryptor; + + __Require_Action(ccRSApairwiseConsistencyCheck(*privateKey, *publicKey) == true, errOut, retval = kCCDecodeError); + + return kCCSuccess; + +errOut: + if(privateCryptor) ccRSACryptorClear(privateCryptor); + if(publicCryptor) ccRSACryptorClear(publicCryptor); + *publicKey = *privateKey = NULL; + return retval; +} + +CCRSACryptorRef CCRSACryptorGetPublicKeyFromPrivateKey(CCRSACryptorRef privateCryptorRef) +{ + int tcReturn; + CCRSACryptor *publicCryptor = NULL, *privateCryptor = privateCryptorRef; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if((publicCryptor = ccMallocRSACryptor(privateCryptor->keySize, ccRSAKeyPublic)) == NULL) return NULL; + CC_XMEMCPY(publicCryptor->rsaKey.public, privateCryptor->rsaKey.private, ccrsa_pub_ctx_size(privateCryptor->keySize)); + publicCryptor->keyType = ccRSAKeyPublic; + return publicCryptor; +} + +CCRSAKeyType CCRSAGetKeyType(CCRSACryptorRef key) +{ + CCRSACryptor *cryptor = key; + CCRSAKeyType retval; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(key == NULL) return ccRSABadKey; + retval = cryptor->keyType; + if(retval != ccRSAKeyPublic && retval != ccRSAKeyPrivate) return ccRSABadKey; + return retval; +} + +int CCRSAGetKeySize(CCRSACryptorRef key) +{ + CCRSACryptor *cryptor = key; + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(key == NULL) return kCCParamError; + + return cryptor->keySize; +} + +void +CCRSACryptorRelease(CCRSACryptorRef key) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccRSACryptorClear(key); +} + + +CCCryptorStatus CCRSACryptorImport(const void *keyPackage, size_t keyPackageLen, CCRSACryptorRef *key) +{ + CCRSACryptor *cryptor = NULL; + CCCryptorStatus retval; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!keyPackage || !key) return kCCParamError; + + DERItem keyItem = {(DERByte *)keyPackage, keyPackageLen}; + DERRSAPubKeyPKCS1 decodedKey; + + if(DERParseSequence(&keyItem, DERNumRSAPubKeyPKCS1ItemSpecs, DERRSAPubKeyPKCS1ItemSpecs, + &decodedKey, sizeof(decodedKey))) return kCCDecodeError; + + size_t n = ccn_nof_size(decodedKey.modulus.length); + cc_unit m[n], e[n]; + __Require_Action(ccn_read_uint(n, m, decodedKey.modulus.length, decodedKey.modulus.data) == 0, errOut, retval = kCCParamError); + __Require_Action(ccn_read_uint(n, e, decodedKey.pubExponent.length, decodedKey.pubExponent.data) == 0, errOut, retval = kCCParamError); + size_t nbits = ccn_bitlen(n, m); + + __Require_Action((cryptor = ccMallocRSACryptor(nbits, ccRSAKeyPublic)) != NULL, errOut, retval = kCCMemoryFailure); + + ccrsa_init_pub(cryptor->rsaKey.public, m, e); + + *key = cryptor; + cryptor->keyType = ccRSAKeyPublic; + return kCCSuccess; + +errOut: + if(cryptor) ccRSACryptorClear(cryptor); + *key = NULL; + return retval; +} + + +CCCryptorStatus CCRSACryptorExport(CCRSACryptorRef key, void *out, size_t *outLen) +{ + CCRSACryptor *cryptor = key; + CCCryptorStatus retval = kCCSuccess; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!key || !out) return kCCParamError; + __Require_Action(ccrsa_export_pub(key->rsaKey.public, outLen, out) == 0, errOut, retval = kCCDecodeError); + +errOut: + return retval; +} + + + + + + + +CCCryptorStatus +CCRSACryptorEncrypt(CCRSACryptorRef publicKey, CCAsymetricPadding padding, const void *plainText, size_t plainTextLen, void *cipherText, size_t *cipherTextLen, + const void *tagData, size_t tagDataLen, CCDigestAlgorithm digestType) +{ + CCCryptorStatus retval = kCCSuccess; + ccrsa_pub_ctx_t pubkey; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!publicKey || !cipherText || !plainText || !cipherTextLen) return kCCParamError; + + pubkey.pub = publicKey->rsaKey.public; + + switch(padding) { + case ccPKCS1Padding: + if(ccrsa_encrypt_eme_pkcs1v15(pubkey, ccDRBGGetRngState(), cipherTextLen, cipherText, plainTextLen, plainText) != 0) + retval = kCCDecodeError; + break; + case ccOAEPPadding: + if(ccrsa_encrypt_oaep(pubkey, CCDigestGetDigestInfo(digestType), ccDRBGGetRngState(), cipherTextLen, cipherText, plainTextLen, plainText, + tagDataLen, tagData) != 0) + retval = kCCDecodeError; + break; + default: + retval = kCCParamError; + goto errOut; + + } + +errOut: + return retval; +} + + + +CCCryptorStatus +CCRSACryptorDecrypt(CCRSACryptorRef privateKey, CCAsymetricPadding padding, const void *cipherText, size_t cipherTextLen, + void *plainText, size_t *plainTextLen, const void *tagData, size_t tagDataLen, CCDigestAlgorithm digestType) +{ + CCCryptorStatus retval = kCCSuccess; + ccrsa_full_ctx_t fullkey; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!privateKey || !cipherText || !plainText || !plainTextLen) return kCCParamError; + + fullkey.full = privateKey->rsaKey.private; + + switch (padding) { + case ccPKCS1Padding: + if(ccrsa_decrypt_eme_pkcs1v15(fullkey, plainTextLen, plainText, cipherTextLen, cipherText) != 0) + retval = kCCDecodeError; + break; + case ccOAEPPadding: + if(ccrsa_decrypt_oaep(fullkey, CCDigestGetDigestInfo(digestType), plainTextLen, plainText, cipherTextLen, cipherText, + tagDataLen, tagData) != 0) + retval = kCCDecodeError; + break; + default: + goto errOut; + } + +errOut: + + return retval; +} + +CCCryptorStatus +CCRSACryptorCrypt(CCRSACryptorRef rsaKey, const void *in, size_t inLen, void *out, size_t *outLen) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!rsaKey || !in || !out || !outLen) return kCCParamError; + + size_t keysizeBytes = rsaKey->keySize/8; + + if(inLen != keysizeBytes || *outLen < keysizeBytes) return kCCMemoryFailure; + + cc_size n = ccrsa_ctx_n(rsaKey->rsaKey.full); + cc_unit buf[n]; + ccn_read_uint(n, buf, inLen, in); + + switch(rsaKey->keyType) { + case ccRSAKeyPublic: + ccrsa_pub_crypt(rsaKey->rsaKey.public, buf, buf); + break; + case ccRSAKeyPrivate: + ccrsa_priv_crypt(ccrsa_ctx_private(rsaKey->rsaKey.full), buf, buf); + break; + default: + return kCCParamError; + } + + *outLen = keysizeBytes; + ccn_write_uint_padded(n, buf, *outLen, out); + return kCCSuccess; +} + + + +static inline cczp_read_uint(cczp_t r, size_t data_size, const uint8_t *data) +{ + if(ccn_read_uint(ccn_nof_size(data_size), CCZP_PRIME(r), data_size, data) != 0) return -1; + CCZP_N(r) = ccn_nof_size(data_size); + cczp_init(r); + return 0; +} + +static inline +CCCryptorStatus ccn_write_arg(size_t n, const cc_unit *source, uint8_t *dest, size_t *destLen) +{ + size_t len; + if((len = ccn_write_uint_size(n, source)) > *destLen) { + return kCCMemoryFailure; + } + *destLen = len; + ccn_write_uint(n, source, *destLen, dest); + return kCCSuccess; +} + + +CCCryptorStatus +CCRSACryptorCreatePairFromData(uint32_t e, + uint8_t *xp1, size_t xp1Length, + uint8_t *xp2, size_t xp2Length, + uint8_t *xp, size_t xpLength, + uint8_t *xq1, size_t xq1Length, + uint8_t *xq2, size_t xq2Length, + uint8_t *xq, size_t xqLength, + CCRSACryptorRef *publicKey, CCRSACryptorRef *privateKey, + uint8_t *retp, size_t *retpLength, + uint8_t *retq, size_t *retqLength, + uint8_t *retm, size_t *retmLength, + uint8_t *retd, size_t *retdLength) +{ + CCCryptorStatus retval; + CCRSACryptor *privateCryptor = NULL; + CCRSACryptor *publicCryptor = NULL; + cc_unit x_p1[ccn_nof_size(xp1Length)]; + cc_unit x_p2[ccn_nof_size(xp2Length)]; + cc_unit x_p[ccn_nof_size(xpLength)]; + cc_unit x_q1[ccn_nof_size(xq1Length)]; + cc_unit x_q2[ccn_nof_size(xq2Length)]; + cc_unit x_q[ccn_nof_size(xqLength)]; + cc_unit e_value[1]; + size_t nbits = xpLength * 8 + xqLength * 8; // or we'll add this as a parameter. This appears to be correct for FIPS + cc_size n = ccn_nof(nbits); + cc_unit p[n], q[n], m[n], d[n]; + cc_size np, nq, nm, nd; + + np = nq = nm = nd = n; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + e_value[0] = (cc_unit) e; + + __Require_Action((privateCryptor = ccMallocRSACryptor(nbits, ccRSAKeyPrivate)) != NULL, errOut, retval = kCCMemoryFailure); + + ccrsa_pub_ctx_t pubk = ccrsa_ctx_public(privateCryptor->rsaKey.full); + ccrsa_priv_ctx_t privk = ccrsa_ctx_private(privateCryptor->rsaKey.full); + + __Require_Action(ccn_read_uint(ccn_nof_size(xp1Length), x_p1, xp1Length, xp1) == 0, errOut, kCCParamError); + __Require_Action(ccn_read_uint(ccn_nof_size(xp2Length), x_p2, xp2Length, xp2)== 0, errOut, kCCParamError); + __Require_Action(ccn_read_uint(ccn_nof_size(xpLength), x_p, xpLength, xp) == 0, errOut, kCCParamError); + __Require_Action(ccn_read_uint(ccn_nof_size(xq1Length), x_q1, xq1Length, xq1) == 0, errOut, kCCParamError); + __Require_Action(ccn_read_uint(ccn_nof_size(xq2Length), x_q2, xq2Length, xq2) == 0, errOut, kCCParamError); + __Require_Action(ccn_read_uint(ccn_nof_size(xqLength), x_q, xqLength, xq) == 0, errOut, kCCParamError); + + __Require_Action(ccrsa_make_931_key(nbits, 1, e_value, + ccn_nof_size(xp1Length), x_p1, ccn_nof_size(xp2Length), x_p2, ccn_nof_size(xpLength), x_p, + ccn_nof_size(xq1Length), x_q1, ccn_nof_size(xq2Length), x_q2, ccn_nof_size(xqLength), x_q, + privateCryptor->rsaKey.full, + &np, p, + &nq, q, + &nm, m, + &nd, d) == 0, errOut, retval = kCCDecodeError); + + privateCryptor->keyType = ccRSAKeyPrivate; + + __Require_Action((publicCryptor = CCRSACryptorGetPublicKeyFromPrivateKey(privateCryptor)) != NULL, errOut, retval = kCCMemoryFailure); + + *publicKey = publicCryptor; + *privateKey = privateCryptor; + ccn_write_arg(np, p, retp, retpLength); + ccn_write_arg(nq, q, retq, retqLength); + ccn_write_arg(nm, m, retm, retmLength); + ccn_write_arg(nd, d, retd, retdLength); + + return kCCSuccess; + +errOut: + if(privateCryptor) ccRSACryptorClear(privateCryptor); + if(publicCryptor) ccRSACryptorClear(publicCryptor); + // CLEAR the bits + *publicKey = *privateKey = NULL; + return retval; + +} + + + +CCCryptorStatus +CCRSACryptorCreateFromData( CCRSAKeyType keyType, uint8_t *modulus, size_t modulusLength, + uint8_t *exponent, size_t exponentLength, + uint8_t *p, size_t pLength, uint8_t *q, size_t qLength, + CCRSACryptorRef *ref) +{ + CCCryptorStatus retval = kCCSuccess; + CCRSACryptor *rsaKey = NULL; + size_t n = ccn_nof_size(modulusLength); + cc_unit m[n]; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + __Require_Action(ccn_read_uint(n, m, modulusLength, modulus), errOut, retval = kCCParamError); + size_t nbits = ccn_bitlen(n, m); + + __Require_Action((rsaKey = ccMallocRSACryptor(nbits, keyType)) != NULL, errOut, retval = kCCMemoryFailure); + + __Require_Action(ccn_read_uint(n, ccrsa_ctx_m(rsaKey->rsaKey.public), modulusLength, modulus), errOut, retval = kCCParamError); + __Require_Action(ccn_read_uint(n, ccrsa_ctx_e(rsaKey->rsaKey.public), exponentLength, exponent), errOut, retval = kCCParamError); + cczp_init(ccrsa_ctx_zm(rsaKey->rsaKey.public)); + rsaKey->keySize = ccn_bitlen(n, ccrsa_ctx_m(rsaKey->rsaKey.public)); + + switch(keyType) { + case ccRSAKeyPublic: + rsaKey->keyType = ccRSAKeyPublic; + break; + + case ccRSAKeyPrivate: { + ccrsa_full_ctx_t fk; + fk.full = rsaKey->rsaKey.full; + ccrsa_pub_ctx_t pubk = ccrsa_ctx_public(rsaKey->rsaKey.public); + ccrsa_priv_ctx_t privk = ccrsa_ctx_private(rsaKey->rsaKey.full); + size_t psize = ccn_nof_size(pLength); + size_t qsize = ccn_nof_size(qLength); + + + CCZP_N(ccrsa_ctx_private_zp(privk)) = psize; + __Require_Action(ccn_read_uint(psize, CCZP_PRIME(ccrsa_ctx_private_zp(privk)), pLength, p), errOut, kCCParamError); + CCZP_N(ccrsa_ctx_private_zq(privk)) = qsize; + __Require_Action(ccn_read_uint(qsize, CCZP_PRIME(ccrsa_ctx_private_zq(privk)), qLength, q), errOut, kCCParamError); + + ccrsa_crt_makekey(ccrsa_ctx_zm(pubk), ccrsa_ctx_e(pubk), ccrsa_ctx_d(fk), + ccrsa_ctx_private_zp(privk), + ccrsa_ctx_private_dp(privk), ccrsa_ctx_private_qinv(privk), + ccrsa_ctx_private_zq(privk), ccrsa_ctx_private_dq(privk)); + + rsaKey->keyType = ccRSAKeyPrivate; + + break; + } + + default: + retval = kCCParamError; + goto errOut; + } + *ref = rsaKey; + return kCCSuccess; + +errOut: + if(rsaKey) ccRSACryptorClear(rsaKey); + return retval; +} + + + + +CCCryptorStatus +CCRSAGetKeyComponents(CCRSACryptorRef rsaKey, uint8_t *modulus, size_t *modulusLength, uint8_t *exponent, size_t *exponentLength, + uint8_t *p, size_t *pLength, uint8_t *q, size_t *qLength) +{ + CCRSACryptor *rsa = rsaKey; + ccrsa_pub_ctx *pubkey = rsaKey->rsaKey.public; + const cc_size n = ccrsa_ctx_n(pubkey); + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + switch(rsa->keyType) { + case ccRSAKeyPublic: { + if(ccrsa_get_pubkey_components(pubkey, modulus, modulusLength, exponent, exponentLength)) return kCCParamError; + break; + } + + case ccRSAKeyPrivate: { + ccrsa_full_ctx *key = rsaKey->rsaKey.private; + if(ccrsa_get_fullkey_components(key, modulus, modulusLength, exponent, exponentLength, + p, pLength, q, qLength)) return kCCParamError; + break; + } + + default: + return kCCParamError; + } + + return kCCSuccess; +} + + +CCCryptorStatus +CCRSACryptorSign(CCRSACryptorRef privateKey, CCAsymetricPadding padding, + const void *hashToSign, size_t hashSignLen, + CCDigestAlgorithm digestType, size_t saltLen, + void *signedData, size_t *signedDataLen) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!privateKey || !hashToSign || !signedData) return kCCParamError; + + switch(padding) { + case ccPKCS1Padding: + if(ccrsa_sign_pkcs1v15(privateKey->rsaKey.full, CCDigestGetDigestInfo(digestType)->oid, + hashSignLen, hashToSign, signedDataLen, signedData) != 0) + return kCCDecodeError; + break; + + case ccOAEPPadding: + if(ccrsa_sign_oaep(privateKey->rsaKey.full, CCDigestGetDigestInfo(digestType), + ccDRBGGetRngState(), hashSignLen, hashToSign, + signedDataLen, signedData) != 0) + return kCCDecodeError; + break; + case ccX931Padding: + case ccPKCS1PaddingRaw: + case ccPaddingNone: + default: + return kCCParamError; + break; + } + return kCCSuccess; +} + + + +CCCryptorStatus +CCRSACryptorVerify(CCRSACryptorRef publicKey, CCAsymetricPadding padding, + const void *hash, size_t hashLen, + CCDigestAlgorithm digestType, size_t saltLen, + const void *signedData, size_t signedDataLen) +{ + bool valid; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(!publicKey || !hash || !signedData) return kCCParamError; + + switch(padding) { + case ccPKCS1Padding: + if(ccrsa_verify_pkcs1v15(publicKey->rsaKey.public, CCDigestGetDigestInfo(digestType)->oid, + hashLen, hash, signedDataLen, signedData, &valid) != 0) + return kCCDecodeError; + if(!valid) return kCCDecodeError; + break; + + case ccOAEPPadding: + if(ccrsa_verify_oaep(publicKey->rsaKey.public, CCDigestGetDigestInfo(digestType), + hashLen, hash, signedDataLen, signedData, &valid) != 0) + return kCCDecodeError; + if(!valid) return kCCDecodeError; + break; + case ccX931Padding: + case ccPKCS1PaddingRaw: + case ccPaddingNone: + default: + return kCCParamError; + break; + } + return kCCSuccess; +} + +#pragma mark APINotDone +#ifdef NEVER + +// This was only here for FIPS. If we move FIPS to the corecrypto layer it will need to be there. + +CCCryptorStatus +CCRSACryptorDecodePayloadPKCS1( + CCRSACryptorRef publicKey, + const void *cipherText, + size_t cipherTextLen, + void *plainText, + size_t *plainTextLen) +{ + int tcReturn; + int stat = 0; + CCRSACryptor *publicCryptor = publicKey; + uint8_t *message; + unsigned long messageLen, modulusLen; + CCCryptorStatus retval = kCCSuccess; + + modulusLen = CCRSAGetKeySize(publicKey); + messageLen = modulusLen / 8; + + if((message = CC_XMALLOC(messageLen)) == NULL) return kCCMemoryFailure; + + tcReturn = rsa_exptmod(cipherText, cipherTextLen, message, messageLen, publicCryptor->keyType, &publicCryptor->key); + if(tcReturn) { + retval = kCCDecodeError; + goto out; + } + tcReturn = pkcs_1_v1_5_decode(message, messageLen, LTC_PKCS_1_EME, modulusLen, plainText, plainTextLen, &stat); + if(tcReturn) { + retval = kCCDecodeError; + goto out; + } + if(!stat) { + retval = kCCDecodeError; + goto out; + } + +out: + CC_XZEROMEM(message, messageLen); + CC_XFREE(message, messageLen); + return retval; +} + +#endif + + + Index: Source/API/CommonRandom.c ================================================================== --- Source/API/CommonRandom.c +++ Source/API/CommonRandom.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2006-2010 Apple Inc. All Rights Reserved. + * Copyright (c) 2012 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License @@ -19,57 +19,255 @@ * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ -/* - * CommonRandom.c - Access to PRNGs - * - * this code was modified from the original embedded SecRandomCopyBytes. +// #define COMMON_RANDOM_FUNCTIONS +#include "CommonRandomSPI.h" +#include +#include +#include +#include +#include +#include +#include "ccMemory.h" +#include "ccdebug.h" + + +/* + This is an internal structure used to represent the two types + of random number generators we're using. +*/ + +typedef struct __CCRandom { + uint32_t rngtype; + union { + struct ccrng_system_state *devrandom; + struct ccrng_CommonCrypto_state *drbg; + } state; + union { + uint8_t *bytes; + struct ccdrbg_info *drbg; + } info; + struct ccdrbg_state *drbg_state; +} ccInternalRandom, *ccInternalRandomRef; + +/* + The types of refs including "undefined" and "user created". +*/ + +static const uint32_t rng_undefined = 0; +static const uint32_t rng_default = 1; +static const uint32_t rng_devrandom = 2; +static const uint32_t rng_created = 99; + +/* + These are the two internal structures for a DRBG and /dev/random + based accessor. +*/ + +ccInternalRandom ccRandomDefaultStruct = { + .rngtype = rng_default, +}; + +ccInternalRandom ccRandomDevRandomStruct = { + .rngtype = rng_devrandom, +}; + +CCRandomRef kCCRandomDefault = &ccRandomDefaultStruct; +CCRandomRef kCCRandomDevRandom = &ccRandomDevRandomStruct; + +/* + Initialize (if necessary) and return the ccrng_state pointer for + the /dev/random rng. + */ + +struct ccrng_state * +ccDevRandomGetRngState() +{ + static dispatch_once_t rnginit; + dispatch_once(&rnginit, ^{ + kCCRandomDevRandom->state.devrandom = (struct ccrng_state *) CC_XMALLOC(sizeof(struct ccrng_system_state)); + ccrng_system_init(kCCRandomDevRandom->state.devrandom); + + }); + return kCCRandomDevRandom->state.devrandom; +} + +/* + Read bytes from /dev/random +*/ + +int +ccDevRandomReadBytes(void *ptr, size_t length) +{ + for(int retries = 5; retries && ccrng_generate(kCCRandomDevRandom->state.devrandom, length, ptr); retries--) + if(retries == 0) return -1; + return 0; +} + + + +/* + Initialize (if necessary) and return the ccrng_state pointer for + the DRBG. + */ + +static int +ccInitDRBG(ccInternalRandomRef drbg, struct ccdrbg_nistctr_custom *options, int function_options) +{ + CCRNGStatus retval = kCCSuccess; + //uint8_t entropy[64]; + //struct timeval now; + + //gettimeofday(&now, NULL); + // ccDevRandomGetRngState(); + // if(ccDevRandomReadBytes(entropy, sizeof(entropy))) return kCCDecodeError; + + + retval = kCCMemoryFailure; // errors following will be memory failures. + + if((drbg->info.drbg = CC_XMALLOC(sizeof(struct ccdrbg_info))) == NULL) goto errOut; + ccdrbg_factory_nistctr(drbg->info.drbg, options); + if((drbg->drbg_state = CC_XMALLOC(drbg->info.drbg->size)) == NULL) goto errOut; + if((drbg->state.drbg = CC_XMALLOC(sizeof(struct ccrng_CommonCrypto_state))) == NULL) goto errOut; + + if(ccrng_CommonCrypto_init(drbg->state.drbg, drbg->info.drbg, drbg->drbg_state, function_options)) { + retval = kCCDecodeError; + goto errOut; + } + + return 0; +errOut: + if(drbg->info.drbg) { + if(drbg->state.drbg) CC_XFREE(drbg->state.drbg, sizeof(struct ccrng_CommonCrypto_state)); + if(drbg->drbg_state) CC_XFREE(drbg->drbg_state, drbg->info.drbg->size); + CC_XFREE(drbg->info.drbg, sizeof(struct ccdrbg_info)); + } + return retval; +} + +#ifndef NDEBUG +#define ASSERT(s) +#else +#define ASSERT(s) assert(s) +#endif + +/* + Default DRGB setup */ - -#include "CommonRandomSPI.h" -#include "CommonCryptor.h" -#include -#include -#include -#include -#include -#include - - - -/* Default random ref for /dev/random. */ -CCRandomRef kCCRandomDefault = (CCRandomRef) NULL; - -/* File descriptor for "/dev/random". */ -static int kCCRandomFD; - -int CCRandomCopyBytes(CCRandomRef rnd, void *bytes, size_t count) { - static dispatch_once_t randopen; - - if (rnd != kCCRandomDefault) return kCCParamError; - - dispatch_once(&randopen, ^{ - kCCRandomFD = open("/dev/random", O_RDONLY); - if(kCCRandomFD > -1) fcntl(kCCRandomFD, F_SETFD, fcntl(kCCRandomFD, F_GETFD, 0) | FD_CLOEXEC); - }); - - if (kCCRandomFD < 0) return -1; - - while (count) { - ssize_t bytes_read = read(kCCRandomFD, bytes, count); - - if (bytes_read == -1) { - if (errno == EINTR) continue; - return -1; - } - - if (bytes_read == 0) return -1; - - bytes += bytes_read; - count -= bytes_read; - } - return kCCSuccess; -} +static const struct ccdrbg_nistctr_custom CCDRGBcustom = { + .ecb = &ccaes_ltc_ecb_encrypt_mode, + .keylen = 16, + .strictFIPS = 1, + .use_df = 1 +}; + +static struct ccdrbg_info CCDRGBinfo; +#define KNOWN_DRGB_STATE_SIZE 1160 +static uint8_t CCDRGBstate[KNOWN_DRGB_STATE_SIZE]; +struct ccrng_CommonCrypto_state CCDRGBrngstate; + +struct ccrng_state * +ccDRBGGetRngState() +{ + static dispatch_once_t rnginit; + + dispatch_once(&rnginit, ^{ + kCCRandomDefault->info.drbg = &CCDRGBinfo; + ccdrbg_factory_nistctr(kCCRandomDefault->info.drbg, &CCDRGBcustom); + ASSERT(kCCRandomDefault->info.drbg->size <= sizeof(CCDRGBstate)); + kCCRandomDefault->drbg_state = CCDRGBstate; + kCCRandomDefault->state.drbg = &CCDRGBrngstate; + if(ccrng_CommonCrypto_init(&CCDRGBrngstate, &CCDRGBinfo, CCDRGBstate, 0)) { + kCCRandomDefault = NULL; + } + }); + ASSERT(kCCRandomDefault != NULL); + if(kCCRandomDefault == NULL) return NULL; + return kCCRandomDefault->state.drbg; +} + + +/* + Read bytes from the DRBG +*/ + +int +ccDRBGReadBytes(struct ccrng_CommonCrypto_state *state, void *ptr, size_t length) +{ + ccrng_generate(state, length, ptr); + return 0; +} + + +CCRNGStatus +CCRNGCreate(uint32_t options, CCRandomRef *rngRef) +{ + CCRNGStatus retval; + ccInternalRandomRef ref; + struct ccdrbg_nistctr_custom custom_options; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ref = CC_XMALLOC(sizeof(ccInternalRandom)); + if(NULL == ref) return kCCMemoryFailure; + + ref->rngtype = rng_created; + // defaults + custom_options.ecb = &ccaes_ltc_ecb_encrypt_mode; + custom_options.keylen = 16; + custom_options.strictFIPS = 1; + custom_options.use_df = 1; + + if(retval = ccInitDRBG(ref, &custom_options, options)) return retval; + *rngRef = ref; + + return kCCSuccess; +} + +CCRNGStatus +CCRNGRelease(CCRandomRef rng) +{ + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + if(rng->rngtype == rng_created) { + ccrng_CommonCrypto_done(rng->state.drbg); + CC_XFREE(rng, sizeof(ccInternalRandom)); + } + return kCCSuccess; +} + +int CCRandomCopyBytes(CCRandomRef rnd, void *bytes, size_t count) +{ + struct ccrng_state *rng; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering rnd(NULL) = %s\n", (rnd == NULL) ? "TRUE": "FALSE"); + + + if(NULL == bytes) return -1; + if(0 == count) return 0; + if(NULL == rnd) { + rng = ccDRBGGetRngState(); + return ccDRBGReadBytes(rng, bytes, count); + } + + switch(rnd->rngtype) { + case rng_default: + rng = ccDRBGGetRngState(); + return ccDRBGReadBytes(rng, bytes, count); + break; + case rng_devrandom: + rng = ccDevRandomGetRngState(); + return ccDevRandomReadBytes(bytes, count); + break; + case rng_created: + return ccDRBGReadBytes(rnd->state.drbg, bytes, count); + break; + default: // we can get bytes from the DRBG + rng = ccDRBGGetRngState(); + return ccDRBGReadBytes(rng, bytes, count); + break; + } +} + + Index: Source/API/CommonSymmetricKeywrap.c ================================================================== --- Source/API/CommonSymmetricKeywrap.c +++ Source/API/CommonSymmetricKeywrap.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * Copyright (c) 2012 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License @@ -19,100 +19,36 @@ * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ +// #define COMMON_SYMMETRIC_KEYWRAP_FUNCTIONS #include "CommonSymmetricKeywrap.h" +#include "CommonCryptor.h" +#include "CommonCryptorPriv.h" #include -#include -#include +#include "ccdebug.h" -static const uint8_t rfc3394_iv_data[] = { 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6 }; +static const uint8_t rfc3394_iv_data[] = { 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, + 0xA6, 0xA6 }; const uint8_t* CCrfc3394_iv = rfc3394_iv_data; const size_t CCrfc3394_ivLen = sizeof(rfc3394_iv_data); static uint64_t -pack64(uint8_t *iv, size_t ivLen) +pack64(const uint8_t *iv, size_t ivLen) { uint64_t retval; int i; - for(i=0, retval=0; i<8; i++) retval = (retval<<8) + iv[i]; + for(i=0, retval=0; i<8; i++) + retval = (retval<<8) + iv[i]; return retval; } -#if KERNEL - -#include -#include - -#define AES128_KEK 1 -#define AES192_KEK 0 -#define AES256_KEK 0 - -#define debug kprintf - -static bool -aes_operation(bool encrypt, const uint8_t *kek, size_t kek_len, uint8_t *block) -{ - uint64_t iv[2] = { 0 }; - - if (encrypt) { - aes_encrypt_ctx encrypt_ctx[1]; - switch(kek_len) { -#if AES128_KEK - case 16: aes_encrypt_key128(kek, encrypt_ctx); break; -#endif -#if AES192_KEK - case 24: aes_encrypt_key192(kek, encrypt_ctx); break; -#endif -#if AES256_KEK - case 32: aes_encrypt_key256(kek, encrypt_ctx); break; -#endif - default: return false; - } - aes_encrypt_cbc(block, (uint8_t*)iv, 1, block, encrypt_ctx); - } else { - aes_decrypt_ctx decrypt_ctx[1]; - switch(kek_len) { -#if AES128_KEK - case 16: aes_decrypt_key128(kek, decrypt_ctx); break; -#endif -#if AES192_KEK - case 24: aes_decrypt_key192(kek, decrypt_ctx); break; -#endif -#if AES256_KEK - case 32: aes_decrypt_key256(kek, decrypt_ctx); break; -#endif - default: return false; - } - aes_decrypt_cbc(block, (uint8_t*)iv, 1, block, decrypt_ctx); - } - - return true; -} - -#else - -#include "CommonCryptor.h" - -#define debug printf - -static bool -aes_operation(bool encrypt, const uint8_t *kek, size_t kek_len, uint8_t *block) -{ - uint64_t iv[2] = { 0 }; - size_t bytes_moved = 0; - - return (0 == CCCrypt(encrypt? kCCEncrypt : kCCDecrypt, - kCCAlgorithmAES128, 0, kek, kek_len, iv, - block, kCCBlockSizeAES128, - block, kCCBlockSizeAES128, &bytes_moved)); -} -#endif + /* 1) Initialize variables. @@ -145,17 +81,20 @@ const uint8_t *rawKey, size_t rawKeyLen, uint8_t *wrappedKey, size_t *wrappedKeyLen) { uint32_t n = rawKeyLen / 8; /* key size in 64 bit blocks */ uint64_t (*R)[2]; /* R is a two-dimensional array, with n rows of 2 columns */ - int i, j, err; - - // allocate R + int i, j, err = 0; + struct ccmode_ecb *ccmode = getCipherMode(kCCAlgorithmAES128, kCCModeECB, kCCEncrypt).ecb; + + CC_DEBUG_LOG(ASL_LEVEL_ERR, "Entering\n"); + ccecb_ctx_decl(ccmode->size, ctx); R = calloc(n, sizeof(uint64_t[2])); - require_action(R, out, err = -1); + // don't wrap with something smaller - require_action(rawKeyLen >= kekLen, out, err = -1); + // require_action(rawKeyLen <= kekLen, out, err = -1); + // kek multiple of 64 bits: 128, 192, 256 require_action(kekLen == 16 || kekLen == 24 || kekLen == 32, out, err = -1); // wrapped_key_len 64 bits larger than key_len require_action(wrappedKeyLen && (*wrappedKeyLen >= rawKeyLen + 64/8), out, err = -1); @@ -165,26 +104,31 @@ uint64_t kek_iv = pack64(iv, ivLen); R[0][0] = kek_iv; + ccmode->init(ccmode, &ctx, kekLen, kek); + for (j = 0; j < 6; j++) { for (i = 0; i < n; i++) { - require_action(aes_operation(true, kek, kekLen, (uint8_t*)&R[i][0]), out, err = -1); + ccmode->ecb(&ctx, 1, (uint8_t*)&R[i][0], (uint8_t*)&R[i][0]); R[(i + 1) % n][0] = R[i][0] ^ _OSSwapInt64((n*j)+i+1); } } // write output memcpy(wrappedKey, &R[0][0], 8); for (i = 0; i < n; i++) memcpy(wrappedKey + 8 + i * 8, &R[i][1], 8); - err = 0; + for(i=0; isize, ctx); + R = calloc(n, sizeof(uint64_t[2])); - require_action(R, out, err = -1); - // kek multiple of 64 bits: 128, 192, 256 - require_action(kekLen == 16 || kekLen == 32, out, err = -1); + + // kek multiple of 64 bits: 128, 192, 256 + require_action(kekLen == 16 || kekLen == 24 || kekLen == 32, out, err = -1); // wrapped_key_len 64 bits larger than key_len - require_action(rawKeyLen && (*rawKeyLen >= wrappedKeyLen - 64/8), out, err = -1); + // require_action(rawKeyLen && (*rawKeyLen <= wrappedKeyLen - 64/8), out, err = -1); // R[0][1] = C[0] ... R[1][n-1] = C[n-1] memcpy(&R[0][0], wrappedKey, 64/8); for (i = 0; i < n; i++) memcpy(&R[i][1], wrappedKey + (64/8) * (i+1), 64/8); + ccmode->init(ccmode, &ctx, kekLen, kek); for (j = 5; j >= 0; j--) { for (i = n - 1; i >= 0; i--) { - R[i][0] = R[(i + 1) % n][0] ^ _OSSwapInt64((n*j)+i+1); - require_action(aes_operation(false, kek, kekLen, (uint8_t*)&R[i][0]), out, err = -1); + R[i][0] = R[(i + 1) % n][0] ^ _OSSwapInt64((n*j)+i+1); + ccmode->ecb(&ctx, 1, (uint8_t*)&R[i][0], (uint8_t*)&R[i][0]); } } uint64_t kek_iv = pack64(iv, ivLen); @@ -229,30 +177,34 @@ for (i = 0; i < n; i++) memcpy(rawKey + i * 8, &R[i][1], 8); // clean all stack variables - err = 0; - + for(i=0; i -#include "cast_lcl.h" - -#ifndef _APPLE_COMMON_CRYPTO_ -#include - -const char *CAST_version="CAST" OPENSSL_VERSION_PTEXT; -#endif /* _APPLE_COMMON_CRYPTO_ */ - -void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, - CAST_KEY *ks, int enc) - { - CAST_LONG l,d[2]; - - n2l(in,l); d[0]=l; - n2l(in,l); d[1]=l; - if (enc) - CAST_encrypt(d,ks); - else - CAST_decrypt(d,ks); - l=d[0]; l2n(l,out); - l=d[1]; l2n(l,out); - l=d[0]=d[1]=0; - } - DELETED Source/CAST/c_enc.c Index: Source/CAST/c_enc.c ================================================================== --- Source/CAST/c_enc.c +++ /dev/null @@ -1,210 +0,0 @@ -/* crypto/cast/c_enc.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include "cast_lcl.h" - -void CAST_encrypt(CAST_LONG *data, CAST_KEY *key) - { - register CAST_LONG l,r,*k,t; - - k= &(key->data[0]); - l=data[0]; - r=data[1]; - - E_CAST( 0,k,l,r,+,^,-); - E_CAST( 1,k,r,l,^,-,+); - E_CAST( 2,k,l,r,-,+,^); - E_CAST( 3,k,r,l,+,^,-); - E_CAST( 4,k,l,r,^,-,+); - E_CAST( 5,k,r,l,-,+,^); - E_CAST( 6,k,l,r,+,^,-); - E_CAST( 7,k,r,l,^,-,+); - E_CAST( 8,k,l,r,-,+,^); - E_CAST( 9,k,r,l,+,^,-); - E_CAST(10,k,l,r,^,-,+); - E_CAST(11,k,r,l,-,+,^); - if(!key->short_key) - { - E_CAST(12,k,l,r,+,^,-); - E_CAST(13,k,r,l,^,-,+); - E_CAST(14,k,l,r,-,+,^); - E_CAST(15,k,r,l,+,^,-); - } - - data[1]=l&0xffffffffL; - data[0]=r&0xffffffffL; - } - -void CAST_decrypt(CAST_LONG *data, CAST_KEY *key) - { - register CAST_LONG l,r,*k,t; - - k= &(key->data[0]); - l=data[0]; - r=data[1]; - - if(!key->short_key) - { - E_CAST(15,k,l,r,+,^,-); - E_CAST(14,k,r,l,-,+,^); - E_CAST(13,k,l,r,^,-,+); - E_CAST(12,k,r,l,+,^,-); - } - E_CAST(11,k,l,r,-,+,^); - E_CAST(10,k,r,l,^,-,+); - E_CAST( 9,k,l,r,+,^,-); - E_CAST( 8,k,r,l,-,+,^); - E_CAST( 7,k,l,r,^,-,+); - E_CAST( 6,k,r,l,+,^,-); - E_CAST( 5,k,l,r,-,+,^); - E_CAST( 4,k,r,l,^,-,+); - E_CAST( 3,k,l,r,+,^,-); - E_CAST( 2,k,r,l,-,+,^); - E_CAST( 1,k,l,r,^,-,+); - E_CAST( 0,k,r,l,+,^,-); - - data[1]=l&0xffffffffL; - data[0]=r&0xffffffffL; - } - -#ifndef _APPLE_COMMON_CRYPTO_ -/* CBC logic not needed here */ -void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - CAST_KEY *ks, unsigned char *iv, int enc) - { - register CAST_LONG tin0,tin1; - register CAST_LONG tout0,tout1,xor0,xor1; - register long l=length; - CAST_LONG tin[2]; - - if (enc) - { - n2l(iv,tout0); - n2l(iv,tout1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - n2l(in,tin0); - n2l(in,tin1); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - CAST_encrypt(tin,ks); - tout0=tin[0]; - tout1=tin[1]; - l2n(tout0,out); - l2n(tout1,out); - } - if (l != -8) - { - n2ln(in,tin0,tin1,l+8); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - CAST_encrypt(tin,ks); - tout0=tin[0]; - tout1=tin[1]; - l2n(tout0,out); - l2n(tout1,out); - } - l2n(tout0,iv); - l2n(tout1,iv); - } - else - { - n2l(iv,xor0); - n2l(iv,xor1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - n2l(in,tin0); - n2l(in,tin1); - tin[0]=tin0; - tin[1]=tin1; - CAST_decrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2n(tout0,out); - l2n(tout1,out); - xor0=tin0; - xor1=tin1; - } - if (l != -8) - { - n2l(in,tin0); - n2l(in,tin1); - tin[0]=tin0; - tin[1]=tin1; - CAST_decrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2nn(tout0,tout1,out,l+8); - xor0=tin0; - xor1=tin1; - } - l2n(xor0,iv); - l2n(xor1,iv); - } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; - } - -#endif /* _APPLE_COMMON_CRYPTO_ */ DELETED Source/CAST/c_skey.c Index: Source/CAST/c_skey.c ================================================================== --- Source/CAST/c_skey.c +++ /dev/null @@ -1,166 +0,0 @@ -/* crypto/cast/c_skey.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include "cast_lcl.h" -#include "cast_s.h" - -#define CAST_exp(l,A,a,n) \ - A[n/4]=l; \ - a[n+3]=(l )&0xff; \ - a[n+2]=(l>> 8)&0xff; \ - a[n+1]=(l>>16)&0xff; \ - a[n+0]=(l>>24)&0xff; - -#define S4 CAST_S_table4 -#define S5 CAST_S_table5 -#define S6 CAST_S_table6 -#define S7 CAST_S_table7 - -void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data) - { - CAST_LONG x[16]; - CAST_LONG z[16]; - CAST_LONG k[32]; - CAST_LONG X[4],Z[4]; - CAST_LONG l,*K; - int i; - - for (i=0; i<16; i++) x[i]=0; - if (len > 16) len=16; - for (i=0; ishort_key=1; - else - key->short_key=0; - - K= &k[0]; - X[0]=((x[ 0]<<24)|(x[ 1]<<16)|(x[ 2]<<8)|x[ 3])&0xffffffffL; - X[1]=((x[ 4]<<24)|(x[ 5]<<16)|(x[ 6]<<8)|x[ 7])&0xffffffffL; - X[2]=((x[ 8]<<24)|(x[ 9]<<16)|(x[10]<<8)|x[11])&0xffffffffL; - X[3]=((x[12]<<24)|(x[13]<<16)|(x[14]<<8)|x[15])&0xffffffffL; - - for (;;) - { - l=X[0]^S4[x[13]]^S5[x[15]]^S6[x[12]]^S7[x[14]]^S6[x[ 8]]; - CAST_exp(l,Z,z, 0); - l=X[2]^S4[z[ 0]]^S5[z[ 2]]^S6[z[ 1]]^S7[z[ 3]]^S7[x[10]]; - CAST_exp(l,Z,z, 4); - l=X[3]^S4[z[ 7]]^S5[z[ 6]]^S6[z[ 5]]^S7[z[ 4]]^S4[x[ 9]]; - CAST_exp(l,Z,z, 8); - l=X[1]^S4[z[10]]^S5[z[ 9]]^S6[z[11]]^S7[z[ 8]]^S5[x[11]]; - CAST_exp(l,Z,z,12); - - K[ 0]= S4[z[ 8]]^S5[z[ 9]]^S6[z[ 7]]^S7[z[ 6]]^S4[z[ 2]]; - K[ 1]= S4[z[10]]^S5[z[11]]^S6[z[ 5]]^S7[z[ 4]]^S5[z[ 6]]; - K[ 2]= S4[z[12]]^S5[z[13]]^S6[z[ 3]]^S7[z[ 2]]^S6[z[ 9]]; - K[ 3]= S4[z[14]]^S5[z[15]]^S6[z[ 1]]^S7[z[ 0]]^S7[z[12]]; - - l=Z[2]^S4[z[ 5]]^S5[z[ 7]]^S6[z[ 4]]^S7[z[ 6]]^S6[z[ 0]]; - CAST_exp(l,X,x, 0); - l=Z[0]^S4[x[ 0]]^S5[x[ 2]]^S6[x[ 1]]^S7[x[ 3]]^S7[z[ 2]]; - CAST_exp(l,X,x, 4); - l=Z[1]^S4[x[ 7]]^S5[x[ 6]]^S6[x[ 5]]^S7[x[ 4]]^S4[z[ 1]]; - CAST_exp(l,X,x, 8); - l=Z[3]^S4[x[10]]^S5[x[ 9]]^S6[x[11]]^S7[x[ 8]]^S5[z[ 3]]; - CAST_exp(l,X,x,12); - - K[ 4]= S4[x[ 3]]^S5[x[ 2]]^S6[x[12]]^S7[x[13]]^S4[x[ 8]]; - K[ 5]= S4[x[ 1]]^S5[x[ 0]]^S6[x[14]]^S7[x[15]]^S5[x[13]]; - K[ 6]= S4[x[ 7]]^S5[x[ 6]]^S6[x[ 8]]^S7[x[ 9]]^S6[x[ 3]]; - K[ 7]= S4[x[ 5]]^S5[x[ 4]]^S6[x[10]]^S7[x[11]]^S7[x[ 7]]; - - l=X[0]^S4[x[13]]^S5[x[15]]^S6[x[12]]^S7[x[14]]^S6[x[ 8]]; - CAST_exp(l,Z,z, 0); - l=X[2]^S4[z[ 0]]^S5[z[ 2]]^S6[z[ 1]]^S7[z[ 3]]^S7[x[10]]; - CAST_exp(l,Z,z, 4); - l=X[3]^S4[z[ 7]]^S5[z[ 6]]^S6[z[ 5]]^S7[z[ 4]]^S4[x[ 9]]; - CAST_exp(l,Z,z, 8); - l=X[1]^S4[z[10]]^S5[z[ 9]]^S6[z[11]]^S7[z[ 8]]^S5[x[11]]; - CAST_exp(l,Z,z,12); - - K[ 8]= S4[z[ 3]]^S5[z[ 2]]^S6[z[12]]^S7[z[13]]^S4[z[ 9]]; - K[ 9]= S4[z[ 1]]^S5[z[ 0]]^S6[z[14]]^S7[z[15]]^S5[z[12]]; - K[10]= S4[z[ 7]]^S5[z[ 6]]^S6[z[ 8]]^S7[z[ 9]]^S6[z[ 2]]; - K[11]= S4[z[ 5]]^S5[z[ 4]]^S6[z[10]]^S7[z[11]]^S7[z[ 6]]; - - l=Z[2]^S4[z[ 5]]^S5[z[ 7]]^S6[z[ 4]]^S7[z[ 6]]^S6[z[ 0]]; - CAST_exp(l,X,x, 0); - l=Z[0]^S4[x[ 0]]^S5[x[ 2]]^S6[x[ 1]]^S7[x[ 3]]^S7[z[ 2]]; - CAST_exp(l,X,x, 4); - l=Z[1]^S4[x[ 7]]^S5[x[ 6]]^S6[x[ 5]]^S7[x[ 4]]^S4[z[ 1]]; - CAST_exp(l,X,x, 8); - l=Z[3]^S4[x[10]]^S5[x[ 9]]^S6[x[11]]^S7[x[ 8]]^S5[z[ 3]]; - CAST_exp(l,X,x,12); - - K[12]= S4[x[ 8]]^S5[x[ 9]]^S6[x[ 7]]^S7[x[ 6]]^S4[x[ 3]]; - K[13]= S4[x[10]]^S5[x[11]]^S6[x[ 5]]^S7[x[ 4]]^S5[x[ 7]]; - K[14]= S4[x[12]]^S5[x[13]]^S6[x[ 3]]^S7[x[ 2]]^S6[x[ 8]]; - K[15]= S4[x[14]]^S5[x[15]]^S6[x[ 1]]^S7[x[ 0]]^S7[x[13]]; - if (K != k) break; - K+=16; - } - - for (i=0; i<16; i++) - { - key->data[i*2]=k[i]; - key->data[i*2+1]=((k[i+16])+16)&0x1f; - } - } - DELETED Source/CAST/cast_lcl.h Index: Source/CAST/cast_lcl.h ================================================================== --- Source/CAST/cast_lcl.h +++ /dev/null @@ -1,258 +0,0 @@ -/* crypto/cast/cast_lcl.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifdef WIN32 -#include -#endif - -#include - -#define OPENSSL_EXTERN extern -//#include "openssl/e_os.h" /* OPENSSL_EXTERN */ - -#undef c2l -#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ - l|=((unsigned long)(*((c)++)))<< 8L, \ - l|=((unsigned long)(*((c)++)))<<16L, \ - l|=((unsigned long)(*((c)++)))<<24L) - -/* NOTE - c is not incremented as per c2l */ -#undef c2ln -#define c2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ - case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ - case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ - case 5: l2|=((unsigned long)(*(--(c)))); \ - case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ - case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ - case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ - case 1: l1|=((unsigned long)(*(--(c)))); \ - } \ - } - -#undef l2c -#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>24L)&0xff)) - -/* NOTE - c is not incremented as per l2c */ -#undef l2cn -#define l2cn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ - } \ - } - -/* NOTE - c is not incremented as per n2l */ -#define n2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((unsigned long)(*(--(c)))) ; \ - case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ - case 6: l2|=((unsigned long)(*(--(c))))<<16; \ - case 5: l2|=((unsigned long)(*(--(c))))<<24; \ - case 4: l1 =((unsigned long)(*(--(c)))) ; \ - case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ - case 2: l1|=((unsigned long)(*(--(c))))<<16; \ - case 1: l1|=((unsigned long)(*(--(c))))<<24; \ - } \ - } - -/* NOTE - c is not incremented as per l2n */ -#define l2nn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ - } \ - } - -#undef n2l -#if defined(__GNUC__) && defined(__ppc__) -/* alignment tolerant big-endian optimization */ - #define n2l(c,l) { l= *((unsigned long *)c); c += 4; } -#else -/* little endian, etc. */ - #define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ - l|=((unsigned long)(*((c)++)))<<16L, \ - l|=((unsigned long)(*((c)++)))<< 8L, \ - l|=((unsigned long)(*((c)++)))) -#endif - -#undef l2n -#if defined(__GNUC__) && defined(__ppc__) - /* alignment tolerant big-endian optimization */ - #define l2n(l,c) { *((unsigned long *)c) = l; c += 4; } -#else - /* little endian, etc. */ - #define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l) )&0xff)) - -#endif /* GNU, big endian */ - -#if defined(WIN32) && defined(_MSC_VER) -#define ROTL(a,n) (_lrotl(a,n)) -#else -#define ROTL(a,n) ((((a)<<(n))&0xffffffffL)|((a)>>(32-(n)))) -#endif - -#define C_M 0x3fc -#define C_0 22L -#define C_1 14L -#define C_2 6L -#define C_3 2L /* left shift */ - -/* The rotate has an extra 16 added to it to help the x86 asm */ -#if defined(CAST_PTR) -#define E_CAST(n,key,L,R,OP1,OP2,OP3) \ - { \ - int i; \ - t=(key[n*2] OP1 R)&0xffffffffL; \ - i=key[n*2+1]; \ - t=ROTL(t,i); \ - L^= (((((*(CAST_LONG *)((unsigned char *) \ - CAST_S_table0+((t>>C_2)&C_M)) OP2 \ - *(CAST_LONG *)((unsigned char *) \ - CAST_S_table1+((t<>C_0)&C_M)))&0xffffffffL) OP1 \ - *(CAST_LONG *)((unsigned char *) \ - CAST_S_table3+((t>>C_1)&C_M)))&0xffffffffL; \ - } -#elif defined(CAST_PTR2) -#define E_CAST(n,key,L,R,OP1,OP2,OP3) \ - { \ - int i; \ - CAST_LONG u,v,w; \ - w=(key[n*2] OP1 R)&0xffffffffL; \ - i=key[n*2+1]; \ - w=ROTL(w,i); \ - u=w>>C_2; \ - v=w<>C_0; \ - t=(t OP2 *(CAST_LONG *)((unsigned char *)CAST_S_table1+v))&0xffffffffL;\ - v=w>>C_1; \ - u&=C_M; \ - v&=C_M; \ - t=(t OP3 *(CAST_LONG *)((unsigned char *)CAST_S_table2+u)&0xffffffffL);\ - t=(t OP1 *(CAST_LONG *)((unsigned char *)CAST_S_table3+v)&0xffffffffL);\ - L^=(t&0xffffffff); \ - } -#else -#define E_CAST(n,key,L,R,OP1,OP2,OP3) \ - { \ - CAST_LONG a,b,c,d; \ - t=(key[n*2] OP1 R)&0xffffffff; \ - t=ROTL(t,(key[n*2+1])); \ - a=CAST_S_table0[(t>> 8)&0xff]; \ - b=CAST_S_table1[(t )&0xff]; \ - c=CAST_S_table2[(t>>24)&0xff]; \ - d=CAST_S_table3[(t>>16)&0xff]; \ - L^=(((((a OP2 b)&0xffffffffL) OP3 c)&0xffffffffL) OP1 d)&0xffffffffL; \ - } -#endif - -#ifdef _APPLE_COMMON_CRYPTO_ -/* CommonCrypto defines */ -#define OPENSSL_GLOBAL -/* - * These rename this tables to avoid symbols collision between libSystem - * and libcrypto. - */ -#define CAST_S_table0 CC_CAST_S_table0 -#define CAST_S_table1 CC_CAST_S_table1 -#define CAST_S_table2 CC_CAST_S_table2 -#define CAST_S_table3 CC_CAST_S_table3 -#define CAST_S_table4 CC_CAST_S_table4 -#define CAST_S_table5 CC_CAST_S_table5 -#define CAST_S_table6 CC_CAST_S_table6 -#define CAST_S_table7 CC_CAST_S_table7 -#endif /* _APPLE_COMMON_CRYPTO_ */ - -OPENSSL_EXTERN const CAST_LONG CAST_S_table0[256]; -OPENSSL_EXTERN const CAST_LONG CAST_S_table1[256]; -OPENSSL_EXTERN const CAST_LONG CAST_S_table2[256]; -OPENSSL_EXTERN const CAST_LONG CAST_S_table3[256]; -OPENSSL_EXTERN const CAST_LONG CAST_S_table4[256]; -OPENSSL_EXTERN const CAST_LONG CAST_S_table5[256]; -OPENSSL_EXTERN const CAST_LONG CAST_S_table6[256]; -OPENSSL_EXTERN const CAST_LONG CAST_S_table7[256]; DELETED Source/CAST/cast_s.h Index: Source/CAST/cast_s.h ================================================================== --- Source/CAST/cast_s.h +++ /dev/null @@ -1,586 +0,0 @@ -/* crypto/cast/cast_s.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -OPENSSL_GLOBAL const CAST_LONG CAST_S_table0[256]={ - 0x30fb40d4,0x9fa0ff0b,0x6beccd2f,0x3f258c7a, - 0x1e213f2f,0x9c004dd3,0x6003e540,0xcf9fc949, - 0xbfd4af27,0x88bbbdb5,0xe2034090,0x98d09675, - 0x6e63a0e0,0x15c361d2,0xc2e7661d,0x22d4ff8e, - 0x28683b6f,0xc07fd059,0xff2379c8,0x775f50e2, - 0x43c340d3,0xdf2f8656,0x887ca41a,0xa2d2bd2d, - 0xa1c9e0d6,0x346c4819,0x61b76d87,0x22540f2f, - 0x2abe32e1,0xaa54166b,0x22568e3a,0xa2d341d0, - 0x66db40c8,0xa784392f,0x004dff2f,0x2db9d2de, - 0x97943fac,0x4a97c1d8,0x527644b7,0xb5f437a7, - 0xb82cbaef,0xd751d159,0x6ff7f0ed,0x5a097a1f, - 0x827b68d0,0x90ecf52e,0x22b0c054,0xbc8e5935, - 0x4b6d2f7f,0x50bb64a2,0xd2664910,0xbee5812d, - 0xb7332290,0xe93b159f,0xb48ee411,0x4bff345d, - 0xfd45c240,0xad31973f,0xc4f6d02e,0x55fc8165, - 0xd5b1caad,0xa1ac2dae,0xa2d4b76d,0xc19b0c50, - 0x882240f2,0x0c6e4f38,0xa4e4bfd7,0x4f5ba272, - 0x564c1d2f,0xc59c5319,0xb949e354,0xb04669fe, - 0xb1b6ab8a,0xc71358dd,0x6385c545,0x110f935d, - 0x57538ad5,0x6a390493,0xe63d37e0,0x2a54f6b3, - 0x3a787d5f,0x6276a0b5,0x19a6fcdf,0x7a42206a, - 0x29f9d4d5,0xf61b1891,0xbb72275e,0xaa508167, - 0x38901091,0xc6b505eb,0x84c7cb8c,0x2ad75a0f, - 0x874a1427,0xa2d1936b,0x2ad286af,0xaa56d291, - 0xd7894360,0x425c750d,0x93b39e26,0x187184c9, - 0x6c00b32d,0x73e2bb14,0xa0bebc3c,0x54623779, - 0x64459eab,0x3f328b82,0x7718cf82,0x59a2cea6, - 0x04ee002e,0x89fe78e6,0x3fab0950,0x325ff6c2, - 0x81383f05,0x6963c5c8,0x76cb5ad6,0xd49974c9, - 0xca180dcf,0x380782d5,0xc7fa5cf6,0x8ac31511, - 0x35e79e13,0x47da91d0,0xf40f9086,0xa7e2419e, - 0x31366241,0x051ef495,0xaa573b04,0x4a805d8d, - 0x548300d0,0x00322a3c,0xbf64cddf,0xba57a68e, - 0x75c6372b,0x50afd341,0xa7c13275,0x915a0bf5, - 0x6b54bfab,0x2b0b1426,0xab4cc9d7,0x449ccd82, - 0xf7fbf265,0xab85c5f3,0x1b55db94,0xaad4e324, - 0xcfa4bd3f,0x2deaa3e2,0x9e204d02,0xc8bd25ac, - 0xeadf55b3,0xd5bd9e98,0xe31231b2,0x2ad5ad6c, - 0x954329de,0xadbe4528,0xd8710f69,0xaa51c90f, - 0xaa786bf6,0x22513f1e,0xaa51a79b,0x2ad344cc, - 0x7b5a41f0,0xd37cfbad,0x1b069505,0x41ece491, - 0xb4c332e6,0x032268d4,0xc9600acc,0xce387e6d, - 0xbf6bb16c,0x6a70fb78,0x0d03d9c9,0xd4df39de, - 0xe01063da,0x4736f464,0x5ad328d8,0xb347cc96, - 0x75bb0fc3,0x98511bfb,0x4ffbcc35,0xb58bcf6a, - 0xe11f0abc,0xbfc5fe4a,0xa70aec10,0xac39570a, - 0x3f04442f,0x6188b153,0xe0397a2e,0x5727cb79, - 0x9ceb418f,0x1cacd68d,0x2ad37c96,0x0175cb9d, - 0xc69dff09,0xc75b65f0,0xd9db40d8,0xec0e7779, - 0x4744ead4,0xb11c3274,0xdd24cb9e,0x7e1c54bd, - 0xf01144f9,0xd2240eb1,0x9675b3fd,0xa3ac3755, - 0xd47c27af,0x51c85f4d,0x56907596,0xa5bb15e6, - 0x580304f0,0xca042cf1,0x011a37ea,0x8dbfaadb, - 0x35ba3e4a,0x3526ffa0,0xc37b4d09,0xbc306ed9, - 0x98a52666,0x5648f725,0xff5e569d,0x0ced63d0, - 0x7c63b2cf,0x700b45e1,0xd5ea50f1,0x85a92872, - 0xaf1fbda7,0xd4234870,0xa7870bf3,0x2d3b4d79, - 0x42e04198,0x0cd0ede7,0x26470db8,0xf881814c, - 0x474d6ad7,0x7c0c5e5c,0xd1231959,0x381b7298, - 0xf5d2f4db,0xab838653,0x6e2f1e23,0x83719c9e, - 0xbd91e046,0x9a56456e,0xdc39200c,0x20c8c571, - 0x962bda1c,0xe1e696ff,0xb141ab08,0x7cca89b9, - 0x1a69e783,0x02cc4843,0xa2f7c579,0x429ef47d, - 0x427b169c,0x5ac9f049,0xdd8f0f00,0x5c8165bf, - }; -OPENSSL_GLOBAL const CAST_LONG CAST_S_table1[256]={ - 0x1f201094,0xef0ba75b,0x69e3cf7e,0x393f4380, - 0xfe61cf7a,0xeec5207a,0x55889c94,0x72fc0651, - 0xada7ef79,0x4e1d7235,0xd55a63ce,0xde0436ba, - 0x99c430ef,0x5f0c0794,0x18dcdb7d,0xa1d6eff3, - 0xa0b52f7b,0x59e83605,0xee15b094,0xe9ffd909, - 0xdc440086,0xef944459,0xba83ccb3,0xe0c3cdfb, - 0xd1da4181,0x3b092ab1,0xf997f1c1,0xa5e6cf7b, - 0x01420ddb,0xe4e7ef5b,0x25a1ff41,0xe180f806, - 0x1fc41080,0x179bee7a,0xd37ac6a9,0xfe5830a4, - 0x98de8b7f,0x77e83f4e,0x79929269,0x24fa9f7b, - 0xe113c85b,0xacc40083,0xd7503525,0xf7ea615f, - 0x62143154,0x0d554b63,0x5d681121,0xc866c359, - 0x3d63cf73,0xcee234c0,0xd4d87e87,0x5c672b21, - 0x071f6181,0x39f7627f,0x361e3084,0xe4eb573b, - 0x602f64a4,0xd63acd9c,0x1bbc4635,0x9e81032d, - 0x2701f50c,0x99847ab4,0xa0e3df79,0xba6cf38c, - 0x10843094,0x2537a95e,0xf46f6ffe,0xa1ff3b1f, - 0x208cfb6a,0x8f458c74,0xd9e0a227,0x4ec73a34, - 0xfc884f69,0x3e4de8df,0xef0e0088,0x3559648d, - 0x8a45388c,0x1d804366,0x721d9bfd,0xa58684bb, - 0xe8256333,0x844e8212,0x128d8098,0xfed33fb4, - 0xce280ae1,0x27e19ba5,0xd5a6c252,0xe49754bd, - 0xc5d655dd,0xeb667064,0x77840b4d,0xa1b6a801, - 0x84db26a9,0xe0b56714,0x21f043b7,0xe5d05860, - 0x54f03084,0x066ff472,0xa31aa153,0xdadc4755, - 0xb5625dbf,0x68561be6,0x83ca6b94,0x2d6ed23b, - 0xeccf01db,0xa6d3d0ba,0xb6803d5c,0xaf77a709, - 0x33b4a34c,0x397bc8d6,0x5ee22b95,0x5f0e5304, - 0x81ed6f61,0x20e74364,0xb45e1378,0xde18639b, - 0x881ca122,0xb96726d1,0x8049a7e8,0x22b7da7b, - 0x5e552d25,0x5272d237,0x79d2951c,0xc60d894c, - 0x488cb402,0x1ba4fe5b,0xa4b09f6b,0x1ca815cf, - 0xa20c3005,0x8871df63,0xb9de2fcb,0x0cc6c9e9, - 0x0beeff53,0xe3214517,0xb4542835,0x9f63293c, - 0xee41e729,0x6e1d2d7c,0x50045286,0x1e6685f3, - 0xf33401c6,0x30a22c95,0x31a70850,0x60930f13, - 0x73f98417,0xa1269859,0xec645c44,0x52c877a9, - 0xcdff33a6,0xa02b1741,0x7cbad9a2,0x2180036f, - 0x50d99c08,0xcb3f4861,0xc26bd765,0x64a3f6ab, - 0x80342676,0x25a75e7b,0xe4e6d1fc,0x20c710e6, - 0xcdf0b680,0x17844d3b,0x31eef84d,0x7e0824e4, - 0x2ccb49eb,0x846a3bae,0x8ff77888,0xee5d60f6, - 0x7af75673,0x2fdd5cdb,0xa11631c1,0x30f66f43, - 0xb3faec54,0x157fd7fa,0xef8579cc,0xd152de58, - 0xdb2ffd5e,0x8f32ce19,0x306af97a,0x02f03ef8, - 0x99319ad5,0xc242fa0f,0xa7e3ebb0,0xc68e4906, - 0xb8da230c,0x80823028,0xdcdef3c8,0xd35fb171, - 0x088a1bc8,0xbec0c560,0x61a3c9e8,0xbca8f54d, - 0xc72feffa,0x22822e99,0x82c570b4,0xd8d94e89, - 0x8b1c34bc,0x301e16e6,0x273be979,0xb0ffeaa6, - 0x61d9b8c6,0x00b24869,0xb7ffce3f,0x08dc283b, - 0x43daf65a,0xf7e19798,0x7619b72f,0x8f1c9ba4, - 0xdc8637a0,0x16a7d3b1,0x9fc393b7,0xa7136eeb, - 0xc6bcc63e,0x1a513742,0xef6828bc,0x520365d6, - 0x2d6a77ab,0x3527ed4b,0x821fd216,0x095c6e2e, - 0xdb92f2fb,0x5eea29cb,0x145892f5,0x91584f7f, - 0x5483697b,0x2667a8cc,0x85196048,0x8c4bacea, - 0x833860d4,0x0d23e0f9,0x6c387e8a,0x0ae6d249, - 0xb284600c,0xd835731d,0xdcb1c647,0xac4c56ea, - 0x3ebd81b3,0x230eabb0,0x6438bc87,0xf0b5b1fa, - 0x8f5ea2b3,0xfc184642,0x0a036b7a,0x4fb089bd, - 0x649da589,0xa345415e,0x5c038323,0x3e5d3bb9, - 0x43d79572,0x7e6dd07c,0x06dfdf1e,0x6c6cc4ef, - 0x7160a539,0x73bfbe70,0x83877605,0x4523ecf1, - }; -OPENSSL_GLOBAL const CAST_LONG CAST_S_table2[256]={ - 0x8defc240,0x25fa5d9f,0xeb903dbf,0xe810c907, - 0x47607fff,0x369fe44b,0x8c1fc644,0xaececa90, - 0xbeb1f9bf,0xeefbcaea,0xe8cf1950,0x51df07ae, - 0x920e8806,0xf0ad0548,0xe13c8d83,0x927010d5, - 0x11107d9f,0x07647db9,0xb2e3e4d4,0x3d4f285e, - 0xb9afa820,0xfade82e0,0xa067268b,0x8272792e, - 0x553fb2c0,0x489ae22b,0xd4ef9794,0x125e3fbc, - 0x21fffcee,0x825b1bfd,0x9255c5ed,0x1257a240, - 0x4e1a8302,0xbae07fff,0x528246e7,0x8e57140e, - 0x3373f7bf,0x8c9f8188,0xa6fc4ee8,0xc982b5a5, - 0xa8c01db7,0x579fc264,0x67094f31,0xf2bd3f5f, - 0x40fff7c1,0x1fb78dfc,0x8e6bd2c1,0x437be59b, - 0x99b03dbf,0xb5dbc64b,0x638dc0e6,0x55819d99, - 0xa197c81c,0x4a012d6e,0xc5884a28,0xccc36f71, - 0xb843c213,0x6c0743f1,0x8309893c,0x0feddd5f, - 0x2f7fe850,0xd7c07f7e,0x02507fbf,0x5afb9a04, - 0xa747d2d0,0x1651192e,0xaf70bf3e,0x58c31380, - 0x5f98302e,0x727cc3c4,0x0a0fb402,0x0f7fef82, - 0x8c96fdad,0x5d2c2aae,0x8ee99a49,0x50da88b8, - 0x8427f4a0,0x1eac5790,0x796fb449,0x8252dc15, - 0xefbd7d9b,0xa672597d,0xada840d8,0x45f54504, - 0xfa5d7403,0xe83ec305,0x4f91751a,0x925669c2, - 0x23efe941,0xa903f12e,0x60270df2,0x0276e4b6, - 0x94fd6574,0x927985b2,0x8276dbcb,0x02778176, - 0xf8af918d,0x4e48f79e,0x8f616ddf,0xe29d840e, - 0x842f7d83,0x340ce5c8,0x96bbb682,0x93b4b148, - 0xef303cab,0x984faf28,0x779faf9b,0x92dc560d, - 0x224d1e20,0x8437aa88,0x7d29dc96,0x2756d3dc, - 0x8b907cee,0xb51fd240,0xe7c07ce3,0xe566b4a1, - 0xc3e9615e,0x3cf8209d,0x6094d1e3,0xcd9ca341, - 0x5c76460e,0x00ea983b,0xd4d67881,0xfd47572c, - 0xf76cedd9,0xbda8229c,0x127dadaa,0x438a074e, - 0x1f97c090,0x081bdb8a,0x93a07ebe,0xb938ca15, - 0x97b03cff,0x3dc2c0f8,0x8d1ab2ec,0x64380e51, - 0x68cc7bfb,0xd90f2788,0x12490181,0x5de5ffd4, - 0xdd7ef86a,0x76a2e214,0xb9a40368,0x925d958f, - 0x4b39fffa,0xba39aee9,0xa4ffd30b,0xfaf7933b, - 0x6d498623,0x193cbcfa,0x27627545,0x825cf47a, - 0x61bd8ba0,0xd11e42d1,0xcead04f4,0x127ea392, - 0x10428db7,0x8272a972,0x9270c4a8,0x127de50b, - 0x285ba1c8,0x3c62f44f,0x35c0eaa5,0xe805d231, - 0x428929fb,0xb4fcdf82,0x4fb66a53,0x0e7dc15b, - 0x1f081fab,0x108618ae,0xfcfd086d,0xf9ff2889, - 0x694bcc11,0x236a5cae,0x12deca4d,0x2c3f8cc5, - 0xd2d02dfe,0xf8ef5896,0xe4cf52da,0x95155b67, - 0x494a488c,0xb9b6a80c,0x5c8f82bc,0x89d36b45, - 0x3a609437,0xec00c9a9,0x44715253,0x0a874b49, - 0xd773bc40,0x7c34671c,0x02717ef6,0x4feb5536, - 0xa2d02fff,0xd2bf60c4,0xd43f03c0,0x50b4ef6d, - 0x07478cd1,0x006e1888,0xa2e53f55,0xb9e6d4bc, - 0xa2048016,0x97573833,0xd7207d67,0xde0f8f3d, - 0x72f87b33,0xabcc4f33,0x7688c55d,0x7b00a6b0, - 0x947b0001,0x570075d2,0xf9bb88f8,0x8942019e, - 0x4264a5ff,0x856302e0,0x72dbd92b,0xee971b69, - 0x6ea22fde,0x5f08ae2b,0xaf7a616d,0xe5c98767, - 0xcf1febd2,0x61efc8c2,0xf1ac2571,0xcc8239c2, - 0x67214cb8,0xb1e583d1,0xb7dc3e62,0x7f10bdce, - 0xf90a5c38,0x0ff0443d,0x606e6dc6,0x60543a49, - 0x5727c148,0x2be98a1d,0x8ab41738,0x20e1be24, - 0xaf96da0f,0x68458425,0x99833be5,0x600d457d, - 0x282f9350,0x8334b362,0xd91d1120,0x2b6d8da0, - 0x642b1e31,0x9c305a00,0x52bce688,0x1b03588a, - 0xf7baefd5,0x4142ed9c,0xa4315c11,0x83323ec5, - 0xdfef4636,0xa133c501,0xe9d3531c,0xee353783, - }; -OPENSSL_GLOBAL const CAST_LONG CAST_S_table3[256]={ - 0x9db30420,0x1fb6e9de,0xa7be7bef,0xd273a298, - 0x4a4f7bdb,0x64ad8c57,0x85510443,0xfa020ed1, - 0x7e287aff,0xe60fb663,0x095f35a1,0x79ebf120, - 0xfd059d43,0x6497b7b1,0xf3641f63,0x241e4adf, - 0x28147f5f,0x4fa2b8cd,0xc9430040,0x0cc32220, - 0xfdd30b30,0xc0a5374f,0x1d2d00d9,0x24147b15, - 0xee4d111a,0x0fca5167,0x71ff904c,0x2d195ffe, - 0x1a05645f,0x0c13fefe,0x081b08ca,0x05170121, - 0x80530100,0xe83e5efe,0xac9af4f8,0x7fe72701, - 0xd2b8ee5f,0x06df4261,0xbb9e9b8a,0x7293ea25, - 0xce84ffdf,0xf5718801,0x3dd64b04,0xa26f263b, - 0x7ed48400,0x547eebe6,0x446d4ca0,0x6cf3d6f5, - 0x2649abdf,0xaea0c7f5,0x36338cc1,0x503f7e93, - 0xd3772061,0x11b638e1,0x72500e03,0xf80eb2bb, - 0xabe0502e,0xec8d77de,0x57971e81,0xe14f6746, - 0xc9335400,0x6920318f,0x081dbb99,0xffc304a5, - 0x4d351805,0x7f3d5ce3,0xa6c866c6,0x5d5bcca9, - 0xdaec6fea,0x9f926f91,0x9f46222f,0x3991467d, - 0xa5bf6d8e,0x1143c44f,0x43958302,0xd0214eeb, - 0x022083b8,0x3fb6180c,0x18f8931e,0x281658e6, - 0x26486e3e,0x8bd78a70,0x7477e4c1,0xb506e07c, - 0xf32d0a25,0x79098b02,0xe4eabb81,0x28123b23, - 0x69dead38,0x1574ca16,0xdf871b62,0x211c40b7, - 0xa51a9ef9,0x0014377b,0x041e8ac8,0x09114003, - 0xbd59e4d2,0xe3d156d5,0x4fe876d5,0x2f91a340, - 0x557be8de,0x00eae4a7,0x0ce5c2ec,0x4db4bba6, - 0xe756bdff,0xdd3369ac,0xec17b035,0x06572327, - 0x99afc8b0,0x56c8c391,0x6b65811c,0x5e146119, - 0x6e85cb75,0xbe07c002,0xc2325577,0x893ff4ec, - 0x5bbfc92d,0xd0ec3b25,0xb7801ab7,0x8d6d3b24, - 0x20c763ef,0xc366a5fc,0x9c382880,0x0ace3205, - 0xaac9548a,0xeca1d7c7,0x041afa32,0x1d16625a, - 0x6701902c,0x9b757a54,0x31d477f7,0x9126b031, - 0x36cc6fdb,0xc70b8b46,0xd9e66a48,0x56e55a79, - 0x026a4ceb,0x52437eff,0x2f8f76b4,0x0df980a5, - 0x8674cde3,0xedda04eb,0x17a9be04,0x2c18f4df, - 0xb7747f9d,0xab2af7b4,0xefc34d20,0x2e096b7c, - 0x1741a254,0xe5b6a035,0x213d42f6,0x2c1c7c26, - 0x61c2f50f,0x6552daf9,0xd2c231f8,0x25130f69, - 0xd8167fa2,0x0418f2c8,0x001a96a6,0x0d1526ab, - 0x63315c21,0x5e0a72ec,0x49bafefd,0x187908d9, - 0x8d0dbd86,0x311170a7,0x3e9b640c,0xcc3e10d7, - 0xd5cad3b6,0x0caec388,0xf73001e1,0x6c728aff, - 0x71eae2a1,0x1f9af36e,0xcfcbd12f,0xc1de8417, - 0xac07be6b,0xcb44a1d8,0x8b9b0f56,0x013988c3, - 0xb1c52fca,0xb4be31cd,0xd8782806,0x12a3a4e2, - 0x6f7de532,0x58fd7eb6,0xd01ee900,0x24adffc2, - 0xf4990fc5,0x9711aac5,0x001d7b95,0x82e5e7d2, - 0x109873f6,0x00613096,0xc32d9521,0xada121ff, - 0x29908415,0x7fbb977f,0xaf9eb3db,0x29c9ed2a, - 0x5ce2a465,0xa730f32c,0xd0aa3fe8,0x8a5cc091, - 0xd49e2ce7,0x0ce454a9,0xd60acd86,0x015f1919, - 0x77079103,0xdea03af6,0x78a8565e,0xdee356df, - 0x21f05cbe,0x8b75e387,0xb3c50651,0xb8a5c3ef, - 0xd8eeb6d2,0xe523be77,0xc2154529,0x2f69efdf, - 0xafe67afb,0xf470c4b2,0xf3e0eb5b,0xd6cc9876, - 0x39e4460c,0x1fda8538,0x1987832f,0xca007367, - 0xa99144f8,0x296b299e,0x492fc295,0x9266beab, - 0xb5676e69,0x9bd3ddda,0xdf7e052f,0xdb25701c, - 0x1b5e51ee,0xf65324e6,0x6afce36c,0x0316cc04, - 0x8644213e,0xb7dc59d0,0x7965291f,0xccd6fd43, - 0x41823979,0x932bcdf6,0xb657c34d,0x4edfd282, - 0x7ae5290c,0x3cb9536b,0x851e20fe,0x9833557e, - 0x13ecf0b0,0xd3ffb372,0x3f85c5c1,0x0aef7ed2, - }; -OPENSSL_GLOBAL const CAST_LONG CAST_S_table4[256]={ - 0x7ec90c04,0x2c6e74b9,0x9b0e66df,0xa6337911, - 0xb86a7fff,0x1dd358f5,0x44dd9d44,0x1731167f, - 0x08fbf1fa,0xe7f511cc,0xd2051b00,0x735aba00, - 0x2ab722d8,0x386381cb,0xacf6243a,0x69befd7a, - 0xe6a2e77f,0xf0c720cd,0xc4494816,0xccf5c180, - 0x38851640,0x15b0a848,0xe68b18cb,0x4caadeff, - 0x5f480a01,0x0412b2aa,0x259814fc,0x41d0efe2, - 0x4e40b48d,0x248eb6fb,0x8dba1cfe,0x41a99b02, - 0x1a550a04,0xba8f65cb,0x7251f4e7,0x95a51725, - 0xc106ecd7,0x97a5980a,0xc539b9aa,0x4d79fe6a, - 0xf2f3f763,0x68af8040,0xed0c9e56,0x11b4958b, - 0xe1eb5a88,0x8709e6b0,0xd7e07156,0x4e29fea7, - 0x6366e52d,0x02d1c000,0xc4ac8e05,0x9377f571, - 0x0c05372a,0x578535f2,0x2261be02,0xd642a0c9, - 0xdf13a280,0x74b55bd2,0x682199c0,0xd421e5ec, - 0x53fb3ce8,0xc8adedb3,0x28a87fc9,0x3d959981, - 0x5c1ff900,0xfe38d399,0x0c4eff0b,0x062407ea, - 0xaa2f4fb1,0x4fb96976,0x90c79505,0xb0a8a774, - 0xef55a1ff,0xe59ca2c2,0xa6b62d27,0xe66a4263, - 0xdf65001f,0x0ec50966,0xdfdd55bc,0x29de0655, - 0x911e739a,0x17af8975,0x32c7911c,0x89f89468, - 0x0d01e980,0x524755f4,0x03b63cc9,0x0cc844b2, - 0xbcf3f0aa,0x87ac36e9,0xe53a7426,0x01b3d82b, - 0x1a9e7449,0x64ee2d7e,0xcddbb1da,0x01c94910, - 0xb868bf80,0x0d26f3fd,0x9342ede7,0x04a5c284, - 0x636737b6,0x50f5b616,0xf24766e3,0x8eca36c1, - 0x136e05db,0xfef18391,0xfb887a37,0xd6e7f7d4, - 0xc7fb7dc9,0x3063fcdf,0xb6f589de,0xec2941da, - 0x26e46695,0xb7566419,0xf654efc5,0xd08d58b7, - 0x48925401,0xc1bacb7f,0xe5ff550f,0xb6083049, - 0x5bb5d0e8,0x87d72e5a,0xab6a6ee1,0x223a66ce, - 0xc62bf3cd,0x9e0885f9,0x68cb3e47,0x086c010f, - 0xa21de820,0xd18b69de,0xf3f65777,0xfa02c3f6, - 0x407edac3,0xcbb3d550,0x1793084d,0xb0d70eba, - 0x0ab378d5,0xd951fb0c,0xded7da56,0x4124bbe4, - 0x94ca0b56,0x0f5755d1,0xe0e1e56e,0x6184b5be, - 0x580a249f,0x94f74bc0,0xe327888e,0x9f7b5561, - 0xc3dc0280,0x05687715,0x646c6bd7,0x44904db3, - 0x66b4f0a3,0xc0f1648a,0x697ed5af,0x49e92ff6, - 0x309e374f,0x2cb6356a,0x85808573,0x4991f840, - 0x76f0ae02,0x083be84d,0x28421c9a,0x44489406, - 0x736e4cb8,0xc1092910,0x8bc95fc6,0x7d869cf4, - 0x134f616f,0x2e77118d,0xb31b2be1,0xaa90b472, - 0x3ca5d717,0x7d161bba,0x9cad9010,0xaf462ba2, - 0x9fe459d2,0x45d34559,0xd9f2da13,0xdbc65487, - 0xf3e4f94e,0x176d486f,0x097c13ea,0x631da5c7, - 0x445f7382,0x175683f4,0xcdc66a97,0x70be0288, - 0xb3cdcf72,0x6e5dd2f3,0x20936079,0x459b80a5, - 0xbe60e2db,0xa9c23101,0xeba5315c,0x224e42f2, - 0x1c5c1572,0xf6721b2c,0x1ad2fff3,0x8c25404e, - 0x324ed72f,0x4067b7fd,0x0523138e,0x5ca3bc78, - 0xdc0fd66e,0x75922283,0x784d6b17,0x58ebb16e, - 0x44094f85,0x3f481d87,0xfcfeae7b,0x77b5ff76, - 0x8c2302bf,0xaaf47556,0x5f46b02a,0x2b092801, - 0x3d38f5f7,0x0ca81f36,0x52af4a8a,0x66d5e7c0, - 0xdf3b0874,0x95055110,0x1b5ad7a8,0xf61ed5ad, - 0x6cf6e479,0x20758184,0xd0cefa65,0x88f7be58, - 0x4a046826,0x0ff6f8f3,0xa09c7f70,0x5346aba0, - 0x5ce96c28,0xe176eda3,0x6bac307f,0x376829d2, - 0x85360fa9,0x17e3fe2a,0x24b79767,0xf5a96b20, - 0xd6cd2595,0x68ff1ebf,0x7555442c,0xf19f06be, - 0xf9e0659a,0xeeb9491d,0x34010718,0xbb30cab8, - 0xe822fe15,0x88570983,0x750e6249,0xda627e55, - 0x5e76ffa8,0xb1534546,0x6d47de08,0xefe9e7d4, - }; -OPENSSL_GLOBAL const CAST_LONG CAST_S_table5[256]={ - 0xf6fa8f9d,0x2cac6ce1,0x4ca34867,0xe2337f7c, - 0x95db08e7,0x016843b4,0xeced5cbc,0x325553ac, - 0xbf9f0960,0xdfa1e2ed,0x83f0579d,0x63ed86b9, - 0x1ab6a6b8,0xde5ebe39,0xf38ff732,0x8989b138, - 0x33f14961,0xc01937bd,0xf506c6da,0xe4625e7e, - 0xa308ea99,0x4e23e33c,0x79cbd7cc,0x48a14367, - 0xa3149619,0xfec94bd5,0xa114174a,0xeaa01866, - 0xa084db2d,0x09a8486f,0xa888614a,0x2900af98, - 0x01665991,0xe1992863,0xc8f30c60,0x2e78ef3c, - 0xd0d51932,0xcf0fec14,0xf7ca07d2,0xd0a82072, - 0xfd41197e,0x9305a6b0,0xe86be3da,0x74bed3cd, - 0x372da53c,0x4c7f4448,0xdab5d440,0x6dba0ec3, - 0x083919a7,0x9fbaeed9,0x49dbcfb0,0x4e670c53, - 0x5c3d9c01,0x64bdb941,0x2c0e636a,0xba7dd9cd, - 0xea6f7388,0xe70bc762,0x35f29adb,0x5c4cdd8d, - 0xf0d48d8c,0xb88153e2,0x08a19866,0x1ae2eac8, - 0x284caf89,0xaa928223,0x9334be53,0x3b3a21bf, - 0x16434be3,0x9aea3906,0xefe8c36e,0xf890cdd9, - 0x80226dae,0xc340a4a3,0xdf7e9c09,0xa694a807, - 0x5b7c5ecc,0x221db3a6,0x9a69a02f,0x68818a54, - 0xceb2296f,0x53c0843a,0xfe893655,0x25bfe68a, - 0xb4628abc,0xcf222ebf,0x25ac6f48,0xa9a99387, - 0x53bddb65,0xe76ffbe7,0xe967fd78,0x0ba93563, - 0x8e342bc1,0xe8a11be9,0x4980740d,0xc8087dfc, - 0x8de4bf99,0xa11101a0,0x7fd37975,0xda5a26c0, - 0xe81f994f,0x9528cd89,0xfd339fed,0xb87834bf, - 0x5f04456d,0x22258698,0xc9c4c83b,0x2dc156be, - 0x4f628daa,0x57f55ec5,0xe2220abe,0xd2916ebf, - 0x4ec75b95,0x24f2c3c0,0x42d15d99,0xcd0d7fa0, - 0x7b6e27ff,0xa8dc8af0,0x7345c106,0xf41e232f, - 0x35162386,0xe6ea8926,0x3333b094,0x157ec6f2, - 0x372b74af,0x692573e4,0xe9a9d848,0xf3160289, - 0x3a62ef1d,0xa787e238,0xf3a5f676,0x74364853, - 0x20951063,0x4576698d,0xb6fad407,0x592af950, - 0x36f73523,0x4cfb6e87,0x7da4cec0,0x6c152daa, - 0xcb0396a8,0xc50dfe5d,0xfcd707ab,0x0921c42f, - 0x89dff0bb,0x5fe2be78,0x448f4f33,0x754613c9, - 0x2b05d08d,0x48b9d585,0xdc049441,0xc8098f9b, - 0x7dede786,0xc39a3373,0x42410005,0x6a091751, - 0x0ef3c8a6,0x890072d6,0x28207682,0xa9a9f7be, - 0xbf32679d,0xd45b5b75,0xb353fd00,0xcbb0e358, - 0x830f220a,0x1f8fb214,0xd372cf08,0xcc3c4a13, - 0x8cf63166,0x061c87be,0x88c98f88,0x6062e397, - 0x47cf8e7a,0xb6c85283,0x3cc2acfb,0x3fc06976, - 0x4e8f0252,0x64d8314d,0xda3870e3,0x1e665459, - 0xc10908f0,0x513021a5,0x6c5b68b7,0x822f8aa0, - 0x3007cd3e,0x74719eef,0xdc872681,0x073340d4, - 0x7e432fd9,0x0c5ec241,0x8809286c,0xf592d891, - 0x08a930f6,0x957ef305,0xb7fbffbd,0xc266e96f, - 0x6fe4ac98,0xb173ecc0,0xbc60b42a,0x953498da, - 0xfba1ae12,0x2d4bd736,0x0f25faab,0xa4f3fceb, - 0xe2969123,0x257f0c3d,0x9348af49,0x361400bc, - 0xe8816f4a,0x3814f200,0xa3f94043,0x9c7a54c2, - 0xbc704f57,0xda41e7f9,0xc25ad33a,0x54f4a084, - 0xb17f5505,0x59357cbe,0xedbd15c8,0x7f97c5ab, - 0xba5ac7b5,0xb6f6deaf,0x3a479c3a,0x5302da25, - 0x653d7e6a,0x54268d49,0x51a477ea,0x5017d55b, - 0xd7d25d88,0x44136c76,0x0404a8c8,0xb8e5a121, - 0xb81a928a,0x60ed5869,0x97c55b96,0xeaec991b, - 0x29935913,0x01fdb7f1,0x088e8dfa,0x9ab6f6f5, - 0x3b4cbf9f,0x4a5de3ab,0xe6051d35,0xa0e1d855, - 0xd36b4cf1,0xf544edeb,0xb0e93524,0xbebb8fbd, - 0xa2d762cf,0x49c92f54,0x38b5f331,0x7128a454, - 0x48392905,0xa65b1db8,0x851c97bd,0xd675cf2f, - }; -OPENSSL_GLOBAL const CAST_LONG CAST_S_table6[256]={ - 0x85e04019,0x332bf567,0x662dbfff,0xcfc65693, - 0x2a8d7f6f,0xab9bc912,0xde6008a1,0x2028da1f, - 0x0227bce7,0x4d642916,0x18fac300,0x50f18b82, - 0x2cb2cb11,0xb232e75c,0x4b3695f2,0xb28707de, - 0xa05fbcf6,0xcd4181e9,0xe150210c,0xe24ef1bd, - 0xb168c381,0xfde4e789,0x5c79b0d8,0x1e8bfd43, - 0x4d495001,0x38be4341,0x913cee1d,0x92a79c3f, - 0x089766be,0xbaeeadf4,0x1286becf,0xb6eacb19, - 0x2660c200,0x7565bde4,0x64241f7a,0x8248dca9, - 0xc3b3ad66,0x28136086,0x0bd8dfa8,0x356d1cf2, - 0x107789be,0xb3b2e9ce,0x0502aa8f,0x0bc0351e, - 0x166bf52a,0xeb12ff82,0xe3486911,0xd34d7516, - 0x4e7b3aff,0x5f43671b,0x9cf6e037,0x4981ac83, - 0x334266ce,0x8c9341b7,0xd0d854c0,0xcb3a6c88, - 0x47bc2829,0x4725ba37,0xa66ad22b,0x7ad61f1e, - 0x0c5cbafa,0x4437f107,0xb6e79962,0x42d2d816, - 0x0a961288,0xe1a5c06e,0x13749e67,0x72fc081a, - 0xb1d139f7,0xf9583745,0xcf19df58,0xbec3f756, - 0xc06eba30,0x07211b24,0x45c28829,0xc95e317f, - 0xbc8ec511,0x38bc46e9,0xc6e6fa14,0xbae8584a, - 0xad4ebc46,0x468f508b,0x7829435f,0xf124183b, - 0x821dba9f,0xaff60ff4,0xea2c4e6d,0x16e39264, - 0x92544a8b,0x009b4fc3,0xaba68ced,0x9ac96f78, - 0x06a5b79a,0xb2856e6e,0x1aec3ca9,0xbe838688, - 0x0e0804e9,0x55f1be56,0xe7e5363b,0xb3a1f25d, - 0xf7debb85,0x61fe033c,0x16746233,0x3c034c28, - 0xda6d0c74,0x79aac56c,0x3ce4e1ad,0x51f0c802, - 0x98f8f35a,0x1626a49f,0xeed82b29,0x1d382fe3, - 0x0c4fb99a,0xbb325778,0x3ec6d97b,0x6e77a6a9, - 0xcb658b5c,0xd45230c7,0x2bd1408b,0x60c03eb7, - 0xb9068d78,0xa33754f4,0xf430c87d,0xc8a71302, - 0xb96d8c32,0xebd4e7be,0xbe8b9d2d,0x7979fb06, - 0xe7225308,0x8b75cf77,0x11ef8da4,0xe083c858, - 0x8d6b786f,0x5a6317a6,0xfa5cf7a0,0x5dda0033, - 0xf28ebfb0,0xf5b9c310,0xa0eac280,0x08b9767a, - 0xa3d9d2b0,0x79d34217,0x021a718d,0x9ac6336a, - 0x2711fd60,0x438050e3,0x069908a8,0x3d7fedc4, - 0x826d2bef,0x4eeb8476,0x488dcf25,0x36c9d566, - 0x28e74e41,0xc2610aca,0x3d49a9cf,0xbae3b9df, - 0xb65f8de6,0x92aeaf64,0x3ac7d5e6,0x9ea80509, - 0xf22b017d,0xa4173f70,0xdd1e16c3,0x15e0d7f9, - 0x50b1b887,0x2b9f4fd5,0x625aba82,0x6a017962, - 0x2ec01b9c,0x15488aa9,0xd716e740,0x40055a2c, - 0x93d29a22,0xe32dbf9a,0x058745b9,0x3453dc1e, - 0xd699296e,0x496cff6f,0x1c9f4986,0xdfe2ed07, - 0xb87242d1,0x19de7eae,0x053e561a,0x15ad6f8c, - 0x66626c1c,0x7154c24c,0xea082b2a,0x93eb2939, - 0x17dcb0f0,0x58d4f2ae,0x9ea294fb,0x52cf564c, - 0x9883fe66,0x2ec40581,0x763953c3,0x01d6692e, - 0xd3a0c108,0xa1e7160e,0xe4f2dfa6,0x693ed285, - 0x74904698,0x4c2b0edd,0x4f757656,0x5d393378, - 0xa132234f,0x3d321c5d,0xc3f5e194,0x4b269301, - 0xc79f022f,0x3c997e7e,0x5e4f9504,0x3ffafbbd, - 0x76f7ad0e,0x296693f4,0x3d1fce6f,0xc61e45be, - 0xd3b5ab34,0xf72bf9b7,0x1b0434c0,0x4e72b567, - 0x5592a33d,0xb5229301,0xcfd2a87f,0x60aeb767, - 0x1814386b,0x30bcc33d,0x38a0c07d,0xfd1606f2, - 0xc363519b,0x589dd390,0x5479f8e6,0x1cb8d647, - 0x97fd61a9,0xea7759f4,0x2d57539d,0x569a58cf, - 0xe84e63ad,0x462e1b78,0x6580f87e,0xf3817914, - 0x91da55f4,0x40a230f3,0xd1988f35,0xb6e318d2, - 0x3ffa50bc,0x3d40f021,0xc3c0bdae,0x4958c24c, - 0x518f36b2,0x84b1d370,0x0fedce83,0x878ddada, - 0xf2a279c7,0x94e01be8,0x90716f4b,0x954b8aa3, - }; -OPENSSL_GLOBAL const CAST_LONG CAST_S_table7[256]={ - 0xe216300d,0xbbddfffc,0xa7ebdabd,0x35648095, - 0x7789f8b7,0xe6c1121b,0x0e241600,0x052ce8b5, - 0x11a9cfb0,0xe5952f11,0xece7990a,0x9386d174, - 0x2a42931c,0x76e38111,0xb12def3a,0x37ddddfc, - 0xde9adeb1,0x0a0cc32c,0xbe197029,0x84a00940, - 0xbb243a0f,0xb4d137cf,0xb44e79f0,0x049eedfd, - 0x0b15a15d,0x480d3168,0x8bbbde5a,0x669ded42, - 0xc7ece831,0x3f8f95e7,0x72df191b,0x7580330d, - 0x94074251,0x5c7dcdfa,0xabbe6d63,0xaa402164, - 0xb301d40a,0x02e7d1ca,0x53571dae,0x7a3182a2, - 0x12a8ddec,0xfdaa335d,0x176f43e8,0x71fb46d4, - 0x38129022,0xce949ad4,0xb84769ad,0x965bd862, - 0x82f3d055,0x66fb9767,0x15b80b4e,0x1d5b47a0, - 0x4cfde06f,0xc28ec4b8,0x57e8726e,0x647a78fc, - 0x99865d44,0x608bd593,0x6c200e03,0x39dc5ff6, - 0x5d0b00a3,0xae63aff2,0x7e8bd632,0x70108c0c, - 0xbbd35049,0x2998df04,0x980cf42a,0x9b6df491, - 0x9e7edd53,0x06918548,0x58cb7e07,0x3b74ef2e, - 0x522fffb1,0xd24708cc,0x1c7e27cd,0xa4eb215b, - 0x3cf1d2e2,0x19b47a38,0x424f7618,0x35856039, - 0x9d17dee7,0x27eb35e6,0xc9aff67b,0x36baf5b8, - 0x09c467cd,0xc18910b1,0xe11dbf7b,0x06cd1af8, - 0x7170c608,0x2d5e3354,0xd4de495a,0x64c6d006, - 0xbcc0c62c,0x3dd00db3,0x708f8f34,0x77d51b42, - 0x264f620f,0x24b8d2bf,0x15c1b79e,0x46a52564, - 0xf8d7e54e,0x3e378160,0x7895cda5,0x859c15a5, - 0xe6459788,0xc37bc75f,0xdb07ba0c,0x0676a3ab, - 0x7f229b1e,0x31842e7b,0x24259fd7,0xf8bef472, - 0x835ffcb8,0x6df4c1f2,0x96f5b195,0xfd0af0fc, - 0xb0fe134c,0xe2506d3d,0x4f9b12ea,0xf215f225, - 0xa223736f,0x9fb4c428,0x25d04979,0x34c713f8, - 0xc4618187,0xea7a6e98,0x7cd16efc,0x1436876c, - 0xf1544107,0xbedeee14,0x56e9af27,0xa04aa441, - 0x3cf7c899,0x92ecbae6,0xdd67016d,0x151682eb, - 0xa842eedf,0xfdba60b4,0xf1907b75,0x20e3030f, - 0x24d8c29e,0xe139673b,0xefa63fb8,0x71873054, - 0xb6f2cf3b,0x9f326442,0xcb15a4cc,0xb01a4504, - 0xf1e47d8d,0x844a1be5,0xbae7dfdc,0x42cbda70, - 0xcd7dae0a,0x57e85b7a,0xd53f5af6,0x20cf4d8c, - 0xcea4d428,0x79d130a4,0x3486ebfb,0x33d3cddc, - 0x77853b53,0x37effcb5,0xc5068778,0xe580b3e6, - 0x4e68b8f4,0xc5c8b37e,0x0d809ea2,0x398feb7c, - 0x132a4f94,0x43b7950e,0x2fee7d1c,0x223613bd, - 0xdd06caa2,0x37df932b,0xc4248289,0xacf3ebc3, - 0x5715f6b7,0xef3478dd,0xf267616f,0xc148cbe4, - 0x9052815e,0x5e410fab,0xb48a2465,0x2eda7fa4, - 0xe87b40e4,0xe98ea084,0x5889e9e1,0xefd390fc, - 0xdd07d35b,0xdb485694,0x38d7e5b2,0x57720101, - 0x730edebc,0x5b643113,0x94917e4f,0x503c2fba, - 0x646f1282,0x7523d24a,0xe0779695,0xf9c17a8f, - 0x7a5b2121,0xd187b896,0x29263a4d,0xba510cdf, - 0x81f47c9f,0xad1163ed,0xea7b5965,0x1a00726e, - 0x11403092,0x00da6d77,0x4a0cdd61,0xad1f4603, - 0x605bdfb0,0x9eedc364,0x22ebe6a8,0xcee7d28a, - 0xa0e736a0,0x5564a6b9,0x10853209,0xc7eb8f37, - 0x2de705ca,0x8951570f,0xdf09822b,0xbd691a6c, - 0xaa12e4f2,0x87451c0f,0xe0f6a27a,0x3ada4819, - 0x4cf1764f,0x0d771c2b,0x67cdb156,0x350d8384, - 0x5938fa0f,0x42399ef3,0x36997b07,0x0e84093d, - 0x4aa93e61,0x8360d87b,0x1fa98b0c,0x1149382c, - 0xe97625a5,0x0614d1b7,0x0e25244b,0x0c768347, - 0x589e8d82,0x0d2059d1,0xa466bb1e,0xf8da0a82, - 0x04f19130,0xba6e4ec0,0x99265164,0x1ee7230d, - 0x50b2ad80,0xeaee6801,0x8db2a283,0xea8bf59e, - }; DELETED Source/CAST/ccCast.c Index: Source/CAST/ccCast.c ================================================================== --- Source/CAST/ccCast.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * ccCAST.c - shim between openssl-based CAST and CommonEncryption. - * - * Created 3/30/06 by Doug Mitchell. - */ - -#include -#include - -int cast_cc_set_key( - CAST_KEY *cx, - const void *rawKey, - size_t keyLength, - int forEncrypt) -{ - CAST_set_key(cx, keyLength, rawKey); - return 0; -} - -void cast_cc_encrypt(CAST_KEY *cx, const void *blockIn, void *blockOut) -{ - CAST_ecb_encrypt((const unsigned char *)blockIn, (unsigned char *)blockOut, - cx, CAST_ENCRYPT); -} - -void cast_cc_decrypt(CAST_KEY *cx, const void *blockIn, void *blockOut) -{ - CAST_ecb_encrypt((const unsigned char *)blockIn, (unsigned char *)blockOut, - cx, CAST_DECRYPT); -} - DELETED Source/CommonCrypto.exp Index: Source/CommonCrypto.exp ================================================================== --- Source/CommonCrypto.exp +++ /dev/null @@ -1,96 +0,0 @@ -_CCAESCmac -_CCCalibratePBKDF -_CCCrypt -_CCCryptorCreate -_CCCryptorCreateFromData -_CCCryptorCreateFromDataWithMode -_CCCryptorCreateWithMode -_CCCryptorDecryptDataBlock -_CCCryptorEncryptDataBlock -_CCCryptorFinal -_CCCryptorGetOutputLength -_CCCryptorRelease -_CCCryptorReset -_CCCryptorUpdate -_CCDesCBCCksum -_CCDesIsWeakKey -_CCDesSetOddParity -_CCDigest -_CCDigestFinal -_CCDigestInit -_CCDigestUpdate -_CCDigestCreate -_CCDigestDestroy -_CCDigestReset -_CCDigestInterrimResult -_CCDigestBlockSize -_CCDigestOutputSize -_CCHmac -_CCHmacFinal -_CCHmacInit -_CCHmacUpdate -_CCKeyDerivationPBKDF -_CCRandomCopyBytes -_CCSymmetricKeyUnwrap -_CCSymmetricKeyWrap -_CCSymmetricUnwrappedSize -_CCSymmetricWrappedSize -_CC_CAST_decrypt -_CC_CAST_ecb_encrypt -_CC_CAST_encrypt -_CC_CAST_set_key -_CC_MD2 -_CC_MD2_Final -_CC_MD2_Init -_CC_MD2_Update -_CC_MD4 -_CC_MD4_Final -_CC_MD4_Init -_CC_MD4_Update -_CC_MD5 -_CC_MD5_Final -_CC_MD5_Init -_CC_MD5_Update -_CC_RC4 -_CC_RC4_set_key -_CC_SHA1 -_CC_SHA1_Final -_CC_SHA1_Init -_CC_SHA1_Update -_CC_SHA224 -_CC_SHA224_Final -_CC_SHA224_Init -_CC_SHA224_Update -_CC_SHA256 -_CC_SHA256_Final -_CC_SHA256_Init -_CC_SHA256_Update -_CC_SHA384 -_CC_SHA384_Final -_CC_SHA384_Init -_CC_SHA384_Update -_CC_SHA512 -_CC_SHA512_Final -_CC_SHA512_Init -_CC_SHA512_Update -_CCrfc3394_iv -_CCrfc3394_ivLen -_aes_cc_decrypt -_aes_cc_encrypt -_aes_cc_set_iv -_aes_cc_set_key -_aes_decrypt_cbc -_aes_decrypt_key128 -_aes_decrypt_key192 -_aes_decrypt_key256 -_aes_encrypt_cbc -_aes_encrypt_key128 -_aes_encrypt_key192 -_aes_encrypt_key256 -_kCCRandomDefault -_osDes3Decrypt -_osDes3Encrypt -_osDes3Setkey -_osDesDecrypt -_osDesEncrypt -_osDesSetkey ADDED Source/CommonCryptoSPI/CommonBigNum.h Index: Source/CommonCryptoSPI/CommonBigNum.h ================================================================== --- /dev/null +++ Source/CommonCryptoSPI/CommonBigNum.h @@ -0,0 +1,771 @@ +/* + * Copyright (c) 2011 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef _CC_BIGNUM_H_ +#define _CC_BIGNUM_H_ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This is an SPI - it isn't intended to be generally used. If you + * intend to use this we strongly urge you to talk to someone in the + * Information Security Group to see if there isn't an alternative + * set of functions to implement your cryptographic needs. + */ + +/* + * This shares the error status of CommonCryptor.h + */ + +typedef CCCryptorStatus CCStatus; +typedef struct _CCBigNumRef *CCBigNumRef; + +/*! + @function CCCreateBigNum + @abstract Creates a BigNum - must be freed later with + CCBigNumFree. + + @param status A pointer to a CCStatus for return codes. + + @result On success this returns a newly + allocated BigNum (must be freed with + CCBigNumFree). + Returns NULL on failure. + */ + +CCBigNumRef +CCCreateBigNum(CCStatus *status) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumClear + @abstract Zeroes (clears) a BigNum. + + @param bn The BigNum to clear. + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumClear(CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumFree + @abstract Frees and clears a BigNum. + + @param bn The BigNum to free. + + */ + +void +CCBigNumFree(CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumCopy + @abstract Copies a BigNum. + + @param status A pointer to a CCStatus for return codes. + @param bn The BigNum to copy. + @result On success this returns a newly + allocated BigNum (must be freed with + CCBigNumFree). + Returns NULL on failure. + */ + +CCBigNumRef +CCBigNumCopy(CCStatus *status, const CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumBitCount + @abstract Returns the number of significant bits + in a BigNum. + + @param bn The BigNum. + @result Returns number of bits. + + */ + +uint32_t +CCBigNumBitCount(const CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumZeroLSBCount + @abstract Returns the number of zero bits + before the least significant 1 bit. + + @param bn The BigNum. + @result Returns number of bits. + + */ + +uint32_t +CCBigNumZeroLSBCount(const CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumByteCount + @abstract Returns the number of bytes if + converted to binary data. + + @param bn The BigNum. + @result Returns number of bytes. + + */ + +uint32_t +CCBigNumByteCount(const CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumFromData + @abstract Creates a BigNum from binary data. + + @param status A pointer to a CCStatus for return codes. + @param s - the data pointer. The data is expected to be + an array of octets in big endian format. + @param len - the length of the data. + @result On success this returns a newly + allocated BigNum (must be freed with + CCBigNumFree). + Returns NULL on failure. + */ + +CCBigNumRef +CCBigNumFromData(CCStatus *status, const void *s, size_t len) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumToData + @abstract Dumps a BigNum into binary data. + + @param status A pointer to a CCStatus for return codes. + @param bn The BigNum. + @param s - the pointer to the data area. + You can use CCBigNumByteCount() to + determine the size of the data area + to provide. + @result Returns the length of the data area. + + */ + +size_t +CCBigNumToData(CCStatus *status, const CCBigNumRef bn, void *to) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumFromHexString + @abstract Creates a BigNum from a hexadecimal string. + + @param status A pointer to a CCStatus for return codes. + @param in - a null terminated hexadecimal string. + @result On success this returns a newly + allocated BigNum (must be freed with + CCBigNumFree). + Returns NULL on failure. + */ + +CCBigNumRef +CCBigNumFromHexString(CCStatus *status, const char *in) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumToHexString + @abstract Dumps a BigNum into binary data. + + @param status A pointer to a CCStatus for return codes. + @param bn The BigNum. + @result Returns a hexadecimal string representation + of the BigNum. This must be freed by the caller. + Returns NULL on failure. + + */ + +char * +CCBigNumToHexString(CCStatus *status, const CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumByteCount + @abstract Returns the number of bytes that will result from + converting a BigNum to octets. + + @param bn The BigNum. + @result The number of bytes. + */ + +uint32_t +CCBigNumByteCount(const CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumCompare + @abstract Compares two BigNums. + + @param bn1 - a BigNum. + @param bn2 - a BigNum. + @result Returns -1 if bn1 is less than bn2. + Returns 0 if bn1 and bn2 are equal. + Returns 1 if bn1 is greater than bn2. + + */ + +int +CCBigNumCompare(const CCBigNumRef bn1, const CCBigNumRef bn2) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumCompareI + @abstract Compares a BigNum and a 32 bit integer. + + @param bn1 - a BigNum. + @param num - an integer. + @result Returns -1 if bn1 is less than num. + Returns 0 if bn1 and num are equal. + Returns 1 if bn1 is greater than num. + + */ + + +int +CCBigNumCompareI(const CCBigNumRef bn1, const uint32_t num) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +/*! + @function CCBigNumSetNegative + @abstract Negates a BigNum. + + @param bn - a BigNum. + @result returns a CCStatus (See CommonCryptor.h for values). + + */ + +CCStatus +CCBigNumSetNegative(CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumSetI + @abstract Sets a BigNum value using an unsigned integer. + + @param bn The BigNum. + @param num The value to set. + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumSetI(CCBigNumRef bn, uint64_t num) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumGetI + @abstract Get an unsigned integer representation of the BigNum. + This assumes the BigNum can actually fit within the + unsigned integer representation. + + @param status A pointer to a CCStatus for return codes. + @param bn The BigNum. + @result returns the unsigned integer value. + */ + +uint32_t +CCBigNumGetI(CCStatus *status, const CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumAdd + @abstract Adds two BigNums. + + @param result A bigNum in which to place the result. + @param a The first BigNum to add. + @param b The second BigNum to add. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumAdd(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumAddI + @abstract Adds a BigNum and an unsigned integer. + + @param result A bigNum in which to place the result. + @param a The first BigNum to add. + @param b The unsigned integer to add. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumAddI(CCBigNumRef result, const CCBigNumRef a, const uint32_t b) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumSub + @abstract Subtracts a BigNum from a BigNum. + + @param result A bigNum in which to place the result. + @param a The BigNum. + @param b The BigNum to subtract. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumSub(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumSubI + @abstract Subtracts an unsigned integer from a BigNum. + + @param result A bigNum in which to place the result. + @param a The BigNum. + @param b The unsigned integer to subtract. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumSubI(CCBigNumRef result, const CCBigNumRef a, const uint32_t b) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumMul + @abstract Multiplies two BigNums. + + @param result A bigNum in which to place the result. + @param a The first BigNum to multiply. + @param b The second BigNum to multiply. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumMul(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumMulI + @abstract Multiplies a BigNum and an unsigned integer. + + @param result A bigNum in which to place the result. + @param a The first BigNum to multiply. + @param b The unsigned integer to multiply. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumMulI(CCBigNumRef result, const CCBigNumRef a, const uint32_t b) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumDiv + @abstract Divides a BigNum (a) by another Bignum (b). + + @param quotient A bigNum in which to place the quotient (a div b). + @param remainder A bigNum in which to place the remainder (a mod b). + @param a The BigNum to divide. + @param b The BigNum used to divide a. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumDiv(CCBigNumRef quotient, CCBigNumRef remainder, const CCBigNumRef a, const CCBigNumRef b) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumDiv2 + @abstract Divides a BigNum (a) by 2. + + @param result A bigNum in which to place the result. + @param a The BigNum to divide. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumDiv2(CCBigNumRef result, const CCBigNumRef a) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumMod + @abstract Find the remainder of a BigNum for a given modulus. + + @param result A bigNum in which to place the result. + @param dividend The BigNum to divide. + @param modulus The BigNum used to divide a and produce the mod value. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumMod(CCBigNumRef result, CCBigNumRef dividend, CCBigNumRef modulus) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumModI + @abstract Find the remainder of a BigNum for a given modulus (unsigned integer version). + + @param result A pointer to an unsigned integer in which to place the result. + @param dividend The BigNum to divide. + @param modulus The BigNum used to divide a and produce the mod value. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumModI(uint32_t *result, CCBigNumRef dividend, uint32_t modulus) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumSquare + @abstract Find the square of a BigNum. + + @param result A bigNum in which to place the result. + @param a The BigNum to square. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumSquare(CCBigNumRef result, const CCBigNumRef a) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumGCD + @abstract Find the Greatest Common Denominator of two BigNums. + + @param result A bigNum in which to place the result. + @param a A BigNum. + @param b A BigNum. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumGCD(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumLCM + @abstract Find the Least Common Multiple of two BigNums. + + @param result A bigNum in which to place the result. + @param a A BigNum. + @param b A BigNum. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumLCM(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumMulMod + @abstract Perform Modular Multiplication. + + @param result A bigNum in which to place the result. + @param a A BigNum. + @param b A BigNum. + @param modulus The Modulus. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumMulMod(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b, const CCBigNumRef modulus) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumSquareMod + @abstract Perform Modular Squaring. + + @param result A bigNum in which to place the result. + @param a A BigNum. + @param modulus The Modulus. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumSquareMod(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef modulus) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumInverseMod + @abstract Perform Modular Inversion. + + @param result A bigNum in which to place the result. + @param a A BigNum. + @param modulus The Modulus. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumInverseMod(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef modulus) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumModExp + @abstract Perform Modular Exponentiation. + + @param result A bigNum in which to place the result. + @param a The base integer. + @param power The power integer. + @param modulus The Modulus. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumModExp(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef power, const CCBigNumRef modulus) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumLeftShift + @abstract Shift a BigNum left + + @param result A bigNum in which to place the result. + @param a The BigNum. + @param digits How many bit places to shift left. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumLeftShift(CCBigNumRef result, const CCBigNumRef a, const uint32_t digits) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumRightShift + @abstract Shift a BigNum right + + @param result A bigNum in which to place the result. + @param a The BigNum. + @param digits How many bit places to shift right. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumRightShift(CCBigNumRef result, const CCBigNumRef a, const uint32_t digits) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumMontgomerySetup + @abstract Setup Montgomery + + @param num The modulus. + @param rho The destination for the reduction digit. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumMontgomerySetup(CCBigNumRef num, uint32_t *rho) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumMontgomeryNormalization + @abstract Get the normalization value. + + @param result A bigNum in which to place the result. + @param modulus The modulus. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumMontgomeryNormalization(CCBigNumRef result, CCBigNumRef modulus) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumMontgomeryReduce + @abstract Reduce a number + + @param x The BigNum to reduce - the result will be stored back into + this BigNum. + @param modulus The modulus. + @param rho The reduction digit. + + @result returns a CCStatus (See CommonCryptor.h for values). + */ + +CCStatus +CCBigNumMontgomeryReduce(CCBigNumRef x, CCBigNumRef modulus, uint32_t rho) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + + +/*! + @function CCBigNumCreateRandom + @abstract Creates a BigNum with a random value. + ZZZZZ + + @param status A pointer to a CCStatus for return codes. + @result On success this returns a newly + allocated BigNum (must be freed with + CCBigNumFree). + Returns NULL on failure. + */ + +CCBigNumRef +CCBigNumCreateRandom(CCStatus *status, int bits, int top, int bottom) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/*! + @function CCBigNumIsPrime + @abstract Determines if a BigNum is prime. + + @param status A pointer to a CCStatus for return codes. + @param bn - a BigNum. + @result Returns true or false. + */ + +bool +CCBigNumIsPrime(CCStatus *status, const CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/*! + @function CCBigNumIsOdd + @abstract Determines if a BigNum is odd. + + @param status A pointer to a CCStatus for return codes. + @param bn - a BigNum. + @result Returns true or false. + */ + +bool +CCBigNumIsOdd(CCStatus *status, const CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/*! + @function CCBigNumIsZero + @abstract Determines if a BigNum is zero. + + @param status A pointer to a CCStatus for return codes. + @param bn - a BigNum. + @result Returns true or false. + */ + +bool +CCBigNumIsZero(CCStatus *status, const CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/*! + @function CCBigNumIsNegative + @abstract Determines if a BigNum is negative. + + @param status A pointer to a CCStatus for return codes. + @param bn - a BigNum. + @result Returns true or false. + */ + +bool +CCBigNumIsNegative(CCStatus *status, const CCBigNumRef bn) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +#ifdef __cplusplus +} +#endif + +#endif /* _CC_BIGNUM_H_ */ Index: Source/CommonCryptoSPI/CommonCMACSPI.h ================================================================== --- Source/CommonCryptoSPI/CommonCMACSPI.h +++ Source/CommonCryptoSPI/CommonCMACSPI.h @@ -47,11 +47,11 @@ Output is written to caller-supplied buffer. */ void CCAESCmac(const void *key, const uint8_t *data, size_t dataLength, void *macOut) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_6_0); #ifdef __cplusplus } #endif Index: Source/CommonCryptoSPI/CommonCryptoPriv.h ================================================================== --- Source/CommonCryptoSPI/CommonCryptoPriv.h +++ Source/CommonCryptoSPI/CommonCryptoPriv.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2006-2012 Apple, Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License @@ -23,15 +23,26 @@ /* * CommonCryptoPriv.h - private typedefs and defines for ComonCrypto */ -#ifndef _COMMON_CRYPTO_PRIV_H_ -#define _COMMON_CRYPTO_PRIV_H_ - -/* - * All CommomCrypto-specific mods to the various open source implementations - * in this package are flagged with this symbol. - */ -#define _APPLE_COMMON_CRYPTO_ - -#endif /* _COMMON_CRYPTO_PRIV_H_ */ +#ifndef __COMMONCRYPTO_PRIVATE__ +#define __COMMONCRYPTO_PRIVATE__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// The following headers will be jettisoned once all internal projects +// are weaned from them. + +#include +#include + +#endif /* __COMMONCRYPTO_PRIVATE__ */ Index: Source/CommonCryptoSPI/CommonCryptorSPI.h ================================================================== --- Source/CommonCryptoSPI/CommonCryptorSPI.h +++ Source/CommonCryptoSPI/CommonCryptorSPI.h @@ -27,12 +27,16 @@ #include #include #include #include +#ifdef KERNEL +#include +#else #include #include +#endif /* KERNEL */ #include #ifdef __cplusplus extern "C" { #endif @@ -41,49 +45,52 @@ This is an SPI header. It includes some work in progress implementation notes that will be removed when this is promoted to an API set. */ /* - Cipher Modes -*/ - -enum { - kCCModeECB = 1, - kCCModeCBC = 2, - kCCModeCFB = 3, - kCCModeCTR = 4, - kCCModeF8 = 5, // Unimplemented for now (not included) - kCCModeLRW = 6, // Unimplemented for now (not included) - kCCModeOFB = 7, - kCCModeXTS = 8, - kCCModeRC4 = 9, // RC4 as a streaming cipher is handled internally as a mode. - kCCModeCFB8 = 10, -}; -typedef uint32_t CCMode; - -/* - Padding for block ciphers -*/ - -enum { - ccDefaultPadding = 0, - ccPKCS7Padding = 1, - ccANSIx923Padding = 2, // Unimplemented for now (not included) - ccISO10126Padding = 3, // Unimplemented for now (not included) -}; -typedef uint32_t CCPadding; - -/* - Mode options - so far only used for CTR mode -*/ - -enum { - kCCModeOptionCTR_LE = 0x0001, // CTR Mode Little Endian - kCCModeOptionCTR_BE = 0x0002 // CTR Mode Big Endian -}; - -typedef uint32_t CCModeOptions; + Private Ciphers + */ + +/* Lion SPI name for no padding. Defining for compatibility. Is now + ccNoPadding in CommonCryptor.h + */ + +enum { + ccDefaultPadding = 0, +}; + + +enum { + kCCAlgorithmAES128NoHardware = 20, + kCCAlgorithmAES128WithHardware = 21 +}; + +/* + Private Modes + */ +enum { + kCCModeGCM = 11, +}; + +/* + Private Paddings + */ +enum { + ccCBCCTS1 = 10, + ccCBCCTS2 = 11, + ccCBCCTS3 = 12, +}; + +/* + Private Cryptor direction (op) + */ +enum { + kCCBoth = 3, +}; + + + /* Supports a mode call of int mode_setup(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, int tweaklen, int num_rounds, int options, mode_context *ctx); @@ -105,28 +112,12 @@ CCModeOptions options, const void *data, /* caller-supplied memory */ size_t dataLength, /* length of data in bytes */ CCCryptorRef *cryptorRef, /* RETURNED */ size_t *dataUsed) /* optional, RETURNED */ -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); - -/* This version mallocs the CCCryptorRef */ - -CCCryptorStatus CCCryptorCreateWithMode( - CCOperation op, /* kCCEncrypt, kCCEncrypt, kCCBoth (default for BlockMode) */ - CCMode mode, - CCAlgorithm alg, - CCPadding padding, - const void *iv, /* optional initialization vector */ - const void *key, /* raw key material */ - size_t keyLength, - const void *tweak, /* raw tweak material */ - size_t tweakLength, - int numRounds, /* 0 == default */ - CCModeOptions options, - CCCryptorRef *cryptorRef) /* RETURNED */ -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + /* Assuming we can use existing CCCryptorCreateFromData for all modes serviced by these: int mode_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, mode_context *ctx); int mode_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, mode_context *ctx); @@ -143,20 +134,20 @@ CCCryptorRef cryptorRef, const void *iv, const void *dataIn, size_t dataInLength, void *dataOut) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); CCCryptorStatus CCCryptorDecryptDataBlock( CCCryptorRef cryptorRef, const void *iv, const void *dataIn, size_t dataInLength, void *dataOut) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /* Assuming we can use the existing CCCryptorRelease() interface for int mode_done(mode_context *ctx); */ @@ -173,24 +164,152 @@ */ CCCryptorStatus CCDesIsWeakKey( void *key, size_t Length) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); void CCDesSetOddParity( void *key, size_t Length) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); uint32_t CCDesCBCCksum(void *input, void *output, size_t length, void *key, size_t keylen, void *ivec) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/* + * returns a cipher blocksize length iv in the provided iv buffer. + */ + +CCCryptorStatus +CCCryptorGetIV(CCCryptorRef cryptorRef, void *iv) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/* + GCM Support Interfaces + + Use CCCryptorCreateWithMode() with the kCCModeGCM selector to initialize + a CryptoRef. Only kCCAlgorithmAES128 can be used with GCM and these + functions. IV Setting etc will be ignored from CCCryptorCreateWithMode(). + Use the CCCryptorGCMAddIV() routine below for IV setup. +*/ + +/* + This adds the initial vector octets from iv of length ivLen to the GCM + CCCryptorRef. You can call this function as many times as required to + process the entire IV. +*/ + +CCCryptorStatus +CCCryptorGCMAddIV(CCCryptorRef cryptorRef, + const void *iv, + size_t ivLen) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/* + Additional Authentication Data + After the entire IV has been processed, the additional authentication + data can be processed. Unlike the IV, a packet/session does not require + additional authentication data (AAD) for security. The AAD is meant to + be used as side–channel data you want to be authenticated with the packet. + Note: once you begin adding AAD to the GCM CCCryptorRef you cannot return + to adding IV data until the state has been reset. +*/ + +CCCryptorStatus +CCCryptorGCMAddAAD(CCCryptorRef cryptorRef, + const void *aData, + size_t aDataLen) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); + +// Maintain the old symbol with incorrect camel-case for now. +CCCryptorStatus +CCCryptorGCMaddAAD(CCCryptorRef cryptorRef, + const void *aData, + size_t aDataLen) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); + +// This is for old iOS5 clients +CCCryptorStatus +CCCryptorGCMAddADD(CCCryptorRef cryptorRef, + const void *aData, + size_t aDataLen) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +CCCryptorStatus CCCryptorGCMEncrypt( + CCCryptorRef cryptorRef, + const void *dataIn, + size_t dataInLength, + void *dataOut) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +CCCryptorStatus CCCryptorGCMDecrypt( + CCCryptorRef cryptorRef, + const void *dataIn, + size_t dataInLength, + void *dataOut) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/* + This terminates the GCM state gcm and stores the tag in tag of length + taglen octets. +*/ + +CCCryptorStatus CCCryptorGCMFinal( + CCCryptorRef cryptorRef, + const void *tag, + size_t *tagLength) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/* + This will reset the GCM CCCryptorRef to the state that CCCryptorCreateWithMode() + left it. The user would then call CCCryptorGCMAddIV(), CCCryptorGCMaddAAD(), etc. +*/ + +CCCryptorStatus CCCryptorGCMReset( + CCCryptorRef cryptorRef) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/* + This will initialize the GCM state with the given key, IV and AAD value + then proceed to encrypt or decrypt the message text and store the final + message tag. The definition of the variables is the same as it is for all + the manual functions. If you are processing many packets under the same + key you shouldn’t use this function as it invokes the pre–computation + with each call. +*/ + +CCCryptorStatus CCCryptorGCM( + CCOperation op, /* kCCEncrypt, kCCDecrypt */ + CCAlgorithm alg, + const void *key, /* raw key material */ + size_t keyLength, + const void *iv, + size_t ivLen, + const void *aData, + size_t aDataLen, + const void *dataIn, + size_t dataInLength, + void *dataOut, + const void *tag, + size_t *tagLength) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); - + +void CC_RC4_set_key(void *ctx, int len, const unsigned char *data) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); + +void CC_RC4(void *ctx, unsigned long len, const unsigned char *indata, + unsigned char *outdata) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0); + #ifdef __cplusplus } #endif #endif /* _CC_CryptorSPI_H_ */ ADDED Source/CommonCryptoSPI/CommonDH.h Index: Source/CommonCryptoSPI/CommonDH.h ================================================================== --- /dev/null +++ Source/CommonCryptoSPI/CommonDH.h @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef _CC_DH_H_ +#define _CC_DH_H_ + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CCDHRef_s *CCDHRef; + +typedef struct CCDHParameters_s *CCDHParameters; + +extern CCDHParameters kCCDHRFC2409Group2 + __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); +extern CCDHParameters kCCDHRFC3526Group5 + __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/*! + @function CCDHCreate + @abstract Creates a Diffie-Hellman context. + + @param dhParameter The Diffie-Hellman Group to use (provides p and g). + The only appropriate values are kCCDHGenerator2 or + kCCDHGenerator5, defined above. + + @result If unable to allocate memory this returns NULL. +*/ + +CCDHRef +CCDHCreate(CCDHParameters dhParameter) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/*! + @function CCDHRelease + @abstract Releases a Diffie-Hellman context. + + @param ref The Diffie-Hellman context to clear and deallocate. + +*/ + +void +CCDHRelease(CCDHRef ref) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/*! + @function CCDHGenerateKey + @abstract Generate the public key for use in a Diffie-Hellman handshake. + This value is returned as a byte string. + + @param ref The Diffie-Hellman context. + @result returns -1 on failure. + +*/ + + +int +CCDHGenerateKey(CCDHRef ref, void *output, size_t *outputLength) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +/*! + @function CCDHComputeKey + @abstract Compute the shared Diffie-Hellman key using the peer's public + key. + + @param sharedKey Shared key computed from the peer public key, p, g, + and the private key. + @param peerPubKey Public key received from the peer. + @param peerPubKeyLen Length of peer public key. + @param ref The Diffie-Hellman context to clear and deallocate. + + @param returns the length of the shared key. + +*/ + +int +CCDHComputeKey(unsigned char *sharedKey, size_t *sharedKeyLen, const void *peerPubKey, size_t peerPubKeyLen, CCDHRef ref) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + + +CCDHParameters +CCDHParametersCreateFromData(const void *p, size_t pLen, const void *g, size_t gLen, size_t l) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +CCDHParameters +CCDHParametersCreateFromPKCS3(const void *data, size_t len) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +size_t +CCDHParametersPKCS3EncodeLength(CCDHParameters parms) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +size_t +CCDHParametersPKCS3Encode(CCDHParameters parms, void *data, size_t dataAvailable) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +void +CCDHParametersRelease(CCDHParameters parameters) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); + +#ifdef __cplusplus +} +#endif + +#endif /* _CC_DH_H_ */ Index: Source/CommonCryptoSPI/CommonDigestSPI.h ================================================================== --- Source/CommonCryptoSPI/CommonDigestSPI.h +++ Source/CommonCryptoSPI/CommonDigestSPI.h @@ -22,20 +22,25 @@ */ #ifndef _CC_DigestSPI_H_ #define _CC_DigestSPI_H_ +#include +#include + #include + #ifdef __cplusplus extern "C" { #endif /*! - @enum CCDigestAlg + @enum CCDigestAlgorithm @abstract Algorithms implemented in this module. + @constant kCCDigestNone Digest Selector for "no digest" @constant kCCDigestMD2 MD2 digest @constant kCCDigestMD4 MD4 digest @constant kCCDigestMD5 MD5 digest @constant kCCDigestRMD128 RMD 128 bit digest @constant kCCDigestRMD160 RMD 160 bit digest @@ -53,10 +58,11 @@ @constant kCCDigestSkein384 Skein 384 bit digest @constant kCCDigestSkein512 Skein 512 bit digest */ enum { + kCCDigestNone = 0, kCCDigestMD2 = 1, kCCDigestMD4 = 2, kCCDigestMD5 = 3, kCCDigestRMD128 = 4, kCCDigestRMD160 = 5, @@ -72,11 +78,15 @@ kCCDigestSkein224 = 16, kCCDigestSkein256 = 17, kCCDigestSkein384 = 18, kCCDigestSkein512 = 19, }; -typedef uint32_t CCDigestAlg; +typedef uint32_t CCDigestAlgorithm; + +// Hold this until Heimdal has changed. + +#define CCDigestAlg CCDigestAlgorithm /*! @typedef CCDigestCtx @abstract Digest context. */ @@ -84,10 +94,26 @@ #define CC_DIGEST_SIZE 1032 typedef struct CCDigestCtx_t { uint8_t context[CC_DIGEST_SIZE]; } CCDigestCtx, *CCDigestRef; +#define CC_RMD128_DIGEST_LENGTH 16 /* digest length in bytes */ +#define CC_RMD128_BLOCK_BYTES 64 /* block size in bytes */ +#define CC_RMD128_BLOCK_LONG (CC_RMD128_BLOCK_BYTES / sizeof(CC_LONG)) + +#define CC_RMD160_DIGEST_LENGTH 20 /* digest length in bytes */ +#define CC_RMD160_BLOCK_BYTES 64 /* block size in bytes */ +#define CC_RMD160_BLOCK_LONG (CC_RMD160_BLOCK_BYTES / sizeof(CC_LONG)) + +#define CC_RMD256_DIGEST_LENGTH 32 /* digest length in bytes */ +#define CC_RMD256_BLOCK_BYTES 64 /* block size in bytes */ +#define CC_RMD256_BLOCK_LONG (CC_RMD256_BLOCK_BYTES / sizeof(CC_LONG)) + +#define CC_RMD320_DIGEST_LENGTH 40 /* digest length in bytes */ +#define CC_RMD320_BLOCK_BYTES 64 /* block size in bytes */ +#define CC_RMD320_BLOCK_LONG (CC_RMD320_BLOCK_BYTES / sizeof(CC_LONG)) + /**************************************************************************/ /* SPI Only */ /**************************************************************************/ /* @@ -106,12 +132,13 @@ returns 0 on success. */ int -CCDigestInit(CCDigestAlg algorithm, CCDigestRef ctx) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +CCDigestInit(CCDigestAlgorithm algorithm, CCDigestRef ctx) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + /**************************************************************************/ /* Future API */ /**************************************************************************/ @@ -132,26 +159,26 @@ Output is written to caller-supplied buffer, as in CCDigestFinal(). */ int -CCDigest(CCDigestAlg algorithm, +CCDigest(CCDigestAlgorithm algorithm, const uint8_t *data, size_t length, uint8_t *output) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /*! @function CCDigestCreate @abstract Allocate and initialize a CCDigestCtx for a digest. @param algorithm Digest algorithm to setup. - returns 0 on success. + returns a pointer to a digestRef on success. */ CCDigestRef -CCDigestCreate(CCDigestAlg alg) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +CCDigestCreate(CCDigestAlgorithm alg) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /*! @function CCDigestUpdate @abstract Continue to digest data. @@ -162,11 +189,11 @@ returns 0 on success. */ int CCDigestUpdate(CCDigestRef ctx, const void *data, size_t length) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /*! @function CCDigestFinal @abstract Conclude digest operations and produce the digest output. @@ -176,11 +203,11 @@ returns 0 on success. */ int CCDigestFinal(CCDigestRef ctx, uint8_t *output) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /*! @function CCDigestDestroy @abstract Clear and free a CCDigestCtx @param ctx A digest context. @@ -187,11 +214,11 @@ */ void CCDigestDestroy(CCDigestRef ctx) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /*! @function CCDigestReset @abstract Clear and re-initialize a CCDigestCtx for the same algorithm. @@ -198,14 +225,14 @@ @param ctx A digest context. */ void CCDigestReset(CCDigestRef ctx) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /*! - @function CCDigestInterrimResult + @function CCDigestRefGetDigest @abstract Produce the digest output result for the bytes currently processed. @param ctx A digest context. @param output The digest bytes (space provided by the caller). @@ -212,39 +239,95 @@ returns 0 on success. */ int -CCDigestInterrimResult(CCDigestRef ctx, uint8_t *output) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +CCDigestGetDigest(CCDigestRef ctx, uint8_t *output) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCDigestGetBlockSize + @abstract Provides the block size of the digest algorithm + + @param algorithm A digest algorithm selector. + + returns 0 on failure or the block size on success. + */ + +size_t +CCDigestGetBlockSize(CCDigestAlgorithm algorithm) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + + +/*! + @function CCDigestGetOutputSize + @abstract Provides the digest output size of the digest algorithm + + @param algorithm A digest algorithm selector. + + returns 0 on failure or the digest output size on success. + */ + +size_t +CCDigestGetOutputSize(CCDigestAlgorithm algorithm) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); /*! - @function CCDigestBlockSize + @function CCDigestGetBlockSizeFromRef @abstract Provides the block size of the digest algorithm @param ctx A digest context. returns 0 on failure or the block size on success. */ size_t +CCDigestGetBlockSizeFromRef(CCDigestRef ctx) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +// Until Heimdal Changes +// #define CCDigestBlockSize CCDigestGetBlockSizeFromRef +size_t CCDigestBlockSize(CCDigestRef ctx) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); - + /*! - @function CCDigestOutputSize + @function CCDigestGetOutputSizeFromRef @abstract Provides the digest output size of the digest algorithm @param ctx A digest context. returns 0 on failure or the digest output size on success. */ size_t +CCDigestGetOutputSizeFromRef(CCDigestRef ctx) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +// Until Heimdal Changes +// #define CCDigestOutputSize CCDigestGetOutputSizeFromRef +size_t CCDigestOutputSize(CCDigestRef ctx) -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + + +uint8_t * +CCDigestOID(CCDigestRef ctx) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +size_t +CCDigestOIDLen(CCDigestRef ctx) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +CCDigestRef +CCDigestCreateByOID(uint8_t *OID, size_t OIDlen) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + #ifdef __cplusplus } #endif #endif /* _CC_DigestSPI_H_ */ ADDED Source/CommonCryptoSPI/CommonECCryptor.h Index: Source/CommonCryptoSPI/CommonECCryptor.h ================================================================== --- /dev/null +++ Source/CommonCryptoSPI/CommonECCryptor.h @@ -0,0 +1,452 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef _CC_ECCRYPTOR_H_ +#define _CC_ECCRYPTOR_H_ + +#include + +#include +#include +#include "CommonRSACryptor.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + @typedef CCECCryptorRef + @abstract Opaque reference to a CCECCryptor object. + */ + +typedef struct _CCECCryptor *CCECCryptorRef; + + +/* + EC Key Types + */ + +enum { + ccECKeyPublic = 0, + ccECKeyPrivate = 1, + ccECBlankPublicKey = 97, + ccECBlankPrivateKey = 98, + ccECBadKey = 99, +}; +typedef uint32_t CCECKeyType; + +/* + EC Key Import/Export Formats + */ + +enum { + kCCImportKeyBinary = 0, + kCCImportKeyDER = 1, +}; +typedef uint32_t CCECKeyExternalFormat; + +/*! + @discussion + + Key sizes for this set of interfaces must be between 128 and 384 bits. + The key size must also be evenly divisible by 8 +*/ + +/*! + @function CCECCryptorGeneratePair + @abstract Generate an EC public and private key. A curve will be chosen from + ECC-256 or ECC-384. + + @param keysize Must be between 192 and 521 (inclusive) + + @param publicKey A (required) pointer for the returned public CCECCryptorRef. + + @param privateKey A (required) pointer for the returned private CCECCryptorRef. + + + @result Possible error returns are kCCParamError and kCCMemoryFailure. +*/ + +CCCryptorStatus +CCECCryptorGeneratePair( size_t keysize, + CCECCryptorRef *publicKey, + CCECCryptorRef *privateKey) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCECCryptorGetPublicKeyFromPrivateKey + @abstract Grab the parts from a private key to make a public key. + + @param privateKey A pointer to a private CCECCryptorRef. + + + @result Possible error returns are kCCParamError and kCCMemoryFailure. + */ + +CCECCryptorRef +CCECCryptorGetPublicKeyFromPrivateKey(CCECCryptorRef privateKey) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCECCryptorImportPublicKey + @abstract Import an Elliptic Curve public key from data. This imports public + keys in ANSI X.9.63 format. + + @param keyPackage The data package containing the encoded key. + + @param keyPackageLen The length of the encoded key package. + + @param key A CCECCryptorRef of the decoded key. + + @result Possible error returns are kCCParamError and kCCMemoryFailure. +*/ + + +CCCryptorStatus CCECCryptorImportPublicKey( void *keyPackage, + size_t keyPackageLen, + CCECCryptorRef *key) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCECCryptorImportKey + @abstract Import an Elliptic Curve public key from data. + + @param format The format in which the key is encoded. + + @param keyPackage The data package containing the encoded key. + + @param keyPackageLen The length of the encoded key package. + + @param keyType The type of key to be imported (public or private). + + @param key A CCECCryptorRef of the decoded key. + + @result Possible error returns are kCCParamError and kCCMemoryFailure. + */ + +CCCryptorStatus CCECCryptorImportKey(CCECKeyExternalFormat format, void *keyPackage, size_t keyPackageLen, CCECKeyType keyType, CCECCryptorRef *key) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCECCryptorExportPublicKey + @abstract Export an Elliptic Curve public key from data. This exports public + keys in ANSI X.9.63 format. + + @param key The CCECCryptorRef of the key to encode. + + @param out The destination for the encoded key. + + @param outLen A pointer to the length of the encoded key. + This is an in/out parameter. + + + @result Possible error returns are kCCParamError and kCCMemoryFailure. + */ + +CCCryptorStatus CCECCryptorExportPublicKey( CCECCryptorRef key, + void *out, + size_t *outLen) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +// We'll remove the CCECCryptorExportPublicKey later - we like this better. +CCCryptorStatus CCECCryptorExportKey(CCECKeyExternalFormat format, void *keyPackage, size_t *keyPackageLen, CCECKeyType keyType, CCECCryptorRef key) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCECGetKeyType + @abstract Determine whether a CCECCryptorRef is public or private + + @param key The CCECCryptorRef. + @result Return values are ccECKeyPublic, ccECKeyPrivate, or ccECBadKey + +*/ + +CCECKeyType CCECGetKeyType(CCECCryptorRef key) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCECGetKeySize + @abstract Return the key size + + @param key The CCECCryptorRef. + @result Returns the keysize in bits or kCCParamError. + +*/ + +int CCECGetKeySize(CCECCryptorRef key) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCECCryptorRelease + @abstract Clear and release a CCECCryptorRef. + + @param key The CCECCryptorRef of the key to release. +*/ + + +void CCECCryptorRelease(CCECCryptorRef key) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCECCryptorSignHash + + @abstract Compute a signature for a hash with an EC private key. + + @param privateKey A pointer to a private CCECCryptorRef. + + @param hashToSign A pointer to the bytes of the value to be signed. + + @param hashSignLen Length of data to be signed. + + @param signedData The signature bytes. + + @param signedDataLen A pointer to the length of signature material. + This is an in/out parameter value. + + @result Possible error returns are kCCParamError and kCCMemoryFailure. +*/ + + +CCCryptorStatus +CCECCryptorSignHash( CCECCryptorRef privateKey, + const void *hashToSign, + size_t hashSignLen, + void *signedData, + size_t *signedDataLen) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCECCryptorVerifyHash + + @abstract Verify a signature for data with an EC private key. + + @param publicKey A pointer to a public CCECCryptorRef. + + @param hash A pointer to the bytes of the hash of the data. + + @param hashLen Length of hash. + + @param signedData The bytes of the signature to be verified. + + @param signedDataLen Length of data associated with the signature. + + @param valid An indicator whether the signature was valid + + @result Possible error returns are kCCParamError, kCCMemoryFailure + or kCCNotVerified. +*/ + +CCCryptorStatus +CCECCryptorVerifyHash( CCECCryptorRef publicKey, + const void *hash, + size_t hashLen, + const void *signedData, + size_t signedDataLen, + uint32_t *valid) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + + +/*! + @function CCECCryptorWrapKey + + @abstract Encrypt data (wrap a symmetric key) with an EC public key. + + @param publicKey A pointer to a public CCECCryptorRef. + + @param plainText A pointer to the data to be encrypted. + + @param plainTextLen Length of data to be encrypted. + + @param cipherText The encrypted byte result. + + @param cipherTextLen Length of encrypted bytes. + + @param digestType The digest algorithm to use (See CommonDigestSPI.h). + + @result Possible error returns are kCCParamError. +*/ + +CCCryptorStatus +CCECCryptorWrapKey(CCECCryptorRef publicKey, + const void *plainText, + size_t plainTextLen, + void *cipherText, + size_t *cipherTextLen, + CCDigestAlg digestType) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCECCryptorUnwrapKey + + @abstract Decrypt data (unwrap a symmetric key) with an EC private key. + + @param privateKey A pointer to a private CCECCryptorRef. + + @param cipherText The encrypted bytes. + + @param cipherTextLen Length of encrypted bytes. + + @param plainText The decrypted data bytes. + + @param plainTextLen A pointer to the length of data decrypted. + This is an in/out parameter. + + @result Possible error returns are kCCParamError. +*/ + +CCCryptorStatus +CCECCryptorUnwrapKey(CCECCryptorRef privateKey, + const void *cipherText, + size_t cipherTextLen, + void *plainText, + size_t *plainTextLen) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCECCryptorComputeSharedSecret + + @abstract Construct a Diffie-Hellman shared secret with a private and + public ECC key. + + @param privateKey A pointer to a private CCECCryptorRef. + + @param publicKey A pointer to a public CCECCryptorRef (usually + obtained from the other party in the session.) + + @param out The output data buffer. + + @param outLen The output data buffer size. This is an in-out + parameter. When the function returns this is set + to the length of the result. + + @result Possible error returns are kCCParamError, kCCDecodeError + or kCCBufferTooSmall. + +*/ + +CCCryptorStatus +CCECCryptorComputeSharedSecret( CCECCryptorRef privateKey, + CCECCryptorRef publicKey, + void *out, + size_t *outLen) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*======================================================================================*/ +/* Only for FIPS Testing */ +/*======================================================================================*/ + +/*! + @function CCECCryptorGetKeyComponents + @abstract Get EC Public Key Parameters for FIPS tests + + @param ecKey The EC Key to deconstruct + @param keySize The EC Keysize. + @param qX, qXLength The pointer and length(return) for the X Parameter. + @param qY, qYLength The pointer and length(return) for the Y Parameter. + @param d, dLength The pointer and length(return) for the D (Private Key Only) + Parameter. + + @result If the function is successful (kCCSuccess) the X and Y parameters contain the + discreet public key point coordinate values. If the key passed in is a Private + Key the D parameter will contain the private key. + All other errors result in kCCParamError. + */ + +CCCryptorStatus +CCECCryptorGetKeyComponents(CCECCryptorRef ecKey, size_t *keySize, + uint8_t *qX, size_t *qXLength, + uint8_t *qY, size_t *qYLength, + uint8_t *d, size_t *dLength) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCECCryptorCreateFromData + @abstract For FIPS CAVS testing we need the ability to create an EC + key from an X and Y parameter set. + + @param keySize The EC Keysize. + @param qX, qXLength The pointer and length for the X Parameter. + @param qY, qYLength The pointer and length for the Y Parameter. + @param ref A pointer to the CCECCryptorRef to contain the result. + @result If the function is successful (kCCSuccess) a CCECCryptorRef is + returned in the ref parameter. All other errors result in + kCCParamError. + */ + +CCCryptorStatus +CCECCryptorCreateFromData(size_t keySize, + uint8_t *qX, size_t qXLength, + uint8_t *qY, size_t qYLength, + CCECCryptorRef *ref) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCECSignatureDecode + @abstract For FIPS CAVS testing we need the ability to get the binary S and R values + from the DER signature blob. + @param SignedData, signedDataLen The pointer and length of the DER formatted signature + @param r, rLength The pointer and length for the R component (return value). + @param s, sLength The pointer and length for the S component (return value). + @result If the function is successful (kCCSuccess) the r and s parameters have the + individual values from the signature. + */ + +CCCryptorStatus +CCECSignatureDecode(const void *signedData, size_t signedDataLen, + uint8_t *r, size_t *rLength, + uint8_t *s, size_t *sLength) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCECSignatureEncode + @abstract For FIPS CAVS testing we need the ability to produce a DER formatted signature from + discreet R and S components. + @param r, rLength The pointer and length for the R component. + @param s, sLength The pointer and length for the S component. + @param signedData, signedDataLen The pointer and length of the DER formatted + signature ( return value) + @result If the function is successful (kCCSuccess) the signature is returned as a + DER-formatted blob. */ + +CCCryptorStatus +CCECSignatureEncode(uint8_t *r, size_t rLength, + uint8_t *s, size_t sLength, + void *signedData, size_t *signedDataLen) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +#ifdef __cplusplus +} +#endif + +#endif /* _CC_ECCRYPTOR_H_ */ ADDED Source/CommonCryptoSPI/CommonHMacSPI.h Index: Source/CommonCryptoSPI/CommonHMacSPI.h ================================================================== --- /dev/null +++ Source/CommonCryptoSPI/CommonHMacSPI.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef _CC_HmacSPI_H_ +#define _CC_HmacSPI_H_ + +#include +#include +#include + +#include +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CCHmacContext * CCHmacContextRef; + +CCHmacContextRef +CCHmacCreate(CCDigestAlg alg, const void *key, size_t keyLength) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/* Update and Final are reused from existing api, type changed from struct CCHmacContext * to CCHmacContextRef though */ + +void +CCHmacDestroy(CCHmacContextRef ctx) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +size_t +CCHmacOutputSizeFromRef(CCHmacContextRef ctx) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +size_t +CCHmacOutputSize(CCDigestAlg alg) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +#ifdef __cplusplus +} +#endif + +#endif /* _CC_HmacSPI_H_ */ ADDED Source/CommonCryptoSPI/CommonRSACryptor.h Index: Source/CommonCryptoSPI/CommonRSACryptor.h ================================================================== --- /dev/null +++ Source/CommonCryptoSPI/CommonRSACryptor.h @@ -0,0 +1,487 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef _CC_RSACRYPTOR_H_ +#define _CC_RSACRYPTOR_H_ + +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + @typedef CCRSACryptorRef + @abstract Opaque reference to a CCRSACryptor object. + */ + +typedef struct _CCRSACryptor *CCRSACryptorRef; + + +/* + RSA Key Types + */ + +enum { + ccRSAKeyPublic = 0, + ccRSAKeyPrivate = 1, + ccRSABlankPublicKey = 97, + ccRSABlankPrivateKey = 98, + ccRSABadKey = 99, +}; +typedef uint32_t CCRSAKeyType; + +/* + Padding for Asymmetric ciphers +*/ + +enum { + ccPaddingNone = 1000, + ccPKCS1Padding = 1001, + ccOAEPPadding = 1002, + ccX931Padding = 1003, // Work in Progress - don't use. + ccPKCS1PaddingRaw = 1004, +}; +typedef uint32_t CCAsymetricPadding; + +/* + Additional CCCryptorStatus for signature verification failure. + */ + +enum { + kCCNotVerified = -4306 +}; + +/*! + @discussion + + Key sizes for this set of interfaces must be between 1024 and 4096 bits. + The key size must also be evenly divisible by 32. +*/ + +/*! + @function CCRSACryptorGeneratePair + @abstract Generate an RSA public and private key. + + @param keysize Example sizes for RSA keys are: 512, 768, 1024, 2048. + + @param e The "e" value (public key). Must be odd; 65537 or larger + + @param publicKey A (required) pointer for the returned public CCRSACryptorRef. + + @param privateKey A (required) pointer for the returned private CCRSACryptorRef. + + + @result Possible error returns are kCCParamError and kCCMemoryFailure. +*/ + +CCCryptorStatus CCRSACryptorGeneratePair( + size_t keysize, + uint32_t e, + CCRSACryptorRef *publicKey, + CCRSACryptorRef *privateKey) + __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCRSACryptorGetPublicKeyFromPrivateKey + @abstract Create an RSA public key from a full private key. + + @param privateKey A pointer to a private CCRSACryptorRef. + @result returns either a valid public key CCRSACryptorRef or NULL. + */ + +CCRSACryptorRef CCRSACryptorGetPublicKeyFromPrivateKey(CCRSACryptorRef privkey) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCRSACryptorImport + @abstract Import an RSA key from data. This imports public or private + keys in PKCS#1 format. + + @param keyPackage The data package containing the encoded key. + + @param keyPackageLen The length of the encoded key package. + + @param key A CCRSACryptorRef of the decoded key. + + @result Possible error returns are kCCParamError and kCCMemoryFailure. +*/ + +CCCryptorStatus CCRSACryptorImport( const void *keyPackage, + size_t keyPackageLen, + CCRSACryptorRef *key) + __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCRSACryptorExport + @abstract Import an RSA key from data. This exports public or private + keys in PKCS#1 format. + + @param key The CCRSACryptorRef of the key to encode. + + @param keyPackage The data package in which to put the encoded key. + + @param keyPackageLen A pointer to the length of the encoded key + package. This is an in/out parameter. + + + @result Possible error returns are kCCParamError and kCCMemoryFailure. + */ + +CCCryptorStatus CCRSACryptorExport( CCRSACryptorRef key, + void *out, + size_t *outLen) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCRSAGetKeyType + @abstract Determine whether a CCRSACryptorRef is public or private + + @param key The CCRSACryptorRef. + @result Return values are ccRSAKeyPublic, ccRSAKeyPrivate, or ccRSABadKey + +*/ + +CCRSAKeyType CCRSAGetKeyType(CCRSACryptorRef key) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCRSAGetKeySize + @abstract Return the key size + + @param key The CCRSACryptorRef. + @result Returns the keysize in bits or kCCParamError. + +*/ + +int CCRSAGetKeySize(CCRSACryptorRef key) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCRSACryptorRelease + @abstract Clear and release a CCRSACryptorRef. + + @param key The CCRSACryptorRef of the key to release. +*/ + + +void CCRSACryptorRelease(CCRSACryptorRef key) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCRSACryptorSign + + @abstract Compute a signature for data with an RSA private key. + + @param privateKey A pointer to a private CCRSACryptorRef. + + @param padding A selector for the padding to be used. + + @param hashToSign A pointer to the bytes of the value to be signed. + + @param hashSignLen Length of data to be signed. + + @param digestType The digest algorithm to use (See CommonDigestSPI.h). + + @param saltLen Length of salt to use for the signature. + + @param sig The signature bytes. + + @param sigLen A pointer to the length of signature material. + This is an in/out parameter value. + + @result Possible error returns are kCCParamError and kCCMemoryFailure. +*/ + + +CCCryptorStatus +CCRSACryptorSign( CCRSACryptorRef privateKey, + CCAsymetricPadding padding, + const void *hashToSign, + size_t hashSignLen, + CCDigestAlgorithm digestType, + size_t saltLen, + void *signedData, + size_t *signedDataLen) + __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCRSACryptorVerify + + @abstract Verify a signature for data with an RSA private key. + + @param publicKey A pointer to a public CCRSACryptorRef. + + @param padding A selector for the padding to be used. + + @param hash A pointer to the bytes of the hash of the data. + + @param hashLen Length of hash. + + @param digestType The digest algorithm to use (See CommonDigestSPI.h). + + @param saltLen Length of salt to use for the signature. + + @param signedData The bytes of the signature to be verified. + + @param signedDataLen Length of data associated with the signature. + + + @result Possible error returns are kCCParamError, kCCMemoryFailure + or kCCNotVerified. +*/ + +CCCryptorStatus +CCRSACryptorVerify( CCRSACryptorRef publicKey, + CCAsymetricPadding padding, + const void *hash, + size_t hashLen, + CCDigestAlgorithm digestType, + size_t saltLen, + const void *signedData, + size_t signedDataLen) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + + +/*! + @function CCRSACryptorEncrypt + + @abstract Encrypt data with an RSA public key. + + @param publicKey A pointer to a public CCRSACryptorRef. + + @param padding A selector for the padding to be used. + + @param plainText A pointer to the data to be encrypted. + + @param plainTextLen Length of data to be encrypted. + + @param cipherText The encrypted byte result. + + @param cipherTextLen Length of encrypted bytes. + + @param tagData tag to be included in the encryption. + + @param tagDataLen Length of tag bytes. + + @param digestType The digest algorithm to use (See CommonDigestSPI.h). + + @result Possible error returns are kCCParamError. +*/ + +CCCryptorStatus CCRSACryptorEncrypt( + CCRSACryptorRef publicKey, + CCAsymetricPadding padding, + const void *plainText, + size_t plainTextLen, + void *cipherText, + size_t *cipherTextLen, + const void *tagData, + size_t tagDataLen, + CCDigestAlgorithm digestType) + __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/*! + @function CCRSACryptorDecrypt + + @abstract Decrypt data with an RSA private key. + + @param privateKey A pointer to a private CCRSACryptorRef. + + @param padding A selector for the padding to be used. + + @param cipherText The encrypted bytes. + + @param cipherTextLen Length of encrypted bytes. + + @param plainText The decrypted data bytes. + + @param plainTextLen A pointer to the length of data decrypted. + This is an in/out parameter. + + @param tagData tag to be included in the encryption. + + @param tagDataLen Length of tag bytes. + + @param digestType The digest algorithm to use (See CommonDigestSPI.h). + + @result Possible error returns are kCCParamError. +*/ + +CCCryptorStatus +CCRSACryptorDecrypt( + CCRSACryptorRef privateKey, + CCAsymetricPadding padding, + const void *cipherText, + size_t cipherTextLen, + void *plainText, + size_t *plainTextLen, + const void *tagData, + size_t tagDataLen, + CCDigestAlgorithm digestType) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCRSACryptorDecodePayloadPKCS1 + + @abstract Decrypt data with an RSA public key, strip off PKCS1 padding and return the payload. + + @param publicKey A pointer to a public CCRSACryptorRef. + + @param cipherText The encrypted bytes. + + @param cipherTextLen Length of encrypted bytes. + + @param plainText The decrypted data bytes. + + @param plainTextLen A pointer to the length of data decrypted. + This is an in/out parameter. + + @param digestType The digest algorithm to use (See CommonDigestSPI.h). + + @result Possible error returns are kCCParamError. + */ + +CCCryptorStatus +CCRSACryptorDecodePayloadPKCS1( + CCRSACryptorRef publicKey, + const void *cipherText, + size_t cipherTextLen, + void *plainText, + size_t *plainTextLen) +__OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0); + +/*! + @function CCRSACryptorCrypt + + @abstract En/Decrypt data with an RSA key. + + @param rsaKey A pointer to a CCRSACryptorRef. + + @param in The input data. + + @param inLen The input data length. + + @param out The output data buffer. + + @param outLen The output data buffer size. This is an in-out + parameter. When the function returns this is set + to the length of the result. + + @result Possible error returns are kCCParamError, kCCDecodeError + or kCCBufferTooSmall. + +*/ + +CCCryptorStatus +CCRSACryptorCrypt( + CCRSACryptorRef rsaKey, + const void *in, + size_t inLen, + void *out, + size_t *outLen) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCRSAGetKeyComponents + @abstract En/Decrypt data with an RSA key. + @param rsaKey A pointer to a CCRSACryptorRef. + @param modulus The modulus in MSB format. + @param modulusLength The modulus data length. (in/out parameter) + @param exponent The raw data bytes of the exponent. + @param exponentLength The exponent data length. (in/out parameter) + @param p The raw data bytes of the modulus factor P. + (ccRSAKeyPrivate only) + @param pLength The P data length. (in/out parameter) + @param q The raw data bytes of the modulus factor Q. + (ccRSAKeyPrivate only) + @param qLength The Q data length. (in/out parameter) + @result If the function is successful (kCCSuccess) +*/ + +CCCryptorStatus +CCRSAGetKeyComponents(CCRSACryptorRef rsaKey, uint8_t *modulus, size_t *modulusLength, uint8_t *exponent, size_t *exponentLength, + uint8_t *p, size_t *pLength, uint8_t *q, size_t *qLength) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCRSACryptorCreateFromData + @abstract For FIPS CAVS testing we need the ability to create an RSA + key from an exponent and Modulus. + + @param keyType The type of key to create - ccRSAKeyPublic + or ccRSAKeyPrivate. + @param modulus The modulus in MSB format. + @param modulusLength The modulus data length. + @param exponent The raw data bytes of the exponent. + @param exponentLength The exponent data length. + @param p The raw data bytes of the modulus factor P. + (ccRSAKeyPrivate only) + @param pLength The P data length. + @param q The raw data bytes of the modulus factor Q. + (ccRSAKeyPrivate only) + @param qLength The Q data length. + + @result If the function is successful (kCCSuccess) a RSACryptoRef is + returned in the ref parameter. All other errors result in + kCCParamError. +*/ + +CCCryptorStatus +CCRSACryptorCreateFromData( CCRSAKeyType keyType, uint8_t *modulus, size_t modulusLength, uint8_t *exponent, size_t exponentLength, + uint8_t *p, size_t pLength, uint8_t *q, size_t qLength, CCRSACryptorRef *ref) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +CCCryptorStatus +CCRSACryptorCreatePairFromData(uint32_t e, + uint8_t *xp1, size_t xp1Length, + uint8_t *xp2, size_t xp2Length, + uint8_t *xp, size_t xpLength, + uint8_t *xq1, size_t xq1Length, + uint8_t *xq2, size_t xq2Length, + uint8_t *xq, size_t xqLength, + CCRSACryptorRef *publicKey, + CCRSACryptorRef *privateKey, + uint8_t *retp, size_t *retpLength, + uint8_t *retq, size_t *retqLength, + uint8_t *retm, size_t *retmLength, + uint8_t *retd, size_t *retdLength) +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); + + +#ifdef __cplusplus +} +#endif + +#endif /* _CC_RSACRYPTOR_H_ */ Index: Source/CommonCryptoSPI/CommonRandomSPI.h ================================================================== --- Source/CommonCryptoSPI/CommonRandomSPI.h +++ Source/CommonCryptoSPI/CommonRandomSPI.h @@ -1,8 +1,13 @@ +#ifndef COMMONRANDOM_H +#define COMMONRANDOM_H 1 + /* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * + * CommonRandom.h + * + * Copyright © 2010-2011 by Apple, Inc. All rights reserved. + * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in @@ -17,62 +22,215 @@ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ - */ - -/*! - @header CommonRandom - The functions provided in CommonRandom.h implement accessors - to cryptographically secure random numbers. -*/ - -#ifndef _COMMON_SECRANDOM_H_ -#define _COMMON_SECRANDOM_H_ - -#include -#include -#include - -/* - When this becomes API we should really make a CommonCrypto/CCErrors.h and - centralize CC error codes - */ - -#include - -#if defined(__cplusplus) -extern "C" { -#endif - - -/*! - @typedef SecRandomRef - @abstract Reference to a (psuedo) random number generator. -*/ - -typedef struct __CCRandom *CCRandomRef; - - -extern CCRandomRef kCCRandomDefault - __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); - -/*! - @function CCRandomCopyBytes - @abstract Return count random bytes in *bytes, allocated by the caller. - @result Return kCCSuccess on success, kCCParamError for parameter error - (unimplemented PRNG) or -1 if something went wrong, check errno - to find out the real error. - @discussion The default PRNG returns cryptographically strong random bits - suitable for use as cryptographic keys, IVs, nonces etc. -*/ - -int CCRandomCopyBytes(CCRandomRef rnd, void *bytes, size_t count) - __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); - - -#if defined(__cplusplus) -} -#endif - -#endif /* !_COMMON_SECRANDOM_H_ */ + * + */ + +#include +#include +#include +#include +#include +#include + +/*! + + @header CommonRNG.h + @abstract An interface to a system random number generator. This module + provides a managed way either to get random numbers from a + NIST-approved random number generator or /dev/random. The NIST + random number generator gets its entropy from /dev/random, but + operates 9x-10x faster than it. + + @discussion It is inconvenient to call system random number generators + directly. In the simple case of calling /dev/random, the caller + has to open the device and close it in addition to managing it + while it's open. This module has as its immediate raison d'tre + the inconvenience of doing this. It manages a file descriptor to + /dev/random including the exception processing of what happens + in a fork() and exec(). Call CCRandomCopyBytes() and all the + fiddly bits are managed for you. Just get on with whatever you + were really trying to do. + + More importantly, though, it also manages a FIPS 140-compliant + way to get random numbers. NIST created in their document SP + 800-90 a new type of AES-based "Deterministic Random Bit + Generator" (DRBG) (what is often called a PRNG) and guidelines + on how to use it. There are two reasons to prefer it over + directly calling /dev/random. It's a standard and immediately + compliant with FIPS 140, and it is dramatically faster per-byte. + For complete disclosure, this implements an AES-CTR DRBG with + derivation function using AES-128 as the cipher and prediction + resistance. + + Thus, we provide two RNGs to call, kCCRandomDefault (the NIST + one) and kCCRandomDevRandom (a managed wrapper around + /dev/random). If you are doing anything involving security, call + the default one. You'll be glad you did, because it does much + security-related housekeeping for you and you don't have to + think about it. Really. + + In implementation details, the first time you call + CCRandomCopyBytes(), it will open up /dev/random and seed the RNG + with 64 bytes. After each call, there is a reseed operation that + happens on an async GCD queue that reseeds with 32 bytes and a + nonce from mach_absolute_time(). All access to the internal DRBG + is serialized through a GCD queue and is therefore thread safe. + + Should you need to create your own RNG context or have a secondary + RNG context, CCRNGCreate() and CCRNGRelease() will let you create + an RNG yourself and then call CCRandomCopyBytes() with that + context. + */ + + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef CCCryptorStatus CCRNGStatus; + + +/*! + @typedef CCRandomRef + @abstract Abstract Reference to a random number generator. + +*/ +#ifndef COMMONRANDOMPRIV_H // Check for the private header +typedef struct __CCRandom *CCRandomRef; +#endif + +/*! + @function CCRandomCopyBytes + + @abstract Return random bytes in a buffer allocated by the caller. + + @discussion The default PRNG returns cryptographically strong random + bits suitable for use as cryptographic keys, IVs, nonces etc. + + @param rnd The random number generator to use. Pre-defined values: + kCCRandomDefault, the NIST AES-based one and + kCCRandomDevRandom, /dev/random itself. + + Alternately, you can create one with CCRNGCreate(). + + @param bytes Pointer to the return buffer. + @param count Number of random bytes to return. + + @result Return kCCSuccess on success. Other values are ... + */ + +int CCRandomCopyBytes(CCRandomRef rnd, void *bytes, size_t count) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +extern CCRandomRef kCCRandomDefault +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +extern CCRandomRef kCCRandomDevRandom +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCRNGCreate + + @abstract Create an RNG context. + + @discussion This creates a CCRandomRef that you can then pass into + CCRandomCopyBytes(). Only call this if you need to create + your own context. You can call CCRandomCopyBytes() with this + context. Remember to release it. + + @param options Option flags. See below. Unless you have a very + good reason, just use kCCRNGOptionCryptoRNG. + + @param rngRef A pointer to a CCRandomRef. + + @result Returns kCCSuccess on success. + + + */ + +CCRNGStatus +CCRNGCreate(uint32_t options, CCRandomRef *rngRef) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + +/*! + @function CCRNGRelease + + @abstract Release an RNG context. + + @discussion This releases and deallocates a context. + + @param rng A CCRandomRef. + + @result Returns kCCSuccess on success. + + + */ + +CCRNGStatus +CCRNGRelease(CCRandomRef rng) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0); + + +/* + Options flags + + The option flags are not exposed through the default use of CCRandomGetBytes(). + They are only exposed through direct use of a CCRandomRef. + + The polarity is reversed here for two reasons. One is that I want people to + think before they make a non-FIPS, predictable RNG. If you're doing any sort of + crypto, you want FIPS and you want prediction resistance. Prediction resistance + reseeds after every query which is slightly slower, but more secure. Non-FIPS + is about 20% faster for very large reads, where very large means well over a MB + per get, which you will probably never do. If you pull under 500 bytes from the + RNG, there is *NO* change in performance for non-FIPS. + + Non-FIPS makes two changes. First, it increments the counter in machine-natural + order, which on little-endian machines makes a very small performance + improvement. It saves you two byte-swaps for every 32-bit increment of the + counter, for every int that has to be incremented, which is admittedly not + much. It is so much not much that this is a compile-time option in the DRBG, + and likely to be turned off. + + But something that makes a difference is that it reads from the DRBG in one + lump sum, instead of in 500 byte chunks, as FIPS demands. On a 50MB test, runs + about 20% faster, but obviously for 500 bytes would run the same. + + Arguably, we should remove the non-FIPS thing because in most circumstances it + matters naught. Also, as we've said before, if you're interested in security, + you shouldn't be worrying about a small performance tweaks. + + Prediction resistance re-seeds the DRBG after every request with 32 bytes from + /dev/random and a timestamp from mach_absolute_time(). This is a legitimate + thing you might want and a difference between a "random" and a "urandom" + variant. + +*/ + +enum { + kCCRNGOptionIgnoreFIPS = 0x00000001, + kCCRNGOptionNoPredictionResistance = 0x00000002, + + kCCRNGOptionCryptoRNG = 0x00000000, +}; + +// Accessor functions to get the rng "states" for internal Security Framework +// use. +#include +#include + +struct ccrng_state *ccDevRandomGetRngState() +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); + +struct ccrng_state *ccDRBGGetRngState() +__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); + + +#if defined(__cplusplus) +} +#endif + +#endif /* COMMONRANDOM_H */ + Index: Source/CommonCryptoSPI/aes.h ================================================================== --- Source/CommonCryptoSPI/aes.h +++ Source/CommonCryptoSPI/aes.h @@ -1,256 +1,97 @@ /* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 28/01/2004 - - This file contains the definitions required to use AES in C. See aesopt.h - for optimisation details. -*/ - -#if !defined( _CC_AES_H_ ) -#define _CC_AES_H_ - -// Generate nothing if this file has been included in an assembly language file. -#if !__ASSEMBLER__ - -#include -#include -#include - -/* This include is used to find 8 & 32 bit unsigned integer types */ -#include - -#include -#if TARGET_OS_EMBEDDED && __arm__ -#define CC_AES_USE_HARDWARE 1 -#endif - -#if CC_AES_USE_HARDWARE -#define CC_AES_MAX_KEYSIZE 32 //32 bytes or 256 bits -#endif - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* CommonCrypto-specific mods. - - _APPLE_COMMON_CRYPTO_, when defined, enables the following: - - -- IV/chain buffer stored in the aes_{en,de}crypt_ctx (though it - can still be passed to the encrypt/decrypt routines) - -- ECB/CBC controlled per ctx->cbcEnable - -- common SPI functions - -- disables AES_VAR -*/ - -#define AES_128 /* define if AES with 128 bit keys is needed */ -#define AES_192 /* define if AES with 192 bit keys is needed */ -#define AES_256 /* define if AES with 256 bit keys is needed */ -#ifndef _APPLE_COMMON_CRYPTO_ -#define AES_VAR /* define if a variable key size is needed */ -#endif - -/* The following must also be set in assembler files if being used */ - -#define AES_ENCRYPT /* if support for encryption is needed */ -#define AES_DECRYPT /* if support for decryption is needed */ -//#define AES_ERR_CHK /* for parameter checks & error return codes */ - -#if UCHAR_MAX == 0xff /* an unsigned 8 bit type */ - typedef unsigned char aes_08t; -#else -# error Please define aes_08t as an 8-bit unsigned integer type in aes.h -#endif - -#if UINT_MAX == 4294967295 /* an unsigned 32 bit type */ - typedef unsigned int aes_32t; -#elif ULONG_MAX == 4294967295ul - typedef unsigned long aes_32t; -#else -# error Please define aes_32t as a 32-bit unsigned integer type in aes.h -#endif - -#define AES_BLOCK_SIZE 16 /* the AES block size in bytes */ -#define N_COLS 4 /* the number of columns in the state */ - -/* The key schedule length is 11, 13 or 15 16-byte blocks for 128, */ -/* 192 or 256-bit keys respectively. That is 176, 208 or 240 bytes */ -/* or 44, 52 or 60 32-bit words. For simplicity this code allocates */ -/* the maximum 60 word array for the key schedule for all key sizes */ - -#if defined( AES_VAR ) || defined( AES_256 ) -#define KS_LENGTH 60 -#elif defined( AES_192 ) -#define KS_LENGTH 52 -#else -#define KS_LENGTH 44 -#endif - -#if defined( AES_ERR_CHK ) -#define aes_ret int -#define aes_good 0 -#define aes_error -1 -#else -#define aes_ret void -#endif - -#if !defined( AES_DLL ) /* implement normal/DLL functions */ -#define aes_rval aes_ret -#else -#define aes_rval aes_ret __declspec(dllexport) _stdcall -#endif - -typedef struct -{ aes_32t ks[KS_LENGTH]; - aes_32t rn; - #ifdef _APPLE_COMMON_CRYPTO_ - unsigned char chainBuf[AES_BLOCK_SIZE]; - aes_32t cbcEnable; - #if CC_AES_USE_HARDWARE - unsigned char keyBytes[CC_AES_MAX_KEYSIZE]; - aes_32t keyLength; - #endif - #endif -} aes_encrypt_ctx; - -typedef struct -{ aes_32t ks[KS_LENGTH]; - aes_32t rn; - #ifdef _APPLE_COMMON_CRYPTO_ - unsigned char chainBuf[AES_BLOCK_SIZE]; - aes_32t cbcEnable; - #if CC_AES_USE_HARDWARE - unsigned char keyBytes[CC_AES_MAX_KEYSIZE]; - aes_32t keyLength; - #endif - #endif -} aes_decrypt_ctx; - -typedef struct -{ - aes_decrypt_ctx decrypt; - aes_encrypt_ctx encrypt; -} aes_ctx; - - -/* This routine must be called before first use if non-static */ -/* tables are being used */ - -void gen_tabs(void); - -/* The key length (klen) is input in bytes when it is in the range */ -/* 16 <= klen <= 32 or in bits when in the range 128 <= klen <= 256 */ - -#if defined( AES_ENCRYPT ) - -#if defined(AES_128) || defined(AES_VAR) -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -aes_rval aes_encrypt_key128(const unsigned char *in_key, aes_encrypt_ctx cx[1]); -#endif - -#if defined(AES_192) || defined(AES_VAR) -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -aes_rval aes_encrypt_key192(const unsigned char *in_key, aes_encrypt_ctx cx[1]); -#endif - -#if defined(AES_256) || defined(AES_VAR) -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -aes_rval aes_encrypt_key256(const unsigned char *in_key, aes_encrypt_ctx cx[1]); -#endif - -#if defined(AES_VAR) -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -aes_rval aes_encrypt_key(const unsigned char *in_key, int key_len, aes_encrypt_ctx cx[1]); -#endif - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -aes_rval aes_encrypt_cbc(const unsigned char *in_blk, const unsigned char *in_iv, unsigned int num_blk, - unsigned char *out_blk, aes_encrypt_ctx cx[1]); -#endif - -#if defined( AES_DECRYPT ) - -#if defined(AES_128) || defined(AES_VAR) -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -aes_rval aes_decrypt_key128(const unsigned char *in_key, aes_decrypt_ctx cx[1]); -#endif - -#if defined(AES_192) || defined(AES_VAR) -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -aes_rval aes_decrypt_key192(const unsigned char *in_key, aes_decrypt_ctx cx[1]); -#endif - -#if defined(AES_256) || defined(AES_VAR) -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -aes_rval aes_decrypt_key256(const unsigned char *in_key, aes_decrypt_ctx cx[1]); -#endif - -#if defined(AES_VAR) -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -aes_rval aes_decrypt_key(const unsigned char *in_key, int key_len, aes_decrypt_ctx cx[1]); -#endif - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -aes_rval aes_decrypt_cbc(const unsigned char *in_blk, const unsigned char *in_iv, unsigned int num_blk, - unsigned char *out_blk, aes_decrypt_ctx cx[1]); -#endif - -#ifdef _APPLE_COMMON_CRYPTO_ - -typedef union -{ - aes_decrypt_ctx decrypt; - aes_encrypt_ctx encrypt; -} aes_cc_ctx; - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -int aes_cc_set_key(aes_cc_ctx *cx, const void *rawKey, aes_32t keyLength, - int forEncrypt); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void aes_cc_set_iv(aes_cc_ctx *cx, int forEncrypt, const void *iv); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void aes_cc_encrypt(aes_cc_ctx *cx, const void *blocksIn, aes_32t numBlocks, - void *blocksOut); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void aes_cc_decrypt(aes_cc_ctx *cx, const void *blocksIn, aes_32t numBlocks, - void *blocksOut); -#endif - -#if defined(__cplusplus) -} -#endif - -#endif // !__ASSEMBLER__ + * aes.h + * + * Copyright © 2010 by Apple, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + * + */ + +/* + * aes.h + * CommonCrypto shoefly for compatability with older versions + * + */ + +#ifdef CC_Building +#include "CommonCryptor.h" +#include "CommonCryptorSPI.h" +#include "CommonCryptorPriv.h" +#else +#include +#include +#endif /* CC_Building */ + +#if !defined( _CC_AES_H_ ) +#define _CC_AES_H_ + +#if defined(__cplusplus) +extern "C" { +#endif + +#define AES_BLOCK_SIZE 16 /* the AES block size in bytes */ + +typedef struct +{ + CCCryptorRef cref; + uint32_t ctx[kCCContextSizeAES128/4]; +} aes_encrypt_ctx; + +typedef struct +{ + CCCryptorRef cref; + uint32_t ctx[kCCContextSizeAES128/4]; +} aes_decrypt_ctx; + + + +void aes_encrypt_key128(const unsigned char *in_key, aes_encrypt_ctx cx[1]) +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0); + +void aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]) +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0); + +void aes_encrypt_key256(const unsigned char *in_key, aes_encrypt_ctx cx[1]) +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0); + +void aes_encrypt_cbc(const unsigned char *in_blk, const unsigned char *in_iv, unsigned int num_blk, + unsigned char *out_blk, aes_encrypt_ctx cx[1]) +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0); + +void aes_decrypt_key128(const unsigned char *in_key, aes_decrypt_ctx cx[1]) +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0); + +void aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]) +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0); + +void aes_decrypt_key256(const unsigned char *in_key, aes_decrypt_ctx cx[1]) +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0); + +void aes_decrypt_cbc(const unsigned char *in_blk, const unsigned char *in_iv, unsigned int num_blk, + unsigned char *out_blk, aes_decrypt_ctx cx[1]) +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0); + + +#if defined(__cplusplus) +} +#endif + #endif /* _CC_AES_H_ */ DELETED Source/CommonCryptoSPI/aesopt.h Index: Source/CommonCryptoSPI/aesopt.h ================================================================== --- Source/CommonCryptoSPI/aesopt.h +++ /dev/null @@ -1,789 +0,0 @@ -/* -The bulk of this file is from Dr. Brian Gladman's AES implementation, described -in the comments below. But some code has been added to select the -implementation. See comments below, where UseGladmanAES is defined. The new -code does not alter Gladman's AES implementation except to completely include -or exclude it from compilation. - - -- Eric Postpischil, January 8, 2008. - - - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 28/01/2004 - - My thanks go to Dag Arne Osvik for devising the schemes used here for key - length derivation from the form of the key schedule - - This file contains the compilation options for AES (Rijndael) and code - that is common across encryption, key scheduling and table generation. - - OPERATION - - These source code files implement the AES algorithm Rijndael designed by - Joan Daemen and Vincent Rijmen. This version is designed for the standard - block size of 16 bytes and for key sizes of 128, 192 and 256 bits (16, 24 - and 32 bytes). - - This version is designed for flexibility and speed using operations on - 32-bit words rather than operations on bytes. It can be compiled with - either big or little endian internal byte order but is faster when the - native byte order for the processor is used. - - THE CIPHER INTERFACE - - The cipher interface is implemented as an array of bytes in which lower - AES bit sequence indexes map to higher numeric significance within bytes. - - aes_08t (an unsigned 8-bit type) - aes_32t (an unsigned 32-bit type) - struct aes_encrypt_ctx (structure for the cipher encryption context) - struct aes_decrypt_ctx (structure for the cipher decryption context) - aes_rval the function return type - - C subroutine calls: - - aes_rval aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]); - aes_rval aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]); - aes_rval aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]); - aes_rval aes_encrypt(const unsigned char *in, unsigned char *out, - const aes_encrypt_ctx cx[1]); - - aes_rval aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]); - aes_rval aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]); - aes_rval aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]); - aes_rval aes_decrypt(const unsigned char *in, unsigned char *out, - const aes_decrypt_ctx cx[1]); - - IMPORTANT NOTE: If you are using this C interface with dynamic tables make sure that - you call genTabs() before AES is used so that the tables are initialised. - - C++ aes class subroutines: - - Class AESencrypt for encryption - - Construtors: - AESencrypt(void) - AESencrypt(const unsigned char *key) - 128 bit key - Members: - aes_rval key128(const unsigned char *key) - aes_rval key192(const unsigned char *key) - aes_rval key256(const unsigned char *key) - aes_rval encrypt(const unsigned char *in, unsigned char *out) const - - Class AESdecrypt for encryption - Construtors: - AESdecrypt(void) - AESdecrypt(const unsigned char *key) - 128 bit key - Members: - aes_rval key128(const unsigned char *key) - aes_rval key192(const unsigned char *key) - aes_rval key256(const unsigned char *key) - aes_rval decrypt(const unsigned char *in, unsigned char *out) const - - COMPILATION - - The files used to provide AES (Rijndael) are - - a. aes.h for the definitions needed for use in C. - b. aescpp.h for the definitions needed for use in C++. - c. aesopt.h for setting compilation options (also includes common code). - d. aescrypt.c for encryption and decrytpion, or - e. aeskey.c for key scheduling. - f. aestab.c for table loading or generation. - g. aescrypt.asm for encryption and decryption using assembler code. - h. aescrypt.mmx.asm for encryption and decryption using MMX assembler. - - To compile AES (Rijndael) for use in C code use aes.h and set the - defines here for the facilities you need (key lengths, encryption - and/or decryption). Do not define AES_DLL or AES_CPP. Set the options - for optimisations and table sizes here. - - To compile AES (Rijndael) for use in in C++ code use aescpp.h but do - not define AES_DLL - - To compile AES (Rijndael) in C as a Dynamic Link Library DLL) use - aes.h and include the AES_DLL define. - - CONFIGURATION OPTIONS (here and in aes.h) - - a. set AES_DLL in aes.h if AES (Rijndael) is to be compiled as a DLL - b. You may need to set PLATFORM_BYTE_ORDER to define the byte order. - c. If you want the code to run in a specific internal byte order, then - ALGORITHM_BYTE_ORDER must be set accordingly. - d. set other configuration options decribed below. -*/ - -#if !defined( _CC_AESOPT_H ) -#define _CC_AESOPT_H - -/* Select which AES implementation to use. Preprocessor directives decide - whether to define UseGladmanAES or UseAESedp or, in the future, other - symbols. Source files for the implementations contain preprocessor - directives to compile their code iff the matching symbol is defined. - - The names GladmanAES and AESedp come from the directories containing the - source code. (I prefer putting "AES" first and am tempted to renamed - "GladmanAES" to "AESGladman", since this groups directories by algorithm in - listings, but I am resisting for the moment.) -*/ -#if defined __i386__ || defined __x86_64__ - // On Intel architectures, use AESedp. - #define UseAESedp -#else - // Otherwise, use Gladman AES. - #define UseGladmanAES -#endif - -/* Suppressing all source in a module would yield an empty module after - preprocessing. GCC allows this, but standard C requires a module to - contain at least one external declaration. So here we make an otherwise - unused declaration that generates no object code. -*/ -#if !defined __ASSEMBLER__ - typedef char DummyDeclarationToMakeValidC; -#endif - -#include -#include - -/* CONFIGURATION - USE OF DEFINES - - Later in this section there are a number of defines that control the - operation of the code. In each section, the purpose of each define is - explained so that the relevant form can be included or excluded by - setting either 1's or 0's respectively on the branches of the related - #if clauses. - - PLATFORM SPECIFIC INCLUDES AND BYTE ORDER IN 32-BIT WORDS - - To obtain the highest speed on processors with 32-bit words, this code - needs to determine the byte order of the target machine. The following - block of code is an attempt to capture the most obvious ways in which - various environemnts define byte order. It may well fail, in which case - the definitions will need to be set by editing at the points marked - **** EDIT HERE IF NECESSARY **** below. My thanks go to Peter Gutmann - for his assistance with this endian detection nightmare. -*/ - -#define BRG_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ -#define BRG_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ - -#if defined(__GNUC__) || defined(__GNU_LIBRARY__) -# if defined(__FreeBSD__) || defined(__OpenBSD__) -# include -# elif defined( BSD ) && BSD >= 199103 -# include -# elif defined(__APPLE__) -# if defined(__BIG_ENDIAN__) && !defined( BIG_ENDIAN ) -# define BIG_ENDIAN -# elif defined(__LITTLE_ENDIAN__) && !defined( LITTLE_ENDIAN ) -# define LITTLE_ENDIAN -# endif -# else -# include -# if defined(__BEOS__) -# include -# endif -# endif -#endif - -#if !defined(PLATFORM_BYTE_ORDER) -# if defined(LITTLE_ENDIAN) || defined(BIG_ENDIAN) -# if defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif !defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# elif defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# endif -# elif defined(_LITTLE_ENDIAN) || defined(_BIG_ENDIAN) -# if defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif !defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# elif defined(_BYTE_ORDER) && (_BYTE_ORDER == _LITTLE_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# endif -# elif defined(__LITTLE_ENDIAN__) || defined(__BIG_ENDIAN__) -# if defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif !defined(__LITTLE_ENDIAN__) && defined(__BIG_ENDIAN__) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __LITTLE_ENDIAN__) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# endif -# endif -#endif - -/* if the platform is still unknown, try to find its byte order */ -/* from commonly used machine defines */ - -#if !defined(PLATFORM_BYTE_ORDER) - -#if defined( __alpha__ ) || defined( __alpha ) || defined( i386 ) || \ - defined( __i386__ ) || defined( _M_I86 ) || defined( _M_IX86 ) || \ - defined( __OS2__ ) || defined( sun386 ) || defined( __TURBOC__ ) || \ - defined( vax ) || defined( vms ) || defined( VMS ) || \ - defined( __VMS ) || defined(__x86_64__) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN - -#elif defined( AMIGA ) || defined( applec ) || defined( __AS400__ ) || \ - defined( _CRAY ) || defined( __hppa ) || defined( __hp9000 ) || \ - defined( ibm370 ) || defined( mc68000 ) || defined( m68k ) || \ - defined( __MRC__ ) || defined( __MVS__ ) || defined( __MWERKS__ ) || \ - defined( sparc ) || defined( __sparc) || defined( SYMANTEC_C ) || \ - defined( __TANDEM ) || defined( THINK_C ) || defined( __VMCMS__ ) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN - -#elif 0 /* **** EDIT HERE IF NECESSARY **** */ -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -#elif 0 /* **** EDIT HERE IF NECESSARY **** */ -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -#else -# error Please edit aesopt.h (line 234 or 236) to set the platform byte order -#endif - -#endif - -/* SOME LOCAL DEFINITIONS */ - -#define NO_TABLES 0 -#define ONE_TABLE 1 -#define FOUR_TABLES 4 -#define NONE 0 -#define PARTIAL 1 -#define FULL 2 - -#if defined(bswap32) -#define aes_sw32 bswap32 -#elif defined(bswap_32) -#define aes_sw32 bswap_32 -#else -#define brot(x,n) (((aes_32t)(x) << n) | ((aes_32t)(x) >> (32 - n))) -#define aes_sw32(x) ((brot((x),8) & 0x00ff00ff) | (brot((x),24) & 0xff00ff00)) -#endif - -/* 1. FUNCTIONS REQUIRED - - This implementation provides subroutines for encryption, decryption - and for setting the three key lengths (separately) for encryption - and decryption. When the assembler code is not being used the following - definition blocks allow the selection of the routines that are to be - included in the compilation. -*/ -#if defined( AES_ENCRYPT ) -#define ENCRYPTION -#define ENCRYPTION_KEY_SCHEDULE -#endif - -#if defined( AES_DECRYPT ) -#define DECRYPTION -#define DECRYPTION_KEY_SCHEDULE -#endif - -/* 2. ASSEMBLER SUPPORT - - This define (which can be on the command line) enables the use of the - assembler code routines for encryption and decryption with the C code - only providing key scheduling -*/ -#if 0 && !defined(AES_ASM) -#define AES_ASM -#endif - -/* 3. BYTE ORDER WITHIN 32 BIT WORDS - - The fundamental data processing units in Rijndael are 8-bit bytes. The - input, output and key input are all enumerated arrays of bytes in which - bytes are numbered starting at zero and increasing to one less than the - number of bytes in the array in question. This enumeration is only used - for naming bytes and does not imply any adjacency or order relationship - from one byte to another. When these inputs and outputs are considered - as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to - byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte. - In this implementation bits are numbered from 0 to 7 starting at the - numerically least significant end of each byte (bit n represents 2^n). - - However, Rijndael can be implemented more efficiently using 32-bit - words by packing bytes into words so that bytes 4*n to 4*n+3 are placed - into word[n]. While in principle these bytes can be assembled into words - in any positions, this implementation only supports the two formats in - which bytes in adjacent positions within words also have adjacent byte - numbers. This order is called big-endian if the lowest numbered bytes - in words have the highest numeric significance and little-endian if the - opposite applies. - - This code can work in either order irrespective of the order used by the - machine on which it runs. Normally the internal byte order will be set - to the order of the processor on which the code is to be run but this - define can be used to reverse this in special situations - - NOTE: Assembler code versions rely on PLATFORM_BYTE_ORDER being set -*/ -#if 1 || defined(AES_ASM) -#define ALGORITHM_BYTE_ORDER PLATFORM_BYTE_ORDER -#elif 0 -#define ALGORITHM_BYTE_ORDER BRG_LITTLE_ENDIAN -#elif 0 -#define ALGORITHM_BYTE_ORDER BRG_BIG_ENDIAN -#else -#error The algorithm byte order is not defined -#endif - -/* 4. FAST INPUT/OUTPUT OPERATIONS. - - On some machines it is possible to improve speed by transferring the - bytes in the input and output arrays to and from the internal 32-bit - variables by addressing these arrays as if they are arrays of 32-bit - words. On some machines this will always be possible but there may - be a large performance penalty if the byte arrays are not aligned on - the normal word boundaries. On other machines this technique will - lead to memory access errors when such 32-bit word accesses are not - properly aligned. The option SAFE_IO avoids such problems but will - often be slower on those machines that support misaligned access - (especially so if care is taken to align the input and output byte - arrays on 32-bit word boundaries). If SAFE_IO is not defined it is - assumed that access to byte arrays as if they are arrays of 32-bit - words will not cause problems when such accesses are misaligned. -*/ -#if 0 && !defined(_MSC_VER) -#define SAFE_IO -#endif - -/* 5. LOOP UNROLLING - - The code for encryption and decrytpion cycles through a number of rounds - that can be implemented either in a loop or by expanding the code into a - long sequence of instructions, the latter producing a larger program but - one that will often be much faster. The latter is called loop unrolling. - There are also potential speed advantages in expanding two iterations in - a loop with half the number of iterations, which is called partial loop - unrolling. The following options allow partial or full loop unrolling - to be set independently for encryption and decryption -*/ -#if 1 -#define ENC_UNROLL FULL -#elif 0 -#define ENC_UNROLL PARTIAL -#else -#define ENC_UNROLL NONE -#endif - -#if 1 -#define DEC_UNROLL FULL -#elif 0 -#define DEC_UNROLL PARTIAL -#else -#define DEC_UNROLL NONE -#endif - -/* 6. FAST FINITE FIELD OPERATIONS - - If this section is included, tables are used to provide faster finite - field arithmetic (this has no effect if FIXED_TABLES is defined). -*/ -#if 1 -#define FF_TABLES -#endif - -/* 7. INTERNAL STATE VARIABLE FORMAT - - The internal state of Rijndael is stored in a number of local 32-bit - word varaibles which can be defined either as an array or as individual - names variables. Include this section if you want to store these local - varaibles in arrays. Otherwise individual local variables will be used. -*/ -#if 0 -#define ARRAYS -#endif - -/* In this implementation the columns of the state array are each held in - 32-bit words. The state array can be held in various ways: in an array - of words, in a number of individual word variables or in a number of - processor registers. The following define maps a variable name x and - a column number c to the way the state array variable is to be held. - The first define below maps the state into an array x[c] whereas the - second form maps the state into a number of individual variables x0, - x1, etc. Another form could map individual state colums to machine - register names. -*/ - -#if defined(ARRAYS) -#define s(x,c) x[c] -#else -#define s(x,c) x##c -#endif - -/* 8. FIXED OR DYNAMIC TABLES - - When this section is included the tables used by the code are compiled - statically into the binary file. Otherwise the subroutine gen_tabs() - must be called to compute them before the code is first used. -*/ -#if 1 -#define FIXED_TABLES -#endif - -/* 9. TABLE ALIGNMENT - - On some sytsems speed will be improved by aligning the AES large lookup - tables on particular boundaries. This define should be set to a power of - two giving the desired alignment. It can be left undefined if alignment - is not needed. This option is specific to the Microsft VC++ compiler - - it seems to sometimes cause trouble for the VC++ version 6 compiler. -*/ - -#if 0 && defined(_MSC_VER) && (_MSC_VER >= 1300) -#define TABLE_ALIGN 64 -#endif - -/* 10. INTERNAL TABLE CONFIGURATION - - This cipher proceeds by repeating in a number of cycles known as 'rounds' - which are implemented by a round function which can optionally be speeded - up using tables. The basic tables are each 256 32-bit words, with either - one or four tables being required for each round function depending on - how much speed is required. The encryption and decryption round functions - are different and the last encryption and decrytpion round functions are - different again making four different round functions in all. - - This means that: - 1. Normal encryption and decryption rounds can each use either 0, 1 - or 4 tables and table spaces of 0, 1024 or 4096 bytes each. - 2. The last encryption and decryption rounds can also use either 0, 1 - or 4 tables and table spaces of 0, 1024 or 4096 bytes each. - - Include or exclude the appropriate definitions below to set the number - of tables used by this implementation. -*/ - -#if 1 /* set tables for the normal encryption round */ -#define ENC_ROUND FOUR_TABLES -#elif 0 -#define ENC_ROUND ONE_TABLE -#else -#define ENC_ROUND NO_TABLES -#endif - -#if 1 /* set tables for the last encryption round */ -#define LAST_ENC_ROUND FOUR_TABLES -#elif 0 -#define LAST_ENC_ROUND ONE_TABLE -#else -#define LAST_ENC_ROUND NO_TABLES -#endif - -#if 1 /* set tables for the normal decryption round */ -#define DEC_ROUND FOUR_TABLES -#elif 0 -#define DEC_ROUND ONE_TABLE -#else -#define DEC_ROUND NO_TABLES -#endif - -#if 1 /* set tables for the last decryption round */ -#define LAST_DEC_ROUND FOUR_TABLES -#elif 0 -#define LAST_DEC_ROUND ONE_TABLE -#else -#define LAST_DEC_ROUND NO_TABLES -#endif - -/* The decryption key schedule can be speeded up with tables in the same - way that the round functions can. Include or exclude the following - defines to set this requirement. -*/ -#if 1 -#define KEY_SCHED FOUR_TABLES -#elif 0 -#define KEY_SCHED ONE_TABLE -#else -#define KEY_SCHED NO_TABLES -#endif - -/* 11. TABLE POINTER CACHING - - Normally tables are referenced directly, Enable this option if you wish to - cache pointers to the tables in the encrypt/decrypt code. Note that this - only works if you are using FOUR_TABLES for the ROUND you enable this for. -*/ -#if 1 -#define ENC_ROUND_CACHE_TABLES -#endif -#if 1 -#define LAST_ENC_ROUND_CACHE_TABLES -#endif -#if 1 -#define DEC_ROUND_CACHE_TABLES -#endif -#if 1 -#define LAST_DEC_ROUND_CACHE_TABLES -#endif - -/* END OF CONFIGURATION OPTIONS */ - -#define RC_LENGTH (5 * (AES_BLOCK_SIZE / 4 - 2)) - -/* Disable or report errors on some combinations of options */ - -#if ENC_ROUND == NO_TABLES && LAST_ENC_ROUND != NO_TABLES -#undef LAST_ENC_ROUND -#define LAST_ENC_ROUND NO_TABLES -#elif ENC_ROUND == ONE_TABLE && LAST_ENC_ROUND == FOUR_TABLES -#undef LAST_ENC_ROUND -#define LAST_ENC_ROUND ONE_TABLE -#endif - -#if ENC_ROUND == NO_TABLES && ENC_UNROLL != NONE -#undef ENC_UNROLL -#define ENC_UNROLL NONE -#endif - -#if DEC_ROUND == NO_TABLES && LAST_DEC_ROUND != NO_TABLES -#undef LAST_DEC_ROUND -#define LAST_DEC_ROUND NO_TABLES -#elif DEC_ROUND == ONE_TABLE && LAST_DEC_ROUND == FOUR_TABLES -#undef LAST_DEC_ROUND -#define LAST_DEC_ROUND ONE_TABLE -#endif - -#if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE -#undef DEC_UNROLL -#define DEC_UNROLL NONE -#endif - -/* upr(x,n): rotates bytes within words by n positions, moving bytes to - higher index positions with wrap around into low positions - ups(x,n): moves bytes by n positions to higher index positions in - words but without wrap around - bval(x,n): extracts a byte from a word - - NOTE: The definitions given here are intended only for use with - unsigned variables and with shift counts that are compile - time constants -*/ - -#if (ALGORITHM_BYTE_ORDER == BRG_LITTLE_ENDIAN) -#define upr(x,n) (((aes_32t)(x) << (8 * (n))) | ((aes_32t)(x) >> (32 - 8 * (n)))) -#define ups(x,n) ((aes_32t) (x) << (8 * (n))) -#define bval(x,n) ((aes_08t)((x) >> (8 * (n)))) -#define bytes2word(b0, b1, b2, b3) \ - (((aes_32t)(b3) << 24) | ((aes_32t)(b2) << 16) | ((aes_32t)(b1) << 8) | (b0)) -#endif - -#if (ALGORITHM_BYTE_ORDER == BRG_BIG_ENDIAN) -#define upr(x,n) (((aes_32t)(x) >> (8 * (n))) | ((aes_32t)(x) << (32 - 8 * (n)))) -#define ups(x,n) ((aes_32t) (x) >> (8 * (n)))) -#define bval(x,n) ((aes_08t)((x) >> (24 - 8 * (n)))) -#define bytes2word(b0, b1, b2, b3) \ - (((aes_32t)(b0) << 24) | ((aes_32t)(b1) << 16) | ((aes_32t)(b2) << 8) | (b3)) -#endif - -#if defined(SAFE_IO) - -#define word_in(x,c) bytes2word(((aes_08t*)(x)+4*c)[0], ((aes_08t*)(x)+4*c)[1], \ - ((aes_08t*)(x)+4*c)[2], ((aes_08t*)(x)+4*c)[3]) -#define word_out(x,c,v) { ((aes_08t*)(x)+4*c)[0] = bval(v,0); ((aes_08t*)(x)+4*c)[1] = bval(v,1); \ - ((aes_08t*)(x)+4*c)[2] = bval(v,2); ((aes_08t*)(x)+4*c)[3] = bval(v,3); } - -#elif (ALGORITHM_BYTE_ORDER == PLATFORM_BYTE_ORDER) - -#define word_in(x,c) (*((aes_32t*)(x)+(c))) -#define word_out(x,c,v) (*((aes_32t*)(x)+(c)) = (v)) - -#else - -#define word_in(x,c) aes_sw32(*((aes_32t*)(x)+(c))) -#define word_out(x,c,v) (*((aes_32t*)(x)+(c)) = aes_sw32(v)) - -#endif - -/* the finite field modular polynomial and elements */ - -#define WPOLY 0x011b -#define BPOLY 0x1b - -/* multiply four bytes in GF(2^8) by 'x' {02} in parallel */ - -#define m1 0x80808080 -#define m2 0x7f7f7f7f -#define gf_mulx(x) ((((x) & m2) << 1) ^ ((((x) & m1) >> 7) * BPOLY)) - -/* The following defines provide alternative definitions of gf_mulx that might - give improved performance if a fast 32-bit multiply is not available. Note - that a temporary variable u needs to be defined where gf_mulx is used. - -#define gf_mulx(x) (u = (x) & m1, u |= (u >> 1), ((x) & m2) << 1) ^ ((u >> 3) | (u >> 6)) -#define m4 (0x01010101 * BPOLY) -#define gf_mulx(x) (u = (x) & m1, ((x) & m2) << 1) ^ ((u - (u >> 7)) & m4) -*/ - -/* Work out which tables are needed for the different options */ - -#if defined( AES_ASM ) -#if defined( ENC_ROUND ) -#undef ENC_ROUND -#endif -#define ENC_ROUND FOUR_TABLES -#if defined( LAST_ENC_ROUND ) -#undef LAST_ENC_ROUND -#endif -#define LAST_ENC_ROUND FOUR_TABLES -#if defined( DEC_ROUND ) -#undef DEC_ROUND -#endif -#define DEC_ROUND FOUR_TABLES -#if defined( LAST_DEC_ROUND ) -#undef LAST_DEC_ROUND -#endif -#define LAST_DEC_ROUND FOUR_TABLES -#if defined( KEY_SCHED ) -#undef KEY_SCHED -#define KEY_SCHED FOUR_TABLES -#endif -#endif - -#if defined(ENCRYPTION) || defined(AES_ASM) -#if ENC_ROUND == ONE_TABLE -#define FT1_SET -#elif ENC_ROUND == FOUR_TABLES -#define FT4_SET -#else -#define SBX_SET -#endif -#if LAST_ENC_ROUND == ONE_TABLE -#define FL1_SET -#elif LAST_ENC_ROUND == FOUR_TABLES -#define FL4_SET -#elif !defined(SBX_SET) -#define SBX_SET -#endif -#endif - -#if defined(DECRYPTION) || defined(AES_ASM) -#if DEC_ROUND == ONE_TABLE -#define IT1_SET -#elif DEC_ROUND == FOUR_TABLES -#define IT4_SET -#else -#define ISB_SET -#endif -#if LAST_DEC_ROUND == ONE_TABLE -#define IL1_SET -#elif LAST_DEC_ROUND == FOUR_TABLES -#define IL4_SET -#elif !defined(ISB_SET) -#define ISB_SET -#endif -#endif - -#if defined(ENCRYPTION_KEY_SCHEDULE) || defined(DECRYPTION_KEY_SCHEDULE) -#if KEY_SCHED == ONE_TABLE -#define LS1_SET -#define IM1_SET -#elif KEY_SCHED == FOUR_TABLES -#define LS4_SET -#define IM4_SET -#elif !defined(SBX_SET) -#define SBX_SET -#endif -#endif - -/* generic definitions of Rijndael macros that use tables */ - -#define no_table(x,box,vf,rf,c) bytes2word( \ - box[bval(vf(x,0,c),rf(0,c))], \ - box[bval(vf(x,1,c),rf(1,c))], \ - box[bval(vf(x,2,c),rf(2,c))], \ - box[bval(vf(x,3,c),rf(3,c))]) - -#define one_table(x,op,tab,vf,rf,c) \ - ( tab[bval(vf(x,0,c),rf(0,c))] \ - ^ op(tab[bval(vf(x,1,c),rf(1,c))],1) \ - ^ op(tab[bval(vf(x,2,c),rf(2,c))],2) \ - ^ op(tab[bval(vf(x,3,c),rf(3,c))],3)) - -#define four_tables(x,tab,vf,rf,c) \ - ( tab[0][bval(vf(x,0,c),rf(0,c))] \ - ^ tab[1][bval(vf(x,1,c),rf(1,c))] \ - ^ tab[2][bval(vf(x,2,c),rf(2,c))] \ - ^ tab[3][bval(vf(x,3,c),rf(3,c))]) - -#define four_cached_tables(x,tab,vf,rf,c) \ -( tab##0[bval(vf(x,0,c),rf(0,c))] \ - ^ tab##1[bval(vf(x,1,c),rf(1,c))] \ - ^ tab##2[bval(vf(x,2,c),rf(2,c))] \ - ^ tab##3[bval(vf(x,3,c),rf(3,c))]) - -#define vf1(x,r,c) (x) -#define rf1(r,c) (r) -#define rf2(r,c) ((8+r-c)&3) - -/* perform forward and inverse column mix operation on four bytes in long word x in */ -/* parallel. NOTE: x must be a simple variable, NOT an expression in these macros. */ - -#if defined(FM4_SET) /* not currently used */ -#define fwd_mcol(x) four_tables(x,t_use(f,m),vf1,rf1,0) -#elif defined(FM1_SET) /* not currently used */ -#define fwd_mcol(x) one_table(x,upr,t_use(f,m),vf1,rf1,0) -#else -#define dec_fmvars aes_32t g2 -#define fwd_mcol(x) (g2 = gf_mulx(x), g2 ^ upr((x) ^ g2, 3) ^ upr((x), 2) ^ upr((x), 1)) -#endif - -#if defined(IM4_SET) -#define inv_mcol(x) four_tables(x,t_use(i,m),vf1,rf1,0) -#elif defined(IM1_SET) -#define inv_mcol(x) one_table(x,upr,t_use(i,m),vf1,rf1,0) -#else -#define dec_imvars aes_32t g2, g4, g9 -#define inv_mcol(x) (g2 = gf_mulx(x), g4 = gf_mulx(g2), g9 = (x) ^ gf_mulx(g4), g4 ^= g9, \ - (x) ^ g2 ^ g4 ^ upr(g2 ^ g9, 3) ^ upr(g4, 2) ^ upr(g9, 1)) -#endif - -#if defined(FL4_SET) -#define ls_box(x,c) four_tables(x,t_use(f,l),vf1,rf2,c) -#elif defined(LS4_SET) -#define ls_box(x,c) four_tables(x,t_use(l,s),vf1,rf2,c) -#elif defined(FL1_SET) -#define ls_box(x,c) one_table(x,upr,t_use(f,l),vf1,rf2,c) -#elif defined(LS1_SET) -#define ls_box(x,c) one_table(x,upr,t_use(l,s),vf1,rf2,c) -#else -#define ls_box(x,c) no_table(x,t_use(s,box),vf1,rf2,c) -#endif - -#endif /* _CC_AESOPT_H */ DELETED Source/CommonCryptoSPI/cast.h Index: Source/CommonCryptoSPI/cast.h ================================================================== --- Source/CommonCryptoSPI/cast.h +++ /dev/null @@ -1,134 +0,0 @@ -/* crypto/cast/cast.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef CC_CAST_H -#define CC_CAST_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#ifdef _APPLE_COMMON_CRYPTO_ -/* avoid symbol collision with libSystem & libcrypto */ -#define CAST_set_key CC_CAST_set_key -#define CAST_ecb_encrypt CC_CAST_ecb_encrypt -#define CAST_encrypt CC_CAST_encrypt -#define CAST_decrypt CC_CAST_decrypt -#endif /* _APPLE_COMMON_CRYPTO_ */ - -#ifdef NO_CAST -#error CAST is disabled. -#endif - -#define CAST_ENCRYPT 1 -#define CAST_DECRYPT 0 - -#ifdef _APPLE_COMMON_CRYPTO_ -#define CAST_LONG uint32_t -#else -#define CAST_LONG unsigned long -#endif /* _APPLE_COMMON_CRYPTO_ */ - -#define CAST_BLOCK 8 /* block size in bytes */ -#define CAST_KEY_LENGTH 16 /* MAX key size in bytes */ -#define CAST_MIN_KEY_LENGTH 5 /* MIN key size in bytes */ -typedef struct cast_key_st - { - CAST_LONG data[32]; - int short_key; /* Use reduced rounds for short key */ - } CAST_KEY; - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out,CAST_KEY *key, - int enc); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void CAST_encrypt(CAST_LONG *data,CAST_KEY *key); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void CAST_decrypt(CAST_LONG *data,CAST_KEY *key); -#ifndef _APPLE_COMMON_CRYPTO_ - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - CAST_KEY *ks, unsigned char *iv, int enc); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, CAST_KEY *schedule, unsigned char *ivec, - int *num, int enc); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, CAST_KEY *schedule, unsigned char *ivec, - int *num); -#endif /* _APPLE_COMMON_CRYPTO_ */ -#ifdef __cplusplus -} -#endif - -#endif /* CC_CAST_H */ DELETED Source/CommonCryptoSPI/ccCast.h Index: Source/CommonCryptoSPI/ccCast.h ================================================================== --- Source/CommonCryptoSPI/ccCast.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * ccCast.h - shim between openssl-based CAST and CommonEncryption. - * - * Created 3/30/06 by Doug Mitchell. - */ - -#ifndef _CC_CCCAST_H_ -#define _CC_CCCAST_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -int cast_cc_set_key( - CAST_KEY *cx, - const void *rawKey, - size_t keyLength, - int forEncrypt); - -void cast_cc_encrypt(CAST_KEY *cx, const void *blockIn, void *blockOut); -void cast_cc_decrypt(CAST_KEY *cx, const void *blockIn, void *blockOut); - -#ifdef __cplusplus -} -#endif - -#endif /* _CC_CCCAST_H_ */ DELETED Source/CommonCryptoSPI/ccRC2.h Index: Source/CommonCryptoSPI/ccRC2.h ================================================================== --- Source/CommonCryptoSPI/ccRC2.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _CC_RC2_H_ -#define _CC_RC2_H_ - -#include -#include "rc2.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif - -int rc2_cc_set_key(RC2_Schedule *cx, const void *rawKey, size_t keyLength); -void rc2_cc_encrypt(RC2_Schedule *cx, const void *blockIn, void *blockOut); -void rc2_cc_decrypt(RC2_Schedule *cx, const void *blockIn, void *blockOut); - -#ifdef __cplusplus -} -#endif - -#endif /* _CC_RC2_H_ */ ADDED Source/CommonCryptoSPI/lionCompat.h Index: Source/CommonCryptoSPI/lionCompat.h ================================================================== --- /dev/null +++ Source/CommonCryptoSPI/lionCompat.h @@ -0,0 +1,54 @@ +/* + * Copyright © 2011 by Apple, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + * + */ + + +#if !defined( _COMMON_CRYPTO_LION_COMPAT_ ) +#define _COMMON_CRYPTO_LION_COMPAT_ + +#include +#include +#include + +typedef struct +{ + CCCryptorRef cref; +} CAST_KEY; + + +size_t +CCDigestBlockSize(CCDigestRef ctx) +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); + +// might be needed. +void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out, CAST_KEY *key, int enc) +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA); + + + +// might be needed. +void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data) +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA); + + +#endif /* _COMMON_CRYPTO_LION_COMPAT_ */ DELETED Source/CommonCryptoSPI/opensslDES.h Index: Source/CommonCryptoSPI/opensslDES.h ================================================================== --- Source/CommonCryptoSPI/opensslDES.h +++ /dev/null @@ -1,145 +0,0 @@ -/* crypto/des/des.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* - * This is pared-down version of , shorn of - * everything except the bare-bones single-block encrypt/decrypt - * routine DES_encrypt1() and the types and #defines needed to use - * it. Plus it has the shim code needed to use this function in - * CommonEncryption. - */ - -#ifndef _CC_OPENSSL_DES_H_ -#define _CC_OPENSSL_DES_H_ - -#include -#include -#include - -#define OPENSSL_DISABLE_OLD_DES_SUPPORT - -// #include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * These typedefs and defines moved here from des.h to allow - * this interface to be exported (via private SPI) to the CSP. - */ -typedef unsigned char DES_cblock[8]; -typedef /* const */ unsigned char const_DES_cblock[8]; -/* With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * - * and const_DES_cblock * are incompatible pointer types. */ - -#undef DES_LONG -#define DES_LONG uint32_t - -typedef struct DES_ks - { - union - { - DES_cblock cblock; - /* make sure things are correct size on machines with - * 8 byte longs */ - DES_LONG deslong[2]; - } ks[16]; - } DES_key_schedule; - - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -int osDesSetkey(DES_key_schedule *dinst, char *key, size_t keyLength, - int forEencrypt); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void osDesEncrypt(DES_key_schedule *ks, - const_DES_cblock *input, - DES_cblock *output); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void osDesDecrypt(DES_key_schedule *ks, - const_DES_cblock *input, - DES_cblock *output); - -/* triple DES */ -typedef struct { - DES_key_schedule ks[3]; -} DES3_Schedule; - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -int osDes3Setkey(DES3_Schedule *dinst, char *key, size_t keyLength, - int forEencrypt); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void osDes3Encrypt(DES3_Schedule *ks, - const_DES_cblock *input, - DES_cblock *output); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void osDes3Decrypt(DES3_Schedule *ks, - const_DES_cblock *input, - DES_cblock *output); - -#ifdef __cplusplus -} -#endif - -#endif /* _CC_OPENSSL_DES_H_ */ DELETED Source/CommonCryptoSPI/rc2.h Index: Source/CommonCryptoSPI/rc2.h ================================================================== --- Source/CommonCryptoSPI/rc2.h +++ /dev/null @@ -1,35 +0,0 @@ - -#ifndef _RC2_H_ -#define _RC2_H_ - -typedef struct rc2_key_st { - unsigned short xkey[64]; -} RC2_Schedule; - -/**********************************************************************\ -* Expand a variable-length user key (between 1 and 128 bytes) to a * -* 64-short working rc2 key, of at most "bits" effective key bits. * -* The effective key bits parameter looks like an export control hack. * -* For normal use, it should always be set to 1024. For convenience, * -* zero is accepted as an alias for 1024. * -\**********************************************************************/ -void rc2_keyschedule( RC2_Schedule *key_schedule, - const unsigned char *key, - unsigned len, - unsigned bits ); - -/**********************************************************************\ -* Encrypt an 8-byte block of plaintext using the given key. * -\**********************************************************************/ -void rc2_encrypt( const RC2_Schedule *key_schedule, - const unsigned char *plain, - unsigned char *cipher ); - -/**********************************************************************\ -* Decrypt an 8-byte block of ciphertext using the given key. * -\**********************************************************************/ -void rc2_decrypt( const RC2_Schedule *key_schedule, - unsigned char *plain, - const unsigned char *cipher ); - -#endif /* _RC2_H_ */ DELETED Source/Digest/md2_dgst.c Index: Source/Digest/md2_dgst.c ================================================================== --- Source/Digest/md2_dgst.c +++ /dev/null @@ -1,240 +0,0 @@ -/* crypto/md2/md2_dgst.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include -#include - -#include "CommonDigestPriv.h" -#ifndef _APPLE_COMMON_CRYPTO_ -#include -#include "opensslv.h" -#endif - -#ifndef _APPLE_COMMON_CRYPTO_ -const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT; -#endif - -/* Implemented from RFC1319 The MD2 Message-Digest Algorithm - */ - -#define UCHAR unsigned char - -static void md2_block(MD2_CTX *c, const unsigned char *d); -/* The magic S table - I have converted it to hex since it is - * basically just a random byte string. */ -static const MD2_INT S[256]={ - 0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, - 0x3D, 0x36, 0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13, - 0x62, 0xA7, 0x05, 0xF3, 0xC0, 0xC7, 0x73, 0x8C, - 0x98, 0x93, 0x2B, 0xD9, 0xBC, 0x4C, 0x82, 0xCA, - 0x1E, 0x9B, 0x57, 0x3C, 0xFD, 0xD4, 0xE0, 0x16, - 0x67, 0x42, 0x6F, 0x18, 0x8A, 0x17, 0xE5, 0x12, - 0xBE, 0x4E, 0xC4, 0xD6, 0xDA, 0x9E, 0xDE, 0x49, - 0xA0, 0xFB, 0xF5, 0x8E, 0xBB, 0x2F, 0xEE, 0x7A, - 0xA9, 0x68, 0x79, 0x91, 0x15, 0xB2, 0x07, 0x3F, - 0x94, 0xC2, 0x10, 0x89, 0x0B, 0x22, 0x5F, 0x21, - 0x80, 0x7F, 0x5D, 0x9A, 0x5A, 0x90, 0x32, 0x27, - 0x35, 0x3E, 0xCC, 0xE7, 0xBF, 0xF7, 0x97, 0x03, - 0xFF, 0x19, 0x30, 0xB3, 0x48, 0xA5, 0xB5, 0xD1, - 0xD7, 0x5E, 0x92, 0x2A, 0xAC, 0x56, 0xAA, 0xC6, - 0x4F, 0xB8, 0x38, 0xD2, 0x96, 0xA4, 0x7D, 0xB6, - 0x76, 0xFC, 0x6B, 0xE2, 0x9C, 0x74, 0x04, 0xF1, - 0x45, 0x9D, 0x70, 0x59, 0x64, 0x71, 0x87, 0x20, - 0x86, 0x5B, 0xCF, 0x65, 0xE6, 0x2D, 0xA8, 0x02, - 0x1B, 0x60, 0x25, 0xAD, 0xAE, 0xB0, 0xB9, 0xF6, - 0x1C, 0x46, 0x61, 0x69, 0x34, 0x40, 0x7E, 0x0F, - 0x55, 0x47, 0xA3, 0x23, 0xDD, 0x51, 0xAF, 0x3A, - 0xC3, 0x5C, 0xF9, 0xCE, 0xBA, 0xC5, 0xEA, 0x26, - 0x2C, 0x53, 0x0D, 0x6E, 0x85, 0x28, 0x84, 0x09, - 0xD3, 0xDF, 0xCD, 0xF4, 0x41, 0x81, 0x4D, 0x52, - 0x6A, 0xDC, 0x37, 0xC8, 0x6C, 0xC1, 0xAB, 0xFA, - 0x24, 0xE1, 0x7B, 0x08, 0x0C, 0xBD, 0xB1, 0x4A, - 0x78, 0x88, 0x95, 0x8B, 0xE3, 0x63, 0xE8, 0x6D, - 0xE9, 0xCB, 0xD5, 0xFE, 0x3B, 0x00, 0x1D, 0x39, - 0xF2, 0xEF, 0xB7, 0x0E, 0x66, 0x58, 0xD0, 0xE4, - 0xA6, 0x77, 0x72, 0xF8, 0xEB, 0x75, 0x4B, 0x0A, - 0x31, 0x44, 0x50, 0xB4, 0x8F, 0xED, 0x1F, 0x1A, - 0xDB, 0x99, 0x8D, 0x33, 0x9F, 0x11, 0x83, 0x14, - }; - -#ifndef _APPLE_COMMON_CRYPTO_ -const char *MD2_options(void) - { - if (sizeof(MD2_INT) == 1) - return("md2(char)"); - else - return("md2(int)"); - } -#endif - -int CC_MD2_Init(MD2_CTX *c) - { - c->num=0; - memset(c->state,0,MD2_BLOCK*sizeof(MD2_INT)); - memset(c->cksm,0,MD2_BLOCK*sizeof(MD2_INT)); - memset(c->data,0,MD2_BLOCK); - return 1; - } - -int CC_MD2_Update(MD2_CTX *c, const void *inData, CC_LONG len) - { - const unsigned char *data = (const unsigned char *)inData; - register UCHAR *p; - - if (len == 0) return 1; - - p=c->data; - if (c->num != 0) - { - if ((c->num+len) >= MD2_BLOCK) - { - memcpy(&(p[c->num]),data,MD2_BLOCK-c->num); - md2_block(c,c->data); - data+=(MD2_BLOCK - c->num); - len-=(MD2_BLOCK - c->num); - c->num=0; - /* drop through and do the rest */ - } - else - { - memcpy(&(p[c->num]),data,(int)len); - /* data+=len; */ - c->num+=(int)len; - return 1; - } - } - /* we now can process the input data in blocks of MD2_BLOCK - * chars and save the leftovers to c->data. */ - while (len >= MD2_BLOCK) - { - md2_block(c,data); - data+=MD2_BLOCK; - len-=MD2_BLOCK; - } - memcpy(p,data,(int)len); - c->num=(int)len; - return 1; - } - -static void md2_block(MD2_CTX *c, const unsigned char *d) - { - register MD2_INT t,*sp1,*sp2; - register int i,j; - MD2_INT state[48]; - - sp1=c->state; - sp2=c->cksm; - j=sp2[MD2_BLOCK-1]; - for (i=0; i<16; i++) - { - state[i]=sp1[i]; - state[i+16]=t=d[i]; - state[i+32]=(t^sp1[i]); - j=sp2[i]^=S[t^j]; - } - t=0; - for (i=0; i<18; i++) - { - for (j=0; j<48; j+=8) - { - t= state[j+ 0]^=S[t]; - t= state[j+ 1]^=S[t]; - t= state[j+ 2]^=S[t]; - t= state[j+ 3]^=S[t]; - t= state[j+ 4]^=S[t]; - t= state[j+ 5]^=S[t]; - t= state[j+ 6]^=S[t]; - t= state[j+ 7]^=S[t]; - } - t=(t+i)&0xff; - } - memcpy(sp1,state,16*sizeof(MD2_INT)); - memset(state,0,48*sizeof(MD2_INT)); - } - -int CC_MD2_Final(unsigned char *md, MD2_CTX *c) - { - int i,v; - register UCHAR *cp; - register MD2_INT *p1,*p2; - - cp=c->data; - p1=c->state; - p2=c->cksm; - v=MD2_BLOCK-c->num; - for (i=c->num; i - */ - -#if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN) -#error "DATA_ORDER must be defined!" -#endif - -#ifndef HASH_CBLOCK -#error "HASH_CBLOCK must be defined!" -#endif -#ifndef HASH_LONG -#error "HASH_LONG must be defined!" -#endif -#ifndef HASH_CTX -#error "HASH_CTX must be defined!" -#endif - -#ifndef HASH_UPDATE -#error "HASH_UPDATE must be defined!" -#endif -#ifndef HASH_TRANSFORM -#error "HASH_TRANSFORM must be defined!" -#endif -#ifndef HASH_FINAL -#error "HASH_FINAL must be defined!" -#endif - -#ifndef HASH_BLOCK_HOST_ORDER -#error "HASH_BLOCK_HOST_ORDER must be defined!" -#endif - -#if 0 -/* - * Moved below as it's required only if HASH_BLOCK_DATA_ORDER_ALIGNED - * isn't defined. - */ -#ifndef HASH_BLOCK_DATA_ORDER -#error "HASH_BLOCK_DATA_ORDER must be defined!" -#endif -#endif - -#ifndef HASH_LBLOCK -#define HASH_LBLOCK (HASH_CBLOCK/4) -#endif - -#ifndef HASH_LONG_LOG2 -#define HASH_LONG_LOG2 2 -#endif - -/* - * Engage compiler specific rotate intrinsic function if available. - */ -#undef ROTATE -#ifndef PEDANTIC -# if 0 /* defined(_MSC_VER) */ -# define ROTATE(a,n) _lrotl(a,n) -# elif defined(__MWERKS__) -# if defined(__POWERPC__) -# define ROTATE(a,n) __rlwinm(a,n,0,31) -# elif defined(__MC68K__) - /* Motorola specific tweak. */ -# define ROTATE(a,n) ( n<24 ? __rol(a,n) : __ror(a,32-n) ) -# else -# define ROTATE(a,n) __rol(a,n) -# endif -# elif defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) - /* - * Some GNU C inline assembler templates. Note that these are - * rotates by *constant* number of bits! But that's exactly - * what we need here... - * - * - */ -# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) -# define ROTATE(a,n) ({ register unsigned int ret; \ - asm ( \ - "roll %1,%0" \ - : "=r"(ret) \ - : "I"(n), "0"((unsigned int)a) \ - : "cc"); \ - ret; \ - }) -# elif defined(__powerpc) || defined(__ppc) -# define ROTATE(a,n) ({ register unsigned int ret; \ - asm ( \ - "rlwinm %0,%1,%2,0,31" \ - : "=r"(ret) \ - : "r"(a), "I"(n)); \ - ret; \ - }) -# endif -# endif - -/* - * Engage compiler specific "fetch in reverse byte order" - * intrinsic function if available. - */ -# if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) - /* some GNU C inline assembler templates by */ -# if (defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)) && !defined(I386_ONLY) -# define BE_FETCH32(a) ({ register unsigned int l=(a);\ - asm ( \ - "bswapl %0" \ - : "=r"(l) : "0"(l)); \ - l; \ - }) -# elif defined(__powerpc) -# define LE_FETCH32(a) ({ register unsigned int l; \ - asm ( \ - "lwbrx %0,0,%1" \ - : "=r"(l) \ - : "r"(a)); \ - l; \ - }) - -# elif defined(__sparc) && defined(OPENSSL_SYS_ULTRASPARC) -# define LE_FETCH32(a) ({ register unsigned int l; \ - asm ( \ - "lda [%1]#ASI_PRIMARY_LITTLE,%0"\ - : "=r"(l) \ - : "r"(a)); \ - l; \ - }) -# endif -# endif -#endif /* PEDANTIC */ - -#if HASH_LONG_LOG2==2 /* Engage only if sizeof(HASH_LONG)== 4 */ -/* A nice byte order reversal from Wei Dai */ -#ifdef ROTATE -/* 5 instructions with rotate instruction, else 9 */ -#define REVERSE_FETCH32(a,l) ( \ - l=*(const HASH_LONG *)(a), \ - ((ROTATE(l,8)&0x00FF00FF)|(ROTATE((l&0x00FF00FF),24))) \ - ) -#else -/* 6 instructions with rotate instruction, else 8 */ -#define REVERSE_FETCH32(a,l) ( \ - l=*(const HASH_LONG *)(a), \ - l=(((l>>8)&0x00FF00FF)|((l&0x00FF00FF)<<8)), \ - ROTATE(l,16) \ - ) -/* - * Originally the middle line started with l=(((l&0xFF00FF00)>>8)|... - * It's rewritten as above for two reasons: - * - RISCs aren't good at long constants and have to explicitely - * compose 'em with several (well, usually 2) instructions in a - * register before performing the actual operation and (as you - * already realized:-) having same constant should inspire the - * compiler to permanently allocate the only register for it; - * - most modern CPUs have two ALUs, but usually only one has - * circuitry for shifts:-( this minor tweak inspires compiler - * to schedule shift instructions in a better way... - * - * - */ -#endif -#endif - -#ifndef ROTATE -#define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n)))) -#endif - -/* - * Make some obvious choices. E.g., HASH_BLOCK_DATA_ORDER_ALIGNED - * and HASH_BLOCK_HOST_ORDER ought to be the same if input data - * and host are of the same "endianess". It's possible to mask - * this with blank #define HASH_BLOCK_DATA_ORDER though... - * - * - */ -#if defined(B_ENDIAN) -# if defined(DATA_ORDER_IS_BIG_ENDIAN) -# if !defined(HASH_BLOCK_DATA_ORDER_ALIGNED) && HASH_LONG_LOG2==2 -# define HASH_BLOCK_DATA_ORDER_ALIGNED HASH_BLOCK_HOST_ORDER -# endif -# elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) -# ifndef HOST_FETCH32 -# ifdef LE_FETCH32 -# define HOST_FETCH32(p,l) LE_FETCH32(p) -# elif defined(REVERSE_FETCH32) -# define HOST_FETCH32(p,l) REVERSE_FETCH32(p,l) -# endif -# endif -# endif -#elif defined(L_ENDIAN) -# if defined(DATA_ORDER_IS_LITTLE_ENDIAN) -# if !defined(HASH_BLOCK_DATA_ORDER_ALIGNED) && HASH_LONG_LOG2==2 -# define HASH_BLOCK_DATA_ORDER_ALIGNED HASH_BLOCK_HOST_ORDER -# endif -# elif defined(DATA_ORDER_IS_BIG_ENDIAN) -# ifndef HOST_FETCH32 -# ifdef BE_FETCH32 -# define HOST_FETCH32(p,l) BE_FETCH32(p) -# elif defined(REVERSE_FETCH32) -# define HOST_FETCH32(p,l) REVERSE_FETCH32(p,l) -# endif -# endif -# endif -#endif - -#if !defined(HASH_BLOCK_DATA_ORDER_ALIGNED) -#ifndef HASH_BLOCK_DATA_ORDER -#error "HASH_BLOCK_DATA_ORDER must be defined!" -#endif -#endif - -#if defined(DATA_ORDER_IS_BIG_ENDIAN) - -#define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++)))<<24), \ - l|=(((unsigned long)(*((c)++)))<<16), \ - l|=(((unsigned long)(*((c)++)))<< 8), \ - l|=(((unsigned long)(*((c)++))) ), \ - l) -#define HOST_p_c2l(c,l,n) { \ - switch (n) { \ - case 0: l =((unsigned long)(*((c)++)))<<24; \ - case 1: l|=((unsigned long)(*((c)++)))<<16; \ - case 2: l|=((unsigned long)(*((c)++)))<< 8; \ - case 3: l|=((unsigned long)(*((c)++))); \ - } } -#define HOST_p_c2l_p(c,l,sc,len) { \ - switch (sc) { \ - case 0: l =((unsigned long)(*((c)++)))<<24; \ - if (--len == 0) break; \ - case 1: l|=((unsigned long)(*((c)++)))<<16; \ - if (--len == 0) break; \ - case 2: l|=((unsigned long)(*((c)++)))<< 8; \ - } } -/* NOTE the pointer is not incremented at the end of this */ -#define HOST_c2l_p(c,l,n) { \ - l=0; (c)+=n; \ - switch (n) { \ - case 3: l =((unsigned long)(*(--(c))))<< 8; \ - case 2: l|=((unsigned long)(*(--(c))))<<16; \ - case 1: l|=((unsigned long)(*(--(c))))<<24; \ - } } -#define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16)&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ - *((c)++)=(unsigned char)(((l) )&0xff), \ - l) - -#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) - -#define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \ - l|=(((unsigned long)(*((c)++)))<< 8), \ - l|=(((unsigned long)(*((c)++)))<<16), \ - l|=(((unsigned long)(*((c)++)))<<24), \ - l) -#define HOST_p_c2l(c,l,n) { \ - switch (n) { \ - case 0: l =((unsigned long)(*((c)++))); \ - case 1: l|=((unsigned long)(*((c)++)))<< 8; \ - case 2: l|=((unsigned long)(*((c)++)))<<16; \ - case 3: l|=((unsigned long)(*((c)++)))<<24; \ - } } -#define HOST_p_c2l_p(c,l,sc,len) { \ - switch (sc) { \ - case 0: l =((unsigned long)(*((c)++))); \ - if (--len == 0) break; \ - case 1: l|=((unsigned long)(*((c)++)))<< 8; \ - if (--len == 0) break; \ - case 2: l|=((unsigned long)(*((c)++)))<<16; \ - } } -/* NOTE the pointer is not incremented at the end of this */ -#define HOST_c2l_p(c,l,n) { \ - l=0; (c)+=n; \ - switch (n) { \ - case 3: l =((unsigned long)(*(--(c))))<<16; \ - case 2: l|=((unsigned long)(*(--(c))))<< 8; \ - case 1: l|=((unsigned long)(*(--(c)))); \ - } } -#define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16)&0xff), \ - *((c)++)=(unsigned char)(((l)>>24)&0xff), \ - l) - -#endif - -/* - * Time for some action:-) - */ - -int HASH_UPDATE (HASH_CTX *c, const void *data_, CC_LONG len) - { - const unsigned char *data=data_; - register HASH_LONG * p; - register unsigned long l; - int sw,sc,ew,ec; - - if (len==0) return 1; - - l=(c->Nl+(len<<3))&0xffffffffL; - /* 95-05-24 eay Fixed a bug with the overflow handling, thanks to - * Wei Dai for pointing it out. */ - if (l < c->Nl) /* overflow */ - c->Nh++; - c->Nh+=(len>>29); - c->Nl=l; - - if (c->num != 0) - { - p=c->data; - sw=c->num>>2; - sc=c->num&0x03; - - if ((c->num+len) >= HASH_CBLOCK) - { - l=p[sw]; HOST_p_c2l(data,l,sc); p[sw++]=l; - for (; swnum); - c->num=0; - /* drop through and do the rest */ - } - else - { - c->num+=len; - if ((sc+len) < 4) /* ugly, add char's to a word */ - { - l=p[sw]; HOST_p_c2l_p(data,l,sc,len); p[sw]=l; - } - else - { - ew=(c->num>>2); - ec=(c->num&0x03); - if (sc) - l=p[sw]; - HOST_p_c2l(data,l,sc); - p[sw++]=l; - for (; sw < ew; sw++) - { - HOST_c2l(data,l); p[sw]=l; - } - if (ec) - { - HOST_c2l_p(data,l,ec); p[sw]=l; - } - } - return 1; - } - } - - sw=len/HASH_CBLOCK; - if (sw > 0) - { -#if defined(HASH_BLOCK_DATA_ORDER_ALIGNED) - /* - * Note that HASH_BLOCK_DATA_ORDER_ALIGNED gets defined - * only if sizeof(HASH_LONG)==4. - */ - if ((((unsigned long)data)%4) == 0) - { - /* data is properly aligned so that we can cast it: */ - HASH_BLOCK_DATA_ORDER_ALIGNED (c,(HASH_LONG *)data,sw); - sw*=HASH_CBLOCK; - data+=sw; - len-=sw; - } - else -#if !defined(HASH_BLOCK_DATA_ORDER) - while (sw--) - { - memcpy (p=c->data,data,HASH_CBLOCK); - HASH_BLOCK_DATA_ORDER_ALIGNED(c,p,1); - data+=HASH_CBLOCK; - len-=HASH_CBLOCK; - } -#endif -#endif -#if defined(HASH_BLOCK_DATA_ORDER) - { - HASH_BLOCK_DATA_ORDER(c,data,sw); - sw*=HASH_CBLOCK; - data+=sw; - len-=sw; - } -#endif - } - - if (len!=0) - { - p = c->data; - c->num = len; - ew=len>>2; /* words to copy */ - ec=len&0x03; - for (; ew; ew--,p++) - { - HOST_c2l(data,l); *p=l; - } - HOST_c2l_p(data,l,ec); - *p=l; - } - return 1; - } - -void HASH_TRANSFORM (HASH_CTX *c, const unsigned char *data); - -void HASH_TRANSFORM (HASH_CTX *c, const unsigned char *data) - { -#if defined(HASH_BLOCK_DATA_ORDER_ALIGNED) - if ((((unsigned long)data)%4) == 0) - /* data is properly aligned so that we can cast it: */ - HASH_BLOCK_DATA_ORDER_ALIGNED (c,(HASH_LONG *)data,1); - else -#if !defined(HASH_BLOCK_DATA_ORDER) - { - memcpy (c->data,data,HASH_CBLOCK); - HASH_BLOCK_DATA_ORDER_ALIGNED (c,c->data,1); - } -#endif -#endif -#if defined(HASH_BLOCK_DATA_ORDER) - HASH_BLOCK_DATA_ORDER (c,data,1); -#endif - } - - -int HASH_FINAL (unsigned char *md, HASH_CTX *c) - { - register HASH_LONG *p; - register unsigned long l; - register int i,j; - static const unsigned char end[4]={0x80,0x00,0x00,0x00}; - const unsigned char *cp=end; - - /* c->num should definitly have room for at least one more byte. */ - p=c->data; - i=c->num>>2; - j=c->num&0x03; - -#if 0 - /* purify often complains about the following line as an - * Uninitialized Memory Read. While this can be true, the - * following p_c2l macro will reset l when that case is true. - * This is because j&0x03 contains the number of 'valid' bytes - * already in p[i]. If and only if j&0x03 == 0, the UMR will - * occur but this is also the only time p_c2l will do - * l= *(cp++) instead of l|= *(cp++) - * Many thanks to Alex Tang for pickup this - * 'potential bug' */ -#ifdef PURIFY - if (j==0) p[i]=0; /* Yeah, but that's not the way to fix it:-) */ -#endif - l=p[i]; -#else - l = (j==0) ? 0 : p[i]; -#endif - HOST_p_c2l(cp,l,j); p[i++]=l; /* i is the next 'undefined word' */ - - if (i>(HASH_LBLOCK-2)) /* save room for Nl and Nh */ - { - if (iNh; - p[HASH_LBLOCK-1]=c->Nl; -#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) - p[HASH_LBLOCK-2]=c->Nl; - p[HASH_LBLOCK-1]=c->Nh; -#endif - HASH_BLOCK_HOST_ORDER (c,p,1); - -#ifndef HASH_MAKE_STRING -#error "HASH_MAKE_STRING must be defined!" -#else - HASH_MAKE_STRING(c,md); -#endif - - c->num=0; - /* clear stuff, HASH_BLOCK may be leaving some stuff on the stack - * but I'm not worried :-) - OPENSSL_cleanse((void *)c,sizeof(HASH_CTX)); - */ - return 1; - } - -#ifndef MD32_REG_T -#define MD32_REG_T long -/* - * This comment was originaly written for MD5, which is why it - * discusses A-D. But it basically applies to all 32-bit digests, - * which is why it was moved to common header file. - * - * In case you wonder why A-D are declared as long and not - * as MD5_LONG. Doing so results in slight performance - * boost on LP64 architectures. The catch is we don't - * really care if 32 MSBs of a 64-bit register get polluted - * with eventual overflows as we *save* only 32 LSBs in - * *either* case. Now declaring 'em long excuses the compiler - * from keeping 32 MSBs zeroed resulting in 13% performance - * improvement under SPARC Solaris7/64 and 5% under AlphaLinux. - * Well, to be honest it should say that this *prevents* - * performance degradation. - * - * Apparently there're LP64 compilers that generate better - * code if A-D are declared int. Most notably GCC-x86_64 - * generates better code. - * - */ -#endif DELETED Source/Digest/md4_dgst.c Index: Source/Digest/md4_dgst.c ================================================================== --- Source/Digest/md4_dgst.c +++ /dev/null @@ -1,268 +0,0 @@ -/* crypto/md4/md4_dgst.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include "CommonDigestPriv.h" -#include "md4_locl.h" -#ifndef _APPLE_COMMON_CRYPTO_ -#include - -const char *MD4_version="MD4" OPENSSL_VERSION_PTEXT; -#endif /* _APPLE_COMMON_CRYPTO_ */ - - -/* Implemented from RFC1186 The MD4 Message-Digest Algorithm - */ - -#define INIT_DATA_A (unsigned long)0x67452301L -#define INIT_DATA_B (unsigned long)0xefcdab89L -#define INIT_DATA_C (unsigned long)0x98badcfeL -#define INIT_DATA_D (unsigned long)0x10325476L - -int CC_MD4_Init(MD4_CTX *c) - { - c->A=INIT_DATA_A; - c->B=INIT_DATA_B; - c->C=INIT_DATA_C; - c->D=INIT_DATA_D; - c->Nl=0; - c->Nh=0; - c->num=0; - return 1; - } - -#ifndef md4_block_host_order -__private_extern__ void md4_block_host_order (MD4_CTX *c, const void *data, int num) - { - const MD4_LONG *X=data; - register unsigned MD32_REG_T A,B,C,D; - - A=c->A; - B=c->B; - C=c->C; - D=c->D; - - for (;num--;X+=HASH_LBLOCK) - { - /* Round 0 */ - R0(A,B,C,D,X[ 0], 3,0); - R0(D,A,B,C,X[ 1], 7,0); - R0(C,D,A,B,X[ 2],11,0); - R0(B,C,D,A,X[ 3],19,0); - R0(A,B,C,D,X[ 4], 3,0); - R0(D,A,B,C,X[ 5], 7,0); - R0(C,D,A,B,X[ 6],11,0); - R0(B,C,D,A,X[ 7],19,0); - R0(A,B,C,D,X[ 8], 3,0); - R0(D,A,B,C,X[ 9], 7,0); - R0(C,D,A,B,X[10],11,0); - R0(B,C,D,A,X[11],19,0); - R0(A,B,C,D,X[12], 3,0); - R0(D,A,B,C,X[13], 7,0); - R0(C,D,A,B,X[14],11,0); - R0(B,C,D,A,X[15],19,0); - /* Round 1 */ - R1(A,B,C,D,X[ 0], 3,0x5A827999L); - R1(D,A,B,C,X[ 4], 5,0x5A827999L); - R1(C,D,A,B,X[ 8], 9,0x5A827999L); - R1(B,C,D,A,X[12],13,0x5A827999L); - R1(A,B,C,D,X[ 1], 3,0x5A827999L); - R1(D,A,B,C,X[ 5], 5,0x5A827999L); - R1(C,D,A,B,X[ 9], 9,0x5A827999L); - R1(B,C,D,A,X[13],13,0x5A827999L); - R1(A,B,C,D,X[ 2], 3,0x5A827999L); - R1(D,A,B,C,X[ 6], 5,0x5A827999L); - R1(C,D,A,B,X[10], 9,0x5A827999L); - R1(B,C,D,A,X[14],13,0x5A827999L); - R1(A,B,C,D,X[ 3], 3,0x5A827999L); - R1(D,A,B,C,X[ 7], 5,0x5A827999L); - R1(C,D,A,B,X[11], 9,0x5A827999L); - R1(B,C,D,A,X[15],13,0x5A827999L); - /* Round 2 */ - R2(A,B,C,D,X[ 0], 3,0x6ED9EBA1); - R2(D,A,B,C,X[ 8], 9,0x6ED9EBA1); - R2(C,D,A,B,X[ 4],11,0x6ED9EBA1); - R2(B,C,D,A,X[12],15,0x6ED9EBA1); - R2(A,B,C,D,X[ 2], 3,0x6ED9EBA1); - R2(D,A,B,C,X[10], 9,0x6ED9EBA1); - R2(C,D,A,B,X[ 6],11,0x6ED9EBA1); - R2(B,C,D,A,X[14],15,0x6ED9EBA1); - R2(A,B,C,D,X[ 1], 3,0x6ED9EBA1); - R2(D,A,B,C,X[ 9], 9,0x6ED9EBA1); - R2(C,D,A,B,X[ 5],11,0x6ED9EBA1); - R2(B,C,D,A,X[13],15,0x6ED9EBA1); - R2(A,B,C,D,X[ 3], 3,0x6ED9EBA1); - R2(D,A,B,C,X[11], 9,0x6ED9EBA1); - R2(C,D,A,B,X[ 7],11,0x6ED9EBA1); - R2(B,C,D,A,X[15],15,0x6ED9EBA1); - - A = c->A += A; - B = c->B += B; - C = c->C += C; - D = c->D += D; - } - } -#endif - -#ifndef md4_block_data_order -#ifdef X -#undef X -#endif -__private_extern__ void md4_block_data_order (MD4_CTX *c, const void *data_, int num) - { - const unsigned char *data=data_; - register unsigned MD32_REG_T A,B,C,D,l; -#ifndef MD32_XARRAY - /* See comment in crypto/sha/sha_locl.h for details. */ - unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, - XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15; -# define X(i) XX##i -#else - MD4_LONG XX[MD4_LBLOCK]; -# define X(i) XX[i] -#endif - - A=c->A; - B=c->B; - C=c->C; - D=c->D; - - for (;num--;) - { - HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l; - /* Round 0 */ - R0(A,B,C,D,X( 0), 3,0); HOST_c2l(data,l); X( 2)=l; - R0(D,A,B,C,X( 1), 7,0); HOST_c2l(data,l); X( 3)=l; - R0(C,D,A,B,X( 2),11,0); HOST_c2l(data,l); X( 4)=l; - R0(B,C,D,A,X( 3),19,0); HOST_c2l(data,l); X( 5)=l; - R0(A,B,C,D,X( 4), 3,0); HOST_c2l(data,l); X( 6)=l; - R0(D,A,B,C,X( 5), 7,0); HOST_c2l(data,l); X( 7)=l; - R0(C,D,A,B,X( 6),11,0); HOST_c2l(data,l); X( 8)=l; - R0(B,C,D,A,X( 7),19,0); HOST_c2l(data,l); X( 9)=l; - R0(A,B,C,D,X( 8), 3,0); HOST_c2l(data,l); X(10)=l; - R0(D,A,B,C,X( 9), 7,0); HOST_c2l(data,l); X(11)=l; - R0(C,D,A,B,X(10),11,0); HOST_c2l(data,l); X(12)=l; - R0(B,C,D,A,X(11),19,0); HOST_c2l(data,l); X(13)=l; - R0(A,B,C,D,X(12), 3,0); HOST_c2l(data,l); X(14)=l; - R0(D,A,B,C,X(13), 7,0); HOST_c2l(data,l); X(15)=l; - R0(C,D,A,B,X(14),11,0); - R0(B,C,D,A,X(15),19,0); - /* Round 1 */ - R1(A,B,C,D,X( 0), 3,0x5A827999L); - R1(D,A,B,C,X( 4), 5,0x5A827999L); - R1(C,D,A,B,X( 8), 9,0x5A827999L); - R1(B,C,D,A,X(12),13,0x5A827999L); - R1(A,B,C,D,X( 1), 3,0x5A827999L); - R1(D,A,B,C,X( 5), 5,0x5A827999L); - R1(C,D,A,B,X( 9), 9,0x5A827999L); - R1(B,C,D,A,X(13),13,0x5A827999L); - R1(A,B,C,D,X( 2), 3,0x5A827999L); - R1(D,A,B,C,X( 6), 5,0x5A827999L); - R1(C,D,A,B,X(10), 9,0x5A827999L); - R1(B,C,D,A,X(14),13,0x5A827999L); - R1(A,B,C,D,X( 3), 3,0x5A827999L); - R1(D,A,B,C,X( 7), 5,0x5A827999L); - R1(C,D,A,B,X(11), 9,0x5A827999L); - R1(B,C,D,A,X(15),13,0x5A827999L); - /* Round 2 */ - R2(A,B,C,D,X( 0), 3,0x6ED9EBA1L); - R2(D,A,B,C,X( 8), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 4),11,0x6ED9EBA1L); - R2(B,C,D,A,X(12),15,0x6ED9EBA1L); - R2(A,B,C,D,X( 2), 3,0x6ED9EBA1L); - R2(D,A,B,C,X(10), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 6),11,0x6ED9EBA1L); - R2(B,C,D,A,X(14),15,0x6ED9EBA1L); - R2(A,B,C,D,X( 1), 3,0x6ED9EBA1L); - R2(D,A,B,C,X( 9), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 5),11,0x6ED9EBA1L); - R2(B,C,D,A,X(13),15,0x6ED9EBA1L); - R2(A,B,C,D,X( 3), 3,0x6ED9EBA1L); - R2(D,A,B,C,X(11), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 7),11,0x6ED9EBA1L); - R2(B,C,D,A,X(15),15,0x6ED9EBA1L); - - A = c->A += A; - B = c->B += B; - C = c->C += C; - D = c->D += D; - } - } -#endif - -#ifdef undef -int printit(unsigned long *l) - { - int i,ii; - - for (i=0; i<2; i++) - { - for (ii=0; ii<8; ii++) - { - fprintf(stderr,"%08lx ",l[i*8+ii]); - } - fprintf(stderr,"\n"); - } - } -#endif - -#ifdef _APPLE_COMMON_CRYPTO_ - -CC_DIGEST_ONE_SHOT(CC_MD4, CC_MD4_CTX, CC_MD4_Init, CC_MD4_Update, CC_MD4_Final) - -#endif DELETED Source/Digest/md4_locl.h Index: Source/Digest/md4_locl.h ================================================================== --- Source/Digest/md4_locl.h +++ /dev/null @@ -1,165 +0,0 @@ -/* crypto/md4/md4_locl.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include -#include "CommonDigestPriv.h" - -#ifndef _APPLE_COMMON_CRYPTO_ -#include -#include -#endif /* _APPLE_COMMON_CRYPTO_ */ - -#ifndef MD4_LONG_LOG2 -#define MD4_LONG_LOG2 2 /* default to 32 bits */ -#endif - -__private_extern__ void md4_block_host_order (MD4_CTX *c, const void *p,int num); -__private_extern__ void md4_block_data_order (MD4_CTX *c, const void *p,int num); - -#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) || defined(__x86_64__) -/* - * *_block_host_order is expected to handle aligned data while - * *_block_data_order - unaligned. As algorithm and host (x86) - * are in this case of the same "endianness" these two are - * otherwise indistinguishable. But normally you don't want to - * call the same function because unaligned access in places - * where alignment is expected is usually a "Bad Thing". Indeed, - * on RISCs you get punished with BUS ERROR signal or *severe* - * performance degradation. Intel CPUs are in turn perfectly - * capable of loading unaligned data without such drastic side - * effect. Yes, they say it's slower than aligned load, but no - * exception is generated and therefore performance degradation - * is *incomparable* with RISCs. What we should weight here is - * costs of unaligned access against costs of aligning data. - * According to my measurements allowing unaligned access results - * in ~9% performance improvement on Pentium II operating at - * 266MHz. I won't be surprised if the difference will be higher - * on faster systems:-) - * - * - */ -#define md4_block_data_order md4_block_host_order -#endif - -#define DATA_ORDER_IS_LITTLE_ENDIAN - -#define HASH_LONG MD4_LONG -#define HASH_LONG_LOG2 MD4_LONG_LOG2 -#define HASH_CTX MD4_CTX -#define HASH_CBLOCK MD4_CBLOCK -#define HASH_LBLOCK MD4_LBLOCK -#ifdef _APPLE_COMMON_CRYPTO_ -#define HASH_UPDATE CC_MD4_Update -#define HASH_TRANSFORM CC_MD4_Transform -#define HASH_FINAL CC_MD4_Final -#else -#define HASH_UPDATE MD4_Update -#define HASH_TRANSFORM MD4_Transform -#define HASH_FINAL MD4_Final -#endif - -#define HASH_MAKE_STRING(c,s) do { \ - unsigned long ll; \ - ll=(c)->A; HOST_l2c(ll,(s)); \ - ll=(c)->B; HOST_l2c(ll,(s)); \ - ll=(c)->C; HOST_l2c(ll,(s)); \ - ll=(c)->D; HOST_l2c(ll,(s)); \ - } while (0) -#define HASH_BLOCK_HOST_ORDER md4_block_host_order -#if !defined(L_ENDIAN) || defined(md4_block_data_order) -#define HASH_BLOCK_DATA_ORDER md4_block_data_order -/* - * Little-endians (Intel and Alpha) feel better without this. - * It looks like memcpy does better job than generic - * md4_block_data_order on copying-n-aligning input data. - * But frankly speaking I didn't expect such result on Alpha. - * On the other hand I've got this with egcs-1.0.2 and if - * program is compiled with another (better?) compiler it - * might turn out other way around. - * - * - */ -#endif - -#include "md32_common.h" - -/* -#define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) -#define G(x,y,z) (((x) & (y)) | ((x) & ((z))) | ((y) & ((z)))) -*/ - -/* As pointed out by Wei Dai , the above can be - * simplified to the code below. Wei attributes these optimizations - * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. - */ -#define F(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) -#define G(b,c,d) (((b) & (c)) | ((b) & (d)) | ((c) & (d))) -#define H(b,c,d) ((b) ^ (c) ^ (d)) - -#define R0(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+F((b),(c),(d))); \ - a=ROTATE(a,s); }; - -#define R1(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+G((b),(c),(d))); \ - a=ROTATE(a,s); };\ - -#define R2(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+H((b),(c),(d))); \ - a=ROTATE(a,s); }; DELETED Source/Digest/md5_dgst.c Index: Source/Digest/md5_dgst.c ================================================================== --- Source/Digest/md5_dgst.c +++ /dev/null @@ -1,313 +0,0 @@ -/* crypto/md5/md5_dgst.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include "CommonDigestPriv.h" -#include "md5_locl.h" - -#ifndef _APPLE_COMMON_CRYPTO_ -#include -const char *MD5_version="MD5" OPENSSL_VERSION_PTEXT; -#endif - -/* Implemented from RFC1321 The MD5 Message-Digest Algorithm - */ - -#define INIT_DATA_A (unsigned long)0x67452301L -#define INIT_DATA_B (unsigned long)0xefcdab89L -#define INIT_DATA_C (unsigned long)0x98badcfeL -#define INIT_DATA_D (unsigned long)0x10325476L - -int CC_MD5_Init(MD5_CTX *c) - { - c->A=INIT_DATA_A; - c->B=INIT_DATA_B; - c->C=INIT_DATA_C; - c->D=INIT_DATA_D; - c->Nl=0; - c->Nh=0; - c->num=0; - return 1; - } - -#ifndef md5_block_host_order -__private_extern__ void md5_block_host_order (MD5_CTX *c, const void *data, int num) - { - const MD5_LONG *X=data; - register unsigned MD32_REG_T A,B,C,D; - - A=c->A; - B=c->B; - C=c->C; - D=c->D; - - for (;num--;X+=HASH_LBLOCK) - { - /* Round 0 */ - R0(A,B,C,D,X[ 0], 7,0xd76aa478L); - R0(D,A,B,C,X[ 1],12,0xe8c7b756L); - R0(C,D,A,B,X[ 2],17,0x242070dbL); - R0(B,C,D,A,X[ 3],22,0xc1bdceeeL); - R0(A,B,C,D,X[ 4], 7,0xf57c0fafL); - R0(D,A,B,C,X[ 5],12,0x4787c62aL); - R0(C,D,A,B,X[ 6],17,0xa8304613L); - R0(B,C,D,A,X[ 7],22,0xfd469501L); - R0(A,B,C,D,X[ 8], 7,0x698098d8L); - R0(D,A,B,C,X[ 9],12,0x8b44f7afL); - R0(C,D,A,B,X[10],17,0xffff5bb1L); - R0(B,C,D,A,X[11],22,0x895cd7beL); - R0(A,B,C,D,X[12], 7,0x6b901122L); - R0(D,A,B,C,X[13],12,0xfd987193L); - R0(C,D,A,B,X[14],17,0xa679438eL); - R0(B,C,D,A,X[15],22,0x49b40821L); - /* Round 1 */ - R1(A,B,C,D,X[ 1], 5,0xf61e2562L); - R1(D,A,B,C,X[ 6], 9,0xc040b340L); - R1(C,D,A,B,X[11],14,0x265e5a51L); - R1(B,C,D,A,X[ 0],20,0xe9b6c7aaL); - R1(A,B,C,D,X[ 5], 5,0xd62f105dL); - R1(D,A,B,C,X[10], 9,0x02441453L); - R1(C,D,A,B,X[15],14,0xd8a1e681L); - R1(B,C,D,A,X[ 4],20,0xe7d3fbc8L); - R1(A,B,C,D,X[ 9], 5,0x21e1cde6L); - R1(D,A,B,C,X[14], 9,0xc33707d6L); - R1(C,D,A,B,X[ 3],14,0xf4d50d87L); - R1(B,C,D,A,X[ 8],20,0x455a14edL); - R1(A,B,C,D,X[13], 5,0xa9e3e905L); - R1(D,A,B,C,X[ 2], 9,0xfcefa3f8L); - R1(C,D,A,B,X[ 7],14,0x676f02d9L); - R1(B,C,D,A,X[12],20,0x8d2a4c8aL); - /* Round 2 */ - R2(A,B,C,D,X[ 5], 4,0xfffa3942L); - R2(D,A,B,C,X[ 8],11,0x8771f681L); - R2(C,D,A,B,X[11],16,0x6d9d6122L); - R2(B,C,D,A,X[14],23,0xfde5380cL); - R2(A,B,C,D,X[ 1], 4,0xa4beea44L); - R2(D,A,B,C,X[ 4],11,0x4bdecfa9L); - R2(C,D,A,B,X[ 7],16,0xf6bb4b60L); - R2(B,C,D,A,X[10],23,0xbebfbc70L); - R2(A,B,C,D,X[13], 4,0x289b7ec6L); - R2(D,A,B,C,X[ 0],11,0xeaa127faL); - R2(C,D,A,B,X[ 3],16,0xd4ef3085L); - R2(B,C,D,A,X[ 6],23,0x04881d05L); - R2(A,B,C,D,X[ 9], 4,0xd9d4d039L); - R2(D,A,B,C,X[12],11,0xe6db99e5L); - R2(C,D,A,B,X[15],16,0x1fa27cf8L); - R2(B,C,D,A,X[ 2],23,0xc4ac5665L); - /* Round 3 */ - R3(A,B,C,D,X[ 0], 6,0xf4292244L); - R3(D,A,B,C,X[ 7],10,0x432aff97L); - R3(C,D,A,B,X[14],15,0xab9423a7L); - R3(B,C,D,A,X[ 5],21,0xfc93a039L); - R3(A,B,C,D,X[12], 6,0x655b59c3L); - R3(D,A,B,C,X[ 3],10,0x8f0ccc92L); - R3(C,D,A,B,X[10],15,0xffeff47dL); - R3(B,C,D,A,X[ 1],21,0x85845dd1L); - R3(A,B,C,D,X[ 8], 6,0x6fa87e4fL); - R3(D,A,B,C,X[15],10,0xfe2ce6e0L); - R3(C,D,A,B,X[ 6],15,0xa3014314L); - R3(B,C,D,A,X[13],21,0x4e0811a1L); - R3(A,B,C,D,X[ 4], 6,0xf7537e82L); - R3(D,A,B,C,X[11],10,0xbd3af235L); - R3(C,D,A,B,X[ 2],15,0x2ad7d2bbL); - R3(B,C,D,A,X[ 9],21,0xeb86d391L); - - A = c->A += A; - B = c->B += B; - C = c->C += C; - D = c->D += D; - } - } -#endif - -#ifndef md5_block_data_order -#ifdef X -#undef X -#endif -__private_extern__ void md5_block_data_order (MD5_CTX *c, const void *data_, int num) - { - const unsigned char *data=data_; - register unsigned MD32_REG_T A,B,C,D,l; -#ifndef MD32_XARRAY - /* See comment in crypto/sha/sha_locl.h for details. */ - unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, - XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15; -# define X(i) XX##i -#else - MD5_LONG XX[MD5_LBLOCK]; -# define X(i) XX[i] -#endif - - A=c->A; - B=c->B; - C=c->C; - D=c->D; - - for (;num--;) - { - HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l; - /* Round 0 */ - R0(A,B,C,D,X( 0), 7,0xd76aa478L); HOST_c2l(data,l); X( 2)=l; - R0(D,A,B,C,X( 1),12,0xe8c7b756L); HOST_c2l(data,l); X( 3)=l; - R0(C,D,A,B,X( 2),17,0x242070dbL); HOST_c2l(data,l); X( 4)=l; - R0(B,C,D,A,X( 3),22,0xc1bdceeeL); HOST_c2l(data,l); X( 5)=l; - R0(A,B,C,D,X( 4), 7,0xf57c0fafL); HOST_c2l(data,l); X( 6)=l; - R0(D,A,B,C,X( 5),12,0x4787c62aL); HOST_c2l(data,l); X( 7)=l; - R0(C,D,A,B,X( 6),17,0xa8304613L); HOST_c2l(data,l); X( 8)=l; - R0(B,C,D,A,X( 7),22,0xfd469501L); HOST_c2l(data,l); X( 9)=l; - R0(A,B,C,D,X( 8), 7,0x698098d8L); HOST_c2l(data,l); X(10)=l; - R0(D,A,B,C,X( 9),12,0x8b44f7afL); HOST_c2l(data,l); X(11)=l; - R0(C,D,A,B,X(10),17,0xffff5bb1L); HOST_c2l(data,l); X(12)=l; - R0(B,C,D,A,X(11),22,0x895cd7beL); HOST_c2l(data,l); X(13)=l; - R0(A,B,C,D,X(12), 7,0x6b901122L); HOST_c2l(data,l); X(14)=l; - R0(D,A,B,C,X(13),12,0xfd987193L); HOST_c2l(data,l); X(15)=l; - R0(C,D,A,B,X(14),17,0xa679438eL); - R0(B,C,D,A,X(15),22,0x49b40821L); - /* Round 1 */ - R1(A,B,C,D,X( 1), 5,0xf61e2562L); - R1(D,A,B,C,X( 6), 9,0xc040b340L); - R1(C,D,A,B,X(11),14,0x265e5a51L); - R1(B,C,D,A,X( 0),20,0xe9b6c7aaL); - R1(A,B,C,D,X( 5), 5,0xd62f105dL); - R1(D,A,B,C,X(10), 9,0x02441453L); - R1(C,D,A,B,X(15),14,0xd8a1e681L); - R1(B,C,D,A,X( 4),20,0xe7d3fbc8L); - R1(A,B,C,D,X( 9), 5,0x21e1cde6L); - R1(D,A,B,C,X(14), 9,0xc33707d6L); - R1(C,D,A,B,X( 3),14,0xf4d50d87L); - R1(B,C,D,A,X( 8),20,0x455a14edL); - R1(A,B,C,D,X(13), 5,0xa9e3e905L); - R1(D,A,B,C,X( 2), 9,0xfcefa3f8L); - R1(C,D,A,B,X( 7),14,0x676f02d9L); - R1(B,C,D,A,X(12),20,0x8d2a4c8aL); - /* Round 2 */ - R2(A,B,C,D,X( 5), 4,0xfffa3942L); - R2(D,A,B,C,X( 8),11,0x8771f681L); - R2(C,D,A,B,X(11),16,0x6d9d6122L); - R2(B,C,D,A,X(14),23,0xfde5380cL); - R2(A,B,C,D,X( 1), 4,0xa4beea44L); - R2(D,A,B,C,X( 4),11,0x4bdecfa9L); - R2(C,D,A,B,X( 7),16,0xf6bb4b60L); - R2(B,C,D,A,X(10),23,0xbebfbc70L); - R2(A,B,C,D,X(13), 4,0x289b7ec6L); - R2(D,A,B,C,X( 0),11,0xeaa127faL); - R2(C,D,A,B,X( 3),16,0xd4ef3085L); - R2(B,C,D,A,X( 6),23,0x04881d05L); - R2(A,B,C,D,X( 9), 4,0xd9d4d039L); - R2(D,A,B,C,X(12),11,0xe6db99e5L); - R2(C,D,A,B,X(15),16,0x1fa27cf8L); - R2(B,C,D,A,X( 2),23,0xc4ac5665L); - /* Round 3 */ - R3(A,B,C,D,X( 0), 6,0xf4292244L); - R3(D,A,B,C,X( 7),10,0x432aff97L); - R3(C,D,A,B,X(14),15,0xab9423a7L); - R3(B,C,D,A,X( 5),21,0xfc93a039L); - R3(A,B,C,D,X(12), 6,0x655b59c3L); - R3(D,A,B,C,X( 3),10,0x8f0ccc92L); - R3(C,D,A,B,X(10),15,0xffeff47dL); - R3(B,C,D,A,X( 1),21,0x85845dd1L); - R3(A,B,C,D,X( 8), 6,0x6fa87e4fL); - R3(D,A,B,C,X(15),10,0xfe2ce6e0L); - R3(C,D,A,B,X( 6),15,0xa3014314L); - R3(B,C,D,A,X(13),21,0x4e0811a1L); - R3(A,B,C,D,X( 4), 6,0xf7537e82L); - R3(D,A,B,C,X(11),10,0xbd3af235L); - R3(C,D,A,B,X( 2),15,0x2ad7d2bbL); - R3(B,C,D,A,X( 9),21,0xeb86d391L); - - A = c->A += A; - B = c->B += B; - C = c->C += C; - D = c->D += D; - } - } -#endif - -#ifdef undef -int printit(unsigned long *l) - { - int i,ii; - - for (i=0; i<2; i++) - { - for (ii=0; ii<8; ii++) - { - fprintf(stderr,"%08lx ",l[i*8+ii]); - } - fprintf(stderr,"\n"); - } - } -#endif - -#ifdef _APPLE_COMMON_CRYPTO_ - -CC_DIGEST_ONE_SHOT(CC_MD5, CC_MD5_CTX, CC_MD5_Init, CC_MD5_Update, CC_MD5_Final) - -#endif - -/* - The following is needed because CC_MD5_Final takes an unsigned char*, not an unsigned char digest[16]. - We previously handled this with a macro, but we take this approach because it allows a function pointer to - MD5Final to be created. -*/ -void MD5Final (unsigned char digest[16], MD5_CTX *context); -void MD5Final (unsigned char digest[16], MD5_CTX *context) -{ - CC_MD5_Final(digest, context); -} - DELETED Source/Digest/md5_locl.h Index: Source/Digest/md5_locl.h ================================================================== --- Source/Digest/md5_locl.h +++ /dev/null @@ -1,183 +0,0 @@ -/* crypto/md5/md5_locl.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef _APPLE_COMMON_CRYPTO_ -#error Compile order requires _APPLE_COMMON_CRYPTO_. - -#include -#include -#include -#include -#endif _APPLE_COMMON_CRYPTO_ - -#ifndef MD5_LONG_LOG2 -#define MD5_LONG_LOG2 2 /* default to 32 bits */ -#endif - -#ifdef MD5_ASM -# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) || defined(__x86_64__) -# define md5_block_host_order md5_block_asm_host_order -# elif defined(__sparc) && defined(OPENSSL_SYS_ULTRASPARC) - void md5_block_asm_data_order_aligned (MD5_CTX *c, const MD5_LONG *p,int num); -# define HASH_BLOCK_DATA_ORDER_ALIGNED md5_block_asm_data_order_aligned -# endif -#endif - -__private_extern__ void md5_block_host_order (MD5_CTX *c, const void *p,int num); -__private_extern__ void md5_block_data_order (MD5_CTX *c, const void *p,int num); - -#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) || defined(__x86_64__) -/* - * *_block_host_order is expected to handle aligned data while - * *_block_data_order - unaligned. As algorithm and host (x86) - * are in this case of the same "endianness" these two are - * otherwise indistinguishable. But normally you don't want to - * call the same function because unaligned access in places - * where alignment is expected is usually a "Bad Thing". Indeed, - * on RISCs you get punished with BUS ERROR signal or *severe* - * performance degradation. Intel CPUs are in turn perfectly - * capable of loading unaligned data without such drastic side - * effect. Yes, they say it's slower than aligned load, but no - * exception is generated and therefore performance degradation - * is *incomparable* with RISCs. What we should weight here is - * costs of unaligned access against costs of aligning data. - * According to my measurements allowing unaligned access results - * in ~9% performance improvement on Pentium II operating at - * 266MHz. I won't be surprised if the difference will be higher - * on faster systems:-) - * - * - */ -#define md5_block_data_order md5_block_host_order -#endif - -#define DATA_ORDER_IS_LITTLE_ENDIAN - -#define HASH_LONG MD5_LONG -#define HASH_LONG_LOG2 MD5_LONG_LOG2 -#define HASH_CTX MD5_CTX -#define HASH_CBLOCK MD5_CBLOCK -#define HASH_LBLOCK MD5_LBLOCK -#ifdef _APPLE_COMMON_CRYPTO_ -#define HASH_UPDATE CC_MD5_Update -#define HASH_TRANSFORM CC_MD5_Transform -#define HASH_FINAL CC_MD5_Final -#else -#define HASH_UPDATE MD5_Update -#define HASH_TRANSFORM MD5_Transform -#define HASH_FINAL MD5_Final -#endif /* _APPLE_COMMON_CRYPTO_ */ - -#define HASH_MAKE_STRING(c,s) do { \ - unsigned long ll; \ - ll=(c)->A; HOST_l2c(ll,(s)); \ - ll=(c)->B; HOST_l2c(ll,(s)); \ - ll=(c)->C; HOST_l2c(ll,(s)); \ - ll=(c)->D; HOST_l2c(ll,(s)); \ - } while (0) -#define HASH_BLOCK_HOST_ORDER md5_block_host_order -#if !defined(L_ENDIAN) || defined(md5_block_data_order) -#define HASH_BLOCK_DATA_ORDER md5_block_data_order -/* - * Little-endians (Intel and Alpha) feel better without this. - * It looks like memcpy does better job than generic - * md5_block_data_order on copying-n-aligning input data. - * But frankly speaking I didn't expect such result on Alpha. - * On the other hand I've got this with egcs-1.0.2 and if - * program is compiled with another (better?) compiler it - * might turn out other way around. - * - * - */ -#endif - -#include "md32_common.h" - -/* -#define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) -#define G(x,y,z) (((x) & (z)) | ((y) & (~(z)))) -*/ - -/* As pointed out by Wei Dai , the above can be - * simplified to the code below. Wei attributes these optimizations - * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. - */ -#define F(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) -#define G(b,c,d) ((((b) ^ (c)) & (d)) ^ (c)) -#define H(b,c,d) ((b) ^ (c) ^ (d)) -#define I(b,c,d) (((~(d)) | (b)) ^ (c)) - -#define R0(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+F((b),(c),(d))); \ - a=ROTATE(a,s); \ - a+=b; };\ - -#define R1(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+G((b),(c),(d))); \ - a=ROTATE(a,s); \ - a+=b; }; - -#define R2(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+H((b),(c),(d))); \ - a=ROTATE(a,s); \ - a+=b; }; - -#define R3(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+I((b),(c),(d))); \ - a=ROTATE(a,s); \ - a+=b; }; DELETED Source/Digest/sha1.c Index: Source/Digest/sha1.c ================================================================== --- Source/Digest/sha1.c +++ /dev/null @@ -1,232 +0,0 @@ -/* crypto/sha/sha1.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* - * In this odd implementation, the actual SHA1 code is in the sha_locl.h header. - * Compile it exactly once, here. - */ -#define SHA_1 1 - -#include -#include - -#if TARGET_OS_EMBEDDED && __arm__ -#define CC_SHA1_USE_HARDWARE 1 -#endif - -#if CC_SHA1_USE_HARDWARE -#define CC_SHA1_USE_HARDWARE_THRESHOLD 4096 -extern int _CC_SHA1_Update(CC_SHA1_CTX *c, const void *data, CC_LONG len); -#endif - -#include "sha_locl.h" - -#ifdef _APPLE_COMMON_CRYPTO_ - -#if CC_SHA1_USE_HARDWARE -//Need the IOKitLib.h only to keep IOSHA1Types.h happy. -#include -#include -#include -#include -#include -#include - -static int cc_sha1_device = -1; -static pthread_once_t cc_sha1_connect_once = PTHREAD_ONCE_INIT; -static CC_LONG cc_sha1_hardware_quantum = (256*4096); //.25 M default value. - -static void cc_sha1_connect(void) { - struct IOSHA1AcceleratorInfo shaInfo; - - cc_sha1_device = open("/dev/sha1_0", O_RDWR, 0); - if(cc_sha1_device < 0) - return; - - if(ioctl(cc_sha1_device, IOSHA1_GET_INFO, &shaInfo) != -1) { - cc_sha1_hardware_quantum = shaInfo.maxBytesPerCall; - } -} - -static CC_LONG sha1_hash_in_hardware(CC_SHA1_CTX *c, const UInt8 *data_buff, CC_LONG length, bool do_final) -{ - // Handle the hardware SHA1. - struct IOSHA1AcceleratorRequest shaRequest; - CC_LONG quantum = cc_sha1_hardware_quantum; - const UInt8 *data = data_buff; - CC_LONG bytes_left = length; - CC_LONG bytes_hashed = 0; - - //Load the saved context - shaRequest.hashBuffer.hashWords[0] = c->h0; - shaRequest.hashBuffer.hashWords[1] = c->h1; - shaRequest.hashBuffer.hashWords[2] = c->h2; - shaRequest.hashBuffer.hashWords[3] = c->h3; - shaRequest.hashBuffer.hashWords[4] = c->h4; - shaRequest.options = 0; - - do { - if (bytes_left < cc_sha1_hardware_quantum) { - quantum = bytes_left; - if (do_final) { - shaRequest.options = kIOSHA1AcceleratorFinal; - shaRequest.totalLength = (UInt64)(length) << 3; //Totallength is in bits. - } - } else { - quantum = cc_sha1_hardware_quantum; - } - - //Split the request in quantums if it is too large. - shaRequest.sourceText = (UInt8 *)data; - shaRequest.textLength = quantum; - - if(ioctl(cc_sha1_device, IOSHA1_PERFORM_HASH, &shaRequest) == -1) { - break; //Failed to complete the whole request but fall back to the software only for the remaining bytes. - } - bytes_left -= quantum; - data += quantum; - }while (bytes_left); - - bytes_hashed = (length - bytes_left); - if(bytes_hashed) { - //Save the result in the CC_SHA1_CTX. - c->h0 = shaRequest.hashBuffer.hashWords[0]; - c->h1 = shaRequest.hashBuffer.hashWords[1]; - c->h2 = shaRequest.hashBuffer.hashWords[2]; - c->h3 = shaRequest.hashBuffer.hashWords[3]; - c->h4 = shaRequest.hashBuffer.hashWords[4]; - - //Update Nl and Nh in the context. Required to finish the hash. - //Copied from the software SHA1 code. - CC_LONG l=(c->Nl+(bytes_hashed<<3))&0xffffffffL; - if (l < c->Nl) /* overflow */ - c->Nh++; - c->Nh+=(bytes_hashed>>29); - c->Nl=l; - } - return bytes_hashed; -} - -int CC_SHA1_Update(CC_SHA1_CTX *c, const void *data, CC_LONG len) -{ - const UInt8 *data_buff = (const UInt8 *) data; - if (len > CC_SHA1_USE_HARDWARE_THRESHOLD && - !(((intptr_t)data_buff + CC_SHA1_BLOCK_BYTES - c->num) & 3) && - !pthread_once(&cc_sha1_connect_once, cc_sha1_connect) && cc_sha1_device >= 0) - { - //USE SHA1 hardware. - if(c->num) { - //Do the first block or less in software - CC_LONG partial = CC_SHA1_BLOCK_BYTES - c->num; - _CC_SHA1_Update(c, data_buff, partial); - len -= partial; - data_buff += partial; - } - - CC_LONG bytes_4_hardware = len & ~(CC_SHA1_BLOCK_BYTES - 1); //Send only mulitple of 64 bytes to the hardware. - CC_LONG bytes_hashed = 0; - bytes_hashed = sha1_hash_in_hardware(c, data_buff, bytes_4_hardware, false); - len -= bytes_hashed; - data_buff += bytes_hashed; - } - - //USE SHA1 software. If len is zero then this immediately returns; - return _CC_SHA1_Update(c, data_buff, len); -} - -UInt8* CC_SHA1(const void *data, CC_LONG len, UInt8 *md) -{ - CC_LONG bytes_hashed = 0; - const UInt8 *data_buff = (const UInt8 *)data; - - if(md == NULL) - return NULL; - - CC_SHA1_CTX ctx; - CC_SHA1_Init(&ctx); - - if (len > CC_SHA1_USE_HARDWARE_THRESHOLD && - !((intptr_t)data_buff & 3) && - !pthread_once(&cc_sha1_connect_once, cc_sha1_connect) && cc_sha1_device >= 0) - { - bytes_hashed = sha1_hash_in_hardware(&ctx, data_buff, len, true); - if (bytes_hashed == len) { - OSWriteBigInt32(md, 0, ctx.h0); - OSWriteBigInt32(md, 4, ctx.h1); - OSWriteBigInt32(md, 8, ctx.h2); - OSWriteBigInt32(md, 12, ctx.h3); - OSWriteBigInt32(md, 16, ctx.h4); - return md; - } - - //Either we have failed partially or completely. - //Fall through to the software. - data_buff += bytes_hashed; - len -= bytes_hashed; - } - //Fall back to Software SHA1. - CC_SHA1_Update(&ctx, data_buff, len); - CC_SHA1_Final(md, &ctx); - return md; -} -#else //#if CC_SHA1_USE_HARDWARE -CC_DIGEST_ONE_SHOT(CC_SHA1, CC_SHA1_CTX, CC_SHA1_Init, CC_SHA1_Update, CC_SHA1_Final) -#endif - -#endif //#ifdef _APPLE_COMMON_CRYPTO_ - DELETED Source/Digest/sha1edp.h Index: Source/Digest/sha1edp.h ================================================================== --- Source/Digest/sha1edp.h +++ /dev/null @@ -1,51 +0,0 @@ -#if !defined sha1edp_h -#define sha1edp_h - - -/* This file is included in sha1edpLittleEndian.s and sha1edpBigEndian.s to - define the symbols below for use in assembly code. - - It is also included in sha1_locl.h and compiled in C to test that the - hard-coded values here match the values used in C. CC_SHA1_BLOCK_BYTES - is defined in another header, so an error will be generated if its - definition here conflicts. The other symbols are tested below, with - the CheckAssertion definition. -*/ - - -// Number of bytes in a SHA-1 block. -#define CC_SHA1_BLOCK_BYTES 64 - -// Offset of h0 to h4 members in SHA-1 context structure. -#define Contexth0 (0*4) -#define Contexth1 (1*4) -#define Contexth2 (2*4) -#define Contexth3 (3*4) -#define Contexth4 (4*4) - - -#if !defined __ASSEMBLER__ - - #include // Get offsetof macro. - - /* Declare CheckAssertion so that if any of the declarations below - differ from it, the compiler will report an error. - */ - extern char CheckAssertion[1]; - - /* Ensure that Contexth0 through Contexth4 are the byte offsets of the - h0 through h4 members of the SHA-1 context structure. - */ - extern char CheckAssertion[Contexth0 == offsetof(SHA_CTX, h0)]; - extern char CheckAssertion[Contexth1 == offsetof(SHA_CTX, h1)]; - extern char CheckAssertion[Contexth2 == offsetof(SHA_CTX, h2)]; - extern char CheckAssertion[Contexth3 == offsetof(SHA_CTX, h3)]; - extern char CheckAssertion[Contexth4 == offsetof(SHA_CTX, h4)]; - /* If these assertions fail, change the definitions of Contexth0 to - Contexth4 to match the offsets of the members. - */ - -#endif // !defined __ASSEMBLER__ - - -#endif // !defined sha1edp_h DELETED Source/Digest/sha1edpBigEndian.s Index: Source/Digest/sha1edpBigEndian.s ================================================================== --- Source/Digest/sha1edpBigEndian.s +++ /dev/null @@ -1,1437 +0,0 @@ -/* sha1edp.s : this file provides optimized x86_64 and i386 implementation of the sha1 function - CoreOS - vector and numerics group - cclee 6-21-10 - - The implementation is based on the principle described in an Intel online article - "Improving the Performance of the Secure Hash Algorithm (SHA-1)" - http://software.intel.com/en-us/articles/improving-the-performance-of-the-secure-hash-algorithm-1/ - - - Update HASH[] by processing a one 64-byte block in MESSAGE[] can be represented by the following C function - -void SHA1( int HASH[], int MESSAGE[] ) -{ - int A[81], B[81], C[81], D[81], E[81]; - int W[80]; - - int i, FN; - - A[0] = HASH[0]; - B[0] = HASH[1]; - C[0] = HASH[2]; - D[0] = HASH[3]; - E[0] = HASH[4]; - - for ( i=0; i<80; ++i ) - { - if ( i < 16 ) - W[i] = BIG_ENDIAN_LOAD( MESSAGE[i] ); - else - W[i] = ROTATE_LEFT( W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1 ); - - FN = F( i, B[i], C[i], D[i] ); - - A[i+1] = FN + E[i] + ROTATE_LEFT( A[i], 5 ) + W[i] + K(i); - B[i+1] = A[i]; - C[i+1] = ROTATE_LEFT( B[i], 30 ); - D[i+1] = C[i]; - E[i+1] = D[i]; - } - - HASH[0] += A[80]; - HASH[1] += B[80]; - HASH[2] += C[80]; - HASH[3] += D[80]; - HASH[4] += E[80]; -} - - For i=0:15, W[i] is simply big-endian loading of MESSAGE[i]. For i=16:79, W[i] is updated according to W[i] = ROTATE_LEFT( W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1 ); - - The approach (by Dean Gaudet) can be used to vectorize the computation of W[i] for i=16:79, - - 1. done on 4 consequtive W[i] values in a single XMM register - W[i ] = (W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]) rol 1 - W[i+1] = (W[i-2] ^ W[i-7] ^ W[i-13] ^ W[i-15]) rol 1 - W[i+2] = (W[i-1] ^ W[i-6] ^ W[i-12] ^ W[i-14]) rol 1 - W[i+3] = ( 0 ^ W[i-5] ^ W[i-11] ^ W[i-13]) rol 1 - - 2. this additional calculation unfortunately requires many additional operations - W[i+3] ^= W[i] rol 1 - - 3. once we have 4 W[i] values in XMM we can also add four K values with one instruction - W[i:i+3] += {K,K,K,K} - - Let W0 = {W[i] W[i+1] W[i+2] W[i+3]} be the current W-vector to be computed, W4 = {W[i-4] W[i-3] W[i-2] W[i-1]} be the previous vector, and so on - The Dean Gaudet approach can be expressed as - - 1. W0 = rotate_left(left_shift(W4,32) ^ W8 ^ left_shift(concatenate(W16,W12),64) ^ W16,1); - 2. W[i+3] ^= W[i] rol 1 - 3. W0 += {K,K,K,K} - - For i>=32, the Intel online article suggests that (using a basic identity (X rol 1) rol 1 = X rol 2) the update equation is equivalent to - - 1. W0 = rotate_left(left_shift(concatenate(W8,W4),64) ^ W16 ^ W28 ^ W32, 2); - - Note: - 1. In total, we need 8 16-byte registers or memory for W0,W4,...,W28. W0 and W32 can be the same register or memory. - 2. The registers are used in a circular buffering mode. For example, we start with W28,W24,...,W0 (with W0 indicating the most recent 16-byte) - i=0, W28,W24,...,W0 - i=4, W24,W20,...,W28 - i=8, W20,W16,...,W24 - . - . - and so forth. - 3. 2 ssse3 instructions are used in the Intel article, pshufb and palignr. - a. pshufb is used to simplify the BIG_ENDIAN_LOAD operation - b. palignr is used to simplify the computation of left_shift(concatenate(W12,W8),64) - 4. we probe __cpu_capabilities to detect ssse3 support and dispatch code with ssse3 support when available. - If ssse3 is not supported, a suboptimal code (pshufb and palignr workaround) is dispatched. - -*/ - -/* the code can be compiled into single block (64 bytes) per call mode by setting Multiple_blocks to 0 */ -#define Multiple_Blocks 1 - -#if defined (__x86_64__) || defined(__i386__) // x86_64 or i386 architectures - -#if defined(__x86_64__) - - // set up for x86_64 -#define stack_size (8+16*11+16*4) // 8 (alignedment) + x0-x10 + 4 128-bits for intermediate WK(t) storage -#define sp %rsp // unifying architectural stack pointer representation -#define ctx %rdi // 1st input argument, will move to HASH_PTR (%r9) -#define buf %rsi // 2nd input argument, will move to BUFFER_PTR (%r10) -#define cnt %r11 // will copy from the 3rd input argument (%rdx) -#define K_BASE %r8 // an aligned pointer to point to shufb reference numbers of table of K values -#define HASH_PTR %r9 // pointer to Hash values (A,B,C,D,E) -#define BUFFER_PTR %r10 // pointer to input blocks - -#else // !__x86_64__ - - // set up for i386 -#define stack_size (12+16*2+16*11+16*4) // 12-bytes (alignment) + extra 2 + 3 (W24/W28/XMM_SHUFB_BSWAP) + 8 (xmm0-xmm7) + 4 (WK(t)) -#define sp %esp // unifying architectural stack pointer representation -#define HASH_PTR stack_size+16+4(sp) // use 1st input argument from caller function, 16 for (esi/edi/ebx/ebp) -#define BUFFER_PTR stack_size+16+8(sp) // use 2nd input argument from caller function -#define cnt stack_size+16+12(sp) // use 3rd input argument from caller function -#define K_BASE stack_size-4(sp) // use for K_BASE - -#endif // __x86_64__ - -// symbolizing registers or stack memory with algorithmic variables W0,W4,...,W28 + W_TMP, W_TMP2, and XMM_SHUFB_BSWAP for code with ssse3 support - -#define W_TMP %xmm0 -#define W_TMP2 %xmm1 -#define W0 %xmm2 -#define W4 %xmm3 -#define W8 %xmm4 -#define W12 %xmm5 -#define W16 %xmm6 -#define W20 %xmm7 -#if defined(__x86_64__) -#define W24 %xmm8 -#define W28 %xmm9 -#define XMM_SHUFB_BSWAP %xmm10 // used only when ssse3 is supported -#else // defined (__i386__) -#define W24 12*16(sp) -#define W28 13*16(sp) -#define XMM_SHUFB_BSWAP 14*16(sp) // used only when ssse3 is supported -#endif - -#define xmov movaps // aligned 16-byte move -#define xmovu movups // unaligned 16-byte move - -// intermediate hash variables -#define A %ecx -#define B %esi -#define C %edi -#define D %ebp -#define E %edx - -// temp variables -#define T1 %eax -#define T2 %ebx - -#define WK(t) (t&15)*4(sp) - - // int F1(int B, int C, int D) { return (D ^ ( B & (C ^ D)); } - // result in T1 - .macro F1 - mov $1, T1 - xor $2, T1 - and $0, T1 - xor $2, T1 - .endm - - // int F2(int B, int C, int D) { return (D ^ B ^ C); } - // result in T1 - .macro F2 - mov $2, T1 - xor $1, T1 - xor $0, T1 - .endm - - // int F3(int B, int C, int D) { return (B & C) | (D & (B ^ C)); } - // result in T1 - .macro F3 - mov $1, T1 - mov $0, T2 - or $0, T1 - and $1, T2 - and $2, T1 - or T2, T1 - .endm - - // for i=60:79, F4 is identical to F2 - #define F4 F2 - - - /* - i=0:15, W[i] = BIG_ENDIAN_LOAD(MESSAGE[i]); - - with ssse3 support, this is achived via - for (i=0;i<16;i+=4) { - 1. W_TMP = new 16 bytes from MESSAGE[] - 2. W_TMP = pshufb(W_TMP, XMM_SHUFB_BSWAP); save to W circular buffer for updating W - 3. WTMP += {K,K,K,K}; - 4. save quadruple W[i]+K[i] = W_TMP in the stack memory; - } - - each step is represented in one of the following 4 macro definitions - -*/ - - .macro W_PRECALC_00_15_0 // input argument $0 : 0/4/8/12 -#if defined (__x86_64__) // BUFFER_PTR is already an address register in x86_64 - xmovu $0*4(BUFFER_PTR), W_TMP // read 16-bytes into W_TMP, BUFFER_PTR possibly not 16-byte aligned -#else // BUFFER_PTR is from the argument set up in the caller - mov BUFFER_PTR, T1 // T1 = BUFFER_PTR - xmovu $0*4(T1), W_TMP // read 16-bytes into W_TMP, BUFFER_PTR possibly not 16-byte aligned -#endif - .endm - - .macro W_PRECALC_00_15_1 // input argument $0 : current 16-bytes in the circular buffer, one of W0,W4,W8,...,W28 - xmov W_TMP, $0 // save W_TMP in the circular buffer - .endm - - .macro W_PRECALC_00_15_2 // K_BASE points to the current K quadruple. -#if defined (__x86_64__) // K_BASE is already an address register in x86_64 - paddd (K_BASE), W_TMP // W_TMP += {K,K,K,K}; -#else // K_BASE is previously set up in the stack memory - mov K_BASE, T1 // T1 = K_BASE - paddd (T1), W_TMP // W_TMP += {K,K,K,K}; -#endif - .endm - - .macro W_PRECALC_00_15_3 - xmov W_TMP, WK($0&~3) // save quadruple W[i]+K in the stack memory, which would be used later for updating the hashes A/B/C/D/E - .endm - - // rounds 16-31 compute W[0] using the vectorization approach by Dean Gaudet - /* - W[i ] = (W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]) rol 1 - W[i+1] = (W[i-2] ^ W[i-7] ^ W[i-13] ^ W[i-15]) rol 1 - W[i+2] = (W[i-1] ^ W[i-6] ^ W[i-12] ^ W[i-14]) rol 1 - W[i+3] = ( 0 ^ W[i-5] ^ W[i-11] ^ W[i-13]) rol 1 - - W[i+3] ^= W[i] rol 1; // this W[i] is already rol by 1, if we are taking from the intial W before rol 1, we should rol this by 2 - - The operation (updating W and W+K) is scheduled as and divided into 4 steps - - 0. W_tmp = W3; W = W14 ^ W8 - 1. W = W3 ^ W8 ^ W14 ^ W16; W_TMP = W; W_TMP2 = (W[i] 0 0 0); - 2. W_TMP = (W3 ^ W8 ^ W14 ^ W16) rol 1; split (W[i] 0 0 0) rol 2 in W_TMP2 and W - 3. W = W_TMP = W_TMP ^ W_TMP2 ^ W = (W3 ^ W8 ^ W14 ^ W16) rol 1 ^ (W[i] 0 0 0) rol 2; WK = W _TMP+K; - - */ - - .macro W_PRECALC_16_31_0_ssse3 // input arguments : W16,W12,W8,W4,W - xmov $1, $4 // W = W12 - palignr $$8, $0, $4 // W = W14 - xmov $3, W_TMP // W_TMP = W4 - psrldq $$4, W_TMP // W_TMP = W3 - pxor $2, $4 // W = W8 ^ W14 - .endm - - .macro W_PRECALC_16_31_1 // input arguments : W16,W - pxor $0, W_TMP // W_TMP = W3 ^ W16 - pxor W_TMP, $1 // W = W3 ^ W16 ^ W8 ^ W14 - xmov $1, W_TMP2 // W_TMP2 = W3 ^ W16 ^ W8 ^ W14 - xmov $1, W_TMP // W_TMP = W3 ^ W16 ^ W8 ^ W14 - pslldq $$12, W_TMP2 // W_TMP2 = (W[i] 0 0 0) - .endm - - .macro W_PRECALC_16_31_2 // input argument : W - psrld $$31, $0 // (W3 ^ W16 ^ W8 ^ W14)>>31 - pslld $$1, W_TMP // (W3 ^ W16 ^ W8 ^ W14)<<1 - por $0, W_TMP // W_TMP = (W3 ^ W16 ^ W8 ^ W14) rol 1 - xmov W_TMP2, $0 // copy W[i] at location of W[i+3] - psrld $$30, W_TMP2 // W_TMP2 = W[i] lower 2 bits after rol 2 - pslld $$2, $0 // W = W[i] higher 30 bits after rol 2 - .endm - - .macro W_PRECALC_16_31_3 // input arguments: W, i, K_XMM -#if defined (__i386__) - mov K_BASE, T1 // K_BASE is store in the stack memory for i386 -#endif - pxor $0, W_TMP - pxor W_TMP2, W_TMP // W_TMP = (W3 ^ W16 ^ W8 ^ W14) rol 1 ^ (W[i] 0 0 0) rol 2 - xmov W_TMP, $0 // save W = W_TMP in the W circular buffer -#if defined (__x86_64__) - paddd $2(K_BASE), W_TMP // W+K -#else - paddd $2(T1), W_TMP // W+K -#endif - xmov W_TMP, WK($1&~3) // save WK = W+K for later update of the hashes A/B/C/D/E - .endm - - // the following is a variant of W_PRECALC_16_31_0_ssse3 to be used for system without ssse3, palignr is replaced with 4 instructions - - .macro W_PRECALC_16_31_0_nossse3 // input arguments : W16,W12,W8,W4,W - xmov $1, $4 // W = W12 = (w9 w10 w11 w12) - - // the following is a wrokaround for palignr - xmov $0, W_TMP // W16 = (w13 w14 w15 w16) - pslldq $$8, $4 // shift left to make (w11 w12 0 0) - psrldq $$8, W_TMP // shift right to make (0 0 w13 w14) - por W_TMP, $4 // W = W14 = (w11 w12 w13 w14) - - xmov $3, W_TMP // W_TMP = W4 = (w1 w2 w3 w4) - psrldq $$4, W_TMP // W_TMP = W3 = (0 w1 w2 w3) - pxor $2, $4 // W = W8 ^ W14 - .endm - - /* rounds 32-79 compute W und W+K iusing the vectorization approach from the Intel article - - W = rotate_left(left_shift(concatenate(W8,W4),64) ^ W16 ^ W28 ^ W32, 2); - - where left_shift(concatenate(W8,W4),64) is equivalent to W6. Note also that W32 and W use the same register. - - - 0. W_tmp = W6; W = W28 ^ W32; - 1. W = W_tmp = W6 ^ W16 ^ W28 ^ W32; - 2. W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2; - 3. W = W_Tmp; WK = W_tmp + K; - -*/ - - - .macro W_PRECALC_32_79_0_ssse3 // inputr arguments : W28,W8,W4,W - xmov $2, W_TMP // (w1 w2 w3 w4) - pxor $0, $3 // W = W28 ^ W32; - palignr $$8, $1, W_TMP // W_tmp = (w3 w4 w5 w6) = W6; - .endm - - // the following is a variant and will be used for system without ssse3 support - .macro W_PRECALC_32_79_0_nossse3 // input arguments : W28,W8,W4,W - xmov $2, W_TMP // (w1 w2 w3 w4) - xmov $1, W_TMP2 // (w5 w6 w7 w8) - pxor $0, $3 // W = W28 ^ W32 - pslldq $$8, W_TMP // (w3 w4 0 0) - psrldq $$8, W_TMP2 // (0 0 w5 w6) - por W_TMP2, W_TMP // W_tmp = (w3 w4 w5 w6) = W6 - .endm - - // this is a variant of W_PRECALC_32_79_0_ssse3 for i386 (as W24/W28 are stored in memory, not in registers) - .macro W_PRECALC_32_79_0_i386_ssse3 // input arguments : W28,W8,W4,W - xmov $3, W_TMP // W32 - pxor $0, W_TMP // W28 ^ W32 - xmov W_TMP, $3 // W = W28 ^ W32; - xmov $2, W_TMP // W4 - palignr $$8, $1, W_TMP // W_tmp = (w3 w4 w5 w6) = W6; - .endm - - // this is a variant of W_PRECALC_32_79_0_nossse3 for i386 (as W24/W28 are stored in memory, not in registers) - .macro W_PRECALC_32_79_0_i386_nossse3 // input arguments : W28,W8,W4,W - xmov $3, W_TMP // W32 - pxor $0, W_TMP // W28 ^ W32 - xmov W_TMP, $3 // W = W28 ^ W32 - xmov $2, W_TMP // W4 = (w1 w2 w3 w4) - xmov $1, W_TMP2 // W8 = (w5 w6 w7 w8) - pslldq $$8, W_TMP // (w3 w4 0 0) - psrldq $$8, W_TMP2 // (0 0 w5 w6) - por W_TMP2, W_TMP // W_tmp = (w3 w4 w5 w6) = W6 - .endm - - .macro W_PRECALC_32_79_1 // input arguments : W16,W - pxor $0, W_TMP // W_tmp = W6 ^ W16 - pxor $1, W_TMP // W_tmp = W6 ^ W16 ^ W28 ^ W32 - xmov W_TMP, $1 // W = W_tmp = W6 ^ W16 ^ W28 ^ W32 - .endm - - .macro W_PRECALC_32_79_2 // input argument : W - psrld $$30, $0 // W >> 30 - pslld $$2, W_TMP // W << 2 - por $0, W_TMP // W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2 - .endm - - // this is a variant of W_PRECALC_32_79_2 for i386 (as W24/W28 are stored in memory, not in registers) - // this should be used when the input is either W24 or W28 on i386 architecture - .macro W_PRECALC_32_79_2_i386 // input argument : W - xmov $0, W_TMP2 // W - psrld $$30, W_TMP2 // W >> 30 - xmov W_TMP2, $0 // save (W >> 30) at W - pslld $$2, W_TMP // W_tmp << 2 - por $0, W_TMP // W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2 - .endm - - .macro W_PRECALC_32_79_3 // input argument W, i, K_XMM -#if defined (__x86_64__) - xmov W_TMP, $0 // W = (W6 ^ W16 ^ W28 ^ W32) rol 2 - paddd $2(K_BASE), W_TMP // W + K - xmov W_TMP, WK($1&~3) // write W+K -#else - mov K_BASE, T1 // T1 = K_BASE (which is in the caller argument) - xmov W_TMP, $0 // W = (W6 ^ W16 ^ W28 ^ W32) rol 2 - paddd $2(T1), W_TMP // W_tmp = W + K - xmov W_TMP, WK($1&~3) // write WK - #endif - .endm - - - /* The hash update operation is completed by the following statements. - - A[i+1] = FN + E[i] + ROTATE_LEFT( A[i], 5 ) + WK(i); - B[i+1] = A[i]; - C[i+1] = ROTATE_LEFT( B[i], 30 ); - D[i+1] = C[i]; - E[i+1] = D[i]; - - Suppose we start with A0,B0,C0,D0,E0. The 1st iteration can be expressed as follows: - - A1 = FN + E0 + rol(A0,5) + WK; - B1 = A0; - C1 = rol(B0, 30); - D1 = C0; - E1 = D0; - - to avoid excessive memory movement between registers, - 1. A1 = FN + E0 + rol(A0,5) + WK; can be temporarily saved in E0, - 2. C1 = rol(B0,30) can be temporarily saved in B0. - - Therefore, ignoring the time index, the update operation is equivalent to - 1. E = FN(B,C,D) + E + rol(A,5) + WK(i) - 2. B = rol(B,30) - 3. the hashes are now stored in the order of E,A,B,C,D - - - To pack 2 hash update operations in 1 iteration, starting with A,B,C,D,E - 1. E = FN(B,C,D) + E + rol(A,5) + WK(i) - 2. B = rol(B,30) - // now the hashes are in the order of E,A,B,C,D - 3. D = FN(A,B,C) + D + rol(E,5) + WK(i+1) - 4. A = rol(A,30) - // now the hashes are in the order of D,E,A,B,C - - These operations are distributed into the following 2 macro definitions RR0 and RR1. - -*/ - - .macro RR0 // input arguments : FN, A, B, C, D, E, i - $0 $2, $3, $4 // T1 = FN(B,C,D) - add WK($6), $5 // E + WK(i) - rol $$30, $2 // B = rol(B,30) - mov $1, T2 // T2 = A - add WK($6+1), $4 // D + WK(i+1) - rol $$5, T2 // rol(A,5) - add T1, $5 // E = FN(B,C,D) + E + WK(i) - .endm - - .macro RR1 - add $5, T2 // T2 = FN(B,C,D) + E + rol(A,5) + WK(i) - mov T2, $5 // E = FN(B,C,D) + E + rol(A,5) + WK(i) - rol $$5, T2 // rol(E,5) - add T2, $4 // D + WK(i+1) + rol(E,5) - $0 $1, $2, $3 // FN(A,B,C) - add T1, $4 // D = FN(A,B,C) + D + rol(E,5) + WK(i+1) - rol $$30, $1 // A = rol(A,30) - .endm - - - - /* - - The following macro definitions are used to expand code for the per-block sha1 operation. - - INITIAL_W_PRECALC_ssse3 : BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack memory - INTERNAL_ssse3 : updating W (16:79) and update the digests A/B/C/D/E (i=0:63, based on W+K stored in the stack memory) - ENDING : finishing up update the digests A/B/C/D/E (i=64:79) - - For multiple-block sha1 operation (Multiple_Blocks = 1), INITIAL_W_PRECALC_ssse3 and ENDING are combined - into 1 macro definition for software pipeling. - - SOFTWARE_PIPELINING_ssse3 : BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack, and finishing up update the digests A/B/C/D/E (i=64:79) - - assume cnt (the number of blocks) >= 1, the main code body should look like - - INITIAL_W_PRECALC_ssse3 // W = big_endian_load and pre-compute W+K (i=0:15) - do { - INTERNAL_ssse3 // update W(i=16:79), and update hash digests A/B/C/D/E (i=0:63) - cnt--; - if (cnt==0) break; - BUFFER_PTR += 64; - SOFTWARE_PIPELINING_ssse3; // update hash digests A/B/C/D/E (i=64:79) + W = big_endian_load and pre-compute W+K (i=0:15) - } - ENDING // update hash digests A/B/C/D/E (i=64:79) - - */ - - #define W_PRECALC_16_31_0 W_PRECALC_16_31_0_ssse3 - #define W_PRECALC_32_79_0 W_PRECALC_32_79_0_ssse3 - #define W_PRECALC_32_79_0_i386 W_PRECALC_32_79_0_i386_ssse3 - - - .macro INITIAL_W_PRECALC_ssse3 // BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack memory - - // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) - W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W0 + K - W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K - - // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 - W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) - W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W28 + K - W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K - - // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 - W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) - W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W24 + K - W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K - - // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) - W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W20 + K - W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K - - .endm - - - .macro INTERNAL_ssse3 // updating W (16:79) and update the digests A/B/C/D/E (i=0:63, based on W+K stored in the stack memory) - - // i=16 : W12,W8,W4,W0,W28,W24,W20,W16 - W_PRECALC_16_31_0 W0,W28,W24,W20,W16 - RR0 F1,A,B,C,D,E,0 - W_PRECALC_16_31_1 W0,W16 - RR1 F1,A,B,C,D,E,0 - W_PRECALC_16_31_2 W16 - RR0 F1,D,E,A,B,C,2 - W_PRECALC_16_31_3 W16, 2, 0 - RR1 F1,D,E,A,B,C,2 - - // i=20 : W8,W4,W0,W28,W24,W20,W16,W12 - W_PRECALC_16_31_0 W28,W24,W20,W16,W12 - RR0 F1,B,C,D,E,A,4 - W_PRECALC_16_31_1 W28,W12 - RR1 F1,B,C,D,E,A,4 - W_PRECALC_16_31_2 W12 - RR0 F1,E,A,B,C,D,6 - W_PRECALC_16_31_3 W12, 6, 16 - RR1 F1,E,A,B,C,D,6 - - // i=24 : W4,W0,W28,W24,W20,W16,W12,W8 - W_PRECALC_16_31_0 W24,W20,W16,W12,W8 - RR0 F1,C,D,E,A,B,8 - W_PRECALC_16_31_1 W24,W8 - RR1 F1,C,D,E,A,B,8 - W_PRECALC_16_31_2 W8 - RR0 F1,A,B,C,D,E,10 - W_PRECALC_16_31_3 W8,10,16 - RR1 F1,A,B,C,D,E,10 - - // i=28 : W0,W28,W24,W20,W16,W12,W8,W4 - W_PRECALC_16_31_0 W20,W16,W12,W8,W4 - RR0 F1,D,E,A,B,C,12 - W_PRECALC_16_31_1 W20,W4 - RR1 F1,D,E,A,B,C,12 - W_PRECALC_16_31_2 W4 - RR0 F1,B,C,D,E,A,14 - W_PRECALC_16_31_3 W4,14,16 - RR1 F1,B,C,D,E,A,14 - - // i=32 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_32_79_0 W28,W8,W4,W0 - RR0 F1,E,A,B,C,D,16 - W_PRECALC_32_79_1 W16,W0 - RR1 F1,E,A,B,C,D,16 - W_PRECALC_32_79_2 W0 - RR0 F1,C,D,E,A,B,18 - W_PRECALC_32_79_3 W0,18,16 - RR1 F1,C,D,E,A,B,18 - - // starting using F2 - - // i=36 : W24,W20,W16,W12,W8,W4,W0,W28 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W24,W4,W0,W28 -#else - W_PRECALC_32_79_0_i386 W24,W4,W0,W28 -#endif - RR0 F2,A,B,C,D,E,20 - W_PRECALC_32_79_1 W12,W28 - RR1 F2,A,B,C,D,E,20 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W28 -#else - W_PRECALC_32_79_2_i386 W28 -#endif - RR0 F2,D,E,A,B,C,22 - W_PRECALC_32_79_3 W28,22,16 - RR1 F2,D,E,A,B,C,22 - - // i=40 : W20,W16,W12,W8,W4,W0,W28,W24 - #undef K_XMM - #define K_XMM 32 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W20,W0,W28,W24 -#else - W_PRECALC_32_79_0_i386 W20,W0,W28,W24 -#endif - RR0 F2,B,C,D,E,A,24 - W_PRECALC_32_79_1 W8,W24 - RR1 F2,B,C,D,E,A,24 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W24 -#else - W_PRECALC_32_79_2_i386 W24 -#endif - RR0 F2,E,A,B,C,D,26 - W_PRECALC_32_79_3 W24,26,K_XMM - RR1 F2,E,A,B,C,D,26 - - // i=44 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_32_79_0 W16,W28,W24,W20 - RR0 F2,C,D,E,A,B,28 - W_PRECALC_32_79_1 W4,W20 - RR1 F2,C,D,E,A,B,28 - W_PRECALC_32_79_2 W20 - RR0 F2,A,B,C,D,E,30 - W_PRECALC_32_79_3 W20,30,K_XMM - RR1 F2,A,B,C,D,E,30 - - // i=48 : W12,W8,W4,W0,W28,W24,W20,W16 - W_PRECALC_32_79_0 W12,W24,W20,W16 - RR0 F2,D,E,A,B,C,32 - W_PRECALC_32_79_1 W0,W16 - RR1 F2,D,E,A,B,C,32 - W_PRECALC_32_79_2 W16 - RR0 F2,B,C,D,E,A,34 - W_PRECALC_32_79_3 W16,34,K_XMM - RR1 F2,B,C,D,E,A,34 - - // i=52 : W8,W4,W0,W28,W24,W20,W16,W12 - W_PRECALC_32_79_0 W8,W20,W16,W12 - RR0 F2,E,A,B,C,D,36 - W_PRECALC_32_79_1 W28,W12 - RR1 F2,E,A,B,C,D,36 - W_PRECALC_32_79_2 W12 - RR0 F2,C,D,E,A,B,38 - W_PRECALC_32_79_3 W12,38,K_XMM - RR1 F2,C,D,E,A,B,38 - - // starting using F3 - - // i=56 : W4,W0,W28,W24,W20,W16,W12,W8 - W_PRECALC_32_79_0 W4,W16,W12,W8 - RR0 F3,A,B,C,D,E,40 - W_PRECALC_32_79_1 W24,W8 - RR1 F3,A,B,C,D,E,40 - W_PRECALC_32_79_2 W8 - RR0 F3,D,E,A,B,C,42 - W_PRECALC_32_79_3 W8,42,K_XMM - RR1 F3,D,E,A,B,C,42 - - // i=60 : W0,W28,W24,W20,W16,W12,W8,W4 - #undef K_XMM - #define K_XMM 48 - W_PRECALC_32_79_0 W0,W12,W8,W4 - RR0 F3,B,C,D,E,A,44 - W_PRECALC_32_79_1 W20,W4 - RR1 F3,B,C,D,E,A,44 - W_PRECALC_32_79_2 W4 - RR0 F3,E,A,B,C,D,46 - W_PRECALC_32_79_3 W4,46,K_XMM - RR1 F3,E,A,B,C,D,46 - - // i=64 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_32_79_0 W28,W8,W4,W0 - RR0 F3,C,D,E,A,B,48 - W_PRECALC_32_79_1 W16,W0 - RR1 F3,C,D,E,A,B,48 - W_PRECALC_32_79_2 W0 - RR0 F3,A,B,C,D,E,50 - W_PRECALC_32_79_3 W0,50,K_XMM - RR1 F3,A,B,C,D,E,50 - - // i=68 : W24,W20,W16,W12,W8,W4,W0,W28 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W24,W4,W0,W28 -#else - W_PRECALC_32_79_0_i386 W24,W4,W0,W28 -#endif - RR0 F3,D,E,A,B,C,52 - W_PRECALC_32_79_1 W12,W28 - RR1 F3,D,E,A,B,C,52 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W28 -#else - W_PRECALC_32_79_2_i386 W28 -#endif - RR0 F3,B,C,D,E,A,54 - W_PRECALC_32_79_3 W28,54,K_XMM - RR1 F3,B,C,D,E,A,54 - - // i=72 : W20,W16,W12,W8,W4,W0,W28,W24 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W20,W0,W28,W24 -#else - W_PRECALC_32_79_0_i386 W20,W0,W28,W24 -#endif - RR0 F3,E,A,B,C,D,56 - W_PRECALC_32_79_1 W8,W24 - RR1 F3,E,A,B,C,D,56 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W24 -#else - W_PRECALC_32_79_2_i386 W24 -#endif - RR0 F3,C,D,E,A,B,58 - W_PRECALC_32_79_3 W24,58,K_XMM - RR1 F3,C,D,E,A,B,58 - - // starting using F4 - - // i=76 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_32_79_0 W16,W28,W24,W20 - RR0 F4,A,B,C,D,E,60 - W_PRECALC_32_79_1 W4,W20 - RR1 F4,A,B,C,D,E,60 - W_PRECALC_32_79_2 W20 - RR0 F4,D,E,A,B,C,62 - W_PRECALC_32_79_3 W20,62,K_XMM - RR1 F4,D,E,A,B,C,62 - - .endm - - .macro SOFTWARE_PIPELINING_ssse3 - // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) - RR0 F4,B,C,D,E,A,64 - W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP - RR1 F4,B,C,D,E,A,64 - W_PRECALC_00_15_2 // W_TMP = W0 + K - RR0 F4,E,A,B,C,D,66 - W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K - RR1 F4,E,A,B,C,D,66 - - // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 - W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) - RR0 F4,C,D,E,A,B,68 - W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP - RR1 F4,C,D,E,A,B,68 - W_PRECALC_00_15_2 // W_TMP = W28 + K - RR0 F4,A,B,C,D,E,70 - W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K[0] - RR1 F4,A,B,C,D,E,70 - - // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 - W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) - RR0 F4,D,E,A,B,C,72 - W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP - RR1 F4,D,E,A,B,C,72 - W_PRECALC_00_15_2 // W_TMP = W24 + K - RR0 F4,B,C,D,E,A,74 - W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K - RR1 F4,B,C,D,E,A,74 - - // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) - RR0 F4,E,A,B,C,D,76 - W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP - RR1 F4,E,A,B,C,D,76 - W_PRECALC_00_15_2 // W_TMP = W20 + K - RR0 F4,C,D,E,A,B,78 - W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K - RR1 F4,C,D,E,A,B,78 - .endm - - - #undef W_PRECALC_16_31_0 - #undef W_PRECALC_32_79_0 - #undef W_PRECALC_32_79_0_i386 - - - - /* - - The following are 3 macro definitions that are no-ssse3 variants of the previous 3 macro definitions. - - INITIAL_W_PRECALC_nossse3 - INTERNAL_nossse3 - SOFTWARE_PIPELINING_nossse3 - - They will be used in a sha1 code main body definition that will be used for system without ssse3 support. - - */ - - #define W_PRECALC_16_31_0 W_PRECALC_16_31_0_nossse3 - #define W_PRECALC_32_79_0 W_PRECALC_32_79_0_nossse3 - #define W_PRECALC_32_79_0_i386 W_PRECALC_32_79_0_i386_nossse3 - - - .macro INITIAL_W_PRECALC_nossse3 - - // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) - W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W0 + K - W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K - - // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 - W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) - W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W28 + K - W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K - - // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 - W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) - W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W24 + K - W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K - - // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) - W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W20 + K - W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K - - .endm - - - .macro INTERNAL_nossse3 - // i=16 - // circular buffer : W12,W8,W4,W0,W28,W24,W20,W16 - W_PRECALC_16_31_0 W0,W28,W24,W20,W16 - RR0 F1,A,B,C,D,E,0 - W_PRECALC_16_31_1 W0,W16 - RR1 F1,A,B,C,D,E,0 - W_PRECALC_16_31_2 W16 - RR0 F1,D,E,A,B,C,2 - W_PRECALC_16_31_3 W16, 2, 0 - RR1 F1,D,E,A,B,C,2 - - // i=20, - // W8,W4,W0,W28,W24,W20,W16,W12 - W_PRECALC_16_31_0 W28,W24,W20,W16,W12 - RR0 F1,B,C,D,E,A,4 - W_PRECALC_16_31_1 W28,W12 - RR1 F1,B,C,D,E,A,4 - - W_PRECALC_16_31_2 W12 - RR0 F1,E,A,B,C,D,6 - W_PRECALC_16_31_3 W12, 6, 16 - RR1 F1,E,A,B,C,D,6 - - // i=24, - // W4,W0,W28,W24,W20,W16,W12,W8 - W_PRECALC_16_31_0 W24,W20,W16,W12,W8 - RR0 F1,C,D,E,A,B,8 - W_PRECALC_16_31_1 W24,W8 - RR1 F1,C,D,E,A,B,8 - - W_PRECALC_16_31_2 W8 - RR0 F1,A,B,C,D,E,10 - W_PRECALC_16_31_3 W8,10,16 - RR1 F1,A,B,C,D,E,10 - - // i=28 - // W0,W28,W24,W20,W16,W12,W8,W4 - W_PRECALC_16_31_0 W20,W16,W12,W8,W4 - RR0 F1,D,E,A,B,C,12 - W_PRECALC_16_31_1 W20,W4 - RR1 F1,D,E,A,B,C,12 - - W_PRECALC_16_31_2 W4 - RR0 F1,B,C,D,E,A,14 - W_PRECALC_16_31_3 W4,14,16 - RR1 F1,B,C,D,E,A,14 - - //i=32 - // W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_32_79_0 W28,W8,W4,W0 - RR0 F1,E,A,B,C,D,16 - W_PRECALC_32_79_1 W16,W0 - RR1 F1,E,A,B,C,D,16 - W_PRECALC_32_79_2 W0 - RR0 F1,C,D,E,A,B,18 - W_PRECALC_32_79_3 W0,18,16 - RR1 F1,C,D,E,A,B,18 - - //i=36 - // W24,W20,W16,W12,W8,W4,W0,W28 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W24,W4,W0,W28 -#else - W_PRECALC_32_79_0_i386 W24,W4,W0,W28 -#endif - RR0 F2,A,B,C,D,E,20 - W_PRECALC_32_79_1 W12,W28 - RR1 F2,A,B,C,D,E,20 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W28 -#else - W_PRECALC_32_79_2_i386 W28 -#endif - RR0 F2,D,E,A,B,C,22 - W_PRECALC_32_79_3 W28,22,16 - RR1 F2,D,E,A,B,C,22 - - //i=40 - #undef K_XMM - #define K_XMM 32 - // W20,W16,W12,W8,W4,W0,W28,W24 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W20,W0,W28,W24 -#else - W_PRECALC_32_79_0_i386 W20,W0,W28,W24 -#endif - RR0 F2,B,C,D,E,A,24 - W_PRECALC_32_79_1 W8,W24 - RR1 F2,B,C,D,E,A,24 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W24 -#else - W_PRECALC_32_79_2_i386 W24 -#endif - RR0 F2,E,A,B,C,D,26 - W_PRECALC_32_79_3 W24,26,K_XMM - RR1 F2,E,A,B,C,D,26 - - //i=44 - // W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_32_79_0 W16,W28,W24,W20 - RR0 F2,C,D,E,A,B,28 - W_PRECALC_32_79_1 W4,W20 - RR1 F2,C,D,E,A,B,28 - W_PRECALC_32_79_2 W20 - RR0 F2,A,B,C,D,E,30 - W_PRECALC_32_79_3 W20,30,K_XMM - RR1 F2,A,B,C,D,E,30 - - //i=48 - // W12,W8,W4,W0,W28,W24,W20,W16 - W_PRECALC_32_79_0 W12,W24,W20,W16 - RR0 F2,D,E,A,B,C,32 - W_PRECALC_32_79_1 W0,W16 - RR1 F2,D,E,A,B,C,32 - W_PRECALC_32_79_2 W16 - RR0 F2,B,C,D,E,A,34 - W_PRECALC_32_79_3 W16,34,K_XMM - RR1 F2,B,C,D,E,A,34 - - //i=52 - // W8,W4,W0,W28,W24,W20,W16,W12 - W_PRECALC_32_79_0 W8,W20,W16,W12 - RR0 F2,E,A,B,C,D,36 - W_PRECALC_32_79_1 W28,W12 - RR1 F2,E,A,B,C,D,36 - W_PRECALC_32_79_2 W12 - RR0 F2,C,D,E,A,B,38 - W_PRECALC_32_79_3 W12,38,K_XMM - RR1 F2,C,D,E,A,B,38 - - //i=56 - // W4,W0,W28,W24,W20,W16,W12,W8 - W_PRECALC_32_79_0 W4,W16,W12,W8 - RR0 F3,A,B,C,D,E,40 - W_PRECALC_32_79_1 W24,W8 - RR1 F3,A,B,C,D,E,40 - W_PRECALC_32_79_2 W8 - RR0 F3,D,E,A,B,C,42 - W_PRECALC_32_79_3 W8,42,K_XMM - RR1 F3,D,E,A,B,C,42 - - //i=60 - #undef K_XMM - #define K_XMM 48 - // W0,W28,W24,W20,W16,W12,W8,W4 - W_PRECALC_32_79_0 W0,W12,W8,W4 - RR0 F3,B,C,D,E,A,44 - W_PRECALC_32_79_1 W20,W4 - RR1 F3,B,C,D,E,A,44 - W_PRECALC_32_79_2 W4 - RR0 F3,E,A,B,C,D,46 - W_PRECALC_32_79_3 W4,46,K_XMM - RR1 F3,E,A,B,C,D,46 - - //i=64 - // W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_32_79_0 W28,W8,W4,W0 - RR0 F3,C,D,E,A,B,48 - W_PRECALC_32_79_1 W16,W0 - RR1 F3,C,D,E,A,B,48 - W_PRECALC_32_79_2 W0 - RR0 F3,A,B,C,D,E,50 - W_PRECALC_32_79_3 W0,50,K_XMM - RR1 F3,A,B,C,D,E,50 - - //i=68 - // W24,W20,W16,W12,W8,W4,W0,W28 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W24,W4,W0,W28 -#else - W_PRECALC_32_79_0_i386 W24,W4,W0,W28 -#endif - RR0 F3,D,E,A,B,C,52 - W_PRECALC_32_79_1 W12,W28 - RR1 F3,D,E,A,B,C,52 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W28 -#else - W_PRECALC_32_79_2_i386 W28 -#endif - RR0 F3,B,C,D,E,A,54 - W_PRECALC_32_79_3 W28,54,K_XMM - RR1 F3,B,C,D,E,A,54 - - //i=72 - // W20,W16,W12,W8,W4,W0,W28,W24 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W20,W0,W28,W24 -#else - W_PRECALC_32_79_0_i386 W20,W0,W28,W24 -#endif - RR0 F3,E,A,B,C,D,56 - W_PRECALC_32_79_1 W8,W24 - RR1 F3,E,A,B,C,D,56 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W24 -#else - W_PRECALC_32_79_2_i386 W24 -#endif - RR0 F3,C,D,E,A,B,58 - W_PRECALC_32_79_3 W24,58,K_XMM - RR1 F3,C,D,E,A,B,58 - - // starting using F4 - - //i=76 - // W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_32_79_0 W16,W28,W24,W20 - RR0 F4,A,B,C,D,E,60 - W_PRECALC_32_79_1 W4,W20 - RR1 F4,A,B,C,D,E,60 - W_PRECALC_32_79_2 W20 - RR0 F4,D,E,A,B,C,62 - W_PRECALC_32_79_3 W20,62,K_XMM - RR1 F4,D,E,A,B,C,62 - - .endm - - .macro SOFTWARE_PIPELINING_nossse3 - // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) - RR0 F4,B,C,D,E,A,64 - W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP - RR1 F4,B,C,D,E,A,64 - W_PRECALC_00_15_2 // W_TMP = W0 + K - RR0 F4,E,A,B,C,D,66 - W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K - RR1 F4,E,A,B,C,D,66 - - // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 - W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) - RR0 F4,C,D,E,A,B,68 - W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP - RR1 F4,C,D,E,A,B,68 - W_PRECALC_00_15_2 // W_TMP = W28 + K - RR0 F4,A,B,C,D,E,70 - W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K[0] - RR1 F4,A,B,C,D,E,70 - - // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 - W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) - RR0 F4,D,E,A,B,C,72 - W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP - RR1 F4,D,E,A,B,C,72 - W_PRECALC_00_15_2 // W_TMP = W24 + K - RR0 F4,B,C,D,E,A,74 - W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K - RR1 F4,B,C,D,E,A,74 - - // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) - RR0 F4,E,A,B,C,D,76 - W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP - RR1 F4,E,A,B,C,D,76 - W_PRECALC_00_15_2 // W_TMP = W20 + K - RR0 F4,C,D,E,A,B,78 - W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K - RR1 F4,C,D,E,A,B,78 - .endm - - .macro ENDING // finish up updating hash digests (i=64:79) - //i=80 - RR0 F4,B,C,D,E,A,64 - RR1 F4,B,C,D,E,A,64 - RR0 F4,E,A,B,C,D,66 - RR1 F4,E,A,B,C,D,66 - - //i=84 - RR0 F4,C,D,E,A,B,68 - RR1 F4,C,D,E,A,B,68 - RR0 F4,A,B,C,D,E,70 - RR1 F4,A,B,C,D,E,70 - - //i=88 - RR0 F4,D,E,A,B,C,72 - RR1 F4,D,E,A,B,C,72 - RR0 F4,B,C,D,E,A,74 - RR1 F4,B,C,D,E,A,74 - - //i=92 - RR0 F4,E,A,B,C,D,76 - RR1 F4,E,A,B,C,D,76 - RR0 F4,C,D,E,A,B,78 - RR1 F4,C,D,E,A,B,78 - .endm - - // load hash digests A,B,C,D,E from memory into registers - .macro LOAD_HASH -#if defined (__x86_64__) - mov (HASH_PTR), A - mov 4(HASH_PTR), B - mov 8(HASH_PTR), C - mov 12(HASH_PTR), D - mov 16(HASH_PTR), E -#else - mov HASH_PTR, T1 - mov (T1), A - mov 4(T1), B - mov 8(T1), C - mov 12(T1), D - mov 16(T1), E -#endif - .endm - - .macro UPDATE_HASH - add $0, $1 - mov $1, $0 - .endm - - .macro UPDATE_ALL_HASH -#if defined (__x86_64__) - UPDATE_HASH (HASH_PTR), A - UPDATE_HASH 4(HASH_PTR), B - UPDATE_HASH 8(HASH_PTR), C - UPDATE_HASH 12(HASH_PTR), D - UPDATE_HASH 16(HASH_PTR), E -#else - mov HASH_PTR, T1 - UPDATE_HASH (T1), A - UPDATE_HASH 4(T1), B - UPDATE_HASH 8(T1), C - UPDATE_HASH 12(T1), D - UPDATE_HASH 16(T1), E -#endif - .endm - - - /* - main sha1 code for system without ssse3 support - */ - - .macro SHA1_PIPELINED_MAIN_BODY_nossse3 - LOAD_HASH // load initial hashes into A,B,C,D,E (registers) - INITIAL_W_PRECALC_nossse3 // big_endian_load(W) and W+K (i=0:15) - .align 4,0x90 -0: - INTERNAL_nossse3 // update W (i=16:79) and update ABCDE (i=0:63) -#if Multiple_Blocks - add $$64, BUFFER_PTR // BUFFER_PTR+=64; - sub $$1, cnt // pre-decrement cnt by 1 - jbe 1f // if cnt <= 0, branch to finish off - SOFTWARE_PIPELINING_nossse3 // update ABCDE (i=64:79) || big_endian_load(W) and W+K (i=0:15) - UPDATE_ALL_HASH // update output hashes - jmp 0b // repeat for next block - .align 4,0x90 -1: - #endif - ENDING // update ABCDE (i=64:79) - UPDATE_ALL_HASH // update output hashes - .endm - - /* - main sha1 code for system with ssse3 support -*/ - - .macro SHA1_PIPELINED_MAIN_BODY_ssse3 - LOAD_HASH // load initial hashes into A,B,C,D,E - INITIAL_W_PRECALC_ssse3 // big_endian_load(W) and W+K (i=0:15) - .align 4,0x90 -0: - INTERNAL_ssse3 // update W (i=16:79) and update ABCDE (i=0:63) -#if Multiple_Blocks - add $$64, BUFFER_PTR // BUFFER_PTR+=64; - sub $$1, cnt // pre-decrement cnt by 1 - jbe 1f // if cnt <= 0, branch to finish off - SOFTWARE_PIPELINING_ssse3 // update ABCDE (i=64:79) || big_endian_load(W) and W+K (i=0:15) - UPDATE_ALL_HASH // update output hashes - jmp 0b // repeat for next block - .align 4,0x90 -1: -#endif - ENDING // update ABCDE (i=64:79) - UPDATE_ALL_HASH // update output hashes - .endm - -#if KERNEL -#include -#else -#include -#endif - - .text - - .globl _sha1_block_asm_host_order - .private_extern _sha1_block_asm_host_order -_sha1_block_asm_host_order: - - // detect SSSE3 and dispatch appropriate code branch - #if defined __x86_64__ - movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capabilities - mov (%rax), %eax // %eax = __cpu_capabilities - #else // i386 - #if defined KERNEL - leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities - mov (%eax), %eax // %eax = __cpu_capabilities - #else - mov _COMM_PAGE_CPU_CAPABILITIES, %eax -#endif - #endif - test $(kHasSupplementalSSE3), %eax - je _SHA1Transform_nossse3_host_order // branch to no-ssse3 code - - - // start the sha1 code with ssse3 support - - // save callee-save registers -#if defined (__x86_64__) - push %rbx - push %rbp -#else - push %ebx - push %ebp - push %esi - push %edi -#endif - - sub $stack_size, sp // allocate stack memory for use - - // save used xmm register if this is for kernel -#if KERNEL - xmov %xmm0, 4*16(sp) - xmov %xmm1, 5*16(sp) - xmov %xmm2, 6*16(sp) - xmov %xmm3, 7*16(sp) - xmov %xmm4, 8*16(sp) - xmov %xmm5, 9*16(sp) - xmov %xmm6, 10*16(sp) - xmov %xmm7, 11*16(sp) -#if defined (__x86_64__) - xmov %xmm8, 12*16(sp) - xmov %xmm9, 13*16(sp) - xmov %xmm10, 14*16(sp) -#endif -#endif - -#if defined (__x86_64__) - - // set up registers to free %edx/%edi/%esi for other use (ABCDE) - mov ctx, HASH_PTR - mov buf, BUFFER_PTR -#if Multiple_Blocks - mov %rdx, cnt -#endif - lea K_XMM_AR(%rip), K_BASE - xmov -16(K_BASE), XMM_SHUFB_BSWAP - -#else // __i386__ - -#if KERNEL - lea K_XMM_AR, %eax -#else - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: pop %eax // Get program counter. - lea K_XMM_AR-0b(%eax), %eax -#endif - mov %eax, K_BASE - xmov -16(%eax), %xmm0 - xmov %xmm0, XMM_SHUFB_BSWAP - -#endif - - SHA1_PIPELINED_MAIN_BODY_ssse3 - - // restore used xmm registers if this is for kernel -#if KERNEL - xmov 4*16(sp), %xmm0 - xmov 5*16(sp), %xmm1 - xmov 6*16(sp), %xmm2 - xmov 7*16(sp), %xmm3 - xmov 8*16(sp), %xmm4 - xmov 9*16(sp), %xmm5 - xmov 10*16(sp), %xmm6 - xmov 11*16(sp), %xmm7 -#if defined (__x86_64__) - xmov 12*16(sp), %xmm8 - xmov 13*16(sp), %xmm9 - xmov 14*16(sp), %xmm10 -#endif -#endif - - add $stack_size, sp // deallocate stack memory - - // restore callee-save registers -#if defined (__x86_64__) - pop %rbp - pop %rbx -#else - pop %edi - pop %esi - pop %ebp - pop %ebx -#endif - - ret // return - - // this is equivalent to the above function _SHA1Transform, but it does not use ssse3 instructions - - .globl _SHA1Transform_nossse3_host_order - .private_extern _SHA1Transform_nossse3_host_order -_SHA1Transform_nossse3_host_order: - - // push callee-save registers -#if defined (__x86_64__) - push %rbx - push %rbp -#else - push %ebx - push %ebp - push %esi - push %edi -#endif - - sub $stack_size, sp // allocate stack memory for local use - - // save used xmm registers if this is for kernel -#if KERNEL - xmov %xmm0, 4*16(sp) - xmov %xmm1, 5*16(sp) - xmov %xmm2, 6*16(sp) - xmov %xmm3, 7*16(sp) - xmov %xmm4, 8*16(sp) - xmov %xmm5, 9*16(sp) - xmov %xmm6, 10*16(sp) - xmov %xmm7, 11*16(sp) -#if defined (__x86_64__) - xmov %xmm8, 12*16(sp) - xmov %xmm9, 13*16(sp) -#endif - #endif - -#if defined (__x86_64__) - - // set up registers to free %edx/%edi/%esi for other use (ABCDE) - mov ctx, HASH_PTR - mov buf, BUFFER_PTR -#if Multiple_Blocks - mov %rdx, cnt - #endif - lea K_XMM_AR(%rip), K_BASE - -#else // __i386__ - -#if KERNEL - lea K_XMM_AR, %eax -#else - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: pop %eax // Get program counter. - lea K_XMM_AR-0b(%eax), %eax -#endif - mov %eax, K_BASE - -#endif - - SHA1_PIPELINED_MAIN_BODY_nossse3 - - // restore used xmm registers if this is for kernel -#if KERNEL - xmov 4*16(sp), %xmm0 - xmov 5*16(sp), %xmm1 - xmov 6*16(sp), %xmm2 - xmov 7*16(sp), %xmm3 - xmov 8*16(sp), %xmm4 - xmov 9*16(sp), %xmm5 - xmov 10*16(sp), %xmm6 - xmov 11*16(sp), %xmm7 -#if defined (__x86_64__) - xmov 12*16(sp), %xmm8 - xmov 13*16(sp), %xmm9 -#endif -#endif - - add $stack_size, sp // deallocate stack memory - - // restore callee-save registers -#if defined (__x86_64__) - pop %rbp - pop %rbx -#else - pop %edi - pop %esi - pop %ebp - pop %ebx -#endif - - ret // return - - .const - .align 4, 0x90 - -#define K1 0x5a827999 -#define K2 0x6ed9eba1 -#define K3 0x8f1bbcdc -#define K4 0xca62c1d6 - -bswap_shufb_ctl: - .long 0x00010203 - .long 0x04050607 - .long 0x08090a0b - .long 0x0c0d0e0f - -K_XMM_AR: - .long K1 - .long K1 - .long K1 - .long K1 - .long K2 - .long K2 - .long K2 - .long K2 - .long K3 - .long K3 - .long K3 - .long K3 - .long K4 - .long K4 - .long K4 - .long K4 - - -#endif // architecture x86_64 or i386 DELETED Source/Digest/sha1edpLittleEndian.s Index: Source/Digest/sha1edpLittleEndian.s ================================================================== --- Source/Digest/sha1edpLittleEndian.s +++ /dev/null @@ -1,1484 +0,0 @@ -/* sha1edp.s : this file provides optimized x86_64 and i386 implementation of the sha1 function - CoreOS - vector and numerics group - cclee 6-21-10 - - The implementation is based on the principle described in an Intel online article - "Improving the Performance of the Secure Hash Algorithm (SHA-1)" - http://software.intel.com/en-us/articles/improving-the-performance-of-the-secure-hash-algorithm-1/ - - - Update HASH[] by processing a one 64-byte block in MESSAGE[] can be represented by the following C function - -void SHA1( int HASH[], int MESSAGE[] ) -{ - int A[81], B[81], C[81], D[81], E[81]; - int W[80]; - - int i, FN; - - A[0] = HASH[0]; - B[0] = HASH[1]; - C[0] = HASH[2]; - D[0] = HASH[3]; - E[0] = HASH[4]; - - for ( i=0; i<80; ++i ) - { - if ( i < 16 ) - W[i] = BIG_ENDIAN_LOAD( MESSAGE[i] ); - else - W[i] = ROTATE_LEFT( W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1 ); - - FN = F( i, B[i], C[i], D[i] ); - - A[i+1] = FN + E[i] + ROTATE_LEFT( A[i], 5 ) + W[i] + K(i); - B[i+1] = A[i]; - C[i+1] = ROTATE_LEFT( B[i], 30 ); - D[i+1] = C[i]; - E[i+1] = D[i]; - } - - HASH[0] += A[80]; - HASH[1] += B[80]; - HASH[2] += C[80]; - HASH[3] += D[80]; - HASH[4] += E[80]; -} - - For i=0:15, W[i] is simply big-endian loading of MESSAGE[i]. For i=16:79, W[i] is updated according to W[i] = ROTATE_LEFT( W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1 ); - - The approach (by Dean Gaudet) can be used to vectorize the computation of W[i] for i=16:79, - - 1. done on 4 consequtive W[i] values in a single XMM register - W[i ] = (W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]) rol 1 - W[i+1] = (W[i-2] ^ W[i-7] ^ W[i-13] ^ W[i-15]) rol 1 - W[i+2] = (W[i-1] ^ W[i-6] ^ W[i-12] ^ W[i-14]) rol 1 - W[i+3] = ( 0 ^ W[i-5] ^ W[i-11] ^ W[i-13]) rol 1 - - 2. this additional calculation unfortunately requires many additional operations - W[i+3] ^= W[i] rol 1 - - 3. once we have 4 W[i] values in XMM we can also add four K values with one instruction - W[i:i+3] += {K,K,K,K} - - Let W0 = {W[i] W[i+1] W[i+2] W[i+3]} be the current W-vector to be computed, W4 = {W[i-4] W[i-3] W[i-2] W[i-1]} be the previous vector, and so on - The Dean Gaudet approach can be expressed as - - 1. W0 = rotate_left(left_shift(W4,32) ^ W8 ^ left_shift(concatenate(W16,W12),64) ^ W16,1); - 2. W[i+3] ^= W[i] rol 1 - 3. W0 += {K,K,K,K} - - For i>=32, the Intel online article suggests that (using a basic identity (X rol 1) rol 1 = X rol 2) the update equation is equivalent to - - 1. W0 = rotate_left(left_shift(concatenate(W8,W4),64) ^ W16 ^ W28 ^ W32, 2); - - Note: - 1. In total, we need 8 16-byte registers or memory for W0,W4,...,W28. W0 and W32 can be the same register or memory. - 2. The registers are used in a circular buffering mode. For example, we start with W28,W24,...,W0 (with W0 indicating the most recent 16-byte) - i=0, W28,W24,...,W0 - i=4, W24,W20,...,W28 - i=8, W20,W16,...,W24 - . - . - and so forth. - 3. 2 ssse3 instructions are used in the Intel article, pshufb and palignr. - a. pshufb is used to simplify the BIG_ENDIAN_LOAD operation - b. palignr is used to simplify the computation of left_shift(concatenate(W12,W8),64) - 4. we probe __cpu_capabilities to detect ssse3 support and dispatch code with ssse3 support when available. - If ssse3 is not supported, a suboptimal code (pshufb and palignr workaround) is dispatched. - -*/ - -/* the code can be compiled into single block (64 bytes) per call mode by setting Multiple_blocks to 0 */ -#define Multiple_Blocks 1 - -#if defined (__x86_64__) || defined(__i386__) // x86_64 or i386 architectures - -#if defined(__x86_64__) - - // set up for x86_64 -#define stack_size (8+16*11+16*4) // 8 (alignedment) + x0-x10 + 4 128-bits for intermediate WK(t) storage -#define sp %rsp // unifying architectural stack pointer representation -#define ctx %rdi // 1st input argument, will move to HASH_PTR (%r9) -#define buf %rsi // 2nd input argument, will move to BUFFER_PTR (%r10) -#define cnt %r11 // will copy from the 3rd input argument (%rdx) -#define K_BASE %r8 // an aligned pointer to point to shufb reference numbers of table of K values -#define HASH_PTR %r9 // pointer to Hash values (A,B,C,D,E) -#define BUFFER_PTR %r10 // pointer to input blocks - -#else // !__x86_64__ - - // set up for i386 -#define stack_size (12+16*2+16*11+16*4) // 12-bytes (alignment) + extra 2 + 3 (W24/W28/XMM_SHUFB_BSWAP) + 8 (xmm0-xmm7) + 4 (WK(t)) -#define sp %esp // unifying architectural stack pointer representation -#define HASH_PTR stack_size+16+4(sp) // use 1st input argument from caller function, 16 for (esi/edi/ebx/ebp) -#define BUFFER_PTR stack_size+16+8(sp) // use 2nd input argument from caller function -#define cnt stack_size+16+12(sp) // use 3rd input argument from caller function -#define K_BASE stack_size-4(sp) // use for K_BASE - -#endif // __x86_64__ - -// symbolizing registers or stack memory with algorithmic variables W0,W4,...,W28 + W_TMP, W_TMP2, and XMM_SHUFB_BSWAP for code with ssse3 support - -#define W_TMP %xmm0 -#define W_TMP2 %xmm1 -#define W0 %xmm2 -#define W4 %xmm3 -#define W8 %xmm4 -#define W12 %xmm5 -#define W16 %xmm6 -#define W20 %xmm7 -#if defined(__x86_64__) -#define W24 %xmm8 -#define W28 %xmm9 -#define XMM_SHUFB_BSWAP %xmm10 // used only when ssse3 is supported -#else // defined (__i386__) -#define W24 12*16(sp) -#define W28 13*16(sp) -#define XMM_SHUFB_BSWAP 14*16(sp) // used only when ssse3 is supported -#endif - -#define xmov movaps // aligned 16-byte move -#define xmovu movups // unaligned 16-byte move - -// intermediate hash variables -#define A %ecx -#define B %esi -#define C %edi -#define D %ebp -#define E %edx - -// temp variables -#define T1 %eax -#define T2 %ebx - -#define WK(t) (t&15)*4(sp) - - // int F1(int B, int C, int D) { return (D ^ ( B & (C ^ D)); } - // result in T1 - .macro F1 - mov $1, T1 - xor $2, T1 - and $0, T1 - xor $2, T1 - .endm - - // int F2(int B, int C, int D) { return (D ^ B ^ C); } - // result in T1 - .macro F2 - mov $2, T1 - xor $1, T1 - xor $0, T1 - .endm - - // int F3(int B, int C, int D) { return (B & C) | (D & (B ^ C)); } - // result in T1 - .macro F3 - mov $1, T1 - mov $0, T2 - or $0, T1 - and $1, T2 - and $2, T1 - or T2, T1 - .endm - - // for i=60:79, F4 is identical to F2 - #define F4 F2 - - - /* - i=0:15, W[i] = BIG_ENDIAN_LOAD(MESSAGE[i]); - - with ssse3 support, this is achived via - for (i=0;i<16;i+=4) { - 1. W_TMP = new 16 bytes from MESSAGE[] - 2. W_TMP = pshufb(W_TMP, XMM_SHUFB_BSWAP); save to W circular buffer for updating W - 3. WTMP += {K,K,K,K}; - 4. save quadruple W[i]+K[i] = W_TMP in the stack memory; - } - - each step is represented in one of the following 4 macro definitions - - */ - - .macro W_PRECALC_00_15_0_ssse3 // input argument $0 : 0/4/8/12 -#if defined (__x86_64__) // BUFFER_PTR is already an address register in x86_64 - xmovu $0*4(BUFFER_PTR), W_TMP // read 16-bytes into W_TMP, BUFFER_PTR possibly not 16-byte aligned -#else // BUFFER_PTR is from the argument set up in the caller - mov BUFFER_PTR, T1 // T1 = BUFFER_PTR - xmovu $0*4(T1), W_TMP // read 16-bytes into W_TMP, BUFFER_PTR possibly not 16-byte aligned -#endif - .endm - - .macro W_PRECALC_00_15_1_ssse3 // input argument $0 : current 16-bytes in the circular buffer, one of W0,W4,W8,...,W28 - pshufb XMM_SHUFB_BSWAP, W_TMP // convert W_TMP from little-endian into big-endian - xmov W_TMP, $0 // save W_TMP in the circular buffer - .endm - - .macro W_PRECALC_00_15_2 // K_BASE points to the current K quadruple. -#if defined (__x86_64__) // K_BASE is already an address register in x86_64 - paddd (K_BASE), W_TMP // W_TMP += {K,K,K,K}; -#else // K_BASE is previously set up in the stack memory - mov K_BASE, T1 // T1 = K_BASE - paddd (T1), W_TMP // W_TMP += {K,K,K,K}; -#endif - .endm - - .macro W_PRECALC_00_15_3 - xmov W_TMP, WK($0&~3) // save quadruple W[i]+K in the stack memory, which would be used later for updating the hashes A/B/C/D/E - .endm - - /* - without ssse3 support, steps 1 and 2 need to be modified - 1. sequentially load 4 words into T1, bswap T1, and save it to 4-bytes in the stack space - 2. load the 16-bytes from the aligned stack memory into W_TMP -*/ - - .macro W_PRECALC_00_15_0_nossse3 // input argument $0 : 0/4/8/12 - -#if defined (__x86_64__) - #define BUFFERP BUFFER_PTR -#else - mov BUFFER_PTR, T2 // copy BUFFER_PTR (from caller 2nd argument) to T2 - #define BUFFERP T2 -#endif - - // load 1st word, bswap it, save it to stack - mov $0*4(BUFFERP), T1 - bswap T1 - mov T1, 14*16(sp) - - // load 2nd word, bswap it, save it to stack - mov 4+$0*4(BUFFERP), T1 - bswap T1 - mov T1, 4+14*16(sp) - - // load 3rd word, bswap it, save it to stack - mov 8+$0*4(BUFFERP), T1 - bswap T1 - mov T1, 8+14*16(sp) - - // load 4th word, bswap it, save it to stack - mov 12+$0*4(BUFFERP), T1 - bswap T1 - mov T1, 12+14*16(sp) - .endm - - .macro W_PRECALC_00_15_1_nossse3 // input argument $0 : current 16-bytes in the circular buffer, one of W0,W4,W8,...,W28 - xmov 14*16(sp), W_TMP // load the bswapped 16-bytes from the aligned stack memory - xmov W_TMP, $0 // save W = W_TMP in the circular buffer - .endm - - // rounds 16-31 compute W[0] using the vectorization approach by Dean Gaudet - /* - W[i ] = (W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]) rol 1 - W[i+1] = (W[i-2] ^ W[i-7] ^ W[i-13] ^ W[i-15]) rol 1 - W[i+2] = (W[i-1] ^ W[i-6] ^ W[i-12] ^ W[i-14]) rol 1 - W[i+3] = ( 0 ^ W[i-5] ^ W[i-11] ^ W[i-13]) rol 1 - - W[i+3] ^= W[i] rol 1; // this W[i] is already rol by 1, if we are taking from the intial W before rol 1, we should rol this by 2 - - The operation (updating W and W+K) is scheduled as and divided into 4 steps - - 0. W_tmp = W3; W = W14 ^ W8 - 1. W = W3 ^ W8 ^ W14 ^ W16; W_TMP = W; W_TMP2 = (W[i] 0 0 0); - 2. W_TMP = (W3 ^ W8 ^ W14 ^ W16) rol 1; split (W[i] 0 0 0) rol 2 in W_TMP2 and W - 3. W = W_TMP = W_TMP ^ W_TMP2 ^ W = (W3 ^ W8 ^ W14 ^ W16) rol 1 ^ (W[i] 0 0 0) rol 2; WK = W _TMP+K; - - */ - - .macro W_PRECALC_16_31_0_ssse3 // input arguments : W16,W12,W8,W4,W - xmov $1, $4 // W = W12 - palignr $$8, $0, $4 // W = W14 - xmov $3, W_TMP // W_TMP = W4 - psrldq $$4, W_TMP // W_TMP = W3 - pxor $2, $4 // W = W8 ^ W14 - .endm - - .macro W_PRECALC_16_31_1 // input arguments : W16,W - pxor $0, W_TMP // W_TMP = W3 ^ W16 - pxor W_TMP, $1 // W = W3 ^ W16 ^ W8 ^ W14 - xmov $1, W_TMP2 // W_TMP2 = W3 ^ W16 ^ W8 ^ W14 - xmov $1, W_TMP // W_TMP = W3 ^ W16 ^ W8 ^ W14 - pslldq $$12, W_TMP2 // W_TMP2 = (W[i] 0 0 0) - .endm - - .macro W_PRECALC_16_31_2 // input argument : W - psrld $$31, $0 // (W3 ^ W16 ^ W8 ^ W14)>>31 - pslld $$1, W_TMP // (W3 ^ W16 ^ W8 ^ W14)<<1 - por $0, W_TMP // W_TMP = (W3 ^ W16 ^ W8 ^ W14) rol 1 - xmov W_TMP2, $0 // copy W[i] at location of W[i+3] - psrld $$30, W_TMP2 // W_TMP2 = W[i] lower 2 bits after rol 2 - pslld $$2, $0 // W = W[i] higher 30 bits after rol 2 - .endm - - .macro W_PRECALC_16_31_3 // input arguments: W, i, K_XMM -#if defined (__i386__) - mov K_BASE, T1 // K_BASE is store in the stack memory for i386 -#endif - pxor $0, W_TMP - pxor W_TMP2, W_TMP // W_TMP = (W3 ^ W16 ^ W8 ^ W14) rol 1 ^ (W[i] 0 0 0) rol 2 - xmov W_TMP, $0 // save W = W_TMP in the W circular buffer -#if defined (__x86_64__) - paddd $2(K_BASE), W_TMP // W+K -#else - paddd $2(T1), W_TMP // W+K -#endif - xmov W_TMP, WK($1&~3) // save WK = W+K for later update of the hashes A/B/C/D/E - .endm - - // the following is a variant of W_PRECALC_16_31_0_ssse3 to be used for system without ssse3, palignr is replaced with 4 instructions - - .macro W_PRECALC_16_31_0_nossse3 // input arguments : W16,W12,W8,W4,W - xmov $1, $4 // W = W12 = (w9 w10 w11 w12) - - // the following is a wrokaround for palignr - xmov $0, W_TMP // W16 = (w13 w14 w15 w16) - pslldq $$8, $4 // shift left to make (w11 w12 0 0) - psrldq $$8, W_TMP // shift right to make (0 0 w13 w14) - por W_TMP, $4 // W = W14 = (w11 w12 w13 w14) - - xmov $3, W_TMP // W_TMP = W4 = (w1 w2 w3 w4) - psrldq $$4, W_TMP // W_TMP = W3 = (0 w1 w2 w3) - pxor $2, $4 // W = W8 ^ W14 - .endm - - /* rounds 32-79 compute W und W+K iusing the vectorization approach from the Intel article - - W = rotate_left(left_shift(concatenate(W8,W4),64) ^ W16 ^ W28 ^ W32, 2); - - where left_shift(concatenate(W8,W4),64) is equivalent to W6. Note also that W32 and W use the same register. - - - 0. W_tmp = W6; W = W28 ^ W32; - 1. W = W_tmp = W6 ^ W16 ^ W28 ^ W32; - 2. W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2; - 3. W = W_Tmp; WK = W_tmp + K; - -*/ - - - .macro W_PRECALC_32_79_0_ssse3 // inputr arguments : W28,W8,W4,W - xmov $2, W_TMP // (w1 w2 w3 w4) - pxor $0, $3 // W = W28 ^ W32; - palignr $$8, $1, W_TMP // W_tmp = (w3 w4 w5 w6) = W6; - .endm - - // the following is a variant and will be used for system without ssse3 support - .macro W_PRECALC_32_79_0_nossse3 // input arguments : W28,W8,W4,W - xmov $2, W_TMP // (w1 w2 w3 w4) - xmov $1, W_TMP2 // (w5 w6 w7 w8) - pxor $0, $3 // W = W28 ^ W32 - pslldq $$8, W_TMP // (w3 w4 0 0) - psrldq $$8, W_TMP2 // (0 0 w5 w6) - por W_TMP2, W_TMP // W_tmp = (w3 w4 w5 w6) = W6 - .endm - - // this is a variant of W_PRECALC_32_79_0_ssse3 for i386 (as W24/W28 are stored in memory, not in registers) - .macro W_PRECALC_32_79_0_i386_ssse3 // input arguments : W28,W8,W4,W - xmov $3, W_TMP // W32 - pxor $0, W_TMP // W28 ^ W32 - xmov W_TMP, $3 // W = W28 ^ W32; - xmov $2, W_TMP // W4 - palignr $$8, $1, W_TMP // W_tmp = (w3 w4 w5 w6) = W6; - .endm - - // this is a variant of W_PRECALC_32_79_0_nossse3 for i386 (as W24/W28 are stored in memory, not in registers) - .macro W_PRECALC_32_79_0_i386_nossse3 // input arguments : W28,W8,W4,W - xmov $3, W_TMP // W32 - pxor $0, W_TMP // W28 ^ W32 - xmov W_TMP, $3 // W = W28 ^ W32 - xmov $2, W_TMP // W4 = (w1 w2 w3 w4) - xmov $1, W_TMP2 // W8 = (w5 w6 w7 w8) - pslldq $$8, W_TMP // (w3 w4 0 0) - psrldq $$8, W_TMP2 // (0 0 w5 w6) - por W_TMP2, W_TMP // W_tmp = (w3 w4 w5 w6) = W6 - .endm - - .macro W_PRECALC_32_79_1 // input arguments : W16,W - pxor $0, W_TMP // W_tmp = W6 ^ W16 - pxor $1, W_TMP // W_tmp = W6 ^ W16 ^ W28 ^ W32 - xmov W_TMP, $1 // W = W_tmp = W6 ^ W16 ^ W28 ^ W32 - .endm - - .macro W_PRECALC_32_79_2 // input argument : W - psrld $$30, $0 // W >> 30 - pslld $$2, W_TMP // W << 2 - por $0, W_TMP // W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2 - .endm - - // this is a variant of W_PRECALC_32_79_2 for i386 (as W24/W28 are stored in memory, not in registers) - // this should be used when the input is either W24 or W28 on i386 architecture - .macro W_PRECALC_32_79_2_i386 // input argument : W - xmov $0, W_TMP2 // W - psrld $$30, W_TMP2 // W >> 30 - xmov W_TMP2, $0 // save (W >> 30) at W - pslld $$2, W_TMP // W_tmp << 2 - por $0, W_TMP // W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2 - .endm - - .macro W_PRECALC_32_79_3 // input argument W, i, K_XMM -#if defined (__x86_64__) - xmov W_TMP, $0 // W = (W6 ^ W16 ^ W28 ^ W32) rol 2 - paddd $2(K_BASE), W_TMP // W + K - xmov W_TMP, WK($1&~3) // write W+K -#else - mov K_BASE, T1 // T1 = K_BASE (which is in the caller argument) - xmov W_TMP, $0 // W = (W6 ^ W16 ^ W28 ^ W32) rol 2 - paddd $2(T1), W_TMP // W_tmp = W + K - xmov W_TMP, WK($1&~3) // write WK - #endif - .endm - - - /* The hash update operation is completed by the following statements. - - A[i+1] = FN + E[i] + ROTATE_LEFT( A[i], 5 ) + WK(i); - B[i+1] = A[i]; - C[i+1] = ROTATE_LEFT( B[i], 30 ); - D[i+1] = C[i]; - E[i+1] = D[i]; - - Suppose we start with A0,B0,C0,D0,E0. The 1st iteration can be expressed as follows: - - A1 = FN + E0 + rol(A0,5) + WK; - B1 = A0; - C1 = rol(B0, 30); - D1 = C0; - E1 = D0; - - to avoid excessive memory movement between registers, - 1. A1 = FN + E0 + rol(A0,5) + WK; can be temporarily saved in E0, - 2. C1 = rol(B0,30) can be temporarily saved in B0. - - Therefore, ignoring the time index, the update operation is equivalent to - 1. E = FN(B,C,D) + E + rol(A,5) + WK(i) - 2. B = rol(B,30) - 3. the hashes are now stored in the order of E,A,B,C,D - - - To pack 2 hash update operations in 1 iteration, starting with A,B,C,D,E - 1. E = FN(B,C,D) + E + rol(A,5) + WK(i) - 2. B = rol(B,30) - // now the hashes are in the order of E,A,B,C,D - 3. D = FN(A,B,C) + D + rol(E,5) + WK(i+1) - 4. A = rol(A,30) - // now the hashes are in the order of D,E,A,B,C - - These operations are distributed into the following 2 macro definitions RR0 and RR1. - -*/ - - .macro RR0 // input arguments : FN, A, B, C, D, E, i - $0 $2, $3, $4 // T1 = FN(B,C,D) - add WK($6), $5 // E + WK(i) - rol $$30, $2 // B = rol(B,30) - mov $1, T2 // T2 = A - add WK($6+1), $4 // D + WK(i+1) - rol $$5, T2 // rol(A,5) - add T1, $5 // E = FN(B,C,D) + E + WK(i) - .endm - - .macro RR1 - add $5, T2 // T2 = FN(B,C,D) + E + rol(A,5) + WK(i) - mov T2, $5 // E = FN(B,C,D) + E + rol(A,5) + WK(i) - rol $$5, T2 // rol(E,5) - add T2, $4 // D + WK(i+1) + rol(E,5) - $0 $1, $2, $3 // FN(A,B,C) - add T1, $4 // D = FN(A,B,C) + D + rol(E,5) + WK(i+1) - rol $$30, $1 // A = rol(A,30) - .endm - - - - /* - - The following macro definitions are used to expand code for the per-block sha1 operation. - - INITIAL_W_PRECALC_ssse3 : BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack memory - INTERNAL_ssse3 : updating W (16:79) and update the digests A/B/C/D/E (i=0:63, based on W+K stored in the stack memory) - ENDING : finishing up update the digests A/B/C/D/E (i=64:79) - - For multiple-block sha1 operation (Multiple_Blocks = 1), INITIAL_W_PRECALC_ssse3 and ENDING are combined - into 1 macro definition for software pipeling. - - SOFTWARE_PIPELINING_ssse3 : BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack, and finishing up update the digests A/B/C/D/E (i=64:79) - - assume cnt (the number of blocks) >= 1, the main code body should look like - - INITIAL_W_PRECALC_ssse3 // W = big_endian_load and pre-compute W+K (i=0:15) - do { - INTERNAL_ssse3 // update W(i=16:79), and update hash digests A/B/C/D/E (i=0:63) - cnt--; - if (cnt==0) break; - BUFFER_PTR += 64; - SOFTWARE_PIPELINING_ssse3; // update hash digests A/B/C/D/E (i=64:79) + W = big_endian_load and pre-compute W+K (i=0:15) - } - ENDING // update hash digests A/B/C/D/E (i=64:79) - - */ - - #define W_PRECALC_00_15_0 W_PRECALC_00_15_0_ssse3 - #define W_PRECALC_00_15_1 W_PRECALC_00_15_1_ssse3 - #define W_PRECALC_16_31_0 W_PRECALC_16_31_0_ssse3 - #define W_PRECALC_32_79_0 W_PRECALC_32_79_0_ssse3 - #define W_PRECALC_32_79_0_i386 W_PRECALC_32_79_0_i386_ssse3 - - - .macro INITIAL_W_PRECALC_ssse3 // BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack memory - - // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) - W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W0 + K - W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K - - // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 - W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) - W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W28 + K - W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K - - // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 - W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) - W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W24 + K - W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K - - // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) - W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W20 + K - W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K - - .endm - - - .macro INTERNAL_ssse3 // updating W (16:79) and update the digests A/B/C/D/E (i=0:63, based on W+K stored in the stack memory) - - // i=16 : W12,W8,W4,W0,W28,W24,W20,W16 - W_PRECALC_16_31_0 W0,W28,W24,W20,W16 - RR0 F1,A,B,C,D,E,0 - W_PRECALC_16_31_1 W0,W16 - RR1 F1,A,B,C,D,E,0 - W_PRECALC_16_31_2 W16 - RR0 F1,D,E,A,B,C,2 - W_PRECALC_16_31_3 W16, 2, 0 - RR1 F1,D,E,A,B,C,2 - - // i=20 : W8,W4,W0,W28,W24,W20,W16,W12 - W_PRECALC_16_31_0 W28,W24,W20,W16,W12 - RR0 F1,B,C,D,E,A,4 - W_PRECALC_16_31_1 W28,W12 - RR1 F1,B,C,D,E,A,4 - W_PRECALC_16_31_2 W12 - RR0 F1,E,A,B,C,D,6 - W_PRECALC_16_31_3 W12, 6, 16 - RR1 F1,E,A,B,C,D,6 - - // i=24 : W4,W0,W28,W24,W20,W16,W12,W8 - W_PRECALC_16_31_0 W24,W20,W16,W12,W8 - RR0 F1,C,D,E,A,B,8 - W_PRECALC_16_31_1 W24,W8 - RR1 F1,C,D,E,A,B,8 - W_PRECALC_16_31_2 W8 - RR0 F1,A,B,C,D,E,10 - W_PRECALC_16_31_3 W8,10,16 - RR1 F1,A,B,C,D,E,10 - - // i=28 : W0,W28,W24,W20,W16,W12,W8,W4 - W_PRECALC_16_31_0 W20,W16,W12,W8,W4 - RR0 F1,D,E,A,B,C,12 - W_PRECALC_16_31_1 W20,W4 - RR1 F1,D,E,A,B,C,12 - W_PRECALC_16_31_2 W4 - RR0 F1,B,C,D,E,A,14 - W_PRECALC_16_31_3 W4,14,16 - RR1 F1,B,C,D,E,A,14 - - // i=32 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_32_79_0 W28,W8,W4,W0 - RR0 F1,E,A,B,C,D,16 - W_PRECALC_32_79_1 W16,W0 - RR1 F1,E,A,B,C,D,16 - W_PRECALC_32_79_2 W0 - RR0 F1,C,D,E,A,B,18 - W_PRECALC_32_79_3 W0,18,16 - RR1 F1,C,D,E,A,B,18 - - // starting using F2 - - // i=36 : W24,W20,W16,W12,W8,W4,W0,W28 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W24,W4,W0,W28 -#else - W_PRECALC_32_79_0_i386 W24,W4,W0,W28 -#endif - RR0 F2,A,B,C,D,E,20 - W_PRECALC_32_79_1 W12,W28 - RR1 F2,A,B,C,D,E,20 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W28 -#else - W_PRECALC_32_79_2_i386 W28 -#endif - RR0 F2,D,E,A,B,C,22 - W_PRECALC_32_79_3 W28,22,16 - RR1 F2,D,E,A,B,C,22 - - // i=40 : W20,W16,W12,W8,W4,W0,W28,W24 - #undef K_XMM - #define K_XMM 32 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W20,W0,W28,W24 -#else - W_PRECALC_32_79_0_i386 W20,W0,W28,W24 -#endif - RR0 F2,B,C,D,E,A,24 - W_PRECALC_32_79_1 W8,W24 - RR1 F2,B,C,D,E,A,24 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W24 -#else - W_PRECALC_32_79_2_i386 W24 -#endif - RR0 F2,E,A,B,C,D,26 - W_PRECALC_32_79_3 W24,26,K_XMM - RR1 F2,E,A,B,C,D,26 - - // i=44 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_32_79_0 W16,W28,W24,W20 - RR0 F2,C,D,E,A,B,28 - W_PRECALC_32_79_1 W4,W20 - RR1 F2,C,D,E,A,B,28 - W_PRECALC_32_79_2 W20 - RR0 F2,A,B,C,D,E,30 - W_PRECALC_32_79_3 W20,30,K_XMM - RR1 F2,A,B,C,D,E,30 - - // i=48 : W12,W8,W4,W0,W28,W24,W20,W16 - W_PRECALC_32_79_0 W12,W24,W20,W16 - RR0 F2,D,E,A,B,C,32 - W_PRECALC_32_79_1 W0,W16 - RR1 F2,D,E,A,B,C,32 - W_PRECALC_32_79_2 W16 - RR0 F2,B,C,D,E,A,34 - W_PRECALC_32_79_3 W16,34,K_XMM - RR1 F2,B,C,D,E,A,34 - - // i=52 : W8,W4,W0,W28,W24,W20,W16,W12 - W_PRECALC_32_79_0 W8,W20,W16,W12 - RR0 F2,E,A,B,C,D,36 - W_PRECALC_32_79_1 W28,W12 - RR1 F2,E,A,B,C,D,36 - W_PRECALC_32_79_2 W12 - RR0 F2,C,D,E,A,B,38 - W_PRECALC_32_79_3 W12,38,K_XMM - RR1 F2,C,D,E,A,B,38 - - // starting using F3 - - // i=56 : W4,W0,W28,W24,W20,W16,W12,W8 - W_PRECALC_32_79_0 W4,W16,W12,W8 - RR0 F3,A,B,C,D,E,40 - W_PRECALC_32_79_1 W24,W8 - RR1 F3,A,B,C,D,E,40 - W_PRECALC_32_79_2 W8 - RR0 F3,D,E,A,B,C,42 - W_PRECALC_32_79_3 W8,42,K_XMM - RR1 F3,D,E,A,B,C,42 - - // i=60 : W0,W28,W24,W20,W16,W12,W8,W4 - #undef K_XMM - #define K_XMM 48 - W_PRECALC_32_79_0 W0,W12,W8,W4 - RR0 F3,B,C,D,E,A,44 - W_PRECALC_32_79_1 W20,W4 - RR1 F3,B,C,D,E,A,44 - W_PRECALC_32_79_2 W4 - RR0 F3,E,A,B,C,D,46 - W_PRECALC_32_79_3 W4,46,K_XMM - RR1 F3,E,A,B,C,D,46 - - // i=64 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_32_79_0 W28,W8,W4,W0 - RR0 F3,C,D,E,A,B,48 - W_PRECALC_32_79_1 W16,W0 - RR1 F3,C,D,E,A,B,48 - W_PRECALC_32_79_2 W0 - RR0 F3,A,B,C,D,E,50 - W_PRECALC_32_79_3 W0,50,K_XMM - RR1 F3,A,B,C,D,E,50 - - // i=68 : W24,W20,W16,W12,W8,W4,W0,W28 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W24,W4,W0,W28 -#else - W_PRECALC_32_79_0_i386 W24,W4,W0,W28 -#endif - RR0 F3,D,E,A,B,C,52 - W_PRECALC_32_79_1 W12,W28 - RR1 F3,D,E,A,B,C,52 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W28 -#else - W_PRECALC_32_79_2_i386 W28 -#endif - RR0 F3,B,C,D,E,A,54 - W_PRECALC_32_79_3 W28,54,K_XMM - RR1 F3,B,C,D,E,A,54 - - // i=72 : W20,W16,W12,W8,W4,W0,W28,W24 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W20,W0,W28,W24 -#else - W_PRECALC_32_79_0_i386 W20,W0,W28,W24 -#endif - RR0 F3,E,A,B,C,D,56 - W_PRECALC_32_79_1 W8,W24 - RR1 F3,E,A,B,C,D,56 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W24 -#else - W_PRECALC_32_79_2_i386 W24 -#endif - RR0 F3,C,D,E,A,B,58 - W_PRECALC_32_79_3 W24,58,K_XMM - RR1 F3,C,D,E,A,B,58 - - // starting using F4 - - // i=76 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_32_79_0 W16,W28,W24,W20 - RR0 F4,A,B,C,D,E,60 - W_PRECALC_32_79_1 W4,W20 - RR1 F4,A,B,C,D,E,60 - W_PRECALC_32_79_2 W20 - RR0 F4,D,E,A,B,C,62 - W_PRECALC_32_79_3 W20,62,K_XMM - RR1 F4,D,E,A,B,C,62 - - .endm - - .macro SOFTWARE_PIPELINING_ssse3 - // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) - RR0 F4,B,C,D,E,A,64 - W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP - RR1 F4,B,C,D,E,A,64 - W_PRECALC_00_15_2 // W_TMP = W0 + K - RR0 F4,E,A,B,C,D,66 - W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K - RR1 F4,E,A,B,C,D,66 - - // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 - W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) - RR0 F4,C,D,E,A,B,68 - W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP - RR1 F4,C,D,E,A,B,68 - W_PRECALC_00_15_2 // W_TMP = W28 + K - RR0 F4,A,B,C,D,E,70 - W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K[0] - RR1 F4,A,B,C,D,E,70 - - // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 - W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) - RR0 F4,D,E,A,B,C,72 - W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP - RR1 F4,D,E,A,B,C,72 - W_PRECALC_00_15_2 // W_TMP = W24 + K - RR0 F4,B,C,D,E,A,74 - W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K - RR1 F4,B,C,D,E,A,74 - - // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) - RR0 F4,E,A,B,C,D,76 - W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP - RR1 F4,E,A,B,C,D,76 - W_PRECALC_00_15_2 // W_TMP = W20 + K - RR0 F4,C,D,E,A,B,78 - W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K - RR1 F4,C,D,E,A,B,78 - .endm - - - #undef W_PRECALC_00_15_0 - #undef W_PRECALC_00_15_1 - #undef W_PRECALC_16_31_0 - #undef W_PRECALC_32_79_0 - #undef W_PRECALC_32_79_0_i386 - - - - /* - - The following are 3 macro definitions that are no-ssse3 variants of the previous 3 macro definitions. - - INITIAL_W_PRECALC_nossse3 - INTERNAL_nossse3 - SOFTWARE_PIPELINING_nossse3 - - They will be used in a sha1 code main body definition that will be used for system without ssse3 support. - - */ - - #define W_PRECALC_00_15_0 W_PRECALC_00_15_0_nossse3 - #define W_PRECALC_00_15_1 W_PRECALC_00_15_1_nossse3 - #define W_PRECALC_16_31_0 W_PRECALC_16_31_0_nossse3 - #define W_PRECALC_32_79_0 W_PRECALC_32_79_0_nossse3 - #define W_PRECALC_32_79_0_i386 W_PRECALC_32_79_0_i386_nossse3 - - - .macro INITIAL_W_PRECALC_nossse3 - - // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) - W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W0 + K - W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K - - // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 - W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) - W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W28 + K - W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K - - // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 - W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) - W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W24 + K - W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K - - // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) - W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP - W_PRECALC_00_15_2 // W_TMP = W20 + K - W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K - - .endm - - - .macro INTERNAL_nossse3 - // i=16 - // circular buffer : W12,W8,W4,W0,W28,W24,W20,W16 - W_PRECALC_16_31_0 W0,W28,W24,W20,W16 - RR0 F1,A,B,C,D,E,0 - W_PRECALC_16_31_1 W0,W16 - RR1 F1,A,B,C,D,E,0 - W_PRECALC_16_31_2 W16 - RR0 F1,D,E,A,B,C,2 - W_PRECALC_16_31_3 W16, 2, 0 - RR1 F1,D,E,A,B,C,2 - - // i=20, - // W8,W4,W0,W28,W24,W20,W16,W12 - W_PRECALC_16_31_0 W28,W24,W20,W16,W12 - RR0 F1,B,C,D,E,A,4 - W_PRECALC_16_31_1 W28,W12 - RR1 F1,B,C,D,E,A,4 - - W_PRECALC_16_31_2 W12 - RR0 F1,E,A,B,C,D,6 - W_PRECALC_16_31_3 W12, 6, 16 - RR1 F1,E,A,B,C,D,6 - - // i=24, - // W4,W0,W28,W24,W20,W16,W12,W8 - W_PRECALC_16_31_0 W24,W20,W16,W12,W8 - RR0 F1,C,D,E,A,B,8 - W_PRECALC_16_31_1 W24,W8 - RR1 F1,C,D,E,A,B,8 - - W_PRECALC_16_31_2 W8 - RR0 F1,A,B,C,D,E,10 - W_PRECALC_16_31_3 W8,10,16 - RR1 F1,A,B,C,D,E,10 - - // i=28 - // W0,W28,W24,W20,W16,W12,W8,W4 - W_PRECALC_16_31_0 W20,W16,W12,W8,W4 - RR0 F1,D,E,A,B,C,12 - W_PRECALC_16_31_1 W20,W4 - RR1 F1,D,E,A,B,C,12 - - W_PRECALC_16_31_2 W4 - RR0 F1,B,C,D,E,A,14 - W_PRECALC_16_31_3 W4,14,16 - RR1 F1,B,C,D,E,A,14 - - //i=32 - // W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_32_79_0 W28,W8,W4,W0 - RR0 F1,E,A,B,C,D,16 - W_PRECALC_32_79_1 W16,W0 - RR1 F1,E,A,B,C,D,16 - W_PRECALC_32_79_2 W0 - RR0 F1,C,D,E,A,B,18 - W_PRECALC_32_79_3 W0,18,16 - RR1 F1,C,D,E,A,B,18 - - //i=36 - // W24,W20,W16,W12,W8,W4,W0,W28 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W24,W4,W0,W28 -#else - W_PRECALC_32_79_0_i386 W24,W4,W0,W28 -#endif - RR0 F2,A,B,C,D,E,20 - W_PRECALC_32_79_1 W12,W28 - RR1 F2,A,B,C,D,E,20 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W28 -#else - W_PRECALC_32_79_2_i386 W28 -#endif - RR0 F2,D,E,A,B,C,22 - W_PRECALC_32_79_3 W28,22,16 - RR1 F2,D,E,A,B,C,22 - - //i=40 - #undef K_XMM - #define K_XMM 32 - // W20,W16,W12,W8,W4,W0,W28,W24 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W20,W0,W28,W24 -#else - W_PRECALC_32_79_0_i386 W20,W0,W28,W24 -#endif - RR0 F2,B,C,D,E,A,24 - W_PRECALC_32_79_1 W8,W24 - RR1 F2,B,C,D,E,A,24 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W24 -#else - W_PRECALC_32_79_2_i386 W24 -#endif - RR0 F2,E,A,B,C,D,26 - W_PRECALC_32_79_3 W24,26,K_XMM - RR1 F2,E,A,B,C,D,26 - - //i=44 - // W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_32_79_0 W16,W28,W24,W20 - RR0 F2,C,D,E,A,B,28 - W_PRECALC_32_79_1 W4,W20 - RR1 F2,C,D,E,A,B,28 - W_PRECALC_32_79_2 W20 - RR0 F2,A,B,C,D,E,30 - W_PRECALC_32_79_3 W20,30,K_XMM - RR1 F2,A,B,C,D,E,30 - - //i=48 - // W12,W8,W4,W0,W28,W24,W20,W16 - W_PRECALC_32_79_0 W12,W24,W20,W16 - RR0 F2,D,E,A,B,C,32 - W_PRECALC_32_79_1 W0,W16 - RR1 F2,D,E,A,B,C,32 - W_PRECALC_32_79_2 W16 - RR0 F2,B,C,D,E,A,34 - W_PRECALC_32_79_3 W16,34,K_XMM - RR1 F2,B,C,D,E,A,34 - - //i=52 - // W8,W4,W0,W28,W24,W20,W16,W12 - W_PRECALC_32_79_0 W8,W20,W16,W12 - RR0 F2,E,A,B,C,D,36 - W_PRECALC_32_79_1 W28,W12 - RR1 F2,E,A,B,C,D,36 - W_PRECALC_32_79_2 W12 - RR0 F2,C,D,E,A,B,38 - W_PRECALC_32_79_3 W12,38,K_XMM - RR1 F2,C,D,E,A,B,38 - - //i=56 - // W4,W0,W28,W24,W20,W16,W12,W8 - W_PRECALC_32_79_0 W4,W16,W12,W8 - RR0 F3,A,B,C,D,E,40 - W_PRECALC_32_79_1 W24,W8 - RR1 F3,A,B,C,D,E,40 - W_PRECALC_32_79_2 W8 - RR0 F3,D,E,A,B,C,42 - W_PRECALC_32_79_3 W8,42,K_XMM - RR1 F3,D,E,A,B,C,42 - - //i=60 - #undef K_XMM - #define K_XMM 48 - // W0,W28,W24,W20,W16,W12,W8,W4 - W_PRECALC_32_79_0 W0,W12,W8,W4 - RR0 F3,B,C,D,E,A,44 - W_PRECALC_32_79_1 W20,W4 - RR1 F3,B,C,D,E,A,44 - W_PRECALC_32_79_2 W4 - RR0 F3,E,A,B,C,D,46 - W_PRECALC_32_79_3 W4,46,K_XMM - RR1 F3,E,A,B,C,D,46 - - //i=64 - // W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_32_79_0 W28,W8,W4,W0 - RR0 F3,C,D,E,A,B,48 - W_PRECALC_32_79_1 W16,W0 - RR1 F3,C,D,E,A,B,48 - W_PRECALC_32_79_2 W0 - RR0 F3,A,B,C,D,E,50 - W_PRECALC_32_79_3 W0,50,K_XMM - RR1 F3,A,B,C,D,E,50 - - //i=68 - // W24,W20,W16,W12,W8,W4,W0,W28 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W24,W4,W0,W28 -#else - W_PRECALC_32_79_0_i386 W24,W4,W0,W28 -#endif - RR0 F3,D,E,A,B,C,52 - W_PRECALC_32_79_1 W12,W28 - RR1 F3,D,E,A,B,C,52 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W28 -#else - W_PRECALC_32_79_2_i386 W28 -#endif - RR0 F3,B,C,D,E,A,54 - W_PRECALC_32_79_3 W28,54,K_XMM - RR1 F3,B,C,D,E,A,54 - - //i=72 - // W20,W16,W12,W8,W4,W0,W28,W24 -#if defined (__x86_64__) - W_PRECALC_32_79_0 W20,W0,W28,W24 -#else - W_PRECALC_32_79_0_i386 W20,W0,W28,W24 -#endif - RR0 F3,E,A,B,C,D,56 - W_PRECALC_32_79_1 W8,W24 - RR1 F3,E,A,B,C,D,56 -#if defined (__x86_64__) - W_PRECALC_32_79_2 W24 -#else - W_PRECALC_32_79_2_i386 W24 -#endif - RR0 F3,C,D,E,A,B,58 - W_PRECALC_32_79_3 W24,58,K_XMM - RR1 F3,C,D,E,A,B,58 - - // starting using F4 - - //i=76 - // W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_32_79_0 W16,W28,W24,W20 - RR0 F4,A,B,C,D,E,60 - W_PRECALC_32_79_1 W4,W20 - RR1 F4,A,B,C,D,E,60 - W_PRECALC_32_79_2 W20 - RR0 F4,D,E,A,B,C,62 - W_PRECALC_32_79_3 W20,62,K_XMM - RR1 F4,D,E,A,B,C,62 - - .endm - - .macro SOFTWARE_PIPELINING_nossse3 - // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 - W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) - RR0 F4,B,C,D,E,A,64 - W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP - RR1 F4,B,C,D,E,A,64 - W_PRECALC_00_15_2 // W_TMP = W0 + K - RR0 F4,E,A,B,C,D,66 - W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K - RR1 F4,E,A,B,C,D,66 - - // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 - W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) - RR0 F4,C,D,E,A,B,68 - W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP - RR1 F4,C,D,E,A,B,68 - W_PRECALC_00_15_2 // W_TMP = W28 + K - RR0 F4,A,B,C,D,E,70 - W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K[0] - RR1 F4,A,B,C,D,E,70 - - // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 - W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) - RR0 F4,D,E,A,B,C,72 - W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP - RR1 F4,D,E,A,B,C,72 - W_PRECALC_00_15_2 // W_TMP = W24 + K - RR0 F4,B,C,D,E,A,74 - W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K - RR1 F4,B,C,D,E,A,74 - - // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 - W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) - RR0 F4,E,A,B,C,D,76 - W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP - RR1 F4,E,A,B,C,D,76 - W_PRECALC_00_15_2 // W_TMP = W20 + K - RR0 F4,C,D,E,A,B,78 - W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K - RR1 F4,C,D,E,A,B,78 - .endm - - .macro ENDING // finish up updating hash digests (i=64:79) - //i=80 - RR0 F4,B,C,D,E,A,64 - RR1 F4,B,C,D,E,A,64 - RR0 F4,E,A,B,C,D,66 - RR1 F4,E,A,B,C,D,66 - - //i=84 - RR0 F4,C,D,E,A,B,68 - RR1 F4,C,D,E,A,B,68 - RR0 F4,A,B,C,D,E,70 - RR1 F4,A,B,C,D,E,70 - - //i=88 - RR0 F4,D,E,A,B,C,72 - RR1 F4,D,E,A,B,C,72 - RR0 F4,B,C,D,E,A,74 - RR1 F4,B,C,D,E,A,74 - - //i=92 - RR0 F4,E,A,B,C,D,76 - RR1 F4,E,A,B,C,D,76 - RR0 F4,C,D,E,A,B,78 - RR1 F4,C,D,E,A,B,78 - .endm - - // load hash digests A,B,C,D,E from memory into registers - .macro LOAD_HASH -#if defined (__x86_64__) - mov (HASH_PTR), A - mov 4(HASH_PTR), B - mov 8(HASH_PTR), C - mov 12(HASH_PTR), D - mov 16(HASH_PTR), E -#else - mov HASH_PTR, T1 - mov (T1), A - mov 4(T1), B - mov 8(T1), C - mov 12(T1), D - mov 16(T1), E -#endif - .endm - - .macro UPDATE_HASH - add $0, $1 - mov $1, $0 - .endm - - .macro UPDATE_ALL_HASH -#if defined (__x86_64__) - UPDATE_HASH (HASH_PTR), A - UPDATE_HASH 4(HASH_PTR), B - UPDATE_HASH 8(HASH_PTR), C - UPDATE_HASH 12(HASH_PTR), D - UPDATE_HASH 16(HASH_PTR), E -#else - mov HASH_PTR, T1 - UPDATE_HASH (T1), A - UPDATE_HASH 4(T1), B - UPDATE_HASH 8(T1), C - UPDATE_HASH 12(T1), D - UPDATE_HASH 16(T1), E -#endif - .endm - - - /* - main sha1 code for system without ssse3 support - */ - - .macro SHA1_PIPELINED_MAIN_BODY_nossse3 - LOAD_HASH // load initial hashes into A,B,C,D,E (registers) - INITIAL_W_PRECALC_nossse3 // big_endian_load(W) and W+K (i=0:15) - .align 4,0x90 -0: - INTERNAL_nossse3 // update W (i=16:79) and update ABCDE (i=0:63) -#if Multiple_Blocks - add $$64, BUFFER_PTR // BUFFER_PTR+=64; - sub $$1, cnt // pre-decrement cnt by 1 - jbe 1f // if cnt <= 0, branch to finish off - SOFTWARE_PIPELINING_nossse3 // update ABCDE (i=64:79) || big_endian_load(W) and W+K (i=0:15) - UPDATE_ALL_HASH // update output hashes - jmp 0b // repeat for next block - .align 4,0x90 -1: - #endif - ENDING // update ABCDE (i=64:79) - UPDATE_ALL_HASH // update output hashes - .endm - - /* - main sha1 code for system with ssse3 support -*/ - - .macro SHA1_PIPELINED_MAIN_BODY_ssse3 - LOAD_HASH // load initial hashes into A,B,C,D,E - INITIAL_W_PRECALC_ssse3 // big_endian_load(W) and W+K (i=0:15) - .align 4,0x90 -0: - INTERNAL_ssse3 // update W (i=16:79) and update ABCDE (i=0:63) -#if Multiple_Blocks - add $$64, BUFFER_PTR // BUFFER_PTR+=64; - sub $$1, cnt // pre-decrement cnt by 1 - jbe 1f // if cnt <= 0, branch to finish off - SOFTWARE_PIPELINING_ssse3 // update ABCDE (i=64:79) || big_endian_load(W) and W+K (i=0:15) - UPDATE_ALL_HASH // update output hashes - jmp 0b // repeat for next block - .align 4,0x90 -1: -#endif - ENDING // update ABCDE (i=64:79) - UPDATE_ALL_HASH // update output hashes - .endm - -#if KERNEL -#include -#else -#include -#endif - - .text - - .globl _sha1_block_asm_data_order - .private_extern _sha1_block_asm_data_order -_sha1_block_asm_data_order: - - // detect SSSE3 and dispatch appropriate code branch - #if defined __x86_64__ - movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capabilities - mov (%rax), %eax // %eax = __cpu_capabilities - #else // i386 - #if KERNEL - leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities - mov (%eax), %eax // %eax = __cpu_capabilities - #else - mov _COMM_PAGE_CPU_CAPABILITIES, %eax -#endif - #endif - test $(kHasSupplementalSSE3), %eax - je _SHA1Transform_nossse3 // branch to no-ssse3 code - - // start the sha1 code with ssse3 support - - // save callee-save registers -#if defined (__x86_64__) - push %rbx - push %rbp -#else - push %ebx - push %ebp - push %esi - push %edi -#endif - - sub $stack_size, sp // allocate stack memory for use - - // save used xmm register if this is for kernel -#if KERNEL - xmov %xmm0, 4*16(sp) - xmov %xmm1, 5*16(sp) - xmov %xmm2, 6*16(sp) - xmov %xmm3, 7*16(sp) - xmov %xmm4, 8*16(sp) - xmov %xmm5, 9*16(sp) - xmov %xmm6, 10*16(sp) - xmov %xmm7, 11*16(sp) -#if defined (__x86_64__) - xmov %xmm8, 12*16(sp) - xmov %xmm9, 13*16(sp) - xmov %xmm10, 14*16(sp) -#endif -#endif - -#if defined (__x86_64__) - - // set up registers to free %edx/%edi/%esi for other use (ABCDE) - mov ctx, HASH_PTR - mov buf, BUFFER_PTR -#if Multiple_Blocks - mov %rdx, cnt -#endif - lea K_XMM_AR(%rip), K_BASE - xmov 0x40(K_BASE), XMM_SHUFB_BSWAP - -#else // __i386__ - -#if KERNEL - lea K_XMM_AR, %eax -#else - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: pop %eax // Get program counter. - lea K_XMM_AR-0b(%eax), %eax -#endif - mov %eax, K_BASE - xmov 0x40(%eax), %xmm0 - xmov %xmm0, XMM_SHUFB_BSWAP - -#endif - - SHA1_PIPELINED_MAIN_BODY_ssse3 - - // restore used xmm registers if this is for kernel -#if KERNEL - xmov 4*16(sp), %xmm0 - xmov 5*16(sp), %xmm1 - xmov 6*16(sp), %xmm2 - xmov 7*16(sp), %xmm3 - xmov 8*16(sp), %xmm4 - xmov 9*16(sp), %xmm5 - xmov 10*16(sp), %xmm6 - xmov 11*16(sp), %xmm7 -#if defined (__x86_64__) - xmov 12*16(sp), %xmm8 - xmov 13*16(sp), %xmm9 - xmov 14*16(sp), %xmm10 -#endif -#endif - - add $stack_size, sp // deallocate stack memory - - // restore callee-save registers -#if defined (__x86_64__) - pop %rbp - pop %rbx -#else - pop %edi - pop %esi - pop %ebp - pop %ebx -#endif - - ret // return - - // this is equivalent to the above function _SHA1Transform, but it does not use ssse3 instructions - - .globl _SHA1Transform_nossse3 - .private_extern _SHA1Transform_nossse3 -_SHA1Transform_nossse3: - - // push callee-save registers -#if defined (__x86_64__) - push %rbx - push %rbp -#else - push %ebx - push %ebp - push %esi - push %edi -#endif - - sub $stack_size, sp // allocate stack memory for local use - - // save used xmm registers if this is for kernel -#if KERNEL - xmov %xmm0, 4*16(sp) - xmov %xmm1, 5*16(sp) - xmov %xmm2, 6*16(sp) - xmov %xmm3, 7*16(sp) - xmov %xmm4, 8*16(sp) - xmov %xmm5, 9*16(sp) - xmov %xmm6, 10*16(sp) - xmov %xmm7, 11*16(sp) -#if defined (__x86_64__) - xmov %xmm8, 12*16(sp) - xmov %xmm9, 13*16(sp) -#endif -#endif - -#if defined (__x86_64__) - - // set up registers to free %edx/%edi/%esi for other use (ABCDE) - mov ctx, HASH_PTR - mov buf, BUFFER_PTR -#if Multiple_Blocks - mov %rdx, cnt - #endif - lea K_XMM_AR(%rip), K_BASE - -#else // __i386__ - -#if KERNEL - lea K_XMM_AR, %eax -#else - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: pop %eax // Get program counter. - lea K_XMM_AR-0b(%eax), %eax -#endif - mov %eax, K_BASE - -#endif - - SHA1_PIPELINED_MAIN_BODY_nossse3 - - // restore used xmm registers if this is for kernel -#if KERNEL - xmov 4*16(sp), %xmm0 - xmov 5*16(sp), %xmm1 - xmov 6*16(sp), %xmm2 - xmov 7*16(sp), %xmm3 - xmov 8*16(sp), %xmm4 - xmov 9*16(sp), %xmm5 - xmov 10*16(sp), %xmm6 - xmov 11*16(sp), %xmm7 -#if defined (__x86_64__) - xmov 12*16(sp), %xmm8 - xmov 13*16(sp), %xmm9 - #endif -#endif - - add $stack_size, sp // deallocate stack memory - - // restore callee-save registers -#if defined (__x86_64__) - pop %rbp - pop %rbx -#else - pop %edi - pop %esi - pop %ebp - pop %ebx -#endif - - ret // return - - .const - .align 4, 0x90 - -#define K1 0x5a827999 -#define K2 0x6ed9eba1 -#define K3 0x8f1bbcdc -#define K4 0xca62c1d6 - -K_XMM_AR: - .long K1 - .long K1 - .long K1 - .long K1 - .long K2 - .long K2 - .long K2 - .long K2 - .long K3 - .long K3 - .long K3 - .long K3 - .long K4 - .long K4 - .long K4 - .long K4 -// bswap_shufb_ctl: accessed thru 0x40(K_XMM_AR) - .long 0x00010203 - .long 0x04050607 - .long 0x08090a0b - .long 0x0c0d0e0f - - - -#endif // architecture x86_64 or i386 DELETED Source/Digest/sha2.c Index: Source/Digest/sha2.c ================================================================== --- Source/Digest/sha2.c +++ /dev/null @@ -1,1002 +0,0 @@ -/* - * Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - --------------------------------------------------------------------------- - Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 26/08/2003 - - This is a byte oriented version of SHA2 that operates on arrays of bytes - stored in memory. This code implements sha256, sha384 and sha512 but the - latter two functions rely on efficient 64-bit integer operations that - may not be very efficient on 32-bit machines - - The sha256 functions use a type 'sha256_ctx' to hold details of the - current hash state and uses the following three calls: - - void sha256_begin(sha256_ctx ctx[1]) - void sha256_hash(const unsigned char data[], - unsigned long len, sha256_ctx ctx[1]) - void sha_end1(unsigned char hval[], sha256_ctx ctx[1]) - - The first subroutine initialises a hash computation by setting up the - context in the sha256_ctx context. The second subroutine hashes 8-bit - bytes from array data[] into the hash state withinh sha256_ctx context, - the number of bytes to be hashed being given by the the unsigned long - integer len. The third subroutine completes the hash calculation and - places the resulting digest value in the array of 8-bit bytes hval[]. - - The sha384 and sha512 functions are similar and use the interfaces: - - void sha384_begin(sha384_ctx ctx[1]); - void sha384_hash(const unsigned char data[], - unsigned long len, sha384_ctx ctx[1]); - void sha384_end(unsigned char hval[], sha384_ctx ctx[1]); - - void sha512_begin(sha512_ctx ctx[1]); - void sha512_hash(const unsigned char data[], - unsigned long len, sha512_ctx ctx[1]); - void sha512_end(unsigned char hval[], sha512_ctx ctx[1]); - - In addition there is a function sha2 that can be used to call all these - functions using a call with a hash length parameter as follows: - - int sha2_begin(unsigned long len, sha2_ctx ctx[1]); - void sha2_hash(const unsigned char data[], - unsigned long len, sha2_ctx ctx[1]); - void sha2_end(unsigned char hval[], sha2_ctx ctx[1]); - - My thanks to Erik Andersen for testing this code - on big-endian systems and for his assistance with corrections -*/ - -/* - * Apple: Measurements indicate that we get both smaller code size and faster - * performance when compiling this file with -O1 than with either -O3 or -Os. - * - * -O1 - * sha2.o 18652 bytes of text - * 7.509 seconds to digest 100000000 bytes with SHA512 - * - * -Os - * sha2.o 19552 bytes of text - * 8.693 seconds to process 100000000 bytes - * - * -O3 - * sha2.o 20452 bytes of text - * 8.535 seconds to process 100000000 bytes - * - * #defining UNROOL_SHA2 leads to no noticable improvement. - */ -#include "sha2Priv.h" /* Apple Common Digest version */ - -/* define the hash functions that you need */ - -#ifndef _APPLE_COMMON_CRYPTO_ -#define SHA_2 /* for dynamic hash length */ -#endif /* _APPLE_COMMON_CRYPTO_ */ -#define SHA_224 -#define SHA_256 -#define SHA_384 -#define SHA_512 - -#if 0 -#define UNROLL_SHA2 /* for SHA2 loop unroll */ -#endif - -#include /* for memcpy() etc. */ -#include /* for _lrotr with VC++ */ - -/* #include "sha2.h" */ - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* PLATFORM SPECIFIC INCLUDES AND BYTE ORDER IN 32-BIT WORDS - - To obtain the highest speed on processors with 32-bit words, this code - needs to determine the byte order of the target machine. The following - block of code is an attempt to capture the most obvious ways in which - various environemnts define byte order. It may well fail, in which case - the definitions will need to be set by editing at the points marked - **** EDIT HERE IF NECESSARY **** below. My thanks go to Peter Gutmann - for his assistance with this endian detection nightmare. -*/ - -#define BRG_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ -#define BRG_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ - -#if defined(__GNUC__) || defined(__GNU_LIBRARY__) -# if defined(__FreeBSD__) || defined(__OpenBSD__) -# include -# elif defined( BSD ) && ( BSD >= 199103 ) -# include -# elif defined(__APPLE__) -# if defined(__BIG_ENDIAN__) && !defined( BIG_ENDIAN ) -# define BIG_ENDIAN -# elif defined(__LITTLE_ENDIAN__) && !defined( LITTLE_ENDIAN ) -# define LITTLE_ENDIAN -# endif -# else -# include -# if !defined(__BEOS__) -# include -# endif -# endif -#endif - -#if !defined(PLATFORM_BYTE_ORDER) -# if defined(LITTLE_ENDIAN) || defined(BIG_ENDIAN) -# if defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif !defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# elif defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# endif -# elif defined(_LITTLE_ENDIAN) || defined(_BIG_ENDIAN) -# if defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif !defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# elif defined(_BYTE_ORDER) && (_BYTE_ORDER == _LITTLE_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# endif -# elif defined(__LITTLE_ENDIAN__) || defined(__BIG_ENDIAN__) -# if defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif !defined(__LITTLE_ENDIAN__) && defined(__BIG_ENDIAN__) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __LITTLE_ENDIAN__) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -# elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -# endif -# endif -#endif - -/* if the platform is still unknown, try to find its byte order */ -/* from commonly used machine defines */ - -#if !defined(PLATFORM_BYTE_ORDER) - -#if defined( __alpha__ ) || defined( __alpha ) || defined( i386 ) || \ - defined( __i386__ ) || defined( _M_I86 ) || defined( _M_IX86 ) || \ - defined( __OS2__ ) || defined( sun386 ) || defined( __TURBOC__ ) || \ - defined( vax ) || defined( vms ) || defined( VMS ) || \ - defined( __VMS ) || defined(__x86_64__) -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN - -#elif defined( AMIGA ) || defined( applec ) || defined( __AS400__ ) || \ - defined( _CRAY ) || defined( __hppa ) || defined( __hp9000 ) || \ - defined( ibm370 ) || defined( mc68000 ) || defined( m68k ) || \ - defined( __MRC__ ) || defined( __MVS__ ) || defined( __MWERKS__ ) || \ - defined( sparc ) || defined( __sparc) || defined( SYMANTEC_C ) || \ - defined( __TANDEM ) || defined( THINK_C ) || defined( __VMCMS__ ) -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN - -#elif 0 /* **** EDIT HERE IF NECESSARY **** */ -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -#elif 0 /* **** EDIT HERE IF NECESSARY **** */ -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -#else -# error Please edit sha2.c (line 184 or 186) to set the platform byte order -#endif - -#endif - -#ifdef _MSC_VER -#pragma intrinsic(memcpy) -#endif - -#if 0 && defined(_MSC_VER) -#define rotl32 _lrotl -#define rotr32 _lrotr -#else -#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) -#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) -#endif - -#if !defined(bswap_32) -#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) -#endif - -#if (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN) -#define SWAP_BYTES -#else -#undef SWAP_BYTES -#endif - -#if 0 - -#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z))) -#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - -#else /* Thanks to Rich Schroeppel and Colin Plumb for the following */ - -#define ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) -#define maj(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y)))) - -#endif - -/* round transforms for SHA256 and SHA512 compression functions */ - -#define vf(n,i) v[(n - i) & 7] - -#define hf(i) (p[i & 15] += \ - g_1(p[(i + 14) & 15]) + p[(i + 9) & 15] + g_0(p[(i + 1) & 15])) - -#define v_cycle(i,j) \ - vf(7,i) += (j ? hf(i) : p[i]) + k_0[i+j] \ - + s_1(vf(4,i)) + ch(vf(4,i),vf(5,i),vf(6,i)); \ - vf(3,i) += vf(7,i); \ - vf(7,i) += s_0(vf(0,i))+ maj(vf(0,i),vf(1,i),vf(2,i)) - -#if defined(SHA_224) || defined(SHA_256) - -#define SHA256_MASK (SHA256_BLOCK_SIZE - 1) - -#if defined(SWAP_BYTES) -#define bsw_32(p,n) \ - { int _i = (n); while(_i--) ((sha2_32t*)p)[_i] = bswap_32(((sha2_32t*)p)[_i]); } -#else -#define bsw_32(p,n) -#endif - -#define s_0(x) (rotr32((x), 2) ^ rotr32((x), 13) ^ rotr32((x), 22)) -#define s_1(x) (rotr32((x), 6) ^ rotr32((x), 11) ^ rotr32((x), 25)) -#define g_0(x) (rotr32((x), 7) ^ rotr32((x), 18) ^ ((x) >> 3)) -#define g_1(x) (rotr32((x), 17) ^ rotr32((x), 19) ^ ((x) >> 10)) -#define k_0 k256 - -/* rotated SHA256 round definition. Rather than swapping variables as in */ -/* FIPS-180, different variables are 'rotated' on each round, returning */ -/* to their starting positions every eight rounds */ - -#define q(n) v##n - -#define one_cycle(a,b,c,d,e,f,g,h,k,w) \ - q(h) += s_1(q(e)) + ch(q(e), q(f), q(g)) + k + w; \ - q(d) += q(h); q(h) += s_0(q(a)) + maj(q(a), q(b), q(c)) - -/* SHA256 mixing data */ -#if defined (SHA256_USE_ASSEMBLY) && (defined(__x86_64__) || defined(__i386__)) - const sha2_32t K256[64] = -#else -static const sha2_32t k256[64] = -#endif -{ 0x428a2f98ul, 0x71374491ul, 0xb5c0fbcful, 0xe9b5dba5ul, - 0x3956c25bul, 0x59f111f1ul, 0x923f82a4ul, 0xab1c5ed5ul, - 0xd807aa98ul, 0x12835b01ul, 0x243185beul, 0x550c7dc3ul, - 0x72be5d74ul, 0x80deb1feul, 0x9bdc06a7ul, 0xc19bf174ul, - 0xe49b69c1ul, 0xefbe4786ul, 0x0fc19dc6ul, 0x240ca1ccul, - 0x2de92c6ful, 0x4a7484aaul, 0x5cb0a9dcul, 0x76f988daul, - 0x983e5152ul, 0xa831c66dul, 0xb00327c8ul, 0xbf597fc7ul, - 0xc6e00bf3ul, 0xd5a79147ul, 0x06ca6351ul, 0x14292967ul, - 0x27b70a85ul, 0x2e1b2138ul, 0x4d2c6dfcul, 0x53380d13ul, - 0x650a7354ul, 0x766a0abbul, 0x81c2c92eul, 0x92722c85ul, - 0xa2bfe8a1ul, 0xa81a664bul, 0xc24b8b70ul, 0xc76c51a3ul, - 0xd192e819ul, 0xd6990624ul, 0xf40e3585ul, 0x106aa070ul, - 0x19a4c116ul, 0x1e376c08ul, 0x2748774cul, 0x34b0bcb5ul, - 0x391c0cb3ul, 0x4ed8aa4aul, 0x5b9cca4ful, 0x682e6ff3ul, - 0x748f82eeul, 0x78a5636ful, 0x84c87814ul, 0x8cc70208ul, - 0x90befffaul, 0xa4506cebul, 0xbef9a3f7ul, 0xc67178f2ul, -}; - -/* Compile 64 bytes of hash data into SHA256 digest value */ -/* NOTE: this routine assumes that the byte order in the */ -/* ctx->wbuf[] at this point is such that low address bytes */ -/* in the ORIGINAL byte stream will go into the high end of */ -/* words on BOTH big and little endian systems */ - -#if defined (SHA256_USE_ASSEMBLY) && (defined(__x86_64__) || defined(__i386__)) -extern sha2_void sha256_compile(sha256_ctx ctx[1]); -#else -static sha2_void sha256_compile(sha256_ctx ctx[1]) -{ -#if !defined(UNROLL_SHA2) - - sha2_32t j, *p = ctx->wbuf, v[8]; - - memcpy(v, ctx->hash, 8 * sizeof(sha2_32t)); - - for(j = 0; j < 64; j += 16) - { - v_cycle( 0, j); v_cycle( 1, j); - v_cycle( 2, j); v_cycle( 3, j); - v_cycle( 4, j); v_cycle( 5, j); - v_cycle( 6, j); v_cycle( 7, j); - v_cycle( 8, j); v_cycle( 9, j); - v_cycle(10, j); v_cycle(11, j); - v_cycle(12, j); v_cycle(13, j); - v_cycle(14, j); v_cycle(15, j); - } - - ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; - ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; - ctx->hash[4] += v[4]; ctx->hash[5] += v[5]; - ctx->hash[6] += v[6]; ctx->hash[7] += v[7]; - -#else - - sha2_32t *p = ctx->wbuf,v0,v1,v2,v3,v4,v5,v6,v7; - - v0 = ctx->hash[0]; v1 = ctx->hash[1]; - v2 = ctx->hash[2]; v3 = ctx->hash[3]; - v4 = ctx->hash[4]; v5 = ctx->hash[5]; - v6 = ctx->hash[6]; v7 = ctx->hash[7]; - - one_cycle(0,1,2,3,4,5,6,7,k256[ 0],p[ 0]); - one_cycle(7,0,1,2,3,4,5,6,k256[ 1],p[ 1]); - one_cycle(6,7,0,1,2,3,4,5,k256[ 2],p[ 2]); - one_cycle(5,6,7,0,1,2,3,4,k256[ 3],p[ 3]); - one_cycle(4,5,6,7,0,1,2,3,k256[ 4],p[ 4]); - one_cycle(3,4,5,6,7,0,1,2,k256[ 5],p[ 5]); - one_cycle(2,3,4,5,6,7,0,1,k256[ 6],p[ 6]); - one_cycle(1,2,3,4,5,6,7,0,k256[ 7],p[ 7]); - one_cycle(0,1,2,3,4,5,6,7,k256[ 8],p[ 8]); - one_cycle(7,0,1,2,3,4,5,6,k256[ 9],p[ 9]); - one_cycle(6,7,0,1,2,3,4,5,k256[10],p[10]); - one_cycle(5,6,7,0,1,2,3,4,k256[11],p[11]); - one_cycle(4,5,6,7,0,1,2,3,k256[12],p[12]); - one_cycle(3,4,5,6,7,0,1,2,k256[13],p[13]); - one_cycle(2,3,4,5,6,7,0,1,k256[14],p[14]); - one_cycle(1,2,3,4,5,6,7,0,k256[15],p[15]); - - one_cycle(0,1,2,3,4,5,6,7,k256[16],hf( 0)); - one_cycle(7,0,1,2,3,4,5,6,k256[17],hf( 1)); - one_cycle(6,7,0,1,2,3,4,5,k256[18],hf( 2)); - one_cycle(5,6,7,0,1,2,3,4,k256[19],hf( 3)); - one_cycle(4,5,6,7,0,1,2,3,k256[20],hf( 4)); - one_cycle(3,4,5,6,7,0,1,2,k256[21],hf( 5)); - one_cycle(2,3,4,5,6,7,0,1,k256[22],hf( 6)); - one_cycle(1,2,3,4,5,6,7,0,k256[23],hf( 7)); - one_cycle(0,1,2,3,4,5,6,7,k256[24],hf( 8)); - one_cycle(7,0,1,2,3,4,5,6,k256[25],hf( 9)); - one_cycle(6,7,0,1,2,3,4,5,k256[26],hf(10)); - one_cycle(5,6,7,0,1,2,3,4,k256[27],hf(11)); - one_cycle(4,5,6,7,0,1,2,3,k256[28],hf(12)); - one_cycle(3,4,5,6,7,0,1,2,k256[29],hf(13)); - one_cycle(2,3,4,5,6,7,0,1,k256[30],hf(14)); - one_cycle(1,2,3,4,5,6,7,0,k256[31],hf(15)); - - one_cycle(0,1,2,3,4,5,6,7,k256[32],hf( 0)); - one_cycle(7,0,1,2,3,4,5,6,k256[33],hf( 1)); - one_cycle(6,7,0,1,2,3,4,5,k256[34],hf( 2)); - one_cycle(5,6,7,0,1,2,3,4,k256[35],hf( 3)); - one_cycle(4,5,6,7,0,1,2,3,k256[36],hf( 4)); - one_cycle(3,4,5,6,7,0,1,2,k256[37],hf( 5)); - one_cycle(2,3,4,5,6,7,0,1,k256[38],hf( 6)); - one_cycle(1,2,3,4,5,6,7,0,k256[39],hf( 7)); - one_cycle(0,1,2,3,4,5,6,7,k256[40],hf( 8)); - one_cycle(7,0,1,2,3,4,5,6,k256[41],hf( 9)); - one_cycle(6,7,0,1,2,3,4,5,k256[42],hf(10)); - one_cycle(5,6,7,0,1,2,3,4,k256[43],hf(11)); - one_cycle(4,5,6,7,0,1,2,3,k256[44],hf(12)); - one_cycle(3,4,5,6,7,0,1,2,k256[45],hf(13)); - one_cycle(2,3,4,5,6,7,0,1,k256[46],hf(14)); - one_cycle(1,2,3,4,5,6,7,0,k256[47],hf(15)); - - one_cycle(0,1,2,3,4,5,6,7,k256[48],hf( 0)); - one_cycle(7,0,1,2,3,4,5,6,k256[49],hf( 1)); - one_cycle(6,7,0,1,2,3,4,5,k256[50],hf( 2)); - one_cycle(5,6,7,0,1,2,3,4,k256[51],hf( 3)); - one_cycle(4,5,6,7,0,1,2,3,k256[52],hf( 4)); - one_cycle(3,4,5,6,7,0,1,2,k256[53],hf( 5)); - one_cycle(2,3,4,5,6,7,0,1,k256[54],hf( 6)); - one_cycle(1,2,3,4,5,6,7,0,k256[55],hf( 7)); - one_cycle(0,1,2,3,4,5,6,7,k256[56],hf( 8)); - one_cycle(7,0,1,2,3,4,5,6,k256[57],hf( 9)); - one_cycle(6,7,0,1,2,3,4,5,k256[58],hf(10)); - one_cycle(5,6,7,0,1,2,3,4,k256[59],hf(11)); - one_cycle(4,5,6,7,0,1,2,3,k256[60],hf(12)); - one_cycle(3,4,5,6,7,0,1,2,k256[61],hf(13)); - one_cycle(2,3,4,5,6,7,0,1,k256[62],hf(14)); - one_cycle(1,2,3,4,5,6,7,0,k256[63],hf(15)); - - ctx->hash[0] += v0; ctx->hash[1] += v1; - ctx->hash[2] += v2; ctx->hash[3] += v3; - ctx->hash[4] += v4; ctx->hash[5] += v5; - ctx->hash[6] += v6; ctx->hash[7] += v7; -#endif -} -#endif // SHA256_USE_ASSEMBLY - -/* SHA256 hash data in an array of bytes into hash buffer */ -/* and call the hash_compile function as required. */ -#ifdef _APPLE_COMMON_CRYPTO_ -int CC_SHA256_Update(CC_SHA256_CTX *ctx, const void *data, CC_LONG len) -#else -sha2_void sha256_hash(const unsigned char data[], unsigned long len, sha256_ctx ctx[1]) -#endif /* _APPLE_COMMON_CRYPTO_ */ -{ sha2_32t pos = (sha2_32t)(ctx->count[0] & SHA256_MASK), - space = SHA256_BLOCK_SIZE - pos; - const unsigned char *sp = data; - - if((ctx->count[0] += len) < len) - ++(ctx->count[1]); - - while(len >= space) /* tranfer whole blocks while possible */ - { - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); - sp += space; len -= space; space = SHA256_BLOCK_SIZE; pos = 0; - bsw_32(ctx->wbuf, SHA256_BLOCK_SIZE >> 2) - sha256_compile(ctx); - } - - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); - return 1; -} - -/* SHA256 Final padding and digest calculation */ - -static sha2_void sha_end1(unsigned char hval[], sha256_ctx ctx[1], const unsigned int hlen) -{ sha2_32t i = (sha2_32t)(ctx->count[0] & SHA256_MASK); - - /* put bytes in the buffer in an order in which references to */ - /* 32-bit words will put bytes with lower addresses into the */ - /* top of 32 bit words on BOTH big and little endian machines */ - bsw_32(ctx->wbuf, (i + 3) >> 2) - - /* we now need to mask valid bytes and add the padding which is */ - /* a single 1 bit and as many zero bits as necessary. Note that */ - /* we can always add the first padding byte here because the */ - /* buffer always has at least one empty slot */ - ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3); - ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3); - - /* we need 9 or more empty positions, one for the padding byte */ - /* (above) and eight for the length count. If there is not */ - /* enough space pad and empty the buffer */ - if(i > SHA256_BLOCK_SIZE - 9) - { - if(i < 60) ctx->wbuf[15] = 0; - sha256_compile(ctx); - i = 0; - } - else /* compute a word index for the empty buffer positions */ - i = (i >> 2) + 1; - - while(i < 14) /* and zero pad all but last two positions */ - ctx->wbuf[i++] = 0; - - /* the following 32-bit length fields are assembled in the */ - /* wrong byte order on little endian machines but this is */ - /* corrected later since they are only ever used as 32-bit */ - /* word values. */ - ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29); - ctx->wbuf[15] = ctx->count[0] << 3; - sha256_compile(ctx); - - /* extract the hash value as bytes in case the hash buffer is */ - /* mislaigned for 32-bit words */ - for(i = 0; i < hlen; ++i) - hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3))); -} - -#endif - -#if defined(SHA_224) - -const sha2_32t i224[8] = -{ - 0xc1059ed8ul, 0x367cd507ul, 0x3070dd17ul, 0xf70e5939ul, - 0xffc00b31ul, 0x68581511ul, 0x64f98fa7ul, 0xbefa4fa4ul -}; - -#ifdef _APPLE_COMMON_CRYPTO_ -int sha224_begin(sha256_ctx ctx[1]) -#else -sha2_void sha224_begin(sha256_ctx ctx[1]) -#endif -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i224, 8 * sizeof(sha2_32t)); - return 1; -} - -#ifdef _APPLE_COMMON_CRYPTO_ -int sha224_end(unsigned char hval[], sha256_ctx ctx[1]) -#else -sha2_void sha224_end(unsigned char hval[], sha256_ctx ctx[1]) -#endif -{ - sha_end1(hval, ctx, SHA224_DIGEST_SIZE); - return 1; -} - -#ifndef _APPLE_COMMON_CRYPTO_ -sha2_void sha224(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha224_ctx cx[1]; - - sha224_begin(cx); - sha224_hash(data, len, cx); - sha_end1(hval, cx, SHA224_DIGEST_SIZE); -} -#endif /* _APPLE_COMMON_CRYPTO_ */ - -/* provide an actual entry for this instead of #defining it */ -extern int CC_SHA224_Update(CC_SHA256_CTX *c, const void *data, CC_LONG len) -{ - return CC_SHA256_Update(c, data, len); -} - -#endif /* SHA_224 */ - -#if defined(SHA_256) - -static const sha2_32t i256[8] = -{ - 0x6a09e667ul, 0xbb67ae85ul, 0x3c6ef372ul, 0xa54ff53aul, - 0x510e527ful, 0x9b05688cul, 0x1f83d9abul, 0x5be0cd19ul -}; - -int sha256_begin(sha256_ctx ctx[1]) -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i256, 8 * sizeof(sha2_32t)); - return 1; -} - -int sha256_end(unsigned char hval[], sha256_ctx ctx[1]) -{ - sha_end1(hval, ctx, SHA256_DIGEST_SIZE); - return 1; -} - -#ifndef _APPLE_COMMON_CRYPTO_ -sha2_void sha256(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha256_ctx cx[1]; - - sha256_begin(cx); - sha256_hash(data, len, cx); - sha_end1(hval, cx, SHA256_DIGEST_SIZE); -} -#endif /* _APPLE_COMMON_CRYPTO_ */ - -#endif - -#if defined(SHA_384) || defined(SHA_512) - -#define SHA512_MASK (SHA512_BLOCK_SIZE - 1) - -#define rotr64(x,n) (((x) >> n) | ((x) << (64 - n))) - -#if !defined(bswap_64) -#define bswap_64(x) (((sha2_64t)(bswap_32((sha2_32t)(x)))) << 32 | bswap_32((sha2_32t)((x) >> 32))) -#endif - -#if defined(SWAP_BYTES) -#define bsw_64(p,n) \ - { int _i = (n); while(_i--) ((sha2_64t*)p)[_i] = bswap_64(((sha2_64t*)p)[_i]); } -#else -#define bsw_64(p,n) -#endif - -/* SHA512 mixing function definitions */ - -#ifdef s_0 -# undef s_0 -# undef s_1 -# undef g_0 -# undef g_1 -# undef k_0 -#endif - -#define s_0(x) (rotr64((x), 28) ^ rotr64((x), 34) ^ rotr64((x), 39)) -#define s_1(x) (rotr64((x), 14) ^ rotr64((x), 18) ^ rotr64((x), 41)) -#define g_0(x) (rotr64((x), 1) ^ rotr64((x), 8) ^ ((x) >> 7)) -#define g_1(x) (rotr64((x), 19) ^ rotr64((x), 61) ^ ((x) >> 6)) -#define k_0 k512 - -/* SHA384/SHA512 mixing data */ - -static const sha2_64t k512[80] = -{ - 0x428a2f98d728ae22ull, 0x7137449123ef65cdull, - 0xb5c0fbcfec4d3b2full, 0xe9b5dba58189dbbcull, - 0x3956c25bf348b538ull, 0x59f111f1b605d019ull, - 0x923f82a4af194f9bull, 0xab1c5ed5da6d8118ull, - 0xd807aa98a3030242ull, 0x12835b0145706fbeull, - 0x243185be4ee4b28cull, 0x550c7dc3d5ffb4e2ull, - 0x72be5d74f27b896full, 0x80deb1fe3b1696b1ull, - 0x9bdc06a725c71235ull, 0xc19bf174cf692694ull, - 0xe49b69c19ef14ad2ull, 0xefbe4786384f25e3ull, - 0x0fc19dc68b8cd5b5ull, 0x240ca1cc77ac9c65ull, - 0x2de92c6f592b0275ull, 0x4a7484aa6ea6e483ull, - 0x5cb0a9dcbd41fbd4ull, 0x76f988da831153b5ull, - 0x983e5152ee66dfabull, 0xa831c66d2db43210ull, - 0xb00327c898fb213full, 0xbf597fc7beef0ee4ull, - 0xc6e00bf33da88fc2ull, 0xd5a79147930aa725ull, - 0x06ca6351e003826full, 0x142929670a0e6e70ull, - 0x27b70a8546d22ffcull, 0x2e1b21385c26c926ull, - 0x4d2c6dfc5ac42aedull, 0x53380d139d95b3dfull, - 0x650a73548baf63deull, 0x766a0abb3c77b2a8ull, - 0x81c2c92e47edaee6ull, 0x92722c851482353bull, - 0xa2bfe8a14cf10364ull, 0xa81a664bbc423001ull, - 0xc24b8b70d0f89791ull, 0xc76c51a30654be30ull, - 0xd192e819d6ef5218ull, 0xd69906245565a910ull, - 0xf40e35855771202aull, 0x106aa07032bbd1b8ull, - 0x19a4c116b8d2d0c8ull, 0x1e376c085141ab53ull, - 0x2748774cdf8eeb99ull, 0x34b0bcb5e19b48a8ull, - 0x391c0cb3c5c95a63ull, 0x4ed8aa4ae3418acbull, - 0x5b9cca4f7763e373ull, 0x682e6ff3d6b2b8a3ull, - 0x748f82ee5defb2fcull, 0x78a5636f43172f60ull, - 0x84c87814a1f0ab72ull, 0x8cc702081a6439ecull, - 0x90befffa23631e28ull, 0xa4506cebde82bde9ull, - 0xbef9a3f7b2c67915ull, 0xc67178f2e372532bull, - 0xca273eceea26619cull, 0xd186b8c721c0c207ull, - 0xeada7dd6cde0eb1eull, 0xf57d4f7fee6ed178ull, - 0x06f067aa72176fbaull, 0x0a637dc5a2c898a6ull, - 0x113f9804bef90daeull, 0x1b710b35131c471bull, - 0x28db77f523047d84ull, 0x32caab7b40c72493ull, - 0x3c9ebe0a15c9bebcull, 0x431d67c49c100d4cull, - 0x4cc5d4becb3e42b6ull, 0x597f299cfc657e2aull, - 0x5fcb6fab3ad6faecull, 0x6c44198c4a475817ull -}; - -/* Compile 128 bytes of hash data into SHA384/512 digest */ -/* NOTE: this routine assumes that the byte order in the */ -/* ctx->wbuf[] at this point is such that low address bytes */ -/* in the ORIGINAL byte stream will go into the high end of */ -/* words on BOTH big and little endian systems */ - -static sha2_void sha512_compile(sha512_ctx ctx[1]) -{ sha2_64t v[8], *p = ctx->wbuf; - sha2_32t j; - - memcpy(v, ctx->hash, 8 * sizeof(sha2_64t)); - - for(j = 0; j < 80; j += 16) - { - v_cycle( 0, j); v_cycle( 1, j); - v_cycle( 2, j); v_cycle( 3, j); - v_cycle( 4, j); v_cycle( 5, j); - v_cycle( 6, j); v_cycle( 7, j); - v_cycle( 8, j); v_cycle( 9, j); - v_cycle(10, j); v_cycle(11, j); - v_cycle(12, j); v_cycle(13, j); - v_cycle(14, j); v_cycle(15, j); - } - - ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; - ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; - ctx->hash[4] += v[4]; ctx->hash[5] += v[5]; - ctx->hash[6] += v[6]; ctx->hash[7] += v[7]; -} - -/* Compile 128 bytes of hash data into SHA256 digest value */ -/* NOTE: this routine assumes that the byte order in the */ -/* ctx->wbuf[] at this point is in such an order that low */ -/* address bytes in the ORIGINAL byte stream placed in this */ -/* buffer will now go to the high end of words on BOTH big */ -/* and little endian systems */ - -#ifdef _APPLE_COMMON_CRYPTO_ -int CC_SHA512_Update(CC_SHA512_CTX *ctx, const void *data, CC_LONG len) -#else -sha2_void sha512_hash(const unsigned char data[], unsigned long len, sha512_ctx ctx[1]) -#endif -{ sha2_32t pos = (sha2_32t)(ctx->count[0] & SHA512_MASK), - space = SHA512_BLOCK_SIZE - pos; - const unsigned char *sp = data; - - if((ctx->count[0] += len) < len) - ++(ctx->count[1]); - - while(len >= space) /* tranfer whole blocks while possible */ - { - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); - sp += space; len -= space; space = SHA512_BLOCK_SIZE; pos = 0; - bsw_64(ctx->wbuf, SHA512_BLOCK_SIZE >> 3); - sha512_compile(ctx); - } - - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); - return 1; -} - -/* SHA384/512 Final padding and digest calculation */ - -static void sha_end2(unsigned char hval[], sha512_ctx ctx[1], const unsigned int hlen) -{ sha2_32t i = (sha2_32t)(ctx->count[0] & SHA512_MASK); - - /* put bytes in the buffer in an order in which references to */ - /* 32-bit words will put bytes with lower addresses into the */ - /* top of 32 bit words on BOTH big and little endian machines */ - bsw_64(ctx->wbuf, (i + 7) >> 3); - - /* we now need to mask valid bytes and add the padding which is */ - /* a single 1 bit and as many zero bits as necessary. Note that */ - /* we can always add the first padding byte here because the */ - /* buffer always has at least one empty slot */ - ctx->wbuf[i >> 3] &= 0xffffffffffffff00ull << 8 * (~i & 7); - ctx->wbuf[i >> 3] |= 0x0000000000000080ull << 8 * (~i & 7); - - /* we need 17 or more empty byte positions, one for the padding */ - /* byte (above) and sixteen for the length count. If there is */ - /* not enough space pad and empty the buffer */ - if(i > SHA512_BLOCK_SIZE - 17) - { - if(i < 120) ctx->wbuf[15] = 0; - sha512_compile(ctx); - i = 0; - } - else - i = (i >> 3) + 1; - - while(i < 14) - ctx->wbuf[i++] = 0; - - /* the following 64-bit length fields are assembled in the */ - /* wrong byte order on little endian machines but this is */ - /* corrected later since they are only ever used as 64-bit */ - /* word values. */ - ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 61); - ctx->wbuf[15] = ctx->count[0] << 3; - sha512_compile(ctx); - - /* extract the hash value as bytes in case the hash buffer is */ - /* misaligned for 32-bit words */ - for(i = 0; i < hlen; ++i) - hval[i] = (unsigned char)(ctx->hash[i >> 3] >> (8 * (~i & 7))); -} - -#endif - -#if defined(SHA_384) - -/* SHA384 initialisation data */ - -static const sha2_64t i384[80] = -{ - 0xcbbb9d5dc1059ed8ull, 0x629a292a367cd507ull, - 0x9159015a3070dd17ull, 0x152fecd8f70e5939ull, - 0x67332667ffc00b31ull, 0x8eb44a8768581511ull, - 0xdb0c2e0d64f98fa7ull, 0x47b5481dbefa4fa4ull -}; - -#ifdef _APPLE_COMMON_CRYPTO_ -int sha384_begin(sha384_ctx *ctx) -#else -sha2_void sha384_begin(sha384_ctx ctx[1]) -#endif -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i384, 8 * sizeof(sha2_64t)); - return 1; -} - -#ifdef _APPLE_COMMON_CRYPTO_ -int sha384_end(unsigned char *hval, sha384_ctx *ctx) -#else -sha2_void sha384_end(unsigned char hval[], sha384_ctx ctx[1]) -#endif -{ - sha_end2(hval, ctx, SHA384_DIGEST_SIZE); - return 1; -} - -/* provide an actual entry for this instead of #defining it */ -extern int CC_SHA384_Update(CC_SHA512_CTX *c, const void *data, CC_LONG len) -{ - return CC_SHA512_Update(c, data, len); -} - - -#ifndef _APPLE_COMMON_CRYPTO_ -sha2_void sha384(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha384_ctx cx[1]; - - sha384_begin(cx); - sha384_hash(data, len, cx); - sha_end2(hval, cx, SHA384_DIGEST_SIZE); -} -#endif /* _APPLE_COMMON_CRYPTO_ */ -#endif - -#if defined(SHA_512) - -/* SHA512 initialisation data */ - -static const sha2_64t i512[80] = -{ - 0x6a09e667f3bcc908ull, 0xbb67ae8584caa73bull, - 0x3c6ef372fe94f82bull, 0xa54ff53a5f1d36f1ull, - 0x510e527fade682d1ull, 0x9b05688c2b3e6c1full, - 0x1f83d9abfb41bd6bull, 0x5be0cd19137e2179ull -}; - -#ifdef _APPLE_COMMON_CRYPTO_ -int sha512_begin(sha512_ctx *ctx) -#else -sha2_void sha512_begin(sha512_ctx ctx[1]) -#endif -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i512, 8 * sizeof(sha2_64t)); - return 1; -} - -#ifdef _APPLE_COMMON_CRYPTO_ -int sha512_end(unsigned char *hval, sha512_ctx *ctx) -#else -sha2_void sha512_end(unsigned char hval[], sha512_ctx ctx[1]) -#endif -{ - sha_end2(hval, ctx, SHA512_DIGEST_SIZE); - return 1; -} - -#ifndef _APPLE_COMMON_CRYPTO_ -sha2_void sha512(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha512_ctx cx[1]; - - sha512_begin(cx); - sha512_hash(data, len, cx); - sha_end2(hval, cx, SHA512_DIGEST_SIZE); -} -#endif /* _APPLE_COMMON_CRYPTO_ */ - -#endif - -#if defined(SHA_2) - -#define CTX_224(x) ((x)->uu->ctx256) -#define CTX_256(x) ((x)->uu->ctx256) -#define CTX_384(x) ((x)->uu->ctx512) -#define CTX_512(x) ((x)->uu->ctx512) - -/* SHA2 initialisation */ - -sha2_int sha2_begin(unsigned long len, sha2_ctx ctx[1]) -{ unsigned long l = len; - switch(len) - { -#if defined(SHA224) - case 224: - case 28: CTX_256(ctx)->count[0] = CTX_256(ctx)->count[1] = 0; - memcpy(CTX_256(ctx)->hash, i224, 32); - ctx->sha2_len = 28; return SHA2_GOOD; -#endif -#if defined(SHA256) - case 256: - case 32: CTX_256(ctx)->count[0] = CTX_256(ctx)->count[1] = 0; - memcpy(CTX_256(ctx)->hash, i256, 32); - ctx->sha2_len = 32; return SHA2_GOOD; -#endif -#if defined(SHA384) - case 384: - case 48: CTX_384(ctx)->count[0] = CTX_384(ctx)->count[1] = 0; - memcpy(CTX_384(ctx)->hash, i384, 64); - ctx->sha2_len = 48; return SHA2_GOOD; -#endif -#if defined(SHA512) - case 512: - case 64: CTX_512(ctx)->count[0] = CTX_512(ctx)->count[1] = 0; - memcpy(CTX_512(ctx)->hash, i512, 64); - ctx->sha2_len = 64; return SHA2_GOOD; -#endif - default: return SHA2_BAD; - } -} - -sha2_void sha2_hash(const unsigned char data[], unsigned long len, sha2_ctx ctx[1]) -{ - switch(ctx->sha2_len) - { -#if defined(SHA224) - case 28: sha224_hash(data, len, CTX_224(ctx)); return; -#endif -#if defined(SHA256) - case 32: sha256_hash(data, len, CTX_256(ctx)); return; -#endif -#if defined(SHA384) - case 48: sha384_hash(data, len, CTX_384(ctx)); return; -#endif -#if defined(SHA512) - case 64: sha512_hash(data, len, CTX_512(ctx)); return; -#endif - } -} - -sha2_void sha2_end(unsigned char hval[], sha2_ctx ctx[1]) -{ - switch(ctx->sha2_len) - { -#if defined(SHA224) - case 28: sha_end1(hval, CTX_224(ctx), SHA224_DIGEST_SIZE); return; -#endif -#if defined(SHA256) - case 32: sha_end1(hval, CTX_256(ctx), SHA256_DIGEST_SIZE); return; -#endif -#if defined(SHA384) - case 48: sha_end2(hval, CTX_384(ctx), SHA384_DIGEST_SIZE); return; -#endif -#if defined(SHA512) - case 64: sha_end2(hval, CTX_512(ctx), SHA512_DIGEST_SIZE); return; -#endif - } -} - -sha2_int sha2(unsigned char hval[], unsigned long size, - const unsigned char data[], unsigned long len) -{ sha2_ctx cx[1]; - - if(sha2_begin(size, cx) == SHA2_GOOD) - { - sha2_hash(data, len, cx); sha2_end(hval, cx); return SHA2_GOOD; - } - else - return SHA2_BAD; -} - -#endif /* SHA2 */ - -#if defined(__cplusplus) -} -#endif - -CC_DIGEST_ONE_SHOT(CC_SHA224, CC_SHA256_CTX, CC_SHA224_Init, - CC_SHA224_Update, CC_SHA224_Final) - -CC_DIGEST_ONE_SHOT(CC_SHA256, CC_SHA256_CTX, CC_SHA256_Init, - CC_SHA256_Update, CC_SHA256_Final) - -CC_DIGEST_ONE_SHOT(CC_SHA384, CC_SHA512_CTX, CC_SHA384_Init, - CC_SHA384_Update, CC_SHA384_Final) - -CC_DIGEST_ONE_SHOT(CC_SHA512, CC_SHA512_CTX, CC_SHA512_Init, - CC_SHA512_Update, CC_SHA512_Final) DELETED Source/Digest/sha256.s Index: Source/Digest/sha256.s ================================================================== --- Source/Digest/sha256.s +++ /dev/null @@ -1,582 +0,0 @@ -/* - This file provides x86_64/i386 hand implementation of the following function - - sha2_void sha256_compile(sha256_ctx ctx[1]); - - which is a C function in CommonCrypto Source/Digest/sha2.c - - The implementation here is modified from another sha256 x86_64/i386 implementation for sha256 in the xnu. - To modify to fit the new API, - the old ctx (points to ctx->hashes) shoule be changed to ctx->hashes, 8(ctx). - the old data (points to ctx->wbuf), should be changed to ctx->wbuf, 40(ctx). - - sha256_compile handles 1 input block (64 bytes) per call. - - cclee 8-10-10 - - The following is comments for the initial xnu-sha256.s. - - void SHA256_Transform(SHA256_ctx *ctx, char *data, unsigned int num_blocks); - - which is a C function in sha2.c (from xnu). - - The code 1st probes cpu_capabilities to detect whether ssse3 is supported. If not, it branches to - SHA256_Transform_nossse3 (in a separate source file sha256nossse3.s) that was cloned from this file - with all ssse3 instructions replaced with sse3 or below instructions. - - sha256 algorithm per block description: - - 1. W(0:15) = big-endian (per 4 bytes) loading of input data (64 byte) - 2. load 8 digests a-h from ctx->state - 3. for r = 0:15 - T1 = h + Sigma1(e) + Ch(e,f,g) + K[r] + W[r]; - d += T1; - h = T1 + Sigma0(a) + Maj(a,b,c) - permute a,b,c,d,e,f,g,h into h,a,b,c,d,e,f,g - 4. for r = 16:63 - W[r] = W[r-16] + sigma1(W[r-2]) + W[r-7] + sigma0(W[r-15]); - T1 = h + Sigma1(e) + Ch(e,f,g) + K[r] + W[r]; - d += T1; - h = T1 + Sigma0(a) + Maj(a,b,c) - permute a,b,c,d,e,f,g,h into h,a,b,c,d,e,f,g - - In the assembly implementation: - - a circular window of message schedule W(r:r+15) is updated and stored in xmm0-xmm3 - - its corresponding W+K(r:r+15) is updated and stored in a stack space circular buffer - - the 8 digests (a-h) will be stored in GPR or m32 (all in GPR for x86_64, and some in m32 for i386) - - the implementation per block looks like - - ---------------------------------------------------------------------------- - - load W(0:15) (big-endian per 4 bytes) into xmm0:xmm3 - pre_calculate and store W+K(0:15) in stack - - load digests a-h from ctx->state; - - for (r=0;r<48;r+=4) { - digests a-h update and permute round r:r+3 - update W([r:r+3]%16) and WK([r:r+3]%16) for the next 4th iteration - } - - for (r=48;r<64;r+=4) { - digests a-h update and permute round r:r+3 - } - - ctx->states += digests a-h; - - ---------------------------------------------------------------------------- - - our implementation (allows multiple blocks per call) pipelines the loading of W/WK of a future block - into the last 16 rounds of its previous block: - - ---------------------------------------------------------------------------- - - load W(0:15) (big-endian per 4 bytes) into xmm0:xmm3 - pre_calculate and store W+K(0:15) in stack - -L_loop: - - load digests a-h from ctx->state; - - for (r=0;r<48;r+=4) { - digests a-h update and permute round r:r+3 - update W([r:r+3]%16) and WK([r:r+3]%16) for the next 4th iteration - } - - num_block--; - if (num_block==0) jmp L_last_block; - - for (r=48;r<64;r+=4) { - digests a-h update and permute round r:r+3 - load W([r:r+3]%16) (big-endian per 4 bytes) into xmm0:xmm3 - pre_calculate and store W+K([r:r+3]%16) in stack - } - - ctx->states += digests a-h; - - jmp L_loop; - -L_last_block: - - for (r=48;r<64;r+=4) { - digests a-h update and permute round r:r+3 - } - - ctx->states += digests a-h; - - ------------------------------------------------------------------------ - - Apple CoreOS vector & numerics - cclee 8-3-10 -*/ -#if defined __i386__ || defined __x86_64__ -#if defined KERNEL -#include -#else -#include -#endif - - // associate variables with registers or memory - -#if defined (__x86_64__) - #define sp %rsp - #define ctx %rdi - #define data %rsi - #define num_blocks %rdx - - #define a %r8d - #define b %r9d - #define c %r10d - #define d %r11d - #define e %r12d - #define f %r13d - #define g %r14d - #define h %r15d - - #define K %rbx - #define stack_size (8+16*8+16+64) // 8 (align) + xmm0:xmm7 + L_aligned_bswap + WK(0:15) - - #define L_aligned_bswap 64(sp) // bswap : big-endian loading of 4-byte words - #define xmm_save 80(sp) // starting address for xmm save/restore -#else - #define sp %esp - #define stack_size (12+16*8+16+16+64) // 12 (align) + xmm0:xmm7 + 16 (c,f,h,K) + L_aligned_bswap + WK(0:15) - #define ctx_addr 20+stack_size(sp) // ret_addr + 4 registers = 20, 1st caller argument - #define data_addr 24+stack_size(sp) // 2nd caller argument - #define num_blocks 28+stack_size(sp) // 3rd caller argument - - #define a %ebx - #define b %edx - #define c 64(sp) - #define d %ebp - #define e %esi - #define f 68(sp) - #define g %edi - #define h 72(sp) - - #define K 76(sp) // pointer to K256[] table - #define L_aligned_bswap 80(sp) // bswap : big-endian loading of 4-byte words - #define xmm_save 96(sp) // starting address for xmm save/restore -#endif - - // 2 local variables - #define t %eax - #define s %ecx - - // a window (16 words) of message scheule - #define W0 %xmm0 - #define W1 %xmm1 - #define W2 %xmm2 - #define W3 %xmm3 - - // circular buffer for WK[(r:r+15)%16] - #define WK(x) (x&15)*4(sp) - -// #define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) - - .macro Ch - mov $0, t // x - mov $0, s // x - not t // ~x - and $1, s // x & y - and $2, t // ~x & z - xor s, t // t = ((x) & (y)) ^ ((~(x)) & (z)); - .endm - -// #define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - - .macro Maj -#if 1 // steve's suggestion - mov $1, t // y - mov $2, s // z - xor $2, t // y^z - and $1, s // y&z - and $0, t // x&(y^z) - xor s, t // Maj(x,y,z) -#else - mov $0, t // x - mov $1, s // y - and s, t // x&y - and $2, s // y&z - xor s, t // (x&y) ^ (y&z) - mov $2, s // z - and $0, s // (x&z) - xor s, t // t = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) -#endif - .endm - -// #define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) - - // performs sigma0_256 on 4 words on an xmm registers - // use xmm6/xmm7 as intermediate registers - .macro sigma0 - movdqa $0, %xmm6 - movdqa $0, %xmm7 - psrld $$3, $0 // SHR3(x) - psrld $$7, %xmm6 // part of ROTR7 - pslld $$14, %xmm7 // part of ROTR18 - pxor %xmm6, $0 - pxor %xmm7, $0 - psrld $$11, %xmm6 // part of ROTR18 - pslld $$11, %xmm7 // part of ROTR7 - pxor %xmm6, $0 - pxor %xmm7, $0 - .endm - -// #define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) - - // performs sigma1_256 on 4 words on an xmm registers - // use xmm6/xmm7 as intermediate registers - .macro sigma1 - movdqa $0, %xmm6 - movdqa $0, %xmm7 - psrld $$10, $0 // SHR10(x) - psrld $$17, %xmm6 // part of ROTR17 - pxor %xmm6, $0 - pslld $$13, %xmm7 // part of ROTR19 - pxor %xmm7, $0 - psrld $$2, %xmm6 // part of ROTR19 - pxor %xmm6, $0 - pslld $$2, %xmm7 // part of ROTR17 - pxor %xmm7, $0 - .endm - -// #define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) - - .macro Sigma0 - mov $0, t // x - mov $0, s // x - ror $$2, t // S32(2, (x)) - ror $$13, s // S32(13, (x)) - xor s, t // S32(2, (x)) ^ S32(13, (x)) - ror $$9, s // S32(22, (x)) - xor s, t // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) - .endm - -// #define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) - - .macro Sigma1 - mov $0, s // x - ror $$6, s // S32(6, (x)) - mov s, t // S32(6, (x)) - ror $$5, s // S32(11, (x)) - xor s, t // S32(6, (x)) ^ S32(11, (x)) - ror $$14, s // S32(25, (x)) - xor s, t // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) - .endm - - // per round digests update - .macro round - Sigma1 $4 // t = T1 - add t, $7 // use h to store h+Sigma1(e) - Ch $4, $5, $6 // t = Ch (e, f, g); - add $7, t // t = h+Sigma1(e)+Ch(e,f,g); - add WK($8), t // h = T1 - add t, $3 // d += T1; - mov t, $7 // h = T1 - Sigma0 $0 // t = Sigma0(a); - add t, $7 // h = T1 + Sigma0(a); - Maj $0, $1, $2 // t = Maj(a,b,c) - add t, $7 // h = T1 + Sigma0(a) + Maj(a,b,c); - .endm - - // per 4 rounds digests update and permutation - // permutation is absorbed by rotating the roles of digests a-h - .macro rounds - round $0, $1, $2, $3, $4, $5, $6, $7, 0+$8 - round $7, $0, $1, $2, $3, $4, $5, $6, 1+$8 - round $6, $7, $0, $1, $2, $3, $4, $5, 2+$8 - round $5, $6, $7, $0, $1, $2, $3, $4, 3+$8 - .endm - - // update the message schedule W and W+K (4 rounds) 16 rounds ahead in the future - .macro message_schedule - - // 4 32-bit K256 words in xmm5 -#if defined (__x86_64__) - movdqu (K), %xmm5 -#else - mov K, t - movdqu (t), %xmm5 -#endif - add $$16, K // K points to next K256 word for next iteration - movdqa $1, %xmm4 // W7:W4 - palignr $$4, $0, %xmm4 // W4:W1 - sigma0 %xmm4 // sigma0(W4:W1) - movdqa $3, %xmm6 // W15:W12 - paddd %xmm4, $0 // $0 = W3:W0 + sigma0(W4:W1) - palignr $$4, $2, %xmm6 // W12:W9 - paddd %xmm6, $0 // $0 = W12:W9 + sigma0(W4:W1) + W3:W0 - movdqa $3, %xmm4 // W15:W12 - psrldq $$8, %xmm4 // 0,0,W15,W14 - sigma1 %xmm4 // sigma1(0,0,W15,W14) - paddd %xmm4, $0 // sigma1(0,0,W15,W14) + W12:W9 + sigma0(W4:W1) + W3:W0 - movdqa $0, %xmm4 // W19-sigma1(W17), W18-sigma1(W16), W17, W16 - pslldq $$8, %xmm4 // W17, W16, 0, 0 - sigma1 %xmm4 // sigma1(W17,W16,0,0) - paddd %xmm4, $0 // W19:W16 - paddd $0, %xmm5 // WK - movdqa %xmm5, WK($4) - .endm - - // this macro is used in the last 16 rounds of a current block - // it reads the next message (16 4-byte words), load it into 4 words W[r:r+3], computes WK[r:r+3] - // and save into stack to prepare for next block - - .macro update_W_WK -#if defined (__x86_64__) - movdqu $0*16(data), $1 // read 4 4-byte words - pshufb L_aligned_bswap, $1 // big-endian of each 4-byte word, W[r:r+3] - movdqu $0*16(K), %xmm4 // K[r:r+3] -#else - mov data_addr, t - movdqu $0*16(t), $1 // read 4 4-byte words - pshufb L_aligned_bswap, $1 // big-endian of each 4-byte word, W[r:r+3] - mov K, t - movdqu $0*16(t), %xmm4 // K[r:r+3] -#endif - paddd $1, %xmm4 // WK[r:r+3] - movdqa %xmm4, WK($0*4) // save WK[r:r+3] into stack circular buffer - .endm - -#if defined(__i386__) - .section __IMPORT,__pointers,non_lazy_symbol_pointers -L_K256$non_lazy_ptr: -.indirect_symbol _K256 - .long 0 -#endif - - .text - -#if defined (SHA256_USE_ASSEMBLY) - .globl _sha256_compile - -_sha256_compile: - -#if 1 - // detect SSSE3 and dispatch appropriate code branch - #if defined __x86_64__ - movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capabilities - mov (%rax), %eax // %eax = __cpu_capabilities - #else // i386 - #if defined KERNEL - leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities - mov (%eax), %eax // %eax = __cpu_capabilities - #else - mov _COMM_PAGE_CPU_CAPABILITIES, %eax - #endif - #endif - test $(kHasSupplementalSSE3), %eax - je _sha256_compile_nossse3 // branch to no-ssse3 code -#endif - - // push callee-saved registers -#if defined (__x86_64__) - push %rbp - push %rbx - push %r12 - push %r13 - push %r14 - push %r15 -#else - push %ebp - push %ebx - push %esi - push %edi -#endif - - // allocate stack space - sub $stack_size, sp - - // set up ctx and data - -#if defined (__x86_64__) - add $8, ctx // now ctx = %rdi - lea 32(ctx), data // data points to ctx->wbuf -#else - add $8, ctx_addr // now ctx points to ctx->hashes - mov ctx_addr, t - add $32, t - mov t, data_addr // data points to ctx->wbuf -#endif - - // if kernel code, save used xmm registers -#if KERNEL - movdqa %xmm0, 0*16+xmm_save - movdqa %xmm1, 1*16+xmm_save - movdqa %xmm2, 2*16+xmm_save - movdqa %xmm3, 3*16+xmm_save - movdqa %xmm4, 4*16+xmm_save - movdqa %xmm5, 5*16+xmm_save - movdqa %xmm6, 6*16+xmm_save - movdqa %xmm7, 7*16+xmm_save -#endif - - // set up bswap parameters in the aligned stack space and pointer to table K256[] -#if defined (__x86_64__) - lea _K256(%rip), K -#else - call 0f // Push program counter onto stack. -0: pop t // Get program counter. - mov L_K256$non_lazy_ptr-0b(t), t - mov t, K -#endif - - // load W[0:15] into xmm0-xmm3 -#if defined (__x86_64__) - movdqu 0*16(data), W0 - movdqu 1*16(data), W1 - movdqu 2*16(data), W2 - movdqu 3*16(data), W3 - add $64, data -#else - mov data_addr, t - movdqu 0*16(t), W0 - movdqu 1*16(t), W1 - movdqu 2*16(t), W2 - movdqu 3*16(t), W3 - add $64, data_addr -#endif - - // compute WK[0:15] and save in stack -#if defined (__x86_64__) - movdqu 0*16(K), %xmm4 - movdqu 1*16(K), %xmm5 - movdqu 2*16(K), %xmm6 - movdqu 3*16(K), %xmm7 -#else - mov K, t - movdqu 0*16(t), %xmm4 - movdqu 1*16(t), %xmm5 - movdqu 2*16(t), %xmm6 - movdqu 3*16(t), %xmm7 -#endif - add $64, K - paddd %xmm0, %xmm4 - paddd %xmm1, %xmm5 - paddd %xmm2, %xmm6 - paddd %xmm3, %xmm7 - movdqa %xmm4, WK(0) - movdqa %xmm5, WK(4) - movdqa %xmm6, WK(8) - movdqa %xmm7, WK(12) - - // digests a-h = ctx->states; -#if defined (__x86_64__) - mov 0*4(ctx), a - mov 1*4(ctx), b - mov 2*4(ctx), c - mov 3*4(ctx), d - mov 4*4(ctx), e - mov 5*4(ctx), f - mov 6*4(ctx), g - mov 7*4(ctx), h -#else - mov ctx_addr, t - mov 0*4(t), a - mov 1*4(t), b - mov 2*4(t), s - mov s, c - mov 3*4(t), d - mov 4*4(t), e - mov 5*4(t), s - mov s, f - mov 6*4(t), g - mov 7*4(t), s - mov s, h -#endif - - // rounds 0:47 interleaved with W/WK update for rounds 16:63 - rounds a, b, c, d, e, f, g, h, 0 - message_schedule W0,W1,W2,W3,16 - rounds e, f, g, h, a, b, c, d, 4 - message_schedule W1,W2,W3,W0,20 - rounds a, b, c, d, e, f, g, h, 8 - message_schedule W2,W3,W0,W1,24 - rounds e, f, g, h, a, b, c, d, 12 - message_schedule W3,W0,W1,W2,28 - rounds a, b, c, d, e, f, g, h, 16 - message_schedule W0,W1,W2,W3,32 - rounds e, f, g, h, a, b, c, d, 20 - message_schedule W1,W2,W3,W0,36 - rounds a, b, c, d, e, f, g, h, 24 - message_schedule W2,W3,W0,W1,40 - rounds e, f, g, h, a, b, c, d, 28 - message_schedule W3,W0,W1,W2,44 - rounds a, b, c, d, e, f, g, h, 32 - message_schedule W0,W1,W2,W3,48 - rounds e, f, g, h, a, b, c, d, 36 - message_schedule W1,W2,W3,W0,52 - rounds a, b, c, d, e, f, g, h, 40 - message_schedule W2,W3,W0,W1,56 - rounds e, f, g, h, a, b, c, d, 44 - message_schedule W3,W0,W1,W2,60 - - // wrap up digest update round 48:63 for final block - rounds a, b, c, d, e, f, g, h, 48 - rounds e, f, g, h, a, b, c, d, 52 - rounds a, b, c, d, e, f, g, h, 56 - rounds e, f, g, h, a, b, c, d, 60 - - // ctx->states += digests a-h -#if defined (__x86_64__) - add a, 0*4(ctx) - add b, 1*4(ctx) - add c, 2*4(ctx) - add d, 3*4(ctx) - add e, 4*4(ctx) - add f, 5*4(ctx) - add g, 6*4(ctx) - add h, 7*4(ctx) -#else - mov ctx_addr, t - add a, 0*4(t) - add b, 1*4(t) - mov c, s - add s, 2*4(t) - add d, 3*4(t) - add e, 4*4(t) - mov f, s - add s, 5*4(t) - add g, 6*4(t) - mov h, s - add s, 7*4(t) -#endif - - // if kernel, restore xmm0-xmm7 -#if KERNEL - movdqa 0*16+xmm_save, %xmm0 - movdqa 1*16+xmm_save, %xmm1 - movdqa 2*16+xmm_save, %xmm2 - movdqa 3*16+xmm_save, %xmm3 - movdqa 4*16+xmm_save, %xmm4 - movdqa 5*16+xmm_save, %xmm5 - movdqa 6*16+xmm_save, %xmm6 - movdqa 7*16+xmm_save, %xmm7 -#endif - - // free allocated stack memory - add $stack_size, sp - - // restore callee-saved registers -#if defined (__x86_64__) - pop %r15 - pop %r14 - pop %r13 - pop %r12 - pop %rbx - pop %rbp -#else - pop %edi - pop %esi - pop %ebx - pop %ebp -#endif - - // return - ret - - -#endif // SHA256_USE_ASSEMBLY -#endif // i386 || x86_64 DELETED Source/Digest/sha256_nossse3.s Index: Source/Digest/sha256_nossse3.s ================================================================== --- Source/Digest/sha256_nossse3.s +++ /dev/null @@ -1,585 +0,0 @@ -/* - This file provides x86_64/i386 hand implementation of the following function - - sha2_void sha256_compile(sha256_ctx ctx[1]); - - which is a C function in CommonCrypto Source/Digest/sha2.c - - The implementation here is modified from another sha256 x86_64/i386 implementation for sha256 in the xnu. - To modify to fit the new API, - the old ctx (points to ctx->hashes) shoule be changed to ctx->hashes, 8(ctx). - the old data (points to ctx->wbuf), should be changed to ctx->wbuf, 40(ctx). - - sha256_compile handles 1 input block (64 bytes) per call. - - cclee 8-10-10 - - The following is comments for the initial xnu-sha256.s. - - void SHA256_Transform(SHA256_ctx *ctx, char *data, unsigned int num_blocks); - - which is a C function in sha2.c (from xnu). - - The code 1st probes cpu_capabilities to detect whether ssse3 is supported. If not, it branches to - SHA256_Transform_nossse3 (in a separate source file sha256nossse3.s) that was cloned from this file - with all ssse3 instructions replaced with sse3 or below instructions. - - sha256 algorithm per block description: - - 1. W(0:15) = big-endian (per 4 bytes) loading of input data (64 byte) - 2. load 8 digests a-h from ctx->state - 3. for r = 0:15 - T1 = h + Sigma1(e) + Ch(e,f,g) + K[r] + W[r]; - d += T1; - h = T1 + Sigma0(a) + Maj(a,b,c) - permute a,b,c,d,e,f,g,h into h,a,b,c,d,e,f,g - 4. for r = 16:63 - W[r] = W[r-16] + sigma1(W[r-2]) + W[r-7] + sigma0(W[r-15]); - T1 = h + Sigma1(e) + Ch(e,f,g) + K[r] + W[r]; - d += T1; - h = T1 + Sigma0(a) + Maj(a,b,c) - permute a,b,c,d,e,f,g,h into h,a,b,c,d,e,f,g - - In the assembly implementation: - - a circular window of message schedule W(r:r+15) is updated and stored in xmm0-xmm3 - - its corresponding W+K(r:r+15) is updated and stored in a stack space circular buffer - - the 8 digests (a-h) will be stored in GPR or m32 (all in GPR for x86_64, and some in m32 for i386) - - the implementation per block looks like - - ---------------------------------------------------------------------------- - - load W(0:15) (big-endian per 4 bytes) into xmm0:xmm3 - pre_calculate and store W+K(0:15) in stack - - load digests a-h from ctx->state; - - for (r=0;r<48;r+=4) { - digests a-h update and permute round r:r+3 - update W([r:r+3]%16) and WK([r:r+3]%16) for the next 4th iteration - } - - for (r=48;r<64;r+=4) { - digests a-h update and permute round r:r+3 - } - - ctx->states += digests a-h; - - ---------------------------------------------------------------------------- - - our implementation (allows multiple blocks per call) pipelines the loading of W/WK of a future block - into the last 16 rounds of its previous block: - - ---------------------------------------------------------------------------- - - load W(0:15) (big-endian per 4 bytes) into xmm0:xmm3 - pre_calculate and store W+K(0:15) in stack - -L_loop: - - load digests a-h from ctx->state; - - for (r=0;r<48;r+=4) { - digests a-h update and permute round r:r+3 - update W([r:r+3]%16) and WK([r:r+3]%16) for the next 4th iteration - } - - num_block--; - if (num_block==0) jmp L_last_block; - - for (r=48;r<64;r+=4) { - digests a-h update and permute round r:r+3 - load W([r:r+3]%16) (big-endian per 4 bytes) into xmm0:xmm3 - pre_calculate and store W+K([r:r+3]%16) in stack - } - - ctx->states += digests a-h; - - jmp L_loop; - -L_last_block: - - for (r=48;r<64;r+=4) { - digests a-h update and permute round r:r+3 - } - - ctx->states += digests a-h; - - ------------------------------------------------------------------------ - - Apple CoreOS vector & numerics - cclee 8-3-10 -*/ - -#if defined (__x86_64__) || defined (__i386__) - -#if defined KERNEL -#include -#else -#include -#endif - - // associate variables with registers or memory - -#if defined (__x86_64__) - #define sp %rsp - #define ctx %rdi - #define data %rsi - #define num_blocks %rdx - - #define a %r8d - #define b %r9d - #define c %r10d - #define d %r11d - #define e %r12d - #define f %r13d - #define g %r14d - #define h %r15d - - #define K %rbx - #define stack_size (8+16*8+16+64) // 8 (align) + xmm0:xmm7 + L_aligned_bswap + WK(0:15) - - #define L_aligned_bswap 64(sp) // bswap : big-endian loading of 4-byte words - #define xmm_save 80(sp) // starting address for xmm save/restore -#else - #define sp %esp - #define stack_size (12+16*8+16+16+64) // 12 (align) + xmm0:xmm7 + 16 (c,f,h,K) + L_aligned_bswap + WK(0:15) - #define ctx_addr 20+stack_size(sp) // ret_addr + 4 registers = 20, 1st caller argument - #define data_addr 24+stack_size(sp) // 2nd caller argument - #define num_blocks 28+stack_size(sp) // 3rd caller argument - - #define a %ebx - #define b %edx - #define c 64(sp) - #define d %ebp - #define e %esi - #define f 68(sp) - #define g %edi - #define h 72(sp) - - #define K 76(sp) // pointer to K256[] table - #define L_aligned_bswap 80(sp) // bswap : big-endian loading of 4-byte words - #define xmm_save 96(sp) // starting address for xmm save/restore -#endif - - // 2 local variables - #define t %eax - #define s %ecx - - // a window (16 words) of message scheule - #define W0 %xmm0 - #define W1 %xmm1 - #define W2 %xmm2 - #define W3 %xmm3 - - // circular buffer for WK[(r:r+15)%16] - #define WK(x) (x&15)*4(sp) - -// #define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) - - .macro Ch - mov $0, t // x - mov $0, s // x - not t // ~x - and $1, s // x & y - and $2, t // ~x & z - xor s, t // t = ((x) & (y)) ^ ((~(x)) & (z)); - .endm - -// #define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - - .macro Maj -#if 1 // steve's suggestion - mov $1, t // y - mov $2, s // z - xor $2, t // y^z - and $1, s // y&z - and $0, t // x&(y^z) - xor s, t // Maj(x,y,z) -#else - mov $0, t // x - mov $1, s // y - and s, t // x&y - and $2, s // y&z - xor s, t // (x&y) ^ (y&z) - mov $2, s // z - and $0, s // (x&z) - xor s, t // t = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) -#endif - .endm - -// #define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) - - // performs sigma0_256 on 4 words on an xmm registers - // use xmm6/xmm7 as intermediate registers - .macro sigma0 - movdqa $0, %xmm6 - movdqa $0, %xmm7 - psrld $$3, $0 // SHR3(x) - psrld $$7, %xmm6 // part of ROTR7 - pslld $$14, %xmm7 // part of ROTR18 - pxor %xmm6, $0 - pxor %xmm7, $0 - psrld $$11, %xmm6 // part of ROTR18 - pslld $$11, %xmm7 // part of ROTR7 - pxor %xmm6, $0 - pxor %xmm7, $0 - .endm - -// #define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) - - // performs sigma1_256 on 4 words on an xmm registers - // use xmm6/xmm7 as intermediate registers - .macro sigma1 - movdqa $0, %xmm6 - movdqa $0, %xmm7 - psrld $$10, $0 // SHR10(x) - psrld $$17, %xmm6 // part of ROTR17 - pxor %xmm6, $0 - pslld $$13, %xmm7 // part of ROTR19 - pxor %xmm7, $0 - psrld $$2, %xmm6 // part of ROTR19 - pxor %xmm6, $0 - pslld $$2, %xmm7 // part of ROTR17 - pxor %xmm7, $0 - .endm - -// #define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) - - .macro Sigma0 - mov $0, t // x - mov $0, s // x - ror $$2, t // S32(2, (x)) - ror $$13, s // S32(13, (x)) - xor s, t // S32(2, (x)) ^ S32(13, (x)) - ror $$9, s // S32(22, (x)) - xor s, t // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) - .endm - -// #define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) - - .macro Sigma1 - mov $0, s // x - ror $$6, s // S32(6, (x)) - mov s, t // S32(6, (x)) - ror $$5, s // S32(11, (x)) - xor s, t // S32(6, (x)) ^ S32(11, (x)) - ror $$14, s // S32(25, (x)) - xor s, t // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) - .endm - - // per round digests update - .macro round - Sigma1 $4 // t = T1 - add t, $7 // use h to store h+Sigma1(e) - Ch $4, $5, $6 // t = Ch (e, f, g); - add $7, t // t = h+Sigma1(e)+Ch(e,f,g); - add WK($8), t // h = T1 - add t, $3 // d += T1; - mov t, $7 // h = T1 - Sigma0 $0 // t = Sigma0(a); - add t, $7 // h = T1 + Sigma0(a); - Maj $0, $1, $2 // t = Maj(a,b,c) - add t, $7 // h = T1 + Sigma0(a) + Maj(a,b,c); - .endm - - // per 4 rounds digests update and permutation - // permutation is absorbed by rotating the roles of digests a-h - .macro rounds - round $0, $1, $2, $3, $4, $5, $6, $7, 0+$8 - round $7, $0, $1, $2, $3, $4, $5, $6, 1+$8 - round $6, $7, $0, $1, $2, $3, $4, $5, 2+$8 - round $5, $6, $7, $0, $1, $2, $3, $4, 3+$8 - .endm - - // update the message schedule W and W+K (4 rounds) 16 rounds ahead in the future - .macro message_schedule - - // 4 32-bit K256 words in xmm5 -#if defined (__x86_64__) - movdqu (K), %xmm5 -#else - mov K, t - movdqu (t), %xmm5 -#endif - add $$16, K // K points to next K256 word for next iteration - movdqa $1, %xmm4 // W7:W4 -#if 0 - palignr $$4, $0, %xmm4 // W4:W1 -#else - movdqa $0, %xmm7 - pslldq $$12, %xmm4 - psrldq $$4, %xmm7 - por %xmm7, %xmm4 -#endif - sigma0 %xmm4 // sigma0(W4:W1) - movdqa $3, %xmm6 // W15:W12 - paddd %xmm4, $0 // $0 = W3:W0 + sigma0(W4:W1) -#if 0 - palignr $$4, $2, %xmm6 // W12:W9 -#else - movdqa $2, %xmm7 - pslldq $$12, %xmm6 - psrldq $$4, %xmm7 - por %xmm7, %xmm6 -#endif - paddd %xmm6, $0 // $0 = W12:W9 + sigma0(W4:W1) + W3:W0 - movdqa $3, %xmm4 // W15:W12 - psrldq $$8, %xmm4 // 0,0,W15,W14 - sigma1 %xmm4 // sigma1(0,0,W15,W14) - paddd %xmm4, $0 // sigma1(0,0,W15,W14) + W12:W9 + sigma0(W4:W1) + W3:W0 - movdqa $0, %xmm4 // W19-sigma1(W17), W18-sigma1(W16), W17, W16 - pslldq $$8, %xmm4 // W17, W16, 0, 0 - sigma1 %xmm4 // sigma1(W17,W16,0,0) - paddd %xmm4, $0 // W19:W16 - paddd $0, %xmm5 // WK - movdqa %xmm5, WK($4) - .endm - - // this macro is used in the last 16 rounds of a current block - // it reads the next message (16 4-byte words), load it into 4 words W[r:r+3], computes WK[r:r+3] - // and save into stack to prepare for next block - - .macro update_W_WK -#if defined (__x86_64__) - movdqu $0*16(data), $1 // read 4 4-byte words - pshufb L_aligned_bswap, $1 // big-endian of each 4-byte word, W[r:r+3] - movdqu $0*16(K), %xmm4 // K[r:r+3] -#else - mov data_addr, t - movdqu $0*16(t), $1 // read 4 4-byte words - pshufb L_aligned_bswap, $1 // big-endian of each 4-byte word, W[r:r+3] - mov K, t - movdqu $0*16(t), %xmm4 // K[r:r+3] -#endif - paddd $1, %xmm4 // WK[r:r+3] - movdqa %xmm4, WK($0*4) // save WK[r:r+3] into stack circular buffer - .endm - - -#if defined (SHA256_USE_ASSEMBLY) - -#if defined (__i386__) - .section __IMPORT,__pointers,non_lazy_symbol_pointers -L_K256$non_lazy_ptr: -.indirect_symbol _K256 - .long 0 -#endif - - .text - .globl _sha256_compile_nossse3 - -_sha256_compile_nossse3: - - // push callee-saved registers -#if defined (__x86_64__) - push %rbp - push %rbx - push %r12 - push %r13 - push %r14 - push %r15 -#else - push %ebp - push %ebx - push %esi - push %edi -#endif - - // allocate stack space - sub $stack_size, sp - - // set up ctx and data - -#if defined (__x86_64__) - add $8, ctx // now ctx = %rdi - lea 32(ctx), data // data points to ctx->wbuf -#else - add $8, ctx_addr // now ctx points to ctx->hashes - mov ctx_addr, t - add $32, t - mov t, data_addr // data points to ctx->wbuf -#endif - - // if kernel code, save used xmm registers -#if KERNEL - movdqa %xmm0, 0*16+xmm_save - movdqa %xmm1, 1*16+xmm_save - movdqa %xmm2, 2*16+xmm_save - movdqa %xmm3, 3*16+xmm_save - movdqa %xmm4, 4*16+xmm_save - movdqa %xmm5, 5*16+xmm_save - movdqa %xmm6, 6*16+xmm_save - movdqa %xmm7, 7*16+xmm_save -#endif - - // set up bswap parameters in the aligned stack space and pointer to table K256[] -#if defined (__x86_64__) - lea _K256(%rip), K -#else - - call 0f // Push program counter onto stack. - 0: pop t // Get program counter. - movl L_K256$non_lazy_ptr-0b(t), t - - mov t, K -#endif - - // load W[0:15] into xmm0-xmm3 -#if defined (__x86_64__) - movdqu 0*16(data), W0 - movdqu 1*16(data), W1 - movdqu 2*16(data), W2 - movdqu 3*16(data), W3 - add $64, data -#else - mov data_addr, t - movdqu 0*16(t), W0 - movdqu 1*16(t), W1 - movdqu 2*16(t), W2 - movdqu 3*16(t), W3 - add $64, data_addr -#endif - - // compute WK[0:15] and save in stack -#if defined (__x86_64__) - movdqu 0*16(K), %xmm4 - movdqu 1*16(K), %xmm5 - movdqu 2*16(K), %xmm6 - movdqu 3*16(K), %xmm7 -#else - mov K, t - movdqu 0*16(t), %xmm4 - movdqu 1*16(t), %xmm5 - movdqu 2*16(t), %xmm6 - movdqu 3*16(t), %xmm7 -#endif - add $64, K - paddd %xmm0, %xmm4 - paddd %xmm1, %xmm5 - paddd %xmm2, %xmm6 - paddd %xmm3, %xmm7 - movdqa %xmm4, WK(0) - movdqa %xmm5, WK(4) - movdqa %xmm6, WK(8) - movdqa %xmm7, WK(12) - - // digests a-h = ctx->states; -#if defined (__x86_64__) - mov 0*4(ctx), a - mov 1*4(ctx), b - mov 2*4(ctx), c - mov 3*4(ctx), d - mov 4*4(ctx), e - mov 5*4(ctx), f - mov 6*4(ctx), g - mov 7*4(ctx), h -#else - mov ctx_addr, t - mov 0*4(t), a - mov 1*4(t), b - mov 2*4(t), s - mov s, c - mov 3*4(t), d - mov 4*4(t), e - mov 5*4(t), s - mov s, f - mov 6*4(t), g - mov 7*4(t), s - mov s, h -#endif - - // rounds 0:47 interleaved with W/WK update for rounds 16:63 - rounds a, b, c, d, e, f, g, h, 0 - message_schedule W0,W1,W2,W3,16 - rounds e, f, g, h, a, b, c, d, 4 - message_schedule W1,W2,W3,W0,20 - rounds a, b, c, d, e, f, g, h, 8 - message_schedule W2,W3,W0,W1,24 - rounds e, f, g, h, a, b, c, d, 12 - message_schedule W3,W0,W1,W2,28 - rounds a, b, c, d, e, f, g, h, 16 - message_schedule W0,W1,W2,W3,32 - rounds e, f, g, h, a, b, c, d, 20 - message_schedule W1,W2,W3,W0,36 - rounds a, b, c, d, e, f, g, h, 24 - message_schedule W2,W3,W0,W1,40 - rounds e, f, g, h, a, b, c, d, 28 - message_schedule W3,W0,W1,W2,44 - rounds a, b, c, d, e, f, g, h, 32 - message_schedule W0,W1,W2,W3,48 - rounds e, f, g, h, a, b, c, d, 36 - message_schedule W1,W2,W3,W0,52 - rounds a, b, c, d, e, f, g, h, 40 - message_schedule W2,W3,W0,W1,56 - rounds e, f, g, h, a, b, c, d, 44 - message_schedule W3,W0,W1,W2,60 - - // wrap up digest update round 48:63 for final block - rounds a, b, c, d, e, f, g, h, 48 - rounds e, f, g, h, a, b, c, d, 52 - rounds a, b, c, d, e, f, g, h, 56 - rounds e, f, g, h, a, b, c, d, 60 - - // ctx->states += digests a-h -#if defined (__x86_64__) - add a, 0*4(ctx) - add b, 1*4(ctx) - add c, 2*4(ctx) - add d, 3*4(ctx) - add e, 4*4(ctx) - add f, 5*4(ctx) - add g, 6*4(ctx) - add h, 7*4(ctx) -#else - mov ctx_addr, t - add a, 0*4(t) - add b, 1*4(t) - mov c, s - add s, 2*4(t) - add d, 3*4(t) - add e, 4*4(t) - mov f, s - add s, 5*4(t) - add g, 6*4(t) - mov h, s - add s, 7*4(t) -#endif - - // if kernel, restore xmm0-xmm7 -#if KERNEL - movdqa 0*16+xmm_save, %xmm0 - movdqa 1*16+xmm_save, %xmm1 - movdqa 2*16+xmm_save, %xmm2 - movdqa 3*16+xmm_save, %xmm3 - movdqa 4*16+xmm_save, %xmm4 - movdqa 5*16+xmm_save, %xmm5 - movdqa 6*16+xmm_save, %xmm6 - movdqa 7*16+xmm_save, %xmm7 -#endif - - // free allocated stack memory - add $stack_size, sp - - // restore callee-saved registers -#if defined (__x86_64__) - pop %r15 - pop %r14 - pop %r13 - pop %r12 - pop %rbx - pop %rbp -#else - pop %edi - pop %esi - pop %ebx - pop %ebp -#endif - - // return - ret - - - -#endif // SHA256_USE_ASSEMBLY -#endif // x86_64/i386 DELETED Source/Digest/sha2Priv.h Index: Source/Digest/sha2Priv.h ================================================================== --- Source/Digest/sha2Priv.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _CC_SHA2_PRIV_H_ -#define _CC_SHA2_PRIV_H_ - - -/* - * This is a replacement for sha2.h; all types, consts, and prototypes are defined - * in CommonDigest.h. We redefine them here so the original Gladman source is - * unmodified except for the include of sha2.h. - */ -#include "CommonDigestPriv.h" -#include - -#define SHA224_DIGEST_SIZE CC_SHA224_DIGEST_LENGTH -#define SHA256_DIGEST_SIZE CC_SHA256_DIGEST_LENGTH -#define SHA384_DIGEST_SIZE CC_SHA384_DIGEST_LENGTH -#define SHA512_DIGEST_SIZE CC_SHA512_DIGEST_LENGTH - -#define SHA224_BLOCK_SIZE CC_SHA224_BLOCK_BYTES -#define SHA256_BLOCK_SIZE CC_SHA256_BLOCK_BYTES -#define SHA384_BLOCK_SIZE CC_SHA384_BLOCK_BYTES -#define SHA512_BLOCK_SIZE CC_SHA512_BLOCK_BYTES - -#define SHA2_GOOD 0 -#define SHA2_BAD 1 - -typedef void sha2_void; - -typedef CC_LONG sha2_32t; -typedef CC_LONG64 sha2_64t; - -typedef CC_SHA256_CTX sha224_ctx; -typedef CC_SHA256_CTX sha256_ctx; -typedef CC_SHA512_CTX sha384_ctx; -typedef CC_SHA512_CTX sha512_ctx; - -#define sha224_begin(c) CC_SHA224_Init(c) -#define sha224_end(md, c) CC_SHA224_Final(md, c) - -#define sha256_begin(c) CC_SHA256_Init(c) -#define sha256_end(md, c) CC_SHA256_Final(md, c) - -#define sha384_begin(c) CC_SHA384_Init(c) -#define sha384_end(md, c) CC_SHA384_Final(md, c) - -#define sha512_begin(c) CC_SHA512_Init(c) -#define sha512_end(md, c) CC_SHA512_Final(md, c) - -#endif /* _CC_SHA2_PRIV_H_ */ - DELETED Source/Digest/sha_locl.h Index: Source/Digest/sha_locl.h ================================================================== --- Source/Digest/sha_locl.h +++ /dev/null @@ -1,491 +0,0 @@ -/* crypto/sha/sha_locl.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include - -#include "CommonDigestPriv.h" - -#ifndef _APPLE_COMMON_CRYPTO_ -#include -#include -#endif - -#ifndef SHA_LONG_LOG2 -#define SHA_LONG_LOG2 2 /* default to 32 bits */ -#endif - -#define DATA_ORDER_IS_BIG_ENDIAN - -#define HASH_LONG SHA_LONG -#define HASH_LONG_LOG2 SHA_LONG_LOG2 -#define HASH_CTX SHA_CTX -#define HASH_CBLOCK SHA_CBLOCK -#define HASH_LBLOCK SHA_LBLOCK -#define HASH_MAKE_STRING(c,s) do { \ - unsigned long ll; \ - ll=(c)->h0; HOST_l2c(ll,(s)); \ - ll=(c)->h1; HOST_l2c(ll,(s)); \ - ll=(c)->h2; HOST_l2c(ll,(s)); \ - ll=(c)->h3; HOST_l2c(ll,(s)); \ - ll=(c)->h4; HOST_l2c(ll,(s)); \ - } while (0) - -#if defined(SHA_0) - -# define HASH_UPDATE SHA_Update -# define HASH_TRANSFORM SHA_Transform -# define HASH_FINAL SHA_Final -# define HASH_INIT SHA_Init -# define HASH_BLOCK_HOST_ORDER sha_block_host_order -# define HASH_BLOCK_DATA_ORDER sha_block_data_order -# define Xupdate(a,ix,ia,ib,ic,id) (ix=(a)=(ia^ib^ic^id)) - - void sha_block_host_order (SHA_CTX *c, const void *p,int num); - void sha_block_data_order (SHA_CTX *c, const void *p,int num); - -#elif defined(SHA_1) - -#ifdef _APPLE_COMMON_CRYPTO_ -#if CC_SHA1_USE_HARDWARE -# define HASH_UPDATE _CC_SHA1_Update -#else -# define HASH_UPDATE CC_SHA1_Update -#endif -# define HASH_TRANSFORM CC_SHA1_Transform -# define HASH_FINAL CC_SHA1_Final -# define HASH_INIT CC_SHA1_Init -#else -# define HASH_UPDATE SHA1_Update -# define HASH_TRANSFORM SHA1_Transform -# define HASH_FINAL SHA1_Final -# define HASH_INIT SHA1_Init -#endif /* _APPLE_COMMON_CRYPTO_ */ - -# define HASH_BLOCK_HOST_ORDER sha1_block_host_order -# define HASH_BLOCK_DATA_ORDER sha1_block_data_order -# if defined(__MWERKS__) && defined(__MC68K__) - /* Metrowerks for Motorola fails otherwise:-( */ -# define Xupdate(a,ix,ia,ib,ic,id) do { (a)=(ia^ib^ic^id); \ - ix=(a)=ROTATE((a),1); \ - } while (0) -# else -# define Xupdate(a,ix,ia,ib,ic,id) ( (a)=(ia^ib^ic^id), \ - ix=(a)=ROTATE((a),1) \ - ) -# endif - -#define SHA1_ASM -#ifdef SHA1_ASM - #if defined __i386__ || defined __x86_64__ - #define sha1_block_host_order sha1_block_asm_host_order - #define DONT_IMPLEMENT_BLOCK_HOST_ORDER - #define sha1_block_data_order sha1_block_asm_data_order - #define DONT_IMPLEMENT_BLOCK_DATA_ORDER - #define HASH_BLOCK_DATA_ORDER_ALIGNED sha1_block_asm_data_order - #include "sha1edp.h" - #endif -#endif - -__private_extern__ void sha1_block_host_order (SHA_CTX *c, const void *p,int num); -__private_extern__ void sha1_block_data_order (SHA_CTX *c, const void *p,int num); - -#else -# error "Either SHA_0 or SHA_1 must be defined." -#endif - -#include "md32_common.h" - -#define INIT_DATA_h0 0x67452301UL -#define INIT_DATA_h1 0xefcdab89UL -#define INIT_DATA_h2 0x98badcfeUL -#define INIT_DATA_h3 0x10325476UL -#define INIT_DATA_h4 0xc3d2e1f0UL - -int HASH_INIT (SHA_CTX *c) - { - c->h0=INIT_DATA_h0; - c->h1=INIT_DATA_h1; - c->h2=INIT_DATA_h2; - c->h3=INIT_DATA_h3; - c->h4=INIT_DATA_h4; - c->Nl=0; - c->Nh=0; - c->num=0; - return 1; - } - -#define K_00_19 0x5a827999UL -#define K_20_39 0x6ed9eba1UL -#define K_40_59 0x8f1bbcdcUL -#define K_60_79 0xca62c1d6UL - -/* As pointed out by Wei Dai , F() below can be - * simplified to the code in F_00_19. Wei attributes these optimisations - * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. - * #define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) - * I've just become aware of another tweak to be made, again from Wei Dai, - * in F_40_59, (x&a)|(y&a) -> (x|y)&a - */ -#define F_00_19(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) -#define F_20_39(b,c,d) ((b) ^ (c) ^ (d)) -#define F_40_59(b,c,d) (((b) & (c)) | (((b)|(c)) & (d))) -#define F_60_79(b,c,d) F_20_39(b,c,d) - -#define BODY_00_15(i,a,b,c,d,e,f,xi) \ - (f)=xi+(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ - (b)=ROTATE((b),30); - -#define BODY_16_19(i,a,b,c,d,e,f,xi,xa,xb,xc,xd) \ - Xupdate(f,xi,xa,xb,xc,xd); \ - (f)+=(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ - (b)=ROTATE((b),30); - -#define BODY_20_31(i,a,b,c,d,e,f,xi,xa,xb,xc,xd) \ - Xupdate(f,xi,xa,xb,xc,xd); \ - (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ - (b)=ROTATE((b),30); - -#define BODY_32_39(i,a,b,c,d,e,f,xa,xb,xc,xd) \ - Xupdate(f,xa,xa,xb,xc,xd); \ - (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ - (b)=ROTATE((b),30); - -#define BODY_40_59(i,a,b,c,d,e,f,xa,xb,xc,xd) \ - Xupdate(f,xa,xa,xb,xc,xd); \ - (f)+=(e)+K_40_59+ROTATE((a),5)+F_40_59((b),(c),(d)); \ - (b)=ROTATE((b),30); - -#define BODY_60_79(i,a,b,c,d,e,f,xa,xb,xc,xd) \ - Xupdate(f,xa,xa,xb,xc,xd); \ - (f)=xa+(e)+K_60_79+ROTATE((a),5)+F_60_79((b),(c),(d)); \ - (b)=ROTATE((b),30); - -#ifdef X -#undef X -#endif -#ifndef MD32_XARRAY - /* - * Originally X was an array. As it's automatic it's natural - * to expect RISC compiler to accomodate at least part of it in - * the register bank, isn't it? Unfortunately not all compilers - * "find" this expectation reasonable:-( On order to make such - * compilers generate better code I replace X[] with a bunch of - * X0, X1, etc. See the function body below... - * - */ -# define X(i) XX##i -#else - /* - * However! Some compilers (most notably HP C) get overwhelmed by - * that many local variables so that we have to have the way to - * fall down to the original behavior. - */ -# define X(i) XX[i] -#endif - -#ifndef DONT_IMPLEMENT_BLOCK_HOST_ORDER -__private_extern__ void HASH_BLOCK_HOST_ORDER (SHA_CTX *c, const void *d, int num) - { - const SHA_LONG *W=d; - register unsigned MD32_REG_T A,B,C,D,E,T; -#ifndef MD32_XARRAY - unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, - XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15; -#else - SHA_LONG XX[16]; -#endif - - A=c->h0; - B=c->h1; - C=c->h2; - D=c->h3; - E=c->h4; - - for (;;) - { - BODY_00_15( 0,A,B,C,D,E,T,W[ 0]); - BODY_00_15( 1,T,A,B,C,D,E,W[ 1]); - BODY_00_15( 2,E,T,A,B,C,D,W[ 2]); - BODY_00_15( 3,D,E,T,A,B,C,W[ 3]); - BODY_00_15( 4,C,D,E,T,A,B,W[ 4]); - BODY_00_15( 5,B,C,D,E,T,A,W[ 5]); - BODY_00_15( 6,A,B,C,D,E,T,W[ 6]); - BODY_00_15( 7,T,A,B,C,D,E,W[ 7]); - BODY_00_15( 8,E,T,A,B,C,D,W[ 8]); - BODY_00_15( 9,D,E,T,A,B,C,W[ 9]); - BODY_00_15(10,C,D,E,T,A,B,W[10]); - BODY_00_15(11,B,C,D,E,T,A,W[11]); - BODY_00_15(12,A,B,C,D,E,T,W[12]); - BODY_00_15(13,T,A,B,C,D,E,W[13]); - BODY_00_15(14,E,T,A,B,C,D,W[14]); - BODY_00_15(15,D,E,T,A,B,C,W[15]); - - BODY_16_19(16,C,D,E,T,A,B,X( 0),W[ 0],W[ 2],W[ 8],W[13]); - BODY_16_19(17,B,C,D,E,T,A,X( 1),W[ 1],W[ 3],W[ 9],W[14]); - BODY_16_19(18,A,B,C,D,E,T,X( 2),W[ 2],W[ 4],W[10],W[15]); - BODY_16_19(19,T,A,B,C,D,E,X( 3),W[ 3],W[ 5],W[11],X( 0)); - - BODY_20_31(20,E,T,A,B,C,D,X( 4),W[ 4],W[ 6],W[12],X( 1)); - BODY_20_31(21,D,E,T,A,B,C,X( 5),W[ 5],W[ 7],W[13],X( 2)); - BODY_20_31(22,C,D,E,T,A,B,X( 6),W[ 6],W[ 8],W[14],X( 3)); - BODY_20_31(23,B,C,D,E,T,A,X( 7),W[ 7],W[ 9],W[15],X( 4)); - BODY_20_31(24,A,B,C,D,E,T,X( 8),W[ 8],W[10],X( 0),X( 5)); - BODY_20_31(25,T,A,B,C,D,E,X( 9),W[ 9],W[11],X( 1),X( 6)); - BODY_20_31(26,E,T,A,B,C,D,X(10),W[10],W[12],X( 2),X( 7)); - BODY_20_31(27,D,E,T,A,B,C,X(11),W[11],W[13],X( 3),X( 8)); - BODY_20_31(28,C,D,E,T,A,B,X(12),W[12],W[14],X( 4),X( 9)); - BODY_20_31(29,B,C,D,E,T,A,X(13),W[13],W[15],X( 5),X(10)); - BODY_20_31(30,A,B,C,D,E,T,X(14),W[14],X( 0),X( 6),X(11)); - BODY_20_31(31,T,A,B,C,D,E,X(15),W[15],X( 1),X( 7),X(12)); - - BODY_32_39(32,E,T,A,B,C,D,X( 0),X( 2),X( 8),X(13)); - BODY_32_39(33,D,E,T,A,B,C,X( 1),X( 3),X( 9),X(14)); - BODY_32_39(34,C,D,E,T,A,B,X( 2),X( 4),X(10),X(15)); - BODY_32_39(35,B,C,D,E,T,A,X( 3),X( 5),X(11),X( 0)); - BODY_32_39(36,A,B,C,D,E,T,X( 4),X( 6),X(12),X( 1)); - BODY_32_39(37,T,A,B,C,D,E,X( 5),X( 7),X(13),X( 2)); - BODY_32_39(38,E,T,A,B,C,D,X( 6),X( 8),X(14),X( 3)); - BODY_32_39(39,D,E,T,A,B,C,X( 7),X( 9),X(15),X( 4)); - - BODY_40_59(40,C,D,E,T,A,B,X( 8),X(10),X( 0),X( 5)); - BODY_40_59(41,B,C,D,E,T,A,X( 9),X(11),X( 1),X( 6)); - BODY_40_59(42,A,B,C,D,E,T,X(10),X(12),X( 2),X( 7)); - BODY_40_59(43,T,A,B,C,D,E,X(11),X(13),X( 3),X( 8)); - BODY_40_59(44,E,T,A,B,C,D,X(12),X(14),X( 4),X( 9)); - BODY_40_59(45,D,E,T,A,B,C,X(13),X(15),X( 5),X(10)); - BODY_40_59(46,C,D,E,T,A,B,X(14),X( 0),X( 6),X(11)); - BODY_40_59(47,B,C,D,E,T,A,X(15),X( 1),X( 7),X(12)); - BODY_40_59(48,A,B,C,D,E,T,X( 0),X( 2),X( 8),X(13)); - BODY_40_59(49,T,A,B,C,D,E,X( 1),X( 3),X( 9),X(14)); - BODY_40_59(50,E,T,A,B,C,D,X( 2),X( 4),X(10),X(15)); - BODY_40_59(51,D,E,T,A,B,C,X( 3),X( 5),X(11),X( 0)); - BODY_40_59(52,C,D,E,T,A,B,X( 4),X( 6),X(12),X( 1)); - BODY_40_59(53,B,C,D,E,T,A,X( 5),X( 7),X(13),X( 2)); - BODY_40_59(54,A,B,C,D,E,T,X( 6),X( 8),X(14),X( 3)); - BODY_40_59(55,T,A,B,C,D,E,X( 7),X( 9),X(15),X( 4)); - BODY_40_59(56,E,T,A,B,C,D,X( 8),X(10),X( 0),X( 5)); - BODY_40_59(57,D,E,T,A,B,C,X( 9),X(11),X( 1),X( 6)); - BODY_40_59(58,C,D,E,T,A,B,X(10),X(12),X( 2),X( 7)); - BODY_40_59(59,B,C,D,E,T,A,X(11),X(13),X( 3),X( 8)); - - BODY_60_79(60,A,B,C,D,E,T,X(12),X(14),X( 4),X( 9)); - BODY_60_79(61,T,A,B,C,D,E,X(13),X(15),X( 5),X(10)); - BODY_60_79(62,E,T,A,B,C,D,X(14),X( 0),X( 6),X(11)); - BODY_60_79(63,D,E,T,A,B,C,X(15),X( 1),X( 7),X(12)); - BODY_60_79(64,C,D,E,T,A,B,X( 0),X( 2),X( 8),X(13)); - BODY_60_79(65,B,C,D,E,T,A,X( 1),X( 3),X( 9),X(14)); - BODY_60_79(66,A,B,C,D,E,T,X( 2),X( 4),X(10),X(15)); - BODY_60_79(67,T,A,B,C,D,E,X( 3),X( 5),X(11),X( 0)); - BODY_60_79(68,E,T,A,B,C,D,X( 4),X( 6),X(12),X( 1)); - BODY_60_79(69,D,E,T,A,B,C,X( 5),X( 7),X(13),X( 2)); - BODY_60_79(70,C,D,E,T,A,B,X( 6),X( 8),X(14),X( 3)); - BODY_60_79(71,B,C,D,E,T,A,X( 7),X( 9),X(15),X( 4)); - BODY_60_79(72,A,B,C,D,E,T,X( 8),X(10),X( 0),X( 5)); - BODY_60_79(73,T,A,B,C,D,E,X( 9),X(11),X( 1),X( 6)); - BODY_60_79(74,E,T,A,B,C,D,X(10),X(12),X( 2),X( 7)); - BODY_60_79(75,D,E,T,A,B,C,X(11),X(13),X( 3),X( 8)); - BODY_60_79(76,C,D,E,T,A,B,X(12),X(14),X( 4),X( 9)); - BODY_60_79(77,B,C,D,E,T,A,X(13),X(15),X( 5),X(10)); - BODY_60_79(78,A,B,C,D,E,T,X(14),X( 0),X( 6),X(11)); - BODY_60_79(79,T,A,B,C,D,E,X(15),X( 1),X( 7),X(12)); - - c->h0=(c->h0+E)&0xffffffffL; - c->h1=(c->h1+T)&0xffffffffL; - c->h2=(c->h2+A)&0xffffffffL; - c->h3=(c->h3+B)&0xffffffffL; - c->h4=(c->h4+C)&0xffffffffL; - - if (--num <= 0) break; - - A=c->h0; - B=c->h1; - C=c->h2; - D=c->h3; - E=c->h4; - - W+=SHA_LBLOCK; - } - } -#endif - -#ifndef DONT_IMPLEMENT_BLOCK_DATA_ORDER -__private_extern__ void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, int num) - { - const unsigned char *data=p; - register unsigned MD32_REG_T A,B,C,D,E,T,l; -#ifndef MD32_XARRAY - unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, - XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15; -#else - SHA_LONG XX[16]; -#endif - - A=c->h0; - B=c->h1; - C=c->h2; - D=c->h3; - E=c->h4; - - for (;;) - { - - HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l; - BODY_00_15( 0,A,B,C,D,E,T,X( 0)); HOST_c2l(data,l); X( 2)=l; - BODY_00_15( 1,T,A,B,C,D,E,X( 1)); HOST_c2l(data,l); X( 3)=l; - BODY_00_15( 2,E,T,A,B,C,D,X( 2)); HOST_c2l(data,l); X( 4)=l; - BODY_00_15( 3,D,E,T,A,B,C,X( 3)); HOST_c2l(data,l); X( 5)=l; - BODY_00_15( 4,C,D,E,T,A,B,X( 4)); HOST_c2l(data,l); X( 6)=l; - BODY_00_15( 5,B,C,D,E,T,A,X( 5)); HOST_c2l(data,l); X( 7)=l; - BODY_00_15( 6,A,B,C,D,E,T,X( 6)); HOST_c2l(data,l); X( 8)=l; - BODY_00_15( 7,T,A,B,C,D,E,X( 7)); HOST_c2l(data,l); X( 9)=l; - BODY_00_15( 8,E,T,A,B,C,D,X( 8)); HOST_c2l(data,l); X(10)=l; - BODY_00_15( 9,D,E,T,A,B,C,X( 9)); HOST_c2l(data,l); X(11)=l; - BODY_00_15(10,C,D,E,T,A,B,X(10)); HOST_c2l(data,l); X(12)=l; - BODY_00_15(11,B,C,D,E,T,A,X(11)); HOST_c2l(data,l); X(13)=l; - BODY_00_15(12,A,B,C,D,E,T,X(12)); HOST_c2l(data,l); X(14)=l; - BODY_00_15(13,T,A,B,C,D,E,X(13)); HOST_c2l(data,l); X(15)=l; - BODY_00_15(14,E,T,A,B,C,D,X(14)); - BODY_00_15(15,D,E,T,A,B,C,X(15)); - - BODY_16_19(16,C,D,E,T,A,B,X( 0),X( 0),X( 2),X( 8),X(13)); - BODY_16_19(17,B,C,D,E,T,A,X( 1),X( 1),X( 3),X( 9),X(14)); - BODY_16_19(18,A,B,C,D,E,T,X( 2),X( 2),X( 4),X(10),X(15)); - BODY_16_19(19,T,A,B,C,D,E,X( 3),X( 3),X( 5),X(11),X( 0)); - - BODY_20_31(20,E,T,A,B,C,D,X( 4),X( 4),X( 6),X(12),X( 1)); - BODY_20_31(21,D,E,T,A,B,C,X( 5),X( 5),X( 7),X(13),X( 2)); - BODY_20_31(22,C,D,E,T,A,B,X( 6),X( 6),X( 8),X(14),X( 3)); - BODY_20_31(23,B,C,D,E,T,A,X( 7),X( 7),X( 9),X(15),X( 4)); - BODY_20_31(24,A,B,C,D,E,T,X( 8),X( 8),X(10),X( 0),X( 5)); - BODY_20_31(25,T,A,B,C,D,E,X( 9),X( 9),X(11),X( 1),X( 6)); - BODY_20_31(26,E,T,A,B,C,D,X(10),X(10),X(12),X( 2),X( 7)); - BODY_20_31(27,D,E,T,A,B,C,X(11),X(11),X(13),X( 3),X( 8)); - BODY_20_31(28,C,D,E,T,A,B,X(12),X(12),X(14),X( 4),X( 9)); - BODY_20_31(29,B,C,D,E,T,A,X(13),X(13),X(15),X( 5),X(10)); - BODY_20_31(30,A,B,C,D,E,T,X(14),X(14),X( 0),X( 6),X(11)); - BODY_20_31(31,T,A,B,C,D,E,X(15),X(15),X( 1),X( 7),X(12)); - - BODY_32_39(32,E,T,A,B,C,D,X( 0),X( 2),X( 8),X(13)); - BODY_32_39(33,D,E,T,A,B,C,X( 1),X( 3),X( 9),X(14)); - BODY_32_39(34,C,D,E,T,A,B,X( 2),X( 4),X(10),X(15)); - BODY_32_39(35,B,C,D,E,T,A,X( 3),X( 5),X(11),X( 0)); - BODY_32_39(36,A,B,C,D,E,T,X( 4),X( 6),X(12),X( 1)); - BODY_32_39(37,T,A,B,C,D,E,X( 5),X( 7),X(13),X( 2)); - BODY_32_39(38,E,T,A,B,C,D,X( 6),X( 8),X(14),X( 3)); - BODY_32_39(39,D,E,T,A,B,C,X( 7),X( 9),X(15),X( 4)); - - BODY_40_59(40,C,D,E,T,A,B,X( 8),X(10),X( 0),X( 5)); - BODY_40_59(41,B,C,D,E,T,A,X( 9),X(11),X( 1),X( 6)); - BODY_40_59(42,A,B,C,D,E,T,X(10),X(12),X( 2),X( 7)); - BODY_40_59(43,T,A,B,C,D,E,X(11),X(13),X( 3),X( 8)); - BODY_40_59(44,E,T,A,B,C,D,X(12),X(14),X( 4),X( 9)); - BODY_40_59(45,D,E,T,A,B,C,X(13),X(15),X( 5),X(10)); - BODY_40_59(46,C,D,E,T,A,B,X(14),X( 0),X( 6),X(11)); - BODY_40_59(47,B,C,D,E,T,A,X(15),X( 1),X( 7),X(12)); - BODY_40_59(48,A,B,C,D,E,T,X( 0),X( 2),X( 8),X(13)); - BODY_40_59(49,T,A,B,C,D,E,X( 1),X( 3),X( 9),X(14)); - BODY_40_59(50,E,T,A,B,C,D,X( 2),X( 4),X(10),X(15)); - BODY_40_59(51,D,E,T,A,B,C,X( 3),X( 5),X(11),X( 0)); - BODY_40_59(52,C,D,E,T,A,B,X( 4),X( 6),X(12),X( 1)); - BODY_40_59(53,B,C,D,E,T,A,X( 5),X( 7),X(13),X( 2)); - BODY_40_59(54,A,B,C,D,E,T,X( 6),X( 8),X(14),X( 3)); - BODY_40_59(55,T,A,B,C,D,E,X( 7),X( 9),X(15),X( 4)); - BODY_40_59(56,E,T,A,B,C,D,X( 8),X(10),X( 0),X( 5)); - BODY_40_59(57,D,E,T,A,B,C,X( 9),X(11),X( 1),X( 6)); - BODY_40_59(58,C,D,E,T,A,B,X(10),X(12),X( 2),X( 7)); - BODY_40_59(59,B,C,D,E,T,A,X(11),X(13),X( 3),X( 8)); - - BODY_60_79(60,A,B,C,D,E,T,X(12),X(14),X( 4),X( 9)); - BODY_60_79(61,T,A,B,C,D,E,X(13),X(15),X( 5),X(10)); - BODY_60_79(62,E,T,A,B,C,D,X(14),X( 0),X( 6),X(11)); - BODY_60_79(63,D,E,T,A,B,C,X(15),X( 1),X( 7),X(12)); - BODY_60_79(64,C,D,E,T,A,B,X( 0),X( 2),X( 8),X(13)); - BODY_60_79(65,B,C,D,E,T,A,X( 1),X( 3),X( 9),X(14)); - BODY_60_79(66,A,B,C,D,E,T,X( 2),X( 4),X(10),X(15)); - BODY_60_79(67,T,A,B,C,D,E,X( 3),X( 5),X(11),X( 0)); - BODY_60_79(68,E,T,A,B,C,D,X( 4),X( 6),X(12),X( 1)); - BODY_60_79(69,D,E,T,A,B,C,X( 5),X( 7),X(13),X( 2)); - BODY_60_79(70,C,D,E,T,A,B,X( 6),X( 8),X(14),X( 3)); - BODY_60_79(71,B,C,D,E,T,A,X( 7),X( 9),X(15),X( 4)); - BODY_60_79(72,A,B,C,D,E,T,X( 8),X(10),X( 0),X( 5)); - BODY_60_79(73,T,A,B,C,D,E,X( 9),X(11),X( 1),X( 6)); - BODY_60_79(74,E,T,A,B,C,D,X(10),X(12),X( 2),X( 7)); - BODY_60_79(75,D,E,T,A,B,C,X(11),X(13),X( 3),X( 8)); - BODY_60_79(76,C,D,E,T,A,B,X(12),X(14),X( 4),X( 9)); - BODY_60_79(77,B,C,D,E,T,A,X(13),X(15),X( 5),X(10)); - BODY_60_79(78,A,B,C,D,E,T,X(14),X( 0),X( 6),X(11)); - BODY_60_79(79,T,A,B,C,D,E,X(15),X( 1),X( 7),X(12)); - - c->h0=(c->h0+E)&0xffffffffL; - c->h1=(c->h1+T)&0xffffffffL; - c->h2=(c->h2+A)&0xffffffffL; - c->h3=(c->h3+B)&0xffffffffL; - c->h4=(c->h4+C)&0xffffffffL; - - if (--num <= 0) break; - - A=c->h0; - B=c->h1; - C=c->h2; - D=c->h3; - E=c->h4; - - } - } -#endif ADDED Source/Exports/CommonCrypto.exp Index: Source/Exports/CommonCrypto.exp ================================================================== --- /dev/null +++ Source/Exports/CommonCrypto.exp @@ -0,0 +1,194 @@ +_CCAESCmac +_CCBigNumAdd +_CCBigNumAddI +_CCBigNumBitCount +_CCBigNumByteCount +_CCBigNumByteCount +_CCBigNumClear +_CCBigNumCompare +_CCBigNumCompareI +_CCBigNumCopy +_CCBigNumCreateRandom +_CCBigNumDiv +_CCBigNumDiv2 +_CCBigNumFree +_CCBigNumFromData +_CCBigNumFromHexString +_CCBigNumGCD +_CCBigNumGetI +_CCBigNumInverseMod +_CCBigNumIsNegative +_CCBigNumIsOdd +_CCBigNumIsPrime +_CCBigNumIsZero +_CCBigNumLCM +_CCBigNumLeftShift +_CCBigNumMod +_CCBigNumModExp +_CCBigNumModI +_CCBigNumMontgomeryNormalization +_CCBigNumMontgomeryReduce +_CCBigNumMontgomerySetup +_CCBigNumMul +_CCBigNumMulI +_CCBigNumMulMod +_CCBigNumRightShift +_CCBigNumSetI +_CCBigNumSetNegative +_CCBigNumSquare +_CCBigNumSquareMod +_CCBigNumSub +_CCBigNumSubI +_CCBigNumToData +_CCBigNumToHexString +_CCBigNumZeroLSBCount +_CCCalibratePBKDF +_CCCreateBigNum +_CCCrypt +_CCCryptorCreate +_CCCryptorCreateFromData +_CCCryptorCreateFromDataWithMode +_CCCryptorCreateWithMode +_CCCryptorDecryptDataBlock +_CCCryptorEncryptDataBlock +_CCCryptorFinal +_CCCryptorGCM +_CCCryptorGCMaddAAD +_CCCryptorGCMAddAAD +_CCCryptorGCMAddADD +_CCCryptorGCMAddIV +_CCCryptorGCMDecrypt +_CCCryptorGCMEncrypt +_CCCryptorGCMFinal +_CCCryptorGCMReset +_CCCryptorGetIV +_CCCryptorGetOutputLength +_CCCryptorRelease +_CCCryptorReset +_CCCryptorUpdate +_CCDHComputeKey +_CCDHCreate +_CCDHGenerateKey +_CCDHParametersCreateFromData +_CCDHParametersCreateFromPKCS3 +_CCDHParametersPKCS3EncodeLength +_CCDHParametersPKCS3Encode +_CCDHParametersRelease +_CCDHRelease +_CCDesCBCCksum +_CCDesIsWeakKey +_CCDesSetOddParity +_CCDigest +_CCDigestCreate +_CCDigestCreateByOID +_CCDigestDestroy +_CCDigestFinal +_CCDigestGetBlockSize +_CCDigestGetBlockSizeFromRef +_CCDigestGetOutputSize +_CCDigestOutputSize +_CCDigestGetOutputSizeFromRef +_CCDigestInit +_CCDigestOID +_CCDigestOIDLen +_CCDigestReset +_CCDigestUpdate +_CCECCryptorComputeSharedSecret +_CCECCryptorCreateFromData +_CCECCryptorExportKey +_CCECCryptorExportPublicKey +_CCECCryptorGeneratePair +_CCECCryptorGetKeyComponents +_CCECCryptorImportKey +_CCECCryptorImportPublicKey +_CCECCryptorRelease +_CCECCryptorSignHash +_CCECCryptorUnwrapKey +_CCECCryptorVerifyHash +_CCECCryptorWrapKey +_CCECGetKeySize +_CCECGetKeyType +_CCHmac +_CCHmacCreate +_CCHmacDestroy +_CCHmacFinal +_CCHmacInit +_CCHmacOutputSize +_CCHmacOutputSizeFromRef +_CCHmacUpdate +_CCKeyDerivationPBKDF +_CCRNGCreate +_CCRNGRelease +_CCRSACryptorCreateFromData +_CCRSACryptorCreatePairFromData +_CCRSACryptorCrypt +_CCRSACryptorDecrypt +_CCRSACryptorEncrypt +_CCRSACryptorExport +_CCRSACryptorGeneratePair +_CCRSACryptorImport +_CCRSACryptorRelease +_CCRSACryptorSign +_CCRSACryptorVerify +_CCRSAGetKeyComponents +_CCRSAGetKeySize +_CCRSAGetKeyType +_CCRandomCopyBytes +_CCSymmetricKeyUnwrap +_CCSymmetricKeyWrap +_CCSymmetricUnwrappedSize +_CCSymmetricWrappedSize +_CC_MD2 +_CC_MD2_Final +_CC_MD2_Init +_CC_MD2_Update +_CC_MD4 +_CC_MD4_Final +_CC_MD4_Init +_CC_MD4_Update +_CC_MD5 +_CC_MD5_Final +_CC_MD5_Init +_CC_MD5_Update +_CC_RC4 +_CC_RC4_set_key +_CC_SHA1 +_CC_SHA1_Final +_CC_SHA1_Init +_CC_SHA1_Update +_CC_SHA224 +_CC_SHA224_Final +_CC_SHA224_Init +_CC_SHA224_Update +_CC_SHA256 +_CC_SHA256_Final +_CC_SHA256_Init +_CC_SHA256_Update +_CC_SHA384 +_CC_SHA384_Final +_CC_SHA384_Init +_CC_SHA384_Update +_CC_SHA512 +_CC_SHA512_Final +_CC_SHA512_Init +_CC_SHA512_Update +_CCrfc3394_iv +_CCrfc3394_ivLen +_aes_decrypt_cbc +_aes_decrypt_key128 +_aes_decrypt_key256 +_aes_encrypt_cbc +_aes_encrypt_key128 +_aes_encrypt_key256 +_ccDRBGGetRngState +_ccDevRandomGetRngState +_kCCRandomDefault +_kCCRandomDevRandom +_kCCDHRFC2409Group2 +_kCCDHRFC3526Group5 +_CCDigestBlockSize +_CAST_ecb_encrypt +_CAST_set_key +_MD5Final + + ADDED Source/Exports/CommonCryptoIOS5.exp Index: Source/Exports/CommonCryptoIOS5.exp ================================================================== --- /dev/null +++ Source/Exports/CommonCryptoIOS5.exp @@ -0,0 +1,192 @@ +_CCAESCmac +_CCBigNumAdd +_CCBigNumAddI +_CCBigNumBitCount +_CCBigNumByteCount +_CCBigNumByteCount +_CCBigNumClear +_CCBigNumCompare +_CCBigNumCompareI +_CCBigNumCopy +_CCBigNumCreateRandom +_CCBigNumDiv +_CCBigNumDiv2 +_CCBigNumFree +_CCBigNumFromData +_CCBigNumFromHexString +_CCBigNumGCD +_CCBigNumGetI +_CCBigNumInverseMod +_CCBigNumIsNegative +_CCBigNumIsOdd +_CCBigNumIsPrime +_CCBigNumIsZero +_CCBigNumLCM +_CCBigNumLeftShift +_CCBigNumMod +_CCBigNumModExp +_CCBigNumModI +_CCBigNumMontgomeryNormalization +_CCBigNumMontgomeryReduce +_CCBigNumMontgomerySetup +_CCBigNumMul +_CCBigNumMulI +_CCBigNumMulMod +_CCBigNumRightShift +_CCBigNumSetI +_CCBigNumSetNegative +_CCBigNumSquare +_CCBigNumSquareMod +_CCBigNumSub +_CCBigNumSubI +_CCBigNumToData +_CCBigNumToHexString +_CCBigNumZeroLSBCount +_CCCalibratePBKDF +_CCCreateBigNum +_CCCrypt +_CCCryptorCreate +_CCCryptorCreateFromData +_CCCryptorCreateFromDataWithMode +_CCCryptorCreateWithMode +_CCCryptorDecryptDataBlock +_CCCryptorEncryptDataBlock +_CCCryptorFinal +_CCCryptorGCM +_CCCryptorGCMaddAAD +_CCCryptorGCMAddAAD +_CCCryptorGCMAddADD +_CCCryptorGCMAddIV +_CCCryptorGCMDecrypt +_CCCryptorGCMEncrypt +_CCCryptorGCMFinal +_CCCryptorGCMReset +_CCCryptorGetIV +_CCCryptorGetOutputLength +_CCCryptorRelease +_CCCryptorReset +_CCCryptorUpdate +_CCDHComputeKey +_CCDHCreate +_CCDHGenerateKey +_CCDHParametersCreateFromData +_CCDHParametersCreateFromPKCS3 +_CCDHParametersPKCS3EncodeLength +_CCDHParametersPKCS3Encode +_CCDHParametersRelease +_CCDHRelease +_CCDesCBCCksum +_CCDesIsWeakKey +_CCDesSetOddParity +_CCDigest +_CCDigestCreate +_CCDigestCreateByOID +_CCDigestDestroy +_CCDigestFinal +_CCDigestGetBlockSize +_CCDigestGetBlockSizeFromRef +_CCDigestGetOutputSize +_CCDigestOutputSize +_CCDigestGetOutputSizeFromRef +_CCDigestInit +_CCDigestOID +_CCDigestOIDLen +_CCDigestReset +_CCDigestUpdate +_CCECCryptorComputeSharedSecret +_CCECCryptorCreateFromData +_CCECCryptorExportKey +_CCECCryptorExportPublicKey +_CCECCryptorGeneratePair +_CCECCryptorGetKeyComponents +_CCECCryptorImportKey +_CCECCryptorImportPublicKey +_CCECCryptorRelease +_CCECCryptorSignHash +_CCECCryptorUnwrapKey +_CCECCryptorVerifyHash +_CCECCryptorWrapKey +_CCECGetKeySize +_CCECGetKeyType +_CCHmac +_CCHmacCreate +_CCHmacDestroy +_CCHmacFinal +_CCHmacInit +_CCHmacOutputSize +_CCHmacOutputSizeFromRef +_CCHmacUpdate +_CCKeyDerivationPBKDF +_CCRNGCreate +_CCRNGRelease +_CCRSACryptorCreateFromData +_CCRSACryptorCreatePairFromData +_CCRSACryptorCrypt +_CCRSACryptorDecrypt +_CCRSACryptorEncrypt +_CCRSACryptorExport +_CCRSACryptorGeneratePair +_CCRSACryptorImport +_CCRSACryptorRelease +_CCRSACryptorSign +_CCRSACryptorVerify +_CCRSAGetKeyComponents +_CCRSAGetKeySize +_CCRSAGetKeyType +_CCRandomCopyBytes +_CCSymmetricKeyUnwrap +_CCSymmetricKeyWrap +_CCSymmetricUnwrappedSize +_CCSymmetricWrappedSize +_CC_MD2 +_CC_MD2_Final +_CC_MD2_Init +_CC_MD2_Update +_CC_MD4 +_CC_MD4_Final +_CC_MD4_Init +_CC_MD4_Update +_CC_MD5 +_CC_MD5_Final +_CC_MD5_Init +_CC_MD5_Update +_CC_RC4 +_CC_RC4_set_key +_CC_SHA1 +_CC_SHA1_Final +_CC_SHA1_Init +_CC_SHA1_Update +_CC_SHA224 +_CC_SHA224_Final +_CC_SHA224_Init +_CC_SHA224_Update +_CC_SHA256 +_CC_SHA256_Final +_CC_SHA256_Init +_CC_SHA256_Update +_CC_SHA384 +_CC_SHA384_Final +_CC_SHA384_Init +_CC_SHA384_Update +_CC_SHA512 +_CC_SHA512_Final +_CC_SHA512_Init +_CC_SHA512_Update +_CCrfc3394_iv +_CCrfc3394_ivLen +_aes_decrypt_cbc +_aes_decrypt_key128 +_aes_decrypt_key256 +_aes_encrypt_cbc +_aes_encrypt_key128 +_aes_encrypt_key256 +_ccDRBGGetRngState +_ccDevRandomGetRngState +_kCCRandomDefault +_kCCRandomDevRandom +_kCCDHRFC2409Group2 +_kCCDHRFC3526Group5 +_CCDigestBlockSize +_MD5Final + + DELETED Source/GladmanAES/README Index: Source/GladmanAES/README ================================================================== --- Source/GladmanAES/README +++ /dev/null @@ -1,6 +0,0 @@ -This AES implementation is based on the Gladman implementation in xnu-863. - -The C files in this directory have been modified to produce no object code -unless the preprocessor symbol UseGladmanAES is defined (in aesopt.h). If the -symbol is not defined, there some other AES implementation (such as AESedp) -must be supplied elsewhere in the build. DELETED Source/GladmanAES/aescrypt.c Index: Source/GladmanAES/aescrypt.c ================================================================== --- Source/GladmanAES/aescrypt.c +++ /dev/null @@ -1,496 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 28/01/2004 - - This file contains the code for implementing encryption and decryption - for AES (Rijndael) for block and key sizes of 16, 24 and 32 bytes. It - can optionally be replaced by code written in assembler using NASM. For - further details see the file aesopt.h -*/ - -#include -#include "aestab.h" -#include - -/* Produce object code iff UseGladmanAES is defined. Otherwise, suppress - use of this module, because some other AES implementation is being used. -*/ -#if defined UseGladmanAES - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#define ki(y,x,k,c) (s(y,c) = s(x, c) ^ (k)[c]) -#define xo(y,x,c) (s(y,c) ^= s(x, c)) -#define si(y,x,c) (s(y,c) = word_in(x, c)) -#define so(y,x,c) word_out(y, c, s(x,c)) - -#if defined(ARRAYS) -#define locals(y,x) x[4],y[4] -#else -#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3 -#endif - -#define dtables(tab) const aes_32t *tab##0, *tab##1, *tab##2, *tab##3 -#define itables(tab) tab##0 = tab[0]; tab##1 = tab[1]; tab##2 = tab[2]; tab##3 = tab[3] - -#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \ - s(y,2) = s(x,2); s(y,3) = s(x,3); - -#define key_in(y,x,k) ki(y,x,k,0); ki(y,x,k,1); ki(y,x,k,2); ki(y,x,k,3) -#define cbc(y,x) xo(y,x,0); xo(y,x,1); xo(y,x,2); xo(y,x,3) -#define state_in(y,x) si(y,x,0); si(y,x,1); si(y,x,2); si(y,x,3) -#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3) -#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3) - -#if defined(ENCRYPTION) && !defined(AES_ASM) - -/* Visual C++ .Net v7.1 provides the fastest encryption code when using - Pentium optimiation with small code but this is poor for decryption - so we need to control this with the following VC++ pragmas -*/ - -#if defined(_MSC_VER) -#pragma optimize( "s", on ) -#endif - -/* Given the column (c) of the output state variable, the following - macros give the input state variables which are needed in its - computation for each row (r) of the state. All the alternative - macros give the same end values but expand into different ways - of calculating these values. In particular the complex macro - used for dynamically variable block sizes is designed to expand - to a compile time constant whenever possible but will expand to - conditional clauses on some branches (I am grateful to Frank - Yellin for this construction) -*/ - -#define fwd_var(x,r,c)\ - ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\ - : r == 1 ? ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))\ - : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\ - : ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))) - -#if defined(FT4_SET) -#undef dec_fmvars -# if defined(ENC_ROUND_CACHE_TABLES) -#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_cached_tables(x,t_fn,fwd_var,rf1,c)) -# else -#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_fn,fwd_var,rf1,c)) -# endif -#elif defined(FT1_SET) -#undef dec_fmvars -#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_fn,fwd_var,rf1,c)) -#else -#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ fwd_mcol(no_table(x,t_sbox,fwd_var,rf1,c))) -#endif - -#if defined(FL4_SET) -# if defined(LAST_ENC_ROUND_CACHE_TABLES) -#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_cached_tables(x,t_fl,fwd_var,rf1,c)) -# else -#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_fl,fwd_var,rf1,c)) -# endif -#elif defined(FL1_SET) -#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_fl,fwd_var,rf1,c)) -#else -#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_sbox,fwd_var,rf1,c)) -#endif - -aes_rval aes_encrypt_cbc(const unsigned char *in, const unsigned char *in_iv, unsigned int num_blk, - unsigned char *out, aes_encrypt_ctx cx[1]) -{ aes_32t locals(b0, b1); - const aes_32t *kp; - const aes_32t *kptr = cx->ks; - #ifdef _APPLE_COMMON_CRYPTO_ - int cbcEnable = (cx->cbcEnable || in_iv) ? 1 : 0; - #endif - -#if defined(ENC_ROUND_CACHE_TABLES) - dtables(t_fn); -#endif -#if defined(LAST_ENC_ROUND_CACHE_TABLES) - dtables(t_fl); -#endif - -#if defined( dec_fmvars ) - dec_fmvars; /* declare variables for fwd_mcol() if needed */ -#endif - -#if defined( AES_ERR_CHK ) - if( cx->rn != 10 && cx->rn != 12 && cx->rn != 14 ) - return aes_error; -#endif - - // Load IV into b0. - #ifdef _APPLE_COMMON_CRYPTO_ - if(in_iv) { - state_in(b0, in_iv); - } - else { - state_in(b0, cx->chainBuf); - } - #else - state_in(b0, in_iv); - #endif /* _APPLE_COMMON_CRYPTO_ */ - - for (;num_blk; in += AES_BLOCK_SIZE, out += AES_BLOCK_SIZE, --num_blk) - { - kp = kptr; -#if 0 - // Read the plaintext into b1 - state_in(b1, in); - #ifdef _APPLE_COMMON_CRYPTO_ - if(cbcEnable) { - #endif - // Do the CBC with b0 which is either the iv or the ciphertext of the - // previous block. - cbc(b1, b0); - #ifdef _APPLE_COMMON_CRYPTO_ - } - #endif - - // Xor b1 with the key schedule to get things started. - key_in(b0, b1, kp); -#else - #ifdef _APPLE_COMMON_CRYPTO_ - if(cbcEnable) { - #endif - // Since xor is associative we mess with the ordering here to get - // the loads started early - key_in(b1, b0, kp); // Xor b0(IV) with the key schedule and assign to b1 - state_in(b0, in); // Load block into b0 - cbc(b0, b1); // Xor b0 with b1 and store in b0 - #ifdef _APPLE_COMMON_CRYPTO_ - } - else { - // Read the plaintext into b1 - state_in(b1, in); - key_in(b0, b1, kp); - } - #endif /* _APPLE_COMMON_CRYPTO_ */ -#endif /* 0 */ - -#if defined(ENC_ROUND_CACHE_TABLES) - itables(t_fn); -#endif - -#if (ENC_UNROLL == FULL) - - switch(cx->rn) - { - case 14: - round(fwd_rnd, b1, b0, kp + 1 * N_COLS); - round(fwd_rnd, b0, b1, kp + 2 * N_COLS); - kp += 2 * N_COLS; - case 12: - round(fwd_rnd, b1, b0, kp + 1 * N_COLS); - round(fwd_rnd, b0, b1, kp + 2 * N_COLS); - kp += 2 * N_COLS; - case 10: - default: - round(fwd_rnd, b1, b0, kp + 1 * N_COLS); - round(fwd_rnd, b0, b1, kp + 2 * N_COLS); - round(fwd_rnd, b1, b0, kp + 3 * N_COLS); - round(fwd_rnd, b0, b1, kp + 4 * N_COLS); - round(fwd_rnd, b1, b0, kp + 5 * N_COLS); - round(fwd_rnd, b0, b1, kp + 6 * N_COLS); - round(fwd_rnd, b1, b0, kp + 7 * N_COLS); - round(fwd_rnd, b0, b1, kp + 8 * N_COLS); - round(fwd_rnd, b1, b0, kp + 9 * N_COLS); -#if defined(LAST_ENC_ROUND_CACHE_TABLES) - itables(t_fl); -#endif - round(fwd_lrnd, b0, b1, kp +10 * N_COLS); - } - -#else - - { aes_32t rnd; -#if (ENC_UNROLL == PARTIAL) - for(rnd = 0; rnd < (cx->rn >> 1) - 1; ++rnd) - { - kp += N_COLS; - round(fwd_rnd, b1, b0, kp); - kp += N_COLS; - round(fwd_rnd, b0, b1, kp); - } - kp += N_COLS; - round(fwd_rnd, b1, b0, kp); -#else - for(rnd = 0; rnd < cx->rn - 1; ++rnd) - { - kp += N_COLS; - round(fwd_rnd, b1, b0, kp); - l_copy(b0, b1); - } -#endif -#if defined(LAST_ENC_ROUND_CACHE_TABLES) - itables(t_fl); -#endif - kp += N_COLS; - round(fwd_lrnd, b0, b1, kp); - } -#endif - - state_out(out, b0); - } - - #ifdef _APPLE_COMMON_CRYPTO_ - if(cbcEnable) { - state_out(cx->chainBuf, b0); - } - #endif - -#if defined( AES_ERR_CHK ) - return aes_good; -#endif -} - -#endif - -#if defined(DECRYPTION) && !defined(AES_ASM) - -/* Visual C++ .Net v7.1 provides the fastest encryption code when using - Pentium optimiation with small code but this is poor for decryption - so we need to control this with the following VC++ pragmas -*/ - -#if defined(_MSC_VER) -#pragma optimize( "t", on ) -#endif - -/* Given the column (c) of the output state variable, the following - macros give the input state variables which are needed in its - computation for each row (r) of the state. All the alternative - macros give the same end values but expand into different ways - of calculating these values. In particular the complex macro - used for dynamically variable block sizes is designed to expand - to a compile time constant whenever possible but will expand to - conditional clauses on some branches (I am grateful to Frank - Yellin for this construction) -*/ - -#define inv_var(x,r,c)\ - ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\ - : r == 1 ? ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))\ - : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\ - : ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))) - -#if defined(IT4_SET) -#undef dec_imvars -# if defined(DEC_ROUND_CACHE_TABLES) -#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_cached_tables(x,t_in,inv_var,rf1,c)) -# else -#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_in,inv_var,rf1,c)) -# endif -#elif defined(IT1_SET) -#undef dec_imvars -#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_in,inv_var,rf1,c)) -#else -#define inv_rnd(y,x,k,c) (s(y,c) = inv_mcol((k)[c] ^ no_table(x,t_ibox,inv_var,rf1,c))) -#endif - -#if defined(IL4_SET) -# if defined(LAST_DEC_ROUND_CACHE_TABLES) -#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_cached_tables(x,t_il,inv_var,rf1,c)) -# else -#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_il,inv_var,rf1,c)) -# endif -#elif defined(IL1_SET) -#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_il,inv_var,rf1,c)) -#else -#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_ibox,inv_var,rf1,c)) -#endif - - -aes_rval aes_decrypt_cbc(const unsigned char *in, const unsigned char *in_iv, unsigned int num_blk, - unsigned char *out, aes_decrypt_ctx cx[1]) -{ aes_32t locals(b0, b1); - const aes_32t *kptr = cx->ks + cx->rn * N_COLS; - const aes_32t *kp; -#if defined(DEC_ROUND_CACHE_TABLES) - dtables(t_in); -#endif -#if defined(LAST_DEC_ROUND_CACHE_TABLES) - dtables(t_il); -#endif - #ifdef _APPLE_COMMON_CRYPTO_ - int cbcEnable = (cx->cbcEnable || in_iv) ? 1 : 0; - unsigned char lastIv[AES_BLOCK_SIZE]; - - /* fix a compiler warning... */ - b00 = 0; b01 = 0; b02=0; b03 = 0; - #endif - -#if defined( dec_imvars ) - dec_imvars; /* declare variables for inv_mcol() if needed */ -#endif - -#if defined( AES_ERR_CHK ) - if( cx->rn != 10 && cx->rn != 12 && cx->rn != 14 ) - return aes_error; -#endif - -#if defined(DEC_ROUND_CACHE_TABLES) - itables(t_in); -#endif - - in += AES_BLOCK_SIZE * (num_blk - 1); - out += AES_BLOCK_SIZE * (num_blk - 1); - // Load the last block's ciphertext into b1 - state_in(b1, in); - - #ifdef _APPLE_COMMON_CRYPTO_ - /* save that last ciphertext block for next op's chain */ - if(cbcEnable & (num_blk != 0)) { - memmove(lastIv, in, AES_BLOCK_SIZE); - } - #endif - - for (;num_blk; out -= AES_BLOCK_SIZE, --num_blk) - { - kp = kptr; - // Do the xor part of state_in, where b1 is the previous block's ciphertext. - key_in(b0, b1, kp); - -#if (DEC_UNROLL == FULL) - - switch(cx->rn) - { - case 14: - round(inv_rnd, b1, b0, kp - 1 * N_COLS); - round(inv_rnd, b0, b1, kp - 2 * N_COLS); - kp -= 2 * N_COLS; - case 12: - round(inv_rnd, b1, b0, kp - 1 * N_COLS); - round(inv_rnd, b0, b1, kp - 2 * N_COLS); - kp -= 2 * N_COLS; - case 10: - default: - round(inv_rnd, b1, b0, kp - 1 * N_COLS); - round(inv_rnd, b0, b1, kp - 2 * N_COLS); - round(inv_rnd, b1, b0, kp - 3 * N_COLS); - round(inv_rnd, b0, b1, kp - 4 * N_COLS); - round(inv_rnd, b1, b0, kp - 5 * N_COLS); - round(inv_rnd, b0, b1, kp - 6 * N_COLS); - round(inv_rnd, b1, b0, kp - 7 * N_COLS); - round(inv_rnd, b0, b1, kp - 8 * N_COLS); - round(inv_rnd, b1, b0, kp - 9 * N_COLS); -#if defined(LAST_DEC_ROUND_CACHE_TABLES) - itables(t_il); -#endif - round(inv_lrnd, b0, b1, kp - 10 * N_COLS); - } - -#else - - { aes_32t rnd; -#if (DEC_UNROLL == PARTIAL) - for(rnd = 0; rnd < (cx->rn >> 1) - 1; ++rnd) - { - kp -= N_COLS; - round(inv_rnd, b1, b0, kp); - kp -= N_COLS; - round(inv_rnd, b0, b1, kp); - } - kp -= N_COLS; - round(inv_rnd, b1, b0, kp); -#else - for(rnd = 0; rnd < cx->rn - 1; ++rnd) - { - kp -= N_COLS; - round(inv_rnd, b1, b0, kp); - l_copy(b0, b1); - } -#endif -#if defined(LAST_DEC_ROUND_CACHE_TABLES) - itables(t_il); -#endif - kp -= N_COLS; - round(inv_lrnd, b0, b1, kp); - } -#endif - - #ifdef _APPLE_COMMON_CRYPTO_ - if(cbcEnable) { - if (num_blk == 1) - { - // We are doing the first block so we need the IV rather than the previous - // block for CBC (there is no previous block) - if(in_iv) { - state_in(b1, in_iv); - } - else { - state_in(b1, cx->chainBuf); - } - } - else - { - in -= AES_BLOCK_SIZE; - state_in(b1, in); - } - - // Do the CBC with b1 which is either the IV or the ciphertext of - // the previous block. - cbc(b0, b1); - } - else { - if (num_blk != 1) { - /* skip this the last time through */ - in -= AES_BLOCK_SIZE; - state_in(b1, in); - } - } - #endif /* _APPLE_COMMON_CRYPTO_ */ - state_out(out, b0); - } - - #ifdef _APPLE_COMMON_CRYPTO_ - /* save last ciphertext block for next op's chain */ - if(cbcEnable) { - memmove(cx->chainBuf, lastIv, AES_BLOCK_SIZE); - } - #endif - -#if defined( AES_ERR_CHK ) - return aes_good; -#endif -} - -#endif - -#if defined(__cplusplus) -} -#endif - -#endif // defined UseGladmanAES DELETED Source/GladmanAES/aeskey.c Index: Source/GladmanAES/aeskey.c ================================================================== --- Source/GladmanAES/aeskey.c +++ /dev/null @@ -1,488 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 26/08/2003 - - This file contains the code for implementing the key schedule for AES - (Rijndael) for block and key sizes of 16, 24, and 32 bytes. See aesopt.h - for further details including optimisation. -*/ - -#include -#include "aestab.h" -#include - -/* Produce object code iff UseGladmanAES is defined. Otherwise, suppress - use of this module, because some other AES implementation is being used. -*/ -#if defined UseGladmanAES - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* Initialise the key schedule from the user supplied key. The key - length can be specified in bytes, with legal values of 16, 24 - and 32, or in bits, with legal values of 128, 192 and 256. These - values correspond with Nk values of 4, 6 and 8 respectively. - - The following macros implement a single cycle in the key - schedule generation process. The number of cycles needed - for each cx->n_col and nk value is: - - nk = 4 5 6 7 8 - ------------------------------ - cx->n_col = 4 10 9 8 7 7 - cx->n_col = 5 14 11 10 9 9 - cx->n_col = 6 19 15 12 11 11 - cx->n_col = 7 21 19 16 13 14 - cx->n_col = 8 29 23 19 17 14 -*/ - -#define ke4(k,i) \ -{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \ - k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \ -} -#define kel4(k,i) \ -{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \ - k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \ -} - -#define ke6(k,i) \ -{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \ - k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \ - k[6*(i)+10] = ss[4] ^= ss[3]; k[6*(i)+11] = ss[5] ^= ss[4]; \ -} -#define kel6(k,i) \ -{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \ - k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \ -} - -#define ke8(k,i) \ -{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \ - k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \ - k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); k[8*(i)+13] = ss[5] ^= ss[4]; \ - k[8*(i)+14] = ss[6] ^= ss[5]; k[8*(i)+15] = ss[7] ^= ss[6]; \ -} -#define kel8(k,i) \ -{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \ - k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \ -} - -#if defined(ENCRYPTION_KEY_SCHEDULE) - -#if defined(AES_128) || defined(AES_VAR) - -aes_rval aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]) -{ aes_32t ss[4]; - - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - -#if ENC_UNROLL == NONE - { aes_32t i; - - for(i = 0; i < ((11 * N_COLS - 5) / 4); ++i) - ke4(cx->ks, i); - } -#else - ke4(cx->ks, 0); ke4(cx->ks, 1); - ke4(cx->ks, 2); ke4(cx->ks, 3); - ke4(cx->ks, 4); ke4(cx->ks, 5); - ke4(cx->ks, 6); ke4(cx->ks, 7); - ke4(cx->ks, 8); -#endif - kel4(cx->ks, 9); - cx->rn = 10; - #if CC_AES_USE_HARDWARE - bcopy(key, cx->keyBytes, 16); - cx->keyLength = 16; - #endif -#if defined( AES_ERR_CHK ) - return aes_good; -#endif -} - -#endif - -#if defined(AES_192) || defined(AES_VAR) - -aes_rval aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]) -{ aes_32t ss[6]; - - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - cx->ks[4] = ss[4] = word_in(key, 4); - cx->ks[5] = ss[5] = word_in(key, 5); - -#if ENC_UNROLL == NONE - { aes_32t i; - - for(i = 0; i < (13 * N_COLS - 7) / 6; ++i) - ke6(cx->ks, i); - } -#else - ke6(cx->ks, 0); ke6(cx->ks, 1); - ke6(cx->ks, 2); ke6(cx->ks, 3); - ke6(cx->ks, 4); ke6(cx->ks, 5); - ke6(cx->ks, 6); -#endif - kel6(cx->ks, 7); - cx->rn = 12; - #if CC_AES_USE_HARDWARE - bcopy(key, cx->keyBytes, 24); - cx->keyLength = 24; - #endif -#if defined( AES_ERR_CHK ) - return aes_good; -#endif -} - -#endif - -#if defined(AES_256) || defined(AES_VAR) - -aes_rval aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]) -{ aes_32t ss[8]; - - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - cx->ks[4] = ss[4] = word_in(key, 4); - cx->ks[5] = ss[5] = word_in(key, 5); - cx->ks[6] = ss[6] = word_in(key, 6); - cx->ks[7] = ss[7] = word_in(key, 7); - -#if ENC_UNROLL == NONE - { aes_32t i; - - for(i = 0; i < (15 * N_COLS - 9) / 8; ++i) - ke8(cx->ks, i); - } -#else - ke8(cx->ks, 0); ke8(cx->ks, 1); - ke8(cx->ks, 2); ke8(cx->ks, 3); - ke8(cx->ks, 4); ke8(cx->ks, 5); -#endif - kel8(cx->ks, 6); - cx->rn = 14; - #if CC_AES_USE_HARDWARE - bcopy(key, cx->keyBytes, 32); - cx->keyLength = 32; - #endif -#if defined( AES_ERR_CHK ) - return aes_good; -#endif -} - -#endif - -#if defined(AES_VAR) - -aes_rval aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]) -{ - switch(key_len) - { -#if defined( AES_ERR_CHK ) - case 16: case 128: return aes_encrypt_key128(key, cx); - case 24: case 192: return aes_encrypt_key192(key, cx); - case 32: case 256: return aes_encrypt_key256(key, cx); - default: return aes_error; -#else - case 16: case 128: aes_encrypt_key128(key, cx); return; - case 24: case 192: aes_encrypt_key192(key, cx); return; - case 32: case 256: aes_encrypt_key256(key, cx); return; -#endif - } -} - -#endif - -#endif - -#if defined(DECRYPTION_KEY_SCHEDULE) - -#if DEC_ROUND == NO_TABLES -#define ff(x) (x) -#else -#define ff(x) inv_mcol(x) -#if defined( dec_imvars ) -#define d_vars dec_imvars -#endif -#endif - -#if 1 -#define kdf4(k,i) \ -{ ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; ss[1] = ss[1] ^ ss[3]; ss[2] = ss[2] ^ ss[3]; ss[3] = ss[3]; \ - ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \ - ss[4] ^= k[4*(i)]; k[4*(i)+4] = ff(ss[4]); ss[4] ^= k[4*(i)+1]; k[4*(i)+5] = ff(ss[4]); \ - ss[4] ^= k[4*(i)+2]; k[4*(i)+6] = ff(ss[4]); ss[4] ^= k[4*(i)+3]; k[4*(i)+7] = ff(ss[4]); \ -} -#define kd4(k,i) \ -{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \ - k[4*(i)+4] = ss[4] ^= k[4*(i)]; k[4*(i)+5] = ss[4] ^= k[4*(i)+1]; \ - k[4*(i)+6] = ss[4] ^= k[4*(i)+2]; k[4*(i)+7] = ss[4] ^= k[4*(i)+3]; \ -} -#define kdl4(k,i) \ -{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \ - k[4*(i)+4] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; k[4*(i)+5] = ss[1] ^ ss[3]; \ - k[4*(i)+6] = ss[0]; k[4*(i)+7] = ss[1]; \ -} -#else -#define kdf4(k,i) \ -{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+ 4] = ff(ss[0]); ss[1] ^= ss[0]; k[4*(i)+ 5] = ff(ss[1]); \ - ss[2] ^= ss[1]; k[4*(i)+ 6] = ff(ss[2]); ss[3] ^= ss[2]; k[4*(i)+ 7] = ff(ss[3]); \ -} -#define kd4(k,i) \ -{ ss[4] = ls_box(ss[3],3) ^ t_use(r,c)[i]; \ - ss[0] ^= ss[4]; ss[4] = ff(ss[4]); k[4*(i)+ 4] = ss[4] ^= k[4*(i)]; \ - ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[4] ^= k[4*(i)+ 1]; \ - ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[4] ^= k[4*(i)+ 2]; \ - ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[4] ^= k[4*(i)+ 3]; \ -} -#define kdl4(k,i) \ -{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+ 4] = ss[0]; ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[1]; \ - ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[2]; ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[3]; \ -} -#endif - -#define kdf6(k,i) \ -{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 6] = ff(ss[0]); ss[1] ^= ss[0]; k[6*(i)+ 7] = ff(ss[1]); \ - ss[2] ^= ss[1]; k[6*(i)+ 8] = ff(ss[2]); ss[3] ^= ss[2]; k[6*(i)+ 9] = ff(ss[3]); \ - ss[4] ^= ss[3]; k[6*(i)+10] = ff(ss[4]); ss[5] ^= ss[4]; k[6*(i)+11] = ff(ss[5]); \ -} -#define kd6(k,i) \ -{ ss[6] = ls_box(ss[5],3) ^ t_use(r,c)[i]; \ - ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[6*(i)+ 6] = ss[6] ^= k[6*(i)]; \ - ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[6] ^= k[6*(i)+ 1]; \ - ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[6] ^= k[6*(i)+ 2]; \ - ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[6] ^= k[6*(i)+ 3]; \ - ss[4] ^= ss[3]; k[6*(i)+10] = ss[6] ^= k[6*(i)+ 4]; \ - ss[5] ^= ss[4]; k[6*(i)+11] = ss[6] ^= k[6*(i)+ 5]; \ -} -#define kdl6(k,i) \ -{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 6] = ss[0]; ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[1]; \ - ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[2]; ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[3]; \ -} - -#define kdf8(k,i) \ -{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 8] = ff(ss[0]); ss[1] ^= ss[0]; k[8*(i)+ 9] = ff(ss[1]); \ - ss[2] ^= ss[1]; k[8*(i)+10] = ff(ss[2]); ss[3] ^= ss[2]; k[8*(i)+11] = ff(ss[3]); \ - ss[4] ^= ls_box(ss[3],0); k[8*(i)+12] = ff(ss[4]); ss[5] ^= ss[4]; k[8*(i)+13] = ff(ss[5]); \ - ss[6] ^= ss[5]; k[8*(i)+14] = ff(ss[6]); ss[7] ^= ss[6]; k[8*(i)+15] = ff(ss[7]); \ -} -#define kd8(k,i) \ -{ aes_32t g = ls_box(ss[7],3) ^ t_use(r,c)[i]; \ - ss[0] ^= g; g = ff(g); k[8*(i)+ 8] = g ^= k[8*(i)]; \ - ss[1] ^= ss[0]; k[8*(i)+ 9] = g ^= k[8*(i)+ 1]; \ - ss[2] ^= ss[1]; k[8*(i)+10] = g ^= k[8*(i)+ 2]; \ - ss[3] ^= ss[2]; k[8*(i)+11] = g ^= k[8*(i)+ 3]; \ - g = ls_box(ss[3],0); \ - ss[4] ^= g; g = ff(g); k[8*(i)+12] = g ^= k[8*(i)+ 4]; \ - ss[5] ^= ss[4]; k[8*(i)+13] = g ^= k[8*(i)+ 5]; \ - ss[6] ^= ss[5]; k[8*(i)+14] = g ^= k[8*(i)+ 6]; \ - ss[7] ^= ss[6]; k[8*(i)+15] = g ^= k[8*(i)+ 7]; \ -} -#define kdl8(k,i) \ -{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 8] = ss[0]; ss[1] ^= ss[0]; k[8*(i)+ 9] = ss[1]; \ - ss[2] ^= ss[1]; k[8*(i)+10] = ss[2]; ss[3] ^= ss[2]; k[8*(i)+11] = ss[3]; \ -} - -#if defined(AES_128) || defined(AES_VAR) - -aes_rval aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]) -{ aes_32t ss[5]; -#if defined( d_vars ) - d_vars; -#endif - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - -#if DEC_UNROLL == NONE - { aes_32t i; - - for(i = 0; i < (11 * N_COLS - 5) / 4; ++i) - ke4(cx->ks, i); - kel4(cx->ks, 9); -#if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 10 * N_COLS; ++i) - cx->ks[i] = inv_mcol(cx->ks[i]); -#endif - } -#else - kdf4(cx->ks, 0); kd4(cx->ks, 1); - kd4(cx->ks, 2); kd4(cx->ks, 3); - kd4(cx->ks, 4); kd4(cx->ks, 5); - kd4(cx->ks, 6); kd4(cx->ks, 7); - kd4(cx->ks, 8); kdl4(cx->ks, 9); -#endif - cx->rn = 10; - #if CC_AES_USE_HARDWARE - bcopy(key, cx->keyBytes, 16); - cx->keyLength = 16; - #endif -#if defined( AES_ERR_CHK ) - return aes_good; -#endif -} - -#endif - -#if defined(AES_192) || defined(AES_VAR) - -aes_rval aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]) -{ aes_32t ss[7]; -#if defined( d_vars ) - d_vars; -#endif - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - -#if DEC_UNROLL == NONE - cx->ks[4] = ss[4] = word_in(key, 4); - cx->ks[5] = ss[5] = word_in(key, 5); - { aes_32t i; - - for(i = 0; i < (13 * N_COLS - 7) / 6; ++i) - ke6(cx->ks, i); - kel6(cx->ks, 7); -#if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 12 * N_COLS; ++i) - cx->ks[i] = inv_mcol(cx->ks[i]); -#endif - } -#else - cx->ks[4] = ff(ss[4] = word_in(key, 4)); - cx->ks[5] = ff(ss[5] = word_in(key, 5)); - kdf6(cx->ks, 0); kd6(cx->ks, 1); - kd6(cx->ks, 2); kd6(cx->ks, 3); - kd6(cx->ks, 4); kd6(cx->ks, 5); - kd6(cx->ks, 6); kdl6(cx->ks, 7); -#endif - cx->rn = 12; - #if CC_AES_USE_HARDWARE - bcopy(key, cx->keyBytes, 24); - cx->keyLength = 24; - #endif -#if defined( AES_ERR_CHK ) - return aes_good; -#endif -} - -#endif - -#if defined(AES_256) || defined(AES_VAR) - -aes_rval aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]) -{ aes_32t ss[8]; -#if defined( d_vars ) - d_vars; -#endif - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - -#if DEC_UNROLL == NONE - cx->ks[4] = ss[4] = word_in(key, 4); - cx->ks[5] = ss[5] = word_in(key, 5); - cx->ks[6] = ss[6] = word_in(key, 6); - cx->ks[7] = ss[7] = word_in(key, 7); - { aes_32t i; - - for(i = 0; i < (15 * N_COLS - 9) / 8; ++i) - ke8(cx->ks, i); - kel8(cx->ks, i); -#if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 14 * N_COLS; ++i) - cx->ks[i] = inv_mcol(cx->ks[i]); - -#endif - } -#else - cx->ks[4] = ff(ss[4] = word_in(key, 4)); - cx->ks[5] = ff(ss[5] = word_in(key, 5)); - cx->ks[6] = ff(ss[6] = word_in(key, 6)); - cx->ks[7] = ff(ss[7] = word_in(key, 7)); - kdf8(cx->ks, 0); kd8(cx->ks, 1); - kd8(cx->ks, 2); kd8(cx->ks, 3); - kd8(cx->ks, 4); kd8(cx->ks, 5); - kdl8(cx->ks, 6); -#endif - cx->rn = 14; - #if CC_AES_USE_HARDWARE - bcopy(key, cx->keyBytes, 32); - cx->keyLength = 32; - #endif -#if defined( AES_ERR_CHK ) - return aes_good; -#endif -} - -#endif - -#if defined(AES_VAR) - -aes_rval aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]) -{ - switch(key_len) - { -#if defined( AES_ERR_CHK ) - case 16: case 128: return aes_decrypt_key128(key, cx); - case 24: case 192: return aes_decrypt_key192(key, cx); - case 32: case 256: return aes_decrypt_key256(key, cx); - default: return aes_error; -#else - case 16: case 128: aes_decrypt_key128(key, cx); return; - case 24: case 192: aes_decrypt_key192(key, cx); return; - case 32: case 256: aes_decrypt_key256(key, cx); return; -#endif - } -} - -#endif - -#endif - - -#if defined(__cplusplus) -} -#endif - -#endif // defined UseGladmanAES DELETED Source/GladmanAES/aestab.c Index: Source/GladmanAES/aestab.c ================================================================== --- Source/GladmanAES/aestab.c +++ /dev/null @@ -1,390 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 28/01/2004 - -*/ - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#define DO_TABLES - -#include - -/* Produce object code iff UseGladmanAES is defined. Otherwise, suppress - use of this module, because some other AES implementation is being used. -*/ -#if defined UseGladmanAES - -#if defined(FIXED_TABLES) - -#define sb_data(w) {\ - w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\ - w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), w(0xab), w(0x76),\ - w(0xca), w(0x82), w(0xc9), w(0x7d), w(0xfa), w(0x59), w(0x47), w(0xf0),\ - w(0xad), w(0xd4), w(0xa2), w(0xaf), w(0x9c), w(0xa4), w(0x72), w(0xc0),\ - w(0xb7), w(0xfd), w(0x93), w(0x26), w(0x36), w(0x3f), w(0xf7), w(0xcc),\ - w(0x34), w(0xa5), w(0xe5), w(0xf1), w(0x71), w(0xd8), w(0x31), w(0x15),\ - w(0x04), w(0xc7), w(0x23), w(0xc3), w(0x18), w(0x96), w(0x05), w(0x9a),\ - w(0x07), w(0x12), w(0x80), w(0xe2), w(0xeb), w(0x27), w(0xb2), w(0x75),\ - w(0x09), w(0x83), w(0x2c), w(0x1a), w(0x1b), w(0x6e), w(0x5a), w(0xa0),\ - w(0x52), w(0x3b), w(0xd6), w(0xb3), w(0x29), w(0xe3), w(0x2f), w(0x84),\ - w(0x53), w(0xd1), w(0x00), w(0xed), w(0x20), w(0xfc), w(0xb1), w(0x5b),\ - w(0x6a), w(0xcb), w(0xbe), w(0x39), w(0x4a), w(0x4c), w(0x58), w(0xcf),\ - w(0xd0), w(0xef), w(0xaa), w(0xfb), w(0x43), w(0x4d), w(0x33), w(0x85),\ - w(0x45), w(0xf9), w(0x02), w(0x7f), w(0x50), w(0x3c), w(0x9f), w(0xa8),\ - w(0x51), w(0xa3), w(0x40), w(0x8f), w(0x92), w(0x9d), w(0x38), w(0xf5),\ - w(0xbc), w(0xb6), w(0xda), w(0x21), w(0x10), w(0xff), w(0xf3), w(0xd2),\ - w(0xcd), w(0x0c), w(0x13), w(0xec), w(0x5f), w(0x97), w(0x44), w(0x17),\ - w(0xc4), w(0xa7), w(0x7e), w(0x3d), w(0x64), w(0x5d), w(0x19), w(0x73),\ - w(0x60), w(0x81), w(0x4f), w(0xdc), w(0x22), w(0x2a), w(0x90), w(0x88),\ - w(0x46), w(0xee), w(0xb8), w(0x14), w(0xde), w(0x5e), w(0x0b), w(0xdb),\ - w(0xe0), w(0x32), w(0x3a), w(0x0a), w(0x49), w(0x06), w(0x24), w(0x5c),\ - w(0xc2), w(0xd3), w(0xac), w(0x62), w(0x91), w(0x95), w(0xe4), w(0x79),\ - w(0xe7), w(0xc8), w(0x37), w(0x6d), w(0x8d), w(0xd5), w(0x4e), w(0xa9),\ - w(0x6c), w(0x56), w(0xf4), w(0xea), w(0x65), w(0x7a), w(0xae), w(0x08),\ - w(0xba), w(0x78), w(0x25), w(0x2e), w(0x1c), w(0xa6), w(0xb4), w(0xc6),\ - w(0xe8), w(0xdd), w(0x74), w(0x1f), w(0x4b), w(0xbd), w(0x8b), w(0x8a),\ - w(0x70), w(0x3e), w(0xb5), w(0x66), w(0x48), w(0x03), w(0xf6), w(0x0e),\ - w(0x61), w(0x35), w(0x57), w(0xb9), w(0x86), w(0xc1), w(0x1d), w(0x9e),\ - w(0xe1), w(0xf8), w(0x98), w(0x11), w(0x69), w(0xd9), w(0x8e), w(0x94),\ - w(0x9b), w(0x1e), w(0x87), w(0xe9), w(0xce), w(0x55), w(0x28), w(0xdf),\ - w(0x8c), w(0xa1), w(0x89), w(0x0d), w(0xbf), w(0xe6), w(0x42), w(0x68),\ - w(0x41), w(0x99), w(0x2d), w(0x0f), w(0xb0), w(0x54), w(0xbb), w(0x16) } - -#define isb_data(w) {\ - w(0x52), w(0x09), w(0x6a), w(0xd5), w(0x30), w(0x36), w(0xa5), w(0x38),\ - w(0xbf), w(0x40), w(0xa3), w(0x9e), w(0x81), w(0xf3), w(0xd7), w(0xfb),\ - w(0x7c), w(0xe3), w(0x39), w(0x82), w(0x9b), w(0x2f), w(0xff), w(0x87),\ - w(0x34), w(0x8e), w(0x43), w(0x44), w(0xc4), w(0xde), w(0xe9), w(0xcb),\ - w(0x54), w(0x7b), w(0x94), w(0x32), w(0xa6), w(0xc2), w(0x23), w(0x3d),\ - w(0xee), w(0x4c), w(0x95), w(0x0b), w(0x42), w(0xfa), w(0xc3), w(0x4e),\ - w(0x08), w(0x2e), w(0xa1), w(0x66), w(0x28), w(0xd9), w(0x24), w(0xb2),\ - w(0x76), w(0x5b), w(0xa2), w(0x49), w(0x6d), w(0x8b), w(0xd1), w(0x25),\ - w(0x72), w(0xf8), w(0xf6), w(0x64), w(0x86), w(0x68), w(0x98), w(0x16),\ - w(0xd4), w(0xa4), w(0x5c), w(0xcc), w(0x5d), w(0x65), w(0xb6), w(0x92),\ - w(0x6c), w(0x70), w(0x48), w(0x50), w(0xfd), w(0xed), w(0xb9), w(0xda),\ - w(0x5e), w(0x15), w(0x46), w(0x57), w(0xa7), w(0x8d), w(0x9d), w(0x84),\ - w(0x90), w(0xd8), w(0xab), w(0x00), w(0x8c), w(0xbc), w(0xd3), w(0x0a),\ - w(0xf7), w(0xe4), w(0x58), w(0x05), w(0xb8), w(0xb3), w(0x45), w(0x06),\ - w(0xd0), w(0x2c), w(0x1e), w(0x8f), w(0xca), w(0x3f), w(0x0f), w(0x02),\ - w(0xc1), w(0xaf), w(0xbd), w(0x03), w(0x01), w(0x13), w(0x8a), w(0x6b),\ - w(0x3a), w(0x91), w(0x11), w(0x41), w(0x4f), w(0x67), w(0xdc), w(0xea),\ - w(0x97), w(0xf2), w(0xcf), w(0xce), w(0xf0), w(0xb4), w(0xe6), w(0x73),\ - w(0x96), w(0xac), w(0x74), w(0x22), w(0xe7), w(0xad), w(0x35), w(0x85),\ - w(0xe2), w(0xf9), w(0x37), w(0xe8), w(0x1c), w(0x75), w(0xdf), w(0x6e),\ - w(0x47), w(0xf1), w(0x1a), w(0x71), w(0x1d), w(0x29), w(0xc5), w(0x89),\ - w(0x6f), w(0xb7), w(0x62), w(0x0e), w(0xaa), w(0x18), w(0xbe), w(0x1b),\ - w(0xfc), w(0x56), w(0x3e), w(0x4b), w(0xc6), w(0xd2), w(0x79), w(0x20),\ - w(0x9a), w(0xdb), w(0xc0), w(0xfe), w(0x78), w(0xcd), w(0x5a), w(0xf4),\ - w(0x1f), w(0xdd), w(0xa8), w(0x33), w(0x88), w(0x07), w(0xc7), w(0x31),\ - w(0xb1), w(0x12), w(0x10), w(0x59), w(0x27), w(0x80), w(0xec), w(0x5f),\ - w(0x60), w(0x51), w(0x7f), w(0xa9), w(0x19), w(0xb5), w(0x4a), w(0x0d),\ - w(0x2d), w(0xe5), w(0x7a), w(0x9f), w(0x93), w(0xc9), w(0x9c), w(0xef),\ - w(0xa0), w(0xe0), w(0x3b), w(0x4d), w(0xae), w(0x2a), w(0xf5), w(0xb0),\ - w(0xc8), w(0xeb), w(0xbb), w(0x3c), w(0x83), w(0x53), w(0x99), w(0x61),\ - w(0x17), w(0x2b), w(0x04), w(0x7e), w(0xba), w(0x77), w(0xd6), w(0x26),\ - w(0xe1), w(0x69), w(0x14), w(0x63), w(0x55), w(0x21), w(0x0c), w(0x7d) } - -#define mm_data(w) {\ - w(0x00), w(0x01), w(0x02), w(0x03), w(0x04), w(0x05), w(0x06), w(0x07),\ - w(0x08), w(0x09), w(0x0a), w(0x0b), w(0x0c), w(0x0d), w(0x0e), w(0x0f),\ - w(0x10), w(0x11), w(0x12), w(0x13), w(0x14), w(0x15), w(0x16), w(0x17),\ - w(0x18), w(0x19), w(0x1a), w(0x1b), w(0x1c), w(0x1d), w(0x1e), w(0x1f),\ - w(0x20), w(0x21), w(0x22), w(0x23), w(0x24), w(0x25), w(0x26), w(0x27),\ - w(0x28), w(0x29), w(0x2a), w(0x2b), w(0x2c), w(0x2d), w(0x2e), w(0x2f),\ - w(0x30), w(0x31), w(0x32), w(0x33), w(0x34), w(0x35), w(0x36), w(0x37),\ - w(0x38), w(0x39), w(0x3a), w(0x3b), w(0x3c), w(0x3d), w(0x3e), w(0x3f),\ - w(0x40), w(0x41), w(0x42), w(0x43), w(0x44), w(0x45), w(0x46), w(0x47),\ - w(0x48), w(0x49), w(0x4a), w(0x4b), w(0x4c), w(0x4d), w(0x4e), w(0x4f),\ - w(0x50), w(0x51), w(0x52), w(0x53), w(0x54), w(0x55), w(0x56), w(0x57),\ - w(0x58), w(0x59), w(0x5a), w(0x5b), w(0x5c), w(0x5d), w(0x5e), w(0x5f),\ - w(0x60), w(0x61), w(0x62), w(0x63), w(0x64), w(0x65), w(0x66), w(0x67),\ - w(0x68), w(0x69), w(0x6a), w(0x6b), w(0x6c), w(0x6d), w(0x6e), w(0x6f),\ - w(0x70), w(0x71), w(0x72), w(0x73), w(0x74), w(0x75), w(0x76), w(0x77),\ - w(0x78), w(0x79), w(0x7a), w(0x7b), w(0x7c), w(0x7d), w(0x7e), w(0x7f),\ - w(0x80), w(0x81), w(0x82), w(0x83), w(0x84), w(0x85), w(0x86), w(0x87),\ - w(0x88), w(0x89), w(0x8a), w(0x8b), w(0x8c), w(0x8d), w(0x8e), w(0x8f),\ - w(0x90), w(0x91), w(0x92), w(0x93), w(0x94), w(0x95), w(0x96), w(0x97),\ - w(0x98), w(0x99), w(0x9a), w(0x9b), w(0x9c), w(0x9d), w(0x9e), w(0x9f),\ - w(0xa0), w(0xa1), w(0xa2), w(0xa3), w(0xa4), w(0xa5), w(0xa6), w(0xa7),\ - w(0xa8), w(0xa9), w(0xaa), w(0xab), w(0xac), w(0xad), w(0xae), w(0xaf),\ - w(0xb0), w(0xb1), w(0xb2), w(0xb3), w(0xb4), w(0xb5), w(0xb6), w(0xb7),\ - w(0xb8), w(0xb9), w(0xba), w(0xbb), w(0xbc), w(0xbd), w(0xbe), w(0xbf),\ - w(0xc0), w(0xc1), w(0xc2), w(0xc3), w(0xc4), w(0xc5), w(0xc6), w(0xc7),\ - w(0xc8), w(0xc9), w(0xca), w(0xcb), w(0xcc), w(0xcd), w(0xce), w(0xcf),\ - w(0xd0), w(0xd1), w(0xd2), w(0xd3), w(0xd4), w(0xd5), w(0xd6), w(0xd7),\ - w(0xd8), w(0xd9), w(0xda), w(0xdb), w(0xdc), w(0xdd), w(0xde), w(0xdf),\ - w(0xe0), w(0xe1), w(0xe2), w(0xe3), w(0xe4), w(0xe5), w(0xe6), w(0xe7),\ - w(0xe8), w(0xe9), w(0xea), w(0xeb), w(0xec), w(0xed), w(0xee), w(0xef),\ - w(0xf0), w(0xf1), w(0xf2), w(0xf3), w(0xf4), w(0xf5), w(0xf6), w(0xf7),\ - w(0xf8), w(0xf9), w(0xfa), w(0xfb), w(0xfc), w(0xfd), w(0xfe), w(0xff) } - -#define rc_data(w) {\ - w(0x01), w(0x02), w(0x04), w(0x08), w(0x10),w(0x20), w(0x40), w(0x80),\ - w(0x1b), w(0x36) } - -#define h0(x) (x) - -#define w0(p) bytes2word(p, 0, 0, 0) -#define w1(p) bytes2word(0, p, 0, 0) -#define w2(p) bytes2word(0, 0, p, 0) -#define w3(p) bytes2word(0, 0, 0, p) - -#define u0(p) bytes2word(f2(p), p, p, f3(p)) -#define u1(p) bytes2word(f3(p), f2(p), p, p) -#define u2(p) bytes2word(p, f3(p), f2(p), p) -#define u3(p) bytes2word(p, p, f3(p), f2(p)) - -#define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p)) -#define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p)) -#define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p)) -#define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p)) - -#endif - -#if defined(FIXED_TABLES) || !defined(FF_TABLES) - -#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY)) -#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY)) -#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \ - ^ (((x>>5) & 4) * WPOLY)) -#define f3(x) (f2(x) ^ x) -#define f9(x) (f8(x) ^ x) -#define fb(x) (f8(x) ^ f2(x) ^ x) -#define fd(x) (f8(x) ^ f4(x) ^ x) -#define fe(x) (f8(x) ^ f4(x) ^ f2(x)) - -#else - -#define f2(x) ((x) ? pow[log[x] + 0x19] : 0) -#define f3(x) ((x) ? pow[log[x] + 0x01] : 0) -#define f9(x) ((x) ? pow[log[x] + 0xc7] : 0) -#define fb(x) ((x) ? pow[log[x] + 0x68] : 0) -#define fd(x) ((x) ? pow[log[x] + 0xee] : 0) -#define fe(x) ((x) ? pow[log[x] + 0xdf] : 0) -#define fi(x) ((x) ? pow[ 255 - log[x]] : 0) - -#endif - -#include "aestab.h" - -#if defined(FIXED_TABLES) - -/* implemented in case of wrong call for fixed tables */ - -void gen_tabs(void) -{ -} - -#else /* dynamic table generation */ - -#if !defined(FF_TABLES) - -/* Generate the tables for the dynamic table option - - It will generally be sensible to use tables to compute finite - field multiplies and inverses but where memory is scarse this - code might sometimes be better. But it only has effect during - initialisation so its pretty unimportant in overall terms. -*/ - -/* return 2 ^ (n - 1) where n is the bit number of the highest bit - set in x with x in the range 1 < x < 0x00000200. This form is - used so that locals within fi can be bytes rather than words -*/ - -static aes_08t hibit(const aes_32t x) -{ aes_08t r = (aes_08t)((x >> 1) | (x >> 2)); - - r |= (r >> 2); - r |= (r >> 4); - return (r + 1) >> 1; -} - -/* return the inverse of the finite field element x */ - -static aes_08t fi(const aes_08t x) -{ aes_08t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0; - - if(x < 2) return x; - - for(;;) - { - if(!n1) return v1; - - while(n2 >= n1) - { - n2 /= n1; p2 ^= p1 * n2; v2 ^= v1 * n2; n2 = hibit(p2); - } - - if(!n2) return v2; - - while(n1 >= n2) - { - n1 /= n2; p1 ^= p2 * n1; v1 ^= v2 * n1; n1 = hibit(p1); - } - } -} - -#endif - -/* The forward and inverse affine transformations used in the S-box */ - -#define fwd_affine(x) \ - (w = (aes_32t)x, w ^= (w<<1)^(w<<2)^(w<<3)^(w<<4), 0x63^(aes_08t)(w^(w>>8))) - -#define inv_affine(x) \ - (w = (aes_32t)x, w = (w<<1)^(w<<3)^(w<<6), 0x05^(aes_08t)(w^(w>>8))) - -static int init = 0; - -void gen_tabs(void) -{ aes_32t i, w; - -#if defined(FF_TABLES) - - aes_08t pow[512], log[256]; - - if(init) return; - /* log and power tables for GF(2^8) finite field with - WPOLY as modular polynomial - the simplest primitive - root is 0x03, used here to generate the tables - */ - - i = 0; w = 1; - do - { - pow[i] = (aes_08t)w; - pow[i + 255] = (aes_08t)w; - log[w] = (aes_08t)i++; - w ^= (w << 1) ^ (w & 0x80 ? WPOLY : 0); - } - while (w != 1); - -#else - if(init) return; -#endif - - for(i = 0, w = 1; i < RC_LENGTH; ++i) - { - t_set(r,c)[i] = bytes2word(w, 0, 0, 0); - w = f2(w); - } - - for(i = 0; i < 256; ++i) - { aes_08t b; - - b = fwd_affine(fi((aes_08t)i)); - w = bytes2word(f2(b), b, b, f3(b)); - -#if defined( SBX_SET ) - t_set(s,box)[i] = b; -#endif - -#if defined( FT1_SET ) /* tables for a normal encryption round */ - t_set(f,n)[i] = w; -#endif -#if defined( FT4_SET ) - t_set(f,n)[0][i] = w; - t_set(f,n)[1][i] = upr(w,1); - t_set(f,n)[2][i] = upr(w,2); - t_set(f,n)[3][i] = upr(w,3); -#endif - w = bytes2word(b, 0, 0, 0); - -#if defined( FL1_SET ) /* tables for last encryption round (may also */ - t_set(f,l)[i] = w; /* be used in the key schedule) */ -#endif -#if defined( FL4_SET ) - t_set(f,l)[0][i] = w; - t_set(f,l)[1][i] = upr(w,1); - t_set(f,l)[2][i] = upr(w,2); - t_set(f,l)[3][i] = upr(w,3); -#endif - -#if defined( LS1_SET ) /* table for key schedule if t_set(f,l) above is */ - t_set(l,s)[i] = w; /* not of the required form */ -#endif -#if defined( LS4_SET ) - t_set(l,s)[0][i] = w; - t_set(l,s)[1][i] = upr(w,1); - t_set(l,s)[2][i] = upr(w,2); - t_set(l,s)[3][i] = upr(w,3); -#endif - - b = fi(inv_affine((aes_08t)i)); - w = bytes2word(fe(b), f9(b), fd(b), fb(b)); - -#if defined( IM1_SET ) /* tables for the inverse mix column operation */ - t_set(i,m)[b] = w; -#endif -#if defined( IM4_SET ) - t_set(i,m)[0][b] = w; - t_set(i,m)[1][b] = upr(w,1); - t_set(i,m)[2][b] = upr(w,2); - t_set(i,m)[3][b] = upr(w,3); -#endif - -#if defined( ISB_SET ) - t_set(i,box)[i] = b; -#endif -#if defined( IT1_SET ) /* tables for a normal decryption round */ - t_set(i,n)[i] = w; -#endif -#if defined( IT4_SET ) - t_set(i,n)[0][i] = w; - t_set(i,n)[1][i] = upr(w,1); - t_set(i,n)[2][i] = upr(w,2); - t_set(i,n)[3][i] = upr(w,3); -#endif - w = bytes2word(b, 0, 0, 0); -#if defined( IL1_SET ) /* tables for last decryption round */ - t_set(i,l)[i] = w; -#endif -#if defined( IL4_SET ) - t_set(i,l)[0][i] = w; - t_set(i,l)[1][i] = upr(w,1); - t_set(i,l)[2][i] = upr(w,2); - t_set(i,l)[3][i] = upr(w,3); -#endif - } - init = 1; -} - -#endif - -#endif // defined UseGladmanAES - -#if defined(__cplusplus) -} -#endif DELETED Source/GladmanAES/aestab.h Index: Source/GladmanAES/aestab.h ================================================================== --- Source/GladmanAES/aestab.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 28/01/2004 - - This file contains the code for declaring the tables needed to implement - AES. The file aesopt.h is assumed to be included before this header file. - If there are no global variables, the definitions here can be used to put - the AES tables in a structure so that a pointer can then be added to the - AES context to pass them to the AES routines that need them. If this - facility is used, the calling program has to ensure that this pointer is - managed appropriately. In particular, the value of the t_dec(in,it) item - in the table structure must be set to zero in order to ensure that the - tables are initialised. In practice the three code sequences in aeskey.c - that control the calls to gen_tabs() and the gen_tabs() routine itself will - have to be changed for a specific implementation. If global variables are - available it will generally be preferable to use them with the precomputed - FIXED_TABLES option that uses static global tables. - - The following defines can be used to control the way the tables - are defined, initialised and used in embedded environments that - require special features for these purposes - - the 't_dec' construction is used to declare fixed table arrays - the 't_set' construction is used to set fixed table values - the 't_use' construction is used to access fixed table values - - 256 byte tables: - - t_xxx(s,box) => forward S box - t_xxx(i,box) => inverse S box - - 256 32-bit word OR 4 x 256 32-bit word tables: - - t_xxx(f,n) => forward normal round - t_xxx(f,l) => forward last round - t_xxx(i,n) => inverse normal round - t_xxx(i,l) => inverse last round - t_xxx(l,s) => key schedule table - t_xxx(i,m) => key schedule table - - Other variables and tables: - - t_xxx(r,c) => the rcon table -*/ - -#if !defined( _CC_AESTAB_H ) -#define _CC_AESTAB_H - -#define t_dec(m,n) t_##m##n -#define t_set(m,n) t_##m##n -#define t_use(m,n) t_##m##n - -#if defined(FIXED_TABLES) -#define Const const -#else -#define Const -#endif - -#if defined(DO_TABLES) -#define Extern -#else -#define Extern extern -#endif - -#if defined(_MSC_VER) && defined(TABLE_ALIGN) -#define Align __declspec(align(TABLE_ALIGN)) -#else -#define Align -#endif - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#if defined(DO_TABLES) && defined(FIXED_TABLES) -#define d_1(t,n,b,e) Align Const t n[256] = b(e) -#define d_4(t,n,b,e,f,g,h) Align Const t n[4][256] = { b(e), b(f), b(g), b(h) } -Extern Align Const aes_32t t_dec(r,c)[RC_LENGTH] = rc_data(w0); -#else -#define d_1(t,n,b,e) Extern Align Const t n[256] -#define d_4(t,n,b,e,f,g,h) Extern Align Const t n[4][256] -Extern Align Const aes_32t t_dec(r,c)[RC_LENGTH]; -#endif - -#if defined( SBX_SET ) - d_1(aes_08t, t_dec(s,box), sb_data, h0); -#endif -#if defined( ISB_SET ) - d_1(aes_08t, t_dec(i,box), isb_data, h0); -#endif - -#if defined( FT1_SET ) - d_1(aes_32t, t_dec(f,n), sb_data, u0); -#endif -#if defined( FT4_SET ) - d_4(aes_32t, t_dec(f,n), sb_data, u0, u1, u2, u3); -#endif - -#if defined( FL1_SET ) - d_1(aes_32t, t_dec(f,l), sb_data, w0); -#endif -#if defined( FL4_SET ) - d_4(aes_32t, t_dec(f,l), sb_data, w0, w1, w2, w3); -#endif - -#if defined( IT1_SET ) - d_1(aes_32t, t_dec(i,n), isb_data, v0); -#endif -#if defined( IT4_SET ) - d_4(aes_32t, t_dec(i,n), isb_data, v0, v1, v2, v3); -#endif - -#if defined( IL1_SET ) - d_1(aes_32t, t_dec(i,l), isb_data, w0); -#endif -#if defined( IL4_SET ) - d_4(aes_32t, t_dec(i,l), isb_data, w0, w1, w2, w3); -#endif - -#if defined( LS1_SET ) -#if defined( FL1_SET ) -#undef LS1_SET -#else - d_1(aes_32t, t_dec(l,s), sb_data, w0); -#endif -#endif - -#if defined( LS4_SET ) -#if defined( FL4_SET ) -#undef LS4_SET -#else - d_4(aes_32t, t_dec(l,s), sb_data, w0, w1, w2, w3); -#endif -#endif - -#if defined( IM1_SET ) - d_1(aes_32t, t_dec(i,m), mm_data, v0); -#endif -#if defined( IM4_SET ) - d_4(aes_32t, t_dec(i,m), mm_data, v0, v1, v2, v3); -#endif - -#if defined(__cplusplus) -} -#endif - -#endif /* _CC_AESTAB_H */ DELETED Source/GladmanAES/ccNewGladman.c Index: Source/GladmanAES/ccNewGladman.c ================================================================== --- Source/GladmanAES/ccNewGladman.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * ccNewGladman.c - shim between Gladman AES and CommonEncryption. - * - * Created 3/30/06 by Doug Mitchell. - */ - -#include - -#if CC_AES_USE_HARDWARE -//Need IOKitLib.h only for IOAESTypes.h -#include -#include -#include -#include -#include -#endif - -/* Produce object code iff UseGladmanAES is defined. Otherwise, suppress - use of this module, because some other AES implementation is being used. -*/ -#if defined UseGladmanAES - -#ifdef _APPLE_COMMON_CRYPTO_ - -#include - -int aes_cc_set_key( - aes_cc_ctx *cx, - const void *rawKey, - aes_32t keyLength, - int forEncrypt) -{ - if(forEncrypt) { - switch(keyLength) { - case 16: - aes_encrypt_key128((const unsigned char *)rawKey, &cx->encrypt); - break; - case 24: - aes_encrypt_key192((const unsigned char *)rawKey, &cx->encrypt); - break; - case 32: - aes_encrypt_key256((const unsigned char *)rawKey, &cx->encrypt); - break; - default: - return -1; - } - cx->encrypt.cbcEnable = 0; - } - else { - switch(keyLength) { - case 16: - aes_decrypt_key128((const unsigned char *)rawKey, &cx->decrypt); - break; - case 24: - aes_decrypt_key192((const unsigned char *)rawKey, &cx->decrypt); - break; - case 32: - aes_decrypt_key256((const unsigned char *)rawKey, &cx->decrypt); - break; - default: - return -1; - } - cx->decrypt.cbcEnable = 0; - } - return 0; -} - -void aes_cc_set_iv(aes_cc_ctx *cx, int forEncrypt, const void *iv) -{ - if(forEncrypt) { - if(iv == NULL) { - cx->encrypt.cbcEnable = 0; - } - else { - memmove(cx->encrypt.chainBuf, iv, AES_BLOCK_SIZE); - cx->encrypt.cbcEnable = 1; - } - } - else { - if(iv == NULL) { - cx->decrypt.cbcEnable = 0; - } - else { - memmove(cx->decrypt.chainBuf, iv, AES_BLOCK_SIZE); - cx->decrypt.cbcEnable = 1; - } - } -} - -#ifndef NULL -#define NULL ((void *)0) -#endif - -#if CC_AES_USE_HARDWARE -#define CC_AES_USE_HARDWARE_THRESHOLD (1024 / AES_BLOCK_SIZE) //In Blocks. -static int cc_aes_device = -1; -static pthread_once_t cc_aes_connect_once = PTHREAD_ONCE_INIT; -static aes_32t cc_aes_hardware_quantum = ((256*4096) / AES_BLOCK_SIZE); //In Blocks. Will be set to what hardware returns; - -static void cc_aes_connect(void) -{ - struct IOAESAcceleratorInfo aesInfo; - - cc_aes_device = open("/dev/aes_0", O_RDWR, 0); - if(cc_aes_device < 0) - return; - if(ioctl(cc_aes_device, IOAES_GET_INFO, &aesInfo) != -1) { - cc_aes_hardware_quantum = aesInfo.maxBytesPerCall / AES_BLOCK_SIZE; - } -} - -static aes_32t aes_cc_use_hardware(IOAESOperation operation, int keyLength, UInt8 *key, UInt8 *iv, UInt8* plainText, UInt8 *cipherText, aes_32t numBlocks) -{ - struct IOAESAcceleratorRequest aesRequest; - aes_32t quantum = cc_aes_hardware_quantum; - UInt8 *pt = plainText; - UInt8 *ct = cipherText; - aes_32t blocks = numBlocks; - - aesRequest.operation = operation; - bcopy(iv, aesRequest.iv.ivBytes, AES_BLOCK_SIZE); - aesRequest.keyData.key.keyLength = (keyLength << 3); //Hardware needs it in bits. - bcopy(key, aesRequest.keyData.key.keyBytes, keyLength); - - while (blocks) { - quantum = ((blocks < cc_aes_hardware_quantum) ? blocks : cc_aes_hardware_quantum); - aesRequest.plainText = pt; - aesRequest.cipherText = ct; - aesRequest.textLength = quantum * AES_BLOCK_SIZE; //The hardware needs textLength in bytes. - - if(ioctl(cc_aes_device, IOAES_ENCRYPT_DECRYPT, &aesRequest) == -1) { - break; - } - blocks -= quantum; - pt += (quantum*AES_BLOCK_SIZE); - ct += (quantum*AES_BLOCK_SIZE); - } - return (numBlocks - blocks); -} -#endif - -void aes_cc_encrypt(aes_cc_ctx *cx, const void *blocksIn, aes_32t numBlocks, void *blocksOut) -{ - #if CC_AES_USE_HARDWARE - if(numBlocks > CC_AES_USE_HARDWARE_THRESHOLD && !pthread_once(&cc_aes_connect_once, cc_aes_connect) && cc_aes_device >= 0) { - aes_encrypt_ctx *cx_encrypt = &cx->encrypt; - UInt8 *key = cx_encrypt->keyBytes; - int keyLength = cx_encrypt->keyLength; - UInt8 *iv = cx_encrypt->chainBuf; - aes_32t blocks_encrypted = 0; - - blocks_encrypted = aes_cc_use_hardware(IOAESOperationEncrypt, keyLength, key, iv, (UInt8 *)blocksIn, (UInt8 *)blocksOut, numBlocks); - if(blocks_encrypted == numBlocks) { // Successfully completed using hardware. - return; - } - //Something went wrong trying to use hardware.. fall through and use the software to do the job. - blocksIn = (UInt8 *)blocksIn + (blocks_encrypted * AES_BLOCK_SIZE); - blocksOut = (UInt8 *)blocksOut + (blocks_encrypted * AES_BLOCK_SIZE); - numBlocks -= blocks_encrypted; - } - #endif - aes_encrypt_cbc((const unsigned char *)blocksIn, - NULL, /* IV - we set via aes_cc_set_iv */ - (unsigned)numBlocks, (unsigned char *)blocksOut, &cx->encrypt); -} - -void aes_cc_decrypt(aes_cc_ctx *cx, const void *blocksIn, aes_32t numBlocks, - void *blocksOut) -{ - #if CC_AES_USE_HARDWARE - if(numBlocks > CC_AES_USE_HARDWARE_THRESHOLD && !pthread_once(&cc_aes_connect_once, cc_aes_connect) && cc_aes_device >= 0) { - aes_decrypt_ctx *cx_decrypt = &cx->decrypt; - UInt8 *key = cx_decrypt->keyBytes; - int keyLength = cx_decrypt->keyLength; - UInt8 *iv = cx_decrypt->chainBuf; - aes_32t blocks_decrypted = 0; - - blocks_decrypted = aes_cc_use_hardware(IOAESOperationDecrypt, keyLength, key, iv, (UInt8 *)blocksOut, (UInt8 *)blocksIn, numBlocks); - if(blocks_decrypted == numBlocks) { // Successfully completed using hardware. - return 1; - } - //Something went wrong trying to use hardware.. fall through and use the software to do the job. - blocksIn = (UInt8 *)blocksIn + (blocks_decrypted * AES_BLOCK_SIZE); - blocksOut = (UInt8 *)blocksOut + (blocks_decrypted * AES_BLOCK_SIZE); - numBlocks -= blocks_decrypted; - } - #endif - aes_decrypt_cbc((const unsigned char *)blocksIn, - NULL, /* IV - we set via aes_cc_set_iv */ - (unsigned)numBlocks, (unsigned char *)blocksOut, &cx->decrypt); -} - -#endif /* _APPLE_COMMON_CRYPTO_ */ - -#endif // defined UseGladmanAES DELETED Source/RC2/ccRC2.c Index: Source/RC2/ccRC2.c ================================================================== --- Source/RC2/ccRC2.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#include "rc2.h" -#include "ccRC2.h" -#include - -int rc2_cc_set_key( - RC2_Schedule *cx, - const void *rawKey, - size_t keyLength) -{ - rc2_keyschedule(cx, rawKey, keyLength, keyLength*8); - return 0; -} - -void rc2_cc_encrypt(RC2_Schedule *cx, const void *blockIn, void *blockOut) -{ - rc2_encrypt(cx, (const unsigned char *)blockIn, (unsigned char *)blockOut); -} - -void rc2_cc_decrypt(RC2_Schedule *cx, const void *blockIn, void *blockOut) -{ - rc2_decrypt(cx, (unsigned char *)blockOut, (const unsigned char *)blockIn); -} - DELETED Source/RC2/rc2.c Index: Source/RC2/rc2.c ================================================================== --- Source/RC2/rc2.c +++ /dev/null @@ -1,158 +0,0 @@ -/**********************************************************************\ -* To commemorate the 1996 RSA Data Security Conference, the following * -* code is released into the public domain by its author. Prost! * -* * -* This cipher uses 16-bit words and little-endian byte ordering. * -* I wonder which processor it was optimized for? * -* * -* Thanks to CodeView, SoftIce, and D86 for helping bring this code to * -* the public. * -\**********************************************************************/ -#include -#include - -#include "rc2.h" - -/**********************************************************************\ -* Expand a variable-length user key (between 1 and 128 bytes) to a * -* 64-short working rc2 key, of at most "bits" effective key bits. * -* The effective key bits parameter looks like an export control hack. * -* For normal use, it should always be set to 1024. For convenience, * -* zero is accepted as an alias for 1024. * -\**********************************************************************/ -void rc2_keyschedule( RC2_Schedule *key_schedule, - const unsigned char *key, - unsigned len, - unsigned bits ) - { - unsigned char x; - unsigned i; - /* 256-entry permutation table, probably derived somehow from pi */ - static const unsigned char permute[256] = { - 217,120,249,196, 25,221,181,237, 40,233,253,121, 74,160,216,157, - 198,126, 55,131, 43,118, 83,142, 98, 76,100,136, 68,139,251,162, - 23,154, 89,245,135,179, 79, 19, 97, 69,109,141, 9,129,125, 50, - 189,143, 64,235,134,183,123, 11,240,149, 33, 34, 92,107, 78,130, - 84,214,101,147,206, 96,178, 28,115, 86,192, 20,167,140,241,220, - 18,117,202, 31, 59,190,228,209, 66, 61,212, 48,163, 60,182, 38, - 111,191, 14,218, 70,105, 7, 87, 39,242, 29,155,188,148, 67, 3, - 248, 17,199,246,144,239, 62,231, 6,195,213, 47,200,102, 30,215, - 8,232,234,222,128, 82,238,247,132,170,114,172, 53, 77,106, 42, - 150, 26,210,113, 90, 21, 73,116, 75,159,208, 94, 4, 24,164,236, - 194,224, 65,110, 15, 81,203,204, 36,145,175, 80,161,244,112, 57, - 153,124, 58,133, 35,184,180,122,252, 2, 54, 91, 37, 85,151, 49, - 45, 93,250,152,227,138,146,174, 5,223, 41, 16,103,108,186,201, - 211, 0,230,207,225,158,168, 44, 99, 22, 1, 63, 88,226,137,169, - 13, 56, 52, 27,171, 51,255,176,187, 72, 12, 95,185,177,205, 46, - 197,243,219, 71,229,165,156,119, 10,166, 32,104,254,127,193,173 - }; - assert(len > 0 && len <= 128); - assert(bits <= 1024); - if (!bits) - bits = 1024; - memcpy(&key_schedule->xkey, key, len); - /* Phase 1: Expand input key to 128 bytes */ - if (len < 128) { - i = 0; - x = ((unsigned char *)key_schedule->xkey)[len-1]; - do { - x = permute[(x + ((unsigned char *)key_schedule->xkey)[i++]) & 255]; - ((unsigned char *)key_schedule->xkey)[len++] = x; - } while (len < 128); - } - /* Phase 2 - reduce effective key size to "bits" */ - len = (bits+7) >> 3; - i = 128-len; - x = permute[((unsigned char *)key_schedule->xkey)[i] & (255 >> (7 & -bits))]; - ((unsigned char *)key_schedule->xkey)[i] = x; - while (i--) { - x = permute[ x ^ ((unsigned char *)key_schedule->xkey)[i+len] ]; - ((unsigned char *)key_schedule->xkey)[i] = x; - } - /* Phase 3 - copy to xkey in little-endian order */ - i = 63; - do { - key_schedule->xkey[i] = ((unsigned char *)key_schedule->xkey)[2*i] + - (((unsigned char *)key_schedule->xkey)[2*i+1] << 8); - } while (i--); - } -/**********************************************************************\ -* Encrypt an 8-byte block of plaintext using the given key. * -\**********************************************************************/ -void rc2_encrypt( const RC2_Schedule *key_schedule, - const unsigned char *plain, - unsigned char *cipher ) - { - unsigned x76, x54, x32, x10, i; - x76 = (plain[7] << 8) + plain[6]; - x54 = (plain[5] << 8) + plain[4]; - x32 = (plain[3] << 8) + plain[2]; - x10 = (plain[1] << 8) + plain[0]; - for (i = 0; i < 16; i++) { - x10 += (x32 & ~x76) + (x54 & x76) + key_schedule->xkey[4*i+0]; - x10 = (x10 << 1) + (x10 >> 15 & 1); - x32 += (x54 & ~x10) + (x76 & x10) + key_schedule->xkey[4*i+1]; - x32 = (x32 << 2) + (x32 >> 14 & 3); - x54 += (x76 & ~x32) + (x10 & x32) + key_schedule->xkey[4*i+2]; - x54 = (x54 << 3) + (x54 >> 13 & 7); - x76 += (x10 & ~x54) + (x32 & x54) + key_schedule->xkey[4*i+3]; - x76 = (x76 << 5) + (x76 >> 11 & 31); - if (i == 4 || i == 10) { - x10 += key_schedule->xkey[x76 & 63]; - x32 += key_schedule->xkey[x10 & 63]; - x54 += key_schedule->xkey[x32 & 63]; - x76 += key_schedule->xkey[x54 & 63]; - } - } - cipher[0] = (unsigned char)x10; - cipher[1] = (unsigned char)(x10 >> 8); - cipher[2] = (unsigned char)x32; - cipher[3] = (unsigned char)(x32 >> 8); - cipher[4] = (unsigned char)x54; - cipher[5] = (unsigned char)(x54 >> 8); - cipher[6] = (unsigned char)x76; - cipher[7] = (unsigned char)(x76 >> 8); - } -/**********************************************************************\ -* Decrypt an 8-byte block of ciphertext using the given key. * -\**********************************************************************/ -void rc2_decrypt( const RC2_Schedule *key_schedule, - unsigned char *plain, - const unsigned char *cipher ) - { - unsigned x76, x54, x32, x10, i; - x76 = (cipher[7] << 8) + cipher[6]; - x54 = (cipher[5] << 8) + cipher[4]; - x32 = (cipher[3] << 8) + cipher[2]; - x10 = (cipher[1] << 8) + cipher[0]; - i = 15; - do { - x76 &= 65535; - x76 = (x76 << 11) + (x76 >> 5); - x76 -= (x10 & ~x54) + (x32 & x54) + key_schedule->xkey[4*i+3]; - x54 &= 65535; - x54 = (x54 << 13) + (x54 >> 3); - x54 -= (x76 & ~x32) + (x10 & x32) + key_schedule->xkey[4*i+2]; - x32 &= 65535; - x32 = (x32 << 14) + (x32 >> 2); - x32 -= (x54 & ~x10) + (x76 & x10) + key_schedule->xkey[4*i+1]; - x10 &= 65535; - x10 = (x10 << 15) + (x10 >> 1); - x10 -= (x32 & ~x76) + (x54 & x76) + key_schedule->xkey[4*i+0]; - if (i == 5 || i == 11) { - x76 -= key_schedule->xkey[x54 & 63]; - x54 -= key_schedule->xkey[x32 & 63]; - x32 -= key_schedule->xkey[x10 & 63]; - x10 -= key_schedule->xkey[x76 & 63]; - } - } while (i--); - plain[0] = (unsigned char)x10; - plain[1] = (unsigned char)(x10 >> 8); - plain[2] = (unsigned char)x32; - plain[3] = (unsigned char)(x32 >> 8); - plain[4] = (unsigned char)x54; - plain[5] = (unsigned char)(x54 >> 8); - plain[6] = (unsigned char)x76; - plain[7] = (unsigned char)(x76 >> 8); - } - DELETED Source/ccOpenssl/des.h Index: Source/ccOpenssl/des.h ================================================================== --- Source/ccOpenssl/des.h +++ /dev/null @@ -1,240 +0,0 @@ -/* crypto/des/des.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef HEADER_NEW_DES_H -#define HEADER_NEW_DES_H - -#ifdef OPENSSL_NO_DES -#error DES is disabled. -#endif - -#include -#include -#include -#include /* OPENSSL_EXTERN */ - -#ifdef _APPLE_COMMON_CRYPTO_ -/* avoid symbol collision with libSystem & libcrypto */ -#define DES_encrypt1 CC_DES_encrypt1 -#define DES_set_key_unchecked CC_DES_set_key_unchecked -#endif /* _APPLE_COMMON_CRYPTO_ */ - -#ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT -# ifndef OPENSSL_ENABLE_OLD_DES_SUPPORT -# define OPENSSL_ENABLE_OLD_DES_SUPPORT -# endif -#endif - -#ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT -# include -#endif - -#define DES_KEY_SZ (sizeof(DES_cblock)) -#define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) - -#define DES_ENCRYPT 1 -#define DES_DECRYPT 0 - -#define DES_CBC_MODE 0 -#define DES_PCBC_MODE 1 - -#define DES_ecb2_encrypt(i,o,k1,k2,e) \ - DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) - -#define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ - DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) - -#define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ - DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) - -#define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ - DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) - -OPENSSL_DECLARE_GLOBAL(int,DES_check_key); /* defaults to false */ -#define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) -OPENSSL_DECLARE_GLOBAL(int,DES_rw_mode); /* defaults to DES_PCBC_MODE */ -#define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode) - -#ifndef _APPLE_COMMON_CRYPTO_ -const char *DES_options(void); -void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks1,DES_key_schedule *ks2, - DES_key_schedule *ks3, int enc); -DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output, - long length,DES_key_schedule *schedule, - const_DES_cblock *ivec); -/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ -void DES_cbc_encrypt(const unsigned char *input,unsigned char *output, - long length,DES_key_schedule *schedule,DES_cblock *ivec, - int enc); -void DES_ncbc_encrypt(const unsigned char *input,unsigned char *output, - long length,DES_key_schedule *schedule,DES_cblock *ivec, - int enc); -void DES_xcbc_encrypt(const unsigned char *input,unsigned char *output, - long length,DES_key_schedule *schedule,DES_cblock *ivec, - const_DES_cblock *inw,const_DES_cblock *outw,int enc); -void DES_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits, - long length,DES_key_schedule *schedule,DES_cblock *ivec, - int enc); -void DES_ecb_encrypt(const_DES_cblock *input,DES_cblock *output, - DES_key_schedule *ks,int enc); -#endif /* _APPLE_COMMON_CRYPTO_ */ - -/* This is the DES encryption function that gets called by just about - every other DES routine in the library. You should not use this - function except to implement 'modes' of DES. I say this because the - functions that call this routine do the conversion from 'char *' to - long, and this needs to be done to make sure 'non-aligned' memory - access do not occur. The characters are loaded 'little endian'. - Data is a pointer to 2 unsigned long's and ks is the - DES_key_schedule to use. enc, is non zero specifies encryption, - zero if decryption. */ -void DES_encrypt1(DES_LONG *data,DES_key_schedule *ks, int enc); - -#ifndef _APPLE_COMMON_CRYPTO_ -/* This functions is the same as DES_encrypt1() except that the DES - initial permutation (IP) and final permutation (FP) have been left - out. As for DES_encrypt1(), you should not use this function. - It is used by the routines in the library that implement triple DES. - IP() DES_encrypt2() DES_encrypt2() DES_encrypt2() FP() is the same - as DES_encrypt1() DES_encrypt1() DES_encrypt1() except faster :-). */ -void DES_encrypt2(DES_LONG *data,DES_key_schedule *ks, int enc); - -void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); -void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); -void DES_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output, - long length, - DES_key_schedule *ks1,DES_key_schedule *ks2, - DES_key_schedule *ks3,DES_cblock *ivec,int enc); -void DES_ede3_cbcm_encrypt(const unsigned char *in,unsigned char *out, - long length, - DES_key_schedule *ks1,DES_key_schedule *ks2, - DES_key_schedule *ks3, - DES_cblock *ivec1,DES_cblock *ivec2, - int enc); -void DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out, - long length,DES_key_schedule *ks1, - DES_key_schedule *ks2,DES_key_schedule *ks3, - DES_cblock *ivec,int *num,int enc); -void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out, - long length,DES_key_schedule *ks1, - DES_key_schedule *ks2,DES_key_schedule *ks3, - DES_cblock *ivec,int *num); - -void DES_xwhite_in2out(const_DES_cblock *DES_key,const_DES_cblock *in_white, - DES_cblock *out_white); - -int DES_enc_read(int fd,void *buf,int len,DES_key_schedule *sched, - DES_cblock *iv); -int DES_enc_write(int fd,const void *buf,int len,DES_key_schedule *sched, - DES_cblock *iv); -char *DES_fcrypt(const char *buf,const char *salt, char *ret); -char *DES_crypt(const char *buf,const char *salt); -void DES_ofb_encrypt(const unsigned char *in,unsigned char *out,int numbits, - long length,DES_key_schedule *schedule,DES_cblock *ivec); -void DES_pcbc_encrypt(const unsigned char *input,unsigned char *output, - long length,DES_key_schedule *schedule,DES_cblock *ivec, - int enc); -DES_LONG DES_quad_cksum(const unsigned char *input,DES_cblock output[], - long length,int out_count,DES_cblock *seed); -int DES_random_key(DES_cblock *ret); -void DES_set_odd_parity(DES_cblock *key); -int DES_check_key_parity(const_DES_cblock *key); -int DES_is_weak_key(const_DES_cblock *key); -/* DES_set_key (= set_key = DES_key_sched = key_sched) calls - * DES_set_key_checked if global variable DES_check_key is set, - * DES_set_key_unchecked otherwise. */ -int DES_set_key(const_DES_cblock *key,DES_key_schedule *schedule); -int DES_key_sched(const_DES_cblock *key,DES_key_schedule *schedule); -int DES_set_key_checked(const_DES_cblock *key,DES_key_schedule *schedule); -#endif /* _APPLE_COMMON_CRYPTO_ */ - -void DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule *schedule); - -#ifndef _APPLE_COMMON_CRYPTO_ -void DES_string_to_key(const char *str,DES_cblock *key); -void DES_string_to_2keys(const char *str,DES_cblock *key1,DES_cblock *key2); -void DES_cfb64_encrypt(const unsigned char *in,unsigned char *out,long length, - DES_key_schedule *schedule,DES_cblock *ivec,int *num, - int enc); -void DES_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length, - DES_key_schedule *schedule,DES_cblock *ivec,int *num); - -int DES_read_password(DES_cblock *key, const char *prompt, int verify); -int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt, - int verify); - -#define DES_fixup_key_parity DES_set_odd_parity - -#endif /* _APPLE_COMMON_CRYPTO_ */ -#ifdef __cplusplus -} -#endif - -#endif DELETED Source/ccOpenssl/des_enc.c Index: Source/ccOpenssl/des_enc.c ================================================================== --- Source/ccOpenssl/des_enc.c +++ /dev/null @@ -1,411 +0,0 @@ -/* crypto/des/des_enc.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include "ccOpenssl/des_locl.h" - -void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) - { - register DES_LONG l,r,t,u; -#ifdef DES_PTR - register const unsigned char *des_SP=(const unsigned char *)DES_SPtrans; -#endif -#ifndef DES_UNROLL - register int i; -#endif - register DES_LONG *s; - - r=data[0]; - l=data[1]; - - IP(r,l); - /* Things have been modified so that the initial rotate is - * done outside the loop. This required the - * DES_SPtrans values in sp.h to be rotated 1 bit to the right. - * One perl script later and things have a 5% speed up on a sparc2. - * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> - * for pointing this out. */ - /* clear the top bits on machines with 8byte longs */ - /* shift left by 2 */ - r=ROTATE(r,29)&0xffffffffL; - l=ROTATE(l,29)&0xffffffffL; - - s=ks->ks->deslong; - /* I don't know if it is worth the effort of loop unrolling the - * inner loop */ - if (enc) - { -#ifdef DES_UNROLL - D_ENCRYPT(l,r, 0); /* 1 */ - D_ENCRYPT(r,l, 2); /* 2 */ - D_ENCRYPT(l,r, 4); /* 3 */ - D_ENCRYPT(r,l, 6); /* 4 */ - D_ENCRYPT(l,r, 8); /* 5 */ - D_ENCRYPT(r,l,10); /* 6 */ - D_ENCRYPT(l,r,12); /* 7 */ - D_ENCRYPT(r,l,14); /* 8 */ - D_ENCRYPT(l,r,16); /* 9 */ - D_ENCRYPT(r,l,18); /* 10 */ - D_ENCRYPT(l,r,20); /* 11 */ - D_ENCRYPT(r,l,22); /* 12 */ - D_ENCRYPT(l,r,24); /* 13 */ - D_ENCRYPT(r,l,26); /* 14 */ - D_ENCRYPT(l,r,28); /* 15 */ - D_ENCRYPT(r,l,30); /* 16 */ -#else - for (i=0; i<32; i+=8) - { - D_ENCRYPT(l,r,i+0); /* 1 */ - D_ENCRYPT(r,l,i+2); /* 2 */ - D_ENCRYPT(l,r,i+4); /* 3 */ - D_ENCRYPT(r,l,i+6); /* 4 */ - } -#endif - } - else - { -#ifdef DES_UNROLL - D_ENCRYPT(l,r,30); /* 16 */ - D_ENCRYPT(r,l,28); /* 15 */ - D_ENCRYPT(l,r,26); /* 14 */ - D_ENCRYPT(r,l,24); /* 13 */ - D_ENCRYPT(l,r,22); /* 12 */ - D_ENCRYPT(r,l,20); /* 11 */ - D_ENCRYPT(l,r,18); /* 10 */ - D_ENCRYPT(r,l,16); /* 9 */ - D_ENCRYPT(l,r,14); /* 8 */ - D_ENCRYPT(r,l,12); /* 7 */ - D_ENCRYPT(l,r,10); /* 6 */ - D_ENCRYPT(r,l, 8); /* 5 */ - D_ENCRYPT(l,r, 6); /* 4 */ - D_ENCRYPT(r,l, 4); /* 3 */ - D_ENCRYPT(l,r, 2); /* 2 */ - D_ENCRYPT(r,l, 0); /* 1 */ -#else - for (i=30; i>0; i-=8) - { - D_ENCRYPT(l,r,i-0); /* 16 */ - D_ENCRYPT(r,l,i-2); /* 15 */ - D_ENCRYPT(l,r,i-4); /* 14 */ - D_ENCRYPT(r,l,i-6); /* 13 */ - } -#endif - } - - /* rotate and clear the top bits on machines with 8byte longs */ - l=ROTATE(l,3)&0xffffffffL; - r=ROTATE(r,3)&0xffffffffL; - - FP(r,l); - data[0]=l; - data[1]=r; - l=r=t=u=0; - } - -#ifndef _APPLE_COMMON_CRYPTO_ - -void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) - { - register DES_LONG l,r,t,u; -#ifdef DES_PTR - register const unsigned char *des_SP=(const unsigned char *)DES_SPtrans; -#endif -#ifndef DES_UNROLL - register int i; -#endif - register DES_LONG *s; - - r=data[0]; - l=data[1]; - - /* Things have been modified so that the initial rotate is - * done outside the loop. This required the - * DES_SPtrans values in sp.h to be rotated 1 bit to the right. - * One perl script later and things have a 5% speed up on a sparc2. - * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> - * for pointing this out. */ - /* clear the top bits on machines with 8byte longs */ - r=ROTATE(r,29)&0xffffffffL; - l=ROTATE(l,29)&0xffffffffL; - - s=ks->ks->deslong; - /* I don't know if it is worth the effort of loop unrolling the - * inner loop */ - if (enc) - { -#ifdef DES_UNROLL - D_ENCRYPT(l,r, 0); /* 1 */ - D_ENCRYPT(r,l, 2); /* 2 */ - D_ENCRYPT(l,r, 4); /* 3 */ - D_ENCRYPT(r,l, 6); /* 4 */ - D_ENCRYPT(l,r, 8); /* 5 */ - D_ENCRYPT(r,l,10); /* 6 */ - D_ENCRYPT(l,r,12); /* 7 */ - D_ENCRYPT(r,l,14); /* 8 */ - D_ENCRYPT(l,r,16); /* 9 */ - D_ENCRYPT(r,l,18); /* 10 */ - D_ENCRYPT(l,r,20); /* 11 */ - D_ENCRYPT(r,l,22); /* 12 */ - D_ENCRYPT(l,r,24); /* 13 */ - D_ENCRYPT(r,l,26); /* 14 */ - D_ENCRYPT(l,r,28); /* 15 */ - D_ENCRYPT(r,l,30); /* 16 */ -#else - for (i=0; i<32; i+=8) - { - D_ENCRYPT(l,r,i+0); /* 1 */ - D_ENCRYPT(r,l,i+2); /* 2 */ - D_ENCRYPT(l,r,i+4); /* 3 */ - D_ENCRYPT(r,l,i+6); /* 4 */ - } -#endif - } - else - { -#ifdef DES_UNROLL - D_ENCRYPT(l,r,30); /* 16 */ - D_ENCRYPT(r,l,28); /* 15 */ - D_ENCRYPT(l,r,26); /* 14 */ - D_ENCRYPT(r,l,24); /* 13 */ - D_ENCRYPT(l,r,22); /* 12 */ - D_ENCRYPT(r,l,20); /* 11 */ - D_ENCRYPT(l,r,18); /* 10 */ - D_ENCRYPT(r,l,16); /* 9 */ - D_ENCRYPT(l,r,14); /* 8 */ - D_ENCRYPT(r,l,12); /* 7 */ - D_ENCRYPT(l,r,10); /* 6 */ - D_ENCRYPT(r,l, 8); /* 5 */ - D_ENCRYPT(l,r, 6); /* 4 */ - D_ENCRYPT(r,l, 4); /* 3 */ - D_ENCRYPT(l,r, 2); /* 2 */ - D_ENCRYPT(r,l, 0); /* 1 */ -#else - for (i=30; i>0; i-=8) - { - D_ENCRYPT(l,r,i-0); /* 16 */ - D_ENCRYPT(r,l,i-2); /* 15 */ - D_ENCRYPT(l,r,i-4); /* 14 */ - D_ENCRYPT(r,l,i-6); /* 13 */ - } -#endif - } - /* rotate and clear the top bits on machines with 8byte longs */ - data[0]=ROTATE(l,3)&0xffffffffL; - data[1]=ROTATE(r,3)&0xffffffffL; - l=r=t=u=0; - } - -void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3) - { - register DES_LONG l,r; - - l=data[0]; - r=data[1]; - IP(l,r); - data[0]=l; - data[1]=r; - DES_encrypt2((DES_LONG *)data,ks1,DES_ENCRYPT); - DES_encrypt2((DES_LONG *)data,ks2,DES_DECRYPT); - DES_encrypt2((DES_LONG *)data,ks3,DES_ENCRYPT); - l=data[0]; - r=data[1]; - FP(r,l); - data[0]=l; - data[1]=r; - } - -void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3) - { - register DES_LONG l,r; - - l=data[0]; - r=data[1]; - IP(l,r); - data[0]=l; - data[1]=r; - DES_encrypt2((DES_LONG *)data,ks3,DES_DECRYPT); - DES_encrypt2((DES_LONG *)data,ks2,DES_ENCRYPT); - DES_encrypt2((DES_LONG *)data,ks1,DES_DECRYPT); - l=data[0]; - r=data[1]; - FP(r,l); - data[0]=l; - data[1]=r; - } - -#ifndef DES_DEFAULT_OPTIONS - -#undef CBC_ENC_C__DONT_UPDATE_IV -#include "ncbc_enc.c" /* DES_ncbc_encrypt */ - -void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int enc) - { - register DES_LONG tin0,tin1; - register DES_LONG tout0,tout1,xor0,xor1; - register const unsigned char *in; - unsigned char *out; - register long l=length; - DES_LONG tin[2]; - unsigned char *iv; - - in=input; - out=output; - iv = &(*ivec)[0]; - - if (enc) - { - c2l(iv,tout0); - c2l(iv,tout1); - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); - c2l(in,tin1); - tin0^=tout0; - tin1^=tout1; - - tin[0]=tin0; - tin[1]=tin1; - DES_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; - - l2c(tout0,out); - l2c(tout1,out); - } - if (l != -8) - { - c2ln(in,tin0,tin1,l+8); - tin0^=tout0; - tin1^=tout1; - - tin[0]=tin0; - tin[1]=tin1; - DES_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; - - l2c(tout0,out); - l2c(tout1,out); - } - iv = &(*ivec)[0]; - l2c(tout0,iv); - l2c(tout1,iv); - } - else - { - register DES_LONG t0,t1; - - c2l(iv,xor0); - c2l(iv,xor1); - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); - c2l(in,tin1); - - t0=tin0; - t1=tin1; - - tin[0]=tin0; - tin[1]=tin1; - DES_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; - - tout0^=xor0; - tout1^=xor1; - l2c(tout0,out); - l2c(tout1,out); - xor0=t0; - xor1=t1; - } - if (l != -8) - { - c2l(in,tin0); - c2l(in,tin1); - - t0=tin0; - t1=tin1; - - tin[0]=tin0; - tin[1]=tin1; - DES_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; - - tout0^=xor0; - tout1^=xor1; - l2cn(tout0,tout1,out,l+8); - xor0=t0; - xor1=t1; - } - - iv = &(*ivec)[0]; - l2c(xor0,iv); - l2c(xor1,iv); - } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; - } - -#endif /* _APPLE_COMMON_CRYPTO_ */ -#endif /* DES_DEFAULT_OPTIONS */ - DELETED Source/ccOpenssl/des_locl.h Index: Source/ccOpenssl/des_locl.h ================================================================== --- Source/ccOpenssl/des_locl.h +++ /dev/null @@ -1,438 +0,0 @@ -/* crypto/des/des_locl.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef HEADER_DES_LOCL_H -#define HEADER_DES_LOCL_H - -#include -#include - -#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) -#ifndef OPENSSL_SYS_MSDOS -#define OPENSSL_SYS_MSDOS -#endif -#endif - -#include -#include - -/* building in CommonCrypto */ -#define DES_DEFAULT_OPTIONS - -#ifndef OPENSSL_SYS_MSDOS -#if !defined(OPENSSL_SYS_VMS) || defined(__DECC) -#ifdef OPENSSL_UNISTD -# include OPENSSL_UNISTD -#else -# include -#endif -#include -#endif -#endif - -#include - -#ifdef OPENSSL_SYS_MSDOS /* Visual C++ 2.1 (Windows NT/95) */ -#include -#include -#include -#include -#endif - -#if defined(__STDC__) || defined(OPENSSL_SYS_VMS) || defined(M_XENIX) || defined(OPENSSL_SYS_MSDOS) -#include -#endif - -#ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -#endif - -#define ITERATIONS 16 -#define HALF_ITERATIONS 8 - -/* used in des_read and des_write */ -#define MAXWRITE (1024*16) -#define BSIZE (MAXWRITE+4) - -#define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ - l|=((DES_LONG)(*((c)++)))<< 8L, \ - l|=((DES_LONG)(*((c)++)))<<16L, \ - l|=((DES_LONG)(*((c)++)))<<24L) - -/* NOTE - c is not incremented as per c2l */ -#define c2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ - case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ - case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ - case 5: l2|=((DES_LONG)(*(--(c)))); \ - case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ - case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ - case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ - case 1: l1|=((DES_LONG)(*(--(c)))); \ - } \ - } - -#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>24L)&0xff)) - -/* replacements for htonl and ntohl since I have no idea what to do - * when faced with machines with 8 byte longs. */ -#define HDRSIZE 4 - -#define n2l(c,l) (l =((DES_LONG)(*((c)++)))<<24L, \ - l|=((DES_LONG)(*((c)++)))<<16L, \ - l|=((DES_LONG)(*((c)++)))<< 8L, \ - l|=((DES_LONG)(*((c)++)))) - -#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l) )&0xff)) - -/* NOTE - c is not incremented as per l2c */ -#define l2cn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ - } \ - } - -#if defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER) -#define ROTATE(a,n) (_lrotr(a,n)) -#elif defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC) -# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) -# define ROTATE(a,n) ({ register unsigned int ret; \ - asm ("rorl %1,%0" \ - : "=r"(ret) \ - : "I"(n),"0"((unsigned int)a) \ - : "cc"); \ - ret; \ - }) -# endif -#endif -#ifndef ROTATE -#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) -#endif - -/* Don't worry about the LOAD_DATA() stuff, that is used by - * fcrypt() to add it's little bit to the front */ - -#ifdef DES_FCRYPT - -#define LOAD_DATA_tmp(R,S,u,t,E0,E1) \ - { DES_LONG tmp; LOAD_DATA(R,S,u,t,E0,E1,tmp); } - -#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ - t=R^(R>>16L); \ - u=t&E0; t&=E1; \ - tmp=(u<<16); u^=R^s[S ]; u^=tmp; \ - tmp=(t<<16); t^=R^s[S+1]; t^=tmp -#else -#define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) -#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ - u=R^s[S ]; \ - t=R^s[S+1] -#endif - -/* The changes to this macro may help or hinder, depending on the - * compiler and the architecture. gcc2 always seems to do well :-). - * Inspired by Dana How - * DO NOT use the alternative version on machines with 8 byte longs. - * It does not seem to work on the Alpha, even when DES_LONG is 4 - * bytes, probably an issue of accessing non-word aligned objects :-( */ -#ifdef DES_PTR - -/* It recently occurred to me that 0^0^0^0^0^0^0 == 0, so there - * is no reason to not xor all the sub items together. This potentially - * saves a register since things can be xored directly into L */ - -#if defined(DES_RISC1) || defined(DES_RISC2) -#ifdef DES_RISC1 -#define D_ENCRYPT(LL,R,S) { \ - unsigned int u1,u2,u3; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u2=(int)u>>8L; \ - u1=(int)u&0xfc; \ - u2&=0xfc; \ - t=ROTATE(t,4); \ - u>>=16L; \ - LL^= *(const DES_LONG *)(des_SP +u1); \ - LL^= *(const DES_LONG *)(des_SP+0x200+u2); \ - u3=(int)(u>>8L); \ - u1=(int)u&0xfc; \ - u3&=0xfc; \ - LL^= *(const DES_LONG *)(des_SP+0x400+u1); \ - LL^= *(const DES_LONG *)(des_SP+0x600+u3); \ - u2=(int)t>>8L; \ - u1=(int)t&0xfc; \ - u2&=0xfc; \ - t>>=16L; \ - LL^= *(const DES_LONG *)(des_SP+0x100+u1); \ - LL^= *(const DES_LONG *)(des_SP+0x300+u2); \ - u3=(int)t>>8L; \ - u1=(int)t&0xfc; \ - u3&=0xfc; \ - LL^= *(const DES_LONG *)(des_SP+0x500+u1); \ - LL^= *(const DES_LONG *)(des_SP+0x700+u3); } -#endif -#ifdef DES_RISC2 -#define D_ENCRYPT(LL,R,S) { \ - unsigned int u1,u2,s1,s2; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u2=(int)u>>8L; \ - u1=(int)u&0xfc; \ - u2&=0xfc; \ - t=ROTATE(t,4); \ - LL^= *(const DES_LONG *)(des_SP +u1); \ - LL^= *(const DES_LONG *)(des_SP+0x200+u2); \ - s1=(int)(u>>16L); \ - s2=(int)(u>>24L); \ - s1&=0xfc; \ - s2&=0xfc; \ - LL^= *(const DES_LONG *)(des_SP+0x400+s1); \ - LL^= *(const DES_LONG *)(des_SP+0x600+s2); \ - u2=(int)t>>8L; \ - u1=(int)t&0xfc; \ - u2&=0xfc; \ - LL^= *(const DES_LONG *)(des_SP+0x100+u1); \ - LL^= *(const DES_LONG *)(des_SP+0x300+u2); \ - s1=(int)(t>>16L); \ - s2=(int)(t>>24L); \ - s1&=0xfc; \ - s2&=0xfc; \ - LL^= *(const DES_LONG *)(des_SP+0x500+s1); \ - LL^= *(const DES_LONG *)(des_SP+0x700+s2); } -#endif -#else -#define D_ENCRYPT(LL,R,S) { \ - LOAD_DATA_tmp(R,S,u,t,E0,E1); \ - t=ROTATE(t,4); \ - LL^= \ - *(const DES_LONG *)(des_SP +((u )&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x200+((u>> 8L)&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x400+((u>>16L)&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x600+((u>>24L)&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x100+((t )&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x300+((t>> 8L)&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x500+((t>>16L)&0xfc))^ \ - *(const DES_LONG *)(des_SP+0x700+((t>>24L)&0xfc)); } -#endif - -#else /* original version */ - -#if defined(DES_RISC1) || defined(DES_RISC2) -#ifdef DES_RISC1 -#define D_ENCRYPT(LL,R,S) {\ - unsigned int u1,u2,u3; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u>>=2L; \ - t=ROTATE(t,6); \ - u2=(int)u>>8L; \ - u1=(int)u&0x3f; \ - u2&=0x3f; \ - u>>=16L; \ - LL^=DES_SPtrans[0][u1]; \ - LL^=DES_SPtrans[2][u2]; \ - u3=(int)u>>8L; \ - u1=(int)u&0x3f; \ - u3&=0x3f; \ - LL^=DES_SPtrans[4][u1]; \ - LL^=DES_SPtrans[6][u3]; \ - u2=(int)t>>8L; \ - u1=(int)t&0x3f; \ - u2&=0x3f; \ - t>>=16L; \ - LL^=DES_SPtrans[1][u1]; \ - LL^=DES_SPtrans[3][u2]; \ - u3=(int)t>>8L; \ - u1=(int)t&0x3f; \ - u3&=0x3f; \ - LL^=DES_SPtrans[5][u1]; \ - LL^=DES_SPtrans[7][u3]; } -#endif -#ifdef DES_RISC2 -#define D_ENCRYPT(LL,R,S) {\ - unsigned int u1,u2,s1,s2; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u>>=2L; \ - t=ROTATE(t,6); \ - u2=(int)u>>8L; \ - u1=(int)u&0x3f; \ - u2&=0x3f; \ - LL^=DES_SPtrans[0][u1]; \ - LL^=DES_SPtrans[2][u2]; \ - s1=(int)u>>16L; \ - s2=(int)u>>24L; \ - s1&=0x3f; \ - s2&=0x3f; \ - LL^=DES_SPtrans[4][s1]; \ - LL^=DES_SPtrans[6][s2]; \ - u2=(int)t>>8L; \ - u1=(int)t&0x3f; \ - u2&=0x3f; \ - LL^=DES_SPtrans[1][u1]; \ - LL^=DES_SPtrans[3][u2]; \ - s1=(int)t>>16; \ - s2=(int)t>>24L; \ - s1&=0x3f; \ - s2&=0x3f; \ - LL^=DES_SPtrans[5][s1]; \ - LL^=DES_SPtrans[7][s2]; } -#endif - -#else - -#define D_ENCRYPT(LL,R,S) {\ - LOAD_DATA_tmp(R,S,u,t,E0,E1); \ - t=ROTATE(t,4); \ - LL^=\ - DES_SPtrans[0][(u>> 2L)&0x3f]^ \ - DES_SPtrans[2][(u>>10L)&0x3f]^ \ - DES_SPtrans[4][(u>>18L)&0x3f]^ \ - DES_SPtrans[6][(u>>26L)&0x3f]^ \ - DES_SPtrans[1][(t>> 2L)&0x3f]^ \ - DES_SPtrans[3][(t>>10L)&0x3f]^ \ - DES_SPtrans[5][(t>>18L)&0x3f]^ \ - DES_SPtrans[7][(t>>26L)&0x3f]; } -#endif -#endif - - /* IP and FP - * The problem is more of a geometric problem that random bit fiddling. - 0 1 2 3 4 5 6 7 62 54 46 38 30 22 14 6 - 8 9 10 11 12 13 14 15 60 52 44 36 28 20 12 4 - 16 17 18 19 20 21 22 23 58 50 42 34 26 18 10 2 - 24 25 26 27 28 29 30 31 to 56 48 40 32 24 16 8 0 - - 32 33 34 35 36 37 38 39 63 55 47 39 31 23 15 7 - 40 41 42 43 44 45 46 47 61 53 45 37 29 21 13 5 - 48 49 50 51 52 53 54 55 59 51 43 35 27 19 11 3 - 56 57 58 59 60 61 62 63 57 49 41 33 25 17 9 1 - - The output has been subject to swaps of the form - 0 1 -> 3 1 but the odd and even bits have been put into - 2 3 2 0 - different words. The main trick is to remember that - t=((l>>size)^r)&(mask); - r^=t; - l^=(t<>(n))^(b))&(m)),\ - (b)^=(t),\ - (a)^=((t)<<(n))) - -#define IP(l,r) \ - { \ - register DES_LONG tt; \ - PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ - PERM_OP(l,r,tt,16,0x0000ffffL); \ - PERM_OP(r,l,tt, 2,0x33333333L); \ - PERM_OP(l,r,tt, 8,0x00ff00ffL); \ - PERM_OP(r,l,tt, 1,0x55555555L); \ - } - -#define FP(l,r) \ - { \ - register DES_LONG tt; \ - PERM_OP(l,r,tt, 1,0x55555555L); \ - PERM_OP(r,l,tt, 8,0x00ff00ffL); \ - PERM_OP(l,r,tt, 2,0x33333333L); \ - PERM_OP(r,l,tt,16,0x0000ffffL); \ - PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ - } - -#ifdef _APPLE_COMMON_CRYPTO_ -/* avoid symbol collision with libSystem & libcrypto */ -#define DES_SPtrans CC_DES_SPtrans -#endif /* _APPLE_COMMON_CRYPTO_ */ - -OPENSSL_EXTERN const DES_LONG DES_SPtrans[8][64]; - -void fcrypt_body(DES_LONG *out,DES_key_schedule *ks, - DES_LONG Eswap0, DES_LONG Eswap1); -#endif DELETED Source/ccOpenssl/e_os2.h Index: Source/ccOpenssl/e_os2.h ================================================================== --- Source/ccOpenssl/e_os2.h +++ /dev/null @@ -1,272 +0,0 @@ -/* e_os2.h */ -/* ==================================================================== - * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@openssl.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - - -#ifndef HEADER_E_OS2_H -#define HEADER_E_OS2_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/****************************************************************************** - * Detect operating systems. This probably needs completing. - * The result is that at least one OPENSSL_SYS_os macro should be defined. - * However, if none is defined, Unix is assumed. - **/ - -#define OPENSSL_SYS_UNIX - -/* ----------------------- Macintosh, before MacOS X ----------------------- */ -#if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_MACINTOSH_CLASSIC -#endif - -/* ---------------------- Microsoft operating systems ---------------------- */ - -/* The 16 bit environments are pretty straightforward */ -#if defined(OPENSSL_SYSNAME_WIN16) || defined(OPENSSL_SYSNAME_MSDOS) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_MSDOS -#endif -#if defined(OPENSSL_SYSNAME_WIN16) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WIN16 -#endif - -/* For 32 bit environment, there seems to be the CygWin environment and then - all the others that try to do the same thing Microsoft does... */ -#if defined(OPENSSL_SYSNAME_UWIN) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WIN32_UWIN -#else -# if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WIN32_CYGWIN -# else -# if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WIN32 -# endif -# if defined(OPENSSL_SYSNAME_WINNT) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WINNT -# endif -# if defined(OPENSSL_SYSNAME_WINCE) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WINCE -# endif -# endif -#endif - -/* Anything that tries to look like Microsoft is "Windows" */ -#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WINDOWS -# ifndef OPENSSL_SYS_MSDOS -# define OPENSSL_SYS_MSDOS -# endif -#endif - -/* DLL settings. This part is a bit tough, because it's up to the application - implementor how he or she will link the application, so it requires some - macro to be used. */ -#ifdef OPENSSL_SYS_WINDOWS -# ifndef OPENSSL_OPT_WINDLL -# if defined(_WINDLL) /* This is used when building OpenSSL to indicate that - DLL linkage should be used */ -# define OPENSSL_OPT_WINDLL -# endif -# endif -#endif - -/* -------------------------------- OpenVMS -------------------------------- */ -#if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_VMS -# if defined(__DECC) -# define OPENSSL_SYS_VMS_DECC -# elif defined(__DECCXX) -# define OPENSSL_SYS_VMS_DECC -# define OPENSSL_SYS_VMS_DECCXX -# else -# define OPENSSL_SYS_VMS_NODECC -# endif -#endif - -/* --------------------------------- OS/2 ---------------------------------- */ -#if defined(__EMX__) || defined(__OS2__) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_OS2 -#endif - -/* --------------------------------- Unix ---------------------------------- */ -#ifdef OPENSSL_SYS_UNIX -# if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX) -# define OPENSSL_SYS_LINUX -# endif -# ifdef OPENSSL_SYSNAME_MPE -# define OPENSSL_SYS_MPE -# endif -# ifdef OPENSSL_SYSNAME_SNI -# define OPENSSL_SYS_SNI -# endif -# ifdef OPENSSL_SYSNAME_ULTRASPARC -# define OPENSSL_SYS_ULTRASPARC -# endif -# ifdef OPENSSL_SYSNAME_NEWS4 -# define OPENSSL_SYS_NEWS4 -# endif -# ifdef OPENSSL_SYSNAME_MACOSX -# define OPENSSL_SYS_MACOSX -# endif -# ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY -# define OPENSSL_SYS_MACOSX_RHAPSODY -# define OPENSSL_SYS_MACOSX -# endif -# ifdef OPENSSL_SYSNAME_SUNOS -# define OPENSSL_SYS_SUNOS -#endif -# if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY) -# define OPENSSL_SYS_CRAY -# endif -# if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX) -# define OPENSSL_SYS_AIX -# endif -#endif - -/* ------------------------------- VxWorks --------------------------------- */ -#ifdef OPENSSL_SYSNAME_VXWORKS -# define OPENSSL_SYS_VXWORKS -#endif - -/** - * That's it for OS-specific stuff - *****************************************************************************/ - - -/* Specials for I/O an exit */ -#ifdef OPENSSL_SYS_MSDOS -# define OPENSSL_UNISTD_IO -# define OPENSSL_DECLARE_EXIT extern void exit(int); -#else -# define OPENSSL_UNISTD_IO OPENSSL_UNISTD -# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ -#endif - -/* Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare - certain global symbols that, with some compilers under VMS, have to be - defined and declared explicitely with globaldef and globalref. - Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare - DLL exports and imports for compilers under Win32. These are a little - more complicated to use. Basically, for any library that exports some - global variables, the following code must be present in the header file - that declares them, before OPENSSL_EXTERN is used: - - #ifdef SOME_BUILD_FLAG_MACRO - # undef OPENSSL_EXTERN - # define OPENSSL_EXTERN OPENSSL_EXPORT - #endif - - The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL - have some generally sensible values, and for OPENSSL_EXTERN to have the - value OPENSSL_IMPORT. -*/ - -#if defined(OPENSSL_SYS_VMS_NODECC) -# define OPENSSL_EXPORT globalref -# define OPENSSL_IMPORT globalref -# define OPENSSL_GLOBAL globaldef -#elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) -# define OPENSSL_EXPORT extern _declspec(dllexport) -# define OPENSSL_IMPORT extern _declspec(dllimport) -# define OPENSSL_GLOBAL -#else -# define OPENSSL_EXPORT extern -# define OPENSSL_IMPORT extern -# define OPENSSL_GLOBAL -#endif -#define OPENSSL_EXTERN OPENSSL_IMPORT - -/* Macros to allow global variables to be reached through function calls when - required (if a shared library version requvres it, for example. - The way it's done allows definitions like this: - - // in foobar.c - OPENSSL_IMPLEMENT_GLOBAL(int,foobar) = 0; - // in foobar.h - OPENSSL_DECLARE_GLOBAL(int,foobar); - #define foobar OPENSSL_GLOBAL_REF(foobar) -*/ -#ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION -# define OPENSSL_IMPLEMENT_GLOBAL(type,name) static type _hide_##name; \ - type *_shadow_##name(void) { return &_hide_##name; } \ - static type _hide_##name -# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) -# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) -#else -# define OPENSSL_IMPLEMENT_GLOBAL(type,name) OPENSSL_GLOBAL type _shadow_##name -# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name -# define OPENSSL_GLOBAL_REF(name) _shadow_##name -#endif - -#ifdef __cplusplus -} -#endif -#endif DELETED Source/ccOpenssl/opensslDES.c Index: Source/ccOpenssl/opensslDES.c ================================================================== --- Source/ccOpenssl/opensslDES.c +++ /dev/null @@ -1,168 +0,0 @@ -/* crypto/des/des_enc.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* - * This is pared-down version of openssl's des_enc.c, shorn of - * everything except the bare-bones single-block encrypt/decrypt - * routine DES_encrypt1(). Plus it has the shim code needed to - * use this function in CommonEncryption. - */ - -#include -#include "ccOpenssl/des_locl.h" -#include -#include "spr.h" - -/* CommonCrypto shim */ - -int osDesSetkey(DES_key_schedule *dinst, char *key, size_t keyLength, - int forEencrypt) -{ - DES_cblock cblock; - memmove(&cblock, key, 8); - DES_set_key_unchecked(&cblock, dinst); - return 0; -} - -void osDesEncrypt(DES_key_schedule *ks, - const_DES_cblock *input, - DES_cblock *output) -{ - /* copied from openssl's DES_ecb_encrypt() */ - register DES_LONG l; - DES_LONG ll[2]; - const unsigned char *in = &(*input)[0]; - unsigned char *out = &(*output)[0]; - - c2l(in,l); ll[0]=l; - c2l(in,l); ll[1]=l; - DES_encrypt1(ll,ks,1); - l=ll[0]; l2c(l,out); - l=ll[1]; l2c(l,out); - l=ll[0]=ll[1]=0; -} - -void osDesDecrypt(DES_key_schedule *ks, - const_DES_cblock *input, - DES_cblock *output) -{ - /* copied from openssl's DES_ecb_encrypt() */ - register DES_LONG l; - DES_LONG ll[2]; - const unsigned char *in = &(*input)[0]; - unsigned char *out = &(*output)[0]; - - c2l(in,l); ll[0]=l; - c2l(in,l); ll[1]=l; - DES_encrypt1(ll,ks,0); - l=ll[0]; l2c(l,out); - l=ll[1]; l2c(l,out); - l=ll[0]=ll[1]=0; -} - -int osDes3Setkey(DES3_Schedule *dinst, char *key, size_t keyLength, - int forEencrypt) -{ - DES_cblock cblock; - memmove(&cblock, key, 8); - DES_set_key_unchecked(&cblock, &dinst->ks[0]); - memmove(&cblock, key+8, 8); - DES_set_key_unchecked(&cblock, &dinst->ks[1]); - memmove(&cblock, key+16, 8); - DES_set_key_unchecked(&cblock, &dinst->ks[2]); - return 0; - -} - -void osDes3Encrypt(DES3_Schedule *ks, - const_DES_cblock *input, - DES_cblock *output) -{ - register DES_LONG l; - DES_LONG ll[2]; - const unsigned char *in = &(*input)[0]; - unsigned char *out = &(*output)[0]; - - c2l(in,l); ll[0]=l; - c2l(in,l); ll[1]=l; - DES_encrypt1(ll,&ks->ks[0],1); - DES_encrypt1(ll,&ks->ks[1],0); - DES_encrypt1(ll,&ks->ks[2],1); - l=ll[0]; l2c(l,out); - l=ll[1]; l2c(l,out); - l=ll[0]=ll[1]=0; -} - -void osDes3Decrypt(DES3_Schedule *ks, - const_DES_cblock *input, - DES_cblock *output) -{ - register DES_LONG l; - DES_LONG ll[2]; - const unsigned char *in = &(*input)[0]; - unsigned char *out = &(*output)[0]; - - c2l(in,l); ll[0]=l; - c2l(in,l); ll[1]=l; - DES_encrypt1(ll,&ks->ks[2],0); - DES_encrypt1(ll,&ks->ks[1],1); - DES_encrypt1(ll,&ks->ks[0],0); - l=ll[0]; l2c(l,out); - l=ll[1]; l2c(l,out); - l=ll[0]=ll[1]=0; -} DELETED Source/ccOpenssl/opensslconf.h Index: Source/ccOpenssl/opensslconf.h ================================================================== --- Source/ccOpenssl/opensslconf.h +++ /dev/null @@ -1,118 +0,0 @@ -/* MacOS/opensslconf.h */ - -#include - -#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ -#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) -#define OPENSSLDIR "/usr/local/ssl" -#endif -#endif - -#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) -#define IDEA_INT unsigned int -#endif - -#if defined(HEADER_MD2_H) && !defined(MD2_INT) -#define MD2_INT unsigned int -#endif - -#if defined(HEADER_RC2_H) && !defined(RC2_INT) -/* I need to put in a mod for the alpha - eay */ -#define RC2_INT unsigned int -#endif - -#if defined(HEADER_RC4_H) -#if !defined(RC4_INT) -/* using int types make the structure larger but make the code faster - * on most boxes I have tested - up to %20 faster. */ -/* - * I don't know what does "most" mean, but declaring "int" is a must on: - * - Intel P6 because partial register stalls are very expensive; - * - elder Alpha because it lacks byte load/store instructions; - */ -#define RC4_INT unsigned char -#endif -#if !defined(RC4_CHUNK) -/* - * This enables code handling data aligned at natural CPU word - * boundary. See crypto/rc4/rc4_enc.c for further details. - */ -#define RC4_CHUNK unsigned long -#endif -#endif - -#if defined(HEADER_DES_H) && !defined(DES_LONG) -/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a - * %20 speed up (longs are 8 bytes, int's are 4). */ -#ifndef DES_LONG -#define DES_LONG unsigned long -#endif -#endif - -#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) -#define CONFIG_HEADER_BN_H -#if __option(longlong) -# define BN_LLONG -#else -# undef BN_LLONG -#endif - -/* Should we define BN_DIV2W here? */ - -/* Only one for the following should be defined */ -/* The prime number generation stuff may not work when - * EIGHT_BIT but I don't care since I've only used this mode - * for debuging the bignum libraries */ -#undef SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#define THIRTY_TWO_BIT -#undef SIXTEEN_BIT -#undef EIGHT_BIT -#endif - -#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) -#define CONFIG_HEADER_RC4_LOCL_H -/* if this is defined data[i] is used instead of *data, this is a %20 - * speedup on x86 */ -#undef RC4_INDEX -#endif - -#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) -#define CONFIG_HEADER_BF_LOCL_H -#define BF_PTR -#endif /* HEADER_BF_LOCL_H */ - -#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) -#define CONFIG_HEADER_DES_LOCL_H -/* the following is tweaked from a config script, that is why it is a - * protected undef/define */ -#ifndef DES_PTR -#define DES_PTR -#endif - -/* This helps C compiler generate the correct code for multiple functional - * units. It reduces register dependancies at the expense of 2 more - * registers */ -#ifndef DES_RISC1 -#define DES_RISC1 -#endif - -#ifndef DES_RISC2 -#undef DES_RISC2 -#endif - -#if defined(DES_RISC1) && defined(DES_RISC2) -YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! -#endif - -/* Unroll the inner loop, this sometimes helps, sometimes hinders. - * Very mucy CPU dependant */ -#ifndef DES_UNROLL -#define DES_UNROLL -#endif - -#endif /* HEADER_DES_LOCL_H */ - -#ifndef __POWERPC__ -#define MD32_XARRAY -#endif DELETED Source/ccOpenssl/set_key.c Index: Source/ccOpenssl/set_key.c ================================================================== --- Source/ccOpenssl/set_key.c +++ /dev/null @@ -1,417 +0,0 @@ -/* crypto/des/set_key.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* set_key.c v 1.4 eay 24/9/91 - * 1.4 Speed up by 400% :-) - * 1.3 added register declarations. - * 1.2 unrolled make_key_sched a bit more - * 1.1 added norm_expand_bits - * 1.0 First working version - */ -#include "ccOpenssl/des_locl.h" - -// OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key) = 0; /* defaults to false */ - -#ifndef _APPLE_COMMON_CRYPTO_ - -static const unsigned char odd_parity[256]={ - 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, - 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, - 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, - 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, - 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, - 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, - 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, -112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, -128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, -145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, -161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, -176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, -193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, -208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, -224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, -241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; - -void DES_set_odd_parity(DES_cblock *key) - { - int i; - - for (i=0; i>(n))^(b))&(m)),\ - * (b)^=(t),\ - * (a)=((a)^((t)<<(n)))) - */ - -#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ - (a)=(a)^(t)^(t>>(16-(n)))) - -static const DES_LONG des_skb[8][64]={ - { - /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ - 0x00000000L,0x00000010L,0x20000000L,0x20000010L, - 0x00010000L,0x00010010L,0x20010000L,0x20010010L, - 0x00000800L,0x00000810L,0x20000800L,0x20000810L, - 0x00010800L,0x00010810L,0x20010800L,0x20010810L, - 0x00000020L,0x00000030L,0x20000020L,0x20000030L, - 0x00010020L,0x00010030L,0x20010020L,0x20010030L, - 0x00000820L,0x00000830L,0x20000820L,0x20000830L, - 0x00010820L,0x00010830L,0x20010820L,0x20010830L, - 0x00080000L,0x00080010L,0x20080000L,0x20080010L, - 0x00090000L,0x00090010L,0x20090000L,0x20090010L, - 0x00080800L,0x00080810L,0x20080800L,0x20080810L, - 0x00090800L,0x00090810L,0x20090800L,0x20090810L, - 0x00080020L,0x00080030L,0x20080020L,0x20080030L, - 0x00090020L,0x00090030L,0x20090020L,0x20090030L, - 0x00080820L,0x00080830L,0x20080820L,0x20080830L, - 0x00090820L,0x00090830L,0x20090820L,0x20090830L, - },{ - /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ - 0x00000000L,0x02000000L,0x00002000L,0x02002000L, - 0x00200000L,0x02200000L,0x00202000L,0x02202000L, - 0x00000004L,0x02000004L,0x00002004L,0x02002004L, - 0x00200004L,0x02200004L,0x00202004L,0x02202004L, - 0x00000400L,0x02000400L,0x00002400L,0x02002400L, - 0x00200400L,0x02200400L,0x00202400L,0x02202400L, - 0x00000404L,0x02000404L,0x00002404L,0x02002404L, - 0x00200404L,0x02200404L,0x00202404L,0x02202404L, - 0x10000000L,0x12000000L,0x10002000L,0x12002000L, - 0x10200000L,0x12200000L,0x10202000L,0x12202000L, - 0x10000004L,0x12000004L,0x10002004L,0x12002004L, - 0x10200004L,0x12200004L,0x10202004L,0x12202004L, - 0x10000400L,0x12000400L,0x10002400L,0x12002400L, - 0x10200400L,0x12200400L,0x10202400L,0x12202400L, - 0x10000404L,0x12000404L,0x10002404L,0x12002404L, - 0x10200404L,0x12200404L,0x10202404L,0x12202404L, - },{ - /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ - 0x00000000L,0x00000001L,0x00040000L,0x00040001L, - 0x01000000L,0x01000001L,0x01040000L,0x01040001L, - 0x00000002L,0x00000003L,0x00040002L,0x00040003L, - 0x01000002L,0x01000003L,0x01040002L,0x01040003L, - 0x00000200L,0x00000201L,0x00040200L,0x00040201L, - 0x01000200L,0x01000201L,0x01040200L,0x01040201L, - 0x00000202L,0x00000203L,0x00040202L,0x00040203L, - 0x01000202L,0x01000203L,0x01040202L,0x01040203L, - 0x08000000L,0x08000001L,0x08040000L,0x08040001L, - 0x09000000L,0x09000001L,0x09040000L,0x09040001L, - 0x08000002L,0x08000003L,0x08040002L,0x08040003L, - 0x09000002L,0x09000003L,0x09040002L,0x09040003L, - 0x08000200L,0x08000201L,0x08040200L,0x08040201L, - 0x09000200L,0x09000201L,0x09040200L,0x09040201L, - 0x08000202L,0x08000203L,0x08040202L,0x08040203L, - 0x09000202L,0x09000203L,0x09040202L,0x09040203L, - },{ - /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ - 0x00000000L,0x00100000L,0x00000100L,0x00100100L, - 0x00000008L,0x00100008L,0x00000108L,0x00100108L, - 0x00001000L,0x00101000L,0x00001100L,0x00101100L, - 0x00001008L,0x00101008L,0x00001108L,0x00101108L, - 0x04000000L,0x04100000L,0x04000100L,0x04100100L, - 0x04000008L,0x04100008L,0x04000108L,0x04100108L, - 0x04001000L,0x04101000L,0x04001100L,0x04101100L, - 0x04001008L,0x04101008L,0x04001108L,0x04101108L, - 0x00020000L,0x00120000L,0x00020100L,0x00120100L, - 0x00020008L,0x00120008L,0x00020108L,0x00120108L, - 0x00021000L,0x00121000L,0x00021100L,0x00121100L, - 0x00021008L,0x00121008L,0x00021108L,0x00121108L, - 0x04020000L,0x04120000L,0x04020100L,0x04120100L, - 0x04020008L,0x04120008L,0x04020108L,0x04120108L, - 0x04021000L,0x04121000L,0x04021100L,0x04121100L, - 0x04021008L,0x04121008L,0x04021108L,0x04121108L, - },{ - /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ - 0x00000000L,0x10000000L,0x00010000L,0x10010000L, - 0x00000004L,0x10000004L,0x00010004L,0x10010004L, - 0x20000000L,0x30000000L,0x20010000L,0x30010000L, - 0x20000004L,0x30000004L,0x20010004L,0x30010004L, - 0x00100000L,0x10100000L,0x00110000L,0x10110000L, - 0x00100004L,0x10100004L,0x00110004L,0x10110004L, - 0x20100000L,0x30100000L,0x20110000L,0x30110000L, - 0x20100004L,0x30100004L,0x20110004L,0x30110004L, - 0x00001000L,0x10001000L,0x00011000L,0x10011000L, - 0x00001004L,0x10001004L,0x00011004L,0x10011004L, - 0x20001000L,0x30001000L,0x20011000L,0x30011000L, - 0x20001004L,0x30001004L,0x20011004L,0x30011004L, - 0x00101000L,0x10101000L,0x00111000L,0x10111000L, - 0x00101004L,0x10101004L,0x00111004L,0x10111004L, - 0x20101000L,0x30101000L,0x20111000L,0x30111000L, - 0x20101004L,0x30101004L,0x20111004L,0x30111004L, - },{ - /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ - 0x00000000L,0x08000000L,0x00000008L,0x08000008L, - 0x00000400L,0x08000400L,0x00000408L,0x08000408L, - 0x00020000L,0x08020000L,0x00020008L,0x08020008L, - 0x00020400L,0x08020400L,0x00020408L,0x08020408L, - 0x00000001L,0x08000001L,0x00000009L,0x08000009L, - 0x00000401L,0x08000401L,0x00000409L,0x08000409L, - 0x00020001L,0x08020001L,0x00020009L,0x08020009L, - 0x00020401L,0x08020401L,0x00020409L,0x08020409L, - 0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, - 0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, - 0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, - 0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, - 0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, - 0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, - 0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, - 0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, - },{ - /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ - 0x00000000L,0x00000100L,0x00080000L,0x00080100L, - 0x01000000L,0x01000100L,0x01080000L,0x01080100L, - 0x00000010L,0x00000110L,0x00080010L,0x00080110L, - 0x01000010L,0x01000110L,0x01080010L,0x01080110L, - 0x00200000L,0x00200100L,0x00280000L,0x00280100L, - 0x01200000L,0x01200100L,0x01280000L,0x01280100L, - 0x00200010L,0x00200110L,0x00280010L,0x00280110L, - 0x01200010L,0x01200110L,0x01280010L,0x01280110L, - 0x00000200L,0x00000300L,0x00080200L,0x00080300L, - 0x01000200L,0x01000300L,0x01080200L,0x01080300L, - 0x00000210L,0x00000310L,0x00080210L,0x00080310L, - 0x01000210L,0x01000310L,0x01080210L,0x01080310L, - 0x00200200L,0x00200300L,0x00280200L,0x00280300L, - 0x01200200L,0x01200300L,0x01280200L,0x01280300L, - 0x00200210L,0x00200310L,0x00280210L,0x00280310L, - 0x01200210L,0x01200310L,0x01280210L,0x01280310L, - },{ - /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ - 0x00000000L,0x04000000L,0x00040000L,0x04040000L, - 0x00000002L,0x04000002L,0x00040002L,0x04040002L, - 0x00002000L,0x04002000L,0x00042000L,0x04042000L, - 0x00002002L,0x04002002L,0x00042002L,0x04042002L, - 0x00000020L,0x04000020L,0x00040020L,0x04040020L, - 0x00000022L,0x04000022L,0x00040022L,0x04040022L, - 0x00002020L,0x04002020L,0x00042020L,0x04042020L, - 0x00002022L,0x04002022L,0x00042022L,0x04042022L, - 0x00000800L,0x04000800L,0x00040800L,0x04040800L, - 0x00000802L,0x04000802L,0x00040802L,0x04040802L, - 0x00002800L,0x04002800L,0x00042800L,0x04042800L, - 0x00002802L,0x04002802L,0x00042802L,0x04042802L, - 0x00000820L,0x04000820L,0x00040820L,0x04040820L, - 0x00000822L,0x04000822L,0x00040822L,0x04040822L, - 0x00002820L,0x04002820L,0x00042820L,0x04042820L, - 0x00002822L,0x04002822L,0x00042822L,0x04042822L, - }}; - -#ifndef _APPLE_COMMON_CRYPTO_ -int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule) - { - if (DES_check_key) - { - return DES_set_key_checked(key, schedule); - } - else - { - DES_set_key_unchecked(key, schedule); - return 0; - } - } - -/* return 0 if key parity is odd (correct), - * return -1 if key parity error, - * return -2 if illegal weak key. - */ -int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule) - { - if (!DES_check_key_parity(key)) - return(-1); - if (DES_is_weak_key(key)) - return(-2); - DES_set_key_unchecked(key, schedule); - return 0; - } - -#endif /* APPLE_COMMON_CRYPTO */ - -void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule) - { - static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; - register DES_LONG c,d,t,s,t2; - register const unsigned char *in; - register DES_LONG *k; - register int i; - -#ifdef OPENBSD_DEV_CRYPTO - memcpy(schedule->key,key,sizeof schedule->key); - schedule->session=NULL; -#endif - k = &schedule->ks->deslong[0]; - in = &(*key)[0]; - - c2l(in,c); - c2l(in,d); - - /* do PC1 in 47 simple operations :-) - * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) - * for the inspiration. :-) */ - PERM_OP (d,c,t,4,0x0f0f0f0fL); - HPERM_OP(c,t,-2,0xcccc0000L); - HPERM_OP(d,t,-2,0xcccc0000L); - PERM_OP (d,c,t,1,0x55555555L); - PERM_OP (c,d,t,8,0x00ff00ffL); - PERM_OP (d,c,t,1,0x55555555L); - d= (((d&0x000000ffL)<<16L)| (d&0x0000ff00L) | - ((d&0x00ff0000L)>>16L)|((c&0xf0000000L)>>4L)); - c&=0x0fffffffL; - - for (i=0; i>2L)|(c<<26L)); d=((d>>2L)|(d<<26L)); } - else - { c=((c>>1L)|(c<<27L)); d=((d>>1L)|(d<<27L)); } - c&=0x0fffffffL; - d&=0x0fffffffL; - /* could be a few less shifts but I am to lazy at this - * point in time to investigate */ - s= des_skb[0][ (c )&0x3f ]| - des_skb[1][((c>> 6L)&0x03)|((c>> 7L)&0x3c)]| - des_skb[2][((c>>13L)&0x0f)|((c>>14L)&0x30)]| - des_skb[3][((c>>20L)&0x01)|((c>>21L)&0x06) | - ((c>>22L)&0x38)]; - t= des_skb[4][ (d )&0x3f ]| - des_skb[5][((d>> 7L)&0x03)|((d>> 8L)&0x3c)]| - des_skb[6][ (d>>15L)&0x3f ]| - des_skb[7][((d>>21L)&0x0f)|((d>>22L)&0x30)]; - - /* table contained 0213 4657 */ - t2=((t<<16L)|(s&0x0000ffffL))&0xffffffffL; - *(k++)=ROTATE(t2,30)&0xffffffffL; - - t2=((s>>16L)|(t&0xffff0000L)); - *(k++)=ROTATE(t2,26)&0xffffffffL; - } - } - -#ifndef _APPLE_COMMON_CRYPTO_ -int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule) - { - return(DES_set_key(key,schedule)); - } -#endif /* _APPLE_COMMON_CRYPTO_ */ - -/* -#undef des_fixup_key_parity -void des_fixup_key_parity(des_cblock *key) - { - des_set_odd_parity(key); - } -*/ DELETED Source/ccOpenssl/spr.h Index: Source/ccOpenssl/spr.h ================================================================== --- Source/ccOpenssl/spr.h +++ /dev/null @@ -1,210 +0,0 @@ -/* crypto/des/spr.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#ifdef _APPLE_COMMON_CRYPTO_ -/* avoid symbol collision with libSystem & libcrypto */ -#define DES_SPtrans CC_DES_SPtrans -#endif /* _APPLE_COMMON_CRYPTO_ */ - -const DES_LONG DES_SPtrans[8][64]={ -{ -/* nibble 0 */ -0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, -0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L, -0x00080802L, 0x02080800L, 0x02080000L, 0x00000802L, -0x02000802L, 0x02000000L, 0x00000000L, 0x00080002L, -0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L, -0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L, -0x00000002L, 0x00000800L, 0x00080800L, 0x02080002L, -0x00000800L, 0x02000802L, 0x02080002L, 0x00000000L, -0x00000000L, 0x02080802L, 0x02000800L, 0x00080002L, -0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L, -0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L, -0x00080802L, 0x00000002L, 0x02000002L, 0x02080000L, -0x02080802L, 0x00080800L, 0x02080000L, 0x02000802L, -0x02000000L, 0x00000802L, 0x00080002L, 0x00000000L, -0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L, -0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L, -},{ -/* nibble 1 */ -0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L, -0x40000010L, 0x00008010L, 0x40008000L, 0x00108000L, -0x00008000L, 0x40100010L, 0x00000010L, 0x40008000L, -0x00100010L, 0x40108000L, 0x40100000L, 0x00000010L, -0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L, -0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L, -0x40008010L, 0x00108010L, 0x40108000L, 0x40000010L, -0x40000000L, 0x00100000L, 0x00008010L, 0x40108010L, -0x00100010L, 0x40108000L, 0x40008000L, 0x00108010L, -0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L, -0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L, -0x00008000L, 0x40000000L, 0x00108010L, 0x40008010L, -0x40108000L, 0x00008000L, 0x00000000L, 0x40000010L, -0x00000010L, 0x40108010L, 0x00108000L, 0x40100000L, -0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L, -0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L, -},{ -/* nibble 2 */ -0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L, -0x00040001L, 0x04000000L, 0x04000101L, 0x00040100L, -0x04000100L, 0x00040000L, 0x04040000L, 0x00000001L, -0x04040101L, 0x00000101L, 0x00000001L, 0x04040001L, -0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L, -0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L, -0x04040001L, 0x04000100L, 0x00040101L, 0x04040000L, -0x00040100L, 0x00000000L, 0x04000000L, 0x00040101L, -0x04040100L, 0x00000100L, 0x00000001L, 0x00040000L, -0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L, -0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L, -0x00040001L, 0x04000000L, 0x04040101L, 0x00000001L, -0x00040101L, 0x04000001L, 0x04000000L, 0x04040101L, -0x00040000L, 0x04000100L, 0x04000101L, 0x00040100L, -0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L, -0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L, -},{ -/* nibble 3 */ -0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L, -0x00000000L, 0x10400000L, 0x10001008L, 0x00400008L, -0x10401000L, 0x10000008L, 0x10000000L, 0x00001008L, -0x10000008L, 0x00401008L, 0x00400000L, 0x10000000L, -0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L, -0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L, -0x00001008L, 0x00000000L, 0x00400008L, 0x10401000L, -0x10001000L, 0x10400008L, 0x10401008L, 0x00400000L, -0x10400008L, 0x00001008L, 0x00400000L, 0x10000008L, -0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L, -0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L, -0x00000000L, 0x10400008L, 0x10401000L, 0x00001000L, -0x10000000L, 0x10401008L, 0x00401008L, 0x00400000L, -0x10401008L, 0x00000008L, 0x10001000L, 0x00401008L, -0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L, -0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L, -},{ -/* nibble 4 */ -0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L, -0x08010020L, 0x08000400L, 0x00010420L, 0x08010000L, -0x00010000L, 0x00000020L, 0x08000020L, 0x00010400L, -0x08000420L, 0x08010020L, 0x08010400L, 0x00000000L, -0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L, -0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L, -0x00000020L, 0x08000420L, 0x08010420L, 0x00010020L, -0x08010000L, 0x00000400L, 0x00000420L, 0x08010400L, -0x08010400L, 0x08000420L, 0x00010020L, 0x08010000L, -0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L, -0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L, -0x00010420L, 0x08000000L, 0x00000400L, 0x00010020L, -0x08000420L, 0x00000400L, 0x00000000L, 0x08010420L, -0x08010020L, 0x08010400L, 0x00000420L, 0x00010000L, -0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L, -0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L, -},{ -/* nibble 5 */ -0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L, -0x00200040L, 0x00002000L, 0x80002040L, 0x00200000L, -0x00002040L, 0x80202040L, 0x00202000L, 0x80000000L, -0x80002000L, 0x80000040L, 0x80200000L, 0x00202040L, -0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L, -0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L, -0x80202040L, 0x80200000L, 0x80000000L, 0x00002040L, -0x00000040L, 0x00202000L, 0x00202040L, 0x80002000L, -0x00002040L, 0x80000000L, 0x80002000L, 0x00202040L, -0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L, -0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L, -0x00200040L, 0x80202040L, 0x00202000L, 0x00000040L, -0x80202040L, 0x00202000L, 0x00200000L, 0x80002040L, -0x80000040L, 0x80200000L, 0x00202040L, 0x00000000L, -0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L, -0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L, -},{ -/* nibble 6 */ -0x00004000L, 0x00000200L, 0x01000200L, 0x01000004L, -0x01004204L, 0x00004004L, 0x00004200L, 0x00000000L, -0x01000000L, 0x01000204L, 0x00000204L, 0x01004000L, -0x00000004L, 0x01004200L, 0x01004000L, 0x00000204L, -0x01000204L, 0x00004000L, 0x00004004L, 0x01004204L, -0x00000000L, 0x01000200L, 0x01000004L, 0x00004200L, -0x01004004L, 0x00004204L, 0x01004200L, 0x00000004L, -0x00004204L, 0x01004004L, 0x00000200L, 0x01000000L, -0x00004204L, 0x01004000L, 0x01004004L, 0x00000204L, -0x00004000L, 0x00000200L, 0x01000000L, 0x01004004L, -0x01000204L, 0x00004204L, 0x00004200L, 0x00000000L, -0x00000200L, 0x01000004L, 0x00000004L, 0x01000200L, -0x00000000L, 0x01000204L, 0x01000200L, 0x00004200L, -0x00000204L, 0x00004000L, 0x01004204L, 0x01000000L, -0x01004200L, 0x00000004L, 0x00004004L, 0x01004204L, -0x01000004L, 0x01004200L, 0x01004000L, 0x00004004L, -},{ -/* nibble 7 */ -0x20800080L, 0x20820000L, 0x00020080L, 0x00000000L, -0x20020000L, 0x00800080L, 0x20800000L, 0x20820080L, -0x00000080L, 0x20000000L, 0x00820000L, 0x00020080L, -0x00820080L, 0x20020080L, 0x20000080L, 0x20800000L, -0x00020000L, 0x00820080L, 0x00800080L, 0x20020000L, -0x20820080L, 0x20000080L, 0x00000000L, 0x00820000L, -0x20000000L, 0x00800000L, 0x20020080L, 0x20800080L, -0x00800000L, 0x00020000L, 0x20820000L, 0x00000080L, -0x00800000L, 0x00020000L, 0x20000080L, 0x20820080L, -0x00020080L, 0x20000000L, 0x00000000L, 0x00820000L, -0x20800080L, 0x20020080L, 0x20020000L, 0x00800080L, -0x20820000L, 0x00000080L, 0x00800080L, 0x20020000L, -0x20820080L, 0x00800000L, 0x20800000L, 0x20000080L, -0x00820000L, 0x00020080L, 0x20020080L, 0x20800000L, -0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L, -0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L, -}}; ADDED Source/ccUtilities/byteBuffer.c Index: Source/ccUtilities/byteBuffer.c ================================================================== --- /dev/null +++ Source/ccUtilities/byteBuffer.c @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2011 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * printByteBuffer.c + * byteutils + */ + +#include "ccMemory.h" +#include "byteBuffer.h" + +void printBytes(uint8_t *buff, size_t len, char *name) +{ + int i; + printf("Dumping %d bytes from %s\n", (int) len, name); + for(i=0; i 0 && !(i%8)) putchar(' '); + if(i > 0 && !(i%64)) putchar('\n'); + printf("%02x", buff[i]); + } + putchar('\n'); +} + +void printByteBuffer(byteBuffer bb, char *name) +{ + printBytes(bb->bytes, bb->len, name); +} + + +byteBuffer +mallocByteBuffer(size_t len) +{ + byteBuffer retval; + if((retval = (byteBuffer) CC_XMALLOC(sizeof(byteBufferStruct) + len + 1)) == NULL) return NULL; + retval->len = len; + retval->size = sizeof(byteBufferStruct) + len + 1; + retval->bytes = (uint8_t *) (retval + 1) ; /* just past the byteBuffer in malloc'ed space */ + return retval; +} + +void +freeByteBuffer(byteBuffer b) +{ + CC_XFREE(b, b->size); +} + + +/* utility function to convert hex character representation to their nibble (4 bit) values */ +static uint8_t +nibbleFromChar(char c) +{ + if(c >= '0' && c <= '9') return c - '0'; + if(c >= 'a' && c <= 'f') return c - 'a' + 10; + if(c >= 'A' && c <= 'F') return c - 'A' + 10; + return 255; +} + +/* Convert a string of characters representing a hex buffer into a series of bytes of that real value */ +byteBuffer +hexStringToBytes(char *inhex) +{ + byteBuffer retval; + uint8_t *p; + int len, i; + + len = (int) strlen(inhex) / 2; + if((retval = mallocByteBuffer(len)) == NULL) return NULL; + + for(i=0, p = (uint8_t *) inhex; ibytes[i] = (nibbleFromChar(*p) << 4) | nibbleFromChar(*(p+1)); + p += 2; + } + retval->bytes[len] = 0; + return retval; +} + +byteBuffer +bytesToBytes(void *bytes, size_t len) +{ + byteBuffer retval = mallocByteBuffer(len); + CC_XMEMCPY(retval->bytes, bytes, len); + return retval; +} + +int +bytesAreEqual(byteBuffer b1, byteBuffer b2) +{ + if(b1->len != b2->len) return 0; + return (CC_XMEMCMP(b1->bytes, b2->bytes, b1->len) == 0); +} + + +static char byteMap[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; +static int byteMapLen = sizeof(byteMap); + +/* Utility function to convert nibbles (4 bit values) into a hex character representation */ +static char +nibbleToChar(uint8_t nibble) +{ + if(nibble < byteMapLen) return byteMap[nibble]; + return '*'; +} + +/* Convert a buffer of binary values into a hex string representation */ +char +*bytesToHexString(byteBuffer bb) +{ + char *retval; + int i; + + retval = CC_XMALLOC(bb->len*2 + 1); + for(i=0; ilen; i++) { + retval[i*2] = nibbleToChar(bb->bytes[i] >> 4); + retval[i*2+1] = nibbleToChar(bb->bytes[i] & 0x0f); + } + retval[bb->len*2] = 0; + return retval; +} + ADDED Source/ccUtilities/byteBuffer.h Index: Source/ccUtilities/byteBuffer.h ================================================================== --- /dev/null +++ Source/ccUtilities/byteBuffer.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2011 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ +*/ + +/* + * printByteBuffer.h + * byteutils + * + */ + +#include +#include +#include +#include + +#ifndef _BYTEBUFFER_H_ +#define _BYTEBUFFER_H_ + +typedef struct byte_buf { + size_t len; + size_t size; + uint8_t *bytes; +} byteBufferStruct, *byteBuffer; + +void printByteBuffer(byteBuffer bb, char *name); + +void printBytes(uint8_t *buff, size_t len, char *name); + +byteBuffer +mallocByteBuffer(size_t len); + +void +freeByteBuffer(byteBuffer b); + +byteBuffer +hexStringToBytes(char *inhex); + +byteBuffer +bytesToBytes(void *bytes, size_t len); + +int +bytesAreEqual(byteBuffer b1, byteBuffer b2); + +char +*bytesToHexString(byteBuffer bytes); + +#endif /* _BYTEBUFFER_H_ */ ADDED Source/ccUtilities/ccErrors.h Index: Source/ccUtilities/ccErrors.h ================================================================== --- /dev/null +++ Source/ccUtilities/ccErrors.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ccErrors.h + * CommonCrypto + */ + +#include "CommonCryptor.h" +#ifndef CCERRORS_H +#define CCERRORS_H + +#define CONTEXT_SIZE_CHK(CCCTX,DIGESTDI) (sizeof(CCCTX) < ccdigest_di_size(DIGESTDI)) +#define CC_NONULLPARM(X) if(NULL==(X)) return kCCParamError + +#endif /* CCERRORS_H */ + ADDED Source/ccUtilities/ccMemory.h Index: Source/ccUtilities/ccMemory.h ================================================================== --- /dev/null +++ Source/ccUtilities/ccMemory.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ccMemory.h + * CommonCrypto + */ + +#ifndef CCMEMORY_H +#define CCMEMORY_H + +#ifdef KERNEL +#define CC_XMALLOC(s) OSMalloc((s), CC_OSMallocTag) +#define CC_XFREE(p, s) OSFree((p), (s), CC_OSMallocTag) +#else /* KERNEL */ +#include +#include + +#define CC_XMALLOC(s) malloc(s) +#define CC_XCALLOC(c, s) calloc((c), (s)) +#define CC_XREALLOC(p, s) realloc((p), (s)) +#define CC_XFREE(p, s) free(p) +#define CC_XMEMCPY(s1, s2, n) memcpy((s1), (s2), (n)) +#define CC_XMEMCMP(s1, s2, n) memcmp((s1), (s2), (n)) +#define CC_XMEMSET(s1, s2, n) memset((s1), (s2), (n)) +#define CC_XZEROMEM(p, n) memset((p), 0, (n)) +#define CC_XSTRCMP(s1, s2) strcmp((s1), (s2)) +#define CC_XSTORE32H(x, y) do { \ +(y)[0] = (unsigned char)(((x)>>24)&255); \ +(y)[1] = (unsigned char)(((x)>>16)&255); \ +(y)[2] = (unsigned char)(((x)>>8)&255); \ +(y)[3] = (unsigned char)((x)&255); \ +} while(0) +#define CC_XSTORE64H(x, y) \ +{ (y)[0] = (unsigned char)(((x)>>56)&255); (y)[1] = (unsigned char)(((x)>>48)&255); \ +(y)[2] = (unsigned char)(((x)>>40)&255); (y)[3] = (unsigned char)(((x)>>32)&255); \ +(y)[4] = (unsigned char)(((x)>>24)&255); (y)[5] = (unsigned char)(((x)>>16)&255); \ +(y)[6] = (unsigned char)(((x)>>8)&255); (y)[7] = (unsigned char)((x)&255); } + + + +#define CC_XQSORT(base, nelement, width, comparfunc) qsort((base), (nelement), (width), (comparfunc)) + +#define CC_XALIGNED(PTR,NBYTE) (!(((size_t)(PTR))%(NBYTE))) + +#define CC_XMIN(X,Y) (((X) < (Y)) ? (X): (Y)) +#endif + + + + +#endif /* CCMEMORY_H */ Index: Source/ccUtilities/ccdebug.c ================================================================== --- Source/ccUtilities/ccdebug.c +++ Source/ccUtilities/ccdebug.c @@ -21,48 +21,55 @@ * @APPLE_LICENSE_HEADER_END@ */ /* * ccdebug.c - CommonCrypto debug macros - * MacTomCrypt * */ + #include "ccdebug.h" #include #include #include #include #include +#include +#include + -static char *std_log_prefix = "###CommonCrypto Function: %s - %s"; +static char *std_log_prefix = "###CommonCrypto : %s - %s"; static const char *std_ident = "CommonCrypto"; static const char *std_facility = "CipherSuite"; -static uint32_t std_options = 0; +static uint32_t std_options = 0; static aslclient aslhandle = NULL; static aslmsg msgptr = NULL; static void ccdebug_init() { - char *ccEnvStdErr = getenv("CC_STDERR"); - - if(ccEnvStdErr != NULL && strncmp(ccEnvStdErr, "yes", 3) == 0) std_options |= ASL_OPT_STDERR; - aslhandle = asl_open(std_ident, std_facility, std_options); - - msgptr = asl_new(ASL_TYPE_MSG); - asl_set(msgptr, ASL_KEY_FACILITY, "com.apple.infosec"); + static dispatch_once_t init; + dispatch_once(&init, ^{ + char *ccEnvStdErr = getenv("CC_STDERR"); + + if(ccEnvStdErr != NULL && strncmp(ccEnvStdErr, "yes", 3) == 0) std_options |= ASL_OPT_STDERR; + aslhandle = asl_open(std_ident, std_facility, std_options); + msgptr = asl_new(ASL_TYPE_MSG); + asl_set(msgptr, ASL_KEY_FACILITY, "com.apple.platformsec"); + }); } - +#define LINESIZE 256 + void ccdebug_imp(int level, char *funcname, char *format, ...) { va_list argp; - char fmtbuffer[256]; + char fmtbuffer[LINESIZE]; - if(aslhandle == NULL) ccdebug_init(); + ccdebug_init(); - sprintf(fmtbuffer, std_log_prefix, funcname, format); va_start(argp, format); + snprintf(fmtbuffer, LINESIZE, std_log_prefix, funcname, format); asl_vlog(aslhandle, msgptr, level, fmtbuffer, argp); va_end(argp); } + Index: Source/ccUtilities/ccdebug.h ================================================================== --- Source/ccUtilities/ccdebug.h +++ Source/ccUtilities/ccdebug.h @@ -1,7 +1,7 @@ -/* - * Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved. +/* + * Copyright (c) 2012 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License @@ -21,24 +21,66 @@ * @APPLE_LICENSE_HEADER_END@ */ /* * ccdebug.h - CommonCrypto debug macros - * MacTomCrypt * */ + +#if defined(COMMON_DIGEST_FUNCTIONS) || defined(COMMON_CMAC_FUNCTIONS) || defined(COMMON_GCM_FUNCTIONS) \ + || defined (COMMON_AESSHOEFLY_FUNCTIONS) || defined(COMMON_CASTSHOEFLY_FUNCTIONS) \ + || defined (COMMON_CRYPTOR_FUNCTIONS) || defined(COMMON_HMAC_FUNCTIONS) \ + || defined(COMMON_KEYDERIVATION_FUNCTIONS) || defined(COMMON_SYMMETRIC_KEYWRAP_FUNCTIONS) \ + || defined(COMMON_RSA_FUNCTIONS) || defined(COMMON_EC_FUNCTIONS) || defined(COMMON_DH_FUNCTIONS) \ + || defined(COMMON_BIGNUM_FUNCTIONS) || defined(COMMON_RANDOM_FUNCTIONS) + +#define DIAGNOSTIC +#endif + +#ifdef KERNEL +#include + +#define CC_DEBUG 1 +#define CC_DEBUG_BUG 2 +#define CC_DEBUG_FAILURE 3 + +#if DIAGNOSTIC +#define CC_DEBUG_LOG(lvl, fmt, ...) do { \ + const char *lvl_type[] = { "INVALID", "DEBUG", "ERROR", "FAILURE" }; \ + char fmtbuffer[256]; \ + int l = lvl; \ + \ + if (l < 0 || l > 3) l = 0; \ + snprintf(fmtbuffer, sizeof(fmtbuffer), \ + "CommonCrypto Function: %s:%d (%s) - %s", __FILE__, __LINE__, \ + lvl_type[l], fmt); \ + printf(fmtbuffer, __VA_ARGS__); \ +} while (0) + +#else + +#define CC_DEBUG_LOG(lvl,fmt,...) {} + +#endif /* DIAGNOSTIC */ + +#else #include #include #define CC_DEBUG_FAILURE ASL_LEVEL_EMERG #define CC_DEBUG_BUG ASL_LEVEL_ERR -#define CC_DEBUG ASL_LEVEL_DEBUG +#define CC_DEBUG ASL_LEVEL_ERR void ccdebug_imp(int level, char *funcname, char *format, ...); -#ifdef DEBUG -#define ccdebug(lvl,fmt,...) ccdebug_imp(lvl, __PRETTY_FUNCTION__, fmt, __VA_ARGS__) +#ifdef DIAGNOSTIC + +#define CC_DEBUG_LOG(lvl,...) ccdebug_imp(lvl, __FUNCTION__, __VA_ARGS__) + #else -#define ccdebug(lvl,fmt,...) {} -#endif + +#define CC_DEBUG_LOG(lvl,...) {} +#endif /* DEBUG */ + +#endif /* KERNEL */ ADDED Source/descriptors/corecryptoSymmetricBridge.c Index: Source/descriptors/corecryptoSymmetricBridge.c ================================================================== --- /dev/null +++ Source/descriptors/corecryptoSymmetricBridge.c @@ -0,0 +1,604 @@ +/* + * Copyright (c) 2012 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#include "corecryptoSymmetricBridge.h" +#include "ccMemory.h" +#include + +static void *noMode(void) { return NULL; } + +// RC4 as a mode trick ... + +void rc4ModeInit(const struct ccmode_ofb *ofb, void *ctx, + unsigned long key_len, const void *key, + const void *iv) +{ + ccrc4_eay.init(ctx, key_len, key); +} + +void rc4crypt(void *ctx, unsigned long nbytes, const void *in, void *out) +{ + ccrc4_eay.crypt(ctx, nbytes, in, out); +} + +typedef struct eay_rc4_key_st +{ + uint32_t x,y; + uint32_t data[256]; +} eay_RC4_KEY; + +struct ccmode_ofb rc4mode = { + .size = sizeof(eay_RC4_KEY), + .block_size = 1, + .init = rc4ModeInit, + .ofb = rc4crypt, +}; + + + +struct ccmode_ofb *cc_rc4_crypt_mode(void) +{ + return &rc4mode; +} + + +// 2 dimensional array of various mode/cipher contexts +// encrypt/decrypt x algorithm matching the list in CommonCryptor.h + +modeList ccmodeList[7][2] = { + { // AES + { ccaes_ecb_encrypt_mode, ccaes_cbc_encrypt_mode, ccaes_cfb_encrypt_mode, ccaes_cfb8_encrypt_mode, ccaes_ctr_crypt_mode, ccaes_ofb_crypt_mode, ccaes_xts_encrypt_mode, ccaes_gcm_encrypt_mode }, + { ccaes_ecb_decrypt_mode, ccaes_cbc_decrypt_mode, ccaes_cfb_decrypt_mode, ccaes_cfb8_decrypt_mode, ccaes_ctr_crypt_mode, ccaes_ofb_crypt_mode, ccaes_xts_decrypt_mode, ccaes_gcm_decrypt_mode } + }, + + { // DES + { ccdes_ecb_encrypt_mode, ccdes_cbc_encrypt_mode, ccdes_cfb_encrypt_mode, ccdes_cfb8_encrypt_mode, ccdes_ctr_crypt_mode, ccdes_ofb_crypt_mode, noMode, noMode }, + { ccdes_ecb_decrypt_mode, ccdes_cbc_decrypt_mode, ccdes_cfb_decrypt_mode, ccdes_cfb8_decrypt_mode, ccdes_ctr_crypt_mode, ccdes_ofb_crypt_mode, noMode, noMode } + }, + + { // DES3 + { ccdes3_ecb_encrypt_mode, ccdes3_cbc_encrypt_mode, ccdes3_cfb_encrypt_mode, ccdes3_cfb8_encrypt_mode, ccdes3_ctr_crypt_mode, ccdes3_ofb_crypt_mode, noMode, noMode }, + { ccdes3_ecb_decrypt_mode, ccdes3_cbc_decrypt_mode, ccdes3_cfb_decrypt_mode, ccdes3_cfb8_decrypt_mode, ccdes3_ctr_crypt_mode, ccdes3_ofb_crypt_mode, noMode, noMode } + }, + + { // CAST + { cccast_ecb_encrypt_mode, cccast_cbc_encrypt_mode, cccast_cfb_encrypt_mode, cccast_cfb8_encrypt_mode, cccast_ctr_crypt_mode, cccast_ofb_crypt_mode, noMode, noMode }, + { cccast_ecb_decrypt_mode, cccast_cbc_decrypt_mode, cccast_cfb_decrypt_mode, cccast_cfb8_decrypt_mode, cccast_ctr_crypt_mode, cccast_ofb_crypt_mode, noMode, noMode } + }, + + { // RC4 - hijack OFB to put in streaming cipher descriptor + { noMode, noMode, noMode, noMode, noMode, cc_rc4_crypt_mode, noMode, noMode }, + { noMode, noMode, noMode, noMode, noMode, cc_rc4_crypt_mode, noMode, noMode } + }, + + + { // RC2 + { ccrc2_ecb_encrypt_mode, ccrc2_cbc_encrypt_mode, ccrc2_cfb_encrypt_mode, ccrc2_cfb8_encrypt_mode, ccrc2_ctr_crypt_mode, ccrc2_ofb_crypt_mode, noMode, noMode }, + { ccrc2_ecb_decrypt_mode, ccrc2_cbc_decrypt_mode, ccrc2_cfb_decrypt_mode, ccrc2_cfb8_decrypt_mode, ccrc2_ctr_crypt_mode, ccrc2_ofb_crypt_mode, noMode, noMode } + }, + + { // Blowfish + { ccblowfish_ecb_encrypt_mode, ccblowfish_cbc_encrypt_mode, ccblowfish_cfb_encrypt_mode, ccblowfish_cfb8_encrypt_mode, ccblowfish_ctr_crypt_mode, ccblowfish_ofb_crypt_mode, noMode, noMode }, + { ccblowfish_ecb_decrypt_mode, ccblowfish_cbc_decrypt_mode, ccblowfish_cfb_decrypt_mode, ccblowfish_cfb8_decrypt_mode, ccblowfish_ctr_crypt_mode, ccblowfish_ofb_crypt_mode, noMode, noMode } + }, +}; + + +// Thunks +//ECB + +static size_t ccecb_mode_get_ctx_size(corecryptoMode modeObject) { return modeObject.ecb->size; } +static size_t ccecb_mode_get_block_size(corecryptoMode modeObject) { return modeObject.ecb->block_size; } +static void ccecb_mode_setup(corecryptoMode modeObj, const void *IV, + const void *key, size_t keylen, const void *tweak, + int tweaklen, int options, modeCtx ctx) +{ + modeObj.ecb->init(modeObj.ecb, ctx.ecb, keylen, key); +} + +static void ccecb_mode_crypt(corecryptoMode modeObj, const void *in, void *out, size_t len, modeCtx ctx) +{ + modeObj.ecb->ecb(ctx.ecb, len / ccecb_mode_get_block_size(modeObj), in, out); +} + +cc2CCModeDescriptor ccecb_mode = { + .mode_get_ctx_size = ccecb_mode_get_ctx_size, + .mode_get_block_size = ccecb_mode_get_block_size, + .mode_setup = ccecb_mode_setup, + .mode_encrypt = ccecb_mode_crypt, + .mode_decrypt = ccecb_mode_crypt, + .mode_encrypt_tweaked = NULL, + .mode_decrypt_tweaked = NULL, + .mode_done = NULL, + .mode_setiv = NULL, + .mode_getiv = NULL +}; + +// CBC + +static size_t cccbc_mode_get_ctx_size(corecryptoMode modeObject) { return modeObject.cbc->size + 16; } +static size_t cccbc_mode_get_block_size(corecryptoMode modeObject) { return modeObject.cbc->block_size; } +static void cccbc_mode_setup(corecryptoMode modeObj, const void *iv, + const void *key, size_t keylen, const void *tweak, + size_t tweaklen, int options, modeCtx ctx) +{ + CC_XMEMCPY(ctx.cbc->iv, iv, modeObj.cbc->block_size); + modeObj.cbc->init(modeObj.cbc, &ctx.cbc->cbc, keylen, key); +} + +static void cccbc_mode_crypt(corecryptoMode modeObj, const void *in, void *out, size_t len, modeCtx ctx) +{ + modeObj.cbc->cbc(&ctx.cbc->cbc, ctx.cbc->iv, len / cccbc_mode_get_block_size(modeObj), in, out); +} + +static int cccbc_getiv(corecryptoMode modeObj, void *iv, uint32_t *len, modeCtx ctx) +{ + if(*len < cccbc_mode_get_block_size(modeObj)) { + *len = cccbc_mode_get_block_size(modeObj); + return -1; + } + uint8_t tmp[cccbc_mode_get_block_size(modeObj)]; + CC_XMEMCPY(iv, ctx.cbc->iv, *len = cccbc_mode_get_block_size(modeObj)); + return 0; +} + +static int cccbc_setiv(corecryptoMode modeObj, const void *iv, uint32_t len, modeCtx ctx) +{ + uint8_t tmp[cccbc_mode_get_block_size(modeObj)]; + if(len != cccbc_mode_get_block_size(modeObj)) return -1; + CC_XMEMCPY(ctx.cbc->iv, iv, cccbc_mode_get_block_size(modeObj)); + return 0; +} + +cc2CCModeDescriptor cccbc_mode = { + .mode_get_ctx_size = cccbc_mode_get_ctx_size, + .mode_get_block_size = cccbc_mode_get_block_size, + .mode_setup = cccbc_mode_setup, + .mode_encrypt = cccbc_mode_crypt, + .mode_decrypt = cccbc_mode_crypt, + .mode_encrypt_tweaked = NULL, + .mode_decrypt_tweaked = NULL, + .mode_done = NULL, + .mode_setiv = cccbc_setiv, + .mode_getiv = cccbc_getiv +}; + +// CFB + +static size_t cccfb_mode_get_ctx_size(corecryptoMode modeObject) { return modeObject.cfb->size; } +static size_t cccfb_mode_get_block_size(corecryptoMode modeObject) { return modeObject.cfb->block_size; } +static void cccfb_mode_setup(corecryptoMode modeObj, const void *iv, + const void *key, size_t keylen, const void *tweak, + size_t tweaklen, int options, modeCtx ctx) +{ + modeObj.cfb->init(modeObj.cfb, ctx.cfb, keylen, key, iv); +} + +static void cccfb_mode_crypt(corecryptoMode modeObj, const void *in, void *out, size_t len, modeCtx ctx) +{ + modeObj.cfb->cfb(ctx.cfb, len / cccfb_mode_get_block_size(modeObj), in, out); +} + +cc2CCModeDescriptor cccfb_mode = { + .mode_get_ctx_size = cccfb_mode_get_ctx_size, + .mode_get_block_size = cccfb_mode_get_block_size, + .mode_setup = cccfb_mode_setup, + .mode_encrypt = cccfb_mode_crypt, + .mode_decrypt = cccfb_mode_crypt, + .mode_encrypt_tweaked = NULL, + .mode_decrypt_tweaked = NULL, + .mode_done = NULL, + .mode_setiv = NULL, + .mode_getiv = NULL +}; + + +// CFB8 + +static size_t cccfb8_mode_get_ctx_size(corecryptoMode modeObject) { return modeObject.cfb8->size; } +static size_t cccfb8_mode_get_block_size(corecryptoMode modeObject) { return modeObject.cfb8->block_size; } +static void cccfb8_mode_setup(corecryptoMode modeObj, const void *iv, + const void *key, size_t keylen, const void *tweak, + size_t tweaklen, int options, modeCtx ctx) +{ + modeObj.cfb8->init(modeObj.cfb8, ctx.cfb8, keylen, key, iv); +} + +static void cccfb8_mode_crypt(corecryptoMode modeObj, const void *in, void *out, size_t len, modeCtx ctx) +{ + modeObj.cfb8->cfb8(ctx.cfb8, len / cccfb8_mode_get_block_size(modeObj), in, out); +} + +cc2CCModeDescriptor cccfb8_mode = { + .mode_get_ctx_size = cccfb8_mode_get_ctx_size, + .mode_get_block_size = cccfb8_mode_get_block_size, + .mode_setup = cccfb8_mode_setup, + .mode_encrypt = cccfb8_mode_crypt, + .mode_decrypt = cccfb8_mode_crypt, + .mode_encrypt_tweaked = NULL, + .mode_decrypt_tweaked = NULL, + .mode_done = NULL, + .mode_setiv = NULL, + .mode_getiv = NULL +}; + +// CTR + +static size_t ccctr_mode_get_ctx_size(corecryptoMode modeObject) { return modeObject.ctr->size; } +static size_t ccctr_mode_get_block_size(corecryptoMode modeObject) { return modeObject.ctr->block_size; } +static void ccctr_mode_setup(corecryptoMode modeObj, const void *iv, + const void *key, size_t keylen, const void *tweak, + size_t tweaklen, int options, modeCtx ctx) +{ + modeObj.ctr->init(modeObj.ctr, ctx.ctr, keylen, key, iv); +} + +static void ccctr_mode_crypt(corecryptoMode modeObj, const void *in, void *out, size_t len, modeCtx ctx) +{ + modeObj.ctr->ctr(ctx.ctr, len / ccctr_mode_get_block_size(modeObj), in, out); +} + +cc2CCModeDescriptor ccctr_mode = { + .mode_get_ctx_size = ccctr_mode_get_ctx_size, + .mode_get_block_size = ccctr_mode_get_block_size, + .mode_setup = ccctr_mode_setup, + .mode_encrypt = ccctr_mode_crypt, + .mode_decrypt = ccctr_mode_crypt, + .mode_encrypt_tweaked = NULL, + .mode_decrypt_tweaked = NULL, + .mode_done = NULL, + .mode_setiv = NULL, + .mode_getiv = NULL +}; + +// OFB + +static size_t ccofb_mode_get_ctx_size(corecryptoMode modeObject) { return modeObject.ofb->size; } +static size_t ccofb_mode_get_block_size(corecryptoMode modeObject) { return modeObject.ofb->block_size; } +static void ccofb_mode_setup(corecryptoMode modeObj, const void *iv, + const void *key, size_t keylen, const void *tweak, + size_t tweaklen, int options, modeCtx ctx) +{ + modeObj.ofb->init(modeObj.ofb, ctx.ofb, keylen, key, iv); +} + +static void ccofb_mode_crypt(corecryptoMode modeObj, const void *in, void *out, size_t len, modeCtx ctx) +{ + modeObj.ofb->ofb(ctx.ofb, len / ccofb_mode_get_block_size(modeObj), in, out); +} + +cc2CCModeDescriptor ccofb_mode = { + .mode_get_ctx_size = ccofb_mode_get_ctx_size, + .mode_get_block_size = ccofb_mode_get_block_size, + .mode_setup = ccofb_mode_setup, + .mode_encrypt = ccofb_mode_crypt, + .mode_decrypt = ccofb_mode_crypt, + .mode_encrypt_tweaked = NULL, + .mode_decrypt_tweaked = NULL, + .mode_done = NULL, + .mode_setiv = NULL, + .mode_getiv = NULL +}; + +// XTS +/* For now we always schedule both encrypt and decrypt contexts for AES-XTS. Original CommonCrypto support + * allowed a "both" (kCCEncrypt and kCCDecrypt) capability used for AES-XTS block I/O. The initialization + * and correct mode objext and context passing are done at the CommonCryptor layer. + */ + + +static size_t ccxts_mode_get_ctx_size(corecryptoMode modeObject) { return modeObject.xts->size; } +static size_t ccxts_mode_get_block_size(corecryptoMode modeObject) { return modeObject.xts->block_size; } +static void ccxts_mode_setup(corecryptoMode modeObj, const void *iv, + const void *key, size_t keylen, const void *tweak, + size_t tweaklen, int options, modeCtx ctx) +{ + modeObj.xts->init(modeObj.xts, ctx.xts, keylen, key, tweak); +} + +#ifdef UNUSED_INTERFACE +static void ccxts_mode_crypt(corecryptoMode modeObj, const void *in, void *out, size_t len, modeCtx ctx) +{ + modeObj.xts->xts(ctx.xts, len / ccxts_mode_get_block_size(modeObj), in, out); +} + +static int ccxts_setiv(corecryptoMode modeObj, const void *iv, uint32_t len, modeCtx ctx) +{ + if(len != modeObj.xts->block_size) return -1; + modeObj.xts->set_tweak(ctx.xts, iv); + return 0; +} + +static int ccxts_getiv(corecryptoMode modeObj, void *iv, uint32_t *len, modeCtx ctx) +{ + if(*len < modeObj.xts->block_size) { + *len = modeObj.xts->block_size; + return -1; + } + CC_XMEMCPY(iv, modeObj.xts->xts(ctx.xts, 0, NULL, NULL), *len = modeObj.xts->block_size); + return 0; +} +#endif + +/* + * These match what we had in libtomcrypt - they really are "this is a logical block" routines, so need + * to handle partial blocks - so we use corecrypto's xts pad routines in every case. + */ + +static void ccxts_mode_encrypt_tweak(corecryptoMode modeObj, const void *in, void *out, size_t len, const void *iv, modeCtx ctx) +{ + ccxts_tweak_decl(ccxts_context_size(modeObj.xts), tweak); + modeObj.xts->set_tweak(ctx.xts, tweak, iv); + ccpad_xts_encrypt(modeObj.xts, ctx.xts, tweak, len, in, out); +} + +static void ccxts_mode_decrypt_tweak(corecryptoMode modeObj, const void *in, void *out, size_t len, const void *iv, modeCtx ctx) +{ + ccxts_tweak_decl(ccxts_context_size(modeObj.xts), tweak); + modeObj.xts->set_tweak(ctx.xts, tweak, iv); + ccpad_xts_decrypt(modeObj.xts, ctx.xts, tweak, len, in, out); +} + + +cc2CCModeDescriptor ccxts_mode = { + .mode_get_ctx_size = ccxts_mode_get_ctx_size, + .mode_get_block_size = ccxts_mode_get_block_size, + .mode_setup = ccxts_mode_setup, + .mode_encrypt = NULL, + .mode_decrypt = NULL, + .mode_encrypt_tweaked = ccxts_mode_encrypt_tweak, + .mode_decrypt_tweaked = ccxts_mode_decrypt_tweak, + .mode_done = NULL, + .mode_setiv = NULL, + .mode_getiv = NULL +}; + +// GCM + +static size_t ccgcm_mode_get_ctx_size(corecryptoMode modeObject) { return modeObject.gcm->size; } +static size_t ccgcm_mode_get_block_size(corecryptoMode modeObject) { return modeObject.gcm->block_size; } +static void ccgcm_mode_setup(corecryptoMode modeObj, const void *iv, + const void *key, size_t keylen, const void *tweak, + size_t tweaklen, int options, modeCtx ctx) +{ + modeObj.gcm->init(modeObj.gcm, ctx.gcm, keylen, key); +} + +static void ccgcm_mode_crypt(corecryptoMode modeObj, const void *in, void *out, size_t len, modeCtx ctx) +{ + modeObj.gcm->gcm(ctx.gcm, len, in, out); +} + +static int ccgcm_setiv(corecryptoMode modeObj, const void *iv, uint32_t len, modeCtx ctx) +{ + modeObj.gcm->set_iv(ctx.gcm, len, iv); + return 0; +} + + +cc2CCModeDescriptor ccgcm_mode = { + .mode_get_ctx_size = ccgcm_mode_get_ctx_size, + .mode_get_block_size = ccgcm_mode_get_block_size, + .mode_setup = ccgcm_mode_setup, + .mode_encrypt = ccgcm_mode_crypt, + .mode_decrypt = ccgcm_mode_crypt, + .mode_encrypt_tweaked = NULL, + .mode_decrypt_tweaked = NULL, + .mode_done = NULL, + .mode_setiv = ccgcm_setiv, + .mode_getiv = NULL +}; + +// Padding + +static int ccpkcs7_encrypt_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *cipherText, size_t *moved) +{ + ccpad_pkcs7_encrypt(modeObj.cbc, &ctx.cbc->cbc, ctx.cbc->iv, len, buff, cipherText); + *moved = modeptr->mode_get_block_size(modeObj); + return 0; +} +static int ccpkcs7_decrypt_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *plainText, size_t *moved) +{ + *moved = ccpad_pkcs7_decrypt(modeObj.cbc, &ctx.cbc->cbc, ctx.cbc->iv, len, buff, plainText); + return 0; +} + + +static int ccpkcs7_encrypt_ecb_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *cipherText, size_t *moved) +{ + ccpad_pkcs7_ecb_encrypt(modeObj.ecb, ctx.ecb, len, buff, cipherText); + *moved = modeptr->mode_get_block_size(modeObj); + return 0; +} +static int ccpkcs7_decrypt_ecb_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *plainText, size_t *moved) +{ + *moved = ccpad_pkcs7_ecb_decrypt(modeObj.ecb, ctx.ecb, len, buff, plainText); + return 0; +} + + +/* + * Maximum space needed for padding. + */ + +#define MAXBLOCKSIZE_PKCS7 128 + +static size_t ccpkcs7_padlen(int encrypt, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, char *buffp) +{ + int retval = 0; + size_t blocksize = modeptr->mode_get_block_size(modeObj); + + /* We're going to return blocksize for unpad as a "maximum needed". Otherwise we're going to have to decrypt the last block to get the number */ + return blocksize; +} + +/* + * How many bytes to reserve to enable padding - this is pre-encrypt/decrypt bytes. + */ + +static size_t ccpkcs7_reserve(int encrypt, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj) +{ + if(encrypt) { + return 0; + } else { + return modeptr->mode_get_block_size(modeObj); + } +} + +cc2CCPaddingDescriptor ccpkcs7_pad = { + .encrypt_pad = ccpkcs7_encrypt_pad, + .decrypt_pad = ccpkcs7_decrypt_pad, + .padlen = ccpkcs7_padlen, + .padreserve = ccpkcs7_reserve, +}; + +cc2CCPaddingDescriptor ccpkcs7_ecb_pad = { + .encrypt_pad = ccpkcs7_encrypt_ecb_pad, + .decrypt_pad = ccpkcs7_decrypt_ecb_pad, + .padlen = ccpkcs7_padlen, + .padreserve = ccpkcs7_reserve, +}; + + +static int cccts1_encrypt_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *cipherText, size_t *moved) +{ + ccpad_cts1_encrypt(modeObj.cbc, &ctx.cbc->cbc, ctx.cbc->iv, len, buff, cipherText); + *moved = len; + return 0; +} +static int cccts1_decrypt_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *plainText, size_t *moved) +{ + ccpad_cts1_decrypt(modeObj.cbc, &ctx.cbc->cbc, ctx.cbc->iv, len, buff, plainText); + *moved = len; + return 0; +} + +static int cccts2_encrypt_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *cipherText, size_t *moved) +{ + ccpad_cts2_encrypt(modeObj.cbc, &ctx.cbc->cbc, ctx.cbc->iv, len, buff, cipherText); + *moved = len; + return 0; +} +static int cccts2_decrypt_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *plainText, size_t *moved) +{ + ccpad_cts2_decrypt(modeObj.cbc, &ctx.cbc->cbc, ctx.cbc->iv, len, buff, plainText); + *moved = len; + return 0; +} + + +static int cccts3_encrypt_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *cipherText, size_t *moved) +{ + ccpad_cts3_encrypt(modeObj.cbc, &ctx.cbc->cbc, ctx.cbc->iv, len, buff, cipherText); + *moved = len; + return 0; +} +static int cccts3_decrypt_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *plainText, size_t *moved) +{ + ccpad_cts3_decrypt(modeObj.cbc, &ctx.cbc->cbc, ctx.cbc->iv, len, buff, plainText); + *moved = len; + return 0; +} + + + +/* + * Maximum space needed for padding. + */ + +#define MAXBLOCKSIZE_PKCS7 128 + +static size_t ccctsX_padlen(int encrypt, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, char *buffp) +{ + return 0; +} + +/* + * How many bytes to reserve to enable padding - this is pre-encrypt/decrypt bytes. + */ + +static size_t ccctsX_reserve(int encrypt, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj) +{ + return modeptr->mode_get_block_size(modeObj) * 2; +} + +cc2CCPaddingDescriptor cccts1_pad = { + .encrypt_pad = cccts1_encrypt_pad, + .decrypt_pad = cccts1_decrypt_pad, + .padlen = ccctsX_padlen, + .padreserve = ccctsX_reserve, +}; + +cc2CCPaddingDescriptor cccts2_pad = { + .encrypt_pad = cccts2_encrypt_pad, + .decrypt_pad = cccts2_decrypt_pad, + .padlen = ccctsX_padlen, + .padreserve = ccctsX_reserve, +}; + + +cc2CCPaddingDescriptor cccts3_pad = { + .encrypt_pad = cccts3_encrypt_pad, + .decrypt_pad = cccts3_decrypt_pad, + .padlen = ccctsX_padlen, + .padreserve = ccctsX_reserve, +}; + + +static int ccnopad_encrypt_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *cipherText, size_t *moved) +{ + *moved = 0; + return 0; +} +static int ccnopad_decrypt_pad(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, size_t len, void *plainText, size_t *moved) +{ + *moved = 0; + return 0; +} + +/* + * Maximum space needed for padding. + */ + +static size_t ccnopad_padlen(int encrypt, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, char *buffp) +{ + return 0; +} + +/* + * How many bytes to reserve to enable padding - this is pre-encrypt/decrypt bytes. + */ + +static size_t ccnopad_reserve(int encrypt, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj) +{ + return 0; +} + +cc2CCPaddingDescriptor ccnopad_pad = { + .encrypt_pad = ccnopad_encrypt_pad, + .decrypt_pad = ccnopad_decrypt_pad, + .padlen = ccnopad_padlen, + .padreserve = ccnopad_reserve, +}; + + ADDED Source/descriptors/corecryptoSymmetricBridge.h Index: Source/descriptors/corecryptoSymmetricBridge.h ================================================================== --- /dev/null +++ Source/descriptors/corecryptoSymmetricBridge.h @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2012 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef CommonCrypto_corecryptoSymmetricBridge_h +#define CommonCrypto_corecryptoSymmetricBridge_h + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef union { + struct ccmode_ecb *ecb; + struct ccmode_cbc *cbc; + struct ccmode_cfb *cfb; + struct ccmode_cfb8 *cfb8; + struct ccmode_ctr *ctr; + struct ccmode_ofb *ofb; + struct ccmode_xts *xts; + struct ccmode_gcm *gcm; +} corecryptoMode; + +typedef struct ccmode_ecb* (*ecb_p) (void); +typedef struct ccmode_cbc* (*cbc_p) (void); +typedef struct ccmode_cfb* (*cfb_p) (void); +typedef struct ccmode_cfb8* (*cfb8_p) (void); +typedef struct ccmode_ctr* (*ctr_p) (void); +typedef struct ccmode_ofb* (*ofb_p) (void); +typedef struct ccmode_xts* (*xts_p) (void); +typedef struct ccmode_gcm* (*gcm_p) (void); + + + +typedef struct modes_t { + ecb_p ecb; + cbc_p cbc; + cfb_p cfb; + cfb8_p cfb8; + ctr_p ctr; + ofb_p ofb; + xts_p xts; + gcm_p gcm; +} modeList; + +modeList ccmodeList[7][2]; + +typedef struct cbc_with_iv_t { + uint8_t iv[16]; + cccbc_ctx cbc; +} cbc_iv_ctx; + +typedef union { + void *data; + ccecb_ctx *ecb; + cbc_iv_ctx *cbc; + cccfb_ctx *cfb; + cccfb8_ctx *cfb8; + ccctr_ctx *ctr; + ccofb_ctx *ofb; + ccxts_ctx *xts; + ccgcm_ctx *gcm; +} modeCtx; + + +#pragma mark Modes + +/** Setup the mode + @param cipher The index of the LTC Cipher - must be registered + @param IV The initial vector + @param key The input symmetric key + @param keylen The length of the input key (octets) + @param tweak The input tweak or salt + @param tweaklen The length of the tweak or salt (if variable) + (octets) + @param options Mask for any mode options + @param ctx [out] The destination of the mode context + */ + +typedef void (*ccmode_setup_p)(corecryptoMode modeObj, const void *iv, + const void *key, size_t keylen, const void *tweak, + size_t tweaklen, int options, modeCtx ctx); +/** Encrypt a block + @param pt The plaintext + @param ct [out] The ciphertext + @param len the length of data (in == out) octets + @param ctx The mode context + @return # bytes encrypted + */ + +typedef void (*ccmode_encrypt_p)(corecryptoMode modeObj, const void *pt, void *ct, size_t len, modeCtx ctx); + +/** Decrypt a block + @param ct The ciphertext + @param pt [out] The plaintext + @param len the length of data (in == out) octets + @param ctx The mode context + @return # bytes encrypted + */ +typedef void (*ccmode_decrypt_p)(corecryptoMode modeObj, const void *ct, void *pt, size_t len, modeCtx ctx); + +/** Encrypt a block with a tweak (XTS mode currently) + @param pt The plaintext + @param ct [out] The ciphertext + @param len the length of data (in == out) octets + @param tweak The 128--bit encryption tweak (e.g. sector + number) + @param ctx The mode context + @return # bytes encrypted + */ +typedef void (*ccmode_encrypt_tweaked_p)(corecryptoMode modeObj, const void *pt, size_t len, + void *ct, const void *tweak, modeCtx ctx); +/** Decrypt a block with a tweak (XTS mode currently) + @param ct The ciphertext + @param pt [out] The plaintext + @param len the length of data (in == out) octets + @param ctx The mode context + @return # bytes encrypted + */ +typedef void (*ccmode_decrypt_tweaked_p)(corecryptoMode modeObj, const void *ct, size_t len, + void *pt, const void *tweak, modeCtx ctx); +/** Terminate the mode + @param ctx [out] The mode context + */ +typedef int (*ccmode_done_p)(corecryptoMode modeObj, modeCtx ctx); +/** Set an Initial Vector + @param IV The initial vector + @param len The length of the initial vector + @param ctx The mode context + */ +typedef int (*ccmode_setiv_p)(corecryptoMode modeObj, const void *iv, uint32_t len, modeCtx ctx); +/** Get an Initial Vector + @param IV [out] The initial vector + @param len The length of the initial vector + @param ctx The mode context + */ +typedef int (*ccmode_getiv_p)(corecryptoMode modeObj, void *iv, uint32_t *len, modeCtx ctx); + +/** Get the mode context size + @param modeObj a pointer to the mode object. + @return the size of the context + */ +typedef size_t (*ccmode_get_ctx_size)(corecryptoMode modeObj); + +/** Get the mode block size + @param modeObj a pointer to the mode object. + @return the size of the block + */ +typedef size_t (*ccmode_get_block_size)(corecryptoMode modeObj); + +typedef struct cc2CCModeDescriptor_t { +// ccBufStrat bufStrat; + ccmode_get_ctx_size mode_get_ctx_size; + ccmode_get_block_size mode_get_block_size; + ccmode_setup_p mode_setup; + ccmode_encrypt_p mode_encrypt; + ccmode_decrypt_p mode_decrypt; + ccmode_encrypt_tweaked_p mode_encrypt_tweaked; + ccmode_decrypt_tweaked_p mode_decrypt_tweaked; + ccmode_done_p mode_done; + ccmode_setiv_p mode_setiv; + ccmode_getiv_p mode_getiv; +} cc2CCModeDescriptor, *cc2CCModeDescriptorPtr; + + +cc2CCModeDescriptor ccecb_mode; +cc2CCModeDescriptor cccbc_mode; +cc2CCModeDescriptor cccfb_mode; +cc2CCModeDescriptor cccfb8_mode; +cc2CCModeDescriptor ccctr_mode; +cc2CCModeDescriptor ccofb_mode; +cc2CCModeDescriptor ccxts_mode; +cc2CCModeDescriptor ccgcm_mode; + + +// Buffer and Padding Handling + +/* + * Fill out the padding for a buffer. The blocksize and starting points are + * used to determine how much needs to be padded. If startpoint is 0 + * then a full new buffer is added. Blocksize cannot be greater than 256. + */ + +typedef int (*cc_encrypt_pad_p)(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, uint32_t startpoint, void *cipherText, size_t *moved); +typedef int (*cc_decrypt_pad_p)(modeCtx ctx, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, void *buff, uint32_t startpoint, void *plainText, size_t *moved); + +/* + * Maximum space needed for padding. + */ + +typedef size_t (*ccpadlen_p) (int encrypt, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj, char *buffp); + +/* + * How many bytes to reserve to enable padding - this is pre-encrypt/decrypt bytes. + */ + +typedef size_t (*ccreserve_p) (int encrypt, cc2CCModeDescriptorPtr modeptr, corecryptoMode modeObj); + +typedef struct cc2CCPaddingDescriptor_t { + cc_encrypt_pad_p encrypt_pad; + cc_decrypt_pad_p decrypt_pad; + ccpadlen_p padlen; + ccreserve_p padreserve; +} cc2CCPaddingDescriptor, *cc2CCPaddingDescriptorPtr; + +cc2CCPaddingDescriptor ccnopad_pad; +cc2CCPaddingDescriptor cccts1_pad; +cc2CCPaddingDescriptor cccts2_pad; +cc2CCPaddingDescriptor cccts3_pad; +cc2CCPaddingDescriptor ccpkcs7_pad; +cc2CCPaddingDescriptor ccpkcs7_ecb_pad; + +#endif ADDED Source/descriptors/digestDescriptors/ccDigestDescriptors.h Index: Source/descriptors/digestDescriptors/ccDigestDescriptors.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ccDigestDescriptors.h @@ -0,0 +1,10 @@ +#include "ccDescriptors.h" + +#ifndef _CC_DIGESTDESCRIPTORS_H +#define _CC_DIGESTDESCRIPTORS_H + +#define CCCTX_SIZE(DI) ((DI)->state_size + sizeof(uint64_t) + (DI)->block_size + sizeof(int)) + + + +#endif /* _CC_DIGESTDESCRIPTORS_H */ ADDED Source/descriptors/digestDescriptors/ccvngneonsha1Descriptor/ccvngneonsha1Desc.c Index: Source/descriptors/digestDescriptors/ccvngneonsha1Descriptor/ccvngneonsha1Desc.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ccvngneonsha1Descriptor/ccvngneonsha1Desc.c @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#if defined(__ARM_ARCH_7A__) +#include "ccvngneonsha1Desc.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "CommonDigest.h" + +const ccDescriptor cc_vngneonsha1_desc = +{ + .implementation_info = &cc_sha1_impinfo, + .dtype.digest.hashsize = CC_SHA1_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA1_BLOCK_BYTES, + .dtype.digest.digest_info = &cc_vngneonsha1_di, + .dtype.digest.init = &cc_vngneon_sha1_init, + .dtype.digest.process = &cc_vngneon_sha1_process, + .dtype.digest.done = &cc_vngneon_sha1_done, +}; + + +int +cc_vngneon_sha1_init(cc_sha1_ctx *md_ctx) { + ccdigest_init(cc_vngneonsha1_di, md_ctx); + return CRYPT_OK; +} + +int +cc_vngneon_sha1_process(cc_sha1_ctx *md_ctx, const unsigned char *in, + unsigned long inlen) { + ccdigest_update(cc_vngneonsha1_di, md_ctx, inlen, in); + return CRYPT_OK; +} + +int cc_vngneon_sha1_done(cc_sha1_ctx *md_ctx, unsigned char *hash) { + ccdigest_final(cc_vngneonsha1_di, md_ctx, hash); + return CRYPT_OK; +} +#endif + ADDED Source/descriptors/digestDescriptors/ccvngneonsha1Descriptor/ccvngneonsha1Desc.h Index: Source/descriptors/digestDescriptors/ccvngneonsha1Descriptor/ccvngneonsha1Desc.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ccvngneonsha1Descriptor/ccvngneonsha1Desc.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#if defined(__ARM_ARCH_7A__) +#define CCSHA1_VNG_ARMV7NEON +#include + +static const struct ccdigest_info *cc_vngneonsha1_di=&ccsha1_vng_armv7neon_di; +typedef void cc_sha1_ctx; + + +int cc_vngneon_sha1_init(cc_sha1_ctx *md_ctx); +int cc_vngneon_sha1_process(cc_sha1_ctx *md_ctx, const unsigned char *in, + unsigned long inlen); +int cc_vngneon_sha1_done(cc_sha1_ctx *md_ctx, unsigned char *hash); +#endif ADDED Source/descriptors/digestDescriptors/ltc_hashcommon.h Index: Source/descriptors/digestDescriptors/ltc_hashcommon.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_hashcommon.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ + +#ifndef LTC_HASHCOMMON_H_ +#define LTC_HASHCOMMON_H_ + +/* a simple macro for making hash "process" functions */ +#define LTC_HASH_PROCESS(func_name, compress_name, state_var, field, block_size) \ +int func_name (state_var *ctx, const unsigned char *in, unsigned long inlen) \ +{ \ +unsigned long n; \ +int err; \ +\ +\ +LTC_ARGCHK(ctx != NULL); \ +LTC_ARGCHK(in != NULL); \ +\ +\ +if (ctx->curlen > sizeof(ctx->buf)) { \ +return CRYPT_INVALID_ARG; \ +} \ +if ((ctx->length + inlen) < ctx->length) { \ +return CRYPT_HASH_OVERFLOW; \ +} \ +while (inlen > 0) { \ +if (ctx->curlen == 0 && inlen >= block_size) { \ +if ((err = compress_name (ctx, in)) != CRYPT_OK) { \ +return err; \ +} \ +ctx->length += block_size * 8; \ +in += block_size; \ +inlen -= block_size; \ +} else { \ +n = MIN(inlen, (block_size - ctx->curlen)); \ +memcpy(ctx->buf + ctx->curlen, in, (size_t)n); \ +ctx->curlen += n; \ +in += n; \ +inlen -= n; \ +if (ctx->curlen == block_size) { \ +if ((err = compress_name (ctx, ctx->buf)) != CRYPT_OK) { \ +return err; \ +} \ +ctx->length += 8*block_size; \ +ctx->curlen = 0; \ +} \ +} \ +} \ +return CRYPT_OK; \ +} + +#endif /* LTC_HASHCOMMON_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_md2_descriptor/ltc_md2.c Index: Source/descriptors/digestDescriptors/ltc_md2_descriptor/ltc_md2.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_md2_descriptor/ltc_md2.c @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ + +#include +#include "ltc_md2.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" + +/** + @param ltc_md2.c + LTC_MD2 (RFC 1319) hash function implementation by Tom St Denis + */ + + +const ccDescriptor ltc_md2_desc = { + .implementation_info = &cc_md2_impinfo, + .dtype.digest.hashsize = CC_MD2_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_MD2_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_md2_init, + .dtype.digest.process = <c_md2_process, + .dtype.digest.done = <c_md2_done, +}; + +static const unsigned char PI_SUBST[256] = { + 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, + 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, + 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, + 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, + 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, + 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, + 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, + 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, + 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, + 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, + 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, + 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, + 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, + 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, + 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, + 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, + 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, + 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 +}; + +/* adds 16 bytes to the checksum */ +static void md2_update_chksum(ltc_md2_ctx *ctx) +{ + int j; + unsigned char L; + + LTC_ARGCHKVD(ctx != NULL); + + L = ctx->chksum[15]; + for (j = 0; j < 16; j++) { + + /* caution, the RFC says its "C[j] = S[M[i*16+j] xor L]" but the + * reference source code [and test vectors] say otherwise. + */ + L = (ctx->chksum[j] ^= PI_SUBST[(int)(ctx->buf[j] ^ L)] & 255); + } +} + +static void md2_compress(ltc_md2_ctx *ctx) +{ + int j, k; + unsigned char t; + + LTC_ARGCHKVD(ctx != NULL); + + /* copy block */ + for (j = 0; j < 16; j++) { + ctx->X[16+j] = ctx->buf[j]; + ctx->X[32+j] = ctx->X[j] ^ ctx->X[16+j]; + } + + t = (unsigned char)0; + + /* do 18 rounds */ + for (j = 0; j < 18; j++) { + for (k = 0; k < 48; k++) { + t = (ctx->X[k] ^= PI_SUBST[(int)(t & 255)]); + } + t = (t + (unsigned char)j) & 255; + } +} + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful + */ +int ltc_md2_init(ltc_md2_ctx *ctx) +{ + + LTC_ARGCHK(ctx != NULL); + + /* LTC_MD2 uses a zero'ed state... */ + CC_XZEROMEM(ctx->X, sizeof(ctx->X)); + CC_XZEROMEM(ctx->chksum, sizeof(ctx->chksum)); + CC_XZEROMEM(ctx->buf, sizeof(ctx->buf)); + ctx->curlen = 0; + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful + */ +int ltc_md2_process(ltc_md2_ctx *ctx, const unsigned char *in, + unsigned long inlen) +{ + unsigned long n; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(in != NULL); + + if (ctx->curlen > sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + while (inlen > 0) { + n = MIN(inlen, (16 - ctx->curlen)); + CC_XMEMCPY(ctx->buf + ctx->curlen, in, (size_t)n); + ctx->curlen += n; + in += n; + inlen -= n; + + /* is 16 bytes full? */ + if (ctx->curlen == 16) { + md2_compress(ctx); + md2_update_chksum(ctx); + ctx->curlen = 0; + } + } + return CRYPT_OK; +} + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (16 bytes) + @return CRYPT_OK if successful + */ +int ltc_md2_done(ltc_md2_ctx *ctx, unsigned char *out) +{ + unsigned long i, k; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + + /* pad the message */ + k = 16 - ctx->curlen; + for (i = ctx->curlen; i < 16; i++) { + ctx->buf[i] = (unsigned char)k; + } + + /* hash and update */ + md2_compress(ctx); + md2_update_chksum(ctx); + + /* hash checksum */ + CC_XMEMCPY(ctx->buf, ctx->chksum, 16); + md2_compress(ctx); + + /* output is lower 16 bytes of X */ + CC_XMEMCPY(out, ctx->X, 16); + +#ifdef LTC_CLEAN_STACK + CC_XZEROMEM(ctx, sizeof(hash_state)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled + */ +int ltc_md2_test(void) +{ +#ifndef LTC_TEST + return CRYPT_NOP; +#else + static const struct { + const char *msg; + unsigned char md[16]; + } tests[] = { + { "", + {0x83,0x50,0xe5,0xa3,0xe2,0x4c,0x15,0x3d, + 0xf2,0x27,0x5c,0x9f,0x80,0x69,0x27,0x73 + } + }, + { "a", + {0x32,0xec,0x01,0xec,0x4a,0x6d,0xac,0x72, + 0xc0,0xab,0x96,0xfb,0x34,0xc0,0xb5,0xd1 + } + }, + { "message digest", + {0xab,0x4f,0x49,0x6b,0xfb,0x2a,0x53,0x0b, + 0x21,0x9f,0xf3,0x30,0x31,0xfe,0x06,0xb0 + } + }, + { "abcdefghijklmnopqrstuvwxyz", + {0x4e,0x8d,0xdf,0xf3,0x65,0x02,0x92,0xab, + 0x5a,0x41,0x08,0xc3,0xaa,0x47,0x94,0x0b + } + }, + { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + {0xda,0x33,0xde,0xf2,0xa4,0x2d,0xf1,0x39, + 0x75,0x35,0x28,0x46,0xc3,0x03,0x38,0xcd + } + }, + { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + {0xd5,0x97,0x6f,0x79,0xd8,0x3d,0x3a,0x0d, + 0xc9,0x80,0x6c,0x3c,0x66,0xf3,0xef,0xd8 + } + } + }; + int i; + ltc_hash_state md; + unsigned char buf[16]; + + for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { + ltc_md2_init(&md); + ltc_md2_process(&md, (const unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); + ltc_md2_done(&md, buf); + if (LTC_XMEMCMP(buf, tests[i].md, 16) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; +#endif /* LTC_TEST */ +} + ADDED Source/descriptors/digestDescriptors/ltc_md2_descriptor/ltc_md2.h Index: Source/descriptors/digestDescriptors/ltc_md2_descriptor/ltc_md2.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_md2_descriptor/ltc_md2.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_md2.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#ifndef _LTC_MD2_H_ +#define _LTC_MD2_H_ + +#define LTC_MD2_HASHSIZE 16 +#define LTC_MD2_BLOCKSIZE 16 + +typedef struct ltc_md2_state { + unsigned long curlen; + unsigned char buf[LTC_MD2_BLOCKSIZE]; + unsigned char chksum[16]; + unsigned char X[48]; + unsigned char paddingB[16]; +} ltc_md2_ctx; + +int ltc_md2_init(ltc_md2_ctx *md); +int ltc_md2_process(ltc_md2_ctx *md, const unsigned char *in, + unsigned long inlen); +int ltc_md2_done(ltc_md2_ctx *md, unsigned char *hash); +int ltc_md2_test(void); + +#endif /* _LTC_MD2_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_md4_descriptor/ltc_md4.c Index: Source/descriptors/digestDescriptors/ltc_md4_descriptor/ltc_md4.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_md4_descriptor/ltc_md4.c @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include +#include "ltc_md4.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" + +/** + @param ltc_md4.c + Submitted by Dobes Vandermeer (dobes@smartt.com) +*/ + + +const ccDescriptor ltc_md4_desc = +{ + .implementation_info = &cc_md4_impinfo, + .dtype.digest.hashsize = CC_MD4_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_MD4_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_md4_init, + .dtype.digest.process = <c_md4_process, + .dtype.digest.done = <c_md4_done, +}; + + +#define S11 3 +#define S12 7 +#define S13 11 +#define S14 19 +#define S21 3 +#define S22 5 +#define S23 9 +#define S24 13 +#define S31 3 +#define S32 9 +#define S33 11 +#define S34 15 + +/* F, G and H are basic LTC_MD4 functions. */ +#define F(x, y, z) (z ^ (x & (y ^ z))) +#define G(x, y, z) ((x & y) | (z & (x | y))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) + +/* ROTATE_LEFT rotates x left n bits. */ +#define ROTATE_LEFT(x, n) LTC_ROLc(x, n) + +/* FF, GG and HH are transformations for rounds 1, 2 and 3 */ +/* Rotation is separate from addition to prevent recomputation */ + +#define FF(a, b, c, d, x, s) { \ + (a) += F ((b), (c), (d)) + (x); \ + (a) = ROTATE_LEFT ((a), (s)); \ + } +#define GG(a, b, c, d, x, s) { \ + (a) += G ((b), (c), (d)) + (x) + 0x5a827999UL; \ + (a) = ROTATE_LEFT ((a), (s)); \ + } +#define HH(a, b, c, d, x, s) { \ + (a) += H ((b), (c), (d)) + (x) + 0x6ed9eba1UL; \ + (a) = ROTATE_LEFT ((a), (s)); \ + } + +#ifdef LTC_CLEAN_STACK +static int _md4_compress(ltc_md4_ctx *ctx, const unsigned char *buf) +#else +static int md4_compress(ltc_md4_ctx *ctx, const unsigned char *buf) +#endif +{ + ulong32 x[16], a, b, c, d; + int i; + + /* copy state */ + a = ctx->state[0]; + b = ctx->state[1]; + c = ctx->state[2]; + d = ctx->state[3]; + + /* copy the state into 512-bits into W[0..15] */ + for (i = 0; i < 16; i++) { + LTC_LOAD32L(x[i], buf + (4*i)); + } + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11); /* 1 */ + FF (d, a, b, c, x[ 1], S12); /* 2 */ + FF (c, d, a, b, x[ 2], S13); /* 3 */ + FF (b, c, d, a, x[ 3], S14); /* 4 */ + FF (a, b, c, d, x[ 4], S11); /* 5 */ + FF (d, a, b, c, x[ 5], S12); /* 6 */ + FF (c, d, a, b, x[ 6], S13); /* 7 */ + FF (b, c, d, a, x[ 7], S14); /* 8 */ + FF (a, b, c, d, x[ 8], S11); /* 9 */ + FF (d, a, b, c, x[ 9], S12); /* 10 */ + FF (c, d, a, b, x[10], S13); /* 11 */ + FF (b, c, d, a, x[11], S14); /* 12 */ + FF (a, b, c, d, x[12], S11); /* 13 */ + FF (d, a, b, c, x[13], S12); /* 14 */ + FF (c, d, a, b, x[14], S13); /* 15 */ + FF (b, c, d, a, x[15], S14); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 0], S21); /* 17 */ + GG (d, a, b, c, x[ 4], S22); /* 18 */ + GG (c, d, a, b, x[ 8], S23); /* 19 */ + GG (b, c, d, a, x[12], S24); /* 20 */ + GG (a, b, c, d, x[ 1], S21); /* 21 */ + GG (d, a, b, c, x[ 5], S22); /* 22 */ + GG (c, d, a, b, x[ 9], S23); /* 23 */ + GG (b, c, d, a, x[13], S24); /* 24 */ + GG (a, b, c, d, x[ 2], S21); /* 25 */ + GG (d, a, b, c, x[ 6], S22); /* 26 */ + GG (c, d, a, b, x[10], S23); /* 27 */ + GG (b, c, d, a, x[14], S24); /* 28 */ + GG (a, b, c, d, x[ 3], S21); /* 29 */ + GG (d, a, b, c, x[ 7], S22); /* 30 */ + GG (c, d, a, b, x[11], S23); /* 31 */ + GG (b, c, d, a, x[15], S24); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 0], S31); /* 33 */ + HH (d, a, b, c, x[ 8], S32); /* 34 */ + HH (c, d, a, b, x[ 4], S33); /* 35 */ + HH (b, c, d, a, x[12], S34); /* 36 */ + HH (a, b, c, d, x[ 2], S31); /* 37 */ + HH (d, a, b, c, x[10], S32); /* 38 */ + HH (c, d, a, b, x[ 6], S33); /* 39 */ + HH (b, c, d, a, x[14], S34); /* 40 */ + HH (a, b, c, d, x[ 1], S31); /* 41 */ + HH (d, a, b, c, x[ 9], S32); /* 42 */ + HH (c, d, a, b, x[ 5], S33); /* 43 */ + HH (b, c, d, a, x[13], S34); /* 44 */ + HH (a, b, c, d, x[ 3], S31); /* 45 */ + HH (d, a, b, c, x[11], S32); /* 46 */ + HH (c, d, a, b, x[ 7], S33); /* 47 */ + HH (b, c, d, a, x[15], S34); /* 48 */ + + + /* Update our state */ + ctx->state[0] = ctx->state[0] + a; + ctx->state[1] = ctx->state[1] + b; + ctx->state[2] = ctx->state[2] + c; + ctx->state[3] = ctx->state[3] + d; + + return CRYPT_OK; +} + +#ifdef LTC_CLEAN_STACK +static int md4_compress(ltc_md4_ctx *ctx, const unsigned char *buf) +{ + int err; + err = _md4_compress(ctx, buf); + + ltc_burn_stack(sizeof(ulong32) * 20 + sizeof(int)); + return err; +} +#endif + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_md4_init(ltc_md4_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->state[0] = 0x67452301UL; + ctx->state[1] = 0xefcdab89UL; + ctx->state[2] = 0x98badcfeUL; + ctx->state[3] = 0x10325476UL; + ctx->length = 0; + ctx->curlen = 0; + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +LTC_HASH_PROCESS(ltc_md4_process, md4_compress, ltc_md4_ctx, md4, 64) + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (16 bytes) + @return CRYPT_OK if successful +*/ +int ltc_md4_done(ltc_md4_ctx *ctx, unsigned char *out) +{ + int i; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + /* increase the length of the message */ + ctx->length += ctx->curlen * 8; + + /* append the '1' bit */ + ctx->buf[ctx->curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (ctx->curlen > 56) { + while (ctx->curlen < 64) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + md4_compress(ctx, ctx->buf); + ctx->curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (ctx->curlen < 56) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64L(ctx->length, ctx->buf+56); + md4_compress(ctx, ctx->buf); + + /* copy output */ + for (i = 0; i < 4; i++) { + LTC_STORE32L(ctx->state[i], out+(4*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(md, sizeof(ltc_hash_state)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int ltc_md4_test(void) +{ + #ifndef LTC_TEST + return CRYPT_NOP; + #else + static const struct md4_test_case { + const char *input; + unsigned char digest[16]; + } cases[] = { + { "", + {0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, + 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0} }, + { "a", + {0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46, + 0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24} }, + { "abc", + {0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, + 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d} }, + { "message digest", + {0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8, + 0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b} }, + { "abcdefghijklmnopqrstuvwxyz", + {0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd, + 0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9} }, + { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + {0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35, + 0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4} }, + { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + {0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19, + 0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36} }, + }; + int i; + ltc_hash_state md; + unsigned char digest[16]; + + for(i = 0; i < (int)(sizeof(cases) / sizeof(cases[0])); i++) { + ltc_md4_init(&md); + ltc_md4_process(&md, (const unsigned char *)cases[i].input, (unsigned long)strlen(cases[i].input)); + ltc_md4_done(&md, digest); + if (LTC_XMEMCMP(digest, cases[i].digest, 16) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + + } + return CRYPT_OK; + #endif +} + ADDED Source/descriptors/digestDescriptors/ltc_md4_descriptor/ltc_md4.h Index: Source/descriptors/digestDescriptors/ltc_md4_descriptor/ltc_md4.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_md4_descriptor/ltc_md4.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_md4.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include + +#ifndef _LTC_MD4_H_ +#define _LTC_MD4_H_ + +#define LTC_MD4_HASHSIZE 16 +#define LTC_MD4_BLOCKSIZE 64 + +typedef struct ltc_md4_state { + uint32_t state[4]; + uint64_t length; + unsigned char buf[LTC_MD4_BLOCKSIZE]; + uint32_t curlen; +} ltc_md4_ctx; + +int ltc_md4_init(ltc_md4_ctx *ctx); +int ltc_md4_process(ltc_md4_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int ltc_md4_done(ltc_md4_ctx *ctx, unsigned char *hash); +int ltc_md4_test(void); + +#endif /* _LTC_MD4_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5.c Index: Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5.c @@ -0,0 +1,373 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include +#include "ltc_md5.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" + +/** + @file ltc_md5.c + LTC_MD5 hash function by Tom St Denis +*/ + +const ccDescriptor ltc_md5_desc = +{ + .implementation_info = &cc_md5_impinfo, + .dtype.digest.hashsize = CC_MD5_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_MD5_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_md5_init, + .dtype.digest.process = <c_md5_process, + .dtype.digest.done = <c_md5_done, +}; + + +#define F(x,y,z) (z ^ (x & (y ^ z))) +#define G(x,y,z) (y ^ (z & (y ^ x))) +#define H(x,y,z) (x^y^z) +#define I(x,y,z) (y^(x|(~z))) + +#ifdef LTC_SMALL_CODE + +#define FF(a,b,c,d,M,s,t) \ + a = (a + F(b,c,d) + M + t); a = ROL(a, s) + b; + +#define GG(a,b,c,d,M,s,t) \ + a = (a + G(b,c,d) + M + t); a = ROL(a, s) + b; + +#define HH(a,b,c,d,M,s,t) \ + a = (a + H(b,c,d) + M + t); a = ROL(a, s) + b; + +#define II(a,b,c,d,M,s,t) \ + a = (a + I(b,c,d) + M + t); a = ROL(a, s) + b; + +static const unsigned char Worder[64] = { + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12, + 5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2, + 0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9 +}; + +static const unsigned char Rorder[64] = { + 7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22, + 5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20, + 4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23, + 6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21 +}; + +static const ulong32 Korder[64] = { +0xd76aa478UL, 0xe8c7b756UL, 0x242070dbUL, 0xc1bdceeeUL, 0xf57c0fafUL, 0x4787c62aUL, 0xa8304613UL, 0xfd469501UL, +0x698098d8UL, 0x8b44f7afUL, 0xffff5bb1UL, 0x895cd7beUL, 0x6b901122UL, 0xfd987193UL, 0xa679438eUL, 0x49b40821UL, +0xf61e2562UL, 0xc040b340UL, 0x265e5a51UL, 0xe9b6c7aaUL, 0xd62f105dUL, 0x02441453UL, 0xd8a1e681UL, 0xe7d3fbc8UL, +0x21e1cde6UL, 0xc33707d6UL, 0xf4d50d87UL, 0x455a14edUL, 0xa9e3e905UL, 0xfcefa3f8UL, 0x676f02d9UL, 0x8d2a4c8aUL, +0xfffa3942UL, 0x8771f681UL, 0x6d9d6122UL, 0xfde5380cUL, 0xa4beea44UL, 0x4bdecfa9UL, 0xf6bb4b60UL, 0xbebfbc70UL, +0x289b7ec6UL, 0xeaa127faUL, 0xd4ef3085UL, 0x04881d05UL, 0xd9d4d039UL, 0xe6db99e5UL, 0x1fa27cf8UL, 0xc4ac5665UL, +0xf4292244UL, 0x432aff97UL, 0xab9423a7UL, 0xfc93a039UL, 0x655b59c3UL, 0x8f0ccc92UL, 0xffeff47dUL, 0x85845dd1UL, +0x6fa87e4fUL, 0xfe2ce6e0UL, 0xa3014314UL, 0x4e0811a1UL, 0xf7537e82UL, 0xbd3af235UL, 0x2ad7d2bbUL, 0xeb86d391UL +}; + +#else + +#define FF(a,b,c,d,M,s,t) \ + a = (a + F(b,c,d) + M + t); a = LTC_ROLc(a, s) + b; + +#define GG(a,b,c,d,M,s,t) \ + a = (a + G(b,c,d) + M + t); a = LTC_ROLc(a, s) + b; + +#define HH(a,b,c,d,M,s,t) \ + a = (a + H(b,c,d) + M + t); a = LTC_ROLc(a, s) + b; + +#define II(a,b,c,d,M,s,t) \ + a = (a + I(b,c,d) + M + t); a = LTC_ROLc(a, s) + b; + + +#endif + +#ifdef LTC_CLEAN_STACK +static int _md5_compress(ltc_md5_ctx *ctx, const unsigned char *buf) +#else +static int md5_compress(ltc_md5_ctx *ctx, const unsigned char *buf) +#endif +{ + ulong32 i, W[16], a, b, c, d; +#ifdef LTC_SMALL_CODE + ulong32 t; +#endif + + /* copy the state into 512-bits into W[0..15] */ + for (i = 0; i < 16; i++) { + LTC_LOAD32L(W[i], buf + (4*i)); + } + + /* copy state */ + a = ctx->state[0]; + b = ctx->state[1]; + c = ctx->state[2]; + d = ctx->state[3]; + +#ifdef LTC_SMALL_CODE + for (i = 0; i < 16; ++i) { + FF(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); + t = d; d = c; c = b; b = a; a = t; + } + + for (; i < 32; ++i) { + GG(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); + t = d; d = c; c = b; b = a; a = t; + } + + for (; i < 48; ++i) { + HH(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); + t = d; d = c; c = b; b = a; a = t; + } + + for (; i < 64; ++i) { + II(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); + t = d; d = c; c = b; b = a; a = t; + } + +#else + FF(a,b,c,d,W[0],7,0xd76aa478UL) + FF(d,a,b,c,W[1],12,0xe8c7b756UL) + FF(c,d,a,b,W[2],17,0x242070dbUL) + FF(b,c,d,a,W[3],22,0xc1bdceeeUL) + FF(a,b,c,d,W[4],7,0xf57c0fafUL) + FF(d,a,b,c,W[5],12,0x4787c62aUL) + FF(c,d,a,b,W[6],17,0xa8304613UL) + FF(b,c,d,a,W[7],22,0xfd469501UL) + FF(a,b,c,d,W[8],7,0x698098d8UL) + FF(d,a,b,c,W[9],12,0x8b44f7afUL) + FF(c,d,a,b,W[10],17,0xffff5bb1UL) + FF(b,c,d,a,W[11],22,0x895cd7beUL) + FF(a,b,c,d,W[12],7,0x6b901122UL) + FF(d,a,b,c,W[13],12,0xfd987193UL) + FF(c,d,a,b,W[14],17,0xa679438eUL) + FF(b,c,d,a,W[15],22,0x49b40821UL) + GG(a,b,c,d,W[1],5,0xf61e2562UL) + GG(d,a,b,c,W[6],9,0xc040b340UL) + GG(c,d,a,b,W[11],14,0x265e5a51UL) + GG(b,c,d,a,W[0],20,0xe9b6c7aaUL) + GG(a,b,c,d,W[5],5,0xd62f105dUL) + GG(d,a,b,c,W[10],9,0x02441453UL) + GG(c,d,a,b,W[15],14,0xd8a1e681UL) + GG(b,c,d,a,W[4],20,0xe7d3fbc8UL) + GG(a,b,c,d,W[9],5,0x21e1cde6UL) + GG(d,a,b,c,W[14],9,0xc33707d6UL) + GG(c,d,a,b,W[3],14,0xf4d50d87UL) + GG(b,c,d,a,W[8],20,0x455a14edUL) + GG(a,b,c,d,W[13],5,0xa9e3e905UL) + GG(d,a,b,c,W[2],9,0xfcefa3f8UL) + GG(c,d,a,b,W[7],14,0x676f02d9UL) + GG(b,c,d,a,W[12],20,0x8d2a4c8aUL) + HH(a,b,c,d,W[5],4,0xfffa3942UL) + HH(d,a,b,c,W[8],11,0x8771f681UL) + HH(c,d,a,b,W[11],16,0x6d9d6122UL) + HH(b,c,d,a,W[14],23,0xfde5380cUL) + HH(a,b,c,d,W[1],4,0xa4beea44UL) + HH(d,a,b,c,W[4],11,0x4bdecfa9UL) + HH(c,d,a,b,W[7],16,0xf6bb4b60UL) + HH(b,c,d,a,W[10],23,0xbebfbc70UL) + HH(a,b,c,d,W[13],4,0x289b7ec6UL) + HH(d,a,b,c,W[0],11,0xeaa127faUL) + HH(c,d,a,b,W[3],16,0xd4ef3085UL) + HH(b,c,d,a,W[6],23,0x04881d05UL) + HH(a,b,c,d,W[9],4,0xd9d4d039UL) + HH(d,a,b,c,W[12],11,0xe6db99e5UL) + HH(c,d,a,b,W[15],16,0x1fa27cf8UL) + HH(b,c,d,a,W[2],23,0xc4ac5665UL) + II(a,b,c,d,W[0],6,0xf4292244UL) + II(d,a,b,c,W[7],10,0x432aff97UL) + II(c,d,a,b,W[14],15,0xab9423a7UL) + II(b,c,d,a,W[5],21,0xfc93a039UL) + II(a,b,c,d,W[12],6,0x655b59c3UL) + II(d,a,b,c,W[3],10,0x8f0ccc92UL) + II(c,d,a,b,W[10],15,0xffeff47dUL) + II(b,c,d,a,W[1],21,0x85845dd1UL) + II(a,b,c,d,W[8],6,0x6fa87e4fUL) + II(d,a,b,c,W[15],10,0xfe2ce6e0UL) + II(c,d,a,b,W[6],15,0xa3014314UL) + II(b,c,d,a,W[13],21,0x4e0811a1UL) + II(a,b,c,d,W[4],6,0xf7537e82UL) + II(d,a,b,c,W[11],10,0xbd3af235UL) + II(c,d,a,b,W[2],15,0x2ad7d2bbUL) + II(b,c,d,a,W[9],21,0xeb86d391UL) +#endif + + ctx->state[0] = ctx->state[0] + a; + ctx->state[1] = ctx->state[1] + b; + ctx->state[2] = ctx->state[2] + c; + ctx->state[3] = ctx->state[3] + d; + + return CRYPT_OK; +} + +#ifdef LTC_CLEAN_STACK +static int md5_compress(ltc_md5_ctx *ctx, const unsigned char *buf) +{ + int err; + err = _md5_compress(ctx, buf); + + // ltc_burn_stack(sizeof(ulong32) * 21); + return err; +} +#endif + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_md5_init(ltc_md5_ctx *ctx) +{ + + LTC_ARGCHK(ctx != NULL); + + ctx->state[0] = 0x67452301UL; + ctx->state[1] = 0xefcdab89UL; + ctx->state[2] = 0x98badcfeUL; + ctx->state[3] = 0x10325476UL; + ctx->curlen = 0; + ctx->length = 0; + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +// LTC_HASH_PROCESS(ltc_md5_process, md5_compress, ltc_md5_ctx, md5, 64) +int ltc_md5_process(ltc_md5_ctx *ctx, const unsigned char *in, unsigned long inlen) +{ + unsigned long n; + int err; + int fullblocks, remainder, processed; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(in != NULL); + + if (ctx->curlen > sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + if ((ctx->length + inlen) < ctx->length) { + return CRYPT_HASH_OVERFLOW; + } + + while (inlen > 0) { + if (ctx->curlen == 0 && inlen >= LTC_MD5_BLOCKSIZE) { + if ((err = md5_compress(ctx, in)) != CRYPT_OK) { + return err; + } + ctx->length += LTC_MD5_BLOCKSIZE * 8; + in += LTC_MD5_BLOCKSIZE; + inlen -= LTC_MD5_BLOCKSIZE; + } else { + n = MIN(inlen, (LTC_MD5_BLOCKSIZE - ctx->curlen)); + CC_XMEMCPY(ctx->buf + ctx->curlen, in, n); + ctx->curlen += n; in += n; inlen -= n; + if (ctx->curlen == LTC_MD5_BLOCKSIZE) { + if ((err = md5_compress(ctx, ctx->buf)) != CRYPT_OK) { + return err; + } + ctx->length += 8*LTC_MD5_BLOCKSIZE; + ctx->curlen = 0; + } + } + } + + return CRYPT_OK; +} + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (16 bytes) + @return CRYPT_OK if successful +*/ +int ltc_md5_done(ltc_md5_ctx *ctx, unsigned char *out) +{ + int i; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + + /* increase the length of the message */ + ctx->length += ctx->curlen * 8; + + /* append the '1' bit */ + ctx->buf[ctx->curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (ctx->curlen > 56) { + while (ctx->curlen < 64) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + md5_compress(ctx, ctx->buf); + ctx->curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (ctx->curlen < 56) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64L(ctx->length, ctx->buf+56); + md5_compress(ctx, ctx->buf); + + /* copy output */ + for (i = 0; i < 4; i++) { + LTC_STORE32L(ctx->state[i], out+(4*i)); + } + ctx->curlen = 0; + return CRYPT_OK; +} + ADDED Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5.h Index: Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_md5.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include +#ifndef _LTC_MD5_H_ +#define _LTC_MD5_H_ + +#define LTC_MD5_HASHSIZE 16 +#define LTC_MD5_BLOCKSIZE 64 + +typedef struct ltc_md5_state { + uint32_t state[4]; + uint64_t length; + unsigned char buf[LTC_MD5_BLOCKSIZE]; + uint32_t curlen; +} ltc_md5_ctx; + +int ltc_md5_init(ltc_md5_ctx *ctx); +int ltc_md5_process(ltc_md5_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int ltc_md5_done(ltc_md5_ctx *ctx, unsigned char *hash); +int ltc_md5_test(void); + +#endif /* _LTC_MD5_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5/ltc_md5.c Index: Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5/ltc_md5.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5/ltc_md5.c @@ -0,0 +1,400 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include "tomcrypt.h" + +/** + @file ltc_md5.c + LTC_MD5 hash function by Tom St Denis +*/ + +#ifdef LTC_MD5 + +cc_implementation_info ltc_md5_impinfo = { + .suiteMask = CC_COMPATIBILITY_SUITE, + .name = "md5", + .classification_id = digest, + .identifier = LTC_MD5_ID, +}; + +const struct ltc_hash_descriptor ltc_md5_desc = +{ + .implementation_info = <c_md5_impinfo, + .hashsize = LTC_MD5_HASHSIZE, + .blocksize = LTC_MD5_BLOCKSIZE, + .OID = { 1, 2, 840, 113549, 2, 5, }, + .OIDlen = 6, + .init = <c_md5_init, + .process = <c_md5_process, + .done = <c_md5_done, + .test = <c_md5_test, + .hmac_block = NULL +}; + +#define F(x,y,z) (z ^ (x & (y ^ z))) +#define G(x,y,z) (y ^ (z & (y ^ x))) +#define H(x,y,z) (x^y^z) +#define I(x,y,z) (y^(x|(~z))) + +#ifdef LTC_SMALL_CODE + +#define FF(a,b,c,d,M,s,t) \ + a = (a + F(b,c,d) + M + t); a = ROL(a, s) + b; + +#define GG(a,b,c,d,M,s,t) \ + a = (a + G(b,c,d) + M + t); a = ROL(a, s) + b; + +#define HH(a,b,c,d,M,s,t) \ + a = (a + H(b,c,d) + M + t); a = ROL(a, s) + b; + +#define II(a,b,c,d,M,s,t) \ + a = (a + I(b,c,d) + M + t); a = ROL(a, s) + b; + +static const unsigned char Worder[64] = { + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12, + 5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2, + 0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9 +}; + +static const unsigned char Rorder[64] = { + 7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22, + 5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20, + 4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23, + 6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21 +}; + +static const ulong32 Korder[64] = { +0xd76aa478UL, 0xe8c7b756UL, 0x242070dbUL, 0xc1bdceeeUL, 0xf57c0fafUL, 0x4787c62aUL, 0xa8304613UL, 0xfd469501UL, +0x698098d8UL, 0x8b44f7afUL, 0xffff5bb1UL, 0x895cd7beUL, 0x6b901122UL, 0xfd987193UL, 0xa679438eUL, 0x49b40821UL, +0xf61e2562UL, 0xc040b340UL, 0x265e5a51UL, 0xe9b6c7aaUL, 0xd62f105dUL, 0x02441453UL, 0xd8a1e681UL, 0xe7d3fbc8UL, +0x21e1cde6UL, 0xc33707d6UL, 0xf4d50d87UL, 0x455a14edUL, 0xa9e3e905UL, 0xfcefa3f8UL, 0x676f02d9UL, 0x8d2a4c8aUL, +0xfffa3942UL, 0x8771f681UL, 0x6d9d6122UL, 0xfde5380cUL, 0xa4beea44UL, 0x4bdecfa9UL, 0xf6bb4b60UL, 0xbebfbc70UL, +0x289b7ec6UL, 0xeaa127faUL, 0xd4ef3085UL, 0x04881d05UL, 0xd9d4d039UL, 0xe6db99e5UL, 0x1fa27cf8UL, 0xc4ac5665UL, +0xf4292244UL, 0x432aff97UL, 0xab9423a7UL, 0xfc93a039UL, 0x655b59c3UL, 0x8f0ccc92UL, 0xffeff47dUL, 0x85845dd1UL, +0x6fa87e4fUL, 0xfe2ce6e0UL, 0xa3014314UL, 0x4e0811a1UL, 0xf7537e82UL, 0xbd3af235UL, 0x2ad7d2bbUL, 0xeb86d391UL +}; + +#else + +#define FF(a,b,c,d,M,s,t) \ + a = (a + F(b,c,d) + M + t); a = LTC_ROLc(a, s) + b; + +#define GG(a,b,c,d,M,s,t) \ + a = (a + G(b,c,d) + M + t); a = LTC_ROLc(a, s) + b; + +#define HH(a,b,c,d,M,s,t) \ + a = (a + H(b,c,d) + M + t); a = LTC_ROLc(a, s) + b; + +#define II(a,b,c,d,M,s,t) \ + a = (a + I(b,c,d) + M + t); a = LTC_ROLc(a, s) + b; + + +#endif + +#ifdef LTC_CLEAN_STACK +static int _md5_compress(ltc_hstate_ptr md, const unsigned char *buf) +#else +static int md5_compress(ltc_hstate_ptr md, const unsigned char *buf) +#endif +{ + ulong32 i, W[16], a, b, c, d; +#ifdef LTC_SMALL_CODE + ulong32 t; +#endif + ltc_md5_ctx *ctx; + + ctx = &md->md5; + + /* copy the state into 512-bits into W[0..15] */ + for (i = 0; i < 16; i++) { + LTC_LOAD32L(W[i], buf + (4*i)); + } + + /* copy state */ + a = ctx->state[0]; + b = ctx->state[1]; + c = ctx->state[2]; + d = ctx->state[3]; + +#ifdef LTC_SMALL_CODE + for (i = 0; i < 16; ++i) { + FF(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); + t = d; d = c; c = b; b = a; a = t; + } + + for (; i < 32; ++i) { + GG(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); + t = d; d = c; c = b; b = a; a = t; + } + + for (; i < 48; ++i) { + HH(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); + t = d; d = c; c = b; b = a; a = t; + } + + for (; i < 64; ++i) { + II(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); + t = d; d = c; c = b; b = a; a = t; + } + +#else + FF(a,b,c,d,W[0],7,0xd76aa478UL) + FF(d,a,b,c,W[1],12,0xe8c7b756UL) + FF(c,d,a,b,W[2],17,0x242070dbUL) + FF(b,c,d,a,W[3],22,0xc1bdceeeUL) + FF(a,b,c,d,W[4],7,0xf57c0fafUL) + FF(d,a,b,c,W[5],12,0x4787c62aUL) + FF(c,d,a,b,W[6],17,0xa8304613UL) + FF(b,c,d,a,W[7],22,0xfd469501UL) + FF(a,b,c,d,W[8],7,0x698098d8UL) + FF(d,a,b,c,W[9],12,0x8b44f7afUL) + FF(c,d,a,b,W[10],17,0xffff5bb1UL) + FF(b,c,d,a,W[11],22,0x895cd7beUL) + FF(a,b,c,d,W[12],7,0x6b901122UL) + FF(d,a,b,c,W[13],12,0xfd987193UL) + FF(c,d,a,b,W[14],17,0xa679438eUL) + FF(b,c,d,a,W[15],22,0x49b40821UL) + GG(a,b,c,d,W[1],5,0xf61e2562UL) + GG(d,a,b,c,W[6],9,0xc040b340UL) + GG(c,d,a,b,W[11],14,0x265e5a51UL) + GG(b,c,d,a,W[0],20,0xe9b6c7aaUL) + GG(a,b,c,d,W[5],5,0xd62f105dUL) + GG(d,a,b,c,W[10],9,0x02441453UL) + GG(c,d,a,b,W[15],14,0xd8a1e681UL) + GG(b,c,d,a,W[4],20,0xe7d3fbc8UL) + GG(a,b,c,d,W[9],5,0x21e1cde6UL) + GG(d,a,b,c,W[14],9,0xc33707d6UL) + GG(c,d,a,b,W[3],14,0xf4d50d87UL) + GG(b,c,d,a,W[8],20,0x455a14edUL) + GG(a,b,c,d,W[13],5,0xa9e3e905UL) + GG(d,a,b,c,W[2],9,0xfcefa3f8UL) + GG(c,d,a,b,W[7],14,0x676f02d9UL) + GG(b,c,d,a,W[12],20,0x8d2a4c8aUL) + HH(a,b,c,d,W[5],4,0xfffa3942UL) + HH(d,a,b,c,W[8],11,0x8771f681UL) + HH(c,d,a,b,W[11],16,0x6d9d6122UL) + HH(b,c,d,a,W[14],23,0xfde5380cUL) + HH(a,b,c,d,W[1],4,0xa4beea44UL) + HH(d,a,b,c,W[4],11,0x4bdecfa9UL) + HH(c,d,a,b,W[7],16,0xf6bb4b60UL) + HH(b,c,d,a,W[10],23,0xbebfbc70UL) + HH(a,b,c,d,W[13],4,0x289b7ec6UL) + HH(d,a,b,c,W[0],11,0xeaa127faUL) + HH(c,d,a,b,W[3],16,0xd4ef3085UL) + HH(b,c,d,a,W[6],23,0x04881d05UL) + HH(a,b,c,d,W[9],4,0xd9d4d039UL) + HH(d,a,b,c,W[12],11,0xe6db99e5UL) + HH(c,d,a,b,W[15],16,0x1fa27cf8UL) + HH(b,c,d,a,W[2],23,0xc4ac5665UL) + II(a,b,c,d,W[0],6,0xf4292244UL) + II(d,a,b,c,W[7],10,0x432aff97UL) + II(c,d,a,b,W[14],15,0xab9423a7UL) + II(b,c,d,a,W[5],21,0xfc93a039UL) + II(a,b,c,d,W[12],6,0x655b59c3UL) + II(d,a,b,c,W[3],10,0x8f0ccc92UL) + II(c,d,a,b,W[10],15,0xffeff47dUL) + II(b,c,d,a,W[1],21,0x85845dd1UL) + II(a,b,c,d,W[8],6,0x6fa87e4fUL) + II(d,a,b,c,W[15],10,0xfe2ce6e0UL) + II(c,d,a,b,W[6],15,0xa3014314UL) + II(b,c,d,a,W[13],21,0x4e0811a1UL) + II(a,b,c,d,W[4],6,0xf7537e82UL) + II(d,a,b,c,W[11],10,0xbd3af235UL) + II(c,d,a,b,W[2],15,0x2ad7d2bbUL) + II(b,c,d,a,W[9],21,0xeb86d391UL) +#endif + + ctx->state[0] = ctx->state[0] + a; + ctx->state[1] = ctx->state[1] + b; + ctx->state[2] = ctx->state[2] + c; + ctx->state[3] = ctx->state[3] + d; + + return CRYPT_OK; +} + +#ifdef LTC_CLEAN_STACK +static int md5_compress(ltc_hstate_ptr md, const unsigned char *buf) +{ + int err; + err = _md5_compress(md, buf); + + ltc_burn_stack(sizeof(ulong32) * 21); + return err; +} +#endif + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_md5_init(ltc_hstate_ptr md) +{ + ltc_md5_ctx *ctx; + + LTC_ARGCHK(md != NULL); + + ctx = &md->md5; + + ctx->state[0] = 0x67452301UL; + ctx->state[1] = 0xefcdab89UL; + ctx->state[2] = 0x98badcfeUL; + ctx->state[3] = 0x10325476UL; + ctx->curlen = 0; + ctx->length = 0; + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +LTC_HASH_PROCESS(ltc_md5_process, md5_compress, ltc_md5_ctx, md5, 64) + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (16 bytes) + @return CRYPT_OK if successful +*/ +int ltc_md5_done(ltc_hstate_ptr md, unsigned char *out) +{ + int i; + ltc_md5_ctx *ctx; + + LTC_ARGCHK(md != NULL); + LTC_ARGCHK(out != NULL); + + ctx = &md->md5; + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + + /* increase the length of the message */ + ctx->length += ctx->curlen * 8; + + /* append the '1' bit */ + ctx->buf[ctx->curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (ctx->curlen > 56) { + while (ctx->curlen < 64) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + md5_compress(md, ctx->buf); + ctx->curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (ctx->curlen < 56) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64L(ctx->length, ctx->buf+56); + md5_compress(md, ctx->buf); + + /* copy output */ + for (i = 0; i < 4; i++) { + LTC_STORE32L(ctx->state[i], out+(4*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(md, sizeof(hash_state)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int ltc_md5_test(void) +{ + #ifndef LTC_TEST + return CRYPT_NOP; + #else + static const struct { + const char *msg; + unsigned char hash[16]; + } tests[] = { + { "", + { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, + 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e } }, + { "a", + {0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, + 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 } }, + { "abc", + { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, + 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 } }, + { "message digest", + { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d, + 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 } }, + { "abcdefghijklmnopqrstuvwxyz", + { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00, + 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b } }, + { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5, + 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f } }, + { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, + 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a } }, + { NULL, { 0 } } + }; + + int i; + unsigned char tmp[16]; + ltc_hash_state md; + + for (i = 0; tests[i].msg != NULL; i++) { + ltc_md5_init(&md); + ltc_md5_process(&md, (const unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); + ltc_md5_done(&md, tmp); + if (LTC_XMEMCMP(tmp, tests[i].hash, 16) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; + #endif +} + +#endif /* LTC_MD5 */ ADDED Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5/ltc_md5.h Index: Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5/ltc_md5.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_md5_descriptor/ltc_md5/ltc_md5.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_md5.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#ifndef _LTC_MD5_H_ +#define _LTC_MD5_H_ + +#define LTC_MD5_HASHSIZE 16 +#define LTC_MD5_BLOCKSIZE 64 + +typedef struct ltc_md5_state { + ulong64 length; + ulong32 state[4], curlen; + unsigned char buf[LTC_MD5_BLOCKSIZE]; +} ltc_md5_ctx; + +int ltc_md5_init(ltc_hstate_ptr md); +int ltc_md5_process(ltc_hstate_ptr md, const unsigned char *in, + unsigned long inlen); +int ltc_md5_done(ltc_hstate_ptr md, unsigned char *hash); +int ltc_md5_test(void); +extern const struct ltc_hash_descriptor ltc_md5_desc; + +#endif /* _LTC_MD5_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd128.c Index: Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd128.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd128.c @@ -0,0 +1,430 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include +#include "ltc_rmd128.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" +#include "CommonDigestSPI.h" + +/** + @param ltc_rmd128.c + RMD128 Hash function +*/ + +/* Implementation of LTC_RIPEMD-128 based on the source by Antoon Bosselaers, + * ESAT-COSIC + * + * This source has been radically overhauled to be portable and work within + * the LibTomCrypt API by Tom St Denis + */ + +const ccDescriptor ltc_rmd128_desc = { + .implementation_info = &cc_rmd128_impinfo, + .dtype.digest.hashsize = CC_RMD128_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_RMD128_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_rmd128_init, + .dtype.digest.process = <c_rmd128_process, + .dtype.digest.done = <c_rmd128_done, +}; + + +/* the four basic functions F(), G() and H() */ +#define F(x, y, z) ((x) ^ (y) ^ (z)) +#define G(x, y, z) (((x) & (y)) | (~(x) & (z))) +#define H(x, y, z) (((x) | ~(y)) ^ (z)) +#define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) + +/* the eight basic operations FF() through III() */ +#define FF(a, b, c, d, x, s) \ + (a) += F((b), (c), (d)) + (x);\ + (a) = LTC_ROLc((a), (s)); + +#define GG(a, b, c, d, x, s) \ + (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ + (a) = LTC_ROLc((a), (s)); + +#define HH(a, b, c, d, x, s) \ + (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\ + (a) = LTC_ROLc((a), (s)); + +#define II(a, b, c, d, x, s) \ + (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcUL;\ + (a) = LTC_ROLc((a), (s)); + +#define FFF(a, b, c, d, x, s) \ + (a) += F((b), (c), (d)) + (x);\ + (a) = LTC_ROLc((a), (s)); + +#define GGG(a, b, c, d, x, s) \ + (a) += G((b), (c), (d)) + (x) + 0x6d703ef3UL;\ + (a) = LTC_ROLc((a), (s)); + +#define HHH(a, b, c, d, x, s) \ + (a) += H((b), (c), (d)) + (x) + 0x5c4dd124UL;\ + (a) = LTC_ROLc((a), (s)); + +#define III(a, b, c, d, x, s) \ + (a) += I((b), (c), (d)) + (x) + 0x50a28be6UL;\ + (a) = LTC_ROLc((a), (s)); + +#ifdef LTC_CLEAN_STACK +static int _rmd128_compress(ltc_rmd128_ctx *ctx, const unsigned char *buf) +#else +static int rmd128_compress(ltc_rmd128_ctx *ctx, const unsigned char *buf) +#endif +{ + ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,X[16]; + int i; + + /* load words X */ + for (i = 0; i < 16; i++){ + LTC_LOAD32L(X[i], buf + (4 * i)); + } + + /* load state */ + aa = aaa = ctx->state[0]; + bb = bbb = ctx->state[1]; + cc = ccc = ctx->state[2]; + dd = ddd = ctx->state[3]; + + /* round 1 */ + FF(aa, bb, cc, dd, X[ 0], 11); + FF(dd, aa, bb, cc, X[ 1], 14); + FF(cc, dd, aa, bb, X[ 2], 15); + FF(bb, cc, dd, aa, X[ 3], 12); + FF(aa, bb, cc, dd, X[ 4], 5); + FF(dd, aa, bb, cc, X[ 5], 8); + FF(cc, dd, aa, bb, X[ 6], 7); + FF(bb, cc, dd, aa, X[ 7], 9); + FF(aa, bb, cc, dd, X[ 8], 11); + FF(dd, aa, bb, cc, X[ 9], 13); + FF(cc, dd, aa, bb, X[10], 14); + FF(bb, cc, dd, aa, X[11], 15); + FF(aa, bb, cc, dd, X[12], 6); + FF(dd, aa, bb, cc, X[13], 7); + FF(cc, dd, aa, bb, X[14], 9); + FF(bb, cc, dd, aa, X[15], 8); + + /* round 2 */ + GG(aa, bb, cc, dd, X[ 7], 7); + GG(dd, aa, bb, cc, X[ 4], 6); + GG(cc, dd, aa, bb, X[13], 8); + GG(bb, cc, dd, aa, X[ 1], 13); + GG(aa, bb, cc, dd, X[10], 11); + GG(dd, aa, bb, cc, X[ 6], 9); + GG(cc, dd, aa, bb, X[15], 7); + GG(bb, cc, dd, aa, X[ 3], 15); + GG(aa, bb, cc, dd, X[12], 7); + GG(dd, aa, bb, cc, X[ 0], 12); + GG(cc, dd, aa, bb, X[ 9], 15); + GG(bb, cc, dd, aa, X[ 5], 9); + GG(aa, bb, cc, dd, X[ 2], 11); + GG(dd, aa, bb, cc, X[14], 7); + GG(cc, dd, aa, bb, X[11], 13); + GG(bb, cc, dd, aa, X[ 8], 12); + + /* round 3 */ + HH(aa, bb, cc, dd, X[ 3], 11); + HH(dd, aa, bb, cc, X[10], 13); + HH(cc, dd, aa, bb, X[14], 6); + HH(bb, cc, dd, aa, X[ 4], 7); + HH(aa, bb, cc, dd, X[ 9], 14); + HH(dd, aa, bb, cc, X[15], 9); + HH(cc, dd, aa, bb, X[ 8], 13); + HH(bb, cc, dd, aa, X[ 1], 15); + HH(aa, bb, cc, dd, X[ 2], 14); + HH(dd, aa, bb, cc, X[ 7], 8); + HH(cc, dd, aa, bb, X[ 0], 13); + HH(bb, cc, dd, aa, X[ 6], 6); + HH(aa, bb, cc, dd, X[13], 5); + HH(dd, aa, bb, cc, X[11], 12); + HH(cc, dd, aa, bb, X[ 5], 7); + HH(bb, cc, dd, aa, X[12], 5); + + /* round 4 */ + II(aa, bb, cc, dd, X[ 1], 11); + II(dd, aa, bb, cc, X[ 9], 12); + II(cc, dd, aa, bb, X[11], 14); + II(bb, cc, dd, aa, X[10], 15); + II(aa, bb, cc, dd, X[ 0], 14); + II(dd, aa, bb, cc, X[ 8], 15); + II(cc, dd, aa, bb, X[12], 9); + II(bb, cc, dd, aa, X[ 4], 8); + II(aa, bb, cc, dd, X[13], 9); + II(dd, aa, bb, cc, X[ 3], 14); + II(cc, dd, aa, bb, X[ 7], 5); + II(bb, cc, dd, aa, X[15], 6); + II(aa, bb, cc, dd, X[14], 8); + II(dd, aa, bb, cc, X[ 5], 6); + II(cc, dd, aa, bb, X[ 6], 5); + II(bb, cc, dd, aa, X[ 2], 12); + + /* parallel round 1 */ + III(aaa, bbb, ccc, ddd, X[ 5], 8); + III(ddd, aaa, bbb, ccc, X[14], 9); + III(ccc, ddd, aaa, bbb, X[ 7], 9); + III(bbb, ccc, ddd, aaa, X[ 0], 11); + III(aaa, bbb, ccc, ddd, X[ 9], 13); + III(ddd, aaa, bbb, ccc, X[ 2], 15); + III(ccc, ddd, aaa, bbb, X[11], 15); + III(bbb, ccc, ddd, aaa, X[ 4], 5); + III(aaa, bbb, ccc, ddd, X[13], 7); + III(ddd, aaa, bbb, ccc, X[ 6], 7); + III(ccc, ddd, aaa, bbb, X[15], 8); + III(bbb, ccc, ddd, aaa, X[ 8], 11); + III(aaa, bbb, ccc, ddd, X[ 1], 14); + III(ddd, aaa, bbb, ccc, X[10], 14); + III(ccc, ddd, aaa, bbb, X[ 3], 12); + III(bbb, ccc, ddd, aaa, X[12], 6); + + /* parallel round 2 */ + HHH(aaa, bbb, ccc, ddd, X[ 6], 9); + HHH(ddd, aaa, bbb, ccc, X[11], 13); + HHH(ccc, ddd, aaa, bbb, X[ 3], 15); + HHH(bbb, ccc, ddd, aaa, X[ 7], 7); + HHH(aaa, bbb, ccc, ddd, X[ 0], 12); + HHH(ddd, aaa, bbb, ccc, X[13], 8); + HHH(ccc, ddd, aaa, bbb, X[ 5], 9); + HHH(bbb, ccc, ddd, aaa, X[10], 11); + HHH(aaa, bbb, ccc, ddd, X[14], 7); + HHH(ddd, aaa, bbb, ccc, X[15], 7); + HHH(ccc, ddd, aaa, bbb, X[ 8], 12); + HHH(bbb, ccc, ddd, aaa, X[12], 7); + HHH(aaa, bbb, ccc, ddd, X[ 4], 6); + HHH(ddd, aaa, bbb, ccc, X[ 9], 15); + HHH(ccc, ddd, aaa, bbb, X[ 1], 13); + HHH(bbb, ccc, ddd, aaa, X[ 2], 11); + + /* parallel round 3 */ + GGG(aaa, bbb, ccc, ddd, X[15], 9); + GGG(ddd, aaa, bbb, ccc, X[ 5], 7); + GGG(ccc, ddd, aaa, bbb, X[ 1], 15); + GGG(bbb, ccc, ddd, aaa, X[ 3], 11); + GGG(aaa, bbb, ccc, ddd, X[ 7], 8); + GGG(ddd, aaa, bbb, ccc, X[14], 6); + GGG(ccc, ddd, aaa, bbb, X[ 6], 6); + GGG(bbb, ccc, ddd, aaa, X[ 9], 14); + GGG(aaa, bbb, ccc, ddd, X[11], 12); + GGG(ddd, aaa, bbb, ccc, X[ 8], 13); + GGG(ccc, ddd, aaa, bbb, X[12], 5); + GGG(bbb, ccc, ddd, aaa, X[ 2], 14); + GGG(aaa, bbb, ccc, ddd, X[10], 13); + GGG(ddd, aaa, bbb, ccc, X[ 0], 13); + GGG(ccc, ddd, aaa, bbb, X[ 4], 7); + GGG(bbb, ccc, ddd, aaa, X[13], 5); + + /* parallel round 4 */ + FFF(aaa, bbb, ccc, ddd, X[ 8], 15); + FFF(ddd, aaa, bbb, ccc, X[ 6], 5); + FFF(ccc, ddd, aaa, bbb, X[ 4], 8); + FFF(bbb, ccc, ddd, aaa, X[ 1], 11); + FFF(aaa, bbb, ccc, ddd, X[ 3], 14); + FFF(ddd, aaa, bbb, ccc, X[11], 14); + FFF(ccc, ddd, aaa, bbb, X[15], 6); + FFF(bbb, ccc, ddd, aaa, X[ 0], 14); + FFF(aaa, bbb, ccc, ddd, X[ 5], 6); + FFF(ddd, aaa, bbb, ccc, X[12], 9); + FFF(ccc, ddd, aaa, bbb, X[ 2], 12); + FFF(bbb, ccc, ddd, aaa, X[13], 9); + FFF(aaa, bbb, ccc, ddd, X[ 9], 12); + FFF(ddd, aaa, bbb, ccc, X[ 7], 5); + FFF(ccc, ddd, aaa, bbb, X[10], 15); + FFF(bbb, ccc, ddd, aaa, X[14], 8); + + /* combine results */ + ddd += cc + ctx->state[1]; /* final result for MDbuf[0] */ + ctx->state[1] = ctx->state[2] + dd + aaa; + ctx->state[2] = ctx->state[3] + aa + bbb; + ctx->state[3] = ctx->state[0] + bb + ccc; + ctx->state[0] = ddd; + + return CRYPT_OK; +} + +#ifdef LTC_CLEAN_STACK +static int rmd128_compress(ltc_rmd128_ctx *ctx, const unsigned char *buf) +{ + int err; + err = _rmd128_compress(md, buf); + + ltc_burn_stack(sizeof(ulong32) * 24 + sizeof(int)); + return err; +} +#endif + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_rmd128_init(ltc_rmd128_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->state[0] = 0x67452301UL; + ctx->state[1] = 0xefcdab89UL; + ctx->state[2] = 0x98badcfeUL; + ctx->state[3] = 0x10325476UL; + ctx->curlen = 0; + ctx->length = 0; + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +LTC_HASH_PROCESS(ltc_rmd128_process, rmd128_compress, ltc_rmd128_ctx, rmd128, 64) + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (16 bytes) + @return CRYPT_OK if successful +*/ +int ltc_rmd128_done(ltc_rmd128_ctx *ctx, unsigned char *out) +{ + int i; + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + + /* increase the length of the message */ + ctx->length += ctx->curlen * 8; + + /* append the '1' bit */ + ctx->buf[ctx->curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (ctx->curlen > 56) { + while (ctx->curlen < 64) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + rmd128_compress(ctx, ctx->buf); + ctx->curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (ctx->curlen < 56) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64L(ctx->length, ctx->buf+56); + rmd128_compress(ctx, ctx->buf); + + /* copy output */ + for (i = 0; i < 4; i++) { + LTC_STORE32L(ctx->state[i], out+(4*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(md, sizeof(ltc_hash_state)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int ltc_rmd128_test(void) +{ +#ifndef LTC_TEST + return CRYPT_NOP; +#else + static const struct { + const char *msg; + unsigned char md[16]; + } tests[] = { + { "", + { 0xcd, 0xf2, 0x62, 0x13, 0xa1, 0x50, 0xdc, 0x3e, + 0xcb, 0x61, 0x0f, 0x18, 0xf6, 0xb3, 0x8b, 0x46 } + }, + { "a", + { 0x86, 0xbe, 0x7a, 0xfa, 0x33, 0x9d, 0x0f, 0xc7, + 0xcf, 0xc7, 0x85, 0xe7, 0x2f, 0x57, 0x8d, 0x33 } + }, + { "abc", + { 0xc1, 0x4a, 0x12, 0x19, 0x9c, 0x66, 0xe4, 0xba, + 0x84, 0x63, 0x6b, 0x0f, 0x69, 0x14, 0x4c, 0x77 } + }, + { "message digest", + { 0x9e, 0x32, 0x7b, 0x3d, 0x6e, 0x52, 0x30, 0x62, + 0xaf, 0xc1, 0x13, 0x2d, 0x7d, 0xf9, 0xd1, 0xb8 } + }, + { "abcdefghijklmnopqrstuvwxyz", + { 0xfd, 0x2a, 0xa6, 0x07, 0xf7, 0x1d, 0xc8, 0xf5, + 0x10, 0x71, 0x49, 0x22, 0xb3, 0x71, 0x83, 0x4e } + }, + { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + { 0xd1, 0xe9, 0x59, 0xeb, 0x17, 0x9c, 0x91, 0x1f, + 0xae, 0xa4, 0x62, 0x4c, 0x60, 0xc5, 0xc7, 0x02 } + } + }; + int x; + unsigned char buf[16]; + ltc_hash_state md; + + for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { + ltc_rmd128_init(&md); + ltc_rmd128_process(&md, (const unsigned char *)tests[x].msg, strlen(tests[x].msg)); + ltc_rmd128_done(&md, buf); + if (LTC_XMEMCMP(buf, tests[x].md, 16) != 0) { + #if 0 + printf("Failed test %d\n", x); + #endif + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; +#endif +} + ADDED Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd128.h Index: Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd128.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd128.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_rmd128.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include + +#ifndef _LTC_RMD128_H_ +#define _LTC_RMD128_H_ + +#define LTC_RMD128_HASHSIZE 16 +#define LTC_RMD128_BLOCKSIZE 64 + +typedef struct ltc_rmd128_state { + uint64_t length; + uint32_t state[4]; + uint32_t curlen; + unsigned char buf[LTC_RMD128_BLOCKSIZE]; +} ltc_rmd128_ctx; + +int ltc_rmd128_init(ltc_rmd128_ctx *ctx); +int ltc_rmd128_process(ltc_rmd128_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int ltc_rmd128_done(ltc_rmd128_ctx *ctx, unsigned char *hash); + +#endif /* _LTC_RMD128_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd160.c Index: Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd160.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd160.c @@ -0,0 +1,492 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include +#include "ltc_rmd160.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" +#include "CommonDigestSPI.h" + +/** + @file ltc_rmd160.c + RMD160 hash function +*/ + +/* Implementation of LTC_RIPEMD-160 based on the source by Antoon Bosselaers, + * ESAT-COSIC + * + * This source has been radically overhauled to be portable and work within + * the LibTomCrypt API by Tom St Denis + */ + +const ccDescriptor ltc_rmd160_desc = { + .implementation_info = &cc_rmd160_impinfo, + .dtype.digest.hashsize = CC_RMD160_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_RMD160_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_rmd160_init, + .dtype.digest.process = <c_rmd160_process, + .dtype.digest.done = <c_rmd160_done, +}; + + +/* the five basic functions F(), G() and H() */ +#define F(x, y, z) ((x) ^ (y) ^ (z)) +#define G(x, y, z) (((x) & (y)) | (~(x) & (z))) +#define H(x, y, z) (((x) | ~(y)) ^ (z)) +#define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) +#define J(x, y, z) ((x) ^ ((y) | ~(z))) + +/* the ten basic operations FF() through III() */ +#define FF(a, b, c, d, e, x, s) \ + (a) += F((b), (c), (d)) + (x);\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define GG(a, b, c, d, e, x, s) \ + (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define HH(a, b, c, d, e, x, s) \ + (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define II(a, b, c, d, e, x, s) \ + (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcUL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define JJ(a, b, c, d, e, x, s) \ + (a) += J((b), (c), (d)) + (x) + 0xa953fd4eUL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define FFF(a, b, c, d, e, x, s) \ + (a) += F((b), (c), (d)) + (x);\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define GGG(a, b, c, d, e, x, s) \ + (a) += G((b), (c), (d)) + (x) + 0x7a6d76e9UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define HHH(a, b, c, d, e, x, s) \ + (a) += H((b), (c), (d)) + (x) + 0x6d703ef3UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define III(a, b, c, d, e, x, s) \ + (a) += I((b), (c), (d)) + (x) + 0x5c4dd124UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define JJJ(a, b, c, d, e, x, s) \ + (a) += J((b), (c), (d)) + (x) + 0x50a28be6UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + + +#ifdef LTC_CLEAN_STACK +static int _rmd160_compress(ltc_rmd160_ctx *ctx, const unsigned char *buf) +#else +static int rmd160_compress(ltc_rmd160_ctx *ctx, const unsigned char *buf) +#endif +{ + ulong32 aa,bb,cc,dd,ee,aaa,bbb,ccc,ddd,eee,X[16]; + int i; + + /* load words X */ + for (i = 0; i < 16; i++){ + LTC_LOAD32L(X[i], buf + (4 * i)); + } + + /* load state */ + aa = aaa = ctx->state[0]; + bb = bbb = ctx->state[1]; + cc = ccc = ctx->state[2]; + dd = ddd = ctx->state[3]; + ee = eee = ctx->state[4]; + + /* round 1 */ + FF(aa, bb, cc, dd, ee, X[ 0], 11); + FF(ee, aa, bb, cc, dd, X[ 1], 14); + FF(dd, ee, aa, bb, cc, X[ 2], 15); + FF(cc, dd, ee, aa, bb, X[ 3], 12); + FF(bb, cc, dd, ee, aa, X[ 4], 5); + FF(aa, bb, cc, dd, ee, X[ 5], 8); + FF(ee, aa, bb, cc, dd, X[ 6], 7); + FF(dd, ee, aa, bb, cc, X[ 7], 9); + FF(cc, dd, ee, aa, bb, X[ 8], 11); + FF(bb, cc, dd, ee, aa, X[ 9], 13); + FF(aa, bb, cc, dd, ee, X[10], 14); + FF(ee, aa, bb, cc, dd, X[11], 15); + FF(dd, ee, aa, bb, cc, X[12], 6); + FF(cc, dd, ee, aa, bb, X[13], 7); + FF(bb, cc, dd, ee, aa, X[14], 9); + FF(aa, bb, cc, dd, ee, X[15], 8); + + /* round 2 */ + GG(ee, aa, bb, cc, dd, X[ 7], 7); + GG(dd, ee, aa, bb, cc, X[ 4], 6); + GG(cc, dd, ee, aa, bb, X[13], 8); + GG(bb, cc, dd, ee, aa, X[ 1], 13); + GG(aa, bb, cc, dd, ee, X[10], 11); + GG(ee, aa, bb, cc, dd, X[ 6], 9); + GG(dd, ee, aa, bb, cc, X[15], 7); + GG(cc, dd, ee, aa, bb, X[ 3], 15); + GG(bb, cc, dd, ee, aa, X[12], 7); + GG(aa, bb, cc, dd, ee, X[ 0], 12); + GG(ee, aa, bb, cc, dd, X[ 9], 15); + GG(dd, ee, aa, bb, cc, X[ 5], 9); + GG(cc, dd, ee, aa, bb, X[ 2], 11); + GG(bb, cc, dd, ee, aa, X[14], 7); + GG(aa, bb, cc, dd, ee, X[11], 13); + GG(ee, aa, bb, cc, dd, X[ 8], 12); + + /* round 3 */ + HH(dd, ee, aa, bb, cc, X[ 3], 11); + HH(cc, dd, ee, aa, bb, X[10], 13); + HH(bb, cc, dd, ee, aa, X[14], 6); + HH(aa, bb, cc, dd, ee, X[ 4], 7); + HH(ee, aa, bb, cc, dd, X[ 9], 14); + HH(dd, ee, aa, bb, cc, X[15], 9); + HH(cc, dd, ee, aa, bb, X[ 8], 13); + HH(bb, cc, dd, ee, aa, X[ 1], 15); + HH(aa, bb, cc, dd, ee, X[ 2], 14); + HH(ee, aa, bb, cc, dd, X[ 7], 8); + HH(dd, ee, aa, bb, cc, X[ 0], 13); + HH(cc, dd, ee, aa, bb, X[ 6], 6); + HH(bb, cc, dd, ee, aa, X[13], 5); + HH(aa, bb, cc, dd, ee, X[11], 12); + HH(ee, aa, bb, cc, dd, X[ 5], 7); + HH(dd, ee, aa, bb, cc, X[12], 5); + + /* round 4 */ + II(cc, dd, ee, aa, bb, X[ 1], 11); + II(bb, cc, dd, ee, aa, X[ 9], 12); + II(aa, bb, cc, dd, ee, X[11], 14); + II(ee, aa, bb, cc, dd, X[10], 15); + II(dd, ee, aa, bb, cc, X[ 0], 14); + II(cc, dd, ee, aa, bb, X[ 8], 15); + II(bb, cc, dd, ee, aa, X[12], 9); + II(aa, bb, cc, dd, ee, X[ 4], 8); + II(ee, aa, bb, cc, dd, X[13], 9); + II(dd, ee, aa, bb, cc, X[ 3], 14); + II(cc, dd, ee, aa, bb, X[ 7], 5); + II(bb, cc, dd, ee, aa, X[15], 6); + II(aa, bb, cc, dd, ee, X[14], 8); + II(ee, aa, bb, cc, dd, X[ 5], 6); + II(dd, ee, aa, bb, cc, X[ 6], 5); + II(cc, dd, ee, aa, bb, X[ 2], 12); + + /* round 5 */ + JJ(bb, cc, dd, ee, aa, X[ 4], 9); + JJ(aa, bb, cc, dd, ee, X[ 0], 15); + JJ(ee, aa, bb, cc, dd, X[ 5], 5); + JJ(dd, ee, aa, bb, cc, X[ 9], 11); + JJ(cc, dd, ee, aa, bb, X[ 7], 6); + JJ(bb, cc, dd, ee, aa, X[12], 8); + JJ(aa, bb, cc, dd, ee, X[ 2], 13); + JJ(ee, aa, bb, cc, dd, X[10], 12); + JJ(dd, ee, aa, bb, cc, X[14], 5); + JJ(cc, dd, ee, aa, bb, X[ 1], 12); + JJ(bb, cc, dd, ee, aa, X[ 3], 13); + JJ(aa, bb, cc, dd, ee, X[ 8], 14); + JJ(ee, aa, bb, cc, dd, X[11], 11); + JJ(dd, ee, aa, bb, cc, X[ 6], 8); + JJ(cc, dd, ee, aa, bb, X[15], 5); + JJ(bb, cc, dd, ee, aa, X[13], 6); + + /* parallel round 1 */ + JJJ(aaa, bbb, ccc, ddd, eee, X[ 5], 8); + JJJ(eee, aaa, bbb, ccc, ddd, X[14], 9); + JJJ(ddd, eee, aaa, bbb, ccc, X[ 7], 9); + JJJ(ccc, ddd, eee, aaa, bbb, X[ 0], 11); + JJJ(bbb, ccc, ddd, eee, aaa, X[ 9], 13); + JJJ(aaa, bbb, ccc, ddd, eee, X[ 2], 15); + JJJ(eee, aaa, bbb, ccc, ddd, X[11], 15); + JJJ(ddd, eee, aaa, bbb, ccc, X[ 4], 5); + JJJ(ccc, ddd, eee, aaa, bbb, X[13], 7); + JJJ(bbb, ccc, ddd, eee, aaa, X[ 6], 7); + JJJ(aaa, bbb, ccc, ddd, eee, X[15], 8); + JJJ(eee, aaa, bbb, ccc, ddd, X[ 8], 11); + JJJ(ddd, eee, aaa, bbb, ccc, X[ 1], 14); + JJJ(ccc, ddd, eee, aaa, bbb, X[10], 14); + JJJ(bbb, ccc, ddd, eee, aaa, X[ 3], 12); + JJJ(aaa, bbb, ccc, ddd, eee, X[12], 6); + + /* parallel round 2 */ + III(eee, aaa, bbb, ccc, ddd, X[ 6], 9); + III(ddd, eee, aaa, bbb, ccc, X[11], 13); + III(ccc, ddd, eee, aaa, bbb, X[ 3], 15); + III(bbb, ccc, ddd, eee, aaa, X[ 7], 7); + III(aaa, bbb, ccc, ddd, eee, X[ 0], 12); + III(eee, aaa, bbb, ccc, ddd, X[13], 8); + III(ddd, eee, aaa, bbb, ccc, X[ 5], 9); + III(ccc, ddd, eee, aaa, bbb, X[10], 11); + III(bbb, ccc, ddd, eee, aaa, X[14], 7); + III(aaa, bbb, ccc, ddd, eee, X[15], 7); + III(eee, aaa, bbb, ccc, ddd, X[ 8], 12); + III(ddd, eee, aaa, bbb, ccc, X[12], 7); + III(ccc, ddd, eee, aaa, bbb, X[ 4], 6); + III(bbb, ccc, ddd, eee, aaa, X[ 9], 15); + III(aaa, bbb, ccc, ddd, eee, X[ 1], 13); + III(eee, aaa, bbb, ccc, ddd, X[ 2], 11); + + /* parallel round 3 */ + HHH(ddd, eee, aaa, bbb, ccc, X[15], 9); + HHH(ccc, ddd, eee, aaa, bbb, X[ 5], 7); + HHH(bbb, ccc, ddd, eee, aaa, X[ 1], 15); + HHH(aaa, bbb, ccc, ddd, eee, X[ 3], 11); + HHH(eee, aaa, bbb, ccc, ddd, X[ 7], 8); + HHH(ddd, eee, aaa, bbb, ccc, X[14], 6); + HHH(ccc, ddd, eee, aaa, bbb, X[ 6], 6); + HHH(bbb, ccc, ddd, eee, aaa, X[ 9], 14); + HHH(aaa, bbb, ccc, ddd, eee, X[11], 12); + HHH(eee, aaa, bbb, ccc, ddd, X[ 8], 13); + HHH(ddd, eee, aaa, bbb, ccc, X[12], 5); + HHH(ccc, ddd, eee, aaa, bbb, X[ 2], 14); + HHH(bbb, ccc, ddd, eee, aaa, X[10], 13); + HHH(aaa, bbb, ccc, ddd, eee, X[ 0], 13); + HHH(eee, aaa, bbb, ccc, ddd, X[ 4], 7); + HHH(ddd, eee, aaa, bbb, ccc, X[13], 5); + + /* parallel round 4 */ + GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15); + GGG(bbb, ccc, ddd, eee, aaa, X[ 6], 5); + GGG(aaa, bbb, ccc, ddd, eee, X[ 4], 8); + GGG(eee, aaa, bbb, ccc, ddd, X[ 1], 11); + GGG(ddd, eee, aaa, bbb, ccc, X[ 3], 14); + GGG(ccc, ddd, eee, aaa, bbb, X[11], 14); + GGG(bbb, ccc, ddd, eee, aaa, X[15], 6); + GGG(aaa, bbb, ccc, ddd, eee, X[ 0], 14); + GGG(eee, aaa, bbb, ccc, ddd, X[ 5], 6); + GGG(ddd, eee, aaa, bbb, ccc, X[12], 9); + GGG(ccc, ddd, eee, aaa, bbb, X[ 2], 12); + GGG(bbb, ccc, ddd, eee, aaa, X[13], 9); + GGG(aaa, bbb, ccc, ddd, eee, X[ 9], 12); + GGG(eee, aaa, bbb, ccc, ddd, X[ 7], 5); + GGG(ddd, eee, aaa, bbb, ccc, X[10], 15); + GGG(ccc, ddd, eee, aaa, bbb, X[14], 8); + + /* parallel round 5 */ + FFF(bbb, ccc, ddd, eee, aaa, X[12] , 8); + FFF(aaa, bbb, ccc, ddd, eee, X[15] , 5); + FFF(eee, aaa, bbb, ccc, ddd, X[10] , 12); + FFF(ddd, eee, aaa, bbb, ccc, X[ 4] , 9); + FFF(ccc, ddd, eee, aaa, bbb, X[ 1] , 12); + FFF(bbb, ccc, ddd, eee, aaa, X[ 5] , 5); + FFF(aaa, bbb, ccc, ddd, eee, X[ 8] , 14); + FFF(eee, aaa, bbb, ccc, ddd, X[ 7] , 6); + FFF(ddd, eee, aaa, bbb, ccc, X[ 6] , 8); + FFF(ccc, ddd, eee, aaa, bbb, X[ 2] , 13); + FFF(bbb, ccc, ddd, eee, aaa, X[13] , 6); + FFF(aaa, bbb, ccc, ddd, eee, X[14] , 5); + FFF(eee, aaa, bbb, ccc, ddd, X[ 0] , 15); + FFF(ddd, eee, aaa, bbb, ccc, X[ 3] , 13); + FFF(ccc, ddd, eee, aaa, bbb, X[ 9] , 11); + FFF(bbb, ccc, ddd, eee, aaa, X[11] , 11); + + /* combine results */ + ddd += cc + ctx->state[1]; /* final result for ctx->state[0] */ + ctx->state[1] = ctx->state[2] + dd + eee; + ctx->state[2] = ctx->state[3] + ee + aaa; + ctx->state[3] = ctx->state[4] + aa + bbb; + ctx->state[4] = ctx->state[0] + bb + ccc; + ctx->state[0] = ddd; + + return CRYPT_OK; +} + +#ifdef LTC_CLEAN_STACK +static int rmd160_compress(ltc_rmd160_ctx *ctx, const unsigned char *buf) +{ + int err; + err = _rmd160_compress(md, buf); + + ltc_burn_stack(sizeof(ulong32) * 26 + sizeof(int)); + return err; +} +#endif + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_rmd160_init(ltc_rmd160_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->state[0] = 0x67452301UL; + ctx->state[1] = 0xefcdab89UL; + ctx->state[2] = 0x98badcfeUL; + ctx->state[3] = 0x10325476UL; + ctx->state[4] = 0xc3d2e1f0UL; + ctx->curlen = 0; + ctx->length = 0; + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +LTC_HASH_PROCESS(ltc_rmd160_process, rmd160_compress, ltc_rmd160_ctx, rmd160, 64) + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (20 bytes) + @return CRYPT_OK if successful +*/ +int ltc_rmd160_done(ltc_rmd160_ctx *ctx, unsigned char *out) +{ + int i; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + + /* increase the length of the message */ + ctx->length += ctx->curlen * 8; + + /* append the '1' bit */ + ctx->buf[ctx->curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (ctx->curlen > 56) { + while (ctx->curlen < 64) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + rmd160_compress(ctx, ctx->buf); + ctx->curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (ctx->curlen < 56) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64L(ctx->length, ctx->buf+56); + rmd160_compress(ctx, ctx->buf); + + /* copy output */ + for (i = 0; i < 5; i++) { + LTC_STORE32L(ctx->state[i], out+(4*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(md, sizeof(ltc_hash_state)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int ltc_rmd160_test(void) +{ +#ifndef LTC_TEST + return CRYPT_NOP; +#else + static const struct { + const char *msg; + unsigned char md[20]; + } tests[] = { + { "", + { 0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54, 0x61, 0x28, + 0x08, 0x97, 0x7e, 0xe8, 0xf5, 0x48, 0xb2, 0x25, 0x8d, 0x31 } + }, + { "a", + { 0x0b, 0xdc, 0x9d, 0x2d, 0x25, 0x6b, 0x3e, 0xe9, 0xda, 0xae, + 0x34, 0x7b, 0xe6, 0xf4, 0xdc, 0x83, 0x5a, 0x46, 0x7f, 0xfe } + }, + { "abc", + { 0x8e, 0xb2, 0x08, 0xf7, 0xe0, 0x5d, 0x98, 0x7a, 0x9b, 0x04, + 0x4a, 0x8e, 0x98, 0xc6, 0xb0, 0x87, 0xf1, 0x5a, 0x0b, 0xfc } + }, + { "message digest", + { 0x5d, 0x06, 0x89, 0xef, 0x49, 0xd2, 0xfa, 0xe5, 0x72, 0xb8, + 0x81, 0xb1, 0x23, 0xa8, 0x5f, 0xfa, 0x21, 0x59, 0x5f, 0x36 } + }, + { "abcdefghijklmnopqrstuvwxyz", + { 0xf7, 0x1c, 0x27, 0x10, 0x9c, 0x69, 0x2c, 0x1b, 0x56, 0xbb, + 0xdc, 0xeb, 0x5b, 0x9d, 0x28, 0x65, 0xb3, 0x70, 0x8d, 0xbc } + }, + { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + { 0x12, 0xa0, 0x53, 0x38, 0x4a, 0x9c, 0x0c, 0x88, 0xe4, 0x05, + 0xa0, 0x6c, 0x27, 0xdc, 0xf4, 0x9a, 0xda, 0x62, 0xeb, 0x2b } + } + }; + int x; + unsigned char buf[20]; + ltc_hash_state md; + + for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { + ltc_rmd160_init(&md); + ltc_rmd160_process(&md, (const unsigned char *)tests[x].msg, + strlen(tests[x].msg)); + ltc_rmd160_done(&md, buf); + if (LTC_XMEMCMP(buf, tests[x].md, 20) != 0) { +#if 0 + printf("Failed test %d\n", x); +#endif + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; +#endif +} + ADDED Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd160.h Index: Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd160.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd160.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_rmd160.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include + +#ifndef _LTC_RMD160_H_ +#define _LTC_RMD160_H_ + +#define LTC_RMD160_HASHSIZE 20 +#define LTC_RMD160_BLOCKSIZE 64 + +typedef struct ltc_rmd160_state { + uint64_t length; + uint32_t state[5]; + uint32_t curlen; + unsigned char buf[LTC_RMD160_BLOCKSIZE]; +} ltc_rmd160_ctx; + +int ltc_rmd160_init(ltc_rmd160_ctx *ctx); +int ltc_rmd160_process(ltc_rmd160_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int ltc_rmd160_done(ltc_rmd160_ctx *ctx, unsigned char *hash); + +#endif /* _LTC_RMD160_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd256.c Index: Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd256.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd256.c @@ -0,0 +1,456 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include +#include "ltc_rmd256.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" +#include "CommonDigestSPI.h" + +/** + @param ltc_rmd256.c + RLTC_MD256 Hash function +*/ + +const ccDescriptor ltc_rmd256_desc = { + .implementation_info = &cc_rmd256_impinfo, + .dtype.digest.hashsize = CC_RMD256_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_RMD256_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_rmd256_init, + .dtype.digest.process = <c_rmd256_process, + .dtype.digest.done = <c_rmd256_done, +}; + + +/* the four basic functions F(), G() and H() */ +#define F(x, y, z) ((x) ^ (y) ^ (z)) +#define G(x, y, z) (((x) & (y)) | (~(x) & (z))) +#define H(x, y, z) (((x) | ~(y)) ^ (z)) +#define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) + +/* the eight basic operations FF() through III() */ +#define FF(a, b, c, d, x, s) \ + (a) += F((b), (c), (d)) + (x);\ + (a) = LTC_ROLc((a), (s)); + +#define GG(a, b, c, d, x, s) \ + (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ + (a) = LTC_ROLc((a), (s)); + +#define HH(a, b, c, d, x, s) \ + (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\ + (a) = LTC_ROLc((a), (s)); + +#define II(a, b, c, d, x, s) \ + (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcUL;\ + (a) = LTC_ROLc((a), (s)); + +#define FFF(a, b, c, d, x, s) \ + (a) += F((b), (c), (d)) + (x);\ + (a) = LTC_ROLc((a), (s)); + +#define GGG(a, b, c, d, x, s) \ + (a) += G((b), (c), (d)) + (x) + 0x6d703ef3UL;\ + (a) = LTC_ROLc((a), (s)); + +#define HHH(a, b, c, d, x, s) \ + (a) += H((b), (c), (d)) + (x) + 0x5c4dd124UL;\ + (a) = LTC_ROLc((a), (s)); + +#define III(a, b, c, d, x, s) \ + (a) += I((b), (c), (d)) + (x) + 0x50a28be6UL;\ + (a) = LTC_ROLc((a), (s)); + +#ifdef LTC_CLEAN_STACK +static int _rmd256_compress(ltc_rmd256_ctx *ctx, const unsigned char *buf) +#else +static int rmd256_compress(ltc_rmd256_ctx *ctx, const unsigned char *buf) +#endif +{ + ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,tmp,X[16]; + int i; + + /* load words X */ + for (i = 0; i < 16; i++){ + LTC_LOAD32L(X[i], buf + (4 * i)); + } + + /* load state */ + aa = ctx->state[0]; + bb = ctx->state[1]; + cc = ctx->state[2]; + dd = ctx->state[3]; + aaa = ctx->state[4]; + bbb = ctx->state[5]; + ccc = ctx->state[6]; + ddd = ctx->state[7]; + + /* round 1 */ + FF(aa, bb, cc, dd, X[ 0], 11); + FF(dd, aa, bb, cc, X[ 1], 14); + FF(cc, dd, aa, bb, X[ 2], 15); + FF(bb, cc, dd, aa, X[ 3], 12); + FF(aa, bb, cc, dd, X[ 4], 5); + FF(dd, aa, bb, cc, X[ 5], 8); + FF(cc, dd, aa, bb, X[ 6], 7); + FF(bb, cc, dd, aa, X[ 7], 9); + FF(aa, bb, cc, dd, X[ 8], 11); + FF(dd, aa, bb, cc, X[ 9], 13); + FF(cc, dd, aa, bb, X[10], 14); + FF(bb, cc, dd, aa, X[11], 15); + FF(aa, bb, cc, dd, X[12], 6); + FF(dd, aa, bb, cc, X[13], 7); + FF(cc, dd, aa, bb, X[14], 9); + FF(bb, cc, dd, aa, X[15], 8); + + /* parallel round 1 */ + III(aaa, bbb, ccc, ddd, X[ 5], 8); + III(ddd, aaa, bbb, ccc, X[14], 9); + III(ccc, ddd, aaa, bbb, X[ 7], 9); + III(bbb, ccc, ddd, aaa, X[ 0], 11); + III(aaa, bbb, ccc, ddd, X[ 9], 13); + III(ddd, aaa, bbb, ccc, X[ 2], 15); + III(ccc, ddd, aaa, bbb, X[11], 15); + III(bbb, ccc, ddd, aaa, X[ 4], 5); + III(aaa, bbb, ccc, ddd, X[13], 7); + III(ddd, aaa, bbb, ccc, X[ 6], 7); + III(ccc, ddd, aaa, bbb, X[15], 8); + III(bbb, ccc, ddd, aaa, X[ 8], 11); + III(aaa, bbb, ccc, ddd, X[ 1], 14); + III(ddd, aaa, bbb, ccc, X[10], 14); + III(ccc, ddd, aaa, bbb, X[ 3], 12); + III(bbb, ccc, ddd, aaa, X[12], 6); + + tmp = aa; aa = aaa; aaa = tmp; + + /* round 2 */ + GG(aa, bb, cc, dd, X[ 7], 7); + GG(dd, aa, bb, cc, X[ 4], 6); + GG(cc, dd, aa, bb, X[13], 8); + GG(bb, cc, dd, aa, X[ 1], 13); + GG(aa, bb, cc, dd, X[10], 11); + GG(dd, aa, bb, cc, X[ 6], 9); + GG(cc, dd, aa, bb, X[15], 7); + GG(bb, cc, dd, aa, X[ 3], 15); + GG(aa, bb, cc, dd, X[12], 7); + GG(dd, aa, bb, cc, X[ 0], 12); + GG(cc, dd, aa, bb, X[ 9], 15); + GG(bb, cc, dd, aa, X[ 5], 9); + GG(aa, bb, cc, dd, X[ 2], 11); + GG(dd, aa, bb, cc, X[14], 7); + GG(cc, dd, aa, bb, X[11], 13); + GG(bb, cc, dd, aa, X[ 8], 12); + + /* parallel round 2 */ + HHH(aaa, bbb, ccc, ddd, X[ 6], 9); + HHH(ddd, aaa, bbb, ccc, X[11], 13); + HHH(ccc, ddd, aaa, bbb, X[ 3], 15); + HHH(bbb, ccc, ddd, aaa, X[ 7], 7); + HHH(aaa, bbb, ccc, ddd, X[ 0], 12); + HHH(ddd, aaa, bbb, ccc, X[13], 8); + HHH(ccc, ddd, aaa, bbb, X[ 5], 9); + HHH(bbb, ccc, ddd, aaa, X[10], 11); + HHH(aaa, bbb, ccc, ddd, X[14], 7); + HHH(ddd, aaa, bbb, ccc, X[15], 7); + HHH(ccc, ddd, aaa, bbb, X[ 8], 12); + HHH(bbb, ccc, ddd, aaa, X[12], 7); + HHH(aaa, bbb, ccc, ddd, X[ 4], 6); + HHH(ddd, aaa, bbb, ccc, X[ 9], 15); + HHH(ccc, ddd, aaa, bbb, X[ 1], 13); + HHH(bbb, ccc, ddd, aaa, X[ 2], 11); + + tmp = bb; bb = bbb; bbb = tmp; + + /* round 3 */ + HH(aa, bb, cc, dd, X[ 3], 11); + HH(dd, aa, bb, cc, X[10], 13); + HH(cc, dd, aa, bb, X[14], 6); + HH(bb, cc, dd, aa, X[ 4], 7); + HH(aa, bb, cc, dd, X[ 9], 14); + HH(dd, aa, bb, cc, X[15], 9); + HH(cc, dd, aa, bb, X[ 8], 13); + HH(bb, cc, dd, aa, X[ 1], 15); + HH(aa, bb, cc, dd, X[ 2], 14); + HH(dd, aa, bb, cc, X[ 7], 8); + HH(cc, dd, aa, bb, X[ 0], 13); + HH(bb, cc, dd, aa, X[ 6], 6); + HH(aa, bb, cc, dd, X[13], 5); + HH(dd, aa, bb, cc, X[11], 12); + HH(cc, dd, aa, bb, X[ 5], 7); + HH(bb, cc, dd, aa, X[12], 5); + + /* parallel round 3 */ + GGG(aaa, bbb, ccc, ddd, X[15], 9); + GGG(ddd, aaa, bbb, ccc, X[ 5], 7); + GGG(ccc, ddd, aaa, bbb, X[ 1], 15); + GGG(bbb, ccc, ddd, aaa, X[ 3], 11); + GGG(aaa, bbb, ccc, ddd, X[ 7], 8); + GGG(ddd, aaa, bbb, ccc, X[14], 6); + GGG(ccc, ddd, aaa, bbb, X[ 6], 6); + GGG(bbb, ccc, ddd, aaa, X[ 9], 14); + GGG(aaa, bbb, ccc, ddd, X[11], 12); + GGG(ddd, aaa, bbb, ccc, X[ 8], 13); + GGG(ccc, ddd, aaa, bbb, X[12], 5); + GGG(bbb, ccc, ddd, aaa, X[ 2], 14); + GGG(aaa, bbb, ccc, ddd, X[10], 13); + GGG(ddd, aaa, bbb, ccc, X[ 0], 13); + GGG(ccc, ddd, aaa, bbb, X[ 4], 7); + GGG(bbb, ccc, ddd, aaa, X[13], 5); + + tmp = cc; cc = ccc; ccc = tmp; + + /* round 4 */ + II(aa, bb, cc, dd, X[ 1], 11); + II(dd, aa, bb, cc, X[ 9], 12); + II(cc, dd, aa, bb, X[11], 14); + II(bb, cc, dd, aa, X[10], 15); + II(aa, bb, cc, dd, X[ 0], 14); + II(dd, aa, bb, cc, X[ 8], 15); + II(cc, dd, aa, bb, X[12], 9); + II(bb, cc, dd, aa, X[ 4], 8); + II(aa, bb, cc, dd, X[13], 9); + II(dd, aa, bb, cc, X[ 3], 14); + II(cc, dd, aa, bb, X[ 7], 5); + II(bb, cc, dd, aa, X[15], 6); + II(aa, bb, cc, dd, X[14], 8); + II(dd, aa, bb, cc, X[ 5], 6); + II(cc, dd, aa, bb, X[ 6], 5); + II(bb, cc, dd, aa, X[ 2], 12); + + /* parallel round 4 */ + FFF(aaa, bbb, ccc, ddd, X[ 8], 15); + FFF(ddd, aaa, bbb, ccc, X[ 6], 5); + FFF(ccc, ddd, aaa, bbb, X[ 4], 8); + FFF(bbb, ccc, ddd, aaa, X[ 1], 11); + FFF(aaa, bbb, ccc, ddd, X[ 3], 14); + FFF(ddd, aaa, bbb, ccc, X[11], 14); + FFF(ccc, ddd, aaa, bbb, X[15], 6); + FFF(bbb, ccc, ddd, aaa, X[ 0], 14); + FFF(aaa, bbb, ccc, ddd, X[ 5], 6); + FFF(ddd, aaa, bbb, ccc, X[12], 9); + FFF(ccc, ddd, aaa, bbb, X[ 2], 12); + FFF(bbb, ccc, ddd, aaa, X[13], 9); + FFF(aaa, bbb, ccc, ddd, X[ 9], 12); + FFF(ddd, aaa, bbb, ccc, X[ 7], 5); + FFF(ccc, ddd, aaa, bbb, X[10], 15); + FFF(bbb, ccc, ddd, aaa, X[14], 8); + + tmp = dd; dd = ddd; ddd = tmp; + + /* combine results */ + ctx->state[0] += aa; + ctx->state[1] += bb; + ctx->state[2] += cc; + ctx->state[3] += dd; + ctx->state[4] += aaa; + ctx->state[5] += bbb; + ctx->state[6] += ccc; + ctx->state[7] += ddd; + + return CRYPT_OK; +} + +#ifdef LTC_CLEAN_STACK +static int rmd256_compress(ltc_rmd256_ctx *ctx, const unsigned char *buf) +{ + int err; + err = _rmd256_compress(md, buf); + + ltc_burn_stack(sizeof(ulong32) * 25 + sizeof(int)); + return err; +} +#endif + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_rmd256_init(ltc_rmd256_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->state[0] = 0x67452301UL; + ctx->state[1] = 0xefcdab89UL; + ctx->state[2] = 0x98badcfeUL; + ctx->state[3] = 0x10325476UL; + ctx->state[4] = 0x76543210UL; + ctx->state[5] = 0xfedcba98UL; + ctx->state[6] = 0x89abcdefUL; + ctx->state[7] = 0x01234567UL; + ctx->curlen = 0; + ctx->length = 0; + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +LTC_HASH_PROCESS(ltc_rmd256_process, rmd256_compress, ltc_rmd256_ctx, rmd256, 64) + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (16 bytes) + @return CRYPT_OK if successful +*/ +int ltc_rmd256_done(ltc_rmd256_ctx *ctx, unsigned char *out) +{ + int i; + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + + /* increase the length of the message */ + ctx->length += ctx->curlen * 8; + + /* append the '1' bit */ + ctx->buf[ctx->curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (ctx->curlen > 56) { + while (ctx->curlen < 64) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + rmd256_compress(ctx, ctx->buf); + ctx->curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (ctx->curlen < 56) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64L(ctx->length, ctx->buf+56); + rmd256_compress(ctx, ctx->buf); + + /* copy output */ + for (i = 0; i < 8; i++) { + LTC_STORE32L(ctx->state[i], out+(4*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(md, sizeof(hash_state)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int ltc_rmd256_test(void) +{ +#ifndef LTC_TEST + return CRYPT_NOP; +#else + static const struct { + const char *msg; + unsigned char md[32]; + } tests[] = { + { "", + { 0x02, 0xba, 0x4c, 0x4e, 0x5f, 0x8e, 0xcd, 0x18, + 0x77, 0xfc, 0x52, 0xd6, 0x4d, 0x30, 0xe3, 0x7a, + 0x2d, 0x97, 0x74, 0xfb, 0x1e, 0x5d, 0x02, 0x63, + 0x80, 0xae, 0x01, 0x68, 0xe3, 0xc5, 0x52, 0x2d } + }, + { "a", + { 0xf9, 0x33, 0x3e, 0x45, 0xd8, 0x57, 0xf5, 0xd9, + 0x0a, 0x91, 0xba, 0xb7, 0x0a, 0x1e, 0xba, 0x0c, + 0xfb, 0x1b, 0xe4, 0xb0, 0x78, 0x3c, 0x9a, 0xcf, + 0xcd, 0x88, 0x3a, 0x91, 0x34, 0x69, 0x29, 0x25 } + }, + { "abc", + { 0xaf, 0xbd, 0x6e, 0x22, 0x8b, 0x9d, 0x8c, 0xbb, + 0xce, 0xf5, 0xca, 0x2d, 0x03, 0xe6, 0xdb, 0xa1, + 0x0a, 0xc0, 0xbc, 0x7d, 0xcb, 0xe4, 0x68, 0x0e, + 0x1e, 0x42, 0xd2, 0xe9, 0x75, 0x45, 0x9b, 0x65 } + }, + { "message digest", + { 0x87, 0xe9, 0x71, 0x75, 0x9a, 0x1c, 0xe4, 0x7a, + 0x51, 0x4d, 0x5c, 0x91, 0x4c, 0x39, 0x2c, 0x90, + 0x18, 0xc7, 0xc4, 0x6b, 0xc1, 0x44, 0x65, 0x55, + 0x4a, 0xfc, 0xdf, 0x54, 0xa5, 0x07, 0x0c, 0x0e } + }, + { "abcdefghijklmnopqrstuvwxyz", + { 0x64, 0x9d, 0x30, 0x34, 0x75, 0x1e, 0xa2, 0x16, + 0x77, 0x6b, 0xf9, 0xa1, 0x8a, 0xcc, 0x81, 0xbc, + 0x78, 0x96, 0x11, 0x8a, 0x51, 0x97, 0x96, 0x87, + 0x82, 0xdd, 0x1f, 0xd9, 0x7d, 0x8d, 0x51, 0x33 } + }, + { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + { 0x57, 0x40, 0xa4, 0x08, 0xac, 0x16, 0xb7, 0x20, + 0xb8, 0x44, 0x24, 0xae, 0x93, 0x1c, 0xbb, 0x1f, + 0xe3, 0x63, 0xd1, 0xd0, 0xbf, 0x40, 0x17, 0xf1, + 0xa8, 0x9f, 0x7e, 0xa6, 0xde, 0x77, 0xa0, 0xb8 } + } + }; + int x; + unsigned char buf[32]; + ltc_hash_state md; + + for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { + ltc_rmd256_init(&md); + ltc_rmd256_process(&md, (const unsigned char *)tests[x].msg, + strlen(tests[x].msg)); + ltc_rmd256_done(&md, buf); + if (LTC_XMEMCMP(buf, tests[x].md, 32) != 0) { + #if 0 + printf("Failed test %d\n", x); + #endif + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; +#endif +} + ADDED Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd256.h Index: Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd256.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd256.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_rmd256.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include + +#ifndef _LTC_RMD256_H_ +#define _LTC_RMD256_H_ + +#define LTC_RMD256_HASHSIZE 32 +#define LTC_RMD256_BLOCKSIZE 64 + +typedef struct ltc_rmd256_state { + uint64_t length; + uint32_t state[8]; + uint32_t curlen; + unsigned char buf[LTC_RMD256_BLOCKSIZE]; +} ltc_rmd256_ctx; + +int ltc_rmd256_init(ltc_rmd256_ctx *ctx); +int ltc_rmd256_process(ltc_rmd256_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int ltc_rmd256_done(ltc_rmd256_ctx *ctx, unsigned char *hash); + +#endif /* _LTC_RMD256_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd320.c Index: Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd320.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd320.c @@ -0,0 +1,520 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include +#include "ltc_rmd320.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" +#include "CommonDigestSPI.h" + +/** + @file ltc_rmd320.c + RMD320 hash function +*/ + +const ccDescriptor ltc_rmd320_desc = { + .implementation_info = &cc_rmd320_impinfo, + .dtype.digest.hashsize = CC_RMD320_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_RMD320_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_rmd320_init, + .dtype.digest.process = <c_rmd320_process, + .dtype.digest.done = <c_rmd320_done, +}; + + +/* the five basic functions F(), G() and H() */ +#define F(x, y, z) ((x) ^ (y) ^ (z)) +#define G(x, y, z) (((x) & (y)) | (~(x) & (z))) +#define H(x, y, z) (((x) | ~(y)) ^ (z)) +#define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) +#define J(x, y, z) ((x) ^ ((y) | ~(z))) + +/* the ten basic operations FF() through III() */ +#define FF(a, b, c, d, e, x, s) \ + (a) += F((b), (c), (d)) + (x);\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define GG(a, b, c, d, e, x, s) \ + (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define HH(a, b, c, d, e, x, s) \ + (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define II(a, b, c, d, e, x, s) \ + (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcUL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define JJ(a, b, c, d, e, x, s) \ + (a) += J((b), (c), (d)) + (x) + 0xa953fd4eUL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define FFF(a, b, c, d, e, x, s) \ + (a) += F((b), (c), (d)) + (x);\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define GGG(a, b, c, d, e, x, s) \ + (a) += G((b), (c), (d)) + (x) + 0x7a6d76e9UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define HHH(a, b, c, d, e, x, s) \ + (a) += H((b), (c), (d)) + (x) + 0x6d703ef3UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define III(a, b, c, d, e, x, s) \ + (a) += I((b), (c), (d)) + (x) + 0x5c4dd124UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + +#define JJJ(a, b, c, d, e, x, s) \ + (a) += J((b), (c), (d)) + (x) + 0x50a28be6UL;\ + (a) = LTC_ROLc((a), (s)) + (e);\ + (c) = LTC_ROLc((c), 10); + + +#ifdef LTC_CLEAN_STACK +static int _rmd320_compress(ltc_rmd320_ctx *ctx, const unsigned char *buf) +#else +static int rmd320_compress(ltc_rmd320_ctx *ctx, const unsigned char *buf) +#endif +{ + ulong32 aa,bb,cc,dd,ee,aaa,bbb,ccc,ddd,eee,tmp,X[16]; + int i; + + /* load words X */ + for (i = 0; i < 16; i++){ + LTC_LOAD32L(X[i], buf + (4 * i)); + } + + /* load state */ + aa = ctx->state[0]; + bb = ctx->state[1]; + cc = ctx->state[2]; + dd = ctx->state[3]; + ee = ctx->state[4]; + aaa = ctx->state[5]; + bbb = ctx->state[6]; + ccc = ctx->state[7]; + ddd = ctx->state[8]; + eee = ctx->state[9]; + + /* round 1 */ + FF(aa, bb, cc, dd, ee, X[ 0], 11); + FF(ee, aa, bb, cc, dd, X[ 1], 14); + FF(dd, ee, aa, bb, cc, X[ 2], 15); + FF(cc, dd, ee, aa, bb, X[ 3], 12); + FF(bb, cc, dd, ee, aa, X[ 4], 5); + FF(aa, bb, cc, dd, ee, X[ 5], 8); + FF(ee, aa, bb, cc, dd, X[ 6], 7); + FF(dd, ee, aa, bb, cc, X[ 7], 9); + FF(cc, dd, ee, aa, bb, X[ 8], 11); + FF(bb, cc, dd, ee, aa, X[ 9], 13); + FF(aa, bb, cc, dd, ee, X[10], 14); + FF(ee, aa, bb, cc, dd, X[11], 15); + FF(dd, ee, aa, bb, cc, X[12], 6); + FF(cc, dd, ee, aa, bb, X[13], 7); + FF(bb, cc, dd, ee, aa, X[14], 9); + FF(aa, bb, cc, dd, ee, X[15], 8); + + /* parallel round 1 */ + JJJ(aaa, bbb, ccc, ddd, eee, X[ 5], 8); + JJJ(eee, aaa, bbb, ccc, ddd, X[14], 9); + JJJ(ddd, eee, aaa, bbb, ccc, X[ 7], 9); + JJJ(ccc, ddd, eee, aaa, bbb, X[ 0], 11); + JJJ(bbb, ccc, ddd, eee, aaa, X[ 9], 13); + JJJ(aaa, bbb, ccc, ddd, eee, X[ 2], 15); + JJJ(eee, aaa, bbb, ccc, ddd, X[11], 15); + JJJ(ddd, eee, aaa, bbb, ccc, X[ 4], 5); + JJJ(ccc, ddd, eee, aaa, bbb, X[13], 7); + JJJ(bbb, ccc, ddd, eee, aaa, X[ 6], 7); + JJJ(aaa, bbb, ccc, ddd, eee, X[15], 8); + JJJ(eee, aaa, bbb, ccc, ddd, X[ 8], 11); + JJJ(ddd, eee, aaa, bbb, ccc, X[ 1], 14); + JJJ(ccc, ddd, eee, aaa, bbb, X[10], 14); + JJJ(bbb, ccc, ddd, eee, aaa, X[ 3], 12); + JJJ(aaa, bbb, ccc, ddd, eee, X[12], 6); + + tmp = aa; aa = aaa; aaa = tmp; + + /* round 2 */ + GG(ee, aa, bb, cc, dd, X[ 7], 7); + GG(dd, ee, aa, bb, cc, X[ 4], 6); + GG(cc, dd, ee, aa, bb, X[13], 8); + GG(bb, cc, dd, ee, aa, X[ 1], 13); + GG(aa, bb, cc, dd, ee, X[10], 11); + GG(ee, aa, bb, cc, dd, X[ 6], 9); + GG(dd, ee, aa, bb, cc, X[15], 7); + GG(cc, dd, ee, aa, bb, X[ 3], 15); + GG(bb, cc, dd, ee, aa, X[12], 7); + GG(aa, bb, cc, dd, ee, X[ 0], 12); + GG(ee, aa, bb, cc, dd, X[ 9], 15); + GG(dd, ee, aa, bb, cc, X[ 5], 9); + GG(cc, dd, ee, aa, bb, X[ 2], 11); + GG(bb, cc, dd, ee, aa, X[14], 7); + GG(aa, bb, cc, dd, ee, X[11], 13); + GG(ee, aa, bb, cc, dd, X[ 8], 12); + + /* parallel round 2 */ + III(eee, aaa, bbb, ccc, ddd, X[ 6], 9); + III(ddd, eee, aaa, bbb, ccc, X[11], 13); + III(ccc, ddd, eee, aaa, bbb, X[ 3], 15); + III(bbb, ccc, ddd, eee, aaa, X[ 7], 7); + III(aaa, bbb, ccc, ddd, eee, X[ 0], 12); + III(eee, aaa, bbb, ccc, ddd, X[13], 8); + III(ddd, eee, aaa, bbb, ccc, X[ 5], 9); + III(ccc, ddd, eee, aaa, bbb, X[10], 11); + III(bbb, ccc, ddd, eee, aaa, X[14], 7); + III(aaa, bbb, ccc, ddd, eee, X[15], 7); + III(eee, aaa, bbb, ccc, ddd, X[ 8], 12); + III(ddd, eee, aaa, bbb, ccc, X[12], 7); + III(ccc, ddd, eee, aaa, bbb, X[ 4], 6); + III(bbb, ccc, ddd, eee, aaa, X[ 9], 15); + III(aaa, bbb, ccc, ddd, eee, X[ 1], 13); + III(eee, aaa, bbb, ccc, ddd, X[ 2], 11); + + tmp = bb; bb = bbb; bbb = tmp; + + /* round 3 */ + HH(dd, ee, aa, bb, cc, X[ 3], 11); + HH(cc, dd, ee, aa, bb, X[10], 13); + HH(bb, cc, dd, ee, aa, X[14], 6); + HH(aa, bb, cc, dd, ee, X[ 4], 7); + HH(ee, aa, bb, cc, dd, X[ 9], 14); + HH(dd, ee, aa, bb, cc, X[15], 9); + HH(cc, dd, ee, aa, bb, X[ 8], 13); + HH(bb, cc, dd, ee, aa, X[ 1], 15); + HH(aa, bb, cc, dd, ee, X[ 2], 14); + HH(ee, aa, bb, cc, dd, X[ 7], 8); + HH(dd, ee, aa, bb, cc, X[ 0], 13); + HH(cc, dd, ee, aa, bb, X[ 6], 6); + HH(bb, cc, dd, ee, aa, X[13], 5); + HH(aa, bb, cc, dd, ee, X[11], 12); + HH(ee, aa, bb, cc, dd, X[ 5], 7); + HH(dd, ee, aa, bb, cc, X[12], 5); + + /* parallel round 3 */ + HHH(ddd, eee, aaa, bbb, ccc, X[15], 9); + HHH(ccc, ddd, eee, aaa, bbb, X[ 5], 7); + HHH(bbb, ccc, ddd, eee, aaa, X[ 1], 15); + HHH(aaa, bbb, ccc, ddd, eee, X[ 3], 11); + HHH(eee, aaa, bbb, ccc, ddd, X[ 7], 8); + HHH(ddd, eee, aaa, bbb, ccc, X[14], 6); + HHH(ccc, ddd, eee, aaa, bbb, X[ 6], 6); + HHH(bbb, ccc, ddd, eee, aaa, X[ 9], 14); + HHH(aaa, bbb, ccc, ddd, eee, X[11], 12); + HHH(eee, aaa, bbb, ccc, ddd, X[ 8], 13); + HHH(ddd, eee, aaa, bbb, ccc, X[12], 5); + HHH(ccc, ddd, eee, aaa, bbb, X[ 2], 14); + HHH(bbb, ccc, ddd, eee, aaa, X[10], 13); + HHH(aaa, bbb, ccc, ddd, eee, X[ 0], 13); + HHH(eee, aaa, bbb, ccc, ddd, X[ 4], 7); + HHH(ddd, eee, aaa, bbb, ccc, X[13], 5); + + tmp = cc; cc = ccc; ccc = tmp; + + /* round 4 */ + II(cc, dd, ee, aa, bb, X[ 1], 11); + II(bb, cc, dd, ee, aa, X[ 9], 12); + II(aa, bb, cc, dd, ee, X[11], 14); + II(ee, aa, bb, cc, dd, X[10], 15); + II(dd, ee, aa, bb, cc, X[ 0], 14); + II(cc, dd, ee, aa, bb, X[ 8], 15); + II(bb, cc, dd, ee, aa, X[12], 9); + II(aa, bb, cc, dd, ee, X[ 4], 8); + II(ee, aa, bb, cc, dd, X[13], 9); + II(dd, ee, aa, bb, cc, X[ 3], 14); + II(cc, dd, ee, aa, bb, X[ 7], 5); + II(bb, cc, dd, ee, aa, X[15], 6); + II(aa, bb, cc, dd, ee, X[14], 8); + II(ee, aa, bb, cc, dd, X[ 5], 6); + II(dd, ee, aa, bb, cc, X[ 6], 5); + II(cc, dd, ee, aa, bb, X[ 2], 12); + + /* parallel round 4 */ + GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15); + GGG(bbb, ccc, ddd, eee, aaa, X[ 6], 5); + GGG(aaa, bbb, ccc, ddd, eee, X[ 4], 8); + GGG(eee, aaa, bbb, ccc, ddd, X[ 1], 11); + GGG(ddd, eee, aaa, bbb, ccc, X[ 3], 14); + GGG(ccc, ddd, eee, aaa, bbb, X[11], 14); + GGG(bbb, ccc, ddd, eee, aaa, X[15], 6); + GGG(aaa, bbb, ccc, ddd, eee, X[ 0], 14); + GGG(eee, aaa, bbb, ccc, ddd, X[ 5], 6); + GGG(ddd, eee, aaa, bbb, ccc, X[12], 9); + GGG(ccc, ddd, eee, aaa, bbb, X[ 2], 12); + GGG(bbb, ccc, ddd, eee, aaa, X[13], 9); + GGG(aaa, bbb, ccc, ddd, eee, X[ 9], 12); + GGG(eee, aaa, bbb, ccc, ddd, X[ 7], 5); + GGG(ddd, eee, aaa, bbb, ccc, X[10], 15); + GGG(ccc, ddd, eee, aaa, bbb, X[14], 8); + + tmp = dd; dd = ddd; ddd = tmp; + + /* round 5 */ + JJ(bb, cc, dd, ee, aa, X[ 4], 9); + JJ(aa, bb, cc, dd, ee, X[ 0], 15); + JJ(ee, aa, bb, cc, dd, X[ 5], 5); + JJ(dd, ee, aa, bb, cc, X[ 9], 11); + JJ(cc, dd, ee, aa, bb, X[ 7], 6); + JJ(bb, cc, dd, ee, aa, X[12], 8); + JJ(aa, bb, cc, dd, ee, X[ 2], 13); + JJ(ee, aa, bb, cc, dd, X[10], 12); + JJ(dd, ee, aa, bb, cc, X[14], 5); + JJ(cc, dd, ee, aa, bb, X[ 1], 12); + JJ(bb, cc, dd, ee, aa, X[ 3], 13); + JJ(aa, bb, cc, dd, ee, X[ 8], 14); + JJ(ee, aa, bb, cc, dd, X[11], 11); + JJ(dd, ee, aa, bb, cc, X[ 6], 8); + JJ(cc, dd, ee, aa, bb, X[15], 5); + JJ(bb, cc, dd, ee, aa, X[13], 6); + + /* parallel round 5 */ + FFF(bbb, ccc, ddd, eee, aaa, X[12] , 8); + FFF(aaa, bbb, ccc, ddd, eee, X[15] , 5); + FFF(eee, aaa, bbb, ccc, ddd, X[10] , 12); + FFF(ddd, eee, aaa, bbb, ccc, X[ 4] , 9); + FFF(ccc, ddd, eee, aaa, bbb, X[ 1] , 12); + FFF(bbb, ccc, ddd, eee, aaa, X[ 5] , 5); + FFF(aaa, bbb, ccc, ddd, eee, X[ 8] , 14); + FFF(eee, aaa, bbb, ccc, ddd, X[ 7] , 6); + FFF(ddd, eee, aaa, bbb, ccc, X[ 6] , 8); + FFF(ccc, ddd, eee, aaa, bbb, X[ 2] , 13); + FFF(bbb, ccc, ddd, eee, aaa, X[13] , 6); + FFF(aaa, bbb, ccc, ddd, eee, X[14] , 5); + FFF(eee, aaa, bbb, ccc, ddd, X[ 0] , 15); + FFF(ddd, eee, aaa, bbb, ccc, X[ 3] , 13); + FFF(ccc, ddd, eee, aaa, bbb, X[ 9] , 11); + FFF(bbb, ccc, ddd, eee, aaa, X[11] , 11); + + tmp = ee; ee = eee; eee = tmp; + + /* combine results */ + ctx->state[0] += aa; + ctx->state[1] += bb; + ctx->state[2] += cc; + ctx->state[3] += dd; + ctx->state[4] += ee; + ctx->state[5] += aaa; + ctx->state[6] += bbb; + ctx->state[7] += ccc; + ctx->state[8] += ddd; + ctx->state[9] += eee; + + return CRYPT_OK; +} + +#ifdef LTC_CLEAN_STACK +static int rmd320_compress(ltc_rmd320_ctx *ctx, const unsigned char *buf) +{ + int err; + err = _rmd320_compress(md, buf); + + ltc_burn_stack(sizeof(ulong32) * 27 + sizeof(int)); + return err; +} +#endif + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_rmd320_init(ltc_rmd320_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->state[0] = 0x67452301UL; + ctx->state[1] = 0xefcdab89UL; + ctx->state[2] = 0x98badcfeUL; + ctx->state[3] = 0x10325476UL; + ctx->state[4] = 0xc3d2e1f0UL; + ctx->state[5] = 0x76543210UL; + ctx->state[6] = 0xfedcba98UL; + ctx->state[7] = 0x89abcdefUL; + ctx->state[8] = 0x01234567UL; + ctx->state[9] = 0x3c2d1e0fUL; + ctx->curlen = 0; + ctx->length = 0; + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +LTC_HASH_PROCESS(ltc_rmd320_process, rmd320_compress, ltc_rmd320_ctx, rmd320, 64) + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (20 bytes) + @return CRYPT_OK if successful +*/ +int ltc_rmd320_done(ltc_rmd320_ctx *ctx, unsigned char *out) +{ + int i; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + + /* increase the length of the message */ + ctx->length += ctx->curlen * 8; + + /* append the '1' bit */ + ctx->buf[ctx->curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (ctx->curlen > 56) { + while (ctx->curlen < 64) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + rmd320_compress(ctx, ctx->buf); + ctx->curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (ctx->curlen < 56) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64L(ctx->length, ctx->buf+56); + rmd320_compress(ctx, ctx->buf); + + /* copy output */ + for (i = 0; i < 10; i++) { + LTC_STORE32L(ctx->state[i], out+(4*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(md, sizeof(hash_state)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int ltc_rmd320_test(void) +{ +#ifndef LTC_TEST + return CRYPT_NOP; +#else + static const struct { + const char *msg; + unsigned char md[40]; + } tests[] = { + { "", + { 0x22, 0xd6, 0x5d, 0x56, 0x61, 0x53, 0x6c, 0xdc, 0x75, 0xc1, + 0xfd, 0xf5, 0xc6, 0xde, 0x7b, 0x41, 0xb9, 0xf2, 0x73, 0x25, + 0xeb, 0xc6, 0x1e, 0x85, 0x57, 0x17, 0x7d, 0x70, 0x5a, 0x0e, + 0xc8, 0x80, 0x15, 0x1c, 0x3a, 0x32, 0xa0, 0x08, 0x99, 0xb8 } + }, + { "a", + { 0xce, 0x78, 0x85, 0x06, 0x38, 0xf9, 0x26, 0x58, 0xa5, 0xa5, + 0x85, 0x09, 0x75, 0x79, 0x92, 0x6d, 0xda, 0x66, 0x7a, 0x57, + 0x16, 0x56, 0x2c, 0xfc, 0xf6, 0xfb, 0xe7, 0x7f, 0x63, 0x54, + 0x2f, 0x99, 0xb0, 0x47, 0x05, 0xd6, 0x97, 0x0d, 0xff, 0x5d } + }, + { "abc", + { 0xde, 0x4c, 0x01, 0xb3, 0x05, 0x4f, 0x89, 0x30, 0xa7, 0x9d, + 0x09, 0xae, 0x73, 0x8e, 0x92, 0x30, 0x1e, 0x5a, 0x17, 0x08, + 0x5b, 0xef, 0xfd, 0xc1, 0xb8, 0xd1, 0x16, 0x71, 0x3e, 0x74, + 0xf8, 0x2f, 0xa9, 0x42, 0xd6, 0x4c, 0xdb, 0xc4, 0x68, 0x2d } + }, + { "message digest", + { 0x3a, 0x8e, 0x28, 0x50, 0x2e, 0xd4, 0x5d, 0x42, 0x2f, 0x68, + 0x84, 0x4f, 0x9d, 0xd3, 0x16, 0xe7, 0xb9, 0x85, 0x33, 0xfa, + 0x3f, 0x2a, 0x91, 0xd2, 0x9f, 0x84, 0xd4, 0x25, 0xc8, 0x8d, + 0x6b, 0x4e, 0xff, 0x72, 0x7d, 0xf6, 0x6a, 0x7c, 0x01, 0x97 } + }, + { "abcdefghijklmnopqrstuvwxyz", + { 0xca, 0xbd, 0xb1, 0x81, 0x0b, 0x92, 0x47, 0x0a, 0x20, 0x93, + 0xaa, 0x6b, 0xce, 0x05, 0x95, 0x2c, 0x28, 0x34, 0x8c, 0xf4, + 0x3f, 0xf6, 0x08, 0x41, 0x97, 0x51, 0x66, 0xbb, 0x40, 0xed, + 0x23, 0x40, 0x04, 0xb8, 0x82, 0x44, 0x63, 0xe6, 0xb0, 0x09 } + }, + { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + { 0xd0, 0x34, 0xa7, 0x95, 0x0c, 0xf7, 0x22, 0x02, 0x1b, 0xa4, + 0xb8, 0x4d, 0xf7, 0x69, 0xa5, 0xde, 0x20, 0x60, 0xe2, 0x59, + 0xdf, 0x4c, 0x9b, 0xb4, 0xa4, 0x26, 0x8c, 0x0e, 0x93, 0x5b, + 0xbc, 0x74, 0x70, 0xa9, 0x69, 0xc9, 0xd0, 0x72, 0xa1, 0xac } + } + }; + int x; + unsigned char buf[40]; + ltc_hash_state md; + + for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { + ltc_rmd320_init(&md); + ltc_rmd320_process(&md, (const unsigned char *)tests[x].msg, strlen(tests[x].msg)); + ltc_rmd320_done(&md, buf); + if (LTC_XMEMCMP(buf, tests[x].md, 40) != 0) { +#if 0 + printf("Failed test %d\n", x); +#endif + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; +#endif +} + ADDED Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd320.h Index: Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd320.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_rmd_descriptor/ltc_rmd320.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_rmd320.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include + +#ifndef _LTC_RMD320_H_ +#define _LTC_RMD320_H_ + +#define LTC_RMD320_HASHSIZE 40 +#define LTC_RMD320_BLOCKSIZE 64 + +typedef struct ltc_rmd320_state { + uint64_t length; + uint32_t state[10]; + uint32_t curlen; + unsigned char buf[LTC_RMD320_BLOCKSIZE]; +} ltc_rmd320_ctx; + +int ltc_rmd320_init(ltc_rmd320_ctx *ctx); +int ltc_rmd320_process(ltc_rmd320_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int ltc_rmd320_done(ltc_rmd320_ctx *ctx, unsigned char *hash); + +#endif /* _LTC_RMD320_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_sha1_descriptor/ltc_sha1.c Index: Source/descriptors/digestDescriptors/ltc_sha1_descriptor/ltc_sha1.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_sha1_descriptor/ltc_sha1.c @@ -0,0 +1,308 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include +#include "ltc_sha1.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" + +/** + @file ltc_sha1.c + LTC_SHA1 code by Tom St Denis +*/ + + +const ccDescriptor ltc_sha1_desc = +{ + .implementation_info = &cc_sha1_impinfo, + .dtype.digest.hashsize = CC_SHA1_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA1_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_sha1_init, + .dtype.digest.process = <c_sha1_process, + .dtype.digest.done = <c_sha1_done, +}; + + +#define F0(x,y,z) (z ^ (x & (y ^ z))) +#define F1(x,y,z) (x ^ y ^ z) +#define F2(x,y,z) ((x & y) | (z & (x | y))) +#define F3(x,y,z) (x ^ y ^ z) + +#ifdef LTC_CLEAN_STACK +static int _sha1_compress(ltc_sha1_ctx *ctx, const unsigned char *buf) +#else +static int sha1_compress(ltc_sha1_ctx *ctx, const unsigned char *buf) +#endif +{ + ulong32 a,b,c,d,e,W[80],i; +#ifdef LTC_SMALL_CODE + ulong32 t; +#endif + + /* copy the state into 512-bits into W[0..15] */ + for (i = 0; i < 16; i++) { + LTC_LOAD32H(W[i], buf + (4*i)); + } + + /* copy state */ + a = ctx->state[0]; + b = ctx->state[1]; + c = ctx->state[2]; + d = ctx->state[3]; + e = ctx->state[4]; + + /* expand it */ + for (i = 16; i < 80; i++) { + W[i] = LTC_ROL(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1); + } + + /* compress */ + /* round one */ + #define FF0(a,b,c,d,e,i) e = (LTC_ROLc(a, 5) + F0(b,c,d) + e + W[i] + 0x5a827999UL); b = LTC_ROLc(b, 30); + #define FF1(a,b,c,d,e,i) e = (LTC_ROLc(a, 5) + F1(b,c,d) + e + W[i] + 0x6ed9eba1UL); b = LTC_ROLc(b, 30); + #define FF2(a,b,c,d,e,i) e = (LTC_ROLc(a, 5) + F2(b,c,d) + e + W[i] + 0x8f1bbcdcUL); b = LTC_ROLc(b, 30); + #define FF3(a,b,c,d,e,i) e = (LTC_ROLc(a, 5) + F3(b,c,d) + e + W[i] + 0xca62c1d6UL); b = LTC_ROLc(b, 30); + +#ifdef LTC_SMALL_CODE + + for (i = 0; i < 20; ) { + FF0(a,b,c,d,e,i++); t = e; e = d; d = c; c = b; b = a; a = t; + } + + for (; i < 40; ) { + FF1(a,b,c,d,e,i++); t = e; e = d; d = c; c = b; b = a; a = t; + } + + for (; i < 60; ) { + FF2(a,b,c,d,e,i++); t = e; e = d; d = c; c = b; b = a; a = t; + } + + for (; i < 80; ) { + FF3(a,b,c,d,e,i++); t = e; e = d; d = c; c = b; b = a; a = t; + } + +#else + + for (i = 0; i < 20; ) { + FF0(a,b,c,d,e,i++); + FF0(e,a,b,c,d,i++); + FF0(d,e,a,b,c,i++); + FF0(c,d,e,a,b,i++); + FF0(b,c,d,e,a,i++); + } + + /* round two */ + for (; i < 40; ) { + FF1(a,b,c,d,e,i++); + FF1(e,a,b,c,d,i++); + FF1(d,e,a,b,c,i++); + FF1(c,d,e,a,b,i++); + FF1(b,c,d,e,a,i++); + } + + /* round three */ + for (; i < 60; ) { + FF2(a,b,c,d,e,i++); + FF2(e,a,b,c,d,i++); + FF2(d,e,a,b,c,i++); + FF2(c,d,e,a,b,i++); + FF2(b,c,d,e,a,i++); + } + + /* round four */ + for (; i < 80; ) { + FF3(a,b,c,d,e,i++); + FF3(e,a,b,c,d,i++); + FF3(d,e,a,b,c,i++); + FF3(c,d,e,a,b,i++); + FF3(b,c,d,e,a,i++); + } +#endif + + #undef FF0 + #undef FF1 + #undef FF2 + #undef FF3 + + /* store */ + ctx->state[0] = ctx->state[0] + a; + ctx->state[1] = ctx->state[1] + b; + ctx->state[2] = ctx->state[2] + c; + ctx->state[3] = ctx->state[3] + d; + ctx->state[4] = ctx->state[4] + e; + + return CRYPT_OK; +} + +#ifdef LTC_CLEAN_STACK +static int sha1_compress(ltc_sha1_ctx *ctx, const unsigned char *buf) +{ + int err; + err = _sha1_compress(ctx, buf); + + ltc_burn_stack(sizeof(ulong32) * 87); + return err; +} +#endif + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_sha1_init(ltc_sha1_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->state[0] = 0x67452301UL; + ctx->state[1] = 0xefcdab89UL; + ctx->state[2] = 0x98badcfeUL; + ctx->state[3] = 0x10325476UL; + ctx->state[4] = 0xc3d2e1f0UL; + ctx->curlen = 0; + ctx->length = 0; + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +LTC_HASH_PROCESS(ltc_sha1_process, sha1_compress, ltc_sha1_ctx, sha1, 64) + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (20 bytes) + @return CRYPT_OK if successful +*/ +int ltc_sha1_done(ltc_sha1_ctx *ctx, unsigned char *out) +{ + int i; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + /* increase the length of the message */ + ctx->length += ctx->curlen * 8; + + /* append the '1' bit */ + ctx->buf[ctx->curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (ctx->curlen > 56) { + while (ctx->curlen < 64) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + sha1_compress(ctx, ctx->buf); + ctx->curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (ctx->curlen < 56) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64H(ctx->length, ctx->buf+56); + sha1_compress(ctx, ctx->buf); + + /* copy output */ + for (i = 0; i < 5; i++) { + LTC_STORE32H(ctx->state[i], out+(4*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(md, sizeof(ltc_hash_state)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int ltc_sha1_test(void) +{ + #ifndef LTC_TEST + return CRYPT_NOP; + #else + static const struct { + const char *msg; + unsigned char hash[20]; + } tests[] = { + { "abc", + { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, + 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, + 0x9c, 0xd0, 0xd8, 0x9d } + }, + { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + { 0x84, 0x98, 0x3E, 0x44, 0x1C, 0x3B, 0xD2, 0x6E, + 0xBA, 0xAE, 0x4A, 0xA1, 0xF9, 0x51, 0x29, 0xE5, + 0xE5, 0x46, 0x70, 0xF1 } + } + }; + + int i; + unsigned char tmp[20]; + ltc_hash_state md; + + for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { + ltc_sha1_init(&md); + ltc_sha1_process(&md, (const unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); + ltc_sha1_done(&md, tmp); + if (LTC_XMEMCMP(tmp, tests[i].hash, 20) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; + #endif +} + ADDED Source/descriptors/digestDescriptors/ltc_sha1_descriptor/ltc_sha1.h Index: Source/descriptors/digestDescriptors/ltc_sha1_descriptor/ltc_sha1.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_sha1_descriptor/ltc_sha1.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_sha1.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include + +#ifndef _LTC_SHA1_H_ +#define _LTC_SHA1_H_ + +#define LTC_SHA1_HASHSIZE 20 +#define LTC_SHA1_BLOCKSIZE 64 + +// Adjusted to take the same space as CC_SHA1_CTX +// The order is important on a 64 bit system so that +// the length variable is 64 bit aligned. + +typedef struct ltc_sha1_state { + uint32_t state[5]; + uint32_t curlen; + uint64_t length; + unsigned char buf[LTC_SHA1_BLOCKSIZE]; +} ltc_sha1_ctx; + +int ltc_sha1_init(ltc_sha1_ctx *ctx); +int ltc_sha1_process(ltc_sha1_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int ltc_sha1_done(ltc_sha1_ctx *ctx, unsigned char *hash); + +#endif /* _LTC_SHA1_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha224.c Index: Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha224.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha224.c @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +/** + @param sha224.c + LTC_SHA-224 new NIST standard based off of LTC_SHA-256 truncated to 224 bits (Tom St Denis) +*/ + +const ccDescriptor ltc_sha224_desc = +{ + .implementation_info = &cc_sha224_impinfo, + .dtype.digest.hashsize = CC_SHA224_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA224_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_sha224_init, + .dtype.digest.process = <c_sha256_process, + .dtype.digest.done = <c_sha224_done, +}; + + +/* init the sha256 er... sha224 state ;-) */ +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_sha224_init(ltc_sha256_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->length = 0; + ctx->state[0] = 0xc1059ed8UL; + ctx->state[1] = 0x367cd507UL; + ctx->state[2] = 0x3070dd17UL; + ctx->state[3] = 0xf70e5939UL; + ctx->state[4] = 0xffc00b31UL; + ctx->state[5] = 0x68581511UL; + ctx->state[6] = 0x64f98fa7UL; + ctx->state[7] = 0xbefa4fa4UL; + + return CRYPT_OK; +} + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (28 bytes) + @return CRYPT_OK if successful +*/ +int ltc_sha224_done(ltc_sha256_ctx *ctx, unsigned char *out) +{ + unsigned char buf[32]; + int err; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + err = ltc_sha256_done(ctx, buf); + CC_XMEMCPY(out, buf, 28); +#ifdef LTC_CLEAN_STACK + ltc_zeromem(buf, sizeof(buf)); +#endif + return err; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int ltc_sha224_test(void) +{ + #ifndef LTC_TEST + return CRYPT_NOP; + #else + static const struct { + const char *msg; + unsigned char hash[28]; + } tests[] = { + { "abc", + { 0x23, 0x09, 0x7d, 0x22, 0x34, 0x05, 0xd8, + 0x22, 0x86, 0x42, 0xa4, 0x77, 0xbd, 0xa2, + 0x55, 0xb3, 0x2a, 0xad, 0xbc, 0xe4, 0xbd, + 0xa0, 0xb3, 0xf7, 0xe3, 0x6c, 0x9d, 0xa7 } + }, + { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + { 0x75, 0x38, 0x8b, 0x16, 0x51, 0x27, 0x76, + 0xcc, 0x5d, 0xba, 0x5d, 0xa1, 0xfd, 0x89, + 0x01, 0x50, 0xb0, 0xc6, 0x45, 0x5c, 0xb4, + 0xf5, 0x8b, 0x19, 0x52, 0x52, 0x25, 0x25 } + }, + }; + + int i; + unsigned char tmp[28]; + ltc_hash_state md; + + for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { + ltc_sha224_init(&md); + ltc_sha224_process(&md, (const unsigned char*)tests[i].msg, + (unsigned long)strlen(tests[i].msg)); + ltc_sha224_done(&md, tmp); + if (LTC_XMEMCMP(tmp, tests[i].hash, 28) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; + #endif +} ADDED Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha224.h Index: Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha224.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha224.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_sha224.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#ifndef _LTC_SHA224_H_ +#define _LTC_SHA224_H_ + +/* + * Note that ltc_sha256 is required for ltc_sha224. + */ + +#define LTC_SHA224_HASHSIZE 28 +#define LTC_SHA224_BLOCKSIZE 64 + +int ltc_sha224_init(ltc_sha256_ctx *ctx); +#define ltc_sha224_process ltc_sha256_process +int ltc_sha224_done(ltc_sha256_ctx *ctx, unsigned char *hash); +int ltc_sha224_test(void); + +#endif /* _LTC_SHA224_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha256.c Index: Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha256.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha256.c @@ -0,0 +1,403 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include +#include "ltc_sha256.h" +#include "ltc_sha224.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" + +/** + @file ltc_sha256.c + LTC_SHA256 by Tom St Denis +*/ + +const ccDescriptor ltc_sha256_desc = +{ + .implementation_info = &cc_sha256_impinfo, + .dtype.digest.hashsize = CC_SHA256_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA256_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_sha256_init, + .dtype.digest.process = <c_sha256_process, + .dtype.digest.done = <c_sha256_done, +}; + + +#ifdef LTC_SMALL_CODE +/* the K array */ +static const ulong32 K[64] = { + 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL, + 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL, + 0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, + 0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, + 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL, + 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL, + 0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, + 0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, + 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL, + 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL, + 0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, + 0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, + 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL +}; +#endif + +/* Various logical functions */ +#define Ch(x,y,z) (z ^ (x & (y ^ z))) +#define Maj(x,y,z) (((x | y) & z) | (x & y)) +#define S(x, n) LTC_RORc((x),(n)) +#define R(x, n) (((x)&0xFFFFFFFFUL)>>(n)) +#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) +#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) +#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3)) +#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) + +/* compress 512-bits */ +#ifdef LTC_CLEAN_STACK +static int _sha256_compress(ltc_sha256_ctx *ctx, const unsigned char *buf) +#else +static int sha256_compress(ltc_sha256_ctx *ctx, const unsigned char *buf) +#endif +{ + ulong32 S[8], W[64], t0, t1; +#ifdef LTC_SMALL_CODE + ulong32 t; +#endif + int i; + + /* copy state into S */ + for (i = 0; i < 8; i++) { + S[i] = ctx->state[i]; + } + + /* copy the state into 512-bits into W[0..15] */ + for (i = 0; i < 16; i++) { + LTC_LOAD32H(W[i], buf + (4*i)); + } + + /* fill W[16..63] */ + for (i = 16; i < 64; i++) { + W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]; + } + + /* Compress */ +#ifdef LTC_SMALL_CODE +#define RND(a,b,c,d,e,f,g,h,i) \ + t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \ + t1 = Sigma0(a) + Maj(a, b, c); \ + d += t0; \ + h = t0 + t1; + + for (i = 0; i < 64; ++i) { + RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i); + t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4]; + S[4] = S[3]; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t; + } +#else +#define RND(a,b,c,d,e,f,g,h,i,ki) \ + t0 = h + Sigma1(e) + Ch(e, f, g) + ki + W[i]; \ + t1 = Sigma0(a) + Maj(a, b, c); \ + d += t0; \ + h = t0 + t1; + + RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],0,0x428a2f98); + RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],1,0x71374491); + RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],2,0xb5c0fbcf); + RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],3,0xe9b5dba5); + RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],4,0x3956c25b); + RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],5,0x59f111f1); + RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],6,0x923f82a4); + RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],7,0xab1c5ed5); + RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],8,0xd807aa98); + RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],9,0x12835b01); + RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],10,0x243185be); + RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],11,0x550c7dc3); + RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],12,0x72be5d74); + RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],13,0x80deb1fe); + RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],14,0x9bdc06a7); + RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],15,0xc19bf174); + RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],16,0xe49b69c1); + RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],17,0xefbe4786); + RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],18,0x0fc19dc6); + RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],19,0x240ca1cc); + RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],20,0x2de92c6f); + RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],21,0x4a7484aa); + RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],22,0x5cb0a9dc); + RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],23,0x76f988da); + RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],24,0x983e5152); + RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],25,0xa831c66d); + RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],26,0xb00327c8); + RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],27,0xbf597fc7); + RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],28,0xc6e00bf3); + RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],29,0xd5a79147); + RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],30,0x06ca6351); + RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],31,0x14292967); + RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],32,0x27b70a85); + RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],33,0x2e1b2138); + RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],34,0x4d2c6dfc); + RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],35,0x53380d13); + RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],36,0x650a7354); + RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],37,0x766a0abb); + RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],38,0x81c2c92e); + RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],39,0x92722c85); + RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],40,0xa2bfe8a1); + RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],41,0xa81a664b); + RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],42,0xc24b8b70); + RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],43,0xc76c51a3); + RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],44,0xd192e819); + RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],45,0xd6990624); + RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],46,0xf40e3585); + RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],47,0x106aa070); + RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],48,0x19a4c116); + RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],49,0x1e376c08); + RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],50,0x2748774c); + RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],51,0x34b0bcb5); + RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],52,0x391c0cb3); + RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],53,0x4ed8aa4a); + RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],54,0x5b9cca4f); + RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],55,0x682e6ff3); + RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],56,0x748f82ee); + RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],57,0x78a5636f); + RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],58,0x84c87814); + RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],59,0x8cc70208); + RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],60,0x90befffa); + RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],61,0xa4506ceb); + RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],62,0xbef9a3f7); + RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],63,0xc67178f2); + +#undef RND + +#endif + + /* feedback */ + for (i = 0; i < 8; i++) { + ctx->state[i] = ctx->state[i] + S[i]; + } + return CRYPT_OK; +} + +#ifdef LTC_CLEAN_STACK +static int sha256_compress(ltc_sha256_ctx *ctx, const unsigned char *buf) +{ + int err; + err = _sha256_compress(ctx, buf); + + ltc_burn_stack(sizeof(ulong32) * 74); + return err; +} +#endif + +#define FULLLENGTH_MASK 0xffffffffffffffc0 +#define BUFFLENGTH_MASK 0x3f + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_sha256_init(ltc_sha256_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->length = 0; + ctx->state[0] = 0x6A09E667UL; + ctx->state[1] = 0xBB67AE85UL; + ctx->state[2] = 0x3C6EF372UL; + ctx->state[3] = 0xA54FF53AUL; + ctx->state[4] = 0x510E527FUL; + ctx->state[5] = 0x9B05688CUL; + ctx->state[6] = 0x1F83D9ABUL; + ctx->state[7] = 0x5BE0CD19UL; + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +// LTC_HASH_PROCESS(ltc_sha256_process, sha256_compress, ltc_sha256_ctx, sha256, 64) +int ltc_sha256_process(ltc_sha256_ctx *ctx, const unsigned char *in, unsigned long inlen) +{ + unsigned long n; + int err; + int fullblocks, remainder, processed, i; + uint64_t curlen; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(in != NULL); + + curlen = ctx->length & BUFFLENGTH_MASK; + + if ((ctx->length + inlen) < ctx->length) { + return CRYPT_HASH_OVERFLOW; + } + + while (inlen > 0) { + if (curlen == 0 && inlen >= LTC_SHA256_BLOCKSIZE) { + fullblocks = inlen / LTC_SHA256_BLOCKSIZE; + remainder = inlen % LTC_SHA256_BLOCKSIZE; + processed = fullblocks * LTC_SHA256_BLOCKSIZE; + for(i=0; i< fullblocks; i++) { + sha256_compress (ctx, in); + in += LTC_SHA256_BLOCKSIZE; + } + ctx->length += LTC_SHA256_BLOCKSIZE * 8 * fullblocks; + inlen -= processed; + } else { + n = MIN(inlen, (LTC_SHA256_BLOCKSIZE - curlen)); + memcpy(ctx->buf + curlen, in, (size_t)n); + curlen += n; in += n; inlen -= n; + if (curlen == LTC_SHA256_BLOCKSIZE) { + sha256_compress (ctx, ctx->buf); + ctx->length += 8*LTC_SHA256_BLOCKSIZE; + curlen = 0; + } + } + } + + ctx->length = (ctx->length & FULLLENGTH_MASK) + curlen; + + return CRYPT_OK; +} + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (32 bytes) + @return CRYPT_OK if successful +*/ +int ltc_sha256_done(ltc_sha256_ctx *ctx, unsigned char *out) +{ + int i; + uint64_t curlen; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + curlen = ctx->length & BUFFLENGTH_MASK; + ctx->length &= FULLLENGTH_MASK; + + + /* increase the length of the message */ + ctx->length += curlen * 8; + + /* append the '1' bit */ + ctx->buf[curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (curlen > 56) { + while (curlen < 64) { + ctx->buf[curlen++] = (unsigned char)0; + } + sha256_compress(ctx, ctx->buf); + curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (curlen < 56) { + ctx->buf[curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64H(ctx->length, ctx->buf+56); + sha256_compress(ctx, ctx->buf); + + /* copy output */ + for (i = 0; i < 8; i++) { + LTC_STORE32H(ctx->state[i], out+(4*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(ctx, sizeof(hash_state)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int ltc_sha256_test(void) +{ + #ifndef LTC_TEST + return CRYPT_NOP; + #else + static const struct { + const char *msg; + unsigned char hash[32]; + } tests[] = { + { "abc", + { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, + 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, + 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, + 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad } + }, + { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8, + 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39, + 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67, + 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 } + }, + }; + + int i; + unsigned char tmp[32]; + ltc_hash_state md; + + for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { + ltc_sha256_init(&md); + ltc_sha256_process(&md, (const unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); + ltc_sha256_done(&md, tmp); + if (LTC_XMEMCMP(tmp, tests[i].hash, 32) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; + #endif +} + +#include "ltc_sha224.c" + ADDED Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha256.h Index: Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha256.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha256.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_sha256.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include + +#ifndef _LTC_SHA256_H_ +#define _LTC_SHA256_H_ + +#define LTC_SHA256_HASHSIZE 32 +#define LTC_SHA256_BLOCKSIZE 64 + +typedef struct ltc_sha256_state { + uint64_t length; + uint32_t state[8]; + unsigned char buf[LTC_SHA256_BLOCKSIZE]; +} ltc_sha256_ctx; + +int ltc_sha256_init(ltc_sha256_ctx *ctx); +int ltc_sha256_process(ltc_sha256_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int ltc_sha256_done(ltc_sha256_ctx *ctx, unsigned char *hash); + +#endif /* _LTC_SHA256_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha384.c Index: Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha384.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha384.c @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +/** + @param sha384.c + LTC_SHA384 hash included in sha512.c, Tom St Denis +*/ + +const ccDescriptor ltc_sha384_desc = +{ + .implementation_info = &cc_sha384_impinfo, + .dtype.digest.hashsize = CC_SHA384_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA384_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_sha384_init, + .dtype.digest.process = <c_sha512_process, + .dtype.digest.done = <c_sha384_done, +}; + + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_sha384_init(ltc_sha512_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->curlen = 0; + ctx->length = 0; + ctx->state[0] = LTC_CONST64(0xcbbb9d5dc1059ed8); + ctx->state[1] = LTC_CONST64(0x629a292a367cd507); + ctx->state[2] = LTC_CONST64(0x9159015a3070dd17); + ctx->state[3] = LTC_CONST64(0x152fecd8f70e5939); + ctx->state[4] = LTC_CONST64(0x67332667ffc00b31); + ctx->state[5] = LTC_CONST64(0x8eb44a8768581511); + ctx->state[6] = LTC_CONST64(0xdb0c2e0d64f98fa7); + ctx->state[7] = LTC_CONST64(0x47b5481dbefa4fa4); + + return CRYPT_OK; +} + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (48 bytes) + @return CRYPT_OK if successful +*/ +int ltc_sha384_done(ltc_sha512_ctx *ctx, unsigned char *out) +{ + unsigned char buf[64]; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + ltc_sha512_done(ctx, buf); + CC_XMEMCPY(out, buf, 48); +#ifdef LTC_CLEAN_STACK + ltc_zeromem(buf, sizeof(buf)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int ltc_sha384_test(void) +{ + #ifndef LTC_TEST + return CRYPT_NOP; + #else + static const struct { + const char *msg; + unsigned char hash[48]; + } tests[] = { + { "abc", + { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b, + 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07, + 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63, + 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed, + 0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23, + 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7 } + }, + { "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", + { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8, + 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47, + 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2, + 0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12, + 0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9, + 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39 } + }, + }; + + int i; + unsigned char tmp[48]; + ltc_hash_state md; + + for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { + ltc_sha384_init(&md); + ltc_sha384_process(&md, (const unsigned char*)tests[i].msg, + (unsigned long)strlen(tests[i].msg)); + ltc_sha384_done(&md, tmp); + if (LTC_XMEMCMP(tmp, tests[i].hash, 48) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; + #endif +} ADDED Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha384.h Index: Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha384.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha384.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_sha384.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#ifndef _LTC_SHA384_H_ +#define _LTC_SHA384_H_ + +/* + * Note that ltc_sha512 is required for ltc_sha384. + */ + +#define LTC_SHA384_HASHSIZE 48 +#define LTC_SHA384_BLOCKSIZE 128 + +int ltc_sha384_init(ltc_sha512_ctx *ctx); +#define ltc_sha384_process ltc_sha512_process +int ltc_sha384_done(ltc_sha512_ctx *ctx, unsigned char *hash); + +#endif /* _LTC_SHA384_H_ */ ADDED Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha512.c Index: Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha512.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha512.c @@ -0,0 +1,337 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include +#include "ltc_sha512.h" +#include "ltc_sha384.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" + +/** + @param ltc_sha512.c + LTC_SHA512 by Tom St Denis +*/ + +const ccDescriptor ltc_sha512_desc = +{ + .implementation_info = &cc_sha512_impinfo, + .dtype.digest.hashsize = CC_SHA512_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA512_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = <c_sha512_init, + .dtype.digest.process = <c_sha512_process, + .dtype.digest.done = <c_sha512_done, +}; + + +/* the K array */ +static const ulong64 K[80] = { +LTC_CONST64(0x428a2f98d728ae22), LTC_CONST64(0x7137449123ef65cd), +LTC_CONST64(0xb5c0fbcfec4d3b2f), LTC_CONST64(0xe9b5dba58189dbbc), +LTC_CONST64(0x3956c25bf348b538), LTC_CONST64(0x59f111f1b605d019), +LTC_CONST64(0x923f82a4af194f9b), LTC_CONST64(0xab1c5ed5da6d8118), +LTC_CONST64(0xd807aa98a3030242), LTC_CONST64(0x12835b0145706fbe), +LTC_CONST64(0x243185be4ee4b28c), LTC_CONST64(0x550c7dc3d5ffb4e2), +LTC_CONST64(0x72be5d74f27b896f), LTC_CONST64(0x80deb1fe3b1696b1), +LTC_CONST64(0x9bdc06a725c71235), LTC_CONST64(0xc19bf174cf692694), +LTC_CONST64(0xe49b69c19ef14ad2), LTC_CONST64(0xefbe4786384f25e3), +LTC_CONST64(0x0fc19dc68b8cd5b5), LTC_CONST64(0x240ca1cc77ac9c65), +LTC_CONST64(0x2de92c6f592b0275), LTC_CONST64(0x4a7484aa6ea6e483), +LTC_CONST64(0x5cb0a9dcbd41fbd4), LTC_CONST64(0x76f988da831153b5), +LTC_CONST64(0x983e5152ee66dfab), LTC_CONST64(0xa831c66d2db43210), +LTC_CONST64(0xb00327c898fb213f), LTC_CONST64(0xbf597fc7beef0ee4), +LTC_CONST64(0xc6e00bf33da88fc2), LTC_CONST64(0xd5a79147930aa725), +LTC_CONST64(0x06ca6351e003826f), LTC_CONST64(0x142929670a0e6e70), +LTC_CONST64(0x27b70a8546d22ffc), LTC_CONST64(0x2e1b21385c26c926), +LTC_CONST64(0x4d2c6dfc5ac42aed), LTC_CONST64(0x53380d139d95b3df), +LTC_CONST64(0x650a73548baf63de), LTC_CONST64(0x766a0abb3c77b2a8), +LTC_CONST64(0x81c2c92e47edaee6), LTC_CONST64(0x92722c851482353b), +LTC_CONST64(0xa2bfe8a14cf10364), LTC_CONST64(0xa81a664bbc423001), +LTC_CONST64(0xc24b8b70d0f89791), LTC_CONST64(0xc76c51a30654be30), +LTC_CONST64(0xd192e819d6ef5218), LTC_CONST64(0xd69906245565a910), +LTC_CONST64(0xf40e35855771202a), LTC_CONST64(0x106aa07032bbd1b8), +LTC_CONST64(0x19a4c116b8d2d0c8), LTC_CONST64(0x1e376c085141ab53), +LTC_CONST64(0x2748774cdf8eeb99), LTC_CONST64(0x34b0bcb5e19b48a8), +LTC_CONST64(0x391c0cb3c5c95a63), LTC_CONST64(0x4ed8aa4ae3418acb), +LTC_CONST64(0x5b9cca4f7763e373), LTC_CONST64(0x682e6ff3d6b2b8a3), +LTC_CONST64(0x748f82ee5defb2fc), LTC_CONST64(0x78a5636f43172f60), +LTC_CONST64(0x84c87814a1f0ab72), LTC_CONST64(0x8cc702081a6439ec), +LTC_CONST64(0x90befffa23631e28), LTC_CONST64(0xa4506cebde82bde9), +LTC_CONST64(0xbef9a3f7b2c67915), LTC_CONST64(0xc67178f2e372532b), +LTC_CONST64(0xca273eceea26619c), LTC_CONST64(0xd186b8c721c0c207), +LTC_CONST64(0xeada7dd6cde0eb1e), LTC_CONST64(0xf57d4f7fee6ed178), +LTC_CONST64(0x06f067aa72176fba), LTC_CONST64(0x0a637dc5a2c898a6), +LTC_CONST64(0x113f9804bef90dae), LTC_CONST64(0x1b710b35131c471b), +LTC_CONST64(0x28db77f523047d84), LTC_CONST64(0x32caab7b40c72493), +LTC_CONST64(0x3c9ebe0a15c9bebc), LTC_CONST64(0x431d67c49c100d4c), +LTC_CONST64(0x4cc5d4becb3e42b6), LTC_CONST64(0x597f299cfc657e2a), +LTC_CONST64(0x5fcb6fab3ad6faec), LTC_CONST64(0x6c44198c4a475817) +}; + +/* Various logical functions */ +#define Ch(x,y,z) (z ^ (x & (y ^ z))) +#define Maj(x,y,z) (((x | y) & z) | (x & y)) +#define S(x, n) LTC_ROR64c(x, n) +#define R(x, n) (((x) & LTC_CONST64(0xFFFFFFFFFFFFFFFF) )>>((ulong64)n)) +#define Sigma0(x) (S(x, 28) ^ S(x, 34) ^ S(x, 39)) +#define Sigma1(x) (S(x, 14) ^ S(x, 18) ^ S(x, 41)) +#define Gamma0(x) (S(x, 1) ^ S(x, 8) ^ R(x, 7)) +#define Gamma1(x) (S(x, 19) ^ S(x, 61) ^ R(x, 6)) + +/* compress 1024-bits */ +#ifdef LTC_CLEAN_STACK +static int _sha512_compress(ltc_sha512_ctx *ctx, const unsigned char *buf) +#else +static int sha512_compress(ltc_sha512_ctx *ctx, const unsigned char *buf) +#endif +{ + ulong64 S[8], W[80], t0, t1; + int i; + + /* copy state into S */ + for (i = 0; i < 8; i++) { + S[i] = ctx->state[i]; + } + + /* copy the state into 1024-bits into W[0..15] */ + for (i = 0; i < 16; i++) { + LTC_LOAD64H(W[i], buf + (8*i)); + } + + /* fill W[16..79] */ + for (i = 16; i < 80; i++) { + W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]; + } + + /* Compress */ +#ifdef LTC_SMALL_CODE + for (i = 0; i < 80; i++) { + t0 = S[7] + Sigma1(S[4]) + Ch(S[4], S[5], S[6]) + K[i] + W[i]; + t1 = Sigma0(S[0]) + Maj(S[0], S[1], S[2]); + S[7] = S[6]; + S[6] = S[5]; + S[5] = S[4]; + S[4] = S[3] + t0; + S[3] = S[2]; + S[2] = S[1]; + S[1] = S[0]; + S[0] = t0 + t1; + } +#else +#define RND(a,b,c,d,e,f,g,h,i) \ + t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \ + t1 = Sigma0(a) + Maj(a, b, c); \ + d += t0; \ + h = t0 + t1; + + for (i = 0; i < 80; i += 8) { + RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i+0); + RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],i+1); + RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],i+2); + RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],i+3); + RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],i+4); + RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],i+5); + RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],i+6); + RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],i+7); + } +#endif + + + /* feedback */ + for (i = 0; i < 8; i++) { + ctx->state[i] = ctx->state[i] + S[i]; + } + + return CRYPT_OK; +} + +/* compress 1024-bits */ +#ifdef LTC_CLEAN_STACK +static int sha512_compress(ltc_sha512_ctx *ctx, const unsigned char *buf) +{ + int err; + err = _sha512_compress(md, buf); + + ltc_burn_stack(sizeof(ulong64) * 90 + sizeof(int)); + return err; +} +#endif + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int ltc_sha512_init(ltc_sha512_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->curlen = 0; + ctx->length = 0; + ctx->state[0] = LTC_CONST64(0x6a09e667f3bcc908); + ctx->state[1] = LTC_CONST64(0xbb67ae8584caa73b); + ctx->state[2] = LTC_CONST64(0x3c6ef372fe94f82b); + ctx->state[3] = LTC_CONST64(0xa54ff53a5f1d36f1); + ctx->state[4] = LTC_CONST64(0x510e527fade682d1); + ctx->state[5] = LTC_CONST64(0x9b05688c2b3e6c1f); + ctx->state[6] = LTC_CONST64(0x1f83d9abfb41bd6b); + ctx->state[7] = LTC_CONST64(0x5be0cd19137e2179); + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +LTC_HASH_PROCESS(ltc_sha512_process, sha512_compress, ltc_sha512_ctx, sha512, 128) + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (64 bytes) + @return CRYPT_OK if successful +*/ +int ltc_sha512_done(ltc_sha512_ctx *ctx, unsigned char *out) +{ + int i; + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + /* increase the length of the message */ + ctx->length += ctx->curlen * LTC_CONST64(8); + + /* append the '1' bit */ + ctx->buf[ctx->curlen++] = (unsigned char)0x80; + + /* if the length is currently above 112 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (ctx->curlen > 112) { + while (ctx->curlen < 128) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + sha512_compress(ctx, ctx->buf); + ctx->curlen = 0; + } + + /* pad upto 120 bytes of zeroes + * note: that from 112 to 120 is the 64 MSB of the length. We assume that + * you won't hash > 2^64 bits of data... :-) + */ + while (ctx->curlen < 120) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64H(ctx->length, ctx->buf+120); + sha512_compress(ctx, ctx->buf); + + /* copy output */ + for (i = 0; i < 8; i++) { + LTC_STORE64H(ctx->state[i], out+(8*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(md, sizeof(hash_state)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int ltc_sha512_test(void) +{ + #ifndef LTC_TEST + return CRYPT_NOP; + #else + static const struct { + const char *msg; + unsigned char hash[64]; + } tests[] = { + { "abc", + { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, + 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31, + 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, + 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a, + 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, + 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd, + 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, + 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f } + }, + { "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", + { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda, + 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f, + 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1, + 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18, + 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4, + 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a, + 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54, + 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09 } + }, + }; + + int i; + unsigned char tmp[64]; + ltc_hash_state md; + + for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { + ltc_sha512_init(&md); + ltc_sha512_process(&md, (const unsigned char *)tests[i].msg, + (unsigned long)strlen(tests[i].msg)); + ltc_sha512_done(&md, tmp); + if (LTC_XMEMCMP(tmp, tests[i].hash, 64) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; + #endif +} + +#include "ltc_sha384.c" + ADDED Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha512.h Index: Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha512.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/ltc_sha2_descriptor/ltc_sha512.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * ltc_sha512.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include +#ifndef _LTC_SHA512_H_ +#define _LTC_SHA512_H_ + +#define LTC_SHA512_HASHSIZE 64 +#define LTC_SHA512_BLOCKSIZE 128 + +typedef struct ltc_sha512_state { + uint64_t length, curlen; + uint64_t state[8]; + unsigned char buf[LTC_SHA512_BLOCKSIZE]; +} ltc_sha512_ctx; + +int ltc_sha512_init(ltc_sha512_ctx *ctx); +int ltc_sha512_process(ltc_sha512_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int ltc_sha512_done(ltc_sha512_ctx *ctx, unsigned char *hash); +int ltc_sha512_test(void); + +#endif /* _LTC_SHA512_H_ */ ADDED Source/descriptors/digestDescriptors/vng_neon_sha1_descriptor/vng_neon_sha1.c Index: Source/descriptors/digestDescriptors/vng_neon_sha1_descriptor/vng_neon_sha1.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_neon_sha1_descriptor/vng_neon_sha1.c @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ + +#include + +#if defined(_ARM_ARCH_7) + +#include +#include "vng_neon_sha1.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" + +/** + @file vng_neon_sha1.c + original LTC_SHA1 code by Tom St Denis + optimized compress function by the Vector and Numerics Group +*/ + + +const ccDescriptor vng_neon_sha1_desc = +{ + .implementation_info = &cc_sha1_impinfo, + .dtype.digest.hashsize = CC_SHA1_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA1_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = &vng_neon_sha1_init, + .dtype.digest.process = &vng_neon_sha1_process, + .dtype.digest.done = &vng_neon_sha1_done, +}; + + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int vng_neon_sha1_init(vng_neon_sha1_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->state[0] = 0x67452301UL; + ctx->state[1] = 0xefcdab89UL; + ctx->state[2] = 0x98badcfeUL; + ctx->state[3] = 0x10325476UL; + ctx->state[4] = 0xc3d2e1f0UL; + ctx->curlen = 0; + ctx->length = 0; + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +int vng_neon_sha1_process(vng_neon_sha1_ctx *ctx, const unsigned char *in, unsigned long inlen) +{ + unsigned long n; + int err; + int fullblocks, remainder, processed; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(in != NULL); + + if (ctx->curlen > sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + if ((ctx->length + inlen) < ctx->length) { + return CRYPT_HASH_OVERFLOW; + } + + while (inlen > 0) { + if (ctx->curlen == 0 && inlen >= VNG_NEON_SHA1_BLOCKSIZE && CC_XALIGNED(in, 4)) { + fullblocks = inlen / VNG_NEON_SHA1_BLOCKSIZE; + remainder = inlen % VNG_NEON_SHA1_BLOCKSIZE; + processed = fullblocks * VNG_NEON_SHA1_BLOCKSIZE; + sha1_vng_armv7neon_compress (ctx->state, fullblocks, in); + ctx->length += VNG_NEON_SHA1_BLOCKSIZE * 8 * fullblocks; + in += processed; + inlen -= processed; + } else { + n = MIN(inlen, (VNG_NEON_SHA1_BLOCKSIZE - ctx->curlen)); + memcpy(ctx->buf + ctx->curlen, in, (size_t)n); + ctx->curlen += n; in += n; inlen -= n; + if (ctx->curlen == VNG_NEON_SHA1_BLOCKSIZE) { + sha1_vng_armv7neon_compress (ctx->state, 1, ctx->buf); + ctx->length += 8*VNG_NEON_SHA1_BLOCKSIZE; + ctx->curlen = 0; + } + } + } + + return CRYPT_OK; +} + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (20 bytes) + @return CRYPT_OK if successful +*/ +int vng_neon_sha1_done(vng_neon_sha1_ctx *ctx, unsigned char *out) +{ + int i; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + /* increase the length of the message */ + ctx->length += ctx->curlen * 8; + + /* append the '1' bit */ + ctx->buf[ctx->curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (ctx->curlen > 56) { + while (ctx->curlen < 64) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + sha1_vng_armv7neon_compress(ctx->state, 1, ctx->buf); + ctx->curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (ctx->curlen < 56) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64H(ctx->length, ctx->buf+56); + sha1_vng_armv7neon_compress(ctx->state, 1, ctx->buf); + + /* copy output */ + for (i = 0; i < 5; i++) { + LTC_STORE32H(ctx->state[i], out+(4*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(md, sizeof(ltc_hash_state)); +#endif + return CRYPT_OK; +} + +/** + Self-test the hash + @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled +*/ +int vng_neon_test(void) +{ + #ifndef LTC_TEST + return CRYPT_NOP; + #else + static const struct { + const char *msg; + unsigned char hash[20]; + } tests[] = { + { "abc", + { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, + 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, + 0x9c, 0xd0, 0xd8, 0x9d } + }, + { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + { 0x84, 0x98, 0x3E, 0x44, 0x1C, 0x3B, 0xD2, 0x6E, + 0xBA, 0xAE, 0x4A, 0xA1, 0xF9, 0x51, 0x29, 0xE5, + 0xE5, 0x46, 0x70, 0xF1 } + } + }; + + int i; + unsigned char tmp[20]; + ltc_hash_state md; + + for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { + vng_neon_sha1_init(&md); + vng_neon_sha1_process(&md, (const unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); + vng_neon_sha1_done(&md, tmp); + if (LTC_XMEMCMP(tmp, tests[i].hash, 20) != 0) { + return CRYPT_FAIL_TESTVECTOR; + } + } + return CRYPT_OK; + #endif +} + +#endif /* _ARM_ARCH_7 */ ADDED Source/descriptors/digestDescriptors/vng_neon_sha1_descriptor/vng_neon_sha1.h Index: Source/descriptors/digestDescriptors/vng_neon_sha1_descriptor/vng_neon_sha1.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_neon_sha1_descriptor/vng_neon_sha1.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * vng_neon_sha1.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include +#include + +#if defined(_ARM_ARCH_7) + +#ifndef _VNG_NEON_SHA1_H_ +#define _VNG_NEON_SHA1_H_ + +#define VNG_NEON_SHA1_HASHSIZE 20 +#define VNG_NEON_SHA1_BLOCKSIZE 64 + +typedef struct vng_neon_sha1_state { + uint32_t state[5]; + uint64_t length; + unsigned char buf[VNG_NEON_SHA1_BLOCKSIZE]; + int curlen; +} vng_neon_sha1_ctx; + +int vng_neon_sha1_init(vng_neon_sha1_ctx *ctx); +int vng_neon_sha1_process(vng_neon_sha1_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int vng_neon_sha1_done(vng_neon_sha1_ctx *ctx, unsigned char *hash); +void sha1_vng_armv7neon_compress(uint32_t state[], unsigned long nblocks, unsigned char *); +#endif /* _ARM_ARCH_7 */ +#endif /* _VNG_NEON_SHA1_H_ */ + ADDED Source/descriptors/digestDescriptors/vng_neon_sha1_descriptor/vng_neon_sha1Compress.s Index: Source/descriptors/digestDescriptors/vng_neon_sha1_descriptor/vng_neon_sha1Compress.s ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_neon_sha1_descriptor/vng_neon_sha1Compress.s @@ -0,0 +1,1593 @@ +/* + + This file is copied from xnu-1776 (sha1armv7neon.s) and renamed to the current name to replace + a buggy version (based on an earlier version I sent to murf (and eventually to Fabrice). + It improves the sha1 performance slightly (8.3 to 7.5 cycles/byte), and also fixes a + compiled-off vpop/vpush bug (compiled only for kernel code). + + The problem with the earlier code that murf/Fabrice was working on is that + the order of the 2nd and 3rd calling arguments are switched. (r1/r2). + While the internal code uses r1 as an temp register, simply changing the order will have the + number of blocks corrupted with temp variable. + + This is fixed by staying with the original order (r0/r1/r2) = (out/in/blocks), and + have r1/r2 switched the 1st thing the subroutine is called. + + I ran the test to verify this fixes the bug. + + cclee 1-13-11 + + sha1armv7neon.s : this file provides optimized armv7+neon implementation of the sha1 function + CoreOS - vector & numerics group + cclee 10-10-10 + + The implementation is based on the principle described in an Intel online article + "Improving the Performance of the Secure Hash Algorithm (SHA-1)" + http://software.intel.com/en-us/articles/improving-the-performance-of-the-secure-hash-algorithm-1/ + + Update HASH[] by processing a one 64-byte block in MESSAGE[] can be represented by the following C function + +void SHA1( int HASH[], int MESSAGE[] ) +{ + int A[81], B[81], C[81], D[81], E[81]; + int W[80]; + int i, FN; + + A[0] = HASH[0]; B[0] = HASH[1]; C[0] = HASH[2]; D[0] = HASH[3]; E[0] = HASH[4]; + + for ( i=0; i<80; ++i ) { + if ( i < 16 ) + W[i] = BIG_ENDIAN_LOAD( MESSAGE[i] ); + else + W[i] = ROTATE_LEFT( W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1 ); + + FN = F( i, B[i], C[i], D[i] ); + A[i+1] = FN + E[i] + ROTATE_LEFT( A[i], 5 ) + W[i] + K(i); + B[i+1] = A[i]; + C[i+1] = ROTATE_LEFT( B[i], 30 ); + D[i+1] = C[i]; + E[i+1] = D[i]; + } + + HASH[0] += A[80]; HASH[1] += B[80]; HASH[2] += C[80]; HASH[3] += D[80]; HASH[4] += E[80]; +} + + + For i=0:15, W[i] is simply big-endian loading of MESSAGE[i]. + For i=16:79, W[i] is updated according to W[i] = ROTATE_LEFT( W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1 ); + + The approach (by Dean Gaudet) can be used to vectorize the computation of W[i] for i=16:79, + + 1. update 4 consequtive W[i] (stored in a single 16-byte register) + W[i ] = (W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]) rol 1 + W[i+1] = (W[i-2] ^ W[i-7] ^ W[i-13] ^ W[i-15]) rol 1 + W[i+2] = (W[i-1] ^ W[i-6] ^ W[i-12] ^ W[i-14]) rol 1 + W[i+3] = ( 0 ^ W[i-5] ^ W[i-11] ^ W[i-13]) rol 1 + + 2. this additional calculation unfortunately requires many additional operations + W[i+3] ^= W[i] rol 1 + + 3. once we have 4 W[i] values in a Q register, we can also add four K values with one instruction + W[i:i+3] += {K,K,K,K} + + Let W0 = {W[i] W[i+1] W[i+2] W[i+3]} be the current W-vector to be computed, + W4 = {W[i-4] W[i-3] W[i-2] W[i-1]} be the previous vector, and so on + + The Dean Gaudet approach can be expressed as + + 1. W0 = rotate_left(left_shift(W4,32) ^ W8 ^ left_shift(concatenate(W16,W12),64) ^ W16,1); + 2. W[i+3] ^= W[i] rol 1 + 3. W0 += {K,K,K,K} + + For i>=32, the Intel online article suggests that (using a basic identity (X rol 1) rol 1 = X rol 2) + the update equation is equivalent to + + 1. W0 = rotate_left(left_shift(concatenate(W8,W4),64) ^ W16 ^ W28 ^ W32, 2); + + Note: + 1. In total, we need 8 16-byte registers or memory for W0,W4,...,W28. W0 and W32 can be the same register or memory. + 2. The registers are used in a circular buffering mode. For example, we start with W28,W24,...,W0 + (with W0 indicating the most recent 16-byte) + i=0, W28,W24,...,W0 + i=4, W24,W20,...,W28 + i=8, W20,W16,...,W24 + . + . + and so forth. + 3. once W-vector is computed, W+K is then computed and saved in the stack memory, this will be used later when + updating the digests A/B/C/D/E + + the execution flow (for 1 single 64-byte block) looks like + + W_PRECALC_00_15 // big-endian loading of 64-bytes into 4 W-vectors, compute WK=W+K, save WK in the stack memory + + W_PRECALC_16_31 // for each vector, update digests, update W (Gaudet) and WK=W+K, save WK in the stack memory + + W_PRECALC_32_79 // for each vector, update digests, update W (Intel) and WK=W+K, save WK in the stack memory + + our implementation (allows multiple blocks per call) pipelines the loading of W/WK of a future block + into the last 16 rounds of its previous block: + + ---------------------------------------------------------------------------------------------------------- + + load W(0:15) (big-endian per 4 bytes) into 4 Q registers + pre_calculate and store WK = W+K(0:15) in 16-byte aligned stack memory + +L_loop: + + load digests a-e from ctx->state; + + for (r=0;r<16;r+=4) { + digests a-e update and permute round r:r+3 + update W([r:r+3]%16) (Gaudet) and WK([r:r+3]%16) for the next 4th iteration + } + + for (r=16;r<64;r+=4) { + digests a-e update and permute round r:r+3 + update W([r:r+3]%16) (Intel) and WK([r:r+3]%16) for the next 4th iteration + } + + num_block--; + if (num_block==0) jmp L_last_block; + + for (r=64;r<80;r+=4) { + digests a-e update and permute round r:r+3 + load W([r:r+3]%16) (big-endian per 4 bytes) into 4 Q registers + pre_calculate and store W+K([r:r+3]%16) in stack + } + + ctx->states += digests a-e; + + jmp L_loop; + +L_last_block: + + for (r=64;r<80;r+=4) { + digests a-e update and permute round r:r+3 + } + + ctx->states += digests a-e; + + + ---------------------------------------------------------------------------------------------------------- + +*/ + +#include + +#if defined(_ARM_ARCH_7) + +#define OPTIMIZED 1 // defined OPTIMIZED to use our final optimized assembly code +#define Multiple_Blocks 1 // defined Multiple_Blocks to allow performing multiple blocks sha1 computation per call + // i.e., change to prototype to void SHA1( int HASH[], int MESSAGE[], int num_blocks ); + +// symbolizing all used variables + +#define ctx r0 // SHA1_CTX *ctx; +#define buf r1 // char *MESSAGE[]; +#define num_blocks r2 // int num_blocks; this is used only if Multiple_Blocks is defined. + +#define K_BASE r3 // to point to the tables for K +#define HASH_PTR r4 // copy of ctx, to release r0 for other usage +#define BUFFER_PTR r5 // copy of buf, to release r1 for other usage + +// sha1 digests a-e +#define A r6 +#define B r8 +#define C r9 +#define D r10 +#define E r11 + +// temp variables +#define T1 r0 +#define T2 r1 + +// used Q registers +#define W_TMP q12 +#define W_TMP2 q13 +#define ZERO q14 +#define K_VALUES q15 +#define W0 q4 +#define W4 q5 +#define W8 q6 +#define W12 q7 +#define W16 q8 +#define W20 q9 +#define W24 q10 +#define W28 q11 + +// for round t (0:79), W+K was previously saved in the stack space, and can be referenced by +#define WK(t) [sp, #((t&15)*4)] + + + + // ----------- macros for initial rounds 0:15 big-endian loading of message[] and saving W+K into stack --------- + + .macro W_PRECALC_00_15_0 // default : BUFFER_PTR points to the current message block + vld1.f32 {W_TMP},[BUFFER_PTR]! // loading 16-byte message[] (16-byte aligned) into W_TMP + .endm + + .macro W_PRECALC_00_15_1 // input $0 : current 16-bytes in the circular buffer + vrev32.8 $0, W_TMP // byte swap W_TMP and save to $0 + .endm + + .macro W_PRECALC_00_15_2 // $0 = W, K_VALUES = (K,K,K,K) + vadd.s32 W_TMP, $0, K_VALUES // W_TMP = W + K + .endm + + .macro W_PRECALC_00_15_3 // default : lr points to the 16-byte aligned memory to store W+K + vst1.s32 {W_TMP}, [lr,:128]! // save W[i]+K in 16-byte aligned stack memory + .endm + + .macro INITIAL_W_PRECALC + + vld1.s32 {K_VALUES}, [K_BASE,:128]! // loading K values into a Q register + + // W28,W24,....,W4,W0 is used as memory in a circular buffer. They are listed in forward order from left to right. + // The last one, e.g., W0=W[0], is the current 4 .long (4-bytes) register. W4 = W[-4]. W28 = W[-28]. + // After a circular buffer rotation, W28 = W[0], W0 = W[-4], W4 = W[-8] and so forth. + +#if !OPTIMIZED + + // proliferate the code using the above 4 macros + // at this point, lr = sp (16-bytes aligned), K_VALUES dupped with K, NUFFER_PTR points to the current message[] + + // i=0 + // circular buffer : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_00_15_0 // W_TMP = (BUFFER_PTR) + W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W[0] = W_TMP + W_PRECALC_00_15_2 W0 // W_TMP = W[0] + K[0] + W_PRECALC_00_15_3 // (sp) = W_TMP = W[0] + K[0] + + // i=4 + // circular buffer : W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_00_15_0 // W_TMP = 16(BUFFER_PTR) + W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W[0] = W_TMP + W_PRECALC_00_15_2 W28 // W_TMP = W[0] + K[0] + W_PRECALC_00_15_3 // 16(sp) = W_TMP = W[0] + K[0] + + // i=8 + // circular buffer : W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_00_15_0 // W_TMP = 32(BUFFER_PTR) + W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W[0] = W_TMP + W_PRECALC_00_15_2 W24 // W_TMP = W[0] + K[0] + W_PRECALC_00_15_3 // 32(sp) = W_TMP = W[0] + K[0] + + // i=12 + // circular buffer : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_00_15_0 // W_TMP = 48(BUFFER_PTR) + W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W[0] = W_TMP + W_PRECALC_00_15_2 W20 // W_TMP = W[0] + K[0] + W_PRECALC_00_15_3 // 48(sp) = W_TMP = W[0] + K[0] + +#else + + // the following performs the same task, using less instructions (and slightly fewer CPU cycles) + //the code uses W4 W8 temporarily, with no harm + + vld1.f32 {W_TMP,W_TMP2},[BUFFER_PTR]! + vld1.f32 {W4,W8},[BUFFER_PTR]! + vrev32.8 W0, W_TMP + vrev32.8 W28, W_TMP2 + vrev32.8 W24, W4 + vrev32.8 W20, W8 + vadd.s32 W_TMP, W0, K_VALUES + vadd.s32 W_TMP2, W28, K_VALUES + vadd.s32 W4, W24, K_VALUES + vadd.s32 W8, W20, K_VALUES + vst1.s32 {W_TMP,W_TMP2}, [lr,:128]! // save W[i]+K(i) in stack memory + vst1.s32 {W4,W8}, [lr,:128]! // save W[i]+K(i) in stack memory + +#endif + + .endm // INITIAL_W_PRECALC + + // ----------------- functions F1/F2/F3/F4 used in updating the sha1 digests ----------------------- + + // F1(b,c,d) = ((((c) ^ (d)) & (b)) ^ (d)) + .macro F1 + eor T1, $2, $1 + and T1, $0 + eor T1, $2 + .endm + + // F2(b,c,d) = ((b) ^ (c) ^ (d)) + .macro F2 + eor T1, $1, $2 + eor T1, $0 + .endm + + // F3(b,c,d) = (((b) & (c)) | (((b) | (c)) & (d))) + .macro F3 + orr T1, $0, $1 + and r12, $1, $0 + and T1, $2 + orr T1, r12 + .endm + + #define F4 F2 // F4 = F2 + + // ------------------------------------------------------------------------------------------------- + + // ------ macros for performing sha1 digest update, rotating the roles of digest registers ------- + /* + FN = F( i, B[i], C[i], D[i] ); + A[i+1] = FN + E[i] + ROTATE_LEFT( A[i], 5 ) + WK[i]; + B[i+1] = A[i]; + C[i+1] = ROTATE_LEFT( B[i], 30 ); + D[i+1] = C[i]; + E[i+1] = D[i]; + */ + + .macro RR0 + $0 $2, $3, $4 // T1 = FN = F( i, B[i], C[i], D[i] ); + ldr r12, WK($6) // r12 = WK[i] + ror $2, #2 // C[i+1] = ROTATE_LEFT( B[i], 30 ); + add $5, r12 // E[i] + WK[i] + ldr r12, WK($6+1) // r12 = WK[i+1] + add $4, r12 // D[i] + WK[i+1] + add $5, T1 // E[i] + WK[i] + FN + .endm + + .macro RR1 + add $5, $5, $1, ror #27 // T2 = FN + E[i] + ROTATE_LEFT( A[i], 5 ) + WK[i] + add $4, $5, ror #27 // E[i+1] + WK[i+1] + ROTATE_LEFT( A[i+1], 5 ) + $0 $1, $2, $3 // T1 = FN = F(i+1, B[i+1], C[i+1], D[i+1]) + add $4, T1 // FN + FN + E[i+1] + ROTATE_LEFT( A[i+1], 5 ) + WK[i+1]; + ror $1, #2 // C[i+1] = B[i] = ROTATE_LEFT( B[i], 30 ); + .endm + // ------------------------------------------------------------------------------------------------- + + // RR0/RR1 and F1/F2/F3 are combined (re-organize the instruction schedule to reduce stalls) + // hence the following 6 combined macros + + .macro RR0_F1 + ldr r12, WK($6) + eor T1, $3, $4 + ldr T2, WK($6+1) + and T1, $2 + add $5, r12 + ror $2, #2 + eor T1, $4 + add $4, T2 + add $5, T1 + .endm + + .macro RR0_F2 + ldrd T1,T2,WK($6) + eor r12, $2, $4 + ror $2, #2 + eor r12, $3 + add $5, T1 + add $4, T2 + add $5, r12 + .endm + + .macro RR0_F3 + ldr r12, WK($6) + orr T1, $2, $3 + and T2, $2, $3 + ror $2, #2 + add $5, r12 + ldr r12, WK($6+1) + and T1, $4 + orr T1, T2 + add $4, r12 + add $5, T1 + .endm + + .macro RR1_F1 + add $5, $5, $1, ror #27 + eor T1, $3, $2 + and T1, $1 + eor T1, $3 + add $4, $5, ror #27 + ror $1, #2 + add $4, T1 + .endm + + .macro RR1_F2 + eor T1, $1, $2 + add $5, $5, $1, ror #27 + eor T1, $3 + add $4, T1 + add $4, $5, ror #27 + ror $1, #2 + .endm + + .macro RR1_F3 + add $5, $5, $1, ror #27 + orr T1, $1, $2 + and T1, $3 + and r12, $1, $2 + orr T1, r12 + add $4, $5, ror #27 + ror $1, #2 + add $4, T1 + .endm + + + // ------ rounds 16-31 compute W[0] using the vectorization approach by Dean Gaudet ------- + /* + W[i ] = (W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]) rol 1 + W[i+1] = (W[i-2] ^ W[i-7] ^ W[i-13] ^ W[i-15]) rol 1 + W[i+2] = (W[i-1] ^ W[i-6] ^ W[i-12] ^ W[i-14]) rol 1 + W[i+3] = ( 0 ^ W[i-5] ^ W[i-11] ^ W[i-13]) rol 1 + + W[i+3] ^= W[i] rol 1 + */ + + // -------------- macros for rounds 16-31 compute W (Gaudet's approach) and save W+K -------------- + + .macro W_PRECALC_16_31_0 // W_16,W_12,W_8,W_4,W + vext.64 $4, $0, $1, #1 + veor $4, $2 // W_8 ^ W_14 + vext.32 W_TMP,$3,ZERO,#1 + .endm + + .macro W_PRECALC_16_31_1 // W_16,W + veor W_TMP, $0 // W_3 ^ W_16 + veor $1, W_TMP // W_3 ^ W_16 ^ W_8 ^ W_14 + vshl.i32 W_TMP, $1, #1 + vext.32 W_TMP2,ZERO, $1, #1 + vshr.u32 $1, #31 + .endm + + .macro W_PRECALC_16_31_2 // W + vorr W_TMP, $0 + vshl.i32 $0, W_TMP2, #2 + vshr.u32 W_TMP2, #30 + .endm + + .macro W_PRECALC_16_31_3 // W, i, K_XMM + veor W_TMP, W_TMP2 + veor W_TMP, $0 + vadd.s32 W_TMP2, W_TMP, K_VALUES + vorr $0, W_TMP, W_TMP + vst1.f32 {W_TMP2}, [lr,:128]! + .endm + + // -------------- macros for rounds 32-79 compute W (Max's approach) and save W+K -------------- + + .macro W_PRECALC_32_79_0 // W_28,W_8,W_4,W + veor $3, $0 + vext.64 W_TMP, $1, $2, #1 + .endm + + .macro W_PRECALC_32_79_1 // W_16,W + veor W_TMP, $0 + veor W_TMP, $1 + vshr.u32 $1, W_TMP, #30 + vshl.i32 W_TMP, #2 + .endm + + .macro W_PRECALC_32_79_2 // W + vorr W_TMP, $0 + .endm + + .macro W_PRECALC_32_79_3 // W, i, K_XMM + vadd.s32 W_TMP2, W_TMP, K_VALUES + vorr $0, W_TMP, W_TMP + vst1.f32 {W_TMP2}, [lr,:128]! + .endm + + // the main code body in early revisions --- no so optimized + +#if !OPTIMIZED + .macro INTERNAL + // i=16 + // circular buffer : W12,W8,W4,W0,W28,W24,W20,W16 + W_PRECALC_16_31_0 W0,W28,W24,W20,W16 + RR0_F1 F1,A,B,C,D,E,0 + W_PRECALC_16_31_1 W0,W16 + RR1_F1 F1,A,B,C,D,E,0 + W_PRECALC_16_31_2 W16 + RR0_F1 F1,D,E,A,B,C,2 + W_PRECALC_16_31_3 W16, 2, 0 + RR1_F1 F1,D,E,A,B,C,2 + + vld1.s32 {K_VALUES}, [K_BASE,:128]! + + // i=20, + // W8,W4,W0,W28,W24,W20,W16,W12 + W_PRECALC_16_31_0 W28,W24,W20,W16,W12 + RR0_F1 F1,B,C,D,E,A,4 + W_PRECALC_16_31_1 W28,W12 + RR1_F1 F1,B,C,D,E,A,4 + W_PRECALC_16_31_2 W12 + RR0_F1 F1,E,A,B,C,D,6 + W_PRECALC_16_31_3 W12, 6, 16 + RR1_F1 F1,E,A,B,C,D,6 + + // i=24, + // W4,W0,W28,W24,W20,W16,W12,W8 + W_PRECALC_16_31_0 W24,W20,W16,W12,W8 + RR0_F1 F1,C,D,E,A,B,8 + W_PRECALC_16_31_1 W24,W8 + RR1_F1 F1,C,D,E,A,B,8 + W_PRECALC_16_31_2 W8 + RR0_F1 F1,A,B,C,D,E,10 + W_PRECALC_16_31_3 W8,10,16 + RR1_F1 F1,A,B,C,D,E,10 + + // i=28 + // W0,W28,W24,W20,W16,W12,W8,W4 + W_PRECALC_16_31_0 W20,W16,W12,W8,W4 + RR0_F1 F1,D,E,A,B,C,12 + W_PRECALC_16_31_1 W20,W4 + RR1_F1 F1,D,E,A,B,C,12 + W_PRECALC_16_31_2 W4 + RR0_F1 F1,B,C,D,E,A,14 + W_PRECALC_16_31_3 W4,14,16 + RR1_F1 F1,B,C,D,E,A,14 + + sub lr, #0x40 + + //i=32 + // W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0 W28,W8,W4,W0 + RR0_F1 F1,E,A,B,C,D,16 + W_PRECALC_32_79_1 W16,W0 + RR1_F1 F1,E,A,B,C,D,16 + W_PRECALC_32_79_2 W0 + RR0_F1 F1,C,D,E,A,B,18 + W_PRECALC_32_79_3 W0,18,16 + RR1_F1 F1,C,D,E,A,B,18 + + //i=36 + // W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_32_79_0 W24,W4,W0,W28 + RR0_F2 F2,A,B,C,D,E,20 + W_PRECALC_32_79_1 W12,W28 + RR1_F2 F2,A,B,C,D,E,20 + W_PRECALC_32_79_2 W28 + RR0_F2 F2,D,E,A,B,C,22 + W_PRECALC_32_79_3 W28,22,16 + RR1_F2 F2,D,E,A,B,C,22 + + vld1.s32 {K_VALUES}, [K_BASE,:128]! + + //i=40 + #undef K_XMM + #define K_XMM 32 + // W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_32_79_0 W20,W0,W28,W24 + RR0_F2 F2,B,C,D,E,A,24 + W_PRECALC_32_79_1 W8,W24 + RR1_F2 F2,B,C,D,E,A,24 + W_PRECALC_32_79_2 W24 + RR0_F2 F2,E,A,B,C,D,26 + W_PRECALC_32_79_3 W24,26,K_XMM + RR1_F2 F2,E,A,B,C,D,26 + + //i=44 + // W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0 W16,W28,W24,W20 + RR0_F2 F2,C,D,E,A,B,28 + W_PRECALC_32_79_1 W4,W20 + RR1_F2 F2,C,D,E,A,B,28 + W_PRECALC_32_79_2 W20 + RR0_F2 F2,A,B,C,D,E,30 + W_PRECALC_32_79_3 W20,30,K_XMM + RR1_F2 F2,A,B,C,D,E,30 + + sub lr, #0x40 + + //i=48 + // W12,W8,W4,W0,W28,W24,W20,W16 + W_PRECALC_32_79_0 W12,W24,W20,W16 + RR0_F2 F2,D,E,A,B,C,32 + W_PRECALC_32_79_1 W0,W16 + RR1_F2 F2,D,E,A,B,C,32 + W_PRECALC_32_79_2 W16 + RR0_F2 F2,B,C,D,E,A,34 + W_PRECALC_32_79_3 W16,34,K_XMM + RR1_F2 F2,B,C,D,E,A,34 + + //i=52 + // W8,W4,W0,W28,W24,W20,W16,W12 + W_PRECALC_32_79_0 W8,W20,W16,W12 + RR0_F2 F2,E,A,B,C,D,36 + W_PRECALC_32_79_1 W28,W12 + RR1_F2 F2,E,A,B,C,D,36 + W_PRECALC_32_79_2 W12 + RR0_F2 F2,C,D,E,A,B,38 + W_PRECALC_32_79_3 W12,38,K_XMM + RR1_F2 F2,C,D,E,A,B,38 + + //i=56 + // W4,W0,W28,W24,W20,W16,W12,W8 + W_PRECALC_32_79_0 W4,W16,W12,W8 + RR0_F3 F3,A,B,C,D,E,40 + W_PRECALC_32_79_1 W24,W8 + RR1 F3,A,B,C,D,E,40 + W_PRECALC_32_79_2 W8 + RR0_F3 F3,D,E,A,B,C,42 + W_PRECALC_32_79_3 W8,42,K_XMM + RR1_F3 F3,D,E,A,B,C,42 + + vld1.s32 {K_VALUES}, [K_BASE,:128]! + + //i=60 + #undef K_XMM + #define K_XMM 48 + // W0,W28,W24,W20,W16,W12,W8,W4 + W_PRECALC_32_79_0 W0,W12,W8,W4 + RR0_F3 F3,B,C,D,E,A,44 + W_PRECALC_32_79_1 W20,W4 + RR1_F3 F3,B,C,D,E,A,44 + W_PRECALC_32_79_2 W4 + RR0_F3 F3,E,A,B,C,D,46 + W_PRECALC_32_79_3 W4,46,K_XMM + RR1_F3 F3,E,A,B,C,D,46 + + sub lr, #0x40 + + //i=64 + // W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0 W28,W8,W4,W0 + RR0_F3 F3,C,D,E,A,B,48 + W_PRECALC_32_79_1 W16,W0 + RR1_F3 F3,C,D,E,A,B,48 + W_PRECALC_32_79_2 W0 + RR0_F3 F3,A,B,C,D,E,50 + W_PRECALC_32_79_3 W0,50,K_XMM + RR1_F3 F3,A,B,C,D,E,50 + + //i=68 + // W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_32_79_0 W24,W4,W0,W28 + RR0_F3 F3,D,E,A,B,C,52 + W_PRECALC_32_79_1 W12,W28 + RR1_F3 F3,D,E,A,B,C,52 + W_PRECALC_32_79_2 W28 + RR0_F3 F3,B,C,D,E,A,54 + W_PRECALC_32_79_3 W28,54,K_XMM + RR1_F3 F3,B,C,D,E,A,54 + + //i=72 + // W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_32_79_0 W20,W0,W28,W24 + RR0_F3 F3,E,A,B,C,D,56 + W_PRECALC_32_79_1 W8,W24 + RR1_F3 F3,E,A,B,C,D,56 + W_PRECALC_32_79_2 W24 + RR0_F3 F3,C,D,E,A,B,58 + W_PRECALC_32_79_3 W24,58,K_XMM + RR1_F3 F3,C,D,E,A,B,58 + + // starting using F4 + + //i=76 + // W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0 W16,W28,W24,W20 + RR0_F2 F4,A,B,C,D,E,60 + W_PRECALC_32_79_1 W4,W20 + RR1_F2 F4,A,B,C,D,E,60 + W_PRECALC_32_79_2 W20 + RR0_F2 F4,D,E,A,B,C,62 + W_PRECALC_32_79_3 W20,62,K_XMM + RR1_F2 F4,D,E,A,B,C,62 + + sub K_BASE, #64 + sub lr, #0x40 + + .endm +#endif // !OPTIMIZED + + + + // macros that further combined W_PRECALC_16_31_0 with RR0 to reduce pipeline stalls + + .macro W_PRECALC_16_31_0_RR0_0 // W_16,W_12,W_8,W_4,W + vext.64 $4, $0, $1, #1 + ldr r12, WK(0) + eor T1, $7, $8 + ldr T2, WK(1) + vext.32 W_TMP,$3,ZERO,#1 + and T1, $6 + add $9, r12 + ror $6, #2 + veor $4, $2 // W_8 ^ W_14 + eor T1, $8 + add $8, T2 + add $9, T1 + ror T2, $5, #27 + .endm + + .macro W_PRECALC_16_31_0_RR0_4 // W_16,W_12,W_8,W_4,W + vext.64 $4, $0, $1, #1 + ldr r12, WK(4) + eor T1, $7, $8 + ldr T2, WK(5) + vext.32 W_TMP,$3,ZERO,#1 + and T1, $6 + add $9, r12 + ror $6, #2 + veor $4, $2 // W_8 ^ W_14 + eor T1, $8 + add $8, T2 + add $9, T1 + ror T2, $5, #27 + .endm + + .macro W_PRECALC_16_31_0_RR0_8 // W_16,W_12,W_8,W_4,W + vext.64 $4, $0, $1, #1 + ldr r12, WK(8) + eor T1, $7, $8 + ldr T2, WK(9) + vext.32 W_TMP,$3,ZERO,#1 + and T1, $6 + add $9, r12 + ror $6, #2 + veor $4, $2 // W_8 ^ W_14 + eor T1, $8 + add $8, T2 + add $9, T1 + ror T2, $5, #27 + .endm + + .macro W_PRECALC_16_31_0_RR0_12 // W_16,W_12,W_8,W_4,W + vext.64 $4, $0, $1, #1 + ldr r12, WK(12) + eor T1, $7, $8 + ldr T2, WK(13) + vext.32 W_TMP,$3,ZERO,#1 + and T1, $6 + add $9, r12 + ror $6, #2 + veor $4, $2 // W_8 ^ W_14 + eor T1, $8 + add $8, T2 + add $9, T1 + ror T2, $5, #27 + .endm + + // macros that further combined W_PRECALC_16_31_1 with RR1 to reduce pipeline stalls + .macro W_PRECALC_16_31_1_RR1 // W_16,W + veor W_TMP, $0 // W_3 ^ W_16 + eor T1, $4, $3 + and T1, $2 + add T2, $6 + eor T1, $4 + veor $1, W_TMP // W_3 ^ W_16 ^ W_8 ^ W_14 + orr $6, T2, T2 + // ror T2, #27 + vshl.i32 W_TMP, $1, #1 + ror $2, #2 + vext.32 W_TMP2,ZERO, $1, #1 + add $5, T1 + vshr.u32 $1, #31 + add $5, T2, ror #27 + .endm + + // macros that further combined W_PRECALC_16_31_2 with RR0 to reduce pipeline stalls + .macro W_PRECALC_16_31_2_RR0 // W + ldr r12, WK($6) + vorr W_TMP, $0 + eor T1, $3, $4 + ldr T2, WK($6+1) + and T1, $2 + vshl.i32 $0, W_TMP2, #2 + add $5, r12 + ror $2, #2 + eor T1, $4 + add $4, T2 + vshr.u32 W_TMP2, #30 + ror T2, $1, #27 + add $5, T1 + .endm + + // macros that further combined W_PRECALC_16_31_3 with RR1 to reduce pipeline stalls + .macro W_PRECALC_16_31_3_RR1 // W, i, K_XMM + veor W_TMP, W_TMP2 + eor T1, $3, $2 + add T2, $5 + and T1, $1 + ror $1, #2 + veor W_TMP, $0 + orr $5, T2, T2 + // ror T2, #27 + vadd.s32 W_TMP2, W_TMP, K_VALUES + eor T1, $3 + vorr $0, W_TMP, W_TMP + add $4, T2, ror #27 + vst1.f32 {W_TMP2}, [lr,:128]! + add $4, T1 + .endm + + // a super macro that combines 4 macro proliferations to further reduce pipeline stalls + // W_PRECALC_16_31_0_RR0_0 W0,W28,W24,W20,W16,A,B,C,D,E + // W_PRECALC_16_31_1_RR1 W0,W16,A,B,C,D,E + // W_PRECALC_16_31_2_RR0 W16,D,E,A,B,C,2 + // W_PRECALC_16_31_3_RR1 W16,D,E,A,B,C + + .macro SUPER_W_PRECALC_16_31_0 // W_16,W_12,W_8,W_4,W + vext.64 $4, $0, $1, #1 + ldrd T1, T2, WK(0) + vext.32 W_TMP,$3,ZERO,#1 + eor r12, $7, $8 + veor $4, $2 // W_8 ^ W_14 + and r12, $6 + veor W_TMP, $0 // W_3 ^ W_16 + add $9, T1 + ror $6, #2 + eor r12, $8 + add $8, T2 + veor $4, W_TMP // W_3 ^ W_16 ^ W_8 ^ W_14 + add $9, r12 + eor r12, $7, $6 + vext.32 W_TMP2,ZERO, $4, #1 + add $9, $9, $5, ror #27 + vshl.i32 W_TMP, $4, #1 + and r12, $5 + vshr.u32 $4, #31 + eor r12, $7 + vorr W_TMP, $4 + ror $5, #2 + vshl.i32 $4, W_TMP2, #2 + add $8, r12 + vshr.u32 W_TMP2, #30 + add $8, $9, ror #27 + ldrd T1, T2, WK(2) + eor r12, $5, $6 + veor W_TMP, W_TMP2 + add $7, T1 + and r12, $9 + ror $9, #2 + veor W_TMP, $4 + eor r12, $6 + add $6, T2 + vadd.s32 W_TMP2, W_TMP, K_VALUES + add $7, r12 + vorr $4, W_TMP, W_TMP + eor r12, $5, $9 + add $7, $7, $8, ror #27 + and r12, $8 + ror $8, #2 + eor r12, $5 + add $6, $7, ror #27 + vst1.f32 {W_TMP2}, [lr,:128]! + add $6, r12 + .endm + + // a super macro that combines 4 macro proliferations to further reduce pipeline stalls + // W_PRECALC_16_31_0_RR0_4 W28,W24,W20,W16,W12,B,C,D,E,A + // W_PRECALC_16_31_1_RR1 W28,W12,B,C,D,E,A + // W_PRECALC_16_31_2_RR0 W12,E,A,B,C,D,6 + // W_PRECALC_16_31_3_RR1 W12,E,A,B,C,D + .macro SUPER_W_PRECALC_16_31_4 // W_16,W_12,W_8,W_4,W + vext.64 $4, $0, $1, #1 + ldrd T1, T2, WK(4) + vext.32 W_TMP,$3,ZERO,#1 + eor r12, $7, $8 + veor $4, $2 // W_8 ^ W_14 + and r12, $6 + veor W_TMP, $0 // W_3 ^ W_16 + add $9, T1 + ror $6, #2 + eor r12, $8 + add $8, T2 + veor $4, W_TMP // W_3 ^ W_16 ^ W_8 ^ W_14 + add $9, r12 + eor r12, $7, $6 + vext.32 W_TMP2,ZERO, $4, #1 + add $9, $9, $5, ror #27 + vshl.i32 W_TMP, $4, #1 + and r12, $5 + vshr.u32 $4, #31 + eor r12, $7 + vorr W_TMP, $4 + ror $5, #2 + vshl.i32 $4, W_TMP2, #2 + add $8, r12 + vshr.u32 W_TMP2, #30 + add $8, $9, ror #27 + ldrd T1, T2, WK(6) + eor r12, $5, $6 + veor W_TMP, W_TMP2 + add $7, T1 + and r12, $9 + ror $9, #2 + veor W_TMP, $4 + eor r12, $6 + add $6, T2 + vadd.s32 W_TMP2, W_TMP, K_VALUES + add $7, r12 + vorr $4, W_TMP, W_TMP + eor r12, $5, $9 + add $7, $7, $8, ror #27 + and r12, $8 + ror $8, #2 + eor r12, $5 + add $6, $7, ror #27 + vst1.f32 {W_TMP2}, [lr,:128]! + add $6, r12 + .endm + + // a super macro that combines 4 macro proliferations to further reduce pipeline stalls + // W_PRECALC_16_31_0_RR0_8 W24,W20,W16,W12,W8,C,D,E,A,B + // W_PRECALC_16_31_1_RR1 W24,W8,C,D,E,A,B + // W_PRECALC_16_31_2_RR0 W8,A,B,C,D,E,10 + // W_PRECALC_16_31_3_RR1 W8,A,B,C,D,E + .macro SUPER_W_PRECALC_16_31_8 // W_16,W_12,W_8,W_4,W + vext.64 $4, $0, $1, #1 + ldrd T1, T2, WK(8) + vext.32 W_TMP,$3,ZERO,#1 + eor r12, $7, $8 + veor $4, $2 // W_8 ^ W_14 + and r12, $6 + veor W_TMP, $0 // W_3 ^ W_16 + add $9, T1 + ror $6, #2 + eor r12, $8 + add $8, T2 + veor $4, W_TMP // W_3 ^ W_16 ^ W_8 ^ W_14 + add $9, r12 + //ror T2, $5, #27 + eor r12, $7, $6 + vext.32 W_TMP2,ZERO, $4, #1 + add $9, $9, $5, ror #27 + vshl.i32 W_TMP, $4, #1 + and r12, $5 + vshr.u32 $4, #31 + eor r12, $7 + vorr W_TMP, $4 + ror $5, #2 + vshl.i32 $4, W_TMP2, #2 + add $8, r12 + vshr.u32 W_TMP2, #30 + add $8, $9, ror #27 + ldrd T1, T2, WK(10) + eor r12, $5, $6 + veor W_TMP, W_TMP2 + add $7, T1 + and r12, $9 + ror $9, #2 + veor W_TMP, $4 + eor r12, $6 + add $6, T2 + vadd.s32 W_TMP2, W_TMP, K_VALUES + add $7, r12 + vorr $4, W_TMP, W_TMP + eor r12, $5, $9 + add $7, $7, $8, ror #27 + and r12, $8 + ror $8, #2 + eor r12, $5 + add $6, $7, ror #27 + vst1.f32 {W_TMP2}, [lr,:128]! + add $6, r12 + .endm + + // a super macro that combines 4 macro proliferations to further reduce pipeline stalls + // W_PRECALC_16_31_0_RR0_12 W20,W16,W12,W8,W4,D,E,A,B,C + // W_PRECALC_16_31_1_RR1 W20,W4,D,E,A,B,C + // W_PRECALC_16_31_2_RR0 W4,B,C,D,E,A,14 + // W_PRECALC_16_31_3_RR1 W4,B,C,D,E,A + .macro SUPER_W_PRECALC_16_31_12 // W_16,W_12,W_8,W_4,W + vext.64 $4, $0, $1, #1 + ldrd T1, T2, WK(12) + vext.32 W_TMP,$3,ZERO,#1 + eor r12, $7, $8 + veor $4, $2 // W_8 ^ W_14 + and r12, $6 + veor W_TMP, $0 // W_3 ^ W_16 + add $9, T1 + ror $6, #2 + eor r12, $8 + add $8, T2 + veor $4, W_TMP // W_3 ^ W_16 ^ W_8 ^ W_14 + add $9, r12 + //ror T2, $5, #27 + eor r12, $7, $6 + vext.32 W_TMP2,ZERO, $4, #1 + add $9, $9, $5, ror #27 + vshl.i32 W_TMP, $4, #1 + and r12, $5 + vshr.u32 $4, #31 + eor r12, $7 + vorr W_TMP, $4 + ror $5, #2 + vshl.i32 $4, W_TMP2, #2 + add $8, r12 + vshr.u32 W_TMP2, #30 + add $8, $9, ror #27 + ldrd T1, T2, WK(14) + eor r12, $5, $6 + veor W_TMP, W_TMP2 + add $7, T1 + and r12, $9 + ror $9, #2 + veor W_TMP, $4 + eor r12, $6 + add $6, T2 + vadd.s32 W_TMP2, W_TMP, K_VALUES + add $7, r12 + vorr $4, W_TMP, W_TMP + eor r12, $5, $9 + add $7, $7, $8, ror #27 + and r12, $8 + ror $8, #2 + eor r12, $5 + add $6, $7, ror #27 + vst1.f32 {W_TMP2}, [lr,:128]! + add $6, r12 + .endm + + // macros that combine W_PRECALC_32_79 with RR0/RR1 and F1/F2/F3 macros + .macro W_PRECALC_32_79_0_RR0_F1 // W_28,W_8,W_4,W + ldr r12, WK($9) + eor T1, $6, $7 + ldr T2, WK($9+1) + veor $3, $0 + and T1, $5 + add $8, r12 + ror $5, #2 + eor T1, $7 + add $7, T2 + vext.64 W_TMP, $1, $2, #1 + add $8, T1 + //ror T2, $4, #27 + .endm + + .macro W_PRECALC_32_79_0_RR0_F2 // W_28,W_8,W_4,W + ldr r12, WK($9) + veor $3, $0 + eor T1, $5, $7 + ror $5, #2 + add $8, r12 + ldr r12, WK($9+1) + eor T1, $6 + vext.64 W_TMP, $1, $2, #1 + add $8, T1 + add $7, r12 + .endm + + .macro W_PRECALC_32_79_0_RR0_F3 // W_28,W_8,W_4,W + ldr r12, WK($9) + veor $3, $0 + orr T1, $5, $6 + and T2, $5, $6 + add $8, r12 + ldr r12, WK($9+1) + ror $5, #2 + vext.64 W_TMP, $1, $2, #1 + and T1, $7 + add $7, r12 + orr T1, T2 + add $8, T1 + .endm + + .macro W_PRECALC_32_79_1_RR1 // combined W_PRECALC_32_79_1 and RR1 to absorb some stalls + veor W_TMP, $0 + add $7, $7, $3, ror #27 + veor W_TMP, $1 + vshr.u32 $1, W_TMP, #30 + add $6, $7, ror #27 + vshl.i32 W_TMP, #2 + $2 $3, $4, $5 + add $6, T1 + ror $3, #2 + .endm + + .macro W_PRECALC_32_79_1_RR1_F1 // combined W_PRECALC_32_79_1 and RR1 to absorb some stalls + veor W_TMP, $0 + eor T1, $5, $4 + add $7, $7, $3, ror #27 + and T1, $3 + veor W_TMP, $1 + eor T1, $5 + vshr.u32 $1, W_TMP, #30 + add $6, T1 + vshl.i32 W_TMP, #2 + add $6, $7, ror #27 + ror $3, #2 + .endm + + .macro W_PRECALC_32_79_1_RR1_F2 // combined W_PRECALC_32_79_1 and RR1 to absorb some stalls + veor W_TMP, $0 + veor W_TMP, $1 + eor T1, $3, $4 + add $7, $7, $3, ror #27 + eor T1, $5 + ror $3, #2 + add $6, T1 + vshr.u32 $1, W_TMP, #30 + vshl.i32 W_TMP, #2 + add $6, $7, ror #27 + .endm + + .macro W_PRECALC_32_79_1_RR1_F3 // combined W_PRECALC_32_79_1 and RR1 to absorb some stalls + veor W_TMP, $0 + veor W_TMP, $1 + add $7, $7, $3, ror #27 + orr T1, $3, $4 + and r12, $4, $3 + and T1, $5 + add $6, $7, ror #27 + orr T1, r12 + vshr.u32 $1, W_TMP, #30 + vshl.i32 W_TMP, #2 + ror $3, #2 + add $6, T1 + .endm + + .macro W_PRECALC_32_79_2_RR0_F1 // W + ldr r12, WK($6) + eor T1, $3, $4 + ldr T2, WK($6+1) + and T1, $2 + add $5, r12 + ror $2, #2 + eor T1, $4 + add $4, T2 + vorr W_TMP, $0 + add $5, T1 + .endm + + .macro W_PRECALC_32_79_2_RR0_F2 // W + ldr r12, WK($6) + eor T1, $2, $4 + ror $2, #2 + eor T1, $3 + add $5, r12 + ldr r12, WK($6+1) + vorr W_TMP, $0 + add $5, T1 + add $4, r12 + .endm + + .macro W_PRECALC_32_79_2_RR0_F3 // W + ldr r12, WK($6) + orr T1, $2, $3 + and T2, $2, $3 + ror $2, #2 + add $5, r12 + ldr r12, WK($6+1) + and T1, $4 + vorr W_TMP, $0 + orr T1, T2 + add $4, r12 + add $5, T1 + .endm + + .macro W_PRECALC_32_79_3_RR1_F1 // W, i, K_XMM + vadd.s32 W_TMP2, W_TMP, K_VALUES + add $5, $5, $1, ror #27 + eor T1, $3, $2 + vorr $0, W_TMP, W_TMP + and T1, $1 + ror $1, #2 + vst1.f32 {W_TMP2}, [lr,:128]! + add $4, $5, ror #27 + eor T1, $3 + add $4, T1 + .endm + + .macro W_PRECALC_32_79_3_RR1_F2 // W, i, K_XMM + vadd.s32 W_TMP2, W_TMP, K_VALUES + vorr $0, W_TMP, W_TMP + add $5, $5, $1, ror #27 + eor T1, $1, $2 + ror $1, #2 + eor T1, $3 + vst1.f32 {W_TMP2}, [lr,:128]! + add $4, T1 + add $4, $5, ror #27 + .endm + + .macro W_PRECALC_32_79_3_RR1_F3 // W, i, K_XMM + vadd.s32 W_TMP2, W_TMP, K_VALUES + vorr $0, W_TMP, W_TMP + orr T1, $1, $2 + add $5, $5, $1, ror #27 + and T1, $3 + and r12, $1, $2 + add $4, $5, ror #27 + orr T1, r12 + vst1.f32 {W_TMP2}, [lr,:128]! + ror $1, #2 + add $4, T1 + .endm + + + .macro LOAD_HASH + ldr A, [HASH_PTR, #0] + ldrd B,C, [HASH_PTR, #4] + ldrd D,E, [HASH_PTR, #12] + .endm + + + + // the main code body --- the final optimized version +#if OPTIMIZED + + // rounds 16-31 use the approach by Dean Gaudet + .macro INTERNAL + // i=16 + // circular buffer : W12,W8,W4,W0,W28,W24,W20,W16 +#if 1 + SUPER_W_PRECALC_16_31_0 W0,W28,W24,W20,W16,A,B,C,D,E +#else + W_PRECALC_16_31_0_RR0_0 W0,W28,W24,W20,W16,A,B,C,D,E + W_PRECALC_16_31_1_RR1 W0,W16,A,B,C,D,E + W_PRECALC_16_31_2_RR0 W16,D,E,A,B,C,2 + W_PRECALC_16_31_3_RR1 W16,D,E,A,B,C +#endif + + vld1.s32 {K_VALUES}, [K_BASE,:128]! + + // i=20, + // W8,W4,W0,W28,W24,W20,W16,W12 +#if 1 + SUPER_W_PRECALC_16_31_4 W28,W24,W20,W16,W12,B,C,D,E,A +#else + W_PRECALC_16_31_0_RR0_4 W28,W24,W20,W16,W12,B,C,D,E,A + W_PRECALC_16_31_1_RR1 W28,W12,B,C,D,E,A + W_PRECALC_16_31_2_RR0 W12,E,A,B,C,D,6 + W_PRECALC_16_31_3_RR1 W12,E,A,B,C,D +#endif + + // i=24, + // W4,W0,W28,W24,W20,W16,W12,W8 +#if 1 + SUPER_W_PRECALC_16_31_8 W24,W20,W16,W12,W8,C,D,E,A,B +#else + W_PRECALC_16_31_0_RR0_8 W24,W20,W16,W12,W8,C,D,E,A,B + W_PRECALC_16_31_1_RR1 W24,W8,C,D,E,A,B + W_PRECALC_16_31_2_RR0 W8,A,B,C,D,E,10 + W_PRECALC_16_31_3_RR1 W8,A,B,C,D,E +#endif + + // i=28 + // W0,W28,W24,W20,W16,W12,W8,W4 +#if 1 + SUPER_W_PRECALC_16_31_12 W20,W16,W12,W8,W4,D,E,A,B,C +#else + W_PRECALC_16_31_0_RR0_12 W20,W16,W12,W8,W4,D,E,A,B,C + W_PRECALC_16_31_1_RR1 W20,W4,D,E,A,B,C + W_PRECALC_16_31_2_RR0 W4,B,C,D,E,A,14 + W_PRECALC_16_31_3_RR1 W4,B,C,D,E,A +#endif + + sub lr, #0x40 + + //i=32 + // W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0_RR0_F1 W28,W8,W4,W0,E,A,B,C,D,16 + W_PRECALC_32_79_1_RR1_F1 W16,W0,F1,E,A,B,C,D,16 + W_PRECALC_32_79_2_RR0_F1 W0,C,D,E,A,B,18 + W_PRECALC_32_79_3_RR1_F1 W0,C,D,E,A,B + + //i=36 + // W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_32_79_0_RR0_F2 W24,W4,W0,W28,A,B,C,D,E,20 + W_PRECALC_32_79_1_RR1_F2 W12,W28,F2,A,B,C,D,E,20 + W_PRECALC_32_79_2_RR0_F2 W28,D,E,A,B,C,22 + W_PRECALC_32_79_3_RR1_F2 W28,D,E,A,B,C + + vld1.s32 {K_VALUES}, [K_BASE,:128]! + + //i=40 + // W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_32_79_0_RR0_F2 W20,W0,W28,W24,B,C,D,E,A,24 + W_PRECALC_32_79_1_RR1_F2 W8,W24,F2,B,C,D,E,A,24 + W_PRECALC_32_79_2_RR0_F2 W24,E,A,B,C,D,26 + W_PRECALC_32_79_3_RR1_F2 W24,E,A,B,C,D + + //i=44 + // W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0_RR0_F2 W16,W28,W24,W20,C,D,E,A,B,28 + W_PRECALC_32_79_1_RR1_F2 W4,W20,F2,C,D,E,A,B,28 + W_PRECALC_32_79_2_RR0_F2 W20,A,B,C,D,E,30 + W_PRECALC_32_79_3_RR1_F2 W20,A,B,C,D,E + + sub lr, #0x40 + + //i=48 + // W12,W8,W4,W0,W28,W24,W20,W16 + W_PRECALC_32_79_0_RR0_F2 W12,W24,W20,W16,D,E,A,B,C,32 + W_PRECALC_32_79_1_RR1_F2 W0,W16,F2,D,E,A,B,C,32 + W_PRECALC_32_79_2_RR0_F2 W16,B,C,D,E,A,34 + W_PRECALC_32_79_3_RR1_F2 W16,B,C,D,E,A + + //i=52 + // W8,W4,W0,W28,W24,W20,W16,W12 + W_PRECALC_32_79_0_RR0_F2 W8,W20,W16,W12,E,A,B,C,D,36 + W_PRECALC_32_79_1_RR1_F2 W28,W12,F2,E,A,B,C,D,36 + W_PRECALC_32_79_2_RR0_F2 W12,C,D,E,A,B,38 + W_PRECALC_32_79_3_RR1_F2 W12,C,D,E,A,B + + //i=56 + // W4,W0,W28,W24,W20,W16,W12,W8 + W_PRECALC_32_79_0_RR0_F3 W4,W16,W12,W8,A,B,C,D,E,40 + W_PRECALC_32_79_1_RR1_F3 W24,W8,F3,A,B,C,D,E,40 + W_PRECALC_32_79_2_RR0_F3 W8,D,E,A,B,C,42 + W_PRECALC_32_79_3_RR1_F3 W8,D,E,A,B,C + + vld1.s32 {K_VALUES}, [K_BASE,:128]! + + //i=60 + // W0,W28,W24,W20,W16,W12,W8,W4 + W_PRECALC_32_79_0_RR0_F3 W0,W12,W8,W4,B,C,D,E,A,44 + W_PRECALC_32_79_1_RR1_F3 W20,W4,F3,B,C,D,E,A,44 + W_PRECALC_32_79_2_RR0_F3 W4,E,A,B,C,D,46 + W_PRECALC_32_79_3_RR1_F3 W4,E,A,B,C,D + + sub lr, #0x40 + + //i=64 + // W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0_RR0_F3 W28,W8,W4,W0,C,D,E,A,B,48 + W_PRECALC_32_79_1_RR1_F3 W16,W0,F3,C,D,E,A,B,48 + W_PRECALC_32_79_2_RR0_F3 W0,A,B,C,D,E,50 + W_PRECALC_32_79_3_RR1_F3 W0,A,B,C,D,E + + //i=68 + // W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_32_79_0_RR0_F3 W24,W4,W0,W28,D,E,A,B,C,52 + W_PRECALC_32_79_1_RR1_F3 W12,W28,F3,D,E,A,B,C,52 + W_PRECALC_32_79_2_RR0_F3 W28,B,C,D,E,A,54 + W_PRECALC_32_79_3_RR1_F3 W28,B,C,D,E,A + + //i=72 + // W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_32_79_0_RR0_F3 W20,W0,W28,W24,E,A,B,C,D,56 + W_PRECALC_32_79_1_RR1_F3 W8,W24,F3,E,A,B,C,D,56 + W_PRECALC_32_79_2_RR0_F3 W24,C,D,E,A,B,58 + W_PRECALC_32_79_3_RR1_F3 W24,C,D,E,A,B + + // starting using F4 + + //i=76 + // W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0_RR0_F2 W16,W28,W24,W20,A,B,C,D,E,60 + W_PRECALC_32_79_1_RR1_F2 W4,W20,F4,A,B,C,D,E,60 + W_PRECALC_32_79_2_RR0_F2 W20,D,E,A,B,C,62 + W_PRECALC_32_79_3_RR1_F2 W20,D,E,A,B,C + + sub K_BASE, #64 + sub lr, #0x40 + .endm + +#endif // OPTIMIZED + + .macro SOFTWARE_PIPELINING + + vld1.s32 {K_VALUES}, [K_BASE,:128]! + +#if !OPTIMIZED + // i=0 + // circular buffer : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) + RR0_F2 F4,B,C,D,E,A,64 + W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W[0] = W_TMP + RR1_F2 F4,B,C,D,E,A,64 + W_PRECALC_00_15_2 W0 // W_TMP = W[0] + K[0] + RR0_F2 F4,E,A,B,C,D,66 + W_PRECALC_00_15_3 // (sp) = W_TMP = W[0] + K[0] + RR1_F2 F4,E,A,B,C,D,66 + + // i=4 + // circular buffer : W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) + RR0_F2 F4,C,D,E,A,B,68 + W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W[0] = W_TMP + RR1_F2 F4,C,D,E,A,B,68 + W_PRECALC_00_15_2 W28 // W_TMP = W[0] + K[0] + RR0_F2 F4,A,B,C,D,E,70 + W_PRECALC_00_15_3 // 16(sp) = W_TMP = W[0] + K[0] + RR1_F2 F4,A,B,C,D,E,70 + + // i=8 + // circular buffer : W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) + RR0_F2 F4,D,E,A,B,C,72 + W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W[0] = W_TMP + RR1_F2 F4,D,E,A,B,C,72 + W_PRECALC_00_15_2 W24 // W_TMP = W[0] + K[0] + RR0_F2 F4,B,C,D,E,A,74 + W_PRECALC_00_15_3 // 32(sp) = W_TMP = W[0] + K[0] + RR1_F2 F4,B,C,D,E,A,74 + + // i=12 + // circular buffer : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) + RR0_F2 F4,E,A,B,C,D,76 + W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W[0] = W_TMP + RR1_F2 F4,E,A,B,C,D,76 + W_PRECALC_00_15_2 W20 // W_TMP = W[0] + K[0] + RR0_F2 F4,C,D,E,A,B,78 + W_PRECALC_00_15_3 // 48(sp) = W_TMP = W[0] + K[0] + RR1_F2 F4,C,D,E,A,B,78 +#else + // i=0 + // circular buffer : W28,W24,W20,W16,W12,W8,W4,W0 + + RR0_F2 F4,B,C,D,E,A,64 + vld1.f32 {W_TMP,W_TMP2},[BUFFER_PTR]! + RR1_F2 F4,B,C,D,E,A,64 + vld1.f32 {W4,W8},[BUFFER_PTR]! + RR0_F2 F4,E,A,B,C,D,66 + vrev32.8 W0, W_TMP + RR1_F2 F4,E,A,B,C,D,66 + + // i=4 + // circular buffer : W24,W20,W16,W12,W8,W4,W0,W28 + RR0_F2 F4,C,D,E,A,B,68 + vrev32.8 W28, W_TMP2 + RR1_F2 F4,C,D,E,A,B,68 + vrev32.8 W24, W4 + RR0_F2 F4,A,B,C,D,E,70 + vrev32.8 W20, W8 + RR1_F2 F4,A,B,C,D,E,70 + + // i=8 + // circular buffer : W20,W16,W12,W8,W4,W0,W28,W24 + RR0_F2 F4,D,E,A,B,C,72 + vadd.s32 W_TMP, W0, K_VALUES + RR1_F2 F4,D,E,A,B,C,72 + vadd.s32 W_TMP2, W28, K_VALUES + RR0_F2 F4,B,C,D,E,A,74 + vadd.s32 W4, W24, K_VALUES + RR1_F2 F4,B,C,D,E,A,74 + + // i=12 + // circular buffer : W16,W12,W8,W4,W0,W28,W24,W20 + RR0_F2 F4,E,A,B,C,D,76 + vadd.s32 W8, W20, K_VALUES + RR1_F2 F4,E,A,B,C,D,76 + vst1.s32 {W_TMP,W_TMP2}, [lr,:128]! // save W[i]+K(i) in stack memory + RR0_F2 F4,C,D,E,A,B,78 + vst1.s32 {W4,W8}, [lr,:128]! // save W[i]+K(i) in stack memory + RR1_F2 F4,C,D,E,A,B,78 +#endif + + sub lr, #0x40 + .endm + + .macro ENDING + //i=80 + RR0_F2 F4,B,C,D,E,A,64 + RR1_F2 F4,B,C,D,E,A,64 + RR0_F2 F4,E,A,B,C,D,66 + RR1_F2 F4,E,A,B,C,D,66 + + //i=84 + RR0_F2 F4,C,D,E,A,B,68 + RR1_F2 F4,C,D,E,A,B,68 + RR0_F2 F4,A,B,C,D,E,70 + RR1_F2 F4,A,B,C,D,E,70 + + //i=88 + RR0_F2 F4,D,E,A,B,C,72 + RR1_F2 F4,D,E,A,B,C,72 + RR0_F2 F4,B,C,D,E,A,74 + RR1_F2 F4,B,C,D,E,A,74 + + //i=92 + RR0_F2 F4,E,A,B,C,D,76 + RR1_F2 F4,E,A,B,C,D,76 + RR0_F2 F4,C,D,E,A,B,78 + RR1_F2 F4,C,D,E,A,B,78 + .endm + + .macro UPDATE_ALL_HASH + ldrd T1, T2, [HASH_PTR,#0] + add A, T1 + add B, T2 + str A, [HASH_PTR,#0] + ldrd T1, T2, [HASH_PTR,#8] + add C, T1 + add D, T2 + strd B, C, [HASH_PTR,#4] + ldr T1, [HASH_PTR,#16] + add E, T1 + strd D, E, [HASH_PTR,#12] + .endm + + .macro SHA1_PIPELINED_MAIN_BODY + LOAD_HASH // load initial hashes into A,B,C,D,E + orr lr, sp, sp + INITIAL_W_PRECALC + sub lr, #0x40 +0: + INTERNAL +#if Multiple_Blocks + subs num_blocks, #1 // pre-decrement num_blocks by 1 + ble 1f // if num_blocks <= 0, branch to finish off + SOFTWARE_PIPELINING + UPDATE_ALL_HASH + b 0b +1: +#endif + ENDING + UPDATE_ALL_HASH + .endm + + .text + + .p2align 4 + +#define K1 0x5a827999 +#define K2 0x6ed9eba1 +#define K3 0x8f1bbcdc +#define K4 0xca62c1d6 + +K_XMM_AR: + .long K1 + .long K1 + .long K1 + .long K1 + .long K2 + .long K2 + .long K2 + .long K2 + .long K3 + .long K3 + .long K3 + .long K3 + .long K4 + .long K4 + .long K4 + .long K4 + + + .globl _sha1_vng_armv7neon_compress + .private_extern _sha1_vng_armv7neon_compress +_sha1_vng_armv7neon_compress: + + // due to the change of order in the 2nd and 3rd calling argument, + // we need to switch r1/r2 to use the original code + // cclee 1-13-11 + mov r12, r1 + mov r1, r2 + mov r2, r12 + + push {r4-r7,lr} + nop + add r7, sp, #12 // set up base pointer for debug tracing + push {r8-r11} + + // align sp to 16-byte boundary + ands r12, sp, #15 // number of bytes to align to 16-byte boundary + addeq r12, #16 // in case it's already 16-byte aligned and hence no where to store num_aligned_bytes + sub sp, r12 + str r12, [sp] + +#if KERNEL + vpush {q8-q15} +#endif + vpush {q4-q7} +#define stack_size (16*4) // circular buffer W0-W3 + sub sp, #stack_size + + veor ZERO, ZERO + + orr HASH_PTR, ctx, ctx + orr BUFFER_PTR, buf, buf + adr K_BASE, K_XMM_AR + + SHA1_PIPELINED_MAIN_BODY + + + add sp, #stack_size + vpop {q4-q5} + vpop {q6-q7} +#if KERNEL + vpop {q8-q9} + vpop {q10-q11} + vpop {q12-q13} + vpop {q14-q15} +#endif + + // restore sp to its original alignment + ldr r12, [sp] + add sp, r12 + + pop {r8-r11} + pop {r4-r7,pc} + +#endif /* _ARM_ARCH_7 */ + ADDED Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_armv7neon_sha256_compress.s Index: Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_armv7neon_sha256_compress.s ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_armv7neon_sha256_compress.s @@ -0,0 +1,806 @@ +/* + This file provides armv7+neon hand implementation of the following function + + void SHA256_Transform(SHA256_ctx *ctx, char *data, unsigned int num_blocks); + + which is a C function in sha2.c (from xnu). + + sha256 algorithm per block description: + + 1. W(0:15) = big-endian (per 4 bytes) loading of input data (64 byte) + 2. load 8 digests a-h from ctx->state + 3. for r = 0:15 + T1 = h + Sigma1(e) + Ch(e,f,g) + K[r] + W[r]; + d += T1; + h = T1 + Sigma0(a) + Maj(a,b,c) + permute a,b,c,d,e,f,g,h into h,a,b,c,d,e,f,g + 4. for r = 16:63 + W[r] = W[r-16] + sigma1(W[r-2]) + W[r-7] + sigma0(W[r-15]); + T1 = h + Sigma1(e) + Ch(e,f,g) + K[r] + W[r]; + d += T1; + h = T1 + Sigma0(a) + Maj(a,b,c) + permute a,b,c,d,e,f,g,h into h,a,b,c,d,e,f,g + + In the assembly implementation: + - a circular window of message schedule W(r:r+15) is updated and stored in q0-q3 + - its corresponding W+K(r:r+15) is updated and stored in a stack space circular buffer + - the 8 digests (a-h) will be stored in GPR or memory + + the implementation per block looks like + + ---------------------------------------------------------------------------- + + load W(0:15) (big-endian per 4 bytes) into q0:q3 + pre_calculate and store W+K(0:15) in stack + + load digests a-h from ctx->state; + + for (r=0;r<48;r+=4) { + digests a-h update and permute round r:r+3 + update W([r:r+3]%16) and WK([r:r+3]%16) for the next 4th iteration + } + + for (r=48;r<64;r+=4) { + digests a-h update and permute round r:r+3 + } + + ctx->states += digests a-h; + + ---------------------------------------------------------------------------- + + our implementation (allows multiple blocks per call) pipelines the loading of W/WK of a future block + into the last 16 rounds of its previous block: + + ---------------------------------------------------------------------------- + + load W(0:15) (big-endian per 4 bytes) into q0:q3 + pre_calculate and store W+K(0:15) in stack + +L_loop: + + load digests a-h from ctx->state; + + for (r=0;r<48;r+=4) { + digests a-h update and permute round r:r+3 + update W([r:r+3]%16) and WK([r:r+3]%16) for the next 4th iteration + } + + num_block--; + if (num_block==0) jmp L_last_block; + + for (r=48;r<64;r+=4) { + digests a-h update and permute round r:r+3 + load W([r:r+3]%16) (big-endian per 4 bytes) into q0:q3 + pre_calculate and store W+K([r:r+3]%16) in stack + } + + ctx->states += digests a-h; + + jmp L_loop; + +L_last_block: + + for (r=48;r<64;r+=4) { + digests a-h update and permute round r:r+3 + } + + ctx->states += digests a-h; + + ------------------------------------------------------------------------ + + Apple CoreOS vector & numerics + cclee 10-12-10 +*/ + +#include + +#if defined(_ARM_ARCH_7) + + // associate variables with registers or memory + + #define ctx r0 + #define data r1 + #define num_blocks [sp, #64] + + #define a r2 + #define b r3 + #define c r4 + #define d r5 + #define e r8 + #define f r9 + #define g r10 + #define h r11 + + #define K r6 + + // 2 local variables + #define t r12 + #define s lr + + // a window (16 words) of message scheule + #define W0 q0 + #define W1 q1 + #define W2 q2 + #define W3 q3 + #define zero q8 + + // circular buffer for WK[(r:r+15)%16] + #define WK(r) [sp,#(r&15)*4] + +// #define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) + + .macro Ch + mvn t, $0 // ~x + and s, $0, $1 // (x) & (y) + and t, t, $2 // (~(x)) & (z) + eor t, t, s // t = Ch(x,y,z) = (((x) & (y)) ^ ((~(x)) & (z))) + .endm + +// #define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + + .macro Maj + eor t, $1, $2 // y^z + and s, $1, $2 // y&z + and t, t, $0 // x&(y^z) + eor t, t, s // t = Maj(x,y,z) = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + .endm + +// #define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) + + // performs sigma0_256 on 4 words on a Q register + // use q6/q7 as intermediate registers + .macro sigma0 + vshr.u32 q6, $0, #7 + vshl.i32 q7, $0, #14 + vshr.u32 $0, $0, #3 + veor $0, q6 + veor $0, q7 + vshr.u32 q6, #11 + vshl.i32 q7, #11 + veor $0, q6 + veor $0, q7 + .endm + +// #define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) + + // performs sigma1_256 on 4 words on a Q register + // use q6/q7 as intermediate registers + .macro sigma1 + vshr.u32 q6, $0, #17 + vshl.i32 q7, $0, #13 + vshr.u32 $0, $0, #10 + veor $0, q6 + veor $0, q7 + vshr.u32 q6, #2 + vshl.i32 q7, #2 + veor $0, q6 + veor $0, q7 + .endm + +// #define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) + + .macro Sigma0 + ror t, $0, #2 // S32(2, (x)) + ror s, $0, #13 // S32(13, (x)) + eor t, t, s // S32(2, (x)) ^ S32(13, (x)) + ror s, s, #9 // S32(22, (x)) + eor t, t, s // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) + .endm + +// #define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + + .macro Sigma1 + ror t, $0, #6 // S32(6, (x)) + ror s, $0, #11 // S32(11, (x)) + eor t, t, s // S32(6, (x)) ^ S32(11, (x)) + ror s, s, #14 // S32(25, (x)) + eor t, t, s // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + .endm + + // per round digests update + .macro round + // ror t, $4, #6 // S32(6, (x)) + eor t, t, $4, ror #11 // S32(6, (x)) ^ S32(11, (x)) + eor t, t, $4, ror #25 // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + and s, $4, $5 // (x) & (y) + add $7, t // use h to store h+Sigma1(e) + bic t, $6, $4 // (~(x)) & (z) + eor t, t, s // t = Ch(x,y,z) = (((x) & (y)) ^ ((~(x)) & (z))) + ldr s, WK($8) // + add $7, t // t = h+Sigma1(e)+Ch(e,f,g); + ror t, $0, #2 // S32(2, (x)) + add $7, s // h = T1 + eor t, t, $0, ror #13 // S32(2, (x)) ^ S32(13, (x)) + add $3, $7 // d += T1; + eor t, t, $0, ror #22 // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) // t = Sigma0(a); + add $7, t // h = T1 + Sigma0(a); + eor t, $1, $2 // y^z + and s, $1, $2 // y&z + and t, t, $0 // x&(y^z) + eor s, s, t // t = Maj(x,y,z) = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + // add $7, s // h = T1 + Sigma0(a) + Maj(a,b,c); + .endm + + // per 4 rounds digests update and permutation + // permutation is absorbed by rotating the roles of digests a-h + .macro rounds + ror t, $4, #6 + round $0, $1, $2, $3, $4, $5, $6, $7, 0+$8 + ror t, $3, #6 + add $7, s + round $7, $0, $1, $2, $3, $4, $5, $6, 1+$8 + ror t, $2, #6 + add $6, s + round $6, $7, $0, $1, $2, $3, $4, $5, 2+$8 + ror t, $1, #6 + add $5, s + round $5, $6, $7, $0, $1, $2, $3, $4, 3+$8 + add $4, s + .endm + + .macro rounds_a + ror t, e, #6 + round a, b, c, d, e, f, g, h, 0+$0 + ror t, d, #6 + add h, s + round h, a, b, c, d, e, f, g, 1+$0 + ror t, c, #6 + add g, s + round g, h, a, b, c, d, e, f, 2+$0 + ror t, b, #6 + add f, s + round f, g, h, a, b, c, d, e, 3+$0 + add e, s + .endm + + .macro rounds_e + ror t, a, #6 + round e, f, g, h, a, b, c, d, 0+$0 + ror t, h, #6 + add d, s + round d, e, f, g, h, a, b, c, 1+$0 + ror t, g, #6 + add c, s + round c, d, e, f, g, h, a, b, 2+$0 + ror t, f, #6 + add b, s + round b, c, d, e, f, g, h, a, 3+$0 + add a, s + .endm + + // update the message schedule W and W+K (4 rounds) 16 rounds ahead in the future + .macro message_schedule + vld1.32 {q5},[K,:128]! + vext.32 q4, $0, $1, #1 // Q4 = w4:w1 + sigma0 q4 // sigma0(w4:w1) + vadd.s32 $0, q4 // w3:w0 + sigma0(w4:w1) + vext.32 q6, $2, $3, #1 // Q6 = w12:w9 + vadd.s32 $0, q6 // w3:w0 + sigma0(w4:w1) + w12:w9 + vext.64 q4, $3, zero, #1 // 0 0 w15:w14 + sigma1 q4 // Q4 = sigma1(0 0 w15:w14) + vadd.s32 $0, q4 // w3:w0 + sigma0(w4:w1) + w12:w9 + sigma1(0 0 w15:w14) + vext.64 q4, zero, $0, #1 // Q4 = (w17:w16 0 0) + sigma1 q4 // sigma1(w17:w16 0 0) + vadd.s32 $0, q4 // w19:w16 = w3:w0 + sigma0(w4:w1) + w12:w9 + sigma1(w17:w14) + add t, sp, #(($4&15)*4) + vadd.s32 q5, $0 // W+K + vst1.32 {q5},[t,:128] + .endm + + // this macro is used in the last 16 rounds of a current block + // it reads the next message (16 4-byte words), load it into 4 words W[r:r+3], computes WK[r:r+3] + // and save into stack to prepare for next block + + .macro update_W_WK + vld1.s32 {$1},[data]! + vrev32.8 $1, $1 + add t, sp, #($0*16) + vld1.s32 {q4},[K,:128]! + vadd.s32 q4, $1 + vst1.32 {q4},[t] + .endm + + .macro Update_Digits + ldr t, [ctx] + ldr s, [ctx,#4] + add a, t + add b, s + strd a, b, [ctx] + + ldr t, [ctx,#8] + ldr s, [ctx,#12] + add c, t + add d, s + strd c, d, [ctx, #8] + + ldr t, [ctx,#16] + ldr s, [ctx,#20] + add e, t + add f, s + strd e, f, [ctx, #16] + + ldr t, [ctx,#24] + ldr s, [ctx,#28] + add g, t + add h, s + strd g, h, [ctx, #24] + .endm + + .macro rounds_a_schedule_update + eor t, e, e, ror #5 // S32(6, (x)) ^ S32(11, (x)) + vld1.32 {q5},[K,:128]! + eor t, t, e, ror #19 // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + vext.32 q4, $1, $2, #1 // Q4 = w4:w1 + and s, e, f // (x) & (y) + add h, t, ror #6 // use h to store h+Sigma1(e) + bic t, g, e // (~(x)) & (z) + vshr.u32 q6, q4, #7 + eor t, t, s // t = Ch(x,y,z) = (((x) & (y)) ^ ((~(x)) & (z))) + vshl.i32 q7, q4, #14 + ldr s, WK($0) // + add h, t // t = h+Sigma1(e)+Ch(e,f,g); + eor t, a, a, ror #11 // S32(2, (x)) ^ S32(13, (x)) + add h, s // h = T1 + eor t, t, a, ror #20 // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) // t = Sigma0(a); + add d, h // d += T1; + vshr.u32 q4, q4, #3 + add h, t, ror #2 // h = T1 + Sigma0(a); + eor t, b, c // y^z + and s, b, c // y&z + veor q4, q6 + vshr.u32 q6, #11 + and t, t, a // x&(y^z) + eor s, s, t // t = Maj(x,y,z) = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + eor t, d, d, ror #5 // S32(6, (x)) ^ S32(11, (x)) + veor q4, q7 + vshl.i32 q7, #11 + + + add h, s + eor t, t, d, ror #19 // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + and s, d, e // (x) & (y) + add g, t, ror #6 // use h to store h+Sigma1(e) + + bic t, f, d // (~(x)) & (z) + veor q4, q6 + veor q4, q7 + vext.32 q6, $3, $4, #1 // Q6 = w12:w9 + vadd.s32 $1, q4 // w3:w0 + sigma0(w4:w1) + eor t, t, s // t = Ch(x,y,z) = (((x) & (y)) ^ ((~(x)) & (z))) + ldr s, WK(1+$0) // + add g, t // t = h+Sigma1(e)+Ch(e,f,g); + eor t, h, h, ror #11 // S32(2, (x)) ^ S32(13, (x)) + add g, s // h = T1 + eor t, t, h, ror #20 // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) // t = Sigma0(a); + vadd.s32 $1, q6 // w3:w0 + sigma0(w4:w1) + w12:w9 + vext.64 q4, $4, zero, #1 // 0 0 w15:w14 + add c, g // d += T1; + add g, t, ror #2 // h = T1 + Sigma0(a); + eor t, a, b // y^z + and s, a, b // y&z + and t, t, h // x&(y^z) + vshr.u32 q6, q4, #17 + vshl.i32 q7, q4, #13 + vshr.u32 q4, q4, #10 + eor s, s, t // t = Maj(x,y,z) = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + + + veor q4, q6 + veor q4, q7 + vshr.u32 q6, #2 + vshl.i32 q7, #2 + veor q4, q6 + veor q4, q7 + + eor t, c, c, ror #5 // S32(6, (x)) ^ S32(11, (x)) + add g, s + eor t, t, c, ror #19 // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + vadd.s32 $1, q4 // w3:w0 + sigma0(w4:w1) + w12:w9 + sigma1(0 0 w15:w14) + and s, c, d // (x) & (y) + add f, t, ror #6 // use h to store h+Sigma1(e) + bic t, e, c // (~(x)) & (z) + vext.64 q4, zero, $1, #1 // Q4 = (w17:w16 0 0) + eor t, t, s // t = Ch(x,y,z) = (((x) & (y)) ^ ((~(x)) & (z))) + ldr s, WK(2+$0) // + add f, t // t = h+Sigma1(e)+Ch(e,f,g); + vshr.u32 q6, q4, #17 + vshl.i32 q7, q4, #13 + vshr.u32 q4, q4, #10 + eor t, g, g, ror #11 // S32(2, (x)) ^ S32(13, (x)) + add f, s // h = T1 + eor t, t, g, ror #20 // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) // t = Sigma0(a); + add b, f // d += T1; + veor q4, q6 + veor q4, q7 + add f, t, ror #2 // h = T1 + Sigma0(a); + eor t, h, a // y^z + and s, h, a // y&z + and t, t, g // x&(y^z) + vshr.u32 q6, #2 + vshl.i32 q7, #2 + eor s, s, t // t = Maj(x,y,z) = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + + eor t, b, b, ror #5 // S32(6, (x)) ^ S32(11, (x)) + add f, s + eor t, t, b, ror #19 // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + veor q4, q6 + veor q4, q7 + + vadd.s32 $1, q4 // w19:w16 = w3:w0 + sigma0(w4:w1) + w12:w9 + sigma1(w17:w14) + + and s, b, c // (x) & (y) + add e, t, ror #6 // use h to store h+Sigma1(e) + bic t, d, b // (~(x)) & (z) + vadd.s32 q5, $1 // W+K + eor t, t, s // t = Ch(x,y,z) = (((x) & (y)) ^ ((~(x)) & (z))) + ldr s, WK(3+$0) // + add e, t // t = h+Sigma1(e)+Ch(e,f,g); + eor t, f, f, ror #11 // S32(2, (x)) ^ S32(13, (x)) + add e, s // h = T1 + eor t, t, f, ror #20 // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) // t = Sigma0(a); + add a, e // d += T1; + add e, t, ror #2 // h = T1 + Sigma0(a); + eor t, g, h // y^z + and s, g, h // y&z + and t, t, f // x&(y^z) + eor s, s, t // t = Maj(x,y,z) = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + + add t, sp, #(($0&15)*4) + add e, s + vst1.32 {q5},[t,:128] + + .endm + + .macro rounds_e_schedule_update + eor t, a, a, ror #5 // S32(6, (x)) ^ S32(11, (x)) + vld1.32 {q5},[K,:128]! + eor t, t, a, ror #19 // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + vext.32 q4, $1, $2, #1 // Q4 = w4:w1 + and s, a, b // (x) & (y) + add d, t, ror #6 // use h to store h+Sigma1(e) + bic t, c, a // (~(x)) & (z) + vshr.u32 q6, q4, #7 + eor t, t, s // t = Ch(x,y,z) = (((x) & (y)) ^ ((~(x)) & (z))) + vshl.i32 q7, q4, #14 + ldr s, WK($0) // + add d, t // t = h+Sigma1(e)+Ch(e,f,g); + eor t, e, e, ror #11 // S32(2, (x)) ^ S32(13, (x)) + add d, s // h = T1 + eor t, t, e, ror #20 // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) // t = Sigma0(a); + add h, d // d += T1; + vshr.u32 q4, q4, #3 + add d, t, ror #2 // h = T1 + Sigma0(a); + eor t, f, g // y^z + and s, f, g // y&z + veor q4, q6 + vshr.u32 q6, #11 + and t, t, e // x&(y^z) + eor s, s, t // t = Maj(x,y,z) = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + eor t, h, h, ror #5 // S32(6, (x)) ^ S32(11, (x)) + veor q4, q7 + vshl.i32 q7, #11 + + + add d, s + eor t, t, h, ror #19 // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + and s, h, a // (x) & (y) + add c, t, ror #6 // use h to store h+Sigma1(e) + bic t, b, h // (~(x)) & (z) + + veor q4, q6 + veor q4, q7 + vext.32 q6, $3, $4, #1 // Q6 = w12:w9 + vadd.s32 $1, q4 // w3:w0 + sigma0(w4:w1) + eor t, t, s // t = Ch(x,y,z) = (((x) & (y)) ^ ((~(x)) & (z))) + ldr s, WK(1+$0) // + add c, t // t = h+Sigma1(e)+Ch(e,f,g); + eor t, d, d, ror #11 // S32(2, (x)) ^ S32(13, (x)) + add c, s // h = T1 + eor t, t, d, ror #20 // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) // t = Sigma0(a); + vadd.s32 $1, q6 // w3:w0 + sigma0(w4:w1) + w12:w9 + vext.64 q4, $4, zero, #1 // 0 0 w15:w14 + add g, c // d += T1; + add c, t, ror #2 // h = T1 + Sigma0(a); + eor t, e, f // y^z + and s, e, f // y&z + and t, t, d // x&(y^z) + vshr.u32 q6, q4, #17 + vshl.i32 q7, q4, #13 + vshr.u32 q4, q4, #10 + eor s, s, t // t = Maj(x,y,z) = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + + veor q4, q6 + veor q4, q7 + vshr.u32 q6, #2 + vshl.i32 q7, #2 + veor q4, q6 + veor q4, q7 + + eor t, g, g, ror #5 // S32(6, (x)) ^ S32(11, (x)) + add c, s + eor t, t, g, ror #19 // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + vadd.s32 $1, q4 // w3:w0 + sigma0(w4:w1) + w12:w9 + sigma1(0 0 w15:w14) + and s, g, h // (x) & (y) + add b, t, ror #6 // use h to store h+Sigma1(e) + bic t, a, g // (~(x)) & (z) + vext.64 q4, zero, $1, #1 // Q4 = (w17:w16 0 0) + eor t, t, s // t = Ch(x,y,z) = (((x) & (y)) ^ ((~(x)) & (z))) + ldr s, WK(2+$0) // + add b, t // t = h+Sigma1(e)+Ch(e,f,g); + vshr.u32 q6, q4, #17 + vshl.i32 q7, q4, #13 + vshr.u32 q4, q4, #10 + eor t, c, c, ror #11 // S32(2, (x)) ^ S32(13, (x)) + add b, s // h = T1 + eor t, t, c, ror #20 // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) // t = Sigma0(a); + add f, b // d += T1; + veor q4, q6 + veor q4, q7 + add b, t, ror #2 // h = T1 + Sigma0(a); + eor t, d, e // y^z + and s, d, e // y&z + and t, t, c // x&(y^z) + vshr.u32 q6, #2 + vshl.i32 q7, #2 + eor s, s, t // t = Maj(x,y,z) = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + + eor t, f, f, ror #5 // S32(6, (x)) ^ S32(11, (x)) + add b, s + eor t, t, f, ror #19 // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + veor q4, q6 + veor q4, q7 + vadd.s32 $1, q4 // w19:w16 = w3:w0 + sigma0(w4:w1) + w12:w9 + sigma1(w17:w14) + + and s, f, g // (x) & (y) + add a, t, ror #6 // use h to store h+Sigma1(e) + bic t, h, f // (~(x)) & (z) + vadd.s32 q5, $1 // W+K + eor t, t, s // t = Ch(x,y,z) = (((x) & (y)) ^ ((~(x)) & (z))) + ldr s, WK(3+$0) // + add a, t // t = h+Sigma1(e)+Ch(e,f,g); + eor t, b, b, ror #11 // S32(2, (x)) ^ S32(13, (x)) + add a, s // h = T1 + eor t, t, b, ror #20 // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) // t = Sigma0(a); + add e, a // d += T1; + add a, t, ror #2 // h = T1 + Sigma0(a); + eor t, c, d // y^z + and s, c, d // y&z + and t, t, b // x&(y^z) + eor s, s, t // t = Maj(x,y,z) = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + add t, sp, #(($0&15)*4) + add a, s + + vst1.32 {q5},[t,:128] + .endm + + .text + + .align 4 +K256: + .long 0x428a2f98 + .long 0x71374491 + .long 0xb5c0fbcf + .long 0xe9b5dba5 + .long 0x3956c25b + .long 0x59f111f1 + .long 0x923f82a4 + .long 0xab1c5ed5 + .long 0xd807aa98 + .long 0x12835b01 + .long 0x243185be + .long 0x550c7dc3 + .long 0x72be5d74 + .long 0x80deb1fe + .long 0x9bdc06a7 + .long 0xc19bf174 + .long 0xe49b69c1 + .long 0xefbe4786 + .long 0x0fc19dc6 + .long 0x240ca1cc + .long 0x2de92c6f + .long 0x4a7484aa + .long 0x5cb0a9dc + .long 0x76f988da + .long 0x983e5152 + .long 0xa831c66d + .long 0xb00327c8 + .long 0xbf597fc7 + .long 0xc6e00bf3 + .long 0xd5a79147 + .long 0x06ca6351 + .long 0x14292967 + .long 0x27b70a85 + .long 0x2e1b2138 + .long 0x4d2c6dfc + .long 0x53380d13 + .long 0x650a7354 + .long 0x766a0abb + .long 0x81c2c92e + .long 0x92722c85 + .long 0xa2bfe8a1 + .long 0xa81a664b + .long 0xc24b8b70 + .long 0xc76c51a3 + .long 0xd192e819 + .long 0xd6990624 + .long 0xf40e3585 + .long 0x106aa070 + .long 0x19a4c116 + .long 0x1e376c08 + .long 0x2748774c + .long 0x34b0bcb5 + .long 0x391c0cb3 + .long 0x4ed8aa4a + .long 0x5b9cca4f + .long 0x682e6ff3 + .long 0x748f82ee + .long 0x78a5636f + .long 0x84c87814 + .long 0x8cc70208 + .long 0x90befffa + .long 0xa4506ceb + .long 0xbef9a3f7 + .long 0xc67178f2 + + + .globl _vng_armv7neon_sha256_compress + .private_extern _vng_armv7neon_sha256_compress +_vng_armv7neon_sha256_compress: + + // due to the change of order in the 2nd and 3rd calling argument, + // we need to switch r1/r2 to use the original code + // cclee 1-13-11 + mov r12, r1 + mov r1, r2 + mov r2, r12 + + // push callee-saved registers + push {r4-r7,lr} + add r7, sp, #12 // set up dtrace frame pointer + push {r8-r11} + + + // align sp to 16-byte boundary + ands r12, sp, #15 // bytes to align to 16-byte boundary + addeq r12, #16 // if nothing, enforce to insert 16 bytes + sub sp, r12 + str r12, [sp] + +#if KERNEL + vpush {q8} +#endif + vpush {q0-q7} +#define stack_size (16*5) // circular buffer W0-W3, extra 16 to save num_blocks + sub sp, #stack_size + + str r2, num_blocks + + veor zero, zero + + // set up pointer to table K256[] + adr K, K256 + + // load W[0:15] + vld1.s32 {W0-W1},[data]! + vld1.s32 {W2-W3},[data]! + + // load K[0:15] & per word byte swap + vrev32.8 W0, W0 + vrev32.8 W1, W1 + vld1.s32 {q4-q5}, [K,:128]! + vrev32.8 W2, W2 + vrev32.8 W3, W3 + vld1.s32 {q6-q7}, [K,:128]! + + // compute WK[0:15] and save in stack + + vadd.s32 q4, q0 + vadd.s32 q5, q1 + vadd.s32 q6, q2 + vadd.s32 q7, q3 + + vstmia sp,{q4-q7} + + // digests a-h = ctx->states; + ldmia ctx,{a-d,e-h} + +L_loop: + + // rounds 0:47 interleaved with W/WK update for rounds 16:63 +#if 1 + rounds_a_schedule_update 0,W0,W1,W2,W3 + rounds_e_schedule_update 4,W1,W2,W3,W0 + rounds_a_schedule_update 8,W2,W3,W0,W1 + rounds_e_schedule_update 12,W3,W0,W1,W2 + rounds_a_schedule_update 16,W0,W1,W2,W3 + rounds_e_schedule_update 20,W1,W2,W3,W0 + rounds_a_schedule_update 24,W2,W3,W0,W1 + rounds_e_schedule_update 28,W3,W0,W1,W2 + rounds_a_schedule_update 32,W0,W1,W2,W3 + rounds_e_schedule_update 36,W1,W2,W3,W0 + rounds_a_schedule_update 40,W2,W3,W0,W1 + rounds_e_schedule_update 44,W3,W0,W1,W2 +#else + rounds_a 0 + message_schedule W0,W1,W2,W3,16 + rounds_e 4 + message_schedule W1,W2,W3,W0,20 + rounds_a 8 + message_schedule W2,W3,W0,W1,24 + rounds_e 12 + message_schedule W3,W0,W1,W2,28 + rounds_a 16 + message_schedule W0,W1,W2,W3,32 + rounds_e 20 + message_schedule W1,W2,W3,W0,36 + rounds_a 24 + message_schedule W2,W3,W0,W1,40 + rounds_e 28 + message_schedule W3,W0,W1,W2,44 + rounds_a 32 + message_schedule W0,W1,W2,W3,48 + rounds_e 36 + message_schedule W1,W2,W3,W0,52 + rounds_a 40 + message_schedule W2,W3,W0,W1,56 + rounds_e 44 + message_schedule W3,W0,W1,W2,60 +#endif + + // revert K to the beginning of K256[] + ldr t, num_blocks + sub K, #256 + + subs t, #1 // num_blocks-- + beq L_final_block // if final block, wrap up final rounds + str t, num_blocks + + // rounds 48:63 interleaved with W/WK initialization for next block rounds 0:15 + rounds_a 48 + update_W_WK 0, W0 + rounds_e 52 + update_W_WK 1, W1 + rounds_a 56 + update_W_WK 2, W2 + rounds_e 60 + update_W_WK 3, W3 + + // ctx->states += digests a-h + Update_Digits + + // digests a-h = ctx->states; + ldmia ctx,{a-d,e-h} + + bal L_loop // branch for next block + + // wrap up digest update round 48:63 for final block +L_final_block: + rounds_a 48 + rounds_e 52 + rounds_a 56 + rounds_e 60 + + // ctx->states += digests a-h + Update_Digits + + // free allocated stack memory + add sp, #stack_size + + // if kernel, restore q0-q8 + vpop {q0-q1} + vpop {q2-q3} + vpop {q4-q5} + vpop {q6-q7} +#if KERNEL + vpop {q8} +#endif + + // dealign sp from the 16-byte boundary + ldr r12, [sp] + add sp, r12 + + // restore callee-save registers and return + pop {r8-r11} + pop {r4-r7,pc} + +#endif /* _ARM_ARCH_7 */ ADDED Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha224.c Index: Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha224.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha224.c @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* Adapted from LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +/** + @param sha224.c + vng_neon_SHA-224 new NIST standard based off of vng_neon_SHA-256 truncated to 224 bits (Tom St Denis) +*/ + +const ccDescriptor vng_neon_sha224_desc = +{ + .implementation_info = &cc_sha224_impinfo, + .dtype.digest.hashsize = CC_SHA224_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA224_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = &vng_neon_sha224_init, + .dtype.digest.process = &vng_neon_sha256_process, + .dtype.digest.done = &vng_neon_sha224_done, +}; + + +/* init the sha256 er... sha224 state ;-) */ +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int vng_neon_sha224_init(vng_neon_sha256_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + // ctx->curlen = 0; + ctx->length = 0; + ctx->state[0] = 0xc1059ed8UL; + ctx->state[1] = 0x367cd507UL; + ctx->state[2] = 0x3070dd17UL; + ctx->state[3] = 0xf70e5939UL; + ctx->state[4] = 0xffc00b31UL; + ctx->state[5] = 0x68581511UL; + ctx->state[6] = 0x64f98fa7UL; + ctx->state[7] = 0xbefa4fa4UL; + + return CRYPT_OK; +} + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (28 bytes) + @return CRYPT_OK if successful +*/ +int vng_neon_sha224_done(vng_neon_sha256_ctx *ctx, unsigned char *out) +{ + unsigned char buf[32]; + int err; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + err = vng_neon_sha256_done(ctx, buf); + CC_XMEMCPY(out, buf, 28); + return err; +} + ADDED Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha224.h Index: Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha224.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha224.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * vng_neon_sha224.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include + +#if defined(_ARM_ARCH_7) + +#ifndef _VNG_NEON_SHA224_H_ +#define _VNG_NEON_SHA224_H_ + +/* + * Note that vng_neon_sha256 is required for vng_neon_sha224. + */ + +#define VNG_NEON_SHA224_HASHSIZE 28 +#define VNG_NEON_SHA224_BLOCKSIZE 64 + +int vng_neon_sha224_init(vng_neon_sha256_ctx *ctx); +#define vng_neon_sha224_process vng_neon_sha256_process +int vng_neon_sha224_done(vng_neon_sha256_ctx *ctx, unsigned char *hash); + +#endif /* _VNG_NEON_SHA224_H_ */ +#endif /* _ARM_ARCH_7 */ ADDED Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha256.c Index: Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha256.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha256.c @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include + +#if defined(_ARM_ARCH_7) + +#include +#include "vng_neon_sha256.h" +#include "vng_neon_sha224.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" + +/** + @file vng_neon_sha256.c + vng_neon_SHA256 by Tom St Denis +*/ + +const ccDescriptor vng_neon_sha256_desc = +{ + .implementation_info = &cc_sha256_impinfo, + .dtype.digest.hashsize = CC_SHA256_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA256_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = &vng_neon_sha256_init, + .dtype.digest.process = &vng_neon_sha256_process, + .dtype.digest.done = &vng_neon_sha256_done, +}; + + +#ifdef LTC_SMALL_CODE +/* the K array */ +static const ulong32 K[64] = { + 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL, + 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL, + 0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, + 0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, + 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL, + 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL, + 0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, + 0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, + 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL, + 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL, + 0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, + 0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, + 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL +}; +#endif + +/* Various logical functions */ +#define Ch(x,y,z) (z ^ (x & (y ^ z))) +#define Maj(x,y,z) (((x | y) & z) | (x & y)) +#define S(x, n) LTC_RORc((x),(n)) +#define R(x, n) (((x)&0xFFFFFFFFUL)>>(n)) +#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) +#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) +#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3)) +#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) + + +#define FULLLENGTH_MASK 0xffffffffffffffc0 +#define BUFFLENGTH_MASK 0x3f +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int vng_neon_sha256_init(vng_neon_sha256_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->length = 0; + ctx->state[0] = 0x6A09E667UL; + ctx->state[1] = 0xBB67AE85UL; + ctx->state[2] = 0x3C6EF372UL; + ctx->state[3] = 0xA54FF53AUL; + ctx->state[4] = 0x510E527FUL; + ctx->state[5] = 0x9B05688CUL; + ctx->state[6] = 0x1F83D9ABUL; + ctx->state[7] = 0x5BE0CD19UL; + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +int vng_neon_sha256_process(vng_neon_sha256_ctx *ctx, const unsigned char *in, unsigned long inlen) +{ + unsigned long n; + int err; + int fullblocks, remainder, processed; + uint64_t curlen; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(in != NULL); + + curlen = ctx->length & BUFFLENGTH_MASK; + + if ((ctx->length + inlen) < ctx->length) { + return CRYPT_HASH_OVERFLOW; + } + + while (inlen > 0) { + if (curlen == 0 && inlen >= VNG_NEON_SHA256_BLOCKSIZE && CC_XALIGNED(in, 4)) { + fullblocks = inlen / VNG_NEON_SHA256_BLOCKSIZE; + remainder = inlen % VNG_NEON_SHA256_BLOCKSIZE; + processed = fullblocks * VNG_NEON_SHA256_BLOCKSIZE; + vng_armv7neon_sha256_compress (ctx->state, fullblocks, in); + ctx->length += VNG_NEON_SHA256_BLOCKSIZE * 8 * fullblocks; + in += processed; + inlen -= processed; + } else { + n = MIN(inlen, (VNG_NEON_SHA256_BLOCKSIZE - curlen)); + memcpy(ctx->buf + curlen, in, (size_t)n); + curlen += n; in += n; inlen -= n; + if (curlen == VNG_NEON_SHA256_BLOCKSIZE) { + vng_armv7neon_sha256_compress (ctx->state, 1, ctx->buf); + ctx->length += 8*VNG_NEON_SHA256_BLOCKSIZE; + curlen = 0; + } + } + } + + ctx->length = (ctx->length & FULLLENGTH_MASK) + curlen; + + return CRYPT_OK; +} + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (32 bytes) + @return CRYPT_OK if successful +*/ +int vng_neon_sha256_done(vng_neon_sha256_ctx *ctx, unsigned char *out) +{ + int i; + uint64_t curlen; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + curlen = ctx->length & BUFFLENGTH_MASK; + ctx->length &= FULLLENGTH_MASK; + + /* increase the length of the message */ + ctx->length += curlen * 8; + + /* append the '1' bit */ + ctx->buf[curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (curlen > 56) { + while (curlen < 64) { + ctx->buf[curlen++] = (unsigned char)0; + } + vng_armv7neon_sha256_compress (ctx->state, 1, ctx->buf); + + curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (curlen < 56) { + ctx->buf[curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64H(ctx->length, ctx->buf+56); + vng_armv7neon_sha256_compress (ctx->state, 1, ctx->buf); + + /* copy output */ + for (i = 0; i < 8; i++) { + LTC_STORE32H(ctx->state[i], out+(4*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(ctx, sizeof(hash_state)); +#endif + return CRYPT_OK; +} + + +#include "vng_neon_sha224.c" + +#endif /* _ARM_ARCH_7 */ ADDED Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha256.h Index: Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha256.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_neon_sha2_descriptor/vng_neon_sha256.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * vng_neon_sha256.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include + +#if defined(_ARM_ARCH_7) +#include + +#ifndef _VNG_NEON_SHA256_H_ +#define _VNG_NEON_SHA256_H_ + +#define VNG_NEON_SHA256_HASHSIZE 32 +#define VNG_NEON_SHA256_BLOCKSIZE 64 + +typedef struct vng_neon_sha256_state { + uint64_t length; + uint32_t state[8]; + unsigned char buf[VNG_NEON_SHA256_BLOCKSIZE]; +} vng_neon_sha256_ctx; + +int vng_neon_sha256_init(vng_neon_sha256_ctx *ctx); +int vng_neon_sha256_process(vng_neon_sha256_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int vng_neon_sha256_done(vng_neon_sha256_ctx *ctx, unsigned char *hash); +void vng_armv7neon_sha256_compress(void *c, unsigned long num, const void *p); + +#endif /* _VNG_NEON_SHA256_H_ */ +#endif /* _ARM_ARCH_7 */ ADDED Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1.c Index: Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1.c @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ + + +#if defined (__x86_64__) || defined(__i386__) // x86_64 or i386 architectures + +#include +#include "vng_x86_sha1.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" + +/** + @file vng_x86_sha1.c + original LTC_SHA1 code by Tom St Denis + optimized compress function by the Vector and Numerics Group +*/ + + +const ccDescriptor vng_x86_sha1_desc = +{ + .implementation_info = &cc_sha1_impinfo, + .dtype.digest.hashsize = CC_SHA1_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA1_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = &vng_x86_sha1_init, + .dtype.digest.process = &vng_x86_sha1_process, + .dtype.digest.done = &vng_x86_sha1_done, +}; + + +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int vng_x86_sha1_init(vng_x86_sha1_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->state[0] = 0x67452301UL; + ctx->state[1] = 0xefcdab89UL; + ctx->state[2] = 0x98badcfeUL; + ctx->state[3] = 0x10325476UL; + ctx->state[4] = 0xc3d2e1f0UL; + CC_XZEROMEM(ctx->buf, CC_SHA1_BLOCK_BYTES); + ctx->curlen = 0; + ctx->length = 0; + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +int vng_x86_sha1_process(vng_x86_sha1_ctx *ctx, const unsigned char *in, unsigned long inlen) +{ + unsigned long n; + int err; + int fullblocks, remainder, processed; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(in != NULL); + + if (ctx->curlen > sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + if ((ctx->length + inlen) < ctx->length) { + return CRYPT_HASH_OVERFLOW; + } + + while (inlen > 0) { + if (ctx->curlen == 0 && inlen >= VNG_X86_SHA1_BLOCKSIZE && CC_XALIGNED(in, 4)) { + fullblocks = inlen / VNG_X86_SHA1_BLOCKSIZE; + // remainder = inlen % VNG_X86_SHA1_BLOCKSIZE; + processed = fullblocks * VNG_X86_SHA1_BLOCKSIZE; + sha1_x86_compress_data_order (ctx->state, in, fullblocks); + ctx->length += processed * 8; + in += processed; + inlen -= processed; + } else { + n = MIN(inlen, (VNG_X86_SHA1_BLOCKSIZE - ctx->curlen)); + CC_XMEMCPY(ctx->buf + ctx->curlen, in, n); + ctx->curlen += n; in += n; inlen -= n; + if (ctx->curlen == VNG_X86_SHA1_BLOCKSIZE) { + sha1_x86_compress_data_order (ctx->state, ctx->buf, 1); + ctx->length += 8*VNG_X86_SHA1_BLOCKSIZE; + ctx->curlen = 0; + } + } + } + + return CRYPT_OK; +} + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (20 bytes) + @return CRYPT_OK if successful +*/ +int vng_x86_sha1_done(vng_x86_sha1_ctx *ctx, unsigned char *out) +{ + int i; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + if (ctx->curlen >= sizeof(ctx->buf)) { + return CRYPT_INVALID_ARG; + } + + /* increase the length of the message */ + ctx->length += ctx->curlen * 8; + + /* append the '1' bit */ + ctx->buf[ctx->curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (ctx->curlen > 56) { + while (ctx->curlen < 64) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + sha1_x86_compress_data_order(ctx->state, ctx->buf, 1); + ctx->curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (ctx->curlen < 56) { + ctx->buf[ctx->curlen++] = (unsigned char)0; + } + + /* store length */ + CC_XSTORE64H(ctx->length, ctx->buf+56); + sha1_x86_compress_data_order(ctx->state, ctx->buf, 1); + + /* copy output */ + for(i=0; i<5; i++, out+=4) CC_XSTORE32H(ctx->state[i], out); + + return CRYPT_OK; +} +#endif /* x86 */ ADDED Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1.h Index: Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * vng_x86_sha1.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2011 Apple Inc. All rights reserved. + * + */ + +#include + +#if defined (__x86_64__) || defined(__i386__) // x86_64 or i386 architectures + +#ifndef _VNG_X86_SHA1_H_ +#define _VNG_X86_SHA1_H_ + +#define VNG_X86_SHA1_HASHSIZE 20 +#define VNG_X86_SHA1_BLOCKSIZE 64 + +// Adjusted to take the same space as CC_SHA1_CTX +// The order is important on a 64 bit system so that +// the length variable is 64 bit aligned. + +typedef struct vng_x86_sha1_state { + uint32_t state[5]; // 20 + uint32_t curlen; // 4 + uint64_t length; // 8 + unsigned char buf[VNG_X86_SHA1_BLOCKSIZE]; // 64 +} vng_x86_sha1_ctx; + +int vng_x86_sha1_init(vng_x86_sha1_ctx *ctx); +int vng_x86_sha1_process(vng_x86_sha1_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int vng_x86_sha1_done(vng_x86_sha1_ctx *ctx, unsigned char *hash); + +// I think the x86 version takes the blocks as the third argument. +void sha1_x86_compress_data_order(uint32_t state[], unsigned char *, unsigned long nblocks); +#endif /* x86 */ +#endif /* _VNG_X86_SHA1_H_ */ + ADDED Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1BE.s Index: Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1BE.s ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1BE.s @@ -0,0 +1,1471 @@ +/* + * Copyright (c) 2011 Apple Computer, Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* sha1edp.s : this file provides optimized x86_64 and i386 implementation of the sha1 function + CoreOS - vector and numerics group + cclee 6-21-10 + + The implementation is based on the principle described in an Intel online article + "Improving the Performance of the Secure Hash Algorithm (SHA-1)" + http://software.intel.com/en-us/articles/improving-the-performance-of-the-secure-hash-algorithm-1/ + + + Update HASH[] by processing a one 64-byte block in MESSAGE[] can be represented by the following C function + +void SHA1( int HASH[], int MESSAGE[] ) +{ + int A[81], B[81], C[81], D[81], E[81]; + int W[80]; + + int i, FN; + + A[0] = HASH[0]; + B[0] = HASH[1]; + C[0] = HASH[2]; + D[0] = HASH[3]; + E[0] = HASH[4]; + + for ( i=0; i<80; ++i ) + { + if ( i < 16 ) + W[i] = BIG_ENDIAN_LOAD( MESSAGE[i] ); + else + W[i] = ROTATE_LEFT( W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1 ); + + FN = F( i, B[i], C[i], D[i] ); + + A[i+1] = FN + E[i] + ROTATE_LEFT( A[i], 5 ) + W[i] + K(i); + B[i+1] = A[i]; + C[i+1] = ROTATE_LEFT( B[i], 30 ); + D[i+1] = C[i]; + E[i+1] = D[i]; + } + + HASH[0] += A[80]; + HASH[1] += B[80]; + HASH[2] += C[80]; + HASH[3] += D[80]; + HASH[4] += E[80]; +} + + For i=0:15, W[i] is simply big-endian loading of MESSAGE[i]. For i=16:79, W[i] is updated according to W[i] = ROTATE_LEFT( W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1 ); + + The approach (by Dean Gaudet) can be used to vectorize the computation of W[i] for i=16:79, + + 1. done on 4 consequtive W[i] values in a single XMM register + W[i ] = (W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]) rol 1 + W[i+1] = (W[i-2] ^ W[i-7] ^ W[i-13] ^ W[i-15]) rol 1 + W[i+2] = (W[i-1] ^ W[i-6] ^ W[i-12] ^ W[i-14]) rol 1 + W[i+3] = ( 0 ^ W[i-5] ^ W[i-11] ^ W[i-13]) rol 1 + + 2. this additional calculation unfortunately requires many additional operations + W[i+3] ^= W[i] rol 1 + + 3. once we have 4 W[i] values in XMM we can also add four K values with one instruction + W[i:i+3] += {K,K,K,K} + + Let W0 = {W[i] W[i+1] W[i+2] W[i+3]} be the current W-vector to be computed, W4 = {W[i-4] W[i-3] W[i-2] W[i-1]} be the previous vector, and so on + The Dean Gaudet approach can be expressed as + + 1. W0 = rotate_left(left_shift(W4,32) ^ W8 ^ left_shift(concatenate(W16,W12),64) ^ W16,1); + 2. W[i+3] ^= W[i] rol 1 + 3. W0 += {K,K,K,K} + + For i>=32, the Intel online article suggests that (using a basic identity (X rol 1) rol 1 = X rol 2) the update equation is equivalent to + + 1. W0 = rotate_left(left_shift(concatenate(W8,W4),64) ^ W16 ^ W28 ^ W32, 2); + + Note: + 1. In total, we need 8 16-byte registers or memory for W0,W4,...,W28. W0 and W32 can be the same register or memory. + 2. The registers are used in a circular buffering mode. For example, we start with W28,W24,...,W0 (with W0 indicating the most recent 16-byte) + i=0, W28,W24,...,W0 + i=4, W24,W20,...,W28 + i=8, W20,W16,...,W24 + . + . + and so forth. + 3. 2 ssse3 instructions are used in the Intel article, pshufb and palignr. + a. pshufb is used to simplify the BIG_ENDIAN_LOAD operation + b. palignr is used to simplify the computation of left_shift(concatenate(W12,W8),64) + 4. we probe __cpu_capabilities to detect ssse3 support and dispatch code with ssse3 support when available. + If ssse3 is not supported, a suboptimal code (pshufb and palignr workaround) is dispatched. + +*/ + +/* the code can be compiled into single block (64 bytes) per call mode by setting Multiple_blocks to 0 */ +#define Multiple_Blocks 1 + +#if defined (__x86_64__) || defined(__i386__) // x86_64 or i386 architectures + +#if defined(__x86_64__) + + // set up for x86_64 +#define stack_size (8+16*11+16*4) // 8 (alignedment) + x0-x10 + 4 128-bits for intermediate WK(t) storage +#define sp %rsp // unifying architectural stack pointer representation +#define ctx %rdi // 1st input argument, will move to HASH_PTR (%r9) +#define buf %rsi // 2nd input argument, will move to BUFFER_PTR (%r10) +#define cnt %r11 // will copy from the 3rd input argument (%rdx) +#define K_BASE %r8 // an aligned pointer to point to shufb reference numbers of table of K values +#define HASH_PTR %r9 // pointer to Hash values (A,B,C,D,E) +#define BUFFER_PTR %r10 // pointer to input blocks + +#else // !__x86_64__ + + // set up for i386 +#define stack_size (12+16*2+16*11+16*4) // 12-bytes (alignment) + extra 2 + 3 (W24/W28/XMM_SHUFB_BSWAP) + 8 (xmm0-xmm7) + 4 (WK(t)) +#define sp %esp // unifying architectural stack pointer representation +#define HASH_PTR stack_size+16+4(sp) // use 1st input argument from caller function, 16 for (esi/edi/ebx/ebp) +#define BUFFER_PTR stack_size+16+8(sp) // use 2nd input argument from caller function +#define cnt stack_size+16+12(sp) // use 3rd input argument from caller function +#define K_BASE stack_size-4(sp) // use for K_BASE + +#endif // __x86_64__ + +// symbolizing registers or stack memory with algorithmic variables W0,W4,...,W28 + W_TMP, W_TMP2, and XMM_SHUFB_BSWAP for code with ssse3 support + +#define W_TMP %xmm0 +#define W_TMP2 %xmm1 +#define W0 %xmm2 +#define W4 %xmm3 +#define W8 %xmm4 +#define W12 %xmm5 +#define W16 %xmm6 +#define W20 %xmm7 +#if defined(__x86_64__) +#define W24 %xmm8 +#define W28 %xmm9 +#define XMM_SHUFB_BSWAP %xmm10 // used only when ssse3 is supported +#else // defined (__i386__) +#define W24 12*16(sp) +#define W28 13*16(sp) +#define XMM_SHUFB_BSWAP 14*16(sp) // used only when ssse3 is supported +#endif + +#define xmov movaps // aligned 16-byte move +#define xmovu movups // unaligned 16-byte move + +// intermediate hash variables +#define A %ecx +#define B %esi +#define C %edi +#define D %ebp +#define E %edx + +// temp variables +#define T1 %eax +#define T2 %ebx + +#define WK(t) (t&15)*4(sp) + + // int F1(int B, int C, int D) { return (D ^ ( B & (C ^ D)); } + // result in T1 + .macro F1 + mov $1, T1 + xor $2, T1 + and $0, T1 + xor $2, T1 + .endm + + // int F2(int B, int C, int D) { return (D ^ B ^ C); } + // result in T1 + .macro F2 + mov $2, T1 + xor $1, T1 + xor $0, T1 + .endm + + // int F3(int B, int C, int D) { return (B & C) | (D & (B ^ C)); } + // result in T1 + .macro F3 + mov $1, T1 + mov $0, T2 + or $0, T1 + and $1, T2 + and $2, T1 + or T2, T1 + .endm + + // for i=60:79, F4 is identical to F2 + #define F4 F2 + + + /* + i=0:15, W[i] = BIG_ENDIAN_LOAD(MESSAGE[i]); + + with ssse3 support, this is achived via + for (i=0;i<16;i+=4) { + 1. W_TMP = new 16 bytes from MESSAGE[] + 2. W_TMP = pshufb(W_TMP, XMM_SHUFB_BSWAP); save to W circular buffer for updating W + 3. WTMP += {K,K,K,K}; + 4. save quadruple W[i]+K[i] = W_TMP in the stack memory; + } + + each step is represented in one of the following 4 macro definitions + + */ + + .macro W_PRECALC_00_15_0 // input argument $0 : 0/4/8/12 +#if defined (__x86_64__) // BUFFER_PTR is already an address register in x86_64 + xmovu $0*4(BUFFER_PTR), W_TMP // read 16-bytes into W_TMP, BUFFER_PTR possibly not 16-byte aligned +#else // BUFFER_PTR is from the argument set up in the caller + mov BUFFER_PTR, T1 // T1 = BUFFER_PTR + xmovu $0*4(T1), W_TMP // read 16-bytes into W_TMP, BUFFER_PTR possibly not 16-byte aligned +#endif + .endm + + .macro W_PRECALC_00_15_1 // input argument $0 : current 16-bytes in the circular buffer, one of W0,W4,W8,...,W28 + xmov W_TMP, $0 // save W_TMP in the circular buffer + .endm + + .macro W_PRECALC_00_15_2 // K_BASE points to the current K quadruple. +#if defined (__x86_64__) // K_BASE is already an address register in x86_64 + paddd (K_BASE), W_TMP // W_TMP += {K,K,K,K}; +#else // K_BASE is previously set up in the stack memory + mov K_BASE, T1 // T1 = K_BASE + paddd (T1), W_TMP // W_TMP += {K,K,K,K}; +#endif + .endm + + .macro W_PRECALC_00_15_3 + xmov W_TMP, WK($0&~3) // save quadruple W[i]+K in the stack memory, which would be used later for updating the hashes A/B/C/D/E + .endm + + // rounds 16-31 compute W[0] using the vectorization approach by Dean Gaudet + /* + W[i ] = (W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]) rol 1 + W[i+1] = (W[i-2] ^ W[i-7] ^ W[i-13] ^ W[i-15]) rol 1 + W[i+2] = (W[i-1] ^ W[i-6] ^ W[i-12] ^ W[i-14]) rol 1 + W[i+3] = ( 0 ^ W[i-5] ^ W[i-11] ^ W[i-13]) rol 1 + + W[i+3] ^= W[i] rol 1; // this W[i] is already rol by 1, if we are taking from the intial W before rol 1, we should rol this by 2 + + The operation (updating W and W+K) is scheduled as and divided into 4 steps + + 0. W_tmp = W3; W = W14 ^ W8 + 1. W = W3 ^ W8 ^ W14 ^ W16; W_TMP = W; W_TMP2 = (W[i] 0 0 0); + 2. W_TMP = (W3 ^ W8 ^ W14 ^ W16) rol 1; split (W[i] 0 0 0) rol 2 in W_TMP2 and W + 3. W = W_TMP = W_TMP ^ W_TMP2 ^ W = (W3 ^ W8 ^ W14 ^ W16) rol 1 ^ (W[i] 0 0 0) rol 2; WK = W _TMP+K; + + */ + + .macro W_PRECALC_16_31_0_ssse3 // input arguments : W16,W12,W8,W4,W + xmov $1, $4 // W = W12 + palignr $$8, $0, $4 // W = W14 + xmov $3, W_TMP // W_TMP = W4 + psrldq $$4, W_TMP // W_TMP = W3 + pxor $2, $4 // W = W8 ^ W14 + .endm + + .macro W_PRECALC_16_31_1 // input arguments : W16,W + pxor $0, W_TMP // W_TMP = W3 ^ W16 + pxor W_TMP, $1 // W = W3 ^ W16 ^ W8 ^ W14 + xmov $1, W_TMP2 // W_TMP2 = W3 ^ W16 ^ W8 ^ W14 + xmov $1, W_TMP // W_TMP = W3 ^ W16 ^ W8 ^ W14 + pslldq $$12, W_TMP2 // W_TMP2 = (W[i] 0 0 0) + .endm + + .macro W_PRECALC_16_31_2 // input argument : W + psrld $$31, $0 // (W3 ^ W16 ^ W8 ^ W14)>>31 + pslld $$1, W_TMP // (W3 ^ W16 ^ W8 ^ W14)<<1 + por $0, W_TMP // W_TMP = (W3 ^ W16 ^ W8 ^ W14) rol 1 + xmov W_TMP2, $0 // copy W[i] at location of W[i+3] + psrld $$30, W_TMP2 // W_TMP2 = W[i] lower 2 bits after rol 2 + pslld $$2, $0 // W = W[i] higher 30 bits after rol 2 + .endm + + .macro W_PRECALC_16_31_3 // input arguments: W, i, K_XMM +#if defined (__i386__) + mov K_BASE, T1 // K_BASE is store in the stack memory for i386 +#endif + pxor $0, W_TMP + pxor W_TMP2, W_TMP // W_TMP = (W3 ^ W16 ^ W8 ^ W14) rol 1 ^ (W[i] 0 0 0) rol 2 + xmov W_TMP, $0 // save W = W_TMP in the W circular buffer +#if defined (__x86_64__) + paddd $2(K_BASE), W_TMP // W+K +#else + paddd $2(T1), W_TMP // W+K +#endif + xmov W_TMP, WK($1&~3) // save WK = W+K for later update of the hashes A/B/C/D/E + .endm + + // the following is a variant of W_PRECALC_16_31_0_ssse3 to be used for system without ssse3, palignr is replaced with 4 instructions + + .macro W_PRECALC_16_31_0_nossse3 // input arguments : W16,W12,W8,W4,W + xmov $1, $4 // W = W12 = (w9 w10 w11 w12) + + // the following is a wrokaround for palignr + xmov $0, W_TMP // W16 = (w13 w14 w15 w16) + pslldq $$8, $4 // shift left to make (w11 w12 0 0) + psrldq $$8, W_TMP // shift right to make (0 0 w13 w14) + por W_TMP, $4 // W = W14 = (w11 w12 w13 w14) + + xmov $3, W_TMP // W_TMP = W4 = (w1 w2 w3 w4) + psrldq $$4, W_TMP // W_TMP = W3 = (0 w1 w2 w3) + pxor $2, $4 // W = W8 ^ W14 + .endm + + /* rounds 32-79 compute W und W+K iusing the vectorization approach from the Intel article + + W = rotate_left(left_shift(concatenate(W8,W4),64) ^ W16 ^ W28 ^ W32, 2); + + where left_shift(concatenate(W8,W4),64) is equivalent to W6. Note also that W32 and W use the same register. + + + 0. W_tmp = W6; W = W28 ^ W32; + 1. W = W_tmp = W6 ^ W16 ^ W28 ^ W32; + 2. W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2; + 3. W = W_Tmp; WK = W_tmp + K; + + */ + + + .macro W_PRECALC_32_79_0_ssse3 // inputr arguments : W28,W8,W4,W + xmov $2, W_TMP // (w1 w2 w3 w4) + pxor $0, $3 // W = W28 ^ W32; + palignr $$8, $1, W_TMP // W_tmp = (w3 w4 w5 w6) = W6; + .endm + + // the following is a variant and will be used for system without ssse3 support + .macro W_PRECALC_32_79_0_nossse3 // input arguments : W28,W8,W4,W + xmov $2, W_TMP // (w1 w2 w3 w4) + xmov $1, W_TMP2 // (w5 w6 w7 w8) + pxor $0, $3 // W = W28 ^ W32 + pslldq $$8, W_TMP // (w3 w4 0 0) + psrldq $$8, W_TMP2 // (0 0 w5 w6) + por W_TMP2, W_TMP // W_tmp = (w3 w4 w5 w6) = W6 + .endm + + // this is a variant of W_PRECALC_32_79_0_ssse3 for i386 (as W24/W28 are stored in memory, not in registers) + .macro W_PRECALC_32_79_0_i386_ssse3 // input arguments : W28,W8,W4,W + xmov $3, W_TMP // W32 + pxor $0, W_TMP // W28 ^ W32 + xmov W_TMP, $3 // W = W28 ^ W32; + xmov $2, W_TMP // W4 + palignr $$8, $1, W_TMP // W_tmp = (w3 w4 w5 w6) = W6; + .endm + + // this is a variant of W_PRECALC_32_79_0_nossse3 for i386 (as W24/W28 are stored in memory, not in registers) + .macro W_PRECALC_32_79_0_i386_nossse3 // input arguments : W28,W8,W4,W + xmov $3, W_TMP // W32 + pxor $0, W_TMP // W28 ^ W32 + xmov W_TMP, $3 // W = W28 ^ W32 + xmov $2, W_TMP // W4 = (w1 w2 w3 w4) + xmov $1, W_TMP2 // W8 = (w5 w6 w7 w8) + pslldq $$8, W_TMP // (w3 w4 0 0) + psrldq $$8, W_TMP2 // (0 0 w5 w6) + por W_TMP2, W_TMP // W_tmp = (w3 w4 w5 w6) = W6 + .endm + + .macro W_PRECALC_32_79_1 // input arguments : W16,W + pxor $0, W_TMP // W_tmp = W6 ^ W16 + pxor $1, W_TMP // W_tmp = W6 ^ W16 ^ W28 ^ W32 + xmov W_TMP, $1 // W = W_tmp = W6 ^ W16 ^ W28 ^ W32 + .endm + + .macro W_PRECALC_32_79_2 // input argument : W + psrld $$30, $0 // W >> 30 + pslld $$2, W_TMP // W << 2 + por $0, W_TMP // W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2 + .endm + + // this is a variant of W_PRECALC_32_79_2 for i386 (as W24/W28 are stored in memory, not in registers) + // this should be used when the input is either W24 or W28 on i386 architecture + .macro W_PRECALC_32_79_2_i386 // input argument : W + xmov $0, W_TMP2 // W + psrld $$30, W_TMP2 // W >> 30 + xmov W_TMP2, $0 // save (W >> 30) at W + pslld $$2, W_TMP // W_tmp << 2 + por $0, W_TMP // W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2 + .endm + + .macro W_PRECALC_32_79_3 // input argument W, i, K_XMM +#if defined (__x86_64__) + xmov W_TMP, $0 // W = (W6 ^ W16 ^ W28 ^ W32) rol 2 + paddd $2(K_BASE), W_TMP // W + K + xmov W_TMP, WK($1&~3) // write W+K +#else + mov K_BASE, T1 // T1 = K_BASE (which is in the caller argument) + xmov W_TMP, $0 // W = (W6 ^ W16 ^ W28 ^ W32) rol 2 + paddd $2(T1), W_TMP // W_tmp = W + K + xmov W_TMP, WK($1&~3) // write WK +#endif + .endm + + + /* The hash update operation is completed by the following statements. + + A[i+1] = FN + E[i] + ROTATE_LEFT( A[i], 5 ) + WK(i); + B[i+1] = A[i]; + C[i+1] = ROTATE_LEFT( B[i], 30 ); + D[i+1] = C[i]; + E[i+1] = D[i]; + + Suppose we start with A0,B0,C0,D0,E0. The 1st iteration can be expressed as follows: + + A1 = FN + E0 + rol(A0,5) + WK; + B1 = A0; + C1 = rol(B0, 30); + D1 = C0; + E1 = D0; + + to avoid excessive memory movement between registers, + 1. A1 = FN + E0 + rol(A0,5) + WK; can be temporarily saved in E0, + 2. C1 = rol(B0,30) can be temporarily saved in B0. + + Therefore, ignoring the time index, the update operation is equivalent to + 1. E = FN(B,C,D) + E + rol(A,5) + WK(i) + 2. B = rol(B,30) + 3. the hashes are now stored in the order of E,A,B,C,D + + + To pack 2 hash update operations in 1 iteration, starting with A,B,C,D,E + 1. E = FN(B,C,D) + E + rol(A,5) + WK(i) + 2. B = rol(B,30) + // now the hashes are in the order of E,A,B,C,D + 3. D = FN(A,B,C) + D + rol(E,5) + WK(i+1) + 4. A = rol(A,30) + // now the hashes are in the order of D,E,A,B,C + + These operations are distributed into the following 2 macro definitions RR0 and RR1. + + */ + + .macro RR0 // input arguments : FN, A, B, C, D, E, i + $0 $2, $3, $4 // T1 = FN(B,C,D) + add WK($6), $5 // E + WK(i) + rol $$30, $2 // B = rol(B,30) + mov $1, T2 // T2 = A + add WK($6+1), $4 // D + WK(i+1) + rol $$5, T2 // rol(A,5) + add T1, $5 // E = FN(B,C,D) + E + WK(i) + .endm + + .macro RR1 + add $5, T2 // T2 = FN(B,C,D) + E + rol(A,5) + WK(i) + mov T2, $5 // E = FN(B,C,D) + E + rol(A,5) + WK(i) + rol $$5, T2 // rol(E,5) + add T2, $4 // D + WK(i+1) + rol(E,5) + $0 $1, $2, $3 // FN(A,B,C) + add T1, $4 // D = FN(A,B,C) + D + rol(E,5) + WK(i+1) + rol $$30, $1 // A = rol(A,30) + .endm + + + + /* + + The following macro definitions are used to expand code for the per-block sha1 operation. + + INITIAL_W_PRECALC_ssse3 : BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack memory + INTERNAL_ssse3 : updating W (16:79) and update the digests A/B/C/D/E (i=0:63, based on W+K stored in the stack memory) + ENDING : finishing up update the digests A/B/C/D/E (i=64:79) + + For multiple-block sha1 operation (Multiple_Blocks = 1), INITIAL_W_PRECALC_ssse3 and ENDING are combined + into 1 macro definition for software pipeling. + + SOFTWARE_PIPELINING_ssse3 : BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack, and finishing up update the digests A/B/C/D/E (i=64:79) + + assume cnt (the number of blocks) >= 1, the main code body should look like + + INITIAL_W_PRECALC_ssse3 // W = big_endian_load and pre-compute W+K (i=0:15) + do { + INTERNAL_ssse3 // update W(i=16:79), and update hash digests A/B/C/D/E (i=0:63) + cnt--; + if (cnt==0) break; + BUFFER_PTR += 64; + SOFTWARE_PIPELINING_ssse3; // update hash digests A/B/C/D/E (i=64:79) + W = big_endian_load and pre-compute W+K (i=0:15) + } + ENDING // update hash digests A/B/C/D/E (i=64:79) + + */ + + #define W_PRECALC_16_31_0 W_PRECALC_16_31_0_ssse3 + #define W_PRECALC_32_79_0 W_PRECALC_32_79_0_ssse3 + #define W_PRECALC_32_79_0_i386 W_PRECALC_32_79_0_i386_ssse3 + + + .macro INITIAL_W_PRECALC_ssse3 // BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack memory + + // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) + W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W0 + K + W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K + + // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) + W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W28 + K + W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K + + // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) + W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W24 + K + W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K + + // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) + W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W20 + K + W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K + + .endm + + + .macro INTERNAL_ssse3 // updating W (16:79) and update the digests A/B/C/D/E (i=0:63, based on W+K stored in the stack memory) + + // i=16 : W12,W8,W4,W0,W28,W24,W20,W16 + W_PRECALC_16_31_0 W0,W28,W24,W20,W16 + RR0 F1,A,B,C,D,E,0 + W_PRECALC_16_31_1 W0,W16 + RR1 F1,A,B,C,D,E,0 + W_PRECALC_16_31_2 W16 + RR0 F1,D,E,A,B,C,2 + W_PRECALC_16_31_3 W16, 2, 0 + RR1 F1,D,E,A,B,C,2 + + // i=20 : W8,W4,W0,W28,W24,W20,W16,W12 + W_PRECALC_16_31_0 W28,W24,W20,W16,W12 + RR0 F1,B,C,D,E,A,4 + W_PRECALC_16_31_1 W28,W12 + RR1 F1,B,C,D,E,A,4 + W_PRECALC_16_31_2 W12 + RR0 F1,E,A,B,C,D,6 + W_PRECALC_16_31_3 W12, 6, 16 + RR1 F1,E,A,B,C,D,6 + + // i=24 : W4,W0,W28,W24,W20,W16,W12,W8 + W_PRECALC_16_31_0 W24,W20,W16,W12,W8 + RR0 F1,C,D,E,A,B,8 + W_PRECALC_16_31_1 W24,W8 + RR1 F1,C,D,E,A,B,8 + W_PRECALC_16_31_2 W8 + RR0 F1,A,B,C,D,E,10 + W_PRECALC_16_31_3 W8,10,16 + RR1 F1,A,B,C,D,E,10 + + // i=28 : W0,W28,W24,W20,W16,W12,W8,W4 + W_PRECALC_16_31_0 W20,W16,W12,W8,W4 + RR0 F1,D,E,A,B,C,12 + W_PRECALC_16_31_1 W20,W4 + RR1 F1,D,E,A,B,C,12 + W_PRECALC_16_31_2 W4 + RR0 F1,B,C,D,E,A,14 + W_PRECALC_16_31_3 W4,14,16 + RR1 F1,B,C,D,E,A,14 + + // i=32 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0 W28,W8,W4,W0 + RR0 F1,E,A,B,C,D,16 + W_PRECALC_32_79_1 W16,W0 + RR1 F1,E,A,B,C,D,16 + W_PRECALC_32_79_2 W0 + RR0 F1,C,D,E,A,B,18 + W_PRECALC_32_79_3 W0,18,16 + RR1 F1,C,D,E,A,B,18 + + // starting using F2 + + // i=36 : W24,W20,W16,W12,W8,W4,W0,W28 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W24,W4,W0,W28 +#else + W_PRECALC_32_79_0_i386 W24,W4,W0,W28 +#endif + RR0 F2,A,B,C,D,E,20 + W_PRECALC_32_79_1 W12,W28 + RR1 F2,A,B,C,D,E,20 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W28 +#else + W_PRECALC_32_79_2_i386 W28 +#endif + RR0 F2,D,E,A,B,C,22 + W_PRECALC_32_79_3 W28,22,16 + RR1 F2,D,E,A,B,C,22 + + // i=40 : W20,W16,W12,W8,W4,W0,W28,W24 + #undef K_XMM + #define K_XMM 32 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W20,W0,W28,W24 +#else + W_PRECALC_32_79_0_i386 W20,W0,W28,W24 +#endif + RR0 F2,B,C,D,E,A,24 + W_PRECALC_32_79_1 W8,W24 + RR1 F2,B,C,D,E,A,24 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W24 +#else + W_PRECALC_32_79_2_i386 W24 +#endif + RR0 F2,E,A,B,C,D,26 + W_PRECALC_32_79_3 W24,26,K_XMM + RR1 F2,E,A,B,C,D,26 + + // i=44 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0 W16,W28,W24,W20 + RR0 F2,C,D,E,A,B,28 + W_PRECALC_32_79_1 W4,W20 + RR1 F2,C,D,E,A,B,28 + W_PRECALC_32_79_2 W20 + RR0 F2,A,B,C,D,E,30 + W_PRECALC_32_79_3 W20,30,K_XMM + RR1 F2,A,B,C,D,E,30 + + // i=48 : W12,W8,W4,W0,W28,W24,W20,W16 + W_PRECALC_32_79_0 W12,W24,W20,W16 + RR0 F2,D,E,A,B,C,32 + W_PRECALC_32_79_1 W0,W16 + RR1 F2,D,E,A,B,C,32 + W_PRECALC_32_79_2 W16 + RR0 F2,B,C,D,E,A,34 + W_PRECALC_32_79_3 W16,34,K_XMM + RR1 F2,B,C,D,E,A,34 + + // i=52 : W8,W4,W0,W28,W24,W20,W16,W12 + W_PRECALC_32_79_0 W8,W20,W16,W12 + RR0 F2,E,A,B,C,D,36 + W_PRECALC_32_79_1 W28,W12 + RR1 F2,E,A,B,C,D,36 + W_PRECALC_32_79_2 W12 + RR0 F2,C,D,E,A,B,38 + W_PRECALC_32_79_3 W12,38,K_XMM + RR1 F2,C,D,E,A,B,38 + + // starting using F3 + + // i=56 : W4,W0,W28,W24,W20,W16,W12,W8 + W_PRECALC_32_79_0 W4,W16,W12,W8 + RR0 F3,A,B,C,D,E,40 + W_PRECALC_32_79_1 W24,W8 + RR1 F3,A,B,C,D,E,40 + W_PRECALC_32_79_2 W8 + RR0 F3,D,E,A,B,C,42 + W_PRECALC_32_79_3 W8,42,K_XMM + RR1 F3,D,E,A,B,C,42 + + // i=60 : W0,W28,W24,W20,W16,W12,W8,W4 + #undef K_XMM + #define K_XMM 48 + W_PRECALC_32_79_0 W0,W12,W8,W4 + RR0 F3,B,C,D,E,A,44 + W_PRECALC_32_79_1 W20,W4 + RR1 F3,B,C,D,E,A,44 + W_PRECALC_32_79_2 W4 + RR0 F3,E,A,B,C,D,46 + W_PRECALC_32_79_3 W4,46,K_XMM + RR1 F3,E,A,B,C,D,46 + + // i=64 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0 W28,W8,W4,W0 + RR0 F3,C,D,E,A,B,48 + W_PRECALC_32_79_1 W16,W0 + RR1 F3,C,D,E,A,B,48 + W_PRECALC_32_79_2 W0 + RR0 F3,A,B,C,D,E,50 + W_PRECALC_32_79_3 W0,50,K_XMM + RR1 F3,A,B,C,D,E,50 + + // i=68 : W24,W20,W16,W12,W8,W4,W0,W28 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W24,W4,W0,W28 +#else + W_PRECALC_32_79_0_i386 W24,W4,W0,W28 +#endif + RR0 F3,D,E,A,B,C,52 + W_PRECALC_32_79_1 W12,W28 + RR1 F3,D,E,A,B,C,52 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W28 +#else + W_PRECALC_32_79_2_i386 W28 +#endif + RR0 F3,B,C,D,E,A,54 + W_PRECALC_32_79_3 W28,54,K_XMM + RR1 F3,B,C,D,E,A,54 + + // i=72 : W20,W16,W12,W8,W4,W0,W28,W24 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W20,W0,W28,W24 +#else + W_PRECALC_32_79_0_i386 W20,W0,W28,W24 +#endif + RR0 F3,E,A,B,C,D,56 + W_PRECALC_32_79_1 W8,W24 + RR1 F3,E,A,B,C,D,56 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W24 +#else + W_PRECALC_32_79_2_i386 W24 +#endif + RR0 F3,C,D,E,A,B,58 + W_PRECALC_32_79_3 W24,58,K_XMM + RR1 F3,C,D,E,A,B,58 + + // starting using F4 + + // i=76 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0 W16,W28,W24,W20 + RR0 F4,A,B,C,D,E,60 + W_PRECALC_32_79_1 W4,W20 + RR1 F4,A,B,C,D,E,60 + W_PRECALC_32_79_2 W20 + RR0 F4,D,E,A,B,C,62 + W_PRECALC_32_79_3 W20,62,K_XMM + RR1 F4,D,E,A,B,C,62 + + .endm + + .macro SOFTWARE_PIPELINING_ssse3 + // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) + RR0 F4,B,C,D,E,A,64 + W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP + RR1 F4,B,C,D,E,A,64 + W_PRECALC_00_15_2 // W_TMP = W0 + K + RR0 F4,E,A,B,C,D,66 + W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K + RR1 F4,E,A,B,C,D,66 + + // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) + RR0 F4,C,D,E,A,B,68 + W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP + RR1 F4,C,D,E,A,B,68 + W_PRECALC_00_15_2 // W_TMP = W28 + K + RR0 F4,A,B,C,D,E,70 + W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K[0] + RR1 F4,A,B,C,D,E,70 + + // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) + RR0 F4,D,E,A,B,C,72 + W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP + RR1 F4,D,E,A,B,C,72 + W_PRECALC_00_15_2 // W_TMP = W24 + K + RR0 F4,B,C,D,E,A,74 + W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K + RR1 F4,B,C,D,E,A,74 + + // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) + RR0 F4,E,A,B,C,D,76 + W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP + RR1 F4,E,A,B,C,D,76 + W_PRECALC_00_15_2 // W_TMP = W20 + K + RR0 F4,C,D,E,A,B,78 + W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K + RR1 F4,C,D,E,A,B,78 + .endm + + + #undef W_PRECALC_16_31_0 + #undef W_PRECALC_32_79_0 + #undef W_PRECALC_32_79_0_i386 + + + + /* + + The following are 3 macro definitions that are no-ssse3 variants of the previous 3 macro definitions. + + INITIAL_W_PRECALC_nossse3 + INTERNAL_nossse3 + SOFTWARE_PIPELINING_nossse3 + + They will be used in a sha1 code main body definition that will be used for system without ssse3 support. + + */ + + #define W_PRECALC_16_31_0 W_PRECALC_16_31_0_nossse3 + #define W_PRECALC_32_79_0 W_PRECALC_32_79_0_nossse3 + #define W_PRECALC_32_79_0_i386 W_PRECALC_32_79_0_i386_nossse3 + + + .macro INITIAL_W_PRECALC_nossse3 + + // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) + W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W0 + K + W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K + + // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) + W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W28 + K + W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K + + // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) + W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W24 + K + W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K + + // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) + W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W20 + K + W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K + + .endm + + + .macro INTERNAL_nossse3 + // i=16 + // circular buffer : W12,W8,W4,W0,W28,W24,W20,W16 + W_PRECALC_16_31_0 W0,W28,W24,W20,W16 + RR0 F1,A,B,C,D,E,0 + W_PRECALC_16_31_1 W0,W16 + RR1 F1,A,B,C,D,E,0 + W_PRECALC_16_31_2 W16 + RR0 F1,D,E,A,B,C,2 + W_PRECALC_16_31_3 W16, 2, 0 + RR1 F1,D,E,A,B,C,2 + + // i=20, + // W8,W4,W0,W28,W24,W20,W16,W12 + W_PRECALC_16_31_0 W28,W24,W20,W16,W12 + RR0 F1,B,C,D,E,A,4 + W_PRECALC_16_31_1 W28,W12 + RR1 F1,B,C,D,E,A,4 + + W_PRECALC_16_31_2 W12 + RR0 F1,E,A,B,C,D,6 + W_PRECALC_16_31_3 W12, 6, 16 + RR1 F1,E,A,B,C,D,6 + + // i=24, + // W4,W0,W28,W24,W20,W16,W12,W8 + W_PRECALC_16_31_0 W24,W20,W16,W12,W8 + RR0 F1,C,D,E,A,B,8 + W_PRECALC_16_31_1 W24,W8 + RR1 F1,C,D,E,A,B,8 + + W_PRECALC_16_31_2 W8 + RR0 F1,A,B,C,D,E,10 + W_PRECALC_16_31_3 W8,10,16 + RR1 F1,A,B,C,D,E,10 + + // i=28 + // W0,W28,W24,W20,W16,W12,W8,W4 + W_PRECALC_16_31_0 W20,W16,W12,W8,W4 + RR0 F1,D,E,A,B,C,12 + W_PRECALC_16_31_1 W20,W4 + RR1 F1,D,E,A,B,C,12 + + W_PRECALC_16_31_2 W4 + RR0 F1,B,C,D,E,A,14 + W_PRECALC_16_31_3 W4,14,16 + RR1 F1,B,C,D,E,A,14 + + //i=32 + // W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0 W28,W8,W4,W0 + RR0 F1,E,A,B,C,D,16 + W_PRECALC_32_79_1 W16,W0 + RR1 F1,E,A,B,C,D,16 + W_PRECALC_32_79_2 W0 + RR0 F1,C,D,E,A,B,18 + W_PRECALC_32_79_3 W0,18,16 + RR1 F1,C,D,E,A,B,18 + + //i=36 + // W24,W20,W16,W12,W8,W4,W0,W28 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W24,W4,W0,W28 +#else + W_PRECALC_32_79_0_i386 W24,W4,W0,W28 +#endif + RR0 F2,A,B,C,D,E,20 + W_PRECALC_32_79_1 W12,W28 + RR1 F2,A,B,C,D,E,20 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W28 +#else + W_PRECALC_32_79_2_i386 W28 +#endif + RR0 F2,D,E,A,B,C,22 + W_PRECALC_32_79_3 W28,22,16 + RR1 F2,D,E,A,B,C,22 + + //i=40 + #undef K_XMM + #define K_XMM 32 + // W20,W16,W12,W8,W4,W0,W28,W24 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W20,W0,W28,W24 +#else + W_PRECALC_32_79_0_i386 W20,W0,W28,W24 +#endif + RR0 F2,B,C,D,E,A,24 + W_PRECALC_32_79_1 W8,W24 + RR1 F2,B,C,D,E,A,24 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W24 +#else + W_PRECALC_32_79_2_i386 W24 +#endif + RR0 F2,E,A,B,C,D,26 + W_PRECALC_32_79_3 W24,26,K_XMM + RR1 F2,E,A,B,C,D,26 + + //i=44 + // W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0 W16,W28,W24,W20 + RR0 F2,C,D,E,A,B,28 + W_PRECALC_32_79_1 W4,W20 + RR1 F2,C,D,E,A,B,28 + W_PRECALC_32_79_2 W20 + RR0 F2,A,B,C,D,E,30 + W_PRECALC_32_79_3 W20,30,K_XMM + RR1 F2,A,B,C,D,E,30 + + //i=48 + // W12,W8,W4,W0,W28,W24,W20,W16 + W_PRECALC_32_79_0 W12,W24,W20,W16 + RR0 F2,D,E,A,B,C,32 + W_PRECALC_32_79_1 W0,W16 + RR1 F2,D,E,A,B,C,32 + W_PRECALC_32_79_2 W16 + RR0 F2,B,C,D,E,A,34 + W_PRECALC_32_79_3 W16,34,K_XMM + RR1 F2,B,C,D,E,A,34 + + //i=52 + // W8,W4,W0,W28,W24,W20,W16,W12 + W_PRECALC_32_79_0 W8,W20,W16,W12 + RR0 F2,E,A,B,C,D,36 + W_PRECALC_32_79_1 W28,W12 + RR1 F2,E,A,B,C,D,36 + W_PRECALC_32_79_2 W12 + RR0 F2,C,D,E,A,B,38 + W_PRECALC_32_79_3 W12,38,K_XMM + RR1 F2,C,D,E,A,B,38 + + //i=56 + // W4,W0,W28,W24,W20,W16,W12,W8 + W_PRECALC_32_79_0 W4,W16,W12,W8 + RR0 F3,A,B,C,D,E,40 + W_PRECALC_32_79_1 W24,W8 + RR1 F3,A,B,C,D,E,40 + W_PRECALC_32_79_2 W8 + RR0 F3,D,E,A,B,C,42 + W_PRECALC_32_79_3 W8,42,K_XMM + RR1 F3,D,E,A,B,C,42 + + //i=60 + #undef K_XMM + #define K_XMM 48 + // W0,W28,W24,W20,W16,W12,W8,W4 + W_PRECALC_32_79_0 W0,W12,W8,W4 + RR0 F3,B,C,D,E,A,44 + W_PRECALC_32_79_1 W20,W4 + RR1 F3,B,C,D,E,A,44 + W_PRECALC_32_79_2 W4 + RR0 F3,E,A,B,C,D,46 + W_PRECALC_32_79_3 W4,46,K_XMM + RR1 F3,E,A,B,C,D,46 + + //i=64 + // W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0 W28,W8,W4,W0 + RR0 F3,C,D,E,A,B,48 + W_PRECALC_32_79_1 W16,W0 + RR1 F3,C,D,E,A,B,48 + W_PRECALC_32_79_2 W0 + RR0 F3,A,B,C,D,E,50 + W_PRECALC_32_79_3 W0,50,K_XMM + RR1 F3,A,B,C,D,E,50 + + //i=68 + // W24,W20,W16,W12,W8,W4,W0,W28 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W24,W4,W0,W28 +#else + W_PRECALC_32_79_0_i386 W24,W4,W0,W28 +#endif + RR0 F3,D,E,A,B,C,52 + W_PRECALC_32_79_1 W12,W28 + RR1 F3,D,E,A,B,C,52 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W28 +#else + W_PRECALC_32_79_2_i386 W28 +#endif + RR0 F3,B,C,D,E,A,54 + W_PRECALC_32_79_3 W28,54,K_XMM + RR1 F3,B,C,D,E,A,54 + + //i=72 + // W20,W16,W12,W8,W4,W0,W28,W24 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W20,W0,W28,W24 +#else + W_PRECALC_32_79_0_i386 W20,W0,W28,W24 +#endif + RR0 F3,E,A,B,C,D,56 + W_PRECALC_32_79_1 W8,W24 + RR1 F3,E,A,B,C,D,56 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W24 +#else + W_PRECALC_32_79_2_i386 W24 +#endif + RR0 F3,C,D,E,A,B,58 + W_PRECALC_32_79_3 W24,58,K_XMM + RR1 F3,C,D,E,A,B,58 + + // starting using F4 + + //i=76 + // W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0 W16,W28,W24,W20 + RR0 F4,A,B,C,D,E,60 + W_PRECALC_32_79_1 W4,W20 + RR1 F4,A,B,C,D,E,60 + W_PRECALC_32_79_2 W20 + RR0 F4,D,E,A,B,C,62 + W_PRECALC_32_79_3 W20,62,K_XMM + RR1 F4,D,E,A,B,C,62 + + .endm + + .macro SOFTWARE_PIPELINING_nossse3 + // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) + RR0 F4,B,C,D,E,A,64 + W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP + RR1 F4,B,C,D,E,A,64 + W_PRECALC_00_15_2 // W_TMP = W0 + K + RR0 F4,E,A,B,C,D,66 + W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K + RR1 F4,E,A,B,C,D,66 + + // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) + RR0 F4,C,D,E,A,B,68 + W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP + RR1 F4,C,D,E,A,B,68 + W_PRECALC_00_15_2 // W_TMP = W28 + K + RR0 F4,A,B,C,D,E,70 + W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K[0] + RR1 F4,A,B,C,D,E,70 + + // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) + RR0 F4,D,E,A,B,C,72 + W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP + RR1 F4,D,E,A,B,C,72 + W_PRECALC_00_15_2 // W_TMP = W24 + K + RR0 F4,B,C,D,E,A,74 + W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K + RR1 F4,B,C,D,E,A,74 + + // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) + RR0 F4,E,A,B,C,D,76 + W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP + RR1 F4,E,A,B,C,D,76 + W_PRECALC_00_15_2 // W_TMP = W20 + K + RR0 F4,C,D,E,A,B,78 + W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K + RR1 F4,C,D,E,A,B,78 + .endm + + .macro ENDING // finish up updating hash digests (i=64:79) + //i=80 + RR0 F4,B,C,D,E,A,64 + RR1 F4,B,C,D,E,A,64 + RR0 F4,E,A,B,C,D,66 + RR1 F4,E,A,B,C,D,66 + + //i=84 + RR0 F4,C,D,E,A,B,68 + RR1 F4,C,D,E,A,B,68 + RR0 F4,A,B,C,D,E,70 + RR1 F4,A,B,C,D,E,70 + + //i=88 + RR0 F4,D,E,A,B,C,72 + RR1 F4,D,E,A,B,C,72 + RR0 F4,B,C,D,E,A,74 + RR1 F4,B,C,D,E,A,74 + + //i=92 + RR0 F4,E,A,B,C,D,76 + RR1 F4,E,A,B,C,D,76 + RR0 F4,C,D,E,A,B,78 + RR1 F4,C,D,E,A,B,78 + .endm + + // load hash digests A,B,C,D,E from memory into registers + .macro LOAD_HASH +#if defined (__x86_64__) + mov (HASH_PTR), A + mov 4(HASH_PTR), B + mov 8(HASH_PTR), C + mov 12(HASH_PTR), D + mov 16(HASH_PTR), E +#else + mov HASH_PTR, T1 + mov (T1), A + mov 4(T1), B + mov 8(T1), C + mov 12(T1), D + mov 16(T1), E +#endif + .endm + + .macro UPDATE_HASH + add $0, $1 + mov $1, $0 + .endm + + .macro UPDATE_ALL_HASH +#if defined (__x86_64__) + UPDATE_HASH (HASH_PTR), A + UPDATE_HASH 4(HASH_PTR), B + UPDATE_HASH 8(HASH_PTR), C + UPDATE_HASH 12(HASH_PTR), D + UPDATE_HASH 16(HASH_PTR), E +#else + mov HASH_PTR, T1 + UPDATE_HASH (T1), A + UPDATE_HASH 4(T1), B + UPDATE_HASH 8(T1), C + UPDATE_HASH 12(T1), D + UPDATE_HASH 16(T1), E +#endif + .endm + + + /* + main sha1 code for system without ssse3 support + */ + + .macro SHA1_PIPELINED_MAIN_BODY_nossse3 + LOAD_HASH // load initial hashes into A,B,C,D,E (registers) + INITIAL_W_PRECALC_nossse3 // big_endian_load(W) and W+K (i=0:15) + .align 4,0x90 +0: + INTERNAL_nossse3 // update W (i=16:79) and update ABCDE (i=0:63) +#if Multiple_Blocks +#if defined(__x86_64__) + add $$64, BUFFER_PTR // BUFFER_PTR+=64; + sub $$1, cnt // pre-decrement cnt by 1 +#else + addl $$64, BUFFER_PTR // BUFFER_PTR+=64; + subl $$1, cnt // pre-decrement cnt by 1 +#endif + jbe 1f // if cnt <= 0, branch to finish off + SOFTWARE_PIPELINING_nossse3 // update ABCDE (i=64:79) || big_endian_load(W) and W+K (i=0:15) + UPDATE_ALL_HASH // update output hashes + jmp 0b // repeat for next block + .align 4,0x90 +1: +#endif + ENDING // update ABCDE (i=64:79) + UPDATE_ALL_HASH // update output hashes + .endm + + /* + main sha1 code for system with ssse3 support + */ + + .macro SHA1_PIPELINED_MAIN_BODY_ssse3 + LOAD_HASH // load initial hashes into A,B,C,D,E + INITIAL_W_PRECALC_ssse3 // big_endian_load(W) and W+K (i=0:15) + .align 4,0x90 +0: + INTERNAL_ssse3 // update W (i=16:79) and update ABCDE (i=0:63) +#if Multiple_Blocks +#if defined(__x86_64__) + add $$64, BUFFER_PTR // BUFFER_PTR+=64; + sub $$1, cnt // pre-decrement cnt by 1 +#else + addl $$64, BUFFER_PTR // BUFFER_PTR+=64; + subl $$1, cnt // pre-decrement cnt by 1 +#endif + jbe 1f // if cnt <= 0, branch to finish off + SOFTWARE_PIPELINING_ssse3 // update ABCDE (i=64:79) || big_endian_load(W) and W+K (i=0:15) + UPDATE_ALL_HASH // update output hashes + jmp 0b // repeat for next block + .align 4,0x90 +1: +#endif + ENDING // update ABCDE (i=64:79) + UPDATE_ALL_HASH // update output hashes + .endm + +#if KERNEL +#include +#else +#include +#endif + + .text + + .globl _sha1_x86_compress_host_order + .private_extern _sha1_x86_compress_host_order +_sha1_x86_compress_host_order: + + // detect SSSE3 and dispatch appropriate code branch + #if defined __x86_64__ + movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capabilities + mov (%rax), %eax // %eax = __cpu_capabilities + #else // i386 + #if defined KERNEL + leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities + mov (%eax), %eax // %eax = __cpu_capabilities + #else + mov _COMM_PAGE_CPU_CAPABILITIES, %eax + #endif + #endif + test $(kHasSupplementalSSE3), %eax + je _SHA1Compress_x86nossse3_host_order // branch to no-ssse3 code + + + // start the sha1 code with ssse3 support + + // save callee-save registers +#if defined (__x86_64__) + push %rbx + push %rbp +#else + push %ebx + push %ebp + push %esi + push %edi +#endif + + sub $stack_size, sp // allocate stack memory for use + + // save used xmm register if this is for kernel +#if KERNEL + xmov %xmm0, 4*16(sp) + xmov %xmm1, 5*16(sp) + xmov %xmm2, 6*16(sp) + xmov %xmm3, 7*16(sp) + xmov %xmm4, 8*16(sp) + xmov %xmm5, 9*16(sp) + xmov %xmm6, 10*16(sp) + xmov %xmm7, 11*16(sp) +#if defined (__x86_64__) + xmov %xmm8, 12*16(sp) + xmov %xmm9, 13*16(sp) + xmov %xmm10, 14*16(sp) +#endif +#endif + +#if defined (__x86_64__) + + // set up registers to free %edx/%edi/%esi for other use (ABCDE) + mov ctx, HASH_PTR + mov buf, BUFFER_PTR +#if Multiple_Blocks + mov %rdx, cnt +#endif + lea K_XMM_AR(%rip), K_BASE + xmov -16(K_BASE), XMM_SHUFB_BSWAP + +#else // __i386__ + +#if KERNEL + lea K_XMM_AR, %eax +#else + // Get address of 0 in R. + call 0f // Push program counter onto stack. + 0: pop %eax // Get program counter. + lea K_XMM_AR-0b(%eax), %eax +#endif + mov %eax, K_BASE + xmov -16(%eax), %xmm0 + xmov %xmm0, XMM_SHUFB_BSWAP + +#endif + + SHA1_PIPELINED_MAIN_BODY_ssse3 + + // restore used xmm registers if this is for kernel +#if KERNEL + xmov 4*16(sp), %xmm0 + xmov 5*16(sp), %xmm1 + xmov 6*16(sp), %xmm2 + xmov 7*16(sp), %xmm3 + xmov 8*16(sp), %xmm4 + xmov 9*16(sp), %xmm5 + xmov 10*16(sp), %xmm6 + xmov 11*16(sp), %xmm7 +#if defined (__x86_64__) + xmov 12*16(sp), %xmm8 + xmov 13*16(sp), %xmm9 + xmov 14*16(sp), %xmm10 +#endif +#endif + + add $stack_size, sp // deallocate stack memory + + // restore callee-save registers +#if defined (__x86_64__) + pop %rbp + pop %rbx +#else + pop %edi + pop %esi + pop %ebp + pop %ebx +#endif + + ret // return + + // this is equivalent to the above function _SHA1Transform, but it does not use ssse3 instructions + + .globl _SHA1Compress_x86nossse3_host_order + .private_extern _SHA1Compress_x86nossse3_host_order +_SHA1Compress_x86nossse3_host_order: + + // push callee-save registers +#if defined (__x86_64__) + push %rbx + push %rbp +#else + push %ebx + push %ebp + push %esi + push %edi +#endif + + sub $stack_size, sp // allocate stack memory for local use + + // save used xmm registers if this is for kernel +#if KERNEL + xmov %xmm0, 4*16(sp) + xmov %xmm1, 5*16(sp) + xmov %xmm2, 6*16(sp) + xmov %xmm3, 7*16(sp) + xmov %xmm4, 8*16(sp) + xmov %xmm5, 9*16(sp) + xmov %xmm6, 10*16(sp) + xmov %xmm7, 11*16(sp) +#if defined (__x86_64__) + xmov %xmm8, 12*16(sp) + xmov %xmm9, 13*16(sp) +#endif +#endif + +#if defined (__x86_64__) + + // set up registers to free %edx/%edi/%esi for other use (ABCDE) + mov ctx, HASH_PTR + mov buf, BUFFER_PTR +#if Multiple_Blocks + mov %rdx, cnt +#endif + lea K_XMM_AR(%rip), K_BASE + +#else // __i386__ + +#if KERNEL + lea K_XMM_AR, %eax +#else + // Get address of 0 in R. + call 0f // Push program counter onto stack. + 0: pop %eax // Get program counter. + lea K_XMM_AR-0b(%eax), %eax +#endif + mov %eax, K_BASE + +#endif + + SHA1_PIPELINED_MAIN_BODY_nossse3 + + // restore used xmm registers if this is for kernel +#if KERNEL + xmov 4*16(sp), %xmm0 + xmov 5*16(sp), %xmm1 + xmov 6*16(sp), %xmm2 + xmov 7*16(sp), %xmm3 + xmov 8*16(sp), %xmm4 + xmov 9*16(sp), %xmm5 + xmov 10*16(sp), %xmm6 + xmov 11*16(sp), %xmm7 +#if defined (__x86_64__) + xmov 12*16(sp), %xmm8 + xmov 13*16(sp), %xmm9 +#endif +#endif + + add $stack_size, sp // deallocate stack memory + + // restore callee-save registers +#if defined (__x86_64__) + pop %rbp + pop %rbx +#else + pop %edi + pop %esi + pop %ebp + pop %ebx +#endif + + ret // return + + .const + .align 4, 0x90 + +#define K1 0x5a827999 +#define K2 0x6ed9eba1 +#define K3 0x8f1bbcdc +#define K4 0xca62c1d6 + +bswap_shufb_ctl: + .long 0x00010203 + .long 0x04050607 + .long 0x08090a0b + .long 0x0c0d0e0f + +K_XMM_AR: + .long K1 + .long K1 + .long K1 + .long K1 + .long K2 + .long K2 + .long K2 + .long K2 + .long K3 + .long K3 + .long K3 + .long K3 + .long K4 + .long K4 + .long K4 + .long K4 + + +#endif // architecture x86_64 or i386 + ADDED Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1LE.s Index: Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1LE.s ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_x86_sha1_descriptor/vng_x86_sha1LE.s @@ -0,0 +1,1518 @@ +/* + * Copyright (c) 2011 Apple Computer, Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* sha1edp.s : this file provides optimized x86_64 and i386 implementation of the sha1 function + CoreOS - vector and numerics group + cclee 6-21-10 + + The implementation is based on the principle described in an Intel online article + "Improving the Performance of the Secure Hash Algorithm (SHA-1)" + http://software.intel.com/en-us/articles/improving-the-performance-of-the-secure-hash-algorithm-1/ + + + Update HASH[] by processing a one 64-byte block in MESSAGE[] can be represented by the following C function + +void SHA1( int HASH[], int MESSAGE[] ) +{ + int A[81], B[81], C[81], D[81], E[81]; + int W[80]; + + int i, FN; + + A[0] = HASH[0]; + B[0] = HASH[1]; + C[0] = HASH[2]; + D[0] = HASH[3]; + E[0] = HASH[4]; + + for ( i=0; i<80; ++i ) + { + if ( i < 16 ) + W[i] = BIG_ENDIAN_LOAD( MESSAGE[i] ); + else + W[i] = ROTATE_LEFT( W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1 ); + + FN = F( i, B[i], C[i], D[i] ); + + A[i+1] = FN + E[i] + ROTATE_LEFT( A[i], 5 ) + W[i] + K(i); + B[i+1] = A[i]; + C[i+1] = ROTATE_LEFT( B[i], 30 ); + D[i+1] = C[i]; + E[i+1] = D[i]; + } + + HASH[0] += A[80]; + HASH[1] += B[80]; + HASH[2] += C[80]; + HASH[3] += D[80]; + HASH[4] += E[80]; +} + + For i=0:15, W[i] is simply big-endian loading of MESSAGE[i]. For i=16:79, W[i] is updated according to W[i] = ROTATE_LEFT( W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1 ); + + The approach (by Dean Gaudet) can be used to vectorize the computation of W[i] for i=16:79, + + 1. done on 4 consequtive W[i] values in a single XMM register + W[i ] = (W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]) rol 1 + W[i+1] = (W[i-2] ^ W[i-7] ^ W[i-13] ^ W[i-15]) rol 1 + W[i+2] = (W[i-1] ^ W[i-6] ^ W[i-12] ^ W[i-14]) rol 1 + W[i+3] = ( 0 ^ W[i-5] ^ W[i-11] ^ W[i-13]) rol 1 + + 2. this additional calculation unfortunately requires many additional operations + W[i+3] ^= W[i] rol 1 + + 3. once we have 4 W[i] values in XMM we can also add four K values with one instruction + W[i:i+3] += {K,K,K,K} + + Let W0 = {W[i] W[i+1] W[i+2] W[i+3]} be the current W-vector to be computed, W4 = {W[i-4] W[i-3] W[i-2] W[i-1]} be the previous vector, and so on + The Dean Gaudet approach can be expressed as + + 1. W0 = rotate_left(left_shift(W4,32) ^ W8 ^ left_shift(concatenate(W16,W12),64) ^ W16,1); + 2. W[i+3] ^= W[i] rol 1 + 3. W0 += {K,K,K,K} + + For i>=32, the Intel online article suggests that (using a basic identity (X rol 1) rol 1 = X rol 2) the update equation is equivalent to + + 1. W0 = rotate_left(left_shift(concatenate(W8,W4),64) ^ W16 ^ W28 ^ W32, 2); + + Note: + 1. In total, we need 8 16-byte registers or memory for W0,W4,...,W28. W0 and W32 can be the same register or memory. + 2. The registers are used in a circular buffering mode. For example, we start with W28,W24,...,W0 (with W0 indicating the most recent 16-byte) + i=0, W28,W24,...,W0 + i=4, W24,W20,...,W28 + i=8, W20,W16,...,W24 + . + . + and so forth. + 3. 2 ssse3 instructions are used in the Intel article, pshufb and palignr. + a. pshufb is used to simplify the BIG_ENDIAN_LOAD operation + b. palignr is used to simplify the computation of left_shift(concatenate(W12,W8),64) + 4. we probe __cpu_capabilities to detect ssse3 support and dispatch code with ssse3 support when available. + If ssse3 is not supported, a suboptimal code (pshufb and palignr workaround) is dispatched. + +*/ + +/* the code can be compiled into single block (64 bytes) per call mode by setting Multiple_blocks to 0 */ +#define Multiple_Blocks 1 + +#if defined (__x86_64__) || defined(__i386__) // x86_64 or i386 architectures + +#if defined(__x86_64__) + + // set up for x86_64 +#define stack_size (8+16*11+16*4) // 8 (alignedment) + x0-x10 + 4 128-bits for intermediate WK(t) storage +#define sp %rsp // unifying architectural stack pointer representation +#define ctx %rdi // 1st input argument, will move to HASH_PTR (%r9) +#define buf %rsi // 2nd input argument, will move to BUFFER_PTR (%r10) +#define cnt %r11 // will copy from the 3rd input argument (%rdx) +#define K_BASE %r8 // an aligned pointer to point to shufb reference numbers of table of K values +#define HASH_PTR %r9 // pointer to Hash values (A,B,C,D,E) +#define BUFFER_PTR %r10 // pointer to input blocks + +#else // !__x86_64__ + + // set up for i386 +#define stack_size (12+16*2+16*11+16*4) // 12-bytes (alignment) + extra 2 + 3 (W24/W28/XMM_SHUFB_BSWAP) + 8 (xmm0-xmm7) + 4 (WK(t)) +#define sp %esp // unifying architectural stack pointer representation +#define HASH_PTR stack_size+16+4(sp) // use 1st input argument from caller function, 16 for (esi/edi/ebx/ebp) +#define BUFFER_PTR stack_size+16+8(sp) // use 2nd input argument from caller function +#define cnt stack_size+16+12(sp) // use 3rd input argument from caller function +#define K_BASE stack_size-4(sp) // use for K_BASE + +#endif // __x86_64__ + +// symbolizing registers or stack memory with algorithmic variables W0,W4,...,W28 + W_TMP, W_TMP2, and XMM_SHUFB_BSWAP for code with ssse3 support + +#define W_TMP %xmm0 +#define W_TMP2 %xmm1 +#define W0 %xmm2 +#define W4 %xmm3 +#define W8 %xmm4 +#define W12 %xmm5 +#define W16 %xmm6 +#define W20 %xmm7 +#if defined(__x86_64__) +#define W24 %xmm8 +#define W28 %xmm9 +#define XMM_SHUFB_BSWAP %xmm10 // used only when ssse3 is supported +#else // defined (__i386__) +#define W24 12*16(sp) +#define W28 13*16(sp) +#define XMM_SHUFB_BSWAP 14*16(sp) // used only when ssse3 is supported +#endif + +#define xmov movaps // aligned 16-byte move +#define xmovu movups // unaligned 16-byte move + +// intermediate hash variables +#define A %ecx +#define B %esi +#define C %edi +#define D %ebp +#define E %edx + +// temp variables +#define T1 %eax +#define T2 %ebx + +#define WK(t) (t&15)*4(sp) + + // int F1(int B, int C, int D) { return (D ^ ( B & (C ^ D)); } + // result in T1 + .macro F1 + mov $1, T1 + xor $2, T1 + and $0, T1 + xor $2, T1 + .endm + + // int F2(int B, int C, int D) { return (D ^ B ^ C); } + // result in T1 + .macro F2 + mov $2, T1 + xor $1, T1 + xor $0, T1 + .endm + + // int F3(int B, int C, int D) { return (B & C) | (D & (B ^ C)); } + // result in T1 + .macro F3 + mov $1, T1 + mov $0, T2 + or $0, T1 + and $1, T2 + and $2, T1 + or T2, T1 + .endm + + // for i=60:79, F4 is identical to F2 + #define F4 F2 + + + /* + i=0:15, W[i] = BIG_ENDIAN_LOAD(MESSAGE[i]); + + with ssse3 support, this is achived via + for (i=0;i<16;i+=4) { + 1. W_TMP = new 16 bytes from MESSAGE[] + 2. W_TMP = pshufb(W_TMP, XMM_SHUFB_BSWAP); save to W circular buffer for updating W + 3. WTMP += {K,K,K,K}; + 4. save quadruple W[i]+K[i] = W_TMP in the stack memory; + } + + each step is represented in one of the following 4 macro definitions + + */ + + .macro W_PRECALC_00_15_0_ssse3 // input argument $0 : 0/4/8/12 +#if defined (__x86_64__) // BUFFER_PTR is already an address register in x86_64 + xmovu $0*4(BUFFER_PTR), W_TMP // read 16-bytes into W_TMP, BUFFER_PTR possibly not 16-byte aligned +#else // BUFFER_PTR is from the argument set up in the caller + mov BUFFER_PTR, T1 // T1 = BUFFER_PTR + xmovu $0*4(T1), W_TMP // read 16-bytes into W_TMP, BUFFER_PTR possibly not 16-byte aligned +#endif + .endm + + .macro W_PRECALC_00_15_1_ssse3 // input argument $0 : current 16-bytes in the circular buffer, one of W0,W4,W8,...,W28 + pshufb XMM_SHUFB_BSWAP, W_TMP // convert W_TMP from little-endian into big-endian + xmov W_TMP, $0 // save W_TMP in the circular buffer + .endm + + .macro W_PRECALC_00_15_2 // K_BASE points to the current K quadruple. +#if defined (__x86_64__) // K_BASE is already an address register in x86_64 + paddd (K_BASE), W_TMP // W_TMP += {K,K,K,K}; +#else // K_BASE is previously set up in the stack memory + mov K_BASE, T1 // T1 = K_BASE + paddd (T1), W_TMP // W_TMP += {K,K,K,K}; +#endif + .endm + + .macro W_PRECALC_00_15_3 + xmov W_TMP, WK($0&~3) // save quadruple W[i]+K in the stack memory, which would be used later for updating the hashes A/B/C/D/E + .endm + + /* + without ssse3 support, steps 1 and 2 need to be modified + 1. sequentially load 4 words into T1, bswap T1, and save it to 4-bytes in the stack space + 2. load the 16-bytes from the aligned stack memory into W_TMP + */ + + .macro W_PRECALC_00_15_0_nossse3 // input argument $0 : 0/4/8/12 + +#if defined (__x86_64__) + #define BUFFERP BUFFER_PTR +#else + mov BUFFER_PTR, T2 // copy BUFFER_PTR (from caller 2nd argument) to T2 + #define BUFFERP T2 +#endif + + // load 1st word, bswap it, save it to stack + mov $0*4(BUFFERP), T1 + bswap T1 + mov T1, 14*16(sp) + + // load 2nd word, bswap it, save it to stack + mov 4+$0*4(BUFFERP), T1 + bswap T1 + mov T1, 4+14*16(sp) + + // load 3rd word, bswap it, save it to stack + mov 8+$0*4(BUFFERP), T1 + bswap T1 + mov T1, 8+14*16(sp) + + // load 4th word, bswap it, save it to stack + mov 12+$0*4(BUFFERP), T1 + bswap T1 + mov T1, 12+14*16(sp) + .endm + + .macro W_PRECALC_00_15_1_nossse3 // input argument $0 : current 16-bytes in the circular buffer, one of W0,W4,W8,...,W28 + xmov 14*16(sp), W_TMP // load the bswapped 16-bytes from the aligned stack memory + xmov W_TMP, $0 // save W = W_TMP in the circular buffer + .endm + + // rounds 16-31 compute W[0] using the vectorization approach by Dean Gaudet + /* + W[i ] = (W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]) rol 1 + W[i+1] = (W[i-2] ^ W[i-7] ^ W[i-13] ^ W[i-15]) rol 1 + W[i+2] = (W[i-1] ^ W[i-6] ^ W[i-12] ^ W[i-14]) rol 1 + W[i+3] = ( 0 ^ W[i-5] ^ W[i-11] ^ W[i-13]) rol 1 + + W[i+3] ^= W[i] rol 1; // this W[i] is already rol by 1, if we are taking from the intial W before rol 1, we should rol this by 2 + + The operation (updating W and W+K) is scheduled as and divided into 4 steps + + 0. W_tmp = W3; W = W14 ^ W8 + 1. W = W3 ^ W8 ^ W14 ^ W16; W_TMP = W; W_TMP2 = (W[i] 0 0 0); + 2. W_TMP = (W3 ^ W8 ^ W14 ^ W16) rol 1; split (W[i] 0 0 0) rol 2 in W_TMP2 and W + 3. W = W_TMP = W_TMP ^ W_TMP2 ^ W = (W3 ^ W8 ^ W14 ^ W16) rol 1 ^ (W[i] 0 0 0) rol 2; WK = W _TMP+K; + + */ + + .macro W_PRECALC_16_31_0_ssse3 // input arguments : W16,W12,W8,W4,W + xmov $1, $4 // W = W12 + palignr $$8, $0, $4 // W = W14 + xmov $3, W_TMP // W_TMP = W4 + psrldq $$4, W_TMP // W_TMP = W3 + pxor $2, $4 // W = W8 ^ W14 + .endm + + .macro W_PRECALC_16_31_1 // input arguments : W16,W + pxor $0, W_TMP // W_TMP = W3 ^ W16 + pxor W_TMP, $1 // W = W3 ^ W16 ^ W8 ^ W14 + xmov $1, W_TMP2 // W_TMP2 = W3 ^ W16 ^ W8 ^ W14 + xmov $1, W_TMP // W_TMP = W3 ^ W16 ^ W8 ^ W14 + pslldq $$12, W_TMP2 // W_TMP2 = (W[i] 0 0 0) + .endm + + .macro W_PRECALC_16_31_2 // input argument : W + psrld $$31, $0 // (W3 ^ W16 ^ W8 ^ W14)>>31 + pslld $$1, W_TMP // (W3 ^ W16 ^ W8 ^ W14)<<1 + por $0, W_TMP // W_TMP = (W3 ^ W16 ^ W8 ^ W14) rol 1 + xmov W_TMP2, $0 // copy W[i] at location of W[i+3] + psrld $$30, W_TMP2 // W_TMP2 = W[i] lower 2 bits after rol 2 + pslld $$2, $0 // W = W[i] higher 30 bits after rol 2 + .endm + + .macro W_PRECALC_16_31_3 // input arguments: W, i, K_XMM +#if defined (__i386__) + mov K_BASE, T1 // K_BASE is store in the stack memory for i386 +#endif + pxor $0, W_TMP + pxor W_TMP2, W_TMP // W_TMP = (W3 ^ W16 ^ W8 ^ W14) rol 1 ^ (W[i] 0 0 0) rol 2 + xmov W_TMP, $0 // save W = W_TMP in the W circular buffer +#if defined (__x86_64__) + paddd $2(K_BASE), W_TMP // W+K +#else + paddd $2(T1), W_TMP // W+K +#endif + xmov W_TMP, WK($1&~3) // save WK = W+K for later update of the hashes A/B/C/D/E + .endm + + // the following is a variant of W_PRECALC_16_31_0_ssse3 to be used for system without ssse3, palignr is replaced with 4 instructions + + .macro W_PRECALC_16_31_0_nossse3 // input arguments : W16,W12,W8,W4,W + xmov $1, $4 // W = W12 = (w9 w10 w11 w12) + + // the following is a wrokaround for palignr + xmov $0, W_TMP // W16 = (w13 w14 w15 w16) + pslldq $$8, $4 // shift left to make (w11 w12 0 0) + psrldq $$8, W_TMP // shift right to make (0 0 w13 w14) + por W_TMP, $4 // W = W14 = (w11 w12 w13 w14) + + xmov $3, W_TMP // W_TMP = W4 = (w1 w2 w3 w4) + psrldq $$4, W_TMP // W_TMP = W3 = (0 w1 w2 w3) + pxor $2, $4 // W = W8 ^ W14 + .endm + + /* rounds 32-79 compute W und W+K iusing the vectorization approach from the Intel article + + W = rotate_left(left_shift(concatenate(W8,W4),64) ^ W16 ^ W28 ^ W32, 2); + + where left_shift(concatenate(W8,W4),64) is equivalent to W6. Note also that W32 and W use the same register. + + + 0. W_tmp = W6; W = W28 ^ W32; + 1. W = W_tmp = W6 ^ W16 ^ W28 ^ W32; + 2. W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2; + 3. W = W_Tmp; WK = W_tmp + K; + + */ + + + .macro W_PRECALC_32_79_0_ssse3 // inputr arguments : W28,W8,W4,W + xmov $2, W_TMP // (w1 w2 w3 w4) + pxor $0, $3 // W = W28 ^ W32; + palignr $$8, $1, W_TMP // W_tmp = (w3 w4 w5 w6) = W6; + .endm + + // the following is a variant and will be used for system without ssse3 support + .macro W_PRECALC_32_79_0_nossse3 // input arguments : W28,W8,W4,W + xmov $2, W_TMP // (w1 w2 w3 w4) + xmov $1, W_TMP2 // (w5 w6 w7 w8) + pxor $0, $3 // W = W28 ^ W32 + pslldq $$8, W_TMP // (w3 w4 0 0) + psrldq $$8, W_TMP2 // (0 0 w5 w6) + por W_TMP2, W_TMP // W_tmp = (w3 w4 w5 w6) = W6 + .endm + + // this is a variant of W_PRECALC_32_79_0_ssse3 for i386 (as W24/W28 are stored in memory, not in registers) + .macro W_PRECALC_32_79_0_i386_ssse3 // input arguments : W28,W8,W4,W + xmov $3, W_TMP // W32 + pxor $0, W_TMP // W28 ^ W32 + xmov W_TMP, $3 // W = W28 ^ W32; + xmov $2, W_TMP // W4 + palignr $$8, $1, W_TMP // W_tmp = (w3 w4 w5 w6) = W6; + .endm + + // this is a variant of W_PRECALC_32_79_0_nossse3 for i386 (as W24/W28 are stored in memory, not in registers) + .macro W_PRECALC_32_79_0_i386_nossse3 // input arguments : W28,W8,W4,W + xmov $3, W_TMP // W32 + pxor $0, W_TMP // W28 ^ W32 + xmov W_TMP, $3 // W = W28 ^ W32 + xmov $2, W_TMP // W4 = (w1 w2 w3 w4) + xmov $1, W_TMP2 // W8 = (w5 w6 w7 w8) + pslldq $$8, W_TMP // (w3 w4 0 0) + psrldq $$8, W_TMP2 // (0 0 w5 w6) + por W_TMP2, W_TMP // W_tmp = (w3 w4 w5 w6) = W6 + .endm + + .macro W_PRECALC_32_79_1 // input arguments : W16,W + pxor $0, W_TMP // W_tmp = W6 ^ W16 + pxor $1, W_TMP // W_tmp = W6 ^ W16 ^ W28 ^ W32 + xmov W_TMP, $1 // W = W_tmp = W6 ^ W16 ^ W28 ^ W32 + .endm + + .macro W_PRECALC_32_79_2 // input argument : W + psrld $$30, $0 // W >> 30 + pslld $$2, W_TMP // W << 2 + por $0, W_TMP // W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2 + .endm + + // this is a variant of W_PRECALC_32_79_2 for i386 (as W24/W28 are stored in memory, not in registers) + // this should be used when the input is either W24 or W28 on i386 architecture + .macro W_PRECALC_32_79_2_i386 // input argument : W + xmov $0, W_TMP2 // W + psrld $$30, W_TMP2 // W >> 30 + xmov W_TMP2, $0 // save (W >> 30) at W + pslld $$2, W_TMP // W_tmp << 2 + por $0, W_TMP // W_tmp = (W6 ^ W16 ^ W28 ^ W32) rol 2 + .endm + + .macro W_PRECALC_32_79_3 // input argument W, i, K_XMM +#if defined (__x86_64__) + xmov W_TMP, $0 // W = (W6 ^ W16 ^ W28 ^ W32) rol 2 + paddd $2(K_BASE), W_TMP // W + K + xmov W_TMP, WK($1&~3) // write W+K +#else + mov K_BASE, T1 // T1 = K_BASE (which is in the caller argument) + xmov W_TMP, $0 // W = (W6 ^ W16 ^ W28 ^ W32) rol 2 + paddd $2(T1), W_TMP // W_tmp = W + K + xmov W_TMP, WK($1&~3) // write WK +#endif + .endm + + + /* The hash update operation is completed by the following statements. + + A[i+1] = FN + E[i] + ROTATE_LEFT( A[i], 5 ) + WK(i); + B[i+1] = A[i]; + C[i+1] = ROTATE_LEFT( B[i], 30 ); + D[i+1] = C[i]; + E[i+1] = D[i]; + + Suppose we start with A0,B0,C0,D0,E0. The 1st iteration can be expressed as follows: + + A1 = FN + E0 + rol(A0,5) + WK; + B1 = A0; + C1 = rol(B0, 30); + D1 = C0; + E1 = D0; + + to avoid excessive memory movement between registers, + 1. A1 = FN + E0 + rol(A0,5) + WK; can be temporarily saved in E0, + 2. C1 = rol(B0,30) can be temporarily saved in B0. + + Therefore, ignoring the time index, the update operation is equivalent to + 1. E = FN(B,C,D) + E + rol(A,5) + WK(i) + 2. B = rol(B,30) + 3. the hashes are now stored in the order of E,A,B,C,D + + + To pack 2 hash update operations in 1 iteration, starting with A,B,C,D,E + 1. E = FN(B,C,D) + E + rol(A,5) + WK(i) + 2. B = rol(B,30) + // now the hashes are in the order of E,A,B,C,D + 3. D = FN(A,B,C) + D + rol(E,5) + WK(i+1) + 4. A = rol(A,30) + // now the hashes are in the order of D,E,A,B,C + + These operations are distributed into the following 2 macro definitions RR0 and RR1. + + */ + + .macro RR0 // input arguments : FN, A, B, C, D, E, i + $0 $2, $3, $4 // T1 = FN(B,C,D) + add WK($6), $5 // E + WK(i) + rol $$30, $2 // B = rol(B,30) + mov $1, T2 // T2 = A + add WK($6+1), $4 // D + WK(i+1) + rol $$5, T2 // rol(A,5) + add T1, $5 // E = FN(B,C,D) + E + WK(i) + .endm + + .macro RR1 + add $5, T2 // T2 = FN(B,C,D) + E + rol(A,5) + WK(i) + mov T2, $5 // E = FN(B,C,D) + E + rol(A,5) + WK(i) + rol $$5, T2 // rol(E,5) + add T2, $4 // D + WK(i+1) + rol(E,5) + $0 $1, $2, $3 // FN(A,B,C) + add T1, $4 // D = FN(A,B,C) + D + rol(E,5) + WK(i+1) + rol $$30, $1 // A = rol(A,30) + .endm + + + + /* + + The following macro definitions are used to expand code for the per-block sha1 operation. + + INITIAL_W_PRECALC_ssse3 : BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack memory + INTERNAL_ssse3 : updating W (16:79) and update the digests A/B/C/D/E (i=0:63, based on W+K stored in the stack memory) + ENDING : finishing up update the digests A/B/C/D/E (i=64:79) + + For multiple-block sha1 operation (Multiple_Blocks = 1), INITIAL_W_PRECALC_ssse3 and ENDING are combined + into 1 macro definition for software pipeling. + + SOFTWARE_PIPELINING_ssse3 : BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack, and finishing up update the digests A/B/C/D/E (i=64:79) + + assume cnt (the number of blocks) >= 1, the main code body should look like + + INITIAL_W_PRECALC_ssse3 // W = big_endian_load and pre-compute W+K (i=0:15) + do { + INTERNAL_ssse3 // update W(i=16:79), and update hash digests A/B/C/D/E (i=0:63) + cnt--; + if (cnt==0) break; + BUFFER_PTR += 64; + SOFTWARE_PIPELINING_ssse3; // update hash digests A/B/C/D/E (i=64:79) + W = big_endian_load and pre-compute W+K (i=0:15) + } + ENDING // update hash digests A/B/C/D/E (i=64:79) + + */ + + #define W_PRECALC_00_15_0 W_PRECALC_00_15_0_ssse3 + #define W_PRECALC_00_15_1 W_PRECALC_00_15_1_ssse3 + #define W_PRECALC_16_31_0 W_PRECALC_16_31_0_ssse3 + #define W_PRECALC_32_79_0 W_PRECALC_32_79_0_ssse3 + #define W_PRECALC_32_79_0_i386 W_PRECALC_32_79_0_i386_ssse3 + + + .macro INITIAL_W_PRECALC_ssse3 // BIG_ENDIAN_LOAD(64 bytes block) into W (i=0:15) and store W+K into the stack memory + + // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) + W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W0 + K + W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K + + // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) + W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W28 + K + W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K + + // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) + W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W24 + K + W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K + + // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) + W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W20 + K + W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K + + .endm + + + .macro INTERNAL_ssse3 // updating W (16:79) and update the digests A/B/C/D/E (i=0:63, based on W+K stored in the stack memory) + + // i=16 : W12,W8,W4,W0,W28,W24,W20,W16 + W_PRECALC_16_31_0 W0,W28,W24,W20,W16 + RR0 F1,A,B,C,D,E,0 + W_PRECALC_16_31_1 W0,W16 + RR1 F1,A,B,C,D,E,0 + W_PRECALC_16_31_2 W16 + RR0 F1,D,E,A,B,C,2 + W_PRECALC_16_31_3 W16, 2, 0 + RR1 F1,D,E,A,B,C,2 + + // i=20 : W8,W4,W0,W28,W24,W20,W16,W12 + W_PRECALC_16_31_0 W28,W24,W20,W16,W12 + RR0 F1,B,C,D,E,A,4 + W_PRECALC_16_31_1 W28,W12 + RR1 F1,B,C,D,E,A,4 + W_PRECALC_16_31_2 W12 + RR0 F1,E,A,B,C,D,6 + W_PRECALC_16_31_3 W12, 6, 16 + RR1 F1,E,A,B,C,D,6 + + // i=24 : W4,W0,W28,W24,W20,W16,W12,W8 + W_PRECALC_16_31_0 W24,W20,W16,W12,W8 + RR0 F1,C,D,E,A,B,8 + W_PRECALC_16_31_1 W24,W8 + RR1 F1,C,D,E,A,B,8 + W_PRECALC_16_31_2 W8 + RR0 F1,A,B,C,D,E,10 + W_PRECALC_16_31_3 W8,10,16 + RR1 F1,A,B,C,D,E,10 + + // i=28 : W0,W28,W24,W20,W16,W12,W8,W4 + W_PRECALC_16_31_0 W20,W16,W12,W8,W4 + RR0 F1,D,E,A,B,C,12 + W_PRECALC_16_31_1 W20,W4 + RR1 F1,D,E,A,B,C,12 + W_PRECALC_16_31_2 W4 + RR0 F1,B,C,D,E,A,14 + W_PRECALC_16_31_3 W4,14,16 + RR1 F1,B,C,D,E,A,14 + + // i=32 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0 W28,W8,W4,W0 + RR0 F1,E,A,B,C,D,16 + W_PRECALC_32_79_1 W16,W0 + RR1 F1,E,A,B,C,D,16 + W_PRECALC_32_79_2 W0 + RR0 F1,C,D,E,A,B,18 + W_PRECALC_32_79_3 W0,18,16 + RR1 F1,C,D,E,A,B,18 + + // starting using F2 + + // i=36 : W24,W20,W16,W12,W8,W4,W0,W28 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W24,W4,W0,W28 +#else + W_PRECALC_32_79_0_i386 W24,W4,W0,W28 +#endif + RR0 F2,A,B,C,D,E,20 + W_PRECALC_32_79_1 W12,W28 + RR1 F2,A,B,C,D,E,20 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W28 +#else + W_PRECALC_32_79_2_i386 W28 +#endif + RR0 F2,D,E,A,B,C,22 + W_PRECALC_32_79_3 W28,22,16 + RR1 F2,D,E,A,B,C,22 + + // i=40 : W20,W16,W12,W8,W4,W0,W28,W24 + #undef K_XMM + #define K_XMM 32 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W20,W0,W28,W24 +#else + W_PRECALC_32_79_0_i386 W20,W0,W28,W24 +#endif + RR0 F2,B,C,D,E,A,24 + W_PRECALC_32_79_1 W8,W24 + RR1 F2,B,C,D,E,A,24 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W24 +#else + W_PRECALC_32_79_2_i386 W24 +#endif + RR0 F2,E,A,B,C,D,26 + W_PRECALC_32_79_3 W24,26,K_XMM + RR1 F2,E,A,B,C,D,26 + + // i=44 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0 W16,W28,W24,W20 + RR0 F2,C,D,E,A,B,28 + W_PRECALC_32_79_1 W4,W20 + RR1 F2,C,D,E,A,B,28 + W_PRECALC_32_79_2 W20 + RR0 F2,A,B,C,D,E,30 + W_PRECALC_32_79_3 W20,30,K_XMM + RR1 F2,A,B,C,D,E,30 + + // i=48 : W12,W8,W4,W0,W28,W24,W20,W16 + W_PRECALC_32_79_0 W12,W24,W20,W16 + RR0 F2,D,E,A,B,C,32 + W_PRECALC_32_79_1 W0,W16 + RR1 F2,D,E,A,B,C,32 + W_PRECALC_32_79_2 W16 + RR0 F2,B,C,D,E,A,34 + W_PRECALC_32_79_3 W16,34,K_XMM + RR1 F2,B,C,D,E,A,34 + + // i=52 : W8,W4,W0,W28,W24,W20,W16,W12 + W_PRECALC_32_79_0 W8,W20,W16,W12 + RR0 F2,E,A,B,C,D,36 + W_PRECALC_32_79_1 W28,W12 + RR1 F2,E,A,B,C,D,36 + W_PRECALC_32_79_2 W12 + RR0 F2,C,D,E,A,B,38 + W_PRECALC_32_79_3 W12,38,K_XMM + RR1 F2,C,D,E,A,B,38 + + // starting using F3 + + // i=56 : W4,W0,W28,W24,W20,W16,W12,W8 + W_PRECALC_32_79_0 W4,W16,W12,W8 + RR0 F3,A,B,C,D,E,40 + W_PRECALC_32_79_1 W24,W8 + RR1 F3,A,B,C,D,E,40 + W_PRECALC_32_79_2 W8 + RR0 F3,D,E,A,B,C,42 + W_PRECALC_32_79_3 W8,42,K_XMM + RR1 F3,D,E,A,B,C,42 + + // i=60 : W0,W28,W24,W20,W16,W12,W8,W4 + #undef K_XMM + #define K_XMM 48 + W_PRECALC_32_79_0 W0,W12,W8,W4 + RR0 F3,B,C,D,E,A,44 + W_PRECALC_32_79_1 W20,W4 + RR1 F3,B,C,D,E,A,44 + W_PRECALC_32_79_2 W4 + RR0 F3,E,A,B,C,D,46 + W_PRECALC_32_79_3 W4,46,K_XMM + RR1 F3,E,A,B,C,D,46 + + // i=64 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0 W28,W8,W4,W0 + RR0 F3,C,D,E,A,B,48 + W_PRECALC_32_79_1 W16,W0 + RR1 F3,C,D,E,A,B,48 + W_PRECALC_32_79_2 W0 + RR0 F3,A,B,C,D,E,50 + W_PRECALC_32_79_3 W0,50,K_XMM + RR1 F3,A,B,C,D,E,50 + + // i=68 : W24,W20,W16,W12,W8,W4,W0,W28 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W24,W4,W0,W28 +#else + W_PRECALC_32_79_0_i386 W24,W4,W0,W28 +#endif + RR0 F3,D,E,A,B,C,52 + W_PRECALC_32_79_1 W12,W28 + RR1 F3,D,E,A,B,C,52 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W28 +#else + W_PRECALC_32_79_2_i386 W28 +#endif + RR0 F3,B,C,D,E,A,54 + W_PRECALC_32_79_3 W28,54,K_XMM + RR1 F3,B,C,D,E,A,54 + + // i=72 : W20,W16,W12,W8,W4,W0,W28,W24 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W20,W0,W28,W24 +#else + W_PRECALC_32_79_0_i386 W20,W0,W28,W24 +#endif + RR0 F3,E,A,B,C,D,56 + W_PRECALC_32_79_1 W8,W24 + RR1 F3,E,A,B,C,D,56 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W24 +#else + W_PRECALC_32_79_2_i386 W24 +#endif + RR0 F3,C,D,E,A,B,58 + W_PRECALC_32_79_3 W24,58,K_XMM + RR1 F3,C,D,E,A,B,58 + + // starting using F4 + + // i=76 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0 W16,W28,W24,W20 + RR0 F4,A,B,C,D,E,60 + W_PRECALC_32_79_1 W4,W20 + RR1 F4,A,B,C,D,E,60 + W_PRECALC_32_79_2 W20 + RR0 F4,D,E,A,B,C,62 + W_PRECALC_32_79_3 W20,62,K_XMM + RR1 F4,D,E,A,B,C,62 + + .endm + + .macro SOFTWARE_PIPELINING_ssse3 + // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) + RR0 F4,B,C,D,E,A,64 + W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP + RR1 F4,B,C,D,E,A,64 + W_PRECALC_00_15_2 // W_TMP = W0 + K + RR0 F4,E,A,B,C,D,66 + W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K + RR1 F4,E,A,B,C,D,66 + + // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) + RR0 F4,C,D,E,A,B,68 + W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP + RR1 F4,C,D,E,A,B,68 + W_PRECALC_00_15_2 // W_TMP = W28 + K + RR0 F4,A,B,C,D,E,70 + W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K[0] + RR1 F4,A,B,C,D,E,70 + + // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) + RR0 F4,D,E,A,B,C,72 + W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP + RR1 F4,D,E,A,B,C,72 + W_PRECALC_00_15_2 // W_TMP = W24 + K + RR0 F4,B,C,D,E,A,74 + W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K + RR1 F4,B,C,D,E,A,74 + + // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) + RR0 F4,E,A,B,C,D,76 + W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP + RR1 F4,E,A,B,C,D,76 + W_PRECALC_00_15_2 // W_TMP = W20 + K + RR0 F4,C,D,E,A,B,78 + W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K + RR1 F4,C,D,E,A,B,78 + .endm + + + #undef W_PRECALC_00_15_0 + #undef W_PRECALC_00_15_1 + #undef W_PRECALC_16_31_0 + #undef W_PRECALC_32_79_0 + #undef W_PRECALC_32_79_0_i386 + + + + /* + + The following are 3 macro definitions that are no-ssse3 variants of the previous 3 macro definitions. + + INITIAL_W_PRECALC_nossse3 + INTERNAL_nossse3 + SOFTWARE_PIPELINING_nossse3 + + They will be used in a sha1 code main body definition that will be used for system without ssse3 support. + + */ + + #define W_PRECALC_00_15_0 W_PRECALC_00_15_0_nossse3 + #define W_PRECALC_00_15_1 W_PRECALC_00_15_1_nossse3 + #define W_PRECALC_16_31_0 W_PRECALC_16_31_0_nossse3 + #define W_PRECALC_32_79_0 W_PRECALC_32_79_0_nossse3 + #define W_PRECALC_32_79_0_i386 W_PRECALC_32_79_0_i386_nossse3 + + + .macro INITIAL_W_PRECALC_nossse3 + + // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) + W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W0 + K + W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K + + // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) + W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W28 + K + W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K + + // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) + W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W24 + K + W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K + + // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) + W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP + W_PRECALC_00_15_2 // W_TMP = W20 + K + W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K + + .endm + + + .macro INTERNAL_nossse3 + // i=16 + // circular buffer : W12,W8,W4,W0,W28,W24,W20,W16 + W_PRECALC_16_31_0 W0,W28,W24,W20,W16 + RR0 F1,A,B,C,D,E,0 + W_PRECALC_16_31_1 W0,W16 + RR1 F1,A,B,C,D,E,0 + W_PRECALC_16_31_2 W16 + RR0 F1,D,E,A,B,C,2 + W_PRECALC_16_31_3 W16, 2, 0 + RR1 F1,D,E,A,B,C,2 + + // i=20, + // W8,W4,W0,W28,W24,W20,W16,W12 + W_PRECALC_16_31_0 W28,W24,W20,W16,W12 + RR0 F1,B,C,D,E,A,4 + W_PRECALC_16_31_1 W28,W12 + RR1 F1,B,C,D,E,A,4 + + W_PRECALC_16_31_2 W12 + RR0 F1,E,A,B,C,D,6 + W_PRECALC_16_31_3 W12, 6, 16 + RR1 F1,E,A,B,C,D,6 + + // i=24, + // W4,W0,W28,W24,W20,W16,W12,W8 + W_PRECALC_16_31_0 W24,W20,W16,W12,W8 + RR0 F1,C,D,E,A,B,8 + W_PRECALC_16_31_1 W24,W8 + RR1 F1,C,D,E,A,B,8 + + W_PRECALC_16_31_2 W8 + RR0 F1,A,B,C,D,E,10 + W_PRECALC_16_31_3 W8,10,16 + RR1 F1,A,B,C,D,E,10 + + // i=28 + // W0,W28,W24,W20,W16,W12,W8,W4 + W_PRECALC_16_31_0 W20,W16,W12,W8,W4 + RR0 F1,D,E,A,B,C,12 + W_PRECALC_16_31_1 W20,W4 + RR1 F1,D,E,A,B,C,12 + + W_PRECALC_16_31_2 W4 + RR0 F1,B,C,D,E,A,14 + W_PRECALC_16_31_3 W4,14,16 + RR1 F1,B,C,D,E,A,14 + + //i=32 + // W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0 W28,W8,W4,W0 + RR0 F1,E,A,B,C,D,16 + W_PRECALC_32_79_1 W16,W0 + RR1 F1,E,A,B,C,D,16 + W_PRECALC_32_79_2 W0 + RR0 F1,C,D,E,A,B,18 + W_PRECALC_32_79_3 W0,18,16 + RR1 F1,C,D,E,A,B,18 + + //i=36 + // W24,W20,W16,W12,W8,W4,W0,W28 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W24,W4,W0,W28 +#else + W_PRECALC_32_79_0_i386 W24,W4,W0,W28 +#endif + RR0 F2,A,B,C,D,E,20 + W_PRECALC_32_79_1 W12,W28 + RR1 F2,A,B,C,D,E,20 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W28 +#else + W_PRECALC_32_79_2_i386 W28 +#endif + RR0 F2,D,E,A,B,C,22 + W_PRECALC_32_79_3 W28,22,16 + RR1 F2,D,E,A,B,C,22 + + //i=40 + #undef K_XMM + #define K_XMM 32 + // W20,W16,W12,W8,W4,W0,W28,W24 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W20,W0,W28,W24 +#else + W_PRECALC_32_79_0_i386 W20,W0,W28,W24 +#endif + RR0 F2,B,C,D,E,A,24 + W_PRECALC_32_79_1 W8,W24 + RR1 F2,B,C,D,E,A,24 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W24 +#else + W_PRECALC_32_79_2_i386 W24 +#endif + RR0 F2,E,A,B,C,D,26 + W_PRECALC_32_79_3 W24,26,K_XMM + RR1 F2,E,A,B,C,D,26 + + //i=44 + // W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0 W16,W28,W24,W20 + RR0 F2,C,D,E,A,B,28 + W_PRECALC_32_79_1 W4,W20 + RR1 F2,C,D,E,A,B,28 + W_PRECALC_32_79_2 W20 + RR0 F2,A,B,C,D,E,30 + W_PRECALC_32_79_3 W20,30,K_XMM + RR1 F2,A,B,C,D,E,30 + + //i=48 + // W12,W8,W4,W0,W28,W24,W20,W16 + W_PRECALC_32_79_0 W12,W24,W20,W16 + RR0 F2,D,E,A,B,C,32 + W_PRECALC_32_79_1 W0,W16 + RR1 F2,D,E,A,B,C,32 + W_PRECALC_32_79_2 W16 + RR0 F2,B,C,D,E,A,34 + W_PRECALC_32_79_3 W16,34,K_XMM + RR1 F2,B,C,D,E,A,34 + + //i=52 + // W8,W4,W0,W28,W24,W20,W16,W12 + W_PRECALC_32_79_0 W8,W20,W16,W12 + RR0 F2,E,A,B,C,D,36 + W_PRECALC_32_79_1 W28,W12 + RR1 F2,E,A,B,C,D,36 + W_PRECALC_32_79_2 W12 + RR0 F2,C,D,E,A,B,38 + W_PRECALC_32_79_3 W12,38,K_XMM + RR1 F2,C,D,E,A,B,38 + + //i=56 + // W4,W0,W28,W24,W20,W16,W12,W8 + W_PRECALC_32_79_0 W4,W16,W12,W8 + RR0 F3,A,B,C,D,E,40 + W_PRECALC_32_79_1 W24,W8 + RR1 F3,A,B,C,D,E,40 + W_PRECALC_32_79_2 W8 + RR0 F3,D,E,A,B,C,42 + W_PRECALC_32_79_3 W8,42,K_XMM + RR1 F3,D,E,A,B,C,42 + + //i=60 + #undef K_XMM + #define K_XMM 48 + // W0,W28,W24,W20,W16,W12,W8,W4 + W_PRECALC_32_79_0 W0,W12,W8,W4 + RR0 F3,B,C,D,E,A,44 + W_PRECALC_32_79_1 W20,W4 + RR1 F3,B,C,D,E,A,44 + W_PRECALC_32_79_2 W4 + RR0 F3,E,A,B,C,D,46 + W_PRECALC_32_79_3 W4,46,K_XMM + RR1 F3,E,A,B,C,D,46 + + //i=64 + // W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_32_79_0 W28,W8,W4,W0 + RR0 F3,C,D,E,A,B,48 + W_PRECALC_32_79_1 W16,W0 + RR1 F3,C,D,E,A,B,48 + W_PRECALC_32_79_2 W0 + RR0 F3,A,B,C,D,E,50 + W_PRECALC_32_79_3 W0,50,K_XMM + RR1 F3,A,B,C,D,E,50 + + //i=68 + // W24,W20,W16,W12,W8,W4,W0,W28 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W24,W4,W0,W28 +#else + W_PRECALC_32_79_0_i386 W24,W4,W0,W28 +#endif + RR0 F3,D,E,A,B,C,52 + W_PRECALC_32_79_1 W12,W28 + RR1 F3,D,E,A,B,C,52 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W28 +#else + W_PRECALC_32_79_2_i386 W28 +#endif + RR0 F3,B,C,D,E,A,54 + W_PRECALC_32_79_3 W28,54,K_XMM + RR1 F3,B,C,D,E,A,54 + + //i=72 + // W20,W16,W12,W8,W4,W0,W28,W24 +#if defined (__x86_64__) + W_PRECALC_32_79_0 W20,W0,W28,W24 +#else + W_PRECALC_32_79_0_i386 W20,W0,W28,W24 +#endif + RR0 F3,E,A,B,C,D,56 + W_PRECALC_32_79_1 W8,W24 + RR1 F3,E,A,B,C,D,56 +#if defined (__x86_64__) + W_PRECALC_32_79_2 W24 +#else + W_PRECALC_32_79_2_i386 W24 +#endif + RR0 F3,C,D,E,A,B,58 + W_PRECALC_32_79_3 W24,58,K_XMM + RR1 F3,C,D,E,A,B,58 + + // starting using F4 + + //i=76 + // W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_32_79_0 W16,W28,W24,W20 + RR0 F4,A,B,C,D,E,60 + W_PRECALC_32_79_1 W4,W20 + RR1 F4,A,B,C,D,E,60 + W_PRECALC_32_79_2 W20 + RR0 F4,D,E,A,B,C,62 + W_PRECALC_32_79_3 W20,62,K_XMM + RR1 F4,D,E,A,B,C,62 + + .endm + + .macro SOFTWARE_PIPELINING_nossse3 + // i=0 : W28,W24,W20,W16,W12,W8,W4,W0 + W_PRECALC_00_15_0 0 // W_TMP = (BUFFER_PTR) + RR0 F4,B,C,D,E,A,64 + W_PRECALC_00_15_1 W0 // convert W_TMP to big-endian, and save W0 = W_TMP + RR1 F4,B,C,D,E,A,64 + W_PRECALC_00_15_2 // W_TMP = W0 + K + RR0 F4,E,A,B,C,D,66 + W_PRECALC_00_15_3 3 // (sp) = W_TMP = W0 + K + RR1 F4,E,A,B,C,D,66 + + // i=4 : W24,W20,W16,W12,W8,W4,W0,W28 + W_PRECALC_00_15_0 4 // W_TMP = 16(BUFFER_PTR) + RR0 F4,C,D,E,A,B,68 + W_PRECALC_00_15_1 W28 // convert W_TMP to big-endian, and save W28 = W_TMP + RR1 F4,C,D,E,A,B,68 + W_PRECALC_00_15_2 // W_TMP = W28 + K + RR0 F4,A,B,C,D,E,70 + W_PRECALC_00_15_3 7 // 16(sp) = W_TMP = W28 + K[0] + RR1 F4,A,B,C,D,E,70 + + // i=8 : W20,W16,W12,W8,W4,W0,W28,W24 + W_PRECALC_00_15_0 8 // W_TMP = 32(BUFFER_PTR) + RR0 F4,D,E,A,B,C,72 + W_PRECALC_00_15_1 W24 // convert W_TMP to big-endian, and save W24 = W_TMP + RR1 F4,D,E,A,B,C,72 + W_PRECALC_00_15_2 // W_TMP = W24 + K + RR0 F4,B,C,D,E,A,74 + W_PRECALC_00_15_3 11 // 32(sp) = W_TMP = W24 + K + RR1 F4,B,C,D,E,A,74 + + // i=12 : W16,W12,W8,W4,W0,W28,W24,W20 + W_PRECALC_00_15_0 12 // W_TMP = 48(BUFFER_PTR) + RR0 F4,E,A,B,C,D,76 + W_PRECALC_00_15_1 W20 // convert W_TMP to big-endian, and save W20 = W_TMP + RR1 F4,E,A,B,C,D,76 + W_PRECALC_00_15_2 // W_TMP = W20 + K + RR0 F4,C,D,E,A,B,78 + W_PRECALC_00_15_3 15 // 48(sp) = W_TMP = W20 + K + RR1 F4,C,D,E,A,B,78 + .endm + + .macro ENDING // finish up updating hash digests (i=64:79) + //i=80 + RR0 F4,B,C,D,E,A,64 + RR1 F4,B,C,D,E,A,64 + RR0 F4,E,A,B,C,D,66 + RR1 F4,E,A,B,C,D,66 + + //i=84 + RR0 F4,C,D,E,A,B,68 + RR1 F4,C,D,E,A,B,68 + RR0 F4,A,B,C,D,E,70 + RR1 F4,A,B,C,D,E,70 + + //i=88 + RR0 F4,D,E,A,B,C,72 + RR1 F4,D,E,A,B,C,72 + RR0 F4,B,C,D,E,A,74 + RR1 F4,B,C,D,E,A,74 + + //i=92 + RR0 F4,E,A,B,C,D,76 + RR1 F4,E,A,B,C,D,76 + RR0 F4,C,D,E,A,B,78 + RR1 F4,C,D,E,A,B,78 + .endm + + // load hash digests A,B,C,D,E from memory into registers + .macro LOAD_HASH +#if defined (__x86_64__) + mov (HASH_PTR), A + mov 4(HASH_PTR), B + mov 8(HASH_PTR), C + mov 12(HASH_PTR), D + mov 16(HASH_PTR), E +#else + mov HASH_PTR, T1 + mov (T1), A + mov 4(T1), B + mov 8(T1), C + mov 12(T1), D + mov 16(T1), E +#endif + .endm + + .macro UPDATE_HASH + add $0, $1 + mov $1, $0 + .endm + + .macro UPDATE_ALL_HASH +#if defined (__x86_64__) + UPDATE_HASH (HASH_PTR), A + UPDATE_HASH 4(HASH_PTR), B + UPDATE_HASH 8(HASH_PTR), C + UPDATE_HASH 12(HASH_PTR), D + UPDATE_HASH 16(HASH_PTR), E +#else + mov HASH_PTR, T1 + UPDATE_HASH (T1), A + UPDATE_HASH 4(T1), B + UPDATE_HASH 8(T1), C + UPDATE_HASH 12(T1), D + UPDATE_HASH 16(T1), E +#endif + .endm + + + /* + main sha1 code for system without ssse3 support + */ + + .macro SHA1_PIPELINED_MAIN_BODY_nossse3 + LOAD_HASH // load initial hashes into A,B,C,D,E (registers) + INITIAL_W_PRECALC_nossse3 // big_endian_load(W) and W+K (i=0:15) + .align 4,0x90 +0: + INTERNAL_nossse3 // update W (i=16:79) and update ABCDE (i=0:63) +#if Multiple_Blocks +#if defined(__x86_64__) + add $$64, BUFFER_PTR // BUFFER_PTR+=64; + sub $$1, cnt // pre-decrement cnt by 1 +#else + addl $$64, BUFFER_PTR // BUFFER_PTR+=64; + subl $$1, cnt // pre-decrement cnt by 1 +#endif + jbe 1f // if cnt <= 0, branch to finish off + SOFTWARE_PIPELINING_nossse3 // update ABCDE (i=64:79) || big_endian_load(W) and W+K (i=0:15) + UPDATE_ALL_HASH // update output hashes + jmp 0b // repeat for next block + .align 4,0x90 +1: +#endif + ENDING // update ABCDE (i=64:79) + UPDATE_ALL_HASH // update output hashes + .endm + + /* + main sha1 code for system with ssse3 support + */ + + .macro SHA1_PIPELINED_MAIN_BODY_ssse3 + LOAD_HASH // load initial hashes into A,B,C,D,E + INITIAL_W_PRECALC_ssse3 // big_endian_load(W) and W+K (i=0:15) + .align 4,0x90 +0: + INTERNAL_ssse3 // update W (i=16:79) and update ABCDE (i=0:63) +#if Multiple_Blocks +#if defined(__x86_64__) + add $$64, BUFFER_PTR // BUFFER_PTR+=64; + sub $$1, cnt // pre-decrement cnt by 1 +#else + addl $$64, BUFFER_PTR // BUFFER_PTR+=64; + subl $$1, cnt // pre-decrement cnt by 1 +#endif + jbe 1f // if cnt <= 0, branch to finish off + SOFTWARE_PIPELINING_ssse3 // update ABCDE (i=64:79) || big_endian_load(W) and W+K (i=0:15) + UPDATE_ALL_HASH // update output hashes + jmp 0b // repeat for next block + .align 4,0x90 +1: +#endif + ENDING // update ABCDE (i=64:79) + UPDATE_ALL_HASH // update output hashes + .endm + +#if KERNEL +#include +#else +#include +#endif + + .text + + .globl _sha1_x86_compress_data_order + .private_extern _sha1_x86_compress_data_order +_sha1_x86_compress_data_order: + + // detect SSSE3 and dispatch appropriate code branch + #if defined __x86_64__ + movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capabilities + mov (%rax), %eax // %eax = __cpu_capabilities + #else // i386 + #if KERNEL + leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities + mov (%eax), %eax // %eax = __cpu_capabilities + #else + mov _COMM_PAGE_CPU_CAPABILITIES, %eax + #endif + #endif + test $(kHasSupplementalSSE3), %eax + je _SHA1Compress_x86nossse3 // branch to no-ssse3 code + + // start the sha1 code with ssse3 support + + // save callee-save registers +#if defined (__x86_64__) + push %rbx + push %rbp +#else + push %ebx + push %ebp + push %esi + push %edi +#endif + + sub $stack_size, sp // allocate stack memory for use + + // save used xmm register if this is for kernel +#if KERNEL + xmov %xmm0, 4*16(sp) + xmov %xmm1, 5*16(sp) + xmov %xmm2, 6*16(sp) + xmov %xmm3, 7*16(sp) + xmov %xmm4, 8*16(sp) + xmov %xmm5, 9*16(sp) + xmov %xmm6, 10*16(sp) + xmov %xmm7, 11*16(sp) +#if defined (__x86_64__) + xmov %xmm8, 12*16(sp) + xmov %xmm9, 13*16(sp) + xmov %xmm10, 14*16(sp) +#endif +#endif + +#if defined (__x86_64__) + + // set up registers to free %edx/%edi/%esi for other use (ABCDE) + mov ctx, HASH_PTR + mov buf, BUFFER_PTR +#if Multiple_Blocks + mov %rdx, cnt +#endif + lea K_XMM_AR(%rip), K_BASE + xmov 0x40(K_BASE), XMM_SHUFB_BSWAP + +#else // __i386__ + +#if KERNEL + lea K_XMM_AR, %eax +#else + // Get address of 0 in R. + call 0f // Push program counter onto stack. + 0: pop %eax // Get program counter. + lea K_XMM_AR-0b(%eax), %eax +#endif + mov %eax, K_BASE + xmov 0x40(%eax), %xmm0 + xmov %xmm0, XMM_SHUFB_BSWAP + +#endif + + SHA1_PIPELINED_MAIN_BODY_ssse3 + + // restore used xmm registers if this is for kernel +#if KERNEL + xmov 4*16(sp), %xmm0 + xmov 5*16(sp), %xmm1 + xmov 6*16(sp), %xmm2 + xmov 7*16(sp), %xmm3 + xmov 8*16(sp), %xmm4 + xmov 9*16(sp), %xmm5 + xmov 10*16(sp), %xmm6 + xmov 11*16(sp), %xmm7 +#if defined (__x86_64__) + xmov 12*16(sp), %xmm8 + xmov 13*16(sp), %xmm9 + xmov 14*16(sp), %xmm10 +#endif +#endif + + add $stack_size, sp // deallocate stack memory + + // restore callee-save registers +#if defined (__x86_64__) + pop %rbp + pop %rbx +#else + pop %edi + pop %esi + pop %ebp + pop %ebx +#endif + + ret // return + + // this is equivalent to the above function _SHA1Transform, but it does not use ssse3 instructions + + .globl _SHA1Compress_x86nossse3 + .private_extern _SHA1Compress_x86nossse3 +_SHA1Compress_x86nossse3: + + // push callee-save registers +#if defined (__x86_64__) + push %rbx + push %rbp +#else + push %ebx + push %ebp + push %esi + push %edi +#endif + + sub $stack_size, sp // allocate stack memory for local use + + // save used xmm registers if this is for kernel +#if KERNEL + xmov %xmm0, 4*16(sp) + xmov %xmm1, 5*16(sp) + xmov %xmm2, 6*16(sp) + xmov %xmm3, 7*16(sp) + xmov %xmm4, 8*16(sp) + xmov %xmm5, 9*16(sp) + xmov %xmm6, 10*16(sp) + xmov %xmm7, 11*16(sp) +#if defined (__x86_64__) + xmov %xmm8, 12*16(sp) + xmov %xmm9, 13*16(sp) +#endif +#endif + +#if defined (__x86_64__) + + // set up registers to free %edx/%edi/%esi for other use (ABCDE) + mov ctx, HASH_PTR + mov buf, BUFFER_PTR +#if Multiple_Blocks + mov %rdx, cnt +#endif + lea K_XMM_AR(%rip), K_BASE + +#else // __i386__ + +#if KERNEL + lea K_XMM_AR, %eax +#else + // Get address of 0 in R. + call 0f // Push program counter onto stack. + 0: pop %eax // Get program counter. + lea K_XMM_AR-0b(%eax), %eax +#endif + mov %eax, K_BASE + +#endif + + SHA1_PIPELINED_MAIN_BODY_nossse3 + + // restore used xmm registers if this is for kernel +#if KERNEL + xmov 4*16(sp), %xmm0 + xmov 5*16(sp), %xmm1 + xmov 6*16(sp), %xmm2 + xmov 7*16(sp), %xmm3 + xmov 8*16(sp), %xmm4 + xmov 9*16(sp), %xmm5 + xmov 10*16(sp), %xmm6 + xmov 11*16(sp), %xmm7 +#if defined (__x86_64__) + xmov 12*16(sp), %xmm8 + xmov 13*16(sp), %xmm9 +#endif +#endif + + add $stack_size, sp // deallocate stack memory + + // restore callee-save registers +#if defined (__x86_64__) + pop %rbp + pop %rbx +#else + pop %edi + pop %esi + pop %ebp + pop %ebx +#endif + + ret // return + + .const + .align 4, 0x90 + +#define K1 0x5a827999 +#define K2 0x6ed9eba1 +#define K3 0x8f1bbcdc +#define K4 0xca62c1d6 + +K_XMM_AR: + .long K1 + .long K1 + .long K1 + .long K1 + .long K2 + .long K2 + .long K2 + .long K2 + .long K3 + .long K3 + .long K3 + .long K3 + .long K4 + .long K4 + .long K4 + .long K4 +// bswap_shufb_ctl: accessed thru 0x40(K_XMM_AR) + .long 0x00010203 + .long 0x04050607 + .long 0x08090a0b + .long 0x0c0d0e0f + + + +#endif // architecture x86_64 or i386 + ADDED Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/sha256.s Index: Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/sha256.s ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/sha256.s @@ -0,0 +1,665 @@ +/* + * Copyright (c) 2011 Apple Computer, Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + This file provides x86_64/i386 hand implementation of the following function + + void SHA256_Transform(SHA256_ctx *ctx, char *data, unsigned int num_blocks); + + which is a C function in sha2.c (from xnu). + + The code 1st probes cpu_capabilities to detect whether ssse3 is supported. If not, it branches to + SHA256_Transform_nossse3 (in a separate source file sha256nossse3.s) that was cloned from this file + with all ssse3 instructions replaced with sse3 or below instructions. + + sha256 algorithm per block description: + + 1. W(0:15) = big-endian (per 4 bytes) loading of input data (64 byte) + 2. load 8 digests a-h from ctx->state + 3. for r = 0:15 + T1 = h + Sigma1(e) + Ch(e,f,g) + K[r] + W[r]; + d += T1; + h = T1 + Sigma0(a) + Maj(a,b,c) + permute a,b,c,d,e,f,g,h into h,a,b,c,d,e,f,g + 4. for r = 16:63 + W[r] = W[r-16] + sigma1(W[r-2]) + W[r-7] + sigma0(W[r-15]); + T1 = h + Sigma1(e) + Ch(e,f,g) + K[r] + W[r]; + d += T1; + h = T1 + Sigma0(a) + Maj(a,b,c) + permute a,b,c,d,e,f,g,h into h,a,b,c,d,e,f,g + + In the assembly implementation: + - a circular window of message schedule W(r:r+15) is updated and stored in xmm0-xmm3 + - its corresponding W+K(r:r+15) is updated and stored in a stack space circular buffer + - the 8 digests (a-h) will be stored in GPR or m32 (all in GPR for x86_64, and some in m32 for i386) + + the implementation per block looks like + + ---------------------------------------------------------------------------- + + load W(0:15) (big-endian per 4 bytes) into xmm0:xmm3 + pre_calculate and store W+K(0:15) in stack + + load digests a-h from ctx->state; + + for (r=0;r<48;r+=4) { + digests a-h update and permute round r:r+3 + update W([r:r+3]%16) and WK([r:r+3]%16) for the next 4th iteration + } + + for (r=48;r<64;r+=4) { + digests a-h update and permute round r:r+3 + } + + ctx->states += digests a-h; + + ---------------------------------------------------------------------------- + + our implementation (allows multiple blocks per call) pipelines the loading of W/WK of a future block + into the last 16 rounds of its previous block: + + ---------------------------------------------------------------------------- + + load W(0:15) (big-endian per 4 bytes) into xmm0:xmm3 + pre_calculate and store W+K(0:15) in stack + +L_loop: + + load digests a-h from ctx->state; + + for (r=0;r<48;r+=4) { + digests a-h update and permute round r:r+3 + update W([r:r+3]%16) and WK([r:r+3]%16) for the next 4th iteration + } + + num_block--; + if (num_block==0) jmp L_last_block; + + for (r=48;r<64;r+=4) { + digests a-h update and permute round r:r+3 + load W([r:r+3]%16) (big-endian per 4 bytes) into xmm0:xmm3 + pre_calculate and store W+K([r:r+3]%16) in stack + } + + ctx->states += digests a-h; + + jmp L_loop; + +L_last_block: + + for (r=48;r<64;r+=4) { + digests a-h update and permute round r:r+3 + } + + ctx->states += digests a-h; + + ------------------------------------------------------------------------ + + Apple CoreOS vector & numerics + cclee 8-3-10 +*/ +#if defined __i386__ || defined __x86_64__ +#if defined KERNEL +#include +#else +#include +#endif + +#if defined (__i386__) +.section __IMPORT,__pointers,non_lazy_symbol_pointers +L_K256$non_lazy_ptr: +.indirect_symbol _K256 +.long 0 +#endif + + + // associate variables with registers or memory + +#if defined (__x86_64__) + #define sp %rsp + #define ctx %rdi + #define data %rsi + #define num_blocks %rdx + + #define a %r8d + #define b %r9d + #define c %r10d + #define d %r11d + #define e %r12d + #define f %r13d + #define g %r14d + #define h %r15d + + #define K %rbx + #define stack_size (8+16*8+16+64) // 8 (align) + xmm0:xmm7 + L_aligned_bswap + WK(0:15) + + #define L_aligned_bswap 64(sp) // bswap : big-endian loading of 4-byte words + #define xmm_save 80(sp) // starting address for xmm save/restore +#else + #define sp %esp + #define stack_size (12+16*8+16+16+64) // 12 (align) + xmm0:xmm7 + 16 (c,f,h,K) + L_aligned_bswap + WK(0:15) + #define ctx_addr 20+stack_size(sp) // ret_addr + 4 registers = 20, 1st caller argument + #define data_addr 24+stack_size(sp) // 2nd caller argument + #define num_blocks 28+stack_size(sp) // 3rd caller argument + + #define a %ebx + #define b %edx + #define c 64(sp) + #define d %ebp + #define e %esi + #define f 68(sp) + #define g %edi + #define h 72(sp) + + #define K 76(sp) // pointer to K256[] table + #define L_aligned_bswap 80(sp) // bswap : big-endian loading of 4-byte words + #define xmm_save 96(sp) // starting address for xmm save/restore +#endif + + // 2 local variables + #define t %eax + #define s %ecx + + // a window (16 words) of message scheule + #define W0 %xmm0 + #define W1 %xmm1 + #define W2 %xmm2 + #define W3 %xmm3 + + // circular buffer for WK[(r:r+15)%16] + #define WK(x) (x&15)*4(sp) + + + +// #define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) + + .macro Ch + mov $0, t // x + mov $0, s // x + not t // ~x + and $1, s // x & y + and $2, t // ~x & z + xor s, t // t = ((x) & (y)) ^ ((~(x)) & (z)); + .endm + +// #define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + + .macro Maj + mov $0, t // x + mov $1, s // y + and s, t // x&y + and $2, s // y&z + xor s, t // (x&y) ^ (y&z) + mov $2, s // z + and $0, s // (x&z) + xor s, t // t = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + .endm + +/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */ +// #define R(b,x) ((x) >> (b)) +/* 32-bit Rotate-right (used in SHA-256): */ +// #define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) + +// #define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) + + // performs sigma0_256 on 4 words on an xmm registers + // use xmm6/xmm7 as intermediate registers + .macro sigma0 + movdqa $0, %xmm6 + movdqa $0, %xmm7 + psrld $$3, $0 // SHR3(x) + psrld $$7, %xmm6 // part of ROTR7 + pslld $$14, %xmm7 // part of ROTR18 + pxor %xmm6, $0 + pxor %xmm7, $0 + psrld $$11, %xmm6 // part of ROTR18 + pslld $$11, %xmm7 // part of ROTR7 + pxor %xmm6, $0 + pxor %xmm7, $0 + .endm + +// #define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) + + // performs sigma1_256 on 4 words on an xmm registers + // use xmm6/xmm7 as intermediate registers + .macro sigma1 + movdqa $0, %xmm6 + movdqa $0, %xmm7 + psrld $$10, $0 // SHR10(x) + psrld $$17, %xmm6 // part of ROTR17 + pxor %xmm6, $0 + pslld $$13, %xmm7 // part of ROTR19 + pxor %xmm7, $0 + psrld $$2, %xmm6 // part of ROTR19 + pxor %xmm6, $0 + pslld $$2, %xmm7 // part of ROTR17 + pxor %xmm7, $0 + .endm + +// #define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) + + .macro Sigma0 + mov $0, t // x + mov $0, s // x + ror $$2, t // S32(2, (x)) + ror $$13, s // S32(13, (x)) + xor s, t // S32(2, (x)) ^ S32(13, (x)) + ror $$9, s // S32(22, (x)) + xor s, t // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) + .endm + +// #define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + + .macro Sigma1 + mov $0, s // x + ror $$6, s // S32(6, (x)) + mov s, t // S32(6, (x)) + ror $$5, s // S32(11, (x)) + xor s, t // S32(6, (x)) ^ S32(11, (x)) + ror $$14, s // S32(25, (x)) + xor s, t // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + .endm + + // per round digests update + .macro round + Sigma1 $4 // t = T1 + add t, $7 // use h to store h+Sigma1(e) + Ch $4, $5, $6 // t = Ch (e, f, g); + add $7, t // t = h+Sigma1(e)+Ch(e,f,g); + add WK($8), t // h = T1 + add t, $3 // d += T1; + mov t, $7 // h = T1 + Sigma0 $0 // t = Sigma0(a); + add t, $7 // h = T1 + Sigma0(a); + Maj $0, $1, $2 // t = Maj(a,b,c) + add t, $7 // h = T1 + Sigma0(a) + Maj(a,b,c); + .endm + + // per 4 rounds digests update and permutation + // permutation is absorbed by rotating the roles of digests a-h + .macro rounds + round $0, $1, $2, $3, $4, $5, $6, $7, 0+$8 + round $7, $0, $1, $2, $3, $4, $5, $6, 1+$8 + round $6, $7, $0, $1, $2, $3, $4, $5, 2+$8 + round $5, $6, $7, $0, $1, $2, $3, $4, 3+$8 + .endm + + // update the message schedule W and W+K (4 rounds) 16 rounds ahead in the future + .macro message_schedule + + // 4 32-bit K256 words in xmm5 +#if defined (__x86_64__) + movdqu (K), %xmm5 + add $$16, K // K points to next K256 word for next iteration +#else + mov K, t + movdqu (t), %xmm5 + addl $$16, K // K points to next K256 word for next iteration +#endif + movdqa $1, %xmm4 // W7:W4 + palignr $$4, $0, %xmm4 // W4:W1 + sigma0 %xmm4 // sigma0(W4:W1) + movdqa $3, %xmm6 // W15:W12 + paddd %xmm4, $0 // $0 = W3:W0 + sigma0(W4:W1) + palignr $$4, $2, %xmm6 // W12:W9 + paddd %xmm6, $0 // $0 = W12:W9 + sigma0(W4:W1) + W3:W0 + movdqa $3, %xmm4 // W15:W12 + psrldq $$8, %xmm4 // 0,0,W15,W14 + sigma1 %xmm4 // sigma1(0,0,W15,W14) + paddd %xmm4, $0 // sigma1(0,0,W15,W14) + W12:W9 + sigma0(W4:W1) + W3:W0 + movdqa $0, %xmm4 // W19-sigma1(W17), W18-sigma1(W16), W17, W16 + pslldq $$8, %xmm4 // W17, W16, 0, 0 + sigma1 %xmm4 // sigma1(W17,W16,0,0) + paddd %xmm4, $0 // W19:W16 + paddd $0, %xmm5 // WK + movdqa %xmm5, WK($4) + .endm + + // this macro is used in the last 16 rounds of a current block + // it reads the next message (16 4-byte words), load it into 4 words W[r:r+3], computes WK[r:r+3] + // and save into stack to prepare for next block + + .macro update_W_WK +#if defined (__x86_64__) + movdqu $0*16(data), $1 // read 4 4-byte words + pshufb L_aligned_bswap, $1 // big-endian of each 4-byte word, W[r:r+3] + movdqu $0*16(K), %xmm4 // K[r:r+3] +#else + mov data_addr, t + movdqu $0*16(t), $1 // read 4 4-byte words + pshufb L_aligned_bswap, $1 // big-endian of each 4-byte word, W[r:r+3] + mov K, t + movdqu $0*16(t), %xmm4 // K[r:r+3] +#endif + paddd $1, %xmm4 // WK[r:r+3] + movdqa %xmm4, WK($0*4) // save WK[r:r+3] into stack circular buffer + .endm + + .text + +#if defined (__x86_64__) || defined (__i386__) + + .globl _vng_x86_sha256_compress + +_vng_x86_sha256_compress: + + + // detect SSSE3 and dispatch appropriate code branch + #if defined __x86_64__ + movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capabilities + mov (%rax), %eax // %eax = __cpu_capabilities + #else // i386 + #if defined KERNEL + leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities + mov (%eax), %eax // %eax = __cpu_capabilities + #else + mov _COMM_PAGE_CPU_CAPABILITIES, %eax + #endif + #endif + test $(kHasSupplementalSSE3), %eax + je _SHA256_Transform_nossse3 // branch to no-ssse3 code + + // push callee-saved registers +#if defined (__x86_64__) + push %rbp + push %rbx + push %r12 + push %r13 + push %r14 + push %r15 +#else + push %ebp + push %ebx + push %esi + push %edi +#endif + + // allocate stack space + sub $stack_size, sp + + // if kernel code, save used xmm registers +#if KERNEL + movdqa %xmm0, 0*16+xmm_save + movdqa %xmm1, 1*16+xmm_save + movdqa %xmm2, 2*16+xmm_save + movdqa %xmm3, 3*16+xmm_save + movdqa %xmm4, 4*16+xmm_save + movdqa %xmm5, 5*16+xmm_save + movdqa %xmm6, 6*16+xmm_save + movdqa %xmm7, 7*16+xmm_save +#endif + + // set up bswap parameters in the aligned stack space and pointer to table K256[] +#if defined (__x86_64__) + lea _K256(%rip), K + lea L_bswap(%rip), %rax + movdqa (%rax), %xmm0 +#else +#if defined (KERNEL) + lea _K256, t +#else + call 0f // Push program counter onto stack. +0: pop t // Get program counter. + movl L_K256$non_lazy_ptr-0b(t), t + +#endif + mov t, K + call 0f // Push program counter onto stack. +0: + pop t // Get program counter. + lea L_bswap-0b(t), t + movdqa (%eax), %xmm0 +#endif + movdqa %xmm0, L_aligned_bswap + + // load W[0:15] into xmm0-xmm3 +#if defined (__x86_64__) + movdqu 0*16(data), W0 + movdqu 1*16(data), W1 + movdqu 2*16(data), W2 + movdqu 3*16(data), W3 + add $64, data +#else + mov data_addr, t + movdqu 0*16(t), W0 + movdqu 1*16(t), W1 + movdqu 2*16(t), W2 + movdqu 3*16(t), W3 + addl $64, data_addr +#endif + pshufb L_aligned_bswap, W0 + pshufb L_aligned_bswap, W1 + pshufb L_aligned_bswap, W2 + pshufb L_aligned_bswap, W3 + + // compute WK[0:15] and save in stack +#if defined (__x86_64__) + movdqu 0*16(K), %xmm4 + movdqu 1*16(K), %xmm5 + movdqu 2*16(K), %xmm6 + movdqu 3*16(K), %xmm7 + add $64, K +#else + mov K, t + movdqu 0*16(t), %xmm4 + movdqu 1*16(t), %xmm5 + movdqu 2*16(t), %xmm6 + movdqu 3*16(t), %xmm7 + addl $64, K +#endif + paddd %xmm0, %xmm4 + paddd %xmm1, %xmm5 + paddd %xmm2, %xmm6 + paddd %xmm3, %xmm7 + movdqa %xmm4, WK(0) + movdqa %xmm5, WK(4) + movdqa %xmm6, WK(8) + movdqa %xmm7, WK(12) + +L_loop: + + // digests a-h = ctx->states; +#if defined (__x86_64__) + mov 0*4(ctx), a + mov 1*4(ctx), b + mov 2*4(ctx), c + mov 3*4(ctx), d + mov 4*4(ctx), e + mov 5*4(ctx), f + mov 6*4(ctx), g + mov 7*4(ctx), h +#else + mov ctx_addr, t + mov 0*4(t), a + mov 1*4(t), b + mov 2*4(t), s + mov s, c + mov 3*4(t), d + mov 4*4(t), e + mov 5*4(t), s + mov s, f + mov 6*4(t), g + mov 7*4(t), s + mov s, h +#endif + + // rounds 0:47 interleaved with W/WK update for rounds 16:63 + rounds a, b, c, d, e, f, g, h, 0 + message_schedule W0,W1,W2,W3,16 + rounds e, f, g, h, a, b, c, d, 4 + message_schedule W1,W2,W3,W0,20 + rounds a, b, c, d, e, f, g, h, 8 + message_schedule W2,W3,W0,W1,24 + rounds e, f, g, h, a, b, c, d, 12 + message_schedule W3,W0,W1,W2,28 + rounds a, b, c, d, e, f, g, h, 16 + message_schedule W0,W1,W2,W3,32 + rounds e, f, g, h, a, b, c, d, 20 + message_schedule W1,W2,W3,W0,36 + rounds a, b, c, d, e, f, g, h, 24 + message_schedule W2,W3,W0,W1,40 + rounds e, f, g, h, a, b, c, d, 28 + message_schedule W3,W0,W1,W2,44 + rounds a, b, c, d, e, f, g, h, 32 + message_schedule W0,W1,W2,W3,48 + rounds e, f, g, h, a, b, c, d, 36 + message_schedule W1,W2,W3,W0,52 + rounds a, b, c, d, e, f, g, h, 40 + message_schedule W2,W3,W0,W1,56 + rounds e, f, g, h, a, b, c, d, 44 + message_schedule W3,W0,W1,W2,60 + + // revert K to the beginning of K256[] +#if defined __x86_64__ + sub $256, K + sub $1, num_blocks // num_blocks-- +#else + subl $256, K + subl $1, num_blocks // num_blocks-- +#endif + + je L_final_block // if final block, wrap up final rounds + + // rounds 48:63 interleaved with W/WK initialization for next block rounds 0:15 + rounds a, b, c, d, e, f, g, h, 48 + update_W_WK 0, W0 + rounds e, f, g, h, a, b, c, d, 52 + update_W_WK 1, W1 + rounds a, b, c, d, e, f, g, h, 56 + update_W_WK 2, W2 + rounds e, f, g, h, a, b, c, d, 60 + update_W_WK 3, W3 + +#if defined (__x86_64__) + add $64, K + add $64, data +#else + addl $64, K + addl $64, data_addr +#endif + + // ctx->states += digests a-h +#if defined (__x86_64__) + add a, 0*4(ctx) + add b, 1*4(ctx) + add c, 2*4(ctx) + add d, 3*4(ctx) + add e, 4*4(ctx) + add f, 5*4(ctx) + add g, 6*4(ctx) + add h, 7*4(ctx) +#else + mov ctx_addr, t + add a, 0*4(t) + add b, 1*4(t) + mov c, s + add s, 2*4(t) + add d, 3*4(t) + add e, 4*4(t) + mov f, s + add s, 5*4(t) + add g, 6*4(t) + mov h, s + add s, 7*4(t) +#endif + + jmp L_loop // branch for next block + + // wrap up digest update round 48:63 for final block +L_final_block: + rounds a, b, c, d, e, f, g, h, 48 + rounds e, f, g, h, a, b, c, d, 52 + rounds a, b, c, d, e, f, g, h, 56 + rounds e, f, g, h, a, b, c, d, 60 + + // ctx->states += digests a-h +#if defined (__x86_64__) + add a, 0*4(ctx) + add b, 1*4(ctx) + add c, 2*4(ctx) + add d, 3*4(ctx) + add e, 4*4(ctx) + add f, 5*4(ctx) + add g, 6*4(ctx) + add h, 7*4(ctx) +#else + mov ctx_addr, t + add a, 0*4(t) + add b, 1*4(t) + mov c, s + add s, 2*4(t) + add d, 3*4(t) + add e, 4*4(t) + mov f, s + add s, 5*4(t) + add g, 6*4(t) + mov h, s + add s, 7*4(t) +#endif + + // if kernel, restore xmm0-xmm7 +#if KERNEL + movdqa 0*16+xmm_save, %xmm0 + movdqa 1*16+xmm_save, %xmm1 + movdqa 2*16+xmm_save, %xmm2 + movdqa 3*16+xmm_save, %xmm3 + movdqa 4*16+xmm_save, %xmm4 + movdqa 5*16+xmm_save, %xmm5 + movdqa 6*16+xmm_save, %xmm6 + movdqa 7*16+xmm_save, %xmm7 +#endif + + // free allocated stack memory + add $stack_size, sp + + // restore callee-saved registers +#if defined (__x86_64__) + pop %r15 + pop %r14 + pop %r13 + pop %r12 + pop %rbx + pop %rbp +#else + pop %edi + pop %esi + pop %ebx + pop %ebp +#endif + + // return + ret + + + .const + .align 4, 0x90 + +L_bswap: + .long 0x00010203 + .long 0x04050607 + .long 0x08090a0b + .long 0x0c0d0e0f + +#endif // x86_64/i386 +#endif // x86_64/i386 + ADDED Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/sha256_nossse3.s Index: Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/sha256_nossse3.s ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/sha256_nossse3.s @@ -0,0 +1,692 @@ +/* + * Copyright (c) 2011 Apple Computer, Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + This file provides x86_64/i386 hand implementation of the following function + + void SHA256_Transform(SHA256_ctx *ctx, char *data, unsigned int num_blocks); + + which is a C function in sha2.c (from xnu). + + The code SHA256_Transform_nossse3 is a clone of SHA256_Transform + with all ssse3 instructions replaced with sse3 or below instructions. + + For performance reason, this function should not be called directly. This file should be working + together with the one that implements SHA256_Transform. There, cpu_capabilities is probed to detect + ssse3. If ssse3 is not supported, the execution will be branched to this no-ssse3-specific function. + + sha256 algorithm per block description: + + 1. W(0:15) = big-endian (per 4 bytes) loading of input data (64 byte) + 2. load 8 digests a-h from ctx->state + 3. for r = 0:15 + T1 = h + Sigma1(e) + Ch(e,f,g) + K[r] + W[r]; + d += T1; + h = T1 + Sigma0(a) + Maj(a,b,c) + permute a,b,c,d,e,f,g,h into h,a,b,c,d,e,f,g + 4. for r = 16:63 + W[r] = W[r-16] + sigma1(W[r-2]) + W[r-7] + sigma0(W[r-15]); + T1 = h + Sigma1(e) + Ch(e,f,g) + K[r] + W[r]; + d += T1; + h = T1 + Sigma0(a) + Maj(a,b,c) + permute a,b,c,d,e,f,g,h into h,a,b,c,d,e,f,g + + In the assembly implementation: + - a circular window of message schedule W(r:r+15) is updated and stored in xmm0-xmm3 + - its corresponding W+K(r:r+15) is updated and stored in a stack space circular buffer + - the 8 digests (a-h) will be stored in GPR or m32 (all in GPR for x86_64, and some in m32 for i386) + + the implementation per block looks like + + ---------------------------------------------------------------------------- + + load W(0:15) (big-endian per 4 bytes) into xmm0:xmm3 + pre_calculate and store W+K(0:15) in stack + + load digests a-h from ctx->state; + + for (r=0;r<48;r+=4) { + digests a-h update and permute round r:r+3 + update W([r:r+3]%16) and WK([r:r+3]%16) for the next 4th iteration + } + + for (r=48;r<64;r+=4) { + digests a-h update and permute round r:r+3 + } + + ctx->states += digests a-h; + + ---------------------------------------------------------------------------- + + our implementation (allows multiple blocks per call) pipelines the loading of W/WK of a future block + into the last 16 rounds of its previous block: + + ---------------------------------------------------------------------------- + + load W(0:15) (big-endian per 4 bytes) into xmm0:xmm3 + pre_calculate and store W+K(0:15) in stack + +L_loop: + + load digests a-h from ctx->state; + + for (r=0;r<48;r+=4) { + digests a-h update and permute round r:r+3 + update W([r:r+3]%16) and WK([r:r+3]%16) for the next 4th iteration + } + + num_block--; + if (num_block==0) jmp L_last_block; + + for (r=48;r<64;r+=4) { + digests a-h update and permute round r:r+3 + load W([r:r+3]%16) (big-endian per 4 bytes) into xmm0:xmm3 + pre_calculate and store W+K([r:r+3]%16) in stack + } + + ctx->states += digests a-h; + + jmp L_loop; + +L_last_block: + + for (r=48;r<64;r+=4) { + digests a-h update and permute round r:r+3 + } + + ctx->states += digests a-h; + + ------------------------------------------------------------------------ + + Apple CoreOS vector & numerics + cclee 8-3-10 +*/ + +#if defined (__x86_64__) || defined (__i386__) + +#if defined KERNEL +#include +#else +#include +#endif + +#if defined (__i386__) + .section __IMPORT,__pointers,non_lazy_symbol_pointers +L_K256$non_lazy_ptr: +.indirect_symbol _K256 + .long 0 +#endif + + // associate variables with registers or memory + +#if defined (__x86_64__) + #define sp %rsp + #define ctx %rdi + #define data %rsi + #define num_blocks %rdx + + #define a %r8d + #define b %r9d + #define c %r10d + #define d %r11d + #define e %r12d + #define f %r13d + #define g %r14d + #define h %r15d + + #define K %rbx + #define stack_size (8+16*8+16+64) // 8 (align) + xmm0:xmm7 + L_aligned_bswap + WK(0:15) + + #define xmm_save 80(sp) // starting address for xmm save/restore +#else + #define sp %esp + #define stack_size (12+16*8+16+16+64) // 12 (align) + xmm0:xmm7 + 16 (c,f,h,K) + L_aligned_bswap + WK(0:15) + #define ctx_addr 20+stack_size(sp) // ret_addr + 4 registers = 20, 1st caller argument + #define data_addr 24+stack_size(sp) // 2nd caller argument + #define num_blocks 28+stack_size(sp) // 3rd caller argument + + #define a %ebx + #define b %edx + #define c 64(sp) + #define d %ebp + #define e %esi + #define f 68(sp) + #define g %edi + #define h 72(sp) + + #define K 76(sp) // pointer to K256[] table + #define xmm_save 96(sp) // starting address for xmm save/restore +#endif + + // 2 local variables + #define t %eax + #define s %ecx + + // a window (16 words) of message scheule + #define W0 %xmm0 + #define W1 %xmm1 + #define W2 %xmm2 + #define W3 %xmm3 + + // circular buffer for WK[(r:r+15)%16] + #define WK(x) (x&15)*4(sp) + +// #define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) + + .macro Ch + mov $0, t // x + mov $0, s // x + not t // ~x + and $1, s // x & y + and $2, t // ~x & z + xor s, t // t = ((x) & (y)) ^ ((~(x)) & (z)); + .endm + +// #define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + + .macro Maj + mov $0, t // x + mov $1, s // y + and s, t // x&y + and $2, s // y&z + xor s, t // (x&y) ^ (y&z) + mov $2, s // z + and $0, s // (x&z) + xor s, t // t = (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + .endm + +/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */ +// #define R(b,x) ((x) >> (b)) +/* 32-bit Rotate-right (used in SHA-256): */ +// #define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) + +// #define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) + + // performs sigma0_256 on 4 words on an xmm registers + // use xmm6/xmm7 as intermediate registers + .macro sigma0 + movdqa $0, %xmm6 + movdqa $0, %xmm7 + psrld $$3, $0 // SHR3(x) + psrld $$7, %xmm6 // part of ROTR7 + pslld $$14, %xmm7 // part of ROTR18 + pxor %xmm6, $0 + pxor %xmm7, $0 + psrld $$11, %xmm6 // part of ROTR18 + pslld $$11, %xmm7 // part of ROTR7 + pxor %xmm6, $0 + pxor %xmm7, $0 + .endm + +// #define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) + + // performs sigma1_256 on 4 words on an xmm registers + // use xmm6/xmm7 as intermediate registers + .macro sigma1 + movdqa $0, %xmm6 + movdqa $0, %xmm7 + psrld $$10, $0 // SHR10(x) + psrld $$17, %xmm6 // part of ROTR17 + pxor %xmm6, $0 + pslld $$13, %xmm7 // part of ROTR19 + pxor %xmm7, $0 + psrld $$2, %xmm6 // part of ROTR19 + pxor %xmm6, $0 + pslld $$2, %xmm7 // part of ROTR17 + pxor %xmm7, $0 + .endm + +// #define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) + + .macro Sigma0 + mov $0, t // x + mov $0, s // x + ror $$2, t // S32(2, (x)) + ror $$13, s // S32(13, (x)) + xor s, t // S32(2, (x)) ^ S32(13, (x)) + ror $$9, s // S32(22, (x)) + xor s, t // t = (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) + .endm + +// #define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + + .macro Sigma1 + mov $0, s // x + ror $$6, s // S32(6, (x)) + mov s, t // S32(6, (x)) + ror $$5, s // S32(11, (x)) + xor s, t // S32(6, (x)) ^ S32(11, (x)) + ror $$14, s // S32(25, (x)) + xor s, t // t = (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) + .endm + + // per round digests update + .macro round + Sigma1 $4 // t = T1 + add t, $7 // use h to store h+Sigma1(e) + Ch $4, $5, $6 // t = Ch (e, f, g); + add $7, t // t = h+Sigma1(e)+Ch(e,f,g); + add WK($8), t // h = T1 + add t, $3 // d += T1; + mov t, $7 // h = T1 + Sigma0 $0 // t = Sigma0(a); + add t, $7 // h = T1 + Sigma0(a); + Maj $0, $1, $2 // t = Maj(a,b,c) + add t, $7 // h = T1 + Sigma0(a) + Maj(a,b,c); + .endm + + // per 4 rounds digests update and permutation + // permutation is absorbed by rotating the roles of digests a-h + .macro rounds + round $0, $1, $2, $3, $4, $5, $6, $7, 0+$8 + round $7, $0, $1, $2, $3, $4, $5, $6, 1+$8 + round $6, $7, $0, $1, $2, $3, $4, $5, 2+$8 + round $5, $6, $7, $0, $1, $2, $3, $4, 3+$8 + .endm + + // update the message schedule W and W+K (4 rounds) 16 rounds ahead in the future + .macro message_schedule + + // 4 32-bit K256 words in xmm5 +#if defined (__x86_64__) + movdqu (K), %xmm5 + add $$16, K // K points to next K256 word for next iteration +#else + mov K, t + movdqu (t), %xmm5 + addl $$16, K // K points to next K256 word for next iteration +#endif + movdqa $1, %xmm4 // W7:W4 +#if 0 + palignr $$4, $0, %xmm4 // W4:W1 +#else // no-ssse3 implementation of palignr + movdqa $0, %xmm7 + pslldq $$12, %xmm4 + psrldq $$4, %xmm7 + por %xmm7, %xmm4 +#endif + sigma0 %xmm4 // sigma0(W4:W1) + movdqa $3, %xmm6 // W15:W12 + paddd %xmm4, $0 // $0 = W3:W0 + sigma0(W4:W1) +#if 0 + palignr $$4, $2, %xmm6 // W12:W9 +#else // no-ssse3 implementation of palignr + movdqa $2, %xmm7 + pslldq $$12, %xmm6 + psrldq $$4, %xmm7 + por %xmm7, %xmm6 +#endif + paddd %xmm6, $0 // $0 = W12:W9 + sigma0(W4:W1) + W3:W0 + movdqa $3, %xmm4 // W15:W12 + psrldq $$8, %xmm4 // 0,0,W15,W14 + sigma1 %xmm4 // sigma1(0,0,W15,W14) + paddd %xmm4, $0 // sigma1(0,0,W15,W14) + W12:W9 + sigma0(W4:W1) + W3:W0 + movdqa $0, %xmm4 // W19-sigma1(W17), W18-sigma1(W16), W17, W16 + pslldq $$8, %xmm4 // W17, W16, 0, 0 + sigma1 %xmm4 // sigma1(W17,W16,0,0) + paddd %xmm4, $0 // W19:W16 + paddd $0, %xmm5 // WK + movdqa %xmm5, WK($4) + .endm + + // this macro is used in the last 16 rounds of a current block + // it reads the next message (16 4-byte words), load it into 4 words W[r:r+3], computes WK[r:r+3] + // and save into stack to prepare for next block + + .macro update_W_WK +#if defined (__x86_64__) +#if 0 + movdqu $0*16(data), $1 // read 4 4-byte words + pshufb L_aligned_bswap, $1 // big-endian of each 4-byte word, W[r:r+3] +#else // no-ssse3 implementation + mov 0+$0*16(data), s + bswap s + mov s, 0+WK($0*4) + mov 4+$0*16(data), s + bswap s + mov s, 4+WK($0*4) + mov 8+$0*16(data), s + bswap s + mov s, 8+WK($0*4) + mov 12+$0*16(data), s + bswap s + mov s, 12+WK($0*4) + movdqa WK($0*4), $1 +#endif + movdqu $0*16(K), %xmm4 // K[r:r+3] +#else + mov data_addr, t +#if 0 + movdqu $0*16(t), $1 // read 4 4-byte words + pshufb L_aligned_bswap, $1 // big-endian of each 4-byte word, W[r:r+3] +#else // no-ssse3 implementation + mov 0+$0*16(t), s + bswap s + mov s, 0+WK($0*4) + mov 4+$0*16(t), s + bswap s + mov s, 4+WK($0*4) + mov 8+$0*16(t), s + bswap s + mov s, 8+WK($0*4) + mov 12+$0*16(t), s + bswap s + mov s, 12+WK($0*4) + movdqa WK($0*4), $1 +#endif + mov K, t + movdqu $0*16(t), %xmm4 // K[r:r+3] +#endif + paddd $1, %xmm4 // WK[r:r+3] + movdqa %xmm4, WK($0*4) // save WK[r:r+3] into stack circular buffer + .endm + + .text + +#if defined (__x86_64__) || defined (__i386__) + + .globl _SHA256_Transform_nossse3 + +_SHA256_Transform_nossse3: + + // push callee-saved registers +#if defined (__x86_64__) + push %rbp + push %rbx + push %r12 + push %r13 + push %r14 + push %r15 +#else + push %ebp + push %ebx + push %esi + push %edi +#endif + + // allocate stack space + sub $stack_size, sp + + // if kernel code, save used xmm registers +#if KERNEL + movdqa %xmm0, 0*16+xmm_save + movdqa %xmm1, 1*16+xmm_save + movdqa %xmm2, 2*16+xmm_save + movdqa %xmm3, 3*16+xmm_save + movdqa %xmm4, 4*16+xmm_save + movdqa %xmm5, 5*16+xmm_save + movdqa %xmm6, 6*16+xmm_save + movdqa %xmm7, 7*16+xmm_save +#endif + + // set up pointer to table K256[] +#if defined (__x86_64__) + lea _K256(%rip), K +#else +#if defined (KERNEL) + lea _K256, t +#else + call 0f // Push program counter onto stack. +0: pop t // Get program counter. + movl L_K256$non_lazy_ptr-0b(t), t + +#endif + mov t, K +#endif + + // load W[0:15] into xmm0-xmm3 + .macro mybswap + movl 0+$0*16($1), a + movl 4+$0*16($1), b + movl 8+$0*16($1), e + movl 12+$0*16($1), d + bswap a + bswap b + bswap e + bswap d + movl a, $0*16(sp) + movl b, 4+$0*16(sp) + movl e, 8+$0*16(sp) + movl d, 12+$0*16(sp) + .endm + +#if defined (__x86_64__) + mybswap 0, data + mybswap 1, data + mybswap 2, data + mybswap 3, data + add $64, data +#else + mov data_addr, t + mybswap 0, t + mybswap 1, t + mybswap 2, t + mybswap 3, t + addl $64, data_addr +#endif + movdqa 0*16(sp), W0 + movdqa 1*16(sp), W1 + movdqa 2*16(sp), W2 + movdqa 3*16(sp), W3 + + // compute WK[0:15] and save in stack +#if defined (__x86_64__) + movdqu 0*16(K), %xmm4 + movdqu 1*16(K), %xmm5 + movdqu 2*16(K), %xmm6 + movdqu 3*16(K), %xmm7 + add $64, K +#else + mov K, t + movdqu 0*16(t), %xmm4 + movdqu 1*16(t), %xmm5 + movdqu 2*16(t), %xmm6 + movdqu 3*16(t), %xmm7 + addl $64, K +#endif + paddd %xmm0, %xmm4 + paddd %xmm1, %xmm5 + paddd %xmm2, %xmm6 + paddd %xmm3, %xmm7 + movdqa %xmm4, WK(0) + movdqa %xmm5, WK(4) + movdqa %xmm6, WK(8) + movdqa %xmm7, WK(12) + +L_loop: + + // digests a-h = ctx->states; +#if defined (__x86_64__) + mov 0*4(ctx), a + mov 1*4(ctx), b + mov 2*4(ctx), c + mov 3*4(ctx), d + mov 4*4(ctx), e + mov 5*4(ctx), f + mov 6*4(ctx), g + mov 7*4(ctx), h +#else + mov ctx_addr, t + mov 0*4(t), a + mov 1*4(t), b + mov 2*4(t), s + mov s, c + mov 3*4(t), d + mov 4*4(t), e + mov 5*4(t), s + mov s, f + mov 6*4(t), g + mov 7*4(t), s + mov s, h +#endif + + // rounds 0:47 interleaved with W/WK update for rounds 16:63 + rounds a, b, c, d, e, f, g, h, 0 + message_schedule W0,W1,W2,W3,16 + rounds e, f, g, h, a, b, c, d, 4 + message_schedule W1,W2,W3,W0,20 + rounds a, b, c, d, e, f, g, h, 8 + message_schedule W2,W3,W0,W1,24 + rounds e, f, g, h, a, b, c, d, 12 + message_schedule W3,W0,W1,W2,28 + rounds a, b, c, d, e, f, g, h, 16 + message_schedule W0,W1,W2,W3,32 + rounds e, f, g, h, a, b, c, d, 20 + message_schedule W1,W2,W3,W0,36 + rounds a, b, c, d, e, f, g, h, 24 + message_schedule W2,W3,W0,W1,40 + rounds e, f, g, h, a, b, c, d, 28 + message_schedule W3,W0,W1,W2,44 + rounds a, b, c, d, e, f, g, h, 32 + message_schedule W0,W1,W2,W3,48 + rounds e, f, g, h, a, b, c, d, 36 + message_schedule W1,W2,W3,W0,52 + rounds a, b, c, d, e, f, g, h, 40 + message_schedule W2,W3,W0,W1,56 + rounds e, f, g, h, a, b, c, d, 44 + message_schedule W3,W0,W1,W2,60 + + // revert K to the beginning of K256[] +#if defined __x86_64__ + sub $256, K + sub $1, num_blocks // num_blocks-- +#else + subl $256, K + subl $1, num_blocks // num_blocks-- +#endif + + je L_final_block // if final block, wrap up final rounds + + // rounds 48:63 interleaved with W/WK initialization for next block rounds 0:15 + rounds a, b, c, d, e, f, g, h, 48 + update_W_WK 0, W0 + rounds e, f, g, h, a, b, c, d, 52 + update_W_WK 1, W1 + rounds a, b, c, d, e, f, g, h, 56 + update_W_WK 2, W2 + rounds e, f, g, h, a, b, c, d, 60 + update_W_WK 3, W3 + +#if defined (__x86_64__) + add $64, K + add $64, data +#else + addl $64, K + addl $64, data_addr +#endif + + // ctx->states += digests a-h +#if defined (__x86_64__) + add a, 0*4(ctx) + add b, 1*4(ctx) + add c, 2*4(ctx) + add d, 3*4(ctx) + add e, 4*4(ctx) + add f, 5*4(ctx) + add g, 6*4(ctx) + add h, 7*4(ctx) +#else + mov ctx_addr, t + add a, 0*4(t) + add b, 1*4(t) + mov c, s + add s, 2*4(t) + add d, 3*4(t) + add e, 4*4(t) + mov f, s + add s, 5*4(t) + add g, 6*4(t) + mov h, s + add s, 7*4(t) +#endif + + jmp L_loop // branch for next block + + // wrap up digest update round 48:63 for final block +L_final_block: + rounds a, b, c, d, e, f, g, h, 48 + rounds e, f, g, h, a, b, c, d, 52 + rounds a, b, c, d, e, f, g, h, 56 + rounds e, f, g, h, a, b, c, d, 60 + + // ctx->states += digests a-h +#if defined (__x86_64__) + add a, 0*4(ctx) + add b, 1*4(ctx) + add c, 2*4(ctx) + add d, 3*4(ctx) + add e, 4*4(ctx) + add f, 5*4(ctx) + add g, 6*4(ctx) + add h, 7*4(ctx) +#else + mov ctx_addr, t + add a, 0*4(t) + add b, 1*4(t) + mov c, s + add s, 2*4(t) + add d, 3*4(t) + add e, 4*4(t) + mov f, s + add s, 5*4(t) + add g, 6*4(t) + mov h, s + add s, 7*4(t) +#endif + + // if kernel, restore xmm0-xmm7 +#if KERNEL + movdqa 0*16+xmm_save, %xmm0 + movdqa 1*16+xmm_save, %xmm1 + movdqa 2*16+xmm_save, %xmm2 + movdqa 3*16+xmm_save, %xmm3 + movdqa 4*16+xmm_save, %xmm4 + movdqa 5*16+xmm_save, %xmm5 + movdqa 6*16+xmm_save, %xmm6 + movdqa 7*16+xmm_save, %xmm7 +#endif + + // free allocated stack memory + add $stack_size, sp + + // restore callee-saved registers +#if defined (__x86_64__) + pop %r15 + pop %r14 + pop %r13 + pop %r12 + pop %rbx + pop %rbp +#else + pop %edi + pop %esi + pop %ebx + pop %ebp +#endif + + // return + ret + + +#endif // x86_64/i386 +#endif // x86_64/i386 ADDED Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha224.c Index: Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha224.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha224.c @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* Adapted from LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +/** + @param sha224.c + vng_x86_SHA-224 new NIST standard based off of vng_x86_SHA-256 truncated to 224 bits (Tom St Denis) +*/ +#if defined (__x86_64__) || defined(__i386__) // x86_64 or i386 architectures + +const ccDescriptor vng_x86_sha224_desc = +{ + .implementation_info = &cc_sha224_impinfo, + .dtype.digest.hashsize = CC_SHA224_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA224_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = &vng_x86_sha224_init, + .dtype.digest.process = &vng_x86_sha256_process, + .dtype.digest.done = &vng_x86_sha224_done, +}; + + +/* init the sha256 er... sha224 state ;-) */ +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int vng_x86_sha224_init(vng_x86_sha256_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + // ctx->curlen = 0; + ctx->length = 0; + ctx->state[0] = 0xc1059ed8UL; + ctx->state[1] = 0x367cd507UL; + ctx->state[2] = 0x3070dd17UL; + ctx->state[3] = 0xf70e5939UL; + ctx->state[4] = 0xffc00b31UL; + ctx->state[5] = 0x68581511UL; + ctx->state[6] = 0x64f98fa7UL; + ctx->state[7] = 0xbefa4fa4UL; + + return CRYPT_OK; +} + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (28 bytes) + @return CRYPT_OK if successful +*/ +int vng_x86_sha224_done(vng_x86_sha256_ctx *ctx, unsigned char *out) +{ + unsigned char buf[32]; + int err; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + err = vng_x86_sha256_done(ctx, buf); + CC_XMEMCPY(out, buf, 28); + return err; +} + +#endif ADDED Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha224.h Index: Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha224.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha224.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * vng_x86_sha224.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + + +#if defined (__x86_64__) || defined(__i386__) // x86_64 or i386 architectures + +#ifndef _VNG_X86_SHA224_H_ +#define _VNG_X86_SHA224_H_ + +/* + * Note that vng_x86_sha256 is required for vng_x86_sha224. + */ + +#define VNG_X86_SHA224_HASHSIZE 28 +#define VNG_X86_SHA224_BLOCKSIZE 64 + +int vng_x86_sha224_init(vng_x86_sha256_ctx *ctx); +#define vng_x86_sha224_process vng_x86_sha256_process +int vng_x86_sha224_done(vng_x86_sha256_ctx *ctx, unsigned char *hash); + +#endif /* _VNG_X86_SHA224_H_ */ +#endif /* x86 */ ADDED Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha256.c Index: Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha256.c ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha256.c @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ + +#if defined (__x86_64__) || defined(__i386__) // x86_64 or i386 architectures + +#include +#include "vng_x86_sha256.h" +#include "vng_x86_sha224.h" +#include "ltc_hashcommon.h" +#include "tomcrypt_cfg.h" +#include "tomcrypt_macros.h" +#include "tomcrypt_argchk.h" +#include "ccDescriptors.h" +#include "ccErrors.h" +#include "ccMemory.h" +#include "CommonDigest.h" + +/** + @file vng_x86_sha256.c + vng_x86_SHA256 by Tom St Denis +*/ + +const ccDescriptor vng_x86_sha256_desc = +{ + .implementation_info = &cc_sha256_impinfo, + .dtype.digest.hashsize = CC_SHA256_DIGEST_LENGTH, + .dtype.digest.blocksize = CC_SHA256_BLOCK_BYTES, + .dtype.digest.digest_info = NULL, + .dtype.digest.init = &vng_x86_sha256_init, + .dtype.digest.process = &vng_x86_sha256_process, + .dtype.digest.done = &vng_x86_sha256_done, +}; + +extern const uint32_t K256[64] = +{ 0x428a2f98ul, 0x71374491ul, 0xb5c0fbcful, 0xe9b5dba5ul, + 0x3956c25bul, 0x59f111f1ul, 0x923f82a4ul, 0xab1c5ed5ul, + 0xd807aa98ul, 0x12835b01ul, 0x243185beul, 0x550c7dc3ul, + 0x72be5d74ul, 0x80deb1feul, 0x9bdc06a7ul, 0xc19bf174ul, + 0xe49b69c1ul, 0xefbe4786ul, 0x0fc19dc6ul, 0x240ca1ccul, + 0x2de92c6ful, 0x4a7484aaul, 0x5cb0a9dcul, 0x76f988daul, + 0x983e5152ul, 0xa831c66dul, 0xb00327c8ul, 0xbf597fc7ul, + 0xc6e00bf3ul, 0xd5a79147ul, 0x06ca6351ul, 0x14292967ul, + 0x27b70a85ul, 0x2e1b2138ul, 0x4d2c6dfcul, 0x53380d13ul, + 0x650a7354ul, 0x766a0abbul, 0x81c2c92eul, 0x92722c85ul, + 0xa2bfe8a1ul, 0xa81a664bul, 0xc24b8b70ul, 0xc76c51a3ul, + 0xd192e819ul, 0xd6990624ul, 0xf40e3585ul, 0x106aa070ul, + 0x19a4c116ul, 0x1e376c08ul, 0x2748774cul, 0x34b0bcb5ul, + 0x391c0cb3ul, 0x4ed8aa4aul, 0x5b9cca4ful, 0x682e6ff3ul, + 0x748f82eeul, 0x78a5636ful, 0x84c87814ul, 0x8cc70208ul, + 0x90befffaul, 0xa4506cebul, 0xbef9a3f7ul, 0xc67178f2ul, +}; + + +/* Various logical functions */ +#define Ch(x,y,z) (z ^ (x & (y ^ z))) +#define Maj(x,y,z) (((x | y) & z) | (x & y)) +#define S(x, n) LTC_RORc((x),(n)) +#define R(x, n) (((x)&0xFFFFFFFFUL)>>(n)) +#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) +#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) +#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3)) +#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) + + +#define FULLLENGTH_MASK 0xffffffffffffffc0 +#define BUFFLENGTH_MASK 0x3f +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ +int vng_x86_sha256_init(vng_x86_sha256_ctx *ctx) +{ + LTC_ARGCHK(ctx != NULL); + + ctx->length = 0; + ctx->state[0] = 0x6A09E667UL; + ctx->state[1] = 0xBB67AE85UL; + ctx->state[2] = 0x3C6EF372UL; + ctx->state[3] = 0xA54FF53AUL; + ctx->state[4] = 0x510E527FUL; + ctx->state[5] = 0x9B05688CUL; + ctx->state[6] = 0x1F83D9ABUL; + ctx->state[7] = 0x5BE0CD19UL; + + return CRYPT_OK; +} + +/** + Process a block of memory though the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ +int vng_x86_sha256_process(vng_x86_sha256_ctx *ctx, const unsigned char *in, unsigned long inlen) +{ + unsigned long n; + int err; + int fullblocks, remainder, processed; + uint64_t curlen; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(in != NULL); + + curlen = ctx->length & BUFFLENGTH_MASK; + + if ((ctx->length + inlen) < ctx->length) { + return CRYPT_HASH_OVERFLOW; + } + + while (inlen > 0) { + if (curlen == 0 && inlen >= VNG_X86_SHA256_BLOCKSIZE && CC_XALIGNED(in, 4)) { + fullblocks = inlen / VNG_X86_SHA256_BLOCKSIZE; + remainder = inlen % VNG_X86_SHA256_BLOCKSIZE; + processed = fullblocks * VNG_X86_SHA256_BLOCKSIZE; + vng_x86_sha256_compress (ctx->state, in, fullblocks); + ctx->length += VNG_X86_SHA256_BLOCKSIZE * 8 * fullblocks; + in += processed; + inlen -= processed; + } else { + n = MIN(inlen, (VNG_X86_SHA256_BLOCKSIZE - curlen)); + memcpy(ctx->buf + curlen, in, (size_t)n); + curlen += n; in += n; inlen -= n; + if (curlen == VNG_X86_SHA256_BLOCKSIZE) { + vng_x86_sha256_compress (ctx->state, ctx->buf, 1); + ctx->length += 8*VNG_X86_SHA256_BLOCKSIZE; + curlen = 0; + } + } + } + + ctx->length = (ctx->length & FULLLENGTH_MASK) + curlen; + + return CRYPT_OK; +} + +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (32 bytes) + @return CRYPT_OK if successful +*/ +int vng_x86_sha256_done(vng_x86_sha256_ctx *ctx, unsigned char *out) +{ + int i; + uint64_t curlen; + + LTC_ARGCHK(ctx != NULL); + LTC_ARGCHK(out != NULL); + + curlen = ctx->length & BUFFLENGTH_MASK; + ctx->length &= FULLLENGTH_MASK; + + /* increase the length of the message */ + ctx->length += curlen * 8; + + /* append the '1' bit */ + ctx->buf[curlen++] = (unsigned char)0x80; + + /* if the length is currently above 56 bytes we append zeros + * then compress. Then we can fall back to padding zeros and length + * encoding like normal. + */ + if (curlen > 56) { + while (curlen < 64) { + ctx->buf[curlen++] = (unsigned char)0; + } + vng_x86_sha256_compress (ctx->state, ctx->buf, 1); + + curlen = 0; + } + + /* pad upto 56 bytes of zeroes */ + while (curlen < 56) { + ctx->buf[curlen++] = (unsigned char)0; + } + + /* store length */ + LTC_STORE64H(ctx->length, ctx->buf+56); + vng_x86_sha256_compress (ctx->state, ctx->buf, 1); + + /* copy output */ + for (i = 0; i < 8; i++) { + LTC_STORE32H(ctx->state[i], out+(4*i)); + } +#ifdef LTC_CLEAN_STACK + ltc_zeromem(ctx, sizeof(hash_state)); +#endif + return CRYPT_OK; +} + + +#include "vng_x86_sha224.c" + +#endif /* x86 */ ADDED Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha256.h Index: Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha256.h ================================================================== --- /dev/null +++ Source/descriptors/digestDescriptors/vng_x86_sha2_descriptor/vng_x86_sha256.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * vng_x86_sha256.h + * MacTomCrypt + * + * InfoSec Standard Configuration + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + + +#if defined (__x86_64__) || defined(__i386__) // x86_64 or i386 architectures +#include + +#ifndef _VNG_X86_SHA256_H_ +#define _VNG_X86_SHA256_H_ + +#define VNG_X86_SHA256_HASHSIZE 32 +#define VNG_X86_SHA256_BLOCKSIZE 64 + +typedef struct vng_x86_sha256_state { + uint64_t length; + uint32_t state[8]; + unsigned char buf[VNG_X86_SHA256_BLOCKSIZE]; +} vng_x86_sha256_ctx; + +int vng_x86_sha256_init(vng_x86_sha256_ctx *ctx); +int vng_x86_sha256_process(vng_x86_sha256_ctx *ctx, const unsigned char *in, + unsigned long inlen); +int vng_x86_sha256_done(vng_x86_sha256_ctx *ctx, unsigned char *hash); +void vng_x86_sha256_compress(void *c, const void *p, unsigned long num); + +#endif /* _VNG_X86_SHA256_H_ */ +#endif /* x86 */ ADDED Source/libDER/README.txt Index: Source/libDER/README.txt ================================================================== --- /dev/null +++ Source/libDER/README.txt @@ -0,0 +1,34 @@ + libDER Library Notes + Last update to this file Jan. 26 2006 by dmitch + +This module is a very lightweight implementation of a DER encoder and +decoder. Unlike most other DER packages, this one does no malloc or +copies when it encodes or decodes; decoding an item yields a pointer +and a byte count which refer to memory inside of the "thing" being +decoded. Likewise, when encoding, the caller mustsupply a target buffer +to which the encoded item is written. + +Support for encoding sequences and for decoding sequences and sets of +known items is also included; when you decode a sequence, you get a +sequence of pointers and byte counts - again, no mallocs or copies occur. + +The directory libDER contains the DER decoding library proper. The main +API is in DER_Decode.h. Support for RSA keys, X509 certs, X509 CRLs, and +miscellaneous OIDs can also be found in libDER. + +Command line programs to parse and display the contents of X509 certificates +and CRLs, using libDER, can be found in the Tests directory. + +Revision History +---------------- + + Date svk tag Changes +-------- ----------- ---------------------------------------- +01/26/06 libDER-5 Avoid varargs macros for portability. +01/03/06 libDER-4 Initial distribution in RSACertLib. +12/23/05 libDER-3 Fix DER_DECODE_ENABLE ifdef for DER_Decode.c. + Add MD2, MD5 OID and DigestInfo capabilities. +12/13/05 libDER-2 Added Apple Custom RSA public key formats. + Added PKCS1 RSA private keys. +11/28/05 libDER-1 Initial tag. + ADDED Source/libDER/Tests/AppleMobilePersonalizedTicket.h Index: Source/libDER/Tests/AppleMobilePersonalizedTicket.h ================================================================== --- /dev/null +++ Source/libDER/Tests/AppleMobilePersonalizedTicket.h @@ -0,0 +1,114 @@ +/* + * AppleMobilePersonalizedTicket.h + * ticketlib + * + * Created by Jason Gosnell on 9/24/09. + * Copyright 2009 Apple, Inc. All rights reserved. + * + */ + +#ifndef APPLEMOBILEPERSONALIZEDTICKET_H +#define APPLEMOBILEPERSONALIZEDTICKET_H + +const unsigned kApECIDTag = 1; +const unsigned kApChipIDTag = 2; +const unsigned kApBoardIDTag = 3; +const unsigned kApProductionModeTag = 4; +const unsigned kApSecurityDomainTag = 5; +const unsigned kLLBBuildStringTag = 6; +const unsigned kiBootDigestTag = 7; +const unsigned kAppleLogoDigestTag = 8; +const unsigned kDeviceTreeDigestTag = 9; +const unsigned kKernelCacheDigestTag = 10; +const unsigned kDiagsDigestTag = 11; +const unsigned kBatteryChargingDigestTag = 12; +const unsigned kBatteryPluginDigestTag = 13; +const unsigned kBatteryLow0DigestTag = 14; +const unsigned kBatteryLow1DigestTag = 15; +const unsigned kRecoveryModeDigestTag = 16; +const unsigned kNeedServiceDigestTag = 17; +const unsigned kApNonceTag = 18; +const unsigned kApPriorTicketIDTag = 19; +const unsigned kiBSSBuildStringTag = 20; +const unsigned kHostiBootTag = 21; +const unsigned kiBECBuildStringTag = 22; +const unsigned kRestoreLogoDigestTag = 23; +const unsigned kRestoreDeviceTreeDigestTag = 24; +const unsigned kRestoreKernelCacheDigestTag = 25; +const unsigned kRestoreRamDiskDigestTag = 26; +const unsigned kOSDigestTag = 27; +const unsigned kApBindingDigestTag = 28; +const unsigned kApServerNonceTag = 29; +const unsigned kLLBPartialDigestTag = 30; +const unsigned kiBootPartialDigestTag = 31; +const unsigned kAppleLogoPartialDigestTag = 32; +const unsigned kDeviceTreePartialDigestTag = 33; +const unsigned kKernelCachePartialDigestTag = 34; +const unsigned kDiagsPartialDigestTag = 35; +const unsigned kBatteryChargingPartialDigestTag = 36; +const unsigned kBatteryPluginPartialDigestTag = 37; +const unsigned kBatteryLow0PartialDigestTag = 38; +const unsigned kBatteryLow1PartialDigestTag = 39; +const unsigned kRecoveryModePartialDigestTag = 40; +const unsigned kNeedServicePartialDigestTag = 41; +const unsigned kiBSSPartialDigestTag = 42; +const unsigned kiBECPartialDigestTag = 43; +const unsigned kRestoreLogoPartialDigestTag = 44; +const unsigned kRestoreDeviceTreePartialDigestTag = 45; +const unsigned kRestoreKernelCachePartialDigestTag = 46; +const unsigned kRestoreRamDiskPartialDigestTag = 47; +const unsigned kiBootTrustedTag = 48; +const unsigned kAppleLogoTrustedTag = 49; +const unsigned kDeviceTreeTrustedTag = 50; +const unsigned kKernelCacheTrustedTag = 51; +const unsigned kDiagsTrustedTag = 52; +const unsigned kBatteryChargingTrustedTag = 53; +const unsigned kBatteryPluginTrustedTag = 54; +const unsigned kBatteryLow0TrustedTag = 55; +const unsigned kBatteryLow1TrustedTag = 56; +const unsigned kRecoveryModeTrustedTag = 57; +const unsigned kNeedServiceTrustedTag = 58; +const unsigned kRestoreLogoTrustedTag = 59; +const unsigned kRestoreDeviceTreeTrustedTag = 60; +const unsigned kRestoreKernelCacheTrustedTag = 61; +const unsigned kRestoreRamDiskTrustedTag = 62; +const unsigned kBbSNUMTag = 63; +const unsigned kBbChipIDTag = 64; +const unsigned kBbProductionModeTag = 65; +const unsigned kFlashPSIBuildStringTag = 66; +const unsigned kModemStackDigestTag = 67; +const unsigned kBbNonceTag = 68; +const unsigned kBbPriorTicketIdTag = 69; +const unsigned kRamPSIBuildStringTag = 70; +const unsigned kHostFlashPSITag = 71; +const unsigned kEBLDigestTag = 72; +const unsigned kStaticEEPDigestTag = 73; +const unsigned kBbApBindingDigestTag = 74; +const unsigned kBbServerNonceTag = 75; +const unsigned kRamPSIPartialDigestTag = 76; +const unsigned kFlashPSIPartialDigestTag = 77; +const unsigned kBatteryCharging0DigestTag = 78; +const unsigned kBatteryCharging1DigestTag = 79; +const unsigned kBatteryFullDigestTag = 80; +const unsigned kBatteryCharging0PartialDigestTag = 81; +const unsigned kBatteryCharging1PartialDigestTag = 82; +const unsigned kBatteryFullPartialDigestTag = 83; +const unsigned kBatteryCharging0TrustedTag = 84; +const unsigned kBatteryCharging1TrustedTag = 85; +const unsigned kBatteryFullTrustedTag = 86; +const unsigned kUniqueBuildIDTag = 87; +const unsigned kBbGoldCertIdTag = 88; +const unsigned kBbSkeyIdTag = 89; +const unsigned kBasebandFirmwareFlashPSIVersionTag = 90; +const unsigned kBasebandFirmwareModemStackDigestTag = 91; +const unsigned kBasebandFirmwareRamPSIVersionTag = 92; +const unsigned kBasebandFirmwareEBLDigestTag = 93; +const unsigned kBasebandFirmwareFlashPSISecPackDigestTag = 94; +const unsigned kBasebandFirmwareModemStackSecPackDigestTag= 95; +const unsigned kBasebandFirmwareFlashPSIDigestTag = 96; +const unsigned kBasebandFirmwareRamPSIPartialDigestTag = 97; +const unsigned kBasebandFirmwareFlashPSIPartialDigestTag = 98; +const unsigned kBbJtagEnableTag = 99; + + +#endif /* APPLEMOBILEPERSONALIZEDTICKET_H */ ADDED Source/libDER/Tests/DER_Ticket.c Index: Source/libDER/Tests/DER_Ticket.c ================================================================== --- /dev/null +++ Source/libDER/Tests/DER_Ticket.c @@ -0,0 +1,188 @@ +/* + * DER_Ticket.c + * libDER + * + * Created by Michael Brouwer on 10/13/09. + * Copyright 2009 Apple Inc. All rights reserved. + * + */ + +#include "DER_Ticket.h" + +#include +#include +#include +#include + +/* Application Processor Ticket */ +const DERItemSpec DERApTicketItemSpecs[] = +{ + { DER_OFFSET(DERApTicket, signatureAlgorithm), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS | DER_ENC_WRITE_DER }, + { DER_OFFSET(DERApTicket, body), + ASN1_CONSTR_SET, + DER_DEC_NO_OPTS | DER_DEC_SAVE_DER | DER_ENC_WRITE_DER }, + { DER_OFFSET(DERApTicket, signature), + ASN1_OCTET_STRING, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERApTicket, certificates), + ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | 1, + DER_DEC_NO_OPTS | DER_ENC_WRITE_DER } +}; +const DERSize DERNumApTicketItemSpecs = + sizeof(DERApTicketItemSpecs) / sizeof(DERItemSpec); + +/* Baseband Ticket */ +const DERItemSpec DERBbTicketItemSpecs[] = +{ + { DER_OFFSET(DERBbTicket, signatureAlgorithm), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS | DER_ENC_WRITE_DER }, + { DER_OFFSET(DERBbTicket, body), + ASN1_CONSTR_SET, + DER_DEC_NO_OPTS | DER_DEC_SAVE_DER | DER_ENC_WRITE_DER }, + { DER_OFFSET(DERBbTicket, signature), + ASN1_OCTET_STRING, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERBbTicket, gpuk), + ASN1_CONTEXT_SPECIFIC | 2, + DER_DEC_NO_OPTS } +}; +const DERSize DERNumBbTicketItemSpecs = + sizeof(DERBbTicketItemSpecs) / sizeof(DERItemSpec); + +#if 0 +/* We need to verify this value and use it here. */ +const DERByte rsaWithSha1Algorithm[] = { + 0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05 +}; +#endif + +#ifdef FAST_SET_LOOKUP +/* Iterates over all the tags in the set to build an index returned in + derSet. */ +DERReturn DERDecodeSetContentInit( + const DERItem *content, /* data to decode */ + DERSet *derSet) /* IN/OUT, to use in DERDecodeSetTag */ +{ + DERReturn drtn; + DERSequence derSeq; + memset(derSet->byTag, 0, derSet->capacity); + drtn = DERDecodeSeqContentInit(content, &derSeq); + if (drtn == DR_Success) { + DERDecodedInfo element; + while ((drtn = DERDecodeSeqNext(&derSeq, &element)) == DR_Success) { + if (element.tag >= derSet->capacity) return DR_UnexpectedTag; + derSet->byTag[element.tag] = element.content.data; + } + if (drtn == DR_EndOfSequence) drtn = DR_Success; + } + derSet->end = content->data + content->length; + + return drtn; +} + +DERReturn DERDecodeSetTag( + DERSet *derSet, /* data to decode */ + DERTag tag, /* tag in sequence/set we are looking for. */ + DERItem *content) /* RETURNED */ +{ + DERReturn drtn; + DERTag tagNumber = tag & ASN1_TAGNUM_MASK; + if (tagNumber > derSet->capacity) + return DR_UnexpectedTag; + DERByte *start = derSet->byTag[tagNumber]; + if (!start) return DR_UnexpectedTag; + DERItem derItem = { .data = start, .length = derSet->end - start }; + DERDecodedInfo element; + drtn = DERDecodeItem(&derItem, &element); + if (drtn) return drtn; + if (tag != element.tag) return DR_UnexpectedTag; + *content = element.content; + + return drtn; +} +#endif /* FAST_SET_LOOKUP */ + +/* Returns the item with tag from the sequence or set pointed to by der. + result DR_EndOfSequence if the tag was not found. */ +DERReturn DERSetDecodeItemWithTag( + const DERItem *der, /* data to decode */ + DERTag tag, /* tag in sequence/set we are looking for. */ + DERItem *content) /* RETURNED */ +{ + DERReturn drtn; + DERSequence derSeq; + DERTag topTag; + drtn = DERDecodeSeqInit(der, &topTag, &derSeq); + if (drtn == DR_Success) { + DERDecodedInfo info; + while ((drtn = DERDecodeSeqNext(&derSeq, &info)) == DR_Success) { + if (info.tag == tag) { + *content = info.content; + return DR_Success; + } + } + } + + return drtn; +} + +DERReturn DERDecodeApTicket( + const DERItem *contents, + DERApTicket *ticket, /* RETURNED */ + DERSize *numUsedBytes) /* RETURNED */ +{ + DERReturn drtn; + DERDecodedInfo decodedTicket; + drtn = DERDecodeItem(contents, &decodedTicket); + if (drtn != DR_Success) goto badTicket; + drtn = DERParseSequenceContent(&decodedTicket.content, + DERNumApTicketItemSpecs, DERApTicketItemSpecs, ticket, 0); + if (drtn != DR_Success) goto badTicket; + + /* Decode the algorithm sequence. */ + DERAlgorithmId algorithm = {}; + drtn = DERParseSequenceContent(&ticket->signatureAlgorithm, + DERNumAlgorithmIdItemSpecs, DERAlgorithmIdItemSpecs, &algorithm, 0); + if (drtn != DR_Success) goto badTicket; + /* TODO Check algorithm oid and ensure there are no params. + Alternatively replace the code above with a simple memcmp with + an already ASN.1 encoded algorithm parms block. */ + +badTicket: + *numUsedBytes = decodedTicket.content.length + + decodedTicket.content.data - contents->data; + + return drtn; +} + +DERReturn DERDecodeBbTicket( + const DERItem *contents, + DERBbTicket *ticket, /* RETURNED */ + DERSize *numUsedBytes) /* RETURNED */ +{ + DERReturn drtn; + DERDecodedInfo decodedTicket; + drtn = DERDecodeItem(contents, &decodedTicket); + if (drtn != DR_Success) goto badTicket; + drtn = DERParseSequenceContent(&decodedTicket.content, + DERNumBbTicketItemSpecs, DERBbTicketItemSpecs, ticket, 0); + if (drtn != DR_Success) goto badTicket; + + /* Decode the algorithm sequence. */ + DERAlgorithmId algorithm = {}; + drtn = DERParseSequenceContent(&ticket->signatureAlgorithm, + DERNumAlgorithmIdItemSpecs, DERAlgorithmIdItemSpecs, &algorithm, 0); + if (drtn != DR_Success) goto badTicket; + /* TODO Check algorithm oid and ensure there are no params. + Alternatively replace the code above with a simple memcmp with + an already ASN.1 encoded algorithm parms block. */ + +badTicket: + *numUsedBytes = decodedTicket.content.length + + decodedTicket.content.data - contents->data; + + return drtn; +} ADDED Source/libDER/Tests/DER_Ticket.h Index: Source/libDER/Tests/DER_Ticket.h ================================================================== --- /dev/null +++ Source/libDER/Tests/DER_Ticket.h @@ -0,0 +1,81 @@ +/* + * DER_Ticket.h + * libDER + * + * Created by Michael Brouwer on 10/13/09. + * Copyright 2009 Apple Inc. All rights reserved. + * + */ + +#include + + +#define FAST_SET_LOOKUP 1 + +#ifdef FAST_SET_LOOKUP +/* state representing a fast by tag set accessor, the caller needs to provide + a set large enough to hold all */ +typedef struct { + DERTag capacity; /* should be large enough to hold all encountered tags. + otherwise DR_UnexpectedTag will be returned, note + that only one tag per tag number can exist. */ + DERByte *end; + DERByte *byTag[]; /* maxTag element array of pointers to tag + length + of items in set indexed by tagNumber. */ +} DERSet; + +/* Iterates over all the tags in the set to build an index returned in + derSet. */ +DERReturn DERDecodeSetContentInit( + const DERItem *der, /* data to decode */ + DERSet *derSet); /* IN/OUT, to use in DERDecodeSetTag */ + +/* Returns DR_UnexpectedTag if the requested tag is not in derSet, returns + the content of the decoded item in content otherwise. */ +DERReturn DERDecodeSetTag( + DERSet *derSeq, /* data to decode */ + DERTag tag, /* tag in sequence/set we are looking for. */ + DERItem *content); /* RETURNED */ +#endif /* FAST_SET_LOOKUP */ + + +DERReturn DERSetDecodeItemWithTag( + const DERItem *der, /* data to decode */ + DERTag tag, /* tag in sequence/set we are looking for. */ + DERItem *content); /* RETURNED */ + + +/* Application Processor Ticket */ +typedef struct { + DERItem signatureAlgorithm; /* AlgorithmId */ + DERItem body; /* SET OF OCTECT STRING, DER_DEC_SAVE_DER */ + DERItem signature; /* OCTET STRING */ + DERItem certificates; /* SEQUENCE of CERTIFICATE */ +} DERApTicket; + +/* DERItemSpecs to decode into a DERApTicket */ +extern const DERItemSpec DERApTicketItemSpecs[]; +extern const DERSize DERNumApTicketItemSpecs; + +DERReturn DERDecodeApTicket( + const DERItem *contents, + DERApTicket *ticket, /* RETURNED */ + DERSize *numUsedBytes); /* RETURNED */ + + +/* Baseband Ticket */ +typedef struct { + DERItem signatureAlgorithm; /* AlgorithmId */ + DERItem body; /* SET OF OCTECT STRING, DER_DEC_SAVE_DER */ + DERItem signature; /* OCTET STRING */ + DERItem gpuk; /* OCTET STRING */ +} DERBbTicket; + +/* DERItemSpecs to decode into a DERBbTicket */ +extern const DERItemSpec DERBbTicketItemSpecs[]; +extern const DERSize DERNumBbTicketItemSpecs; + +DERReturn DERDecodeBbTicket( + const DERItem *contents, + DERBbTicket *ticket, /* RETURNED */ + DERSize *numUsedBytes); /* RETURNED */ ADDED Source/libDER/Tests/G1_GPrK.pem Index: Source/libDER/Tests/G1_GPrK.pem ================================================================== --- /dev/null +++ Source/libDER/Tests/G1_GPrK.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICWwIBAAKBgQCv34jZMZdANoIYptLYgU121ucX5UAKaKQUlihPwS6W2R5phNog +w5PH0cBv+znVYhqmZLW8ctV0nQqk8Zo33I0qeJeBE2zptK6Yv79mhmbY14VhKeMc +Smjb2+o3kVYlLMKoB3Xl76yjB0InYOnddK8JoLXkK7PYbTiBfejxT8ZuMQIBAwKB +gHU/sJDLuirPAWXEjJBWM6SPRLqY1VxFwrhkGt/WHw87aZut5sCCYoU2gEqne+OW +vG7tzn2h46MTXG32Zs/oXhs1dKaKdHJyKZcrC+SMKjpL+tSVflujUDkF3qFnCneX +x1n16nWMOuwAoVlrXuqG3TLUiYBBbJAZy2rJuDYid/WjAkEA1tzwbnj4coGtW++2 +ExAbIt6szd96y2MOGWbm3a+rm0D2FHrUfq8yamGsrRRtF9HM+kbTgSM3ulGExA6w +0L0p4wJBANGLltVFRZbuiKM92aEXZkKudXvGGAoNeDm1XpkWxi3WqwIbYR6lDpvu +dJLHEJKRcGeg0EhtyIw13ItF70tVU9sCQQCPPfWe+1BMVnOSn863YBIXPx3elPyH +l167me8+dR0SK064UeL/H3bxlnMeDZ4P4TNRhI0AwiUm4QMtXyCLKMaXAkEAi7Jk +ji4uZJ8Fwik7wLpELHROUoQQBrOle84/ELnZc+RyAWeWFG4JvUmjDIS1twugRRXg +MEkwXXk9si6fh4435wJAOYJia32scDKS4C20zVc12mQutnaK6g9Bdt2vzH3u82Ef +nchdtuR4ipWl3v8xX6jX3XdD31xa2Dh840iP1wjPrg== +-----END RSA PRIVATE KEY----- ADDED Source/libDER/Tests/S5L8920_TATSU_FAC_DARWIN_DEV_CHAIN.der Index: Source/libDER/Tests/S5L8920_TATSU_FAC_DARWIN_DEV_CHAIN.der ================================================================== --- /dev/null +++ Source/libDER/Tests/S5L8920_TATSU_FAC_DARWIN_DEV_CHAIN.der cannot compute difference between binary files ADDED Source/libDER/Tests/bb_ticket.bin Index: Source/libDER/Tests/bb_ticket.bin ================================================================== --- /dev/null +++ Source/libDER/Tests/bb_ticket.bin cannot compute difference between binary files ADDED Source/libDER/Tests/certsCrls/EndCertificateCP.01.01.crt Index: Source/libDER/Tests/certsCrls/EndCertificateCP.01.01.crt ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/EndCertificateCP.01.01.crt cannot compute difference between binary files ADDED Source/libDER/Tests/certsCrls/Test_CRL_CA1.crl Index: Source/libDER/Tests/certsCrls/Test_CRL_CA1.crl ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/Test_CRL_CA1.crl cannot compute difference between binary files ADDED Source/libDER/Tests/certsCrls/Test_CRL_CA1.crl.pem Index: Source/libDER/Tests/certsCrls/Test_CRL_CA1.crl.pem ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/Test_CRL_CA1.crl.pem @@ -0,0 +1,13 @@ +-----BEGIN X509 CRL----- +MIIB3zCByDANBgkqhkiG9w0BAQQFADBvMQswCQYDVQQGEwJkZTEgMB4GA1UEChMX +SW5zZWN1cmVUZXN0Q2VydGlmaWNhdGUxFzAVBgNVBAMTDkZvciBUZXN0cyBPbmx5 +MSUwIwYJKoZIhvcNAQkBFhZpbnNlY3VyZUB0ZXN0Lmluc2VjdXJlFw0wMTA4MTcx +MTEyMDNaFw0wNjA4MTYxMTEyMDNaMCgwEgIBAxcNMDEwODE3MTExMDM5WjASAgEF +Fw0wMTA4MTcxMTExNTlaMA0GCSqGSIb3DQEBBAUAA4IBAQB47lMVCKlPoBAgLway +76eNRq1749jt/7g/Ouh06isNM66/CgzVL2xKSC3s2FX4xKg320niWI6Dvm4H3M6I +7RvuoCvZBVpu1MA8z2No89g2UPWlSxUAvuvo2GOGRgo+8nc/84g8biLUxTSF8Vs4 +T1Hngo1qrfePM4ou1uu7LhRnR8tuIVoQT6W3RSlEsQRBRM3y+VkOPAf0GBGyl6WG +WiymXHqsqis80WbX50tr859Cltqbu2yaFAX++IEBBDB7JoVi1blumgarqfXYkoUW +n9d3F8qySNjsfhOV613fXpmfXFZ33uTFsLSoihP8f6+Cusx2rfuGap7jOPv7j7sj +l2Y1 +-----END X509 CRL----- ADDED Source/libDER/Tests/certsCrls/TrustAnchorCP.01.01.crt Index: Source/libDER/Tests/certsCrls/TrustAnchorCP.01.01.crt ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/TrustAnchorCP.01.01.crt cannot compute difference between binary files ADDED Source/libDER/Tests/certsCrls/TrustAnchorCRLCP.01.01.crl Index: Source/libDER/Tests/certsCrls/TrustAnchorCRLCP.01.01.crl ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/TrustAnchorCRLCP.01.01.crl cannot compute difference between binary files ADDED Source/libDER/Tests/certsCrls/apple_v3.000.cer Index: Source/libDER/Tests/certsCrls/apple_v3.000.cer ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/apple_v3.000.cer cannot compute difference between binary files ADDED Source/libDER/Tests/certsCrls/apple_v3.001.cer Index: Source/libDER/Tests/certsCrls/apple_v3.001.cer ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/apple_v3.001.cer cannot compute difference between binary files ADDED Source/libDER/Tests/certsCrls/entrust_v3.100.cer Index: Source/libDER/Tests/certsCrls/entrust_v3.100.cer ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/entrust_v3.100.cer cannot compute difference between binary files ADDED Source/libDER/Tests/certsCrls/entrust_v3.101.cer Index: Source/libDER/Tests/certsCrls/entrust_v3.101.cer ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/entrust_v3.101.cer cannot compute difference between binary files ADDED Source/libDER/Tests/certsCrls/keybank_v3.100.cer Index: Source/libDER/Tests/certsCrls/keybank_v3.100.cer ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/keybank_v3.100.cer cannot compute difference between binary files ADDED Source/libDER/Tests/certsCrls/keybank_v3.101.cer Index: Source/libDER/Tests/certsCrls/keybank_v3.101.cer ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/keybank_v3.101.cer cannot compute difference between binary files ADDED Source/libDER/Tests/certsCrls/keybank_v3.102.cer Index: Source/libDER/Tests/certsCrls/keybank_v3.102.cer ================================================================== --- /dev/null +++ Source/libDER/Tests/certsCrls/keybank_v3.102.cer cannot compute difference between binary files ADDED Source/libDER/Tests/parseCert.c Index: Source/libDER/Tests/parseCert.c ================================================================== --- /dev/null +++ Source/libDER/Tests/parseCert.c @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2005-2007,2010 Apple Inc. All Rights Reserved. + * + * parseCert.c - parse a DER-encoded X509 certificate using libDER. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void usage(char **argv) +{ + printf("usage: %s certFile [options]\n", argv[0]); + printf("Options:\n"); + printf(" -v -- verbose \n"); + /* etc. */ + exit(1); +} + +static void printValidity( + DERItem *validity, + int verbose) +{ + DERReturn drtn; + DERValidity derv; + + drtn = DERParseSequenceContent(validity, + DERNumValidityItemSpecs, DERValidityItemSpecs, + &derv, sizeof(derv)); + if(drtn) { + DERPerror("DERParseSequenceContent(validity)", drtn); + return; + } + decodePrintItem("notBefore", IT_Leaf, verbose, &derv.notBefore); + decodePrintItem("notAfter", IT_Leaf, verbose, &derv.notAfter); + +} + +int main(int argc, char **argv) +{ + unsigned char *certData = NULL; + unsigned certDataLen = 0; + DERSignedCertCrl signedCert; + DERTBSCert tbs; + DERReturn drtn; + DERItem item; + int verbose = 0; + extern char *optarg; + int arg; + extern int optind; + + if(argc < 2) { + usage(argv); + } + if(readFile(argv[1], &certData, &certDataLen)) { + printf("***Error reading cert from %s. Aborting.\n", argv[1]); + exit(1); + } + + optind = 2; + while ((arg = getopt(argc, argv, "vh")) != -1) { + switch (arg) { + case 'v': + verbose = 1; + break; + case 'h': + usage(argv); + } + } + if(optind != argc) { + usage(argv); + } + + /* Top level decode of signed cert into 3 components */ + item.data = certData; + item.length = certDataLen; + drtn = DERParseSequence(&item, DERNumSignedCertCrlItemSpecs, DERSignedCertCrlItemSpecs, + &signedCert, sizeof(signedCert)); + if(drtn) { + DERPerror("DERParseSequence(SignedCert)", drtn); + exit(1); + } + printItem("TBSCert", IT_Branch, verbose, ASN1_CONSTR_SEQUENCE, &signedCert.tbs); + + incrIndent(); + + /* decode the TBSCert - it was saved in full DER form */ + drtn = DERParseSequence(&signedCert.tbs, + DERNumTBSCertItemSpecs, DERTBSCertItemSpecs, + &tbs, sizeof(tbs)); + if(drtn) { + DERPerror("DERParseSequenceContent(TBSCert)", drtn); + exit(1); + } + if(tbs.version.data) { + /* unwrap the explicitly tagged integer.... */ + decodePrintItem("version", IT_Leaf, verbose, &tbs.version); + } + printItem("serialNum", IT_Leaf, verbose, ASN1_INTEGER, &tbs.serialNum); + + printItem("tbsSigAlg", IT_Branch, verbose, ASN1_CONSTR_SEQUENCE, &tbs.tbsSigAlg); + incrIndent(); + printAlgId(&tbs.tbsSigAlg, verbose); + decrIndent(); + + printItem("issuer", IT_Leaf, verbose, ASN1_CONSTR_SEQUENCE, &tbs.issuer); + printItem("subject", IT_Leaf, verbose, ASN1_CONSTR_SEQUENCE, &tbs.subject); + + printItem("validity", IT_Branch, verbose, ASN1_CONSTR_SEQUENCE, &tbs.validity); + incrIndent(); + printValidity(&tbs.validity, verbose); + decrIndent(); + + printItem("subjectPubKey", IT_Branch, verbose, ASN1_CONSTR_SEQUENCE, + &tbs.subjectPubKey); + incrIndent(); + printSubjPubKeyInfo(&tbs.subjectPubKey, verbose); + decrIndent(); + + if(tbs.issuerID.data) { + /* found tag is implicit context specific: tell printItem what it really is */ + printItem("issuerID", IT_Leaf, verbose, ASN1_BIT_STRING, &tbs.issuerID); + } + if(tbs.subjectID.data) { + printItem("subjectID", IT_Leaf, verbose, ASN1_BIT_STRING, &tbs.subjectID); + } + if(tbs.extensions.data) { + printItem("extensions", IT_Leaf, verbose, ASN1_CONSTRUCTED | ASN1_CONTEXT_SPECIFIC | 3, + &tbs.extensions); + } + decrIndent(); + + printItem("sigAlg", IT_Branch, verbose, ASN1_CONSTR_SEQUENCE, &signedCert.sigAlg); + incrIndent(); + printAlgId(&signedCert.sigAlg, verbose); + decrIndent(); + + printItem("sig", IT_Leaf, verbose, ASN1_BIT_STRING, &signedCert.sig); + + return 0; +} ADDED Source/libDER/Tests/parseCrl.c Index: Source/libDER/Tests/parseCrl.c ================================================================== --- /dev/null +++ Source/libDER/Tests/parseCrl.c @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2005-2007,2010 Apple Inc. All Rights Reserved. + * + * parseCrl.c - parse a DER-encoded X509 CRL using libDER. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void usage(char **argv) +{ + printf("usage: %s crlFile [options]\n", argv[0]); + printf("Options:\n"); + printf(" -v -- verbose \n"); + /* etc. */ + exit(1); +} + +/* + * This is a SEQUENCE OF so we use the low-level DERDecodeSeq* routines to snag one entry + * at a time. + */ +static void printRevokedCerts( + DERItem *revokedCerts, + int verbose) +{ + DERReturn drtn; + DERDecodedInfo currItem; + DERSequence seq; + unsigned certNum; + DERRevokedCert revoked; + + drtn = DERDecodeSeqContentInit(revokedCerts, &seq); + if(drtn) { + DERPerror("DERDecodeSeqContentInit(revokedCerts)", drtn); + return; + } + + for(certNum=0; ; certNum++) { + drtn = DERDecodeSeqNext(&seq, &currItem); + switch(drtn) { + case DR_EndOfSequence: + /* normal termination */ + return; + default: + DERPerror("DERDecodeSeqNext", drtn); + return; + case DR_Success: + doIndent(); + printf("revoked cert %u\n", certNum); + incrIndent(); + drtn = DERParseSequenceContent(&currItem.content, + DERNumRevokedCertItemSpecs, DERRevokedCertItemSpecs, + &revoked, sizeof(revoked)); + if(drtn) { + DERPerror("DERParseSequenceContent(RevokedCert)", drtn); + decrIndent(); + return; + } + printItem("serialNum", IT_Leaf, verbose, ASN1_INTEGER, &revoked.serialNum); + decodePrintItem("revocationDate", IT_Leaf, verbose, &revoked.revocationDate); + printItem("extensions", IT_Branch, verbose, ASN1_CONSTR_SEQUENCE, &revoked.extensions); + decrIndent(); + } + } +} + +int main(int argc, char **argv) +{ + unsigned char *crlData = NULL; + unsigned crlDataLen = 0; + DERSignedCertCrl signedCrl; + DERTBSCrl tbs; + DERReturn drtn; + DERItem item; + int verbose = 0; + extern char *optarg; + int arg; + extern int optind; + + if(argc < 2) { + usage(argv); + } + if(readFile(argv[1], &crlData, &crlDataLen)) { + printf("***Error reading CRL from %s. Aborting.\n", argv[1]); + exit(1); + } + + optind = 2; + while ((arg = getopt(argc, argv, "vh")) != -1) { + switch (arg) { + case 'v': + verbose = 1; + break; + case 'h': + usage(argv); + } + } + if(optind != argc) { + usage(argv); + } + + /* Top level decode of signed CRL into 3 components */ + item.data = crlData; + item.length = crlDataLen; + drtn = DERParseSequence(&item, DERNumSignedCertCrlItemSpecs, DERSignedCertCrlItemSpecs, + &signedCrl, sizeof(signedCrl)); + if(drtn) { + DERPerror("DERParseSequence(SignedCrl)", drtn); + exit(1); + } + printItem("TBSCrl", IT_Branch, verbose, ASN1_CONSTR_SEQUENCE, &signedCrl.tbs); + + incrIndent(); + + /* decode the TBSCrl - it was saved in full DER form */ + drtn = DERParseSequence(&signedCrl.tbs, + DERNumTBSCrlItemSpecs, DERTBSCrlItemSpecs, + &tbs, sizeof(tbs)); + if(drtn) { + DERPerror("DERParseSequenceContent(TBSCrl)", drtn); + exit(1); + } + if(tbs.version.data) { + printItem("version", IT_Leaf, verbose, ASN1_INTEGER, &tbs.version); + } + + printItem("tbsSigAlg", IT_Branch, verbose, ASN1_CONSTR_SEQUENCE, &tbs.tbsSigAlg); + incrIndent(); + printAlgId(&tbs.tbsSigAlg, verbose); + decrIndent(); + + printItem("issuer", IT_Leaf, verbose, ASN1_CONSTR_SEQUENCE, &tbs.issuer); + + decodePrintItem("thisUpdate", IT_Leaf, verbose, &tbs.thisUpdate); + decodePrintItem("nextUpdate", IT_Leaf, verbose, &tbs.nextUpdate); + + if(tbs.revokedCerts.data) { + printItem("version", IT_Leaf, verbose, ASN1_CONSTR_SEQUENCE, &tbs.revokedCerts); + incrIndent(); + printRevokedCerts(&tbs.revokedCerts, verbose); + decrIndent(); + } + + if(tbs.extensions.data) { + printItem("extensions", IT_Leaf, verbose, ASN1_CONSTRUCTED | ASN1_CONTEXT_SPECIFIC | 3, + &tbs.extensions); + } + + printItem("sigAlg", IT_Branch, verbose, ASN1_CONSTR_SEQUENCE, &signedCrl.sigAlg); + incrIndent(); + printAlgId(&signedCrl.sigAlg, verbose); + decrIndent(); + + printItem("sig", IT_Leaf, verbose, ASN1_BIT_STRING, &signedCrl.sig); + + return 0; +} ADDED Source/libDER/Tests/parseTicket.c Index: Source/libDER/Tests/parseTicket.c ================================================================== --- /dev/null +++ Source/libDER/Tests/parseTicket.c @@ -0,0 +1,586 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "AppleMobilePersonalizedTicket.h" +#include +#include +#include +#include +#include +#include +#include "DER_Ticket.h" + +const unsigned char GoldKeyCert[] = { +0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, +0x00, 0x08, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, +0x03, 0x00, 0x00, 0x00, 0x31, 0x6e, 0xc6, 0x4f, +0xf1, 0xe8, 0x7d, 0x81, 0x38, 0x6d, 0xd8, 0xb3, +0x2b, 0xe4, 0xb5, 0xa0, 0x09, 0xaf, 0x74, 0xdd, +0xe9, 0x60, 0x27, 0x42, 0x07, 0xa3, 0xac, 0xef, +0xe5, 0x75, 0x07, 0xa8, 0xc2, 0x2c, 0x25, 0x56, +0x91, 0x37, 0xea, 0xdb, 0xdb, 0x68, 0x4a, 0x1c, +0xe3, 0x29, 0x61, 0x85, 0xd7, 0xd8, 0x66, 0x86, +0x66, 0xbf, 0xbf, 0x98, 0xae, 0xb4, 0xe9, 0x6c, +0x13, 0x81, 0x97, 0x78, 0x2a, 0x8d, 0xdc, 0x37, +0x9a, 0xf1, 0xa4, 0x0a, 0x9d, 0x74, 0xd5, 0x72, +0xbc, 0xb5, 0x64, 0xa6, 0x1a, 0x62, 0xd5, 0x39, +0xfb, 0x6f, 0xc0, 0xd1, 0xc7, 0x93, 0xc3, 0x20, +0xda, 0x84, 0x69, 0x1e, 0xd9, 0x96, 0x2e, 0xc1, +0x4f, 0x28, 0x96, 0x14, 0xa4, 0x68, 0x0a, 0x40, +0xe5, 0x17, 0xe7, 0xd6, 0x76, 0x4d, 0x81, 0xd8, +0xd2, 0xa6, 0x18, 0x82, 0x36, 0x40, 0x97, 0x31, +0xd9, 0x88, 0xdf, 0xaf, 0x05, 0x3a, 0x4b, 0x4e, +0x1b, 0x4a, 0x76, 0x6f, 0xb9, 0x6c, 0x18, 0x5d, +0xd5, 0x98, 0xf0, 0xf1, 0xbe, 0x0a, 0xd9, 0x57, +0x85, 0xc6, 0xc9, 0x63, 0xb3, 0xf5, 0x21, 0x26, +0x07, 0xba, 0x6a, 0x05, 0xfb, 0x5a, 0x06, 0x87, +0x2a, 0x30, 0x3f, 0xa9, 0xea, 0xab, 0x0e, 0x50, +0x70, 0x3b, 0x7e, 0xd4, 0xd2, 0x8c, 0xf3, 0xa1, +0xcf, 0x9a, 0x6c, 0x6b, 0xcf, 0x9b, 0x1b, 0x2a, +0x97, 0x6a, 0x3c, 0x38, 0x40, 0x43, 0xb1, 0x97, +0x19, 0x07, 0x64, 0x11, 0x94, 0x73, 0x14, 0xc9, +0xa3, 0xfe, 0x7f, 0xf6, 0x64, 0x23, 0x73, 0xe3, +0x76, 0xce, 0xf7, 0xf4, 0x2f, 0x6c, 0x9d, 0x0a, +0xf6, 0x39, 0xe6, 0x1d, 0xb2, 0x17, 0x29, 0x39, +0x98, 0x52, 0xda, 0xe0, 0x31, 0xa1, 0xfa, 0x85, +0x52, 0xc2, 0x60, 0xb5, 0x11, 0x42, 0xc6, 0x9b, +0x55, 0xd8, 0x40, 0x37, 0xf7, 0xdb, 0x01, 0x6a, +0xd5, 0x26, 0x3b, 0x27, 0x07, 0x20, 0xf7, 0x58, +0xd5, 0xa4, 0x1c, 0xe6, 0x2f, 0x74, 0x14, 0x6e, +0xa4, 0xe8, 0xc8, 0xe8, 0x9a, 0x39, 0x6d, 0xde, +0x7f, 0x67, 0x65, 0x40, 0x68, 0x26, 0x65, 0x62, +0x95, 0x87, 0x45, 0x62, 0x0d, 0x8d, 0x42, 0xad, +0x3b, 0x4f, 0xd3, 0x8f, 0x58, 0xcb, 0x61, 0x46, +0xc9, 0x3d, 0x7d, 0x75, 0x3c, 0x6d, 0xac, 0xdf, +0x53, 0xf4, 0x66, 0x9e, 0x14, 0x82, 0xc7, 0xd1, +0xd0, 0xec, 0x92, 0x24, 0x97, 0x1e, 0xc9, 0x7a, +0xfd, 0x8f, 0x75, 0xe2, 0xfd, 0x7e, 0x07, 0x44, +0x46, 0x56, 0x64, 0x9b, 0x1b, 0x17, 0xfa, 0xd6, +0xf5, 0xdb, 0xc9, 0x27, 0x3b, 0x60, 0x27, 0x2f, +0x84, 0xd7, 0xac, 0x7f, 0xf3, 0xa7, 0x16, 0x31, +0xfa, 0x19, 0x54, 0x57, 0x98, 0xb5, 0xdb, 0x9c, +0xc3, 0xb5, 0x55, 0x72, 0x98, 0x2f, 0x56, 0x33, +0x7c, 0x38, 0x1f, 0xb4, 0x8c, 0x94, 0x1a, 0x6a, +0x26, 0x8a, 0x84, 0xfc, 0x8d, 0xb1, 0x49, 0xbb, +0x6d, 0x11, 0x36, 0xc9, 0x05, 0x57, 0x87, 0xd2, +0xdb, 0xd3, 0xe3, 0xea, 0x08, 0xb2, 0x9f, 0x44, +0x85, 0xd7, 0xd4, 0x96, 0x25, 0xeb, 0x2b, 0xca, +0x86, 0x0f, 0x33, 0x69, 0xc4, 0xda, 0x98, 0x68, +0x21, 0xad, 0xd8, 0xc4, 0x4e, 0x46, 0x33, 0x43, +0xad, 0xe7, 0xfe, 0x58, 0x10, 0x00, 0x76, 0x3c, +0xd4, 0x14, 0x5a, 0x74, 0x43, 0x04, 0xc3, 0xdd, +0x46, 0xc3, 0xe0, 0x4b, 0x46, 0xb5, 0x84, 0xcb, +0xe6, 0x40, 0x71, 0xdf, 0x50, 0x16, 0x5f, 0xf0, +0x0f, 0xc5, 0x9c, 0x50, 0x64, 0xe0, 0x64, 0x1c, +0x58, 0x87, 0xae, 0x91, 0x9c, 0xb6, 0x57, 0x77, +0xf0, 0xc4, 0x3e, 0xcf, 0xb6, 0xc5, 0x10, 0x0c, +0xea, 0x5b, 0xcc, 0xaf, 0xee, 0x7b, 0x15, 0x4e, +0x4e, 0x3c, 0x29, 0x9c, 0xf8, 0xe6, 0x59, 0xca, +0xaf, 0x48, 0x12, 0x99, 0x76, 0xde, 0x54, 0xe2, +0x75, 0x62, 0x31, 0x17, +}; + +#define SIG_LEN 128 +#define HASH_LEN 20 + +const unsigned char fakeAlgOID[] = { +0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05 +}; + +const unsigned char fakeG3Cert[] = { +0x01,0x00,0x00,0x00, +0x1c,0x00,0x00,0x00, +0x01,0x08,0x00,0x00, +0x10,0x0a,0x00,0x00, +0x00,0x00,0x00,0x00, +0x00,0x04,0x00,0x00, +0x01,0x00,0x01,0x00, +0x19,0xfc,0xb6,0x7b,0x4e,0xa8,0xd7,0xb1,0xeb,0xf9,0x19,0x28,0x07,0x7f,0x47,0x4c, +0xe1,0x9f,0xbe,0x01,0x15,0x5c,0xea,0xda,0xc3,0xd1,0x59,0x3c,0x75,0xed,0x00,0x7b, +0x22,0x67,0x22,0xd6,0xd3,0xee,0xc2,0x04,0xdf,0x47,0xc4,0x85,0xc0,0x56,0xa4,0x8d, +0xf3,0xf0,0xcf,0x00,0x9d,0xd2,0x03,0xc1,0x23,0x3f,0xc8,0x9f,0xef,0xfe,0xea,0x50, +0x33,0x6b,0xbe,0x74,0x1a,0xa3,0x3c,0x13,0xa2,0xc5,0xf6,0x75,0x88,0x1d,0x3f,0xba, +0xff,0x0d,0x47,0xab,0xbe,0xfe,0x42,0xd3,0xea,0xe2,0xe2,0xb0,0x06,0xd7,0x88,0xf8, +0x1d,0x93,0xdf,0x86,0xbd,0xd8,0xa8,0x5f,0x2b,0xe3,0x97,0x41,0xa1,0xc6,0x1d,0x69, +0xe9,0x88,0xdf,0x87,0xbb,0x1b,0xff,0x31,0x82,0xae,0x8a,0x69,0x31,0xca,0xc3,0x90, +0x0f,0x0d,0x22,0xa3,0xcf,0x8d,0xcc,0x23,0x03,0x10,0xed,0x74,0x8e,0x13,0x74,0x49, +0x9d,0x9a,0x1c,0xf2,0x57,0x2d,0x18,0x89,0x6d,0xb8,0xcc,0xab,0xcf,0xd9,0xd8,0x0e, +0x46,0x68,0x98,0xa3,0x81,0x5d,0x18,0xe8,0x4d,0x03,0x96,0x14,0xc5,0xaf,0x21,0x91, +0xb7,0x8c,0x97,0xa1,0x85,0xde,0x85,0x78,0xa8,0xd7,0x25,0x20,0x9b,0x2b,0x98,0x36, +0xd5,0xfe,0x14,0x9b,0x5d,0xe3,0x78,0xf4,0xd6,0xb2,0x15,0xc9,0xfd,0x13,0x77,0x7b, +0x8a,0x5e,0x9e,0x85,0xff,0x53,0x6d,0x24,0x5d,0xc9,0x52,0x16,0x98,0x18,0xb1,0xaf, +0xe1,0x6a,0xd6,0xe8,0xa9,0x7c,0x78,0x8e,0x9f,0x79,0x21,0xa1,0xde,0xf4,0xaf,0x9c, +0xd4,0x61,0x52,0xf9,0xe7,0xfc,0xd7,0x10,0x1b,0x91,0x66,0x14,0x26,0xfd,0xda,0xee, +0xe5,0xd9,0x4c,0xb7,0x9d,0x6d,0x17,0xf8,0xc2,0x21,0xb4,0x34,0x08,0x0c,0x44,0x79, +0x53,0x9c,0x81,0xbf,0x1f,0x22,0x0a,0xa6,0xe7,0x22,0x5f,0x5c,0xcb,0x31,0x2e,0xf5, +0x0c,0x1a,0xf1,0x67,0x13,0x7f,0xe6,0xb3,0xb2,0xfe,0x6b,0x09,0xac,0xa6,0xd4,0x14, +0xe7,0xe9,0x11,0x0e,0x49,0x99,0x06,0x04,0xa4,0x43,0x22,0xec,0x9f,0x59,0x83,0xfb, +0xef,0xa3,0x8f,0x6b,0xde,0x70,0x0c,0xbb,0x89,0xe9,0x88,0xbc,0xeb,0x36,0x42,0x42, +0x50,0x84,0xf5,0x93,0x98,0x93,0xed,0xa2,0x1f,0x13,0x60,0x36,0xc8,0x2f,0x9f,0xd1, +0xc4,0x23,0xf6,0xd0,0x49,0x40,0xab,0xbe,0xf7,0x43,0x02,0x96,0xf0,0x74,0xa5,0x7d, +0x68,0x89,0xfa,0x58, 0xad, 0x7b, 0x2f, 0x7d, 0xe8, 0x21, 0x34, 0x5e, 0x6c, 0x20, +0x97, 0x9e +}; + +const unsigned char fakeSig[] = { +0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10, +0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10, +0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10, +0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10, +0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10, +0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10, +0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10, +0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 +}; + +static void +dumpBytes( const char *title, const unsigned char *data, int len, int nonewline ); + +static int +rsa_sign( + const char *keyFile, + unsigned char *plain, + unsigned plainLength, + unsigned char signature[SIG_LEN] ) +{ + int rc = -1; + FILE *fp = NULL; + RSA *rsa = NULL; + unsigned signatureLength = 0; + + fp = fopen ( (char*) keyFile, "r" ); + if ( !fp ) { + fprintf( stderr, "failed to open file=%s\n", keyFile ); + goto cleanup; + } + rsa = RSA_new(); + if ( !rsa ) { + fprintf( stderr, "RSA_new() failed\n" ); + goto cleanup; + } + rsa = (RSA*)PEM_read_RSAPrivateKey( fp, &rsa, NULL, NULL ); + if ( !rsa ) { + fprintf( stderr, "PEM_read_RSAPrivateKey() failed\n" ); + goto cleanup; + } + signatureLength = SIG_LEN; + char sha1[20] = {}; + (void) SHA1( plain, plainLength, (unsigned char*)sha1 ); + rc = RSA_sign( NID_sha1, (unsigned char*)sha1, sizeof( sha1), + signature, &signatureLength, rsa ); + if ( rc != 1 ) { + fprintf(stderr, "RSA_sign failed=%d\n", rc ); + rc = -1; + goto cleanup; + } else { + rc = 0; + } + +cleanup: + if ( fp ) fclose( fp ); + RSA_free( rsa ); + return rc; +} + +static int +rsa_verify( + const char *keyFile, + unsigned char *plain, + unsigned plainLength, + unsigned char signature[SIG_LEN] ) +{ + int rc = -1; + FILE *fp = NULL; + RSA *rsa = NULL; + unsigned signatureLength = 0; + + fp = fopen ( (char*) keyFile, "r" ); + if ( !fp ) { + fprintf( stderr, "failed to open file=%s\n", keyFile ); + goto cleanup; + } + rsa = RSA_new(); + if ( !rsa ) { + fprintf( stderr, "RSA_new() failed\n" ); + goto cleanup; + } + rsa = (RSA*)PEM_read_RSAPrivateKey( fp, &rsa, NULL, NULL ); + if ( !rsa ) { + fprintf( stderr, "PEM_read_RSAPrivateKey() failed\n" ); + goto cleanup; + } + signatureLength = SIG_LEN; + char sha1[20] = {}; + (void) SHA1( plain, plainLength, (unsigned char*)sha1 ); + rc = RSA_verify( NID_sha1, (unsigned char*)sha1, sizeof( sha1 ), + signature, signatureLength, rsa ); + if ( rc != 1 ) { + fprintf(stderr, "RSA_verify failed=%d\n", rc ); + rc = -1; + goto cleanup; + } else { + rc = 0; + } + +cleanup: + if ( fp ) fclose( fp ); + RSA_free( rsa ); + return rc; + return rc; +} + +static void +dumpBytes( const char *title, const unsigned char *data, int len, int nonewline ) +{ + int width = 16; + int line = 0; + int multiple = 0; + + multiple = ( len % width == 0 ); + + printf( "[%s: %d bytes]\n", title, len ); + while ( len-- > 0 ) { + line++; + printf( "%02X ", *data++ ); + if ( line % width == 0 && len > 0 && !nonewline ) { + printf( "\n" ); + } + } + + printf("\n"); +} + +static void +readFile(char *filename, unsigned char **data, unsigned *len) +{ + int size = 0; + FILE *file = NULL; + if ((file = fopen(filename, "r")) == NULL) { + fprintf(stderr, "could not open file=%s", filename); + return; + } + fseek(file, 0, SEEK_END); + size = ftell(file); + *len = size; + *data = (unsigned char*)malloc(*len); + if (!*data) { + fprintf(stderr, "Out of memory"); + fclose(file); + return; + } + rewind(file); + (void)fread(*data, size, 1, file); + fclose(file); +} + +static void +writeFile( char* filename, unsigned char* buf, int len ) +{ + FILE *file = NULL; + file = fopen( filename, "w" ); + if ( file ) { + fwrite( buf, len, 1, file ); + fclose( file ); + } +} + + +static void +verify_bb_ticket( + unsigned char *ticketData, + unsigned ticketLength, + const char *keyFile, + bool doPrint ) +{ + if ( doPrint ) { + dumpBytes( "Ticket (whole)", ticketData, ticketLength, 0 ); + printf( "\nBreakdown:\n" ); + } + + DERItem derTicket = { .data = ticketData, .length = ticketLength }; + DERReturn drtn; + DERBbTicket ticket = {}; + DERSize ticketSize; + drtn = DERDecodeBbTicket(&derTicket, &ticket, &ticketSize); + if (drtn != DR_Success) goto badTicket; + fprintf( stderr, "ticketSize=%u\n", ticketSize ); + + // Verify signature if key file exists (we should really use the certificate or GPUK in the ticket here. */ + if ( keyFile ) { + int status = rsa_verify( + keyFile, + (unsigned char *)ticket.body.data, + ticket.body.length, + (unsigned char *)ticket.signature.data ); + if ( status ) { + fprintf( stderr, "rsa_verify failed=%d\n", status ); + } else { + fprintf( stdout, "Signature verified successfully\n"); + } + } + + /* Example of how to retrive fields from ticket. */ + DERItem snum; + drtn = DERSetDecodeItemWithTag(&ticket.body, + ASN1_CONTEXT_SPECIFIC | kBbSNUMTag, &snum); + if (drtn != DR_Success) goto badTicket; + DERItem chipId; + drtn = DERSetDecodeItemWithTag(&ticket.body, + ASN1_CONTEXT_SPECIFIC | kBbChipIDTag, &chipId); + if (drtn != DR_Success) goto badTicket; + + return; +badTicket: + fprintf( stdout, "Bad ticket\n"); + return; +} + +static void +verify_ticket_file( + const char *ticketFile, + const char *keyFile ) +{ + unsigned char *ticket = NULL; + unsigned ticketLength = 0; + readFile( (char*)ticketFile, &ticket, &ticketLength ); + verify_bb_ticket( ticket, ticketLength, keyFile, false ); +} + +static void +make_sample_ap_ticket( void ) +{ + unsigned char chipId[] = { 0x01, 0x02, 0x03, 0x04 }; + unsigned char ecid[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }; + + DERApTicket ticket = { }; + + /* Encode the signatureAlgorithm field of the ticket. */ + DERAlgorithmId algorithmId = { .oid = oidSha1Rsa, .params = {} }; + ticket.signatureAlgorithm.length = DERLengthOfEncodedSequence( + ASN1_CONSTR_SEQUENCE, &algorithmId, DERNumAlgorithmIdItemSpecs, + DERAlgorithmIdItemSpecs); + ticket.signatureAlgorithm.data = malloc(ticket.signatureAlgorithm.length); + DEREncodeSequence(ASN1_CONSTR_SEQUENCE, &algorithmId, DERNumAlgorithmIdItemSpecs, DERAlgorithmIdItemSpecs, ticket.signatureAlgorithm.data, &ticket.signatureAlgorithm.length); + + /* Construct ticket body. */ + DERSize numBodyItemSpecs = 0; + DERItemSpec bodyItemSpecs[50] = {}; + DERItem bodyItems[50] = {}; + + /* Add tags in sorted order. */ + bodyItemSpecs[numBodyItemSpecs].offset = numBodyItemSpecs * sizeof(DERItem); + bodyItemSpecs[numBodyItemSpecs].tag = ASN1_CONTEXT_SPECIFIC | kApECIDTag; + bodyItemSpecs[numBodyItemSpecs].options = DER_ENC_NO_OPTS; + bodyItems[numBodyItemSpecs].data = ecid; + bodyItems[numBodyItemSpecs].length = sizeof(ecid); + numBodyItemSpecs++; + + bodyItemSpecs[numBodyItemSpecs].offset = numBodyItemSpecs * sizeof(DERItem); + bodyItemSpecs[numBodyItemSpecs].tag = ASN1_CONTEXT_SPECIFIC | kApChipIDTag; + bodyItemSpecs[numBodyItemSpecs].options = DER_ENC_NO_OPTS; + bodyItems[numBodyItemSpecs].data = chipId; + bodyItems[numBodyItemSpecs].length = sizeof(chipId); + numBodyItemSpecs++; + + /* Encode ticket body. */ + ticket.body.length = DERLengthOfEncodedSequence(ASN1_CONSTR_SET, + &bodyItems, numBodyItemSpecs, bodyItemSpecs); + ticket.body.data = malloc(ticket.body.length); + DEREncodeSequence(ASN1_CONSTR_SET, &bodyItems, numBodyItemSpecs, + bodyItemSpecs, ticket.body.data, &ticket.body.length); + + // Signature + ticket.signature.data = (DERByte *)fakeSig; + ticket.signature.length = sizeof(fakeSig); + + // Certificates + DERItemSpec certItemSpecs[1]; + DERItem certItems[1]; + certItemSpecs[0].offset = 0; + certItemSpecs[0].tag = ASN1_CONSTR_SEQUENCE; + certItemSpecs[0].options = DER_ENC_WRITE_DER; + + // NOTE: The Certificate should be added to the ticket by the host. I'm just simulating that here + // to generate the final ticket blob. + readFile("S5L8920_TATSU_FAC_DARWIN_DEV_CHAIN.der", &certItems[0].data, &certItems[0].length); + + ticket.certificates.length = DERLengthOfEncodedSequence( + ASN1_CONSTRUCTED | ASN1_CONTEXT_SPECIFIC | 1, &certItems, + 1, certItemSpecs); + ticket.certificates.data = malloc(ticket.certificates.length); + DEREncodeSequence(ASN1_CONSTRUCTED | ASN1_CONTEXT_SPECIFIC | 1, &certItems, + 1, certItemSpecs, ticket.certificates.data, &ticket.certificates.length); + + /* Encode the entire ticket. */ + DERSize ticketLength = DERLengthOfEncodedSequence(ASN1_CONSTR_SEQUENCE, + &ticket, DERNumApTicketItemSpecs, DERApTicketItemSpecs); + DERByte *ticketBytes = malloc(ticketLength); + DEREncodeSequence(ASN1_CONSTR_SEQUENCE, &ticket, DERNumApTicketItemSpecs, DERApTicketItemSpecs, + ticketBytes, &ticketLength); + + // save ticket to file + writeFile("ApTicket.bin", ticketBytes, ticketLength); + +//cleanup: + free(ticket.body.data); + free(ticket.signatureAlgorithm.data); + free(ticket.certificates.data); + free(ticketBytes); +} + +static void +make_sample_bb_ticket( void ) +{ + int status = 0; + unsigned char chipId[] = { 0x01, 0x02, 0x03, 0x04 }; + unsigned char snum[] = { 0x01, 0x02, 0x03, 0x04 }; + unsigned char signature[SIG_LEN] = {}; + DERByte *ticketBytes = NULL; + + DERBbTicket ticket = {}; + + /* Encode the signatureAlgorithm field of the ticket. */ + DERAlgorithmId algorithmId = { .oid = oidSha1Rsa }; + ticket.signatureAlgorithm.length = DERLengthOfEncodedSequence( + ASN1_CONSTR_SEQUENCE, &algorithmId, DERNumAlgorithmIdItemSpecs, + DERAlgorithmIdItemSpecs); + ticket.signatureAlgorithm.data = malloc(ticket.signatureAlgorithm.length); + DEREncodeSequence(ASN1_CONSTR_SEQUENCE, &algorithmId, + DERNumAlgorithmIdItemSpecs, DERAlgorithmIdItemSpecs, + ticket.signatureAlgorithm.data, &ticket.signatureAlgorithm.length); + + /* Construct ticket body. */ + DERSize numBodyItemSpecs = 0; + DERItemSpec bodyItemSpecs[50] = {}; + DERItem bodyItems[50] = {}; + + /* Add tags in sorted order. */ + bodyItemSpecs[numBodyItemSpecs].offset = numBodyItemSpecs * sizeof(DERItem); + bodyItemSpecs[numBodyItemSpecs].tag = ASN1_CONTEXT_SPECIFIC | kBbSNUMTag; + bodyItemSpecs[numBodyItemSpecs].options = DER_ENC_NO_OPTS; + bodyItems[numBodyItemSpecs].data = snum; + bodyItems[numBodyItemSpecs].length = sizeof(snum); + numBodyItemSpecs++; + + bodyItemSpecs[numBodyItemSpecs].offset = numBodyItemSpecs * sizeof(DERItem); + bodyItemSpecs[numBodyItemSpecs].tag = ASN1_CONTEXT_SPECIFIC | kBbChipIDTag; + bodyItemSpecs[numBodyItemSpecs].options = DER_ENC_NO_OPTS; + bodyItems[numBodyItemSpecs].data = chipId; + bodyItems[numBodyItemSpecs].length = sizeof(chipId); + numBodyItemSpecs++; + + /* Encode ticket body. */ + ticket.body.length = DERLengthOfEncodedSequence(ASN1_CONSTR_SET, + &bodyItems, numBodyItemSpecs, bodyItemSpecs); + ticket.body.data = malloc(ticket.body.length); + DEREncodeSequence(ASN1_CONSTR_SET, &bodyItems, numBodyItemSpecs, bodyItemSpecs, + ticket.body.data, &ticket.body.length); + + // NOTE: In the SEE machine, the Body above will then be hashed/signed to generate signature + status = rsa_sign( + "G1_GPrK.pem", + ticket.body.data, + ticket.body.length, + (unsigned char *)signature ); + if ( status ) { + fprintf( stderr, "rsa_sign failed=%d\n", status ); + goto cleanup; + } else { + fprintf( stdout, "Signed successfully\n"); + } + + status = rsa_verify( + "G1_GPrK.pem", + ticket.body.data, + ticket.body.length, + (unsigned char *)signature ); + if ( status ) { + fprintf( stderr, "rsa_verify failed=%d\n", status ); + goto cleanup; + } else { + fprintf( stdout, "Signature verified successfully\n"); + } + + // Signature + ticket.signature.data = signature; + ticket.signature.length = SIG_LEN; + + // Certificates + ticket.gpuk.length = sizeof(GoldKeyCert); + ticket.gpuk.data = (DERByte *)GoldKeyCert; + + /* Encode the entire ticket. */ + DERSize ticketLength = DERLengthOfEncodedSequence(ASN1_CONSTR_SEQUENCE, + &ticket, DERNumBbTicketItemSpecs, DERBbTicketItemSpecs); + ticketBytes = malloc(ticketLength); + DEREncodeSequence(ASN1_CONSTR_SEQUENCE, &ticket, DERNumBbTicketItemSpecs, + DERBbTicketItemSpecs, ticketBytes, &ticketLength); + + // save ticket to file + writeFile("BbTicket.bin", ticketBytes, ticketLength); + +cleanup: + free(ticket.body.data); + free(ticket.signatureAlgorithm.data); + free(ticketBytes); +} + +static void +long_tag_test(void) +{ + printf("ASN1_TAG_MASK 0x%.016qx\n", (uint64_t)ASN1_TAG_MASK); + printf("ASN1_TAGNUM_MASK 0x%.016qx\n", (uint64_t)ASN1_TAGNUM_MASK); + printf("ASN1_METHOD_MASK 0x%.016qx\n", (uint64_t)ASN1_METHOD_MASK); + printf("ASN1_PRIMITIVE 0x%.016qx\n", (uint64_t)ASN1_PRIMITIVE); + printf("ASN1_CONSTRUCTED 0x%.016qx\n", (uint64_t)ASN1_CONSTRUCTED); + printf("ASN1_CLASS_MASK 0x%.016qx\n", (uint64_t)ASN1_CLASS_MASK); + printf("ASN1_UNIVERSAL 0x%.016qx\n", (uint64_t)ASN1_UNIVERSAL); + printf("ASN1_APPLICATION 0x%.016qx\n", (uint64_t)ASN1_APPLICATION); + printf("ASN1_CONTEXT_SPECIFIC 0x%.016qx\n", (uint64_t)ASN1_CONTEXT_SPECIFIC); + printf("ASN1_PRIVATE 0x%.016qx\n", (uint64_t)ASN1_PRIVATE); + + DERByte buf[10]; + DERSize len = sizeof(buf); + DERReturn drtn; + DERTag tag = ASN1_CONTEXT_SPECIFIC | ASN1_TAGNUM_MASK; + drtn = DEREncodeItem(tag, 0, 0, buf, &len); + if (drtn) + { + printf("DEREncodeItem: %u\n", drtn); + } + DERItem der = { .data = buf, .length = len }; + + dumpBytes("tlv", buf, len, 0); + + DERDecodedInfo decoded; + drtn = DERDecodeItem(&der, &decoded); + if (drtn) + { + printf("DERDecodeItem: %u\n", drtn); + } + if (decoded.tag != tag) + { + printf("DERDecodeItem tag: 0x%qx != 0x%qx\n", (uint64_t)decoded.tag, (uint64_t)tag); + } + printf("DERDecodeItem tag: 0x%qx encoded in %u bytes, decoded length: %u\n", + (uint64_t)tag, len, decoded.content.length); +} + +int main(int argc, char **argv) +{ + long_tag_test(); + printf( "=> Making sample BB ticket...\n"); + make_sample_bb_ticket(); + printf( "=> Making sample AP ticket...\n"); + make_sample_ap_ticket(); + printf( "=> Verifying signature in bb_ticket.bin ...\n"); + verify_ticket_file( "bb_ticket.bin", "G1_GPrK.pem" ); + return 0; +} ADDED Source/libDER/libDER.xcodeproj/project.pbxproj Index: Source/libDER/libDER.xcodeproj/project.pbxproj ================================================================== --- /dev/null +++ Source/libDER/libDER.xcodeproj/project.pbxproj @@ -0,0 +1,828 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXAggregateTarget section */ + 053BA30F091C00B100A7007A /* World */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 4CD81A6D09BE1FD2000A9641 /* Build configuration list for PBXAggregateTarget "World" */; + buildPhases = ( + ); + dependencies = ( + 053BA317091C017E00A7007A /* PBXTargetDependency */, + 053BA463091FE60E00A7007A /* PBXTargetDependency */, + 058ECC54091FF0000050AA30 /* PBXTargetDependency */, + 058F16680925224F009FA1C5 /* PBXTargetDependency */, + 4C96C8DC113F4174005483E8 /* PBXTargetDependency */, + ); + name = World; + productName = World; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 053BA324091C02B700A7007A /* DER_Decode.h in Headers */ = {isa = PBXBuildFile; fileRef = 053BA321091C02B700A7007A /* DER_Decode.h */; }; + 053BA325091C02B700A7007A /* libDER_config.h in Headers */ = {isa = PBXBuildFile; fileRef = 053BA322091C02B700A7007A /* libDER_config.h */; }; + 053BA326091C02B700A7007A /* libDER.h in Headers */ = {isa = PBXBuildFile; fileRef = 053BA323091C02B700A7007A /* libDER.h */; }; + 053BA344091C089B00A7007A /* asn1Types.h in Headers */ = {isa = PBXBuildFile; fileRef = 053BA342091C089B00A7007A /* asn1Types.h */; }; + 053BA345091C089B00A7007A /* DER_Decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 053BA343091C089B00A7007A /* DER_Decode.c */; }; + 053BA399091C258100A7007A /* DER_CertCrl.c in Sources */ = {isa = PBXBuildFile; fileRef = 053BA397091C258100A7007A /* DER_CertCrl.c */; }; + 053BA39A091C258100A7007A /* DER_CertCrl.h in Headers */ = {isa = PBXBuildFile; fileRef = 053BA398091C258100A7007A /* DER_CertCrl.h */; }; + 053BA45D091FE5E700A7007A /* libDER.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 053BA314091C00BF00A7007A /* libDER.a */; }; + 053BA461091FE60700A7007A /* parseCert.c in Sources */ = {isa = PBXBuildFile; fileRef = 053BA460091FE60700A7007A /* parseCert.c */; }; + 053BA470091FE6C100A7007A /* fileIo.c in Sources */ = {isa = PBXBuildFile; fileRef = 053BA46E091FE6C100A7007A /* fileIo.c */; }; + 053BA471091FE6C100A7007A /* fileIo.h in Headers */ = {isa = PBXBuildFile; fileRef = 053BA46F091FE6C100A7007A /* fileIo.h */; }; + 053BA47D091FE7CC00A7007A /* libDERUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 053BA47B091FE7CC00A7007A /* libDERUtils.h */; }; + 053BA47E091FE7CC00A7007A /* libDERUtils.c in Sources */ = {isa = PBXBuildFile; fileRef = 053BA47C091FE7CC00A7007A /* libDERUtils.c */; }; + 0544AEA10940939C00DD6C0B /* DER_Encode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0544AE9F0940939C00DD6C0B /* DER_Encode.h */; }; + 0544AEA20940939C00DD6C0B /* DER_Encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 0544AEA00940939C00DD6C0B /* DER_Encode.c */; }; + 058ECC52091FEFF70050AA30 /* libDERUtils.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 053BA46B091FE63E00A7007A /* libDERUtils.a */; }; + 058ECD350920F5E30050AA30 /* DER_Keys.c in Sources */ = {isa = PBXBuildFile; fileRef = 058ECD330920F5E30050AA30 /* DER_Keys.c */; }; + 058ECD360920F5E30050AA30 /* DER_Keys.h in Headers */ = {isa = PBXBuildFile; fileRef = 058ECD340920F5E30050AA30 /* DER_Keys.h */; }; + 058F15C20922B73F009FA1C5 /* printFields.h in Headers */ = {isa = PBXBuildFile; fileRef = 058F15C00922B73F009FA1C5 /* printFields.h */; }; + 058F15C30922B73F009FA1C5 /* printFields.c in Sources */ = {isa = PBXBuildFile; fileRef = 058F15C10922B73F009FA1C5 /* printFields.c */; }; + 058F163109250D16009FA1C5 /* oids.c in Sources */ = {isa = PBXBuildFile; fileRef = 058F162D09250D0D009FA1C5 /* oids.c */; }; + 058F163209250D17009FA1C5 /* oids.h in Headers */ = {isa = PBXBuildFile; fileRef = 058F162E09250D0D009FA1C5 /* oids.h */; }; + 058F1659092513A7009FA1C5 /* parseCrl.c in Sources */ = {isa = PBXBuildFile; fileRef = 058F1658092513A7009FA1C5 /* parseCrl.c */; }; + 058F16710925230E009FA1C5 /* libDER.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 053BA314091C00BF00A7007A /* libDER.a */; }; + 058F16720925230F009FA1C5 /* libDERUtils.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 053BA46B091FE63E00A7007A /* libDERUtils.a */; }; + 05E0E40709228A5E005F4693 /* DER_Digest.h in Headers */ = {isa = PBXBuildFile; fileRef = 05E0E40509228A5E005F4693 /* DER_Digest.h */; }; + 05E0E40809228A5E005F4693 /* DER_Digest.c in Sources */ = {isa = PBXBuildFile; fileRef = 05E0E40609228A5E005F4693 /* DER_Digest.c */; }; + 4C96C8D6113F4165005483E8 /* DER_Ticket.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C96C8D3113F4165005483E8 /* DER_Ticket.c */; }; + 4C96C8D7113F4165005483E8 /* parseTicket.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C96C8D5113F4165005483E8 /* parseTicket.c */; }; + 4C96C8E2113F4232005483E8 /* libDER.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 053BA314091C00BF00A7007A /* libDER.a */; }; + 4C96C8ED113F42D1005483E8 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C96C8EC113F42C4005483E8 /* libcrypto.dylib */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 053BA316091C017E00A7007A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 053BA30A091C00A400A7007A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 053BA313091C00BF00A7007A; + remoteInfo = libDER; + }; + 053BA458091FE59900A7007A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 053BA30A091C00A400A7007A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 053BA313091C00BF00A7007A; + remoteInfo = libDER; + }; + 053BA462091FE60E00A7007A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 053BA30A091C00A400A7007A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 053BA444091FE58C00A7007A; + remoteInfo = parseCert; + }; + 058ECC53091FF0000050AA30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 053BA30A091C00A400A7007A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 053BA46A091FE63E00A7007A; + remoteInfo = libDERUtils; + }; + 058ECC55091FF0090050AA30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 053BA30A091C00A400A7007A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 053BA46A091FE63E00A7007A; + remoteInfo = libDERUtils; + }; + 058F16670925224F009FA1C5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 053BA30A091C00A400A7007A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 058F16530925135E009FA1C5; + remoteInfo = parseCrl; + }; + 058F1675092523D8009FA1C5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 053BA30A091C00A400A7007A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 053BA313091C00BF00A7007A; + remoteInfo = libDER; + }; + 058F1677092523DD009FA1C5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 053BA30A091C00A400A7007A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 053BA46A091FE63E00A7007A; + remoteInfo = libDERUtils; + }; + 4C96C8DB113F4174005483E8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 053BA30A091C00A400A7007A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4C96C8CD113F4132005483E8; + remoteInfo = parseTicket; + }; + 4C96C8E0113F4223005483E8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 053BA30A091C00A400A7007A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 053BA313091C00BF00A7007A; + remoteInfo = libDER; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 053BA314091C00BF00A7007A /* libDER.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libDER.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 053BA321091C02B700A7007A /* DER_Decode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DER_Decode.h; sourceTree = ""; }; + 053BA322091C02B700A7007A /* libDER_config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = libDER_config.h; sourceTree = ""; }; + 053BA323091C02B700A7007A /* libDER.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = libDER.h; sourceTree = ""; }; + 053BA342091C089B00A7007A /* asn1Types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = asn1Types.h; sourceTree = ""; }; + 053BA343091C089B00A7007A /* DER_Decode.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = DER_Decode.c; sourceTree = ""; }; + 053BA397091C258100A7007A /* DER_CertCrl.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = DER_CertCrl.c; sourceTree = ""; }; + 053BA398091C258100A7007A /* DER_CertCrl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DER_CertCrl.h; sourceTree = ""; }; + 053BA445091FE58C00A7007A /* parseCert */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = parseCert; sourceTree = BUILT_PRODUCTS_DIR; }; + 053BA460091FE60700A7007A /* parseCert.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = parseCert.c; sourceTree = ""; }; + 053BA46B091FE63E00A7007A /* libDERUtils.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libDERUtils.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 053BA46E091FE6C100A7007A /* fileIo.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = fileIo.c; sourceTree = ""; }; + 053BA46F091FE6C100A7007A /* fileIo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = fileIo.h; sourceTree = ""; }; + 053BA47B091FE7CC00A7007A /* libDERUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libDERUtils.h; sourceTree = ""; }; + 053BA47C091FE7CC00A7007A /* libDERUtils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = libDERUtils.c; sourceTree = ""; }; + 0544AE9F0940939C00DD6C0B /* DER_Encode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DER_Encode.h; sourceTree = ""; }; + 0544AEA00940939C00DD6C0B /* DER_Encode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DER_Encode.c; sourceTree = ""; }; + 058ECD330920F5E30050AA30 /* DER_Keys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = DER_Keys.c; sourceTree = ""; }; + 058ECD340920F5E30050AA30 /* DER_Keys.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DER_Keys.h; sourceTree = ""; }; + 058ECE5C09211AE40050AA30 /* libGiants.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libGiants.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 058ECE5E09211AFB0050AA30 /* libgRSA.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgRSA.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 058F15C00922B73F009FA1C5 /* printFields.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = printFields.h; sourceTree = ""; }; + 058F15C10922B73F009FA1C5 /* printFields.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = printFields.c; sourceTree = ""; }; + 058F162D09250D0D009FA1C5 /* oids.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = oids.c; sourceTree = ""; }; + 058F162E09250D0D009FA1C5 /* oids.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = oids.h; sourceTree = ""; }; + 058F16540925135E009FA1C5 /* parseCrl */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = parseCrl; sourceTree = BUILT_PRODUCTS_DIR; }; + 058F1658092513A7009FA1C5 /* parseCrl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = parseCrl.c; sourceTree = ""; }; + 05E0E40509228A5E005F4693 /* DER_Digest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DER_Digest.h; sourceTree = ""; }; + 05E0E40609228A5E005F4693 /* DER_Digest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DER_Digest.c; sourceTree = ""; }; + 4C86289E1137D5BE009EAB5A /* iPhoneFamily.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = iPhoneFamily.xcconfig; path = AppleInternal/XcodeConfig/iPhoneFamily.xcconfig; sourceTree = DEVELOPER_DIR; }; + 4C96C8CE113F4132005483E8 /* parseTicket */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = parseTicket; sourceTree = BUILT_PRODUCTS_DIR; }; + 4C96C8D2113F4165005483E8 /* AppleMobilePersonalizedTicket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleMobilePersonalizedTicket.h; sourceTree = ""; }; + 4C96C8D3113F4165005483E8 /* DER_Ticket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DER_Ticket.c; sourceTree = ""; }; + 4C96C8D4113F4165005483E8 /* DER_Ticket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DER_Ticket.h; sourceTree = ""; }; + 4C96C8D5113F4165005483E8 /* parseTicket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = parseTicket.c; sourceTree = ""; }; + 4C96C8EC113F42C4005483E8 /* libcrypto.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcrypto.dylib; path = /usr/lib/libcrypto.dylib; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 053BA312091C00BF00A7007A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 053BA443091FE58C00A7007A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 058ECC52091FEFF70050AA30 /* libDERUtils.a in Frameworks */, + 053BA45D091FE5E700A7007A /* libDER.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 053BA469091FE63E00A7007A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 058F16520925135E009FA1C5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 058F16720925230F009FA1C5 /* libDERUtils.a in Frameworks */, + 058F16710925230E009FA1C5 /* libDER.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4C96C8CC113F4132005483E8 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4C96C8E2113F4232005483E8 /* libDER.a in Frameworks */, + 4C96C8ED113F42D1005483E8 /* libcrypto.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 053BA306091C00A400A7007A = { + isa = PBXGroup; + children = ( + 053BA31E091C029900A7007A /* libDER */, + 053BA466091FE62100A7007A /* libDERUtils */, + 053BA45C091FE5CE00A7007A /* Tests */, + 4C86289E1137D5BE009EAB5A /* iPhoneFamily.xcconfig */, + 058ECE5B09211AB20050AA30 /* External Libs */, + 053BA315091C00BF00A7007A /* Products */, + ); + sourceTree = ""; + }; + 053BA315091C00BF00A7007A /* Products */ = { + isa = PBXGroup; + children = ( + 053BA314091C00BF00A7007A /* libDER.a */, + 053BA445091FE58C00A7007A /* parseCert */, + 053BA46B091FE63E00A7007A /* libDERUtils.a */, + 058F16540925135E009FA1C5 /* parseCrl */, + 4C96C8CE113F4132005483E8 /* parseTicket */, + ); + name = Products; + sourceTree = ""; + }; + 053BA31E091C029900A7007A /* libDER */ = { + isa = PBXGroup; + children = ( + 058ECD330920F5E30050AA30 /* DER_Keys.c */, + 058ECD340920F5E30050AA30 /* DER_Keys.h */, + 053BA342091C089B00A7007A /* asn1Types.h */, + 053BA397091C258100A7007A /* DER_CertCrl.c */, + 053BA398091C258100A7007A /* DER_CertCrl.h */, + 053BA343091C089B00A7007A /* DER_Decode.c */, + 053BA321091C02B700A7007A /* DER_Decode.h */, + 0544AEA00940939C00DD6C0B /* DER_Encode.c */, + 0544AE9F0940939C00DD6C0B /* DER_Encode.h */, + 053BA322091C02B700A7007A /* libDER_config.h */, + 053BA323091C02B700A7007A /* libDER.h */, + 05E0E40509228A5E005F4693 /* DER_Digest.h */, + 05E0E40609228A5E005F4693 /* DER_Digest.c */, + 058F162D09250D0D009FA1C5 /* oids.c */, + 058F162E09250D0D009FA1C5 /* oids.h */, + ); + path = libDER; + sourceTree = ""; + }; + 053BA45C091FE5CE00A7007A /* Tests */ = { + isa = PBXGroup; + children = ( + 4C96C8D2113F4165005483E8 /* AppleMobilePersonalizedTicket.h */, + 4C96C8D3113F4165005483E8 /* DER_Ticket.c */, + 4C96C8D4113F4165005483E8 /* DER_Ticket.h */, + 4C96C8D5113F4165005483E8 /* parseTicket.c */, + 053BA460091FE60700A7007A /* parseCert.c */, + 058F1658092513A7009FA1C5 /* parseCrl.c */, + ); + path = Tests; + sourceTree = ""; + }; + 053BA466091FE62100A7007A /* libDERUtils */ = { + isa = PBXGroup; + children = ( + 053BA47B091FE7CC00A7007A /* libDERUtils.h */, + 053BA47C091FE7CC00A7007A /* libDERUtils.c */, + 053BA46E091FE6C100A7007A /* fileIo.c */, + 053BA46F091FE6C100A7007A /* fileIo.h */, + 058F15C00922B73F009FA1C5 /* printFields.h */, + 058F15C10922B73F009FA1C5 /* printFields.c */, + ); + path = libDERUtils; + sourceTree = ""; + }; + 058ECE5B09211AB20050AA30 /* External Libs */ = { + isa = PBXGroup; + children = ( + 058ECE5E09211AFB0050AA30 /* libgRSA.a */, + 058ECE5C09211AE40050AA30 /* libGiants.a */, + 4C96C8EC113F42C4005483E8 /* libcrypto.dylib */, + ); + name = "External Libs"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 053BA310091C00BF00A7007A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 053BA324091C02B700A7007A /* DER_Decode.h in Headers */, + 053BA325091C02B700A7007A /* libDER_config.h in Headers */, + 053BA326091C02B700A7007A /* libDER.h in Headers */, + 053BA344091C089B00A7007A /* asn1Types.h in Headers */, + 053BA39A091C258100A7007A /* DER_CertCrl.h in Headers */, + 058ECD360920F5E30050AA30 /* DER_Keys.h in Headers */, + 05E0E40709228A5E005F4693 /* DER_Digest.h in Headers */, + 058F163209250D17009FA1C5 /* oids.h in Headers */, + 0544AEA10940939C00DD6C0B /* DER_Encode.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 053BA467091FE63E00A7007A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 053BA471091FE6C100A7007A /* fileIo.h in Headers */, + 053BA47D091FE7CC00A7007A /* libDERUtils.h in Headers */, + 058F15C20922B73F009FA1C5 /* printFields.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 053BA313091C00BF00A7007A /* libDER */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4CD81A5D09BE1FD2000A9641 /* Build configuration list for PBXNativeTarget "libDER" */; + buildPhases = ( + 053BA310091C00BF00A7007A /* Headers */, + 053BA311091C00BF00A7007A /* Sources */, + 053BA312091C00BF00A7007A /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = libDER; + productName = libDER; + productReference = 053BA314091C00BF00A7007A /* libDER.a */; + productType = "com.apple.product-type.library.static"; + }; + 053BA444091FE58C00A7007A /* parseCert */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4CD81A6509BE1FD2000A9641 /* Build configuration list for PBXNativeTarget "parseCert" */; + buildPhases = ( + 053BA442091FE58C00A7007A /* Sources */, + 053BA443091FE58C00A7007A /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 053BA459091FE59900A7007A /* PBXTargetDependency */, + 058ECC56091FF0090050AA30 /* PBXTargetDependency */, + ); + name = parseCert; + productName = parseCert; + productReference = 053BA445091FE58C00A7007A /* parseCert */; + productType = "com.apple.product-type.tool"; + }; + 053BA46A091FE63E00A7007A /* libDERUtils */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4CD81A6109BE1FD2000A9641 /* Build configuration list for PBXNativeTarget "libDERUtils" */; + buildPhases = ( + 053BA467091FE63E00A7007A /* Headers */, + 053BA468091FE63E00A7007A /* Sources */, + 053BA469091FE63E00A7007A /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = libDERUtils; + productName = libDERUtils; + productReference = 053BA46B091FE63E00A7007A /* libDERUtils.a */; + productType = "com.apple.product-type.library.static"; + }; + 058F16530925135E009FA1C5 /* parseCrl */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4CD81A6909BE1FD2000A9641 /* Build configuration list for PBXNativeTarget "parseCrl" */; + buildPhases = ( + 058F16510925135E009FA1C5 /* Sources */, + 058F16520925135E009FA1C5 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 058F1676092523D8009FA1C5 /* PBXTargetDependency */, + 058F1678092523DD009FA1C5 /* PBXTargetDependency */, + ); + name = parseCrl; + productName = parseCrl; + productReference = 058F16540925135E009FA1C5 /* parseCrl */; + productType = "com.apple.product-type.tool"; + }; + 4C96C8CD113F4132005483E8 /* parseTicket */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4C96C8D8113F4165005483E8 /* Build configuration list for PBXNativeTarget "parseTicket" */; + buildPhases = ( + 4C96C8CB113F4132005483E8 /* Sources */, + 4C96C8CC113F4132005483E8 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 4C96C8E1113F4223005483E8 /* PBXTargetDependency */, + ); + name = parseTicket; + productName = parseTicket; + productReference = 4C96C8CE113F4132005483E8 /* parseTicket */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 053BA30A091C00A400A7007A /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 4CD81A7109BE1FD2000A9641 /* Build configuration list for PBXProject "libDER" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 053BA306091C00A400A7007A; + productRefGroup = 053BA315091C00BF00A7007A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 053BA30F091C00B100A7007A /* World */, + 053BA313091C00BF00A7007A /* libDER */, + 053BA444091FE58C00A7007A /* parseCert */, + 053BA46A091FE63E00A7007A /* libDERUtils */, + 058F16530925135E009FA1C5 /* parseCrl */, + 4C96C8CD113F4132005483E8 /* parseTicket */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 053BA311091C00BF00A7007A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 053BA345091C089B00A7007A /* DER_Decode.c in Sources */, + 053BA399091C258100A7007A /* DER_CertCrl.c in Sources */, + 058ECD350920F5E30050AA30 /* DER_Keys.c in Sources */, + 05E0E40809228A5E005F4693 /* DER_Digest.c in Sources */, + 058F163109250D16009FA1C5 /* oids.c in Sources */, + 0544AEA20940939C00DD6C0B /* DER_Encode.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 053BA442091FE58C00A7007A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 053BA461091FE60700A7007A /* parseCert.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 053BA468091FE63E00A7007A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 053BA470091FE6C100A7007A /* fileIo.c in Sources */, + 053BA47E091FE7CC00A7007A /* libDERUtils.c in Sources */, + 058F15C30922B73F009FA1C5 /* printFields.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 058F16510925135E009FA1C5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 058F1659092513A7009FA1C5 /* parseCrl.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4C96C8CB113F4132005483E8 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4C96C8D6113F4165005483E8 /* DER_Ticket.c in Sources */, + 4C96C8D7113F4165005483E8 /* parseTicket.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 053BA317091C017E00A7007A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 053BA313091C00BF00A7007A /* libDER */; + targetProxy = 053BA316091C017E00A7007A /* PBXContainerItemProxy */; + }; + 053BA459091FE59900A7007A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 053BA313091C00BF00A7007A /* libDER */; + targetProxy = 053BA458091FE59900A7007A /* PBXContainerItemProxy */; + }; + 053BA463091FE60E00A7007A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 053BA444091FE58C00A7007A /* parseCert */; + targetProxy = 053BA462091FE60E00A7007A /* PBXContainerItemProxy */; + }; + 058ECC54091FF0000050AA30 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 053BA46A091FE63E00A7007A /* libDERUtils */; + targetProxy = 058ECC53091FF0000050AA30 /* PBXContainerItemProxy */; + }; + 058ECC56091FF0090050AA30 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 053BA46A091FE63E00A7007A /* libDERUtils */; + targetProxy = 058ECC55091FF0090050AA30 /* PBXContainerItemProxy */; + }; + 058F16680925224F009FA1C5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 058F16530925135E009FA1C5 /* parseCrl */; + targetProxy = 058F16670925224F009FA1C5 /* PBXContainerItemProxy */; + }; + 058F1676092523D8009FA1C5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 053BA313091C00BF00A7007A /* libDER */; + targetProxy = 058F1675092523D8009FA1C5 /* PBXContainerItemProxy */; + }; + 058F1678092523DD009FA1C5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 053BA46A091FE63E00A7007A /* libDERUtils */; + targetProxy = 058F1677092523DD009FA1C5 /* PBXContainerItemProxy */; + }; + 4C96C8DC113F4174005483E8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4C96C8CD113F4132005483E8 /* parseTicket */; + targetProxy = 4C96C8DB113F4174005483E8 /* PBXContainerItemProxy */; + }; + 4C96C8E1113F4223005483E8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 053BA313091C00BF00A7007A /* libDER */; + targetProxy = 4C96C8E0113F4223005483E8 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 4C96C8D0113F4132005483E8 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = parseTicket; + }; + name = Debug; + }; + 4C96C8D1113F4132005483E8 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = parseTicket; + }; + name = Release; + }; + 792E01120CBC0CE3007C00A0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INSTALL_PATH = "$(INDIGO_INSTALL_PATH_PREFIX)/usr/local/lib"; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = DER; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 792E01130CBC0CE3007C00A0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + INSTALL_PATH = "$(INDIGO_INSTALL_PATH_PREFIX)/usr/local/lib"; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = DER; + SKIP_INSTALL = YES; + }; + name = Release; + }; + 792E01140CBC0CE3007C00A0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = DERUtils; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 792E01150CBC0CE3007C00A0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = DERUtils; + SKIP_INSTALL = YES; + }; + name = Release; + }; + 792E01160CBC0CE3007C00A0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = parseCert; + }; + name = Debug; + }; + 792E01170CBC0CE3007C00A0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = parseCert; + }; + name = Release; + }; + 792E01180CBC0CE3007C00A0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = parseCrl; + }; + name = Debug; + }; + 792E01190CBC0CE3007C00A0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = parseCrl; + }; + name = Release; + }; + 792E011A0CBC0CE3007C00A0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + OTHER_CFLAGS = "-DNDEBUG"; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = World; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Debug; + }; + 792E011B0CBC0CE3007C00A0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = World; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Release; + }; + 792E011C0CBC0CE3007C00A0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4C86289E1137D5BE009EAB5A /* iPhoneFamily.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_OPTIMIZATION_LEVEL = 1; + GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_VALUE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)", + "$(SRCROOT)/libDER", + ); + "HEADER_SEARCH_PATHS[sdk=macosx*][arch=*]" = ( + "$(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers", + "$(HEADER_SEARCH_PATHS)", + ); + OTHER_CFLAGS = ( + "-fconstant-cfstrings", + "-fno-inline", + ); + SDKROOT = iphoneos.internal; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + WARNING_CFLAGS = ( + "-Wall", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + ); + }; + name = Debug; + }; + 792E011D0CBC0CE3007C00A0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4C86289E1137D5BE009EAB5A /* iPhoneFamily.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_OPTIMIZATION_LEVEL = s; + GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_VALUE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)", + "$(SRCROOT)/libDER", + ); + "HEADER_SEARCH_PATHS[sdk=macosx*][arch=*]" = ( + "$(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers", + "$(HEADER_SEARCH_PATHS)", + ); + OTHER_CFLAGS = "-fconstant-cfstrings"; + SDKROOT = iphoneos.internal; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + WARNING_CFLAGS = ( + "-Wall", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + ); + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 4C96C8D8113F4165005483E8 /* Build configuration list for PBXNativeTarget "parseTicket" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4C96C8D0113F4132005483E8 /* Debug */, + 4C96C8D1113F4132005483E8 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4CD81A5D09BE1FD2000A9641 /* Build configuration list for PBXNativeTarget "libDER" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 792E01120CBC0CE3007C00A0 /* Debug */, + 792E01130CBC0CE3007C00A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4CD81A6109BE1FD2000A9641 /* Build configuration list for PBXNativeTarget "libDERUtils" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 792E01140CBC0CE3007C00A0 /* Debug */, + 792E01150CBC0CE3007C00A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4CD81A6509BE1FD2000A9641 /* Build configuration list for PBXNativeTarget "parseCert" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 792E01160CBC0CE3007C00A0 /* Debug */, + 792E01170CBC0CE3007C00A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4CD81A6909BE1FD2000A9641 /* Build configuration list for PBXNativeTarget "parseCrl" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 792E01180CBC0CE3007C00A0 /* Debug */, + 792E01190CBC0CE3007C00A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4CD81A6D09BE1FD2000A9641 /* Build configuration list for PBXAggregateTarget "World" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 792E011A0CBC0CE3007C00A0 /* Debug */, + 792E011B0CBC0CE3007C00A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4CD81A7109BE1FD2000A9641 /* Build configuration list for PBXProject "libDER" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 792E011C0CBC0CE3007C00A0 /* Debug */, + 792E011D0CBC0CE3007C00A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 053BA30A091C00A400A7007A /* Project object */; +} ADDED Source/libDER/libDER/DER_CertCrl.c Index: Source/libDER/libDER/DER_CertCrl.c ================================================================== --- /dev/null +++ Source/libDER/libDER/DER_CertCrl.c @@ -0,0 +1,319 @@ +/* Copyright (c) 2005-2009 Apple Inc. All Rights Reserved. */ + +/* + * DER_Cert.c - support for decoding X509 certificates + * + * Created Nov. 4 2005 by Doug Mitchell. + */ + +#include "DER_Decode.h" +#include "DER_CertCrl.h" +#include "asn1Types.h" + +/* + * DERItemSpecs for X509 certificates. + */ + +/* top level cert with three components */ +const DERItemSpec DERSignedCertCrlItemSpecs[] = +{ + { DER_OFFSET(DERSignedCertCrl, tbs), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS | DER_DEC_SAVE_DER}, + { DER_OFFSET(DERSignedCertCrl, sigAlg), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERSignedCertCrl, sig), + ASN1_BIT_STRING, + DER_DEC_NO_OPTS } +}; + +const DERSize DERNumSignedCertCrlItemSpecs = + sizeof(DERSignedCertCrlItemSpecs) / sizeof(DERItemSpec); + +/* TBS cert */ +const DERItemSpec DERTBSCertItemSpecs[] = +{ + { DER_OFFSET(DERTBSCert, version), + ASN1_CONSTRUCTED | ASN1_CONTEXT_SPECIFIC | 0, + DER_DEC_OPTIONAL }, /* version - EXPLICIT */ + { DER_OFFSET(DERTBSCert, serialNum), + ASN1_INTEGER, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERTBSCert, tbsSigAlg), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERTBSCert, issuer), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERTBSCert, validity), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERTBSCert, subject), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERTBSCert, subjectPubKey), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS }, + /* libsecurity_asn1 has these two as CONSTRUCTED, but the ASN.1 spec + * doesn't look that way to me. I don't have any certs that have these + * fields.... */ + { DER_OFFSET(DERTBSCert, issuerID), + ASN1_CONTEXT_SPECIFIC | 1, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERTBSCert, subjectID), + ASN1_CONTEXT_SPECIFIC | 2, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERTBSCert, extensions), + ASN1_CONSTRUCTED | ASN1_CONTEXT_SPECIFIC | 3, + DER_DEC_OPTIONAL } +}; +const DERSize DERNumTBSCertItemSpecs = sizeof(DERTBSCertItemSpecs) / sizeof(DERItemSpec); + +/* DERValidity */ +const DERItemSpec DERValidityItemSpecs[] = +{ + { DER_OFFSET(DERValidity, notBefore), + 0, /* no tag - ANY */ + DER_DEC_ASN_ANY | DER_DEC_SAVE_DER }, + { DER_OFFSET(DERValidity, notAfter), + 0, /* no tag - ANY */ + DER_DEC_ASN_ANY | DER_DEC_SAVE_DER } +}; +const DERSize DERNumValidityItemSpecs = + sizeof(DERValidityItemSpecs) / sizeof(DERItemSpec); + +/* DERAttributeTypeAndValue */ +const DERItemSpec DERAttributeTypeAndValueItemSpecs[] = { + { DER_OFFSET(DERAttributeTypeAndValue, type), + ASN1_OBJECT_ID, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERAttributeTypeAndValue, value), + 0, /* no tag - ANY */ + DER_DEC_ASN_ANY | DER_DEC_SAVE_DER } +}; + +const DERSize DERNumAttributeTypeAndValueItemSpecs = + sizeof(DERAttributeTypeAndValueItemSpecs) / sizeof(DERItemSpec); + +/* DERExtension */ +const DERItemSpec DERExtensionItemSpecs[] = +{ + { DER_OFFSET(DERExtension, extnID), + ASN1_OBJECT_ID, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERExtension, critical), + ASN1_BOOLEAN, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERExtension, extnValue), + ASN1_OCTET_STRING, + DER_DEC_NO_OPTS } +}; +const DERSize DERNumExtensionItemSpecs = + sizeof(DERExtensionItemSpecs) / sizeof(DERItemSpec); + +/* DERBasicConstraints */ +const DERItemSpec DERBasicConstraintsItemSpecs[] = +{ + { DER_OFFSET(DERBasicConstraints, cA), + ASN1_BOOLEAN, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERBasicConstraints, pathLenConstraint), + ASN1_INTEGER, + DER_DEC_OPTIONAL } +}; +const DERSize DERNumBasicConstraintsItemSpecs = + sizeof(DERBasicConstraintsItemSpecs) / sizeof(DERItemSpec); + +/* DERPrivateKeyUsagePeriod. */ +const DERItemSpec DERPrivateKeyUsagePeriodItemSpecs[] = +{ + { DER_OFFSET(DERPrivateKeyUsagePeriod, notBefore), + ASN1_CONTEXT_SPECIFIC | 0, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERPrivateKeyUsagePeriod, notAfter), + ASN1_CONTEXT_SPECIFIC | 1, + DER_DEC_OPTIONAL } +}; +const DERSize DERNumPrivateKeyUsagePeriodItemSpecs = + sizeof(DERPrivateKeyUsagePeriodItemSpecs) / sizeof(DERItemSpec); + +/* DERDistributionPoint. */ +const DERItemSpec DERDistributionPointItemSpecs[] = +{ + { DER_OFFSET(DERDistributionPoint, distributionPoint), + ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | 0, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERDistributionPoint, reasons), + ASN1_CONTEXT_SPECIFIC | 1, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERDistributionPoint, cRLIssuer), + ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | 2, + DER_DEC_OPTIONAL } +}; +const DERSize DERNumDistributionPointItemSpecs = + sizeof(DERDistributionPointItemSpecs) / sizeof(DERItemSpec); + +/* DERPolicyInformation. */ +const DERItemSpec DERPolicyInformationItemSpecs[] = +{ + { DER_OFFSET(DERPolicyInformation, policyIdentifier), + ASN1_OBJECT_ID, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERPolicyInformation, policyQualifiers), + ASN1_CONSTR_SEQUENCE, + DER_DEC_OPTIONAL } +}; +const DERSize DERNumPolicyInformationItemSpecs = + sizeof(DERPolicyInformationItemSpecs) / sizeof(DERItemSpec); + +/* DERPolicyQualifierInfo. */ +const DERItemSpec DERPolicyQualifierInfoItemSpecs[] = +{ + { DER_OFFSET(DERPolicyQualifierInfo, policyQualifierID), + ASN1_OBJECT_ID, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERPolicyQualifierInfo, qualifier), + 0, /* no tag - ANY */ + DER_DEC_ASN_ANY | DER_DEC_SAVE_DER } +}; +const DERSize DERNumPolicyQualifierInfoItemSpecs = + sizeof(DERPolicyQualifierInfoItemSpecs) / sizeof(DERItemSpec); + +/* DERUserNotice. */ +const DERItemSpec DERUserNoticeItemSpecs[] = +{ + { DER_OFFSET(DERUserNotice, noticeRef), + ASN1_CONSTR_SEQUENCE, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERUserNotice, explicitText), + 0, /* no tag - ANY */ + DER_DEC_ASN_ANY | DER_DEC_OPTIONAL | DER_DEC_SAVE_DER } +}; +const DERSize DERNumUserNoticeItemSpecs = + sizeof(DERUserNoticeItemSpecs) / sizeof(DERItemSpec); + +/* DERNoticeReference. */ +const DERItemSpec DERNoticeReferenceItemSpecs[] = +{ + { DER_OFFSET(DERNoticeReference, organization), + 0, /* no tag - ANY */ + DER_DEC_ASN_ANY | DER_DEC_SAVE_DER }, + { DER_OFFSET(DERNoticeReference, noticeNumbers), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS } +}; +const DERSize DERNumNoticeReferenceItemSpecs = + sizeof(DERNoticeReferenceItemSpecs) / sizeof(DERItemSpec); + +/* DERPolicyMapping. */ +const DERItemSpec DERPolicyMappingItemSpecs[] = +{ + { DER_OFFSET(DERPolicyMapping, issuerDomainPolicy), + ASN1_OBJECT_ID, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERPolicyMapping, subjectDomainPolicy), + ASN1_OBJECT_ID, + DER_DEC_NO_OPTS } +}; +const DERSize DERNumPolicyMappingItemSpecs = + sizeof(DERPolicyMappingItemSpecs) / sizeof(DERItemSpec); + +/* DERAccessDescription. */ +const DERItemSpec DERAccessDescriptionItemSpecs[] = +{ + { DER_OFFSET(DERAccessDescription, accessMethod), + ASN1_OBJECT_ID, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERAccessDescription, accessLocation), + 0, /* no tag - ANY */ + DER_DEC_ASN_ANY | DER_DEC_SAVE_DER } +}; +const DERSize DERNumAccessDescriptionItemSpecs = + sizeof(DERAccessDescriptionItemSpecs) / sizeof(DERItemSpec); + +/* DERAuthorityKeyIdentifier. */ +const DERItemSpec DERAuthorityKeyIdentifierItemSpecs[] = +{ + { DER_OFFSET(DERAuthorityKeyIdentifier, keyIdentifier), + ASN1_CONTEXT_SPECIFIC | 0, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERAuthorityKeyIdentifier, authorityCertIssuer), + ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | 1, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERAuthorityKeyIdentifier, authorityCertSerialNumber), + ASN1_CONTEXT_SPECIFIC | 2, + DER_DEC_OPTIONAL } +}; +const DERSize DERNumAuthorityKeyIdentifierItemSpecs = + sizeof(DERAuthorityKeyIdentifierItemSpecs) / sizeof(DERItemSpec); + +/* DEROtherName. */ +const DERItemSpec DEROtherNameItemSpecs[] = +{ + { DER_OFFSET(DEROtherName, typeIdentifier), + ASN1_OBJECT_ID, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DEROtherName, value), + ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | 0, + DER_DEC_NO_OPTS }, +}; +const DERSize DERNumOtherNameItemSpecs = + sizeof(DEROtherNameItemSpecs) / sizeof(DERItemSpec); + +/* DERPolicyConstraints. */ +const DERItemSpec DERPolicyConstraintsItemSpecs[] = +{ + { DER_OFFSET(DERPolicyConstraints, requireExplicitPolicy), + ASN1_CONTEXT_SPECIFIC | 0, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERPolicyConstraints, inhibitPolicyMapping), + ASN1_CONTEXT_SPECIFIC | 1, + DER_DEC_OPTIONAL } +}; +const DERSize DERNumPolicyConstraintsItemSpecs = + sizeof(DERPolicyConstraintsItemSpecs) / sizeof(DERItemSpec); + +/* DERTBSCrl */ +const DERItemSpec DERTBSCrlItemSpecs[] = +{ + { DER_OFFSET(DERTBSCrl, version), + ASN1_INTEGER, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERTBSCrl, tbsSigAlg), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERTBSCrl, issuer), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERTBSCrl, thisUpdate), + 0, /* no tag - ANY */ + DER_DEC_ASN_ANY | DER_DEC_SAVE_DER }, + { DER_OFFSET(DERTBSCrl, nextUpdate), + 0, /* no tag - ANY */ + DER_DEC_ASN_ANY | DER_DEC_SAVE_DER }, + { DER_OFFSET(DERTBSCrl, revokedCerts), + ASN1_CONSTR_SEQUENCE, + DER_DEC_OPTIONAL }, + { DER_OFFSET(DERTBSCrl, extensions), + ASN1_CONSTRUCTED | ASN1_CONTEXT_SPECIFIC | 0, + DER_DEC_OPTIONAL } +}; +const DERSize DERNumTBSCrlItemSpecs = sizeof(DERTBSCrlItemSpecs) / sizeof(DERItemSpec); + +/* DERRevokedCert */ +const DERItemSpec DERRevokedCertItemSpecs[] = +{ + { DER_OFFSET(DERRevokedCert, serialNum), + ASN1_INTEGER, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERRevokedCert, revocationDate), + 0, /* no tag - ANY */ + DER_DEC_ASN_ANY | DER_DEC_SAVE_DER }, + { DER_OFFSET(DERRevokedCert, extensions), + ASN1_CONSTR_SEQUENCE, + DER_DEC_OPTIONAL } +}; + +const DERSize DERNumRevokedCertItemSpecs = + sizeof(DERRevokedCertItemSpecs) / sizeof(DERItemSpec); ADDED Source/libDER/libDER/DER_CertCrl.h Index: Source/libDER/libDER/DER_CertCrl.h ================================================================== --- /dev/null +++ Source/libDER/libDER/DER_CertCrl.h @@ -0,0 +1,237 @@ +/* Copyright (c) 2005-2009 Apple Inc. All Rights Reserved. */ + +/* + * DER_CertCrl.h - support for decoding X509 certificates and CRLs + * + * Created Nov. 4 2005 by dmitch + */ + +#ifndef _DER_CERT_CRL_H_ +#define _DER_CERT_CRL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "libDER.h" +#include "DER_Decode.h" + +/* + * Top level cert or CRL - the two are identical at this level - three + * components. The tbs field is saved in full DER form for sig verify. + */ +typedef struct { + DERItem tbs; /* sequence, DERTBSCert, DER_DEC_SAVE_DER */ + DERItem sigAlg; /* sequence, DERAlgorithmId */ + DERItem sig; /* bit string */ +} DERSignedCertCrl; + +/* DERItemSpecs to decode into a DERSignedCertCrl */ +extern const DERItemSpec DERSignedCertCrlItemSpecs[]; +extern const DERSize DERNumSignedCertCrlItemSpecs; + +/* TBS cert components */ +typedef struct { + DERItem version; /* integer, optional, EXPLICIT */ + DERItem serialNum; /* integer */ + DERItem tbsSigAlg; /* sequence, DERAlgorithmId */ + DERItem issuer; /* sequence, TBD */ + DERItem validity; /* sequence, DERValidity */ + DERItem subject; /* sequence, TBD */ + DERItem subjectPubKey; /* sequence, DERSubjPubKeyInfo */ + DERItem issuerID; /* bit string, optional */ + DERItem subjectID; /* bit string, optional */ + DERItem extensions; /* sequence, optional, EXPLICIT */ +} DERTBSCert; + +/* DERItemSpecs to decode into a DERTBSCert */ +extern const DERItemSpec DERTBSCertItemSpecs[]; +extern const DERSize DERNumTBSCertItemSpecs; + +/* + * validity - components can be either UTC or generalized time. + * Both are ASN_ANY with DER_DEC_SAVE_DER. + */ +typedef struct { + DERItem notBefore; + DERItem notAfter; +} DERValidity; + +/* DERItemSpecs to decode into a DERValidity */ +extern const DERItemSpec DERValidityItemSpecs[]; +extern const DERSize DERNumValidityItemSpecs; + +/* AttributeTypeAndValue components. */ +typedef struct { + DERItem type; + DERItem value; +} DERAttributeTypeAndValue; + +/* DERItemSpecs to decode into DERAttributeTypeAndValue */ +extern const DERItemSpec DERAttributeTypeAndValueItemSpecs[]; +extern const DERSize DERNumAttributeTypeAndValueItemSpecs; + +/* Extension components */ +typedef struct { + DERItem extnID; + DERItem critical; + DERItem extnValue; +} DERExtension; + +/* DERItemSpecs to decode into DERExtension */ +extern const DERItemSpec DERExtensionItemSpecs[]; +extern const DERSize DERNumExtensionItemSpecs; + +/* BasicConstraints components. */ +typedef struct { + DERItem cA; + DERItem pathLenConstraint; +} DERBasicConstraints; + +/* DERItemSpecs to decode into DERBasicConstraints */ +extern const DERItemSpec DERBasicConstraintsItemSpecs[]; +extern const DERSize DERNumBasicConstraintsItemSpecs; + +/* PrivateKeyUsagePeriod components. */ +typedef struct { + DERItem notBefore; + DERItem notAfter; +} DERPrivateKeyUsagePeriod; + +/* DERItemSpecs to decode into a DERPrivateKeyUsagePeriod */ +extern const DERItemSpec DERPrivateKeyUsagePeriodItemSpecs[]; +extern const DERSize DERNumPrivateKeyUsagePeriodItemSpecs; + +/* DistributionPoint components. */ +typedef struct { + DERItem distributionPoint; + DERItem reasons; + DERItem cRLIssuer; +} DERDistributionPoint; + +/* DERItemSpecs to decode into a DERDistributionPoint */ +extern const DERItemSpec DERDistributionPointItemSpecs[]; +extern const DERSize DERNumDistributionPointItemSpecs; + +/* PolicyInformation components. */ +typedef struct { + DERItem policyIdentifier; + DERItem policyQualifiers; +} DERPolicyInformation; + +/* DERItemSpecs to decode into a DERPolicyInformation */ +extern const DERItemSpec DERPolicyInformationItemSpecs[]; +extern const DERSize DERNumPolicyInformationItemSpecs; + +/* PolicyQualifierInfo components. */ +typedef struct { + DERItem policyQualifierID; + DERItem qualifier; +} DERPolicyQualifierInfo; + +/* DERItemSpecs to decode into a DERPolicyQualifierInfo */ +extern const DERItemSpec DERPolicyQualifierInfoItemSpecs[]; +extern const DERSize DERNumPolicyQualifierInfoItemSpecs; + +/* UserNotice components. */ +typedef struct { + DERItem noticeRef; + DERItem explicitText; +} DERUserNotice; + +/* DERItemSpecs to decode into a DERUserNotice */ +extern const DERItemSpec DERUserNoticeItemSpecs[]; +extern const DERSize DERNumUserNoticeItemSpecs; + +/* NoticeReference components. */ +typedef struct { + DERItem organization; + DERItem noticeNumbers; +} DERNoticeReference; + +/* DERItemSpecs to decode into a DERNoticeReference */ +extern const DERItemSpec DERNoticeReferenceItemSpecs[]; +extern const DERSize DERNumNoticeReferenceItemSpecs; + +/* PolicyMapping components. */ +typedef struct { + DERItem issuerDomainPolicy; + DERItem subjectDomainPolicy; +} DERPolicyMapping; + +/* DERItemSpecs to decode into a DERPolicyMapping */ +extern const DERItemSpec DERPolicyMappingItemSpecs[]; +extern const DERSize DERNumPolicyMappingItemSpecs; + +/* AccessDescription components. */ +typedef struct { + DERItem accessMethod; + DERItem accessLocation; +} DERAccessDescription; + +/* DERItemSpecs to decode into a DERAccessDescription */ +extern const DERItemSpec DERAccessDescriptionItemSpecs[]; +extern const DERSize DERNumAccessDescriptionItemSpecs; + +/* AuthorityKeyIdentifier components. */ +typedef struct { + DERItem keyIdentifier; + DERItem authorityCertIssuer; + DERItem authorityCertSerialNumber; +} DERAuthorityKeyIdentifier; + +/* DERItemSpecs to decode into a DERAuthorityKeyIdentifier */ +extern const DERItemSpec DERAuthorityKeyIdentifierItemSpecs[]; +extern const DERSize DERNumAuthorityKeyIdentifierItemSpecs; + +/* OtherName components. */ +typedef struct { + DERItem typeIdentifier; + DERItem value; +} DEROtherName; + +/* DERItemSpecs to decode into a DEROtherName */ +extern const DERItemSpec DEROtherNameItemSpecs[]; +extern const DERSize DERNumOtherNameItemSpecs; + +/* PolicyConstraints components. */ +typedef struct { + DERItem requireExplicitPolicy; + DERItem inhibitPolicyMapping; +} DERPolicyConstraints; + +/* DERItemSpecs to decode into a DERPolicyConstraints */ +extern const DERItemSpec DERPolicyConstraintsItemSpecs[]; +extern const DERSize DERNumPolicyConstraintsItemSpecs; + +/* TBS CRL */ +typedef struct { + DERItem version; /* integer, optional */ + DERItem tbsSigAlg; /* sequence, DERAlgorithmId */ + DERItem issuer; /* sequence, TBD */ + DERItem thisUpdate; /* ASN_ANY, SAVE_DER */ + DERItem nextUpdate; /* ASN_ANY, SAVE_DER */ + DERItem revokedCerts; /* sequence of DERRevokedCert, optional */ + DERItem extensions; /* sequence, optional, EXPLICIT */ +} DERTBSCrl; + +/* DERItemSpecs to decode into a DERTBSCrl */ +extern const DERItemSpec DERTBSCrlItemSpecs[]; +extern const DERSize DERNumTBSCrlItemSpecs; + +typedef struct { + DERItem serialNum; /* integer */ + DERItem revocationDate; /* time - ASN_ANY, SAVE_DER */ + DERItem extensions; /* sequence, optional, EXPLICIT */ +} DERRevokedCert; + +/* DERItemSpecs to decode into a DERRevokedCert */ +extern const DERItemSpec DERRevokedCertItemSpecs[]; +extern const DERSize DERNumRevokedCertItemSpecs; + +#ifdef __cplusplus +} +#endif + +#endif /* _DER_CERT_CRL_H_ */ + ADDED Source/libDER/libDER/DER_Decode.c Index: Source/libDER/libDER/DER_Decode.c ================================================================== --- /dev/null +++ Source/libDER/libDER/DER_Decode.c @@ -0,0 +1,584 @@ +/* + * Copyright (c) 2005-2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * DER_Decode.c - DER decoding routines + */ + +#include "DER_Decode.h" +#include "asn1Types.h" + +#include "libDER_config.h" + +#ifndef DER_DECODE_ENABLE +#error Please define DER_DECODE_ENABLE. +#endif + +#if DER_DECODE_ENABLE + +#define DER_DECODE_DEBUG 0 +#if DER_DECODE_DEBUG +#include +#define derDecDbg(a) printf(a) +#define derDecDbg1(a, b) printf(a, b) +#define derDecDbg2(a, b, c) printf(a, b, c) +#define derDecDbg3(a, b, c, d) printf(a, b, c, d) +#else +#define derDecDbg(a) +#define derDecDbg1(a, b) +#define derDecDbg2(a, b, c) +#define derDecDbg3(a, b, c, d) +#endif /* DER_DECODE_DEBUG */ + +/* + * Basic decoding primitive. Only works with: + * + * -- definite length encoding + * -- one-byte tags + * -- max content length fits in a DERSize + * + * No malloc or copy of the contents is performed; the returned + * content->content.data is a pointer into the incoming der data. + */ +DERReturn DERDecodeItem( + const DERItem *der, /* data to decode */ + DERDecodedInfo *decoded) /* RETURNED */ +{ + DERByte tag1; /* first tag byte */ + DERByte len1; /* first length byte */ + DERTag tagNumber; /* tag number without class and method bits */ + DERByte *derPtr = der->data; + DERSize derLen = der->length; + + /* The tag decoding below is fully BER complient. We support a max tag + value of 2 ^ ((sizeof(DERTag) * 8) - 3) - 1 so for tag size 1 byte we + support tag values from 0 - 0x1F. For tag size 2 tag values + from 0 - 0x1FFF and for tag size 4 values from 0 - 0x1FFFFFFF. */ + if(derLen < 2) { + return DR_DecodeError; + } + /* Grab the first byte of the tag. */ + tag1 = *derPtr++; + derLen--; + tagNumber = tag1 & 0x1F; + if(tagNumber == 0x1F) { +#ifdef DER_MULTIBYTE_TAGS + /* Long tag form: bit 8 of each octet shall be set to one unless it is + the last octet of the tag */ + const DERTag overflowMask = ((DERTag)0x7F << (sizeof(DERTag) * 8 - 7)); + DERByte tagByte; + tagNumber = 0; + do { + if(derLen < 2 || (tagNumber & overflowMask) != 0) { + return DR_DecodeError; + } + tagByte = *derPtr++; + derLen--; + tagNumber = (tagNumber << 7) | (tagByte & 0x7F); + } while((tagByte & 0x80) != 0); + + /* Check for any of the top 3 reserved bits being set. */ + if ((tagNumber & (overflowMask << 4)) != 0) +#endif + return DR_DecodeError; + } + /* Returned tag, top 3 bits are class/method remaining bits are number. */ + decoded->tag = ((DERTag)(tag1 & 0xE0) << ((sizeof(DERTag) - 1) * 8)) | tagNumber; + + /* Tag decoding above ensured we have at least one more input byte left. */ + len1 = *derPtr++; + derLen--; + if(len1 & 0x80) { + /* long length form - first byte is length of length */ + DERSize longLen = 0; /* long form length */ + unsigned dex; + + len1 &= 0x7f; + if((len1 > sizeof(DERSize)) || (len1 > derLen)) { + /* no can do */ + return DR_DecodeError; + } + for(dex=0; dex derLen) { + /* not enough data left for this encoding */ + return DR_DecodeError; + } + decoded->content.data = derPtr; + decoded->content.length = longLen; + } + else { + /* short length form, len1 is the length */ + if(len1 > derLen) { + /* not enough data left for this encoding */ + return DR_DecodeError; + } + decoded->content.data = derPtr; + decoded->content.length = len1; + } + + return DR_Success; +} + +/* + * Given a BIT_STRING, in the form of its raw content bytes, + * obtain the number of unused bits and the raw bit string bytes. + */ +DERReturn DERParseBitString( + const DERItem *contents, + DERItem *bitStringBytes, /* RETURNED */ + DERByte *numUnusedBits) /* RETURNED */ +{ + if(contents->length < 2) { + /* not enough room for actual bits after the unused bits field */ + *numUnusedBits = 0; + bitStringBytes->data = NULL; + bitStringBytes->length = 0; + return DR_Success; + } + *numUnusedBits = contents->data[0]; + bitStringBytes->data = contents->data + 1; + bitStringBytes->length = contents->length - 1; + return DR_Success; +} + +/* + * Given a BOOLEAN, in the form of its raw content bytes, + * obtain it's value. + */ +DERReturn DERParseBoolean( + const DERItem *contents, + bool defaultValue, + bool *value) { /* RETURNED */ + if (contents->length == 0) { + *value = defaultValue; + return DR_Success; + } + if (contents->length != 1 || + (contents->data[0] != 0 && contents->data[0] != 0xFF)) + return DR_DecodeError; + + *value = contents->data[0] != 0; + return DR_Success; +} + +DERReturn DERParseInteger( + const DERItem *contents, + uint32_t *result) { /* RETURNED */ + DERSize ix, length = contents->length; + if (length > 4) + return DR_BufOverflow; + uint32_t value = 0; + for (ix = 0; ix < length; ++ix) { + value <<= 8; + value += contents->data[ix]; + } + *result = value; + return DR_Success; +} + +/* Sequence/set support */ + +/* + * To decode a set or sequence, call DERDecodeSeqInit once, then + * call DERDecodeSeqNext to get each enclosed item. + * DERDecodeSeqNext returns DR_EndOfSequence when no more + * items are available. + */ +DERReturn DERDecodeSeqInit( + const DERItem *der, /* data to decode */ + DERTag *tag, /* RETURNED tag of sequence/set. This will be + * either ASN1_CONSTR_SEQUENCE or ASN1_CONSTR_SET. */ + DERSequence *derSeq) /* RETURNED, to use in DERDecodeSeqNext */ +{ + DERDecodedInfo decoded; + DERReturn drtn; + + drtn = DERDecodeItem(der, &decoded); + if(drtn) { + return drtn; + } + *tag = decoded.tag; + switch(decoded.tag) { + case ASN1_CONSTR_SEQUENCE: + case ASN1_CONSTR_SET: + break; + default: + return DR_UnexpectedTag; + } + derSeq->nextItem = decoded.content.data; + derSeq->end = decoded.content.data + decoded.content.length; + return DR_Success; +} + +/* + * Use this to start in on decoding a sequence's content, when + * the top-level tag and content have already been decoded. + */ +DERReturn DERDecodeSeqContentInit( + const DERItem *content, + DERSequence *derSeq) /* RETURNED, to use in DERDecodeSeqNext */ +{ + /* just prepare for decoding items in content */ + derSeq->nextItem = content->data; + derSeq->end = content->data + content->length; + return DR_Success; +} + +DERReturn DERDecodeSeqNext( + DERSequence *derSeq, + DERDecodedInfo *decoded) /* RETURNED */ +{ + DERReturn drtn; + DERItem item; + + if(derSeq->nextItem >= derSeq->end) { + /* normal termination, contents all used up */ + return DR_EndOfSequence; + } + + /* decode next item */ + item.data = derSeq->nextItem; + item.length = derSeq->end - derSeq->nextItem; + drtn = DERDecodeItem(&item, decoded); + if(drtn) { + return drtn; + } + + /* skip over the item we just decoded */ + derSeq->nextItem = decoded->content.data + decoded->content.length; + return DR_Success; +} + +/* + * High level sequence parse, starting with top-level tag and content. + * Top level tag must be ASN1_CONSTR_SEQUENCE - if it's not, and that's + * OK, use DERParseSequenceContent(). + */ +DERReturn DERParseSequence( + const DERItem *der, + DERShort numItems, /* size of itemSpecs[] */ + const DERItemSpec *itemSpecs, + void *dest, /* DERDecodedInfo(s) here RETURNED */ + DERSize sizeToZero) /* optional */ +{ + DERReturn drtn; + DERDecodedInfo topDecode; + + drtn = DERDecodeItem(der, &topDecode); + if(drtn) { + return drtn; + } + if(topDecode.tag != ASN1_CONSTR_SEQUENCE) { + return DR_UnexpectedTag; + } + return DERParseSequenceContent(&topDecode.content, + numItems, itemSpecs, dest, sizeToZero); +} + +/* high level sequence parse, starting with sequence's content */ +DERReturn DERParseSequenceContent( + const DERItem *content, + DERShort numItems, /* size of itemSpecs[] */ + const DERItemSpec *itemSpecs, + void *dest, /* DERDecodedInfo(s) here RETURNED */ + DERSize sizeToZero) /* optional */ +{ + DERSequence derSeq; + DERReturn drtn; + DERShort itemDex; + DERByte *currDER; /* full DER encoding of current item */ + + if(sizeToZero) { + DERMemset(dest, 0, sizeToZero); + } + + drtn = DERDecodeSeqContentInit(content, &derSeq); + if(drtn) { + return drtn; + } + + /* main loop */ + for(itemDex=0 ; itemDexoptions; + derDecDbg3("--- currItem %u expectTag 0x%x currOptions 0x%x\n", + i, currItemSpec->tag, currOptions); + + if((currOptions & DER_DEC_ASN_ANY) || + (foundTag == currItemSpec->tag)) { + /* + * We're good with this one. Cook up destination address + * as appropriate. + */ + if(!(currOptions & DER_DEC_SKIP)) { + derDecDbg1("--- MATCH at currItem %u\n", i); + DERByte *byteDst = (DERByte *)dest + currItemSpec->offset; + DERItem *dst = (DERItem *)byteDst; + *dst = currDecoded.content; + if(currOptions & DER_DEC_SAVE_DER) { + /* recreate full DER encoding of this item */ + derDecDbg1("--- SAVE_DER at currItem %u\n", i); + dst->data = currDER; + dst->length += (currDecoded.content.data - currDER); + } + } + + /* on to next item */ + itemDex = i + 1; + + /* is this the end? */ + if(itemDex == numItems) { + /* normal termination */ + return DR_Success; + } + else { + /* on to next item */ + foundMatch = 1; + break; + } + } /* ASN_ANY, or match */ + + /* + * If current itemSpec isn't optional, abort - else on to + * next item + */ + if(!(currOptions & DER_DEC_OPTIONAL)) { + derDecDbg1("--- MISMATCH at currItem %u, !OPTIONAL, abort\n", i); + return DR_UnexpectedTag; + } + + /* else this was optional, on to next item */ + } /* searching for tag match */ + + if(foundMatch == 0) { + /* + * Found an item we couldn't match to any tag spec and we're at + * the end. + */ + derDecDbg("--- TAG NOT FOUND, abort\n"); + return DR_UnexpectedTag; + } + + /* else on to next item */ + } /* main loop */ + + /* + * If we get here, there appears to be more to process, but we've + * given the caller everything they want. + */ + return DR_Success; +} + +#if 0 +/* + * High level sequence parse, starting with top-level tag and content. + * Top level tag must be ASN1_CONSTR_SEQUENCE - if it's not, and that's + * OK, use DERParseSequenceContent(). + */ +DERReturn DERParseSequenceOf( + const DERItem *der, + DERShort numItems, /* size of itemSpecs[] */ + const DERItemSpec *itemSpecs, + void *dest, /* DERDecodedInfo(s) here RETURNED */ + DERSize *numDestItems) /* output */ +{ + DERReturn drtn; + DERDecodedInfo topDecode; + + drtn = DERDecodeItem(der, &topDecode); + if(drtn) { + return drtn; + } + if(topDecode.tag != ASN1_CONSTR_SEQUENCE) { + return DR_UnexpectedTag; + } + return DERParseSequenceContent(&topDecode.content, + numItems, itemSpecs, dest, sizeToZero); +} + +/* + * High level set of parse, starting with top-level tag and content. + * Top level tag must be ASN1_CONSTR_SET - if it's not, and that's + * OK, use DERParseSetOrSequenceOfContent(). + */ +DERReturn DERParseSetOf( + const DERItem *der, + DERShort numItems, /* size of itemSpecs[] */ + const DERItemSpec *itemSpecs, + void *dest, /* DERDecodedInfo(s) here RETURNED */ + DERSize *numDestItems) /* output */ +{ + DERReturn drtn; + DERDecodedInfo topDecode; + + drtn = DERDecodeItem(der, &topDecode); + if(drtn) { + return drtn; + } + if(topDecode.tag != ASN1_CONSTR_SET) { + return DR_UnexpectedTag; + } + return DERParseSetOrSequenceOfContent(&topDecode.content, + numItems, itemSpecs, dest, numDestItems); +} + +/* High level set of or sequence of parse, starting with set or + sequence's content */ +DERReturn DERParseSetOrSequenceOfContent( + const DERItem *content, + void(*itemHandeler)(void *, const DERDecodedInfo *) + void *itemHandelerContext); +{ + DERSequence derSeq; + DERShort itemDex; + + drtn = DERDecodeSeqContentInit(content, &derSeq); + require_noerr_quiet(drtn, badCert); + + /* main loop */ + for (;;) { + DERDecodedInfo currDecoded; + DERShort i; + DERByte foundTag; + char foundMatch = 0; + + drtn = DERDecodeSeqNext(&derSeq, &currDecoded); + if(drtn) { + /* The only legal error here is DR_EndOfSequence. */ + if(drtn == DR_EndOfSequence) { + /* no more items left in the sequence; success */ + return DR_Success; + } + else { + /* any other error is fatal */ + require_noerr_quiet(drtn, badCert); + } + } /* decode error */ + + /* Each element can be anything. */ + foundTag = currDecoded.tag; + + /* + * We're good with this one. Cook up destination address + * as appropriate. + */ + DERByte *byteDst = (DERByte *)dest + currItemSpec->offset; + DERItem *dst = (DERItem *)byteDst; + *dst = currDecoded.content; + if(currOptions & DER_DEC_SAVE_DER) { + /* recreate full DER encoding of this item */ + derDecDbg1("--- SAVE_DER at currItem %u\n", i); + dst->data = currDER; + dst->length += (currDecoded.content.data - currDER); + } + + /* on to next item */ + itemDex = i + 1; + + /* is this the end? */ + if(itemDex == numItems) { + /* normal termination */ + return DR_Success; + } + else { + /* on to next item */ + foundMatch = 1; + break; + } + + /* + * If current itemSpec isn't optional, abort - else on to + * next item + */ + if(!(currOptions & DER_DEC_OPTIONAL)) { + derDecDbg1("--- MISMATCH at currItem %u, !OPTIONAL, abort\n", i); + return DR_UnexpectedTag; + } + + /* else this was optional, on to next item */ + } /* searching for tag match */ + + if(foundMatch == 0) { + /* + * Found an item we couldn't match to any tag spec and we're at + * the end. + */ + derDecDbg("--- TAG NOT FOUND, abort\n"); + return DR_UnexpectedTag; + } + + /* else on to next item */ + } /* main loop */ + + /* + * If we get here, there appears to be more to process, but we've + * given the caller everything they want. + */ + return DR_Success; + } +} +#endif + +#endif /* DER_DECODE_ENABLE */ ADDED Source/libDER/libDER/DER_Decode.h Index: Source/libDER/libDER/DER_Decode.h ================================================================== --- /dev/null +++ Source/libDER/libDER/DER_Decode.h @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2005-2010 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * DER_Decode.h - DER decoding routines + */ + +#ifndef _DER_DECODE_H_ +#define _DER_DECODE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "libDER.h" +#include + +/* + * Decoding one item consists of extracting its tag, a pointer + * to the actual content, and the length of the content. Those + * three are represented by a DERDecodedInfo. + */ +typedef struct { + DERTag tag; + DERItem content; +} DERDecodedInfo; + +/* + * Basic decoding primitive. Only works with: + * + * -- definite length encoding + * -- one-byte tags + * -- max content length fits in a DERSize + * + * No malloc or copy of the contents is performed; the returned + * content->content.data is a pointer into the incoming der data. + */ +DERReturn DERDecodeItem( + const DERItem *der, /* data to decode */ + DERDecodedInfo *decoded); /* RETURNED */ + +/* + * Given a BIT_STRING, in the form of its raw content bytes, + * obtain the number of unused bits and the raw bit string bytes. + */ +DERReturn DERParseBitString( + const DERItem *contents, + DERItem *bitStringBytes, /* RETURNED */ + DERByte *numUnusedBits); /* RETURNED */ + +/* + * Given a BOOLEAN, in the form of its raw content bytes, + * obtain it's value. + */ +DERReturn DERParseBoolean( + const DERItem *contents, + bool defaultValue, + bool *value); /* RETURNED */ + +DERReturn DERParseInteger( + const DERItem *contents, + uint32_t *value); /* RETURNED */ + +/* + * Sequence/set decode support. + */ + +/* state representing a sequence or set being decoded */ +typedef struct { + DERByte *nextItem; + DERByte *end; +} DERSequence; + +/* + * To decode a set or sequence, call DERDecodeSeqInit or + * DERDecodeSeqContentInit once, then call DERDecodeSeqNext to + * get each enclosed item. + * + * DERDecodeSeqNext returns DR_EndOfSequence when no more + * items are available. + */ + +/* + * Use this to parse the top level sequence's tag and content length. + */ +DERReturn DERDecodeSeqInit( + const DERItem *der, /* data to decode */ + DERTag *tag, /* RETURNED tag of sequence/set. This will be + * either ASN1_CONSTR_SEQUENCE or + * ASN1_CONSTR_SET. */ + DERSequence *derSeq); /* RETURNED, to use in DERDecodeSeqNext */ + +/* + * Use this to start in on decoding a sequence's content, when + * the top-level tag and content have already been decoded. + */ +DERReturn DERDecodeSeqContentInit( + const DERItem *content, + DERSequence *derSeq); /* RETURNED, to use in DERDecodeSeqNext */ + +/* obtain the next decoded item in a sequence or set */ +DERReturn DERDecodeSeqNext( + DERSequence *derSeq, + DERDecodedInfo *decoded); /* RETURNED */ + +/* + * High level sequence decode. + */ + +/* + * Per-item decode options. + */ + +/* Explicit default, no options */ +#define DER_DEC_NO_OPTS 0x0000 + +/* This item optional, can be skipped during decode */ +#define DER_DEC_OPTIONAL 0x0001 + +/* Skip the tag check; accept anything. */ +#define DER_DEC_ASN_ANY 0x0002 + +/* Skip item, no write to DERDecodedInfo (but tag check still performed) */ +#define DER_DEC_SKIP 0x0004 + +/* Save full DER encoding in DERDecodedInfo, including tag and length. Normally + * only the content is saved. */ +#define DER_DEC_SAVE_DER 0x0008 + +/* + * High level sequence parse, starting with top-level tag and content. + * Top level tag must be ASN1_CONSTR_SEQUENCE - if it's not, and that's + * OK, use DERParseSequenceContent(). + * + * These never return DR_EndOfSequence - if an *unexpected* end of sequence + * occurs, return DR_IncompleteSeq. + * + * Results of the decoding of one item are placed in a DERItem whose address + * is the dest arg plus the offset value in the associated DERItemSpec. + * + * Items which are optional (DER_DEC_OPTIONAL) and which are not found, + * leave their associated DERDecodedInfos unmodified. + * + * Processing of a sequence ends on detection of any error or after the + * last DERItemSpec is processed. + * + * The sizeToZero argument, if nonzero, indicates the number of bytes + * starting at dest to zero before processing the sequence. This is + * generally desirable, particularly if there are any DER_DEC_OPTIONAL + * items in the sequence; skipped optional items are detected by the + * caller via a NULL DERDecodedInfo.content.data; if this hasn't been + * explicitly zeroed (generally, by passing a nonzero value of sizeToZero), + * skipped items can't be detected. + */ +DERReturn DERParseSequence( + const DERItem *der, + DERShort numItems, /* size of itemSpecs[] */ + const DERItemSpec *itemSpecs, + void *dest, /* DERDecodedInfo(s) here RETURNED */ + DERSize sizeToZero); /* optional */ + +/* high level sequence parse, starting with sequence's content */ +DERReturn DERParseSequenceContent( + const DERItem *content, + DERShort numItems, /* size of itemSpecs[] */ + const DERItemSpec *itemSpecs, + void *dest, /* DERDecodedInfo(s) here RETURNED */ + DERSize sizeToZero); /* optional */ + +#ifdef __cplusplus +} +#endif + +#endif /* _DER_DECODE_H_ */ + ADDED Source/libDER/libDER/DER_Digest.c Index: Source/libDER/libDER/DER_Digest.c ================================================================== --- /dev/null +++ Source/libDER/libDER/DER_Digest.c @@ -0,0 +1,162 @@ +/* Copyright (c) 2005-2008,2010 Apple Inc. All Rights Reserved. */ + +/* + * DER_Digest.h - DER encode a DigestInfo + * + * Created Nov. 9 2005 by dmitch + */ + +#include "DER_Digest.h" + +/* + * Create an encoded DigestInfo based on the specified SHA1 digest. + * The digest must be 20 bytes long. + * + * Result is placed in caller's buffer, which must be at least of + * length DER_DIGEST_INFO_LEN bytes. + * + * The *resultLen parameter is the available size in the result + * buffer on input, and the actual length of the encoded DigestInfo + * on output. + * + * In the interest of saving code space, this just drops the caller's + * digest into an otherwise hard-coded, fixed, encoded SHA1 DigestInfo. + * Nothing is variable so we know the whole thing. It looks like this: + * + * SEQUENCE OF <33> { + * SEQUENCE OF <9> { + * OID <5>: OID : < 06 05 2B 0E 03 02 1A > + * NULL + * } + * OCTET STRING <20>: + * 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 + * 55 55 55 55 + * } + * + * + * tower.local:digestInfo> hexdump -x /tmp/encodedDigest + * 0000000 3021 3009 0605 2b0e 0302 1a05 0004 1455 + * 0000010 5555 5555 5555 5555 5555 5555 5555 5555 + * * + * 0000020 + */ + +static const unsigned char encodedSha1Digest[] = +{ + 0x30, 0x21, /* top level sequence length 33 */ + 0x30, 0x09, /* algorithm ID, sequence length 9 */ + 0x06, 0x05, /* alg OID, length 5, SHA1 */ + 0x2b, 0x0e, 0x03, 0x02, 0x1a, + 0x05, 0x00, /* NULL parameters */ + 0x04, 0x14 /* integer length 20 */ + /* digest follows */ +}; + +DERReturn DEREncodeSHA1DigestInfo( + const DERByte *sha1Digest, + DERSize sha1DigestLen, + DERByte *result, /* encoded result RETURNED here */ + DERSize *resultLen) /* IN/OUT */ +{ + DERSize totalLen = sizeof(encodedSha1Digest) + DER_SHA1_DIGEST_LEN; + + if((sha1Digest == NULL) || (sha1DigestLen != DER_SHA1_DIGEST_LEN) || + (result == NULL) || (resultLen == NULL)) { + return DR_ParamErr; + } + if(*resultLen < DER_SHA1_DIGEST_INFO_LEN) { + return DR_BufOverflow; + } + DERMemmove(result, encodedSha1Digest, sizeof(encodedSha1Digest)); + DERMemmove(result + sizeof(encodedSha1Digest), sha1Digest, DER_SHA1_DIGEST_LEN); + *resultLen = totalLen; + return DR_Success; +} + +/* + joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) + csor(3) nistalgorithm(4) hashAlgs(2) sha256(1) + + future ones to add: sha384(2) sha512(3) sha224(4) +*/ +static const unsigned char encodedSha256Digest[] = +{ + 0x30, 0x31, /* top level sequence length 49 */ + 0x30, 0x0d, /* algorithm ID, sequence length 13 */ + 0x06, 0x09, + 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, + 0x05, 0x00, /* NULL parameters */ + 0x04, 0x20 /* integer length 32 */ + /* digest follows */ +}; + +DERReturn DEREncodeSHA256DigestInfo( + const DERByte *sha256Digest, + DERSize sha256DigestLen, + DERByte *result, /* encoded result RETURNED here */ + DERSize *resultLen) /* IN/OUT */ +{ + DERSize totalLen = sizeof(encodedSha256Digest) + DER_SHA256_DIGEST_LEN; + + if((sha256Digest == NULL) || (sha256DigestLen != DER_SHA256_DIGEST_LEN) || + (result == NULL) || (resultLen == NULL)) { + return DR_ParamErr; + } + if(*resultLen < DER_SHA256_DIGEST_INFO_LEN) { + return DR_BufOverflow; + } + DERMemmove(result, encodedSha256Digest, sizeof(encodedSha256Digest)); + DERMemmove(result + sizeof(encodedSha256Digest), sha256Digest, DER_SHA256_DIGEST_LEN); + *resultLen = totalLen; + return DR_Success; +} + + +/* Same thing, MD5/MD2 */ +static const unsigned char encodedMdDigest[] = +{ + 0x30, 0x20, /* top level sequence length 32 */ + 0x30, 0x0c, /* algorithm ID, sequence length 12 */ + 0x06, 0x08, /* alg OID, length 8, MD2/MD5 */ + 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, + 0x05, /* 5 = MD5, 2 = MD2 */ + 0x05, 0x00, /* NULL parameters */ + 0x04, 0x10 /* integer length 16 */ + /* digest follows */ +}; + +#define WHICH_DIGEST_INDEX 13 +#define WHICH_DIGEST_MD2 2 +#define WHICH_DIGEST_MD5 5 + +DERReturn DEREncodeMDDigestInfo( + WhichDigest whichDigest, + const DERByte *mdDigest, + DERSize mdDigestLen, + DERByte *result, /* encoded result RETURNED here */ + DERSize *resultLen) /* IN/OUT */ +{ + DERSize totalLen = sizeof(encodedMdDigest) + DER_MD_DIGEST_LEN; + + if((mdDigest == NULL) || (mdDigestLen != DER_MD_DIGEST_LEN) || + (result == NULL) || (resultLen == NULL)) { + return DR_ParamErr; + } + if(*resultLen < totalLen) { + return DR_BufOverflow; + } + DERMemmove(result, encodedMdDigest, sizeof(encodedMdDigest)); + DERMemmove(result + sizeof(encodedMdDigest), mdDigest, DER_MD_DIGEST_LEN); + switch(whichDigest) { + case WD_MD2: + result[WHICH_DIGEST_INDEX] = WHICH_DIGEST_MD2; + break; + case WD_MD5: + result[WHICH_DIGEST_INDEX] = WHICH_DIGEST_MD5; + break; + default: + return DR_ParamErr; + } + *resultLen = totalLen; + return DR_Success; +} ADDED Source/libDER/libDER/DER_Digest.h Index: Source/libDER/libDER/DER_Digest.h ================================================================== --- /dev/null +++ Source/libDER/libDER/DER_Digest.h @@ -0,0 +1,74 @@ +/* Copyright (c) 2005-2008,2010 Apple Inc. All Rights Reserved. */ + +/* + * DER_Digest.h - DER encode a DigestInfo + * + * Created Nov. 9 2005 by dmitch + */ + +#ifndef _DER_DIGEST_H_ +#define _DER_DIGEST_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "libDER.h" + +/* + * Create an encoded DigestInfo based on the specified SHA1 digest. + * The incoming digest must be 20 bytes long. + * + * Result is placed in caller's buffer, which must be at least of + * length DER_SHA1_DIGEST_INFO_LEN bytes. + * + * The *resultLen parameter is the available size in the result + * buffer on input, and the actual length of the encoded DigestInfo + * on output. + */ +#define DER_SHA1_DIGEST_LEN 20 +#define DER_SHA1_DIGEST_INFO_LEN 35 + +DERReturn DEREncodeSHA1DigestInfo( + const DERByte *sha1Digest, + DERSize sha1DigestLen, + DERByte *result, /* encoded result RETURNED here */ + DERSize *resultLen); /* IN/OUT */ + +#define DER_SHA256_DIGEST_LEN 32 +#define DER_SHA256_DIGEST_INFO_LEN 51 + +DERReturn DEREncodeSHA256DigestInfo( + const DERByte *sha256Digest, + DERSize sha256DigestLen, + DERByte *result, /* encoded result RETURNED here */ + DERSize *resultLen); /* IN/OUT */ + +/* + * Likewise, create an encoded DIgestInfo for specified MD5 or MD2 digest. + */ +#define DER_MD_DIGEST_LEN 16 +#define DER_MD_DIGEST_INFO_LEN 34 + +typedef enum { + WD_MD2 = 1, + WD_MD5 = 2 +} WhichDigest; + +DERReturn DEREncodeMDDigestInfo( + WhichDigest whichDigest, + const DERByte *mdDigest, + DERSize mdDigestLen, + DERByte *result, /* encoded result RETURNED here */ + DERSize *resultLen); /* IN/OUT */ + +/* max sizes you'll need in the general cases */ +#define DER_MAX_DIGEST_LEN DER_SHA256_DIGEST_LEN +#define DER_MAX_ENCODED_INFO_LEN DER_SHA256_DIGEST_INFO_LEN + +#ifdef __cplusplus +} +#endif + +#endif /* _DER_DIGEST_H_ */ + ADDED Source/libDER/libDER/DER_Encode.c Index: Source/libDER/libDER/DER_Encode.c ================================================================== --- /dev/null +++ Source/libDER/libDER/DER_Encode.c @@ -0,0 +1,342 @@ +/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */ + +/* + * DER_Encode.h - DER encoding routines + * + * Created Dec. 2 2005 by dmitch + */ + +#include "DER_Encode.h" +#include "asn1Types.h" +#include "libDER_config.h" +#include "DER_Decode.h" + +#ifndef DER_ENCODE_ENABLE +#error Please define DER_ENCODE_ENABLE. +#endif + +#if DER_ENCODE_ENABLE + +/* calculate size of encoded tag */ +static DERSize DERLengthOfTag( + DERTag tag) +{ + DERSize rtn = 1; + + tag &= ASN1_TAGNUM_MASK; + if (tag >= 0x1F) { + /* Shift 7-bit digits out of the tag integer until it's zero. */ + while(tag != 0) { + rtn++; + tag >>= 7; + } + } + + return rtn; +} + +/* encode tag */ +static DERReturn DEREncodeTag( + DERTag tag, + DERByte *buf, /* encoded length goes here */ + DERSize *inOutLen) /* IN/OUT */ +{ + DERSize outLen = DERLengthOfTag(tag); + DERTag tagNumber = tag & ASN1_TAGNUM_MASK; + DERByte tag1 = (tag >> (sizeof(DERTag) * 8 - 8)) & 0xE0; + + if(outLen > *inOutLen) { + return DR_BufOverflow; + } + + if(outLen == 1) { + /* short form */ + *buf = tag1 | tagNumber; + } + else { + /* long form */ + DERByte *tagBytes = buf + outLen; // l.s. digit of tag + *buf = tag1 | 0x1F; // tag class / method indicator + *--tagBytes = tagNumber & 0x7F; + tagNumber >>= 7; + while(tagNumber != 0) { + *--tagBytes = (tagNumber & 0x7F) | 0x80; + tagNumber >>= 7; + } + } + *inOutLen = outLen; + return DR_Success; +} + +/* calculate size of encoded length */ +DERSize DERLengthOfLength( + DERSize length) +{ + DERSize rtn; + + if(length < 0x80) { + /* short form length */ + return 1; + } + + /* long form - one length-of-length byte plus length bytes */ + rtn = 1; + while(length != 0) { + rtn++; + length >>= 8; + } + return rtn; +} + +/* encode length */ +DERReturn DEREncodeLength( + DERSize length, + DERByte *buf, /* encoded length goes here */ + DERSize *inOutLen) /* IN/OUT */ +{ + DERByte *lenBytes; + DERSize outLen = DERLengthOfLength(length); + + if(outLen > *inOutLen) { + return DR_BufOverflow; + } + + if(length < 0x80) { + /* short form */ + *buf = (DERByte)length; + *inOutLen = 1; + return DR_Success; + } + + /* long form */ + *buf = (outLen - 1) | 0x80; // length of length, long form indicator + lenBytes = buf + outLen - 1; // l.s. digit of length + while(length != 0) { + *lenBytes-- = (DERByte)length; + length >>= 8; + } + *inOutLen = outLen; + return DR_Success; +} + +DERSize DERLengthOfItem( + DERTag tag, + DERSize length) +{ + return DERLengthOfTag(tag) + DERLengthOfLength(length) + length; +} + +DERReturn DEREncodeItem( + DERTag tag, + DERSize length, + const DERByte *src, + DERByte *derOut, /* encoded item goes here */ + DERSize *inOutLen) /* IN/OUT */ +{ + DERReturn drtn; + DERSize itemLen; + DERByte *currPtr = derOut; + DERSize bytesLeft = DERLengthOfItem(tag, length); + if(bytesLeft > *inOutLen) { + return DR_BufOverflow; + } + *inOutLen = bytesLeft; + + /* top level tag */ + itemLen = bytesLeft; + drtn = DEREncodeTag(tag, currPtr, &itemLen); + if(drtn) { + return drtn; + } + currPtr += itemLen; + bytesLeft -= itemLen; + itemLen = bytesLeft; + drtn = DEREncodeLength(length, currPtr, &itemLen); + if(drtn) { + return drtn; + } + currPtr += itemLen; + bytesLeft -= itemLen; + DERMemmove(currPtr, src, length); + + return DR_Success; +} + +static /* calculate the content length of an encoded sequence */ +DERSize DERContentLengthOfEncodedSequence( + const void *src, /* generally a ptr to a struct full of + * DERItems */ + DERShort numItems, /* size of itemSpecs[] */ + const DERItemSpec *itemSpecs) +{ + DERSize contentLen = 0; + unsigned dex; + DERSize thisContentLen; + + /* find length of each item */ + for(dex=0; dexoptions; + const DERByte *byteSrc = (const DERByte *)src + currItemSpec->offset; + const DERItem *itemSrc = (const DERItem *)byteSrc; + + if(currOptions & DER_ENC_WRITE_DER) { + /* easy case - no encode */ + contentLen += itemSrc->length; + continue; + } + + if ((currOptions & DER_DEC_OPTIONAL) && itemSrc->length == 0) { + /* If an optional item isn't present we don't encode a + tag and len. */ + continue; + } + + /* + * length of this item = + * tag (one byte) + + * length of length + + * content length + + * optional zero byte for signed integer + */ + contentLen += DERLengthOfTag(currItemSpec->tag); + + /* check need for pad byte before calculating lengthOfLength... */ + thisContentLen = itemSrc->length; + if((currOptions & DER_ENC_SIGNED_INT) && + (itemSrc->length != 0)) { + if(itemSrc->data[0] & 0x80) { + /* insert zero keep it positive */ + thisContentLen++; + } + } + contentLen += DERLengthOfLength(thisContentLen); + contentLen += thisContentLen; + } + return contentLen; +} + +DERReturn DEREncodeSequence( + DERTag topTag, /* ASN1_CONSTR_SEQUENCE, ASN1_CONSTR_SET */ + const void *src, /* generally a ptr to a struct full of + * DERItems */ + DERShort numItems, /* size of itemSpecs[] */ + const DERItemSpec *itemSpecs, + DERByte *derOut, /* encoded data written here */ + DERSize *inOutLen) /* IN/OUT */ +{ + const DERByte *endPtr = derOut + *inOutLen; + DERByte *currPtr = derOut; + DERSize bytesLeft = *inOutLen; + DERSize contentLen; + DERReturn drtn; + DERSize itemLen; + unsigned dex; + + /* top level tag */ + itemLen = bytesLeft; + drtn = DEREncodeTag(topTag, currPtr, &itemLen); + if(drtn) { + return drtn; + } + currPtr += itemLen; + bytesLeft -= itemLen; + if(currPtr >= endPtr) { + return DR_BufOverflow; + } + + /* content length */ + contentLen = DERContentLengthOfEncodedSequence(src, numItems, itemSpecs); + itemLen = bytesLeft; + drtn = DEREncodeLength(contentLen, currPtr, &itemLen); + if(drtn) { + return drtn; + } + currPtr += itemLen; + bytesLeft -= itemLen; + if(currPtr + contentLen > endPtr) { + return DR_BufOverflow; + } + /* we don't have to check for overflow any more */ + + /* grind thru the items */ + for(dex=0; dexoptions; + const DERByte *byteSrc = (const DERByte *)src + currItemSpec->offset; + const DERItem *itemSrc = (const DERItem *)byteSrc; + int prependZero = 0; + + if(currOptions & DER_ENC_WRITE_DER) { + /* easy case */ + DERMemmove(currPtr, itemSrc->data, itemSrc->length); + currPtr += itemSrc->length; + bytesLeft -= itemSrc->length; + continue; + } + + if ((currOptions & DER_DEC_OPTIONAL) && itemSrc->length == 0) { + /* If an optional item isn't present we skip it. */ + continue; + } + + /* encode one item: first the tag */ + itemLen = bytesLeft; + drtn = DEREncodeTag(currItemSpec->tag, currPtr, &itemLen); + if(drtn) { + return drtn; + } + currPtr += itemLen; + bytesLeft -= itemLen; + + /* do we need to prepend a zero to content? */ + contentLen = itemSrc->length; + if((currOptions & DER_ENC_SIGNED_INT) && + (itemSrc->length != 0)) { + if(itemSrc->data[0] & 0x80) { + /* insert zero keep it positive */ + contentLen++; + prependZero = 1; + } + } + + /* encode content length */ + itemLen = bytesLeft; + drtn = DEREncodeLength(contentLen, currPtr, &itemLen); + if(drtn) { + return drtn; + } + currPtr += itemLen; + bytesLeft -= itemLen; + + /* now the content, with possible leading zero added */ + if(prependZero) { + *currPtr++ = 0; + bytesLeft--; + } + DERMemmove(currPtr, itemSrc->data, itemSrc->length); + currPtr += itemSrc->length; + bytesLeft -= itemSrc->length; + } + *inOutLen = (currPtr - derOut); + return DR_Success; +} + +/* calculate the length of an encoded sequence. */ +DERSize DERLengthOfEncodedSequence( + DERTag topTag, + const void *src, /* generally a ptr to a struct full of + * DERItems */ + DERShort numItems, /* size of itemSpecs[] */ + const DERItemSpec *itemSpecs) +{ + DERSize contentLen = DERContentLengthOfEncodedSequence( + src, numItems, itemSpecs); + + return DERLengthOfTag(topTag) + + DERLengthOfLength(contentLen) + + contentLen; +} + +#endif /* DER_ENCODE_ENABLE */ + ADDED Source/libDER/libDER/DER_Encode.h Index: Source/libDER/libDER/DER_Encode.h ================================================================== --- /dev/null +++ Source/libDER/libDER/DER_Encode.h @@ -0,0 +1,103 @@ +/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */ + +/* + * DER_Encode.h - DER encoding routines + * + * Created Dec. 2 2005 by dmitch + */ + +#ifndef _DER_ENCCODE_H_ +#define _DER_ENCODE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "libDER.h" + +/* + * Max size of an encoded item given its length. + * This includes a possible leading zero prepended to a signed integer + * (see DER_ENC_SIGNED_INT below). + */ +#define DER_MAX_ENCODED_SIZE(len) \ + ( 1 + /* tag */ \ + 5 + /* max length */ \ + 1 + /* possible prepended zero */ \ + len) + +/* calculate size of encoded length */ +DERSize DERLengthOfLength( + DERSize length); + +/* encode length */ +DERReturn DEREncodeLength( + DERSize length, + DERByte *buf, /* encoded length goes here */ + DERSize *inOutLen); /* IN/OUT */ + +/* calculate size of encoded length */ +DERSize DERLengthOfItem( + DERTag tag, + DERSize length); + +/* encode item */ +DERReturn DEREncodeItem( + DERTag tag, + DERSize length, + const DERByte *src, + DERByte *derOut, /* encoded item goes here */ + DERSize *inOutLen); /* IN/OUT */ + +/* + * Per-item encode options. + */ + +/* explicit default, no options */ +#define DER_ENC_NO_OPTS 0x0000 + +/* signed integer check: if incoming m.s. bit is 1, prepend a zero */ +#define DER_ENC_SIGNED_INT 0x0100 + +/* DERItem contains fully encoded item - copy, don't encode */ +#define DER_ENC_WRITE_DER 0x0200 + + +/* + * High-level sequence or set encode support. + * + * The outgoing sequence is expressed as an array of DERItemSpecs, each + * of which corresponds to one item in the encoded sequence. + * + * Normally the tag of the encoded item comes from the associated + * DERItemSpec, and the content comes from the DERItem whose address is + * the src arg plus the offset value in the associated DERItemSpec. + * + * If the DER_ENC_WRITE_DER option is true for a given DERItemSpec then + * no per-item encoding is done; the DER - with tag, length, and content - + * is taken en masse from the associated DERItem. + */ +DERReturn DEREncodeSequence( + DERTag topTag, /* ASN1_CONSTR_SEQUENCE, ASN1_CONSTR_SET */ + const void *src, /* generally a ptr to a struct full of + * DERItems */ + DERShort numItems, /* size of itemSpecs[] */ + const DERItemSpec *itemSpecs, + DERByte *derOut, /* encoded data written here */ + DERSize *inOutLen); /* IN/OUT */ + +/* precalculate the length of an encoded sequence. */ +DERSize DERLengthOfEncodedSequence( + DERTag topTag, /* ASN1_CONSTR_SEQUENCE, ASN1_CONSTR_SET */ + const void *src, /* generally a ptr to a struct full of + * DERItems */ + DERShort numItems, /* size of itemSpecs[] */ + const DERItemSpec *itemSpecs); + + +#ifdef __cplusplus +} +#endif + +#endif /* _DER_DECODE_H_ */ + ADDED Source/libDER/libDER/DER_Keys.c Index: Source/libDER/libDER/DER_Keys.c ================================================================== --- /dev/null +++ Source/libDER/libDER/DER_Keys.c @@ -0,0 +1,167 @@ +/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */ + +/* + * DER_Cert.c - support for decoding RSA keys + * + * Created Nov. 8 2005 by Doug Mitchell. + */ + +#include "DER_Decode.h" +#include "DER_Encode.h" +#include "DER_Keys.h" +#include "asn1Types.h" +#include "libDER_config.h" + +#ifndef DER_DECODE_ENABLE +#error Please define DER_DECODE_ENABLE. +#endif +#if DER_DECODE_ENABLE + +/* + * DERItemSpecs for decoding RSA keys. + */ + +/* Algorithm Identifier */ +const DERItemSpec DERAlgorithmIdItemSpecs[] = +{ + { DER_OFFSET(DERAlgorithmId, oid), + ASN1_OBJECT_ID, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERAlgorithmId, params), + 0, /* no tag - any */ + DER_DEC_ASN_ANY | DER_DEC_OPTIONAL | DER_DEC_SAVE_DER } +}; +const DERSize DERNumAlgorithmIdItemSpecs = + sizeof(DERAlgorithmIdItemSpecs) / sizeof(DERItemSpec); + +/* X509 SubjectPublicKeyInfo */ +const DERItemSpec DERSubjPubKeyInfoItemSpecs[] = +{ + { DER_OFFSET(DERSubjPubKeyInfo, algId), + ASN1_CONSTR_SEQUENCE, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERSubjPubKeyInfo, pubKey), + ASN1_BIT_STRING, + DER_DEC_NO_OPTS }, + +}; +const DERSize DERNumSubjPubKeyInfoItemSpecs = + sizeof(DERSubjPubKeyInfoItemSpecs) / sizeof(DERItemSpec); + +/* + * RSA private key in CRT format + */ +const DERItemSpec DERRSAPrivKeyCRTItemSpecs[] = +{ + /* version, n, e, d - skip */ + { 0, + ASN1_INTEGER, + DER_DEC_SKIP }, + { 0, + ASN1_INTEGER, + DER_DEC_SKIP }, + { 0, + ASN1_INTEGER, + DER_DEC_SKIP }, + { 0, + ASN1_INTEGER, + DER_DEC_SKIP }, + { DER_OFFSET(DERRSAPrivKeyCRT, p), + ASN1_INTEGER, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERRSAPrivKeyCRT, q), + ASN1_INTEGER, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERRSAPrivKeyCRT, dp), + ASN1_INTEGER, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERRSAPrivKeyCRT, dq), + ASN1_INTEGER, + DER_DEC_NO_OPTS }, + { DER_OFFSET(DERRSAPrivKeyCRT, qInv), + ASN1_INTEGER, + DER_DEC_NO_OPTS }, + /* ignore the (optional) rest */ +}; +const DERSize DERNumRSAPrivKeyCRTItemSpecs = + sizeof(DERRSAPrivKeyCRTItemSpecs) / sizeof(DERItemSpec); + +#endif /* DER_DECODE_ENABLE */ + +#if DER_DECODE_ENABLE || DER_ENCODE_ENABLE + +/* RSA public key in PKCS1 format - encode and decode */ +const DERItemSpec DERRSAPubKeyPKCS1ItemSpecs[] = +{ + { DER_OFFSET(DERRSAPubKeyPKCS1, modulus), + ASN1_INTEGER, + DER_DEC_NO_OPTS | DER_ENC_SIGNED_INT }, + { DER_OFFSET(DERRSAPubKeyPKCS1, pubExponent), + ASN1_INTEGER, + DER_DEC_NO_OPTS | DER_ENC_SIGNED_INT }, +}; +const DERSize DERNumRSAPubKeyPKCS1ItemSpecs = + sizeof(DERRSAPubKeyPKCS1ItemSpecs) / sizeof(DERItemSpec); + +/* RSA public key in Apple custome format with reciprocal - encode and decode */ +const DERItemSpec DERRSAPubKeyAppleItemSpecs[] = +{ + { DER_OFFSET(DERRSAPubKeyApple, modulus), + ASN1_INTEGER, + DER_DEC_NO_OPTS | DER_ENC_SIGNED_INT }, + { DER_OFFSET(DERRSAPubKeyApple, reciprocal), + ASN1_INTEGER, + DER_DEC_NO_OPTS | DER_ENC_SIGNED_INT }, + { DER_OFFSET(DERRSAPubKeyApple, pubExponent), + ASN1_INTEGER, + DER_DEC_NO_OPTS | DER_ENC_SIGNED_INT }, +}; +const DERSize DERNumRSAPubKeyAppleItemSpecs = + sizeof(DERRSAPubKeyAppleItemSpecs) / sizeof(DERItemSpec); + + +#endif /* DER_DECODE_ENABLE || DER_ENCODE_ENABLE */ + +#ifndef DER_ENCODE_ENABLE +#error Please define DER_ENCODE_ENABLE. +#endif + +#if DER_ENCODE_ENABLE + +/* RSA Key Pair, encode only */ +const DERItemSpec DERRSAKeyPairItemSpecs[] = +{ + { DER_OFFSET(DERRSAKeyPair, version), + ASN1_INTEGER, + DER_ENC_SIGNED_INT }, + { DER_OFFSET(DERRSAKeyPair, n), + ASN1_INTEGER, + DER_ENC_SIGNED_INT }, + { DER_OFFSET(DERRSAKeyPair, e), + ASN1_INTEGER, + DER_ENC_SIGNED_INT }, + { DER_OFFSET(DERRSAKeyPair, d), + ASN1_INTEGER, + DER_ENC_SIGNED_INT }, + { DER_OFFSET(DERRSAKeyPair, p), + ASN1_INTEGER, + DER_ENC_SIGNED_INT }, + { DER_OFFSET(DERRSAKeyPair, q), + ASN1_INTEGER, + DER_ENC_SIGNED_INT }, + { DER_OFFSET(DERRSAKeyPair, dp), + ASN1_INTEGER, + DER_ENC_SIGNED_INT }, + { DER_OFFSET(DERRSAKeyPair, dq), + ASN1_INTEGER, + DER_ENC_SIGNED_INT }, + { DER_OFFSET(DERRSAKeyPair, qInv), + ASN1_INTEGER, + DER_ENC_SIGNED_INT }, +}; + +const DERSize DERNumRSAKeyPairItemSpecs = + sizeof(DERRSAKeyPairItemSpecs) / sizeof(DERItemSpec); + +#endif /* DER_ENCODE_ENABLE */ + ADDED Source/libDER/libDER/DER_Keys.h Index: Source/libDER/libDER/DER_Keys.h ================================================================== --- /dev/null +++ Source/libDER/libDER/DER_Keys.h @@ -0,0 +1,104 @@ +/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */ + +/* + * DER_Keys.h - support for decoding RSA keys + * + * Created Nov. 8 2005 by dmitch + */ + +#ifndef _DER_KEYS_H_ +#define _DER_KEYS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "libDER.h" +#include "DER_Decode.h" + +/* Algorithm Identifier components */ +typedef struct { + DERItem oid; /* OID */ + DERItem params; /* ASN_ANY, optional, DER_DEC_SAVE_DER */ +} DERAlgorithmId; + +/* DERItemSpecs to decode into a DERAlgorithmId */ +extern const DERItemSpec DERAlgorithmIdItemSpecs[]; +extern const DERSize DERNumAlgorithmIdItemSpecs; + +/* X509 SubjectPublicKeyInfo */ +typedef struct { + DERItem algId; /* sequence, DERAlgorithmId */ + DERItem pubKey; /* BIT STRING */ +} DERSubjPubKeyInfo; + +/* DERItemSpecs to decode into a DERSubjPubKeyInfo */ +extern const DERItemSpec DERSubjPubKeyInfoItemSpecs[]; +extern const DERSize DERNumSubjPubKeyInfoItemSpecs; + +/* + * RSA public key in PKCS1 format; this is inside the BIT_STRING in + * DERSubjPubKeyInfo.pubKey. + */ +typedef struct { + DERItem modulus; /* n - INTEGER */ + DERItem pubExponent; /* e - INTEGER */ +} DERRSAPubKeyPKCS1; + +/* DERItemSpecs to decode/encode into/from a DERRSAPubKeyPKCS1 */ +extern const DERItemSpec DERRSAPubKeyPKCS1ItemSpecs[]; +extern const DERSize DERNumRSAPubKeyPKCS1ItemSpecs; + +/* + * RSA public key in custom (to this library) format, including + * the reciprocal. All fields are integers. + */ +typedef struct { + DERItem modulus; /* n */ + DERItem reciprocal; /* reciprocal of modulus */ + DERItem pubExponent; /* e */ +} DERRSAPubKeyApple; + +/* DERItemSpecs to decode/encode into/from a DERRSAPubKeyApple */ +extern const DERItemSpec DERRSAPubKeyAppleItemSpecs[]; +extern const DERSize DERNumRSAPubKeyAppleItemSpecs; + +/* + * RSA Private key, PKCS1 format, CRT option. + * All fields are integers. + */ +typedef struct { + DERItem p; /* p * q = n */ + DERItem q; + DERItem dp; /* d mod (p-1) */ + DERItem dq; /* d mod (q-1) */ + DERItem qInv; +} DERRSAPrivKeyCRT; + +/* DERItemSpecs to decode into a DERRSAPrivKeyCRT */ +extern const DERItemSpec DERRSAPrivKeyCRTItemSpecs[]; +extern const DERSize DERNumRSAPrivKeyCRTItemSpecs; + +/* Fully formed RSA key pair, for generating a PKCS1 private key */ +typedef struct { + DERItem version; + DERItem n; /* modulus */ + DERItem e; /* public exponent */ + DERItem d; /* private exponent */ + DERItem p; /* n = p*q */ + DERItem q; + DERItem dp; /* d mod (p-1) */ + DERItem dq; /* d mod (q-1) */ + DERItem qInv; /* q^(-1) mod p */ +} DERRSAKeyPair; + +/* DERItemSpecs to encode a DERRSAKeyPair */ +extern const DERItemSpec DERRSAKeyPairItemSpecs[]; +extern const DERSize DERNumRSAKeyPairItemSpecs; + +#ifdef __cplusplus +} +#endif + +#endif /* _DER_KEYS_H_ */ + ADDED Source/libDER/libDER/asn1Types.h Index: Source/libDER/libDER/asn1Types.h ================================================================== --- /dev/null +++ Source/libDER/libDER/asn1Types.h @@ -0,0 +1,91 @@ +/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */ + +/* + * asn1Types.h - ASN.1/DER #defines - strictly hard coded per the real world + * + * Created Nov. 4 2005 by dmitch + */ + +#ifndef _ASN1_TYPES_H_ +#define _ASN1_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* copied from libsecurity_asn1 project */ + +#define ASN1_BOOLEAN 0x01 +#define ASN1_INTEGER 0x02 +#define ASN1_BIT_STRING 0x03 +#define ASN1_OCTET_STRING 0x04 +#define ASN1_NULL 0x05 +#define ASN1_OBJECT_ID 0x06 +#define ASN1_OBJECT_DESCRIPTOR 0x07 +/* External type and instance-of type 0x08 */ +#define ASN1_REAL 0x09 +#define ASN1_ENUMERATED 0x0a +#define ASN1_EMBEDDED_PDV 0x0b +#define ASN1_UTF8_STRING 0x0c +/* 0x0d */ +/* 0x0e */ +/* 0x0f */ +#define ASN1_SEQUENCE 0x10 +#define ASN1_SET 0x11 +#define ASN1_NUMERIC_STRING 0x12 +#define ASN1_PRINTABLE_STRING 0x13 +#define ASN1_T61_STRING 0x14 +#define ASN1_VIDEOTEX_STRING 0x15 +#define ASN1_IA5_STRING 0x16 +#define ASN1_UTC_TIME 0x17 +#define ASN1_GENERALIZED_TIME 0x18 +#define ASN1_GRAPHIC_STRING 0x19 +#define ASN1_VISIBLE_STRING 0x1a +#define ASN1_GENERAL_STRING 0x1b +#define ASN1_UNIVERSAL_STRING 0x1c +/* 0x1d */ +#define ASN1_BMP_STRING 0x1e +#define ASN1_HIGH_TAG_NUMBER 0x1f +#define ASN1_TELETEX_STRING ASN1_T61_STRING + +#ifdef DER_MULTIBYTE_TAGS + +#define ASN1_TAG_MASK ((DERTag)~0) +#define ASN1_TAGNUM_MASK ((DERTag)~((DERTag)7 << (sizeof(DERTag) * 8 - 3))) + +#define ASN1_METHOD_MASK ((DERTag)1 << (sizeof(DERTag) * 8 - 3)) +#define ASN1_PRIMITIVE ((DERTag)0 << (sizeof(DERTag) * 8 - 3)) +#define ASN1_CONSTRUCTED ((DERTag)1 << (sizeof(DERTag) * 8 - 3)) + +#define ASN1_CLASS_MASK ((DERTag)3 << (sizeof(DERTag) * 8 - 2)) +#define ASN1_UNIVERSAL ((DERTag)0 << (sizeof(DERTag) * 8 - 2)) +#define ASN1_APPLICATION ((DERTag)1 << (sizeof(DERTag) * 8 - 2)) +#define ASN1_CONTEXT_SPECIFIC ((DERTag)2 << (sizeof(DERTag) * 8 - 2)) +#define ASN1_PRIVATE ((DERTag)3 << (sizeof(DERTag) * 8 - 2)) + +#else /* DER_MULTIBYTE_TAGS */ + +#define ASN1_TAG_MASK 0xff +#define ASN1_TAGNUM_MASK 0x1f +#define ASN1_METHOD_MASK 0x20 +#define ASN1_PRIMITIVE 0x00 +#define ASN1_CONSTRUCTED 0x20 + +#define ASN1_CLASS_MASK 0xc0 +#define ASN1_UNIVERSAL 0x00 +#define ASN1_APPLICATION 0x40 +#define ASN1_CONTEXT_SPECIFIC 0x80 +#define ASN1_PRIVATE 0xc0 + +#endif /* !DER_MULTIBYTE_TAGS */ + +/* sequence and set appear as the following */ +#define ASN1_CONSTR_SEQUENCE (ASN1_CONSTRUCTED | ASN1_SEQUENCE) +#define ASN1_CONSTR_SET (ASN1_CONSTRUCTED | ASN1_SET) + +#ifdef __cplusplus +} +#endif + +#endif /* _ASN1_TYPES_H_ */ + ADDED Source/libDER/libDER/libDER.h Index: Source/libDER/libDER/libDER.h ================================================================== --- /dev/null +++ Source/libDER/libDER/libDER.h @@ -0,0 +1,65 @@ +/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */ + +/* + * libDER.h - main header for libDER, a ROM-capable DER decoding library. + * + * Created Nov. 4 2005 by dmitch + */ + +#ifndef _LIB_DER_H_ +#define _LIB_DER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "libDER_config.h" +/* + * Error returns generated by this library. + */ +typedef enum { + DR_Success, + DR_EndOfSequence, /* end of sequence or set */ + DR_UnexpectedTag, /* unexpected tag found while decoding */ + DR_DecodeError, /* misc. decoding error (badly formatted DER) */ + DR_Unimplemented, /* function not implemented in this configuration */ + DR_IncompleteSeq, /* incomplete sequence */ + DR_ParamErr, /* incoming parameter error */ + DR_BufOverflow /* buffer overflow */ + /* etc. */ +} DERReturn; + +/* + * Primary representation of a block of memory. + */ +typedef struct { + DERByte *data; + DERSize length; +} DERItem; + +/* + * The structure of a sequence during decode or encode is expressed as + * an array of DERItemSpecs. While decoding or encoding a sequence, + * each item in the sequence corresponds to one DERItemSpec. + */ +typedef struct { + DERSize offset; /* offset of destination DERItem */ + DERTag tag; /* DER tag */ + DERShort options; /* DER_DEC_xxx or DER_ENC_xxx */ +} DERItemSpec; + +/* + * Macro to obtain offset of a DERDecodedInfo within a struct. + * FIXME this is going to need reworking to avoid compiler warnings + * on 64-bit compiles. It'll work OK as long as an offset can't be larger + * than a DERSize, but the cast from a pointer to a DERSize may + * provoke compiler warnings. + */ +#define DER_OFFSET(type, field) ((DERSize)(&((type *)0)->field)) + +#ifdef __cplusplus +} +#endif + +#endif /* _LIB_DER_H_ */ + ADDED Source/libDER/libDER/libDER_config.h Index: Source/libDER/libDER/libDER_config.h ================================================================== --- /dev/null +++ Source/libDER/libDER/libDER_config.h @@ -0,0 +1,92 @@ +/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */ + +/* + * libDER_config.h - platform dependent #defines and typedefs for libDER + * + * Created Nov. 4 2005 by dmitch + */ + +#ifndef _LIB_DER_CONFIG_H_ +#define _LIB_DER_CONFIG_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Basic data types: unsigned 8-bit integer, unsigned 32-bit integer + */ +typedef uint8_t DERByte; +typedef uint16_t DERShort; +typedef size_t DERSize; + +/* + * Use these #defines of you have memset, memmove, and memcmp; else + * write your own equivalents. + */ + +#define DERMemset(ptr, c, len) memset(ptr, c, len) +#define DERMemmove(dst, src, len) memmove(dst, src, len) +#define DERMemcmp(b1, b2, len) memcmp(b1, b2, len) + + +/*** + *** Compile time options to trim size of the library. + ***/ + +/* enable general DER encode */ +#define DER_ENCODE_ENABLE 1 + +/* enable general DER decode */ +#define DER_DECODE_ENABLE 1 + +#ifndef DER_MULTIBYTE_TAGS +/* enable multibyte tag support. */ +#define DER_MULTIBYTE_TAGS 1 +#endif + +#ifndef DER_TAG_SIZE +/* Iff DER_MULTIBYTE_TAGS is 1 this is the sizeof(DERTag) in bytes. Note that + tags are still encoded and decoded from a minimally encoded DER + represantation. This value determines how big each DERItemSpecs is, we + choose 2 since that makes DERItemSpecs 8 bytes wide. */ +#define DER_TAG_SIZE 2 +#endif + + +/* ---------------------- Do not edit below this line ---------------------- */ + +/* + * Logical representation of a tag (the encoded representation is always in + * the minimal number of bytes). The top 3 bits encode class and method + * The remaining bits encode the tag value. To obtain smaller DERItemSpecs + * sizes, choose the smallest type that fits your needs. Most standard ASN.1 + * usage only needs single byte tags, but ocasionally custom applications + * require a larger tag namespace. + */ +#if DER_MULTIBYTE_TAGS + +#if DER_TAG_SIZE == 1 +typedef uint8_t DERTag; +#elif DER_TAG_SIZE == 2 +typedef uint16_t DERTag; +#elif DER_TAG_SIZE == 4 +typedef uint32_t DERTag; +#elif DER_TAG_SIZE == 8 +typedef uint64_t DERTag; +#else +#error DER_TAG_SIZE invalid +#endif + +#else /* DER_MULTIBYTE_TAGS */ +typedef DERByte DERTag; +#endif /* !DER_MULTIBYTE_TAGS */ + +#ifdef __cplusplus +} +#endif + +#endif /* _LIB_DER_CONFIG_H_ */ ADDED Source/libDER/libDER/oids.c Index: Source/libDER/libDER/oids.c ================================================================== --- /dev/null +++ Source/libDER/libDER/oids.c @@ -0,0 +1,466 @@ +/* Copyright (c) 2005-2009 Apple Inc. All Rights Reserved. */ + +/* + * oids.c - OID consts + * + * Created Nov. 11 2005 by dmitch + */ + +#include "libDER.h" +#include "oids.h" + +#define OID_ISO_CCITT_DIR_SERVICE 85 +#define OID_DS OID_ISO_CCITT_DIR_SERVICE +#define OID_ATTR_TYPE OID_DS, 4 +#define OID_EXTENSION OID_DS, 29 +#define OID_ISO_STANDARD 40 +#define OID_ISO_MEMBER 42 +#define OID_US OID_ISO_MEMBER, 134, 72 + +#define OID_ISO_IDENTIFIED_ORG 43 +#define OID_OSINET OID_ISO_IDENTIFIED_ORG, 4 +#define OID_GOSIP OID_ISO_IDENTIFIED_ORG, 5 +#define OID_DOD OID_ISO_IDENTIFIED_ORG, 6 +#define OID_OIW OID_ISO_IDENTIFIED_ORG, 14 + +/* From the PKCS Standards */ +#define OID_RSA OID_US, 134, 247, 13 +#define OID_RSA_HASH OID_RSA, 2 +#define OID_RSA_ENCRYPT OID_RSA, 3 +#define OID_PKCS OID_RSA, 1 +#define OID_PKCS_1 OID_PKCS, 1 +#define OID_PKCS_2 OID_PKCS, 2 +#define OID_PKCS_3 OID_PKCS, 3 +#define OID_PKCS_4 OID_PKCS, 4 +#define OID_PKCS_5 OID_PKCS, 5 +#define OID_PKCS_6 OID_PKCS, 6 +#define OID_PKCS_7 OID_PKCS, 7 +#define OID_PKCS_8 OID_PKCS, 8 +#define OID_PKCS_9 OID_PKCS, 9 +#define OID_PKCS_10 OID_PKCS, 10 +#define OID_PKCS_11 OID_PKCS, 11 +#define OID_PKCS_12 OID_PKCS, 12 + +/* ANSI X9.62 */ +#define OID_ANSI_X9_62 OID_US, 206, 61 +#define OID_PUBLIC_KEY_TYPE OID_ANSI_X9_62, 2 +#define OID_EC_SIG_TYPE OID_ANSI_X9_62, 4 +#define OID_ECDSA_WITH_SHA2 OID_EC_SIG_TYPE, 3 + +/* ANSI X9.42 */ +#define OID_ANSI_X9_42 OID_US, 206, 62, 2 +#define OID_ANSI_X9_42_SCHEME OID_ANSI_X9_42, 3 +#define OID_ANSI_X9_42_NAMED_SCHEME OID_ANSI_X9_42, 4 + +/* DOD IANA Security releated objects. */ +#define OID_IANA OID_DOD, 1, 5 + +/* Kerberos PKINIT */ +#define OID_KERBv5 OID_IANA, 2 +#define OID_KERBv5_PKINIT OID_KERBv5, 3 + +/* DOD IANA Mechanisms. */ +#define OID_MECHANISMS OID_IANA, 5 + +/* PKIX */ +#define OID_PKIX OID_MECHANISMS, 7 +#define OID_PE OID_PKIX, 1 +#define OID_QT OID_PKIX, 2 +#define OID_KP OID_PKIX, 3 +#define OID_OTHER_NAME OID_PKIX, 8 +#define OID_PDA OID_PKIX, 9 +#define OID_QCS OID_PKIX, 11 +#define OID_AD OID_PKIX, 48 +#define OID_AD_OCSP OID_AD, 1 +#define OID_AD_CAISSUERS OID_AD, 2 + +/* ISAKMP */ +#define OID_ISAKMP OID_MECHANISMS, 8 + +/* ETSI */ +#define OID_ETSI 0x04, 0x00 +#define OID_ETSI_QCS 0x04, 0x00, 0x8E, 0x46, 0x01 + +#define OID_OIW_SECSIG OID_OIW, 3 + +#define OID_OIW_ALGORITHM OID_OIW_SECSIG, 2 + +/* NIST defined digest algorithm arc (2, 16, 840, 1, 101, 3, 4, 2) */ +#define OID_NIST_HASHALG 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02 + +/* + * Apple-specific OID bases + */ + +/* + * apple OBJECT IDENTIFIER ::= + * { iso(1) member-body(2) US(840) 113635 } + * + * BER = 06 06 2A 86 48 86 F7 63 + */ +#define APPLE_OID OID_US, 0x86, 0xf7, 0x63 + +/* appleDataSecurity OBJECT IDENTIFIER ::= + * { apple 100 } + * { 1 2 840 113635 100 } + * + * BER = 06 07 2A 86 48 86 F7 63 64 + */ +#define APPLE_ADS_OID APPLE_OID, 0x64 + +/* + * appleTrustPolicy OBJECT IDENTIFIER ::= + * { appleDataSecurity 1 } + * { 1 2 840 113635 100 1 } + * + * BER = 06 08 2A 86 48 86 F7 63 64 01 + */ +#define APPLE_TP_OID APPLE_ADS_OID, 1 + +/* + * appleSecurityAlgorithm OBJECT IDENTIFIER ::= + * { appleDataSecurity 2 } + * { 1 2 840 113635 100 2 } + * + * BER = 06 08 2A 86 48 86 F7 63 64 02 + */ +#define APPLE_ALG_OID APPLE_ADS_OID, 2 + +/* + * appleDotMacCertificate OBJECT IDENTIFIER ::= + * { appleDataSecurity 3 } + * { 1 2 840 113635 100 3 } + */ +#define APPLE_DOTMAC_CERT_OID APPLE_ADS_OID, 3 + +/* + * Basis of Policy OIDs for .mac TP requests + * + * dotMacCertificateRequest OBJECT IDENTIFIER ::= + * { appleDotMacCertificate 1 } + * { 1 2 840 113635 100 3 1 } + */ +#define APPLE_DOTMAC_CERT_REQ_OID APPLE_DOTMAC_CERT_OID, 1 + +/* + * Basis of .mac Certificate Extensions + * + * dotMacCertificateExtension OBJECT IDENTIFIER ::= + * { appleDotMacCertificate 2 } + * { 1 2 840 113635 100 3 2 } + */ +#define APPLE_DOTMAC_CERT_EXTEN_OID APPLE_DOTMAC_CERT_OID, 2 + +/* + * Basis of .mac Certificate request OID/value identitifiers + * + * dotMacCertificateRequestValues OBJECT IDENTIFIER ::= + * { appleDotMacCertificate 3 } + * { 1 2 840 113635 100 3 3 } + */ +#define APPLE_DOTMAC_CERT_REQ_VALUE_OID APPLE_DOTMAC_CERT_OID, 3 + +/* + * Basis of Apple-specific extended key usages + * + * appleExtendedKeyUsage OBJECT IDENTIFIER ::= + * { appleDataSecurity 4 } + * { 1 2 840 113635 100 4 } + */ +#define APPLE_EKU_OID APPLE_ADS_OID, 4 + +/* + * Basis of Apple Code Signing extended key usages + * appleCodeSigning OBJECT IDENTIFIER ::= + * { appleExtendedKeyUsage 1 } + * { 1 2 840 113635 100 4 1} + */ +#define APPLE_EKU_CODE_SIGNING APPLE_EKU_OID, 1 +#define APPLE_EKU_APPLE_ID APPLE_EKU_OID, 7 + +/* + * Basis of Apple-specific Certific Policy IDs. + * appleCertificatePolicies OBJECT IDENTIFIER ::= + * { appleDataSecurity 5 } + * { 1 2 840 113635 100 5 } + */ +#define APPLE_CERT_POLICIES APPLE_ADS_OID, 5 + +/* + * Basis of Apple-specific Signing extensions + * { appleDataSecurity 6 } + */ +#define APPLE_CERT_EXT APPLE_ADS_OID, 6 +/* Apple Intermediate Marker OIDs */ +#define APPLE_CERT_EXT_INTERMEDIATE_MARKER APPLE_CERT_EXT, 2 +/* Apple Apple ID Intermediate Marker */ +#define APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLEID APPLE_CERT_EXT_INTERMEDIATE_MARKER, 3 + +/* Secure Boot Embedded Image3 value, + co-opted by desktop for "Apple Released Code Signature", without value */ +#define APPLE_SBOOT_CERT_EXTEN_SBOOT_SPEC_OID APPLE_ADS_OID, 6, 1, 1 +/* iPhone Provisioning Profile Signing leaf */ +#define APPLE_PROVISIONING_PROFILE_OID APPLE_ADS_OID, 6, 2, 2, 1 +/* iPhone Application Signing leaf */ +#define APPLE_APP_SIGINING_OID APPLE_ADS_OID, 6, 1, 3 + +/* + * Netscape OIDs. + */ +#define NETSCAPE_BASE_OID 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42 + +/* + * Netscape cert extension. + * + * netscape-cert-extension OBJECT IDENTIFIER ::= + * { 2 16 840 1 113730 1 } + * + * BER = 06 08 60 86 48 01 86 F8 42 01 + */ +#define NETSCAPE_CERT_EXTEN NETSCAPE_BASE_OID, 0x01 + +#define NETSCAPE_CERT_POLICY NETSCAPE_BASE_OID, 0x04 + +/* Entrust OIDs. */ +#define ENTRUST_BASE_OID OID_US, 0x86, 0xf6, 0x7d + +/* + * Entrust cert extension. + * + * entrust-cert-extension OBJECT IDENTIFIER ::= + * { 1 2 840 113533 7 65 } + * + * BER = 06 08 2A 86 48 86 F6 7D 07 41 + */ +#define ENTRUST_CERT_EXTEN ENTRUST_BASE_OID, 0x07, 0x41 + +/* Microsfot OIDs. */ +#define MICROSOFT_BASE_OID OID_DOD, 0x01, 0x04, 0x01, 0x82, 0x37 +#define MICROSOFT_ENROLLMENT_OID MICROSOFT_BASE_OID, 0x14 + +/* Algorithm OIDs. */ +static const DERByte + _oidRsa[] = { OID_PKCS_1, 1 }, + _oidMd2Rsa[] = { OID_PKCS_1, 2 }, + _oidMd5Rsa[] = { OID_PKCS_1, 4 }, + _oidSha1Rsa[] = { OID_PKCS_1, 5 }, + _oidSha256Rsa[] = { OID_PKCS_1, 11 }, + _oidEcPubKey[] = { OID_PUBLIC_KEY_TYPE, 1 }, + _oidSha1Ecdsa[] = { OID_EC_SIG_TYPE, 1 }, /* rfc3279 */ + _oidSha224Ecdsa[] = { OID_ECDSA_WITH_SHA2, 1 }, /* rfc5758 */ + _oidSha256Ecdsa[] = { OID_ECDSA_WITH_SHA2, 2 }, /* rfc5758 */ + _oidSha384Ecdsa[] = { OID_ECDSA_WITH_SHA2, 3 }, /* rfc5758 */ + _oidSha512Ecdsa[] = { OID_ECDSA_WITH_SHA2, 4 }, /* rfc5758 */ + _oidMd2[] = { OID_RSA_HASH, 2 }, + _oidMd4[] = { OID_RSA_HASH, 4 }, + _oidMd5[] = { OID_RSA_HASH, 5 }, + _oidSha1[] = { OID_OIW_ALGORITHM, 26 }, + _oidSha256[] = { OID_NIST_HASHALG, 1 }, + _oidSha384[] = { OID_NIST_HASHALG, 2 }, + _oidSha512[] = { OID_NIST_HASHALG, 3 }, + _oidSha224[] = { OID_NIST_HASHALG, 4 }; + +const DERItem + oidRsa = { (DERByte *)_oidRsa, + sizeof(_oidRsa) }, + oidMd2Rsa = { (DERByte *)_oidMd2Rsa, + sizeof(_oidMd2Rsa) }, + oidMd5Rsa = { (DERByte *)_oidMd5Rsa, + sizeof(_oidMd5Rsa) }, + oidSha1Rsa = { (DERByte *)_oidSha1Rsa, + sizeof(_oidSha1Rsa) }, + oidSha256Rsa = { (DERByte *)_oidSha256Rsa, + sizeof(_oidSha256Rsa) }, + oidEcPubKey = { (DERByte *)_oidEcPubKey, + sizeof(_oidEcPubKey) }, + oidSha1Ecdsa = { (DERByte *)_oidSha1Ecdsa, + sizeof(_oidSha1Ecdsa) }, + oidSha224Ecdsa = { (DERByte *)_oidSha224Ecdsa, + sizeof(_oidSha224Ecdsa) }, + oidSha256Ecdsa = { (DERByte *)_oidSha256Ecdsa, + sizeof(_oidSha256Ecdsa) }, + oidSha384Ecdsa = { (DERByte *)_oidSha384Ecdsa, + sizeof(_oidSha384Ecdsa) }, + oidSha512Ecdsa = { (DERByte *)_oidSha512Ecdsa, + sizeof(_oidSha512Ecdsa) }, + oidMd2 = { (DERByte *)_oidMd2, + sizeof(_oidMd2) }, + oidMd4 = { (DERByte *)_oidMd4, + sizeof(_oidMd4) }, + oidMd5 = { (DERByte *)_oidMd5, + sizeof(_oidMd5) }, + oidSha1 = { (DERByte *)_oidSha1, + sizeof(_oidSha1) }, + oidSha256 = { (DERByte *)_oidSha256, + sizeof(_oidSha256) }, + oidSha384 = { (DERByte *)_oidSha384, + sizeof(_oidSha384) }, + oidSha512 = { (DERByte *)_oidSha512, + sizeof(_oidSha512) }, + oidSha224 = { (DERByte *)_oidSha224, + sizeof(_oidSha224) }; + +/* Extension OIDs. */ +static const DERByte + _oidSubjectKeyIdentifier[] = { OID_EXTENSION, 14 }, + _oidKeyUsage[] = { OID_EXTENSION, 15 }, + _oidPrivateKeyUsagePeriod[] = { OID_EXTENSION, 16 }, + _oidSubjectAltName[] = { OID_EXTENSION, 17 }, + _oidIssuerAltName[] = { OID_EXTENSION, 18 }, + _oidBasicConstraints[] = { OID_EXTENSION, 19 }, + _oidCrlDistributionPoints[] = { OID_EXTENSION, 31 }, + _oidCertificatePolicies[] = { OID_EXTENSION, 32 }, + _oidAnyPolicy[] = { OID_EXTENSION, 32, 0 }, + _oidPolicyMappings[] = { OID_EXTENSION, 33 }, + _oidAuthorityKeyIdentifier[] = { OID_EXTENSION, 35 }, + _oidPolicyConstraints[] = { OID_EXTENSION, 36 }, + _oidExtendedKeyUsage[] = { OID_EXTENSION, 37 }, + _oidAnyExtendedKeyUsage[] = { OID_EXTENSION, 37, 0 }, + _oidInhibitAnyPolicy[] = { OID_EXTENSION, 54 }, + _oidAuthorityInfoAccess[] = { OID_PE, 1 }, + _oidSubjectInfoAccess[] = { OID_PE, 11 }, + _oidAdOCSP[] = { OID_AD_OCSP }, + _oidAdCAIssuer[] = { OID_AD_CAISSUERS }, + _oidNetscapeCertType[] = { NETSCAPE_CERT_EXTEN, 1 }, + _oidEntrustVersInfo[] = { ENTRUST_CERT_EXTEN, 0 }, + _oidMSNTPrincipalName[] = { MICROSOFT_ENROLLMENT_OID, 2, 3 }, + /* Policy Qualifier IDs for Internet policy qualifiers. */ + _oidQtCps[] = { OID_QT, 1 }, + _oidQtUNotice[] = { OID_QT, 2 }, + /* X.501 Name IDs. */ + _oidCommonName[] = { OID_ATTR_TYPE, 3 }, + _oidCountryName[] = { OID_ATTR_TYPE, 6 }, + _oidLocalityName[] = { OID_ATTR_TYPE, 7 }, + _oidStateOrProvinceName[] = { OID_ATTR_TYPE, 8 }, + _oidOrganizationName[] = { OID_ATTR_TYPE, 10 }, + _oidOrganizationalUnitName[] = { OID_ATTR_TYPE, 11 }, + _oidDescription[] = { OID_ATTR_TYPE, 13 }, + _oidEmailAddress[] = { OID_PKCS_9, 1 }, + _oidFriendlyName[] = { OID_PKCS_9, 20 }, + _oidLocalKeyId[] = { OID_PKCS_9, 21 }, + _oidExtendedKeyUsageServerAuth[] = { OID_KP, 1 }, + _oidExtendedKeyUsageClientAuth[] = { OID_KP, 2 }, + _oidExtendedKeyUsageCodeSigning[] = { OID_KP, 3 }, + _oidExtendedKeyUsageEmailProtection[] = { OID_KP, 4 }, + _oidExtendedKeyUsageOCSPSigning[] = { OID_KP, 9 }, + _oidExtendedKeyUsageIPSec[] = { OID_ISAKMP, 2, 2 }, + _oidExtendedKeyUsageMicrosoftSGC[] = { MICROSOFT_BASE_OID, 10, 3, 3 }, + _oidExtendedKeyUsageNetscapeSGC[] = { NETSCAPE_CERT_POLICY, 1 }, + _oidAppleSecureBootCertSpec[] = { APPLE_SBOOT_CERT_EXTEN_SBOOT_SPEC_OID }, + _oidAppleProvisioningProfile[] = {APPLE_PROVISIONING_PROFILE_OID }, + _oidAppleApplicationSigning[] = { APPLE_APP_SIGINING_OID }, + _oidAppleExtendedKeyUsageAppleID[] = { APPLE_EKU_APPLE_ID }, + _oidAppleIntmMarkerAppleID[] = { APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLEID }; + +const DERItem + oidSubjectKeyIdentifier = { (DERByte *)_oidSubjectKeyIdentifier, + sizeof(_oidSubjectKeyIdentifier) }, + oidKeyUsage = { (DERByte *)_oidKeyUsage, + sizeof(_oidKeyUsage) }, + oidPrivateKeyUsagePeriod = { (DERByte *)_oidPrivateKeyUsagePeriod, + sizeof(_oidPrivateKeyUsagePeriod) }, + oidSubjectAltName = { (DERByte *)_oidSubjectAltName, + sizeof(_oidSubjectAltName) }, + oidIssuerAltName = { (DERByte *)_oidIssuerAltName, + sizeof(_oidIssuerAltName) }, + oidBasicConstraints = { (DERByte *)_oidBasicConstraints, + sizeof(_oidBasicConstraints) }, + oidCrlDistributionPoints = { (DERByte *)_oidCrlDistributionPoints, + sizeof(_oidCrlDistributionPoints) }, + oidCertificatePolicies = { (DERByte *)_oidCertificatePolicies, + sizeof(_oidCertificatePolicies) }, + oidAnyPolicy = { (DERByte *)_oidAnyPolicy, + sizeof(_oidAnyPolicy) }, + oidPolicyMappings = { (DERByte *)_oidPolicyMappings, + sizeof(_oidPolicyMappings) }, + oidAuthorityKeyIdentifier = { (DERByte *)_oidAuthorityKeyIdentifier, + sizeof(_oidAuthorityKeyIdentifier) }, + oidPolicyConstraints = { (DERByte *)_oidPolicyConstraints, + sizeof(_oidPolicyConstraints) }, + oidExtendedKeyUsage = { (DERByte *)_oidExtendedKeyUsage, + sizeof(_oidExtendedKeyUsage) }, + oidAnyExtendedKeyUsage = { (DERByte *)_oidAnyExtendedKeyUsage, + sizeof(_oidAnyExtendedKeyUsage) }, + oidInhibitAnyPolicy = { (DERByte *)_oidInhibitAnyPolicy, + sizeof(_oidInhibitAnyPolicy) }, + oidAuthorityInfoAccess = { (DERByte *)_oidAuthorityInfoAccess, + sizeof(_oidAuthorityInfoAccess) }, + oidSubjectInfoAccess = { (DERByte *)_oidSubjectInfoAccess, + sizeof(_oidSubjectInfoAccess) }, + oidAdOCSP = { (DERByte *)_oidAdOCSP, + sizeof(_oidAdOCSP) }, + oidAdCAIssuer = { (DERByte *)_oidAdCAIssuer, + sizeof(_oidAdCAIssuer) }, + oidNetscapeCertType = { (DERByte *)_oidNetscapeCertType, + sizeof(_oidNetscapeCertType) }, + oidEntrustVersInfo = { (DERByte *)_oidEntrustVersInfo, + sizeof(_oidEntrustVersInfo) }, + oidMSNTPrincipalName = { (DERByte *)_oidMSNTPrincipalName, + sizeof(_oidMSNTPrincipalName) }, + /* Policy Qualifier IDs for Internet policy qualifiers. */ + oidQtCps = { (DERByte *)_oidQtCps, + sizeof(_oidQtCps) }, + oidQtUNotice = { (DERByte *)_oidQtUNotice, + sizeof(_oidQtUNotice) }, + /* X.501 Name IDs. */ + oidCommonName = { (DERByte *)_oidCommonName, + sizeof(_oidCommonName) }, + oidCountryName = { (DERByte *)_oidCountryName, + sizeof(_oidCountryName) }, + oidLocalityName = { (DERByte *)_oidLocalityName, + sizeof(_oidLocalityName) }, + oidStateOrProvinceName = { (DERByte *)_oidStateOrProvinceName, + sizeof(_oidStateOrProvinceName) }, + oidOrganizationName = { (DERByte *)_oidOrganizationName, + sizeof(_oidOrganizationName) }, + oidOrganizationalUnitName = { (DERByte *)_oidOrganizationalUnitName, + sizeof(_oidOrganizationalUnitName) }, + oidDescription = { (DERByte *)_oidDescription, + sizeof(_oidDescription) }, + oidEmailAddress = { (DERByte *)_oidEmailAddress, + sizeof(_oidEmailAddress) }, + oidFriendlyName = { (DERByte *)_oidFriendlyName, + sizeof(_oidFriendlyName) }, + oidLocalKeyId = { (DERByte *)_oidLocalKeyId, + sizeof(_oidLocalKeyId) }, + oidExtendedKeyUsageServerAuth = { (DERByte *)_oidExtendedKeyUsageServerAuth, + sizeof(_oidExtendedKeyUsageServerAuth) }, + oidExtendedKeyUsageClientAuth = { (DERByte *)_oidExtendedKeyUsageClientAuth, + sizeof(_oidExtendedKeyUsageClientAuth) }, + oidExtendedKeyUsageCodeSigning = { (DERByte *)_oidExtendedKeyUsageCodeSigning, + sizeof(_oidExtendedKeyUsageCodeSigning) }, + oidExtendedKeyUsageEmailProtection = { (DERByte *)_oidExtendedKeyUsageEmailProtection, + sizeof(_oidExtendedKeyUsageEmailProtection) }, + oidExtendedKeyUsageOCSPSigning = { (DERByte *)_oidExtendedKeyUsageOCSPSigning, + sizeof(_oidExtendedKeyUsageOCSPSigning) }, + oidExtendedKeyUsageIPSec = { (DERByte *)_oidExtendedKeyUsageIPSec, + sizeof(_oidExtendedKeyUsageIPSec) }, + oidExtendedKeyUsageMicrosoftSGC = { (DERByte *)_oidExtendedKeyUsageMicrosoftSGC, + sizeof(_oidExtendedKeyUsageMicrosoftSGC) }, + oidExtendedKeyUsageNetscapeSGC = { (DERByte *)_oidExtendedKeyUsageNetscapeSGC, + sizeof(_oidExtendedKeyUsageNetscapeSGC) }, + oidAppleSecureBootCertSpec = { (DERByte *)_oidAppleSecureBootCertSpec, + sizeof(_oidAppleSecureBootCertSpec) }, + oidAppleProvisioningProfile = { (DERByte *)_oidAppleProvisioningProfile, + sizeof(_oidAppleProvisioningProfile) }, + oidAppleApplicationSigning = { (DERByte *)_oidAppleApplicationSigning, + sizeof(_oidAppleApplicationSigning) }, + oidAppleExtendedKeyUsageAppleID = { (DERByte *)_oidAppleExtendedKeyUsageAppleID, + sizeof(_oidAppleExtendedKeyUsageAppleID) }, + oidAppleIntmMarkerAppleID = { (DERByte *)_oidAppleIntmMarkerAppleID, + sizeof(_oidAppleIntmMarkerAppleID) }; + + +bool DEROidCompare(const DERItem *oid1, const DERItem *oid2) { + if ((oid1 == NULL) || (oid2 == NULL)) { + return false; + } + if (oid1->length != oid2->length) { + return false; + } + if (!DERMemcmp(oid1->data, oid2->data, oid1->length)) { + return true; + } else { + return false; + } +} ADDED Source/libDER/libDER/oids.h Index: Source/libDER/libDER/oids.h ================================================================== --- /dev/null +++ Source/libDER/libDER/oids.h @@ -0,0 +1,101 @@ +/* Copyright (c) 2005-2009 Apple Inc. All Rights Reserved. */ + +/* + * oids.h - declaration of OID consts + * + * Created Nov. 11 2005 by dmitch + */ + +#ifndef _LIB_DER_OIDS_H_ +#define _LIB_DER_OIDS_H_ + +#include "libDER.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Algorithm oids. */ +extern const DERItem + oidRsa, /* PKCS1 RSA encryption, used to identify RSA keys */ + oidMd2Rsa, /* PKCS1 md2withRSAEncryption signature alg */ + oidMd5Rsa, /* PKCS1 md5withRSAEncryption signature alg */ + oidSha1Rsa, /* PKCS1 sha1withRSAEncryption signature alg */ + oidSha256Rsa, /* PKCS1 sha256WithRSAEncryption signature alg */ + oidEcPubKey, /* ECDH or ECDSA public key in a certificate */ + oidSha1Ecdsa, /* ECDSA with SHA1 signature alg */ + oidSha224Ecdsa, /* ECDSA with SHA224 signature alg */ + oidSha256Ecdsa, /* ECDSA with SHA256 signature alg */ + oidSha384Ecdsa, /* ECDSA with SHA384 signature alg */ + oidSha512Ecdsa, /* ECDSA with SHA512 signature alg */ + oidMd2, /* OID_RSA_HASH 2 */ + oidMd4, /* OID_RSA_HASH 4 */ + oidMd5, /* OID_RSA_HASH 5 */ + oidSha1, /* OID_OIW_ALGORITHM 26 */ + oidSha256, /* OID_NIST_HASHALG 1 */ + oidSha384, /* OID_NIST_HASHALG 2 */ + oidSha512, /* OID_NIST_HASHALG 3 */ + oidSha224; /* OID_NIST_HASHALG 4 */ + +/* Standard X.509 Cert and CRL extensions. */ +extern const DERItem + oidSubjectKeyIdentifier, + oidKeyUsage, + oidPrivateKeyUsagePeriod, + oidSubjectAltName, + oidIssuerAltName, + oidBasicConstraints, + oidCrlDistributionPoints, + oidCertificatePolicies, + oidAnyPolicy, + oidPolicyMappings, + oidAuthorityKeyIdentifier, + oidPolicyConstraints, + oidExtendedKeyUsage, + oidAnyExtendedKeyUsage, + oidInhibitAnyPolicy, + oidAuthorityInfoAccess, + oidSubjectInfoAccess, + oidAdOCSP, + oidAdCAIssuer, + oidNetscapeCertType, + oidEntrustVersInfo, + oidMSNTPrincipalName, + /* Policy Qualifier IDs for Internet policy qualifiers. */ + oidQtCps, + oidQtUNotice, + /* X.501 Name IDs. */ + oidCommonName, + oidCountryName, + oidLocalityName, + oidStateOrProvinceName, + oidOrganizationName, + oidOrganizationalUnitName, + oidDescription, + oidEmailAddress, + oidFriendlyName, + oidLocalKeyId, + oidExtendedKeyUsageServerAuth, + oidExtendedKeyUsageClientAuth, + oidExtendedKeyUsageCodeSigning, + oidExtendedKeyUsageEmailProtection, + oidExtendedKeyUsageOCSPSigning, + oidExtendedKeyUsageIPSec, + oidExtendedKeyUsageMicrosoftSGC, + oidExtendedKeyUsageNetscapeSGC, + /* Secure Boot Spec oid */ + oidAppleSecureBootCertSpec, + oidAppleProvisioningProfile, + oidAppleApplicationSigning, + oidAppleExtendedKeyUsageAppleID, + oidAppleIntmMarkerAppleID; + +/* Compare two decoded OIDs. Returns true iff they are equivalent. */ +bool DEROidCompare(const DERItem *oid1, const DERItem *oid2); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIB_DER_UTILS_H_ */ ADDED Source/libDER/libDERUtils/fileIo.c Index: Source/libDER/libDERUtils/fileIo.c ================================================================== --- /dev/null +++ Source/libDER/libDERUtils/fileIo.c @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2005-2007,2010 Apple Inc. All Rights Reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "fileIo.h" + +int writeFile( + const char *fileName, + const unsigned char *bytes, + unsigned numBytes) +{ + int rtn; + int fd; + + fd = open(fileName, O_RDWR | O_CREAT | O_TRUNC, 0600); + if(fd <= 0) { + return errno; + } + rtn = write(fd, bytes, (size_t)numBytes); + if(rtn != (int)numBytes) { + if(rtn >= 0) { + fprintf(stderr, "writeFile: short write\n"); + } + rtn = EIO; + } + else { + rtn = 0; + } + close(fd); + return rtn; +} + +/* + * Read entire file. + */ +int readFile( + const char *fileName, + unsigned char **bytes, // mallocd and returned + unsigned *numBytes) // returned +{ + int rtn; + int fd; + char *buf; + struct stat sb; + size_t size; + + *numBytes = 0; + *bytes = NULL; + fd = open(fileName, O_RDONLY, 0); + if(fd <= 0) { + return errno; + } + rtn = fstat(fd, &sb); + if(rtn) { + goto errOut; + } + size = (size_t) sb.st_size; + buf = (char *)malloc(size); + if(buf == NULL) { + rtn = ENOMEM; + goto errOut; + } + rtn = read(fd, buf, (size_t)size); + if(rtn != (int)size) { + if(rtn >= 0) { + fprintf(stderr, "readFile: short read\n"); + } + rtn = EIO; + } + else { + rtn = 0; + *bytes = (unsigned char *)buf; + *numBytes = size; + } +errOut: + close(fd); + return rtn; +} ADDED Source/libDER/libDERUtils/fileIo.h Index: Source/libDER/libDERUtils/fileIo.h ================================================================== --- /dev/null +++ Source/libDER/libDERUtils/fileIo.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2005-2007,2010 Apple Inc. All Rights Reserved. + */ + +#ifndef _DER_FILE_IO_H_ +#define _DER_FILE_IO_H_ + +/* + * Read entire file. + */ +#ifdef __cplusplus +extern "C" { +#endif + +int readFile( + const char *fileName, + unsigned char **bytes, // mallocd and returned + unsigned *numBytes); // returned + +int writeFile( + const char *fileName, + const unsigned char *bytes, + unsigned numBytes); + +#ifdef __cplusplus +} +#endif + +#endif /* _DER_FILE_IO_H_ */ ADDED Source/libDER/libDERUtils/libDERUtils.c Index: Source/libDER/libDERUtils/libDERUtils.c ================================================================== --- /dev/null +++ Source/libDER/libDERUtils/libDERUtils.c @@ -0,0 +1,36 @@ +/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */ + +/* + * libDERUtils.c - support routines for libDER tests & examples + * + * Created Nov. 7 2005 by dmitch + */ + +#include +#include + +const char *DERReturnString( + DERReturn drtn) +{ + static char unknown[128]; + + switch(drtn) { + case DR_Success: return "DR_Success"; + case DR_EndOfSequence: return "DR_EndOfSequence"; + case DR_UnexpectedTag: return "DR_UnexpectedTag"; + case DR_DecodeError: return "DR_DecodeError"; + case DR_Unimplemented: return "DR_Unimplemented"; + case DR_IncompleteSeq: return "DR_IncompleteSeq"; + default: + sprintf(unknown, "Unknown error (%d)", (int)drtn); + return unknown; + } +} + +void DERPerror( + const char *op, + DERReturn drtn) +{ + fprintf(stderr, "*** %s: %s\n", op, DERReturnString(drtn)); +} + ADDED Source/libDER/libDERUtils/libDERUtils.h Index: Source/libDER/libDERUtils/libDERUtils.h ================================================================== --- /dev/null +++ Source/libDER/libDERUtils/libDERUtils.h @@ -0,0 +1,29 @@ +/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */ + +/* + * libDERUtils.h - support routines for libDER tests & examples + * + * Created Nov. 7 2005 by dmitch + */ + +#ifndef _LIB_DER_UTILS_H_ +#define _LIB_DER_UTILS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +const char *DERReturnString( + DERReturn drtn); + +void DERPerror( + const char *op, + DERReturn rtn); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIB_DER_UTILS_H_ */ ADDED Source/libDER/libDERUtils/printFields.c Index: Source/libDER/libDERUtils/printFields.c ================================================================== --- /dev/null +++ Source/libDER/libDERUtils/printFields.c @@ -0,0 +1,343 @@ +/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */ + +/* + * printFeilds.h - print various DER objects + * + * Created Nov. 9 2005 by dmitch + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static int indentLevel = 0; + +void doIndent() +{ + int i; + for (i = 0; ilength; + + printf("<%u> ", item->length); + if(toPrint > TO_PRINT_MAX) { + toPrint = TO_PRINT_MAX; + } + for(dex=0; dexdata[dex]); + } + if(item->length > TO_PRINT_MAX) { + printf("..."); + } + printf("\n"); +} + +void printBitString( + DERItem *item) +{ + unsigned dex; + unsigned toPrint = item->length; + DERItem bitStringBytes; + DERByte numUnused; + DERReturn drtn; + + drtn = DERParseBitString(item, &bitStringBytes, &numUnused); + if(drtn) { + DERPerror("DERParseBitString", drtn); + return; + } + + printf("<%u, %u> ", bitStringBytes.length, numUnused); + toPrint = bitStringBytes.length; + if(toPrint > TO_PRINT_MAX) { + toPrint = TO_PRINT_MAX; + } + for(dex=0; dexlength > TO_PRINT_MAX) { + printf("..."); + } + printf("\n"); +} + +void printString( + DERItem *item) +{ + unsigned dex; + char *cp = (char *)item->data; + printf("'"); + for(dex=0; dexlength; dex++) { + putchar(*cp++); + } + printf("'\n"); + +} + +#define COLON_COLUMN 20 + +/* + * Print line header, with current indent, followed by specified label, followed + * by a ':' in column COLON_COLUMN, followed by one space. + */ +void printHeader( + const char *label) +{ + unsigned numPrinted; + + doIndent(); + printf("%s", label); + numPrinted = indentLevel + strlen(label); + if(numPrinted < COLON_COLUMN) { + unsigned numSpaces = COLON_COLUMN - numPrinted; + unsigned dex; + for(dex=0; dex + +#ifdef __cplusplus +extern "C" { +#endif + +void doIndent(); +void incrIndent(); +void decrIndent(); +void printHex(DERItem *item); +void printBitString(DERItem *item); +void printString(DERItem *item); +void printHeader(const char *label); + +typedef enum { + IT_Leaf, // leaf; always print contents + IT_Branch // branch; print contents iff verbose +} ItemType; + +void printItem( + const char *label, + ItemType itemType, + int verbose, + DERTag tag, // maybe from decoding, maybe the real tag underlying + // an implicitly tagged item + DERItem *item); // content + +void printAlgId( + const DERItem *content, + int verbose); +void printSubjPubKeyInfo( + const DERItem *content, + int verbose); + +/* decode one item and print it */ +void decodePrintItem( + const char *label, + ItemType itemType, + int verbose, + DERItem *derItem); + +#ifdef __cplusplus +} +#endif + +#endif /* _PRINT_FIELDS_H_ */ DELETED Source/libtomcrypt/doc/footer.html Index: Source/libtomcrypt/doc/footer.html ================================================================== --- Source/libtomcrypt/doc/footer.html +++ /dev/null @@ -1,10 +0,0 @@ -
-Code by Tom
-Docs using doxygen - - - DELETED Source/libtomcrypt/doc/header.html Index: Source/libtomcrypt/doc/header.html ================================================================== --- Source/libtomcrypt/doc/header.html +++ /dev/null @@ -1,12 +0,0 @@ - - -LibTomCrypt: Main Page - - - - - DELETED Source/libtomcrypt/src/ciphers/RC4/rc4.h Index: Source/libtomcrypt/src/ciphers/RC4/rc4.h ================================================================== --- Source/libtomcrypt/src/ciphers/RC4/rc4.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved. - * - * The contents of this file constitute Original Code as defined in and are - * subject to the Apple Public Source License Version 1.2 (the 'License'). - * You may not use this file except in compliance with the License. Please obtain - * a copy of the License at http://www.apple.com/publicsource and read it before - * using this file. - * - * This Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS - * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT - * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the - * specific language governing rights and limitations under the License. - */ - - -/* crypto/rc4/rc4.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef HEADER_RC4_H -#define HEADER_RC4_H - -#include -#include -//#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef NO_RC4 -#error RC4 is disabled. -#endif - - -typedef uint32_t RC4_INT; - -/* and we'll map to unique function names to avoid collisions with libcrypto */ -// #define RC4_set_key CC_RC4_set_key -// #define RC4 CC_RC4 - - -#define RC4_MIN_KEY_SIZE_BYTES 1 -#define RC4_MAX_KEY_SIZE_BYTES 512 - -typedef struct rc4_key_st - { - RC4_INT x,y; - RC4_INT data[256]; - } RC4_KEY; - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void CC_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); - -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) -void CC_RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, - unsigned char *outdata); - -#ifdef __cplusplus -} -#endif - -#endif DELETED Source/libtomcrypt/src/ciphers/RC4/rc4_enc.c Index: Source/libtomcrypt/src/ciphers/RC4/rc4_enc.c ================================================================== --- Source/libtomcrypt/src/ciphers/RC4/rc4_enc.c +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved. - * - * The contents of this file constitute Original Code as defined in and are - * subject to the Apple Public Source License Version 1.2 (the 'License'). - * You may not use this file except in compliance with the License. Please obtain - * a copy of the License at http://www.apple.com/publicsource and read it before - * using this file. - * - * This Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS - * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT - * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the - * specific language governing rights and limitations under the License. - */ - - -/* crypto/rc4/rc4_enc.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include "rc4.h" - -/* RC4 as implemented from a posting from - * Newsgroups: sci.crypt - * From: sterndark@netcom.com (David Sterndark) - * Subject: RC4 Algorithm revealed. - * Message-ID: - * Date: Wed, 14 Sep 1994 06:35:31 GMT - */ - -void CC_RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, - unsigned char *outdata) - { - register RC4_INT *d; - register RC4_INT x,y,tx,ty; - int i; - - x=key->x; - y=key->y; - d=key->data; - -#if defined(RC4_CHUNK) - /* - * The original reason for implementing this(*) was the fact that - * pre-21164a Alpha CPUs don't have byte load/store instructions - * and e.g. a byte store has to be done with 64-bit load, shift, - * and, or and finally 64-bit store. Peaking data and operating - * at natural word size made it possible to reduce amount of - * instructions as well as to perform early read-ahead without - * suffering from RAW (read-after-write) hazard. This resulted - * in ~40%(**) performance improvement on 21064 box with gcc. - * But it's not only Alpha users who win here:-) Thanks to the - * early-n-wide read-ahead this implementation also exhibits - * >40% speed-up on SPARC and 20-30% on 64-bit MIPS (depending - * on sizeof(RC4_INT)). - * - * (*) "this" means code which recognizes the case when input - * and output pointers appear to be aligned at natural CPU - * word boundary - * (**) i.e. according to 'apps/openssl speed rc4' benchmark, - * crypto/rc4/rc4speed.c exhibits almost 70% speed-up... - * - * Cavets. - * - * - RC4_CHUNK="unsigned long long" should be a #1 choice for - * UltraSPARC. Unfortunately gcc generates very slow code - * (2.5-3 times slower than one generated by Sun's WorkShop - * C) and therefore gcc (at least 2.95 and earlier) should - * always be told that RC4_CHUNK="unsigned long". - * - * - */ - -# define RC4_STEP ( \ - x=(x+1) &0xff, \ - tx=d[x], \ - y=(tx+y)&0xff, \ - ty=d[y], \ - d[y]=tx, \ - d[x]=ty, \ - (RC4_CHUNK)d[(tx+ty)&0xff]\ - ) - - if ( ( ((unsigned long)indata & (sizeof(RC4_CHUNK)-1)) | - ((unsigned long)outdata & (sizeof(RC4_CHUNK)-1)) ) == 0 ) - { - RC4_CHUNK ichunk,otp; - const union { long one; char little; } is_endian = {1}; - - /* - * I reckon we can afford to implement both endian - * cases and to decide which way to take at run-time - * because the machine code appears to be very compact - * and redundant 1-2KB is perfectly tolerable (i.e. - * in case the compiler fails to eliminate it:-). By - * suggestion from Terrel Larson - * who also stands for the is_endian union:-) - * - * Special notes. - * - * - is_endian is declared automatic as doing otherwise - * (declaring static) prevents gcc from eliminating - * the redundant code; - * - compilers (those I've tried) don't seem to have - * problems eliminating either the operators guarded - * by "if (sizeof(RC4_CHUNK)==8)" or the condition - * expressions themselves so I've got 'em to replace - * corresponding #ifdefs from the previous version; - * - I chose to let the redundant switch cases when - * sizeof(RC4_CHUNK)!=8 be (were also #ifdefed - * before); - * - in case you wonder "&(sizeof(RC4_CHUNK)*8-1)" in - * [LB]ESHFT guards against "shift is out of range" - * warnings when sizeof(RC4_CHUNK)!=8 - * - * - */ - if (!is_endian.little) - { /* BIG-ENDIAN CASE */ -# define BESHFT(c) (((sizeof(RC4_CHUNK)-(c)-1)*8)&(sizeof(RC4_CHUNK)*8-1)) - for (;len&-sizeof(RC4_CHUNK);len-=sizeof(RC4_CHUNK)) - { - ichunk = *(RC4_CHUNK *)indata; - otp = RC4_STEP<x=x; - key->y=y; - return; - } /* big-endian */ - else - { /* LITTLE-ENDIAN CASE */ -# define LESHFT(c) (((c)*8)&(sizeof(RC4_CHUNK)*8-1)) - for (;len&-sizeof(RC4_CHUNK);len-=sizeof(RC4_CHUNK)) - { - ichunk = *(RC4_CHUNK *)indata; - otp = RC4_STEP; - otp |= RC4_STEP<<8; - otp |= RC4_STEP<<16; - otp |= RC4_STEP<<24; - if (sizeof(RC4_CHUNK)==8) - { - otp |= RC4_STEP<>= (sizeof(RC4_CHUNK)-len)<<3; - switch (len&(sizeof(RC4_CHUNK)-1)) - { - case 7: otp = RC4_STEP, i+=8; - case 6: otp |= RC4_STEP<x=x; - key->y=y; - return; - } /* little-endian */ - } -#endif -#define LOOP(in,out) \ - x=((x+1)&0xff); \ - tx=d[x]; \ - y=(tx+y)&0xff; \ - d[x]=ty=d[y]; \ - d[y]=tx; \ - (out) = d[(tx+ty)&0xff]^ (in); - -#ifndef RC4_INDEX -#define RC4_LOOP(a,b,i) LOOP(*((a)++),*((b)++)) -#else -#define RC4_LOOP(a,b,i) LOOP(a[i],b[i]) -#endif - - i=(int)(len>>3L); - if (i) - { - for (;;) - { - RC4_LOOP(indata,outdata,0); - RC4_LOOP(indata,outdata,1); - RC4_LOOP(indata,outdata,2); - RC4_LOOP(indata,outdata,3); - RC4_LOOP(indata,outdata,4); - RC4_LOOP(indata,outdata,5); - RC4_LOOP(indata,outdata,6); - RC4_LOOP(indata,outdata,7); -#ifdef RC4_INDEX - indata+=8; - outdata+=8; -#endif - if (--i == 0) break; - } - } - i=(int)len&0x07; - if (i) - { - for (;;) - { - RC4_LOOP(indata,outdata,0); if (--i == 0) break; - RC4_LOOP(indata,outdata,1); if (--i == 0) break; - RC4_LOOP(indata,outdata,2); if (--i == 0) break; - RC4_LOOP(indata,outdata,3); if (--i == 0) break; - RC4_LOOP(indata,outdata,4); if (--i == 0) break; - RC4_LOOP(indata,outdata,5); if (--i == 0) break; - RC4_LOOP(indata,outdata,6); if (--i == 0) break; - } - } - key->x=x; - key->y=y; - } DELETED Source/libtomcrypt/src/ciphers/RC4/rc4_skey.c Index: Source/libtomcrypt/src/ciphers/RC4/rc4_skey.c ================================================================== --- Source/libtomcrypt/src/ciphers/RC4/rc4_skey.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved. - * - * The contents of this file constitute Original Code as defined in and are - * subject to the Apple Public Source License Version 1.2 (the 'License'). - * You may not use this file except in compliance with the License. Please obtain - * a copy of the License at http://www.apple.com/publicsource and read it before - * using this file. - * - * This Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS - * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT - * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the - * specific language governing rights and limitations under the License. - */ - - -/* crypto/rc4/rc4_skey.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include "rc4.h" - - -/* RC4 as implemented from a posting from - * Newsgroups: sci.crypt - * From: sterndark@netcom.com (David Sterndark) - * Subject: RC4 Algorithm revealed. - * Message-ID: - * Date: Wed, 14 Sep 1994 06:35:31 GMT - */ - -void CC_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) - { - register RC4_INT tmp; - register int id1,id2; - register RC4_INT *d; - unsigned int i; - - d= &(key->data[0]); - for (i=0; i<256; i++) - d[i]=i; - key->x = 0; - key->y = 0; - id1=id2=0; - -#define SK_LOOP(n) { \ - tmp=d[(n)]; \ - id2 = (data[id1] + tmp + id2) & 0xff; \ - if (++id1 == len) id1=0; \ - d[(n)]=d[id2]; \ - d[id2]=tmp; } - - for (i=0; i < 256; i+=4) - { - SK_LOOP(i+0); - SK_LOOP(i+1); - SK_LOOP(i+2); - SK_LOOP(i+3); - } - } - DELETED Source/libtomcrypt/src/ciphers/aesedpport/AES.s Index: Source/libtomcrypt/src/ciphers/aesedpport/AES.s ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/AES.s +++ /dev/null @@ -1,145 +0,0 @@ -/* AES.s -- Core AES routines for Intel processors. - - Written by Eric Postpischil, January 30, 2008. -*/ -#if defined __i386__ || defined __x86_64__ - - -/* We build these AES routines as a single module because the routines refer - to labels in Data.s and it is easier and faster to refer to them as local - labels. In my implementations of AES for CommonCrypto, both i386 and - x86_64 use position-independent code. For this in-kernel implementation, - i386 has been converted to absolute addressing, but x86_64 still uses PIC. - - A local label can be referred to with position-independent assembler - expressions such as "label-base(register)", where is a local label - whose address has been loaded into . (On i386, this is typically - done with the idiom of a call to the next instruction and a pop of that - return address into a register.) Without local labels, the references must - be done using spaces for addresses of "lazy symbols" that are filled in by - the dynamic loader and loaded by the code that wants the address. - - So the various routines in other files are assembled here via #include - directives. -*/ -#include "Data.s" - - -#define TableSize (256*4) - /* Each of the arrays defined in Data.s except for the round constants - in _AESRcon is composed of four tables of 256 entries of four bytes - each. TableSize is the number of bytes in one of those four tables. - */ - - -// Include constants describing the AES context structures. -#include "Context.h" - - -/* Define a macro to select a value based on architecture. This reduces - some of the architecture conditionalization later in the source. -*/ -#if defined __i386__ - #define Arch(i386, x86_64) i386 -#elif defined __x86_64__ - #define Arch(i386, x86_64) x86_64 -#endif - - -// Define an instruction for moving pointers. -#define movp Arch(movd, movd) - // Latter argument should be "movq", but the assembler uses "movd". - - -/* Rename the general registers. This makes it easier to keep track of them - and provides names for the "whole register" that are uniform between i386 - and x86_64. -*/ -#if defined __i386__ - #define r0 %eax // Available for any use. - #define r1 %ecx // Available for any use, some special purposes (loop). - #define r2 %edx // Available for any use. - #define r3 %ebx // Must be preserved by called routine. - #define r4 %esp // Stack pointer. - #define r5 %ebp // Frame pointer, must preserve, no bare indirect. - #define r6 %esi // Must be preserved by called routine. - #define r7 %edi // Must be preserved by called routine. -#elif defined __x86_64__ - #define r0 %rax // Available for any use. - #define r1 %rcx // Available for any use. - #define r2 %rdx // Available for any use. - #define r3 %rbx // Must be preserved by called routine. - #define r4 %rsp // Stack pointer. - #define r5 %rbp // Frame pointer. Must be preserved by called routine. - #define r6 %rsi // Available for any use. - #define r7 %rdi // Available for any use. - #define r8 %r8 // Available for any use. - #define r9 %r9 // Available for any use. - #define r10 %r10 // Available for any use. - #define r11 %r11 // Available for any use. - #define r12 %r12 // Must be preserved by called routine. - #define r13 %r13 // Must be preserved by called routine. - #define r14 %r14 // Must be preserved by called routine. - #define r15 %r15 // Must be preserved by called routine. -#else - #error "Unknown architecture." -#endif - -// Define names for parts of registers. - -#define r0d %eax // Low 32 bits of r0. -#define r1d %ecx // Low 32 bits of r1. -#define r2d %edx // Low 32 bits of r2. -#define r3d %ebx // Low 32 bits of r3. -#define r5d %ebp // Low 32 bits of r5. -#define r6d %esi // Low 32 bits of r6. -#define r7d %edi // Low 32 bits of r7. -#define r8d %r8d // Low 32 bits of r8. -#define r9d %r9d // Low 32 bits of r9. -#define r11d %r11d // Low 32 bits of r11. - -#define r0l %al // Low byte of r0. -#define r1l %cl // Low byte of r1. -#define r2l %dl // Low byte of r2. -#define r3l %bl // Low byte of r3. -#define r5l %bpl // Low byte of r5. - -#define r0h %ah // Second lowest byte of r0. -#define r1h %ch // Second lowest byte of r1. -#define r2h %dh // Second lowest byte of r2. -#define r3h %bh // Second lowest byte of r3. - - - .text - - -// Define encryption routine, _AESEncryptWithExpandedKey -#define Select 0 -#include "EncryptDecrypt.s" -#undef Select - - -// Define decryption routine, _AESDecryptWithExpandedKey -#define Select 1 -#include "EncryptDecrypt.s" -#undef Select - -// Define encryption routine, _AESEncryptWithExpandedKey -#define Select 2 -#include "EncryptDecrypt.s" -#undef Select - - -// Define decryption routine, _AESDecryptWithExpandedKey -#define Select 3 -#include "EncryptDecrypt.s" -#undef Select - - -// Define key expansion routine for encryption, _AESExpandKeyForEncryption. -#include "ExpandKeyForEncryption.s" - - -// Define key expansion for decryption routine, _AESExpandKeyForDecryption. -#include "ExpandKeyForDecryption.s" -#endif /* x86 based build */ DELETED Source/libtomcrypt/src/ciphers/aesedpport/Context.h Index: Source/libtomcrypt/src/ciphers/aesedpport/Context.h ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/Context.h +++ /dev/null @@ -1,9 +0,0 @@ -// Define byte offset of key within context structure. -#define ContextKey 0 - -/* Define byte offset of key length within context structure. The number - stored there is the number of bytes from the start of the first round key - to the start of the last round key. That is 16 less than the number of - bytes in the entire key. -*/ -#define ContextKeyLength 240 DELETED Source/libtomcrypt/src/ciphers/aesedpport/Data.s Index: Source/libtomcrypt/src/ciphers/aesedpport/Data.s ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/Data.s +++ /dev/null @@ -1,5196 +0,0 @@ -// This file was generated by MakeData.c. - - - .const - - -// Round constants. - .globl _AESRcon - .private_extern _AESRcon -_AESRcon: - .byte 0 // Not used, included for indexing simplicity. - .byte 0x01 - .byte 0x02 - .byte 0x04 - .byte 0x08 - .byte 0x10 - .byte 0x20 - .byte 0x40 - .byte 0x80 - .byte 0x1b - .byte 0x36 - - -// Tables for InvMixColumn. - .globl _AESInvMixColumnTable - .private_extern _AESInvMixColumnTable - .align 2 -_AESInvMixColumnTable: - // Table 0. - .long 0x00000000 - .long 0x0b0d090e - .long 0x161a121c - .long 0x1d171b12 - .long 0x2c342438 - .long 0x27392d36 - .long 0x3a2e3624 - .long 0x31233f2a - .long 0x58684870 - .long 0x5365417e - .long 0x4e725a6c - .long 0x457f5362 - .long 0x745c6c48 - .long 0x7f516546 - .long 0x62467e54 - .long 0x694b775a - .long 0xb0d090e0 - .long 0xbbdd99ee - .long 0xa6ca82fc - .long 0xadc78bf2 - .long 0x9ce4b4d8 - .long 0x97e9bdd6 - .long 0x8afea6c4 - .long 0x81f3afca - .long 0xe8b8d890 - .long 0xe3b5d19e - .long 0xfea2ca8c - .long 0xf5afc382 - .long 0xc48cfca8 - .long 0xcf81f5a6 - .long 0xd296eeb4 - .long 0xd99be7ba - .long 0x7bbb3bdb - .long 0x70b632d5 - .long 0x6da129c7 - .long 0x66ac20c9 - .long 0x578f1fe3 - .long 0x5c8216ed - .long 0x41950dff - .long 0x4a9804f1 - .long 0x23d373ab - .long 0x28de7aa5 - .long 0x35c961b7 - .long 0x3ec468b9 - .long 0x0fe75793 - .long 0x04ea5e9d - .long 0x19fd458f - .long 0x12f04c81 - .long 0xcb6bab3b - .long 0xc066a235 - .long 0xdd71b927 - .long 0xd67cb029 - .long 0xe75f8f03 - .long 0xec52860d - .long 0xf1459d1f - .long 0xfa489411 - .long 0x9303e34b - .long 0x980eea45 - .long 0x8519f157 - .long 0x8e14f859 - .long 0xbf37c773 - .long 0xb43ace7d - .long 0xa92dd56f - .long 0xa220dc61 - .long 0xf66d76ad - .long 0xfd607fa3 - .long 0xe07764b1 - .long 0xeb7a6dbf - .long 0xda595295 - .long 0xd1545b9b - .long 0xcc434089 - .long 0xc74e4987 - .long 0xae053edd - .long 0xa50837d3 - .long 0xb81f2cc1 - .long 0xb31225cf - .long 0x82311ae5 - .long 0x893c13eb - .long 0x942b08f9 - .long 0x9f2601f7 - .long 0x46bde64d - .long 0x4db0ef43 - .long 0x50a7f451 - .long 0x5baafd5f - .long 0x6a89c275 - .long 0x6184cb7b - .long 0x7c93d069 - .long 0x779ed967 - .long 0x1ed5ae3d - .long 0x15d8a733 - .long 0x08cfbc21 - .long 0x03c2b52f - .long 0x32e18a05 - .long 0x39ec830b - .long 0x24fb9819 - .long 0x2ff69117 - .long 0x8dd64d76 - .long 0x86db4478 - .long 0x9bcc5f6a - .long 0x90c15664 - .long 0xa1e2694e - .long 0xaaef6040 - .long 0xb7f87b52 - .long 0xbcf5725c - .long 0xd5be0506 - .long 0xdeb30c08 - .long 0xc3a4171a - .long 0xc8a91e14 - .long 0xf98a213e - .long 0xf2872830 - .long 0xef903322 - .long 0xe49d3a2c - .long 0x3d06dd96 - .long 0x360bd498 - .long 0x2b1ccf8a - .long 0x2011c684 - .long 0x1132f9ae - .long 0x1a3ff0a0 - .long 0x0728ebb2 - .long 0x0c25e2bc - .long 0x656e95e6 - .long 0x6e639ce8 - .long 0x737487fa - .long 0x78798ef4 - .long 0x495ab1de - .long 0x4257b8d0 - .long 0x5f40a3c2 - .long 0x544daacc - .long 0xf7daec41 - .long 0xfcd7e54f - .long 0xe1c0fe5d - .long 0xeacdf753 - .long 0xdbeec879 - .long 0xd0e3c177 - .long 0xcdf4da65 - .long 0xc6f9d36b - .long 0xafb2a431 - .long 0xa4bfad3f - .long 0xb9a8b62d - .long 0xb2a5bf23 - .long 0x83868009 - .long 0x888b8907 - .long 0x959c9215 - .long 0x9e919b1b - .long 0x470a7ca1 - .long 0x4c0775af - .long 0x51106ebd - .long 0x5a1d67b3 - .long 0x6b3e5899 - .long 0x60335197 - .long 0x7d244a85 - .long 0x7629438b - .long 0x1f6234d1 - .long 0x146f3ddf - .long 0x097826cd - .long 0x02752fc3 - .long 0x335610e9 - .long 0x385b19e7 - .long 0x254c02f5 - .long 0x2e410bfb - .long 0x8c61d79a - .long 0x876cde94 - .long 0x9a7bc586 - .long 0x9176cc88 - .long 0xa055f3a2 - .long 0xab58faac - .long 0xb64fe1be - .long 0xbd42e8b0 - .long 0xd4099fea - .long 0xdf0496e4 - .long 0xc2138df6 - .long 0xc91e84f8 - .long 0xf83dbbd2 - .long 0xf330b2dc - .long 0xee27a9ce - .long 0xe52aa0c0 - .long 0x3cb1477a - .long 0x37bc4e74 - .long 0x2aab5566 - .long 0x21a65c68 - .long 0x10856342 - .long 0x1b886a4c - .long 0x069f715e - .long 0x0d927850 - .long 0x64d90f0a - .long 0x6fd40604 - .long 0x72c31d16 - .long 0x79ce1418 - .long 0x48ed2b32 - .long 0x43e0223c - .long 0x5ef7392e - .long 0x55fa3020 - .long 0x01b79aec - .long 0x0aba93e2 - .long 0x17ad88f0 - .long 0x1ca081fe - .long 0x2d83bed4 - .long 0x268eb7da - .long 0x3b99acc8 - .long 0x3094a5c6 - .long 0x59dfd29c - .long 0x52d2db92 - .long 0x4fc5c080 - .long 0x44c8c98e - .long 0x75ebf6a4 - .long 0x7ee6ffaa - .long 0x63f1e4b8 - .long 0x68fcedb6 - .long 0xb1670a0c - .long 0xba6a0302 - .long 0xa77d1810 - .long 0xac70111e - .long 0x9d532e34 - .long 0x965e273a - .long 0x8b493c28 - .long 0x80443526 - .long 0xe90f427c - .long 0xe2024b72 - .long 0xff155060 - .long 0xf418596e - .long 0xc53b6644 - .long 0xce366f4a - .long 0xd3217458 - .long 0xd82c7d56 - .long 0x7a0ca137 - .long 0x7101a839 - .long 0x6c16b32b - .long 0x671bba25 - .long 0x5638850f - .long 0x5d358c01 - .long 0x40229713 - .long 0x4b2f9e1d - .long 0x2264e947 - .long 0x2969e049 - .long 0x347efb5b - .long 0x3f73f255 - .long 0x0e50cd7f - .long 0x055dc471 - .long 0x184adf63 - .long 0x1347d66d - .long 0xcadc31d7 - .long 0xc1d138d9 - .long 0xdcc623cb - .long 0xd7cb2ac5 - .long 0xe6e815ef - .long 0xede51ce1 - .long 0xf0f207f3 - .long 0xfbff0efd - .long 0x92b479a7 - .long 0x99b970a9 - .long 0x84ae6bbb - .long 0x8fa362b5 - .long 0xbe805d9f - .long 0xb58d5491 - .long 0xa89a4f83 - .long 0xa397468d - // Table 1. - .long 0x00000000 - .long 0x0d090e0b - .long 0x1a121c16 - .long 0x171b121d - .long 0x3424382c - .long 0x392d3627 - .long 0x2e36243a - .long 0x233f2a31 - .long 0x68487058 - .long 0x65417e53 - .long 0x725a6c4e - .long 0x7f536245 - .long 0x5c6c4874 - .long 0x5165467f - .long 0x467e5462 - .long 0x4b775a69 - .long 0xd090e0b0 - .long 0xdd99eebb - .long 0xca82fca6 - .long 0xc78bf2ad - .long 0xe4b4d89c - .long 0xe9bdd697 - .long 0xfea6c48a - .long 0xf3afca81 - .long 0xb8d890e8 - .long 0xb5d19ee3 - .long 0xa2ca8cfe - .long 0xafc382f5 - .long 0x8cfca8c4 - .long 0x81f5a6cf - .long 0x96eeb4d2 - .long 0x9be7bad9 - .long 0xbb3bdb7b - .long 0xb632d570 - .long 0xa129c76d - .long 0xac20c966 - .long 0x8f1fe357 - .long 0x8216ed5c - .long 0x950dff41 - .long 0x9804f14a - .long 0xd373ab23 - .long 0xde7aa528 - .long 0xc961b735 - .long 0xc468b93e - .long 0xe757930f - .long 0xea5e9d04 - .long 0xfd458f19 - .long 0xf04c8112 - .long 0x6bab3bcb - .long 0x66a235c0 - .long 0x71b927dd - .long 0x7cb029d6 - .long 0x5f8f03e7 - .long 0x52860dec - .long 0x459d1ff1 - .long 0x489411fa - .long 0x03e34b93 - .long 0x0eea4598 - .long 0x19f15785 - .long 0x14f8598e - .long 0x37c773bf - .long 0x3ace7db4 - .long 0x2dd56fa9 - .long 0x20dc61a2 - .long 0x6d76adf6 - .long 0x607fa3fd - .long 0x7764b1e0 - .long 0x7a6dbfeb - .long 0x595295da - .long 0x545b9bd1 - .long 0x434089cc - .long 0x4e4987c7 - .long 0x053eddae - .long 0x0837d3a5 - .long 0x1f2cc1b8 - .long 0x1225cfb3 - .long 0x311ae582 - .long 0x3c13eb89 - .long 0x2b08f994 - .long 0x2601f79f - .long 0xbde64d46 - .long 0xb0ef434d - .long 0xa7f45150 - .long 0xaafd5f5b - .long 0x89c2756a - .long 0x84cb7b61 - .long 0x93d0697c - .long 0x9ed96777 - .long 0xd5ae3d1e - .long 0xd8a73315 - .long 0xcfbc2108 - .long 0xc2b52f03 - .long 0xe18a0532 - .long 0xec830b39 - .long 0xfb981924 - .long 0xf691172f - .long 0xd64d768d - .long 0xdb447886 - .long 0xcc5f6a9b - .long 0xc1566490 - .long 0xe2694ea1 - .long 0xef6040aa - .long 0xf87b52b7 - .long 0xf5725cbc - .long 0xbe0506d5 - .long 0xb30c08de - .long 0xa4171ac3 - .long 0xa91e14c8 - .long 0x8a213ef9 - .long 0x872830f2 - .long 0x903322ef - .long 0x9d3a2ce4 - .long 0x06dd963d - .long 0x0bd49836 - .long 0x1ccf8a2b - .long 0x11c68420 - .long 0x32f9ae11 - .long 0x3ff0a01a - .long 0x28ebb207 - .long 0x25e2bc0c - .long 0x6e95e665 - .long 0x639ce86e - .long 0x7487fa73 - .long 0x798ef478 - .long 0x5ab1de49 - .long 0x57b8d042 - .long 0x40a3c25f - .long 0x4daacc54 - .long 0xdaec41f7 - .long 0xd7e54ffc - .long 0xc0fe5de1 - .long 0xcdf753ea - .long 0xeec879db - .long 0xe3c177d0 - .long 0xf4da65cd - .long 0xf9d36bc6 - .long 0xb2a431af - .long 0xbfad3fa4 - .long 0xa8b62db9 - .long 0xa5bf23b2 - .long 0x86800983 - .long 0x8b890788 - .long 0x9c921595 - .long 0x919b1b9e - .long 0x0a7ca147 - .long 0x0775af4c - .long 0x106ebd51 - .long 0x1d67b35a - .long 0x3e58996b - .long 0x33519760 - .long 0x244a857d - .long 0x29438b76 - .long 0x6234d11f - .long 0x6f3ddf14 - .long 0x7826cd09 - .long 0x752fc302 - .long 0x5610e933 - .long 0x5b19e738 - .long 0x4c02f525 - .long 0x410bfb2e - .long 0x61d79a8c - .long 0x6cde9487 - .long 0x7bc5869a - .long 0x76cc8891 - .long 0x55f3a2a0 - .long 0x58faacab - .long 0x4fe1beb6 - .long 0x42e8b0bd - .long 0x099fead4 - .long 0x0496e4df - .long 0x138df6c2 - .long 0x1e84f8c9 - .long 0x3dbbd2f8 - .long 0x30b2dcf3 - .long 0x27a9ceee - .long 0x2aa0c0e5 - .long 0xb1477a3c - .long 0xbc4e7437 - .long 0xab55662a - .long 0xa65c6821 - .long 0x85634210 - .long 0x886a4c1b - .long 0x9f715e06 - .long 0x9278500d - .long 0xd90f0a64 - .long 0xd406046f - .long 0xc31d1672 - .long 0xce141879 - .long 0xed2b3248 - .long 0xe0223c43 - .long 0xf7392e5e - .long 0xfa302055 - .long 0xb79aec01 - .long 0xba93e20a - .long 0xad88f017 - .long 0xa081fe1c - .long 0x83bed42d - .long 0x8eb7da26 - .long 0x99acc83b - .long 0x94a5c630 - .long 0xdfd29c59 - .long 0xd2db9252 - .long 0xc5c0804f - .long 0xc8c98e44 - .long 0xebf6a475 - .long 0xe6ffaa7e - .long 0xf1e4b863 - .long 0xfcedb668 - .long 0x670a0cb1 - .long 0x6a0302ba - .long 0x7d1810a7 - .long 0x70111eac - .long 0x532e349d - .long 0x5e273a96 - .long 0x493c288b - .long 0x44352680 - .long 0x0f427ce9 - .long 0x024b72e2 - .long 0x155060ff - .long 0x18596ef4 - .long 0x3b6644c5 - .long 0x366f4ace - .long 0x217458d3 - .long 0x2c7d56d8 - .long 0x0ca1377a - .long 0x01a83971 - .long 0x16b32b6c - .long 0x1bba2567 - .long 0x38850f56 - .long 0x358c015d - .long 0x22971340 - .long 0x2f9e1d4b - .long 0x64e94722 - .long 0x69e04929 - .long 0x7efb5b34 - .long 0x73f2553f - .long 0x50cd7f0e - .long 0x5dc47105 - .long 0x4adf6318 - .long 0x47d66d13 - .long 0xdc31d7ca - .long 0xd138d9c1 - .long 0xc623cbdc - .long 0xcb2ac5d7 - .long 0xe815efe6 - .long 0xe51ce1ed - .long 0xf207f3f0 - .long 0xff0efdfb - .long 0xb479a792 - .long 0xb970a999 - .long 0xae6bbb84 - .long 0xa362b58f - .long 0x805d9fbe - .long 0x8d5491b5 - .long 0x9a4f83a8 - .long 0x97468da3 - // Table 2. - .long 0x00000000 - .long 0x090e0b0d - .long 0x121c161a - .long 0x1b121d17 - .long 0x24382c34 - .long 0x2d362739 - .long 0x36243a2e - .long 0x3f2a3123 - .long 0x48705868 - .long 0x417e5365 - .long 0x5a6c4e72 - .long 0x5362457f - .long 0x6c48745c - .long 0x65467f51 - .long 0x7e546246 - .long 0x775a694b - .long 0x90e0b0d0 - .long 0x99eebbdd - .long 0x82fca6ca - .long 0x8bf2adc7 - .long 0xb4d89ce4 - .long 0xbdd697e9 - .long 0xa6c48afe - .long 0xafca81f3 - .long 0xd890e8b8 - .long 0xd19ee3b5 - .long 0xca8cfea2 - .long 0xc382f5af - .long 0xfca8c48c - .long 0xf5a6cf81 - .long 0xeeb4d296 - .long 0xe7bad99b - .long 0x3bdb7bbb - .long 0x32d570b6 - .long 0x29c76da1 - .long 0x20c966ac - .long 0x1fe3578f - .long 0x16ed5c82 - .long 0x0dff4195 - .long 0x04f14a98 - .long 0x73ab23d3 - .long 0x7aa528de - .long 0x61b735c9 - .long 0x68b93ec4 - .long 0x57930fe7 - .long 0x5e9d04ea - .long 0x458f19fd - .long 0x4c8112f0 - .long 0xab3bcb6b - .long 0xa235c066 - .long 0xb927dd71 - .long 0xb029d67c - .long 0x8f03e75f - .long 0x860dec52 - .long 0x9d1ff145 - .long 0x9411fa48 - .long 0xe34b9303 - .long 0xea45980e - .long 0xf1578519 - .long 0xf8598e14 - .long 0xc773bf37 - .long 0xce7db43a - .long 0xd56fa92d - .long 0xdc61a220 - .long 0x76adf66d - .long 0x7fa3fd60 - .long 0x64b1e077 - .long 0x6dbfeb7a - .long 0x5295da59 - .long 0x5b9bd154 - .long 0x4089cc43 - .long 0x4987c74e - .long 0x3eddae05 - .long 0x37d3a508 - .long 0x2cc1b81f - .long 0x25cfb312 - .long 0x1ae58231 - .long 0x13eb893c - .long 0x08f9942b - .long 0x01f79f26 - .long 0xe64d46bd - .long 0xef434db0 - .long 0xf45150a7 - .long 0xfd5f5baa - .long 0xc2756a89 - .long 0xcb7b6184 - .long 0xd0697c93 - .long 0xd967779e - .long 0xae3d1ed5 - .long 0xa73315d8 - .long 0xbc2108cf - .long 0xb52f03c2 - .long 0x8a0532e1 - .long 0x830b39ec - .long 0x981924fb - .long 0x91172ff6 - .long 0x4d768dd6 - .long 0x447886db - .long 0x5f6a9bcc - .long 0x566490c1 - .long 0x694ea1e2 - .long 0x6040aaef - .long 0x7b52b7f8 - .long 0x725cbcf5 - .long 0x0506d5be - .long 0x0c08deb3 - .long 0x171ac3a4 - .long 0x1e14c8a9 - .long 0x213ef98a - .long 0x2830f287 - .long 0x3322ef90 - .long 0x3a2ce49d - .long 0xdd963d06 - .long 0xd498360b - .long 0xcf8a2b1c - .long 0xc6842011 - .long 0xf9ae1132 - .long 0xf0a01a3f - .long 0xebb20728 - .long 0xe2bc0c25 - .long 0x95e6656e - .long 0x9ce86e63 - .long 0x87fa7374 - .long 0x8ef47879 - .long 0xb1de495a - .long 0xb8d04257 - .long 0xa3c25f40 - .long 0xaacc544d - .long 0xec41f7da - .long 0xe54ffcd7 - .long 0xfe5de1c0 - .long 0xf753eacd - .long 0xc879dbee - .long 0xc177d0e3 - .long 0xda65cdf4 - .long 0xd36bc6f9 - .long 0xa431afb2 - .long 0xad3fa4bf - .long 0xb62db9a8 - .long 0xbf23b2a5 - .long 0x80098386 - .long 0x8907888b - .long 0x9215959c - .long 0x9b1b9e91 - .long 0x7ca1470a - .long 0x75af4c07 - .long 0x6ebd5110 - .long 0x67b35a1d - .long 0x58996b3e - .long 0x51976033 - .long 0x4a857d24 - .long 0x438b7629 - .long 0x34d11f62 - .long 0x3ddf146f - .long 0x26cd0978 - .long 0x2fc30275 - .long 0x10e93356 - .long 0x19e7385b - .long 0x02f5254c - .long 0x0bfb2e41 - .long 0xd79a8c61 - .long 0xde94876c - .long 0xc5869a7b - .long 0xcc889176 - .long 0xf3a2a055 - .long 0xfaacab58 - .long 0xe1beb64f - .long 0xe8b0bd42 - .long 0x9fead409 - .long 0x96e4df04 - .long 0x8df6c213 - .long 0x84f8c91e - .long 0xbbd2f83d - .long 0xb2dcf330 - .long 0xa9ceee27 - .long 0xa0c0e52a - .long 0x477a3cb1 - .long 0x4e7437bc - .long 0x55662aab - .long 0x5c6821a6 - .long 0x63421085 - .long 0x6a4c1b88 - .long 0x715e069f - .long 0x78500d92 - .long 0x0f0a64d9 - .long 0x06046fd4 - .long 0x1d1672c3 - .long 0x141879ce - .long 0x2b3248ed - .long 0x223c43e0 - .long 0x392e5ef7 - .long 0x302055fa - .long 0x9aec01b7 - .long 0x93e20aba - .long 0x88f017ad - .long 0x81fe1ca0 - .long 0xbed42d83 - .long 0xb7da268e - .long 0xacc83b99 - .long 0xa5c63094 - .long 0xd29c59df - .long 0xdb9252d2 - .long 0xc0804fc5 - .long 0xc98e44c8 - .long 0xf6a475eb - .long 0xffaa7ee6 - .long 0xe4b863f1 - .long 0xedb668fc - .long 0x0a0cb167 - .long 0x0302ba6a - .long 0x1810a77d - .long 0x111eac70 - .long 0x2e349d53 - .long 0x273a965e - .long 0x3c288b49 - .long 0x35268044 - .long 0x427ce90f - .long 0x4b72e202 - .long 0x5060ff15 - .long 0x596ef418 - .long 0x6644c53b - .long 0x6f4ace36 - .long 0x7458d321 - .long 0x7d56d82c - .long 0xa1377a0c - .long 0xa8397101 - .long 0xb32b6c16 - .long 0xba25671b - .long 0x850f5638 - .long 0x8c015d35 - .long 0x97134022 - .long 0x9e1d4b2f - .long 0xe9472264 - .long 0xe0492969 - .long 0xfb5b347e - .long 0xf2553f73 - .long 0xcd7f0e50 - .long 0xc471055d - .long 0xdf63184a - .long 0xd66d1347 - .long 0x31d7cadc - .long 0x38d9c1d1 - .long 0x23cbdcc6 - .long 0x2ac5d7cb - .long 0x15efe6e8 - .long 0x1ce1ede5 - .long 0x07f3f0f2 - .long 0x0efdfbff - .long 0x79a792b4 - .long 0x70a999b9 - .long 0x6bbb84ae - .long 0x62b58fa3 - .long 0x5d9fbe80 - .long 0x5491b58d - .long 0x4f83a89a - .long 0x468da397 - // Table 3. - .long 0x00000000 - .long 0x0e0b0d09 - .long 0x1c161a12 - .long 0x121d171b - .long 0x382c3424 - .long 0x3627392d - .long 0x243a2e36 - .long 0x2a31233f - .long 0x70586848 - .long 0x7e536541 - .long 0x6c4e725a - .long 0x62457f53 - .long 0x48745c6c - .long 0x467f5165 - .long 0x5462467e - .long 0x5a694b77 - .long 0xe0b0d090 - .long 0xeebbdd99 - .long 0xfca6ca82 - .long 0xf2adc78b - .long 0xd89ce4b4 - .long 0xd697e9bd - .long 0xc48afea6 - .long 0xca81f3af - .long 0x90e8b8d8 - .long 0x9ee3b5d1 - .long 0x8cfea2ca - .long 0x82f5afc3 - .long 0xa8c48cfc - .long 0xa6cf81f5 - .long 0xb4d296ee - .long 0xbad99be7 - .long 0xdb7bbb3b - .long 0xd570b632 - .long 0xc76da129 - .long 0xc966ac20 - .long 0xe3578f1f - .long 0xed5c8216 - .long 0xff41950d - .long 0xf14a9804 - .long 0xab23d373 - .long 0xa528de7a - .long 0xb735c961 - .long 0xb93ec468 - .long 0x930fe757 - .long 0x9d04ea5e - .long 0x8f19fd45 - .long 0x8112f04c - .long 0x3bcb6bab - .long 0x35c066a2 - .long 0x27dd71b9 - .long 0x29d67cb0 - .long 0x03e75f8f - .long 0x0dec5286 - .long 0x1ff1459d - .long 0x11fa4894 - .long 0x4b9303e3 - .long 0x45980eea - .long 0x578519f1 - .long 0x598e14f8 - .long 0x73bf37c7 - .long 0x7db43ace - .long 0x6fa92dd5 - .long 0x61a220dc - .long 0xadf66d76 - .long 0xa3fd607f - .long 0xb1e07764 - .long 0xbfeb7a6d - .long 0x95da5952 - .long 0x9bd1545b - .long 0x89cc4340 - .long 0x87c74e49 - .long 0xddae053e - .long 0xd3a50837 - .long 0xc1b81f2c - .long 0xcfb31225 - .long 0xe582311a - .long 0xeb893c13 - .long 0xf9942b08 - .long 0xf79f2601 - .long 0x4d46bde6 - .long 0x434db0ef - .long 0x5150a7f4 - .long 0x5f5baafd - .long 0x756a89c2 - .long 0x7b6184cb - .long 0x697c93d0 - .long 0x67779ed9 - .long 0x3d1ed5ae - .long 0x3315d8a7 - .long 0x2108cfbc - .long 0x2f03c2b5 - .long 0x0532e18a - .long 0x0b39ec83 - .long 0x1924fb98 - .long 0x172ff691 - .long 0x768dd64d - .long 0x7886db44 - .long 0x6a9bcc5f - .long 0x6490c156 - .long 0x4ea1e269 - .long 0x40aaef60 - .long 0x52b7f87b - .long 0x5cbcf572 - .long 0x06d5be05 - .long 0x08deb30c - .long 0x1ac3a417 - .long 0x14c8a91e - .long 0x3ef98a21 - .long 0x30f28728 - .long 0x22ef9033 - .long 0x2ce49d3a - .long 0x963d06dd - .long 0x98360bd4 - .long 0x8a2b1ccf - .long 0x842011c6 - .long 0xae1132f9 - .long 0xa01a3ff0 - .long 0xb20728eb - .long 0xbc0c25e2 - .long 0xe6656e95 - .long 0xe86e639c - .long 0xfa737487 - .long 0xf478798e - .long 0xde495ab1 - .long 0xd04257b8 - .long 0xc25f40a3 - .long 0xcc544daa - .long 0x41f7daec - .long 0x4ffcd7e5 - .long 0x5de1c0fe - .long 0x53eacdf7 - .long 0x79dbeec8 - .long 0x77d0e3c1 - .long 0x65cdf4da - .long 0x6bc6f9d3 - .long 0x31afb2a4 - .long 0x3fa4bfad - .long 0x2db9a8b6 - .long 0x23b2a5bf - .long 0x09838680 - .long 0x07888b89 - .long 0x15959c92 - .long 0x1b9e919b - .long 0xa1470a7c - .long 0xaf4c0775 - .long 0xbd51106e - .long 0xb35a1d67 - .long 0x996b3e58 - .long 0x97603351 - .long 0x857d244a - .long 0x8b762943 - .long 0xd11f6234 - .long 0xdf146f3d - .long 0xcd097826 - .long 0xc302752f - .long 0xe9335610 - .long 0xe7385b19 - .long 0xf5254c02 - .long 0xfb2e410b - .long 0x9a8c61d7 - .long 0x94876cde - .long 0x869a7bc5 - .long 0x889176cc - .long 0xa2a055f3 - .long 0xacab58fa - .long 0xbeb64fe1 - .long 0xb0bd42e8 - .long 0xead4099f - .long 0xe4df0496 - .long 0xf6c2138d - .long 0xf8c91e84 - .long 0xd2f83dbb - .long 0xdcf330b2 - .long 0xceee27a9 - .long 0xc0e52aa0 - .long 0x7a3cb147 - .long 0x7437bc4e - .long 0x662aab55 - .long 0x6821a65c - .long 0x42108563 - .long 0x4c1b886a - .long 0x5e069f71 - .long 0x500d9278 - .long 0x0a64d90f - .long 0x046fd406 - .long 0x1672c31d - .long 0x1879ce14 - .long 0x3248ed2b - .long 0x3c43e022 - .long 0x2e5ef739 - .long 0x2055fa30 - .long 0xec01b79a - .long 0xe20aba93 - .long 0xf017ad88 - .long 0xfe1ca081 - .long 0xd42d83be - .long 0xda268eb7 - .long 0xc83b99ac - .long 0xc63094a5 - .long 0x9c59dfd2 - .long 0x9252d2db - .long 0x804fc5c0 - .long 0x8e44c8c9 - .long 0xa475ebf6 - .long 0xaa7ee6ff - .long 0xb863f1e4 - .long 0xb668fced - .long 0x0cb1670a - .long 0x02ba6a03 - .long 0x10a77d18 - .long 0x1eac7011 - .long 0x349d532e - .long 0x3a965e27 - .long 0x288b493c - .long 0x26804435 - .long 0x7ce90f42 - .long 0x72e2024b - .long 0x60ff1550 - .long 0x6ef41859 - .long 0x44c53b66 - .long 0x4ace366f - .long 0x58d32174 - .long 0x56d82c7d - .long 0x377a0ca1 - .long 0x397101a8 - .long 0x2b6c16b3 - .long 0x25671bba - .long 0x0f563885 - .long 0x015d358c - .long 0x13402297 - .long 0x1d4b2f9e - .long 0x472264e9 - .long 0x492969e0 - .long 0x5b347efb - .long 0x553f73f2 - .long 0x7f0e50cd - .long 0x71055dc4 - .long 0x63184adf - .long 0x6d1347d6 - .long 0xd7cadc31 - .long 0xd9c1d138 - .long 0xcbdcc623 - .long 0xc5d7cb2a - .long 0xefe6e815 - .long 0xe1ede51c - .long 0xf3f0f207 - .long 0xfdfbff0e - .long 0xa792b479 - .long 0xa999b970 - .long 0xbb84ae6b - .long 0xb58fa362 - .long 0x9fbe805d - .long 0x91b58d54 - .long 0x83a89a4f - .long 0x8da39746 - - -// Tables for main encryption iterations. - .globl _AESEncryptTable - .private_extern _AESEncryptTable - .align 2 -_AESEncryptTable: - // Table 0. - .long 0xa56363c6 - .long 0x847c7cf8 - .long 0x997777ee - .long 0x8d7b7bf6 - .long 0x0df2f2ff - .long 0xbd6b6bd6 - .long 0xb16f6fde - .long 0x54c5c591 - .long 0x50303060 - .long 0x03010102 - .long 0xa96767ce - .long 0x7d2b2b56 - .long 0x19fefee7 - .long 0x62d7d7b5 - .long 0xe6abab4d - .long 0x9a7676ec - .long 0x45caca8f - .long 0x9d82821f - .long 0x40c9c989 - .long 0x877d7dfa - .long 0x15fafaef - .long 0xeb5959b2 - .long 0xc947478e - .long 0x0bf0f0fb - .long 0xecadad41 - .long 0x67d4d4b3 - .long 0xfda2a25f - .long 0xeaafaf45 - .long 0xbf9c9c23 - .long 0xf7a4a453 - .long 0x967272e4 - .long 0x5bc0c09b - .long 0xc2b7b775 - .long 0x1cfdfde1 - .long 0xae93933d - .long 0x6a26264c - .long 0x5a36366c - .long 0x413f3f7e - .long 0x02f7f7f5 - .long 0x4fcccc83 - .long 0x5c343468 - .long 0xf4a5a551 - .long 0x34e5e5d1 - .long 0x08f1f1f9 - .long 0x937171e2 - .long 0x73d8d8ab - .long 0x53313162 - .long 0x3f15152a - .long 0x0c040408 - .long 0x52c7c795 - .long 0x65232346 - .long 0x5ec3c39d - .long 0x28181830 - .long 0xa1969637 - .long 0x0f05050a - .long 0xb59a9a2f - .long 0x0907070e - .long 0x36121224 - .long 0x9b80801b - .long 0x3de2e2df - .long 0x26ebebcd - .long 0x6927274e - .long 0xcdb2b27f - .long 0x9f7575ea - .long 0x1b090912 - .long 0x9e83831d - .long 0x742c2c58 - .long 0x2e1a1a34 - .long 0x2d1b1b36 - .long 0xb26e6edc - .long 0xee5a5ab4 - .long 0xfba0a05b - .long 0xf65252a4 - .long 0x4d3b3b76 - .long 0x61d6d6b7 - .long 0xceb3b37d - .long 0x7b292952 - .long 0x3ee3e3dd - .long 0x712f2f5e - .long 0x97848413 - .long 0xf55353a6 - .long 0x68d1d1b9 - .long 0x00000000 - .long 0x2cededc1 - .long 0x60202040 - .long 0x1ffcfce3 - .long 0xc8b1b179 - .long 0xed5b5bb6 - .long 0xbe6a6ad4 - .long 0x46cbcb8d - .long 0xd9bebe67 - .long 0x4b393972 - .long 0xde4a4a94 - .long 0xd44c4c98 - .long 0xe85858b0 - .long 0x4acfcf85 - .long 0x6bd0d0bb - .long 0x2aefefc5 - .long 0xe5aaaa4f - .long 0x16fbfbed - .long 0xc5434386 - .long 0xd74d4d9a - .long 0x55333366 - .long 0x94858511 - .long 0xcf45458a - .long 0x10f9f9e9 - .long 0x06020204 - .long 0x817f7ffe - .long 0xf05050a0 - .long 0x443c3c78 - .long 0xba9f9f25 - .long 0xe3a8a84b - .long 0xf35151a2 - .long 0xfea3a35d - .long 0xc0404080 - .long 0x8a8f8f05 - .long 0xad92923f - .long 0xbc9d9d21 - .long 0x48383870 - .long 0x04f5f5f1 - .long 0xdfbcbc63 - .long 0xc1b6b677 - .long 0x75dadaaf - .long 0x63212142 - .long 0x30101020 - .long 0x1affffe5 - .long 0x0ef3f3fd - .long 0x6dd2d2bf - .long 0x4ccdcd81 - .long 0x140c0c18 - .long 0x35131326 - .long 0x2fececc3 - .long 0xe15f5fbe - .long 0xa2979735 - .long 0xcc444488 - .long 0x3917172e - .long 0x57c4c493 - .long 0xf2a7a755 - .long 0x827e7efc - .long 0x473d3d7a - .long 0xac6464c8 - .long 0xe75d5dba - .long 0x2b191932 - .long 0x957373e6 - .long 0xa06060c0 - .long 0x98818119 - .long 0xd14f4f9e - .long 0x7fdcdca3 - .long 0x66222244 - .long 0x7e2a2a54 - .long 0xab90903b - .long 0x8388880b - .long 0xca46468c - .long 0x29eeeec7 - .long 0xd3b8b86b - .long 0x3c141428 - .long 0x79dedea7 - .long 0xe25e5ebc - .long 0x1d0b0b16 - .long 0x76dbdbad - .long 0x3be0e0db - .long 0x56323264 - .long 0x4e3a3a74 - .long 0x1e0a0a14 - .long 0xdb494992 - .long 0x0a06060c - .long 0x6c242448 - .long 0xe45c5cb8 - .long 0x5dc2c29f - .long 0x6ed3d3bd - .long 0xefacac43 - .long 0xa66262c4 - .long 0xa8919139 - .long 0xa4959531 - .long 0x37e4e4d3 - .long 0x8b7979f2 - .long 0x32e7e7d5 - .long 0x43c8c88b - .long 0x5937376e - .long 0xb76d6dda - .long 0x8c8d8d01 - .long 0x64d5d5b1 - .long 0xd24e4e9c - .long 0xe0a9a949 - .long 0xb46c6cd8 - .long 0xfa5656ac - .long 0x07f4f4f3 - .long 0x25eaeacf - .long 0xaf6565ca - .long 0x8e7a7af4 - .long 0xe9aeae47 - .long 0x18080810 - .long 0xd5baba6f - .long 0x887878f0 - .long 0x6f25254a - .long 0x722e2e5c - .long 0x241c1c38 - .long 0xf1a6a657 - .long 0xc7b4b473 - .long 0x51c6c697 - .long 0x23e8e8cb - .long 0x7cdddda1 - .long 0x9c7474e8 - .long 0x211f1f3e - .long 0xdd4b4b96 - .long 0xdcbdbd61 - .long 0x868b8b0d - .long 0x858a8a0f - .long 0x907070e0 - .long 0x423e3e7c - .long 0xc4b5b571 - .long 0xaa6666cc - .long 0xd8484890 - .long 0x05030306 - .long 0x01f6f6f7 - .long 0x120e0e1c - .long 0xa36161c2 - .long 0x5f35356a - .long 0xf95757ae - .long 0xd0b9b969 - .long 0x91868617 - .long 0x58c1c199 - .long 0x271d1d3a - .long 0xb99e9e27 - .long 0x38e1e1d9 - .long 0x13f8f8eb - .long 0xb398982b - .long 0x33111122 - .long 0xbb6969d2 - .long 0x70d9d9a9 - .long 0x898e8e07 - .long 0xa7949433 - .long 0xb69b9b2d - .long 0x221e1e3c - .long 0x92878715 - .long 0x20e9e9c9 - .long 0x49cece87 - .long 0xff5555aa - .long 0x78282850 - .long 0x7adfdfa5 - .long 0x8f8c8c03 - .long 0xf8a1a159 - .long 0x80898909 - .long 0x170d0d1a - .long 0xdabfbf65 - .long 0x31e6e6d7 - .long 0xc6424284 - .long 0xb86868d0 - .long 0xc3414182 - .long 0xb0999929 - .long 0x772d2d5a - .long 0x110f0f1e - .long 0xcbb0b07b - .long 0xfc5454a8 - .long 0xd6bbbb6d - .long 0x3a16162c - // Table 1. - .long 0x6363c6a5 - .long 0x7c7cf884 - .long 0x7777ee99 - .long 0x7b7bf68d - .long 0xf2f2ff0d - .long 0x6b6bd6bd - .long 0x6f6fdeb1 - .long 0xc5c59154 - .long 0x30306050 - .long 0x01010203 - .long 0x6767cea9 - .long 0x2b2b567d - .long 0xfefee719 - .long 0xd7d7b562 - .long 0xabab4de6 - .long 0x7676ec9a - .long 0xcaca8f45 - .long 0x82821f9d - .long 0xc9c98940 - .long 0x7d7dfa87 - .long 0xfafaef15 - .long 0x5959b2eb - .long 0x47478ec9 - .long 0xf0f0fb0b - .long 0xadad41ec - .long 0xd4d4b367 - .long 0xa2a25ffd - .long 0xafaf45ea - .long 0x9c9c23bf - .long 0xa4a453f7 - .long 0x7272e496 - .long 0xc0c09b5b - .long 0xb7b775c2 - .long 0xfdfde11c - .long 0x93933dae - .long 0x26264c6a - .long 0x36366c5a - .long 0x3f3f7e41 - .long 0xf7f7f502 - .long 0xcccc834f - .long 0x3434685c - .long 0xa5a551f4 - .long 0xe5e5d134 - .long 0xf1f1f908 - .long 0x7171e293 - .long 0xd8d8ab73 - .long 0x31316253 - .long 0x15152a3f - .long 0x0404080c - .long 0xc7c79552 - .long 0x23234665 - .long 0xc3c39d5e - .long 0x18183028 - .long 0x969637a1 - .long 0x05050a0f - .long 0x9a9a2fb5 - .long 0x07070e09 - .long 0x12122436 - .long 0x80801b9b - .long 0xe2e2df3d - .long 0xebebcd26 - .long 0x27274e69 - .long 0xb2b27fcd - .long 0x7575ea9f - .long 0x0909121b - .long 0x83831d9e - .long 0x2c2c5874 - .long 0x1a1a342e - .long 0x1b1b362d - .long 0x6e6edcb2 - .long 0x5a5ab4ee - .long 0xa0a05bfb - .long 0x5252a4f6 - .long 0x3b3b764d - .long 0xd6d6b761 - .long 0xb3b37dce - .long 0x2929527b - .long 0xe3e3dd3e - .long 0x2f2f5e71 - .long 0x84841397 - .long 0x5353a6f5 - .long 0xd1d1b968 - .long 0x00000000 - .long 0xededc12c - .long 0x20204060 - .long 0xfcfce31f - .long 0xb1b179c8 - .long 0x5b5bb6ed - .long 0x6a6ad4be - .long 0xcbcb8d46 - .long 0xbebe67d9 - .long 0x3939724b - .long 0x4a4a94de - .long 0x4c4c98d4 - .long 0x5858b0e8 - .long 0xcfcf854a - .long 0xd0d0bb6b - .long 0xefefc52a - .long 0xaaaa4fe5 - .long 0xfbfbed16 - .long 0x434386c5 - .long 0x4d4d9ad7 - .long 0x33336655 - .long 0x85851194 - .long 0x45458acf - .long 0xf9f9e910 - .long 0x02020406 - .long 0x7f7ffe81 - .long 0x5050a0f0 - .long 0x3c3c7844 - .long 0x9f9f25ba - .long 0xa8a84be3 - .long 0x5151a2f3 - .long 0xa3a35dfe - .long 0x404080c0 - .long 0x8f8f058a - .long 0x92923fad - .long 0x9d9d21bc - .long 0x38387048 - .long 0xf5f5f104 - .long 0xbcbc63df - .long 0xb6b677c1 - .long 0xdadaaf75 - .long 0x21214263 - .long 0x10102030 - .long 0xffffe51a - .long 0xf3f3fd0e - .long 0xd2d2bf6d - .long 0xcdcd814c - .long 0x0c0c1814 - .long 0x13132635 - .long 0xececc32f - .long 0x5f5fbee1 - .long 0x979735a2 - .long 0x444488cc - .long 0x17172e39 - .long 0xc4c49357 - .long 0xa7a755f2 - .long 0x7e7efc82 - .long 0x3d3d7a47 - .long 0x6464c8ac - .long 0x5d5dbae7 - .long 0x1919322b - .long 0x7373e695 - .long 0x6060c0a0 - .long 0x81811998 - .long 0x4f4f9ed1 - .long 0xdcdca37f - .long 0x22224466 - .long 0x2a2a547e - .long 0x90903bab - .long 0x88880b83 - .long 0x46468cca - .long 0xeeeec729 - .long 0xb8b86bd3 - .long 0x1414283c - .long 0xdedea779 - .long 0x5e5ebce2 - .long 0x0b0b161d - .long 0xdbdbad76 - .long 0xe0e0db3b - .long 0x32326456 - .long 0x3a3a744e - .long 0x0a0a141e - .long 0x494992db - .long 0x06060c0a - .long 0x2424486c - .long 0x5c5cb8e4 - .long 0xc2c29f5d - .long 0xd3d3bd6e - .long 0xacac43ef - .long 0x6262c4a6 - .long 0x919139a8 - .long 0x959531a4 - .long 0xe4e4d337 - .long 0x7979f28b - .long 0xe7e7d532 - .long 0xc8c88b43 - .long 0x37376e59 - .long 0x6d6ddab7 - .long 0x8d8d018c - .long 0xd5d5b164 - .long 0x4e4e9cd2 - .long 0xa9a949e0 - .long 0x6c6cd8b4 - .long 0x5656acfa - .long 0xf4f4f307 - .long 0xeaeacf25 - .long 0x6565caaf - .long 0x7a7af48e - .long 0xaeae47e9 - .long 0x08081018 - .long 0xbaba6fd5 - .long 0x7878f088 - .long 0x25254a6f - .long 0x2e2e5c72 - .long 0x1c1c3824 - .long 0xa6a657f1 - .long 0xb4b473c7 - .long 0xc6c69751 - .long 0xe8e8cb23 - .long 0xdddda17c - .long 0x7474e89c - .long 0x1f1f3e21 - .long 0x4b4b96dd - .long 0xbdbd61dc - .long 0x8b8b0d86 - .long 0x8a8a0f85 - .long 0x7070e090 - .long 0x3e3e7c42 - .long 0xb5b571c4 - .long 0x6666ccaa - .long 0x484890d8 - .long 0x03030605 - .long 0xf6f6f701 - .long 0x0e0e1c12 - .long 0x6161c2a3 - .long 0x35356a5f - .long 0x5757aef9 - .long 0xb9b969d0 - .long 0x86861791 - .long 0xc1c19958 - .long 0x1d1d3a27 - .long 0x9e9e27b9 - .long 0xe1e1d938 - .long 0xf8f8eb13 - .long 0x98982bb3 - .long 0x11112233 - .long 0x6969d2bb - .long 0xd9d9a970 - .long 0x8e8e0789 - .long 0x949433a7 - .long 0x9b9b2db6 - .long 0x1e1e3c22 - .long 0x87871592 - .long 0xe9e9c920 - .long 0xcece8749 - .long 0x5555aaff - .long 0x28285078 - .long 0xdfdfa57a - .long 0x8c8c038f - .long 0xa1a159f8 - .long 0x89890980 - .long 0x0d0d1a17 - .long 0xbfbf65da - .long 0xe6e6d731 - .long 0x424284c6 - .long 0x6868d0b8 - .long 0x414182c3 - .long 0x999929b0 - .long 0x2d2d5a77 - .long 0x0f0f1e11 - .long 0xb0b07bcb - .long 0x5454a8fc - .long 0xbbbb6dd6 - .long 0x16162c3a - // Table 2. - .long 0x63c6a563 - .long 0x7cf8847c - .long 0x77ee9977 - .long 0x7bf68d7b - .long 0xf2ff0df2 - .long 0x6bd6bd6b - .long 0x6fdeb16f - .long 0xc59154c5 - .long 0x30605030 - .long 0x01020301 - .long 0x67cea967 - .long 0x2b567d2b - .long 0xfee719fe - .long 0xd7b562d7 - .long 0xab4de6ab - .long 0x76ec9a76 - .long 0xca8f45ca - .long 0x821f9d82 - .long 0xc98940c9 - .long 0x7dfa877d - .long 0xfaef15fa - .long 0x59b2eb59 - .long 0x478ec947 - .long 0xf0fb0bf0 - .long 0xad41ecad - .long 0xd4b367d4 - .long 0xa25ffda2 - .long 0xaf45eaaf - .long 0x9c23bf9c - .long 0xa453f7a4 - .long 0x72e49672 - .long 0xc09b5bc0 - .long 0xb775c2b7 - .long 0xfde11cfd - .long 0x933dae93 - .long 0x264c6a26 - .long 0x366c5a36 - .long 0x3f7e413f - .long 0xf7f502f7 - .long 0xcc834fcc - .long 0x34685c34 - .long 0xa551f4a5 - .long 0xe5d134e5 - .long 0xf1f908f1 - .long 0x71e29371 - .long 0xd8ab73d8 - .long 0x31625331 - .long 0x152a3f15 - .long 0x04080c04 - .long 0xc79552c7 - .long 0x23466523 - .long 0xc39d5ec3 - .long 0x18302818 - .long 0x9637a196 - .long 0x050a0f05 - .long 0x9a2fb59a - .long 0x070e0907 - .long 0x12243612 - .long 0x801b9b80 - .long 0xe2df3de2 - .long 0xebcd26eb - .long 0x274e6927 - .long 0xb27fcdb2 - .long 0x75ea9f75 - .long 0x09121b09 - .long 0x831d9e83 - .long 0x2c58742c - .long 0x1a342e1a - .long 0x1b362d1b - .long 0x6edcb26e - .long 0x5ab4ee5a - .long 0xa05bfba0 - .long 0x52a4f652 - .long 0x3b764d3b - .long 0xd6b761d6 - .long 0xb37dceb3 - .long 0x29527b29 - .long 0xe3dd3ee3 - .long 0x2f5e712f - .long 0x84139784 - .long 0x53a6f553 - .long 0xd1b968d1 - .long 0x00000000 - .long 0xedc12ced - .long 0x20406020 - .long 0xfce31ffc - .long 0xb179c8b1 - .long 0x5bb6ed5b - .long 0x6ad4be6a - .long 0xcb8d46cb - .long 0xbe67d9be - .long 0x39724b39 - .long 0x4a94de4a - .long 0x4c98d44c - .long 0x58b0e858 - .long 0xcf854acf - .long 0xd0bb6bd0 - .long 0xefc52aef - .long 0xaa4fe5aa - .long 0xfbed16fb - .long 0x4386c543 - .long 0x4d9ad74d - .long 0x33665533 - .long 0x85119485 - .long 0x458acf45 - .long 0xf9e910f9 - .long 0x02040602 - .long 0x7ffe817f - .long 0x50a0f050 - .long 0x3c78443c - .long 0x9f25ba9f - .long 0xa84be3a8 - .long 0x51a2f351 - .long 0xa35dfea3 - .long 0x4080c040 - .long 0x8f058a8f - .long 0x923fad92 - .long 0x9d21bc9d - .long 0x38704838 - .long 0xf5f104f5 - .long 0xbc63dfbc - .long 0xb677c1b6 - .long 0xdaaf75da - .long 0x21426321 - .long 0x10203010 - .long 0xffe51aff - .long 0xf3fd0ef3 - .long 0xd2bf6dd2 - .long 0xcd814ccd - .long 0x0c18140c - .long 0x13263513 - .long 0xecc32fec - .long 0x5fbee15f - .long 0x9735a297 - .long 0x4488cc44 - .long 0x172e3917 - .long 0xc49357c4 - .long 0xa755f2a7 - .long 0x7efc827e - .long 0x3d7a473d - .long 0x64c8ac64 - .long 0x5dbae75d - .long 0x19322b19 - .long 0x73e69573 - .long 0x60c0a060 - .long 0x81199881 - .long 0x4f9ed14f - .long 0xdca37fdc - .long 0x22446622 - .long 0x2a547e2a - .long 0x903bab90 - .long 0x880b8388 - .long 0x468cca46 - .long 0xeec729ee - .long 0xb86bd3b8 - .long 0x14283c14 - .long 0xdea779de - .long 0x5ebce25e - .long 0x0b161d0b - .long 0xdbad76db - .long 0xe0db3be0 - .long 0x32645632 - .long 0x3a744e3a - .long 0x0a141e0a - .long 0x4992db49 - .long 0x060c0a06 - .long 0x24486c24 - .long 0x5cb8e45c - .long 0xc29f5dc2 - .long 0xd3bd6ed3 - .long 0xac43efac - .long 0x62c4a662 - .long 0x9139a891 - .long 0x9531a495 - .long 0xe4d337e4 - .long 0x79f28b79 - .long 0xe7d532e7 - .long 0xc88b43c8 - .long 0x376e5937 - .long 0x6ddab76d - .long 0x8d018c8d - .long 0xd5b164d5 - .long 0x4e9cd24e - .long 0xa949e0a9 - .long 0x6cd8b46c - .long 0x56acfa56 - .long 0xf4f307f4 - .long 0xeacf25ea - .long 0x65caaf65 - .long 0x7af48e7a - .long 0xae47e9ae - .long 0x08101808 - .long 0xba6fd5ba - .long 0x78f08878 - .long 0x254a6f25 - .long 0x2e5c722e - .long 0x1c38241c - .long 0xa657f1a6 - .long 0xb473c7b4 - .long 0xc69751c6 - .long 0xe8cb23e8 - .long 0xdda17cdd - .long 0x74e89c74 - .long 0x1f3e211f - .long 0x4b96dd4b - .long 0xbd61dcbd - .long 0x8b0d868b - .long 0x8a0f858a - .long 0x70e09070 - .long 0x3e7c423e - .long 0xb571c4b5 - .long 0x66ccaa66 - .long 0x4890d848 - .long 0x03060503 - .long 0xf6f701f6 - .long 0x0e1c120e - .long 0x61c2a361 - .long 0x356a5f35 - .long 0x57aef957 - .long 0xb969d0b9 - .long 0x86179186 - .long 0xc19958c1 - .long 0x1d3a271d - .long 0x9e27b99e - .long 0xe1d938e1 - .long 0xf8eb13f8 - .long 0x982bb398 - .long 0x11223311 - .long 0x69d2bb69 - .long 0xd9a970d9 - .long 0x8e07898e - .long 0x9433a794 - .long 0x9b2db69b - .long 0x1e3c221e - .long 0x87159287 - .long 0xe9c920e9 - .long 0xce8749ce - .long 0x55aaff55 - .long 0x28507828 - .long 0xdfa57adf - .long 0x8c038f8c - .long 0xa159f8a1 - .long 0x89098089 - .long 0x0d1a170d - .long 0xbf65dabf - .long 0xe6d731e6 - .long 0x4284c642 - .long 0x68d0b868 - .long 0x4182c341 - .long 0x9929b099 - .long 0x2d5a772d - .long 0x0f1e110f - .long 0xb07bcbb0 - .long 0x54a8fc54 - .long 0xbb6dd6bb - .long 0x162c3a16 - // Table 3. - .long 0xc6a56363 - .long 0xf8847c7c - .long 0xee997777 - .long 0xf68d7b7b - .long 0xff0df2f2 - .long 0xd6bd6b6b - .long 0xdeb16f6f - .long 0x9154c5c5 - .long 0x60503030 - .long 0x02030101 - .long 0xcea96767 - .long 0x567d2b2b - .long 0xe719fefe - .long 0xb562d7d7 - .long 0x4de6abab - .long 0xec9a7676 - .long 0x8f45caca - .long 0x1f9d8282 - .long 0x8940c9c9 - .long 0xfa877d7d - .long 0xef15fafa - .long 0xb2eb5959 - .long 0x8ec94747 - .long 0xfb0bf0f0 - .long 0x41ecadad - .long 0xb367d4d4 - .long 0x5ffda2a2 - .long 0x45eaafaf - .long 0x23bf9c9c - .long 0x53f7a4a4 - .long 0xe4967272 - .long 0x9b5bc0c0 - .long 0x75c2b7b7 - .long 0xe11cfdfd - .long 0x3dae9393 - .long 0x4c6a2626 - .long 0x6c5a3636 - .long 0x7e413f3f - .long 0xf502f7f7 - .long 0x834fcccc - .long 0x685c3434 - .long 0x51f4a5a5 - .long 0xd134e5e5 - .long 0xf908f1f1 - .long 0xe2937171 - .long 0xab73d8d8 - .long 0x62533131 - .long 0x2a3f1515 - .long 0x080c0404 - .long 0x9552c7c7 - .long 0x46652323 - .long 0x9d5ec3c3 - .long 0x30281818 - .long 0x37a19696 - .long 0x0a0f0505 - .long 0x2fb59a9a - .long 0x0e090707 - .long 0x24361212 - .long 0x1b9b8080 - .long 0xdf3de2e2 - .long 0xcd26ebeb - .long 0x4e692727 - .long 0x7fcdb2b2 - .long 0xea9f7575 - .long 0x121b0909 - .long 0x1d9e8383 - .long 0x58742c2c - .long 0x342e1a1a - .long 0x362d1b1b - .long 0xdcb26e6e - .long 0xb4ee5a5a - .long 0x5bfba0a0 - .long 0xa4f65252 - .long 0x764d3b3b - .long 0xb761d6d6 - .long 0x7dceb3b3 - .long 0x527b2929 - .long 0xdd3ee3e3 - .long 0x5e712f2f - .long 0x13978484 - .long 0xa6f55353 - .long 0xb968d1d1 - .long 0x00000000 - .long 0xc12ceded - .long 0x40602020 - .long 0xe31ffcfc - .long 0x79c8b1b1 - .long 0xb6ed5b5b - .long 0xd4be6a6a - .long 0x8d46cbcb - .long 0x67d9bebe - .long 0x724b3939 - .long 0x94de4a4a - .long 0x98d44c4c - .long 0xb0e85858 - .long 0x854acfcf - .long 0xbb6bd0d0 - .long 0xc52aefef - .long 0x4fe5aaaa - .long 0xed16fbfb - .long 0x86c54343 - .long 0x9ad74d4d - .long 0x66553333 - .long 0x11948585 - .long 0x8acf4545 - .long 0xe910f9f9 - .long 0x04060202 - .long 0xfe817f7f - .long 0xa0f05050 - .long 0x78443c3c - .long 0x25ba9f9f - .long 0x4be3a8a8 - .long 0xa2f35151 - .long 0x5dfea3a3 - .long 0x80c04040 - .long 0x058a8f8f - .long 0x3fad9292 - .long 0x21bc9d9d - .long 0x70483838 - .long 0xf104f5f5 - .long 0x63dfbcbc - .long 0x77c1b6b6 - .long 0xaf75dada - .long 0x42632121 - .long 0x20301010 - .long 0xe51affff - .long 0xfd0ef3f3 - .long 0xbf6dd2d2 - .long 0x814ccdcd - .long 0x18140c0c - .long 0x26351313 - .long 0xc32fecec - .long 0xbee15f5f - .long 0x35a29797 - .long 0x88cc4444 - .long 0x2e391717 - .long 0x9357c4c4 - .long 0x55f2a7a7 - .long 0xfc827e7e - .long 0x7a473d3d - .long 0xc8ac6464 - .long 0xbae75d5d - .long 0x322b1919 - .long 0xe6957373 - .long 0xc0a06060 - .long 0x19988181 - .long 0x9ed14f4f - .long 0xa37fdcdc - .long 0x44662222 - .long 0x547e2a2a - .long 0x3bab9090 - .long 0x0b838888 - .long 0x8cca4646 - .long 0xc729eeee - .long 0x6bd3b8b8 - .long 0x283c1414 - .long 0xa779dede - .long 0xbce25e5e - .long 0x161d0b0b - .long 0xad76dbdb - .long 0xdb3be0e0 - .long 0x64563232 - .long 0x744e3a3a - .long 0x141e0a0a - .long 0x92db4949 - .long 0x0c0a0606 - .long 0x486c2424 - .long 0xb8e45c5c - .long 0x9f5dc2c2 - .long 0xbd6ed3d3 - .long 0x43efacac - .long 0xc4a66262 - .long 0x39a89191 - .long 0x31a49595 - .long 0xd337e4e4 - .long 0xf28b7979 - .long 0xd532e7e7 - .long 0x8b43c8c8 - .long 0x6e593737 - .long 0xdab76d6d - .long 0x018c8d8d - .long 0xb164d5d5 - .long 0x9cd24e4e - .long 0x49e0a9a9 - .long 0xd8b46c6c - .long 0xacfa5656 - .long 0xf307f4f4 - .long 0xcf25eaea - .long 0xcaaf6565 - .long 0xf48e7a7a - .long 0x47e9aeae - .long 0x10180808 - .long 0x6fd5baba - .long 0xf0887878 - .long 0x4a6f2525 - .long 0x5c722e2e - .long 0x38241c1c - .long 0x57f1a6a6 - .long 0x73c7b4b4 - .long 0x9751c6c6 - .long 0xcb23e8e8 - .long 0xa17cdddd - .long 0xe89c7474 - .long 0x3e211f1f - .long 0x96dd4b4b - .long 0x61dcbdbd - .long 0x0d868b8b - .long 0x0f858a8a - .long 0xe0907070 - .long 0x7c423e3e - .long 0x71c4b5b5 - .long 0xccaa6666 - .long 0x90d84848 - .long 0x06050303 - .long 0xf701f6f6 - .long 0x1c120e0e - .long 0xc2a36161 - .long 0x6a5f3535 - .long 0xaef95757 - .long 0x69d0b9b9 - .long 0x17918686 - .long 0x9958c1c1 - .long 0x3a271d1d - .long 0x27b99e9e - .long 0xd938e1e1 - .long 0xeb13f8f8 - .long 0x2bb39898 - .long 0x22331111 - .long 0xd2bb6969 - .long 0xa970d9d9 - .long 0x07898e8e - .long 0x33a79494 - .long 0x2db69b9b - .long 0x3c221e1e - .long 0x15928787 - .long 0xc920e9e9 - .long 0x8749cece - .long 0xaaff5555 - .long 0x50782828 - .long 0xa57adfdf - .long 0x038f8c8c - .long 0x59f8a1a1 - .long 0x09808989 - .long 0x1a170d0d - .long 0x65dabfbf - .long 0xd731e6e6 - .long 0x84c64242 - .long 0xd0b86868 - .long 0x82c34141 - .long 0x29b09999 - .long 0x5a772d2d - .long 0x1e110f0f - .long 0x7bcbb0b0 - .long 0xa8fc5454 - .long 0x6dd6bbbb - .long 0x2c3a1616 - - -// Tables for main decryption iterations. - .globl _AESDecryptTable - .private_extern _AESDecryptTable - .align 2 -_AESDecryptTable: - // Table 0. - .long 0x50a7f451 - .long 0x5365417e - .long 0xc3a4171a - .long 0x965e273a - .long 0xcb6bab3b - .long 0xf1459d1f - .long 0xab58faac - .long 0x9303e34b - .long 0x55fa3020 - .long 0xf66d76ad - .long 0x9176cc88 - .long 0x254c02f5 - .long 0xfcd7e54f - .long 0xd7cb2ac5 - .long 0x80443526 - .long 0x8fa362b5 - .long 0x495ab1de - .long 0x671bba25 - .long 0x980eea45 - .long 0xe1c0fe5d - .long 0x02752fc3 - .long 0x12f04c81 - .long 0xa397468d - .long 0xc6f9d36b - .long 0xe75f8f03 - .long 0x959c9215 - .long 0xeb7a6dbf - .long 0xda595295 - .long 0x2d83bed4 - .long 0xd3217458 - .long 0x2969e049 - .long 0x44c8c98e - .long 0x6a89c275 - .long 0x78798ef4 - .long 0x6b3e5899 - .long 0xdd71b927 - .long 0xb64fe1be - .long 0x17ad88f0 - .long 0x66ac20c9 - .long 0xb43ace7d - .long 0x184adf63 - .long 0x82311ae5 - .long 0x60335197 - .long 0x457f5362 - .long 0xe07764b1 - .long 0x84ae6bbb - .long 0x1ca081fe - .long 0x942b08f9 - .long 0x58684870 - .long 0x19fd458f - .long 0x876cde94 - .long 0xb7f87b52 - .long 0x23d373ab - .long 0xe2024b72 - .long 0x578f1fe3 - .long 0x2aab5566 - .long 0x0728ebb2 - .long 0x03c2b52f - .long 0x9a7bc586 - .long 0xa50837d3 - .long 0xf2872830 - .long 0xb2a5bf23 - .long 0xba6a0302 - .long 0x5c8216ed - .long 0x2b1ccf8a - .long 0x92b479a7 - .long 0xf0f207f3 - .long 0xa1e2694e - .long 0xcdf4da65 - .long 0xd5be0506 - .long 0x1f6234d1 - .long 0x8afea6c4 - .long 0x9d532e34 - .long 0xa055f3a2 - .long 0x32e18a05 - .long 0x75ebf6a4 - .long 0x39ec830b - .long 0xaaef6040 - .long 0x069f715e - .long 0x51106ebd - .long 0xf98a213e - .long 0x3d06dd96 - .long 0xae053edd - .long 0x46bde64d - .long 0xb58d5491 - .long 0x055dc471 - .long 0x6fd40604 - .long 0xff155060 - .long 0x24fb9819 - .long 0x97e9bdd6 - .long 0xcc434089 - .long 0x779ed967 - .long 0xbd42e8b0 - .long 0x888b8907 - .long 0x385b19e7 - .long 0xdbeec879 - .long 0x470a7ca1 - .long 0xe90f427c - .long 0xc91e84f8 - .long 0x00000000 - .long 0x83868009 - .long 0x48ed2b32 - .long 0xac70111e - .long 0x4e725a6c - .long 0xfbff0efd - .long 0x5638850f - .long 0x1ed5ae3d - .long 0x27392d36 - .long 0x64d90f0a - .long 0x21a65c68 - .long 0xd1545b9b - .long 0x3a2e3624 - .long 0xb1670a0c - .long 0x0fe75793 - .long 0xd296eeb4 - .long 0x9e919b1b - .long 0x4fc5c080 - .long 0xa220dc61 - .long 0x694b775a - .long 0x161a121c - .long 0x0aba93e2 - .long 0xe52aa0c0 - .long 0x43e0223c - .long 0x1d171b12 - .long 0x0b0d090e - .long 0xadc78bf2 - .long 0xb9a8b62d - .long 0xc8a91e14 - .long 0x8519f157 - .long 0x4c0775af - .long 0xbbdd99ee - .long 0xfd607fa3 - .long 0x9f2601f7 - .long 0xbcf5725c - .long 0xc53b6644 - .long 0x347efb5b - .long 0x7629438b - .long 0xdcc623cb - .long 0x68fcedb6 - .long 0x63f1e4b8 - .long 0xcadc31d7 - .long 0x10856342 - .long 0x40229713 - .long 0x2011c684 - .long 0x7d244a85 - .long 0xf83dbbd2 - .long 0x1132f9ae - .long 0x6da129c7 - .long 0x4b2f9e1d - .long 0xf330b2dc - .long 0xec52860d - .long 0xd0e3c177 - .long 0x6c16b32b - .long 0x99b970a9 - .long 0xfa489411 - .long 0x2264e947 - .long 0xc48cfca8 - .long 0x1a3ff0a0 - .long 0xd82c7d56 - .long 0xef903322 - .long 0xc74e4987 - .long 0xc1d138d9 - .long 0xfea2ca8c - .long 0x360bd498 - .long 0xcf81f5a6 - .long 0x28de7aa5 - .long 0x268eb7da - .long 0xa4bfad3f - .long 0xe49d3a2c - .long 0x0d927850 - .long 0x9bcc5f6a - .long 0x62467e54 - .long 0xc2138df6 - .long 0xe8b8d890 - .long 0x5ef7392e - .long 0xf5afc382 - .long 0xbe805d9f - .long 0x7c93d069 - .long 0xa92dd56f - .long 0xb31225cf - .long 0x3b99acc8 - .long 0xa77d1810 - .long 0x6e639ce8 - .long 0x7bbb3bdb - .long 0x097826cd - .long 0xf418596e - .long 0x01b79aec - .long 0xa89a4f83 - .long 0x656e95e6 - .long 0x7ee6ffaa - .long 0x08cfbc21 - .long 0xe6e815ef - .long 0xd99be7ba - .long 0xce366f4a - .long 0xd4099fea - .long 0xd67cb029 - .long 0xafb2a431 - .long 0x31233f2a - .long 0x3094a5c6 - .long 0xc066a235 - .long 0x37bc4e74 - .long 0xa6ca82fc - .long 0xb0d090e0 - .long 0x15d8a733 - .long 0x4a9804f1 - .long 0xf7daec41 - .long 0x0e50cd7f - .long 0x2ff69117 - .long 0x8dd64d76 - .long 0x4db0ef43 - .long 0x544daacc - .long 0xdf0496e4 - .long 0xe3b5d19e - .long 0x1b886a4c - .long 0xb81f2cc1 - .long 0x7f516546 - .long 0x04ea5e9d - .long 0x5d358c01 - .long 0x737487fa - .long 0x2e410bfb - .long 0x5a1d67b3 - .long 0x52d2db92 - .long 0x335610e9 - .long 0x1347d66d - .long 0x8c61d79a - .long 0x7a0ca137 - .long 0x8e14f859 - .long 0x893c13eb - .long 0xee27a9ce - .long 0x35c961b7 - .long 0xede51ce1 - .long 0x3cb1477a - .long 0x59dfd29c - .long 0x3f73f255 - .long 0x79ce1418 - .long 0xbf37c773 - .long 0xeacdf753 - .long 0x5baafd5f - .long 0x146f3ddf - .long 0x86db4478 - .long 0x81f3afca - .long 0x3ec468b9 - .long 0x2c342438 - .long 0x5f40a3c2 - .long 0x72c31d16 - .long 0x0c25e2bc - .long 0x8b493c28 - .long 0x41950dff - .long 0x7101a839 - .long 0xdeb30c08 - .long 0x9ce4b4d8 - .long 0x90c15664 - .long 0x6184cb7b - .long 0x70b632d5 - .long 0x745c6c48 - .long 0x4257b8d0 - // Table 1. - .long 0xa7f45150 - .long 0x65417e53 - .long 0xa4171ac3 - .long 0x5e273a96 - .long 0x6bab3bcb - .long 0x459d1ff1 - .long 0x58faacab - .long 0x03e34b93 - .long 0xfa302055 - .long 0x6d76adf6 - .long 0x76cc8891 - .long 0x4c02f525 - .long 0xd7e54ffc - .long 0xcb2ac5d7 - .long 0x44352680 - .long 0xa362b58f - .long 0x5ab1de49 - .long 0x1bba2567 - .long 0x0eea4598 - .long 0xc0fe5de1 - .long 0x752fc302 - .long 0xf04c8112 - .long 0x97468da3 - .long 0xf9d36bc6 - .long 0x5f8f03e7 - .long 0x9c921595 - .long 0x7a6dbfeb - .long 0x595295da - .long 0x83bed42d - .long 0x217458d3 - .long 0x69e04929 - .long 0xc8c98e44 - .long 0x89c2756a - .long 0x798ef478 - .long 0x3e58996b - .long 0x71b927dd - .long 0x4fe1beb6 - .long 0xad88f017 - .long 0xac20c966 - .long 0x3ace7db4 - .long 0x4adf6318 - .long 0x311ae582 - .long 0x33519760 - .long 0x7f536245 - .long 0x7764b1e0 - .long 0xae6bbb84 - .long 0xa081fe1c - .long 0x2b08f994 - .long 0x68487058 - .long 0xfd458f19 - .long 0x6cde9487 - .long 0xf87b52b7 - .long 0xd373ab23 - .long 0x024b72e2 - .long 0x8f1fe357 - .long 0xab55662a - .long 0x28ebb207 - .long 0xc2b52f03 - .long 0x7bc5869a - .long 0x0837d3a5 - .long 0x872830f2 - .long 0xa5bf23b2 - .long 0x6a0302ba - .long 0x8216ed5c - .long 0x1ccf8a2b - .long 0xb479a792 - .long 0xf207f3f0 - .long 0xe2694ea1 - .long 0xf4da65cd - .long 0xbe0506d5 - .long 0x6234d11f - .long 0xfea6c48a - .long 0x532e349d - .long 0x55f3a2a0 - .long 0xe18a0532 - .long 0xebf6a475 - .long 0xec830b39 - .long 0xef6040aa - .long 0x9f715e06 - .long 0x106ebd51 - .long 0x8a213ef9 - .long 0x06dd963d - .long 0x053eddae - .long 0xbde64d46 - .long 0x8d5491b5 - .long 0x5dc47105 - .long 0xd406046f - .long 0x155060ff - .long 0xfb981924 - .long 0xe9bdd697 - .long 0x434089cc - .long 0x9ed96777 - .long 0x42e8b0bd - .long 0x8b890788 - .long 0x5b19e738 - .long 0xeec879db - .long 0x0a7ca147 - .long 0x0f427ce9 - .long 0x1e84f8c9 - .long 0x00000000 - .long 0x86800983 - .long 0xed2b3248 - .long 0x70111eac - .long 0x725a6c4e - .long 0xff0efdfb - .long 0x38850f56 - .long 0xd5ae3d1e - .long 0x392d3627 - .long 0xd90f0a64 - .long 0xa65c6821 - .long 0x545b9bd1 - .long 0x2e36243a - .long 0x670a0cb1 - .long 0xe757930f - .long 0x96eeb4d2 - .long 0x919b1b9e - .long 0xc5c0804f - .long 0x20dc61a2 - .long 0x4b775a69 - .long 0x1a121c16 - .long 0xba93e20a - .long 0x2aa0c0e5 - .long 0xe0223c43 - .long 0x171b121d - .long 0x0d090e0b - .long 0xc78bf2ad - .long 0xa8b62db9 - .long 0xa91e14c8 - .long 0x19f15785 - .long 0x0775af4c - .long 0xdd99eebb - .long 0x607fa3fd - .long 0x2601f79f - .long 0xf5725cbc - .long 0x3b6644c5 - .long 0x7efb5b34 - .long 0x29438b76 - .long 0xc623cbdc - .long 0xfcedb668 - .long 0xf1e4b863 - .long 0xdc31d7ca - .long 0x85634210 - .long 0x22971340 - .long 0x11c68420 - .long 0x244a857d - .long 0x3dbbd2f8 - .long 0x32f9ae11 - .long 0xa129c76d - .long 0x2f9e1d4b - .long 0x30b2dcf3 - .long 0x52860dec - .long 0xe3c177d0 - .long 0x16b32b6c - .long 0xb970a999 - .long 0x489411fa - .long 0x64e94722 - .long 0x8cfca8c4 - .long 0x3ff0a01a - .long 0x2c7d56d8 - .long 0x903322ef - .long 0x4e4987c7 - .long 0xd138d9c1 - .long 0xa2ca8cfe - .long 0x0bd49836 - .long 0x81f5a6cf - .long 0xde7aa528 - .long 0x8eb7da26 - .long 0xbfad3fa4 - .long 0x9d3a2ce4 - .long 0x9278500d - .long 0xcc5f6a9b - .long 0x467e5462 - .long 0x138df6c2 - .long 0xb8d890e8 - .long 0xf7392e5e - .long 0xafc382f5 - .long 0x805d9fbe - .long 0x93d0697c - .long 0x2dd56fa9 - .long 0x1225cfb3 - .long 0x99acc83b - .long 0x7d1810a7 - .long 0x639ce86e - .long 0xbb3bdb7b - .long 0x7826cd09 - .long 0x18596ef4 - .long 0xb79aec01 - .long 0x9a4f83a8 - .long 0x6e95e665 - .long 0xe6ffaa7e - .long 0xcfbc2108 - .long 0xe815efe6 - .long 0x9be7bad9 - .long 0x366f4ace - .long 0x099fead4 - .long 0x7cb029d6 - .long 0xb2a431af - .long 0x233f2a31 - .long 0x94a5c630 - .long 0x66a235c0 - .long 0xbc4e7437 - .long 0xca82fca6 - .long 0xd090e0b0 - .long 0xd8a73315 - .long 0x9804f14a - .long 0xdaec41f7 - .long 0x50cd7f0e - .long 0xf691172f - .long 0xd64d768d - .long 0xb0ef434d - .long 0x4daacc54 - .long 0x0496e4df - .long 0xb5d19ee3 - .long 0x886a4c1b - .long 0x1f2cc1b8 - .long 0x5165467f - .long 0xea5e9d04 - .long 0x358c015d - .long 0x7487fa73 - .long 0x410bfb2e - .long 0x1d67b35a - .long 0xd2db9252 - .long 0x5610e933 - .long 0x47d66d13 - .long 0x61d79a8c - .long 0x0ca1377a - .long 0x14f8598e - .long 0x3c13eb89 - .long 0x27a9ceee - .long 0xc961b735 - .long 0xe51ce1ed - .long 0xb1477a3c - .long 0xdfd29c59 - .long 0x73f2553f - .long 0xce141879 - .long 0x37c773bf - .long 0xcdf753ea - .long 0xaafd5f5b - .long 0x6f3ddf14 - .long 0xdb447886 - .long 0xf3afca81 - .long 0xc468b93e - .long 0x3424382c - .long 0x40a3c25f - .long 0xc31d1672 - .long 0x25e2bc0c - .long 0x493c288b - .long 0x950dff41 - .long 0x01a83971 - .long 0xb30c08de - .long 0xe4b4d89c - .long 0xc1566490 - .long 0x84cb7b61 - .long 0xb632d570 - .long 0x5c6c4874 - .long 0x57b8d042 - // Table 2. - .long 0xf45150a7 - .long 0x417e5365 - .long 0x171ac3a4 - .long 0x273a965e - .long 0xab3bcb6b - .long 0x9d1ff145 - .long 0xfaacab58 - .long 0xe34b9303 - .long 0x302055fa - .long 0x76adf66d - .long 0xcc889176 - .long 0x02f5254c - .long 0xe54ffcd7 - .long 0x2ac5d7cb - .long 0x35268044 - .long 0x62b58fa3 - .long 0xb1de495a - .long 0xba25671b - .long 0xea45980e - .long 0xfe5de1c0 - .long 0x2fc30275 - .long 0x4c8112f0 - .long 0x468da397 - .long 0xd36bc6f9 - .long 0x8f03e75f - .long 0x9215959c - .long 0x6dbfeb7a - .long 0x5295da59 - .long 0xbed42d83 - .long 0x7458d321 - .long 0xe0492969 - .long 0xc98e44c8 - .long 0xc2756a89 - .long 0x8ef47879 - .long 0x58996b3e - .long 0xb927dd71 - .long 0xe1beb64f - .long 0x88f017ad - .long 0x20c966ac - .long 0xce7db43a - .long 0xdf63184a - .long 0x1ae58231 - .long 0x51976033 - .long 0x5362457f - .long 0x64b1e077 - .long 0x6bbb84ae - .long 0x81fe1ca0 - .long 0x08f9942b - .long 0x48705868 - .long 0x458f19fd - .long 0xde94876c - .long 0x7b52b7f8 - .long 0x73ab23d3 - .long 0x4b72e202 - .long 0x1fe3578f - .long 0x55662aab - .long 0xebb20728 - .long 0xb52f03c2 - .long 0xc5869a7b - .long 0x37d3a508 - .long 0x2830f287 - .long 0xbf23b2a5 - .long 0x0302ba6a - .long 0x16ed5c82 - .long 0xcf8a2b1c - .long 0x79a792b4 - .long 0x07f3f0f2 - .long 0x694ea1e2 - .long 0xda65cdf4 - .long 0x0506d5be - .long 0x34d11f62 - .long 0xa6c48afe - .long 0x2e349d53 - .long 0xf3a2a055 - .long 0x8a0532e1 - .long 0xf6a475eb - .long 0x830b39ec - .long 0x6040aaef - .long 0x715e069f - .long 0x6ebd5110 - .long 0x213ef98a - .long 0xdd963d06 - .long 0x3eddae05 - .long 0xe64d46bd - .long 0x5491b58d - .long 0xc471055d - .long 0x06046fd4 - .long 0x5060ff15 - .long 0x981924fb - .long 0xbdd697e9 - .long 0x4089cc43 - .long 0xd967779e - .long 0xe8b0bd42 - .long 0x8907888b - .long 0x19e7385b - .long 0xc879dbee - .long 0x7ca1470a - .long 0x427ce90f - .long 0x84f8c91e - .long 0x00000000 - .long 0x80098386 - .long 0x2b3248ed - .long 0x111eac70 - .long 0x5a6c4e72 - .long 0x0efdfbff - .long 0x850f5638 - .long 0xae3d1ed5 - .long 0x2d362739 - .long 0x0f0a64d9 - .long 0x5c6821a6 - .long 0x5b9bd154 - .long 0x36243a2e - .long 0x0a0cb167 - .long 0x57930fe7 - .long 0xeeb4d296 - .long 0x9b1b9e91 - .long 0xc0804fc5 - .long 0xdc61a220 - .long 0x775a694b - .long 0x121c161a - .long 0x93e20aba - .long 0xa0c0e52a - .long 0x223c43e0 - .long 0x1b121d17 - .long 0x090e0b0d - .long 0x8bf2adc7 - .long 0xb62db9a8 - .long 0x1e14c8a9 - .long 0xf1578519 - .long 0x75af4c07 - .long 0x99eebbdd - .long 0x7fa3fd60 - .long 0x01f79f26 - .long 0x725cbcf5 - .long 0x6644c53b - .long 0xfb5b347e - .long 0x438b7629 - .long 0x23cbdcc6 - .long 0xedb668fc - .long 0xe4b863f1 - .long 0x31d7cadc - .long 0x63421085 - .long 0x97134022 - .long 0xc6842011 - .long 0x4a857d24 - .long 0xbbd2f83d - .long 0xf9ae1132 - .long 0x29c76da1 - .long 0x9e1d4b2f - .long 0xb2dcf330 - .long 0x860dec52 - .long 0xc177d0e3 - .long 0xb32b6c16 - .long 0x70a999b9 - .long 0x9411fa48 - .long 0xe9472264 - .long 0xfca8c48c - .long 0xf0a01a3f - .long 0x7d56d82c - .long 0x3322ef90 - .long 0x4987c74e - .long 0x38d9c1d1 - .long 0xca8cfea2 - .long 0xd498360b - .long 0xf5a6cf81 - .long 0x7aa528de - .long 0xb7da268e - .long 0xad3fa4bf - .long 0x3a2ce49d - .long 0x78500d92 - .long 0x5f6a9bcc - .long 0x7e546246 - .long 0x8df6c213 - .long 0xd890e8b8 - .long 0x392e5ef7 - .long 0xc382f5af - .long 0x5d9fbe80 - .long 0xd0697c93 - .long 0xd56fa92d - .long 0x25cfb312 - .long 0xacc83b99 - .long 0x1810a77d - .long 0x9ce86e63 - .long 0x3bdb7bbb - .long 0x26cd0978 - .long 0x596ef418 - .long 0x9aec01b7 - .long 0x4f83a89a - .long 0x95e6656e - .long 0xffaa7ee6 - .long 0xbc2108cf - .long 0x15efe6e8 - .long 0xe7bad99b - .long 0x6f4ace36 - .long 0x9fead409 - .long 0xb029d67c - .long 0xa431afb2 - .long 0x3f2a3123 - .long 0xa5c63094 - .long 0xa235c066 - .long 0x4e7437bc - .long 0x82fca6ca - .long 0x90e0b0d0 - .long 0xa73315d8 - .long 0x04f14a98 - .long 0xec41f7da - .long 0xcd7f0e50 - .long 0x91172ff6 - .long 0x4d768dd6 - .long 0xef434db0 - .long 0xaacc544d - .long 0x96e4df04 - .long 0xd19ee3b5 - .long 0x6a4c1b88 - .long 0x2cc1b81f - .long 0x65467f51 - .long 0x5e9d04ea - .long 0x8c015d35 - .long 0x87fa7374 - .long 0x0bfb2e41 - .long 0x67b35a1d - .long 0xdb9252d2 - .long 0x10e93356 - .long 0xd66d1347 - .long 0xd79a8c61 - .long 0xa1377a0c - .long 0xf8598e14 - .long 0x13eb893c - .long 0xa9ceee27 - .long 0x61b735c9 - .long 0x1ce1ede5 - .long 0x477a3cb1 - .long 0xd29c59df - .long 0xf2553f73 - .long 0x141879ce - .long 0xc773bf37 - .long 0xf753eacd - .long 0xfd5f5baa - .long 0x3ddf146f - .long 0x447886db - .long 0xafca81f3 - .long 0x68b93ec4 - .long 0x24382c34 - .long 0xa3c25f40 - .long 0x1d1672c3 - .long 0xe2bc0c25 - .long 0x3c288b49 - .long 0x0dff4195 - .long 0xa8397101 - .long 0x0c08deb3 - .long 0xb4d89ce4 - .long 0x566490c1 - .long 0xcb7b6184 - .long 0x32d570b6 - .long 0x6c48745c - .long 0xb8d04257 - // Table 3. - .long 0x5150a7f4 - .long 0x7e536541 - .long 0x1ac3a417 - .long 0x3a965e27 - .long 0x3bcb6bab - .long 0x1ff1459d - .long 0xacab58fa - .long 0x4b9303e3 - .long 0x2055fa30 - .long 0xadf66d76 - .long 0x889176cc - .long 0xf5254c02 - .long 0x4ffcd7e5 - .long 0xc5d7cb2a - .long 0x26804435 - .long 0xb58fa362 - .long 0xde495ab1 - .long 0x25671bba - .long 0x45980eea - .long 0x5de1c0fe - .long 0xc302752f - .long 0x8112f04c - .long 0x8da39746 - .long 0x6bc6f9d3 - .long 0x03e75f8f - .long 0x15959c92 - .long 0xbfeb7a6d - .long 0x95da5952 - .long 0xd42d83be - .long 0x58d32174 - .long 0x492969e0 - .long 0x8e44c8c9 - .long 0x756a89c2 - .long 0xf478798e - .long 0x996b3e58 - .long 0x27dd71b9 - .long 0xbeb64fe1 - .long 0xf017ad88 - .long 0xc966ac20 - .long 0x7db43ace - .long 0x63184adf - .long 0xe582311a - .long 0x97603351 - .long 0x62457f53 - .long 0xb1e07764 - .long 0xbb84ae6b - .long 0xfe1ca081 - .long 0xf9942b08 - .long 0x70586848 - .long 0x8f19fd45 - .long 0x94876cde - .long 0x52b7f87b - .long 0xab23d373 - .long 0x72e2024b - .long 0xe3578f1f - .long 0x662aab55 - .long 0xb20728eb - .long 0x2f03c2b5 - .long 0x869a7bc5 - .long 0xd3a50837 - .long 0x30f28728 - .long 0x23b2a5bf - .long 0x02ba6a03 - .long 0xed5c8216 - .long 0x8a2b1ccf - .long 0xa792b479 - .long 0xf3f0f207 - .long 0x4ea1e269 - .long 0x65cdf4da - .long 0x06d5be05 - .long 0xd11f6234 - .long 0xc48afea6 - .long 0x349d532e - .long 0xa2a055f3 - .long 0x0532e18a - .long 0xa475ebf6 - .long 0x0b39ec83 - .long 0x40aaef60 - .long 0x5e069f71 - .long 0xbd51106e - .long 0x3ef98a21 - .long 0x963d06dd - .long 0xddae053e - .long 0x4d46bde6 - .long 0x91b58d54 - .long 0x71055dc4 - .long 0x046fd406 - .long 0x60ff1550 - .long 0x1924fb98 - .long 0xd697e9bd - .long 0x89cc4340 - .long 0x67779ed9 - .long 0xb0bd42e8 - .long 0x07888b89 - .long 0xe7385b19 - .long 0x79dbeec8 - .long 0xa1470a7c - .long 0x7ce90f42 - .long 0xf8c91e84 - .long 0x00000000 - .long 0x09838680 - .long 0x3248ed2b - .long 0x1eac7011 - .long 0x6c4e725a - .long 0xfdfbff0e - .long 0x0f563885 - .long 0x3d1ed5ae - .long 0x3627392d - .long 0x0a64d90f - .long 0x6821a65c - .long 0x9bd1545b - .long 0x243a2e36 - .long 0x0cb1670a - .long 0x930fe757 - .long 0xb4d296ee - .long 0x1b9e919b - .long 0x804fc5c0 - .long 0x61a220dc - .long 0x5a694b77 - .long 0x1c161a12 - .long 0xe20aba93 - .long 0xc0e52aa0 - .long 0x3c43e022 - .long 0x121d171b - .long 0x0e0b0d09 - .long 0xf2adc78b - .long 0x2db9a8b6 - .long 0x14c8a91e - .long 0x578519f1 - .long 0xaf4c0775 - .long 0xeebbdd99 - .long 0xa3fd607f - .long 0xf79f2601 - .long 0x5cbcf572 - .long 0x44c53b66 - .long 0x5b347efb - .long 0x8b762943 - .long 0xcbdcc623 - .long 0xb668fced - .long 0xb863f1e4 - .long 0xd7cadc31 - .long 0x42108563 - .long 0x13402297 - .long 0x842011c6 - .long 0x857d244a - .long 0xd2f83dbb - .long 0xae1132f9 - .long 0xc76da129 - .long 0x1d4b2f9e - .long 0xdcf330b2 - .long 0x0dec5286 - .long 0x77d0e3c1 - .long 0x2b6c16b3 - .long 0xa999b970 - .long 0x11fa4894 - .long 0x472264e9 - .long 0xa8c48cfc - .long 0xa01a3ff0 - .long 0x56d82c7d - .long 0x22ef9033 - .long 0x87c74e49 - .long 0xd9c1d138 - .long 0x8cfea2ca - .long 0x98360bd4 - .long 0xa6cf81f5 - .long 0xa528de7a - .long 0xda268eb7 - .long 0x3fa4bfad - .long 0x2ce49d3a - .long 0x500d9278 - .long 0x6a9bcc5f - .long 0x5462467e - .long 0xf6c2138d - .long 0x90e8b8d8 - .long 0x2e5ef739 - .long 0x82f5afc3 - .long 0x9fbe805d - .long 0x697c93d0 - .long 0x6fa92dd5 - .long 0xcfb31225 - .long 0xc83b99ac - .long 0x10a77d18 - .long 0xe86e639c - .long 0xdb7bbb3b - .long 0xcd097826 - .long 0x6ef41859 - .long 0xec01b79a - .long 0x83a89a4f - .long 0xe6656e95 - .long 0xaa7ee6ff - .long 0x2108cfbc - .long 0xefe6e815 - .long 0xbad99be7 - .long 0x4ace366f - .long 0xead4099f - .long 0x29d67cb0 - .long 0x31afb2a4 - .long 0x2a31233f - .long 0xc63094a5 - .long 0x35c066a2 - .long 0x7437bc4e - .long 0xfca6ca82 - .long 0xe0b0d090 - .long 0x3315d8a7 - .long 0xf14a9804 - .long 0x41f7daec - .long 0x7f0e50cd - .long 0x172ff691 - .long 0x768dd64d - .long 0x434db0ef - .long 0xcc544daa - .long 0xe4df0496 - .long 0x9ee3b5d1 - .long 0x4c1b886a - .long 0xc1b81f2c - .long 0x467f5165 - .long 0x9d04ea5e - .long 0x015d358c - .long 0xfa737487 - .long 0xfb2e410b - .long 0xb35a1d67 - .long 0x9252d2db - .long 0xe9335610 - .long 0x6d1347d6 - .long 0x9a8c61d7 - .long 0x377a0ca1 - .long 0x598e14f8 - .long 0xeb893c13 - .long 0xceee27a9 - .long 0xb735c961 - .long 0xe1ede51c - .long 0x7a3cb147 - .long 0x9c59dfd2 - .long 0x553f73f2 - .long 0x1879ce14 - .long 0x73bf37c7 - .long 0x53eacdf7 - .long 0x5f5baafd - .long 0xdf146f3d - .long 0x7886db44 - .long 0xca81f3af - .long 0xb93ec468 - .long 0x382c3424 - .long 0xc25f40a3 - .long 0x1672c31d - .long 0xbc0c25e2 - .long 0x288b493c - .long 0xff41950d - .long 0x397101a8 - .long 0x08deb30c - .long 0xd89ce4b4 - .long 0x6490c156 - .long 0x7b6184cb - .long 0xd570b632 - .long 0x48745c6c - .long 0xd04257b8 - - -// SubBytes embedded in words tables. - .globl _AESSubBytesWordTable - .private_extern _AESSubBytesWordTable - .align 2 -_AESSubBytesWordTable: - // Table 0. - .long 0x00000063 - .long 0x0000007c - .long 0x00000077 - .long 0x0000007b - .long 0x000000f2 - .long 0x0000006b - .long 0x0000006f - .long 0x000000c5 - .long 0x00000030 - .long 0x00000001 - .long 0x00000067 - .long 0x0000002b - .long 0x000000fe - .long 0x000000d7 - .long 0x000000ab - .long 0x00000076 - .long 0x000000ca - .long 0x00000082 - .long 0x000000c9 - .long 0x0000007d - .long 0x000000fa - .long 0x00000059 - .long 0x00000047 - .long 0x000000f0 - .long 0x000000ad - .long 0x000000d4 - .long 0x000000a2 - .long 0x000000af - .long 0x0000009c - .long 0x000000a4 - .long 0x00000072 - .long 0x000000c0 - .long 0x000000b7 - .long 0x000000fd - .long 0x00000093 - .long 0x00000026 - .long 0x00000036 - .long 0x0000003f - .long 0x000000f7 - .long 0x000000cc - .long 0x00000034 - .long 0x000000a5 - .long 0x000000e5 - .long 0x000000f1 - .long 0x00000071 - .long 0x000000d8 - .long 0x00000031 - .long 0x00000015 - .long 0x00000004 - .long 0x000000c7 - .long 0x00000023 - .long 0x000000c3 - .long 0x00000018 - .long 0x00000096 - .long 0x00000005 - .long 0x0000009a - .long 0x00000007 - .long 0x00000012 - .long 0x00000080 - .long 0x000000e2 - .long 0x000000eb - .long 0x00000027 - .long 0x000000b2 - .long 0x00000075 - .long 0x00000009 - .long 0x00000083 - .long 0x0000002c - .long 0x0000001a - .long 0x0000001b - .long 0x0000006e - .long 0x0000005a - .long 0x000000a0 - .long 0x00000052 - .long 0x0000003b - .long 0x000000d6 - .long 0x000000b3 - .long 0x00000029 - .long 0x000000e3 - .long 0x0000002f - .long 0x00000084 - .long 0x00000053 - .long 0x000000d1 - .long 0x00000000 - .long 0x000000ed - .long 0x00000020 - .long 0x000000fc - .long 0x000000b1 - .long 0x0000005b - .long 0x0000006a - .long 0x000000cb - .long 0x000000be - .long 0x00000039 - .long 0x0000004a - .long 0x0000004c - .long 0x00000058 - .long 0x000000cf - .long 0x000000d0 - .long 0x000000ef - .long 0x000000aa - .long 0x000000fb - .long 0x00000043 - .long 0x0000004d - .long 0x00000033 - .long 0x00000085 - .long 0x00000045 - .long 0x000000f9 - .long 0x00000002 - .long 0x0000007f - .long 0x00000050 - .long 0x0000003c - .long 0x0000009f - .long 0x000000a8 - .long 0x00000051 - .long 0x000000a3 - .long 0x00000040 - .long 0x0000008f - .long 0x00000092 - .long 0x0000009d - .long 0x00000038 - .long 0x000000f5 - .long 0x000000bc - .long 0x000000b6 - .long 0x000000da - .long 0x00000021 - .long 0x00000010 - .long 0x000000ff - .long 0x000000f3 - .long 0x000000d2 - .long 0x000000cd - .long 0x0000000c - .long 0x00000013 - .long 0x000000ec - .long 0x0000005f - .long 0x00000097 - .long 0x00000044 - .long 0x00000017 - .long 0x000000c4 - .long 0x000000a7 - .long 0x0000007e - .long 0x0000003d - .long 0x00000064 - .long 0x0000005d - .long 0x00000019 - .long 0x00000073 - .long 0x00000060 - .long 0x00000081 - .long 0x0000004f - .long 0x000000dc - .long 0x00000022 - .long 0x0000002a - .long 0x00000090 - .long 0x00000088 - .long 0x00000046 - .long 0x000000ee - .long 0x000000b8 - .long 0x00000014 - .long 0x000000de - .long 0x0000005e - .long 0x0000000b - .long 0x000000db - .long 0x000000e0 - .long 0x00000032 - .long 0x0000003a - .long 0x0000000a - .long 0x00000049 - .long 0x00000006 - .long 0x00000024 - .long 0x0000005c - .long 0x000000c2 - .long 0x000000d3 - .long 0x000000ac - .long 0x00000062 - .long 0x00000091 - .long 0x00000095 - .long 0x000000e4 - .long 0x00000079 - .long 0x000000e7 - .long 0x000000c8 - .long 0x00000037 - .long 0x0000006d - .long 0x0000008d - .long 0x000000d5 - .long 0x0000004e - .long 0x000000a9 - .long 0x0000006c - .long 0x00000056 - .long 0x000000f4 - .long 0x000000ea - .long 0x00000065 - .long 0x0000007a - .long 0x000000ae - .long 0x00000008 - .long 0x000000ba - .long 0x00000078 - .long 0x00000025 - .long 0x0000002e - .long 0x0000001c - .long 0x000000a6 - .long 0x000000b4 - .long 0x000000c6 - .long 0x000000e8 - .long 0x000000dd - .long 0x00000074 - .long 0x0000001f - .long 0x0000004b - .long 0x000000bd - .long 0x0000008b - .long 0x0000008a - .long 0x00000070 - .long 0x0000003e - .long 0x000000b5 - .long 0x00000066 - .long 0x00000048 - .long 0x00000003 - .long 0x000000f6 - .long 0x0000000e - .long 0x00000061 - .long 0x00000035 - .long 0x00000057 - .long 0x000000b9 - .long 0x00000086 - .long 0x000000c1 - .long 0x0000001d - .long 0x0000009e - .long 0x000000e1 - .long 0x000000f8 - .long 0x00000098 - .long 0x00000011 - .long 0x00000069 - .long 0x000000d9 - .long 0x0000008e - .long 0x00000094 - .long 0x0000009b - .long 0x0000001e - .long 0x00000087 - .long 0x000000e9 - .long 0x000000ce - .long 0x00000055 - .long 0x00000028 - .long 0x000000df - .long 0x0000008c - .long 0x000000a1 - .long 0x00000089 - .long 0x0000000d - .long 0x000000bf - .long 0x000000e6 - .long 0x00000042 - .long 0x00000068 - .long 0x00000041 - .long 0x00000099 - .long 0x0000002d - .long 0x0000000f - .long 0x000000b0 - .long 0x00000054 - .long 0x000000bb - .long 0x00000016 - // Table 1. - .long 0x00006300 - .long 0x00007c00 - .long 0x00007700 - .long 0x00007b00 - .long 0x0000f200 - .long 0x00006b00 - .long 0x00006f00 - .long 0x0000c500 - .long 0x00003000 - .long 0x00000100 - .long 0x00006700 - .long 0x00002b00 - .long 0x0000fe00 - .long 0x0000d700 - .long 0x0000ab00 - .long 0x00007600 - .long 0x0000ca00 - .long 0x00008200 - .long 0x0000c900 - .long 0x00007d00 - .long 0x0000fa00 - .long 0x00005900 - .long 0x00004700 - .long 0x0000f000 - .long 0x0000ad00 - .long 0x0000d400 - .long 0x0000a200 - .long 0x0000af00 - .long 0x00009c00 - .long 0x0000a400 - .long 0x00007200 - .long 0x0000c000 - .long 0x0000b700 - .long 0x0000fd00 - .long 0x00009300 - .long 0x00002600 - .long 0x00003600 - .long 0x00003f00 - .long 0x0000f700 - .long 0x0000cc00 - .long 0x00003400 - .long 0x0000a500 - .long 0x0000e500 - .long 0x0000f100 - .long 0x00007100 - .long 0x0000d800 - .long 0x00003100 - .long 0x00001500 - .long 0x00000400 - .long 0x0000c700 - .long 0x00002300 - .long 0x0000c300 - .long 0x00001800 - .long 0x00009600 - .long 0x00000500 - .long 0x00009a00 - .long 0x00000700 - .long 0x00001200 - .long 0x00008000 - .long 0x0000e200 - .long 0x0000eb00 - .long 0x00002700 - .long 0x0000b200 - .long 0x00007500 - .long 0x00000900 - .long 0x00008300 - .long 0x00002c00 - .long 0x00001a00 - .long 0x00001b00 - .long 0x00006e00 - .long 0x00005a00 - .long 0x0000a000 - .long 0x00005200 - .long 0x00003b00 - .long 0x0000d600 - .long 0x0000b300 - .long 0x00002900 - .long 0x0000e300 - .long 0x00002f00 - .long 0x00008400 - .long 0x00005300 - .long 0x0000d100 - .long 0x00000000 - .long 0x0000ed00 - .long 0x00002000 - .long 0x0000fc00 - .long 0x0000b100 - .long 0x00005b00 - .long 0x00006a00 - .long 0x0000cb00 - .long 0x0000be00 - .long 0x00003900 - .long 0x00004a00 - .long 0x00004c00 - .long 0x00005800 - .long 0x0000cf00 - .long 0x0000d000 - .long 0x0000ef00 - .long 0x0000aa00 - .long 0x0000fb00 - .long 0x00004300 - .long 0x00004d00 - .long 0x00003300 - .long 0x00008500 - .long 0x00004500 - .long 0x0000f900 - .long 0x00000200 - .long 0x00007f00 - .long 0x00005000 - .long 0x00003c00 - .long 0x00009f00 - .long 0x0000a800 - .long 0x00005100 - .long 0x0000a300 - .long 0x00004000 - .long 0x00008f00 - .long 0x00009200 - .long 0x00009d00 - .long 0x00003800 - .long 0x0000f500 - .long 0x0000bc00 - .long 0x0000b600 - .long 0x0000da00 - .long 0x00002100 - .long 0x00001000 - .long 0x0000ff00 - .long 0x0000f300 - .long 0x0000d200 - .long 0x0000cd00 - .long 0x00000c00 - .long 0x00001300 - .long 0x0000ec00 - .long 0x00005f00 - .long 0x00009700 - .long 0x00004400 - .long 0x00001700 - .long 0x0000c400 - .long 0x0000a700 - .long 0x00007e00 - .long 0x00003d00 - .long 0x00006400 - .long 0x00005d00 - .long 0x00001900 - .long 0x00007300 - .long 0x00006000 - .long 0x00008100 - .long 0x00004f00 - .long 0x0000dc00 - .long 0x00002200 - .long 0x00002a00 - .long 0x00009000 - .long 0x00008800 - .long 0x00004600 - .long 0x0000ee00 - .long 0x0000b800 - .long 0x00001400 - .long 0x0000de00 - .long 0x00005e00 - .long 0x00000b00 - .long 0x0000db00 - .long 0x0000e000 - .long 0x00003200 - .long 0x00003a00 - .long 0x00000a00 - .long 0x00004900 - .long 0x00000600 - .long 0x00002400 - .long 0x00005c00 - .long 0x0000c200 - .long 0x0000d300 - .long 0x0000ac00 - .long 0x00006200 - .long 0x00009100 - .long 0x00009500 - .long 0x0000e400 - .long 0x00007900 - .long 0x0000e700 - .long 0x0000c800 - .long 0x00003700 - .long 0x00006d00 - .long 0x00008d00 - .long 0x0000d500 - .long 0x00004e00 - .long 0x0000a900 - .long 0x00006c00 - .long 0x00005600 - .long 0x0000f400 - .long 0x0000ea00 - .long 0x00006500 - .long 0x00007a00 - .long 0x0000ae00 - .long 0x00000800 - .long 0x0000ba00 - .long 0x00007800 - .long 0x00002500 - .long 0x00002e00 - .long 0x00001c00 - .long 0x0000a600 - .long 0x0000b400 - .long 0x0000c600 - .long 0x0000e800 - .long 0x0000dd00 - .long 0x00007400 - .long 0x00001f00 - .long 0x00004b00 - .long 0x0000bd00 - .long 0x00008b00 - .long 0x00008a00 - .long 0x00007000 - .long 0x00003e00 - .long 0x0000b500 - .long 0x00006600 - .long 0x00004800 - .long 0x00000300 - .long 0x0000f600 - .long 0x00000e00 - .long 0x00006100 - .long 0x00003500 - .long 0x00005700 - .long 0x0000b900 - .long 0x00008600 - .long 0x0000c100 - .long 0x00001d00 - .long 0x00009e00 - .long 0x0000e100 - .long 0x0000f800 - .long 0x00009800 - .long 0x00001100 - .long 0x00006900 - .long 0x0000d900 - .long 0x00008e00 - .long 0x00009400 - .long 0x00009b00 - .long 0x00001e00 - .long 0x00008700 - .long 0x0000e900 - .long 0x0000ce00 - .long 0x00005500 - .long 0x00002800 - .long 0x0000df00 - .long 0x00008c00 - .long 0x0000a100 - .long 0x00008900 - .long 0x00000d00 - .long 0x0000bf00 - .long 0x0000e600 - .long 0x00004200 - .long 0x00006800 - .long 0x00004100 - .long 0x00009900 - .long 0x00002d00 - .long 0x00000f00 - .long 0x0000b000 - .long 0x00005400 - .long 0x0000bb00 - .long 0x00001600 - // Table 2. - .long 0x00630000 - .long 0x007c0000 - .long 0x00770000 - .long 0x007b0000 - .long 0x00f20000 - .long 0x006b0000 - .long 0x006f0000 - .long 0x00c50000 - .long 0x00300000 - .long 0x00010000 - .long 0x00670000 - .long 0x002b0000 - .long 0x00fe0000 - .long 0x00d70000 - .long 0x00ab0000 - .long 0x00760000 - .long 0x00ca0000 - .long 0x00820000 - .long 0x00c90000 - .long 0x007d0000 - .long 0x00fa0000 - .long 0x00590000 - .long 0x00470000 - .long 0x00f00000 - .long 0x00ad0000 - .long 0x00d40000 - .long 0x00a20000 - .long 0x00af0000 - .long 0x009c0000 - .long 0x00a40000 - .long 0x00720000 - .long 0x00c00000 - .long 0x00b70000 - .long 0x00fd0000 - .long 0x00930000 - .long 0x00260000 - .long 0x00360000 - .long 0x003f0000 - .long 0x00f70000 - .long 0x00cc0000 - .long 0x00340000 - .long 0x00a50000 - .long 0x00e50000 - .long 0x00f10000 - .long 0x00710000 - .long 0x00d80000 - .long 0x00310000 - .long 0x00150000 - .long 0x00040000 - .long 0x00c70000 - .long 0x00230000 - .long 0x00c30000 - .long 0x00180000 - .long 0x00960000 - .long 0x00050000 - .long 0x009a0000 - .long 0x00070000 - .long 0x00120000 - .long 0x00800000 - .long 0x00e20000 - .long 0x00eb0000 - .long 0x00270000 - .long 0x00b20000 - .long 0x00750000 - .long 0x00090000 - .long 0x00830000 - .long 0x002c0000 - .long 0x001a0000 - .long 0x001b0000 - .long 0x006e0000 - .long 0x005a0000 - .long 0x00a00000 - .long 0x00520000 - .long 0x003b0000 - .long 0x00d60000 - .long 0x00b30000 - .long 0x00290000 - .long 0x00e30000 - .long 0x002f0000 - .long 0x00840000 - .long 0x00530000 - .long 0x00d10000 - .long 0x00000000 - .long 0x00ed0000 - .long 0x00200000 - .long 0x00fc0000 - .long 0x00b10000 - .long 0x005b0000 - .long 0x006a0000 - .long 0x00cb0000 - .long 0x00be0000 - .long 0x00390000 - .long 0x004a0000 - .long 0x004c0000 - .long 0x00580000 - .long 0x00cf0000 - .long 0x00d00000 - .long 0x00ef0000 - .long 0x00aa0000 - .long 0x00fb0000 - .long 0x00430000 - .long 0x004d0000 - .long 0x00330000 - .long 0x00850000 - .long 0x00450000 - .long 0x00f90000 - .long 0x00020000 - .long 0x007f0000 - .long 0x00500000 - .long 0x003c0000 - .long 0x009f0000 - .long 0x00a80000 - .long 0x00510000 - .long 0x00a30000 - .long 0x00400000 - .long 0x008f0000 - .long 0x00920000 - .long 0x009d0000 - .long 0x00380000 - .long 0x00f50000 - .long 0x00bc0000 - .long 0x00b60000 - .long 0x00da0000 - .long 0x00210000 - .long 0x00100000 - .long 0x00ff0000 - .long 0x00f30000 - .long 0x00d20000 - .long 0x00cd0000 - .long 0x000c0000 - .long 0x00130000 - .long 0x00ec0000 - .long 0x005f0000 - .long 0x00970000 - .long 0x00440000 - .long 0x00170000 - .long 0x00c40000 - .long 0x00a70000 - .long 0x007e0000 - .long 0x003d0000 - .long 0x00640000 - .long 0x005d0000 - .long 0x00190000 - .long 0x00730000 - .long 0x00600000 - .long 0x00810000 - .long 0x004f0000 - .long 0x00dc0000 - .long 0x00220000 - .long 0x002a0000 - .long 0x00900000 - .long 0x00880000 - .long 0x00460000 - .long 0x00ee0000 - .long 0x00b80000 - .long 0x00140000 - .long 0x00de0000 - .long 0x005e0000 - .long 0x000b0000 - .long 0x00db0000 - .long 0x00e00000 - .long 0x00320000 - .long 0x003a0000 - .long 0x000a0000 - .long 0x00490000 - .long 0x00060000 - .long 0x00240000 - .long 0x005c0000 - .long 0x00c20000 - .long 0x00d30000 - .long 0x00ac0000 - .long 0x00620000 - .long 0x00910000 - .long 0x00950000 - .long 0x00e40000 - .long 0x00790000 - .long 0x00e70000 - .long 0x00c80000 - .long 0x00370000 - .long 0x006d0000 - .long 0x008d0000 - .long 0x00d50000 - .long 0x004e0000 - .long 0x00a90000 - .long 0x006c0000 - .long 0x00560000 - .long 0x00f40000 - .long 0x00ea0000 - .long 0x00650000 - .long 0x007a0000 - .long 0x00ae0000 - .long 0x00080000 - .long 0x00ba0000 - .long 0x00780000 - .long 0x00250000 - .long 0x002e0000 - .long 0x001c0000 - .long 0x00a60000 - .long 0x00b40000 - .long 0x00c60000 - .long 0x00e80000 - .long 0x00dd0000 - .long 0x00740000 - .long 0x001f0000 - .long 0x004b0000 - .long 0x00bd0000 - .long 0x008b0000 - .long 0x008a0000 - .long 0x00700000 - .long 0x003e0000 - .long 0x00b50000 - .long 0x00660000 - .long 0x00480000 - .long 0x00030000 - .long 0x00f60000 - .long 0x000e0000 - .long 0x00610000 - .long 0x00350000 - .long 0x00570000 - .long 0x00b90000 - .long 0x00860000 - .long 0x00c10000 - .long 0x001d0000 - .long 0x009e0000 - .long 0x00e10000 - .long 0x00f80000 - .long 0x00980000 - .long 0x00110000 - .long 0x00690000 - .long 0x00d90000 - .long 0x008e0000 - .long 0x00940000 - .long 0x009b0000 - .long 0x001e0000 - .long 0x00870000 - .long 0x00e90000 - .long 0x00ce0000 - .long 0x00550000 - .long 0x00280000 - .long 0x00df0000 - .long 0x008c0000 - .long 0x00a10000 - .long 0x00890000 - .long 0x000d0000 - .long 0x00bf0000 - .long 0x00e60000 - .long 0x00420000 - .long 0x00680000 - .long 0x00410000 - .long 0x00990000 - .long 0x002d0000 - .long 0x000f0000 - .long 0x00b00000 - .long 0x00540000 - .long 0x00bb0000 - .long 0x00160000 - // Table 3. - .long 0x63000000 - .long 0x7c000000 - .long 0x77000000 - .long 0x7b000000 - .long 0xf2000000 - .long 0x6b000000 - .long 0x6f000000 - .long 0xc5000000 - .long 0x30000000 - .long 0x01000000 - .long 0x67000000 - .long 0x2b000000 - .long 0xfe000000 - .long 0xd7000000 - .long 0xab000000 - .long 0x76000000 - .long 0xca000000 - .long 0x82000000 - .long 0xc9000000 - .long 0x7d000000 - .long 0xfa000000 - .long 0x59000000 - .long 0x47000000 - .long 0xf0000000 - .long 0xad000000 - .long 0xd4000000 - .long 0xa2000000 - .long 0xaf000000 - .long 0x9c000000 - .long 0xa4000000 - .long 0x72000000 - .long 0xc0000000 - .long 0xb7000000 - .long 0xfd000000 - .long 0x93000000 - .long 0x26000000 - .long 0x36000000 - .long 0x3f000000 - .long 0xf7000000 - .long 0xcc000000 - .long 0x34000000 - .long 0xa5000000 - .long 0xe5000000 - .long 0xf1000000 - .long 0x71000000 - .long 0xd8000000 - .long 0x31000000 - .long 0x15000000 - .long 0x04000000 - .long 0xc7000000 - .long 0x23000000 - .long 0xc3000000 - .long 0x18000000 - .long 0x96000000 - .long 0x05000000 - .long 0x9a000000 - .long 0x07000000 - .long 0x12000000 - .long 0x80000000 - .long 0xe2000000 - .long 0xeb000000 - .long 0x27000000 - .long 0xb2000000 - .long 0x75000000 - .long 0x09000000 - .long 0x83000000 - .long 0x2c000000 - .long 0x1a000000 - .long 0x1b000000 - .long 0x6e000000 - .long 0x5a000000 - .long 0xa0000000 - .long 0x52000000 - .long 0x3b000000 - .long 0xd6000000 - .long 0xb3000000 - .long 0x29000000 - .long 0xe3000000 - .long 0x2f000000 - .long 0x84000000 - .long 0x53000000 - .long 0xd1000000 - .long 0x00000000 - .long 0xed000000 - .long 0x20000000 - .long 0xfc000000 - .long 0xb1000000 - .long 0x5b000000 - .long 0x6a000000 - .long 0xcb000000 - .long 0xbe000000 - .long 0x39000000 - .long 0x4a000000 - .long 0x4c000000 - .long 0x58000000 - .long 0xcf000000 - .long 0xd0000000 - .long 0xef000000 - .long 0xaa000000 - .long 0xfb000000 - .long 0x43000000 - .long 0x4d000000 - .long 0x33000000 - .long 0x85000000 - .long 0x45000000 - .long 0xf9000000 - .long 0x02000000 - .long 0x7f000000 - .long 0x50000000 - .long 0x3c000000 - .long 0x9f000000 - .long 0xa8000000 - .long 0x51000000 - .long 0xa3000000 - .long 0x40000000 - .long 0x8f000000 - .long 0x92000000 - .long 0x9d000000 - .long 0x38000000 - .long 0xf5000000 - .long 0xbc000000 - .long 0xb6000000 - .long 0xda000000 - .long 0x21000000 - .long 0x10000000 - .long 0xff000000 - .long 0xf3000000 - .long 0xd2000000 - .long 0xcd000000 - .long 0x0c000000 - .long 0x13000000 - .long 0xec000000 - .long 0x5f000000 - .long 0x97000000 - .long 0x44000000 - .long 0x17000000 - .long 0xc4000000 - .long 0xa7000000 - .long 0x7e000000 - .long 0x3d000000 - .long 0x64000000 - .long 0x5d000000 - .long 0x19000000 - .long 0x73000000 - .long 0x60000000 - .long 0x81000000 - .long 0x4f000000 - .long 0xdc000000 - .long 0x22000000 - .long 0x2a000000 - .long 0x90000000 - .long 0x88000000 - .long 0x46000000 - .long 0xee000000 - .long 0xb8000000 - .long 0x14000000 - .long 0xde000000 - .long 0x5e000000 - .long 0x0b000000 - .long 0xdb000000 - .long 0xe0000000 - .long 0x32000000 - .long 0x3a000000 - .long 0x0a000000 - .long 0x49000000 - .long 0x06000000 - .long 0x24000000 - .long 0x5c000000 - .long 0xc2000000 - .long 0xd3000000 - .long 0xac000000 - .long 0x62000000 - .long 0x91000000 - .long 0x95000000 - .long 0xe4000000 - .long 0x79000000 - .long 0xe7000000 - .long 0xc8000000 - .long 0x37000000 - .long 0x6d000000 - .long 0x8d000000 - .long 0xd5000000 - .long 0x4e000000 - .long 0xa9000000 - .long 0x6c000000 - .long 0x56000000 - .long 0xf4000000 - .long 0xea000000 - .long 0x65000000 - .long 0x7a000000 - .long 0xae000000 - .long 0x08000000 - .long 0xba000000 - .long 0x78000000 - .long 0x25000000 - .long 0x2e000000 - .long 0x1c000000 - .long 0xa6000000 - .long 0xb4000000 - .long 0xc6000000 - .long 0xe8000000 - .long 0xdd000000 - .long 0x74000000 - .long 0x1f000000 - .long 0x4b000000 - .long 0xbd000000 - .long 0x8b000000 - .long 0x8a000000 - .long 0x70000000 - .long 0x3e000000 - .long 0xb5000000 - .long 0x66000000 - .long 0x48000000 - .long 0x03000000 - .long 0xf6000000 - .long 0x0e000000 - .long 0x61000000 - .long 0x35000000 - .long 0x57000000 - .long 0xb9000000 - .long 0x86000000 - .long 0xc1000000 - .long 0x1d000000 - .long 0x9e000000 - .long 0xe1000000 - .long 0xf8000000 - .long 0x98000000 - .long 0x11000000 - .long 0x69000000 - .long 0xd9000000 - .long 0x8e000000 - .long 0x94000000 - .long 0x9b000000 - .long 0x1e000000 - .long 0x87000000 - .long 0xe9000000 - .long 0xce000000 - .long 0x55000000 - .long 0x28000000 - .long 0xdf000000 - .long 0x8c000000 - .long 0xa1000000 - .long 0x89000000 - .long 0x0d000000 - .long 0xbf000000 - .long 0xe6000000 - .long 0x42000000 - .long 0x68000000 - .long 0x41000000 - .long 0x99000000 - .long 0x2d000000 - .long 0x0f000000 - .long 0xb0000000 - .long 0x54000000 - .long 0xbb000000 - .long 0x16000000 - - -// InvSubBytes embedded in words tables. - .globl _AESInvSubBytesWordTable - .private_extern _AESInvSubBytesWordTable - .align 2 -_AESInvSubBytesWordTable: - // Table 0. - .long 0x00000052 - .long 0x00000009 - .long 0x0000006a - .long 0x000000d5 - .long 0x00000030 - .long 0x00000036 - .long 0x000000a5 - .long 0x00000038 - .long 0x000000bf - .long 0x00000040 - .long 0x000000a3 - .long 0x0000009e - .long 0x00000081 - .long 0x000000f3 - .long 0x000000d7 - .long 0x000000fb - .long 0x0000007c - .long 0x000000e3 - .long 0x00000039 - .long 0x00000082 - .long 0x0000009b - .long 0x0000002f - .long 0x000000ff - .long 0x00000087 - .long 0x00000034 - .long 0x0000008e - .long 0x00000043 - .long 0x00000044 - .long 0x000000c4 - .long 0x000000de - .long 0x000000e9 - .long 0x000000cb - .long 0x00000054 - .long 0x0000007b - .long 0x00000094 - .long 0x00000032 - .long 0x000000a6 - .long 0x000000c2 - .long 0x00000023 - .long 0x0000003d - .long 0x000000ee - .long 0x0000004c - .long 0x00000095 - .long 0x0000000b - .long 0x00000042 - .long 0x000000fa - .long 0x000000c3 - .long 0x0000004e - .long 0x00000008 - .long 0x0000002e - .long 0x000000a1 - .long 0x00000066 - .long 0x00000028 - .long 0x000000d9 - .long 0x00000024 - .long 0x000000b2 - .long 0x00000076 - .long 0x0000005b - .long 0x000000a2 - .long 0x00000049 - .long 0x0000006d - .long 0x0000008b - .long 0x000000d1 - .long 0x00000025 - .long 0x00000072 - .long 0x000000f8 - .long 0x000000f6 - .long 0x00000064 - .long 0x00000086 - .long 0x00000068 - .long 0x00000098 - .long 0x00000016 - .long 0x000000d4 - .long 0x000000a4 - .long 0x0000005c - .long 0x000000cc - .long 0x0000005d - .long 0x00000065 - .long 0x000000b6 - .long 0x00000092 - .long 0x0000006c - .long 0x00000070 - .long 0x00000048 - .long 0x00000050 - .long 0x000000fd - .long 0x000000ed - .long 0x000000b9 - .long 0x000000da - .long 0x0000005e - .long 0x00000015 - .long 0x00000046 - .long 0x00000057 - .long 0x000000a7 - .long 0x0000008d - .long 0x0000009d - .long 0x00000084 - .long 0x00000090 - .long 0x000000d8 - .long 0x000000ab - .long 0x00000000 - .long 0x0000008c - .long 0x000000bc - .long 0x000000d3 - .long 0x0000000a - .long 0x000000f7 - .long 0x000000e4 - .long 0x00000058 - .long 0x00000005 - .long 0x000000b8 - .long 0x000000b3 - .long 0x00000045 - .long 0x00000006 - .long 0x000000d0 - .long 0x0000002c - .long 0x0000001e - .long 0x0000008f - .long 0x000000ca - .long 0x0000003f - .long 0x0000000f - .long 0x00000002 - .long 0x000000c1 - .long 0x000000af - .long 0x000000bd - .long 0x00000003 - .long 0x00000001 - .long 0x00000013 - .long 0x0000008a - .long 0x0000006b - .long 0x0000003a - .long 0x00000091 - .long 0x00000011 - .long 0x00000041 - .long 0x0000004f - .long 0x00000067 - .long 0x000000dc - .long 0x000000ea - .long 0x00000097 - .long 0x000000f2 - .long 0x000000cf - .long 0x000000ce - .long 0x000000f0 - .long 0x000000b4 - .long 0x000000e6 - .long 0x00000073 - .long 0x00000096 - .long 0x000000ac - .long 0x00000074 - .long 0x00000022 - .long 0x000000e7 - .long 0x000000ad - .long 0x00000035 - .long 0x00000085 - .long 0x000000e2 - .long 0x000000f9 - .long 0x00000037 - .long 0x000000e8 - .long 0x0000001c - .long 0x00000075 - .long 0x000000df - .long 0x0000006e - .long 0x00000047 - .long 0x000000f1 - .long 0x0000001a - .long 0x00000071 - .long 0x0000001d - .long 0x00000029 - .long 0x000000c5 - .long 0x00000089 - .long 0x0000006f - .long 0x000000b7 - .long 0x00000062 - .long 0x0000000e - .long 0x000000aa - .long 0x00000018 - .long 0x000000be - .long 0x0000001b - .long 0x000000fc - .long 0x00000056 - .long 0x0000003e - .long 0x0000004b - .long 0x000000c6 - .long 0x000000d2 - .long 0x00000079 - .long 0x00000020 - .long 0x0000009a - .long 0x000000db - .long 0x000000c0 - .long 0x000000fe - .long 0x00000078 - .long 0x000000cd - .long 0x0000005a - .long 0x000000f4 - .long 0x0000001f - .long 0x000000dd - .long 0x000000a8 - .long 0x00000033 - .long 0x00000088 - .long 0x00000007 - .long 0x000000c7 - .long 0x00000031 - .long 0x000000b1 - .long 0x00000012 - .long 0x00000010 - .long 0x00000059 - .long 0x00000027 - .long 0x00000080 - .long 0x000000ec - .long 0x0000005f - .long 0x00000060 - .long 0x00000051 - .long 0x0000007f - .long 0x000000a9 - .long 0x00000019 - .long 0x000000b5 - .long 0x0000004a - .long 0x0000000d - .long 0x0000002d - .long 0x000000e5 - .long 0x0000007a - .long 0x0000009f - .long 0x00000093 - .long 0x000000c9 - .long 0x0000009c - .long 0x000000ef - .long 0x000000a0 - .long 0x000000e0 - .long 0x0000003b - .long 0x0000004d - .long 0x000000ae - .long 0x0000002a - .long 0x000000f5 - .long 0x000000b0 - .long 0x000000c8 - .long 0x000000eb - .long 0x000000bb - .long 0x0000003c - .long 0x00000083 - .long 0x00000053 - .long 0x00000099 - .long 0x00000061 - .long 0x00000017 - .long 0x0000002b - .long 0x00000004 - .long 0x0000007e - .long 0x000000ba - .long 0x00000077 - .long 0x000000d6 - .long 0x00000026 - .long 0x000000e1 - .long 0x00000069 - .long 0x00000014 - .long 0x00000063 - .long 0x00000055 - .long 0x00000021 - .long 0x0000000c - .long 0x0000007d - // Table 1. - .long 0x00005200 - .long 0x00000900 - .long 0x00006a00 - .long 0x0000d500 - .long 0x00003000 - .long 0x00003600 - .long 0x0000a500 - .long 0x00003800 - .long 0x0000bf00 - .long 0x00004000 - .long 0x0000a300 - .long 0x00009e00 - .long 0x00008100 - .long 0x0000f300 - .long 0x0000d700 - .long 0x0000fb00 - .long 0x00007c00 - .long 0x0000e300 - .long 0x00003900 - .long 0x00008200 - .long 0x00009b00 - .long 0x00002f00 - .long 0x0000ff00 - .long 0x00008700 - .long 0x00003400 - .long 0x00008e00 - .long 0x00004300 - .long 0x00004400 - .long 0x0000c400 - .long 0x0000de00 - .long 0x0000e900 - .long 0x0000cb00 - .long 0x00005400 - .long 0x00007b00 - .long 0x00009400 - .long 0x00003200 - .long 0x0000a600 - .long 0x0000c200 - .long 0x00002300 - .long 0x00003d00 - .long 0x0000ee00 - .long 0x00004c00 - .long 0x00009500 - .long 0x00000b00 - .long 0x00004200 - .long 0x0000fa00 - .long 0x0000c300 - .long 0x00004e00 - .long 0x00000800 - .long 0x00002e00 - .long 0x0000a100 - .long 0x00006600 - .long 0x00002800 - .long 0x0000d900 - .long 0x00002400 - .long 0x0000b200 - .long 0x00007600 - .long 0x00005b00 - .long 0x0000a200 - .long 0x00004900 - .long 0x00006d00 - .long 0x00008b00 - .long 0x0000d100 - .long 0x00002500 - .long 0x00007200 - .long 0x0000f800 - .long 0x0000f600 - .long 0x00006400 - .long 0x00008600 - .long 0x00006800 - .long 0x00009800 - .long 0x00001600 - .long 0x0000d400 - .long 0x0000a400 - .long 0x00005c00 - .long 0x0000cc00 - .long 0x00005d00 - .long 0x00006500 - .long 0x0000b600 - .long 0x00009200 - .long 0x00006c00 - .long 0x00007000 - .long 0x00004800 - .long 0x00005000 - .long 0x0000fd00 - .long 0x0000ed00 - .long 0x0000b900 - .long 0x0000da00 - .long 0x00005e00 - .long 0x00001500 - .long 0x00004600 - .long 0x00005700 - .long 0x0000a700 - .long 0x00008d00 - .long 0x00009d00 - .long 0x00008400 - .long 0x00009000 - .long 0x0000d800 - .long 0x0000ab00 - .long 0x00000000 - .long 0x00008c00 - .long 0x0000bc00 - .long 0x0000d300 - .long 0x00000a00 - .long 0x0000f700 - .long 0x0000e400 - .long 0x00005800 - .long 0x00000500 - .long 0x0000b800 - .long 0x0000b300 - .long 0x00004500 - .long 0x00000600 - .long 0x0000d000 - .long 0x00002c00 - .long 0x00001e00 - .long 0x00008f00 - .long 0x0000ca00 - .long 0x00003f00 - .long 0x00000f00 - .long 0x00000200 - .long 0x0000c100 - .long 0x0000af00 - .long 0x0000bd00 - .long 0x00000300 - .long 0x00000100 - .long 0x00001300 - .long 0x00008a00 - .long 0x00006b00 - .long 0x00003a00 - .long 0x00009100 - .long 0x00001100 - .long 0x00004100 - .long 0x00004f00 - .long 0x00006700 - .long 0x0000dc00 - .long 0x0000ea00 - .long 0x00009700 - .long 0x0000f200 - .long 0x0000cf00 - .long 0x0000ce00 - .long 0x0000f000 - .long 0x0000b400 - .long 0x0000e600 - .long 0x00007300 - .long 0x00009600 - .long 0x0000ac00 - .long 0x00007400 - .long 0x00002200 - .long 0x0000e700 - .long 0x0000ad00 - .long 0x00003500 - .long 0x00008500 - .long 0x0000e200 - .long 0x0000f900 - .long 0x00003700 - .long 0x0000e800 - .long 0x00001c00 - .long 0x00007500 - .long 0x0000df00 - .long 0x00006e00 - .long 0x00004700 - .long 0x0000f100 - .long 0x00001a00 - .long 0x00007100 - .long 0x00001d00 - .long 0x00002900 - .long 0x0000c500 - .long 0x00008900 - .long 0x00006f00 - .long 0x0000b700 - .long 0x00006200 - .long 0x00000e00 - .long 0x0000aa00 - .long 0x00001800 - .long 0x0000be00 - .long 0x00001b00 - .long 0x0000fc00 - .long 0x00005600 - .long 0x00003e00 - .long 0x00004b00 - .long 0x0000c600 - .long 0x0000d200 - .long 0x00007900 - .long 0x00002000 - .long 0x00009a00 - .long 0x0000db00 - .long 0x0000c000 - .long 0x0000fe00 - .long 0x00007800 - .long 0x0000cd00 - .long 0x00005a00 - .long 0x0000f400 - .long 0x00001f00 - .long 0x0000dd00 - .long 0x0000a800 - .long 0x00003300 - .long 0x00008800 - .long 0x00000700 - .long 0x0000c700 - .long 0x00003100 - .long 0x0000b100 - .long 0x00001200 - .long 0x00001000 - .long 0x00005900 - .long 0x00002700 - .long 0x00008000 - .long 0x0000ec00 - .long 0x00005f00 - .long 0x00006000 - .long 0x00005100 - .long 0x00007f00 - .long 0x0000a900 - .long 0x00001900 - .long 0x0000b500 - .long 0x00004a00 - .long 0x00000d00 - .long 0x00002d00 - .long 0x0000e500 - .long 0x00007a00 - .long 0x00009f00 - .long 0x00009300 - .long 0x0000c900 - .long 0x00009c00 - .long 0x0000ef00 - .long 0x0000a000 - .long 0x0000e000 - .long 0x00003b00 - .long 0x00004d00 - .long 0x0000ae00 - .long 0x00002a00 - .long 0x0000f500 - .long 0x0000b000 - .long 0x0000c800 - .long 0x0000eb00 - .long 0x0000bb00 - .long 0x00003c00 - .long 0x00008300 - .long 0x00005300 - .long 0x00009900 - .long 0x00006100 - .long 0x00001700 - .long 0x00002b00 - .long 0x00000400 - .long 0x00007e00 - .long 0x0000ba00 - .long 0x00007700 - .long 0x0000d600 - .long 0x00002600 - .long 0x0000e100 - .long 0x00006900 - .long 0x00001400 - .long 0x00006300 - .long 0x00005500 - .long 0x00002100 - .long 0x00000c00 - .long 0x00007d00 - // Table 2. - .long 0x00520000 - .long 0x00090000 - .long 0x006a0000 - .long 0x00d50000 - .long 0x00300000 - .long 0x00360000 - .long 0x00a50000 - .long 0x00380000 - .long 0x00bf0000 - .long 0x00400000 - .long 0x00a30000 - .long 0x009e0000 - .long 0x00810000 - .long 0x00f30000 - .long 0x00d70000 - .long 0x00fb0000 - .long 0x007c0000 - .long 0x00e30000 - .long 0x00390000 - .long 0x00820000 - .long 0x009b0000 - .long 0x002f0000 - .long 0x00ff0000 - .long 0x00870000 - .long 0x00340000 - .long 0x008e0000 - .long 0x00430000 - .long 0x00440000 - .long 0x00c40000 - .long 0x00de0000 - .long 0x00e90000 - .long 0x00cb0000 - .long 0x00540000 - .long 0x007b0000 - .long 0x00940000 - .long 0x00320000 - .long 0x00a60000 - .long 0x00c20000 - .long 0x00230000 - .long 0x003d0000 - .long 0x00ee0000 - .long 0x004c0000 - .long 0x00950000 - .long 0x000b0000 - .long 0x00420000 - .long 0x00fa0000 - .long 0x00c30000 - .long 0x004e0000 - .long 0x00080000 - .long 0x002e0000 - .long 0x00a10000 - .long 0x00660000 - .long 0x00280000 - .long 0x00d90000 - .long 0x00240000 - .long 0x00b20000 - .long 0x00760000 - .long 0x005b0000 - .long 0x00a20000 - .long 0x00490000 - .long 0x006d0000 - .long 0x008b0000 - .long 0x00d10000 - .long 0x00250000 - .long 0x00720000 - .long 0x00f80000 - .long 0x00f60000 - .long 0x00640000 - .long 0x00860000 - .long 0x00680000 - .long 0x00980000 - .long 0x00160000 - .long 0x00d40000 - .long 0x00a40000 - .long 0x005c0000 - .long 0x00cc0000 - .long 0x005d0000 - .long 0x00650000 - .long 0x00b60000 - .long 0x00920000 - .long 0x006c0000 - .long 0x00700000 - .long 0x00480000 - .long 0x00500000 - .long 0x00fd0000 - .long 0x00ed0000 - .long 0x00b90000 - .long 0x00da0000 - .long 0x005e0000 - .long 0x00150000 - .long 0x00460000 - .long 0x00570000 - .long 0x00a70000 - .long 0x008d0000 - .long 0x009d0000 - .long 0x00840000 - .long 0x00900000 - .long 0x00d80000 - .long 0x00ab0000 - .long 0x00000000 - .long 0x008c0000 - .long 0x00bc0000 - .long 0x00d30000 - .long 0x000a0000 - .long 0x00f70000 - .long 0x00e40000 - .long 0x00580000 - .long 0x00050000 - .long 0x00b80000 - .long 0x00b30000 - .long 0x00450000 - .long 0x00060000 - .long 0x00d00000 - .long 0x002c0000 - .long 0x001e0000 - .long 0x008f0000 - .long 0x00ca0000 - .long 0x003f0000 - .long 0x000f0000 - .long 0x00020000 - .long 0x00c10000 - .long 0x00af0000 - .long 0x00bd0000 - .long 0x00030000 - .long 0x00010000 - .long 0x00130000 - .long 0x008a0000 - .long 0x006b0000 - .long 0x003a0000 - .long 0x00910000 - .long 0x00110000 - .long 0x00410000 - .long 0x004f0000 - .long 0x00670000 - .long 0x00dc0000 - .long 0x00ea0000 - .long 0x00970000 - .long 0x00f20000 - .long 0x00cf0000 - .long 0x00ce0000 - .long 0x00f00000 - .long 0x00b40000 - .long 0x00e60000 - .long 0x00730000 - .long 0x00960000 - .long 0x00ac0000 - .long 0x00740000 - .long 0x00220000 - .long 0x00e70000 - .long 0x00ad0000 - .long 0x00350000 - .long 0x00850000 - .long 0x00e20000 - .long 0x00f90000 - .long 0x00370000 - .long 0x00e80000 - .long 0x001c0000 - .long 0x00750000 - .long 0x00df0000 - .long 0x006e0000 - .long 0x00470000 - .long 0x00f10000 - .long 0x001a0000 - .long 0x00710000 - .long 0x001d0000 - .long 0x00290000 - .long 0x00c50000 - .long 0x00890000 - .long 0x006f0000 - .long 0x00b70000 - .long 0x00620000 - .long 0x000e0000 - .long 0x00aa0000 - .long 0x00180000 - .long 0x00be0000 - .long 0x001b0000 - .long 0x00fc0000 - .long 0x00560000 - .long 0x003e0000 - .long 0x004b0000 - .long 0x00c60000 - .long 0x00d20000 - .long 0x00790000 - .long 0x00200000 - .long 0x009a0000 - .long 0x00db0000 - .long 0x00c00000 - .long 0x00fe0000 - .long 0x00780000 - .long 0x00cd0000 - .long 0x005a0000 - .long 0x00f40000 - .long 0x001f0000 - .long 0x00dd0000 - .long 0x00a80000 - .long 0x00330000 - .long 0x00880000 - .long 0x00070000 - .long 0x00c70000 - .long 0x00310000 - .long 0x00b10000 - .long 0x00120000 - .long 0x00100000 - .long 0x00590000 - .long 0x00270000 - .long 0x00800000 - .long 0x00ec0000 - .long 0x005f0000 - .long 0x00600000 - .long 0x00510000 - .long 0x007f0000 - .long 0x00a90000 - .long 0x00190000 - .long 0x00b50000 - .long 0x004a0000 - .long 0x000d0000 - .long 0x002d0000 - .long 0x00e50000 - .long 0x007a0000 - .long 0x009f0000 - .long 0x00930000 - .long 0x00c90000 - .long 0x009c0000 - .long 0x00ef0000 - .long 0x00a00000 - .long 0x00e00000 - .long 0x003b0000 - .long 0x004d0000 - .long 0x00ae0000 - .long 0x002a0000 - .long 0x00f50000 - .long 0x00b00000 - .long 0x00c80000 - .long 0x00eb0000 - .long 0x00bb0000 - .long 0x003c0000 - .long 0x00830000 - .long 0x00530000 - .long 0x00990000 - .long 0x00610000 - .long 0x00170000 - .long 0x002b0000 - .long 0x00040000 - .long 0x007e0000 - .long 0x00ba0000 - .long 0x00770000 - .long 0x00d60000 - .long 0x00260000 - .long 0x00e10000 - .long 0x00690000 - .long 0x00140000 - .long 0x00630000 - .long 0x00550000 - .long 0x00210000 - .long 0x000c0000 - .long 0x007d0000 - // Table 3. - .long 0x52000000 - .long 0x09000000 - .long 0x6a000000 - .long 0xd5000000 - .long 0x30000000 - .long 0x36000000 - .long 0xa5000000 - .long 0x38000000 - .long 0xbf000000 - .long 0x40000000 - .long 0xa3000000 - .long 0x9e000000 - .long 0x81000000 - .long 0xf3000000 - .long 0xd7000000 - .long 0xfb000000 - .long 0x7c000000 - .long 0xe3000000 - .long 0x39000000 - .long 0x82000000 - .long 0x9b000000 - .long 0x2f000000 - .long 0xff000000 - .long 0x87000000 - .long 0x34000000 - .long 0x8e000000 - .long 0x43000000 - .long 0x44000000 - .long 0xc4000000 - .long 0xde000000 - .long 0xe9000000 - .long 0xcb000000 - .long 0x54000000 - .long 0x7b000000 - .long 0x94000000 - .long 0x32000000 - .long 0xa6000000 - .long 0xc2000000 - .long 0x23000000 - .long 0x3d000000 - .long 0xee000000 - .long 0x4c000000 - .long 0x95000000 - .long 0x0b000000 - .long 0x42000000 - .long 0xfa000000 - .long 0xc3000000 - .long 0x4e000000 - .long 0x08000000 - .long 0x2e000000 - .long 0xa1000000 - .long 0x66000000 - .long 0x28000000 - .long 0xd9000000 - .long 0x24000000 - .long 0xb2000000 - .long 0x76000000 - .long 0x5b000000 - .long 0xa2000000 - .long 0x49000000 - .long 0x6d000000 - .long 0x8b000000 - .long 0xd1000000 - .long 0x25000000 - .long 0x72000000 - .long 0xf8000000 - .long 0xf6000000 - .long 0x64000000 - .long 0x86000000 - .long 0x68000000 - .long 0x98000000 - .long 0x16000000 - .long 0xd4000000 - .long 0xa4000000 - .long 0x5c000000 - .long 0xcc000000 - .long 0x5d000000 - .long 0x65000000 - .long 0xb6000000 - .long 0x92000000 - .long 0x6c000000 - .long 0x70000000 - .long 0x48000000 - .long 0x50000000 - .long 0xfd000000 - .long 0xed000000 - .long 0xb9000000 - .long 0xda000000 - .long 0x5e000000 - .long 0x15000000 - .long 0x46000000 - .long 0x57000000 - .long 0xa7000000 - .long 0x8d000000 - .long 0x9d000000 - .long 0x84000000 - .long 0x90000000 - .long 0xd8000000 - .long 0xab000000 - .long 0x00000000 - .long 0x8c000000 - .long 0xbc000000 - .long 0xd3000000 - .long 0x0a000000 - .long 0xf7000000 - .long 0xe4000000 - .long 0x58000000 - .long 0x05000000 - .long 0xb8000000 - .long 0xb3000000 - .long 0x45000000 - .long 0x06000000 - .long 0xd0000000 - .long 0x2c000000 - .long 0x1e000000 - .long 0x8f000000 - .long 0xca000000 - .long 0x3f000000 - .long 0x0f000000 - .long 0x02000000 - .long 0xc1000000 - .long 0xaf000000 - .long 0xbd000000 - .long 0x03000000 - .long 0x01000000 - .long 0x13000000 - .long 0x8a000000 - .long 0x6b000000 - .long 0x3a000000 - .long 0x91000000 - .long 0x11000000 - .long 0x41000000 - .long 0x4f000000 - .long 0x67000000 - .long 0xdc000000 - .long 0xea000000 - .long 0x97000000 - .long 0xf2000000 - .long 0xcf000000 - .long 0xce000000 - .long 0xf0000000 - .long 0xb4000000 - .long 0xe6000000 - .long 0x73000000 - .long 0x96000000 - .long 0xac000000 - .long 0x74000000 - .long 0x22000000 - .long 0xe7000000 - .long 0xad000000 - .long 0x35000000 - .long 0x85000000 - .long 0xe2000000 - .long 0xf9000000 - .long 0x37000000 - .long 0xe8000000 - .long 0x1c000000 - .long 0x75000000 - .long 0xdf000000 - .long 0x6e000000 - .long 0x47000000 - .long 0xf1000000 - .long 0x1a000000 - .long 0x71000000 - .long 0x1d000000 - .long 0x29000000 - .long 0xc5000000 - .long 0x89000000 - .long 0x6f000000 - .long 0xb7000000 - .long 0x62000000 - .long 0x0e000000 - .long 0xaa000000 - .long 0x18000000 - .long 0xbe000000 - .long 0x1b000000 - .long 0xfc000000 - .long 0x56000000 - .long 0x3e000000 - .long 0x4b000000 - .long 0xc6000000 - .long 0xd2000000 - .long 0x79000000 - .long 0x20000000 - .long 0x9a000000 - .long 0xdb000000 - .long 0xc0000000 - .long 0xfe000000 - .long 0x78000000 - .long 0xcd000000 - .long 0x5a000000 - .long 0xf4000000 - .long 0x1f000000 - .long 0xdd000000 - .long 0xa8000000 - .long 0x33000000 - .long 0x88000000 - .long 0x07000000 - .long 0xc7000000 - .long 0x31000000 - .long 0xb1000000 - .long 0x12000000 - .long 0x10000000 - .long 0x59000000 - .long 0x27000000 - .long 0x80000000 - .long 0xec000000 - .long 0x5f000000 - .long 0x60000000 - .long 0x51000000 - .long 0x7f000000 - .long 0xa9000000 - .long 0x19000000 - .long 0xb5000000 - .long 0x4a000000 - .long 0x0d000000 - .long 0x2d000000 - .long 0xe5000000 - .long 0x7a000000 - .long 0x9f000000 - .long 0x93000000 - .long 0xc9000000 - .long 0x9c000000 - .long 0xef000000 - .long 0xa0000000 - .long 0xe0000000 - .long 0x3b000000 - .long 0x4d000000 - .long 0xae000000 - .long 0x2a000000 - .long 0xf5000000 - .long 0xb0000000 - .long 0xc8000000 - .long 0xeb000000 - .long 0xbb000000 - .long 0x3c000000 - .long 0x83000000 - .long 0x53000000 - .long 0x99000000 - .long 0x61000000 - .long 0x17000000 - .long 0x2b000000 - .long 0x04000000 - .long 0x7e000000 - .long 0xba000000 - .long 0x77000000 - .long 0xd6000000 - .long 0x26000000 - .long 0xe1000000 - .long 0x69000000 - .long 0x14000000 - .long 0x63000000 - .long 0x55000000 - .long 0x21000000 - .long 0x0c000000 - .long 0x7d000000 DELETED Source/libtomcrypt/src/ciphers/aesedpport/EncryptDecrypt.s Index: Source/libtomcrypt/src/ciphers/aesedpport/EncryptDecrypt.s ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/EncryptDecrypt.s +++ /dev/null @@ -1,604 +0,0 @@ -/* This file defines _aes_encrypt or _aes_decrypt, according to the value of - the Select preprocessor symbol. This file is designed to be included in - another assembly file using the preprocessor #include directive, to benefit - from some assembly-time calculations. - - These two routines are nearly identical. They differ only in the tables - they use, the direction they iterate through the key, and the permutation - performed on part of the state. - - Written by Eric Postpischil, January 2008. -*/ - -/* add AES HW detection and HW-specific program branch cclee 3-12-10 */ - -#include - -#if Select == 0 - #define Name _aes_encrypt // Routine name. - #define MTable _AESEncryptTable // Main table. - #define FTable _AESSubBytesWordTable // Final table. - #define P0 S0 // State permutation. - #define P1 S1 - #define P2 S2 - #define P3 S3 - #define Increment +16 // ExpandedKey increment. -#elif Select == 1 - #define Name _aes_decrypt // Routine name. - #define MTable _AESDecryptTable // Main table. - #define FTable _AESInvSubBytesWordTable // Final table. - #define P0 S2 // State permutation. - #define P1 S3 - #define P2 S0 - #define P3 S1 - #define Increment -16 // ExpandedKey increment. -#elif Select == 2 - #define Name _aes_encrypt_xmm_no_save // Routine name. - #define MTable _AESEncryptTable // Main table. - #define FTable _AESSubBytesWordTable // Final table. - #define P0 S0 // State permutation. - #define P1 S1 - #define P2 S2 - #define P3 S3 - #define Increment +16 // ExpandedKey increment. -#elif Select == 3 - #define Name _aes_decrypt_xmm_no_save // Routine name. - #define MTable _AESDecryptTable // Main table. - #define FTable _AESInvSubBytesWordTable // Final table. - #define P0 S2 // State permutation. - #define P1 S3 - #define P2 S0 - #define P3 S1 - #define Increment -16 // ExpandedKey increment. -#endif // Select - - -/* Routine: - - _AESEncryptWithExpandedKey (if Select is 0) or - _AESDecryptWithExpandedKey (if Select is 1). - - Function: - - Perform the AES cipher or its inverse as defined in Federal Information - Processing Standards Publication 197 (FIPS-197), November 26, 2001. - - The inverse cipher here is the "Equivalent Inverse Cipher" in FIPS-197. - - Input: - - Constant data: - - The following names must be locally defined so the assembler - can calculate certain offsets. - - For encryption: - - static const Word _AESEncryptTable[4][256]. - - _AESEncryptTable[i] contains the tables T[i] defined in AES - Proposal: Rijndael, version 2, 03/09/99, by Joan Daemen and - Vincent Rijmen, section 5.2.1, page 18. These tables - combine the SubBytes and MixColumns operations. - - static const Word _AESSubBytesWordTable[256]. - - _AESSubBytesWordTable[i][j] = SubBytes(j) << 8*i, where - SubBytes is defined in FIPS-197. _AESSubBytesWordTable - differs from _AESEncryptTable in that it does not include - the MixColumn operation. It is used in performing the last - round, which differs fromm the previous rounds in that it - does not include the MixColumn operation. - - For decryption: - - static const Word _AESDecryptTable[4][256]. - - The analog of _AESEncryptTable for decryption. - - static const Word _AESSubBytesWordTable[256]. - - _AESInvSubBytesWordTable[i][j] = InvSubBytes(j) << 8*i, - where InvSubBytes is defined in FIPS-197. - _AESInvSubBytesWordTable differs from _AESDecryptTable in - that it does not include the InvMixColumn operation. It is - used in performing the last round, which differs from the - previous rounds in that it does not include the - InvMixColumn operation. - - Arguments: - - const Byte *InputText. - - Address of input, 16 bytes. Best if four-byte aligned. - - Byte *OutputText. - - Address of output, 16 bytes. Best if four-byte aligned. - - aes_encrypt_ctx *Context or aes_decrypt_ctx *Context - - aes_encrypt_ctx and aes_decrypt_ctx are identical except the - former is used for encryption and the latter for decryption. - - Each is a structure containing the expanded key beginning at - offset ContextKey and a four-byte "key length" beginning at - offset ContextKeyLength. The "key length" is the number of - bytes from the start of the first round key to the start of the - last round key. That is 16 less than the number of bytes in - the entire key. - - Output: - - Encrypted or decrypted data is written to *OutputText. - - Return: - - aes_rval // -1 if "key length" is invalid. 0 otherwise. -*/ - - .text - .globl Name -Name: - - // detect AES HW, cclee 3-13-10 -#if Select < 2 // only for aes_encrypt/aes_decrypt -#if defined __x86_64__ - movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capabilities - mov (%rax), %eax // %eax = __cpu_capabilities -#else -#ifdef KERNEL - leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities - mov (%eax), %eax // %eax = __cpu_capabilities -#else - mov _COMM_PAGE_CPU_CAPABILITIES, %eax -#endif -#endif - test $(kHasAES), %eax // __cpu_capabilities & kHasAES -#if Select == 0 - jne _aes_encrypt_hw // if AES HW detected, branch to HW specific code -#else - jne _aes_decrypt_hw // if AES HW detected, branch to HW specific code -#endif -#endif // Select - - // Push new stack frame. - push r5 - - /* Save registers and set SaveSize to the number of bytes pushed onto the - stack so far, including the caller's return address. - */ - push r3 - #if defined __i386__ - push r6 - push r7 - #define SaveSize (5*4) - #else - #define SaveSize (3*8) - #endif - - /* Number of bytes used for local variables: - - 4 (i386) or 0 (x86_64) bytes for ExpandedKeyEnd. - - 5 (i386) or 3 (x86_64) 16-byte spaces to save XMM registers. - */ - #define LocalsSize (Arch(4, 0) + Arch(5, 3)*16) - - #if 0 < LocalsSize - // Padding to position stack pointer at a multiple of 16 bytes. - #define Padding (15 & -(SaveSize + LocalsSize)) - sub $Padding + LocalsSize, r4 // Allocate space on stack. - #else - #define Padding 0 - #endif - -#ifdef KERNEL -#if Select < 2 - // Save XMM registers. - movaps %xmm0, 0*16(r4) - movaps %xmm1, 1*16(r4) - movaps %xmm2, 2*16(r4) -#if defined __i386__ - movaps %xmm3, 3*16(r4) - movaps %xmm4, 4*16(r4) -#endif -#endif // Select -#endif // KERNEL - -#if defined __i386__ - - // Number of bytes from caller's stack pointer to ours. - #define StackFrame (SaveSize + Padding + LocalsSize) - - // Define location of argument i (presuming 4-byte arguments). - #define Argument(i) StackFrame+4*(i)(%esp) - - #define ArgInputText Argument(0) - #define ArgOutputText Argument(1) - #define ArgContext Argument(2) - -#elif defined __x86_64__ - - // Arguments. - #define InputText r7 // Used early then overwritten for other use. - #define OutputText r6 // Needed near end of routine. - #define ArgContext r2 - /* The argument passed in r2 overlaps registers we need for other - work, so it must be moved early in the routine. - */ - -#endif - -#define BaseP Arch(r6, r9) // Base pointer for addressing global data. -#define ExpandedKey Arch(t0, r10) // Address of expanded key. - -/* The Work registers defined below are used to hold parts of the AES state - while we dissect or assemble it. They must be assigned to the A, B, C, and - D registers so that we can access the bytes in %al, %ah, and so on. -*/ -#define Work0d r0d -#define Work0l r0l -#define Work0h r0h -#define Work1d r3d -#define Work1l r3l -#define Work1h r3h -#define Work2d r1d -#define Work2l r1l -#define Work2h r1h -#define Work3d r2d -#define Work3l r2l -#define Work3h r2h - -#define t0 r5 -#define t0d r5d // Low 32 bits of t0. -#define t0l r5l // Low byte of t0. - -#define t1 r7 - -/* S0, S1, S2, and S3 are where we assemble the new AES state when computing - a regular round. S1, S2, and S3 are assigned to the Work registers, but - S0 needs to go somewhere else because Work0 holds part of the old state. -*/ -#define S0 Arch(t1, r8d) -#define S1 Work1d -#define S2 Work2d -#define S3 Work3d - -/* These XMM registers are used as holding space, because it is faster to - spill to these registers than to the stack. (On x86_64, we do not need - to spill, because there are additional general registers available. - However, using more general registers requires saving them to the stack - and restoring them. I timed it, and no time was saved.) -*/ -#define vS1 %xmm0 -#define vS2 %xmm1 -#define vS3 %xmm2 -#if defined __i386__ - #define vExpandedKey %xmm3 - #define vIncrement %xmm4 -#endif - - // Get address of expanded key. - mov ArgContext, ExpandedKey - #if 0 != ContextKey - add $ContextKey, ExpandedKey - #endif - -/* Store sentinel value of ExpandedKey on the stack on i386, a register on - x86_64. -*/ -#define ExpandedKeyEnd Arch(5*16(r4), r11) - - // Get and check "key length". - movzx ContextKeyLength(ExpandedKey), r0 - cmp $160, r0 - je 2f - cmp $192, r0 - je 2f - cmp $224, r0 - je 2f - mov $-1, r0 // Return error. - jmp 9f -2: - - #if (Select == 0 || Select == 2) - // For encryption, prepare to iterate forward through expanded key. - add ExpandedKey, r0 - mov r0, ExpandedKeyEnd - #else - // For decryption, prepare to iterate backward through expanded key. - mov ExpandedKey, ExpandedKeyEnd - add r0, ExpandedKey - #endif - - // Initialize State from input text. - #if defined __i386__ - mov ArgInputText, BaseP - #define InputText BaseP - #endif - mov 0*4(InputText), Work0d - mov 1*4(InputText), S1 - mov 2*4(InputText), S2 - mov 3*4(InputText), S3 -#undef InputText // Register is reused after this for other purposes. - - // Add round key and save results. - xor 0*4(ExpandedKey), Work0d // S0 is in dissection register. - xor 1*4(ExpandedKey), S1 - movd S1, vS1 // Save S1 to S3 in vector registers. - xor 2*4(ExpandedKey), S2 - movd S2, vS2 - xor 3*4(ExpandedKey), S3 - movd S3, vS3 - - add $Increment, ExpandedKey // Advance to next round key. - - #if defined __i386__ - // Save expanded key address and increment in vector registers. - mov $Increment, t1 - movp ExpandedKey, vExpandedKey - movp t1, vIncrement - #endif - - // Set up relative addressing. - #if defined __i386__ - - // Get address of 0 in BaseP. - call 0f // Push program counter onto stack. - 0: - pop BaseP // Get program counter. - - // Define macros to help address data. -#define LookupM(table, index) MTable-0b+(table)*TableSize(BaseP, index, 4) -#define LookupF(table, index) FTable-0b+(table)*TableSize(BaseP, index, 4) - - #elif defined __x86_64__ - - lea MTable(%rip), BaseP - - // Define macros to help address data. - #define LookupM(table, index) (table)*TableSize(BaseP, index, 4) - #define LookupF(table, index) (table)*TableSize(BaseP, index, 4) - -/* With these definitions of LookupM and LookupF, BaseP must be loaded with - the address of the table at the point where it is used. So we need an - instruction to change BaseP after we are done with MTable and before we - start using FTable. I would prefer to use something like: - - .set FMinusM, FTable - MTable - #define LookupF(table, index) \ - FMinusM+(table)*TableSize(BaseP, index, 4) - - Then BaseP would not need to change. However, this fails due to an - assembler/linker bug, . -*/ - - #endif - - // Get round key. - mov 0*4(ExpandedKey), S0 - mov 1*4(ExpandedKey), S1 - mov 2*4(ExpandedKey), S2 - mov 3*4(ExpandedKey), S3 - -1: - /* Word 0 of the current state must be in Work0 now, and the next round - key must be in S0 to S3. - */ - - // Process previous S0. - movzx Work0l, t0 - xor LookupM(0, t0), S0 - movzx Work0h, t0d - xor LookupM(1, t0), P3 - shr $16, Work0d - movzx Work0l, t0d - xor LookupM(2, t0), S2 - movzx Work0h, t0d - xor LookupM(3, t0), P1 - - // Process previous S1. - movd vS1, Work0d - movzx Work0l, t0d - xor LookupM(0, t0), S1 - movzx Work0h, t0d - xor LookupM(1, t0), P0 - shr $16, Work0d - movzx Work0l, t0d - xor LookupM(2, t0), S3 - movzx Work0h, t0d - xor LookupM(3, t0), P2 - - // Process previous S2. - movd vS2, Work0d - movzx Work0l, t0d - xor LookupM(0, t0), S2 - movzx Work0h, t0d - xor LookupM(1, t0), P1 - shr $16, Work0d - movzx Work0l, t0d - xor LookupM(2, t0), S0 - movzx Work0h, t0d - xor LookupM(3, t0), P3 - - // Process previous S3. - movd vS3, Work0d - movzx Work0l, t0d - xor LookupM(0, t0), S3 - movzx Work0h, t0d - xor LookupM(1, t0), P2 - shr $16, Work0d - movzx Work0l, t0d - xor LookupM(2, t0), S1 - movzx Work0h, t0d - xor LookupM(3, t0), P0 - - #if defined __i386__ - paddd vIncrement, vExpandedKey - movp vExpandedKey, ExpandedKey - #else - add $Increment, ExpandedKey - #endif - - // Save state for next iteration and load next round key. - mov S0, Work0d - mov 0*4(ExpandedKey), S0 - movd S1, vS1 - mov 1*4(ExpandedKey), S1 - movd S2, vS2 - mov 2*4(ExpandedKey), S2 - movd S3, vS3 - mov 3*4(ExpandedKey), S3 - - cmp ExpandedKeyEnd, ExpandedKey - jne 1b - - /* Word 0 of the current state must be in Work0 now, and the next round - key must be in S0 to S3. - */ - - // Work around assembler bug. See comments above about Radar 5683882. - #if defined __x86_64__ - lea FTable(%rip), BaseP - #endif - - // Process previous S0. - movzx Work0l, t0 - xor LookupF(0, t0), S0 - movzx Work0h, t0d - xor LookupF(1, t0), P3 - shr $16, Work0d - movzx Work0l, t0d - xor LookupF(2, t0), S2 - movzx Work0h, t0d - xor LookupF(3, t0), P1 - - // Process previous S1. - movd vS1, Work0d - movzx Work0l, t0d - xor LookupF(0, t0), S1 - movzx Work0h, t0d - xor LookupF(1, t0), P0 - shr $16, Work0d - movzx Work0l, t0d - xor LookupF(2, t0), S3 - movzx Work0h, t0d - xor LookupF(3, t0), P2 - - // Process previous S2. - movd vS2, Work0d - movzx Work0l, t0d - xor LookupF(0, t0), S2 - movzx Work0h, t0d - xor LookupF(1, t0), P1 - shr $16, Work0d - movzx Work0l, t0d - xor LookupF(2, t0), S0 - movzx Work0h, t0d - xor LookupF(3, t0), P3 - - // Process previous S3. - movd vS3, Work0d - movzx Work0l, t0d - xor LookupF(0, t0), S3 - movzx Work0h, t0d - xor LookupF(1, t0), P2 - shr $16, Work0d - movzx Work0l, t0d - xor LookupF(2, t0), S1 - movzx Work0h, t0d - xor LookupF(3, t0), P0 - - #if defined __i386__ // Architecture. - // Get OutputText address. - #define OutputText BaseP - mov ArgOutputText, OutputText - #endif // Architecture. - - // Write output. - mov S0, 0*4(OutputText) - mov S1, 1*4(OutputText) - mov S2, 2*4(OutputText) - mov S3, 3*4(OutputText) - - xor r0, r0 // Return success. - -9: - // Pop stack and restore registers. -#ifdef KERNEL -#if Select < 2 -#if defined __i386__ - movaps 4*16(r4), %xmm4 - movaps 3*16(r4), %xmm3 -#endif - movaps 2*16(r4), %xmm2 - movaps 1*16(r4), %xmm1 - movaps 0*16(r4), %xmm0 -#endif // Select -#endif // KERNEL - #if 0 < LocalsSize - add $Padding + LocalsSize, r4 - #endif - #if defined __i386__ - pop r7 - pop r6 - #elif defined __x86_64__ - #endif - pop r3 - pop r5 - - ret - - -#undef ArgExpandedKey -#undef ArgInputText -#undef ArgNr -#undef ArgOutputText -#undef Argument -#undef BaseP -#undef ExpandedKey -#undef ExpandedKeyEnd -#undef FTable -#undef InputText -#undef LocalsSize -#undef LookupM -#undef LookupF -#undef MTable -#undef OutputText -#undef Padding -#undef SaveSize -#undef S0 -#undef S1 -#undef S2 -#undef S3 -#undef StackFrame -#undef Work0d -#undef Work0h -#undef Work0l -#undef Work1d -#undef Work1h -#undef Work1l -#undef Work2d -#undef Work2h -#undef Work2l -#undef Work3d -#undef Work3h -#undef Work3l -#undef t0 -#undef t0d -#undef t0l -#undef t1 -#undef vExpandedKey -#undef vS1 -#undef vS2 -#undef vS3 - -#undef Name -#undef MTable -#undef FTable -#undef P0 -#undef P1 -#undef P2 -#undef P3 -#undef Increment DELETED Source/libtomcrypt/src/ciphers/aesedpport/ExpandKeyForDecryption.s Index: Source/libtomcrypt/src/ciphers/aesedpport/ExpandKeyForDecryption.s ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/ExpandKeyForDecryption.s +++ /dev/null @@ -1,1216 +0,0 @@ -/* This file defines _aes_decrypt_key, _aes_decrypt_key128, - _aes_decrypt_key192, and _aes_decrypt_key256. It is designed to be - included in another assembly file with the preprocessor #include directive, - to benefit from some assembly-time calculations. - - Written by Eric Postpischil, January 2008. - - The comments here do not say much about the algorithm; the code just - follows the FIPS-197 specification. I recommend reading the specification - before working with this code or examining the C code in the parent - directory that illustrates key expansion. - - One complication is that this routine both expands the key and applies - InvMixColumn to most of the words in the expanded key. This modifies the - key for use with the Equivalent Inverse Cipher. - - During key expansion, there are sequences of four or six words that are - produced like this: - - E[i+0] = E[i+0-Nk] ^ f(E[i-1]), where f is some function. - E[i+1] = E[i+1-Nk] ^ E[i+0]. - E[i+2] = E[i+2-Nk] ^ E[i+1]. - E[i+3] = E[i+3-Nk] ^ E[i+2]. - - When Nk is four or eight, the sequence stops there. When it is six, it - goes on for two more words. Let I be the InvMixColumn function. for the - Equivalent Inverse Cipher, we want to store I(E[i+0]), I(E[i+1]), - I(E[i+2]), I(E[i+3]) (and two more when Nk is six). However, we do not - need to calculate I four times. In AES' finite field, I is a linear - combination of the four bytes of its input. The ^ operation on the bits - that represent field elements is an addition in the Galois field. So - I(a ^ b) = I(a) ^ I(b). Then we have: - - I(E[i+0]) = I(E[i+0-Nk] ^ f(E[i-1])) = I(E[i+0-Nk]) ^ I(f(E[i-1])). - I(E[i+1]) = I(E[i+1-Nk]) ^ I(E[i+0]). - I(E[i+2]) = I(E[i+2-Nk]) ^ I(E[i+1]). - I(E[i+3]) = I(E[i+3-Nk]) ^ I(E[i+2]). - - To compute this, we compute I(f(E[i-1])) and XOR it with the previously - stored E[i+0-Nk])) to get I(E[i+0])). Then we XOR that with the previously - stored E[i+1-Nk])) to get I(E[i+1])), and so on. - - Note that to compute I(f(E[i-1])), we need to have E[i-1]. So we have to - compute the pre-InvMixColumn words of the expanded key; it is not - sufficient to have the post-InvMixColumn words. -*/ - - -/* Routine: - - _aes_decrypt_key. - - _aes_decrypt_key128, _aes_decrypt_key192, and _aes_decrypt_key256. - - Function: - - Expand the user's cipher key into the key schedule, as defined in - Federal Information Processing Standards Publication 197 (FIPS-197), - November 26, 2001. - - For decryption, the key is modified as shown in Figure 15 in FIPS-197, - to support the Equivalent Inverse Cipher. - - Input: - - Constant data: - - The following names must be locally defined so the assembler - can calculate certain offsets. - - static const Word _AESSubBytesWordTable[4][256]. - - _AESSubBytesWordTable[i][j] = SubBytes(j) << 8*i, where - SubBytes is defined in FIPS-197. _AESSubBytesWordTable - differs from _AESEncryptTable in that it does not include - the MixColumn operation. It is used in performing the last - round, which differs fromm the previous rounds in that it - does not include the MixColumn operation. - - static const Word _AESSInvMixColumnTable[4][256]. - - _AESInvMixColumnTable[i][j] contains the contribution of byte - j to element i of the InvMixColumn operation. - - The four bytes of the word _AESInvMixColumnTable[0][j] are: - - {0xe}*{j}, {0x9}*{j}, {0xd}*{j}, {0xb}*{j}, - - listed in increasing address order, where multiplication is - performed in the Galois field. {j} designates the element of - the Galois field represented by j. _AESInvMixColumn[i][j] has - the same bytes, rotated right in the order shown above. - - static const Byte _AESRcon[]. - - Round constants, beginning with AESRcon[1] for the first round - (AESRcon[0] is padding.) - - Arguments: - - const unsigned char *Key - - Address of user's cipher key. - - int Length - - Number of bytes (16, 24, or 32) or bits (128, 192, or 256) in - user's cipher key. - - This argument is used with _aes_decrypt_key. It is not - present for the other routines. In those routines, Context - is the second argument. - - aes_decrypt_ctx *Context - - Structure to contain the expanded key beginning at offset - ContextKey and a four-byte "key length" beginning at offset - ContextKeyLength. The "key length" is the number of bytes from - the start of the first round key to the startof the last rond - key. That is 16 less than the number of bytes in the entire - key. - - Output: - - The expanded key and the "key length" are written to *Context. - - Return: - - aes_rval // -1 if "key length" is invalid. 0 otherwise. -*/ -/* add AES HW detection and program branch if AES HW is detected cclee 3-12-10 */ - -#include - -#define dr r0d // Dissection register. -#define drl r0l // Low 8 bits of dissection register. -#define drh r0h // Second-lowest 8 bits of dissection register. - -#define t0 r1 -#define t0d r1d // Low 32 bits of t0. - -#define STable r2 // Address of SubBytes table. Overlaps Nk. -#define ITable r3 // Address of InvMixColumn table. -#define offset Arch(r5, r11) // Address offset and loop sentinel. - -#define R r7 // Address of round constant. -#define K r7 // User key pointer. - // R and K overlap. - -#define E r6 // Expanded key pointer. - -#define ve0 %xmm0 -#define ve1 %xmm1 -#define ve2 %xmm2 -#define ve3 %xmm3 -#define ve4 %xmm4 -#define ve5 %xmm5 -#define vt1 %xmm6 -#define vt0 %xmm7 - -#define LookupS(table, index) (table)*TableSize(STable, index, 4) -#define LookupI(table, index) (table)*TableSize(ITable, index, 4) - - -/* InvMixColumn puts InvMixColumn(dr) into vt0. This is a non-standard - subroutine. It does not conform to the ABI. It is an integral part of - _ExpandKeyForDecryption and shares register use with it. -*/ -InvMixColumn: - movzx drl, t0 - movd LookupI(0, t0), vt0 // Look up byte 0 in table 0. - movzx drh, t0d - movd LookupI(1, t0), vt1 // Look up byte 1 in table 1. - pxor vt1, vt0 - shr $16, dr - movzx drl, t0d - movd LookupI(2, t0), vt1 // Look up byte 2 in table 2. - pxor vt1, vt0 - movzx drh, t0d - movd LookupI(3, t0), vt1 // Look up byte 3 in table 3. - pxor vt1, vt0 - ret - - - // SubWordRotWord adds (XORs) SubWord(RotWord(dr)) to vt0. - .macro SubWordRotWord - movzx drl, t0 - movd LookupS(3, t0), vt1 // Look up byte 0 in table 3. - pxor vt1, vt0 - movzx drh, t0d - movd LookupS(0, t0), vt1 // Look up byte 1 in table 0. - pxor vt1, vt0 - shr $$16, dr - movzx drl, t0d - movd LookupS(1, t0), vt1 // Look up byte 2 in table 1. - pxor vt1, vt0 - movzx drh, t0d - movd LookupS(2, t0), vt1 // Look up byte 3 in table 2. - pxor vt1, vt0 - .endmacro - - - // SubWord puts SubWord(dr) into vt0. - .macro SubWord - movzx drl, t0 - movd LookupS(0, t0), vt0 // Look up byte 0 in table 0. - movzx drh, t0d - movd LookupS(1, t0), vt1 // Look up byte 1 in table 1. - pxor vt1,vt0 - shr $$16, dr - movzx drl, t0d - movd LookupS(2, t0), vt1 // Look up byte 2 in table 2. - pxor vt1,vt0 - movzx drh, t0d - movd LookupS(3, t0), vt1 // Look up byte 3 in table 3. - pxor vt1,vt0 - .endmacro - - .text - .globl _aes_decrypt_key -// .private_extern _aes_decrypt_key -_aes_decrypt_key: - - // detect AES HW, cclee 3-13-10 -#if defined __x86_64__ - movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capabilities - mov (%rax), %eax // %eax = __cpu_capabilities -#else -#ifdef KERNEL - leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities - mov (%eax), %eax // %eax = __cpu_capabilities -#else - mov _COMM_PAGE_CPU_CAPABILITIES, %eax -#endif -#endif - test $(kHasAES), %eax // __cpu_capabilities & kHasAES - jne _aes_decrypt_key_hw // if AES HW detected, branch to _aes_decrypt_key_hw - - /* Save registers and set SaveSize to the number of bytes pushed onto the - stack so far, including the caller's return address. - */ - push r3 - #if defined __i386__ - push r5 - push r6 - push r7 - #define SaveSize (5*4) - #else - #define SaveSize (2*8) - #endif - - /* Number of bytes used for local variables: - - 8 16-byte spaces to save XMM registers. - - 8 four-byte spaces for work. - */ - #define LocalsSize (8*16 + 8*4) - - // Define stack offset to storage space for local data. - #define Local (8*16) - - #if 0 < LocalsSize - // Padding to position stack pointer at a multiple of 16 bytes. - #define Padding (15 & -(SaveSize + LocalsSize)) - sub $Padding + LocalsSize, r4 // Allocate space on stack. - #else - #define Padding 0 - #endif - - /* StackFrame is the number of bytes in our stack frame, from caller's - stack pointer to ours (so it includes the return address). - */ - #define StackFrame (SaveSize + Padding + LocalsSize) - - // Save xmm registers. - movaps %xmm0, 0*16(r4) - movaps %xmm1, 1*16(r4) - movaps %xmm2, 2*16(r4) - movaps %xmm3, 3*16(r4) - movaps %xmm4, 4*16(r4) - movaps %xmm5, 5*16(r4) - movaps %xmm6, 6*16(r4) - movaps %xmm7, 7*16(r4) - -#if defined __i386__ - - // Define location of argument i. - #define Argument(i) StackFrame+4*(i)(r4) - - #define Nk t0d - - // Load arguments. - mov Argument(2), E - mov Argument(1), Nk - mov Argument(0), K - -#elif defined __x86_64__ - - #define Nk r9d // Number of words in key. - mov r6d, Nk // Move Nk argument out of way. - mov r2, E // Move E argument to common register. - -#endif - - // Dispatch on key length. - cmp $128, Nk - jge 2f - shl $3, Nk // Convert from bytes to bits. - cmp $128, Nk -2: - je DKeyHas4Words - cmp $192, Nk - je DKeyHas6Words - cmp $256, Nk - je DKeyHas8Words - mov $-1, r0 // Return error. - jmp 9f - - - .globl _aes_decrypt_key128 -// .private_extern _aes_decrypt_key128 -_aes_decrypt_key128: - - /* Save registers and set SaveSize to the number of bytes pushed onto the - stack so far, including the caller's return address. - */ - push r3 - #if defined __i386__ - push r5 - push r6 - push r7 - #define SaveSize (5*4) - #else - #define SaveSize (2*8) - #endif - - /* Number of bytes used for local variables: - - 8 16-byte spaces to save XMM registers. - - 8 four-byte spaces for work. - */ - #define LocalsSize (8*16 + 8*4) - - // Define stack offset to storage space for local data. - #define Local (8*16) - - #if 0 < LocalsSize - // Padding to position stack pointer at a multiple of 16 bytes. - #define Padding (15 & -(SaveSize + LocalsSize)) - sub $Padding + LocalsSize, r4 // Allocate space on stack. - #else - #define Padding 0 - #endif - - /* StackFrame is the number of bytes in our stack frame, from caller's - stack pointer to ours (so it includes the return address). - */ - #define StackFrame (SaveSize + Padding + LocalsSize) - - // Save xmm registers. - movaps %xmm0, 0*16(r4) - movaps %xmm1, 1*16(r4) - movaps %xmm2, 2*16(r4) - movaps %xmm3, 3*16(r4) - movaps %xmm4, 4*16(r4) - movaps %xmm5, 5*16(r4) - movaps %xmm6, 6*16(r4) - movaps %xmm7, 7*16(r4) - -#if defined __i386__ - - // Load arguments. - #define Argument(i) StackFrame+4*(i)(r4) - mov Argument(1), E - mov Argument(0), K - -#endif - -// Merge point for _aes_decrypt_key and _aes_decrypt_key128. -DKeyHas4Words: - - // First words of expanded key are copied from user key. - movd 0*4(K), ve0 - movd 1*4(K), ve1 - movd 2*4(K), ve2 - movd 3*4(K), ve3 - - movl $10*16, ContextKeyLength(E) // Set "key length." - - #if 0 != ContextKey - add $ContextKey, E - #endif - - // K cannot be used after we write to R, since they use the same register. - - #if defined __i386__ - - call 0f // Push program counter onto stack. - 0: pop STable // Get program counter. - lea _AESRcon-0b(STable), R - lea _AESInvMixColumnTable-0b(STable), ITable - lea _AESSubBytesWordTable-0b(STable), STable - - #elif defined __x86_64__ - - lea _AESRcon(%rip), R - lea _AESInvMixColumnTable(%rip), ITable - lea _AESSubBytesWordTable(%rip), STable - - #endif - - /* With a four-word key, there are ten rounds (eleven 16-byte key blocks), - nine of which have InvMixColumn applied. - */ - mov $-9*4*4, offset - sub offset, E - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 0*4(E, offset) - movd ve1, 1*4(E, offset) - movd ve2, 2*4(E, offset) - movd ve3, 3*4(E, offset) - -/* Here is the first iteration of the key expansion. It is separate from the - main loop below because we need to apply InvMixColumn to each of the - outputs, in ve0 through ve3. In the main loop, the technique described at - the top of this file is used to compute the proper outputs while using - InvMixColumn only once. -*/ - add $1, R // Advance pointer. - movd ve3, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - pxor ve0, ve1 - pxor ve1, ve2 - pxor ve2, ve3 - - add $4*4, offset - - /* Apply InvMixColumn to each word. The transformed values are stored in - the expanded key. The original values are retained in registers for - further computation. - */ - movd ve0, dr - call InvMixColumn - movd vt0, 0*4(E, offset) - - movd ve1, dr - call InvMixColumn - movd vt0, 1*4(E, offset) - - movd ve2, dr - call InvMixColumn - movd vt0, 2*4(E, offset) - - movd ve3, dr - call InvMixColumn - movd vt0, 3*4(E, offset) - -// Here is the main loop. -1: - add $1, R // Advance pointer. - movd ve3, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - pxor ve0, ve1 - pxor ve1, ve2 - pxor ve2, ve3 - /* Dr. Brian Gladman uses a technique with a single XOR here instead - of the previous four. There is some periodic behavior in the key - expansion, and Gladman maintains E[4*i+3] for the latest four - values of i. XORing the value in vt0 with one of these yields its - replacement. However, using this technique requires additional - instructions before the loop (to initialize the values) and after - it (to extract the final values to be stored) and either some way - to rotate or index four values in the loop or a four-fold unrolling - of the loop to provide the indexing. Experiment suggests the - former is not worthwhile. Unrolling the loop might give a small - gain, at the cost of increased use of instruction cache, increased - instructions loads the first time the routine is executed, and - increased code complexity, so I decided against it. - */ - - // Apply InvMixColumn to the difference. - movd vt0, dr - call InvMixColumn - - add $4*4, offset - - // Chain the transformed difference to previously transformed outputs. - movd (0-4)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 0*4(E, offset) - - movd (1-4)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 1*4(E, offset) - - movd (2-4)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 2*4(E, offset) - - movd (3-4)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 3*4(E, offset) - - jl 1b - -// Here is the final iteration, which does not perform InvMixColumn. - - movd ve3, dr // Put previous word into work register. - movzx 1(R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - movd ve0, 4*4(E, offset) - pxor ve0, ve1 - movd ve1, 5*4(E, offset) - pxor ve1, ve2 - movd ve2, 6*4(E, offset) - pxor ve2, ve3 - movd ve3, 7*4(E, offset) - - xor r0, r0 // Return success. - -9: - // Pop stack and restore registers. - movaps 7*16(r4), %xmm7 - movaps 6*16(r4), %xmm6 - movaps 5*16(r4), %xmm5 - movaps 4*16(r4), %xmm4 - movaps 3*16(r4), %xmm3 - movaps 2*16(r4), %xmm2 - movaps 1*16(r4), %xmm1 - movaps 0*16(r4), %xmm0 - #if 0 < LocalsSize - add $Padding + LocalsSize, r4 - #endif - #if defined __i386__ - pop r7 - pop r6 - pop r5 - #endif - pop r3 - - ret - - - .globl _aes_decrypt_key192 -// .private_extern _aes_decrypt_key192 -_aes_decrypt_key192: - - /* Save registers and set SaveSize to the number of bytes pushed onto the - stack so far, including the caller's return address. - */ - push r3 - #if defined __i386__ - push r5 - push r6 - push r7 - #define SaveSize (5*4) - #else - #define SaveSize (2*8) - #endif - - /* Number of bytes used for local variables: - - 8 16-byte spaces to save XMM registers. - - 8 four-byte spaces for work. - */ - #define LocalsSize (8*16 + 8*4) - - // Define stack offset to storage space for local data. - #define Local (8*16) - - #if 0 < LocalsSize - // Padding to position stack pointer at a multiple of 16 bytes. - #define Padding (15 & -(SaveSize + LocalsSize)) - sub $Padding + LocalsSize, r4 // Allocate space on stack. - #else - #define Padding 0 - #endif - - /* StackFrame is the number of bytes in our stack frame, from caller's - stack pointer to ours (so it includes the return address). - */ - #define StackFrame (SaveSize + Padding + LocalsSize) - - // Save xmm registers. - movaps %xmm0, 0*16(r4) - movaps %xmm1, 1*16(r4) - movaps %xmm2, 2*16(r4) - movaps %xmm3, 3*16(r4) - movaps %xmm4, 4*16(r4) - movaps %xmm5, 5*16(r4) - movaps %xmm6, 6*16(r4) - movaps %xmm7, 7*16(r4) - -#if defined __i386__ - - // Load arguments. - #define Argument(i) StackFrame+4*(i)(r4) - mov Argument(1), E - mov Argument(0), K - -#endif - -// Merge point for _aes_decrypt_key and _aes_decrypt_key192. -DKeyHas6Words: - - // First words of expanded key are copied from user key. - movd 0*4(K), ve0 - movd 1*4(K), ve1 - movd 2*4(K), ve2 - movd 3*4(K), ve3 - - movl $12*16, ContextKeyLength(E) // Set "key length." - - #if 0 != ContextKey - add $ContextKey, E - #endif - - movd 4*4(K), ve4 - movd 5*4(K), ve5 - - // K cannot be used after we write to R, since they use the same register. - - #if defined __i386__ - - call 0f // Push program counter onto stack. - 0: pop STable // Get program counter. - lea _AESRcon-0b(STable), R - lea _AESInvMixColumnTable-0b(STable), ITable - lea _AESSubBytesWordTable-0b(STable), STable - - #elif defined __x86_64__ - - lea _AESRcon(%rip), R - lea _AESInvMixColumnTable(%rip), ITable - lea _AESSubBytesWordTable(%rip), STable - - #endif - - /* With a six-word key, there are twelve rounds (thirteen 16-byte key - blocks), eleven of which have InvMixColumn applied. The key expansion - proceeds in iterations of six four-byte words, so the termination - condition is a bit complicated. We set offset to the negative of 10 - four four-byte words, and the loop branch does another iteration if - offset is less than or equal to zero, meaning the number of iterations - performed so far is less than or equal to 10. Thus, after ten - iterations, it branches again. After the eleventh iteration, it - stops. Code after the end of the loop computes the twelfth key block, - which does not have InvMixColumn applied. - */ - mov $-10*4*4, offset - sub offset, E - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 0*4(E, offset) - movd ve1, 1*4(E, offset) - movd ve2, 2*4(E, offset) - movd ve3, 3*4(E, offset) - - /* The first four words are stored untransformed. After that, words in - the expanded key are transformed by InvMixColumn. - */ - movd ve4, dr - call InvMixColumn - movd vt0, 4*4(E, offset) - - movd ve5, dr - call InvMixColumn - movd vt0, 5*4(E, offset) - -/* Here is the first iteration of the key expansion. It is separate from the - main loop below because we need to apply InvMixColumn to each of the - outputs, in ve0 through ve5. In the main loop, the technique described at - the top of this file is used to compute the proper outputs while using - InvMixColumn only once. -*/ - add $1, R // Advance pointer. - movd ve5, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - pxor ve0, ve1 - pxor ve1, ve2 - pxor ve2, ve3 - pxor ve3, ve4 - pxor ve4, ve5 - - add $6*4, offset - - /* Apply InvMixColumn to each word. The transformed values are stored in - the expanded key. The original values are retained in registers for - further computation. - */ - movd ve0, dr - call InvMixColumn - movd vt0, 0*4(E, offset) - - movd ve1, dr - call InvMixColumn - movd vt0, 1*4(E, offset) - - movd ve2, dr - call InvMixColumn - movd vt0, 2*4(E, offset) - - movd ve3, dr - call InvMixColumn - movd vt0, 3*4(E, offset) - - movd (4-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 4*4(E, offset) - - movd (5-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 5*4(E, offset) - -// Here is the main loop. -1: - add $1, R // Advance pointer. - movd ve5, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - pxor ve0, ve1 - pxor ve1, ve2 - pxor ve2, ve3 - pxor ve3, ve4 - pxor ve4, ve5 - - // Apply InvMixColumn to the difference. - movd vt0, dr - call InvMixColumn - - add $6*4, offset - - // Chain the transformed difference to previously transformed outputs. - movd (0-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 0*4(E, offset) - - movd (1-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 1*4(E, offset) - - movd (2-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 2*4(E, offset) - - movd (3-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 3*4(E, offset) - - movd (4-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 4*4(E, offset) - - movd (5-6)*4(E, offset), vt1 - pxor vt1, vt0 - movd vt0, 5*4(E, offset) - - jle 1b - -// Here is the final iteration, which does not perform InvMixColumn. - - movd ve5, dr // Put previous word into work register. - movzx 1(R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - pxor vt0, ve0 - - // Chain to successive words. - movd ve0, 6*4(E, offset) - pxor ve0, ve1 - movd ve1, 7*4(E, offset) - pxor ve1, ve2 - movd ve2, 8*4(E, offset) - pxor ve2, ve3 - movd ve3, 9*4(E, offset) - - xor r0, r0 // Return success. - - // Pop stack and restore registers. - movaps 7*16(r4), %xmm7 - movaps 6*16(r4), %xmm6 - movaps 5*16(r4), %xmm5 - movaps 4*16(r4), %xmm4 - movaps 3*16(r4), %xmm3 - movaps 2*16(r4), %xmm2 - movaps 1*16(r4), %xmm1 - movaps 0*16(r4), %xmm0 - #if 0 < LocalsSize - add $Padding + LocalsSize, r4 - #endif - #if defined __i386__ - pop r7 - pop r6 - pop r5 - #endif - pop r3 - - ret - - - .globl _aes_decrypt_key256 -// .private_extern _aes_decrypt_key256 -_aes_decrypt_key256: - - /* Save registers and set SaveSize to the number of bytes pushed onto the - stack so far, including the caller's return address. - */ - push r3 - #if defined __i386__ - push r5 - push r6 - push r7 - #define SaveSize (5*4) - #else - #define SaveSize (2*8) - #endif - - /* Number of bytes used for local variables: - - 8 16-byte spaces to save XMM registers. - - 8 four-byte spaces for work. - */ - #define LocalsSize (8*16 + 8*4) - - // Define stack offset to storage space for local data. - #define Local (8*16) - - #if 0 < LocalsSize - // Padding to position stack pointer at a multiple of 16 bytes. - #define Padding (15 & -(SaveSize + LocalsSize)) - sub $Padding + LocalsSize, r4 // Allocate space on stack. - #else - #define Padding 0 - #endif - - /* StackFrame is the number of bytes in our stack frame, from caller's - stack pointer to ours (so it includes the return address). - */ - #define StackFrame (SaveSize + Padding + LocalsSize) - - // Save xmm registers. - movaps %xmm0, 0*16(r4) - movaps %xmm1, 1*16(r4) - movaps %xmm2, 2*16(r4) - movaps %xmm3, 3*16(r4) - movaps %xmm4, 4*16(r4) - movaps %xmm5, 5*16(r4) - movaps %xmm6, 6*16(r4) - movaps %xmm7, 7*16(r4) - -#if defined __i386__ - - // Load arguments. - #define Argument(i) StackFrame+4*(i)(r4) - mov Argument(1), E - mov Argument(0), K - -#endif - -// Merge point for _aes_decrypt_key and _aes_decrypt_key256. -DKeyHas8Words: - - // First words of expanded key are copied from user key. - movd 0*4(K), ve0 - movd 1*4(K), ve1 - movd 2*4(K), ve2 - movd 3*4(K), ve3 - - movl $14*16, ContextKeyLength(E) // Set "key length." - - #if 0 != ContextKey - add $ContextKey, E - #endif - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 0*4(E) - movd ve1, 1*4(E) - movd ve2, 2*4(E) - movd ve3, 3*4(E) - movd 4*4(K), ve0 - movd 5*4(K), ve1 - movd 6*4(K), ve2 - movd 7*4(K), ve3 - - // K cannot be used after we write to R, since they use the same register. - - #if defined __i386__ - - call 0f // Push program counter onto stack. - 0: pop STable // Get program counter. - lea _AESRcon-0b(STable), R - lea _AESInvMixColumnTable-0b(STable), ITable - lea _AESSubBytesWordTable-0b(STable), STable - - #elif defined __x86_64__ - - lea _AESRcon(%rip), R - lea _AESInvMixColumnTable(%rip), ITable - lea _AESSubBytesWordTable(%rip), STable - - #endif - - /* With an eight-word key, there are fourteen rounds (fifteen 16-byte key - blocks), thirteen of which have InvMixColumn applied. - */ - mov $-12*4*4, offset - sub offset, E - - // Save untransformed values in stack area. - movd ve0, 4*4+Local(r4) - movd ve1, 5*4+Local(r4) - movd ve2, 6*4+Local(r4) - movd ve3, 7*4+Local(r4) - - /* Apply InvMixColumn to words 4 through 7. The transformed values are - stored in the expanded key. The original values are saved in the stack - area for further computation. - */ - movd ve0, dr - call InvMixColumn - movd vt0, 4*4(E, offset) - - movd ve1, dr - call InvMixColumn - movd vt0, 5*4(E, offset) - - movd ve2, dr - call InvMixColumn - movd vt0, 6*4(E, offset) - - movd ve3, dr - call InvMixColumn - movd vt0, 7*4(E, offset) - -/* Here is the first iteration of the key expansion. It is separate from the - main loop below because we need to apply InvMixColumn to each of the - outputs, in ve0 through ve3. In the main loop, the technique described at - the top of this file is used to compute the proper outputs while using - InvMixColumn only once. -*/ - add $1, R // Advance pointer. - movd ve3, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - - add $8*4, offset - - movd (0-8)*4(E, offset), ve0 // Get old word. - pxor vt0, ve0 - movd ve0, 0*4+Local(r4) // Save on stack. - movd ve0, dr - call InvMixColumn - movd vt0, 0*4(E, offset) // Write to expanded key. - - /* Chain to successive words and apply InvMixColumn to each word. The - transformed values are stored in the expanded key. The original - values are retained in local data for further computation. - */ - movd (1-8)*4(E, offset), ve1 // Get old word. - pxor ve0, ve1 // Chain. - movd ve1, 1*4+Local(r4) // Save on stack. - movd ve1, dr - call InvMixColumn - movd vt0, 1*4(E, offset) // Write to expanded key. - - movd (2-8)*4(E, offset), ve2 // Get old word. - pxor ve1, ve2 // Chain. - movd ve2, 2*4+Local(r4) // Save on stack. - movd ve2, dr - call InvMixColumn - movd vt0, 2*4(E, offset) // Write to expanded key. - - movd (3-8)*4(E, offset), ve3 // Get old word. - pxor ve2, ve3 // Chain. - movd ve3, 3*4+Local(r4) // Save on stack. - movd ve3, dr - call InvMixColumn - movd vt0, 3*4(E, offset) // Write to expanded key. - - movd ve3, dr // Put previous word into work register. - SubWord - - movd 4*4+Local(r4), ve0 // Get old word. - pxor vt0, ve0 // Chain. - movd ve0, 4*4+Local(r4) // Save on stack. - - movd 5*4+Local(r4), ve1 // Get old word. - pxor ve0, ve1 // Chain. - movd ve1, 5*4+Local(r4) // Save on stack. - - movd 6*4+Local(r4), ve2 // Get old word. - pxor ve1, ve2 // Chain. - movd ve2, 6*4+Local(r4) // Save on stack. - - movd 7*4+Local(r4), ve3 // Get old word. - pxor ve2, ve3 // Chain. - movd ve3, 7*4+Local(r4) // Save on stack. - - movd vt0, dr // Move change to work register. - call InvMixColumn - - movd (4-8)*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, 4*4(E, offset) // Write new word to expanded key. - - movd (5-8)*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, 5*4(E, offset) // Write new word to expanded key. - - movd (6-8)*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, 6*4(E, offset) // Write new word to expanded key. - - movd (7-8)*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, 7*4(E, offset) // Write new word to expanded key. - -// Here is the main loop. -1: - add $1, R // Advance pointer. - movd ve3, dr // Put previous word into work register. - movzx (R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - - movd 0*4+Local(r4), ve0 // Get old word. - pxor vt0, ve0 - movd ve0, 0*4+Local(r4) // Save on stack. - - // Chain to successive words. - movd 1*4+Local(r4), ve1 // Get old word. - pxor ve0, ve1 // Chain. - movd ve1, 1*4+Local(r4) // Save on stack. - - movd 2*4+Local(r4), ve2 // Get old word. - pxor ve1, ve2 // Chain. - movd ve2, 2*4+Local(r4) // Save on stack. - - movd 3*4+Local(r4), ve3 // Get old word. - pxor ve2, ve3 // Chain. - movd ve3, 3*4+Local(r4) // Save on stack. - - movd vt0, dr // Move change to work register. - call InvMixColumn - - movd 0*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (0+8)*4(E, offset) // Write new word to expanded key. - - movd 1*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (1+8)*4(E, offset) // Write new word to expanded key. - - movd 2*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (2+8)*4(E, offset) // Write new word to expanded key. - - movd 3*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (3+8)*4(E, offset) // Write new word to expanded key. - - movd ve3, dr // Put previous word into work register. - SubWord - - movd 4*4+Local(r4), ve0 // Get old word. - pxor vt0, ve0 // Chain. - movd ve0, 4*4+Local(r4) // Save on stack. - - movd 5*4+Local(r4), ve1 // Get old word. - pxor ve0, ve1 // Chain. - movd ve1, 5*4+Local(r4) // Save on stack. - - movd 6*4+Local(r4), ve2 // Get old word. - pxor ve1, ve2 // Chain. - movd ve2, 6*4+Local(r4) // Save on stack. - - movd 7*4+Local(r4), ve3 // Get old word. - pxor ve2, ve3 // Chain. - movd ve3, 7*4+Local(r4) // Save on stack. - - movd vt0, dr // Move change to work register. - call InvMixColumn - - movd 4*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (4+8)*4(E, offset) // Write new word to expanded key. - - movd 5*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (5+8)*4(E, offset) // Write new word to expanded key. - - movd 6*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (6+8)*4(E, offset) // Write new word to expanded key. - - movd 7*4(E, offset), vt1 // Get old word. - pxor vt1, vt0 // Chain. - movd vt0, (7+8)*4(E, offset) // Write new word to expanded key. - - add $8*4, offset - - jl 1b - - movd ve3, dr // Put previous word into work register. - movzx 1(R), t0d // Get round constant. - movd t0d, vt0 - - SubWordRotWord - - movd 0*4+Local(r4), ve0 // Get old word. - pxor vt0, ve0 // Chain. - movd ve0, (0+8)*4(E, offset) - - // Chain to successive words. - movd 1*4+Local(r4), ve1 // Get old word. - pxor ve0, ve1 // Chain. - movd ve1, (1+8)*4(E, offset) - - movd 2*4+Local(r4), ve2 // Get old word. - pxor ve1, ve2 // Chain. - movd ve2, (2+8)*4(E, offset) - - movd 3*4+Local(r4), ve3 // Get old word. - pxor ve2, ve3 // Chain. - movd ve3, (3+8)*4(E, offset) - - xor r0, r0 // Return success. - - // Pop stack and restore registers. - movaps 7*16(r4), %xmm7 - movaps 6*16(r4), %xmm6 - movaps 5*16(r4), %xmm5 - movaps 4*16(r4), %xmm4 - movaps 3*16(r4), %xmm3 - movaps 2*16(r4), %xmm2 - movaps 1*16(r4), %xmm1 - movaps 0*16(r4), %xmm0 - #if 0 < LocalsSize - add $Padding + LocalsSize, r4 - #endif - #if defined __i386__ - pop r7 - pop r6 - pop r5 - #endif - pop r3 - - ret - - -#undef Address -#undef Argument -#undef E -#undef ITable -#undef K -#undef Local -#undef LocalsSize -#undef LookupI -#undef LookupS -#undef Nk -#undef Padding -#undef R -#undef SaveSize -#undef STable -#undef StackFrame -#undef dr -#undef drh -#undef drl -#undef offset -#undef t0 -#undef t0d -#undef ve0 -#undef ve1 -#undef ve2 -#undef ve3 -#undef ve4 -#undef ve5 -#undef vt0 -#undef vt1 DELETED Source/libtomcrypt/src/ciphers/aesedpport/ExpandKeyForEncryption.s Index: Source/libtomcrypt/src/ciphers/aesedpport/ExpandKeyForEncryption.s ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/ExpandKeyForEncryption.s +++ /dev/null @@ -1,837 +0,0 @@ -/* This file defines _aes_encrypt_key, _aes_encrypt_key128, - _aes_encrypt_key192, and _aes_encrypt_key256. It is designed to be - included in another assembly file with the preprocessor #include directive, - to benefit from some assembly-time calculations. - - Written by Eric Postpischil, January 2008. - - The comments here do not say much about the algorithm; the code just - follows the FIPS-197 specification. I recommend reading the specification - before working with this code or examining the C code in the parent - directory that illustrates key expansion. -*/ - - -/* Routines: - - _aes_encrypt_key. - - _aes_encrypt_key128, _aes_encrypt_key192, and _aes_encrypt_key256. - - Function: - - Expand the user's cipher key into the key schedule, as defined in - Federal Information Processing Standards Publication 197 (FIPS-197), - November 26, 2001. - - Input: - - Constant data: - - The following names must be locally defined so the assembler - can calculate certain offsets. - - static const Word _AESSubBytesWordTable[4][256]. - - _AESSubBytesWordTable[i][j] = SubBytes(j) << 8*i, where - SubBytes is defined in FIPS-197. _AESSubBytesWordTable - differs from _AESEncryptTable in that it does not include - the MixColumn operation. It is used in performing the last - round, which differs fromm the previous rounds in that it - does not include the MixColumn operation. - - static const Byte _AESRcon[]. - - Round constants, beginning with AESRcon[1] for the first round - (AESRcon[0] is padding.) - - Arguments: - - const unsigned char *Key - - Address of user's cipher key. - - int Length - - Number of bytes (16, 24, or 32) or bits (128, 192, or 256) in - user's cipher key. - - This argument is used with _aes_encrypt_key. It is not - present for the other routines. In those routines, Context - is the second argument. - - aes_encrypt_ctx *Context - - Structure to contain the expanded key beginning at offset - ContextKey and a four-byte "key length" beginning at offset - ContextKeyLength. The "key length" is the number of bytes from - the start of the first round key to the start of the last round - key. That is 16 less than the number of bytes in the entire - key. - - Output: - - The expanded key and the "key length" are written to *Context. - - Return: - - aes_rval // -1 if "key length" is invalid. 0 otherwise. -*/ - -/* add AES HW detection and program branch if AES HW is detected cclee 3-12-10 */ - -#include - - .text - .globl _aes_encrypt_key -// .private_extern _aes_encrypt_key -_aes_encrypt_key: - - // detect AES HW, cclee-3-13-10 -#if defined __x86_64__ - movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capabilities - mov (%rax), %eax // %eax = __cpu_capabilities -#else -#ifdef KERNEL - leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities - mov (%eax), %eax // %eax = __cpu_capabilities -#else - mov _COMM_PAGE_CPU_CAPABILITIES, %eax -#endif -#endif - test $(kHasAES), %eax // __cpu_capabilities & kHasAES - jne _aes_encrypt_key_hw // if AES HW detected, branch to _aes_encrypt_key_hw - -#define dr r0d // Dissection register. -#define drl r0l // Low 8 bits of dissection register. -#define drh r0h // Second-lowest 8 bits of dissection register. - -#define t0 r1 -#define t0d r1d // Low 32 bits of t0. - -#define offset Arch(r5, r11) // Address offset and loop sentinel. - -#define R r7 // Address of round constant. -#define K r7 // User key pointer. - // R and K overlap. - -#define E r6 // Expanded key pointer. - -#define ve0 %xmm0 -#define ve1 %xmm1 -#define ve2 %xmm2 -#define ve3 %xmm3 -#define vt3 %xmm4 -#define vt2 %xmm5 -#define vt1 %xmm6 -#define vt0 %xmm7 - -#define LookupS(table, index) (table)*TableSize(STable, index, 4) - - /* Save registers and set SaveSize to the number of bytes pushed onto the - stack so far, including the caller's return address. - */ - push r3 - #if defined __i386__ - push r5 - push r6 - push r7 - #define SaveSize (5*4) - #else - #define SaveSize (2*8) - #endif - - /* Number of bytes used for local variables: - - 8 16-byte spaces to save XMM registers. - */ - #define LocalsSize (8*16) - - #if 0 < LocalsSize - // Padding to position stack pointer at a multiple of 16 bytes. - #define Padding (15 & -(SaveSize + LocalsSize)) - sub $Padding + LocalsSize, r4 // Allocate space on stack. - #else - #define Padding 0 - #endif - - /* StackFrame is the number of bytes in our stack frame, from caller's - stack pointer to ours (so it includes the return address). - */ - #define StackFrame (SaveSize + Padding + LocalsSize) - - // Save xmm registers. - movaps %xmm0, 0*16(r4) - movaps %xmm1, 1*16(r4) - movaps %xmm2, 2*16(r4) - movaps %xmm3, 3*16(r4) - movaps %xmm4, 4*16(r4) - movaps %xmm5, 5*16(r4) - movaps %xmm6, 6*16(r4) - movaps %xmm7, 7*16(r4) - -#if defined __i386__ - - // Define location of argument i. - #define Argument(i) StackFrame+4*(i)(r4) - - #define Nk t0d - - // Load arguments. - mov Argument(2), E - mov Argument(1), Nk - mov Argument(0), K - -#elif defined __x86_64__ - - #define Nk r9d // Number of words in key. - mov r6d, Nk // Move Nk argument out of way. - mov r2, E // Move E argument to common register. - -#endif - - // Dispatch on key length. - cmp $128, Nk - jge 2f - shl $3, Nk // Convert from bytes to bits. - cmp $128, Nk -2: - je EKeyHas4Words - cmp $192, Nk - je EKeyHas6Words - cmp $256, Nk - je EKeyHas8Words - mov $-1, r0 // Return error. - jmp 9f - -// Stop using Nk. -#undef Nk - - .globl _aes_encrypt_key128 -// .private_extern _aes_encrypt_key128 -_aes_encrypt_key128: - - /* Save registers and set SaveSize to the number of bytes pushed onto the - stack so far, including the caller's return address. - */ - push r3 - #if defined __i386__ - push r5 - push r6 - push r7 - #define SaveSize (5*4) - #else - #define SaveSize (2*8) - #endif - - /* Number of bytes used for local variables: - - 8 16-byte spaces to save XMM registers. - */ - #define LocalsSize (8*16) - - #if 0 < LocalsSize - // Padding to position stack pointer at a multiple of 16 bytes. - #define Padding (15 & -(SaveSize + LocalsSize)) - sub $Padding + LocalsSize, r4 // Allocate space on stack. - #else - #define Padding 0 - #endif - - /* StackFrame is the number of bytes in our stack frame, from caller's - stack pointer to ours (so it includes the return address). - */ - #define StackFrame (SaveSize + Padding + LocalsSize) - - // Save xmm registers. - movaps %xmm0, 0*16(r4) - movaps %xmm1, 1*16(r4) - movaps %xmm2, 2*16(r4) - movaps %xmm3, 3*16(r4) - movaps %xmm4, 4*16(r4) - movaps %xmm5, 5*16(r4) - movaps %xmm6, 6*16(r4) - movaps %xmm7, 7*16(r4) - - #if defined __i386__ - - // Load arguments. - #define Argument(i) StackFrame+4*(i)(r4) - mov Argument(1), E - mov Argument(0), K - - #endif - -// Merge point for _aes_encrypt_key and _aes_encrypt_key128. -EKeyHas4Words: - -#define e0 r2d -#define e1 r3d -#define e2 Arch(r5d, r11d) -#define e3 r7d - - // First words of expanded key are copied from user key. - mov 0*4(K), e0 - mov 1*4(K), e1 - mov 2*4(K), e2 - mov 3*4(K), e3 - - movl $10*16, ContextKeyLength(E) // Set "key length." - - #if 0 != ContextKey - add $ContextKey, E - #endif - - // K cannot be used after we write to R, since they use the same register. - - // Cache round constants in output buffer. The last is a sentinel. - movb $0x01, 1*16(E) - movb $0x02, 2*16(E) - movb $0x04, 3*16(E) - movb $0x08, 4*16(E) - movb $0x10, 5*16(E) - movb $0x20, 6*16(E) - movb $0x40, 7*16(E) - movb $0x80, 8*16(E) - movb $0x1b, 9*16(E) - movb $0x36, 10*16(E) - - // Store initial words of expanded key, which are copies of user's key. - mov e0, 0*4(E) - mov e1, 1*4(E) - mov e2, 2*4(E) - mov e3, 3*4(E) - - #if defined __x86_64__ - - #define STable r8 - lea _AESSubBytesWordTable(%rip), STable - - #else - - #define STable r6 - sub $16, r4 // allocate stack memory for storing E and STable - mov E, (r4) // save E - - call 0f // Push program counter onto stack. - 0: - pop %eax // Get program counter. - - lea _AESSubBytesWordTable-0b(%eax), STable - mov STable, 4(r4) // Save STable - - #endif - -1: - mov e3, dr // Put previous word into dissection register. - - // Perform SubWord(RotWord(dr)). - movzx drl, t0 - xor LookupS(3, t0), e0 // Look up byte 0 in table 3. - movzx drh, t0d - xor LookupS(0, t0), e0 // Look up byte 1 in table 0. - shr $16, dr - movzx drl, t0d - xor LookupS(1, t0), e0 // Look up byte 2 in table 1. - movzx drh, t0d - xor LookupS(2, t0), e0 // Look up byte 3 in table 2. - -#if defined __i386__ - mov (r4), E -#endif - - add $4*4, E - - movzx (E), t0d // Get cached round constant. - xor t0d, e0 // XOR with word from four words back. - - // Chain to successive words. - mov e0, 0*4(E) - xor e0, e1 - mov e1, 1*4(E) - xor e1, e2 - mov e2, 2*4(E) - xor e2, e3 - mov e3, 3*4(E) - -#if defined __i386__ - mov E, (r4) - mov 4(r4), STable -#endif - - cmp $0x36, t0d // Was this the last round constant? - - jne 1b - -#if defined __i386__ - add $16, r4 -#endif - - xor r0, r0 // Return success. - -9: - // Pop stack and restore registers. - movaps 7*16(r4), %xmm7 - movaps 6*16(r4), %xmm6 - movaps 5*16(r4), %xmm5 - movaps 4*16(r4), %xmm4 - movaps 3*16(r4), %xmm3 - movaps 2*16(r4), %xmm2 - movaps 1*16(r4), %xmm1 - movaps 0*16(r4), %xmm0 - #if 0 < LocalsSize - add $Padding + LocalsSize, r4 - #endif - #if defined __i386__ - pop r7 - pop r6 - pop r5 - #endif - pop r3 - - ret - - -// Reset definitions for next case. -#undef e0 -#undef e1 -#undef e2 -#undef e3 -#undef STable - -#undef vt3 -#undef vt2 -#define ve4 %xmm4 -#define ve5 %xmm5 - - - .globl _aes_encrypt_key192 -// .private_extern _aes_encrypt_key192 -_aes_encrypt_key192: - - /* Save registers and set SaveSize to the number of bytes pushed onto the - stack so far, including the caller's return address. - */ - push r3 - #if defined __i386__ - push r5 - push r6 - push r7 - #define SaveSize (5*4) - #else - #define SaveSize (2*8) - #endif - - /* Number of bytes used for local variables: - - 8 16-byte spaces to save XMM registers. - */ - #define LocalsSize (8*16) - - #if 0 < LocalsSize - // Padding to position stack pointer at a multiple of 16 bytes. - #define Padding (15 & -(SaveSize + LocalsSize)) - sub $Padding + LocalsSize, r4 // Allocate space on stack. - #else - #define Padding 0 - #endif - - /* StackFrame is the number of bytes in our stack frame, from caller's - stack pointer to ours (so it includes the return address). - */ - #define StackFrame (SaveSize + Padding + LocalsSize) - - // Save xmm registers. - movaps %xmm0, 0*16(r4) - movaps %xmm1, 1*16(r4) - movaps %xmm2, 2*16(r4) - movaps %xmm3, 3*16(r4) - movaps %xmm4, 4*16(r4) - movaps %xmm5, 5*16(r4) - movaps %xmm6, 6*16(r4) - movaps %xmm7, 7*16(r4) - - #if defined __i386__ - - // Load arguments. - #define Argument(i) StackFrame+4*(i)(r4) - mov Argument(1), E - mov Argument(0), K - - #endif - -// Merge point for _aes_encrypt_key and _aes_encrypt_key192. -EKeyHas6Words: - - // First words of expanded key are copied from user key. - movd 0*4(K), ve0 - movd 1*4(K), ve1 - movd 2*4(K), ve2 - movd 3*4(K), ve3 - - movl $12*16, ContextKeyLength(E) // Set "key length." - - #if 0 != ContextKey - add $ContextKey, E - #endif - - movd 4*4(K), ve4 - movd 5*4(K), ve5 - - // K cannot be used after we write to R, since they use the same register. - - #if defined __i386__ - - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: - pop %eax // Get program counter. - - #define STable r3 - lea _AESRcon-0b(%eax), R - lea _AESSubBytesWordTable-0b(%eax), STable - - #elif defined __x86_64__ - - #define STable r8 - lea _AESRcon(%rip), R - lea _AESSubBytesWordTable(%rip), STable - - #endif - - /* With a six-word key, there are twelve rounds (thirteen 16-byte key - blocks). - */ - mov $-12*4*4, offset - sub offset, E - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 0*4(E, offset) - movd ve1, 1*4(E, offset) - movd ve2, 2*4(E, offset) - movd ve3, 3*4(E, offset) - movd ve4, 4*4(E, offset) - movd ve5, 5*4(E, offset) - -/* Jump into loop body. The key expansion processes six four-byte words per - iteration. 52 are needed in the key. So only four are needed in the last - iteration. -*/ - jmp 2f -1: - // Continue chaining to successive words. - pxor ve3, ve4 - movd ve4, 4*4(E, offset) - pxor ve4, ve5 - movd ve5, 5*4(E, offset) -2: - add $1, R // Advance pointer. - movd ve5, dr // Put previous word into dissection register. - movzx (R), t0 // Get round constant. - movd t0d, vt1 - pxor vt1, ve0 // XOR with word from six words back. - - // Perform SubWord(RotWord(dr)). - movzx drl, t0d - movd LookupS(3, t0), vt0 // Look up byte 0 in table 3. - movzx drh, t0d - movd LookupS(0, t0), vt1 // Look up byte 1 in table 0. - shr $16, dr - movzx drl, t0d - pxor vt1, vt0 - pxor vt0, ve0 - movd LookupS(1, t0), vt0 // Look up byte 2 in table 1. - movzx drh, t0d - movd LookupS(2, t0), vt1 // Look up byte 3 in table 2. - pxor vt1, vt0 - pxor vt0, ve0 - - add $6*4, offset - - // Chain to successive words. - movd ve0, 0*4(E, offset) - pxor ve0, ve1 - movd ve1, 1*4(E, offset) - pxor ve1, ve2 - movd ve2, 2*4(E, offset) - pxor ve2, ve3 - movd ve3, 3*4(E, offset) - - jne 1b - - xor r0, r0 // Return success. - - // Pop stack and restore registers. - movaps 7*16(r4), %xmm7 - movaps 6*16(r4), %xmm6 - movaps 5*16(r4), %xmm5 - movaps 4*16(r4), %xmm4 - movaps 3*16(r4), %xmm3 - movaps 2*16(r4), %xmm2 - movaps 1*16(r4), %xmm1 - movaps 0*16(r4), %xmm0 - #if 0 < LocalsSize - add $Padding + LocalsSize, r4 - #endif - #if defined __i386__ - pop r7 - pop r6 - pop r5 - #endif - pop r3 - - ret - - -// Reset definitions for next case. -#undef ve4 -#undef ve5 -#define vt3 %xmm4 -#define vt2 %xmm5 - -#undef STable - - .globl _aes_encrypt_key256 -// .private_extern _aes_encrypt_key256 -_aes_encrypt_key256: - - /* Save registers and set SaveSize to the number of bytes pushed onto the - stack so far, including the caller's return address. - */ - push r3 - #if defined __i386__ - push r5 - push r6 - push r7 - #define SaveSize (5*4) - #else - #define SaveSize (2*8) - #endif - - /* Number of bytes used for local variables: - - 8 16-byte spaces to save XMM registers. - */ - #define LocalsSize (8*16) - - #if 0 < LocalsSize - // Padding to position stack pointer at a multiple of 16 bytes. - #define Padding (15 & -(SaveSize + LocalsSize)) - sub $Padding + LocalsSize, r4 // Allocate space on stack. - #else - #define Padding 0 - #endif - - /* StackFrame is the number of bytes in our stack frame, from caller's - stack pointer to ours (so it includes the return address). - */ - #define StackFrame (SaveSize + Padding + LocalsSize) - - // Save xmm registers. - movaps %xmm0, 0*16(r4) - movaps %xmm1, 1*16(r4) - movaps %xmm2, 2*16(r4) - movaps %xmm3, 3*16(r4) - movaps %xmm4, 4*16(r4) - movaps %xmm5, 5*16(r4) - movaps %xmm6, 6*16(r4) - movaps %xmm7, 7*16(r4) - - #if defined __i386__ - - // Load arguments. - #define Argument(i) StackFrame+4*(i)(r4) - mov Argument(1), E - mov Argument(0), K - - #endif - -// Merge point for _aes_encrypt_key and _aes_encrypt_key256. -EKeyHas8Words: - - // First words of expanded key are copied from user key. - movd 0*4(K), ve0 - movd 1*4(K), ve1 - movd 2*4(K), ve2 - movd 3*4(K), ve3 - - movl $14*16, ContextKeyLength(E) // Set "key length." - - #if 0 != ContextKey - add $ContextKey, E - #endif - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 0*4(E) - movd ve1, 1*4(E) - movd ve2, 2*4(E) - movd ve3, 3*4(E) - movd 4*4(K), ve0 - movd 5*4(K), ve1 - movd 6*4(K), ve2 - movd 7*4(K), ve3 - - // K cannot be used after we write to R, since they use the same register. - - #if defined __i386__ - - // Get address of 0 in R. - call 0f // Push program counter onto stack. - 0: - pop %eax // Get program counter. - - #define STable r3 - lea _AESRcon-0b(%eax), R - lea _AESSubBytesWordTable-0b(%eax), STable - - #elif defined __x86_64__ - - #define STable r8 - lea _AESRcon(%rip), R - lea _AESSubBytesWordTable(%rip), STable - - #endif - - /* With an eight-word key, there are fourteen rounds (fifteen 16-byte key - blocks). - */ - mov $-14*4*4, offset - sub offset, E - - // Store initial words of expanded key, which are copies of user's key. - movd ve0, 4*4(E, offset) - movd ve1, 5*4(E, offset) - movd ve2, 6*4(E, offset) - movd ve3, 7*4(E, offset) - -/* Jump into loop body. The key expansion processes eight four-byte words per - iteration. 60 are needed in the key. So only four are needed in the last - iteration. -*/ - jmp 2f -1: - movd ve3, dr // Put previous word into dissection register. - - /* Get word from eight words back (it is four words back from where E - currently points, and we use it to prepare the value to be stored - four words beyond where E currently points). - */ - movd -4*4(E, offset), ve0 - - // Perform SubWord(dr). - movzx drl, t0 - movd LookupS(0, t0), vt0 // Look up byte 0 in table 0. - movzx drh, t0d - movd LookupS(1, t0), vt1 // Look up byte 1 in table 1. - shr $16, dr - movzx drl, t0d - movd LookupS(2, t0), vt2 // Look up byte 2 in table 2. - movzx drh, t0d - movd LookupS(3, t0), vt3 // Look up byte 3 in table 3. - pxor vt1, vt0 - pxor vt3, vt2 - pxor vt0, ve0 - pxor vt2, ve0 - - movd -3*4(E, offset), ve1 // Get words from eight words back. - movd -2*4(E, offset), ve2 - movd -1*4(E, offset), ve3 - - // Chain to successive words. - movd ve0, 4*4(E, offset) - pxor ve0, ve1 - movd ve1, 5*4(E, offset) - pxor ve1, ve2 - movd ve2, 6*4(E, offset) - pxor ve2, ve3 - movd ve3, 7*4(E, offset) - -2: - add $1, R // Advance pointer. - movd ve3, dr // Put previous word into dissection register. - movzx (R), t0d // Get round constant. - movd t0d, vt1 - movd 0*4(E, offset), ve0 // Get word from eight words back. - pxor vt1, ve0 - - // Perform SubWord(RotWord(dr)). - movzx drl, t0 - movd LookupS(3, t0), vt0 // Look up byte 0 in table 3. - movzx drh, t0d - movd LookupS(0, t0), vt1 // Look up byte 1 in table 0. - shr $16, dr - movzx drl, t0d - movd LookupS(1, t0), vt2 // Look up byte 2 in table 1. - movzx drh, t0d - movd LookupS(2, t0), vt3 // Look up byte 3 in table 2. - pxor vt1, vt0 - pxor vt3, vt2 - pxor vt0, ve0 - pxor vt2, ve0 - - movd 1*4(E, offset), ve1 - movd 2*4(E, offset), ve2 - movd 3*4(E, offset), ve3 - - add $8*4, offset - - // Chain to successive words. - movd ve0, 0*4(E, offset) - pxor ve0, ve1 - movd ve1, 1*4(E, offset) - pxor ve1, ve2 - movd ve2, 2*4(E, offset) - pxor ve2, ve3 - movd ve3, 3*4(E, offset) - - jne 1b - - xor r0, r0 // Return success. - - // Pop stack and restore registers. - movaps 7*16(r4), %xmm7 - movaps 6*16(r4), %xmm6 - movaps 5*16(r4), %xmm5 - movaps 4*16(r4), %xmm4 - movaps 3*16(r4), %xmm3 - movaps 2*16(r4), %xmm2 - movaps 1*16(r4), %xmm1 - movaps 0*16(r4), %xmm0 - #if 0 < LocalsSize - add $Padding + LocalsSize, r4 - #endif - #if defined __i386__ - pop r7 - pop r6 - pop r5 - #endif - pop r3 - - ret - - -#undef Address -#undef Argument -#undef E -#undef K -#undef LocalsSize -#undef LookupS -#undef Padding -#undef R -#undef SaveSize -#undef STable -#undef StackFrame -#undef dr -#undef drh -#undef drl -#undef offset -#undef t0 -#undef t0d -#undef ve0 -#undef ve1 -#undef ve2 -#undef ve3 -#undef vt0 -#undef vt1 -#undef vt2 -#undef vt3 DELETED Source/libtomcrypt/src/ciphers/aesedpport/Setup/Data.mk Index: Source/libtomcrypt/src/ciphers/aesedpport/Setup/Data.mk ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/Setup/Data.mk +++ /dev/null @@ -1,30 +0,0 @@ -default: - @echo "This makefile builds Data.s, which contains constant data for the" - @echo "AES implementation. This file does not normally need to be rebuilt," - @echo "so it is checked into the source code repository. It should be" - @echo "changed only when the implementation changes and needs data in a" - @echo "different format. (This file can also build a C version, Data.c," - @echo "but that is not currently in use.)" - @echo "" - @echo "To rebuild the file(s), execute \"make -f Data.mk all\"." - -.PHONY: all clean -Targets = Data.s -all: $(Targets) - -CFLAGS += -O3 -std=c99 -Wmost -Werror - -.INTERMEDIATE: MakeData -MakeData: MakeData.c - -# Do not leave bad output files if the build fails. -.DELETE_ON_ERROR: $(Targets) - -Data.c: MakeData - ./$< >$@ C - -Data.s: MakeData - ./$< >$@ Intel - -clean: - -rm $(Targets) DELETED Source/libtomcrypt/src/ciphers/aesedpport/Setup/MakeData.c Index: Source/libtomcrypt/src/ciphers/aesedpport/Setup/MakeData.c ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/Setup/MakeData.c +++ /dev/null @@ -1,516 +0,0 @@ -#include -#include -#include -#include - -#define MaxRcon 11 - -typedef uint8_t Byte; -typedef uint32_t Word; - - -/* In comments below, {n} designates the Galois field element represented by - the byte n. See notes about Galois field multiplication in ReadMe.txt. - - So 3+5 is addition of ordinary integers, and 3+5 == 8, while {3}+{5} is - addition in the field, and {3} + {5} = {3 XOR 5} = {6}.) -*/ - - -// Define constants for languages. -typedef enum { C, IntelAssembly } Language; - - -/* LogBase3[i] will contain the base-three logarithm of i in the 256-element - Galois field defined by AES. That is, {3}**LogBase3[i] == {3}**i. -*/ -static Byte LogBase3[256]; - -/* AntilogBase3[i] will contain {3}**i in the 256-element Galois field defined - by AES. It contains extra elements so that the antilog of a+b can be found - by looking up a+b directly, without having to reduce modulo the period, for - 0 <= a, b < 255. - - (254 is the greatest value we encounter. Each a or b we use is the - base-three logarithm of some element. As a primitive root, the powers of - three cycle through all non-zero elements of the field, of which there are - 255, so the exponents cover 0 to 254 before the powers repeat.) -*/ -static Byte AntilogBase3[254+254+1]; - - -static void InitializeLogTables(void) -{ - // log({1}) is zero, so start {p} (power) at {1} and l (logarithm) at 0. - Byte p = 1; - int l = 0; - do - { - // Record table entries. - LogBase3[p] = l; - AntilogBase3[l] = p; - - /* Observe that {2}*{p} is {p << 1 ^ (a & 0x80 ? 0x1b : 0)}, per notes - in ReadMe.txt. We produce {3}*{p}: - - {3}*{p} - = {1}*{p} + {2}*{p} - = {1}*{p} + {p << 1 ^ (a & 0x80 ? 0x1b : 0)} - = {p ^ p << 1 ^ (p & 0x80 ? 0x1b : 0)}. - */ - p ^= p << 1 ^ (p & 0x80 ? 0x1b : 0); - ++l; - - } while (p != 1); // Stop when we have gone around completely. - - /* The antilogarithms are periodic with a period of 255, and we want to - look up elements as high as 254+254 (the largest that a sum of two - logarithms could be), so we replicate the table beyond the first - period. - */ - for (l = 255; l < 254+254; ++l) - AntilogBase3[l] = AntilogBase3[l-255]; -} - - -/* MultiplyByte(Byte b, Byte c) returns {b}*{c}. It requires tables that must - be initialized before this routine is used. -*/ -static Byte MultiplyByte(Byte b, Byte c) -{ - // Calculate product by adding logarithms, but avoid logarithms of zero. - return b == 0 || c == 0 ? 0 : AntilogBase3[LogBase3[b] + LogBase3[c]]; -} - - -// Return {0} if {b} is {0} and the multiplicative inverse of {b} otherwise. -static Byte InverseByte(Byte b) -{ - return b == 0 ? 0 : AntilogBase3[255 - LogBase3[b]]; -} - - -// Perform AES' SubBytes operation on a single byte. -static Byte SubByte(Byte b) -{ - unsigned int r = InverseByte(b); - - // Duplicate r as a proxy for a rotate operation. - r = r | r<<8; - - // Apply the standard's affine transformation. - return r ^ r>>4 ^ r>>5 ^ r>>6 ^ r>>7 ^ 0x63; -} - - -// Define and populate tables for the SubBytes and InvSubBytes operations. -static Byte SubBytesTable[256]; -static Byte InvSubBytesTable[256]; - - -static void InitializeSubBytesTable(void) -{ - for (int i = 0; i < 256; ++i) - SubBytesTable[i] = SubByte((Byte) i); -} - - -static void InitializeInvSubBytesTable(void) -{ - for (int i = 0; i < 256; ++i) - InvSubBytesTable[SubByte((Byte) i)] = i; -} - - -/* Print tables for SubBytes function providing the output byte embedded in - various places in a word, so that the table entries can be used with - fewer byte manipulations. -*/ -static void PrintSubBytesWordTable(Language language) -{ - switch (language) - { - case C: - printf("\n\n" - "// SubBytes embedded in words tables.\n" - "const Word AESSubBytesWordTable[4][256] =\n" - "{\n"); - for (int j = 0; j < 4; ++j) - { - printf("\t{\n"); - for (int i = 0; i < 256; ++i) - printf("\t\t0x%08x,\n", SubBytesTable[i] << j*8); - printf("\t},\n"); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// SubBytes embedded in words tables.\n" - "\t.globl\t_AESSubBytesWordTable\n" - "\t.private_extern\t_AESSubBytesWordTable\n" - "\t.align\t2\n" - "_AESSubBytesWordTable:\n"); - for (int j = 0; j < 4; ++j) - { - printf("\t// Table %d.\n", j); - for (int i = 0; i < 256; ++i) - printf("\t.long\t0x%08x\n", SubBytesTable[i] << j*8); - } - break; - } -} - - -/* Print tables for InvSubBytes function providing the output byte embedded in - various places in a word, so that the table entries can be used with - fewer byte manipulations. -*/ -static void PrintInvSubBytesWordTable(Language language) -{ - switch (language) - { - case C: - printf("\n\n" - "// InvSubBytes embedded in words tables.\n" - "const Word AESInvSubBytesWordTable[4][256] =\n" - "{\n"); - for (int j = 0; j < 4; ++j) - { - printf("\t{\n"); - for (int i = 0; i < 256; ++i) - printf("\t\t0x%08x,\n", InvSubBytesTable[i] << j*8); - printf("\t},\n"); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// InvSubBytes embedded in words tables.\n" - "\t.globl\t_AESInvSubBytesWordTable\n" - "\t.private_extern\t_AESInvSubBytesWordTable\n" - "\t.align\t2\n" - "_AESInvSubBytesWordTable:\n"); - for (int j = 0; j < 4; ++j) - { - printf("\t// Table %d.\n", j); - for (int i = 0; i < 256; ++i) - printf("\t.long\t0x%08x\n", InvSubBytesTable[i] << j*8); - } - break; - } -} - - -// Print the round constants. -static void PrintRcon(Language language) -{ - union { Byte c[4]; Word w; } t = { { 1, 0, 0, 0 } }; - - switch (language) - { - case C: - printf("\n\n" - "// Round constants.\n" - "const Byte AESRcon[] =\n" - "{\n" - "\t0,\t// Not used, included for indexing simplicity.\n"); - for (int i = 1; i < MaxRcon; ++i) - { - printf("\t0x%02x,\n", t.w); - t.c[0] = MultiplyByte(0x2, t.c[0]); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// Round constants.\n" - "\t.globl\t_AESRcon\n" - "\t.private_extern\t_AESRcon\n" - "_AESRcon:\n" - "\t.byte\t0\t// Not used, included for indexing simplicity.\n"); - for (int i = 1; i < MaxRcon; ++i) - { - printf("\t.byte\t0x%02x\n", t.w); - t.c[0] = MultiplyByte(0x2, t.c[0]); - } - break; - } -} - - -// Print tables for the InvMixColumn operation. -static void PrintInvMixColumnTable(Language language) -{ - Word T[4][256]; - - for (int i = 0; i < 256; ++i) - { - union { Byte b[4]; Word w; } c; - - Byte s9 = MultiplyByte(0x9, i); - Byte sb = MultiplyByte(0xb, i); - Byte sd = MultiplyByte(0xd, i); - Byte se = MultiplyByte(0xe, i); - - c.b[0] = se; - c.b[1] = s9; - c.b[2] = sd; - c.b[3] = sb; - T[0][i] = c.w; - - c.b[0] = sb; - c.b[1] = se; - c.b[2] = s9; - c.b[3] = sd; - T[1][i] = c.w; - - c.b[0] = sd; - c.b[1] = sb; - c.b[2] = se; - c.b[3] = s9; - T[2][i] = c.w; - - c.b[0] = s9; - c.b[1] = sd; - c.b[2] = sb; - c.b[3] = se; - T[3][i] = c.w; - } - - switch (language) - { - case C: - printf("\n\n" - "// Tables for InvMixColumn.\n" - "const Word AESInvMixColumnTable[4][256] =\n" - "{\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t{\n"); - for (int j = 0; j < 256; ++j) - printf("\t\t0x%08x,\n", T[i][j]); - printf("\t},\n"); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// Tables for InvMixColumn.\n" - "\t.globl\t_AESInvMixColumnTable\n" - "\t.private_extern\t_AESInvMixColumnTable\n" - "\t.align\t2\n" - "_AESInvMixColumnTable:\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t// Table %d.\n", i); - for (int j = 0; j < 256; ++j) - printf("\t.long\t0x%08x\n", T[i][j]); - } - break; - } -} - - -/* Print the tables defined AES Proposal: Rijndael, amended, 9/04/2003, - section 5.2.1. These combine the MixColumn and SubBytes operations. -*/ -static void PrintEncryptTable(Language language) -{ - Word T[4][256]; - - for (int i = 0; i < 256; ++i) - { - union { Byte b[4]; Word w; } c; - - Byte s1 = SubBytesTable[i]; - Byte s2 = MultiplyByte(0x2, s1); - Byte s3 = s1 ^ s2; - - c.b[0] = s2; - c.b[1] = s1; - c.b[2] = s1; - c.b[3] = s3; - T[0][i] = c.w; - - c.b[0] = s3; - c.b[1] = s2; - //c.b[2] = s1; - c.b[3] = s1; - T[1][i] = c.w; - - c.b[0] = s1; - c.b[1] = s3; - c.b[2] = s2; - //c.b[3] = s1; - T[2][i] = c.w; - - //c.b[0] = s1; - c.b[1] = s1; - c.b[2] = s3; - c.b[3] = s2; - T[3][i] = c.w; - } - - switch (language) - { - case C: - printf("\n\n" - "// Tables for main encryption iterations.\n" - "const Word AESEncryptTable[4][256] =\n" - "{\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t{\n"); - for (int j = 0; j < 256; ++j) - printf("\t\t0x%08x,\n", T[i][j]); - printf("\t},\n"); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// Tables for main encryption iterations.\n" - "\t.globl\t_AESEncryptTable\n" - "\t.private_extern\t_AESEncryptTable\n" - "\t.align\t2\n" - "_AESEncryptTable:\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t// Table %d.\n", i); - for (int j = 0; j < 256; ++j) - printf("\t.long\t0x%08x\n", T[i][j]); - } - break; - } -} - - -/* Print the inverse tables. These correspond to the tables above, but for - decyrption. These combine the InvSubBytes and InvMixColumn operations. -*/ -static void PrintDecryptTable(Language language) -{ - Word T[4][256]; - - for (int i = 0; i < 256; ++i) - { - union { Byte b[4]; Word w; } c; - - Byte si = InvSubBytesTable[i]; - - Byte s9 = MultiplyByte(0x9, si); - Byte sb = MultiplyByte(0xb, si); - Byte sd = MultiplyByte(0xd, si); - Byte se = MultiplyByte(0xe, si); - - c.b[0] = se; - c.b[1] = s9; - c.b[2] = sd; - c.b[3] = sb; - T[0][i] = c.w; - - c.b[0] = sb; - c.b[1] = se; - c.b[2] = s9; - c.b[3] = sd; - T[1][i] = c.w; - - c.b[0] = sd; - c.b[1] = sb; - c.b[2] = se; - c.b[3] = s9; - T[2][i] = c.w; - - c.b[0] = s9; - c.b[1] = sd; - c.b[2] = sb; - c.b[3] = se; - T[3][i] = c.w; - } - - switch (language) - { - case C: - printf("\n\n" - "// Tables for main decryption iterations.\n" - "const Word AESDecryptTable[4][256] =\n" - "{\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t{\n"); - for (int j = 0; j < 256; ++j) - printf("\t\t0x%08x,\n", T[i][j]); - printf("\t},\n"); - } - printf("};\n"); - break; - - case IntelAssembly: - printf("\n\n" - "// Tables for main decryption iterations.\n" - "\t.globl\t_AESDecryptTable\n" - "\t.private_extern\t_AESDecryptTable\n" - "\t.align\t2\n" - "_AESDecryptTable:\n"); - for (int i = 0; i < 4; ++i) - { - printf("\t// Table %d.\n", i); - for (int j = 0; j < 256; ++j) - printf("\t.long\t0x%08x\n", T[i][j]); - } - break; - } -} - - -static void Usage(const char *ProgramName) -{ - fprintf(stderr, - "%s: This program must have exactly one argument, \"C\" to generate\n" - "C or \"Intel\" to generate GCC i386/x86_64 assembly.\n", ProgramName); - exit(EXIT_FAILURE); -} - - -int main(int argc, char *argv[]) -{ - if (argc != 2) - Usage(argv[0]); - - Language language; - - // Figure out which language to generate, C or Intel assembly. - if (0 == strcmp(argv[1], "C")) - language = C; - else if (0 == strcmp(argv[1], "Intel")) - language = IntelAssembly; - else - Usage(argv[0]); - - printf("// This file was generated by " __FILE__ ".\n"); - - if (language == C) - printf("\n\n#include \"AES.h\"\n"); - - if (language == IntelAssembly) - printf("\n\n\t.const\n"); - - InitializeLogTables(); - InitializeSubBytesTable(); - InitializeInvSubBytesTable(); - - PrintRcon(language); - PrintInvMixColumnTable(language); - PrintEncryptTable(language); - PrintDecryptTable(language); - PrintSubBytesWordTable(language); - PrintInvSubBytesWordTable(language); - - return 0; -} DELETED Source/libtomcrypt/src/ciphers/aesedpport/Setup/ReadMe.txt Index: Source/libtomcrypt/src/ciphers/aesedpport/Setup/ReadMe.txt ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/Setup/ReadMe.txt +++ /dev/null @@ -1,22 +0,0 @@ -This directory contains a hybrid AES implementation. The core AES routines -(the actual encryption, decryption, and key expansion) are in: - - AES.s - Data.mk - Data.s - EncryptDecrypt.s - ExpandKeyForDecryption.s - ExpandKeyForEncryption.s - MakeData.c - -Although the above files do not explicitly include aes.h, they confirm to -certain things defined in it, notably the aes_rval type and the layout of the -aes_encrypt_ctx and aes_decrypt_ctx structures. These must be kept -compatibility; the definitions of ContextKey and ContextKeyLength in AES.s must -match the offsets of the key ("ks") and key_length ("inf") members of -aes_encrypt_ctx and aes_decrypt_ctx. (For some reason, aes_inf is a union that -is written as a 32-bit integer and read as an 8-bit integer. I do not know -why but have reproduced that behavior in the new implementation.) - -aes_modes.c extends the API, most notably by implementing CBC mode using the -basic AES block encryption. It uses aesopt.h and edefs.h. DELETED Source/libtomcrypt/src/ciphers/aesedpport/aes_crypt_hw.s Index: Source/libtomcrypt/src/ciphers/aesedpport/aes_crypt_hw.s ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/aes_crypt_hw.s +++ /dev/null @@ -1,474 +0,0 @@ -/* This files defines _aes_encrypt_hw and _aes_decrypt_hw --- Intel Westmere HW AES-based implementation - of _aes_encrypt and _aes_decrypt. - - These 2 functions SHOULD BE entried ONLY after the AES HW is verified to be available. - They SHOULD NOT be called without AES HW detection. It might cause xnu to crash. - - The AES HW is detected 1st thing in - _aes_encrypt (EncryptDecrypt.s) - _aes_decrypt (EncryptDecrypt.s) - and, if AES HW is detected, branch without link (ie, jump) to the functions here. - - The implementation here follows the examples in an Intel White Paper - "Intel Advanced Encryption Standard (AES) Instruction Set" Rev.2 01 - - Note: Rev. 03 Final 2010 01 26 is available. Looks like some code change from Rev.2 01 - - cclee 3-13-10 -*/ -#if defined __i386__ || defined __x86_64__ - - .text - .align 4,0x90 -.globl _aes_encrypt_hw -_aes_encrypt_hw: - -#if defined __i386__ - movl 4(%esp), %eax // in - movl 12(%esp), %edx // ctx - movl 8(%esp), %ecx // out - - #define LOCAL_SIZE (12+16+16) // 16-byte align (-4 for return address) + 16 (xmm0) + 16 (xmm1) - #define in %eax - #define ctx %edx - #define out %ecx - #define r13 %esp - -#else // x86_64 - - #define LOCAL_SIZE (8+16+16) // 16-byte align (-8 for return address) + 16 (xmm0) + 16 (xmm1) - #define in %rdi - #define ctx %rdx - #define out %rsi - #define r13 %rsp - -#endif // i386 or x86_64 - -#ifdef KERNEL - sub $LOCAL_SIZE, r13 - movaps %xmm0, (r13) -#endif - movups (in), %xmm0 - - // key length identification - movl 240(ctx), %eax // key length - cmp $160, %eax - je L_AES_128 - cmp $192, %eax - je L_AES_192 - cmp $224, %eax - je L_AES_256 - mov $-1, %eax // return ERROR -#ifdef KERNEL - movaps (r13), %xmm0 - add $LOCAL_SIZE, r13 -#endif - ret - -L_AES_128: - testb $15, %dl // check whether expanded key is 16-byte aligned - jne 0f // if not 16-byte aligned, aesenc xmm, m128 won't work - pxor (ctx), %xmm0 - aesenc 16(ctx), %xmm0 - aesenc 32(ctx), %xmm0 - aesenc 48(ctx), %xmm0 - aesenc 64(ctx), %xmm0 - aesenc 80(ctx), %xmm0 - aesenc 96(ctx), %xmm0 - aesenc 112(ctx), %xmm0 - aesenc 128(ctx), %xmm0 - aesenc 144(ctx), %xmm0 - aesenclast 160(ctx), %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - add $LOCAL_SIZE, r13 -#endif - ret -0: // special case expanded key is not 16-byte aligned -#ifdef KERNEL - movaps %xmm1, 16(r13) // save xmm1 into stack -#endif - movups (ctx), %xmm1 - pxor %xmm1, %xmm0 - movups 16(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 32(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 48(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 64(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 80(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 96(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 112(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 128(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 144(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 160(ctx), %xmm1 - aesenclast %xmm1, %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - movaps 16(r13), %xmm1 - add $LOCAL_SIZE, r13 -#endif - ret - -L_AES_192: - testb $15, %dl // check whether expanded key is 16-byte aligned - jne 0f // if not 16-byte aligned, aesenc xmm, m128 won't work - pxor (ctx), %xmm0 - aesenc 16(ctx), %xmm0 - aesenc 32(ctx), %xmm0 - aesenc 48(ctx), %xmm0 - aesenc 64(ctx), %xmm0 - aesenc 80(ctx), %xmm0 - aesenc 96(ctx), %xmm0 - aesenc 112(ctx), %xmm0 - aesenc 128(ctx), %xmm0 - aesenc 144(ctx), %xmm0 - aesenc 160(ctx), %xmm0 - aesenc 176(ctx), %xmm0 - aesenclast 192(ctx), %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - add $LOCAL_SIZE, r13 -#endif - ret -0: // special case expanded key is not 16-byte aligned -#ifdef KERNEL - movaps %xmm1, 16(r13) // save xmm1 into stack -#endif - movups (ctx), %xmm1 - pxor %xmm1, %xmm0 - movups 16(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 32(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 48(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 64(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 80(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 96(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 112(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 128(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 144(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 160(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 176(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 192(ctx), %xmm1 - aesenclast %xmm1, %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - movaps 16(r13), %xmm1 - add $LOCAL_SIZE, r13 -#endif - ret - -L_AES_256: - testb $15, %dl // check whether expanded key is 16-byte aligned - jne 0f // if not 16-byte aligned, aesenc xmm, m128 won't work - pxor (ctx), %xmm0 - aesenc 16(ctx), %xmm0 - aesenc 32(ctx), %xmm0 - aesenc 48(ctx), %xmm0 - aesenc 64(ctx), %xmm0 - aesenc 80(ctx), %xmm0 - aesenc 96(ctx), %xmm0 - aesenc 112(ctx), %xmm0 - aesenc 128(ctx), %xmm0 - aesenc 144(ctx), %xmm0 - aesenc 160(ctx), %xmm0 - aesenc 176(ctx), %xmm0 - aesenc 192(ctx), %xmm0 - aesenc 208(ctx), %xmm0 - aesenclast 224(ctx), %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - add $LOCAL_SIZE, r13 -#endif - ret -0: // special case expanded key is not 16-byte aligned -#ifdef KERNEL - movaps %xmm1, 16(r13) // save xmm1 into stack -#endif - movups (ctx), %xmm1 - pxor %xmm1, %xmm0 - movups 16(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 32(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 48(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 64(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 80(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 96(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 112(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 128(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 144(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 160(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 176(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 192(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 208(ctx), %xmm1 - aesenc %xmm1, %xmm0 - movups 224(ctx), %xmm1 - aesenclast %xmm1, %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - movaps 16(r13), %xmm1 - add $LOCAL_SIZE, r13 -#endif - ret - - - .text - .align 4,0x90 -.globl _aes_decrypt_hw -_aes_decrypt_hw: - -#if defined __i386__ - movl 4(%esp), %eax // in - movl 12(%esp), %edx // ctx - movl 8(%esp), %ecx // out - -#endif - -#ifdef KERNEL - sub $LOCAL_SIZE, r13 - movaps %xmm0, (r13) -#endif - movups (in), %xmm0 - - // key length identification - movl 240(ctx), %eax // key length - cmp $160, %eax - je 0f // AES-128 - cmp $192, %eax - je 1f // AES-192 - cmp $224, %eax - je 2f // AES-256 - mov $-1, %eax // return ERROR -#ifdef KERNEL - movaps (r13), %xmm0 - add $LOCAL_SIZE, r13 -#endif - ret - -0: // AES-128 - testb $15, %dl // check whether expanded key is 16-byte aligned - jne 9f // if not 16-byte aligned, aesenc xmm, m128 won't work - pxor 160(ctx), %xmm0 - aesdec 144(ctx), %xmm0 - aesdec 128(ctx), %xmm0 - aesdec 112(ctx), %xmm0 - aesdec 96(ctx), %xmm0 - aesdec 80(ctx), %xmm0 - aesdec 64(ctx), %xmm0 - aesdec 48(ctx), %xmm0 - aesdec 32(ctx), %xmm0 - aesdec 16(ctx), %xmm0 - aesdeclast (ctx), %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - add $LOCAL_SIZE, r13 -#endif - ret -9: // AES-128 Decrypt : special case expanded key is not 16-byte aligned -#ifdef KERNEL - movaps %xmm1, 16(r13) // save xmm1 into stack -#endif - movups 160(ctx), %xmm1 - pxor %xmm1, %xmm0 - movups 144(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 128(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 112(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 96(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 80(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 64(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 48(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 32(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 16(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups (ctx), %xmm1 - aesdeclast %xmm1, %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - movaps 16(r13), %xmm1 - add $LOCAL_SIZE, r13 -#endif - ret - -1: // AES-192 - testb $15, %dl // check whether expanded key is 16-byte aligned - jne 9f // if not 16-byte aligned, aesenc xmm, m128 won't work - pxor 192(ctx), %xmm0 - aesdec 176(ctx), %xmm0 - aesdec 160(ctx), %xmm0 - aesdec 144(ctx), %xmm0 - aesdec 128(ctx), %xmm0 - aesdec 112(ctx), %xmm0 - aesdec 96(ctx), %xmm0 - aesdec 80(ctx), %xmm0 - aesdec 64(ctx), %xmm0 - aesdec 48(ctx), %xmm0 - aesdec 32(ctx), %xmm0 - aesdec 16(ctx), %xmm0 - aesdeclast (ctx), %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - add $LOCAL_SIZE, r13 -#endif - ret -9: // AES-192 Decrypt : special case expanded key is not 16-byte aligned -#ifdef KERNEL - movaps %xmm1, 16(r13) // save xmm1 into stack -#endif - movups 192(ctx), %xmm1 - pxor %xmm1, %xmm0 - movups 176(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 160(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 144(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 128(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 112(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 96(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 80(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 64(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 48(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 32(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 16(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups (ctx), %xmm1 - aesdeclast %xmm1, %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - movaps 16(r13), %xmm1 - add $LOCAL_SIZE, r13 -#endif - ret - -2: // AES-256 - testb $15, %dl // check whether expanded key is 16-byte aligned - jne 9f // if not 16-byte aligned, aesenc xmm, m128 won't work - pxor 224(ctx), %xmm0 - aesdec 208(ctx), %xmm0 - aesdec 192(ctx), %xmm0 - aesdec 176(ctx), %xmm0 - aesdec 160(ctx), %xmm0 - aesdec 144(ctx), %xmm0 - aesdec 128(ctx), %xmm0 - aesdec 112(ctx), %xmm0 - aesdec 96(ctx), %xmm0 - aesdec 80(ctx), %xmm0 - aesdec 64(ctx), %xmm0 - aesdec 48(ctx), %xmm0 - aesdec 32(ctx), %xmm0 - aesdec 16(ctx), %xmm0 - aesdeclast (ctx), %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - add $LOCAL_SIZE, r13 -#endif - ret -9: // AES-256 Decrypt : special case expanded key is not 16-byte aligned -#ifdef KERNEL - movaps %xmm1, 16(r13) // save xmm1 into stack -#endif - movups 224(ctx), %xmm1 - pxor %xmm1, %xmm0 - movups 208(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 192(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 176(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 160(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 144(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 128(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 112(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 96(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 80(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 64(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 48(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 32(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups 16(ctx), %xmm1 - aesdec %xmm1, %xmm0 - movups (ctx), %xmm1 - aesdeclast %xmm1, %xmm0 - xorl %eax, %eax - movups %xmm0, (out) -#ifdef KERNEL - movaps (r13), %xmm0 - movaps 16(r13), %xmm1 - add $LOCAL_SIZE, r13 -#endif - ret - -#endif /* x86 based build */ DELETED Source/libtomcrypt/src/ciphers/aesedpport/aes_key_hw.s Index: Source/libtomcrypt/src/ciphers/aesedpport/aes_key_hw.s ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/aes_key_hw.s +++ /dev/null @@ -1,407 +0,0 @@ -/* This files defines _aes_encrypt_key_hw and _aes_decrypt_key_hw --- Intel Westmere HW AES-based implementation - of _aes_encrypt_key and _aes_decrypt_key. - - These 2 functions SHOULD BE entried ONLY after the AES HW is verified to be available. - They SHOULD NOT be called without AES HW detection. It might cause xnu to crash. - - The AES HW is detected 1st thing in - _aes_encrypt_key (ExpandKeyForEncryption.s) - _aes_decrypt_key (ExpandKeyForDecryption.s) - and, if AES HW is detected, branch without link (ie, jump) to the functions here. - - The implementation here follows the examples in an Intel White Paper - "Intel Advanced Encryption Standard (AES) Instruction Set" Rev.2 01 - - Note: Rev. 03 Final 2010 01 26 is available. Looks like some code change from Rev.2 01 - - cclee 3-13-10 -*/ -#if defined __i386__ || defined __x86_64__ - - .text - .align 4,0x90 - - // hw_aes_encrypt_key(key, klen, hwectx); - // klen = 16, 24, or 32, or (128/192/256) - - .globl _aes_encrypt_key_hw -_aes_encrypt_key_hw: - -#ifdef __i386__ - push %ebp - mov %esp, %ebp - push %ebx - push %edi - mov 8(%ebp), %eax // pointer to key - mov 12(%ebp), %ebx // klen - mov 16(%ebp), %edi // ctx - #define pkey %eax - #define klen %ebx - #define ctx %edi - #define sp %esp - #define cx %ecx -#else - #define pkey %rdi - #define klen %rsi - #define ctx %rdx - #define sp %rsp - #define cx %rcx - push %rbp - mov %rsp, %rbp -#endif - -#ifdef KERNEL - // for xmm registers save and restore - sub $(16*4), sp -#endif - - cmp $32, klen - jg 0f // klen>32 - shl $3, klen // convert 16/24/32 to 128/192/256 -0: - - cmp $128, klen // AES-128 ? - je L_AES_128_Encrypt_Key - cmp $192, klen // AES-192 ? - je L_AES_192_Encrypt_Key - cmp $256, klen // AES-256 ? - je L_AES_256_Encrypt_Key - mov $1, %eax // return error for wrong klen -L_Encrypt_Key_2_return: -#ifdef KERNEL - add $(16*4), sp -#endif -#ifdef __i386__ - pop %edi - pop %ebx -#endif - leave - ret - -L_AES_128_Encrypt_Key: -#ifdef KERNEL - // save xmm registers - movaps %xmm1, (sp) - movaps %xmm2, 16(sp) - movaps %xmm3, 32(sp) -#endif // KERNEL - - movl $160, 240(ctx) // write expanded key length to ctx - xor cx, cx - - movups (pkey), %xmm1 - movups %xmm1, (ctx) - aeskeygenassist $1, %xmm1, %xmm2 - call L_key_expansion_128 - aeskeygenassist $2, %xmm1, %xmm2 - call L_key_expansion_128 - aeskeygenassist $4, %xmm1, %xmm2 - call L_key_expansion_128 - aeskeygenassist $8, %xmm1, %xmm2 - call L_key_expansion_128 - aeskeygenassist $0x10, %xmm1, %xmm2 - call L_key_expansion_128 - aeskeygenassist $0x20, %xmm1, %xmm2 - call L_key_expansion_128 - aeskeygenassist $0x40, %xmm1, %xmm2 - call L_key_expansion_128 - aeskeygenassist $0x80, %xmm1, %xmm2 - call L_key_expansion_128 - aeskeygenassist $0x1b, %xmm1, %xmm2 - call L_key_expansion_128 - aeskeygenassist $0x36, %xmm1, %xmm2 - call L_key_expansion_128 - -#ifdef KERNEL - // restore xmm registers - movaps (sp), %xmm1 - movaps 16(sp), %xmm2 - movaps 32(sp), %xmm3 -#endif // KERNEL - xor %eax, %eax // return 0 for success - jmp L_Encrypt_Key_2_return - - .align 4, 0x90 -L_key_expansion_128: - pshufd $0xff, %xmm2, %xmm2 - movaps %xmm1, %xmm3 - pslldq $4, %xmm3 - pxor %xmm3, %xmm1 - movaps %xmm1, %xmm3 - pslldq $4, %xmm3 - pxor %xmm3, %xmm1 - movaps %xmm1, %xmm3 - pslldq $4, %xmm3 - pxor %xmm3, %xmm1 - pxor %xmm2, %xmm1 - add $16, cx - movups %xmm1, (ctx, cx) - ret - -L_AES_192_Encrypt_Key: -#ifdef KERNEL - // save xmm registers - movaps %xmm1, (sp) - movaps %xmm2, 16(sp) - movaps %xmm3, 32(sp) - movaps %xmm4, 48(sp) -#endif // KERNEL - movl $192, 240(ctx) // write expanded key length to ctx - - movups (pkey), %xmm1 - movq 16(pkey), %xmm3 - - movups %xmm1, (ctx) - movq %xmm3, 16(ctx) - - lea 24(ctx), cx - - aeskeygenassist $1, %xmm3, %xmm2 - call L_key_expansion_192 - aeskeygenassist $2, %xmm3, %xmm2 - call L_key_expansion_192 - aeskeygenassist $4, %xmm3, %xmm2 - call L_key_expansion_192 - aeskeygenassist $8, %xmm3, %xmm2 - call L_key_expansion_192 - aeskeygenassist $0x10, %xmm3, %xmm2 - call L_key_expansion_192 - aeskeygenassist $0x20, %xmm3, %xmm2 - call L_key_expansion_192 - aeskeygenassist $0x40, %xmm3, %xmm2 - call L_key_expansion_192 - aeskeygenassist $0x80, %xmm3, %xmm2 - call L_key_expansion_192 - -#ifdef KERNEL - // restore xmm registers - movaps (sp), %xmm1 - movaps 16(sp), %xmm2 - movaps 32(sp), %xmm3 - movaps 48(sp), %xmm4 -#endif // KERNEL - xor %eax, %eax // return 0 for success - jmp L_Encrypt_Key_2_return - - .align 4, 0x90 -L_key_expansion_192: - pshufd $0x55, %xmm2, %xmm2 - - movaps %xmm1, %xmm4 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm1 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm1 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm1 - pxor %xmm2, %xmm1 - - pshufd $0xff, %xmm1, %xmm2 - - movaps %xmm3, %xmm4 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm3 - pxor %xmm2, %xmm3 - - movups %xmm1, (cx) - movq %xmm3, 16(cx) - - add $24, cx - ret - -L_AES_256_Encrypt_Key: -#ifdef KERNEL - // save xmm registers - movaps %xmm1, (sp) - movaps %xmm2, 16(sp) - movaps %xmm3, 32(sp) - movaps %xmm4, 48(sp) -#endif // KERNEL - movl $224, 240(ctx) // write expanded key length to ctx - - movups (pkey), %xmm1 - movups 16(pkey), %xmm3 - movups %xmm1, (ctx) - movups %xmm3, 16(ctx) - - lea 32(ctx), cx - - aeskeygenassist $1, %xmm3, %xmm2 - call L_key_expansion_256 - aeskeygenassist $2, %xmm3, %xmm2 - call L_key_expansion_256 - aeskeygenassist $4, %xmm3, %xmm2 - call L_key_expansion_256 - aeskeygenassist $8, %xmm3, %xmm2 - call L_key_expansion_256 - aeskeygenassist $0x10, %xmm3, %xmm2 - call L_key_expansion_256 - aeskeygenassist $0x20, %xmm3, %xmm2 - call L_key_expansion_256 - aeskeygenassist $0x40, %xmm3, %xmm2 - call L_key_expansion_256_final - -#ifdef KERNEL - // restore xmm registers - movaps (sp), %xmm1 - movaps 16(sp), %xmm2 - movaps 32(sp), %xmm3 - movaps 48(sp), %xmm4 -#endif // KERNEL - xor %eax, %eax // return 0 for success - jmp L_Encrypt_Key_2_return - - .align 4, 0x90 -L_key_expansion_256: - - pshufd $0xff, %xmm2, %xmm2 - - movaps %xmm1, %xmm4 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm1 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm1 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm1 - pxor %xmm2, %xmm1 - - movups %xmm1, (cx) - - aeskeygenassist $0, %xmm1, %xmm4 - - pshufd $0xaa, %xmm4, %xmm2 - - movaps %xmm3, %xmm4 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm3 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm3 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm3 - pxor %xmm2, %xmm3 - - movups %xmm3, 16(cx) - - add $32, cx - ret - - .align 4, 0x90 -L_key_expansion_256_final: - - pshufd $0xff, %xmm2, %xmm2 - - movaps %xmm1, %xmm4 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm1 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm1 - pslldq $4, %xmm4 - - pxor %xmm4, %xmm1 - pxor %xmm2, %xmm1 - - movups %xmm1, (cx) - ret - -// _aes_decrypt_key_hw is implemented as -// 1. call _aes_encrypt_key_hw -// 2. use aesimc to convert the expanded round keys (except the 1st and last round keys) - - .text - .align 4, 0x90 - .globl _aes_decrypt_key_hw -_aes_decrypt_key_hw: - -#ifdef __i386__ - - push %ebp - mov %esp, %ebp - sub $(8+16), %esp - - // copy input arguments for calling aes_decrypt_key_hw - - mov 8(%ebp), %eax - mov %eax, (%esp) - mov 12(%ebp), %eax - mov %eax, 4(%esp) - mov 16(%ebp), %eax - mov %eax, 8(%esp) - -#else - - push %rbp - mov %rsp, %rbp - sub $16, %rsp - - // calling arguments %rdi/%rsi/%rdx will be used for encrypt_key - // %rdx (ctx) will return unchanged - // %rsi (klen) will (<<3) if <= 32 - -#endif - call _aes_encrypt_key_hw - cmp $0, %eax - je L_decrypt_inv -L_decrypt_almost_done: -#ifdef __i386__ - add $(8+16), %esp -#else - add $16, %rsp -#endif - leave - ret - -L_decrypt_inv: -#ifdef KERNEL - movaps %xmm0, (sp) -#endif - -#ifdef __i386__ - #undef klen - #undef ctx - mov 12(%ebp), %eax // klen - mov 16(%ebp), %edx // ctx - #define klen %eax - #define ctx %edx - cmp $32, klen - jg 0f // klen>32 - shl $3, klen // convert 16/24/32 to 128/192/256 -0: -#endif - - mov $9, cx // default is AES-128 - cmp $128, klen - je L_Decrypt_Key - add $2, cx - cmp $192, klen - je L_Decrypt_Key - add $2, cx - -L_Decrypt_Key: - add $16, ctx - movups (ctx), %xmm0 - aesimc %xmm0, %xmm0 - movups %xmm0, (ctx) - sub $1, cx - jg L_Decrypt_Key - -#ifdef KERNEL - movaps (sp), %xmm0 -#endif -#ifdef __i386__ - xor %eax, %eax -#endif - jmp L_decrypt_almost_done - -#endif /* x86 based build */ DELETED Source/libtomcrypt/src/ciphers/aesedpport/aes_modes_asm.s Index: Source/libtomcrypt/src/ciphers/aesedpport/aes_modes_asm.s ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/aes_modes_asm.s +++ /dev/null @@ -1,428 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 31/01/2006 - - These subroutines implement multiple block AES modes for ECB, CBC, CFB, - OFB and CTR encryption, The code provides support for the VIA Advanced - Cryptography Engine (ACE). - - NOTE: In the following subroutines, the AES contexts (ctx) must be - 16 byte aligned if VIA ACE is being used -*/ -#if defined __i386__ || defined __x86_64__ - -/* modified 3/5/10 cclee */ -/* Clean up those related to VIA ACE and hand optimize aes_cbc_encrypt and aes_cbc_decrypt */ -/* move the xmm registers save/restore originally inside the callee functions into these 2 caller functions */ - -/* add code comments/description and HW AES detection and execution branch cclee 3-13-10 */ - -/* cclee 7-30-10 - per murf's request, I changed the type of the 2nd argument iv in aes_encrypt_cbc/aes_decrypt_cbc - from "const unsigned char *" to "unsigned char *". That is, the updated *iv (16-bytes) is written back - to the memory in the caller function pointed by the input argument. - In the implementation, *iv is locally saved in %xmm7. - Before return, we now write %xmm7 back to *iv. - - Note: we only do this in CommonCrypto. In the kernel, there are some other functions (IOKit/vm_pageout, e.g.) - that might assume *iv is read only, and therefore should not be changed. This is being tracked in - - xnu : add cbc feature in bsd/crypto/aes/i386/ - -*/ - -#include // to use __cpu_capabilities&kHasAES to detect Intel Westmere AES HW - -#if 0 - -// TODO: -// aes_ecb_encrypt and aes_ecb_decrypt are not present in gen/aescrypt.c -// would add the implementation if needed -// they are now compiled from aes_modes.c - -aes_rval aes_ecb_encrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, const aes_encrypt_ctx ctx[1]) -{ int nb = len >> 4; - - if(len & (AES_BLOCK_SIZE - 1)) return 1; - while(nb--) { - aes_encrypt(ibuf, obuf, ctx); - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - } - return 0; -} - -aes_rval aes_ecb_decrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, const aes_decrypt_ctx ctx[1]) -{ int nb = len >> 4; - - if(len & (AES_BLOCK_SIZE - 1)) return 1; - while(nb--) { - aes_decrypt(ibuf, obuf, ctx); - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - } - return 0; -} -#endif - -#if 0 -aes_rval aesedp_encrypt_cbc(const unsigned char *ibuf, unsigned char *iv, unsigned int num_blk, - unsigned char *obuf, const aes_encrypt_ctx ctx[1]) -{ - int i; - - while (num_blk--) { - *iv ^= ibuf; // 128-bit - aes_encrypt(*iv, *iv, ctx); - memcpy(obuf, iv, AES_BLOCK_SIZE); - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - - } - - return 0; -} -#endif - - .text - .align 4,0x90 - .globl _aesedp_encrypt_cbc -_aesedp_encrypt_cbc: - - // detect AES HW - // if AES HW detected, branch to AES-HW-specific function _aesedp_encrypt_cbc_hw (aes_modes_hw.s) - // o.w., fall through to the original AES-SW function - -#if defined __x86_64__ - movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capability - mov (%rax), %eax // %eax = __cpu_capabilities -#else -#ifdef KERNEL - leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities - mov (%eax), %eax // %eax = __cpu_capabilities -#else - mov _COMM_PAGE_CPU_CAPABILITIES, %eax -#endif -#endif - test $(kHasAES), %eax // kHasAES & __cpu_capabilities - jne _aesedp_encrypt_cbc_hw // if AES HW detected, branch to HW-specific code - - // save registers and allocate stack memory for xmm registers and calling arguments (i386 only) -#if defined __i386__ - push %ebp - mov %esp, %ebp - push %ebx // to be used as ibuf - push %edi // to be used as obuf - sub $(16+16+7*16), %esp // 12 (calling arguments) + 4 (%esi) + 16 (iv) + 7*16 (xmm) - mov %esi, 12(%esp) // save %esp in the unused 4-bytes, to be used as num_blk - - #define sp %esp -#else // __x86_64__ - push %rbp - mov %rsp, %rbp - push %rbx - push %r12 - push %r13 - push %r14 - push %r15 - sub $(8+16+5*16+16), %rsp // 8 (align) + 16 (dummy iv) + 5*16 (xmm) + 16 (for i386-x86_64 consistency) - - #define sp %rsp -#endif - - // save xmm registers for kernel use - // xmm6-xmm7 will be used locally - // xmm0-xmm2 (x86_64) or xmm0-/xmm4 (i386) will be used inside _aes_encrypt_xmm_no_save (non-restored) - - // the following code is changed per to a request from commoncrypto, it use directly *iv, not a local copy - -#ifdef KERNEL - movaps %xmm7, 16(sp) - movaps %xmm6, 32(sp) - movaps %xmm0, 64(sp) - movaps %xmm1, 80(sp) - movaps %xmm2, 96(sp) -#if defined __i386__ - movaps %xmm3, 112(sp) - movaps %xmm4, 128(sp) -#endif -#endif - - // set up registers from calling arguments - -#if defined __i386__ - - mov 12(%ebp), %eax // iv - mov 24(%ebp), %edx // ctx - movups (%eax), %xmm7 // in_iv - mov %eax, (%esp) // 1st iv for aes_encrypt - mov %eax, 4(%esp) // 2nd iv for aes_encrypt - mov %edx, 8(%esp) // ctx for aes_encrypt - mov 8(%ebp), %ebx // ibuf - mov 16(%ebp), %esi // num_blk - mov 20(%ebp), %edi // obuf - - #define ibuf %ebx - #define obuf %edi - #define num_blk %esi - -#else // __x86_64__, calling arguments order : rdi/rsi/rdx/rcx/r8 - - mov %rdi, %rbx // ibuf - mov %rsi, %r12 // &iv - movups (%rsi), %xmm7 // in_iv - mov %rdx, %r13 // num_blk - mov %rcx, %r14 // obuf - mov %r8, %r15 // ctx - - #define ibuf %rbx - #define iv %r12 - #define num_blk %r13d - #define obuf %r14 - #define ctx %r15 - -#endif - - cmp $1, num_blk // num_blk vs 1 - jl 9f // if num_blk < 1, branch to bypass the main loop -0: - movups (ibuf), %xmm6 // ibuf -#if defined __i386__ - mov 12(%ebp), %eax // &iv[0] - pxor %xmm6, %xmm7 // iv ^= ibuf - movups %xmm7, (%eax) // save iv -#else - pxor %xmm6, %xmm7 // iv ^= ibuf - movups %xmm7, (iv) // save iv - mov iv, %rdi // 1st calling argument for aes_encrypt - mov iv, %rsi // 2nd calling argument for aes_encrypt - mov ctx, %rdx // 3rd calling argument for aes_encrypt -#endif - call _aes_encrypt_xmm_no_save // aes_encrypt(iv, iv, ctx) -#if defined __i386__ - mov 12(%ebp), %eax // &iv[0] - movups (%eax), %xmm7 // read iv -#else - movups (iv), %xmm7 // read iv -#endif - movups %xmm7, (obuf) // memcpy(obuf, iv, AES_BLOCK_SIZE); - add $16, ibuf // ibuf += AES_BLOCK_SIZE; - add $16, obuf // obuf += AES_BLOCK_SIZE; - sub $1, num_blk // num_blk -- - jg 0b // if num_blk > 0, repeat the loop -9: - -L_crypt_cbc_done: - - // save the updated *iv -#if defined __i386__ - mov 12(%ebp), %eax - movups %xmm7, (%eax) -#else - movups %xmm7, (iv) -#endif - - // restore xmm registers due to kernel use -#ifdef KERNEL - movaps 16(sp), %xmm7 - movaps 32(sp), %xmm6 - movaps 64(sp), %xmm0 - movaps 80(sp), %xmm1 - movaps 96(sp), %xmm2 -#if defined __i386__ - movaps 112(sp), %xmm3 - movaps 128(sp), %xmm4 -#endif -#endif - - xor %eax, %eax // to return 0 for SUCCESS - -#if defined __i386__ - mov 12(%esp), %esi // restore %esi - add $(16+16+7*16), %esp // 12 (calling arguments) + 4 (%esi) + 16 (iv) + 7*16 (xmm) - pop %edi - pop %ebx -#else - add $(8+16+5*16+16), %rsp // 8 (align) + 16 (dummy iv) + 5*16 (xmm) + 16 (for i386-x86_64 consistency) - pop %r15 - pop %r14 - pop %r13 - pop %r12 - pop %rbx -#endif - leave - ret - -#if 0 -aes_rval aesedp_decrypt_cbc(const unsigned char *ibuf, unsigned char *iv, unsigned int num_blk, - unsigned char *obuf, const aes_decrypt_ctx cx[1]) -{ - unsigned char tmp[16]; - int i; - - while (num_blk--) { - - memcpy(tmp, ibuf, AES_BLOCK_SIZE); - aes_decrypt(ibuf, obuf, ctx); - obuf ^= *iv; - memcpy(iv, tmp, AES_BLOCK_SIZE); - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - } - - return 0; -} -#endif - - .text - .align 4,0x90 - .globl _aesedp_decrypt_cbc -_aesedp_decrypt_cbc: - - // detect AES HW - // if AES HW detected, branch to AES-HW-specific function _aesedp_decrypt_cbc_hw (aes_modes_hw.s) - // o.w., fall through to the original AES-SW function - -#if defined __x86_64__ - movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capability - mov (%rax), %eax // %eax = __cpu_capabilities -#else -#ifdef KERNEL - leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities - mov (%eax), %eax // %eax = __cpu_capabilities -#else - mov _COMM_PAGE_CPU_CAPABILITIES, %eax -#endif -#endif - test $(kHasAES), %eax // kHasAES & __cpu_capabilities - jne _aesedp_decrypt_cbc_hw - - // save registers and allocate stack memory for xmm registers and calling arguments (i386 only) -#if defined __i386__ - push %ebp - mov %esp, %ebp - push %ebx // to be used as ibuf - push %edi // to be used as obuf - sub $(16+16+7*16), %esp // 12 (calling arguments) + 4 (%esi) + 16 (iv) + 7*16 (xmm) - mov %esi, 12(%esp) // save %esp in the unused 4-bytes, to be used as num_blk - - #define sp %esp -#else // __x86_64__ - push %rbp - mov %rsp, %rbp - push %rbx - push %r12 - push %r13 - push %r14 - push %r15 - sub $(8+16+5*16+16), %rsp // 8 (align) + 16 (dummy iv) + 5*16 (xmm) + 16 (for i386-x86_64 consistency) - - #define sp %rsp -#endif - - // save xmm registers for kernel use - // xmm6-xmm7 will be used locally - // xmm0-xmm2 (x86_64) or xmm0-/xmm4 (i386) will be used inside _aes_encrypt_xmm_no_save (non-restored) - -#ifdef KERNEL - movaps %xmm7, 16(sp) - movaps %xmm6, 32(sp) - movaps %xmm0, 64(sp) - movaps %xmm1, 80(sp) - movaps %xmm2, 96(sp) -#if defined __i386__ - movaps %xmm3, 112(sp) - movaps %xmm4, 128(sp) -#endif -#endif - - // set up registers from calling arguments - -#if defined __i386__ - mov 12(%ebp), %eax // &iv[0] - mov 24(%ebp), %edx // ctx - movups (%eax), %xmm7 // in_iv - mov %edx, 8(%esp) // ctx for aes_encrypt - mov 8(%ebp), %ebx // ibuf - mov 16(%ebp), %esi // num_blk - mov 20(%ebp), %edi // obuf - - #define ibuf %ebx - #define obuf %edi - #define num_blk %esi -#else // __x86_64__, rdi/rsi/rdx/rcx/r8 - mov %rdi, %rbx // ibuf - mov %rsi, %r12 // &iv[0] - movups (%rsi), %xmm7 // in_iv - mov %rdx, %r13 // num_blk - mov %rcx, %r14 // obuf - mov %r8, %r15 // ctx - - #define ibuf %rbx - #define num_blk %r13d - #define obuf %r14 - #define ctx %r15 - -#endif - // memcpy(tmp, ibuf, AES_BLOCK_SIZE); - // aes_decrypt(ibuf, obuf, ctx); - // obuf ^= iv; - // memcpy(iv, tmp, AES_BLOCK_SIZE); - // ibuf += AES_BLOCK_SIZE; - // obuf += AES_BLOCK_SIZE; - - cmp $1, num_blk // num_blk vs 1 - jl L_crypt_cbc_done // if num_blk < 1, bypass the main loop, jump to finishing code -0: - movups (ibuf), %xmm6 // tmp -#if defined __i386__ - mov ibuf, (sp) // ibuf - mov obuf, 4(sp) // obuf -#else - mov ibuf, %rdi // ibuf - mov obuf, %rsi // obuf - mov ctx, %rdx // ctx -#endif - call _aes_decrypt_xmm_no_save // aes_decrypt(ibuf, obuf, ctx) - movups (obuf), %xmm0 // obuf - pxor %xmm7, %xmm0 // obuf ^= iv; - movaps %xmm6, %xmm7 // memcpy(iv, tmp, AES_BLOCK_SIZE); - movups %xmm0, (obuf) // update obuf - add $16, ibuf // ibuf += AES_BLOCK_SIZE; - add $16, obuf // obuf += AES_BLOCK_SIZE; - sub $1, num_blk // num_blk -- - jg 0b // if num_blk > 0, repeat the loop -9: - - // we are done here, the finishing code is identical to that in aesedp_encrypt_cbc, so just jump to there - jmp L_crypt_cbc_done -#endif /* x86 based build */ DELETED Source/libtomcrypt/src/ciphers/aesedpport/aes_modes_hw.s Index: Source/libtomcrypt/src/ciphers/aesedpport/aes_modes_hw.s ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/aes_modes_hw.s +++ /dev/null @@ -1,1694 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 31/01/2006 - - These subroutines implement multiple block AES modes for ECB, CBC, CFB, - OFB and CTR encryption, The code provides support for the VIA Advanced - Cryptography Engine (ACE). - - NOTE: In the following subroutines, the AES contexts (ctx) must be - 16 byte aligned if VIA ACE is being used -*/ - -#if defined __i386__ || defined __x86_64__ - -/* modified 3/5/10 cclee */ -/* Clean up those related to VIA ACE and hand optimize aes_cbc_encrypt and aes_cbc_decrypt */ -/* move the xmm registers save/restore originally inside the callee functions into these 2 caller functions */ - -/* HW-AES specific implementation cclee 3-12-10 */ -/* In aes_encrypt_cbc and aes_decrypt_cbc, __cpu_capabilities is polled, - and if kHasAES is detected, branch to the hw-specific functions here */ - - -/* - This files defines _aesedp_encrypt_cbc_hw and _aesedp_decrypt_cbc_hw --- Intel Westmere HW AES-based implementation - of _aes_encrypt_cbc and _aes_decrypt_cbc. - - These 2 functions SHOULD BE entried ONLY after the AES HW is verified to be available. - They SHOULD NOT be called without AES HW detection. It might cause xnu to crash. - - The AES HW is detected 1st thing in - _aes_encrypt_cbc (aes_modes_asm.s) - _aes_decrypt_cbc (aes_modes_asm.s) - and, if AES HW is detected, branch without link (ie, jump) to the functions here. - - The implementation here follows the examples in an Intel White Paper - "Intel Advanced Encryption Standard (AES) Instruction Set" Rev.2 01 - - Note: Rev. 03 Final 2010 01 26 is available. Looks like some code change from Rev.2 01 - - cclee 3-13-10 -*/ - -/* - The function _aesedp_decrypt_cbc_hw previously simply serially decrypts block by block - in our group meeting, Eric/Ali suggested that I perhaps should take a look of combining multiple blocks - in a loop and interleaving multiple aesdec instructions to absorb/hide stalls to improve the decrypt thoughput. - - The idea was actually described in the Intel AES Instruction Set White Paper (Rev. 2.0 page 53-55) - - This modification interleaves the aesdec/aesdeclast instructions for 4 blocks in cbc mode. - On a 2.4GHz core-i5/2.66GHz core-i7, the x86_64 decrypt throughput (in xnu-iokit) has been improved - from 1180/1332 to 1667/1858 MBytes/sec. This is approximately 1.40 times speedup in the decryption. - The encrypt throughput is not changed. - - I also enhanced the assembly code comments. - - cclee-4-30-10 (Do you know 4-30 is National Honesty Day in the US? No need to know. I've been honest all the time.) - -*/ - -/* cclee 7-30-10 - per murf's request, I changed the type of the 2nd argument iv in aes_encrypt_cbc/aes_decrypt_cbc - from "const unsigned char *" to "unsigned char *". That is, the updated *iv (16-bytes) is written back - to the memory in the caller function pointed by the input argument. - In the implementation, *iv is locally saved in %xmm7. - Before return, we now write %xmm7 back to *iv. - - Note: we only do this in CommonCrypto. In the kernel, there are some other functions (IOKit/vm_pageout, e.g.) - that might assume *iv is read only, and therefore should not be changed. This is being tracked in - - xnu : add cbc feature in bsd/crypto/aes/i386/ - -*/ - -/* ---------------------------------------------------------------------------------------------------------------- - - aes_encrypt_cbc function (see aes_modes.c or aes_modes_asm.s) : - - For simplicity, I am assuming all variables are in 128-bit data type. - - aes_rval aes_encrypt_cbc(const __m128 *ibuf, __m128 *iv, int num_blk, __m128 *obuf, const aes_encrypt_ctx *ctx) - { - while(num_blk--) { - *iv ^= *ibuf++; - aes_encrypt(iv, iv, ctx); - *obuf++ = *iv; - } - return 0; - } - - The following is an implementation of this function using Intel AESNI. - This function _aesedp_encrypt_cbc_hw SHOULD NOT be called directly. - Developer should still call _aes_encrypt_cbc (in aes_modes_asm.s) which will poll cpu_capabilities and branch - to this aesni-based function should it detecs that aesni is available. - Blindly call this function SURELY will cause a CRASH on systems with no aesni support. - - Note that each block starts with *iv, which is the output of the previous block. Therefore, the cbc blocks - are serially chained. This prevents us from arranging several blocks for encryption in parallel. - - ----------------------------------------------------------------------------------------------------------------*/ - - .text - .align 4,0x90 - .globl _aesedp_encrypt_cbc_hw -_aesedp_encrypt_cbc_hw: - - // push/save registers for local use -#if defined __i386__ - - push %ebp - movl %esp, %ebp - push %ebx - push %edi - - #define sp %esp - -#else // __x86_64__ - - push %rbp - mov %rsp, %rbp - push %rbx - push %r13 - push %r14 - push %r15 - - #define sp %rsp - -#endif - - // if this is kernel code, need to save used xmm registers -#ifdef KERNEL - -#if defined __i386__ - sub $(8*16), %esp // for possible xmm0-xmm7 save/restore -#else - sub $(16*16), %rsp // xmm0-xmm15 save/restore -#endif - - movaps %xmm0, (sp) - movaps %xmm1, 16(sp) - movaps %xmm2, 32(sp) - movaps %xmm3, 48(sp) - movaps %xmm4, 64(sp) - movaps %xmm5, 80(sp) - movaps %xmm6, 96(sp) - movaps %xmm7, 112(sp) -#if defined __x86_64__ - movaps %xmm8, 16*8(sp) - movaps %xmm9, 16*9(sp) - movaps %xmm10, 16*10(sp) - movaps %xmm11, 16*11(sp) - movaps %xmm12, 16*12(sp) - movaps %xmm13, 16*13(sp) - movaps %xmm14, 16*14(sp) - movaps %xmm15, 16*15(sp) -#endif // __x86_64__ - -#endif // KERNEL - - #define iv %xmm0 - -#ifdef __i386__ - - mov 12(%ebp), %eax // &iv[0] - mov 24(%ebp), %edx // ctx - movups (%eax), iv // iv = in_iv - mov 8(%ebp), %ebx // ibuf - mov 16(%ebp), %ecx // num_blk - mov 20(%ebp), %edi // obuf - - #define ibuf %ebx - #define obuf %edi - #define num_blk %ecx - #define ctx %edx - -#else - - mov %rdi, %rbx // ibuf - movups (%rsi), iv // iv = in_iv - mov %rdx, %r13 // num_blk - mov %rcx, %r14 // obuf - mov %r8, %r15 // ctx - - #define ibuf %rbx - #define num_blk %r13d - #define obuf %r14 - #define ctx %r15 - -#endif - - mov 240(ctx), %eax // aes length - cmp $160, %eax // aes-128 encrypt ? - je L_encrypt_128 - cmp $192, %eax // aes-192 encrypt ? - je L_encrypt_192 - cmp $224, %eax // aes-256 encrypt ? - je L_encrypt_256 - mov $-1, %eax // return error - jmp L_error - - // - // aes-128 encrypt_cbc operation, up to L_HW_cbc_done - // - -L_encrypt_128: - - cmp $1, num_blk // check number of block - jl L_HW_cbc_done // should it be less than 1, nothing to do - - movups (ctx), %xmm2 // key0 - movups 16(ctx), %xmm3 // key1 - movups 32(ctx), %xmm4 // key2 - movups 48(ctx), %xmm5 // key3 - movups 64(ctx), %xmm6 // key4 - movups 80(ctx), %xmm7 // key5 -#if defined __x86_64__ - movups 96(ctx), %xmm8 // key6 - movups 112(ctx), %xmm9 // key7 - movups 128(ctx), %xmm10 // key8 - movups 144(ctx), %xmm11 // key9 - movups 160(ctx), %xmm12 // keyA -#endif - - // while (num_blk--) { - // *iv ^= *ibuf++; - // aes_encrypt(iv, iv, ctx); - // *obuf++ = *iv; - // } -0: - movups (ibuf), %xmm1 // *ibuf - pxor %xmm2, iv // 1st instruction inside aes_encrypt - pxor %xmm1, iv // *iv ^= *ibuf - - // finishing up the rest of aes_encrypt - aesenc %xmm3, iv - aesenc %xmm4, iv - aesenc %xmm5, iv - aesenc %xmm6, iv - aesenc %xmm7, iv -#if defined __x86_64__ - aesenc %xmm8, iv - aesenc %xmm9, iv - aesenc %xmm10, iv - aesenc %xmm11, iv - aesenclast %xmm12, iv -#else - movups 96(ctx), %xmm1 // key6 - aesenc %xmm1, iv - movups 112(ctx), %xmm1 // key7 - aesenc %xmm1, iv - movups 128(ctx), %xmm1 // key8 - aesenc %xmm1, iv - movups 144(ctx), %xmm1 // key9 - aesenc %xmm1, iv - movups 160(ctx), %xmm1 // keyA - aesenclast %xmm1, iv -#endif - - movups iv, (obuf) // *obuf = *iv; - add $16, obuf // obuf++; - add $16, ibuf // ibuf++; - sub $1, num_blk // num_blk -- - jg 0b // if num_blk > 0, repeat the loop - - // the following will be branched to from all other cases (encrypt/decrypt 128/192/256) - -L_HW_cbc_done: - - // save the updated *iv -#if defined __i386__ - mov 12(%ebp), %eax - movups iv, (%eax) -#else - movups iv, (%rsi) -#endif - - xor %eax, %eax // to return CRYPT_OK - -L_error: - - // if kernel, restore xmm registers -#ifdef KERNEL - movaps 0(sp), %xmm0 - movaps 16(sp), %xmm1 - movaps 32(sp), %xmm2 - movaps 48(sp), %xmm3 - movaps 64(sp), %xmm4 - movaps 80(sp), %xmm5 - movaps 96(sp), %xmm6 - movaps 112(sp), %xmm7 -#if defined __x86_64__ - movaps 16*8(sp), %xmm8 - movaps 16*9(sp), %xmm9 - movaps 16*10(sp), %xmm10 - movaps 16*11(sp), %xmm11 - movaps 16*12(sp), %xmm12 - movaps 16*13(sp), %xmm13 - movaps 16*14(sp), %xmm14 - movaps 16*15(sp), %xmm15 -#endif // __x86_64__ -#endif // KERNEL - - // release used stack memory, restore used callee-saved registers, and return -#if defined __i386__ -#ifdef KERNEL - add $(8*16), %esp -#endif - pop %edi - pop %ebx -#else -#ifdef KERNEL - add $(16*16), %rsp -#endif - pop %r15 - pop %r14 - pop %r13 - pop %rbx -#endif - leave - ret - - // - // aes-192 encrypt_cbc operation, after completion, branch to L_HW_cbc_done - // - -L_encrypt_192: - - cmp $1, num_blk // check number of block - jl L_HW_cbc_done // should it be less than 1, nothing to do - - movups (ctx), %xmm2 // key0 - movups 16(ctx), %xmm3 // key1 - movups 32(ctx), %xmm4 // key2 - movups 48(ctx), %xmm5 // key3 - movups 64(ctx), %xmm6 // key4 - movups 80(ctx), %xmm7 // key5 -#if defined __x86_64__ - movups 96(ctx), %xmm8 // key6 - movups 112(ctx), %xmm9 // key7 - movups 128(ctx), %xmm10 // key8 - movups 144(ctx), %xmm11 // key9 - movups 160(ctx), %xmm12 // keyA - movups 176(ctx), %xmm13 // keyB - movups 192(ctx), %xmm14 // keyC -#endif - - // while (num_blk--) { - // *iv ^= *ibuf++; - // aes_encrypt(iv, iv, ctx); - // *obuf++ = *iv; - // } -0: - movups (ibuf), %xmm1 // *ibuf - pxor %xmm1, iv // *iv ^= ibuf - - // aes_encrypt(iv, iv, ctx); - - pxor %xmm2, iv - aesenc %xmm3, iv - aesenc %xmm4, iv - aesenc %xmm5, iv - aesenc %xmm6, iv - aesenc %xmm7, iv -#if defined __x86_64__ - aesenc %xmm8, iv - aesenc %xmm9, iv - aesenc %xmm10, iv - aesenc %xmm11, iv - aesenc %xmm12, iv - aesenc %xmm13, iv - aesenclast %xmm14, iv -#else - movups 96(ctx), %xmm1 - aesenc %xmm1, iv - movups 112(ctx), %xmm1 - aesenc %xmm1, iv - movups 128(ctx), %xmm1 - aesenc %xmm1, iv - movups 144(ctx), %xmm1 - aesenc %xmm1, iv - movups 160(ctx), %xmm1 - aesenc %xmm1, iv - movups 176(ctx), %xmm1 - aesenc %xmm1, iv - movups 192(ctx), %xmm1 - aesenclast %xmm1, iv -#endif - - movups iv, (obuf) // *obuf = *iv; - add $16, ibuf // ibuf++ - add $16, obuf // obuf++ - - sub $1, num_blk // num_blk -- - jg 0b // if num_blk > 0, repeat the loop - - jmp L_HW_cbc_done // share with the common exit code - - // - // aes-256 encrypt_cbc operation, after completion, branch to L_HW_cbc_done - // - -L_encrypt_256: - - cmp $1, num_blk // check number of block - jl L_HW_cbc_done // should it be less than 1, nothing to do - - movups (ctx), %xmm2 // key0 - movups 16(ctx), %xmm3 // key1 - movups 32(ctx), %xmm4 // key2 - movups 48(ctx), %xmm5 // key3 - movups 64(ctx), %xmm6 // key4 - movups 80(ctx), %xmm7 // key5 -#if defined __x86_64__ - movups 96(ctx), %xmm8 // key6 - movups 112(ctx), %xmm9 // key7 - movups 128(ctx), %xmm10 // key8 - movups 144(ctx), %xmm11 // key9 - movups 160(ctx), %xmm12 // keyA - movups 176(ctx), %xmm13 // keyB - movups 192(ctx), %xmm14 // keyC - movups 208(ctx), %xmm15 // keyD - // movups 224(ctx), %xmm1 // keyE -#endif - - // while (num_blk--) { - // *iv ^= *ibuf++; - // aes_encrypt(iv, iv, ctx); - // *obuf++ = *iv; - // } -0: - movups (ibuf), %xmm1 // *ibuf - pxor %xmm1, iv // *iv ^= ibuf - - // aes_encrypt(iv, iv, ctx); - pxor %xmm2, iv - aesenc %xmm3, iv - aesenc %xmm4, iv - aesenc %xmm5, iv - aesenc %xmm6, iv - aesenc %xmm7, iv -#if defined __x86_64__ - movups 224(ctx), %xmm1 // keyE - aesenc %xmm8, iv - aesenc %xmm9, iv - aesenc %xmm10, iv - aesenc %xmm11, iv - aesenc %xmm12, iv - aesenc %xmm13, iv - aesenc %xmm14, iv - aesenc %xmm15, iv - aesenclast %xmm1, iv -#else - movups 96(ctx), %xmm1 // key6 - aesenc %xmm1, iv - movups 112(ctx), %xmm1 // key7 - aesenc %xmm1, iv - movups 128(ctx), %xmm1 // key8 - aesenc %xmm1, iv - movups 144(ctx), %xmm1 // key9 - aesenc %xmm1, iv - movups 160(ctx), %xmm1 // keyA - aesenc %xmm1, iv - movups 176(ctx), %xmm1 // keyB - aesenc %xmm1, iv - movups 192(ctx), %xmm1 // keyC - aesenc %xmm1, iv - movups 208(ctx), %xmm1 // keyD - aesenc %xmm1, iv - movups 224(ctx), %xmm1 // keyE - aesenclast %xmm1, iv -#endif - - movups iv, (obuf) // *obuf = *iv; - add $16, ibuf // ibuf++ - add $16, obuf // obuf++ - - sub $1, num_blk // num_blk -- - jg 0b // if num_blk > 0, repeat the loop - - jmp L_HW_cbc_done // share with the common exit code - - - - // - // --------- END of aesedp_encrypt_cbc_hw ------------------- - // - - -/* ---------------------------------------------------------------------------------------------------------------- - - aes_decrypt_cbc function (see aes_modes.c or aes_modes_asm.s) : - - For simplicity, I am assuming all variables are in 128-bit data type. - - aes_rval aes_decrypt_cbc(const __m128 *ibuf, __m128 *iv, int num_blk, __m128 *obuf, const aes_decrypt_ctx *ctx) - { - while(num_blk--) { - aes_decrypt(ibuf, obuf, ctx); - *obuf++ ^= *iv; - *iv = *ibuf++; - } - return 0; - } - - The following is an implementation of this function using Intel AESNI. - This function _aesedp_decrypt_cbc_hw SHOULD NOT be called directly. - Developer should still call _aes_decrypt_cbc (in aes_modes_asm.s) which will poll cpu_capabilities and branch - to this aesni-based function should it detecs that aesni is available. - Blindly call this function SURELY will cause a CRASH on systems with no aesni support. - - Note that the decryption operation is not related over blocks. - This gives opportunity of arranging aes_decrypt operations in parallel to speed up code. - This is equivalent to what has been described in the Intel AES Instruction Set White Paper (Rev. 2.0 page 53-55) - The following assembly code exploits this idea to achieve ~ 1.4 speed up in aes_decrypt_cbc. - - Example C code for packing 4 blocks in an iteration is shown as follows: - - while ((num_blk-=4)>=0) { - - // the following 4 functions can be interleaved to exploit parallelism - aes_decrypt(ibuf, obuf, ctx); - aes_decrypt(ibuf+1, obuf+1, ctx); - aes_decrypt(ibuf+2, obuf+2, ctx); - aes_decrypt(ibuf+3, obuf+3, ctx); - - obuf[0] ^= *iv; obuf[1] ^= ibuf[1]; obuf[2] ^= ibuf[1]; obuf[3] ^= ibuf[2]; - *iv = ibuf[3]; ibuf += 4; obuf += 4; - } - num_blk+=4; - - ----------------------------------------------------------------------------------------------------------------*/ - - .text - .align 4,0x90 - .globl _aesedp_decrypt_cbc_hw -_aesedp_decrypt_cbc_hw: - - // push/save registers for local use -#if defined __i386__ - - push %ebp - movl %esp, %ebp - push %ebx // ibuf - push %edi // obuf - - #define sp %esp - -#else // __x86_64__ - - push %rbp - mov %rsp, %rbp - push %rbx - push %r13 - push %r14 - push %r15 - - #define sp %rsp - -#endif - - - // if kernel, allocate stack space to save xmm registers -#ifdef KERNEL -#if defined __i386__ - sub $(8*16), %esp -#else - sub $(16*16), %rsp -#endif - movaps %xmm0, (sp) - movaps %xmm1, 16(sp) - movaps %xmm2, 32(sp) - movaps %xmm3, 48(sp) - movaps %xmm4, 64(sp) - movaps %xmm5, 80(sp) - movaps %xmm6, 96(sp) - movaps %xmm7, 112(sp) -#if defined __x86_64__ - movaps %xmm8, 16*8(sp) - movaps %xmm9, 16*9(sp) - movaps %xmm10, 16*10(sp) - movaps %xmm11, 16*11(sp) - movaps %xmm12, 16*12(sp) - movaps %xmm13, 16*13(sp) - movaps %xmm14, 16*14(sp) - movaps %xmm15, 16*15(sp) -#endif // __x86_64__ -#endif - - #undef iv - #define iv %xmm0 - -#if defined __i386__ - mov 12(%ebp), %eax // &iv[0] - mov 24(%ebp), %edx // ctx - movups (%eax), iv // iv = in_iv - mov 8(%ebp), %ebx // ibuf - mov 16(%ebp), %ecx // num_blk - mov 20(%ebp), %edi // obuf - - #define ibuf %ebx - #define obuf %edi - #define num_blk %ecx - #define ctx %edx - -#else // __x86_64__, rdi/rsi/rdx/rcx/r8 - - mov %rdi, %rbx // ibuf - movups (%rsi), iv // iv = in_iv - mov %rdx, %r13 // num_blk - mov %rcx, %r14 // obuf - mov %r8, %r15 // ctx - - #define ibuf %rbx - #define num_blk %r13d - #define obuf %r14 - #define ctx %r15 - -#endif - - mov 240(ctx), %eax // aes length - cmp $160, %eax // aes-128 decrypt - je L_decrypt_128 - cmp $192, %eax // aes-192 decrypt - je L_decrypt_192 - cmp $224, %eax // aes-256 decrypt - je L_decrypt_256 - - mov $-1, %eax // wrong aes length, to return -1 - jmp L_error // early exit due to wrong aes length - - - // - // aes-128 decrypt_cbc operation, after completion, branch to L_HW_cbc_done - // - -L_decrypt_128: - - cmp $1, num_blk - jl L_HW_cbc_done // if num_blk < 1, early return - - // aes-128 decrypt expanded keys - movups 160(ctx), %xmm3 - movups 144(ctx), %xmm4 - movups 128(ctx), %xmm5 - movups 112(ctx), %xmm6 - movups 96(ctx), %xmm7 -#if defined __x86_64__ - movups 80(ctx), %xmm8 - movups 64(ctx), %xmm9 - movups 48(ctx), %xmm10 - movups 32(ctx), %xmm11 - movups 16(ctx), %xmm12 - movups 0(ctx), %xmm13 -#endif - - // performs 4 block decryption in an iteration to exploit decrypt in parallel - - // while ((num_blk-=4)>=0) { - // aes_decrypt(ibuf, obuf, ctx); - // aes_decrypt(ibuf+1, obuf+1, ctx); - // aes_decrypt(ibuf+2, obuf+2, ctx); - // aes_decrypt(ibuf+3, obuf+3, ctx); - // obuf[0] ^= *iv; obuf[1] ^= ibuf[1]; obuf[2] ^= ibuf[1]; obuf[3] ^= ibuf[2]; - // *iv = ibuf[3]; ibuf += 4; obuf += 4; - // } - - sub $4, num_blk // pre decrement num_blk by 4 - jl 9f // if num_blk < 4, skip the per-4-blocks processing code - -0: - - -#if defined __x86_64__ - - movups (ibuf), %xmm1 // tmp = 1st ibuf - movups 16(ibuf), %xmm2 // tmp = 2nd ibuf - movups 32(ibuf), %xmm14 // tmp = 3rd ibuf - movups 48(ibuf), %xmm15 // tmp = 4th ibuf - - // for x86_64, the expanded keys are already stored in xmm3-xmm13 - - // aes-128 decrypt round 0 per 4 blocks - pxor %xmm3, %xmm1 - pxor %xmm3, %xmm2 - pxor %xmm3, %xmm14 - pxor %xmm3, %xmm15 - - // aes-128 decrypt round 1 per 4 blocks - aesdec %xmm4, %xmm1 - aesdec %xmm4, %xmm2 - aesdec %xmm4, %xmm14 - aesdec %xmm4, %xmm15 - - // aes-128 decrypt round 2 per 4 blocks - aesdec %xmm5, %xmm1 - aesdec %xmm5, %xmm2 - aesdec %xmm5, %xmm14 - aesdec %xmm5, %xmm15 - - // aes-128 decrypt round 3 per 4 blocks - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm14 - aesdec %xmm6, %xmm15 - - // aes-128 decrypt round 4 per 4 blocks - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm14 - aesdec %xmm7, %xmm15 - - // aes-128 decrypt round 5 per 4 blocks - aesdec %xmm8, %xmm1 - aesdec %xmm8, %xmm2 - aesdec %xmm8, %xmm14 - aesdec %xmm8, %xmm15 - - // aes-128 decrypt round 6 per 4 blocks - aesdec %xmm9, %xmm1 - aesdec %xmm9, %xmm2 - aesdec %xmm9, %xmm14 - aesdec %xmm9, %xmm15 - - // aes-128 decrypt round 7 per 4 blocks - aesdec %xmm10, %xmm1 - aesdec %xmm10, %xmm2 - aesdec %xmm10, %xmm14 - aesdec %xmm10, %xmm15 - - // aes-128 decrypt round 8 per 4 blocks - aesdec %xmm11, %xmm1 - aesdec %xmm11, %xmm2 - aesdec %xmm11, %xmm14 - aesdec %xmm11, %xmm15 - - // aes-128 decrypt round 9 per 4 blocks - aesdec %xmm12, %xmm1 - aesdec %xmm12, %xmm2 - aesdec %xmm12, %xmm14 - aesdec %xmm12, %xmm15 - - // aes-128 decrypt round 10 (last) per 4 blocks - aesdeclast %xmm13, %xmm1 - aesdeclast %xmm13, %xmm2 - aesdeclast %xmm13, %xmm14 - aesdeclast %xmm13, %xmm15 - - pxor iv, %xmm1 // obuf[0] ^= *iv; - movups (ibuf), iv // ibuf[0] - pxor iv, %xmm2 // obuf[1] ^= ibuf[0]; - movups 16(ibuf), iv // ibuf[1] - pxor iv, %xmm14 // obuf[2] ^= ibuf[1]; - movups 32(ibuf), iv // ibuf[2] - pxor iv, %xmm15 // obuf[3] ^= obuf[2]; - movups 48(ibuf), iv // *iv = ibuf[3] - - movups %xmm1, (obuf) // write 1st obuf - movups %xmm2, 16(obuf) // write 2nd obuf - movups %xmm14, 32(obuf) // write 3rd obuf - movups %xmm15, 48(obuf) // write 4th obuf - - -#else - - // aes_decrypt_cbc per 4 blocks using aes-128 for i386 - // xmm1/xmm2/xmm4/xmm5 used for obuf per block - // xmm3 = key0 - // xmm0 = iv - // xmm6/xmm7 dynamically load with other expanded keys - - movups (ibuf), %xmm1 // tmp = 1st ibuf - movups 16(ibuf), %xmm2 // tmp = 2nd ibuf - movups 32(ibuf), %xmm4 // tmp = 3rd ibuf - movups 48(ibuf), %xmm5 // tmp = 4th ibuf - - // aes_decrypt - // for i386, sequentially load expanded keys into xmm6/xmm7 - - movups 144(ctx), %xmm6 // key1 - - // aes-128 decrypt round 0 per 4 blocks - pxor %xmm3, %xmm1 - pxor %xmm3, %xmm2 - pxor %xmm3, %xmm4 - pxor %xmm3, %xmm5 - - movups 128(ctx), %xmm7 // key2 - - // aes-128 decrypt round 1 per 4 blocks - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 112(ctx), %xmm6 // key3 - - // aes-128 decrypt round 2 per 4 blocks - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 96(ctx), %xmm7 // key4 - - // aes-128 decrypt round 3 per 4 blocks - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 80(ctx), %xmm6 // key5 - - // aes-128 decrypt round 4 per 4 blocks - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 64(ctx), %xmm7 // key6 - - // aes-128 decrypt round 5 per 4 blocks - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 48(ctx), %xmm6 // key7 - - // aes-128 decrypt round 6 per 4 blocks - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 32(ctx), %xmm7 // key8 - - // aes-128 decrypt round 7 per 4 blocks - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 16(ctx), %xmm6 // key9 - - // aes-128 decrypt round 8 per 4 blocks - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 0(ctx), %xmm7 // keyA - - // aes-128 decrypt round 9 per 4 blocks - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - // aes-128 decrypt round 10 (last) per 4 blocks - aesdeclast %xmm7, %xmm1 - aesdeclast %xmm7, %xmm2 - aesdeclast %xmm7, %xmm4 - aesdeclast %xmm7, %xmm5 - - pxor iv, %xmm1 // 1st obuf ^= iv; - movups (ibuf), iv // 1st memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm2 // 2nd obuf ^= iv; - movups 16(ibuf), iv // 2nd memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm4 // 3rd obuf ^= iv; - movups 32(ibuf), iv // 3rd memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm5 // 4th obuf ^= iv; - movups 48(ibuf), iv // 4th memcpy(iv, tmp, AES_BLOCK_SIZE); - - movups %xmm1, (obuf) // write 1st obuf - movups %xmm2, 16(obuf) // write 2nd obuf - movups %xmm4, 32(obuf) // write 3rd obuf - movups %xmm5, 48(obuf) // write 4th obuf -#endif - - add $64, ibuf // ibuf += 4; - add $64, obuf // obuf += 4; - - sub $4, num_blk // num_blk -= 4 - jge 0b // if num_blk > 0, repeat the loop - -9: add $4, num_blk // post incremtn num_blk by 4 - je L_HW_cbc_done // if num_blk == 0, no need for forthur processing code - -#if defined __i386__ - // updated as they might be needed as expanded keys in the remaining - movups 144(ctx), %xmm4 - movups 128(ctx), %xmm5 - movups 112(ctx), %xmm6 - movups 96(ctx), %xmm7 -#endif - - test $2, num_blk // check whether num_blk has 2 blocks - je 9f // if num_blk & 2 == 0, skip the per-pair processing code - - // do the remaining 2 blocks together - - movups (ibuf), %xmm1 // tmp = 1st ibuf - movups 16(ibuf), %xmm2 // tmp = 2nd ibuf - - // aes_decrypt - pxor %xmm3, %xmm1 - pxor %xmm3, %xmm2 - aesdec %xmm4, %xmm1 - aesdec %xmm4, %xmm2 - aesdec %xmm5, %xmm1 - aesdec %xmm5, %xmm2 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 -#if defined __x86_64__ - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm8, %xmm1 - aesdec %xmm8, %xmm2 - aesdec %xmm9, %xmm1 - aesdec %xmm9, %xmm2 - aesdec %xmm10, %xmm1 - aesdec %xmm10, %xmm2 - aesdec %xmm11, %xmm1 - aesdec %xmm11, %xmm2 - aesdec %xmm12, %xmm1 - aesdec %xmm12, %xmm2 - aesdeclast %xmm13, %xmm1 - aesdeclast %xmm13, %xmm2 -#else - movups 80(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - movups 64(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - movups 48(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - movups 32(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - movups 16(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - movups 0(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdeclast %xmm7, %xmm1 - aesdeclast %xmm7, %xmm2 - movups 112(ctx), %xmm6 - movups 96(ctx), %xmm7 -#endif - - pxor iv, %xmm1 // obuf[0] ^= *iv; - movups (ibuf), iv // ibuf[0] - pxor iv, %xmm2 // obuf[1] ^= ibuf[0] - movups 16(ibuf), iv // *iv = ibuf[1] - - movups %xmm1, (obuf) // write obuf[0] - movups %xmm2, 16(obuf) // write obuf[1] - - add $32, ibuf // ibuf += 2 - add $32, obuf // obuf += 2 - -9: - test $1, num_blk // check whether num_blk has residual 1 block - je L_HW_cbc_done // if num_blk == 0, no need for residual processing code - - movups (ibuf), %xmm2 // tmp = ibuf - // aes_decrypt - pxor %xmm3, %xmm2 - aesdec %xmm4, %xmm2 - aesdec %xmm5, %xmm2 - aesdec %xmm6, %xmm2 - aesdec %xmm7, %xmm2 -#if defined __x86_64__ - aesdec %xmm8, %xmm2 - aesdec %xmm9, %xmm2 - aesdec %xmm10, %xmm2 - aesdec %xmm11, %xmm2 - aesdec %xmm12, %xmm2 - aesdeclast %xmm13, %xmm2 -#else - movups 80(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 64(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 48(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 32(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 16(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups (ctx), %xmm1 - aesdeclast %xmm1, %xmm2 -#endif - - pxor iv, %xmm2 // *obuf ^= *iv; - movups (ibuf), iv // *iv = *ibuf; - movups %xmm2, (obuf) // write *obuf - - jmp L_HW_cbc_done - - // - // aes-192 decrypt_cbc operation, after completion, branch to L_HW_cbc_done - // - -L_decrypt_192: - - cmp $1, num_blk - jl L_HW_cbc_done // if num_blk < 1, early return - - // aes-192 decryp expanded keys - movups 192(ctx), %xmm3 - movups 176(ctx), %xmm4 - movups 160(ctx), %xmm5 - movups 144(ctx), %xmm6 - movups 128(ctx), %xmm7 -#if defined __x86_64__ - movups 112(ctx), %xmm8 - movups 96(ctx), %xmm9 - movups 80(ctx), %xmm10 - movups 64(ctx), %xmm11 - movups 48(ctx), %xmm12 - movups 32(ctx), %xmm13 - movups 16(ctx), %xmm14 - movups (ctx), %xmm15 -#endif - - // performs 4 block decryption in an iteration to exploit decrypt in parallel - - // while ((num_blk-=4)>=0) { - // aes_decrypt(ibuf, obuf, ctx); - // aes_decrypt(ibuf+1, obuf+1, ctx); - // aes_decrypt(ibuf+2, obuf+2, ctx); - // aes_decrypt(ibuf+3, obuf+3, ctx); - // obuf[0] ^= *iv; obuf[1] ^= ibuf[1]; obuf[2] ^= ibuf[1]; obuf[3] ^= ibuf[2]; - // *iv = ibuf[3]; ibuf += 4; obuf += 4; - // } - - sub $4, num_blk // pre decrement num_blk by 4 - jl 9f // if num_blk < 4, skip the per-4-blocks processing code -0: - -#if defined __x86_64__ - - movups (ibuf), %xmm1 // tmp = 1st ibuf - movups 16(ibuf), %xmm2 // tmp = 2nd ibuf - movups 32(ibuf), %xmm14 // tmp = 3rd ibuf - movups 48(ibuf), %xmm15 // tmp = 4th ibuf - - // aes_decrypt, for x86_64, the expanded keys are already stored in xmm3-xmm13 - // use %xmm12/%xmm13 ts dynamic keys in the middle, restored afterwards - - // round 0 for 4 blocks - pxor %xmm3, %xmm1 - pxor %xmm3, %xmm2 - pxor %xmm3, %xmm14 - pxor %xmm3, %xmm15 - - // round 1 for 4 blocks - aesdec %xmm4, %xmm1 - aesdec %xmm4, %xmm2 - aesdec %xmm4, %xmm14 - aesdec %xmm4, %xmm15 - - // round 2 for 4 blocks - aesdec %xmm5, %xmm1 - aesdec %xmm5, %xmm2 - aesdec %xmm5, %xmm14 - aesdec %xmm5, %xmm15 - - // round 3 for 4 blocks - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm14 - aesdec %xmm6, %xmm15 - - // round 4 for 4 blocks - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm14 - aesdec %xmm7, %xmm15 - - // round 5 for 4 blocks - aesdec %xmm8, %xmm1 - aesdec %xmm8, %xmm2 - aesdec %xmm8, %xmm14 - aesdec %xmm8, %xmm15 - - // round 6 for 4 blocks - aesdec %xmm9, %xmm1 - aesdec %xmm9, %xmm2 - aesdec %xmm9, %xmm14 - aesdec %xmm9, %xmm15 - - // round 7 for 4 blocks - aesdec %xmm10, %xmm1 - aesdec %xmm10, %xmm2 - aesdec %xmm10, %xmm14 - aesdec %xmm10, %xmm15 - - // round 8 for 4 blocks - aesdec %xmm11, %xmm1 - aesdec %xmm11, %xmm2 - aesdec %xmm11, %xmm14 - aesdec %xmm11, %xmm15 - - // round 9 for 4 blocks - aesdec %xmm12, %xmm1 - aesdec %xmm12, %xmm2 - aesdec %xmm12, %xmm14 - aesdec %xmm12, %xmm15 - - movups 16(ctx), %xmm12 - - // round A for 4 blocks - aesdec %xmm13, %xmm1 - aesdec %xmm13, %xmm2 - aesdec %xmm13, %xmm14 - aesdec %xmm13, %xmm15 - - movups (ctx), %xmm13 - - // round B for 4 blocks - aesdec %xmm12, %xmm1 - aesdec %xmm12, %xmm2 - aesdec %xmm12, %xmm14 - aesdec %xmm12, %xmm15 - - movups 48(ctx), %xmm12 // restore %xmm12 to its original key - - // round C (last) for 4 blocks - aesdeclast %xmm13, %xmm1 - aesdeclast %xmm13, %xmm2 - aesdeclast %xmm13, %xmm14 - aesdeclast %xmm13, %xmm15 - - movups 32(ctx), %xmm13 // restore %xmm13 to its original key - - pxor iv, %xmm1 // obuf[0] ^= *iv; - movups (ibuf), iv // ibuf[0] - pxor iv, %xmm2 // obuf[1] ^= ibuf[0] - movups 16(ibuf), iv // ibuf[1] - pxor iv, %xmm14 // obuf[2] ^= ibuf[1] - movups 32(ibuf), iv // ibuf[2] - pxor iv, %xmm15 // obuf[3] ^= ibuf[2] - movups 48(ibuf), iv // *iv = ibuf[3] - - movups %xmm1, (obuf) // write 1st obuf - movups %xmm2, 16(obuf) // write 2nd obuf - movups %xmm14, 32(obuf) // write 3rd obuf - movups %xmm15, 48(obuf) // write 4th obuf - - add $64, ibuf // ibuf += 4; - add $64, obuf // obuf += 4; - - sub $4, num_blk // num_blk -= 4 - jge 0b // if num_blk > 0, repeat the loop - -9: add $4, num_blk // post incremtn num_blk by 4 - je L_HW_cbc_done // if num_blk == 0, prepare to return - - movups 16(ctx), %xmm14 // restore %xmm14 to its key - movups (ctx), %xmm15 // restore %xmm15 to its key - -#else - - movups (ibuf), %xmm1 // tmp = 1st ibuf - movups 16(ibuf), %xmm2 // tmp = 2nd ibuf - movups 32(ibuf), %xmm4 // tmp = 3rd ibuf - movups 48(ibuf), %xmm5 // tmp = 4th ibuf - - // aes_decrypt - // for i386, sequentially load expanded keys into xmm6/xmm7 - movups 176(ctx), %xmm6 - pxor %xmm3, %xmm1 - pxor %xmm3, %xmm2 - pxor %xmm3, %xmm4 - pxor %xmm3, %xmm5 - - movups 160(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 144(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 128(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 112(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 96(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 80(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 64(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 48(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 32(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 16(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 0(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - aesdeclast %xmm7, %xmm1 - aesdeclast %xmm7, %xmm2 - aesdeclast %xmm7, %xmm4 - aesdeclast %xmm7, %xmm5 - - pxor iv, %xmm1 // 1st obuf ^= iv; - movups (ibuf), iv // 1st memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm2 // 2nd obuf ^= iv; - movups 16(ibuf), iv // 2nd memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm4 // 3rd obuf ^= iv; - movups 32(ibuf), iv // 3rd memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm5 // 4th obuf ^= iv; - movups 48(ibuf), iv // 4th memcpy(iv, tmp, AES_BLOCK_SIZE); - movups %xmm1, (obuf) // write 1st obuf - movups %xmm2, 16(obuf) // write 2nd obuf - movups %xmm4, 32(obuf) // write 3rd obuf - movups %xmm5, 48(obuf) // write 4th obuf - - add $64, ibuf // ibuf += AES_BLOCK_SIZE * 4; - add $64, obuf // obuf += AES_BLOCK_SIZE * 4; - - sub $4, num_blk // num_blk -= 4 - jge 0b // if num_blk > 0, repeat the loop - - -9: add $4, num_blk // post incremtn num_blk by 4 - je L_HW_cbc_done // if num_blk == 0, no need for forthur processing code - - movups 176(ctx), %xmm4 - movups 160(ctx), %xmm5 - movups 144(ctx), %xmm6 - movups 128(ctx), %xmm7 - -#endif - - // per-block aes_decrypt_cbc loop - -0: - movups (ibuf), %xmm2 // tmp = ibuf - - // aes_decrypt - pxor %xmm3, %xmm2 - aesdec %xmm4, %xmm2 - aesdec %xmm5, %xmm2 - aesdec %xmm6, %xmm2 - aesdec %xmm7, %xmm2 -#if defined __x86_64__ - aesdec %xmm8, %xmm2 - aesdec %xmm9, %xmm2 - aesdec %xmm10, %xmm2 - aesdec %xmm11, %xmm2 - aesdec %xmm12, %xmm2 - aesdec %xmm13, %xmm2 - aesdec %xmm14, %xmm2 - aesdeclast %xmm15, %xmm2 -#else - movups 112(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 96(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 80(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 64(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 48(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 32(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 16(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups (ctx), %xmm1 - aesdeclast %xmm1, %xmm2 -#endif - - pxor iv, %xmm2 // obuf ^= iv; - movups (ibuf), iv // memcpy(iv, tmp, AES_BLOCK_SIZE); - - movups %xmm2, (obuf) // write obuf - - add $16, ibuf // ibuf += AES_BLOCK_SIZE; - add $16, obuf // obuf += AES_BLOCK_SIZE; - sub $1, num_blk // num_blk -- - jg 0b // if num_blk > 0, repeat the loop - - jmp L_HW_cbc_done - - // - // aes-256 decrypt_cbc operation, after completion, branch to L_HW_cbc_done - // - -L_decrypt_256: - - cmp $1, num_blk - jl L_HW_cbc_done - - movups 224(ctx), %xmm3 - movups 208(ctx), %xmm4 - movups 192(ctx), %xmm5 - movups 176(ctx), %xmm6 - movups 160(ctx), %xmm7 -#if defined __x86_64__ - movups 144(ctx), %xmm8 - movups 128(ctx), %xmm9 - movups 112(ctx), %xmm10 - movups 96(ctx), %xmm11 - movups 80(ctx), %xmm12 - movups 64(ctx), %xmm13 - movups 48(ctx), %xmm14 - movups 32(ctx), %xmm15 -// movups 16(ctx), %xmm14 -// movups (ctx), %xmm15 -#endif - -#if defined __x86_64__ - - sub $4, num_blk // pre decrement num_blk by 4 - jl 9f // if num_blk < 4, skip the per-4-blocks processing code -0: - movups (ibuf), %xmm1 // tmp = 1st ibuf - movups 16(ibuf), %xmm2 // tmp = 2nd ibuf - movups 32(ibuf), %xmm14 // tmp = 3rd ibuf - movups 48(ibuf), %xmm15 // tmp = 4th ibuf - - // aes_decrypt, for x86_64, the expanded keys are already stored in xmm3-xmm13 - pxor %xmm3, %xmm1 - pxor %xmm3, %xmm2 - pxor %xmm3, %xmm14 - pxor %xmm3, %xmm15 - - aesdec %xmm4, %xmm1 - aesdec %xmm4, %xmm2 - aesdec %xmm4, %xmm14 - aesdec %xmm4, %xmm15 - - aesdec %xmm5, %xmm1 - aesdec %xmm5, %xmm2 - aesdec %xmm5, %xmm14 - aesdec %xmm5, %xmm15 - - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm14 - aesdec %xmm6, %xmm15 - - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm14 - aesdec %xmm7, %xmm15 - - aesdec %xmm8, %xmm1 - aesdec %xmm8, %xmm2 - aesdec %xmm8, %xmm14 - aesdec %xmm8, %xmm15 - - aesdec %xmm9, %xmm1 - aesdec %xmm9, %xmm2 - aesdec %xmm9, %xmm14 - aesdec %xmm9, %xmm15 - - aesdec %xmm10, %xmm1 - aesdec %xmm10, %xmm2 - aesdec %xmm10, %xmm14 - aesdec %xmm10, %xmm15 - - aesdec %xmm11, %xmm1 - aesdec %xmm11, %xmm2 - aesdec %xmm11, %xmm14 - aesdec %xmm11, %xmm15 - - aesdec %xmm12, %xmm1 - aesdec %xmm12, %xmm2 - aesdec %xmm12, %xmm14 - aesdec %xmm12, %xmm15 - movups 48(ctx), %xmm12 - - aesdec %xmm13, %xmm1 - aesdec %xmm13, %xmm2 - aesdec %xmm13, %xmm14 - aesdec %xmm13, %xmm15 - movups 32(ctx), %xmm13 - - aesdec %xmm12, %xmm1 - aesdec %xmm12, %xmm2 - aesdec %xmm12, %xmm14 - aesdec %xmm12, %xmm15 - movups 16(ctx), %xmm12 - - aesdec %xmm13, %xmm1 - aesdec %xmm13, %xmm2 - aesdec %xmm13, %xmm14 - aesdec %xmm13, %xmm15 - movups (ctx), %xmm13 - - aesdec %xmm12, %xmm1 - aesdec %xmm12, %xmm2 - aesdec %xmm12, %xmm14 - aesdec %xmm12, %xmm15 - movups 80(ctx), %xmm12 - - aesdeclast %xmm13, %xmm1 - aesdeclast %xmm13, %xmm2 - aesdeclast %xmm13, %xmm14 - aesdeclast %xmm13, %xmm15 - movups 64(ctx), %xmm13 - - pxor iv, %xmm1 // obuf ^= iv; - movups (ibuf), iv // memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm2 // obuf ^= iv; - movups 16(ibuf), iv // memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm14 // obuf ^= iv; - movups 32(ibuf), iv // memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm15 // obuf ^= iv; - movups 48(ibuf), iv // memcpy(iv, tmp, AES_BLOCK_SIZE); - - movups %xmm1, (obuf) // write 1st obuf - movups %xmm2, 16(obuf) // write 2nd obuf - movups %xmm14, 32(obuf) // write 3rd obuf - movups %xmm15, 48(obuf) // write 4th obuf - - add $64, ibuf // ibuf += AES_BLOCK_SIZE*4; - add $64, obuf // obuf += AES_BLOCK_SIZE*4; - - sub $4, num_blk // num_blk -= 4 - jge 0b // if num_blk > 0, repeat the loop - -9: add $4, num_blk // post incremtn num_blk by 4 - je L_HW_cbc_done // if num_blk == 0, no need for forthur processing code - - movups 48(ctx), %xmm14 - movups 32(ctx), %xmm15 - -#else - - sub $4, num_blk // pre decrement num_blk by 4 - jl 9f // if num_blk < 4, skip the per-pair processing code -0: - movups (ibuf), %xmm1 // tmp = 1st ibuf - movups 16(ibuf), %xmm2 // tmp = 2nd ibuf - movups 32(ibuf), %xmm4 // tmp = 3rd ibuf - movups 48(ibuf), %xmm5 // tmp = 4th ibuf - - // aes_decrypt - // for i386, sequentially load expanded keys into xmm6/xmm7 - movups 208(ctx), %xmm6 - pxor %xmm3, %xmm1 - pxor %xmm3, %xmm2 - pxor %xmm3, %xmm4 - pxor %xmm3, %xmm5 - - movups 192(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 176(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 160(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 144(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 128(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 112(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 96(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 80(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 64(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 48(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 32(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - movups 16(ctx), %xmm6 - aesdec %xmm7, %xmm1 - aesdec %xmm7, %xmm2 - aesdec %xmm7, %xmm4 - aesdec %xmm7, %xmm5 - - movups 0(ctx), %xmm7 - aesdec %xmm6, %xmm1 - aesdec %xmm6, %xmm2 - aesdec %xmm6, %xmm4 - aesdec %xmm6, %xmm5 - - aesdeclast %xmm7, %xmm1 - aesdeclast %xmm7, %xmm2 - aesdeclast %xmm7, %xmm4 - aesdeclast %xmm7, %xmm5 - - pxor iv, %xmm1 // 1st obuf ^= iv; - movups (ibuf), iv // 1st memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm2 // 2nd obuf ^= iv; - movups 16(ibuf), iv // 2nd memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm4 // 3rd obuf ^= iv; - movups 32(ibuf), iv // 3rd memcpy(iv, tmp, AES_BLOCK_SIZE); - pxor iv, %xmm5 // 4th obuf ^= iv; - movups 48(ibuf), iv // 4th memcpy(iv, tmp, AES_BLOCK_SIZE); - movups %xmm1, (obuf) // write 1st obuf - movups %xmm2, 16(obuf) // write 2nd obuf - movups %xmm4, 32(obuf) // write 3rd obuf - movups %xmm5, 48(obuf) // write 4th obuf - - add $64, ibuf // ibuf += AES_BLOCK_SIZE * 4; - add $64, obuf // obuf += AES_BLOCK_SIZE * 4; - - sub $4, num_blk // num_blk -= 4 - jge 0b // if num_blk > 0, repeat the loop - - -9: add $4, num_blk // post incremtn num_blk by 4 - je L_HW_cbc_done // if num_blk == 0, no need for forthur processing code - - movups 208(ctx), %xmm4 - movups 192(ctx), %xmm5 - movups 176(ctx), %xmm6 - movups 160(ctx), %xmm7 - -#endif - -0: - movups (ibuf), %xmm2 // tmp = ibuf - - // aes_decrypt - pxor %xmm3, %xmm2 - aesdec %xmm4, %xmm2 - aesdec %xmm5, %xmm2 - aesdec %xmm6, %xmm2 - aesdec %xmm7, %xmm2 -#if defined __x86_64__ - aesdec %xmm8, %xmm2 - aesdec %xmm9, %xmm2 - aesdec %xmm10, %xmm2 - aesdec %xmm11, %xmm2 - aesdec %xmm12, %xmm2 - aesdec %xmm13, %xmm2 - aesdec %xmm14, %xmm2 - aesdec %xmm15, %xmm2 -#else - movups 144(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 128(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 112(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 96(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 80(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 64(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 48(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups 32(ctx), %xmm1 - aesdec %xmm1, %xmm2 -#endif - movups 16(ctx), %xmm1 - aesdec %xmm1, %xmm2 - movups (ctx), %xmm1 - aesdeclast %xmm1, %xmm2 - - pxor iv, %xmm2 // obuf ^= iv; - movups (ibuf), iv // memcpy(iv, tmp, AES_BLOCK_SIZE); - - movups %xmm2, (obuf) // write obuf - - add $16, ibuf // ibuf += AES_BLOCK_SIZE; - add $16, obuf // obuf += AES_BLOCK_SIZE; - sub $1, num_blk // num_blk -- - jg 0b // if num_blk > 0, repeat the loop - - jmp L_HW_cbc_done - - // - // --------- END of aesedp_decrypt_cbc_hw ------------------- - // -#endif /* x86 based build */ DELETED Source/libtomcrypt/src/ciphers/aesedpport/aesedp.c Index: Source/libtomcrypt/src/ciphers/aesedpport/aesedp.c ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/aesedp.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * aesedp.c - * MacTomCrypt - * - * InfoSec Standard Configuration - * Copyright 2010 Apple Inc. All rights reserved. - * - */ - - -#include "tomcrypt.h" -#include "aesedpPriv.h" -#include "aesxts.h" -#include "ccdebug.h" -const struct ltc_cipher_descriptor aesedp_desc = -{ - "aesedp", // Name - 65, // Internal ID - 16, 32, 16, 10, // Min KeySize, Max Keysize, Block Size, Rounds - aesedp_setup, aesedp_ecb_encrypt, aesedp_ecb_decrypt, aesedp_test, aesedp_done, aesedp_keysize, - /* ECB Accelerators */ - NULL, NULL, - /* CBC Accelerators */ -#if defined (__i386__) || defined (__x86_64__) - aesedp_cbc_encrypt, aesedp_cbc_decrypt, -#else - NULL, NULL, -#endif - /* CTR Accelerator */ - NULL, - /* LRW Accelerators */ - NULL, NULL, -#if defined (__i386__) || defined (__x86_64__) - /* XTS Accelerators */ - aesxts_encrypt, aesxts_decrypt, -#else - NULL, NULL, -#endif - /* CCM Accelerator */ - NULL, - /* GCM Accelerator */ - NULL, - /* OMAC Accelerator */ - NULL, - /* XCBC Accelerator */ - NULL, - /* F9 Accelerator */ - NULL -}; - - -int -aesedp_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -{ -#if defined (__i386__) || defined (__x86_64__) - - aesedp_ctx *ctx = &skey->aesedp; - int retval; - - if((retval = aesedp_keysize(&keylen)) != CRYPT_OK) return retval; - - if((retval = aes_encrypt_key(key, keylen, &ctx->encrypt)) != CRYPT_OK) return CRYPT_ERROR; - if((retval = aes_decrypt_key(key, keylen, &ctx->decrypt)) != CRYPT_OK) return CRYPT_ERROR; - return CRYPT_OK; - -#else - return CRYPT_UNIMPLEMENTED; -#endif -} - - -int -aesedp_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -{ -#if defined (__i386__) || defined (__x86_64__) - - aesedp_ctx *ctx = &skey->aesedp; - return aes_encrypt(pt, ct, &ctx->encrypt); - -#else - return CRYPT_UNIMPLEMENTED; -#endif -} - - - -int -aesedp_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -{ -#if defined (__i386__) || defined (__x86_64__) - - aesedp_ctx *ctx = &skey->aesedp; - return aes_decrypt(ct, pt, &ctx->decrypt); - -#else - return CRYPT_UNIMPLEMENTED; -#endif -} - - - -int -aesedp_test(void) -{ -#if defined (__i386__) || defined (__x86_64__) - #ifndef LTC_TEST - return CRYPT_NOP; - #else - int err; - static const struct { - int keylen; - unsigned char key[32], pt[16], ct[16]; - } tests[] = { - { 16, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, - { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, - { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, - 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a } - }, { - 24, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 }, - { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, - { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, - 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 } - }, { - 32, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, - { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, - { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, - 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 } - } - }; - - symmetric_key key; - unsigned char tmp[2][16]; - int i, y; - - for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) { - zeromem(&key, sizeof(key)); - if ((err = aesedp_setup(tests[i].key, tests[i].keylen, 0, &key)) != CRYPT_OK) { - return err; - } - - aesedp_ecb_encrypt(tests[i].pt, tmp[0], &key); - aesedp_ecb_decrypt(tmp[0], tmp[1], &key); - if (XMEMCMP(tmp[0], tests[i].ct, 16) || XMEMCMP(tmp[1], tests[i].pt, 16)) { -#if 0 - printf("\n\nTest %d failed\n", i); - if (XMEMCMP(tmp[0], tests[i].ct, 16)) { - printf("CT: "); - for (i = 0; i < 16; i++) { - printf("%02x ", tmp[0][i]); - } - printf("\n"); - } else { - printf("PT: "); - for (i = 0; i < 16; i++) { - printf("%02x ", tmp[1][i]); - } - printf("\n"); - } -#endif - return CRYPT_FAIL_TESTVECTOR; - } - - /* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */ - for (y = 0; y < 16; y++) tmp[0][y] = 0; - for (y = 0; y < 1000; y++) aesedp_ecb_encrypt(tmp[0], tmp[0], &key); - for (y = 0; y < 1000; y++) aesedp_ecb_decrypt(tmp[0], tmp[0], &key); - for (y = 0; y < 16; y++) if (tmp[0][y] != 0) return CRYPT_FAIL_TESTVECTOR; - } - return CRYPT_OK; - #endif -#else - return CRYPT_UNIMPLEMENTED; -#endif - -} - - - -void -aesedp_done(symmetric_key *skey) -{ -} - - -int -aesedp_cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *iv, symmetric_key *skey) -{ - aesedp_ctx *ctx = &skey->aesedp; - return aesedp_encrypt_cbc((const unsigned char *) pt, (const unsigned char *) iv, blocks, ct, &ctx->encrypt); -} - -int -aesedp_cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long blocks, unsigned char *iv, symmetric_key *skey) -{ - aesedp_ctx *ctx = &skey->aesedp; - return aesedp_decrypt_cbc((const unsigned char *) ct, (const unsigned char *) iv, blocks, pt, &ctx->decrypt); -} - - -int -aesedp_keysize(int *keysize) -{ -#if defined (__i386__) || defined (__x86_64__) - switch (*keysize) { - case 16: - case 24: - case 32: - return CRYPT_OK; - default: - return CRYPT_INVALID_KEYSIZE; - } -#else - return CRYPT_UNIMPLEMENTED; -#endif -} - DELETED Source/libtomcrypt/src/ciphers/aesedpport/aesedp.h Index: Source/libtomcrypt/src/ciphers/aesedpport/aesedp.h ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/aesedp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * aesedp.h - * MacTomCrypt - * - * InfoSec Standard Configuration - * Copyright 2010 Apple Inc. All rights reserved. - * - */ - -#ifndef AESEDP_H_ -#define AESEDP_H_ -#if defined(__cplusplus) -extern "C" -{ -#endif - -#define KS_LENGTH 60 - -typedef struct { - ulong32 ks[KS_LENGTH]; - ulong32 rn; -} aesedp_encrypt_ctx; - -typedef struct { - ulong32 ks[KS_LENGTH]; - ulong32 rn; -} aesedp_decrypt_ctx; - -typedef struct { - aesedp_encrypt_ctx encrypt; - aesedp_decrypt_ctx decrypt; -} aesedp_ctx; - -#if defined(__cplusplus) -} -#endif -#endif /* AESEDP_H_ */ DELETED Source/libtomcrypt/src/ciphers/aesedpport/aesedpPriv.h Index: Source/libtomcrypt/src/ciphers/aesedpport/aesedpPriv.h ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/aesedpPriv.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * aesedpPriv.h - * MacTomCrypt - * - * InfoSec Standard Configuration - * Copyright 2010 Apple Inc. All rights reserved. - * - */ - -#ifndef AESEDPPRIV_H_ -#define AESEDPPRIV_H_ -#if defined(__cplusplus) -extern "C" -{ -#endif - -#include "aesedp.h" -// Assembly level interfaces for basic AES. - -int -aes_encrypt_key(const unsigned char *key, int key_len, aesedp_encrypt_ctx cx[1]); - -int -aes_decrypt_key(const unsigned char *key, int key_len, aesedp_decrypt_ctx cx[1]); - -int -aes_encrypt(const unsigned char *Plaintext, unsigned char *Ciphertext, aesedp_encrypt_ctx *ctx); - -int -aes_decrypt(const unsigned char *Ciphertext, unsigned char *Plaintext, aesedp_decrypt_ctx *ctx); - -extern int aesedp_decrypt_cbc(const unsigned char *ibuf, const unsigned char *in_iv, unsigned int num_blk, - unsigned char *obuf, const aesedp_encrypt_ctx cx[1]); -extern int aesedp_encrypt_cbc(const unsigned char *ibuf, const unsigned char *in_iv, unsigned int num_blk, - unsigned char *obuf, const aesedp_decrypt_ctx ctx[1]); - -// MURF ZZZ REMOVE -void AESEncryptCBC(void *Output, const void *Input, - void *ChainBuffer, void *Key, long Blocks, long Rounds); -void AESDecryptCBC(void *Output, const void *Input, - void *ChainBuffer, void *Key, long Blocks, long Rounds); - - -#if defined(__cplusplus) -} -#endif - -#endif /* AESEDPPRIV_H_ */ DELETED Source/libtomcrypt/src/ciphers/aesedpport/aesxts.c Index: Source/libtomcrypt/src/ciphers/aesedpport/aesxts.c ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/aesxts.c +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#include "aesxts.h" -#include -#include -#include -#include "aesedpPriv.h" - - -/** Start XTS mode - @param cipher The index of the cipher to use - @param key1 The encrypt key - @param key2 The tweak encrypt key - @param keylen The length of the keys (each) in octets - @param num_rounds The number of rounds for the cipher (0 == default) - @param xts [out] XTS structure - Returns CRYPT_OK upon success. - */ - -uint32_t -aesxts_start(uint32_t cipher, // ignored - we're doing this for xts-aes only - const uint8_t *IV __unused, // ignored - const uint8_t *key1, int keylen, - const uint8_t *key2, int tweaklen __unused, // both keys are the same size for xts - uint32_t num_rounds, // ignored - uint32_t options __unused, // ignored - symmetric_xts *xts) -{ - uint32_t err; - - /* check inputs */ - if((key1 == NULL)|| (key2 == NULL) || (xts == NULL)) return CRYPT_INVALID_ARG; - - /* schedule the two ciphers */ - if ((err = aesedp_setup(key1, keylen, num_rounds, &xts->key1)) != 0) { - return err; - } - if ((err = aesedp_setup(key2, keylen, num_rounds, &xts->key2)) != 0) { - return err; - } - xts->cipher = cipher; - - return err; -} - - - - -/** multiply by x - @param I The value to multiply by x (LFSR shift) - */ -#if defined __x86_64__ || defined __i386__ -extern void aesxts_mult_x(uint8_t *I); -#else -static void aesxts_mult_x(uint8_t *I) -{ - uint32_t x; - uint8_t t, tt; - - for (x = t = 0; x < 16; x++) { - tt = I[x] >> 7; - I[x] = ((I[x] << 1) | t) & 0xFF; - t = tt; - } - if (tt) { - I[0] ^= 0x87; - } -} -#endif - -#if defined __x86_64__ || defined __i386__ -extern int aesxts_tweak_crypt(const uint8_t *P, uint8_t *C, uint8_t *T, aesedp_encrypt_ctx *ctx); -/* extern */ int aesxts_tweak_crypt_group(const uint8_t *P, uint8_t *C, uint8_t *T, aesedp_encrypt_ctx *ctx, uint32_t lim); -#else -static int aesxts_tweak_crypt(const uint8_t *P, uint8_t *C, uint8_t *T, aesedp_encrypt_ctx *ctx) -{ - uint32_t x; - uint32_t err; - - /* tweak encrypt block i */ - for (x = 0; x < 16; x += sizeof(uint64_t)) { - *((uint64_t*)&C[x]) = *((uint64_t*)&P[x]) ^ *((uint64_t*)&T[x]); - } - - if ((err = aes_encrypt(C, C, ctx)) != CRYPT_OK) { - return CRYPT_INVALID_KEYSIZE; - } - - for (x = 0; x < 16; x += sizeof(uint64_t)) { - *((uint64_t*)&C[x]) ^= *((uint64_t*)&T[x]); - } - - /* LFSR the tweak */ - aesxts_mult_x(T); - - return CRYPT_OK; -} -#endif - -/** XTS Encryption - @param pt [in] Plaintext - @param ptlen Length of plaintext (and ciphertext) - @param ct [out] Ciphertext - @param tweak [in] The 128--bit encryption tweak (e.g. sector number) - @param xts The XTS structure - Returns CRYPT_OK upon success - */ - -int aesxts_encrypt( - const uint8_t *pt, unsigned long ptlen, - uint8_t *ct, - const uint8_t *tweak, - symmetric_xts *xts) -{ - aesedp_ctx *encKS = &xts->key1.aesedp; - aesedp_ctx *twkKS = &xts->key2.aesedp; - aesedp_encrypt_ctx *encrypt_ctx = &encKS->encrypt; - aesedp_encrypt_ctx *tweak_ctx = &twkKS->encrypt; - uint8_t PP[16], CC[16], T[16]; - uint64_t i, m, mo, lim; - uint64_t err; - - /* get number of blocks */ - m = ptlen >> 4; - mo = ptlen & 15; - - /* must have at least one full block */ - if (m == 0) { - return CRYPT_INVALID_ARG; - } - - /* encrypt the tweak */ - if ((err = aes_encrypt(tweak, T, tweak_ctx)) != 0) { - return CRYPT_INVALID_KEYSIZE; - } - - /* for i = 0 to m-2 do */ - if (mo == 0) { - lim = m; - } else { - lim = m - 1; - } - - -#if defined __x86_64__ || defined __i386__ - if (lim>0) { - err = aesxts_tweak_crypt_group(pt, ct, T, encrypt_ctx, lim); - ct += (lim<<4); - pt += (lim<<4); - } -#else - for (i = 0; i < lim; i++) { - err = aesxts_tweak_crypt(pt, ct, T, encrypt_ctx); - ct += 16; - pt += 16; - } -#endif - - /* if ptlen not divide 16 then */ - if (mo > 0) { - /* CC = tweak encrypt block m-1 */ - if ((err = aesxts_tweak_crypt(pt, CC, T, encrypt_ctx)) != 0) { - return err; - } - - /* Cm = first ptlen % 16 bytes of CC */ - for (i = 0; i < mo; i++) { - PP[i] = pt[16+i]; - ct[16+i] = CC[i]; - } - - for (; i < 16; i++) { - PP[i] = CC[i]; - } - - /* Cm-1 = Tweak encrypt PP */ - if ((err = aesxts_tweak_crypt(PP, ct, T, encrypt_ctx)) != 0) { - return err; - } - } - - return err; -} - -#if defined __x86_64__ || defined __i386__ -extern int aesxts_tweak_uncrypt(const uint8_t *C, uint8_t *P, uint8_t *T, aesedp_decrypt_ctx *ctx); -extern int aesxts_tweak_uncrypt_group(const uint8_t *C, uint8_t *P, uint8_t *T, aesedp_decrypt_ctx *ctx, uint32_t lim); -#else -static int aesxts_tweak_uncrypt(const uint8_t *C, uint8_t *P, uint8_t *T, aesedp_decrypt_ctx *ctx) -{ - uint32_t x; - uint32_t err; - - /* tweak encrypt block i */ - for (x = 0; x < 16; x += sizeof(uint64_t)) { - *((uint64_t*)&P[x]) = *((uint64_t*)&C[x]) ^ *((uint64_t*)&T[x]); - } - - err = aes_decrypt(P, P, ctx); - - for (x = 0; x < 16; x += sizeof(uint64_t)) { - *((uint64_t*)&P[x]) ^= *((uint64_t*)&T[x]); - } - - /* LFSR the tweak */ - aesxts_mult_x(T); - - return err; -} -#endif - -/** XTS Decryption - @param ct [in] Ciphertext - @param ptlen Length of plaintext (and ciphertext) - @param pt [out] Plaintext - @param tweak [in] The 128--bit encryption tweak (e.g. sector number) - @param xts The XTS structure - Returns CRYPT_OK upon success - */ - -int aesxts_decrypt( - const uint8_t *ct, unsigned long ptlen, - uint8_t *pt, - const uint8_t *tweak, - symmetric_xts *xts) -{ - aesedp_ctx *encKS = (aesedp_ctx *) &xts->key1; - aesedp_ctx *twkKS = (aesedp_ctx *) &xts->key2; - aesedp_encrypt_ctx *decrypt_ctx = &encKS->decrypt; - uint8_t PP[16], CC[16], T[16]; - uint64_t i, m, mo, lim; - uint64_t err; - - /* check inputs */ - if((pt == NULL) || (ct == NULL)|| (tweak == NULL) || (xts == NULL)) return 1; - - /* get number of blocks */ - m = ptlen >> 4; - mo = ptlen & 15; - - /* must have at least one full block */ - if (m == 0) { - return CRYPT_INVALID_ARG; - } - - /* encrypt the tweak , yes - encrypt */ - if ((err = aes_encrypt(tweak, T, &twkKS->encrypt)) != 0) { - return CRYPT_INVALID_KEYSIZE; - } - - /* for i = 0 to m-2 do */ - if (mo == 0) { - lim = m; - } else { - lim = m - 1; - } - -#if defined __x86_64__ || defined __i386__ - if (lim>0) { - err = aesxts_tweak_uncrypt_group(ct, pt, T, decrypt_ctx, lim); - ct += (lim<<4); - pt += (lim<<4); - } -#else - for (i = 0; i < lim; i++) { - err = aesxts_tweak_uncrypt(ct, pt, T, decrypt_ctx); - ct += 16; - pt += 16; - } -#endif - - /* if ptlen not divide 16 then */ - if (mo > 0) { - memcpy(CC, T, 16); - aesxts_mult_x(CC); - - /* PP = tweak decrypt block m-1 */ - if ((err = aesxts_tweak_uncrypt(ct, PP, CC, decrypt_ctx)) != CRYPT_OK) { - return err; - } - - /* Pm = first ptlen % 16 bytes of PP */ - for (i = 0; i < mo; i++) { - CC[i] = ct[16+i]; - pt[16+i] = PP[i]; - } - for (; i < 16; i++) { - CC[i] = PP[i]; - } - - /* Pm-1 = Tweak uncrypt CC */ - if ((err = aesxts_tweak_uncrypt(CC, pt, T, decrypt_ctx)) != CRYPT_OK) { - return err; - } - } - - return CRYPT_OK; -} - - - -void aesxts_done(symmetric_xts *xts) -{ - if(xts == NULL) return; - aesedp_done(&xts->key1); - aesedp_done(&xts->key2); -} - DELETED Source/libtomcrypt/src/ciphers/aesedpport/aesxts.h Index: Source/libtomcrypt/src/ciphers/aesedpport/aesxts.h ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/aesxts.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * aesxts.h - * - * - */ - -#include "stdint.h" -#include "tomcrypt.h" - -#ifndef _AESXTS_H -#define _AESXTS_H - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* - * The context for XTS-AES - */ - -#ifdef NEVER -#define KS_LENGTH 60 - -typedef struct { - uint32_t ks[KS_LENGTH]; - uint32_t rn; -} aesedp_encrypt_ctx; - -typedef struct { - uint32_t ks[KS_LENGTH]; - uint32_t rn; -} aesedp_decrypt_ctx; - -typedef struct { - aesedp_decrypt_ctx decrypt; - aesedp_encrypt_ctx encrypt; -} aesedp_ctx; - -// xts mode context - -typedef struct { - aesedp_ctx key1, key2; - uint32_t cipher; // ignore - this is to fit with the library, but in this case we're only using aes -} symmetric_xts; - -#endif - -/* - * These are the interfaces required for XTS-AES support - */ - -uint32_t -aesxts_start(uint32_t cipher, // ignored - we're doing this for xts-aes only - const uint8_t *IV, // ignored - const uint8_t *key1, int keylen, - const uint8_t *key2, int tweaklen, // both keys are the same size for xts - uint32_t num_rounds, // ignored - uint32_t options, // ignored - symmetric_xts *xts); - -int aesxts_encrypt( - const uint8_t *pt, unsigned long ptlen, - uint8_t *ct, - const uint8_t *tweak, // this can be considered the sector IV for this use - symmetric_xts *xts); - -int aesxts_decrypt( - const uint8_t *ct, unsigned long ptlen, - uint8_t *pt, - const uint8_t *tweak, // this can be considered the sector IV for this use - symmetric_xts *xts); - - -void aesxts_done(symmetric_xts *xts); - -#if defined(__cplusplus) -} -#endif - -#endif /* _AESXTS_H */ DELETED Source/libtomcrypt/src/ciphers/aesedpport/aesxts_asm.s Index: Source/libtomcrypt/src/ciphers/aesedpport/aesxts_asm.s ================================================================== --- Source/libtomcrypt/src/ciphers/aesedpport/aesxts_asm.s +++ /dev/null @@ -1,1305 +0,0 @@ -/* - This file "aesxts.s" provides x86_64 / i386 optimization of the following functions - - 0. xts_mult_x_on_xmm7 : a code macro that is used throughout all other functions - 1. void xts_mult_x(uint8_t *I); - 2. int tweak_crypt(const uint8_t *P, uint8_t *C, uint8_t *T, aesedp_encrypt_ctx *ctx); - 3. int tweak_crypt_group(const uint8_t *P, uint8_t *C, uint8_t *T, aesedp_encrypt_ctx *ctx, uint32_t lim); - 4. int tweak_uncrypt(const uint8_t *C, uint8_t *P, uint8_t *T, aesedp_decrypt_ctx *ctx); - 5. int tweak_uncrypt_group(const uint8_t *C, uint8_t *P, uint8_t *T, aesedp_decrypt_ctx *ctx, uint32_t lim); - - This file should be compiled together with xtsClearC.c - - functions 1,2,4 are supposed to replace the C functions in xtsClearC.c for x86_64/i386 architectures - functions 3,5 are only given here, no C code is available, they are called in xts_encrypt/xts_decrypt (xtsClearC.c) - - we can possibly add C code for functions 3 and 5 for future porting to other architectures - - cclee 4-29-10 - -*/ - -#if defined __i386__ || defined __x86_64__ -#include -#define CRYPT_OK 0 // can not include "crypt.h" in which CRYPT_OK is from enum - -/* - The following macro is used throughout the functions in this file. - It is the core function within the function xts_mult_x defined in (xtsClearC.c) - - upon entry, %xmm7 = the input tweak (128-bit), - on return, %xmm7 = the updated tweak (128-bit) - the macro uses %xmm1/%xmm2/%ecx in the computation - the operation can be described as follows : - 0. let x = %xmm7; // 128-bit little-endian input - 1. x = rotate_left(x,1); // rotate left by 1 -bit - 2. if (x&1) x ^= 0x0000...0086; // if least significant bit = 1, least significant byte ^= 0x86; - 3. return x; - - It's a pity that SSE does not support shifting of the whole 128-bit xmm registers. - The workaround is - 1. using parallel dual quad (8-byte) shifting, 1 for the 2 bottom 63-bits, 1 for the 2 leading bits - 2. manipulating the shifted quad words to form the 128-bit shifted result. - - Input : %xmm7 - Output : %xmm7 - Used : %xmm1/%xmm2/%ecx - - The macro is good for both x86_64 and i386. - -*/ - - .macro xts_mult_x_on_xmm7 // input : x = %xmm7, MS = most significant, LS = least significant - movaps %xmm7, %xmm1 // %xmm1 = a copy of x - movaps %xmm7, %xmm2 // %xmm2 = a copy of x - psllq $$1, %xmm7 // 1-bit left shift of 2 quad words (x1<<1, x0<<1), zero-filled - psrlq $$63, %xmm1 // 2 leading bits, each in the least significant bit of a quad word - psrad $$31, %xmm2 // the MS 32-bit will be either 0 or -1, depending on the MS bit of x - pshufd $$0xc6, %xmm1, %xmm1 // switch the positions of the 2 leading bits - pshufd $$0x03, %xmm2, %xmm2 // the LS 32-bit will be either 0 or -1, depending on the MS bit of x - por %xmm1, %xmm7 // we finally has %xmm7 = rotate_left(x,1); - movl $$0x86, %ecx // a potential byte to xor the bottom byte - movd %ecx, %xmm1 // copy it to %xmm1, the other is 0 - pand %xmm2, %xmm1 // %xmm1 = 0 or 0x86, depending on the MS bit of x - pxor %xmm1, %xmm7 // rotate_left(x,1) ^= 0 or 0x86 depending on the MS bit of x - .endm - - -/* - function : void xts_mult_x(uint8_t *I); - - 1. load (__m128*) (I) into xmm7 - 2. macro xts_mult_x_on_xmm7 (i/o @ xmm7, used xmm1/xmm2/ecx) - 3. save output (%xmm7) to memory pointed by I - - input : 16-byte memory pointed by I - output : same 16-byte memory pointed by I - - if kernel code, xmm1/xmm2/xmm7 saved and restored - other used registers : eax/ecx - - */ - .text - .align 4,0x90 - .globl _aesxts_mult_x -_aesxts_mult_x: - -#if defined __x86_64__ - #define I %rdi // 1st argument at %rdi for x86_64 - #define sp %rsp -#else - mov 4(%esp), %eax // 1st argument at stack, offset 4 for ret_addr for i386 - #define I %eax - #define sp %esp -#endif - - // if KERNEL code, allocate memory and save xmm1/xmm2/xmm7 -#ifdef KERNEL -#if defined __x86_64__ - sub $0x38, sp // 8-bytes alignment + 3 * 16 bytes -#else - sub $0x3c, sp // 12-bytes alignment + 3 * 16 bytes -#endif - movaps %xmm1, (sp) - movaps %xmm2, 16(sp) - movaps %xmm7, 32(sp) -#endif - - // load, compute, and save - movups (I), %xmm7 // load input tweak 128-bit into %xmm7 - xts_mult_x_on_xmm7 // the macro (also used else where) will update %xmm7 as the output - movups %xmm7, (I) // save the xts_mult_x output - - // if KERNEL code, restore xmm1/xmm2/xmm7 and deallocate stack memory -#ifdef KERNEL - movaps (sp), %xmm1 - movaps 16(sp), %xmm2 - movaps 32(sp), %xmm7 -#if defined __x86_64__ - add $0x38, sp // 8-bytes alignment + 3 * 16 bytes -#else - add $0x3c, sp // 12-bytes alignment + 3 * 16 bytes -#endif -#endif - - ret // return - - #undef I - #undef sp - -/* - The following is x86_64/i386 assembly implementation of - - int tweak_crypt(const uint8_t *P, uint8_t *C, uint8_t *T, aesedp_encrypt_ctx *ctx); - - Its C code implementation is given in xtsClearC.c - - all pointers P/C/T points to a block of 16 bytes. In the following description, P/C/T represent 128-bit data. - - The operation of tweak_crypt - - 1. C = P ^ T - 2. err = aes_encryp(C, C, ctx); if (err != CRYPT_OK) return err; - 3. C = C ^ T - 4. xts_mult_x(T) - 5. return CRYPT_OK; - - The following is the assembly implementation flow - - 1. save used xmm registers (xmm1/xmm7) if kernel code - 2. load xmm1 = P, xmm7 = T - 3. xmm1 = C = P ^ T - 4. write xmm1 to C - 5. call aes_encryp(C,C,ctx); note that it will use aesni if available, also xmm will return intact - 6. load xmm1 = C - 7. xmm1 = C = C^T = xmm1 ^ xmm7 - 8. write xmm1 to C - 9. update T (in xmm7) via xts_mult_x macro - a. restore xmm registers (xmm1/xmm7) if kernel code - b. return CRYPT_OK (in eax) - - Note: used xmm registers : xmm1/xmm2/xmm7, xmm2 in xts_mult_x macro - -*/ - - .text - .align 4,0x90 - .globl _aesxts_tweak_crypt -_aesxts_tweak_crypt: -#if defined __i386__ - - // push into stack for local use - push %ebp - mov %esp, %ebp - push %ebx - push %edi - push %esi - - // alllocate stack memory for local use - sub $12+16*4, %esp // 12 (alignment) + 3*16 (xmm save/restore) + 16 (aes_crypt calling arguments) - - // load with called arguments - mov 8(%ebp), %eax // P, we need this only briefly, so eax is fine - mov 12(%ebp), %edi // C - mov 16(%ebp), %ebx // T - mov 20(%ebp), %esi // ctx - - #define P %eax - #define C %edi - #define T %ebx - #define ctx %esi - #define sp %esp - -#else - // x86_64 calling argument order : rdi/rsi/rdx/rcx/r8 - - // push into stack for local use - push %rbp - mov %rsp, %rbp - push %r12 - push %r13 - push %r14 - push %r15 - - // alllocate stack memory for local use, if kernel code, need to save/restore xmm registers -#ifdef KERNEL - sub $4*16, %rsp // only need 3*16, add 16 extra so to make save/restore xmm common to i386 -#endif - - // load with called arguments, release rdi/rsi/rdx/rcx/r8, as need to call aes_encrypt - mov %rsi, %r13 - mov %rdx, %r14 - mov %rcx, %r15 - - #define P %rdi - #define C %r13 - #define T %r14 - #define ctx %r15 - #define sp %rsp - -#endif - - // if kernel, save used xmm registers -#ifdef KERNEL - movaps %xmm1, 16(sp) - movaps %xmm2, 32(sp) - movaps %xmm7, 48(sp) -#endif - - movups (P), %xmm1 // P - movups (T), %xmm7 // T - - // setup caliing arguments for aes_encrypt -#if defined __i386__ - mov C, (%esp) // C - mov C, 4(%esp) // C - mov ctx, 8(%esp) // ctx -#else - mov C, %rdi // C - mov C, %rsi // C - mov ctx, %rdx // ctx -#endif - - pxor %xmm7, %xmm1 // C = P ^ T - movups %xmm1, (C) // save C into memory - - call _aes_encrypt // err = aes_encrypt(C,C,ctx); - - cmp $CRYPT_OK, %eax // check err == CRYPT_OK - jne 9f // if err != CRYPT_OK, exit - - movups (C), %xmm1 // load xmm1 = C - pxor %xmm7, %xmm1 // C ^= T - movups %xmm1, (C) // write C with xmm1, xmm1 is freed now, will be changed in the following macro - - xts_mult_x_on_xmm7 // update T (on xmm7) - - movups %xmm7, (T) // write xmm7 to T -9: - - // restore used xmm registers if this is for kernel -#ifdef KERNEL - movaps 16(sp), %xmm1 - movaps 32(sp), %xmm2 - movaps 48(sp), %xmm7 -#endif - - // free stack memory and restore callee registers -#if defined __i386__ - add $12+16*4, %esp // 12 (alignment) + 3*16 (xmm save/restore) + 16 (aes_crypt calling arguments) - pop %esi - pop %edi - pop %ebx -#else -#ifdef KERNEL - add $4*16, %rsp // only need 3*16, add 16 extra so make save/restore xmm common to i386 -#endif - pop %r15 - pop %r14 - pop %r13 - pop %r12 -#endif - - // return, eax/rax already has the return val - leave - ret - - #undef P - #undef C - #undef T - #undef ctx - #undef sp - -/* - The following is x86_64/i386 assembly implementation of - - int tweak_crypt_group(const uint8_t *P, uint8_t *C, uint8_t *T, aesedp_encrypt_ctx *ctx, uint32_t lim); - - TODO : Its C code implementation is YET to be provided in xtsClearC.c (for the benefit of porting to other ISAs) - This function is grouped version of the above function tweak_crypt(), so xmm registers save/restore only need - to happen once for all grouped blocks. - - The implementation here probes __cpu_capabilities to detect whether aesni (or hw-aes instruction) is available. - If aesni is available, the code branch to optimized code that uses aesni. - - The optimized aesni code operates as follows: - - while (more than 4 consecutive blocks available) { - - do xts_mult_x macro 4 times and write the 4 tweaks on stack (16-byte aligned) - - perform 4 C = P ^ T; // T is on 16-byte aligned stack - - perform 4 aes_encrypt (all aes_encrypt instruction interleaved to achieve better throughtput) - - perform 4 C = C ^ T // T is on 16-byte aligned stack - - } - - The code then falls through to the scalar code, that sequentially performs what tweak_crypt does - - 1. C = P ^ T - 2. err = aes_encryp(C, C, ctx); if (err != CRYPT_OK) return err; - 3. C = C ^ T - 4. xts_mult_x(T) - - Note: used xmm registers : - xmm0-xmm5, xmm7 if aesni is available - xmm0-xmm4, xmm7 if aesni is not available. - -*/ - - - .text - .align 4,0x90 - .globl _aesxts_tweak_crypt_group -_aesxts_tweak_crypt_group: - -#if defined __i386__ - - // push callee-saved registers for local use - push %ebp - mov %esp, %ebp - push %ebx - push %edi - push %esi - - // allocate stack memory for local use and/or xmm register save for kernel code - sub $(12+8*16+16*4), %esp // 12 (alignment) + 8*16 (xmm) + 4*16 (pre-computed tweaks) aesni - // 12 (alignment) + 8*16 (xmm) + 4*16 (only 12 used for aes_encrypt) no aesni - // transfer calling arguments - mov 20(%ebp), %eax // ctx - mov 12(%ebp), %edi // C - mov 16(%ebp), %ebx // T - mov 8(%ebp), %esi // P - mov %eax, 8(%esp) // ctx as the 3rd parameter to aes_decrypt - - #define P %esi - #define C %edi - #define T %ebx - #define lim 24(%ebp) - #define sp %esp - -#else - - // push callee-saved registers for local use - push %rbp - mov %rsp, %rbp - push %rbx - push %r12 - push %r13 - push %r14 - push %r15 - - // allocate stack memory for local use and/or xmm register save for kernel code - sub $(8+8*16+16*5), %rsp // 8 (alignment) + 8*16 (xmm) + 4*16 (pre-computed tweaks) + 16 (common to i386) - - // rdi/rsi/rdx/rcx/r8 - // transfer calling arguments - mov %rdi, %r12 - mov %rsi, %r13 - mov %rdx, %r14 - mov %rcx, %r15 - mov %r8, %rbx - - #define P %r12 - #define C %r13 - #define T %r14 - #define ctx %r15 - #define lim %ebx - #define sp %rsp -#endif - -#ifdef KERNEL - movaps %xmm0, 0x50(sp) - movaps %xmm1, 0x60(sp) - movaps %xmm2, 0x70(sp) - movaps %xmm3, 0x80(sp) - movaps %xmm4, 0x90(sp) - movaps %xmm7, 0xa0(sp) -#endif - - // probe __cpu_capabilities to detect aesni -#if defined __x86_64__ - movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capabilities - mov (%rax), %eax // %eax = __cpu_capabilities -#else // i386 -#if defined KERNEL - leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities - mov (%eax), %eax // %eax = __cpu_capabilities -#else - mov _COMM_PAGE_CPU_CAPABILITIES, %eax -#endif -#endif - test $(kHasAES), %eax - je L_crypt_group_sw // if aesni not available, jump to sw-based implementation - - // aesni-based implementation - - sub $4, lim // pre-decrement lim by 4 - jl 9f // if lim < 4, skip the following code - - movups (T), %xmm7 // xmm7 is the tweak before encrypting every 4 blocks -#ifdef KERNEL - movaps %xmm5, 0xb0(sp) // hw-aes-based uses extra xmm5 -#endif - -0: - // derive 4 tweaks using xts_mult_x macro, and save on aligned stack space - // xmm7 will be the tweak for next 4-blocks iteration - - #define tweak1 16(sp) - #define tweak2 32(sp) - #define tweak3 48(sp) - #define tweak4 64(sp) - - movaps %xmm7, tweak1 // save 1st tweak on stack - xts_mult_x_on_xmm7 // compute 2nd tweak - movaps %xmm7, tweak2 // save 2nd tweak on stack - xts_mult_x_on_xmm7 // compute 3rd tweak - movaps %xmm7, tweak3 // save 3rd tweak on stack - xts_mult_x_on_xmm7 // compute 4th tweak - movaps %xmm7, tweak4 // save 4th tweak on stack - xts_mult_x_on_xmm7 // compute 1st tweak for next iteration - - // read 4 Ps - movups (P), %xmm0 - movups 16(P), %xmm1 - movups 32(P), %xmm2 - movups 48(P), %xmm3 - - // 4 C = P ^ T - pxor tweak1, %xmm0 - pxor tweak2, %xmm1 - pxor tweak3, %xmm2 - pxor tweak4, %xmm3 - - // 4 interleaved aes_encrypt - -#if defined __i386__ - mov 8(sp), %ecx // ctx - #undef ctx - #define ctx %ecx -#endif - - mov 240(ctx), %eax // aes length - - cmp $160, %eax // AES-128 ? - je 160f - cmp $192, %eax // AES-192 ? - je 192f - cmp $224, %eax // AES-256 ? - je 224f - mov $-1, %eax // error : non-supported aes length -#ifdef KERNEL - movaps 0xb0(sp), %xmm5 // hw-aes-based uses extra xmm5 -#endif - jmp L_error_crypt - - // definitions, macros, and constructs for 4 blocks hw-aes-encrypt - - // the following key definitions will also be used in tweak_uncrypt_group - #define key0 0(ctx) - #define key1 16(ctx) - #define key2 32(ctx) - #define key3 48(ctx) - #define key4 64(ctx) - #define key5 80(ctx) - #define key6 96(ctx) - #define key7 112(ctx) - #define key8 128(ctx) - #define key9 144(ctx) - #define keyA 160(ctx) - #define keyB 176(ctx) - #define keyC 192(ctx) - #define keyD 208(ctx) - #define keyE 224(ctx) - - #define aes aesenc - #define aeslast aesenclast - - // all aes encrypt operations start with the following sequence - .macro aes_common_part - movups key0, %xmm4 - movups key1, %xmm5 - pxor %xmm4, %xmm0 - pxor %xmm4, %xmm1 - pxor %xmm4, %xmm2 - pxor %xmm4, %xmm3 - movups key2, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups key3, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups key4, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups key5, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups key6, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups key7, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups key8, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups key9, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups keyA, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - .endm - - // all aes encypt operations end with the following 4 instructions - .macro aes_last - aeslast %xmm4, %xmm0 - aeslast %xmm4, %xmm1 - aeslast %xmm4, %xmm2 - aeslast %xmm4, %xmm3 - .endm - - .macro aes_128 - aes_common_part // encrypt common part - aes_last // encrypt ending part - .endm - - .macro aes_192 - aes_common_part // encrypt common part - - // 10 extra instructions in between common and ending - movups keyB, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups keyC, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - - aes_last // encrypt ending part - .endm - - .macro aes_256 - aes_common_part // encrypt common part - - // 20 extra instructions in between common and ending - movups keyB, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups keyC, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups keyD, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups keyE, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - - aes_last // encrypt ending part - .endm - -160: // AES-128 encrypt - aes_128 - jmp 8f - -192: // AES-192 encrypt - aes_192 - jmp 8f - -224: // AES-256 encrypt - aes_256 - -8: - - // 4 C = C ^ T - pxor tweak1, %xmm0 - pxor tweak2, %xmm1 - pxor tweak3, %xmm2 - pxor tweak4, %xmm3 - - // write 4 Cs - movups %xmm0, (C) - movups %xmm1, 16(C) - movups %xmm2, 32(C) - movups %xmm3, 48(C) - - add $64, P - add $64, C - - sub $4, lim - jge 0b - -#ifdef KERNEL - movaps 0xb0(sp), %xmm5 // hw-aes-based uses extra xmm5 -#endif - movups %xmm7, (T) - -9: - xor %eax, %eax // to return CRYPT_OK - add $4, lim // post-increment lim by 4 - je 9f // if lim==0, branch to prepare to return - -L_crypt_group_sw: - - movups (T), %xmm7 // T, xmm7 will be used as T (128-bit) throughtout the loop - - sub $1, lim // pre-decrement lim by 1 - jl 1f // if lim < 1, branch to prepare to return -0: - movups (P), %xmm0 // P - - // prepare for calling aes_encrypt -#if defined __i386__ - mov C, (%esp) // C - mov C, 4(%esp) // C - // ctx was prepared previously in preamble -#else - mov C, %rdi // C - mov C, %rsi // C - mov ctx, %rdx // ctx -#endif - - pxor %xmm7, %xmm0 // C = P ^ T - movups %xmm0, (C) // save C into memory - - call _aes_encrypt_xmm_no_save // err = aes_encrypt(C,C,ctx); - - cmp $CRYPT_OK, %eax // err == CRYPT_OK ? - jne 9f // if err != CRYPT_OK, branch to exit with error - - movups (C), %xmm0 // load xmm0 with C - pxor %xmm7, %xmm0 // C ^= T - movups %xmm0, (C) // save output C - - xts_mult_x_on_xmm7 - - add $16, C // next C - add $16, P // next P - sub $1, lim // lim-- - jge 0b // if (lim>0) repeat the scalar loop - -1: movups %xmm7, (T) // save final tweak -L_error_crypt: -9: - // if kernel, restore used xmm registers -#ifdef KERNEL - movaps 0x50(sp), %xmm0 - movaps 0x60(sp), %xmm1 - movaps 0x70(sp), %xmm2 - movaps 0x80(sp), %xmm3 - movaps 0x90(sp), %xmm4 - movaps 0xa0(sp), %xmm7 -#endif - -#if defined __i386__ - add $(12+16*8+16*4), %esp - pop %esi - pop %edi - pop %ebx -#else - add $(8+16*8+16*5), %rsp - pop %r15 - pop %r14 - pop %r13 - pop %r12 - pop %rbx -#endif - leave - ret - - #undef P - #undef C - #undef T - #undef ctx - #undef sp - -/* - The following is x86_64/i386 assembly implementation of - - int tweak_uncrypt(const uint8_t *C, uint8_t *P, uint8_t *T, aesedp_decrypt_ctx *ctx); - - Its C code implementation is given in xtsClearC.c - - all pointers C/P/T points to a block of 16 bytes. In the following description, C/P/T represent 128-bit data. - - The operation of tweak_crypt - - 1. P = C ^ T - 2. err = aes_decryp(P, P, ctx); if (err != CRYPT_OK) return err; - 3. P = P ^ T - 4. xts_mult_x(T) - 5. return CRYPT_OK; - - The following is the assembly implementation flow - - 1. save used xmm registers (xmm1/xmm7) if kernel code - 2. load xmm1 = C, xmm7 = T - 3. xmm1 = P = C ^ T - 4. write xmm1 to P - 5. call aes_decryp(P,P,ctx); note that it will use aesni if available, also xmm will return intact - 6. load xmm1 = P - 7. xmm1 = P = P^T = xmm1 ^ xmm7 - 8. write xmm1 to P - 9. update T (in xmm7) via xts_mult_x macro - a. restore xmm registers (xmm1/xmm7) if kernel code - b. return CRYPT_OK (in eax) - - Note: used xmm registers : xmm1/xmm2/xmm7, xmm2 in xts_mult_x macro - -*/ - - .text - .align 4,0x90 - .globl _aesxts_tweak_uncrypt -_aesxts_tweak_uncrypt: -#if defined __i386__ - - // push into stack for local use - push %ebp - mov %esp, %ebp - push %ebx - push %edi - push %esi - - // alllocate stack memory for local use - sub $12+16*4, %esp // 12 (alignment) + 3*16 (xmm save/restore) + 16 (aes_crypt calling arguments) - - // load with called arguments - mov 8(%ebp), %eax // C, we need this only briefly, so eax is fine - mov 12(%ebp), %edi // P - mov 16(%ebp), %ebx // T - mov 20(%ebp), %esi // ctx - - #define C %eax - #define P %edi - #define T %ebx - #define ctx %esi - #define sp %esp - -#else - // x86_64 calling argument order : rdi/rsi/rdx/rcx/r8 - - // push into stack for local use - push %rbp - mov %rsp, %rbp - push %r12 - push %r13 - push %r14 - push %r15 - - // alllocate stack memory for local use, if kernel code, need to save/restore xmm registers -#ifdef KERNEL - sub $4*16, %rsp // only need 3*16, add 16 extra so to make save/restore xmm common to i386 -#endif - - // load with called arguments, release rdi/rsi/rdx/rcx/r8, as need to call aes_decrypt - mov %rsi, %r13 - mov %rdx, %r14 - mov %rcx, %r15 - - #define C %rdi - #define P %r13 - #define T %r14 - #define ctx %r15 - #define sp %rsp - -#endif - - // if kernel, save used xmm registers -#ifdef KERNEL - movaps %xmm1, 16(sp) - movaps %xmm2, 32(sp) - movaps %xmm7, 48(sp) -#endif - - movups (C), %xmm1 // C - movups (T), %xmm7 // T - - // setup caliing arguments for aes_decrypt -#if defined __i386__ - mov P, (%esp) // P - mov P, 4(%esp) // P - mov ctx, 8(%esp) // ctx -#else - mov P, %rdi // P - mov P, %rsi // P - mov ctx, %rdx // ctx -#endif - - pxor %xmm7, %xmm1 // P = C ^ T - movups %xmm1, (P) // save P into memory - - call _aes_decrypt // err = aes_decrypt(P,P,ctx); - - cmp $CRYPT_OK, %eax // check err == CRYPT_OK - jne 9f // if err != CRYPT_OK, exit - - movups (P), %xmm1 // load xmm1 = P - pxor %xmm7, %xmm1 // P ^= T - movups %xmm1, (P) // write P with xmm1, xmm1 is freed now, will be changed in the following macro - - xts_mult_x_on_xmm7 // update T (on xmm7) - - movups %xmm7, (T) // write xmm7 to T -9: - - // restore used xmm registers if this is for kernel -#ifdef KERNEL - movaps 16(sp), %xmm1 - movaps 32(sp), %xmm2 - movaps 48(sp), %xmm7 -#endif - - // free stack memory and restore callee registers -#if defined __i386__ - add $12+16*4, %esp // 12 (alignment) + 3*16 (xmm save/restore) + 16 (aes_crypt calling arguments) - pop %esi - pop %edi - pop %ebx -#else -#ifdef KERNEL - add $4*16, %rsp // only need 3*16, add 16 extra so make save/restore xmm common to i386 -#endif - pop %r15 - pop %r14 - pop %r13 - pop %r12 -#endif - - // return, eax/rax already has the return val - leave - ret - - #undef P - #undef C - #undef T - #undef ctx - #undef sp - -/* - The following is x86_64/i386 assembly implementation of - - int tweak_uncrypt_group(const uint8_t *C, uint8_t *P, uint8_t *T, aesedp_decrypt_ctx *ctx, uint32_t lim); - - TODO : Its C code implementation is YET to be provided in xtsClearC.c (for the benefit of porting to other ISAs) - This function is grouped version of the above function tweak_uncrypt(), so xmm registers save/restore only need - to happen once for all grouped blocks. - - The implementation here probes __cpu_capabilities to detect whether aesni (or hw-aes instruction) is available. - If aesni is available, the code branch to optimized code that uses aesni. - - The optimized aesni code operates as follows: - - while (more than 4 consecutive blocks available) { - - do xts_mult_x macro 4 times and write the 4 tweaks on stack (16-byte aligned) - - perform 4 P = C ^ T; // T is on 16-byte aligned stack - - perform 4 aes_decrypt (all aes_decrypt instruction interleaved to achieve better throughtput) - - perform 4 P = P ^ T // T is on 16-byte aligned stack - - } - - The code then falls through to the scalar code, that sequentially performs what tweak_crypt does - - 1. P = C ^ T - 2. err = aes_decryp(P, P, ctx); if (err != CRYPT_OK) return err; - 3. P = P ^ T - 4. xts_mult_x(T) - - Note: used xmm registers : - xmm0-xmm5, xmm7 if aesni is available - xmm0-xmm4, xmm7 if aesni is not available. - -*/ - - - .text - .align 4,0x90 - .globl _aesxts_tweak_uncrypt_group -_aesxts_tweak_uncrypt_group: - -#if defined __i386__ - - // push callee-saved registers for local use - push %ebp - mov %esp, %ebp - push %ebx - push %edi - push %esi - - // allocate stack memory for local use and/or xmm register save for kernel code - sub $(12+8*16+16*4), %esp // 12 (alignment) + 8*16 (xmm) + 4*16 (pre-computed tweaks) aesni - // 12 (alignment) + 8*16 (xmm) + 4*16 (only 12 used for aes_decrypt) no aesni - // transfer calling arguments - mov 20(%ebp), %eax // ctx - mov 12(%ebp), %edi // P - mov 16(%ebp), %ebx // T - mov 8(%ebp), %esi // C - mov %eax, 8(%esp) // ctx as the 3rd parameter to aes_decrypt - - #define C %esi - #define P %edi - #define T %ebx - #define lim 24(%ebp) - #define sp %esp - -#else - - // push callee-saved registers for local use - push %rbp - mov %rsp, %rbp - push %rbx - push %r12 - push %r13 - push %r14 - push %r15 - - // allocate stack memory for local use and/or xmm register save for kernel code - sub $(8+8*16+16*5), %rsp // 8 (alignment) + 8*16 (xmm) + 4*16 (pre-computed tweaks) + 16 (common to i386) - - // rdi/rsi/rdx/rcx/r8 - // transfer calling arguments - mov %rdi, %r12 - mov %rsi, %r13 - mov %rdx, %r14 - mov %rcx, %r15 - mov %r8, %rbx - - #define C %r12 - #define P %r13 - #define T %r14 - #define ctx %r15 - #define lim %ebx - #define sp %rsp -#endif - -#ifdef KERNEL - movaps %xmm0, 0x50(sp) - movaps %xmm1, 0x60(sp) - movaps %xmm2, 0x70(sp) - movaps %xmm3, 0x80(sp) - movaps %xmm4, 0x90(sp) - movaps %xmm7, 0xa0(sp) -#endif - - // probe __cpu_capabilities to detect aesni -#if defined __x86_64__ - movq __cpu_capabilities@GOTPCREL(%rip), %rax // %rax -> __cpu_capabilities - mov (%rax), %eax // %eax = __cpu_capabilities -#else // i386 -#if defined KERNEL - leal __cpu_capabilities, %eax // %eax -> __cpu_capabilities - mov (%eax), %eax // %eax = __cpu_capabilities -#else - movl _COMM_PAGE_CPU_CAPABILITIES, %eax -#endif -#endif - test $(kHasAES), %eax - je L_uncrypt_group_sw // if aesni not available, jump to sw-based implementation - - // aesni-based implementation - - sub $4, lim // pre-decrement lim by 4 - jl 9f // if lim < 4, skip the following code - - movups (T), %xmm7 // xmm7 is the tweak before decrypting every 4 blocks -#ifdef KERNEL - movaps %xmm5, 0xb0(sp) // hw-aes-based uses extra xmm5 -#endif - -0: - // derive 4 tweaks using xts_mult_x macro, and save on aligned stack space - // xmm7 will be the tweak for next 4-blocks iteration - - #define tweak1 16(sp) - #define tweak2 32(sp) - #define tweak3 48(sp) - #define tweak4 64(sp) - - movaps %xmm7, tweak1 // save 1st tweak on stack - xts_mult_x_on_xmm7 // compute 2nd tweak - movaps %xmm7, tweak2 // save 2nd tweak on stack - xts_mult_x_on_xmm7 // compute 3rd tweak - movaps %xmm7, tweak3 // save 3rd tweak on stack - xts_mult_x_on_xmm7 // compute 4th tweak - movaps %xmm7, tweak4 // save 4th tweak on stack - xts_mult_x_on_xmm7 // compute 1st tweak for next iteration - - // read 4 Cs - movups (C), %xmm0 - movups 16(C), %xmm1 - movups 32(C), %xmm2 - movups 48(C), %xmm3 - - // 4 P = C ^ T - pxor tweak1, %xmm0 - pxor tweak2, %xmm1 - pxor tweak3, %xmm2 - pxor tweak4, %xmm3 - - // 4 interleaved aes_decrypt - -#if defined __i386__ - mov 8(sp), %ecx // ctx - #undef ctx - #define ctx %ecx -#endif - - mov 240(ctx), %eax // aes length - - cmp $160, %eax // AES-128 ? - je 160f - cmp $192, %eax // AES-192 ? - je 192f - cmp $224, %eax // AES-256 ? - je 224f - mov $-1, %eax // error : non-supported aes length -#ifdef KERNEL - movaps 0xb0(sp), %xmm5 // hw-aes-based uses extra xmm5 -#endif - jmp L_error_uncrypt - - // definitions, macros to construc hw-aes-decrypt - // will reuse previously defined key0 = (ctx), key1 = 16(ctx), .... - #undef aes - #undef aeslast - #define aes aesdec - #define aeslast aesdeclast - - .macro aes_decrypt_common - movups key8, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups key7, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups key6, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups key5, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups key4, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups key3, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups key2, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups key1, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups key0, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - aeslast %xmm4, %xmm0 - aeslast %xmm4, %xmm1 - aeslast %xmm4, %xmm2 - aeslast %xmm4, %xmm3 - .endm - - .macro aes_dec_128 - movups keyA, %xmm4 - movups key9, %xmm5 - pxor %xmm4, %xmm0 - pxor %xmm4, %xmm1 - pxor %xmm4, %xmm2 - pxor %xmm4, %xmm3 - aes_decrypt_common - .endm - - .macro aes_dec_192 - movups keyC, %xmm4 - movups keyB, %xmm5 - pxor %xmm4, %xmm0 - pxor %xmm4, %xmm1 - pxor %xmm4, %xmm2 - pxor %xmm4, %xmm3 - movups keyA, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups key9, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - aes_decrypt_common - .endm - - .macro aes_dec_256 - movups keyE, %xmm4 - movups keyD, %xmm5 - pxor %xmm4, %xmm0 - pxor %xmm4, %xmm1 - pxor %xmm4, %xmm2 - pxor %xmm4, %xmm3 - movups keyC, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups keyB, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - movups keyA, %xmm4 - aes %xmm5, %xmm0 - aes %xmm5, %xmm1 - aes %xmm5, %xmm2 - aes %xmm5, %xmm3 - movups key9, %xmm5 - aes %xmm4, %xmm0 - aes %xmm4, %xmm1 - aes %xmm4, %xmm2 - aes %xmm4, %xmm3 - aes_decrypt_common - .endm - -160: // AES-128 decrypt - aes_dec_128 - jmp 8f - -192: // AES-192 decrypt - aes_dec_192 - jmp 8f - -224: // AES-256 decrypt - aes_dec_256 - -8: - - // 4 P = P ^ T - pxor tweak1, %xmm0 - pxor tweak2, %xmm1 - pxor tweak3, %xmm2 - pxor tweak4, %xmm3 - - // write 4 Ps - movups %xmm0, (P) - movups %xmm1, 16(P) - movups %xmm2, 32(P) - movups %xmm3, 48(P) - - add $64, C - add $64, P - - sub $4, lim - jge 0b - -#ifdef KERNEL - movaps 0xb0(sp), %xmm5 // hw-aes-based uses extra xmm5 -#endif - movups %xmm7, (T) - -9: - xor %eax, %eax // to return CRYPT_OK - add $4, lim // post-increment lim by 4 - je 9f // if lim==0, branch to prepare to return - -L_uncrypt_group_sw: - - movups (T), %xmm7 // T, xmm7 will be used as T (128-bit) throughtout the loop - - sub $1, lim // pre-decrement lim by 1 - jl 1f // if lim < 1, branch to prepare to return -0: - movups (C), %xmm0 // C - - // prepare for calling aes_decrypt -#if defined __i386__ - mov P, (%esp) // P - mov P, 4(%esp) // P - // ctx was prepared previously in preamble -#else - mov P, %rdi // P - mov P, %rsi // P - mov ctx, %rdx // ctx -#endif - - pxor %xmm7, %xmm0 // P = C ^ T - movups %xmm0, (P) // save P into memory - - call _aes_decrypt_xmm_no_save // err = aes_decrypt(P,P,ctx); - - cmp $CRYPT_OK, %eax // err == CRYPT_OK ? - jne 9f // if err != CRYPT_OK, branch to exit with error - - movups (P), %xmm0 // load xmm0 with P - pxor %xmm7, %xmm0 // P ^= T - movups %xmm0, (P) // save output P - - xts_mult_x_on_xmm7 - - add $16, C // next C - add $16, P // next P - sub $1, lim // lim-- - jge 0b // if (lim>0) repeat the scalar loop - -1: movups %xmm7, (T) // save final tweak -L_error_uncrypt: -9: - // if kernel, restore used xmm registers -#ifdef KERNEL - movaps 0x50(sp), %xmm0 - movaps 0x60(sp), %xmm1 - movaps 0x70(sp), %xmm2 - movaps 0x80(sp), %xmm3 - movaps 0x90(sp), %xmm4 - movaps 0xa0(sp), %xmm7 -#endif - -#if defined __i386__ - add $(12+16*8+16*4), %esp - pop %esi - pop %edi - pop %ebx -#else - add $(8+16*8+16*5), %rsp - pop %r15 - pop %r14 - pop %r13 - pop %r12 - pop %rbx -#endif - leave - ret -#endif /* x86 based build */ DELETED Source/libtomcrypt/src/ciphers/cast5.c Index: Source/libtomcrypt/src/ciphers/cast5.c ================================================================== --- Source/libtomcrypt/src/ciphers/cast5.c +++ /dev/null @@ -1,739 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - - /** - @file cast5.c - Implementation of LTC_CAST5 (RFC 2144) by Tom St Denis - */ -#include "tomcrypt.h" - -#ifdef LTC_CAST5 - -const struct ltc_cipher_descriptor cast5_desc = { - "cast5", - 15, - 5, 16, 8, 16, - &cast5_setup, - &cast5_ecb_encrypt, - &cast5_ecb_decrypt, - &cast5_test, - &cast5_done, - &cast5_keysize, - /* ECB Accelerators */ - NULL, NULL, - /* CBC Accelerators */ - NULL, NULL, - /* CTR Accelerators */ - NULL, - /* LRW Accelerators */ - NULL, NULL, - /* XTS Accelerators */ - NULL, NULL, - /* CCM Accelerator */ - NULL, - /* GCM Accelerator */ - NULL, - /* OMAC Accelerator */ - NULL, - /* XCBC Accelerator */ - NULL, - /* F9 Accelerator */ - NULL -}; - -static const ulong32 S1[256] = { -0x30fb40d4UL, 0x9fa0ff0bUL, 0x6beccd2fUL, 0x3f258c7aUL, 0x1e213f2fUL, 0x9c004dd3UL, -0x6003e540UL, 0xcf9fc949UL, 0xbfd4af27UL, 0x88bbbdb5UL, 0xe2034090UL, 0x98d09675UL, -0x6e63a0e0UL, 0x15c361d2UL, 0xc2e7661dUL, 0x22d4ff8eUL, 0x28683b6fUL, 0xc07fd059UL, -0xff2379c8UL, 0x775f50e2UL, 0x43c340d3UL, 0xdf2f8656UL, 0x887ca41aUL, 0xa2d2bd2dUL, -0xa1c9e0d6UL, 0x346c4819UL, 0x61b76d87UL, 0x22540f2fUL, 0x2abe32e1UL, 0xaa54166bUL, -0x22568e3aUL, 0xa2d341d0UL, 0x66db40c8UL, 0xa784392fUL, 0x004dff2fUL, 0x2db9d2deUL, -0x97943facUL, 0x4a97c1d8UL, 0x527644b7UL, 0xb5f437a7UL, 0xb82cbaefUL, 0xd751d159UL, -0x6ff7f0edUL, 0x5a097a1fUL, 0x827b68d0UL, 0x90ecf52eUL, 0x22b0c054UL, 0xbc8e5935UL, -0x4b6d2f7fUL, 0x50bb64a2UL, 0xd2664910UL, 0xbee5812dUL, 0xb7332290UL, 0xe93b159fUL, -0xb48ee411UL, 0x4bff345dUL, 0xfd45c240UL, 0xad31973fUL, 0xc4f6d02eUL, 0x55fc8165UL, -0xd5b1caadUL, 0xa1ac2daeUL, 0xa2d4b76dUL, 0xc19b0c50UL, 0x882240f2UL, 0x0c6e4f38UL, -0xa4e4bfd7UL, 0x4f5ba272UL, 0x564c1d2fUL, 0xc59c5319UL, 0xb949e354UL, 0xb04669feUL, -0xb1b6ab8aUL, 0xc71358ddUL, 0x6385c545UL, 0x110f935dUL, 0x57538ad5UL, 0x6a390493UL, -0xe63d37e0UL, 0x2a54f6b3UL, 0x3a787d5fUL, 0x6276a0b5UL, 0x19a6fcdfUL, 0x7a42206aUL, -0x29f9d4d5UL, 0xf61b1891UL, 0xbb72275eUL, 0xaa508167UL, 0x38901091UL, 0xc6b505ebUL, -0x84c7cb8cUL, 0x2ad75a0fUL, 0x874a1427UL, 0xa2d1936bUL, 0x2ad286afUL, 0xaa56d291UL, -0xd7894360UL, 0x425c750dUL, 0x93b39e26UL, 0x187184c9UL, 0x6c00b32dUL, 0x73e2bb14UL, -0xa0bebc3cUL, 0x54623779UL, 0x64459eabUL, 0x3f328b82UL, 0x7718cf82UL, 0x59a2cea6UL, -0x04ee002eUL, 0x89fe78e6UL, 0x3fab0950UL, 0x325ff6c2UL, 0x81383f05UL, 0x6963c5c8UL, -0x76cb5ad6UL, 0xd49974c9UL, 0xca180dcfUL, 0x380782d5UL, 0xc7fa5cf6UL, 0x8ac31511UL, -0x35e79e13UL, 0x47da91d0UL, 0xf40f9086UL, 0xa7e2419eUL, 0x31366241UL, 0x051ef495UL, -0xaa573b04UL, 0x4a805d8dUL, 0x548300d0UL, 0x00322a3cUL, 0xbf64cddfUL, 0xba57a68eUL, -0x75c6372bUL, 0x50afd341UL, 0xa7c13275UL, 0x915a0bf5UL, 0x6b54bfabUL, 0x2b0b1426UL, -0xab4cc9d7UL, 0x449ccd82UL, 0xf7fbf265UL, 0xab85c5f3UL, 0x1b55db94UL, 0xaad4e324UL, -0xcfa4bd3fUL, 0x2deaa3e2UL, 0x9e204d02UL, 0xc8bd25acUL, 0xeadf55b3UL, 0xd5bd9e98UL, -0xe31231b2UL, 0x2ad5ad6cUL, 0x954329deUL, 0xadbe4528UL, 0xd8710f69UL, 0xaa51c90fUL, -0xaa786bf6UL, 0x22513f1eUL, 0xaa51a79bUL, 0x2ad344ccUL, 0x7b5a41f0UL, 0xd37cfbadUL, -0x1b069505UL, 0x41ece491UL, 0xb4c332e6UL, 0x032268d4UL, 0xc9600accUL, 0xce387e6dUL, -0xbf6bb16cUL, 0x6a70fb78UL, 0x0d03d9c9UL, 0xd4df39deUL, 0xe01063daUL, 0x4736f464UL, -0x5ad328d8UL, 0xb347cc96UL, 0x75bb0fc3UL, 0x98511bfbUL, 0x4ffbcc35UL, 0xb58bcf6aUL, -0xe11f0abcUL, 0xbfc5fe4aUL, 0xa70aec10UL, 0xac39570aUL, 0x3f04442fUL, 0x6188b153UL, -0xe0397a2eUL, 0x5727cb79UL, 0x9ceb418fUL, 0x1cacd68dUL, 0x2ad37c96UL, 0x0175cb9dUL, -0xc69dff09UL, 0xc75b65f0UL, 0xd9db40d8UL, 0xec0e7779UL, 0x4744ead4UL, 0xb11c3274UL, -0xdd24cb9eUL, 0x7e1c54bdUL, 0xf01144f9UL, 0xd2240eb1UL, 0x9675b3fdUL, 0xa3ac3755UL, -0xd47c27afUL, 0x51c85f4dUL, 0x56907596UL, 0xa5bb15e6UL, 0x580304f0UL, 0xca042cf1UL, -0x011a37eaUL, 0x8dbfaadbUL, 0x35ba3e4aUL, 0x3526ffa0UL, 0xc37b4d09UL, 0xbc306ed9UL, -0x98a52666UL, 0x5648f725UL, 0xff5e569dUL, 0x0ced63d0UL, 0x7c63b2cfUL, 0x700b45e1UL, -0xd5ea50f1UL, 0x85a92872UL, 0xaf1fbda7UL, 0xd4234870UL, 0xa7870bf3UL, 0x2d3b4d79UL, -0x42e04198UL, 0x0cd0ede7UL, 0x26470db8UL, 0xf881814cUL, 0x474d6ad7UL, 0x7c0c5e5cUL, -0xd1231959UL, 0x381b7298UL, 0xf5d2f4dbUL, 0xab838653UL, 0x6e2f1e23UL, 0x83719c9eUL, -0xbd91e046UL, 0x9a56456eUL, 0xdc39200cUL, 0x20c8c571UL, 0x962bda1cUL, 0xe1e696ffUL, -0xb141ab08UL, 0x7cca89b9UL, 0x1a69e783UL, 0x02cc4843UL, 0xa2f7c579UL, 0x429ef47dUL, -0x427b169cUL, 0x5ac9f049UL, 0xdd8f0f00UL, 0x5c8165bfUL}; - -static const ulong32 S2[256] = { -0x1f201094UL, 0xef0ba75bUL, 0x69e3cf7eUL, 0x393f4380UL, 0xfe61cf7aUL, 0xeec5207aUL, -0x55889c94UL, 0x72fc0651UL, 0xada7ef79UL, 0x4e1d7235UL, 0xd55a63ceUL, 0xde0436baUL, -0x99c430efUL, 0x5f0c0794UL, 0x18dcdb7dUL, 0xa1d6eff3UL, 0xa0b52f7bUL, 0x59e83605UL, -0xee15b094UL, 0xe9ffd909UL, 0xdc440086UL, 0xef944459UL, 0xba83ccb3UL, 0xe0c3cdfbUL, -0xd1da4181UL, 0x3b092ab1UL, 0xf997f1c1UL, 0xa5e6cf7bUL, 0x01420ddbUL, 0xe4e7ef5bUL, -0x25a1ff41UL, 0xe180f806UL, 0x1fc41080UL, 0x179bee7aUL, 0xd37ac6a9UL, 0xfe5830a4UL, -0x98de8b7fUL, 0x77e83f4eUL, 0x79929269UL, 0x24fa9f7bUL, 0xe113c85bUL, 0xacc40083UL, -0xd7503525UL, 0xf7ea615fUL, 0x62143154UL, 0x0d554b63UL, 0x5d681121UL, 0xc866c359UL, -0x3d63cf73UL, 0xcee234c0UL, 0xd4d87e87UL, 0x5c672b21UL, 0x071f6181UL, 0x39f7627fUL, -0x361e3084UL, 0xe4eb573bUL, 0x602f64a4UL, 0xd63acd9cUL, 0x1bbc4635UL, 0x9e81032dUL, -0x2701f50cUL, 0x99847ab4UL, 0xa0e3df79UL, 0xba6cf38cUL, 0x10843094UL, 0x2537a95eUL, -0xf46f6ffeUL, 0xa1ff3b1fUL, 0x208cfb6aUL, 0x8f458c74UL, 0xd9e0a227UL, 0x4ec73a34UL, -0xfc884f69UL, 0x3e4de8dfUL, 0xef0e0088UL, 0x3559648dUL, 0x8a45388cUL, 0x1d804366UL, -0x721d9bfdUL, 0xa58684bbUL, 0xe8256333UL, 0x844e8212UL, 0x128d8098UL, 0xfed33fb4UL, -0xce280ae1UL, 0x27e19ba5UL, 0xd5a6c252UL, 0xe49754bdUL, 0xc5d655ddUL, 0xeb667064UL, -0x77840b4dUL, 0xa1b6a801UL, 0x84db26a9UL, 0xe0b56714UL, 0x21f043b7UL, 0xe5d05860UL, -0x54f03084UL, 0x066ff472UL, 0xa31aa153UL, 0xdadc4755UL, 0xb5625dbfUL, 0x68561be6UL, -0x83ca6b94UL, 0x2d6ed23bUL, 0xeccf01dbUL, 0xa6d3d0baUL, 0xb6803d5cUL, 0xaf77a709UL, -0x33b4a34cUL, 0x397bc8d6UL, 0x5ee22b95UL, 0x5f0e5304UL, 0x81ed6f61UL, 0x20e74364UL, -0xb45e1378UL, 0xde18639bUL, 0x881ca122UL, 0xb96726d1UL, 0x8049a7e8UL, 0x22b7da7bUL, -0x5e552d25UL, 0x5272d237UL, 0x79d2951cUL, 0xc60d894cUL, 0x488cb402UL, 0x1ba4fe5bUL, -0xa4b09f6bUL, 0x1ca815cfUL, 0xa20c3005UL, 0x8871df63UL, 0xb9de2fcbUL, 0x0cc6c9e9UL, -0x0beeff53UL, 0xe3214517UL, 0xb4542835UL, 0x9f63293cUL, 0xee41e729UL, 0x6e1d2d7cUL, -0x50045286UL, 0x1e6685f3UL, 0xf33401c6UL, 0x30a22c95UL, 0x31a70850UL, 0x60930f13UL, -0x73f98417UL, 0xa1269859UL, 0xec645c44UL, 0x52c877a9UL, 0xcdff33a6UL, 0xa02b1741UL, -0x7cbad9a2UL, 0x2180036fUL, 0x50d99c08UL, 0xcb3f4861UL, 0xc26bd765UL, 0x64a3f6abUL, -0x80342676UL, 0x25a75e7bUL, 0xe4e6d1fcUL, 0x20c710e6UL, 0xcdf0b680UL, 0x17844d3bUL, -0x31eef84dUL, 0x7e0824e4UL, 0x2ccb49ebUL, 0x846a3baeUL, 0x8ff77888UL, 0xee5d60f6UL, -0x7af75673UL, 0x2fdd5cdbUL, 0xa11631c1UL, 0x30f66f43UL, 0xb3faec54UL, 0x157fd7faUL, -0xef8579ccUL, 0xd152de58UL, 0xdb2ffd5eUL, 0x8f32ce19UL, 0x306af97aUL, 0x02f03ef8UL, -0x99319ad5UL, 0xc242fa0fUL, 0xa7e3ebb0UL, 0xc68e4906UL, 0xb8da230cUL, 0x80823028UL, -0xdcdef3c8UL, 0xd35fb171UL, 0x088a1bc8UL, 0xbec0c560UL, 0x61a3c9e8UL, 0xbca8f54dUL, -0xc72feffaUL, 0x22822e99UL, 0x82c570b4UL, 0xd8d94e89UL, 0x8b1c34bcUL, 0x301e16e6UL, -0x273be979UL, 0xb0ffeaa6UL, 0x61d9b8c6UL, 0x00b24869UL, 0xb7ffce3fUL, 0x08dc283bUL, -0x43daf65aUL, 0xf7e19798UL, 0x7619b72fUL, 0x8f1c9ba4UL, 0xdc8637a0UL, 0x16a7d3b1UL, -0x9fc393b7UL, 0xa7136eebUL, 0xc6bcc63eUL, 0x1a513742UL, 0xef6828bcUL, 0x520365d6UL, -0x2d6a77abUL, 0x3527ed4bUL, 0x821fd216UL, 0x095c6e2eUL, 0xdb92f2fbUL, 0x5eea29cbUL, -0x145892f5UL, 0x91584f7fUL, 0x5483697bUL, 0x2667a8ccUL, 0x85196048UL, 0x8c4baceaUL, -0x833860d4UL, 0x0d23e0f9UL, 0x6c387e8aUL, 0x0ae6d249UL, 0xb284600cUL, 0xd835731dUL, -0xdcb1c647UL, 0xac4c56eaUL, 0x3ebd81b3UL, 0x230eabb0UL, 0x6438bc87UL, 0xf0b5b1faUL, -0x8f5ea2b3UL, 0xfc184642UL, 0x0a036b7aUL, 0x4fb089bdUL, 0x649da589UL, 0xa345415eUL, -0x5c038323UL, 0x3e5d3bb9UL, 0x43d79572UL, 0x7e6dd07cUL, 0x06dfdf1eUL, 0x6c6cc4efUL, -0x7160a539UL, 0x73bfbe70UL, 0x83877605UL, 0x4523ecf1UL}; - -static const ulong32 S3[256] = { -0x8defc240UL, 0x25fa5d9fUL, 0xeb903dbfUL, 0xe810c907UL, 0x47607fffUL, 0x369fe44bUL, -0x8c1fc644UL, 0xaececa90UL, 0xbeb1f9bfUL, 0xeefbcaeaUL, 0xe8cf1950UL, 0x51df07aeUL, -0x920e8806UL, 0xf0ad0548UL, 0xe13c8d83UL, 0x927010d5UL, 0x11107d9fUL, 0x07647db9UL, -0xb2e3e4d4UL, 0x3d4f285eUL, 0xb9afa820UL, 0xfade82e0UL, 0xa067268bUL, 0x8272792eUL, -0x553fb2c0UL, 0x489ae22bUL, 0xd4ef9794UL, 0x125e3fbcUL, 0x21fffceeUL, 0x825b1bfdUL, -0x9255c5edUL, 0x1257a240UL, 0x4e1a8302UL, 0xbae07fffUL, 0x528246e7UL, 0x8e57140eUL, -0x3373f7bfUL, 0x8c9f8188UL, 0xa6fc4ee8UL, 0xc982b5a5UL, 0xa8c01db7UL, 0x579fc264UL, -0x67094f31UL, 0xf2bd3f5fUL, 0x40fff7c1UL, 0x1fb78dfcUL, 0x8e6bd2c1UL, 0x437be59bUL, -0x99b03dbfUL, 0xb5dbc64bUL, 0x638dc0e6UL, 0x55819d99UL, 0xa197c81cUL, 0x4a012d6eUL, -0xc5884a28UL, 0xccc36f71UL, 0xb843c213UL, 0x6c0743f1UL, 0x8309893cUL, 0x0feddd5fUL, -0x2f7fe850UL, 0xd7c07f7eUL, 0x02507fbfUL, 0x5afb9a04UL, 0xa747d2d0UL, 0x1651192eUL, -0xaf70bf3eUL, 0x58c31380UL, 0x5f98302eUL, 0x727cc3c4UL, 0x0a0fb402UL, 0x0f7fef82UL, -0x8c96fdadUL, 0x5d2c2aaeUL, 0x8ee99a49UL, 0x50da88b8UL, 0x8427f4a0UL, 0x1eac5790UL, -0x796fb449UL, 0x8252dc15UL, 0xefbd7d9bUL, 0xa672597dUL, 0xada840d8UL, 0x45f54504UL, -0xfa5d7403UL, 0xe83ec305UL, 0x4f91751aUL, 0x925669c2UL, 0x23efe941UL, 0xa903f12eUL, -0x60270df2UL, 0x0276e4b6UL, 0x94fd6574UL, 0x927985b2UL, 0x8276dbcbUL, 0x02778176UL, -0xf8af918dUL, 0x4e48f79eUL, 0x8f616ddfUL, 0xe29d840eUL, 0x842f7d83UL, 0x340ce5c8UL, -0x96bbb682UL, 0x93b4b148UL, 0xef303cabUL, 0x984faf28UL, 0x779faf9bUL, 0x92dc560dUL, -0x224d1e20UL, 0x8437aa88UL, 0x7d29dc96UL, 0x2756d3dcUL, 0x8b907ceeUL, 0xb51fd240UL, -0xe7c07ce3UL, 0xe566b4a1UL, 0xc3e9615eUL, 0x3cf8209dUL, 0x6094d1e3UL, 0xcd9ca341UL, -0x5c76460eUL, 0x00ea983bUL, 0xd4d67881UL, 0xfd47572cUL, 0xf76cedd9UL, 0xbda8229cUL, -0x127dadaaUL, 0x438a074eUL, 0x1f97c090UL, 0x081bdb8aUL, 0x93a07ebeUL, 0xb938ca15UL, -0x97b03cffUL, 0x3dc2c0f8UL, 0x8d1ab2ecUL, 0x64380e51UL, 0x68cc7bfbUL, 0xd90f2788UL, -0x12490181UL, 0x5de5ffd4UL, 0xdd7ef86aUL, 0x76a2e214UL, 0xb9a40368UL, 0x925d958fUL, -0x4b39fffaUL, 0xba39aee9UL, 0xa4ffd30bUL, 0xfaf7933bUL, 0x6d498623UL, 0x193cbcfaUL, -0x27627545UL, 0x825cf47aUL, 0x61bd8ba0UL, 0xd11e42d1UL, 0xcead04f4UL, 0x127ea392UL, -0x10428db7UL, 0x8272a972UL, 0x9270c4a8UL, 0x127de50bUL, 0x285ba1c8UL, 0x3c62f44fUL, -0x35c0eaa5UL, 0xe805d231UL, 0x428929fbUL, 0xb4fcdf82UL, 0x4fb66a53UL, 0x0e7dc15bUL, -0x1f081fabUL, 0x108618aeUL, 0xfcfd086dUL, 0xf9ff2889UL, 0x694bcc11UL, 0x236a5caeUL, -0x12deca4dUL, 0x2c3f8cc5UL, 0xd2d02dfeUL, 0xf8ef5896UL, 0xe4cf52daUL, 0x95155b67UL, -0x494a488cUL, 0xb9b6a80cUL, 0x5c8f82bcUL, 0x89d36b45UL, 0x3a609437UL, 0xec00c9a9UL, -0x44715253UL, 0x0a874b49UL, 0xd773bc40UL, 0x7c34671cUL, 0x02717ef6UL, 0x4feb5536UL, -0xa2d02fffUL, 0xd2bf60c4UL, 0xd43f03c0UL, 0x50b4ef6dUL, 0x07478cd1UL, 0x006e1888UL, -0xa2e53f55UL, 0xb9e6d4bcUL, 0xa2048016UL, 0x97573833UL, 0xd7207d67UL, 0xde0f8f3dUL, -0x72f87b33UL, 0xabcc4f33UL, 0x7688c55dUL, 0x7b00a6b0UL, 0x947b0001UL, 0x570075d2UL, -0xf9bb88f8UL, 0x8942019eUL, 0x4264a5ffUL, 0x856302e0UL, 0x72dbd92bUL, 0xee971b69UL, -0x6ea22fdeUL, 0x5f08ae2bUL, 0xaf7a616dUL, 0xe5c98767UL, 0xcf1febd2UL, 0x61efc8c2UL, -0xf1ac2571UL, 0xcc8239c2UL, 0x67214cb8UL, 0xb1e583d1UL, 0xb7dc3e62UL, 0x7f10bdceUL, -0xf90a5c38UL, 0x0ff0443dUL, 0x606e6dc6UL, 0x60543a49UL, 0x5727c148UL, 0x2be98a1dUL, -0x8ab41738UL, 0x20e1be24UL, 0xaf96da0fUL, 0x68458425UL, 0x99833be5UL, 0x600d457dUL, -0x282f9350UL, 0x8334b362UL, 0xd91d1120UL, 0x2b6d8da0UL, 0x642b1e31UL, 0x9c305a00UL, -0x52bce688UL, 0x1b03588aUL, 0xf7baefd5UL, 0x4142ed9cUL, 0xa4315c11UL, 0x83323ec5UL, -0xdfef4636UL, 0xa133c501UL, 0xe9d3531cUL, 0xee353783UL}; - -static const ulong32 S4[256] = { -0x9db30420UL, 0x1fb6e9deUL, 0xa7be7befUL, 0xd273a298UL, 0x4a4f7bdbUL, 0x64ad8c57UL, -0x85510443UL, 0xfa020ed1UL, 0x7e287affUL, 0xe60fb663UL, 0x095f35a1UL, 0x79ebf120UL, -0xfd059d43UL, 0x6497b7b1UL, 0xf3641f63UL, 0x241e4adfUL, 0x28147f5fUL, 0x4fa2b8cdUL, -0xc9430040UL, 0x0cc32220UL, 0xfdd30b30UL, 0xc0a5374fUL, 0x1d2d00d9UL, 0x24147b15UL, -0xee4d111aUL, 0x0fca5167UL, 0x71ff904cUL, 0x2d195ffeUL, 0x1a05645fUL, 0x0c13fefeUL, -0x081b08caUL, 0x05170121UL, 0x80530100UL, 0xe83e5efeUL, 0xac9af4f8UL, 0x7fe72701UL, -0xd2b8ee5fUL, 0x06df4261UL, 0xbb9e9b8aUL, 0x7293ea25UL, 0xce84ffdfUL, 0xf5718801UL, -0x3dd64b04UL, 0xa26f263bUL, 0x7ed48400UL, 0x547eebe6UL, 0x446d4ca0UL, 0x6cf3d6f5UL, -0x2649abdfUL, 0xaea0c7f5UL, 0x36338cc1UL, 0x503f7e93UL, 0xd3772061UL, 0x11b638e1UL, -0x72500e03UL, 0xf80eb2bbUL, 0xabe0502eUL, 0xec8d77deUL, 0x57971e81UL, 0xe14f6746UL, -0xc9335400UL, 0x6920318fUL, 0x081dbb99UL, 0xffc304a5UL, 0x4d351805UL, 0x7f3d5ce3UL, -0xa6c866c6UL, 0x5d5bcca9UL, 0xdaec6feaUL, 0x9f926f91UL, 0x9f46222fUL, 0x3991467dUL, -0xa5bf6d8eUL, 0x1143c44fUL, 0x43958302UL, 0xd0214eebUL, 0x022083b8UL, 0x3fb6180cUL, -0x18f8931eUL, 0x281658e6UL, 0x26486e3eUL, 0x8bd78a70UL, 0x7477e4c1UL, 0xb506e07cUL, -0xf32d0a25UL, 0x79098b02UL, 0xe4eabb81UL, 0x28123b23UL, 0x69dead38UL, 0x1574ca16UL, -0xdf871b62UL, 0x211c40b7UL, 0xa51a9ef9UL, 0x0014377bUL, 0x041e8ac8UL, 0x09114003UL, -0xbd59e4d2UL, 0xe3d156d5UL, 0x4fe876d5UL, 0x2f91a340UL, 0x557be8deUL, 0x00eae4a7UL, -0x0ce5c2ecUL, 0x4db4bba6UL, 0xe756bdffUL, 0xdd3369acUL, 0xec17b035UL, 0x06572327UL, -0x99afc8b0UL, 0x56c8c391UL, 0x6b65811cUL, 0x5e146119UL, 0x6e85cb75UL, 0xbe07c002UL, -0xc2325577UL, 0x893ff4ecUL, 0x5bbfc92dUL, 0xd0ec3b25UL, 0xb7801ab7UL, 0x8d6d3b24UL, -0x20c763efUL, 0xc366a5fcUL, 0x9c382880UL, 0x0ace3205UL, 0xaac9548aUL, 0xeca1d7c7UL, -0x041afa32UL, 0x1d16625aUL, 0x6701902cUL, 0x9b757a54UL, 0x31d477f7UL, 0x9126b031UL, -0x36cc6fdbUL, 0xc70b8b46UL, 0xd9e66a48UL, 0x56e55a79UL, 0x026a4cebUL, 0x52437effUL, -0x2f8f76b4UL, 0x0df980a5UL, 0x8674cde3UL, 0xedda04ebUL, 0x17a9be04UL, 0x2c18f4dfUL, -0xb7747f9dUL, 0xab2af7b4UL, 0xefc34d20UL, 0x2e096b7cUL, 0x1741a254UL, 0xe5b6a035UL, -0x213d42f6UL, 0x2c1c7c26UL, 0x61c2f50fUL, 0x6552daf9UL, 0xd2c231f8UL, 0x25130f69UL, -0xd8167fa2UL, 0x0418f2c8UL, 0x001a96a6UL, 0x0d1526abUL, 0x63315c21UL, 0x5e0a72ecUL, -0x49bafefdUL, 0x187908d9UL, 0x8d0dbd86UL, 0x311170a7UL, 0x3e9b640cUL, 0xcc3e10d7UL, -0xd5cad3b6UL, 0x0caec388UL, 0xf73001e1UL, 0x6c728affUL, 0x71eae2a1UL, 0x1f9af36eUL, -0xcfcbd12fUL, 0xc1de8417UL, 0xac07be6bUL, 0xcb44a1d8UL, 0x8b9b0f56UL, 0x013988c3UL, -0xb1c52fcaUL, 0xb4be31cdUL, 0xd8782806UL, 0x12a3a4e2UL, 0x6f7de532UL, 0x58fd7eb6UL, -0xd01ee900UL, 0x24adffc2UL, 0xf4990fc5UL, 0x9711aac5UL, 0x001d7b95UL, 0x82e5e7d2UL, -0x109873f6UL, 0x00613096UL, 0xc32d9521UL, 0xada121ffUL, 0x29908415UL, 0x7fbb977fUL, -0xaf9eb3dbUL, 0x29c9ed2aUL, 0x5ce2a465UL, 0xa730f32cUL, 0xd0aa3fe8UL, 0x8a5cc091UL, -0xd49e2ce7UL, 0x0ce454a9UL, 0xd60acd86UL, 0x015f1919UL, 0x77079103UL, 0xdea03af6UL, -0x78a8565eUL, 0xdee356dfUL, 0x21f05cbeUL, 0x8b75e387UL, 0xb3c50651UL, 0xb8a5c3efUL, -0xd8eeb6d2UL, 0xe523be77UL, 0xc2154529UL, 0x2f69efdfUL, 0xafe67afbUL, 0xf470c4b2UL, -0xf3e0eb5bUL, 0xd6cc9876UL, 0x39e4460cUL, 0x1fda8538UL, 0x1987832fUL, 0xca007367UL, -0xa99144f8UL, 0x296b299eUL, 0x492fc295UL, 0x9266beabUL, 0xb5676e69UL, 0x9bd3dddaUL, -0xdf7e052fUL, 0xdb25701cUL, 0x1b5e51eeUL, 0xf65324e6UL, 0x6afce36cUL, 0x0316cc04UL, -0x8644213eUL, 0xb7dc59d0UL, 0x7965291fUL, 0xccd6fd43UL, 0x41823979UL, 0x932bcdf6UL, -0xb657c34dUL, 0x4edfd282UL, 0x7ae5290cUL, 0x3cb9536bUL, 0x851e20feUL, 0x9833557eUL, -0x13ecf0b0UL, 0xd3ffb372UL, 0x3f85c5c1UL, 0x0aef7ed2UL}; - -static const ulong32 S5[256] = { -0x7ec90c04UL, 0x2c6e74b9UL, 0x9b0e66dfUL, 0xa6337911UL, 0xb86a7fffUL, 0x1dd358f5UL, -0x44dd9d44UL, 0x1731167fUL, 0x08fbf1faUL, 0xe7f511ccUL, 0xd2051b00UL, 0x735aba00UL, -0x2ab722d8UL, 0x386381cbUL, 0xacf6243aUL, 0x69befd7aUL, 0xe6a2e77fUL, 0xf0c720cdUL, -0xc4494816UL, 0xccf5c180UL, 0x38851640UL, 0x15b0a848UL, 0xe68b18cbUL, 0x4caadeffUL, -0x5f480a01UL, 0x0412b2aaUL, 0x259814fcUL, 0x41d0efe2UL, 0x4e40b48dUL, 0x248eb6fbUL, -0x8dba1cfeUL, 0x41a99b02UL, 0x1a550a04UL, 0xba8f65cbUL, 0x7251f4e7UL, 0x95a51725UL, -0xc106ecd7UL, 0x97a5980aUL, 0xc539b9aaUL, 0x4d79fe6aUL, 0xf2f3f763UL, 0x68af8040UL, -0xed0c9e56UL, 0x11b4958bUL, 0xe1eb5a88UL, 0x8709e6b0UL, 0xd7e07156UL, 0x4e29fea7UL, -0x6366e52dUL, 0x02d1c000UL, 0xc4ac8e05UL, 0x9377f571UL, 0x0c05372aUL, 0x578535f2UL, -0x2261be02UL, 0xd642a0c9UL, 0xdf13a280UL, 0x74b55bd2UL, 0x682199c0UL, 0xd421e5ecUL, -0x53fb3ce8UL, 0xc8adedb3UL, 0x28a87fc9UL, 0x3d959981UL, 0x5c1ff900UL, 0xfe38d399UL, -0x0c4eff0bUL, 0x062407eaUL, 0xaa2f4fb1UL, 0x4fb96976UL, 0x90c79505UL, 0xb0a8a774UL, -0xef55a1ffUL, 0xe59ca2c2UL, 0xa6b62d27UL, 0xe66a4263UL, 0xdf65001fUL, 0x0ec50966UL, -0xdfdd55bcUL, 0x29de0655UL, 0x911e739aUL, 0x17af8975UL, 0x32c7911cUL, 0x89f89468UL, -0x0d01e980UL, 0x524755f4UL, 0x03b63cc9UL, 0x0cc844b2UL, 0xbcf3f0aaUL, 0x87ac36e9UL, -0xe53a7426UL, 0x01b3d82bUL, 0x1a9e7449UL, 0x64ee2d7eUL, 0xcddbb1daUL, 0x01c94910UL, -0xb868bf80UL, 0x0d26f3fdUL, 0x9342ede7UL, 0x04a5c284UL, 0x636737b6UL, 0x50f5b616UL, -0xf24766e3UL, 0x8eca36c1UL, 0x136e05dbUL, 0xfef18391UL, 0xfb887a37UL, 0xd6e7f7d4UL, -0xc7fb7dc9UL, 0x3063fcdfUL, 0xb6f589deUL, 0xec2941daUL, 0x26e46695UL, 0xb7566419UL, -0xf654efc5UL, 0xd08d58b7UL, 0x48925401UL, 0xc1bacb7fUL, 0xe5ff550fUL, 0xb6083049UL, -0x5bb5d0e8UL, 0x87d72e5aUL, 0xab6a6ee1UL, 0x223a66ceUL, 0xc62bf3cdUL, 0x9e0885f9UL, -0x68cb3e47UL, 0x086c010fUL, 0xa21de820UL, 0xd18b69deUL, 0xf3f65777UL, 0xfa02c3f6UL, -0x407edac3UL, 0xcbb3d550UL, 0x1793084dUL, 0xb0d70ebaUL, 0x0ab378d5UL, 0xd951fb0cUL, -0xded7da56UL, 0x4124bbe4UL, 0x94ca0b56UL, 0x0f5755d1UL, 0xe0e1e56eUL, 0x6184b5beUL, -0x580a249fUL, 0x94f74bc0UL, 0xe327888eUL, 0x9f7b5561UL, 0xc3dc0280UL, 0x05687715UL, -0x646c6bd7UL, 0x44904db3UL, 0x66b4f0a3UL, 0xc0f1648aUL, 0x697ed5afUL, 0x49e92ff6UL, -0x309e374fUL, 0x2cb6356aUL, 0x85808573UL, 0x4991f840UL, 0x76f0ae02UL, 0x083be84dUL, -0x28421c9aUL, 0x44489406UL, 0x736e4cb8UL, 0xc1092910UL, 0x8bc95fc6UL, 0x7d869cf4UL, -0x134f616fUL, 0x2e77118dUL, 0xb31b2be1UL, 0xaa90b472UL, 0x3ca5d717UL, 0x7d161bbaUL, -0x9cad9010UL, 0xaf462ba2UL, 0x9fe459d2UL, 0x45d34559UL, 0xd9f2da13UL, 0xdbc65487UL, -0xf3e4f94eUL, 0x176d486fUL, 0x097c13eaUL, 0x631da5c7UL, 0x445f7382UL, 0x175683f4UL, -0xcdc66a97UL, 0x70be0288UL, 0xb3cdcf72UL, 0x6e5dd2f3UL, 0x20936079UL, 0x459b80a5UL, -0xbe60e2dbUL, 0xa9c23101UL, 0xeba5315cUL, 0x224e42f2UL, 0x1c5c1572UL, 0xf6721b2cUL, -0x1ad2fff3UL, 0x8c25404eUL, 0x324ed72fUL, 0x4067b7fdUL, 0x0523138eUL, 0x5ca3bc78UL, -0xdc0fd66eUL, 0x75922283UL, 0x784d6b17UL, 0x58ebb16eUL, 0x44094f85UL, 0x3f481d87UL, -0xfcfeae7bUL, 0x77b5ff76UL, 0x8c2302bfUL, 0xaaf47556UL, 0x5f46b02aUL, 0x2b092801UL, -0x3d38f5f7UL, 0x0ca81f36UL, 0x52af4a8aUL, 0x66d5e7c0UL, 0xdf3b0874UL, 0x95055110UL, -0x1b5ad7a8UL, 0xf61ed5adUL, 0x6cf6e479UL, 0x20758184UL, 0xd0cefa65UL, 0x88f7be58UL, -0x4a046826UL, 0x0ff6f8f3UL, 0xa09c7f70UL, 0x5346aba0UL, 0x5ce96c28UL, 0xe176eda3UL, -0x6bac307fUL, 0x376829d2UL, 0x85360fa9UL, 0x17e3fe2aUL, 0x24b79767UL, 0xf5a96b20UL, -0xd6cd2595UL, 0x68ff1ebfUL, 0x7555442cUL, 0xf19f06beUL, 0xf9e0659aUL, 0xeeb9491dUL, -0x34010718UL, 0xbb30cab8UL, 0xe822fe15UL, 0x88570983UL, 0x750e6249UL, 0xda627e55UL, -0x5e76ffa8UL, 0xb1534546UL, 0x6d47de08UL, 0xefe9e7d4UL}; - -static const ulong32 S6[256] = { -0xf6fa8f9dUL, 0x2cac6ce1UL, 0x4ca34867UL, 0xe2337f7cUL, 0x95db08e7UL, 0x016843b4UL, -0xeced5cbcUL, 0x325553acUL, 0xbf9f0960UL, 0xdfa1e2edUL, 0x83f0579dUL, 0x63ed86b9UL, -0x1ab6a6b8UL, 0xde5ebe39UL, 0xf38ff732UL, 0x8989b138UL, 0x33f14961UL, 0xc01937bdUL, -0xf506c6daUL, 0xe4625e7eUL, 0xa308ea99UL, 0x4e23e33cUL, 0x79cbd7ccUL, 0x48a14367UL, -0xa3149619UL, 0xfec94bd5UL, 0xa114174aUL, 0xeaa01866UL, 0xa084db2dUL, 0x09a8486fUL, -0xa888614aUL, 0x2900af98UL, 0x01665991UL, 0xe1992863UL, 0xc8f30c60UL, 0x2e78ef3cUL, -0xd0d51932UL, 0xcf0fec14UL, 0xf7ca07d2UL, 0xd0a82072UL, 0xfd41197eUL, 0x9305a6b0UL, -0xe86be3daUL, 0x74bed3cdUL, 0x372da53cUL, 0x4c7f4448UL, 0xdab5d440UL, 0x6dba0ec3UL, -0x083919a7UL, 0x9fbaeed9UL, 0x49dbcfb0UL, 0x4e670c53UL, 0x5c3d9c01UL, 0x64bdb941UL, -0x2c0e636aUL, 0xba7dd9cdUL, 0xea6f7388UL, 0xe70bc762UL, 0x35f29adbUL, 0x5c4cdd8dUL, -0xf0d48d8cUL, 0xb88153e2UL, 0x08a19866UL, 0x1ae2eac8UL, 0x284caf89UL, 0xaa928223UL, -0x9334be53UL, 0x3b3a21bfUL, 0x16434be3UL, 0x9aea3906UL, 0xefe8c36eUL, 0xf890cdd9UL, -0x80226daeUL, 0xc340a4a3UL, 0xdf7e9c09UL, 0xa694a807UL, 0x5b7c5eccUL, 0x221db3a6UL, -0x9a69a02fUL, 0x68818a54UL, 0xceb2296fUL, 0x53c0843aUL, 0xfe893655UL, 0x25bfe68aUL, -0xb4628abcUL, 0xcf222ebfUL, 0x25ac6f48UL, 0xa9a99387UL, 0x53bddb65UL, 0xe76ffbe7UL, -0xe967fd78UL, 0x0ba93563UL, 0x8e342bc1UL, 0xe8a11be9UL, 0x4980740dUL, 0xc8087dfcUL, -0x8de4bf99UL, 0xa11101a0UL, 0x7fd37975UL, 0xda5a26c0UL, 0xe81f994fUL, 0x9528cd89UL, -0xfd339fedUL, 0xb87834bfUL, 0x5f04456dUL, 0x22258698UL, 0xc9c4c83bUL, 0x2dc156beUL, -0x4f628daaUL, 0x57f55ec5UL, 0xe2220abeUL, 0xd2916ebfUL, 0x4ec75b95UL, 0x24f2c3c0UL, -0x42d15d99UL, 0xcd0d7fa0UL, 0x7b6e27ffUL, 0xa8dc8af0UL, 0x7345c106UL, 0xf41e232fUL, -0x35162386UL, 0xe6ea8926UL, 0x3333b094UL, 0x157ec6f2UL, 0x372b74afUL, 0x692573e4UL, -0xe9a9d848UL, 0xf3160289UL, 0x3a62ef1dUL, 0xa787e238UL, 0xf3a5f676UL, 0x74364853UL, -0x20951063UL, 0x4576698dUL, 0xb6fad407UL, 0x592af950UL, 0x36f73523UL, 0x4cfb6e87UL, -0x7da4cec0UL, 0x6c152daaUL, 0xcb0396a8UL, 0xc50dfe5dUL, 0xfcd707abUL, 0x0921c42fUL, -0x89dff0bbUL, 0x5fe2be78UL, 0x448f4f33UL, 0x754613c9UL, 0x2b05d08dUL, 0x48b9d585UL, -0xdc049441UL, 0xc8098f9bUL, 0x7dede786UL, 0xc39a3373UL, 0x42410005UL, 0x6a091751UL, -0x0ef3c8a6UL, 0x890072d6UL, 0x28207682UL, 0xa9a9f7beUL, 0xbf32679dUL, 0xd45b5b75UL, -0xb353fd00UL, 0xcbb0e358UL, 0x830f220aUL, 0x1f8fb214UL, 0xd372cf08UL, 0xcc3c4a13UL, -0x8cf63166UL, 0x061c87beUL, 0x88c98f88UL, 0x6062e397UL, 0x47cf8e7aUL, 0xb6c85283UL, -0x3cc2acfbUL, 0x3fc06976UL, 0x4e8f0252UL, 0x64d8314dUL, 0xda3870e3UL, 0x1e665459UL, -0xc10908f0UL, 0x513021a5UL, 0x6c5b68b7UL, 0x822f8aa0UL, 0x3007cd3eUL, 0x74719eefUL, -0xdc872681UL, 0x073340d4UL, 0x7e432fd9UL, 0x0c5ec241UL, 0x8809286cUL, 0xf592d891UL, -0x08a930f6UL, 0x957ef305UL, 0xb7fbffbdUL, 0xc266e96fUL, 0x6fe4ac98UL, 0xb173ecc0UL, -0xbc60b42aUL, 0x953498daUL, 0xfba1ae12UL, 0x2d4bd736UL, 0x0f25faabUL, 0xa4f3fcebUL, -0xe2969123UL, 0x257f0c3dUL, 0x9348af49UL, 0x361400bcUL, 0xe8816f4aUL, 0x3814f200UL, -0xa3f94043UL, 0x9c7a54c2UL, 0xbc704f57UL, 0xda41e7f9UL, 0xc25ad33aUL, 0x54f4a084UL, -0xb17f5505UL, 0x59357cbeUL, 0xedbd15c8UL, 0x7f97c5abUL, 0xba5ac7b5UL, 0xb6f6deafUL, -0x3a479c3aUL, 0x5302da25UL, 0x653d7e6aUL, 0x54268d49UL, 0x51a477eaUL, 0x5017d55bUL, -0xd7d25d88UL, 0x44136c76UL, 0x0404a8c8UL, 0xb8e5a121UL, 0xb81a928aUL, 0x60ed5869UL, -0x97c55b96UL, 0xeaec991bUL, 0x29935913UL, 0x01fdb7f1UL, 0x088e8dfaUL, 0x9ab6f6f5UL, -0x3b4cbf9fUL, 0x4a5de3abUL, 0xe6051d35UL, 0xa0e1d855UL, 0xd36b4cf1UL, 0xf544edebUL, -0xb0e93524UL, 0xbebb8fbdUL, 0xa2d762cfUL, 0x49c92f54UL, 0x38b5f331UL, 0x7128a454UL, -0x48392905UL, 0xa65b1db8UL, 0x851c97bdUL, 0xd675cf2fUL}; - -static const ulong32 S7[256] = { -0x85e04019UL, 0x332bf567UL, 0x662dbfffUL, 0xcfc65693UL, 0x2a8d7f6fUL, 0xab9bc912UL, -0xde6008a1UL, 0x2028da1fUL, 0x0227bce7UL, 0x4d642916UL, 0x18fac300UL, 0x50f18b82UL, -0x2cb2cb11UL, 0xb232e75cUL, 0x4b3695f2UL, 0xb28707deUL, 0xa05fbcf6UL, 0xcd4181e9UL, -0xe150210cUL, 0xe24ef1bdUL, 0xb168c381UL, 0xfde4e789UL, 0x5c79b0d8UL, 0x1e8bfd43UL, -0x4d495001UL, 0x38be4341UL, 0x913cee1dUL, 0x92a79c3fUL, 0x089766beUL, 0xbaeeadf4UL, -0x1286becfUL, 0xb6eacb19UL, 0x2660c200UL, 0x7565bde4UL, 0x64241f7aUL, 0x8248dca9UL, -0xc3b3ad66UL, 0x28136086UL, 0x0bd8dfa8UL, 0x356d1cf2UL, 0x107789beUL, 0xb3b2e9ceUL, -0x0502aa8fUL, 0x0bc0351eUL, 0x166bf52aUL, 0xeb12ff82UL, 0xe3486911UL, 0xd34d7516UL, -0x4e7b3affUL, 0x5f43671bUL, 0x9cf6e037UL, 0x4981ac83UL, 0x334266ceUL, 0x8c9341b7UL, -0xd0d854c0UL, 0xcb3a6c88UL, 0x47bc2829UL, 0x4725ba37UL, 0xa66ad22bUL, 0x7ad61f1eUL, -0x0c5cbafaUL, 0x4437f107UL, 0xb6e79962UL, 0x42d2d816UL, 0x0a961288UL, 0xe1a5c06eUL, -0x13749e67UL, 0x72fc081aUL, 0xb1d139f7UL, 0xf9583745UL, 0xcf19df58UL, 0xbec3f756UL, -0xc06eba30UL, 0x07211b24UL, 0x45c28829UL, 0xc95e317fUL, 0xbc8ec511UL, 0x38bc46e9UL, -0xc6e6fa14UL, 0xbae8584aUL, 0xad4ebc46UL, 0x468f508bUL, 0x7829435fUL, 0xf124183bUL, -0x821dba9fUL, 0xaff60ff4UL, 0xea2c4e6dUL, 0x16e39264UL, 0x92544a8bUL, 0x009b4fc3UL, -0xaba68cedUL, 0x9ac96f78UL, 0x06a5b79aUL, 0xb2856e6eUL, 0x1aec3ca9UL, 0xbe838688UL, -0x0e0804e9UL, 0x55f1be56UL, 0xe7e5363bUL, 0xb3a1f25dUL, 0xf7debb85UL, 0x61fe033cUL, -0x16746233UL, 0x3c034c28UL, 0xda6d0c74UL, 0x79aac56cUL, 0x3ce4e1adUL, 0x51f0c802UL, -0x98f8f35aUL, 0x1626a49fUL, 0xeed82b29UL, 0x1d382fe3UL, 0x0c4fb99aUL, 0xbb325778UL, -0x3ec6d97bUL, 0x6e77a6a9UL, 0xcb658b5cUL, 0xd45230c7UL, 0x2bd1408bUL, 0x60c03eb7UL, -0xb9068d78UL, 0xa33754f4UL, 0xf430c87dUL, 0xc8a71302UL, 0xb96d8c32UL, 0xebd4e7beUL, -0xbe8b9d2dUL, 0x7979fb06UL, 0xe7225308UL, 0x8b75cf77UL, 0x11ef8da4UL, 0xe083c858UL, -0x8d6b786fUL, 0x5a6317a6UL, 0xfa5cf7a0UL, 0x5dda0033UL, 0xf28ebfb0UL, 0xf5b9c310UL, -0xa0eac280UL, 0x08b9767aUL, 0xa3d9d2b0UL, 0x79d34217UL, 0x021a718dUL, 0x9ac6336aUL, -0x2711fd60UL, 0x438050e3UL, 0x069908a8UL, 0x3d7fedc4UL, 0x826d2befUL, 0x4eeb8476UL, -0x488dcf25UL, 0x36c9d566UL, 0x28e74e41UL, 0xc2610acaUL, 0x3d49a9cfUL, 0xbae3b9dfUL, -0xb65f8de6UL, 0x92aeaf64UL, 0x3ac7d5e6UL, 0x9ea80509UL, 0xf22b017dUL, 0xa4173f70UL, -0xdd1e16c3UL, 0x15e0d7f9UL, 0x50b1b887UL, 0x2b9f4fd5UL, 0x625aba82UL, 0x6a017962UL, -0x2ec01b9cUL, 0x15488aa9UL, 0xd716e740UL, 0x40055a2cUL, 0x93d29a22UL, 0xe32dbf9aUL, -0x058745b9UL, 0x3453dc1eUL, 0xd699296eUL, 0x496cff6fUL, 0x1c9f4986UL, 0xdfe2ed07UL, -0xb87242d1UL, 0x19de7eaeUL, 0x053e561aUL, 0x15ad6f8cUL, 0x66626c1cUL, 0x7154c24cUL, -0xea082b2aUL, 0x93eb2939UL, 0x17dcb0f0UL, 0x58d4f2aeUL, 0x9ea294fbUL, 0x52cf564cUL, -0x9883fe66UL, 0x2ec40581UL, 0x763953c3UL, 0x01d6692eUL, 0xd3a0c108UL, 0xa1e7160eUL, -0xe4f2dfa6UL, 0x693ed285UL, 0x74904698UL, 0x4c2b0eddUL, 0x4f757656UL, 0x5d393378UL, -0xa132234fUL, 0x3d321c5dUL, 0xc3f5e194UL, 0x4b269301UL, 0xc79f022fUL, 0x3c997e7eUL, -0x5e4f9504UL, 0x3ffafbbdUL, 0x76f7ad0eUL, 0x296693f4UL, 0x3d1fce6fUL, 0xc61e45beUL, -0xd3b5ab34UL, 0xf72bf9b7UL, 0x1b0434c0UL, 0x4e72b567UL, 0x5592a33dUL, 0xb5229301UL, -0xcfd2a87fUL, 0x60aeb767UL, 0x1814386bUL, 0x30bcc33dUL, 0x38a0c07dUL, 0xfd1606f2UL, -0xc363519bUL, 0x589dd390UL, 0x5479f8e6UL, 0x1cb8d647UL, 0x97fd61a9UL, 0xea7759f4UL, -0x2d57539dUL, 0x569a58cfUL, 0xe84e63adUL, 0x462e1b78UL, 0x6580f87eUL, 0xf3817914UL, -0x91da55f4UL, 0x40a230f3UL, 0xd1988f35UL, 0xb6e318d2UL, 0x3ffa50bcUL, 0x3d40f021UL, -0xc3c0bdaeUL, 0x4958c24cUL, 0x518f36b2UL, 0x84b1d370UL, 0x0fedce83UL, 0x878ddadaUL, -0xf2a279c7UL, 0x94e01be8UL, 0x90716f4bUL, 0x954b8aa3UL}; - -static const ulong32 S8[256] = { -0xe216300dUL, 0xbbddfffcUL, 0xa7ebdabdUL, 0x35648095UL, 0x7789f8b7UL, 0xe6c1121bUL, -0x0e241600UL, 0x052ce8b5UL, 0x11a9cfb0UL, 0xe5952f11UL, 0xece7990aUL, 0x9386d174UL, -0x2a42931cUL, 0x76e38111UL, 0xb12def3aUL, 0x37ddddfcUL, 0xde9adeb1UL, 0x0a0cc32cUL, -0xbe197029UL, 0x84a00940UL, 0xbb243a0fUL, 0xb4d137cfUL, 0xb44e79f0UL, 0x049eedfdUL, -0x0b15a15dUL, 0x480d3168UL, 0x8bbbde5aUL, 0x669ded42UL, 0xc7ece831UL, 0x3f8f95e7UL, -0x72df191bUL, 0x7580330dUL, 0x94074251UL, 0x5c7dcdfaUL, 0xabbe6d63UL, 0xaa402164UL, -0xb301d40aUL, 0x02e7d1caUL, 0x53571daeUL, 0x7a3182a2UL, 0x12a8ddecUL, 0xfdaa335dUL, -0x176f43e8UL, 0x71fb46d4UL, 0x38129022UL, 0xce949ad4UL, 0xb84769adUL, 0x965bd862UL, -0x82f3d055UL, 0x66fb9767UL, 0x15b80b4eUL, 0x1d5b47a0UL, 0x4cfde06fUL, 0xc28ec4b8UL, -0x57e8726eUL, 0x647a78fcUL, 0x99865d44UL, 0x608bd593UL, 0x6c200e03UL, 0x39dc5ff6UL, -0x5d0b00a3UL, 0xae63aff2UL, 0x7e8bd632UL, 0x70108c0cUL, 0xbbd35049UL, 0x2998df04UL, -0x980cf42aUL, 0x9b6df491UL, 0x9e7edd53UL, 0x06918548UL, 0x58cb7e07UL, 0x3b74ef2eUL, -0x522fffb1UL, 0xd24708ccUL, 0x1c7e27cdUL, 0xa4eb215bUL, 0x3cf1d2e2UL, 0x19b47a38UL, -0x424f7618UL, 0x35856039UL, 0x9d17dee7UL, 0x27eb35e6UL, 0xc9aff67bUL, 0x36baf5b8UL, -0x09c467cdUL, 0xc18910b1UL, 0xe11dbf7bUL, 0x06cd1af8UL, 0x7170c608UL, 0x2d5e3354UL, -0xd4de495aUL, 0x64c6d006UL, 0xbcc0c62cUL, 0x3dd00db3UL, 0x708f8f34UL, 0x77d51b42UL, -0x264f620fUL, 0x24b8d2bfUL, 0x15c1b79eUL, 0x46a52564UL, 0xf8d7e54eUL, 0x3e378160UL, -0x7895cda5UL, 0x859c15a5UL, 0xe6459788UL, 0xc37bc75fUL, 0xdb07ba0cUL, 0x0676a3abUL, -0x7f229b1eUL, 0x31842e7bUL, 0x24259fd7UL, 0xf8bef472UL, 0x835ffcb8UL, 0x6df4c1f2UL, -0x96f5b195UL, 0xfd0af0fcUL, 0xb0fe134cUL, 0xe2506d3dUL, 0x4f9b12eaUL, 0xf215f225UL, -0xa223736fUL, 0x9fb4c428UL, 0x25d04979UL, 0x34c713f8UL, 0xc4618187UL, 0xea7a6e98UL, -0x7cd16efcUL, 0x1436876cUL, 0xf1544107UL, 0xbedeee14UL, 0x56e9af27UL, 0xa04aa441UL, -0x3cf7c899UL, 0x92ecbae6UL, 0xdd67016dUL, 0x151682ebUL, 0xa842eedfUL, 0xfdba60b4UL, -0xf1907b75UL, 0x20e3030fUL, 0x24d8c29eUL, 0xe139673bUL, 0xefa63fb8UL, 0x71873054UL, -0xb6f2cf3bUL, 0x9f326442UL, 0xcb15a4ccUL, 0xb01a4504UL, 0xf1e47d8dUL, 0x844a1be5UL, -0xbae7dfdcUL, 0x42cbda70UL, 0xcd7dae0aUL, 0x57e85b7aUL, 0xd53f5af6UL, 0x20cf4d8cUL, -0xcea4d428UL, 0x79d130a4UL, 0x3486ebfbUL, 0x33d3cddcUL, 0x77853b53UL, 0x37effcb5UL, -0xc5068778UL, 0xe580b3e6UL, 0x4e68b8f4UL, 0xc5c8b37eUL, 0x0d809ea2UL, 0x398feb7cUL, -0x132a4f94UL, 0x43b7950eUL, 0x2fee7d1cUL, 0x223613bdUL, 0xdd06caa2UL, 0x37df932bUL, -0xc4248289UL, 0xacf3ebc3UL, 0x5715f6b7UL, 0xef3478ddUL, 0xf267616fUL, 0xc148cbe4UL, -0x9052815eUL, 0x5e410fabUL, 0xb48a2465UL, 0x2eda7fa4UL, 0xe87b40e4UL, 0xe98ea084UL, -0x5889e9e1UL, 0xefd390fcUL, 0xdd07d35bUL, 0xdb485694UL, 0x38d7e5b2UL, 0x57720101UL, -0x730edebcUL, 0x5b643113UL, 0x94917e4fUL, 0x503c2fbaUL, 0x646f1282UL, 0x7523d24aUL, -0xe0779695UL, 0xf9c17a8fUL, 0x7a5b2121UL, 0xd187b896UL, 0x29263a4dUL, 0xba510cdfUL, -0x81f47c9fUL, 0xad1163edUL, 0xea7b5965UL, 0x1a00726eUL, 0x11403092UL, 0x00da6d77UL, -0x4a0cdd61UL, 0xad1f4603UL, 0x605bdfb0UL, 0x9eedc364UL, 0x22ebe6a8UL, 0xcee7d28aUL, -0xa0e736a0UL, 0x5564a6b9UL, 0x10853209UL, 0xc7eb8f37UL, 0x2de705caUL, 0x8951570fUL, -0xdf09822bUL, 0xbd691a6cUL, 0xaa12e4f2UL, 0x87451c0fUL, 0xe0f6a27aUL, 0x3ada4819UL, -0x4cf1764fUL, 0x0d771c2bUL, 0x67cdb156UL, 0x350d8384UL, 0x5938fa0fUL, 0x42399ef3UL, -0x36997b07UL, 0x0e84093dUL, 0x4aa93e61UL, 0x8360d87bUL, 0x1fa98b0cUL, 0x1149382cUL, -0xe97625a5UL, 0x0614d1b7UL, 0x0e25244bUL, 0x0c768347UL, 0x589e8d82UL, 0x0d2059d1UL, -0xa466bb1eUL, 0xf8da0a82UL, 0x04f19130UL, 0xba6e4ec0UL, 0x99265164UL, 0x1ee7230dUL, -0x50b2ad80UL, 0xeaee6801UL, 0x8db2a283UL, 0xea8bf59eUL}; - -/* returns the i'th byte of a variable */ -#ifdef _MSC_VER - #define GB(x, i) ((unsigned char)((x[(15-i)>>2])>>(unsigned)(8*((15-i)&3)))) -#else - #define GB(x, i) (((x[(15-i)>>2])>>(unsigned)(8*((15-i)&3)))&255) -#endif - - /** - Initialize the LTC_CAST5 block cipher - @param key The symmetric key you wish to pass - @param keylen The key length in bytes - @param num_rounds The number of rounds desired (0 for default) - @param skey The key in as scheduled by this function. - @return CRYPT_OK if successful - */ -#ifdef LTC_CLEAN_STACK -static int _cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -#else -int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -#endif -{ - ulong32 x[4], z[4]; - unsigned char buf[16]; - int y, i; - - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(skey != NULL); - - if (num_rounds != 12 && num_rounds != 16 && num_rounds != 0) { - return CRYPT_INVALID_ROUNDS; - } - - if (num_rounds == 12 && keylen > 10) { - return CRYPT_INVALID_ROUNDS; - } - - if (keylen < 5 || keylen > 16) { - return CRYPT_INVALID_KEYSIZE; - } - - /* extend the key as required */ - zeromem(buf, sizeof(buf)); - XMEMCPY(buf, key, (size_t)keylen); - - /* load and start the awful looking network */ - for (y = 0; y < 4; y++) { - LOAD32H(x[3-y],buf+4*y); - } - - for (i = y = 0; y < 2; y++) { - z[3] = x[3] ^ S5[GB(x, 0xD)] ^ S6[GB(x, 0xF)] ^ S7[GB(x, 0xC)] ^ S8[GB(x, 0xE)] ^ S7[GB(x, 0x8)]; - z[2] = x[1] ^ S5[GB(z, 0x0)] ^ S6[GB(z, 0x2)] ^ S7[GB(z, 0x1)] ^ S8[GB(z, 0x3)] ^ S8[GB(x, 0xA)]; - z[1] = x[0] ^ S5[GB(z, 0x7)] ^ S6[GB(z, 0x6)] ^ S7[GB(z, 0x5)] ^ S8[GB(z, 0x4)] ^ S5[GB(x, 0x9)]; - z[0] = x[2] ^ S5[GB(z, 0xA)] ^ S6[GB(z, 0x9)] ^ S7[GB(z, 0xb)] ^ S8[GB(z, 0x8)] ^ S6[GB(x, 0xB)]; - skey->cast5.K[i++] = S5[GB(z, 0x8)] ^ S6[GB(z, 0x9)] ^ S7[GB(z, 0x7)] ^ S8[GB(z, 0x6)] ^ S5[GB(z, 0x2)]; - skey->cast5.K[i++] = S5[GB(z, 0xA)] ^ S6[GB(z, 0xB)] ^ S7[GB(z, 0x5)] ^ S8[GB(z, 0x4)] ^ S6[GB(z, 0x6)]; - skey->cast5.K[i++] = S5[GB(z, 0xC)] ^ S6[GB(z, 0xd)] ^ S7[GB(z, 0x3)] ^ S8[GB(z, 0x2)] ^ S7[GB(z, 0x9)]; - skey->cast5.K[i++] = S5[GB(z, 0xE)] ^ S6[GB(z, 0xF)] ^ S7[GB(z, 0x1)] ^ S8[GB(z, 0x0)] ^ S8[GB(z, 0xc)]; - - x[3] = z[1] ^ S5[GB(z, 0x5)] ^ S6[GB(z, 0x7)] ^ S7[GB(z, 0x4)] ^ S8[GB(z, 0x6)] ^ S7[GB(z, 0x0)]; - x[2] = z[3] ^ S5[GB(x, 0x0)] ^ S6[GB(x, 0x2)] ^ S7[GB(x, 0x1)] ^ S8[GB(x, 0x3)] ^ S8[GB(z, 0x2)]; - x[1] = z[2] ^ S5[GB(x, 0x7)] ^ S6[GB(x, 0x6)] ^ S7[GB(x, 0x5)] ^ S8[GB(x, 0x4)] ^ S5[GB(z, 0x1)]; - x[0] = z[0] ^ S5[GB(x, 0xA)] ^ S6[GB(x, 0x9)] ^ S7[GB(x, 0xb)] ^ S8[GB(x, 0x8)] ^ S6[GB(z, 0x3)]; - skey->cast5.K[i++] = S5[GB(x, 0x3)] ^ S6[GB(x, 0x2)] ^ S7[GB(x, 0xc)] ^ S8[GB(x, 0xd)] ^ S5[GB(x, 0x8)]; - skey->cast5.K[i++] = S5[GB(x, 0x1)] ^ S6[GB(x, 0x0)] ^ S7[GB(x, 0xe)] ^ S8[GB(x, 0xf)] ^ S6[GB(x, 0xd)]; - skey->cast5.K[i++] = S5[GB(x, 0x7)] ^ S6[GB(x, 0x6)] ^ S7[GB(x, 0x8)] ^ S8[GB(x, 0x9)] ^ S7[GB(x, 0x3)]; - skey->cast5.K[i++] = S5[GB(x, 0x5)] ^ S6[GB(x, 0x4)] ^ S7[GB(x, 0xa)] ^ S8[GB(x, 0xb)] ^ S8[GB(x, 0x7)]; - - /* second half */ - z[3] = x[3] ^ S5[GB(x, 0xD)] ^ S6[GB(x, 0xF)] ^ S7[GB(x, 0xC)] ^ S8[GB(x, 0xE)] ^ S7[GB(x, 0x8)]; - z[2] = x[1] ^ S5[GB(z, 0x0)] ^ S6[GB(z, 0x2)] ^ S7[GB(z, 0x1)] ^ S8[GB(z, 0x3)] ^ S8[GB(x, 0xA)]; - z[1] = x[0] ^ S5[GB(z, 0x7)] ^ S6[GB(z, 0x6)] ^ S7[GB(z, 0x5)] ^ S8[GB(z, 0x4)] ^ S5[GB(x, 0x9)]; - z[0] = x[2] ^ S5[GB(z, 0xA)] ^ S6[GB(z, 0x9)] ^ S7[GB(z, 0xb)] ^ S8[GB(z, 0x8)] ^ S6[GB(x, 0xB)]; - skey->cast5.K[i++] = S5[GB(z, 0x3)] ^ S6[GB(z, 0x2)] ^ S7[GB(z, 0xc)] ^ S8[GB(z, 0xd)] ^ S5[GB(z, 0x9)]; - skey->cast5.K[i++] = S5[GB(z, 0x1)] ^ S6[GB(z, 0x0)] ^ S7[GB(z, 0xe)] ^ S8[GB(z, 0xf)] ^ S6[GB(z, 0xc)]; - skey->cast5.K[i++] = S5[GB(z, 0x7)] ^ S6[GB(z, 0x6)] ^ S7[GB(z, 0x8)] ^ S8[GB(z, 0x9)] ^ S7[GB(z, 0x2)]; - skey->cast5.K[i++] = S5[GB(z, 0x5)] ^ S6[GB(z, 0x4)] ^ S7[GB(z, 0xa)] ^ S8[GB(z, 0xb)] ^ S8[GB(z, 0x6)]; - - x[3] = z[1] ^ S5[GB(z, 0x5)] ^ S6[GB(z, 0x7)] ^ S7[GB(z, 0x4)] ^ S8[GB(z, 0x6)] ^ S7[GB(z, 0x0)]; - x[2] = z[3] ^ S5[GB(x, 0x0)] ^ S6[GB(x, 0x2)] ^ S7[GB(x, 0x1)] ^ S8[GB(x, 0x3)] ^ S8[GB(z, 0x2)]; - x[1] = z[2] ^ S5[GB(x, 0x7)] ^ S6[GB(x, 0x6)] ^ S7[GB(x, 0x5)] ^ S8[GB(x, 0x4)] ^ S5[GB(z, 0x1)]; - x[0] = z[0] ^ S5[GB(x, 0xA)] ^ S6[GB(x, 0x9)] ^ S7[GB(x, 0xb)] ^ S8[GB(x, 0x8)] ^ S6[GB(z, 0x3)]; - skey->cast5.K[i++] = S5[GB(x, 0x8)] ^ S6[GB(x, 0x9)] ^ S7[GB(x, 0x7)] ^ S8[GB(x, 0x6)] ^ S5[GB(x, 0x3)]; - skey->cast5.K[i++] = S5[GB(x, 0xa)] ^ S6[GB(x, 0xb)] ^ S7[GB(x, 0x5)] ^ S8[GB(x, 0x4)] ^ S6[GB(x, 0x7)]; - skey->cast5.K[i++] = S5[GB(x, 0xc)] ^ S6[GB(x, 0xd)] ^ S7[GB(x, 0x3)] ^ S8[GB(x, 0x2)] ^ S7[GB(x, 0x8)]; - skey->cast5.K[i++] = S5[GB(x, 0xe)] ^ S6[GB(x, 0xf)] ^ S7[GB(x, 0x1)] ^ S8[GB(x, 0x0)] ^ S8[GB(x, 0xd)]; - } - - skey->cast5.keylen = keylen; - -#ifdef LTC_CLEAN_STACK - zeromem(buf, sizeof(buf)); - zeromem(x, sizeof(x)); - zeromem(z, sizeof(z)); -#endif - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -{ - int z; - z = _cast5_setup(key, keylen, num_rounds, skey); - burn_stack(sizeof(ulong32)*8 + 16 + sizeof(int)*2); - return z; -} -#endif - -#ifdef _MSC_VER - #define INLINE __inline -#else - #define INLINE -#endif - -INLINE static ulong32 FI(ulong32 R, ulong32 Km, ulong32 Kr) -{ - ulong32 I; - I = (Km + R); - I = ROL(I, Kr); - return ((S1[byte(I, 3)] ^ S2[byte(I,2)]) - S3[byte(I,1)]) + S4[byte(I,0)]; -} - -INLINE static ulong32 FII(ulong32 R, ulong32 Km, ulong32 Kr) -{ - ulong32 I; - I = (Km ^ R); - I = ROL(I, Kr); - return ((S1[byte(I, 3)] - S2[byte(I,2)]) + S3[byte(I,1)]) ^ S4[byte(I,0)]; -} - -INLINE static ulong32 FIII(ulong32 R, ulong32 Km, ulong32 Kr) -{ - ulong32 I; - I = (Km - R); - I = ROL(I, Kr); - return ((S1[byte(I, 3)] + S2[byte(I,2)]) ^ S3[byte(I,1)]) - S4[byte(I,0)]; -} - -/** - Encrypts a block of text with LTC_CAST5 - @param pt The input plaintext (8 bytes) - @param ct The output ciphertext (8 bytes) - @param skey The key as scheduled -*/ -#ifdef LTC_CLEAN_STACK -static int _cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -#else -int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -#endif -{ - ulong32 R, L; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - - LOAD32H(L,&pt[0]); - LOAD32H(R,&pt[4]); - L ^= FI(R, skey->cast5.K[0], skey->cast5.K[16]); - R ^= FII(L, skey->cast5.K[1], skey->cast5.K[17]); - L ^= FIII(R, skey->cast5.K[2], skey->cast5.K[18]); - R ^= FI(L, skey->cast5.K[3], skey->cast5.K[19]); - L ^= FII(R, skey->cast5.K[4], skey->cast5.K[20]); - R ^= FIII(L, skey->cast5.K[5], skey->cast5.K[21]); - L ^= FI(R, skey->cast5.K[6], skey->cast5.K[22]); - R ^= FII(L, skey->cast5.K[7], skey->cast5.K[23]); - L ^= FIII(R, skey->cast5.K[8], skey->cast5.K[24]); - R ^= FI(L, skey->cast5.K[9], skey->cast5.K[25]); - L ^= FII(R, skey->cast5.K[10], skey->cast5.K[26]); - R ^= FIII(L, skey->cast5.K[11], skey->cast5.K[27]); - if (skey->cast5.keylen > 10) { - L ^= FI(R, skey->cast5.K[12], skey->cast5.K[28]); - R ^= FII(L, skey->cast5.K[13], skey->cast5.K[29]); - L ^= FIII(R, skey->cast5.K[14], skey->cast5.K[30]); - R ^= FI(L, skey->cast5.K[15], skey->cast5.K[31]); - } - STORE32H(R,&ct[0]); - STORE32H(L,&ct[4]); - return CRYPT_OK; -} - - -#ifdef LTC_CLEAN_STACK -int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -{ - int err =_cast5_ecb_encrypt(pt,ct,skey); - burn_stack(sizeof(ulong32)*3); - return err; -} -#endif - -/** - Decrypts a block of text with LTC_CAST5 - @param ct The input ciphertext (8 bytes) - @param pt The output plaintext (8 bytes) - @param skey The key as scheduled -*/ -#ifdef LTC_CLEAN_STACK -static int _cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -#else -int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -#endif -{ - ulong32 R, L; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - - LOAD32H(R,&ct[0]); - LOAD32H(L,&ct[4]); - if (skey->cast5.keylen > 10) { - R ^= FI(L, skey->cast5.K[15], skey->cast5.K[31]); - L ^= FIII(R, skey->cast5.K[14], skey->cast5.K[30]); - R ^= FII(L, skey->cast5.K[13], skey->cast5.K[29]); - L ^= FI(R, skey->cast5.K[12], skey->cast5.K[28]); - } - R ^= FIII(L, skey->cast5.K[11], skey->cast5.K[27]); - L ^= FII(R, skey->cast5.K[10], skey->cast5.K[26]); - R ^= FI(L, skey->cast5.K[9], skey->cast5.K[25]); - L ^= FIII(R, skey->cast5.K[8], skey->cast5.K[24]); - R ^= FII(L, skey->cast5.K[7], skey->cast5.K[23]); - L ^= FI(R, skey->cast5.K[6], skey->cast5.K[22]); - R ^= FIII(L, skey->cast5.K[5], skey->cast5.K[21]); - L ^= FII(R, skey->cast5.K[4], skey->cast5.K[20]); - R ^= FI(L, skey->cast5.K[3], skey->cast5.K[19]); - L ^= FIII(R, skey->cast5.K[2], skey->cast5.K[18]); - R ^= FII(L, skey->cast5.K[1], skey->cast5.K[17]); - L ^= FI(R, skey->cast5.K[0], skey->cast5.K[16]); - STORE32H(L,&pt[0]); - STORE32H(R,&pt[4]); - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -{ - int err = _cast5_ecb_decrypt(ct,pt,skey); - burn_stack(sizeof(ulong32)*3); - return err; -} -#endif - -/** - Performs a self-test of the LTC_CAST5 block cipher - @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled -*/ -int cast5_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - static const struct { - int keylen; - unsigned char key[16]; - unsigned char pt[8]; - unsigned char ct[8]; - } tests[] = { - { 16, - {0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9A}, - {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, - {0x23, 0x8B, 0x4F, 0xE5, 0x84, 0x7E, 0x44, 0xB2} - }, - { 10, - {0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, 0x23, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, - {0xEB, 0x6A, 0x71, 0x1A, 0x2C, 0x02, 0x27, 0x1B}, - }, - { 5, - {0x01, 0x23, 0x45, 0x67, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, - {0x7A, 0xC8, 0x16, 0xD1, 0x6E, 0x9B, 0x30, 0x2E} - } - }; - int i, y, err; - symmetric_key key; - unsigned char tmp[2][8]; - - for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { - if ((err = cast5_setup(tests[i].key, tests[i].keylen, 0, &key)) != CRYPT_OK) { - return err; - } - cast5_ecb_encrypt(tests[i].pt, tmp[0], &key); - cast5_ecb_decrypt(tmp[0], tmp[1], &key); - if ((XMEMCMP(tmp[0], tests[i].ct, 8) != 0) || (XMEMCMP(tmp[1], tests[i].pt, 8) != 0)) { - return CRYPT_FAIL_TESTVECTOR; - } - /* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */ - for (y = 0; y < 8; y++) tmp[0][y] = 0; - for (y = 0; y < 1000; y++) cast5_ecb_encrypt(tmp[0], tmp[0], &key); - for (y = 0; y < 1000; y++) cast5_ecb_decrypt(tmp[0], tmp[0], &key); - for (y = 0; y < 8; y++) if (tmp[0][y] != 0) return CRYPT_FAIL_TESTVECTOR; - - } - return CRYPT_OK; - #endif -} - -/** Terminate the context - @param skey The scheduled key -*/ -void cast5_done(symmetric_key *skey) -{ -} - -/** - Gets suitable key size - @param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable. - @return CRYPT_OK if the input key size is acceptable. -*/ -int cast5_keysize(int *keysize) -{ - LTC_ARGCHK(keysize != NULL); - if (*keysize < 5) { - return CRYPT_INVALID_KEYSIZE; - } else if (*keysize > 16) { - *keysize = 16; - } - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/cast5.c,v $ */ -/* $Revision: 1.14 $ */ -/* $Date: 2007/05/12 14:13:00 $ */ DELETED Source/libtomcrypt/src/ciphers/des.c Index: Source/libtomcrypt/src/ciphers/des.c ================================================================== --- Source/libtomcrypt/src/ciphers/des.c +++ /dev/null @@ -1,2039 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file des.c - LTC_DES code submitted by Dobes Vandermeer -*/ - -#ifdef LTC_DES - -#define LTC_SMALL_CODE 1 /* Do IP/FP as geometics transforms */ - -#define EN0 0 -#define DE1 1 - -const struct ltc_cipher_descriptor des_desc = -{ - "des", - 13, - 8, 8, 8, 16, - &des_setup, - &des_ecb_encrypt, - &des_ecb_decrypt, - &des_test, - &des_done, - &des_keysize, - /* ECB Accelerators */ - NULL, NULL, - /* CBC Accelerators */ - NULL, NULL, - /* CTR Accelerators */ - NULL, - /* LRW Accelerators */ - NULL, NULL, - /* XTS Accelerators */ - NULL, NULL, - /* CCM Accelerator */ - NULL, - /* GCM Accelerator */ - NULL, - /* OMAC Accelerator */ - NULL, - /* XCBC Accelerator */ - NULL, - /* F9 Accelerator */ - NULL -}; - -const struct ltc_cipher_descriptor des3_desc = -{ - "3des", - 14, - 24, 24, 8, 16, - &des3_setup, - &des3_ecb_encrypt, - &des3_ecb_decrypt, - &des3_test, - &des3_done, - &des3_keysize, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL -}; - -static const ulong32 bytebit[8] = -{ - 0200, 0100, 040, 020, 010, 04, 02, 01 -}; - -static const ulong32 bigbyte[24] = -{ - 0x800000UL, 0x400000UL, 0x200000UL, 0x100000UL, - 0x80000UL, 0x40000UL, 0x20000UL, 0x10000UL, - 0x8000UL, 0x4000UL, 0x2000UL, 0x1000UL, - 0x800UL, 0x400UL, 0x200UL, 0x100UL, - 0x80UL, 0x40UL, 0x20UL, 0x10UL, - 0x8UL, 0x4UL, 0x2UL, 0x1L -}; - -/* Use the key schedule specific in the standard (ANSI X3.92-1981) */ - -static const unsigned char pc1[56] = { - 56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, - 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, - 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, - 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 -}; - -static const unsigned char totrot[16] = { - 1, 2, 4, 6, - 8, 10, 12, 14, - 15, 17, 19, 21, - 23, 25, 27, 28 -}; - -static const unsigned char pc2[48] = { - 13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9, - 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1, - 40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47, - 43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 -}; - - -static const ulong32 SP1[64] = -{ - 0x01010400UL, 0x00000000UL, 0x00010000UL, 0x01010404UL, - 0x01010004UL, 0x00010404UL, 0x00000004UL, 0x00010000UL, - 0x00000400UL, 0x01010400UL, 0x01010404UL, 0x00000400UL, - 0x01000404UL, 0x01010004UL, 0x01000000UL, 0x00000004UL, - 0x00000404UL, 0x01000400UL, 0x01000400UL, 0x00010400UL, - 0x00010400UL, 0x01010000UL, 0x01010000UL, 0x01000404UL, - 0x00010004UL, 0x01000004UL, 0x01000004UL, 0x00010004UL, - 0x00000000UL, 0x00000404UL, 0x00010404UL, 0x01000000UL, - 0x00010000UL, 0x01010404UL, 0x00000004UL, 0x01010000UL, - 0x01010400UL, 0x01000000UL, 0x01000000UL, 0x00000400UL, - 0x01010004UL, 0x00010000UL, 0x00010400UL, 0x01000004UL, - 0x00000400UL, 0x00000004UL, 0x01000404UL, 0x00010404UL, - 0x01010404UL, 0x00010004UL, 0x01010000UL, 0x01000404UL, - 0x01000004UL, 0x00000404UL, 0x00010404UL, 0x01010400UL, - 0x00000404UL, 0x01000400UL, 0x01000400UL, 0x00000000UL, - 0x00010004UL, 0x00010400UL, 0x00000000UL, 0x01010004UL -}; - -static const ulong32 SP2[64] = -{ - 0x80108020UL, 0x80008000UL, 0x00008000UL, 0x00108020UL, - 0x00100000UL, 0x00000020UL, 0x80100020UL, 0x80008020UL, - 0x80000020UL, 0x80108020UL, 0x80108000UL, 0x80000000UL, - 0x80008000UL, 0x00100000UL, 0x00000020UL, 0x80100020UL, - 0x00108000UL, 0x00100020UL, 0x80008020UL, 0x00000000UL, - 0x80000000UL, 0x00008000UL, 0x00108020UL, 0x80100000UL, - 0x00100020UL, 0x80000020UL, 0x00000000UL, 0x00108000UL, - 0x00008020UL, 0x80108000UL, 0x80100000UL, 0x00008020UL, - 0x00000000UL, 0x00108020UL, 0x80100020UL, 0x00100000UL, - 0x80008020UL, 0x80100000UL, 0x80108000UL, 0x00008000UL, - 0x80100000UL, 0x80008000UL, 0x00000020UL, 0x80108020UL, - 0x00108020UL, 0x00000020UL, 0x00008000UL, 0x80000000UL, - 0x00008020UL, 0x80108000UL, 0x00100000UL, 0x80000020UL, - 0x00100020UL, 0x80008020UL, 0x80000020UL, 0x00100020UL, - 0x00108000UL, 0x00000000UL, 0x80008000UL, 0x00008020UL, - 0x80000000UL, 0x80100020UL, 0x80108020UL, 0x00108000UL -}; - -static const ulong32 SP3[64] = -{ - 0x00000208UL, 0x08020200UL, 0x00000000UL, 0x08020008UL, - 0x08000200UL, 0x00000000UL, 0x00020208UL, 0x08000200UL, - 0x00020008UL, 0x08000008UL, 0x08000008UL, 0x00020000UL, - 0x08020208UL, 0x00020008UL, 0x08020000UL, 0x00000208UL, - 0x08000000UL, 0x00000008UL, 0x08020200UL, 0x00000200UL, - 0x00020200UL, 0x08020000UL, 0x08020008UL, 0x00020208UL, - 0x08000208UL, 0x00020200UL, 0x00020000UL, 0x08000208UL, - 0x00000008UL, 0x08020208UL, 0x00000200UL, 0x08000000UL, - 0x08020200UL, 0x08000000UL, 0x00020008UL, 0x00000208UL, - 0x00020000UL, 0x08020200UL, 0x08000200UL, 0x00000000UL, - 0x00000200UL, 0x00020008UL, 0x08020208UL, 0x08000200UL, - 0x08000008UL, 0x00000200UL, 0x00000000UL, 0x08020008UL, - 0x08000208UL, 0x00020000UL, 0x08000000UL, 0x08020208UL, - 0x00000008UL, 0x00020208UL, 0x00020200UL, 0x08000008UL, - 0x08020000UL, 0x08000208UL, 0x00000208UL, 0x08020000UL, - 0x00020208UL, 0x00000008UL, 0x08020008UL, 0x00020200UL -}; - -static const ulong32 SP4[64] = -{ - 0x00802001UL, 0x00002081UL, 0x00002081UL, 0x00000080UL, - 0x00802080UL, 0x00800081UL, 0x00800001UL, 0x00002001UL, - 0x00000000UL, 0x00802000UL, 0x00802000UL, 0x00802081UL, - 0x00000081UL, 0x00000000UL, 0x00800080UL, 0x00800001UL, - 0x00000001UL, 0x00002000UL, 0x00800000UL, 0x00802001UL, - 0x00000080UL, 0x00800000UL, 0x00002001UL, 0x00002080UL, - 0x00800081UL, 0x00000001UL, 0x00002080UL, 0x00800080UL, - 0x00002000UL, 0x00802080UL, 0x00802081UL, 0x00000081UL, - 0x00800080UL, 0x00800001UL, 0x00802000UL, 0x00802081UL, - 0x00000081UL, 0x00000000UL, 0x00000000UL, 0x00802000UL, - 0x00002080UL, 0x00800080UL, 0x00800081UL, 0x00000001UL, - 0x00802001UL, 0x00002081UL, 0x00002081UL, 0x00000080UL, - 0x00802081UL, 0x00000081UL, 0x00000001UL, 0x00002000UL, - 0x00800001UL, 0x00002001UL, 0x00802080UL, 0x00800081UL, - 0x00002001UL, 0x00002080UL, 0x00800000UL, 0x00802001UL, - 0x00000080UL, 0x00800000UL, 0x00002000UL, 0x00802080UL -}; - -static const ulong32 SP5[64] = -{ - 0x00000100UL, 0x02080100UL, 0x02080000UL, 0x42000100UL, - 0x00080000UL, 0x00000100UL, 0x40000000UL, 0x02080000UL, - 0x40080100UL, 0x00080000UL, 0x02000100UL, 0x40080100UL, - 0x42000100UL, 0x42080000UL, 0x00080100UL, 0x40000000UL, - 0x02000000UL, 0x40080000UL, 0x40080000UL, 0x00000000UL, - 0x40000100UL, 0x42080100UL, 0x42080100UL, 0x02000100UL, - 0x42080000UL, 0x40000100UL, 0x00000000UL, 0x42000000UL, - 0x02080100UL, 0x02000000UL, 0x42000000UL, 0x00080100UL, - 0x00080000UL, 0x42000100UL, 0x00000100UL, 0x02000000UL, - 0x40000000UL, 0x02080000UL, 0x42000100UL, 0x40080100UL, - 0x02000100UL, 0x40000000UL, 0x42080000UL, 0x02080100UL, - 0x40080100UL, 0x00000100UL, 0x02000000UL, 0x42080000UL, - 0x42080100UL, 0x00080100UL, 0x42000000UL, 0x42080100UL, - 0x02080000UL, 0x00000000UL, 0x40080000UL, 0x42000000UL, - 0x00080100UL, 0x02000100UL, 0x40000100UL, 0x00080000UL, - 0x00000000UL, 0x40080000UL, 0x02080100UL, 0x40000100UL -}; - -static const ulong32 SP6[64] = -{ - 0x20000010UL, 0x20400000UL, 0x00004000UL, 0x20404010UL, - 0x20400000UL, 0x00000010UL, 0x20404010UL, 0x00400000UL, - 0x20004000UL, 0x00404010UL, 0x00400000UL, 0x20000010UL, - 0x00400010UL, 0x20004000UL, 0x20000000UL, 0x00004010UL, - 0x00000000UL, 0x00400010UL, 0x20004010UL, 0x00004000UL, - 0x00404000UL, 0x20004010UL, 0x00000010UL, 0x20400010UL, - 0x20400010UL, 0x00000000UL, 0x00404010UL, 0x20404000UL, - 0x00004010UL, 0x00404000UL, 0x20404000UL, 0x20000000UL, - 0x20004000UL, 0x00000010UL, 0x20400010UL, 0x00404000UL, - 0x20404010UL, 0x00400000UL, 0x00004010UL, 0x20000010UL, - 0x00400000UL, 0x20004000UL, 0x20000000UL, 0x00004010UL, - 0x20000010UL, 0x20404010UL, 0x00404000UL, 0x20400000UL, - 0x00404010UL, 0x20404000UL, 0x00000000UL, 0x20400010UL, - 0x00000010UL, 0x00004000UL, 0x20400000UL, 0x00404010UL, - 0x00004000UL, 0x00400010UL, 0x20004010UL, 0x00000000UL, - 0x20404000UL, 0x20000000UL, 0x00400010UL, 0x20004010UL -}; - -static const ulong32 SP7[64] = -{ - 0x00200000UL, 0x04200002UL, 0x04000802UL, 0x00000000UL, - 0x00000800UL, 0x04000802UL, 0x00200802UL, 0x04200800UL, - 0x04200802UL, 0x00200000UL, 0x00000000UL, 0x04000002UL, - 0x00000002UL, 0x04000000UL, 0x04200002UL, 0x00000802UL, - 0x04000800UL, 0x00200802UL, 0x00200002UL, 0x04000800UL, - 0x04000002UL, 0x04200000UL, 0x04200800UL, 0x00200002UL, - 0x04200000UL, 0x00000800UL, 0x00000802UL, 0x04200802UL, - 0x00200800UL, 0x00000002UL, 0x04000000UL, 0x00200800UL, - 0x04000000UL, 0x00200800UL, 0x00200000UL, 0x04000802UL, - 0x04000802UL, 0x04200002UL, 0x04200002UL, 0x00000002UL, - 0x00200002UL, 0x04000000UL, 0x04000800UL, 0x00200000UL, - 0x04200800UL, 0x00000802UL, 0x00200802UL, 0x04200800UL, - 0x00000802UL, 0x04000002UL, 0x04200802UL, 0x04200000UL, - 0x00200800UL, 0x00000000UL, 0x00000002UL, 0x04200802UL, - 0x00000000UL, 0x00200802UL, 0x04200000UL, 0x00000800UL, - 0x04000002UL, 0x04000800UL, 0x00000800UL, 0x00200002UL -}; - -static const ulong32 SP8[64] = -{ - 0x10001040UL, 0x00001000UL, 0x00040000UL, 0x10041040UL, - 0x10000000UL, 0x10001040UL, 0x00000040UL, 0x10000000UL, - 0x00040040UL, 0x10040000UL, 0x10041040UL, 0x00041000UL, - 0x10041000UL, 0x00041040UL, 0x00001000UL, 0x00000040UL, - 0x10040000UL, 0x10000040UL, 0x10001000UL, 0x00001040UL, - 0x00041000UL, 0x00040040UL, 0x10040040UL, 0x10041000UL, - 0x00001040UL, 0x00000000UL, 0x00000000UL, 0x10040040UL, - 0x10000040UL, 0x10001000UL, 0x00041040UL, 0x00040000UL, - 0x00041040UL, 0x00040000UL, 0x10041000UL, 0x00001000UL, - 0x00000040UL, 0x10040040UL, 0x00001000UL, 0x00041040UL, - 0x10001000UL, 0x00000040UL, 0x10000040UL, 0x10040000UL, - 0x10040040UL, 0x10000000UL, 0x00040000UL, 0x10001040UL, - 0x00000000UL, 0x10041040UL, 0x00040040UL, 0x10000040UL, - 0x10040000UL, 0x10001000UL, 0x10001040UL, 0x00000000UL, - 0x10041040UL, 0x00041000UL, 0x00041000UL, 0x00001040UL, - 0x00001040UL, 0x00040040UL, 0x10000000UL, 0x10041000UL -}; - -#ifndef LTC_SMALL_CODE - -static const ulong64 des_ip[8][256] = { - -{ CONST64(0x0000000000000000), CONST64(0x0000001000000000), CONST64(0x0000000000000010), CONST64(0x0000001000000010), - CONST64(0x0000100000000000), CONST64(0x0000101000000000), CONST64(0x0000100000000010), CONST64(0x0000101000000010), - CONST64(0x0000000000001000), CONST64(0x0000001000001000), CONST64(0x0000000000001010), CONST64(0x0000001000001010), - CONST64(0x0000100000001000), CONST64(0x0000101000001000), CONST64(0x0000100000001010), CONST64(0x0000101000001010), - CONST64(0x0010000000000000), CONST64(0x0010001000000000), CONST64(0x0010000000000010), CONST64(0x0010001000000010), - CONST64(0x0010100000000000), CONST64(0x0010101000000000), CONST64(0x0010100000000010), CONST64(0x0010101000000010), - CONST64(0x0010000000001000), CONST64(0x0010001000001000), CONST64(0x0010000000001010), CONST64(0x0010001000001010), - CONST64(0x0010100000001000), CONST64(0x0010101000001000), CONST64(0x0010100000001010), CONST64(0x0010101000001010), - CONST64(0x0000000000100000), CONST64(0x0000001000100000), CONST64(0x0000000000100010), CONST64(0x0000001000100010), - CONST64(0x0000100000100000), CONST64(0x0000101000100000), CONST64(0x0000100000100010), CONST64(0x0000101000100010), - CONST64(0x0000000000101000), CONST64(0x0000001000101000), CONST64(0x0000000000101010), CONST64(0x0000001000101010), - CONST64(0x0000100000101000), CONST64(0x0000101000101000), CONST64(0x0000100000101010), CONST64(0x0000101000101010), - CONST64(0x0010000000100000), CONST64(0x0010001000100000), CONST64(0x0010000000100010), CONST64(0x0010001000100010), - CONST64(0x0010100000100000), CONST64(0x0010101000100000), CONST64(0x0010100000100010), CONST64(0x0010101000100010), - CONST64(0x0010000000101000), CONST64(0x0010001000101000), CONST64(0x0010000000101010), CONST64(0x0010001000101010), - CONST64(0x0010100000101000), CONST64(0x0010101000101000), CONST64(0x0010100000101010), CONST64(0x0010101000101010), - CONST64(0x1000000000000000), CONST64(0x1000001000000000), CONST64(0x1000000000000010), CONST64(0x1000001000000010), - CONST64(0x1000100000000000), CONST64(0x1000101000000000), CONST64(0x1000100000000010), CONST64(0x1000101000000010), - CONST64(0x1000000000001000), CONST64(0x1000001000001000), CONST64(0x1000000000001010), CONST64(0x1000001000001010), - CONST64(0x1000100000001000), CONST64(0x1000101000001000), CONST64(0x1000100000001010), CONST64(0x1000101000001010), - CONST64(0x1010000000000000), CONST64(0x1010001000000000), CONST64(0x1010000000000010), CONST64(0x1010001000000010), - CONST64(0x1010100000000000), CONST64(0x1010101000000000), CONST64(0x1010100000000010), CONST64(0x1010101000000010), - CONST64(0x1010000000001000), CONST64(0x1010001000001000), CONST64(0x1010000000001010), CONST64(0x1010001000001010), - CONST64(0x1010100000001000), CONST64(0x1010101000001000), CONST64(0x1010100000001010), CONST64(0x1010101000001010), - CONST64(0x1000000000100000), CONST64(0x1000001000100000), CONST64(0x1000000000100010), CONST64(0x1000001000100010), - CONST64(0x1000100000100000), CONST64(0x1000101000100000), CONST64(0x1000100000100010), CONST64(0x1000101000100010), - CONST64(0x1000000000101000), CONST64(0x1000001000101000), CONST64(0x1000000000101010), CONST64(0x1000001000101010), - CONST64(0x1000100000101000), CONST64(0x1000101000101000), CONST64(0x1000100000101010), CONST64(0x1000101000101010), - CONST64(0x1010000000100000), CONST64(0x1010001000100000), CONST64(0x1010000000100010), CONST64(0x1010001000100010), - CONST64(0x1010100000100000), CONST64(0x1010101000100000), CONST64(0x1010100000100010), CONST64(0x1010101000100010), - CONST64(0x1010000000101000), CONST64(0x1010001000101000), CONST64(0x1010000000101010), CONST64(0x1010001000101010), - CONST64(0x1010100000101000), CONST64(0x1010101000101000), CONST64(0x1010100000101010), CONST64(0x1010101000101010), - CONST64(0x0000000010000000), CONST64(0x0000001010000000), CONST64(0x0000000010000010), CONST64(0x0000001010000010), - CONST64(0x0000100010000000), CONST64(0x0000101010000000), CONST64(0x0000100010000010), CONST64(0x0000101010000010), - CONST64(0x0000000010001000), CONST64(0x0000001010001000), CONST64(0x0000000010001010), CONST64(0x0000001010001010), - CONST64(0x0000100010001000), CONST64(0x0000101010001000), CONST64(0x0000100010001010), CONST64(0x0000101010001010), - CONST64(0x0010000010000000), CONST64(0x0010001010000000), CONST64(0x0010000010000010), CONST64(0x0010001010000010), - CONST64(0x0010100010000000), CONST64(0x0010101010000000), CONST64(0x0010100010000010), CONST64(0x0010101010000010), - CONST64(0x0010000010001000), CONST64(0x0010001010001000), CONST64(0x0010000010001010), CONST64(0x0010001010001010), - CONST64(0x0010100010001000), CONST64(0x0010101010001000), CONST64(0x0010100010001010), CONST64(0x0010101010001010), - CONST64(0x0000000010100000), CONST64(0x0000001010100000), CONST64(0x0000000010100010), CONST64(0x0000001010100010), - CONST64(0x0000100010100000), CONST64(0x0000101010100000), CONST64(0x0000100010100010), CONST64(0x0000101010100010), - CONST64(0x0000000010101000), CONST64(0x0000001010101000), CONST64(0x0000000010101010), CONST64(0x0000001010101010), - CONST64(0x0000100010101000), CONST64(0x0000101010101000), CONST64(0x0000100010101010), CONST64(0x0000101010101010), - CONST64(0x0010000010100000), CONST64(0x0010001010100000), CONST64(0x0010000010100010), CONST64(0x0010001010100010), - CONST64(0x0010100010100000), CONST64(0x0010101010100000), CONST64(0x0010100010100010), CONST64(0x0010101010100010), - CONST64(0x0010000010101000), CONST64(0x0010001010101000), CONST64(0x0010000010101010), CONST64(0x0010001010101010), - CONST64(0x0010100010101000), CONST64(0x0010101010101000), CONST64(0x0010100010101010), CONST64(0x0010101010101010), - CONST64(0x1000000010000000), CONST64(0x1000001010000000), CONST64(0x1000000010000010), CONST64(0x1000001010000010), - CONST64(0x1000100010000000), CONST64(0x1000101010000000), CONST64(0x1000100010000010), CONST64(0x1000101010000010), - CONST64(0x1000000010001000), CONST64(0x1000001010001000), CONST64(0x1000000010001010), CONST64(0x1000001010001010), - CONST64(0x1000100010001000), CONST64(0x1000101010001000), CONST64(0x1000100010001010), CONST64(0x1000101010001010), - CONST64(0x1010000010000000), CONST64(0x1010001010000000), CONST64(0x1010000010000010), CONST64(0x1010001010000010), - CONST64(0x1010100010000000), CONST64(0x1010101010000000), CONST64(0x1010100010000010), CONST64(0x1010101010000010), - CONST64(0x1010000010001000), CONST64(0x1010001010001000), CONST64(0x1010000010001010), CONST64(0x1010001010001010), - CONST64(0x1010100010001000), CONST64(0x1010101010001000), CONST64(0x1010100010001010), CONST64(0x1010101010001010), - CONST64(0x1000000010100000), CONST64(0x1000001010100000), CONST64(0x1000000010100010), CONST64(0x1000001010100010), - CONST64(0x1000100010100000), CONST64(0x1000101010100000), CONST64(0x1000100010100010), CONST64(0x1000101010100010), - CONST64(0x1000000010101000), CONST64(0x1000001010101000), CONST64(0x1000000010101010), CONST64(0x1000001010101010), - CONST64(0x1000100010101000), CONST64(0x1000101010101000), CONST64(0x1000100010101010), CONST64(0x1000101010101010), - CONST64(0x1010000010100000), CONST64(0x1010001010100000), CONST64(0x1010000010100010), CONST64(0x1010001010100010), - CONST64(0x1010100010100000), CONST64(0x1010101010100000), CONST64(0x1010100010100010), CONST64(0x1010101010100010), - CONST64(0x1010000010101000), CONST64(0x1010001010101000), CONST64(0x1010000010101010), CONST64(0x1010001010101010), - CONST64(0x1010100010101000), CONST64(0x1010101010101000), CONST64(0x1010100010101010), CONST64(0x1010101010101010) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000800000000), CONST64(0x0000000000000008), CONST64(0x0000000800000008), - CONST64(0x0000080000000000), CONST64(0x0000080800000000), CONST64(0x0000080000000008), CONST64(0x0000080800000008), - CONST64(0x0000000000000800), CONST64(0x0000000800000800), CONST64(0x0000000000000808), CONST64(0x0000000800000808), - CONST64(0x0000080000000800), CONST64(0x0000080800000800), CONST64(0x0000080000000808), CONST64(0x0000080800000808), - CONST64(0x0008000000000000), CONST64(0x0008000800000000), CONST64(0x0008000000000008), CONST64(0x0008000800000008), - CONST64(0x0008080000000000), CONST64(0x0008080800000000), CONST64(0x0008080000000008), CONST64(0x0008080800000008), - CONST64(0x0008000000000800), CONST64(0x0008000800000800), CONST64(0x0008000000000808), CONST64(0x0008000800000808), - CONST64(0x0008080000000800), CONST64(0x0008080800000800), CONST64(0x0008080000000808), CONST64(0x0008080800000808), - CONST64(0x0000000000080000), CONST64(0x0000000800080000), CONST64(0x0000000000080008), CONST64(0x0000000800080008), - CONST64(0x0000080000080000), CONST64(0x0000080800080000), CONST64(0x0000080000080008), CONST64(0x0000080800080008), - CONST64(0x0000000000080800), CONST64(0x0000000800080800), CONST64(0x0000000000080808), CONST64(0x0000000800080808), - CONST64(0x0000080000080800), CONST64(0x0000080800080800), CONST64(0x0000080000080808), CONST64(0x0000080800080808), - CONST64(0x0008000000080000), CONST64(0x0008000800080000), CONST64(0x0008000000080008), CONST64(0x0008000800080008), - CONST64(0x0008080000080000), CONST64(0x0008080800080000), CONST64(0x0008080000080008), CONST64(0x0008080800080008), - CONST64(0x0008000000080800), CONST64(0x0008000800080800), CONST64(0x0008000000080808), CONST64(0x0008000800080808), - CONST64(0x0008080000080800), CONST64(0x0008080800080800), CONST64(0x0008080000080808), CONST64(0x0008080800080808), - CONST64(0x0800000000000000), CONST64(0x0800000800000000), CONST64(0x0800000000000008), CONST64(0x0800000800000008), - CONST64(0x0800080000000000), CONST64(0x0800080800000000), CONST64(0x0800080000000008), CONST64(0x0800080800000008), - CONST64(0x0800000000000800), CONST64(0x0800000800000800), CONST64(0x0800000000000808), CONST64(0x0800000800000808), - CONST64(0x0800080000000800), CONST64(0x0800080800000800), CONST64(0x0800080000000808), CONST64(0x0800080800000808), - CONST64(0x0808000000000000), CONST64(0x0808000800000000), CONST64(0x0808000000000008), CONST64(0x0808000800000008), - CONST64(0x0808080000000000), CONST64(0x0808080800000000), CONST64(0x0808080000000008), CONST64(0x0808080800000008), - CONST64(0x0808000000000800), CONST64(0x0808000800000800), CONST64(0x0808000000000808), CONST64(0x0808000800000808), - CONST64(0x0808080000000800), CONST64(0x0808080800000800), CONST64(0x0808080000000808), CONST64(0x0808080800000808), - CONST64(0x0800000000080000), CONST64(0x0800000800080000), CONST64(0x0800000000080008), CONST64(0x0800000800080008), - CONST64(0x0800080000080000), CONST64(0x0800080800080000), CONST64(0x0800080000080008), CONST64(0x0800080800080008), - CONST64(0x0800000000080800), CONST64(0x0800000800080800), CONST64(0x0800000000080808), CONST64(0x0800000800080808), - CONST64(0x0800080000080800), CONST64(0x0800080800080800), CONST64(0x0800080000080808), CONST64(0x0800080800080808), - CONST64(0x0808000000080000), CONST64(0x0808000800080000), CONST64(0x0808000000080008), CONST64(0x0808000800080008), - CONST64(0x0808080000080000), CONST64(0x0808080800080000), CONST64(0x0808080000080008), CONST64(0x0808080800080008), - CONST64(0x0808000000080800), CONST64(0x0808000800080800), CONST64(0x0808000000080808), CONST64(0x0808000800080808), - CONST64(0x0808080000080800), CONST64(0x0808080800080800), CONST64(0x0808080000080808), CONST64(0x0808080800080808), - CONST64(0x0000000008000000), CONST64(0x0000000808000000), CONST64(0x0000000008000008), CONST64(0x0000000808000008), - CONST64(0x0000080008000000), CONST64(0x0000080808000000), CONST64(0x0000080008000008), CONST64(0x0000080808000008), - CONST64(0x0000000008000800), CONST64(0x0000000808000800), CONST64(0x0000000008000808), CONST64(0x0000000808000808), - CONST64(0x0000080008000800), CONST64(0x0000080808000800), CONST64(0x0000080008000808), CONST64(0x0000080808000808), - CONST64(0x0008000008000000), CONST64(0x0008000808000000), CONST64(0x0008000008000008), CONST64(0x0008000808000008), - CONST64(0x0008080008000000), CONST64(0x0008080808000000), CONST64(0x0008080008000008), CONST64(0x0008080808000008), - CONST64(0x0008000008000800), CONST64(0x0008000808000800), CONST64(0x0008000008000808), CONST64(0x0008000808000808), - CONST64(0x0008080008000800), CONST64(0x0008080808000800), CONST64(0x0008080008000808), CONST64(0x0008080808000808), - CONST64(0x0000000008080000), CONST64(0x0000000808080000), CONST64(0x0000000008080008), CONST64(0x0000000808080008), - CONST64(0x0000080008080000), CONST64(0x0000080808080000), CONST64(0x0000080008080008), CONST64(0x0000080808080008), - CONST64(0x0000000008080800), CONST64(0x0000000808080800), CONST64(0x0000000008080808), CONST64(0x0000000808080808), - CONST64(0x0000080008080800), CONST64(0x0000080808080800), CONST64(0x0000080008080808), CONST64(0x0000080808080808), - CONST64(0x0008000008080000), CONST64(0x0008000808080000), CONST64(0x0008000008080008), CONST64(0x0008000808080008), - CONST64(0x0008080008080000), CONST64(0x0008080808080000), CONST64(0x0008080008080008), CONST64(0x0008080808080008), - CONST64(0x0008000008080800), CONST64(0x0008000808080800), CONST64(0x0008000008080808), CONST64(0x0008000808080808), - CONST64(0x0008080008080800), CONST64(0x0008080808080800), CONST64(0x0008080008080808), CONST64(0x0008080808080808), - CONST64(0x0800000008000000), CONST64(0x0800000808000000), CONST64(0x0800000008000008), CONST64(0x0800000808000008), - CONST64(0x0800080008000000), CONST64(0x0800080808000000), CONST64(0x0800080008000008), CONST64(0x0800080808000008), - CONST64(0x0800000008000800), CONST64(0x0800000808000800), CONST64(0x0800000008000808), CONST64(0x0800000808000808), - CONST64(0x0800080008000800), CONST64(0x0800080808000800), CONST64(0x0800080008000808), CONST64(0x0800080808000808), - CONST64(0x0808000008000000), CONST64(0x0808000808000000), CONST64(0x0808000008000008), CONST64(0x0808000808000008), - CONST64(0x0808080008000000), CONST64(0x0808080808000000), CONST64(0x0808080008000008), CONST64(0x0808080808000008), - CONST64(0x0808000008000800), CONST64(0x0808000808000800), CONST64(0x0808000008000808), CONST64(0x0808000808000808), - CONST64(0x0808080008000800), CONST64(0x0808080808000800), CONST64(0x0808080008000808), CONST64(0x0808080808000808), - CONST64(0x0800000008080000), CONST64(0x0800000808080000), CONST64(0x0800000008080008), CONST64(0x0800000808080008), - CONST64(0x0800080008080000), CONST64(0x0800080808080000), CONST64(0x0800080008080008), CONST64(0x0800080808080008), - CONST64(0x0800000008080800), CONST64(0x0800000808080800), CONST64(0x0800000008080808), CONST64(0x0800000808080808), - CONST64(0x0800080008080800), CONST64(0x0800080808080800), CONST64(0x0800080008080808), CONST64(0x0800080808080808), - CONST64(0x0808000008080000), CONST64(0x0808000808080000), CONST64(0x0808000008080008), CONST64(0x0808000808080008), - CONST64(0x0808080008080000), CONST64(0x0808080808080000), CONST64(0x0808080008080008), CONST64(0x0808080808080008), - CONST64(0x0808000008080800), CONST64(0x0808000808080800), CONST64(0x0808000008080808), CONST64(0x0808000808080808), - CONST64(0x0808080008080800), CONST64(0x0808080808080800), CONST64(0x0808080008080808), CONST64(0x0808080808080808) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000400000000), CONST64(0x0000000000000004), CONST64(0x0000000400000004), - CONST64(0x0000040000000000), CONST64(0x0000040400000000), CONST64(0x0000040000000004), CONST64(0x0000040400000004), - CONST64(0x0000000000000400), CONST64(0x0000000400000400), CONST64(0x0000000000000404), CONST64(0x0000000400000404), - CONST64(0x0000040000000400), CONST64(0x0000040400000400), CONST64(0x0000040000000404), CONST64(0x0000040400000404), - CONST64(0x0004000000000000), CONST64(0x0004000400000000), CONST64(0x0004000000000004), CONST64(0x0004000400000004), - CONST64(0x0004040000000000), CONST64(0x0004040400000000), CONST64(0x0004040000000004), CONST64(0x0004040400000004), - CONST64(0x0004000000000400), CONST64(0x0004000400000400), CONST64(0x0004000000000404), CONST64(0x0004000400000404), - CONST64(0x0004040000000400), CONST64(0x0004040400000400), CONST64(0x0004040000000404), CONST64(0x0004040400000404), - CONST64(0x0000000000040000), CONST64(0x0000000400040000), CONST64(0x0000000000040004), CONST64(0x0000000400040004), - CONST64(0x0000040000040000), CONST64(0x0000040400040000), CONST64(0x0000040000040004), CONST64(0x0000040400040004), - CONST64(0x0000000000040400), CONST64(0x0000000400040400), CONST64(0x0000000000040404), CONST64(0x0000000400040404), - CONST64(0x0000040000040400), CONST64(0x0000040400040400), CONST64(0x0000040000040404), CONST64(0x0000040400040404), - CONST64(0x0004000000040000), CONST64(0x0004000400040000), CONST64(0x0004000000040004), CONST64(0x0004000400040004), - CONST64(0x0004040000040000), CONST64(0x0004040400040000), CONST64(0x0004040000040004), CONST64(0x0004040400040004), - CONST64(0x0004000000040400), CONST64(0x0004000400040400), CONST64(0x0004000000040404), CONST64(0x0004000400040404), - CONST64(0x0004040000040400), CONST64(0x0004040400040400), CONST64(0x0004040000040404), CONST64(0x0004040400040404), - CONST64(0x0400000000000000), CONST64(0x0400000400000000), CONST64(0x0400000000000004), CONST64(0x0400000400000004), - CONST64(0x0400040000000000), CONST64(0x0400040400000000), CONST64(0x0400040000000004), CONST64(0x0400040400000004), - CONST64(0x0400000000000400), CONST64(0x0400000400000400), CONST64(0x0400000000000404), CONST64(0x0400000400000404), - CONST64(0x0400040000000400), CONST64(0x0400040400000400), CONST64(0x0400040000000404), CONST64(0x0400040400000404), - CONST64(0x0404000000000000), CONST64(0x0404000400000000), CONST64(0x0404000000000004), CONST64(0x0404000400000004), - CONST64(0x0404040000000000), CONST64(0x0404040400000000), CONST64(0x0404040000000004), CONST64(0x0404040400000004), - CONST64(0x0404000000000400), CONST64(0x0404000400000400), CONST64(0x0404000000000404), CONST64(0x0404000400000404), - CONST64(0x0404040000000400), CONST64(0x0404040400000400), CONST64(0x0404040000000404), CONST64(0x0404040400000404), - CONST64(0x0400000000040000), CONST64(0x0400000400040000), CONST64(0x0400000000040004), CONST64(0x0400000400040004), - CONST64(0x0400040000040000), CONST64(0x0400040400040000), CONST64(0x0400040000040004), CONST64(0x0400040400040004), - CONST64(0x0400000000040400), CONST64(0x0400000400040400), CONST64(0x0400000000040404), CONST64(0x0400000400040404), - CONST64(0x0400040000040400), CONST64(0x0400040400040400), CONST64(0x0400040000040404), CONST64(0x0400040400040404), - CONST64(0x0404000000040000), CONST64(0x0404000400040000), CONST64(0x0404000000040004), CONST64(0x0404000400040004), - CONST64(0x0404040000040000), CONST64(0x0404040400040000), CONST64(0x0404040000040004), CONST64(0x0404040400040004), - CONST64(0x0404000000040400), CONST64(0x0404000400040400), CONST64(0x0404000000040404), CONST64(0x0404000400040404), - CONST64(0x0404040000040400), CONST64(0x0404040400040400), CONST64(0x0404040000040404), CONST64(0x0404040400040404), - CONST64(0x0000000004000000), CONST64(0x0000000404000000), CONST64(0x0000000004000004), CONST64(0x0000000404000004), - CONST64(0x0000040004000000), CONST64(0x0000040404000000), CONST64(0x0000040004000004), CONST64(0x0000040404000004), - CONST64(0x0000000004000400), CONST64(0x0000000404000400), CONST64(0x0000000004000404), CONST64(0x0000000404000404), - CONST64(0x0000040004000400), CONST64(0x0000040404000400), CONST64(0x0000040004000404), CONST64(0x0000040404000404), - CONST64(0x0004000004000000), CONST64(0x0004000404000000), CONST64(0x0004000004000004), CONST64(0x0004000404000004), - CONST64(0x0004040004000000), CONST64(0x0004040404000000), CONST64(0x0004040004000004), CONST64(0x0004040404000004), - CONST64(0x0004000004000400), CONST64(0x0004000404000400), CONST64(0x0004000004000404), CONST64(0x0004000404000404), - CONST64(0x0004040004000400), CONST64(0x0004040404000400), CONST64(0x0004040004000404), CONST64(0x0004040404000404), - CONST64(0x0000000004040000), CONST64(0x0000000404040000), CONST64(0x0000000004040004), CONST64(0x0000000404040004), - CONST64(0x0000040004040000), CONST64(0x0000040404040000), CONST64(0x0000040004040004), CONST64(0x0000040404040004), - CONST64(0x0000000004040400), CONST64(0x0000000404040400), CONST64(0x0000000004040404), CONST64(0x0000000404040404), - CONST64(0x0000040004040400), CONST64(0x0000040404040400), CONST64(0x0000040004040404), CONST64(0x0000040404040404), - CONST64(0x0004000004040000), CONST64(0x0004000404040000), CONST64(0x0004000004040004), CONST64(0x0004000404040004), - CONST64(0x0004040004040000), CONST64(0x0004040404040000), CONST64(0x0004040004040004), CONST64(0x0004040404040004), - CONST64(0x0004000004040400), CONST64(0x0004000404040400), CONST64(0x0004000004040404), CONST64(0x0004000404040404), - CONST64(0x0004040004040400), CONST64(0x0004040404040400), CONST64(0x0004040004040404), CONST64(0x0004040404040404), - CONST64(0x0400000004000000), CONST64(0x0400000404000000), CONST64(0x0400000004000004), CONST64(0x0400000404000004), - CONST64(0x0400040004000000), CONST64(0x0400040404000000), CONST64(0x0400040004000004), CONST64(0x0400040404000004), - CONST64(0x0400000004000400), CONST64(0x0400000404000400), CONST64(0x0400000004000404), CONST64(0x0400000404000404), - CONST64(0x0400040004000400), CONST64(0x0400040404000400), CONST64(0x0400040004000404), CONST64(0x0400040404000404), - CONST64(0x0404000004000000), CONST64(0x0404000404000000), CONST64(0x0404000004000004), CONST64(0x0404000404000004), - CONST64(0x0404040004000000), CONST64(0x0404040404000000), CONST64(0x0404040004000004), CONST64(0x0404040404000004), - CONST64(0x0404000004000400), CONST64(0x0404000404000400), CONST64(0x0404000004000404), CONST64(0x0404000404000404), - CONST64(0x0404040004000400), CONST64(0x0404040404000400), CONST64(0x0404040004000404), CONST64(0x0404040404000404), - CONST64(0x0400000004040000), CONST64(0x0400000404040000), CONST64(0x0400000004040004), CONST64(0x0400000404040004), - CONST64(0x0400040004040000), CONST64(0x0400040404040000), CONST64(0x0400040004040004), CONST64(0x0400040404040004), - CONST64(0x0400000004040400), CONST64(0x0400000404040400), CONST64(0x0400000004040404), CONST64(0x0400000404040404), - CONST64(0x0400040004040400), CONST64(0x0400040404040400), CONST64(0x0400040004040404), CONST64(0x0400040404040404), - CONST64(0x0404000004040000), CONST64(0x0404000404040000), CONST64(0x0404000004040004), CONST64(0x0404000404040004), - CONST64(0x0404040004040000), CONST64(0x0404040404040000), CONST64(0x0404040004040004), CONST64(0x0404040404040004), - CONST64(0x0404000004040400), CONST64(0x0404000404040400), CONST64(0x0404000004040404), CONST64(0x0404000404040404), - CONST64(0x0404040004040400), CONST64(0x0404040404040400), CONST64(0x0404040004040404), CONST64(0x0404040404040404) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000200000000), CONST64(0x0000000000000002), CONST64(0x0000000200000002), - CONST64(0x0000020000000000), CONST64(0x0000020200000000), CONST64(0x0000020000000002), CONST64(0x0000020200000002), - CONST64(0x0000000000000200), CONST64(0x0000000200000200), CONST64(0x0000000000000202), CONST64(0x0000000200000202), - CONST64(0x0000020000000200), CONST64(0x0000020200000200), CONST64(0x0000020000000202), CONST64(0x0000020200000202), - CONST64(0x0002000000000000), CONST64(0x0002000200000000), CONST64(0x0002000000000002), CONST64(0x0002000200000002), - CONST64(0x0002020000000000), CONST64(0x0002020200000000), CONST64(0x0002020000000002), CONST64(0x0002020200000002), - CONST64(0x0002000000000200), CONST64(0x0002000200000200), CONST64(0x0002000000000202), CONST64(0x0002000200000202), - CONST64(0x0002020000000200), CONST64(0x0002020200000200), CONST64(0x0002020000000202), CONST64(0x0002020200000202), - CONST64(0x0000000000020000), CONST64(0x0000000200020000), CONST64(0x0000000000020002), CONST64(0x0000000200020002), - CONST64(0x0000020000020000), CONST64(0x0000020200020000), CONST64(0x0000020000020002), CONST64(0x0000020200020002), - CONST64(0x0000000000020200), CONST64(0x0000000200020200), CONST64(0x0000000000020202), CONST64(0x0000000200020202), - CONST64(0x0000020000020200), CONST64(0x0000020200020200), CONST64(0x0000020000020202), CONST64(0x0000020200020202), - CONST64(0x0002000000020000), CONST64(0x0002000200020000), CONST64(0x0002000000020002), CONST64(0x0002000200020002), - CONST64(0x0002020000020000), CONST64(0x0002020200020000), CONST64(0x0002020000020002), CONST64(0x0002020200020002), - CONST64(0x0002000000020200), CONST64(0x0002000200020200), CONST64(0x0002000000020202), CONST64(0x0002000200020202), - CONST64(0x0002020000020200), CONST64(0x0002020200020200), CONST64(0x0002020000020202), CONST64(0x0002020200020202), - CONST64(0x0200000000000000), CONST64(0x0200000200000000), CONST64(0x0200000000000002), CONST64(0x0200000200000002), - CONST64(0x0200020000000000), CONST64(0x0200020200000000), CONST64(0x0200020000000002), CONST64(0x0200020200000002), - CONST64(0x0200000000000200), CONST64(0x0200000200000200), CONST64(0x0200000000000202), CONST64(0x0200000200000202), - CONST64(0x0200020000000200), CONST64(0x0200020200000200), CONST64(0x0200020000000202), CONST64(0x0200020200000202), - CONST64(0x0202000000000000), CONST64(0x0202000200000000), CONST64(0x0202000000000002), CONST64(0x0202000200000002), - CONST64(0x0202020000000000), CONST64(0x0202020200000000), CONST64(0x0202020000000002), CONST64(0x0202020200000002), - CONST64(0x0202000000000200), CONST64(0x0202000200000200), CONST64(0x0202000000000202), CONST64(0x0202000200000202), - CONST64(0x0202020000000200), CONST64(0x0202020200000200), CONST64(0x0202020000000202), CONST64(0x0202020200000202), - CONST64(0x0200000000020000), CONST64(0x0200000200020000), CONST64(0x0200000000020002), CONST64(0x0200000200020002), - CONST64(0x0200020000020000), CONST64(0x0200020200020000), CONST64(0x0200020000020002), CONST64(0x0200020200020002), - CONST64(0x0200000000020200), CONST64(0x0200000200020200), CONST64(0x0200000000020202), CONST64(0x0200000200020202), - CONST64(0x0200020000020200), CONST64(0x0200020200020200), CONST64(0x0200020000020202), CONST64(0x0200020200020202), - CONST64(0x0202000000020000), CONST64(0x0202000200020000), CONST64(0x0202000000020002), CONST64(0x0202000200020002), - CONST64(0x0202020000020000), CONST64(0x0202020200020000), CONST64(0x0202020000020002), CONST64(0x0202020200020002), - CONST64(0x0202000000020200), CONST64(0x0202000200020200), CONST64(0x0202000000020202), CONST64(0x0202000200020202), - CONST64(0x0202020000020200), CONST64(0x0202020200020200), CONST64(0x0202020000020202), CONST64(0x0202020200020202), - CONST64(0x0000000002000000), CONST64(0x0000000202000000), CONST64(0x0000000002000002), CONST64(0x0000000202000002), - CONST64(0x0000020002000000), CONST64(0x0000020202000000), CONST64(0x0000020002000002), CONST64(0x0000020202000002), - CONST64(0x0000000002000200), CONST64(0x0000000202000200), CONST64(0x0000000002000202), CONST64(0x0000000202000202), - CONST64(0x0000020002000200), CONST64(0x0000020202000200), CONST64(0x0000020002000202), CONST64(0x0000020202000202), - CONST64(0x0002000002000000), CONST64(0x0002000202000000), CONST64(0x0002000002000002), CONST64(0x0002000202000002), - CONST64(0x0002020002000000), CONST64(0x0002020202000000), CONST64(0x0002020002000002), CONST64(0x0002020202000002), - CONST64(0x0002000002000200), CONST64(0x0002000202000200), CONST64(0x0002000002000202), CONST64(0x0002000202000202), - CONST64(0x0002020002000200), CONST64(0x0002020202000200), CONST64(0x0002020002000202), CONST64(0x0002020202000202), - CONST64(0x0000000002020000), CONST64(0x0000000202020000), CONST64(0x0000000002020002), CONST64(0x0000000202020002), - CONST64(0x0000020002020000), CONST64(0x0000020202020000), CONST64(0x0000020002020002), CONST64(0x0000020202020002), - CONST64(0x0000000002020200), CONST64(0x0000000202020200), CONST64(0x0000000002020202), CONST64(0x0000000202020202), - CONST64(0x0000020002020200), CONST64(0x0000020202020200), CONST64(0x0000020002020202), CONST64(0x0000020202020202), - CONST64(0x0002000002020000), CONST64(0x0002000202020000), CONST64(0x0002000002020002), CONST64(0x0002000202020002), - CONST64(0x0002020002020000), CONST64(0x0002020202020000), CONST64(0x0002020002020002), CONST64(0x0002020202020002), - CONST64(0x0002000002020200), CONST64(0x0002000202020200), CONST64(0x0002000002020202), CONST64(0x0002000202020202), - CONST64(0x0002020002020200), CONST64(0x0002020202020200), CONST64(0x0002020002020202), CONST64(0x0002020202020202), - CONST64(0x0200000002000000), CONST64(0x0200000202000000), CONST64(0x0200000002000002), CONST64(0x0200000202000002), - CONST64(0x0200020002000000), CONST64(0x0200020202000000), CONST64(0x0200020002000002), CONST64(0x0200020202000002), - CONST64(0x0200000002000200), CONST64(0x0200000202000200), CONST64(0x0200000002000202), CONST64(0x0200000202000202), - CONST64(0x0200020002000200), CONST64(0x0200020202000200), CONST64(0x0200020002000202), CONST64(0x0200020202000202), - CONST64(0x0202000002000000), CONST64(0x0202000202000000), CONST64(0x0202000002000002), CONST64(0x0202000202000002), - CONST64(0x0202020002000000), CONST64(0x0202020202000000), CONST64(0x0202020002000002), CONST64(0x0202020202000002), - CONST64(0x0202000002000200), CONST64(0x0202000202000200), CONST64(0x0202000002000202), CONST64(0x0202000202000202), - CONST64(0x0202020002000200), CONST64(0x0202020202000200), CONST64(0x0202020002000202), CONST64(0x0202020202000202), - CONST64(0x0200000002020000), CONST64(0x0200000202020000), CONST64(0x0200000002020002), CONST64(0x0200000202020002), - CONST64(0x0200020002020000), CONST64(0x0200020202020000), CONST64(0x0200020002020002), CONST64(0x0200020202020002), - CONST64(0x0200000002020200), CONST64(0x0200000202020200), CONST64(0x0200000002020202), CONST64(0x0200000202020202), - CONST64(0x0200020002020200), CONST64(0x0200020202020200), CONST64(0x0200020002020202), CONST64(0x0200020202020202), - CONST64(0x0202000002020000), CONST64(0x0202000202020000), CONST64(0x0202000002020002), CONST64(0x0202000202020002), - CONST64(0x0202020002020000), CONST64(0x0202020202020000), CONST64(0x0202020002020002), CONST64(0x0202020202020002), - CONST64(0x0202000002020200), CONST64(0x0202000202020200), CONST64(0x0202000002020202), CONST64(0x0202000202020202), - CONST64(0x0202020002020200), CONST64(0x0202020202020200), CONST64(0x0202020002020202), CONST64(0x0202020202020202) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000010000000000), CONST64(0x0000000000000100), CONST64(0x0000010000000100), - CONST64(0x0001000000000000), CONST64(0x0001010000000000), CONST64(0x0001000000000100), CONST64(0x0001010000000100), - CONST64(0x0000000000010000), CONST64(0x0000010000010000), CONST64(0x0000000000010100), CONST64(0x0000010000010100), - CONST64(0x0001000000010000), CONST64(0x0001010000010000), CONST64(0x0001000000010100), CONST64(0x0001010000010100), - CONST64(0x0100000000000000), CONST64(0x0100010000000000), CONST64(0x0100000000000100), CONST64(0x0100010000000100), - CONST64(0x0101000000000000), CONST64(0x0101010000000000), CONST64(0x0101000000000100), CONST64(0x0101010000000100), - CONST64(0x0100000000010000), CONST64(0x0100010000010000), CONST64(0x0100000000010100), CONST64(0x0100010000010100), - CONST64(0x0101000000010000), CONST64(0x0101010000010000), CONST64(0x0101000000010100), CONST64(0x0101010000010100), - CONST64(0x0000000001000000), CONST64(0x0000010001000000), CONST64(0x0000000001000100), CONST64(0x0000010001000100), - CONST64(0x0001000001000000), CONST64(0x0001010001000000), CONST64(0x0001000001000100), CONST64(0x0001010001000100), - CONST64(0x0000000001010000), CONST64(0x0000010001010000), CONST64(0x0000000001010100), CONST64(0x0000010001010100), - CONST64(0x0001000001010000), CONST64(0x0001010001010000), CONST64(0x0001000001010100), CONST64(0x0001010001010100), - CONST64(0x0100000001000000), CONST64(0x0100010001000000), CONST64(0x0100000001000100), CONST64(0x0100010001000100), - CONST64(0x0101000001000000), CONST64(0x0101010001000000), CONST64(0x0101000001000100), CONST64(0x0101010001000100), - CONST64(0x0100000001010000), CONST64(0x0100010001010000), CONST64(0x0100000001010100), CONST64(0x0100010001010100), - CONST64(0x0101000001010000), CONST64(0x0101010001010000), CONST64(0x0101000001010100), CONST64(0x0101010001010100), - CONST64(0x0000000100000000), CONST64(0x0000010100000000), CONST64(0x0000000100000100), CONST64(0x0000010100000100), - CONST64(0x0001000100000000), CONST64(0x0001010100000000), CONST64(0x0001000100000100), CONST64(0x0001010100000100), - CONST64(0x0000000100010000), CONST64(0x0000010100010000), CONST64(0x0000000100010100), CONST64(0x0000010100010100), - CONST64(0x0001000100010000), CONST64(0x0001010100010000), CONST64(0x0001000100010100), CONST64(0x0001010100010100), - CONST64(0x0100000100000000), CONST64(0x0100010100000000), CONST64(0x0100000100000100), CONST64(0x0100010100000100), - CONST64(0x0101000100000000), CONST64(0x0101010100000000), CONST64(0x0101000100000100), CONST64(0x0101010100000100), - CONST64(0x0100000100010000), CONST64(0x0100010100010000), CONST64(0x0100000100010100), CONST64(0x0100010100010100), - CONST64(0x0101000100010000), CONST64(0x0101010100010000), CONST64(0x0101000100010100), CONST64(0x0101010100010100), - CONST64(0x0000000101000000), CONST64(0x0000010101000000), CONST64(0x0000000101000100), CONST64(0x0000010101000100), - CONST64(0x0001000101000000), CONST64(0x0001010101000000), CONST64(0x0001000101000100), CONST64(0x0001010101000100), - CONST64(0x0000000101010000), CONST64(0x0000010101010000), CONST64(0x0000000101010100), CONST64(0x0000010101010100), - CONST64(0x0001000101010000), CONST64(0x0001010101010000), CONST64(0x0001000101010100), CONST64(0x0001010101010100), - CONST64(0x0100000101000000), CONST64(0x0100010101000000), CONST64(0x0100000101000100), CONST64(0x0100010101000100), - CONST64(0x0101000101000000), CONST64(0x0101010101000000), CONST64(0x0101000101000100), CONST64(0x0101010101000100), - CONST64(0x0100000101010000), CONST64(0x0100010101010000), CONST64(0x0100000101010100), CONST64(0x0100010101010100), - CONST64(0x0101000101010000), CONST64(0x0101010101010000), CONST64(0x0101000101010100), CONST64(0x0101010101010100), - CONST64(0x0000000000000001), CONST64(0x0000010000000001), CONST64(0x0000000000000101), CONST64(0x0000010000000101), - CONST64(0x0001000000000001), CONST64(0x0001010000000001), CONST64(0x0001000000000101), CONST64(0x0001010000000101), - CONST64(0x0000000000010001), CONST64(0x0000010000010001), CONST64(0x0000000000010101), CONST64(0x0000010000010101), - CONST64(0x0001000000010001), CONST64(0x0001010000010001), CONST64(0x0001000000010101), CONST64(0x0001010000010101), - CONST64(0x0100000000000001), CONST64(0x0100010000000001), CONST64(0x0100000000000101), CONST64(0x0100010000000101), - CONST64(0x0101000000000001), CONST64(0x0101010000000001), CONST64(0x0101000000000101), CONST64(0x0101010000000101), - CONST64(0x0100000000010001), CONST64(0x0100010000010001), CONST64(0x0100000000010101), CONST64(0x0100010000010101), - CONST64(0x0101000000010001), CONST64(0x0101010000010001), CONST64(0x0101000000010101), CONST64(0x0101010000010101), - CONST64(0x0000000001000001), CONST64(0x0000010001000001), CONST64(0x0000000001000101), CONST64(0x0000010001000101), - CONST64(0x0001000001000001), CONST64(0x0001010001000001), CONST64(0x0001000001000101), CONST64(0x0001010001000101), - CONST64(0x0000000001010001), CONST64(0x0000010001010001), CONST64(0x0000000001010101), CONST64(0x0000010001010101), - CONST64(0x0001000001010001), CONST64(0x0001010001010001), CONST64(0x0001000001010101), CONST64(0x0001010001010101), - CONST64(0x0100000001000001), CONST64(0x0100010001000001), CONST64(0x0100000001000101), CONST64(0x0100010001000101), - CONST64(0x0101000001000001), CONST64(0x0101010001000001), CONST64(0x0101000001000101), CONST64(0x0101010001000101), - CONST64(0x0100000001010001), CONST64(0x0100010001010001), CONST64(0x0100000001010101), CONST64(0x0100010001010101), - CONST64(0x0101000001010001), CONST64(0x0101010001010001), CONST64(0x0101000001010101), CONST64(0x0101010001010101), - CONST64(0x0000000100000001), CONST64(0x0000010100000001), CONST64(0x0000000100000101), CONST64(0x0000010100000101), - CONST64(0x0001000100000001), CONST64(0x0001010100000001), CONST64(0x0001000100000101), CONST64(0x0001010100000101), - CONST64(0x0000000100010001), CONST64(0x0000010100010001), CONST64(0x0000000100010101), CONST64(0x0000010100010101), - CONST64(0x0001000100010001), CONST64(0x0001010100010001), CONST64(0x0001000100010101), CONST64(0x0001010100010101), - CONST64(0x0100000100000001), CONST64(0x0100010100000001), CONST64(0x0100000100000101), CONST64(0x0100010100000101), - CONST64(0x0101000100000001), CONST64(0x0101010100000001), CONST64(0x0101000100000101), CONST64(0x0101010100000101), - CONST64(0x0100000100010001), CONST64(0x0100010100010001), CONST64(0x0100000100010101), CONST64(0x0100010100010101), - CONST64(0x0101000100010001), CONST64(0x0101010100010001), CONST64(0x0101000100010101), CONST64(0x0101010100010101), - CONST64(0x0000000101000001), CONST64(0x0000010101000001), CONST64(0x0000000101000101), CONST64(0x0000010101000101), - CONST64(0x0001000101000001), CONST64(0x0001010101000001), CONST64(0x0001000101000101), CONST64(0x0001010101000101), - CONST64(0x0000000101010001), CONST64(0x0000010101010001), CONST64(0x0000000101010101), CONST64(0x0000010101010101), - CONST64(0x0001000101010001), CONST64(0x0001010101010001), CONST64(0x0001000101010101), CONST64(0x0001010101010101), - CONST64(0x0100000101000001), CONST64(0x0100010101000001), CONST64(0x0100000101000101), CONST64(0x0100010101000101), - CONST64(0x0101000101000001), CONST64(0x0101010101000001), CONST64(0x0101000101000101), CONST64(0x0101010101000101), - CONST64(0x0100000101010001), CONST64(0x0100010101010001), CONST64(0x0100000101010101), CONST64(0x0100010101010101), - CONST64(0x0101000101010001), CONST64(0x0101010101010001), CONST64(0x0101000101010101), CONST64(0x0101010101010101) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000008000000000), CONST64(0x0000000000000080), CONST64(0x0000008000000080), - CONST64(0x0000800000000000), CONST64(0x0000808000000000), CONST64(0x0000800000000080), CONST64(0x0000808000000080), - CONST64(0x0000000000008000), CONST64(0x0000008000008000), CONST64(0x0000000000008080), CONST64(0x0000008000008080), - CONST64(0x0000800000008000), CONST64(0x0000808000008000), CONST64(0x0000800000008080), CONST64(0x0000808000008080), - CONST64(0x0080000000000000), CONST64(0x0080008000000000), CONST64(0x0080000000000080), CONST64(0x0080008000000080), - CONST64(0x0080800000000000), CONST64(0x0080808000000000), CONST64(0x0080800000000080), CONST64(0x0080808000000080), - CONST64(0x0080000000008000), CONST64(0x0080008000008000), CONST64(0x0080000000008080), CONST64(0x0080008000008080), - CONST64(0x0080800000008000), CONST64(0x0080808000008000), CONST64(0x0080800000008080), CONST64(0x0080808000008080), - CONST64(0x0000000000800000), CONST64(0x0000008000800000), CONST64(0x0000000000800080), CONST64(0x0000008000800080), - CONST64(0x0000800000800000), CONST64(0x0000808000800000), CONST64(0x0000800000800080), CONST64(0x0000808000800080), - CONST64(0x0000000000808000), CONST64(0x0000008000808000), CONST64(0x0000000000808080), CONST64(0x0000008000808080), - CONST64(0x0000800000808000), CONST64(0x0000808000808000), CONST64(0x0000800000808080), CONST64(0x0000808000808080), - CONST64(0x0080000000800000), CONST64(0x0080008000800000), CONST64(0x0080000000800080), CONST64(0x0080008000800080), - CONST64(0x0080800000800000), CONST64(0x0080808000800000), CONST64(0x0080800000800080), CONST64(0x0080808000800080), - CONST64(0x0080000000808000), CONST64(0x0080008000808000), CONST64(0x0080000000808080), CONST64(0x0080008000808080), - CONST64(0x0080800000808000), CONST64(0x0080808000808000), CONST64(0x0080800000808080), CONST64(0x0080808000808080), - CONST64(0x8000000000000000), CONST64(0x8000008000000000), CONST64(0x8000000000000080), CONST64(0x8000008000000080), - CONST64(0x8000800000000000), CONST64(0x8000808000000000), CONST64(0x8000800000000080), CONST64(0x8000808000000080), - CONST64(0x8000000000008000), CONST64(0x8000008000008000), CONST64(0x8000000000008080), CONST64(0x8000008000008080), - CONST64(0x8000800000008000), CONST64(0x8000808000008000), CONST64(0x8000800000008080), CONST64(0x8000808000008080), - CONST64(0x8080000000000000), CONST64(0x8080008000000000), CONST64(0x8080000000000080), CONST64(0x8080008000000080), - CONST64(0x8080800000000000), CONST64(0x8080808000000000), CONST64(0x8080800000000080), CONST64(0x8080808000000080), - CONST64(0x8080000000008000), CONST64(0x8080008000008000), CONST64(0x8080000000008080), CONST64(0x8080008000008080), - CONST64(0x8080800000008000), CONST64(0x8080808000008000), CONST64(0x8080800000008080), CONST64(0x8080808000008080), - CONST64(0x8000000000800000), CONST64(0x8000008000800000), CONST64(0x8000000000800080), CONST64(0x8000008000800080), - CONST64(0x8000800000800000), CONST64(0x8000808000800000), CONST64(0x8000800000800080), CONST64(0x8000808000800080), - CONST64(0x8000000000808000), CONST64(0x8000008000808000), CONST64(0x8000000000808080), CONST64(0x8000008000808080), - CONST64(0x8000800000808000), CONST64(0x8000808000808000), CONST64(0x8000800000808080), CONST64(0x8000808000808080), - CONST64(0x8080000000800000), CONST64(0x8080008000800000), CONST64(0x8080000000800080), CONST64(0x8080008000800080), - CONST64(0x8080800000800000), CONST64(0x8080808000800000), CONST64(0x8080800000800080), CONST64(0x8080808000800080), - CONST64(0x8080000000808000), CONST64(0x8080008000808000), CONST64(0x8080000000808080), CONST64(0x8080008000808080), - CONST64(0x8080800000808000), CONST64(0x8080808000808000), CONST64(0x8080800000808080), CONST64(0x8080808000808080), - CONST64(0x0000000080000000), CONST64(0x0000008080000000), CONST64(0x0000000080000080), CONST64(0x0000008080000080), - CONST64(0x0000800080000000), CONST64(0x0000808080000000), CONST64(0x0000800080000080), CONST64(0x0000808080000080), - CONST64(0x0000000080008000), CONST64(0x0000008080008000), CONST64(0x0000000080008080), CONST64(0x0000008080008080), - CONST64(0x0000800080008000), CONST64(0x0000808080008000), CONST64(0x0000800080008080), CONST64(0x0000808080008080), - CONST64(0x0080000080000000), CONST64(0x0080008080000000), CONST64(0x0080000080000080), CONST64(0x0080008080000080), - CONST64(0x0080800080000000), CONST64(0x0080808080000000), CONST64(0x0080800080000080), CONST64(0x0080808080000080), - CONST64(0x0080000080008000), CONST64(0x0080008080008000), CONST64(0x0080000080008080), CONST64(0x0080008080008080), - CONST64(0x0080800080008000), CONST64(0x0080808080008000), CONST64(0x0080800080008080), CONST64(0x0080808080008080), - CONST64(0x0000000080800000), CONST64(0x0000008080800000), CONST64(0x0000000080800080), CONST64(0x0000008080800080), - CONST64(0x0000800080800000), CONST64(0x0000808080800000), CONST64(0x0000800080800080), CONST64(0x0000808080800080), - CONST64(0x0000000080808000), CONST64(0x0000008080808000), CONST64(0x0000000080808080), CONST64(0x0000008080808080), - CONST64(0x0000800080808000), CONST64(0x0000808080808000), CONST64(0x0000800080808080), CONST64(0x0000808080808080), - CONST64(0x0080000080800000), CONST64(0x0080008080800000), CONST64(0x0080000080800080), CONST64(0x0080008080800080), - CONST64(0x0080800080800000), CONST64(0x0080808080800000), CONST64(0x0080800080800080), CONST64(0x0080808080800080), - CONST64(0x0080000080808000), CONST64(0x0080008080808000), CONST64(0x0080000080808080), CONST64(0x0080008080808080), - CONST64(0x0080800080808000), CONST64(0x0080808080808000), CONST64(0x0080800080808080), CONST64(0x0080808080808080), - CONST64(0x8000000080000000), CONST64(0x8000008080000000), CONST64(0x8000000080000080), CONST64(0x8000008080000080), - CONST64(0x8000800080000000), CONST64(0x8000808080000000), CONST64(0x8000800080000080), CONST64(0x8000808080000080), - CONST64(0x8000000080008000), CONST64(0x8000008080008000), CONST64(0x8000000080008080), CONST64(0x8000008080008080), - CONST64(0x8000800080008000), CONST64(0x8000808080008000), CONST64(0x8000800080008080), CONST64(0x8000808080008080), - CONST64(0x8080000080000000), CONST64(0x8080008080000000), CONST64(0x8080000080000080), CONST64(0x8080008080000080), - CONST64(0x8080800080000000), CONST64(0x8080808080000000), CONST64(0x8080800080000080), CONST64(0x8080808080000080), - CONST64(0x8080000080008000), CONST64(0x8080008080008000), CONST64(0x8080000080008080), CONST64(0x8080008080008080), - CONST64(0x8080800080008000), CONST64(0x8080808080008000), CONST64(0x8080800080008080), CONST64(0x8080808080008080), - CONST64(0x8000000080800000), CONST64(0x8000008080800000), CONST64(0x8000000080800080), CONST64(0x8000008080800080), - CONST64(0x8000800080800000), CONST64(0x8000808080800000), CONST64(0x8000800080800080), CONST64(0x8000808080800080), - CONST64(0x8000000080808000), CONST64(0x8000008080808000), CONST64(0x8000000080808080), CONST64(0x8000008080808080), - CONST64(0x8000800080808000), CONST64(0x8000808080808000), CONST64(0x8000800080808080), CONST64(0x8000808080808080), - CONST64(0x8080000080800000), CONST64(0x8080008080800000), CONST64(0x8080000080800080), CONST64(0x8080008080800080), - CONST64(0x8080800080800000), CONST64(0x8080808080800000), CONST64(0x8080800080800080), CONST64(0x8080808080800080), - CONST64(0x8080000080808000), CONST64(0x8080008080808000), CONST64(0x8080000080808080), CONST64(0x8080008080808080), - CONST64(0x8080800080808000), CONST64(0x8080808080808000), CONST64(0x8080800080808080), CONST64(0x8080808080808080) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000004000000000), CONST64(0x0000000000000040), CONST64(0x0000004000000040), - CONST64(0x0000400000000000), CONST64(0x0000404000000000), CONST64(0x0000400000000040), CONST64(0x0000404000000040), - CONST64(0x0000000000004000), CONST64(0x0000004000004000), CONST64(0x0000000000004040), CONST64(0x0000004000004040), - CONST64(0x0000400000004000), CONST64(0x0000404000004000), CONST64(0x0000400000004040), CONST64(0x0000404000004040), - CONST64(0x0040000000000000), CONST64(0x0040004000000000), CONST64(0x0040000000000040), CONST64(0x0040004000000040), - CONST64(0x0040400000000000), CONST64(0x0040404000000000), CONST64(0x0040400000000040), CONST64(0x0040404000000040), - CONST64(0x0040000000004000), CONST64(0x0040004000004000), CONST64(0x0040000000004040), CONST64(0x0040004000004040), - CONST64(0x0040400000004000), CONST64(0x0040404000004000), CONST64(0x0040400000004040), CONST64(0x0040404000004040), - CONST64(0x0000000000400000), CONST64(0x0000004000400000), CONST64(0x0000000000400040), CONST64(0x0000004000400040), - CONST64(0x0000400000400000), CONST64(0x0000404000400000), CONST64(0x0000400000400040), CONST64(0x0000404000400040), - CONST64(0x0000000000404000), CONST64(0x0000004000404000), CONST64(0x0000000000404040), CONST64(0x0000004000404040), - CONST64(0x0000400000404000), CONST64(0x0000404000404000), CONST64(0x0000400000404040), CONST64(0x0000404000404040), - CONST64(0x0040000000400000), CONST64(0x0040004000400000), CONST64(0x0040000000400040), CONST64(0x0040004000400040), - CONST64(0x0040400000400000), CONST64(0x0040404000400000), CONST64(0x0040400000400040), CONST64(0x0040404000400040), - CONST64(0x0040000000404000), CONST64(0x0040004000404000), CONST64(0x0040000000404040), CONST64(0x0040004000404040), - CONST64(0x0040400000404000), CONST64(0x0040404000404000), CONST64(0x0040400000404040), CONST64(0x0040404000404040), - CONST64(0x4000000000000000), CONST64(0x4000004000000000), CONST64(0x4000000000000040), CONST64(0x4000004000000040), - CONST64(0x4000400000000000), CONST64(0x4000404000000000), CONST64(0x4000400000000040), CONST64(0x4000404000000040), - CONST64(0x4000000000004000), CONST64(0x4000004000004000), CONST64(0x4000000000004040), CONST64(0x4000004000004040), - CONST64(0x4000400000004000), CONST64(0x4000404000004000), CONST64(0x4000400000004040), CONST64(0x4000404000004040), - CONST64(0x4040000000000000), CONST64(0x4040004000000000), CONST64(0x4040000000000040), CONST64(0x4040004000000040), - CONST64(0x4040400000000000), CONST64(0x4040404000000000), CONST64(0x4040400000000040), CONST64(0x4040404000000040), - CONST64(0x4040000000004000), CONST64(0x4040004000004000), CONST64(0x4040000000004040), CONST64(0x4040004000004040), - CONST64(0x4040400000004000), CONST64(0x4040404000004000), CONST64(0x4040400000004040), CONST64(0x4040404000004040), - CONST64(0x4000000000400000), CONST64(0x4000004000400000), CONST64(0x4000000000400040), CONST64(0x4000004000400040), - CONST64(0x4000400000400000), CONST64(0x4000404000400000), CONST64(0x4000400000400040), CONST64(0x4000404000400040), - CONST64(0x4000000000404000), CONST64(0x4000004000404000), CONST64(0x4000000000404040), CONST64(0x4000004000404040), - CONST64(0x4000400000404000), CONST64(0x4000404000404000), CONST64(0x4000400000404040), CONST64(0x4000404000404040), - CONST64(0x4040000000400000), CONST64(0x4040004000400000), CONST64(0x4040000000400040), CONST64(0x4040004000400040), - CONST64(0x4040400000400000), CONST64(0x4040404000400000), CONST64(0x4040400000400040), CONST64(0x4040404000400040), - CONST64(0x4040000000404000), CONST64(0x4040004000404000), CONST64(0x4040000000404040), CONST64(0x4040004000404040), - CONST64(0x4040400000404000), CONST64(0x4040404000404000), CONST64(0x4040400000404040), CONST64(0x4040404000404040), - CONST64(0x0000000040000000), CONST64(0x0000004040000000), CONST64(0x0000000040000040), CONST64(0x0000004040000040), - CONST64(0x0000400040000000), CONST64(0x0000404040000000), CONST64(0x0000400040000040), CONST64(0x0000404040000040), - CONST64(0x0000000040004000), CONST64(0x0000004040004000), CONST64(0x0000000040004040), CONST64(0x0000004040004040), - CONST64(0x0000400040004000), CONST64(0x0000404040004000), CONST64(0x0000400040004040), CONST64(0x0000404040004040), - CONST64(0x0040000040000000), CONST64(0x0040004040000000), CONST64(0x0040000040000040), CONST64(0x0040004040000040), - CONST64(0x0040400040000000), CONST64(0x0040404040000000), CONST64(0x0040400040000040), CONST64(0x0040404040000040), - CONST64(0x0040000040004000), CONST64(0x0040004040004000), CONST64(0x0040000040004040), CONST64(0x0040004040004040), - CONST64(0x0040400040004000), CONST64(0x0040404040004000), CONST64(0x0040400040004040), CONST64(0x0040404040004040), - CONST64(0x0000000040400000), CONST64(0x0000004040400000), CONST64(0x0000000040400040), CONST64(0x0000004040400040), - CONST64(0x0000400040400000), CONST64(0x0000404040400000), CONST64(0x0000400040400040), CONST64(0x0000404040400040), - CONST64(0x0000000040404000), CONST64(0x0000004040404000), CONST64(0x0000000040404040), CONST64(0x0000004040404040), - CONST64(0x0000400040404000), CONST64(0x0000404040404000), CONST64(0x0000400040404040), CONST64(0x0000404040404040), - CONST64(0x0040000040400000), CONST64(0x0040004040400000), CONST64(0x0040000040400040), CONST64(0x0040004040400040), - CONST64(0x0040400040400000), CONST64(0x0040404040400000), CONST64(0x0040400040400040), CONST64(0x0040404040400040), - CONST64(0x0040000040404000), CONST64(0x0040004040404000), CONST64(0x0040000040404040), CONST64(0x0040004040404040), - CONST64(0x0040400040404000), CONST64(0x0040404040404000), CONST64(0x0040400040404040), CONST64(0x0040404040404040), - CONST64(0x4000000040000000), CONST64(0x4000004040000000), CONST64(0x4000000040000040), CONST64(0x4000004040000040), - CONST64(0x4000400040000000), CONST64(0x4000404040000000), CONST64(0x4000400040000040), CONST64(0x4000404040000040), - CONST64(0x4000000040004000), CONST64(0x4000004040004000), CONST64(0x4000000040004040), CONST64(0x4000004040004040), - CONST64(0x4000400040004000), CONST64(0x4000404040004000), CONST64(0x4000400040004040), CONST64(0x4000404040004040), - CONST64(0x4040000040000000), CONST64(0x4040004040000000), CONST64(0x4040000040000040), CONST64(0x4040004040000040), - CONST64(0x4040400040000000), CONST64(0x4040404040000000), CONST64(0x4040400040000040), CONST64(0x4040404040000040), - CONST64(0x4040000040004000), CONST64(0x4040004040004000), CONST64(0x4040000040004040), CONST64(0x4040004040004040), - CONST64(0x4040400040004000), CONST64(0x4040404040004000), CONST64(0x4040400040004040), CONST64(0x4040404040004040), - CONST64(0x4000000040400000), CONST64(0x4000004040400000), CONST64(0x4000000040400040), CONST64(0x4000004040400040), - CONST64(0x4000400040400000), CONST64(0x4000404040400000), CONST64(0x4000400040400040), CONST64(0x4000404040400040), - CONST64(0x4000000040404000), CONST64(0x4000004040404000), CONST64(0x4000000040404040), CONST64(0x4000004040404040), - CONST64(0x4000400040404000), CONST64(0x4000404040404000), CONST64(0x4000400040404040), CONST64(0x4000404040404040), - CONST64(0x4040000040400000), CONST64(0x4040004040400000), CONST64(0x4040000040400040), CONST64(0x4040004040400040), - CONST64(0x4040400040400000), CONST64(0x4040404040400000), CONST64(0x4040400040400040), CONST64(0x4040404040400040), - CONST64(0x4040000040404000), CONST64(0x4040004040404000), CONST64(0x4040000040404040), CONST64(0x4040004040404040), - CONST64(0x4040400040404000), CONST64(0x4040404040404000), CONST64(0x4040400040404040), CONST64(0x4040404040404040) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000002000000000), CONST64(0x0000000000000020), CONST64(0x0000002000000020), - CONST64(0x0000200000000000), CONST64(0x0000202000000000), CONST64(0x0000200000000020), CONST64(0x0000202000000020), - CONST64(0x0000000000002000), CONST64(0x0000002000002000), CONST64(0x0000000000002020), CONST64(0x0000002000002020), - CONST64(0x0000200000002000), CONST64(0x0000202000002000), CONST64(0x0000200000002020), CONST64(0x0000202000002020), - CONST64(0x0020000000000000), CONST64(0x0020002000000000), CONST64(0x0020000000000020), CONST64(0x0020002000000020), - CONST64(0x0020200000000000), CONST64(0x0020202000000000), CONST64(0x0020200000000020), CONST64(0x0020202000000020), - CONST64(0x0020000000002000), CONST64(0x0020002000002000), CONST64(0x0020000000002020), CONST64(0x0020002000002020), - CONST64(0x0020200000002000), CONST64(0x0020202000002000), CONST64(0x0020200000002020), CONST64(0x0020202000002020), - CONST64(0x0000000000200000), CONST64(0x0000002000200000), CONST64(0x0000000000200020), CONST64(0x0000002000200020), - CONST64(0x0000200000200000), CONST64(0x0000202000200000), CONST64(0x0000200000200020), CONST64(0x0000202000200020), - CONST64(0x0000000000202000), CONST64(0x0000002000202000), CONST64(0x0000000000202020), CONST64(0x0000002000202020), - CONST64(0x0000200000202000), CONST64(0x0000202000202000), CONST64(0x0000200000202020), CONST64(0x0000202000202020), - CONST64(0x0020000000200000), CONST64(0x0020002000200000), CONST64(0x0020000000200020), CONST64(0x0020002000200020), - CONST64(0x0020200000200000), CONST64(0x0020202000200000), CONST64(0x0020200000200020), CONST64(0x0020202000200020), - CONST64(0x0020000000202000), CONST64(0x0020002000202000), CONST64(0x0020000000202020), CONST64(0x0020002000202020), - CONST64(0x0020200000202000), CONST64(0x0020202000202000), CONST64(0x0020200000202020), CONST64(0x0020202000202020), - CONST64(0x2000000000000000), CONST64(0x2000002000000000), CONST64(0x2000000000000020), CONST64(0x2000002000000020), - CONST64(0x2000200000000000), CONST64(0x2000202000000000), CONST64(0x2000200000000020), CONST64(0x2000202000000020), - CONST64(0x2000000000002000), CONST64(0x2000002000002000), CONST64(0x2000000000002020), CONST64(0x2000002000002020), - CONST64(0x2000200000002000), CONST64(0x2000202000002000), CONST64(0x2000200000002020), CONST64(0x2000202000002020), - CONST64(0x2020000000000000), CONST64(0x2020002000000000), CONST64(0x2020000000000020), CONST64(0x2020002000000020), - CONST64(0x2020200000000000), CONST64(0x2020202000000000), CONST64(0x2020200000000020), CONST64(0x2020202000000020), - CONST64(0x2020000000002000), CONST64(0x2020002000002000), CONST64(0x2020000000002020), CONST64(0x2020002000002020), - CONST64(0x2020200000002000), CONST64(0x2020202000002000), CONST64(0x2020200000002020), CONST64(0x2020202000002020), - CONST64(0x2000000000200000), CONST64(0x2000002000200000), CONST64(0x2000000000200020), CONST64(0x2000002000200020), - CONST64(0x2000200000200000), CONST64(0x2000202000200000), CONST64(0x2000200000200020), CONST64(0x2000202000200020), - CONST64(0x2000000000202000), CONST64(0x2000002000202000), CONST64(0x2000000000202020), CONST64(0x2000002000202020), - CONST64(0x2000200000202000), CONST64(0x2000202000202000), CONST64(0x2000200000202020), CONST64(0x2000202000202020), - CONST64(0x2020000000200000), CONST64(0x2020002000200000), CONST64(0x2020000000200020), CONST64(0x2020002000200020), - CONST64(0x2020200000200000), CONST64(0x2020202000200000), CONST64(0x2020200000200020), CONST64(0x2020202000200020), - CONST64(0x2020000000202000), CONST64(0x2020002000202000), CONST64(0x2020000000202020), CONST64(0x2020002000202020), - CONST64(0x2020200000202000), CONST64(0x2020202000202000), CONST64(0x2020200000202020), CONST64(0x2020202000202020), - CONST64(0x0000000020000000), CONST64(0x0000002020000000), CONST64(0x0000000020000020), CONST64(0x0000002020000020), - CONST64(0x0000200020000000), CONST64(0x0000202020000000), CONST64(0x0000200020000020), CONST64(0x0000202020000020), - CONST64(0x0000000020002000), CONST64(0x0000002020002000), CONST64(0x0000000020002020), CONST64(0x0000002020002020), - CONST64(0x0000200020002000), CONST64(0x0000202020002000), CONST64(0x0000200020002020), CONST64(0x0000202020002020), - CONST64(0x0020000020000000), CONST64(0x0020002020000000), CONST64(0x0020000020000020), CONST64(0x0020002020000020), - CONST64(0x0020200020000000), CONST64(0x0020202020000000), CONST64(0x0020200020000020), CONST64(0x0020202020000020), - CONST64(0x0020000020002000), CONST64(0x0020002020002000), CONST64(0x0020000020002020), CONST64(0x0020002020002020), - CONST64(0x0020200020002000), CONST64(0x0020202020002000), CONST64(0x0020200020002020), CONST64(0x0020202020002020), - CONST64(0x0000000020200000), CONST64(0x0000002020200000), CONST64(0x0000000020200020), CONST64(0x0000002020200020), - CONST64(0x0000200020200000), CONST64(0x0000202020200000), CONST64(0x0000200020200020), CONST64(0x0000202020200020), - CONST64(0x0000000020202000), CONST64(0x0000002020202000), CONST64(0x0000000020202020), CONST64(0x0000002020202020), - CONST64(0x0000200020202000), CONST64(0x0000202020202000), CONST64(0x0000200020202020), CONST64(0x0000202020202020), - CONST64(0x0020000020200000), CONST64(0x0020002020200000), CONST64(0x0020000020200020), CONST64(0x0020002020200020), - CONST64(0x0020200020200000), CONST64(0x0020202020200000), CONST64(0x0020200020200020), CONST64(0x0020202020200020), - CONST64(0x0020000020202000), CONST64(0x0020002020202000), CONST64(0x0020000020202020), CONST64(0x0020002020202020), - CONST64(0x0020200020202000), CONST64(0x0020202020202000), CONST64(0x0020200020202020), CONST64(0x0020202020202020), - CONST64(0x2000000020000000), CONST64(0x2000002020000000), CONST64(0x2000000020000020), CONST64(0x2000002020000020), - CONST64(0x2000200020000000), CONST64(0x2000202020000000), CONST64(0x2000200020000020), CONST64(0x2000202020000020), - CONST64(0x2000000020002000), CONST64(0x2000002020002000), CONST64(0x2000000020002020), CONST64(0x2000002020002020), - CONST64(0x2000200020002000), CONST64(0x2000202020002000), CONST64(0x2000200020002020), CONST64(0x2000202020002020), - CONST64(0x2020000020000000), CONST64(0x2020002020000000), CONST64(0x2020000020000020), CONST64(0x2020002020000020), - CONST64(0x2020200020000000), CONST64(0x2020202020000000), CONST64(0x2020200020000020), CONST64(0x2020202020000020), - CONST64(0x2020000020002000), CONST64(0x2020002020002000), CONST64(0x2020000020002020), CONST64(0x2020002020002020), - CONST64(0x2020200020002000), CONST64(0x2020202020002000), CONST64(0x2020200020002020), CONST64(0x2020202020002020), - CONST64(0x2000000020200000), CONST64(0x2000002020200000), CONST64(0x2000000020200020), CONST64(0x2000002020200020), - CONST64(0x2000200020200000), CONST64(0x2000202020200000), CONST64(0x2000200020200020), CONST64(0x2000202020200020), - CONST64(0x2000000020202000), CONST64(0x2000002020202000), CONST64(0x2000000020202020), CONST64(0x2000002020202020), - CONST64(0x2000200020202000), CONST64(0x2000202020202000), CONST64(0x2000200020202020), CONST64(0x2000202020202020), - CONST64(0x2020000020200000), CONST64(0x2020002020200000), CONST64(0x2020000020200020), CONST64(0x2020002020200020), - CONST64(0x2020200020200000), CONST64(0x2020202020200000), CONST64(0x2020200020200020), CONST64(0x2020202020200020), - CONST64(0x2020000020202000), CONST64(0x2020002020202000), CONST64(0x2020000020202020), CONST64(0x2020002020202020), - CONST64(0x2020200020202000), CONST64(0x2020202020202000), CONST64(0x2020200020202020), CONST64(0x2020202020202020) - }}; - -static const ulong64 des_fp[8][256] = { - -{ CONST64(0x0000000000000000), CONST64(0x0000008000000000), CONST64(0x0000000002000000), CONST64(0x0000008002000000), - CONST64(0x0000000000020000), CONST64(0x0000008000020000), CONST64(0x0000000002020000), CONST64(0x0000008002020000), - CONST64(0x0000000000000200), CONST64(0x0000008000000200), CONST64(0x0000000002000200), CONST64(0x0000008002000200), - CONST64(0x0000000000020200), CONST64(0x0000008000020200), CONST64(0x0000000002020200), CONST64(0x0000008002020200), - CONST64(0x0000000000000002), CONST64(0x0000008000000002), CONST64(0x0000000002000002), CONST64(0x0000008002000002), - CONST64(0x0000000000020002), CONST64(0x0000008000020002), CONST64(0x0000000002020002), CONST64(0x0000008002020002), - CONST64(0x0000000000000202), CONST64(0x0000008000000202), CONST64(0x0000000002000202), CONST64(0x0000008002000202), - CONST64(0x0000000000020202), CONST64(0x0000008000020202), CONST64(0x0000000002020202), CONST64(0x0000008002020202), - CONST64(0x0200000000000000), CONST64(0x0200008000000000), CONST64(0x0200000002000000), CONST64(0x0200008002000000), - CONST64(0x0200000000020000), CONST64(0x0200008000020000), CONST64(0x0200000002020000), CONST64(0x0200008002020000), - CONST64(0x0200000000000200), CONST64(0x0200008000000200), CONST64(0x0200000002000200), CONST64(0x0200008002000200), - CONST64(0x0200000000020200), CONST64(0x0200008000020200), CONST64(0x0200000002020200), CONST64(0x0200008002020200), - CONST64(0x0200000000000002), CONST64(0x0200008000000002), CONST64(0x0200000002000002), CONST64(0x0200008002000002), - CONST64(0x0200000000020002), CONST64(0x0200008000020002), CONST64(0x0200000002020002), CONST64(0x0200008002020002), - CONST64(0x0200000000000202), CONST64(0x0200008000000202), CONST64(0x0200000002000202), CONST64(0x0200008002000202), - CONST64(0x0200000000020202), CONST64(0x0200008000020202), CONST64(0x0200000002020202), CONST64(0x0200008002020202), - CONST64(0x0002000000000000), CONST64(0x0002008000000000), CONST64(0x0002000002000000), CONST64(0x0002008002000000), - CONST64(0x0002000000020000), CONST64(0x0002008000020000), CONST64(0x0002000002020000), CONST64(0x0002008002020000), - CONST64(0x0002000000000200), CONST64(0x0002008000000200), CONST64(0x0002000002000200), CONST64(0x0002008002000200), - CONST64(0x0002000000020200), CONST64(0x0002008000020200), CONST64(0x0002000002020200), CONST64(0x0002008002020200), - CONST64(0x0002000000000002), CONST64(0x0002008000000002), CONST64(0x0002000002000002), CONST64(0x0002008002000002), - CONST64(0x0002000000020002), CONST64(0x0002008000020002), CONST64(0x0002000002020002), CONST64(0x0002008002020002), - CONST64(0x0002000000000202), CONST64(0x0002008000000202), CONST64(0x0002000002000202), CONST64(0x0002008002000202), - CONST64(0x0002000000020202), CONST64(0x0002008000020202), CONST64(0x0002000002020202), CONST64(0x0002008002020202), - CONST64(0x0202000000000000), CONST64(0x0202008000000000), CONST64(0x0202000002000000), CONST64(0x0202008002000000), - CONST64(0x0202000000020000), CONST64(0x0202008000020000), CONST64(0x0202000002020000), CONST64(0x0202008002020000), - CONST64(0x0202000000000200), CONST64(0x0202008000000200), CONST64(0x0202000002000200), CONST64(0x0202008002000200), - CONST64(0x0202000000020200), CONST64(0x0202008000020200), CONST64(0x0202000002020200), CONST64(0x0202008002020200), - CONST64(0x0202000000000002), CONST64(0x0202008000000002), CONST64(0x0202000002000002), CONST64(0x0202008002000002), - CONST64(0x0202000000020002), CONST64(0x0202008000020002), CONST64(0x0202000002020002), CONST64(0x0202008002020002), - CONST64(0x0202000000000202), CONST64(0x0202008000000202), CONST64(0x0202000002000202), CONST64(0x0202008002000202), - CONST64(0x0202000000020202), CONST64(0x0202008000020202), CONST64(0x0202000002020202), CONST64(0x0202008002020202), - CONST64(0x0000020000000000), CONST64(0x0000028000000000), CONST64(0x0000020002000000), CONST64(0x0000028002000000), - CONST64(0x0000020000020000), CONST64(0x0000028000020000), CONST64(0x0000020002020000), CONST64(0x0000028002020000), - CONST64(0x0000020000000200), CONST64(0x0000028000000200), CONST64(0x0000020002000200), CONST64(0x0000028002000200), - CONST64(0x0000020000020200), CONST64(0x0000028000020200), CONST64(0x0000020002020200), CONST64(0x0000028002020200), - CONST64(0x0000020000000002), CONST64(0x0000028000000002), CONST64(0x0000020002000002), CONST64(0x0000028002000002), - CONST64(0x0000020000020002), CONST64(0x0000028000020002), CONST64(0x0000020002020002), CONST64(0x0000028002020002), - CONST64(0x0000020000000202), CONST64(0x0000028000000202), CONST64(0x0000020002000202), CONST64(0x0000028002000202), - CONST64(0x0000020000020202), CONST64(0x0000028000020202), CONST64(0x0000020002020202), CONST64(0x0000028002020202), - CONST64(0x0200020000000000), CONST64(0x0200028000000000), CONST64(0x0200020002000000), CONST64(0x0200028002000000), - CONST64(0x0200020000020000), CONST64(0x0200028000020000), CONST64(0x0200020002020000), CONST64(0x0200028002020000), - CONST64(0x0200020000000200), CONST64(0x0200028000000200), CONST64(0x0200020002000200), CONST64(0x0200028002000200), - CONST64(0x0200020000020200), CONST64(0x0200028000020200), CONST64(0x0200020002020200), CONST64(0x0200028002020200), - CONST64(0x0200020000000002), CONST64(0x0200028000000002), CONST64(0x0200020002000002), CONST64(0x0200028002000002), - CONST64(0x0200020000020002), CONST64(0x0200028000020002), CONST64(0x0200020002020002), CONST64(0x0200028002020002), - CONST64(0x0200020000000202), CONST64(0x0200028000000202), CONST64(0x0200020002000202), CONST64(0x0200028002000202), - CONST64(0x0200020000020202), CONST64(0x0200028000020202), CONST64(0x0200020002020202), CONST64(0x0200028002020202), - CONST64(0x0002020000000000), CONST64(0x0002028000000000), CONST64(0x0002020002000000), CONST64(0x0002028002000000), - CONST64(0x0002020000020000), CONST64(0x0002028000020000), CONST64(0x0002020002020000), CONST64(0x0002028002020000), - CONST64(0x0002020000000200), CONST64(0x0002028000000200), CONST64(0x0002020002000200), CONST64(0x0002028002000200), - CONST64(0x0002020000020200), CONST64(0x0002028000020200), CONST64(0x0002020002020200), CONST64(0x0002028002020200), - CONST64(0x0002020000000002), CONST64(0x0002028000000002), CONST64(0x0002020002000002), CONST64(0x0002028002000002), - CONST64(0x0002020000020002), CONST64(0x0002028000020002), CONST64(0x0002020002020002), CONST64(0x0002028002020002), - CONST64(0x0002020000000202), CONST64(0x0002028000000202), CONST64(0x0002020002000202), CONST64(0x0002028002000202), - CONST64(0x0002020000020202), CONST64(0x0002028000020202), CONST64(0x0002020002020202), CONST64(0x0002028002020202), - CONST64(0x0202020000000000), CONST64(0x0202028000000000), CONST64(0x0202020002000000), CONST64(0x0202028002000000), - CONST64(0x0202020000020000), CONST64(0x0202028000020000), CONST64(0x0202020002020000), CONST64(0x0202028002020000), - CONST64(0x0202020000000200), CONST64(0x0202028000000200), CONST64(0x0202020002000200), CONST64(0x0202028002000200), - CONST64(0x0202020000020200), CONST64(0x0202028000020200), CONST64(0x0202020002020200), CONST64(0x0202028002020200), - CONST64(0x0202020000000002), CONST64(0x0202028000000002), CONST64(0x0202020002000002), CONST64(0x0202028002000002), - CONST64(0x0202020000020002), CONST64(0x0202028000020002), CONST64(0x0202020002020002), CONST64(0x0202028002020002), - CONST64(0x0202020000000202), CONST64(0x0202028000000202), CONST64(0x0202020002000202), CONST64(0x0202028002000202), - CONST64(0x0202020000020202), CONST64(0x0202028000020202), CONST64(0x0202020002020202), CONST64(0x0202028002020202) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000200000000), CONST64(0x0000000008000000), CONST64(0x0000000208000000), - CONST64(0x0000000000080000), CONST64(0x0000000200080000), CONST64(0x0000000008080000), CONST64(0x0000000208080000), - CONST64(0x0000000000000800), CONST64(0x0000000200000800), CONST64(0x0000000008000800), CONST64(0x0000000208000800), - CONST64(0x0000000000080800), CONST64(0x0000000200080800), CONST64(0x0000000008080800), CONST64(0x0000000208080800), - CONST64(0x0000000000000008), CONST64(0x0000000200000008), CONST64(0x0000000008000008), CONST64(0x0000000208000008), - CONST64(0x0000000000080008), CONST64(0x0000000200080008), CONST64(0x0000000008080008), CONST64(0x0000000208080008), - CONST64(0x0000000000000808), CONST64(0x0000000200000808), CONST64(0x0000000008000808), CONST64(0x0000000208000808), - CONST64(0x0000000000080808), CONST64(0x0000000200080808), CONST64(0x0000000008080808), CONST64(0x0000000208080808), - CONST64(0x0800000000000000), CONST64(0x0800000200000000), CONST64(0x0800000008000000), CONST64(0x0800000208000000), - CONST64(0x0800000000080000), CONST64(0x0800000200080000), CONST64(0x0800000008080000), CONST64(0x0800000208080000), - CONST64(0x0800000000000800), CONST64(0x0800000200000800), CONST64(0x0800000008000800), CONST64(0x0800000208000800), - CONST64(0x0800000000080800), CONST64(0x0800000200080800), CONST64(0x0800000008080800), CONST64(0x0800000208080800), - CONST64(0x0800000000000008), CONST64(0x0800000200000008), CONST64(0x0800000008000008), CONST64(0x0800000208000008), - CONST64(0x0800000000080008), CONST64(0x0800000200080008), CONST64(0x0800000008080008), CONST64(0x0800000208080008), - CONST64(0x0800000000000808), CONST64(0x0800000200000808), CONST64(0x0800000008000808), CONST64(0x0800000208000808), - CONST64(0x0800000000080808), CONST64(0x0800000200080808), CONST64(0x0800000008080808), CONST64(0x0800000208080808), - CONST64(0x0008000000000000), CONST64(0x0008000200000000), CONST64(0x0008000008000000), CONST64(0x0008000208000000), - CONST64(0x0008000000080000), CONST64(0x0008000200080000), CONST64(0x0008000008080000), CONST64(0x0008000208080000), - CONST64(0x0008000000000800), CONST64(0x0008000200000800), CONST64(0x0008000008000800), CONST64(0x0008000208000800), - CONST64(0x0008000000080800), CONST64(0x0008000200080800), CONST64(0x0008000008080800), CONST64(0x0008000208080800), - CONST64(0x0008000000000008), CONST64(0x0008000200000008), CONST64(0x0008000008000008), CONST64(0x0008000208000008), - CONST64(0x0008000000080008), CONST64(0x0008000200080008), CONST64(0x0008000008080008), CONST64(0x0008000208080008), - CONST64(0x0008000000000808), CONST64(0x0008000200000808), CONST64(0x0008000008000808), CONST64(0x0008000208000808), - CONST64(0x0008000000080808), CONST64(0x0008000200080808), CONST64(0x0008000008080808), CONST64(0x0008000208080808), - CONST64(0x0808000000000000), CONST64(0x0808000200000000), CONST64(0x0808000008000000), CONST64(0x0808000208000000), - CONST64(0x0808000000080000), CONST64(0x0808000200080000), CONST64(0x0808000008080000), CONST64(0x0808000208080000), - CONST64(0x0808000000000800), CONST64(0x0808000200000800), CONST64(0x0808000008000800), CONST64(0x0808000208000800), - CONST64(0x0808000000080800), CONST64(0x0808000200080800), CONST64(0x0808000008080800), CONST64(0x0808000208080800), - CONST64(0x0808000000000008), CONST64(0x0808000200000008), CONST64(0x0808000008000008), CONST64(0x0808000208000008), - CONST64(0x0808000000080008), CONST64(0x0808000200080008), CONST64(0x0808000008080008), CONST64(0x0808000208080008), - CONST64(0x0808000000000808), CONST64(0x0808000200000808), CONST64(0x0808000008000808), CONST64(0x0808000208000808), - CONST64(0x0808000000080808), CONST64(0x0808000200080808), CONST64(0x0808000008080808), CONST64(0x0808000208080808), - CONST64(0x0000080000000000), CONST64(0x0000080200000000), CONST64(0x0000080008000000), CONST64(0x0000080208000000), - CONST64(0x0000080000080000), CONST64(0x0000080200080000), CONST64(0x0000080008080000), CONST64(0x0000080208080000), - CONST64(0x0000080000000800), CONST64(0x0000080200000800), CONST64(0x0000080008000800), CONST64(0x0000080208000800), - CONST64(0x0000080000080800), CONST64(0x0000080200080800), CONST64(0x0000080008080800), CONST64(0x0000080208080800), - CONST64(0x0000080000000008), CONST64(0x0000080200000008), CONST64(0x0000080008000008), CONST64(0x0000080208000008), - CONST64(0x0000080000080008), CONST64(0x0000080200080008), CONST64(0x0000080008080008), CONST64(0x0000080208080008), - CONST64(0x0000080000000808), CONST64(0x0000080200000808), CONST64(0x0000080008000808), CONST64(0x0000080208000808), - CONST64(0x0000080000080808), CONST64(0x0000080200080808), CONST64(0x0000080008080808), CONST64(0x0000080208080808), - CONST64(0x0800080000000000), CONST64(0x0800080200000000), CONST64(0x0800080008000000), CONST64(0x0800080208000000), - CONST64(0x0800080000080000), CONST64(0x0800080200080000), CONST64(0x0800080008080000), CONST64(0x0800080208080000), - CONST64(0x0800080000000800), CONST64(0x0800080200000800), CONST64(0x0800080008000800), CONST64(0x0800080208000800), - CONST64(0x0800080000080800), CONST64(0x0800080200080800), CONST64(0x0800080008080800), CONST64(0x0800080208080800), - CONST64(0x0800080000000008), CONST64(0x0800080200000008), CONST64(0x0800080008000008), CONST64(0x0800080208000008), - CONST64(0x0800080000080008), CONST64(0x0800080200080008), CONST64(0x0800080008080008), CONST64(0x0800080208080008), - CONST64(0x0800080000000808), CONST64(0x0800080200000808), CONST64(0x0800080008000808), CONST64(0x0800080208000808), - CONST64(0x0800080000080808), CONST64(0x0800080200080808), CONST64(0x0800080008080808), CONST64(0x0800080208080808), - CONST64(0x0008080000000000), CONST64(0x0008080200000000), CONST64(0x0008080008000000), CONST64(0x0008080208000000), - CONST64(0x0008080000080000), CONST64(0x0008080200080000), CONST64(0x0008080008080000), CONST64(0x0008080208080000), - CONST64(0x0008080000000800), CONST64(0x0008080200000800), CONST64(0x0008080008000800), CONST64(0x0008080208000800), - CONST64(0x0008080000080800), CONST64(0x0008080200080800), CONST64(0x0008080008080800), CONST64(0x0008080208080800), - CONST64(0x0008080000000008), CONST64(0x0008080200000008), CONST64(0x0008080008000008), CONST64(0x0008080208000008), - CONST64(0x0008080000080008), CONST64(0x0008080200080008), CONST64(0x0008080008080008), CONST64(0x0008080208080008), - CONST64(0x0008080000000808), CONST64(0x0008080200000808), CONST64(0x0008080008000808), CONST64(0x0008080208000808), - CONST64(0x0008080000080808), CONST64(0x0008080200080808), CONST64(0x0008080008080808), CONST64(0x0008080208080808), - CONST64(0x0808080000000000), CONST64(0x0808080200000000), CONST64(0x0808080008000000), CONST64(0x0808080208000000), - CONST64(0x0808080000080000), CONST64(0x0808080200080000), CONST64(0x0808080008080000), CONST64(0x0808080208080000), - CONST64(0x0808080000000800), CONST64(0x0808080200000800), CONST64(0x0808080008000800), CONST64(0x0808080208000800), - CONST64(0x0808080000080800), CONST64(0x0808080200080800), CONST64(0x0808080008080800), CONST64(0x0808080208080800), - CONST64(0x0808080000000008), CONST64(0x0808080200000008), CONST64(0x0808080008000008), CONST64(0x0808080208000008), - CONST64(0x0808080000080008), CONST64(0x0808080200080008), CONST64(0x0808080008080008), CONST64(0x0808080208080008), - CONST64(0x0808080000000808), CONST64(0x0808080200000808), CONST64(0x0808080008000808), CONST64(0x0808080208000808), - CONST64(0x0808080000080808), CONST64(0x0808080200080808), CONST64(0x0808080008080808), CONST64(0x0808080208080808) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000800000000), CONST64(0x0000000020000000), CONST64(0x0000000820000000), - CONST64(0x0000000000200000), CONST64(0x0000000800200000), CONST64(0x0000000020200000), CONST64(0x0000000820200000), - CONST64(0x0000000000002000), CONST64(0x0000000800002000), CONST64(0x0000000020002000), CONST64(0x0000000820002000), - CONST64(0x0000000000202000), CONST64(0x0000000800202000), CONST64(0x0000000020202000), CONST64(0x0000000820202000), - CONST64(0x0000000000000020), CONST64(0x0000000800000020), CONST64(0x0000000020000020), CONST64(0x0000000820000020), - CONST64(0x0000000000200020), CONST64(0x0000000800200020), CONST64(0x0000000020200020), CONST64(0x0000000820200020), - CONST64(0x0000000000002020), CONST64(0x0000000800002020), CONST64(0x0000000020002020), CONST64(0x0000000820002020), - CONST64(0x0000000000202020), CONST64(0x0000000800202020), CONST64(0x0000000020202020), CONST64(0x0000000820202020), - CONST64(0x2000000000000000), CONST64(0x2000000800000000), CONST64(0x2000000020000000), CONST64(0x2000000820000000), - CONST64(0x2000000000200000), CONST64(0x2000000800200000), CONST64(0x2000000020200000), CONST64(0x2000000820200000), - CONST64(0x2000000000002000), CONST64(0x2000000800002000), CONST64(0x2000000020002000), CONST64(0x2000000820002000), - CONST64(0x2000000000202000), CONST64(0x2000000800202000), CONST64(0x2000000020202000), CONST64(0x2000000820202000), - CONST64(0x2000000000000020), CONST64(0x2000000800000020), CONST64(0x2000000020000020), CONST64(0x2000000820000020), - CONST64(0x2000000000200020), CONST64(0x2000000800200020), CONST64(0x2000000020200020), CONST64(0x2000000820200020), - CONST64(0x2000000000002020), CONST64(0x2000000800002020), CONST64(0x2000000020002020), CONST64(0x2000000820002020), - CONST64(0x2000000000202020), CONST64(0x2000000800202020), CONST64(0x2000000020202020), CONST64(0x2000000820202020), - CONST64(0x0020000000000000), CONST64(0x0020000800000000), CONST64(0x0020000020000000), CONST64(0x0020000820000000), - CONST64(0x0020000000200000), CONST64(0x0020000800200000), CONST64(0x0020000020200000), CONST64(0x0020000820200000), - CONST64(0x0020000000002000), CONST64(0x0020000800002000), CONST64(0x0020000020002000), CONST64(0x0020000820002000), - CONST64(0x0020000000202000), CONST64(0x0020000800202000), CONST64(0x0020000020202000), CONST64(0x0020000820202000), - CONST64(0x0020000000000020), CONST64(0x0020000800000020), CONST64(0x0020000020000020), CONST64(0x0020000820000020), - CONST64(0x0020000000200020), CONST64(0x0020000800200020), CONST64(0x0020000020200020), CONST64(0x0020000820200020), - CONST64(0x0020000000002020), CONST64(0x0020000800002020), CONST64(0x0020000020002020), CONST64(0x0020000820002020), - CONST64(0x0020000000202020), CONST64(0x0020000800202020), CONST64(0x0020000020202020), CONST64(0x0020000820202020), - CONST64(0x2020000000000000), CONST64(0x2020000800000000), CONST64(0x2020000020000000), CONST64(0x2020000820000000), - CONST64(0x2020000000200000), CONST64(0x2020000800200000), CONST64(0x2020000020200000), CONST64(0x2020000820200000), - CONST64(0x2020000000002000), CONST64(0x2020000800002000), CONST64(0x2020000020002000), CONST64(0x2020000820002000), - CONST64(0x2020000000202000), CONST64(0x2020000800202000), CONST64(0x2020000020202000), CONST64(0x2020000820202000), - CONST64(0x2020000000000020), CONST64(0x2020000800000020), CONST64(0x2020000020000020), CONST64(0x2020000820000020), - CONST64(0x2020000000200020), CONST64(0x2020000800200020), CONST64(0x2020000020200020), CONST64(0x2020000820200020), - CONST64(0x2020000000002020), CONST64(0x2020000800002020), CONST64(0x2020000020002020), CONST64(0x2020000820002020), - CONST64(0x2020000000202020), CONST64(0x2020000800202020), CONST64(0x2020000020202020), CONST64(0x2020000820202020), - CONST64(0x0000200000000000), CONST64(0x0000200800000000), CONST64(0x0000200020000000), CONST64(0x0000200820000000), - CONST64(0x0000200000200000), CONST64(0x0000200800200000), CONST64(0x0000200020200000), CONST64(0x0000200820200000), - CONST64(0x0000200000002000), CONST64(0x0000200800002000), CONST64(0x0000200020002000), CONST64(0x0000200820002000), - CONST64(0x0000200000202000), CONST64(0x0000200800202000), CONST64(0x0000200020202000), CONST64(0x0000200820202000), - CONST64(0x0000200000000020), CONST64(0x0000200800000020), CONST64(0x0000200020000020), CONST64(0x0000200820000020), - CONST64(0x0000200000200020), CONST64(0x0000200800200020), CONST64(0x0000200020200020), CONST64(0x0000200820200020), - CONST64(0x0000200000002020), CONST64(0x0000200800002020), CONST64(0x0000200020002020), CONST64(0x0000200820002020), - CONST64(0x0000200000202020), CONST64(0x0000200800202020), CONST64(0x0000200020202020), CONST64(0x0000200820202020), - CONST64(0x2000200000000000), CONST64(0x2000200800000000), CONST64(0x2000200020000000), CONST64(0x2000200820000000), - CONST64(0x2000200000200000), CONST64(0x2000200800200000), CONST64(0x2000200020200000), CONST64(0x2000200820200000), - CONST64(0x2000200000002000), CONST64(0x2000200800002000), CONST64(0x2000200020002000), CONST64(0x2000200820002000), - CONST64(0x2000200000202000), CONST64(0x2000200800202000), CONST64(0x2000200020202000), CONST64(0x2000200820202000), - CONST64(0x2000200000000020), CONST64(0x2000200800000020), CONST64(0x2000200020000020), CONST64(0x2000200820000020), - CONST64(0x2000200000200020), CONST64(0x2000200800200020), CONST64(0x2000200020200020), CONST64(0x2000200820200020), - CONST64(0x2000200000002020), CONST64(0x2000200800002020), CONST64(0x2000200020002020), CONST64(0x2000200820002020), - CONST64(0x2000200000202020), CONST64(0x2000200800202020), CONST64(0x2000200020202020), CONST64(0x2000200820202020), - CONST64(0x0020200000000000), CONST64(0x0020200800000000), CONST64(0x0020200020000000), CONST64(0x0020200820000000), - CONST64(0x0020200000200000), CONST64(0x0020200800200000), CONST64(0x0020200020200000), CONST64(0x0020200820200000), - CONST64(0x0020200000002000), CONST64(0x0020200800002000), CONST64(0x0020200020002000), CONST64(0x0020200820002000), - CONST64(0x0020200000202000), CONST64(0x0020200800202000), CONST64(0x0020200020202000), CONST64(0x0020200820202000), - CONST64(0x0020200000000020), CONST64(0x0020200800000020), CONST64(0x0020200020000020), CONST64(0x0020200820000020), - CONST64(0x0020200000200020), CONST64(0x0020200800200020), CONST64(0x0020200020200020), CONST64(0x0020200820200020), - CONST64(0x0020200000002020), CONST64(0x0020200800002020), CONST64(0x0020200020002020), CONST64(0x0020200820002020), - CONST64(0x0020200000202020), CONST64(0x0020200800202020), CONST64(0x0020200020202020), CONST64(0x0020200820202020), - CONST64(0x2020200000000000), CONST64(0x2020200800000000), CONST64(0x2020200020000000), CONST64(0x2020200820000000), - CONST64(0x2020200000200000), CONST64(0x2020200800200000), CONST64(0x2020200020200000), CONST64(0x2020200820200000), - CONST64(0x2020200000002000), CONST64(0x2020200800002000), CONST64(0x2020200020002000), CONST64(0x2020200820002000), - CONST64(0x2020200000202000), CONST64(0x2020200800202000), CONST64(0x2020200020202000), CONST64(0x2020200820202000), - CONST64(0x2020200000000020), CONST64(0x2020200800000020), CONST64(0x2020200020000020), CONST64(0x2020200820000020), - CONST64(0x2020200000200020), CONST64(0x2020200800200020), CONST64(0x2020200020200020), CONST64(0x2020200820200020), - CONST64(0x2020200000002020), CONST64(0x2020200800002020), CONST64(0x2020200020002020), CONST64(0x2020200820002020), - CONST64(0x2020200000202020), CONST64(0x2020200800202020), CONST64(0x2020200020202020), CONST64(0x2020200820202020) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000002000000000), CONST64(0x0000000080000000), CONST64(0x0000002080000000), - CONST64(0x0000000000800000), CONST64(0x0000002000800000), CONST64(0x0000000080800000), CONST64(0x0000002080800000), - CONST64(0x0000000000008000), CONST64(0x0000002000008000), CONST64(0x0000000080008000), CONST64(0x0000002080008000), - CONST64(0x0000000000808000), CONST64(0x0000002000808000), CONST64(0x0000000080808000), CONST64(0x0000002080808000), - CONST64(0x0000000000000080), CONST64(0x0000002000000080), CONST64(0x0000000080000080), CONST64(0x0000002080000080), - CONST64(0x0000000000800080), CONST64(0x0000002000800080), CONST64(0x0000000080800080), CONST64(0x0000002080800080), - CONST64(0x0000000000008080), CONST64(0x0000002000008080), CONST64(0x0000000080008080), CONST64(0x0000002080008080), - CONST64(0x0000000000808080), CONST64(0x0000002000808080), CONST64(0x0000000080808080), CONST64(0x0000002080808080), - CONST64(0x8000000000000000), CONST64(0x8000002000000000), CONST64(0x8000000080000000), CONST64(0x8000002080000000), - CONST64(0x8000000000800000), CONST64(0x8000002000800000), CONST64(0x8000000080800000), CONST64(0x8000002080800000), - CONST64(0x8000000000008000), CONST64(0x8000002000008000), CONST64(0x8000000080008000), CONST64(0x8000002080008000), - CONST64(0x8000000000808000), CONST64(0x8000002000808000), CONST64(0x8000000080808000), CONST64(0x8000002080808000), - CONST64(0x8000000000000080), CONST64(0x8000002000000080), CONST64(0x8000000080000080), CONST64(0x8000002080000080), - CONST64(0x8000000000800080), CONST64(0x8000002000800080), CONST64(0x8000000080800080), CONST64(0x8000002080800080), - CONST64(0x8000000000008080), CONST64(0x8000002000008080), CONST64(0x8000000080008080), CONST64(0x8000002080008080), - CONST64(0x8000000000808080), CONST64(0x8000002000808080), CONST64(0x8000000080808080), CONST64(0x8000002080808080), - CONST64(0x0080000000000000), CONST64(0x0080002000000000), CONST64(0x0080000080000000), CONST64(0x0080002080000000), - CONST64(0x0080000000800000), CONST64(0x0080002000800000), CONST64(0x0080000080800000), CONST64(0x0080002080800000), - CONST64(0x0080000000008000), CONST64(0x0080002000008000), CONST64(0x0080000080008000), CONST64(0x0080002080008000), - CONST64(0x0080000000808000), CONST64(0x0080002000808000), CONST64(0x0080000080808000), CONST64(0x0080002080808000), - CONST64(0x0080000000000080), CONST64(0x0080002000000080), CONST64(0x0080000080000080), CONST64(0x0080002080000080), - CONST64(0x0080000000800080), CONST64(0x0080002000800080), CONST64(0x0080000080800080), CONST64(0x0080002080800080), - CONST64(0x0080000000008080), CONST64(0x0080002000008080), CONST64(0x0080000080008080), CONST64(0x0080002080008080), - CONST64(0x0080000000808080), CONST64(0x0080002000808080), CONST64(0x0080000080808080), CONST64(0x0080002080808080), - CONST64(0x8080000000000000), CONST64(0x8080002000000000), CONST64(0x8080000080000000), CONST64(0x8080002080000000), - CONST64(0x8080000000800000), CONST64(0x8080002000800000), CONST64(0x8080000080800000), CONST64(0x8080002080800000), - CONST64(0x8080000000008000), CONST64(0x8080002000008000), CONST64(0x8080000080008000), CONST64(0x8080002080008000), - CONST64(0x8080000000808000), CONST64(0x8080002000808000), CONST64(0x8080000080808000), CONST64(0x8080002080808000), - CONST64(0x8080000000000080), CONST64(0x8080002000000080), CONST64(0x8080000080000080), CONST64(0x8080002080000080), - CONST64(0x8080000000800080), CONST64(0x8080002000800080), CONST64(0x8080000080800080), CONST64(0x8080002080800080), - CONST64(0x8080000000008080), CONST64(0x8080002000008080), CONST64(0x8080000080008080), CONST64(0x8080002080008080), - CONST64(0x8080000000808080), CONST64(0x8080002000808080), CONST64(0x8080000080808080), CONST64(0x8080002080808080), - CONST64(0x0000800000000000), CONST64(0x0000802000000000), CONST64(0x0000800080000000), CONST64(0x0000802080000000), - CONST64(0x0000800000800000), CONST64(0x0000802000800000), CONST64(0x0000800080800000), CONST64(0x0000802080800000), - CONST64(0x0000800000008000), CONST64(0x0000802000008000), CONST64(0x0000800080008000), CONST64(0x0000802080008000), - CONST64(0x0000800000808000), CONST64(0x0000802000808000), CONST64(0x0000800080808000), CONST64(0x0000802080808000), - CONST64(0x0000800000000080), CONST64(0x0000802000000080), CONST64(0x0000800080000080), CONST64(0x0000802080000080), - CONST64(0x0000800000800080), CONST64(0x0000802000800080), CONST64(0x0000800080800080), CONST64(0x0000802080800080), - CONST64(0x0000800000008080), CONST64(0x0000802000008080), CONST64(0x0000800080008080), CONST64(0x0000802080008080), - CONST64(0x0000800000808080), CONST64(0x0000802000808080), CONST64(0x0000800080808080), CONST64(0x0000802080808080), - CONST64(0x8000800000000000), CONST64(0x8000802000000000), CONST64(0x8000800080000000), CONST64(0x8000802080000000), - CONST64(0x8000800000800000), CONST64(0x8000802000800000), CONST64(0x8000800080800000), CONST64(0x8000802080800000), - CONST64(0x8000800000008000), CONST64(0x8000802000008000), CONST64(0x8000800080008000), CONST64(0x8000802080008000), - CONST64(0x8000800000808000), CONST64(0x8000802000808000), CONST64(0x8000800080808000), CONST64(0x8000802080808000), - CONST64(0x8000800000000080), CONST64(0x8000802000000080), CONST64(0x8000800080000080), CONST64(0x8000802080000080), - CONST64(0x8000800000800080), CONST64(0x8000802000800080), CONST64(0x8000800080800080), CONST64(0x8000802080800080), - CONST64(0x8000800000008080), CONST64(0x8000802000008080), CONST64(0x8000800080008080), CONST64(0x8000802080008080), - CONST64(0x8000800000808080), CONST64(0x8000802000808080), CONST64(0x8000800080808080), CONST64(0x8000802080808080), - CONST64(0x0080800000000000), CONST64(0x0080802000000000), CONST64(0x0080800080000000), CONST64(0x0080802080000000), - CONST64(0x0080800000800000), CONST64(0x0080802000800000), CONST64(0x0080800080800000), CONST64(0x0080802080800000), - CONST64(0x0080800000008000), CONST64(0x0080802000008000), CONST64(0x0080800080008000), CONST64(0x0080802080008000), - CONST64(0x0080800000808000), CONST64(0x0080802000808000), CONST64(0x0080800080808000), CONST64(0x0080802080808000), - CONST64(0x0080800000000080), CONST64(0x0080802000000080), CONST64(0x0080800080000080), CONST64(0x0080802080000080), - CONST64(0x0080800000800080), CONST64(0x0080802000800080), CONST64(0x0080800080800080), CONST64(0x0080802080800080), - CONST64(0x0080800000008080), CONST64(0x0080802000008080), CONST64(0x0080800080008080), CONST64(0x0080802080008080), - CONST64(0x0080800000808080), CONST64(0x0080802000808080), CONST64(0x0080800080808080), CONST64(0x0080802080808080), - CONST64(0x8080800000000000), CONST64(0x8080802000000000), CONST64(0x8080800080000000), CONST64(0x8080802080000000), - CONST64(0x8080800000800000), CONST64(0x8080802000800000), CONST64(0x8080800080800000), CONST64(0x8080802080800000), - CONST64(0x8080800000008000), CONST64(0x8080802000008000), CONST64(0x8080800080008000), CONST64(0x8080802080008000), - CONST64(0x8080800000808000), CONST64(0x8080802000808000), CONST64(0x8080800080808000), CONST64(0x8080802080808000), - CONST64(0x8080800000000080), CONST64(0x8080802000000080), CONST64(0x8080800080000080), CONST64(0x8080802080000080), - CONST64(0x8080800000800080), CONST64(0x8080802000800080), CONST64(0x8080800080800080), CONST64(0x8080802080800080), - CONST64(0x8080800000008080), CONST64(0x8080802000008080), CONST64(0x8080800080008080), CONST64(0x8080802080008080), - CONST64(0x8080800000808080), CONST64(0x8080802000808080), CONST64(0x8080800080808080), CONST64(0x8080802080808080) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000004000000000), CONST64(0x0000000001000000), CONST64(0x0000004001000000), - CONST64(0x0000000000010000), CONST64(0x0000004000010000), CONST64(0x0000000001010000), CONST64(0x0000004001010000), - CONST64(0x0000000000000100), CONST64(0x0000004000000100), CONST64(0x0000000001000100), CONST64(0x0000004001000100), - CONST64(0x0000000000010100), CONST64(0x0000004000010100), CONST64(0x0000000001010100), CONST64(0x0000004001010100), - CONST64(0x0000000000000001), CONST64(0x0000004000000001), CONST64(0x0000000001000001), CONST64(0x0000004001000001), - CONST64(0x0000000000010001), CONST64(0x0000004000010001), CONST64(0x0000000001010001), CONST64(0x0000004001010001), - CONST64(0x0000000000000101), CONST64(0x0000004000000101), CONST64(0x0000000001000101), CONST64(0x0000004001000101), - CONST64(0x0000000000010101), CONST64(0x0000004000010101), CONST64(0x0000000001010101), CONST64(0x0000004001010101), - CONST64(0x0100000000000000), CONST64(0x0100004000000000), CONST64(0x0100000001000000), CONST64(0x0100004001000000), - CONST64(0x0100000000010000), CONST64(0x0100004000010000), CONST64(0x0100000001010000), CONST64(0x0100004001010000), - CONST64(0x0100000000000100), CONST64(0x0100004000000100), CONST64(0x0100000001000100), CONST64(0x0100004001000100), - CONST64(0x0100000000010100), CONST64(0x0100004000010100), CONST64(0x0100000001010100), CONST64(0x0100004001010100), - CONST64(0x0100000000000001), CONST64(0x0100004000000001), CONST64(0x0100000001000001), CONST64(0x0100004001000001), - CONST64(0x0100000000010001), CONST64(0x0100004000010001), CONST64(0x0100000001010001), CONST64(0x0100004001010001), - CONST64(0x0100000000000101), CONST64(0x0100004000000101), CONST64(0x0100000001000101), CONST64(0x0100004001000101), - CONST64(0x0100000000010101), CONST64(0x0100004000010101), CONST64(0x0100000001010101), CONST64(0x0100004001010101), - CONST64(0x0001000000000000), CONST64(0x0001004000000000), CONST64(0x0001000001000000), CONST64(0x0001004001000000), - CONST64(0x0001000000010000), CONST64(0x0001004000010000), CONST64(0x0001000001010000), CONST64(0x0001004001010000), - CONST64(0x0001000000000100), CONST64(0x0001004000000100), CONST64(0x0001000001000100), CONST64(0x0001004001000100), - CONST64(0x0001000000010100), CONST64(0x0001004000010100), CONST64(0x0001000001010100), CONST64(0x0001004001010100), - CONST64(0x0001000000000001), CONST64(0x0001004000000001), CONST64(0x0001000001000001), CONST64(0x0001004001000001), - CONST64(0x0001000000010001), CONST64(0x0001004000010001), CONST64(0x0001000001010001), CONST64(0x0001004001010001), - CONST64(0x0001000000000101), CONST64(0x0001004000000101), CONST64(0x0001000001000101), CONST64(0x0001004001000101), - CONST64(0x0001000000010101), CONST64(0x0001004000010101), CONST64(0x0001000001010101), CONST64(0x0001004001010101), - CONST64(0x0101000000000000), CONST64(0x0101004000000000), CONST64(0x0101000001000000), CONST64(0x0101004001000000), - CONST64(0x0101000000010000), CONST64(0x0101004000010000), CONST64(0x0101000001010000), CONST64(0x0101004001010000), - CONST64(0x0101000000000100), CONST64(0x0101004000000100), CONST64(0x0101000001000100), CONST64(0x0101004001000100), - CONST64(0x0101000000010100), CONST64(0x0101004000010100), CONST64(0x0101000001010100), CONST64(0x0101004001010100), - CONST64(0x0101000000000001), CONST64(0x0101004000000001), CONST64(0x0101000001000001), CONST64(0x0101004001000001), - CONST64(0x0101000000010001), CONST64(0x0101004000010001), CONST64(0x0101000001010001), CONST64(0x0101004001010001), - CONST64(0x0101000000000101), CONST64(0x0101004000000101), CONST64(0x0101000001000101), CONST64(0x0101004001000101), - CONST64(0x0101000000010101), CONST64(0x0101004000010101), CONST64(0x0101000001010101), CONST64(0x0101004001010101), - CONST64(0x0000010000000000), CONST64(0x0000014000000000), CONST64(0x0000010001000000), CONST64(0x0000014001000000), - CONST64(0x0000010000010000), CONST64(0x0000014000010000), CONST64(0x0000010001010000), CONST64(0x0000014001010000), - CONST64(0x0000010000000100), CONST64(0x0000014000000100), CONST64(0x0000010001000100), CONST64(0x0000014001000100), - CONST64(0x0000010000010100), CONST64(0x0000014000010100), CONST64(0x0000010001010100), CONST64(0x0000014001010100), - CONST64(0x0000010000000001), CONST64(0x0000014000000001), CONST64(0x0000010001000001), CONST64(0x0000014001000001), - CONST64(0x0000010000010001), CONST64(0x0000014000010001), CONST64(0x0000010001010001), CONST64(0x0000014001010001), - CONST64(0x0000010000000101), CONST64(0x0000014000000101), CONST64(0x0000010001000101), CONST64(0x0000014001000101), - CONST64(0x0000010000010101), CONST64(0x0000014000010101), CONST64(0x0000010001010101), CONST64(0x0000014001010101), - CONST64(0x0100010000000000), CONST64(0x0100014000000000), CONST64(0x0100010001000000), CONST64(0x0100014001000000), - CONST64(0x0100010000010000), CONST64(0x0100014000010000), CONST64(0x0100010001010000), CONST64(0x0100014001010000), - CONST64(0x0100010000000100), CONST64(0x0100014000000100), CONST64(0x0100010001000100), CONST64(0x0100014001000100), - CONST64(0x0100010000010100), CONST64(0x0100014000010100), CONST64(0x0100010001010100), CONST64(0x0100014001010100), - CONST64(0x0100010000000001), CONST64(0x0100014000000001), CONST64(0x0100010001000001), CONST64(0x0100014001000001), - CONST64(0x0100010000010001), CONST64(0x0100014000010001), CONST64(0x0100010001010001), CONST64(0x0100014001010001), - CONST64(0x0100010000000101), CONST64(0x0100014000000101), CONST64(0x0100010001000101), CONST64(0x0100014001000101), - CONST64(0x0100010000010101), CONST64(0x0100014000010101), CONST64(0x0100010001010101), CONST64(0x0100014001010101), - CONST64(0x0001010000000000), CONST64(0x0001014000000000), CONST64(0x0001010001000000), CONST64(0x0001014001000000), - CONST64(0x0001010000010000), CONST64(0x0001014000010000), CONST64(0x0001010001010000), CONST64(0x0001014001010000), - CONST64(0x0001010000000100), CONST64(0x0001014000000100), CONST64(0x0001010001000100), CONST64(0x0001014001000100), - CONST64(0x0001010000010100), CONST64(0x0001014000010100), CONST64(0x0001010001010100), CONST64(0x0001014001010100), - CONST64(0x0001010000000001), CONST64(0x0001014000000001), CONST64(0x0001010001000001), CONST64(0x0001014001000001), - CONST64(0x0001010000010001), CONST64(0x0001014000010001), CONST64(0x0001010001010001), CONST64(0x0001014001010001), - CONST64(0x0001010000000101), CONST64(0x0001014000000101), CONST64(0x0001010001000101), CONST64(0x0001014001000101), - CONST64(0x0001010000010101), CONST64(0x0001014000010101), CONST64(0x0001010001010101), CONST64(0x0001014001010101), - CONST64(0x0101010000000000), CONST64(0x0101014000000000), CONST64(0x0101010001000000), CONST64(0x0101014001000000), - CONST64(0x0101010000010000), CONST64(0x0101014000010000), CONST64(0x0101010001010000), CONST64(0x0101014001010000), - CONST64(0x0101010000000100), CONST64(0x0101014000000100), CONST64(0x0101010001000100), CONST64(0x0101014001000100), - CONST64(0x0101010000010100), CONST64(0x0101014000010100), CONST64(0x0101010001010100), CONST64(0x0101014001010100), - CONST64(0x0101010000000001), CONST64(0x0101014000000001), CONST64(0x0101010001000001), CONST64(0x0101014001000001), - CONST64(0x0101010000010001), CONST64(0x0101014000010001), CONST64(0x0101010001010001), CONST64(0x0101014001010001), - CONST64(0x0101010000000101), CONST64(0x0101014000000101), CONST64(0x0101010001000101), CONST64(0x0101014001000101), - CONST64(0x0101010000010101), CONST64(0x0101014000010101), CONST64(0x0101010001010101), CONST64(0x0101014001010101) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000100000000), CONST64(0x0000000004000000), CONST64(0x0000000104000000), - CONST64(0x0000000000040000), CONST64(0x0000000100040000), CONST64(0x0000000004040000), CONST64(0x0000000104040000), - CONST64(0x0000000000000400), CONST64(0x0000000100000400), CONST64(0x0000000004000400), CONST64(0x0000000104000400), - CONST64(0x0000000000040400), CONST64(0x0000000100040400), CONST64(0x0000000004040400), CONST64(0x0000000104040400), - CONST64(0x0000000000000004), CONST64(0x0000000100000004), CONST64(0x0000000004000004), CONST64(0x0000000104000004), - CONST64(0x0000000000040004), CONST64(0x0000000100040004), CONST64(0x0000000004040004), CONST64(0x0000000104040004), - CONST64(0x0000000000000404), CONST64(0x0000000100000404), CONST64(0x0000000004000404), CONST64(0x0000000104000404), - CONST64(0x0000000000040404), CONST64(0x0000000100040404), CONST64(0x0000000004040404), CONST64(0x0000000104040404), - CONST64(0x0400000000000000), CONST64(0x0400000100000000), CONST64(0x0400000004000000), CONST64(0x0400000104000000), - CONST64(0x0400000000040000), CONST64(0x0400000100040000), CONST64(0x0400000004040000), CONST64(0x0400000104040000), - CONST64(0x0400000000000400), CONST64(0x0400000100000400), CONST64(0x0400000004000400), CONST64(0x0400000104000400), - CONST64(0x0400000000040400), CONST64(0x0400000100040400), CONST64(0x0400000004040400), CONST64(0x0400000104040400), - CONST64(0x0400000000000004), CONST64(0x0400000100000004), CONST64(0x0400000004000004), CONST64(0x0400000104000004), - CONST64(0x0400000000040004), CONST64(0x0400000100040004), CONST64(0x0400000004040004), CONST64(0x0400000104040004), - CONST64(0x0400000000000404), CONST64(0x0400000100000404), CONST64(0x0400000004000404), CONST64(0x0400000104000404), - CONST64(0x0400000000040404), CONST64(0x0400000100040404), CONST64(0x0400000004040404), CONST64(0x0400000104040404), - CONST64(0x0004000000000000), CONST64(0x0004000100000000), CONST64(0x0004000004000000), CONST64(0x0004000104000000), - CONST64(0x0004000000040000), CONST64(0x0004000100040000), CONST64(0x0004000004040000), CONST64(0x0004000104040000), - CONST64(0x0004000000000400), CONST64(0x0004000100000400), CONST64(0x0004000004000400), CONST64(0x0004000104000400), - CONST64(0x0004000000040400), CONST64(0x0004000100040400), CONST64(0x0004000004040400), CONST64(0x0004000104040400), - CONST64(0x0004000000000004), CONST64(0x0004000100000004), CONST64(0x0004000004000004), CONST64(0x0004000104000004), - CONST64(0x0004000000040004), CONST64(0x0004000100040004), CONST64(0x0004000004040004), CONST64(0x0004000104040004), - CONST64(0x0004000000000404), CONST64(0x0004000100000404), CONST64(0x0004000004000404), CONST64(0x0004000104000404), - CONST64(0x0004000000040404), CONST64(0x0004000100040404), CONST64(0x0004000004040404), CONST64(0x0004000104040404), - CONST64(0x0404000000000000), CONST64(0x0404000100000000), CONST64(0x0404000004000000), CONST64(0x0404000104000000), - CONST64(0x0404000000040000), CONST64(0x0404000100040000), CONST64(0x0404000004040000), CONST64(0x0404000104040000), - CONST64(0x0404000000000400), CONST64(0x0404000100000400), CONST64(0x0404000004000400), CONST64(0x0404000104000400), - CONST64(0x0404000000040400), CONST64(0x0404000100040400), CONST64(0x0404000004040400), CONST64(0x0404000104040400), - CONST64(0x0404000000000004), CONST64(0x0404000100000004), CONST64(0x0404000004000004), CONST64(0x0404000104000004), - CONST64(0x0404000000040004), CONST64(0x0404000100040004), CONST64(0x0404000004040004), CONST64(0x0404000104040004), - CONST64(0x0404000000000404), CONST64(0x0404000100000404), CONST64(0x0404000004000404), CONST64(0x0404000104000404), - CONST64(0x0404000000040404), CONST64(0x0404000100040404), CONST64(0x0404000004040404), CONST64(0x0404000104040404), - CONST64(0x0000040000000000), CONST64(0x0000040100000000), CONST64(0x0000040004000000), CONST64(0x0000040104000000), - CONST64(0x0000040000040000), CONST64(0x0000040100040000), CONST64(0x0000040004040000), CONST64(0x0000040104040000), - CONST64(0x0000040000000400), CONST64(0x0000040100000400), CONST64(0x0000040004000400), CONST64(0x0000040104000400), - CONST64(0x0000040000040400), CONST64(0x0000040100040400), CONST64(0x0000040004040400), CONST64(0x0000040104040400), - CONST64(0x0000040000000004), CONST64(0x0000040100000004), CONST64(0x0000040004000004), CONST64(0x0000040104000004), - CONST64(0x0000040000040004), CONST64(0x0000040100040004), CONST64(0x0000040004040004), CONST64(0x0000040104040004), - CONST64(0x0000040000000404), CONST64(0x0000040100000404), CONST64(0x0000040004000404), CONST64(0x0000040104000404), - CONST64(0x0000040000040404), CONST64(0x0000040100040404), CONST64(0x0000040004040404), CONST64(0x0000040104040404), - CONST64(0x0400040000000000), CONST64(0x0400040100000000), CONST64(0x0400040004000000), CONST64(0x0400040104000000), - CONST64(0x0400040000040000), CONST64(0x0400040100040000), CONST64(0x0400040004040000), CONST64(0x0400040104040000), - CONST64(0x0400040000000400), CONST64(0x0400040100000400), CONST64(0x0400040004000400), CONST64(0x0400040104000400), - CONST64(0x0400040000040400), CONST64(0x0400040100040400), CONST64(0x0400040004040400), CONST64(0x0400040104040400), - CONST64(0x0400040000000004), CONST64(0x0400040100000004), CONST64(0x0400040004000004), CONST64(0x0400040104000004), - CONST64(0x0400040000040004), CONST64(0x0400040100040004), CONST64(0x0400040004040004), CONST64(0x0400040104040004), - CONST64(0x0400040000000404), CONST64(0x0400040100000404), CONST64(0x0400040004000404), CONST64(0x0400040104000404), - CONST64(0x0400040000040404), CONST64(0x0400040100040404), CONST64(0x0400040004040404), CONST64(0x0400040104040404), - CONST64(0x0004040000000000), CONST64(0x0004040100000000), CONST64(0x0004040004000000), CONST64(0x0004040104000000), - CONST64(0x0004040000040000), CONST64(0x0004040100040000), CONST64(0x0004040004040000), CONST64(0x0004040104040000), - CONST64(0x0004040000000400), CONST64(0x0004040100000400), CONST64(0x0004040004000400), CONST64(0x0004040104000400), - CONST64(0x0004040000040400), CONST64(0x0004040100040400), CONST64(0x0004040004040400), CONST64(0x0004040104040400), - CONST64(0x0004040000000004), CONST64(0x0004040100000004), CONST64(0x0004040004000004), CONST64(0x0004040104000004), - CONST64(0x0004040000040004), CONST64(0x0004040100040004), CONST64(0x0004040004040004), CONST64(0x0004040104040004), - CONST64(0x0004040000000404), CONST64(0x0004040100000404), CONST64(0x0004040004000404), CONST64(0x0004040104000404), - CONST64(0x0004040000040404), CONST64(0x0004040100040404), CONST64(0x0004040004040404), CONST64(0x0004040104040404), - CONST64(0x0404040000000000), CONST64(0x0404040100000000), CONST64(0x0404040004000000), CONST64(0x0404040104000000), - CONST64(0x0404040000040000), CONST64(0x0404040100040000), CONST64(0x0404040004040000), CONST64(0x0404040104040000), - CONST64(0x0404040000000400), CONST64(0x0404040100000400), CONST64(0x0404040004000400), CONST64(0x0404040104000400), - CONST64(0x0404040000040400), CONST64(0x0404040100040400), CONST64(0x0404040004040400), CONST64(0x0404040104040400), - CONST64(0x0404040000000004), CONST64(0x0404040100000004), CONST64(0x0404040004000004), CONST64(0x0404040104000004), - CONST64(0x0404040000040004), CONST64(0x0404040100040004), CONST64(0x0404040004040004), CONST64(0x0404040104040004), - CONST64(0x0404040000000404), CONST64(0x0404040100000404), CONST64(0x0404040004000404), CONST64(0x0404040104000404), - CONST64(0x0404040000040404), CONST64(0x0404040100040404), CONST64(0x0404040004040404), CONST64(0x0404040104040404) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000400000000), CONST64(0x0000000010000000), CONST64(0x0000000410000000), - CONST64(0x0000000000100000), CONST64(0x0000000400100000), CONST64(0x0000000010100000), CONST64(0x0000000410100000), - CONST64(0x0000000000001000), CONST64(0x0000000400001000), CONST64(0x0000000010001000), CONST64(0x0000000410001000), - CONST64(0x0000000000101000), CONST64(0x0000000400101000), CONST64(0x0000000010101000), CONST64(0x0000000410101000), - CONST64(0x0000000000000010), CONST64(0x0000000400000010), CONST64(0x0000000010000010), CONST64(0x0000000410000010), - CONST64(0x0000000000100010), CONST64(0x0000000400100010), CONST64(0x0000000010100010), CONST64(0x0000000410100010), - CONST64(0x0000000000001010), CONST64(0x0000000400001010), CONST64(0x0000000010001010), CONST64(0x0000000410001010), - CONST64(0x0000000000101010), CONST64(0x0000000400101010), CONST64(0x0000000010101010), CONST64(0x0000000410101010), - CONST64(0x1000000000000000), CONST64(0x1000000400000000), CONST64(0x1000000010000000), CONST64(0x1000000410000000), - CONST64(0x1000000000100000), CONST64(0x1000000400100000), CONST64(0x1000000010100000), CONST64(0x1000000410100000), - CONST64(0x1000000000001000), CONST64(0x1000000400001000), CONST64(0x1000000010001000), CONST64(0x1000000410001000), - CONST64(0x1000000000101000), CONST64(0x1000000400101000), CONST64(0x1000000010101000), CONST64(0x1000000410101000), - CONST64(0x1000000000000010), CONST64(0x1000000400000010), CONST64(0x1000000010000010), CONST64(0x1000000410000010), - CONST64(0x1000000000100010), CONST64(0x1000000400100010), CONST64(0x1000000010100010), CONST64(0x1000000410100010), - CONST64(0x1000000000001010), CONST64(0x1000000400001010), CONST64(0x1000000010001010), CONST64(0x1000000410001010), - CONST64(0x1000000000101010), CONST64(0x1000000400101010), CONST64(0x1000000010101010), CONST64(0x1000000410101010), - CONST64(0x0010000000000000), CONST64(0x0010000400000000), CONST64(0x0010000010000000), CONST64(0x0010000410000000), - CONST64(0x0010000000100000), CONST64(0x0010000400100000), CONST64(0x0010000010100000), CONST64(0x0010000410100000), - CONST64(0x0010000000001000), CONST64(0x0010000400001000), CONST64(0x0010000010001000), CONST64(0x0010000410001000), - CONST64(0x0010000000101000), CONST64(0x0010000400101000), CONST64(0x0010000010101000), CONST64(0x0010000410101000), - CONST64(0x0010000000000010), CONST64(0x0010000400000010), CONST64(0x0010000010000010), CONST64(0x0010000410000010), - CONST64(0x0010000000100010), CONST64(0x0010000400100010), CONST64(0x0010000010100010), CONST64(0x0010000410100010), - CONST64(0x0010000000001010), CONST64(0x0010000400001010), CONST64(0x0010000010001010), CONST64(0x0010000410001010), - CONST64(0x0010000000101010), CONST64(0x0010000400101010), CONST64(0x0010000010101010), CONST64(0x0010000410101010), - CONST64(0x1010000000000000), CONST64(0x1010000400000000), CONST64(0x1010000010000000), CONST64(0x1010000410000000), - CONST64(0x1010000000100000), CONST64(0x1010000400100000), CONST64(0x1010000010100000), CONST64(0x1010000410100000), - CONST64(0x1010000000001000), CONST64(0x1010000400001000), CONST64(0x1010000010001000), CONST64(0x1010000410001000), - CONST64(0x1010000000101000), CONST64(0x1010000400101000), CONST64(0x1010000010101000), CONST64(0x1010000410101000), - CONST64(0x1010000000000010), CONST64(0x1010000400000010), CONST64(0x1010000010000010), CONST64(0x1010000410000010), - CONST64(0x1010000000100010), CONST64(0x1010000400100010), CONST64(0x1010000010100010), CONST64(0x1010000410100010), - CONST64(0x1010000000001010), CONST64(0x1010000400001010), CONST64(0x1010000010001010), CONST64(0x1010000410001010), - CONST64(0x1010000000101010), CONST64(0x1010000400101010), CONST64(0x1010000010101010), CONST64(0x1010000410101010), - CONST64(0x0000100000000000), CONST64(0x0000100400000000), CONST64(0x0000100010000000), CONST64(0x0000100410000000), - CONST64(0x0000100000100000), CONST64(0x0000100400100000), CONST64(0x0000100010100000), CONST64(0x0000100410100000), - CONST64(0x0000100000001000), CONST64(0x0000100400001000), CONST64(0x0000100010001000), CONST64(0x0000100410001000), - CONST64(0x0000100000101000), CONST64(0x0000100400101000), CONST64(0x0000100010101000), CONST64(0x0000100410101000), - CONST64(0x0000100000000010), CONST64(0x0000100400000010), CONST64(0x0000100010000010), CONST64(0x0000100410000010), - CONST64(0x0000100000100010), CONST64(0x0000100400100010), CONST64(0x0000100010100010), CONST64(0x0000100410100010), - CONST64(0x0000100000001010), CONST64(0x0000100400001010), CONST64(0x0000100010001010), CONST64(0x0000100410001010), - CONST64(0x0000100000101010), CONST64(0x0000100400101010), CONST64(0x0000100010101010), CONST64(0x0000100410101010), - CONST64(0x1000100000000000), CONST64(0x1000100400000000), CONST64(0x1000100010000000), CONST64(0x1000100410000000), - CONST64(0x1000100000100000), CONST64(0x1000100400100000), CONST64(0x1000100010100000), CONST64(0x1000100410100000), - CONST64(0x1000100000001000), CONST64(0x1000100400001000), CONST64(0x1000100010001000), CONST64(0x1000100410001000), - CONST64(0x1000100000101000), CONST64(0x1000100400101000), CONST64(0x1000100010101000), CONST64(0x1000100410101000), - CONST64(0x1000100000000010), CONST64(0x1000100400000010), CONST64(0x1000100010000010), CONST64(0x1000100410000010), - CONST64(0x1000100000100010), CONST64(0x1000100400100010), CONST64(0x1000100010100010), CONST64(0x1000100410100010), - CONST64(0x1000100000001010), CONST64(0x1000100400001010), CONST64(0x1000100010001010), CONST64(0x1000100410001010), - CONST64(0x1000100000101010), CONST64(0x1000100400101010), CONST64(0x1000100010101010), CONST64(0x1000100410101010), - CONST64(0x0010100000000000), CONST64(0x0010100400000000), CONST64(0x0010100010000000), CONST64(0x0010100410000000), - CONST64(0x0010100000100000), CONST64(0x0010100400100000), CONST64(0x0010100010100000), CONST64(0x0010100410100000), - CONST64(0x0010100000001000), CONST64(0x0010100400001000), CONST64(0x0010100010001000), CONST64(0x0010100410001000), - CONST64(0x0010100000101000), CONST64(0x0010100400101000), CONST64(0x0010100010101000), CONST64(0x0010100410101000), - CONST64(0x0010100000000010), CONST64(0x0010100400000010), CONST64(0x0010100010000010), CONST64(0x0010100410000010), - CONST64(0x0010100000100010), CONST64(0x0010100400100010), CONST64(0x0010100010100010), CONST64(0x0010100410100010), - CONST64(0x0010100000001010), CONST64(0x0010100400001010), CONST64(0x0010100010001010), CONST64(0x0010100410001010), - CONST64(0x0010100000101010), CONST64(0x0010100400101010), CONST64(0x0010100010101010), CONST64(0x0010100410101010), - CONST64(0x1010100000000000), CONST64(0x1010100400000000), CONST64(0x1010100010000000), CONST64(0x1010100410000000), - CONST64(0x1010100000100000), CONST64(0x1010100400100000), CONST64(0x1010100010100000), CONST64(0x1010100410100000), - CONST64(0x1010100000001000), CONST64(0x1010100400001000), CONST64(0x1010100010001000), CONST64(0x1010100410001000), - CONST64(0x1010100000101000), CONST64(0x1010100400101000), CONST64(0x1010100010101000), CONST64(0x1010100410101000), - CONST64(0x1010100000000010), CONST64(0x1010100400000010), CONST64(0x1010100010000010), CONST64(0x1010100410000010), - CONST64(0x1010100000100010), CONST64(0x1010100400100010), CONST64(0x1010100010100010), CONST64(0x1010100410100010), - CONST64(0x1010100000001010), CONST64(0x1010100400001010), CONST64(0x1010100010001010), CONST64(0x1010100410001010), - CONST64(0x1010100000101010), CONST64(0x1010100400101010), CONST64(0x1010100010101010), CONST64(0x1010100410101010) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000001000000000), CONST64(0x0000000040000000), CONST64(0x0000001040000000), - CONST64(0x0000000000400000), CONST64(0x0000001000400000), CONST64(0x0000000040400000), CONST64(0x0000001040400000), - CONST64(0x0000000000004000), CONST64(0x0000001000004000), CONST64(0x0000000040004000), CONST64(0x0000001040004000), - CONST64(0x0000000000404000), CONST64(0x0000001000404000), CONST64(0x0000000040404000), CONST64(0x0000001040404000), - CONST64(0x0000000000000040), CONST64(0x0000001000000040), CONST64(0x0000000040000040), CONST64(0x0000001040000040), - CONST64(0x0000000000400040), CONST64(0x0000001000400040), CONST64(0x0000000040400040), CONST64(0x0000001040400040), - CONST64(0x0000000000004040), CONST64(0x0000001000004040), CONST64(0x0000000040004040), CONST64(0x0000001040004040), - CONST64(0x0000000000404040), CONST64(0x0000001000404040), CONST64(0x0000000040404040), CONST64(0x0000001040404040), - CONST64(0x4000000000000000), CONST64(0x4000001000000000), CONST64(0x4000000040000000), CONST64(0x4000001040000000), - CONST64(0x4000000000400000), CONST64(0x4000001000400000), CONST64(0x4000000040400000), CONST64(0x4000001040400000), - CONST64(0x4000000000004000), CONST64(0x4000001000004000), CONST64(0x4000000040004000), CONST64(0x4000001040004000), - CONST64(0x4000000000404000), CONST64(0x4000001000404000), CONST64(0x4000000040404000), CONST64(0x4000001040404000), - CONST64(0x4000000000000040), CONST64(0x4000001000000040), CONST64(0x4000000040000040), CONST64(0x4000001040000040), - CONST64(0x4000000000400040), CONST64(0x4000001000400040), CONST64(0x4000000040400040), CONST64(0x4000001040400040), - CONST64(0x4000000000004040), CONST64(0x4000001000004040), CONST64(0x4000000040004040), CONST64(0x4000001040004040), - CONST64(0x4000000000404040), CONST64(0x4000001000404040), CONST64(0x4000000040404040), CONST64(0x4000001040404040), - CONST64(0x0040000000000000), CONST64(0x0040001000000000), CONST64(0x0040000040000000), CONST64(0x0040001040000000), - CONST64(0x0040000000400000), CONST64(0x0040001000400000), CONST64(0x0040000040400000), CONST64(0x0040001040400000), - CONST64(0x0040000000004000), CONST64(0x0040001000004000), CONST64(0x0040000040004000), CONST64(0x0040001040004000), - CONST64(0x0040000000404000), CONST64(0x0040001000404000), CONST64(0x0040000040404000), CONST64(0x0040001040404000), - CONST64(0x0040000000000040), CONST64(0x0040001000000040), CONST64(0x0040000040000040), CONST64(0x0040001040000040), - CONST64(0x0040000000400040), CONST64(0x0040001000400040), CONST64(0x0040000040400040), CONST64(0x0040001040400040), - CONST64(0x0040000000004040), CONST64(0x0040001000004040), CONST64(0x0040000040004040), CONST64(0x0040001040004040), - CONST64(0x0040000000404040), CONST64(0x0040001000404040), CONST64(0x0040000040404040), CONST64(0x0040001040404040), - CONST64(0x4040000000000000), CONST64(0x4040001000000000), CONST64(0x4040000040000000), CONST64(0x4040001040000000), - CONST64(0x4040000000400000), CONST64(0x4040001000400000), CONST64(0x4040000040400000), CONST64(0x4040001040400000), - CONST64(0x4040000000004000), CONST64(0x4040001000004000), CONST64(0x4040000040004000), CONST64(0x4040001040004000), - CONST64(0x4040000000404000), CONST64(0x4040001000404000), CONST64(0x4040000040404000), CONST64(0x4040001040404000), - CONST64(0x4040000000000040), CONST64(0x4040001000000040), CONST64(0x4040000040000040), CONST64(0x4040001040000040), - CONST64(0x4040000000400040), CONST64(0x4040001000400040), CONST64(0x4040000040400040), CONST64(0x4040001040400040), - CONST64(0x4040000000004040), CONST64(0x4040001000004040), CONST64(0x4040000040004040), CONST64(0x4040001040004040), - CONST64(0x4040000000404040), CONST64(0x4040001000404040), CONST64(0x4040000040404040), CONST64(0x4040001040404040), - CONST64(0x0000400000000000), CONST64(0x0000401000000000), CONST64(0x0000400040000000), CONST64(0x0000401040000000), - CONST64(0x0000400000400000), CONST64(0x0000401000400000), CONST64(0x0000400040400000), CONST64(0x0000401040400000), - CONST64(0x0000400000004000), CONST64(0x0000401000004000), CONST64(0x0000400040004000), CONST64(0x0000401040004000), - CONST64(0x0000400000404000), CONST64(0x0000401000404000), CONST64(0x0000400040404000), CONST64(0x0000401040404000), - CONST64(0x0000400000000040), CONST64(0x0000401000000040), CONST64(0x0000400040000040), CONST64(0x0000401040000040), - CONST64(0x0000400000400040), CONST64(0x0000401000400040), CONST64(0x0000400040400040), CONST64(0x0000401040400040), - CONST64(0x0000400000004040), CONST64(0x0000401000004040), CONST64(0x0000400040004040), CONST64(0x0000401040004040), - CONST64(0x0000400000404040), CONST64(0x0000401000404040), CONST64(0x0000400040404040), CONST64(0x0000401040404040), - CONST64(0x4000400000000000), CONST64(0x4000401000000000), CONST64(0x4000400040000000), CONST64(0x4000401040000000), - CONST64(0x4000400000400000), CONST64(0x4000401000400000), CONST64(0x4000400040400000), CONST64(0x4000401040400000), - CONST64(0x4000400000004000), CONST64(0x4000401000004000), CONST64(0x4000400040004000), CONST64(0x4000401040004000), - CONST64(0x4000400000404000), CONST64(0x4000401000404000), CONST64(0x4000400040404000), CONST64(0x4000401040404000), - CONST64(0x4000400000000040), CONST64(0x4000401000000040), CONST64(0x4000400040000040), CONST64(0x4000401040000040), - CONST64(0x4000400000400040), CONST64(0x4000401000400040), CONST64(0x4000400040400040), CONST64(0x4000401040400040), - CONST64(0x4000400000004040), CONST64(0x4000401000004040), CONST64(0x4000400040004040), CONST64(0x4000401040004040), - CONST64(0x4000400000404040), CONST64(0x4000401000404040), CONST64(0x4000400040404040), CONST64(0x4000401040404040), - CONST64(0x0040400000000000), CONST64(0x0040401000000000), CONST64(0x0040400040000000), CONST64(0x0040401040000000), - CONST64(0x0040400000400000), CONST64(0x0040401000400000), CONST64(0x0040400040400000), CONST64(0x0040401040400000), - CONST64(0x0040400000004000), CONST64(0x0040401000004000), CONST64(0x0040400040004000), CONST64(0x0040401040004000), - CONST64(0x0040400000404000), CONST64(0x0040401000404000), CONST64(0x0040400040404000), CONST64(0x0040401040404000), - CONST64(0x0040400000000040), CONST64(0x0040401000000040), CONST64(0x0040400040000040), CONST64(0x0040401040000040), - CONST64(0x0040400000400040), CONST64(0x0040401000400040), CONST64(0x0040400040400040), CONST64(0x0040401040400040), - CONST64(0x0040400000004040), CONST64(0x0040401000004040), CONST64(0x0040400040004040), CONST64(0x0040401040004040), - CONST64(0x0040400000404040), CONST64(0x0040401000404040), CONST64(0x0040400040404040), CONST64(0x0040401040404040), - CONST64(0x4040400000000000), CONST64(0x4040401000000000), CONST64(0x4040400040000000), CONST64(0x4040401040000000), - CONST64(0x4040400000400000), CONST64(0x4040401000400000), CONST64(0x4040400040400000), CONST64(0x4040401040400000), - CONST64(0x4040400000004000), CONST64(0x4040401000004000), CONST64(0x4040400040004000), CONST64(0x4040401040004000), - CONST64(0x4040400000404000), CONST64(0x4040401000404000), CONST64(0x4040400040404000), CONST64(0x4040401040404000), - CONST64(0x4040400000000040), CONST64(0x4040401000000040), CONST64(0x4040400040000040), CONST64(0x4040401040000040), - CONST64(0x4040400000400040), CONST64(0x4040401000400040), CONST64(0x4040400040400040), CONST64(0x4040401040400040), - CONST64(0x4040400000004040), CONST64(0x4040401000004040), CONST64(0x4040400040004040), CONST64(0x4040401040004040), - CONST64(0x4040400000404040), CONST64(0x4040401000404040), CONST64(0x4040400040404040), CONST64(0x4040401040404040) - }}; - -#endif - - -static void cookey(const ulong32 *raw1, ulong32 *keyout); - -#ifdef LTC_CLEAN_STACK -static void _deskey(const unsigned char *key, short edf, ulong32 *keyout) -#else -static void deskey(const unsigned char *key, short edf, ulong32 *keyout) -#endif -{ - ulong32 i, j, l, m, n, kn[32]; - unsigned char pc1m[56], pcr[56]; - - for (j=0; j < 56; j++) { - l = (ulong32)pc1[j]; - m = l & 7; - pc1m[j] = (unsigned char)((key[l >> 3U] & bytebit[m]) == bytebit[m] ? 1 : 0); - } - - for (i=0; i < 16; i++) { - if (edf == DE1) { - m = (15 - i) << 1; - } else { - m = i << 1; - } - n = m + 1; - kn[m] = kn[n] = 0L; - for (j=0; j < 28; j++) { - l = j + (ulong32)totrot[i]; - if (l < 28) { - pcr[j] = pc1m[l]; - } else { - pcr[j] = pc1m[l - 28]; - } - } - for (/*j = 28*/; j < 56; j++) { - l = j + (ulong32)totrot[i]; - if (l < 56) { - pcr[j] = pc1m[l]; - } else { - pcr[j] = pc1m[l - 28]; - } - } - for (j=0; j < 24; j++) { - if ((int)pcr[(int)pc2[j]] != 0) { - kn[m] |= bigbyte[j]; - } - if ((int)pcr[(int)pc2[j+24]] != 0) { - kn[n] |= bigbyte[j]; - } - } - } - - cookey(kn, keyout); -} - -#ifdef LTC_CLEAN_STACK -static void deskey(const unsigned char *key, short edf, ulong32 *keyout) -{ - _deskey(key, edf, keyout); - burn_stack(sizeof(int)*5 + sizeof(ulong32)*32 + sizeof(unsigned char)*112); -} -#endif - -#ifdef LTC_CLEAN_STACK -static void _cookey(const ulong32 *raw1, ulong32 *keyout) -#else -static void cookey(const ulong32 *raw1, ulong32 *keyout) -#endif -{ - ulong32 *cook; - const ulong32 *raw0; - ulong32 dough[32]; - int i; - - cook = dough; - for(i=0; i < 16; i++, raw1++) - { - raw0 = raw1++; - *cook = (*raw0 & 0x00fc0000L) << 6; - *cook |= (*raw0 & 0x00000fc0L) << 10; - *cook |= (*raw1 & 0x00fc0000L) >> 10; - *cook++ |= (*raw1 & 0x00000fc0L) >> 6; - *cook = (*raw0 & 0x0003f000L) << 12; - *cook |= (*raw0 & 0x0000003fL) << 16; - *cook |= (*raw1 & 0x0003f000L) >> 4; - *cook++ |= (*raw1 & 0x0000003fL); - } - - XMEMCPY(keyout, dough, sizeof dough); -} - -#ifdef LTC_CLEAN_STACK -static void cookey(const ulong32 *raw1, ulong32 *keyout) -{ - _cookey(raw1, keyout); - burn_stack(sizeof(ulong32 *) * 2 + sizeof(ulong32)*32 + sizeof(int)); -} -#endif - -#ifndef LTC_CLEAN_STACK -static void desfunc(ulong32 *block, const ulong32 *keys) -#else -static void _desfunc(ulong32 *block, const ulong32 *keys) -#endif -{ - ulong32 work, right, leftt; - int cur_round; - - leftt = block[0]; - right = block[1]; - -#ifdef LTC_SMALL_CODE - work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL; - right ^= work; - leftt ^= (work << 4); - - work = ((leftt >> 16) ^ right) & 0x0000ffffL; - right ^= work; - leftt ^= (work << 16); - - work = ((right >> 2) ^ leftt) & 0x33333333L; - leftt ^= work; - right ^= (work << 2); - - work = ((right >> 8) ^ leftt) & 0x00ff00ffL; - leftt ^= work; - right ^= (work << 8); - - right = ROLc(right, 1); - work = (leftt ^ right) & 0xaaaaaaaaL; - - leftt ^= work; - right ^= work; - leftt = ROLc(leftt, 1); -#else - { - ulong64 tmp; - tmp = des_ip[0][byte(leftt, 0)] ^ - des_ip[1][byte(leftt, 1)] ^ - des_ip[2][byte(leftt, 2)] ^ - des_ip[3][byte(leftt, 3)] ^ - des_ip[4][byte(right, 0)] ^ - des_ip[5][byte(right, 1)] ^ - des_ip[6][byte(right, 2)] ^ - des_ip[7][byte(right, 3)]; - leftt = (ulong32)(tmp >> 32); - right = (ulong32)(tmp & 0xFFFFFFFFUL); - } -#endif - - for (cur_round = 0; cur_round < 8; cur_round++) { - work = RORc(right, 4) ^ *keys++; - leftt ^= SP7[work & 0x3fL] - ^ SP5[(work >> 8) & 0x3fL] - ^ SP3[(work >> 16) & 0x3fL] - ^ SP1[(work >> 24) & 0x3fL]; - work = right ^ *keys++; - leftt ^= SP8[ work & 0x3fL] - ^ SP6[(work >> 8) & 0x3fL] - ^ SP4[(work >> 16) & 0x3fL] - ^ SP2[(work >> 24) & 0x3fL]; - - work = RORc(leftt, 4) ^ *keys++; - right ^= SP7[ work & 0x3fL] - ^ SP5[(work >> 8) & 0x3fL] - ^ SP3[(work >> 16) & 0x3fL] - ^ SP1[(work >> 24) & 0x3fL]; - work = leftt ^ *keys++; - right ^= SP8[ work & 0x3fL] - ^ SP6[(work >> 8) & 0x3fL] - ^ SP4[(work >> 16) & 0x3fL] - ^ SP2[(work >> 24) & 0x3fL]; - } - -#ifdef LTC_SMALL_CODE - right = RORc(right, 1); - work = (leftt ^ right) & 0xaaaaaaaaL; - leftt ^= work; - right ^= work; - leftt = RORc(leftt, 1); - work = ((leftt >> 8) ^ right) & 0x00ff00ffL; - right ^= work; - leftt ^= (work << 8); - /* -- */ - work = ((leftt >> 2) ^ right) & 0x33333333L; - right ^= work; - leftt ^= (work << 2); - work = ((right >> 16) ^ leftt) & 0x0000ffffL; - leftt ^= work; - right ^= (work << 16); - work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL; - leftt ^= work; - right ^= (work << 4); -#else - { - ulong64 tmp; - tmp = des_fp[0][byte(leftt, 0)] ^ - des_fp[1][byte(leftt, 1)] ^ - des_fp[2][byte(leftt, 2)] ^ - des_fp[3][byte(leftt, 3)] ^ - des_fp[4][byte(right, 0)] ^ - des_fp[5][byte(right, 1)] ^ - des_fp[6][byte(right, 2)] ^ - des_fp[7][byte(right, 3)]; - leftt = (ulong32)(tmp >> 32); - right = (ulong32)(tmp & 0xFFFFFFFFUL); - } -#endif - - block[0] = right; - block[1] = leftt; -} - -#ifdef LTC_CLEAN_STACK -static void desfunc(ulong32 *block, const ulong32 *keys) -{ - _desfunc(block, keys); - burn_stack(sizeof(ulong32) * 4 + sizeof(int)); -} -#endif - - /** - Initialize the LTC_DES block cipher - @param key The symmetric key you wish to pass - @param keylen The key length in bytes - @param num_rounds The number of rounds desired (0 for default) - @param skey The key in as scheduled by this function. - @return CRYPT_OK if successful - */ -int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -{ - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(skey != NULL); - - if (num_rounds != 0 && num_rounds != 16) { - return CRYPT_INVALID_ROUNDS; - } - - if (keylen != 8) { - return CRYPT_INVALID_KEYSIZE; - } - - deskey(key, EN0, skey->des.ek); - deskey(key, DE1, skey->des.dk); - - return CRYPT_OK; -} - - /** - Initialize the 3LTC_DES-EDE block cipher - @param key The symmetric key you wish to pass - @param keylen The key length in bytes - @param num_rounds The number of rounds desired (0 for default) - @param skey The key in as scheduled by this function. - @return CRYPT_OK if successful - */ -int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -{ - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(skey != NULL); - - if(num_rounds != 0 && num_rounds != 16) { - return CRYPT_INVALID_ROUNDS; - } - - if (keylen != 24) { - return CRYPT_INVALID_KEYSIZE; - } - - deskey(key, EN0, skey->des3.ek[0]); - deskey(key+8, DE1, skey->des3.ek[1]); - deskey(key+16, EN0, skey->des3.ek[2]); - - deskey(key, DE1, skey->des3.dk[2]); - deskey(key+8, EN0, skey->des3.dk[1]); - deskey(key+16, DE1, skey->des3.dk[0]); - - return CRYPT_OK; -} - -/** - Encrypts a block of text with LTC_DES - @param pt The input plaintext (8 bytes) - @param ct The output ciphertext (8 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful -*/ -int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -{ - ulong32 work[2]; - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - LOAD32H(work[0], pt+0); - LOAD32H(work[1], pt+4); - desfunc(work, skey->des.ek); - STORE32H(work[0],ct+0); - STORE32H(work[1],ct+4); - return CRYPT_OK; -} - -/** - Decrypts a block of text with LTC_DES - @param ct The input ciphertext (8 bytes) - @param pt The output plaintext (8 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful -*/ -int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -{ - ulong32 work[2]; - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - LOAD32H(work[0], ct+0); - LOAD32H(work[1], ct+4); - desfunc(work, skey->des.dk); - STORE32H(work[0],pt+0); - STORE32H(work[1],pt+4); - return CRYPT_OK; -} - -/** - Encrypts a block of text with 3LTC_DES-EDE - @param pt The input plaintext (8 bytes) - @param ct The output ciphertext (8 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful -*/ -int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -{ - ulong32 work[2]; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - LOAD32H(work[0], pt+0); - LOAD32H(work[1], pt+4); - desfunc(work, skey->des3.ek[0]); - desfunc(work, skey->des3.ek[1]); - desfunc(work, skey->des3.ek[2]); - STORE32H(work[0],ct+0); - STORE32H(work[1],ct+4); - return CRYPT_OK; -} - -/** - Decrypts a block of text with 3LTC_DES-EDE - @param ct The input ciphertext (8 bytes) - @param pt The output plaintext (8 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful -*/ -int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -{ - ulong32 work[2]; - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - LOAD32H(work[0], ct+0); - LOAD32H(work[1], ct+4); - desfunc(work, skey->des3.dk[0]); - desfunc(work, skey->des3.dk[1]); - desfunc(work, skey->des3.dk[2]); - STORE32H(work[0],pt+0); - STORE32H(work[1],pt+4); - return CRYPT_OK; -} - -/** - Performs a self-test of the LTC_DES block cipher - @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled -*/ -int des_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - int err; - static const struct des_test_case { - int num, mode; /* mode 1 = encrypt */ - unsigned char key[8], txt[8], out[8]; - } cases[] = { - { 1, 1, { 0x10, 0x31, 0x6E, 0x02, 0x8C, 0x8F, 0x3B, 0x4A }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x82, 0xDC, 0xBA, 0xFB, 0xDE, 0xAB, 0x66, 0x02 } }, - { 2, 1, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x95, 0xF8, 0xA5, 0xE5, 0xDD, 0x31, 0xD9, 0x00 }, - { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, - { 3, 1, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0xDD, 0x7F, 0x12, 0x1C, 0xA5, 0x01, 0x56, 0x19 }, - { 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, - { 4, 1, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x2E, 0x86, 0x53, 0x10, 0x4F, 0x38, 0x34, 0xEA }, - { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, - { 5, 1, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x4B, 0xD3, 0x88, 0xFF, 0x6C, 0xD8, 0x1D, 0x4F }, - { 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, - { 6, 1, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x20, 0xB9, 0xE7, 0x67, 0xB2, 0xFB, 0x14, 0x56 }, - { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, - { 7, 1, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x55, 0x57, 0x93, 0x80, 0xD7, 0x71, 0x38, 0xEF }, - { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, - { 8, 1, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x6C, 0xC5, 0xDE, 0xFA, 0xAF, 0x04, 0x51, 0x2F }, - { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, - { 9, 1, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x0D, 0x9F, 0x27, 0x9B, 0xA5, 0xD8, 0x72, 0x60 }, - { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, - {10, 1, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0xD9, 0x03, 0x1B, 0x02, 0x71, 0xBD, 0x5A, 0x0A }, - { 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, - - { 1, 0, { 0x10, 0x31, 0x6E, 0x02, 0x8C, 0x8F, 0x3B, 0x4A }, - { 0x82, 0xDC, 0xBA, 0xFB, 0xDE, 0xAB, 0x66, 0x02 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, - { 2, 0, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x95, 0xF8, 0xA5, 0xE5, 0xDD, 0x31, 0xD9, 0x00 } }, - { 3, 0, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0xDD, 0x7F, 0x12, 0x1C, 0xA5, 0x01, 0x56, 0x19 } }, - { 4, 0, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x2E, 0x86, 0x53, 0x10, 0x4F, 0x38, 0x34, 0xEA } }, - { 5, 0, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x4B, 0xD3, 0x88, 0xFF, 0x6C, 0xD8, 0x1D, 0x4F } }, - { 6, 0, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x20, 0xB9, 0xE7, 0x67, 0xB2, 0xFB, 0x14, 0x56 } }, - { 7, 0, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x55, 0x57, 0x93, 0x80, 0xD7, 0x71, 0x38, 0xEF } }, - { 8, 0, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x6C, 0xC5, 0xDE, 0xFA, 0xAF, 0x04, 0x51, 0x2F } }, - { 9, 0, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x0D, 0x9F, 0x27, 0x9B, 0xA5, 0xD8, 0x72, 0x60 } }, - {10, 0, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0xD9, 0x03, 0x1B, 0x02, 0x71, 0xBD, 0x5A, 0x0A } } - - /*** more test cases you could add if you are not convinced (the above test cases aren't really too good): - - key plaintext ciphertext - 0000000000000000 0000000000000000 8CA64DE9C1B123A7 - FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF 7359B2163E4EDC58 - 3000000000000000 1000000000000001 958E6E627A05557B - 1111111111111111 1111111111111111 F40379AB9E0EC533 - 0123456789ABCDEF 1111111111111111 17668DFC7292532D - 1111111111111111 0123456789ABCDEF 8A5AE1F81AB8F2DD - 0000000000000000 0000000000000000 8CA64DE9C1B123A7 - FEDCBA9876543210 0123456789ABCDEF ED39D950FA74BCC4 - 7CA110454A1A6E57 01A1D6D039776742 690F5B0D9A26939B - 0131D9619DC1376E 5CD54CA83DEF57DA 7A389D10354BD271 - 07A1133E4A0B2686 0248D43806F67172 868EBB51CAB4599A - 3849674C2602319E 51454B582DDF440A 7178876E01F19B2A - 04B915BA43FEB5B6 42FD443059577FA2 AF37FB421F8C4095 - 0113B970FD34F2CE 059B5E0851CF143A 86A560F10EC6D85B - 0170F175468FB5E6 0756D8E0774761D2 0CD3DA020021DC09 - 43297FAD38E373FE 762514B829BF486A EA676B2CB7DB2B7A - 07A7137045DA2A16 3BDD119049372802 DFD64A815CAF1A0F - 04689104C2FD3B2F 26955F6835AF609A 5C513C9C4886C088 - 37D06BB516CB7546 164D5E404F275232 0A2AEEAE3FF4AB77 - 1F08260D1AC2465E 6B056E18759F5CCA EF1BF03E5DFA575A - 584023641ABA6176 004BD6EF09176062 88BF0DB6D70DEE56 - 025816164629B007 480D39006EE762F2 A1F9915541020B56 - 49793EBC79B3258F 437540C8698F3CFA 6FBF1CAFCFFD0556 - 4FB05E1515AB73A7 072D43A077075292 2F22E49BAB7CA1AC - 49E95D6D4CA229BF 02FE55778117F12A 5A6B612CC26CCE4A - 018310DC409B26D6 1D9D5C5018F728C2 5F4C038ED12B2E41 - 1C587F1C13924FEF 305532286D6F295A 63FAC0D034D9F793 - 0101010101010101 0123456789ABCDEF 617B3A0CE8F07100 - 1F1F1F1F0E0E0E0E 0123456789ABCDEF DB958605F8C8C606 - E0FEE0FEF1FEF1FE 0123456789ABCDEF EDBFD1C66C29CCC7 - 0000000000000000 FFFFFFFFFFFFFFFF 355550B2150E2451 - FFFFFFFFFFFFFFFF 0000000000000000 CAAAAF4DEAF1DBAE - 0123456789ABCDEF 0000000000000000 D5D44FF720683D0D - FEDCBA9876543210 FFFFFFFFFFFFFFFF 2A2BB008DF97C2F2 - - http://www.ecs.soton.ac.uk/~prw99r/ez438/vectors.txt - ***/ - }; - int i, y; - unsigned char tmp[8]; - symmetric_key des; - - for(i=0; i < (int)(sizeof(cases)/sizeof(cases[0])); i++) - { - if ((err = des_setup(cases[i].key, 8, 0, &des)) != CRYPT_OK) { - return err; - } - if (cases[i].mode != 0) { - des_ecb_encrypt(cases[i].txt, tmp, &des); - } else { - des_ecb_decrypt(cases[i].txt, tmp, &des); - } - - if (XMEMCMP(cases[i].out, tmp, sizeof(tmp)) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - - /* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */ - for (y = 0; y < 8; y++) tmp[y] = 0; - for (y = 0; y < 1000; y++) des_ecb_encrypt(tmp, tmp, &des); - for (y = 0; y < 1000; y++) des_ecb_decrypt(tmp, tmp, &des); - for (y = 0; y < 8; y++) if (tmp[y] != 0) return CRYPT_FAIL_TESTVECTOR; -} - - return CRYPT_OK; - #endif -} - -int des3_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - unsigned char key[24], pt[8], ct[8], tmp[8]; - symmetric_key skey; - int x, err; - - if ((err = des_test()) != CRYPT_OK) { - return err; - } - - for (x = 0; x < 8; x++) { - pt[x] = x; - } - - for (x = 0; x < 24; x++) { - key[x] = x; - } - - if ((err = des3_setup(key, 24, 0, &skey)) != CRYPT_OK) { - return err; - } - - des3_ecb_encrypt(pt, ct, &skey); - des3_ecb_decrypt(ct, tmp, &skey); - - if (XMEMCMP(pt, tmp, 8) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - - return CRYPT_OK; - #endif -} - -/** Terminate the context - @param skey The scheduled key -*/ -void des_done(symmetric_key *skey) -{ -} - -/** Terminate the context - @param skey The scheduled key -*/ -void des3_done(symmetric_key *skey) -{ -} - - -/** - Gets suitable key size - @param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable. - @return CRYPT_OK if the input key size is acceptable. -*/ -int des_keysize(int *keysize) -{ - LTC_ARGCHK(keysize != NULL); - if(*keysize < 8) { - return CRYPT_INVALID_KEYSIZE; - } - *keysize = 8; - return CRYPT_OK; -} - -/** - Gets suitable key size - @param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable. - @return CRYPT_OK if the input key size is acceptable. -*/ -int des3_keysize(int *keysize) -{ - LTC_ARGCHK(keysize != NULL); - if(*keysize < 24) { - return CRYPT_INVALID_KEYSIZE; - } - *keysize = 24; - return CRYPT_OK; -} - -#include "CommonCryptor.h" -#include "CommonCryptorSPI.h" - -static uint8_t weak_keys[][8] = { - {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}, /* weak keys */ - {0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE}, - {0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E}, - {0xE0,0xE0,0xE0,0xE0,0xF1,0xF1,0xF1,0xF1}, - {0x01,0xFE,0x01,0xFE,0x01,0xFE,0x01,0xFE}, /* semi-weak keys */ - {0xFE,0x01,0xFE,0x01,0xFE,0x01,0xFE,0x01}, - {0x1F,0xE0,0x1F,0xE0,0x0E,0xF1,0x0E,0xF1}, - {0xE0,0x1F,0xE0,0x1F,0xF1,0x0E,0xF1,0x0E}, - {0x01,0xE0,0x01,0xE0,0x01,0xF1,0x01,0xF1}, - {0xE0,0x01,0xE0,0x01,0xF1,0x01,0xF1,0x01}, - {0x1F,0xFE,0x1F,0xFE,0x0E,0xFE,0x0E,0xFE}, - {0xFE,0x1F,0xFE,0x1F,0xFE,0x0E,0xFE,0x0E}, - {0x01,0x1F,0x01,0x1F,0x01,0x0E,0x01,0x0E}, - {0x1F,0x01,0x1F,0x01,0x0E,0x01,0x0E,0x01}, - {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, - {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1} -}; - -CCCryptorStatus CCDesIsWeakKey( - void *key, - size_t length) -{ - size_t n; - - LTC_ARGCHK(key != NULL); - - if (length != 8) - return CRYPT_INVALID_KEYSIZE; - - for (n = 0; n < sizeof(weak_keys) / sizeof(weak_keys[0]); n++) - if (memcmp(weak_keys[n], key, 8) == 0) - return CRYPT_INVALID_KEYSIZE; - - return CRYPT_OK; -} - -static uint8_t odd_parity[256] = { - 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, - 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, - 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, - 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, - 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, - 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, - 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, - 112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, - 128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, - 145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, - 161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, - 176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, - 193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, - 208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, - 224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, - 241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254, -}; - -void CCDesSetOddParity(void *key, - size_t Length) -{ - uint8_t *p = key; - size_t n; - - for (n = 0; n < Length; n++) - p[n] = odd_parity[p[n]]; - -} - -uint32_t CCDesCBCCksum(void *in, void *out, - size_t length, void *key, size_t keylen, - void *ivec) -{ - const uint8_t *input = in; - const uint8_t *inputiv = ivec; - uint32_t uiv[2]; - uint32_t work[2] = { 0, 0 }; - symmetric_key des; - - des_setup(key, 8, 0, &des); - - LOAD32H(uiv[0], inputiv+0); - LOAD32H(uiv[1], inputiv+4); - - while (length >= 8) { - LOAD32H(work[0], input+0); - LOAD32H(work[1], input+4); - - work[0] ^= uiv[0]; work[1] ^= uiv[1]; - desfunc(work, &des); - uiv[0] = work[0]; uiv[1] = work[1]; - - length -= 8; - input += 8; - } - if (length) { - uint8_t tmp[8]; - memcpy(tmp, input, length); - memset(tmp + length, 0, 8 - length); - LOAD32H(work[0], tmp+0); - LOAD32H(work[1], tmp+4); - - work[0] ^= uiv[0]; work[1] ^= uiv[1]; - desfunc(work, &des); - } - if (out) { - uint8_t *output = out; - STORE32H(work[0],output+0); - STORE32H(work[1],output+4); - } - - uiv[0] = 0; work[0] = 0; uiv[1] = 0; - return work[1]; -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/des.c,v $ */ -/* $Revision: 1.15 $ */ -/* $Date: 2007/05/12 14:20:27 $ */ DELETED Source/libtomcrypt/src/ciphers/ltc_aes/aes.c Index: Source/libtomcrypt/src/ciphers/ltc_aes/aes.c ================================================================== --- Source/libtomcrypt/src/ciphers/ltc_aes/aes.c +++ /dev/null @@ -1,760 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* AES implementation by Tom St Denis - * - * Derived from the Public Domain source code by - - --- - * rijndael-alg-fst.c - * - * @version 3.0 (December 2000) - * - * Optimised ANSI C code for the Rijndael cipher (now AES) - * - * @author Vincent Rijmen - * @author Antoon Bosselaers - * @author Paulo Barreto - --- - */ -/** - @file aes.c - Implementation of AES - */ - -#include "tomcrypt.h" - -#ifdef LTC_RIJNDAEL - -#ifndef ENCRYPT_ONLY - -#define SETUP rijndael_setup -#define ECB_ENC rijndael_ecb_encrypt -#define ECB_DEC rijndael_ecb_decrypt -#define ECB_DONE rijndael_done -#define ECB_TEST rijndael_test -#define ECB_KS rijndael_keysize - -const struct ltc_cipher_descriptor rijndael_desc = -{ - "rijndael", - 6, - 16, 32, 16, 10, - SETUP, ECB_ENC, ECB_DEC, ECB_TEST, ECB_DONE, ECB_KS, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL -}; - -const struct ltc_cipher_descriptor aesedp_desc = -{ - "aesedp", - 6, - 16, 32, 16, 10, - SETUP, ECB_ENC, ECB_DEC, ECB_TEST, ECB_DONE, ECB_KS, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL -}; - -#else - -#define SETUP rijndael_enc_setup -#define ECB_ENC rijndael_enc_ecb_encrypt -#define ECB_KS rijndael_enc_keysize -#define ECB_DONE rijndael_enc_done - -const struct ltc_cipher_descriptor rijndael_enc_desc = -{ - "rijndael", - 6, - 16, 32, 16, 10, - SETUP, ECB_ENC, NULL, NULL, ECB_DONE, ECB_KS, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL -}; - -const struct ltc_cipher_descriptor aes_enc_desc = -{ - "aes", - 6, - 16, 32, 16, 10, - SETUP, ECB_ENC, NULL, NULL, ECB_DONE, ECB_KS, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL -}; - -#endif - -#include "aes_tab.c" - -static ulong32 setup_mix(ulong32 temp) -{ - return (Te4_3[byte(temp, 2)]) ^ - (Te4_2[byte(temp, 1)]) ^ - (Te4_1[byte(temp, 0)]) ^ - (Te4_0[byte(temp, 3)]); -} - -#ifndef ENCRYPT_ONLY -#ifdef LTC_SMALL_CODE -static ulong32 setup_mix2(ulong32 temp) -{ - return Td0(255 & Te4[byte(temp, 3)]) ^ - Td1(255 & Te4[byte(temp, 2)]) ^ - Td2(255 & Te4[byte(temp, 1)]) ^ - Td3(255 & Te4[byte(temp, 0)]); -} -#endif -#endif - -/** - Initialize the AES (Rijndael) block cipher - @param key The symmetric key you wish to pass - @param keylen The key length in bytes - @param num_rounds The number of rounds desired (0 for default) - @param skey The key in as scheduled by this function. - @return CRYPT_OK if successful - */ -int SETUP(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -{ - int i, j; - ulong32 temp, *rk; -#ifndef ENCRYPT_ONLY - ulong32 *rrk; -#endif - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(skey != NULL); - - if (keylen != 16 && keylen != 24 && keylen != 32) { - return CRYPT_INVALID_KEYSIZE; - } - - if (num_rounds != 0 && num_rounds != (10 + ((keylen/8)-2)*2)) { - return CRYPT_INVALID_ROUNDS; - } - - skey->rijndael.Nr = 10 + ((keylen/8)-2)*2; - - /* setup the forward key */ - i = 0; - rk = skey->rijndael.eK; - LOAD32H(rk[0], key ); - LOAD32H(rk[1], key + 4); - LOAD32H(rk[2], key + 8); - LOAD32H(rk[3], key + 12); - if (keylen == 16) { - j = 44; - for (;;) { - temp = rk[3]; - rk[4] = rk[0] ^ setup_mix(temp) ^ rcon[i]; - rk[5] = rk[1] ^ rk[4]; - rk[6] = rk[2] ^ rk[5]; - rk[7] = rk[3] ^ rk[6]; - if (++i == 10) { - break; - } - rk += 4; - } - } else if (keylen == 24) { - j = 52; - LOAD32H(rk[4], key + 16); - LOAD32H(rk[5], key + 20); - for (;;) { -#ifdef _MSC_VER - temp = skey->rijndael.eK[rk - skey->rijndael.eK + 5]; -#else - temp = rk[5]; -#endif - rk[ 6] = rk[ 0] ^ setup_mix(temp) ^ rcon[i]; - rk[ 7] = rk[ 1] ^ rk[ 6]; - rk[ 8] = rk[ 2] ^ rk[ 7]; - rk[ 9] = rk[ 3] ^ rk[ 8]; - if (++i == 8) { - break; - } - rk[10] = rk[ 4] ^ rk[ 9]; - rk[11] = rk[ 5] ^ rk[10]; - rk += 6; - } - } else if (keylen == 32) { - j = 60; - LOAD32H(rk[4], key + 16); - LOAD32H(rk[5], key + 20); - LOAD32H(rk[6], key + 24); - LOAD32H(rk[7], key + 28); - for (;;) { -#ifdef _MSC_VER - temp = skey->rijndael.eK[rk - skey->rijndael.eK + 7]; -#else - temp = rk[7]; -#endif - rk[ 8] = rk[ 0] ^ setup_mix(temp) ^ rcon[i]; - rk[ 9] = rk[ 1] ^ rk[ 8]; - rk[10] = rk[ 2] ^ rk[ 9]; - rk[11] = rk[ 3] ^ rk[10]; - if (++i == 7) { - break; - } - temp = rk[11]; - rk[12] = rk[ 4] ^ setup_mix(RORc(temp, 8)); - rk[13] = rk[ 5] ^ rk[12]; - rk[14] = rk[ 6] ^ rk[13]; - rk[15] = rk[ 7] ^ rk[14]; - rk += 8; - } - } else { - /* this can't happen */ - return CRYPT_ERROR; - } - -#ifndef ENCRYPT_ONLY - /* setup the inverse key now */ - rk = skey->rijndael.dK; - rrk = skey->rijndael.eK + j - 4; - - /* apply the inverse MixColumn transform to all round keys but the first and the last: */ - /* copy first */ - *rk++ = *rrk++; - *rk++ = *rrk++; - *rk++ = *rrk++; - *rk = *rrk; - rk -= 3; rrk -= 3; - - for (i = 1; i < skey->rijndael.Nr; i++) { - rrk -= 4; - rk += 4; -#ifdef LTC_SMALL_CODE - temp = rrk[0]; - rk[0] = setup_mix2(temp); - temp = rrk[1]; - rk[1] = setup_mix2(temp); - temp = rrk[2]; - rk[2] = setup_mix2(temp); - temp = rrk[3]; - rk[3] = setup_mix2(temp); -#else - temp = rrk[0]; - rk[0] = - Tks0[byte(temp, 3)] ^ - Tks1[byte(temp, 2)] ^ - Tks2[byte(temp, 1)] ^ - Tks3[byte(temp, 0)]; - temp = rrk[1]; - rk[1] = - Tks0[byte(temp, 3)] ^ - Tks1[byte(temp, 2)] ^ - Tks2[byte(temp, 1)] ^ - Tks3[byte(temp, 0)]; - temp = rrk[2]; - rk[2] = - Tks0[byte(temp, 3)] ^ - Tks1[byte(temp, 2)] ^ - Tks2[byte(temp, 1)] ^ - Tks3[byte(temp, 0)]; - temp = rrk[3]; - rk[3] = - Tks0[byte(temp, 3)] ^ - Tks1[byte(temp, 2)] ^ - Tks2[byte(temp, 1)] ^ - Tks3[byte(temp, 0)]; -#endif - - } - - /* copy last */ - rrk -= 4; - rk += 4; - *rk++ = *rrk++; - *rk++ = *rrk++; - *rk++ = *rrk++; - *rk = *rrk; -#endif /* ENCRYPT_ONLY */ - - return CRYPT_OK; -} - -/** - Encrypts a block of text with AES - @param pt The input plaintext (16 bytes) - @param ct The output ciphertext (16 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful - */ -#ifdef LTC_CLEAN_STACK -static int _rijndael_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -#else -int ECB_ENC(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -#endif -{ - ulong32 s0, s1, s2, s3, t0, t1, t2, t3, *rk; - int Nr, r; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - - Nr = skey->rijndael.Nr; - rk = skey->rijndael.eK; - - /* - * map byte array block to cipher state - * and add initial round key: - */ - LOAD32H(s0, pt ); s0 ^= rk[0]; - LOAD32H(s1, pt + 4); s1 ^= rk[1]; - LOAD32H(s2, pt + 8); s2 ^= rk[2]; - LOAD32H(s3, pt + 12); s3 ^= rk[3]; - -#ifdef LTC_SMALL_CODE - - for (r = 0; ; r++) { - rk += 4; - t0 = - Te0(byte(s0, 3)) ^ - Te1(byte(s1, 2)) ^ - Te2(byte(s2, 1)) ^ - Te3(byte(s3, 0)) ^ - rk[0]; - t1 = - Te0(byte(s1, 3)) ^ - Te1(byte(s2, 2)) ^ - Te2(byte(s3, 1)) ^ - Te3(byte(s0, 0)) ^ - rk[1]; - t2 = - Te0(byte(s2, 3)) ^ - Te1(byte(s3, 2)) ^ - Te2(byte(s0, 1)) ^ - Te3(byte(s1, 0)) ^ - rk[2]; - t3 = - Te0(byte(s3, 3)) ^ - Te1(byte(s0, 2)) ^ - Te2(byte(s1, 1)) ^ - Te3(byte(s2, 0)) ^ - rk[3]; - if (r == Nr-2) { - break; - } - s0 = t0; s1 = t1; s2 = t2; s3 = t3; - } - rk += 4; - -#else - - /* - * Nr - 1 full rounds: - */ - r = Nr >> 1; - for (;;) { - t0 = - Te0(byte(s0, 3)) ^ - Te1(byte(s1, 2)) ^ - Te2(byte(s2, 1)) ^ - Te3(byte(s3, 0)) ^ - rk[4]; - t1 = - Te0(byte(s1, 3)) ^ - Te1(byte(s2, 2)) ^ - Te2(byte(s3, 1)) ^ - Te3(byte(s0, 0)) ^ - rk[5]; - t2 = - Te0(byte(s2, 3)) ^ - Te1(byte(s3, 2)) ^ - Te2(byte(s0, 1)) ^ - Te3(byte(s1, 0)) ^ - rk[6]; - t3 = - Te0(byte(s3, 3)) ^ - Te1(byte(s0, 2)) ^ - Te2(byte(s1, 1)) ^ - Te3(byte(s2, 0)) ^ - rk[7]; - - rk += 8; - if (--r == 0) { - break; - } - - s0 = - Te0(byte(t0, 3)) ^ - Te1(byte(t1, 2)) ^ - Te2(byte(t2, 1)) ^ - Te3(byte(t3, 0)) ^ - rk[0]; - s1 = - Te0(byte(t1, 3)) ^ - Te1(byte(t2, 2)) ^ - Te2(byte(t3, 1)) ^ - Te3(byte(t0, 0)) ^ - rk[1]; - s2 = - Te0(byte(t2, 3)) ^ - Te1(byte(t3, 2)) ^ - Te2(byte(t0, 1)) ^ - Te3(byte(t1, 0)) ^ - rk[2]; - s3 = - Te0(byte(t3, 3)) ^ - Te1(byte(t0, 2)) ^ - Te2(byte(t1, 1)) ^ - Te3(byte(t2, 0)) ^ - rk[3]; - } - -#endif - - /* - * apply last round and - * map cipher state to byte array block: - */ - s0 = - (Te4_3[byte(t0, 3)]) ^ - (Te4_2[byte(t1, 2)]) ^ - (Te4_1[byte(t2, 1)]) ^ - (Te4_0[byte(t3, 0)]) ^ - rk[0]; - STORE32H(s0, ct); - s1 = - (Te4_3[byte(t1, 3)]) ^ - (Te4_2[byte(t2, 2)]) ^ - (Te4_1[byte(t3, 1)]) ^ - (Te4_0[byte(t0, 0)]) ^ - rk[1]; - STORE32H(s1, ct+4); - s2 = - (Te4_3[byte(t2, 3)]) ^ - (Te4_2[byte(t3, 2)]) ^ - (Te4_1[byte(t0, 1)]) ^ - (Te4_0[byte(t1, 0)]) ^ - rk[2]; - STORE32H(s2, ct+8); - s3 = - (Te4_3[byte(t3, 3)]) ^ - (Te4_2[byte(t0, 2)]) ^ - (Te4_1[byte(t1, 1)]) ^ - (Te4_0[byte(t2, 0)]) ^ - rk[3]; - STORE32H(s3, ct+12); - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -int ECB_ENC(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -{ - int err = _rijndael_ecb_encrypt(pt, ct, skey); - burn_stack(sizeof(unsigned long)*8 + sizeof(unsigned long*) + sizeof(int)*2); - return err; -} -#endif - -#ifndef ENCRYPT_ONLY - -/** - Decrypts a block of text with AES - @param ct The input ciphertext (16 bytes) - @param pt The output plaintext (16 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful - */ -#ifdef LTC_CLEAN_STACK -static int _rijndael_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -#else -int ECB_DEC(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -#endif -{ - ulong32 s0, s1, s2, s3, t0, t1, t2, t3, *rk; - int Nr, r; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - - Nr = skey->rijndael.Nr; - rk = skey->rijndael.dK; - - /* - * map byte array block to cipher state - * and add initial round key: - */ - LOAD32H(s0, ct ); s0 ^= rk[0]; - LOAD32H(s1, ct + 4); s1 ^= rk[1]; - LOAD32H(s2, ct + 8); s2 ^= rk[2]; - LOAD32H(s3, ct + 12); s3 ^= rk[3]; - -#ifdef LTC_SMALL_CODE - for (r = 0; ; r++) { - rk += 4; - t0 = - Td0(byte(s0, 3)) ^ - Td1(byte(s3, 2)) ^ - Td2(byte(s2, 1)) ^ - Td3(byte(s1, 0)) ^ - rk[0]; - t1 = - Td0(byte(s1, 3)) ^ - Td1(byte(s0, 2)) ^ - Td2(byte(s3, 1)) ^ - Td3(byte(s2, 0)) ^ - rk[1]; - t2 = - Td0(byte(s2, 3)) ^ - Td1(byte(s1, 2)) ^ - Td2(byte(s0, 1)) ^ - Td3(byte(s3, 0)) ^ - rk[2]; - t3 = - Td0(byte(s3, 3)) ^ - Td1(byte(s2, 2)) ^ - Td2(byte(s1, 1)) ^ - Td3(byte(s0, 0)) ^ - rk[3]; - if (r == Nr-2) { - break; - } - s0 = t0; s1 = t1; s2 = t2; s3 = t3; - } - rk += 4; - -#else - - /* - * Nr - 1 full rounds: - */ - r = Nr >> 1; - for (;;) { - - t0 = - Td0(byte(s0, 3)) ^ - Td1(byte(s3, 2)) ^ - Td2(byte(s2, 1)) ^ - Td3(byte(s1, 0)) ^ - rk[4]; - t1 = - Td0(byte(s1, 3)) ^ - Td1(byte(s0, 2)) ^ - Td2(byte(s3, 1)) ^ - Td3(byte(s2, 0)) ^ - rk[5]; - t2 = - Td0(byte(s2, 3)) ^ - Td1(byte(s1, 2)) ^ - Td2(byte(s0, 1)) ^ - Td3(byte(s3, 0)) ^ - rk[6]; - t3 = - Td0(byte(s3, 3)) ^ - Td1(byte(s2, 2)) ^ - Td2(byte(s1, 1)) ^ - Td3(byte(s0, 0)) ^ - rk[7]; - - rk += 8; - if (--r == 0) { - break; - } - - - s0 = - Td0(byte(t0, 3)) ^ - Td1(byte(t3, 2)) ^ - Td2(byte(t2, 1)) ^ - Td3(byte(t1, 0)) ^ - rk[0]; - s1 = - Td0(byte(t1, 3)) ^ - Td1(byte(t0, 2)) ^ - Td2(byte(t3, 1)) ^ - Td3(byte(t2, 0)) ^ - rk[1]; - s2 = - Td0(byte(t2, 3)) ^ - Td1(byte(t1, 2)) ^ - Td2(byte(t0, 1)) ^ - Td3(byte(t3, 0)) ^ - rk[2]; - s3 = - Td0(byte(t3, 3)) ^ - Td1(byte(t2, 2)) ^ - Td2(byte(t1, 1)) ^ - Td3(byte(t0, 0)) ^ - rk[3]; - } -#endif - - /* - * apply last round and - * map cipher state to byte array block: - */ - s0 = - (Td4[byte(t0, 3)] & 0xff000000) ^ - (Td4[byte(t3, 2)] & 0x00ff0000) ^ - (Td4[byte(t2, 1)] & 0x0000ff00) ^ - (Td4[byte(t1, 0)] & 0x000000ff) ^ - rk[0]; - STORE32H(s0, pt); - s1 = - (Td4[byte(t1, 3)] & 0xff000000) ^ - (Td4[byte(t0, 2)] & 0x00ff0000) ^ - (Td4[byte(t3, 1)] & 0x0000ff00) ^ - (Td4[byte(t2, 0)] & 0x000000ff) ^ - rk[1]; - STORE32H(s1, pt+4); - s2 = - (Td4[byte(t2, 3)] & 0xff000000) ^ - (Td4[byte(t1, 2)] & 0x00ff0000) ^ - (Td4[byte(t0, 1)] & 0x0000ff00) ^ - (Td4[byte(t3, 0)] & 0x000000ff) ^ - rk[2]; - STORE32H(s2, pt+8); - s3 = - (Td4[byte(t3, 3)] & 0xff000000) ^ - (Td4[byte(t2, 2)] & 0x00ff0000) ^ - (Td4[byte(t1, 1)] & 0x0000ff00) ^ - (Td4[byte(t0, 0)] & 0x000000ff) ^ - rk[3]; - STORE32H(s3, pt+12); - - return CRYPT_OK; -} - - -#ifdef LTC_CLEAN_STACK -int ECB_DEC(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -{ - int err = _rijndael_ecb_decrypt(ct, pt, skey); - burn_stack(sizeof(unsigned long)*8 + sizeof(unsigned long*) + sizeof(int)*2); - return err; -} -#endif - -/** - Performs a self-test of the AES block cipher - @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled - */ -int ECB_TEST(void) -{ -#ifndef LTC_TEST - return CRYPT_NOP; -#else - int err; - static const struct { - int keylen; - unsigned char key[32], pt[16], ct[16]; - } tests[] = { - { 16, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, - { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, - { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, - 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a } - }, { - 24, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 }, - { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, - { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, - 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 } - }, { - 32, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, - { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, - { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, - 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 } - } - }; - - symmetric_key key; - unsigned char tmp[2][16]; - int i, y; - - for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) { - zeromem(&key, sizeof(key)); - if ((err = rijndael_setup(tests[i].key, tests[i].keylen, 0, &key)) != CRYPT_OK) { - return err; - } - - rijndael_ecb_encrypt(tests[i].pt, tmp[0], &key); - rijndael_ecb_decrypt(tmp[0], tmp[1], &key); - if (XMEMCMP(tmp[0], tests[i].ct, 16) || XMEMCMP(tmp[1], tests[i].pt, 16)) { -#if 0 - printf("\n\nTest %d failed\n", i); - if (XMEMCMP(tmp[0], tests[i].ct, 16)) { - printf("CT: "); - for (i = 0; i < 16; i++) { - printf("%02x ", tmp[0][i]); - } - printf("\n"); - } else { - printf("PT: "); - for (i = 0; i < 16; i++) { - printf("%02x ", tmp[1][i]); - } - printf("\n"); - } -#endif - return CRYPT_FAIL_TESTVECTOR; - } - - /* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */ - for (y = 0; y < 16; y++) tmp[0][y] = 0; - for (y = 0; y < 1000; y++) rijndael_ecb_encrypt(tmp[0], tmp[0], &key); - for (y = 0; y < 1000; y++) rijndael_ecb_decrypt(tmp[0], tmp[0], &key); - for (y = 0; y < 16; y++) if (tmp[0][y] != 0) return CRYPT_FAIL_TESTVECTOR; - } - return CRYPT_OK; -#endif -} - -#endif /* ENCRYPT_ONLY */ - - -/** Terminate the context - @param skey The scheduled key - */ -void ECB_DONE(symmetric_key *skey) -{ -} - - -/** - Gets suitable key size - @param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable. - @return CRYPT_OK if the input key size is acceptable. - */ -int ECB_KS(int *keysize) -{ - LTC_ARGCHK(keysize != NULL); - - if (*keysize < 16) - return CRYPT_INVALID_KEYSIZE; - if (*keysize < 24) { - *keysize = 16; - return CRYPT_OK; - } else if (*keysize < 32) { - *keysize = 24; - return CRYPT_OK; - } else { - *keysize = 32; - return CRYPT_OK; - } -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/aes/aes.c,v $ */ -/* $Revision: 1.16 $ */ -/* $Date: 2007/05/12 14:13:00 $ */ DELETED Source/libtomcrypt/src/ciphers/ltc_aes/aes_tab.c Index: Source/libtomcrypt/src/ciphers/ltc_aes/aes_tab.c ================================================================== --- Source/libtomcrypt/src/ciphers/ltc_aes/aes_tab.c +++ /dev/null @@ -1,1031 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -/* The precomputed tables for AES */ -/* - Te0[x] = S [x].[02, 01, 01, 03]; - Te1[x] = S [x].[03, 02, 01, 01]; - Te2[x] = S [x].[01, 03, 02, 01]; - Te3[x] = S [x].[01, 01, 03, 02]; - Te4[x] = S [x].[01, 01, 01, 01]; - - Td0[x] = Si[x].[0e, 09, 0d, 0b]; - Td1[x] = Si[x].[0b, 0e, 09, 0d]; - Td2[x] = Si[x].[0d, 0b, 0e, 09]; - Td3[x] = Si[x].[09, 0d, 0b, 0e]; - Td4[x] = Si[x].[01, 01, 01, 01]; - */ - -/** - @file aes_tab.c - AES tables - */ - -#include - -static const uint32_t TE0[256] = { - 0xc66363a5UL, 0xf87c7c84UL, 0xee777799UL, 0xf67b7b8dUL, - 0xfff2f20dUL, 0xd66b6bbdUL, 0xde6f6fb1UL, 0x91c5c554UL, - 0x60303050UL, 0x02010103UL, 0xce6767a9UL, 0x562b2b7dUL, - 0xe7fefe19UL, 0xb5d7d762UL, 0x4dababe6UL, 0xec76769aUL, - 0x8fcaca45UL, 0x1f82829dUL, 0x89c9c940UL, 0xfa7d7d87UL, - 0xeffafa15UL, 0xb25959ebUL, 0x8e4747c9UL, 0xfbf0f00bUL, - 0x41adadecUL, 0xb3d4d467UL, 0x5fa2a2fdUL, 0x45afafeaUL, - 0x239c9cbfUL, 0x53a4a4f7UL, 0xe4727296UL, 0x9bc0c05bUL, - 0x75b7b7c2UL, 0xe1fdfd1cUL, 0x3d9393aeUL, 0x4c26266aUL, - 0x6c36365aUL, 0x7e3f3f41UL, 0xf5f7f702UL, 0x83cccc4fUL, - 0x6834345cUL, 0x51a5a5f4UL, 0xd1e5e534UL, 0xf9f1f108UL, - 0xe2717193UL, 0xabd8d873UL, 0x62313153UL, 0x2a15153fUL, - 0x0804040cUL, 0x95c7c752UL, 0x46232365UL, 0x9dc3c35eUL, - 0x30181828UL, 0x379696a1UL, 0x0a05050fUL, 0x2f9a9ab5UL, - 0x0e070709UL, 0x24121236UL, 0x1b80809bUL, 0xdfe2e23dUL, - 0xcdebeb26UL, 0x4e272769UL, 0x7fb2b2cdUL, 0xea75759fUL, - 0x1209091bUL, 0x1d83839eUL, 0x582c2c74UL, 0x341a1a2eUL, - 0x361b1b2dUL, 0xdc6e6eb2UL, 0xb45a5aeeUL, 0x5ba0a0fbUL, - 0xa45252f6UL, 0x763b3b4dUL, 0xb7d6d661UL, 0x7db3b3ceUL, - 0x5229297bUL, 0xdde3e33eUL, 0x5e2f2f71UL, 0x13848497UL, - 0xa65353f5UL, 0xb9d1d168UL, 0x00000000UL, 0xc1eded2cUL, - 0x40202060UL, 0xe3fcfc1fUL, 0x79b1b1c8UL, 0xb65b5bedUL, - 0xd46a6abeUL, 0x8dcbcb46UL, 0x67bebed9UL, 0x7239394bUL, - 0x944a4adeUL, 0x984c4cd4UL, 0xb05858e8UL, 0x85cfcf4aUL, - 0xbbd0d06bUL, 0xc5efef2aUL, 0x4faaaae5UL, 0xedfbfb16UL, - 0x864343c5UL, 0x9a4d4dd7UL, 0x66333355UL, 0x11858594UL, - 0x8a4545cfUL, 0xe9f9f910UL, 0x04020206UL, 0xfe7f7f81UL, - 0xa05050f0UL, 0x783c3c44UL, 0x259f9fbaUL, 0x4ba8a8e3UL, - 0xa25151f3UL, 0x5da3a3feUL, 0x804040c0UL, 0x058f8f8aUL, - 0x3f9292adUL, 0x219d9dbcUL, 0x70383848UL, 0xf1f5f504UL, - 0x63bcbcdfUL, 0x77b6b6c1UL, 0xafdada75UL, 0x42212163UL, - 0x20101030UL, 0xe5ffff1aUL, 0xfdf3f30eUL, 0xbfd2d26dUL, - 0x81cdcd4cUL, 0x180c0c14UL, 0x26131335UL, 0xc3ecec2fUL, - 0xbe5f5fe1UL, 0x359797a2UL, 0x884444ccUL, 0x2e171739UL, - 0x93c4c457UL, 0x55a7a7f2UL, 0xfc7e7e82UL, 0x7a3d3d47UL, - 0xc86464acUL, 0xba5d5de7UL, 0x3219192bUL, 0xe6737395UL, - 0xc06060a0UL, 0x19818198UL, 0x9e4f4fd1UL, 0xa3dcdc7fUL, - 0x44222266UL, 0x542a2a7eUL, 0x3b9090abUL, 0x0b888883UL, - 0x8c4646caUL, 0xc7eeee29UL, 0x6bb8b8d3UL, 0x2814143cUL, - 0xa7dede79UL, 0xbc5e5ee2UL, 0x160b0b1dUL, 0xaddbdb76UL, - 0xdbe0e03bUL, 0x64323256UL, 0x743a3a4eUL, 0x140a0a1eUL, - 0x924949dbUL, 0x0c06060aUL, 0x4824246cUL, 0xb85c5ce4UL, - 0x9fc2c25dUL, 0xbdd3d36eUL, 0x43acacefUL, 0xc46262a6UL, - 0x399191a8UL, 0x319595a4UL, 0xd3e4e437UL, 0xf279798bUL, - 0xd5e7e732UL, 0x8bc8c843UL, 0x6e373759UL, 0xda6d6db7UL, - 0x018d8d8cUL, 0xb1d5d564UL, 0x9c4e4ed2UL, 0x49a9a9e0UL, - 0xd86c6cb4UL, 0xac5656faUL, 0xf3f4f407UL, 0xcfeaea25UL, - 0xca6565afUL, 0xf47a7a8eUL, 0x47aeaee9UL, 0x10080818UL, - 0x6fbabad5UL, 0xf0787888UL, 0x4a25256fUL, 0x5c2e2e72UL, - 0x381c1c24UL, 0x57a6a6f1UL, 0x73b4b4c7UL, 0x97c6c651UL, - 0xcbe8e823UL, 0xa1dddd7cUL, 0xe874749cUL, 0x3e1f1f21UL, - 0x964b4bddUL, 0x61bdbddcUL, 0x0d8b8b86UL, 0x0f8a8a85UL, - 0xe0707090UL, 0x7c3e3e42UL, 0x71b5b5c4UL, 0xcc6666aaUL, - 0x904848d8UL, 0x06030305UL, 0xf7f6f601UL, 0x1c0e0e12UL, - 0xc26161a3UL, 0x6a35355fUL, 0xae5757f9UL, 0x69b9b9d0UL, - 0x17868691UL, 0x99c1c158UL, 0x3a1d1d27UL, 0x279e9eb9UL, - 0xd9e1e138UL, 0xebf8f813UL, 0x2b9898b3UL, 0x22111133UL, - 0xd26969bbUL, 0xa9d9d970UL, 0x078e8e89UL, 0x339494a7UL, - 0x2d9b9bb6UL, 0x3c1e1e22UL, 0x15878792UL, 0xc9e9e920UL, - 0x87cece49UL, 0xaa5555ffUL, 0x50282878UL, 0xa5dfdf7aUL, - 0x038c8c8fUL, 0x59a1a1f8UL, 0x09898980UL, 0x1a0d0d17UL, - 0x65bfbfdaUL, 0xd7e6e631UL, 0x844242c6UL, 0xd06868b8UL, - 0x824141c3UL, 0x299999b0UL, 0x5a2d2d77UL, 0x1e0f0f11UL, - 0x7bb0b0cbUL, 0xa85454fcUL, 0x6dbbbbd6UL, 0x2c16163aUL, -}; - -#ifndef PELI_TAB -static const uint32_t Te4[256] = { - 0x63636363UL, 0x7c7c7c7cUL, 0x77777777UL, 0x7b7b7b7bUL, - 0xf2f2f2f2UL, 0x6b6b6b6bUL, 0x6f6f6f6fUL, 0xc5c5c5c5UL, - 0x30303030UL, 0x01010101UL, 0x67676767UL, 0x2b2b2b2bUL, - 0xfefefefeUL, 0xd7d7d7d7UL, 0xababababUL, 0x76767676UL, - 0xcacacacaUL, 0x82828282UL, 0xc9c9c9c9UL, 0x7d7d7d7dUL, - 0xfafafafaUL, 0x59595959UL, 0x47474747UL, 0xf0f0f0f0UL, - 0xadadadadUL, 0xd4d4d4d4UL, 0xa2a2a2a2UL, 0xafafafafUL, - 0x9c9c9c9cUL, 0xa4a4a4a4UL, 0x72727272UL, 0xc0c0c0c0UL, - 0xb7b7b7b7UL, 0xfdfdfdfdUL, 0x93939393UL, 0x26262626UL, - 0x36363636UL, 0x3f3f3f3fUL, 0xf7f7f7f7UL, 0xccccccccUL, - 0x34343434UL, 0xa5a5a5a5UL, 0xe5e5e5e5UL, 0xf1f1f1f1UL, - 0x71717171UL, 0xd8d8d8d8UL, 0x31313131UL, 0x15151515UL, - 0x04040404UL, 0xc7c7c7c7UL, 0x23232323UL, 0xc3c3c3c3UL, - 0x18181818UL, 0x96969696UL, 0x05050505UL, 0x9a9a9a9aUL, - 0x07070707UL, 0x12121212UL, 0x80808080UL, 0xe2e2e2e2UL, - 0xebebebebUL, 0x27272727UL, 0xb2b2b2b2UL, 0x75757575UL, - 0x09090909UL, 0x83838383UL, 0x2c2c2c2cUL, 0x1a1a1a1aUL, - 0x1b1b1b1bUL, 0x6e6e6e6eUL, 0x5a5a5a5aUL, 0xa0a0a0a0UL, - 0x52525252UL, 0x3b3b3b3bUL, 0xd6d6d6d6UL, 0xb3b3b3b3UL, - 0x29292929UL, 0xe3e3e3e3UL, 0x2f2f2f2fUL, 0x84848484UL, - 0x53535353UL, 0xd1d1d1d1UL, 0x00000000UL, 0xededededUL, - 0x20202020UL, 0xfcfcfcfcUL, 0xb1b1b1b1UL, 0x5b5b5b5bUL, - 0x6a6a6a6aUL, 0xcbcbcbcbUL, 0xbebebebeUL, 0x39393939UL, - 0x4a4a4a4aUL, 0x4c4c4c4cUL, 0x58585858UL, 0xcfcfcfcfUL, - 0xd0d0d0d0UL, 0xefefefefUL, 0xaaaaaaaaUL, 0xfbfbfbfbUL, - 0x43434343UL, 0x4d4d4d4dUL, 0x33333333UL, 0x85858585UL, - 0x45454545UL, 0xf9f9f9f9UL, 0x02020202UL, 0x7f7f7f7fUL, - 0x50505050UL, 0x3c3c3c3cUL, 0x9f9f9f9fUL, 0xa8a8a8a8UL, - 0x51515151UL, 0xa3a3a3a3UL, 0x40404040UL, 0x8f8f8f8fUL, - 0x92929292UL, 0x9d9d9d9dUL, 0x38383838UL, 0xf5f5f5f5UL, - 0xbcbcbcbcUL, 0xb6b6b6b6UL, 0xdadadadaUL, 0x21212121UL, - 0x10101010UL, 0xffffffffUL, 0xf3f3f3f3UL, 0xd2d2d2d2UL, - 0xcdcdcdcdUL, 0x0c0c0c0cUL, 0x13131313UL, 0xececececUL, - 0x5f5f5f5fUL, 0x97979797UL, 0x44444444UL, 0x17171717UL, - 0xc4c4c4c4UL, 0xa7a7a7a7UL, 0x7e7e7e7eUL, 0x3d3d3d3dUL, - 0x64646464UL, 0x5d5d5d5dUL, 0x19191919UL, 0x73737373UL, - 0x60606060UL, 0x81818181UL, 0x4f4f4f4fUL, 0xdcdcdcdcUL, - 0x22222222UL, 0x2a2a2a2aUL, 0x90909090UL, 0x88888888UL, - 0x46464646UL, 0xeeeeeeeeUL, 0xb8b8b8b8UL, 0x14141414UL, - 0xdedededeUL, 0x5e5e5e5eUL, 0x0b0b0b0bUL, 0xdbdbdbdbUL, - 0xe0e0e0e0UL, 0x32323232UL, 0x3a3a3a3aUL, 0x0a0a0a0aUL, - 0x49494949UL, 0x06060606UL, 0x24242424UL, 0x5c5c5c5cUL, - 0xc2c2c2c2UL, 0xd3d3d3d3UL, 0xacacacacUL, 0x62626262UL, - 0x91919191UL, 0x95959595UL, 0xe4e4e4e4UL, 0x79797979UL, - 0xe7e7e7e7UL, 0xc8c8c8c8UL, 0x37373737UL, 0x6d6d6d6dUL, - 0x8d8d8d8dUL, 0xd5d5d5d5UL, 0x4e4e4e4eUL, 0xa9a9a9a9UL, - 0x6c6c6c6cUL, 0x56565656UL, 0xf4f4f4f4UL, 0xeaeaeaeaUL, - 0x65656565UL, 0x7a7a7a7aUL, 0xaeaeaeaeUL, 0x08080808UL, - 0xbabababaUL, 0x78787878UL, 0x25252525UL, 0x2e2e2e2eUL, - 0x1c1c1c1cUL, 0xa6a6a6a6UL, 0xb4b4b4b4UL, 0xc6c6c6c6UL, - 0xe8e8e8e8UL, 0xddddddddUL, 0x74747474UL, 0x1f1f1f1fUL, - 0x4b4b4b4bUL, 0xbdbdbdbdUL, 0x8b8b8b8bUL, 0x8a8a8a8aUL, - 0x70707070UL, 0x3e3e3e3eUL, 0xb5b5b5b5UL, 0x66666666UL, - 0x48484848UL, 0x03030303UL, 0xf6f6f6f6UL, 0x0e0e0e0eUL, - 0x61616161UL, 0x35353535UL, 0x57575757UL, 0xb9b9b9b9UL, - 0x86868686UL, 0xc1c1c1c1UL, 0x1d1d1d1dUL, 0x9e9e9e9eUL, - 0xe1e1e1e1UL, 0xf8f8f8f8UL, 0x98989898UL, 0x11111111UL, - 0x69696969UL, 0xd9d9d9d9UL, 0x8e8e8e8eUL, 0x94949494UL, - 0x9b9b9b9bUL, 0x1e1e1e1eUL, 0x87878787UL, 0xe9e9e9e9UL, - 0xcecececeUL, 0x55555555UL, 0x28282828UL, 0xdfdfdfdfUL, - 0x8c8c8c8cUL, 0xa1a1a1a1UL, 0x89898989UL, 0x0d0d0d0dUL, - 0xbfbfbfbfUL, 0xe6e6e6e6UL, 0x42424242UL, 0x68686868UL, - 0x41414141UL, 0x99999999UL, 0x2d2d2d2dUL, 0x0f0f0f0fUL, - 0xb0b0b0b0UL, 0x54545454UL, 0xbbbbbbbbUL, 0x16161616UL, -}; -#endif - -#ifndef ENCRYPT_ONLY - -static const uint32_t TD0[256] = { - 0x51f4a750UL, 0x7e416553UL, 0x1a17a4c3UL, 0x3a275e96UL, - 0x3bab6bcbUL, 0x1f9d45f1UL, 0xacfa58abUL, 0x4be30393UL, - 0x2030fa55UL, 0xad766df6UL, 0x88cc7691UL, 0xf5024c25UL, - 0x4fe5d7fcUL, 0xc52acbd7UL, 0x26354480UL, 0xb562a38fUL, - 0xdeb15a49UL, 0x25ba1b67UL, 0x45ea0e98UL, 0x5dfec0e1UL, - 0xc32f7502UL, 0x814cf012UL, 0x8d4697a3UL, 0x6bd3f9c6UL, - 0x038f5fe7UL, 0x15929c95UL, 0xbf6d7aebUL, 0x955259daUL, - 0xd4be832dUL, 0x587421d3UL, 0x49e06929UL, 0x8ec9c844UL, - 0x75c2896aUL, 0xf48e7978UL, 0x99583e6bUL, 0x27b971ddUL, - 0xbee14fb6UL, 0xf088ad17UL, 0xc920ac66UL, 0x7dce3ab4UL, - 0x63df4a18UL, 0xe51a3182UL, 0x97513360UL, 0x62537f45UL, - 0xb16477e0UL, 0xbb6bae84UL, 0xfe81a01cUL, 0xf9082b94UL, - 0x70486858UL, 0x8f45fd19UL, 0x94de6c87UL, 0x527bf8b7UL, - 0xab73d323UL, 0x724b02e2UL, 0xe31f8f57UL, 0x6655ab2aUL, - 0xb2eb2807UL, 0x2fb5c203UL, 0x86c57b9aUL, 0xd33708a5UL, - 0x302887f2UL, 0x23bfa5b2UL, 0x02036abaUL, 0xed16825cUL, - 0x8acf1c2bUL, 0xa779b492UL, 0xf307f2f0UL, 0x4e69e2a1UL, - 0x65daf4cdUL, 0x0605bed5UL, 0xd134621fUL, 0xc4a6fe8aUL, - 0x342e539dUL, 0xa2f355a0UL, 0x058ae132UL, 0xa4f6eb75UL, - 0x0b83ec39UL, 0x4060efaaUL, 0x5e719f06UL, 0xbd6e1051UL, - 0x3e218af9UL, 0x96dd063dUL, 0xdd3e05aeUL, 0x4de6bd46UL, - 0x91548db5UL, 0x71c45d05UL, 0x0406d46fUL, 0x605015ffUL, - 0x1998fb24UL, 0xd6bde997UL, 0x894043ccUL, 0x67d99e77UL, - 0xb0e842bdUL, 0x07898b88UL, 0xe7195b38UL, 0x79c8eedbUL, - 0xa17c0a47UL, 0x7c420fe9UL, 0xf8841ec9UL, 0x00000000UL, - 0x09808683UL, 0x322bed48UL, 0x1e1170acUL, 0x6c5a724eUL, - 0xfd0efffbUL, 0x0f853856UL, 0x3daed51eUL, 0x362d3927UL, - 0x0a0fd964UL, 0x685ca621UL, 0x9b5b54d1UL, 0x24362e3aUL, - 0x0c0a67b1UL, 0x9357e70fUL, 0xb4ee96d2UL, 0x1b9b919eUL, - 0x80c0c54fUL, 0x61dc20a2UL, 0x5a774b69UL, 0x1c121a16UL, - 0xe293ba0aUL, 0xc0a02ae5UL, 0x3c22e043UL, 0x121b171dUL, - 0x0e090d0bUL, 0xf28bc7adUL, 0x2db6a8b9UL, 0x141ea9c8UL, - 0x57f11985UL, 0xaf75074cUL, 0xee99ddbbUL, 0xa37f60fdUL, - 0xf701269fUL, 0x5c72f5bcUL, 0x44663bc5UL, 0x5bfb7e34UL, - 0x8b432976UL, 0xcb23c6dcUL, 0xb6edfc68UL, 0xb8e4f163UL, - 0xd731dccaUL, 0x42638510UL, 0x13972240UL, 0x84c61120UL, - 0x854a247dUL, 0xd2bb3df8UL, 0xaef93211UL, 0xc729a16dUL, - 0x1d9e2f4bUL, 0xdcb230f3UL, 0x0d8652ecUL, 0x77c1e3d0UL, - 0x2bb3166cUL, 0xa970b999UL, 0x119448faUL, 0x47e96422UL, - 0xa8fc8cc4UL, 0xa0f03f1aUL, 0x567d2cd8UL, 0x223390efUL, - 0x87494ec7UL, 0xd938d1c1UL, 0x8ccaa2feUL, 0x98d40b36UL, - 0xa6f581cfUL, 0xa57ade28UL, 0xdab78e26UL, 0x3fadbfa4UL, - 0x2c3a9de4UL, 0x5078920dUL, 0x6a5fcc9bUL, 0x547e4662UL, - 0xf68d13c2UL, 0x90d8b8e8UL, 0x2e39f75eUL, 0x82c3aff5UL, - 0x9f5d80beUL, 0x69d0937cUL, 0x6fd52da9UL, 0xcf2512b3UL, - 0xc8ac993bUL, 0x10187da7UL, 0xe89c636eUL, 0xdb3bbb7bUL, - 0xcd267809UL, 0x6e5918f4UL, 0xec9ab701UL, 0x834f9aa8UL, - 0xe6956e65UL, 0xaaffe67eUL, 0x21bccf08UL, 0xef15e8e6UL, - 0xbae79bd9UL, 0x4a6f36ceUL, 0xea9f09d4UL, 0x29b07cd6UL, - 0x31a4b2afUL, 0x2a3f2331UL, 0xc6a59430UL, 0x35a266c0UL, - 0x744ebc37UL, 0xfc82caa6UL, 0xe090d0b0UL, 0x33a7d815UL, - 0xf104984aUL, 0x41ecdaf7UL, 0x7fcd500eUL, 0x1791f62fUL, - 0x764dd68dUL, 0x43efb04dUL, 0xccaa4d54UL, 0xe49604dfUL, - 0x9ed1b5e3UL, 0x4c6a881bUL, 0xc12c1fb8UL, 0x4665517fUL, - 0x9d5eea04UL, 0x018c355dUL, 0xfa877473UL, 0xfb0b412eUL, - 0xb3671d5aUL, 0x92dbd252UL, 0xe9105633UL, 0x6dd64713UL, - 0x9ad7618cUL, 0x37a10c7aUL, 0x59f8148eUL, 0xeb133c89UL, - 0xcea927eeUL, 0xb761c935UL, 0xe11ce5edUL, 0x7a47b13cUL, - 0x9cd2df59UL, 0x55f2733fUL, 0x1814ce79UL, 0x73c737bfUL, - 0x53f7cdeaUL, 0x5ffdaa5bUL, 0xdf3d6f14UL, 0x7844db86UL, - 0xcaaff381UL, 0xb968c43eUL, 0x3824342cUL, 0xc2a3405fUL, - 0x161dc372UL, 0xbce2250cUL, 0x283c498bUL, 0xff0d9541UL, - 0x39a80171UL, 0x080cb3deUL, 0xd8b4e49cUL, 0x6456c190UL, - 0x7bcb8461UL, 0xd532b670UL, 0x486c5c74UL, 0xd0b85742UL, -}; - -static const uint32_t Td4[256] = { - 0x52525252UL, 0x09090909UL, 0x6a6a6a6aUL, 0xd5d5d5d5UL, - 0x30303030UL, 0x36363636UL, 0xa5a5a5a5UL, 0x38383838UL, - 0xbfbfbfbfUL, 0x40404040UL, 0xa3a3a3a3UL, 0x9e9e9e9eUL, - 0x81818181UL, 0xf3f3f3f3UL, 0xd7d7d7d7UL, 0xfbfbfbfbUL, - 0x7c7c7c7cUL, 0xe3e3e3e3UL, 0x39393939UL, 0x82828282UL, - 0x9b9b9b9bUL, 0x2f2f2f2fUL, 0xffffffffUL, 0x87878787UL, - 0x34343434UL, 0x8e8e8e8eUL, 0x43434343UL, 0x44444444UL, - 0xc4c4c4c4UL, 0xdedededeUL, 0xe9e9e9e9UL, 0xcbcbcbcbUL, - 0x54545454UL, 0x7b7b7b7bUL, 0x94949494UL, 0x32323232UL, - 0xa6a6a6a6UL, 0xc2c2c2c2UL, 0x23232323UL, 0x3d3d3d3dUL, - 0xeeeeeeeeUL, 0x4c4c4c4cUL, 0x95959595UL, 0x0b0b0b0bUL, - 0x42424242UL, 0xfafafafaUL, 0xc3c3c3c3UL, 0x4e4e4e4eUL, - 0x08080808UL, 0x2e2e2e2eUL, 0xa1a1a1a1UL, 0x66666666UL, - 0x28282828UL, 0xd9d9d9d9UL, 0x24242424UL, 0xb2b2b2b2UL, - 0x76767676UL, 0x5b5b5b5bUL, 0xa2a2a2a2UL, 0x49494949UL, - 0x6d6d6d6dUL, 0x8b8b8b8bUL, 0xd1d1d1d1UL, 0x25252525UL, - 0x72727272UL, 0xf8f8f8f8UL, 0xf6f6f6f6UL, 0x64646464UL, - 0x86868686UL, 0x68686868UL, 0x98989898UL, 0x16161616UL, - 0xd4d4d4d4UL, 0xa4a4a4a4UL, 0x5c5c5c5cUL, 0xccccccccUL, - 0x5d5d5d5dUL, 0x65656565UL, 0xb6b6b6b6UL, 0x92929292UL, - 0x6c6c6c6cUL, 0x70707070UL, 0x48484848UL, 0x50505050UL, - 0xfdfdfdfdUL, 0xededededUL, 0xb9b9b9b9UL, 0xdadadadaUL, - 0x5e5e5e5eUL, 0x15151515UL, 0x46464646UL, 0x57575757UL, - 0xa7a7a7a7UL, 0x8d8d8d8dUL, 0x9d9d9d9dUL, 0x84848484UL, - 0x90909090UL, 0xd8d8d8d8UL, 0xababababUL, 0x00000000UL, - 0x8c8c8c8cUL, 0xbcbcbcbcUL, 0xd3d3d3d3UL, 0x0a0a0a0aUL, - 0xf7f7f7f7UL, 0xe4e4e4e4UL, 0x58585858UL, 0x05050505UL, - 0xb8b8b8b8UL, 0xb3b3b3b3UL, 0x45454545UL, 0x06060606UL, - 0xd0d0d0d0UL, 0x2c2c2c2cUL, 0x1e1e1e1eUL, 0x8f8f8f8fUL, - 0xcacacacaUL, 0x3f3f3f3fUL, 0x0f0f0f0fUL, 0x02020202UL, - 0xc1c1c1c1UL, 0xafafafafUL, 0xbdbdbdbdUL, 0x03030303UL, - 0x01010101UL, 0x13131313UL, 0x8a8a8a8aUL, 0x6b6b6b6bUL, - 0x3a3a3a3aUL, 0x91919191UL, 0x11111111UL, 0x41414141UL, - 0x4f4f4f4fUL, 0x67676767UL, 0xdcdcdcdcUL, 0xeaeaeaeaUL, - 0x97979797UL, 0xf2f2f2f2UL, 0xcfcfcfcfUL, 0xcecececeUL, - 0xf0f0f0f0UL, 0xb4b4b4b4UL, 0xe6e6e6e6UL, 0x73737373UL, - 0x96969696UL, 0xacacacacUL, 0x74747474UL, 0x22222222UL, - 0xe7e7e7e7UL, 0xadadadadUL, 0x35353535UL, 0x85858585UL, - 0xe2e2e2e2UL, 0xf9f9f9f9UL, 0x37373737UL, 0xe8e8e8e8UL, - 0x1c1c1c1cUL, 0x75757575UL, 0xdfdfdfdfUL, 0x6e6e6e6eUL, - 0x47474747UL, 0xf1f1f1f1UL, 0x1a1a1a1aUL, 0x71717171UL, - 0x1d1d1d1dUL, 0x29292929UL, 0xc5c5c5c5UL, 0x89898989UL, - 0x6f6f6f6fUL, 0xb7b7b7b7UL, 0x62626262UL, 0x0e0e0e0eUL, - 0xaaaaaaaaUL, 0x18181818UL, 0xbebebebeUL, 0x1b1b1b1bUL, - 0xfcfcfcfcUL, 0x56565656UL, 0x3e3e3e3eUL, 0x4b4b4b4bUL, - 0xc6c6c6c6UL, 0xd2d2d2d2UL, 0x79797979UL, 0x20202020UL, - 0x9a9a9a9aUL, 0xdbdbdbdbUL, 0xc0c0c0c0UL, 0xfefefefeUL, - 0x78787878UL, 0xcdcdcdcdUL, 0x5a5a5a5aUL, 0xf4f4f4f4UL, - 0x1f1f1f1fUL, 0xddddddddUL, 0xa8a8a8a8UL, 0x33333333UL, - 0x88888888UL, 0x07070707UL, 0xc7c7c7c7UL, 0x31313131UL, - 0xb1b1b1b1UL, 0x12121212UL, 0x10101010UL, 0x59595959UL, - 0x27272727UL, 0x80808080UL, 0xececececUL, 0x5f5f5f5fUL, - 0x60606060UL, 0x51515151UL, 0x7f7f7f7fUL, 0xa9a9a9a9UL, - 0x19191919UL, 0xb5b5b5b5UL, 0x4a4a4a4aUL, 0x0d0d0d0dUL, - 0x2d2d2d2dUL, 0xe5e5e5e5UL, 0x7a7a7a7aUL, 0x9f9f9f9fUL, - 0x93939393UL, 0xc9c9c9c9UL, 0x9c9c9c9cUL, 0xefefefefUL, - 0xa0a0a0a0UL, 0xe0e0e0e0UL, 0x3b3b3b3bUL, 0x4d4d4d4dUL, - 0xaeaeaeaeUL, 0x2a2a2a2aUL, 0xf5f5f5f5UL, 0xb0b0b0b0UL, - 0xc8c8c8c8UL, 0xebebebebUL, 0xbbbbbbbbUL, 0x3c3c3c3cUL, - 0x83838383UL, 0x53535353UL, 0x99999999UL, 0x61616161UL, - 0x17171717UL, 0x2b2b2b2bUL, 0x04040404UL, 0x7e7e7e7eUL, - 0xbabababaUL, 0x77777777UL, 0xd6d6d6d6UL, 0x26262626UL, - 0xe1e1e1e1UL, 0x69696969UL, 0x14141414UL, 0x63636363UL, - 0x55555555UL, 0x21212121UL, 0x0c0c0c0cUL, 0x7d7d7d7dUL, -}; - -#endif /* ENCRYPT_ONLY */ - -#ifdef LTC_SMALL_CODE - -#define Te0(x) TE0[x] -#define Te1(x) RORc(TE0[x], 8) -#define Te2(x) RORc(TE0[x], 16) -#define Te3(x) RORc(TE0[x], 24) - -#define Td0(x) TD0[x] -#define Td1(x) RORc(TD0[x], 8) -#define Td2(x) RORc(TD0[x], 16) -#define Td3(x) RORc(TD0[x], 24) - -#define Te4_0 0x000000FF & Te4 -#define Te4_1 0x0000FF00 & Te4 -#define Te4_2 0x00FF0000 & Te4 -#define Te4_3 0xFF000000 & Te4 - -#else - -#define Te0(x) TE0[x] -#define Te1(x) TE1[x] -#define Te2(x) TE2[x] -#define Te3(x) TE3[x] - -#define Td0(x) TD0[x] -#define Td1(x) TD1[x] -#define Td2(x) TD2[x] -#define Td3(x) TD3[x] - -static const uint32_t TE1[256] = { - 0xa5c66363UL, 0x84f87c7cUL, 0x99ee7777UL, 0x8df67b7bUL, - 0x0dfff2f2UL, 0xbdd66b6bUL, 0xb1de6f6fUL, 0x5491c5c5UL, - 0x50603030UL, 0x03020101UL, 0xa9ce6767UL, 0x7d562b2bUL, - 0x19e7fefeUL, 0x62b5d7d7UL, 0xe64dababUL, 0x9aec7676UL, - 0x458fcacaUL, 0x9d1f8282UL, 0x4089c9c9UL, 0x87fa7d7dUL, - 0x15effafaUL, 0xebb25959UL, 0xc98e4747UL, 0x0bfbf0f0UL, - 0xec41adadUL, 0x67b3d4d4UL, 0xfd5fa2a2UL, 0xea45afafUL, - 0xbf239c9cUL, 0xf753a4a4UL, 0x96e47272UL, 0x5b9bc0c0UL, - 0xc275b7b7UL, 0x1ce1fdfdUL, 0xae3d9393UL, 0x6a4c2626UL, - 0x5a6c3636UL, 0x417e3f3fUL, 0x02f5f7f7UL, 0x4f83ccccUL, - 0x5c683434UL, 0xf451a5a5UL, 0x34d1e5e5UL, 0x08f9f1f1UL, - 0x93e27171UL, 0x73abd8d8UL, 0x53623131UL, 0x3f2a1515UL, - 0x0c080404UL, 0x5295c7c7UL, 0x65462323UL, 0x5e9dc3c3UL, - 0x28301818UL, 0xa1379696UL, 0x0f0a0505UL, 0xb52f9a9aUL, - 0x090e0707UL, 0x36241212UL, 0x9b1b8080UL, 0x3ddfe2e2UL, - 0x26cdebebUL, 0x694e2727UL, 0xcd7fb2b2UL, 0x9fea7575UL, - 0x1b120909UL, 0x9e1d8383UL, 0x74582c2cUL, 0x2e341a1aUL, - 0x2d361b1bUL, 0xb2dc6e6eUL, 0xeeb45a5aUL, 0xfb5ba0a0UL, - 0xf6a45252UL, 0x4d763b3bUL, 0x61b7d6d6UL, 0xce7db3b3UL, - 0x7b522929UL, 0x3edde3e3UL, 0x715e2f2fUL, 0x97138484UL, - 0xf5a65353UL, 0x68b9d1d1UL, 0x00000000UL, 0x2cc1ededUL, - 0x60402020UL, 0x1fe3fcfcUL, 0xc879b1b1UL, 0xedb65b5bUL, - 0xbed46a6aUL, 0x468dcbcbUL, 0xd967bebeUL, 0x4b723939UL, - 0xde944a4aUL, 0xd4984c4cUL, 0xe8b05858UL, 0x4a85cfcfUL, - 0x6bbbd0d0UL, 0x2ac5efefUL, 0xe54faaaaUL, 0x16edfbfbUL, - 0xc5864343UL, 0xd79a4d4dUL, 0x55663333UL, 0x94118585UL, - 0xcf8a4545UL, 0x10e9f9f9UL, 0x06040202UL, 0x81fe7f7fUL, - 0xf0a05050UL, 0x44783c3cUL, 0xba259f9fUL, 0xe34ba8a8UL, - 0xf3a25151UL, 0xfe5da3a3UL, 0xc0804040UL, 0x8a058f8fUL, - 0xad3f9292UL, 0xbc219d9dUL, 0x48703838UL, 0x04f1f5f5UL, - 0xdf63bcbcUL, 0xc177b6b6UL, 0x75afdadaUL, 0x63422121UL, - 0x30201010UL, 0x1ae5ffffUL, 0x0efdf3f3UL, 0x6dbfd2d2UL, - 0x4c81cdcdUL, 0x14180c0cUL, 0x35261313UL, 0x2fc3ececUL, - 0xe1be5f5fUL, 0xa2359797UL, 0xcc884444UL, 0x392e1717UL, - 0x5793c4c4UL, 0xf255a7a7UL, 0x82fc7e7eUL, 0x477a3d3dUL, - 0xacc86464UL, 0xe7ba5d5dUL, 0x2b321919UL, 0x95e67373UL, - 0xa0c06060UL, 0x98198181UL, 0xd19e4f4fUL, 0x7fa3dcdcUL, - 0x66442222UL, 0x7e542a2aUL, 0xab3b9090UL, 0x830b8888UL, - 0xca8c4646UL, 0x29c7eeeeUL, 0xd36bb8b8UL, 0x3c281414UL, - 0x79a7dedeUL, 0xe2bc5e5eUL, 0x1d160b0bUL, 0x76addbdbUL, - 0x3bdbe0e0UL, 0x56643232UL, 0x4e743a3aUL, 0x1e140a0aUL, - 0xdb924949UL, 0x0a0c0606UL, 0x6c482424UL, 0xe4b85c5cUL, - 0x5d9fc2c2UL, 0x6ebdd3d3UL, 0xef43acacUL, 0xa6c46262UL, - 0xa8399191UL, 0xa4319595UL, 0x37d3e4e4UL, 0x8bf27979UL, - 0x32d5e7e7UL, 0x438bc8c8UL, 0x596e3737UL, 0xb7da6d6dUL, - 0x8c018d8dUL, 0x64b1d5d5UL, 0xd29c4e4eUL, 0xe049a9a9UL, - 0xb4d86c6cUL, 0xfaac5656UL, 0x07f3f4f4UL, 0x25cfeaeaUL, - 0xafca6565UL, 0x8ef47a7aUL, 0xe947aeaeUL, 0x18100808UL, - 0xd56fbabaUL, 0x88f07878UL, 0x6f4a2525UL, 0x725c2e2eUL, - 0x24381c1cUL, 0xf157a6a6UL, 0xc773b4b4UL, 0x5197c6c6UL, - 0x23cbe8e8UL, 0x7ca1ddddUL, 0x9ce87474UL, 0x213e1f1fUL, - 0xdd964b4bUL, 0xdc61bdbdUL, 0x860d8b8bUL, 0x850f8a8aUL, - 0x90e07070UL, 0x427c3e3eUL, 0xc471b5b5UL, 0xaacc6666UL, - 0xd8904848UL, 0x05060303UL, 0x01f7f6f6UL, 0x121c0e0eUL, - 0xa3c26161UL, 0x5f6a3535UL, 0xf9ae5757UL, 0xd069b9b9UL, - 0x91178686UL, 0x5899c1c1UL, 0x273a1d1dUL, 0xb9279e9eUL, - 0x38d9e1e1UL, 0x13ebf8f8UL, 0xb32b9898UL, 0x33221111UL, - 0xbbd26969UL, 0x70a9d9d9UL, 0x89078e8eUL, 0xa7339494UL, - 0xb62d9b9bUL, 0x223c1e1eUL, 0x92158787UL, 0x20c9e9e9UL, - 0x4987ceceUL, 0xffaa5555UL, 0x78502828UL, 0x7aa5dfdfUL, - 0x8f038c8cUL, 0xf859a1a1UL, 0x80098989UL, 0x171a0d0dUL, - 0xda65bfbfUL, 0x31d7e6e6UL, 0xc6844242UL, 0xb8d06868UL, - 0xc3824141UL, 0xb0299999UL, 0x775a2d2dUL, 0x111e0f0fUL, - 0xcb7bb0b0UL, 0xfca85454UL, 0xd66dbbbbUL, 0x3a2c1616UL, -}; -static const uint32_t TE2[256] = { - 0x63a5c663UL, 0x7c84f87cUL, 0x7799ee77UL, 0x7b8df67bUL, - 0xf20dfff2UL, 0x6bbdd66bUL, 0x6fb1de6fUL, 0xc55491c5UL, - 0x30506030UL, 0x01030201UL, 0x67a9ce67UL, 0x2b7d562bUL, - 0xfe19e7feUL, 0xd762b5d7UL, 0xabe64dabUL, 0x769aec76UL, - 0xca458fcaUL, 0x829d1f82UL, 0xc94089c9UL, 0x7d87fa7dUL, - 0xfa15effaUL, 0x59ebb259UL, 0x47c98e47UL, 0xf00bfbf0UL, - 0xadec41adUL, 0xd467b3d4UL, 0xa2fd5fa2UL, 0xafea45afUL, - 0x9cbf239cUL, 0xa4f753a4UL, 0x7296e472UL, 0xc05b9bc0UL, - 0xb7c275b7UL, 0xfd1ce1fdUL, 0x93ae3d93UL, 0x266a4c26UL, - 0x365a6c36UL, 0x3f417e3fUL, 0xf702f5f7UL, 0xcc4f83ccUL, - 0x345c6834UL, 0xa5f451a5UL, 0xe534d1e5UL, 0xf108f9f1UL, - 0x7193e271UL, 0xd873abd8UL, 0x31536231UL, 0x153f2a15UL, - 0x040c0804UL, 0xc75295c7UL, 0x23654623UL, 0xc35e9dc3UL, - 0x18283018UL, 0x96a13796UL, 0x050f0a05UL, 0x9ab52f9aUL, - 0x07090e07UL, 0x12362412UL, 0x809b1b80UL, 0xe23ddfe2UL, - 0xeb26cdebUL, 0x27694e27UL, 0xb2cd7fb2UL, 0x759fea75UL, - 0x091b1209UL, 0x839e1d83UL, 0x2c74582cUL, 0x1a2e341aUL, - 0x1b2d361bUL, 0x6eb2dc6eUL, 0x5aeeb45aUL, 0xa0fb5ba0UL, - 0x52f6a452UL, 0x3b4d763bUL, 0xd661b7d6UL, 0xb3ce7db3UL, - 0x297b5229UL, 0xe33edde3UL, 0x2f715e2fUL, 0x84971384UL, - 0x53f5a653UL, 0xd168b9d1UL, 0x00000000UL, 0xed2cc1edUL, - 0x20604020UL, 0xfc1fe3fcUL, 0xb1c879b1UL, 0x5bedb65bUL, - 0x6abed46aUL, 0xcb468dcbUL, 0xbed967beUL, 0x394b7239UL, - 0x4ade944aUL, 0x4cd4984cUL, 0x58e8b058UL, 0xcf4a85cfUL, - 0xd06bbbd0UL, 0xef2ac5efUL, 0xaae54faaUL, 0xfb16edfbUL, - 0x43c58643UL, 0x4dd79a4dUL, 0x33556633UL, 0x85941185UL, - 0x45cf8a45UL, 0xf910e9f9UL, 0x02060402UL, 0x7f81fe7fUL, - 0x50f0a050UL, 0x3c44783cUL, 0x9fba259fUL, 0xa8e34ba8UL, - 0x51f3a251UL, 0xa3fe5da3UL, 0x40c08040UL, 0x8f8a058fUL, - 0x92ad3f92UL, 0x9dbc219dUL, 0x38487038UL, 0xf504f1f5UL, - 0xbcdf63bcUL, 0xb6c177b6UL, 0xda75afdaUL, 0x21634221UL, - 0x10302010UL, 0xff1ae5ffUL, 0xf30efdf3UL, 0xd26dbfd2UL, - 0xcd4c81cdUL, 0x0c14180cUL, 0x13352613UL, 0xec2fc3ecUL, - 0x5fe1be5fUL, 0x97a23597UL, 0x44cc8844UL, 0x17392e17UL, - 0xc45793c4UL, 0xa7f255a7UL, 0x7e82fc7eUL, 0x3d477a3dUL, - 0x64acc864UL, 0x5de7ba5dUL, 0x192b3219UL, 0x7395e673UL, - 0x60a0c060UL, 0x81981981UL, 0x4fd19e4fUL, 0xdc7fa3dcUL, - 0x22664422UL, 0x2a7e542aUL, 0x90ab3b90UL, 0x88830b88UL, - 0x46ca8c46UL, 0xee29c7eeUL, 0xb8d36bb8UL, 0x143c2814UL, - 0xde79a7deUL, 0x5ee2bc5eUL, 0x0b1d160bUL, 0xdb76addbUL, - 0xe03bdbe0UL, 0x32566432UL, 0x3a4e743aUL, 0x0a1e140aUL, - 0x49db9249UL, 0x060a0c06UL, 0x246c4824UL, 0x5ce4b85cUL, - 0xc25d9fc2UL, 0xd36ebdd3UL, 0xacef43acUL, 0x62a6c462UL, - 0x91a83991UL, 0x95a43195UL, 0xe437d3e4UL, 0x798bf279UL, - 0xe732d5e7UL, 0xc8438bc8UL, 0x37596e37UL, 0x6db7da6dUL, - 0x8d8c018dUL, 0xd564b1d5UL, 0x4ed29c4eUL, 0xa9e049a9UL, - 0x6cb4d86cUL, 0x56faac56UL, 0xf407f3f4UL, 0xea25cfeaUL, - 0x65afca65UL, 0x7a8ef47aUL, 0xaee947aeUL, 0x08181008UL, - 0xbad56fbaUL, 0x7888f078UL, 0x256f4a25UL, 0x2e725c2eUL, - 0x1c24381cUL, 0xa6f157a6UL, 0xb4c773b4UL, 0xc65197c6UL, - 0xe823cbe8UL, 0xdd7ca1ddUL, 0x749ce874UL, 0x1f213e1fUL, - 0x4bdd964bUL, 0xbddc61bdUL, 0x8b860d8bUL, 0x8a850f8aUL, - 0x7090e070UL, 0x3e427c3eUL, 0xb5c471b5UL, 0x66aacc66UL, - 0x48d89048UL, 0x03050603UL, 0xf601f7f6UL, 0x0e121c0eUL, - 0x61a3c261UL, 0x355f6a35UL, 0x57f9ae57UL, 0xb9d069b9UL, - 0x86911786UL, 0xc15899c1UL, 0x1d273a1dUL, 0x9eb9279eUL, - 0xe138d9e1UL, 0xf813ebf8UL, 0x98b32b98UL, 0x11332211UL, - 0x69bbd269UL, 0xd970a9d9UL, 0x8e89078eUL, 0x94a73394UL, - 0x9bb62d9bUL, 0x1e223c1eUL, 0x87921587UL, 0xe920c9e9UL, - 0xce4987ceUL, 0x55ffaa55UL, 0x28785028UL, 0xdf7aa5dfUL, - 0x8c8f038cUL, 0xa1f859a1UL, 0x89800989UL, 0x0d171a0dUL, - 0xbfda65bfUL, 0xe631d7e6UL, 0x42c68442UL, 0x68b8d068UL, - 0x41c38241UL, 0x99b02999UL, 0x2d775a2dUL, 0x0f111e0fUL, - 0xb0cb7bb0UL, 0x54fca854UL, 0xbbd66dbbUL, 0x163a2c16UL, -}; -static const uint32_t TE3[256] = { - - 0x6363a5c6UL, 0x7c7c84f8UL, 0x777799eeUL, 0x7b7b8df6UL, - 0xf2f20dffUL, 0x6b6bbdd6UL, 0x6f6fb1deUL, 0xc5c55491UL, - 0x30305060UL, 0x01010302UL, 0x6767a9ceUL, 0x2b2b7d56UL, - 0xfefe19e7UL, 0xd7d762b5UL, 0xababe64dUL, 0x76769aecUL, - 0xcaca458fUL, 0x82829d1fUL, 0xc9c94089UL, 0x7d7d87faUL, - 0xfafa15efUL, 0x5959ebb2UL, 0x4747c98eUL, 0xf0f00bfbUL, - 0xadadec41UL, 0xd4d467b3UL, 0xa2a2fd5fUL, 0xafafea45UL, - 0x9c9cbf23UL, 0xa4a4f753UL, 0x727296e4UL, 0xc0c05b9bUL, - 0xb7b7c275UL, 0xfdfd1ce1UL, 0x9393ae3dUL, 0x26266a4cUL, - 0x36365a6cUL, 0x3f3f417eUL, 0xf7f702f5UL, 0xcccc4f83UL, - 0x34345c68UL, 0xa5a5f451UL, 0xe5e534d1UL, 0xf1f108f9UL, - 0x717193e2UL, 0xd8d873abUL, 0x31315362UL, 0x15153f2aUL, - 0x04040c08UL, 0xc7c75295UL, 0x23236546UL, 0xc3c35e9dUL, - 0x18182830UL, 0x9696a137UL, 0x05050f0aUL, 0x9a9ab52fUL, - 0x0707090eUL, 0x12123624UL, 0x80809b1bUL, 0xe2e23ddfUL, - 0xebeb26cdUL, 0x2727694eUL, 0xb2b2cd7fUL, 0x75759feaUL, - 0x09091b12UL, 0x83839e1dUL, 0x2c2c7458UL, 0x1a1a2e34UL, - 0x1b1b2d36UL, 0x6e6eb2dcUL, 0x5a5aeeb4UL, 0xa0a0fb5bUL, - 0x5252f6a4UL, 0x3b3b4d76UL, 0xd6d661b7UL, 0xb3b3ce7dUL, - 0x29297b52UL, 0xe3e33eddUL, 0x2f2f715eUL, 0x84849713UL, - 0x5353f5a6UL, 0xd1d168b9UL, 0x00000000UL, 0xeded2cc1UL, - 0x20206040UL, 0xfcfc1fe3UL, 0xb1b1c879UL, 0x5b5bedb6UL, - 0x6a6abed4UL, 0xcbcb468dUL, 0xbebed967UL, 0x39394b72UL, - 0x4a4ade94UL, 0x4c4cd498UL, 0x5858e8b0UL, 0xcfcf4a85UL, - 0xd0d06bbbUL, 0xefef2ac5UL, 0xaaaae54fUL, 0xfbfb16edUL, - 0x4343c586UL, 0x4d4dd79aUL, 0x33335566UL, 0x85859411UL, - 0x4545cf8aUL, 0xf9f910e9UL, 0x02020604UL, 0x7f7f81feUL, - 0x5050f0a0UL, 0x3c3c4478UL, 0x9f9fba25UL, 0xa8a8e34bUL, - 0x5151f3a2UL, 0xa3a3fe5dUL, 0x4040c080UL, 0x8f8f8a05UL, - 0x9292ad3fUL, 0x9d9dbc21UL, 0x38384870UL, 0xf5f504f1UL, - 0xbcbcdf63UL, 0xb6b6c177UL, 0xdada75afUL, 0x21216342UL, - 0x10103020UL, 0xffff1ae5UL, 0xf3f30efdUL, 0xd2d26dbfUL, - 0xcdcd4c81UL, 0x0c0c1418UL, 0x13133526UL, 0xecec2fc3UL, - 0x5f5fe1beUL, 0x9797a235UL, 0x4444cc88UL, 0x1717392eUL, - 0xc4c45793UL, 0xa7a7f255UL, 0x7e7e82fcUL, 0x3d3d477aUL, - 0x6464acc8UL, 0x5d5de7baUL, 0x19192b32UL, 0x737395e6UL, - 0x6060a0c0UL, 0x81819819UL, 0x4f4fd19eUL, 0xdcdc7fa3UL, - 0x22226644UL, 0x2a2a7e54UL, 0x9090ab3bUL, 0x8888830bUL, - 0x4646ca8cUL, 0xeeee29c7UL, 0xb8b8d36bUL, 0x14143c28UL, - 0xdede79a7UL, 0x5e5ee2bcUL, 0x0b0b1d16UL, 0xdbdb76adUL, - 0xe0e03bdbUL, 0x32325664UL, 0x3a3a4e74UL, 0x0a0a1e14UL, - 0x4949db92UL, 0x06060a0cUL, 0x24246c48UL, 0x5c5ce4b8UL, - 0xc2c25d9fUL, 0xd3d36ebdUL, 0xacacef43UL, 0x6262a6c4UL, - 0x9191a839UL, 0x9595a431UL, 0xe4e437d3UL, 0x79798bf2UL, - 0xe7e732d5UL, 0xc8c8438bUL, 0x3737596eUL, 0x6d6db7daUL, - 0x8d8d8c01UL, 0xd5d564b1UL, 0x4e4ed29cUL, 0xa9a9e049UL, - 0x6c6cb4d8UL, 0x5656faacUL, 0xf4f407f3UL, 0xeaea25cfUL, - 0x6565afcaUL, 0x7a7a8ef4UL, 0xaeaee947UL, 0x08081810UL, - 0xbabad56fUL, 0x787888f0UL, 0x25256f4aUL, 0x2e2e725cUL, - 0x1c1c2438UL, 0xa6a6f157UL, 0xb4b4c773UL, 0xc6c65197UL, - 0xe8e823cbUL, 0xdddd7ca1UL, 0x74749ce8UL, 0x1f1f213eUL, - 0x4b4bdd96UL, 0xbdbddc61UL, 0x8b8b860dUL, 0x8a8a850fUL, - 0x707090e0UL, 0x3e3e427cUL, 0xb5b5c471UL, 0x6666aaccUL, - 0x4848d890UL, 0x03030506UL, 0xf6f601f7UL, 0x0e0e121cUL, - 0x6161a3c2UL, 0x35355f6aUL, 0x5757f9aeUL, 0xb9b9d069UL, - 0x86869117UL, 0xc1c15899UL, 0x1d1d273aUL, 0x9e9eb927UL, - 0xe1e138d9UL, 0xf8f813ebUL, 0x9898b32bUL, 0x11113322UL, - 0x6969bbd2UL, 0xd9d970a9UL, 0x8e8e8907UL, 0x9494a733UL, - 0x9b9bb62dUL, 0x1e1e223cUL, 0x87879215UL, 0xe9e920c9UL, - 0xcece4987UL, 0x5555ffaaUL, 0x28287850UL, 0xdfdf7aa5UL, - 0x8c8c8f03UL, 0xa1a1f859UL, 0x89898009UL, 0x0d0d171aUL, - 0xbfbfda65UL, 0xe6e631d7UL, 0x4242c684UL, 0x6868b8d0UL, - 0x4141c382UL, 0x9999b029UL, 0x2d2d775aUL, 0x0f0f111eUL, - 0xb0b0cb7bUL, 0x5454fca8UL, 0xbbbbd66dUL, 0x16163a2cUL, -}; - -#ifndef PELI_TAB -static const uint32_t Te4_0[] = { - 0x00000063UL, 0x0000007cUL, 0x00000077UL, 0x0000007bUL, 0x000000f2UL, 0x0000006bUL, 0x0000006fUL, 0x000000c5UL, - 0x00000030UL, 0x00000001UL, 0x00000067UL, 0x0000002bUL, 0x000000feUL, 0x000000d7UL, 0x000000abUL, 0x00000076UL, - 0x000000caUL, 0x00000082UL, 0x000000c9UL, 0x0000007dUL, 0x000000faUL, 0x00000059UL, 0x00000047UL, 0x000000f0UL, - 0x000000adUL, 0x000000d4UL, 0x000000a2UL, 0x000000afUL, 0x0000009cUL, 0x000000a4UL, 0x00000072UL, 0x000000c0UL, - 0x000000b7UL, 0x000000fdUL, 0x00000093UL, 0x00000026UL, 0x00000036UL, 0x0000003fUL, 0x000000f7UL, 0x000000ccUL, - 0x00000034UL, 0x000000a5UL, 0x000000e5UL, 0x000000f1UL, 0x00000071UL, 0x000000d8UL, 0x00000031UL, 0x00000015UL, - 0x00000004UL, 0x000000c7UL, 0x00000023UL, 0x000000c3UL, 0x00000018UL, 0x00000096UL, 0x00000005UL, 0x0000009aUL, - 0x00000007UL, 0x00000012UL, 0x00000080UL, 0x000000e2UL, 0x000000ebUL, 0x00000027UL, 0x000000b2UL, 0x00000075UL, - 0x00000009UL, 0x00000083UL, 0x0000002cUL, 0x0000001aUL, 0x0000001bUL, 0x0000006eUL, 0x0000005aUL, 0x000000a0UL, - 0x00000052UL, 0x0000003bUL, 0x000000d6UL, 0x000000b3UL, 0x00000029UL, 0x000000e3UL, 0x0000002fUL, 0x00000084UL, - 0x00000053UL, 0x000000d1UL, 0x00000000UL, 0x000000edUL, 0x00000020UL, 0x000000fcUL, 0x000000b1UL, 0x0000005bUL, - 0x0000006aUL, 0x000000cbUL, 0x000000beUL, 0x00000039UL, 0x0000004aUL, 0x0000004cUL, 0x00000058UL, 0x000000cfUL, - 0x000000d0UL, 0x000000efUL, 0x000000aaUL, 0x000000fbUL, 0x00000043UL, 0x0000004dUL, 0x00000033UL, 0x00000085UL, - 0x00000045UL, 0x000000f9UL, 0x00000002UL, 0x0000007fUL, 0x00000050UL, 0x0000003cUL, 0x0000009fUL, 0x000000a8UL, - 0x00000051UL, 0x000000a3UL, 0x00000040UL, 0x0000008fUL, 0x00000092UL, 0x0000009dUL, 0x00000038UL, 0x000000f5UL, - 0x000000bcUL, 0x000000b6UL, 0x000000daUL, 0x00000021UL, 0x00000010UL, 0x000000ffUL, 0x000000f3UL, 0x000000d2UL, - 0x000000cdUL, 0x0000000cUL, 0x00000013UL, 0x000000ecUL, 0x0000005fUL, 0x00000097UL, 0x00000044UL, 0x00000017UL, - 0x000000c4UL, 0x000000a7UL, 0x0000007eUL, 0x0000003dUL, 0x00000064UL, 0x0000005dUL, 0x00000019UL, 0x00000073UL, - 0x00000060UL, 0x00000081UL, 0x0000004fUL, 0x000000dcUL, 0x00000022UL, 0x0000002aUL, 0x00000090UL, 0x00000088UL, - 0x00000046UL, 0x000000eeUL, 0x000000b8UL, 0x00000014UL, 0x000000deUL, 0x0000005eUL, 0x0000000bUL, 0x000000dbUL, - 0x000000e0UL, 0x00000032UL, 0x0000003aUL, 0x0000000aUL, 0x00000049UL, 0x00000006UL, 0x00000024UL, 0x0000005cUL, - 0x000000c2UL, 0x000000d3UL, 0x000000acUL, 0x00000062UL, 0x00000091UL, 0x00000095UL, 0x000000e4UL, 0x00000079UL, - 0x000000e7UL, 0x000000c8UL, 0x00000037UL, 0x0000006dUL, 0x0000008dUL, 0x000000d5UL, 0x0000004eUL, 0x000000a9UL, - 0x0000006cUL, 0x00000056UL, 0x000000f4UL, 0x000000eaUL, 0x00000065UL, 0x0000007aUL, 0x000000aeUL, 0x00000008UL, - 0x000000baUL, 0x00000078UL, 0x00000025UL, 0x0000002eUL, 0x0000001cUL, 0x000000a6UL, 0x000000b4UL, 0x000000c6UL, - 0x000000e8UL, 0x000000ddUL, 0x00000074UL, 0x0000001fUL, 0x0000004bUL, 0x000000bdUL, 0x0000008bUL, 0x0000008aUL, - 0x00000070UL, 0x0000003eUL, 0x000000b5UL, 0x00000066UL, 0x00000048UL, 0x00000003UL, 0x000000f6UL, 0x0000000eUL, - 0x00000061UL, 0x00000035UL, 0x00000057UL, 0x000000b9UL, 0x00000086UL, 0x000000c1UL, 0x0000001dUL, 0x0000009eUL, - 0x000000e1UL, 0x000000f8UL, 0x00000098UL, 0x00000011UL, 0x00000069UL, 0x000000d9UL, 0x0000008eUL, 0x00000094UL, - 0x0000009bUL, 0x0000001eUL, 0x00000087UL, 0x000000e9UL, 0x000000ceUL, 0x00000055UL, 0x00000028UL, 0x000000dfUL, - 0x0000008cUL, 0x000000a1UL, 0x00000089UL, 0x0000000dUL, 0x000000bfUL, 0x000000e6UL, 0x00000042UL, 0x00000068UL, - 0x00000041UL, 0x00000099UL, 0x0000002dUL, 0x0000000fUL, 0x000000b0UL, 0x00000054UL, 0x000000bbUL, 0x00000016UL -}; - -static const uint32_t Te4_1[] = { - 0x00006300UL, 0x00007c00UL, 0x00007700UL, 0x00007b00UL, 0x0000f200UL, 0x00006b00UL, 0x00006f00UL, 0x0000c500UL, - 0x00003000UL, 0x00000100UL, 0x00006700UL, 0x00002b00UL, 0x0000fe00UL, 0x0000d700UL, 0x0000ab00UL, 0x00007600UL, - 0x0000ca00UL, 0x00008200UL, 0x0000c900UL, 0x00007d00UL, 0x0000fa00UL, 0x00005900UL, 0x00004700UL, 0x0000f000UL, - 0x0000ad00UL, 0x0000d400UL, 0x0000a200UL, 0x0000af00UL, 0x00009c00UL, 0x0000a400UL, 0x00007200UL, 0x0000c000UL, - 0x0000b700UL, 0x0000fd00UL, 0x00009300UL, 0x00002600UL, 0x00003600UL, 0x00003f00UL, 0x0000f700UL, 0x0000cc00UL, - 0x00003400UL, 0x0000a500UL, 0x0000e500UL, 0x0000f100UL, 0x00007100UL, 0x0000d800UL, 0x00003100UL, 0x00001500UL, - 0x00000400UL, 0x0000c700UL, 0x00002300UL, 0x0000c300UL, 0x00001800UL, 0x00009600UL, 0x00000500UL, 0x00009a00UL, - 0x00000700UL, 0x00001200UL, 0x00008000UL, 0x0000e200UL, 0x0000eb00UL, 0x00002700UL, 0x0000b200UL, 0x00007500UL, - 0x00000900UL, 0x00008300UL, 0x00002c00UL, 0x00001a00UL, 0x00001b00UL, 0x00006e00UL, 0x00005a00UL, 0x0000a000UL, - 0x00005200UL, 0x00003b00UL, 0x0000d600UL, 0x0000b300UL, 0x00002900UL, 0x0000e300UL, 0x00002f00UL, 0x00008400UL, - 0x00005300UL, 0x0000d100UL, 0x00000000UL, 0x0000ed00UL, 0x00002000UL, 0x0000fc00UL, 0x0000b100UL, 0x00005b00UL, - 0x00006a00UL, 0x0000cb00UL, 0x0000be00UL, 0x00003900UL, 0x00004a00UL, 0x00004c00UL, 0x00005800UL, 0x0000cf00UL, - 0x0000d000UL, 0x0000ef00UL, 0x0000aa00UL, 0x0000fb00UL, 0x00004300UL, 0x00004d00UL, 0x00003300UL, 0x00008500UL, - 0x00004500UL, 0x0000f900UL, 0x00000200UL, 0x00007f00UL, 0x00005000UL, 0x00003c00UL, 0x00009f00UL, 0x0000a800UL, - 0x00005100UL, 0x0000a300UL, 0x00004000UL, 0x00008f00UL, 0x00009200UL, 0x00009d00UL, 0x00003800UL, 0x0000f500UL, - 0x0000bc00UL, 0x0000b600UL, 0x0000da00UL, 0x00002100UL, 0x00001000UL, 0x0000ff00UL, 0x0000f300UL, 0x0000d200UL, - 0x0000cd00UL, 0x00000c00UL, 0x00001300UL, 0x0000ec00UL, 0x00005f00UL, 0x00009700UL, 0x00004400UL, 0x00001700UL, - 0x0000c400UL, 0x0000a700UL, 0x00007e00UL, 0x00003d00UL, 0x00006400UL, 0x00005d00UL, 0x00001900UL, 0x00007300UL, - 0x00006000UL, 0x00008100UL, 0x00004f00UL, 0x0000dc00UL, 0x00002200UL, 0x00002a00UL, 0x00009000UL, 0x00008800UL, - 0x00004600UL, 0x0000ee00UL, 0x0000b800UL, 0x00001400UL, 0x0000de00UL, 0x00005e00UL, 0x00000b00UL, 0x0000db00UL, - 0x0000e000UL, 0x00003200UL, 0x00003a00UL, 0x00000a00UL, 0x00004900UL, 0x00000600UL, 0x00002400UL, 0x00005c00UL, - 0x0000c200UL, 0x0000d300UL, 0x0000ac00UL, 0x00006200UL, 0x00009100UL, 0x00009500UL, 0x0000e400UL, 0x00007900UL, - 0x0000e700UL, 0x0000c800UL, 0x00003700UL, 0x00006d00UL, 0x00008d00UL, 0x0000d500UL, 0x00004e00UL, 0x0000a900UL, - 0x00006c00UL, 0x00005600UL, 0x0000f400UL, 0x0000ea00UL, 0x00006500UL, 0x00007a00UL, 0x0000ae00UL, 0x00000800UL, - 0x0000ba00UL, 0x00007800UL, 0x00002500UL, 0x00002e00UL, 0x00001c00UL, 0x0000a600UL, 0x0000b400UL, 0x0000c600UL, - 0x0000e800UL, 0x0000dd00UL, 0x00007400UL, 0x00001f00UL, 0x00004b00UL, 0x0000bd00UL, 0x00008b00UL, 0x00008a00UL, - 0x00007000UL, 0x00003e00UL, 0x0000b500UL, 0x00006600UL, 0x00004800UL, 0x00000300UL, 0x0000f600UL, 0x00000e00UL, - 0x00006100UL, 0x00003500UL, 0x00005700UL, 0x0000b900UL, 0x00008600UL, 0x0000c100UL, 0x00001d00UL, 0x00009e00UL, - 0x0000e100UL, 0x0000f800UL, 0x00009800UL, 0x00001100UL, 0x00006900UL, 0x0000d900UL, 0x00008e00UL, 0x00009400UL, - 0x00009b00UL, 0x00001e00UL, 0x00008700UL, 0x0000e900UL, 0x0000ce00UL, 0x00005500UL, 0x00002800UL, 0x0000df00UL, - 0x00008c00UL, 0x0000a100UL, 0x00008900UL, 0x00000d00UL, 0x0000bf00UL, 0x0000e600UL, 0x00004200UL, 0x00006800UL, - 0x00004100UL, 0x00009900UL, 0x00002d00UL, 0x00000f00UL, 0x0000b000UL, 0x00005400UL, 0x0000bb00UL, 0x00001600UL -}; - -static const uint32_t Te4_2[] = { - 0x00630000UL, 0x007c0000UL, 0x00770000UL, 0x007b0000UL, 0x00f20000UL, 0x006b0000UL, 0x006f0000UL, 0x00c50000UL, - 0x00300000UL, 0x00010000UL, 0x00670000UL, 0x002b0000UL, 0x00fe0000UL, 0x00d70000UL, 0x00ab0000UL, 0x00760000UL, - 0x00ca0000UL, 0x00820000UL, 0x00c90000UL, 0x007d0000UL, 0x00fa0000UL, 0x00590000UL, 0x00470000UL, 0x00f00000UL, - 0x00ad0000UL, 0x00d40000UL, 0x00a20000UL, 0x00af0000UL, 0x009c0000UL, 0x00a40000UL, 0x00720000UL, 0x00c00000UL, - 0x00b70000UL, 0x00fd0000UL, 0x00930000UL, 0x00260000UL, 0x00360000UL, 0x003f0000UL, 0x00f70000UL, 0x00cc0000UL, - 0x00340000UL, 0x00a50000UL, 0x00e50000UL, 0x00f10000UL, 0x00710000UL, 0x00d80000UL, 0x00310000UL, 0x00150000UL, - 0x00040000UL, 0x00c70000UL, 0x00230000UL, 0x00c30000UL, 0x00180000UL, 0x00960000UL, 0x00050000UL, 0x009a0000UL, - 0x00070000UL, 0x00120000UL, 0x00800000UL, 0x00e20000UL, 0x00eb0000UL, 0x00270000UL, 0x00b20000UL, 0x00750000UL, - 0x00090000UL, 0x00830000UL, 0x002c0000UL, 0x001a0000UL, 0x001b0000UL, 0x006e0000UL, 0x005a0000UL, 0x00a00000UL, - 0x00520000UL, 0x003b0000UL, 0x00d60000UL, 0x00b30000UL, 0x00290000UL, 0x00e30000UL, 0x002f0000UL, 0x00840000UL, - 0x00530000UL, 0x00d10000UL, 0x00000000UL, 0x00ed0000UL, 0x00200000UL, 0x00fc0000UL, 0x00b10000UL, 0x005b0000UL, - 0x006a0000UL, 0x00cb0000UL, 0x00be0000UL, 0x00390000UL, 0x004a0000UL, 0x004c0000UL, 0x00580000UL, 0x00cf0000UL, - 0x00d00000UL, 0x00ef0000UL, 0x00aa0000UL, 0x00fb0000UL, 0x00430000UL, 0x004d0000UL, 0x00330000UL, 0x00850000UL, - 0x00450000UL, 0x00f90000UL, 0x00020000UL, 0x007f0000UL, 0x00500000UL, 0x003c0000UL, 0x009f0000UL, 0x00a80000UL, - 0x00510000UL, 0x00a30000UL, 0x00400000UL, 0x008f0000UL, 0x00920000UL, 0x009d0000UL, 0x00380000UL, 0x00f50000UL, - 0x00bc0000UL, 0x00b60000UL, 0x00da0000UL, 0x00210000UL, 0x00100000UL, 0x00ff0000UL, 0x00f30000UL, 0x00d20000UL, - 0x00cd0000UL, 0x000c0000UL, 0x00130000UL, 0x00ec0000UL, 0x005f0000UL, 0x00970000UL, 0x00440000UL, 0x00170000UL, - 0x00c40000UL, 0x00a70000UL, 0x007e0000UL, 0x003d0000UL, 0x00640000UL, 0x005d0000UL, 0x00190000UL, 0x00730000UL, - 0x00600000UL, 0x00810000UL, 0x004f0000UL, 0x00dc0000UL, 0x00220000UL, 0x002a0000UL, 0x00900000UL, 0x00880000UL, - 0x00460000UL, 0x00ee0000UL, 0x00b80000UL, 0x00140000UL, 0x00de0000UL, 0x005e0000UL, 0x000b0000UL, 0x00db0000UL, - 0x00e00000UL, 0x00320000UL, 0x003a0000UL, 0x000a0000UL, 0x00490000UL, 0x00060000UL, 0x00240000UL, 0x005c0000UL, - 0x00c20000UL, 0x00d30000UL, 0x00ac0000UL, 0x00620000UL, 0x00910000UL, 0x00950000UL, 0x00e40000UL, 0x00790000UL, - 0x00e70000UL, 0x00c80000UL, 0x00370000UL, 0x006d0000UL, 0x008d0000UL, 0x00d50000UL, 0x004e0000UL, 0x00a90000UL, - 0x006c0000UL, 0x00560000UL, 0x00f40000UL, 0x00ea0000UL, 0x00650000UL, 0x007a0000UL, 0x00ae0000UL, 0x00080000UL, - 0x00ba0000UL, 0x00780000UL, 0x00250000UL, 0x002e0000UL, 0x001c0000UL, 0x00a60000UL, 0x00b40000UL, 0x00c60000UL, - 0x00e80000UL, 0x00dd0000UL, 0x00740000UL, 0x001f0000UL, 0x004b0000UL, 0x00bd0000UL, 0x008b0000UL, 0x008a0000UL, - 0x00700000UL, 0x003e0000UL, 0x00b50000UL, 0x00660000UL, 0x00480000UL, 0x00030000UL, 0x00f60000UL, 0x000e0000UL, - 0x00610000UL, 0x00350000UL, 0x00570000UL, 0x00b90000UL, 0x00860000UL, 0x00c10000UL, 0x001d0000UL, 0x009e0000UL, - 0x00e10000UL, 0x00f80000UL, 0x00980000UL, 0x00110000UL, 0x00690000UL, 0x00d90000UL, 0x008e0000UL, 0x00940000UL, - 0x009b0000UL, 0x001e0000UL, 0x00870000UL, 0x00e90000UL, 0x00ce0000UL, 0x00550000UL, 0x00280000UL, 0x00df0000UL, - 0x008c0000UL, 0x00a10000UL, 0x00890000UL, 0x000d0000UL, 0x00bf0000UL, 0x00e60000UL, 0x00420000UL, 0x00680000UL, - 0x00410000UL, 0x00990000UL, 0x002d0000UL, 0x000f0000UL, 0x00b00000UL, 0x00540000UL, 0x00bb0000UL, 0x00160000UL -}; - -static const uint32_t Te4_3[] = { - 0x63000000UL, 0x7c000000UL, 0x77000000UL, 0x7b000000UL, 0xf2000000UL, 0x6b000000UL, 0x6f000000UL, 0xc5000000UL, - 0x30000000UL, 0x01000000UL, 0x67000000UL, 0x2b000000UL, 0xfe000000UL, 0xd7000000UL, 0xab000000UL, 0x76000000UL, - 0xca000000UL, 0x82000000UL, 0xc9000000UL, 0x7d000000UL, 0xfa000000UL, 0x59000000UL, 0x47000000UL, 0xf0000000UL, - 0xad000000UL, 0xd4000000UL, 0xa2000000UL, 0xaf000000UL, 0x9c000000UL, 0xa4000000UL, 0x72000000UL, 0xc0000000UL, - 0xb7000000UL, 0xfd000000UL, 0x93000000UL, 0x26000000UL, 0x36000000UL, 0x3f000000UL, 0xf7000000UL, 0xcc000000UL, - 0x34000000UL, 0xa5000000UL, 0xe5000000UL, 0xf1000000UL, 0x71000000UL, 0xd8000000UL, 0x31000000UL, 0x15000000UL, - 0x04000000UL, 0xc7000000UL, 0x23000000UL, 0xc3000000UL, 0x18000000UL, 0x96000000UL, 0x05000000UL, 0x9a000000UL, - 0x07000000UL, 0x12000000UL, 0x80000000UL, 0xe2000000UL, 0xeb000000UL, 0x27000000UL, 0xb2000000UL, 0x75000000UL, - 0x09000000UL, 0x83000000UL, 0x2c000000UL, 0x1a000000UL, 0x1b000000UL, 0x6e000000UL, 0x5a000000UL, 0xa0000000UL, - 0x52000000UL, 0x3b000000UL, 0xd6000000UL, 0xb3000000UL, 0x29000000UL, 0xe3000000UL, 0x2f000000UL, 0x84000000UL, - 0x53000000UL, 0xd1000000UL, 0x00000000UL, 0xed000000UL, 0x20000000UL, 0xfc000000UL, 0xb1000000UL, 0x5b000000UL, - 0x6a000000UL, 0xcb000000UL, 0xbe000000UL, 0x39000000UL, 0x4a000000UL, 0x4c000000UL, 0x58000000UL, 0xcf000000UL, - 0xd0000000UL, 0xef000000UL, 0xaa000000UL, 0xfb000000UL, 0x43000000UL, 0x4d000000UL, 0x33000000UL, 0x85000000UL, - 0x45000000UL, 0xf9000000UL, 0x02000000UL, 0x7f000000UL, 0x50000000UL, 0x3c000000UL, 0x9f000000UL, 0xa8000000UL, - 0x51000000UL, 0xa3000000UL, 0x40000000UL, 0x8f000000UL, 0x92000000UL, 0x9d000000UL, 0x38000000UL, 0xf5000000UL, - 0xbc000000UL, 0xb6000000UL, 0xda000000UL, 0x21000000UL, 0x10000000UL, 0xff000000UL, 0xf3000000UL, 0xd2000000UL, - 0xcd000000UL, 0x0c000000UL, 0x13000000UL, 0xec000000UL, 0x5f000000UL, 0x97000000UL, 0x44000000UL, 0x17000000UL, - 0xc4000000UL, 0xa7000000UL, 0x7e000000UL, 0x3d000000UL, 0x64000000UL, 0x5d000000UL, 0x19000000UL, 0x73000000UL, - 0x60000000UL, 0x81000000UL, 0x4f000000UL, 0xdc000000UL, 0x22000000UL, 0x2a000000UL, 0x90000000UL, 0x88000000UL, - 0x46000000UL, 0xee000000UL, 0xb8000000UL, 0x14000000UL, 0xde000000UL, 0x5e000000UL, 0x0b000000UL, 0xdb000000UL, - 0xe0000000UL, 0x32000000UL, 0x3a000000UL, 0x0a000000UL, 0x49000000UL, 0x06000000UL, 0x24000000UL, 0x5c000000UL, - 0xc2000000UL, 0xd3000000UL, 0xac000000UL, 0x62000000UL, 0x91000000UL, 0x95000000UL, 0xe4000000UL, 0x79000000UL, - 0xe7000000UL, 0xc8000000UL, 0x37000000UL, 0x6d000000UL, 0x8d000000UL, 0xd5000000UL, 0x4e000000UL, 0xa9000000UL, - 0x6c000000UL, 0x56000000UL, 0xf4000000UL, 0xea000000UL, 0x65000000UL, 0x7a000000UL, 0xae000000UL, 0x08000000UL, - 0xba000000UL, 0x78000000UL, 0x25000000UL, 0x2e000000UL, 0x1c000000UL, 0xa6000000UL, 0xb4000000UL, 0xc6000000UL, - 0xe8000000UL, 0xdd000000UL, 0x74000000UL, 0x1f000000UL, 0x4b000000UL, 0xbd000000UL, 0x8b000000UL, 0x8a000000UL, - 0x70000000UL, 0x3e000000UL, 0xb5000000UL, 0x66000000UL, 0x48000000UL, 0x03000000UL, 0xf6000000UL, 0x0e000000UL, - 0x61000000UL, 0x35000000UL, 0x57000000UL, 0xb9000000UL, 0x86000000UL, 0xc1000000UL, 0x1d000000UL, 0x9e000000UL, - 0xe1000000UL, 0xf8000000UL, 0x98000000UL, 0x11000000UL, 0x69000000UL, 0xd9000000UL, 0x8e000000UL, 0x94000000UL, - 0x9b000000UL, 0x1e000000UL, 0x87000000UL, 0xe9000000UL, 0xce000000UL, 0x55000000UL, 0x28000000UL, 0xdf000000UL, - 0x8c000000UL, 0xa1000000UL, 0x89000000UL, 0x0d000000UL, 0xbf000000UL, 0xe6000000UL, 0x42000000UL, 0x68000000UL, - 0x41000000UL, 0x99000000UL, 0x2d000000UL, 0x0f000000UL, 0xb0000000UL, 0x54000000UL, 0xbb000000UL, 0x16000000UL -}; -#endif /* pelimac */ - -#ifndef ENCRYPT_ONLY - -static const uint32_t TD1[256] = { - 0x5051f4a7UL, 0x537e4165UL, 0xc31a17a4UL, 0x963a275eUL, - 0xcb3bab6bUL, 0xf11f9d45UL, 0xabacfa58UL, 0x934be303UL, - 0x552030faUL, 0xf6ad766dUL, 0x9188cc76UL, 0x25f5024cUL, - 0xfc4fe5d7UL, 0xd7c52acbUL, 0x80263544UL, 0x8fb562a3UL, - 0x49deb15aUL, 0x6725ba1bUL, 0x9845ea0eUL, 0xe15dfec0UL, - 0x02c32f75UL, 0x12814cf0UL, 0xa38d4697UL, 0xc66bd3f9UL, - 0xe7038f5fUL, 0x9515929cUL, 0xebbf6d7aUL, 0xda955259UL, - 0x2dd4be83UL, 0xd3587421UL, 0x2949e069UL, 0x448ec9c8UL, - 0x6a75c289UL, 0x78f48e79UL, 0x6b99583eUL, 0xdd27b971UL, - 0xb6bee14fUL, 0x17f088adUL, 0x66c920acUL, 0xb47dce3aUL, - 0x1863df4aUL, 0x82e51a31UL, 0x60975133UL, 0x4562537fUL, - 0xe0b16477UL, 0x84bb6baeUL, 0x1cfe81a0UL, 0x94f9082bUL, - 0x58704868UL, 0x198f45fdUL, 0x8794de6cUL, 0xb7527bf8UL, - 0x23ab73d3UL, 0xe2724b02UL, 0x57e31f8fUL, 0x2a6655abUL, - 0x07b2eb28UL, 0x032fb5c2UL, 0x9a86c57bUL, 0xa5d33708UL, - 0xf2302887UL, 0xb223bfa5UL, 0xba02036aUL, 0x5ced1682UL, - 0x2b8acf1cUL, 0x92a779b4UL, 0xf0f307f2UL, 0xa14e69e2UL, - 0xcd65daf4UL, 0xd50605beUL, 0x1fd13462UL, 0x8ac4a6feUL, - 0x9d342e53UL, 0xa0a2f355UL, 0x32058ae1UL, 0x75a4f6ebUL, - 0x390b83ecUL, 0xaa4060efUL, 0x065e719fUL, 0x51bd6e10UL, - 0xf93e218aUL, 0x3d96dd06UL, 0xaedd3e05UL, 0x464de6bdUL, - 0xb591548dUL, 0x0571c45dUL, 0x6f0406d4UL, 0xff605015UL, - 0x241998fbUL, 0x97d6bde9UL, 0xcc894043UL, 0x7767d99eUL, - 0xbdb0e842UL, 0x8807898bUL, 0x38e7195bUL, 0xdb79c8eeUL, - 0x47a17c0aUL, 0xe97c420fUL, 0xc9f8841eUL, 0x00000000UL, - 0x83098086UL, 0x48322bedUL, 0xac1e1170UL, 0x4e6c5a72UL, - 0xfbfd0effUL, 0x560f8538UL, 0x1e3daed5UL, 0x27362d39UL, - 0x640a0fd9UL, 0x21685ca6UL, 0xd19b5b54UL, 0x3a24362eUL, - 0xb10c0a67UL, 0x0f9357e7UL, 0xd2b4ee96UL, 0x9e1b9b91UL, - 0x4f80c0c5UL, 0xa261dc20UL, 0x695a774bUL, 0x161c121aUL, - 0x0ae293baUL, 0xe5c0a02aUL, 0x433c22e0UL, 0x1d121b17UL, - 0x0b0e090dUL, 0xadf28bc7UL, 0xb92db6a8UL, 0xc8141ea9UL, - 0x8557f119UL, 0x4caf7507UL, 0xbbee99ddUL, 0xfda37f60UL, - 0x9ff70126UL, 0xbc5c72f5UL, 0xc544663bUL, 0x345bfb7eUL, - 0x768b4329UL, 0xdccb23c6UL, 0x68b6edfcUL, 0x63b8e4f1UL, - 0xcad731dcUL, 0x10426385UL, 0x40139722UL, 0x2084c611UL, - 0x7d854a24UL, 0xf8d2bb3dUL, 0x11aef932UL, 0x6dc729a1UL, - 0x4b1d9e2fUL, 0xf3dcb230UL, 0xec0d8652UL, 0xd077c1e3UL, - 0x6c2bb316UL, 0x99a970b9UL, 0xfa119448UL, 0x2247e964UL, - 0xc4a8fc8cUL, 0x1aa0f03fUL, 0xd8567d2cUL, 0xef223390UL, - 0xc787494eUL, 0xc1d938d1UL, 0xfe8ccaa2UL, 0x3698d40bUL, - 0xcfa6f581UL, 0x28a57adeUL, 0x26dab78eUL, 0xa43fadbfUL, - 0xe42c3a9dUL, 0x0d507892UL, 0x9b6a5fccUL, 0x62547e46UL, - 0xc2f68d13UL, 0xe890d8b8UL, 0x5e2e39f7UL, 0xf582c3afUL, - 0xbe9f5d80UL, 0x7c69d093UL, 0xa96fd52dUL, 0xb3cf2512UL, - 0x3bc8ac99UL, 0xa710187dUL, 0x6ee89c63UL, 0x7bdb3bbbUL, - 0x09cd2678UL, 0xf46e5918UL, 0x01ec9ab7UL, 0xa8834f9aUL, - 0x65e6956eUL, 0x7eaaffe6UL, 0x0821bccfUL, 0xe6ef15e8UL, - 0xd9bae79bUL, 0xce4a6f36UL, 0xd4ea9f09UL, 0xd629b07cUL, - 0xaf31a4b2UL, 0x312a3f23UL, 0x30c6a594UL, 0xc035a266UL, - 0x37744ebcUL, 0xa6fc82caUL, 0xb0e090d0UL, 0x1533a7d8UL, - 0x4af10498UL, 0xf741ecdaUL, 0x0e7fcd50UL, 0x2f1791f6UL, - 0x8d764dd6UL, 0x4d43efb0UL, 0x54ccaa4dUL, 0xdfe49604UL, - 0xe39ed1b5UL, 0x1b4c6a88UL, 0xb8c12c1fUL, 0x7f466551UL, - 0x049d5eeaUL, 0x5d018c35UL, 0x73fa8774UL, 0x2efb0b41UL, - 0x5ab3671dUL, 0x5292dbd2UL, 0x33e91056UL, 0x136dd647UL, - 0x8c9ad761UL, 0x7a37a10cUL, 0x8e59f814UL, 0x89eb133cUL, - 0xeecea927UL, 0x35b761c9UL, 0xede11ce5UL, 0x3c7a47b1UL, - 0x599cd2dfUL, 0x3f55f273UL, 0x791814ceUL, 0xbf73c737UL, - 0xea53f7cdUL, 0x5b5ffdaaUL, 0x14df3d6fUL, 0x867844dbUL, - 0x81caaff3UL, 0x3eb968c4UL, 0x2c382434UL, 0x5fc2a340UL, - 0x72161dc3UL, 0x0cbce225UL, 0x8b283c49UL, 0x41ff0d95UL, - 0x7139a801UL, 0xde080cb3UL, 0x9cd8b4e4UL, 0x906456c1UL, - 0x617bcb84UL, 0x70d532b6UL, 0x74486c5cUL, 0x42d0b857UL, -}; -static const uint32_t TD2[256] = { - 0xa75051f4UL, 0x65537e41UL, 0xa4c31a17UL, 0x5e963a27UL, - 0x6bcb3babUL, 0x45f11f9dUL, 0x58abacfaUL, 0x03934be3UL, - 0xfa552030UL, 0x6df6ad76UL, 0x769188ccUL, 0x4c25f502UL, - 0xd7fc4fe5UL, 0xcbd7c52aUL, 0x44802635UL, 0xa38fb562UL, - 0x5a49deb1UL, 0x1b6725baUL, 0x0e9845eaUL, 0xc0e15dfeUL, - 0x7502c32fUL, 0xf012814cUL, 0x97a38d46UL, 0xf9c66bd3UL, - 0x5fe7038fUL, 0x9c951592UL, 0x7aebbf6dUL, 0x59da9552UL, - 0x832dd4beUL, 0x21d35874UL, 0x692949e0UL, 0xc8448ec9UL, - 0x896a75c2UL, 0x7978f48eUL, 0x3e6b9958UL, 0x71dd27b9UL, - 0x4fb6bee1UL, 0xad17f088UL, 0xac66c920UL, 0x3ab47dceUL, - 0x4a1863dfUL, 0x3182e51aUL, 0x33609751UL, 0x7f456253UL, - 0x77e0b164UL, 0xae84bb6bUL, 0xa01cfe81UL, 0x2b94f908UL, - 0x68587048UL, 0xfd198f45UL, 0x6c8794deUL, 0xf8b7527bUL, - 0xd323ab73UL, 0x02e2724bUL, 0x8f57e31fUL, 0xab2a6655UL, - 0x2807b2ebUL, 0xc2032fb5UL, 0x7b9a86c5UL, 0x08a5d337UL, - 0x87f23028UL, 0xa5b223bfUL, 0x6aba0203UL, 0x825ced16UL, - 0x1c2b8acfUL, 0xb492a779UL, 0xf2f0f307UL, 0xe2a14e69UL, - 0xf4cd65daUL, 0xbed50605UL, 0x621fd134UL, 0xfe8ac4a6UL, - 0x539d342eUL, 0x55a0a2f3UL, 0xe132058aUL, 0xeb75a4f6UL, - 0xec390b83UL, 0xefaa4060UL, 0x9f065e71UL, 0x1051bd6eUL, - 0x8af93e21UL, 0x063d96ddUL, 0x05aedd3eUL, 0xbd464de6UL, - 0x8db59154UL, 0x5d0571c4UL, 0xd46f0406UL, 0x15ff6050UL, - 0xfb241998UL, 0xe997d6bdUL, 0x43cc8940UL, 0x9e7767d9UL, - 0x42bdb0e8UL, 0x8b880789UL, 0x5b38e719UL, 0xeedb79c8UL, - 0x0a47a17cUL, 0x0fe97c42UL, 0x1ec9f884UL, 0x00000000UL, - 0x86830980UL, 0xed48322bUL, 0x70ac1e11UL, 0x724e6c5aUL, - 0xfffbfd0eUL, 0x38560f85UL, 0xd51e3daeUL, 0x3927362dUL, - 0xd9640a0fUL, 0xa621685cUL, 0x54d19b5bUL, 0x2e3a2436UL, - 0x67b10c0aUL, 0xe70f9357UL, 0x96d2b4eeUL, 0x919e1b9bUL, - 0xc54f80c0UL, 0x20a261dcUL, 0x4b695a77UL, 0x1a161c12UL, - 0xba0ae293UL, 0x2ae5c0a0UL, 0xe0433c22UL, 0x171d121bUL, - 0x0d0b0e09UL, 0xc7adf28bUL, 0xa8b92db6UL, 0xa9c8141eUL, - 0x198557f1UL, 0x074caf75UL, 0xddbbee99UL, 0x60fda37fUL, - 0x269ff701UL, 0xf5bc5c72UL, 0x3bc54466UL, 0x7e345bfbUL, - 0x29768b43UL, 0xc6dccb23UL, 0xfc68b6edUL, 0xf163b8e4UL, - 0xdccad731UL, 0x85104263UL, 0x22401397UL, 0x112084c6UL, - 0x247d854aUL, 0x3df8d2bbUL, 0x3211aef9UL, 0xa16dc729UL, - 0x2f4b1d9eUL, 0x30f3dcb2UL, 0x52ec0d86UL, 0xe3d077c1UL, - 0x166c2bb3UL, 0xb999a970UL, 0x48fa1194UL, 0x642247e9UL, - 0x8cc4a8fcUL, 0x3f1aa0f0UL, 0x2cd8567dUL, 0x90ef2233UL, - 0x4ec78749UL, 0xd1c1d938UL, 0xa2fe8ccaUL, 0x0b3698d4UL, - 0x81cfa6f5UL, 0xde28a57aUL, 0x8e26dab7UL, 0xbfa43fadUL, - 0x9de42c3aUL, 0x920d5078UL, 0xcc9b6a5fUL, 0x4662547eUL, - 0x13c2f68dUL, 0xb8e890d8UL, 0xf75e2e39UL, 0xaff582c3UL, - 0x80be9f5dUL, 0x937c69d0UL, 0x2da96fd5UL, 0x12b3cf25UL, - 0x993bc8acUL, 0x7da71018UL, 0x636ee89cUL, 0xbb7bdb3bUL, - 0x7809cd26UL, 0x18f46e59UL, 0xb701ec9aUL, 0x9aa8834fUL, - 0x6e65e695UL, 0xe67eaaffUL, 0xcf0821bcUL, 0xe8e6ef15UL, - 0x9bd9bae7UL, 0x36ce4a6fUL, 0x09d4ea9fUL, 0x7cd629b0UL, - 0xb2af31a4UL, 0x23312a3fUL, 0x9430c6a5UL, 0x66c035a2UL, - 0xbc37744eUL, 0xcaa6fc82UL, 0xd0b0e090UL, 0xd81533a7UL, - 0x984af104UL, 0xdaf741ecUL, 0x500e7fcdUL, 0xf62f1791UL, - 0xd68d764dUL, 0xb04d43efUL, 0x4d54ccaaUL, 0x04dfe496UL, - 0xb5e39ed1UL, 0x881b4c6aUL, 0x1fb8c12cUL, 0x517f4665UL, - 0xea049d5eUL, 0x355d018cUL, 0x7473fa87UL, 0x412efb0bUL, - 0x1d5ab367UL, 0xd25292dbUL, 0x5633e910UL, 0x47136dd6UL, - 0x618c9ad7UL, 0x0c7a37a1UL, 0x148e59f8UL, 0x3c89eb13UL, - 0x27eecea9UL, 0xc935b761UL, 0xe5ede11cUL, 0xb13c7a47UL, - 0xdf599cd2UL, 0x733f55f2UL, 0xce791814UL, 0x37bf73c7UL, - 0xcdea53f7UL, 0xaa5b5ffdUL, 0x6f14df3dUL, 0xdb867844UL, - 0xf381caafUL, 0xc43eb968UL, 0x342c3824UL, 0x405fc2a3UL, - 0xc372161dUL, 0x250cbce2UL, 0x498b283cUL, 0x9541ff0dUL, - 0x017139a8UL, 0xb3de080cUL, 0xe49cd8b4UL, 0xc1906456UL, - 0x84617bcbUL, 0xb670d532UL, 0x5c74486cUL, 0x5742d0b8UL, -}; -static const uint32_t TD3[256] = { - 0xf4a75051UL, 0x4165537eUL, 0x17a4c31aUL, 0x275e963aUL, - 0xab6bcb3bUL, 0x9d45f11fUL, 0xfa58abacUL, 0xe303934bUL, - 0x30fa5520UL, 0x766df6adUL, 0xcc769188UL, 0x024c25f5UL, - 0xe5d7fc4fUL, 0x2acbd7c5UL, 0x35448026UL, 0x62a38fb5UL, - 0xb15a49deUL, 0xba1b6725UL, 0xea0e9845UL, 0xfec0e15dUL, - 0x2f7502c3UL, 0x4cf01281UL, 0x4697a38dUL, 0xd3f9c66bUL, - 0x8f5fe703UL, 0x929c9515UL, 0x6d7aebbfUL, 0x5259da95UL, - 0xbe832dd4UL, 0x7421d358UL, 0xe0692949UL, 0xc9c8448eUL, - 0xc2896a75UL, 0x8e7978f4UL, 0x583e6b99UL, 0xb971dd27UL, - 0xe14fb6beUL, 0x88ad17f0UL, 0x20ac66c9UL, 0xce3ab47dUL, - 0xdf4a1863UL, 0x1a3182e5UL, 0x51336097UL, 0x537f4562UL, - 0x6477e0b1UL, 0x6bae84bbUL, 0x81a01cfeUL, 0x082b94f9UL, - 0x48685870UL, 0x45fd198fUL, 0xde6c8794UL, 0x7bf8b752UL, - 0x73d323abUL, 0x4b02e272UL, 0x1f8f57e3UL, 0x55ab2a66UL, - 0xeb2807b2UL, 0xb5c2032fUL, 0xc57b9a86UL, 0x3708a5d3UL, - 0x2887f230UL, 0xbfa5b223UL, 0x036aba02UL, 0x16825cedUL, - 0xcf1c2b8aUL, 0x79b492a7UL, 0x07f2f0f3UL, 0x69e2a14eUL, - 0xdaf4cd65UL, 0x05bed506UL, 0x34621fd1UL, 0xa6fe8ac4UL, - 0x2e539d34UL, 0xf355a0a2UL, 0x8ae13205UL, 0xf6eb75a4UL, - 0x83ec390bUL, 0x60efaa40UL, 0x719f065eUL, 0x6e1051bdUL, - 0x218af93eUL, 0xdd063d96UL, 0x3e05aeddUL, 0xe6bd464dUL, - 0x548db591UL, 0xc45d0571UL, 0x06d46f04UL, 0x5015ff60UL, - 0x98fb2419UL, 0xbde997d6UL, 0x4043cc89UL, 0xd99e7767UL, - 0xe842bdb0UL, 0x898b8807UL, 0x195b38e7UL, 0xc8eedb79UL, - 0x7c0a47a1UL, 0x420fe97cUL, 0x841ec9f8UL, 0x00000000UL, - 0x80868309UL, 0x2bed4832UL, 0x1170ac1eUL, 0x5a724e6cUL, - 0x0efffbfdUL, 0x8538560fUL, 0xaed51e3dUL, 0x2d392736UL, - 0x0fd9640aUL, 0x5ca62168UL, 0x5b54d19bUL, 0x362e3a24UL, - 0x0a67b10cUL, 0x57e70f93UL, 0xee96d2b4UL, 0x9b919e1bUL, - 0xc0c54f80UL, 0xdc20a261UL, 0x774b695aUL, 0x121a161cUL, - 0x93ba0ae2UL, 0xa02ae5c0UL, 0x22e0433cUL, 0x1b171d12UL, - 0x090d0b0eUL, 0x8bc7adf2UL, 0xb6a8b92dUL, 0x1ea9c814UL, - 0xf1198557UL, 0x75074cafUL, 0x99ddbbeeUL, 0x7f60fda3UL, - 0x01269ff7UL, 0x72f5bc5cUL, 0x663bc544UL, 0xfb7e345bUL, - 0x4329768bUL, 0x23c6dccbUL, 0xedfc68b6UL, 0xe4f163b8UL, - 0x31dccad7UL, 0x63851042UL, 0x97224013UL, 0xc6112084UL, - 0x4a247d85UL, 0xbb3df8d2UL, 0xf93211aeUL, 0x29a16dc7UL, - 0x9e2f4b1dUL, 0xb230f3dcUL, 0x8652ec0dUL, 0xc1e3d077UL, - 0xb3166c2bUL, 0x70b999a9UL, 0x9448fa11UL, 0xe9642247UL, - 0xfc8cc4a8UL, 0xf03f1aa0UL, 0x7d2cd856UL, 0x3390ef22UL, - 0x494ec787UL, 0x38d1c1d9UL, 0xcaa2fe8cUL, 0xd40b3698UL, - 0xf581cfa6UL, 0x7ade28a5UL, 0xb78e26daUL, 0xadbfa43fUL, - 0x3a9de42cUL, 0x78920d50UL, 0x5fcc9b6aUL, 0x7e466254UL, - 0x8d13c2f6UL, 0xd8b8e890UL, 0x39f75e2eUL, 0xc3aff582UL, - 0x5d80be9fUL, 0xd0937c69UL, 0xd52da96fUL, 0x2512b3cfUL, - 0xac993bc8UL, 0x187da710UL, 0x9c636ee8UL, 0x3bbb7bdbUL, - 0x267809cdUL, 0x5918f46eUL, 0x9ab701ecUL, 0x4f9aa883UL, - 0x956e65e6UL, 0xffe67eaaUL, 0xbccf0821UL, 0x15e8e6efUL, - 0xe79bd9baUL, 0x6f36ce4aUL, 0x9f09d4eaUL, 0xb07cd629UL, - 0xa4b2af31UL, 0x3f23312aUL, 0xa59430c6UL, 0xa266c035UL, - 0x4ebc3774UL, 0x82caa6fcUL, 0x90d0b0e0UL, 0xa7d81533UL, - 0x04984af1UL, 0xecdaf741UL, 0xcd500e7fUL, 0x91f62f17UL, - 0x4dd68d76UL, 0xefb04d43UL, 0xaa4d54ccUL, 0x9604dfe4UL, - 0xd1b5e39eUL, 0x6a881b4cUL, 0x2c1fb8c1UL, 0x65517f46UL, - 0x5eea049dUL, 0x8c355d01UL, 0x877473faUL, 0x0b412efbUL, - 0x671d5ab3UL, 0xdbd25292UL, 0x105633e9UL, 0xd647136dUL, - 0xd7618c9aUL, 0xa10c7a37UL, 0xf8148e59UL, 0x133c89ebUL, - 0xa927eeceUL, 0x61c935b7UL, 0x1ce5ede1UL, 0x47b13c7aUL, - 0xd2df599cUL, 0xf2733f55UL, 0x14ce7918UL, 0xc737bf73UL, - 0xf7cdea53UL, 0xfdaa5b5fUL, 0x3d6f14dfUL, 0x44db8678UL, - 0xaff381caUL, 0x68c43eb9UL, 0x24342c38UL, 0xa3405fc2UL, - 0x1dc37216UL, 0xe2250cbcUL, 0x3c498b28UL, 0x0d9541ffUL, - 0xa8017139UL, 0x0cb3de08UL, 0xb4e49cd8UL, 0x56c19064UL, - 0xcb84617bUL, 0x32b670d5UL, 0x6c5c7448UL, 0xb85742d0UL, -}; - -static const uint32_t Tks0[] = { - 0x00000000UL, 0x0e090d0bUL, 0x1c121a16UL, 0x121b171dUL, 0x3824342cUL, 0x362d3927UL, 0x24362e3aUL, 0x2a3f2331UL, - 0x70486858UL, 0x7e416553UL, 0x6c5a724eUL, 0x62537f45UL, 0x486c5c74UL, 0x4665517fUL, 0x547e4662UL, 0x5a774b69UL, - 0xe090d0b0UL, 0xee99ddbbUL, 0xfc82caa6UL, 0xf28bc7adUL, 0xd8b4e49cUL, 0xd6bde997UL, 0xc4a6fe8aUL, 0xcaaff381UL, - 0x90d8b8e8UL, 0x9ed1b5e3UL, 0x8ccaa2feUL, 0x82c3aff5UL, 0xa8fc8cc4UL, 0xa6f581cfUL, 0xb4ee96d2UL, 0xbae79bd9UL, - 0xdb3bbb7bUL, 0xd532b670UL, 0xc729a16dUL, 0xc920ac66UL, 0xe31f8f57UL, 0xed16825cUL, 0xff0d9541UL, 0xf104984aUL, - 0xab73d323UL, 0xa57ade28UL, 0xb761c935UL, 0xb968c43eUL, 0x9357e70fUL, 0x9d5eea04UL, 0x8f45fd19UL, 0x814cf012UL, - 0x3bab6bcbUL, 0x35a266c0UL, 0x27b971ddUL, 0x29b07cd6UL, 0x038f5fe7UL, 0x0d8652ecUL, 0x1f9d45f1UL, 0x119448faUL, - 0x4be30393UL, 0x45ea0e98UL, 0x57f11985UL, 0x59f8148eUL, 0x73c737bfUL, 0x7dce3ab4UL, 0x6fd52da9UL, 0x61dc20a2UL, - 0xad766df6UL, 0xa37f60fdUL, 0xb16477e0UL, 0xbf6d7aebUL, 0x955259daUL, 0x9b5b54d1UL, 0x894043ccUL, 0x87494ec7UL, - 0xdd3e05aeUL, 0xd33708a5UL, 0xc12c1fb8UL, 0xcf2512b3UL, 0xe51a3182UL, 0xeb133c89UL, 0xf9082b94UL, 0xf701269fUL, - 0x4de6bd46UL, 0x43efb04dUL, 0x51f4a750UL, 0x5ffdaa5bUL, 0x75c2896aUL, 0x7bcb8461UL, 0x69d0937cUL, 0x67d99e77UL, - 0x3daed51eUL, 0x33a7d815UL, 0x21bccf08UL, 0x2fb5c203UL, 0x058ae132UL, 0x0b83ec39UL, 0x1998fb24UL, 0x1791f62fUL, - 0x764dd68dUL, 0x7844db86UL, 0x6a5fcc9bUL, 0x6456c190UL, 0x4e69e2a1UL, 0x4060efaaUL, 0x527bf8b7UL, 0x5c72f5bcUL, - 0x0605bed5UL, 0x080cb3deUL, 0x1a17a4c3UL, 0x141ea9c8UL, 0x3e218af9UL, 0x302887f2UL, 0x223390efUL, 0x2c3a9de4UL, - 0x96dd063dUL, 0x98d40b36UL, 0x8acf1c2bUL, 0x84c61120UL, 0xaef93211UL, 0xa0f03f1aUL, 0xb2eb2807UL, 0xbce2250cUL, - 0xe6956e65UL, 0xe89c636eUL, 0xfa877473UL, 0xf48e7978UL, 0xdeb15a49UL, 0xd0b85742UL, 0xc2a3405fUL, 0xccaa4d54UL, - 0x41ecdaf7UL, 0x4fe5d7fcUL, 0x5dfec0e1UL, 0x53f7cdeaUL, 0x79c8eedbUL, 0x77c1e3d0UL, 0x65daf4cdUL, 0x6bd3f9c6UL, - 0x31a4b2afUL, 0x3fadbfa4UL, 0x2db6a8b9UL, 0x23bfa5b2UL, 0x09808683UL, 0x07898b88UL, 0x15929c95UL, 0x1b9b919eUL, - 0xa17c0a47UL, 0xaf75074cUL, 0xbd6e1051UL, 0xb3671d5aUL, 0x99583e6bUL, 0x97513360UL, 0x854a247dUL, 0x8b432976UL, - 0xd134621fUL, 0xdf3d6f14UL, 0xcd267809UL, 0xc32f7502UL, 0xe9105633UL, 0xe7195b38UL, 0xf5024c25UL, 0xfb0b412eUL, - 0x9ad7618cUL, 0x94de6c87UL, 0x86c57b9aUL, 0x88cc7691UL, 0xa2f355a0UL, 0xacfa58abUL, 0xbee14fb6UL, 0xb0e842bdUL, - 0xea9f09d4UL, 0xe49604dfUL, 0xf68d13c2UL, 0xf8841ec9UL, 0xd2bb3df8UL, 0xdcb230f3UL, 0xcea927eeUL, 0xc0a02ae5UL, - 0x7a47b13cUL, 0x744ebc37UL, 0x6655ab2aUL, 0x685ca621UL, 0x42638510UL, 0x4c6a881bUL, 0x5e719f06UL, 0x5078920dUL, - 0x0a0fd964UL, 0x0406d46fUL, 0x161dc372UL, 0x1814ce79UL, 0x322bed48UL, 0x3c22e043UL, 0x2e39f75eUL, 0x2030fa55UL, - 0xec9ab701UL, 0xe293ba0aUL, 0xf088ad17UL, 0xfe81a01cUL, 0xd4be832dUL, 0xdab78e26UL, 0xc8ac993bUL, 0xc6a59430UL, - 0x9cd2df59UL, 0x92dbd252UL, 0x80c0c54fUL, 0x8ec9c844UL, 0xa4f6eb75UL, 0xaaffe67eUL, 0xb8e4f163UL, 0xb6edfc68UL, - 0x0c0a67b1UL, 0x02036abaUL, 0x10187da7UL, 0x1e1170acUL, 0x342e539dUL, 0x3a275e96UL, 0x283c498bUL, 0x26354480UL, - 0x7c420fe9UL, 0x724b02e2UL, 0x605015ffUL, 0x6e5918f4UL, 0x44663bc5UL, 0x4a6f36ceUL, 0x587421d3UL, 0x567d2cd8UL, - 0x37a10c7aUL, 0x39a80171UL, 0x2bb3166cUL, 0x25ba1b67UL, 0x0f853856UL, 0x018c355dUL, 0x13972240UL, 0x1d9e2f4bUL, - 0x47e96422UL, 0x49e06929UL, 0x5bfb7e34UL, 0x55f2733fUL, 0x7fcd500eUL, 0x71c45d05UL, 0x63df4a18UL, 0x6dd64713UL, - 0xd731dccaUL, 0xd938d1c1UL, 0xcb23c6dcUL, 0xc52acbd7UL, 0xef15e8e6UL, 0xe11ce5edUL, 0xf307f2f0UL, 0xfd0efffbUL, - 0xa779b492UL, 0xa970b999UL, 0xbb6bae84UL, 0xb562a38fUL, 0x9f5d80beUL, 0x91548db5UL, 0x834f9aa8UL, 0x8d4697a3UL -}; - -static const uint32_t Tks1[] = { - 0x00000000UL, 0x0b0e090dUL, 0x161c121aUL, 0x1d121b17UL, 0x2c382434UL, 0x27362d39UL, 0x3a24362eUL, 0x312a3f23UL, - 0x58704868UL, 0x537e4165UL, 0x4e6c5a72UL, 0x4562537fUL, 0x74486c5cUL, 0x7f466551UL, 0x62547e46UL, 0x695a774bUL, - 0xb0e090d0UL, 0xbbee99ddUL, 0xa6fc82caUL, 0xadf28bc7UL, 0x9cd8b4e4UL, 0x97d6bde9UL, 0x8ac4a6feUL, 0x81caaff3UL, - 0xe890d8b8UL, 0xe39ed1b5UL, 0xfe8ccaa2UL, 0xf582c3afUL, 0xc4a8fc8cUL, 0xcfa6f581UL, 0xd2b4ee96UL, 0xd9bae79bUL, - 0x7bdb3bbbUL, 0x70d532b6UL, 0x6dc729a1UL, 0x66c920acUL, 0x57e31f8fUL, 0x5ced1682UL, 0x41ff0d95UL, 0x4af10498UL, - 0x23ab73d3UL, 0x28a57adeUL, 0x35b761c9UL, 0x3eb968c4UL, 0x0f9357e7UL, 0x049d5eeaUL, 0x198f45fdUL, 0x12814cf0UL, - 0xcb3bab6bUL, 0xc035a266UL, 0xdd27b971UL, 0xd629b07cUL, 0xe7038f5fUL, 0xec0d8652UL, 0xf11f9d45UL, 0xfa119448UL, - 0x934be303UL, 0x9845ea0eUL, 0x8557f119UL, 0x8e59f814UL, 0xbf73c737UL, 0xb47dce3aUL, 0xa96fd52dUL, 0xa261dc20UL, - 0xf6ad766dUL, 0xfda37f60UL, 0xe0b16477UL, 0xebbf6d7aUL, 0xda955259UL, 0xd19b5b54UL, 0xcc894043UL, 0xc787494eUL, - 0xaedd3e05UL, 0xa5d33708UL, 0xb8c12c1fUL, 0xb3cf2512UL, 0x82e51a31UL, 0x89eb133cUL, 0x94f9082bUL, 0x9ff70126UL, - 0x464de6bdUL, 0x4d43efb0UL, 0x5051f4a7UL, 0x5b5ffdaaUL, 0x6a75c289UL, 0x617bcb84UL, 0x7c69d093UL, 0x7767d99eUL, - 0x1e3daed5UL, 0x1533a7d8UL, 0x0821bccfUL, 0x032fb5c2UL, 0x32058ae1UL, 0x390b83ecUL, 0x241998fbUL, 0x2f1791f6UL, - 0x8d764dd6UL, 0x867844dbUL, 0x9b6a5fccUL, 0x906456c1UL, 0xa14e69e2UL, 0xaa4060efUL, 0xb7527bf8UL, 0xbc5c72f5UL, - 0xd50605beUL, 0xde080cb3UL, 0xc31a17a4UL, 0xc8141ea9UL, 0xf93e218aUL, 0xf2302887UL, 0xef223390UL, 0xe42c3a9dUL, - 0x3d96dd06UL, 0x3698d40bUL, 0x2b8acf1cUL, 0x2084c611UL, 0x11aef932UL, 0x1aa0f03fUL, 0x07b2eb28UL, 0x0cbce225UL, - 0x65e6956eUL, 0x6ee89c63UL, 0x73fa8774UL, 0x78f48e79UL, 0x49deb15aUL, 0x42d0b857UL, 0x5fc2a340UL, 0x54ccaa4dUL, - 0xf741ecdaUL, 0xfc4fe5d7UL, 0xe15dfec0UL, 0xea53f7cdUL, 0xdb79c8eeUL, 0xd077c1e3UL, 0xcd65daf4UL, 0xc66bd3f9UL, - 0xaf31a4b2UL, 0xa43fadbfUL, 0xb92db6a8UL, 0xb223bfa5UL, 0x83098086UL, 0x8807898bUL, 0x9515929cUL, 0x9e1b9b91UL, - 0x47a17c0aUL, 0x4caf7507UL, 0x51bd6e10UL, 0x5ab3671dUL, 0x6b99583eUL, 0x60975133UL, 0x7d854a24UL, 0x768b4329UL, - 0x1fd13462UL, 0x14df3d6fUL, 0x09cd2678UL, 0x02c32f75UL, 0x33e91056UL, 0x38e7195bUL, 0x25f5024cUL, 0x2efb0b41UL, - 0x8c9ad761UL, 0x8794de6cUL, 0x9a86c57bUL, 0x9188cc76UL, 0xa0a2f355UL, 0xabacfa58UL, 0xb6bee14fUL, 0xbdb0e842UL, - 0xd4ea9f09UL, 0xdfe49604UL, 0xc2f68d13UL, 0xc9f8841eUL, 0xf8d2bb3dUL, 0xf3dcb230UL, 0xeecea927UL, 0xe5c0a02aUL, - 0x3c7a47b1UL, 0x37744ebcUL, 0x2a6655abUL, 0x21685ca6UL, 0x10426385UL, 0x1b4c6a88UL, 0x065e719fUL, 0x0d507892UL, - 0x640a0fd9UL, 0x6f0406d4UL, 0x72161dc3UL, 0x791814ceUL, 0x48322bedUL, 0x433c22e0UL, 0x5e2e39f7UL, 0x552030faUL, - 0x01ec9ab7UL, 0x0ae293baUL, 0x17f088adUL, 0x1cfe81a0UL, 0x2dd4be83UL, 0x26dab78eUL, 0x3bc8ac99UL, 0x30c6a594UL, - 0x599cd2dfUL, 0x5292dbd2UL, 0x4f80c0c5UL, 0x448ec9c8UL, 0x75a4f6ebUL, 0x7eaaffe6UL, 0x63b8e4f1UL, 0x68b6edfcUL, - 0xb10c0a67UL, 0xba02036aUL, 0xa710187dUL, 0xac1e1170UL, 0x9d342e53UL, 0x963a275eUL, 0x8b283c49UL, 0x80263544UL, - 0xe97c420fUL, 0xe2724b02UL, 0xff605015UL, 0xf46e5918UL, 0xc544663bUL, 0xce4a6f36UL, 0xd3587421UL, 0xd8567d2cUL, - 0x7a37a10cUL, 0x7139a801UL, 0x6c2bb316UL, 0x6725ba1bUL, 0x560f8538UL, 0x5d018c35UL, 0x40139722UL, 0x4b1d9e2fUL, - 0x2247e964UL, 0x2949e069UL, 0x345bfb7eUL, 0x3f55f273UL, 0x0e7fcd50UL, 0x0571c45dUL, 0x1863df4aUL, 0x136dd647UL, - 0xcad731dcUL, 0xc1d938d1UL, 0xdccb23c6UL, 0xd7c52acbUL, 0xe6ef15e8UL, 0xede11ce5UL, 0xf0f307f2UL, 0xfbfd0effUL, - 0x92a779b4UL, 0x99a970b9UL, 0x84bb6baeUL, 0x8fb562a3UL, 0xbe9f5d80UL, 0xb591548dUL, 0xa8834f9aUL, 0xa38d4697UL -}; - -static const uint32_t Tks2[] = { - 0x00000000UL, 0x0d0b0e09UL, 0x1a161c12UL, 0x171d121bUL, 0x342c3824UL, 0x3927362dUL, 0x2e3a2436UL, 0x23312a3fUL, - 0x68587048UL, 0x65537e41UL, 0x724e6c5aUL, 0x7f456253UL, 0x5c74486cUL, 0x517f4665UL, 0x4662547eUL, 0x4b695a77UL, - 0xd0b0e090UL, 0xddbbee99UL, 0xcaa6fc82UL, 0xc7adf28bUL, 0xe49cd8b4UL, 0xe997d6bdUL, 0xfe8ac4a6UL, 0xf381caafUL, - 0xb8e890d8UL, 0xb5e39ed1UL, 0xa2fe8ccaUL, 0xaff582c3UL, 0x8cc4a8fcUL, 0x81cfa6f5UL, 0x96d2b4eeUL, 0x9bd9bae7UL, - 0xbb7bdb3bUL, 0xb670d532UL, 0xa16dc729UL, 0xac66c920UL, 0x8f57e31fUL, 0x825ced16UL, 0x9541ff0dUL, 0x984af104UL, - 0xd323ab73UL, 0xde28a57aUL, 0xc935b761UL, 0xc43eb968UL, 0xe70f9357UL, 0xea049d5eUL, 0xfd198f45UL, 0xf012814cUL, - 0x6bcb3babUL, 0x66c035a2UL, 0x71dd27b9UL, 0x7cd629b0UL, 0x5fe7038fUL, 0x52ec0d86UL, 0x45f11f9dUL, 0x48fa1194UL, - 0x03934be3UL, 0x0e9845eaUL, 0x198557f1UL, 0x148e59f8UL, 0x37bf73c7UL, 0x3ab47dceUL, 0x2da96fd5UL, 0x20a261dcUL, - 0x6df6ad76UL, 0x60fda37fUL, 0x77e0b164UL, 0x7aebbf6dUL, 0x59da9552UL, 0x54d19b5bUL, 0x43cc8940UL, 0x4ec78749UL, - 0x05aedd3eUL, 0x08a5d337UL, 0x1fb8c12cUL, 0x12b3cf25UL, 0x3182e51aUL, 0x3c89eb13UL, 0x2b94f908UL, 0x269ff701UL, - 0xbd464de6UL, 0xb04d43efUL, 0xa75051f4UL, 0xaa5b5ffdUL, 0x896a75c2UL, 0x84617bcbUL, 0x937c69d0UL, 0x9e7767d9UL, - 0xd51e3daeUL, 0xd81533a7UL, 0xcf0821bcUL, 0xc2032fb5UL, 0xe132058aUL, 0xec390b83UL, 0xfb241998UL, 0xf62f1791UL, - 0xd68d764dUL, 0xdb867844UL, 0xcc9b6a5fUL, 0xc1906456UL, 0xe2a14e69UL, 0xefaa4060UL, 0xf8b7527bUL, 0xf5bc5c72UL, - 0xbed50605UL, 0xb3de080cUL, 0xa4c31a17UL, 0xa9c8141eUL, 0x8af93e21UL, 0x87f23028UL, 0x90ef2233UL, 0x9de42c3aUL, - 0x063d96ddUL, 0x0b3698d4UL, 0x1c2b8acfUL, 0x112084c6UL, 0x3211aef9UL, 0x3f1aa0f0UL, 0x2807b2ebUL, 0x250cbce2UL, - 0x6e65e695UL, 0x636ee89cUL, 0x7473fa87UL, 0x7978f48eUL, 0x5a49deb1UL, 0x5742d0b8UL, 0x405fc2a3UL, 0x4d54ccaaUL, - 0xdaf741ecUL, 0xd7fc4fe5UL, 0xc0e15dfeUL, 0xcdea53f7UL, 0xeedb79c8UL, 0xe3d077c1UL, 0xf4cd65daUL, 0xf9c66bd3UL, - 0xb2af31a4UL, 0xbfa43fadUL, 0xa8b92db6UL, 0xa5b223bfUL, 0x86830980UL, 0x8b880789UL, 0x9c951592UL, 0x919e1b9bUL, - 0x0a47a17cUL, 0x074caf75UL, 0x1051bd6eUL, 0x1d5ab367UL, 0x3e6b9958UL, 0x33609751UL, 0x247d854aUL, 0x29768b43UL, - 0x621fd134UL, 0x6f14df3dUL, 0x7809cd26UL, 0x7502c32fUL, 0x5633e910UL, 0x5b38e719UL, 0x4c25f502UL, 0x412efb0bUL, - 0x618c9ad7UL, 0x6c8794deUL, 0x7b9a86c5UL, 0x769188ccUL, 0x55a0a2f3UL, 0x58abacfaUL, 0x4fb6bee1UL, 0x42bdb0e8UL, - 0x09d4ea9fUL, 0x04dfe496UL, 0x13c2f68dUL, 0x1ec9f884UL, 0x3df8d2bbUL, 0x30f3dcb2UL, 0x27eecea9UL, 0x2ae5c0a0UL, - 0xb13c7a47UL, 0xbc37744eUL, 0xab2a6655UL, 0xa621685cUL, 0x85104263UL, 0x881b4c6aUL, 0x9f065e71UL, 0x920d5078UL, - 0xd9640a0fUL, 0xd46f0406UL, 0xc372161dUL, 0xce791814UL, 0xed48322bUL, 0xe0433c22UL, 0xf75e2e39UL, 0xfa552030UL, - 0xb701ec9aUL, 0xba0ae293UL, 0xad17f088UL, 0xa01cfe81UL, 0x832dd4beUL, 0x8e26dab7UL, 0x993bc8acUL, 0x9430c6a5UL, - 0xdf599cd2UL, 0xd25292dbUL, 0xc54f80c0UL, 0xc8448ec9UL, 0xeb75a4f6UL, 0xe67eaaffUL, 0xf163b8e4UL, 0xfc68b6edUL, - 0x67b10c0aUL, 0x6aba0203UL, 0x7da71018UL, 0x70ac1e11UL, 0x539d342eUL, 0x5e963a27UL, 0x498b283cUL, 0x44802635UL, - 0x0fe97c42UL, 0x02e2724bUL, 0x15ff6050UL, 0x18f46e59UL, 0x3bc54466UL, 0x36ce4a6fUL, 0x21d35874UL, 0x2cd8567dUL, - 0x0c7a37a1UL, 0x017139a8UL, 0x166c2bb3UL, 0x1b6725baUL, 0x38560f85UL, 0x355d018cUL, 0x22401397UL, 0x2f4b1d9eUL, - 0x642247e9UL, 0x692949e0UL, 0x7e345bfbUL, 0x733f55f2UL, 0x500e7fcdUL, 0x5d0571c4UL, 0x4a1863dfUL, 0x47136dd6UL, - 0xdccad731UL, 0xd1c1d938UL, 0xc6dccb23UL, 0xcbd7c52aUL, 0xe8e6ef15UL, 0xe5ede11cUL, 0xf2f0f307UL, 0xfffbfd0eUL, - 0xb492a779UL, 0xb999a970UL, 0xae84bb6bUL, 0xa38fb562UL, 0x80be9f5dUL, 0x8db59154UL, 0x9aa8834fUL, 0x97a38d46UL -}; - -static const uint32_t Tks3[] = { - 0x00000000UL, 0x090d0b0eUL, 0x121a161cUL, 0x1b171d12UL, 0x24342c38UL, 0x2d392736UL, 0x362e3a24UL, 0x3f23312aUL, - 0x48685870UL, 0x4165537eUL, 0x5a724e6cUL, 0x537f4562UL, 0x6c5c7448UL, 0x65517f46UL, 0x7e466254UL, 0x774b695aUL, - 0x90d0b0e0UL, 0x99ddbbeeUL, 0x82caa6fcUL, 0x8bc7adf2UL, 0xb4e49cd8UL, 0xbde997d6UL, 0xa6fe8ac4UL, 0xaff381caUL, - 0xd8b8e890UL, 0xd1b5e39eUL, 0xcaa2fe8cUL, 0xc3aff582UL, 0xfc8cc4a8UL, 0xf581cfa6UL, 0xee96d2b4UL, 0xe79bd9baUL, - 0x3bbb7bdbUL, 0x32b670d5UL, 0x29a16dc7UL, 0x20ac66c9UL, 0x1f8f57e3UL, 0x16825cedUL, 0x0d9541ffUL, 0x04984af1UL, - 0x73d323abUL, 0x7ade28a5UL, 0x61c935b7UL, 0x68c43eb9UL, 0x57e70f93UL, 0x5eea049dUL, 0x45fd198fUL, 0x4cf01281UL, - 0xab6bcb3bUL, 0xa266c035UL, 0xb971dd27UL, 0xb07cd629UL, 0x8f5fe703UL, 0x8652ec0dUL, 0x9d45f11fUL, 0x9448fa11UL, - 0xe303934bUL, 0xea0e9845UL, 0xf1198557UL, 0xf8148e59UL, 0xc737bf73UL, 0xce3ab47dUL, 0xd52da96fUL, 0xdc20a261UL, - 0x766df6adUL, 0x7f60fda3UL, 0x6477e0b1UL, 0x6d7aebbfUL, 0x5259da95UL, 0x5b54d19bUL, 0x4043cc89UL, 0x494ec787UL, - 0x3e05aeddUL, 0x3708a5d3UL, 0x2c1fb8c1UL, 0x2512b3cfUL, 0x1a3182e5UL, 0x133c89ebUL, 0x082b94f9UL, 0x01269ff7UL, - 0xe6bd464dUL, 0xefb04d43UL, 0xf4a75051UL, 0xfdaa5b5fUL, 0xc2896a75UL, 0xcb84617bUL, 0xd0937c69UL, 0xd99e7767UL, - 0xaed51e3dUL, 0xa7d81533UL, 0xbccf0821UL, 0xb5c2032fUL, 0x8ae13205UL, 0x83ec390bUL, 0x98fb2419UL, 0x91f62f17UL, - 0x4dd68d76UL, 0x44db8678UL, 0x5fcc9b6aUL, 0x56c19064UL, 0x69e2a14eUL, 0x60efaa40UL, 0x7bf8b752UL, 0x72f5bc5cUL, - 0x05bed506UL, 0x0cb3de08UL, 0x17a4c31aUL, 0x1ea9c814UL, 0x218af93eUL, 0x2887f230UL, 0x3390ef22UL, 0x3a9de42cUL, - 0xdd063d96UL, 0xd40b3698UL, 0xcf1c2b8aUL, 0xc6112084UL, 0xf93211aeUL, 0xf03f1aa0UL, 0xeb2807b2UL, 0xe2250cbcUL, - 0x956e65e6UL, 0x9c636ee8UL, 0x877473faUL, 0x8e7978f4UL, 0xb15a49deUL, 0xb85742d0UL, 0xa3405fc2UL, 0xaa4d54ccUL, - 0xecdaf741UL, 0xe5d7fc4fUL, 0xfec0e15dUL, 0xf7cdea53UL, 0xc8eedb79UL, 0xc1e3d077UL, 0xdaf4cd65UL, 0xd3f9c66bUL, - 0xa4b2af31UL, 0xadbfa43fUL, 0xb6a8b92dUL, 0xbfa5b223UL, 0x80868309UL, 0x898b8807UL, 0x929c9515UL, 0x9b919e1bUL, - 0x7c0a47a1UL, 0x75074cafUL, 0x6e1051bdUL, 0x671d5ab3UL, 0x583e6b99UL, 0x51336097UL, 0x4a247d85UL, 0x4329768bUL, - 0x34621fd1UL, 0x3d6f14dfUL, 0x267809cdUL, 0x2f7502c3UL, 0x105633e9UL, 0x195b38e7UL, 0x024c25f5UL, 0x0b412efbUL, - 0xd7618c9aUL, 0xde6c8794UL, 0xc57b9a86UL, 0xcc769188UL, 0xf355a0a2UL, 0xfa58abacUL, 0xe14fb6beUL, 0xe842bdb0UL, - 0x9f09d4eaUL, 0x9604dfe4UL, 0x8d13c2f6UL, 0x841ec9f8UL, 0xbb3df8d2UL, 0xb230f3dcUL, 0xa927eeceUL, 0xa02ae5c0UL, - 0x47b13c7aUL, 0x4ebc3774UL, 0x55ab2a66UL, 0x5ca62168UL, 0x63851042UL, 0x6a881b4cUL, 0x719f065eUL, 0x78920d50UL, - 0x0fd9640aUL, 0x06d46f04UL, 0x1dc37216UL, 0x14ce7918UL, 0x2bed4832UL, 0x22e0433cUL, 0x39f75e2eUL, 0x30fa5520UL, - 0x9ab701ecUL, 0x93ba0ae2UL, 0x88ad17f0UL, 0x81a01cfeUL, 0xbe832dd4UL, 0xb78e26daUL, 0xac993bc8UL, 0xa59430c6UL, - 0xd2df599cUL, 0xdbd25292UL, 0xc0c54f80UL, 0xc9c8448eUL, 0xf6eb75a4UL, 0xffe67eaaUL, 0xe4f163b8UL, 0xedfc68b6UL, - 0x0a67b10cUL, 0x036aba02UL, 0x187da710UL, 0x1170ac1eUL, 0x2e539d34UL, 0x275e963aUL, 0x3c498b28UL, 0x35448026UL, - 0x420fe97cUL, 0x4b02e272UL, 0x5015ff60UL, 0x5918f46eUL, 0x663bc544UL, 0x6f36ce4aUL, 0x7421d358UL, 0x7d2cd856UL, - 0xa10c7a37UL, 0xa8017139UL, 0xb3166c2bUL, 0xba1b6725UL, 0x8538560fUL, 0x8c355d01UL, 0x97224013UL, 0x9e2f4b1dUL, - 0xe9642247UL, 0xe0692949UL, 0xfb7e345bUL, 0xf2733f55UL, 0xcd500e7fUL, 0xc45d0571UL, 0xdf4a1863UL, 0xd647136dUL, - 0x31dccad7UL, 0x38d1c1d9UL, 0x23c6dccbUL, 0x2acbd7c5UL, 0x15e8e6efUL, 0x1ce5ede1UL, 0x07f2f0f3UL, 0x0efffbfdUL, - 0x79b492a7UL, 0x70b999a9UL, 0x6bae84bbUL, 0x62a38fb5UL, 0x5d80be9fUL, 0x548db591UL, 0x4f9aa883UL, 0x4697a38dUL -}; - -#endif /* ENCRYPT_ONLY */ - -#endif /* SMALL CODE */ - -static const uint32_t rcon[] = { - 0x01000000UL, 0x02000000UL, 0x04000000UL, 0x08000000UL, - 0x10000000UL, 0x20000000UL, 0x40000000UL, 0x80000000UL, - 0x1B000000UL, 0x36000000UL, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ -}; - -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/aes/aes_tab.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:23 $ */ DELETED Source/libtomcrypt/src/ciphers/ltc_aes/ltc_aes.h Index: Source/libtomcrypt/src/ciphers/ltc_aes/ltc_aes.h ================================================================== --- Source/libtomcrypt/src/ciphers/ltc_aes/ltc_aes.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * ltc_aes.h - * MacTomCrypt - * - * InfoSec Standard Configuration - * Copyright 2010 Apple Inc. All rights reserved. - * - */ - -#ifndef _LTC_AES_H_ -#define _LTC_AES_H_ - -#include -#include - -#if defined(__cplusplus) -extern "C" -{ -#endif - -typedef struct ltc_rijndael_key { - uint32_t eK[60], dK[60]; - int Nr; -} ltc_rijndael_keysched; - -/* make aes an alias */ -#define ltc_aes_setup ltc_rijndael_setup -#define ltc_aes_ecb_encrypt ltc_rijndael_ecb_encrypt -#define ltc_aes_ecb_decrypt ltc_rijndael_ecb_decrypt -#define ltc_aes_test ltc_rijndael_test -#define ltc_aes_done ltc_rijndael_done -#define ltc_aes_keysize ltc_rijndael_keysize - -#define ltc_aes_enc_setup ltc_rijndael_enc_setup -#define ltc_aes_enc_ecb_encrypt ltc_rijndael_enc_ecb_encrypt -#define ltc_aes_enc_keysize ltc_rijndael_enc_keysize - -int ltc_rijndael_setup(const unsigned char *key, int keylen, int num_rounds, - ltc_rijndael_keysched *skey); -int ltc_rijndael_ecb_encrypt(const unsigned char *pt, unsigned char *ct, - ltc_rijndael_keysched *skey); -int ltc_rijndael_ecb_decrypt(const unsigned char *ct, unsigned char *pt, - ltc_rijndael_keysched *skey); -int ltc_rijndael_test(void); -void ltc_rijndael_done(ltc_rijndael_keysched *skey); -int ltc_rijndael_keysize(int *keysize); -int ltc_rijndael_enc_setup(const unsigned char *key, int keylen, int num_rounds, - ltc_rijndael_keysched *skey); -int ltc_rijndael_enc_ecb_encrypt(const unsigned char *pt, unsigned char *ct, - ltc_rijndael_keysched *skey); -void ltc_rijndael_enc_done(ltc_rijndael_keysched *skey); -int ltc_rijndael_enc_keysize(int *keysize); -extern const struct ltc_cipher_descriptor ltc_rijndael_desc, ltc_aes_desc; -extern const struct ltc_cipher_descriptor ltc_rijndael_enc_desc, - ltc_aes_enc_desc; - -#if defined(__cplusplus) -} -#endif - -#endif /* _LTC_AES_H_ */ DELETED Source/libtomcrypt/src/ciphers/rc2.c Index: Source/libtomcrypt/src/ciphers/rc2.c ================================================================== --- Source/libtomcrypt/src/ciphers/rc2.c +++ /dev/null @@ -1,381 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -/**********************************************************************\ -* To commemorate the 1996 RSA Data Security Conference, the following * -* code is released into the public domain by its author. Prost! * -* * -* This cipher uses 16-bit words and little-endian byte ordering. * -* I wonder which processor it was optimized for? * -* * -* Thanks to CodeView, SoftIce, and D86 for helping bring this code to * -* the public. * -\**********************************************************************/ -#include - -/** - @file rc2.c - Implementation of LTC_RC2 -*/ - -#ifdef LTC_RC2 - -const struct ltc_cipher_descriptor rc2_desc = { - "rc2", - 12, 8, 128, 8, 16, - &rc2_setup, - &rc2_ecb_encrypt, - &rc2_ecb_decrypt, - &rc2_test, - &rc2_done, - &rc2_keysize, - /* ECB Accelerators */ - NULL, NULL, - /* CBC Accelerators */ - NULL, NULL, - /* CTR Accelerators */ - NULL, - /* LRW Accelerators */ - NULL, NULL, - /* XTS Accelerators */ - NULL, NULL, - /* CCM Accelerator */ - NULL, - /* GCM Accelerator */ - NULL, - /* OMAC Accelerator */ - NULL, - /* XCBC Accelerator */ - NULL, - /* F9 Accelerator */ - NULL -}; - -/* 256-entry permutation table, probably derived somehow from pi */ -static const unsigned char permute[256] = { - 217,120,249,196, 25,221,181,237, 40,233,253,121, 74,160,216,157, - 198,126, 55,131, 43,118, 83,142, 98, 76,100,136, 68,139,251,162, - 23,154, 89,245,135,179, 79, 19, 97, 69,109,141, 9,129,125, 50, - 189,143, 64,235,134,183,123, 11,240,149, 33, 34, 92,107, 78,130, - 84,214,101,147,206, 96,178, 28,115, 86,192, 20,167,140,241,220, - 18,117,202, 31, 59,190,228,209, 66, 61,212, 48,163, 60,182, 38, - 111,191, 14,218, 70,105, 7, 87, 39,242, 29,155,188,148, 67, 3, - 248, 17,199,246,144,239, 62,231, 6,195,213, 47,200,102, 30,215, - 8,232,234,222,128, 82,238,247,132,170,114,172, 53, 77,106, 42, - 150, 26,210,113, 90, 21, 73,116, 75,159,208, 94, 4, 24,164,236, - 194,224, 65,110, 15, 81,203,204, 36,145,175, 80,161,244,112, 57, - 153,124, 58,133, 35,184,180,122,252, 2, 54, 91, 37, 85,151, 49, - 45, 93,250,152,227,138,146,174, 5,223, 41, 16,103,108,186,201, - 211, 0,230,207,225,158,168, 44, 99, 22, 1, 63, 88,226,137,169, - 13, 56, 52, 27,171, 51,255,176,187, 72, 12, 95,185,177,205, 46, - 197,243,219, 71,229,165,156,119, 10,166, 32,104,254,127,193,173 -}; - - /** - Initialize the LTC_RC2 block cipher - @param key The symmetric key you wish to pass - @param keylen The key length in bytes - @param num_rounds The number of rounds desired (0 for default) - @param skey The key in as scheduled by this function. - @return CRYPT_OK if successful - */ -int rc2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -{ - unsigned *xkey = skey->rc2.xkey; - unsigned char tmp[128]; - unsigned T8, TM; - int i, bits; - - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(skey != NULL); - - if (keylen < 8 || keylen > 128) { - return CRYPT_INVALID_KEYSIZE; - } - - if (num_rounds != 0 && num_rounds != 16) { - return CRYPT_INVALID_ROUNDS; - } - - for (i = 0; i < keylen; i++) { - tmp[i] = key[i] & 255; - } - - /* Phase 1: Expand input key to 128 bytes */ - if (keylen < 128) { - for (i = keylen; i < 128; i++) { - tmp[i] = permute[(tmp[i - 1] + tmp[i - keylen]) & 255]; - } - } - - /* Phase 2 - reduce effective key size to "bits" */ - bits = keylen<<3; - T8 = (unsigned)(bits+7)>>3; - TM = (255 >> (unsigned)(7 & -bits)); - tmp[128 - T8] = permute[tmp[128 - T8] & TM]; - for (i = 127 - T8; i >= 0; i--) { - tmp[i] = permute[tmp[i + 1] ^ tmp[i + T8]]; - } - - /* Phase 3 - copy to xkey in little-endian order */ - for (i = 0; i < 64; i++) { - xkey[i] = (unsigned)tmp[2*i] + ((unsigned)tmp[2*i+1] << 8); - } - -#ifdef LTC_CLEAN_STACK - zeromem(tmp, sizeof(tmp)); -#endif - - return CRYPT_OK; -} - -/**********************************************************************\ -* Encrypt an 8-byte block of plaintext using the given key. * -\**********************************************************************/ -/** - Encrypts a block of text with LTC_RC2 - @param pt The input plaintext (8 bytes) - @param ct The output ciphertext (8 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful -*/ -#ifdef LTC_CLEAN_STACK -static int _rc2_ecb_encrypt( const unsigned char *pt, - unsigned char *ct, - symmetric_key *skey) -#else -int rc2_ecb_encrypt( const unsigned char *pt, - unsigned char *ct, - symmetric_key *skey) -#endif -{ - unsigned *xkey; - unsigned x76, x54, x32, x10, i; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - - xkey = skey->rc2.xkey; - - x76 = ((unsigned)pt[7] << 8) + (unsigned)pt[6]; - x54 = ((unsigned)pt[5] << 8) + (unsigned)pt[4]; - x32 = ((unsigned)pt[3] << 8) + (unsigned)pt[2]; - x10 = ((unsigned)pt[1] << 8) + (unsigned)pt[0]; - - for (i = 0; i < 16; i++) { - x10 = (x10 + (x32 & ~x76) + (x54 & x76) + xkey[4*i+0]) & 0xFFFF; - x10 = ((x10 << 1) | (x10 >> 15)); - - x32 = (x32 + (x54 & ~x10) + (x76 & x10) + xkey[4*i+1]) & 0xFFFF; - x32 = ((x32 << 2) | (x32 >> 14)); - - x54 = (x54 + (x76 & ~x32) + (x10 & x32) + xkey[4*i+2]) & 0xFFFF; - x54 = ((x54 << 3) | (x54 >> 13)); - - x76 = (x76 + (x10 & ~x54) + (x32 & x54) + xkey[4*i+3]) & 0xFFFF; - x76 = ((x76 << 5) | (x76 >> 11)); - - if (i == 4 || i == 10) { - x10 = (x10 + xkey[x76 & 63]) & 0xFFFF; - x32 = (x32 + xkey[x10 & 63]) & 0xFFFF; - x54 = (x54 + xkey[x32 & 63]) & 0xFFFF; - x76 = (x76 + xkey[x54 & 63]) & 0xFFFF; - } - } - - ct[0] = (unsigned char)x10; - ct[1] = (unsigned char)(x10 >> 8); - ct[2] = (unsigned char)x32; - ct[3] = (unsigned char)(x32 >> 8); - ct[4] = (unsigned char)x54; - ct[5] = (unsigned char)(x54 >> 8); - ct[6] = (unsigned char)x76; - ct[7] = (unsigned char)(x76 >> 8); - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -int rc2_ecb_encrypt( const unsigned char *pt, - unsigned char *ct, - symmetric_key *skey) -{ - int err = _rc2_ecb_encrypt(pt, ct, skey); - burn_stack(sizeof(unsigned *) + sizeof(unsigned) * 5); - return err; -} -#endif - -/**********************************************************************\ -* Decrypt an 8-byte block of ciphertext using the given key. * -\**********************************************************************/ -/** - Decrypts a block of text with LTC_RC2 - @param ct The input ciphertext (8 bytes) - @param pt The output plaintext (8 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful -*/ -#ifdef LTC_CLEAN_STACK -static int _rc2_ecb_decrypt( const unsigned char *ct, - unsigned char *pt, - symmetric_key *skey) -#else -int rc2_ecb_decrypt( const unsigned char *ct, - unsigned char *pt, - symmetric_key *skey) -#endif -{ - unsigned x76, x54, x32, x10; - unsigned *xkey; - int i; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - - xkey = skey->rc2.xkey; - - x76 = ((unsigned)ct[7] << 8) + (unsigned)ct[6]; - x54 = ((unsigned)ct[5] << 8) + (unsigned)ct[4]; - x32 = ((unsigned)ct[3] << 8) + (unsigned)ct[2]; - x10 = ((unsigned)ct[1] << 8) + (unsigned)ct[0]; - - for (i = 15; i >= 0; i--) { - if (i == 4 || i == 10) { - x76 = (x76 - xkey[x54 & 63]) & 0xFFFF; - x54 = (x54 - xkey[x32 & 63]) & 0xFFFF; - x32 = (x32 - xkey[x10 & 63]) & 0xFFFF; - x10 = (x10 - xkey[x76 & 63]) & 0xFFFF; - } - - x76 = ((x76 << 11) | (x76 >> 5)); - x76 = (x76 - ((x10 & ~x54) + (x32 & x54) + xkey[4*i+3])) & 0xFFFF; - - x54 = ((x54 << 13) | (x54 >> 3)); - x54 = (x54 - ((x76 & ~x32) + (x10 & x32) + xkey[4*i+2])) & 0xFFFF; - - x32 = ((x32 << 14) | (x32 >> 2)); - x32 = (x32 - ((x54 & ~x10) + (x76 & x10) + xkey[4*i+1])) & 0xFFFF; - - x10 = ((x10 << 15) | (x10 >> 1)); - x10 = (x10 - ((x32 & ~x76) + (x54 & x76) + xkey[4*i+0])) & 0xFFFF; - } - - pt[0] = (unsigned char)x10; - pt[1] = (unsigned char)(x10 >> 8); - pt[2] = (unsigned char)x32; - pt[3] = (unsigned char)(x32 >> 8); - pt[4] = (unsigned char)x54; - pt[5] = (unsigned char)(x54 >> 8); - pt[6] = (unsigned char)x76; - pt[7] = (unsigned char)(x76 >> 8); - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -int rc2_ecb_decrypt( const unsigned char *ct, - unsigned char *pt, - symmetric_key *skey) -{ - int err = _rc2_ecb_decrypt(ct, pt, skey); - burn_stack(sizeof(unsigned *) + sizeof(unsigned) * 4 + sizeof(int)); - return err; -} -#endif - -/** - Performs a self-test of the LTC_RC2 block cipher - @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled -*/ -int rc2_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - static const struct { - int keylen; - unsigned char key[16], pt[8], ct[8]; - } tests[] = { - - { 8, - { 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, - { 0x30, 0x64, 0x9e, 0xdf, 0x9b, 0xe7, 0xd2, 0xc2 } - - }, - { 16, - { 0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a, 0x7f, - 0x0f, 0x79, 0xc3, 0x84, 0x62, 0x7b, 0xaf, 0xb2 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x22, 0x69, 0x55, 0x2a, 0xb0, 0xf8, 0x5c, 0xa6 } - } - }; - int x, y, err; - symmetric_key skey; - unsigned char tmp[2][8]; - - for (x = 0; x < (int)(sizeof(tests) / sizeof(tests[0])); x++) { - zeromem(tmp, sizeof(tmp)); - if ((err = rc2_setup(tests[x].key, tests[x].keylen, 0, &skey)) != CRYPT_OK) { - return err; - } - - rc2_ecb_encrypt(tests[x].pt, tmp[0], &skey); - rc2_ecb_decrypt(tmp[0], tmp[1], &skey); - - if (XMEMCMP(tmp[0], tests[x].ct, 8) != 0 || XMEMCMP(tmp[1], tests[x].pt, 8) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - - /* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */ - for (y = 0; y < 8; y++) tmp[0][y] = 0; - for (y = 0; y < 1000; y++) rc2_ecb_encrypt(tmp[0], tmp[0], &skey); - for (y = 0; y < 1000; y++) rc2_ecb_decrypt(tmp[0], tmp[0], &skey); - for (y = 0; y < 8; y++) if (tmp[0][y] != 0) return CRYPT_FAIL_TESTVECTOR; - } - return CRYPT_OK; - #endif -} - -/** Terminate the context - @param skey The scheduled key -*/ -void rc2_done(symmetric_key *skey) -{ -} - -/** - Gets suitable key size - @param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable. - @return CRYPT_OK if the input key size is acceptable. -*/ -int rc2_keysize(int *keysize) -{ - LTC_ARGCHK(keysize != NULL); - if (*keysize < 8) { - return CRYPT_INVALID_KEYSIZE; - } else if (*keysize > 128) { - *keysize = 128; - } - return CRYPT_OK; -} - -#endif - - - - -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/rc2.c,v $ */ -/* $Revision: 1.14 $ */ -/* $Date: 2007/05/12 14:13:00 $ */ DELETED Source/libtomcrypt/src/ciphers/rc5.c Index: Source/libtomcrypt/src/ciphers/rc5.c ================================================================== --- Source/libtomcrypt/src/ciphers/rc5.c +++ /dev/null @@ -1,341 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/** - @file rc5.c - LTC_RC5 code by Tom St Denis -*/ - -#include "tomcrypt.h" - -#ifdef LTC_RC5 - -const struct ltc_cipher_descriptor rc5_desc = -{ - "rc5", - 2, - 8, 128, 8, 12, - &rc5_setup, - &rc5_ecb_encrypt, - &rc5_ecb_decrypt, - &rc5_test, - &rc5_done, - &rc5_keysize, - /* ECB Accelerators */ - NULL, NULL, - /* CBC Accelerators */ - NULL, NULL, - /* CTR Accelerators */ - NULL, - /* LRW Accelerators */ - NULL, NULL, - /* XTS Accelerators */ - NULL, NULL, - /* CCM Accelerator */ - NULL, - /* GCM Accelerator */ - NULL, - /* OMAC Accelerator */ - NULL, - /* XCBC Accelerator */ - NULL, - /* F9 Accelerator */ - NULL -}; - -static const ulong32 stab[50] = { -0xb7e15163UL, 0x5618cb1cUL, 0xf45044d5UL, 0x9287be8eUL, 0x30bf3847UL, 0xcef6b200UL, 0x6d2e2bb9UL, 0x0b65a572UL, -0xa99d1f2bUL, 0x47d498e4UL, 0xe60c129dUL, 0x84438c56UL, 0x227b060fUL, 0xc0b27fc8UL, 0x5ee9f981UL, 0xfd21733aUL, -0x9b58ecf3UL, 0x399066acUL, 0xd7c7e065UL, 0x75ff5a1eUL, 0x1436d3d7UL, 0xb26e4d90UL, 0x50a5c749UL, 0xeedd4102UL, -0x8d14babbUL, 0x2b4c3474UL, 0xc983ae2dUL, 0x67bb27e6UL, 0x05f2a19fUL, 0xa42a1b58UL, 0x42619511UL, 0xe0990ecaUL, -0x7ed08883UL, 0x1d08023cUL, 0xbb3f7bf5UL, 0x5976f5aeUL, 0xf7ae6f67UL, 0x95e5e920UL, 0x341d62d9UL, 0xd254dc92UL, -0x708c564bUL, 0x0ec3d004UL, 0xacfb49bdUL, 0x4b32c376UL, 0xe96a3d2fUL, 0x87a1b6e8UL, 0x25d930a1UL, 0xc410aa5aUL, -0x62482413UL, 0x007f9dccUL -}; - - /** - Initialize the LTC_RC5 block cipher - @param key The symmetric key you wish to pass - @param keylen The key length in bytes - @param num_rounds The number of rounds desired (0 for default) - @param skey The key in as scheduled by this function. - @return CRYPT_OK if successful - */ -#ifdef LTC_CLEAN_STACK -static int _rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -#else -int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -#endif -{ - ulong32 L[64], *S, A, B, i, j, v, s, t, l; - - LTC_ARGCHK(skey != NULL); - LTC_ARGCHK(key != NULL); - - /* test parameters */ - if (num_rounds == 0) { - num_rounds = rc5_desc.default_rounds; - } - - if (num_rounds < 12 || num_rounds > 24) { - return CRYPT_INVALID_ROUNDS; - } - - /* key must be between 64 and 1024 bits */ - if (keylen < 8 || keylen > 128) { - return CRYPT_INVALID_KEYSIZE; - } - - skey->rc5.rounds = num_rounds; - S = skey->rc5.K; - - /* copy the key into the L array */ - for (A = i = j = 0; i < (ulong32)keylen; ) { - A = (A << 8) | ((ulong32)(key[i++] & 255)); - if ((i & 3) == 0) { - L[j++] = BSWAP(A); - A = 0; - } - } - - if ((keylen & 3) != 0) { - A <<= (ulong32)((8 * (4 - (keylen&3)))); - L[j++] = BSWAP(A); - } - - /* setup the S array */ - t = (ulong32)(2 * (num_rounds + 1)); - XMEMCPY(S, stab, t * sizeof(*S)); - - /* mix buffer */ - s = 3 * MAX(t, j); - l = j; - for (A = B = i = j = v = 0; v < s; v++) { - A = S[i] = ROLc(S[i] + A + B, 3); - B = L[j] = ROL(L[j] + A + B, (A+B)); - if (++i == t) { i = 0; } - if (++j == l) { j = 0; } - } - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -{ - int x; - x = _rc5_setup(key, keylen, num_rounds, skey); - burn_stack(sizeof(ulong32) * 122 + sizeof(int)); - return x; -} -#endif - -/** - Encrypts a block of text with LTC_RC5 - @param pt The input plaintext (8 bytes) - @param ct The output ciphertext (8 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful -*/ -#ifdef LTC_CLEAN_STACK -static int _rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -#else -int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -#endif -{ - ulong32 A, B, *K; - int r; - LTC_ARGCHK(skey != NULL); - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - - LOAD32L(A, &pt[0]); - LOAD32L(B, &pt[4]); - A += skey->rc5.K[0]; - B += skey->rc5.K[1]; - K = skey->rc5.K + 2; - - if ((skey->rc5.rounds & 1) == 0) { - for (r = 0; r < skey->rc5.rounds; r += 2) { - A = ROL(A ^ B, B) + K[0]; - B = ROL(B ^ A, A) + K[1]; - A = ROL(A ^ B, B) + K[2]; - B = ROL(B ^ A, A) + K[3]; - K += 4; - } - } else { - for (r = 0; r < skey->rc5.rounds; r++) { - A = ROL(A ^ B, B) + K[0]; - B = ROL(B ^ A, A) + K[1]; - K += 2; - } - } - STORE32L(A, &ct[0]); - STORE32L(B, &ct[4]); - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -{ - int err = _rc5_ecb_encrypt(pt, ct, skey); - burn_stack(sizeof(ulong32) * 2 + sizeof(int)); - return err; -} -#endif - -/** - Decrypts a block of text with LTC_RC5 - @param ct The input ciphertext (8 bytes) - @param pt The output plaintext (8 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful -*/ -#ifdef LTC_CLEAN_STACK -static int _rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -#else -int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -#endif -{ - ulong32 A, B, *K; - int r; - LTC_ARGCHK(skey != NULL); - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - - LOAD32L(A, &ct[0]); - LOAD32L(B, &ct[4]); - K = skey->rc5.K + (skey->rc5.rounds << 1); - - if ((skey->rc5.rounds & 1) == 0) { - K -= 2; - for (r = skey->rc5.rounds - 1; r >= 0; r -= 2) { - B = ROR(B - K[3], A) ^ A; - A = ROR(A - K[2], B) ^ B; - B = ROR(B - K[1], A) ^ A; - A = ROR(A - K[0], B) ^ B; - K -= 4; - } - } else { - for (r = skey->rc5.rounds - 1; r >= 0; r--) { - B = ROR(B - K[1], A) ^ A; - A = ROR(A - K[0], B) ^ B; - K -= 2; - } - } - A -= skey->rc5.K[0]; - B -= skey->rc5.K[1]; - STORE32L(A, &pt[0]); - STORE32L(B, &pt[4]); - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -{ - int err = _rc5_ecb_decrypt(ct, pt, skey); - burn_stack(sizeof(ulong32) * 2 + sizeof(int)); - return err; -} -#endif - -/** - Performs a self-test of the LTC_RC5 block cipher - @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled -*/ -int rc5_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - static const struct { - unsigned char key[16], pt[8], ct[8]; - } tests[] = { - { - { 0x91, 0x5f, 0x46, 0x19, 0xbe, 0x41, 0xb2, 0x51, - 0x63, 0x55, 0xa5, 0x01, 0x10, 0xa9, 0xce, 0x91 }, - { 0x21, 0xa5, 0xdb, 0xee, 0x15, 0x4b, 0x8f, 0x6d }, - { 0xf7, 0xc0, 0x13, 0xac, 0x5b, 0x2b, 0x89, 0x52 } - }, - { - { 0x78, 0x33, 0x48, 0xe7, 0x5a, 0xeb, 0x0f, 0x2f, - 0xd7, 0xb1, 0x69, 0xbb, 0x8d, 0xc1, 0x67, 0x87 }, - { 0xF7, 0xC0, 0x13, 0xAC, 0x5B, 0x2B, 0x89, 0x52 }, - { 0x2F, 0x42, 0xB3, 0xB7, 0x03, 0x69, 0xFC, 0x92 } - }, - { - { 0xDC, 0x49, 0xdb, 0x13, 0x75, 0xa5, 0x58, 0x4f, - 0x64, 0x85, 0xb4, 0x13, 0xb5, 0xf1, 0x2b, 0xaf }, - { 0x2F, 0x42, 0xB3, 0xB7, 0x03, 0x69, 0xFC, 0x92 }, - { 0x65, 0xc1, 0x78, 0xb2, 0x84, 0xd1, 0x97, 0xcc } - } - }; - unsigned char tmp[2][8]; - int x, y, err; - symmetric_key key; - - for (x = 0; x < (int)(sizeof(tests) / sizeof(tests[0])); x++) { - /* setup key */ - if ((err = rc5_setup(tests[x].key, 16, 12, &key)) != CRYPT_OK) { - return err; - } - - /* encrypt and decrypt */ - rc5_ecb_encrypt(tests[x].pt, tmp[0], &key); - rc5_ecb_decrypt(tmp[0], tmp[1], &key); - - /* compare */ - if (XMEMCMP(tmp[0], tests[x].ct, 8) != 0 || XMEMCMP(tmp[1], tests[x].pt, 8) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - - /* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */ - for (y = 0; y < 8; y++) tmp[0][y] = 0; - for (y = 0; y < 1000; y++) rc5_ecb_encrypt(tmp[0], tmp[0], &key); - for (y = 0; y < 1000; y++) rc5_ecb_decrypt(tmp[0], tmp[0], &key); - for (y = 0; y < 8; y++) if (tmp[0][y] != 0) return CRYPT_FAIL_TESTVECTOR; - } - return CRYPT_OK; - #endif -} - -/** Terminate the context - @param skey The scheduled key -*/ -void rc5_done(symmetric_key *skey) -{ -} - -/** - Gets suitable key size - @param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable. - @return CRYPT_OK if the input key size is acceptable. -*/ -int rc5_keysize(int *keysize) -{ - LTC_ARGCHK(keysize != NULL); - if (*keysize < 8) { - return CRYPT_INVALID_KEYSIZE; - } else if (*keysize > 128) { - *keysize = 128; - } - return CRYPT_OK; -} - -#endif - - - - -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/rc5.c,v $ */ -/* $Revision: 1.14 $ */ -/* $Date: 2007/05/12 14:13:00 $ */ DELETED Source/libtomcrypt/src/hashes/helper/hash_file.c Index: Source/libtomcrypt/src/hashes/helper/hash_file.c ================================================================== --- Source/libtomcrypt/src/hashes/helper/hash_file.c +++ /dev/null @@ -1,57 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file hash_file.c - Hash a file, Tom St Denis -*/ - -/** - @param hash The index of the hash desired - @param fname The name of the file you wish to hash - @param out [out] The destination of the digest - @param outlen [in/out] The max size and resulting size of the message digest - @result CRYPT_OK if successful -*/ -int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *outlen) -{ -#ifdef LTC_NO_FILE - return CRYPT_NOP; -#else - FILE *in; - int err; - LTC_ARGCHK(fname != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - if ((err = hash_is_valid(hash)) != CRYPT_OK) { - return err; - } - - in = fopen(fname, "rb"); - if (in == NULL) { - return CRYPT_FILE_NOTFOUND; - } - - err = hash_filehandle(hash, in, out, outlen); - if (fclose(in) != 0) { - return CRYPT_ERROR; - } - - return err; -#endif -} - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_file.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/12/28 01:27:23 $ */ DELETED Source/libtomcrypt/src/hashes/helper/hash_filehandle.c Index: Source/libtomcrypt/src/hashes/helper/hash_filehandle.c ================================================================== --- Source/libtomcrypt/src/hashes/helper/hash_filehandle.c +++ /dev/null @@ -1,71 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file hash_filehandle.c - Hash open files, Tom St Denis -*/ - -/** - Hash data from an open file handle. - @param hash The index of the hash you want to use - @param in The FILE* handle of the file you want to hash - @param out [out] The destination of the digest - @param outlen [in/out] The max size and resulting size of the digest - @result CRYPT_OK if successful -*/ -int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outlen) -{ -#ifdef LTC_NO_FILE - return CRYPT_NOP; -#else - hash_state md; - unsigned char buf[512]; - size_t x; - int err; - - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - LTC_ARGCHK(in != NULL); - - if ((err = hash_is_valid(hash)) != CRYPT_OK) { - return err; - } - - if (*outlen < hash_descriptor[hash].hashsize) { - *outlen = hash_descriptor[hash].hashsize; - return CRYPT_BUFFER_OVERFLOW; - } - if ((err = hash_descriptor[hash].init(&md)) != CRYPT_OK) { - return err; - } - - *outlen = hash_descriptor[hash].hashsize; - do { - x = fread(buf, 1, sizeof(buf), in); - if ((err = hash_descriptor[hash].process(&md, buf, x)) != CRYPT_OK) { - return err; - } - } while (x == sizeof(buf)); - err = hash_descriptor[hash].done(&md, out); - -#ifdef LTC_CLEAN_STACK - zeromem(buf, sizeof(buf)); -#endif - return err; -#endif -} - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_filehandle.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:23 $ */ DELETED Source/libtomcrypt/src/hashes/helper/hash_memory.c Index: Source/libtomcrypt/src/hashes/helper/hash_memory.c ================================================================== --- Source/libtomcrypt/src/hashes/helper/hash_memory.c +++ /dev/null @@ -1,69 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file hash_memory.c - Hash memory helper, Tom St Denis -*/ - -/** - Hash a block of memory and store the digest. - @param hash The index of the hash you wish to use - @param in The data you wish to hash - @param inlen The length of the data to hash (octets) - @param out [out] Where to store the digest - @param outlen [in/out] Max size and resulting size of the digest - @return CRYPT_OK if successful -*/ -int hash_memory(int hash, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen) -{ - hash_state *md; - int err; - - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - if ((err = hash_is_valid(hash)) != CRYPT_OK) { - return err; - } - - if (*outlen < hash_descriptor[hash].hashsize) { - *outlen = hash_descriptor[hash].hashsize; - return CRYPT_BUFFER_OVERFLOW; - } - - md = XMALLOC(sizeof(hash_state)); - if (md == NULL) { - return CRYPT_MEM; - } - - if ((err = hash_descriptor[hash].init(md)) != CRYPT_OK) { - goto LBL_ERR; - } - if ((err = hash_descriptor[hash].process(md, in, inlen)) != CRYPT_OK) { - goto LBL_ERR; - } - err = hash_descriptor[hash].done(md, out); - *outlen = hash_descriptor[hash].hashsize; -LBL_ERR: -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - XFREE(md); - - return err; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_memory.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:23 $ */ DELETED Source/libtomcrypt/src/hashes/helper/hash_memory_multi.c Index: Source/libtomcrypt/src/hashes/helper/hash_memory_multi.c ================================================================== --- Source/libtomcrypt/src/hashes/helper/hash_memory_multi.c +++ /dev/null @@ -1,87 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" -#include -/** - @file hash_memory_multi.c - Hash (multiple buffers) memory helper, Tom St Denis -*/ - -/** - Hash multiple (non-adjacent) blocks of memory at once. - @param hash The index of the hash you wish to use - @param out [out] Where to store the digest - @param outlen [in/out] Max size and resulting size of the digest - @param in The data you wish to hash - @param inlen The length of the data to hash (octets) - @param ... tuples of (data,len) pairs to hash, terminated with a (NULL,x) (x=don't care) - @return CRYPT_OK if successful -*/ -int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen, - const unsigned char *in, unsigned long inlen, ...) -{ - hash_state *md; - int err; - va_list args; - const unsigned char *curptr; - unsigned long curlen; - - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - if ((err = hash_is_valid(hash)) != CRYPT_OK) { - return err; - } - - if (*outlen < hash_descriptor[hash].hashsize) { - *outlen = hash_descriptor[hash].hashsize; - return CRYPT_BUFFER_OVERFLOW; - } - - md = XMALLOC(sizeof(hash_state)); - if (md == NULL) { - return CRYPT_MEM; - } - - if ((err = hash_descriptor[hash].init(md)) != CRYPT_OK) { - goto LBL_ERR; - } - - va_start(args, inlen); - curptr = in; - curlen = inlen; - for (;;) { - /* process buf */ - if ((err = hash_descriptor[hash].process(md, curptr, curlen)) != CRYPT_OK) { - goto LBL_ERR; - } - /* step to next */ - curptr = va_arg(args, const unsigned char*); - if (curptr == NULL) { - break; - } - curlen = va_arg(args, unsigned long); - } - err = hash_descriptor[hash].done(md, out); - *outlen = hash_descriptor[hash].hashsize; -LBL_ERR: -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - XFREE(md); - va_end(args); - return err; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_memory_multi.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:23 $ */ DELETED Source/libtomcrypt/src/hashes/md2.c Index: Source/libtomcrypt/src/hashes/md2.c ================================================================== --- Source/libtomcrypt/src/hashes/md2.c +++ /dev/null @@ -1,251 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @param md2.c - LTC_MD2 (RFC 1319) hash function implementation by Tom St Denis -*/ - -#ifdef LTC_MD2 - -const struct ltc_hash_descriptor md2_desc = -{ - "md2", - 7, - 16, - 16, - - /* OID */ - { 1, 2, 840, 113549, 2, 2, }, - 6, - - &md2_init, - &md2_process, - &md2_done, - &md2_test, - NULL -}; - -static const unsigned char PI_SUBST[256] = { - 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, - 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, - 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, - 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, - 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, - 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, - 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, - 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, - 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, - 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, - 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, - 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, - 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, - 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, - 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, - 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, - 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, - 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 -}; - -/* adds 16 bytes to the checksum */ -static void md2_update_chksum(hash_state *md) -{ - int j; - unsigned char L; - L = md->md2.chksum[15]; - for (j = 0; j < 16; j++) { - -/* caution, the RFC says its "C[j] = S[M[i*16+j] xor L]" but the reference source code [and test vectors] say - otherwise. -*/ - L = (md->md2.chksum[j] ^= PI_SUBST[(int)(md->md2.buf[j] ^ L)] & 255); - } -} - -static void md2_compress(hash_state *md) -{ - int j, k; - unsigned char t; - - /* copy block */ - for (j = 0; j < 16; j++) { - md->md2.X[16+j] = md->md2.buf[j]; - md->md2.X[32+j] = md->md2.X[j] ^ md->md2.X[16+j]; - } - - t = (unsigned char)0; - - /* do 18 rounds */ - for (j = 0; j < 18; j++) { - for (k = 0; k < 48; k++) { - t = (md->md2.X[k] ^= PI_SUBST[(int)(t & 255)]); - } - t = (t + (unsigned char)j) & 255; - } -} - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int md2_init(hash_state *md) -{ - LTC_ARGCHK(md != NULL); - - /* LTC_MD2 uses a zero'ed state... */ - zeromem(md->md2.X, sizeof(md->md2.X)); - zeromem(md->md2.chksum, sizeof(md->md2.chksum)); - zeromem(md->md2.buf, sizeof(md->md2.buf)); - md->md2.curlen = 0; - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -int md2_process(hash_state *md, const unsigned char *in, unsigned long inlen) -{ - unsigned long n; - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(in != NULL); - if (md-> md2 .curlen > sizeof(md-> md2 .buf)) { - return CRYPT_INVALID_ARG; - } - while (inlen > 0) { - n = MIN(inlen, (16 - md->md2.curlen)); - XMEMCPY(md->md2.buf + md->md2.curlen, in, (size_t)n); - md->md2.curlen += n; - in += n; - inlen -= n; - - /* is 16 bytes full? */ - if (md->md2.curlen == 16) { - md2_compress(md); - md2_update_chksum(md); - md->md2.curlen = 0; - } - } - return CRYPT_OK; -} - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (16 bytes) - @return CRYPT_OK if successful -*/ -int md2_done(hash_state * md, unsigned char *out) -{ - unsigned long i, k; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->md2.curlen >= sizeof(md->md2.buf)) { - return CRYPT_INVALID_ARG; - } - - - /* pad the message */ - k = 16 - md->md2.curlen; - for (i = md->md2.curlen; i < 16; i++) { - md->md2.buf[i] = (unsigned char)k; - } - - /* hash and update */ - md2_compress(md); - md2_update_chksum(md); - - /* hash checksum */ - XMEMCPY(md->md2.buf, md->md2.chksum, 16); - md2_compress(md); - - /* output is lower 16 bytes of X */ - XMEMCPY(out, md->md2.X, 16); - -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int md2_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - static const struct { - char *msg; - unsigned char md[16]; - } tests[] = { - { "", - {0x83,0x50,0xe5,0xa3,0xe2,0x4c,0x15,0x3d, - 0xf2,0x27,0x5c,0x9f,0x80,0x69,0x27,0x73 - } - }, - { "a", - {0x32,0xec,0x01,0xec,0x4a,0x6d,0xac,0x72, - 0xc0,0xab,0x96,0xfb,0x34,0xc0,0xb5,0xd1 - } - }, - { "message digest", - {0xab,0x4f,0x49,0x6b,0xfb,0x2a,0x53,0x0b, - 0x21,0x9f,0xf3,0x30,0x31,0xfe,0x06,0xb0 - } - }, - { "abcdefghijklmnopqrstuvwxyz", - {0x4e,0x8d,0xdf,0xf3,0x65,0x02,0x92,0xab, - 0x5a,0x41,0x08,0xc3,0xaa,0x47,0x94,0x0b - } - }, - { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - {0xda,0x33,0xde,0xf2,0xa4,0x2d,0xf1,0x39, - 0x75,0x35,0x28,0x46,0xc3,0x03,0x38,0xcd - } - }, - { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", - {0xd5,0x97,0x6f,0x79,0xd8,0x3d,0x3a,0x0d, - 0xc9,0x80,0x6c,0x3c,0x66,0xf3,0xef,0xd8 - } - } - }; - int i; - hash_state md; - unsigned char buf[16]; - - for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { - md2_init(&md); - md2_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); - md2_done(&md, buf); - if (XMEMCMP(buf, tests[i].md, 16) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; - #endif -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/md2.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2007/05/12 14:25:28 $ */ DELETED Source/libtomcrypt/src/hashes/md4.c Index: Source/libtomcrypt/src/hashes/md4.c ================================================================== --- Source/libtomcrypt/src/hashes/md4.c +++ /dev/null @@ -1,307 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @param md4.c - Submitted by Dobes Vandermeer (dobes@smartt.com) -*/ - -#ifdef LTC_MD4 - -const struct ltc_hash_descriptor md4_desc = -{ - "md4", - 6, - 16, - 64, - - /* OID */ - { 1, 2, 840, 113549, 2, 4, }, - 6, - - &md4_init, - &md4_process, - &md4_done, - &md4_test, - NULL -}; - -#define S11 3 -#define S12 7 -#define S13 11 -#define S14 19 -#define S21 3 -#define S22 5 -#define S23 9 -#define S24 13 -#define S31 3 -#define S32 9 -#define S33 11 -#define S34 15 - -/* F, G and H are basic LTC_MD4 functions. */ -#define F(x, y, z) (z ^ (x & (y ^ z))) -#define G(x, y, z) ((x & y) | (z & (x | y))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) - -/* ROTATE_LEFT rotates x left n bits. */ -#define ROTATE_LEFT(x, n) ROLc(x, n) - -/* FF, GG and HH are transformations for rounds 1, 2 and 3 */ -/* Rotation is separate from addition to prevent recomputation */ - -#define FF(a, b, c, d, x, s) { \ - (a) += F ((b), (c), (d)) + (x); \ - (a) = ROTATE_LEFT ((a), (s)); \ - } -#define GG(a, b, c, d, x, s) { \ - (a) += G ((b), (c), (d)) + (x) + 0x5a827999UL; \ - (a) = ROTATE_LEFT ((a), (s)); \ - } -#define HH(a, b, c, d, x, s) { \ - (a) += H ((b), (c), (d)) + (x) + 0x6ed9eba1UL; \ - (a) = ROTATE_LEFT ((a), (s)); \ - } - -#ifdef LTC_CLEAN_STACK -static int _md4_compress(hash_state *md, unsigned char *buf) -#else -static int md4_compress(hash_state *md, unsigned char *buf) -#endif -{ - ulong32 x[16], a, b, c, d; - int i; - - /* copy state */ - a = md->md4.state[0]; - b = md->md4.state[1]; - c = md->md4.state[2]; - d = md->md4.state[3]; - - /* copy the state into 512-bits into W[0..15] */ - for (i = 0; i < 16; i++) { - LOAD32L(x[i], buf + (4*i)); - } - - /* Round 1 */ - FF (a, b, c, d, x[ 0], S11); /* 1 */ - FF (d, a, b, c, x[ 1], S12); /* 2 */ - FF (c, d, a, b, x[ 2], S13); /* 3 */ - FF (b, c, d, a, x[ 3], S14); /* 4 */ - FF (a, b, c, d, x[ 4], S11); /* 5 */ - FF (d, a, b, c, x[ 5], S12); /* 6 */ - FF (c, d, a, b, x[ 6], S13); /* 7 */ - FF (b, c, d, a, x[ 7], S14); /* 8 */ - FF (a, b, c, d, x[ 8], S11); /* 9 */ - FF (d, a, b, c, x[ 9], S12); /* 10 */ - FF (c, d, a, b, x[10], S13); /* 11 */ - FF (b, c, d, a, x[11], S14); /* 12 */ - FF (a, b, c, d, x[12], S11); /* 13 */ - FF (d, a, b, c, x[13], S12); /* 14 */ - FF (c, d, a, b, x[14], S13); /* 15 */ - FF (b, c, d, a, x[15], S14); /* 16 */ - - /* Round 2 */ - GG (a, b, c, d, x[ 0], S21); /* 17 */ - GG (d, a, b, c, x[ 4], S22); /* 18 */ - GG (c, d, a, b, x[ 8], S23); /* 19 */ - GG (b, c, d, a, x[12], S24); /* 20 */ - GG (a, b, c, d, x[ 1], S21); /* 21 */ - GG (d, a, b, c, x[ 5], S22); /* 22 */ - GG (c, d, a, b, x[ 9], S23); /* 23 */ - GG (b, c, d, a, x[13], S24); /* 24 */ - GG (a, b, c, d, x[ 2], S21); /* 25 */ - GG (d, a, b, c, x[ 6], S22); /* 26 */ - GG (c, d, a, b, x[10], S23); /* 27 */ - GG (b, c, d, a, x[14], S24); /* 28 */ - GG (a, b, c, d, x[ 3], S21); /* 29 */ - GG (d, a, b, c, x[ 7], S22); /* 30 */ - GG (c, d, a, b, x[11], S23); /* 31 */ - GG (b, c, d, a, x[15], S24); /* 32 */ - - /* Round 3 */ - HH (a, b, c, d, x[ 0], S31); /* 33 */ - HH (d, a, b, c, x[ 8], S32); /* 34 */ - HH (c, d, a, b, x[ 4], S33); /* 35 */ - HH (b, c, d, a, x[12], S34); /* 36 */ - HH (a, b, c, d, x[ 2], S31); /* 37 */ - HH (d, a, b, c, x[10], S32); /* 38 */ - HH (c, d, a, b, x[ 6], S33); /* 39 */ - HH (b, c, d, a, x[14], S34); /* 40 */ - HH (a, b, c, d, x[ 1], S31); /* 41 */ - HH (d, a, b, c, x[ 9], S32); /* 42 */ - HH (c, d, a, b, x[ 5], S33); /* 43 */ - HH (b, c, d, a, x[13], S34); /* 44 */ - HH (a, b, c, d, x[ 3], S31); /* 45 */ - HH (d, a, b, c, x[11], S32); /* 46 */ - HH (c, d, a, b, x[ 7], S33); /* 47 */ - HH (b, c, d, a, x[15], S34); /* 48 */ - - - /* Update our state */ - md->md4.state[0] = md->md4.state[0] + a; - md->md4.state[1] = md->md4.state[1] + b; - md->md4.state[2] = md->md4.state[2] + c; - md->md4.state[3] = md->md4.state[3] + d; - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -static int md4_compress(hash_state *md, unsigned char *buf) -{ - int err; - err = _md4_compress(md, buf); - burn_stack(sizeof(ulong32) * 20 + sizeof(int)); - return err; -} -#endif - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int md4_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - md->md4.state[0] = 0x67452301UL; - md->md4.state[1] = 0xefcdab89UL; - md->md4.state[2] = 0x98badcfeUL; - md->md4.state[3] = 0x10325476UL; - md->md4.length = 0; - md->md4.curlen = 0; - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -HASH_PROCESS(md4_process, md4_compress, md4, 64) - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (16 bytes) - @return CRYPT_OK if successful -*/ -int md4_done(hash_state * md, unsigned char *out) -{ - int i; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->md4.curlen >= sizeof(md->md4.buf)) { - return CRYPT_INVALID_ARG; - } - - /* increase the length of the message */ - md->md4.length += md->md4.curlen * 8; - - /* append the '1' bit */ - md->md4.buf[md->md4.curlen++] = (unsigned char)0x80; - - /* if the length is currently above 56 bytes we append zeros - * then compress. Then we can fall back to padding zeros and length - * encoding like normal. - */ - if (md->md4.curlen > 56) { - while (md->md4.curlen < 64) { - md->md4.buf[md->md4.curlen++] = (unsigned char)0; - } - md4_compress(md, md->md4.buf); - md->md4.curlen = 0; - } - - /* pad upto 56 bytes of zeroes */ - while (md->md4.curlen < 56) { - md->md4.buf[md->md4.curlen++] = (unsigned char)0; - } - - /* store length */ - STORE64L(md->md4.length, md->md4.buf+56); - md4_compress(md, md->md4.buf); - - /* copy output */ - for (i = 0; i < 4; i++) { - STORE32L(md->md4.state[i], out+(4*i)); - } -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int md4_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - static const struct md4_test_case { - char *input; - unsigned char digest[16]; - } cases[] = { - { "", - {0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, - 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0} }, - { "a", - {0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46, - 0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24} }, - { "abc", - {0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, - 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d} }, - { "message digest", - {0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8, - 0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b} }, - { "abcdefghijklmnopqrstuvwxyz", - {0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd, - 0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9} }, - { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - {0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35, - 0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4} }, - { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", - {0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19, - 0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36} }, - }; - int i; - hash_state md; - unsigned char digest[16]; - - for(i = 0; i < (int)(sizeof(cases) / sizeof(cases[0])); i++) { - md4_init(&md); - md4_process(&md, (unsigned char *)cases[i].input, (unsigned long)strlen(cases[i].input)); - md4_done(&md, digest); - if (XMEMCMP(digest, cases[i].digest, 16) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - - } - return CRYPT_OK; - #endif -} - -#endif - - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/md4.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2007/05/12 14:25:28 $ */ DELETED Source/libtomcrypt/src/hashes/md5.c Index: Source/libtomcrypt/src/hashes/md5.c ================================================================== --- Source/libtomcrypt/src/hashes/md5.c +++ /dev/null @@ -1,368 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - - -/** - @file md5.c - LTC_MD5 hash function by Tom St Denis -*/ - -#ifdef LTC_MD5 - -const struct ltc_hash_descriptor ltc_md5_desc = -{ - "md5", - 3, - 16, - 64, - - /* OID */ - { 1, 2, 840, 113549, 2, 5, }, - 6, - - <c_md5_init, - <c_md5_process, - <c_md5_done, - <c_md5_test, - NULL -}; - -#define F(x,y,z) (z ^ (x & (y ^ z))) -#define G(x,y,z) (y ^ (z & (y ^ x))) -#define H(x,y,z) (x^y^z) -#define I(x,y,z) (y^(x|(~z))) - -#ifdef LTC_SMALL_CODE - -#define FF(a,b,c,d,M,s,t) \ - a = (a + F(b,c,d) + M + t); a = ROL(a, s) + b; - -#define GG(a,b,c,d,M,s,t) \ - a = (a + G(b,c,d) + M + t); a = ROL(a, s) + b; - -#define HH(a,b,c,d,M,s,t) \ - a = (a + H(b,c,d) + M + t); a = ROL(a, s) + b; - -#define II(a,b,c,d,M,s,t) \ - a = (a + I(b,c,d) + M + t); a = ROL(a, s) + b; - -static const unsigned char Worder[64] = { - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12, - 5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2, - 0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9 -}; - -static const unsigned char Rorder[64] = { - 7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22, - 5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20, - 4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23, - 6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21 -}; - -static const ulong32 Korder[64] = { -0xd76aa478UL, 0xe8c7b756UL, 0x242070dbUL, 0xc1bdceeeUL, 0xf57c0fafUL, 0x4787c62aUL, 0xa8304613UL, 0xfd469501UL, -0x698098d8UL, 0x8b44f7afUL, 0xffff5bb1UL, 0x895cd7beUL, 0x6b901122UL, 0xfd987193UL, 0xa679438eUL, 0x49b40821UL, -0xf61e2562UL, 0xc040b340UL, 0x265e5a51UL, 0xe9b6c7aaUL, 0xd62f105dUL, 0x02441453UL, 0xd8a1e681UL, 0xe7d3fbc8UL, -0x21e1cde6UL, 0xc33707d6UL, 0xf4d50d87UL, 0x455a14edUL, 0xa9e3e905UL, 0xfcefa3f8UL, 0x676f02d9UL, 0x8d2a4c8aUL, -0xfffa3942UL, 0x8771f681UL, 0x6d9d6122UL, 0xfde5380cUL, 0xa4beea44UL, 0x4bdecfa9UL, 0xf6bb4b60UL, 0xbebfbc70UL, -0x289b7ec6UL, 0xeaa127faUL, 0xd4ef3085UL, 0x04881d05UL, 0xd9d4d039UL, 0xe6db99e5UL, 0x1fa27cf8UL, 0xc4ac5665UL, -0xf4292244UL, 0x432aff97UL, 0xab9423a7UL, 0xfc93a039UL, 0x655b59c3UL, 0x8f0ccc92UL, 0xffeff47dUL, 0x85845dd1UL, -0x6fa87e4fUL, 0xfe2ce6e0UL, 0xa3014314UL, 0x4e0811a1UL, 0xf7537e82UL, 0xbd3af235UL, 0x2ad7d2bbUL, 0xeb86d391UL -}; - -#else - -#define FF(a,b,c,d,M,s,t) \ - a = (a + F(b,c,d) + M + t); a = ROLc(a, s) + b; - -#define GG(a,b,c,d,M,s,t) \ - a = (a + G(b,c,d) + M + t); a = ROLc(a, s) + b; - -#define HH(a,b,c,d,M,s,t) \ - a = (a + H(b,c,d) + M + t); a = ROLc(a, s) + b; - -#define II(a,b,c,d,M,s,t) \ - a = (a + I(b,c,d) + M + t); a = ROLc(a, s) + b; - - -#endif - -#ifdef LTC_CLEAN_STACK -static int _md5_compress(hash_state *md, unsigned char *buf) -#else -static int md5_compress(hash_state *md, unsigned char *buf) -#endif -{ - ulong32 i, W[16], a, b, c, d; -#ifdef LTC_SMALL_CODE - ulong32 t; -#endif - - /* copy the state into 512-bits into W[0..15] */ - for (i = 0; i < 16; i++) { - LOAD32L(W[i], buf + (4*i)); - } - - /* copy state */ - a = md->md5.state[0]; - b = md->md5.state[1]; - c = md->md5.state[2]; - d = md->md5.state[3]; - -#ifdef LTC_SMALL_CODE - for (i = 0; i < 16; ++i) { - FF(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); - t = d; d = c; c = b; b = a; a = t; - } - - for (; i < 32; ++i) { - GG(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); - t = d; d = c; c = b; b = a; a = t; - } - - for (; i < 48; ++i) { - HH(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); - t = d; d = c; c = b; b = a; a = t; - } - - for (; i < 64; ++i) { - II(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); - t = d; d = c; c = b; b = a; a = t; - } - -#else - FF(a,b,c,d,W[0],7,0xd76aa478UL) - FF(d,a,b,c,W[1],12,0xe8c7b756UL) - FF(c,d,a,b,W[2],17,0x242070dbUL) - FF(b,c,d,a,W[3],22,0xc1bdceeeUL) - FF(a,b,c,d,W[4],7,0xf57c0fafUL) - FF(d,a,b,c,W[5],12,0x4787c62aUL) - FF(c,d,a,b,W[6],17,0xa8304613UL) - FF(b,c,d,a,W[7],22,0xfd469501UL) - FF(a,b,c,d,W[8],7,0x698098d8UL) - FF(d,a,b,c,W[9],12,0x8b44f7afUL) - FF(c,d,a,b,W[10],17,0xffff5bb1UL) - FF(b,c,d,a,W[11],22,0x895cd7beUL) - FF(a,b,c,d,W[12],7,0x6b901122UL) - FF(d,a,b,c,W[13],12,0xfd987193UL) - FF(c,d,a,b,W[14],17,0xa679438eUL) - FF(b,c,d,a,W[15],22,0x49b40821UL) - GG(a,b,c,d,W[1],5,0xf61e2562UL) - GG(d,a,b,c,W[6],9,0xc040b340UL) - GG(c,d,a,b,W[11],14,0x265e5a51UL) - GG(b,c,d,a,W[0],20,0xe9b6c7aaUL) - GG(a,b,c,d,W[5],5,0xd62f105dUL) - GG(d,a,b,c,W[10],9,0x02441453UL) - GG(c,d,a,b,W[15],14,0xd8a1e681UL) - GG(b,c,d,a,W[4],20,0xe7d3fbc8UL) - GG(a,b,c,d,W[9],5,0x21e1cde6UL) - GG(d,a,b,c,W[14],9,0xc33707d6UL) - GG(c,d,a,b,W[3],14,0xf4d50d87UL) - GG(b,c,d,a,W[8],20,0x455a14edUL) - GG(a,b,c,d,W[13],5,0xa9e3e905UL) - GG(d,a,b,c,W[2],9,0xfcefa3f8UL) - GG(c,d,a,b,W[7],14,0x676f02d9UL) - GG(b,c,d,a,W[12],20,0x8d2a4c8aUL) - HH(a,b,c,d,W[5],4,0xfffa3942UL) - HH(d,a,b,c,W[8],11,0x8771f681UL) - HH(c,d,a,b,W[11],16,0x6d9d6122UL) - HH(b,c,d,a,W[14],23,0xfde5380cUL) - HH(a,b,c,d,W[1],4,0xa4beea44UL) - HH(d,a,b,c,W[4],11,0x4bdecfa9UL) - HH(c,d,a,b,W[7],16,0xf6bb4b60UL) - HH(b,c,d,a,W[10],23,0xbebfbc70UL) - HH(a,b,c,d,W[13],4,0x289b7ec6UL) - HH(d,a,b,c,W[0],11,0xeaa127faUL) - HH(c,d,a,b,W[3],16,0xd4ef3085UL) - HH(b,c,d,a,W[6],23,0x04881d05UL) - HH(a,b,c,d,W[9],4,0xd9d4d039UL) - HH(d,a,b,c,W[12],11,0xe6db99e5UL) - HH(c,d,a,b,W[15],16,0x1fa27cf8UL) - HH(b,c,d,a,W[2],23,0xc4ac5665UL) - II(a,b,c,d,W[0],6,0xf4292244UL) - II(d,a,b,c,W[7],10,0x432aff97UL) - II(c,d,a,b,W[14],15,0xab9423a7UL) - II(b,c,d,a,W[5],21,0xfc93a039UL) - II(a,b,c,d,W[12],6,0x655b59c3UL) - II(d,a,b,c,W[3],10,0x8f0ccc92UL) - II(c,d,a,b,W[10],15,0xffeff47dUL) - II(b,c,d,a,W[1],21,0x85845dd1UL) - II(a,b,c,d,W[8],6,0x6fa87e4fUL) - II(d,a,b,c,W[15],10,0xfe2ce6e0UL) - II(c,d,a,b,W[6],15,0xa3014314UL) - II(b,c,d,a,W[13],21,0x4e0811a1UL) - II(a,b,c,d,W[4],6,0xf7537e82UL) - II(d,a,b,c,W[11],10,0xbd3af235UL) - II(c,d,a,b,W[2],15,0x2ad7d2bbUL) - II(b,c,d,a,W[9],21,0xeb86d391UL) -#endif - - md->md5.state[0] = md->md5.state[0] + a; - md->md5.state[1] = md->md5.state[1] + b; - md->md5.state[2] = md->md5.state[2] + c; - md->md5.state[3] = md->md5.state[3] + d; - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -static int md5_compress(hash_state *md, unsigned char *buf) -{ - int err; - err = _md5_compress(md, buf); - burn_stack(sizeof(ulong32) * 21); - return err; -} -#endif - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int ltc_md5_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - md->md5.state[0] = 0x67452301UL; - md->md5.state[1] = 0xefcdab89UL; - md->md5.state[2] = 0x98badcfeUL; - md->md5.state[3] = 0x10325476UL; - md->md5.curlen = 0; - md->md5.length = 0; - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -HASH_PROCESS(ltc_md5_process, md5_compress, md5, 64) - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (16 bytes) - @return CRYPT_OK if successful -*/ -int ltc_md5_done(hash_state * md, unsigned char *out) -{ - int i; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->md5.curlen >= sizeof(md->md5.buf)) { - return CRYPT_INVALID_ARG; - } - - - /* increase the length of the message */ - md->md5.length += md->md5.curlen * 8; - - /* append the '1' bit */ - md->md5.buf[md->md5.curlen++] = (unsigned char)0x80; - - /* if the length is currently above 56 bytes we append zeros - * then compress. Then we can fall back to padding zeros and length - * encoding like normal. - */ - if (md->md5.curlen > 56) { - while (md->md5.curlen < 64) { - md->md5.buf[md->md5.curlen++] = (unsigned char)0; - } - md5_compress(md, md->md5.buf); - md->md5.curlen = 0; - } - - /* pad upto 56 bytes of zeroes */ - while (md->md5.curlen < 56) { - md->md5.buf[md->md5.curlen++] = (unsigned char)0; - } - - /* store length */ - STORE64L(md->md5.length, md->md5.buf+56); - md5_compress(md, md->md5.buf); - - /* copy output */ - for (i = 0; i < 4; i++) { - STORE32L(md->md5.state[i], out+(4*i)); - } -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int ltc_md5_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - static const struct { - char *msg; - unsigned char hash[16]; - } tests[] = { - { "", - { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, - 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e } }, - { "a", - {0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, - 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 } }, - { "abc", - { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, - 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 } }, - { "message digest", - { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d, - 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 } }, - { "abcdefghijklmnopqrstuvwxyz", - { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00, - 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b } }, - { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5, - 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f } }, - { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", - { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, - 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a } }, - { NULL, { 0 } } - }; - - int i; - unsigned char tmp[16]; - hash_state md; - - for (i = 0; tests[i].msg != NULL; i++) { - ltc_md5_init(&md); - ltc_md5_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); - ltc_md5_done(&md, tmp); - if (XMEMCMP(tmp, tests[i].hash, 16) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; - #endif -} - -#endif - - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/md5.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2007/05/12 14:25:28 $ */ DELETED Source/libtomcrypt/src/hashes/rmd128.c Index: Source/libtomcrypt/src/hashes/rmd128.c ================================================================== --- Source/libtomcrypt/src/hashes/rmd128.c +++ /dev/null @@ -1,410 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @param rmd128.c - RMD128 Hash function -*/ - -/* Implementation of LTC_RIPEMD-128 based on the source by Antoon Bosselaers, ESAT-COSIC - * - * This source has been radically overhauled to be portable and work within - * the LibTomCrypt API by Tom St Denis - */ - -#ifdef LTC_RIPEMD128 - -const struct ltc_hash_descriptor rmd128_desc = -{ - "rmd128", - 8, - 16, - 64, - - /* OID */ - { 1, 0, 10118, 3, 0, 50 }, - 6, - - &rmd128_init, - &rmd128_process, - &rmd128_done, - &rmd128_test, - NULL -}; - -/* the four basic functions F(), G() and H() */ -#define F(x, y, z) ((x) ^ (y) ^ (z)) -#define G(x, y, z) (((x) & (y)) | (~(x) & (z))) -#define H(x, y, z) (((x) | ~(y)) ^ (z)) -#define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) - -/* the eight basic operations FF() through III() */ -#define FF(a, b, c, d, x, s) \ - (a) += F((b), (c), (d)) + (x);\ - (a) = ROLc((a), (s)); - -#define GG(a, b, c, d, x, s) \ - (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ - (a) = ROLc((a), (s)); - -#define HH(a, b, c, d, x, s) \ - (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\ - (a) = ROLc((a), (s)); - -#define II(a, b, c, d, x, s) \ - (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcUL;\ - (a) = ROLc((a), (s)); - -#define FFF(a, b, c, d, x, s) \ - (a) += F((b), (c), (d)) + (x);\ - (a) = ROLc((a), (s)); - -#define GGG(a, b, c, d, x, s) \ - (a) += G((b), (c), (d)) + (x) + 0x6d703ef3UL;\ - (a) = ROLc((a), (s)); - -#define HHH(a, b, c, d, x, s) \ - (a) += H((b), (c), (d)) + (x) + 0x5c4dd124UL;\ - (a) = ROLc((a), (s)); - -#define III(a, b, c, d, x, s) \ - (a) += I((b), (c), (d)) + (x) + 0x50a28be6UL;\ - (a) = ROLc((a), (s)); - -#ifdef LTC_CLEAN_STACK -static int _rmd128_compress(hash_state *md, unsigned char *buf) -#else -static int rmd128_compress(hash_state *md, unsigned char *buf) -#endif -{ - ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,X[16]; - int i; - - /* load words X */ - for (i = 0; i < 16; i++){ - LOAD32L(X[i], buf + (4 * i)); - } - - /* load state */ - aa = aaa = md->rmd128.state[0]; - bb = bbb = md->rmd128.state[1]; - cc = ccc = md->rmd128.state[2]; - dd = ddd = md->rmd128.state[3]; - - /* round 1 */ - FF(aa, bb, cc, dd, X[ 0], 11); - FF(dd, aa, bb, cc, X[ 1], 14); - FF(cc, dd, aa, bb, X[ 2], 15); - FF(bb, cc, dd, aa, X[ 3], 12); - FF(aa, bb, cc, dd, X[ 4], 5); - FF(dd, aa, bb, cc, X[ 5], 8); - FF(cc, dd, aa, bb, X[ 6], 7); - FF(bb, cc, dd, aa, X[ 7], 9); - FF(aa, bb, cc, dd, X[ 8], 11); - FF(dd, aa, bb, cc, X[ 9], 13); - FF(cc, dd, aa, bb, X[10], 14); - FF(bb, cc, dd, aa, X[11], 15); - FF(aa, bb, cc, dd, X[12], 6); - FF(dd, aa, bb, cc, X[13], 7); - FF(cc, dd, aa, bb, X[14], 9); - FF(bb, cc, dd, aa, X[15], 8); - - /* round 2 */ - GG(aa, bb, cc, dd, X[ 7], 7); - GG(dd, aa, bb, cc, X[ 4], 6); - GG(cc, dd, aa, bb, X[13], 8); - GG(bb, cc, dd, aa, X[ 1], 13); - GG(aa, bb, cc, dd, X[10], 11); - GG(dd, aa, bb, cc, X[ 6], 9); - GG(cc, dd, aa, bb, X[15], 7); - GG(bb, cc, dd, aa, X[ 3], 15); - GG(aa, bb, cc, dd, X[12], 7); - GG(dd, aa, bb, cc, X[ 0], 12); - GG(cc, dd, aa, bb, X[ 9], 15); - GG(bb, cc, dd, aa, X[ 5], 9); - GG(aa, bb, cc, dd, X[ 2], 11); - GG(dd, aa, bb, cc, X[14], 7); - GG(cc, dd, aa, bb, X[11], 13); - GG(bb, cc, dd, aa, X[ 8], 12); - - /* round 3 */ - HH(aa, bb, cc, dd, X[ 3], 11); - HH(dd, aa, bb, cc, X[10], 13); - HH(cc, dd, aa, bb, X[14], 6); - HH(bb, cc, dd, aa, X[ 4], 7); - HH(aa, bb, cc, dd, X[ 9], 14); - HH(dd, aa, bb, cc, X[15], 9); - HH(cc, dd, aa, bb, X[ 8], 13); - HH(bb, cc, dd, aa, X[ 1], 15); - HH(aa, bb, cc, dd, X[ 2], 14); - HH(dd, aa, bb, cc, X[ 7], 8); - HH(cc, dd, aa, bb, X[ 0], 13); - HH(bb, cc, dd, aa, X[ 6], 6); - HH(aa, bb, cc, dd, X[13], 5); - HH(dd, aa, bb, cc, X[11], 12); - HH(cc, dd, aa, bb, X[ 5], 7); - HH(bb, cc, dd, aa, X[12], 5); - - /* round 4 */ - II(aa, bb, cc, dd, X[ 1], 11); - II(dd, aa, bb, cc, X[ 9], 12); - II(cc, dd, aa, bb, X[11], 14); - II(bb, cc, dd, aa, X[10], 15); - II(aa, bb, cc, dd, X[ 0], 14); - II(dd, aa, bb, cc, X[ 8], 15); - II(cc, dd, aa, bb, X[12], 9); - II(bb, cc, dd, aa, X[ 4], 8); - II(aa, bb, cc, dd, X[13], 9); - II(dd, aa, bb, cc, X[ 3], 14); - II(cc, dd, aa, bb, X[ 7], 5); - II(bb, cc, dd, aa, X[15], 6); - II(aa, bb, cc, dd, X[14], 8); - II(dd, aa, bb, cc, X[ 5], 6); - II(cc, dd, aa, bb, X[ 6], 5); - II(bb, cc, dd, aa, X[ 2], 12); - - /* parallel round 1 */ - III(aaa, bbb, ccc, ddd, X[ 5], 8); - III(ddd, aaa, bbb, ccc, X[14], 9); - III(ccc, ddd, aaa, bbb, X[ 7], 9); - III(bbb, ccc, ddd, aaa, X[ 0], 11); - III(aaa, bbb, ccc, ddd, X[ 9], 13); - III(ddd, aaa, bbb, ccc, X[ 2], 15); - III(ccc, ddd, aaa, bbb, X[11], 15); - III(bbb, ccc, ddd, aaa, X[ 4], 5); - III(aaa, bbb, ccc, ddd, X[13], 7); - III(ddd, aaa, bbb, ccc, X[ 6], 7); - III(ccc, ddd, aaa, bbb, X[15], 8); - III(bbb, ccc, ddd, aaa, X[ 8], 11); - III(aaa, bbb, ccc, ddd, X[ 1], 14); - III(ddd, aaa, bbb, ccc, X[10], 14); - III(ccc, ddd, aaa, bbb, X[ 3], 12); - III(bbb, ccc, ddd, aaa, X[12], 6); - - /* parallel round 2 */ - HHH(aaa, bbb, ccc, ddd, X[ 6], 9); - HHH(ddd, aaa, bbb, ccc, X[11], 13); - HHH(ccc, ddd, aaa, bbb, X[ 3], 15); - HHH(bbb, ccc, ddd, aaa, X[ 7], 7); - HHH(aaa, bbb, ccc, ddd, X[ 0], 12); - HHH(ddd, aaa, bbb, ccc, X[13], 8); - HHH(ccc, ddd, aaa, bbb, X[ 5], 9); - HHH(bbb, ccc, ddd, aaa, X[10], 11); - HHH(aaa, bbb, ccc, ddd, X[14], 7); - HHH(ddd, aaa, bbb, ccc, X[15], 7); - HHH(ccc, ddd, aaa, bbb, X[ 8], 12); - HHH(bbb, ccc, ddd, aaa, X[12], 7); - HHH(aaa, bbb, ccc, ddd, X[ 4], 6); - HHH(ddd, aaa, bbb, ccc, X[ 9], 15); - HHH(ccc, ddd, aaa, bbb, X[ 1], 13); - HHH(bbb, ccc, ddd, aaa, X[ 2], 11); - - /* parallel round 3 */ - GGG(aaa, bbb, ccc, ddd, X[15], 9); - GGG(ddd, aaa, bbb, ccc, X[ 5], 7); - GGG(ccc, ddd, aaa, bbb, X[ 1], 15); - GGG(bbb, ccc, ddd, aaa, X[ 3], 11); - GGG(aaa, bbb, ccc, ddd, X[ 7], 8); - GGG(ddd, aaa, bbb, ccc, X[14], 6); - GGG(ccc, ddd, aaa, bbb, X[ 6], 6); - GGG(bbb, ccc, ddd, aaa, X[ 9], 14); - GGG(aaa, bbb, ccc, ddd, X[11], 12); - GGG(ddd, aaa, bbb, ccc, X[ 8], 13); - GGG(ccc, ddd, aaa, bbb, X[12], 5); - GGG(bbb, ccc, ddd, aaa, X[ 2], 14); - GGG(aaa, bbb, ccc, ddd, X[10], 13); - GGG(ddd, aaa, bbb, ccc, X[ 0], 13); - GGG(ccc, ddd, aaa, bbb, X[ 4], 7); - GGG(bbb, ccc, ddd, aaa, X[13], 5); - - /* parallel round 4 */ - FFF(aaa, bbb, ccc, ddd, X[ 8], 15); - FFF(ddd, aaa, bbb, ccc, X[ 6], 5); - FFF(ccc, ddd, aaa, bbb, X[ 4], 8); - FFF(bbb, ccc, ddd, aaa, X[ 1], 11); - FFF(aaa, bbb, ccc, ddd, X[ 3], 14); - FFF(ddd, aaa, bbb, ccc, X[11], 14); - FFF(ccc, ddd, aaa, bbb, X[15], 6); - FFF(bbb, ccc, ddd, aaa, X[ 0], 14); - FFF(aaa, bbb, ccc, ddd, X[ 5], 6); - FFF(ddd, aaa, bbb, ccc, X[12], 9); - FFF(ccc, ddd, aaa, bbb, X[ 2], 12); - FFF(bbb, ccc, ddd, aaa, X[13], 9); - FFF(aaa, bbb, ccc, ddd, X[ 9], 12); - FFF(ddd, aaa, bbb, ccc, X[ 7], 5); - FFF(ccc, ddd, aaa, bbb, X[10], 15); - FFF(bbb, ccc, ddd, aaa, X[14], 8); - - /* combine results */ - ddd += cc + md->rmd128.state[1]; /* final result for MDbuf[0] */ - md->rmd128.state[1] = md->rmd128.state[2] + dd + aaa; - md->rmd128.state[2] = md->rmd128.state[3] + aa + bbb; - md->rmd128.state[3] = md->rmd128.state[0] + bb + ccc; - md->rmd128.state[0] = ddd; - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -static int rmd128_compress(hash_state *md, unsigned char *buf) -{ - int err; - err = _rmd128_compress(md, buf); - burn_stack(sizeof(ulong32) * 24 + sizeof(int)); - return err; -} -#endif - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int rmd128_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - md->rmd128.state[0] = 0x67452301UL; - md->rmd128.state[1] = 0xefcdab89UL; - md->rmd128.state[2] = 0x98badcfeUL; - md->rmd128.state[3] = 0x10325476UL; - md->rmd128.curlen = 0; - md->rmd128.length = 0; - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -HASH_PROCESS(rmd128_process, rmd128_compress, rmd128, 64) - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (16 bytes) - @return CRYPT_OK if successful -*/ -int rmd128_done(hash_state * md, unsigned char *out) -{ - int i; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->rmd128.curlen >= sizeof(md->rmd128.buf)) { - return CRYPT_INVALID_ARG; - } - - - /* increase the length of the message */ - md->rmd128.length += md->rmd128.curlen * 8; - - /* append the '1' bit */ - md->rmd128.buf[md->rmd128.curlen++] = (unsigned char)0x80; - - /* if the length is currently above 56 bytes we append zeros - * then compress. Then we can fall back to padding zeros and length - * encoding like normal. - */ - if (md->rmd128.curlen > 56) { - while (md->rmd128.curlen < 64) { - md->rmd128.buf[md->rmd128.curlen++] = (unsigned char)0; - } - rmd128_compress(md, md->rmd128.buf); - md->rmd128.curlen = 0; - } - - /* pad upto 56 bytes of zeroes */ - while (md->rmd128.curlen < 56) { - md->rmd128.buf[md->rmd128.curlen++] = (unsigned char)0; - } - - /* store length */ - STORE64L(md->rmd128.length, md->rmd128.buf+56); - rmd128_compress(md, md->rmd128.buf); - - /* copy output */ - for (i = 0; i < 4; i++) { - STORE32L(md->rmd128.state[i], out+(4*i)); - } -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int rmd128_test(void) -{ -#ifndef LTC_TEST - return CRYPT_NOP; -#else - static const struct { - char *msg; - unsigned char md[16]; - } tests[] = { - { "", - { 0xcd, 0xf2, 0x62, 0x13, 0xa1, 0x50, 0xdc, 0x3e, - 0xcb, 0x61, 0x0f, 0x18, 0xf6, 0xb3, 0x8b, 0x46 } - }, - { "a", - { 0x86, 0xbe, 0x7a, 0xfa, 0x33, 0x9d, 0x0f, 0xc7, - 0xcf, 0xc7, 0x85, 0xe7, 0x2f, 0x57, 0x8d, 0x33 } - }, - { "abc", - { 0xc1, 0x4a, 0x12, 0x19, 0x9c, 0x66, 0xe4, 0xba, - 0x84, 0x63, 0x6b, 0x0f, 0x69, 0x14, 0x4c, 0x77 } - }, - { "message digest", - { 0x9e, 0x32, 0x7b, 0x3d, 0x6e, 0x52, 0x30, 0x62, - 0xaf, 0xc1, 0x13, 0x2d, 0x7d, 0xf9, 0xd1, 0xb8 } - }, - { "abcdefghijklmnopqrstuvwxyz", - { 0xfd, 0x2a, 0xa6, 0x07, 0xf7, 0x1d, 0xc8, 0xf5, - 0x10, 0x71, 0x49, 0x22, 0xb3, 0x71, 0x83, 0x4e } - }, - { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - { 0xd1, 0xe9, 0x59, 0xeb, 0x17, 0x9c, 0x91, 0x1f, - 0xae, 0xa4, 0x62, 0x4c, 0x60, 0xc5, 0xc7, 0x02 } - } - }; - int x; - unsigned char buf[16]; - hash_state md; - - for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { - rmd128_init(&md); - rmd128_process(&md, (unsigned char *)tests[x].msg, strlen(tests[x].msg)); - rmd128_done(&md, buf); - if (XMEMCMP(buf, tests[x].md, 16) != 0) { - #if 0 - printf("Failed test %d\n", x); - #endif - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; -#endif -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd128.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2007/05/12 14:25:28 $ */ DELETED Source/libtomcrypt/src/hashes/rmd160.c Index: Source/libtomcrypt/src/hashes/rmd160.c ================================================================== --- Source/libtomcrypt/src/hashes/rmd160.c +++ /dev/null @@ -1,469 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file rmd160.c - RMD160 hash function -*/ - -/* Implementation of LTC_RIPEMD-160 based on the source by Antoon Bosselaers, ESAT-COSIC - * - * This source has been radically overhauled to be portable and work within - * the LibTomCrypt API by Tom St Denis - */ - -#ifdef LTC_RIPEMD160 - -const struct ltc_hash_descriptor rmd160_desc = -{ - "rmd160", - 9, - 20, - 64, - - /* OID */ - { 1, 3, 36, 3, 2, 1, }, - 6, - - &rmd160_init, - &rmd160_process, - &rmd160_done, - &rmd160_test, - NULL -}; - -/* the five basic functions F(), G() and H() */ -#define F(x, y, z) ((x) ^ (y) ^ (z)) -#define G(x, y, z) (((x) & (y)) | (~(x) & (z))) -#define H(x, y, z) (((x) | ~(y)) ^ (z)) -#define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) -#define J(x, y, z) ((x) ^ ((y) | ~(z))) - -/* the ten basic operations FF() through III() */ -#define FF(a, b, c, d, e, x, s) \ - (a) += F((b), (c), (d)) + (x);\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define GG(a, b, c, d, e, x, s) \ - (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define HH(a, b, c, d, e, x, s) \ - (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define II(a, b, c, d, e, x, s) \ - (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcUL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define JJ(a, b, c, d, e, x, s) \ - (a) += J((b), (c), (d)) + (x) + 0xa953fd4eUL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define FFF(a, b, c, d, e, x, s) \ - (a) += F((b), (c), (d)) + (x);\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define GGG(a, b, c, d, e, x, s) \ - (a) += G((b), (c), (d)) + (x) + 0x7a6d76e9UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define HHH(a, b, c, d, e, x, s) \ - (a) += H((b), (c), (d)) + (x) + 0x6d703ef3UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define III(a, b, c, d, e, x, s) \ - (a) += I((b), (c), (d)) + (x) + 0x5c4dd124UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define JJJ(a, b, c, d, e, x, s) \ - (a) += J((b), (c), (d)) + (x) + 0x50a28be6UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - - -#ifdef LTC_CLEAN_STACK -static int _rmd160_compress(hash_state *md, unsigned char *buf) -#else -static int rmd160_compress(hash_state *md, unsigned char *buf) -#endif -{ - ulong32 aa,bb,cc,dd,ee,aaa,bbb,ccc,ddd,eee,X[16]; - int i; - - /* load words X */ - for (i = 0; i < 16; i++){ - LOAD32L(X[i], buf + (4 * i)); - } - - /* load state */ - aa = aaa = md->rmd160.state[0]; - bb = bbb = md->rmd160.state[1]; - cc = ccc = md->rmd160.state[2]; - dd = ddd = md->rmd160.state[3]; - ee = eee = md->rmd160.state[4]; - - /* round 1 */ - FF(aa, bb, cc, dd, ee, X[ 0], 11); - FF(ee, aa, bb, cc, dd, X[ 1], 14); - FF(dd, ee, aa, bb, cc, X[ 2], 15); - FF(cc, dd, ee, aa, bb, X[ 3], 12); - FF(bb, cc, dd, ee, aa, X[ 4], 5); - FF(aa, bb, cc, dd, ee, X[ 5], 8); - FF(ee, aa, bb, cc, dd, X[ 6], 7); - FF(dd, ee, aa, bb, cc, X[ 7], 9); - FF(cc, dd, ee, aa, bb, X[ 8], 11); - FF(bb, cc, dd, ee, aa, X[ 9], 13); - FF(aa, bb, cc, dd, ee, X[10], 14); - FF(ee, aa, bb, cc, dd, X[11], 15); - FF(dd, ee, aa, bb, cc, X[12], 6); - FF(cc, dd, ee, aa, bb, X[13], 7); - FF(bb, cc, dd, ee, aa, X[14], 9); - FF(aa, bb, cc, dd, ee, X[15], 8); - - /* round 2 */ - GG(ee, aa, bb, cc, dd, X[ 7], 7); - GG(dd, ee, aa, bb, cc, X[ 4], 6); - GG(cc, dd, ee, aa, bb, X[13], 8); - GG(bb, cc, dd, ee, aa, X[ 1], 13); - GG(aa, bb, cc, dd, ee, X[10], 11); - GG(ee, aa, bb, cc, dd, X[ 6], 9); - GG(dd, ee, aa, bb, cc, X[15], 7); - GG(cc, dd, ee, aa, bb, X[ 3], 15); - GG(bb, cc, dd, ee, aa, X[12], 7); - GG(aa, bb, cc, dd, ee, X[ 0], 12); - GG(ee, aa, bb, cc, dd, X[ 9], 15); - GG(dd, ee, aa, bb, cc, X[ 5], 9); - GG(cc, dd, ee, aa, bb, X[ 2], 11); - GG(bb, cc, dd, ee, aa, X[14], 7); - GG(aa, bb, cc, dd, ee, X[11], 13); - GG(ee, aa, bb, cc, dd, X[ 8], 12); - - /* round 3 */ - HH(dd, ee, aa, bb, cc, X[ 3], 11); - HH(cc, dd, ee, aa, bb, X[10], 13); - HH(bb, cc, dd, ee, aa, X[14], 6); - HH(aa, bb, cc, dd, ee, X[ 4], 7); - HH(ee, aa, bb, cc, dd, X[ 9], 14); - HH(dd, ee, aa, bb, cc, X[15], 9); - HH(cc, dd, ee, aa, bb, X[ 8], 13); - HH(bb, cc, dd, ee, aa, X[ 1], 15); - HH(aa, bb, cc, dd, ee, X[ 2], 14); - HH(ee, aa, bb, cc, dd, X[ 7], 8); - HH(dd, ee, aa, bb, cc, X[ 0], 13); - HH(cc, dd, ee, aa, bb, X[ 6], 6); - HH(bb, cc, dd, ee, aa, X[13], 5); - HH(aa, bb, cc, dd, ee, X[11], 12); - HH(ee, aa, bb, cc, dd, X[ 5], 7); - HH(dd, ee, aa, bb, cc, X[12], 5); - - /* round 4 */ - II(cc, dd, ee, aa, bb, X[ 1], 11); - II(bb, cc, dd, ee, aa, X[ 9], 12); - II(aa, bb, cc, dd, ee, X[11], 14); - II(ee, aa, bb, cc, dd, X[10], 15); - II(dd, ee, aa, bb, cc, X[ 0], 14); - II(cc, dd, ee, aa, bb, X[ 8], 15); - II(bb, cc, dd, ee, aa, X[12], 9); - II(aa, bb, cc, dd, ee, X[ 4], 8); - II(ee, aa, bb, cc, dd, X[13], 9); - II(dd, ee, aa, bb, cc, X[ 3], 14); - II(cc, dd, ee, aa, bb, X[ 7], 5); - II(bb, cc, dd, ee, aa, X[15], 6); - II(aa, bb, cc, dd, ee, X[14], 8); - II(ee, aa, bb, cc, dd, X[ 5], 6); - II(dd, ee, aa, bb, cc, X[ 6], 5); - II(cc, dd, ee, aa, bb, X[ 2], 12); - - /* round 5 */ - JJ(bb, cc, dd, ee, aa, X[ 4], 9); - JJ(aa, bb, cc, dd, ee, X[ 0], 15); - JJ(ee, aa, bb, cc, dd, X[ 5], 5); - JJ(dd, ee, aa, bb, cc, X[ 9], 11); - JJ(cc, dd, ee, aa, bb, X[ 7], 6); - JJ(bb, cc, dd, ee, aa, X[12], 8); - JJ(aa, bb, cc, dd, ee, X[ 2], 13); - JJ(ee, aa, bb, cc, dd, X[10], 12); - JJ(dd, ee, aa, bb, cc, X[14], 5); - JJ(cc, dd, ee, aa, bb, X[ 1], 12); - JJ(bb, cc, dd, ee, aa, X[ 3], 13); - JJ(aa, bb, cc, dd, ee, X[ 8], 14); - JJ(ee, aa, bb, cc, dd, X[11], 11); - JJ(dd, ee, aa, bb, cc, X[ 6], 8); - JJ(cc, dd, ee, aa, bb, X[15], 5); - JJ(bb, cc, dd, ee, aa, X[13], 6); - - /* parallel round 1 */ - JJJ(aaa, bbb, ccc, ddd, eee, X[ 5], 8); - JJJ(eee, aaa, bbb, ccc, ddd, X[14], 9); - JJJ(ddd, eee, aaa, bbb, ccc, X[ 7], 9); - JJJ(ccc, ddd, eee, aaa, bbb, X[ 0], 11); - JJJ(bbb, ccc, ddd, eee, aaa, X[ 9], 13); - JJJ(aaa, bbb, ccc, ddd, eee, X[ 2], 15); - JJJ(eee, aaa, bbb, ccc, ddd, X[11], 15); - JJJ(ddd, eee, aaa, bbb, ccc, X[ 4], 5); - JJJ(ccc, ddd, eee, aaa, bbb, X[13], 7); - JJJ(bbb, ccc, ddd, eee, aaa, X[ 6], 7); - JJJ(aaa, bbb, ccc, ddd, eee, X[15], 8); - JJJ(eee, aaa, bbb, ccc, ddd, X[ 8], 11); - JJJ(ddd, eee, aaa, bbb, ccc, X[ 1], 14); - JJJ(ccc, ddd, eee, aaa, bbb, X[10], 14); - JJJ(bbb, ccc, ddd, eee, aaa, X[ 3], 12); - JJJ(aaa, bbb, ccc, ddd, eee, X[12], 6); - - /* parallel round 2 */ - III(eee, aaa, bbb, ccc, ddd, X[ 6], 9); - III(ddd, eee, aaa, bbb, ccc, X[11], 13); - III(ccc, ddd, eee, aaa, bbb, X[ 3], 15); - III(bbb, ccc, ddd, eee, aaa, X[ 7], 7); - III(aaa, bbb, ccc, ddd, eee, X[ 0], 12); - III(eee, aaa, bbb, ccc, ddd, X[13], 8); - III(ddd, eee, aaa, bbb, ccc, X[ 5], 9); - III(ccc, ddd, eee, aaa, bbb, X[10], 11); - III(bbb, ccc, ddd, eee, aaa, X[14], 7); - III(aaa, bbb, ccc, ddd, eee, X[15], 7); - III(eee, aaa, bbb, ccc, ddd, X[ 8], 12); - III(ddd, eee, aaa, bbb, ccc, X[12], 7); - III(ccc, ddd, eee, aaa, bbb, X[ 4], 6); - III(bbb, ccc, ddd, eee, aaa, X[ 9], 15); - III(aaa, bbb, ccc, ddd, eee, X[ 1], 13); - III(eee, aaa, bbb, ccc, ddd, X[ 2], 11); - - /* parallel round 3 */ - HHH(ddd, eee, aaa, bbb, ccc, X[15], 9); - HHH(ccc, ddd, eee, aaa, bbb, X[ 5], 7); - HHH(bbb, ccc, ddd, eee, aaa, X[ 1], 15); - HHH(aaa, bbb, ccc, ddd, eee, X[ 3], 11); - HHH(eee, aaa, bbb, ccc, ddd, X[ 7], 8); - HHH(ddd, eee, aaa, bbb, ccc, X[14], 6); - HHH(ccc, ddd, eee, aaa, bbb, X[ 6], 6); - HHH(bbb, ccc, ddd, eee, aaa, X[ 9], 14); - HHH(aaa, bbb, ccc, ddd, eee, X[11], 12); - HHH(eee, aaa, bbb, ccc, ddd, X[ 8], 13); - HHH(ddd, eee, aaa, bbb, ccc, X[12], 5); - HHH(ccc, ddd, eee, aaa, bbb, X[ 2], 14); - HHH(bbb, ccc, ddd, eee, aaa, X[10], 13); - HHH(aaa, bbb, ccc, ddd, eee, X[ 0], 13); - HHH(eee, aaa, bbb, ccc, ddd, X[ 4], 7); - HHH(ddd, eee, aaa, bbb, ccc, X[13], 5); - - /* parallel round 4 */ - GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15); - GGG(bbb, ccc, ddd, eee, aaa, X[ 6], 5); - GGG(aaa, bbb, ccc, ddd, eee, X[ 4], 8); - GGG(eee, aaa, bbb, ccc, ddd, X[ 1], 11); - GGG(ddd, eee, aaa, bbb, ccc, X[ 3], 14); - GGG(ccc, ddd, eee, aaa, bbb, X[11], 14); - GGG(bbb, ccc, ddd, eee, aaa, X[15], 6); - GGG(aaa, bbb, ccc, ddd, eee, X[ 0], 14); - GGG(eee, aaa, bbb, ccc, ddd, X[ 5], 6); - GGG(ddd, eee, aaa, bbb, ccc, X[12], 9); - GGG(ccc, ddd, eee, aaa, bbb, X[ 2], 12); - GGG(bbb, ccc, ddd, eee, aaa, X[13], 9); - GGG(aaa, bbb, ccc, ddd, eee, X[ 9], 12); - GGG(eee, aaa, bbb, ccc, ddd, X[ 7], 5); - GGG(ddd, eee, aaa, bbb, ccc, X[10], 15); - GGG(ccc, ddd, eee, aaa, bbb, X[14], 8); - - /* parallel round 5 */ - FFF(bbb, ccc, ddd, eee, aaa, X[12] , 8); - FFF(aaa, bbb, ccc, ddd, eee, X[15] , 5); - FFF(eee, aaa, bbb, ccc, ddd, X[10] , 12); - FFF(ddd, eee, aaa, bbb, ccc, X[ 4] , 9); - FFF(ccc, ddd, eee, aaa, bbb, X[ 1] , 12); - FFF(bbb, ccc, ddd, eee, aaa, X[ 5] , 5); - FFF(aaa, bbb, ccc, ddd, eee, X[ 8] , 14); - FFF(eee, aaa, bbb, ccc, ddd, X[ 7] , 6); - FFF(ddd, eee, aaa, bbb, ccc, X[ 6] , 8); - FFF(ccc, ddd, eee, aaa, bbb, X[ 2] , 13); - FFF(bbb, ccc, ddd, eee, aaa, X[13] , 6); - FFF(aaa, bbb, ccc, ddd, eee, X[14] , 5); - FFF(eee, aaa, bbb, ccc, ddd, X[ 0] , 15); - FFF(ddd, eee, aaa, bbb, ccc, X[ 3] , 13); - FFF(ccc, ddd, eee, aaa, bbb, X[ 9] , 11); - FFF(bbb, ccc, ddd, eee, aaa, X[11] , 11); - - /* combine results */ - ddd += cc + md->rmd160.state[1]; /* final result for md->rmd160.state[0] */ - md->rmd160.state[1] = md->rmd160.state[2] + dd + eee; - md->rmd160.state[2] = md->rmd160.state[3] + ee + aaa; - md->rmd160.state[3] = md->rmd160.state[4] + aa + bbb; - md->rmd160.state[4] = md->rmd160.state[0] + bb + ccc; - md->rmd160.state[0] = ddd; - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -static int rmd160_compress(hash_state *md, unsigned char *buf) -{ - int err; - err = _rmd160_compress(md, buf); - burn_stack(sizeof(ulong32) * 26 + sizeof(int)); - return err; -} -#endif - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int rmd160_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - md->rmd160.state[0] = 0x67452301UL; - md->rmd160.state[1] = 0xefcdab89UL; - md->rmd160.state[2] = 0x98badcfeUL; - md->rmd160.state[3] = 0x10325476UL; - md->rmd160.state[4] = 0xc3d2e1f0UL; - md->rmd160.curlen = 0; - md->rmd160.length = 0; - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -HASH_PROCESS(rmd160_process, rmd160_compress, rmd160, 64) - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (20 bytes) - @return CRYPT_OK if successful -*/ -int rmd160_done(hash_state * md, unsigned char *out) -{ - int i; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->rmd160.curlen >= sizeof(md->rmd160.buf)) { - return CRYPT_INVALID_ARG; - } - - - /* increase the length of the message */ - md->rmd160.length += md->rmd160.curlen * 8; - - /* append the '1' bit */ - md->rmd160.buf[md->rmd160.curlen++] = (unsigned char)0x80; - - /* if the length is currently above 56 bytes we append zeros - * then compress. Then we can fall back to padding zeros and length - * encoding like normal. - */ - if (md->rmd160.curlen > 56) { - while (md->rmd160.curlen < 64) { - md->rmd160.buf[md->rmd160.curlen++] = (unsigned char)0; - } - rmd160_compress(md, md->rmd160.buf); - md->rmd160.curlen = 0; - } - - /* pad upto 56 bytes of zeroes */ - while (md->rmd160.curlen < 56) { - md->rmd160.buf[md->rmd160.curlen++] = (unsigned char)0; - } - - /* store length */ - STORE64L(md->rmd160.length, md->rmd160.buf+56); - rmd160_compress(md, md->rmd160.buf); - - /* copy output */ - for (i = 0; i < 5; i++) { - STORE32L(md->rmd160.state[i], out+(4*i)); - } -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int rmd160_test(void) -{ -#ifndef LTC_TEST - return CRYPT_NOP; -#else - static const struct { - char *msg; - unsigned char md[20]; - } tests[] = { - { "", - { 0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54, 0x61, 0x28, - 0x08, 0x97, 0x7e, 0xe8, 0xf5, 0x48, 0xb2, 0x25, 0x8d, 0x31 } - }, - { "a", - { 0x0b, 0xdc, 0x9d, 0x2d, 0x25, 0x6b, 0x3e, 0xe9, 0xda, 0xae, - 0x34, 0x7b, 0xe6, 0xf4, 0xdc, 0x83, 0x5a, 0x46, 0x7f, 0xfe } - }, - { "abc", - { 0x8e, 0xb2, 0x08, 0xf7, 0xe0, 0x5d, 0x98, 0x7a, 0x9b, 0x04, - 0x4a, 0x8e, 0x98, 0xc6, 0xb0, 0x87, 0xf1, 0x5a, 0x0b, 0xfc } - }, - { "message digest", - { 0x5d, 0x06, 0x89, 0xef, 0x49, 0xd2, 0xfa, 0xe5, 0x72, 0xb8, - 0x81, 0xb1, 0x23, 0xa8, 0x5f, 0xfa, 0x21, 0x59, 0x5f, 0x36 } - }, - { "abcdefghijklmnopqrstuvwxyz", - { 0xf7, 0x1c, 0x27, 0x10, 0x9c, 0x69, 0x2c, 0x1b, 0x56, 0xbb, - 0xdc, 0xeb, 0x5b, 0x9d, 0x28, 0x65, 0xb3, 0x70, 0x8d, 0xbc } - }, - { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - { 0x12, 0xa0, 0x53, 0x38, 0x4a, 0x9c, 0x0c, 0x88, 0xe4, 0x05, - 0xa0, 0x6c, 0x27, 0xdc, 0xf4, 0x9a, 0xda, 0x62, 0xeb, 0x2b } - } - }; - int x; - unsigned char buf[20]; - hash_state md; - - for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { - rmd160_init(&md); - rmd160_process(&md, (unsigned char *)tests[x].msg, strlen(tests[x].msg)); - rmd160_done(&md, buf); - if (XMEMCMP(buf, tests[x].md, 20) != 0) { -#if 0 - printf("Failed test %d\n", x); -#endif - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; -#endif -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd160.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2007/05/12 14:25:28 $ */ DELETED Source/libtomcrypt/src/hashes/rmd256.c Index: Source/libtomcrypt/src/hashes/rmd256.c ================================================================== --- Source/libtomcrypt/src/hashes/rmd256.c +++ /dev/null @@ -1,431 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @param rmd256.c - RLTC_MD256 Hash function -*/ - -#ifdef LTC_RIPEMD256 - -const struct ltc_hash_descriptor rmd256_desc = -{ - "rmd256", - 11, - 32, - 64, - - /* OID */ - { 1, 3, 36, 3, 2, 3 }, - 6, - - &rmd256_init, - &rmd256_process, - &rmd256_done, - &rmd256_test, - NULL -}; - -/* the four basic functions F(), G() and H() */ -#define F(x, y, z) ((x) ^ (y) ^ (z)) -#define G(x, y, z) (((x) & (y)) | (~(x) & (z))) -#define H(x, y, z) (((x) | ~(y)) ^ (z)) -#define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) - -/* the eight basic operations FF() through III() */ -#define FF(a, b, c, d, x, s) \ - (a) += F((b), (c), (d)) + (x);\ - (a) = ROLc((a), (s)); - -#define GG(a, b, c, d, x, s) \ - (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ - (a) = ROLc((a), (s)); - -#define HH(a, b, c, d, x, s) \ - (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\ - (a) = ROLc((a), (s)); - -#define II(a, b, c, d, x, s) \ - (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcUL;\ - (a) = ROLc((a), (s)); - -#define FFF(a, b, c, d, x, s) \ - (a) += F((b), (c), (d)) + (x);\ - (a) = ROLc((a), (s)); - -#define GGG(a, b, c, d, x, s) \ - (a) += G((b), (c), (d)) + (x) + 0x6d703ef3UL;\ - (a) = ROLc((a), (s)); - -#define HHH(a, b, c, d, x, s) \ - (a) += H((b), (c), (d)) + (x) + 0x5c4dd124UL;\ - (a) = ROLc((a), (s)); - -#define III(a, b, c, d, x, s) \ - (a) += I((b), (c), (d)) + (x) + 0x50a28be6UL;\ - (a) = ROLc((a), (s)); - -#ifdef LTC_CLEAN_STACK -static int _rmd256_compress(hash_state *md, unsigned char *buf) -#else -static int rmd256_compress(hash_state *md, unsigned char *buf) -#endif -{ - ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,tmp,X[16]; - int i; - - /* load words X */ - for (i = 0; i < 16; i++){ - LOAD32L(X[i], buf + (4 * i)); - } - - /* load state */ - aa = md->rmd256.state[0]; - bb = md->rmd256.state[1]; - cc = md->rmd256.state[2]; - dd = md->rmd256.state[3]; - aaa = md->rmd256.state[4]; - bbb = md->rmd256.state[5]; - ccc = md->rmd256.state[6]; - ddd = md->rmd256.state[7]; - - /* round 1 */ - FF(aa, bb, cc, dd, X[ 0], 11); - FF(dd, aa, bb, cc, X[ 1], 14); - FF(cc, dd, aa, bb, X[ 2], 15); - FF(bb, cc, dd, aa, X[ 3], 12); - FF(aa, bb, cc, dd, X[ 4], 5); - FF(dd, aa, bb, cc, X[ 5], 8); - FF(cc, dd, aa, bb, X[ 6], 7); - FF(bb, cc, dd, aa, X[ 7], 9); - FF(aa, bb, cc, dd, X[ 8], 11); - FF(dd, aa, bb, cc, X[ 9], 13); - FF(cc, dd, aa, bb, X[10], 14); - FF(bb, cc, dd, aa, X[11], 15); - FF(aa, bb, cc, dd, X[12], 6); - FF(dd, aa, bb, cc, X[13], 7); - FF(cc, dd, aa, bb, X[14], 9); - FF(bb, cc, dd, aa, X[15], 8); - - /* parallel round 1 */ - III(aaa, bbb, ccc, ddd, X[ 5], 8); - III(ddd, aaa, bbb, ccc, X[14], 9); - III(ccc, ddd, aaa, bbb, X[ 7], 9); - III(bbb, ccc, ddd, aaa, X[ 0], 11); - III(aaa, bbb, ccc, ddd, X[ 9], 13); - III(ddd, aaa, bbb, ccc, X[ 2], 15); - III(ccc, ddd, aaa, bbb, X[11], 15); - III(bbb, ccc, ddd, aaa, X[ 4], 5); - III(aaa, bbb, ccc, ddd, X[13], 7); - III(ddd, aaa, bbb, ccc, X[ 6], 7); - III(ccc, ddd, aaa, bbb, X[15], 8); - III(bbb, ccc, ddd, aaa, X[ 8], 11); - III(aaa, bbb, ccc, ddd, X[ 1], 14); - III(ddd, aaa, bbb, ccc, X[10], 14); - III(ccc, ddd, aaa, bbb, X[ 3], 12); - III(bbb, ccc, ddd, aaa, X[12], 6); - - tmp = aa; aa = aaa; aaa = tmp; - - /* round 2 */ - GG(aa, bb, cc, dd, X[ 7], 7); - GG(dd, aa, bb, cc, X[ 4], 6); - GG(cc, dd, aa, bb, X[13], 8); - GG(bb, cc, dd, aa, X[ 1], 13); - GG(aa, bb, cc, dd, X[10], 11); - GG(dd, aa, bb, cc, X[ 6], 9); - GG(cc, dd, aa, bb, X[15], 7); - GG(bb, cc, dd, aa, X[ 3], 15); - GG(aa, bb, cc, dd, X[12], 7); - GG(dd, aa, bb, cc, X[ 0], 12); - GG(cc, dd, aa, bb, X[ 9], 15); - GG(bb, cc, dd, aa, X[ 5], 9); - GG(aa, bb, cc, dd, X[ 2], 11); - GG(dd, aa, bb, cc, X[14], 7); - GG(cc, dd, aa, bb, X[11], 13); - GG(bb, cc, dd, aa, X[ 8], 12); - - /* parallel round 2 */ - HHH(aaa, bbb, ccc, ddd, X[ 6], 9); - HHH(ddd, aaa, bbb, ccc, X[11], 13); - HHH(ccc, ddd, aaa, bbb, X[ 3], 15); - HHH(bbb, ccc, ddd, aaa, X[ 7], 7); - HHH(aaa, bbb, ccc, ddd, X[ 0], 12); - HHH(ddd, aaa, bbb, ccc, X[13], 8); - HHH(ccc, ddd, aaa, bbb, X[ 5], 9); - HHH(bbb, ccc, ddd, aaa, X[10], 11); - HHH(aaa, bbb, ccc, ddd, X[14], 7); - HHH(ddd, aaa, bbb, ccc, X[15], 7); - HHH(ccc, ddd, aaa, bbb, X[ 8], 12); - HHH(bbb, ccc, ddd, aaa, X[12], 7); - HHH(aaa, bbb, ccc, ddd, X[ 4], 6); - HHH(ddd, aaa, bbb, ccc, X[ 9], 15); - HHH(ccc, ddd, aaa, bbb, X[ 1], 13); - HHH(bbb, ccc, ddd, aaa, X[ 2], 11); - - tmp = bb; bb = bbb; bbb = tmp; - - /* round 3 */ - HH(aa, bb, cc, dd, X[ 3], 11); - HH(dd, aa, bb, cc, X[10], 13); - HH(cc, dd, aa, bb, X[14], 6); - HH(bb, cc, dd, aa, X[ 4], 7); - HH(aa, bb, cc, dd, X[ 9], 14); - HH(dd, aa, bb, cc, X[15], 9); - HH(cc, dd, aa, bb, X[ 8], 13); - HH(bb, cc, dd, aa, X[ 1], 15); - HH(aa, bb, cc, dd, X[ 2], 14); - HH(dd, aa, bb, cc, X[ 7], 8); - HH(cc, dd, aa, bb, X[ 0], 13); - HH(bb, cc, dd, aa, X[ 6], 6); - HH(aa, bb, cc, dd, X[13], 5); - HH(dd, aa, bb, cc, X[11], 12); - HH(cc, dd, aa, bb, X[ 5], 7); - HH(bb, cc, dd, aa, X[12], 5); - - /* parallel round 3 */ - GGG(aaa, bbb, ccc, ddd, X[15], 9); - GGG(ddd, aaa, bbb, ccc, X[ 5], 7); - GGG(ccc, ddd, aaa, bbb, X[ 1], 15); - GGG(bbb, ccc, ddd, aaa, X[ 3], 11); - GGG(aaa, bbb, ccc, ddd, X[ 7], 8); - GGG(ddd, aaa, bbb, ccc, X[14], 6); - GGG(ccc, ddd, aaa, bbb, X[ 6], 6); - GGG(bbb, ccc, ddd, aaa, X[ 9], 14); - GGG(aaa, bbb, ccc, ddd, X[11], 12); - GGG(ddd, aaa, bbb, ccc, X[ 8], 13); - GGG(ccc, ddd, aaa, bbb, X[12], 5); - GGG(bbb, ccc, ddd, aaa, X[ 2], 14); - GGG(aaa, bbb, ccc, ddd, X[10], 13); - GGG(ddd, aaa, bbb, ccc, X[ 0], 13); - GGG(ccc, ddd, aaa, bbb, X[ 4], 7); - GGG(bbb, ccc, ddd, aaa, X[13], 5); - - tmp = cc; cc = ccc; ccc = tmp; - - /* round 4 */ - II(aa, bb, cc, dd, X[ 1], 11); - II(dd, aa, bb, cc, X[ 9], 12); - II(cc, dd, aa, bb, X[11], 14); - II(bb, cc, dd, aa, X[10], 15); - II(aa, bb, cc, dd, X[ 0], 14); - II(dd, aa, bb, cc, X[ 8], 15); - II(cc, dd, aa, bb, X[12], 9); - II(bb, cc, dd, aa, X[ 4], 8); - II(aa, bb, cc, dd, X[13], 9); - II(dd, aa, bb, cc, X[ 3], 14); - II(cc, dd, aa, bb, X[ 7], 5); - II(bb, cc, dd, aa, X[15], 6); - II(aa, bb, cc, dd, X[14], 8); - II(dd, aa, bb, cc, X[ 5], 6); - II(cc, dd, aa, bb, X[ 6], 5); - II(bb, cc, dd, aa, X[ 2], 12); - - /* parallel round 4 */ - FFF(aaa, bbb, ccc, ddd, X[ 8], 15); - FFF(ddd, aaa, bbb, ccc, X[ 6], 5); - FFF(ccc, ddd, aaa, bbb, X[ 4], 8); - FFF(bbb, ccc, ddd, aaa, X[ 1], 11); - FFF(aaa, bbb, ccc, ddd, X[ 3], 14); - FFF(ddd, aaa, bbb, ccc, X[11], 14); - FFF(ccc, ddd, aaa, bbb, X[15], 6); - FFF(bbb, ccc, ddd, aaa, X[ 0], 14); - FFF(aaa, bbb, ccc, ddd, X[ 5], 6); - FFF(ddd, aaa, bbb, ccc, X[12], 9); - FFF(ccc, ddd, aaa, bbb, X[ 2], 12); - FFF(bbb, ccc, ddd, aaa, X[13], 9); - FFF(aaa, bbb, ccc, ddd, X[ 9], 12); - FFF(ddd, aaa, bbb, ccc, X[ 7], 5); - FFF(ccc, ddd, aaa, bbb, X[10], 15); - FFF(bbb, ccc, ddd, aaa, X[14], 8); - - tmp = dd; dd = ddd; ddd = tmp; - - /* combine results */ - md->rmd256.state[0] += aa; - md->rmd256.state[1] += bb; - md->rmd256.state[2] += cc; - md->rmd256.state[3] += dd; - md->rmd256.state[4] += aaa; - md->rmd256.state[5] += bbb; - md->rmd256.state[6] += ccc; - md->rmd256.state[7] += ddd; - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -static int rmd256_compress(hash_state *md, unsigned char *buf) -{ - int err; - err = _rmd256_compress(md, buf); - burn_stack(sizeof(ulong32) * 25 + sizeof(int)); - return err; -} -#endif - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int rmd256_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - md->rmd256.state[0] = 0x67452301UL; - md->rmd256.state[1] = 0xefcdab89UL; - md->rmd256.state[2] = 0x98badcfeUL; - md->rmd256.state[3] = 0x10325476UL; - md->rmd256.state[4] = 0x76543210UL; - md->rmd256.state[5] = 0xfedcba98UL; - md->rmd256.state[6] = 0x89abcdefUL; - md->rmd256.state[7] = 0x01234567UL; - md->rmd256.curlen = 0; - md->rmd256.length = 0; - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -HASH_PROCESS(rmd256_process, rmd256_compress, rmd256, 64) - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (16 bytes) - @return CRYPT_OK if successful -*/ -int rmd256_done(hash_state * md, unsigned char *out) -{ - int i; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->rmd256.curlen >= sizeof(md->rmd256.buf)) { - return CRYPT_INVALID_ARG; - } - - - /* increase the length of the message */ - md->rmd256.length += md->rmd256.curlen * 8; - - /* append the '1' bit */ - md->rmd256.buf[md->rmd256.curlen++] = (unsigned char)0x80; - - /* if the length is currently above 56 bytes we append zeros - * then compress. Then we can fall back to padding zeros and length - * encoding like normal. - */ - if (md->rmd256.curlen > 56) { - while (md->rmd256.curlen < 64) { - md->rmd256.buf[md->rmd256.curlen++] = (unsigned char)0; - } - rmd256_compress(md, md->rmd256.buf); - md->rmd256.curlen = 0; - } - - /* pad upto 56 bytes of zeroes */ - while (md->rmd256.curlen < 56) { - md->rmd256.buf[md->rmd256.curlen++] = (unsigned char)0; - } - - /* store length */ - STORE64L(md->rmd256.length, md->rmd256.buf+56); - rmd256_compress(md, md->rmd256.buf); - - /* copy output */ - for (i = 0; i < 8; i++) { - STORE32L(md->rmd256.state[i], out+(4*i)); - } -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int rmd256_test(void) -{ -#ifndef LTC_TEST - return CRYPT_NOP; -#else - static const struct { - char *msg; - unsigned char md[32]; - } tests[] = { - { "", - { 0x02, 0xba, 0x4c, 0x4e, 0x5f, 0x8e, 0xcd, 0x18, - 0x77, 0xfc, 0x52, 0xd6, 0x4d, 0x30, 0xe3, 0x7a, - 0x2d, 0x97, 0x74, 0xfb, 0x1e, 0x5d, 0x02, 0x63, - 0x80, 0xae, 0x01, 0x68, 0xe3, 0xc5, 0x52, 0x2d } - }, - { "a", - { 0xf9, 0x33, 0x3e, 0x45, 0xd8, 0x57, 0xf5, 0xd9, - 0x0a, 0x91, 0xba, 0xb7, 0x0a, 0x1e, 0xba, 0x0c, - 0xfb, 0x1b, 0xe4, 0xb0, 0x78, 0x3c, 0x9a, 0xcf, - 0xcd, 0x88, 0x3a, 0x91, 0x34, 0x69, 0x29, 0x25 } - }, - { "abc", - { 0xaf, 0xbd, 0x6e, 0x22, 0x8b, 0x9d, 0x8c, 0xbb, - 0xce, 0xf5, 0xca, 0x2d, 0x03, 0xe6, 0xdb, 0xa1, - 0x0a, 0xc0, 0xbc, 0x7d, 0xcb, 0xe4, 0x68, 0x0e, - 0x1e, 0x42, 0xd2, 0xe9, 0x75, 0x45, 0x9b, 0x65 } - }, - { "message digest", - { 0x87, 0xe9, 0x71, 0x75, 0x9a, 0x1c, 0xe4, 0x7a, - 0x51, 0x4d, 0x5c, 0x91, 0x4c, 0x39, 0x2c, 0x90, - 0x18, 0xc7, 0xc4, 0x6b, 0xc1, 0x44, 0x65, 0x55, - 0x4a, 0xfc, 0xdf, 0x54, 0xa5, 0x07, 0x0c, 0x0e } - }, - { "abcdefghijklmnopqrstuvwxyz", - { 0x64, 0x9d, 0x30, 0x34, 0x75, 0x1e, 0xa2, 0x16, - 0x77, 0x6b, 0xf9, 0xa1, 0x8a, 0xcc, 0x81, 0xbc, - 0x78, 0x96, 0x11, 0x8a, 0x51, 0x97, 0x96, 0x87, - 0x82, 0xdd, 0x1f, 0xd9, 0x7d, 0x8d, 0x51, 0x33 } - }, - { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - { 0x57, 0x40, 0xa4, 0x08, 0xac, 0x16, 0xb7, 0x20, - 0xb8, 0x44, 0x24, 0xae, 0x93, 0x1c, 0xbb, 0x1f, - 0xe3, 0x63, 0xd1, 0xd0, 0xbf, 0x40, 0x17, 0xf1, - 0xa8, 0x9f, 0x7e, 0xa6, 0xde, 0x77, 0xa0, 0xb8 } - } - }; - int x; - unsigned char buf[32]; - hash_state md; - - for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { - rmd256_init(&md); - rmd256_process(&md, (unsigned char *)tests[x].msg, strlen(tests[x].msg)); - rmd256_done(&md, buf); - if (XMEMCMP(buf, tests[x].md, 32) != 0) { - #if 0 - printf("Failed test %d\n", x); - #endif - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; -#endif -} - -#endif - DELETED Source/libtomcrypt/src/hashes/rmd320.c Index: Source/libtomcrypt/src/hashes/rmd320.c ================================================================== --- Source/libtomcrypt/src/hashes/rmd320.c +++ /dev/null @@ -1,495 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file rmd320.c - RMD320 hash function -*/ - -#ifdef LTC_RIPEMD320 - -const struct ltc_hash_descriptor rmd320_desc = -{ - "rmd320", - 12, - 40, - 64, - - /* OID */ - { 0 }, - 0, - - &rmd320_init, - &rmd320_process, - &rmd320_done, - &rmd320_test, - NULL -}; - -/* the five basic functions F(), G() and H() */ -#define F(x, y, z) ((x) ^ (y) ^ (z)) -#define G(x, y, z) (((x) & (y)) | (~(x) & (z))) -#define H(x, y, z) (((x) | ~(y)) ^ (z)) -#define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) -#define J(x, y, z) ((x) ^ ((y) | ~(z))) - -/* the ten basic operations FF() through III() */ -#define FF(a, b, c, d, e, x, s) \ - (a) += F((b), (c), (d)) + (x);\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define GG(a, b, c, d, e, x, s) \ - (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define HH(a, b, c, d, e, x, s) \ - (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define II(a, b, c, d, e, x, s) \ - (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcUL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define JJ(a, b, c, d, e, x, s) \ - (a) += J((b), (c), (d)) + (x) + 0xa953fd4eUL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define FFF(a, b, c, d, e, x, s) \ - (a) += F((b), (c), (d)) + (x);\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define GGG(a, b, c, d, e, x, s) \ - (a) += G((b), (c), (d)) + (x) + 0x7a6d76e9UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define HHH(a, b, c, d, e, x, s) \ - (a) += H((b), (c), (d)) + (x) + 0x6d703ef3UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define III(a, b, c, d, e, x, s) \ - (a) += I((b), (c), (d)) + (x) + 0x5c4dd124UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - -#define JJJ(a, b, c, d, e, x, s) \ - (a) += J((b), (c), (d)) + (x) + 0x50a28be6UL;\ - (a) = ROLc((a), (s)) + (e);\ - (c) = ROLc((c), 10); - - -#ifdef LTC_CLEAN_STACK -static int _rmd320_compress(hash_state *md, unsigned char *buf) -#else -static int rmd320_compress(hash_state *md, unsigned char *buf) -#endif -{ - ulong32 aa,bb,cc,dd,ee,aaa,bbb,ccc,ddd,eee,tmp,X[16]; - int i; - - /* load words X */ - for (i = 0; i < 16; i++){ - LOAD32L(X[i], buf + (4 * i)); - } - - /* load state */ - aa = md->rmd320.state[0]; - bb = md->rmd320.state[1]; - cc = md->rmd320.state[2]; - dd = md->rmd320.state[3]; - ee = md->rmd320.state[4]; - aaa = md->rmd320.state[5]; - bbb = md->rmd320.state[6]; - ccc = md->rmd320.state[7]; - ddd = md->rmd320.state[8]; - eee = md->rmd320.state[9]; - - /* round 1 */ - FF(aa, bb, cc, dd, ee, X[ 0], 11); - FF(ee, aa, bb, cc, dd, X[ 1], 14); - FF(dd, ee, aa, bb, cc, X[ 2], 15); - FF(cc, dd, ee, aa, bb, X[ 3], 12); - FF(bb, cc, dd, ee, aa, X[ 4], 5); - FF(aa, bb, cc, dd, ee, X[ 5], 8); - FF(ee, aa, bb, cc, dd, X[ 6], 7); - FF(dd, ee, aa, bb, cc, X[ 7], 9); - FF(cc, dd, ee, aa, bb, X[ 8], 11); - FF(bb, cc, dd, ee, aa, X[ 9], 13); - FF(aa, bb, cc, dd, ee, X[10], 14); - FF(ee, aa, bb, cc, dd, X[11], 15); - FF(dd, ee, aa, bb, cc, X[12], 6); - FF(cc, dd, ee, aa, bb, X[13], 7); - FF(bb, cc, dd, ee, aa, X[14], 9); - FF(aa, bb, cc, dd, ee, X[15], 8); - - /* parallel round 1 */ - JJJ(aaa, bbb, ccc, ddd, eee, X[ 5], 8); - JJJ(eee, aaa, bbb, ccc, ddd, X[14], 9); - JJJ(ddd, eee, aaa, bbb, ccc, X[ 7], 9); - JJJ(ccc, ddd, eee, aaa, bbb, X[ 0], 11); - JJJ(bbb, ccc, ddd, eee, aaa, X[ 9], 13); - JJJ(aaa, bbb, ccc, ddd, eee, X[ 2], 15); - JJJ(eee, aaa, bbb, ccc, ddd, X[11], 15); - JJJ(ddd, eee, aaa, bbb, ccc, X[ 4], 5); - JJJ(ccc, ddd, eee, aaa, bbb, X[13], 7); - JJJ(bbb, ccc, ddd, eee, aaa, X[ 6], 7); - JJJ(aaa, bbb, ccc, ddd, eee, X[15], 8); - JJJ(eee, aaa, bbb, ccc, ddd, X[ 8], 11); - JJJ(ddd, eee, aaa, bbb, ccc, X[ 1], 14); - JJJ(ccc, ddd, eee, aaa, bbb, X[10], 14); - JJJ(bbb, ccc, ddd, eee, aaa, X[ 3], 12); - JJJ(aaa, bbb, ccc, ddd, eee, X[12], 6); - - tmp = aa; aa = aaa; aaa = tmp; - - /* round 2 */ - GG(ee, aa, bb, cc, dd, X[ 7], 7); - GG(dd, ee, aa, bb, cc, X[ 4], 6); - GG(cc, dd, ee, aa, bb, X[13], 8); - GG(bb, cc, dd, ee, aa, X[ 1], 13); - GG(aa, bb, cc, dd, ee, X[10], 11); - GG(ee, aa, bb, cc, dd, X[ 6], 9); - GG(dd, ee, aa, bb, cc, X[15], 7); - GG(cc, dd, ee, aa, bb, X[ 3], 15); - GG(bb, cc, dd, ee, aa, X[12], 7); - GG(aa, bb, cc, dd, ee, X[ 0], 12); - GG(ee, aa, bb, cc, dd, X[ 9], 15); - GG(dd, ee, aa, bb, cc, X[ 5], 9); - GG(cc, dd, ee, aa, bb, X[ 2], 11); - GG(bb, cc, dd, ee, aa, X[14], 7); - GG(aa, bb, cc, dd, ee, X[11], 13); - GG(ee, aa, bb, cc, dd, X[ 8], 12); - - /* parallel round 2 */ - III(eee, aaa, bbb, ccc, ddd, X[ 6], 9); - III(ddd, eee, aaa, bbb, ccc, X[11], 13); - III(ccc, ddd, eee, aaa, bbb, X[ 3], 15); - III(bbb, ccc, ddd, eee, aaa, X[ 7], 7); - III(aaa, bbb, ccc, ddd, eee, X[ 0], 12); - III(eee, aaa, bbb, ccc, ddd, X[13], 8); - III(ddd, eee, aaa, bbb, ccc, X[ 5], 9); - III(ccc, ddd, eee, aaa, bbb, X[10], 11); - III(bbb, ccc, ddd, eee, aaa, X[14], 7); - III(aaa, bbb, ccc, ddd, eee, X[15], 7); - III(eee, aaa, bbb, ccc, ddd, X[ 8], 12); - III(ddd, eee, aaa, bbb, ccc, X[12], 7); - III(ccc, ddd, eee, aaa, bbb, X[ 4], 6); - III(bbb, ccc, ddd, eee, aaa, X[ 9], 15); - III(aaa, bbb, ccc, ddd, eee, X[ 1], 13); - III(eee, aaa, bbb, ccc, ddd, X[ 2], 11); - - tmp = bb; bb = bbb; bbb = tmp; - - /* round 3 */ - HH(dd, ee, aa, bb, cc, X[ 3], 11); - HH(cc, dd, ee, aa, bb, X[10], 13); - HH(bb, cc, dd, ee, aa, X[14], 6); - HH(aa, bb, cc, dd, ee, X[ 4], 7); - HH(ee, aa, bb, cc, dd, X[ 9], 14); - HH(dd, ee, aa, bb, cc, X[15], 9); - HH(cc, dd, ee, aa, bb, X[ 8], 13); - HH(bb, cc, dd, ee, aa, X[ 1], 15); - HH(aa, bb, cc, dd, ee, X[ 2], 14); - HH(ee, aa, bb, cc, dd, X[ 7], 8); - HH(dd, ee, aa, bb, cc, X[ 0], 13); - HH(cc, dd, ee, aa, bb, X[ 6], 6); - HH(bb, cc, dd, ee, aa, X[13], 5); - HH(aa, bb, cc, dd, ee, X[11], 12); - HH(ee, aa, bb, cc, dd, X[ 5], 7); - HH(dd, ee, aa, bb, cc, X[12], 5); - - /* parallel round 3 */ - HHH(ddd, eee, aaa, bbb, ccc, X[15], 9); - HHH(ccc, ddd, eee, aaa, bbb, X[ 5], 7); - HHH(bbb, ccc, ddd, eee, aaa, X[ 1], 15); - HHH(aaa, bbb, ccc, ddd, eee, X[ 3], 11); - HHH(eee, aaa, bbb, ccc, ddd, X[ 7], 8); - HHH(ddd, eee, aaa, bbb, ccc, X[14], 6); - HHH(ccc, ddd, eee, aaa, bbb, X[ 6], 6); - HHH(bbb, ccc, ddd, eee, aaa, X[ 9], 14); - HHH(aaa, bbb, ccc, ddd, eee, X[11], 12); - HHH(eee, aaa, bbb, ccc, ddd, X[ 8], 13); - HHH(ddd, eee, aaa, bbb, ccc, X[12], 5); - HHH(ccc, ddd, eee, aaa, bbb, X[ 2], 14); - HHH(bbb, ccc, ddd, eee, aaa, X[10], 13); - HHH(aaa, bbb, ccc, ddd, eee, X[ 0], 13); - HHH(eee, aaa, bbb, ccc, ddd, X[ 4], 7); - HHH(ddd, eee, aaa, bbb, ccc, X[13], 5); - - tmp = cc; cc = ccc; ccc = tmp; - - /* round 4 */ - II(cc, dd, ee, aa, bb, X[ 1], 11); - II(bb, cc, dd, ee, aa, X[ 9], 12); - II(aa, bb, cc, dd, ee, X[11], 14); - II(ee, aa, bb, cc, dd, X[10], 15); - II(dd, ee, aa, bb, cc, X[ 0], 14); - II(cc, dd, ee, aa, bb, X[ 8], 15); - II(bb, cc, dd, ee, aa, X[12], 9); - II(aa, bb, cc, dd, ee, X[ 4], 8); - II(ee, aa, bb, cc, dd, X[13], 9); - II(dd, ee, aa, bb, cc, X[ 3], 14); - II(cc, dd, ee, aa, bb, X[ 7], 5); - II(bb, cc, dd, ee, aa, X[15], 6); - II(aa, bb, cc, dd, ee, X[14], 8); - II(ee, aa, bb, cc, dd, X[ 5], 6); - II(dd, ee, aa, bb, cc, X[ 6], 5); - II(cc, dd, ee, aa, bb, X[ 2], 12); - - /* parallel round 4 */ - GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15); - GGG(bbb, ccc, ddd, eee, aaa, X[ 6], 5); - GGG(aaa, bbb, ccc, ddd, eee, X[ 4], 8); - GGG(eee, aaa, bbb, ccc, ddd, X[ 1], 11); - GGG(ddd, eee, aaa, bbb, ccc, X[ 3], 14); - GGG(ccc, ddd, eee, aaa, bbb, X[11], 14); - GGG(bbb, ccc, ddd, eee, aaa, X[15], 6); - GGG(aaa, bbb, ccc, ddd, eee, X[ 0], 14); - GGG(eee, aaa, bbb, ccc, ddd, X[ 5], 6); - GGG(ddd, eee, aaa, bbb, ccc, X[12], 9); - GGG(ccc, ddd, eee, aaa, bbb, X[ 2], 12); - GGG(bbb, ccc, ddd, eee, aaa, X[13], 9); - GGG(aaa, bbb, ccc, ddd, eee, X[ 9], 12); - GGG(eee, aaa, bbb, ccc, ddd, X[ 7], 5); - GGG(ddd, eee, aaa, bbb, ccc, X[10], 15); - GGG(ccc, ddd, eee, aaa, bbb, X[14], 8); - - tmp = dd; dd = ddd; ddd = tmp; - - /* round 5 */ - JJ(bb, cc, dd, ee, aa, X[ 4], 9); - JJ(aa, bb, cc, dd, ee, X[ 0], 15); - JJ(ee, aa, bb, cc, dd, X[ 5], 5); - JJ(dd, ee, aa, bb, cc, X[ 9], 11); - JJ(cc, dd, ee, aa, bb, X[ 7], 6); - JJ(bb, cc, dd, ee, aa, X[12], 8); - JJ(aa, bb, cc, dd, ee, X[ 2], 13); - JJ(ee, aa, bb, cc, dd, X[10], 12); - JJ(dd, ee, aa, bb, cc, X[14], 5); - JJ(cc, dd, ee, aa, bb, X[ 1], 12); - JJ(bb, cc, dd, ee, aa, X[ 3], 13); - JJ(aa, bb, cc, dd, ee, X[ 8], 14); - JJ(ee, aa, bb, cc, dd, X[11], 11); - JJ(dd, ee, aa, bb, cc, X[ 6], 8); - JJ(cc, dd, ee, aa, bb, X[15], 5); - JJ(bb, cc, dd, ee, aa, X[13], 6); - - /* parallel round 5 */ - FFF(bbb, ccc, ddd, eee, aaa, X[12] , 8); - FFF(aaa, bbb, ccc, ddd, eee, X[15] , 5); - FFF(eee, aaa, bbb, ccc, ddd, X[10] , 12); - FFF(ddd, eee, aaa, bbb, ccc, X[ 4] , 9); - FFF(ccc, ddd, eee, aaa, bbb, X[ 1] , 12); - FFF(bbb, ccc, ddd, eee, aaa, X[ 5] , 5); - FFF(aaa, bbb, ccc, ddd, eee, X[ 8] , 14); - FFF(eee, aaa, bbb, ccc, ddd, X[ 7] , 6); - FFF(ddd, eee, aaa, bbb, ccc, X[ 6] , 8); - FFF(ccc, ddd, eee, aaa, bbb, X[ 2] , 13); - FFF(bbb, ccc, ddd, eee, aaa, X[13] , 6); - FFF(aaa, bbb, ccc, ddd, eee, X[14] , 5); - FFF(eee, aaa, bbb, ccc, ddd, X[ 0] , 15); - FFF(ddd, eee, aaa, bbb, ccc, X[ 3] , 13); - FFF(ccc, ddd, eee, aaa, bbb, X[ 9] , 11); - FFF(bbb, ccc, ddd, eee, aaa, X[11] , 11); - - tmp = ee; ee = eee; eee = tmp; - - /* combine results */ - md->rmd320.state[0] += aa; - md->rmd320.state[1] += bb; - md->rmd320.state[2] += cc; - md->rmd320.state[3] += dd; - md->rmd320.state[4] += ee; - md->rmd320.state[5] += aaa; - md->rmd320.state[6] += bbb; - md->rmd320.state[7] += ccc; - md->rmd320.state[8] += ddd; - md->rmd320.state[9] += eee; - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -static int rmd320_compress(hash_state *md, unsigned char *buf) -{ - int err; - err = _rmd320_compress(md, buf); - burn_stack(sizeof(ulong32) * 27 + sizeof(int)); - return err; -} -#endif - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int rmd320_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - md->rmd320.state[0] = 0x67452301UL; - md->rmd320.state[1] = 0xefcdab89UL; - md->rmd320.state[2] = 0x98badcfeUL; - md->rmd320.state[3] = 0x10325476UL; - md->rmd320.state[4] = 0xc3d2e1f0UL; - md->rmd320.state[5] = 0x76543210UL; - md->rmd320.state[6] = 0xfedcba98UL; - md->rmd320.state[7] = 0x89abcdefUL; - md->rmd320.state[8] = 0x01234567UL; - md->rmd320.state[9] = 0x3c2d1e0fUL; - md->rmd320.curlen = 0; - md->rmd320.length = 0; - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -HASH_PROCESS(rmd320_process, rmd320_compress, rmd320, 64) - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (20 bytes) - @return CRYPT_OK if successful -*/ -int rmd320_done(hash_state * md, unsigned char *out) -{ - int i; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->rmd320.curlen >= sizeof(md->rmd320.buf)) { - return CRYPT_INVALID_ARG; - } - - - /* increase the length of the message */ - md->rmd320.length += md->rmd320.curlen * 8; - - /* append the '1' bit */ - md->rmd320.buf[md->rmd320.curlen++] = (unsigned char)0x80; - - /* if the length is currently above 56 bytes we append zeros - * then compress. Then we can fall back to padding zeros and length - * encoding like normal. - */ - if (md->rmd320.curlen > 56) { - while (md->rmd320.curlen < 64) { - md->rmd320.buf[md->rmd320.curlen++] = (unsigned char)0; - } - rmd320_compress(md, md->rmd320.buf); - md->rmd320.curlen = 0; - } - - /* pad upto 56 bytes of zeroes */ - while (md->rmd320.curlen < 56) { - md->rmd320.buf[md->rmd320.curlen++] = (unsigned char)0; - } - - /* store length */ - STORE64L(md->rmd320.length, md->rmd320.buf+56); - rmd320_compress(md, md->rmd320.buf); - - /* copy output */ - for (i = 0; i < 10; i++) { - STORE32L(md->rmd320.state[i], out+(4*i)); - } -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int rmd320_test(void) -{ -#ifndef LTC_TEST - return CRYPT_NOP; -#else - static const struct { - char *msg; - unsigned char md[40]; - } tests[] = { - { "", - { 0x22, 0xd6, 0x5d, 0x56, 0x61, 0x53, 0x6c, 0xdc, 0x75, 0xc1, - 0xfd, 0xf5, 0xc6, 0xde, 0x7b, 0x41, 0xb9, 0xf2, 0x73, 0x25, - 0xeb, 0xc6, 0x1e, 0x85, 0x57, 0x17, 0x7d, 0x70, 0x5a, 0x0e, - 0xc8, 0x80, 0x15, 0x1c, 0x3a, 0x32, 0xa0, 0x08, 0x99, 0xb8 } - }, - { "a", - { 0xce, 0x78, 0x85, 0x06, 0x38, 0xf9, 0x26, 0x58, 0xa5, 0xa5, - 0x85, 0x09, 0x75, 0x79, 0x92, 0x6d, 0xda, 0x66, 0x7a, 0x57, - 0x16, 0x56, 0x2c, 0xfc, 0xf6, 0xfb, 0xe7, 0x7f, 0x63, 0x54, - 0x2f, 0x99, 0xb0, 0x47, 0x05, 0xd6, 0x97, 0x0d, 0xff, 0x5d } - }, - { "abc", - { 0xde, 0x4c, 0x01, 0xb3, 0x05, 0x4f, 0x89, 0x30, 0xa7, 0x9d, - 0x09, 0xae, 0x73, 0x8e, 0x92, 0x30, 0x1e, 0x5a, 0x17, 0x08, - 0x5b, 0xef, 0xfd, 0xc1, 0xb8, 0xd1, 0x16, 0x71, 0x3e, 0x74, - 0xf8, 0x2f, 0xa9, 0x42, 0xd6, 0x4c, 0xdb, 0xc4, 0x68, 0x2d } - }, - { "message digest", - { 0x3a, 0x8e, 0x28, 0x50, 0x2e, 0xd4, 0x5d, 0x42, 0x2f, 0x68, - 0x84, 0x4f, 0x9d, 0xd3, 0x16, 0xe7, 0xb9, 0x85, 0x33, 0xfa, - 0x3f, 0x2a, 0x91, 0xd2, 0x9f, 0x84, 0xd4, 0x25, 0xc8, 0x8d, - 0x6b, 0x4e, 0xff, 0x72, 0x7d, 0xf6, 0x6a, 0x7c, 0x01, 0x97 } - }, - { "abcdefghijklmnopqrstuvwxyz", - { 0xca, 0xbd, 0xb1, 0x81, 0x0b, 0x92, 0x47, 0x0a, 0x20, 0x93, - 0xaa, 0x6b, 0xce, 0x05, 0x95, 0x2c, 0x28, 0x34, 0x8c, 0xf4, - 0x3f, 0xf6, 0x08, 0x41, 0x97, 0x51, 0x66, 0xbb, 0x40, 0xed, - 0x23, 0x40, 0x04, 0xb8, 0x82, 0x44, 0x63, 0xe6, 0xb0, 0x09 } - }, - { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - { 0xd0, 0x34, 0xa7, 0x95, 0x0c, 0xf7, 0x22, 0x02, 0x1b, 0xa4, - 0xb8, 0x4d, 0xf7, 0x69, 0xa5, 0xde, 0x20, 0x60, 0xe2, 0x59, - 0xdf, 0x4c, 0x9b, 0xb4, 0xa4, 0x26, 0x8c, 0x0e, 0x93, 0x5b, - 0xbc, 0x74, 0x70, 0xa9, 0x69, 0xc9, 0xd0, 0x72, 0xa1, 0xac } - } - }; - int x; - unsigned char buf[40]; - hash_state md; - - for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { - rmd320_init(&md); - rmd320_process(&md, (unsigned char *)tests[x].msg, strlen(tests[x].msg)); - rmd320_done(&md, buf); - if (XMEMCMP(buf, tests[x].md, 40) != 0) { -#if 0 - printf("Failed test %d\n", x); -#endif - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; -#endif -} - -#endif - DELETED Source/libtomcrypt/src/hashes/sha1.c Index: Source/libtomcrypt/src/hashes/sha1.c ================================================================== --- Source/libtomcrypt/src/hashes/sha1.c +++ /dev/null @@ -1,288 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file sha1.c - LTC_SHA1 code by Tom St Denis -*/ - - -#ifdef LTC_SHA1 - -const struct ltc_hash_descriptor sha1_desc = -{ - "sha1", - 2, - 20, - 64, - - /* OID */ - { 1, 3, 14, 3, 2, 26, }, - 6, - - &sha1_init, - &sha1_process, - &sha1_done, - &sha1_test, - NULL -}; - -#define F0(x,y,z) (z ^ (x & (y ^ z))) -#define F1(x,y,z) (x ^ y ^ z) -#define F2(x,y,z) ((x & y) | (z & (x | y))) -#define F3(x,y,z) (x ^ y ^ z) - -#ifdef LTC_CLEAN_STACK -static int _sha1_compress(hash_state *md, unsigned char *buf) -#else -static int sha1_compress(hash_state *md, unsigned char *buf) -#endif -{ - ulong32 a,b,c,d,e,W[80],i; -#ifdef LTC_SMALL_CODE - ulong32 t; -#endif - - /* copy the state into 512-bits into W[0..15] */ - for (i = 0; i < 16; i++) { - LOAD32H(W[i], buf + (4*i)); - } - - /* copy state */ - a = md->sha1.state[0]; - b = md->sha1.state[1]; - c = md->sha1.state[2]; - d = md->sha1.state[3]; - e = md->sha1.state[4]; - - /* expand it */ - for (i = 16; i < 80; i++) { - W[i] = ROL(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1); - } - - /* compress */ - /* round one */ - #define FF0(a,b,c,d,e,i) e = (ROLc(a, 5) + F0(b,c,d) + e + W[i] + 0x5a827999UL); b = ROLc(b, 30); - #define FF1(a,b,c,d,e,i) e = (ROLc(a, 5) + F1(b,c,d) + e + W[i] + 0x6ed9eba1UL); b = ROLc(b, 30); - #define FF2(a,b,c,d,e,i) e = (ROLc(a, 5) + F2(b,c,d) + e + W[i] + 0x8f1bbcdcUL); b = ROLc(b, 30); - #define FF3(a,b,c,d,e,i) e = (ROLc(a, 5) + F3(b,c,d) + e + W[i] + 0xca62c1d6UL); b = ROLc(b, 30); - -#ifdef LTC_SMALL_CODE - - for (i = 0; i < 20; ) { - FF0(a,b,c,d,e,i++); t = e; e = d; d = c; c = b; b = a; a = t; - } - - for (; i < 40; ) { - FF1(a,b,c,d,e,i++); t = e; e = d; d = c; c = b; b = a; a = t; - } - - for (; i < 60; ) { - FF2(a,b,c,d,e,i++); t = e; e = d; d = c; c = b; b = a; a = t; - } - - for (; i < 80; ) { - FF3(a,b,c,d,e,i++); t = e; e = d; d = c; c = b; b = a; a = t; - } - -#else - - for (i = 0; i < 20; ) { - FF0(a,b,c,d,e,i++); - FF0(e,a,b,c,d,i++); - FF0(d,e,a,b,c,i++); - FF0(c,d,e,a,b,i++); - FF0(b,c,d,e,a,i++); - } - - /* round two */ - for (; i < 40; ) { - FF1(a,b,c,d,e,i++); - FF1(e,a,b,c,d,i++); - FF1(d,e,a,b,c,i++); - FF1(c,d,e,a,b,i++); - FF1(b,c,d,e,a,i++); - } - - /* round three */ - for (; i < 60; ) { - FF2(a,b,c,d,e,i++); - FF2(e,a,b,c,d,i++); - FF2(d,e,a,b,c,i++); - FF2(c,d,e,a,b,i++); - FF2(b,c,d,e,a,i++); - } - - /* round four */ - for (; i < 80; ) { - FF3(a,b,c,d,e,i++); - FF3(e,a,b,c,d,i++); - FF3(d,e,a,b,c,i++); - FF3(c,d,e,a,b,i++); - FF3(b,c,d,e,a,i++); - } -#endif - - #undef FF0 - #undef FF1 - #undef FF2 - #undef FF3 - - /* store */ - md->sha1.state[0] = md->sha1.state[0] + a; - md->sha1.state[1] = md->sha1.state[1] + b; - md->sha1.state[2] = md->sha1.state[2] + c; - md->sha1.state[3] = md->sha1.state[3] + d; - md->sha1.state[4] = md->sha1.state[4] + e; - - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -static int sha1_compress(hash_state *md, unsigned char *buf) -{ - int err; - err = _sha1_compress(md, buf); - burn_stack(sizeof(ulong32) * 87); - return err; -} -#endif - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int sha1_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - md->sha1.state[0] = 0x67452301UL; - md->sha1.state[1] = 0xefcdab89UL; - md->sha1.state[2] = 0x98badcfeUL; - md->sha1.state[3] = 0x10325476UL; - md->sha1.state[4] = 0xc3d2e1f0UL; - md->sha1.curlen = 0; - md->sha1.length = 0; - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -HASH_PROCESS(sha1_process, sha1_compress, sha1, 64) - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (20 bytes) - @return CRYPT_OK if successful -*/ -int sha1_done(hash_state * md, unsigned char *out) -{ - int i; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->sha1.curlen >= sizeof(md->sha1.buf)) { - return CRYPT_INVALID_ARG; - } - - /* increase the length of the message */ - md->sha1.length += md->sha1.curlen * 8; - - /* append the '1' bit */ - md->sha1.buf[md->sha1.curlen++] = (unsigned char)0x80; - - /* if the length is currently above 56 bytes we append zeros - * then compress. Then we can fall back to padding zeros and length - * encoding like normal. - */ - if (md->sha1.curlen > 56) { - while (md->sha1.curlen < 64) { - md->sha1.buf[md->sha1.curlen++] = (unsigned char)0; - } - sha1_compress(md, md->sha1.buf); - md->sha1.curlen = 0; - } - - /* pad upto 56 bytes of zeroes */ - while (md->sha1.curlen < 56) { - md->sha1.buf[md->sha1.curlen++] = (unsigned char)0; - } - - /* store length */ - STORE64H(md->sha1.length, md->sha1.buf+56); - sha1_compress(md, md->sha1.buf); - - /* copy output */ - for (i = 0; i < 5; i++) { - STORE32H(md->sha1.state[i], out+(4*i)); - } -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int sha1_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - static const struct { - char *msg; - unsigned char hash[20]; - } tests[] = { - { "abc", - { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, - 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, - 0x9c, 0xd0, 0xd8, 0x9d } - }, - { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - { 0x84, 0x98, 0x3E, 0x44, 0x1C, 0x3B, 0xD2, 0x6E, - 0xBA, 0xAE, 0x4A, 0xA1, 0xF9, 0x51, 0x29, 0xE5, - 0xE5, 0x46, 0x70, 0xF1 } - } - }; - - int i; - unsigned char tmp[20]; - hash_state md; - - for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { - sha1_init(&md); - sha1_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); - sha1_done(&md, tmp); - if (XMEMCMP(tmp, tests[i].hash, 20) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; - #endif -} - -#endif - - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha1.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2007/05/12 14:25:28 $ */ DELETED Source/libtomcrypt/src/hashes/sha2/sha224.c Index: Source/libtomcrypt/src/hashes/sha2/sha224.c ================================================================== --- Source/libtomcrypt/src/hashes/sha2/sha224.c +++ /dev/null @@ -1,125 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -/** - @param sha224.c - LTC_SHA-224 new NIST standard based off of LTC_SHA-256 truncated to 224 bits (Tom St Denis) -*/ - -const struct ltc_hash_descriptor sha224_desc = -{ - "sha224", - 10, - 28, - 64, - - /* OID */ - { 2, 16, 840, 1, 101, 3, 4, 2, 4, }, - 9, - - &sha224_init, - &sha256_process, - &sha224_done, - &sha224_test, - NULL -}; - -/* init the sha256 er... sha224 state ;-) */ -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int sha224_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - - md->sha256.curlen = 0; - md->sha256.length = 0; - md->sha256.state[0] = 0xc1059ed8UL; - md->sha256.state[1] = 0x367cd507UL; - md->sha256.state[2] = 0x3070dd17UL; - md->sha256.state[3] = 0xf70e5939UL; - md->sha256.state[4] = 0xffc00b31UL; - md->sha256.state[5] = 0x68581511UL; - md->sha256.state[6] = 0x64f98fa7UL; - md->sha256.state[7] = 0xbefa4fa4UL; - return CRYPT_OK; -} - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (28 bytes) - @return CRYPT_OK if successful -*/ -int sha224_done(hash_state * md, unsigned char *out) -{ - unsigned char buf[32]; - int err; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - err = sha256_done(md, buf); - XMEMCPY(out, buf, 28); -#ifdef LTC_CLEAN_STACK - zeromem(buf, sizeof(buf)); -#endif - return err; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int sha224_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - static const struct { - char *msg; - unsigned char hash[28]; - } tests[] = { - { "abc", - { 0x23, 0x09, 0x7d, 0x22, 0x34, 0x05, 0xd8, - 0x22, 0x86, 0x42, 0xa4, 0x77, 0xbd, 0xa2, - 0x55, 0xb3, 0x2a, 0xad, 0xbc, 0xe4, 0xbd, - 0xa0, 0xb3, 0xf7, 0xe3, 0x6c, 0x9d, 0xa7 } - }, - { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - { 0x75, 0x38, 0x8b, 0x16, 0x51, 0x27, 0x76, - 0xcc, 0x5d, 0xba, 0x5d, 0xa1, 0xfd, 0x89, - 0x01, 0x50, 0xb0, 0xc6, 0x45, 0x5c, 0xb4, - 0xf5, 0x8b, 0x19, 0x52, 0x52, 0x25, 0x25 } - }, - }; - - int i; - unsigned char tmp[28]; - hash_state md; - - for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { - sha224_init(&md); - sha224_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); - sha224_done(&md, tmp); - if (XMEMCMP(tmp, tests[i].hash, 28) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; - #endif -} - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha224.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2007/05/12 14:25:28 $ */ DELETED Source/libtomcrypt/src/hashes/sha2/sha256.c Index: Source/libtomcrypt/src/hashes/sha2/sha256.c ================================================================== --- Source/libtomcrypt/src/hashes/sha2/sha256.c +++ /dev/null @@ -1,340 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file sha256.c - LTC_SHA256 by Tom St Denis -*/ - -#ifdef LTC_SHA256 - -const struct ltc_hash_descriptor sha256_desc = -{ - "sha256", - 0, - 32, - 64, - - /* OID */ - { 2, 16, 840, 1, 101, 3, 4, 2, 1, }, - 9, - - &sha256_init, - &sha256_process, - &sha256_done, - &sha256_test, - NULL -}; - -#ifdef LTC_SMALL_CODE -/* the K array */ -static const ulong32 K[64] = { - 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL, - 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL, - 0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, - 0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, - 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL, - 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL, - 0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, - 0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, - 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL, - 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL, - 0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, - 0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, - 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL -}; -#endif - -/* Various logical functions */ -#define Ch(x,y,z) (z ^ (x & (y ^ z))) -#define Maj(x,y,z) (((x | y) & z) | (x & y)) -#define S(x, n) RORc((x),(n)) -#define R(x, n) (((x)&0xFFFFFFFFUL)>>(n)) -#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) -#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) -#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3)) -#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) - -/* compress 512-bits */ -#ifdef LTC_CLEAN_STACK -static int _sha256_compress(hash_state * md, unsigned char *buf) -#else -static int sha256_compress(hash_state * md, unsigned char *buf) -#endif -{ - ulong32 S[8], W[64], t0, t1; -#ifdef LTC_SMALL_CODE - ulong32 t; -#endif - int i; - - /* copy state into S */ - for (i = 0; i < 8; i++) { - S[i] = md->sha256.state[i]; - } - - /* copy the state into 512-bits into W[0..15] */ - for (i = 0; i < 16; i++) { - LOAD32H(W[i], buf + (4*i)); - } - - /* fill W[16..63] */ - for (i = 16; i < 64; i++) { - W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]; - } - - /* Compress */ -#ifdef LTC_SMALL_CODE -#define RND(a,b,c,d,e,f,g,h,i) \ - t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \ - t1 = Sigma0(a) + Maj(a, b, c); \ - d += t0; \ - h = t0 + t1; - - for (i = 0; i < 64; ++i) { - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i); - t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4]; - S[4] = S[3]; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t; - } -#else -#define RND(a,b,c,d,e,f,g,h,i,ki) \ - t0 = h + Sigma1(e) + Ch(e, f, g) + ki + W[i]; \ - t1 = Sigma0(a) + Maj(a, b, c); \ - d += t0; \ - h = t0 + t1; - - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],0,0x428a2f98); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],1,0x71374491); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],2,0xb5c0fbcf); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],3,0xe9b5dba5); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],4,0x3956c25b); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],5,0x59f111f1); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],6,0x923f82a4); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],7,0xab1c5ed5); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],8,0xd807aa98); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],9,0x12835b01); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],10,0x243185be); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],11,0x550c7dc3); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],12,0x72be5d74); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],13,0x80deb1fe); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],14,0x9bdc06a7); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],15,0xc19bf174); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],16,0xe49b69c1); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],17,0xefbe4786); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],18,0x0fc19dc6); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],19,0x240ca1cc); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],20,0x2de92c6f); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],21,0x4a7484aa); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],22,0x5cb0a9dc); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],23,0x76f988da); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],24,0x983e5152); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],25,0xa831c66d); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],26,0xb00327c8); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],27,0xbf597fc7); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],28,0xc6e00bf3); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],29,0xd5a79147); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],30,0x06ca6351); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],31,0x14292967); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],32,0x27b70a85); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],33,0x2e1b2138); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],34,0x4d2c6dfc); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],35,0x53380d13); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],36,0x650a7354); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],37,0x766a0abb); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],38,0x81c2c92e); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],39,0x92722c85); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],40,0xa2bfe8a1); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],41,0xa81a664b); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],42,0xc24b8b70); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],43,0xc76c51a3); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],44,0xd192e819); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],45,0xd6990624); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],46,0xf40e3585); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],47,0x106aa070); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],48,0x19a4c116); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],49,0x1e376c08); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],50,0x2748774c); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],51,0x34b0bcb5); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],52,0x391c0cb3); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],53,0x4ed8aa4a); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],54,0x5b9cca4f); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],55,0x682e6ff3); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],56,0x748f82ee); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],57,0x78a5636f); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],58,0x84c87814); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],59,0x8cc70208); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],60,0x90befffa); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],61,0xa4506ceb); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],62,0xbef9a3f7); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],63,0xc67178f2); - -#undef RND - -#endif - - /* feedback */ - for (i = 0; i < 8; i++) { - md->sha256.state[i] = md->sha256.state[i] + S[i]; - } - return CRYPT_OK; -} - -#ifdef LTC_CLEAN_STACK -static int sha256_compress(hash_state * md, unsigned char *buf) -{ - int err; - err = _sha256_compress(md, buf); - burn_stack(sizeof(ulong32) * 74); - return err; -} -#endif - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int sha256_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - - md->sha256.curlen = 0; - md->sha256.length = 0; - md->sha256.state[0] = 0x6A09E667UL; - md->sha256.state[1] = 0xBB67AE85UL; - md->sha256.state[2] = 0x3C6EF372UL; - md->sha256.state[3] = 0xA54FF53AUL; - md->sha256.state[4] = 0x510E527FUL; - md->sha256.state[5] = 0x9B05688CUL; - md->sha256.state[6] = 0x1F83D9ABUL; - md->sha256.state[7] = 0x5BE0CD19UL; - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -HASH_PROCESS(sha256_process, sha256_compress, sha256, 64) - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (32 bytes) - @return CRYPT_OK if successful -*/ -int sha256_done(hash_state * md, unsigned char *out) -{ - int i; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->sha256.curlen >= sizeof(md->sha256.buf)) { - return CRYPT_INVALID_ARG; - } - - - /* increase the length of the message */ - md->sha256.length += md->sha256.curlen * 8; - - /* append the '1' bit */ - md->sha256.buf[md->sha256.curlen++] = (unsigned char)0x80; - - /* if the length is currently above 56 bytes we append zeros - * then compress. Then we can fall back to padding zeros and length - * encoding like normal. - */ - if (md->sha256.curlen > 56) { - while (md->sha256.curlen < 64) { - md->sha256.buf[md->sha256.curlen++] = (unsigned char)0; - } - sha256_compress(md, md->sha256.buf); - md->sha256.curlen = 0; - } - - /* pad upto 56 bytes of zeroes */ - while (md->sha256.curlen < 56) { - md->sha256.buf[md->sha256.curlen++] = (unsigned char)0; - } - - /* store length */ - STORE64H(md->sha256.length, md->sha256.buf+56); - sha256_compress(md, md->sha256.buf); - - /* copy output */ - for (i = 0; i < 8; i++) { - STORE32H(md->sha256.state[i], out+(4*i)); - } -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int sha256_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - static const struct { - char *msg; - unsigned char hash[32]; - } tests[] = { - { "abc", - { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, - 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, - 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, - 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad } - }, - { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8, - 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39, - 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67, - 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 } - }, - }; - - int i; - unsigned char tmp[32]; - hash_state md; - - for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { - sha256_init(&md); - sha256_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); - sha256_done(&md, tmp); - if (XMEMCMP(tmp, tests[i].hash, 32) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; - #endif -} - -#ifdef LTC_SHA224 -#include "sha224.c" -#endif - -#endif - - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha256.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2007/05/12 14:25:28 $ */ DELETED Source/libtomcrypt/src/hashes/sha2/sha384.c Index: Source/libtomcrypt/src/hashes/sha2/sha384.c ================================================================== --- Source/libtomcrypt/src/hashes/sha2/sha384.c +++ /dev/null @@ -1,135 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -/** - @param sha384.c - LTC_SHA384 hash included in sha512.c, Tom St Denis -*/ - -const struct ltc_hash_descriptor sha384_desc = -{ - "sha384", - 4, - 48, - 128, - - /* OID */ - { 2, 16, 840, 1, 101, 3, 4, 2, 2, }, - 9, - - &sha384_init, - &sha512_process, - &sha384_done, - &sha384_test, - NULL -}; - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int sha384_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - - md->sha512.curlen = 0; - md->sha512.length = 0; - md->sha512.state[0] = CONST64(0xcbbb9d5dc1059ed8); - md->sha512.state[1] = CONST64(0x629a292a367cd507); - md->sha512.state[2] = CONST64(0x9159015a3070dd17); - md->sha512.state[3] = CONST64(0x152fecd8f70e5939); - md->sha512.state[4] = CONST64(0x67332667ffc00b31); - md->sha512.state[5] = CONST64(0x8eb44a8768581511); - md->sha512.state[6] = CONST64(0xdb0c2e0d64f98fa7); - md->sha512.state[7] = CONST64(0x47b5481dbefa4fa4); - return CRYPT_OK; -} - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (48 bytes) - @return CRYPT_OK if successful -*/ -int sha384_done(hash_state * md, unsigned char *out) -{ - unsigned char buf[64]; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->sha512.curlen >= sizeof(md->sha512.buf)) { - return CRYPT_INVALID_ARG; - } - - sha512_done(md, buf); - XMEMCPY(out, buf, 48); -#ifdef LTC_CLEAN_STACK - zeromem(buf, sizeof(buf)); -#endif - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int sha384_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - static const struct { - char *msg; - unsigned char hash[48]; - } tests[] = { - { "abc", - { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b, - 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07, - 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63, - 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed, - 0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23, - 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7 } - }, - { "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", - { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8, - 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47, - 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2, - 0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12, - 0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9, - 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39 } - }, - }; - - int i; - unsigned char tmp[48]; - hash_state md; - - for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { - sha384_init(&md); - sha384_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); - sha384_done(&md, tmp); - if (XMEMCMP(tmp, tests[i].hash, 48) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; - #endif -} - - - - - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha384.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2007/05/12 14:25:28 $ */ DELETED Source/libtomcrypt/src/hashes/sha2/sha512.c Index: Source/libtomcrypt/src/hashes/sha2/sha512.c ================================================================== --- Source/libtomcrypt/src/hashes/sha2/sha512.c +++ /dev/null @@ -1,319 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @param sha512.c - LTC_SHA512 by Tom St Denis -*/ - -#ifdef LTC_SHA512 - -const struct ltc_hash_descriptor sha512_desc = -{ - "sha512", - 5, - 64, - 128, - - /* OID */ - { 2, 16, 840, 1, 101, 3, 4, 2, 3, }, - 9, - - &sha512_init, - &sha512_process, - &sha512_done, - &sha512_test, - NULL -}; - -/* the K array */ -static const ulong64 K[80] = { -CONST64(0x428a2f98d728ae22), CONST64(0x7137449123ef65cd), -CONST64(0xb5c0fbcfec4d3b2f), CONST64(0xe9b5dba58189dbbc), -CONST64(0x3956c25bf348b538), CONST64(0x59f111f1b605d019), -CONST64(0x923f82a4af194f9b), CONST64(0xab1c5ed5da6d8118), -CONST64(0xd807aa98a3030242), CONST64(0x12835b0145706fbe), -CONST64(0x243185be4ee4b28c), CONST64(0x550c7dc3d5ffb4e2), -CONST64(0x72be5d74f27b896f), CONST64(0x80deb1fe3b1696b1), -CONST64(0x9bdc06a725c71235), CONST64(0xc19bf174cf692694), -CONST64(0xe49b69c19ef14ad2), CONST64(0xefbe4786384f25e3), -CONST64(0x0fc19dc68b8cd5b5), CONST64(0x240ca1cc77ac9c65), -CONST64(0x2de92c6f592b0275), CONST64(0x4a7484aa6ea6e483), -CONST64(0x5cb0a9dcbd41fbd4), CONST64(0x76f988da831153b5), -CONST64(0x983e5152ee66dfab), CONST64(0xa831c66d2db43210), -CONST64(0xb00327c898fb213f), CONST64(0xbf597fc7beef0ee4), -CONST64(0xc6e00bf33da88fc2), CONST64(0xd5a79147930aa725), -CONST64(0x06ca6351e003826f), CONST64(0x142929670a0e6e70), -CONST64(0x27b70a8546d22ffc), CONST64(0x2e1b21385c26c926), -CONST64(0x4d2c6dfc5ac42aed), CONST64(0x53380d139d95b3df), -CONST64(0x650a73548baf63de), CONST64(0x766a0abb3c77b2a8), -CONST64(0x81c2c92e47edaee6), CONST64(0x92722c851482353b), -CONST64(0xa2bfe8a14cf10364), CONST64(0xa81a664bbc423001), -CONST64(0xc24b8b70d0f89791), CONST64(0xc76c51a30654be30), -CONST64(0xd192e819d6ef5218), CONST64(0xd69906245565a910), -CONST64(0xf40e35855771202a), CONST64(0x106aa07032bbd1b8), -CONST64(0x19a4c116b8d2d0c8), CONST64(0x1e376c085141ab53), -CONST64(0x2748774cdf8eeb99), CONST64(0x34b0bcb5e19b48a8), -CONST64(0x391c0cb3c5c95a63), CONST64(0x4ed8aa4ae3418acb), -CONST64(0x5b9cca4f7763e373), CONST64(0x682e6ff3d6b2b8a3), -CONST64(0x748f82ee5defb2fc), CONST64(0x78a5636f43172f60), -CONST64(0x84c87814a1f0ab72), CONST64(0x8cc702081a6439ec), -CONST64(0x90befffa23631e28), CONST64(0xa4506cebde82bde9), -CONST64(0xbef9a3f7b2c67915), CONST64(0xc67178f2e372532b), -CONST64(0xca273eceea26619c), CONST64(0xd186b8c721c0c207), -CONST64(0xeada7dd6cde0eb1e), CONST64(0xf57d4f7fee6ed178), -CONST64(0x06f067aa72176fba), CONST64(0x0a637dc5a2c898a6), -CONST64(0x113f9804bef90dae), CONST64(0x1b710b35131c471b), -CONST64(0x28db77f523047d84), CONST64(0x32caab7b40c72493), -CONST64(0x3c9ebe0a15c9bebc), CONST64(0x431d67c49c100d4c), -CONST64(0x4cc5d4becb3e42b6), CONST64(0x597f299cfc657e2a), -CONST64(0x5fcb6fab3ad6faec), CONST64(0x6c44198c4a475817) -}; - -/* Various logical functions */ -#define Ch(x,y,z) (z ^ (x & (y ^ z))) -#define Maj(x,y,z) (((x | y) & z) | (x & y)) -#define S(x, n) ROR64c(x, n) -#define R(x, n) (((x)&CONST64(0xFFFFFFFFFFFFFFFF))>>((ulong64)n)) -#define Sigma0(x) (S(x, 28) ^ S(x, 34) ^ S(x, 39)) -#define Sigma1(x) (S(x, 14) ^ S(x, 18) ^ S(x, 41)) -#define Gamma0(x) (S(x, 1) ^ S(x, 8) ^ R(x, 7)) -#define Gamma1(x) (S(x, 19) ^ S(x, 61) ^ R(x, 6)) - -/* compress 1024-bits */ -#ifdef LTC_CLEAN_STACK -static int _sha512_compress(hash_state * md, unsigned char *buf) -#else -static int sha512_compress(hash_state * md, unsigned char *buf) -#endif -{ - ulong64 S[8], W[80], t0, t1; - int i; - - /* copy state into S */ - for (i = 0; i < 8; i++) { - S[i] = md->sha512.state[i]; - } - - /* copy the state into 1024-bits into W[0..15] */ - for (i = 0; i < 16; i++) { - LOAD64H(W[i], buf + (8*i)); - } - - /* fill W[16..79] */ - for (i = 16; i < 80; i++) { - W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]; - } - - /* Compress */ -#ifdef LTC_SMALL_CODE - for (i = 0; i < 80; i++) { - t0 = S[7] + Sigma1(S[4]) + Ch(S[4], S[5], S[6]) + K[i] + W[i]; - t1 = Sigma0(S[0]) + Maj(S[0], S[1], S[2]); - S[7] = S[6]; - S[6] = S[5]; - S[5] = S[4]; - S[4] = S[3] + t0; - S[3] = S[2]; - S[2] = S[1]; - S[1] = S[0]; - S[0] = t0 + t1; - } -#else -#define RND(a,b,c,d,e,f,g,h,i) \ - t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \ - t1 = Sigma0(a) + Maj(a, b, c); \ - d += t0; \ - h = t0 + t1; - - for (i = 0; i < 80; i += 8) { - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i+0); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],i+1); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],i+2); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],i+3); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],i+4); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],i+5); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],i+6); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],i+7); - } -#endif - - - /* feedback */ - for (i = 0; i < 8; i++) { - md->sha512.state[i] = md->sha512.state[i] + S[i]; - } - - return CRYPT_OK; -} - -/* compress 1024-bits */ -#ifdef LTC_CLEAN_STACK -static int sha512_compress(hash_state * md, unsigned char *buf) -{ - int err; - err = _sha512_compress(md, buf); - burn_stack(sizeof(ulong64) * 90 + sizeof(int)); - return err; -} -#endif - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int sha512_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - md->sha512.curlen = 0; - md->sha512.length = 0; - md->sha512.state[0] = CONST64(0x6a09e667f3bcc908); - md->sha512.state[1] = CONST64(0xbb67ae8584caa73b); - md->sha512.state[2] = CONST64(0x3c6ef372fe94f82b); - md->sha512.state[3] = CONST64(0xa54ff53a5f1d36f1); - md->sha512.state[4] = CONST64(0x510e527fade682d1); - md->sha512.state[5] = CONST64(0x9b05688c2b3e6c1f); - md->sha512.state[6] = CONST64(0x1f83d9abfb41bd6b); - md->sha512.state[7] = CONST64(0x5be0cd19137e2179); - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -HASH_PROCESS(sha512_process, sha512_compress, sha512, 128) - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (64 bytes) - @return CRYPT_OK if successful -*/ -int sha512_done(hash_state * md, unsigned char *out) -{ - int i; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->sha512.curlen >= sizeof(md->sha512.buf)) { - return CRYPT_INVALID_ARG; - } - - /* increase the length of the message */ - md->sha512.length += md->sha512.curlen * CONST64(8); - - /* append the '1' bit */ - md->sha512.buf[md->sha512.curlen++] = (unsigned char)0x80; - - /* if the length is currently above 112 bytes we append zeros - * then compress. Then we can fall back to padding zeros and length - * encoding like normal. - */ - if (md->sha512.curlen > 112) { - while (md->sha512.curlen < 128) { - md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; - } - sha512_compress(md, md->sha512.buf); - md->sha512.curlen = 0; - } - - /* pad upto 120 bytes of zeroes - * note: that from 112 to 120 is the 64 MSB of the length. We assume that you won't hash - * > 2^64 bits of data... :-) - */ - while (md->sha512.curlen < 120) { - md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; - } - - /* store length */ - STORE64H(md->sha512.length, md->sha512.buf+120); - sha512_compress(md, md->sha512.buf); - - /* copy output */ - for (i = 0; i < 8; i++) { - STORE64H(md->sha512.state[i], out+(8*i)); - } -#ifdef LTC_CLEAN_STACK - zeromem(md, sizeof(hash_state)); -#endif - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int sha512_test(void) -{ - #ifndef LTC_TEST - return CRYPT_NOP; - #else - static const struct { - char *msg; - unsigned char hash[64]; - } tests[] = { - { "abc", - { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, - 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31, - 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, - 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a, - 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, - 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd, - 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, - 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f } - }, - { "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", - { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda, - 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f, - 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1, - 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18, - 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4, - 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a, - 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54, - 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09 } - }, - }; - - int i; - unsigned char tmp[64]; - hash_state md; - - for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { - sha512_init(&md); - sha512_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); - sha512_done(&md, tmp); - if (XMEMCMP(tmp, tests[i].hash, 64) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; - #endif -} - -#ifdef LTC_SHA384 - #include "sha384.c" -#endif - -#endif - - - - -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha512.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2007/05/12 14:25:28 $ */ DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/SHA3api_ref.c Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/SHA3api_ref.c ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/SHA3api_ref.c +++ /dev/null @@ -1,117 +0,0 @@ -/*********************************************************************** -** -** Implementation of the AHS API using the Skein hash function. -** -** Source code author: Doug Whiting, 2008. -** -** This algorithm and source code is released to the public domain. -** -************************************************************************/ - -#include /* get the memcpy/memset functions */ -#include "skein.h" /* get the Skein API definitions */ -#include "SHA3api_ref.h"/* get the AHS API definitions */ - -/******************************************************************/ -/* AHS API code */ -/******************************************************************/ - -#if SKEIN_SHA3_API - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* select the context size and init the context */ -HashReturn Init(hashState *state, int hashbitlen) - { - if (hashbitlen <= SKEIN_256_NIST_MAX_HASHBITS) - { - Skein_Assert(hashbitlen > 0,BAD_HASHLEN); - state->statebits = 64*SKEIN_256_STATE_WORDS; - return Skein_256_Init(&state->u.ctx_256,(size_t) hashbitlen); - } - if (hashbitlen <= SKEIN_512_NIST_MAX_HASHBITS) - { - state->statebits = 64*SKEIN_512_STATE_WORDS; - return Skein_512_Init(&state->u.ctx_512,(size_t) hashbitlen); - } - else - { - state->statebits = 64*SKEIN1024_STATE_WORDS; - return Skein1024_Init(&state->u.ctx1024,(size_t) hashbitlen); - } - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* process data to be hashed */ -HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen) - { - /* only the final Update() call is allowed do partial bytes, else assert an error */ - Skein_Assert((state->u.h.T[1] & SKEIN_T1_FLAG_BIT_PAD) == 0 || databitlen == 0, FAIL); - - Skein_Assert(state->statebits % 256 == 0 && (state->statebits-256) < 1024,FAIL); - if ((databitlen & 7) == 0) /* partial bytes? */ - { - switch ((state->statebits >> 8) & 3) - { - case 2: return Skein_512_Update(&state->u.ctx_512,data,databitlen >> 3); - case 1: return Skein_256_Update(&state->u.ctx_256,data,databitlen >> 3); - case 0: return Skein1024_Update(&state->u.ctx1024,data,databitlen >> 3); - default: return FAIL; - } - } - else - { /* handle partial final byte */ - size_t bCnt = (databitlen >> 3) + 1; /* number of bytes to handle (nonzero here!) */ - u08b_t b,mask; - - mask = (u08b_t) (1u << (7 - (databitlen & 7))); /* partial byte bit mask */ - b = (u08b_t) ((data[bCnt-1] & (0-mask)) | mask); /* apply bit padding on final byte */ - - switch ((state->statebits >> 8) & 3) - { - case 2: Skein_512_Update(&state->u.ctx_512,data,bCnt-1); /* process all but the final byte */ - Skein_512_Update(&state->u.ctx_512,&b , 1 ); /* process the (masked) partial byte */ - break; - case 1: Skein_256_Update(&state->u.ctx_256,data,bCnt-1); /* process all but the final byte */ - Skein_256_Update(&state->u.ctx_256,&b , 1 ); /* process the (masked) partial byte */ - break; - case 0: Skein1024_Update(&state->u.ctx1024,data,bCnt-1); /* process all but the final byte */ - Skein1024_Update(&state->u.ctx1024,&b , 1 ); /* process the (masked) partial byte */ - break; - default: return FAIL; - } - Skein_Set_Bit_Pad_Flag(state->u.h); /* set tweak flag for the final call */ - - return SUCCESS; - } - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* finalize hash computation and output the result (hashbitlen bits) */ -HashReturn Final(hashState *state, BitSequence *hashval) - { - Skein_Assert(state->statebits % 256 == 0 && (state->statebits-256) < 1024,FAIL); - switch ((state->statebits >> 8) & 3) - { - case 2: return Skein_512_Final(&state->u.ctx_512,hashval); - case 1: return Skein_256_Final(&state->u.ctx_256,hashval); - case 0: return Skein1024_Final(&state->u.ctx1024,hashval); - default: return FAIL; - } - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* all-in-one hash function */ -HashReturn Hash(int hashbitlen, const BitSequence *data, /* all-in-one call */ - DataLength databitlen,BitSequence *hashval) - { - hashState state; - HashReturn r = Init(&state,hashbitlen); - if (r == SUCCESS) - { /* these calls do not fail when called properly */ - r = Update(&state,data,databitlen); - Final(&state,hashval); - } - return r; - } - -#endif /* SKEIN_SHA3_API */ DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/SHA3api_ref.h Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/SHA3api_ref.h ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/SHA3api_ref.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef _AHS_API_H_ -#define _AHS_API_H_ - -/*********************************************************************** -** -** Interface declarations of the AHS API using the Skein hash function. -** -** Source code author: Doug Whiting, 2008. -** -** This algorithm and source code is released to the public domain. -** -************************************************************************/ - -#include "skein.h" - -typedef enum - { - SUCCESS = SKEIN_SUCCESS, - FAIL = SKEIN_FAIL, - BAD_HASHLEN = SKEIN_BAD_HASHLEN - } - HashReturn; - -typedef size_t DataLength; /* bit count type */ -typedef u08b_t BitSequence; /* bit stream type */ - -typedef struct - { - uint_t statebits; /* 256, 512, or 1024 */ - union - { - Skein_Ctxt_Hdr_t h; /* common header "overlay" */ - Skein_256_Ctxt_t ctx_256; - Skein_512_Ctxt_t ctx_512; - Skein1024_Ctxt_t ctx1024; - } u; - } - hashState; - -/* "incremental" hashing API */ -HashReturn Init (hashState *state, int hashbitlen); -HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen); -HashReturn Final (hashState *state, BitSequence *hashval); - -/* "all-in-one" call */ -HashReturn Hash (int hashbitlen, const BitSequence *data, - DataLength databitlen, BitSequence *hashval); - - -/* -** Re-define the compile-time constants below to change the selection -** of the Skein state size in the Init() function in SHA3api_ref.c. -** -** That is, the NIST API does not allow for explicit selection of the -** Skein block size, so it must be done implicitly in the Init() function. -** The selection is controlled by these constants. -*/ -#ifndef SKEIN_256_NIST_MAX_HASHBITS -#define SKEIN_256_NIST_MAX_HASHBITS (256) -#endif - -#ifndef SKEIN_512_NIST_MAX_HASHBITS -#define SKEIN_512_NIST_MAX_HASHBITS (512) -#endif - -#endif /* ifdef _AHS_API_H_ */ DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/brg_endian.h Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/brg_endian.h ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/brg_endian.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 20/10/2006 -*/ - -#ifndef BRG_ENDIAN_H -#define BRG_ENDIAN_H - -#define IS_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ -#define IS_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ - -/* Include files where endian defines and byteswap functions may reside */ -#if defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ ) -# include -#elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \ - defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ ) -# include -#elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ ) -# if !defined( __MINGW32__ ) && !defined(AVR) -# include -# if !defined( __BEOS__ ) -# include -# endif -# endif -#endif - -/* Now attempt to set the define for platform byte order using any */ -/* of the four forms SYMBOL, _SYMBOL, __SYMBOL & __SYMBOL__, which */ -/* seem to encompass most endian symbol definitions */ - -#if defined( BIG_ENDIAN ) && defined( LITTLE_ENDIAN ) -# if defined( BYTE_ORDER ) && BYTE_ORDER == BIG_ENDIAN -# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN -# elif defined( BYTE_ORDER ) && BYTE_ORDER == LITTLE_ENDIAN -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -# endif -#elif defined( BIG_ENDIAN ) -# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN -#elif defined( LITTLE_ENDIAN ) -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -#endif - -#if defined( _BIG_ENDIAN ) && defined( _LITTLE_ENDIAN ) -# if defined( _BYTE_ORDER ) && _BYTE_ORDER == _BIG_ENDIAN -# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN -# elif defined( _BYTE_ORDER ) && _BYTE_ORDER == _LITTLE_ENDIAN -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -# endif -#elif defined( _BIG_ENDIAN ) -# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN -#elif defined( _LITTLE_ENDIAN ) -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -#endif - -#if defined( __BIG_ENDIAN ) && defined( __LITTLE_ENDIAN ) -# if defined( __BYTE_ORDER ) && __BYTE_ORDER == __BIG_ENDIAN -# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN -# elif defined( __BYTE_ORDER ) && __BYTE_ORDER == __LITTLE_ENDIAN -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -# endif -#elif defined( __BIG_ENDIAN ) -# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN -#elif defined( __LITTLE_ENDIAN ) -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -#endif - -#if defined( __BIG_ENDIAN__ ) && defined( __LITTLE_ENDIAN__ ) -# if defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __BIG_ENDIAN__ -# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN -# elif defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __LITTLE_ENDIAN__ -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -# endif -#elif defined( __BIG_ENDIAN__ ) -# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN -#elif defined( __LITTLE_ENDIAN__ ) -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -#endif - -/* if the platform byte order could not be determined, then try to */ -/* set this define using common machine defines */ -#if !defined(PLATFORM_BYTE_ORDER) - -#if defined( __alpha__ ) || defined( __alpha ) || defined( i386 ) || \ - defined( __i386__ ) || defined( _M_I86 ) || defined( _M_IX86 ) || \ - defined( __OS2__ ) || defined( sun386 ) || defined( __TURBOC__ ) || \ - defined( vax ) || defined( vms ) || defined( VMS ) || \ - defined( __VMS ) || defined( _M_X64 ) || defined( AVR ) -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN - -#elif defined( AMIGA ) || defined( applec ) || defined( __AS400__ ) || \ - defined( _CRAY ) || defined( __hppa ) || defined( __hp9000 ) || \ - defined( ibm370 ) || defined( mc68000 ) || defined( m68k ) || \ - defined( __MRC__ ) || defined( __MVS__ ) || defined( __MWERKS__ ) || \ - defined( sparc ) || defined( __sparc) || defined( SYMANTEC_C ) || \ - defined( __VOS__ ) || defined( __TIGCC__ ) || defined( __TANDEM ) || \ - defined( THINK_C ) || defined( __VMCMS__ ) -# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN - -#elif 0 /* **** EDIT HERE IF NECESSARY **** */ -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -#elif 0 /* **** EDIT HERE IF NECESSARY **** */ -# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN -#else -# error Please edit lines 126 or 128 in brg_endian.h to set the platform byte order -#endif -#endif - -/* special handler for IA64, which may be either endianness (?) */ -/* here we assume little-endian, but this may need to be changed */ -#if defined(__ia64) || defined(__ia64__) || defined(_M_IA64) -# define PLATFORM_MUST_ALIGN (1) -#ifndef PLATFORM_BYTE_ORDER -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -#endif -#endif - -#ifndef PLATFORM_MUST_ALIGN -# define PLATFORM_MUST_ALIGN (0) -#endif - -#endif /* ifndef BRG_ENDIAN_H */ DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/brg_types.h Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/brg_types.h ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/brg_types.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 09/09/2006 - - The unsigned integer types defined here are of the form uint_t where - is the length of the type; for example, the unsigned 32-bit type is - 'uint_32t'. These are NOT the same as the 'C99 integer types' that are - defined in the inttypes.h and stdint.h headers since attempts to use these - types have shown that support for them is still highly variable. However, - since the latter are of the form uint_t, a regular expression search - and replace (in VC++ search on 'uint_{:z}t' and replace with 'uint\1_t') - can be used to convert the types used here to the C99 standard types. -*/ - -#ifndef BRG_TYPES_H -#define BRG_TYPES_H - -#if defined(__cplusplus) -extern "C" { -#endif - -#include - -#ifndef BRG_UI8 -# define BRG_UI8 -# if UCHAR_MAX == 255u - typedef unsigned char uint_8t; -# else -# error Please define uint_8t as an 8-bit unsigned integer type in brg_types.h -# endif -#endif - -#ifndef BRG_UI16 -# define BRG_UI16 -# if USHRT_MAX == 65535u - typedef unsigned short uint_16t; -# else -# error Please define uint_16t as a 16-bit unsigned short type in brg_types.h -# endif -#endif - -#ifndef BRG_UI32 -# define BRG_UI32 -# if UINT_MAX == 4294967295u -# define li_32(h) 0x##h##u - typedef unsigned int uint_32t; -# elif ULONG_MAX == 4294967295u -# define li_32(h) 0x##h##ul - typedef unsigned long uint_32t; -# elif defined( _CRAY ) -# error This code needs 32-bit data types, which Cray machines do not provide -# else -# error Please define uint_32t as a 32-bit unsigned integer type in brg_types.h -# endif -#endif - -#ifndef BRG_UI64 -# if defined( __BORLANDC__ ) && !defined( __MSDOS__ ) -# define BRG_UI64 -# define li_64(h) 0x##h##ui64 - typedef unsigned __int64 uint_64t; -# elif defined( _MSC_VER ) && ( _MSC_VER < 1300 ) /* 1300 == VC++ 7.0 */ -# define BRG_UI64 -# define li_64(h) 0x##h##ui64 - typedef unsigned __int64 uint_64t; -# elif defined( __sun ) && defined(ULONG_MAX) && ULONG_MAX == 0xfffffffful -# define BRG_UI64 -# define li_64(h) 0x##h##ull - typedef unsigned long long uint_64t; -# elif defined( UINT_MAX ) && UINT_MAX > 4294967295u -# if UINT_MAX == 18446744073709551615u -# define BRG_UI64 -# define li_64(h) 0x##h##u - typedef unsigned int uint_64t; -# endif -# elif defined( ULONG_MAX ) && ULONG_MAX > 4294967295u -# if ULONG_MAX == 18446744073709551615ul -# define BRG_UI64 -# define li_64(h) 0x##h##ul - typedef unsigned long uint_64t; -# endif -# elif defined( ULLONG_MAX ) && ULLONG_MAX > 4294967295u -# if ULLONG_MAX == 18446744073709551615ull -# define BRG_UI64 -# define li_64(h) 0x##h##ull - typedef unsigned long long uint_64t; -# endif -# elif defined( ULONG_LONG_MAX ) && ULONG_LONG_MAX > 4294967295u -# if ULONG_LONG_MAX == 18446744073709551615ull -# define BRG_UI64 -# define li_64(h) 0x##h##ull - typedef unsigned long long uint_64t; -# endif -# elif defined(__GNUC__) /* DLW: avoid mingw problem with -ansi */ -# define BRG_UI64 -# define li_64(h) 0x##h##ull - typedef unsigned long long uint_64t; -# endif -#endif - -#if defined( NEED_UINT_64T ) && !defined( BRG_UI64 ) -# error Please define uint_64t as an unsigned 64 bit type in brg_types.h -#endif - -#ifndef RETURN_VALUES -# define RETURN_VALUES -# if defined( DLL_EXPORT ) -# if defined( _MSC_VER ) || defined ( __INTEL_COMPILER ) -# define VOID_RETURN __declspec( dllexport ) void __stdcall -# define INT_RETURN __declspec( dllexport ) int __stdcall -# elif defined( __GNUC__ ) -# define VOID_RETURN __declspec( __dllexport__ ) void -# define INT_RETURN __declspec( __dllexport__ ) int -# else -# error Use of the DLL is only available on the Microsoft, Intel and GCC compilers -# endif -# elif defined( DLL_IMPORT ) -# if defined( _MSC_VER ) || defined ( __INTEL_COMPILER ) -# define VOID_RETURN __declspec( dllimport ) void __stdcall -# define INT_RETURN __declspec( dllimport ) int __stdcall -# elif defined( __GNUC__ ) -# define VOID_RETURN __declspec( __dllimport__ ) void -# define INT_RETURN __declspec( __dllimport__ ) int -# else -# error Use of the DLL is only available on the Microsoft, Intel and GCC compilers -# endif -# elif defined( __WATCOMC__ ) -# define VOID_RETURN void __cdecl -# define INT_RETURN int __cdecl -# else -# define VOID_RETURN void -# define INT_RETURN int -# endif -#endif - -/* These defines are used to declare buffers in a way that allows - faster operations on longer variables to be used. In all these - defines 'size' must be a power of 2 and >= 8 - - dec_unit_type(size,x) declares a variable 'x' of length - 'size' bits - - dec_bufr_type(size,bsize,x) declares a buffer 'x' of length 'bsize' - bytes defined as an array of variables - each of 'size' bits (bsize must be a - multiple of size / 8) - - ptr_cast(x,size) casts a pointer to a pointer to a - varaiable of length 'size' bits -*/ - -#define ui_type(size) uint_##size##t -#define dec_unit_type(size,x) typedef ui_type(size) x -#define dec_bufr_type(size,bsize,x) typedef ui_type(size) x[bsize / (size >> 3)] -#define ptr_cast(x,size) ((ui_type(size)*)(x)) - -#if defined(__cplusplus) -} -#endif - -#endif DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein.c Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein.c ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein.c +++ /dev/null @@ -1,792 +0,0 @@ -/*********************************************************************** -** -** Implementation of the Skein hash function. -** -** Source code author: Doug Whiting, 2008. -** -** This algorithm and source code is released to the public domain. -** -************************************************************************/ - -#define SKEIN_PORT_CODE /* instantiate any code in skein_port.h */ - -#include /* get the memcpy/memset functions */ -#include "skein.h" /* get the Skein API definitions */ -#include "skein_iv.h" /* get precomputed IVs */ - -/*****************************************************************/ -/* External function to process blkCnt (nonzero) full block(s) of data. */ -void Skein_256_Process_Block(Skein_256_Ctxt_t *ctx,const u08b_t *blkPtr,size_t blkCnt,size_t byteCntAdd); -void Skein_512_Process_Block(Skein_512_Ctxt_t *ctx,const u08b_t *blkPtr,size_t blkCnt,size_t byteCntAdd); -void Skein1024_Process_Block(Skein1024_Ctxt_t *ctx,const u08b_t *blkPtr,size_t blkCnt,size_t byteCntAdd); - -#if SKEIN256_BUILD - -/*****************************************************************/ -/* 256-bit Skein */ -/*****************************************************************/ - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* init the context for a straight hashing operation */ -int Skein_256_Init(Skein_256_Ctxt_t *ctx, size_t hashBitLen) - { - union - { - u08b_t b[SKEIN_256_STATE_BYTES]; - u64b_t w[SKEIN_256_STATE_WORDS]; - } cfg; /* config block */ - - Skein_Assert(hashBitLen > 0,SKEIN_BAD_HASHLEN); - ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ - - switch (hashBitLen) - { /* use pre-computed values, where available */ -#ifndef SKEIN_NO_PRECOMP - case 256: memcpy(ctx->X,SKEIN_256_IV_256,sizeof(ctx->X)); break; - case 224: memcpy(ctx->X,SKEIN_256_IV_224,sizeof(ctx->X)); break; - case 160: memcpy(ctx->X,SKEIN_256_IV_160,sizeof(ctx->X)); break; - case 128: memcpy(ctx->X,SKEIN_256_IV_128,sizeof(ctx->X)); break; -#endif - default: - /* here if there is no precomputed IV value available */ - /* build/process the config block, type == CONFIG (could be precomputed) */ - Skein_Start_New_Type(ctx,CFG_FINAL); /* set tweaks: T0=0; T1=CFG | FINAL */ - - cfg.w[0] = Skein_Swap64(SKEIN_SCHEMA_VER); /* set the schema, version */ - cfg.w[1] = Skein_Swap64(hashBitLen); /* hash result length in bits */ - cfg.w[2] = Skein_Swap64(SKEIN_CFG_TREE_INFO_SEQUENTIAL); - memset(&cfg.w[3],0,sizeof(cfg) - 3*sizeof(cfg.w[0])); /* zero pad config block */ - - /* compute the initial chaining values from config block */ - memset(ctx->X,0,sizeof(ctx->X)); /* zero the chaining variables */ - Skein_256_Process_Block(ctx,cfg.b,1,SKEIN_CFG_STR_LEN); - break; - } - /* The chaining vars ctx->X are now initialized for the given hashBitLen. */ - /* Set up to process the data message portion of the hash (default) */ - Skein_Start_New_Type(ctx,MSG); /* T0=0, T1= MSG type */ - - return SKEIN_SUCCESS; - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* init the context for a MAC and/or tree hash operation */ -/* [identical to Skein_256_Init() when keyBytes == 0 && treeInfo == SKEIN_CFG_TREE_INFO_SEQUENTIAL] */ -int Skein_256_InitExt(Skein_256_Ctxt_t *ctx,size_t hashBitLen,u64b_t treeInfo, const u08b_t *key, size_t keyBytes) - { - union - { - u08b_t b[SKEIN_256_STATE_BYTES]; - u64b_t w[SKEIN_256_STATE_WORDS]; - } cfg; /* config block */ - - Skein_Assert(hashBitLen > 0,SKEIN_BAD_HASHLEN); - Skein_Assert(keyBytes == 0 || key != NULL,SKEIN_FAIL); - - /* compute the initial chaining values ctx->X[], based on key */ - if (keyBytes == 0) /* is there a key? */ - { - memset(ctx->X,0,sizeof(ctx->X)); /* no key: use all zeroes as key for config block */ - } - else /* here to pre-process a key */ - { - Skein_assert(sizeof(cfg.b) >= sizeof(ctx->X)); - /* do a mini-Init right here */ - ctx->h.hashBitLen=8*sizeof(ctx->X); /* set output hash bit count = state size */ - Skein_Start_New_Type(ctx,KEY); /* set tweaks: T0 = 0; T1 = KEY type */ - memset(ctx->X,0,sizeof(ctx->X)); /* zero the initial chaining variables */ - Skein_256_Update(ctx,key,keyBytes); /* hash the key */ - Skein_256_Final_Pad(ctx,cfg.b); /* put result into cfg.b[] */ - memcpy(ctx->X,cfg.b,sizeof(cfg.b)); /* copy over into ctx->X[] */ -#if SKEIN_NEED_SWAP - { - uint_t i; - for (i=0;iX[i] = Skein_Swap64(ctx->X[i]); - } -#endif - } - /* build/process the config block, type == CONFIG (could be precomputed for each key) */ - ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ - Skein_Start_New_Type(ctx,CFG_FINAL); - - memset(&cfg.w,0,sizeof(cfg.w)); /* pre-pad cfg.w[] with zeroes */ - cfg.w[0] = Skein_Swap64(SKEIN_SCHEMA_VER); - cfg.w[1] = Skein_Swap64(hashBitLen); /* hash result length in bits */ - cfg.w[2] = Skein_Swap64(treeInfo); /* tree hash config info (or SKEIN_CFG_TREE_INFO_SEQUENTIAL) */ - - Skein_Show_Key(256,&ctx->h,key,keyBytes); - - /* compute the initial chaining values from config block */ - Skein_256_Process_Block(ctx,cfg.b,1,SKEIN_CFG_STR_LEN); - - /* The chaining vars ctx->X are now initialized */ - /* Set up to process the data message portion of the hash (default) */ - ctx->h.bCnt = 0; /* buffer b[] starts out empty */ - Skein_Start_New_Type(ctx,MSG); - - return SKEIN_SUCCESS; - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* process the input bytes */ -int Skein_256_Update(Skein_256_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt) - { - size_t n; - - Skein_Assert(ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - /* process full blocks, if any */ - if (msgByteCnt + ctx->h.bCnt > SKEIN_256_BLOCK_BYTES) - { - if (ctx->h.bCnt) /* finish up any buffered message data */ - { - n = SKEIN_256_BLOCK_BYTES - ctx->h.bCnt; /* # bytes free in buffer b[] */ - if (n) - { - Skein_assert(n < msgByteCnt); /* check on our logic here */ - memcpy(&ctx->b[ctx->h.bCnt],msg,n); - msgByteCnt -= n; - msg += n; - ctx->h.bCnt += n; - } - Skein_assert(ctx->h.bCnt == SKEIN_256_BLOCK_BYTES); - Skein_256_Process_Block(ctx,ctx->b,1,SKEIN_256_BLOCK_BYTES); - ctx->h.bCnt = 0; - } - /* now process any remaining full blocks, directly from input message data */ - if (msgByteCnt > SKEIN_256_BLOCK_BYTES) - { - n = (msgByteCnt-1) / SKEIN_256_BLOCK_BYTES; /* number of full blocks to process */ - Skein_256_Process_Block(ctx,msg,n,SKEIN_256_BLOCK_BYTES); - msgByteCnt -= n * SKEIN_256_BLOCK_BYTES; - msg += n * SKEIN_256_BLOCK_BYTES; - } - Skein_assert(ctx->h.bCnt == 0); - } - - /* copy any remaining source message data bytes into b[] */ - if (msgByteCnt) - { - Skein_assert(msgByteCnt + ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES); - memcpy(&ctx->b[ctx->h.bCnt],msg,msgByteCnt); - ctx->h.bCnt += msgByteCnt; - } - - return SKEIN_SUCCESS; - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* finalize the hash computation and output the result */ -int Skein_256_Final(Skein_256_Ctxt_t *ctx, u08b_t *hashVal) - { - size_t i,n,byteCnt; - u64b_t X[SKEIN_256_STATE_WORDS]; - Skein_Assert(ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ - if (ctx->h.bCnt < SKEIN_256_BLOCK_BYTES) /* zero pad b[] if necessary */ - memset(&ctx->b[ctx->h.bCnt],0,SKEIN_256_BLOCK_BYTES - ctx->h.bCnt); - - Skein_256_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ - - /* now output the result */ - byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ - - /* run Threefish in "counter mode" to generate output */ - memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ - memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ - for (i=0;i*SKEIN_256_BLOCK_BYTES < byteCnt;i++) - { - ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ - Skein_Start_New_Type(ctx,OUT_FINAL); - Skein_256_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ - n = byteCnt - i*SKEIN_256_BLOCK_BYTES; /* number of output bytes left to go */ - if (n >= SKEIN_256_BLOCK_BYTES) - n = SKEIN_256_BLOCK_BYTES; - Skein_Put64_LSB_First(hashVal+i*SKEIN_256_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes */ - Skein_Show_Final(256,&ctx->h,n,hashVal+i*SKEIN_256_BLOCK_BYTES); - memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ - } - return SKEIN_SUCCESS; - } - -#if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF) -size_t Skein_256_API_CodeSize(void) - { - return ((u08b_t *) Skein_256_API_CodeSize) - - ((u08b_t *) Skein_256_Init); - } -#endif - -#endif /* SKEIN256_BUILD */ - -#if SKEIN512_BUILD - -/*****************************************************************/ -/* 512-bit Skein */ -/*****************************************************************/ - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* init the context for a straight hashing operation */ -int Skein_512_Init(Skein_512_Ctxt_t *ctx, size_t hashBitLen) - { - union - { - u08b_t b[SKEIN_512_STATE_BYTES]; - u64b_t w[SKEIN_512_STATE_WORDS]; - } cfg; /* config block */ - - Skein_Assert(hashBitLen > 0,SKEIN_BAD_HASHLEN); - ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ - - switch (hashBitLen) - { /* use pre-computed values, where available */ -#ifndef SKEIN_NO_PRECOMP - case 512: memcpy(ctx->X,SKEIN_512_IV_512,sizeof(ctx->X)); break; - case 384: memcpy(ctx->X,SKEIN_512_IV_384,sizeof(ctx->X)); break; - case 256: memcpy(ctx->X,SKEIN_512_IV_256,sizeof(ctx->X)); break; - case 224: memcpy(ctx->X,SKEIN_512_IV_224,sizeof(ctx->X)); break; -#endif - default: - /* here if there is no precomputed IV value available */ - /* build/process the config block, type == CONFIG (could be precomputed) */ - Skein_Start_New_Type(ctx,CFG_FINAL); /* set tweaks: T0=0; T1=CFG | FINAL */ - - cfg.w[0] = Skein_Swap64(SKEIN_SCHEMA_VER); /* set the schema, version */ - cfg.w[1] = Skein_Swap64(hashBitLen); /* hash result length in bits */ - cfg.w[2] = Skein_Swap64(SKEIN_CFG_TREE_INFO_SEQUENTIAL); - memset(&cfg.w[3],0,sizeof(cfg) - 3*sizeof(cfg.w[0])); /* zero pad config block */ - - /* compute the initial chaining values from config block */ - memset(ctx->X,0,sizeof(ctx->X)); /* zero the chaining variables */ - Skein_512_Process_Block(ctx,cfg.b,1,SKEIN_CFG_STR_LEN); - break; - } - - /* The chaining vars ctx->X are now initialized for the given hashBitLen. */ - /* Set up to process the data message portion of the hash (default) */ - Skein_Start_New_Type(ctx,MSG); /* T0=0, T1= MSG type */ - - return SKEIN_SUCCESS; - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* init the context for a MAC and/or tree hash operation */ -/* [identical to Skein_512_Init() when keyBytes == 0 && treeInfo == SKEIN_CFG_TREE_INFO_SEQUENTIAL] */ -int Skein_512_InitExt(Skein_512_Ctxt_t *ctx,size_t hashBitLen,u64b_t treeInfo, const u08b_t *key, size_t keyBytes) - { - union - { - u08b_t b[SKEIN_512_STATE_BYTES]; - u64b_t w[SKEIN_512_STATE_WORDS]; - } cfg; /* config block */ - - Skein_Assert(hashBitLen > 0,SKEIN_BAD_HASHLEN); - Skein_Assert(keyBytes == 0 || key != NULL,SKEIN_FAIL); - - /* compute the initial chaining values ctx->X[], based on key */ - if (keyBytes == 0) /* is there a key? */ - { - memset(ctx->X,0,sizeof(ctx->X)); /* no key: use all zeroes as key for config block */ - } - else /* here to pre-process a key */ - { - Skein_assert(sizeof(cfg.b) >= sizeof(ctx->X)); - /* do a mini-Init right here */ - ctx->h.hashBitLen=8*sizeof(ctx->X); /* set output hash bit count = state size */ - Skein_Start_New_Type(ctx,KEY); /* set tweaks: T0 = 0; T1 = KEY type */ - memset(ctx->X,0,sizeof(ctx->X)); /* zero the initial chaining variables */ - Skein_512_Update(ctx,key,keyBytes); /* hash the key */ - Skein_512_Final_Pad(ctx,cfg.b); /* put result into cfg.b[] */ - memcpy(ctx->X,cfg.b,sizeof(cfg.b)); /* copy over into ctx->X[] */ -#if SKEIN_NEED_SWAP - { - uint_t i; - for (i=0;iX[i] = Skein_Swap64(ctx->X[i]); - } -#endif - } - /* build/process the config block, type == CONFIG (could be precomputed for each key) */ - ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ - Skein_Start_New_Type(ctx,CFG_FINAL); - - memset(&cfg.w,0,sizeof(cfg.w)); /* pre-pad cfg.w[] with zeroes */ - cfg.w[0] = Skein_Swap64(SKEIN_SCHEMA_VER); - cfg.w[1] = Skein_Swap64(hashBitLen); /* hash result length in bits */ - cfg.w[2] = Skein_Swap64(treeInfo); /* tree hash config info (or SKEIN_CFG_TREE_INFO_SEQUENTIAL) */ - - Skein_Show_Key(512,&ctx->h,key,keyBytes); - - /* compute the initial chaining values from config block */ - Skein_512_Process_Block(ctx,cfg.b,1,SKEIN_CFG_STR_LEN); - - /* The chaining vars ctx->X are now initialized */ - /* Set up to process the data message portion of the hash (default) */ - ctx->h.bCnt = 0; /* buffer b[] starts out empty */ - Skein_Start_New_Type(ctx,MSG); - - return SKEIN_SUCCESS; - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* process the input bytes */ -int Skein_512_Update(Skein_512_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt) - { - size_t n; - - Skein_Assert(ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - /* process full blocks, if any */ - if (msgByteCnt + ctx->h.bCnt > SKEIN_512_BLOCK_BYTES) - { - if (ctx->h.bCnt) /* finish up any buffered message data */ - { - n = SKEIN_512_BLOCK_BYTES - ctx->h.bCnt; /* # bytes free in buffer b[] */ - if (n) - { - Skein_assert(n < msgByteCnt); /* check on our logic here */ - memcpy(&ctx->b[ctx->h.bCnt],msg,n); - msgByteCnt -= n; - msg += n; - ctx->h.bCnt += n; - } - Skein_assert(ctx->h.bCnt == SKEIN_512_BLOCK_BYTES); - Skein_512_Process_Block(ctx,ctx->b,1,SKEIN_512_BLOCK_BYTES); - ctx->h.bCnt = 0; - } - /* now process any remaining full blocks, directly from input message data */ - if (msgByteCnt > SKEIN_512_BLOCK_BYTES) - { - n = (msgByteCnt-1) / SKEIN_512_BLOCK_BYTES; /* number of full blocks to process */ - Skein_512_Process_Block(ctx,msg,n,SKEIN_512_BLOCK_BYTES); - msgByteCnt -= n * SKEIN_512_BLOCK_BYTES; - msg += n * SKEIN_512_BLOCK_BYTES; - } - Skein_assert(ctx->h.bCnt == 0); - } - - /* copy any remaining source message data bytes into b[] */ - if (msgByteCnt) - { - Skein_assert(msgByteCnt + ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES); - memcpy(&ctx->b[ctx->h.bCnt],msg,msgByteCnt); - ctx->h.bCnt += msgByteCnt; - } - - return SKEIN_SUCCESS; - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* finalize the hash computation and output the result */ -int Skein_512_Final(Skein_512_Ctxt_t *ctx, u08b_t *hashVal) - { - size_t i,n,byteCnt; - u64b_t X[SKEIN_512_STATE_WORDS]; - Skein_Assert(ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ - if (ctx->h.bCnt < SKEIN_512_BLOCK_BYTES) /* zero pad b[] if necessary */ - memset(&ctx->b[ctx->h.bCnt],0,SKEIN_512_BLOCK_BYTES - ctx->h.bCnt); - - Skein_512_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ - - /* now output the result */ - byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ - - /* run Threefish in "counter mode" to generate output */ - memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ - memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ - for (i=0;i*SKEIN_512_BLOCK_BYTES < byteCnt;i++) - { - ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ - Skein_Start_New_Type(ctx,OUT_FINAL); - Skein_512_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ - n = byteCnt - i*SKEIN_512_BLOCK_BYTES; /* number of output bytes left to go */ - if (n >= SKEIN_512_BLOCK_BYTES) - n = SKEIN_512_BLOCK_BYTES; - Skein_Put64_LSB_First(hashVal+i*SKEIN_512_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes */ - Skein_Show_Final(512,&ctx->h,n,hashVal+i*SKEIN_512_BLOCK_BYTES); - memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ - } - return SKEIN_SUCCESS; - } - -#if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF) -size_t Skein_512_API_CodeSize(void) - { - return ((u08b_t *) Skein_512_API_CodeSize) - - ((u08b_t *) Skein_512_Init); - } -#endif - -#endif /* SKEIN512_BUILD */ - -#if SKEIN1024_BUILD - -/*****************************************************************/ -/* 1024-bit Skein */ -/*****************************************************************/ - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* init the context for a straight hashing operation */ -int Skein1024_Init(Skein1024_Ctxt_t *ctx, size_t hashBitLen) - { - union - { - u08b_t b[SKEIN1024_STATE_BYTES]; - u64b_t w[SKEIN1024_STATE_WORDS]; - } cfg; /* config block */ - - Skein_Assert(hashBitLen > 0,SKEIN_BAD_HASHLEN); - ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ - - switch (hashBitLen) - { /* use pre-computed values, where available */ -#ifndef SKEIN_NO_PRECOMP - case 512: memcpy(ctx->X,SKEIN1024_IV_512 ,sizeof(ctx->X)); break; - case 384: memcpy(ctx->X,SKEIN1024_IV_384 ,sizeof(ctx->X)); break; - case 1024: memcpy(ctx->X,SKEIN1024_IV_1024,sizeof(ctx->X)); break; -#endif - default: - /* here if there is no precomputed IV value available */ - /* build/process the config block, type == CONFIG (could be precomputed) */ - Skein_Start_New_Type(ctx,CFG_FINAL); /* set tweaks: T0=0; T1=CFG | FINAL */ - - cfg.w[0] = Skein_Swap64(SKEIN_SCHEMA_VER); /* set the schema, version */ - cfg.w[1] = Skein_Swap64(hashBitLen); /* hash result length in bits */ - cfg.w[2] = Skein_Swap64(SKEIN_CFG_TREE_INFO_SEQUENTIAL); - memset(&cfg.w[3],0,sizeof(cfg) - 3*sizeof(cfg.w[0])); /* zero pad config block */ - - /* compute the initial chaining values from config block */ - memset(ctx->X,0,sizeof(ctx->X)); /* zero the chaining variables */ - Skein1024_Process_Block(ctx,cfg.b,1,SKEIN_CFG_STR_LEN); - break; - } - - /* The chaining vars ctx->X are now initialized for the given hashBitLen. */ - /* Set up to process the data message portion of the hash (default) */ - Skein_Start_New_Type(ctx,MSG); /* T0=0, T1= MSG type */ - - return SKEIN_SUCCESS; - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* init the context for a MAC and/or tree hash operation */ -/* [identical to Skein1024_Init() when keyBytes == 0 && treeInfo == SKEIN_CFG_TREE_INFO_SEQUENTIAL] */ -int Skein1024_InitExt(Skein1024_Ctxt_t *ctx,size_t hashBitLen,u64b_t treeInfo, const u08b_t *key, size_t keyBytes) - { - union - { - u08b_t b[SKEIN1024_STATE_BYTES]; - u64b_t w[SKEIN1024_STATE_WORDS]; - } cfg; /* config block */ - - Skein_Assert(hashBitLen > 0,SKEIN_BAD_HASHLEN); - Skein_Assert(keyBytes == 0 || key != NULL,SKEIN_FAIL); - - /* compute the initial chaining values ctx->X[], based on key */ - if (keyBytes == 0) /* is there a key? */ - { - memset(ctx->X,0,sizeof(ctx->X)); /* no key: use all zeroes as key for config block */ - } - else /* here to pre-process a key */ - { - Skein_assert(sizeof(cfg.b) >= sizeof(ctx->X)); - /* do a mini-Init right here */ - ctx->h.hashBitLen=8*sizeof(ctx->X); /* set output hash bit count = state size */ - Skein_Start_New_Type(ctx,KEY); /* set tweaks: T0 = 0; T1 = KEY type */ - memset(ctx->X,0,sizeof(ctx->X)); /* zero the initial chaining variables */ - Skein1024_Update(ctx,key,keyBytes); /* hash the key */ - Skein1024_Final_Pad(ctx,cfg.b); /* put result into cfg.b[] */ - memcpy(ctx->X,cfg.b,sizeof(cfg.b)); /* copy over into ctx->X[] */ -#if SKEIN_NEED_SWAP - { - uint_t i; - for (i=0;iX[i] = Skein_Swap64(ctx->X[i]); - } -#endif - } - /* build/process the config block, type == CONFIG (could be precomputed for each key) */ - ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ - Skein_Start_New_Type(ctx,CFG_FINAL); - - memset(&cfg.w,0,sizeof(cfg.w)); /* pre-pad cfg.w[] with zeroes */ - cfg.w[0] = Skein_Swap64(SKEIN_SCHEMA_VER); - cfg.w[1] = Skein_Swap64(hashBitLen); /* hash result length in bits */ - cfg.w[2] = Skein_Swap64(treeInfo); /* tree hash config info (or SKEIN_CFG_TREE_INFO_SEQUENTIAL) */ - - Skein_Show_Key(1024,&ctx->h,key,keyBytes); - - /* compute the initial chaining values from config block */ - Skein1024_Process_Block(ctx,cfg.b,1,SKEIN_CFG_STR_LEN); - - /* The chaining vars ctx->X are now initialized */ - /* Set up to process the data message portion of the hash (default) */ - ctx->h.bCnt = 0; /* buffer b[] starts out empty */ - Skein_Start_New_Type(ctx,MSG); - - return SKEIN_SUCCESS; - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* process the input bytes */ -int Skein1024_Update(Skein1024_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt) - { - size_t n; - - Skein_Assert(ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - /* process full blocks, if any */ - if (msgByteCnt + ctx->h.bCnt > SKEIN1024_BLOCK_BYTES) - { - if (ctx->h.bCnt) /* finish up any buffered message data */ - { - n = SKEIN1024_BLOCK_BYTES - ctx->h.bCnt; /* # bytes free in buffer b[] */ - if (n) - { - Skein_assert(n < msgByteCnt); /* check on our logic here */ - memcpy(&ctx->b[ctx->h.bCnt],msg,n); - msgByteCnt -= n; - msg += n; - ctx->h.bCnt += n; - } - Skein_assert(ctx->h.bCnt == SKEIN1024_BLOCK_BYTES); - Skein1024_Process_Block(ctx,ctx->b,1,SKEIN1024_BLOCK_BYTES); - ctx->h.bCnt = 0; - } - /* now process any remaining full blocks, directly from input message data */ - if (msgByteCnt > SKEIN1024_BLOCK_BYTES) - { - n = (msgByteCnt-1) / SKEIN1024_BLOCK_BYTES; /* number of full blocks to process */ - Skein1024_Process_Block(ctx,msg,n,SKEIN1024_BLOCK_BYTES); - msgByteCnt -= n * SKEIN1024_BLOCK_BYTES; - msg += n * SKEIN1024_BLOCK_BYTES; - } - Skein_assert(ctx->h.bCnt == 0); - } - - /* copy any remaining source message data bytes into b[] */ - if (msgByteCnt) - { - Skein_assert(msgByteCnt + ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES); - memcpy(&ctx->b[ctx->h.bCnt],msg,msgByteCnt); - ctx->h.bCnt += msgByteCnt; - } - - return SKEIN_SUCCESS; - } - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* finalize the hash computation and output the result */ -int Skein1024_Final(Skein1024_Ctxt_t *ctx, u08b_t *hashVal) - { - size_t i,n,byteCnt; - u64b_t X[SKEIN1024_STATE_WORDS]; - Skein_Assert(ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ - if (ctx->h.bCnt < SKEIN1024_BLOCK_BYTES) /* zero pad b[] if necessary */ - memset(&ctx->b[ctx->h.bCnt],0,SKEIN1024_BLOCK_BYTES - ctx->h.bCnt); - - Skein1024_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ - - /* now output the result */ - byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ - - /* run Threefish in "counter mode" to generate output */ - memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ - memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ - for (i=0;i*SKEIN1024_BLOCK_BYTES < byteCnt;i++) - { - ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ - Skein_Start_New_Type(ctx,OUT_FINAL); - Skein1024_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ - n = byteCnt - i*SKEIN1024_BLOCK_BYTES; /* number of output bytes left to go */ - if (n >= SKEIN1024_BLOCK_BYTES) - n = SKEIN1024_BLOCK_BYTES; - Skein_Put64_LSB_First(hashVal+i*SKEIN1024_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes */ - Skein_Show_Final(1024,&ctx->h,n,hashVal+i*SKEIN1024_BLOCK_BYTES); - memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ - } - return SKEIN_SUCCESS; - } - -#if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF) -size_t Skein1024_API_CodeSize(void) - { - return ((u08b_t *) Skein1024_API_CodeSize) - - ((u08b_t *) Skein1024_Init); - } -#endif - -#endif /* SKEIN1024_BUILD */ - -/**************** Functions to support MAC/tree hashing ***************/ -/* (this code is identical for Optimized and Reference versions) */ - -#if SKEIN256_BUILD - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* finalize the hash computation and output the block, no OUTPUT stage */ -int Skein_256_Final_Pad(Skein_256_Ctxt_t *ctx, u08b_t *hashVal) - { - Skein_Assert(ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ - if (ctx->h.bCnt < SKEIN_256_BLOCK_BYTES) /* zero pad b[] if necessary */ - memset(&ctx->b[ctx->h.bCnt],0,SKEIN_256_BLOCK_BYTES - ctx->h.bCnt); - Skein_256_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ - - Skein_Put64_LSB_First(hashVal,ctx->X,SKEIN_256_BLOCK_BYTES); /* "output" the state bytes */ - - return SKEIN_SUCCESS; - } - -#endif /* SKEIN256_BUILD */ - -#if SKEIN512_BUILD - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* finalize the hash computation and output the block, no OUTPUT stage */ -int Skein_512_Final_Pad(Skein_512_Ctxt_t *ctx, u08b_t *hashVal) - { - Skein_Assert(ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ - if (ctx->h.bCnt < SKEIN_512_BLOCK_BYTES) /* zero pad b[] if necessary */ - memset(&ctx->b[ctx->h.bCnt],0,SKEIN_512_BLOCK_BYTES - ctx->h.bCnt); - Skein_512_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ - - Skein_Put64_LSB_First(hashVal,ctx->X,SKEIN_512_BLOCK_BYTES); /* "output" the state bytes */ - - return SKEIN_SUCCESS; - } - -#endif /* SKEIN512_BUILD */ - -#if SKEIN1024_BUILD - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* finalize the hash computation and output the block, no OUTPUT stage */ -int Skein1024_Final_Pad(Skein1024_Ctxt_t *ctx, u08b_t *hashVal) - { - Skein_Assert(ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ - if (ctx->h.bCnt < SKEIN1024_BLOCK_BYTES) /* zero pad b[] if necessary */ - memset(&ctx->b[ctx->h.bCnt],0,SKEIN1024_BLOCK_BYTES - ctx->h.bCnt); - Skein1024_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ - - Skein_Put64_LSB_First(hashVal,ctx->X,SKEIN1024_BLOCK_BYTES); /* "output" the state bytes */ - - return SKEIN_SUCCESS; - } - -#endif /* SKEIN1024_BUILD */ - -#if SKEIN_TREE_HASH -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* just do the OUTPUT stage */ - -#if SKEIN256_BUILD - -int Skein_256_Output(Skein_256_Ctxt_t *ctx, u08b_t *hashVal) - { - size_t i,n,byteCnt; - u64b_t X[SKEIN_256_STATE_WORDS]; - Skein_Assert(ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - /* now output the result */ - byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ - - /* run Threefish in "counter mode" to generate output */ - memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ - memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ - for (i=0;i*SKEIN_256_BLOCK_BYTES < byteCnt;i++) - { - ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ - Skein_Start_New_Type(ctx,OUT_FINAL); - Skein_256_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ - n = byteCnt - i*SKEIN_256_BLOCK_BYTES; /* number of output bytes left to go */ - if (n >= SKEIN_256_BLOCK_BYTES) - n = SKEIN_256_BLOCK_BYTES; - Skein_Put64_LSB_First(hashVal+i*SKEIN_256_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes */ - Skein_Show_Final(256,&ctx->h,n,hashVal+i*SKEIN_256_BLOCK_BYTES); - memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ - } - return SKEIN_SUCCESS; - } - -#endif /* SKEIN256_BUILD */ - -#if SKEIN512_BUILD - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* just do the OUTPUT stage */ -int Skein_512_Output(Skein_512_Ctxt_t *ctx, u08b_t *hashVal) - { - size_t i,n,byteCnt; - u64b_t X[SKEIN_512_STATE_WORDS]; - Skein_Assert(ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - /* now output the result */ - byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ - - /* run Threefish in "counter mode" to generate output */ - memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ - memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ - for (i=0;i*SKEIN_512_BLOCK_BYTES < byteCnt;i++) - { - ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ - Skein_Start_New_Type(ctx,OUT_FINAL); - Skein_512_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ - n = byteCnt - i*SKEIN_512_BLOCK_BYTES; /* number of output bytes left to go */ - if (n >= SKEIN_512_BLOCK_BYTES) - n = SKEIN_512_BLOCK_BYTES; - Skein_Put64_LSB_First(hashVal+i*SKEIN_512_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes */ - Skein_Show_Final(256,&ctx->h,n,hashVal+i*SKEIN_512_BLOCK_BYTES); - memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ - } - return SKEIN_SUCCESS; - } - -#endif /* SKEIN512_BUILD */ - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* just do the OUTPUT stage */ - -#if SKEIN1024_BUILD - -int Skein1024_Output(Skein1024_Ctxt_t *ctx, u08b_t *hashVal) - { - size_t i,n,byteCnt; - u64b_t X[SKEIN1024_STATE_WORDS]; - Skein_Assert(ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ - - /* now output the result */ - byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ - - /* run Threefish in "counter mode" to generate output */ - memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ - memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ - for (i=0;i*SKEIN1024_BLOCK_BYTES < byteCnt;i++) - { - ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ - Skein_Start_New_Type(ctx,OUT_FINAL); - Skein1024_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ - n = byteCnt - i*SKEIN1024_BLOCK_BYTES; /* number of output bytes left to go */ - if (n >= SKEIN1024_BLOCK_BYTES) - n = SKEIN1024_BLOCK_BYTES; - Skein_Put64_LSB_First(hashVal+i*SKEIN1024_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes */ - Skein_Show_Final(256,&ctx->h,n,hashVal+i*SKEIN1024_BLOCK_BYTES); - memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ - } - return SKEIN_SUCCESS; - } - -#endif /* SKEIN1024_BUILD */ - -#endif DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein.h Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein.h ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein.h +++ /dev/null @@ -1,365 +0,0 @@ -#ifndef _SKEIN_H_ -#define _SKEIN_H_ 1 -/************************************************************************** -** -** Interface declarations and internal definitions for Skein hashing. -** -** Source code author: Doug Whiting, 2008. - ** Changes added in for CommonCrypto/LTC: Jon Callas, 2010. -** -** This algorithm and source code is released to the public domain. -** -*************************************************************************** -** -** The following compile-time switches may be defined to control some -** tradeoffs between speed, code size, error checking, and security. -** -** The "default" note explains what happens when the switch is not defined. -** -** SKEIN_DEBUG -- make callouts from inside Skein code -** to examine/display intermediate values. -** [default: no callouts (no overhead)] -** -** SKEIN_ERR_CHECK -- how error checking is handled inside Skein -** code. If not defined, most error checking -** is disabled (for performance). Otherwise, -** the switch value is interpreted as: -** 0: use assert() to flag errors -** 1: return SKEIN_FAIL to flag errors -** -***************************************************************************/ - -#include /* get size_t definition */ -#include "skein_port.h" /* get platform-specific definitions */ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifndef SKEIN256_BUILD -#define SKEIN256_BUILD 0 -#define SKEIN512_BUILD 1 -#define SKEIN1024_BUILD 0 -#endif - -#define SKEIN_SHA3_API 0 /* build the SHA 3 API Routines? */ - -#define SKEIN_TREE_HASH 0 /* build the tree hash Routines? */ - -enum - { - SKEIN_SUCCESS = 0, /* return codes from Skein calls */ - SKEIN_FAIL = 1, - SKEIN_BAD_HASHLEN = 2 - }; - -#define SKEIN_MODIFIER_WORDS ( 2) /* number of modifier (tweak) words */ - -#define SKEIN_256_STATE_WORDS ( 4) -#define SKEIN_512_STATE_WORDS ( 8) -#define SKEIN1024_STATE_WORDS (16) -#define SKEIN_MAX_STATE_WORDS (16) - -#define SKEIN_256_STATE_BYTES ( 8*SKEIN_256_STATE_WORDS) -#define SKEIN_512_STATE_BYTES ( 8*SKEIN_512_STATE_WORDS) -#define SKEIN1024_STATE_BYTES ( 8*SKEIN1024_STATE_WORDS) - -#define SKEIN_256_STATE_BITS (64*SKEIN_256_STATE_WORDS) -#define SKEIN_512_STATE_BITS (64*SKEIN_512_STATE_WORDS) -#define SKEIN1024_STATE_BITS (64*SKEIN1024_STATE_WORDS) - -#define SKEIN_256_BLOCK_BYTES ( 8*SKEIN_256_STATE_WORDS) -#define SKEIN_512_BLOCK_BYTES ( 8*SKEIN_512_STATE_WORDS) -#define SKEIN1024_BLOCK_BYTES ( 8*SKEIN1024_STATE_WORDS) - -typedef struct - { - size_t hashBitLen; /* size of hash result, in bits */ - size_t bCnt; /* current byte count in buffer b[] */ - u64b_t T[SKEIN_MODIFIER_WORDS]; /* tweak words: T[0]=byte cnt, T[1]=flags */ - } Skein_Ctxt_Hdr_t; - -typedef struct /* 256-bit Skein hash context structure */ - { - Skein_Ctxt_Hdr_t h; /* common header context variables */ - u64b_t X[SKEIN_256_STATE_WORDS]; /* chaining variables */ - u08b_t b[SKEIN_256_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ - } Skein_256_Ctxt_t; - -typedef struct /* 512-bit Skein hash context structure */ - { - Skein_Ctxt_Hdr_t h; /* common header context variables */ - u64b_t X[SKEIN_512_STATE_WORDS]; /* chaining variables */ - u08b_t b[SKEIN_512_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ - } Skein_512_Ctxt_t; - -typedef struct /* 1024-bit Skein hash context structure */ - { - Skein_Ctxt_Hdr_t h; /* common header context variables */ - u64b_t X[SKEIN1024_STATE_WORDS]; /* chaining variables */ - u08b_t b[SKEIN1024_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ - } Skein1024_Ctxt_t; - -/* Skein APIs for (incremental) "straight hashing" */ -#if SKEIN256_BUILD -int Skein_256_Init (Skein_256_Ctxt_t *ctx, size_t hashBitLen); -int Skein_256_Update(Skein_256_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt); -int Skein_256_Final (Skein_256_Ctxt_t *ctx, u08b_t * hashVal); -#endif - -#if SKEIN512_BUILD -extern int Skein_512_Init (Skein_512_Ctxt_t *ctx, size_t hashBitLen); -extern int Skein_512_Update(Skein_512_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt); -extern int Skein_512_Final (Skein_512_Ctxt_t *ctx, u08b_t * hashVal); -#endif - -#if SKEIN1024_BUILD -int Skein1024_Init (Skein1024_Ctxt_t *ctx, size_t hashBitLen); -int Skein1024_Update(Skein1024_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt); -int Skein1024_Final (Skein1024_Ctxt_t *ctx, u08b_t * hashVal); -#endif - -/* -** Skein APIs for "extended" initialization: MAC keys, tree hashing. -** After an InitExt() call, just use Update/Final calls as with Init(). -** -** Notes: Same parameters as _Init() calls, plus treeInfo/key/keyBytes. -** When keyBytes == 0 and treeInfo == SKEIN_SEQUENTIAL, -** the results of InitExt() are identical to calling Init(). -** The function Init() may be called once to "precompute" the IV for -** a given hashBitLen value, then by saving a copy of the context -** the IV computation may be avoided in later calls. -** Similarly, the function InitExt() may be called once per MAC key -** to precompute the MAC IV, then a copy of the context saved and -** reused for each new MAC computation. -**/ -#if SKEIN256_BUILD -int Skein_256_InitExt(Skein_256_Ctxt_t *ctx, size_t hashBitLen, u64b_t treeInfo, const u08b_t *key, size_t keyBytes); -#endif -#if SKEIN512_BUILD -int Skein_512_InitExt(Skein_512_Ctxt_t *ctx, size_t hashBitLen, u64b_t treeInfo, const u08b_t *key, size_t keyBytes); -#endif -#if SKEIN1024_BUILD -int Skein1024_InitExt(Skein1024_Ctxt_t *ctx, size_t hashBitLen, u64b_t treeInfo, const u08b_t *key, size_t keyBytes); -#endif - -/* -** Skein APIs for MAC and tree hash: -** Final_Pad: pad, do final block, but no OUTPUT type -** Output: do just the output stage -*/ -#if SKEIN256_BUILD -int Skein_256_Final_Pad(Skein_256_Ctxt_t *ctx, u08b_t * hashVal); -#endif -#if SKEIN512_BUILD -int Skein_512_Final_Pad(Skein_512_Ctxt_t *ctx, u08b_t * hashVal); -#endif -#if SKEIN1024_BUILD -int Skein1024_Final_Pad(Skein1024_Ctxt_t *ctx, u08b_t * hashVal); -#endif - -#ifndef SKEIN_TREE_HASH -#define SKEIN_TREE_HASH (1) -#endif -#if SKEIN_TREE_HASH -#if SKEIN256_BUILD -int Skein_256_Output (Skein_256_Ctxt_t *ctx, u08b_t * hashVal); -#endif -#if SKEIN512_BUILD -int Skein_512_Output (Skein_512_Ctxt_t *ctx, u08b_t * hashVal); -#endif -#if SKEIN1024_BUILD -int Skein1024_Output (Skein1024_Ctxt_t *ctx, u08b_t * hashVal); -#endif -#endif - -/***************************************************************** -** "Internal" Skein definitions -** -- not needed for sequential hashing API, but will be -** helpful for other uses of Skein (e.g., tree hash mode). -** -- included here so that they can be shared between -** reference and optimized code. -******************************************************************/ - -/* tweak word T[1]: bit field starting positions */ -#define SKEIN_T1_BIT(BIT) ((BIT) - 64) /* offset 64 because it's the second word */ - -#define SKEIN_T1_POS_TREE_LVL SKEIN_T1_BIT(112) /* bits 112..118: level in hash tree */ -#define SKEIN_T1_POS_BIT_PAD SKEIN_T1_BIT(119) /* bit 119 : partial final input byte */ -#define SKEIN_T1_POS_BLK_TYPE SKEIN_T1_BIT(120) /* bits 120..125: type field */ -#define SKEIN_T1_POS_FIRST SKEIN_T1_BIT(126) /* bits 126 : first block flag */ -#define SKEIN_T1_POS_FINAL SKEIN_T1_BIT(127) /* bit 127 : final block flag */ - -/* tweak word T[1]: flag bit definition(s) */ -#define SKEIN_T1_FLAG_FIRST (((u64b_t) 1 ) << SKEIN_T1_POS_FIRST) -#define SKEIN_T1_FLAG_FINAL (((u64b_t) 1 ) << SKEIN_T1_POS_FINAL) -#define SKEIN_T1_FLAG_BIT_PAD (((u64b_t) 1 ) << SKEIN_T1_POS_BIT_PAD) - -/* tweak word T[1]: tree level bit field mask */ -#define SKEIN_T1_TREE_LVL_MASK (((u64b_t)0x7F) << SKEIN_T1_POS_TREE_LVL) -#define SKEIN_T1_TREE_LEVEL(n) (((u64b_t) (n)) << SKEIN_T1_POS_TREE_LVL) - -/* tweak word T[1]: block type field */ -#define SKEIN_BLK_TYPE_KEY ( 0) /* key, for MAC and KDF */ -#define SKEIN_BLK_TYPE_CFG ( 4) /* configuration block */ -#define SKEIN_BLK_TYPE_PERS ( 8) /* personalization string */ -#define SKEIN_BLK_TYPE_PK (12) /* public key (for digital signature hashing) */ -#define SKEIN_BLK_TYPE_KDF (16) /* key identifier for KDF */ -#define SKEIN_BLK_TYPE_NONCE (20) /* nonce for PRNG */ -#define SKEIN_BLK_TYPE_MSG (48) /* message processing */ -#define SKEIN_BLK_TYPE_OUT (63) /* output stage */ -#define SKEIN_BLK_TYPE_MASK (63) /* bit field mask */ - -#define SKEIN_T1_BLK_TYPE(T) (((u64b_t) (SKEIN_BLK_TYPE_##T)) << SKEIN_T1_POS_BLK_TYPE) -#define SKEIN_T1_BLK_TYPE_KEY SKEIN_T1_BLK_TYPE(KEY) /* key, for MAC and KDF */ -#define SKEIN_T1_BLK_TYPE_CFG SKEIN_T1_BLK_TYPE(CFG) /* configuration block */ -#define SKEIN_T1_BLK_TYPE_PERS SKEIN_T1_BLK_TYPE(PERS) /* personalization string */ -#define SKEIN_T1_BLK_TYPE_PK SKEIN_T1_BLK_TYPE(PK) /* public key (for digital signature hashing) */ -#define SKEIN_T1_BLK_TYPE_KDF SKEIN_T1_BLK_TYPE(KDF) /* key identifier for KDF */ -#define SKEIN_T1_BLK_TYPE_NONCE SKEIN_T1_BLK_TYPE(NONCE)/* nonce for PRNG */ -#define SKEIN_T1_BLK_TYPE_MSG SKEIN_T1_BLK_TYPE(MSG) /* message processing */ -#define SKEIN_T1_BLK_TYPE_OUT SKEIN_T1_BLK_TYPE(OUT) /* output stage */ -#define SKEIN_T1_BLK_TYPE_MASK SKEIN_T1_BLK_TYPE(MASK) /* field bit mask */ - -#define SKEIN_T1_BLK_TYPE_CFG_FINAL (SKEIN_T1_BLK_TYPE_CFG | SKEIN_T1_FLAG_FINAL) -#define SKEIN_T1_BLK_TYPE_OUT_FINAL (SKEIN_T1_BLK_TYPE_OUT | SKEIN_T1_FLAG_FINAL) - -#define SKEIN_VERSION (1) - -#ifndef SKEIN_ID_STRING_LE /* allow compile-time personalization */ -#define SKEIN_ID_STRING_LE (0x33414853) /* "SHA3" (little-endian)*/ -#endif - -#define SKEIN_MK_64(hi32,lo32) ((lo32) + (((u64b_t) (hi32)) << 32)) -#define SKEIN_SCHEMA_VER SKEIN_MK_64(SKEIN_VERSION,SKEIN_ID_STRING_LE) -#define SKEIN_KS_PARITY SKEIN_MK_64(0x55555555,0x55555555) - -#define SKEIN_CFG_STR_LEN (4*8) - -/* bit field definitions in config block treeInfo word */ -#define SKEIN_CFG_TREE_LEAF_SIZE_POS ( 0) -#define SKEIN_CFG_TREE_NODE_SIZE_POS ( 8) -#define SKEIN_CFG_TREE_MAX_LEVEL_POS (16) - -#define SKEIN_CFG_TREE_LEAF_SIZE_MSK (((u64b_t) 0xFF) << SKEIN_CFG_TREE_LEAF_SIZE_POS) -#define SKEIN_CFG_TREE_NODE_SIZE_MSK (((u64b_t) 0xFF) << SKEIN_CFG_TREE_NODE_SIZE_POS) -#define SKEIN_CFG_TREE_MAX_LEVEL_MSK (((u64b_t) 0xFF) << SKEIN_CFG_TREE_MAX_LEVEL_POS) - -#define SKEIN_CFG_TREE_INFO(leaf,node,maxLvl) \ - ( (((u64b_t)(leaf )) << SKEIN_CFG_TREE_LEAF_SIZE_POS) | \ - (((u64b_t)(node )) << SKEIN_CFG_TREE_NODE_SIZE_POS) | \ - (((u64b_t)(maxLvl)) << SKEIN_CFG_TREE_MAX_LEVEL_POS) ) - -#define SKEIN_CFG_TREE_INFO_SEQUENTIAL SKEIN_CFG_TREE_INFO(0,0,0) /* use as treeInfo in InitExt() call for sequential processing */ - -/* -** Skein macros for getting/setting tweak words, etc. -** These are useful for partial input bytes, hash tree init/update, etc. -**/ -#define Skein_Get_Tweak(ctxPtr,TWK_NUM) ((ctxPtr)->h.T[TWK_NUM]) -#define Skein_Set_Tweak(ctxPtr,TWK_NUM,tVal) {(ctxPtr)->h.T[TWK_NUM] = (tVal);} - -#define Skein_Get_T0(ctxPtr) Skein_Get_Tweak(ctxPtr,0) -#define Skein_Get_T1(ctxPtr) Skein_Get_Tweak(ctxPtr,1) -#define Skein_Set_T0(ctxPtr,T0) Skein_Set_Tweak(ctxPtr,0,T0) -#define Skein_Set_T1(ctxPtr,T1) Skein_Set_Tweak(ctxPtr,1,T1) - -/* set both tweak words at once */ -#define Skein_Set_T0_T1(ctxPtr,T0,T1) \ - { \ - Skein_Set_T0(ctxPtr,(T0)); \ - Skein_Set_T1(ctxPtr,(T1)); \ - } - -#define Skein_Set_Type(ctxPtr,BLK_TYPE) \ - Skein_Set_T1(ctxPtr,SKEIN_T1_BLK_TYPE_##BLK_TYPE) - -/* set up for starting with a new type: h.T[0]=0; h.T[1] = NEW_TYPE; h.bCnt=0; */ -#define Skein_Start_New_Type(ctxPtr,BLK_TYPE) \ - { Skein_Set_T0_T1(ctxPtr,0,SKEIN_T1_FLAG_FIRST | SKEIN_T1_BLK_TYPE_##BLK_TYPE); (ctxPtr)->h.bCnt=0; } - -#define Skein_Clear_First_Flag(hdr) { (hdr).T[1] &= ~SKEIN_T1_FLAG_FIRST; } -#define Skein_Set_Bit_Pad_Flag(hdr) { (hdr).T[1] |= SKEIN_T1_FLAG_BIT_PAD; } - -#define Skein_Set_Tree_Level(hdr,height) { (hdr).T[1] |= SKEIN_T1_TREE_LEVEL(height);} - -/***************************************************************** -** "Internal" Skein definitions for debugging and error checking -******************************************************************/ -#ifdef SKEIN_DEBUG /* examine/display intermediate values? */ -#include "skein_debug.h" -#else /* default is no callouts */ -#define Skein_Show_Block(bits,ctx,X,blkPtr,wPtr,ksEvenPtr,ksOddPtr) -#define Skein_Show_Round(bits,ctx,r,X) -#define Skein_Show_R_Ptr(bits,ctx,r,X_ptr) -#define Skein_Show_Final(bits,ctx,cnt,outPtr) -#define Skein_Show_Key(bits,ctx,key,keyBytes) -#endif - -#ifndef SKEIN_ERR_CHECK /* run-time checks (e.g., bad params, uninitialized context)? */ -#define Skein_Assert(x,retCode)/* default: ignore all Asserts, for performance */ -#define Skein_assert(x) -#elif defined(SKEIN_ASSERT) -#include -#define Skein_Assert(x,retCode) assert(x) -#define Skein_assert(x) assert(x) -#else -#include -#define Skein_Assert(x,retCode) { if (!(x)) return retCode; } /* caller error */ -#define Skein_assert(x) assert(x) /* internal error */ -#endif - -/***************************************************************** -** Skein block function constants (shared across Ref and Opt code) -******************************************************************/ -enum - { - /* Skein_256 round rotation constants */ - R_256_0_0=14, R_256_0_1=16, - R_256_1_0=52, R_256_1_1=57, - R_256_2_0=23, R_256_2_1=40, - R_256_3_0= 5, R_256_3_1=37, - R_256_4_0=25, R_256_4_1=33, - R_256_5_0=46, R_256_5_1=12, - R_256_6_0=58, R_256_6_1=22, - R_256_7_0=32, R_256_7_1=32, - - /* Skein_512 round rotation constants */ - R_512_0_0=46, R_512_0_1=36, R_512_0_2=19, R_512_0_3=37, - R_512_1_0=33, R_512_1_1=27, R_512_1_2=14, R_512_1_3=42, - R_512_2_0=17, R_512_2_1=49, R_512_2_2=36, R_512_2_3=39, - R_512_3_0=44, R_512_3_1= 9, R_512_3_2=54, R_512_3_3=56, - R_512_4_0=39, R_512_4_1=30, R_512_4_2=34, R_512_4_3=24, - R_512_5_0=13, R_512_5_1=50, R_512_5_2=10, R_512_5_3=17, - R_512_6_0=25, R_512_6_1=29, R_512_6_2=39, R_512_6_3=43, - R_512_7_0= 8, R_512_7_1=35, R_512_7_2=56, R_512_7_3=22, - - /* Skein1024 round rotation constants */ - R1024_0_0=24, R1024_0_1=13, R1024_0_2= 8, R1024_0_3=47, R1024_0_4= 8, R1024_0_5=17, R1024_0_6=22, R1024_0_7=37, - R1024_1_0=38, R1024_1_1=19, R1024_1_2=10, R1024_1_3=55, R1024_1_4=49, R1024_1_5=18, R1024_1_6=23, R1024_1_7=52, - R1024_2_0=33, R1024_2_1= 4, R1024_2_2=51, R1024_2_3=13, R1024_2_4=34, R1024_2_5=41, R1024_2_6=59, R1024_2_7=17, - R1024_3_0= 5, R1024_3_1=20, R1024_3_2=48, R1024_3_3=41, R1024_3_4=47, R1024_3_5=28, R1024_3_6=16, R1024_3_7=25, - R1024_4_0=41, R1024_4_1= 9, R1024_4_2=37, R1024_4_3=31, R1024_4_4=12, R1024_4_5=47, R1024_4_6=44, R1024_4_7=30, - R1024_5_0=16, R1024_5_1=34, R1024_5_2=56, R1024_5_3=51, R1024_5_4= 4, R1024_5_5=53, R1024_5_6=42, R1024_5_7=41, - R1024_6_0=31, R1024_6_1=44, R1024_6_2=47, R1024_6_3=46, R1024_6_4=19, R1024_6_5=42, R1024_6_6=44, R1024_6_7=25, - R1024_7_0= 9, R1024_7_1=48, R1024_7_2=35, R1024_7_3=52, R1024_7_4=23, R1024_7_5=31, R1024_7_6=37, R1024_7_7=20 - }; - -#ifndef SKEIN_ROUNDS -#define SKEIN_256_ROUNDS_TOTAL (72) /* number of rounds for the different block sizes */ -#define SKEIN_512_ROUNDS_TOTAL (72) -#define SKEIN1024_ROUNDS_TOTAL (80) -#else /* allow command-line define in range 8*(5..14) */ -#define SKEIN_256_ROUNDS_TOTAL (8*((((SKEIN_ROUNDS/100) + 5) % 10) + 5)) -#define SKEIN_512_ROUNDS_TOTAL (8*((((SKEIN_ROUNDS/ 10) + 5) % 10) + 5)) -#define SKEIN1024_ROUNDS_TOTAL (8*((((SKEIN_ROUNDS ) + 5) % 10) + 5)) -#endif - -#include "skein_dropin.h" - -#ifdef __cplusplus -} -#endif - -#endif /* ifndef _SKEIN_H_ */ DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_block.c Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_block.c ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_block.c +++ /dev/null @@ -1,709 +0,0 @@ -/*********************************************************************** -** -** Implementation of the Skein block functions. -** -** Source code author: Doug Whiting, 2008. -** Changes added in for CommonCrypto/LTC: Jon Callas, 2010. -** -** This algorithm and source code is released to the public domain. -** -** Compile-time switches: -** -** SKEIN_USE_ASM -- set bits (256/512/1024) to select which -** versions use ASM code for block processing -** [default: use C for all block sizes] -** -************************************************************************/ - -#include -#include "skein.h" - -#ifndef SKEIN_USE_ASM -#define SKEIN_USE_ASM (0) /* default is all C code (no ASM) */ -#endif - -#define SKEIN_LOOP 101 /* unroll Skein-512 only */ - -#ifndef SKEIN_LOOP -#define SKEIN_LOOP 001 /* default: unroll 256 and 512, but not 1024 */ -#endif - -#define BLK_BITS (WCNT*64) /* some useful definitions for code here */ -#define KW_TWK_BASE (0) -#define KW_KEY_BASE (3) -#define ks (kw + KW_KEY_BASE) -#define ts (kw + KW_TWK_BASE) - -#ifdef SKEIN_DEBUG -#define DebugSaveTweak(ctx) { ctx->h.T[0] = ts[0]; ctx->h.T[1] = ts[1]; } -#else -#define DebugSaveTweak(ctx) -#endif - -#ifndef SKEIN256_BUILD -#define SKEIN256_BUILD 0 -#define SKEIN512_BUILD 1 -#define SKEIN1024_BUILD 0 -#endif - -#if SKEIN256_BUILD -/***************************** Skein_256 ******************************/ -#if !(SKEIN_USE_ASM & 256) -void Skein_256_Process_Block(Skein_256_Ctxt_t *ctx,const u08b_t *blkPtr,size_t blkCnt,size_t byteCntAdd) - { /* do it in C */ - enum - { - WCNT = SKEIN_256_STATE_WORDS - }; -#undef RCNT -#define RCNT (SKEIN_256_ROUNDS_TOTAL/8) - -#ifdef SKEIN_LOOP /* configure how much to unroll the loop */ -#define SKEIN_UNROLL_256 (((SKEIN_LOOP)/100)%10) -#else -#define SKEIN_UNROLL_256 (0) -#endif - -#if SKEIN_UNROLL_256 -#if (RCNT % SKEIN_UNROLL_256) -//#error "Invalid SKEIN_UNROLL_256" /* sanity check on unroll count */ -#endif - size_t r; - u64b_t kw[WCNT+4+RCNT*2]; /* key schedule words : chaining vars + tweak + "rotation"*/ -#else - u64b_t kw[WCNT+4]; /* key schedule words : chaining vars + tweak */ -#endif - u64b_t X0,X1,X2,X3; /* local copy of context vars, for speed */ - u64b_t w [WCNT]; /* local copy of input block */ -#ifdef SKEIN_DEBUG - const u64b_t *Xptr[4]; /* use for debugging (help compiler put Xn in registers) */ - Xptr[0] = &X0; Xptr[1] = &X1; Xptr[2] = &X2; Xptr[3] = &X3; -#endif - Skein_assert(blkCnt != 0); /* never call with blkCnt == 0! */ - ts[0] = ctx->h.T[0]; - ts[1] = ctx->h.T[1]; - do { - /* this implementation only supports 2**64 input bytes (no carry out here) */ - ts[0] += byteCntAdd; /* update processed length */ - - /* precompute the key schedule for this block */ - ks[0] = ctx->X[0]; - ks[1] = ctx->X[1]; - ks[2] = ctx->X[2]; - ks[3] = ctx->X[3]; - ks[4] = ks[0] ^ ks[1] ^ ks[2] ^ ks[3] ^ SKEIN_KS_PARITY; - - ts[2] = ts[0] ^ ts[1]; - - Skein_Get64_LSB_First(w,blkPtr,WCNT); /* get input block in little-endian format */ - DebugSaveTweak(ctx); - Skein_Show_Block(BLK_BITS,&ctx->h,ctx->X,blkPtr,w,ks,ts); - - X0 = w[0] + ks[0]; /* do the first full key injection */ - X1 = w[1] + ks[1] + ts[0]; - X2 = w[2] + ks[2] + ts[1]; - X3 = w[3] + ks[3]; - - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,SKEIN_RND_KEY_INITIAL,Xptr); /* show starting state values */ - - blkPtr += SKEIN_256_BLOCK_BYTES; - - /* run the rounds */ - -#define Round256(p0,p1,p2,p3,ROT,rNum) \ - X##p0 += X##p1; X##p1 = RotL_64(X##p1,ROT##_0); X##p1 ^= X##p0; \ - X##p2 += X##p3; X##p3 = RotL_64(X##p3,ROT##_1); X##p3 ^= X##p2; \ - -#if SKEIN_UNROLL_256 == 0 -#define R256(p0,p1,p2,p3,ROT,rNum) /* fully unrolled */ \ - Round256(p0,p1,p2,p3,ROT,rNum) \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,rNum,Xptr); - -#define I256(R) \ - X0 += ks[((R)+1) % 5]; /* inject the key schedule value */ \ - X1 += ks[((R)+2) % 5] + ts[((R)+1) % 3]; \ - X2 += ks[((R)+3) % 5] + ts[((R)+2) % 3]; \ - X3 += ks[((R)+4) % 5] + (R)+1; \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,SKEIN_RND_KEY_INJECT,Xptr); -#else /* looping version */ -#define R256(p0,p1,p2,p3,ROT,rNum) \ - Round256(p0,p1,p2,p3,ROT,rNum) \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,4*(r-1)+rNum,Xptr); - -#define I256(R) \ - X0 += ks[r+(R)+0]; /* inject the key schedule value */ \ - X1 += ks[r+(R)+1] + ts[r+(R)+0]; \ - X2 += ks[r+(R)+2] + ts[r+(R)+1]; \ - X3 += ks[r+(R)+3] + r+(R) ; \ - ks[r + (R)+4 ] = ks[r+(R)-1]; /* rotate key schedule */\ - ts[r + (R)+2 ] = ts[r+(R)-1]; \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,SKEIN_RND_KEY_INJECT,Xptr); - - for (r=1;r < 2*RCNT;r+=2*SKEIN_UNROLL_256) /* loop thru it */ -#endif - { -#define R256_8_rounds(R) \ - R256(0,1,2,3,R_256_0,8*(R) + 1); \ - R256(0,3,2,1,R_256_1,8*(R) + 2); \ - R256(0,1,2,3,R_256_2,8*(R) + 3); \ - R256(0,3,2,1,R_256_3,8*(R) + 4); \ - I256(2*(R)); \ - R256(0,1,2,3,R_256_4,8*(R) + 5); \ - R256(0,3,2,1,R_256_5,8*(R) + 6); \ - R256(0,1,2,3,R_256_6,8*(R) + 7); \ - R256(0,3,2,1,R_256_7,8*(R) + 8); \ - I256(2*(R)+1); - - R256_8_rounds( 0); - -#define R256_Unroll_R(NN) ((SKEIN_UNROLL_256 == 0 && SKEIN_256_ROUNDS_TOTAL/8 > (NN)) || (SKEIN_UNROLL_256 > (NN))) - - #if R256_Unroll_R( 1) - R256_8_rounds( 1); - #endif - #if R256_Unroll_R( 2) - R256_8_rounds( 2); - #endif - #if R256_Unroll_R( 3) - R256_8_rounds( 3); - #endif - #if R256_Unroll_R( 4) - R256_8_rounds( 4); - #endif - #if R256_Unroll_R( 5) - R256_8_rounds( 5); - #endif - #if R256_Unroll_R( 6) - R256_8_rounds( 6); - #endif - #if R256_Unroll_R( 7) - R256_8_rounds( 7); - #endif - #if R256_Unroll_R( 8) - R256_8_rounds( 8); - #endif - #if R256_Unroll_R( 9) - R256_8_rounds( 9); - #endif - #if R256_Unroll_R(10) - R256_8_rounds(10); - #endif - #if R256_Unroll_R(11) - R256_8_rounds(11); - #endif - #if R256_Unroll_R(12) - R256_8_rounds(12); - #endif - #if R256_Unroll_R(13) - R256_8_rounds(13); - #endif - #if R256_Unroll_R(14) - R256_8_rounds(14); - #endif - #if (SKEIN_UNROLL_256 > 14) -//#error "need more unrolling in Skein_256_Process_Block" - #endif - } - /* do the final "feedforward" xor, update context chaining vars */ - ctx->X[0] = X0 ^ w[0]; - ctx->X[1] = X1 ^ w[1]; - ctx->X[2] = X2 ^ w[2]; - ctx->X[3] = X3 ^ w[3]; - - Skein_Show_Round(BLK_BITS,&ctx->h,SKEIN_RND_FEED_FWD,ctx->X); - - ts[1] &= ~SKEIN_T1_FLAG_FIRST; - } - while (--blkCnt); - ctx->h.T[0] = ts[0]; - ctx->h.T[1] = ts[1]; - } - -#if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF) -size_t Skein_256_Process_Block_CodeSize(void) - { - return ((u08b_t *) Skein_256_Process_Block_CodeSize) - - ((u08b_t *) Skein_256_Process_Block); - } -uint_t Skein_256_Unroll_Cnt(void) - { - return SKEIN_UNROLL_256; - } -#endif -#endif - -#endif /* SKEIN256_BUILD */ - -#if SKEIN512_BUILD - -/***************************** Skein_512 ******************************/ -#if !(SKEIN_USE_ASM & 512) -void Skein_512_Process_Block(Skein_512_Ctxt_t *ctx,const u08b_t *blkPtr,size_t blkCnt,size_t byteCntAdd) - { /* do it in C */ - enum - { - WCNT = SKEIN_512_STATE_WORDS - }; -#undef RCNT -#define RCNT (SKEIN_512_ROUNDS_TOTAL/8) - -#ifdef SKEIN_LOOP /* configure how much to unroll the loop */ -#define SKEIN_UNROLL_512 (((SKEIN_LOOP)/10)%10) -#else -#define SKEIN_UNROLL_512 (0) -#endif - -#if SKEIN_UNROLL_512 -#if (RCNT % SKEIN_UNROLL_512) -//#error "Invalid SKEIN_UNROLL_512" /* sanity check on unroll count */ -#endif - size_t r; - u64b_t kw[WCNT+4+RCNT*2]; /* key schedule words : chaining vars + tweak + "rotation"*/ -#else - u64b_t kw[WCNT+4]; /* key schedule words : chaining vars + tweak */ -#endif - u64b_t X0,X1,X2,X3,X4,X5,X6,X7; /* local copy of vars, for speed */ - u64b_t w [WCNT]; /* local copy of input block */ -#ifdef SKEIN_DEBUG - const u64b_t *Xptr[8]; /* use for debugging (help compiler put Xn in registers) */ - Xptr[0] = &X0; Xptr[1] = &X1; Xptr[2] = &X2; Xptr[3] = &X3; - Xptr[4] = &X4; Xptr[5] = &X5; Xptr[6] = &X6; Xptr[7] = &X7; -#endif - - Skein_assert(blkCnt != 0); /* never call with blkCnt == 0! */ - ts[0] = ctx->h.T[0]; - ts[1] = ctx->h.T[1]; - do { - /* this implementation only supports 2**64 input bytes (no carry out here) */ - ts[0] += byteCntAdd; /* update processed length */ - - /* precompute the key schedule for this block */ - ks[0] = ctx->X[0]; - ks[1] = ctx->X[1]; - ks[2] = ctx->X[2]; - ks[3] = ctx->X[3]; - ks[4] = ctx->X[4]; - ks[5] = ctx->X[5]; - ks[6] = ctx->X[6]; - ks[7] = ctx->X[7]; - ks[8] = ks[0] ^ ks[1] ^ ks[2] ^ ks[3] ^ - ks[4] ^ ks[5] ^ ks[6] ^ ks[7] ^ SKEIN_KS_PARITY; - - ts[2] = ts[0] ^ ts[1]; - - Skein_Get64_LSB_First(w,blkPtr,WCNT); /* get input block in little-endian format */ - DebugSaveTweak(ctx); - Skein_Show_Block(BLK_BITS,&ctx->h,ctx->X,blkPtr,w,ks,ts); - - X0 = w[0] + ks[0]; /* do the first full key injection */ - X1 = w[1] + ks[1]; - X2 = w[2] + ks[2]; - X3 = w[3] + ks[3]; - X4 = w[4] + ks[4]; - X5 = w[5] + ks[5] + ts[0]; - X6 = w[6] + ks[6] + ts[1]; - X7 = w[7] + ks[7]; - - blkPtr += SKEIN_512_BLOCK_BYTES; - - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,SKEIN_RND_KEY_INITIAL,Xptr); - /* run the rounds */ -#define Round512(p0,p1,p2,p3,p4,p5,p6,p7,ROT,rNum) \ - X##p0 += X##p1; X##p1 = RotL_64(X##p1,ROT##_0); X##p1 ^= X##p0; \ - X##p2 += X##p3; X##p3 = RotL_64(X##p3,ROT##_1); X##p3 ^= X##p2; \ - X##p4 += X##p5; X##p5 = RotL_64(X##p5,ROT##_2); X##p5 ^= X##p4; \ - X##p6 += X##p7; X##p7 = RotL_64(X##p7,ROT##_3); X##p7 ^= X##p6; \ - -#if SKEIN_UNROLL_512 == 0 -#define R512(p0,p1,p2,p3,p4,p5,p6,p7,ROT,rNum) /* unrolled */ \ - Round512(p0,p1,p2,p3,p4,p5,p6,p7,ROT,rNum) \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,rNum,Xptr); - -#define I512(R) \ - X0 += ks[((R)+1) % 9]; /* inject the key schedule value */ \ - X1 += ks[((R)+2) % 9]; \ - X2 += ks[((R)+3) % 9]; \ - X3 += ks[((R)+4) % 9]; \ - X4 += ks[((R)+5) % 9]; \ - X5 += ks[((R)+6) % 9] + ts[((R)+1) % 3]; \ - X6 += ks[((R)+7) % 9] + ts[((R)+2) % 3]; \ - X7 += ks[((R)+8) % 9] + (R)+1; \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,SKEIN_RND_KEY_INJECT,Xptr); -#else /* looping version */ -#define R512(p0,p1,p2,p3,p4,p5,p6,p7,ROT,rNum) \ - Round512(p0,p1,p2,p3,p4,p5,p6,p7,ROT,rNum) \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,4*(r-1)+rNum,Xptr); - -#define I512(R) \ - X0 += ks[r+(R)+0]; /* inject the key schedule value */ \ - X1 += ks[r+(R)+1]; \ - X2 += ks[r+(R)+2]; \ - X3 += ks[r+(R)+3]; \ - X4 += ks[r+(R)+4]; \ - X5 += ks[r+(R)+5] + ts[r+(R)+0]; \ - X6 += ks[r+(R)+6] + ts[r+(R)+1]; \ - X7 += ks[r+(R)+7] + r+(R) ; \ - ks[r + (R)+8] = ks[r+(R)-1]; /* rotate key schedule */ \ - ts[r + (R)+2] = ts[r+(R)-1]; \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,SKEIN_RND_KEY_INJECT,Xptr); - - for (r=1;r < 2*RCNT;r+=2*SKEIN_UNROLL_512) /* loop thru it */ -#endif /* end of looped code definitions */ - { -#define R512_8_rounds(R) /* do 8 full rounds */ \ - R512(0,1,2,3,4,5,6,7,R_512_0,8*(R)+ 1); \ - R512(2,1,4,7,6,5,0,3,R_512_1,8*(R)+ 2); \ - R512(4,1,6,3,0,5,2,7,R_512_2,8*(R)+ 3); \ - R512(6,1,0,7,2,5,4,3,R_512_3,8*(R)+ 4); \ - I512(2*(R)); \ - R512(0,1,2,3,4,5,6,7,R_512_4,8*(R)+ 5); \ - R512(2,1,4,7,6,5,0,3,R_512_5,8*(R)+ 6); \ - R512(4,1,6,3,0,5,2,7,R_512_6,8*(R)+ 7); \ - R512(6,1,0,7,2,5,4,3,R_512_7,8*(R)+ 8); \ - I512(2*(R)+1); /* and key injection */ - - R512_8_rounds( 0); - -#define R512_Unroll_R(NN) ((SKEIN_UNROLL_512 == 0 && SKEIN_512_ROUNDS_TOTAL/8 > (NN)) || (SKEIN_UNROLL_512 > (NN))) - - #if R512_Unroll_R( 1) - R512_8_rounds( 1); - #endif - #if R512_Unroll_R( 2) - R512_8_rounds( 2); - #endif - #if R512_Unroll_R( 3) - R512_8_rounds( 3); - #endif - #if R512_Unroll_R( 4) - R512_8_rounds( 4); - #endif - #if R512_Unroll_R( 5) - R512_8_rounds( 5); - #endif - #if R512_Unroll_R( 6) - R512_8_rounds( 6); - #endif - #if R512_Unroll_R( 7) - R512_8_rounds( 7); - #endif - #if R512_Unroll_R( 8) - R512_8_rounds( 8); - #endif - #if R512_Unroll_R( 9) - R512_8_rounds( 9); - #endif - #if R512_Unroll_R(10) - R512_8_rounds(10); - #endif - #if R512_Unroll_R(11) - R512_8_rounds(11); - #endif - #if R512_Unroll_R(12) - R512_8_rounds(12); - #endif - #if R512_Unroll_R(13) - R512_8_rounds(13); - #endif - #if R512_Unroll_R(14) - R512_8_rounds(14); - #endif - #if (SKEIN_UNROLL_512 > 14) -//#error "need more unrolling in Skein_512_Process_Block" - #endif - } - - /* do the final "feedforward" xor, update context chaining vars */ - ctx->X[0] = X0 ^ w[0]; - ctx->X[1] = X1 ^ w[1]; - ctx->X[2] = X2 ^ w[2]; - ctx->X[3] = X3 ^ w[3]; - ctx->X[4] = X4 ^ w[4]; - ctx->X[5] = X5 ^ w[5]; - ctx->X[6] = X6 ^ w[6]; - ctx->X[7] = X7 ^ w[7]; - Skein_Show_Round(BLK_BITS,&ctx->h,SKEIN_RND_FEED_FWD,ctx->X); - - ts[1] &= ~SKEIN_T1_FLAG_FIRST; - } - while (--blkCnt); - ctx->h.T[0] = ts[0]; - ctx->h.T[1] = ts[1]; - } - -#if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF) -size_t Skein_512_Process_Block_CodeSize(void) - { - return ((u08b_t *) Skein_512_Process_Block_CodeSize) - - ((u08b_t *) Skein_512_Process_Block); - } -uint_t Skein_512_Unroll_Cnt(void) - { - return SKEIN_UNROLL_512; - } -#endif -#endif - -#endif /* SKEIN512_BUILD */ - -#if SKEIN1024_BUILD - -/***************************** Skein1024 ******************************/ -#if !(SKEIN_USE_ASM & 1024) -void Skein1024_Process_Block(Skein1024_Ctxt_t *ctx,const u08b_t *blkPtr,size_t blkCnt,size_t byteCntAdd) - { /* do it in C, always looping (unrolled is bigger AND slower!) */ - enum - { - WCNT = SKEIN1024_STATE_WORDS - }; -#undef RCNT -#define RCNT (SKEIN1024_ROUNDS_TOTAL/8) - -#ifdef SKEIN_LOOP /* configure how much to unroll the loop */ -#define SKEIN_UNROLL_1024 ((SKEIN_LOOP)%10) -#else -#define SKEIN_UNROLL_1024 (0) -#endif - -#if (SKEIN_UNROLL_1024 != 0) -#if (RCNT % SKEIN_UNROLL_1024) -//#error "Invalid SKEIN_UNROLL_1024" /* sanity check on unroll count */ -#endif - size_t r; - u64b_t kw[WCNT+4+RCNT*2]; /* key schedule words : chaining vars + tweak + "rotation"*/ -#else - u64b_t kw[WCNT+4]; /* key schedule words : chaining vars + tweak */ -#endif - - u64b_t X00,X01,X02,X03,X04,X05,X06,X07, /* local copy of vars, for speed */ - X08,X09,X10,X11,X12,X13,X14,X15; - u64b_t w [WCNT]; /* local copy of input block */ -#ifdef SKEIN_DEBUG - const u64b_t *Xptr[16]; /* use for debugging (help compiler put Xn in registers) */ - Xptr[ 0] = &X00; Xptr[ 1] = &X01; Xptr[ 2] = &X02; Xptr[ 3] = &X03; - Xptr[ 4] = &X04; Xptr[ 5] = &X05; Xptr[ 6] = &X06; Xptr[ 7] = &X07; - Xptr[ 8] = &X08; Xptr[ 9] = &X09; Xptr[10] = &X10; Xptr[11] = &X11; - Xptr[12] = &X12; Xptr[13] = &X13; Xptr[14] = &X14; Xptr[15] = &X15; -#endif - - Skein_assert(blkCnt != 0); /* never call with blkCnt == 0! */ - ts[0] = ctx->h.T[0]; - ts[1] = ctx->h.T[1]; - do { - /* this implementation only supports 2**64 input bytes (no carry out here) */ - ts[0] += byteCntAdd; /* update processed length */ - - /* precompute the key schedule for this block */ - ks[ 0] = ctx->X[ 0]; - ks[ 1] = ctx->X[ 1]; - ks[ 2] = ctx->X[ 2]; - ks[ 3] = ctx->X[ 3]; - ks[ 4] = ctx->X[ 4]; - ks[ 5] = ctx->X[ 5]; - ks[ 6] = ctx->X[ 6]; - ks[ 7] = ctx->X[ 7]; - ks[ 8] = ctx->X[ 8]; - ks[ 9] = ctx->X[ 9]; - ks[10] = ctx->X[10]; - ks[11] = ctx->X[11]; - ks[12] = ctx->X[12]; - ks[13] = ctx->X[13]; - ks[14] = ctx->X[14]; - ks[15] = ctx->X[15]; - ks[16] = ks[ 0] ^ ks[ 1] ^ ks[ 2] ^ ks[ 3] ^ - ks[ 4] ^ ks[ 5] ^ ks[ 6] ^ ks[ 7] ^ - ks[ 8] ^ ks[ 9] ^ ks[10] ^ ks[11] ^ - ks[12] ^ ks[13] ^ ks[14] ^ ks[15] ^ SKEIN_KS_PARITY; - - ts[2] = ts[0] ^ ts[1]; - - Skein_Get64_LSB_First(w,blkPtr,WCNT); /* get input block in little-endian format */ - DebugSaveTweak(ctx); - Skein_Show_Block(BLK_BITS,&ctx->h,ctx->X,blkPtr,w,ks,ts); - - X00 = w[ 0] + ks[ 0]; /* do the first full key injection */ - X01 = w[ 1] + ks[ 1]; - X02 = w[ 2] + ks[ 2]; - X03 = w[ 3] + ks[ 3]; - X04 = w[ 4] + ks[ 4]; - X05 = w[ 5] + ks[ 5]; - X06 = w[ 6] + ks[ 6]; - X07 = w[ 7] + ks[ 7]; - X08 = w[ 8] + ks[ 8]; - X09 = w[ 9] + ks[ 9]; - X10 = w[10] + ks[10]; - X11 = w[11] + ks[11]; - X12 = w[12] + ks[12]; - X13 = w[13] + ks[13] + ts[0]; - X14 = w[14] + ks[14] + ts[1]; - X15 = w[15] + ks[15]; - - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,SKEIN_RND_KEY_INITIAL,Xptr); - -#define Round1024(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pA,pB,pC,pD,pE,pF,ROT,rNum) \ - X##p0 += X##p1; X##p1 = RotL_64(X##p1,ROT##_0); X##p1 ^= X##p0; \ - X##p2 += X##p3; X##p3 = RotL_64(X##p3,ROT##_1); X##p3 ^= X##p2; \ - X##p4 += X##p5; X##p5 = RotL_64(X##p5,ROT##_2); X##p5 ^= X##p4; \ - X##p6 += X##p7; X##p7 = RotL_64(X##p7,ROT##_3); X##p7 ^= X##p6; \ - X##p8 += X##p9; X##p9 = RotL_64(X##p9,ROT##_4); X##p9 ^= X##p8; \ - X##pA += X##pB; X##pB = RotL_64(X##pB,ROT##_5); X##pB ^= X##pA; \ - X##pC += X##pD; X##pD = RotL_64(X##pD,ROT##_6); X##pD ^= X##pC; \ - X##pE += X##pF; X##pF = RotL_64(X##pF,ROT##_7); X##pF ^= X##pE; \ - -#if SKEIN_UNROLL_1024 == 0 -#define R1024(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pA,pB,pC,pD,pE,pF,ROT,rn) \ - Round1024(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pA,pB,pC,pD,pE,pF,ROT,rn) \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,rn,Xptr); - -#define I1024(R) \ - X00 += ks[((R)+ 1) % 17]; /* inject the key schedule value */ \ - X01 += ks[((R)+ 2) % 17]; \ - X02 += ks[((R)+ 3) % 17]; \ - X03 += ks[((R)+ 4) % 17]; \ - X04 += ks[((R)+ 5) % 17]; \ - X05 += ks[((R)+ 6) % 17]; \ - X06 += ks[((R)+ 7) % 17]; \ - X07 += ks[((R)+ 8) % 17]; \ - X08 += ks[((R)+ 9) % 17]; \ - X09 += ks[((R)+10) % 17]; \ - X10 += ks[((R)+11) % 17]; \ - X11 += ks[((R)+12) % 17]; \ - X12 += ks[((R)+13) % 17]; \ - X13 += ks[((R)+14) % 17] + ts[((R)+1) % 3]; \ - X14 += ks[((R)+15) % 17] + ts[((R)+2) % 3]; \ - X15 += ks[((R)+16) % 17] + (R)+1; \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,SKEIN_RND_KEY_INJECT,Xptr); -#else /* looping version */ -#define R1024(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pA,pB,pC,pD,pE,pF,ROT,rn) \ - Round1024(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pA,pB,pC,pD,pE,pF,ROT,rn) \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,4*(r-1)+rn,Xptr); - -#define I1024(R) \ - X00 += ks[r+(R)+ 0]; /* inject the key schedule value */ \ - X01 += ks[r+(R)+ 1]; \ - X02 += ks[r+(R)+ 2]; \ - X03 += ks[r+(R)+ 3]; \ - X04 += ks[r+(R)+ 4]; \ - X05 += ks[r+(R)+ 5]; \ - X06 += ks[r+(R)+ 6]; \ - X07 += ks[r+(R)+ 7]; \ - X08 += ks[r+(R)+ 8]; \ - X09 += ks[r+(R)+ 9]; \ - X10 += ks[r+(R)+10]; \ - X11 += ks[r+(R)+11]; \ - X12 += ks[r+(R)+12]; \ - X13 += ks[r+(R)+13] + ts[r+(R)+0]; \ - X14 += ks[r+(R)+14] + ts[r+(R)+1]; \ - X15 += ks[r+(R)+15] + r+(R) ; \ - ks[r + (R)+16] = ks[r+(R)-1]; /* rotate key schedule */ \ - ts[r + (R)+ 2] = ts[r+(R)-1]; \ - Skein_Show_R_Ptr(BLK_BITS,&ctx->h,SKEIN_RND_KEY_INJECT,Xptr); - - for (r=1;r <= 2*RCNT;r+=2*SKEIN_UNROLL_1024) /* loop thru it */ -#endif - { -#define R1024_8_rounds(R) /* do 8 full rounds */ \ - R1024(00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,R1024_0,8*(R) + 1); \ - R1024(00,09,02,13,06,11,04,15,10,07,12,03,14,05,08,01,R1024_1,8*(R) + 2); \ - R1024(00,07,02,05,04,03,06,01,12,15,14,13,08,11,10,09,R1024_2,8*(R) + 3); \ - R1024(00,15,02,11,06,13,04,09,14,01,08,05,10,03,12,07,R1024_3,8*(R) + 4); \ - I1024(2*(R)); \ - R1024(00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,R1024_4,8*(R) + 5); \ - R1024(00,09,02,13,06,11,04,15,10,07,12,03,14,05,08,01,R1024_5,8*(R) + 6); \ - R1024(00,07,02,05,04,03,06,01,12,15,14,13,08,11,10,09,R1024_6,8*(R) + 7); \ - R1024(00,15,02,11,06,13,04,09,14,01,08,05,10,03,12,07,R1024_7,8*(R) + 8); \ - I1024(2*(R)+1); - - R1024_8_rounds( 0); - -#define R1024_Unroll_R(NN) ((SKEIN_UNROLL_1024 == 0 && SKEIN1024_ROUNDS_TOTAL/8 > (NN)) || (SKEIN_UNROLL_1024 > (NN))) - - #if R1024_Unroll_R( 1) - R1024_8_rounds( 1); - #endif - #if R1024_Unroll_R( 2) - R1024_8_rounds( 2); - #endif - #if R1024_Unroll_R( 3) - R1024_8_rounds( 3); - #endif - #if R1024_Unroll_R( 4) - R1024_8_rounds( 4); - #endif - #if R1024_Unroll_R( 5) - R1024_8_rounds( 5); - #endif - #if R1024_Unroll_R( 6) - R1024_8_rounds( 6); - #endif - #if R1024_Unroll_R( 7) - R1024_8_rounds( 7); - #endif - #if R1024_Unroll_R( 8) - R1024_8_rounds( 8); - #endif - #if R1024_Unroll_R( 9) - R1024_8_rounds( 9); - #endif - #if R1024_Unroll_R(10) - R1024_8_rounds(10); - #endif - #if R1024_Unroll_R(11) - R1024_8_rounds(11); - #endif - #if R1024_Unroll_R(12) - R1024_8_rounds(12); - #endif - #if R1024_Unroll_R(13) - R1024_8_rounds(13); - #endif - #if R1024_Unroll_R(14) - R1024_8_rounds(14); - #endif - #if (SKEIN_UNROLL_1024 > 14) -//#error "need more unrolling in Skein_1024_Process_Block" - #endif - } - /* do the final "feedforward" xor, update context chaining vars */ - - ctx->X[ 0] = X00 ^ w[ 0]; - ctx->X[ 1] = X01 ^ w[ 1]; - ctx->X[ 2] = X02 ^ w[ 2]; - ctx->X[ 3] = X03 ^ w[ 3]; - ctx->X[ 4] = X04 ^ w[ 4]; - ctx->X[ 5] = X05 ^ w[ 5]; - ctx->X[ 6] = X06 ^ w[ 6]; - ctx->X[ 7] = X07 ^ w[ 7]; - ctx->X[ 8] = X08 ^ w[ 8]; - ctx->X[ 9] = X09 ^ w[ 9]; - ctx->X[10] = X10 ^ w[10]; - ctx->X[11] = X11 ^ w[11]; - ctx->X[12] = X12 ^ w[12]; - ctx->X[13] = X13 ^ w[13]; - ctx->X[14] = X14 ^ w[14]; - ctx->X[15] = X15 ^ w[15]; - - Skein_Show_Round(BLK_BITS,&ctx->h,SKEIN_RND_FEED_FWD,ctx->X); - - ts[1] &= ~SKEIN_T1_FLAG_FIRST; - blkPtr += SKEIN1024_BLOCK_BYTES; - } - while (--blkCnt); - ctx->h.T[0] = ts[0]; - ctx->h.T[1] = ts[1]; - } - -#if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF) -size_t Skein1024_Process_Block_CodeSize(void) - { - return ((u08b_t *) Skein1024_Process_Block_CodeSize) - - ((u08b_t *) Skein1024_Process_Block); - } -uint_t Skein1024_Unroll_Cnt(void) - { - return SKEIN_UNROLL_1024; - } -#endif -#endif - -#endif /* SKEIN1024_BUILD */ DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_debug.c Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_debug.c ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_debug.c +++ /dev/null @@ -1,230 +0,0 @@ -/*********************************************************************** -** -** Debug output functions for Skein hashing. -** -** Source code author: Doug Whiting, 2008. -** -** This algorithm and source code is released to the public domain. -** -************************************************************************/ -#include - -#ifdef SKEIN_DEBUG /* only instantiate this code if SKEIN_DEBUG is on */ -#include "skein.h" - -static const char *INDENT = " "; /* how much to indent on new line */ - -uint_t skein_DebugFlag = 0; /* off by default. Must be set externally */ - -static void Show64(size_t cnt,const u64b_t *X) - { - size_t i; - for (i=0;i < cnt;i++) - { - if (i % 4 == 0) printf(INDENT); - printf(" %08X.%08X ",(uint_32t)(X[i] >> 32),(uint_32t)X[i]); - if (i % 4 == 3 || i==cnt-1) printf("\n"); - } - } - -static void Show08(size_t cnt,const u08b_t *b) - { - size_t i; - for (i=0;i < cnt;i++) - { - if (i %16 == 0) printf(INDENT); - else if (i % 4 == 0) printf(" "); - printf(" %02X",b[i]); - if (i %16 == 15 || i==cnt-1) printf("\n"); - } - } - -static const char *AlgoHeader(uint_t bits) - { - if (skein_DebugFlag & SKEIN_DEBUG_THREEFISH) - switch (bits) - { - case 256: return ":Threefish-256: "; - case 512: return ":Threefish-512: "; - case 1024: return ":Threefish-1024:"; - } - else - switch (bits) - { - case 256: return ":Skein-256: "; - case 512: return ":Skein-512: "; - case 1024: return ":Skein-1024:"; - } - return NULL; - } - -void Skein_Show_Final(uint_t bits,const Skein_Ctxt_Hdr_t *h,size_t cnt,const u08b_t *outPtr) - { - if (skein_DebugFlag & SKEIN_DEBUG_CONFIG || ((h->T[1] & SKEIN_T1_BLK_TYPE_MASK) != SKEIN_T1_BLK_TYPE_CFG)) - if (skein_DebugFlag & SKEIN_DEBUG_FINAL) - { - printf("\n%s Final output=\n",AlgoHeader(bits)); - Show08(cnt,outPtr); - printf(" ++++++++++\n"); - } - } - -/* show state after a round (or "pseudo-round") */ -void Skein_Show_Round(uint_t bits,const Skein_Ctxt_Hdr_t *h,size_t r,const u64b_t *X) - { - static uint_t injectNum=0; /* not multi-thread safe! */ - - if (skein_DebugFlag & SKEIN_DEBUG_CONFIG || ((h->T[1] & SKEIN_T1_BLK_TYPE_MASK) != SKEIN_T1_BLK_TYPE_CFG)) - if (skein_DebugFlag) - { - if (r >= SKEIN_RND_SPECIAL) - { /* a key injection (or feedforward) point */ - injectNum = (r == SKEIN_RND_KEY_INITIAL) ? 0 : injectNum+1; - if ( skein_DebugFlag & SKEIN_DEBUG_INJECT || - ((skein_DebugFlag & SKEIN_DEBUG_FINAL) && r == SKEIN_RND_FEED_FWD)) - { - printf("\n%s",AlgoHeader(bits)); - switch (r) - { - case SKEIN_RND_KEY_INITIAL: - printf(" [state after initial key injection]"); - break; - case SKEIN_RND_KEY_INJECT: - printf(" [state after key injection #%02d]",injectNum); - break; - case SKEIN_RND_FEED_FWD: - printf(" [state after plaintext feedforward]"); - injectNum = 0; - break; - } - printf("=\n"); - Show64(bits/64,X); - if (r== SKEIN_RND_FEED_FWD) - printf(" ----------\n"); - } - } - else if (skein_DebugFlag & SKEIN_DEBUG_ROUNDS) - { - uint_t j; - u64b_t p[SKEIN_MAX_STATE_WORDS]; - const u08b_t *perm; - const static u08b_t PERM_256 [4][ 4] = { { 0,1,2,3 }, { 0,3,2,1 }, { 0,1,2,3 }, { 0,3,2,1 } }; - const static u08b_t PERM_512 [4][ 8] = { { 0,1,2,3,4,5,6,7 }, - { 2,1,4,7,6,5,0,3 }, - { 4,1,6,3,0,5,2,7 }, - { 6,1,0,7,2,5,4,3 } - }; - const static u08b_t PERM_1024[4][16] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 }, - { 0, 9, 2,13, 6,11, 4,15,10, 7,12, 3,14, 5, 8, 1 }, - { 0, 7, 2, 5, 4, 3, 6, 1,12,15,14,13, 8,11,10, 9 }, - { 0,15, 2,11, 6,13, 4, 9,14, 1, 8, 5,10, 3,12, 7 } - }; - - if ((skein_DebugFlag & SKEIN_DEBUG_PERMUTE) && (r & 3)) - { - printf("\n%s [state after round %2d (permuted)]=\n",AlgoHeader(bits),r); - switch (bits) - { - case 256: perm = PERM_256 [r&3]; break; - case 512: perm = PERM_512 [r&3]; break; - default: perm = PERM_1024[r&3]; break; - } - for (j=0;jT[1] & SKEIN_T1_BLK_TYPE_MASK) != SKEIN_T1_BLK_TYPE_CFG)) - if (skein_DebugFlag) - { - if (skein_DebugFlag & SKEIN_DEBUG_HDR) - { - printf("\n%s Block: outBits=%4d. T0=%06X.",AlgoHeader(bits),(uint_t) h->hashBitLen,(uint_t)h->T[0]); - printf(" Type="); - n = (uint_t) ((h->T[1] & SKEIN_T1_BLK_TYPE_MASK) >> SKEIN_T1_POS_BLK_TYPE); - switch (n) - { - case SKEIN_BLK_TYPE_KEY: printf("KEY. "); break; - case SKEIN_BLK_TYPE_CFG: printf("CFG. "); break; - case SKEIN_BLK_TYPE_PERS: printf("PERS."); break; - case SKEIN_BLK_TYPE_PK : printf("PK. "); break; - case SKEIN_BLK_TYPE_KDF: printf("KDF. "); break; - case SKEIN_BLK_TYPE_MSG: printf("MSG. "); break; - case SKEIN_BLK_TYPE_OUT: printf("OUT. "); break; - default: printf("0x%02X.",n); break; - } - printf(" Flags="); - printf((h->T[1] & SKEIN_T1_FLAG_FIRST) ? " First":" "); - printf((h->T[1] & SKEIN_T1_FLAG_FINAL) ? " Final":" "); - printf((h->T[1] & SKEIN_T1_FLAG_BIT_PAD) ? " Pad" :" "); - n = (uint_t) ((h->T[1] & SKEIN_T1_TREE_LVL_MASK) >> SKEIN_T1_POS_TREE_LVL); - if (n) - printf(" TreeLevel = %02X",n); - printf("\n"); - } - if (skein_DebugFlag & SKEIN_DEBUG_TWEAK) - { - printf(" Tweak:\n"); - Show64(2,h->T); - } - if (skein_DebugFlag & SKEIN_DEBUG_STATE) - { - printf(" %s words:\n",(skein_DebugFlag & SKEIN_DEBUG_THREEFISH)?"Key":"State"); - Show64(bits/64,X); - } - if (skein_DebugFlag & SKEIN_DEBUG_KEYSCHED) - { - printf(" Tweak schedule:\n"); - Show64(3,tsPtr); - printf(" Key schedule:\n"); - Show64((bits/64)+1,ksPtr); - } - if (skein_DebugFlag & SKEIN_DEBUG_INPUT_64) - { - printf(" Input block (words):\n"); - Show64(bits/64,wPtr); - } - if (skein_DebugFlag & SKEIN_DEBUG_INPUT_08) - { - printf(" Input block (bytes):\n"); - Show08(bits/8,blkPtr); - } - } - } - -void Skein_Show_Key(uint_t bits,const Skein_Ctxt_Hdr_t *h,const u08b_t *key,size_t keyBytes) - { - if (keyBytes) - if (skein_DebugFlag & SKEIN_DEBUG_CONFIG || ((h->T[1] & SKEIN_T1_BLK_TYPE_MASK) != SKEIN_T1_BLK_TYPE_CFG)) - if (skein_DebugFlag & SKEIN_DEBUG_KEY) - { - printf("\n%s MAC key = %4u bytes\n",AlgoHeader(bits),keyBytes); - Show08(keyBytes,key); - } - } -#endif DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_debug.h Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_debug.h ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_debug.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _SKEIN_DEBUG_H_ -#define _SKEIN_DEBUG_H_ -/*********************************************************************** -** -** Interface definitions for Skein hashing debug output. -** -** Source code author: Doug Whiting, 2008. -** -** This algorithm and source code is released to the public domain. -** -************************************************************************/ - -#ifdef SKEIN_DEBUG -/* callout functions used inside Skein code */ -void Skein_Show_Block(uint_t bits,const Skein_Ctxt_Hdr_t *h,const u64b_t *X,const u08b_t *blkPtr, - const u64b_t *wPtr,const u64b_t *ksPtr,const u64b_t *tsPtr); -void Skein_Show_Round(uint_t bits,const Skein_Ctxt_Hdr_t *h,size_t r,const u64b_t *X); -void Skein_Show_R_Ptr(uint_t bits,const Skein_Ctxt_Hdr_t *h,size_t r,const u64b_t *X_ptr[]); -void Skein_Show_Final(uint_t bits,const Skein_Ctxt_Hdr_t *h,size_t cnt,const u08b_t *outPtr); -void Skein_Show_Key (uint_t bits,const Skein_Ctxt_Hdr_t *h,const u08b_t *key,size_t keyBytes); - -extern uint_t skein_DebugFlag; /* flags to control debug output (0 --> none) */ - -#define SKEIN_RND_SPECIAL (1000u) -#define SKEIN_RND_KEY_INITIAL (SKEIN_RND_SPECIAL+0u) -#define SKEIN_RND_KEY_INJECT (SKEIN_RND_SPECIAL+1u) -#define SKEIN_RND_FEED_FWD (SKEIN_RND_SPECIAL+2u) - -/* flag bits: skein_DebugFlag */ -#define SKEIN_DEBUG_KEY (1u << 1) /* show MAC key */ -#define SKEIN_DEBUG_CONFIG (1u << 2) /* show config block processing */ -#define SKEIN_DEBUG_STATE (1u << 3) /* show input state during Show_Block() */ -#define SKEIN_DEBUG_TWEAK (1u << 4) /* show input state during Show_Block() */ -#define SKEIN_DEBUG_KEYSCHED (1u << 5) /* show expanded key schedule */ -#define SKEIN_DEBUG_INPUT_64 (1u << 6) /* show input block as 64-bit words */ -#define SKEIN_DEBUG_INPUT_08 (1u << 7) /* show input block as 8-bit bytes */ -#define SKEIN_DEBUG_INJECT (1u << 8) /* show state after key injection & feedforward points */ -#define SKEIN_DEBUG_ROUNDS (1u << 9) /* show state after all rounds */ -#define SKEIN_DEBUG_FINAL (1u <<10) /* show final output of Skein */ -#define SKEIN_DEBUG_HDR (1u <<11) /* show block header */ -#define SKEIN_DEBUG_THREEFISH (1u <<12) /* use Threefish name instead of Skein */ -#define SKEIN_DEBUG_PERMUTE (1u <<13) /* use word permutations */ -#define SKEIN_DEBUG_ALL ((~0u) & ~(SKEIN_DEBUG_THREEFISH | SKEIN_DEBUG_PERMUTE)) -#define THREEFISH_DEBUG_ALL (SKEIN_DEBUG_ALL | SKEIN_DEBUG_THREEFISH) - -#endif /* SKEIN_DEBUG */ - -#endif /* _SKEIN_DEBUG_H_ */ DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_dropin.c Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_dropin.c ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_dropin.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * skein_dropin.c - * - * Created by Jon Callas on 5/25/10. - * Copyright 2010 Apple, Inc. All rights reserved. - * - */ - -#include "skein.h" - -#if SKEIN512_BUILD - -int Skein_512_128_Init(Skein_512_Ctxt_t *ctx) -{ - return Skein_512_Init(ctx, 128); -} - -int Skein_512_160_Init(Skein_512_Ctxt_t *ctx) -{ - return Skein_512_Init(ctx, 160); -} - -int Skein_512_224_Init(Skein_512_Ctxt_t *ctx) -{ - return Skein_512_Init(ctx, 224); -} - -int Skein_512_256_Init(Skein_512_Ctxt_t *ctx) -{ - return Skein_512_Init(ctx, 256); -} - -int Skein_512_384_Init(Skein_512_Ctxt_t *ctx) -{ - return Skein_512_Init(ctx, 384); -} - -int Skein_512_512_Init(Skein_512_Ctxt_t *ctx) -{ - return Skein_512_Init(ctx, 512); -} - -///// One-shot returns - -int Skein_512_128(const u08b_t *msg, size_t msgByteCnt, u08b_t *output) -{ - int result; - Skein_512_Ctxt_t ctx; - - result = Skein_512_Init(&ctx, 128); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Update(&ctx, msg, msgByteCnt); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Final(&ctx, output); - - return result; -} - -int Skein_512_160(const u08b_t *msg, size_t msgByteCnt, u08b_t *output) -{ - int result; - Skein_512_Ctxt_t ctx; - - result = Skein_512_Init(&ctx, 160); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Update(&ctx, msg, msgByteCnt); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Final(&ctx, output); - - return result; -} - -int Skein_512_224(const u08b_t *msg, size_t msgByteCnt, u08b_t *output) -{ - int result; - Skein_512_Ctxt_t ctx; - - result = Skein_512_Init(&ctx, 224); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Update(&ctx, msg, msgByteCnt); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Final(&ctx, output); - - return result; -} - -int Skein_512_256(const u08b_t *msg, size_t msgByteCnt, u08b_t *output) -{ - int result; - Skein_512_Ctxt_t ctx; - - result = Skein_512_Init(&ctx, 256); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Update(&ctx, msg, msgByteCnt); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Final(&ctx, output); - - return result; -} - -int Skein_512_384(const u08b_t *msg, size_t msgByteCnt, u08b_t *output) -{ - int result; - Skein_512_Ctxt_t ctx; - - result = Skein_512_Init(&ctx, 384); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Update(&ctx, msg, msgByteCnt); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Final(&ctx, output); - - return result; -} - -int Skein_512_512(const u08b_t *msg, size_t msgByteCnt, u08b_t *output) -{ - int result; - Skein_512_Ctxt_t ctx; - - result = Skein_512_Init(&ctx, 512); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Update(&ctx, msg, msgByteCnt); - - if (result == SKEIN_SUCCESS) - result = Skein_512_Final(&ctx, output); - - return result; -} - -#endif /* SKEIN512_BUILD */ - DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_dropin.h Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_dropin.h ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_dropin.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * skein_dropin.h - * - * Created by Jon Callas on 5/25/10. - * Copyright 2010 Apple, Inc. All rights reserved. - * - */ - -#ifndef _SKEIN_DROPIN_H_ -#define _SKEIN_DROPIN_H_ 1 - -#ifdef __cplusplus -extern "C" { -#endif - -extern int Skein_512_128_Init(Skein_512_Ctxt_t *ctx); -extern int Skein_512_160_Init(Skein_512_Ctxt_t *ctx); -extern int Skein_512_224_Init(Skein_512_Ctxt_t *ctx); -extern int Skein_512_256_Init(Skein_512_Ctxt_t *ctx); -extern int Skein_512_384_Init(Skein_512_Ctxt_t *ctx); -extern int Skein_512_512_Init(Skein_512_Ctxt_t *ctx); - - -extern int Skein_512_128(const u08b_t *msg, size_t msgByteCnt, u08b_t *output); -extern int Skein_512_160(const u08b_t *msg, size_t msgByteCnt, u08b_t *output); -extern int Skein_512_224(const u08b_t *msg, size_t msgByteCnt, u08b_t *output); -extern int Skein_512_256(const u08b_t *msg, size_t msgByteCnt, u08b_t *output); -extern int Skein_512_384(const u08b_t *msg, size_t msgByteCnt, u08b_t *output); -extern int Skein_512_512(const u08b_t *msg, size_t msgByteCnt, u08b_t *output); - -#ifdef __cplusplus -} -#endif - - -#endif DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_iv.h Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_iv.h ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_iv.h +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef _SKEIN_IV_H_ -#define _SKEIN_IV_H_ - -#include "skein.h" /* get Skein macros and types */ - -/* -***************** Pre-computed Skein IVs ******************* -** -** NOTE: these values are not "magic" constants, but -** are generated using the Threefish block function. -** They are pre-computed here only for speed; i.e., to -** avoid the need for a Threefish call during Init(). -** -** The IV for any fixed hash length may be pre-computed. -** Only the most common values are included here. -** -************************************************************ -**/ - -#define MK_64 SKEIN_MK_64 - -/* blkSize = 256 bits. hashSize = 128 bits */ -const u64b_t SKEIN_256_IV_128[] = - { - MK_64(0x46B39C3A,0xAA418D4F), - MK_64(0x681229DD,0x06920827), - MK_64(0xCBE067C9,0x78460238), - MK_64(0xC388A1B7,0x4EC45EF3) - }; - -/* blkSize = 256 bits. hashSize = 160 bits */ -const u64b_t SKEIN_256_IV_160[] = - { - MK_64(0xD51846B9,0xDAE51FBB), - MK_64(0x7D47BABD,0x6205526D), - MK_64(0xA1A8703E,0x47B89F20), - MK_64(0xB97D7234,0xC5927589) - }; - -/* blkSize = 256 bits. hashSize = 224 bits */ -const u64b_t SKEIN_256_IV_224[] = - { - MK_64(0xFE6720F4,0x5ED90A57), - MK_64(0x352D51F3,0xB01B6FBC), - MK_64(0xD764B04F,0x1785F14E), - MK_64(0xE7F24611,0xDDD59B27) - }; - -/* blkSize = 256 bits. hashSize = 256 bits */ -const u64b_t SKEIN_256_IV_256[] = - { - MK_64(0x164290A9,0xD4EEEF1D), - MK_64(0x8E7EAF44,0xB1B0CD15), - MK_64(0xA8BA0822,0xF69D09AE), - MK_64(0x0AF25C5E,0x364A6468) - }; - -/* blkSize = 512 bits. hashSize = 128 bits */ -const u64b_t SKEIN_512_IV_128[] = - { - MK_64(0x51AF0A1B,0x97A7DA9C), - MK_64(0xEC77F8A5,0xF4C6004C), - MK_64(0x0BB7182C,0x25CA1F6E), - MK_64(0x1B22A2CB,0x9F9339C5), - MK_64(0xC905E0A4,0x31216AA4), - MK_64(0xAEE4D5D0,0xBD378696), - MK_64(0x92744A50,0x1953D08A), - MK_64(0x2DCAD6F9,0x85777E17) - }; - -/* blkSize = 512 bits. hashSize = 160 bits */ -const u64b_t SKEIN_512_IV_160[] = - { - MK_64(0x9A73479A,0xC7701247), - MK_64(0xD657FBF8,0xFDE0DA1A), - MK_64(0xB1EE72A6,0xB04DA375), - MK_64(0xE87ED2A1,0xC20605B8), - MK_64(0x220A0EFA,0x9B925E17), - MK_64(0x6D72A217,0xEAF0B419), - MK_64(0x6CD72290,0xAA33FA72), - MK_64(0x5829089E,0x759C4256) - }; - -/* blkSize = 512 bits. hashSize = 224 bits */ -const u64b_t SKEIN_512_IV_224[] = - { - MK_64(0x10C55045,0x6BF94560), - MK_64(0x59004AF1,0xF558ACCC), - MK_64(0x82BD1BF9,0xB7461DFD), - MK_64(0x46B0F3A4,0x7C2AF60E), - MK_64(0xECC8498C,0xE80A8DCA), - MK_64(0x50A1DA33,0x10C836EF), - MK_64(0x3538F92A,0x39165A80), - MK_64(0x896A4329,0xCD5DCF2A) - }; - -/* blkSize = 512 bits. hashSize = 256 bits */ -const u64b_t SKEIN_512_IV_256[] = - { - MK_64(0x85A195B1,0x8B2264EC), - MK_64(0x7A6DAC64,0xC047C2B0), - MK_64(0xE1A21465,0xEE3FE124), - MK_64(0x1D211735,0x6504425A), - MK_64(0xC962DC0F,0xC0046F2C), - MK_64(0x8D5A3E90,0x4B1BE9C8), - MK_64(0xAFB7174B,0xBD8FEEE9), - MK_64(0x7FE63D9B,0xF94EDEB8) - }; - -/* blkSize = 512 bits. hashSize = 384 bits */ -const u64b_t SKEIN_512_IV_384[] = - { - MK_64(0x755C4957,0x16D7512B), - MK_64(0xB4587127,0x14DF4CEF), - MK_64(0x677D2E8C,0x027C060A), - MK_64(0x8DA4F592,0x05232716), - MK_64(0xCE454B58,0xC445AD7F), - MK_64(0x23048344,0xACA8BC96), - MK_64(0xF719BCC3,0x38768323), - MK_64(0xD77E3686,0x50579DEC) - }; - -/* blkSize = 512 bits. hashSize = 512 bits */ -const u64b_t SKEIN_512_IV_512[] = - { - MK_64(0x1A9A721C,0x8A265CA5), - MK_64(0xC9ABACF5,0xAA853978), - MK_64(0x4AF6652A,0xB80A2883), - MK_64(0x66F5E8A8,0x09A773C7), - MK_64(0x7FA984B7,0x81BAAF5B), - MK_64(0x0FE5D2D9,0x3233F397), - MK_64(0x6E29F932,0xDCB412D7), - MK_64(0xD40CD947,0x2F225C23) - }; - -/* blkSize = 1024 bits. hashSize = 384 bits */ -const u64b_t SKEIN1024_IV_384[] = - { - MK_64(0x9E887D47,0x2693F556), - MK_64(0xF4553A5A,0xB3A902D8), - MK_64(0x60A10790,0x28E4504E), - MK_64(0x96FAA39D,0x943F8ABE), - MK_64(0x2A769D27,0x828A22A7), - MK_64(0xB2F274F5,0xB2C3A833), - MK_64(0xC722C052,0x47F09222), - MK_64(0x377C4A92,0xEE78B216), - MK_64(0x97CFE7B2,0x039F4C9D), - MK_64(0xC864ACFA,0xC83C8364), - MK_64(0x73F26579,0x1D3CF723), - MK_64(0x2464DC1E,0x5E327F97), - MK_64(0x135D3954,0xF181CB1A), - MK_64(0x244BBF13,0x24C5C669), - MK_64(0xE1E258BC,0x446662E3), - MK_64(0xCF1E0F47,0x934A469C) - }; - -/* blkSize = 1024 bits. hashSize = 512 bits */ -const u64b_t SKEIN1024_IV_512[] = - { - MK_64(0x76066F1F,0x612DD519), - MK_64(0xD9B93D95,0x75D90191), - MK_64(0x582D15EA,0x89696586), - MK_64(0x4F1CA328,0xB5F10FB3), - MK_64(0x686C454D,0xEC64B419), - MK_64(0x2D7BD9B4,0x026EDABE), - MK_64(0xEF346195,0x1ACD05C4), - MK_64(0x1759E898,0x4446E275), - MK_64(0xACFC075A,0xE724456D), - MK_64(0x82F35D0A,0xE7704311), - MK_64(0x99D0B103,0x9AD7E344), - MK_64(0x85D6C81D,0x29F6204B), - MK_64(0x0CA2A987,0x5D57632A), - MK_64(0x069A8931,0x47A448FA), - MK_64(0x3C42FB50,0x02815320), - MK_64(0xF7E22C15,0x953E3125) - }; - -/* blkSize = 1024 bits. hashSize = 1024 bits */ -const u64b_t SKEIN1024_IV_1024[] = - { - MK_64(0x495E85B9,0x53876965), - MK_64(0x1E3D5C1B,0x41E754EF), - MK_64(0x23725455,0x2E9C10C7), - MK_64(0x0B00AAB4,0xFA441407), - MK_64(0x17DDA56A,0xA106337C), - MK_64(0xF98200E9,0xCAE13F94), - MK_64(0xF2DF7F00,0xADFF12BF), - MK_64(0xA92673D0,0xD0CA7AD9), - MK_64(0xC0DD64B0,0x4B27ED98), - MK_64(0x87C36A6C,0xA0A26F90), - MK_64(0x640C8526,0xD0850A10), - MK_64(0x6EBFAD0C,0x93DA09AE), - MK_64(0x617E3BCD,0xDEE4A85F), - MK_64(0x05A4A1A7,0xD82737B7), - MK_64(0x002BAF2C,0x3EB13D30), - MK_64(0x28527A78,0xC83D554C) - }; - -#endif /* _SKEIN_IV_H_ */ DELETED Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_port.h Index: Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_port.h ================================================================== --- Source/libtomcrypt/src/hashes/skein/Optimized_64bit/skein_port.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef _SKEIN_PORT_H_ -#define _SKEIN_PORT_H_ -/******************************************************************* -** -** Platform-specific definitions for Skein hash function. -** -** Source code author: Doug Whiting, 2008. -** -** This algorithm and source code is released to the public domain. -** -** Many thanks to Brian Gladman for his portable header files. -** -** To port Skein to an "unsupported" platform, change the definitions -** in this file appropriately. -** -********************************************************************/ - -#include "brg_types.h" /* get integer type definitions */ - -typedef unsigned int uint_t; /* native unsigned integer */ -typedef uint_8t u08b_t; /* 8-bit unsigned integer */ -typedef uint_64t u64b_t; /* 64-bit unsigned integer */ - -#ifndef RotL_64 -#define RotL_64(x,N) (((x) << (N)) | ((x) >> (64-(N)))) -#endif - -/* - * Skein is "natively" little-endian (unlike SHA-xxx), for optimal - * performance on x86 CPUs. The Skein code requires the following - * definitions for dealing with endianness: - * - * SKEIN_NEED_SWAP: 0 for little-endian, 1 for big-endian - * Skein_Put64_LSB_First - * Skein_Get64_LSB_First - * Skein_Swap64 - * - * If SKEIN_NEED_SWAP is defined at compile time, it is used here - * along with the portable versions of Put64/Get64/Swap64, which - * are slow in general. - * - * Otherwise, an "auto-detect" of endianness is attempted below. - * If the default handling doesn't work well, the user may insert - * platform-specific code instead (e.g., for big-endian CPUs). - * - */ -#ifndef SKEIN_NEED_SWAP /* compile-time "override" for endianness? */ - -#include "brg_endian.h" /* get endianness selection */ -#if PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN - /* here for big-endian CPUs */ -#define SKEIN_NEED_SWAP (1) -#elif PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN - /* here for x86 and x86-64 CPUs (and other detected little-endian CPUs) */ -#define SKEIN_NEED_SWAP (0) -#if PLATFORM_MUST_ALIGN == 0 /* ok to use "fast" versions? */ -#define Skein_Put64_LSB_First(dst08,src64,bCnt) memcpy(dst08,src64,bCnt) -#define Skein_Get64_LSB_First(dst64,src08,wCnt) memcpy(dst64,src08,8*(wCnt)) -#endif -#else -#error "Skein needs endianness setting!" -#endif - -#endif /* ifndef SKEIN_NEED_SWAP */ - -/* - ****************************************************************** - * Provide any definitions still needed. - ****************************************************************** - */ -#ifndef Skein_Swap64 /* swap for big-endian, nop for little-endian */ -#if SKEIN_NEED_SWAP -#define Skein_Swap64(w64) \ - ( (( ((u64b_t)(w64)) & 0xFF) << 56) | \ - (((((u64b_t)(w64)) >> 8) & 0xFF) << 48) | \ - (((((u64b_t)(w64)) >>16) & 0xFF) << 40) | \ - (((((u64b_t)(w64)) >>24) & 0xFF) << 32) | \ - (((((u64b_t)(w64)) >>32) & 0xFF) << 24) | \ - (((((u64b_t)(w64)) >>40) & 0xFF) << 16) | \ - (((((u64b_t)(w64)) >>48) & 0xFF) << 8) | \ - (((((u64b_t)(w64)) >>56) & 0xFF) ) ) -#else -#define Skein_Swap64(w64) (w64) -#endif -#endif /* ifndef Skein_Swap64 */ - - -#ifndef Skein_Put64_LSB_First -void Skein_Put64_LSB_First(u08b_t *dst,const u64b_t *src,size_t bCnt) -#ifdef SKEIN_PORT_CODE /* instantiate the function code here? */ - { /* this version is fully portable (big-endian or little-endian), but slow */ - size_t n; - - for (n=0;n>3] >> (8*(n&7))); - } -#else - ; /* output only the function prototype */ -#endif -#endif /* ifndef Skein_Put64_LSB_First */ - - -#ifndef Skein_Get64_LSB_First -void Skein_Get64_LSB_First(u64b_t *dst,const u08b_t *src,size_t wCnt) -#ifdef SKEIN_PORT_CODE /* instantiate the function code here? */ - { /* this version is fully portable (big-endian or little-endian), but slow */ - size_t n; - - for (n=0;n<8*wCnt;n+=8) - dst[n/8] = (((u64b_t) src[n ]) ) + - (((u64b_t) src[n+1]) << 8) + - (((u64b_t) src[n+2]) << 16) + - (((u64b_t) src[n+3]) << 24) + - (((u64b_t) src[n+4]) << 32) + - (((u64b_t) src[n+5]) << 40) + - (((u64b_t) src[n+6]) << 48) + - (((u64b_t) src[n+7]) << 56) ; - } -#else - ; /* output only the function prototype */ -#endif -#endif /* ifndef Skein_Get64_LSB_First */ - -#endif /* ifndef _SKEIN_PORT_H_ */ DELETED Source/libtomcrypt/src/hashes/skein_ltc.c Index: Source/libtomcrypt/src/hashes/skein_ltc.c ================================================================== --- Source/libtomcrypt/src/hashes/skein_ltc.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * skein_ltc.c - * Skein-Test - * - * Created by Jon Callas on 5/25/10. - * Copyright 2010 Apple, Inc. All rights reserved. - * - */ - -#include "tomcrypt.h" - -#include "skein.h" - -#ifdef LTC_SKEIN -#include "skein_ltc.h" - -int skein_test(void); - -const struct ltc_hash_descriptor skein512_128_desc = -{ - "skein512-128", /** name of hash **/ - SKEIN512_128_LTC_TAG, /** internal ID **/ - 128/8, /** Size of digest in octets **/ - 64, /** Input block size in octets */ - - /* OID */ - { 1, 2, 840, 113635, 100, 2, 8, - 128}, - /** Length of DER encoding */ - sizeof("\x06\x0B\x2A\x86\x48\x86\xF7\x63\x64\x02\x08\x81\x00")-1, - - &Skein_512_128_Init, - &Skein_512_Update, - &Skein_512_Final, - &skein_test, - NULL -}; - -const struct ltc_hash_descriptor skein512_160_desc = -{ - "skein512-160", /** name of hash **/ - SKEIN512_160_LTC_TAG, /** internal ID **/ - 160/8, /** Size of digest in octets **/ - 64, /** Input block size in octets */ - - /* OID */ - { 1, 2, 840, 113635, 100, 2, 8, - 160}, - /** Length of DER encoding */ - sizeof("\x06\x0B\x2A\x86\x48\x86\xF7\x63\x64\x02\x08\x81\x20")-1, - - &Skein_512_160_Init, - &Skein_512_Update, - &Skein_512_Final, - &skein_test, - NULL -}; - -const struct ltc_hash_descriptor skein512_224_desc = -{ - "skein512-224", /** name of hash **/ - SKEIN512_224_LTC_TAG, /** internal ID **/ - 224/8, /** Size of digest in octets **/ - 64, /** Input block size in octets */ - - /* OID */ - { 1, 2, 840, 113635, 100, 2, 8, - 224}, - /** Length of DER encoding */ - sizeof("\x06\x0B\x2A\x86\x48\x86\xF7\x63\x64\x02\x08\x81\x60")-1, - - &Skein_512_224_Init, - &Skein_512_Update, - &Skein_512_Final, - &skein_test, - NULL -}; - -const struct ltc_hash_descriptor skein512_256_desc = -{ - "skein512-256", /** name of hash **/ - SKEIN512_256_LTC_TAG, /** internal ID **/ - 256/8, /** Size of digest in octets **/ - 64, /** Input block size in octets */ - - /* OID */ - { 1, 2, 840, 113635, 100, 2, 8, - 256}, - /** Length of DER encoding */ - sizeof("\x06\x0B\x2A\x86\x48\x86\xF7\x63\x64\x02\x08\x82\x00")-1, - - &Skein_512_256_Init, - &Skein_512_Update, - &Skein_512_Final, - &skein_test, - NULL -}; - -const struct ltc_hash_descriptor skein512_384_desc = -{ - "skein512-384", /** name of hash **/ - SKEIN512_384_LTC_TAG, /** internal ID **/ - 384/8, /** Size of digest in octets **/ - 64, /** Input block size in octets */ - - /* OID */ - { 1, 2, 840, 113635, 100, 2, 8, - 384}, - /** Length of DER encoding */ - sizeof("\x06\x0B\x2A\x86\x48\x86\xF7\x63\x64\x02\x08\x83\x00")-1, - - &Skein_512_384_Init, - &Skein_512_Update, - &Skein_512_Final, - &skein_test, - NULL -}; - -const struct ltc_hash_descriptor skein512_512_desc = -{ - "skein512-512", /** name of hash **/ - SKEIN512_512_LTC_TAG, /** internal ID **/ - 512/8, /** Size of digest in octets **/ - 64, /** Input block size in octets */ - - /* OID */ - { 1, 2, 840, 113635, 100, 2, 8, - 512}, - /** Length of DER encoding */ - sizeof("\x06\x0B\x2A\x86\x48\x86\xF7\x63\x64\x02\x08\x84\x00")-1, - - &Skein_512_512_Init, - &Skein_512_Update, - &Skein_512_Final, - &skein_test, - NULL -}; - -int skein_test(void) -{ -#ifndef LTC_TEST - return CRYPT_NOP; -#else - static const struct { - char *msg; - unsigned char hash[20]; - } tests[] = { - { {0xFF, 0x00 }, - { 0x42, 0xAA, 0x6B, 0xD9, 0xCA, 0x92, 0xE9, 0x0E, 0xA2, 0x8D, 0xF6, 0xF6, 0xF2, 0xD0, 0xD9, 0xB8, - 0x5A, 0x2D, 0x19, 0x07, 0xEE, 0x4D, 0xC1, 0xB1, 0x71, 0xAC, 0xE7, 0xEB, 0x11, 0x59, 0xBE, 0x3B, - 0xD1, 0xBC, 0x56, 0x58, 0x6D, 0x92, 0x49, 0x2B, 0x6E, 0xFF, 0x9B, 0xE0, 0x33, 0x06, 0x99, 0x4C, - 0x65, 0xA3, 0x32, 0xC4, 0xC2, 0x41, 0x60, 0xF4, 0x66, 0x55, 0x04, 0x0E, 0x55, 0x8E, 0x83, 0x29 } - }, - { { 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0, - 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8, 0xE7, 0xE6, 0xE5, 0xE4, 0xE3, 0xE2, 0xE1, 0xE0, - 0xDF, 0xDE, 0xDD, 0xDC, 0xDB, 0xDA, 0xD9, 0xD8, 0xD7, 0xD6, 0xD5, 0xD4, 0xD3, 0xD2, 0xD1, 0xD0, - 0xCF, 0xCE, 0xCD, 0xCC, 0xCB, 0xCA, 0xC9, 0xC8, 0xC7, 0xC6, 0xC5, 0xC4, 0xC3, 0xC2, 0xC1, 0xC0, - 0x00 }, - { 0x04, 0xF9, 0x6C, 0x6F, 0x61, 0xB3, 0xE2, 0x37, 0xA4, 0xFA, 0x77, 0x55, 0xEE, 0x4A, 0xCF, 0x34, - 0x49, 0x42, 0x22, 0x96, 0x89, 0x54, 0xF4, 0x95, 0xAD, 0x14, 0x7A, 0x1A, 0x71, 0x5F, 0x7A, 0x73, - 0xEB, 0xEC, 0xFA, 0x1E, 0xF2, 0x75, 0xBE, 0xD8, 0x7D, 0xC6, 0x0B, 0xD1, 0xA0, 0xBC, 0x60, 0x21, - 0x06, 0xFA, 0x98, 0xF8, 0xE7, 0x23, 0x7B, 0xD1, 0xAC, 0x09, 0x58, 0xE7, 0x6D, 0x30, 0x66, 0x78 } - } - }; - - int i; - unsigned char tmp[64]; - Skein_512_Ctxt_t md; - - for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { - Skein_512_Init(&md, 512); - Skein_512_Update(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); - Skein_512_Final(&md, tmp); - if (XMEMCMP(tmp, tests[i].hash, 20) != 0) { - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; -#endif -} - - -#endif DELETED Source/libtomcrypt/src/hashes/skein_ltc.h Index: Source/libtomcrypt/src/hashes/skein_ltc.h ================================================================== --- Source/libtomcrypt/src/hashes/skein_ltc.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * skein_ltc.h - * Skein-Test - * - * Created by Jon Callas on 5/25/10. - * Copyright 2010 Apple, Inc. All rights reserved. - * - */ - -#include "tomcrypt.h" - -#ifndef _SKEIN_LTC_H_ -#define _SKEIN_LTC_H_ 1 -#ifdef LTC_SKEIN - -enum { - SKEIN512_128_LTC_TAG = 30, - SKEIN512_160_LTC_TAG = 31, - SKEIN512_224_LTC_TAG = 32, - SKEIN512_256_LTC_TAG = 33, - SKEIN512_384_LTC_TAG = 34, - SKEIN512_512_LTC_TAG = 35 -}; - -const struct ltc_hash_descriptor skein512_128_desc; -const struct ltc_hash_descriptor skein512_160_desc; -const struct ltc_hash_descriptor skein512_224_desc; -const struct ltc_hash_descriptor skein512_256_desc; -const struct ltc_hash_descriptor skein512_384_desc; -const struct ltc_hash_descriptor skein512_512_desc; -#endif -#endif DELETED Source/libtomcrypt/src/headers/tomcrypt.h Index: Source/libtomcrypt/src/headers/tomcrypt.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef TOMCRYPT_H_ -#define TOMCRYPT_H_ -#include -#include -#include -#include -#include -#include - -/* use configuration data */ -#include "tomcrypt_custom.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* version */ -#define CRYPT 0x0117 -#define SCRYPT "1.17" - -/* max size of either a cipher/hash block or symmetric key [largest of the two] */ -#define MAXBLOCKSIZE 128 - -/* descriptor table size */ -#define TAB_SIZE 32 - -/* error codes [will be expanded in future releases] */ -enum { - CRYPT_OK=0, /* Result OK */ - CRYPT_ERROR, /* Generic Error */ - CRYPT_NOP, /* Not a failure but no operation was performed */ - - CRYPT_INVALID_KEYSIZE, /* Invalid key size given */ - CRYPT_INVALID_ROUNDS, /* Invalid number of rounds */ - CRYPT_FAIL_TESTVECTOR, /* Algorithm failed test vectors */ - - CRYPT_BUFFER_OVERFLOW, /* Not enough space for output */ - CRYPT_INVALID_PACKET, /* Invalid input packet given */ - - CRYPT_INVALID_PRNGSIZE, /* Invalid number of bits for a PRNG */ - CRYPT_ERROR_READPRNG, /* Could not read enough from PRNG */ - - CRYPT_INVALID_CIPHER, /* Invalid cipher specified */ - CRYPT_INVALID_HASH, /* Invalid hash specified */ - CRYPT_INVALID_PRNG, /* Invalid PRNG specified */ - - CRYPT_MEM, /* Out of memory */ - - CRYPT_PK_TYPE_MISMATCH, /* Not equivalent types of PK keys */ - CRYPT_PK_NOT_PRIVATE, /* Requires a private PK key */ - - CRYPT_INVALID_ARG, /* Generic invalid argument */ - CRYPT_FILE_NOTFOUND, /* File Not Found */ - - CRYPT_PK_INVALID_TYPE, /* Invalid type of PK key */ - CRYPT_PK_INVALID_SYSTEM,/* Invalid PK system specified */ - CRYPT_PK_DUP, /* Duplicate key already in key ring */ - CRYPT_PK_NOT_FOUND, /* Key not found in keyring */ - CRYPT_PK_INVALID_SIZE, /* Invalid size input for PK parameters */ - - CRYPT_INVALID_PRIME_SIZE,/* Invalid size of prime requested */ - CRYPT_PK_INVALID_PADDING, /* Invalid padding on input */ - - CRYPT_HASH_OVERFLOW /* Hash applied to too many bits */ -#ifdef MACTOMCRYPT - , CRYPT_UNIMPLEMENTED /* called an unimplemented routine through a function table */ -#endif -}; - -#include "tomcrypt_cfg.h" -#include "tomcrypt_macros.h" -#include "tomcrypt_cipher.h" -#include "tomcrypt_hash.h" -#include "tomcrypt_mac.h" -#include "tomcrypt_prng.h" -#include "tomcrypt_pk.h" -#include "tomcrypt_math.h" -#include "tomcrypt_misc.h" -#include "tomcrypt_argchk.h" -#include "tomcrypt_pkcs.h" -#include "tomcrypt_mode.h" - -#ifdef __cplusplus - } -#endif - -#endif /* TOMCRYPT_H_ */ - - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt.h,v $ */ -/* $Revision: 1.21 $ */ -/* $Date: 2006/12/16 19:34:05 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_argchk.h Index: Source/libtomcrypt/src/headers/tomcrypt_argchk.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_argchk.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Defines the LTC_ARGCHK macro used within the library */ -/* ARGTYPE is defined in mycrypt_cfg.h */ -#if ARGTYPE == 0 - -#include - -/* this is the default LibTomCrypt macro */ -void crypt_argchk(char *v, char *s, int d); -#define LTC_ARGCHK(x) if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } -#define LTC_ARGCHKVD(x) LTC_ARGCHK(x) - -#elif ARGTYPE == 1 - -/* fatal type of error */ -#define LTC_ARGCHK(x) assert((x)) -#define LTC_ARGCHKVD(x) LTC_ARGCHK(x) - -#elif ARGTYPE == 2 - -#define LTC_ARGCHK(x) if (!(x)) { fprintf(stderr, "\nwarning: ARGCHK failed at %s:%d\n", __FILE__, __LINE__); } -#define LTC_ARGCHKVD(x) LTC_ARGCHK(x) - -#elif ARGTYPE == 3 - -#define LTC_ARGCHK(x) -#define LTC_ARGCHKVD(x) LTC_ARGCHK(x) - -#elif ARGTYPE == 4 - -#define LTC_ARGCHK(x) if (!(x)) return CRYPT_INVALID_ARG; -#define LTC_ARGCHKVD(x) if (!(x)) return; - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_argchk.h,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/08/27 20:50:21 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_cfg.h Index: Source/libtomcrypt/src/headers/tomcrypt_cfg.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_cfg.h +++ /dev/null @@ -1,140 +0,0 @@ -/* This is the build config file. - * - * With this you can setup what to inlcude/exclude automatically during any build. Just comment - * out the line that #define's the word for the thing you want to remove. phew! - */ - -#ifndef TOMCRYPT_CFG_H -#define TOMCRYPT_CFG_H - -#if defined(_WIN32) || defined(_MSC_VER) -#define LTC_CALL __cdecl -#else -#ifndef LTC_CALL - #define LTC_CALL -#endif -#endif - -#ifndef LTC_EXPORT -#define LTC_EXPORT -#endif - -/* certain platforms use macros for these, making the prototypes broken */ -#ifndef LTC_NO_PROTOTYPES - -/* you can change how memory allocation works ... */ -LTC_EXPORT void * LTC_CALL XMALLOC(size_t n); -LTC_EXPORT void * LTC_CALL XREALLOC(void *p, size_t n); -LTC_EXPORT void * LTC_CALL XCALLOC(size_t n, size_t s); -LTC_EXPORT void LTC_CALL XFREE(void *p); - -LTC_EXPORT void LTC_CALL XQSORT(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); - - -/* change the clock function too */ -LTC_EXPORT clock_t LTC_CALL XCLOCK(void); - -/* various other functions */ -LTC_EXPORT void * LTC_CALL XMEMCPY(void *dest, const void *src, size_t n); -LTC_EXPORT int LTC_CALL XMEMCMP(const void *s1, const void *s2, size_t n); -LTC_EXPORT void * LTC_CALL XMEMSET(void *s, int c, size_t n); - -LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2); - -#endif - -/* type of argument checking, 0=default, 1=fatal and 2=error+continue, 3=nothing */ -#ifndef ARGTYPE - #define ARGTYPE 0 -#endif - -/* Controls endianess and size of registers. Leave uncommented to get platform neutral [slower] code - * - * Note: in order to use the optimized macros your platform must support unaligned 32 and 64 bit read/writes. - * The x86 platforms allow this but some others [ARM for instance] do not. On those platforms you **MUST** - * use the portable [slower] macros. - */ - -/* detect x86-32 machines somewhat */ -#if !defined(__STRICT_ANSI__) && (defined(INTEL_CC) || (defined(_MSC_VER) && defined(WIN32)) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__)))) - #define ENDIAN_LITTLE - #define ENDIAN_32BITWORD - #define LTC_FAST - #define LTC_FAST_TYPE unsigned long -#endif - -/* detects MIPS R5900 processors (PS2) */ -#if (defined(__R5900) || defined(R5900) || defined(__R5900__)) && (defined(_mips) || defined(__mips__) || defined(mips)) - #define ENDIAN_LITTLE - #define ENDIAN_64BITWORD -#endif - -/* detect amd64 */ -#if !defined(__STRICT_ANSI__) && defined(__x86_64__) - #define ENDIAN_LITTLE - #define ENDIAN_64BITWORD - #define LTC_FAST - #define LTC_FAST_TYPE unsigned long -#endif - -/* detect PPC32 */ -#if !defined(__STRICT_ANSI__) && defined(LTC_PPC32) - #define ENDIAN_BIG - #define ENDIAN_32BITWORD - #define LTC_FAST - #define LTC_FAST_TYPE unsigned long -#endif - -/* detect sparc and sparc64 */ -#if defined(__sparc__) - #define ENDIAN_BIG - #if defined(__arch64__) - #define ENDIAN_64BITWORD - #else - #define ENDIAN_32BITWORD - #endif -#endif - - -#ifdef LTC_NO_FAST - #ifdef LTC_FAST - #undef LTC_FAST - #endif -#endif - -/* No asm is a quick way to disable anything "not portable" */ - -/* ZZZ murf added this define - we should see what blocks using assembly at some point */ -#define LTC_NO_ASM - -#ifdef LTC_NO_ASM - #undef ENDIAN_LITTLE - #undef ENDIAN_BIG - #undef ENDIAN_32BITWORD - #undef ENDIAN_64BITWORD - #undef LTC_FAST - #undef LTC_FAST_TYPE - #define LTC_NO_ROLC - #define LTC_NO_BSWAP -#endif - -/* #define ENDIAN_LITTLE */ -/* #define ENDIAN_BIG */ - -/* #define ENDIAN_32BITWORD */ -/* #define ENDIAN_64BITWORD */ - -#if (defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) && !(defined(ENDIAN_32BITWORD) || defined(ENDIAN_64BITWORD)) - #error You must specify a word size as well as endianess in tomcrypt_cfg.h -#endif - -#if !(defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) - #define ENDIAN_NEUTRAL -#endif - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_cfg.h,v $ */ -/* $Revision: 1.19 $ */ -/* $Date: 2006/12/04 02:19:48 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_cipher.h Index: Source/libtomcrypt/src/headers/tomcrypt_cipher.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_cipher.h +++ /dev/null @@ -1,1009 +0,0 @@ -/* ---- SYMMETRIC KEY STUFF ----- - * - * We put each of the ciphers scheduled keys in their own structs then we put all of - * the key formats in one union. This makes the function prototypes easier to use. - */ -#ifdef LTC_BLOWFISH -struct blowfish_key { - ulong32 S[4][256]; - ulong32 K[18]; -}; -#endif - -#ifdef LTC_RC5 -struct rc5_key { - int rounds; - ulong32 K[50]; -}; -#endif - -#ifdef LTC_RC6 -struct rc6_key { - ulong32 K[44]; -}; -#endif - -#ifdef LTC_SAFERP -struct saferp_key { - unsigned char K[33][16]; - long rounds; -}; -#endif - -#ifdef LTC_RIJNDAEL -struct rijndael_key { - ulong32 eK[60], dK[60]; - int Nr; -}; -#endif - -#ifdef EDP_AES -#include "aesedp.h" -#endif - -#ifdef LTC_KSEED -struct kseed_key { - ulong32 K[32], dK[32]; -}; -#endif - -#ifdef LTC_KASUMI -struct kasumi_key { - ulong32 KLi1[8], KLi2[8], - KOi1[8], KOi2[8], KOi3[8], - KIi1[8], KIi2[8], KIi3[8]; -}; -#endif - -#ifdef LTC_XTEA -struct xtea_key { - unsigned long A[32], B[32]; -}; -#endif - -#ifdef LTC_TWOFISH -#ifndef LTC_TWOFISH_SMALL - struct twofish_key { - ulong32 S[4][256], K[40]; - }; -#else - struct twofish_key { - ulong32 K[40]; - unsigned char S[32], start; - }; -#endif -#endif - -#ifdef LTC_SAFER -#define LTC_SAFER_K64_DEFAULT_NOF_ROUNDS 6 -#define LTC_SAFER_K128_DEFAULT_NOF_ROUNDS 10 -#define LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS 8 -#define LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS 10 -#define LTC_SAFER_MAX_NOF_ROUNDS 13 -#define LTC_SAFER_BLOCK_LEN 8 -#define LTC_SAFER_KEY_LEN (1 + LTC_SAFER_BLOCK_LEN * (1 + 2 * LTC_SAFER_MAX_NOF_ROUNDS)) -typedef unsigned char safer_block_t[LTC_SAFER_BLOCK_LEN]; -typedef unsigned char safer_key_t[LTC_SAFER_KEY_LEN]; -struct safer_key { safer_key_t key; }; -#endif - -#ifdef LTC_RC2 -struct rc2_key { unsigned xkey[64]; }; -#endif - -#ifdef LTC_DES -struct des_key { - ulong32 ek[32], dk[32]; -}; - -struct des3_key { - ulong32 ek[3][32], dk[3][32]; -}; -#endif - -#ifdef LTC_CAST5 -struct cast5_key { - ulong32 K[32], keylen; -}; -#endif - -#ifdef LTC_NOEKEON -struct noekeon_key { - ulong32 K[4], dK[4]; -}; -#endif - -#ifdef LTC_SKIPJACK -struct skipjack_key { - unsigned char key[10]; -}; -#endif - -#ifdef LTC_KHAZAD -struct khazad_key { - ulong64 roundKeyEnc[8 + 1]; - ulong64 roundKeyDec[8 + 1]; -}; -#endif - -#ifdef LTC_ANUBIS -struct anubis_key { - int keyBits; - int R; - ulong32 roundKeyEnc[18 + 1][4]; - ulong32 roundKeyDec[18 + 1][4]; -}; -#endif - -#ifdef LTC_MULTI2 -struct multi2_key { - int N; - ulong32 uk[8]; -}; -#endif - -#ifdef LTC_CAMELLIA -struct camellia_key { - int R; - ulong64 kw[4], k[24], kl[6]; -}; -#endif - -typedef union Symmetric_key { -#ifdef LTC_DES - struct des_key des; - struct des3_key des3; -#endif -#ifdef LTC_RC2 - struct rc2_key rc2; -#endif - -#ifdef LTC_SAFER - struct safer_key safer; -#endif -#ifdef LTC_TWOFISH - struct twofish_key twofish; -#endif -#ifdef LTC_BLOWFISH - struct blowfish_key blowfish; -#endif - -#ifdef LTC_RC5 - struct rc5_key rc5; -#endif -#ifdef LTC_RC6 - struct rc6_key rc6; -#endif - -#ifdef LTC_SAFERP - struct saferp_key saferp; -#endif - -#ifdef LTC_RIJNDAEL - struct rijndael_key rijndael; -#endif - -#ifdef LTC_XTEA - struct xtea_key xtea; -#endif - -#ifdef LTC_CAST5 - struct cast5_key cast5; -#endif - -#ifdef LTC_NOEKEON - struct noekeon_key noekeon; -#endif -#ifdef LTC_SKIPJACK - struct skipjack_key skipjack; -#endif -#ifdef LTC_KHAZAD - struct khazad_key khazad; -#endif -#ifdef LTC_ANUBIS - struct anubis_key anubis; -#endif -#ifdef LTC_KSEED - struct kseed_key kseed; -#endif -#ifdef LTC_KASUMI - struct kasumi_key kasumi; -#endif -#ifdef LTC_MULTI2 - struct multi2_key multi2; -#endif -#ifdef LTC_CAMELLIA - struct camellia_key camellia; -#endif - -#ifdef EDP_AES - aesedp_ctx aesedp; -#endif - void *data; -} symmetric_key; - -#ifdef LTC_ECB_MODE -/** A block cipher ECB structure */ -typedef struct { - /** The index of the cipher chosen */ - int cipher, - /** The block size of the given cipher */ - blocklen; - /** The scheduled key */ - symmetric_key key; -} symmetric_ECB; -#endif - -#ifdef LTC_CFB_MODE -/** A block cipher CFB structure */ -typedef struct { - /** The index of the cipher chosen */ - int cipher, - /** The block size of the given cipher */ - blocklen, - /** The padding offset */ - padlen; - /** The current IV */ - unsigned char IV[MAXBLOCKSIZE], - /** The pad used to encrypt/decrypt */ - pad[MAXBLOCKSIZE]; - /** The scheduled key */ - symmetric_key key; -} symmetric_CFB; -#endif - -#ifdef LTC_OFB_MODE -/** A block cipher OFB structure */ -typedef struct { - /** The index of the cipher chosen */ - int cipher, - /** The block size of the given cipher */ - blocklen, - /** The padding offset */ - padlen; - /** The current IV */ - unsigned char IV[MAXBLOCKSIZE]; - /** The scheduled key */ - symmetric_key key; -} symmetric_OFB; -#endif - -#ifdef LTC_CBC_MODE -/** A block cipher CBC structure */ -typedef struct { - /** The index of the cipher chosen */ - int cipher, - /** The block size of the given cipher */ - blocklen; - /** The current IV */ - unsigned char IV[MAXBLOCKSIZE]; - /** The scheduled key */ - symmetric_key key; -} symmetric_CBC; -#endif - - -#ifdef LTC_CTR_MODE -/** A block cipher CTR structure */ -typedef struct { - /** The index of the cipher chosen */ - int cipher, - /** The block size of the given cipher */ - blocklen, - /** The padding offset */ - padlen, - /** The mode (endianess) of the CTR, 0==little, 1==big */ - mode, - /** counter width */ - ctrlen; - - /** The counter */ - unsigned char ctr[MAXBLOCKSIZE], - /** The pad used to encrypt/decrypt */ - pad[MAXBLOCKSIZE]; - /** The scheduled key */ - symmetric_key key; -} symmetric_CTR; -#endif - - -#ifdef LTC_LRW_MODE -/** A LRW structure */ -typedef struct { - /** The index of the cipher chosen (must be a 128-bit block cipher) */ - int cipher; - - /** The current IV */ - unsigned char IV[16], - - /** the tweak key */ - tweak[16], - - /** The current pad, it's the product of the first 15 bytes against the tweak key */ - pad[16]; - - /** The scheduled symmetric key */ - symmetric_key key; - -#ifdef LRW_TABLES - /** The pre-computed multiplication table */ - unsigned char PC[16][256][16]; -#endif -} symmetric_LRW; -#endif - -#ifdef LTC_F8_MODE -/** A block cipher F8 structure */ -typedef struct { - /** The index of the cipher chosen */ - int cipher, - /** The block size of the given cipher */ - blocklen, - /** The padding offset */ - padlen; - /** The current IV */ - unsigned char IV[MAXBLOCKSIZE], - MIV[MAXBLOCKSIZE]; - /** Current block count */ - ulong32 blockcnt; - /** The scheduled key */ - symmetric_key key; -} symmetric_F8; -#endif - -#ifdef LTC_XTS_MODE -typedef struct { - symmetric_key key1, key2; - ulong32 cipher; -} symmetric_xts; -#endif - - -/** cipher descriptor table, last entry has "name == NULL" to mark the end of table */ -extern struct ltc_cipher_descriptor { - /** name of cipher */ - char *name; - /** internal ID */ - unsigned char ID; - /** min keysize (octets) */ - int min_key_length, - /** max keysize (octets) */ - max_key_length, - /** block size (octets) */ - block_length, - /** default number of rounds */ - default_rounds; - /** Setup the cipher - @param key The input symmetric key - @param keylen The length of the input key (octets) - @param num_rounds The requested number of rounds (0==default) - @param skey [out] The destination of the scheduled key - @return CRYPT_OK if successful - */ - int (*setup)(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); - /** Encrypt a block - @param pt The plaintext - @param ct [out] The ciphertext - @param skey The scheduled key - @return CRYPT_OK if successful - */ - int (*ecb_encrypt)(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); - /** Decrypt a block - @param ct The ciphertext - @param pt [out] The plaintext - @param skey The scheduled key - @return CRYPT_OK if successful - */ - int (*ecb_decrypt)(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); - /** Test the block cipher - @return CRYPT_OK if successful, CRYPT_NOP if self-testing has been disabled - */ - int (*test)(void); - - /** Terminate the context - @param skey The scheduled key - */ - void (*done)(symmetric_key *skey); - - /** Determine a key size - @param keysize [in/out] The size of the key desired and the suggested size - @return CRYPT_OK if successful - */ - int (*keysize)(int *keysize); - -/** Accelerators **/ - /** Accelerated ECB encryption - @param pt Plaintext - @param ct Ciphertext - @param blocks The number of complete blocks to process - @param skey The scheduled key context - @return CRYPT_OK if successful - */ - int (*accel_ecb_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, symmetric_key *skey); - - /** Accelerated ECB decryption - @param pt Plaintext - @param ct Ciphertext - @param blocks The number of complete blocks to process - @param skey The scheduled key context - @return CRYPT_OK if successful - */ - int (*accel_ecb_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long blocks, symmetric_key *skey); - - /** Accelerated CBC encryption - @param pt Plaintext - @param ct Ciphertext - @param blocks The number of complete blocks to process - @param IV The initial value (input/output) - @param skey The scheduled key context - @return CRYPT_OK if successful - */ - int (*accel_cbc_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, symmetric_key *skey); - - /** Accelerated CBC decryption - @param pt Plaintext - @param ct Ciphertext - @param blocks The number of complete blocks to process - @param IV The initial value (input/output) - @param skey The scheduled key context - @return CRYPT_OK if successful - */ - int (*accel_cbc_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long blocks, unsigned char *IV, symmetric_key *skey); - - /** Accelerated CTR encryption - @param pt Plaintext - @param ct Ciphertext - @param blocks The number of complete blocks to process - @param IV The initial value (input/output) - @param mode little or big endian counter (mode=0 or mode=1) - @param skey The scheduled key context - @return CRYPT_OK if successful - */ - int (*accel_ctr_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, int mode, symmetric_key *skey); - - /** Accelerated LRW - @param pt Plaintext - @param ct Ciphertext - @param blocks The number of complete blocks to process - @param IV The initial value (input/output) - @param tweak The LRW tweak - @param skey The scheduled key context - @return CRYPT_OK if successful - */ - int (*accel_lrw_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, const unsigned char *tweak, symmetric_key *skey); - - /** Accelerated LRW - @param ct Ciphertext - @param pt Plaintext - @param blocks The number of complete blocks to process - @param IV The initial value (input/output) - @param tweak The LRW tweak - @param skey The scheduled key context - @return CRYPT_OK if successful - */ - int (*accel_lrw_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long blocks, unsigned char *IV, const unsigned char *tweak, symmetric_key *skey); - - // XTS Acceleration - /** Accelerated XTS - @param pt Plaintext - @param len The length of the logical block to process - @param ct Ciphertext - @param tweak [in] The 128--bit encryption tweak (e.g. sector number) - @param xts The XTS structure - @return CRYPT_OK if successful - */ - int (*accel_xts_encrypt)(const unsigned char *pt, unsigned long len, unsigned char *ct, const unsigned char *tweak, symmetric_xts *xts); - - /** Accelerated XTS - @param ct Ciphertext - @param len The length of the logical block to process - @param pt Plaintext - @param len The length of the logical block to process - @param tweak [in] The 128--bit encryption tweak (e.g. sector number) - @param xts The XTS structure - @return CRYPT_OK if successful - */ - int (*accel_xts_decrypt)(const unsigned char *ct, unsigned long len, unsigned char *pt, const unsigned char *tweak, symmetric_xts *xts); - - // END XTS Acceleration - - /** Accelerated CCM packet (one-shot) - @param key The secret key to use - @param keylen The length of the secret key (octets) - @param uskey A previously scheduled key [optional can be NULL] - @param nonce The session nonce [use once] - @param noncelen The length of the nonce - @param header The header for the session - @param headerlen The length of the header (octets) - @param pt [out] The plaintext - @param ptlen The length of the plaintext (octets) - @param ct [out] The ciphertext - @param tag [out] The destination tag - @param taglen [in/out] The max size and resulting size of the authentication tag - @param direction Encrypt or Decrypt direction (0 or 1) - @return CRYPT_OK if successful - */ - int (*accel_ccm_memory)( - const unsigned char *key, unsigned long keylen, - symmetric_key *uskey, - const unsigned char *nonce, unsigned long noncelen, - const unsigned char *header, unsigned long headerlen, - unsigned char *pt, unsigned long ptlen, - unsigned char *ct, - unsigned char *tag, unsigned long *taglen, - int direction); - - /** Accelerated GCM packet (one shot) - @param key The secret key - @param keylen The length of the secret key - @param IV The initial vector - @param IVlen The length of the initial vector - @param adata The additional authentication data (header) - @param adatalen The length of the adata - @param pt The plaintext - @param ptlen The length of the plaintext (ciphertext length is the same) - @param ct The ciphertext - @param tag [out] The MAC tag - @param taglen [in/out] The MAC tag length - @param direction Encrypt or Decrypt mode (GCM_ENCRYPT or GCM_DECRYPT) - @return CRYPT_OK on success - */ - int (*accel_gcm_memory)( - const unsigned char *key, unsigned long keylen, - const unsigned char *IV, unsigned long IVlen, - const unsigned char *adata, unsigned long adatalen, - unsigned char *pt, unsigned long ptlen, - unsigned char *ct, - unsigned char *tag, unsigned long *taglen, - int direction); - - /** Accelerated one shot LTC_OMAC - @param key The secret key - @param keylen The key length (octets) - @param in The message - @param inlen Length of message (octets) - @param out [out] Destination for tag - @param outlen [in/out] Initial and final size of out - @return CRYPT_OK on success - */ - int (*omac_memory)( - const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); - - /** Accelerated one shot XCBC - @param key The secret key - @param keylen The key length (octets) - @param in The message - @param inlen Length of message (octets) - @param out [out] Destination for tag - @param outlen [in/out] Initial and final size of out - @return CRYPT_OK on success - */ - int (*xcbc_memory)( - const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); - - /** Accelerated one shot F9 - @param key The secret key - @param keylen The key length (octets) - @param in The message - @param inlen Length of message (octets) - @param out [out] Destination for tag - @param outlen [in/out] Initial and final size of out - @return CRYPT_OK on success - @remark Requires manual padding - */ - int (*f9_memory)( - const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -} cipher_descriptor[]; - -#ifdef LTC_BLOWFISH -int blowfish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int blowfish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int blowfish_test(void); -void blowfish_done(symmetric_key *skey); -int blowfish_keysize(int *keysize); -extern const struct ltc_cipher_descriptor blowfish_desc; -#endif - -#ifdef LTC_RC5 -int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int rc5_test(void); -void rc5_done(symmetric_key *skey); -int rc5_keysize(int *keysize); -extern const struct ltc_cipher_descriptor rc5_desc; -#endif - -#ifdef LTC_RC6 -int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int rc6_test(void); -void rc6_done(symmetric_key *skey); -int rc6_keysize(int *keysize); -extern const struct ltc_cipher_descriptor rc6_desc; -#endif - -#ifdef LTC_RC2 -int rc2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int rc2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int rc2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int rc2_test(void); -void rc2_done(symmetric_key *skey); -int rc2_keysize(int *keysize); -extern const struct ltc_cipher_descriptor rc2_desc; -#endif - -#ifdef LTC_SAFERP -int saferp_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int saferp_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int saferp_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int saferp_test(void); -void saferp_done(symmetric_key *skey); -int saferp_keysize(int *keysize); -extern const struct ltc_cipher_descriptor saferp_desc; -#endif - -#ifdef LTC_SAFER -int safer_k64_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int safer_sk64_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int safer_k128_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int safer_sk128_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int safer_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *key); -int safer_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *key); -int safer_k64_test(void); -int safer_sk64_test(void); -int safer_sk128_test(void); -void safer_done(symmetric_key *skey); -int safer_64_keysize(int *keysize); -int safer_128_keysize(int *keysize); -extern const struct ltc_cipher_descriptor safer_k64_desc, safer_k128_desc, safer_sk64_desc, safer_sk128_desc; -#endif - -#ifdef LTC_RIJNDAEL - -/* make aes an alias */ -#define aes_setup rijndael_setup -#define aes_ecb_encrypt rijndael_ecb_encrypt -#define aes_ecb_decrypt rijndael_ecb_decrypt -#define aes_test rijndael_test -#define aes_done rijndael_done -#define aes_keysize rijndael_keysize - -#define aes_enc_setup rijndael_enc_setup -#define aes_enc_ecb_encrypt rijndael_enc_ecb_encrypt -#define aes_enc_keysize rijndael_enc_keysize - -int rijndael_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int rijndael_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int rijndael_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int rijndael_test(void); -void rijndael_done(symmetric_key *skey); -int rijndael_keysize(int *keysize); -int rijndael_enc_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int rijndael_enc_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -void rijndael_enc_done(symmetric_key *skey); -int rijndael_enc_keysize(int *keysize); -extern const struct ltc_cipher_descriptor rijndael_desc, aes_desc; -extern const struct ltc_cipher_descriptor rijndael_enc_desc, aes_enc_desc; -#endif - -#ifdef EDP_AES -int aesedp_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int aesedp_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int aesedp_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int aesedp_test(void); -void aesedp_done(symmetric_key *skey); -int aesedp_cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *iv, symmetric_key *skey); -int aesedp_cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long blocks, unsigned char *iv, symmetric_key *skey); -int aesedp_keysize(int *keysize); -extern const struct ltc_cipher_descriptor aesedp_desc; -#endif - -#ifdef LTC_XTEA -int xtea_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int xtea_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int xtea_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int xtea_test(void); -void xtea_done(symmetric_key *skey); -int xtea_keysize(int *keysize); -extern const struct ltc_cipher_descriptor xtea_desc; -#endif - -#ifdef LTC_TWOFISH -int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int twofish_test(void); -void twofish_done(symmetric_key *skey); -int twofish_keysize(int *keysize); -extern const struct ltc_cipher_descriptor twofish_desc; -#endif - -#ifdef LTC_DES -int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int des_test(void); -void des_done(symmetric_key *skey); -int des_keysize(int *keysize); -int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int des3_test(void); -void des3_done(symmetric_key *skey); -int des3_keysize(int *keysize); -extern const struct ltc_cipher_descriptor des_desc, des3_desc; -#endif - -#ifdef LTC_CAST5 -int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int cast5_test(void); -void cast5_done(symmetric_key *skey); -int cast5_keysize(int *keysize); -extern const struct ltc_cipher_descriptor cast5_desc; -#endif - -#ifdef LTC_NOEKEON -int noekeon_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int noekeon_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int noekeon_test(void); -void noekeon_done(symmetric_key *skey); -int noekeon_keysize(int *keysize); -extern const struct ltc_cipher_descriptor noekeon_desc; -#endif - -#ifdef LTC_SKIPJACK -int skipjack_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int skipjack_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int skipjack_test(void); -void skipjack_done(symmetric_key *skey); -int skipjack_keysize(int *keysize); -extern const struct ltc_cipher_descriptor skipjack_desc; -#endif - -#ifdef LTC_KHAZAD -int khazad_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int khazad_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int khazad_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int khazad_test(void); -void khazad_done(symmetric_key *skey); -int khazad_keysize(int *keysize); -extern const struct ltc_cipher_descriptor khazad_desc; -#endif - -#ifdef LTC_ANUBIS -int anubis_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int anubis_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int anubis_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int anubis_test(void); -void anubis_done(symmetric_key *skey); -int anubis_keysize(int *keysize); -extern const struct ltc_cipher_descriptor anubis_desc; -#endif - -#ifdef LTC_KSEED -int kseed_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int kseed_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int kseed_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int kseed_test(void); -void kseed_done(symmetric_key *skey); -int kseed_keysize(int *keysize); -extern const struct ltc_cipher_descriptor kseed_desc; -#endif - -#ifdef LTC_KASUMI -int kasumi_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int kasumi_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int kasumi_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int kasumi_test(void); -void kasumi_done(symmetric_key *skey); -int kasumi_keysize(int *keysize); -extern const struct ltc_cipher_descriptor kasumi_desc; -#endif - - -#ifdef LTC_MULTI2 -int multi2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int multi2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int multi2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int multi2_test(void); -void multi2_done(symmetric_key *skey); -int multi2_keysize(int *keysize); -extern const struct ltc_cipher_descriptor multi2_desc; -#endif - -#ifdef LTC_CAMELLIA -int camellia_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); -int camellia_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); -int camellia_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); -int camellia_test(void); -void camellia_done(symmetric_key *skey); -int camellia_keysize(int *keysize); -extern const struct ltc_cipher_descriptor camellia_desc; -#endif - -#ifdef LTC_ECB_MODE -#ifdef MACTOMCRYPT -int ecb_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, int tweaklen, - int num_rounds, int options, symmetric_ECB *ecb); -#else -int ecb_start(int cipher, const unsigned char *key, int keylen, int num_rounds, symmetric_ECB *ecb); -#endif -int ecb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_ECB *ecb); -int ecb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_ECB *ecb); -int ecb_done(symmetric_ECB *ecb); -#endif - -#ifdef LTC_CFB_MODE -#ifdef MACTOMCRYPT -int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, int tweaklen, - int num_rounds, int options, symmetric_CFB *cfb); -#else -int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, - int keylen, int num_rounds, symmetric_CFB *cfb); -#endif -int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CFB *cfb); -int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CFB *cfb); -int cfb_getiv(unsigned char *IV, unsigned long *len, symmetric_CFB *cfb); -int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb); -int cfb_done(symmetric_CFB *cfb); -#endif - -#ifdef LTC_OFB_MODE -#ifdef MACTOMCRYPT -int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, - const unsigned char *tweak, int tweaklen, int num_rounds, int options, symmetric_OFB *ofb); -#else -int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key, - int keylen, int num_rounds, symmetric_OFB *ofb); -#endif -int ofb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_OFB *ofb); -int ofb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_OFB *ofb); -int ofb_getiv(unsigned char *IV, unsigned long *len, symmetric_OFB *ofb); -int ofb_setiv(const unsigned char *IV, unsigned long len, symmetric_OFB *ofb); -int ofb_done(symmetric_OFB *ofb); -#endif - -#ifdef LTC_CBC_MODE -#ifdef MACTOMCRYPT -int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, - const unsigned char *tweak, int tweaklen, int num_rounds, int options, symmetric_CBC *cbc); -#else -int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key, - int keylen, int num_rounds, symmetric_CBC *cbc); -#endif -int cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CBC *cbc); -int cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CBC *cbc); -int cbc_encrypt_tweaked(const unsigned char *pt, unsigned long len, unsigned char *ct, const unsigned char *tweak, symmetric_CBC *cbc); -int cbc_decrypt_tweaked(const unsigned char *ct, unsigned long len, unsigned char *pt, const unsigned char *tweak, symmetric_CBC *cbc); -int cbc_getiv(unsigned char *IV, unsigned long *len, symmetric_CBC *cbc); -int cbc_setiv(const unsigned char *IV, unsigned long len, symmetric_CBC *cbc); -int cbc_done(symmetric_CBC *cbc); -#endif - -#ifdef LTC_CTR_MODE - -#define CTR_COUNTER_LITTLE_ENDIAN 0x0000 -#define CTR_COUNTER_BIG_ENDIAN 0x1000 -#define LTC_CTR_RFC3686 0x2000 - -#ifdef MACTOMCRYPT -int ctr_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, int tweaklen, - int num_rounds, int ctr_mode, symmetric_CTR *ctr); -#else -int ctr_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, int num_rounds, int ctr_mode, symmetric_CTR *ctr); -#endif -int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CTR *ctr); -int ctr_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CTR *ctr); -int ctr_getiv(unsigned char *IV, unsigned long *len, symmetric_CTR *ctr); -int ctr_setiv(const unsigned char *IV, unsigned long len, symmetric_CTR *ctr); -int ctr_done(symmetric_CTR *ctr); -int ctr_test(void); -#endif - -#ifdef LTC_LRW_MODE - -#define LRW_ENCRYPT 0 -#define LRW_DECRYPT 1 - -#ifdef MACTOMCRYPT -int lrw_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, - const unsigned char *tweak, int tweaklen, int num_rounds, int options, symmetric_LRW *lrw); -#else -int lrw_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, int num_rounds, symmetric_LRW *lrw); -#endif -int lrw_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_LRW *lrw); -int lrw_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_LRW *lrw); -int lrw_getiv(unsigned char *IV, unsigned long *len, symmetric_LRW *lrw); -int lrw_setiv(const unsigned char *IV, unsigned long len, symmetric_LRW *lrw); -int lrw_done(symmetric_LRW *lrw); -int lrw_test(void); - -/* don't call */ -int lrw_process(const unsigned char *pt, unsigned char *ct, unsigned long len, int mode, symmetric_LRW *lrw); -#endif - -#ifdef LTC_F8_MODE -#ifdef MACTOMCRYPT -int f8_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, - const unsigned char *salt_key, int skeylen, int num_rounds, int options, symmetric_F8 *f8); -#else -int f8_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *salt_key, int skeylen, - int num_rounds, symmetric_F8 *f8); -#endif -int f8_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_F8 *f8); -int f8_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_F8 *f8); -int f8_getiv(unsigned char *IV, unsigned long *len, symmetric_F8 *f8); -int f8_setiv(const unsigned char *IV, unsigned long len, symmetric_F8 *f8); -int f8_done(symmetric_F8 *f8); -int f8_test_mode(void); -#endif - -#ifdef LTC_XTS_MODE -#ifdef NEVER -typedef struct { - symmetric_key key1, key2; - int cipher; -} symmetric_xts; -#endif - -#ifdef MACTOMCRYPT -int xts_start(int cipher, const unsigned char *IV, const unsigned char *key1, int keylen, - const unsigned char *key2, int tweaklen, int num_rounds, int options, symmetric_xts *xts); -#else -int xts_start(int cipher, const unsigned char *key1, const unsigned char *key2, unsigned long keylen, int num_rounds, symmetric_xts *xts); -#endif - -int xts_encrypt( - const unsigned char *pt, unsigned long ptlen, - unsigned char *ct, - const unsigned char *tweak, - symmetric_xts *xts); -int xts_decrypt( - const unsigned char *ct, unsigned long ptlen, - unsigned char *pt, - const unsigned char *tweak, - symmetric_xts *xts); - -void xts_done(symmetric_xts *xts); -int xts_test(void); -void xts_mult_x(unsigned char *I); -#endif - -#ifdef MACTOMCRYPT -int cfb8_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, int tweaklen, - int num_rounds, int options, symmetric_CFB *cfb); -#else -int cfb8_start(int cipher, const unsigned char *IV, const unsigned char *key, - int keylen, int num_rounds, symmetric_CFB *cfb); -#endif -int cfb8_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CFB *cfb); -int cfb8_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CFB *cfb); -int cfb8_getiv(unsigned char *IV, unsigned long *len, symmetric_CFB *cfb); -int cfb8_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb); -int cfb8_done(symmetric_CFB *cfb); - -int find_cipher(const char *name); -int find_cipher_any(const char *name, int blocklen, int keylen); -int find_cipher_id(unsigned char ID); -int register_cipher(const struct ltc_cipher_descriptor *cipher); -int unregister_cipher(const struct ltc_cipher_descriptor *cipher); -int cipher_is_valid(int idx); - -LTC_MUTEX_PROTO(ltc_cipher_mutex) - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_cipher.h,v $ */ -/* $Revision: 1.55 $ */ -/* $Date: 2007/06/20 13:14:31 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_custom.h Index: Source/libtomcrypt/src/headers/tomcrypt_custom.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_custom.h +++ /dev/null @@ -1,436 +0,0 @@ -#ifndef TOMCRYPT_CUSTOM_H_ -#define TOMCRYPT_CUSTOM_H_ - -/* MacTomCrypt Operation Limits */ - -/* ZZZ murf We use our own Yarrow derived /dev/random */ -#define LTC_NO_PRNGS -/* ZZZ murf defines some needed functions in tomcrypt_math.h */ -#define LTC_SOURCE -/* ZZZ murf limit algorithms to more standard ones */ -#define MACTOMCRYPT -#ifdef MACTOMCRYPT -#define MAC_TOMCRYPT_STD_ROUTINES -#define LTC_SKEIN -#define EDP_AES -#endif - -/* macros for various libc functions you can change for embedded targets */ -#ifndef XMALLOC - #ifdef malloc - #define LTC_NO_PROTOTYPES - #endif -#define XMALLOC malloc -#endif -#ifndef XREALLOC - #ifdef realloc - #define LTC_NO_PROTOTYPES - #endif -#define XREALLOC realloc -#endif -#ifndef XCALLOC - #ifdef calloc - #define LTC_NO_PROTOTYPES - #endif -#define XCALLOC calloc -#endif -#ifndef XFREE - #ifdef free - #define LTC_NO_PROTOTYPES - #endif -#define XFREE free -#endif - -#ifndef XMEMSET - #ifdef memset - #define LTC_NO_PROTOTYPES - #endif -#define XMEMSET memset -#endif -#ifndef XMEMCPY - #ifdef memcpy - #define LTC_NO_PROTOTYPES - #endif -#define XMEMCPY memcpy -#endif -#ifndef XMEMCMP - #ifdef memcmp - #define LTC_NO_PROTOTYPES - #endif -#define XMEMCMP memcmp -#endif -#ifndef XSTRCMP - #ifdef strcmp - #define LTC_NO_PROTOTYPES - #endif -#define XSTRCMP strcmp -#endif - -#ifndef XCLOCK -#define XCLOCK clock -#endif -#ifndef XCLOCKS_PER_SEC -#define XCLOCKS_PER_SEC CLOCKS_PER_SEC -#endif - -#ifndef XQSORT - #ifdef qsort - #define LTC_NO_PROTOTYPES - #endif -#define XQSORT qsort -#endif - -/* Easy button? */ -#ifdef LTC_EASY - #define LTC_NO_CIPHERS - #define LTC_RIJNDAEL - #define LTC_BLOWFISH - #define LTC_DES - #define LTC_CAST5 - - #define LTC_NO_MODES - #define LTC_ECB_MODE - #define LTC_CBC_MODE - #define LTC_CTR_MODE - - #define LTC_NO_HASHES - #define LTC_SHA1 - #define LTC_SHA512 - #define LTC_SHA384 - #define LTC_SHA256 - #define LTC_SHA224 - - #define LTC_NO_MACS - #define LTC_HMAC - #define LTC_OMAC - #define LTC_CCM_MODE - - #define LTC_NO_PRNGS - #define LTC_SPRNG - #define LTC_YARROW - #define LTC_DEVRANDOM - #define TRY_URANDOM_FIRST - - #define LTC_NO_PK - #define LTC_MRSA - #define LTC_MECC -#endif - -/* Use small code where possible */ -/* #define LTC_SMALL_CODE */ - -/* Enable self-test test vector checking */ -#ifndef LTC_NO_TEST - #define LTC_TEST -#endif - -/* clean the stack of functions which put private information on stack */ -/* #define LTC_CLEAN_STACK */ - -/* disable all file related functions */ -/* #define LTC_NO_FILE */ - -/* disable all forms of ASM */ -/* #define LTC_NO_ASM */ - -/* disable FAST mode */ -/* #define LTC_NO_FAST */ - -/* disable BSWAP on x86 */ -/* #define LTC_NO_BSWAP */ - -/* ---> Symmetric Block Ciphers <--- */ -#ifndef LTC_NO_CIPHERS - -#define LTC_RC2 -#define LTC_RC5 -#define LTC_RC6 -#define LTC_RIJNDAEL -/* LTC_DES includes EDE triple-LTC_DES */ -#define LTC_DES -#define LTC_CAST5 - -/* ZZZ murf - adding easy-off for "exotic" crypto */ - -#if !defined(MAC_TOMCRYPT_STD_ROUTINES) -// #define LTC_XTEA -/* _TABLES tells it to use tables during setup, _SMALL means to use the smaller scheduled key format - * (saves 4KB of ram), _ALL_TABLES enables all tables during setup */ -#define LTC_TWOFISH -#ifndef LTC_NO_TABLES - #define LTC_TWOFISH_TABLES - /* #define LTC_TWOFISH_ALL_TABLES */ -#else - #define LTC_TWOFISH_SMALL -#endif -/* #define LTC_TWOFISH_SMALL */ -#define LTC_BLOWFISH -#define LTC_SAFERP -#define LTC_NOEKEON -#define LTC_SKIPJACK -#define LTC_SAFER -#define LTC_KHAZAD -#define LTC_ANUBIS -#define LTC_ANUBIS_TWEAK -#define LTC_KSEED -#define LTC_KASUMI -#define LTC_MULTI2 -#define LTC_CAMELLIA -#endif /* MAC_TOMCRYPT_STD_ROUTINES */ - -#endif /* LTC_NO_CIPHERS */ - - -/* ---> Block Cipher Modes of Operation <--- */ -#ifndef LTC_NO_MODES - -#define LTC_CFB_MODE -#define LTC_OFB_MODE -#define LTC_ECB_MODE -#define LTC_CBC_MODE -#define LTC_CTR_MODE - -/* F8 chaining mode */ -#define LTC_F8_MODE - -/* LRW mode */ -#define LTC_LRW_MODE -#ifndef LTC_NO_TABLES - /* like GCM mode this will enable 16 8x128 tables [64KB] that make - * seeking very fast. - */ -#if !defined(MAC_TOMCRYPT_STD_ROUTINES) - #define LRW_TABLES -#endif /* MAC_TOMCRYPT_STD_ROUTINES */ -#endif - -/* XTS mode */ -#define LTC_XTS_MODE - -#endif /* LTC_NO_MODES */ - -/* ---> One-Way Hash Functions <--- */ -#ifndef LTC_NO_HASHES - -#if !defined(MAC_TOMCRYPT_STD_ROUTINES) -#define LTC_CHC_HASH -#define LTC_WHIRLPOOL -#endif /* MAC_TOMCRYPT_STD_ROUTINES */ - -#define LTC_SHA512 -#define LTC_SHA384 -#define LTC_SHA256 -#define LTC_SHA224 -#define LTC_TIGER -#define LTC_SHA1 -#define LTC_MD5 -#define LTC_MD4 -#define LTC_MD2 -#define LTC_RIPEMD128 -#define LTC_RIPEMD160 -#define LTC_RIPEMD256 -#define LTC_RIPEMD320 - -#endif /* LTC_NO_HASHES */ - -/* ---> MAC functions <--- */ -#ifndef LTC_NO_MACS - -#define LTC_HMAC -#define LTC_OMAC -#define LTC_PMAC -#define LTC_XCBC - -#if !defined(MAC_TOMCRYPT_STD_ROUTINES) -#define LTC_F9_MODE -#define LTC_PELICAN -#endif /* MAC_TOMCRYPT_STD_ROUTINES */ - - -#if defined(LTC_PELICAN) && !defined(LTC_RIJNDAEL) - #error Pelican-MAC requires LTC_RIJNDAEL -#endif - -/* ---> Encrypt + Authenticate Modes <--- */ - -#define LTC_EAX_MODE -#if defined(LTC_EAX_MODE) && !(defined(LTC_CTR_MODE) && defined(LTC_OMAC)) - #error LTC_EAX_MODE requires CTR and LTC_OMAC mode -#endif - -#define LTC_OCB_MODE -#define LTC_CCM_MODE -#define LTC_GCM_MODE - -/* Use 64KiB tables */ -#ifndef LTC_NO_TABLES - #define LTC_GCM_TABLES -#endif - -/* USE SSE2? requires GCC works on x86_32 and x86_64*/ -#ifdef LTC_GCM_TABLES -/* #define LTC_GCM_TABLES_SSE2 */ -#endif - -#endif /* LTC_NO_MACS */ - -/* Various tidbits of modern neatoness */ -#define LTC_BASE64 - -/* --> Pseudo Random Number Generators <--- */ -#ifndef LTC_NO_PRNGS - -/* Yarrow */ -#define LTC_YARROW -/* which descriptor of AES to use? */ -/* 0 = rijndael_enc 1 = aes_enc, 2 = rijndael [full], 3 = aes [full] */ -#define LTC_YARROW_AES 0 - -#if defined(LTC_YARROW) && !defined(LTC_CTR_MODE) - #error LTC_YARROW requires LTC_CTR_MODE chaining mode to be defined! -#endif - -/* a PRNG that simply reads from an available system source */ -#define LTC_SPRNG - -/* The LTC_RC4 stream cipher */ -#define LTC_RC4 - -/* Fortuna PRNG */ -#define LTC_FORTUNA -/* reseed every N calls to the read function */ -#define LTC_FORTUNA_WD 10 -/* number of pools (4..32) can save a bit of ram by lowering the count */ -#define LTC_FORTUNA_POOLS 32 - -/* Greg's LTC_SOBER128 PRNG ;-0 */ -#define LTC_SOBER128 - -/* the *nix style /dev/random device */ -#define LTC_DEVRANDOM -/* try /dev/urandom before trying /dev/random */ -#define TRY_URANDOM_FIRST - -#endif /* LTC_NO_PRNGS */ - -/* ---> math provider? <--- */ -#ifndef LTC_NO_MATH - -/* LibTomMath */ -/* #define LTM_LTC_DESC */ - -/* TomsFastMath */ -/* #define TFM_LTC_DESC */ - -#endif /* LTC_NO_MATH */ - -/* ---> Public Key Crypto <--- */ -#ifndef LTC_NO_PK - -/* Include RSA support */ -#define LTC_MRSA - -/* Include Katja (a Rabin variant like RSA) */ -/* #define MKAT */ - -/* Digital Signature Algorithm */ -#define LTC_MDSA - -/* ECC */ -#define LTC_MECC - -/* use Shamir's trick for point mul (speeds up signature verification) */ -/* #define LTC_ECC_SHAMIR */ - -#if defined(TFM_LTC_DESC) && defined(LTC_MECC) - #define LTC_MECC_ACCEL -#endif - -/* do we want fixed point ECC */ -/* #define LTC_MECC_FP */ - -/* Timing Resistant? */ -/* #define LTC_ECC_TIMING_RESISTANT */ - -#endif /* LTC_NO_PK */ - -/* LTC_PKCS #1 (RSA) and #5 (Password Handling) stuff */ -#ifndef LTC_NO_PKCS - -#define LTC_PKCS_1 -#define LTC_PKCS_5 - -/* Include ASN.1 DER (required by DSA/RSA) */ -#define LTC_DER - -#endif /* LTC_NO_PKCS */ - -/* cleanup */ - -#ifdef LTC_MECC -/* Supported ECC Key Sizes */ -#ifndef LTC_NO_CURVES - #define ECC112 - #define ECC128 - #define ECC160 - #define ECC192 - #define ECC224 - #define ECC256 - #define ECC384 - #define ECC521 -#endif -#endif - -#if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(MKATJA) - /* Include the MPI functionality? (required by the PK algorithms) */ - #define MPI -#endif - -#ifdef LTC_MRSA - #define LTC_PKCS_1 -#endif - -#if defined(LTC_DER) && !defined(MPI) - #error ASN.1 DER requires MPI functionality -#endif - -#if (defined(LTC_MDSA) || defined(LTC_MRSA) || defined(LTC_MECC) || defined(MKATJA)) && !defined(LTC_DER) - #error PK requires ASN.1 DER functionality, make sure LTC_DER is enabled -#endif - -/* THREAD management */ -#ifdef LTC_PTHREAD - -#include - -#define LTC_MUTEX_GLOBAL(x) pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER; -#define LTC_MUTEX_PROTO(x) extern pthread_mutex_t x; -#define LTC_MUTEX_TYPE(x) pthread_mutex_t x; -#define LTC_MUTEX_INIT(x) pthread_mutex_init(x, NULL); -#define LTC_MUTEX_LOCK(x) pthread_mutex_lock(x); -#define LTC_MUTEX_UNLOCK(x) pthread_mutex_unlock(x); - -#else - -/* default no functions */ -#define LTC_MUTEX_GLOBAL(x) -#define LTC_MUTEX_PROTO(x) -#define LTC_MUTEX_TYPE(x) -#define LTC_MUTEX_INIT(x) -#define LTC_MUTEX_LOCK(x) -#define LTC_MUTEX_UNLOCK(x) - -#endif - -/* Debuggers */ - -/* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and LTC_RC4 work (see the code) */ -/* #define LTC_VALGRIND */ - -#endif - - - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_custom.h,v $ */ -/* $Revision: 1.74 $ */ -/* $Date: 2007/06/20 13:14:31 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_hash.h Index: Source/libtomcrypt/src/headers/tomcrypt_hash.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_hash.h +++ /dev/null @@ -1,396 +0,0 @@ -/* ---- HASH FUNCTIONS ---- */ -#ifdef LTC_SHA512 -struct sha512_state { - ulong64 length, state[8]; - unsigned long curlen; - unsigned char buf[128]; -}; -#endif - -#ifdef LTC_SHA256 -struct sha256_state { - ulong64 length; - ulong32 state[8], curlen; - unsigned char buf[64]; -}; -#endif - -#ifdef LTC_SHA1 -struct sha1_state { - ulong64 length; - ulong32 state[5], curlen; - unsigned char buf[64]; -}; -#endif - -#ifdef LTC_MD5 -struct md5_state { - ulong64 length; - ulong32 state[4], curlen; - unsigned char buf[64]; -}; -#endif - -#ifdef LTC_MD4 -struct md4_state { - ulong64 length; - ulong32 state[4], curlen; - unsigned char buf[64]; -}; -#endif - -#ifdef LTC_TIGER -struct tiger_state { - ulong64 state[3], length; - unsigned long curlen; - unsigned char buf[64]; -}; -#endif - -#ifdef LTC_MD2 -struct md2_state { - unsigned char chksum[16], X[48], buf[16]; - unsigned long curlen; -}; -#endif - -#ifdef LTC_RIPEMD128 -struct rmd128_state { - ulong64 length; - unsigned char buf[64]; - ulong32 curlen, state[4]; -}; -#endif - -#ifdef LTC_RIPEMD160 -struct rmd160_state { - ulong64 length; - unsigned char buf[64]; - ulong32 curlen, state[5]; -}; -#endif - -#ifdef LTC_RIPEMD256 -struct rmd256_state { - ulong64 length; - unsigned char buf[64]; - ulong32 curlen, state[8]; -}; -#endif - -#ifdef LTC_RIPEMD320 -struct rmd320_state { - ulong64 length; - unsigned char buf[64]; - ulong32 curlen, state[10]; -}; -#endif - -#ifdef LTC_WHIRLPOOL -struct whirlpool_state { - ulong64 length, state[8]; - unsigned char buf[64]; - ulong32 curlen; -}; -#endif - -#ifdef LTC_CHC_HASH -struct chc_state { - ulong64 length; - unsigned char state[MAXBLOCKSIZE], buf[MAXBLOCKSIZE]; - ulong32 curlen; -}; -#endif - -#ifdef LTC_SKEIN -/// -/// I apologize for #including here, but it works, and will -/// save you from skew. -- jdcc -/// - -#include "skein.h" -#include "skein_dropin.h" - -#endif - -typedef union Hash_state { - char dummy[1]; -#ifdef LTC_CHC_HASH - struct chc_state chc; -#endif -#ifdef LTC_WHIRLPOOL - struct whirlpool_state whirlpool; -#endif -#ifdef LTC_SHA512 - struct sha512_state sha512; -#endif -#ifdef LTC_SHA256 - struct sha256_state sha256; -#endif -#ifdef LTC_SHA1 - struct sha1_state sha1; -#endif -#ifdef LTC_MD5 - struct md5_state md5; -#endif -#ifdef LTC_MD4 - struct md4_state md4; -#endif -#ifdef LTC_MD2 - struct md2_state md2; -#endif -#ifdef LTC_TIGER - struct tiger_state tiger; -#endif -#ifdef LTC_RIPEMD128 - struct rmd128_state rmd128; -#endif -#ifdef LTC_RIPEMD160 - struct rmd160_state rmd160; -#endif -#ifdef LTC_RIPEMD256 - struct rmd256_state rmd256; -#endif -#ifdef LTC_RIPEMD320 - struct rmd320_state rmd320; -#endif -#ifdef LTC_SKEIN - Skein_512_Ctxt_t skein; -#endif - void *data; -} hash_state; - -/** hash descriptor */ -extern struct ltc_hash_descriptor { - /** name of hash */ - char *name; - /** internal ID */ - unsigned char ID; - /** Size of digest in octets */ - unsigned long hashsize; - /** Input block size in octets */ - unsigned long blocksize; - /** ASN.1 OID */ - unsigned long OID[16]; - /** Length of DER encoding */ - unsigned long OIDlen; - - /** Init a hash state - @param hash The hash to initialize - @return CRYPT_OK if successful - */ - int (*init)(hash_state *hash); - /** Process a block of data - @param hash The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful - */ - int (*process)(hash_state *hash, const unsigned char *in, unsigned long inlen); - /** Produce the digest and store it - @param hash The hash state - @param out [out] The destination of the digest - @return CRYPT_OK if successful - */ - int (*done)(hash_state *hash, unsigned char *out); - /** Self-test - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled - */ - int (*test)(void); - - /* accelerated hmac callback: if you need to-do multiple packets just use the generic hmac_memory and provide a hash callback */ - int (*hmac_block)(const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); - -} hash_descriptor[]; - -#ifdef LTC_CHC_HASH -int chc_register(int cipher); -int chc_init(hash_state * md); -int chc_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int chc_done(hash_state * md, unsigned char *hash); -int chc_test(void); -extern const struct ltc_hash_descriptor chc_desc; -#endif - -#ifdef LTC_WHIRLPOOL -int whirlpool_init(hash_state * md); -int whirlpool_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int whirlpool_done(hash_state * md, unsigned char *hash); -int whirlpool_test(void); -extern const struct ltc_hash_descriptor whirlpool_desc; -#endif - -#ifdef LTC_SHA512 -int sha512_init(hash_state * md); -int sha512_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int sha512_done(hash_state * md, unsigned char *hash); -int sha512_test(void); -extern const struct ltc_hash_descriptor sha512_desc; -#endif - -#ifdef LTC_SHA384 -#ifndef LTC_SHA512 - #error LTC_SHA512 is required for LTC_SHA384 -#endif -int sha384_init(hash_state * md); -#define sha384_process sha512_process -int sha384_done(hash_state * md, unsigned char *hash); -int sha384_test(void); -extern const struct ltc_hash_descriptor sha384_desc; -#endif - -#ifdef LTC_SHA256 -int sha256_init(hash_state * md); -int sha256_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int sha256_done(hash_state * md, unsigned char *hash); -int sha256_test(void); -extern const struct ltc_hash_descriptor sha256_desc; - -#ifdef LTC_SHA224 -#ifndef LTC_SHA256 - #error LTC_SHA256 is required for LTC_SHA224 -#endif -int sha224_init(hash_state * md); -#define sha224_process sha256_process -int sha224_done(hash_state * md, unsigned char *hash); -int sha224_test(void); -extern const struct ltc_hash_descriptor sha224_desc; -#endif -#endif - -#ifdef LTC_SHA1 -int sha1_init(hash_state * md); -int sha1_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int sha1_done(hash_state * md, unsigned char *hash); -int sha1_test(void); -extern const struct ltc_hash_descriptor sha1_desc; -#endif - -#ifdef LTC_MD5 -int ltc_md5_init(hash_state * md); -int ltc_md5_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int ltc_md5_done(hash_state * md, unsigned char *hash); -int ltc_md5_test(void); -extern const struct ltc_hash_descriptor ltc_md5_desc; -#endif - -#ifdef LTC_MD4 -int md4_init(hash_state * md); -int md4_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int md4_done(hash_state * md, unsigned char *hash); -int md4_test(void); -extern const struct ltc_hash_descriptor md4_desc; -#endif - -#ifdef LTC_MD2 -int md2_init(hash_state * md); -int md2_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int md2_done(hash_state * md, unsigned char *hash); -int md2_test(void); -extern const struct ltc_hash_descriptor md2_desc; -#endif - -#ifdef LTC_TIGER -int tiger_init(hash_state * md); -int tiger_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int tiger_done(hash_state * md, unsigned char *hash); -int tiger_test(void); -extern const struct ltc_hash_descriptor tiger_desc; -#endif - -#ifdef LTC_RIPEMD128 -int rmd128_init(hash_state * md); -int rmd128_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int rmd128_done(hash_state * md, unsigned char *hash); -int rmd128_test(void); -extern const struct ltc_hash_descriptor rmd128_desc; -#endif - -#ifdef LTC_RIPEMD160 -int rmd160_init(hash_state * md); -int rmd160_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int rmd160_done(hash_state * md, unsigned char *hash); -int rmd160_test(void); -extern const struct ltc_hash_descriptor rmd160_desc; -#endif - -#ifdef LTC_RIPEMD256 -int rmd256_init(hash_state * md); -int rmd256_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int rmd256_done(hash_state * md, unsigned char *hash); -int rmd256_test(void); -extern const struct ltc_hash_descriptor rmd256_desc; -#endif - -#ifdef LTC_RIPEMD320 -int rmd320_init(hash_state * md); -int rmd320_process(hash_state * md, const unsigned char *in, unsigned long inlen); -int rmd320_done(hash_state * md, unsigned char *hash); -int rmd320_test(void); -extern const struct ltc_hash_descriptor rmd320_desc; -#endif - - -int find_hash(const char *name); -int find_hash_id(unsigned char ID); -int find_hash_oid(const unsigned long *ID, unsigned long IDlen); -int find_hash_any(const char *name, int digestlen); -int register_hash(const struct ltc_hash_descriptor *hash); -int unregister_hash(const struct ltc_hash_descriptor *hash); -int hash_is_valid(int idx); - -LTC_MUTEX_PROTO(ltc_hash_mutex) - -int hash_memory(int hash, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen, - const unsigned char *in, unsigned long inlen, ...); -int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outlen); -int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *outlen); - -/* a simple macro for making hash "process" functions */ -#define HASH_PROCESS(func_name, compress_name, state_var, block_size) \ -int func_name (hash_state * md, const unsigned char *in, unsigned long inlen) \ -{ \ - unsigned long n; \ - int err; \ - LTC_ARGCHK(md != NULL); \ - LTC_ARGCHK(in != NULL); \ - if (md-> state_var .curlen > sizeof(md-> state_var .buf)) { \ - return CRYPT_INVALID_ARG; \ - } \ - if ((md-> state_var .length + inlen) < md-> state_var .length) { \ - return CRYPT_HASH_OVERFLOW; \ - } \ - while (inlen > 0) { \ - if (md-> state_var .curlen == 0 && inlen >= block_size) { \ - if ((err = compress_name (md, (unsigned char *)in)) != CRYPT_OK) { \ - return err; \ - } \ - md-> state_var .length += block_size * 8; \ - in += block_size; \ - inlen -= block_size; \ - } else { \ - n = MIN(inlen, (block_size - md-> state_var .curlen)); \ - memcpy(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n); \ - md-> state_var .curlen += n; \ - in += n; \ - inlen -= n; \ - if (md-> state_var .curlen == block_size) { \ - if ((err = compress_name (md, md-> state_var .buf)) != CRYPT_OK) { \ - return err; \ - } \ - md-> state_var .length += 8*block_size; \ - md-> state_var .curlen = 0; \ - } \ - } \ - } \ - return CRYPT_OK; \ -} - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_hash.h,v $ */ -/* $Revision: 1.22 $ */ -/* $Date: 2007/05/12 14:32:35 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_mac.h Index: Source/libtomcrypt/src/headers/tomcrypt_mac.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_mac.h +++ /dev/null @@ -1,397 +0,0 @@ -#ifdef LTC_HMAC -typedef struct Hmac_state { - hash_state md; - int hash; - hash_state hashstate; - unsigned char *key; -} hmac_state; - -int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned long keylen); -int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen); -int hmac_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen); -int hmac_test(void); -int hmac_memory(int hash, - const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int hmac_memory_multi(int hash, - const unsigned char *key, unsigned long keylen, - unsigned char *out, unsigned long *outlen, - const unsigned char *in, unsigned long inlen, ...); -int hmac_file(int hash, const char *fname, const unsigned char *key, - unsigned long keylen, - unsigned char *dst, unsigned long *dstlen); -#endif - -#ifdef LTC_OMAC - -typedef struct { - int cipher_idx, - buflen, - blklen; - unsigned char block[MAXBLOCKSIZE], - prev[MAXBLOCKSIZE], - Lu[2][MAXBLOCKSIZE]; - symmetric_key key; -} omac_state; - -int omac_init(omac_state *omac, int cipher, const unsigned char *key, unsigned long keylen); -int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen); -int omac_done(omac_state *omac, unsigned char *out, unsigned long *outlen); -int omac_memory(int cipher, - const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int omac_memory_multi(int cipher, - const unsigned char *key, unsigned long keylen, - unsigned char *out, unsigned long *outlen, - const unsigned char *in, unsigned long inlen, ...); -int omac_file(int cipher, - const unsigned char *key, unsigned long keylen, - const char *filename, - unsigned char *out, unsigned long *outlen); -int omac_test(void); -#endif /* LTC_OMAC */ - -#ifdef LTC_PMAC - -typedef struct { - unsigned char Ls[32][MAXBLOCKSIZE], /* L shifted by i bits to the left */ - Li[MAXBLOCKSIZE], /* value of Li [current value, we calc from previous recall] */ - Lr[MAXBLOCKSIZE], /* L * x^-1 */ - block[MAXBLOCKSIZE], /* currently accumulated block */ - checksum[MAXBLOCKSIZE]; /* current checksum */ - - symmetric_key key; /* scheduled key for cipher */ - unsigned long block_index; /* index # for current block */ - int cipher_idx, /* cipher idx */ - block_len, /* length of block */ - buflen; /* number of bytes in the buffer */ -} pmac_state; - -int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned long keylen); -int pmac_process(pmac_state *pmac, const unsigned char *in, unsigned long inlen); -int pmac_done(pmac_state *pmac, unsigned char *out, unsigned long *outlen); - -int pmac_memory(int cipher, - const unsigned char *key, unsigned long keylen, - const unsigned char *msg, unsigned long msglen, - unsigned char *out, unsigned long *outlen); - -int pmac_memory_multi(int cipher, - const unsigned char *key, unsigned long keylen, - unsigned char *out, unsigned long *outlen, - const unsigned char *in, unsigned long inlen, ...); - -int pmac_file(int cipher, - const unsigned char *key, unsigned long keylen, - const char *filename, - unsigned char *out, unsigned long *outlen); - -int pmac_test(void); - -/* internal functions */ -int pmac_ntz(unsigned long x); -void pmac_shift_xor(pmac_state *pmac); - -#endif /* PMAC */ - -#ifdef LTC_EAX_MODE - -#if !(defined(LTC_OMAC) && defined(LTC_CTR_MODE)) - #error LTC_EAX_MODE requires LTC_OMAC and CTR -#endif - -typedef struct { - unsigned char N[MAXBLOCKSIZE]; - symmetric_CTR ctr; - omac_state headeromac, ctomac; -} eax_state; - -int eax_init(eax_state *eax, int cipher, const unsigned char *key, unsigned long keylen, - const unsigned char *nonce, unsigned long noncelen, - const unsigned char *header, unsigned long headerlen); - -int eax_encrypt(eax_state *eax, const unsigned char *pt, unsigned char *ct, unsigned long length); -int eax_decrypt(eax_state *eax, const unsigned char *ct, unsigned char *pt, unsigned long length); -int eax_addheader(eax_state *eax, const unsigned char *header, unsigned long length); -int eax_done(eax_state *eax, unsigned char *tag, unsigned long *taglen); - -int eax_encrypt_authenticate_memory(int cipher, - const unsigned char *key, unsigned long keylen, - const unsigned char *nonce, unsigned long noncelen, - const unsigned char *header, unsigned long headerlen, - const unsigned char *pt, unsigned long ptlen, - unsigned char *ct, - unsigned char *tag, unsigned long *taglen); - -int eax_decrypt_verify_memory(int cipher, - const unsigned char *key, unsigned long keylen, - const unsigned char *nonce, unsigned long noncelen, - const unsigned char *header, unsigned long headerlen, - const unsigned char *ct, unsigned long ctlen, - unsigned char *pt, - unsigned char *tag, unsigned long taglen, - int *stat); - - int eax_test(void); -#endif /* EAX MODE */ - -#ifdef LTC_OCB_MODE -typedef struct { - unsigned char L[MAXBLOCKSIZE], /* L value */ - Ls[32][MAXBLOCKSIZE], /* L shifted by i bits to the left */ - Li[MAXBLOCKSIZE], /* value of Li [current value, we calc from previous recall] */ - Lr[MAXBLOCKSIZE], /* L * x^-1 */ - R[MAXBLOCKSIZE], /* R value */ - checksum[MAXBLOCKSIZE]; /* current checksum */ - - symmetric_key key; /* scheduled key for cipher */ - unsigned long block_index; /* index # for current block */ - int cipher, /* cipher idx */ - block_len; /* length of block */ -} ocb_state; - -int ocb_init(ocb_state *ocb, int cipher, - const unsigned char *key, unsigned long keylen, const unsigned char *nonce); - -int ocb_encrypt(ocb_state *ocb, const unsigned char *pt, unsigned char *ct); -int ocb_decrypt(ocb_state *ocb, const unsigned char *ct, unsigned char *pt); - -int ocb_done_encrypt(ocb_state *ocb, - const unsigned char *pt, unsigned long ptlen, - unsigned char *ct, - unsigned char *tag, unsigned long *taglen); - -int ocb_done_decrypt(ocb_state *ocb, - const unsigned char *ct, unsigned long ctlen, - unsigned char *pt, - const unsigned char *tag, unsigned long taglen, int *stat); - -int ocb_encrypt_authenticate_memory(int cipher, - const unsigned char *key, unsigned long keylen, - const unsigned char *nonce, - const unsigned char *pt, unsigned long ptlen, - unsigned char *ct, - unsigned char *tag, unsigned long *taglen); - -int ocb_decrypt_verify_memory(int cipher, - const unsigned char *key, unsigned long keylen, - const unsigned char *nonce, - const unsigned char *ct, unsigned long ctlen, - unsigned char *pt, - const unsigned char *tag, unsigned long taglen, - int *stat); - -int ocb_test(void); - -/* internal functions */ -void ocb_shift_xor(ocb_state *ocb, unsigned char *Z); -int ocb_ntz(unsigned long x); -int s_ocb_done(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen, - unsigned char *ct, unsigned char *tag, unsigned long *taglen, int mode); - -#endif /* LTC_OCB_MODE */ - -#ifdef LTC_CCM_MODE - -#define CCM_ENCRYPT 0 -#define CCM_DECRYPT 1 - -int ccm_memory(int cipher, - const unsigned char *key, unsigned long keylen, - symmetric_key *uskey, - const unsigned char *nonce, unsigned long noncelen, - const unsigned char *header, unsigned long headerlen, - unsigned char *pt, unsigned long ptlen, - unsigned char *ct, - unsigned char *tag, unsigned long *taglen, - int direction); - -int ccm_memory_ex(int cipher, - const unsigned char *key, unsigned long keylen, - symmetric_key *uskey, - const unsigned char *nonce, unsigned long noncelen, - const unsigned char *header, unsigned long headerlen, - unsigned char *pt, unsigned long ptlen, - unsigned char *ct, - unsigned char *tag, unsigned long *taglen, - int direction, - const unsigned char *B0, - const unsigned char *CTR, - int ctrwidth); - -int ccm_test(void); - -#endif /* LTC_CCM_MODE */ - -#if defined(LRW_MODE) || defined(LTC_GCM_MODE) -void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *c); -#endif - - -/* table shared between GCM and LRW */ -#if defined(LTC_GCM_TABLES) || defined(LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST)) -extern const unsigned char gcm_shift_table[]; -#endif - -#ifdef LTC_GCM_MODE - -#define GCM_ENCRYPT 0 -#define GCM_DECRYPT 1 - -#define LTC_GCM_MODE_IV 0 -#define LTC_GCM_MODE_AAD 1 -#define LTC_GCM_MODE_TEXT 2 - -typedef struct { - symmetric_key K; - unsigned char H[16], /* multiplier */ - X[16], /* accumulator */ - Y[16], /* counter */ - Y_0[16], /* initial counter */ - buf[16]; /* buffer for stuff */ - - int cipher, /* which cipher */ - ivmode, /* Which mode is the IV in? */ - mode, /* mode the GCM code is in */ - buflen; /* length of data in buf */ - - ulong64 totlen, /* 64-bit counter used for IV and AAD */ - pttotlen; /* 64-bit counter for the PT */ - -#ifdef LTC_GCM_TABLES - unsigned char PC[16][256][16] /* 16 tables of 8x128 */ -#ifdef LTC_GCM_TABLES_SSE2 -__attribute__ ((aligned (16))) -#endif -; -#endif -} gcm_state; - -void gcm_mult_h(gcm_state *gcm, unsigned char *I); - -int gcm_init(gcm_state *gcm, int cipher, - const unsigned char *key, int keylen); - -int gcm_reset(gcm_state *gcm); - -int gcm_add_iv(gcm_state *gcm, - const unsigned char *IV, unsigned long IVlen); - -int gcm_add_aad(gcm_state *gcm, - const unsigned char *adata, unsigned long adatalen); - -int gcm_process(gcm_state *gcm, - unsigned char *pt, unsigned long ptlen, - unsigned char *ct, - int direction); - -int gcm_done(gcm_state *gcm, - unsigned char *tag, unsigned long *taglen); - -int gcm_memory( int cipher, - const unsigned char *key, unsigned long keylen, - const unsigned char *IV, unsigned long IVlen, - const unsigned char *adata, unsigned long adatalen, - unsigned char *pt, unsigned long ptlen, - unsigned char *ct, - unsigned char *tag, unsigned long *taglen, - int direction); -int gcm_test(void); - -#endif /* LTC_GCM_MODE */ - -#ifdef LTC_PELICAN - -typedef struct pelican_state -{ - symmetric_key K; - unsigned char state[16]; - int buflen; -} pelican_state; - -int pelican_init(pelican_state *pelmac, const unsigned char *key, unsigned long keylen); -int pelican_process(pelican_state *pelmac, const unsigned char *in, unsigned long inlen); -int pelican_done(pelican_state *pelmac, unsigned char *out); -int pelican_test(void); - -int pelican_memory(const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out); - -#endif - -#ifdef LTC_XCBC - -/* add this to "keylen" to xcbc_init to use a pure three-key XCBC MAC */ -#define LTC_XCBC_PURE 0x8000UL - -typedef struct { - unsigned char K[3][MAXBLOCKSIZE], - IV[MAXBLOCKSIZE]; - - symmetric_key key; - - int cipher, - buflen, - blocksize; -} xcbc_state; - -int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned long keylen); -int xcbc_process(xcbc_state *xcbc, const unsigned char *in, unsigned long inlen); -int xcbc_done(xcbc_state *xcbc, unsigned char *out, unsigned long *outlen); -int xcbc_memory(int cipher, - const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int xcbc_memory_multi(int cipher, - const unsigned char *key, unsigned long keylen, - unsigned char *out, unsigned long *outlen, - const unsigned char *in, unsigned long inlen, ...); -int xcbc_file(int cipher, - const unsigned char *key, unsigned long keylen, - const char *filename, - unsigned char *out, unsigned long *outlen); -int xcbc_test(void); - -#endif - -#ifdef LTC_F9_MODE - -typedef struct { - unsigned char akey[MAXBLOCKSIZE], - ACC[MAXBLOCKSIZE], - IV[MAXBLOCKSIZE]; - - symmetric_key key; - - int cipher, - buflen, - keylen, - blocksize; -} f9_state; - -int f9_init(f9_state *f9, int cipher, const unsigned char *key, unsigned long keylen); -int f9_process(f9_state *f9, const unsigned char *in, unsigned long inlen); -int f9_done(f9_state *f9, unsigned char *out, unsigned long *outlen); -int f9_memory(int cipher, - const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int f9_memory_multi(int cipher, - const unsigned char *key, unsigned long keylen, - unsigned char *out, unsigned long *outlen, - const unsigned char *in, unsigned long inlen, ...); -int f9_file(int cipher, - const unsigned char *key, unsigned long keylen, - const char *filename, - unsigned char *out, unsigned long *outlen); -int f9_test(void); - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_mac.h,v $ */ -/* $Revision: 1.24 $ */ -/* $Date: 2007/06/20 13:14:31 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_macros.h Index: Source/libtomcrypt/src/headers/tomcrypt_macros.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_macros.h +++ /dev/null @@ -1,424 +0,0 @@ -/* fix for MSVC ...evil! */ -#ifdef _MSC_VER - #define CONST64(n) n ## ui64 - typedef unsigned __int64 ulong64; -#else - #define CONST64(n) n ## ULL - typedef unsigned long long ulong64; -#endif - -/* this is the "32-bit at least" data type - * Re-define it to suit your platform but it must be at least 32-bits - */ -#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) - typedef unsigned ulong32; -#else - typedef unsigned long ulong32; -#endif - -/* ---- HELPER MACROS ---- */ -#ifdef ENDIAN_NEUTRAL - -#define STORE32L(x, y) \ - { (y)[3] = (unsigned char)(((x)>>24)&255); (y)[2] = (unsigned char)(((x)>>16)&255); \ - (y)[1] = (unsigned char)(((x)>>8)&255); (y)[0] = (unsigned char)((x)&255); } - -#define LOAD32L(x, y) \ - { x = ((unsigned long)((y)[3] & 255)<<24) | \ - ((unsigned long)((y)[2] & 255)<<16) | \ - ((unsigned long)((y)[1] & 255)<<8) | \ - ((unsigned long)((y)[0] & 255)); } - -#define STORE64L(x, y) \ - { (y)[7] = (unsigned char)(((x)>>56)&255); (y)[6] = (unsigned char)(((x)>>48)&255); \ - (y)[5] = (unsigned char)(((x)>>40)&255); (y)[4] = (unsigned char)(((x)>>32)&255); \ - (y)[3] = (unsigned char)(((x)>>24)&255); (y)[2] = (unsigned char)(((x)>>16)&255); \ - (y)[1] = (unsigned char)(((x)>>8)&255); (y)[0] = (unsigned char)((x)&255); } - -#define LOAD64L(x, y) \ - { x = (((ulong64)((y)[7] & 255))<<56)|(((ulong64)((y)[6] & 255))<<48)| \ - (((ulong64)((y)[5] & 255))<<40)|(((ulong64)((y)[4] & 255))<<32)| \ - (((ulong64)((y)[3] & 255))<<24)|(((ulong64)((y)[2] & 255))<<16)| \ - (((ulong64)((y)[1] & 255))<<8)|(((ulong64)((y)[0] & 255))); } - -#define STORE32H(x, y) \ - { (y)[0] = (unsigned char)(((x)>>24)&255); (y)[1] = (unsigned char)(((x)>>16)&255); \ - (y)[2] = (unsigned char)(((x)>>8)&255); (y)[3] = (unsigned char)((x)&255); } - -#define LOAD32H(x, y) \ - { x = ((unsigned long)((y)[0] & 255)<<24) | \ - ((unsigned long)((y)[1] & 255)<<16) | \ - ((unsigned long)((y)[2] & 255)<<8) | \ - ((unsigned long)((y)[3] & 255)); } - -#define STORE64H(x, y) \ - { (y)[0] = (unsigned char)(((x)>>56)&255); (y)[1] = (unsigned char)(((x)>>48)&255); \ - (y)[2] = (unsigned char)(((x)>>40)&255); (y)[3] = (unsigned char)(((x)>>32)&255); \ - (y)[4] = (unsigned char)(((x)>>24)&255); (y)[5] = (unsigned char)(((x)>>16)&255); \ - (y)[6] = (unsigned char)(((x)>>8)&255); (y)[7] = (unsigned char)((x)&255); } - -#define LOAD64H(x, y) \ - { x = (((ulong64)((y)[0] & 255))<<56)|(((ulong64)((y)[1] & 255))<<48) | \ - (((ulong64)((y)[2] & 255))<<40)|(((ulong64)((y)[3] & 255))<<32) | \ - (((ulong64)((y)[4] & 255))<<24)|(((ulong64)((y)[5] & 255))<<16) | \ - (((ulong64)((y)[6] & 255))<<8)|(((ulong64)((y)[7] & 255))); } - -#endif /* ENDIAN_NEUTRAL */ - -#ifdef ENDIAN_LITTLE - -#if !defined(LTC_NO_BSWAP) && (defined(INTEL_CC) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__) || defined(__x86_64__)))) - -#define STORE32H(x, y) \ -asm __volatile__ ( \ - "bswapl %0 \n\t" \ - "movl %0,(%1)\n\t" \ - "bswapl %0 \n\t" \ - ::"r"(x), "r"(y)); - -#define LOAD32H(x, y) \ -asm __volatile__ ( \ - "movl (%1),%0\n\t" \ - "bswapl %0\n\t" \ - :"=r"(x): "r"(y)); - -#else - -#define STORE32H(x, y) \ - { (y)[0] = (unsigned char)(((x)>>24)&255); (y)[1] = (unsigned char)(((x)>>16)&255); \ - (y)[2] = (unsigned char)(((x)>>8)&255); (y)[3] = (unsigned char)((x)&255); } - -#define LOAD32H(x, y) \ - { x = ((unsigned long)((y)[0] & 255)<<24) | \ - ((unsigned long)((y)[1] & 255)<<16) | \ - ((unsigned long)((y)[2] & 255)<<8) | \ - ((unsigned long)((y)[3] & 255)); } - -#endif - - -/* x86_64 processor */ -#if !defined(LTC_NO_BSWAP) && (defined(__GNUC__) && defined(__x86_64__)) - -#define STORE64H(x, y) \ -asm __volatile__ ( \ - "bswapq %0 \n\t" \ - "movq %0,(%1)\n\t" \ - "bswapq %0 \n\t" \ - ::"r"(x), "r"(y)); - -#define LOAD64H(x, y) \ -asm __volatile__ ( \ - "movq (%1),%0\n\t" \ - "bswapq %0\n\t" \ - :"=r"(x): "r"(y)); - -#else - -#define STORE64H(x, y) \ - { (y)[0] = (unsigned char)(((x)>>56)&255); (y)[1] = (unsigned char)(((x)>>48)&255); \ - (y)[2] = (unsigned char)(((x)>>40)&255); (y)[3] = (unsigned char)(((x)>>32)&255); \ - (y)[4] = (unsigned char)(((x)>>24)&255); (y)[5] = (unsigned char)(((x)>>16)&255); \ - (y)[6] = (unsigned char)(((x)>>8)&255); (y)[7] = (unsigned char)((x)&255); } - -#define LOAD64H(x, y) \ - { x = (((ulong64)((y)[0] & 255))<<56)|(((ulong64)((y)[1] & 255))<<48) | \ - (((ulong64)((y)[2] & 255))<<40)|(((ulong64)((y)[3] & 255))<<32) | \ - (((ulong64)((y)[4] & 255))<<24)|(((ulong64)((y)[5] & 255))<<16) | \ - (((ulong64)((y)[6] & 255))<<8)|(((ulong64)((y)[7] & 255))); } - -#endif - -#ifdef ENDIAN_32BITWORD - -#define STORE32L(x, y) \ - { ulong32 __t = (x); XMEMCPY(y, &__t, 4); } - -#define LOAD32L(x, y) \ - XMEMCPY(&(x), y, 4); - -#define STORE64L(x, y) \ - { (y)[7] = (unsigned char)(((x)>>56)&255); (y)[6] = (unsigned char)(((x)>>48)&255); \ - (y)[5] = (unsigned char)(((x)>>40)&255); (y)[4] = (unsigned char)(((x)>>32)&255); \ - (y)[3] = (unsigned char)(((x)>>24)&255); (y)[2] = (unsigned char)(((x)>>16)&255); \ - (y)[1] = (unsigned char)(((x)>>8)&255); (y)[0] = (unsigned char)((x)&255); } - -#define LOAD64L(x, y) \ - { x = (((ulong64)((y)[7] & 255))<<56)|(((ulong64)((y)[6] & 255))<<48)| \ - (((ulong64)((y)[5] & 255))<<40)|(((ulong64)((y)[4] & 255))<<32)| \ - (((ulong64)((y)[3] & 255))<<24)|(((ulong64)((y)[2] & 255))<<16)| \ - (((ulong64)((y)[1] & 255))<<8)|(((ulong64)((y)[0] & 255))); } - -#else /* 64-bit words then */ - -#define STORE32L(x, y) \ - { ulong32 __t = (x); XMEMCPY(y, &__t, 4); } - -#define LOAD32L(x, y) \ - { XMEMCPY(&(x), y, 4); x &= 0xFFFFFFFF; } - -#define STORE64L(x, y) \ - { ulong64 __t = (x); XMEMCPY(y, &__t, 8); } - -#define LOAD64L(x, y) \ - { XMEMCPY(&(x), y, 8); } - -#endif /* ENDIAN_64BITWORD */ - -#endif /* ENDIAN_LITTLE */ - -#ifdef ENDIAN_BIG -#define STORE32L(x, y) \ - { (y)[3] = (unsigned char)(((x)>>24)&255); (y)[2] = (unsigned char)(((x)>>16)&255); \ - (y)[1] = (unsigned char)(((x)>>8)&255); (y)[0] = (unsigned char)((x)&255); } - -#define LOAD32L(x, y) \ - { x = ((unsigned long)((y)[3] & 255)<<24) | \ - ((unsigned long)((y)[2] & 255)<<16) | \ - ((unsigned long)((y)[1] & 255)<<8) | \ - ((unsigned long)((y)[0] & 255)); } - -#define STORE64L(x, y) \ - { (y)[7] = (unsigned char)(((x)>>56)&255); (y)[6] = (unsigned char)(((x)>>48)&255); \ - (y)[5] = (unsigned char)(((x)>>40)&255); (y)[4] = (unsigned char)(((x)>>32)&255); \ - (y)[3] = (unsigned char)(((x)>>24)&255); (y)[2] = (unsigned char)(((x)>>16)&255); \ - (y)[1] = (unsigned char)(((x)>>8)&255); (y)[0] = (unsigned char)((x)&255); } - -#define LOAD64L(x, y) \ - { x = (((ulong64)((y)[7] & 255))<<56)|(((ulong64)((y)[6] & 255))<<48) | \ - (((ulong64)((y)[5] & 255))<<40)|(((ulong64)((y)[4] & 255))<<32) | \ - (((ulong64)((y)[3] & 255))<<24)|(((ulong64)((y)[2] & 255))<<16) | \ - (((ulong64)((y)[1] & 255))<<8)|(((ulong64)((y)[0] & 255))); } - -#ifdef ENDIAN_32BITWORD - -#define STORE32H(x, y) \ - { ulong32 __t = (x); XMEMCPY(y, &__t, 4); } - -#define LOAD32H(x, y) \ - XMEMCPY(&(x), y, 4); - -#define STORE64H(x, y) \ - { (y)[0] = (unsigned char)(((x)>>56)&255); (y)[1] = (unsigned char)(((x)>>48)&255); \ - (y)[2] = (unsigned char)(((x)>>40)&255); (y)[3] = (unsigned char)(((x)>>32)&255); \ - (y)[4] = (unsigned char)(((x)>>24)&255); (y)[5] = (unsigned char)(((x)>>16)&255); \ - (y)[6] = (unsigned char)(((x)>>8)&255); (y)[7] = (unsigned char)((x)&255); } - -#define LOAD64H(x, y) \ - { x = (((ulong64)((y)[0] & 255))<<56)|(((ulong64)((y)[1] & 255))<<48)| \ - (((ulong64)((y)[2] & 255))<<40)|(((ulong64)((y)[3] & 255))<<32)| \ - (((ulong64)((y)[4] & 255))<<24)|(((ulong64)((y)[5] & 255))<<16)| \ - (((ulong64)((y)[6] & 255))<<8)| (((ulong64)((y)[7] & 255))); } - -#else /* 64-bit words then */ - -#define STORE32H(x, y) \ - { ulong32 __t = (x); XMEMCPY(y, &__t, 4); } - -#define LOAD32H(x, y) \ - { XMEMCPY(&(x), y, 4); x &= 0xFFFFFFFF; } - -#define STORE64H(x, y) \ - { ulong64 __t = (x); XMEMCPY(y, &__t, 8); } - -#define LOAD64H(x, y) \ - { XMEMCPY(&(x), y, 8); } - -#endif /* ENDIAN_64BITWORD */ -#endif /* ENDIAN_BIG */ - -#define BSWAP(x) ( ((x>>24)&0x000000FFUL) | ((x<<24)&0xFF000000UL) | \ - ((x>>8)&0x0000FF00UL) | ((x<<8)&0x00FF0000UL) ) - - -/* 32-bit Rotates */ -#if defined(_MSC_VER) - -/* instrinsic rotate */ -#include -#pragma intrinsic(_lrotr,_lrotl) -#define ROR(x,n) _lrotr(x,n) -#define ROL(x,n) _lrotl(x,n) -#define RORc(x,n) _lrotr(x,n) -#define ROLc(x,n) _lrotl(x,n) - -#elif !defined(__STRICT_ANSI__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && !defined(INTEL_CC) && !defined(LTC_NO_ASM) - -static inline unsigned ROL(unsigned word, int i) -{ - asm ("roll %%cl,%0" - :"=r" (word) - :"0" (word),"c" (i)); - return word; -} - -static inline unsigned ROR(unsigned word, int i) -{ - asm ("rorl %%cl,%0" - :"=r" (word) - :"0" (word),"c" (i)); - return word; -} - -#ifndef LTC_NO_ROLC - -static inline unsigned ROLc(unsigned word, const int i) -{ - asm ("roll %2,%0" - :"=r" (word) - :"0" (word),"I" (i)); - return word; -} - -static inline unsigned RORc(unsigned word, const int i) -{ - asm ("rorl %2,%0" - :"=r" (word) - :"0" (word),"I" (i)); - return word; -} - -#else - -#define ROLc ROL -#define RORc ROR - -#endif - -#elif !defined(__STRICT_ANSI__) && defined(LTC_PPC32) - -static inline unsigned ROL(unsigned word, int i) -{ - asm ("rotlw %0,%0,%2" - :"=r" (word) - :"0" (word),"r" (i)); - return word; -} - -static inline unsigned ROR(unsigned word, int i) -{ - asm ("rotlw %0,%0,%2" - :"=r" (word) - :"0" (word),"r" (32-i)); - return word; -} - -#ifndef LTC_NO_ROLC - -static inline unsigned ROLc(unsigned word, const int i) -{ - asm ("rotlwi %0,%0,%2" - :"=r" (word) - :"0" (word),"I" (i)); - return word; -} - -static inline unsigned RORc(unsigned word, const int i) -{ - asm ("rotrwi %0,%0,%2" - :"=r" (word) - :"0" (word),"I" (i)); - return word; -} - -#else - -#define ROLc ROL -#define RORc ROR - -#endif - - -#else - -/* rotates the hard way */ -#define ROL(x, y) ( (((unsigned long)(x)<<(unsigned long)((y)&31)) | (((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL) -#define ROR(x, y) ( ((((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)((y)&31)) | ((unsigned long)(x)<<(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL) -#define ROLc(x, y) ( (((unsigned long)(x)<<(unsigned long)((y)&31)) | (((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL) -#define RORc(x, y) ( ((((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)((y)&31)) | ((unsigned long)(x)<<(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL) - -#endif - - -/* 64-bit Rotates */ -#if !defined(__STRICT_ANSI__) && defined(__GNUC__) && defined(__x86_64__) && !defined(LTC_NO_ASM) - -static inline unsigned long ROL64(unsigned long word, int i) -{ - asm("rolq %%cl,%0" - :"=r" (word) - :"0" (word),"c" (i)); - return word; -} - -static inline unsigned long ROR64(unsigned long word, int i) -{ - asm("rorq %%cl,%0" - :"=r" (word) - :"0" (word),"c" (i)); - return word; -} - -#ifndef LTC_NO_ROLC - -static inline unsigned long ROL64c(unsigned long word, const int i) -{ - asm("rolq %2,%0" - :"=r" (word) - :"0" (word),"J" (i)); - return word; -} - -static inline unsigned long ROR64c(unsigned long word, const int i) -{ - asm("rorq %2,%0" - :"=r" (word) - :"0" (word),"J" (i)); - return word; -} - -#else /* LTC_NO_ROLC */ - -#define ROL64c ROL64 -#define ROR64c ROR64 - -#endif - -#else /* Not x86_64 */ - -#define ROL64(x, y) \ - ( (((x)<<((ulong64)(y)&63)) | \ - (((x)&CONST64(0xFFFFFFFFFFFFFFFF))>>((ulong64)64-((y)&63)))) & CONST64(0xFFFFFFFFFFFFFFFF)) - -#define ROR64(x, y) \ - ( ((((x)&CONST64(0xFFFFFFFFFFFFFFFF))>>((ulong64)(y)&CONST64(63))) | \ - ((x)<<((ulong64)(64-((y)&CONST64(63)))))) & CONST64(0xFFFFFFFFFFFFFFFF)) - -#define ROL64c(x, y) \ - ( (((x)<<((ulong64)(y)&63)) | \ - (((x)&CONST64(0xFFFFFFFFFFFFFFFF))>>((ulong64)64-((y)&63)))) & CONST64(0xFFFFFFFFFFFFFFFF)) - -#define ROR64c(x, y) \ - ( ((((x)&CONST64(0xFFFFFFFFFFFFFFFF))>>((ulong64)(y)&CONST64(63))) | \ - ((x)<<((ulong64)(64-((y)&CONST64(63)))))) & CONST64(0xFFFFFFFFFFFFFFFF)) - -#endif - -#ifndef MAX - #define MAX(x, y) ( ((x)>(y))?(x):(y) ) -#endif - -#ifndef MIN - #define MIN(x, y) ( ((x)<(y))?(x):(y) ) -#endif - -/* extract a byte portably */ -#ifdef _MSC_VER - #define byte(x, n) ((unsigned char)((x) >> (8 * (n)))) -#else - #define byte(x, n) (((x) >> (8 * (n))) & 255) -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_macros.h,v $ */ -/* $Revision: 1.15 $ */ -/* $Date: 2006/11/29 23:43:57 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_math.h Index: Source/libtomcrypt/src/headers/tomcrypt_math.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_math.h +++ /dev/null @@ -1,500 +0,0 @@ -/** math functions **/ - -#define LTC_MP_LT -1 -#define LTC_MP_EQ 0 -#define LTC_MP_GT 1 - -#define LTC_MP_NO 0 -#define LTC_MP_YES 1 - -#ifndef LTC_MECC - typedef void ecc_point; -#endif - -#ifndef LTC_MRSA - typedef void rsa_key; -#endif - -/** math descriptor */ -typedef struct { - /** Name of the math provider */ - char *name; - - /** Bits per digit, amount of bits must fit in an unsigned long */ - int bits_per_digit; - -/* ---- init/deinit functions ---- */ - - /** initialize a bignum - @param a The number to initialize - @return CRYPT_OK on success - */ - int (*init)(void **a); - - /** init copy - @param dst The number to initialize and write to - @param src The number to copy from - @return CRYPT_OK on success - */ - int (*init_copy)(void **dst, void *src); - - /** deinit - @param a The number to free - @return CRYPT_OK on success - */ - void (*deinit)(void *a); - -/* ---- data movement ---- */ - - /** negate - @param src The number to negate - @param dst The destination - @return CRYPT_OK on success - */ - int (*neg)(void *src, void *dst); - - /** copy - @param src The number to copy from - @param dst The number to write to - @return CRYPT_OK on success - */ - int (*copy)(void *src, void *dst); - -/* ---- trivial low level functions ---- */ - - /** set small constant - @param a Number to write to - @param n Source upto bits_per_digit (actually meant for very small constants) - @return CRYPT_OK on succcess - */ - int (*set_int)(void *a, unsigned long n); - - /** get small constant - @param a Number to read, only fetches upto bits_per_digit from the number - @return The lower bits_per_digit of the integer (unsigned) - */ - unsigned long (*get_int)(void *a); - - /** get digit n - @param a The number to read from - @param n The number of the digit to fetch - @return The bits_per_digit sized n'th digit of a - */ - unsigned long (*get_digit)(void *a, int n); - - /** Get the number of digits that represent the number - @param a The number to count - @return The number of digits used to represent the number - */ - int (*get_digit_count)(void *a); - - /** compare two integers - @param a The left side integer - @param b The right side integer - @return LTC_MP_LT if a < b, LTC_MP_GT if a > b and LTC_MP_EQ otherwise. (signed comparison) - */ - int (*compare)(void *a, void *b); - - /** compare against int - @param a The left side integer - @param b The right side integer (upto bits_per_digit) - @return LTC_MP_LT if a < b, LTC_MP_GT if a > b and LTC_MP_EQ otherwise. (signed comparison) - */ - int (*compare_d)(void *a, unsigned long n); - - /** Count the number of bits used to represent the integer - @param a The integer to count - @return The number of bits required to represent the integer - */ - int (*count_bits)(void * a); - - /** Count the number of LSB bits which are zero - @param a The integer to count - @return The number of contiguous zero LSB bits - */ - int (*count_lsb_bits)(void *a); - - /** Compute a power of two - @param a The integer to store the power in - @param n The power of two you want to store (a = 2^n) - @return CRYPT_OK on success - */ - int (*twoexpt)(void *a , int n); - -/* ---- radix conversions ---- */ - - /** read ascii string - @param a The integer to store into - @param str The string to read - @param radix The radix the integer has been represented in (2-64) - @return CRYPT_OK on success - */ - int (*read_radix)(void *a, const char *str, int radix); - - /** write number to string - @param a The integer to store - @param str The destination for the string - @param radix The radix the integer is to be represented in (2-64) - @return CRYPT_OK on success - */ - int (*write_radix)(void *a, char *str, int radix); - - /** get size as unsigned char string - @param a The integer to get the size (when stored in array of octets) - @return The length of the integer - */ - unsigned long (*unsigned_size)(void *a); - - /** store an integer as an array of octets - @param src The integer to store - @param dst The buffer to store the integer in - @return CRYPT_OK on success - */ - int (*unsigned_write)(void *src, unsigned char *dst); - - /** read an array of octets and store as integer - @param dst The integer to load - @param src The array of octets - @param len The number of octets - @return CRYPT_OK on success - */ - int (*unsigned_read)(void *dst, unsigned char *src, unsigned long len); - -/* ---- basic math ---- */ - - /** add two integers - @param a The first source integer - @param b The second source integer - @param c The destination of "a + b" - @return CRYPT_OK on success - */ - int (*add)(void *a, void *b, void *c); - - - /** add two integers - @param a The first source integer - @param b The second source integer (single digit of upto bits_per_digit in length) - @param c The destination of "a + b" - @return CRYPT_OK on success - */ - int (*addi)(void *a, unsigned long b, void *c); - - /** subtract two integers - @param a The first source integer - @param b The second source integer - @param c The destination of "a - b" - @return CRYPT_OK on success - */ - int (*sub)(void *a, void *b, void *c); - - /** subtract two integers - @param a The first source integer - @param b The second source integer (single digit of upto bits_per_digit in length) - @param c The destination of "a - b" - @return CRYPT_OK on success - */ - int (*subi)(void *a, unsigned long b, void *c); - - /** multiply two integers - @param a The first source integer - @param b The second source integer (single digit of upto bits_per_digit in length) - @param c The destination of "a * b" - @return CRYPT_OK on success - */ - int (*mul)(void *a, void *b, void *c); - - /** multiply two integers - @param a The first source integer - @param b The second source integer (single digit of upto bits_per_digit in length) - @param c The destination of "a * b" - @return CRYPT_OK on success - */ - int (*muli)(void *a, unsigned long b, void *c); - - /** Square an integer - @param a The integer to square - @param b The destination - @return CRYPT_OK on success - */ - int (*sqr)(void *a, void *b); - - /** Divide an integer - @param a The dividend - @param b The divisor - @param c The quotient (can be NULL to signify don't care) - @param d The remainder (can be NULL to signify don't care) - @return CRYPT_OK on success - */ - int (*mpdiv)(void *a, void *b, void *c, void *d); - - /** divide by two - @param a The integer to divide (shift right) - @param b The destination - @return CRYPT_OK on success - */ - int (*div_2)(void *a, void *b); - - /** Get remainder (small value) - @param a The integer to reduce - @param b The modulus (upto bits_per_digit in length) - @param c The destination for the residue - @return CRYPT_OK on success - */ - int (*modi)(void *a, unsigned long b, unsigned long *c); - - /** gcd - @param a The first integer - @param b The second integer - @param c The destination for (a, b) - @return CRYPT_OK on success - */ - int (*gcd)(void *a, void *b, void *c); - - /** lcm - @param a The first integer - @param b The second integer - @param c The destination for [a, b] - @return CRYPT_OK on success - */ - int (*lcm)(void *a, void *b, void *c); - - /** Modular multiplication - @param a The first source - @param b The second source - @param c The modulus - @param d The destination (a*b mod c) - @return CRYPT_OK on success - */ - int (*mulmod)(void *a, void *b, void *c, void *d); - - /** Modular squaring - @param a The first source - @param b The modulus - @param c The destination (a*a mod b) - @return CRYPT_OK on success - */ - int (*sqrmod)(void *a, void *b, void *c); - - /** Modular inversion - @param a The value to invert - @param b The modulus - @param c The destination (1/a mod b) - @return CRYPT_OK on success - */ - int (*invmod)(void *, void *, void *); - -/* ---- reduction ---- */ - - /** setup montgomery - @param a The modulus - @param b The destination for the reduction digit - @return CRYPT_OK on success - */ - int (*montgomery_setup)(void *a, void **b); - - /** get normalization value - @param a The destination for the normalization value - @param b The modulus - @return CRYPT_OK on success - */ - int (*montgomery_normalization)(void *a, void *b); - - /** reduce a number - @param a The number [and dest] to reduce - @param b The modulus - @param c The value "b" from montgomery_setup() - @return CRYPT_OK on success - */ - int (*montgomery_reduce)(void *a, void *b, void *c); - - /** clean up (frees memory) - @param a The value "b" from montgomery_setup() - @return CRYPT_OK on success - */ - void (*montgomery_deinit)(void *a); - -/* ---- exponentiation ---- */ - - /** Modular exponentiation - @param a The base integer - @param b The power (can be negative) integer - @param c The modulus integer - @param d The destination - @return CRYPT_OK on success - */ - int (*exptmod)(void *a, void *b, void *c, void *d); - - /** Primality testing - @param a The integer to test - @param b The destination of the result (FP_YES if prime) - @return CRYPT_OK on success - */ - int (*isprime)(void *a, int *b); - -/* ---- (optional) ecc point math ---- */ - - /** ECC GF(p) point multiplication (from the NIST curves) - @param k The integer to multiply the point by - @param G The point to multiply - @param R The destination for kG - @param modulus The modulus for the field - @param map Boolean indicated whether to map back to affine or not (can be ignored if you work in affine only) - @return CRYPT_OK on success - */ - int (*ecc_ptmul)(void *k, ecc_point *G, ecc_point *R, void *modulus, int map); - - /** ECC GF(p) point addition - @param P The first point - @param Q The second point - @param R The destination of P + Q - @param modulus The modulus - @param mp The "b" value from montgomery_setup() - @return CRYPT_OK on success - */ - int (*ecc_ptadd)(ecc_point *P, ecc_point *Q, ecc_point *R, void *modulus, void *mp); - - /** ECC GF(p) point double - @param P The first point - @param R The destination of 2P - @param modulus The modulus - @param mp The "b" value from montgomery_setup() - @return CRYPT_OK on success - */ - int (*ecc_ptdbl)(ecc_point *P, ecc_point *R, void *modulus, void *mp); - - /** ECC mapping from projective to affine, currently uses (x,y,z) => (x/z^2, y/z^3, 1) - @param P The point to map - @param modulus The modulus - @param mp The "b" value from montgomery_setup() - @return CRYPT_OK on success - @remark The mapping can be different but keep in mind a ecc_point only has three - integers (x,y,z) so if you use a different mapping you have to make it fit. - */ - int (*ecc_map)(ecc_point *P, void *modulus, void *mp); - - /** Computes kA*A + kB*B = C using Shamir's Trick - @param A First point to multiply - @param kA What to multiple A by - @param B Second point to multiply - @param kB What to multiple B by - @param C [out] Destination point (can overlap with A or B - @param modulus Modulus for curve - @return CRYPT_OK on success - */ - int (*ecc_mul2add)(ecc_point *A, void *kA, - ecc_point *B, void *kB, - ecc_point *C, - void *modulus); - -/* ---- (optional) rsa optimized math (for internal CRT) ---- */ - - /** RSA Key Generation - @param prng An active PRNG state - @param wprng The index of the PRNG desired - @param size The size of the modulus (key size) desired (octets) - @param e The "e" value (public key). e==65537 is a good choice - @param key [out] Destination of a newly created private key pair - @return CRYPT_OK if successful, upon error all allocated ram is freed - */ - int (*rsa_keygen)(prng_state *prng, int wprng, int size, long e, rsa_key *key); - - - /** RSA exponentiation - @param in The octet array representing the base - @param inlen The length of the input - @param out The destination (to be stored in an octet array format) - @param outlen The length of the output buffer and the resulting size (zero padded to the size of the modulus) - @param which PK_PUBLIC for public RSA and PK_PRIVATE for private RSA - @param key The RSA key to use - @return CRYPT_OK on success - */ - int (*rsa_me)(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, int which, - rsa_key *key); -} ltc_math_descriptor; - -extern ltc_math_descriptor ltc_mp; - -int ltc_init_multi(void **a, ...); -void ltc_deinit_multi(void *a, ...); - -#ifdef LTM_DESC -extern const ltc_math_descriptor ltm_desc; -#endif - -#ifdef TFM_DESC -extern const ltc_math_descriptor tfm_desc; -#endif - -#ifdef GMP_DESC -extern const ltc_math_descriptor gmp_desc; -#endif - -#if !defined(DESC_DEF_ONLY) && defined(LTC_SOURCE) - -#define MP_DIGIT_BIT ltc_mp.bits_per_digit - -/* some handy macros */ -#define mp_init(a) ltc_mp.init(a) -#define mp_init_multi ltc_init_multi -#define mp_clear(a) ltc_mp.deinit(a) -#define mp_clear_multi ltc_deinit_multi -#define mp_init_copy(a, b) ltc_mp.init_copy(a, b) - -#define mp_neg(a, b) ltc_mp.neg(a, b) -#define mp_copy(a, b) ltc_mp.copy(a, b) - -#define mp_set(a, b) ltc_mp.set_int(a, b) -#define mp_set_int(a, b) ltc_mp.set_int(a, b) -#define mp_get_int(a) ltc_mp.get_int(a) -#define mp_get_digit(a, n) ltc_mp.get_digit(a, n) -#define mp_get_digit_count(a) ltc_mp.get_digit_count(a) -#define mp_cmp(a, b) ltc_mp.compare(a, b) -#define mp_cmp_d(a, b) ltc_mp.compare_d(a, b) -#define mp_count_bits(a) ltc_mp.count_bits(a) -#define mp_cnt_lsb(a) ltc_mp.count_lsb_bits(a) -#define mp_2expt(a, b) ltc_mp.twoexpt(a, b) - -#define mp_read_radix(a, b, c) ltc_mp.read_radix(a, b, c) -#define mp_toradix(a, b, c) ltc_mp.write_radix(a, b, c) -#define mp_unsigned_bin_size(a) ltc_mp.unsigned_size(a) -#define mp_to_unsigned_bin(a, b) ltc_mp.unsigned_write(a, b) -#define mp_read_unsigned_bin(a, b, c) ltc_mp.unsigned_read(a, b, c) - -#define mp_add(a, b, c) ltc_mp.add(a, b, c) -#define mp_add_d(a, b, c) ltc_mp.addi(a, b, c) -#define mp_sub(a, b, c) ltc_mp.sub(a, b, c) -#define mp_sub_d(a, b, c) ltc_mp.subi(a, b, c) -#define mp_mul(a, b, c) ltc_mp.mul(a, b, c) -#define mp_mul_d(a, b, c) ltc_mp.muli(a, b, c) -#define mp_sqr(a, b) ltc_mp.sqr(a, b) -#define mp_div(a, b, c, d) ltc_mp.mpdiv(a, b, c, d) -#define mp_div_2(a, b) ltc_mp.div_2(a, b) -#define mp_mod(a, b, c) ltc_mp.mpdiv(a, b, NULL, c) -#define mp_mod_d(a, b, c) ltc_mp.modi(a, b, c) -#define mp_gcd(a, b, c) ltc_mp.gcd(a, b, c) -#define mp_lcm(a, b, c) ltc_mp.lcm(a, b, c) - -#define mp_mulmod(a, b, c, d) ltc_mp.mulmod(a, b, c, d) -#define mp_sqrmod(a, b, c) ltc_mp.sqrmod(a, b, c) -#define mp_invmod(a, b, c) ltc_mp.invmod(a, b, c) - -#define mp_montgomery_setup(a, b) ltc_mp.montgomery_setup(a, b) -#define mp_montgomery_normalization(a, b) ltc_mp.montgomery_normalization(a, b) -#define mp_montgomery_reduce(a, b, c) ltc_mp.montgomery_reduce(a, b, c) -#define mp_montgomery_free(a) ltc_mp.montgomery_deinit(a) - -#define mp_exptmod(a,b,c,d) ltc_mp.exptmod(a,b,c,d) -#define mp_prime_is_prime(a, b, c) ltc_mp.isprime(a, c) - -#define mp_iszero(a) (mp_cmp_d(a, 0) == LTC_MP_EQ ? LTC_MP_YES : LTC_MP_NO) -#define mp_isodd(a) (mp_get_digit_count(a) > 0 ? (mp_get_digit(a, 0) & 1 ? LTC_MP_YES : LTC_MP_NO) : LTC_MP_NO) -#define mp_exch(a, b) do { void *ABC__tmp = a; a = b; b = ABC__tmp; } while(0); - -#define mp_tohex(a, b) mp_toradix(a, b, 16) - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_math.h,v $ */ -/* $Revision: 1.44 $ */ -/* $Date: 2007/05/12 14:32:35 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_misc.h Index: Source/libtomcrypt/src/headers/tomcrypt_misc.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_misc.h +++ /dev/null @@ -1,23 +0,0 @@ -/* ---- LTC_BASE64 Routines ---- */ -#ifdef LTC_BASE64 -int base64_encode(const unsigned char *in, unsigned long len, - unsigned char *out, unsigned long *outlen); - -int base64_decode(const unsigned char *in, unsigned long len, - unsigned char *out, unsigned long *outlen); -#endif - -/* ---- MEM routines ---- */ -void zeromem(void *dst, size_t len); -void burn_stack(unsigned long len); - -const char *error_to_string(int err); - -extern const char *crypt_build_settings; - -/* ---- HMM ---- */ -int crypt_fsa(void *mp, ...); - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_misc.h,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2007/05/12 14:32:35 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_mode.h Index: Source/libtomcrypt/src/headers/tomcrypt_mode.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_mode.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#include -#include -#include "tomcrypt.h" -#include "rc4.h" - -typedef union ltcModeContext { - symmetric_ECB ecbContext; - symmetric_CBC cbcContext; - symmetric_CFB cfbContext; - symmetric_CTR ctrContext; - symmetric_OFB ofbContext; - symmetric_LRW lrwContext; - symmetric_F8 f8Context; - symmetric_xts xtsContext; - char rc4ctx[sizeof(RC4_KEY)]; -} mode_context; - -typedef struct ltc_mode_descriptor { - /** name of mode */ - char *name; - /** internal ID */ - unsigned char ID; - /** default number of rounds */ - uint32_t default_rounds; - /** size of the context */ - size_t ctxsize; - /** Setup the mode - @param cipher The index of the LTC Cipher - must be registered - @param IV The initial vector - @param key The input symmetric key - @param keylen The length of the input key (octets) - @param tweak The input tweak or salt - @param tweaklen The length of the tweak or salt (if variable) (octets) - @param options Mask for any mode options - @param num_rounds The requested number of rounds (0==default) - @param ctx [out] The destination of the mode context - @return CRYPT_OK if successful - */ - int (*mode_setup)(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, int tweaklen, int num_rounds, int options, mode_context *ctx); - /** Encrypt a block - @param pt The plaintext - @param ct [out] The ciphertext - @param len the length of data (in == out) octets - @param ctx The mode context - @return CRYPT_OK if successful - */ - int (*mode_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long len, mode_context *ctx); - /** Decrypt a block - @param ct The ciphertext - @param pt [out] The plaintext - @param len the length of data (in == out) octets - @param ctx The mode context - @return CRYPT_OK if successful - */ - int (*mode_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long len, mode_context *ctx); - /** Encrypt a block with a tweak (XTS mode currently) - @param pt The plaintext - @param ct [out] The ciphertext - @param len the length of data (in == out) octets - @param tweak The 128--bit encryption tweak (e.g. sector number) - @param ctx The mode context - @return CRYPT_OK if successful - */ - int (*mode_encrypt_tweaked)(const unsigned char *pt, unsigned long len, unsigned char *ct, const unsigned char *tweak, mode_context *ctx); - /** Decrypt a block with a tweak (XTS mode currently) - @param ct The ciphertext - @param pt [out] The plaintext - @param len the length of data (in == out) octets - @param ctx The mode context - @return CRYPT_OK if successful - */ - int (*mode_decrypt_tweaked)(const unsigned char *ct, unsigned long len, unsigned char *pt, const unsigned char *tweak, mode_context *ctx); - /** Terminate the mode - @param ctx [out] The mode context - @return CRYPT_OK if successful - */ - int (*mode_done)(mode_context *ctx); - /** Set an Initial Vector - @param IV The initial vector - @param len The length of the initial vector - @param ctx The mode context - @return CRYPT_OK if successful - */ - int (*mode_setiv)(const unsigned char *IV, unsigned long len, mode_context *ctx); - /** Get an Initial Vector - @param IV [out] The initial vector - @param len The length of the initial vector - @param ctx The mode context - @return CRYPT_OK if successful - */ - int (*mode_getiv)(const unsigned char *IV, unsigned long *len, mode_context *ctx); - - -} *mode_descriptor_ptr; - -extern mode_descriptor_ptr mode_descriptor[]; - -int unimp_mode_setup(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, -const unsigned char *tweak, int tweaklen, int num_rounds, int options, mode_context *ctx); -int unimp_mode_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, mode_context *ctx); -int unimp_mode_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, mode_context *ctx); -int unimp_mode_encrypt_tweaked(const unsigned char *pt, unsigned long len, unsigned char *ct, const unsigned char *tweak, mode_context *ctx); -int unimp_mode_decrypt_tweaked(const unsigned char *ct, unsigned long len, unsigned char *pt, const unsigned char *tweak, mode_context *ctx); -int unimp_mode_done(mode_context *ctx); -int unimp_mode_setiv(const unsigned char *IV, unsigned long len, mode_context *ctx); -int unimp_mode_getiv(const unsigned char *IV, unsigned long *len, mode_context *ctx); - -int rc4_stream_setup(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, -const unsigned char *tweak, int tweaklen, int num_rounds, int options, RC4_KEY *ctx); -int rc4_stream_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, mode_context *ctx); -int rc4_stream_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, mode_context *ctx); -int rc4_stream_done(mode_context *ctx); - -extern const struct ltc_mode_descriptor modeUNIMP_desc; -extern const struct ltc_mode_descriptor modeECB_desc; -extern const struct ltc_mode_descriptor modeCBC_desc; -extern const struct ltc_mode_descriptor modeCFB_desc; -extern const struct ltc_mode_descriptor modeCFB8_desc; -extern const struct ltc_mode_descriptor modeCTR_desc; -extern const struct ltc_mode_descriptor modef8_desc; -extern const struct ltc_mode_descriptor modeLRW_desc; -extern const struct ltc_mode_descriptor modeOFB_desc; -extern const struct ltc_mode_descriptor modeXTS_desc; -extern const struct ltc_mode_descriptor modeRC4_desc; - DELETED Source/libtomcrypt/src/headers/tomcrypt_pk.h Index: Source/libtomcrypt/src/headers/tomcrypt_pk.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_pk.h +++ /dev/null @@ -1,559 +0,0 @@ -/* ---- NUMBER THEORY ---- */ - -enum { - PK_PUBLIC=0, - PK_PRIVATE=1 -}; - -int rand_prime(void *N, long len, prng_state *prng, int wprng); - -/* ---- RSA ---- */ -#ifdef LTC_MRSA - -/* Min and Max RSA key sizes (in bits) */ -#define MIN_RSA_SIZE 1024 -#define MAX_RSA_SIZE 4096 - -/** RSA LTC_PKCS style key */ -typedef struct Rsa_key { - /** Type of key, PK_PRIVATE or PK_PUBLIC */ - int type; - /** The public exponent */ - void *e; - /** The private exponent */ - void *d; - /** The modulus */ - void *N; - /** The p factor of N */ - void *p; - /** The q factor of N */ - void *q; - /** The 1/q mod p CRT param */ - void *qP; - /** The d mod (p - 1) CRT param */ - void *dP; - /** The d mod (q - 1) CRT param */ - void *dQ; -} rsa_key; - -int rsa_make_key(prng_state *prng1, int wprng1, prng_state *prng2, int wprng2, int size, long e, rsa_key *key); - -int rsa_exptmod(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, int which, - rsa_key *key); - -void rsa_free(rsa_key *key); - -/* These use LTC_PKCS #1 v2.0 padding */ -#define rsa_encrypt_key(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _prng, _prng_idx, _hash_idx, _key) \ - rsa_encrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _prng, _prng_idx, _hash_idx, LTC_PKCS_1_OAEP, _key) - -#define rsa_decrypt_key(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash_idx, _stat, _key) \ - rsa_decrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash_idx, LTC_PKCS_1_OAEP, _stat, _key) - -#define rsa_sign_hash(_in, _inlen, _out, _outlen, _prng, _prng_idx, _hash_idx, _saltlen, _key) \ - rsa_sign_hash_ex(_in, _inlen, _out, _outlen, LTC_PKCS_1_PSS, _prng, _prng_idx, _hash_idx, _saltlen, _key) - -#define rsa_verify_hash(_sig, _siglen, _hash, _hashlen, _hash_idx, _saltlen, _stat, _key) \ - rsa_verify_hash_ex(_sig, _siglen, _hash, _hashlen, LTC_PKCS_1_PSS, _hash_idx, _saltlen, _stat, _key) - -/* These can be switched between LTC_PKCS #1 v2.x and LTC_PKCS #1 v1.5 paddings */ -int rsa_encrypt_key_ex(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - const unsigned char *lparam, unsigned long lparamlen, - prng_state *prng, int prng_idx, int hash_idx, int padding, rsa_key *key); - -int rsa_decrypt_key_ex(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - const unsigned char *lparam, unsigned long lparamlen, - int hash_idx, int padding, - int *stat, rsa_key *key); - -int rsa_sign_hash_ex(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - int padding, - prng_state *prng, int prng_idx, - int hash_idx, unsigned long saltlen, - rsa_key *key); - -int rsa_verify_hash_ex(const unsigned char *sig, unsigned long siglen, - const unsigned char *hash, unsigned long hashlen, - int padding, - int hash_idx, unsigned long saltlen, - int *stat, rsa_key *key); - -/* LTC_PKCS #1 import/export */ -int rsa_export(unsigned char *out, unsigned long *outlen, int type, rsa_key *key); -int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key); - -#endif - -/* ---- Katja ---- */ -#ifdef MKAT - -/* Min and Max KAT key sizes (in bits) */ -#define MIN_KAT_SIZE 1024 -#define MAX_KAT_SIZE 4096 - -/** Katja LTC_PKCS style key */ -typedef struct KAT_key { - /** Type of key, PK_PRIVATE or PK_PUBLIC */ - int type; - /** The private exponent */ - void *d; - /** The modulus */ - void *N; - /** The p factor of N */ - void *p; - /** The q factor of N */ - void *q; - /** The 1/q mod p CRT param */ - void *qP; - /** The d mod (p - 1) CRT param */ - void *dP; - /** The d mod (q - 1) CRT param */ - void *dQ; - /** The pq param */ - void *pq; -} katja_key; - -int katja_make_key(prng_state *prng, int wprng, int size, katja_key *key); - -int katja_exptmod(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, int which, - katja_key *key); - -void katja_free(katja_key *key); - -/* These use LTC_PKCS #1 v2.0 padding */ -int katja_encrypt_key(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - const unsigned char *lparam, unsigned long lparamlen, - prng_state *prng, int prng_idx, int hash_idx, katja_key *key); - -int katja_decrypt_key(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - const unsigned char *lparam, unsigned long lparamlen, - int hash_idx, int *stat, - katja_key *key); - -/* LTC_PKCS #1 import/export */ -int katja_export(unsigned char *out, unsigned long *outlen, int type, katja_key *key); -int katja_import(const unsigned char *in, unsigned long inlen, katja_key *key); - -#endif - -/* ---- ECC Routines ---- */ -#ifdef LTC_MECC - -/* size of our temp buffers for exported keys */ -#define ECC_BUF_SIZE 256 - -/* max private key size */ -#define ECC_MAXSIZE 66 - -/** Structure defines a NIST GF(p) curve */ -typedef struct { - /** The size of the curve in octets */ - int size; - - /** name of curve */ - char *name; - - /** The prime that defines the field the curve is in (encoded in hex) */ - char *prime; - - /** The fields B param (hex) */ - char *B; - - /** The order of the curve (hex) */ - char *order; - - /** The x co-ordinate of the base point on the curve (hex) */ - char *Gx; - - /** The y co-ordinate of the base point on the curve (hex) */ - char *Gy; -} ltc_ecc_set_type; - -/** A point on a ECC curve, stored in Jacbobian format such that (x,y,z) => (x/z^2, y/z^3, 1) when interpretted as affine */ -typedef struct { - - /** Is this the point at infinity? **/ - - int infinity; - - /** The x co-ordinate */ - void *x; - - /** The y co-ordinate */ - void *y; - - /** The z co-ordinate */ - void *z; -} ecc_point; - -/** An ECC key */ -typedef struct { - /** Type of key, PK_PRIVATE or PK_PUBLIC */ - int type; - - /** Index into the ltc_ecc_sets[] for the parameters of this curve; if -1, then this key is using user supplied curve in dp */ - int idx; - - /** pointer to domain parameters; either points to NIST curves (identified by idx >= 0) or user supplied curve */ - const ltc_ecc_set_type *dp; - - /** The public key */ - ecc_point pubkey; - - /** The private key */ - void *k; -} ecc_key; - -/** the ECC params provided */ -extern const ltc_ecc_set_type ltc_ecc_sets[]; - -int ecc_test(void); -void ecc_sizes(int *low, int *high); -int ecc_get_size(ecc_key *key); - -int ecc_make_key(prng_state *prng, int wprng, int keysize, ecc_key *key); -int ecc_make_key_ex(prng_state *prng, int wprng, ecc_key *key, const ltc_ecc_set_type *dp); -void ecc_free(ecc_key *key); - -int ecc_validate_key(ecc_key *key); - -int ecc_export(unsigned char *out, unsigned long *outlen, int type, ecc_key *key); -int ecc_import(const unsigned char *in, unsigned long inlen, ecc_key *key); -int ecc_import_ex(const unsigned char *in, unsigned long inlen, ecc_key *key, const ltc_ecc_set_type *dp); - -int ecc_ansi_x963_export(ecc_key *key, unsigned char *out, unsigned long *outlen); -int ecc_ansi_x963_import(const unsigned char *in, unsigned long inlen, ecc_key *key); -int ecc_ansi_x963_import_ex(const unsigned char *in, unsigned long inlen, ecc_key *key, ltc_ecc_set_type *dp); - -int ecc_shared_secret(ecc_key *private_key, ecc_key *public_key, - unsigned char *out, unsigned long *outlen); - -int ecc_encrypt_key(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - prng_state *prng, int wprng, int hash, - ecc_key *key); - -int ecc_decrypt_key(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - ecc_key *key); - -int ecc_sign_hash(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - prng_state *prng, int wprng, ecc_key *key); - -int ecc_verify_hash(const unsigned char *sig, unsigned long siglen, - const unsigned char *hash, unsigned long hashlen, - int *stat, ecc_key *key); - -/* low level functions */ -ecc_point *ltc_ecc_new_point(void); -void ltc_ecc_del_point(ecc_point *p); -int ltc_ecc_is_valid_idx(int n); - -/* point ops (mp == montgomery digit) */ -#if !defined(LTC_MECC_ACCEL) || defined(LTM_LTC_DESC) || defined(GMP_LTC_DESC) -/* R = 2P */ -int ltc_ecc_projective_dbl_point(ecc_point *P, ecc_point *R, void *modulus, void *mp); - -/* R = P + Q */ -int ltc_ecc_projective_add_point(ecc_point *P, ecc_point *Q, ecc_point *R, void *modulus, void *mp); -#endif - -#if defined(LTC_MECC_FP) -/* optimized point multiplication using fixed point cache (HAC algorithm 14.117) */ -int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int map); - -/* functions for saving/loading/freeing/adding to fixed point cache */ -int ltc_ecc_fp_save_state(unsigned char **out, unsigned long *outlen); -int ltc_ecc_fp_restore_state(unsigned char *in, unsigned long inlen); -void ltc_ecc_fp_free(void); -int ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock); - -/* lock/unlock all points currently in fixed point cache */ -void ltc_ecc_fp_tablelock(int lock); -#endif - -/* R = kG */ -int ltc_ecc_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int map); - -#ifdef LTC_ECC_SHAMIR -/* kA*A + kB*B = C */ -int ltc_ecc_mul2add(ecc_point *A, void *kA, - ecc_point *B, void *kB, - ecc_point *C, - void *modulus); - -#ifdef LTC_MECC_FP -/* Shamir's trick with optimized point multiplication using fixed point cache */ -int ltc_ecc_fp_mul2add(ecc_point *A, void *kA, - ecc_point *B, void *kB, - ecc_point *C, void *modulus); -#endif - -#endif - - -/* map P to affine from projective */ -int ltc_ecc_map(ecc_point *P, void *modulus, void *mp); - -#endif - -#ifdef LTC_MDSA - -/* Max diff between group and modulus size in bytes */ -#define LTC_MDSA_DELTA 512 - -/* Max DSA group size in bytes (default allows 4k-bit groups) */ -#define LTC_MDSA_MAX_GROUP 512 - -/** DSA key structure */ -typedef struct { - /** The key type, PK_PRIVATE or PK_PUBLIC */ - int type; - - /** The order of the sub-group used in octets */ - int qord; - - /** The generator */ - void *g; - - /** The prime used to generate the sub-group */ - void *q; - - /** The large prime that generats the field the contains the sub-group */ - void *p; - - /** The private key */ - void *x; - - /** The public key */ - void *y; -} dsa_key; - -int dsa_make_key(prng_state *prng, int wprng, int group_size, int modulus_size, dsa_key *key); -void dsa_free(dsa_key *key); - -int dsa_sign_hash_raw(const unsigned char *in, unsigned long inlen, - void *r, void *s, - prng_state *prng, int wprng, dsa_key *key); - -int dsa_sign_hash(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - prng_state *prng, int wprng, dsa_key *key); - -int dsa_verify_hash_raw( void *r, void *s, - const unsigned char *hash, unsigned long hashlen, - int *stat, dsa_key *key); - -int dsa_verify_hash(const unsigned char *sig, unsigned long siglen, - const unsigned char *hash, unsigned long hashlen, - int *stat, dsa_key *key); - -int dsa_encrypt_key(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - prng_state *prng, int wprng, int hash, - dsa_key *key); - -int dsa_decrypt_key(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - dsa_key *key); - -int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key); -int dsa_export(unsigned char *out, unsigned long *outlen, int type, dsa_key *key); -int dsa_verify_key(dsa_key *key, int *stat); - -int dsa_shared_secret(void *private_key, void *base, - dsa_key *public_key, - unsigned char *out, unsigned long *outlen); -#endif - -#ifdef LTC_DER -/* DER handling */ - -enum { - LTC_ASN1_EOL, - LTC_ASN1_BOOLEAN, - LTC_ASN1_INTEGER, - LTC_ASN1_SHORT_INTEGER, - LTC_ASN1_BIT_STRING, - LTC_ASN1_OCTET_STRING, - LTC_ASN1_NULL, - LTC_ASN1_OBJECT_IDENTIFIER, - LTC_ASN1_IA5_STRING, - LTC_ASN1_PRINTABLE_STRING, - LTC_ASN1_UTF8_STRING, - LTC_ASN1_UTCTIME, - LTC_ASN1_CHOICE, - LTC_ASN1_SEQUENCE, - LTC_ASN1_SET, - LTC_ASN1_SETOF -}; - -/** A LTC ASN.1 list type */ -typedef struct ltc_asn1_list_ { - /** The LTC ASN.1 enumerated type identifier */ - int type; - /** The data to encode or place for decoding */ - void *data; - /** The size of the input or resulting output */ - unsigned long size; - /** The used flag, this is used by the CHOICE ASN.1 type to indicate which choice was made */ - int used; - /** prev/next entry in the list */ - struct ltc_asn1_list_ *prev, *next, *child, *parent; -} ltc_asn1_list; - -#define LTC_SET_ASN1(list, index, Type, Data, Size) \ - do { \ - int LTC_MACRO_temp = (index); \ - ltc_asn1_list *LTC_MACRO_list = (list); \ - LTC_MACRO_list[LTC_MACRO_temp].type = (Type); \ - LTC_MACRO_list[LTC_MACRO_temp].data = (void*)(Data); \ - LTC_MACRO_list[LTC_MACRO_temp].size = (Size); \ - LTC_MACRO_list[LTC_MACRO_temp].used = 0; \ - } while (0); - -/* SEQUENCE */ -int der_encode_sequence_ex(ltc_asn1_list *list, unsigned long inlen, - unsigned char *out, unsigned long *outlen, int type_of); - -#define der_encode_sequence(list, inlen, out, outlen) der_encode_sequence_ex(list, inlen, out, outlen, LTC_ASN1_SEQUENCE) - -int der_decode_sequence_ex(const unsigned char *in, unsigned long inlen, - ltc_asn1_list *list, unsigned long outlen, int ordered); - -#define der_decode_sequence(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list, outlen, 1) - -int der_length_sequence(ltc_asn1_list *list, unsigned long inlen, - unsigned long *outlen); - -/* SET */ -#define der_decode_set(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list, outlen, 0) -#define der_length_set der_length_sequence -int der_encode_set(ltc_asn1_list *list, unsigned long inlen, - unsigned char *out, unsigned long *outlen); - -int der_encode_setof(ltc_asn1_list *list, unsigned long inlen, - unsigned char *out, unsigned long *outlen); - -/* VA list handy helpers with triplets of */ -int der_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...); -int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...); - -/* FLEXI DECODER handle unknown list decoder */ -int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list **out); -void der_free_sequence_flexi(ltc_asn1_list *list); -void der_sequence_free(ltc_asn1_list *in); - -/* BOOLEAN */ -int der_length_boolean(unsigned long *outlen); -int der_encode_boolean(int in, - unsigned char *out, unsigned long *outlen); -int der_decode_boolean(const unsigned char *in, unsigned long inlen, - int *out); -/* INTEGER */ -int der_encode_integer(void *num, unsigned char *out, unsigned long *outlen); -int der_decode_integer(const unsigned char *in, unsigned long inlen, void *num); -int der_length_integer(void *num, unsigned long *len); - -/* INTEGER -- handy for 0..2^32-1 values */ -int der_decode_short_integer(const unsigned char *in, unsigned long inlen, unsigned long *num); -int der_encode_short_integer(unsigned long num, unsigned char *out, unsigned long *outlen); -int der_length_short_integer(unsigned long num, unsigned long *outlen); - -/* BIT STRING */ -int der_encode_bit_string(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int der_decode_bit_string(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int der_length_bit_string(unsigned long nbits, unsigned long *outlen); - -/* OCTET STRING */ -int der_encode_octet_string(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int der_decode_octet_string(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int der_length_octet_string(unsigned long noctets, unsigned long *outlen); - -/* OBJECT IDENTIFIER */ -int der_encode_object_identifier(unsigned long *words, unsigned long nwords, - unsigned char *out, unsigned long *outlen); -int der_decode_object_identifier(const unsigned char *in, unsigned long inlen, - unsigned long *words, unsigned long *outlen); -int der_length_object_identifier(unsigned long *words, unsigned long nwords, unsigned long *outlen); -unsigned long der_object_identifier_bits(unsigned long x); - -/* IA5 STRING */ -int der_encode_ia5_string(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int der_decode_ia5_string(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int der_length_ia5_string(const unsigned char *octets, unsigned long noctets, unsigned long *outlen); - -int der_ia5_char_encode(int c); -int der_ia5_value_decode(int v); - -/* Printable STRING */ -int der_encode_printable_string(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int der_decode_printable_string(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int der_length_printable_string(const unsigned char *octets, unsigned long noctets, unsigned long *outlen); - -int der_printable_char_encode(int c); -int der_printable_value_decode(int v); - -/* UTF-8 */ -#if (defined(SIZE_MAX) || __STDC_VERSION__ >= 199901L || defined(WCHAR_MAX) || defined(_WCHAR_T) || defined(_WCHAR_T_DEFINED) || defined (__WCHAR_TYPE__)) && !defined(LTC_NO_WCHAR) -#include -#else -typedef ulong32 wchar_t; -#endif - -int der_encode_utf8_string(const wchar_t *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); - -int der_decode_utf8_string(const unsigned char *in, unsigned long inlen, - wchar_t *out, unsigned long *outlen); -unsigned long der_utf8_charsize(const wchar_t c); -int der_length_utf8_string(const wchar_t *in, unsigned long noctets, unsigned long *outlen); - - -/* CHOICE */ -int der_decode_choice(const unsigned char *in, unsigned long *inlen, - ltc_asn1_list *list, unsigned long outlen); - -/* UTCTime */ -typedef struct { - unsigned YY, /* year */ - MM, /* month */ - DD, /* day */ - hh, /* hour */ - mm, /* minute */ - ss, /* second */ - off_dir, /* timezone offset direction 0 == +, 1 == - */ - off_hh, /* timezone offset hours */ - off_mm; /* timezone offset minutes */ -} ltc_utctime; - -int der_encode_utctime(ltc_utctime *utctime, - unsigned char *out, unsigned long *outlen); - -int der_decode_utctime(const unsigned char *in, unsigned long *inlen, - ltc_utctime *out); - -int der_length_utctime(ltc_utctime *utctime, unsigned long *outlen); - - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_pk.h,v $ */ -/* $Revision: 1.81 $ */ -/* $Date: 2007/05/12 14:32:35 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_pkcs.h Index: Source/libtomcrypt/src/headers/tomcrypt_pkcs.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_pkcs.h +++ /dev/null @@ -1,89 +0,0 @@ -/* LTC_PKCS Header Info */ - -/* ===> LTC_PKCS #1 -- RSA Cryptography <=== */ -#ifdef LTC_PKCS_1 - -enum ltc_pkcs_1_v1_5_blocks -{ - LTC_PKCS_1_EMSA = 1, /* Block type 1 (LTC_PKCS #1 v1.5 signature padding) */ - LTC_PKCS_1_EME = 2 /* Block type 2 (LTC_PKCS #1 v1.5 encryption padding) */ -}; - -enum ltc_pkcs_1_paddings -{ - LTC_PKCS_1_V1_5 = 1, /* LTC_PKCS #1 v1.5 padding (\sa ltc_pkcs_1_v1_5_blocks) */ - LTC_PKCS_1_OAEP = 2, /* LTC_PKCS #1 v2.0 encryption padding */ - LTC_PKCS_1_PSS = 3 /* LTC_PKCS #1 v2.1 signature padding */ -}; - -int pkcs_1_mgf1( int hash_idx, - const unsigned char *seed, unsigned long seedlen, - unsigned char *mask, unsigned long masklen); - -int pkcs_1_i2osp(void *n, unsigned long modulus_len, unsigned char *out); -int pkcs_1_os2ip(void *n, unsigned char *in, unsigned long inlen); - -/* *** v1.5 padding */ -int pkcs_1_v1_5_encode(const unsigned char *msg, - unsigned long msglen, - int block_type, - unsigned long modulus_bitlen, - prng_state *prng, - int prng_idx, - unsigned char *out, - unsigned long *outlen); - -int pkcs_1_v1_5_decode(const unsigned char *msg, - unsigned long msglen, - int block_type, - unsigned long modulus_bitlen, - unsigned char *out, - unsigned long *outlen, - int *is_valid); - -/* *** v2.1 padding */ -int pkcs_1_oaep_encode(const unsigned char *msg, unsigned long msglen, - const unsigned char *lparam, unsigned long lparamlen, - unsigned long modulus_bitlen, prng_state *prng, - int prng_idx, int hash_idx, - unsigned char *out, unsigned long *outlen); - -int pkcs_1_oaep_decode(const unsigned char *msg, unsigned long msglen, - const unsigned char *lparam, unsigned long lparamlen, - unsigned long modulus_bitlen, int hash_idx, - unsigned char *out, unsigned long *outlen, - int *res); - -int pkcs_1_pss_encode(const unsigned char *msghash, unsigned long msghashlen, - unsigned long saltlen, prng_state *prng, - int prng_idx, int hash_idx, - unsigned long modulus_bitlen, - unsigned char *out, unsigned long *outlen); - -int pkcs_1_pss_decode(const unsigned char *msghash, unsigned long msghashlen, - const unsigned char *sig, unsigned long siglen, - unsigned long saltlen, int hash_idx, - unsigned long modulus_bitlen, int *res); - -#endif /* LTC_PKCS_1 */ - -/* ===> LTC_PKCS #5 -- Password Based Cryptography <=== */ -#ifdef LTC_PKCS_5 - -/* Algorithm #1 (old) */ -int pkcs_5_alg1(const unsigned char *password, unsigned long password_len, - const unsigned char *salt, - int iteration_count, int hash_idx, - unsigned char *out, unsigned long *outlen); - -/* Algorithm #2 (new) */ -int pkcs_5_alg2(const unsigned char *password, unsigned long password_len, - const unsigned char *salt, unsigned long salt_len, - int iteration_count, int hash_idx, - unsigned char *out, unsigned long *outlen); - -#endif /* LTC_PKCS_5 */ - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_pkcs.h,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2007/05/12 14:32:35 $ */ DELETED Source/libtomcrypt/src/headers/tomcrypt_prng.h Index: Source/libtomcrypt/src/headers/tomcrypt_prng.h ================================================================== --- Source/libtomcrypt/src/headers/tomcrypt_prng.h +++ /dev/null @@ -1,199 +0,0 @@ -/* ---- PRNG Stuff ---- */ -#ifdef LTC_YARROW -struct yarrow_prng { - int cipher, hash; - unsigned char pool[MAXBLOCKSIZE]; - symmetric_CTR ctr; - LTC_MUTEX_TYPE(prng_lock) -}; -#endif - -#ifdef LTC_RC4 -struct rc4_prng { - int x, y; - unsigned char buf[256]; -}; -#endif - -#ifdef LTC_FORTUNA -struct fortuna_prng { - hash_state pool[LTC_FORTUNA_POOLS]; /* the pools */ - - symmetric_key skey; - - unsigned char K[32], /* the current key */ - IV[16]; /* IV for CTR mode */ - - unsigned long pool_idx, /* current pool we will add to */ - pool0_len, /* length of 0'th pool */ - wd; - - ulong64 reset_cnt; /* number of times we have reset */ - LTC_MUTEX_TYPE(prng_lock) -}; -#endif - -#ifdef LTC_SOBER128 -struct sober128_prng { - ulong32 R[17], /* Working storage for the shift register */ - initR[17], /* saved register contents */ - konst, /* key dependent constant */ - sbuf; /* partial word encryption buffer */ - - int nbuf, /* number of part-word stream bits buffered */ - flag, /* first add_entropy call or not? */ - set; /* did we call add_entropy to set key? */ - -}; -#endif - -typedef union Prng_state { - char dummy[1]; -#ifdef LTC_YARROW - struct yarrow_prng yarrow; -#endif -#ifdef LTC_RC4 - struct rc4_prng rc4; -#endif -#ifdef LTC_FORTUNA - struct fortuna_prng fortuna; -#endif -#ifdef LTC_SOBER128 - struct sober128_prng sober128; -#endif -} prng_state; - -/** PRNG descriptor */ -extern struct ltc_prng_descriptor { - /** Name of the PRNG */ - char *name; - /** size in bytes of exported state */ - int export_size; - /** Start a PRNG state - @param prng [out] The state to initialize - @return CRYPT_OK if successful - */ - int (*start)(prng_state *prng); - /** Add entropy to the PRNG - @param in The entropy - @param inlen Length of the entropy (octets)\ - @param prng The PRNG state - @return CRYPT_OK if successful - */ - int (*add_entropy)(const unsigned char *in, unsigned long inlen, prng_state *prng); - /** Ready a PRNG state to read from - @param prng The PRNG state to ready - @return CRYPT_OK if successful - */ - int (*ready)(prng_state *prng); - /** Read from the PRNG - @param out [out] Where to store the data - @param outlen Length of data desired (octets) - @param prng The PRNG state to read from - @return Number of octets read - */ - unsigned long (*read)(unsigned char *out, unsigned long outlen, prng_state *prng); - /** Terminate a PRNG state - @param prng The PRNG state to terminate - @return CRYPT_OK if successful - */ - int (*done)(prng_state *prng); - /** Export a PRNG state - @param out [out] The destination for the state - @param outlen [in/out] The max size and resulting size of the PRNG state - @param prng The PRNG to export - @return CRYPT_OK if successful - */ - int (*pexport)(unsigned char *out, unsigned long *outlen, prng_state *prng); - /** Import a PRNG state - @param in The data to import - @param inlen The length of the data to import (octets) - @param prng The PRNG to initialize/import - @return CRYPT_OK if successful - */ - int (*pimport)(const unsigned char *in, unsigned long inlen, prng_state *prng); - /** Self-test the PRNG - @return CRYPT_OK if successful, CRYPT_NOP if self-testing has been disabled - */ - int (*test)(void); -} prng_descriptor[]; - -#ifdef LTC_YARROW -int yarrow_start(prng_state *prng); -int yarrow_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); -int yarrow_ready(prng_state *prng); -unsigned long yarrow_read(unsigned char *out, unsigned long outlen, prng_state *prng); -int yarrow_done(prng_state *prng); -int yarrow_export(unsigned char *out, unsigned long *outlen, prng_state *prng); -int yarrow_import(const unsigned char *in, unsigned long inlen, prng_state *prng); -int yarrow_test(void); -extern const struct ltc_prng_descriptor yarrow_desc; -#endif - -#ifdef LTC_FORTUNA -int fortuna_start(prng_state *prng); -int fortuna_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); -int fortuna_ready(prng_state *prng); -unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state *prng); -int fortuna_done(prng_state *prng); -int fortuna_export(unsigned char *out, unsigned long *outlen, prng_state *prng); -int fortuna_import(const unsigned char *in, unsigned long inlen, prng_state *prng); -int fortuna_test(void); -extern const struct ltc_prng_descriptor fortuna_desc; -#endif - -#ifdef LTC_RC4 -int rc4_start(prng_state *prng); -int rc4_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); -int rc4_ready(prng_state *prng); -unsigned long rc4_read(unsigned char *out, unsigned long outlen, prng_state *prng); -int rc4_done(prng_state *prng); -int rc4_export(unsigned char *out, unsigned long *outlen, prng_state *prng); -int rc4_import(const unsigned char *in, unsigned long inlen, prng_state *prng); -int rc4_test(void); -extern const struct ltc_prng_descriptor rc4_desc; -#endif - -#ifdef LTC_SPRNG -int sprng_start(prng_state *prng); -int sprng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); -int sprng_ready(prng_state *prng); -unsigned long sprng_read(unsigned char *out, unsigned long outlen, prng_state *prng); -int sprng_done(prng_state *prng); -int sprng_export(unsigned char *out, unsigned long *outlen, prng_state *prng); -int sprng_import(const unsigned char *in, unsigned long inlen, prng_state *prng); -int sprng_test(void); -extern const struct ltc_prng_descriptor sprng_desc; -#endif - -#ifdef LTC_SOBER128 -int sober128_start(prng_state *prng); -int sober128_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); -int sober128_ready(prng_state *prng); -unsigned long sober128_read(unsigned char *out, unsigned long outlen, prng_state *prng); -int sober128_done(prng_state *prng); -int sober128_export(unsigned char *out, unsigned long *outlen, prng_state *prng); -int sober128_import(const unsigned char *in, unsigned long inlen, prng_state *prng); -int sober128_test(void); -extern const struct ltc_prng_descriptor sober128_desc; -#endif - -int find_prng(const char *name); -int register_prng(const struct ltc_prng_descriptor *prng); -int unregister_prng(const struct ltc_prng_descriptor *prng); -int prng_is_valid(int idx); -LTC_MUTEX_PROTO(ltc_prng_mutex) - -/* Slow RNG you **might** be able to use to seed a PRNG with. Be careful as this - * might not work on all platforms as planned - */ -unsigned long rng_get_bytes(unsigned char *out, - unsigned long outlen, - void (*callback)(void)); - -int rng_make_prng(int bits, int wprng, prng_state *prng, void (*callback)(void)); - - -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_prng.h,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2007/05/12 14:32:35 $ */ DELETED Source/libtomcrypt/src/misc/base64/base64_decode.c Index: Source/libtomcrypt/src/misc/base64/base64_decode.c ================================================================== --- Source/libtomcrypt/src/misc/base64/base64_decode.c +++ /dev/null @@ -1,104 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file base64_decode.c - Compliant base64 code donated by Wayne Scott (wscott@bitmover.com) -*/ - - -#ifdef LTC_BASE64 - -static const unsigned char map[256] = { -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 62, 255, 255, 255, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, -255, 254, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 255, 255, 255, 255, 255, -255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255 }; - -/** - base64 decode a block of memory - @param in The base64 data to decode - @param inlen The length of the base64 data - @param out [out] The destination of the binary decoded data - @param outlen [in/out] The max size and resulting size of the decoded data - @return CRYPT_OK if successful -*/ -int base64_decode(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen) -{ - unsigned long t, x, y, z; - unsigned char c; - int g; - - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - g = 3; - for (x = y = z = t = 0; x < inlen; x++) { - c = map[in[x]&0xFF]; - if (c == 255) continue; - /* the final = symbols are read and used to trim the remaining bytes */ - if (c == 254) { - c = 0; - /* prevent g < 0 which would potentially allow an overflow later */ - if (--g < 0) { - return CRYPT_INVALID_PACKET; - } - } else if (g != 3) { - /* we only allow = to be at the end */ - return CRYPT_INVALID_PACKET; - } - - t = (t<<6)|c; - - if (++y == 4) { - if (z + g > *outlen) { - return CRYPT_BUFFER_OVERFLOW; - } - out[z++] = (unsigned char)((t>>16)&255); - if (g > 1) out[z++] = (unsigned char)((t>>8)&255); - if (g > 2) out[z++] = (unsigned char)(t&255); - y = t = 0; - } - } - if (y != 0) { - return CRYPT_INVALID_PACKET; - } - *outlen = z; - return CRYPT_OK; -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/base64/base64_decode.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2007/05/12 14:32:35 $ */ DELETED Source/libtomcrypt/src/misc/base64/base64_encode.c Index: Source/libtomcrypt/src/misc/base64/base64_encode.c ================================================================== --- Source/libtomcrypt/src/misc/base64/base64_encode.c +++ /dev/null @@ -1,81 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file base64_encode.c - Compliant base64 encoder donated by Wayne Scott (wscott@bitmover.com) -*/ - - -#ifdef LTC_BASE64 - -static const char *codes = -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -/** - base64 Encode a buffer (NUL terminated) - @param in The input buffer to encode - @param inlen The length of the input buffer - @param out [out] The destination of the base64 encoded data - @param outlen [in/out] The max size and resulting size - @return CRYPT_OK if successful -*/ -int base64_encode(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen) -{ - unsigned long i, len2, leven; - unsigned char *p; - - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - /* valid output size ? */ - len2 = 4 * ((inlen + 2) / 3); - if (*outlen < len2 + 1) { - *outlen = len2 + 1; - return CRYPT_BUFFER_OVERFLOW; - } - p = out; - leven = 3*(inlen / 3); - for (i = 0; i < leven; i += 3) { - *p++ = codes[(in[0] >> 2) & 0x3F]; - *p++ = codes[(((in[0] & 3) << 4) + (in[1] >> 4)) & 0x3F]; - *p++ = codes[(((in[1] & 0xf) << 2) + (in[2] >> 6)) & 0x3F]; - *p++ = codes[in[2] & 0x3F]; - in += 3; - } - /* Pad it if necessary... */ - if (i < inlen) { - unsigned a = in[0]; - unsigned b = (i+1 < inlen) ? in[1] : 0; - - *p++ = codes[(a >> 2) & 0x3F]; - *p++ = codes[(((a & 3) << 4) + (b >> 4)) & 0x3F]; - *p++ = (i+1 < inlen) ? codes[(((b & 0xf) << 2)) & 0x3F] : '='; - *p++ = '='; - } - - /* append a NULL byte */ - *p = '\0'; - - /* return ok */ - *outlen = p - out; - return CRYPT_OK; -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/base64/base64_encode.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2007/05/12 14:32:35 $ */ DELETED Source/libtomcrypt/src/misc/burn_stack.c Index: Source/libtomcrypt/src/misc/burn_stack.c ================================================================== --- Source/libtomcrypt/src/misc/burn_stack.c +++ /dev/null @@ -1,34 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file burn_stack.c - Burn stack, Tom St Denis -*/ - -/** - Burn some stack memory - @param len amount of stack to burn in bytes -*/ -void burn_stack(unsigned long len) -{ - unsigned char buf[32]; - zeromem(buf, sizeof(buf)); - if (len > (unsigned long)sizeof(buf)) - burn_stack(len - sizeof(buf)); -} - - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/burn_stack.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt.c Index: Source/libtomcrypt/src/misc/crypt/crypt.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt.c +++ /dev/null @@ -1,379 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt.c - Build strings, Tom St Denis -*/ - -const char *crypt_build_settings = - "LibTomCrypt " SCRYPT " (Tom St Denis, tomstdenis@gmail.com)\n" - "LibTomCrypt is public domain software.\n" - "Built on " __DATE__ " at " __TIME__ "\n\n\n" - "Endianess: " -#if defined(ENDIAN_NEUTRAL) - "neutral\n" -#elif defined(ENDIAN_LITTLE) - "little" - #if defined(ENDIAN_32BITWORD) - " (32-bit words)\n" - #else - " (64-bit words)\n" - #endif -#elif defined(ENDIAN_BIG) - "big" - #if defined(ENDIAN_32BITWORD) - " (32-bit words)\n" - #else - " (64-bit words)\n" - #endif -#endif - "Clean stack: " -#if defined(LTC_CLEAN_STACK) - "enabled\n" -#else - "disabled\n" -#endif - "Ciphers built-in:\n" -#if defined(LTC_BLOWFISH) - " Blowfish\n" -#endif -#if defined(LTC_RC2) - " LTC_RC2\n" -#endif -#if defined(LTC_RC5) - " LTC_RC5\n" -#endif -#if defined(LTC_RC6) - " LTC_RC6\n" -#endif -#if defined(LTC_SAFERP) - " Safer+\n" -#endif -#if defined(LTC_SAFER) - " Safer\n" -#endif -#if defined(LTC_RIJNDAEL) - " Rijndael\n" -#endif -#if defined(LTC_XTEA) - " LTC_XTEA\n" -#endif -#if defined(LTC_TWOFISH) - " Twofish " - #if defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_TABLES) && defined(LTC_TWOFISH_ALL_TABLES) - "(small, tables, all_tables)\n" - #elif defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_TABLES) - "(small, tables)\n" - #elif defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_ALL_TABLES) - "(small, all_tables)\n" - #elif defined(LTC_TWOFISH_TABLES) && defined(LTC_TWOFISH_ALL_TABLES) - "(tables, all_tables)\n" - #elif defined(LTC_TWOFISH_SMALL) - "(small)\n" - #elif defined(LTC_TWOFISH_TABLES) - "(tables)\n" - #elif defined(LTC_TWOFISH_ALL_TABLES) - "(all_tables)\n" - #else - "\n" - #endif -#endif -#if defined(LTC_DES) - " LTC_DES\n" -#endif -#if defined(LTC_CAST5) - " LTC_CAST5\n" -#endif -#if defined(LTC_NOEKEON) - " Noekeon\n" -#endif -#if defined(LTC_SKIPJACK) - " Skipjack\n" -#endif -#if defined(LTC_KHAZAD) - " Khazad\n" -#endif -#if defined(LTC_ANUBIS) - " Anubis " -#endif -#if defined(LTC_ANUBIS_TWEAK) - " (tweaked)" -#endif - "\n" -#if defined(LTC_KSEED) - " LTC_KSEED\n" -#endif -#if defined(LTC_KASUMI) - " KASUMI\n" -#endif -#if defined(LTC_MULTI2) - " MULTI2\n" -#endif -#if defined(LTC_CAMELLIA) - " Camellia\n" -#endif - - "\nHashes built-in:\n" -#if defined(LTC_SHA512) - " LTC_SHA-512\n" -#endif -#if defined(LTC_SHA384) - " LTC_SHA-384\n" -#endif -#if defined(LTC_SHA256) - " LTC_SHA-256\n" -#endif -#if defined(LTC_SHA224) - " LTC_SHA-224\n" -#endif -#if defined(LTC_TIGER) - " LTC_TIGER\n" -#endif -#if defined(LTC_SHA1) - " LTC_SHA1\n" -#endif -#if defined(LTC_MD5) - " LTC_MD5\n" -#endif -#if defined(LTC_MD4) - " LTC_MD4\n" -#endif -#if defined(LTC_MD2) - " LTC_MD2\n" -#endif -#if defined(LTC_RIPEMD128) - " LTC_RIPEMD128\n" -#endif -#if defined(LTC_RIPEMD160) - " LTC_RIPEMD160\n" -#endif -#if defined(LTC_RIPEMD256) - " LTC_RIPEMD256\n" -#endif -#if defined(LTC_RIPEMD320) - " LTC_RIPEMD320\n" -#endif -#if defined(LTC_WHIRLPOOL) - " LTC_WHIRLPOOL\n" -#endif -#if defined(LTC_CHC_HASH) - " LTC_CHC_HASH \n" -#endif - - "\nBlock Chaining Modes:\n" -#if defined(LTC_CFB_MODE) - " CFB\n" -#endif -#if defined(LTC_OFB_MODE) - " OFB\n" -#endif -#if defined(LTC_ECB_MODE) - " ECB\n" -#endif -#if defined(LTC_CBC_MODE) - " CBC\n" -#endif -#if defined(LTC_CTR_MODE) - " CTR " -#endif -#if defined(LTC_CTR_OLD) - " (CTR_OLD) " -#endif - "\n" -#if defined(LRW_MODE) - " LRW_MODE" -#if defined(LRW_TABLES) - " (LRW_TABLES) " -#endif - "\n" -#endif -#if defined(LTC_F8_MODE) - " F8 MODE\n" -#endif -#if defined(LTC_XTS_MODE) - " LTC_XTS_MODE\n" -#endif - - "\nMACs:\n" -#if defined(LTC_HMAC) - " LTC_HMAC\n" -#endif -#if defined(LTC_OMAC) - " LTC_OMAC\n" -#endif -#if defined(LTC_PMAC) - " PMAC\n" -#endif -#if defined(LTC_PELICAN) - " LTC_PELICAN\n" -#endif -#if defined(LTC_XCBC) - " XCBC-MAC\n" -#endif -#if defined(LTC_F9_MODE) - " F9-MAC\n" -#endif - - "\nENC + AUTH modes:\n" -#if defined(LTC_EAX_MODE) - " LTC_EAX_MODE\n" -#endif -#if defined(LTC_OCB_MODE) - " LTC_OCB_MODE\n" -#endif -#if defined(LTC_CCM_MODE) - " LTC_CCM_MODE\n" -#endif -#if defined(LTC_GCM_MODE) - " LTC_GCM_MODE " -#endif -#if defined(LTC_GCM_TABLES) - " (LTC_GCM_TABLES) " -#endif - "\n" - - "\nPRNG:\n" -#if defined(LTC_YARROW) - " Yarrow\n" -#endif -#if defined(LTC_SPRNG) - " LTC_SPRNG\n" -#endif -#if defined(LTC_RC4) - " LTC_RC4\n" -#endif -#if defined(LTC_FORTUNA) - " Fortuna\n" -#endif -#if defined(LTC_SOBER128) - " LTC_SOBER128\n" -#endif - - "\nPK Algs:\n" -#if defined(LTC_MRSA) - " RSA \n" -#endif -#if defined(LTC_MECC) - " ECC\n" -#endif -#if defined(LTC_MDSA) - " DSA\n" -#endif -#if defined(MKAT) - " Katja\n" -#endif - - "\nCompiler:\n" -#if defined(WIN32) - " WIN32 platform detected.\n" -#endif -#if defined(__CYGWIN__) - " CYGWIN Detected.\n" -#endif -#if defined(__DJGPP__) - " DJGPP Detected.\n" -#endif -#if defined(_MSC_VER) - " MSVC compiler detected.\n" -#endif -#if defined(__GNUC__) - " GCC compiler detected.\n" -#endif -#if defined(INTEL_CC) - " Intel C Compiler detected.\n" -#endif -#if defined(__x86_64__) - " x86-64 detected.\n" -#endif -#if defined(LTC_PPC32) - " LTC_PPC32 defined \n" -#endif - - "\nVarious others: " -#if defined(LTC_BASE64) - " LTC_BASE64 " -#endif -#if defined(MPI) - " MPI " -#endif -#if defined(TRY_UNRANDOM_FIRST) - " TRY_UNRANDOM_FIRST " -#endif -#if defined(LTC_TEST) - " LTC_TEST " -#endif -#if defined(LTC_PKCS_1) - " LTC_PKCS#1 " -#endif -#if defined(LTC_PKCS_5) - " LTC_PKCS#5 " -#endif -#if defined(LTC_SMALL_CODE) - " LTC_SMALL_CODE " -#endif -#if defined(LTC_NO_FILE) - " LTC_NO_FILE " -#endif -#if defined(LTC_DER) - " LTC_DER " -#endif -#if defined(LTC_FAST) - " LTC_FAST " -#endif -#if defined(LTC_NO_FAST) - " LTC_NO_FAST " -#endif -#if defined(LTC_NO_BSWAP) - " LTC_NO_BSWAP " -#endif -#if defined(LTC_NO_ASM) - " LTC_NO_ASM " -#endif -#if defined(LTC_NO_TEST) - " LTC_NO_TEST " -#endif -#if defined(LTC_NO_TABLES) - " LTC_NO_TABLES " -#endif -#if defined(LTC_PTHREAD) - " LTC_PTHREAD " -#endif -#if defined(LTM_LTC_DESC) - " LTM_DESC " -#endif -#if defined(TFM_LTC_DESC) - " TFM_DESC " -#endif -#if defined(LTC_MECC_ACCEL) - " LTC_MECC_ACCEL " -#endif -#if defined(GMP_LTC_DESC) - " GMP_DESC " -#endif -#if defined(LTC_EASY) - " (easy) " -#endif -#if defined(LTC_MECC_FP) - " LTC_MECC_FP " -#endif -#if defined(LTC_ECC_SHAMIR) - " LTC_ECC_SHAMIR " -#endif - "\n" - "\n\n\n" - ; - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt.c,v $ */ -/* $Revision: 1.37 $ */ -/* $Date: 2007/06/20 13:14:31 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_argchk.c Index: Source/libtomcrypt/src/misc/crypt/crypt_argchk.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_argchk.c +++ /dev/null @@ -1,30 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" -#include - -/** - @file crypt_argchk.c - Perform argument checking, Tom St Denis -*/ - -#if (ARGTYPE == 0) -void crypt_argchk(char *v, char *s, int d) -{ - fprintf(stderr, "LTC_ARGCHK '%s' failure on line %d of file %s\n", - v, d, s); - (void)raise(SIGABRT); -} -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_argchk.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c Index: Source/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c +++ /dev/null @@ -1,27 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_cipher_descriptor.c - Stores the cipher descriptor table, Tom St Denis -*/ - -struct ltc_cipher_descriptor cipher_descriptor[TAB_SIZE] = { -{ NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } - }; - -LTC_MUTEX_GLOBAL(ltc_cipher_mutex) - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c,v $ */ -/* $Revision: 1.13 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c Index: Source/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c +++ /dev/null @@ -1,36 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_cipher_is_valid.c - Determine if cipher is valid, Tom St Denis -*/ - -/* - Test if a cipher index is valid - @param idx The index of the cipher to search for - @return CRYPT_OK if valid -*/ -int cipher_is_valid(int idx) -{ - LTC_MUTEX_LOCK(<c_cipher_mutex); - if (idx < 0 || idx >= TAB_SIZE || cipher_descriptor[idx].name == NULL) { - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return CRYPT_INVALID_CIPHER; - } - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return CRYPT_OK; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_find_cipher.c Index: Source/libtomcrypt/src/misc/crypt/crypt_find_cipher.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_find_cipher.c +++ /dev/null @@ -1,41 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_find_cipher.c - Find a cipher in the descriptor tables, Tom St Denis -*/ - -/** - Find a registered cipher by name - @param name The name of the cipher to look for - @return >= 0 if found, -1 if not present -*/ -int find_cipher(const char *name) -{ - int x; - LTC_ARGCHK(name != NULL); - LTC_MUTEX_LOCK(<c_cipher_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (cipher_descriptor[x].name != NULL && !XSTRCMP(cipher_descriptor[x].name, name)) { - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return -1; -} - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_cipher.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c Index: Source/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c +++ /dev/null @@ -1,50 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_find_cipher_any.c - Find a cipher in the descriptor tables, Tom St Denis -*/ - -/** - Find a cipher flexibly. First by name then if not present by block and key size - @param name The name of the cipher desired - @param blocklen The minimum length of the block cipher desired (octets) - @param keylen The minimum length of the key size desired (octets) - @return >= 0 if found, -1 if not present -*/ -int find_cipher_any(const char *name, int blocklen, int keylen) -{ - int x; - - LTC_ARGCHK(name != NULL); - - x = find_cipher(name); - if (x != -1) return x; - - LTC_MUTEX_LOCK(<c_cipher_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (cipher_descriptor[x].name == NULL) { - continue; - } - if (blocklen <= (int)cipher_descriptor[x].block_length && keylen <= (int)cipher_descriptor[x].max_key_length) { - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return -1; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c Index: Source/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c +++ /dev/null @@ -1,40 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_find_cipher_id.c - Find cipher by ID, Tom St Denis -*/ - -/** - Find a cipher by ID number - @param ID The ID (not same as index) of the cipher to find - @return >= 0 if found, -1 if not present -*/ -int find_cipher_id(unsigned char ID) -{ - int x; - LTC_MUTEX_LOCK(<c_cipher_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (cipher_descriptor[x].ID == ID) { - x = (cipher_descriptor[x].name == NULL) ? -1 : x; - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return -1; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_find_hash.c Index: Source/libtomcrypt/src/misc/crypt/crypt_find_hash.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_find_hash.c +++ /dev/null @@ -1,40 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_find_hash.c - Find a hash, Tom St Denis -*/ - -/** - Find a registered hash by name - @param name The name of the hash to look for - @return >= 0 if found, -1 if not present -*/ -int find_hash(const char *name) -{ - int x; - LTC_ARGCHK(name != NULL); - LTC_MUTEX_LOCK(<c_hash_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (hash_descriptor[x].name != NULL && XSTRCMP(hash_descriptor[x].name, name) == 0) { - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return -1; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_hash.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c Index: Source/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c +++ /dev/null @@ -1,51 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_find_hash_any.c - Find a hash, Tom St Denis -*/ - -/** - Find a hash flexibly. First by name then if not present by digest size - @param name The name of the hash desired - @param digestlen The minimum length of the digest size (octets) - @return >= 0 if found, -1 if not present -*/ - -int find_hash_any(const char *name, int digestlen) -{ - int x, y, z; - LTC_ARGCHK(name != NULL); - - x = find_hash(name); - if (x != -1) return x; - - LTC_MUTEX_LOCK(<c_hash_mutex); - y = MAXBLOCKSIZE+1; - z = -1; - for (x = 0; x < TAB_SIZE; x++) { - if (hash_descriptor[x].name == NULL) { - continue; - } - if ((int)hash_descriptor[x].hashsize >= digestlen && (int)hash_descriptor[x].hashsize < y) { - z = x; - y = hash_descriptor[x].hashsize; - } - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return z; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c Index: Source/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c +++ /dev/null @@ -1,40 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_find_hash_id.c - Find hash by ID, Tom St Denis -*/ - -/** - Find a hash by ID number - @param ID The ID (not same as index) of the hash to find - @return >= 0 if found, -1 if not present -*/ -int find_hash_id(unsigned char ID) -{ - int x; - LTC_MUTEX_LOCK(<c_hash_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (hash_descriptor[x].ID == ID) { - x = (hash_descriptor[x].name == NULL) ? -1 : x; - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return -1; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c Index: Source/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c +++ /dev/null @@ -1,35 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_find_hash_oid.c - Find a hash, Tom St Denis -*/ - -int find_hash_oid(const unsigned long *ID, unsigned long IDlen) -{ - int x; - LTC_ARGCHK(ID != NULL); - LTC_MUTEX_LOCK(<c_hash_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (hash_descriptor[x].name != NULL && hash_descriptor[x].OIDlen == IDlen && !XMEMCMP(hash_descriptor[x].OID, ID, sizeof(unsigned long) * IDlen)) { - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return -1; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_find_prng.c Index: Source/libtomcrypt/src/misc/crypt/crypt_find_prng.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_find_prng.c +++ /dev/null @@ -1,41 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_find_prng.c - Find a PRNG, Tom St Denis -*/ - -/** - Find a registered PRNG by name - @param name The name of the PRNG to look for - @return >= 0 if found, -1 if not present -*/ -int find_prng(const char *name) -{ - int x; - LTC_ARGCHK(name != NULL); - LTC_MUTEX_LOCK(<c_prng_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if ((prng_descriptor[x].name != NULL) && XSTRCMP(prng_descriptor[x].name, name) == 0) { - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return x; - } - } - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return -1; -} - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_prng.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_fsa.c Index: Source/libtomcrypt/src/misc/crypt/crypt_fsa.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_fsa.c +++ /dev/null @@ -1,59 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" -#include - -/** - @file crypt_fsa.c - LibTomCrypt FULL SPEED AHEAD!, Tom St Denis -*/ - -/* format is ltc_mp, cipher_desc, [cipher_desc], NULL, hash_desc, [hash_desc], NULL, prng_desc, [prng_desc], NULL */ -int crypt_fsa(void *mp, ...) -{ - int err; - va_list args; - void *p; - - va_start(args, mp); - if (mp != NULL) { - XMEMCPY(<c_mp, mp, sizeof(ltc_mp)); - } - - while ((p = va_arg(args, void*)) != NULL) { - if ((err = register_cipher(p)) != CRYPT_OK) { - va_end(args); - return err; - } - } - - while ((p = va_arg(args, void*)) != NULL) { - if ((err = register_hash(p)) != CRYPT_OK) { - va_end(args); - return err; - } - } - - while ((p = va_arg(args, void*)) != NULL) { - if ((err = register_prng(p)) != CRYPT_OK) { - va_end(args); - return err; - } - } - - va_end(args); - return CRYPT_OK; -} - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_fsa.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c Index: Source/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c +++ /dev/null @@ -1,27 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_hash_descriptor.c - Stores the hash descriptor table, Tom St Denis -*/ - -struct ltc_hash_descriptor hash_descriptor[TAB_SIZE] = { -{ NULL, 0, 0, 0, { 0 }, 0, NULL, NULL, NULL, NULL, NULL } -}; - -LTC_MUTEX_GLOBAL(ltc_hash_mutex) - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c Index: Source/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c +++ /dev/null @@ -1,36 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_hash_is_valid.c - Determine if hash is valid, Tom St Denis -*/ - -/* - Test if a hash index is valid - @param idx The index of the hash to search for - @return CRYPT_OK if valid -*/ -int hash_is_valid(int idx) -{ - LTC_MUTEX_LOCK(<c_hash_mutex); - if (idx < 0 || idx >= TAB_SIZE || hash_descriptor[idx].name == NULL) { - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return CRYPT_INVALID_HASH; - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return CRYPT_OK; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c Index: Source/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c +++ /dev/null @@ -1,13 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -ltc_math_descriptor ltc_mp; DELETED Source/libtomcrypt/src/misc/crypt/crypt_mode_descriptor.c Index: Source/libtomcrypt/src/misc/crypt/crypt_mode_descriptor.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_mode_descriptor.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/* - * crypt_mode_descriptor.c - * MacTomCrypt - */ -#include "tomcrypt.h" - -/* - - This is implemented slightly differently from Tom's cipher descriptor table. All entries are static and the order and ID match. Not only that, but the - modes advertised by CommonCryptor.h match the IDs and hence the array index. That's currently defined like this: - -enum { - kCCModeECB = 1, - kCCModeCBC = 2, - kCCModeCFB = 3, - kCCModeCTR = 4, - kCCModeF8 = 5, // Not included - kCCModeLRW = 6, // Not included - kCCModeOFB = 7, - kCCModeXTS = 8, - kCCModeRC4 = 9, // RC4 as a streaming cipher is handled internally as a mode. -}; -typedef uint32_t CCMode; - -*/ - -mode_descriptor_ptr mode_descriptor[TAB_SIZE] = { - &modeUNIMP_desc, - &modeECB_desc, - &modeCBC_desc, - &modeCFB_desc, - &modeCTR_desc, - &modeUNIMP_desc, - &modeUNIMP_desc, - &modeOFB_desc, - &modeXTS_desc, - &modeRC4_desc, - &modeCFB8_desc, - }; DELETED Source/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c Index: Source/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c +++ /dev/null @@ -1,26 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_prng_descriptor.c - Stores the PRNG descriptors, Tom St Denis -*/ -struct ltc_prng_descriptor prng_descriptor[TAB_SIZE] = { -{ NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } -}; - -LTC_MUTEX_GLOBAL(ltc_prng_mutex) - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c Index: Source/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c +++ /dev/null @@ -1,36 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_prng_is_valid.c - Determine if PRNG is valid, Tom St Denis -*/ - -/* - Test if a PRNG index is valid - @param idx The index of the PRNG to search for - @return CRYPT_OK if valid -*/ -int prng_is_valid(int idx) -{ - LTC_MUTEX_LOCK(<c_prng_mutex); - if (idx < 0 || idx >= TAB_SIZE || prng_descriptor[idx].name == NULL) { - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return CRYPT_INVALID_PRNG; - } - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return CRYPT_OK; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_register_cipher.c Index: Source/libtomcrypt/src/misc/crypt/crypt_register_cipher.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_register_cipher.c +++ /dev/null @@ -1,54 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_register_cipher.c - Register a cipher, Tom St Denis -*/ - -/** - Register a cipher with the descriptor table - @param cipher The cipher you wish to register - @return value >= 0 if successfully added (or already present), -1 if unsuccessful -*/ -int register_cipher(const struct ltc_cipher_descriptor *cipher) -{ - int x; - - LTC_ARGCHK(cipher != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_cipher_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (cipher_descriptor[x].name != NULL && cipher_descriptor[x].ID == cipher->ID) { - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return x; - } - } - - /* find a blank spot */ - for (x = 0; x < TAB_SIZE; x++) { - if (cipher_descriptor[x].name == NULL) { - XMEMCPY(&cipher_descriptor[x], cipher, sizeof(struct ltc_cipher_descriptor)); - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return x; - } - } - - /* no spot */ - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return -1; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_register_cipher.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_register_hash.c Index: Source/libtomcrypt/src/misc/crypt/crypt_register_hash.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_register_hash.c +++ /dev/null @@ -1,53 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_register_hash.c - Register a HASH, Tom St Denis -*/ - -/** - Register a hash with the descriptor table - @param hash The hash you wish to register - @return value >= 0 if successfully added (or already present), -1 if unsuccessful -*/ -int register_hash(const struct ltc_hash_descriptor *hash) -{ - int x; - - LTC_ARGCHK(hash != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_hash_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (XMEMCMP(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) { - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return x; - } - } - - /* find a blank spot */ - for (x = 0; x < TAB_SIZE; x++) { - if (hash_descriptor[x].name == NULL) { - XMEMCPY(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)); - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return x; - } - } - /* no spot */ - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return -1; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_register_hash.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_register_prng.c Index: Source/libtomcrypt/src/misc/crypt/crypt_register_prng.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_register_prng.c +++ /dev/null @@ -1,54 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_register_prng.c - Register a PRNG, Tom St Denis -*/ - -/** - Register a PRNG with the descriptor table - @param prng The PRNG you wish to register - @return value >= 0 if successfully added (or already present), -1 if unsuccessful -*/ -int register_prng(const struct ltc_prng_descriptor *prng) -{ - int x; - - LTC_ARGCHK(prng != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_prng_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) == 0) { - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return x; - } - } - - /* find a blank spot */ - for (x = 0; x < TAB_SIZE; x++) { - if (prng_descriptor[x].name == NULL) { - XMEMCPY(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)); - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return x; - } - } - - /* no spot */ - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return -1; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_register_prng.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c Index: Source/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c +++ /dev/null @@ -1,45 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_unregister_cipher.c - Unregister a cipher, Tom St Denis -*/ - -/** - Unregister a cipher from the descriptor table - @param cipher The cipher descriptor to remove - @return CRYPT_OK on success -*/ -int unregister_cipher(const struct ltc_cipher_descriptor *cipher) -{ - int x; - - LTC_ARGCHK(cipher != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_cipher_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (XMEMCMP(&cipher_descriptor[x], cipher, sizeof(struct ltc_cipher_descriptor)) == 0) { - cipher_descriptor[x].name = NULL; - cipher_descriptor[x].ID = 255; - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return CRYPT_OK; - } - } - LTC_MUTEX_UNLOCK(<c_cipher_mutex); - return CRYPT_ERROR; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c Index: Source/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c +++ /dev/null @@ -1,44 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_unregister_hash.c - Unregister a hash, Tom St Denis -*/ - -/** - Unregister a hash from the descriptor table - @param hash The hash descriptor to remove - @return CRYPT_OK on success -*/ -int unregister_hash(const struct ltc_hash_descriptor *hash) -{ - int x; - - LTC_ARGCHK(hash != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_hash_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (XMEMCMP(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) { - hash_descriptor[x].name = NULL; - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return CRYPT_OK; - } - } - LTC_MUTEX_UNLOCK(<c_hash_mutex); - return CRYPT_ERROR; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c Index: Source/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c ================================================================== --- Source/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c +++ /dev/null @@ -1,44 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file crypt_unregister_prng.c - Unregister a PRNG, Tom St Denis -*/ - -/** - Unregister a PRNG from the descriptor table - @param prng The PRNG descriptor to remove - @return CRYPT_OK on success -*/ -int unregister_prng(const struct ltc_prng_descriptor *prng) -{ - int x; - - LTC_ARGCHK(prng != NULL); - - /* is it already registered? */ - LTC_MUTEX_LOCK(<c_prng_mutex); - for (x = 0; x < TAB_SIZE; x++) { - if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) != 0) { - prng_descriptor[x].name = NULL; - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return CRYPT_OK; - } - } - LTC_MUTEX_UNLOCK(<c_prng_mutex); - return CRYPT_ERROR; -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/error_to_string.c Index: Source/libtomcrypt/src/misc/error_to_string.c ================================================================== --- Source/libtomcrypt/src/misc/error_to_string.c +++ /dev/null @@ -1,77 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -#include "tomcrypt.h" - -/** - @file error_to_string.c - Convert error codes to ASCII strings, Tom St Denis -*/ - -static const char *err_2_str[] = -{ - "CRYPT_OK", - "CRYPT_ERROR", - "Non-fatal 'no-operation' requested.", - - "Invalid keysize for block cipher.", - "Invalid number of rounds for block cipher.", - "Algorithm failed test vectors.", - - "Buffer overflow.", - "Invalid input packet.", - - "Invalid number of bits for a PRNG.", - "Error reading the PRNG.", - - "Invalid cipher specified.", - "Invalid hash specified.", - "Invalid PRNG specified.", - - "Out of memory.", - - "Invalid PK key or key type specified for function.", - "A private PK key is required.", - - "Invalid argument provided.", - "File Not Found", - - "Invalid PK type.", - "Invalid PK system.", - "Duplicate PK key found on keyring.", - "Key not found in keyring.", - "Invalid sized parameter.", - - "Invalid size for prime.", - - "Invalid padding.", - - "Hash applied to too many bits.", -}; - -/** - Convert an LTC error code to ASCII - @param err The error code - @return A pointer to the ASCII NUL terminated string for the error or "Invalid error code." if the err code was not valid. -*/ -const char *error_to_string(int err) -{ - if (err < 0 || err >= (int)(sizeof(err_2_str)/sizeof(err_2_str[0]))) { - return "Invalid error code."; - } else { - return err_2_str[err]; - } -} - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/error_to_string.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c Index: Source/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c ================================================================== --- Source/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c +++ /dev/null @@ -1,106 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include - -/** - @file pkcs_5_1.c - LTC_PKCS #5, Algorithm #1, Tom St Denis -*/ -#ifdef LTC_PKCS_5 -/** - Execute LTC_PKCS #5 v1 - @param password The password (or key) - @param password_len The length of the password (octet) - @param salt The salt (or nonce) which is 8 octets long - @param iteration_count The LTC_PKCS #5 v1 iteration count - @param hash_idx The index of the hash desired - @param out [out] The destination for this algorithm - @param outlen [in/out] The max size and resulting size of the algorithm output - @return CRYPT_OK if successful -*/ -int pkcs_5_alg1(const unsigned char *password, unsigned long password_len, - const unsigned char *salt, - int iteration_count, int hash_idx, - unsigned char *out, unsigned long *outlen) -{ - int err; - unsigned long x; - hash_state *md; - unsigned char *buf; - - LTC_ARGCHK(password != NULL); - LTC_ARGCHK(salt != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - /* test hash IDX */ - if ((err = hash_is_valid(hash_idx)) != CRYPT_OK) { - return err; - } - - /* allocate memory */ - md = XMALLOC(sizeof(hash_state)); - buf = XMALLOC(MAXBLOCKSIZE); - if (md == NULL || buf == NULL) { - if (md != NULL) { - XFREE(md); - } - if (buf != NULL) { - XFREE(buf); - } - return CRYPT_MEM; - } - - /* hash initial password + salt */ - if ((err = hash_descriptor[hash_idx].init(md)) != CRYPT_OK) { - goto LBL_ERR; - } - if ((err = hash_descriptor[hash_idx].process(md, password, password_len)) != CRYPT_OK) { - goto LBL_ERR; - } - if ((err = hash_descriptor[hash_idx].process(md, salt, 8)) != CRYPT_OK) { - goto LBL_ERR; - } - if ((err = hash_descriptor[hash_idx].done(md, buf)) != CRYPT_OK) { - goto LBL_ERR; - } - - while (--iteration_count) { - /* code goes here. */ - x = MAXBLOCKSIZE; - if ((err = hash_memory(hash_idx, buf, hash_descriptor[hash_idx].hashsize, buf, &x)) != CRYPT_OK) { - goto LBL_ERR; - } - } - - /* copy upto outlen bytes */ - for (x = 0; x < hash_descriptor[hash_idx].hashsize && x < *outlen; x++) { - out[x] = buf[x]; - } - *outlen = x; - err = CRYPT_OK; -LBL_ERR: -#ifdef LTC_CLEAN_STACK - zeromem(buf, MAXBLOCKSIZE); - zeromem(md, sizeof(hash_state)); -#endif - - XFREE(buf); - XFREE(md); - - return err; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2007/05/12 14:32:35 $ */ DELETED Source/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c Index: Source/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c ================================================================== --- Source/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c +++ /dev/null @@ -1,129 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include - -/** - @file pkcs_5_2.c - LTC_PKCS #5, Algorithm #2, Tom St Denis -*/ -#ifdef LTC_PKCS_5 - -/** - Execute LTC_PKCS #5 v2 - @param password The input password (or key) - @param password_len The length of the password (octets) - @param salt The salt (or nonce) - @param salt_len The length of the salt (octets) - @param iteration_count # of iterations desired for LTC_PKCS #5 v2 [read specs for more] - @param hash_idx The index of the hash desired - @param out [out] The destination for this algorithm - @param outlen [in/out] The max size and resulting size of the algorithm output - @return CRYPT_OK if successful -*/ -int pkcs_5_alg2(const unsigned char *password, unsigned long password_len, - const unsigned char *salt, unsigned long salt_len, - int iteration_count, int hash_idx, - unsigned char *out, unsigned long *outlen) -{ - int err, itts; - ulong32 blkno; - unsigned long stored, left, x, y; - unsigned char *buf[2]; - hmac_state *hmac; - - LTC_ARGCHK(password != NULL); - LTC_ARGCHK(salt != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - /* test hash IDX */ - if ((err = hash_is_valid(hash_idx)) != CRYPT_OK) { - return err; - } - - buf[0] = XMALLOC(MAXBLOCKSIZE * 2); - hmac = XMALLOC(sizeof(hmac_state)); - if (hmac == NULL || buf[0] == NULL) { - if (hmac != NULL) { - XFREE(hmac); - } - if (buf[0] != NULL) { - XFREE(buf[0]); - } - return CRYPT_MEM; - } - /* buf[1] points to the second block of MAXBLOCKSIZE bytes */ - buf[1] = buf[0] + MAXBLOCKSIZE; - - left = *outlen; - blkno = 1; - stored = 0; - while (left != 0) { - /* process block number blkno */ - zeromem(buf[0], MAXBLOCKSIZE*2); - - /* store current block number and increment for next pass */ - STORE32H(blkno, buf[1]); - ++blkno; - - /* get PRF(P, S||int(blkno)) */ - if ((err = hmac_init(hmac, hash_idx, password, password_len)) != CRYPT_OK) { - goto LBL_ERR; - } - if ((err = hmac_process(hmac, salt, salt_len)) != CRYPT_OK) { - goto LBL_ERR; - } - if ((err = hmac_process(hmac, buf[1], 4)) != CRYPT_OK) { - goto LBL_ERR; - } - x = MAXBLOCKSIZE; - if ((err = hmac_done(hmac, buf[0], &x)) != CRYPT_OK) { - goto LBL_ERR; - } - - /* now compute repeated and XOR it in buf[1] */ - XMEMCPY(buf[1], buf[0], x); - for (itts = 1; itts < iteration_count; ++itts) { - if ((err = hmac_memory(hash_idx, password, password_len, buf[0], x, buf[0], &x)) != CRYPT_OK) { - goto LBL_ERR; - } - for (y = 0; y < x; y++) { - buf[1][y] ^= buf[0][y]; - } - } - - /* now emit upto x bytes of buf[1] to output */ - for (y = 0; y < x && left != 0; ++y) { - out[stored++] = buf[1][y]; - --left; - } - } - *outlen = stored; - - err = CRYPT_OK; -LBL_ERR: -#ifdef LTC_CLEAN_STACK - zeromem(buf[0], MAXBLOCKSIZE*2); - zeromem(hmac, sizeof(hmac_state)); -#endif - - XFREE(hmac); - XFREE(buf[0]); - - return err; -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2007/05/12 14:32:35 $ */ DELETED Source/libtomcrypt/src/misc/zeromem.c Index: Source/libtomcrypt/src/misc/zeromem.c ================================================================== --- Source/libtomcrypt/src/misc/zeromem.c +++ /dev/null @@ -1,34 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file zeromem.c - Zero a block of memory, Tom St Denis -*/ - -/** - Zero a block of memory - @param out The destination of the area to zero - @param outlen The length of the area to zero (octets) -*/ -void zeromem(void *out, size_t outlen) -{ - unsigned char *mem = out; - LTC_ARGCHKVD(out != NULL); - while (outlen-- > 0) { - *mem++ = 0; - } -} - -/* $Source: /cvs/libtom/libtomcrypt/src/misc/zeromem.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cbc/cbc_decrypt.c Index: Source/libtomcrypt/src/modes/cbc/cbc_decrypt.c ================================================================== --- Source/libtomcrypt/src/modes/cbc/cbc_decrypt.c +++ /dev/null @@ -1,103 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cbc_decrypt.c - CBC implementation, encrypt block, Tom St Denis -*/ - - -#ifdef LTC_CBC_MODE - -/** - CBC decrypt - @param ct Ciphertext - @param pt [out] Plaintext - @param len The number of bytes to process (must be multiple of block length) - @param cbc CBC state - @return CRYPT_OK if successful -*/ -int cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CBC *cbc) -{ - int x, err; - unsigned char tmp[16]; -#ifdef LTC_FAST - LTC_FAST_TYPE tmpy; -#else - unsigned char tmpy; -#endif - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(cbc != NULL); - - if ((err = cipher_is_valid(cbc->cipher)) != CRYPT_OK) { - return err; - } - - /* is blocklen valid? */ - if (cbc->blocklen < 1 || cbc->blocklen > (int)sizeof(cbc->IV)) { - return CRYPT_INVALID_ARG; - } - - if (len % cbc->blocklen) { - return CRYPT_INVALID_ARG; - } -#ifdef LTC_FAST - if (cbc->blocklen % sizeof(LTC_FAST_TYPE)) { - return CRYPT_INVALID_ARG; - } -#endif - - if (cipher_descriptor[cbc->cipher].accel_cbc_decrypt != NULL) { - return cipher_descriptor[cbc->cipher].accel_cbc_decrypt(ct, pt, len / cbc->blocklen, cbc->IV, &cbc->key); - } else { - while (len) { - /* decrypt */ - if ((err = cipher_descriptor[cbc->cipher].ecb_decrypt(ct, tmp, &cbc->key)) != CRYPT_OK) { - return err; - } - - /* xor IV against plaintext */ - #if defined(LTC_FAST) - for (x = 0; x < cbc->blocklen; x += sizeof(LTC_FAST_TYPE)) { - tmpy = *((LTC_FAST_TYPE*)((unsigned char *)cbc->IV + x)) ^ *((LTC_FAST_TYPE*)((unsigned char *)tmp + x)); - *((LTC_FAST_TYPE*)((unsigned char *)cbc->IV + x)) = *((LTC_FAST_TYPE*)((unsigned char *)ct + x)); - *((LTC_FAST_TYPE*)((unsigned char *)pt + x)) = tmpy; - } - #else - for (x = 0; x < cbc->blocklen; x++) { - tmpy = tmp[x] ^ cbc->IV[x]; - cbc->IV[x] = ct[x]; - pt[x] = tmpy; - } - #endif - - ct += cbc->blocklen; - pt += cbc->blocklen; - len -= cbc->blocklen; - } - } - return CRYPT_OK; -} - -int cbc_decrypt_tweaked(const unsigned char *ct, unsigned long len, unsigned char *pt, const unsigned char *tweak, symmetric_CBC *cbc) -{ - (void) cbc_setiv(tweak, cbc->blocklen, cbc); - return cbc_decrypt(ct, pt, len, cbc); -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_decrypt.c,v $ */ -/* $Revision: 1.16 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cbc/cbc_descriptor.c Index: Source/libtomcrypt/src/modes/cbc/cbc_descriptor.c ================================================================== --- Source/libtomcrypt/src/modes/cbc/cbc_descriptor.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/* - * cbc_descriptor.c - * MacTomCrypt - */ - -#include "tomcrypt.h" -#if defined(LTC_CBC_MODE) && defined(MACTOMCRYPT) - -const struct ltc_mode_descriptor modeCBC_desc = -{ - "CBC", - 2, /* Must match kCCModeCBC = 2 */ - 1, - sizeof(symmetric_CBC), - &cbc_start, - &cbc_encrypt, - &cbc_decrypt, - &cbc_encrypt_tweaked, - &cbc_decrypt_tweaked, - &cbc_done, - &cbc_setiv, - &cbc_getiv, -}; -#endif /* LTC_CBC_MODE */ DELETED Source/libtomcrypt/src/modes/cbc/cbc_done.c Index: Source/libtomcrypt/src/modes/cbc/cbc_done.c ================================================================== --- Source/libtomcrypt/src/modes/cbc/cbc_done.c +++ /dev/null @@ -1,42 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cbc_done.c - CBC implementation, finish chain, Tom St Denis -*/ - -#ifdef LTC_CBC_MODE - -/** Terminate the chain - @param cbc The CBC chain to terminate - @return CRYPT_OK on success -*/ -int cbc_done(symmetric_CBC *cbc) -{ - int err; - LTC_ARGCHK(cbc != NULL); - - if ((err = cipher_is_valid(cbc->cipher)) != CRYPT_OK) { - return err; - } - cipher_descriptor[cbc->cipher].done(&cbc->key); - return CRYPT_OK; -} - - - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_done.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cbc/cbc_encrypt.c Index: Source/libtomcrypt/src/modes/cbc/cbc_encrypt.c ================================================================== --- Source/libtomcrypt/src/modes/cbc/cbc_encrypt.c +++ /dev/null @@ -1,104 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cbc_encrypt.c - CBC implementation, encrypt block, Tom St Denis -*/ - - -#ifdef LTC_CBC_MODE - -/** - CBC encrypt - @param pt Plaintext - @param ct [out] Ciphertext - @param len The number of bytes to process (must be multiple of block length) - @param cbc CBC state - @return CRYPT_OK if successful -*/ -int cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CBC *cbc) -{ - int x, err; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(cbc != NULL); - - if ((err = cipher_is_valid(cbc->cipher)) != CRYPT_OK) { - return err; - } - - /* is blocklen valid? */ - if (cbc->blocklen < 1 || cbc->blocklen > (int)sizeof(cbc->IV)) { - return CRYPT_INVALID_ARG; - } - - if (len % cbc->blocklen) { - return CRYPT_INVALID_ARG; - } -#ifdef LTC_FAST - if (cbc->blocklen % sizeof(LTC_FAST_TYPE)) { - return CRYPT_INVALID_ARG; - } -#endif - - if (cipher_descriptor[cbc->cipher].accel_cbc_encrypt != NULL) { - return cipher_descriptor[cbc->cipher].accel_cbc_encrypt(pt, ct, len / cbc->blocklen, cbc->IV, &cbc->key); - } else { - while (len) { - /* xor IV against plaintext */ - #if defined(LTC_FAST) - for (x = 0; x < cbc->blocklen; x += sizeof(LTC_FAST_TYPE)) { - *((LTC_FAST_TYPE*)((unsigned char *)cbc->IV + x)) ^= *((LTC_FAST_TYPE*)((unsigned char *)pt + x)); - } - #else - for (x = 0; x < cbc->blocklen; x++) { - cbc->IV[x] ^= pt[x]; - } - #endif - - /* encrypt */ - if ((err = cipher_descriptor[cbc->cipher].ecb_encrypt(cbc->IV, ct, &cbc->key)) != CRYPT_OK) { - return err; - } - - /* store IV [ciphertext] for a future block */ - #if defined(LTC_FAST) - for (x = 0; x < cbc->blocklen; x += sizeof(LTC_FAST_TYPE)) { - *((LTC_FAST_TYPE*)((unsigned char *)cbc->IV + x)) = *((LTC_FAST_TYPE*)((unsigned char *)ct + x)); - } - #else - for (x = 0; x < cbc->blocklen; x++) { - cbc->IV[x] = ct[x]; - } - #endif - - ct += cbc->blocklen; - pt += cbc->blocklen; - len -= cbc->blocklen; - } - } - return CRYPT_OK; -} - -int cbc_encrypt_tweaked(const unsigned char *pt, unsigned long len, unsigned char *ct, const unsigned char *tweak, symmetric_CBC *cbc) -{ - (void) cbc_setiv(tweak, cbc->blocklen, cbc); - return cbc_encrypt(pt, ct, len, cbc); -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_encrypt.c,v $ */ -/* $Revision: 1.14 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cbc/cbc_getiv.c Index: Source/libtomcrypt/src/modes/cbc/cbc_getiv.c ================================================================== --- Source/libtomcrypt/src/modes/cbc/cbc_getiv.c +++ /dev/null @@ -1,46 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cbc_getiv.c - CBC implementation, get IV, Tom St Denis -*/ - -#ifdef LTC_CBC_MODE - -/** - Get the current initial vector - @param IV [out] The destination of the initial vector - @param len [in/out] The max size and resulting size of the initial vector - @param cbc The CBC state - @return CRYPT_OK if successful -*/ -int cbc_getiv(unsigned char *IV, unsigned long *len, symmetric_CBC *cbc) -{ - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(len != NULL); - LTC_ARGCHK(cbc != NULL); - if ((unsigned long)cbc->blocklen > *len) { - *len = cbc->blocklen; - return CRYPT_BUFFER_OVERFLOW; - } - XMEMCPY(IV, cbc->IV, cbc->blocklen); - *len = cbc->blocklen; - - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_getiv.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cbc/cbc_setiv.c Index: Source/libtomcrypt/src/modes/cbc/cbc_setiv.c ================================================================== --- Source/libtomcrypt/src/modes/cbc/cbc_setiv.c +++ /dev/null @@ -1,44 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cbc_setiv.c - CBC implementation, set IV, Tom St Denis -*/ - - -#ifdef LTC_CBC_MODE - -/** - Set an initial vector - @param IV The initial vector - @param len The length of the vector (in octets) - @param cbc The CBC state - @return CRYPT_OK if successful -*/ -int cbc_setiv(const unsigned char *IV, unsigned long len, symmetric_CBC *cbc) -{ - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(cbc != NULL); - if (len != (unsigned long)cbc->blocklen) { - return CRYPT_INVALID_ARG; - } - XMEMCPY(cbc->IV, IV, len); - return CRYPT_OK; -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_setiv.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cbc/cbc_start.c Index: Source/libtomcrypt/src/modes/cbc/cbc_start.c ================================================================== --- Source/libtomcrypt/src/modes/cbc/cbc_start.c +++ /dev/null @@ -1,67 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cbc_start.c - CBC implementation, start chain, Tom St Denis -*/ - -#ifdef LTC_CBC_MODE - -/** - Initialize a CBC context - @param cipher The index of the cipher desired - @param IV The initial vector - @param key The secret key - @param keylen The length of the secret key (octets) - @param num_rounds Number of rounds in the cipher desired (0 for default) - @param cbc The CBC state to initialize - @return CRYPT_OK if successful -*/ -#ifdef MACTOMCRYPT -int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, - const unsigned char *tweak, int tweaklen, int num_rounds, int options, symmetric_CBC *cbc) -#else -int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key, - int keylen, int num_rounds, symmetric_CBC *cbc) -#endif -{ - int x, err; - - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(cbc != NULL); - - /* bad param? */ - if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { - return err; - } - - /* setup cipher */ - if ((err = cipher_descriptor[cipher].setup(key, keylen, num_rounds, &cbc->key)) != CRYPT_OK) { - return err; - } - - /* copy IV */ - cbc->blocklen = cipher_descriptor[cipher].block_length; - cbc->cipher = cipher; - for (x = 0; x < cbc->blocklen; x++) { - cbc->IV[x] = IV[x]; - } - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_start.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cfb/cfb_decrypt.c Index: Source/libtomcrypt/src/modes/cfb/cfb_decrypt.c ================================================================== --- Source/libtomcrypt/src/modes/cfb/cfb_decrypt.c +++ /dev/null @@ -1,67 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb_decrypt.c - CFB implementation, decrypt data, Tom St Denis -*/ - -#ifdef LTC_CFB_MODE - -/** - CFB decrypt - @param ct Ciphertext - @param pt [out] Plaintext - @param len Length of ciphertext (octets) - @param cfb CFB state - @return CRYPT_OK if successful -*/ -int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CFB *cfb) -{ - int err; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(cfb != NULL); - - if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { - return err; - } - - /* is blocklen/padlen valid? */ - if (cfb->blocklen < 0 || cfb->blocklen > (int)sizeof(cfb->IV) || - cfb->padlen < 0 || cfb->padlen > (int)sizeof(cfb->pad)) { - return CRYPT_INVALID_ARG; - } - - while (len-- > 0) { - if (cfb->padlen == cfb->blocklen) { - if ((err = cipher_descriptor[cfb->cipher].ecb_encrypt(cfb->pad, cfb->IV, &cfb->key)) != CRYPT_OK) { - return err; - } - cfb->padlen = 0; - } - cfb->pad[cfb->padlen] = *ct; - *pt = *ct ^ cfb->IV[cfb->padlen]; - ++pt; - ++ct; - ++(cfb->padlen); - } - return CRYPT_OK; -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_decrypt.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cfb/cfb_descriptor.c Index: Source/libtomcrypt/src/modes/cfb/cfb_descriptor.c ================================================================== --- Source/libtomcrypt/src/modes/cfb/cfb_descriptor.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/* - * cfb_descriptor.c - * MacTomCrypt - */ - -#include "tomcrypt.h" -#if defined(LTC_CFB_MODE) && defined(MACTOMCRYPT) - -const struct ltc_mode_descriptor modeCFB_desc = -{ - "CFB", - 3, /* Must match kCCModeCFB = 3 */ - 1, - sizeof(symmetric_CFB), - &cfb_start, - &cfb_encrypt, - &cfb_decrypt, - &unimp_mode_encrypt_tweaked, - &unimp_mode_decrypt_tweaked, - &cfb_done, - &cfb_setiv, - &cfb_getiv, -}; -#endif /* LTC_CFB_MODE */ DELETED Source/libtomcrypt/src/modes/cfb/cfb_done.c Index: Source/libtomcrypt/src/modes/cfb/cfb_done.c ================================================================== --- Source/libtomcrypt/src/modes/cfb/cfb_done.c +++ /dev/null @@ -1,42 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb_done.c - CFB implementation, finish chain, Tom St Denis -*/ - -#ifdef LTC_CFB_MODE - -/** Terminate the chain - @param cfb The CFB chain to terminate - @return CRYPT_OK on success -*/ -int cfb_done(symmetric_CFB *cfb) -{ - int err; - LTC_ARGCHK(cfb != NULL); - - if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { - return err; - } - cipher_descriptor[cfb->cipher].done(&cfb->key); - return CRYPT_OK; -} - - - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_done.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cfb/cfb_encrypt.c Index: Source/libtomcrypt/src/modes/cfb/cfb_encrypt.c ================================================================== --- Source/libtomcrypt/src/modes/cfb/cfb_encrypt.c +++ /dev/null @@ -1,65 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb_encrypt.c - CFB implementation, encrypt data, Tom St Denis -*/ - -#ifdef LTC_CFB_MODE - -/** - CFB encrypt - @param pt Plaintext - @param ct [out] Ciphertext - @param len Length of plaintext (octets) - @param cfb CFB state - @return CRYPT_OK if successful -*/ -int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CFB *cfb) -{ - int err; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(cfb != NULL); - - if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { - return err; - } - - /* is blocklen/padlen valid? */ - if (cfb->blocklen < 0 || cfb->blocklen > (int)sizeof(cfb->IV) || - cfb->padlen < 0 || cfb->padlen > (int)sizeof(cfb->pad)) { - return CRYPT_INVALID_ARG; - } - - while (len-- > 0) { - if (cfb->padlen == cfb->blocklen) { - if ((err = cipher_descriptor[cfb->cipher].ecb_encrypt(cfb->pad, cfb->IV, &cfb->key)) != CRYPT_OK) { - return err; - } - cfb->padlen = 0; - } - cfb->pad[cfb->padlen] = (*ct = *pt ^ cfb->IV[cfb->padlen]); - ++pt; - ++ct; - ++(cfb->padlen); - } - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_encrypt.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cfb/cfb_getiv.c Index: Source/libtomcrypt/src/modes/cfb/cfb_getiv.c ================================================================== --- Source/libtomcrypt/src/modes/cfb/cfb_getiv.c +++ /dev/null @@ -1,46 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb_getiv.c - CFB implementation, get IV, Tom St Denis -*/ - -#ifdef LTC_CFB_MODE - -/** - Get the current initial vector - @param IV [out] The destination of the initial vector - @param len [in/out] The max size and resulting size of the initial vector - @param cfb The CFB state - @return CRYPT_OK if successful -*/ -int cfb_getiv(unsigned char *IV, unsigned long *len, symmetric_CFB *cfb) -{ - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(len != NULL); - LTC_ARGCHK(cfb != NULL); - if ((unsigned long)cfb->blocklen > *len) { - *len = cfb->blocklen; - return CRYPT_BUFFER_OVERFLOW; - } - XMEMCPY(IV, cfb->IV, cfb->blocklen); - *len = cfb->blocklen; - - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_getiv.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cfb/cfb_setiv.c Index: Source/libtomcrypt/src/modes/cfb/cfb_setiv.c ================================================================== --- Source/libtomcrypt/src/modes/cfb/cfb_setiv.c +++ /dev/null @@ -1,52 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb_setiv.c - CFB implementation, set IV, Tom St Denis -*/ - -#ifdef LTC_CFB_MODE - -/** - Set an initial vector - @param IV The initial vector - @param len The length of the vector (in octets) - @param cfb The CFB state - @return CRYPT_OK if successful -*/ -int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb) -{ - int err; - - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(cfb != NULL); - - if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { - return err; - } - - if (len != (unsigned long)cfb->blocklen) { - return CRYPT_INVALID_ARG; - } - - /* force next block */ - cfb->padlen = 0; - return cipher_descriptor[cfb->cipher].ecb_encrypt(IV, cfb->IV, &cfb->key); -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_setiv.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cfb/cfb_start.c Index: Source/libtomcrypt/src/modes/cfb/cfb_start.c ================================================================== --- Source/libtomcrypt/src/modes/cfb/cfb_start.c +++ /dev/null @@ -1,70 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb_start.c - CFB implementation, start chain, Tom St Denis -*/ - - -#ifdef LTC_CFB_MODE - -/** - Initialize a CFB context - @param cipher The index of the cipher desired - @param IV The initial vector - @param key The secret key - @param keylen The length of the secret key (octets) - @param num_rounds Number of rounds in the cipher desired (0 for default) - @param cfb The CFB state to initialize - @return CRYPT_OK if successful -*/ -#ifdef MACTOMCRYPT -int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, int tweaklen, - int num_rounds, int options, symmetric_CFB *cfb) -#else -int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, - int keylen, int num_rounds, symmetric_CFB *cfb) -#endif -{ - int x, err; - - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(cfb != NULL); - - if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { - return err; - } - - - /* copy data */ - cfb->cipher = cipher; - cfb->blocklen = cipher_descriptor[cipher].block_length; - for (x = 0; x < cfb->blocklen; x++) - cfb->IV[x] = IV[x]; - - /* init the cipher */ - if ((err = cipher_descriptor[cipher].setup(key, keylen, num_rounds, &cfb->key)) != CRYPT_OK) { - return err; - } - - /* encrypt the IV */ - cfb->padlen = 0; - return cipher_descriptor[cfb->cipher].ecb_encrypt(cfb->IV, cfb->IV, &cfb->key); -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_start.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cfb8/cfb8_decrypt.c Index: Source/libtomcrypt/src/modes/cfb8/cfb8_decrypt.c ================================================================== --- Source/libtomcrypt/src/modes/cfb8/cfb8_decrypt.c +++ /dev/null @@ -1,66 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb_decrypt.c - CFB implementation, decrypt data, Tom St Denis -*/ - -#ifdef LTC_CFB_MODE - -/** - CFB decrypt - @param ct Ciphertext - @param pt [out] Plaintext - @param len Length of ciphertext (octets) - @param cfb CFB state - @return CRYPT_OK if successful -*/ -int cfb8_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CFB *cfb) -{ - int err; - unsigned char *theIV; - int ivSize; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(cfb != NULL); - - theIV = (unsigned char *) cfb->IV; - ivSize = cfb->blocklen; - - if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) return err; - - if (cfb->blocklen < 0 || cfb->blocklen > ivSize) return CRYPT_INVALID_ARG; - - while (len-- > 0) { - // XOR the plaintext byte *ct with the leftmost byte of the IV buffer giving *pt - *pt = cfb->pad[0] ^ *ct; - // Rotate the IV Buffer left one byte - memmove(theIV, theIV+1, ivSize-1); - // copy *ct into the rightmost byte of the IV buffer - theIV[ivSize - 1] = *ct; - // Encrypt the IV buffer - if ((err = cipher_descriptor[cfb->cipher].ecb_encrypt(cfb->IV, cfb->pad, &cfb->key)) != CRYPT_OK) return err; - // Bump the pointers - ++pt; - ++ct; - } - return CRYPT_OK; -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_decrypt.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cfb8/cfb8_descriptor.c Index: Source/libtomcrypt/src/modes/cfb8/cfb8_descriptor.c ================================================================== --- Source/libtomcrypt/src/modes/cfb8/cfb8_descriptor.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/* - * cfb_descriptor.c - * MacTomCrypt - */ - -#include "tomcrypt.h" -#if defined(LTC_CFB_MODE) && defined(MACTOMCRYPT) - -const struct ltc_mode_descriptor modeCFB8_desc = -{ - "CFB8", - 10, /* Must match kCCModeCFB = 3 */ - 1, - sizeof(symmetric_CFB), - &cfb8_start, - &cfb8_encrypt, - &cfb8_decrypt, - &unimp_mode_encrypt_tweaked, - &unimp_mode_decrypt_tweaked, - &cfb8_done, - &cfb8_setiv, - &cfb8_getiv, -}; -#endif /* LTC_CFB_MODE */ DELETED Source/libtomcrypt/src/modes/cfb8/cfb8_done.c Index: Source/libtomcrypt/src/modes/cfb8/cfb8_done.c ================================================================== --- Source/libtomcrypt/src/modes/cfb8/cfb8_done.c +++ /dev/null @@ -1,42 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb_done.c - CFB implementation, finish chain, Tom St Denis -*/ - -#ifdef LTC_CFB_MODE - -/** Terminate the chain - @param cfb The CFB chain to terminate - @return CRYPT_OK on success -*/ -int cfb8_done(symmetric_CFB *cfb) -{ - int err; - LTC_ARGCHK(cfb != NULL); - - if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { - return err; - } - cipher_descriptor[cfb->cipher].done(&cfb->key); - return CRYPT_OK; -} - - - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_done.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cfb8/cfb8_encrypt.c Index: Source/libtomcrypt/src/modes/cfb8/cfb8_encrypt.c ================================================================== --- Source/libtomcrypt/src/modes/cfb8/cfb8_encrypt.c +++ /dev/null @@ -1,63 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb_encrypt.c - CFB implementation, encrypt data, Tom St Denis -*/ - -#ifdef LTC_CFB_MODE - - -/** - CFB8 encrypt - @param pt Plaintext - @param ct [out] Ciphertext - @param len Length of plaintext (octets) - @param cfb CFB state - @return CRYPT_OK if successful -*/ - -int cfb8_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CFB *cfb) -{ - int err; - unsigned char *theIV; - int ivSize; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(cfb != NULL); - - theIV = (unsigned char *) cfb->IV; - ivSize = cfb->blocklen; - - if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) return err; - - if (cfb->blocklen < 0 || cfb->blocklen > ivSize) return CRYPT_INVALID_ARG; - - while (len-- > 0) { - // XOR the plaintext byte *pt with the leftmost byte of the IV buffer giving *ct - *ct = cfb->pad[0] ^ *pt; - // Rotate the IV Buffer left one byte - memmove(theIV, theIV+1, ivSize-1); - // copy *ct into the rightmost byte of the IV buffer - theIV[ivSize - 1] = *ct; - // Encrypt the IV buffer - if ((err = cipher_descriptor[cfb->cipher].ecb_encrypt(cfb->IV, cfb->pad, &cfb->key)) != CRYPT_OK) return err; - // Bump the pointers - ++pt; - ++ct; - } - return CRYPT_OK; -} - -#endif DELETED Source/libtomcrypt/src/modes/cfb8/cfb8_getiv.c Index: Source/libtomcrypt/src/modes/cfb8/cfb8_getiv.c ================================================================== --- Source/libtomcrypt/src/modes/cfb8/cfb8_getiv.c +++ /dev/null @@ -1,46 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb_getiv.c - CFB implementation, get IV, Tom St Denis -*/ - -#ifdef LTC_CFB_MODE - -/** - Get the current initial vector - @param IV [out] The destination of the initial vector - @param len [in/out] The max size and resulting size of the initial vector - @param cfb The CFB state - @return CRYPT_OK if successful -*/ -int cfb8_getiv(unsigned char *IV, unsigned long *len, symmetric_CFB *cfb) -{ - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(len != NULL); - LTC_ARGCHK(cfb != NULL); - if ((unsigned long)cfb->blocklen > *len) { - *len = cfb->blocklen; - return CRYPT_BUFFER_OVERFLOW; - } - XMEMCPY(IV, cfb->IV, cfb->blocklen); - *len = cfb->blocklen; - - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_getiv.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cfb8/cfb8_setiv.c Index: Source/libtomcrypt/src/modes/cfb8/cfb8_setiv.c ================================================================== --- Source/libtomcrypt/src/modes/cfb8/cfb8_setiv.c +++ /dev/null @@ -1,52 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb_setiv.c - CFB implementation, set IV, Tom St Denis -*/ - -#ifdef LTC_CFB_MODE - -/** - Set an initial vector - @param IV The initial vector - @param len The length of the vector (in octets) - @param cfb The CFB state - @return CRYPT_OK if successful -*/ -int cfb8_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb) -{ - int err; - - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(cfb != NULL); - - if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { - return err; - } - - if (len != (unsigned long)cfb->blocklen) { - return CRYPT_INVALID_ARG; - } - - /* force next block */ - cfb->padlen = 0; - return cipher_descriptor[cfb->cipher].ecb_encrypt(IV, cfb->pad, &cfb->key); -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_setiv.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/cfb8/cfb8_start.c Index: Source/libtomcrypt/src/modes/cfb8/cfb8_start.c ================================================================== --- Source/libtomcrypt/src/modes/cfb8/cfb8_start.c +++ /dev/null @@ -1,69 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file cfb8_start.c - CFB implementation, start chain, Tom St Denis -*/ - - -#ifdef LTC_CFB_MODE - -/** - Initialize a CFB8 context - @param cipher The index of the cipher desired - @param IV The initial vector - @param key The secret key - @param keylen The length of the secret key (octets) - @param num_rounds Number of rounds in the cipher desired (0 for default) - @param cfb The CFB state to initialize - @return CRYPT_OK if successful -*/ -#ifdef MACTOMCRYPT -int cfb8_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, int tweaklen, - int num_rounds, int options, symmetric_CFB *cfb) -#else -int cfb8_start(int cipher, const unsigned char *IV, const unsigned char *key, - int keylen, int num_rounds, symmetric_CFB *cfb) -#endif -{ - int x, err; - - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(cfb != NULL); - - if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { - return err; - } - - - /* copy data */ - cfb->cipher = cipher; - cfb->blocklen = cipher_descriptor[cipher].block_length; - for (x = 0; x < cfb->blocklen; x++) - cfb->IV[x] = IV[x]; - - /* init the cipher */ - if ((err = cipher_descriptor[cipher].setup(key, keylen, num_rounds, &cfb->key)) != CRYPT_OK) { - return err; - } - - /* encrypt the IV */ - return cipher_descriptor[cfb->cipher].ecb_encrypt(cfb->IV, cfb->pad, &cfb->key); -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_start.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ctr/ctr_decrypt.c Index: Source/libtomcrypt/src/modes/ctr/ctr_decrypt.c ================================================================== --- Source/libtomcrypt/src/modes/ctr/ctr_decrypt.c +++ /dev/null @@ -1,42 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ctr_decrypt.c - CTR implementation, decrypt data, Tom St Denis -*/ - -#ifdef LTC_CTR_MODE - -/** - CTR decrypt - @param ct Ciphertext - @param pt [out] Plaintext - @param len Length of ciphertext (octets) - @param ctr CTR state - @return CRYPT_OK if successful -*/ -int ctr_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CTR *ctr) -{ - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(ctr != NULL); - - return ctr_encrypt(ct, pt, len, ctr); -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_decrypt.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ctr/ctr_descriptor.c Index: Source/libtomcrypt/src/modes/ctr/ctr_descriptor.c ================================================================== --- Source/libtomcrypt/src/modes/ctr/ctr_descriptor.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/* - * ctr_descriptor.c - * MacTomCrypt - */ - -#include "tomcrypt.h" -#if defined(LTC_CTR_MODE) && defined(MACTOMCRYPT) - -const struct ltc_mode_descriptor modeCTR_desc = -{ - "CTR", - 4, /* Must match kCCModeCTR = 4 */ - 1, - sizeof(symmetric_CTR), - &ctr_start, - &ctr_encrypt, - &ctr_decrypt, - &unimp_mode_encrypt_tweaked, - &unimp_mode_decrypt_tweaked, - &ctr_done, - &ctr_setiv, - &ctr_getiv, -}; -#endif /* LTC_CTR_MODE */ DELETED Source/libtomcrypt/src/modes/ctr/ctr_done.c Index: Source/libtomcrypt/src/modes/ctr/ctr_done.c ================================================================== --- Source/libtomcrypt/src/modes/ctr/ctr_done.c +++ /dev/null @@ -1,42 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ctr_done.c - CTR implementation, finish chain, Tom St Denis -*/ - -#ifdef LTC_CTR_MODE - -/** Terminate the chain - @param ctr The CTR chain to terminate - @return CRYPT_OK on success -*/ -int ctr_done(symmetric_CTR *ctr) -{ - int err; - LTC_ARGCHK(ctr != NULL); - - if ((err = cipher_is_valid(ctr->cipher)) != CRYPT_OK) { - return err; - } - cipher_descriptor[ctr->cipher].done(&ctr->key); - return CRYPT_OK; -} - - - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_done.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ctr/ctr_encrypt.c Index: Source/libtomcrypt/src/modes/ctr/ctr_encrypt.c ================================================================== --- Source/libtomcrypt/src/modes/ctr/ctr_encrypt.c +++ /dev/null @@ -1,112 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ctr_encrypt.c - CTR implementation, encrypt data, Tom St Denis -*/ - - -#ifdef LTC_CTR_MODE - -/** - CTR encrypt - @param pt Plaintext - @param ct [out] Ciphertext - @param len Length of plaintext (octets) - @param ctr CTR state - @return CRYPT_OK if successful -*/ -int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CTR *ctr) -{ - int x, err; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(ctr != NULL); - - if ((err = cipher_is_valid(ctr->cipher)) != CRYPT_OK) { - return err; - } - - /* is blocklen/padlen valid? */ - if (ctr->blocklen < 1 || ctr->blocklen > (int)sizeof(ctr->ctr) || - ctr->padlen < 0 || ctr->padlen > (int)sizeof(ctr->pad)) { - return CRYPT_INVALID_ARG; - } - -#ifdef LTC_FAST - if (ctr->blocklen % sizeof(LTC_FAST_TYPE)) { - return CRYPT_INVALID_ARG; - } -#endif - - /* handle acceleration only if pad is empty, accelerator is present and length is >= a block size */ - if ((ctr->padlen == ctr->blocklen) && cipher_descriptor[ctr->cipher].accel_ctr_encrypt != NULL && (len >= (unsigned long)ctr->blocklen)) { - if ((err = cipher_descriptor[ctr->cipher].accel_ctr_encrypt(pt, ct, len/ctr->blocklen, ctr->ctr, ctr->mode, &ctr->key)) != CRYPT_OK) { - return err; - } - len %= ctr->blocklen; - } - - while (len) { - /* is the pad empty? */ - if (ctr->padlen == ctr->blocklen) { - /* increment counter */ - if (ctr->mode == CTR_COUNTER_LITTLE_ENDIAN) { - /* little-endian */ - for (x = 0; x < ctr->ctrlen; x++) { - ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255; - if (ctr->ctr[x] != (unsigned char)0) { - break; - } - } - } else { - /* big-endian */ - for (x = ctr->blocklen-1; x >= ctr->ctrlen; x--) { - ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255; - if (ctr->ctr[x] != (unsigned char)0) { - break; - } - } - } - - /* encrypt it */ - if ((err = cipher_descriptor[ctr->cipher].ecb_encrypt(ctr->ctr, ctr->pad, &ctr->key)) != CRYPT_OK) { - return err; - } - ctr->padlen = 0; - } -#ifdef LTC_FAST - if (ctr->padlen == 0 && len >= (unsigned long)ctr->blocklen) { - for (x = 0; x < ctr->blocklen; x += sizeof(LTC_FAST_TYPE)) { - *((LTC_FAST_TYPE*)((unsigned char *)ct + x)) = *((LTC_FAST_TYPE*)((unsigned char *)pt + x)) ^ - *((LTC_FAST_TYPE*)((unsigned char *)ctr->pad + x)); - } - pt += ctr->blocklen; - ct += ctr->blocklen; - len -= ctr->blocklen; - ctr->padlen = ctr->blocklen; - continue; - } -#endif - *ct++ = *pt++ ^ ctr->pad[ctr->padlen++]; - --len; - } - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_encrypt.c,v $ */ -/* $Revision: 1.22 $ */ -/* $Date: 2007/02/22 20:26:05 $ */ DELETED Source/libtomcrypt/src/modes/ctr/ctr_getiv.c Index: Source/libtomcrypt/src/modes/ctr/ctr_getiv.c ================================================================== --- Source/libtomcrypt/src/modes/ctr/ctr_getiv.c +++ /dev/null @@ -1,46 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ctr_getiv.c - CTR implementation, get IV, Tom St Denis -*/ - -#ifdef LTC_CTR_MODE - -/** - Get the current initial vector - @param IV [out] The destination of the initial vector - @param len [in/out] The max size and resulting size of the initial vector - @param ctr The CTR state - @return CRYPT_OK if successful -*/ -int ctr_getiv(unsigned char *IV, unsigned long *len, symmetric_CTR *ctr) -{ - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(len != NULL); - LTC_ARGCHK(ctr != NULL); - if ((unsigned long)ctr->blocklen > *len) { - *len = ctr->blocklen; - return CRYPT_BUFFER_OVERFLOW; - } - XMEMCPY(IV, ctr->ctr, ctr->blocklen); - *len = ctr->blocklen; - - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_getiv.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ctr/ctr_setiv.c Index: Source/libtomcrypt/src/modes/ctr/ctr_setiv.c ================================================================== --- Source/libtomcrypt/src/modes/ctr/ctr_setiv.c +++ /dev/null @@ -1,56 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ctr_setiv.c - CTR implementation, set IV, Tom St Denis -*/ - -#ifdef LTC_CTR_MODE - -/** - Set an initial vector - @param IV The initial vector - @param len The length of the vector (in octets) - @param ctr The CTR state - @return CRYPT_OK if successful -*/ -int ctr_setiv(const unsigned char *IV, unsigned long len, symmetric_CTR *ctr) -{ - int err; - - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(ctr != NULL); - - /* bad param? */ - if ((err = cipher_is_valid(ctr->cipher)) != CRYPT_OK) { - return err; - } - - if (len != (unsigned long)ctr->blocklen) { - return CRYPT_INVALID_ARG; - } - - /* set IV */ - XMEMCPY(ctr->ctr, IV, len); - - /* force next block */ - ctr->padlen = 0; - return cipher_descriptor[ctr->cipher].ecb_encrypt(IV, ctr->pad, &ctr->key); -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_setiv.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ctr/ctr_start.c Index: Source/libtomcrypt/src/modes/ctr/ctr_start.c ================================================================== --- Source/libtomcrypt/src/modes/ctr/ctr_start.c +++ /dev/null @@ -1,103 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ctr_start.c - CTR implementation, start chain, Tom St Denis -*/ - - -#ifdef LTC_CTR_MODE - -/** - Initialize a CTR context - @param cipher The index of the cipher desired - @param IV The initial vector - @param key The secret key - @param keylen The length of the secret key (octets) - @param num_rounds Number of rounds in the cipher desired (0 for default) - @param ctr_mode The counter mode (CTR_COUNTER_LITTLE_ENDIAN or CTR_COUNTER_BIG_ENDIAN) - @param ctr The CTR state to initialize - @return CRYPT_OK if successful -*/ -#ifdef MACTOMCRYPT -int ctr_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, int tweaklen, - int num_rounds, int ctr_mode, symmetric_CTR *ctr) -#else -int ctr_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, - int num_rounds, int ctr_mode, symmetric_CTR *ctr) -#endif -{ - int x, err; - - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(ctr != NULL); - - /* bad param? */ - if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { - return err; - } - - /* ctrlen == counter width */ - ctr->ctrlen = (ctr_mode & 255) ? (ctr_mode & 255) : cipher_descriptor[cipher].block_length; - if (ctr->ctrlen > cipher_descriptor[cipher].block_length) { - return CRYPT_INVALID_ARG; - } - - if ((ctr_mode & 0x1000) == CTR_COUNTER_BIG_ENDIAN) { - ctr->ctrlen = cipher_descriptor[cipher].block_length - ctr->ctrlen; - } - - /* setup cipher */ - if ((err = cipher_descriptor[cipher].setup(key, keylen, num_rounds, &ctr->key)) != CRYPT_OK) { - return err; - } - - /* copy ctr */ - ctr->blocklen = cipher_descriptor[cipher].block_length; - ctr->cipher = cipher; - ctr->padlen = 0; - ctr->mode = ctr_mode & 0x1000; - for (x = 0; x < ctr->blocklen; x++) { - ctr->ctr[x] = IV[x]; - } - - if (ctr_mode & LTC_CTR_RFC3686) { - /* increment the IV as per RFC 3686 */ - if (ctr->mode == CTR_COUNTER_LITTLE_ENDIAN) { - /* little-endian */ - for (x = 0; x < ctr->ctrlen; x++) { - ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255; - if (ctr->ctr[x] != (unsigned char)0) { - break; - } - } - } else { - /* big-endian */ - for (x = ctr->blocklen-1; x >= ctr->ctrlen; x--) { - ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255; - if (ctr->ctr[x] != (unsigned char)0) { - break; - } - } - } - } - - return cipher_descriptor[ctr->cipher].ecb_encrypt(ctr->ctr, ctr->pad, &ctr->key); -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_start.c,v $ */ -/* $Revision: 1.15 $ */ -/* $Date: 2007/02/23 14:18:37 $ */ DELETED Source/libtomcrypt/src/modes/ctr/ctr_test.c Index: Source/libtomcrypt/src/modes/ctr/ctr_test.c ================================================================== --- Source/libtomcrypt/src/modes/ctr/ctr_test.c +++ /dev/null @@ -1,90 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ctr_test.c - CTR implementation, Tests again RFC 3686, Tom St Denis -*/ - -#ifdef LTC_CTR_MODE - -int ctr_test(void) -{ -#ifdef LTC_NO_TEST - return CRYPT_NOP; -#else - static const struct { - int keylen, msglen; - unsigned char key[32], IV[16], pt[64], ct[64]; - } tests[] = { -/* 128-bit key, 16-byte pt */ -{ - 16, 16, - {0xAE,0x68,0x52,0xF8,0x12,0x10,0x67,0xCC,0x4B,0xF7,0xA5,0x76,0x55,0x77,0xF3,0x9E }, - {0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, - {0x53,0x69,0x6E,0x67,0x6C,0x65,0x20,0x62,0x6C,0x6F,0x63,0x6B,0x20,0x6D,0x73,0x67 }, - {0xE4,0x09,0x5D,0x4F,0xB7,0xA7,0xB3,0x79,0x2D,0x61,0x75,0xA3,0x26,0x13,0x11,0xB8 }, -}, - -/* 128-bit key, 36-byte pt */ -{ - 16, 36, - {0x76,0x91,0xBE,0x03,0x5E,0x50,0x20,0xA8,0xAC,0x6E,0x61,0x85,0x29,0xF9,0xA0,0xDC }, - {0x00,0xE0,0x01,0x7B,0x27,0x77,0x7F,0x3F,0x4A,0x17,0x86,0xF0,0x00,0x00,0x00,0x00 }, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, - 0x20,0x21,0x22,0x23}, - {0xC1,0xCF,0x48,0xA8,0x9F,0x2F,0xFD,0xD9,0xCF,0x46,0x52,0xE9,0xEF,0xDB,0x72,0xD7, - 0x45,0x40,0xA4,0x2B,0xDE,0x6D,0x78,0x36,0xD5,0x9A,0x5C,0xEA,0xAE,0xF3,0x10,0x53, - 0x25,0xB2,0x07,0x2F }, -}, -}; - int idx, err, x; - unsigned char buf[64]; - symmetric_CTR ctr; - - /* AES can be under rijndael or aes... try to find it */ - if ((idx = find_cipher("aes")) == -1) { - if ((idx = find_cipher("rijndael")) == -1) { - return CRYPT_NOP; - } - } - - for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { -#ifdef MACTOMCRYPT - if ((err = ctr_start(idx, tests[x].IV, tests[x].key, tests[x].keylen, - NULL, 0, 0, CTR_COUNTER_BIG_ENDIAN|LTC_CTR_RFC3686, &ctr)) != CRYPT_OK) { -#else - if ((err = ctr_start(idx, tests[x].IV, tests[x].key, tests[x].keylen, 0, CTR_COUNTER_BIG_ENDIAN|LTC_CTR_RFC3686, &ctr)) != CRYPT_OK) { -#endif - return err; - } - if ((err = ctr_encrypt(tests[x].pt, buf, tests[x].msglen, &ctr)) != CRYPT_OK) { - return err; - } - ctr_done(&ctr); - if (XMEMCMP(buf, tests[x].ct, tests[x].msglen)) { - return CRYPT_FAIL_TESTVECTOR; - } - } - return CRYPT_OK; -#endif -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_test.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ - - - DELETED Source/libtomcrypt/src/modes/ecb/ecb_decrypt.c Index: Source/libtomcrypt/src/modes/ecb/ecb_decrypt.c ================================================================== --- Source/libtomcrypt/src/modes/ecb/ecb_decrypt.c +++ /dev/null @@ -1,61 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ecb_decrypt.c - ECB implementation, decrypt a block, Tom St Denis -*/ - -#ifdef LTC_ECB_MODE - -/** - ECB decrypt - @param ct Ciphertext - @param pt [out] Plaintext - @param len The number of octets to process (must be multiple of the cipher block size) - @param ecb ECB state - @return CRYPT_OK if successful -*/ -int ecb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_ECB *ecb) -{ - int err; - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(ecb != NULL); - if ((err = cipher_is_valid(ecb->cipher)) != CRYPT_OK) { - return err; - } - if (len % cipher_descriptor[ecb->cipher].block_length) { - return CRYPT_INVALID_ARG; - } - - /* check for accel */ - if (cipher_descriptor[ecb->cipher].accel_ecb_decrypt != NULL) { - return cipher_descriptor[ecb->cipher].accel_ecb_decrypt(ct, pt, len / cipher_descriptor[ecb->cipher].block_length, &ecb->key); - } else { - while (len) { - if ((err = cipher_descriptor[ecb->cipher].ecb_decrypt(ct, pt, &ecb->key)) != CRYPT_OK) { - return err; - } - pt += cipher_descriptor[ecb->cipher].block_length; - ct += cipher_descriptor[ecb->cipher].block_length; - len -= cipher_descriptor[ecb->cipher].block_length; - } - } - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ecb/ecb_decrypt.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ecb/ecb_descriptor.c Index: Source/libtomcrypt/src/modes/ecb/ecb_descriptor.c ================================================================== --- Source/libtomcrypt/src/modes/ecb/ecb_descriptor.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/* - * ecb_descriptor.c - * MacTomCrypt - */ - -#include "tomcrypt.h" -#if defined(LTC_ECB_MODE) && defined(MACTOMCRYPT) - -const struct ltc_mode_descriptor modeECB_desc = -{ - "ECB", - 1, /* Must match kCCModeECB = 1 */ - 1, - sizeof(symmetric_ECB), - &ecb_start, - &ecb_encrypt, - &ecb_decrypt, - &unimp_mode_encrypt_tweaked, - &unimp_mode_decrypt_tweaked, - &ecb_done, - &unimp_mode_setiv, - &unimp_mode_getiv, -}; -#endif /* LTC_ECB_MODE */ DELETED Source/libtomcrypt/src/modes/ecb/ecb_done.c Index: Source/libtomcrypt/src/modes/ecb/ecb_done.c ================================================================== --- Source/libtomcrypt/src/modes/ecb/ecb_done.c +++ /dev/null @@ -1,42 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ecb_done.c - ECB implementation, finish chain, Tom St Denis -*/ - -#ifdef LTC_ECB_MODE - -/** Terminate the chain - @param ecb The ECB chain to terminate - @return CRYPT_OK on success -*/ -int ecb_done(symmetric_ECB *ecb) -{ - int err; - LTC_ARGCHK(ecb != NULL); - - if ((err = cipher_is_valid(ecb->cipher)) != CRYPT_OK) { - return err; - } - cipher_descriptor[ecb->cipher].done(&ecb->key); - return CRYPT_OK; -} - - - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ecb/ecb_done.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ecb/ecb_encrypt.c Index: Source/libtomcrypt/src/modes/ecb/ecb_encrypt.c ================================================================== --- Source/libtomcrypt/src/modes/ecb/ecb_encrypt.c +++ /dev/null @@ -1,61 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ecb_encrypt.c - ECB implementation, encrypt a block, Tom St Denis -*/ - -#ifdef LTC_ECB_MODE - -/** - ECB encrypt - @param pt Plaintext - @param ct [out] Ciphertext - @param len The number of octets to process (must be multiple of the cipher block size) - @param ecb ECB state - @return CRYPT_OK if successful -*/ -int ecb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_ECB *ecb) -{ - int err; - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(ecb != NULL); - if ((err = cipher_is_valid(ecb->cipher)) != CRYPT_OK) { - return err; - } - if (len % cipher_descriptor[ecb->cipher].block_length) { - return CRYPT_INVALID_ARG; - } - - /* check for accel */ - if (cipher_descriptor[ecb->cipher].accel_ecb_encrypt != NULL) { - return cipher_descriptor[ecb->cipher].accel_ecb_encrypt(pt, ct, len / cipher_descriptor[ecb->cipher].block_length, &ecb->key); - } else { - while (len) { - if ((err = cipher_descriptor[ecb->cipher].ecb_encrypt(pt, ct, &ecb->key)) != CRYPT_OK) { - return err; - } - pt += cipher_descriptor[ecb->cipher].block_length; - ct += cipher_descriptor[ecb->cipher].block_length; - len -= cipher_descriptor[ecb->cipher].block_length; - } - } - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ecb/ecb_encrypt.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ecb/ecb_start.c Index: Source/libtomcrypt/src/modes/ecb/ecb_start.c ================================================================== --- Source/libtomcrypt/src/modes/ecb/ecb_start.c +++ /dev/null @@ -1,53 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ecb_start.c - ECB implementation, start chain, Tom St Denis -*/ - - -#ifdef LTC_ECB_MODE - -/** - Initialize a ECB context - @param cipher The index of the cipher desired - @param key The secret key - @param keylen The length of the secret key (octets) - @param num_rounds Number of rounds in the cipher desired (0 for default) - @param ecb The ECB state to initialize - @return CRYPT_OK if successful -*/ -#ifdef MACTOMCRYPT -int ecb_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, int tweaklen, - int num_rounds, int options, symmetric_ECB *ecb) -#else -int ecb_start(int cipher, const unsigned char *key, int keylen, int num_rounds, symmetric_ECB *ecb) -#endif -{ - int err; - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(ecb != NULL); - - if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { - return err; - } - ecb->cipher = cipher; - ecb->blocklen = cipher_descriptor[cipher].block_length; - return cipher_descriptor[cipher].setup(key, keylen, num_rounds, &ecb->key); -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ecb/ecb_start.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ofb/ofb_decrypt.c Index: Source/libtomcrypt/src/modes/ofb/ofb_decrypt.c ================================================================== --- Source/libtomcrypt/src/modes/ofb/ofb_decrypt.c +++ /dev/null @@ -1,43 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ofb_decrypt.c - OFB implementation, decrypt data, Tom St Denis -*/ - -#ifdef LTC_OFB_MODE - -/** - OFB decrypt - @param ct Ciphertext - @param pt [out] Plaintext - @param len Length of ciphertext (octets) - @param ofb OFB state - @return CRYPT_OK if successful -*/ -int ofb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_OFB *ofb) -{ - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(ofb != NULL); - return ofb_encrypt(ct, pt, len, ofb); -} - - -#endif - - - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_decrypt.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ofb/ofb_descriptor.c Index: Source/libtomcrypt/src/modes/ofb/ofb_descriptor.c ================================================================== --- Source/libtomcrypt/src/modes/ofb/ofb_descriptor.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * ofb_descriptor.c - * MacTomCrypt - */ - -#include "tomcrypt.h" -#if defined(LTC_OFB_MODE) && defined(MACTOMCRYPT) - -const struct ltc_mode_descriptor modeOFB_desc = -{ - "OFB", - 7, /* Must match kCCModeOFB = 7 */ - 1, - sizeof(symmetric_OFB), - &ofb_start, - &ofb_encrypt, - &ofb_decrypt, - &unimp_mode_encrypt_tweaked, - &unimp_mode_decrypt_tweaked, - &ofb_done, - &ofb_setiv, - &ofb_getiv, -}; -#endif /* LTC_OFB_MODE */ DELETED Source/libtomcrypt/src/modes/ofb/ofb_done.c Index: Source/libtomcrypt/src/modes/ofb/ofb_done.c ================================================================== --- Source/libtomcrypt/src/modes/ofb/ofb_done.c +++ /dev/null @@ -1,42 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ofb_done.c - OFB implementation, finish chain, Tom St Denis -*/ - -#ifdef LTC_OFB_MODE - -/** Terminate the chain - @param ofb The OFB chain to terminate - @return CRYPT_OK on success -*/ -int ofb_done(symmetric_OFB *ofb) -{ - int err; - LTC_ARGCHK(ofb != NULL); - - if ((err = cipher_is_valid(ofb->cipher)) != CRYPT_OK) { - return err; - } - cipher_descriptor[ofb->cipher].done(&ofb->key); - return CRYPT_OK; -} - - - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_done.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ofb/ofb_encrypt.c Index: Source/libtomcrypt/src/modes/ofb/ofb_encrypt.c ================================================================== --- Source/libtomcrypt/src/modes/ofb/ofb_encrypt.c +++ /dev/null @@ -1,60 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ofb_encrypt.c - OFB implementation, encrypt data, Tom St Denis -*/ - -#ifdef LTC_OFB_MODE - -/** - OFB encrypt - @param pt Plaintext - @param ct [out] Ciphertext - @param len Length of plaintext (octets) - @param ofb OFB state - @return CRYPT_OK if successful -*/ -int ofb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_OFB *ofb) -{ - int err; - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(ofb != NULL); - if ((err = cipher_is_valid(ofb->cipher)) != CRYPT_OK) { - return err; - } - - /* is blocklen/padlen valid? */ - if (ofb->blocklen < 0 || ofb->blocklen > (int)sizeof(ofb->IV) || - ofb->padlen < 0 || ofb->padlen > (int)sizeof(ofb->IV)) { - return CRYPT_INVALID_ARG; - } - - while (len-- > 0) { - if (ofb->padlen == ofb->blocklen) { - if ((err = cipher_descriptor[ofb->cipher].ecb_encrypt(ofb->IV, ofb->IV, &ofb->key)) != CRYPT_OK) { - return err; - } - ofb->padlen = 0; - } - *ct++ = *pt++ ^ ofb->IV[(ofb->padlen)++]; - } - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_encrypt.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ofb/ofb_getiv.c Index: Source/libtomcrypt/src/modes/ofb/ofb_getiv.c ================================================================== --- Source/libtomcrypt/src/modes/ofb/ofb_getiv.c +++ /dev/null @@ -1,46 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ofb_getiv.c - OFB implementation, get IV, Tom St Denis -*/ - -#ifdef LTC_OFB_MODE - -/** - Get the current initial vector - @param IV [out] The destination of the initial vector - @param len [in/out] The max size and resulting size of the initial vector - @param ofb The OFB state - @return CRYPT_OK if successful -*/ -int ofb_getiv(unsigned char *IV, unsigned long *len, symmetric_OFB *ofb) -{ - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(len != NULL); - LTC_ARGCHK(ofb != NULL); - if ((unsigned long)ofb->blocklen > *len) { - *len = ofb->blocklen; - return CRYPT_BUFFER_OVERFLOW; - } - XMEMCPY(IV, ofb->IV, ofb->blocklen); - *len = ofb->blocklen; - - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_getiv.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ofb/ofb_setiv.c Index: Source/libtomcrypt/src/modes/ofb/ofb_setiv.c ================================================================== --- Source/libtomcrypt/src/modes/ofb/ofb_setiv.c +++ /dev/null @@ -1,52 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ofb_setiv.c - OFB implementation, set IV, Tom St Denis -*/ - -#ifdef LTC_OFB_MODE - -/** - Set an initial vector - @param IV The initial vector - @param len The length of the vector (in octets) - @param ofb The OFB state - @return CRYPT_OK if successful -*/ -int ofb_setiv(const unsigned char *IV, unsigned long len, symmetric_OFB *ofb) -{ - int err; - - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(ofb != NULL); - - if ((err = cipher_is_valid(ofb->cipher)) != CRYPT_OK) { - return err; - } - - if (len != (unsigned long)ofb->blocklen) { - return CRYPT_INVALID_ARG; - } - - /* force next block */ - ofb->padlen = 0; - return cipher_descriptor[ofb->cipher].ecb_encrypt(IV, ofb->IV, &ofb->key); -} - -#endif - - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_setiv.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/ofb/ofb_start.c Index: Source/libtomcrypt/src/modes/ofb/ofb_start.c ================================================================== --- Source/libtomcrypt/src/modes/ofb/ofb_start.c +++ /dev/null @@ -1,65 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - @file ofb_start.c - OFB implementation, start chain, Tom St Denis -*/ - - -#ifdef LTC_OFB_MODE - -/** - Initialize a OFB context - @param cipher The index of the cipher desired - @param IV The initial vector - @param key The secret key - @param keylen The length of the secret key (octets) - @param num_rounds Number of rounds in the cipher desired (0 for default) - @param ofb The OFB state to initialize - @return CRYPT_OK if successful -*/ -#ifdef MACTOMCRYPT -int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, - const unsigned char *tweak, int tweaklen, int num_rounds, int options, symmetric_OFB *ofb) -#else -int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key, - int keylen, int num_rounds, symmetric_OFB *ofb) -#endif -{ - int x, err; - - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(ofb != NULL); - - if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { - return err; - } - - /* copy details */ - ofb->cipher = cipher; - ofb->blocklen = cipher_descriptor[cipher].block_length; - for (x = 0; x < ofb->blocklen; x++) { - ofb->IV[x] = IV[x]; - } - - /* init the cipher */ - ofb->padlen = ofb->blocklen; - return cipher_descriptor[cipher].setup(key, keylen, num_rounds, &ofb->key); -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_start.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/28 01:27:24 $ */ DELETED Source/libtomcrypt/src/modes/rc4_stream.c Index: Source/libtomcrypt/src/modes/rc4_stream.c ================================================================== --- Source/libtomcrypt/src/modes/rc4_stream.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#include "tomcrypt.h" -#include "ccdebug.h" -// Wrench RC4 into a common interface. - -const struct ltc_mode_descriptor modeRC4_desc = -{ - "RC4", - 10, - 1, - sizeof(RC4_KEY), - &rc4_stream_setup, - &rc4_stream_encrypt, - &rc4_stream_decrypt, - &unimp_mode_encrypt_tweaked, - &unimp_mode_decrypt_tweaked, - &rc4_stream_done, - &unimp_mode_setiv, - &unimp_mode_getiv, -}; - - -int rc4_stream_setup(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, -const unsigned char *tweak, int tweaklen, int num_rounds, int options, RC4_KEY *ctx) { - CC_RC4_set_key(ctx, keylen, key); - return CRYPT_OK; -} - -int rc4_stream_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, mode_context *ctx) { - ccdebug(ASL_LEVEL_ERR, " RC4 Processing %d bytes\n" , len); - CC_RC4(ctx, len, pt, ct); - return CRYPT_OK; -} - -int rc4_stream_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, mode_context *ctx) { - ccdebug(ASL_LEVEL_ERR, " RC4 Processing %d bytes\n" , len); - CC_RC4(ctx, len, ct, pt); - return CRYPT_OK; -} - -int rc4_stream_done(mode_context *ctx) { - memset(ctx, 0, sizeof(RC4_KEY)); - return CRYPT_OK; -} DELETED Source/libtomcrypt/src/modes/unimplemented.c Index: Source/libtomcrypt/src/modes/unimplemented.c ================================================================== --- Source/libtomcrypt/src/modes/unimplemented.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#include "tomcrypt.h" - -// Filler routines for unimplemented mode methods. - -const struct ltc_mode_descriptor modeUNIMP_desc = -{ - NULL, - 0, - 0, - 0, - unimp_mode_setup, - unimp_mode_encrypt, - unimp_mode_decrypt, - unimp_mode_encrypt_tweaked, - unimp_mode_decrypt_tweaked, - unimp_mode_done, - unimp_mode_setiv, - unimp_mode_getiv, -}; - - -int unimp_mode_setup(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, -const unsigned char *tweak, int tweaklen, int num_rounds, int options, mode_context *ctx) { return CRYPT_UNIMPLEMENTED; } - -int unimp_mode_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, mode_context *ctx) { return CRYPT_UNIMPLEMENTED; } - -int unimp_mode_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, mode_context *ctx) { return CRYPT_UNIMPLEMENTED; } - -int unimp_mode_encrypt_tweaked(const unsigned char *pt, unsigned long len, unsigned char *ct, const unsigned char *tweak, mode_context *ctx) { return CRYPT_UNIMPLEMENTED; } - -int unimp_mode_decrypt_tweaked(const unsigned char *ct, unsigned long len, unsigned char *pt, const unsigned char *tweak, mode_context *ctx) { return CRYPT_UNIMPLEMENTED; } - -int unimp_mode_done(mode_context *ctx) { return CRYPT_UNIMPLEMENTED; } - -int unimp_mode_setiv(const unsigned char *IV, unsigned long len, mode_context *ctx) { return CRYPT_UNIMPLEMENTED; } - -int unimp_mode_getiv(const unsigned char *IV, unsigned long *len, mode_context *ctx) { return CRYPT_UNIMPLEMENTED; } - DELETED Source/libtomcrypt/src/modes/xts/xts_decrypt.c Index: Source/libtomcrypt/src/modes/xts/xts_decrypt.c ================================================================== --- Source/libtomcrypt/src/modes/xts/xts_decrypt.c +++ /dev/null @@ -1,144 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects - */ - -#ifdef LTC_XTS_MODE - -static int tweak_uncrypt(const unsigned char *C, unsigned char *P, unsigned char *T, symmetric_xts *xts) -{ - unsigned long x; - int err; - - /* tweak encrypt block i */ -#ifdef LTC_FAST - for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) { - *((LTC_FAST_TYPE*)&P[x]) = *((LTC_FAST_TYPE*)&C[x]) ^ *((LTC_FAST_TYPE*)&T[x]); - } -#else - for (x = 0; x < 16; x++) { - P[x] = C[x] ^ T[x]; - } -#endif - - err = cipher_descriptor[xts->cipher].ecb_decrypt(P, P, &xts->key1); - -#ifdef LTC_FAST - for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) { - *((LTC_FAST_TYPE*)&P[x]) ^= *((LTC_FAST_TYPE*)&T[x]); - } -#else - for (x = 0; x < 16; x++) { - P[x] = P[x] ^ T[x]; - } -#endif - - /* LFSR the tweak */ - xts_mult_x(T); - - return err; -} - -/** XTS Decryption - @param ct [in] Ciphertext - @param ptlen Length of plaintext (and ciphertext) - @param pt [out] Plaintext - @param tweak [in] The 128--bit encryption tweak (e.g. sector number) - @param xts The XTS structure - Returns CRYPT_OK upon success - */int xts_decrypt( - const unsigned char *ct, unsigned long ptlen, - unsigned char *pt, - const unsigned char *tweak, - symmetric_xts *xts) -{ - unsigned char PP[16], CC[16], T[16]; - unsigned long i, m, mo, lim; - int err; - - /* check inputs */ - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(tweak != NULL); - LTC_ARGCHK(xts != NULL); - - /* check if valid */ - if ((err = cipher_is_valid(xts->cipher)) != CRYPT_OK) { - return err; - } - - // if the cipher has an accelerated logical block decryptor, call it. - if(cipher_descriptor[xts->cipher].accel_xts_decrypt) return cipher_descriptor[xts->cipher].accel_xts_decrypt(ct, ptlen, pt, tweak, xts); - - /* get number of blocks */ - m = ptlen >> 4; - mo = ptlen & 15; - - /* must have at least one full block */ - if (m == 0) { - return CRYPT_INVALID_ARG; - } - - /* encrypt the tweak */ - if ((err = cipher_descriptor[xts->cipher].ecb_encrypt(tweak, T, &xts->key2)) != CRYPT_OK) { - return err; - } - - /* for i = 0 to m-2 do */ - if (mo == 0) { - lim = m; - } else { - lim = m - 1; - } - - for (i = 0; i < lim; i++) { - err = tweak_uncrypt(ct, pt, T, xts); - ct += 16; - pt += 16; - } - - /* if ptlen not divide 16 then */ - if (mo > 0) { - XMEMCPY(CC, T, 16); - xts_mult_x(CC); - - /* PP = tweak decrypt block m-1 */ - if ((err = tweak_uncrypt(ct, PP, CC, xts)) != CRYPT_OK) { - return err; - } - - /* Pm = first ptlen % 16 bytes of PP */ - for (i = 0; i < mo; i++) { - CC[i] = ct[16+i]; - pt[16+i] = PP[i]; - } - for (; i < 16; i++) { - CC[i] = PP[i]; - } - - /* Pm-1 = Tweak uncrypt CC */ - if ((err = tweak_uncrypt(CC, pt, T, xts)) != CRYPT_OK) { - return err; - } - } - - return CRYPT_OK; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/xts/xts_decrypt.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2007/05/12 14:05:56 $ */ - DELETED Source/libtomcrypt/src/modes/xts/xts_descriptor.c Index: Source/libtomcrypt/src/modes/xts/xts_descriptor.c ================================================================== --- Source/libtomcrypt/src/modes/xts/xts_descriptor.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * xts_descriptor.c - * MacTomCrypt - */ - -#include "tomcrypt.h" -#if defined(LTC_XTS_MODE) && defined(MACTOMCRYPT) - -const struct ltc_mode_descriptor modeXTS_desc = -{ - "XTS", - 8, /* Must match kCCModeXTS = 8 */ - 1, - sizeof(symmetric_xts), - &xts_start, - &unimp_mode_encrypt, - &unimp_mode_decrypt, - &xts_encrypt, - &xts_decrypt, - &xts_done, - &unimp_mode_setiv, - &unimp_mode_getiv, -}; - -#endif /* LTC_XTS_MODE */ DELETED Source/libtomcrypt/src/modes/xts/xts_done.c Index: Source/libtomcrypt/src/modes/xts/xts_done.c ================================================================== --- Source/libtomcrypt/src/modes/xts/xts_done.c +++ /dev/null @@ -1,34 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects -*/ - -#ifdef LTC_XTS_MODE - -/** Terminate XTS state - @param XTS The state to terminate -*/ -void xts_done(symmetric_xts *xts) -{ - LTC_ARGCHKVD(xts != NULL); - cipher_descriptor[xts->cipher].done(&xts->key1); - cipher_descriptor[xts->cipher].done(&xts->key2); -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/xts/xts_done.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2007/03/10 23:59:09 $ */ - DELETED Source/libtomcrypt/src/modes/xts/xts_encrypt.c Index: Source/libtomcrypt/src/modes/xts/xts_encrypt.c ================================================================== --- Source/libtomcrypt/src/modes/xts/xts_encrypt.c +++ /dev/null @@ -1,145 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects - */ - -#ifdef LTC_XTS_MODE - -static int tweak_crypt(const unsigned char *P, unsigned char *C, unsigned char *T, symmetric_xts *xts) -{ - unsigned long x; - int err; - - /* tweak encrypt block i */ -#ifdef LTC_FAST - for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) { - *((LTC_FAST_TYPE*)&C[x]) = *((LTC_FAST_TYPE*)&P[x]) ^ *((LTC_FAST_TYPE*)&T[x]); - } -#else - for (x = 0; x < 16; x++) { - C[x] = P[x] ^ T[x]; - } -#endif - - if ((err = cipher_descriptor[xts->cipher].ecb_encrypt(C, C, &xts->key1)) != CRYPT_OK) { - return err; - } - -#ifdef LTC_FAST - for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) { - *((LTC_FAST_TYPE*)&C[x]) ^= *((LTC_FAST_TYPE*)&T[x]); - } -#else - for (x = 0; x < 16; x++) { - C[x] = C[x] ^ T[x]; - } -#endif - - /* LFSR the tweak */ - xts_mult_x(T); - - return CRYPT_OK; -} - -/** XTS Encryption - @param pt [in] Plaintext - @param ptlen Length of plaintext (and ciphertext) - @param ct [out] Ciphertext - @param tweak [in] The 128--bit encryption tweak (e.g. sector number) - @param xts The XTS structure - Returns CRYPT_OK upon success - */ -int xts_encrypt( - const unsigned char *pt, unsigned long ptlen, - unsigned char *ct, - const unsigned char *tweak, - symmetric_xts *xts) -{ - unsigned char PP[16], CC[16], T[16]; - unsigned long i, m, mo, lim; - int err; - - /* check inputs */ - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(tweak != NULL); - LTC_ARGCHK(xts != NULL); - - /* check if valid */ - if ((err = cipher_is_valid(xts->cipher)) != CRYPT_OK) { - return err; - } - - // if the cipher has an accelerated logical block encryptor, call it. - if(cipher_descriptor[xts->cipher].accel_xts_encrypt) return cipher_descriptor[xts->cipher].accel_xts_encrypt(pt, ptlen, ct, tweak, xts); - - /* get number of blocks */ - m = ptlen >> 4; - mo = ptlen & 15; - - /* must have at least one full block */ - if (m == 0) { - return CRYPT_INVALID_ARG; - } - - /* encrypt the tweak */ - if ((err = cipher_descriptor[xts->cipher].ecb_encrypt(tweak, T, &xts->key2)) != CRYPT_OK) { - return err; - } - - /* for i = 0 to m-2 do */ - if (mo == 0) { - lim = m; - } else { - lim = m - 1; - } - - for (i = 0; i < lim; i++) { - err = tweak_crypt(pt, ct, T, xts); - ct += 16; - pt += 16; - } - - /* if ptlen not divide 16 then */ - if (mo > 0) { - /* CC = tweak encrypt block m-1 */ - if ((err = tweak_crypt(pt, CC, T, xts)) != CRYPT_OK) { - return err; - } - - /* Cm = first ptlen % 16 bytes of CC */ - for (i = 0; i < mo; i++) { - PP[i] = pt[16+i]; - ct[16+i] = CC[i]; - } - - for (; i < 16; i++) { - PP[i] = CC[i]; - } - - /* Cm-1 = Tweak encrypt PP */ - if ((err = tweak_crypt(PP, ct, T, xts)) != CRYPT_OK) { - return err; - } - } - - return err; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/xts/xts_encrypt.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2007/05/12 14:05:56 $ */ - DELETED Source/libtomcrypt/src/modes/xts/xts_init.c Index: Source/libtomcrypt/src/modes/xts/xts_init.c ================================================================== --- Source/libtomcrypt/src/modes/xts/xts_init.c +++ /dev/null @@ -1,71 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects -*/ - -#ifdef LTC_XTS_MODE - - -/** Start XTS mode - @param cipher The index of the cipher to use - @param key1 The encrypt key - @param key2 The tweak encrypt key - @param keylen The length of the keys (each) in octets - @param num_rounds The number of rounds for the cipher (0 == default) - @param xts [out] XTS structure - Returns CRYPT_OK upon success. -*/ -#ifdef MACTOMCRYPT -int xts_start(int cipher, const unsigned char *IV, const unsigned char *key1, int keylen, const unsigned char *key2, int tweaklen, - int num_rounds, int options, symmetric_xts *xts) -#else -int xts_start(int cipher, const unsigned char *key1, const unsigned char *key2, unsigned long keylen, int num_rounds, symmetric_xts *xts) -#endif - - -{ - int err; - - /* check inputs */ - LTC_ARGCHK(key1 != NULL); - LTC_ARGCHK(key2 != NULL); - LTC_ARGCHK(xts != NULL); - - /* check if valid */ - if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { - return err; - } - - if (cipher_descriptor[cipher].block_length != 16) { - return CRYPT_INVALID_ARG; - } - - /* schedule the two ciphers */ - if ((err = cipher_descriptor[cipher].setup(key1, keylen, num_rounds, &xts->key1)) != CRYPT_OK) { - return err; - } - if ((err = cipher_descriptor[cipher].setup(key2, keylen, num_rounds, &xts->key2)) != CRYPT_OK) { - return err; - } - xts->cipher = cipher; - - return err; -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/xts/xts_init.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2007/03/10 23:59:09 $ */ - DELETED Source/libtomcrypt/src/modes/xts/xts_mult_x.c Index: Source/libtomcrypt/src/modes/xts/xts_mult_x.c ================================================================== --- Source/libtomcrypt/src/modes/xts/xts_mult_x.c +++ /dev/null @@ -1,42 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -/** - Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects -*/ - -#ifdef LTC_XTS_MODE - -/** multiply by x - @param I The value to multiply by x (LFSR shift) -*/ -void xts_mult_x(unsigned char *I) -{ - int x; - unsigned char t, tt; - - for (x = t = 0; x < 16; x++) { - tt = I[x] >> 7; - I[x] = ((I[x] << 1) | t) & 0xFF; - t = tt; - } - if (tt) { - I[0] ^= 0x87; - } -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/xts/xts_mult_x.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2007/03/10 23:59:09 $ */ - DELETED Source/libtomcrypt/src/modes/xts/xts_test.c Index: Source/libtomcrypt/src/modes/xts/xts_test.c ================================================================== --- Source/libtomcrypt/src/modes/xts/xts_test.c +++ /dev/null @@ -1,203 +0,0 @@ -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include "tomcrypt.h" - -#ifdef LTC_XTS_MODE - -/** - Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects - Returns CRYPT_OK upon success. -*/ -int xts_test(void) -{ -#ifdef LTC_NO_TEST - return CRYPT_NOP; -#else - static const struct { - int keylen; - unsigned char key1[32]; - unsigned char key2[32]; - ulong64 seqnum; - unsigned long PTLEN; - unsigned char PTX[512], CTX[512]; - } tests[] = { - -/* #1 32 byte key, 32 byte PTX */ -{ - 32, - { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, - { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, - 0, - 32, - { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, - { 0x91,0x7c,0xf6,0x9e,0xbd,0x68,0xb2,0xec,0x9b,0x9f,0xe9,0xa3,0xea,0xdd,0xa6,0x92,0xcd,0x43,0xd2,0xf5,0x95,0x98,0xed,0x85,0x8c,0x02,0xc2,0x65,0x2f,0xbf,0x92,0x2e }, -}, - -/* #2, 32 byte key, 32 byte PTX */ -{ - 32, - { 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11 }, - { 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22 }, - CONST64(0x3333333333), - 32, - { 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44 }, - { 0xc4,0x54,0x18,0x5e,0x6a,0x16,0x93,0x6e,0x39,0x33,0x40,0x38,0xac,0xef,0x83,0x8b,0xfb,0x18,0x6f,0xff,0x74,0x80,0xad,0xc4,0x28,0x93,0x82,0xec,0xd6,0xd3,0x94,0xf0 }, -}, - -/* #5 from xts.7, 32 byte key, 32 byte PTX */ -{ - 32, - { 0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,0xf7,0xf6,0xf5,0xf4,0xf3,0xf2,0xf1,0xf0 }, - { 0xbf,0xbe,0xbd,0xbc,0xbb,0xba,0xb9,0xb8,0xb7,0xb6,0xb5,0xb4,0xb3,0xb2,0xb1,0xb0 }, - CONST64(0x123456789a), - 32, - { 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44 }, - { 0xb0,0x1f,0x86,0xf8,0xed,0xc1,0x86,0x37,0x06,0xfa,0x8a,0x42,0x53,0xe3,0x4f,0x28,0xaf,0x31,0x9d,0xe3,0x83,0x34,0x87,0x0f,0x4d,0xd1,0xf9,0x4c,0xbe,0x98,0x32,0xf1 }, -}, - -/* #4, 32 byte key, 512 byte PTX */ -{ - 32, - { 0x27,0x18,0x28,0x18,0x28,0x45,0x90,0x45,0x23,0x53,0x60,0x28,0x74,0x71,0x35,0x26 }, - { 0x31,0x41,0x59,0x26,0x53,0x58,0x97,0x93,0x23,0x84,0x62,0x64,0x33,0x83,0x27,0x95 }, - 0, - 512, - { -0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, -0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, -0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f, -0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f, -0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, -0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, -0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, -0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff, -0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, -0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, -0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f, -0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f, -0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, -0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, -0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, -0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff, - }, - { -0x27,0xa7,0x47,0x9b,0xef,0xa1,0xd4,0x76,0x48,0x9f,0x30,0x8c,0xd4,0xcf,0xa6,0xe2,0xa9,0x6e,0x4b,0xbe,0x32,0x08,0xff,0x25,0x28,0x7d,0xd3,0x81,0x96,0x16,0xe8,0x9c, -0xc7,0x8c,0xf7,0xf5,0xe5,0x43,0x44,0x5f,0x83,0x33,0xd8,0xfa,0x7f,0x56,0x00,0x00,0x05,0x27,0x9f,0xa5,0xd8,0xb5,0xe4,0xad,0x40,0xe7,0x36,0xdd,0xb4,0xd3,0x54,0x12, -0x32,0x80,0x63,0xfd,0x2a,0xab,0x53,0xe5,0xea,0x1e,0x0a,0x9f,0x33,0x25,0x00,0xa5,0xdf,0x94,0x87,0xd0,0x7a,0x5c,0x92,0xcc,0x51,0x2c,0x88,0x66,0xc7,0xe8,0x60,0xce, -0x93,0xfd,0xf1,0x66,0xa2,0x49,0x12,0xb4,0x22,0x97,0x61,0x46,0xae,0x20,0xce,0x84,0x6b,0xb7,0xdc,0x9b,0xa9,0x4a,0x76,0x7a,0xae,0xf2,0x0c,0x0d,0x61,0xad,0x02,0x65, -0x5e,0xa9,0x2d,0xc4,0xc4,0xe4,0x1a,0x89,0x52,0xc6,0x51,0xd3,0x31,0x74,0xbe,0x51,0xa1,0x0c,0x42,0x11,0x10,0xe6,0xd8,0x15,0x88,0xed,0xe8,0x21,0x03,0xa2,0x52,0xd8, -0xa7,0x50,0xe8,0x76,0x8d,0xef,0xff,0xed,0x91,0x22,0x81,0x0a,0xae,0xb9,0x9f,0x91,0x72,0xaf,0x82,0xb6,0x04,0xdc,0x4b,0x8e,0x51,0xbc,0xb0,0x82,0x35,0xa6,0xf4,0x34, -0x13,0x32,0xe4,0xca,0x60,0x48,0x2a,0x4b,0xa1,0xa0,0x3b,0x3e,0x65,0x00,0x8f,0xc5,0xda,0x76,0xb7,0x0b,0xf1,0x69,0x0d,0xb4,0xea,0xe2,0x9c,0x5f,0x1b,0xad,0xd0,0x3c, -0x5c,0xcf,0x2a,0x55,0xd7,0x05,0xdd,0xcd,0x86,0xd4,0x49,0x51,0x1c,0xeb,0x7e,0xc3,0x0b,0xf1,0x2b,0x1f,0xa3,0x5b,0x91,0x3f,0x9f,0x74,0x7a,0x8a,0xfd,0x1b,0x13,0x0e, -0x94,0xbf,0xf9,0x4e,0xff,0xd0,0x1a,0x91,0x73,0x5c,0xa1,0x72,0x6a,0xcd,0x0b,0x19,0x7c,0x4e,0x5b,0x03,0x39,0x36,0x97,0xe1,0x26,0x82,0x6f,0xb6,0xbb,0xde,0x8e,0xcc, -0x1e,0x08,0x29,0x85,0x16,0xe2,0xc9,0xed,0x03,0xff,0x3c,0x1b,0x78,0x60,0xf6,0xde,0x76,0xd4,0xce,0xcd,0x94,0xc8,0x11,0x98,0x55,0xef,0x52,0x97,0xca,0x67,0xe9,0xf3, -0xe7,0xff,0x72,0xb1,0xe9,0x97,0x85,0xca,0x0a,0x7e,0x77,0x20,0xc5,0xb3,0x6d,0xc6,0xd7,0x2c,0xac,0x95,0x74,0xc8,0xcb,0xbc,0x2f,0x80,0x1e,0x23,0xe5,0x6f,0xd3,0x44, -0xb0,0x7f,0x22,0x15,0x4b,0xeb,0xa0,0xf0,0x8c,0xe8,0x89,0x1e,0x64,0x3e,0xd9,0x95,0xc9,0x4d,0x9a,0x69,0xc9,0xf1,0xb5,0xf4,0x99,0x02,0x7a,0x78,0x57,0x2a,0xee,0xbd, -0x74,0xd2,0x0c,0xc3,0x98,0x81,0xc2,0x13,0xee,0x77,0x0b,0x10,0x10,0xe4,0xbe,0xa7,0x18,0x84,0x69,0x77,0xae,0x11,0x9f,0x7a,0x02,0x3a,0xb5,0x8c,0xca,0x0a,0xd7,0x52, -0xaf,0xe6,0x56,0xbb,0x3c,0x17,0x25,0x6a,0x9f,0x6e,0x9b,0xf1,0x9f,0xdd,0x5a,0x38,0xfc,0x82,0xbb,0xe8,0x72,0xc5,0x53,0x9e,0xdb,0x60,0x9e,0xf4,0xf7,0x9c,0x20,0x3e, -0xbb,0x14,0x0f,0x2e,0x58,0x3c,0xb2,0xad,0x15,0xb4,0xaa,0x5b,0x65,0x50,0x16,0xa8,0x44,0x92,0x77,0xdb,0xd4,0x77,0xef,0x2c,0x8d,0x6c,0x01,0x7d,0xb7,0x38,0xb1,0x8d, -0xeb,0x4a,0x42,0x7d,0x19,0x23,0xce,0x3f,0xf2,0x62,0x73,0x57,0x79,0xa4,0x18,0xf2,0x0a,0x28,0x2d,0xf9,0x20,0x14,0x7b,0xea,0xbe,0x42,0x1e,0xe5,0x31,0x9d,0x05,0x68, - } -}, - -/* #7, 32 byte key, 17 byte PTX */ -{ - 32, - { 0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,0xf7,0xf6,0xf5,0xf4,0xf3,0xf2,0xf1,0xf0 }, - { 0xbf,0xbe,0xbd,0xbc,0xbb,0xba,0xb9,0xb8,0xb7,0xb6,0xb5,0xb4,0xb3,0xb2,0xb1,0xb0 }, - CONST64(0x123456789a), - 17, - { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 }, - { 0x6c,0x16,0x25,0xdb,0x46,0x71,0x52,0x2d,0x3d,0x75,0x99,0x60,0x1d,0xe7,0xca,0x09,0xed }, -}, - -/* #15, 32 byte key, 25 byte PTX */ -{ - 32, - { 0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,0xf7,0xf6,0xf5,0xf4,0xf3,0xf2,0xf1,0xf0 }, - { 0xbf,0xbe,0xbd,0xbc,0xbb,0xba,0xb9,0xb8,0xb7,0xb6,0xb5,0xb4,0xb3,0xb2,0xb1,0xb0 }, - CONST64(0x123456789a), - 25, - { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18 }, - { 0x8f,0x4d,0xcb,0xad,0x55,0x55,0x8d,0x7b,0x4e,0x01,0xd9,0x37,0x9c,0xd4,0xea,0x22,0xed,0xbf,0x9d,0xac,0xe4,0x5d,0x6f,0x6a,0x73 }, -}, - -/* #21, 32 byte key, 31 byte PTX */ -{ - 32, - { 0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,0xf7,0xf6,0xf5,0xf4,0xf3,0xf2,0xf1,0xf0 }, - { 0xbf,0xbe,0xbd,0xbc,0xbb,0xba,0xb9,0xb8,0xb7,0xb6,0xb5,0xb4,0xb3,0xb2,0xb1,0xb0 }, - CONST64(0x123456789a), - 31, - { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e }, - { 0xd0,0x5b,0xc0,0x90,0xa8,0xe0,0x4f,0x1b,0x3d,0x3e,0xcd,0xd5,0xba,0xec,0x0f,0xd4,0xed,0xbf,0x9d,0xac,0xe4,0x5d,0x6f,0x6a,0x73,0x06,0xe6,0x4b,0xe5,0xdd,0x82 }, -}, - -}; - unsigned char OUT[512], T[16]; - ulong64 seq; - symmetric_xts xts; - int i, err, idx; - - /* AES can be under rijndael or aes... try to find it */ - if ((idx = find_cipher("aes")) == -1) { - if ((idx = find_cipher("rijndael")) == -1) { - return CRYPT_NOP; - } - } - - for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) { -#ifdef MACTOMCRYPT - err = xts_start(idx, NULL, tests[i].key1, tests[i].keylen/2, tests[i].key2, 0, 0, 0, &xts); -#else - err = xts_start(idx, tests[i].key1, tests[i].key2, tests[i].keylen/2, 0, &xts); -#endif - if (err != CRYPT_OK) { - return err; - } - - seq = tests[i].seqnum; - STORE64L(seq,T); - XMEMSET(T+8, 0, 8); - - err = xts_encrypt(tests[i].PTX, tests[i].PTLEN, OUT, T, &xts); - if (err != CRYPT_OK) { - xts_done(&xts); - return err; - } - - if (XMEMCMP(OUT, tests[i].CTX, tests[i].PTLEN)) { - xts_done(&xts); - return CRYPT_FAIL_TESTVECTOR; - } - - err = xts_decrypt(tests[i].CTX, tests[i].PTLEN, OUT, T, &xts); - if (err != CRYPT_OK) { - xts_done(&xts); - return err; - } - - if (XMEMCMP(OUT, tests[i].PTX, tests[i].PTLEN)) { - xts_done(&xts); - return CRYPT_FAIL_TESTVECTOR; - } - xts_done(&xts); - } - return CRYPT_OK; -#endif -} - -#endif - -/* $Source: /cvs/libtom/libtomcrypt/src/modes/xts/xts_test.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2007/03/10 23:59:09 $ */ - DELETED Source/libtomcrypt/src/padding/ansix923/ansi923pad.c Index: Source/libtomcrypt/src/padding/ansix923/ansi923pad.c ================================================================== --- Source/libtomcrypt/src/padding/ansix923/ansi923pad.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - - - - -/* - * ansi923pad.c - * MacTomCrypt - * - * ANSI.923 padding mode functions. - */ - - -#include "ansi923pad.h" - -#define MAXBLOCKSIZE_ANSI923 128 - -int -ansi923_pad(char *buff, size_t blocksize, size_t startpoint) { - char padbyte; - int i; - - if((buff == NULL) || (blocksize > MAXBLOCKSIZE_ANSI923) || (startpoint > blocksize)) return -1; - padbyte = blocksize - startpoint; - if(padbyte == 0) padbyte = blocksize; - - for(i = 0; i < padbyte; i++) buff[startpoint + i] = 0; - buff[startpoint + padbyte - 1] = padbyte; - return padbyte; -} - - -int -ansi923_len(size_t blocksize) { - if(blocksize > MAXBLOCKSIZE_ANSI923) return -1; - return blocksize * 2; -} - -int -ansi923_unpadlen(char *buff, size_t blocksize) { - if(blocksize > MAXBLOCKSIZE_ANSI923) return -1; - if(buff == NULL) return -1; - return blocksize - *(buff + blocksize - 1); -} - - DELETED Source/libtomcrypt/src/padding/ansix923/ansi923pad.h Index: Source/libtomcrypt/src/padding/ansix923/ansi923pad.h ================================================================== --- Source/libtomcrypt/src/padding/ansix923/ansi923pad.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#include -#include - -/* - * ansi923.h - * MacTomCrypt - * - * ANSI.923 padding mode functions. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Fill out the padding for a buffer. The blocksize and starting points are used to determine how much needs - * to be padded. If startpoint is blocksize+1 then a full new buffer is added. Blocksize cannot be greater - * than 256. - */ - -int -ansi923_pad(char *buff, size_t blocksize, size_t startpoint); - -/* - * Given the last buffer containing the pad, how many bytes is the original text? - * returns -1 on error. - */ - -int -ansi923_unpadlen(char *buff, size_t blocksize); - -/* - * Maximum space needed for padding. For ANSI.923 this is blocksize*2 - */ - -int -ansi923_len(size_t blocksize); - -#ifdef __cplusplus -} -#endif - DELETED Source/libtomcrypt/src/padding/iso10126/iso10126pad.c Index: Source/libtomcrypt/src/padding/iso10126/iso10126pad.c ================================================================== --- Source/libtomcrypt/src/padding/iso10126/iso10126pad.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - - - - -/* - * iso10126pad.c - * MacTomCrypt - * - * iso10126 padding mode functions. - */ - - -#include "iso10126pad.h" - -#define MAXBLOCKSIZE_ISO10126 128 - -int -iso10126_pad(char *buff, size_t blocksize, size_t startpoint) { - char padbyte; - int i; - - if((buff == NULL) || (blocksize > MAXBLOCKSIZE_ISO10126) || (startpoint > blocksize)) return -1; - padbyte = blocksize - startpoint; - if(padbyte != 0) { - for(i = 0; i < padbyte; i++) buff[startpoint + i] = 0 /* ZZZ Random source needed */; - } - return padbyte; -} - - -int -iso10126_len(size_t blocksize) { - if(blocksize > MAXBLOCKSIZE_ISO10126) return -1; - return blocksize; -} - -int -iso10126_unpadlen(char *buff, size_t blocksize) { - if(blocksize > MAXBLOCKSIZE_ISO10126) return -1; - if(buff == NULL) return -1; - return blocksize; -} - - DELETED Source/libtomcrypt/src/padding/iso10126/iso10126pad.h Index: Source/libtomcrypt/src/padding/iso10126/iso10126pad.h ================================================================== --- Source/libtomcrypt/src/padding/iso10126/iso10126pad.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#include -#include - -/* - * iso10126pad.h - * MacTomCrypt - * - * iso10126 padding mode functions. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Fill out the padding for a buffer. The blocksize and starting points are used to determine how much needs - * to be padded. If startpoint is blocksize+1 then a full new buffer is added. Blocksize cannot be greater - * than 256. - */ - -int -iso10126_pad(char *buff, size_t blocksize, size_t startpoint); - -/* - * Given the last buffer containing the pad, how many bytes is the original text? - * returns -1 on error. - */ - -int -iso10126_unpadlen(char *buff, size_t blocksize); - -/* - * Maximum space needed for padding. For iso10126 this is blocksize*2 - */ - -int -iso10126_len(size_t blocksize); - -#ifdef __cplusplus -} -#endif - DELETED Source/libtomcrypt/src/padding/nopadding/nopad.c Index: Source/libtomcrypt/src/padding/nopadding/nopad.c ================================================================== --- Source/libtomcrypt/src/padding/nopadding/nopad.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - - - - -/* - * nopad.c - * MacTomCrypt - * - * No padding mode functions. - */ - - -#include "nopad.h" - -int -no_pad(char *buff, size_t blocksize, size_t startpoint) { - return 0; -} - - -int -no_len(size_t blocksize) { - return 0; -} - -int -no_unpadlen(char *buff, size_t blocksize) { - return blocksize; -} - - DELETED Source/libtomcrypt/src/padding/nopadding/nopad.h Index: Source/libtomcrypt/src/padding/nopadding/nopad.h ================================================================== --- Source/libtomcrypt/src/padding/nopadding/nopad.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#include -#include - -/* - * nopad.h - * MacTomCrypt - * - * No padding mode functions. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Fill out the padding for a buffer. The blocksize and starting points are used to determine how much needs - * to be padded. If startpoint is blocksize+1 then a full new buffer is added. Blocksize cannot be greater - * than 256. - */ - -int -no_pad(char *buff, size_t blocksize, size_t startpoint); - -/* - * Given the last buffer containing the pad, how many bytes is the original text? - * returns -1 on error. - */ - -int -no_unpadlen(char *buff, size_t blocksize); - -/* - * Maximum space needed for padding. For PKCS7 this is blocksize*2 - */ - -int -no_len(size_t blocksize); - -#ifdef __cplusplus -} -#endif - DELETED Source/libtomcrypt/src/padding/pkcs7/pkcs7pad.c Index: Source/libtomcrypt/src/padding/pkcs7/pkcs7pad.c ================================================================== --- Source/libtomcrypt/src/padding/pkcs7/pkcs7pad.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - - - - -/* - * pkcs7pad.c - * MacTomCrypt - * - * PKCS7 padding mode functions. - */ - - -#include "pkcs7pad.h" - -#define MAXBLOCKSIZE_PKCS7 128 - -int -pkcs7_pad(char *buff, size_t blocksize, size_t startpoint) { - char padbyte; - int i; - - if((buff == NULL) || (blocksize > MAXBLOCKSIZE_PKCS7) || (startpoint > blocksize)) return -1; - padbyte = blocksize - startpoint; - if(padbyte == 0) padbyte = blocksize; - - for(i = 0; i < padbyte; i++) buff[startpoint + i] = padbyte; - return padbyte; -} - - -int -pkcs7_len(size_t blocksize) { - if(blocksize > MAXBLOCKSIZE_PKCS7) return -1; - return blocksize * 2; -} - -int -pkcs7_unpadlen(char *buff, size_t blocksize) { - if(blocksize > MAXBLOCKSIZE_PKCS7) return -1; - if(buff == NULL) return -1; - return blocksize - buff[blocksize - 1]; -} - - DELETED Source/libtomcrypt/src/padding/pkcs7/pkcs7pad.h Index: Source/libtomcrypt/src/padding/pkcs7/pkcs7pad.h ================================================================== --- Source/libtomcrypt/src/padding/pkcs7/pkcs7pad.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2010 Apple Inc. All Rights Reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#include -#include - -/* - * pkcs7pad.h - * MacTomCrypt - * - * PKCS7 padding mode functions. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Fill out the padding for a buffer. The blocksize and starting points are used to determine how much needs - * to be padded. If startpoint is blocksize+1 then a full new buffer is added. Blocksize cannot be greater - * than 256. - */ - -int -pkcs7_pad(char *buff, size_t blocksize, size_t startpoint); - -/* - * Given the last buffer containing the pad, how many bytes is the original text? - * returns -1 on error. - */ - -int -pkcs7_unpadlen(char *buff, size_t blocksize); - -/* - * Maximum space needed for padding. For PKCS7 this is blocksize*2 - */ - -int -pkcs7_len(size_t blocksize); - -#ifdef __cplusplus -} -#endif - DELETED UnitTestSource/CCMemoryHandler.h Index: UnitTestSource/CCMemoryHandler.h ================================================================== --- UnitTestSource/CCMemoryHandler.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// CCMemoryHandler.h -// CommonCrypto -// -// Created by Jim Murphy on 1/13/10. -// Copyright 2010 Apple. All rights reserved. -// - -#import - -class CCMemoryHandler -{ -protected: - NSMutableArray* _memoryList; - -private: - // disallow heap based instances of this class - void* operator new (size_t size) - { - return ::operator new(size); - } - -public: - CCMemoryHandler() : - _memoryList(nil) - { - _memoryList = [NSMutableArray new]; - } - - virtual ~CCMemoryHandler() - { - [_memoryList release]; - _memoryList = nil; - } - - void* malloc(size_t size); -}; - DELETED UnitTestSource/CCMemoryHandler.mm Index: UnitTestSource/CCMemoryHandler.mm ================================================================== --- UnitTestSource/CCMemoryHandler.mm +++ /dev/null @@ -1,55 +0,0 @@ -// -// CCMemoryHandler.mm -// CommonCrypto -// -// Created by Jim Murphy on 1/13/10. -// Copyright 2010 Apple. All rights reserved. -// - -#import "CCMemoryHandler.h" - -@interface CCMemoryAllocation : NSObject -{ - void* _allocation; -} - -@property (readonly) void* allocation; - -- (id)initWithMemSize:(size_t)size; - -@end - -@implementation CCMemoryAllocation - -@synthesize allocation = _allocation; - -- (id)initWithMemSize:(size_t)size -{ - _allocation = NULL; - if ((self = [super init])) - { - _allocation = malloc(size); - memset(_allocation, 0, size); - } - return self; -} - -- (void)dealloc -{ - if (_allocation != NULL) - { - free(_allocation); - _allocation = NULL; - } - [super dealloc]; -} - -@end - -void* CCMemoryHandler::malloc(size_t size) -{ - CCMemoryAllocation* allocObj = [[CCMemoryAllocation alloc] initWithMemSize:size]; - void* result = allocObj.allocation; - [_memoryList addObject:allocObj]; - return result; -} DELETED UnitTestSource/CommonCryptoUnitTests-Info.plist Index: UnitTestSource/CommonCryptoUnitTests-Info.plist ================================================================== --- UnitTestSource/CommonCryptoUnitTests-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - DELETED UnitTestSource/CommonCryptoUnitTests.h Index: UnitTestSource/CommonCryptoUnitTests.h ================================================================== --- UnitTestSource/CommonCryptoUnitTests.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// CommonCryptoUnitTests.h -// CommonCrypto -// -// Created by Jim Murphy on 1/11/10. -// Copyright 2010 Apple. All rights reserved. -// - -#import -#import -#import "TestToolProtocol.h" - - -@interface CommonCryptoUnitTests : SenTestCase -{ - // No member variables -} - -// This allows an object that is NOT subclassed from SenTestCase to issue -// an assert -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr; - -@end DELETED UnitTestSource/CommonCryptoUnitTests.mm Index: UnitTestSource/CommonCryptoUnitTests.mm ================================================================== --- UnitTestSource/CommonCryptoUnitTests.mm +++ /dev/null @@ -1,183 +0,0 @@ -// -// CommonCryptoUnitTests.mm -// CommonCrypto -// -// Created by Jim Murphy on 1/11/10. -// Copyright 2010 Apple Inc. All rights reserved. -// - -#import "CommonCryptoUnitTests.h" -#import "DigestTest.h" -#include "CommonDigest.h" -#include "CommonCryptor.h" -#include "CommonHMAC.h" -#include "RandomNumberService.h" -#import "EncryptionTest.h" -#import "HMACTest.h" -#import "PBKDFTest.h" -#import "SymmetricWrapTest.h" -#import "CommonRandomSPI.h" - - -// - (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr; -/* -------------------------------------------------------------------------- - class: CommonCryptoUnitTests - description: Implementation of the unit tests for the CommonCrypto - library - -------------------------------------------------------------------------- */ -@implementation CommonCryptoUnitTests - -/* -------------------------------------------------------------------------- - method: -(void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr - decription: Provide a way for class that is NOT subclassed from - SenTestCase have an assert - -------------------------------------------------------------------------- */ --(void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr -{ - STAssertTrue(result, errorStr); -} - -/* -------------------------------------------------------------------------- - method: - (void)testDigests - decription: Test all of the digest algorithms in the CommonCrypto - library - -------------------------------------------------------------------------- */ -- (void)testDigests -{ - NSAutoreleasePool *pool = [NSAutoreleasePool new]; - - NSLog(@"%@", @"In the testDigest method"); - - NSArray* digestTests = [CCDigestTestObject setupDigestTests:self]; - - for (CCDigestTestObject* testObject in digestTests) - { - NSLog(@"Running test for %@", testObject.digestName); - [testObject runTest]; - } - - [pool drain]; -} - -/* -------------------------------------------------------------------------- - method: - (void)testEncryption - decription: Test all of the encryption algorithms in the CommonCrypto - library - -------------------------------------------------------------------------- */ -- (void)testEncryption -{ - - NSAutoreleasePool *pool = [NSAutoreleasePool new]; - - NSLog(@"%@", @"In the testEncryption method"); - NSArray* encryptionTests = [CCEncryptionTest setupEncryptionTests:self]; - - for (CCEncryptionTest* aTest in encryptionTests) - { - NSLog(@"Running test for %@", aTest.algName); - [aTest runTest]; - } - - - [pool drain]; - -} - -/* -------------------------------------------------------------------------- - method: - (void)testHMAC - decription: Test all of the HMAC algorithms in the CommonCrypto library - -------------------------------------------------------------------------- */ -- (void)testHMAC -{ - NSAutoreleasePool *pool = [NSAutoreleasePool new]; - - NSLog(@"%@", @"In the testHMAC method"); - NSArray* hmacTests = [CCHMACTestObject setupHMACTests:self]; - - for (CCHMACTestObject* aTest in hmacTests) - { - NSLog(@"Running test for %@", aTest.nameHMAC); - [aTest runTest]; - } - - - [pool drain]; -} - -/* -------------------------------------------------------------------------- - method: - (void)testPBKDF - decription: Test all of the PBKDF algorithms in the CommonCrypto library - -------------------------------------------------------------------------- */ -- (void)testPBKDF -{ - NSAutoreleasePool *pool = [NSAutoreleasePool new]; - - NSLog(@"%@", @"In the testPBKDF method"); - printf("Starting\n"); - NSArray* pbkdfTests = [CCDerviationTestObject setupPBKDFTests:self]; - - for (CCDerviationTestObject* aTest in pbkdfTests) - { - NSLog(@"Running test for %@", aTest.namePBKDF); - [aTest runTest]; - } - - - [pool drain]; -} - - -/* -------------------------------------------------------------------------- - method: - (void)testSymmetricWrap - decription: Test all of the SymmetricWrap algorithms in the CommonCrypto library - -------------------------------------------------------------------------- */ -- (void)testSymmetricWrap -{ - NSAutoreleasePool *pool = [NSAutoreleasePool new]; - - NSLog(@"%@", @"In the testSymmetricWrap method"); - NSArray* SymmetricWrapTests = [CCSymmetricalWrapTest setupSymmWrapTests:self]; - - for (CCSymmetricalWrapTest* aTest in SymmetricWrapTests) - { - NSLog(@"%@", @"About to call the unit test"); - [aTest runTest]; - } - - [pool drain]; -} - -/* -------------------------------------------------------------------------- - method: - (void)testRandomCopyBytes - decription: Test the main PRNG for non-repeatability - -------------------------------------------------------------------------- */ -- (void)testRandomCopyBytes -{ - NSAutoreleasePool *pool = [NSAutoreleasePool new]; - uint8_t bytes[1024]; - uint8_t previous[1024]; - int i; - - NSLog(@"%@", @"In the testRandomCopyBytes method"); - bzero(previous, 1024); - for(i=0; i<1024; i++) { - int retval = CCRandomCopyBytes(kCCRandomDefault, bytes, 1024); - if(retval) { - NSLog(@"%@", @"Failed call to CCRandomCopyBytes"); - } - - if(memcmp(previous, bytes, 1024) == 0) { - NSLog(@"%@", @"Failed - random bytes match (1024 bytes)"); - } - - memcpy(previous, bytes, 1024); - } - - - [pool drain]; -} - - -@end - - DELETED UnitTestSource/DigestTest.h Index: UnitTestSource/DigestTest.h ================================================================== --- UnitTestSource/DigestTest.h +++ /dev/null @@ -1,84 +0,0 @@ -// -// DigestTest.h -// CommonCrypto -// -// Created by Jim Murphy on 1/12/10. -// Copyright 2010 Apple. All rights reserved. -// - -#import -#include "CommonDigest.h" -#include "CommonDigestSPI.h" -#import "TestToolProtocol.h" - -/* ========================================================================== - Type defined by this file - ========================================================================== */ - -// Block definition for initializing a staged digest -typedef int (^initBlock)(void *ctx); - -// Block definition for updating a staged digest -typedef int (^updateBlock)(void *ctx, const void *data, CC_LONG len); - -// Block definition for finalizing a staged digest -typedef int (^finalBlock)(unsigned char *md, void *ctx); - -// Block definition for a 'one shot' digest -typedef unsigned char* (^oneShotBlock)(const void *data, CC_LONG len, unsigned char *md); - -/* ========================================================================== - Defines used by this file - ========================================================================== */ - -#define MIN_DATA_SIZE 1 -#define MAX_DATA_SIZE 10000 /* bytes */ -#define MAX_DIGEST_SIZE 64 -#define MAX_CONTEXT_SIZE CC_DIGEST_SIZE - - -/* -------------------------------------------------------------------------- - Class: CCDigestTestObject - Description: This class provides for testing a digest type - -------------------------------------------------------------------------- */ - -@interface CCDigestTestObject : NSObject -{ - NSString* _digestName; // The name of the digest type - size_t _digestSize; // The size of the digest - initBlock _initBlock; // Block that initialize a staged digest - updateBlock _updateBlock; // Block that updates a staged digest - finalBlock _finalBlock; // Block that finalizes a staged digest - oneShotBlock _oneShotBlock; // Block that does a 'one shot' digest - NSData* _stagedResult; // Result of the staged digest - NSData* _oneShotResult; // Result of the 'one shot' digest - NSData* _digestData; // Data to be digested - unsigned char _context[MAX_CONTEXT_SIZE]; // Working digest buffer - id - _testObject; // The owning test object NOT retained - BOOL _testPassed; -} - -@property (readonly) NSString* digestName; -@property (readonly) size_t digestSize; -@property (readonly) NSData* stagedResult; -@property (readonly) NSData* oneShotResult; -@property (readonly) NSData* digestData; -@property (readwrite, assign) id testObject; -@property (readonly) BOOL testPassed; - - -+ (NSArray *)setupDigestTests:(id)testObject; - - -- (id)initWithDigestName:(NSString *)name withDigestSize:(size_t)size - withInitBlock:(initBlock)initDigest - withUpdateBlock:(updateBlock)updateDigest - withFinalBlock:(finalBlock)completeDigest - withOneShotBlock:(oneShotBlock)oneShotDigest; - -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr; - -- (void)runTest; - -@end DELETED UnitTestSource/DigestTest.mm Index: UnitTestSource/DigestTest.mm ================================================================== --- UnitTestSource/DigestTest.mm +++ /dev/null @@ -1,513 +0,0 @@ -// -// DigestTest.mm -// CommonCrypto -// -// Created by Jim Murphy on 1/12/10. -// Copyright 2010 Apple. All rights reserved. -// - -#import "DigestTest.h" -#import "RandomNumberService.h" -#include "CommonDigest.h" -#include "CommonDigestSPI.h" -#include - - -@implementation CCDigestTestObject - -@synthesize digestName = _digestName; -@synthesize digestSize = _digestSize; -@synthesize stagedResult = _stagedResult; -@synthesize oneShotResult = _oneShotResult; -@synthesize digestData = _digestData; -@synthesize testObject = _testObject; -@synthesize testPassed = _testPassed; - - -/* -------------------------------------------------------------------------- - method: setupDigestTests - returns: NSArray * - decription: This method allows for creating digest specific tests for - all of the digest supported by the CommonCrypto library. - It creates an instance of the CCDigestTestObject for - each digest to be tested and places that object into - an NSArray. - -------------------------------------------------------------------------- */ -+ (NSArray *)setupDigestTests:(id)testObject; -{ - initBlock anInitBlock; - updateBlock anUpdateBlock; - finalBlock aFinalBlock; - oneShotBlock anOneShotBlock; - - NSMutableArray* result = [NSMutableArray array]; // autoreleased - - // --------------------- MD2 Digest ---------------------- - anInitBlock = ^(void *ctx) - { - return CC_MD2_Init((CC_MD2_CTX *)ctx); - }; - - anUpdateBlock = ^(void *ctx, const void *data, CC_LONG len) - { - return CC_MD2_Update((CC_MD2_CTX *)ctx, data, len); - }; - - aFinalBlock = ^(unsigned char *md, void *ctx) - { - return CC_MD2_Final(md, (CC_MD2_CTX *)ctx); - }; - - anOneShotBlock = ^(const void *data, CC_LONG len, unsigned char *md) - { - return CC_MD2(data, len, md); - }; - - CCDigestTestObject* md2DigestTest = [[[CCDigestTestObject alloc] - initWithDigestName:@"MD2" - withDigestSize:CC_MD2_DIGEST_LENGTH - withInitBlock:anInitBlock - withUpdateBlock:anUpdateBlock - withFinalBlock:aFinalBlock - withOneShotBlock:anOneShotBlock] autorelease]; - - md2DigestTest.testObject = testObject; - - [result addObject:md2DigestTest]; - - // --------------------- MD4 Digest ---------------------- - anInitBlock = ^(void *ctx) - { - return CC_MD4_Init((CC_MD4_CTX *)ctx); - }; - - anUpdateBlock = ^(void *ctx, const void *data, CC_LONG len) - { - return CC_MD4_Update((CC_MD4_CTX *)ctx, data, len); - }; - - aFinalBlock = ^(unsigned char *md, void *ctx) - { - return CC_MD4_Final(md, (CC_MD4_CTX *)ctx); - }; - - anOneShotBlock = ^(const void *data, CC_LONG len, unsigned char *md) - { - return CC_MD4(data, len, md); - }; - - CCDigestTestObject* md4DigestTest = [[[CCDigestTestObject alloc] initWithDigestName:@"MD4" - withDigestSize:CC_MD4_DIGEST_LENGTH - withInitBlock:anInitBlock - withUpdateBlock:anUpdateBlock - withFinalBlock:aFinalBlock - withOneShotBlock:anOneShotBlock] autorelease]; - - md4DigestTest.testObject = testObject; - - [result addObject:md4DigestTest]; - - // --------------------- MD5 Digest ---------------------- - - anInitBlock = ^(void *ctx) - { - return CC_MD5_Init((CC_MD5_CTX *)ctx); - }; - - anUpdateBlock = ^(void *ctx, const void *data, CC_LONG len) - { - return CC_MD5_Update((CC_MD5_CTX *)ctx, data, len); - }; - - aFinalBlock = ^(unsigned char *md, void *ctx) - { - return CC_MD5_Final(md, (CC_MD5_CTX *)ctx); - }; - - anOneShotBlock = ^(const void *data, CC_LONG len, unsigned char *md) - { - return CC_MD5(data, len, md); - }; - - CCDigestTestObject* md5DigestTest = [[[CCDigestTestObject alloc] initWithDigestName:@"MD5" - withDigestSize:CC_MD5_DIGEST_LENGTH - withInitBlock:anInitBlock - withUpdateBlock:anUpdateBlock - withFinalBlock:aFinalBlock - withOneShotBlock:anOneShotBlock] autorelease]; - - md5DigestTest.testObject = testObject; - - [result addObject:md5DigestTest]; - - // --------------------- SHA1 Digest ---------------------- - - anInitBlock = ^(void *ctx) - { - return CC_SHA1_Init((CC_SHA1_CTX *)ctx); - }; - - anUpdateBlock = ^(void *ctx, const void *data, CC_LONG len) - { - return CC_SHA1_Update((CC_SHA1_CTX *)ctx, data, len); - }; - - aFinalBlock = ^(unsigned char *md, void *ctx) - { - return CC_SHA1_Final(md, (CC_SHA1_CTX *)ctx); - }; - - anOneShotBlock = ^(const void *data, CC_LONG len, unsigned char *md) - { - return CC_SHA1(data, len, md); - }; - - CCDigestTestObject* sha1DigestTest = [[[CCDigestTestObject alloc] initWithDigestName:@"SHA1" - withDigestSize:CC_SHA1_DIGEST_LENGTH - withInitBlock:anInitBlock - withUpdateBlock:anUpdateBlock - withFinalBlock:aFinalBlock - withOneShotBlock:anOneShotBlock] autorelease]; - - sha1DigestTest.testObject = testObject; - - [result addObject:sha1DigestTest]; - - // --------------------- SHA224 Digest ---------------------- - - anInitBlock = ^(void *ctx) - { - return CC_SHA224_Init((CC_SHA256_CTX *)ctx); - }; - - anUpdateBlock = ^(void *ctx, const void *data, CC_LONG len) - { - return CC_SHA224_Update((CC_SHA256_CTX *)ctx, data, len); - }; - - aFinalBlock = ^(unsigned char *md, void *ctx) - { - return CC_SHA224_Final(md, (CC_SHA256_CTX *)ctx); - }; - - anOneShotBlock = ^(const void *data, CC_LONG len, unsigned char *md) - { - return CC_SHA224(data, len, md); - }; - - CCDigestTestObject* sha224DigestTest = [[[CCDigestTestObject alloc] initWithDigestName:@"SHA224" - withDigestSize:CC_SHA224_DIGEST_LENGTH - withInitBlock:anInitBlock - withUpdateBlock:anUpdateBlock - withFinalBlock:aFinalBlock - withOneShotBlock:anOneShotBlock] autorelease]; - - sha224DigestTest.testObject = testObject; - - [result addObject:sha224DigestTest]; - - // --------------------- SHA256 Digest ---------------------- - - anInitBlock = ^(void *ctx) - { - return CC_SHA256_Init((CC_SHA256_CTX *)ctx); - }; - - anUpdateBlock = ^(void *ctx, const void *data, CC_LONG len) - { - return CC_SHA256_Update((CC_SHA256_CTX *)ctx, data, len); - }; - - aFinalBlock = ^(unsigned char *md, void *ctx) - { - return CC_SHA256_Final(md, (CC_SHA256_CTX *)ctx); - }; - - anOneShotBlock = ^(const void *data, CC_LONG len, unsigned char *md) - { - return CC_SHA256(data, len, md); - }; - - CCDigestTestObject* sha256DigestTest = [[[CCDigestTestObject alloc] initWithDigestName:@"SHA256" - withDigestSize:CC_SHA256_DIGEST_LENGTH - withInitBlock:anInitBlock - withUpdateBlock:anUpdateBlock - withFinalBlock:aFinalBlock - withOneShotBlock:anOneShotBlock] autorelease]; - - sha224DigestTest.testObject = testObject; - - [result addObject:sha256DigestTest]; - - // --------------------- SHA384 Digest ---------------------- - - anInitBlock = ^(void *ctx) - { - return CC_SHA384_Init((CC_SHA512_CTX *)ctx); - }; - - anUpdateBlock = ^(void *ctx, const void *data, CC_LONG len) - { - return CC_SHA384_Update((CC_SHA512_CTX *)ctx, data, len); - }; - - aFinalBlock = ^(unsigned char *md, void *ctx) - { - return CC_SHA384_Final(md, (CC_SHA512_CTX *)ctx); - }; - - anOneShotBlock = ^(const void *data, CC_LONG len, unsigned char *md) - { - return CC_SHA384(data, len, md); - }; - - CCDigestTestObject* sha384DigestTest = [[[CCDigestTestObject alloc] initWithDigestName:@"SHA384" - withDigestSize:CC_SHA384_DIGEST_LENGTH - withInitBlock:anInitBlock - withUpdateBlock:anUpdateBlock - withFinalBlock:aFinalBlock - withOneShotBlock:anOneShotBlock] autorelease]; - - sha384DigestTest.testObject = testObject; - - [result addObject:sha384DigestTest]; - - // --------------------- SHA512 Digest ---------------------- - - anInitBlock = ^(void *ctx) - { - return CC_SHA512_Init((CC_SHA512_CTX *)ctx); - }; - - anUpdateBlock = ^(void *ctx, const void *data, CC_LONG len) - { - return CC_SHA512_Update((CC_SHA512_CTX *)ctx, data, len); - }; - - aFinalBlock = ^(unsigned char *md, void *ctx) - { - return CC_SHA512_Final(md, (CC_SHA512_CTX *)ctx); - }; - - anOneShotBlock = ^(const void *data, CC_LONG len, unsigned char *md) - { - return CC_SHA512(data, len, md); - }; - - CCDigestTestObject* sha512DigestTest = [[[CCDigestTestObject alloc] initWithDigestName:@"SHA512" - withDigestSize:CC_SHA512_DIGEST_LENGTH - withInitBlock:anInitBlock - withUpdateBlock:anUpdateBlock - withFinalBlock:aFinalBlock - withOneShotBlock:anOneShotBlock] autorelease]; - - sha512DigestTest.testObject = testObject; - - [result addObject:sha512DigestTest]; - - // --------------------- Skein512 Digest ---------------------- - - - anInitBlock = ^(void *ctx) - { - return CCDigestInit(kCCDigestSkein512, (CCDigestCtx *)ctx); - }; - - anUpdateBlock = ^(void *ctx, const void *data, CC_LONG len) - { - return CCDigestUpdate((CCDigestCtx *)ctx, (const uint8_t *) data, len); - }; - - aFinalBlock = ^(unsigned char *md, void *ctx) - { - return CCDigestFinal((CCDigestCtx *)ctx, md); - }; - - anOneShotBlock = ^(const void *data, CC_LONG len, unsigned char *md) - { - return (unsigned char *) CCDigest(kCCDigestSkein512, (const uint8_t *)data, len, (uint8_t *)md); - }; - - CCDigestTestObject* skein512DigestTest = [[[CCDigestTestObject alloc] initWithDigestName:@"Skein512 (CommonHash)" - withDigestSize:CC_SHA512_DIGEST_LENGTH - withInitBlock:anInitBlock - withUpdateBlock:anUpdateBlock - withFinalBlock:aFinalBlock - withOneShotBlock:anOneShotBlock] autorelease]; - - skein512DigestTest.testObject = testObject; - - [result addObject:skein512DigestTest]; - - - - return result; -} - - -/* -------------------------------------------------------------------------- - method: initWithDigestName:withDigestSize:withInitBlock:withUpdateBlock:withFinalBlock:withOneShotBlock: - returns: new CCDigestTestObject object - parameters: - name: - Then name of the digest type i.e. SHA1 - size: - The size in bytes of the digest for the specified type - initDigest: - A block to initialize a staged digest - updateDigest: - A block to update a staged digest - completeDigest: - A block to finalize a staged digest - oneShotDigest: - A block to do a 'one shot' digest - - - decription: Initalize a new Digest testing object - -------------------------------------------------------------------------- */ -- (id)initWithDigestName:(NSString *)name withDigestSize:(size_t)size - withInitBlock:(initBlock)initDigest - withUpdateBlock:(updateBlock)updateDigest - withFinalBlock:(finalBlock)completeDigest - withOneShotBlock:(oneShotBlock)oneShotDigest -{ - if ((self = [super init])) - { - _testPassed = YES; - [self doAssertTest:(NULL != name) errorString:@"CCDigestTestObject.init received a nil Name"]; - [self doAssertTest:(size > 0) errorString:@"CCDigestTestObject.init got a 0 buffer size"]; - [self doAssertTest:(0 != initDigest) errorString:@"CCDigestTestObject.init received a NULL InitBlock"]; - [self doAssertTest:(0 != updateDigest) errorString:@"CCDigestTestObject.init received a NULL UpdateBlock"]; - [self doAssertTest:(0 != completeDigest) errorString:@"CCDigestTestObject.init received a NULL CompleteDigestBlock"]; - [self doAssertTest:(0 != oneShotDigest) errorString:@"CCDigestTestObject.init received a NULL OneShotBlock"]; - - _digestName = [name copy]; - _digestSize = size; - _initBlock = [initDigest copy]; - _updateBlock = [updateDigest copy]; - _finalBlock = [completeDigest copy]; - _oneShotBlock = [oneShotDigest copy]; - - // Create the data that will be digested by this test. - CCRandomNumberService* randNumService = [CCRandomNumberService defaultRandomNumberService]; - unsigned int randomDataLength = [randNumService generateRandomNumberInRange:MIN_DATA_SIZE toMax:MAX_DATA_SIZE]; - _digestData = [[randNumService generateRandomDataOfSize:randomDataLength] retain]; - memset(_context, 0, MAX_CONTEXT_SIZE); - } - return self; -} - -/* -------------------------------------------------------------------------- - method: dealloc - returns: void - decription: Alway put away your toys when you are done playing with - them. - -------------------------------------------------------------------------- */ -- (void)dealloc -{ - [_digestName release]; - [_stagedResult release]; - [_oneShotResult release]; - [_digestData release]; - [_initBlock release]; - [_updateBlock release]; - [_finalBlock release]; - [_oneShotBlock release]; - [super dealloc]; -} - -/* -------------------------------------------------------------------------- - method: doStaged - returns: void - decription: Do the staged digest creation for this test placing the - result into the _stagedResult member - -------------------------------------------------------------------------- */ -- (void)doStaged -{ - - unsigned int thisMove; - memset(_context, 0, MAX_CONTEXT_SIZE); - - _initBlock(_context); - - unsigned int dataLength = [self.digestData length]; - const unsigned char* raw_bytes = (const unsigned char*)[self.digestData bytes]; - - unsigned char mdBuffer[MAX_DIGEST_SIZE]; - memset(mdBuffer, 0, MAX_DIGEST_SIZE); - - - CCRandomNumberService* randNumService = [CCRandomNumberService defaultRandomNumberService]; - - while (dataLength) - { - thisMove = [randNumService generateRandomNumberInRange:1 toMax:dataLength]; - _updateBlock(_context, raw_bytes, thisMove); - - raw_bytes += thisMove; - - dataLength -= thisMove; - } - - (void)_finalBlock(mdBuffer, _context); - [_stagedResult release]; - _stagedResult = [[NSData alloc] initWithBytes:mdBuffer length:_digestSize]; - -} - -/* -------------------------------------------------------------------------- - method: doOneShot - returns: void - decription: Do the 'one shot' digest creation for this test placing the - result into the _oneShotResult member - -------------------------------------------------------------------------- */ -- (void)doOneShot -{ - unsigned char mdBuffer[MAX_DIGEST_SIZE]; - memset(mdBuffer, 0, MAX_DIGEST_SIZE); - _oneShotBlock([self.digestData bytes], [self.digestData length], (unsigned char *)mdBuffer); - [_oneShotResult release]; - _oneShotResult = [[NSData alloc] initWithBytes:mdBuffer length:_digestSize]; - -} - -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr -{ - if (nil != self.testObject) - { - [self.testObject doAssertTest:result errorString:errorStr]; - return; - } - - if (_testPassed) - { - _testPassed = result; - } -} - - -/* -------------------------------------------------------------------------- - method: runTest - returns: void - decription: Do the testing of the digest by creating both a staged - and one shot digest from the same data and ensuring - that the two digests match - -------------------------------------------------------------------------- */ -- (void)runTest -{ - [self doOneShot]; - [self doStaged]; - - BOOL testResult = [self.stagedResult isEqualToData:self.oneShotResult]; - - [self doAssertTest:testResult errorString:[ - NSString stringWithFormat:@"Staged Result is not equal to the one shot result for digest type %@", self.digestName]]; - - if (nil == _testObject) - { - printf("DigestTest: %s\n", (self.testPassed) ? "Passed" : "Failed"); - } -} - -@end - DELETED UnitTestSource/EncryptionTest.h Index: UnitTestSource/EncryptionTest.h ================================================================== --- UnitTestSource/EncryptionTest.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// EncryptionTest.h -// CommonCrypto -// -// Created by Jim Murphy on 1/13/10. -// Copyright 2010 Apple. All rights reserved. -// - -#import -#import "TestToolProtocol.h" -#include "CommonCryptor.h" - - - -@interface CCEncryptionTest : NSObject -{ - CCAlgorithm _encrAlg; - uint32 _blockSize; - uint32 _minKeySizeInBytes; - uint32 _maxKeySizeInBytes; - size_t _ctxSize; - NSString* _algName; - id _testObject; // The owning test object NOT retained - BOOL _testPassed; -} - -@property (readonly) CCAlgorithm encrAlg; -@property (readonly) uint32 blockSize; -@property (readonly) uint32 minKeySizeInBytes; -@property (readonly) uint32 maxKeySizeInBytes; -@property (readonly) size_t ctxSize; -@property (readonly) NSString* algName; -@property (readonly) id testObject; -@property (readonly) BOOL testPassed; - - -+ (NSArray *)setupEncryptionTests:(id)testObject; - -- (id)initWithEncryptionName:(NSString *)name - withEncryptionAlgo:(CCAlgorithm)encrAlg - withBlockSize:(uint32)blockSize - withMinKeySizeInBytes:(uint32)minKeySizeInBytes - withMaxKeySizeInBytes:(uint32)maxKeySizeInBytes - withContextSize:(size_t)ctxSize - withUnitTest:(id)testObject; - -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr; - -- (void)runTest; - -@end DELETED UnitTestSource/EncryptionTest.mm Index: UnitTestSource/EncryptionTest.mm ================================================================== --- UnitTestSource/EncryptionTest.mm +++ /dev/null @@ -1,806 +0,0 @@ -// -// EncryptionTest.mm -// CommonCrypto -// -// Created by Jim Murphy on 1/13/10. -// Copyright 2010 Apple. All rights reserved. -// - -#import "EncryptionTest.h" - -/* Copyright 2006 Apple Computer, Inc. - * - * ccSymTest.c - test CommonCrypto symmetric encrypt/decrypt. - */ -#include -#include -#include -#include "CommonCryptor.h" -#include -#include "RandomNumberService.h" - -int DoTesting(CCEncryptionTest* unitTest); - -/* - * Defaults. - */ -#define LOOPS_DEF 500 -#define MIN_DATA_SIZE 8 -#define MAX_DATA_SIZE 10000 /* bytes */ -#define MAX_KEY_SIZE kCCKeySizeMaxRC4 /* bytes */ -#define MAX_BLOCK_SIZE kCCBlockSizeAES128 /* bytes */ -#define LOOP_NOTIFY 250 - -/* - * Enumerate algs our own way to allow iteration. - */ -typedef enum { - ALG_AES_128 = 1, /* 128 bit block, 128 bit key */ - ALG_AES_192, /* 128 bit block, 192 bit key */ - ALG_AES_256, /* 128 bit block, 256 bit key */ - ALG_DES, - ALG_3DES, - ALG_CAST, - ALG_RC4, - /* these aren't in CommonCrypto (yet?) */ - ALG_RC2, - ALG_RC5, - ALG_BFISH, - ALG_ASC, - ALG_NULL /* normally not used */ -} SymAlg; -#define ALG_FIRST ALG_AES_128 -#define ALG_LAST ALG_RC4 - - -@implementation CCEncryptionTest - -@synthesize encrAlg = _encrAlg; -@synthesize blockSize = _blockSize; -@synthesize minKeySizeInBytes = _minKeySizeInBytes; -@synthesize maxKeySizeInBytes = _maxKeySizeInBytes; -@synthesize ctxSize = _ctxSize; -@synthesize algName = _algName; -@synthesize testObject = _testObject; -@synthesize testPassed = _testPassed; - - -+ (NSArray *)setupEncryptionTests:(id)testObject -{ - NSMutableArray* result = [NSMutableArray array]; - - // ============================= DES ========================== - - CCEncryptionTest* desTest = [[[CCEncryptionTest alloc] - initWithEncryptionName:@"DES" - withEncryptionAlgo:kCCAlgorithmDES - withBlockSize:kCCBlockSizeDES - withMinKeySizeInBytes:kCCKeySizeDES - withMaxKeySizeInBytes:kCCKeySizeDES - withContextSize:kCCContextSizeDES - withUnitTest:testObject - ] autorelease]; - - [result addObject:desTest]; - - // ============================= 3DES ========================= - - CCEncryptionTest* des3Test = [[[CCEncryptionTest alloc] - initWithEncryptionName:@"3DES" - withEncryptionAlgo:kCCAlgorithm3DES - withBlockSize:kCCBlockSize3DES - withMinKeySizeInBytes:kCCKeySize3DES - withMaxKeySizeInBytes:kCCKeySize3DES - withContextSize:kCCContextSize3DES - withUnitTest:testObject - ] autorelease]; - - [result addObject:des3Test]; - - // ============================ AES128 ========================= - - CCEncryptionTest* aes128Test = [[[CCEncryptionTest alloc] - initWithEncryptionName:@"AES128" - withEncryptionAlgo:kCCAlgorithmAES128 - withBlockSize:kCCBlockSizeAES128 - withMinKeySizeInBytes:kCCKeySizeAES128 - withMaxKeySizeInBytes:kCCKeySizeAES128 - withContextSize:kCCContextSizeAES128 - withUnitTest:testObject - ] autorelease]; - - [result addObject:aes128Test]; - - // ============================ AES192 ========================= - - CCEncryptionTest* aes192Test = [[[CCEncryptionTest alloc] - initWithEncryptionName:@"AES192" - withEncryptionAlgo:kCCAlgorithmAES128 - withBlockSize:kCCBlockSizeAES128 - withMinKeySizeInBytes:kCCKeySizeAES192 - withMaxKeySizeInBytes:kCCKeySizeAES192 - withContextSize:kCCContextSizeAES128 - withUnitTest:testObject - ] autorelease]; - - [result addObject:aes192Test]; - - // ============================ AES256 ========================= - - CCEncryptionTest* aes256Test = [[[CCEncryptionTest alloc] - initWithEncryptionName:@"AES256" - withEncryptionAlgo:kCCAlgorithmAES128 - withBlockSize:kCCBlockSizeAES128 - withMinKeySizeInBytes:kCCKeySizeAES256 - withMaxKeySizeInBytes:kCCKeySizeAES256 - withContextSize:kCCContextSizeAES128 - withUnitTest:testObject - ] autorelease]; - - [result addObject:aes256Test]; - - // ============================= CAST ========================== - - CCEncryptionTest* castTest = [[[CCEncryptionTest alloc] - initWithEncryptionName:@"CAST" - withEncryptionAlgo:kCCAlgorithmCAST - withBlockSize:kCCBlockSizeCAST - withMinKeySizeInBytes:kCCKeySizeMinCAST - withMaxKeySizeInBytes:kCCKeySizeMaxCAST - withContextSize:kCCContextSizeCAST - withUnitTest:testObject - ] autorelease]; - - [result addObject:castTest]; - - // ============================== RC4 ========================== - - CCEncryptionTest* rc4Test = [[[CCEncryptionTest alloc] - initWithEncryptionName:@"RC4" - withEncryptionAlgo:kCCAlgorithmRC4 - withBlockSize:0 - withMinKeySizeInBytes:kCCKeySizeMinRC4 - withMaxKeySizeInBytes:kCCKeySizeMaxRC4 - withContextSize:kCCContextSizeRC4 - withUnitTest:testObject - ] autorelease]; - - [result addObject:rc4Test]; - - return result; -} - -- (id)initWithEncryptionName:(NSString *)name - withEncryptionAlgo:(CCAlgorithm)encrAlg - withBlockSize:(uint32)blockSize - withMinKeySizeInBytes:(uint32)minKeySizeInBytes - withMaxKeySizeInBytes:(uint32)maxKeySizeInBytes - withContextSize:(size_t)ctxSize - withUnitTest:(id)testObject -{ - if ((self = [super init])) - { - _encrAlg = encrAlg; - _blockSize = blockSize; - _minKeySizeInBytes = minKeySizeInBytes; - _maxKeySizeInBytes = maxKeySizeInBytes; - _ctxSize = ctxSize; - _algName = [name copy]; - _testObject = [testObject retain]; - _testPassed = YES; - } - return self; -} - -- (void)dealloc -{ - [_algName release]; - [_testObject release]; - [super dealloc]; -} - -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr -{ - if (nil != self.testObject) - { - [self.testObject doAssertTest:result errorString:errorStr]; - return; - } - - if (_testPassed) - { - _testPassed = result; - } -} - - - -- (void)runTest -{ - int iResult = DoTesting(self); - [self doAssertTest:(iResult == 0) errorString:[NSString stringWithFormat:@"%@ test failed", _algName]]; - - if (nil == _testObject) - { - printf("EncryptionTest: %s\n", (self.testPassed) ? "Passed" : "Failed"); - } -} - -@end - - -static void appGetRandomBytes(void* dest, uint32 numBytes) -{ - NSAutoreleasePool *pool = [NSAutoreleasePool new]; - NSData* tempResult = [[CCRandomNumberService defaultRandomNumberService] generateRandomDataOfSize:numBytes]; - memcpy(dest, [tempResult bytes], numBytes); - [pool drain]; -} - - -static void printCCError(NSString* str, CCCryptorStatus crtn, id unitTest) -{ - NSString* errStr; - - switch(crtn) - { - case kCCSuccess: errStr = @"kCCSuccess"; break; - case kCCParamError: errStr = @"kCCParamError"; break; - case kCCBufferTooSmall: errStr = @"kCCBufferTooSmall"; break; - case kCCMemoryFailure: errStr = @"kCCMemoryFailure"; break; - case kCCAlignmentError: errStr = @"kCCAlignmentError"; break; - case kCCDecodeError: errStr = @"kCCDecodeError"; break; - case kCCUnimplemented: errStr = @"kCCUnimplemented"; break; - default: - errStr = [NSString stringWithFormat:@"Unknown(%ld)", (long)crtn]; - break; - } - NSString* outputStr = nil; - if (NULL != str) - { - outputStr = [NSString stringWithFormat:@"%@ %@", str, errStr]; - } - else - { - outputStr = errStr; - } - - [unitTest doAssertTest:NO errorString:outputStr]; -} - -/* max context size */ -#define CC_MAX_CTX_SIZE kCCContextSizeRC4 - -/* - * We write a marker at end of expected output and at end of caller-allocated - * CCCryptorRef, and check at the end to make sure they weren't written - */ -#define MARKER_LENGTH 8 -#define MARKER_BYTE 0x7e - -/* - * Test harness for CCCryptor with lots of options. - */ -CCCryptorStatus doCCCrypt( - bool forEncrypt, - CCAlgorithm encrAlg, - bool doCbc, - bool doPadding, - const void *keyBytes, size_t keyLen, - const void *iv, - bool randUpdates, - bool inPlace, /* !doPadding only */ - size_t ctxSize, /* if nonzero, we allocate ctx */ - bool askOutSize, - const uint8_t *inText, size_t inTextLen, - uint8_t **outText, size_t *outTextLen, /* both returned, WE malloc */ - id unitTest) -{ - CCCryptorRef cryptor = NULL; - CCCryptorStatus crtn; - CCOperation op = forEncrypt ? kCCEncrypt : kCCDecrypt; - CCOptions options = 0; - uint8_t *outBuf = NULL; /* mallocd output buffer */ - uint8_t *outp; /* running ptr into outBuf */ - const uint8 *inp; /* running ptr into inText */ - size_t outLen; /* bytes remaining in outBuf */ - size_t toMove; /* bytes remaining in inText */ - size_t thisMoveOut; /* output from CCCryptUpdate()/CCCryptFinal() */ - size_t outBytes; /* total bytes actually produced in outBuf */ - char ctx[CC_MAX_CTX_SIZE]; /* for CCCryptorCreateFromData() */ - uint8_t *textMarker = NULL; /* 8 bytes of marker here after expected end of - * output */ - char *ctxMarker = NULL; /* ditto for caller-provided context */ - unsigned dex; - size_t askedOutSize; /* from the lib */ - size_t thisOutLen; /* dataOutAvailable we use */ - - - if(!doCbc) - { - options |= kCCOptionECBMode; - } - - if(doPadding) - { - options |= kCCOptionPKCS7Padding; - } - - /* just hack this one */ - outLen = inTextLen; - if(forEncrypt) - { - outLen += MAX_BLOCK_SIZE; - } - - outBuf = (uint8_t *)malloc(outLen + MARKER_LENGTH); - - /* library should not touch this memory */ - textMarker = outBuf + outLen; - memset(textMarker, MARKER_BYTE, MARKER_LENGTH); - - /* subsequent errors to errOut: */ - - if(inPlace) - { - memmove(outBuf, inText, inTextLen); - inp = outBuf; - } - else - { - inp = inText; - } - - if(!randUpdates) - { - /* one shot */ - if(askOutSize) - { - crtn = CCCrypt(op, encrAlg, options, - keyBytes, keyLen, iv, - inp, inTextLen, - outBuf, 0, &askedOutSize); - if(crtn != kCCBufferTooSmall) - { - NSString* errStr = [NSString stringWithFormat:@"CCCrypt: ***Did not get kCCBufferTooSmall as expected\n alg %d inTextLen %lu cbc %d padding %d keyLen %lu", - (int)encrAlg, (unsigned long)inTextLen, (int)doCbc, (int)doPadding, - (unsigned long)keyLen]; - - printCCError(errStr, crtn, unitTest); - crtn = -1; - goto errOut; - } - outLen = askedOutSize; - } - crtn = CCCrypt(op, encrAlg, options, - keyBytes, keyLen, iv, - inp, inTextLen, - outBuf, outLen, &outLen); - if(crtn) - { - printCCError(@"CCCrypt", crtn, unitTest); - goto errOut; - } - - [unitTest doAssertTest:(outLen != 0) errorString:@"output length should be non-zero for encryption operation"]; - *outText = outBuf; - *outTextLen = outLen; - goto errOut; - } - - /* random multi updates */ - if(ctxSize) { - size_t ctxSizeCreated; - - if(askOutSize) - { - crtn = CCCryptorCreateFromData(op, encrAlg, options, - keyBytes, keyLen, iv, - ctx, 0 /* ctxSize */, - &cryptor, &askedOutSize); - if(crtn != kCCBufferTooSmall) - { - printCCError(@"CCCryptorCreateFromData: ***Did not get kCCBufferTooSmall as expected", crtn, unitTest); - crtn = -1; - goto errOut; - } - ctxSize = askedOutSize; - } - crtn = CCCryptorCreateFromData(op, encrAlg, options, - keyBytes, keyLen, iv, - ctx, ctxSize, &cryptor, &ctxSizeCreated); - if(crtn) - { - printCCError(@"CCCryptorCreateFromData", crtn, unitTest); - return crtn; - } - ctxMarker = ctx + ctxSizeCreated; - memset(ctxMarker, MARKER_BYTE, MARKER_LENGTH); - } - else - { - crtn = CCCryptorCreate(op, encrAlg, options, - keyBytes, keyLen, iv, - &cryptor); - if(crtn) - { - printCCError(@"CCCryptorCreate", crtn, unitTest); - return crtn; - } - } - - toMove = inTextLen; /* total to go */ - outp = outBuf; - outBytes = 0; /* bytes actually produced in outBuf */ - - while(toMove) - { - uint32 thisMoveIn; /* input to CCryptUpdate() */ - - thisMoveIn = [[CCRandomNumberService defaultRandomNumberService] - generateRandomNumberInRange:1 toMax:toMove]; - if(askOutSize) - { - thisOutLen = CCCryptorGetOutputLength(cryptor, thisMoveIn, false); - } - else - { - thisOutLen = outLen; - } - crtn = CCCryptorUpdate(cryptor, inp, thisMoveIn, - outp, thisOutLen, &thisMoveOut); - if(crtn) - { - printCCError(@"CCCryptorUpdate", crtn, unitTest); - goto errOut; - } - inp += thisMoveIn; - toMove -= thisMoveIn; - outp += thisMoveOut; - outLen -= thisMoveOut; - outBytes += thisMoveOut; - } - - if(doPadding) - { - /* Final is not needed if padding is disabled */ - if(askOutSize) - { - thisOutLen = CCCryptorGetOutputLength(cryptor, 0, true); - } - else - { - thisOutLen = outLen; - } - crtn = CCCryptorFinal(cryptor, outp, thisOutLen, &thisMoveOut); - } - else - { - thisMoveOut = 0; - crtn = kCCSuccess; - } - - if(crtn) - { - printCCError(@"CCCryptorFinal", crtn, unitTest); - goto errOut; - } - - outBytes += thisMoveOut; - *outText = outBuf; - *outTextLen = outBytes; - crtn = kCCSuccess; - - for(dex=0; dex unitTest) -{ - uint8_t keyBytes[MAX_KEY_SIZE]; - uint8_t iv[MAX_BLOCK_SIZE]; - uint8_t *ivPtrEncrypt; - uint8_t *ivPtrDecrypt; - uint8_t *ctext = NULL; /* mallocd by doCCCrypt */ - size_t ctextLen = 0; - uint8_t *rptext = NULL; /* mallocd by doCCCrypt */ - size_t rptextLen; - CCCryptorStatus crtn; - int rtn = 0; - - /* random key */ - appGetRandomBytes(keyBytes, keySizeInBytes); - - /* random IV if needed */ - if(doCbc) - { - if(nullIV) - { - memset(iv, 0, MAX_BLOCK_SIZE); - - /* flip a coin, give one side NULL, the other size zeroes */ - - if ([[CCRandomNumberService defaultRandomNumberService] - generateRandomNumberInRange:1 toMax:2] == 1) - { - ivPtrEncrypt = NULL; - ivPtrDecrypt = iv; - } - else - { - ivPtrEncrypt = iv; - ivPtrDecrypt = NULL; - } - } - else - { - appGetRandomBytes(iv, MAX_BLOCK_SIZE); - ivPtrEncrypt = iv; - ivPtrDecrypt = iv; - } - } - else - { - ivPtrEncrypt = NULL; - ivPtrDecrypt = NULL; - } - - crtn = doCCCrypt(true, encrAlg, doCbc, doPadding, - keyBytes, keySizeInBytes, ivPtrEncrypt, - stagedEncr, inPlace, ctxSize, askOutSize, - ptext, ptextLen, - &ctext, &ctextLen, unitTest); - if(crtn) - { - rtn = 1; - goto abort; - } - - crtn = doCCCrypt(false, encrAlg, doCbc, doPadding, - keyBytes, keySizeInBytes, ivPtrDecrypt, - stagedDecr, inPlace, ctxSize, askOutSize, - ctext, ctextLen, - &rptext, &rptextLen, unitTest); - if(crtn) - { - rtn = 1; - goto abort; - } - - /* compare ptext, rptext */ - if(ptextLen != rptextLen) - { - NSString* errStr = [NSString stringWithFormat:@"Ptext length mismatch: expect %lu, got %lu\n", ptextLen, rptextLen]; - [unitTest doAssertTest:NO errorString:errStr]; - rtn = 1; - goto abort; - - } - - if(memcmp(ptext, rptext, ptextLen)) - { - [unitTest doAssertTest:NO errorString:@"***data miscompare"]; - rtn = 1; - } - -abort: - if(ctext) - { - free(ctext); - } - if(rptext) - { - free(rptext); - } - return rtn; -} - -bool isBitSet(unsigned bit, unsigned word) -{ - if(bit > 31) - { - NSLog(@"We don't have that many bits"); - exit(1); - } - unsigned mask = 1 << bit; - return (word & mask) ? true : false; -} - -int DoTesting(CCEncryptionTest* unitTest) -{ - unsigned loop; - uint8 *ptext; - size_t ptextLen; - bool stagedEncr; - bool stagedDecr; - bool doPadding; - bool doCbc; - bool nullIV; - const char *algStr; - CCAlgorithm encrAlg; - uint32 minKeySizeInBytes; - uint32 maxKeySizeInBytes; - uint32 keySizeInBytes; - int rtn = 0; - uint32 blockSize; // for noPadding case - size_t ctxSize; // always set per alg - size_t ctxSizeUsed; // passed to doTest - bool askOutSize; // inquire output size each op - - /* - * User-spec'd params - */ - bool keySizeSpec = false; // false: use rand key size - unsigned loops = LOOPS_DEF; - size_t minPtextSize = MIN_DATA_SIZE; - size_t maxPtextSize = MAX_DATA_SIZE; - bool quiet = false; - bool paddingSpec = false; // true: user calls doPadding, const - bool cbcSpec = false; // ditto for doCbc - bool stagedSpec = false; // ditto for stagedEncr and stagedDecr - bool inPlace = false; // en/decrypt in place for ECB - bool allocCtxSpec = false; // use allocCtx - bool allocCtx = false; // allocate context ourself - - - ptext = (uint8 *)malloc(maxPtextSize); - if(ptext == NULL) - { - [unitTest doAssertTest:NO errorString:@"Insufficient heap space"]; - exit(1); - } - /* ptext length set in test loop */ - - /* Set up the values for this test from the object */ - encrAlg = unitTest.encrAlg; - blockSize = unitTest.blockSize; - minKeySizeInBytes = unitTest.minKeySizeInBytes; - maxKeySizeInBytes = unitTest.maxKeySizeInBytes; - ctxSize = unitTest.ctxSize; - algStr = [unitTest.algName UTF8String]; - - for(loop=1; ; loop++) - { - ptextLen = [[CCRandomNumberService defaultRandomNumberService] - generateRandomNumberInRange:minPtextSize toMax:maxPtextSize]; - appGetRandomBytes(ptext, ptextLen); - - /* per-loop settings */ - if(!keySizeSpec) - { - if(minKeySizeInBytes == maxKeySizeInBytes) - { - keySizeInBytes = minKeySizeInBytes; - } - else - { - keySizeInBytes = [[CCRandomNumberService defaultRandomNumberService] - generateRandomNumberInRange:minKeySizeInBytes toMax:maxKeySizeInBytes]; - } - } - if(blockSize == 0) - { - /* stream cipher */ - doCbc = false; - doPadding = false; - } - else - { - if(!cbcSpec) - { - doCbc = isBitSet(0, loop); - } - if(!paddingSpec) - { - doPadding = isBitSet(1, loop); - } - } - if(!doPadding && (blockSize != 0)) - { - /* align plaintext */ - ptextLen = (ptextLen / blockSize) * blockSize; - if(ptextLen == 0) - { - ptextLen = blockSize; - } - } - if(!stagedSpec) - { - stagedEncr = isBitSet(2, loop); - stagedDecr = isBitSet(3, loop); - } - if(doCbc) - { - nullIV = isBitSet(4, loop); - } - else - { - nullIV = false; - } - inPlace = isBitSet(5, loop); - if(allocCtxSpec) - { - ctxSizeUsed = allocCtx ? ctxSize : 0; - } - else if(isBitSet(6, loop)) - { - ctxSizeUsed = ctxSize; - } - else - { - ctxSizeUsed = 0; - } - askOutSize = isBitSet(7, loop); - - - if(doTest(ptext, ptextLen, - encrAlg, doCbc, doPadding, nullIV, - keySizeInBytes, - stagedEncr, stagedDecr, inPlace, ctxSizeUsed, askOutSize, - quiet, unitTest)) - { - rtn = 1; - break; - } - - if(loops && (loop == loops)) - { - break; - } - - if(rtn) - { - break; - } - - } /* for algs */ - - free(ptext); - return rtn; -} DELETED UnitTestSource/HMACTest.h Index: UnitTestSource/HMACTest.h ================================================================== --- UnitTestSource/HMACTest.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// HMACTest.h -// CommonCrypto -// -// Created by Jim Murphy on 1/14/10. -// Copyright 2010 Apple. All rights reserved. -// - -#import -#include "CommonHMAC.h" -#import "TestToolProtocol.h" - -/* -------------------------------------------------------------------------- - Class: CCHMACTestObject - Description: This class provides for testing a HMAC type - -------------------------------------------------------------------------- */ - -@interface CCHMACTestObject : NSObject -{ - NSString* _nameHMAC; // The name of the HMAC type - CCHmacAlgorithm _algoHMAC; // The HMAC algorithm - NSData* _keyMaterial; // The key for the HMAC - NSData* _stagedResult; // Result of the staged HMAC - NSData* _oneShotResult; // Result of the 'one shot' HMAC - NSData* _dataHMAC; // Data to be HMACed - unsigned int _digestBufferSize; // The size of the output buffer - void* _digestBuffer; // The output buffer for the digest - CCHmacContext _context; // Working HMAC buffer - id - _testObject; // The owning test object NOT retained - BOOL _testPassed; -} - -@property (readonly) NSString* nameHMAC; -@property (readonly) CCHmacAlgorithm algoHMAC; -@property (readonly) NSData* keyMaterial; -@property (readonly) NSData* stagedResult; -@property (readonly) NSData* oneShotResult; -@property (readonly) NSData* dataHMAC; -@property (readonly) void* digestBuffer; -@property (readonly) id testObject; -@property (readonly) BOOL testPassed; - - -+ (NSArray *)setupHMACTests:(id)testObject; - -- (id)initWithHMACName:(NSString *)name - withCCHmacAlgorithm:(CCHmacAlgorithm)algo - withDigestSize:(unsigned int)digestSize - withTestObject:(id)testObject; - -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr; - -- (void)runTest; - -@end DELETED UnitTestSource/HMACTest.mm Index: UnitTestSource/HMACTest.mm ================================================================== --- UnitTestSource/HMACTest.mm +++ /dev/null @@ -1,261 +0,0 @@ -// -// HMACTest.mm -// CommonCrypto -// -// Created by Jim Murphy on 1/14/10. -// Copyright 2010 Apple. All rights reserved. -// - -#import "HMACTest.h" -#import "RandomNumberService.h" -#import "CommonHMAC.h" -#include - -// completely arbitrary -#define kMIN_KEY_LENGTH 0 -#define kMAX_KEY_LENGTH 512 - -#define kMIN_DATA_LENGTH 16 -#define kMAC_DATA_LENGTH 0x8000 - -@implementation CCHMACTestObject - -@synthesize nameHMAC = _nameHMAC; -@synthesize algoHMAC = _algoHMAC; -@synthesize keyMaterial = _keyMaterial; -@synthesize stagedResult = _stagedResult; -@synthesize oneShotResult = _oneShotResult; -@synthesize dataHMAC = _dataHMAC; -@synthesize testObject = _testObject; -@synthesize digestBuffer = _digestBuffer; -@synthesize testPassed = _testPassed; - - -/* -------------------------------------------------------------------------- - method: setupHMACTests - returns: NSArray * - decription: This method allows for creating digest specific tests for - all of the digest supported by the CommonCrypto library. - It creates an instance of the CCDigestTestObject for - each digest to be tested and places that object into - an NSArray. - -------------------------------------------------------------------------- */ -+ (NSArray *)setupHMACTests:(id)testObject; -{ - - NSMutableArray* result = [NSMutableArray array]; // autoreleased - - // ======================= SHA1 HMAC ========================== - - CCHMACTestObject* sha1HMACTest = [[[CCHMACTestObject alloc] initWithHMACName:@"Sha1HMAC" - withCCHmacAlgorithm:kCCHmacAlgSHA1 withDigestSize:CC_SHA1_DIGEST_LENGTH - withTestObject:testObject] autorelease]; - - [result addObject:sha1HMACTest]; - - // ======================= MD5 HMAC ========================== - - CCHMACTestObject* md5HMACTest = [[[CCHMACTestObject alloc] initWithHMACName:@"md5HMAC" - withCCHmacAlgorithm:kCCHmacAlgMD5 withDigestSize:CC_MD5_DIGEST_LENGTH - withTestObject:testObject] autorelease]; - - [result addObject:md5HMACTest]; - - // ====================== SHA256 HMAC ========================= - - CCHMACTestObject* sha256HMACTest = [[[CCHMACTestObject alloc] initWithHMACName:@"Sha256HMAC" - withCCHmacAlgorithm:kCCHmacAlgSHA256 withDigestSize:CC_SHA256_DIGEST_LENGTH - withTestObject:testObject] autorelease]; - - [result addObject:sha256HMACTest]; - - // ====================== SHA384 HMAC ========================= - - CCHMACTestObject* sha384HMACTest = [[[CCHMACTestObject alloc] initWithHMACName:@"Sha384HMAC" - withCCHmacAlgorithm:kCCHmacAlgSHA384 withDigestSize:CC_SHA384_DIGEST_LENGTH - withTestObject:testObject] autorelease]; - - [result addObject:sha384HMACTest]; - - // ====================== SHA512 HMAC ========================= - - CCHMACTestObject* sha512HMACTest = [[[CCHMACTestObject alloc] initWithHMACName:@"Sha512HMAC" - withCCHmacAlgorithm:kCCHmacAlgSHA512 withDigestSize:CC_SHA512_DIGEST_LENGTH - withTestObject:testObject] autorelease]; - - [result addObject:sha512HMACTest]; - - // ====================== SHA224 HMAC ========================= - - CCHMACTestObject* sha224HMACTest = [[[CCHMACTestObject alloc] initWithHMACName:@"Sha224HMAC" - withCCHmacAlgorithm:kCCHmacAlgSHA224 withDigestSize:CC_SHA224_DIGEST_LENGTH - withTestObject:testObject] autorelease]; - - [result addObject:sha224HMACTest]; - - - return result; -} - - -- (id)initWithHMACName:(NSString *)name - withCCHmacAlgorithm:(CCHmacAlgorithm)algo - withDigestSize:(unsigned int)digestSize - withTestObject:(id)testObject - -{ - if ((self = [super init])) - { - _testPassed = YES; - - _nameHMAC = [name copy]; - _algoHMAC = algo; - - CCRandomNumberService* randService = [CCRandomNumberService defaultRandomNumberService]; - - unsigned int bufferSize = [randService generateRandomNumberInRange:kMIN_KEY_LENGTH toMax:kMAX_KEY_LENGTH]; - _keyMaterial = [[randService generateRandomDataOfSize:bufferSize] copy]; - - _stagedResult = nil; - _oneShotResult = nil; - - bufferSize = [randService generateRandomNumberInRange:kMIN_DATA_LENGTH toMax:kMAC_DATA_LENGTH]; - _dataHMAC = [[randService generateRandomDataOfSize:bufferSize] copy]; - - _digestBufferSize = digestSize; - _digestBuffer = malloc(_digestBufferSize); - - _testObject = [testObject retain]; - } - return self; - -} - - -/* -------------------------------------------------------------------------- - method: dealloc - returns: void - decription: Alway put away your toys when you are done playing with - them. - -------------------------------------------------------------------------- */ -- (void)dealloc -{ - [_keyMaterial release]; - [_stagedResult release]; - [_oneShotResult release]; - [_dataHMAC release]; - [_testObject release]; - if (NULL != _digestBuffer) - { - free(_digestBuffer); - _digestBuffer = NULL; - } - [super dealloc]; -} - -- (CCHmacContext *)context -{ - return &_context; -} - -- (void)clearContext -{ - memset(&_context, 0, sizeof(_context)); - memset(_digestBuffer, 0, _digestBufferSize); -} - -/* -------------------------------------------------------------------------- - method: doStaged - returns: void - decription: Do the staged digest creation for this test placing the - result into the _stagedResult member - -------------------------------------------------------------------------- */ -- (void)doStaged -{ - [self clearContext]; - - CCHmacInit([self context], self.algoHMAC, [self.keyMaterial bytes], - [self.keyMaterial length]); - - unsigned int dataLength = [self.dataHMAC length]; - unsigned int thisMove; - - const unsigned char* raw_bytes = (const unsigned char*)[self.dataHMAC bytes]; - - CCRandomNumberService* randNumService = [CCRandomNumberService defaultRandomNumberService]; - - while (dataLength) - { - thisMove = [randNumService generateRandomNumberInRange:1 toMax:dataLength]; - - CCHmacUpdate([self context], raw_bytes, thisMove); - - raw_bytes += thisMove; - - dataLength -= thisMove; - } - - CCHmacFinal([self context], _digestBuffer); - [_stagedResult release]; - _stagedResult = [[NSData alloc] initWithBytes:_digestBuffer length:_digestBufferSize]; -} - - -/* -------------------------------------------------------------------------- - method: doOneShot - returns: void - decription: Do the 'one shot' digest creation for this test placing the - result into the _oneShotResult member - -------------------------------------------------------------------------- */ -- (void)doOneShot -{ - [self clearContext]; - CCHmac(self.algoHMAC, [self.keyMaterial bytes], [self.keyMaterial length], - [self.dataHMAC bytes], [self.dataHMAC length], _digestBuffer); - - [_oneShotResult release]; - _oneShotResult = [[NSData alloc] initWithBytes:_digestBuffer length:_digestBufferSize]; - -} - -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr -{ - if (nil != self.testObject) - { - [self.testObject doAssertTest:result errorString:errorStr]; - return; - } - - if (_testPassed) - { - _testPassed = result; - } -} - - -/* -------------------------------------------------------------------------- - method: runTest - returns: void - decription: Do the testing of the digest by creating both a staged - and one shot digest from the same data and ensuring - that the two digests match - -------------------------------------------------------------------------- */ -- (void)runTest -{ - [self doOneShot]; - [self doStaged]; - - BOOL testResult = [self.stagedResult isEqualToData:self.oneShotResult]; - - [self doAssertTest:testResult errorString:[ - NSString stringWithFormat:@"Staged Result is not equal to the one shot result for digest type %@", self.nameHMAC]]; - - if (nil == _testObject) - { - printf("HMACTest: %s\n", (self.testPassed) ? "Passed" : "Failed"); - } - -} - -@end - DELETED UnitTestSource/PBKDFTest.h Index: UnitTestSource/PBKDFTest.h ================================================================== --- UnitTestSource/PBKDFTest.h +++ /dev/null @@ -1,68 +0,0 @@ -// -// PBKDFTest.h -// CommonCrypto -// -// Created by Richard Murphy on 2/3/10. -// Copyright 2010 McKenzie-Murphy. All rights reserved. -// - -#import -#include "CommonKeyDerivation.h" -#import "TestToolProtocol.h" - -/* -------------------------------------------------------------------------- - Class: CCDerviationTestObject - Description: This class provides for testing a PBKDF type - -------------------------------------------------------------------------- */ - -@interface CCDerviationTestObject : NSObject -{ - NSString* _namePBKDF; // The name of the PBKDF type - CCPBKDFAlgorithm _algoPBKDF; // The PBKDF algorithm - NSData* _password; // The password for the PBKDF - NSData* _salt; // The salt for the PBKDF - CCPseudoRandomAlgorithm _prf; // The PRF to use with the PBKDF - uint _rounds; // The number of rounds for the PBKDF - uint8_t _derivedKey[1024]; // Max buffer for derived key from function under test - NSData* _derivedResult; // Result of the staged PBKDF - NSData* _expectedResult; // The expected result - id _testObject; // The owning test object NOT retained - BOOL _testPassed; - -} - -@property (readonly) NSString* namePBKDF; -@property (readonly) CCPBKDFAlgorithm algoPBKDF; -@property (readonly) NSData* password; -@property (readonly) NSData* salt; -@property (readonly) CCPseudoRandomAlgorithm prf; -@property (readonly) uint rounds; -@property (readonly) NSData* derivedResult; -@property (readonly) NSData* expectedResult; -@property (readonly) id testObject; -@property (readonly) BOOL testPassed; - - -+ (NSArray *)setupPBKDFTests:(id)testObject; - -- (id)initWithPBKDFName:(NSString *)name - withCCPBKDFAlgorithm:(CCPBKDFAlgorithm) algo - withPassword:(NSData *) password - withSalt:(NSData *) salt - withCCPseudoRandomAlgorithm:(CCPseudoRandomAlgorithm) prf - withRounds:(uint)rounds - withExpectedResult:(NSData *)expectedResult - withTestObject:(id)testObject; - -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr; - -- (void)runTest; - - -struct test_vector { - u_int rounds; - const char *pass; - const char *salt; - const char expected[32]; -}; -@end DELETED UnitTestSource/PBKDFTest.mm Index: UnitTestSource/PBKDFTest.mm ================================================================== --- UnitTestSource/PBKDFTest.mm +++ /dev/null @@ -1,208 +0,0 @@ -// -// PBKDFTest.mm -// CommonCrypto -// -// Created by Richard Murphy on 2/3/10. -// Copyright 2010 McKenzie-Murphy. All rights reserved. -// - -#import "PBKDFTest.h" -#include - - -@implementation CCDerviationTestObject - -@synthesize namePBKDF = _namePBKDF; -@synthesize algoPBKDF = _algoPBKDF; -@synthesize password = _password; -@synthesize salt = _salt; -@synthesize prf = _prf; -@synthesize rounds = _rounds; -@synthesize derivedResult = _derivedResult; -@synthesize expectedResult = _expectedResult; -@synthesize testObject = _testObject; -@synthesize testPassed = _testPassed; - - -/* -------------------------------------------------------------------------- - method: setupPBKDFTests - returns: NSArray * - decription: This method allows for creating digest specific tests for - all of the digest supported by the CommonCrypto library. - It creates an instance of the CCDigestTestObject for - each digest to be tested and places that object into - an NSArray. - -------------------------------------------------------------------------- */ -+ (NSArray *)setupPBKDFTests:(id)testObject; -{ - - NSMutableArray* result = [NSMutableArray array]; // autoreleased - - /* - * Test vectors from RFC 3962 - */ - - struct test_vector test_vectors[] = { - { - 1, "password", "ATHENA.MIT.EDUraeburn", { - 0xcd, 0xed, 0xb5, 0x28, 0x1b, 0xb2, 0xf8, 0x01, 0x56, 0x5a, 0x11, 0x22, 0xb2, 0x56, 0x35, 0x15, - 0x0a, 0xd1, 0xf7, 0xa0, 0x4b, 0xb9, 0xf3, 0xa3, 0x33, 0xec, 0xc0, 0xe2, 0xe1, 0xf7, 0x08, 0x37 }, - }, { - 2, "password", "ATHENA.MIT.EDUraeburn", { - 0x01, 0xdb, 0xee, 0x7f, 0x4a, 0x9e, 0x24, 0x3e, 0x98, 0x8b, 0x62, 0xc7, 0x3c, 0xda, 0x93, 0x5d, - 0xa0, 0x53, 0x78, 0xb9, 0x32, 0x44, 0xec, 0x8f, 0x48, 0xa9, 0x9e, 0x61, 0xad, 0x79, 0x9d, 0x86 }, - }, { - 1200, "password", "ATHENA.MIT.EDUraeburn", { - 0x5c, 0x08, 0xeb, 0x61, 0xfd, 0xf7, 0x1e, 0x4e, 0x4e, 0xc3, 0xcf, 0x6b, 0xa1, 0xf5, 0x51, 0x2b, - 0xa7, 0xe5, 0x2d, 0xdb, 0xc5, 0xe5, 0x14, 0x2f, 0x70, 0x8a, 0x31, 0xe2, 0xe6, 0x2b, 0x1e, 0x13 }, - }, { - 5, "password", "\0224VxxV4\022", /* 0x1234567878563412 */ { - 0xd1, 0xda, 0xa7, 0x86, 0x15, 0xf2, 0x87, 0xe6, 0xa1, 0xc8, 0xb1, 0x20, 0xd7, 0x06, 0x2a, 0x49, - 0x3f, 0x98, 0xd2, 0x03, 0xe6, 0xbe, 0x49, 0xa6, 0xad, 0xf4, 0xfa, 0x57, 0x4b, 0x6e, 0x64, 0xee }, - }, { 1200, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "pass phrase equals block size", { - 0x13, 0x9c, 0x30, 0xc0, 0x96, 0x6b, 0xc3, 0x2b, 0xa5, 0x5f, 0xdb, 0xf2, 0x12, 0x53, 0x0a, 0xc9, - 0xc5, 0xec, 0x59, 0xf1, 0xa4, 0x52, 0xf5, 0xcc, 0x9a, 0xd9, 0x40, 0xfe, 0xa0, 0x59, 0x8e, 0xd1 }, - }, { 1200, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "pass phrase exceeds block size", { - 0x9c, 0xca, 0xd6, 0xd4, 0x68, 0x77, 0x0c, 0xd5, 0x1b, 0x10, 0xe6, 0xa6, 0x87, 0x21, 0xbe, 0x61, - 0x1a, 0x8b, 0x4d, 0x28, 0x26, 0x01, 0xdb, 0x3b, 0x36, 0xbe, 0x92, 0x46, 0x91, 0x5e, 0xc8, 0x2a }, - }, { 50, "\360\235\204\236", /* g-clef (0xf09d849e) */ "EXAMPLE.COMpianist", { - 0x6b, 0x9c, 0xf2, 0x6d, 0x45, 0x45, 0x5a, 0x43, 0xa5, 0xb8, 0xbb, 0x27, 0x6a, 0x40, 0x3b, 0x39, - 0xe7, 0xfe, 0x37, 0xa0, 0xc4, 0x1e, 0x02, 0xc2, 0x81, 0xff, 0x30, 0x69, 0xe1, 0xe9, 0x4f, 0x52 }, - }, { 1, "password", "salt", { - 0x0c, 0x60, 0xc8, 0x0f, 0x96, 0x1f, 0x0e, 0x71, 0xf3, 0xa9, 0xb5, 0x24, 0xaf, 0x60, 0x12, 0x06, - 0x2f, 0xe0, 0x37, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - } - }; - int nvecs = (sizeof(test_vectors) / sizeof(*test_vectors)); - int i; - - for(i=0; i< nvecs-1; i++) { - CCDerviationTestObject* pbkdfHMACSha1Test = [[[CCDerviationTestObject alloc] - initWithPBKDFName:@"pbkdfHMACSha1Test1" - withCCPBKDFAlgorithm: kCCPBKDF2 - withPassword: [[NSData alloc] initWithBytes:test_vectors[i].pass length:strlen(test_vectors[i].pass)] - withSalt: [[NSData alloc] initWithBytes:test_vectors[i].salt length:strlen(test_vectors[i].salt)] - withCCPseudoRandomAlgorithm: kCCPRFHmacAlgSHA1 - withRounds:(uint)test_vectors[i].rounds - withExpectedResult:[[NSData alloc] initWithBytes:test_vectors[i].expected length:32] - withTestObject:testObject] autorelease]; - [result addObject:pbkdfHMACSha1Test]; - } - - CCDerviationTestObject* pbkdfHMACSha1Test = [[[CCDerviationTestObject alloc] - initWithPBKDFName:@"pbkdfHMACSha1Test1" - withCCPBKDFAlgorithm: kCCPBKDF2 - withPassword: [[NSData alloc] initWithBytes:test_vectors[i].pass length:strlen(test_vectors[i].pass)] - withSalt: [[NSData alloc] initWithBytes:test_vectors[i].salt length:strlen(test_vectors[i].salt)] - withCCPseudoRandomAlgorithm: kCCPRFHmacAlgSHA1 - withRounds:(uint)test_vectors[i].rounds - withExpectedResult:[[NSData alloc] initWithBytes:test_vectors[i].expected length:20] - withTestObject:testObject] autorelease]; - [result addObject:pbkdfHMACSha1Test]; - - - return result; -} - - -- (id)initWithPBKDFName:(NSString *)namePBKDF - withCCPBKDFAlgorithm:(CCPBKDFAlgorithm) algoPBKDF - withPassword:(NSData *) password - withSalt:(NSData *) salt -withCCPseudoRandomAlgorithm:(CCPseudoRandomAlgorithm) prf - withRounds:(uint)rounds - withExpectedResult:(NSData *)expectedResult - withTestObject:(id)testObject; - -{ - if ((self = [super init])) - { - _namePBKDF = [namePBKDF copy]; - _algoPBKDF = algoPBKDF; - _password = [password copy]; - _salt = [salt copy]; - _prf = prf; - _rounds = rounds; - _expectedResult = [expectedResult copy]; - _testObject = testObject; - _testPassed = YES; - } - return self; - -} - - -/* -------------------------------------------------------------------------- - method: dealloc - returns: void - decription: Alway put away your toys when you are done playing with - them. - -------------------------------------------------------------------------- */ -- (void)dealloc -{ - [_namePBKDF release]; - [_password release]; - [_salt release]; - [_expectedResult release]; - [_derivedResult release]; - //[_testObject release]; - [super dealloc]; -} - -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr -{ - if (nil != self.testObject) - { - [self.testObject doAssertTest:result errorString:errorStr]; - return; - } - - if (_testPassed) - { - _testPassed = result; - } -} - -/* -------------------------------------------------------------------------- - method: doTest - returns: void - decription: Do the 'one shot' digest creation for this test placing the - result into the _oneShotResult member - -------------------------------------------------------------------------- */ -- (void)doVectorTest -{ - // [self clearContext]; - (void) CCKeyDerivationPBKDF(self.algoPBKDF, (const char *)[self.password bytes], [self.password length], - (const uint8_t *)[self.salt bytes], [self.salt length], - _prf, _rounds, - _derivedKey, [self.expectedResult length]); - - //[_derivedResult release]; - _derivedResult = [[NSData alloc] initWithBytes:_derivedKey length:[self.expectedResult length]]; - -} - -/* -------------------------------------------------------------------------- - method: runTest - returns: void - decription: Do the testing of the digest by creating both a staged - and one shot digest from the same data and ensuring - that the two digests match - -------------------------------------------------------------------------- */ -- (void)runTest -{ - [self doVectorTest]; - - BOOL testResult = [self.expectedResult isEqualToData:self.derivedResult]; - - [self doAssertTest:testResult errorString:[ - NSString stringWithFormat:@"Expected Result is not equal to the derived result in %@", self.namePBKDF]]; - - if (nil == _testObject) - { - printf("PBKDFTest: %s\n", (self.testPassed) ? "Passed" : "Failed"); - } -} - -@end - DELETED UnitTestSource/RandomNumberService.h Index: UnitTestSource/RandomNumberService.h ================================================================== --- UnitTestSource/RandomNumberService.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// RandomNumberService.h -// CommonCrypto -// -// Created by Jim Murphy on 1/12/10. -// Copyright 2010 Apple. All rights reserved. -// - -#import - - -/* -------------------------------------------------------------------------- - Class: CCRandomNumberService - Description: This class provides random number services for testing - Note: This should be in another shared file so that other unit - test code could use this service. For now it can remain - here for illustration - -------------------------------------------------------------------------- */ -@interface CCRandomNumberService : NSObject -{ - NSFileHandle* _devRandomFileHandle; // file handle for reading from /dev/random -} - -// Get the "default" Random number service -+ (CCRandomNumberService *)defaultRandomNumberService; - -// Release the default Random number service. NOTE: This is really -// an unsafe method. This should ONLY be called once. -+ (void)relaseDefaultRandomNumberService; - -// generate a random integer within a set range -- (unsigned int)generateRandomNumberInRange:(unsigned int)min - toMax:(unsigned int)max; - -// generate a random set of bytes of an arbitrary length -- (NSData *)generateRandomDataOfSize:(size_t)length; - -@end DELETED UnitTestSource/RandomNumberService.mm Index: UnitTestSource/RandomNumberService.mm ================================================================== --- UnitTestSource/RandomNumberService.mm +++ /dev/null @@ -1,130 +0,0 @@ -// -// RandomNumberService.mm -// CommonCrypto -// -// Created by Jim Murphy on 1/12/10. -// Copyright 2010 Apple. All rights reserved. -// - -#import "RandomNumberService.h" - - -// The one singleton representation of the RandomNumberService -static CCRandomNumberService* gDefaultRandomNumberService = nil; - -@implementation CCRandomNumberService - -/* -------------------------------------------------------------------------- - method: [class] defaultRandomNumberService - returns: CCRandomNumberService* - decription: This class method ensures a singleton instance for getting - random data for testing - -------------------------------------------------------------------------- */ -+ (CCRandomNumberService *) defaultRandomNumberService -{ - if (nil == gDefaultRandomNumberService) - { - gDefaultRandomNumberService = [CCRandomNumberService new]; - } - - return gDefaultRandomNumberService; -} - -/* -------------------------------------------------------------------------- - method: [class] relaseDefaultRandomNumberService - returns: void - decription: Releases the singleton object - -------------------------------------------------------------------------- */ -+ (void)relaseDefaultRandomNumberService -{ - [gDefaultRandomNumberService release]; - gDefaultRandomNumberService = nil; -} - -/* -------------------------------------------------------------------------- - method: init - returns: id - decription: Initialize a new instance of the CCRandomNumberService - object. It ensure a singleton object for this service - -------------------------------------------------------------------------- */ -- (id)init -{ - if (nil != gDefaultRandomNumberService) - { - // This needs to be a singleton - // The correct thing here would be to - // complain but for now 'do the right thing' - [self release]; - self = gDefaultRandomNumberService; - } - else - { - // This is the normal path - if ((self = [super init])) - { - _devRandomFileHandle = [[NSFileHandle fileHandleForReadingAtPath:@"/dev/random"] retain]; - } - } - return self; -} - -/* -------------------------------------------------------------------------- - method: dealloc - returns: void - decription: Alway put away your toys when you are done playing with - them. - -------------------------------------------------------------------------- */ -- (void)dealloc -{ - [_devRandomFileHandle closeFile]; - [_devRandomFileHandle release]; - [super dealloc]; -} - -/* -------------------------------------------------------------------------- - method: generateRandomNumberInRange:toMax: - returns: unsigned int within the specified range - parameters: - min: - The minimum value to be returned - - max: - The maximum value to be returned - - decription: Returns a pesudo random number within a range. - -------------------------------------------------------------------------- */ -- (unsigned int)generateRandomNumberInRange:(unsigned int)min toMax:(unsigned int)max -{ - unsigned int result = 0L; - if (min == max) - { - result = min; - } - else - { - NSAutoreleasePool *pool = [NSAutoreleasePool new]; - NSData* randomData = [_devRandomFileHandle readDataOfLength:sizeof(result)]; - unsigned int temp_i = *((unsigned int *) [randomData bytes]); - result = (min + (temp_i % (max - min + 1))); - [pool drain]; - } - return result; -} - -/* -------------------------------------------------------------------------- - method: generateRandomDataOfSize:toMax: - returns: autorelased NSData of pesudo random data of the specified - size - parameters: - length: - The size in bytes of the data to be created - - decription: Returns a NSData of random data - -------------------------------------------------------------------------- */ -- (NSData *)generateRandomDataOfSize:(size_t)length -{ - NSData* randomData = [_devRandomFileHandle readDataOfLength:length]; - return randomData; -} - -@end DELETED UnitTestSource/SymmetricWrapTest.h Index: UnitTestSource/SymmetricWrapTest.h ================================================================== --- UnitTestSource/SymmetricWrapTest.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// SymmetricWrapTest.h -// CommonCrypto -// -// Created by Richard Murphy on 2/3/10. -// Copyright 2010 McKenzie-Murphy. All rights reserved. -// - -#import -#import "CommonSymmetricKeywrap.h" -#import "TestToolProtocol.h" - - -@interface CCSymmetricalWrapTest : NSObject -{ - id _testObject; // The owning test object NOT retained - BOOL _testPassed; - -} - -@property (readonly) id testObject; -@property (readonly) BOOL testPassed; - -+ (NSArray *)setupSymmWrapTests:(id)testObject; - -- (id)initWithTestObject:(id)testObject; - -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr; - -- (void)runTest; - -@end - DELETED UnitTestSource/SymmetricWrapTest.mm Index: UnitTestSource/SymmetricWrapTest.mm ================================================================== --- UnitTestSource/SymmetricWrapTest.mm +++ /dev/null @@ -1,150 +0,0 @@ -// -// SymmetricWrapTest.mm -// CommonCrypto -// -// Created by Richard Murphy on 2/3/10. -// Copyright 2010 McKenzie-Murphy. All rights reserved. -// - -#import "SymmetricWrapTest.h" -#include - - -@implementation CCSymmetricalWrapTest - -@synthesize testObject = _testObject; -@synthesize testPassed = _testPassed; - -+ (NSArray *)setupSymmWrapTests:(id)testObject -{ - - NSMutableArray* result = [NSMutableArray array]; // autoreleased - - CCSymmetricalWrapTest* wrapTest = [[[CCSymmetricalWrapTest alloc] initWithTestObject:testObject] autorelease]; - [result addObject:wrapTest]; - return result; -} - -- (id)initWithTestObject:(id)testObject -{ - - if ((self = [super init])) - { - _testPassed = YES; - _testObject = testObject; - - } - return self; -} - -- (void)dealloc -{ - [super dealloc]; - -} - -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr -{ - if (nil != self.testObject) - { - [self.testObject doAssertTest:result errorString:errorStr]; - return; - } - - if (_testPassed) - { - _testPassed = result; - } -} - - -- (void)runTest -{ - - uint8_t kek[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F - }; - - uint8_t key[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF - }; - - uint8_t wrapped_key[] = { - 0x1F, 0xA6, 0x8B, 0x0A, 0x81, 0x12, 0xB4, 0x47, - 0xAE, 0xF3, 0x4B, 0xD8, 0xFB, 0x5A, 0x7B, 0x82, - 0x9D, 0x3E, 0x86, 0x23, 0x71, 0xD2, 0xCF, 0xE5 - }; - - uint8_t wrapped[(128+64)/8]; - size_t wrapped_size = sizeof(wrapped); - uint8_t unwrapped[128/8]; - size_t unwrapped_size = sizeof(unwrapped); - - BOOL self_test = NO; // guilty until proven - - //rfc3394_wrap(kek, sizeof(kek), rfc3394_iv, key, sizeof(key), wrapped, &wrapped_size); - const uint8_t *iv = CCrfc3394_iv; - const size_t ivLen = CCrfc3394_ivLen; - - CCSymmetricKeyWrap(kCCWRAPAES, iv , ivLen, kek, sizeof(kek), key, sizeof(key), wrapped, &wrapped_size); - - self_test = (0 == memcmp(wrapped, wrapped_key, wrapped_size)); - [self doAssertTest:self_test errorString:@"Wrapped key does not match"]; - - //rfc3394_unwrap(kek, sizeof(kek), rfc3394_iv, wrapped, wrapped_size, unwrapped, &unwrapped_size); - CCSymmetricKeyUnwrap(kCCWRAPAES, iv, ivLen, kek, sizeof(kek), wrapped, wrapped_size, unwrapped, &unwrapped_size); - self_test = (0 == memcmp(unwrapped, key, sizeof(key))); - [self doAssertTest:self_test errorString:@"Unwrapped key does not match"]; - - if (nil == _testObject) - { - printf("SymmetricalWrapTestest: %s\n", (self.testPassed) ? "Passed" : "Failed"); - } - - /* - #if !KERNEL || AES256_KEK - { - uint8_t kek[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F - }; - uint8_t key[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F - }; - uint8_t wrapped_key[] = { - 0x28, 0xC9, 0xF4, 0x04, 0xC4, 0xB8, 0x10, 0xF4, - 0xCB, 0xCC, 0xB3, 0x5C, 0xFB, 0x87, 0xF8, 0x26, - 0x3F, 0x57, 0x86, 0xE2, 0xD8, 0x0E, 0xD3, 0x26, - 0xCB, 0xC7, 0xF0, 0xE7, 0x1A, 0x99, 0xF4, 0x3B, - 0xFB, 0x98, 0x8B, 0x9B, 0x7A, 0x02, 0xDD, 0x21 - }; - uint8_t wrapped[(256+64)/8]; - size_t wrapped_size = sizeof(wrapped); - uint8_t unwrapped[256/8]; - size_t unwrapped_size = sizeof(unwrapped); - bool self_test; - - rfc3394_wrap(kek, sizeof(kek), rfc3394_iv, key, sizeof(key), wrapped, &wrapped_size); - self_test = (0 == memcmp(wrapped, wrapped_key, wrapped_size)); - require(self_test, out); - printf("\nSELF-TEST %s\n\n", self_test ? "OK" : "FAIL"); - rfc3394_unwrap(kek, sizeof(kek), rfc3394_iv, wrapped, wrapped_size, unwrapped, &unwrapped_size); - self_test = (0 == memcmp(unwrapped, key, sizeof(key))); - require(self_test, out); - printf("\nSELF-TEST %s\n\n", self_test ? "OK" : "FAIL"); - } - #endif - */ - - -} - -@end - DELETED UnitTestSource/TestToolProtocol.h Index: UnitTestSource/TestToolProtocol.h ================================================================== --- UnitTestSource/TestToolProtocol.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// TestToolProtocol.h -// CommonCrypto -// -// Created by James Murphy on 10/28/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@protocol TestToolProtocol - -- (void)doAssertTest:(BOOL)result errorString:(NSString *)errorStr; - -@end DELETED UnitTestSource/main.mm Index: UnitTestSource/main.mm ================================================================== --- UnitTestSource/main.mm +++ /dev/null @@ -1,90 +0,0 @@ -/* - * main.mm - * CommonCrypto - * - * Created by James Murphy on 10/28/10. - * Copyright 2010 __MyCompanyName__. All rights reserved. - * - */ - -#import -#import "CommonCryptoUnitTests.h" -#import "DigestTest.h" -#import "CommonDigest.h" -#import "CommonCryptor.h" -#import "CommonHMAC.h" -#import "RandomNumberService.h" -#import "EncryptionTest.h" -#import "HMACTest.h" -#import "PBKDFTest.h" -#import "SymmetricWrapTest.h" -#import "CommonRandomSPI.h" - -int main (int argc, const char * argv[]) -{ - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - NSArray* digestTests = [CCDigestTestObject setupDigestTests:nil]; - - for (CCDigestTestObject* testObject in digestTests) - { - [testObject runTest]; - } - - NSArray* encryptionTests = [CCEncryptionTest setupEncryptionTests:nil]; - - for (CCEncryptionTest* aTest in encryptionTests) - { - [aTest runTest]; - } - - NSArray* hmacTests = [CCHMACTestObject setupHMACTests:nil]; - - for (CCHMACTestObject* aTest in hmacTests) - { - [aTest runTest]; - } - - NSArray* pbkdfTests = [CCDerviationTestObject setupPBKDFTests:nil]; - - for (CCDerviationTestObject* aTest in pbkdfTests) - { - [aTest runTest]; - } - - NSArray* SymmetricWrapTests = [CCSymmetricalWrapTest setupSymmWrapTests:nil]; - - for (CCSymmetricalWrapTest* aTest in SymmetricWrapTests) - { - [aTest runTest]; - } - - uint8_t bytes[1024]; - uint8_t previous[1024]; - int i; - - bzero(previous, 1024); - for(i = 0; i < 1024; i++) - { - int retval = CCRandomCopyBytes(kCCRandomDefault, bytes, 1024); - if(retval) - { - printf("CCRandomCopyBytes: Failed"); - } - - if(memcmp(previous, bytes, 1024) == 0) - { - printf("CCRandomCopyBytes: Failed"); - } - - memcpy(previous, bytes, 1024); - } - - [pool drain]; - return 0; -} - - - - - DELETED doc/CCCalibratePBKDF.3cc Index: doc/CCCalibratePBKDF.3cc ================================================================== --- doc/CCCalibratePBKDF.3cc +++ /dev/null @@ -1,1 +0,0 @@ -.so man3/CCCommonKeyDerivation.3cc DELETED doc/CCCommonKeyDerivation.3cc Index: doc/CCCommonKeyDerivation.3cc ================================================================== --- doc/CCCommonKeyDerivation.3cc +++ /dev/null @@ -1,135 +0,0 @@ -.Dd January 21, 2011 -.Dt CCCommonKeyDerivation.3cc -.Os -.Sh NAME -.Nm CCKeyDerivationPBKDF , -.Nm CCCalibratePBKDF -.Nd Common Key Derivation Interfaces -.Sh LIBRARY -These functions are found in libSystem. -.Sh SYNOPSIS -.In CommonCrypto/CommonKeyDerivation.h -.Ft int -.Fn CCKeyDerivationPBKDF "CCPBKDFAlgorithm algorithm" "const char *password" \ -"size_t passwordLen" "const uint8_t *salt""size_t saltLen" "CCPseudoRandomAlgorithm prf" \ -"uint rounds" "uint8_t *derivedKey""size_t derivedKeyLen" -.Ft uint -.Fn CCCalibratePBKDF "CCPBKDFAlgorithm algorithm" "size_t passwordLen" "size_t saltLen" \ -"CCPseudoRandomAlgorithm prf" "size_t derivedKeyLen" "uint32_t msec" -.Sh DESCRIPTION -.Ss Function -.Nm CCKeyDerivationPBKDF -.Ss Abstract -Derive a key from a text password/passphrase -.Ss Parameters -.Bl -tag -.It algorithm -Currently only PBKDF2 is available via kCCPBKDF2 -.It password -The text password used as input to the derivation function. The actual octets present in \ -this string will be used with no additional processing. It's extremely important that the \ -same encoding and normalization be used each time this routine is called if the same key \ -is expected to be derived. -.It passwordLen -The length of the text password in bytes. -.It salt -The salt byte values used as input to the derivation function. -.It saltLen -The length of the salt in bytes. -.It prf -The Pseudo Random Algorithm to use for the derivation iterations. -.It rounds -The number of rounds of the Pseudo Random Algorithm to use. -.It derivedKey -The resulting derived key produced by the function. The space for this must be provided \ -by the caller. -.It derivedKeyLen -The length of the derived key in bytes. -.El -.Pp -.Ss Discussion -The following values are used to designate the PRF: -.br -.sp -\fB * kCCPRFHmacAlgSHA1 -.br - * kCCPRFHmacAlgSHA224 -.br - * kCCPRFHmacAlgSHA256 -.br - * kCCPRFHmacAlgSHA384 -.br - * kCCPRFHmacAlgSHA512\fR -.br -.Pp -.Ss Result -.Er kCCParamError -- can result from bad values for the password, salt, and unwrapped key pointers as \ -well as a bad value for the prf function. -.Ss Function -.Nm CCCalibratePBKDF -.Ss Abstract -Determine the number of PRF rounds to use for a specific delay on the current platform. -.Ss Parameters -.Bl -tag -.It algorithm -Currently only PBKDF2 is available via kCCPBKDF2 -.It passwordLen -The length of the text password in bytes. -.It saltLen -The length of the salt in bytes. -.It prf -The Pseudo Random Algorithm to use for the derivation iterations. -.It derivedKeyLen -The expected length of the derived key in bytes. -.It msec -The targetted duration we want to achieve for a key derivation with these parameters. -.El -.Pp -.Ss Result -The number of iterations to use for the desired processing time. -.Sh EXAMPLE -.nf -int main (int argc, const char * argv[]) { - uint rounds; - size_t passwordLen = 10, saltLen = 10; - char *password = "ThePasswrd"; - uint8_t salt[10] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 }; - CCPseudoRandomAlgorithm prf = kCCPRFHmacAlgSHA256; - size_t derivedKeyLen = 16; - uint8_t derivedKey[16]; - uint32_t msec = 10; - int retval; -.sp - rounds = CCCalibratePBKDF(kCCPBKDF2, strlen(password), saltLen, prf, derivedKeyLen, msec); -.sp - retval = CCKeyDerivationPBKDF(kCCPBKDF2, password, strlen(password), salt, saltLen, - prf, rounds, derivedKey, derivedKeyLen); - /* At this point the key is produced in "derivedKey" for "derivedKeyLen" bytes and could - be used as the key for AES encryption. -.sp - The "Salt" must be remembered somehow by the calling program as well as the rounds value - and prf that was used. These values, along with the original password will result in the - same 16 byte key being produced each time. - */ - return 0; -} -.fi -.Sh HISTORY -These functions are available in OS X 10.7 and IOS 5.0 and later. -.Sh SEE ALSO -.Xr CCCryptor 3cc , -.Xr CCHmac 3cc , -.Xr CC_MD5 3cc , -.Xr CC_SHA 3cc , -.Xr CC_crypto 3cc , -.Xr CCDigest 3cc -.Sh STANDARDS -.Bl -tag -.It AES: -Federal Information Processing Standard \s-1FIPS\s0 \s-1PUB\s0 197 (Advanced Encryption Standard), -.It DES: -Federal Information Processing Standard \s-1FIPS\s0 \s-1PUB\s0 46\-3 (Data Encryption Standard) -.It 3DES: -NIST Special Publication\s-1PUB\s0 800\-67 (Recommendation for the Triple Data Encryption Algorithm (TDEA) Block Cipher) -.El DELETED doc/CCKeyDerivationPBKDF.3cc Index: doc/CCKeyDerivationPBKDF.3cc ================================================================== --- doc/CCKeyDerivationPBKDF.3cc +++ /dev/null @@ -1,1 +0,0 @@ -.so man3/CCCommonKeyDerivation.3cc DELETED doc/CCSymmetricKeyUnwrap.3cc Index: doc/CCSymmetricKeyUnwrap.3cc ================================================================== --- doc/CCSymmetricKeyUnwrap.3cc +++ /dev/null @@ -1,1 +0,0 @@ -.so man3/CCSymmetricKeyWrap.3cc DELETED doc/CCSymmetricKeyWrap.3cc Index: doc/CCSymmetricKeyWrap.3cc ================================================================== --- doc/CCSymmetricKeyWrap.3cc +++ /dev/null @@ -1,149 +0,0 @@ -.Dd January 20, 2011 -.Dt CCSymmetricKeyWrap 3cc -.Os -.Sh NAME -.Nm CCSymmetricKeyWrap , -.Nm CCSymmetricKeyUnwrap , -.Nm CCSymmetricWrappedSize , -.Nm CCSymmetricUnwrappedSize -.Nd Common Symmetric Keywrap Algorithm Interfaces -.Sh LIBRARY -These functions are found in libSystem. -.Sh SYNOPSIS -.In CommonCrypto/CommonSymmetricKeywrap.h -.Ft int -.Fn CCSymmetricKeyWrap "CCWrappingAlgorithm algorithm" "const uint8_t *iv" "const size_t ivLen" \ -"const uint8_t *kek" "size_t kekLen" "const uint8_t *rawKey" "size_t rawKeyLen" \ -"uint8_t *wrappedKey" "size_t *wrappedKeyLen" -.Ft int -.Fn CCSymmetricKeyUnwrap "CCWrappingAlgorithm algorithm" "const uint8_t *iv" \ -"const size_t ivLen" "const uint8_t *kek" "size_t kekLen" "const uint8_t *wrappedKey" \ -"size_t wrappedKeyLen" "uint8_t *rawKey" "size_t *rawKeyLen" -.Ft size_t -.Fn CCSymmetricWrappedSize "CCWrappingAlgorithm algorithm" "size_t rawKeyLen" -.Ft size_t -.Fn CCSymmetricUnwrappedSize "CCWrappingAlgorithm algorithm" "size_t wrappedKeyLen" -.Sh DESCRIPTION -.Ss Function -.Nm CCSymmetricKeyWrap -.Ss Abstract -Wrap a symmetric key with a Key Encryption Key (KEK). -.Ss Parameters -.Bl -tag -.It algorithm -Currently only AES Keywrapping (rfc3394) is available via kCCWRAPAES -.It iv -The initialization value to be used. CCrfc3394_iv is available as a constant for \ -the standard IV to use. -.It ivLen -The length of the initialization value to be used. CCrfc3394_ivLen is available as \ -a constant for the standard IV to use. -.It kek -The Key Encryption Key to be used to wrap the raw key. -.It kekLen -The length of the KEK in bytes. -.It rawKey -The raw key bytes to be wrapped. -.It rawKeyLen -The length of the key in bytes. -.It wrappedKey -The resulting wrapped key produced by the function. The space for this must be \ -provided by the caller. -.It wrappedKeyLen -The length of the wrapped key in bytes. -.El -.Pp -.Ss Discussion -The algorithm chosen is determined by the algorithm parameter and the size of the \ -key being wrapped (ie aes128 for 128 bit keys). -.Pp -.Ss Result -.Er kCCBufferTooSmall -- indicates insufficent space in the wrappedKey buffer. -.Pp -.Er kCCParamError -- can result from bad values for the kek, rawKey, and wrappedKey key pointers. -.Ss Function -.Nm CCSymmetricKeyUnwrap -.Ss Abstract -Unwrap a symmetric key with a Key Encryption Key (KEK). -.Ss Parameters -.Bl -tag -.It algorithm -Currently only AES Keywrapping (rfc3394) is available via kCCWRAPAES -.It iv -The initialization value to be used. CCrfc3394_iv is available as a constant for the \ -standard IV to use. -.It ivLen -The length of the initialization value to be used. CCrfc3394_ivLen is available as a \ -constant for the standard IV to use. -.It kekLen -The length of the KEK in bytes. -.It wrappedKey -The wrapped key bytes. -.It wrappedKeyLen -The length of the wrapped key in bytes. -.It rawKey -The resulting raw key bytes. The space for this must be provided by the caller. -.It rawKeyLen -The length of the raw key in bytes. -.El -.Pp -.Ss Discussion -The algorithm chosen is determined by the algorithm parameter and the size of the key \ -being wrapped (ie aes128 for 128 bit keys). -.Ss Result -.Er kCCBufferTooSmall -- indicates insufficent space in the rawKey buffer. -.Pp -.Er kCCParamError -- can result from bad values for the kek, rawKey, and wrappedKey key pointers. -.Pp -.br -.Ss Function -.Nm CCSymmetricWrappedSize -.Ss Abstract -Determine the buffer size required to hold a key wrapped with -.Fn CCAESKeyWrap . -.Ss Parameters -.Bl -tag -.It algorithm -Currently only AES Keywrapping (rfc3394) is available via kCCWRAPAES -.It rawKeyLen -The length of the key in bytes. -.El -.Ss Result -The length of the resulting wrapped key. -.br -.Ss Function -.Nm CCSymmetricUnwrappedSize -.Ss abstract -Determine the buffer size required to hold a key unwrapped with -.Fn CCAESKeyUnwrap . -.Ss Parameters -.Bl -tag -.It algorithm -Currently only AES Keywrapping (rfc3394) is available via kCCWRAPAES -.It wrappedKeyLen -The length of the wrapped key in bytes. -.El -.Ss Result -The length of the resulting raw key. -.Sh HISTORY -These functions are available in OS X 10.7 and IOS 5.0 and later. -.Sh SEE ALSO -.Xr CCCryptor 3cc , -.Xr CCHmac 3cc , -.Xr CC_MD5 3cc , -.Xr CC_SHA 3cc , -.Xr CC_crypto 3cc , -.Xr CCDigest 3cc -.Sh STANDARDS -.Bl -tag -.It AES: -Federal Information Processing Standard \s-1FIPS\s0 \s-1PUB\s0 197 (Advanced Encryption Standard), -.It DES: -Federal Information Processing Standard \s-1FIPS\s0 \s-1PUB\s0 46\-3 (Data Encryption Standard) -.It 3DES: -NIST Special Publication\s-1PUB\s0 800\-67 (Recommendation for the Triple Data Encryption Algorithm (TDEA) Block Cipher) -.El DELETED doc/CCSymmetricUnwrappedSize.3cc Index: doc/CCSymmetricUnwrappedSize.3cc ================================================================== --- doc/CCSymmetricUnwrappedSize.3cc +++ /dev/null @@ -1,1 +0,0 @@ -.so man3/CCSymmetricKeyWrap.3cc DELETED doc/CCSymmetricWrappedSize.3cc Index: doc/CCSymmetricWrappedSize.3cc ================================================================== --- doc/CCSymmetricWrappedSize.3cc +++ /dev/null @@ -1,1 +0,0 @@ -.so man3/CCSymmetricKeyWrap.3cc Index: doc/CommonCrypto.plist ================================================================== --- doc/CommonCrypto.plist +++ doc/CommonCrypto.plist @@ -1,14 +1,12 @@ - + OpenSourceLicense - openssl - OpenSourceImportDate - 2004-04-07 + Eric Young OpenSourceLicenseFile CommonCrypto.txt OpenSourceModifications Extensive customization for OS X OpenSourceProject @@ -22,57 +20,39 @@ OpenSourceImportDate 2004-04-07 OpenSourceLicense - other + Brian Gladman OpenSourceLicenseFile CommonCrypto.txt OpenSourceModifications Customization for OS X OpenSourceProject Gladman AES OpenSourceURL - http://gladman.plushost.co.uk/oldsite/AES/aes-src-29-04-09.zip + http://fp.gladman.plus.com/AES/aesfull.zip OpenSourceVersion aes-src-26-08-05 OpenSourceWebsiteURL - http://www.gladman.me.uk/ + http://fp.gladman.plus.com/AES/index.htm OpenSourceImportDate 2005-09-02 OpenSourceLicense - other + Brian Gladman OpenSourceLicenseFile CommonCrypto.txt OpenSourceModifications Customization for OS X OpenSourceProject Gladman SHA2 OpenSourceURL - http://gladman.plushost.co.uk/oldsite/cryptography_technology/sha/sha2-07-01-07.zip + http://fp.gladman.plus.com/cryptography_technology/sha/sha-26-08-05.zip OpenSourceVersion sha-26-08-05 OpenSourceWebsiteURL - http://www.gladman.me.uk/ - - - OpenSourceImportDate - 2010-01-04 - OpenSourceLicense - other - OpenSourceLicenseFile - CommonCrypto.txt - OpenSourceModifications - Branched for OS X - OpenSourceProject - libTomCrypt - OpenSourceURL - http://libtom.org/files/crypt-1.17.zip - OpenSourceVersion - 1.17 - OpenSourceWebsiteURL - http://libtom.org/ + http://fp.gladman.plus.com/cryptography_technology/sha/index.htm Index: doc/CommonCrypto.txt ================================================================== --- doc/CommonCrypto.txt +++ doc/CommonCrypto.txt @@ -116,18 +116,5 @@ DISCLAIMER This software is provided 'as is' with no explicit or implied warranties in respect of its properties, including, but not limited to, correctness and/or fitness for purpose. - ---------------------------------------------------------------------------- -License for libTomCrypt ---------------------------------------------------------------------------- -libTomCrypt is a library that provides various cryptographic -algorithms in a highly modular and flexible manner. - -The library is free for all purposes without any express -guarantee it works. - -Tom St Denis, tomstdenis@gmail.com, http://libtom.org - - ADDED xcodescripts/convert-launchd-plists-to-binary.sh Index: xcodescripts/convert-launchd-plists-to-binary.sh ================================================================== --- /dev/null +++ xcodescripts/convert-launchd-plists-to-binary.sh @@ -0,0 +1,6 @@ +/bin/sh +set -e +mkdir -p "$DSTROOT"/System/Library/LaunchDaemons +for plist in "$SRCROOT"/cc_fips_test/*.plist; do + plutil -convert binary1 "$plist" -o "$DSTROOT"/System/Library/LaunchDaemons/$(basename "$plist") +done