• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ EVP_CIPHER_CTX_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中EVP_CIPHER_CTX_free函数的典型用法代码示例。如果您正苦于以下问题:C++ EVP_CIPHER_CTX_free函数的具体用法?C++ EVP_CIPHER_CTX_free怎么用?C++ EVP_CIPHER_CTX_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了EVP_CIPHER_CTX_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sgx_aes_gcm_close

sgx_status_t sgx_aes_gcm_close(sgx_aes_state_handle_t aes_gcm_state)
{
    if (aes_gcm_state != NULL) {
        EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)aes_gcm_state);
    }

    return SGX_SUCCESS;
}
开发者ID:hyjiang,项目名称:linux-sgx,代码行数:8,代码来源:sgx_aes_gcm.cpp


示例2: tr_rc4_free

void
tr_rc4_free (tr_rc4_ctx_t handle)
{
  if (handle == NULL)
    return;

  EVP_CIPHER_CTX_free (handle);
}
开发者ID:NAStools,项目名称:transmission,代码行数:8,代码来源:crypto-utils-openssl.c


示例3: aes_ctr_release

static int
aes_ctr_release(archive_crypto_ctx *ctx)
{
	EVP_CIPHER_CTX_free(ctx->ctx);
	memset(ctx->key, 0, ctx->key_len);
	memset(ctx->nonce, 0, sizeof(ctx->nonce));
	return 0;
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:8,代码来源:archive_cryptor.c


示例4: sgx_aes_gcm128_enc_init

sgx_status_t sgx_aes_gcm128_enc_init(const uint8_t *key, const uint8_t *iv, uint32_t iv_len, const uint8_t *aad,
    uint32_t aad_len, sgx_aes_state_handle_t* aes_gcm_state)
{
    if ((aad_len >= INT_MAX) || (key == NULL) || (iv_len != SGX_AESGCM_IV_SIZE) || ((aad_len > 0) && (aad == NULL))
        || (iv == NULL) || (aes_gcm_state == NULL))
    {
        return SGX_ERROR_INVALID_PARAMETER;
    }
    int len = 0;
    sgx_status_t ret = SGX_ERROR_UNEXPECTED;
    EVP_CIPHER_CTX * pState = NULL;

    do {
        // Create and initialise the context
        //
        if (!(pState = EVP_CIPHER_CTX_new())) {
            ret = SGX_ERROR_OUT_OF_MEMORY;
            break;
        }

        // Initialize ctx with AES-128 GCM
        //
        if (!EVP_EncryptInit_ex(pState, EVP_aes_128_gcm(), NULL, NULL, NULL)) {
            break;
        }

        // Set IV len
        //
        if (!EVP_CIPHER_CTX_ctrl(pState, EVP_CTRL_AEAD_SET_IVLEN, iv_len, NULL)) {
            break;
        }

        // Initialize encryption key and IV
        //
        if (!EVP_EncryptInit_ex(pState, NULL, NULL, (unsigned char*)key, iv)) {
            break;
        }

        // Provide AAD data if exist
        //
        if (NULL != aad) {
            if (!EVP_EncryptUpdate(pState, NULL, &len, aad, aad_len)) {
                break;
            }
        }

        *aes_gcm_state = (EVP_CIPHER_CTX*)pState;
        ret = SGX_SUCCESS;
    } while (0);

    if (ret != SGX_SUCCESS) {
        if (pState != NULL) {
            EVP_CIPHER_CTX_free(pState);
        }
    }

    return ret;
}
开发者ID:hyjiang,项目名称:linux-sgx,代码行数:58,代码来源:sgx_aes_gcm.cpp


示例5: aes_ctr_init

static int
aes_ctr_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
             const unsigned char *iv, int enc) /* init key */
{
    /*
     * variable "c" is leaked from this scope, but is later freed
     * in aes_ctr_cleanup
     */
    aes_ctr_ctx *c;
    const EVP_CIPHER *aes_cipher;
    (void) enc;

    switch(EVP_CIPHER_CTX_key_length(ctx)) {
    case 16:
        aes_cipher = EVP_aes_128_ecb();
        break;
    case 24:
        aes_cipher = EVP_aes_192_ecb();
        break;
    case 32:
        aes_cipher = EVP_aes_256_ecb();
        break;
    default:
        return 0;
    }

    c = malloc(sizeof(*c));
    if(c == NULL)
        return 0;

#ifdef HAVE_OPAQUE_STRUCTS
    c->aes_ctx = EVP_CIPHER_CTX_new();
#else
    c->aes_ctx = malloc(sizeof(EVP_CIPHER_CTX));
#endif
    if(c->aes_ctx == NULL) {
        free(c);
        return 0;
    }

    if(EVP_EncryptInit(c->aes_ctx, aes_cipher, key, NULL) != 1) {
#ifdef HAVE_OPAQUE_STRUCTS
        EVP_CIPHER_CTX_free(c->aes_ctx);
#else
        free(c->aes_ctx);
#endif
        free(c);
        return 0;
    }

    EVP_CIPHER_CTX_set_padding(c->aes_ctx, 0);

    memcpy(c->ctr, iv, AES_BLOCK_SIZE);

    EVP_CIPHER_CTX_set_app_data(ctx, c);

    return 1;
}
开发者ID:stinb,项目名称:libssh2,代码行数:58,代码来源:openssl.c


