diff options
author | Ulf Möller <ulf@openssl.org> | 1999-05-13 11:37:32 +0000 |
---|---|---|
committer | Ulf Möller <ulf@openssl.org> | 1999-05-13 11:37:32 +0000 |
commit | 7d7d2cbcb02206f3393681f2bce198e11e2e185b (patch) | |
tree | 93410fafc5aa977c748ea492994da3f581d11278 /crypto | |
parent | 8d111f4a476896a417069d16597ce3009f9bb992 (diff) |
VMS support.
Submitted by: Richard Levitte <richard@levitte.org>
Diffstat (limited to 'crypto')
50 files changed, 9470 insertions, 319 deletions
diff --git a/crypto/Makefile.ssl b/crypto/Makefile.ssl index 15b1f11b4e..4806eeeb7c 100644 --- a/crypto/Makefile.ssl +++ b/crypto/Makefile.ssl @@ -31,7 +31,7 @@ SDIRS= md2 md5 sha mdc2 hmac ripemd \ buffer bio stack lhash rand err objects \ evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp -GENERAL=Makefile README +GENERAL=Makefile README crypto-lib.com install.com LIB= $(TOP)/libcrypto.a LIBSRC= cryptlib.c mem.c cversion.c ex_data.c tmdiff.c cpt_err.c diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c index 557c1efb8e..2c605ef33b 100644 --- a/crypto/asn1/a_utctm.c +++ b/crypto/asn1/a_utctm.c @@ -58,6 +58,11 @@ #include <stdio.h> #include <time.h> +#ifdef VMS +#include <descrip.h> +#include <lnmdef.h> +#include <starlet.h> +#endif #include "cryptlib.h" #include <openssl/asn1.h> @@ -182,6 +187,43 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) #else ts=gmtime(&t); #endif +#ifdef VMS + if (ts == NULL) + { + static $DESCRIPTOR(tabnam,"LNM$DCL_LOGICAL"); + static $DESCRIPTOR(lognam,"SYS$TIMEZONE_DIFFERENTIAL"); + char result[256]; + unsigned int reslen = 0; + struct { + short buflen; + short code; + void *bufaddr; + unsigned int *reslen; + } itemlist[] = { + { 0, LNM$_STRING, 0, 0 }, + { 0, 0, 0, 0 }, + }; + int status; + + /* Get the value for SYS$TIMEZONE_DIFFERENTIAL */ + itemlist[0].buflen = sizeof(result); + itemlist[0].bufaddr = result; + itemlist[0].reslen = &reslen; + status = sys$trnlnm(0, &tabnam, &lognam, 0, itemlist); + if (!(status & 1)) + return NULL; + result[reslen] = '\0'; + + /* Get the numerical value of the equivalence string */ + status = atoi(result); + + /* and use it to move time to GMT */ + t -= status; + + /* then convert the result to the time structure */ + ts=(struct tm *)localtime(&t); + } +#endif p=(char *)s->data; if ((p == NULL) || (s->length < 14)) { diff --git a/crypto/bf/bf_opts.c b/crypto/bf/bf_opts.c index 7253d765e9..6ac0611918 100644 --- a/crypto/bf/bf_opts.c +++ b/crypto/bf/bf_opts.c @@ -59,7 +59,7 @@ /* define PART1, PART2, PART3 or PART4 to build only with a few of the options. * This is for machines with 64k code segment size restrictions. */ -#ifndef MSDOS +#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) #define TIMES #endif @@ -71,7 +71,6 @@ extern void exit(); #endif #include <signal.h> -#ifndef VMS #ifndef _IRIX #include <time.h> #endif @@ -79,15 +78,15 @@ extern void exit(); #include <sys/types.h> #include <sys/times.h> #endif -#else /* VMS */ -#include <types.h> -struct tms { - time_t tms_utime; - time_t tms_stime; - time_t tms_uchild; /* I dunno... */ - time_t tms_uchildsys; /* so these names are a guess :-) */ - } + +/* Depending on the VMS version, the tms structure is perhaps defined. + The __TMS macro will show if it was. If it wasn't defined, we should + undefine TIMES, since that tells the rest of the program how things + should be handled. -- Richard Levitte */ +#if defined(VMS) && defined(__DECC) && !defined(__TMS) +#undef TIMES #endif + #ifndef TIMES #include <sys/timeb.h> #endif diff --git a/crypto/bf/bfspeed.c b/crypto/bf/bfspeed.c index bca36e5a3b..52758e24b1 100644 --- a/crypto/bf/bfspeed.c +++ b/crypto/bf/bfspeed.c @@ -59,7 +59,7 @@ /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ /* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ -#ifndef MSDOS +#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) #define TIMES #endif @@ -71,7 +71,6 @@ extern int exit(); #endif #include <signal.h> -#ifndef VMS #ifndef _IRIX #include <time.h> #endif @@ -79,15 +78,15 @@ extern int exit(); #include <sys/types.h> #include <sys/times.h> #endif -#else /* VMS */ -#include <types.h> -struct tms { - time_t tms_utime; - time_t tms_stime; - time_t tms_uchild; /* I dunno... */ - time_t tms_uchildsys; /* so these names are a guess :-) */ - } + +/* Depending on the VMS version, the tms structure is perhaps defined. + The __TMS macro will show if it was. If it wasn't defined, we should + undefine TIMES, since that tells the rest of the program how things + should be handled. -- Richard Levitte */ +#if defined(VMS) && defined(__DECC) && !defined(__TMS) +#undef TIMES #endif + #ifndef TIMES #include <sys/timeb.h> #endif diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c index cc9c125478..07c9edd33c 100644 --- a/crypto/bio/b_sock.c +++ b/crypto/bio/b_sock.c @@ -195,7 +195,7 @@ int BIO_sock_error(int sock) * a cast it will choke the compiler: if you do have a cast then * you can either go for (char *) or (void *). */ - i=getsockopt(sock,SOL_SOCKET,SO_ERROR,(void *)&j,&size); + i=getsockopt(sock,SOL_SOCKET,SO_ERROR,(void *)&j,(void *)&size); if (i < 0) return(1); else @@ -408,6 +408,8 @@ void BIO_sock_cleanup(void) #endif } +#if !defined(VMS) || __VMS_VER >= 70000000 + int BIO_socket_ioctl(int fd, long type, unsigned long *arg) { int i; @@ -417,6 +419,7 @@ int BIO_socket_ioctl(int fd, long type, unsigned long *arg) SYSerr(SYS_F_IOCTLSOCKET,get_last_socket_error()); return(i); } +#endif /* __VMS_VER */ /* The reason I have implemented this instead of using sscanf is because * Visual C 1.52c gives an unresolved external when linking a DLL :-( */ @@ -593,7 +596,12 @@ int BIO_accept(int sock, char **addr) memset((char *)&from,0,sizeof(from)); len=sizeof(from); - ret=accept(sock,(struct sockaddr *)&from,&len); + /* Note: under VMS with SOCKETSHR the third parameter is currently + * of type (int *) whereas under other systems it is (void *) if + * you don't have a cast it will choke the compiler: if you do + * have a cast then you can either go for (int *) or (void *). + */ + ret=accept(sock,(struct sockaddr *)&from,(void *)&len); if (ret == INVALID_SOCKET) { SYSerr(SYS_F_ACCEPT,get_last_socket_error()); diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c index 74e6bd6a05..e6961f2305 100644 --- a/crypto/bio/bss_acpt.c +++ b/crypto/bio/bss_acpt.c @@ -70,6 +70,11 @@ #define SOCKET_PROTOCOL IPPROTO_TCP #endif +#if (__VMS_VER < 70000000) /* FIONBIO used as a switch to enable ioctl, + and that isn't in VMS < 7.0 */ +#undef FIONBIO +#endif + typedef struct bio_accept_st { int state; diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index 6e4fe9f5d4..21c379ed1a 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -70,6 +70,12 @@ #define SOCKET_PROTOCOL IPPROTO_TCP #endif +#if (__VMS_VER < 70000000) /* FIONBIO used as a switch to enable ioctl, + and that isn't in VMS < 7.0 */ +#undef FIONBIO +#endif + + typedef struct bio_connect_st { int state; diff --git a/crypto/bio/bss_rtcp.c b/crypto/bio/bss_rtcp.c index 925e9c811a..2ef040057e 100644 --- a/crypto/bio/bss_rtcp.c +++ b/crypto/bio/bss_rtcp.c @@ -58,6 +58,7 @@ /* Written by David L. Jones <jonesd@kcgl1.eng.ohio-state.edu> * Date: 22-JUL-1996 + * Revised: 25-SEP-1997 Update for 0.8.1, BIO_CTRL_SET -> BIO_C_SET_FD */ /* VMS */ #include <stdio.h> @@ -68,7 +69,8 @@ #include <openssl/bio.h> #include <iodef.h> /* VMS IO$_ definitions */ -extern int SYS$QIOW(); +#include <starlet.h> + typedef unsigned short io_channel; /*************************************************************************/ struct io_status { short status, count; long flags; }; @@ -114,11 +116,17 @@ BIO_METHOD *BIO_s_rtcp(void) /*****************************************************************************/ /* Decnet I/O routines. */ + +#ifdef __DECC +#pragma message save +#pragma message disable DOLLARID +#endif + static int get ( io_channel chan, char *buffer, int maxlen, int *length ) { int status; struct io_status iosb; - status = SYS$QIOW ( 0, chan, IO$_READVBLK, &iosb, 0, 0, + status = sys$qiow ( 0, chan, IO$_READVBLK, &iosb, 0, 0, buffer, maxlen, 0, 0, 0, 0 ); if ( (status&1) == 1 ) status = iosb.status; if ( (status&1) == 1 ) *length = iosb.count; @@ -129,11 +137,16 @@ static int put ( io_channel chan, char *buffer, int length ) { int status; struct io_status iosb; - status = SYS$QIOW ( 0, chan, IO$_WRITEVBLK, &iosb, 0, 0, + status = sys$qiow ( 0, chan, IO$_WRITEVBLK, &iosb, 0, 0, buffer, length, 0, 0, 0, 0 ); if ( (status&1) == 1 ) status = iosb.status; return status; } + +#ifdef __DECC +#pragma message restore +#endif + /***************************************************************************/ static int rtcp_new(BIO *bi) @@ -243,7 +256,7 @@ static long rtcp_ctrl(BIO *b, int cmd, long num, char *ptr) case BIO_CTRL_EOF: ret = 1; break; - case BIO_CTRL_SET: + case BIO_C_SET_FD: b->num = num; ret = 1; break; diff --git a/crypto/bn/asm/vms.mar b/crypto/bn/asm/vms.mar new file mode 100644 index 0000000000..ac9d57d7b0 --- /dev/null +++ b/crypto/bn/asm/vms.mar @@ -0,0 +1,6695 @@ + .title vax_bn_mul_add_word unsigned multiply & add, 32*32+32+32=>64 +; +; w.j.m. 15-jan-1999 +; +; it's magic ... +; +; ULONG bn_mul_add_words(ULONG r[],ULONG a[],int n,ULONG w) { +; ULONG c = 0; +; int i; +; for(i = 0; i < n; i++) <c,r[i]> := r[i] + c + a[i] * w ; +; return c; +; } + +r=4 ;(AP) +a=8 ;(AP) +n=12 ;(AP) n by value (input) +w=16 ;(AP) w by value (input) + + + .psect code,nowrt + +.entry bn_mul_add_words,^m<r2,r3,r4,r5,r6> + + moval @r(ap),r2 + moval @a(ap),r3 + movl n(ap),r4 ; assumed >0 by C code + movl w(ap),r5 + clrl r6 ; c + +0$: + emul r5,(r3),(r2),r0 ; w, a[], r[] considered signed + + ; fixup for "negative" r[] + tstl (r2) + bgeq 10$ + incl r1 +10$: + + ; add in c + addl2 r6,r0 + adwc #0,r1 + + ; combined fixup for "negative" w, a[] + tstl r5 + bgeq 20$ + addl2 (r3),r1 +20$: + tstl (r3) + bgeq 30$ + addl2 r5,r1 +30$: + + movl r0,(r2)+ ; store lo result in r[] & advance + addl #4,r3 ; advance a[] + movl r1,r6 ; store hi result => c + + sobgtr r4,0$ + + movl r6,r0 ; return c + ret + + .title vax_bn_mul_word unsigned multiply & add, 32*32+32=>64 +; +; w.j.m. 15-jan-1999 +; +; it's magic ... +; +; ULONG bn_mul_words(ULONG r[],ULONG a[],int n,ULONG w) { +; ULONG c = 0; +; int i; +; for(i = 0; i < num; i++) <c,r[i]> := a[i] * w + c ; +; return(c); +; } + +r=4 ;(AP) +a=8 ;(AP) +n=12 ;(AP) n by value (input) +w=16 ;(AP) w by value (input) + + + .psect code,nowrt + +.entry bn_mul_words,^m<r2,r3,r4,r5,r6> + + moval @r(ap),r2 ; r2 -> r[] + moval @a(ap),r3 ; r3 -> a[] + movl n(ap),r4 ; r4 = loop count (assumed >0 by C code) + movl w(ap),r5 ; r5 = w + clrl r6 ; r6 = c + +0$: + ; <r1,r0> := w * a[] + c + emul r5,(r3),r6,r0 ; w, a[], c considered signed + + ; fixup for "negative" c + tstl r6 ; c + bgeq 10$ + incl r1 +10$: + + ; combined fixup for "negative" w, a[] + tstl r5 ; w + bgeq 20$ + addl2 (r3),r1 ; a[] +20$: + tstl (r3) ; a[] + bgeq 30$ + addl2 r5,r1 ; w +30$: + + movl r0,(r2)+ ; store lo result in r[] & advance + addl #4,r3 ; advance a[] + movl r1,r6 ; store hi result => c + + sobgtr r4,0$ + + movl r6,r0 ; return c + ret + + .title vax_bn_sqr_words unsigned square, 32*32=>64 +; +; w.j.m. 15-jan-1999 +; +; it's magic ... +; +; void bn_sqr_words(ULONG r[],ULONG a[],int n) { +; int i; +; for(i = 0; i < n; i++) <r[2*i+1],r[2*i]> := a[i] * a[i] ; +; } + +r=4 ;(AP) +a=8 ;(AP) +n=12 ;(AP) n by value (input) + + + .psect code,nowrt + +.entry bn_sqr_words,^m<r2,r3,r4,r5> + + moval @r(ap),r2 ; r2 -> r[] + moval @a(ap),r3 ; r3 -> a[] + movl n(ap),r4 ; r4 = n (assumed >0 by C code) + +0$: + movl (r3)+,r5 ; r5 = a[] & advance + + ; <r1,r0> := a[] * a[] + emul r5,r5,#0,r0 ; a[] considered signed + + ; fixup for "negative" a[] + tstl r5 ; a[] + bgeq 30$ + addl2 r5,r1 ; a[] + addl2 r5,r1 ; a[] +30$: + + movl r0,(r2)+ ; store lo result in r[] & advance + movl r1,(r2)+ ; store hi result in r[] & advance + + sobgtr r4,0$ + + movl #1,r0 ; return SS$_NORMAL + ret + + .title (generated) + + .psect code,nowrt + +.entry BN_DIV_WORDS,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10> + subl2 #4,sp + + clrl r9 + movl #2,r8 + + tstl 12(ap) + bneq noname.2 + mnegl #1,r10 + brw noname.3 + tstl r0 + nop +noname.2: + + pushl 12(ap) + calls #1,BN_NUM_BITS_WORD + movl r0,r7 + + cmpl r7,#32 + beql noname.4 + ashl r7,#1,r2 + cmpl 4(ap),r2 + blequ noname.4 + + pushl r7 + calls #1,BN_DIV_WORDS_ABORT +noname.4: + + subl3 r7,#32,r7 + + movl 12(ap),r2 + cmpl 4(ap),r2 + blssu noname.5 + subl2 r2,4(ap) +noname.5: + + tstl r7 + beql noname.6 + + ashl r7,r2,12(ap) + + ashl r7,4(ap),r4 + subl3 r7,#32,r3 + subl3 r3,#32,r2 + extzv r3,r2,8(ap),r2 + bisl3 r4,r2,4(ap) + + ashl r7,8(ap),8(ap) +noname.6: + + bicl3 #65535,12(ap),r2 + extzv #16,#16,r2,r5 + + bicl3 #-65536,12(ap),r6 + +noname.7: + + moval 4(ap),r2 + movzwl 2(r2),r0 + cmpl r0,r5 + bneq noname.8 + + movzwl #65535,r4 + brb noname.9 +noname.8: + + clrl r1 + movl (r2),r0 + movl r5,r2 + bgeq vcg.1 + cmpl r2,r0 + bgtru vcg.2 + incl r1 + brb vcg.2 + nop +vcg.1: + ediv r2,r0,r1,r0 +vcg.2: + movl r1,r4 +noname.9: + +noname.10: + + mull3 r5,r4,r0 + subl3 r0,4(ap),r3 + + bicl3 #65535,r3,r0 + bneq noname.13 + mull3 r6,r4,r2 + ashl #16,r3,r1 + bicl3 #65535,8(ap),r0 + extzv #16,#16,r0,r0 + addl2 r0,r1 + cmpl r2,r1 + bgtru noname.12 +noname.11: + + brb noname.13 + nop +noname.12: + + decl r4 + brb noname.10 +noname.13: + + mull3 r5,r4,r1 + + mull3 r6,r4,r0 + + extzv #16,#16,r0,r3 + + ashl #16,r0,r2 + bicl3 #65535,r2,r0 + + addl2 r3,r1 + + moval 8(ap),r3 + cmpl (r3),r0 + bgequ noname.15 + incl r1 +noname.15: + + subl2 r0,(r3) + + cmpl 4(ap),r1 + bgequ noname.16 + + addl2 12(ap),4(ap) + + decl r4 +noname.16: + + subl2 r1,4(ap) + + decl r8 + beql noname.18 +noname.17: + + ashl #16,r4,r9 + + ashl #16,4(ap),r2 + movzwl 2(r3),r0 + bisl2 r0,r2 + bicl3 #0,r2,4(ap) + + bicl3 #-65536,(r3),r0 + ashl #16,r0,(r3) + brw noname.7 + nop +noname.18: + + bisl2 r4,r9 + + movl r9,r10 + +noname.3: + movl r10,r0 + ret + tstl r0 + + + .psect code,nowrt + +.entry BN_ADD_WORDS,^m<r2,r3,r4,r5,r6,r7> + + tstl 16(ap) + bgtr noname.21 + clrl r7 + brw noname.22 +noname.21: + + clrl r4 + + tstl r0 +noname.23: + + movl 8(ap),r6 + addl3 r4,(r6),r2 + + bicl2 #0,r2 + + clrl r0 + cmpl r2,r4 + bgequ vcg.3 + incl r0 +vcg.3: + movl r0,r4 + + movl 12(ap),r5 + addl3 (r5),r2,r1 + bicl2 #0,r1 + + clrl r0 + cmpl r1,r2 + bgequ vcg.4 + incl r0 +vcg.4: + addl2 r0,r4 + + movl 4(ap),r3 + movl r1,(r3) + + decl 16(ap) + bgtr gen.1 + brw noname.25 +gen.1: +noname.24: + + addl3 r4,4(r6),r2 + + bicl2 #0,r2 + + clrl r0 + cmpl r2,r4 + bgequ vcg.5 + incl r0 +vcg.5: + movl r0,r4 + + addl3 4(r5),r2,r1 + bicl2 #0,r1 + + clrl r0 + cmpl r1,r2 + bgequ vcg.6 + incl r0 +vcg.6: + addl2 r0,r4 + + movl r1,4(r3) + + decl 16(ap) + bleq noname.25 +noname.26: + + addl3 r4,8(r6),r2 + + bicl2 #0,r2 + + clrl r0 + cmpl r2,r4 + bgequ vcg.7 + incl r0 +vcg.7: + movl r0,r4 + + addl3 8(r5),r2,r1 + bicl2 #0,r1 + + clrl r0 + cmpl r1,r2 + bgequ vcg.8 + incl r0 +vcg.8: + addl2 r0,r4 + + movl r1,8(r3) + + decl 16(ap) + bleq noname.25 +noname.27: + + addl3 r4,12(r6),r2 + + bicl2 #0,r2 + + clrl r0 + cmpl r2,r4 + bgequ vcg.9 + incl r0 +vcg.9: + movl r0,r4 + + addl3 12(r5),r2,r1 + bicl2 #0,r1 + + clrl r0 + cmpl r1,r2 + bgequ vcg.10 + incl r0 +vcg.10: + addl2 r0,r4 + + movl r1,12(r3) + + decl 16(ap) + bleq noname.25 +noname.28: + + addl3 #16,r6,8(ap) + + addl3 #16,r5,12(ap) + + addl3 #16,r3,4(ap) + brw noname.23 + tstl r0 +noname.25: + + movl r4,r7 + +noname.22: + movl r7,r0 + ret + nop + + + +;r=4 ;(AP) +;a=8 ;(AP) +;b=12 ;(AP) +;n=16 ;(AP) n by value (input) + + .psect code,nowrt + +.entry BN_SUB_WORDS,^m<r2,r3,r4,r5,r6,r7> + + clrl r6 + + tstl 16(ap) + bgtr noname.31 + clrl r7 + brw noname.32 + tstl r0 +noname.31: + +noname.33: + + movl 8(ap),r5 + movl (r5),r1 + movl 12(ap),r4 + movl (r4),r2 + + movl 4(ap),r3 + subl3 r2,r1,r0 + subl2 r6,r0 + bicl3 #0,r0,(r3) + + cmpl r1,r2 + beql noname.34 + clrl r0 + cmpl r1,r2 + bgequ vcg.11 + incl r0 +vcg.11: + movl r0,r6 +noname.34: + + decl 16(ap) + bgtr gen.2 + brw noname.36 +gen.2: +noname.35: + + movl 4(r5),r2 + movl 4(r4),r1 + + subl3 r1,r2,r0 + subl2 r6,r0 + bicl3 #0,r0,4(r3) + + cmpl r2,r1 + beql noname.37 + clrl r0 + cmpl r2,r1 + bgequ vcg.12 + incl r0 +vcg.12: |