00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "system.h"
00029 #include "blockmode.h"
00030 #include "mp32.h"
00031 #include "debug.h"
00032
00033 int blockEncrypt(const blockCipher* bc, blockCipherParam* bp, cipherMode mode, int blocks, uint32* dst, const uint32* src)
00034 {
00035 if (bc->mode)
00036 {
00037 register const blockMode* bm = bc->mode+mode;
00038
00039 if (bm)
00040 {
00041 register const blockModeEncrypt be = bm->encrypt;
00042
00043 if (be)
00044 return be(bp, blocks, dst, src);
00045 }
00046 }
00047
00048 return -1;
00049 }
00050
00051 int blockDecrypt(const blockCipher* bc, blockCipherParam* bp, cipherMode mode, int blocks, uint32* dst, const uint32* src)
00052 {
00053 if (bc->mode)
00054 {
00055 register const blockMode* bm = bc->mode+mode;
00056
00057 if (bm)
00058 {
00059 register const blockModeEncrypt bd = bm->decrypt;
00060
00061 if (bd)
00062 return bd(bp, blocks, dst, src);
00063 }
00064 }
00065
00066 return -1;
00067 }