Remove RSAREF (not used).

You can still get the code using tag "rsaref".
This commit is contained in:
Ulf Möller 2000-11-22 16:52:29 +00:00
parent 01412ec600
commit 37fc8c3747
7 changed files with 0 additions and 1688 deletions

View file

@ -1,2 +0,0 @@
lib
Makefile.save

View file

@ -1,102 +0,0 @@
#
# SSLeay/rsaref/Makefile
#
DIR= rsaref
TOP= ..
CC= cc
INCLUDES= -I../crypto -I../include
CFLAG=-g
INSTALL_PREFIX=
OPENSSLDIR= /usr/local/ssl
INSTALLTOP=/usr/local/ssl
MAKE= make -f Makefile.ssl
MAKEDEPEND= $(TOP)/util/domd $(TOP)
MAKEFILE= Makefile.ssl
AR= ar r
CFLAGS= $(INCLUDES) $(CFLAG)
GENERAL=Makefile rsaref-lib.com install.com
TEST=
APPS=
LIB=$(TOP)/libRSAglue.a
LIBSRC= rsaref.c rsar_err.c
LIBOBJ= rsaref.o rsar_err.o
SRC= $(LIBSRC)
EXHEADER= rsaref.h
HEADER= $(EXHEADER)
ALL= $(GENERAL) $(SRC) $(HEADER)
top:
(cd ..; $(MAKE) DIRS=rsaref all)
all: lib
lib: $(LIBOBJ)
$(AR) $(LIB) $(LIBOBJ)
@echo You may get an error following this line. Please ignore.
- $(RANLIB) $(LIB)
@touch lib
files:
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
links:
@$(TOP)/util/point.sh Makefile.ssl Makefile
@$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
@$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
@$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
install:
-@if [ "x`echo x $(EX_LIBS) | grep RSAglue`" != x ]; then \
echo "installing libRSAglue.a"; \
cp $(LIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/libRSAglue.a; \
$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/libRSAglue.a; \
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/libRSAglue.a; \
fi
# @for i in $(EXHEADER) ; \
# do \
# (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
# chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
# done;
tags:
ctags $(SRC)
tests:
lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
depend:
$(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC)
dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
mv -f Makefile.new $(MAKEFILE)
clean:
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
rsar_err.o: ../include/openssl/bio.h ../include/openssl/bn.h
rsar_err.o: ../include/openssl/crypto.h ../include/openssl/err.h
rsar_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
rsar_err.o: ../include/openssl/opensslv.h ../include/openssl/rsa.h
rsar_err.o: ../include/openssl/rsaref.h ../include/openssl/safestack.h
rsar_err.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
rsaref.o: ../crypto/cryptlib.h ../include/openssl/bio.h ../include/openssl/bn.h
rsaref.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
rsaref.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
rsaref.o: ../include/openssl/err.h ../include/openssl/lhash.h
rsaref.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
rsaref.o: ../include/openssl/rand.h ../include/openssl/rsa.h
rsaref.o: ../include/openssl/rsaref.h ../include/openssl/safestack.h
rsaref.o: ../include/openssl/stack.h ../include/openssl/symhacks.h

View file

@ -1,69 +0,0 @@
$! INSTALL.COM -- Installs the files in a given directory tree
$!
$! Author: Richard Levitte <richard@levitte.org>
$! Time of creation: 22-MAY-1998 10:13
$!
$! P1 root of the directory tree
$!
$ IF P1 .EQS. ""
$ THEN
$ WRITE SYS$OUTPUT "First argument missing."
$ WRITE SYS$OUTPUT "Should be the directory where you want things installed."
$ EXIT
$ ENDIF
$
$ ROOT = F$PARSE(P1,"[]A.;0",,,"SYNTAX_ONLY,NO_CONCEAL") - "A.;0"
$ ROOT_DEV = F$PARSE(ROOT,,,"DEVICE","SYNTAX_ONLY")
$ ROOT_DIR = F$PARSE(ROOT,,,"DIRECTORY","SYNTAX_ONLY") -
- "[000000." - "][" - "[" - "]"
$ ROOT = ROOT_DEV + "[" + ROOT_DIR
$
$ DEFINE/NOLOG WRK_SSLROOT 'ROOT'.] /TRANS=CONC
$ DEFINE/NOLOG WRK_SSLVLIB WRK_SSLROOT:[VAX_LIB]
$ DEFINE/NOLOG WRK_SSLALIB WRK_SSLROOT:[ALPHA_LIB]
$
$ IF F$PARSE("WRK_SSLROOT:[000000]") .EQS. "" THEN -
CREATE/DIR/LOG WRK_SSLROOT:[000000]
$ IF F$PARSE("WRK_SSLVLIB:") .EQS. "" THEN -
CREATE/DIR/LOG WRK_SSLVLIB:
$ IF F$PARSE("WRK_SSLALIB:") .EQS. "" THEN -
CREATE/DIR/LOG WRK_SSLALIB:
$
$ LIBS := LIBRSAGLUE
$
$ VEXE_DIR := [-.VAX.EXE.CRYPTO]
$ AEXE_DIR := [-.AXP.EXE.CRYPTO]
$
$ I = 0
$ LOOP_LIB:
$ E = F$EDIT(F$ELEMENT(I, ",", LIBS),"TRIM")
$ I = I + 1
$ IF E .EQS. "," THEN GOTO LOOP_LIB_END
$ SET NOON
$ IF F$SEARCH(VEXE_DIR+E+".OLB") .NES. ""
$ THEN
$ COPY 'VEXE_DIR''E'.OLB WRK_SSLVLIB:'E'.OLB/log
$ SET FILE/PROT=W:RE WRK_SSLVLIB:'E'.OLB
$ ENDIF
$ ! Preparing for the time when we have shareable images
$ IF F$SEARCH(VEXE_DIR+E+".EXE") .NES. ""
$ THEN
$ COPY 'VEXE_DIR''E'.EXE WRK_SSLVLIB:'E'.EXE/log
$ SET FILE/PROT=W:RE WRK_SSLVLIB:'E'.EXE
$ ENDIF
$ IF F$SEARCH(AEXE_DIR+E+".OLB") .NES. ""
$ THEN
$ COPY 'AEXE_DIR''E'.OLB WRK_SSLALIB:'E'.OLB/log
$ SET FILE/PROT=W:RE WRK_SSLALIB:'E'.OLB
$ ENDIF
$ ! Preparing for the time when we have shareable images
$ IF F$SEARCH(AEXE_DIR+E+".EXE") .NES. ""
$ THEN
$ COPY 'AEXE_DIR''E'.EXE WRK_SSLALIB:'E'.EXE/log
$ SET FILE/PROT=W:RE WRK_SSLALIB:'E'.EXE
$ ENDIF
$ SET ON
$ GOTO LOOP_LIB
$ LOOP_LIB_END:
$
$ EXIT

