diff options
Diffstat (limited to 'src/lib/libcrypto')
105 files changed, 788 insertions, 3260 deletions
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl index 48fa857d5b..34cbb5d844 100755 --- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl +++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl | |||
@@ -36,7 +36,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | |||
36 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or | 36 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or |
37 | die "can't locate x86_64-xlate.pl"; | 37 | die "can't locate x86_64-xlate.pl"; |
38 | 38 | ||
39 | open STDOUT,"| $^X $xlate $flavour $output"; | 39 | open OUT,"| \"$^X\" $xlate $flavour $output"; |
40 | *STDOUT=*OUT; | ||
40 | 41 | ||
41 | $verticalspin=1; # unlike 32-bit version $verticalspin performs | 42 | $verticalspin=1; # unlike 32-bit version $verticalspin performs |
42 | # ~15% better on both AMD and Intel cores | 43 | # ~15% better on both AMD and Intel cores |
diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl index 499f3b3f42..0dbb194b8d 100644 --- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl +++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl | |||
@@ -172,7 +172,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | |||
172 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or | 172 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or |
173 | die "can't locate x86_64-xlate.pl"; | 173 | die "can't locate x86_64-xlate.pl"; |
174 | 174 | ||
175 | open STDOUT,"| $^X $xlate $flavour $output"; | 175 | open OUT,"| \"$^X\" $xlate $flavour $output"; |
176 | *STDOUT=*OUT; | ||
176 | 177 | ||
177 | $movkey = $PREFIX eq "aesni" ? "movups" : "movups"; | 178 | $movkey = $PREFIX eq "aesni" ? "movups" : "movups"; |
178 | @_4args=$win64? ("%rcx","%rdx","%r8", "%r9") : # Win64 order | 179 | @_4args=$win64? ("%rcx","%rdx","%r8", "%r9") : # Win64 order |
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c index ad0d2506f6..297c45a9ff 100644 --- a/src/lib/libcrypto/asn1/a_int.c +++ b/src/lib/libcrypto/asn1/a_int.c | |||
@@ -116,7 +116,7 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp) | |||
116 | int pad=0,ret,i,neg; | 116 | int pad=0,ret,i,neg; |
117 | unsigned char *p,*n,pb=0; | 117 | unsigned char *p,*n,pb=0; |
118 | 118 | ||
119 | if ((a == NULL) || (a->data == NULL)) return(0); | 119 | if (a == NULL) return(0); |
120 | neg=a->type & V_ASN1_NEG; | 120 | neg=a->type & V_ASN1_NEG; |
121 | if (a->length == 0) | 121 | if (a->length == 0) |
122 | ret=1; | 122 | ret=1; |
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c index 264ebf2393..ead37ac325 100644 --- a/src/lib/libcrypto/asn1/a_strex.c +++ b/src/lib/libcrypto/asn1/a_strex.c | |||
@@ -567,6 +567,7 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in) | |||
567 | if(mbflag == -1) return -1; | 567 | if(mbflag == -1) return -1; |
568 | mbflag |= MBSTRING_FLAG; | 568 | mbflag |= MBSTRING_FLAG; |
569 | stmp.data = NULL; | 569 | stmp.data = NULL; |
570 | stmp.length = 0; | ||
570 | ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); | 571 | ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); |
571 | if(ret < 0) return ret; | 572 | if(ret < 0) return ret; |
572 | *out = stmp.data; | 573 | *out = stmp.data; |
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c index 1a30bf119b..aa60203ba8 100644 --- a/src/lib/libcrypto/asn1/asn1_err.c +++ b/src/lib/libcrypto/asn1/asn1_err.c | |||
@@ -305,7 +305,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]= | |||
305 | {ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, | 305 | {ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, |
306 | {ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM),"unknown signature algorithm"}, | 306 | {ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM),"unknown signature algorithm"}, |
307 | {ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"}, | 307 | {ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"}, |
308 | {ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unkown format"}, | 308 | {ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unknown format"}, |
309 | {ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, | 309 | {ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, |
310 | {ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, | 310 | {ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, |
311 | {ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, | 311 | {ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, |
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c index 627ec87f9f..b649e1fcf9 100644 --- a/src/lib/libcrypto/asn1/x_pubkey.c +++ b/src/lib/libcrypto/asn1/x_pubkey.c | |||
@@ -175,12 +175,15 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) | |||
175 | CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY); | 175 | CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY); |
176 | if (key->pkey) | 176 | if (key->pkey) |
177 | { | 177 | { |
178 | CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY); | ||
178 | EVP_PKEY_free(ret); | 179 | EVP_PKEY_free(ret); |
179 | ret = key->pkey; | 180 | ret = key->pkey; |
180 | } | 181 | } |
181 | else | 182 | else |
183 | { | ||
182 | key->pkey = ret; | 184 | key->pkey = ret; |
183 | CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY); | 185 | CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY); |
186 | } | ||
184 | CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY); | 187 | CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY); |
185 | 188 | ||
186 | return ret; | 189 | return ret; |
diff --git a/src/lib/libcrypto/bio/bss_dgram.c b/src/lib/libcrypto/bio/bss_dgram.c index 1b1e4bec81..54c012c47d 100644 --- a/src/lib/libcrypto/bio/bss_dgram.c +++ b/src/lib/libcrypto/bio/bss_dgram.c | |||
@@ -77,10 +77,20 @@ | |||
77 | #define OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE 0xc0 | 77 | #define OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE 0xc0 |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | #ifdef OPENSSL_SYS_LINUX | 80 | #if defined(OPENSSL_SYS_LINUX) && !defined(IP_MTU) |
81 | #define IP_MTU 14 /* linux is lame */ | 81 | #define IP_MTU 14 /* linux is lame */ |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | #if defined(__FreeBSD__) && defined(IN6_IS_ADDR_V4MAPPED) | ||
85 | /* Standard definition causes type-punning problems. */ | ||
86 | #undef IN6_IS_ADDR_V4MAPPED | ||
87 | #define s6_addr32 __u6_addr.__u6_addr32 | ||
88 | #define IN6_IS_ADDR_V4MAPPED(a) \ | ||
89 | (((a)->s6_addr32[0] == 0) && \ | ||
90 | ((a)->s6_addr32[1] == 0) && \ | ||
91 | ((a)->s6_addr32[2] == htonl(0x0000ffff))) | ||
92 | #endif | ||
93 | |||
84 | #ifdef WATT32 | 94 | #ifdef WATT32 |
85 | #define sock_write SockWrite /* Watt-32 uses same names */ | 95 | #define sock_write SockWrite /* Watt-32 uses same names */ |
86 | #define sock_read SockRead | 96 | #define sock_read SockRead |
@@ -255,7 +265,7 @@ static void dgram_adjust_rcv_timeout(BIO *b) | |||
255 | { | 265 | { |
256 | #if defined(SO_RCVTIMEO) | 266 | #if defined(SO_RCVTIMEO) |
257 | bio_dgram_data *data = (bio_dgram_data *)b->ptr; | 267 | bio_dgram_data *data = (bio_dgram_data *)b->ptr; |
258 | int sz = sizeof(int); | 268 | union { size_t s; int i; } sz = {0}; |
259 | 269 | ||
260 | /* Is a timer active? */ | 270 | /* Is a timer active? */ |
261 | if (data->next_timeout.tv_sec > 0 || data->next_timeout.tv_usec > 0) | 271 | if (data->next_timeout.tv_sec > 0 || data->next_timeout.tv_usec > 0) |
@@ -265,8 +275,10 @@ static void dgram_adjust_rcv_timeout(BIO *b) | |||
265 | /* Read current socket timeout */ | 275 | /* Read current socket timeout */ |
266 | #ifdef OPENSSL_SYS_WINDOWS | 276 | #ifdef OPENSSL_SYS_WINDOWS |
267 | int timeout; | 277 | int timeout; |
278 | |||
279 | sz.i = sizeof(timeout); | ||
268 | if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, | 280 | if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, |
269 | (void*)&timeout, &sz) < 0) | 281 | (void*)&timeout, &sz.i) < 0) |
270 | { perror("getsockopt"); } | 282 | { perror("getsockopt"); } |
271 | else | 283 | else |
272 | { | 284 | { |
@@ -274,9 +286,12 @@ static void dgram_adjust_rcv_timeout(BIO *b) | |||
274 | data->socket_timeout.tv_usec = (timeout % 1000) * 1000; | 286 | data->socket_timeout.tv_usec = (timeout % 1000) * 1000; |
275 | } | 287 | } |
276 | #else | 288 | #else |
289 | sz.i = sizeof(data->socket_timeout); | ||
277 | if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, | 290 | if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, |
278 | &(data->socket_timeout), (void *)&sz) < 0) | 291 | &(data->socket_timeout), (void *)&sz) < 0) |
279 | { perror("getsockopt"); } | 292 | { perror("getsockopt"); } |
293 | else if (sizeof(sz.s)!=sizeof(sz.i) && sz.i==0) | ||
294 | OPENSSL_assert(sz.s<=sizeof(data->socket_timeout)); | ||
280 | #endif | 295 | #endif |
281 | 296 | ||
282 | /* Get current time */ | 297 | /* Get current time */ |
@@ -445,11 +460,10 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
445 | int *ip; | 460 | int *ip; |
446 | struct sockaddr *to = NULL; | 461 | struct sockaddr *to = NULL; |
447 | bio_dgram_data *data = NULL; | 462 | bio_dgram_data *data = NULL; |
448 | #if defined(IP_MTU_DISCOVER) || defined(IP_MTU) | 463 | #if defined(OPENSSL_SYS_LINUX) && (defined(IP_MTU_DISCOVER) || defined(IP_MTU)) |
449 | long sockopt_val = 0; | 464 | int sockopt_val = 0; |
450 | unsigned int sockopt_len = 0; | 465 | socklen_t sockopt_len; /* assume that system supporting IP_MTU is |
451 | #endif | 466 | * modern enough to define socklen_t */ |
452 | #ifdef OPENSSL_SYS_LINUX | ||
453 | socklen_t addr_len; | 467 | socklen_t addr_len; |
454 | union { | 468 | union { |
455 | struct sockaddr sa; | 469 | struct sockaddr sa; |
@@ -531,7 +545,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
531 | break; | 545 | break; |
532 | /* (Linux)kernel sets DF bit on outgoing IP packets */ | 546 | /* (Linux)kernel sets DF bit on outgoing IP packets */ |
533 | case BIO_CTRL_DGRAM_MTU_DISCOVER: | 547 | case BIO_CTRL_DGRAM_MTU_DISCOVER: |
534 | #ifdef OPENSSL_SYS_LINUX | 548 | #if defined(OPENSSL_SYS_LINUX) && defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO) |
535 | addr_len = (socklen_t)sizeof(addr); | 549 | addr_len = (socklen_t)sizeof(addr); |
536 | memset((void *)&addr, 0, sizeof(addr)); | 550 | memset((void *)&addr, 0, sizeof(addr)); |
537 | if (getsockname(b->num, &addr.sa, &addr_len) < 0) | 551 | if (getsockname(b->num, &addr.sa, &addr_len) < 0) |
@@ -539,7 +553,6 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
539 | ret = 0; | 553 | ret = 0; |
540 | break; | 554 | break; |
541 | } | 555 | } |
542 | sockopt_len = sizeof(sockopt_val); | ||
543 | switch (addr.sa.sa_family) | 556 | switch (addr.sa.sa_family) |
544 | { | 557 | { |
545 | case AF_INET: | 558 | case AF_INET: |
@@ -548,7 +561,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
548 | &sockopt_val, sizeof(sockopt_val))) < 0) | 561 | &sockopt_val, sizeof(sockopt_val))) < 0) |
549 | perror("setsockopt"); | 562 | perror("setsockopt"); |
550 | break; | 563 | break; |
551 | #if OPENSSL_USE_IPV6 && defined(IPV6_MTU_DISCOVER) | 564 | #if OPENSSL_USE_IPV6 && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO) |
552 | case AF_INET6: | 565 | case AF_INET6: |
553 | sockopt_val = IPV6_PMTUDISC_DO; | 566 | sockopt_val = IPV6_PMTUDISC_DO; |
554 | if ((ret = setsockopt(b->num, IPPROTO_IPV6, IPV6_MTU_DISCOVER, | 567 | if ((ret = setsockopt(b->num, IPPROTO_IPV6, IPV6_MTU_DISCOVER, |
@@ -565,7 +578,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
565 | break; | 578 | break; |
566 | #endif | 579 | #endif |
567 | case BIO_CTRL_DGRAM_QUERY_MTU: | 580 | case BIO_CTRL_DGRAM_QUERY_MTU: |
568 | #ifdef OPENSSL_SYS_LINUX | 581 | #if defined(OPENSSL_SYS_LINUX) && defined(IP_MTU) |
569 | addr_len = (socklen_t)sizeof(addr); | 582 | addr_len = (socklen_t)sizeof(addr); |
570 | memset((void *)&addr, 0, sizeof(addr)); | 583 | memset((void *)&addr, 0, sizeof(addr)); |
571 | if (getsockname(b->num, &addr.sa, &addr_len) < 0) | 584 | if (getsockname(b->num, &addr.sa, &addr_len) < 0) |
@@ -727,12 +740,15 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
727 | #endif | 740 | #endif |
728 | break; | 741 | break; |
729 | case BIO_CTRL_DGRAM_GET_RECV_TIMEOUT: | 742 | case BIO_CTRL_DGRAM_GET_RECV_TIMEOUT: |
730 | #ifdef OPENSSL_SYS_WINDOWS | ||
731 | { | 743 | { |
732 | int timeout, sz = sizeof(timeout); | 744 | union { size_t s; int i; } sz = {0}; |
745 | #ifdef OPENSSL_SYS_WINDOWS | ||
746 | int timeout; | ||
733 | struct timeval *tv = (struct timeval *)ptr; | 747 | struct timeval *tv = (struct timeval *)ptr; |
748 | |||
749 | sz.i = sizeof(timeout); | ||
734 | if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, | 750 | if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, |
735 | (void*)&timeout, &sz) < 0) | 751 | (void*)&timeout, &sz.i) < 0) |
736 | { perror("getsockopt"); ret = -1; } | 752 | { perror("getsockopt"); ret = -1; } |
737 | else | 753 | else |
738 | { | 754 | { |
@@ -740,12 +756,20 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
740 | tv->tv_usec = (timeout % 1000) * 1000; | 756 | tv->tv_usec = (timeout % 1000) * 1000; |
741 | ret = sizeof(*tv); | 757 | ret = sizeof(*tv); |
742 | } | 758 | } |
743 | } | ||
744 | #else | 759 | #else |
760 | sz.i = sizeof(struct timeval); | ||
745 | if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, | 761 | if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, |
746 | ptr, (void *)&ret) < 0) | 762 | ptr, (void *)&sz) < 0) |
747 | { perror("getsockopt"); ret = -1; } | 763 | { perror("getsockopt"); ret = -1; } |
764 | else if (sizeof(sz.s)!=sizeof(sz.i) && sz.i==0) | ||
765 | { | ||
766 | OPENSSL_assert(sz.s<=sizeof(struct timeval)); | ||
767 | ret = (int)sz.s; | ||
768 | } | ||
769 | else | ||
770 | ret = sz.i; | ||
748 | #endif | 771 | #endif |
772 | } | ||
749 | break; | 773 | break; |
750 | #endif | 774 | #endif |
751 | #if defined(SO_SNDTIMEO) | 775 | #if defined(SO_SNDTIMEO) |
@@ -765,12 +789,15 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
765 | #endif | 789 | #endif |
766 | break; | 790 | break; |
767 | case BIO_CTRL_DGRAM_GET_SEND_TIMEOUT: | 791 | case BIO_CTRL_DGRAM_GET_SEND_TIMEOUT: |
768 | #ifdef OPENSSL_SYS_WINDOWS | ||
769 | { | 792 | { |
770 | int timeout, sz = sizeof(timeout); | 793 | union { size_t s; int i; } sz = {0}; |
794 | #ifdef OPENSSL_SYS_WINDOWS | ||
795 | int timeout; | ||
771 | struct timeval *tv = (struct timeval *)ptr; | 796 | struct timeval *tv = (struct timeval *)ptr; |
797 | |||
798 | sz.i = sizeof(timeout); | ||
772 | if (getsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO, | 799 | if (getsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO, |
773 | (void*)&timeout, &sz) < 0) | 800 | (void*)&timeout, &sz.i) < 0) |
774 | { perror("getsockopt"); ret = -1; } | 801 | { perror("getsockopt"); ret = -1; } |
775 | else | 802 | else |
776 | { | 803 | { |
@@ -778,12 +805,20 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
778 | tv->tv_usec = (timeout % 1000) * 1000; | 805 | tv->tv_usec = (timeout % 1000) * 1000; |
779 | ret = sizeof(*tv); | 806 | ret = sizeof(*tv); |
780 | } | 807 | } |
781 | } | ||
782 | #else | 808 | #else |
809 | sz.i = sizeof(struct timeval); | ||
783 | if ( getsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO, | 810 | if ( getsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO, |
784 | ptr, (void *)&ret) < 0) | 811 | ptr, (void *)&sz) < 0) |
785 | { perror("getsockopt"); ret = -1; } | 812 | { perror("getsockopt"); ret = -1; } |
813 | else if (sizeof(sz.s)!=sizeof(sz.i) && sz.i==0) | ||
814 | { | ||
815 | OPENSSL_assert(sz.s<=sizeof(struct timeval)); | ||
816 | ret = (int)sz.s; | ||
817 | } | ||
818 | else | ||
819 | ret = sz.i; | ||
786 | #endif | 820 | #endif |
821 | } | ||
787 | break; | 822 | break; |
788 | #endif | 823 | #endif |
789 | case BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP: | 824 | case BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP: |
@@ -871,8 +906,8 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag) | |||
871 | memset(authchunks, 0, sizeof(sockopt_len)); | 906 | memset(authchunks, 0, sizeof(sockopt_len)); |
872 | ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len); | 907 | ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len); |
873 | OPENSSL_assert(ret >= 0); | 908 | OPENSSL_assert(ret >= 0); |
874 | 909 | ||
875 | for (p = (unsigned char*) authchunks + sizeof(sctp_assoc_t); | 910 | for (p = (unsigned char*) authchunks->gauth_chunks; |
876 | p < (unsigned char*) authchunks + sockopt_len; | 911 | p < (unsigned char*) authchunks + sockopt_len; |
877 | p += sizeof(uint8_t)) | 912 | p += sizeof(uint8_t)) |
878 | { | 913 | { |
@@ -955,7 +990,6 @@ static int dgram_sctp_free(BIO *a) | |||
955 | #ifdef SCTP_AUTHENTICATION_EVENT | 990 | #ifdef SCTP_AUTHENTICATION_EVENT |
956 | void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notification *snp) | 991 | void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notification *snp) |
957 | { | 992 | { |
958 | unsigned int sockopt_len = 0; | ||
959 | int ret; | 993 | int ret; |
960 | struct sctp_authkey_event* authkeyevent = &snp->sn_auth_event; | 994 | struct sctp_authkey_event* authkeyevent = &snp->sn_auth_event; |
961 | 995 | ||
@@ -965,9 +999,8 @@ void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notification *snp) | |||
965 | 999 | ||
966 | /* delete key */ | 1000 | /* delete key */ |
967 | authkeyid.scact_keynumber = authkeyevent->auth_keynumber; | 1001 | authkeyid.scact_keynumber = authkeyevent->auth_keynumber; |
968 | sockopt_len = sizeof(struct sctp_authkeyid); | ||
969 | ret = setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_DELETE_KEY, | 1002 | ret = setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_DELETE_KEY, |
970 | &authkeyid, sockopt_len); | 1003 | &authkeyid, sizeof(struct sctp_authkeyid)); |
971 | } | 1004 | } |
972 | } | 1005 | } |
973 | #endif | 1006 | #endif |
@@ -1164,7 +1197,7 @@ static int dgram_sctp_read(BIO *b, char *out, int outl) | |||
1164 | ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen); | 1197 | ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen); |
1165 | OPENSSL_assert(ii >= 0); | 1198 | OPENSSL_assert(ii >= 0); |
1166 | 1199 | ||
1167 | for (p = (unsigned char*) authchunks + sizeof(sctp_assoc_t); | 1200 | for (p = (unsigned char*) authchunks->gauth_chunks; |
1168 | p < (unsigned char*) authchunks + optlen; | 1201 | p < (unsigned char*) authchunks + optlen; |
1169 | p += sizeof(uint8_t)) | 1202 | p += sizeof(uint8_t)) |
1170 | { | 1203 | { |
@@ -1298,7 +1331,7 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
1298 | { | 1331 | { |
1299 | long ret=1; | 1332 | long ret=1; |
1300 | bio_dgram_sctp_data *data = NULL; | 1333 | bio_dgram_sctp_data *data = NULL; |
1301 | unsigned int sockopt_len = 0; | 1334 | socklen_t sockopt_len = 0; |
1302 | struct sctp_authkeyid authkeyid; | 1335 | struct sctp_authkeyid authkeyid; |
1303 | struct sctp_authkey *authkey; | 1336 | struct sctp_authkey *authkey; |
1304 | 1337 | ||
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c index b7dce5c1a2..2227b2b52d 100644 --- a/src/lib/libcrypto/bio/bss_log.c +++ b/src/lib/libcrypto/bio/bss_log.c | |||
@@ -245,7 +245,7 @@ static int MS_CALLBACK slg_puts(BIO *bp, const char *str) | |||
245 | 245 | ||
246 | static void xopenlog(BIO* bp, char* name, int level) | 246 | static void xopenlog(BIO* bp, char* name, int level) |
247 | { | 247 | { |
248 | if (GetVersion() < 0x80000000) | 248 | if (check_winnt()) |
249 | bp->ptr = RegisterEventSourceA(NULL,name); | 249 | bp->ptr = RegisterEventSourceA(NULL,name); |
250 | else | 250 | else |
251 | bp->ptr = NULL; | 251 | bp->ptr = NULL; |
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index f34248ec4f..21a1a3fe35 100644 --- a/src/lib/libcrypto/bn/bn.h +++ b/src/lib/libcrypto/bn/bn.h | |||
@@ -538,6 +538,8 @@ BIGNUM *BN_mod_inverse(BIGNUM *ret, | |||
538 | BIGNUM *BN_mod_sqrt(BIGNUM *ret, | 538 | BIGNUM *BN_mod_sqrt(BIGNUM *ret, |
539 | const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx); | 539 | const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx); |
540 | 540 | ||
541 | void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); | ||
542 | |||
541 | /* Deprecated versions */ | 543 | /* Deprecated versions */ |
542 | #ifndef OPENSSL_NO_DEPRECATED | 544 | #ifndef OPENSSL_NO_DEPRECATED |
543 | BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe, | 545 | BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe, |
@@ -774,11 +776,20 @@ int RAND_pseudo_bytes(unsigned char *buf,int num); | |||
774 | 776 | ||
775 | #define bn_fix_top(a) bn_check_top(a) | 777 | #define bn_fix_top(a) bn_check_top(a) |
776 | 778 | ||
779 | #define bn_check_size(bn, bits) bn_wcheck_size(bn, ((bits+BN_BITS2-1))/BN_BITS2) | ||
780 | #define bn_wcheck_size(bn, words) \ | ||
781 | do { \ | ||
782 | const BIGNUM *_bnum2 = (bn); \ | ||
783 | assert(words <= (_bnum2)->dmax && words >= (_bnum2)->top); \ | ||
784 | } while(0) | ||
785 | |||
777 | #else /* !BN_DEBUG */ | 786 | #else /* !BN_DEBUG */ |
778 | 787 | ||
779 | #define bn_pollute(a) | 788 | #define bn_pollute(a) |
780 | #define bn_check_top(a) | 789 | #define bn_check_top(a) |
781 | #define bn_fix_top(a) bn_correct_top(a) | 790 | #define bn_fix_top(a) bn_correct_top(a) |
791 | #define bn_check_size(bn, bits) | ||
792 | #define bn_wcheck_size(bn, words) | ||
782 | 793 | ||
783 | #endif | 794 | #endif |
784 | 795 | ||
diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c index 52b3304293..7b2403185e 100644 --- a/src/lib/libcrypto/bn/bn_div.c +++ b/src/lib/libcrypto/bn/bn_div.c | |||
@@ -141,6 +141,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, | |||
141 | * | 141 | * |
142 | * <appro@fy.chalmers.se> | 142 | * <appro@fy.chalmers.se> |
143 | */ | 143 | */ |
144 | #undef bn_div_words | ||
144 | # define bn_div_words(n0,n1,d0) \ | 145 | # define bn_div_words(n0,n1,d0) \ |
145 | ({ asm volatile ( \ | 146 | ({ asm volatile ( \ |
146 | "divl %4" \ | 147 | "divl %4" \ |
@@ -155,6 +156,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, | |||
155 | * Same story here, but it's 128-bit by 64-bit division. Wow! | 156 | * Same story here, but it's 128-bit by 64-bit division. Wow! |
156 | * <appro@fy.chalmers.se> | 157 | * <appro@fy.chalmers.se> |
157 | */ | 158 | */ |
159 | # undef bn_div_words | ||
158 | # define bn_div_words(n0,n1,d0) \ | 160 | # define bn_div_words(n0,n1,d0) \ |
159 | ({ asm volatile ( \ | 161 | ({ asm volatile ( \ |
160 | "divq %4" \ | 162 | "divq %4" \ |
diff --git a/src/lib/libcrypto/bn/bn_gcd.c b/src/lib/libcrypto/bn/bn_gcd.c index 4a352119ba..a808f53178 100644 --- a/src/lib/libcrypto/bn/bn_gcd.c +++ b/src/lib/libcrypto/bn/bn_gcd.c | |||
@@ -205,6 +205,7 @@ err: | |||
205 | /* solves ax == 1 (mod n) */ | 205 | /* solves ax == 1 (mod n) */ |
206 | static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, | 206 | static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, |
207 | const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); | 207 | const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); |
208 | |||
208 | BIGNUM *BN_mod_inverse(BIGNUM *in, | 209 | BIGNUM *BN_mod_inverse(BIGNUM *in, |
209 | const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) | 210 | const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) |
210 | { | 211 | { |
diff --git a/src/lib/libcrypto/bn/bn_lcl.h b/src/lib/libcrypto/bn/bn_lcl.h index eecfd8cc99..817c773b65 100644 --- a/src/lib/libcrypto/bn/bn_lcl.h +++ b/src/lib/libcrypto/bn/bn_lcl.h | |||
@@ -282,16 +282,23 @@ extern "C" { | |||
282 | # endif | 282 | # endif |
283 | # elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)) | 283 | # elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)) |
284 | # if defined(__GNUC__) && __GNUC__>=2 | 284 | # if defined(__GNUC__) && __GNUC__>=2 |
285 | # define BN_UMULT_HIGH(a,b) ({ \ | 285 | # if __GNUC__>=4 && __GNUC_MINOR__>=4 /* "h" constraint is no more since 4.4 */ |
286 | # define BN_UMULT_HIGH(a,b) (((__uint128_t)(a)*(b))>>64) | ||
287 | # define BN_UMULT_LOHI(low,high,a,b) ({ \ | ||
288 | __uint128_t ret=(__uint128_t)(a)*(b); \ | ||
289 | (high)=ret>>64; (low)=ret; }) | ||
290 | # else | ||
291 | # define BN_UMULT_HIGH(a,b) ({ \ | ||
286 | register BN_ULONG ret; \ | 292 | register BN_ULONG ret; \ |
287 | asm ("dmultu %1,%2" \ | 293 | asm ("dmultu %1,%2" \ |
288 | : "=h"(ret) \ | 294 | : "=h"(ret) \ |
289 | : "r"(a), "r"(b) : "l"); \ | 295 | : "r"(a), "r"(b) : "l"); \ |
290 | ret; }) | 296 | ret; }) |
291 | # define BN_UMULT_LOHI(low,high,a,b) \ | 297 | # define BN_UMULT_LOHI(low,high,a,b)\ |
292 | asm ("dmultu %2,%3" \ | 298 | asm ("dmultu %2,%3" \ |
293 | : "=l"(low),"=h"(high) \ | 299 | : "=l"(low),"=h"(high) \ |
294 | : "r"(a), "r"(b)); | 300 | : "r"(a), "r"(b)); |
301 | # endif | ||
295 | # endif | 302 | # endif |
296 | # endif /* cpu */ | 303 | # endif /* cpu */ |
297 | #endif /* OPENSSL_NO_ASM */ | 304 | #endif /* OPENSSL_NO_ASM */ |
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 7a5676de69..5461e6ee7d 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
@@ -824,3 +824,55 @@ int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b, | |||
824 | } | 824 | } |
825 | return bn_cmp_words(a,b,cl); | 825 | return bn_cmp_words(a,b,cl); |
826 | } | 826 | } |
827 | |||
828 | /* | ||
829 | * Constant-time conditional swap of a and b. | ||
830 | * a and b are swapped if condition is not 0. The code assumes that at most one bit of condition is set. | ||
831 | * nwords is the number of words to swap. The code assumes that at least nwords are allocated in both a and b, | ||
832 | * and that no more than nwords are used by either a or b. | ||
833 | * a and b cannot be the same number | ||
834 | */ | ||
835 | void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) | ||
836 | { | ||
837 | BN_ULONG t; | ||
838 | int i; | ||
839 | |||
840 | bn_wcheck_size(a, nwords); | ||
841 | bn_wcheck_size(b, nwords); | ||
842 | |||
843 | assert(a != b); | ||
844 | assert((condition & (condition - 1)) == 0); | ||
845 | assert(sizeof(BN_ULONG) >= sizeof(int)); | ||
846 | |||
847 | condition = ((condition - 1) >> (BN_BITS2 - 1)) - 1; | ||
848 | |||
849 | t = (a->top^b->top) & condition; | ||
850 | a->top ^= t; | ||
851 | b->top ^= t; | ||
852 | |||
853 | #define BN_CONSTTIME_SWAP(ind) \ | ||
854 | do { \ | ||
855 | t = (a->d[ind] ^ b->d[ind]) & condition; \ | ||
856 | a->d[ind] ^= t; \ | ||
857 | b->d[ind] ^= t; \ | ||
858 | } while (0) | ||
859 | |||
860 | |||
861 | switch (nwords) { | ||
862 | default: | ||
863 | for (i = 10; i < nwords; i++) | ||
864 | BN_CONSTTIME_SWAP(i); | ||
865 | /* Fallthrough */ | ||
866 | case 10: BN_CONSTTIME_SWAP(9); /* Fallthrough */ | ||
867 | case 9: BN_CONSTTIME_SWAP(8); /* Fallthrough */ | ||
868 | case 8: BN_CONSTTIME_SWAP(7); /* Fallthrough */ | ||
869 | case 7: BN_CONSTTIME_SWAP(6); /* Fallthrough */ | ||
870 | case 6: BN_CONSTTIME_SWAP(5); /* Fallthrough */ | ||
871 | case 5: BN_CONSTTIME_SWAP(4); /* Fallthrough */ | ||
872 | case 4: BN_CONSTTIME_SWAP(3); /* Fallthrough */ | ||
873 | case 3: BN_CONSTTIME_SWAP(2); /* Fallthrough */ | ||
874 | case 2: BN_CONSTTIME_SWAP(1); /* Fallthrough */ | ||
875 | case 1: BN_CONSTTIME_SWAP(0); | ||
876 | } | ||
877 | #undef BN_CONSTTIME_SWAP | ||
878 | } | ||
diff --git a/src/lib/libcrypto/bn/bn_nist.c b/src/lib/libcrypto/bn/bn_nist.c index 43caee4770..e22968d4a3 100644 --- a/src/lib/libcrypto/bn/bn_nist.c +++ b/src/lib/libcrypto/bn/bn_nist.c | |||
@@ -286,26 +286,25 @@ const BIGNUM *BN_get0_nist_prime_521(void) | |||
286 | } | 286 | } |
287 | 287 | ||
288 | 288 | ||
289 | static void nist_cp_bn_0(BN_ULONG *buf, BN_ULONG *a, int top, int max) | 289 | static void nist_cp_bn_0(BN_ULONG *dst, const BN_ULONG *src, int top, int max) |
290 | { | 290 | { |
291 | int i; | 291 | int i; |
292 | BN_ULONG *_tmp1 = (buf), *_tmp2 = (a); | ||
293 | 292 | ||
294 | #ifdef BN_DEBUG | 293 | #ifdef BN_DEBUG |
295 | OPENSSL_assert(top <= max); | 294 | OPENSSL_assert(top <= max); |
296 | #endif | 295 | #endif |
297 | for (i = (top); i != 0; i--) | 296 | for (i = 0; i < top; i++) |
298 | *_tmp1++ = *_tmp2++; | 297 | dst[i] = src[i]; |
299 | for (i = (max) - (top); i != 0; i--) | 298 | for (; i < max; i++) |
300 | *_tmp1++ = (BN_ULONG) 0; | 299 | dst[i] = 0; |
301 | } | 300 | } |
302 | 301 | ||
303 | static void nist_cp_bn(BN_ULONG *buf, BN_ULONG *a, int top) | 302 | static void nist_cp_bn(BN_ULONG *dst, const BN_ULONG *src, int top) |
304 | { | 303 | { |
305 | int i; | 304 | int i; |
306 | BN_ULONG *_tmp1 = (buf), *_tmp2 = (a); | 305 | |
307 | for (i = (top); i != 0; i--) | 306 | for (i = 0; i < top; i++) |
308 | *_tmp1++ = *_tmp2++; | 307 | dst[i] = src[i]; |
309 | } | 308 | } |
310 | 309 | ||
311 | #if BN_BITS2 == 64 | 310 | #if BN_BITS2 == 64 |
@@ -451,8 +450,9 @@ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
451 | */ | 450 | */ |
452 | mask = 0-(PTR_SIZE_INT)bn_sub_words(c_d,r_d,_nist_p_192[0],BN_NIST_192_TOP); | 451 | mask = 0-(PTR_SIZE_INT)bn_sub_words(c_d,r_d,_nist_p_192[0],BN_NIST_192_TOP); |
453 | mask &= 0-(PTR_SIZE_INT)carry; | 452 | mask &= 0-(PTR_SIZE_INT)carry; |
453 | res = c_d; | ||
454 | res = (BN_ULONG *) | 454 | res = (BN_ULONG *) |
455 | (((PTR_SIZE_INT)c_d&~mask) | ((PTR_SIZE_INT)r_d&mask)); | 455 | (((PTR_SIZE_INT)res&~mask) | ((PTR_SIZE_INT)r_d&mask)); |
456 | nist_cp_bn(r_d, res, BN_NIST_192_TOP); | 456 | nist_cp_bn(r_d, res, BN_NIST_192_TOP); |
457 | r->top = BN_NIST_192_TOP; | 457 | r->top = BN_NIST_192_TOP; |
458 | bn_correct_top(r); | 458 | bn_correct_top(r); |
@@ -479,8 +479,11 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
479 | int top = a->top, i; | 479 | int top = a->top, i; |
480 | int carry; | 480 | int carry; |
481 | BN_ULONG *r_d, *a_d = a->d; | 481 | BN_ULONG *r_d, *a_d = a->d; |
482 | BN_ULONG buf[BN_NIST_224_TOP], | 482 | union { |
483 | c_d[BN_NIST_224_TOP], | 483 | BN_ULONG bn[BN_NIST_224_TOP]; |
484 | unsigned int ui[BN_NIST_224_TOP*sizeof(BN_ULONG)/sizeof(unsigned int)]; | ||
485 | } buf; | ||
486 | BN_ULONG c_d[BN_NIST_224_TOP], | ||
484 | *res; | 487 | *res; |
485 | PTR_SIZE_INT mask; | 488 | PTR_SIZE_INT mask; |
486 | union { bn_addsub_f f; PTR_SIZE_INT p; } u; | 489 | union { bn_addsub_f f; PTR_SIZE_INT p; } u; |
@@ -519,18 +522,18 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
519 | /* copy upper 256 bits of 448 bit number ... */ | 522 | /* copy upper 256 bits of 448 bit number ... */ |
520 | nist_cp_bn_0(c_d, a_d + (BN_NIST_224_TOP-1), top - (BN_NIST_224_TOP-1), BN_NIST_224_TOP); | 523 | nist_cp_bn_0(c_d, a_d + (BN_NIST_224_TOP-1), top - (BN_NIST_224_TOP-1), BN_NIST_224_TOP); |
521 | /* ... and right shift by 32 to obtain upper 224 bits */ | 524 | /* ... and right shift by 32 to obtain upper 224 bits */ |
522 | nist_set_224(buf, c_d, 14, 13, 12, 11, 10, 9, 8); | 525 | nist_set_224(buf.bn, c_d, 14, 13, 12, 11, 10, 9, 8); |
523 | /* truncate lower part to 224 bits too */ | 526 | /* truncate lower part to 224 bits too */ |
524 | r_d[BN_NIST_224_TOP-1] &= BN_MASK2l; | 527 | r_d[BN_NIST_224_TOP-1] &= BN_MASK2l; |
525 | #else | 528 | #else |
526 | nist_cp_bn_0(buf, a_d + BN_NIST_224_TOP, top - BN_NIST_224_TOP, BN_NIST_224_TOP); | 529 | nist_cp_bn_0(buf.bn, a_d + BN_NIST_224_TOP, top - BN_NIST_224_TOP, BN_NIST_224_TOP); |
527 | #endif | 530 | #endif |
528 | 531 | ||
529 | #if defined(NIST_INT64) && BN_BITS2!=64 | 532 | #if defined(NIST_INT64) && BN_BITS2!=64 |
530 | { | 533 | { |
531 | NIST_INT64 acc; /* accumulator */ | 534 | NIST_INT64 acc; /* accumulator */ |
532 | unsigned int *rp=(unsigned int *)r_d; | 535 | unsigned int *rp=(unsigned int *)r_d; |
533 | const unsigned int *bp=(const unsigned int *)buf; | 536 | const unsigned int *bp=(const unsigned int *)buf.ui; |
534 | 537 | ||
535 | acc = rp[0]; acc -= bp[7-7]; | 538 | acc = rp[0]; acc -= bp[7-7]; |
536 | acc -= bp[11-7]; rp[0] = (unsigned int)acc; acc >>= 32; | 539 | acc -= bp[11-7]; rp[0] = (unsigned int)acc; acc >>= 32; |
@@ -565,13 +568,13 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
565 | { | 568 | { |
566 | BN_ULONG t_d[BN_NIST_224_TOP]; | 569 | BN_ULONG t_d[BN_NIST_224_TOP]; |
567 | 570 | ||
568 | nist_set_224(t_d, buf, 10, 9, 8, 7, 0, 0, 0); | 571 | nist_set_224(t_d, buf.bn, 10, 9, 8, 7, 0, 0, 0); |
569 | carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP); | 572 | carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP); |
570 | nist_set_224(t_d, buf, 0, 13, 12, 11, 0, 0, 0); | 573 | nist_set_224(t_d, buf.bn, 0, 13, 12, 11, 0, 0, 0); |
571 | carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP); | 574 | carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP); |
572 | nist_set_224(t_d, buf, 13, 12, 11, 10, 9, 8, 7); | 575 | nist_set_224(t_d, buf.bn, 13, 12, 11, 10, 9, 8, 7); |
573 | carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP); | 576 | carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP); |
574 | nist_set_224(t_d, buf, 0, 0, 0, 0, 13, 12, 11); | 577 | nist_set_224(t_d, buf.bn, 0, 0, 0, 0, 13, 12, 11); |
575 | carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP); | 578 | carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP); |
576 | 579 | ||
577 | #if BN_BITS2==64 | 580 | #if BN_BITS2==64 |
@@ -606,7 +609,8 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
606 | /* otherwise it's effectively same as in BN_nist_mod_192... */ | 609 | /* otherwise it's effectively same as in BN_nist_mod_192... */ |
607 | mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_224[0],BN_NIST_224_TOP); | 610 | mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_224[0],BN_NIST_224_TOP); |
608 | mask &= 0-(PTR_SIZE_INT)carry; | 611 | mask &= 0-(PTR_SIZE_INT)carry; |
609 | res = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) | | 612 | res = c_d; |
613 | res = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) | | ||
610 | ((PTR_SIZE_INT)r_d&mask)); | 614 | ((PTR_SIZE_INT)r_d&mask)); |
611 | nist_cp_bn(r_d, res, BN_NIST_224_TOP); | 615 | nist_cp_bn(r_d, res, BN_NIST_224_TOP); |
612 | r->top = BN_NIST_224_TOP; | 616 | r->top = BN_NIST_224_TOP; |
@@ -805,7 +809,8 @@ int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
805 | 809 | ||
806 | mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_256[0],BN_NIST_256_TOP); | 810 | mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_256[0],BN_NIST_256_TOP); |
807 | mask &= 0-(PTR_SIZE_INT)carry; | 811 | mask &= 0-(PTR_SIZE_INT)carry; |
808 | res = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) | | 812 | res = c_d; |
813 | res = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) | | ||
809 | ((PTR_SIZE_INT)r_d&mask)); | 814 | ((PTR_SIZE_INT)r_d&mask)); |
810 | nist_cp_bn(r_d, res, BN_NIST_256_TOP); | 815 | nist_cp_bn(r_d, res, BN_NIST_256_TOP); |
811 | r->top = BN_NIST_256_TOP; | 816 | r->top = BN_NIST_256_TOP; |
@@ -1026,7 +1031,8 @@ int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
1026 | 1031 | ||
1027 | mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_384[0],BN_NIST_384_TOP); | 1032 | mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_384[0],BN_NIST_384_TOP); |
1028 | mask &= 0-(PTR_SIZE_INT)carry; | 1033 | mask &= 0-(PTR_SIZE_INT)carry; |
1029 | res = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) | | 1034 | res = c_d; |
1035 | res = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) | | ||
1030 | ((PTR_SIZE_INT)r_d&mask)); | 1036 | ((PTR_SIZE_INT)r_d&mask)); |
1031 | nist_cp_bn(r_d, res, BN_NIST_384_TOP); | 1037 | nist_cp_bn(r_d, res, BN_NIST_384_TOP); |
1032 | r->top = BN_NIST_384_TOP; | 1038 | r->top = BN_NIST_384_TOP; |
@@ -1092,7 +1098,8 @@ int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
1092 | 1098 | ||
1093 | bn_add_words(r_d,r_d,t_d,BN_NIST_521_TOP); | 1099 | bn_add_words(r_d,r_d,t_d,BN_NIST_521_TOP); |
1094 | mask = 0-(PTR_SIZE_INT)bn_sub_words(t_d,r_d,_nist_p_521,BN_NIST_521_TOP); | 1100 | mask = 0-(PTR_SIZE_INT)bn_sub_words(t_d,r_d,_nist_p_521,BN_NIST_521_TOP); |
1095 | res = (BN_ULONG *)(((PTR_SIZE_INT)t_d&~mask) | | 1101 | res = t_d; |
1102 | res = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) | | ||
1096 | ((PTR_SIZE_INT)r_d&mask)); | 1103 | ((PTR_SIZE_INT)r_d&mask)); |
1097 | nist_cp_bn(r_d,res,BN_NIST_521_TOP); | 1104 | nist_cp_bn(r_d,res,BN_NIST_521_TOP); |
1098 | r->top = BN_NIST_521_TOP; | 1105 | r->top = BN_NIST_521_TOP; |
diff --git a/src/lib/libcrypto/buffer/buffer.c b/src/lib/libcrypto/buffer/buffer.c index d7aa79ad7f..d4a4ce43b3 100644 --- a/src/lib/libcrypto/buffer/buffer.c +++ b/src/lib/libcrypto/buffer/buffer.c | |||
@@ -179,14 +179,14 @@ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) | |||
179 | return(len); | 179 | return(len); |
180 | } | 180 | } |
181 | 181 | ||
182 | void BUF_reverse(unsigned char *out, unsigned char *in, size_t size) | 182 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size) |
183 | { | 183 | { |
184 | size_t i; | 184 | size_t i; |
185 | if (in) | 185 | if (in) |
186 | { | 186 | { |
187 | out += size - 1; | 187 | out += size - 1; |
188 | for (i = 0; i < size; i++) | 188 | for (i = 0; i < size; i++) |
189 | *in++ = *out--; | 189 | *out-- = *in++; |
190 | } | 190 | } |
191 | else | 191 | else |
192 | { | 192 | { |
diff --git a/src/lib/libcrypto/buffer/buffer.h b/src/lib/libcrypto/buffer/buffer.h index 178e418282..f8da32b485 100644 --- a/src/lib/libcrypto/buffer/buffer.h +++ b/src/lib/libcrypto/buffer/buffer.h | |||
@@ -88,7 +88,7 @@ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len); | |||
88 | char * BUF_strdup(const char *str); | 88 | char * BUF_strdup(const char *str); |
89 | char * BUF_strndup(const char *str, size_t siz); | 89 | char * BUF_strndup(const char *str, size_t siz); |
90 | void * BUF_memdup(const void *data, size_t siz); | 90 | void * BUF_memdup(const void *data, size_t siz); |
91 | void BUF_reverse(unsigned char *out, unsigned char *in, size_t siz); | 91 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); |
92 | 92 | ||
93 | /* safe string functions */ | 93 | /* safe string functions */ |
94 | size_t BUF_strlcpy(char *dst,const char *src,size_t siz); | 94 | size_t BUF_strlcpy(char *dst,const char *src,size_t siz); |
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c index 766ea8cac7..0b77d8b7d0 100644 --- a/src/lib/libcrypto/cryptlib.c +++ b/src/lib/libcrypto/cryptlib.c | |||
@@ -504,7 +504,7 @@ void CRYPTO_THREADID_current(CRYPTO_THREADID *id) | |||
504 | CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL)); | 504 | CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL)); |
505 | #else | 505 | #else |
506 | /* For everything else, default to using the address of 'errno' */ | 506 | /* For everything else, default to using the address of 'errno' */ |
507 | CRYPTO_THREADID_set_pointer(id, &errno); | 507 | CRYPTO_THREADID_set_pointer(id, (void*)&errno); |
508 | #endif | 508 | #endif |
509 | } | 509 | } |
510 | 510 | ||
@@ -704,6 +704,7 @@ void OPENSSL_cpuid_setup(void) | |||
704 | } | 704 | } |
705 | else | 705 | else |
706 | vec = OPENSSL_ia32_cpuid(); | 706 | vec = OPENSSL_ia32_cpuid(); |
707 | |||
707 | /* | 708 | /* |
708 | * |(1<<10) sets a reserved bit to signal that variable | 709 | * |(1<<10) sets a reserved bit to signal that variable |
709 | * was initialized already... This is to avoid interference | 710 | * was initialized already... This is to avoid interference |
@@ -888,7 +889,7 @@ void OPENSSL_showfatal (const char *fmta,...) | |||
888 | 889 | ||
889 | #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 | 890 | #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 |
890 | /* this -------------v--- guards NT-specific calls */ | 891 | /* this -------------v--- guards NT-specific calls */ |
891 | if (GetVersion() < 0x80000000 && OPENSSL_isservice() > 0) | 892 | if (check_winnt() && OPENSSL_isservice() > 0) |
892 | { HANDLE h = RegisterEventSource(0,_T("OPENSSL")); | 893 | { HANDLE h = RegisterEventSource(0,_T("OPENSSL")); |
893 | const TCHAR *pmsg=buf; | 894 | const TCHAR *pmsg=buf; |
894 | ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0); | 895 | ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0); |
@@ -924,3 +925,16 @@ void OpenSSLDie(const char *file,int line,const char *assertion) | |||
924 | } | 925 | } |
925 | 926 | ||
926 | void *OPENSSL_stderr(void) { return stderr; } | 927 | void *OPENSSL_stderr(void) { return stderr; } |
928 | |||
929 | int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) | ||
930 | { | ||
931 | size_t i; | ||
932 | const unsigned char *a = in_a; | ||
933 | const unsigned char *b = in_b; | ||
934 | unsigned char x = 0; | ||
935 | |||
936 | for (i = 0; i < len; i++) | ||
937 | x |= a[i] ^ b[i]; | ||
938 | |||
939 | return x; | ||
940 | } | ||
diff --git a/src/lib/libcrypto/cryptlib.h b/src/lib/libcrypto/cryptlib.h index 1761f6b668..d26f9630ea 100644 --- a/src/lib/libcrypto/cryptlib.h +++ b/src/lib/libcrypto/cryptlib.h | |||
@@ -100,7 +100,7 @@ extern "C" { | |||
100 | 100 | ||
101 | void OPENSSL_cpuid_setup(void); | 101 | void OPENSSL_cpuid_setup(void); |
102 | extern unsigned int OPENSSL_ia32cap_P[]; | 102 | extern unsigned int OPENSSL_ia32cap_P[]; |
103 | void OPENSSL_showfatal(const char *,...); | 103 | void OPENSSL_showfatal(const char *fmta,...); |
104 | void *OPENSSL_stderr(void); | 104 | void *OPENSSL_stderr(void); |
105 | extern int OPENSSL_NONPIC_relocated; | 105 | extern int OPENSSL_NONPIC_relocated; |
106 | 106 | ||
diff --git a/src/lib/libcrypto/crypto-lib.com b/src/lib/libcrypto/crypto-lib.com deleted file mode 100644 index c280aa03a8..0000000000 --- a/src/lib/libcrypto/crypto-lib.com +++ /dev/null | |||
@@ -1,1516 +0,0 @@ | |||
1 | $! | ||
2 | $! CRYPTO-LIB.COM | ||
3 | $! Written By: Robert Byer | ||
4 | $! Vice-President | ||
5 | $! A-Com Computing, Inc. | ||
6 | $! byer@mail.all-net.net | ||
7 | $! | ||
8 | $! Changes by Richard Levitte <richard@levitte.org> | ||
9 | $! Zoltan Arpadffy <arpadffy@polarhome.com> | ||
10 | $! | ||
11 | $! This command files compiles and creates the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" | ||
12 | $! library for OpenSSL. The "xxx" denotes the machine architecture, ALPHA, | ||
13 | $! IA64 or VAX. | ||
14 | $! | ||
15 | $! It was re-written so it would try to determine what "C" compiler to use | ||
16 | $! or you can specify which "C" compiler to use. | ||
17 | $! | ||
18 | $! Specify the following as P1 to build just that part or ALL to just | ||
19 | $! build everything. | ||
20 | $! | ||
21 | $! LIBRARY To just compile the [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library. | ||
22 | $! APPS To just compile the [.xxx.EXE.CRYPTO]*.EXE | ||
23 | $! ALL To do both LIBRARY and APPS | ||
24 | $! | ||
25 | $! Specify DEBUG or NODEBUG as P2 to compile with or without debugger | ||
26 | $! information. | ||
27 | $! | ||
28 | $! Specify which compiler at P3 to try to compile under. | ||
29 | $! | ||
30 | $! VAXC For VAX C. | ||
31 | $! DECC For DEC C. | ||
32 | $! GNUC For GNU C. | ||
33 | $! | ||
34 | $! If you don't specify a compiler, it will try to determine which | ||
35 | $! "C" compiler to use. | ||
36 | $! | ||
37 | $! P4, if defined, sets a TCP/IP library to use, through one of the following | ||
38 | $! keywords: | ||
39 | $! | ||
40 | $! UCX For UCX | ||
41 | $! TCPIP For TCPIP (post UCX) | ||
42 | $! SOCKETSHR For SOCKETSHR+NETLIB | ||
43 | $! | ||
44 | $! P5, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up) | ||
45 | $! | ||
46 | $! P6, if defined, sets a choice of crypto methods to compile. | ||
47 | $! WARNING: this should only be done to recompile some part of an already | ||
48 | $! fully compiled library. | ||
49 | $! | ||
50 | $! P7, if defined, specifies the C pointer size. Ignored on VAX. | ||
51 | $! ("64=ARGV" gives more efficient code with HP C V7.3 or newer.) | ||
52 | $! Supported values are: | ||
53 | $! | ||
54 | $! "" Compile with default (/NOPOINTER_SIZE) | ||
55 | $! 32 Compile with /POINTER_SIZE=32 (SHORT) | ||
56 | $! 64 Compile with /POINTER_SIZE=64[=ARGV] (LONG[=ARGV]). | ||
57 | $! (Automatically select ARGV if compiler supports it.) | ||
58 | $! 64= Compile with /POINTER_SIZE=64 (LONG). | ||
59 | $! 64=ARGV Compile with /POINTER_SIZE=64=ARGV (LONG=ARGV). | ||
60 | $! | ||
61 | $! P8, if defined, specifies a directory where ZLIB files (zlib.h, | ||
62 | $! libz.olb) may be found. Optionally, a non-default object library | ||
63 | $! name may be included ("dev:[dir]libz_64.olb", for example). | ||
64 | $! | ||
65 | $! | ||
66 | $! Announce/identify. | ||
67 | $! | ||
68 | $ proc = f$environment( "procedure") | ||
69 | $ write sys$output "@@@ "+ - | ||
70 | f$parse( proc, , , "name")+ f$parse( proc, , , "type") | ||
71 | $! | ||
72 | $! Define A TCP/IP Library That We Will Need To Link To. | ||
73 | $! (That Is, If We Need To Link To One.) | ||
74 | $! | ||
75 | $ TCPIP_LIB = "" | ||
76 | $ ZLIB_LIB = "" | ||
77 | $! | ||
78 | $! Check Which Architecture We Are Using. | ||
79 | $! | ||
80 | $ IF (F$GETSYI("CPU").LT.128) | ||
81 | $ THEN | ||
82 | $! | ||
83 | $! The Architecture Is VAX | ||
84 | $! | ||
85 | $ ARCH = "VAX" | ||
86 | $! | ||
87 | $! Else... | ||
88 | $! | ||
89 | $ ELSE | ||
90 | $! | ||
91 | $! The Architecture Is Alpha, IA64 or whatever comes in the future. | ||
92 | $! | ||
93 | $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE") | ||
94 | $ IF (ARCH .EQS. "") THEN ARCH = "UNK" | ||
95 | $! | ||
96 | $! End The Architecture Check. | ||
97 | $! | ||
98 | $ ENDIF | ||
99 | $! | ||
100 | $ ARCHD = ARCH | ||
101 | $ LIB32 = "32" | ||
102 | $ OPT_FILE = "" | ||
103 | $ POINTER_SIZE = "" | ||
104 | $! | ||
105 | $! Define The Different Encryption Types. | ||
106 | $! NOTE: Some might think this list ugly. However, it's made this way to | ||
107 | $! reflect the SDIRS variable in [-]Makefile.org as closely as possible, | ||
108 | $! thereby making it fairly easy to verify that the lists are the same. | ||
109 | $! | ||
110 | $ ET_WHIRLPOOL = "WHRLPOOL" | ||
111 | $ IF ARCH .EQS. "VAX" THEN ET_WHIRLPOOL = "" | ||
112 | $ ENCRYPT_TYPES = "Basic,"+ - | ||
113 | "OBJECTS,"+ - | ||
114 | "MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,"+ET_WHIRLPOOL+","+ - | ||
115 | "DES,AES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,MODES,"+ - | ||
116 | "BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,"+ - | ||
117 | "BUFFER,BIO,STACK,LHASH,RAND,ERR,"+ - | ||
118 | "EVP,EVP_2,EVP_3,ASN1,ASN1_2,PEM,X509,X509V3,"+ - | ||
119 | "CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,UI,KRB5,"+ - | ||
120 | "CMS,PQUEUE,TS,JPAKE,SRP,STORE,CMAC" | ||
121 | $! | ||
122 | $! Check To Make Sure We Have Valid Command Line Parameters. | ||
123 | $! | ||
124 | $ GOSUB CHECK_OPTIONS | ||
125 | $! | ||
126 | $! Define The OBJ and EXE Directories. | ||
127 | $! | ||
128 | $ OBJ_DIR := SYS$DISK:[-.'ARCHD'.OBJ.CRYPTO] | ||
129 | $ EXE_DIR := SYS$DISK:[-.'ARCHD'.EXE.CRYPTO] | ||
130 | $! | ||
131 | $! Specify the destination directory in any /MAP option. | ||
132 | $! | ||
133 | $ if (LINKMAP .eqs. "MAP") | ||
134 | $ then | ||
135 | $ LINKMAP = LINKMAP+ "=''EXE_DIR'" | ||
136 | $ endif | ||
137 | $! | ||
138 | $! Add the location prefix to the linker options file name. | ||
139 | $! | ||
140 | $ if (OPT_FILE .nes. "") | ||
141 | $ then | ||
142 | $ OPT_FILE = EXE_DIR+ OPT_FILE | ||
143 | $ endif | ||
144 | $! | ||
145 | $! Initialise logical names and such | ||
146 | $! | ||
147 | $ GOSUB INITIALISE | ||
148 | $! | ||
149 | $! Tell The User What Kind of Machine We Run On. | ||
150 | $! | ||
151 | $ WRITE SYS$OUTPUT "Host system architecture: ''ARCHD'" | ||
152 | $! | ||
153 | $! | ||
154 | $! Check To See If The Architecture Specific OBJ Directory Exists. | ||
155 | $! | ||
156 | $ IF (F$PARSE(OBJ_DIR).EQS."") | ||
157 | $ THEN | ||
158 | $! | ||
159 | $! It Dosen't Exist, So Create It. | ||
160 | $! | ||
161 | $ CREATE/DIR 'OBJ_DIR' | ||
162 | $! | ||
163 | $! End The Architecture Specific OBJ Directory Check. | ||
164 | $! | ||
165 | $ ENDIF | ||
166 | $! | ||
167 | $! Check To See If The Architecture Specific Directory Exists. | ||
168 | $! | ||
169 | $ IF (F$PARSE(EXE_DIR).EQS."") | ||
170 | $ THEN | ||
171 | $! | ||
172 | $! It Dosen't Exist, So Create It. | ||
173 | $! | ||
174 | $ CREATE/DIRECTORY 'EXE_DIR' | ||
175 | $! | ||
176 | $! End The Architecture Specific Directory Check. | ||
177 | $! | ||
178 | $ ENDIF | ||
179 | $! | ||
180 | $! Define The Library Name. | ||
181 | $! | ||
182 | $ LIB_NAME := 'EXE_DIR'SSL_LIBCRYPTO'LIB32'.OLB | ||
183 | $! | ||
184 | $! Define The CRYPTO-LIB We Are To Use. | ||
185 | $! | ||
186 | $ CRYPTO_LIB := 'EXE_DIR'SSL_LIBCRYPTO'LIB32'.OLB | ||
187 | $! | ||
188 | $! Check To See If We Already Have A "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library... | ||
189 | $! | ||
190 | $ IF (F$SEARCH(LIB_NAME).EQS."") | ||
191 | $ THEN | ||
192 | $! | ||
193 | $! Guess Not, Create The Library. | ||
194 | $! | ||
195 | $ LIBRARY/CREATE/OBJECT 'LIB_NAME' | ||
196 | $! | ||
197 | $! End The Library Check. | ||
198 | $! | ||
199 | $ ENDIF | ||
200 | $! | ||
201 | $! Build our options file for the application | ||
202 | $! | ||
203 | $ GOSUB CHECK_OPT_FILE | ||
204 | $! | ||
205 | $! Define The Different Encryption "library" Strings. | ||
206 | $! | ||
207 | $ APPS_DES = "DES/DES,CBC3_ENC" | ||
208 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" | ||
209 | $ | ||
210 | $ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,cpt_err,"+ - | ||
211 | "ebcdic,uid,o_time,o_str,o_dir,o_fips.c,o_init,fips_ers" | ||
212 | $ LIB_MD2 = "md2_dgst,md2_one" | ||
213 | $ LIB_MD4 = "md4_dgst,md4_one" | ||
214 | $ LIB_MD5 = "md5_dgst,md5_one" | ||
215 | $ LIB_SHA = "sha_dgst,sha1dgst,sha_one,sha1_one,sha256,sha512" | ||
216 | $ LIB_MDC2 = "mdc2dgst,mdc2_one" | ||
217 | $ LIB_HMAC = "hmac,hm_ameth,hm_pmeth" | ||
218 | $ LIB_RIPEMD = "rmd_dgst,rmd_one" | ||
219 | $ LIB_WHRLPOOL = "wp_dgst,wp_block" | ||
220 | $ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ - | ||
221 | "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ - | ||
222 | "enc_read,enc_writ,ofb64enc,"+ - | ||
223 | "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ - | ||
224 | "des_enc,fcrypt_b,"+ - | ||
225 | "fcrypt,xcbc_enc,rpc_enc,cbc_cksm,"+ - | ||
226 | "ede_cbcm_enc,des_old,des_old2,read2pwd" | ||
227 | $ LIB_RC2 = "rc2_ecb,rc2_skey,rc2_cbc,rc2cfb64,rc2ofb64" | ||
228 | $ LIB_RC4 = "rc4_skey,rc4_enc,rc4_utl" | ||
229 | $ LIB_RC5 = "rc5_skey,rc5_ecb,rc5_enc,rc5cfb64,rc5ofb64" | ||
230 | $ LIB_IDEA = "i_cbc,i_cfb64,i_ofb64,i_ecb,i_skey" | ||
231 | $ LIB_BF = "bf_skey,bf_ecb,bf_enc,bf_cfb64,bf_ofb64" | ||
232 | $ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64" | ||
233 | $ LIB_CAMELLIA = "camellia,cmll_misc,cmll_ecb,cmll_cbc,cmll_ofb,"+ - | ||
234 | "cmll_cfb,cmll_ctr,cmll_utl" | ||
235 | $ LIB_SEED = "seed,seed_ecb,seed_cbc,seed_cfb,seed_ofb" | ||
236 | $ LIB_MODES = "cbc128,ctr128,cts128,cfb128,ofb128,gcm128,"+ - | ||
237 | "ccm128,xts128" | ||
238 | $ LIB_BN_ASM = "[.asm]vms.mar,vms-helper" | ||
239 | $ IF F$TRNLNM("OPENSSL_NO_ASM") .OR. ARCH .NES. "VAX" THEN - | ||
240 | LIB_BN_ASM = "bn_asm" | ||
241 | $ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ - | ||
242 | "bn_print,bn_rand,bn_shift,bn_word,bn_blind,"+ - | ||
243 | "bn_kron,bn_sqrt,bn_gcd,bn_prime,bn_err,bn_sqr,"+LIB_BN_ASM+","+ - | ||
244 | "bn_recp,bn_mont,bn_mpi,bn_exp2,bn_gf2m,bn_nist,"+ - | ||
245 | "bn_depr,bn_const,bn_x931p" | ||
246 | $ LIB_EC = "ec_lib,ecp_smpl,ecp_mont,ecp_nist,ec_cvt,ec_mult,"+ - | ||
247 | "ec_err,ec_curve,ec_check,ec_print,ec_asn1,ec_key,"+ - | ||
248 | "ec2_smpl,ec2_mult,ec_ameth,ec_pmeth,eck_prn,"+ - | ||
249 | "ecp_nistp224,ecp_nistp256,ecp_nistp521,ecp_nistputil,"+ - | ||
250 | "ecp_oct,ec2_oct,ec_oct" | ||
251 | $ LIB_RSA = "rsa_eay,rsa_gen,rsa_lib,rsa_sign,rsa_saos,rsa_err,"+ - | ||
252 | "rsa_pk1,rsa_ssl,rsa_none,rsa_oaep,rsa_chk,rsa_null,"+ - | ||
253 | "rsa_pss,rsa_x931,rsa_asn1,rsa_depr,rsa_ameth,rsa_prn,"+ - | ||
254 | "rsa_pmeth,rsa_crpt" | ||
255 | $ LIB_DSA = "dsa_gen,dsa_key,dsa_lib,dsa_asn1,dsa_vrf,dsa_sign,"+ - | ||
256 | "dsa_err,dsa_ossl,dsa_depr,dsa_ameth,dsa_pmeth,dsa_prn" | ||
257 | $ LIB_ECDSA = "ecs_lib,ecs_asn1,ecs_ossl,ecs_sign,ecs_vrf,ecs_err" | ||
258 | $ LIB_DH = "dh_asn1,dh_gen,dh_key,dh_lib,dh_check,dh_err,dh_depr,"+ - | ||
259 | "dh_ameth,dh_pmeth,dh_prn" | ||
260 | $ LIB_ECDH = "ech_lib,ech_ossl,ech_key,ech_err" | ||
261 | $ LIB_DSO = "dso_dl,dso_dlfcn,dso_err,dso_lib,dso_null,"+ - | ||
262 | "dso_openssl,dso_win32,dso_vms,dso_beos" | ||
263 | $ LIB_ENGINE = "eng_err,eng_lib,eng_list,eng_init,eng_ctrl,"+ - | ||
264 | "eng_table,eng_pkey,eng_fat,eng_all,"+ - | ||
265 | "tb_rsa,tb_dsa,tb_ecdsa,tb_dh,tb_ecdh,tb_rand,tb_store,"+ - | ||
266 | "tb_cipher,tb_digest,tb_pkmeth,tb_asnmth,"+ - | ||
267 | "eng_openssl,eng_dyn,eng_cnf,eng_cryptodev,"+ - | ||
268 | "eng_rsax,eng_rdrand" | ||
269 | $ LIB_AES = "aes_core,aes_misc,aes_ecb,aes_cbc,aes_cfb,aes_ofb,aes_ctr,"+ - | ||
270 | "aes_ige,aes_wrap" | ||
271 | $ LIB_BUFFER = "buffer,buf_str,buf_err" | ||
272 | $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ - | ||
273 | "bss_mem,bss_null,bss_fd,"+ - | ||
274 | "bss_file,bss_sock,bss_conn,"+ - | ||
275 | "bf_null,bf_buff,b_print,b_dump,"+ - | ||
276 | "b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log,"+ - | ||
277 | "bss_dgram,"+ - | ||
278 | "bf_lbuf" | ||
279 | $ LIB_STACK = "stack" | ||
280 | $ LIB_LHASH = "lhash,lh_stats" | ||
281 | $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,"+ - | ||
282 | "rand_vms" | ||
283 | $ LIB_ERR = "err,err_all,err_prn" | ||
284 | $ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err,obj_xref" | ||
285 | $ LIB_EVP = "encode,digest,evp_enc,evp_key,evp_acnf,"+ - | ||
286 | "e_des,e_bf,e_idea,e_des3,e_camellia,"+ - | ||
287 | "e_rc4,e_aes,names,e_seed,"+ - | ||
288 | "e_xcbc_d,e_rc2,e_cast,e_rc5" | ||
289 | $ LIB_EVP_2 = "m_null,m_md2,m_md4,m_md5,m_sha,m_sha1,m_wp," + - | ||
290 | "m_dss,m_dss1,m_mdc2,m_ripemd,m_ecdsa,"+ - | ||
291 | "p_open,p_seal,p_sign,p_verify,p_lib,p_enc,p_dec,"+ - | ||
292 | "bio_md,bio_b64,bio_enc,evp_err,e_null,"+ - | ||
293 | "c_all,c_allc,c_alld,evp_lib,bio_ok,"+- | ||
294 | "evp_pkey,evp_pbe,p5_crpt,p5_crpt2" | ||
295 | $ LIB_EVP_3 = "e_old,pmeth_lib,pmeth_fn,pmeth_gn,m_sigver,evp_fips,"+ - | ||
296 | "e_aes_cbc_hmac_sha1,e_rc4_hmac_md5" | ||
297 | $ LIB_ASN1 = "a_object,a_bitstr,a_utctm,a_gentm,a_time,a_int,a_octet,"+ - | ||
298 | "a_print,a_type,a_set,a_dup,a_d2i_fp,a_i2d_fp,"+ - | ||
299 | "a_enum,a_utf8,a_sign,a_digest,a_verify,a_mbstr,a_strex,"+ - | ||
300 | "x_algor,x_val,x_pubkey,x_sig,x_req,x_attrib,x_bignum,"+ - | ||
301 | "x_long,x_name,x_x509,x_x509a,x_crl,x_info,x_spki,nsseq,"+ - | ||
302 | "x_nx509,d2i_pu,d2i_pr,i2d_pu,i2d_pr" | ||
303 | $ LIB_ASN1_2 = "t_req,t_x509,t_x509a,t_crl,t_pkey,t_spki,t_bitst,"+ - | ||
304 | "tasn_new,tasn_fre,tasn_enc,tasn_dec,tasn_utl,tasn_typ,"+ - | ||
305 | "tasn_prn,ameth_lib,"+ - | ||
306 | "f_int,f_string,n_pkey,"+ - | ||
307 | "f_enum,x_pkey,a_bool,x_exten,bio_asn1,bio_ndef,asn_mime,"+ - | ||
308 | "asn1_gen,asn1_par,asn1_lib,asn1_err,a_bytes,a_strnid,"+ - | ||
309 | "evp_asn1,asn_pack,p5_pbe,p5_pbev2,p8_pkey,asn_moid" | ||
310 | $ LIB_PEM = "pem_sign,pem_seal,pem_info,pem_lib,pem_all,pem_err,"+ - | ||
311 | "pem_x509,pem_xaux,pem_oth,pem_pk8,pem_pkey,pvkfmt" | ||
312 | $ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ - | ||
313 | "x509_obj,x509_req,x509spki,x509_vfy,"+ - | ||
314 | "x509_set,x509cset,x509rset,x509_err,"+ - | ||
315 | "x509name,x509_v3,x509_ext,x509_att,"+ - | ||
316 | "x509type,x509_lu,x_all,x509_txt,"+ - | ||
317 | "x509_trs,by_file,by_dir,x509_vpm" | ||
318 | $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ - | ||
319 | "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ - | ||
320 | "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info,"+ - | ||
321 | "v3_ocsp,v3_akeya,v3_pmaps,v3_pcons,v3_ncons,v3_pcia,v3_pci,"+ - | ||
322 | "pcy_cache,pcy_node,pcy_data,pcy_map,pcy_tree,pcy_lib,"+ - | ||
323 | "v3_asid,v3_addr" | ||
324 | $ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap" | ||
325 | $ LIB_TXT_DB = "txt_db" | ||
326 | $ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ - | ||
327 | "pk7_mime,bio_pk7" | ||
328 | $ LIB_PKCS12 = "p12_add,p12_asn,p12_attr,p12_crpt,p12_crt,p12_decr,"+ - | ||
329 | "p12_init,p12_key,p12_kiss,p12_mutl,"+ - | ||
330 | "p12_utl,p12_npas,pk12err,p12_p8d,p12_p8e" | ||
331 | $ LIB_COMP = "comp_lib,comp_err,"+ - | ||
332 | "c_rle,c_zlib" | ||
333 | $ LIB_OCSP = "ocsp_asn,ocsp_ext,ocsp_ht,ocsp_lib,ocsp_cl,"+ - | ||
334 | "ocsp_srv,ocsp_prn,ocsp_vfy,ocsp_err" | ||
335 | $ LIB_UI_COMPAT = ",ui_compat" | ||
336 | $ LIB_UI = "ui_err,ui_lib,ui_openssl,ui_util"+LIB_UI_COMPAT | ||
337 | $ LIB_KRB5 = "krb5_asn" | ||
338 | $ LIB_CMS = "cms_lib,cms_asn1,cms_att,cms_io,cms_smime,cms_err,"+ - | ||
339 | "cms_sd,cms_dd,cms_cd,cms_env,cms_enc,cms_ess,"+ - | ||
340 | "cms_pwri" | ||
341 | $ LIB_PQUEUE = "pqueue" | ||
342 | $ LIB_TS = "ts_err,ts_req_utils,ts_req_print,ts_rsp_utils,ts_rsp_print,"+ - | ||
343 | "ts_rsp_sign,ts_rsp_verify,ts_verify_ctx,ts_lib,ts_conf,"+ - | ||
344 | "ts_asn1" | ||
345 | $ LIB_JPAKE = "jpake,jpake_err" | ||
346 | $ LIB_SRP = "srp_lib,srp_vfy" | ||
347 | $ LIB_STORE = "str_err,str_lib,str_meth,str_mem" | ||
348 | $ LIB_CMAC = "cmac,cm_ameth.c,cm_pmeth" | ||
349 | $! | ||
350 | $! Setup exceptional compilations | ||
351 | $! | ||
352 | $ CC3_SHOWN = 0 | ||
353 | $ CC4_SHOWN = 0 | ||
354 | $ CC5_SHOWN = 0 | ||
355 | $ CC6_SHOWN = 0 | ||
356 | $! | ||
357 | $! The following lists must have leading and trailing commas, and no | ||
358 | $! embedded spaces. (They are scanned for ",name,".) | ||
359 | $! | ||
360 | $ ! Add definitions for no threads on OpenVMS 7.1 and higher. | ||
361 | $ COMPILEWITH_CC3 = ",bss_rtcp," | ||
362 | $ ! Disable the DOLLARID warning. Not needed with /STANDARD=RELAXED. | ||
363 | $ COMPILEWITH_CC4 = "" !!! ",a_utctm,bss_log,o_time,o_dir," | ||
364 | $ ! Disable disjoint optimization on VAX with DECC. | ||
365 | $ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + - | ||
366 | "seed,sha_dgst,sha1dgst,rmd_dgst,bf_enc," | ||
367 | $ ! Disable the MIXLINKAGE warning. | ||
368 | $ COMPILEWITH_CC6 = "" !!! ",enc_read,set_key," | ||
369 | $! | ||
370 | $! Figure Out What Other Modules We Are To Build. | ||
371 | $! | ||
372 | $ BUILD_SET: | ||
373 | $! | ||
374 | $! Define A Module Counter. | ||
375 | $! | ||
376 | $ MODULE_COUNTER = 0 | ||
377 | $! | ||
378 | $! Top Of The Loop. | ||
379 | $! | ||
380 | $ MODULE_NEXT: | ||
381 | $! | ||
382 | $! Extract The Module Name From The Encryption List. | ||
383 | $! | ||
384 | $ MODULE_NAME = F$ELEMENT(MODULE_COUNTER,",",ENCRYPT_TYPES) | ||
385 | $ IF MODULE_NAME.EQS."Basic" THEN MODULE_NAME = "" | ||
386 | $ MODULE_NAME1 = MODULE_NAME | ||
387 | $! | ||
388 | $! Check To See If We Are At The End Of The Module List. | ||
389 | $! | ||
390 | $ IF (MODULE_NAME.EQS.",") | ||
391 | $ THEN | ||
392 | $! | ||
393 | $! We Are At The End Of The Module List, Go To MODULE_DONE. | ||
394 | $! | ||
395 | $ GOTO MODULE_DONE | ||
396 | $! | ||
397 | $! End The Module List Check. | ||
398 | $! | ||
399 | $ ENDIF | ||
400 | $! | ||
401 | $! Increment The Moudle Counter. | ||
402 | $! | ||
403 | $ MODULE_COUNTER = MODULE_COUNTER + 1 | ||
404 | $! | ||
405 | $! Create The Library and Apps Module Names. | ||
406 | $! | ||
407 | $ LIB_MODULE = "LIB_" + MODULE_NAME | ||
408 | $ APPS_MODULE = "APPS_" + MODULE_NAME | ||
409 | $ IF (F$EXTRACT(0,5,MODULE_NAME).EQS."ASN1_") | ||
410 | $ THEN | ||
411 | $ MODULE_NAME = "ASN1" | ||
412 | $ ENDIF | ||
413 | $ IF (F$EXTRACT(0,4,MODULE_NAME).EQS."EVP_") | ||
414 | $ THEN | ||
415 | $ MODULE_NAME = "EVP" | ||
416 | $ ENDIF | ||
417 | $! | ||
418 | $! Set state (can be LIB and APPS) | ||
419 | $! | ||
420 | $ STATE = "LIB" | ||
421 | $ IF BUILDALL .EQS. "APPS" THEN STATE = "APPS" | ||
422 | $! | ||
423 | $! Check if the library module name actually is defined | ||
424 | $! | ||
425 | $ IF F$TYPE('LIB_MODULE') .EQS. "" | ||
426 | $ THEN | ||
427 | $ WRITE SYS$ERROR "" | ||
428 | $ WRITE SYS$ERROR "The module ",MODULE_NAME1," does not exist. Continuing..." | ||
429 | $ WRITE SYS$ERROR "" | ||
430 | $ GOTO MODULE_NEXT | ||
431 | $ ENDIF | ||
432 | $! | ||
433 | $! Top Of The Module Loop. | ||
434 | $! | ||
435 | $ MODULE_AGAIN: | ||
436 | $! | ||
437 | $! Tell The User What Module We Are Building. | ||
438 | $! | ||
439 | $ IF (MODULE_NAME1.NES."") | ||
440 | $ THEN | ||
441 | $ IF STATE .EQS. "LIB" | ||
442 | $ THEN | ||
443 | $ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Library Files. (",BUILDALL,",",STATE,")" | ||
444 | $ ELSE IF F$TYPE('APPS_MODULE') .NES. "" | ||
445 | $ THEN | ||
446 | $ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Applications. (",BUILDALL,",",STATE,")" | ||
447 | $ ENDIF | ||
448 | $ ENDIF | ||
449 | $ ENDIF | ||
450 | $! | ||
451 | $! Define A File Counter And Set It To "0". | ||
452 | $! | ||
453 | $ FILE_COUNTER = 0 | ||
454 | $ APPLICATION = "" | ||
455 | $ APPLICATION_COUNTER = 0 | ||
456 | $! | ||
457 | $! Top Of The File Loop. | ||
458 | $! | ||
459 | $ NEXT_FILE: | ||
460 | $! | ||
461 | $! Look in the LIB_MODULE is we're in state LIB | ||
462 | $! | ||
463 | $ IF STATE .EQS. "LIB" | ||
464 | $ THEN | ||
465 | $! | ||
466 | $! O.K, Extract The File Name From The File List. | ||
467 | $! | ||
468 | $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",'LIB_MODULE') | ||
469 | $! | ||
470 | $! else | ||
471 | $! | ||
472 | $ ELSE | ||
473 | $ FILE_NAME = "," | ||
474 | $! | ||
475 | $ IF F$TYPE('APPS_MODULE') .NES. "" | ||
476 | $ THEN | ||
477 | $! | ||
478 | $! Extract The File Name From The File List. | ||
479 | $! This part is a bit more complicated. | ||
480 | $! | ||
481 | $ IF APPLICATION .EQS. "" | ||
482 | $ THEN | ||
483 | $ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE') | ||
484 | $ APPLICATION_COUNTER = APPLICATION_COUNTER + 1 | ||
485 | $ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION) | ||
486 | $ APPLICATION = F$ELEMENT(0,"/",APPLICATION) | ||
487 | $ FILE_COUNTER = 0 | ||
488 | $ ENDIF | ||
489 | $ | ||
490 | $! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*" | ||
491 | $! SHOW SYMBOL APPLICATION* | ||
492 | $! | ||
493 | $ IF APPLICATION .NES. ";" | ||
494 | $ THEN | ||
495 | $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",APPLICATION_OBJECTS) | ||
496 | $ IF FILE_NAME .EQS. "," | ||
497 | $ THEN | ||
498 | $ APPLICATION = "" | ||
499 | $ GOTO NEXT_FILE | ||
500 | $ ENDIF | ||
501 | $ ENDIF | ||
502 | $ ENDIF | ||
503 | $ ENDIF | ||
504 | $! | ||
505 | $! Check To See If We Are At The End Of The File List. | ||
506 | $! | ||
507 | $ IF (FILE_NAME.EQS.",") | ||
508 | $ THEN | ||
509 | $! | ||
510 | $! We Are At The End Of The File List, Change State Or Goto FILE_DONE. | ||
511 | $! | ||
512 | $ IF STATE .EQS. "LIB" .AND. BUILDALL .NES. "LIBRARY" | ||
513 | $ THEN | ||
514 | $ STATE = "APPS" | ||
515 | $ GOTO MODULE_AGAIN | ||
516 | $ ELSE | ||
517 | $ GOTO FILE_DONE | ||
518 | $ ENDIF | ||
519 | $! | ||
520 | $! End The File List Check. | ||
521 | $! | ||
522 | $ ENDIF | ||
523 | $! | ||
524 | $! Increment The Counter. | ||
525 | $! | ||
526 | $ FILE_COUNTER = FILE_COUNTER + 1 | ||
527 | $! | ||
528 | $! Create The Source File Name. | ||
529 | $! | ||
530 | $ TMP_FILE_NAME = F$ELEMENT(1,"]",FILE_NAME) | ||
531 | $ IF TMP_FILE_NAME .EQS. "]" THEN TMP_FILE_NAME = FILE_NAME | ||
532 | $ IF F$ELEMENT(0,".",TMP_FILE_NAME) .EQS. TMP_FILE_NAME THEN - | ||
533 | FILE_NAME = FILE_NAME + ".c" | ||
534 | $ IF (MODULE_NAME.NES."") | ||
535 | $ THEN | ||
536 | $ SOURCE_FILE = "SYS$DISK:[." + MODULE_NAME+ "]" + FILE_NAME | ||
537 | $ ELSE | ||
538 | $ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME | ||
539 | $ ENDIF | ||
540 | $ SOURCE_FILE = SOURCE_FILE - "][" | ||
541 | $! | ||
542 | $! Create The Object File Name. | ||
543 | $! | ||
544 | $ OBJECT_FILE = OBJ_DIR + F$PARSE(FILE_NAME,,,"NAME","SYNTAX_ONLY") + ".OBJ" | ||
545 | $ ON WARNING THEN GOTO NEXT_FILE | ||
546 | $! | ||
547 | $! Check To See If The File We Want To Compile Is Actually There. | ||
548 | $! | ||
549 | $ IF (F$SEARCH(SOURCE_FILE).EQS."") | ||
550 | $ THEN | ||
551 | $! | ||
552 | $! Tell The User That The File Doesn't Exist. | ||
553 | $! | ||
554 | $ WRITE SYS$OUTPUT "" | ||
555 | $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Doesn't Exist." | ||
556 | $ WRITE SYS$OUTPUT "" | ||
557 | $! | ||
558 | $! Exit The Build. | ||
559 | $! | ||
560 | $ GOTO EXIT | ||
561 | $! | ||
562 | $! End The File Exist Check. | ||
563 | $! | ||
564 | $ ENDIF | ||
565 | $! | ||
566 | $! Tell The User We Are Compiling The File. | ||
567 | $! | ||
568 | $ IF (MODULE_NAME.EQS."") | ||
569 | $ THEN | ||
570 | $ WRITE SYS$OUTPUT "Compiling The ",FILE_NAME," File. (",BUILDALL,",",STATE,")" | ||
571 | $ ENDIF | ||
572 | $ IF (MODULE_NAME.NES."") | ||
573 | $ THEN | ||
574 | $ WRITE SYS$OUTPUT " ",FILE_NAME,"" | ||
575 | $ ENDIF | ||
576 | $! | ||
577 | $! Compile The File. | ||
578 | $! | ||
579 | $ ON ERROR THEN GOTO NEXT_FILE | ||
580 | $ FILE_NAME0 = ","+ F$ELEMENT(0,".",FILE_NAME)+ "," | ||
581 | $ IF FILE_NAME - ".mar" .NES. FILE_NAME | ||
582 | $ THEN | ||
583 | $ MACRO/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
584 | $ ELSE | ||
585 | $ IF COMPILEWITH_CC3 - FILE_NAME0 .NES. COMPILEWITH_CC3 | ||
586 | $ THEN | ||
587 | $ write sys$output " \Using special rule (3)" | ||
588 | $ if (.not. CC3_SHOWN) | ||
589 | $ then | ||
590 | $ CC3_SHOWN = 1 | ||
591 | $ x = " "+ CC3 | ||
592 | $ write /symbol sys$output x | ||
593 | $ endif | ||
594 | $ CC3/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
595 | $ ELSE | ||
596 | $ IF COMPILEWITH_CC4 - FILE_NAME0 .NES. COMPILEWITH_CC4 | ||
597 | $ THEN | ||
598 | $ write /symbol sys$output " \Using special rule (4)" | ||
599 | $ if (.not. CC4_SHOWN) | ||
600 | $ then | ||
601 | $ CC4_SHOWN = 1 | ||
602 | $ x = " "+ CC4 | ||
603 | $ write /symbol sys$output x | ||
604 | $ endif | ||
605 | $ CC4/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
606 | $ ELSE | ||
607 | $ IF CC5_DIFFERENT .AND. - | ||
608 | (COMPILEWITH_CC5 - FILE_NAME0 .NES. COMPILEWITH_CC5) | ||
609 | $ THEN | ||
610 | $ write sys$output " \Using special rule (5)" | ||
611 | $ if (.not. CC5_SHOWN) | ||
612 | $ then | ||
613 | $ CC5_SHOWN = 1 | ||
614 | $ x = " "+ CC5 | ||
615 | $ write /symbol sys$output x | ||
616 | $ endif | ||
617 | $ CC5/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
618 | $ ELSE | ||
619 | $ IF COMPILEWITH_CC6 - FILE_NAME0 .NES. COMPILEWITH_CC6 | ||
620 | $ THEN | ||
621 | $ write sys$output " \Using special rule (6)" | ||
622 | $ if (.not. CC6_SHOWN) | ||
623 | $ then | ||
624 | $ CC6_SHOWN = 1 | ||
625 | $ x = " "+ CC6 | ||
626 | $ write /symbol sys$output x | ||
627 | $ endif | ||
628 | $ CC6/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
629 | $ ELSE | ||
630 | $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
631 | $ ENDIF | ||
632 | $ ENDIF | ||
633 | $ ENDIF | ||
634 | $ ENDIF | ||
635 | $ ENDIF | ||
636 | $ IF STATE .EQS. "LIB" | ||
637 | $ THEN | ||
638 | $! | ||
639 | $! Add It To The Library. | ||
640 | $! | ||
641 | $ LIBRARY/REPLACE 'LIB_NAME' 'OBJECT_FILE' | ||
642 | $! | ||
643 | $! Time To Clean Up The Object File. | ||
644 | $! | ||
645 | $ DELETE 'OBJECT_FILE';* | ||
646 | $ ENDIF | ||
647 | $! | ||
648 | $! Go Back And Do It Again. | ||
649 | $! | ||
650 | $ GOTO NEXT_FILE | ||
651 | $! | ||
652 | $! All Done With This Library Part. | ||
653 | $! | ||
654 | $ FILE_DONE: | ||
655 | $! | ||
656 | $! Time To Build Some Applications | ||
657 | $! | ||
658 | $ IF F$TYPE('APPS_MODULE') .NES. "" .AND. BUILDALL .NES. "LIBRARY" | ||
659 | $ THEN | ||
660 | $ APPLICATION_COUNTER = 0 | ||
661 | $ NEXT_APPLICATION: | ||
662 | $ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE') | ||
663 | $ IF APPLICATION .EQS. ";" THEN GOTO APPLICATION_DONE | ||
664 | $ | ||
665 | $ APPLICATION_COUNTER = APPLICATION_COUNTER + 1 | ||
666 | $ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION) | ||
667 | $ APPLICATION = F$ELEMENT(0,"/",APPLICATION) | ||
668 | $ | ||
669 | $! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*" | ||
670 | $! SHOW SYMBOL APPLICATION* | ||
671 | $! | ||
672 | $! Tell the user what happens | ||
673 | $! | ||
674 | $ WRITE SYS$OUTPUT " ",APPLICATION,".exe" | ||
675 | $! | ||
676 | $! Link The Program. | ||
677 | $! | ||
678 | $ ON ERROR THEN GOTO NEXT_APPLICATION | ||
679 | $! | ||
680 | $! Link With A TCP/IP Library. | ||
681 | $! | ||
682 | $ LINK /'DEBUGGER' /'LINKMAP' /'TRACEBACK' - | ||
683 | /EXE='EXE_DIR''APPLICATION'.EXE - | ||
684 | 'OBJ_DIR''APPLICATION_OBJECTS', - | ||
685 | 'CRYPTO_LIB'/LIBRARY - | ||
686 | 'TCPIP_LIB' - | ||
687 | 'ZLIB_LIB' - | ||
688 | ,'OPT_FILE' /OPTIONS | ||
689 | $! | ||
690 | $ GOTO NEXT_APPLICATION | ||
691 | $ APPLICATION_DONE: | ||
692 | $ ENDIF | ||
693 | $! | ||
694 | $! Go Back And Get The Next Module. | ||
695 | $! | ||
696 | $ GOTO MODULE_NEXT | ||
697 | $! | ||
698 | $! All Done With This Module. | ||
699 | $! | ||
700 | $ MODULE_DONE: | ||
701 | $! | ||
702 | $! Tell The User That We Are All Done. | ||
703 | $! | ||
704 | $ WRITE SYS$OUTPUT "All Done..." | ||
705 | $ EXIT: | ||
706 | $ GOSUB CLEANUP | ||
707 | $ EXIT | ||
708 | $! | ||
709 | $! Check For The Link Option FIle. | ||
710 | $! | ||
711 | $ CHECK_OPT_FILE: | ||
712 | $! | ||
713 | $! Check To See If We Need To Make A VAX C Option File. | ||
714 | $! | ||
715 | $ IF (COMPILER.EQS."VAXC") | ||
716 | $ THEN | ||
717 | $! | ||
718 | $! Check To See If We Already Have A VAX C Linker Option File. | ||
719 | $! | ||
720 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
721 | $ THEN | ||
722 | $! | ||
723 | $! We Need A VAX C Linker Option File. | ||
724 | $! | ||
725 | $ CREATE 'OPT_FILE' | ||
726 | $DECK | ||
727 | ! | ||
728 | ! Default System Options File To Link Against | ||
729 | ! The Sharable VAX C Runtime Library. | ||
730 | ! | ||
731 | SYS$SHARE:VAXCRTL.EXE/SHARE | ||
732 | $EOD | ||
733 | $! | ||
734 | $! End The Option File Check. | ||
735 | $! | ||
736 | $ ENDIF | ||
737 | $! | ||
738 | $! End The VAXC Check. | ||
739 | $! | ||
740 | $ ENDIF | ||
741 | $! | ||
742 | $! Check To See If We Need A GNU C Option File. | ||
743 | $! | ||
744 | $ IF (COMPILER.EQS."GNUC") | ||
745 | $ THEN | ||
746 | $! | ||
747 | $! Check To See If We Already Have A GNU C Linker Option File. | ||
748 | $! | ||
749 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
750 | $ THEN | ||
751 | $! | ||
752 | $! We Need A GNU C Linker Option File. | ||
753 | $! | ||
754 | $ CREATE 'OPT_FILE' | ||
755 | $DECK | ||
756 | ! | ||
757 | ! Default System Options File To Link Against | ||
758 | ! The Sharable C Runtime Library. | ||
759 | ! | ||
760 | GNU_CC:[000000]GCCLIB/LIBRARY | ||
761 | SYS$SHARE:VAXCRTL/SHARE | ||
762 | $EOD | ||
763 | $! | ||
764 | $! End The Option File Check. | ||
765 | $! | ||
766 | $ ENDIF | ||
767 | $! | ||
768 | $! End The GNU C Check. | ||
769 | $! | ||
770 | $ ENDIF | ||
771 | $! | ||
772 | $! Check To See If We Need A DEC C Option File. | ||
773 | $! | ||
774 | $ IF (COMPILER.EQS."DECC") | ||
775 | $ THEN | ||
776 | $! | ||
777 | $! Check To See If We Already Have A DEC C Linker Option File. | ||
778 | $! | ||
779 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
780 | $ THEN | ||
781 | $! | ||
782 | $! Figure Out If We Need A non-VAX Or A VAX Linker Option File. | ||
783 | $! | ||
784 | $ IF ARCH .EQS. "VAX" | ||
785 | $ THEN | ||
786 | $! | ||
787 | $! We Need A DEC C Linker Option File For VAX. | ||
788 | $! | ||
789 | $ CREATE 'OPT_FILE' | ||
790 | $DECK | ||
791 | ! | ||
792 | ! Default System Options File To Link Against | ||
793 | ! The Sharable DEC C Runtime Library. | ||
794 | ! | ||
795 | SYS$SHARE:DECC$SHR.EXE/SHARE | ||
796 | $EOD | ||
797 | $! | ||
798 | $! Else... | ||
799 | $! | ||
800 | $ ELSE | ||
801 | $! | ||
802 | $! Create The non-VAX Linker Option File. | ||
803 | $! | ||
804 | $ CREATE 'OPT_FILE' | ||
805 | $DECK | ||
806 | ! | ||
807 | ! Default System Options File For non-VAX To Link Against | ||
808 | ! The Sharable C Runtime Library. | ||
809 | ! | ||
810 | SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE | ||
811 | SYS$SHARE:CMA$OPEN_RTL/SHARE | ||
812 | $EOD | ||
813 | $! | ||
814 | $! End The DEC C Option File Check. | ||
815 | $! | ||
816 | $ ENDIF | ||
817 | $! | ||
818 | $! End The Option File Search. | ||
819 | $! | ||
820 | $ ENDIF | ||
821 | $! | ||
822 | $! End The DEC C Check. | ||
823 | $! | ||
824 | $ ENDIF | ||
825 | $! | ||
826 | $! Tell The User What Linker Option File We Are Using. | ||
827 | $! | ||
828 | $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"." | ||
829 | $! | ||
830 | $! Time To RETURN. | ||
831 | $! | ||
832 | $ RETURN | ||
833 | $! | ||
834 | $! Check The User's Options. | ||
835 | $! | ||
836 | $ CHECK_OPTIONS: | ||
837 | $! | ||
838 | $! Check To See If P1 Is Blank. | ||
839 | $! | ||
840 | $ IF (P1.EQS."ALL") | ||
841 | $ THEN | ||
842 | $! | ||
843 | $! P1 Is Blank, So Build Everything. | ||
844 | $! | ||
845 | $ BUILDALL = "TRUE" | ||
846 | $! | ||
847 | $! Else... | ||
848 | $! | ||
849 | $ ELSE | ||
850 | $! | ||
851 | $! Else, Check To See If P1 Has A Valid Argument. | ||
852 | $! | ||
853 | $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."APPS") | ||
854 | $ THEN | ||
855 | $! | ||
856 | $! A Valid Argument. | ||
857 | $! | ||
858 | $ BUILDALL = P1 | ||
859 | $! | ||
860 | $! Else... | ||
861 | $! | ||
862 | $ ELSE | ||
863 | $! | ||
864 | $! Tell The User We Don't Know What They Want. | ||
865 | $! | ||
866 | $ WRITE SYS$OUTPUT "" | ||
867 | $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" | ||
868 | $ WRITE SYS$OUTPUT "" | ||
869 | $ WRITE SYS$OUTPUT " ALL : Just Build Everything." | ||
870 | $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library." | ||
871 | $ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.CRYPTO]*.EXE Programs." | ||
872 | $ WRITE SYS$OUTPUT "" | ||
873 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For:" | ||
874 | $ WRITE SYS$OUTPUT "" | ||
875 | $ WRITE SYS$OUTPUT " ALPHA[64]: Alpha Architecture." | ||
876 | $ WRITE SYS$OUTPUT " IA64[64] : IA64 Architecture." | ||
877 | $ WRITE SYS$OUTPUT " VAX : VAX Architecture." | ||
878 | $ WRITE SYS$OUTPUT "" | ||
879 | $! | ||
880 | $! Time To EXIT. | ||
881 | $! | ||
882 | $ EXIT | ||
883 | $! | ||
884 | $! End The Valid Argument Check. | ||
885 | $! | ||
886 | $ ENDIF | ||
887 | $! | ||
888 | $! End The P1 Check. | ||
889 | $! | ||
890 | $ ENDIF | ||
891 | $! | ||
892 | $! Check To See If P2 Is Blank. | ||
893 | $! | ||
894 | $ IF (P2.EQS."NODEBUG") | ||
895 | $ THEN | ||
896 | $! | ||
897 | $! P2 Is NODEBUG, So Compile Without The Debugger Information. | ||
898 | $! | ||
899 | $ DEBUGGER = "NODEBUG" | ||
900 | $ LINKMAP = "NOMAP" | ||
901 | $ TRACEBACK = "NOTRACEBACK" | ||
902 | $ GCC_OPTIMIZE = "OPTIMIZE" | ||
903 | $ CC_OPTIMIZE = "OPTIMIZE" | ||
904 | $ MACRO_OPTIMIZE = "OPTIMIZE" | ||
905 | $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile." | ||
906 | $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization." | ||
907 | $ ELSE | ||
908 | $! | ||
909 | $! Check To See If We Are To Compile With Debugger Information. | ||
910 | $! | ||
911 | $ IF (P2.EQS."DEBUG") | ||
912 | $ THEN | ||
913 | $! | ||
914 | $! Compile With Debugger Information. | ||
915 | $! | ||
916 | $ DEBUGGER = "DEBUG" | ||
917 | $ LINKMAP = "MAP" | ||
918 | $ TRACEBACK = "TRACEBACK" | ||
919 | $ GCC_OPTIMIZE = "NOOPTIMIZE" | ||
920 | $ CC_OPTIMIZE = "NOOPTIMIZE" | ||
921 | $ MACRO_OPTIMIZE = "NOOPTIMIZE" | ||
922 | $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile." | ||
923 | $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization." | ||
924 | $ ELSE | ||
925 | $! | ||
926 | $! They Entered An Invalid Option. | ||
927 | $! | ||
928 | $ WRITE SYS$OUTPUT "" | ||
929 | $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:" | ||
930 | $ WRITE SYS$OUTPUT "" | ||
931 | $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information." | ||
932 | $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information." | ||
933 | $ WRITE SYS$OUTPUT "" | ||
934 | $! | ||
935 | $! Time To EXIT. | ||
936 | $! | ||
937 | $ EXIT | ||
938 | $! | ||
939 | $! End The Valid Argument Check. | ||
940 | $! | ||
941 | $ ENDIF | ||
942 | $! | ||
943 | $! End The P2 Check. | ||
944 | $! | ||
945 | $ ENDIF | ||
946 | $! | ||
947 | $! Special Threads For OpenVMS v7.1 Or Later | ||
948 | $! | ||
949 | $! Written By: Richard Levitte | ||
950 | $! richard@levitte.org | ||
951 | $! | ||
952 | $! | ||
953 | $! Check To See If We Have A Option For P5. | ||
954 | $! | ||
955 | $ IF (P5.EQS."") | ||
956 | $ THEN | ||
957 | $! | ||
958 | $! Get The Version Of VMS We Are Using. | ||
959 | $! | ||
960 | $ ISSEVEN := | ||
961 | $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION"))) | ||
962 | $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP)) | ||
963 | $! | ||
964 | $! Check To See If The VMS Version Is v7.1 Or Later. | ||
965 | $! | ||
966 | $ IF (TMP.GE.71) | ||
967 | $ THEN | ||
968 | $! | ||
969 | $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads. | ||
970 | $! | ||
971 | $ ISSEVEN := ,PTHREAD_USE_D4 | ||
972 | $! | ||
973 | $! End The VMS Version Check. | ||
974 | $! | ||
975 | $ ENDIF | ||
976 | $! | ||
977 | $! End The P5 Check. | ||
978 | $! | ||
979 | $ ENDIF | ||
980 | $! | ||
981 | $! Check P7 (POINTER_SIZE). | ||
982 | $! | ||
983 | $ IF (P7 .NES. "") .AND. (ARCH .NES. "VAX") | ||
984 | $ THEN | ||
985 | $! | ||
986 | $ IF (P7 .EQS. "32") | ||
987 | $ THEN | ||
988 | $ POINTER_SIZE = " /POINTER_SIZE=32" | ||
989 | $ ELSE | ||
990 | $ POINTER_SIZE = F$EDIT( P7, "COLLAPSE, UPCASE") | ||
991 | $ IF ((POINTER_SIZE .EQS. "64") .OR. - | ||
992 | (POINTER_SIZE .EQS. "64=") .OR. - | ||
993 | (POINTER_SIZE .EQS. "64=ARGV")) | ||
994 | $ THEN | ||
995 | $ ARCHD = ARCH+ "_64" | ||
996 | $ LIB32 = "" | ||
997 | $ POINTER_SIZE = " /POINTER_SIZE=64" | ||
998 | $ ELSE | ||
999 | $! | ||
1000 | $! Tell The User Entered An Invalid Option. | ||
1001 | $! | ||
1002 | $ WRITE SYS$OUTPUT "" | ||
1003 | $ WRITE SYS$OUTPUT "The Option ", P7, - | ||
1004 | " Is Invalid. The Valid Options Are:" | ||
1005 | $ WRITE SYS$OUTPUT "" | ||
1006 | $ WRITE SYS$OUTPUT - | ||
1007 | " """" : Compile with default (short) pointers." | ||
1008 | $ WRITE SYS$OUTPUT - | ||
1009 | " 32 : Compile with 32-bit (short) pointers." | ||
1010 | $ WRITE SYS$OUTPUT - | ||
1011 | " 64 : Compile with 64-bit (long) pointers (auto ARGV)." | ||
1012 | $ WRITE SYS$OUTPUT - | ||
1013 | " 64= : Compile with 64-bit (long) pointers (no ARGV)." | ||
1014 | $ WRITE SYS$OUTPUT - | ||
1015 | " 64=ARGV : Compile with 64-bit (long) pointers (ARGV)." | ||
1016 | $ WRITE SYS$OUTPUT "" | ||
1017 | $! | ||
1018 | $! Time To EXIT. | ||
1019 | $! | ||
1020 | $ EXIT | ||
1021 | $! | ||
1022 | $ ENDIF | ||
1023 | $! | ||
1024 | $ ENDIF | ||
1025 | $! | ||
1026 | $! End The P7 (POINTER_SIZE) Check. | ||
1027 | $! | ||
1028 | $ ENDIF | ||
1029 | $! | ||
1030 | $! Set basic C compiler /INCLUDE directories. | ||
1031 | $! | ||
1032 | $ CC_INCLUDES = "SYS$DISK:[.''ARCHD'],SYS$DISK:[],SYS$DISK:[-],"+ - | ||
1033 | "SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.MODES],SYS$DISK:[.ASN1],SYS$DISK:[.EVP]" | ||
1034 | $! | ||
1035 | $! Check To See If P3 Is Blank. | ||
1036 | $! | ||
1037 | $ IF (P3.EQS."") | ||
1038 | $ THEN | ||
1039 | $! | ||
1040 | $! O.K., The User Didn't Specify A Compiler, Let's Try To | ||
1041 | $! Find Out Which One To Use. | ||
1042 | $! | ||
1043 | $! Check To See If We Have GNU C. | ||
1044 | $! | ||
1045 | $ IF (F$TRNLNM("GNU_CC").NES."") | ||
1046 | $ THEN | ||
1047 | $! | ||
1048 | $! Looks Like GNUC, Set To Use GNUC. | ||
1049 | $! | ||
1050 | $ P3 = "GNUC" | ||
1051 | $! | ||
1052 | $! Else... | ||
1053 | $! | ||
1054 | $ ELSE | ||
1055 | $! | ||
1056 | $! Check To See If We Have VAXC Or DECC. | ||
1057 | $! | ||
1058 | $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."") | ||
1059 | $ THEN | ||
1060 | $! | ||
1061 | $! Looks Like DECC, Set To Use DECC. | ||
1062 | $! | ||
1063 | $ P3 = "DECC" | ||
1064 | $! | ||
1065 | $! Else... | ||
1066 | $! | ||
1067 | $ ELSE | ||
1068 | $! | ||
1069 | $! Looks Like VAXC, Set To Use VAXC. | ||
1070 | $! | ||
1071 | $ P3 = "VAXC" | ||
1072 | $! | ||
1073 | $! End The VAXC Compiler Check. | ||
1074 | $! | ||
1075 | $ ENDIF | ||
1076 | $! | ||
1077 | $! End The DECC & VAXC Compiler Check. | ||
1078 | $! | ||
1079 | $ ENDIF | ||
1080 | $! | ||
1081 | $! End The Compiler Check. | ||
1082 | $! | ||
1083 | $ ENDIF | ||
1084 | $! | ||
1085 | $! Check To See If We Have A Option For P4. | ||
1086 | $! | ||
1087 | $ IF (P4.EQS."") | ||
1088 | $ THEN | ||
1089 | $! | ||
1090 | $! Find out what socket library we have available | ||
1091 | $! | ||
1092 | $ IF F$PARSE("SOCKETSHR:") .NES. "" | ||
1093 | $ THEN | ||
1094 | $! | ||
1095 | $! We have SOCKETSHR, and it is my opinion that it's the best to use. | ||
1096 | $! | ||
1097 | $ P4 = "SOCKETSHR" | ||
1098 | $! | ||
1099 | $! Tell the user | ||
1100 | $! | ||
1101 | $ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP" | ||
1102 | $! | ||
1103 | $! Else, let's look for something else | ||
1104 | $! | ||
1105 | $ ELSE | ||
1106 | $! | ||
1107 | $! Like UCX (the reason to do this before Multinet is that the UCX | ||
1108 | $! emulation is easier to use...) | ||
1109 | $! | ||
1110 | $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" - | ||
1111 | .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" - | ||
1112 | .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. "" | ||
1113 | $ THEN | ||
1114 | $! | ||
1115 | $! Last resort: a UCX or UCX-compatible library | ||
1116 | $! | ||
1117 | $ P4 = "UCX" | ||
1118 | $! | ||
1119 | $! Tell the user | ||
1120 | $! | ||
1121 | $ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP" | ||
1122 | $! | ||
1123 | $! That was all... | ||
1124 | $! | ||
1125 | $ ENDIF | ||
1126 | $ ENDIF | ||
1127 | $ ENDIF | ||
1128 | $! | ||
1129 | $! Set Up Initial CC Definitions, Possibly With User Ones | ||
1130 | $! | ||
1131 | $ CCDEFS = "TCPIP_TYPE_''P4',DSO_VMS" | ||
1132 | $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS | ||
1133 | $ CCEXTRAFLAGS = "" | ||
1134 | $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS | ||
1135 | $ CCDISABLEWARNINGS = "" !!! "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR" | ||
1136 | $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN - | ||
1137 | CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS | ||
1138 | $! | ||
1139 | $! Check To See If We Have A ZLIB Option. | ||
1140 | $! | ||
1141 | $ ZLIB = P8 | ||
1142 | $ IF (ZLIB .NES. "") | ||
1143 | $ THEN | ||
1144 | $! | ||
1145 | $! Check for expected ZLIB files. | ||
1146 | $! | ||
1147 | $ err = 0 | ||
1148 | $ file1 = f$parse( "zlib.h", ZLIB, , , "SYNTAX_ONLY") | ||
1149 | $ if (f$search( file1) .eqs. "") | ||
1150 | $ then | ||
1151 | $ WRITE SYS$OUTPUT "" | ||
1152 | $ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid." | ||
1153 | $ WRITE SYS$OUTPUT " Can't find header: ''file1'" | ||
1154 | $ err = 1 | ||
1155 | $ endif | ||
1156 | $ file1 = f$parse( "A.;", ZLIB)- "A.;" | ||
1157 | $! | ||
1158 | $ file2 = f$parse( ZLIB, "libz.olb", , , "SYNTAX_ONLY") | ||
1159 | $ if (f$search( file2) .eqs. "") | ||
1160 | $ then | ||
1161 | $ if (err .eq. 0) | ||
1162 | $ then | ||
1163 | $ WRITE SYS$OUTPUT "" | ||
1164 | $ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid." | ||
1165 | $ endif | ||
1166 | $ WRITE SYS$OUTPUT " Can't find library: ''file2'" | ||
1167 | $ WRITE SYS$OUTPUT "" | ||
1168 | $ err = err+ 2 | ||
1169 | $ endif | ||
1170 | $ if (err .eq. 1) | ||
1171 | $ then | ||
1172 | $ WRITE SYS$OUTPUT "" | ||
1173 | $ endif | ||
1174 | $! | ||
1175 | $ if (err .ne. 0) | ||
1176 | $ then | ||
1177 | $ EXIT | ||
1178 | $ endif | ||
1179 | $! | ||
1180 | $ CCDEFS = """ZLIB=1"", "+ CCDEFS | ||
1181 | $ CC_INCLUDES = CC_INCLUDES+ ", "+ file1 | ||
1182 | $ ZLIB_LIB = ", ''file2' /library" | ||
1183 | $! | ||
1184 | $! Print info | ||
1185 | $! | ||
1186 | $ WRITE SYS$OUTPUT "ZLIB library spec: ", file2 | ||
1187 | $! | ||
1188 | $! End The ZLIB Check. | ||
1189 | $! | ||
1190 | $ ENDIF | ||
1191 | $! | ||
1192 | $! Check To See If The User Entered A Valid Parameter. | ||
1193 | $! | ||
1194 | $ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC") | ||
1195 | $ THEN | ||
1196 | $! | ||
1197 | $! Check To See If The User Wanted DECC. | ||
1198 | $! | ||
1199 | $ IF (P3.EQS."DECC") | ||
1200 | $ THEN | ||
1201 | $! | ||
1202 | $! Looks Like DECC, Set To Use DECC. | ||
1203 | $! | ||
1204 | $ COMPILER = "DECC" | ||
1205 | $! | ||
1206 | $! Tell The User We Are Using DECC. | ||
1207 | $! | ||
1208 | $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler." | ||
1209 | $! | ||
1210 | $! Use DECC... | ||
1211 | $! | ||
1212 | $ CC = "CC" | ||
1213 | $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - | ||
1214 | THEN CC = "CC/DECC" | ||
1215 | $ CC = CC + " /''CC_OPTIMIZE' /''DEBUGGER' /STANDARD=RELAXED"+ - | ||
1216 | "''POINTER_SIZE' /NOLIST /PREFIX=ALL" + - | ||
1217 | " /INCLUDE=(''CC_INCLUDES')"+ - | ||
1218 | CCEXTRAFLAGS | ||
1219 | $! | ||
1220 | $! Define The Linker Options File Name. | ||
1221 | $! | ||
1222 | $ OPT_FILE = "VAX_DECC_OPTIONS.OPT" | ||
1223 | $! | ||
1224 | $! End DECC Check. | ||
1225 | $! | ||
1226 | $ ENDIF | ||
1227 | $! | ||
1228 | $! Check To See If We Are To Use VAXC. | ||
1229 | $! | ||
1230 | $ IF (P3.EQS."VAXC") | ||
1231 | $ THEN | ||
1232 | $! | ||
1233 | $! Looks Like VAXC, Set To Use VAXC. | ||
1234 | $! | ||
1235 | $ COMPILER = "VAXC" | ||
1236 | $! | ||
1237 | $! Tell The User We Are Using VAX C. | ||
1238 | $! | ||
1239 | $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler." | ||
1240 | $! | ||
1241 | $! Compile Using VAXC. | ||
1242 | $! | ||
1243 | $ CC = "CC" | ||
1244 | $ IF ARCH.NES."VAX" | ||
1245 | $ THEN | ||
1246 | $ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!" | ||
1247 | $ EXIT | ||
1248 | $ ENDIF | ||
1249 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" | ||
1250 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | ||
1251 | "/INCLUDE=(''CC_INCLUDES')"+ - | ||
1252 | CCEXTRAFLAGS | ||
1253 | $ CCDEFS = """VAXC""," + CCDEFS | ||
1254 | $! | ||
1255 | $! Define <sys> As SYS$COMMON:[SYSLIB] | ||
1256 | $! | ||
1257 | $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB] | ||
1258 | $! | ||
1259 | $! Define The Linker Options File Name. | ||
1260 | $! | ||
1261 | $ OPT_FILE = "VAX_VAXC_OPTIONS.OPT" | ||
1262 | $! | ||
1263 | $! End VAXC Check | ||
1264 | $! | ||
1265 | $ ENDIF | ||
1266 | $! | ||
1267 | $! Check To See If We Are To Use GNU C. | ||
1268 | $! | ||
1269 | $ IF (P3.EQS."GNUC") | ||
1270 | $ THEN | ||
1271 | $! | ||
1272 | $! Looks Like GNUC, Set To Use GNUC. | ||
1273 | $! | ||
1274 | $ COMPILER = "GNUC" | ||
1275 | $! | ||
1276 | $! Tell The User We Are Using GNUC. | ||
1277 | $! | ||
1278 | $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler." | ||
1279 | $! | ||
1280 | $! Use GNU C... | ||
1281 | $! | ||
1282 | $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | ||
1283 | "/INCLUDE=(''CC_INCLUDES')"+ - | ||
1284 | CCEXTRAFLAGS | ||
1285 | $! | ||
1286 | $! Define The Linker Options File Name. | ||
1287 | $! | ||
1288 | $ OPT_FILE = "VAX_GNUC_OPTIONS.OPT" | ||
1289 | $! | ||
1290 | $! End The GNU C Check. | ||
1291 | $! | ||
1292 | $ ENDIF | ||
1293 | $! | ||
1294 | $! Set up default defines | ||
1295 | $! | ||
1296 | $ CCDEFS = """FLAT_INC=1""," + CCDEFS | ||
1297 | $! | ||
1298 | $! Finish up the definition of CC. | ||
1299 | $! | ||
1300 | $ IF COMPILER .EQS. "DECC" | ||
1301 | $ THEN | ||
1302 | $ IF CCDISABLEWARNINGS .EQS. "" | ||
1303 | $ THEN | ||
1304 | $ CC4DISABLEWARNINGS = "DOLLARID" | ||
1305 | $ CC6DISABLEWARNINGS = "MIXLINKAGE" | ||
1306 | $ ELSE | ||
1307 | $ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID" | ||
1308 | $ CC6DISABLEWARNINGS = CCDISABLEWARNINGS + ",MIXLINKAGE" | ||
1309 | $ CCDISABLEWARNINGS = " /WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))" | ||
1310 | $ ENDIF | ||
1311 | $ CC4DISABLEWARNINGS = " /WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))" | ||
1312 | $ CC6DISABLEWARNINGS = " /WARNING=(DISABLE=(" + CC6DISABLEWARNINGS + "))" | ||
1313 | $ ELSE | ||
1314 | $ CCDISABLEWARNINGS = "" | ||
1315 | $ CC4DISABLEWARNINGS = "" | ||
1316 | $ CC6DISABLEWARNINGS = "" | ||
1317 | $ ENDIF | ||
1318 | $ CC3 = CC + " /DEFINE=(" + CCDEFS + ISSEVEN + ")" + CCDISABLEWARNINGS | ||
1319 | $ CC = CC + " /DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS | ||
1320 | $ IF ARCH .EQS. "VAX" .AND. COMPILER .EQS. "DECC" .AND. P2 .NES. "DEBUG" | ||
1321 | $ THEN | ||
1322 | $ CC5 = CC + " /OPTIMIZE=NODISJOINT" | ||
1323 | $ CC5_DIFFERENT = 1 | ||
1324 | $ ELSE | ||
1325 | $ CC5 = CC | ||
1326 | $ CC5_DIFFERENT = 0 | ||
1327 | $ ENDIF | ||
1328 | $ CC4 = CC - CCDISABLEWARNINGS + CC4DISABLEWARNINGS | ||
1329 | $ CC6 = CC - CCDISABLEWARNINGS + CC6DISABLEWARNINGS | ||
1330 | $! | ||
1331 | $! Show user the result | ||
1332 | $! | ||
1333 | $ WRITE/SYMBOL SYS$OUTPUT "Main C Compiling Command: ",CC | ||
1334 | $! | ||
1335 | $! Else The User Entered An Invalid Argument. | ||
1336 | $! | ||
1337 | $ ELSE | ||
1338 | $! | ||
1339 | $! Tell The User We Don't Know What They Want. | ||
1340 | $! | ||
1341 | $ WRITE SYS$OUTPUT "" | ||
1342 | $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:" | ||
1343 | $ WRITE SYS$OUTPUT "" | ||
1344 | $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C." | ||
1345 | $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C." | ||
1346 | $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C." | ||
1347 | $ WRITE SYS$OUTPUT "" | ||
1348 | $! | ||
1349 | $! Time To EXIT. | ||
1350 | $! | ||
1351 | $ EXIT | ||
1352 | $! | ||
1353 | $! End The Valid Argument Check. | ||
1354 | $! | ||
1355 | $ ENDIF | ||
1356 | $! | ||
1357 | $! Build a MACRO command for the architecture at hand | ||
1358 | $! | ||
1359 | $ IF ARCH .EQS. "VAX" THEN MACRO = "MACRO/''DEBUGGER'" | ||
1360 | $ IF ARCH .NES. "VAX" THEN MACRO = "MACRO/MIGRATION/''DEBUGGER'/''MACRO_OPTIMIZE'" | ||
1361 | $! | ||
1362 | $! Show user the result | ||
1363 | $! | ||
1364 | $ WRITE/SYMBOL SYS$OUTPUT "Main MACRO Compiling Command: ",MACRO | ||
1365 | $! | ||
1366 | $! Time to check the contents, and to make sure we get the correct library. | ||
1367 | $! | ||
1368 | $ IF P4.EQS."SOCKETSHR" .OR. P4.EQS."MULTINET" .OR. P4.EQS."UCX" - | ||
1369 | .OR. P4.EQS."TCPIP" .OR. P4.EQS."NONE" | ||
1370 | $ THEN | ||
1371 | $! | ||
1372 | $! Check to see if SOCKETSHR was chosen | ||
1373 | $! | ||
1374 | $ IF P4.EQS."SOCKETSHR" | ||
1375 | $ THEN | ||
1376 | $! | ||
1377 | $! Set the library to use SOCKETSHR | ||
1378 | $! | ||
1379 | $ TCPIP_LIB = ",SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT /OPTIONS" | ||
1380 | $! | ||
1381 | $! Done with SOCKETSHR | ||
1382 | $! | ||
1383 | $ ENDIF | ||
1384 | $! | ||
1385 | $! Check to see if MULTINET was chosen | ||
1386 | $! | ||
1387 | $ IF P4.EQS."MULTINET" | ||
1388 | $ THEN | ||
1389 | $! | ||
1390 | $! Set the library to use UCX emulation. | ||
1391 | $! | ||
1392 | $ P4 = "UCX" | ||
1393 | $! | ||
1394 | $! Done with MULTINET | ||
1395 | $! | ||
1396 | $ ENDIF | ||
1397 | $! | ||
1398 | $! Check to see if UCX was chosen | ||
1399 | $! | ||
1400 | $ IF P4.EQS."UCX" | ||
1401 | $ THEN | ||
1402 | $! | ||
1403 | $! Set the library to use UCX. | ||
1404 | $! | ||
1405 | $ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT /OPTIONS" | ||
1406 | $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" | ||
1407 | $ THEN | ||
1408 | $ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT /OPTIONS" | ||
1409 | $ ELSE | ||
1410 | $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN - | ||
1411 | TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT /OPTIONS" | ||
1412 | $ ENDIF | ||
1413 | $! | ||
1414 | $! Done with UCX | ||
1415 | $! | ||
1416 | $ ENDIF | ||
1417 | $! | ||
1418 | $! Check to see if TCPIP was chosen | ||
1419 | $! | ||
1420 | $ IF P4.EQS."TCPIP" | ||
1421 | $ THEN | ||
1422 | $! | ||
1423 | $! Set the library to use TCPIP (post UCX). | ||
1424 | $! | ||
1425 | $ TCPIP_LIB = ",SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT /OPTIONS" | ||
1426 | $! | ||
1427 | $! Done with TCPIP | ||
1428 | $! | ||
1429 | $ ENDIF | ||
1430 | $! | ||
1431 | $! Check to see if NONE was chosen | ||
1432 | $! | ||
1433 | $ IF P4.EQS."NONE" | ||
1434 | $ THEN | ||
1435 | $! | ||
1436 | $! Do not use a TCPIP library. | ||
1437 | $! | ||
1438 | $ TCPIP_LIB = "" | ||
1439 | $! | ||
1440 | $! Done with TCPIP | ||
1441 | $! | ||
1442 | $ ENDIF | ||
1443 | $! | ||
1444 | $! Print info | ||
1445 | $! | ||
1446 | $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB- "," | ||
1447 | $! | ||
1448 | $! Else The User Entered An Invalid Argument. | ||
1449 | $! | ||
1450 | $ ELSE | ||
1451 | $! | ||
1452 | $! Tell The User We Don't Know What They Want. | ||
1453 | $! | ||
1454 | $ WRITE SYS$OUTPUT "" | ||
1455 | $ WRITE SYS$OUTPUT "The Option ",P4," Is Invalid. The Valid Options Are:" | ||
1456 | $ WRITE SYS$OUTPUT "" | ||
1457 | $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library." | ||
1458 | $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library." | ||
1459 | $ WRITE SYS$OUTPUT " TCPIP : To link with TCPIP (post UCX) TCP/IP library." | ||
1460 | $ WRITE SYS$OUTPUT "" | ||
1461 | $! | ||
1462 | $! Time To EXIT. | ||
1463 | $! | ||
1464 | $ EXIT | ||
1465 | $! | ||
1466 | $! Done with TCP/IP libraries | ||
1467 | $! | ||
1468 | $ ENDIF | ||
1469 | $! | ||
1470 | $! Check if the user wanted to compile just a subset of all the encryption | ||
1471 | $! methods. | ||
1472 | $! | ||
1473 | $ IF P6 .NES. "" | ||
1474 | $ THEN | ||
1475 | $ ENCRYPT_TYPES = P6 | ||
1476 | $ ENDIF | ||
1477 | $! | ||
1478 | $! Time To RETURN... | ||
1479 | $! | ||
1480 | $ RETURN | ||
1481 | $! | ||
1482 | $ INITIALISE: | ||
1483 | $! | ||
1484 | $! Save old value of the logical name OPENSSL | ||
1485 | $! | ||
1486 | $ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE") | ||
1487 | $! | ||
1488 | $! Save directory information | ||
1489 | $! | ||
1490 | $ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;" | ||
1491 | $ __HERE = F$EDIT(__HERE,"UPCASE") | ||
1492 | $ __TOP = __HERE - "CRYPTO]" | ||
1493 | $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]" | ||
1494 | $! | ||
1495 | $! Set up the logical name OPENSSL to point at the include directory | ||
1496 | $! | ||
1497 | $ DEFINE OPENSSL/NOLOG '__INCLUDE' | ||
1498 | $! | ||
1499 | $! Done | ||
1500 | $! | ||
1501 | $ RETURN | ||
1502 | $! | ||
1503 | $ CLEANUP: | ||
1504 | $! | ||
1505 | $! Restore the logical name OPENSSL if it had a value | ||
1506 | $! | ||
1507 | $ IF __SAVE_OPENSSL .EQS. "" | ||
1508 | $ THEN | ||
1509 | $ DEASSIGN OPENSSL | ||
1510 | $ ELSE | ||
1511 | $ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL' | ||
1512 | $ ENDIF | ||
1513 | $! | ||
1514 | $! Done | ||
1515 | $! | ||
1516 | $ RETURN | ||
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h index 6aeda0a9ac..f92fc5182d 100644 --- a/src/lib/libcrypto/crypto.h +++ b/src/lib/libcrypto/crypto.h | |||
@@ -488,10 +488,10 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), | |||
488 | long (**go)(void)); | 488 | long (**go)(void)); |
489 | 489 | ||
490 | void *CRYPTO_malloc_locked(int num, const char *file, int line); | 490 | void *CRYPTO_malloc_locked(int num, const char *file, int line); |
491 | void CRYPTO_free_locked(void *); | 491 | void CRYPTO_free_locked(void *ptr); |
492 | void *CRYPTO_malloc(int num, const char *file, int line); | 492 | void *CRYPTO_malloc(int num, const char *file, int line); |
493 | char *CRYPTO_strdup(const char *str, const char *file, int line); | 493 | char *CRYPTO_strdup(const char *str, const char *file, int line); |
494 | void CRYPTO_free(void *); | 494 | void CRYPTO_free(void *ptr); |
495 | void *CRYPTO_realloc(void *addr,int num, const char *file, int line); | 495 | void *CRYPTO_realloc(void *addr,int num, const char *file, int line); |
496 | void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, | 496 | void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, |
497 | int line); | 497 | int line); |
@@ -574,6 +574,13 @@ void OPENSSL_init(void); | |||
574 | #define fips_cipher_abort(alg) while(0) | 574 | #define fips_cipher_abort(alg) while(0) |
575 | #endif | 575 | #endif |
576 | 576 | ||
577 | /* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It | ||
578 | * takes an amount of time dependent on |len|, but independent of the contents | ||
579 | * of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a | ||
580 | * defined order as the return value when a != b is undefined, other than to be | ||
581 | * non-zero. */ | ||
582 | int CRYPTO_memcmp(const void *a, const void *b, size_t len); | ||
583 | |||
577 | /* BEGIN ERROR CODES */ | 584 | /* BEGIN ERROR CODES */ |
578 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 585 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
579 | * made after this point may be overwritten when the script is next run. | 586 | * made after this point may be overwritten when the script is next run. |
diff --git a/src/lib/libcrypto/des/des-lib.com b/src/lib/libcrypto/des/des-lib.com deleted file mode 100644 index 348f1c0470..0000000000 --- a/src/lib/libcrypto/des/des-lib.com +++ /dev/null | |||
@@ -1,1005 +0,0 @@ | |||
1 | $! | ||
2 | $! DES-LIB.COM | ||
3 | $! Written By: Robert Byer | ||
4 | $! Vice-President | ||
5 | $! A-Com Computing, Inc. | ||
6 | $! byer@mail.all-net.net | ||
7 | $! | ||
8 | $! Changes by Richard Levitte <richard@levitte.org> | ||
9 | $! | ||
10 | $! This command files compiles and creates the | ||
11 | $! "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" library. The "xxx" denotes the machine | ||
12 | $! architecture of ALPHA, IA64 or VAX. | ||
13 | $! | ||
14 | $! It was re-written to try to determine which "C" compiler to try to use | ||
15 | $! or the user can specify a compiler in P3. | ||
16 | $! | ||
17 | $! Specify one of the following to build just that part, specify "ALL" to | ||
18 | $! just build everything. | ||
19 | $! | ||
20 | $! ALL To Just Build "Everything". | ||
21 | $! LIBRARY To Just Build The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library. | ||
22 | $! DESTEST To Just Build The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program. | ||
23 | $! SPEED To Just Build The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program. | ||
24 | $! RPW To Just Build The [.xxx.EXE.CRYPTO.DES]RPW.EXE Program. | ||
25 | $! DES To Just Build The [.xxx.EXE.CRYPTO.DES]DES.EXE Program. | ||
26 | $! DES_OPTS To Just Build The [.xxx.EXE.CRYPTO.DES]DES_OPTS.EXE Program. | ||
27 | $! | ||
28 | $! Specify either DEBUG or NODEBUG as P2 to compile with or without | ||
29 | $! debugging information. | ||
30 | $! | ||
31 | $! Specify which compiler at P3 to try to compile under. | ||
32 | $! | ||
33 | $! VAXC For VAX C. | ||
34 | $! DECC For DEC C. | ||
35 | $! GNUC For GNU C. | ||
36 | $! | ||
37 | $! If you don't speficy a compiler, it will try to determine which | ||
38 | $! "C" compiler to try to use. | ||
39 | $! | ||
40 | $! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up) | ||
41 | $! | ||
42 | $! | ||
43 | $! Make sure we know what architecture we run on. | ||
44 | $! | ||
45 | $! | ||
46 | $! Check Which Architecture We Are Using. | ||
47 | $! | ||
48 | $ IF (F$GETSYI("CPU").LT.128) | ||
49 | $ THEN | ||
50 | $! | ||
51 | $! The Architecture Is VAX | ||
52 | $! | ||
53 | $ ARCH := VAX | ||
54 | $! | ||
55 | $! Else... | ||
56 | $! | ||
57 | $ ELSE | ||
58 | $! | ||
59 | $! The Architecture Is Alpha, IA64 or whatever comes in the future. | ||
60 | $! | ||
61 | $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE") | ||
62 | $ IF (ARCH .EQS. "") THEN ARCH = "UNK" | ||
63 | $! | ||
64 | $! End The Architecture Check. | ||
65 | $! | ||
66 | $ ENDIF | ||
67 | $! | ||
68 | $! Define The OBJ Directory Name. | ||
69 | $! | ||
70 | $ OBJ_DIR := SYS$DISK:[--.'ARCH'.OBJ.CRYPTO.DES] | ||
71 | $! | ||
72 | $! Define The EXE Directory Name. | ||
73 | $! | ||
74 | $ EXE_DIR :== SYS$DISK:[--.'ARCH'.EXE.CRYPTO.DES] | ||
75 | $! | ||
76 | $! Check To Make Sure We Have Valid Command Line Parameters. | ||
77 | $! | ||
78 | $ GOSUB CHECK_OPTIONS | ||
79 | $! | ||
80 | $! Tell The User What Kind of Machine We Run On. | ||
81 | $! | ||
82 | $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine." | ||
83 | $! | ||
84 | $! Check To See If The Architecture Specific OBJ Directory Exists. | ||
85 | $! | ||
86 | $ IF (F$PARSE(OBJ_DIR).EQS."") | ||
87 | $ THEN | ||
88 | $! | ||
89 | $! It Dosen't Exist, So Create It. | ||
90 | $! | ||
91 | $ CREATE/DIR 'OBJ_DIR' | ||
92 | $! | ||
93 | $! End The Architecture Specific OBJ Directory Check. | ||
94 | $! | ||
95 | $ ENDIF | ||
96 | $! | ||
97 | $! Check To See If The Architecture Specific Directory Exists. | ||
98 | $! | ||
99 | $ IF (F$PARSE(EXE_DIR).EQS."") | ||
100 | $ THEN | ||
101 | $! | ||
102 | $! It Dosen't Exist, So Create It. | ||
103 | $! | ||
104 | $ CREATE/DIR 'EXE_DIR' | ||
105 | $! | ||
106 | $! End The Architecture Specific Directory Check. | ||
107 | $! | ||
108 | $ ENDIF | ||
109 | $! | ||
110 | $! Define The Library Name. | ||
111 | $! | ||
112 | $ LIB_NAME := 'EXE_DIR'LIBDES.OLB | ||
113 | $! | ||
114 | $! Check To See What We Are To Do. | ||
115 | $! | ||
116 | $ IF (BUILDALL.EQS."TRUE") | ||
117 | $ THEN | ||
118 | $! | ||
119 | $! Since Nothing Special Was Specified, Do Everything. | ||
120 | $! | ||
121 | $ GOSUB LIBRARY | ||
122 | $ GOSUB DESTEST | ||
123 | $ GOSUB SPEED | ||
124 | $ GOSUB RPW | ||
125 | $ GOSUB DES | ||
126 | $ GOSUB DES_OPTS | ||
127 | $! | ||
128 | $! Else... | ||
129 | $! | ||
130 | $ ELSE | ||
131 | $! | ||
132 | $! Build Just What The User Wants Us To Build. | ||
133 | $! | ||
134 | $ GOSUB 'BUILDALL' | ||
135 | $! | ||
136 | $! End The BUILDALL Check. | ||
137 | $! | ||
138 | $ ENDIF | ||
139 | $! | ||
140 | $! Time To EXIT. | ||
141 | $! | ||
142 | $ EXIT | ||
143 | $ LIBRARY: | ||
144 | $! | ||
145 | $! Tell The User That We Are Compiling. | ||
146 | $! | ||
147 | $ WRITE SYS$OUTPUT "Compiling The ",LIB_NAME," Files." | ||
148 | $! | ||
149 | $! Check To See If We Already Have A "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" Library... | ||
150 | $! | ||
151 | $ IF (F$SEARCH(LIB_NAME).EQS."") | ||
152 | $ THEN | ||
153 | $! | ||
154 | $! Guess Not, Create The Library. | ||
155 | $! | ||
156 | $ LIBRARY/CREATE/OBJECT 'LIB_NAME' | ||
157 | $! | ||
158 | $! End The Library Exist Check. | ||
159 | $! | ||
160 | $ ENDIF | ||
161 | $! | ||
162 | $! Define The DES Library Files. | ||
163 | $! | ||
164 | $ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ - | ||
165 | "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ - | ||
166 | "enc_read,enc_writ,ofb64enc,"+ - | ||
167 | "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ - | ||
168 | "des_enc,fcrypt_b,read2pwd,"+ - | ||
169 | "fcrypt,xcbc_enc,read_pwd,rpc_enc,cbc_cksm,supp" | ||
170 | $! | ||
171 | $! Define A File Counter And Set It To "0". | ||
172 | $! | ||
173 | $ FILE_COUNTER = 0 | ||
174 | $! | ||
175 | $! Top Of The File Loop. | ||
176 | $! | ||
177 | $ NEXT_FILE: | ||
178 | $! | ||
179 | $! O.K, Extract The File Name From The File List. | ||
180 | $! | ||
181 | $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",LIB_DES) | ||
182 | $! | ||
183 | $! Check To See If We Are At The End Of The File List. | ||
184 | $! | ||
185 | $ IF (FILE_NAME.EQS.",") THEN GOTO FILE_DONE | ||
186 | $! | ||
187 | $! Increment The Counter. | ||
188 | $! | ||
189 | $ FILE_COUNTER = FILE_COUNTER + 1 | ||
190 | $! | ||
191 | $! Create The Source File Name. | ||
192 | $! | ||
193 | $ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME + ".C" | ||
194 | $! | ||
195 | $! Tell The User We Are Compiling The Source File. | ||
196 | $! | ||
197 | $ WRITE SYS$OUTPUT " ",FILE_NAME,".C" | ||
198 | $! | ||
199 | $! Create The Object File Name. | ||
200 | $! | ||
201 | $ OBJECT_FILE = OBJ_DIR + FILE_NAME + "." + ARCH + "OBJ" | ||
202 | $ ON WARNING THEN GOTO NEXT_FILE | ||
203 | $! | ||
204 | $! Check To See If The File We Want To Compile Actually Exists. | ||
205 | $! | ||
206 | $ IF (F$SEARCH(SOURCE_FILE).EQS."") | ||
207 | $ THEN | ||
208 | $! | ||
209 | $! Tell The User That The File Dosen't Exist. | ||
210 | $! | ||
211 | $ WRITE SYS$OUTPUT "" | ||
212 | $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist." | ||
213 | $ WRITE SYS$OUTPUT "" | ||
214 | $! | ||
215 | $! Exit The Build. | ||
216 | $! | ||
217 | $ EXIT | ||
218 | $! | ||
219 | $! End The File Exists Check. | ||
220 | $! | ||
221 | $ ENDIF | ||
222 | $! | ||
223 | $! Compile The File. | ||
224 | $! | ||
225 | $ ON ERROR THEN GOTO NEXT_FILE | ||
226 | $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
227 | $! | ||
228 | $! Add It To The Library. | ||
229 | $! | ||
230 | $ LIBRARY/REPLACE/OBJECT 'LIB_NAME' 'OBJECT_FILE' | ||
231 | $! | ||
232 | $! Time To Clean Up The Object File. | ||
233 | $! | ||
234 | $ DELETE 'OBJECT_FILE';* | ||
235 | $! | ||
236 | $! Go Back And Do It Again. | ||
237 | $! | ||
238 | $ GOTO NEXT_FILE | ||
239 | $! | ||
240 | $! All Done With This Library Part. | ||
241 | $! | ||
242 | $ FILE_DONE: | ||
243 | $! | ||
244 | $! Tell The User That We Are All Done. | ||
245 | $! | ||
246 | $ WRITE SYS$OUTPUT "Library ",LIB_NAME," Built." | ||
247 | $! | ||
248 | $! All Done, Time To Return. | ||
249 | $! | ||
250 | $ RETURN | ||
251 | $! | ||
252 | $! Compile The DESTEST Program. | ||
253 | $! | ||
254 | $ DESTEST: | ||
255 | $! | ||
256 | $! Check To See If We Have The Proper Libraries. | ||
257 | $! | ||
258 | $ GOSUB LIB_CHECK | ||
259 | $! | ||
260 | $! Check To See If We Have A Linker Option File. | ||
261 | $! | ||
262 | $ GOSUB CHECK_OPT_FILE | ||
263 | $! | ||
264 | $! Check To See If The File We Want To Compile Actually Exists. | ||
265 | $! | ||
266 | $ IF (F$SEARCH("SYS$DISK:[]DESTEST.C").EQS."") | ||
267 | $ THEN | ||
268 | $! | ||
269 | $! Tell The User That The File Dosen't Exist. | ||
270 | $! | ||
271 | $ WRITE SYS$OUTPUT "" | ||
272 | $ WRITE SYS$OUTPUT "The File DESTEST.C Dosen't Exist." | ||
273 | $ WRITE SYS$OUTPUT "" | ||
274 | $! | ||
275 | $! Exit The Build. | ||
276 | $! | ||
277 | $ EXIT | ||
278 | $! | ||
279 | $! End The DESTEST.C File Check. | ||
280 | $! | ||
281 | $ ENDIF | ||
282 | $! | ||
283 | $! Tell The User What We Are Building. | ||
284 | $! | ||
285 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DESTEST.EXE" | ||
286 | $! | ||
287 | $! Compile The DESTEST Program. | ||
288 | $! | ||
289 | $ CC/OBJECT='OBJ_DIR'DESTEST.OBJ SYS$DISK:[]DESTEST.C | ||
290 | $! | ||
291 | $! Link The DESTEST Program. | ||
292 | $! | ||
293 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DESTEST.EXE - | ||
294 | 'OBJ_DIR'DESTEST.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
295 | $! | ||
296 | $! All Done, Time To Return. | ||
297 | $! | ||
298 | $ RETURN | ||
299 | $! | ||
300 | $! Compile The SPEED Program. | ||
301 | $! | ||
302 | $ SPEED: | ||
303 | $! | ||
304 | $! Check To See If We Have The Proper Libraries. | ||
305 | $! | ||
306 | $ GOSUB LIB_CHECK | ||
307 | $! | ||
308 | $! Check To See If We Have A Linker Option File. | ||
309 | $! | ||
310 | $ GOSUB CHECK_OPT_FILE | ||
311 | $! | ||
312 | $! Check To See If The File We Want To Compile Actually Exists. | ||
313 | $! | ||
314 | $ IF (F$SEARCH("SYS$DISK:[]SPEED.C").EQS."") | ||
315 | $ THEN | ||
316 | $! | ||
317 | $! Tell The User That The File Dosen't Exist. | ||
318 | $! | ||
319 | $ WRITE SYS$OUTPUT "" | ||
320 | $ WRITE SYS$OUTPUT "The File SPEED.C Dosen't Exist." | ||
321 | $ WRITE SYS$OUTPUT "" | ||
322 | $! | ||
323 | $! Exit The Build. | ||
324 | $! | ||
325 | $ EXIT | ||
326 | $! | ||
327 | $! End The SPEED.C File Check. | ||
328 | $! | ||
329 | $ ENDIF | ||
330 | $! | ||
331 | $! Tell The User What We Are Building. | ||
332 | $! | ||
333 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"SPEED.EXE" | ||
334 | $! | ||
335 | $! Compile The SPEED Program. | ||
336 | $! | ||
337 | $ CC/OBJECT='OBJ_DIR'SPEED.OBJ SYS$DISK:[]SPEED.C | ||
338 | $! | ||
339 | $! Link The SPEED Program. | ||
340 | $! | ||
341 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'SPEED.EXE - | ||
342 | 'OBJ_DIR'SPEED.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
343 | $! | ||
344 | $! All Done, Time To Return. | ||
345 | $! | ||
346 | $ RETURN | ||
347 | $! | ||
348 | $! Compile The RPW Program. | ||
349 | $! | ||
350 | $ RPW: | ||
351 | $! | ||
352 | $! Check To See If We Have The Proper Libraries. | ||
353 | $! | ||
354 | $ GOSUB LIB_CHECK | ||
355 | $! | ||
356 | $! Check To See If We Have A Linker Option File. | ||
357 | $! | ||
358 | $ GOSUB CHECK_OPT_FILE | ||
359 | $! | ||
360 | $! Check To See If The File We Want To Compile Actually Exists. | ||
361 | $! | ||
362 | $ IF (F$SEARCH("SYS$DISK:[]RPW.C").EQS."") | ||
363 | $ THEN | ||
364 | $! | ||
365 | $! Tell The User That The File Dosen't Exist. | ||
366 | $! | ||
367 | $ WRITE SYS$OUTPUT "" | ||
368 | $ WRITE SYS$OUTPUT "The File RPW.C Dosen't Exist." | ||
369 | $ WRITE SYS$OUTPUT "" | ||
370 | $! | ||
371 | $! Exit The Build. | ||
372 | $! | ||
373 | $ EXIT | ||
374 | $! | ||
375 | $! End The RPW.C File Check. | ||
376 | $! | ||
377 | $ ENDIF | ||
378 | $! | ||
379 | $! Tell The User What We Are Building. | ||
380 | $! | ||
381 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"RPW.EXE" | ||
382 | $! | ||
383 | $! Compile The RPW Program. | ||
384 | $! | ||
385 | $ CC/OBJECT='OBJ_DIR'RPW.OBJ SYS$DISK:[]RPW.C | ||
386 | $! | ||
387 | $! Link The RPW Program. | ||
388 | $! | ||
389 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'RPW.EXE - | ||
390 | 'OBJ_DIR'RPW.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
391 | $! | ||
392 | $! All Done, Time To Return. | ||
393 | $! | ||
394 | $ RETURN | ||
395 | $! | ||
396 | $! Compile The DES Program. | ||
397 | $! | ||
398 | $ DES: | ||
399 | $! | ||
400 | $! Check To See If We Have The Proper Libraries. | ||
401 | $! | ||
402 | $ GOSUB LIB_CHECK | ||
403 | $! | ||
404 | $! Check To See If We Have A Linker Option File. | ||
405 | $! | ||
406 | $ GOSUB CHECK_OPT_FILE | ||
407 | $! | ||
408 | $! Check To See If The File We Want To Compile Actually Exists. | ||
409 | $! | ||
410 | $ IF (F$SEARCH("SYS$DISK:[]DES.C").EQS."") | ||
411 | $ THEN | ||
412 | $! | ||
413 | $! Tell The User That The File Dosen't Exist. | ||
414 | $! | ||
415 | $ WRITE SYS$OUTPUT "" | ||
416 | $ WRITE SYS$OUTPUT "The File DES.C Dosen't Exist." | ||
417 | $ WRITE SYS$OUTPUT "" | ||
418 | $! | ||
419 | $! Exit The Build. | ||
420 | $! | ||
421 | $ EXIT | ||
422 | $! | ||
423 | $! End The DES.C File Check. | ||
424 | $! | ||
425 | $ ENDIF | ||
426 | $! | ||
427 | $! Tell The User What We Are Building. | ||
428 | $! | ||
429 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES.EXE" | ||
430 | $! | ||
431 | $! Compile The DES Program. | ||
432 | $! | ||
433 | $ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]DES.C | ||
434 | $ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]CBC3_ENC.C | ||
435 | $! | ||
436 | $! Link The DES Program. | ||
437 | $! | ||
438 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES.EXE - | ||
439 | 'OBJ_DIR'DES.OBJ,'OBJ_DIR'CBC3_ENC.OBJ,- | ||
440 | 'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
441 | $! | ||
442 | $! All Done, Time To Return. | ||
443 | $! | ||
444 | $ RETURN | ||
445 | $! | ||
446 | $! Compile The DES_OPTS Program. | ||
447 | $! | ||
448 | $ DES_OPTS: | ||
449 | $! | ||
450 | $! Check To See If We Have The Proper Libraries. | ||
451 | $! | ||
452 | $ GOSUB LIB_CHECK | ||
453 | $! | ||
454 | $! Check To See If We Have A Linker Option File. | ||
455 | $! | ||
456 | $ GOSUB CHECK_OPT_FILE | ||
457 | $! | ||
458 | $! Check To See If The File We Want To Compile Actually Exists. | ||
459 | $! | ||
460 | $ IF (F$SEARCH("SYS$DISK:[]DES_OPTS.C").EQS."") | ||
461 | $ THEN | ||
462 | $! | ||
463 | $! Tell The User That The File Dosen't Exist. | ||
464 | $! | ||
465 | $ WRITE SYS$OUTPUT "" | ||
466 | $ WRITE SYS$OUTPUT "The File DES_OPTS.C Dosen't Exist." | ||
467 | $ WRITE SYS$OUTPUT "" | ||
468 | $! | ||
469 | $! Exit The Build. | ||
470 | $! | ||
471 | $ EXIT | ||
472 | $! | ||
473 | $! End The DES_OPTS.C File Check. | ||
474 | $! | ||
475 | $ ENDIF | ||
476 | $! | ||
477 | $! Tell The User What We Are Building. | ||
478 | $! | ||
479 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES_OPTS.EXE" | ||
480 | $! | ||
481 | $! Compile The DES_OPTS Program. | ||
482 | $! | ||
483 | $ CC/OBJECT='OBJ_DIR'DES_OPTS.OBJ SYS$DISK:[]DES_OPTS.C | ||
484 | $! | ||
485 | $! Link The DES_OPTS Program. | ||
486 | $! | ||
487 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES_OPTS.EXE - | ||
488 | 'OBJ_DIR'DES_OPTS.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
489 | $! | ||
490 | $! All Done, Time To Return. | ||
491 | $! | ||
492 | $ RETURN | ||
493 | $ EXIT | ||
494 | $! | ||
495 | $! Check For The Link Option FIle. | ||
496 | $! | ||
497 | $ CHECK_OPT_FILE: | ||
498 | $! | ||
499 | $! Check To See If We Need To Make A VAX C Option File. | ||
500 | $! | ||
501 | $ IF (COMPILER.EQS."VAXC") | ||
502 | $ THEN | ||
503 | $! | ||
504 | $! Check To See If We Already Have A VAX C Linker Option File. | ||
505 | $! | ||
506 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
507 | $ THEN | ||
508 | $! | ||
509 | $! We Need A VAX C Linker Option File. | ||
510 | $! | ||
511 | $ CREATE 'OPT_FILE' | ||
512 | $DECK | ||
513 | ! | ||
514 | ! Default System Options File To Link Agianst | ||
515 | ! The Sharable VAX C Runtime Library. | ||
516 | ! | ||
517 | SYS$SHARE:VAXCRTL.EXE/SHARE | ||
518 | $EOD | ||
519 | $! | ||
520 | $! End The Option File Check. | ||
521 | $! | ||
522 | $ ENDIF | ||
523 | $! | ||
524 | $! End The VAXC Check. | ||
525 | $! | ||
526 | $ ENDIF | ||
527 | $! | ||
528 | $! Check To See If We Need A GNU C Option File. | ||
529 | $! | ||
530 | $ IF (COMPILER.EQS."GNUC") | ||
531 | $ THEN | ||
532 | $! | ||
533 | $! Check To See If We Already Have A GNU C Linker Option File. | ||
534 | $! | ||
535 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
536 | $ THEN | ||
537 | $! | ||
538 | $! We Need A GNU C Linker Option File. | ||
539 | $! | ||
540 | $ CREATE 'OPT_FILE' | ||
541 | $DECK | ||
542 | ! | ||
543 | ! Default System Options File To Link Agianst | ||
544 | ! The Sharable C Runtime Library. | ||
545 | ! | ||
546 | GNU_CC:[000000]GCCLIB/LIBRARY | ||
547 | SYS$SHARE:VAXCRTL/SHARE | ||
548 | $EOD | ||
549 | $! | ||
550 | $! End The Option File Check. | ||
551 | $! | ||
552 | $ ENDIF | ||
553 | $! | ||
554 | $! End The GNU C Check. | ||
555 | $! | ||
556 | $ ENDIF | ||
557 | $! | ||
558 | $! Check To See If We Need A DEC C Option File. | ||
559 | $! | ||
560 | $ IF (COMPILER.EQS."DECC") | ||
561 | $ THEN | ||
562 | $! | ||
563 | $! Check To See If We Already Have A DEC C Linker Option File. | ||
564 | $! | ||
565 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
566 | $ THEN | ||
567 | $! | ||
568 | $! Figure Out If We Need An non-VAX Or A VAX Linker Option File. | ||
569 | $! | ||
570 | $ IF (F$GETSYI("CPU").LT.128) | ||
571 | $ THEN | ||
572 | $! | ||
573 | $! We Need A DEC C Linker Option File For VAX. | ||
574 | $! | ||
575 | $ CREATE 'OPT_FILE' | ||
576 | $DECK | ||
577 | ! | ||
578 | ! Default System Options File To Link Agianst | ||
579 | ! The Sharable DEC C Runtime Library. | ||
580 | ! | ||
581 | SYS$SHARE:DECC$SHR.EXE/SHARE | ||
582 | $EOD | ||
583 | $! | ||
584 | $! Else... | ||
585 | $! | ||
586 | $ ELSE | ||
587 | $! | ||
588 | $! Create The non-VAX Linker Option File. | ||
589 | $! | ||
590 | $ CREATE 'OPT_FILE' | ||
591 | $DECK | ||
592 | ! | ||
593 | ! Default System Options File For non-VAX To Link Agianst | ||
594 | ! The Sharable C Runtime Library. | ||
595 | ! | ||
596 | SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE | ||
597 | SYS$SHARE:CMA$OPEN_RTL/SHARE | ||
598 | $EOD | ||
599 | $! | ||
600 | $! End The DEC C Option File Check. | ||
601 | $! | ||
602 | $ ENDIF | ||
603 | $! | ||
604 | $! End The Option File Search. | ||
605 | $! | ||
606 | $ ENDIF | ||
607 | $! | ||
608 | $! End The DEC C Check. | ||
609 | $! | ||
610 | $ ENDIF | ||
611 | $! | ||
612 | $! Tell The User What Linker Option File We Are Using. | ||
613 | $! | ||
614 | $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"." | ||
615 | $! | ||
616 | $! Time To RETURN. | ||
617 | $! | ||
618 | $ RETURN | ||
619 | $! | ||
620 | $! Library Check. | ||
621 | $! | ||
622 | $ LIB_CHECK: | ||
623 | $! | ||
624 | $! Look For The Library LIBDES.OLB. | ||
625 | $! | ||
626 | $ IF (F$SEARCH(LIB_NAME).EQS."") | ||
627 | $ THEN | ||
628 | $! | ||
629 | $! Tell The User We Can't Find The [.xxx.CRYPTO.DES]LIBDES.OLB Library. | ||
630 | $! | ||
631 | $ WRITE SYS$OUTPUT "" | ||
632 | $ WRITE SYS$OUTPUT "Can't Find The Library ",LIB_NAME,"." | ||
633 | $ WRITE SYS$OUTPUT "We Can't Link Without It." | ||
634 | $ WRITE SYS$OUTPUT "" | ||
635 | $! | ||
636 | $! Since We Can't Link Without It, Exit. | ||
637 | $! | ||
638 | $ EXIT | ||
639 | $ ENDIF | ||
640 | $! | ||
641 | $! Time To Return. | ||
642 | $! | ||
643 | $ RETURN | ||
644 | $! | ||
645 | $! Check The User's Options. | ||
646 | $! | ||
647 | $ CHECK_OPTIONS: | ||
648 | $! | ||
649 | $! Check To See If We Are To "Just Build Everything". | ||
650 | $! | ||
651 | $ IF (P1.EQS."ALL") | ||
652 | $ THEN | ||
653 | $! | ||
654 | $! P1 Is "ALL", So Build Everything. | ||
655 | $! | ||
656 | $ BUILDALL = "TRUE" | ||
657 | $! | ||
658 | $! Else... | ||
659 | $! | ||
660 | $ ELSE | ||
661 | $! | ||
662 | $! Else, Check To See If P1 Has A Valid Argument. | ||
663 | $! | ||
664 | $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."DESTEST").OR.(P1.EQS."SPEED") - | ||
665 | .OR.(P1.EQS."RPW").OR.(P1.EQS."DES").OR.(P1.EQS."DES_OPTS") | ||
666 | $ THEN | ||
667 | $! | ||
668 | $! A Valid Argument. | ||
669 | $! | ||
670 | $ BUILDALL = P1 | ||
671 | $! | ||
672 | $! Else... | ||
673 | $! | ||
674 | $ ELSE | ||
675 | $! | ||
676 | $! Tell The User We Don't Know What They Want. | ||
677 | $! | ||
678 | $ WRITE SYS$OUTPUT "" | ||
679 | $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" | ||
680 | $ WRITE SYS$OUTPUT "" | ||
681 | $ WRITE SYS$OUTPUT " ALL : Just Build Everything." | ||
682 | $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library." | ||
683 | $ WRITE SYS$OUTPUT " DESTEST : To Compile Just The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program." | ||
684 | $ WRITE SYS$OUTPUT " SPEED : To Compile Just The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program." | ||
685 | $ WRITE SYS$OUTPUT " RPW : To Compile Just The [.xxx.EXE.CRYPTO.DES]RPW.EXE Program." | ||
686 | $ WRITE SYS$OUTPUT " DES : To Compile Just The [.xxx.EXE.CRYPTO.DES]DES.EXE Program." | ||
687 | $ WRITE SYS$OUTPUT " DES_OPTS : To Compile Just The [.xxx.EXE.CRYTPO.DES]DES_OPTS.EXE Program." | ||
688 | $ WRITE SYS$OUTPUT "" | ||
689 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For: " | ||
690 | $ WRITE SYS$OUTPUT "" | ||
691 | $ WRITE SYS$OUTPUT " ALPHA : Alpha Architecture." | ||
692 | $ WRITE SYS$OUTPUT " IA64 : IA64 Architecture." | ||
693 | $ WRITE SYS$OUTPUT " VAX : VAX Architecture." | ||
694 | $ WRITE SYS$OUTPUT "" | ||
695 | $! | ||
696 | $! Time To EXIT. | ||
697 | $! | ||
698 | $ EXIT | ||
699 | $! | ||
700 | $! End The Valid Argument Check. | ||
701 | $! | ||
702 | $ ENDIF | ||
703 | $! | ||
704 | $! End The P1 Check. | ||
705 | $! | ||
706 | $ ENDIF | ||
707 | $! | ||
708 | $! Check To See If We Are To Compile Without Debugger Information. | ||
709 | $! | ||
710 | $ IF (P2.EQS."NODEBUG") | ||
711 | $ THEN | ||
712 | $! | ||
713 | $! P2 Is Blank, So Compile Without Debugger Information. | ||
714 | $! | ||
715 | $ DEBUGGER = "NODEBUG" | ||
716 | $ TRACEBACK = "NOTRACEBACK" | ||
717 | $ GCC_OPTIMIZE = "OPTIMIZE" | ||
718 | $ CC_OPTIMIZE = "OPTIMIZE" | ||
719 | $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile." | ||
720 | $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization." | ||
721 | $! | ||
722 | $! Else... | ||
723 | $! | ||
724 | $ ELSE | ||
725 | $! | ||
726 | $! Check To See If We Are To Compile With Debugger Information. | ||
727 | $! | ||
728 | $ IF (P2.EQS."DEBUG") | ||
729 | $ THEN | ||
730 | $! | ||
731 | $! Compile With Debugger Information. | ||
732 | $! | ||
733 | $ DEBUGGER = "DEBUG" | ||
734 | $ TRACEBACK = "TRACEBACK" | ||
735 | $ GCC_OPTIMIZE = "NOOPTIMIZE" | ||
736 | $ CC_OPTIMIZE = "NOOPTIMIZE" | ||
737 | $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile." | ||
738 | $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization." | ||
739 | $! | ||
740 | $! Else... | ||
741 | $! | ||
742 | $ ELSE | ||
743 | $! | ||
744 | $! Tell The User Entered An Invalid Option.. | ||
745 | $! | ||
746 | $ WRITE SYS$OUTPUT "" | ||
747 | $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:" | ||
748 | $ WRITE SYS$OUTPUT "" | ||
749 | $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information." | ||
750 | $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information." | ||
751 | $ WRITE SYS$OUTPUT "" | ||
752 | $! | ||
753 | $! Time To EXIT. | ||
754 | $! | ||
755 | $ EXIT | ||
756 | $! | ||
757 | $! End The Valid Argument Check. | ||
758 | $! | ||
759 | $ ENDIF | ||
760 | $! | ||
761 | $! End The P2 Check. | ||
762 | $! | ||
763 | $ ENDIF | ||
764 | $! | ||
765 | $! Special Threads For OpenVMS v7.1 Or Later. | ||
766 | $! | ||
767 | $! Written By: Richard Levitte | ||
768 | $! richard@levitte.org | ||
769 | $! | ||
770 | $! | ||
771 | $! Check To See If We Have A Option For P4. | ||
772 | $! | ||
773 | $ IF (P4.EQS."") | ||
774 | $ THEN | ||
775 | $! | ||
776 | $! Get The Version Of VMS We Are Using. | ||
777 | $! | ||
778 | $ ISSEVEN := "" | ||
779 | $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION"))) | ||
780 | $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP)) | ||
781 | $! | ||
782 | $! Check To See If The VMS Version Is v7.1 Or Later. | ||
783 | $! | ||
784 | $ IF (TMP.GE.71) | ||
785 | $ THEN | ||
786 | $! | ||
787 | $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads. | ||
788 | $! | ||
789 | $ ISSEVEN := ,PTHREAD_USE_D4 | ||
790 | $! | ||
791 | $! End The VMS Version Check. | ||
792 | $! | ||
793 | $ ENDIF | ||
794 | $! | ||
795 | $! End The P4 Check. | ||
796 | $! | ||
797 | $ ENDIF | ||
798 | $! | ||
799 | $! Check To See If P3 Is Blank. | ||
800 | $! | ||
801 | $ IF (P3.EQS."") | ||
802 | $ THEN | ||
803 | $! | ||
804 | $! O.K., The User Didn't Specify A Compiler, Let's Try To | ||
805 | $! Find Out Which One To Use. | ||
806 | $! | ||
807 | $! Check To See If We Have GNU C. | ||
808 | $! | ||
809 | $ IF (F$TRNLNM("GNU_CC").NES."") | ||
810 | $ THEN | ||
811 | $! | ||
812 | $! Looks Like GNUC, Set To Use GNUC. | ||
813 | $! | ||
814 | $ P3 = "GNUC" | ||
815 | $! | ||
816 | $! Else... | ||
817 | $! | ||
818 | $ ELSE | ||
819 | $! | ||
820 | $! Check To See If We Have VAXC Or DECC. | ||
821 | $! | ||
822 | $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."") | ||
823 | $ THEN | ||
824 | $! | ||
825 | $! Looks Like DECC, Set To Use DECC. | ||
826 | $! | ||
827 | $ P3 = "DECC" | ||
828 | $! | ||
829 | $! Else... | ||
830 | $! | ||
831 | $ ELSE | ||
832 | $! | ||
833 | $! Looks Like VAXC, Set To Use VAXC. | ||
834 | $! | ||
835 | $ P3 = "VAXC" | ||
836 | $! | ||
837 | $! End The VAXC Compiler Check. | ||
838 | $! | ||
839 | $ ENDIF | ||
840 | $! | ||
841 | $! End The DECC & VAXC Compiler Check. | ||
842 | $! | ||
843 | $ ENDIF | ||
844 | $! | ||
845 | $! End The Compiler Check. | ||
846 | $! | ||
847 | $ ENDIF | ||
848 | $! | ||
849 | $! Set Up Initial CC Definitions, Possibly With User Ones | ||
850 | $! | ||
851 | $ CCDEFS = "" | ||
852 | $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = USER_CCDEFS | ||
853 | $ CCEXTRAFLAGS = "" | ||
854 | $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS | ||
855 | $ CCDISABLEWARNINGS = "" | ||
856 | $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN - | ||
857 | CCDISABLEWARNINGS = USER_CCDISABLEWARNINGS | ||
858 | $! | ||
859 | $! Check To See If The User Entered A Valid Paramter. | ||
860 | $! | ||
861 | $ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC") | ||
862 | $ THEN | ||
863 | $! | ||
864 | $! Check To See If The User Wanted DECC. | ||
865 | $! | ||
866 | $ IF (P3.EQS."DECC") | ||
867 | $ THEN | ||
868 | $! | ||
869 | $! Looks Like DECC, Set To Use DECC. | ||
870 | $! | ||
871 | $ COMPILER = "DECC" | ||
872 | $! | ||
873 | $! Tell The User We Are Using DECC. | ||
874 | $! | ||
875 | $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler." | ||
876 | $! | ||
877 | $! Use DECC... | ||
878 | $! | ||
879 | $ CC = "CC" | ||
880 | $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - | ||
881 | THEN CC = "CC/DECC" | ||
882 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - | ||
883 | "/NOLIST/PREFIX=ALL" + CCEXTRAFLAGS | ||
884 | $! | ||
885 | $! Define The Linker Options File Name. | ||
886 | $! | ||
887 | $ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT" | ||
888 | $! | ||
889 | $! End DECC Check. | ||
890 | $! | ||
891 | $ ENDIF | ||
892 | $! | ||
893 | $! Check To See If We Are To Use VAXC. | ||
894 | $! | ||
895 | $ IF (P3.EQS."VAXC") | ||
896 | $ THEN | ||
897 | $! | ||
898 | $! Looks Like VAXC, Set To Use VAXC. | ||
899 | $! | ||
900 | $ COMPILER = "VAXC" | ||
901 | $! | ||
902 | $! Tell The User We Are Using VAX C. | ||
903 | $! | ||
904 | $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler." | ||
905 | $! | ||
906 | $! Compile Using VAXC. | ||
907 | $! | ||
908 | $ CC = "CC" | ||
909 | $ IF ARCH.NES."VAX" | ||
910 | $ THEN | ||
911 | $ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!" | ||
912 | $ EXIT | ||
913 | $ ENDIF | ||
914 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" | ||
915 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS | ||
916 | $ CCDEFS = """VAXC""," + CCDEFS | ||
917 | $! | ||
918 | $! Define <sys> As SYS$COMMON:[SYSLIB] | ||
919 | $! | ||
920 | $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB] | ||
921 | $! | ||
922 | $! Define The Linker Options File Name. | ||
923 | $! | ||
924 | $ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT" | ||
925 | $! | ||
926 | $! End VAXC Check | ||
927 | $! | ||
928 | $ ENDIF | ||
929 | $! | ||
930 | $! Check To See If We Are To Use GNU C. | ||
931 | $! | ||
932 | $ IF (P3.EQS."GNUC") | ||
933 | $ THEN | ||
934 | $! | ||
935 | $! Looks Like GNUC, Set To Use GNUC. | ||
936 | $! | ||
937 | $ COMPILER = "GNUC" | ||
938 | $! | ||
939 | $! Tell The User We Are Using GNUC. | ||
940 | $! | ||
941 | $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler." | ||
942 | $! | ||
943 | $! Use GNU C... | ||
944 | $! | ||
945 | $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS | ||
946 | $! | ||
947 | $! Define The Linker Options File Name. | ||
948 | $! | ||
949 | $ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT" | ||
950 | $! | ||
951 | $! End The GNU C Check. | ||
952 | $! | ||
953 | $ ENDIF | ||
954 | $! | ||
955 | $! Set up default defines | ||
956 | $! | ||
957 | $ CCDEFS = """FLAT_INC=1""," + CCDEFS | ||
958 | $! | ||
959 | $! Finish up the definition of CC. | ||
960 | $! | ||
961 | $ IF COMPILER .EQS. "DECC" | ||
962 | $ THEN | ||
963 | $ IF CCDISABLEWARNINGS .EQS. "" | ||
964 | $ THEN | ||
965 | $ CC4DISABLEWARNINGS = "DOLLARID" | ||
966 | $ ELSE | ||
967 | $ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID" | ||
968 | $ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))" | ||
969 | $ ENDIF | ||
970 | $ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))" | ||
971 | $ ELSE | ||
972 | $ CCDISABLEWARNINGS = "" | ||
973 | $ CC4DISABLEWARNINGS = "" | ||
974 | $ ENDIF | ||
975 | $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS | ||
976 | $! | ||
977 | $! Show user the result | ||
978 | $! | ||
979 | $ WRITE SYS$OUTPUT "Main Compiling Command: ",CC | ||
980 | $! | ||
981 | $! Else The User Entered An Invalid Argument. | ||
982 | $! | ||
983 | $ ELSE | ||
984 | $! | ||
985 | $! Tell The User We Don't Know What They Want. | ||
986 | $! | ||
987 | $ WRITE SYS$OUTPUT "" | ||
988 | $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:" | ||
989 | $ WRITE SYS$OUTPUT "" | ||
990 | $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C." | ||
991 | $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C." | ||
992 | $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C." | ||
993 | $ WRITE SYS$OUTPUT "" | ||
994 | $! | ||
995 | $! Time To EXIT. | ||
996 | $! | ||
997 | $ EXIT | ||
998 | $! | ||
999 | $! End The P3 Check. | ||
1000 | $! | ||
1001 | $ ENDIF | ||
1002 | $! | ||
1003 | $! Time To RETURN... | ||
1004 | $! | ||
1005 | $ RETURN | ||
diff --git a/src/lib/libcrypto/des/des.h b/src/lib/libcrypto/des/des.h index 23c8cfc901..1eaedcbd24 100644 --- a/src/lib/libcrypto/des/des.h +++ b/src/lib/libcrypto/des/des.h | |||
@@ -56,8 +56,8 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef HEADER_DES_H | 59 | #ifndef HEADER_NEW_DES_H |
60 | #define HEADER_DES_H | 60 | #define HEADER_NEW_DES_H |
61 | 61 | ||
62 | #include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, | 62 | #include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, |
63 | DES_LONG (via openssl/opensslconf.h */ | 63 | DES_LONG (via openssl/opensslconf.h */ |
@@ -71,8 +71,6 @@ | |||
71 | # define OPENSSL_EXTERN OPENSSL_EXPORT | 71 | # define OPENSSL_EXTERN OPENSSL_EXPORT |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | #define des_SPtrans DES_SPtrans | ||
75 | |||
76 | #ifdef __cplusplus | 74 | #ifdef __cplusplus |
77 | extern "C" { | 75 | extern "C" { |
78 | #endif | 76 | #endif |
diff --git a/src/lib/libcrypto/des/des_old.h b/src/lib/libcrypto/des/des_old.h index 8665ba4e7e..2b2c372354 100644 --- a/src/lib/libcrypto/des/des_old.h +++ b/src/lib/libcrypto/des/des_old.h | |||
@@ -88,8 +88,8 @@ | |||
88 | * | 88 | * |
89 | */ | 89 | */ |
90 | 90 | ||
91 | #ifndef HEADER_DES_OLD_H | 91 | #ifndef HEADER_DES_H |
92 | #define HEADER_DES_OLD_H | 92 | #define HEADER_DES_H |
93 | 93 | ||
94 | #include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ | 94 | #include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ |
95 | 95 | ||
@@ -97,7 +97,7 @@ | |||
97 | #error DES is disabled. | 97 | #error DES is disabled. |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | #ifndef HEADER_DES_H | 100 | #ifndef HEADER_NEW_DES_H |
101 | #error You must include des.h, not des_old.h directly. | 101 | #error You must include des.h, not des_old.h directly. |
102 | #endif | 102 | #endif |
103 | 103 | ||
diff --git a/src/lib/libcrypto/des/set_key.c b/src/lib/libcrypto/des/set_key.c index d3e69ca8b5..da4d62e112 100644 --- a/src/lib/libcrypto/des/set_key.c +++ b/src/lib/libcrypto/des/set_key.c | |||
@@ -63,9 +63,8 @@ | |||
63 | * 1.1 added norm_expand_bits | 63 | * 1.1 added norm_expand_bits |
64 | * 1.0 First working version | 64 | * 1.0 First working version |
65 | */ | 65 | */ |
66 | #include "des_locl.h" | ||
67 | |||
68 | #include <openssl/crypto.h> | 66 | #include <openssl/crypto.h> |
67 | #include "des_locl.h" | ||
69 | 68 | ||
70 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */ | 69 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */ |
71 | 70 | ||
diff --git a/src/lib/libcrypto/des/str2key.c b/src/lib/libcrypto/des/str2key.c index 9c2054bda6..1077f99d1b 100644 --- a/src/lib/libcrypto/des/str2key.c +++ b/src/lib/libcrypto/des/str2key.c | |||
@@ -56,8 +56,8 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include "des_locl.h" | ||
60 | #include <openssl/crypto.h> | 59 | #include <openssl/crypto.h> |
60 | #include "des_locl.h" | ||
61 | 61 | ||
62 | void DES_string_to_key(const char *str, DES_cblock *key) | 62 | void DES_string_to_key(const char *str, DES_cblock *key) |
63 | { | 63 | { |
diff --git a/src/lib/libcrypto/doc/ERR_get_error.pod b/src/lib/libcrypto/doc/ERR_get_error.pod index 34443045fc..828ecf529b 100644 --- a/src/lib/libcrypto/doc/ERR_get_error.pod +++ b/src/lib/libcrypto/doc/ERR_get_error.pod | |||
@@ -52,8 +52,11 @@ ERR_get_error_line_data(), ERR_peek_error_line_data() and | |||
52 | ERR_get_last_error_line_data() store additional data and flags | 52 | ERR_get_last_error_line_data() store additional data and flags |
53 | associated with the error code in *B<data> | 53 | associated with the error code in *B<data> |
54 | and *B<flags>, unless these are B<NULL>. *B<data> contains a string | 54 | and *B<flags>, unless these are B<NULL>. *B<data> contains a string |
55 | if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by OPENSSL_malloc(), | 55 | if *B<flags>&B<ERR_TXT_STRING> is true. |
56 | *B<flags>&B<ERR_TXT_MALLOCED> is true. | 56 | |
57 | An application B<MUST NOT> free the *B<data> pointer (or any other pointers | ||
58 | returned by these functions) with OPENSSL_free() as freeing is handled | ||
59 | automatically by the error library. | ||
57 | 60 | ||
58 | =head1 RETURN VALUES | 61 | =head1 RETURN VALUES |
59 | 62 | ||
diff --git a/src/lib/libcrypto/doc/EVP_BytesToKey.pod b/src/lib/libcrypto/doc/EVP_BytesToKey.pod index d375c46e03..0ea7d55c0f 100644 --- a/src/lib/libcrypto/doc/EVP_BytesToKey.pod +++ b/src/lib/libcrypto/doc/EVP_BytesToKey.pod | |||
@@ -17,7 +17,7 @@ EVP_BytesToKey - password based encryption routine | |||
17 | 17 | ||
18 | EVP_BytesToKey() derives a key and IV from various parameters. B<type> is | 18 | EVP_BytesToKey() derives a key and IV from various parameters. B<type> is |
19 | the cipher to derive the key and IV for. B<md> is the message digest to use. | 19 | the cipher to derive the key and IV for. B<md> is the message digest to use. |
20 | The B<salt> paramter is used as a salt in the derivation: it should point to | 20 | The B<salt> parameter is used as a salt in the derivation: it should point to |
21 | an 8 byte buffer or NULL if no salt is used. B<data> is a buffer containing | 21 | an 8 byte buffer or NULL if no salt is used. B<data> is a buffer containing |
22 | B<datal> bytes which is used to derive the keying data. B<count> is the | 22 | B<datal> bytes which is used to derive the keying data. B<count> is the |
23 | iteration count to use. The derived key and IV will be written to B<key> | 23 | iteration count to use. The derived key and IV will be written to B<key> |
diff --git a/src/lib/libcrypto/doc/EVP_DigestInit.pod b/src/lib/libcrypto/doc/EVP_DigestInit.pod index 1aa15acb61..367691cc7a 100644 --- a/src/lib/libcrypto/doc/EVP_DigestInit.pod +++ b/src/lib/libcrypto/doc/EVP_DigestInit.pod | |||
@@ -252,9 +252,9 @@ digest name passed on the command line. | |||
252 | 252 | ||
253 | =head1 SEE ALSO | 253 | =head1 SEE ALSO |
254 | 254 | ||
255 | L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>, | 255 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, |
256 | L<MD5(3)|MD5(3)>, L<MDC2(3)|MDC2(3)>, L<RIPEMD160(3)|RIPEMD160(3)>, | 256 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, |
257 | L<SHA1(3)|SHA1(3)> | 257 | L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> |
258 | 258 | ||
259 | =head1 HISTORY | 259 | =head1 HISTORY |
260 | 260 | ||
diff --git a/src/lib/libcrypto/doc/EVP_EncryptInit.pod b/src/lib/libcrypto/doc/EVP_EncryptInit.pod index 8271d3dfc4..1c4bf184a1 100644 --- a/src/lib/libcrypto/doc/EVP_EncryptInit.pod +++ b/src/lib/libcrypto/doc/EVP_EncryptInit.pod | |||
@@ -152,7 +152,7 @@ does not remain in memory. | |||
152 | 152 | ||
153 | EVP_EncryptInit(), EVP_DecryptInit() and EVP_CipherInit() behave in a | 153 | EVP_EncryptInit(), EVP_DecryptInit() and EVP_CipherInit() behave in a |
154 | similar way to EVP_EncryptInit_ex(), EVP_DecryptInit_ex and | 154 | similar way to EVP_EncryptInit_ex(), EVP_DecryptInit_ex and |
155 | EVP_CipherInit_ex() except the B<ctx> paramter does not need to be | 155 | EVP_CipherInit_ex() except the B<ctx> parameter does not need to be |
156 | initialized and they always use the default cipher implementation. | 156 | initialized and they always use the default cipher implementation. |
157 | 157 | ||
158 | EVP_EncryptFinal(), EVP_DecryptFinal() and EVP_CipherFinal() behave in a | 158 | EVP_EncryptFinal(), EVP_DecryptFinal() and EVP_CipherFinal() behave in a |
diff --git a/src/lib/libcrypto/doc/EVP_SignInit.pod b/src/lib/libcrypto/doc/EVP_SignInit.pod index 781d43e401..620a623ab6 100644 --- a/src/lib/libcrypto/doc/EVP_SignInit.pod +++ b/src/lib/libcrypto/doc/EVP_SignInit.pod | |||
@@ -89,10 +89,10 @@ The previous two bugs are fixed in the newer EVP_SignDigest*() function. | |||
89 | =head1 SEE ALSO | 89 | =head1 SEE ALSO |
90 | 90 | ||
91 | L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, | 91 | L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, |
92 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, | 92 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, |
93 | L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>, | 93 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, |
94 | L<MD5(3)|MD5(3)>, L<MDC2(3)|MDC2(3)>, L<RIPEMD(3)|RIPEMD(3)>, | 94 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, |
95 | L<SHA1(3)|SHA1(3)>, L<digest(1)|digest(1)> | 95 | L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> |
96 | 96 | ||
97 | =head1 HISTORY | 97 | =head1 HISTORY |
98 | 98 | ||
diff --git a/src/lib/libcrypto/doc/dsa.pod b/src/lib/libcrypto/doc/dsa.pod index ae2e5d81f9..da07d2b930 100644 --- a/src/lib/libcrypto/doc/dsa.pod +++ b/src/lib/libcrypto/doc/dsa.pod | |||
@@ -101,7 +101,8 @@ Standard, DSS), ANSI X9.30 | |||
101 | =head1 SEE ALSO | 101 | =head1 SEE ALSO |
102 | 102 | ||
103 | L<bn(3)|bn(3)>, L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, | 103 | L<bn(3)|bn(3)>, L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, |
104 | L<rsa(3)|rsa(3)>, L<SHA1(3)|SHA1(3)>, L<DSA_new(3)|DSA_new(3)>, | 104 | L<rsa(3)|rsa(3)>, L<sha(3)|sha(3)>, L<engine(3)|engine(3)>, |
105 | L<DSA_new(3)|DSA_new(3)>, | ||
105 | L<DSA_size(3)|DSA_size(3)>, | 106 | L<DSA_size(3)|DSA_size(3)>, |
106 | L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>, | 107 | L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>, |
107 | L<DSA_dup_DH(3)|DSA_dup_DH(3)>, | 108 | L<DSA_dup_DH(3)|DSA_dup_DH(3)>, |
diff --git a/src/lib/libcrypto/dso/dso_dlfcn.c b/src/lib/libcrypto/dso/dso_dlfcn.c index e21b9f6dbc..5f351b318d 100644 --- a/src/lib/libcrypto/dso/dso_dlfcn.c +++ b/src/lib/libcrypto/dso/dso_dlfcn.c | |||
@@ -86,7 +86,7 @@ DSO_METHOD *DSO_METHOD_dlfcn(void) | |||
86 | # if defined(_AIX) || defined(__CYGWIN__) || \ | 86 | # if defined(_AIX) || defined(__CYGWIN__) || \ |
87 | defined(__SCO_VERSION__) || defined(_SCO_ELF) || \ | 87 | defined(__SCO_VERSION__) || defined(_SCO_ELF) || \ |
88 | (defined(__osf__) && !defined(RTLD_NEXT)) || \ | 88 | (defined(__osf__) && !defined(RTLD_NEXT)) || \ |
89 | (defined(__OpenBSD__) && (!defined(__ELF__) || !defined(RTLD_SELF))) || \ | 89 | (defined(__OpenBSD__) && !defined(RTLD_SELF)) || \ |
90 | defined(__ANDROID__) | 90 | defined(__ANDROID__) |
91 | # undef HAVE_DLINFO | 91 | # undef HAVE_DLINFO |
92 | # endif | 92 | # endif |
diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h index 9d01325af3..dfe8710d33 100644 --- a/src/lib/libcrypto/ec/ec.h +++ b/src/lib/libcrypto/ec/ec.h | |||
@@ -274,10 +274,10 @@ int EC_GROUP_get_curve_name(const EC_GROUP *group); | |||
274 | void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); | 274 | void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); |
275 | int EC_GROUP_get_asn1_flag(const EC_GROUP *group); | 275 | int EC_GROUP_get_asn1_flag(const EC_GROUP *group); |
276 | 276 | ||
277 | void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t); | 277 | void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form); |
278 | point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); | 278 | point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); |
279 | 279 | ||
280 | unsigned char *EC_GROUP_get0_seed(const EC_GROUP *); | 280 | unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); |
281 | size_t EC_GROUP_get_seed_len(const EC_GROUP *); | 281 | size_t EC_GROUP_get_seed_len(const EC_GROUP *); |
282 | size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); | 282 | size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); |
283 | 283 | ||
@@ -626,8 +626,8 @@ int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *c | |||
626 | */ | 626 | */ |
627 | int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); | 627 | int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); |
628 | 628 | ||
629 | int EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *); | 629 | int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); |
630 | int EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *); | 630 | int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx); |
631 | 631 | ||
632 | /** Computes r = generator * n sum_{i=0}^num p[i] * m[i] | 632 | /** Computes r = generator * n sum_{i=0}^num p[i] * m[i] |
633 | * \param group underlying EC_GROUP object | 633 | * \param group underlying EC_GROUP object |
@@ -800,16 +800,24 @@ const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); | |||
800 | int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); | 800 | int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); |
801 | 801 | ||
802 | unsigned EC_KEY_get_enc_flags(const EC_KEY *key); | 802 | unsigned EC_KEY_get_enc_flags(const EC_KEY *key); |
803 | void EC_KEY_set_enc_flags(EC_KEY *, unsigned int); | 803 | void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); |
804 | point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *); | 804 | point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); |
805 | void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t); | 805 | void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); |
806 | /* functions to set/get method specific data */ | 806 | /* functions to set/get method specific data */ |
807 | void *EC_KEY_get_key_method_data(EC_KEY *, | 807 | void *EC_KEY_get_key_method_data(EC_KEY *key, |
808 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); | 808 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); |
809 | void EC_KEY_insert_key_method_data(EC_KEY *, void *data, | 809 | /** Sets the key method data of an EC_KEY object, if none has yet been set. |
810 | * \param key EC_KEY object | ||
811 | * \param data opaque data to install. | ||
812 | * \param dup_func a function that duplicates |data|. | ||
813 | * \param free_func a function that frees |data|. | ||
814 | * \param clear_free_func a function that wipes and frees |data|. | ||
815 | * \return the previously set data pointer, or NULL if |data| was inserted. | ||
816 | */ | ||
817 | void *EC_KEY_insert_key_method_data(EC_KEY *key, void *data, | ||
810 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); | 818 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); |
811 | /* wrapper functions for the underlying EC_GROUP object */ | 819 | /* wrapper functions for the underlying EC_GROUP object */ |
812 | void EC_KEY_set_asn1_flag(EC_KEY *, int); | 820 | void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); |
813 | 821 | ||
814 | /** Creates a table of pre-computed multiples of the generator to | 822 | /** Creates a table of pre-computed multiples of the generator to |
815 | * accelerate further EC_KEY operations. | 823 | * accelerate further EC_KEY operations. |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 25247b5803..de9a0cc2b3 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
@@ -480,10 +480,10 @@ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx) | |||
480 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) != | 480 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) != |
481 | EC_METHOD_get_field_type(EC_GROUP_method_of(b))) | 481 | EC_METHOD_get_field_type(EC_GROUP_method_of(b))) |
482 | return 1; | 482 | return 1; |
483 | /* compare the curve name (if present) */ | 483 | /* compare the curve name (if present in both) */ |
484 | if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) && | 484 | if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) && |
485 | EC_GROUP_get_curve_name(a) == EC_GROUP_get_curve_name(b)) | 485 | EC_GROUP_get_curve_name(a) != EC_GROUP_get_curve_name(b)) |
486 | return 0; | 486 | return 1; |
487 | 487 | ||
488 | if (!ctx) | 488 | if (!ctx) |
489 | ctx_new = ctx = BN_CTX_new(); | 489 | ctx_new = ctx = BN_CTX_new(); |
@@ -993,12 +993,12 @@ int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN | |||
993 | if (group->meth->point_cmp == 0) | 993 | if (group->meth->point_cmp == 0) |
994 | { | 994 | { |
995 | ECerr(EC_F_EC_POINT_CMP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 995 | ECerr(EC_F_EC_POINT_CMP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
996 | return 0; | 996 | return -1; |
997 | } | 997 | } |
998 | if ((group->meth != a->meth) || (a->meth != b->meth)) | 998 | if ((group->meth != a->meth) || (a->meth != b->meth)) |
999 | { | 999 | { |
1000 | ECerr(EC_F_EC_POINT_CMP, EC_R_INCOMPATIBLE_OBJECTS); | 1000 | ECerr(EC_F_EC_POINT_CMP, EC_R_INCOMPATIBLE_OBJECTS); |
1001 | return 0; | 1001 | return -1; |
1002 | } | 1002 | } |
1003 | return group->meth->point_cmp(group, a, b, ctx); | 1003 | return group->meth->point_cmp(group, a, b, ctx); |
1004 | } | 1004 | } |
diff --git a/src/lib/libcrypto/ec/ecp_mont.c b/src/lib/libcrypto/ec/ecp_mont.c index 079e47431b..f04f132c7a 100644 --- a/src/lib/libcrypto/ec/ecp_mont.c +++ b/src/lib/libcrypto/ec/ecp_mont.c | |||
@@ -114,7 +114,6 @@ const EC_METHOD *EC_GFp_mont_method(void) | |||
114 | ec_GFp_mont_field_decode, | 114 | ec_GFp_mont_field_decode, |
115 | ec_GFp_mont_field_set_to_one }; | 115 | ec_GFp_mont_field_set_to_one }; |
116 | 116 | ||
117 | |||
118 | return &ret; | 117 | return &ret; |
119 | #endif | 118 | #endif |
120 | } | 119 | } |
diff --git a/src/lib/libcrypto/ec/ectest.c b/src/lib/libcrypto/ec/ectest.c index f107782de0..102eaa9b23 100644 --- a/src/lib/libcrypto/ec/ectest.c +++ b/src/lib/libcrypto/ec/ectest.c | |||
@@ -236,7 +236,7 @@ static void group_order_tests(EC_GROUP *group) | |||
236 | } | 236 | } |
237 | 237 | ||
238 | static void prime_field_tests(void) | 238 | static void prime_field_tests(void) |
239 | { | 239 | { |
240 | BN_CTX *ctx = NULL; | 240 | BN_CTX *ctx = NULL; |
241 | BIGNUM *p, *a, *b; | 241 | BIGNUM *p, *a, *b; |
242 | EC_GROUP *group; | 242 | EC_GROUP *group; |
diff --git a/src/lib/libcrypto/ecdh/Makefile b/src/lib/libcrypto/ecdh/Makefile index 65d8904ee8..ba05fea05c 100644 --- a/src/lib/libcrypto/ecdh/Makefile +++ b/src/lib/libcrypto/ecdh/Makefile | |||
@@ -84,17 +84,12 @@ ech_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | |||
84 | ech_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 84 | ech_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
85 | ech_err.o: ech_err.c | 85 | ech_err.o: ech_err.c |
86 | ech_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 86 | ech_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
87 | ech_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 87 | ech_key.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
88 | ech_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 88 | ech_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
89 | ech_key.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 89 | ech_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
90 | ech_key.o: ../../include/openssl/engine.h ../../include/openssl/evp.h | 90 | ech_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
91 | ech_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 91 | ech_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
92 | ech_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 92 | ech_key.o: ech_key.c ech_locl.h |
93 | ech_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
94 | ech_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
95 | ech_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
96 | ech_key.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
97 | ech_key.o: ../../include/openssl/x509_vfy.h ech_key.c ech_locl.h | ||
98 | ech_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 93 | ech_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
99 | ech_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 94 | ech_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
100 | ech_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 95 | ech_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
diff --git a/src/lib/libcrypto/engine/eng_all.c b/src/lib/libcrypto/engine/eng_all.c index 0ae5d672b1..6093376df4 100644 --- a/src/lib/libcrypto/engine/eng_all.c +++ b/src/lib/libcrypto/engine/eng_all.c | |||
@@ -73,7 +73,6 @@ void ENGINE_load_builtin_engines(void) | |||
73 | #if !defined(OPENSSL_NO_HW) && (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)) | 73 | #if !defined(OPENSSL_NO_HW) && (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)) |
74 | ENGINE_load_cryptodev(); | 74 | ENGINE_load_cryptodev(); |
75 | #endif | 75 | #endif |
76 | |||
77 | #ifndef OPENSSL_NO_RSAX | 76 | #ifndef OPENSSL_NO_RSAX |
78 | ENGINE_load_rsax(); | 77 | ENGINE_load_rsax(); |
79 | #endif | 78 | #endif |
diff --git a/src/lib/libcrypto/engine/eng_list.c b/src/lib/libcrypto/engine/eng_list.c index 27846edb1e..95c858960b 100644 --- a/src/lib/libcrypto/engine/eng_list.c +++ b/src/lib/libcrypto/engine/eng_list.c | |||
@@ -408,6 +408,7 @@ ENGINE *ENGINE_by_id(const char *id) | |||
408 | !ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) || | 408 | !ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) || |
409 | !ENGINE_ctrl_cmd_string(iterator, "DIR_ADD", | 409 | !ENGINE_ctrl_cmd_string(iterator, "DIR_ADD", |
410 | load_dir, 0) || | 410 | load_dir, 0) || |
411 | !ENGINE_ctrl_cmd_string(iterator, "LIST_ADD", "1", 0) || | ||
411 | !ENGINE_ctrl_cmd_string(iterator, "LOAD", NULL, 0)) | 412 | !ENGINE_ctrl_cmd_string(iterator, "LOAD", NULL, 0)) |
412 | goto notfound; | 413 | goto notfound; |
413 | return iterator; | 414 | return iterator; |
diff --git a/src/lib/libcrypto/err/err_all.c b/src/lib/libcrypto/err/err_all.c index bd8946d8ba..8eb547d98d 100644 --- a/src/lib/libcrypto/err/err_all.c +++ b/src/lib/libcrypto/err/err_all.c | |||
@@ -64,7 +64,9 @@ | |||
64 | #endif | 64 | #endif |
65 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
67 | #ifndef OPENSSL_NO_COMP | ||
67 | #include <openssl/comp.h> | 68 | #include <openssl/comp.h> |
69 | #endif | ||
68 | #ifndef OPENSSL_NO_RSA | 70 | #ifndef OPENSSL_NO_RSA |
69 | #include <openssl/rsa.h> | 71 | #include <openssl/rsa.h> |
70 | #endif | 72 | #endif |
@@ -95,6 +97,9 @@ | |||
95 | #include <openssl/ui.h> | 97 | #include <openssl/ui.h> |
96 | #include <openssl/ocsp.h> | 98 | #include <openssl/ocsp.h> |
97 | #include <openssl/err.h> | 99 | #include <openssl/err.h> |
100 | #ifdef OPENSSL_FIPS | ||
101 | #include <openssl/fips.h> | ||
102 | #endif | ||
98 | #include <openssl/ts.h> | 103 | #include <openssl/ts.h> |
99 | #ifndef OPENSSL_NO_CMS | 104 | #ifndef OPENSSL_NO_CMS |
100 | #include <openssl/cms.h> | 105 | #include <openssl/cms.h> |
@@ -102,11 +107,6 @@ | |||
102 | #ifndef OPENSSL_NO_JPAKE | 107 | #ifndef OPENSSL_NO_JPAKE |
103 | #include <openssl/jpake.h> | 108 | #include <openssl/jpake.h> |
104 | #endif | 109 | #endif |
105 | #include <openssl/comp.h> | ||
106 | |||
107 | #ifdef OPENSSL_FIPS | ||
108 | #include <openssl/fips.h> | ||
109 | #endif | ||
110 | 110 | ||
111 | void ERR_load_crypto_strings(void) | 111 | void ERR_load_crypto_strings(void) |
112 | { | 112 | { |
@@ -130,7 +130,9 @@ void ERR_load_crypto_strings(void) | |||
130 | ERR_load_ASN1_strings(); | 130 | ERR_load_ASN1_strings(); |
131 | ERR_load_CONF_strings(); | 131 | ERR_load_CONF_strings(); |
132 | ERR_load_CRYPTO_strings(); | 132 | ERR_load_CRYPTO_strings(); |
133 | #ifndef OPENSSL_NO_COMP | ||
133 | ERR_load_COMP_strings(); | 134 | ERR_load_COMP_strings(); |
135 | #endif | ||
134 | #ifndef OPENSSL_NO_EC | 136 | #ifndef OPENSSL_NO_EC |
135 | ERR_load_EC_strings(); | 137 | ERR_load_EC_strings(); |
136 | #endif | 138 | #endif |
@@ -153,15 +155,14 @@ void ERR_load_crypto_strings(void) | |||
153 | #endif | 155 | #endif |
154 | ERR_load_OCSP_strings(); | 156 | ERR_load_OCSP_strings(); |
155 | ERR_load_UI_strings(); | 157 | ERR_load_UI_strings(); |
158 | #ifdef OPENSSL_FIPS | ||
159 | ERR_load_FIPS_strings(); | ||
160 | #endif | ||
156 | #ifndef OPENSSL_NO_CMS | 161 | #ifndef OPENSSL_NO_CMS |
157 | ERR_load_CMS_strings(); | 162 | ERR_load_CMS_strings(); |
158 | #endif | 163 | #endif |
159 | #ifndef OPENSSL_NO_JPAKE | 164 | #ifndef OPENSSL_NO_JPAKE |
160 | ERR_load_JPAKE_strings(); | 165 | ERR_load_JPAKE_strings(); |
161 | #endif | 166 | #endif |
162 | ERR_load_COMP_strings(); | ||
163 | #endif | ||
164 | #ifdef OPENSSL_FIPS | ||
165 | ERR_load_FIPS_strings(); | ||
166 | #endif | 167 | #endif |
167 | } | 168 | } |
diff --git a/src/lib/libcrypto/evp/Makefile b/src/lib/libcrypto/evp/Makefile index 0fe1b96bff..0447b442bc 100644 --- a/src/lib/libcrypto/evp/Makefile +++ b/src/lib/libcrypto/evp/Makefile | |||
@@ -67,7 +67,7 @@ files: | |||
67 | links: | 67 | links: |
68 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | 68 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) |
69 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | 69 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) |
70 | cp $(TESTDATA) ../../test | 70 | @[ -f $(TESTDATA) ] && cp $(TESTDATA) ../../test && echo "$(TESTDATA) -> ../../test/$(TESTDATA)" |
71 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | 71 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) |
72 | 72 | ||
73 | install: | 73 | install: |
@@ -356,6 +356,20 @@ evp_acnf.o: ../../include/openssl/opensslconf.h | |||
356 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 356 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
357 | evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 357 | evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
358 | evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c | 358 | evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c |
359 | evp_cnf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
360 | evp_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
361 | evp_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
362 | evp_cnf.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
363 | evp_cnf.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
364 | evp_cnf.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
365 | evp_cnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
366 | evp_cnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
367 | evp_cnf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
368 | evp_cnf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
369 | evp_cnf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
370 | evp_cnf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
371 | evp_cnf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
372 | evp_cnf.o: ../../include/openssl/x509v3.h ../cryptlib.h evp_cnf.c | ||
359 | evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h | 373 | evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h |
360 | evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 374 | evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
361 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 375 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
@@ -437,28 +451,22 @@ evp_pkey.o: ../asn1/asn1_locl.h ../cryptlib.h evp_pkey.c | |||
437 | m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 451 | m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
438 | m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 452 | m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
439 | m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 453 | m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
440 | m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 454 | m_dss.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
441 | m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 455 | m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
442 | m_dss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | 456 | m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
443 | m_dss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 457 | m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
444 | m_dss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
445 | m_dss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
446 | m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 458 | m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
447 | m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 459 | m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
448 | m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
449 | m_dss.o: ../cryptlib.h m_dss.c | 460 | m_dss.o: ../cryptlib.h m_dss.c |
450 | m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 461 | m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
451 | m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 462 | m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
452 | m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 463 | m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
453 | m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 464 | m_dss1.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
454 | m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 465 | m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
455 | m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | 466 | m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
456 | m_dss1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 467 | m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
457 | m_dss1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
458 | m_dss1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
459 | m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 468 | m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
460 | m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 469 | m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
461 | m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
462 | m_dss1.o: ../cryptlib.h m_dss1.c | 470 | m_dss1.o: ../cryptlib.h m_dss1.c |
463 | m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h | 471 | m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h |
464 | m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 472 | m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
@@ -563,16 +571,13 @@ m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | |||
563 | m_sha.o: ../cryptlib.h evp_locl.h m_sha.c | 571 | m_sha.o: ../cryptlib.h evp_locl.h m_sha.c |
564 | m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 572 | m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
565 | m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 573 | m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
566 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 574 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
567 | m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 575 | m_sha1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
568 | m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 576 | m_sha1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
569 | m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 577 | m_sha1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
570 | m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 578 | m_sha1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h |
571 | m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
572 | m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
573 | m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 579 | m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
574 | m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 580 | m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
575 | m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
576 | m_sha1.o: ../cryptlib.h m_sha1.c | 581 | m_sha1.o: ../cryptlib.h m_sha1.c |
577 | m_sigver.o: ../../e_os.h ../../include/openssl/asn1.h | 582 | m_sigver.o: ../../e_os.h ../../include/openssl/asn1.h |
578 | m_sigver.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 583 | m_sigver.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c index 72a2a67277..ac6d441aad 100644 --- a/src/lib/libcrypto/evp/bio_b64.c +++ b/src/lib/libcrypto/evp/bio_b64.c | |||
@@ -264,7 +264,7 @@ static int b64_read(BIO *b, char *out, int outl) | |||
264 | } | 264 | } |
265 | 265 | ||
266 | /* we fell off the end without starting */ | 266 | /* we fell off the end without starting */ |
267 | if (j == i) | 267 | if ((j == i) && (num == 0)) |
268 | { | 268 | { |
269 | /* Is this is one long chunk?, if so, keep on | 269 | /* Is this is one long chunk?, if so, keep on |
270 | * reading until a new line. */ | 270 | * reading until a new line. */ |
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c index 467e6b5ae9..d14e8e48d5 100644 --- a/src/lib/libcrypto/evp/digest.c +++ b/src/lib/libcrypto/evp/digest.c | |||
@@ -267,6 +267,7 @@ int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | |||
267 | return FIPS_digestfinal(ctx, md, size); | 267 | return FIPS_digestfinal(ctx, md, size); |
268 | #else | 268 | #else |
269 | int ret; | 269 | int ret; |
270 | |||
270 | OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); | 271 | OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); |
271 | ret=ctx->digest->final(ctx,md); | 272 | ret=ctx->digest->final(ctx,md); |
272 | if (size != NULL) | 273 | if (size != NULL) |
@@ -365,8 +366,11 @@ int EVP_Digest(const void *data, size_t count, | |||
365 | 366 | ||
366 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) | 367 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) |
367 | { | 368 | { |
368 | EVP_MD_CTX_cleanup(ctx); | 369 | if (ctx) |
369 | OPENSSL_free(ctx); | 370 | { |
371 | EVP_MD_CTX_cleanup(ctx); | ||
372 | OPENSSL_free(ctx); | ||
373 | } | ||
370 | } | 374 | } |
371 | 375 | ||
372 | /* This call frees resources associated with the context */ | 376 | /* This call frees resources associated with the context */ |
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index 1e4af0cb75..c7869b69ef 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c | |||
@@ -842,7 +842,10 @@ static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
842 | gctx->ctr = NULL; | 842 | gctx->ctr = NULL; |
843 | break; | 843 | break; |
844 | } | 844 | } |
845 | else | ||
845 | #endif | 846 | #endif |
847 | (void)0; /* terminate potentially open 'else' */ | ||
848 | |||
846 | AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks); | 849 | AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks); |
847 | CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f)AES_encrypt); | 850 | CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f)AES_encrypt); |
848 | #ifdef AES_CTR_ASM | 851 | #ifdef AES_CTR_ASM |
@@ -969,8 +972,6 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
969 | 972 | ||
970 | if (!gctx->iv_set) | 973 | if (!gctx->iv_set) |
971 | return -1; | 974 | return -1; |
972 | if (!ctx->encrypt && gctx->taglen < 0) | ||
973 | return -1; | ||
974 | if (in) | 975 | if (in) |
975 | { | 976 | { |
976 | if (out == NULL) | 977 | if (out == NULL) |
@@ -1012,6 +1013,8 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
1012 | { | 1013 | { |
1013 | if (!ctx->encrypt) | 1014 | if (!ctx->encrypt) |
1014 | { | 1015 | { |
1016 | if (gctx->taglen < 0) | ||
1017 | return -1; | ||
1015 | if (CRYPTO_gcm128_finish(&gctx->gcm, | 1018 | if (CRYPTO_gcm128_finish(&gctx->gcm, |
1016 | ctx->buf, gctx->taglen) != 0) | 1019 | ctx->buf, gctx->taglen) != 0) |
1017 | return -1; | 1020 | return -1; |
@@ -1083,14 +1086,17 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
1083 | xctx->xts.block1 = (block128_f)vpaes_decrypt; | 1086 | xctx->xts.block1 = (block128_f)vpaes_decrypt; |
1084 | } | 1087 | } |
1085 | 1088 | ||
1086 | vpaes_set_encrypt_key(key + ctx->key_len/2, | 1089 | vpaes_set_encrypt_key(key + ctx->key_len/2, |
1087 | ctx->key_len * 4, &xctx->ks2); | 1090 | ctx->key_len * 4, &xctx->ks2); |
1088 | xctx->xts.block2 = (block128_f)vpaes_encrypt; | 1091 | xctx->xts.block2 = (block128_f)vpaes_encrypt; |
1089 | 1092 | ||
1090 | xctx->xts.key1 = &xctx->ks1; | 1093 | xctx->xts.key1 = &xctx->ks1; |
1091 | break; | 1094 | break; |
1092 | } | 1095 | } |
1096 | else | ||
1093 | #endif | 1097 | #endif |
1098 | (void)0; /* terminate potentially open 'else' */ | ||
1099 | |||
1094 | if (enc) | 1100 | if (enc) |
1095 | { | 1101 | { |
1096 | AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1); | 1102 | AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1); |
@@ -1217,6 +1223,7 @@ static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
1217 | vpaes_set_encrypt_key(key, ctx->key_len*8, &cctx->ks); | 1223 | vpaes_set_encrypt_key(key, ctx->key_len*8, &cctx->ks); |
1218 | CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, | 1224 | CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, |
1219 | &cctx->ks, (block128_f)vpaes_encrypt); | 1225 | &cctx->ks, (block128_f)vpaes_encrypt); |
1226 | cctx->str = NULL; | ||
1220 | cctx->key_set = 1; | 1227 | cctx->key_set = 1; |
1221 | break; | 1228 | break; |
1222 | } | 1229 | } |
diff --git a/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c b/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c index 483e04b605..fb2c884a78 100644 --- a/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c +++ b/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c | |||
@@ -328,10 +328,11 @@ static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
328 | 328 | ||
329 | if (res!=SHA_CBLOCK) continue; | 329 | if (res!=SHA_CBLOCK) continue; |
330 | 330 | ||
331 | mask = 0-((inp_len+8-j)>>(sizeof(j)*8-1)); | 331 | /* j is not incremented yet */ |
332 | mask = 0-((inp_len+7-j)>>(sizeof(j)*8-1)); | ||
332 | data->u[SHA_LBLOCK-1] |= bitlen&mask; | 333 | data->u[SHA_LBLOCK-1] |= bitlen&mask; |
333 | sha1_block_data_order(&key->md,data,1); | 334 | sha1_block_data_order(&key->md,data,1); |
334 | mask &= 0-((j-inp_len-73)>>(sizeof(j)*8-1)); | 335 | mask &= 0-((j-inp_len-72)>>(sizeof(j)*8-1)); |
335 | pmac->u[0] |= key->md.h0 & mask; | 336 | pmac->u[0] |= key->md.h0 & mask; |
336 | pmac->u[1] |= key->md.h1 & mask; | 337 | pmac->u[1] |= key->md.h1 & mask; |
337 | pmac->u[2] |= key->md.h2 & mask; | 338 | pmac->u[2] |= key->md.h2 & mask; |
diff --git a/src/lib/libcrypto/evp/e_des3.c b/src/lib/libcrypto/evp/e_des3.c index 1e69972662..8d7b7de292 100644 --- a/src/lib/libcrypto/evp/e_des3.c +++ b/src/lib/libcrypto/evp/e_des3.c | |||
@@ -101,7 +101,7 @@ static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
101 | static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 101 | static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
102 | const unsigned char *in, size_t inl) | 102 | const unsigned char *in, size_t inl) |
103 | { | 103 | { |
104 | if (inl>=EVP_MAXCHUNK) | 104 | while (inl>=EVP_MAXCHUNK) |
105 | { | 105 | { |
106 | DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, | 106 | DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, |
107 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | 107 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, |
@@ -132,7 +132,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
132 | printf("\n"); | 132 | printf("\n"); |
133 | } | 133 | } |
134 | #endif /* KSSL_DEBUG */ | 134 | #endif /* KSSL_DEBUG */ |
135 | if (inl>=EVP_MAXCHUNK) | 135 | while (inl>=EVP_MAXCHUNK) |
136 | { | 136 | { |
137 | DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, | 137 | DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, |
138 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | 138 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, |
@@ -151,7 +151,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
151 | static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 151 | static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
152 | const unsigned char *in, size_t inl) | 152 | const unsigned char *in, size_t inl) |
153 | { | 153 | { |
154 | if (inl>=EVP_MAXCHUNK) | 154 | while (inl>=EVP_MAXCHUNK) |
155 | { | 155 | { |
156 | DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK, | 156 | DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK, |
157 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | 157 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, |
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index 3b1fa87576..faeb3c24e6 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
@@ -788,8 +788,8 @@ const EVP_CIPHER *EVP_aes_128_cfb128(void); | |||
788 | # define EVP_aes_128_cfb EVP_aes_128_cfb128 | 788 | # define EVP_aes_128_cfb EVP_aes_128_cfb128 |
789 | const EVP_CIPHER *EVP_aes_128_ofb(void); | 789 | const EVP_CIPHER *EVP_aes_128_ofb(void); |
790 | const EVP_CIPHER *EVP_aes_128_ctr(void); | 790 | const EVP_CIPHER *EVP_aes_128_ctr(void); |
791 | const EVP_CIPHER *EVP_aes_128_gcm(void); | ||
792 | const EVP_CIPHER *EVP_aes_128_ccm(void); | 791 | const EVP_CIPHER *EVP_aes_128_ccm(void); |
792 | const EVP_CIPHER *EVP_aes_128_gcm(void); | ||
793 | const EVP_CIPHER *EVP_aes_128_xts(void); | 793 | const EVP_CIPHER *EVP_aes_128_xts(void); |
794 | const EVP_CIPHER *EVP_aes_192_ecb(void); | 794 | const EVP_CIPHER *EVP_aes_192_ecb(void); |
795 | const EVP_CIPHER *EVP_aes_192_cbc(void); | 795 | const EVP_CIPHER *EVP_aes_192_cbc(void); |
@@ -799,8 +799,8 @@ const EVP_CIPHER *EVP_aes_192_cfb128(void); | |||
799 | # define EVP_aes_192_cfb EVP_aes_192_cfb128 | 799 | # define EVP_aes_192_cfb EVP_aes_192_cfb128 |
800 | const EVP_CIPHER *EVP_aes_192_ofb(void); | 800 | const EVP_CIPHER *EVP_aes_192_ofb(void); |
801 | const EVP_CIPHER *EVP_aes_192_ctr(void); | 801 | const EVP_CIPHER *EVP_aes_192_ctr(void); |
802 | const EVP_CIPHER *EVP_aes_192_gcm(void); | ||
803 | const EVP_CIPHER *EVP_aes_192_ccm(void); | 802 | const EVP_CIPHER *EVP_aes_192_ccm(void); |
803 | const EVP_CIPHER *EVP_aes_192_gcm(void); | ||
804 | const EVP_CIPHER *EVP_aes_256_ecb(void); | 804 | const EVP_CIPHER *EVP_aes_256_ecb(void); |
805 | const EVP_CIPHER *EVP_aes_256_cbc(void); | 805 | const EVP_CIPHER *EVP_aes_256_cbc(void); |
806 | const EVP_CIPHER *EVP_aes_256_cfb1(void); | 806 | const EVP_CIPHER *EVP_aes_256_cfb1(void); |
@@ -809,8 +809,8 @@ const EVP_CIPHER *EVP_aes_256_cfb128(void); | |||
809 | # define EVP_aes_256_cfb EVP_aes_256_cfb128 | 809 | # define EVP_aes_256_cfb EVP_aes_256_cfb128 |
810 | const EVP_CIPHER *EVP_aes_256_ofb(void); | 810 | const EVP_CIPHER *EVP_aes_256_ofb(void); |
811 | const EVP_CIPHER *EVP_aes_256_ctr(void); | 811 | const EVP_CIPHER *EVP_aes_256_ctr(void); |
812 | const EVP_CIPHER *EVP_aes_256_gcm(void); | ||
813 | const EVP_CIPHER *EVP_aes_256_ccm(void); | 812 | const EVP_CIPHER *EVP_aes_256_ccm(void); |
813 | const EVP_CIPHER *EVP_aes_256_gcm(void); | ||
814 | const EVP_CIPHER *EVP_aes_256_xts(void); | 814 | const EVP_CIPHER *EVP_aes_256_xts(void); |
815 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) | 815 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) |
816 | const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); | 816 | const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); |
@@ -1242,6 +1242,8 @@ void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, | |||
1242 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, | 1242 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, |
1243 | const char *type, const char *value)); | 1243 | const char *type, const char *value)); |
1244 | 1244 | ||
1245 | void EVP_add_alg_module(void); | ||
1246 | |||
1245 | /* BEGIN ERROR CODES */ | 1247 | /* BEGIN ERROR CODES */ |
1246 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 1248 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
1247 | * made after this point may be overwritten when the script is next run. | 1249 | * made after this point may be overwritten when the script is next run. |
@@ -1256,6 +1258,7 @@ void ERR_load_EVP_strings(void); | |||
1256 | #define EVP_F_AES_INIT_KEY 133 | 1258 | #define EVP_F_AES_INIT_KEY 133 |
1257 | #define EVP_F_AES_XTS 172 | 1259 | #define EVP_F_AES_XTS 172 |
1258 | #define EVP_F_AES_XTS_CIPHER 175 | 1260 | #define EVP_F_AES_XTS_CIPHER 175 |
1261 | #define EVP_F_ALG_MODULE_INIT 177 | ||
1259 | #define EVP_F_CAMELLIA_INIT_KEY 159 | 1262 | #define EVP_F_CAMELLIA_INIT_KEY 159 |
1260 | #define EVP_F_CMAC_INIT 173 | 1263 | #define EVP_F_CMAC_INIT 173 |
1261 | #define EVP_F_D2I_PKEY 100 | 1264 | #define EVP_F_D2I_PKEY 100 |
@@ -1349,15 +1352,19 @@ void ERR_load_EVP_strings(void); | |||
1349 | #define EVP_R_DIFFERENT_PARAMETERS 153 | 1352 | #define EVP_R_DIFFERENT_PARAMETERS 153 |
1350 | #define EVP_R_DISABLED_FOR_FIPS 163 | 1353 | #define EVP_R_DISABLED_FOR_FIPS 163 |
1351 | #define EVP_R_ENCODE_ERROR 115 | 1354 | #define EVP_R_ENCODE_ERROR 115 |
1355 | #define EVP_R_ERROR_LOADING_SECTION 165 | ||
1356 | #define EVP_R_ERROR_SETTING_FIPS_MODE 166 | ||
1352 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 | 1357 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 |
1353 | #define EVP_R_EXPECTING_AN_RSA_KEY 127 | 1358 | #define EVP_R_EXPECTING_AN_RSA_KEY 127 |
1354 | #define EVP_R_EXPECTING_A_DH_KEY 128 | 1359 | #define EVP_R_EXPECTING_A_DH_KEY 128 |
1355 | #define EVP_R_EXPECTING_A_DSA_KEY 129 | 1360 | #define EVP_R_EXPECTING_A_DSA_KEY 129 |
1356 | #define EVP_R_EXPECTING_A_ECDSA_KEY 141 | 1361 | #define EVP_R_EXPECTING_A_ECDSA_KEY 141 |
1357 | #define EVP_R_EXPECTING_A_EC_KEY 142 | 1362 | #define EVP_R_EXPECTING_A_EC_KEY 142 |
1363 | #define EVP_R_FIPS_MODE_NOT_SUPPORTED 167 | ||
1358 | #define EVP_R_INITIALIZATION_ERROR 134 | 1364 | #define EVP_R_INITIALIZATION_ERROR 134 |
1359 | #define EVP_R_INPUT_NOT_INITIALIZED 111 | 1365 | #define EVP_R_INPUT_NOT_INITIALIZED 111 |
1360 | #define EVP_R_INVALID_DIGEST 152 | 1366 | #define EVP_R_INVALID_DIGEST 152 |
1367 | #define EVP_R_INVALID_FIPS_MODE 168 | ||
1361 | #define EVP_R_INVALID_KEY_LENGTH 130 | 1368 | #define EVP_R_INVALID_KEY_LENGTH 130 |
1362 | #define EVP_R_INVALID_OPERATION 148 | 1369 | #define EVP_R_INVALID_OPERATION 148 |
1363 | #define EVP_R_IV_TOO_LARGE 102 | 1370 | #define EVP_R_IV_TOO_LARGE 102 |
@@ -1382,6 +1389,7 @@ void ERR_load_EVP_strings(void); | |||
1382 | #define EVP_R_TOO_LARGE 164 | 1389 | #define EVP_R_TOO_LARGE 164 |
1383 | #define EVP_R_UNKNOWN_CIPHER 160 | 1390 | #define EVP_R_UNKNOWN_CIPHER 160 |
1384 | #define EVP_R_UNKNOWN_DIGEST 161 | 1391 | #define EVP_R_UNKNOWN_DIGEST 161 |
1392 | #define EVP_R_UNKNOWN_OPTION 169 | ||
1385 | #define EVP_R_UNKNOWN_PBE_ALGORITHM 121 | 1393 | #define EVP_R_UNKNOWN_PBE_ALGORITHM 121 |
1386 | #define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 | 1394 | #define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 |
1387 | #define EVP_R_UNSUPPORTED_ALGORITHM 156 | 1395 | #define EVP_R_UNSUPPORTED_ALGORITHM 156 |
diff --git a/src/lib/libcrypto/evp/evp_err.c b/src/lib/libcrypto/evp/evp_err.c index db0f76d59b..08eab9882f 100644 --- a/src/lib/libcrypto/evp/evp_err.c +++ b/src/lib/libcrypto/evp/evp_err.c | |||
@@ -75,6 +75,7 @@ static ERR_STRING_DATA EVP_str_functs[]= | |||
75 | {ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, | 75 | {ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, |
76 | {ERR_FUNC(EVP_F_AES_XTS), "AES_XTS"}, | 76 | {ERR_FUNC(EVP_F_AES_XTS), "AES_XTS"}, |
77 | {ERR_FUNC(EVP_F_AES_XTS_CIPHER), "AES_XTS_CIPHER"}, | 77 | {ERR_FUNC(EVP_F_AES_XTS_CIPHER), "AES_XTS_CIPHER"}, |
78 | {ERR_FUNC(EVP_F_ALG_MODULE_INIT), "ALG_MODULE_INIT"}, | ||
78 | {ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, | 79 | {ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, |
79 | {ERR_FUNC(EVP_F_CMAC_INIT), "CMAC_INIT"}, | 80 | {ERR_FUNC(EVP_F_CMAC_INIT), "CMAC_INIT"}, |
80 | {ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, | 81 | {ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, |
@@ -171,15 +172,19 @@ static ERR_STRING_DATA EVP_str_reasons[]= | |||
171 | {ERR_REASON(EVP_R_DIFFERENT_PARAMETERS) ,"different parameters"}, | 172 | {ERR_REASON(EVP_R_DIFFERENT_PARAMETERS) ,"different parameters"}, |
172 | {ERR_REASON(EVP_R_DISABLED_FOR_FIPS) ,"disabled for fips"}, | 173 | {ERR_REASON(EVP_R_DISABLED_FOR_FIPS) ,"disabled for fips"}, |
173 | {ERR_REASON(EVP_R_ENCODE_ERROR) ,"encode error"}, | 174 | {ERR_REASON(EVP_R_ENCODE_ERROR) ,"encode error"}, |
175 | {ERR_REASON(EVP_R_ERROR_LOADING_SECTION) ,"error loading section"}, | ||
176 | {ERR_REASON(EVP_R_ERROR_SETTING_FIPS_MODE),"error setting fips mode"}, | ||
174 | {ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"}, | 177 | {ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"}, |
175 | {ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY) ,"expecting an rsa key"}, | 178 | {ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY) ,"expecting an rsa key"}, |
176 | {ERR_REASON(EVP_R_EXPECTING_A_DH_KEY) ,"expecting a dh key"}, | 179 | {ERR_REASON(EVP_R_EXPECTING_A_DH_KEY) ,"expecting a dh key"}, |
177 | {ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY) ,"expecting a dsa key"}, | 180 | {ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY) ,"expecting a dsa key"}, |
178 | {ERR_REASON(EVP_R_EXPECTING_A_ECDSA_KEY) ,"expecting a ecdsa key"}, | 181 | {ERR_REASON(EVP_R_EXPECTING_A_ECDSA_KEY) ,"expecting a ecdsa key"}, |
179 | {ERR_REASON(EVP_R_EXPECTING_A_EC_KEY) ,"expecting a ec key"}, | 182 | {ERR_REASON(EVP_R_EXPECTING_A_EC_KEY) ,"expecting a ec key"}, |
183 | {ERR_REASON(EVP_R_FIPS_MODE_NOT_SUPPORTED),"fips mode not supported"}, | ||
180 | {ERR_REASON(EVP_R_INITIALIZATION_ERROR) ,"initialization error"}, | 184 | {ERR_REASON(EVP_R_INITIALIZATION_ERROR) ,"initialization error"}, |
181 | {ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"}, | 185 | {ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"}, |
182 | {ERR_REASON(EVP_R_INVALID_DIGEST) ,"invalid digest"}, | 186 | {ERR_REASON(EVP_R_INVALID_DIGEST) ,"invalid digest"}, |
187 | {ERR_REASON(EVP_R_INVALID_FIPS_MODE) ,"invalid fips mode"}, | ||
183 | {ERR_REASON(EVP_R_INVALID_KEY_LENGTH) ,"invalid key length"}, | 188 | {ERR_REASON(EVP_R_INVALID_KEY_LENGTH) ,"invalid key length"}, |
184 | {ERR_REASON(EVP_R_INVALID_OPERATION) ,"invalid operation"}, | 189 | {ERR_REASON(EVP_R_INVALID_OPERATION) ,"invalid operation"}, |
185 | {ERR_REASON(EVP_R_IV_TOO_LARGE) ,"iv too large"}, | 190 | {ERR_REASON(EVP_R_IV_TOO_LARGE) ,"iv too large"}, |
@@ -204,6 +209,7 @@ static ERR_STRING_DATA EVP_str_reasons[]= | |||
204 | {ERR_REASON(EVP_R_TOO_LARGE) ,"too large"}, | 209 | {ERR_REASON(EVP_R_TOO_LARGE) ,"too large"}, |
205 | {ERR_REASON(EVP_R_UNKNOWN_CIPHER) ,"unknown cipher"}, | 210 | {ERR_REASON(EVP_R_UNKNOWN_CIPHER) ,"unknown cipher"}, |
206 | {ERR_REASON(EVP_R_UNKNOWN_DIGEST) ,"unknown digest"}, | 211 | {ERR_REASON(EVP_R_UNKNOWN_DIGEST) ,"unknown digest"}, |
212 | {ERR_REASON(EVP_R_UNKNOWN_OPTION) ,"unknown option"}, | ||
207 | {ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"}, | 213 | {ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"}, |
208 | {ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"}, | 214 | {ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"}, |
209 | {ERR_REASON(EVP_R_UNSUPPORTED_ALGORITHM) ,"unsupported algorithm"}, | 215 | {ERR_REASON(EVP_R_UNSUPPORTED_ALGORITHM) ,"unsupported algorithm"}, |
diff --git a/src/lib/libcrypto/evp/m_dss.c b/src/lib/libcrypto/evp/m_dss.c index 4ad63ada6f..6fb7e9a861 100644 --- a/src/lib/libcrypto/evp/m_dss.c +++ b/src/lib/libcrypto/evp/m_dss.c | |||
@@ -60,7 +60,7 @@ | |||
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
62 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
63 | #include <openssl/x509.h> | 63 | #include <openssl/sha.h> |
64 | #ifndef OPENSSL_NO_DSA | 64 | #ifndef OPENSSL_NO_DSA |
65 | #include <openssl/dsa.h> | 65 | #include <openssl/dsa.h> |
66 | #endif | 66 | #endif |
diff --git a/src/lib/libcrypto/evp/m_dss1.c b/src/lib/libcrypto/evp/m_dss1.c index f80170efeb..2df362a670 100644 --- a/src/lib/libcrypto/evp/m_dss1.c +++ b/src/lib/libcrypto/evp/m_dss1.c | |||
@@ -63,7 +63,7 @@ | |||
63 | 63 | ||
64 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
65 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
66 | #include <openssl/x509.h> | 66 | #include <openssl/sha.h> |
67 | #ifndef OPENSSL_NO_DSA | 67 | #ifndef OPENSSL_NO_DSA |
68 | #include <openssl/dsa.h> | 68 | #include <openssl/dsa.h> |
69 | #endif | 69 | #endif |
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c index 3cb11f1ebb..bd0c01ad3c 100644 --- a/src/lib/libcrypto/evp/m_sha1.c +++ b/src/lib/libcrypto/evp/m_sha1.c | |||
@@ -65,7 +65,7 @@ | |||
65 | 65 | ||
66 | #include <openssl/evp.h> | 66 | #include <openssl/evp.h> |
67 | #include <openssl/objects.h> | 67 | #include <openssl/objects.h> |
68 | #include <openssl/x509.h> | 68 | #include <openssl/sha.h> |
69 | #ifndef OPENSSL_NO_RSA | 69 | #ifndef OPENSSL_NO_RSA |
70 | #include <openssl/rsa.h> | 70 | #include <openssl/rsa.h> |
71 | #endif | 71 | #endif |
diff --git a/src/lib/libcrypto/evp/p5_crpt2.c b/src/lib/libcrypto/evp/p5_crpt2.c index 975d004df4..fe3c6c8813 100644 --- a/src/lib/libcrypto/evp/p5_crpt2.c +++ b/src/lib/libcrypto/evp/p5_crpt2.c | |||
@@ -85,19 +85,24 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, | |||
85 | unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4]; | 85 | unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4]; |
86 | int cplen, j, k, tkeylen, mdlen; | 86 | int cplen, j, k, tkeylen, mdlen; |
87 | unsigned long i = 1; | 87 | unsigned long i = 1; |
88 | HMAC_CTX hctx; | 88 | HMAC_CTX hctx_tpl, hctx; |
89 | 89 | ||
90 | mdlen = EVP_MD_size(digest); | 90 | mdlen = EVP_MD_size(digest); |
91 | if (mdlen < 0) | 91 | if (mdlen < 0) |
92 | return 0; | 92 | return 0; |
93 | 93 | ||
94 | HMAC_CTX_init(&hctx); | 94 | HMAC_CTX_init(&hctx_tpl); |
95 | p = out; | 95 | p = out; |
96 | tkeylen = keylen; | 96 | tkeylen = keylen; |
97 | if(!pass) | 97 | if(!pass) |
98 | passlen = 0; | 98 | passlen = 0; |
99 | else if(passlen == -1) | 99 | else if(passlen == -1) |
100 | passlen = strlen(pass); | 100 | passlen = strlen(pass); |
101 | if (!HMAC_Init_ex(&hctx_tpl, pass, passlen, digest, NULL)) | ||
102 | { | ||
103 | HMAC_CTX_cleanup(&hctx_tpl); | ||
104 | return 0; | ||
105 | } | ||
101 | while(tkeylen) | 106 | while(tkeylen) |
102 | { | 107 | { |
103 | if(tkeylen > mdlen) | 108 | if(tkeylen > mdlen) |
@@ -111,19 +116,36 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, | |||
111 | itmp[1] = (unsigned char)((i >> 16) & 0xff); | 116 | itmp[1] = (unsigned char)((i >> 16) & 0xff); |
112 | itmp[2] = (unsigned char)((i >> 8) & 0xff); | 117 | itmp[2] = (unsigned char)((i >> 8) & 0xff); |
113 | itmp[3] = (unsigned char)(i & 0xff); | 118 | itmp[3] = (unsigned char)(i & 0xff); |
114 | if (!HMAC_Init_ex(&hctx, pass, passlen, digest, NULL) | 119 | if (!HMAC_CTX_copy(&hctx, &hctx_tpl)) |
115 | || !HMAC_Update(&hctx, salt, saltlen) | ||
116 | || !HMAC_Update(&hctx, itmp, 4) | ||
117 | || !HMAC_Final(&hctx, digtmp, NULL)) | ||
118 | { | 120 | { |
121 | HMAC_CTX_cleanup(&hctx_tpl); | ||
122 | return 0; | ||
123 | } | ||
124 | if (!HMAC_Update(&hctx, salt, saltlen) | ||
125 | || !HMAC_Update(&hctx, itmp, 4) | ||
126 | || !HMAC_Final(&hctx, digtmp, NULL)) | ||
127 | { | ||
128 | HMAC_CTX_cleanup(&hctx_tpl); | ||
119 | HMAC_CTX_cleanup(&hctx); | 129 | HMAC_CTX_cleanup(&hctx); |
120 | return 0; | 130 | return 0; |
121 | } | 131 | } |
132 | HMAC_CTX_cleanup(&hctx); | ||
122 | memcpy(p, digtmp, cplen); | 133 | memcpy(p, digtmp, cplen); |
123 | for(j = 1; j < iter; j++) | 134 | for(j = 1; j < iter; j++) |
124 | { | 135 | { |
125 | HMAC(digest, pass, passlen, | 136 | if (!HMAC_CTX_copy(&hctx, &hctx_tpl)) |
126 | digtmp, mdlen, digtmp, NULL); | 137 | { |
138 | HMAC_CTX_cleanup(&hctx_tpl); | ||
139 | return 0; | ||
140 | } | ||
141 | if (!HMAC_Update(&hctx, digtmp, mdlen) | ||
142 | || !HMAC_Final(&hctx, digtmp, NULL)) | ||
143 | { | ||
144 | HMAC_CTX_cleanup(&hctx_tpl); | ||
145 | HMAC_CTX_cleanup(&hctx); | ||
146 | return 0; | ||
147 | } | ||
148 | HMAC_CTX_cleanup(&hctx); | ||
127 | for(k = 0; k < cplen; k++) | 149 | for(k = 0; k < cplen; k++) |
128 | p[k] ^= digtmp[k]; | 150 | p[k] ^= digtmp[k]; |
129 | } | 151 | } |
@@ -131,7 +153,7 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, | |||
131 | i++; | 153 | i++; |
132 | p+= cplen; | 154 | p+= cplen; |
133 | } | 155 | } |
134 | HMAC_CTX_cleanup(&hctx); | 156 | HMAC_CTX_cleanup(&hctx_tpl); |
135 | #ifdef DEBUG_PKCS5V2 | 157 | #ifdef DEBUG_PKCS5V2 |
136 | fprintf(stderr, "Password:\n"); | 158 | fprintf(stderr, "Password:\n"); |
137 | h__dump (pass, passlen); | 159 | h__dump (pass, passlen); |
diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c index dfa48c157c..8afb664306 100644 --- a/src/lib/libcrypto/evp/p_sign.c +++ b/src/lib/libcrypto/evp/p_sign.c | |||
@@ -80,7 +80,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, | |||
80 | { | 80 | { |
81 | unsigned char m[EVP_MAX_MD_SIZE]; | 81 | unsigned char m[EVP_MAX_MD_SIZE]; |
82 | unsigned int m_len; | 82 | unsigned int m_len; |
83 | int i=0,ok=0,v; | 83 | int i = 0,ok = 0,v; |
84 | EVP_MD_CTX tmp_ctx; | 84 | EVP_MD_CTX tmp_ctx; |
85 | EVP_PKEY_CTX *pkctx = NULL; | 85 | EVP_PKEY_CTX *pkctx = NULL; |
86 | 86 | ||
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c index 5f5c409f45..c66d63ccf8 100644 --- a/src/lib/libcrypto/evp/p_verify.c +++ b/src/lib/libcrypto/evp/p_verify.c | |||
@@ -67,7 +67,7 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, | |||
67 | { | 67 | { |
68 | unsigned char m[EVP_MAX_MD_SIZE]; | 68 | unsigned char m[EVP_MAX_MD_SIZE]; |
69 | unsigned int m_len; | 69 | unsigned int m_len; |
70 | int i=-1,ok=0,v; | 70 | int i = 0,ok = 0,v; |
71 | EVP_MD_CTX tmp_ctx; | 71 | EVP_MD_CTX tmp_ctx; |
72 | EVP_PKEY_CTX *pkctx = NULL; | 72 | EVP_PKEY_CTX *pkctx = NULL; |
73 | 73 | ||
diff --git a/src/lib/libcrypto/install-crypto.com b/src/lib/libcrypto/install-crypto.com deleted file mode 100755 index 85b3d583cf..0000000000 --- a/src/lib/libcrypto/install-crypto.com +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | $! INSTALL.COM -- Installs the files in a given directory tree | ||
2 | $! | ||
3 | $! Author: Richard Levitte <richard@levitte.org> | ||
4 | $! Time of creation: 22-MAY-1998 10:13 | ||
5 | $! | ||
6 | $! Changes by Zoltan Arpadffy <zoli@polarhome.com> | ||
7 | $! | ||
8 | $! P1 root of the directory tree | ||
9 | $! P2 "64" for 64-bit pointers. | ||
10 | $! | ||
11 | $! | ||
12 | $! Announce/identify. | ||
13 | $! | ||
14 | $ proc = f$environment( "procedure") | ||
15 | $ write sys$output "@@@ "+ - | ||
16 | f$parse( proc, , , "name")+ f$parse( proc, , , "type") | ||
17 | $! | ||
18 | $ on error then goto tidy | ||
19 | $ on control_c then goto tidy | ||
20 | $! | ||
21 | $ if (p1 .eqs. "") | ||
22 | $ then | ||
23 | $ write sys$output "First argument missing." | ||
24 | $ write sys$output - | ||
25 | "It should be the directory where you want things installed." | ||
26 | $ exit | ||
27 | $ endif | ||
28 | $! | ||
29 | $ if (f$getsyi( "cpu") .lt. 128) | ||
30 | $ then | ||
31 | $ arch = "VAX" | ||
32 | $ else | ||
33 | $ arch = f$edit( f$getsyi( "arch_name"), "upcase") | ||
34 | $ if (arch .eqs. "") then arch = "UNK" | ||
35 | $ endif | ||
36 | $! | ||
37 | $ archd = arch | ||
38 | $ lib32 = "32" | ||
39 | $ shr = "_SHR32" | ||
40 | $! | ||
41 | $ if (p2 .nes. "") | ||
42 | $ then | ||
43 | $ if (p2 .eqs. "64") | ||
44 | $ then | ||
45 | $ archd = arch+ "_64" | ||
46 | $ lib32 = "" | ||
47 | $ shr = "_SHR" | ||
48 | $ else | ||
49 | $ if (p2 .nes. "32") | ||
50 | $ then | ||
51 | $ write sys$output "Second argument invalid." | ||
52 | $ write sys$output "It should be "32", "64", or nothing." | ||
53 | $ exit | ||
54 | $ endif | ||
55 | $ endif | ||
56 | $ endif | ||
57 | $! | ||
58 | $ root = f$parse( p1, "[]A.;0", , , "syntax_only, no_conceal") - "A.;0" | ||
59 | $ root_dev = f$parse( root, , , "device", "syntax_only") | ||
60 | $ root_dir = f$parse( root, , , "directory", "syntax_only") - - | ||
61 | "[000000." - "][" - "[" - "]" | ||
62 | $ root = root_dev + "[" + root_dir | ||
63 | $! | ||
64 | $ define /nolog wrk_sslroot 'root'.] /trans=conc | ||
65 | $ define /nolog wrk_sslinclude wrk_sslroot:[include] | ||
66 | $ define /nolog wrk_sslxlib wrk_sslroot:['arch'_lib] | ||
67 | $! | ||
68 | $ if f$parse("wrk_sslroot:[000000]") .eqs. "" then - | ||
69 | create /directory /log wrk_sslroot:[000000] | ||
70 | $ if f$parse("wrk_sslinclude:") .eqs. "" then - | ||
71 | create /directory /log wrk_sslinclude: | ||
72 | $ if f$parse("wrk_sslxlib:") .eqs. "" then - | ||
73 | create /directory /log wrk_sslxlib: | ||
74 | $! | ||
75 | $ sdirs := , - | ||
76 | 'archd', - | ||
77 | objects, - | ||
78 | md2, md4, md5, sha, mdc2, hmac, ripemd, whrlpool, - | ||
79 | des, aes, rc2, rc4, rc5, idea, bf, cast, camellia, seed, - | ||
80 | bn, ec, rsa, dsa, ecdsa, dh, ecdh, dso, engine, - | ||
81 | buffer, bio, stack, lhash, rand, err, - | ||
82 | evp, asn1, pem, x509, x509v3, conf, txt_db, pkcs7, pkcs12, comp, ocsp, - | ||
83 | ui, krb5, - | ||
84 | store, cms, pqueue, ts, jpake | ||
85 | $! | ||
86 | $ exheader_ := crypto.h, opensslv.h, ebcdic.h, symhacks.h, ossl_typ.h | ||
87 | $ exheader_'archd' := opensslconf.h | ||
88 | $ exheader_objects := objects.h, obj_mac.h | ||
89 | $ exheader_md2 := md2.h | ||
90 | $ exheader_md4 := md4.h | ||
91 | $ exheader_md5 := md5.h | ||
92 | $ exheader_sha := sha.h | ||
93 | $ exheader_mdc2 := mdc2.h | ||
94 | $ exheader_hmac := hmac.h | ||
95 | $ exheader_ripemd := ripemd.h | ||
96 | $ exheader_whrlpool := whrlpool.h | ||
97 | $ exheader_des := des.h, des_old.h | ||
98 | $ exheader_aes := aes.h | ||
99 | $ exheader_rc2 := rc2.h | ||
100 | $ exheader_rc4 := rc4.h | ||
101 | $ exheader_rc5 := rc5.h | ||
102 | $ exheader_idea := idea.h | ||
103 | $ exheader_bf := blowfish.h | ||
104 | $ exheader_cast := cast.h | ||
105 | $ exheader_camellia := camellia.h | ||
106 | $ exheader_seed := seed.h | ||
107 | $ exheader_modes := modes.h | ||
108 | $ exheader_bn := bn.h | ||
109 | $ exheader_ec := ec.h | ||
110 | $ exheader_rsa := rsa.h | ||
111 | $ exheader_dsa := dsa.h | ||
112 | $ exheader_ecdsa := ecdsa.h | ||
113 | $ exheader_dh := dh.h | ||
114 | $ exheader_ecdh := ecdh.h | ||
115 | $ exheader_dso := dso.h | ||
116 | $ exheader_engine := engine.h | ||
117 | $ exheader_buffer := buffer.h | ||
118 | $ exheader_bio := bio.h | ||
119 | $ exheader_stack := stack.h, safestack.h | ||
120 | $ exheader_lhash := lhash.h | ||
121 | $ exheader_rand := rand.h | ||
122 | $ exheader_err := err.h | ||
123 | $ exheader_evp := evp.h | ||
124 | $ exheader_asn1 := asn1.h, asn1_mac.h, asn1t.h | ||
125 | $ exheader_pem := pem.h, pem2.h | ||
126 | $ exheader_x509 := x509.h, x509_vfy.h | ||
127 | $ exheader_x509v3 := x509v3.h | ||
128 | $ exheader_conf := conf.h, conf_api.h | ||
129 | $ exheader_txt_db := txt_db.h | ||
130 | $ exheader_pkcs7 := pkcs7.h | ||
131 | $ exheader_pkcs12 := pkcs12.h | ||
132 | $ exheader_comp := comp.h | ||
133 | $ exheader_ocsp := ocsp.h | ||
134 | $ exheader_ui := ui.h, ui_compat.h | ||
135 | $ exheader_krb5 := krb5_asn.h | ||
136 | $! exheader_store := store.h, str_compat.h | ||
137 | $ exheader_store := store.h | ||
138 | $ exheader_cms := cms.h | ||
139 | $ exheader_pqueue := pqueue.h | ||
140 | $ exheader_ts := ts.h | ||
141 | $ exheader_jpake := jpake.h | ||
142 | $ libs := ssl_libcrypto | ||
143 | $! | ||
144 | $ exe_dir := [-.'archd'.exe.crypto] | ||
145 | $! | ||
146 | $! Header files. | ||
147 | $! | ||
148 | $ i = 0 | ||
149 | $ loop_sdirs: | ||
150 | $ d = f$edit( f$element( i, ",", sdirs), "trim") | ||
151 | $ i = i + 1 | ||
152 | $ if d .eqs. "," then goto loop_sdirs_end | ||
153 | $ tmp = exheader_'d' | ||
154 | $ if (d .nes. "") then d = "."+ d | ||
155 | $ copy /protection = w:re ['d']'tmp' wrk_sslinclude: /log | ||
156 | $ goto loop_sdirs | ||
157 | $ loop_sdirs_end: | ||
158 | $! | ||
159 | $! Object libraries, shareable images. | ||
160 | $! | ||
161 | $ i = 0 | ||
162 | $ loop_lib: | ||
163 | $ e = f$edit( f$element( i, ",", libs), "trim") | ||
164 | $ i = i + 1 | ||
165 | $ if e .eqs. "," then goto loop_lib_end | ||
166 | $ set noon | ||
167 | $ file = exe_dir+ e+ lib32+ ".olb" | ||
168 | $ if f$search( file) .nes. "" | ||
169 | $ then | ||
170 | $ copy /protection = w:re 'file' wrk_sslxlib: /log | ||
171 | $ endif | ||
172 | $! | ||
173 | $ file = exe_dir+ e+ shr+ ".exe" | ||
174 | $ if f$search( file) .nes. "" | ||
175 | $ then | ||
176 | $ copy /protection = w:re 'file' wrk_sslxlib: /log | ||
177 | $ endif | ||
178 | $ set on | ||
179 | $ goto loop_lib | ||
180 | $ loop_lib_end: | ||
181 | $! | ||
182 | $ tidy: | ||
183 | $! | ||
184 | $ call deass wrk_sslroot | ||
185 | $ call deass wrk_sslinclude | ||
186 | $ call deass wrk_sslxlib | ||
187 | $! | ||
188 | $ exit | ||
189 | $! | ||
190 | $ deass: subroutine | ||
191 | $ if (f$trnlnm( p1, "LNM$PROCESS") .nes. "") | ||
192 | $ then | ||
193 | $ deassign /process 'p1' | ||
194 | $ endif | ||
195 | $ endsubroutine | ||
196 | $! | ||
diff --git a/src/lib/libcrypto/install.com b/src/lib/libcrypto/install.com deleted file mode 100644 index ad3e4d48c7..0000000000 --- a/src/lib/libcrypto/install.com +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
1 | $! INSTALL.COM -- Installs the files in a given directory tree | ||
2 | $! | ||
3 | $! Author: Richard Levitte <richard@levitte.org> | ||
4 | $! Time of creation: 22-MAY-1998 10:13 | ||
5 | $! | ||
6 | $! Changes by Zoltan Arpadffy <zoli@polarhome.com> | ||
7 | $! | ||
8 | $! P1 root of the directory tree | ||
9 | $! | ||
10 | $ IF P1 .EQS. "" | ||
11 | $ THEN | ||
12 | $ WRITE SYS$OUTPUT "First argument missing." | ||
13 | $ WRITE SYS$OUTPUT - | ||
14 | "It should be the directory where you want things installed." | ||
15 | $ EXIT | ||
16 | $ ENDIF | ||
17 | $ | ||
18 | $ IF (F$GETSYI("CPU").LT.128) | ||
19 | $ THEN | ||
20 | $ ARCH := VAX | ||
21 | $ ELSE | ||
22 | $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE") | ||
23 | $ IF (ARCH .EQS. "") THEN ARCH = "UNK" | ||
24 | $ ENDIF | ||
25 | $ | ||
26 | $ ROOT = F$PARSE(P1,"[]A.;0",,,"SYNTAX_ONLY,NO_CONCEAL") - "A.;0" | ||
27 | $ ROOT_DEV = F$PARSE(ROOT,,,"DEVICE","SYNTAX_ONLY") | ||
28 | $ ROOT_DIR = F$PARSE(ROOT,,,"DIRECTORY","SYNTAX_ONLY") - | ||
29 | - "[000000." - "][" - "[" - "]" | ||
30 | $ ROOT = ROOT_DEV + "[" + ROOT_DIR | ||
31 | $ | ||
32 | $ DEFINE/NOLOG WRK_SSLROOT 'ROOT'.] /TRANS=CONC | ||
33 | $ DEFINE/NOLOG WRK_SSLLIB WRK_SSLROOT:['ARCH'_LIB] | ||
34 | $ DEFINE/NOLOG WRK_SSLINCLUDE WRK_SSLROOT:[INCLUDE] | ||
35 | $ | ||
36 | $ IF F$PARSE("WRK_SSLROOT:[000000]") .EQS. "" THEN - | ||
37 | CREATE/DIR/LOG WRK_SSLROOT:[000000] | ||
38 | $ IF F$PARSE("WRK_SSLLIB:") .EQS. "" THEN - | ||
39 | CREATE/DIR/LOG WRK_SSLLIB: | ||
40 | $ IF F$PARSE("WRK_SSLINCLUDE:") .EQS. "" THEN - | ||
41 | CREATE/DIR/LOG WRK_SSLINCLUDE: | ||
42 | $ | ||
43 | $ SDIRS := ,- | ||
44 | _'ARCH',- | ||
45 | OBJECTS,- | ||
46 | MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,WHRLPOOL,- | ||
47 | DES,AES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,- | ||
48 | BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,- | ||
49 | BUFFER,BIO,STACK,LHASH,RAND,ERR,- | ||
50 | EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,- | ||
51 | UI,KRB5,- | ||
52 | STORE,CMS,PQUEUE,TS,JPAKE | ||
53 | $ EXHEADER_ := crypto.h,opensslv.h,ebcdic.h,symhacks.h,ossl_typ.h | ||
54 | $ EXHEADER__'ARCH' := opensslconf.h | ||
55 | $ EXHEADER_OBJECTS := objects.h,obj_mac.h | ||
56 | $ EXHEADER_MD2 := md2.h | ||
57 | $ EXHEADER_MD4 := md4.h | ||
58 | $ EXHEADER_MD5 := md5.h | ||
59 | $ EXHEADER_SHA := sha.h | ||
60 | $ EXHEADER_MDC2 := mdc2.h | ||
61 | $ EXHEADER_HMAC := hmac.h | ||
62 | $ EXHEADER_RIPEMD := ripemd.h | ||
63 | $ EXHEADER_WHRLPOOL := whrlpool.h | ||
64 | $ EXHEADER_DES := des.h,des_old.h | ||
65 | $ EXHEADER_AES := aes.h | ||
66 | $ EXHEADER_RC2 := rc2.h | ||
67 | $ EXHEADER_RC4 := rc4.h | ||
68 | $ EXHEADER_RC5 := rc5.h | ||
69 | $ EXHEADER_IDEA := idea.h | ||
70 | $ EXHEADER_BF := blowfish.h | ||
71 | $ EXHEADER_CAST := cast.h | ||
72 | $ EXHEADER_CAMELLIA := camellia.h | ||
73 | $ EXHEADER_SEED := seed.h | ||
74 | $ EXHEADER_MODES := modes.h | ||
75 | $ EXHEADER_BN := bn.h | ||
76 | $ EXHEADER_EC := ec.h | ||
77 | $ EXHEADER_RSA := rsa.h | ||
78 | $ EXHEADER_DSA := dsa.h | ||
79 | $ EXHEADER_ECDSA := ecdsa.h | ||
80 | $ EXHEADER_DH := dh.h | ||
81 | $ EXHEADER_ECDH := ecdh.h | ||
82 | $ EXHEADER_DSO := dso.h | ||
83 | $ EXHEADER_ENGINE := engine.h | ||
84 | $ EXHEADER_BUFFER := buffer.h | ||
85 | $ EXHEADER_BIO := bio.h | ||
86 | $ EXHEADER_STACK := stack.h,safestack.h | ||
87 | $ EXHEADER_LHASH := lhash.h | ||
88 | $ EXHEADER_RAND := rand.h | ||
89 | $ EXHEADER_ERR := err.h | ||
90 | $ EXHEADER_EVP := evp.h | ||
91 | $ EXHEADER_ASN1 := asn1.h,asn1_mac.h,asn1t.h | ||
92 | $ EXHEADER_PEM := pem.h,pem2.h | ||
93 | $ EXHEADER_X509 := x509.h,x509_vfy.h | ||
94 | $ EXHEADER_X509V3 := x509v3.h | ||
95 | $ EXHEADER_CONF := conf.h,conf_api.h | ||
96 | $ EXHEADER_TXT_DB := txt_db.h | ||
97 | $ EXHEADER_PKCS7 := pkcs7.h | ||
98 | $ EXHEADER_PKCS12 := pkcs12.h | ||
99 | $ EXHEADER_COMP := comp.h | ||
100 | $ EXHEADER_OCSP := ocsp.h | ||
101 | $ EXHEADER_UI := ui.h,ui_compat.h | ||
102 | $ EXHEADER_KRB5 := krb5_asn.h | ||
103 | $! EXHEADER_STORE := store.h,str_compat.h | ||
104 | $ EXHEADER_STORE := store.h | ||
105 | $ EXHEADER_CMS := cms.h | ||
106 | $ EXHEADER_PQUEUE := pqueue.h | ||
107 | $ EXHEADER_TS := ts.h | ||
108 | $ EXHEADER_JPAKE := jpake.h | ||
109 | $ LIBS := LIBCRYPTO | ||
110 | $ | ||
111 | $ EXE_DIR := [-.'ARCH'.EXE.CRYPTO] | ||
112 | $ | ||
113 | $ I = 0 | ||
114 | $ LOOP_SDIRS: | ||
115 | $ D = F$EDIT(F$ELEMENT(I, ",", SDIRS),"TRIM") | ||
116 | $ I = I + 1 | ||
117 | $ IF D .EQS. "," THEN GOTO LOOP_SDIRS_END | ||
118 | $ tmp = EXHEADER_'D' | ||
119 | $ IF D .EQS. "" | ||
120 | $ THEN | ||
121 | $ COPY 'tmp' WRK_SSLINCLUDE: /LOG | ||
122 | $ ELSE | ||
123 | $ IF D .EQS. "_''ARCH'" | ||
124 | $ THEN | ||
125 | $ COPY [-.'ARCH'.CRYPTO]'tmp' WRK_SSLINCLUDE: /LOG | ||
126 | $ ELSE | ||
127 | $ COPY [.'D']'tmp' WRK_SSLINCLUDE: /LOG | ||
128 | $ ENDIF | ||
129 | $ ENDIF | ||
130 | $ SET FILE/PROT=WORLD:RE WRK_SSLINCLUDE:'tmp' | ||
131 | $ GOTO LOOP_SDIRS | ||
132 | $ LOOP_SDIRS_END: | ||
133 | $ | ||
134 | $ I = 0 | ||
135 | $ LOOP_LIB: | ||
136 | $ E = F$EDIT(F$ELEMENT(I, ",", LIBS),"TRIM") | ||
137 | $ I = I + 1 | ||
138 | $ IF E .EQS. "," THEN GOTO LOOP_LIB_END | ||
139 | $ SET NOON | ||
140 | $ IF F$SEARCH(EXE_DIR+E+".OLB") .NES. "" | ||
141 | $ THEN | ||
142 | $ COPY 'EXE_DIR''E'.OLB WRK_SSLLIB:'E'.OLB/log | ||
143 | $ SET FILE/PROT=W:RE WRK_SSLLIB:'E'.OLB | ||
144 | $ ENDIF | ||
145 | $ ! Preparing for the time when we have shareable images | ||
146 | $ IF F$SEARCH(EXE_DIR+E+".EXE") .NES. "" | ||
147 | $ THEN | ||
148 | $ COPY 'EXE_DIR''E'.EXE WRK_SSLLIB:'E'.EXE/log | ||
149 | $ SET FILE/PROT=W:RE WRK_SSLLIB:'E'.EXE | ||
150 | $ ENDIF | ||
151 | $ SET ON | ||
152 | $ GOTO LOOP_LIB | ||
153 | $ LOOP_LIB_END: | ||
154 | $ | ||
155 | $ EXIT | ||
diff --git a/src/lib/libcrypto/md4/md4_dgst.c b/src/lib/libcrypto/md4/md4_dgst.c index 82c2cb2d98..b5b165b052 100644 --- a/src/lib/libcrypto/md4/md4_dgst.c +++ b/src/lib/libcrypto/md4/md4_dgst.c | |||
@@ -106,22 +106,23 @@ void md4_block_data_order (MD4_CTX *c, const void *data_, size_t num) | |||
106 | 106 | ||
107 | for (;num--;) | 107 | for (;num--;) |
108 | { | 108 | { |
109 | HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l; | 109 | (void)HOST_c2l(data,l); X( 0)=l; |
110 | (void)HOST_c2l(data,l); X( 1)=l; | ||
110 | /* Round 0 */ | 111 | /* Round 0 */ |
111 | R0(A,B,C,D,X( 0), 3,0); HOST_c2l(data,l); X( 2)=l; | 112 | R0(A,B,C,D,X( 0), 3,0); (void)HOST_c2l(data,l); X( 2)=l; |
112 | R0(D,A,B,C,X( 1), 7,0); HOST_c2l(data,l); X( 3)=l; | 113 | R0(D,A,B,C,X( 1), 7,0); (void)HOST_c2l(data,l); X( 3)=l; |
113 | R0(C,D,A,B,X( 2),11,0); HOST_c2l(data,l); X( 4)=l; | 114 | R0(C,D,A,B,X( 2),11,0); (void)HOST_c2l(data,l); X( 4)=l; |
114 | R0(B,C,D,A,X( 3),19,0); HOST_c2l(data,l); X( 5)=l; | 115 | R0(B,C,D,A,X( 3),19,0); (void)HOST_c2l(data,l); X( 5)=l; |
115 | R0(A,B,C,D,X( 4), 3,0); HOST_c2l(data,l); X( 6)=l; | 116 | R0(A,B,C,D,X( 4), 3,0); (void)HOST_c2l(data,l); X( 6)=l; |
116 | R0(D,A,B,C,X( 5), 7,0); HOST_c2l(data,l); X( 7)=l; | 117 | R0(D,A,B,C,X( 5), 7,0); (void)HOST_c2l(data,l); X( 7)=l; |
117 | R0(C,D,A,B,X( 6),11,0); HOST_c2l(data,l); X( 8)=l; | 118 | R0(C,D,A,B,X( 6),11,0); (void)HOST_c2l(data,l); X( 8)=l; |
118 | R0(B,C,D,A,X( 7),19,0); HOST_c2l(data,l); X( 9)=l; | 119 | R0(B,C,D,A,X( 7),19,0); (void)HOST_c2l(data,l); X( 9)=l; |
119 | R0(A,B,C,D,X( 8), 3,0); HOST_c2l(data,l); X(10)=l; | 120 | R0(A,B,C,D,X( 8), 3,0); (void)HOST_c2l(data,l); X(10)=l; |
120 | R0(D,A,B,C,X( 9), 7,0); HOST_c2l(data,l); X(11)=l; | 121 | R0(D,A,B,C,X( 9), 7,0); (void)HOST_c2l(data,l); X(11)=l; |
121 | R0(C,D,A,B,X(10),11,0); HOST_c2l(data,l); X(12)=l; | 122 | R0(C,D,A,B,X(10),11,0); (void)HOST_c2l(data,l); X(12)=l; |
122 | R0(B,C,D,A,X(11),19,0); HOST_c2l(data,l); X(13)=l; | 123 | R0(B,C,D,A,X(11),19,0); (void)HOST_c2l(data,l); X(13)=l; |
123 | R0(A,B,C,D,X(12), 3,0); HOST_c2l(data,l); X(14)=l; | 124 | R0(A,B,C,D,X(12), 3,0); (void)HOST_c2l(data,l); X(14)=l; |
124 | R0(D,A,B,C,X(13), 7,0); HOST_c2l(data,l); X(15)=l; | 125 | R0(D,A,B,C,X(13), 7,0); (void)HOST_c2l(data,l); X(15)=l; |
125 | R0(C,D,A,B,X(14),11,0); | 126 | R0(C,D,A,B,X(14),11,0); |
126 | R0(B,C,D,A,X(15),19,0); | 127 | R0(B,C,D,A,X(15),19,0); |
127 | /* Round 1 */ | 128 | /* Round 1 */ |
diff --git a/src/lib/libcrypto/md4/md4_locl.h b/src/lib/libcrypto/md4/md4_locl.h index c8085b0ead..99c3e5004c 100644 --- a/src/lib/libcrypto/md4/md4_locl.h +++ b/src/lib/libcrypto/md4/md4_locl.h | |||
@@ -77,10 +77,10 @@ void md4_block_data_order (MD4_CTX *c, const void *p,size_t num); | |||
77 | #define HASH_FINAL MD4_Final | 77 | #define HASH_FINAL MD4_Final |
78 | #define HASH_MAKE_STRING(c,s) do { \ | 78 | #define HASH_MAKE_STRING(c,s) do { \ |
79 | unsigned long ll; \ | 79 | unsigned long ll; \ |
80 | ll=(c)->A; HOST_l2c(ll,(s)); \ | 80 | ll=(c)->A; (void)HOST_l2c(ll,(s)); \ |
81 | ll=(c)->B; HOST_l2c(ll,(s)); \ | 81 | ll=(c)->B; (void)HOST_l2c(ll,(s)); \ |
82 | ll=(c)->C; HOST_l2c(ll,(s)); \ | 82 | ll=(c)->C; (void)HOST_l2c(ll,(s)); \ |
83 | ll=(c)->D; HOST_l2c(ll,(s)); \ | 83 | ll=(c)->D; (void)HOST_l2c(ll,(s)); \ |
84 | } while (0) | 84 | } while (0) |
85 | #define HASH_BLOCK_DATA_ORDER md4_block_data_order | 85 | #define HASH_BLOCK_DATA_ORDER md4_block_data_order |
86 | 86 | ||
diff --git a/src/lib/libcrypto/md5/md5_locl.h b/src/lib/libcrypto/md5/md5_locl.h index 968d577995..74d63d1f9c 100644 --- a/src/lib/libcrypto/md5/md5_locl.h +++ b/src/lib/libcrypto/md5/md5_locl.h | |||
@@ -86,10 +86,10 @@ void md5_block_data_order (MD5_CTX *c, const void *p,size_t num); | |||
86 | #define HASH_FINAL MD5_Final | 86 | #define HASH_FINAL MD5_Final |
87 | #define HASH_MAKE_STRING(c,s) do { \ | 87 | #define HASH_MAKE_STRING(c,s) do { \ |
88 | unsigned long ll; \ | 88 | unsigned long ll; \ |
89 | ll=(c)->A; HOST_l2c(ll,(s)); \ | 89 | ll=(c)->A; (void)HOST_l2c(ll,(s)); \ |
90 | ll=(c)->B; HOST_l2c(ll,(s)); \ | 90 | ll=(c)->B; (void)HOST_l2c(ll,(s)); \ |
91 | ll=(c)->C; HOST_l2c(ll,(s)); \ | 91 | ll=(c)->C; (void)HOST_l2c(ll,(s)); \ |
92 | ll=(c)->D; HOST_l2c(ll,(s)); \ | 92 | ll=(c)->D; (void)HOST_l2c(ll,(s)); \ |
93 | } while (0) | 93 | } while (0) |
94 | #define HASH_BLOCK_DATA_ORDER md5_block_data_order | 94 | #define HASH_BLOCK_DATA_ORDER md5_block_data_order |
95 | 95 | ||
diff --git a/src/lib/libcrypto/mdc2/mdc2dgst.c b/src/lib/libcrypto/mdc2/mdc2dgst.c index b74bb1a759..d66ed6a1c6 100644 --- a/src/lib/libcrypto/mdc2/mdc2dgst.c +++ b/src/lib/libcrypto/mdc2/mdc2dgst.c | |||
@@ -59,9 +59,9 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <string.h> | 61 | #include <string.h> |
62 | #include <openssl/crypto.h> | ||
62 | #include <openssl/des.h> | 63 | #include <openssl/des.h> |
63 | #include <openssl/mdc2.h> | 64 | #include <openssl/mdc2.h> |
64 | #include <openssl/crypto.h> | ||
65 | 65 | ||
66 | #undef c2l | 66 | #undef c2l |
67 | #define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ | 67 | #define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ |
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c index 24ccf729ca..55e829dc92 100644 --- a/src/lib/libcrypto/mem.c +++ b/src/lib/libcrypto/mem.c | |||
@@ -121,10 +121,10 @@ static void (*set_debug_options_func)(long) = NULL; | |||
121 | static long (*get_debug_options_func)(void) = NULL; | 121 | static long (*get_debug_options_func)(void) = NULL; |
122 | #endif | 122 | #endif |
123 | 123 | ||
124 | |||
125 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), | 124 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), |
126 | void (*f)(void *)) | 125 | void (*f)(void *)) |
127 | { | 126 | { |
127 | /* Dummy call just to ensure OPENSSL_init() gets linked in */ | ||
128 | OPENSSL_init(); | 128 | OPENSSL_init(); |
129 | if (!allow_customize) | 129 | if (!allow_customize) |
130 | return 0; | 130 | return 0; |
diff --git a/src/lib/libcrypto/modes/Makefile b/src/lib/libcrypto/modes/Makefile index 3d8bafd571..c825b12f25 100644 --- a/src/lib/libcrypto/modes/Makefile +++ b/src/lib/libcrypto/modes/Makefile | |||
@@ -53,10 +53,7 @@ ghash-x86_64.s: asm/ghash-x86_64.pl | |||
53 | ghash-sparcv9.s: asm/ghash-sparcv9.pl | 53 | ghash-sparcv9.s: asm/ghash-sparcv9.pl |
54 | $(PERL) asm/ghash-sparcv9.pl $@ $(CFLAGS) | 54 | $(PERL) asm/ghash-sparcv9.pl $@ $(CFLAGS) |
55 | ghash-alpha.s: asm/ghash-alpha.pl | 55 | ghash-alpha.s: asm/ghash-alpha.pl |
56 | (preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \ | 56 | $(PERL) $< | $(CC) -E - | tee $@ > /dev/null |
57 | $(PERL) asm/ghash-alpha.pl > $$preproc && \ | ||
58 | $(CC) -E $$preproc > $@ && rm $$preproc) | ||
59 | |||
60 | ghash-parisc.s: asm/ghash-parisc.pl | 57 | ghash-parisc.s: asm/ghash-parisc.pl |
61 | $(PERL) asm/ghash-parisc.pl $(PERLASM_SCHEME) $@ | 58 | $(PERL) asm/ghash-parisc.pl $(PERLASM_SCHEME) $@ |
62 | 59 | ||
diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c index 84380a96a9..4a548c2ed4 100644 --- a/src/lib/libcrypto/objects/o_names.c +++ b/src/lib/libcrypto/objects/o_names.c | |||
@@ -73,7 +73,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), | |||
73 | name_funcs_stack=sk_NAME_FUNCS_new_null(); | 73 | name_funcs_stack=sk_NAME_FUNCS_new_null(); |
74 | MemCheck_on(); | 74 | MemCheck_on(); |
75 | } | 75 | } |
76 | if ((name_funcs_stack == NULL)) | 76 | if (name_funcs_stack == NULL) |
77 | { | 77 | { |
78 | /* ERROR */ | 78 | /* ERROR */ |
79 | return(0); | 79 | return(0); |
diff --git a/src/lib/libcrypto/ocsp/ocsp_vfy.c b/src/lib/libcrypto/ocsp/ocsp_vfy.c index 91a45c9133..276718304d 100644 --- a/src/lib/libcrypto/ocsp/ocsp_vfy.c +++ b/src/lib/libcrypto/ocsp/ocsp_vfy.c | |||
@@ -111,6 +111,7 @@ int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, | |||
111 | init_res = X509_STORE_CTX_init(&ctx, st, signer, bs->certs); | 111 | init_res = X509_STORE_CTX_init(&ctx, st, signer, bs->certs); |
112 | if(!init_res) | 112 | if(!init_res) |
113 | { | 113 | { |
114 | ret = -1; | ||
114 | OCSPerr(OCSP_F_OCSP_BASIC_VERIFY,ERR_R_X509_LIB); | 115 | OCSPerr(OCSP_F_OCSP_BASIC_VERIFY,ERR_R_X509_LIB); |
115 | goto end; | 116 | goto end; |
116 | } | 117 | } |
diff --git a/src/lib/libcrypto/opensslv.h b/src/lib/libcrypto/opensslv.h index 71be3590af..ebe7180723 100644 --- a/src/lib/libcrypto/opensslv.h +++ b/src/lib/libcrypto/opensslv.h | |||
@@ -25,11 +25,11 @@ | |||
25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for | 25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for |
26 | * major minor fix final patch/beta) | 26 | * major minor fix final patch/beta) |
27 | */ | 27 | */ |
28 | #define OPENSSL_VERSION_NUMBER 0x1000103fL | 28 | #define OPENSSL_VERSION_NUMBER 0x1000107fL |
29 | #ifdef OPENSSL_FIPS | 29 | #ifdef OPENSSL_FIPS |
30 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c-fips 10 May 2012" | 30 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1g-fips 7 Apr 2014" |
31 | #else | 31 | #else |
32 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c 10 May 2012" | 32 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1g 7 Apr 2014" |
33 | #endif | 33 | #endif |
34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT | 34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT |
35 | 35 | ||
diff --git a/src/lib/libcrypto/pem/pem_all.c b/src/lib/libcrypto/pem/pem_all.c index 3e7a6093ad..eac0460e3e 100644 --- a/src/lib/libcrypto/pem/pem_all.c +++ b/src/lib/libcrypto/pem/pem_all.c | |||
@@ -193,7 +193,61 @@ RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **rsa, pem_password_cb *cb, | |||
193 | 193 | ||
194 | #endif | 194 | #endif |
195 | 195 | ||
196 | #ifdef OPENSSL_FIPS | ||
197 | |||
198 | int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc, | ||
199 | unsigned char *kstr, int klen, | ||
200 | pem_password_cb *cb, void *u) | ||
201 | { | ||
202 | if (FIPS_mode()) | ||
203 | { | ||
204 | EVP_PKEY *k; | ||
205 | int ret; | ||
206 | k = EVP_PKEY_new(); | ||
207 | if (!k) | ||
208 | return 0; | ||
209 | EVP_PKEY_set1_RSA(k, x); | ||
210 | |||
211 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
212 | EVP_PKEY_free(k); | ||
213 | return ret; | ||
214 | } | ||
215 | else | ||
216 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSAPrivateKey, | ||
217 | PEM_STRING_RSA,bp,x,enc,kstr,klen,cb,u); | ||
218 | } | ||
219 | |||
220 | #ifndef OPENSSL_NO_FP_API | ||
221 | int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, | ||
222 | unsigned char *kstr, int klen, | ||
223 | pem_password_cb *cb, void *u) | ||
224 | { | ||
225 | if (FIPS_mode()) | ||
226 | { | ||
227 | EVP_PKEY *k; | ||
228 | int ret; | ||
229 | k = EVP_PKEY_new(); | ||
230 | if (!k) | ||
231 | return 0; | ||
232 | |||
233 | EVP_PKEY_set1_RSA(k, x); | ||
234 | |||
235 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
236 | EVP_PKEY_free(k); | ||
237 | return ret; | ||
238 | } | ||
239 | else | ||
240 | return PEM_ASN1_write((i2d_of_void *)i2d_RSAPrivateKey, | ||
241 | PEM_STRING_RSA,fp,x,enc,kstr,klen,cb,u); | ||
242 | } | ||
243 | #endif | ||
244 | |||
245 | #else | ||
246 | |||
196 | IMPLEMENT_PEM_write_cb_const(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey) | 247 | IMPLEMENT_PEM_write_cb_const(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey) |
248 | |||
249 | #endif | ||
250 | |||
197 | IMPLEMENT_PEM_rw_const(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey) | 251 | IMPLEMENT_PEM_rw_const(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey) |
198 | IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY) | 252 | IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY) |
199 | 253 | ||
@@ -223,7 +277,59 @@ DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb, | |||
223 | return pkey_get_dsa(pktmp, dsa); /* will free pktmp */ | 277 | return pkey_get_dsa(pktmp, dsa); /* will free pktmp */ |
224 | } | 278 | } |
225 | 279 | ||
280 | #ifdef OPENSSL_FIPS | ||
281 | |||
282 | int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, | ||
283 | unsigned char *kstr, int klen, | ||
284 | pem_password_cb *cb, void *u) | ||
285 | { | ||
286 | if (FIPS_mode()) | ||
287 | { | ||
288 | EVP_PKEY *k; | ||
289 | int ret; | ||
290 | k = EVP_PKEY_new(); | ||
291 | if (!k) | ||
292 | return 0; | ||
293 | EVP_PKEY_set1_DSA(k, x); | ||
294 | |||
295 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
296 | EVP_PKEY_free(k); | ||
297 | return ret; | ||
298 | } | ||
299 | else | ||
300 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAPrivateKey, | ||
301 | PEM_STRING_DSA,bp,x,enc,kstr,klen,cb,u); | ||
302 | } | ||
303 | |||
304 | #ifndef OPENSSL_NO_FP_API | ||
305 | int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, | ||
306 | unsigned char *kstr, int klen, | ||
307 | pem_password_cb *cb, void *u) | ||
308 | { | ||
309 | if (FIPS_mode()) | ||
310 | { | ||
311 | EVP_PKEY *k; | ||
312 | int ret; | ||
313 | k = EVP_PKEY_new(); | ||
314 | if (!k) | ||
315 | return 0; | ||
316 | EVP_PKEY_set1_DSA(k, x); | ||
317 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
318 | EVP_PKEY_free(k); | ||
319 | return ret; | ||
320 | } | ||
321 | else | ||
322 | return PEM_ASN1_write((i2d_of_void *)i2d_DSAPrivateKey, | ||
323 | PEM_STRING_DSA,fp,x,enc,kstr,klen,cb,u); | ||
324 | } | ||
325 | #endif | ||
326 | |||
327 | #else | ||
328 | |||
226 | IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey) | 329 | IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey) |
330 | |||
331 | #endif | ||
332 | |||
227 | IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY) | 333 | IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY) |
228 | 334 | ||
229 | #ifndef OPENSSL_NO_FP_API | 335 | #ifndef OPENSSL_NO_FP_API |
@@ -269,8 +375,63 @@ EC_KEY *PEM_read_bio_ECPrivateKey(BIO *bp, EC_KEY **key, pem_password_cb *cb, | |||
269 | 375 | ||
270 | IMPLEMENT_PEM_rw_const(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, ECPKParameters) | 376 | IMPLEMENT_PEM_rw_const(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, ECPKParameters) |
271 | 377 | ||
378 | |||
379 | |||
380 | #ifdef OPENSSL_FIPS | ||
381 | |||
382 | int PEM_write_bio_ECPrivateKey(BIO *bp, EC_KEY *x, const EVP_CIPHER *enc, | ||
383 | unsigned char *kstr, int klen, | ||
384 | pem_password_cb *cb, void *u) | ||
385 | { | ||
386 | if (FIPS_mode()) | ||
387 | { | ||
388 | EVP_PKEY *k; | ||
389 | int ret; | ||
390 | k = EVP_PKEY_new(); | ||
391 | if (!k) | ||
392 | return 0; | ||
393 | EVP_PKEY_set1_EC_KEY(k, x); | ||
394 | |||
395 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
396 | EVP_PKEY_free(k); | ||
397 | return ret; | ||
398 | } | ||
399 | else | ||
400 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_ECPrivateKey, | ||
401 | PEM_STRING_ECPRIVATEKEY, | ||
402 | bp,x,enc,kstr,klen,cb,u); | ||
403 | } | ||
404 | |||
405 | #ifndef OPENSSL_NO_FP_API | ||
406 | int PEM_write_ECPrivateKey(FILE *fp, EC_KEY *x, const EVP_CIPHER *enc, | ||
407 | unsigned char *kstr, int klen, | ||
408 | pem_password_cb *cb, void *u) | ||
409 | { | ||
410 | if (FIPS_mode()) | ||
411 | { | ||
412 | EVP_PKEY *k; | ||
413 | int ret; | ||
414 | k = EVP_PKEY_new(); | ||
415 | if (!k) | ||
416 | return 0; | ||
417 | EVP_PKEY_set1_EC_KEY(k, x); | ||
418 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
419 | EVP_PKEY_free(k); | ||
420 | return ret; | ||
421 | } | ||
422 | else | ||
423 | return PEM_ASN1_write((i2d_of_void *)i2d_ECPrivateKey, | ||
424 | PEM_STRING_ECPRIVATEKEY, | ||
425 | fp,x,enc,kstr,klen,cb,u); | ||
426 | } | ||
427 | #endif | ||
428 | |||
429 | #else | ||
430 | |||
272 | IMPLEMENT_PEM_write_cb(ECPrivateKey, EC_KEY, PEM_STRING_ECPRIVATEKEY, ECPrivateKey) | 431 | IMPLEMENT_PEM_write_cb(ECPrivateKey, EC_KEY, PEM_STRING_ECPRIVATEKEY, ECPrivateKey) |
273 | 432 | ||
433 | #endif | ||
434 | |||
274 | IMPLEMENT_PEM_rw(EC_PUBKEY, EC_KEY, PEM_STRING_PUBLIC, EC_PUBKEY) | 435 | IMPLEMENT_PEM_rw(EC_PUBKEY, EC_KEY, PEM_STRING_PUBLIC, EC_PUBKEY) |
275 | 436 | ||
276 | #ifndef OPENSSL_NO_FP_API | 437 | #ifndef OPENSSL_NO_FP_API |
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c index 1b2be527ed..cc7f24a9c1 100644 --- a/src/lib/libcrypto/pem/pem_info.c +++ b/src/lib/libcrypto/pem/pem_info.c | |||
@@ -167,6 +167,7 @@ start: | |||
167 | #ifndef OPENSSL_NO_RSA | 167 | #ifndef OPENSSL_NO_RSA |
168 | if (strcmp(name,PEM_STRING_RSA) == 0) | 168 | if (strcmp(name,PEM_STRING_RSA) == 0) |
169 | { | 169 | { |
170 | d2i=(D2I_OF(void))d2i_RSAPrivateKey; | ||
170 | if (xi->x_pkey != NULL) | 171 | if (xi->x_pkey != NULL) |
171 | { | 172 | { |
172 | if (!sk_X509_INFO_push(ret,xi)) goto err; | 173 | if (!sk_X509_INFO_push(ret,xi)) goto err; |
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index cfc89a9921..5a421fc4b6 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c | |||
@@ -394,7 +394,8 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, | |||
394 | goto err; | 394 | goto err; |
395 | /* The 'iv' is used as the iv and as a salt. It is | 395 | /* The 'iv' is used as the iv and as a salt. It is |
396 | * NOT taken from the BytesToKey function */ | 396 | * NOT taken from the BytesToKey function */ |
397 | EVP_BytesToKey(enc,EVP_md5(),iv,kstr,klen,1,key,NULL); | 397 | if (!EVP_BytesToKey(enc,EVP_md5(),iv,kstr,klen,1,key,NULL)) |
398 | goto err; | ||
398 | 399 | ||
399 | if (kstr == (unsigned char *)buf) OPENSSL_cleanse(buf,PEM_BUFSIZE); | 400 | if (kstr == (unsigned char *)buf) OPENSSL_cleanse(buf,PEM_BUFSIZE); |
400 | 401 | ||
@@ -406,12 +407,15 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, | |||
406 | /* k=strlen(buf); */ | 407 | /* k=strlen(buf); */ |
407 | 408 | ||
408 | EVP_CIPHER_CTX_init(&ctx); | 409 | EVP_CIPHER_CTX_init(&ctx); |
409 | EVP_EncryptInit_ex(&ctx,enc,NULL,key,iv); | 410 | ret = 1; |
410 | EVP_EncryptUpdate(&ctx,data,&j,data,i); | 411 | if (!EVP_EncryptInit_ex(&ctx,enc,NULL,key,iv) |
411 | EVP_EncryptFinal_ex(&ctx,&(data[j]),&i); | 412 | || !EVP_EncryptUpdate(&ctx,data,&j,data,i) |
413 | || !EVP_EncryptFinal_ex(&ctx,&(data[j]),&i)) | ||
414 | ret = 0; | ||
412 | EVP_CIPHER_CTX_cleanup(&ctx); | 415 | EVP_CIPHER_CTX_cleanup(&ctx); |
416 | if (ret == 0) | ||
417 | goto err; | ||
413 | i+=j; | 418 | i+=j; |
414 | ret=1; | ||
415 | } | 419 | } |
416 | else | 420 | else |
417 | { | 421 | { |
@@ -459,14 +463,17 @@ int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen, | |||
459 | ebcdic2ascii(buf, buf, klen); | 463 | ebcdic2ascii(buf, buf, klen); |
460 | #endif | 464 | #endif |
461 | 465 | ||
462 | EVP_BytesToKey(cipher->cipher,EVP_md5(),&(cipher->iv[0]), | 466 | if (!EVP_BytesToKey(cipher->cipher,EVP_md5(),&(cipher->iv[0]), |
463 | (unsigned char *)buf,klen,1,key,NULL); | 467 | (unsigned char *)buf,klen,1,key,NULL)) |
468 | return 0; | ||
464 | 469 | ||
465 | j=(int)len; | 470 | j=(int)len; |
466 | EVP_CIPHER_CTX_init(&ctx); | 471 | EVP_CIPHER_CTX_init(&ctx); |
467 | EVP_DecryptInit_ex(&ctx,cipher->cipher,NULL, key,&(cipher->iv[0])); | 472 | o = EVP_DecryptInit_ex(&ctx,cipher->cipher,NULL, key,&(cipher->iv[0])); |
468 | EVP_DecryptUpdate(&ctx,data,&i,data,j); | 473 | if (o) |
469 | o=EVP_DecryptFinal_ex(&ctx,&(data[i]),&j); | 474 | o = EVP_DecryptUpdate(&ctx,data,&i,data,j); |
475 | if (o) | ||
476 | o = EVP_DecryptFinal_ex(&ctx,&(data[i]),&j); | ||
470 | EVP_CIPHER_CTX_cleanup(&ctx); | 477 | EVP_CIPHER_CTX_cleanup(&ctx); |
471 | OPENSSL_cleanse((char *)buf,sizeof(buf)); | 478 | OPENSSL_cleanse((char *)buf,sizeof(buf)); |
472 | OPENSSL_cleanse((char *)key,sizeof(key)); | 479 | OPENSSL_cleanse((char *)key,sizeof(key)); |
diff --git a/src/lib/libcrypto/pem/pem_seal.c b/src/lib/libcrypto/pem/pem_seal.c index 59690b56ae..b6b4e13498 100644 --- a/src/lib/libcrypto/pem/pem_seal.c +++ b/src/lib/libcrypto/pem/pem_seal.c | |||
@@ -96,7 +96,8 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, | |||
96 | EVP_EncodeInit(&ctx->encode); | 96 | EVP_EncodeInit(&ctx->encode); |
97 | 97 | ||
98 | EVP_MD_CTX_init(&ctx->md); | 98 | EVP_MD_CTX_init(&ctx->md); |
99 | EVP_SignInit(&ctx->md,md_type); | 99 | if (!EVP_SignInit(&ctx->md,md_type)) |
100 | goto err; | ||
100 | 101 | ||
101 | EVP_CIPHER_CTX_init(&ctx->cipher); | 102 | EVP_CIPHER_CTX_init(&ctx->cipher); |
102 | ret=EVP_SealInit(&ctx->cipher,type,ek,ekl,iv,pubk,npubk); | 103 | ret=EVP_SealInit(&ctx->cipher,type,ek,ekl,iv,pubk,npubk); |
@@ -163,7 +164,8 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, | |||
163 | goto err; | 164 | goto err; |
164 | } | 165 | } |
165 | 166 | ||
166 | EVP_EncryptFinal_ex(&ctx->cipher,s,(int *)&i); | 167 | if (!EVP_EncryptFinal_ex(&ctx->cipher,s,(int *)&i)) |
168 | goto err; | ||
167 | EVP_EncodeUpdate(&ctx->encode,out,&j,s,i); | 169 | EVP_EncodeUpdate(&ctx->encode,out,&j,s,i); |
168 | *outl=j; | 170 | *outl=j; |
169 | out+=j; | 171 | out+=j; |
diff --git a/src/lib/libcrypto/perlasm/cbc.pl b/src/lib/libcrypto/perlasm/cbc.pl index 6fc2510905..24561e759a 100644 --- a/src/lib/libcrypto/perlasm/cbc.pl +++ b/src/lib/libcrypto/perlasm/cbc.pl | |||
@@ -150,7 +150,7 @@ sub cbc | |||
150 | &set_label("PIC_point"); | 150 | &set_label("PIC_point"); |
151 | &blindpop("edx"); | 151 | &blindpop("edx"); |
152 | &lea("ecx",&DWP(&label("cbc_enc_jmp_table")."-".&label("PIC_point"),"edx")); | 152 | &lea("ecx",&DWP(&label("cbc_enc_jmp_table")."-".&label("PIC_point"),"edx")); |
153 | &mov($count,&DWP(0,"ecx",$count,4)) | 153 | &mov($count,&DWP(0,"ecx",$count,4)); |
154 | &add($count,"edx"); | 154 | &add($count,"edx"); |
155 | &xor("ecx","ecx"); | 155 | &xor("ecx","ecx"); |
156 | &xor("edx","edx"); | 156 | &xor("edx","edx"); |
diff --git a/src/lib/libcrypto/pkcs12/p12_crt.c b/src/lib/libcrypto/pkcs12/p12_crt.c index 96b131defa..a34915d02d 100644 --- a/src/lib/libcrypto/pkcs12/p12_crt.c +++ b/src/lib/libcrypto/pkcs12/p12_crt.c | |||
@@ -90,7 +90,14 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, | |||
90 | 90 | ||
91 | /* Set defaults */ | 91 | /* Set defaults */ |
92 | if (!nid_cert) | 92 | if (!nid_cert) |
93 | { | ||
94 | #ifdef OPENSSL_FIPS | ||
95 | if (FIPS_mode()) | ||
96 | nid_cert = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | ||
97 | else | ||
98 | #endif | ||
93 | nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC; | 99 | nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC; |
100 | } | ||
94 | if (!nid_key) | 101 | if (!nid_key) |
95 | nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | 102 | nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; |
96 | if (!iter) | 103 | if (!iter) |
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c index c55c7b60b3..61d58502fd 100644 --- a/src/lib/libcrypto/pkcs12/p12_key.c +++ b/src/lib/libcrypto/pkcs12/p12_key.c | |||
@@ -176,24 +176,32 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
176 | out += u; | 176 | out += u; |
177 | for (j = 0; j < v; j++) B[j] = Ai[j % u]; | 177 | for (j = 0; j < v; j++) B[j] = Ai[j % u]; |
178 | /* Work out B + 1 first then can use B as tmp space */ | 178 | /* Work out B + 1 first then can use B as tmp space */ |
179 | if (!BN_bin2bn (B, v, Bpl1)) goto err; | 179 | if (!BN_bin2bn (B, v, Bpl1)) |
180 | if (!BN_add_word (Bpl1, 1)) goto err; | 180 | goto err; |
181 | if (!BN_add_word (Bpl1, 1)) | ||
182 | goto err; | ||
181 | for (j = 0; j < Ilen ; j+=v) { | 183 | for (j = 0; j < Ilen ; j+=v) { |
182 | if (!BN_bin2bn (I + j, v, Ij)) goto err; | 184 | if (!BN_bin2bn(I + j, v, Ij)) |
183 | if (!BN_add (Ij, Ij, Bpl1)) goto err; | 185 | goto err; |
184 | BN_bn2bin (Ij, B); | 186 | if (!BN_add(Ij, Ij, Bpl1)) |
187 | goto err; | ||
188 | if (!BN_bn2bin(Ij, B)) | ||
189 | goto err; | ||
185 | Ijlen = BN_num_bytes (Ij); | 190 | Ijlen = BN_num_bytes (Ij); |
186 | /* If more than 2^(v*8) - 1 cut off MSB */ | 191 | /* If more than 2^(v*8) - 1 cut off MSB */ |
187 | if (Ijlen > v) { | 192 | if (Ijlen > v) { |
188 | BN_bn2bin (Ij, B); | 193 | if (!BN_bn2bin (Ij, B)) |
194 | goto err; | ||
189 | memcpy (I + j, B + 1, v); | 195 | memcpy (I + j, B + 1, v); |
190 | #ifndef PKCS12_BROKEN_KEYGEN | 196 | #ifndef PKCS12_BROKEN_KEYGEN |
191 | /* If less than v bytes pad with zeroes */ | 197 | /* If less than v bytes pad with zeroes */ |
192 | } else if (Ijlen < v) { | 198 | } else if (Ijlen < v) { |
193 | memset(I + j, 0, v - Ijlen); | 199 | memset(I + j, 0, v - Ijlen); |
194 | BN_bn2bin(Ij, I + j + v - Ijlen); | 200 | if (!BN_bn2bin(Ij, I + j + v - Ijlen)) |
201 | goto err; | ||
195 | #endif | 202 | #endif |
196 | } else BN_bn2bin (Ij, I + j); | 203 | } else if (!BN_bn2bin (Ij, I + j)) |
204 | goto err; | ||
197 | } | 205 | } |
198 | } | 206 | } |
199 | 207 | ||
diff --git a/src/lib/libcrypto/rand/md_rand.c b/src/lib/libcrypto/rand/md_rand.c index fcdd3f2a84..aee1c30b0a 100644 --- a/src/lib/libcrypto/rand/md_rand.c +++ b/src/lib/libcrypto/rand/md_rand.c | |||
@@ -123,10 +123,10 @@ | |||
123 | 123 | ||
124 | #include "e_os.h" | 124 | #include "e_os.h" |
125 | 125 | ||
126 | #include <openssl/crypto.h> | ||
126 | #include <openssl/rand.h> | 127 | #include <openssl/rand.h> |
127 | #include "rand_lcl.h" | 128 | #include "rand_lcl.h" |
128 | 129 | ||
129 | #include <openssl/crypto.h> | ||
130 | #include <openssl/err.h> | 130 | #include <openssl/err.h> |
131 | 131 | ||
132 | #ifdef BN_DEBUG | 132 | #ifdef BN_DEBUG |
@@ -198,6 +198,9 @@ static void ssleay_rand_add(const void *buf, int num, double add) | |||
198 | EVP_MD_CTX m; | 198 | EVP_MD_CTX m; |
199 | int do_not_lock; | 199 | int do_not_lock; |
200 | 200 | ||
201 | if (!num) | ||
202 | return; | ||
203 | |||
201 | /* | 204 | /* |
202 | * (Based on the rand(3) manpage) | 205 | * (Based on the rand(3) manpage) |
203 | * | 206 | * |
@@ -380,8 +383,11 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo) | |||
380 | * are fed into the hash function and the results are kept in the | 383 | * are fed into the hash function and the results are kept in the |
381 | * global 'md'. | 384 | * global 'md'. |
382 | */ | 385 | */ |
383 | 386 | #ifdef OPENSSL_FIPS | |
384 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | 387 | /* NB: in FIPS mode we are already under a lock */ |
388 | if (!FIPS_mode()) | ||
389 | #endif | ||
390 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
385 | 391 | ||
386 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ | 392 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ |
387 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); | 393 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); |
@@ -460,7 +466,10 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo) | |||
460 | 466 | ||
461 | /* before unlocking, we must clear 'crypto_lock_rand' */ | 467 | /* before unlocking, we must clear 'crypto_lock_rand' */ |
462 | crypto_lock_rand = 0; | 468 | crypto_lock_rand = 0; |
463 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | 469 | #ifdef OPENSSL_FIPS |
470 | if (!FIPS_mode()) | ||
471 | #endif | ||
472 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
464 | 473 | ||
465 | while (num > 0) | 474 | while (num > 0) |
466 | { | 475 | { |
@@ -512,10 +521,16 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo) | |||
512 | MD_Init(&m); | 521 | MD_Init(&m); |
513 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); | 522 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); |
514 | MD_Update(&m,local_md,MD_DIGEST_LENGTH); | 523 | MD_Update(&m,local_md,MD_DIGEST_LENGTH); |
515 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | 524 | #ifdef OPENSSL_FIPS |
525 | if (!FIPS_mode()) | ||
526 | #endif | ||
527 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
516 | MD_Update(&m,md,MD_DIGEST_LENGTH); | 528 | MD_Update(&m,md,MD_DIGEST_LENGTH); |
517 | MD_Final(&m,md); | 529 | MD_Final(&m,md); |
518 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | 530 | #ifdef OPENSSL_FIPS |
531 | if (!FIPS_mode()) | ||
532 | #endif | ||
533 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
519 | 534 | ||
520 | EVP_MD_CTX_cleanup(&m); | 535 | EVP_MD_CTX_cleanup(&m); |
521 | if (ok) | 536 | if (ok) |
diff --git a/src/lib/libcrypto/rand/rand.h b/src/lib/libcrypto/rand/rand.h index dc8fcf94c5..bb5520e80a 100644 --- a/src/lib/libcrypto/rand/rand.h +++ b/src/lib/libcrypto/rand/rand.h | |||
@@ -138,6 +138,7 @@ void ERR_load_RAND_strings(void); | |||
138 | #define RAND_F_SSLEAY_RAND_BYTES 100 | 138 | #define RAND_F_SSLEAY_RAND_BYTES 100 |
139 | 139 | ||
140 | /* Reason codes. */ | 140 | /* Reason codes. */ |
141 | #define RAND_R_DUAL_EC_DRBG_DISABLED 104 | ||
141 | #define RAND_R_ERROR_INITIALISING_DRBG 102 | 142 | #define RAND_R_ERROR_INITIALISING_DRBG 102 |
142 | #define RAND_R_ERROR_INSTANTIATING_DRBG 103 | 143 | #define RAND_R_ERROR_INSTANTIATING_DRBG 103 |
143 | #define RAND_R_NO_FIPS_RANDOM_METHOD_SET 101 | 144 | #define RAND_R_NO_FIPS_RANDOM_METHOD_SET 101 |
diff --git a/src/lib/libcrypto/rand/rand_err.c b/src/lib/libcrypto/rand/rand_err.c index b8586c8f4a..c4c80fc8cc 100644 --- a/src/lib/libcrypto/rand/rand_err.c +++ b/src/lib/libcrypto/rand/rand_err.c | |||
@@ -78,6 +78,7 @@ static ERR_STRING_DATA RAND_str_functs[]= | |||
78 | 78 | ||
79 | static ERR_STRING_DATA RAND_str_reasons[]= | 79 | static ERR_STRING_DATA RAND_str_reasons[]= |
80 | { | 80 | { |
81 | {ERR_REASON(RAND_R_DUAL_EC_DRBG_DISABLED),"dual ec drbg disabled"}, | ||
81 | {ERR_REASON(RAND_R_ERROR_INITIALISING_DRBG),"error initialising drbg"}, | 82 | {ERR_REASON(RAND_R_ERROR_INITIALISING_DRBG),"error initialising drbg"}, |
82 | {ERR_REASON(RAND_R_ERROR_INSTANTIATING_DRBG),"error instantiating drbg"}, | 83 | {ERR_REASON(RAND_R_ERROR_INSTANTIATING_DRBG),"error instantiating drbg"}, |
83 | {ERR_REASON(RAND_R_NO_FIPS_RANDOM_METHOD_SET),"no fips random method set"}, | 84 | {ERR_REASON(RAND_R_NO_FIPS_RANDOM_METHOD_SET),"no fips random method set"}, |
diff --git a/src/lib/libcrypto/rand/rand_lib.c b/src/lib/libcrypto/rand/rand_lib.c index daf1dab973..5ac0e14caf 100644 --- a/src/lib/libcrypto/rand/rand_lib.c +++ b/src/lib/libcrypto/rand/rand_lib.c | |||
@@ -210,8 +210,11 @@ static size_t drbg_get_entropy(DRBG_CTX *ctx, unsigned char **pout, | |||
210 | 210 | ||
211 | static void drbg_free_entropy(DRBG_CTX *ctx, unsigned char *out, size_t olen) | 211 | static void drbg_free_entropy(DRBG_CTX *ctx, unsigned char *out, size_t olen) |
212 | { | 212 | { |
213 | OPENSSL_cleanse(out, olen); | 213 | if (out) |
214 | OPENSSL_free(out); | 214 | { |
215 | OPENSSL_cleanse(out, olen); | ||
216 | OPENSSL_free(out); | ||
217 | } | ||
215 | } | 218 | } |
216 | 219 | ||
217 | /* Set "additional input" when generating random data. This uses the | 220 | /* Set "additional input" when generating random data. This uses the |
@@ -266,6 +269,14 @@ int RAND_init_fips(void) | |||
266 | DRBG_CTX *dctx; | 269 | DRBG_CTX *dctx; |
267 | size_t plen; | 270 | size_t plen; |
268 | unsigned char pers[32], *p; | 271 | unsigned char pers[32], *p; |
272 | #ifndef OPENSSL_ALLOW_DUAL_EC_DRBG | ||
273 | if (fips_drbg_type >> 16) | ||
274 | { | ||
275 | RANDerr(RAND_F_RAND_INIT_FIPS, RAND_R_DUAL_EC_DRBG_DISABLED); | ||
276 | return 0; | ||
277 | } | ||
278 | #endif | ||
279 | |||
269 | dctx = FIPS_get_default_drbg(); | 280 | dctx = FIPS_get_default_drbg(); |
270 | if (FIPS_drbg_init(dctx, fips_drbg_type, fips_drbg_flags) <= 0) | 281 | if (FIPS_drbg_init(dctx, fips_drbg_type, fips_drbg_flags) <= 0) |
271 | { | 282 | { |
diff --git a/src/lib/libcrypto/rand/rand_win.c b/src/lib/libcrypto/rand/rand_win.c index 5d134e186b..34ffcd23f9 100644 --- a/src/lib/libcrypto/rand/rand_win.c +++ b/src/lib/libcrypto/rand/rand_win.c | |||
@@ -750,7 +750,7 @@ static void readscreen(void) | |||
750 | int y; /* y-coordinate of screen lines to grab */ | 750 | int y; /* y-coordinate of screen lines to grab */ |
751 | int n = 16; /* number of screen lines to grab at a time */ | 751 | int n = 16; /* number of screen lines to grab at a time */ |
752 | 752 | ||
753 | if (GetVersion() < 0x80000000 && OPENSSL_isservice()>0) | 753 | if (check_winnt() && OPENSSL_isservice()>0) |
754 | return; | 754 | return; |
755 | 755 | ||
756 | /* Create a screen DC and a memory DC compatible to screen DC */ | 756 | /* Create a screen DC and a memory DC compatible to screen DC */ |
diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c index 030e07f418..7f1428072d 100644 --- a/src/lib/libcrypto/rand/randfile.c +++ b/src/lib/libcrypto/rand/randfile.c | |||
@@ -57,7 +57,9 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | /* We need to define this to get macros like S_IFBLK and S_IFCHR */ | 59 | /* We need to define this to get macros like S_IFBLK and S_IFCHR */ |
60 | #if !defined(OPENSSL_SYS_VXWORKS) | ||
60 | #define _XOPEN_SOURCE 500 | 61 | #define _XOPEN_SOURCE 500 |
62 | #endif | ||
61 | 63 | ||
62 | #include <errno.h> | 64 | #include <errno.h> |
63 | #include <stdio.h> | 65 | #include <stdio.h> |
diff --git a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl index d6eac205e9..75750dbf33 100755 --- a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl +++ b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | |||
@@ -112,7 +112,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | |||
112 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or | 112 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or |
113 | die "can't locate x86_64-xlate.pl"; | 113 | die "can't locate x86_64-xlate.pl"; |
114 | 114 | ||
115 | open STDOUT,"| $^X $xlate $flavour $output"; | 115 | open OUT,"| \"$^X\" $xlate $flavour $output"; |
116 | *STDOUT=*OUT; | ||
116 | 117 | ||
117 | $dat="%rdi"; # arg1 | 118 | $dat="%rdi"; # arg1 |
118 | $len="%rsi"; # arg2 | 119 | $len="%rsi"; # arg2 |
diff --git a/src/lib/libcrypto/rc4/rc4test.c b/src/lib/libcrypto/rc4/rc4test.c index 633a79e758..4312605ccb 100644 --- a/src/lib/libcrypto/rc4/rc4test.c +++ b/src/lib/libcrypto/rc4/rc4test.c | |||
@@ -120,6 +120,12 @@ int main(int argc, char *argv[]) | |||
120 | RC4_KEY key; | 120 | RC4_KEY key; |
121 | unsigned char obuf[512]; | 121 | unsigned char obuf[512]; |
122 | 122 | ||
123 | #if !defined(OPENSSL_PIC) | ||
124 | void OPENSSL_cpuid_setup(void); | ||
125 | |||
126 | OPENSSL_cpuid_setup(); | ||
127 | #endif | ||
128 | |||
123 | for (i=0; i<6; i++) | 129 | for (i=0; i<6; i++) |
124 | { | 130 | { |
125 | RC4_set_key(&key,keys[i][0],&(keys[i][1])); | 131 | RC4_set_key(&key,keys[i][0],&(keys[i][1])); |
diff --git a/src/lib/libcrypto/ripemd/rmd_dgst.c b/src/lib/libcrypto/ripemd/rmd_dgst.c index 9ff1a0705e..d8e72da51b 100644 --- a/src/lib/libcrypto/ripemd/rmd_dgst.c +++ b/src/lib/libcrypto/ripemd/rmd_dgst.c | |||
@@ -88,7 +88,7 @@ fips_md_init(RIPEMD160) | |||
88 | void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num) | 88 | void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num) |
89 | { | 89 | { |
90 | const unsigned char *data=p; | 90 | const unsigned char *data=p; |
91 | register volatile unsigned MD32_REG_T A,B,C,D,E; | 91 | register unsigned MD32_REG_T A,B,C,D,E; |
92 | unsigned MD32_REG_T a,b,c,d,e,l; | 92 | unsigned MD32_REG_T a,b,c,d,e,l; |
93 | #ifndef MD32_XARRAY | 93 | #ifndef MD32_XARRAY |
94 | /* See comment in crypto/sha/sha_locl.h for details. */ | 94 | /* See comment in crypto/sha/sha_locl.h for details. */ |
@@ -105,21 +105,21 @@ void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num) | |||
105 | 105 | ||
106 | A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E; | 106 | A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E; |
107 | 107 | ||
108 | HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l; | 108 | (void)HOST_c2l(data,l); X( 0)=l;(void)HOST_c2l(data,l); X( 1)=l; |
109 | RIP1(A,B,C,D,E,WL00,SL00); HOST_c2l(data,l); X( 2)=l; | 109 | RIP1(A,B,C,D,E,WL00,SL00); (void)HOST_c2l(data,l); X( 2)=l; |
110 | RIP1(E,A,B,C,D,WL01,SL01); HOST_c2l(data,l); X( 3)=l; | 110 | RIP1(E,A,B,C,D,WL01,SL01); (void)HOST_c2l(data,l); X( 3)=l; |
111 | RIP1(D,E,A,B,C,WL02,SL02); HOST_c2l(data,l); X( 4)=l; | 111 | RIP1(D,E,A,B,C,WL02,SL02); (void)HOST_c2l(data,l); X( 4)=l; |
112 | RIP1(C,D,E,A,B,WL03,SL03); HOST_c2l(data,l); X( 5)=l; | 112 | RIP1(C,D,E,A,B,WL03,SL03); (void)HOST_c2l(data,l); X( 5)=l; |
113 | RIP1(B,C,D,E,A,WL04,SL04); HOST_c2l(data,l); X( 6)=l; | 113 | RIP1(B,C,D,E,A,WL04,SL04); (void)HOST_c2l(data,l); X( 6)=l; |
114 | RIP1(A,B,C,D,E,WL05,SL05); HOST_c2l(data,l); X( 7)=l; | 114 | RIP1(A,B,C,D,E,WL05,SL05); (void)HOST_c2l(data,l); X( 7)=l; |
115 | RIP1(E,A,B,C,D,WL06,SL06); HOST_c2l(data,l); X( 8)=l; | 115 | RIP1(E,A,B,C,D,WL06,SL06); (void)HOST_c2l(data,l); X( 8)=l; |
116 | RIP1(D,E,A,B,C,WL07,SL07); HOST_c2l(data,l); X( 9)=l; | 116 | RIP1(D,E,A,B,C,WL07,SL07); (void)HOST_c2l(data,l); X( 9)=l; |
117 | RIP1(C,D,E,A,B,WL08,SL08); HOST_c2l(data,l); X(10)=l; | 117 | RIP1(C,D,E,A,B,WL08,SL08); (void)HOST_c2l(data,l); X(10)=l; |
118 | RIP1(B,C,D,E,A,WL09,SL09); HOST_c2l(data,l); X(11)=l; | 118 | RIP1(B,C,D,E,A,WL09,SL09); (void)HOST_c2l(data,l); X(11)=l; |
119 | RIP1(A,B,C,D,E,WL10,SL10); HOST_c2l(data,l); X(12)=l; | 119 | RIP1(A,B,C,D,E,WL10,SL10); (void)HOST_c2l(data,l); X(12)=l; |
120 | RIP1(E,A,B,C,D,WL11,SL11); HOST_c2l(data,l); X(13)=l; | 120 | RIP1(E,A,B,C,D,WL11,SL11); (void)HOST_c2l(data,l); X(13)=l; |
121 | RIP1(D,E,A,B,C,WL12,SL12); HOST_c2l(data,l); X(14)=l; | 121 | RIP1(D,E,A,B,C,WL12,SL12); (void)HOST_c2l(data,l); X(14)=l; |
122 | RIP1(C,D,E,A,B,WL13,SL13); HOST_c2l(data,l); X(15)=l; | 122 | RIP1(C,D,E,A,B,WL13,SL13); (void)HOST_c2l(data,l); X(15)=l; |
123 | RIP1(B,C,D,E,A,WL14,SL14); | 123 | RIP1(B,C,D,E,A,WL14,SL14); |
124 | RIP1(A,B,C,D,E,WL15,SL15); | 124 | RIP1(A,B,C,D,E,WL15,SL15); |
125 | 125 | ||
diff --git a/src/lib/libcrypto/ripemd/rmd_locl.h b/src/lib/libcrypto/ripemd/rmd_locl.h index f14b346e66..2bd8957d14 100644 --- a/src/lib/libcrypto/ripemd/rmd_locl.h +++ b/src/lib/libcrypto/ripemd/rmd_locl.h | |||
@@ -88,11 +88,11 @@ void ripemd160_block_data_order (RIPEMD160_CTX *c, const void *p,size_t num); | |||
88 | #define HASH_FINAL RIPEMD160_Final | 88 | #define HASH_FINAL RIPEMD160_Final |
89 | #define HASH_MAKE_STRING(c,s) do { \ | 89 | #define HASH_MAKE_STRING(c,s) do { \ |
90 | unsigned long ll; \ | 90 | unsigned long ll; \ |
91 | ll=(c)->A; HOST_l2c(ll,(s)); \ | 91 | ll=(c)->A; (void)HOST_l2c(ll,(s)); \ |
92 | ll=(c)->B; HOST_l2c(ll,(s)); \ | 92 | ll=(c)->B; (void)HOST_l2c(ll,(s)); \ |
93 | ll=(c)->C; HOST_l2c(ll,(s)); \ | 93 | ll=(c)->C; (void)HOST_l2c(ll,(s)); \ |
94 | ll=(c)->D; HOST_l2c(ll,(s)); \ | 94 | ll=(c)->D; (void)HOST_l2c(ll,(s)); \ |
95 | ll=(c)->E; HOST_l2c(ll,(s)); \ | 95 | ll=(c)->E; (void)HOST_l2c(ll,(s)); \ |
96 | } while (0) | 96 | } while (0) |
97 | #define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order | 97 | #define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order |
98 | 98 | ||
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h index 4814a2fc15..5f269e577a 100644 --- a/src/lib/libcrypto/rsa/rsa.h +++ b/src/lib/libcrypto/rsa/rsa.h | |||
@@ -280,7 +280,7 @@ struct rsa_st | |||
280 | 280 | ||
281 | RSA * RSA_new(void); | 281 | RSA * RSA_new(void); |
282 | RSA * RSA_new_method(ENGINE *engine); | 282 | RSA * RSA_new_method(ENGINE *engine); |
283 | int RSA_size(const RSA *); | 283 | int RSA_size(const RSA *rsa); |
284 | 284 | ||
285 | /* Deprecated version */ | 285 | /* Deprecated version */ |
286 | #ifndef OPENSSL_NO_DEPRECATED | 286 | #ifndef OPENSSL_NO_DEPRECATED |
diff --git a/src/lib/libcrypto/rsa/rsa_chk.c b/src/lib/libcrypto/rsa/rsa_chk.c index 9d848db8c6..cc30e77132 100644 --- a/src/lib/libcrypto/rsa/rsa_chk.c +++ b/src/lib/libcrypto/rsa/rsa_chk.c | |||
@@ -59,6 +59,12 @@ int RSA_check_key(const RSA *key) | |||
59 | BN_CTX *ctx; | 59 | BN_CTX *ctx; |
60 | int r; | 60 | int r; |
61 | int ret=1; | 61 | int ret=1; |
62 | |||
63 | if (!key->p || !key->q || !key->n || !key->e || !key->d) | ||
64 | { | ||
65 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_VALUE_MISSING); | ||
66 | return 0; | ||
67 | } | ||
62 | 68 | ||
63 | i = BN_new(); | 69 | i = BN_new(); |
64 | j = BN_new(); | 70 | j = BN_new(); |
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index 2e1ddd48d3..88ee2cb557 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c | |||
@@ -847,12 +847,12 @@ static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | |||
847 | if (!BN_mod(r0,pr1,rsa->p,ctx)) goto err; | 847 | if (!BN_mod(r0,pr1,rsa->p,ctx)) goto err; |
848 | 848 | ||
849 | /* If p < q it is occasionally possible for the correction of | 849 | /* If p < q it is occasionally possible for the correction of |
850 | * adding 'p' if r0 is negative above to leave the result still | 850 | * adding 'p' if r0 is negative above to leave the result still |
851 | * negative. This can break the private key operations: the following | 851 | * negative. This can break the private key operations: the following |
852 | * second correction should *always* correct this rare occurrence. | 852 | * second correction should *always* correct this rare occurrence. |
853 | * This will *never* happen with OpenSSL generated keys because | 853 | * This will *never* happen with OpenSSL generated keys because |
854 | * they ensure p > q [steve] | 854 | * they ensure p > q [steve] |
855 | */ | 855 | */ |
856 | if (BN_is_negative(r0)) | 856 | if (BN_is_negative(r0)) |
857 | if (!BN_add(r0,r0,rsa->p)) goto err; | 857 | if (!BN_add(r0,r0,rsa->p)) goto err; |
858 | if (!BN_mul(r1,r0,rsa->q,ctx)) goto err; | 858 | if (!BN_mul(r1,r0,rsa->q,ctx)) goto err; |
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c index e08ac151ff..af4d24a56e 100644 --- a/src/lib/libcrypto/rsa/rsa_oaep.c +++ b/src/lib/libcrypto/rsa/rsa_oaep.c | |||
@@ -149,7 +149,7 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | |||
149 | if (!EVP_Digest((void *)param, plen, phash, NULL, EVP_sha1(), NULL)) | 149 | if (!EVP_Digest((void *)param, plen, phash, NULL, EVP_sha1(), NULL)) |
150 | return -1; | 150 | return -1; |
151 | 151 | ||
152 | if (timingsafe_bcmp(db, phash, SHA_DIGEST_LENGTH) != 0 || bad) | 152 | if (CRYPTO_memcmp(db, phash, SHA_DIGEST_LENGTH) != 0 || bad) |
153 | goto decoding_err; | 153 | goto decoding_err; |
154 | else | 154 | else |
155 | { | 155 | { |
diff --git a/src/lib/libcrypto/sha/Makefile b/src/lib/libcrypto/sha/Makefile index 2eb2b7af99..6d191d3936 100644 --- a/src/lib/libcrypto/sha/Makefile +++ b/src/lib/libcrypto/sha/Makefile | |||
@@ -60,9 +60,7 @@ sha256-armv4.S: asm/sha256-armv4.pl | |||
60 | $(PERL) $< $(PERLASM_SCHEME) $@ | 60 | $(PERL) $< $(PERLASM_SCHEME) $@ |
61 | 61 | ||
62 | sha1-alpha.s: asm/sha1-alpha.pl | 62 | sha1-alpha.s: asm/sha1-alpha.pl |
63 | (preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \ | 63 | $(PERL) $< | $(CC) -E - | tee $@ > /dev/null |
64 | $(PERL) asm/sha1-alpha.pl > $$preproc && \ | ||
65 | $(CC) -E $$preproc > $@ && rm $$preproc) | ||
66 | 64 | ||
67 | # Solaris make has to be explicitly told | 65 | # Solaris make has to be explicitly told |
68 | sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $(PERLASM_SCHEME) > $@ | 66 | sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $(PERLASM_SCHEME) > $@ |
diff --git a/src/lib/libcrypto/sha/sha1_one.c b/src/lib/libcrypto/sha/sha1_one.c index 7c65b60276..c56ec94020 100644 --- a/src/lib/libcrypto/sha/sha1_one.c +++ b/src/lib/libcrypto/sha/sha1_one.c | |||
@@ -58,8 +58,8 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <openssl/sha.h> | ||
62 | #include <openssl/crypto.h> | 61 | #include <openssl/crypto.h> |
62 | #include <openssl/sha.h> | ||
63 | 63 | ||
64 | #ifndef OPENSSL_NO_SHA1 | 64 | #ifndef OPENSSL_NO_SHA1 |
65 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) | 65 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) |
diff --git a/src/lib/libcrypto/sha/sha1dgst.c b/src/lib/libcrypto/sha/sha1dgst.c index 81219af088..a98690225f 100644 --- a/src/lib/libcrypto/sha/sha1dgst.c +++ b/src/lib/libcrypto/sha/sha1dgst.c | |||
@@ -56,8 +56,8 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/opensslconf.h> | ||
60 | #include <openssl/crypto.h> | 59 | #include <openssl/crypto.h> |
60 | #include <openssl/opensslconf.h> | ||
61 | #if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA) | 61 | #if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA) |
62 | 62 | ||
63 | #undef SHA_0 | 63 | #undef SHA_0 |
diff --git a/src/lib/libcrypto/sha/sha_dgst.c b/src/lib/libcrypto/sha/sha_dgst.c index c946ad827d..fb63b17ff2 100644 --- a/src/lib/libcrypto/sha/sha_dgst.c +++ b/src/lib/libcrypto/sha/sha_dgst.c | |||
@@ -56,8 +56,8 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/opensslconf.h> | ||
60 | #include <openssl/crypto.h> | 59 | #include <openssl/crypto.h> |
60 | #include <openssl/opensslconf.h> | ||
61 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) | 61 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) |
62 | 62 | ||
63 | #undef SHA_1 | 63 | #undef SHA_1 |
diff --git a/src/lib/libcrypto/sha/sha_locl.h b/src/lib/libcrypto/sha/sha_locl.h index 7a0c3ca8d8..d673255f78 100644 --- a/src/lib/libcrypto/sha/sha_locl.h +++ b/src/lib/libcrypto/sha/sha_locl.h | |||
@@ -69,11 +69,11 @@ | |||
69 | #define HASH_CBLOCK SHA_CBLOCK | 69 | #define HASH_CBLOCK SHA_CBLOCK |
70 | #define HASH_MAKE_STRING(c,s) do { \ | 70 | #define HASH_MAKE_STRING(c,s) do { \ |
71 | unsigned long ll; \ | 71 | unsigned long ll; \ |
72 | ll=(c)->h0; HOST_l2c(ll,(s)); \ | 72 | ll=(c)->h0; (void)HOST_l2c(ll,(s)); \ |
73 | ll=(c)->h1; HOST_l2c(ll,(s)); \ | 73 | ll=(c)->h1; (void)HOST_l2c(ll,(s)); \ |
74 | ll=(c)->h2; HOST_l2c(ll,(s)); \ | 74 | ll=(c)->h2; (void)HOST_l2c(ll,(s)); \ |
75 | ll=(c)->h3; HOST_l2c(ll,(s)); \ | 75 | ll=(c)->h3; (void)HOST_l2c(ll,(s)); \ |
76 | ll=(c)->h4; HOST_l2c(ll,(s)); \ | 76 | ll=(c)->h4; (void)HOST_l2c(ll,(s)); \ |
77 | } while (0) | 77 | } while (0) |
78 | 78 | ||
79 | #if defined(SHA_0) | 79 | #if defined(SHA_0) |
@@ -256,21 +256,21 @@ static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) | |||
256 | } | 256 | } |
257 | else | 257 | else |
258 | { | 258 | { |
259 | HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l; | 259 | (void)HOST_c2l(data,l); X( 0)=l; (void)HOST_c2l(data,l); X( 1)=l; |
260 | BODY_00_15( 0,A,B,C,D,E,T,X( 0)); HOST_c2l(data,l); X( 2)=l; | 260 | BODY_00_15( 0,A,B,C,D,E,T,X( 0)); (void)HOST_c2l(data,l); X( 2)=l; |
261 | BODY_00_15( 1,T,A,B,C,D,E,X( 1)); HOST_c2l(data,l); X( 3)=l; | 261 | BODY_00_15( 1,T,A,B,C,D,E,X( 1)); (void)HOST_c2l(data,l); X( 3)=l; |
262 | BODY_00_15( 2,E,T,A,B,C,D,X( 2)); HOST_c2l(data,l); X( 4)=l; | 262 | BODY_00_15( 2,E,T,A,B,C,D,X( 2)); (void)HOST_c2l(data,l); X( 4)=l; |
263 | BODY_00_15( 3,D,E,T,A,B,C,X( 3)); HOST_c2l(data,l); X( 5)=l; | 263 | BODY_00_15( 3,D,E,T,A,B,C,X( 3)); (void)HOST_c2l(data,l); X( 5)=l; |
264 | BODY_00_15( 4,C,D,E,T,A,B,X( 4)); HOST_c2l(data,l); X( 6)=l; | 264 | BODY_00_15( 4,C,D,E,T,A,B,X( 4)); (void)HOST_c2l(data,l); X( 6)=l; |
265 | BODY_00_15( 5,B,C,D,E,T,A,X( 5)); HOST_c2l(data,l); X( 7)=l; | 265 | BODY_00_15( 5,B,C,D,E,T,A,X( 5)); (void)HOST_c2l(data,l); X( 7)=l; |
266 | BODY_00_15( 6,A,B,C,D,E,T,X( 6)); HOST_c2l(data,l); X( 8)=l; | 266 | BODY_00_15( 6,A,B,C,D,E,T,X( 6)); (void)HOST_c2l(data,l); X( 8)=l; |
267 | BODY_00_15( 7,T,A,B,C,D,E,X( 7)); HOST_c2l(data,l); X( 9)=l; | 267 | BODY_00_15( 7,T,A,B,C,D,E,X( 7)); (void)HOST_c2l(data,l); X( 9)=l; |
268 | BODY_00_15( 8,E,T,A,B,C,D,X( 8)); HOST_c2l(data,l); X(10)=l; | 268 | BODY_00_15( 8,E,T,A,B,C,D,X( 8)); (void)HOST_c2l(data,l); X(10)=l; |
269 | BODY_00_15( 9,D,E,T,A,B,C,X( 9)); HOST_c2l(data,l); X(11)=l; | 269 | BODY_00_15( 9,D,E,T,A,B,C,X( 9)); (void)HOST_c2l(data,l); X(11)=l; |
270 | BODY_00_15(10,C,D,E,T,A,B,X(10)); HOST_c2l(data,l); X(12)=l; | 270 | BODY_00_15(10,C,D,E,T,A,B,X(10)); (void)HOST_c2l(data,l); X(12)=l; |
271 | BODY_00_15(11,B,C,D,E,T,A,X(11)); HOST_c2l(data,l); X(13)=l; | 271 | BODY_00_15(11,B,C,D,E,T,A,X(11)); (void)HOST_c2l(data,l); X(13)=l; |
272 | BODY_00_15(12,A,B,C,D,E,T,X(12)); HOST_c2l(data,l); X(14)=l; | 272 | BODY_00_15(12,A,B,C,D,E,T,X(12)); (void)HOST_c2l(data,l); X(14)=l; |
273 | BODY_00_15(13,T,A,B,C,D,E,X(13)); HOST_c2l(data,l); X(15)=l; | 273 | BODY_00_15(13,T,A,B,C,D,E,X(13)); (void)HOST_c2l(data,l); X(15)=l; |
274 | BODY_00_15(14,E,T,A,B,C,D,X(14)); | 274 | BODY_00_15(14,E,T,A,B,C,D,X(14)); |
275 | BODY_00_15(15,D,E,T,A,B,C,X(15)); | 275 | BODY_00_15(15,D,E,T,A,B,C,X(15)); |
276 | } | 276 | } |
diff --git a/src/lib/libcrypto/symhacks.h b/src/lib/libcrypto/symhacks.h index 403f592dcd..bd2f000d59 100644 --- a/src/lib/libcrypto/symhacks.h +++ b/src/lib/libcrypto/symhacks.h | |||
@@ -193,17 +193,23 @@ | |||
193 | #undef SSL_CTX_set_srp_username_callback | 193 | #undef SSL_CTX_set_srp_username_callback |
194 | #define SSL_CTX_set_srp_username_callback SSL_CTX_set_srp_un_cb | 194 | #define SSL_CTX_set_srp_username_callback SSL_CTX_set_srp_un_cb |
195 | #undef ssl_add_clienthello_use_srtp_ext | 195 | #undef ssl_add_clienthello_use_srtp_ext |
196 | #define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext | 196 | #define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext |
197 | #undef ssl_add_serverhello_use_srtp_ext | 197 | #undef ssl_add_serverhello_use_srtp_ext |
198 | #define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext | 198 | #define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext |
199 | #undef ssl_parse_clienthello_use_srtp_ext | 199 | #undef ssl_parse_clienthello_use_srtp_ext |
200 | #define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext | 200 | #define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext |
201 | #undef ssl_parse_serverhello_use_srtp_ext | 201 | #undef ssl_parse_serverhello_use_srtp_ext |
202 | #define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext | 202 | #define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext |
203 | #undef SSL_CTX_set_next_protos_advertised_cb | 203 | #undef SSL_CTX_set_next_protos_advertised_cb |
204 | #define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_cb | 204 | #define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_cb |
205 | #undef SSL_CTX_set_next_proto_select_cb | 205 | #undef SSL_CTX_set_next_proto_select_cb |
206 | #define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb | 206 | #define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb |
207 | #undef ssl3_cbc_record_digest_supported | ||
208 | #define ssl3_cbc_record_digest_supported ssl3_cbc_record_digest_support | ||
209 | #undef ssl_check_clienthello_tlsext_late | ||
210 | #define ssl_check_clienthello_tlsext_late ssl_check_clihello_tlsext_late | ||
211 | #undef ssl_check_clienthello_tlsext_early | ||
212 | #define ssl_check_clienthello_tlsext_early ssl_check_clihello_tlsext_early | ||
207 | 213 | ||
208 | /* Hack some long ENGINE names */ | 214 | /* Hack some long ENGINE names */ |
209 | #undef ENGINE_get_default_BN_mod_exp_crt | 215 | #undef ENGINE_get_default_BN_mod_exp_crt |
@@ -316,8 +322,6 @@ | |||
316 | #define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf | 322 | #define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf |
317 | #undef ec_GFp_simple_points_make_affine | 323 | #undef ec_GFp_simple_points_make_affine |
318 | #define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine | 324 | #define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine |
319 | #undef ec_GFp_simple_group_get_curve_GFp | ||
320 | #define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp | ||
321 | #undef ec_GFp_simple_set_Jprojective_coordinates_GFp | 325 | #undef ec_GFp_simple_set_Jprojective_coordinates_GFp |
322 | #define ec_GFp_simple_set_Jprojective_coordinates_GFp \ | 326 | #define ec_GFp_simple_set_Jprojective_coordinates_GFp \ |
323 | ec_GFp_smp_set_Jproj_coords_GFp | 327 | ec_GFp_smp_set_Jproj_coords_GFp |
diff --git a/src/lib/libcrypto/threads/pthreads-vms.com b/src/lib/libcrypto/threads/pthreads-vms.com deleted file mode 100644 index 1cf92bdf57..0000000000 --- a/src/lib/libcrypto/threads/pthreads-vms.com +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | $! To compile mttest on VMS. | ||
2 | $! | ||
3 | $! WARNING: only tested with DEC C so far. | ||
4 | $ | ||
5 | $ if (f$getsyi("cpu").lt.128) | ||
6 | $ then | ||
7 | $ arch := VAX | ||
8 | $ else | ||
9 | $ arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE") | ||
10 | $ if (arch .eqs. "") then arch = "UNK" | ||
11 | $ endif | ||
12 | $ define/user openssl [--.include.openssl] | ||
13 | $ cc/def=PTHREADS mttest.c | ||
14 | $ link mttest,[--.'arch'.exe.ssl]libssl/lib,[--.'arch'.exe.crypto]libcrypto/lib | ||
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c index e319faa47b..a38c7581e6 100644 --- a/src/lib/libcrypto/ui/ui_openssl.c +++ b/src/lib/libcrypto/ui/ui_openssl.c | |||
@@ -122,9 +122,15 @@ | |||
122 | * sigaction and fileno included. -pedantic would be more appropriate for | 122 | * sigaction and fileno included. -pedantic would be more appropriate for |
123 | * the intended purposes, but we can't prevent users from adding -ansi. | 123 | * the intended purposes, but we can't prevent users from adding -ansi. |
124 | */ | 124 | */ |
125 | #if defined(OPENSSL_SYSNAME_VXWORKS) | ||
126 | #include <sys/types.h> | ||
127 | #endif | ||
128 | |||
125 | #if !defined(_POSIX_C_SOURCE) && defined(OPENSSL_SYS_VMS) | 129 | #if !defined(_POSIX_C_SOURCE) && defined(OPENSSL_SYS_VMS) |
130 | #ifndef _POSIX_C_SOURCE | ||
126 | #define _POSIX_C_SOURCE 2 | 131 | #define _POSIX_C_SOURCE 2 |
127 | #endif | 132 | #endif |
133 | #endif | ||
128 | #include <signal.h> | 134 | #include <signal.h> |
129 | #include <stdio.h> | 135 | #include <stdio.h> |
130 | #include <string.h> | 136 | #include <string.h> |
@@ -398,8 +404,8 @@ static int read_till_nl(FILE *in) | |||
398 | char buf[SIZE+1]; | 404 | char buf[SIZE+1]; |
399 | 405 | ||
400 | do { | 406 | do { |
401 | if (fgets(buf,sizeof(buf),in) == NULL) | 407 | if (!fgets(buf,SIZE,in)) |
402 | break; | 408 | return 0; |
403 | } while (strchr(buf,'\n') == NULL); | 409 | } while (strchr(buf,'\n') == NULL); |
404 | return 1; | 410 | return 1; |
405 | } | 411 | } |
diff --git a/src/lib/libcrypto/util/deltree.com b/src/lib/libcrypto/util/deltree.com deleted file mode 100644 index 9f36b1a5e9..0000000000 --- a/src/lib/libcrypto/util/deltree.com +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | $! DELTREE.COM | ||
2 | $ | ||
3 | $ call deltree 'p1' | ||
4 | $ exit $status | ||
5 | $ | ||
6 | $ deltree: subroutine ! P1 is a name of a directory | ||
7 | $ on control_y then goto dt_STOP | ||
8 | $ on warning then goto dt_exit | ||
9 | $ _dt_def = f$trnlnm("SYS$DISK")+f$directory() | ||
10 | $ if f$parse(p1) .eqs. "" then exit | ||
11 | $ set default 'f$parse(p1,,,"DEVICE")''f$parse(p1,,,"DIRECTORY")' | ||
12 | $ p1 = f$parse(p1,,,"NAME") + f$parse(p1,,,"TYPE") | ||
13 | $ _fp = f$parse(".DIR",p1) | ||
14 | $ dt_loop: | ||
15 | $ _f = f$search(_fp) | ||
16 | $ if _f .eqs. "" then goto dt_loopend | ||
17 | $ call deltree [.'f$parse(_f,,,"NAME")']*.* | ||
18 | $ goto dt_loop | ||
19 | $ dt_loopend: | ||
20 | $ _fp = f$parse(p1,".;*") | ||
21 | $ if f$search(_fp) .eqs. "" then goto dt_exit | ||
22 | $ set noon | ||
23 | $ set file/prot=(S:RWED,O:RWED,G:RWED,W:RWED) '_fp' | ||
24 | $ set on | ||
25 | $ delete/nolog '_fp' | ||
26 | $ dt_exit: | ||
27 | $ set default '_dt_def' | ||
28 | $ goto dt_end | ||
29 | $ dt_STOP: | ||
30 | $ set default '_dt_def' | ||
31 | $ stop/id="" | ||
32 | $ exit | ||
33 | $ dt_end: | ||
34 | $ endsubroutine | ||
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num index 93f80ba0c6..aa86b2b8b1 100644 --- a/src/lib/libcrypto/util/libeay.num +++ b/src/lib/libcrypto/util/libeay.num | |||
@@ -3510,6 +3510,8 @@ BIO_get_callback_arg 3902 EXIST::FUNCTION: | |||
3510 | BIO_set_callback 3903 EXIST::FUNCTION: | 3510 | BIO_set_callback 3903 EXIST::FUNCTION: |
3511 | d2i_ASIdOrRange 3904 EXIST::FUNCTION:RFC3779 | 3511 | d2i_ASIdOrRange 3904 EXIST::FUNCTION:RFC3779 |
3512 | i2d_ASIdentifiers 3905 EXIST::FUNCTION:RFC3779 | 3512 | i2d_ASIdentifiers 3905 EXIST::FUNCTION:RFC3779 |
3513 | CRYPTO_memcmp 3906 EXIST::FUNCTION: | ||
3514 | BN_consttime_swap 3907 EXIST::FUNCTION: | ||
3513 | SEED_decrypt 3908 EXIST::FUNCTION:SEED | 3515 | SEED_decrypt 3908 EXIST::FUNCTION:SEED |
3514 | SEED_encrypt 3909 EXIST::FUNCTION:SEED | 3516 | SEED_encrypt 3909 EXIST::FUNCTION:SEED |
3515 | SEED_cbc_encrypt 3910 EXIST::FUNCTION:SEED | 3517 | SEED_cbc_encrypt 3910 EXIST::FUNCTION:SEED |
@@ -3687,7 +3689,7 @@ FIPS_dh_new 4073 NOEXIST::FUNCTION: | |||
3687 | FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION: | 3689 | FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION: |
3688 | FIPS_dh_free 4075 NOEXIST::FUNCTION: | 3690 | FIPS_dh_free 4075 NOEXIST::FUNCTION: |
3689 | fips_pkey_signature_test 4076 NOEXIST::FUNCTION: | 3691 | fips_pkey_signature_test 4076 NOEXIST::FUNCTION: |
3690 | EVP_add_alg_module 4077 NOEXIST::FUNCTION: | 3692 | EVP_add_alg_module 4077 EXIST::FUNCTION: |
3691 | int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION: | 3693 | int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION: |
3692 | int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION: | 3694 | int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION: |
3693 | int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION: | 3695 | int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION: |
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl index 458f830401..72fa089f6b 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
@@ -1222,7 +1222,7 @@ sub read_options | |||
1222 | } | 1222 | } |
1223 | } | 1223 | } |
1224 | } | 1224 | } |
1225 | elsif (/^([^=]*)=(.*)$/ && !/^-D/){ $VARS{$1}=$2; } | 1225 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } |
1226 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } | 1226 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } |
1227 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) | 1227 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) |
1228 | { $c_flags.="$_ "; } | 1228 | { $c_flags.="$_ "; } |
diff --git a/src/lib/libcrypto/util/pl/BC-32.pl b/src/lib/libcrypto/util/pl/BC-32.pl index 1f1e13fb40..b41bb45e82 100644 --- a/src/lib/libcrypto/util/pl/BC-32.pl +++ b/src/lib/libcrypto/util/pl/BC-32.pl | |||
@@ -18,7 +18,7 @@ $out_def="out32"; | |||
18 | $tmp_def="tmp32"; | 18 | $tmp_def="tmp32"; |
19 | $inc_def="inc32"; | 19 | $inc_def="inc32"; |
20 | #enable max error messages, disable most common warnings | 20 | #enable max error messages, disable most common warnings |
21 | $cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp "; | 21 | $cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp -D_timeb=timeb -D_ftime=ftime "; |
22 | if ($debug) | 22 | if ($debug) |
23 | { | 23 | { |
24 | $cflags.="-Od -y -v -vi- -D_DEBUG"; | 24 | $cflags.="-Od -y -v -vi- -D_DEBUG"; |
@@ -38,7 +38,7 @@ $efile=""; | |||
38 | $exep='.exe'; | 38 | $exep='.exe'; |
39 | if ($no_sock) | 39 | if ($no_sock) |
40 | { $ex_libs=""; } | 40 | { $ex_libs=""; } |
41 | else { $ex_libs="cw32mt.lib import32.lib"; } | 41 | else { $ex_libs="cw32mt.lib import32.lib crypt32.lib ws2_32.lib"; } |
42 | 42 | ||
43 | # static library stuff | 43 | # static library stuff |
44 | $mklib='tlib /P64'; | 44 | $mklib='tlib /P64'; |
@@ -51,8 +51,8 @@ $lfile=''; | |||
51 | $shlib_ex_obj=""; | 51 | $shlib_ex_obj=""; |
52 | $app_ex_obj="c0x32.obj"; | 52 | $app_ex_obj="c0x32.obj"; |
53 | 53 | ||
54 | $asm='nasmw -f obj -d__omf__'; | 54 | $asm=(`nasm -v 2>NUL` ge `nasmw -v 2>NUL`?"nasm":"nasmw")." -f obj -d__omf__"; |
55 | $asm.=" /Zi" if $debug; | 55 | $asm.=" -g" if $debug; |
56 | $afile='-o'; | 56 | $afile='-o'; |
57 | 57 | ||
58 | $bn_mulw_obj=''; | 58 | $bn_mulw_obj=''; |
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl index c503bd52b9..3705fc73b7 100644 --- a/src/lib/libcrypto/util/pl/VC-32.pl +++ b/src/lib/libcrypto/util/pl/VC-32.pl | |||
@@ -27,6 +27,8 @@ $zlib_lib="zlib1.lib"; | |||
27 | $l_flags =~ s/-L("\[^"]+")/\/libpath:$1/g; | 27 | $l_flags =~ s/-L("\[^"]+")/\/libpath:$1/g; |
28 | $l_flags =~ s/-L(\S+)/\/libpath:$1/g; | 28 | $l_flags =~ s/-L(\S+)/\/libpath:$1/g; |
29 | 29 | ||
30 | my $ff = ""; | ||
31 | |||
30 | # C compiler stuff | 32 | # C compiler stuff |
31 | $cc='cl'; | 33 | $cc='cl'; |
32 | if ($FLAVOR =~ /WIN64/) | 34 | if ($FLAVOR =~ /WIN64/) |
@@ -118,7 +120,7 @@ elsif ($FLAVOR =~ /CE/) | |||
118 | $base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'})); | 120 | $base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'})); |
119 | $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'})); | 121 | $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'})); |
120 | $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics... | 122 | $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics... |
121 | $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG'; | 123 | $dbg_cflags=' /MC /Od -DDEBUG -D_DEBUG'; |
122 | $lflags="/nologo /opt:ref $wcelflag"; | 124 | $lflags="/nologo /opt:ref $wcelflag"; |
123 | } | 125 | } |
124 | else # Win32 | 126 | else # Win32 |
@@ -126,6 +128,7 @@ else # Win32 | |||
126 | $base_cflags= " $mf_cflag"; | 128 | $base_cflags= " $mf_cflag"; |
127 | my $f = $shlib || $fips ?' /MD':' /MT'; | 129 | my $f = $shlib || $fips ?' /MD':' /MT'; |
128 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib | 130 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib |
131 | $ff = "/fixed"; | ||
129 | $opt_cflags=$f.' /Ox /O2 /Ob2'; | 132 | $opt_cflags=$f.' /Ox /O2 /Ob2'; |
130 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; | 133 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; |
131 | $lflags="/nologo /subsystem:console /opt:ref"; | 134 | $lflags="/nologo /subsystem:console /opt:ref"; |
@@ -318,7 +321,7 @@ sub do_lib_rule | |||
318 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; | 321 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; |
319 | $ret.="\tSET FIPS_TARGET=$target\n"; | 322 | $ret.="\tSET FIPS_TARGET=$target\n"; |
320 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; | 323 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; |
321 | $ret.="\t\$(FIPSLINK) \$(MLFLAGS) /map $base_arg $efile$target "; | 324 | $ret.="\t\$(FIPSLINK) \$(MLFLAGS) $ff /map $base_arg $efile$target "; |
322 | $ret.="$name @<<\n \$(SHLIB_EX_OBJ) $objs \$(EX_LIBS) "; | 325 | $ret.="$name @<<\n \$(SHLIB_EX_OBJ) $objs \$(EX_LIBS) "; |
323 | $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n"; | 326 | $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n"; |
324 | } | 327 | } |
@@ -355,7 +358,7 @@ sub do_link_rule | |||
355 | $ret.="\tSET FIPS_TARGET=$target\n"; | 358 | $ret.="\tSET FIPS_TARGET=$target\n"; |
356 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; | 359 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; |
357 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; | 360 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; |
358 | $ret.="\t\$(FIPSLINK) \$(LFLAGS) /map $efile$target @<<\n"; | 361 | $ret.="\t\$(FIPSLINK) \$(LFLAGS) $ff /map $efile$target @<<\n"; |
359 | $ret.="\t\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n"; | 362 | $ret.="\t\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n"; |
360 | } | 363 | } |
361 | else | 364 | else |
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c index 27ca5150c1..c6602dae4f 100644 --- a/src/lib/libcrypto/x509/by_dir.c +++ b/src/lib/libcrypto/x509/by_dir.c | |||
@@ -218,7 +218,7 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
218 | 218 | ||
219 | s=dir; | 219 | s=dir; |
220 | p=s; | 220 | p=s; |
221 | for (;;p++) | 221 | do |
222 | { | 222 | { |
223 | if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) | 223 | if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) |
224 | { | 224 | { |
@@ -264,9 +264,7 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
264 | return 0; | 264 | return 0; |
265 | } | 265 | } |
266 | } | 266 | } |
267 | if (*p == '\0') | 267 | } while (*p++ != '\0'); |
268 | break; | ||
269 | } | ||
270 | return 1; | 268 | return 1; |
271 | } | 269 | } |
272 | 270 | ||
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c index 7c2aaee2e9..352aa37434 100644 --- a/src/lib/libcrypto/x509/x509_cmp.c +++ b/src/lib/libcrypto/x509/x509_cmp.c | |||
@@ -86,10 +86,9 @@ unsigned long X509_issuer_and_serial_hash(X509 *a) | |||
86 | 86 | ||
87 | EVP_MD_CTX_init(&ctx); | 87 | EVP_MD_CTX_init(&ctx); |
88 | f=X509_NAME_oneline(a->cert_info->issuer,NULL,0); | 88 | f=X509_NAME_oneline(a->cert_info->issuer,NULL,0); |
89 | ret=strlen(f); | ||
90 | if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL)) | 89 | if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL)) |
91 | goto err; | 90 | goto err; |
92 | if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,ret)) | 91 | if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,strlen(f))) |
93 | goto err; | 92 | goto err; |
94 | OPENSSL_free(f); | 93 | OPENSSL_free(f); |
95 | if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data, | 94 | if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data, |
@@ -249,14 +248,14 @@ unsigned long X509_NAME_hash_old(X509_NAME *x) | |||
249 | i2d_X509_NAME(x,NULL); | 248 | i2d_X509_NAME(x,NULL); |
250 | EVP_MD_CTX_init(&md_ctx); | 249 | EVP_MD_CTX_init(&md_ctx); |
251 | EVP_MD_CTX_set_flags(&md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | 250 | EVP_MD_CTX_set_flags(&md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); |
252 | EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL); | 251 | if (EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL) |
253 | EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length); | 252 | && EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length) |
254 | EVP_DigestFinal_ex(&md_ctx,md,NULL); | 253 | && EVP_DigestFinal_ex(&md_ctx,md,NULL)) |
254 | ret=(((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| | ||
255 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) | ||
256 | )&0xffffffffL; | ||
255 | EVP_MD_CTX_cleanup(&md_ctx); | 257 | EVP_MD_CTX_cleanup(&md_ctx); |
256 | 258 | ||
257 | ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| | ||
258 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) | ||
259 | )&0xffffffffL; | ||
260 | return(ret); | 259 | return(ret); |
261 | } | 260 | } |
262 | #endif | 261 | #endif |
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index b0779db023..920066aeba 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
@@ -694,6 +694,7 @@ static int check_cert(X509_STORE_CTX *ctx) | |||
694 | X509_CRL *crl = NULL, *dcrl = NULL; | 694 | X509_CRL *crl = NULL, *dcrl = NULL; |
695 | X509 *x; | 695 | X509 *x; |
696 | int ok, cnum; | 696 | int ok, cnum; |
697 | unsigned int last_reasons; | ||
697 | cnum = ctx->error_depth; | 698 | cnum = ctx->error_depth; |
698 | x = sk_X509_value(ctx->chain, cnum); | 699 | x = sk_X509_value(ctx->chain, cnum); |
699 | ctx->current_cert = x; | 700 | ctx->current_cert = x; |
@@ -702,6 +703,7 @@ static int check_cert(X509_STORE_CTX *ctx) | |||
702 | ctx->current_reasons = 0; | 703 | ctx->current_reasons = 0; |
703 | while (ctx->current_reasons != CRLDP_ALL_REASONS) | 704 | while (ctx->current_reasons != CRLDP_ALL_REASONS) |
704 | { | 705 | { |
706 | last_reasons = ctx->current_reasons; | ||
705 | /* Try to retrieve relevant CRL */ | 707 | /* Try to retrieve relevant CRL */ |
706 | if (ctx->get_crl) | 708 | if (ctx->get_crl) |
707 | ok = ctx->get_crl(ctx, &crl, x); | 709 | ok = ctx->get_crl(ctx, &crl, x); |
@@ -745,6 +747,15 @@ static int check_cert(X509_STORE_CTX *ctx) | |||
745 | X509_CRL_free(dcrl); | 747 | X509_CRL_free(dcrl); |
746 | crl = NULL; | 748 | crl = NULL; |
747 | dcrl = NULL; | 749 | dcrl = NULL; |
750 | /* If reasons not updated we wont get anywhere by | ||
751 | * another iteration, so exit loop. | ||
752 | */ | ||
753 | if (last_reasons == ctx->current_reasons) | ||
754 | { | ||
755 | ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; | ||
756 | ok = ctx->verify_cb(0, ctx); | ||
757 | goto err; | ||
758 | } | ||
748 | } | 759 | } |
749 | err: | 760 | err: |
750 | X509_CRL_free(crl); | 761 | X509_CRL_free(crl); |
@@ -872,7 +883,7 @@ static int crl_extension_match(X509_CRL *a, X509_CRL *b, int nid) | |||
872 | { | 883 | { |
873 | ASN1_OCTET_STRING *exta, *extb; | 884 | ASN1_OCTET_STRING *exta, *extb; |
874 | int i; | 885 | int i; |
875 | i = X509_CRL_get_ext_by_NID(a, nid, 0); | 886 | i = X509_CRL_get_ext_by_NID(a, nid, -1); |
876 | if (i >= 0) | 887 | if (i >= 0) |
877 | { | 888 | { |
878 | /* Can't have multiple occurrences */ | 889 | /* Can't have multiple occurrences */ |
@@ -883,7 +894,7 @@ static int crl_extension_match(X509_CRL *a, X509_CRL *b, int nid) | |||
883 | else | 894 | else |
884 | exta = NULL; | 895 | exta = NULL; |
885 | 896 | ||
886 | i = X509_CRL_get_ext_by_NID(b, nid, 0); | 897 | i = X509_CRL_get_ext_by_NID(b, nid, -1); |
887 | 898 | ||
888 | if (i >= 0) | 899 | if (i >= 0) |
889 | { | 900 | { |
@@ -1451,10 +1462,9 @@ static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x) | |||
1451 | * a certificate was revoked. This has since been changed since | 1462 | * a certificate was revoked. This has since been changed since |
1452 | * critical extension can change the meaning of CRL entries. | 1463 | * critical extension can change the meaning of CRL entries. |
1453 | */ | 1464 | */ |
1454 | if (crl->flags & EXFLAG_CRITICAL) | 1465 | if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) |
1466 | && (crl->flags & EXFLAG_CRITICAL)) | ||
1455 | { | 1467 | { |
1456 | if (ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) | ||
1457 | return 1; | ||
1458 | ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION; | 1468 | ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION; |
1459 | ok = ctx->verify_cb(0, ctx); | 1469 | ok = ctx->verify_cb(0, ctx); |
1460 | if(!ok) | 1470 | if(!ok) |
diff --git a/src/lib/libcrypto/x509/x_all.c b/src/lib/libcrypto/x509/x_all.c index b94aeeb873..e06602d65a 100644 --- a/src/lib/libcrypto/x509/x_all.c +++ b/src/lib/libcrypto/x509/x_all.c | |||
@@ -97,6 +97,7 @@ int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md) | |||
97 | 97 | ||
98 | int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx) | 98 | int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx) |
99 | { | 99 | { |
100 | x->cert_info->enc.modified = 1; | ||
100 | return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CINF), | 101 | return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CINF), |
101 | x->cert_info->signature, | 102 | x->cert_info->signature, |
102 | x->sig_alg, x->signature, x->cert_info, ctx); | 103 | x->sig_alg, x->signature, x->cert_info, ctx); |
@@ -123,6 +124,7 @@ int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md) | |||
123 | 124 | ||
124 | int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx) | 125 | int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx) |
125 | { | 126 | { |
127 | x->crl->enc.modified = 1; | ||
126 | return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CRL_INFO), | 128 | return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CRL_INFO), |
127 | x->crl->sig_alg, x->sig_alg, x->signature, x->crl, ctx); | 129 | x->crl->sig_alg, x->sig_alg, x->signature, x->crl, ctx); |
128 | } | 130 | } |
diff --git a/src/lib/libcrypto/x509v3/v3_purp.c b/src/lib/libcrypto/x509v3/v3_purp.c index 181bd34979..ad688657e0 100644 --- a/src/lib/libcrypto/x509v3/v3_purp.c +++ b/src/lib/libcrypto/x509v3/v3_purp.c | |||
@@ -474,11 +474,11 @@ static void x509v3_cache_extensions(X509 *x) | |||
474 | for (i = 0; i < X509_get_ext_count(x); i++) | 474 | for (i = 0; i < X509_get_ext_count(x); i++) |
475 | { | 475 | { |
476 | ex = X509_get_ext(x, i); | 476 | ex = X509_get_ext(x, i); |
477 | if (!X509_EXTENSION_get_critical(ex)) | ||
478 | continue; | ||
479 | if (OBJ_obj2nid(X509_EXTENSION_get_object(ex)) | 477 | if (OBJ_obj2nid(X509_EXTENSION_get_object(ex)) |
480 | == NID_freshest_crl) | 478 | == NID_freshest_crl) |
481 | x->ex_flags |= EXFLAG_FRESHEST; | 479 | x->ex_flags |= EXFLAG_FRESHEST; |
480 | if (!X509_EXTENSION_get_critical(ex)) | ||
481 | continue; | ||
482 | if (!X509_supported_extension(ex)) | 482 | if (!X509_supported_extension(ex)) |
483 | { | 483 | { |
484 | x->ex_flags |= EXFLAG_CRITICAL; | 484 | x->ex_flags |= EXFLAG_CRITICAL; |
diff --git a/src/lib/libcrypto/x86_64cpuid.pl b/src/lib/libcrypto/x86_64cpuid.pl index 7b7b93b223..6ebfd017ea 100644 --- a/src/lib/libcrypto/x86_64cpuid.pl +++ b/src/lib/libcrypto/x86_64cpuid.pl | |||
@@ -11,7 +11,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | |||
11 | ( $xlate="${dir}perlasm/x86_64-xlate.pl" and -f $xlate) or | 11 | ( $xlate="${dir}perlasm/x86_64-xlate.pl" and -f $xlate) or |
12 | die "can't locate x86_64-xlate.pl"; | 12 | die "can't locate x86_64-xlate.pl"; |
13 | 13 | ||
14 | open STDOUT,"| $^X $xlate $flavour $output"; | 14 | open OUT,"| \"$^X\" $xlate $flavour $output"; |
15 | *STDOUT=*OUT; | ||
15 | 16 | ||
16 | ($arg1,$arg2,$arg3,$arg4)=$win64?("%rcx","%rdx","%r8", "%r9") : # Win64 order | 17 | ($arg1,$arg2,$arg3,$arg4)=$win64?("%rcx","%rdx","%r8", "%r9") : # Win64 order |
17 | ("%rdi","%rsi","%rdx","%rcx"); # Unix order | 18 | ("%rdi","%rsi","%rdx","%rcx"); # Unix order |