Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/ftp/bbftp-client/files/patch-connecttoserver.c
16462 views
1
--- connecttoserver.c.orig 2013-02-07 10:42:46 UTC
2
+++ connecttoserver.c
3
@@ -517,6 +517,7 @@ int connectviapassword()
4
#ifdef WITH_SSL
5
RSA *hisrsa ;
6
int lenrsa ;
7
+ BIGNUM *n, *e;
8
#endif
9
/*
10
** Get the socket
11
@@ -629,33 +630,35 @@ int connectviapassword()
12
/*
13
** Getting BIGNUM structures to store the key and exponent
14
*/
15
- if ( (hisrsa->n = BN_new()) == NULL) {
16
+ n = BN_new();
17
+ e = BN_new();
18
+ if (n == NULL || e == NULL) {
19
free(readbuffer) ;
20
close(tmpctrlsock) ;
21
printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ;
22
return -1 ;
23
}
24
- if ( (hisrsa->e = BN_new()) == NULL) {
25
- free(readbuffer) ;
26
- close(tmpctrlsock) ;
27
- printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ;
28
- return -1 ;
29
- }
30
/*
31
** Copy the key and exponent received
32
*/
33
- if ( BN_mpi2bn(pubkey,lenkey,hisrsa->n) == NULL ) {
34
+ if ( BN_mpi2bn(pubkey,lenkey,n) == NULL ) {
35
free(readbuffer) ;
36
close(tmpctrlsock) ;
37
printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubkey",(char *) ERR_error_string(ERR_get_error(),NULL)) ;
38
return -1 ;
39
}
40
- if ( BN_mpi2bn(pubexponent,lenexpo,hisrsa->e) == NULL ) {
41
+ if ( BN_mpi2bn(pubexponent,lenexpo,e) == NULL ) {
42
free(readbuffer) ;
43
close(tmpctrlsock) ;
44
printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubexponent",(char *) ERR_error_string(ERR_get_error(),NULL)) ;
45
return -1 ;
46
}
47
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
48
+ hisrsa->n = n;
49
+ hisrsa->e = e;
50
+#else
51
+ RSA_set0_key(hisrsa, n, e, NULL);
52
+#endif
53
lenrsa = RSA_size(hisrsa) ;
54
55
if (strlen(username) > lenrsa - 41 ) {
56
57