View file

@ -1,119 +0,0 @@
/* rsaref/rsar_err.c */
/* ====================================================================
* Copyright (c) 1999 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).
*
*/
/* NOTE: this file was auto generated by the mkerr.pl script: any changes
* made to it will be overwritten when the script next updates this file,
* only reason strings will be preserved.
*/
#include <stdio.h>
#include <openssl/err.h>
#include <openssl/rsaref.h>
/* BEGIN ERROR CODES */
#ifndef NO_ERR
static ERR_STRING_DATA RSAREF_str_functs[]=
{
{ERR_PACK(0,RSAREF_F_BN_REF_MOD_EXP,0), "BN_REF_MOD_EXP"},
{ERR_PACK(0,RSAREF_F_RSAREF_BN2BIN,0), "RSAREF_BN2BIN"},
{ERR_PACK(0,RSAREF_F_RSA_BN2BIN,0), "RSA_BN2BIN"},
{ERR_PACK(0,RSAREF_F_RSA_PRIVATE_DECRYPT,0), "RSA_private_decrypt"},
{ERR_PACK(0,RSAREF_F_RSA_PRIVATE_ENCRYPT,0), "RSA_private_encrypt"},
{ERR_PACK(0,RSAREF_F_RSA_PUBLIC_DECRYPT,0), "RSA_public_decrypt"},
{ERR_PACK(0,RSAREF_F_RSA_PUBLIC_ENCRYPT,0), "RSA_public_encrypt"},
{ERR_PACK(0,RSAREF_F_RSA_REF_BN2BIN,0), "RSA_REF_BN2BIN"},
{ERR_PACK(0,RSAREF_F_RSA_REF_MOD_EXP,0), "RSA_REF_MOD_EXP"},
{ERR_PACK(0,RSAREF_F_RSA_REF_PRIVATE_DECRYPT,0), "RSA_REF_PRIVATE_DECRYPT"},
{ERR_PACK(0,RSAREF_F_RSA_REF_PRIVATE_ENCRYPT,0), "RSA_REF_PRIVATE_ENCRYPT"},
{ERR_PACK(0,RSAREF_F_RSA_REF_PUBLIC_DECRYPT,0), "RSA_REF_PUBLIC_DECRYPT"},
{ERR_PACK(0,RSAREF_F_RSA_REF_PUBLIC_ENCRYPT,0), "RSA_REF_PUBLIC_ENCRYPT"},
{0,NULL}
};
static ERR_STRING_DATA RSAREF_str_reasons[]=
{
{RSAREF_R_CONTENT_ENCODING ,"content encoding"},
{RSAREF_R_DATA ,"data"},
{RSAREF_R_DIGEST_ALGORITHM ,"digest algorithm"},
{RSAREF_R_ENCODING ,"encoding"},
{RSAREF_R_ENCRYPTION_ALGORITHM ,"encryption algorithm"},
{RSAREF_R_KEY ,"key"},
{RSAREF_R_KEY_ENCODING ,"key encoding"},
{RSAREF_R_LEN ,"len"},
{RSAREF_R_MODULUS_LEN ,"modulus len"},
{RSAREF_R_NEED_RANDOM ,"need random"},
{RSAREF_R_PRIVATE_KEY ,"private key"},
{RSAREF_R_PUBLIC_KEY ,"public key"},
{RSAREF_R_SIGNATURE ,"signature"},
{RSAREF_R_SIGNATURE_ENCODING ,"signature encoding"},
{0,NULL}
};
#endif
void ERR_load_RSAREF_strings(void)
{
static int init=1;
if (init)
{
init=0;
#ifndef NO_ERR
ERR_load_strings(ERR_LIB_RSAREF,RSAREF_str_functs);
ERR_load_strings(ERR_LIB_RSAREF,RSAREF_str_reasons);
#endif
}
}

View file

@ -1,902 +0,0 @@
$!
$! RSAREF-LIB.COM
$! Written By: Robert Byer
$! Vice-President
$! A-Com Computing, Inc.
$! byer@mail.all-net.net
$!
$! Changes by Richard Levitte <richard@levitte.org>
$!
$! This command files compiles and creates the "[.xxx.EXE.RSAREF]LIBRSAGLUE.OLB"
$! library. The "xxx" denotes the machine architecture of AXP or VAX.
$!
$! Specify one of the following to build just that part or "ALL" to
$! just build everything.
$!
$! ALL To Just Build "Everything".
$! LIBRARY To Just Build The [.xxx.EXE.RSAREF]LIBRSAGLUE.OLB Library.
$! DHDEMO To Just Build The [.xxx.EXE.RSAREF]DHDEMO.EXE Program.
$! RDEMO To Just Build The [.xxx.EXE.RSAREF]RDEMO.EXE Program.
$!
$! Specify DEBUG or NODEBUG as P2 to compile with or without debugging
$! information.
$!
$! Specify which compiler at P3 to try to compile under.
$!
$! VAXC For VAX C.
$! DECC For DEC C.
$! GNUC For GNU C.
$!
$! If you don't speficy a compiler, it will prompt you for one.
$!
$! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
$!
$!
$! Check Which Architecture We Are Using.
$!
$ IF (F$GETSYI("CPU").GE.128)
$ THEN
$!
$! The Architecture Is AXP
$!
$ ARCH := AXP
$!
$! Else...
$!
$ ELSE
$!
$! The Architecture Is VAX.
$!
$ ARCH := VAX
$!
$! End The Architecture Check.
$!
$ ENDIF
$!
$! Check To Make Sure We Have Valid Command Line Parameters.
$!
$ GOSUB CHECK_OPTIONS
$!
$! Initialise logical names and such
$!
$ GOSUB INITIALISE
$!
$! Tell The User What Kind of Machine We Run On.
$!
$ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine."
$!
$! Define The OBJ Directory Name.
$!
$ OBJ_DIR := SYS$DISK:[-.'ARCH'.OBJ.RSAREF]
$!
$! Check To See If The Architecture Specific OBJ Directory Exists.
$!
$ IF (F$PARSE(OBJ_DIR).EQS."")
$ THEN
$!
$! It Dosen't Exist, So Create It.
$!
$ CREATE/DIR 'OBJ_DIR'
$!
$! End The Architecture Specific OBJ Directory Check.
$!
$ ENDIF
$!
$! Define The EXE Directory Name.
$!
$ EXE_DIR := SYS$DISK:[-.'ARCH'.EXE.RSAREF]
$!
$! Check To See If The Architecture Specific EXE Directory Exists.
$!
$ IF (F$PARSE(EXE_DIR).EQS."")
$ THEN
$!
$! It Dosen't Exist, So Create It.
$!
$ CREATE/DIR 'EXE_DIR'
$!
$! End The Architecture Specific EXE Directory Check.
$!
$ ENDIF
$!
$! Define The Library Name.
$!
$ LIB_NAME := 'EXE_DIR'LIBRSAGLUE.OLB
$!
$! Check To See What We Are To Do.
$!
$ IF (BUILDALL.EQS."TRUE")
$ THEN
$!
$! Since Nothing Special Was Specified, Do Everything.
$!
$ GOSUB LIBRARY
$ GOSUB DHDEMO
$ GOSUB RDEMO
$!
$! Else...
$!
$ ELSE
$!
$! Build Just What The User Wants Us To Build.
$!
$ GOSUB 'BUILDALL'
$!
$! End The BUILDALL Check.
$!
$ ENDIF
$!
$! Time To EXIT.
$!
$ EXIT:
$ GOSUB CLEANUP
$ EXIT
$!
$ LIBRARY:
$!
$! Tell The User That We Are Compiling.
$!
$ WRITE SYS$OUTPUT "Compiling The ",LIB_NAME," Files."
$!
$! Check To See If We Already Have A "LIBRSAGLUE.OLB" Library...
$!
$ IF (F$SEARCH(LIB_NAME).EQS."")
$ THEN
$!
$! Guess Not, Create The Library.
$!
$ LIBRARY/CREATE/OBJECT 'LIB_NAME'
$!
$! End The Library Exist Check.
$!
$ ENDIF
$!
$! Define The RSAREF Library Files.
$!
$ LIB_RSAREF = "DESC,DIGIT,MD2C,MD5C,NN,PRIME,RSA,R_DH,R_ENCODE,R_ENHANC," + -
"R_KEYGEN,R_RANDOM,R_STDLIB"
$!
$! Define A File Counter And Set It To "0".
$!
$ FILE_COUNTER = 0
$!
$! Top Of The File Loop.
$!
$ NEXT_FILE:
$!
$! O.K, Extract The File Name From The File List.
$!
$ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",LIB_RSAREF)
$!
$! Check To See If We Are At The End Of The File List.
$!
$ IF (FILE_NAME.EQS.",") THEN GOTO FILE_DONE
$!
$! Increment The Counter.
$!
$ FILE_COUNTER = FILE_COUNTER + 1
$!
$! Create The Source File Name.
$!
$ SOURCE_FILE = "SYS$DISK:[.SOURCE]" + FILE_NAME + ".C"
$!
$! Tell The User We Are Compiling The Source File.
$!
$ WRITE SYS$OUTPUT " ",FILE_NAME,".C"
$!
$! Create The Object File Name.
$!
$ OBJECT_FILE = OBJ_DIR + FILE_NAME + ".OBJ"
$ ON WARNING THEN GOTO NEXT_FILE
$!
$! Check To See If The File We Want To Compile Actually Exists.
$!
$ IF (F$SEARCH(SOURCE_FILE).EQS."")
$ THEN
$!
$! Tell The User That The File Dosen't Exist.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist."
$ WRITE SYS$OUTPUT ""
$!
$! Exit The Build.
$!
$ EXIT
$!
$! End The File Exist Check.
$!
$ ENDIF
$!
$! Compile The File.
$!
$ ON ERROR THEN GOTO NEXT_FILE
$ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
$!
$! Add It To The Library.
$!
$ LIBRARY/REPLACE/OBJECT 'LIB_NAME' 'OBJECT_FILE'
$!
$! Time To Clean Up The Object File.
$!
$ DELETE 'OBJECT_FILE';*
$!
$! Go Back And Do It Again.
$!
$ GOTO NEXT_FILE
$!
$! All Done With This Library Part.
$!
$ FILE_DONE:
$!
$! Tell The User That We Are All Done.
$!
$ WRITE SYS$OUTPUT "Library ",LIB_NAME," Built."
$!
$! All Done, Time To Return.
$!
$ RETURN
$!
$! Compile The [.xxx.EXE.RSAREF]DHDEMO Program.
$!
$ DHDEMO:
$!
$! Check To See If We Have The Proper Libraries.
$!
$ GOSUB LIB_CHECK
$!
$! Check To See If We Have A Linker Option File.
$!
$ GOSUB CHECK_OPT_FILE
$!
$! Check To See If The File We Want To Compile Actually Exists.
$!
$ IF (F$SEARCH("SYS$DISK:[.RDEMO]DHDEMO.C").EQS."")
$ THEN
$!
$! Tell The User That The File Dosen't Exist.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "The File [.RDEMO]DHDEMO.C Dosen't Exist."
$ WRITE SYS$OUTPUT ""
$!
$! Exit The Build.
$!
$ EXIT
$!
$! End The [.RDEMO]DHDEMO.C File Check.
$!
$ ENDIF
$!
$! Tell The User What We Are Building.
$!
$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DHDEMO.EXE"
$!
$! Compile The DHDEMO Program.
$!
$ CC/OBJECT='OBJ_DIR'DHDEMO.OBJ SYS$DISK:[.RDEMO]DHDEMO.C
$!
$! Link The DHDEMO Program.
$!
$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS -
/EXE='EXE_DIR'DHDEMO.EXE 'OBJ_DIR'DHDEMO.OBJ, -
'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
$!
$! All Done, Time To Return.
$!
$ RETURN
$!
$! Compile The RDEMO Program.
$!
$ RDEMO:
$!
$! Check To See If We Have The Proper Libraries.
$!
$ GOSUB LIB_CHECK
$!
$! Check To See If We Have A Linker Option File.
$!
$ GOSUB CHECK_OPT_FILE
$!
$! Check To See If The File We Want To Compile Actually Exists.
$!
$ IF (F$SEARCH("SYS$DISK:[.RDEMO]RDEMO.C").EQS."")
$ THEN
$!
$! Tell The User That The File Dosen't Exist.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "The File [.RDEMO]RDEMO.C Dosen't Exist."
$ WRITE SYS$OUTPUT ""
$!
$! Exit The Build.
$!
$ EXIT
$!
$! End The [.RDEMO]RDEMO.C File Check.
$!
$ ENDIF
$!
$! Tell The User What We Are Building.
$!
$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"RDEMO.EXE"
$!
$! Compile The RDEMO Program.
$!
$ CC/OBJECT='OBJ_DIR'RDEMO.OBJ SYS$DISK:[.RDEMO]RDEMO.C
$!
$! Link The RDEMO Program.
$!
$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS -
/EXE='EXE_DIR'RDEMO.EXE 'OBJ_DIR'RDEMO.OBJ, -
'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
$!
$! All Done, Time To Return.
$!
$ RETURN
$!
$! Check For The Link Option FIle.
$!
$ CHECK_OPT_FILE:
$!
$! Check To See If We Need To Make A VAX C Option File.
$!
$ IF (COMPILER.EQS."VAXC")
$ THEN
$!
$! Check To See If We Already Have A VAX C Linker Option File.
$!
$ IF (F$SEARCH(OPT_FILE).EQS."")
$ THEN
$!
$! We Need A VAX C Linker Option File.
$!
$ CREATE 'OPT_FILE'
$DECK
!
! Default System Options File To Link Agianst
! The Sharable VAX C Runtime Library.
!
SYS$SHARE:VAXCRTL.EXE/SHARE
$EOD
$!
$! End The Option File Check.
$!
$ ENDIF
$!
$! End The VAXC Check.
$!
$ ENDIF
$!
$! Check To See If We Need A GNU C Option File.
$!
$ IF (COMPILER.EQS."GNUC")
$ THEN
$!
$! Check To See If We Already Have A GNU C Linker Option File.
$!
$ IF (F$SEARCH(OPT_FILE).EQS."")
$ THEN
$!
$! We Need A GNU C Linker Option File.
$!
$ CREATE 'OPT_FILE'
$DECK
!
! Default System Options File To Link Agianst
! The Sharable C Runtime Library.
!
GNU_CC:[000000]GCCLIB/LIBRARY
SYS$SHARE:VAXCRTL/SHARE
$EOD
$!
$! End The Option File Check.
$!
$ ENDIF
$!
$! End The GNU C Check.
$!
$ ENDIF
$!
$! Check To See If We Need A DEC C Option File.
$!
$ IF (COMPILER.EQS."DECC")
$ THEN
$!
$! Check To See If We Already Have A DEC C Linker Option File.
$!
$ IF (F$SEARCH(OPT_FILE).EQS."")
$ THEN
$!
$! Figure Out If We Need An AXP Or A VAX Linker Option File.
$!
$ IF (ARCH.EQS."VAX")
$ THEN
$!
$! We Need A DEC C Linker Option File For VAX.
$!
$ CREATE 'OPT_FILE'
$DECK
!
! Default System Options File To Link Agianst
! The Sharable DEC C Runtime Library.
!
SYS$SHARE:DECC$SHR.EXE/SHARE
$EOD
$!
$! Else...
$!
$ ELSE
$!
$! Create The AXP Linker Option File.
$!
$ CREATE 'OPT_FILE'
$DECK
!
! Default System Options File For AXP To Link Agianst
! The Sharable C Runtime Library.
!
SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
SYS$SHARE:CMA$OPEN_RTL/SHARE
$EOD
$!
$! End The VAX/AXP DEC C Option File Check.
$!
$ ENDIF
$!
$! End The Option File Search.
$!
$ ENDIF
$!
$! End The DEC C Check.
$!
$ ENDIF
$!
$! Tell The User What Linker Option File We Are Using.
$!
$ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
$!
$! Time To RETURN.
$!
$ RETURN
$ LIB_CHECK:
$!
$! Look For The Library LIBRSAGLUE.OLB.
$!
$ IF (F$SEARCH(LIB_NAME).EQS."")
$ THEN
$!
$! Tell The User We Can't Find The [.xxx.EXE.RSAREF]LIBRSAGLUE.OLB Library.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Can't Find The Library ",LIB_NAME,"."
$ WRITE SYS$OUTPUT "We Can't Link Without It."
$ WRITE SYS$OUTPUT ""
$!
$! And Ask If They Would Like To Build It.
$!
$ INQUIRE YESNO "Would You Like To Build The Library Now (Y/N)?"
$!
$! Check The Answer.
$!
$ IF (YESNO.EQS."Y").OR.(YESNO.EQS."y")
$ THEN
$!
$! Then Build The Library.
$!
$ GOSUB LIBRARY
$!
$! When Done With That, RETURN To Finish What Ever We Were Doing
$! That Needed The Library.
$!
$ RETURN
$!
$! Else...
$!
$ ELSE
$!
$! Since We Can't Link Without It, Exit.
$!
$ EXIT
$!
$! End The Answer Check.
$!
$ ENDIF
$!
$! End The Library Check.
$!
$ ENDIF
$!
$! Time To Return.
$!
$ RETURN
$!
$! Check The User's Options.
$!
$ CHECK_OPTIONS:
$!
$! Check To See If P1 Is Blank.
$!
$ IF (P1.EQS."ALL")
$ THEN
$!
$! P1 Is Blank, So Build Everything.
$!
$ BUILDALL = "TRUE"
$!
$! Else...
$!
$ ELSE
$!
$! Else, Check To See If P1 Has A Valid Arguement.
$!
$ IF (P1.EQS."LIBRARY").OR.(P1.EQS."DHDEMO").OR.(P1.EQS."RDEMO")
$ THEN
$!
$! A Valid Arguement.
$!
$ BUILDALL = P1
$!
$! Else....
$!
$ ELSE
$!
$! Tell The User We Don't Know What They Want.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT " ALL : To Just Build Everything."
$ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.RSAREF]LIBRSAGLUE.OLB Library."
$ WRITE SYS$OUTPUT " DHDEMO : To Compile Just The [.xxx.EXE.RSAREF]DHDEMO Program."
$ WRITE SYS$OUTPUT " RDEMO : To Compile Just The [.xxx.EXE.RSAREF]RDEMO Program.
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT " Where 'xxx' Stands For:"
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT " AXP : Alpha Architecture."
$ WRITE SYS$OUTPUT " VAX : VAX Architecture."
$ WRITE SYS$OUTPUT ""
$!
$! Time To EXIT.
$!
$ EXIT
$!
$! End The Valid Arguement Check.
$!
$ ENDIF
$!
$! End The P1 Check.
$!
$ ENDIF
$!
$! Check To See If P2 Is Blank.
$!
$ IF (P2.EQS."NODEBUG")
$ THEN
$!
$! P2 Is "NODEBUG" So Compile Without Debugger Information.
$!
$ DEBUGGER = "NODEBUG"
$ TRACEBACK = "NOTRACEBACK"
$ GCC_OPTIMIZE = "OPTIMIZE"
$ CC_OPTIMIZE = "OPTIMIZE"
$ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
$ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
$ ELSE
$!
$! Check To See If We Are To Compile With Debugger Information.
$!
$ IF (P2.EQS."DEBUG")
$ THEN
$!
$! Compile With Debugger Information.
$!
$ DEBUGGER = "DEBUG"
$ TRACEBACK = "TRACEBACK"
$ GCC_OPTIMIZE = "NOOPTIMIZE"
$ CC_OPTIMIZE = "NOOPTIMIZE"
$ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
$ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
$ ELSE
$!
$! Tell The User Entered An Invalid Option..
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
$ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
$ WRITE SYS$OUTPUT ""
$!
$! Time To EXIT.
$!
$ EXIT
$!
$! End The Valid Arguement Check.
$!
$ ENDIF
$!
$! End The P2 Check.
$!
$ ENDIF
$!
$! Special Threads For OpenVMS v7.1 Or Later.
$!
$! Written By: Richard Levitte
$! richard@levitte.org
$!
$!
$! Check To See If We Have A Option For P4.
$!
$ IF (P4.EQS."")
$ THEN
$!
$! Get The Version Of VMS We Are Using.
$!
$ ISSEVEN :=
$ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
$ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
$!
$! Check To See If The VMS Version Is v7.1 Or Later.
$!
$ IF (TMP.GE.71)
$ THEN
$!
$! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
$!
$ ISSEVEN := ,PTHREAD_USE_D4
$!
$! End The VMS Version Check.
$!
$ ENDIF
$!
$! End The P4 Check.
$!
$ ENDIF
$!
$! Check To See If P3 Is Blank.
$!
$ IF (P3.EQS."")
$ THEN
$!
$! O.K., The User Didn't Specify A Compiler, Let's Try To
$! Find Out Which One To Use.
$!
$! Check To See If We Have GNU C.
$!
$ IF (F$TRNLNM("GNU_CC").NES."")
$ THEN
$!
$! Looks Like GNUC, Set To Use GNUC.
$!
$ COMPILER = "GNUC"
$!
$! End The GNU C Compiler Check.
$!
$ ELSE
$!
$! Check To See If We Have VAXC Or DECC.
$!
$ IF (ARCH.EQS."ALPHA").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
$ THEN
$!
$! Looks Like DECC, Set To Use DECC.
$!
$ COMPILER = "DECC"
$!
$! Tell The User We Are Using DECC.
$!
$ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
$!
$! Else...
$!
$ ELSE
$!
$! Looks Like VAXC, Set To Use VAXC.
$!
$ COMPILER = "VAXC"
$!
$! End The VAXC Compiler Check.
$!
$ ENDIF
$!
$! End The DECC & VAXC Compiler Check.
$!
$ ENDIF
$!
$! End The Compiler Check.
$!
$ ENDIF
$!
$! Set Up Initial CC Definitions, Possibly With User Ones
$!
$ CCDEFS = "VMS=1"
$ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
$ CCEXTRAFLAGS = ""
$ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
$ CCDISABLEWARNINGS = ""
$ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
CCDISABLEWARNINGS = USER_CCDISABLEWARNINGS
$!
$! Check To See If The User Entered A Valid Paramter.
$!
$ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC")
$ THEN
$!
$! Check To See If The User Wanted DECC.
$!
$ IF (P3.EQS."DECC")
$ THEN
$!
$! Looks Like DECC, Set To Use DECC.
$!
$ COMPILER = "DECC"
$!
$! Tell The User We Are Using DECC.
$!
$ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
$!
$! Use DECC...
$!
$ CC = "CC"
$ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
THEN CC = "CC/DECC"
$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
"/NOLIST/PREFIX=ALL" + -
"/INCLUDE=(SYS$DISK:[-.CRYPTO],SYS$DISK:[.SOURCE])" + CCEXTRAFLAGS
$!
$! Define The Linker Options File Name.
$!
$ OPT_FILE = "SYS$DISK:[]VAX_DECC_OPTIONS.OPT"
$!
$! End DECC Check.
$!
$ ENDIF
$!
$! Check To See If We Are To Use VAXC.
$!
$ IF (P3.EQS."VAXC")
$ THEN
$!
$! Looks Like VAXC, Set To Use VAXC.
$!
$ COMPILER = "VAXC"
$!
$! Tell The User We Are Using VAX C.
$!
$ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
$!
$! Compile Using VAXC.
$!
$ CC = "CC"
$ IF ARCH.EQS."AXP"
$ THEN
$ WRITE SYS$OUTPUT "There is no VAX C on Alpha!"
$ EXIT
$ ENDIF
$ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
"/INCLUDE=(SYS$DISK:[-.CRYPTO],SYS$DISK:[.SOURCE])" + CCEXTRAFLAGS
$ CCDEFS = CCDEFS + ",""VAXC"""
$!
$! Define <sys> As SYS$COMMON:[SYSLIB]
$!
$ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
$!
$! Define The Linker Options File Name.
$!
$ OPT_FILE = "SYS$DISK:[]VAX_VAXC_OPTIONS.OPT"
$!
$! End VAXC Check
$!
$ ENDIF
$!
$! Check To See If We Are To Use GNU C.
$!
$ IF (P3.EQS."GNUC")
$ THEN
$!
$! Looks Like GNUC, Set To Use GNUC.
$!
$ COMPILER = "GNUC"
$!
$! Tell The User We Are Using GNUC.
$!
$ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
$!
$! Use GNU C...
$!
$ IF F$TYPE(GCC) .EQS. "" THEN GCC := GCC
$ CC = GCC+"/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
"/INCLUDE=(SYS$DISK:[-.CRYPTO],SYS$DISK:[.SOURCE])" + CCEXTRAFLAGS
$!
$! Define The Linker Options File Name.
$!
$ OPT_FILE = "SYS$DISK:[]VAX_GNUC_OPTIONS.OPT"
$!
$! End The GNU C Check.
$!
$ ENDIF
$!
$! Set up default defines
$!
$ CCDEFS = """FLAT_INC=1""," + CCDEFS
$ CCDEFS = CCDEFS + ",""RSAref=1"""
$!
$! Finish up the definition of CC.
$!
$ IF COMPILER .EQS. "DECC"
$ THEN
$ IF CCDISABLEWARNINGS .NES. ""
$ THEN
$ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
$ ENDIF
$ ELSE
$ CCDISABLEWARNINGS = ""
$ ENDIF
$ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
$!
$! Show user the result
$!
$ WRITE SYS$OUTPUT "Main Compiling Command: ",CC
$!
$! Else The User Entered An Invalid Arguement.
$!
$ ELSE
$!
$! Tell The User We Don't Know What They Want.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
$ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
$ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
$ WRITE SYS$OUTPUT ""
$!
$! Time To EXIT.
$!
$ EXIT
$!
$! End The P3 Check.
$!
$ ENDIF
$!
$! Time To RETURN...
$!
$ RETURN
$!
$ INITIALISE:
$!
$! Save old value of the logical name OPENSSL
$!
$ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE")
$!
$! Save directory information
$!
$ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
$ __TOP = __HERE - "RSAREF]"
$ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
$!
$! Set up the logical name OPENSSL to point at the include directory
$!
$ DEFINE OPENSSL/NOLOG '__INCLUDE'
$!
$! Done
$!
$ RETURN
$!
$ CLEANUP:
$!
$! Restore the logical name OPENSSL if it had a value
$!
$ IF __SAVE_OPENSSL .EQS. ""
$ THEN
$ DEASSIGN OPENSSL
$ ELSE
$ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL'
$ ENDIF
$!
$! Done
$!
$ RETURN