示例6: initializeAESKeys

bool Wallet::writeSecurityImage(const QPixmap* pixmap, const QString& outputFilePath) {
    // aes requires a couple 128-bit keys (ckey and ivec).  For now, I'll just
    // use the md5 of the salt as the ckey (md5 is 128-bit), and ivec will be
    // a constant.  We can review this later - there are ways to generate keys
    // from a password that may be better.
    unsigned char ivec[16];
    unsigned char ckey[32];

    initializeAESKeys(ivec, ckey, _salt);

    int tempSize, outSize;
    QByteArray inputFileBuffer;
    QBuffer buffer(&inputFileBuffer);
    buffer.open(QIODevice::WriteOnly);

    // another spot where we are assuming only jpgs
    pixmap->save(&buffer, "jpg");

    // reserve enough capacity for encrypted bytes
    unsigned char* outputFileBuffer = new unsigned char[inputFileBuffer.size() + AES_BLOCK_SIZE];

    EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();

    // TODO: add error handling!!!
    if (!EVP_EncryptInit_ex(ctx, EVP_des_ede3_cbc(), NULL, ckey, ivec)) {
        qCDebug(commerce) << "encrypt init failure";
        delete[] outputFileBuffer;
        return false;
    }
    if (!EVP_EncryptUpdate(ctx, outputFileBuffer, &tempSize, (unsigned char*)inputFileBuffer.data(), inputFileBuffer.size())) {
        qCDebug(commerce) << "encrypt update failure";
        delete[] outputFileBuffer;
        return false;
    }
    outSize = tempSize;
    if (!EVP_EncryptFinal_ex(ctx, outputFileBuffer + outSize, &tempSize)) {
        qCDebug(commerce) << "encrypt final failure";
        delete[] outputFileBuffer;
        return false;
    }

    outSize += tempSize;
    EVP_CIPHER_CTX_free(ctx);
    qCDebug(commerce) << "encrypted buffer size" << outSize;
    QByteArray output((const char*)outputFileBuffer, outSize);

    // now APPEND to the file,
    QByteArray b64output = output.toBase64();
    QFile outputFile(outputFilePath);
    outputFile.open(QIODevice::Append);
    outputFile.write(IMAGE_HEADER);
    outputBase64WithNewlines(outputFile, b64output);
    outputFile.write(IMAGE_FOOTER);
    outputFile.close();

    delete[] outputFileBuffer;
    return true;
}
开发者ID:Atlante45,项目名称:hifi,代码行数:58,代码来源:Wallet.cpp


