diff -uNr /usr/src/crypto/openssl.bak/apps/enc.c ./apps/enc.c --- /usr/src/crypto/openssl.bak/apps/enc.c Sun Nov 26 11:32:48 2000 +++ ./apps/enc.c Mon Jul 29 18:05:21 2002 @@ -385,6 +385,9 @@ str = pass; } + if (c == EVP_enc_rot13()) + nosalt=1; + if ((str == NULL) && (cipher != NULL) && (hkey == NULL)) { for (;;) @@ -413,7 +416,6 @@ } } } - if (outf == NULL) { diff -uNr /usr/src/crypto/openssl.bak/apps/progs.h ./apps/progs.h --- /usr/src/crypto/openssl.bak/apps/progs.h Sun Nov 26 11:32:48 2000 +++ ./apps/progs.h Fri Jul 26 12:32:20 2002 @@ -117,6 +117,7 @@ {FUNC_TYPE_MD,"mdc2",dgst_main}, {FUNC_TYPE_MD,"rmd160",dgst_main}, {FUNC_TYPE_CIPHER,"base64",enc_main}, + {FUNC_TYPE_CIPHER,"rot13",enc_main}, #ifndef NO_DES {FUNC_TYPE_CIPHER,"des",enc_main}, #endif diff -uNr /usr/src/crypto/openssl.bak/apps/progs.pl ./apps/progs.pl --- /usr/src/crypto/openssl.bak/apps/progs.pl Sun Nov 26 11:32:48 2000 +++ ./apps/progs.pl Fri Jul 26 12:32:20 2002 @@ -48,6 +48,7 @@ } foreach ( + "rot13", "base64", "des", "des3", "desx", "idea", "rc4", "rc4-40", "rc2", "bf", "cast", "rc5", diff -uNr /usr/src/crypto/openssl.bak/crypto/evp/Makefile.ssl ./crypto/evp/Makefile.ssl --- /usr/src/crypto/openssl.bak/crypto/evp/Makefile.ssl Thu Jul 5 00:19:24 2001 +++ ./crypto/evp/Makefile.ssl Fri Jul 26 12:32:23 2002 @@ -29,7 +29,7 @@ m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \ m_dss.c m_dss1.c m_mdc2.c m_ripemd.c \ p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \ - bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \ + bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c e_rot13.c \ c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \ evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c diff -uNr /usr/src/crypto/openssl.bak/crypto/evp/c_allc.c ./crypto/evp/c_allc.c --- /usr/src/crypto/openssl.bak/crypto/evp/c_allc.c Sun Aug 20 09:48:36 2000 +++ ./crypto/evp/c_allc.c Fri Jul 26 13:49:42 2002 @@ -146,4 +146,6 @@ #endif PKCS12_PBE_add(); PKCS5_PBE_add(); + + EVP_add_cipher(EVP_enc_rot13()); } diff -uNr /usr/src/crypto/openssl.bak/crypto/evp/e_rot13.c ./crypto/evp/e_rot13.c --- /usr/src/crypto/openssl.bak/crypto/evp/e_rot13.c Thu Jan 1 01:00:00 1970 +++ ./crypto/evp/e_rot13.c Mon Jul 29 18:05:35 2002 @@ -0,0 +1,88 @@ +/* crypto/evp/e_rot13.c */ +/* + * Copyright (c) 2001, 2002 Bruce M. Simpson. + * 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 acknowledgement: + * This product includes software developed by Bruce M. Simpson. + * 4. Neither the name of Bruce M. Simpson nor the names of other + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES + * ``AS IS'' AND ANY EXPRESS 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 FOUNDATION OR 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. + */ + +#include +#include "cryptlib.h" +#include +#include + +static int rot13_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, + const unsigned char *iv,int enc); +static int rot13_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, unsigned int inl); +static EVP_CIPHER r_cipher= + { + NID_rot13, + 1,0,0, + 0, + rot13_init_key, + rot13_cipher, + NULL, + 0, + NULL, + NULL, + NULL + }; + +EVP_CIPHER *EVP_enc_rot13(void) + { + return(&r_cipher); + } + +static int rot13_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, + const unsigned char *iv, int enc) + { + memset(&(ctx->c),0,sizeof(ctx->c)); + return 1; + } + +static int rot13_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, unsigned int inl) + { + if (in != out) + { + unsigned char *pin = in, *pout = out, c; + + while (--inl) + { + c = *pin++; + if (islower(c)) + c = (((c - 'a') + 13 ) % 26) + 'a'; + else if (isupper(c)) + c = (((c - 'A') + 13 ) % 26) + 'A'; + *pout++ = c; + } + } + return 1; + } + diff -uNr /usr/src/crypto/openssl.bak/crypto/evp/evp.h ./crypto/evp/evp.h --- /usr/src/crypto/openssl.bak/crypto/evp/evp.h Thu Jul 5 00:19:24 2001 +++ ./crypto/evp/evp.h Fri Jul 26 12:32:23 2002 @@ -644,6 +644,7 @@ EVP_MD *EVP_ripemd160(void); #endif EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ +EVP_CIPHER *EVP_enc_rot13(void); /* does *something* */ #ifndef NO_DES EVP_CIPHER *EVP_des_ecb(void); EVP_CIPHER *EVP_des_ede(void); diff -uNr /usr/src/crypto/openssl.bak/crypto/objects/obj_dat.h ./crypto/objects/obj_dat.h --- /usr/src/crypto/openssl.bak/crypto/objects/obj_dat.h Sun Nov 26 11:33:42 2000 +++ ./crypto/objects/obj_dat.h Mon Jul 29 18:03:57 2002 @@ -61,12 +61,12 @@ * perl obj_dat.pl objects.h obj_dat.h */ -#define NUM_NID 393 -#define NUM_SN 392 -#define NUM_LN 392 -#define NUM_OBJ 366 +#define NUM_NID 394 +#define NUM_SN 393 +#define NUM_LN 393 +#define NUM_OBJ 367 -static unsigned char lvalues[2896]={ +static unsigned char lvalues[2902]={ 0x00, /* [ 0] OBJ_undef */ 0x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 1] OBJ_rsadsi */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 7] OBJ_pkcs */ @@ -433,6 +433,7 @@ 0xBA,0x82,0x58, /* [2872] OBJ_dcObject */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x19,/* [2875] OBJ_domainComponent */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x0D,/* [2885] OBJ_Domain */ +0x29,0x01,0x01,0x85,0x1A,0x03, /* [2895] OBJ_rot13 */ }; static ASN1_OBJECT nid_objs[NUM_NID]={ @@ -1045,6 +1046,7 @@ {"dcobject","dcObject",NID_dcObject,3,&(lvalues[2872]),0}, {"DC","domainComponent",NID_domainComponent,10,&(lvalues[2875]),0}, {"domain","Domain",NID_Domain,10,&(lvalues[2885]),0}, +{"ROT13","rot13",NID_rot13,6,&(lvalues[2895]),0}, }; static ASN1_OBJECT *sn_objs[NUM_SN]={ @@ -1136,6 +1138,7 @@ &(nid_objs[123]),/* "RC5-OFB" */ &(nid_objs[117]),/* "RIPEMD160" */ &(nid_objs[124]),/* "RLE" */ +&(nid_objs[393]),/* "ROT13" */ &(nid_objs[19]),/* "RSA" */ &(nid_objs[ 7]),/* "RSA-MD2" */ &(nid_objs[ 8]),/* "RSA-MD5" */ @@ -1416,6 +1419,7 @@ &(nid_objs[385]),/* "private" */ &(nid_objs[84]),/* "privateKeyUsagePeriod" */ &(nid_objs[286]),/* "qcStatements" */ +&(nid_objs[393]),/* "rot13" */ &(nid_objs[ 6]),/* "rsaEncryption" */ &(nid_objs[377]),/* "rsaSignature" */ &(nid_objs[ 1]),/* "rsadsi" */ @@ -1910,6 +1914,7 @@ &(nid_objs[143]),/* OBJ_sxnet 1 3 101 1 4 1 */ &(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[393]),/* OBJ_rot13 1 1 1 1 666 3 */ &(nid_objs[ 1]),/* OBJ_rsadsi 1 2 840 113549 */ &(nid_objs[185]),/* OBJ_X9cm 1 2 840 10040 4 */ &(nid_objs[127]),/* OBJ_id_pkix 1 3 6 1 5 5 7 */ diff -uNr /usr/src/crypto/openssl.bak/crypto/objects/obj_mac.h ./crypto/objects/obj_mac.h --- /usr/src/crypto/openssl.bak/crypto/objects/obj_mac.h Sun Nov 26 11:38:44 2000 +++ ./crypto/objects/obj_mac.h Fri Jul 26 15:51:41 2002 @@ -1796,3 +1796,7 @@ #define NID_zlib_compression 125 #define OBJ_zlib_compression 1L,1L,1L,1L,666L,2L +#define SN_rot13 "ROT13" +#define LN_rot13 "rot13" +#define NID_rot13 393 +#define OBJ_rot13 1L,1L,1L,1L,666L,3L diff -uNr /usr/src/crypto/openssl.bak/crypto/objects/objects.h ./crypto/objects/objects.h --- /usr/src/crypto/openssl.bak/crypto/objects/objects.h Sun Nov 26 11:33:43 2000 +++ ./crypto/objects/objects.h Fri Jul 26 15:50:46 2002 @@ -954,6 +954,12 @@ #define LN_OCSP_sign "OCSP Signing" #define NID_OCSP_sign 180 #define OBJ_OCSP_sign OBJ_id_kp,9L + +#define SN_rot13 "ROT13" +#define LN_rot13 "rot13" +#define NID_rot13 393 +#define OBJ_rot13 1L,1L,1L,1L,666L,3L + #endif /* USE_OBJ_MAC */ #include diff -uNr /usr/src/crypto/openssl.bak/crypto/objects/objects.txt ./crypto/objects/objects.txt --- /usr/src/crypto/openssl.bak/crypto/objects/objects.txt Sun Nov 26 11:33:43 2000 +++ ./crypto/objects/objects.txt Fri Jul 26 15:49:57 2002 @@ -590,4 +590,6 @@ 1 1 1 1 666 1 : RLE : run length compression !Cname zlib-compression 1 1 1 1 666 2 : ZLIB : zlib compression +!Cname rot13 +1 1 1 1 666 3 : ROT13 : rot13