View file

@ -1,309 +0,0 @@
/* rsaref/rsaref.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* 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 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 cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#ifndef NO_RSA
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/bn.h>
#include <openssl/rsa.h>
#include <openssl/rsaref.h>
#include <openssl/rand.h>
static int RSAref_bn2bin(BIGNUM * from, unsigned char* to, int max);
#ifdef undef
static BIGNUM* RSAref_bin2bn(const unsigned char* from, BIGNUM * to, int max);
#endif
static int RSAref_Public_eay2ref(RSA * from, RSArefPublicKey * to);
static int RSAref_Private_eay2ref(RSA * from, RSArefPrivateKey * to);
int RSA_ref_private_decrypt(int len, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
int RSA_ref_private_encrypt(int len, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
int RSA_ref_public_encrypt(int len, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
int RSA_ref_public_decrypt(int len, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
static int BN_ref_mod_exp(BIGNUM *r,const BIGNUM *a,
const BIGNUM *p,const BIGNUM *m,
BN_CTX *ctx, BN_MONT_CTX *m_ctx);
static int RSA_ref_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
static RSA_METHOD rsa_pkcs1_ref_meth={
"RSAref PKCS#1 RSA",
RSA_ref_public_encrypt,
RSA_ref_public_decrypt,
RSA_ref_private_encrypt,
RSA_ref_private_decrypt,
RSA_ref_mod_exp,
BN_ref_mod_exp,
NULL,
NULL,
0,
NULL,
};
const RSA_METHOD *RSA_PKCS1_RSAref(void)
{
return(&rsa_pkcs1_ref_meth);
}
static int RSA_ref_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
{
RSAREFerr(RSAREF_F_RSA_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return(0);
}
static int BN_ref_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
{
RSAREFerr(RSAREF_F_BN_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return(0);
}
/* unsigned char *to: [max] */
static int RSAref_bn2bin(BIGNUM *from, unsigned char *to, int max)
{
int i;
i=BN_num_bytes(from);
if (i > max)
{
RSAREFerr(RSAREF_F_RSAREF_BN2BIN,RSAREF_R_LEN);
return(0);
}
memset(to,0,(unsigned int)max);
if (!BN_bn2bin(from,&(to[max-i])))
return(0);
return(1);
}
#ifdef undef
/* unsigned char *from: [max] */
static BIGNUM *RSAref_bin2bn(unsigned char *from, BIGNUM *to, int max)
{
int i;
BIGNUM *ret;
for (i=0; i<max; i++)
if (from[i]) break;
ret=BN_bin2bn(&(from[i]),max-i,to);
return(ret);
}
static int RSAref_Public_ref2eay(RSArefPublicKey *from, RSA *to)
{
to->n=RSAref_bin2bn(from->m,NULL,RSAref_MAX_LEN);
to->e=RSAref_bin2bn(from->e,NULL,RSAref_MAX_LEN);
if ((to->n == NULL) || (to->e == NULL)) return(0);
return(1);
}
#endif
static int RSAref_Public_eay2ref(RSA *from, RSArefPublicKey *to)
{
to->bits=BN_num_bits(from->n);
if (!RSAref_bn2bin(from->n,to->m,RSAref_MAX_LEN)) return(0);
if (!RSAref_bn2bin(from->e,to->e,RSAref_MAX_LEN)) return(0);
return(1);
}
#ifdef undef
static int RSAref_Private_ref2eay(RSArefPrivateKey *from, RSA *to)
{
if ((to->n=RSAref_bin2bn(from->m,NULL,RSAref_MAX_LEN)) == NULL)
return(0);
if ((to->e=RSAref_bin2bn(from->e,NULL,RSAref_MAX_LEN)) == NULL)
return(0);
if ((to->d=RSAref_bin2bn(from->d,NULL,RSAref_MAX_LEN)) == NULL)
return(0);
if ((to->p=RSAref_bin2bn(from->prime[0],NULL,RSAref_MAX_PLEN)) == NULL)
return(0);
if ((to->q=RSAref_bin2bn(from->prime[1],NULL,RSAref_MAX_PLEN)) == NULL)
return(0);
if ((to->dmp1=RSAref_bin2bn(from->pexp[0],NULL,RSAref_MAX_PLEN))
== NULL)
return(0);
if ((to->dmq1=RSAref_bin2bn(from->pexp[1],NULL,RSAref_MAX_PLEN))
== NULL)
return(0);
if ((to->iqmp=RSAref_bin2bn(from->coef,NULL,RSAref_MAX_PLEN)) == NULL)
return(0);
return(1);
}
#endif
static int RSAref_Private_eay2ref(RSA *from, RSArefPrivateKey *to)
{
to->bits=BN_num_bits(from->n);
if (!RSAref_bn2bin(from->n,to->m,RSAref_MAX_LEN)) return(0);
if (!RSAref_bn2bin(from->e,to->e,RSAref_MAX_LEN)) return(0);
if (!RSAref_bn2bin(from->d,to->d,RSAref_MAX_LEN)) return(0);
if (!RSAref_bn2bin(from->p,to->prime[0],RSAref_MAX_PLEN)) return(0);
if (!RSAref_bn2bin(from->q,to->prime[1],RSAref_MAX_PLEN)) return(0);
if (!RSAref_bn2bin(from->dmp1,to->pexp[0],RSAref_MAX_PLEN)) return(0);
if (!RSAref_bn2bin(from->dmq1,to->pexp[1],RSAref_MAX_PLEN)) return(0);
if (!RSAref_bn2bin(from->iqmp,to->coef,RSAref_MAX_PLEN)) return(0);
return(1);
}
int RSA_ref_private_decrypt(int len, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding)
{
int i,outlen= -1;
RSArefPrivateKey RSAkey;
if (!RSAref_Private_eay2ref(rsa,&RSAkey))
goto err;
if ((i=RSAPrivateDecrypt(to,&outlen,from,len,&RSAkey)) != 0)
{
RSAREFerr(RSAREF_F_RSA_REF_PRIVATE_DECRYPT,i);
outlen= -1;
}
err:
memset(&RSAkey,0,sizeof(RSAkey));
return(outlen);
}
int RSA_ref_private_encrypt(int len, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding)
{
int i,outlen= -1;
RSArefPrivateKey RSAkey;
if (padding != RSA_PKCS1_PADDING)
{
RSAREFerr(RSAREF_F_RSA_REF_PRIVATE_ENCRYPT, RSA_R_UNKNOWN_PADDING_TYPE);
goto err;
}
if (!RSAref_Private_eay2ref(rsa,&RSAkey))
goto err;
if ((i=RSAPrivateEncrypt(to,&outlen,from,len,&RSAkey)) != 0)
{
RSAREFerr(RSAREF_F_RSA_REF_PRIVATE_ENCRYPT,i);
outlen= -1;
}
err:
memset(&RSAkey,0,sizeof(RSAkey));
return(outlen);
}
int RSA_ref_public_decrypt(int len, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding)
{
int i,outlen= -1;
RSArefPublicKey RSAkey;
if (!RSAref_Public_eay2ref(rsa,&RSAkey))
goto err;
if ((i=RSAPublicDecrypt(to,&outlen,from,len,&RSAkey)) != 0)
{
RSAREFerr(RSAREF_F_RSA_REF_PUBLIC_DECRYPT,i);
outlen= -1;
}
err:
memset(&RSAkey,0,sizeof(RSAkey));
return(outlen);
}
int RSA_ref_public_encrypt(int len, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding)
{
int outlen= -1;
int i;
RSArefPublicKey RSAkey;
RSARandomState rnd;
unsigned char buf[16];
if (padding != RSA_PKCS1_PADDING && padding != RSA_SSLV23_PADDING)
{
RSAREFerr(RSAREF_F_RSA_REF_PUBLIC_ENCRYPT, RSA_R_UNKNOWN_PADDING_TYPE);
goto err;
}
R_RandomInit(&rnd);
R_GetRandomBytesNeeded((unsigned int *)&i,&rnd);
while (i > 0)
{
if (RAND_bytes(buf,16) <= 0)
goto err;
R_RandomUpdate(&rnd,buf,(unsigned int)((i>16)?16:i));
i-=16;
}
if (!RSAref_Public_eay2ref(rsa,&RSAkey))
goto err;
if ((i=RSAPublicEncrypt(to,&outlen,from,len,&RSAkey,&rnd)) != 0)
{
RSAREFerr(RSAREF_F_RSA_REF_PUBLIC_ENCRYPT,i);
outlen= -1;
goto err;
}
err:
memset(&RSAkey,0,sizeof(RSAkey));
R_RandomFinal(&rnd);
memset(&rnd,0,sizeof(rnd));
return(outlen);
}
#else /* !NO_RSA */
# if PEDANTIC
static void *dummy=&dummy;
# endif
#endif