示例7: encrypt

int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *aad,
    int aad_len, unsigned char *key, unsigned char *iv,
    unsigned char *ciphertext, unsigned char *tag)
{
    EVP_CIPHER_CTX *ctx;

    int len;

    int ciphertext_len;


    /* Create and initialise the context */
    if(!(ctx = EVP_CIPHER_CTX_new())) handleErrors();

    /* Initialise the encryption operation. */
    if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_256_gcm(), NULL, NULL, NULL))
        handleErrors();

    /* Set IV length if default 12 bytes (96 bits) is not appropriate */
    if(1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, 16, NULL))
        handleErrors();

    /* Initialise key and IV */
    if(1 != EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv)) handleErrors();

    /* Provide any AAD data. This can be called zero or more times as
     * required
     */
    /*
    if(1 != EVP_EncryptUpdate(ctx, NULL, &len, aad, aad_len))
        handleErrors();
        */

    /* Provide the message to be encrypted, and obtain the encrypted output.
     * EVP_EncryptUpdate can be called multiple times if necessary
     */
    if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len))
        handleErrors();
    ciphertext_len = len;

    /* Finalise the encryption. Normally ciphertext bytes may be written at
     * this stage, but this does not occur in GCM mode
     */
    if(1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &len)) handleErrors();
    ciphertext_len += len;

    /* Get the tag */
    /*
    if(1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag))
        handleErrors();
        */

    /* Clean up */
    EVP_CIPHER_CTX_free(ctx);

    return ciphertext_len;
}
开发者ID:keiya,项目名称:kernelhack,代码行数:57,代码来源:evp_gcm.c


示例8: aes_cleanup

static void aes_cleanup(EVP_CIPHER_CTX* ctx)
{
	EVP_CIPHER_CTX_free(ctx);
	#if(OPENSSL_VERSION_NUMBER<0x10000000L)
		ERR_remove_state(0);
	#elif(OPENSSL_VERSION_NUMBER<0x10100000L)
		ERR_remove_thread_state(NULL);
	#endif
}
开发者ID:mrmoss,项目名称:enano,代码行数:9,代码来源:crypto.cpp


示例9: decryptccm

int decryptccm(unsigned char *ciphertext, int ciphertext_len, unsigned char *tag, unsigned char *key, unsigned char *iv,
	unsigned char *plaintext)
{
	EVP_CIPHER_CTX *ctx;
	int len;
	int plaintext_len;
	int ret;

	/* Create and initialise the context */
	if(!(ctx = EVP_CIPHER_CTX_new())) handleErrors("Create and initialise the context");

	/* Initialise the decryption operation. */
	if(1 != EVP_DecryptInit_ex(ctx, EVP_aes_256_ccm(), NULL, NULL, NULL))
		handleErrors("Initialise the decryption operation.");

	/* Setting IV len to 7. Not strictly necessary as this is the default
	 * but shown here for the purposes of this example */
	if(1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_IVLEN, 7, NULL))
		handleErrors("Setting IV len to 7. ");

	/* Set expected tag value. */
	if(1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG, 14, tag))
		handleErrors("Set expected tag value.");

	/* Initialise key and IV */
	if(1 != EVP_DecryptInit_ex(ctx, NULL, NULL, key, iv))
		handleErrors("Initialise key and IV");


	/* Provide the total ciphertext length
	 */
	if(1 != EVP_DecryptUpdate(ctx, NULL, &len, NULL, ciphertext_len))
		handleErrors("rovide the total ciphertext length");



	/* Provide the message to be decrypted, and obtain the plaintext output.
	 * EVP_DecryptUpdate can be called multiple times if necessary
	 */
	ret = EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len);

	plaintext_len = len;

	/* Clean up */
	EVP_CIPHER_CTX_free(ctx);

	if(ret > 0)
	{
		/* Success */
		return plaintext_len;
	}
	else
	{
		/* Verify failed */
		return -1;
	}
}
开发者ID:garymalaysia,项目名称:Portfolio,代码行数:57,代码来源:decrypKeyExchange.c


示例10: LUA_FUNCTION

static LUA_FUNCTION(openssl_cipher_ctx_free)
{
  EVP_CIPHER_CTX *ctx = CHECK_OBJECT(1, EVP_CIPHER_CTX, "openssl.evp_cipher_ctx");
  lua_pushnil(L);
  lua_rawsetp(L, LUA_REGISTRYINDEX, ctx);
  EVP_CIPHER_CTX_cleanup(ctx);
  EVP_CIPHER_CTX_free(ctx);
  return 0;
}
开发者ID:world100,项目名称:11111,代码行数:9,代码来源:cipher.c


示例11: aes_cipher_free

void
aes_cipher_free(aes_cnt_cipher_t *cipher_)
{
  if (!cipher_)
    return;
  EVP_CIPHER_CTX *cipher = (EVP_CIPHER_CTX *) cipher_;
  EVP_CIPHER_CTX_cleanup(cipher);
  EVP_CIPHER_CTX_free(cipher);
}
开发者ID:themiron,项目名称:asuswrt-merlin,代码行数:9,代码来源:aes.c


示例12: test_ctx_replace

/* Test copying of contexts */
static void test_ctx_replace(EVP_CIPHER_CTX **pctx)
	{
	/* Make copy of context and replace original */
	EVP_CIPHER_CTX *ctx_copy;
	ctx_copy = EVP_CIPHER_CTX_new();
	EVP_CIPHER_CTX_copy(ctx_copy, *pctx);
	EVP_CIPHER_CTX_free(*pctx);
	*pctx = ctx_copy;
	}
开发者ID:Acidburn0zzz,项目名称:openssl,代码行数:10,代码来源:evp_test.c


示例13: crypto_encrypt_final

int crypto_encrypt_final(CipherContext *ctx, char *ciphertext) {
    int ciphertext_len;

    if (EVP_EncryptFinal_ex(ctx, (unsigned char *)ciphertext, &ciphertext_len) != 1)
        crypto_handle_error();

    EVP_CIPHER_CTX_free(ctx);

    return ciphertext_len;
}
开发者ID:iitzco,项目名称:steganography,代码行数:10,代码来源:encrypt.c


示例14: generate_key

/** Decrypt a buffer.
 * @param cipher cipher ID
 * @param enc encrypted buffer
 * @param enc_size number of bytes in @p enc
 * @param plain on return contains plain text data
 * @param plain_size size in bytes of @p plain
 * @return number of bytes that were in the encrypted buffer (this can be shorter if the data
 * did not exactly fit the AES block size.
 */
size_t
BufferDecryptor::decrypt(int cipher, const void *enc, size_t enc_size, void *plain, size_t plain_size)
{
#ifdef HAVE_LIBCRYPTO
  if (keys_.find(cipher) == keys_.end()) {
    generate_key(cipher);
  }

  const EVP_CIPHER *evp_cipher = cipher_by_id(cipher);

  const size_t iv_size = EVP_CIPHER_iv_length(evp_cipher);
  const unsigned char *iv = (const unsigned char *)enc;
  unsigned char *enc_m = (unsigned char *)enc + iv_size;
  enc_size -= iv_size;

  EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
  if ( ! EVP_DecryptInit(ctx, evp_cipher, (const unsigned char *)keys_[cipher].c_str(), iv))
  {
    EVP_CIPHER_CTX_free(ctx);
    throw std::runtime_error("Could not initialize cipher context");
  }

  int outl = plain_size;
  if ( ! EVP_DecryptUpdate(ctx,
			   (unsigned char *)plain, &outl, enc_m, enc_size))
  {
    EVP_CIPHER_CTX_free(ctx);
    throw std::runtime_error("DecryptUpdate failed");
  }

  int plen = 0;
  if ( ! EVP_DecryptFinal(ctx, (unsigned char *)plain + outl, &plen) ) {
    EVP_CIPHER_CTX_free(ctx);
    throw std::runtime_error("DecryptFinal failed");
  }
  outl += plen;

  EVP_CIPHER_CTX_free(ctx);
  return outl;
#else
  throw std::runtime_error("Decryption support not available");
#endif
}
开发者ID:timn,项目名称:fawkes,代码行数:52,代码来源:crypto.cpp


