2016-05-17 18:24:46 +00:00
|
|
|
/*
|
|
|
|
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
1998-12-21 10:52:47 +00:00
|
|
|
*
|
2016-05-17 18:24:46 +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
|
1998-12-21 10:52:47 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2015-05-14 14:56:48 +00:00
|
|
|
#include "internal/cryptlib.h"
|
1999-04-23 22:13:45 +00:00
|
|
|
#include <openssl/evp.h>
|
|
|
|
#include <openssl/objects.h>
|
2015-12-18 16:01:28 +00:00
|
|
|
#include "internal/evp_int.h"
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2000-06-03 14:13:58 +00:00
|
|
|
static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
2015-01-22 03:40:55 +00:00
|
|
|
const unsigned char *iv, int enc);
|
2000-05-27 12:38:43 +00:00
|
|
|
static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
2015-01-22 03:40:55 +00:00
|
|
|
const unsigned char *in, size_t inl);
|
|
|
|
static const EVP_CIPHER n_cipher = {
|
|
|
|
NID_undef,
|
|
|
|
1, 0, 0, 0,
|
|
|
|
null_init_key,
|
|
|
|
null_cipher,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
};
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2001-03-09 02:51:02 +00:00
|
|
|
const EVP_CIPHER *EVP_enc_null(void)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
return (&n_cipher);
|
|
|
|
}
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2000-06-03 14:13:58 +00:00
|
|
|
static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
2015-01-22 03:40:55 +00:00
|
|
|
const unsigned char *iv, int enc)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2000-05-27 12:38:43 +00:00
|
|
|
static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
2015-01-22 03:40:55 +00:00
|
|
|
const unsigned char *in, size_t inl)
|
|
|
|
{
|
|
|
|
if (in != out)
|
2015-05-04 22:00:15 +00:00
|
|
|
memcpy(out, in, inl);
|
2015-01-22 03:40:55 +00:00
|
|
|
return 1;
|
|
|
|
}
|