View file

@ -1,185 +0,0 @@
/* rsaref/rsaref.h */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* 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 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 cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#ifndef HEADER_RSAREF_H
#define HEADER_RSAREF_H
#ifndef NO_RSA
#include <openssl/rsa.h>
#ifdef __cplusplus
extern "C" {
#endif
/* RSAeuro */
/*#define RSAref_MAX_BITS 2048*/
/* RSAref */
#define RSAref_MAX_BITS 1024
#define RSAref_MIN_BITS 508
#define RSAref_MAX_LEN ((RSAref_MAX_BITS+7)/8)
#define RSAref_MAX_PBITS (RSAref_MAX_BITS+1)/2
#define RSAref_MAX_PLEN ((RSAref_MAX_PBITS+7)/8)
typedef struct RSArefPublicKey_st
{
unsigned int bits;
unsigned char m[RSAref_MAX_LEN];
unsigned char e[RSAref_MAX_LEN];
} RSArefPublicKey;
typedef struct RSArefPrivateKey_st
{
unsigned int bits;
unsigned char m[RSAref_MAX_LEN];
unsigned char e[RSAref_MAX_LEN];
unsigned char d[RSAref_MAX_LEN];
unsigned char prime[2][RSAref_MAX_PLEN];/* p & q */
unsigned char pexp[2][RSAref_MAX_PLEN]; /* dmp1 & dmq1 */
unsigned char coef[RSAref_MAX_PLEN]; /* iqmp */
} RSArefPrivateKey;
typedef struct RSARandomState_st
{
unsigned int needed;
unsigned char state[16];
unsigned int outputnum;
unsigned char output[16];
} RSARandomState;
#define RE_CONTENT_ENCODING 0x0400
#define RE_DATA 0x0401
#define RE_DIGEST_ALGORITHM 0x0402
#define RE_ENCODING 0x0403
#define RE_KEY 0x0404
#define RE_KEY_ENCODING 0x0405
#define RE_LEN 0x0406
#define RE_MODULUS_LEN 0x0407
#define RE_NEED_RANDOM 0x0408
#define RE_PRIVATE_KEY 0x0409
#define RE_PUBLIC_KEY 0x040a
#define RE_SIGNATURE 0x040b
#define RE_SIGNATURE_ENCODING 0x040c
#define RE_ENCRYPTION_ALGORITHM 0x040d
int RSAPrivateDecrypt(unsigned char *to, int *outlen,
const unsigned char *from,
int len, RSArefPrivateKey *RSAkey);
int RSAPrivateEncrypt(unsigned char *to, int *outlen,
const unsigned char *from,
int len, RSArefPrivateKey *RSAkey);
int RSAPublicDecrypt(unsigned char *to, int *outlen,
const unsigned char *from,
int len, RSArefPublicKey *RSAkey);
int RSAPublicEncrypt(unsigned char *to, int *outlen,
const unsigned char *from,
int len, RSArefPublicKey *RSAkey,RSARandomState *rnd);
int R_RandomInit(RSARandomState *rnd);
int R_GetRandomBytesNeeded(unsigned int *,RSARandomState *rnd);
int R_RandomUpdate(RSARandomState *rnd,
const unsigned char *data, unsigned int n);
int R_RandomFinal(RSARandomState *rnd);
void ERR_load_RSAREF_strings(void );
const RSA_METHOD *RSA_PKCS1_RSAref(void );
#ifdef __cplusplus
}
#endif
#endif
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
/* Error codes for the RSAREF functions. */
/* Function codes. */
#define RSAREF_F_BN_REF_MOD_EXP 100
#define RSAREF_F_RSAREF_BN2BIN 101
#define RSAREF_F_RSA_BN2BIN 102
#define RSAREF_F_RSA_PRIVATE_DECRYPT 103
#define RSAREF_F_RSA_PRIVATE_ENCRYPT 104
#define RSAREF_F_RSA_PUBLIC_DECRYPT 105
#define RSAREF_F_RSA_PUBLIC_ENCRYPT 106
#define RSAREF_F_RSA_REF_BN2BIN 107
#define RSAREF_F_RSA_REF_MOD_EXP 108
#define RSAREF_F_RSA_REF_PRIVATE_DECRYPT 109
#define RSAREF_F_RSA_REF_PRIVATE_ENCRYPT 110
#define RSAREF_F_RSA_REF_PUBLIC_DECRYPT 111
#define RSAREF_F_RSA_REF_PUBLIC_ENCRYPT 112
/* Reason codes. */
#define RSAREF_R_CONTENT_ENCODING 0x0400
#define RSAREF_R_DATA 0x0401
#define RSAREF_R_DIGEST_ALGORITHM 0x0402
#define RSAREF_R_ENCODING 0x0403
#define RSAREF_R_ENCRYPTION_ALGORITHM 0x040d
#define RSAREF_R_KEY 0x0404
#define RSAREF_R_KEY_ENCODING 0x0405
#define RSAREF_R_LEN 0x0406
#define RSAREF_R_MODULUS_LEN 0x0407
#define RSAREF_R_NEED_RANDOM 0x0408
#define RSAREF_R_PRIVATE_KEY 0x0409
#define RSAREF_R_PUBLIC_KEY 0x040a
#define RSAREF_R_SIGNATURE 0x040b
#define RSAREF_R_SIGNATURE_ENCODING 0x040c
#endif