示例15: AES_PRF

static krb5_error_code
AES_PRF(krb5_context context,
	krb5_crypto crypto,
	const krb5_data *in,
	krb5_data *out)
{
    struct _krb5_checksum_type *ct = crypto->et->checksum;
    krb5_error_code ret;
    Checksum result;
    krb5_keyblock *derived;

    result.cksumtype = ct->type;
    ret = krb5_data_alloc(&result.checksum, ct->checksumsize);
    if (ret) {
	krb5_set_error_message(context, ret, N_("malloc: out memory", ""));
	return ret;
    }

    ret = (*ct->checksum)(context, NULL, in->data, in->length, 0, &result);
    if (ret) {
	krb5_data_free(&result.checksum);
	return ret;
    }

    if (result.checksum.length < crypto->et->blocksize)
	krb5_abortx(context, "internal prf error");

    derived = NULL;
    ret = krb5_derive_key(context, crypto->key.key,
			  crypto->et->type, "prf", 3, &derived);
    if (ret)
	krb5_abortx(context, "krb5_derive_key");

    ret = krb5_data_alloc(out, crypto->et->blocksize);
    if (ret)
	krb5_abortx(context, "malloc failed");

    {
	const EVP_CIPHER *c = (*crypto->et->keytype->evp)();
	EVP_CIPHER_CTX *ctx;

	ctx = EVP_CIPHER_CTX_new(); /* ivec all zero */
	if (ctx == NULL)
	    krb5_abortx(context, "malloc failed");
	EVP_CipherInit_ex(ctx, c, NULL, derived->keyvalue.data, NULL, 1);
	EVP_Cipher(ctx, out->data, result.checksum.data,
		   crypto->et->blocksize);
	EVP_CIPHER_CTX_free(ctx);
    }

    krb5_data_free(&result.checksum);
    krb5_free_keyblock(context, derived);

    return ret;
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:55,代码来源:crypto-aes.c


示例16: crypto_block_cleanup

/**
 * @brief Clean encryption / decryption context.
 * @note After cleanup, a context is free to be reused if necessary.
 * @param ctx The block context to use.
 * @return Returns APR_ENOTIMPL if not supported.
 */
static apr_status_t crypto_block_cleanup(apr_crypto_block_t *ctx)
{

    if (ctx->initialised) {
        EVP_CIPHER_CTX_free(ctx->cipherCtx);
        ctx->initialised = 0;
    }

    return APR_SUCCESS;

}
开发者ID:MiKTeX,项目名称:miktex,代码行数:17,代码来源:apr_crypto_openssl.c


示例17: entersafe_cipher_apdu

static int entersafe_cipher_apdu(sc_card_t *card, sc_apdu_t *apdu,
								 u8 *key, size_t keylen,
								 u8 *buff, size_t buffsize)
{
	 EVP_CIPHER_CTX * ctx = NULL;
	 u8 iv[8]={0};
	 int len;

	SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);

	 assert(card);
	 assert(apdu);
	 assert(key);
	 assert(buff);

	 /* padding as 0x80 0x00 0x00...... */
	 memset(buff,0,buffsize);
	 buff[0]=apdu->lc;
	 memcpy(buff+1,apdu->data,apdu->lc);
	 buff[apdu->lc+1]=0x80;

	 ctx = EVP_CIPHER_CTX_new();
	 if (ctx == NULL)
		 SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_OUT_OF_MEMORY);
	 EVP_CIPHER_CTX_set_padding(ctx,0);

	 if(keylen == 8)
		  EVP_EncryptInit_ex(ctx, EVP_des_ecb(), NULL, key, iv);
	 else if (keylen == 16) 
		  EVP_EncryptInit_ex(ctx, EVP_des_ede(), NULL, key, iv);
	 else
		  SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_INTERNAL);
	 
	 len = apdu->lc;
	 if(!EVP_EncryptUpdate(ctx, buff, &len, buff, buffsize)){
		  sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "entersafe encryption error.");
		  SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_INTERNAL);
	 }
	 apdu->lc = len;

	 EVP_CIPHER_CTX_free(ctx);

	 if(apdu->lc!=buffsize)
	 {
		  sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "entersafe build cipher apdu failed.");
		  SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_INTERNAL);
	 }

	 apdu->data=buff;
	 apdu->datalen=apdu->lc;

	 SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_SUCCESS);
}
开发者ID:hongquan,项目名称:OpenSC-main,代码行数:53,代码来源:card-entersafe.c


