chris_zcl 2013-07-03 05:48 采纳率: 0%
浏览 1905

Apache Modulue开发中遇到的问题,关于openssl加密,总是报错,错在哪里?

char *iaisession_getobmuid(request_rec *r, const char *encid, const unsigned char *enckey, unsigned char *iv, const char *mtiid)
{
unsigned char *obmuid = (unsigned char *) apr_pcalloc(r->pool, LENGTH_OBMUID + 1);
char *b64edobmuid;
// get muid length
int mtiidlen = strlen(mtiid);
// encrypted obmuid length
int obmuidlen = 0;
// padding length
int paddinglen = 0;
// according to the key length, decide 128bit or 256bit AES encryption algorithm.
const EVP_CIPHER *aes_cbc = NULL;
int keylen = strlen((char *)enckey);
if (keylen == LENGTH_KEY_16) {
aes_cbc = EVP_aes_128_cbc();
} else if (keylen == LENGTH_KEY_32) {
aes_cbc = EVP_aes_256_cbc();
}
// cipher contex
EVP_CIPHER_CTX ctx;
// initializes cipher contex.
EVP_CIPHER_CTX_init(&ctx);
// sets up cipher context ctx for encryption with cipher type from ENGINE (default implementation).
EVP_EncryptInit_ex(&ctx, aes_cbc, NULL, enckey, iv);
// encrypts mtiidlen bytes from the mtiid in and writes the encrypted version to obmuid.
EVP_EncryptUpdate(&ctx, obmuid, &obmuidlen, (unsigned char *)mtiid, mtiidlen);
// obmuid is the encrypts.
EVP_EncryptFinal_ex(&ctx, obmuid + obmuidlen, &paddinglen);
// clears all information from a cipher context and free up any allocated memory associate with it.
EVP_CIPHER_CTX_cleanup(&ctx);
// base64 encode
b64edobmuid = iaisession_encodebybase64(r->pool, obmuid);
return b64edobmuid;
}

[Wed Jul 03 01:43:13 2013] [notice] child pid 28278 exit signal Segmentation fault (11)

  • 写回答

1条回答

  • oyljerry 2015-01-03 03:37
    关注

    segmentation fault,程序异常了,比如指针越界等

    评论

报告相同问题?

悬赏问题

  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn