summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2007-04-23 23:48:59 +0000
committerBodo Möller <bodo@openssl.org>2007-04-23 23:48:59 +0000
commit96afc1cfd53a0ffcca8544fa751eb9bf17749133 (patch)
treea21b008f179047a3a4c244c379ec33599bfd77e9 /crypto
parent24a8c25ab5a91b4cf467aef1af3dcc474b1c7df2 (diff)
Add SEED encryption algorithm.
PR: 1503 Submitted by: KISA Reviewed by: Bodo Moeller
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asn1/Makefile6
-rw-r--r--crypto/crypto-lib.com5
-rw-r--r--crypto/dsa/Makefile48
-rw-r--r--crypto/evp/Makefile16
-rw-r--r--crypto/evp/c_allc.c9
-rw-r--r--crypto/evp/e_seed.c83
-rw-r--r--crypto/evp/evp.h9
-rw-r--r--crypto/evp/evp_test.c7
-rw-r--r--crypto/evp/evptests.txt9
-rw-r--r--crypto/hmac/Makefile25
-rw-r--r--crypto/install.com3
-rw-r--r--crypto/objects/obj_dat.h35
-rw-r--r--crypto/objects/obj_mac.h25
-rw-r--r--crypto/objects/obj_mac.num5
-rw-r--r--crypto/objects/objects.txt10
-rw-r--r--crypto/pkcs7/Makefile6
-rw-r--r--crypto/seed/Makefile87
-rw-r--r--crypto/seed/seed.c286
-rw-r--r--crypto/seed/seed.h137
-rw-r--r--crypto/seed/seed_cbc.c129
-rw-r--r--crypto/seed/seed_cfb.c144
-rw-r--r--crypto/seed/seed_ecb.c60
-rw-r--r--crypto/seed/seed_locl.h116
-rw-r--r--crypto/seed/seed_ofb.c128
-rw-r--r--crypto/stack/safestack.h2
25 files changed, 1351 insertions, 39 deletions
diff --git a/crypto/asn1/Makefile b/crypto/asn1/Makefile
index 9890b062e4..8ec745b8c5 100644
--- a/crypto/asn1/Makefile
+++ b/crypto/asn1/Makefile
@@ -388,6 +388,12 @@ asn_pack.o: ../../include/openssl/opensslconf.h
asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c
+bio_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+bio_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+bio_asn1.o: ../../include/openssl/opensslconf.h
+bio_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+bio_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+bio_asn1.o: ../../include/openssl/symhacks.h bio_asn1.c
d2i_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
diff --git a/crypto/crypto-lib.com b/crypto/crypto-lib.com
index c4362f569e..248469920d 100644
--- a/crypto/crypto-lib.com
+++ b/crypto/crypto-lib.com
@@ -78,7 +78,7 @@ $!
$ ENCRYPT_TYPES = "Basic,"+ -
"OBJECTS,"+ -
"MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,WHRLPOOL,"+ -
- "DES,AES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,"+ -
+ "DES,AES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,"+ -
"BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,"+ -
"BUFFER,BIO,STACK,LHASH,RAND,ERR,"+ -
"EVP,EVP_2,EVP_3,ASN1,ASN1_2,PEM,X509,X509V3,"+ -
@@ -185,6 +185,7 @@ $ LIB_BF = "bf_skey,bf_ecb,bf_enc,bf_cfb64,bf_ofb64"
$ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64"
$ LIB_CAMELLIA = "camellia,cmll_misc,cmll_ecb,cmll_cbc,cmll_ofb,"+ -
"cmll_cfb,cmll_ctr"
+$ LIB_SEED = "seed,seed_cbc,seed_ecb,seed_cfb,seed_ofb"
$ LIB_BN_ASM = "[.asm]vms.mar,vms-helper"
$ IF F$TRNLNM("OPENSSL_NO_ASM").OR.ARCH.EQS."AXP" THEN LIB_BN_ASM = "bn_asm"
$ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ -
@@ -229,7 +230,7 @@ $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,"+ -
$ LIB_ERR = "err,err_all,err_prn"
$ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err,obj_xref"
$ LIB_EVP = "encode,digest,evp_enc,evp_key,evp_acnf,"+ -
- "e_des,e_bf,e_idea,e_des3,e_camellia,"+ -
+ "e_des,e_bf,e_idea,e_des3,e_camellia,e_seed,"+ -
"e_rc4,e_aes,names,"+ -
"e_xcbc_d,e_rc2,e_cast,e_rc5"
$ LIB_EVP_2 = "m_null,m_md2,m_md4,m_md5,m_sha,m_sha1,m_wp," + -
diff --git a/crypto/dsa/Makefile b/crypto/dsa/Makefile
index cd3126e16c..9cf490a046 100644
--- a/crypto/dsa/Makefile
+++ b/crypto/dsa/Makefile
@@ -128,7 +128,7 @@ dsa_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
dsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
dsa_gen.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-dsa_gen.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_gen.c
+dsa_gen.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_gen.c dsa_locl.h
dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
dsa_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
@@ -155,23 +155,23 @@ dsa_ossl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
dsa_ossl.o: ../../include/openssl/opensslconf.h
dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-dsa_ossl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-dsa_ossl.o: ../cryptlib.h dsa_ossl.c
+dsa_ossl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+dsa_ossl.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_ossl.c
dsa_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
dsa_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
dsa_pmeth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-dsa_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-dsa_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-dsa_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-dsa_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-dsa_pmeth.o: ../../include/openssl/objects.h
+dsa_pmeth.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+dsa_pmeth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
+dsa_pmeth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+dsa_pmeth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+dsa_pmeth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
dsa_pmeth.o: ../../include/openssl/opensslconf.h
dsa_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-dsa_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-dsa_pmeth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-dsa_pmeth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-dsa_pmeth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-dsa_pmeth.o: ../cryptlib.h ../evp/evp_locl.h dsa_pmeth.c
+dsa_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+dsa_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+dsa_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+dsa_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_locl.h
+dsa_pmeth.o: dsa_locl.h dsa_pmeth.c
dsa_prn.o: ../../e_os.h ../../include/openssl/asn1.h
dsa_prn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
dsa_prn.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
@@ -182,23 +182,19 @@ dsa_prn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
dsa_prn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
dsa_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
dsa_prn.o: ../cryptlib.h dsa_prn.c
-dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h
-dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+dsa_sign.o: ../../e_os.h ../../include/openssl/bio.h
dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
dsa_sign.o: ../../include/openssl/opensslconf.h
dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
-dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-dsa_sign.o: ../cryptlib.h dsa_sign.c
-dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h
-dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
-dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
-dsa_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-dsa_vrf.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
-dsa_vrf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-dsa_vrf.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
+dsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+dsa_sign.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_sign.c
+dsa_vrf.o: ../../e_os.h ../../include/openssl/bio.h
+dsa_vrf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+dsa_vrf.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
dsa_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
dsa_vrf.o: ../cryptlib.h dsa_vrf.c
diff --git a/crypto/evp/Makefile b/crypto/evp/Makefile
index 89e2eeee8e..b11297e7f8 100644
--- a/crypto/evp/Makefile
+++ b/crypto/evp/Makefile
@@ -20,7 +20,7 @@ APPS=
LIB=$(TOP)/libcrypto.a
LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\
- e_rc4.c e_aes.c names.c \
+ e_rc4.c e_aes.c names.c e_seed.c \
e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c m_wp.c \
m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c\
@@ -32,7 +32,7 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\
- e_rc4.o e_aes.o names.o \
+ e_rc4.o e_aes.o names.o e_seed.o \
e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o m_wp.o \
m_dss.o m_dss1.o m_mdc2.o m_ripemd.o m_ecdsa.o\
@@ -279,6 +279,15 @@ e_rc5.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
e_rc5.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
e_rc5.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc5.c
+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
+e_seed.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+e_seed.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+e_seed.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+e_seed.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
+e_seed.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+e_seed.o: e_seed.c evp_locl.h
e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h
e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
@@ -525,7 +534,8 @@ m_sigver.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
m_sigver.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
m_sigver.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
m_sigver.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-m_sigver.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_sigver.c
+m_sigver.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h
+m_sigver.o: m_sigver.c
m_wp.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
m_wp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
m_wp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
diff --git a/crypto/evp/c_allc.c b/crypto/evp/c_allc.c
index 68630dd7ea..bafb81bfa0 100644
--- a/crypto/evp/c_allc.c
+++ b/crypto/evp/c_allc.c
@@ -107,6 +107,15 @@ void OpenSSL_add_all_ciphers(void)
EVP_add_cipher_alias(SN_idea_cbc,"idea");
#endif
+#ifndef OPENSSL_NO_SEED
+ EVP_add_cipher(EVP_seed_ecb());
+ EVP_add_cipher(EVP_seed_cfb());
+ EVP_add_cipher(EVP_seed_ofb());
+ EVP_add_cipher(EVP_seed_cbc());
+ EVP_add_cipher_alias(SN_seed_cbc,"SEED");
+ EVP_add_cipher_alias(SN_seed_cbc,"seed");
+#endif
+
#ifndef OPENSSL_NO_RC2
EVP_add_cipher(EVP_rc2_ecb());
EVP_add_cipher(EVP_rc2_cfb());
diff --git a/crypto/evp/e_seed.c b/crypto/evp/e_seed.c
new file mode 100644
index 0000000000..2d1759d276
--- /dev/null
+++ b/crypto/evp/e_seed.c
@@ -0,0 +1,83 @@
+/* crypto/evp/e_seed.c -*- mode:C; c-file-style: "eay" -*- */
+/* ====================================================================
+ * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#include <openssl/opensslconf.h>
+#ifndef OPENSSL_NO_SEED
+#include <openssl/evp.h>
+#include <openssl/err.h>
+#include <string.h>
+#include <assert.h>
+#include <openssl/seed.h>
+#include "evp_locl.h"
+
+static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc);
+
+typedef struct
+ {
+ SEED_KEY_SCHEDULE ks;
+ } EVP_SEED_KEY;
+
+IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed,
+ 16, 16, 16, 128,
+ 0, seed_init_key, 0, 0, 0, 0)
+
+static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+ const unsigned char *iv, int enc)
+ {
+ SEED_set_key(key, ctx->cipher_data);
+ return 1;
+ }
+
+#endif
diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h
index 7b979504e6..428300e000 100644
--- a/crypto/evp/evp.h
+++ b/crypto/evp/evp.h
@@ -767,6 +767,14 @@ const EVP_CIPHER *EVP_camellia_256_cfb128(void);
const EVP_CIPHER *EVP_camellia_256_ofb(void);
#endif
+#ifndef OPENSSL_NO_SEED
+const EVP_CIPHER *EVP_seed_ecb(void);
+const EVP_CIPHER *EVP_seed_cbc(void);
+const EVP_CIPHER *EVP_seed_cfb128(void);
+# define EVP_seed_cfb EVP_seed_cfb128
+const EVP_CIPHER *EVP_seed_ofb(void);
+#endif
+
void OPENSSL_add_all_algorithms_noconf(void);
void OPENSSL_add_all_algorithms_conf(void);
@@ -1265,6 +1273,7 @@ void ERR_load_EVP_strings(void);
#define EVP_R_UNSUPPORTED_SALT_TYPE 126
#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
#define EVP_R_WRONG_PUBLIC_KEY_TYPE 110
+#define EVP_R_SEED_KEY_SETUP_FAILED 162
#ifdef __cplusplus
}
diff --git a/crypto/evp/evp_test.c b/crypto/evp/evp_test.c
index 6ecbecce75..bb6f02c2e9 100644
--- a/crypto/evp/evp_test.c
+++ b/crypto/evp/evp_test.c
@@ -424,6 +424,13 @@ int main(int argc,char **argv)
continue;
}
#endif
+#ifdef OPENSSL_NO_SEED
+ if (strstr(cipher, "SEED") == cipher)
+ {
+ fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
+ continue;
+ }
+#endif
fprintf(stderr,"Can't find %s\n",cipher);
EXIT(3);
}
diff --git a/crypto/evp/evptests.txt b/crypto/evp/evptests.txt
index 193009f781..beb12144b6 100644
--- a/crypto/evp/evptests.txt
+++ b/crypto/evp/evptests.txt
@@ -310,3 +310,12 @@ CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF
CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:0
CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:0
+# SEED test vectors from RFC4269
+SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0F:5EBAC6E0054E166819AFF1CC6D346CDB:0
+SEED-ECB:000102030405060708090A0B0C0D0E0F::00000000000000000000000000000000:C11F22F20140505084483597E4370F43:0
+SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7D:EE54D13EBCAE706D226BC3142CD40D4A:0
+SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC7:9B9B7BFCD1813CB95D0B3618F40F5122:0
+SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0F:5EBAC6E0054E166819AFF1CC6D346CDB:1
+SEED-ECB:000102030405060708090A0B0C0D0E0F::00000000000000000000000000000000:C11F22F20140505084483597E4370F43:1
+SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7D:EE54D13EBCAE706D226BC3142CD40D4A:1
+SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC7:9B9B7BFCD1813CB95D0B3618F40F5122:1
diff --git a/crypto/hmac/Makefile b/crypto/hmac/Makefile
index 5f7df5d647..0e91709f64 100644
--- a/crypto/hmac/Makefile
+++ b/crypto/hmac/Makefile
@@ -74,6 +74,31 @@ clean:
# DO NOT DELETE THIS LINE -- make depend depends on it.
+hm_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
+hm_ameth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+hm_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+hm_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+hm_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+hm_ameth.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+hm_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+hm_ameth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+hm_ameth.o: ../../include/openssl/symhacks.h ../asn1/asn1_locl.h ../cryptlib.h
+hm_ameth.o: hm_ameth.c
+hm_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
+hm_pmeth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+hm_pmeth.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+hm_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+hm_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+hm_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+hm_pmeth.o: ../../include/openssl/hmac.h ../../include/openssl/lhash.h
+hm_pmeth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+hm_pmeth.o: ../../include/openssl/opensslconf.h
+hm_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+hm_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+hm_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+hm_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+hm_pmeth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+hm_pmeth.o: ../cryptlib.h ../evp/evp_locl.h hm_pmeth.c
hmac.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
hmac.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
hmac.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
diff --git a/crypto/install.com b/crypto/install.com
index 8aa387df2b..da4ab8569c 100644
--- a/crypto/install.com
+++ b/crypto/install.com
@@ -35,7 +35,7 @@ $
$ SDIRS := ,-
OBJECTS,-
MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,WHRLPOOL,-
- DES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,-
+ DES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,-
BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,AES,-
BUFFER,BIO,STACK,LHASH,RAND,ERR,-
EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,-
@@ -60,6 +60,7 @@ $ EXHEADER_IDEA := idea.h
$ EXHEADER_BF := blowfish.h
$ EXHEADER_CAST := cast.h
$ EXHEADER_CAMELLIA := camellia.h
+$ EXHEADER_SEED := seed.h
$ EXHEADER_BN := bn.h
$ EXHEADER_EC := ec.h
$ EXHEADER_RSA := rsa.h
diff --git a/crypto/objects/obj_dat.h b/crypto/objects/obj_dat.h
index 5108a3b20d..872d79ba4f 100644
--- a/crypto/objects/obj_dat.h
+++ b/crypto/objects/obj_dat.h
@@ -62,12 +62,12 @@
* [including the GNU Public Licence.]
*/
-#define NUM_NID 837
-#define NUM_SN 833
-#define NUM_LN 833
-#define NUM_OBJ 787
+#define NUM_NID 842
+#define NUM_SN 838
+#define NUM_LN 838
+#define NUM_OBJ 792
-static unsigned char lvalues[5560]={
+static unsigned char lvalues[5598]={
0x00, /* [ 0] OBJ_undef */
0x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 1] OBJ_rsadsi */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 7] OBJ_pkcs */
@@ -855,6 +855,11 @@ static unsigned char lvalues[5560]={
0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x04, /* [5533] OBJ_ecdsa_with_SHA512 */
0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x01,/* [5541] OBJ_dsa_with_SHA224 */
0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x02,/* [5550] OBJ_dsa_with_SHA256 */
+0x2A,0x83,0x1A,0x8C,0x9A,0x44, /* [5559] OBJ_kisa */
+0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x03, /* [5565] OBJ_seed_ecb */
+0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x04, /* [5573] OBJ_seed_cbc */
+0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x05, /* [5581] OBJ_seed_cfb128 */
+0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x06, /* [5589] OBJ_seed_ofb128 */
};
static ASN1_OBJECT nid_objs[NUM_NID]={
@@ -2210,6 +2215,11 @@ static ASN1_OBJECT nid_objs[NUM_NID]={
&(lvalues[5550]),0},
{"gost89-cnt","gost89-cnt",NID_gost89_cnt,0,NULL,0},
{"HMAC","hmac",NID_hmac,0,NULL,0},
+{"KISA","kisa",NID_kisa,6,&(lvalues[5559]),0},
+{"SEED-ECB","seed-ecb",NID_seed_ecb,8,&(lvalues[5565]),0},
+{"SEED-CBC","seed-cbc",NID_seed_cbc,8,&(lvalues[5573]),0},
+{"SEED-CFB","seed-cfb",NID_seed_cfb128,8,&(lvalues[5581]),0},
+{"SEED-OFB","seed-ofb",NID_seed_ofb128,8,&(lvalues[5589]),0},
};
static ASN1_OBJECT *sn_objs[NUM_SN]={
@@ -2300,6 +2310,7 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={
&(nid_objs[183]),/* "ISO-US" */
&(nid_objs[645]),/* "ITU-T" */
&(nid_objs[646]),/* "JOINT-ISO-ITU-T" */
+&(nid_objs[837]),/* "KISA" */
&(nid_objs[15]),/* "L" */
&(nid_objs[ 3]),/* "MD2" */
&(nid_objs[257]),/* "MD4" */
@@ -2362,6 +2373,10 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={
&(nid_objs[668]),/* "RSA-SHA256" */
&(nid_objs[669]),/* "RSA-SHA384" */
&(nid_objs[670]),/* "RSA-SHA512" */
+&(nid_objs[839]),/* "SEED-CBC" */
+&(nid_objs[840]),/* "SEED-CFB" */
+&(nid_objs[838]),/* "SEED-ECB" */
+&(nid_objs[841]),/* "SEED-OFB" */
&(nid_objs[41]),/* "SHA" */
&(nid_objs[64]),/* "SHA1" */
&(nid_objs[675]),/* "SHA224" */
@@ -3564,6 +3579,7 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={
&(nid_objs[492]),/* "janetMailbox" */
&(nid_objs[646]),/* "joint-iso-itu-t" */
&(nid_objs[150]),/* "keyBag" */
+&(nid_objs[837]),/* "kisa" */
&(nid_objs[477]),/* "lastModifiedBy" */
&(nid_objs[476]),/* "lastModifiedTime" */
&(nid_objs[157]),/* "localKeyID" */
@@ -3714,6 +3730,10 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={
&(nid_objs[733]),/* "sect571k1" */
&(nid_objs[734]),/* "sect571r1" */
&(nid_objs[635]),/* "secure device signature" */
+&(nid_objs[839]),/* "seed-cbc" */
+&(nid_objs[840]),/* "seed-cfb" */
+&(nid_objs[838]),/* "seed-ecb" */
+&(nid_objs[841]),/* "seed-ofb" */
&(nid_objs[105]),/* "serialNumber" */
&(nid_objs[625]),/* "set-addPolicy" */
&(nid_objs[515]),/* "set-attr" */
@@ -4158,6 +4178,7 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={
&(nid_objs[777]),/* OBJ_whirlpool 1 0 10118 3 0 55 */
&(nid_objs[124]),/* OBJ_rle_compression 1 1 1 1 666 1 */
&(nid_objs[125]),/* OBJ_zlib_compression 1 1 1 1 666 2 */
+&(nid_objs[837]),/* OBJ_kisa 1 2 410 200004 */
&(nid_objs[780]),/* OBJ_id_GostR3411_94_with_GostR3410_2001 1 2 643 2 2 3 */
&(nid_objs[781]),/* OBJ_id_GostR3411_94_with_GostR3410_94 1 2 643 2 2 4 */
&(nid_objs[782]),/* OBJ_id_GostR3411_94 1 2 643 2 2 9 */
@@ -4251,6 +4272,10 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={
&(nid_objs[768]),/* OBJ_camellia_256_ofb128 0 3 4401 5 3 1 9 43 */
&(nid_objs[759]),/* OBJ_camellia_256_cfb128 0 3 4401 5 3 1 9 44 */
&(nid_objs[437]),/* OBJ_pilot 0 9 2342 19200300 100 */
+&(nid_objs[838]),/* OBJ_seed_ecb 1 2 410 200004 1 3 */
+&(nid_objs[839]),/* OBJ_seed_cbc 1 2 410 200004 1 4 */
+&(nid_objs[840]),/* OBJ_seed_cfb128 1 2 410 200004 1 5 */
+&(nid_objs[841]),/* OBJ_seed_ofb128 1 2 410 200004 1 6 */
&(nid_objs[824]),/* OBJ_id_GostR3411_94_with_GostR3410_94_cc 1 2 643 2 9 1 3 3 */
&(nid_objs[825]),/* OBJ_id_GostR3411_94_with_GostR3410_2001_cc 1 2 643 2 9 1 3 4 */
&(nid_objs[822]),/* OBJ_id_GostR3410_94_cc 1 2 643 2 9 1 5 3 */
diff --git a/crypto/objects/obj_mac.h b/crypto/objects/obj_mac.h
index 6461c3453b..68e3ecfdb7 100644
--- a/crypto/objects/obj_mac.h
+++ b/crypto/objects/obj_mac.h
@@ -3680,6 +3680,31 @@
#define LN_camellia_256_cfb8 "camellia-256-cfb8"
#define NID_camellia_256_cfb8 765
+#define SN_kisa "KISA"
+#define LN_kisa "kisa"
+#define NID_kisa 837
+#define OBJ_kisa OBJ_member_body,410L,200004L
+
+#define SN_seed_ecb "SEED-ECB"
+#define LN_seed_ecb "seed-ecb"
+#define NID_seed_ecb 838
+#define OBJ_seed_ecb OBJ_kisa,1L,3L
+
+#define SN_seed_cbc "SEED-CBC"
+#define LN_seed_cbc "seed-cbc"
+#define NID_seed_cbc 839
+#define OBJ_seed_cbc OBJ_kisa,1L,4L
+
+#define SN_seed_cfb128 "SEED-CFB"
+#define LN_seed_cfb128 "seed-cfb"
+#define NID_seed_cfb128 840
+#define OBJ_seed_cfb128 OBJ_kisa,1L,5L
+
+#define SN_seed_ofb128 "SEED-OFB"
+#define LN_seed_ofb128 "seed-ofb"
+#define NID_seed_ofb128 841
+#define OBJ_seed_ofb128 OBJ_kisa,1L,6L
+
#define SN_hmac "HMAC"
#define LN_hmac "hmac"
#define NID_hmac 836
diff --git a/crypto/objects/obj_mac.num b/crypto/objects/obj_mac.num
index 3ca42fe84a..5386af062e 100644
--- a/crypto/objects/obj_mac.num
+++ b/crypto/objects/obj_mac.num
@@ -834,3 +834,8 @@ dsa_with_SHA224 833
dsa_with_SHA256 834
gost89_cnt 835
hmac 836
+kisa 837
+seed_ecb 838
+seed_cbc 839
+seed_cfb128 840
+seed_ofb128 841
diff --git a/crypto/objects/objects.txt b/crypto/objects/objects.txt
index 8bd9653db9..628ec2886e 100644
--- a/crypto/objects/objects.txt
+++ b/crypto/objects/objects.txt
@@ -1189,6 +1189,16 @@ camellia 44 : CAMELLIA-256-CFB : camellia-256-cfb
: CAMELLIA-192-CFB8 : camellia-192-cfb8
: CAMELLIA-256-CFB8 : camellia-256-cfb8
+# Definitions for SEED cipher - ECB, CBC, OFB mode
+
+member-body 410 200004 : KISA : kisa
+kisa 1 3 : SEED-ECB : seed-ecb
+kisa 1 4 : SEED-CBC : seed-cbc
+!Cname seed-cfb128
+kisa 1 5 : SEED-CFB : seed-cfb
+!Cname seed-ofb128
+kisa 1 6 : SEED-OFB : seed-ofb
+
# There is no OID that just denotes "HMAC" oddly enough...
: HMAC : hmac
diff --git a/crypto/pkcs7/Makefile b/crypto/pkcs7/Makefile
index 675c319568..3cba38aa1a 100644
--- a/crypto/pkcs7/Makefile
+++ b/crypto/pkcs7/Makefile
@@ -95,6 +95,12 @@ clean:
# DO NOT DELETE THIS LINE -- make depend depends on it.
+bio_pk7.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+bio_pk7.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+bio_pk7.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+bio_pk7.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+bio_pk7.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+bio_pk7.o: ../../include/openssl/symhacks.h bio_pk7.c
pk7_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
pk7_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
pk7_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
diff --git a/crypto/seed/Makefile b/crypto/seed/Makefile
new file mode 100644
index 0000000000..f9de27b288
--- /dev/null
+++ b/crypto/seed/Makefile
@@ -0,0 +1,87 @@
+#
+# crypto/seed/Makefile
+#
+
+DIR= seed
+TOP= ../..
+CC= cc
+CPP= $(CC) -E
+INCLUDES=
+CFLAG=-g
+MAKEFILE= Makefile
+AR= ar r
+
+CFLAGS= $(INCLUDES) $(CFLAG)
+
+GENERAL=Makefile
+TEST=
+APPS=
+
+LIB=$(TOP)/libcrypto.a
+LIBSRC=seed.c seed_ecb.c seed_cbc.c seed_cfb.c seed_ofb.c
+LIBOBJ=seed.o seed_ecb.o seed_cbc.o seed_cfb.o seed_ofb.o
+
+SRC= $(LIBSRC)
+
+EXHEADER= seed.h
+HEADER= seed_locl.h $(EXHEADER)
+
+ALL= $(GENERAL) $(SRC) $(HEADER)
+
+top:
+ (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
+
+all: lib
+
+lib: $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
+ $(RANLIB) $(LIB) || echo Never mind.
+ @touch lib
+
+file