示例18: EVP_CIPHER_CTX_new

/*
 * Encrypt/Decrypt a buffer based on password and algor, result in a
 * OPENSSL_malloc'ed buffer
 */
unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor,
                                const char *pass, int passlen,
                                const unsigned char *in, int inlen,
                                unsigned char **data, int *datalen, int en_de)
{
    unsigned char *out = NULL;
    int outlen, i;
    EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();

    if (ctx == NULL) {
        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_MALLOC_FAILURE);
        goto err;
    }

    /* Decrypt data */
    if (!EVP_PBE_CipherInit(algor->algorithm, pass, passlen,
                            algor->parameter, ctx, en_de)) {
        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,
                  PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR);
        goto err;
    }

    if ((out = OPENSSL_malloc(inlen + EVP_CIPHER_CTX_block_size(ctx)))
            == NULL) {
        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_MALLOC_FAILURE);
        goto err;
    }

    if (!EVP_CipherUpdate(ctx, out, &i, in, inlen)) {
        OPENSSL_free(out);
        out = NULL;
        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_EVP_LIB);
        goto err;
    }

    outlen = i;
    if (!EVP_CipherFinal_ex(ctx, out + i, &i)) {
        OPENSSL_free(out);
        out = NULL;
        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,
                  PKCS12_R_PKCS12_CIPHERFINAL_ERROR);
        goto err;
    }
    outlen += i;
    if (datalen)
        *datalen = outlen;
    if (data)
        *data = out;
 err:
    EVP_CIPHER_CTX_free(ctx);
    return out;

}
开发者ID:ciz,项目名称:openssl,代码行数:57,代码来源:p12_decr.c


示例19: EVP_CIPHER_CTX_free

void RarVolume::DecryptFree()
{
	if (m_context)
	{
#ifdef HAVE_OPENSSL
		EVP_CIPHER_CTX_free((EVP_CIPHER_CTX*)m_context);
#elif defined(HAVE_NETTLE)
		delete (aes_ctx*)m_context;
#endif
		m_context = nullptr;
	}
}
开发者ID:sanderjo,项目名称:nzbget,代码行数:12,代码来源:RarReader.cpp


示例20: crypto_decrypt_final

int crypto_decrypt_final(CipherContext *ctx, char *decryptedtext) {
    int decryptedtext_len;

    if (EVP_DecryptFinal_ex(ctx, (unsigned char *)decryptedtext, &decryptedtext_len) != 1)
        crypto_handle_error();

    EVP_CIPHER_CTX_free(ctx);

    /* Add a NULL terminator. We are expecting printable text */
    decryptedtext[decryptedtext_len] = '\0';

    return decryptedtext_len;
}
开发者ID:iitzco,项目名称:steganography,代码行数:13,代码来源:encrypt.c



注:本文中的EVP_CIPHER_CTX_free函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ EVP_CIPHER_CTX_get_app_data函数代码示例发布时间:2022-05-30
下一篇:
C++ EVP_CIPHER_CTX_ctrl函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap