<commit_before>#include <stdio.h>
#include <string.h>
#include "ntru.h"
#include <openssl/evp.h>

/*****************************************************************************
 * Sample code that shows how to do hybrid encryption using NTRU and AES.    *
 *****************************************************************************/

int openssl_encr_decr(uint8_t *inbuf, int inlen, uint8_t *outbuf, int *outlen, uint8_t *key, uint8_t *iv, int do_encrypt) {
    EVP_CIPHER_CTX ctx;
    EVP_CIPHER_CTX_init(&ctx);
    EVP_CipherInit_ex(&ctx, EVP_aes_128_cbc(), NULL, NULL, NULL, do_encrypt);
    EVP_CipherInit_ex(&ctx, NULL, NULL, key, iv, do_encrypt);
    int retval = EVP_CipherUpdate(&ctx, outbuf, outlen, inbuf, inlen);
    int pad_bytes;
    if (retval && !EVP_CipherFinal_ex(&ctx, outbuf+*outlen, &pad_bytes))
        retval = 0;
    *outlen += pad_bytes;
    EVP_CIPHER_CTX_cleanup(&ctx);
    return retval;
}
<commit_msg>Initialize pad_bytes<commit_after>#include <stdio.h>
#include <string.h>
#include "ntru.h"
#include <openssl/evp.h>

/*****************************************************************************
 * Sample code that shows how to do hybrid encryption using NTRU and AES.    *
 *****************************************************************************/

int openssl_encr_decr(uint8_t *inbuf, int inlen, uint8_t *outbuf, int *outlen, uint8_t *key, uint8_t *iv, int do_encrypt) {
    EVP_CIPHER_CTX ctx;
    EVP_CIPHER_CTX_init(&ctx);
    EVP_CipherInit_ex(&ctx, EVP_aes_128_cbc(), NULL, NULL, NULL, do_encrypt);
    EVP_CipherInit_ex(&ctx, NULL, NULL, key, iv, do_encrypt);
    int retval = EVP_CipherUpdate(&ctx, outbuf, outlen, inbuf, inlen);
    int pad_bytes = 0;
    if (retval && !EVP_CipherFinal_ex(&ctx, outbuf+*outlen, &pad_bytes))
        retval = 0;
    *outlen += pad_bytes;
    EVP_CIPHER_CTX_cleanup(&ctx);
    return retval;
}

{'fraction_non_alphanumeric': 0.2704, 'fraction_numerical': 0.009066666666666667, 'mean_word_length': 5.380952380952381, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1399400', 'n_tokens_mistral': 677, 'n_tokens_neox': 648, 'n_words': 146}