Revision 5fafdf24 aes.c
b/aes.c | ||
---|---|---|
1 | 1 |
/** |
2 |
*
|
|
2 |
* |
|
3 | 3 |
* aes.c - integrated in QEMU by Fabrice Bellard from the OpenSSL project. |
4 | 4 |
*/ |
5 | 5 |
/* |
... | ... | |
1267 | 1267 |
|
1268 | 1268 |
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, |
1269 | 1269 |
const unsigned long length, const AES_KEY *key, |
1270 |
unsigned char *ivec, const int enc)
|
|
1270 |
unsigned char *ivec, const int enc) |
|
1271 | 1271 |
{ |
1272 | 1272 |
|
1273 | 1273 |
unsigned long n; |
... | ... | |
1294 | 1294 |
AES_encrypt(tmp, tmp, key); |
1295 | 1295 |
memcpy(out, tmp, AES_BLOCK_SIZE); |
1296 | 1296 |
memcpy(ivec, tmp, AES_BLOCK_SIZE); |
1297 |
}
|
|
1297 |
} |
|
1298 | 1298 |
} else { |
1299 | 1299 |
while (len >= AES_BLOCK_SIZE) { |
1300 | 1300 |
memcpy(tmp, in, AES_BLOCK_SIZE); |
... | ... | |
1312 | 1312 |
for(n=0; n < len; ++n) |
1313 | 1313 |
out[n] = tmp[n] ^ ivec[n]; |
1314 | 1314 |
memcpy(ivec, tmp, AES_BLOCK_SIZE); |
1315 |
}
|
|
1315 |
} |
|
1316 | 1316 |
} |
1317 | 1317 |
} |
Also available in: Unified diff