new modules

This commit is contained in:
Zhi Guan
2015-10-05 15:34:54 +08:00
parent 8afb3ef97b
commit 254a1266d6
49 changed files with 4895 additions and 187 deletions

View File

@@ -30,7 +30,7 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c evp_cnf.c \
evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c \
e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c \
e_aes_cbc_hmac_sha1.c e_aes_cbc_hmac_sha256.c e_rc4_hmac_md5.c \
m_sm3.c e_sms4.c
m_sm3.c e_sms4.c e_zuc.c
LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o evp_cnf.o \
e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\
@@ -44,7 +44,7 @@ LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o evp_cnf.o \
evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o \
e_old.o pmeth_lib.o pmeth_fn.o pmeth_gn.o m_sigver.o \
e_aes_cbc_hmac_sha1.o e_aes_cbc_hmac_sha256.o e_rc4_hmac_md5.o \
m_sm3.o e_sms4.o
m_sm3.o e_sms4.o e_zuc.o
SRC= $(LIBSRC)
@@ -354,6 +354,16 @@ e_sms4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
e_sms4.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
e_sms4.o: ../../include/openssl/symhacks.h ../cryptlib.h e_sms4.c evp_locl.h
e_zuc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
e_zuc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
e_zuc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
#e_zuc.o: ../../include/openssl/evp.h ../../include/openssl/zuc.h
e_zuc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
e_zuc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
e_zuc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
e_zuc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
e_zuc.o: ../../include/openssl/symhacks.h ../cryptlib.h e_zuc.c evp_locl.h
e_seed.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
e_seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
e_seed.o: ../../include/openssl/err.h ../../include/openssl/evp.h

View File

@@ -172,6 +172,10 @@ void OpenSSL_add_all_ciphers(void)
EVP_add_cipher_alias(SN_sms4_cbc,"sms4");
#endif
#ifndef OPENSSL_NO_ZUC
EVP_add_cipher(EVP_zuc());
#endif
#ifndef OPENSSL_NO_AES
EVP_add_cipher(EVP_aes_128_ecb());
EVP_add_cipher(EVP_aes_128_cbc());

48
crypto/evp/e_zuc.c Normal file
View File

@@ -0,0 +1,48 @@
#include <stdio.h>
#include "cryptlib.h"
#ifndef OPENSSL_NO_ZUC
#include <openssl/evp.h>
#include "evp_locl.h"
#include <openssl/objects.h>
#include <openssl/zuc.h>
static int zuc_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc)
{
//ZUC_set_key((ZUC_KEY *)&ctx->cipher_data, EVP_CIPHER_CTX_key_length(ctx), key);
return 1;
}
static int zuc_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inlen)
{
//ZUC_encrypt((ZUC_KEY *)&ctx->cipher_data, inlen, in, out);
return 1;
}
static const EVP_CIPHER zuc_cipher = {
NID_zuc, /* nid */
4, /* block_size */
16, /* key_len */
16, /* iv_len */
0, /* flags */
zuc_init, /* init() */
zuc_do_cipher, /* do_cipher() */
NULL, /* cleanup() */
sizeof(ZUC_KEY), /* ctx_size */
NULL, /* set_asn1_parameters() */
NULL, /* get_asn1_parameters() */
NULL, /* ctrl() */
NULL /* app_data */
};
const EVP_CIPHER *EVP_zuc(void)
{
return &zuc_cipher;
}
#endif

View File

@@ -838,6 +838,9 @@ const EVP_CIPHER *EVP_sms4_ofb128(void);
#define EVP_sm4_cfb128 EVP_sms4_cfb128
#define EVP_sm4_ofb128 EVP_sms4_ofb128
#endif
#ifndef OPENSSL_NO_ZUC
const EVP_CIPHER *EVP_zuc(void);
#endif
# ifndef OPENSSL_NO_AES
const EVP_CIPHER *EVP_aes_128_ecb(void);
const EVP_CIPHER *EVP_aes_128_cbc(void);