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 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题