7 * encrypt/decrypt using Gladman version of AES.
10 CSSM_RETURN
encryptDecryptTest(
13 uint32 blockSizeInBits
,
14 const uint8
*key
, // raw key bytes
20 uint8
*inPtr
= (uint8
*)inText
;
21 uint8
*outPtr
= outText
;
22 uint32 blockSizeInBytes
= blockSizeInBits
/ 8;
23 uint32 blocks
= inTextLen
/ blockSizeInBytes
;
25 if(blockSizeInBits
!= 128) {
26 printf("***This AES implementation supports only 128 bit blocks.\n");
27 return CSSM_ERRCODE_INTERNAL_ERROR
;
29 memmove(aesKey
, key
, keySizeInBits
/ 8);
30 set_key(aesKey
, keySizeInBits
);
31 for( ; blocks
> 0; blocks
--) {
33 rEncrypt((u4byte
*)inPtr
, (u4byte
*)outPtr
);
36 rDecrypt((u4byte
*)inPtr
, (u4byte
*)outPtr
);
38 inPtr
+= blockSizeInBytes
;
39 outPtr
+= blockSizeInBytes
;