Blame crypto/evp/e_null.c

Packit c4476c
/*
Packit c4476c
 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
 *
Packit c4476c
 * Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
 * this file except in compliance with the License.  You can obtain a copy
Packit c4476c
 * in the file LICENSE in the source distribution or at
Packit c4476c
 * https://www.openssl.org/source/license.html
Packit c4476c
 */
Packit c4476c
Packit c4476c
#include <stdio.h>
Packit c4476c
#include "internal/cryptlib.h"
Packit c4476c
#include <openssl/evp.h>
Packit c4476c
#include <openssl/objects.h>
Packit c4476c
#include "crypto/evp.h"
Packit c4476c
Packit c4476c
static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
Packit c4476c
                         const unsigned char *iv, int enc);
Packit c4476c
static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
Packit c4476c
                       const unsigned char *in, size_t inl);
Packit c4476c
static const EVP_CIPHER n_cipher = {
Packit c4476c
    NID_undef,
Packit c4476c
    1, 0, 0,
Packit c4476c
    EVP_CIPH_FLAG_FIPS,
Packit c4476c
    null_init_key,
Packit c4476c
    null_cipher,
Packit c4476c
    NULL,
Packit c4476c
    0,
Packit c4476c
    NULL,
Packit c4476c
    NULL,
Packit c4476c
    NULL,
Packit c4476c
    NULL
Packit c4476c
};
Packit c4476c
Packit c4476c
const EVP_CIPHER *EVP_enc_null(void)
Packit c4476c
{
Packit c4476c
    return &n_cipher;
Packit c4476c
}
Packit c4476c
Packit c4476c
static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
Packit c4476c
                         const unsigned char *iv, int enc)
Packit c4476c
{
Packit c4476c
    return 1;
Packit c4476c
}
Packit c4476c
Packit c4476c
static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
Packit c4476c
                       const unsigned char *in, size_t inl)
Packit c4476c
{
Packit c4476c
    if (in != out)
Packit c4476c
        memcpy(out, in, inl);
Packit c4476c
    return 1;
Packit c4476c
}