2018-09-13 19:18:07 +00:00
|
|
|
/*
|
|
|
|
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2000-01-10 06:22:05 +00:00
|
|
|
*
|
2018-09-13 19:18:07 +00:00
|
|
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
2000-01-10 06:22:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2018-09-13 19:18:07 +00:00
|
|
|
#include "internal/cryptlib.h"
|
2000-01-10 06:22:05 +00:00
|
|
|
#include <openssl/evp.h>
|
|
|
|
#include <openssl/objects.h>
|
2020-03-17 21:27:57 +00:00
|
|
|
#include "crypto/evp.h"
|
2000-01-10 06:22:05 +00:00
|
|
|
|
2000-11-13 01:03:58 +00:00
|
|
|
static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
2015-03-20 15:28:40 +00:00
|
|
|
const unsigned char *iv, int enc);
|
2000-11-13 01:03:58 +00:00
|
|
|
static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
2015-03-20 15:28:40 +00:00
|
|
|
const unsigned char *in, size_t inl);
|
|
|
|
static const EVP_CIPHER n_cipher = {
|
|
|
|
NID_undef,
|
2018-09-13 19:18:07 +00:00
|
|
|
1, 0, 0, 0,
|
2015-03-20 15:28:40 +00:00
|
|
|
null_init_key,
|
|
|
|
null_cipher,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
};
|
2000-01-10 06:22:05 +00:00
|
|
|
|
2003-01-28 21:43:22 +00:00
|
|
|
const EVP_CIPHER *EVP_enc_null(void)
|
2015-03-20 15:28:40 +00:00
|
|
|
{
|
2018-09-13 19:18:07 +00:00
|
|
|
return &n_cipher;
|
2015-03-20 15:28:40 +00:00
|
|
|
}
|
2000-01-10 06:22:05 +00:00
|
|
|
|
2000-11-13 01:03:58 +00:00
|
|
|
static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
2015-03-20 15:28:40 +00:00
|
|
|
const unsigned char *iv, int enc)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2000-01-10 06:22:05 +00:00
|
|
|
|
2000-11-13 01:03:58 +00:00
|
|
|
static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
2015-03-20 15:28:40 +00:00
|
|
|
const unsigned char *in, size_t inl)
|
|
|
|
{
|
|
|
|
if (in != out)
|
2018-09-13 19:18:07 +00:00
|
|
|
memcpy(out, in, inl);
|
2015-03-20 15:28:40 +00:00
|
|
|
return 1;
|
|
|
|
}
|