65,187
社区成员




Item *
DET_abstract_integer::encrypt(const Item &ptext, uint64_t IV) const
{
const ulonglong value = RiboldMYSQL::val_uint(ptext);
getCInteger_().checkValue(value);
const ulonglong res = static_cast<ulonglong>(getBlowfish_().encrypt(value));
LOG(encl) << "DET_int enc " << value << "--->" << res;
return new (current_thd->mem_root) Item_int(res);
}
uint64_t encrypt(uint64_t pt) {
uint64_t ct;
block_encrypt(&pt,&ct);
//在这里返回之前和blowfish算法的加密都是相同的,返回的数值也是正常的。但是返回后立即就出现了错误。
return ct;
}
void block_encrypt(void *ptext,void *ctext) {
sm4_crypt_ecb(&ctx,SM_ENCRYPT,16,(uint8_t*)ptext,(uint8_t*)ctext);
}
uint64_t encrypt(uint64_t pt) {
uint64_t ct;
block_encrypt(&pt,&ct);
return ct;
}
如果改成这样:
uint64_t encrypt(uint64_t pt) {
uint64_t ct;
block_encrypt(&pt,&ct);
uint64_t tc=ct
return tc;
}
就可以正确返回了,这是为什么呢???