Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
1b225a01
Commit
1b225a01
authored
Mar 13, 2011
by
Ken Thomases
Committed by
Alexandre Julliard
Mar 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
secur32: Move some GnuTLS-specific helper functions.
parent
12195b32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
96 deletions
+96
-96
schannel.c
dlls/secur32/schannel.c
+96
-96
No files found.
dlls/secur32/schannel.c
View file @
1b225a01
...
...
@@ -72,6 +72,102 @@ MAKE_FUNCPTR(gnutls_transport_set_push_function);
#undef MAKE_FUNCPTR
static
unsigned
int
schannel_get_cipher_block_size
(
gnutls_cipher_algorithm_t
cipher
)
{
const
struct
{
gnutls_cipher_algorithm_t
cipher
;
unsigned
int
block_size
;
}
algorithms
[]
=
{
{
GNUTLS_CIPHER_3DES_CBC
,
8
},
{
GNUTLS_CIPHER_AES_128_CBC
,
16
},
{
GNUTLS_CIPHER_AES_256_CBC
,
16
},
{
GNUTLS_CIPHER_ARCFOUR_128
,
1
},
{
GNUTLS_CIPHER_ARCFOUR_40
,
1
},
{
GNUTLS_CIPHER_DES_CBC
,
8
},
{
GNUTLS_CIPHER_NULL
,
1
},
{
GNUTLS_CIPHER_RC2_40_CBC
,
8
},
};
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
algorithms
)
/
sizeof
(
*
algorithms
);
++
i
)
{
if
(
algorithms
[
i
].
cipher
==
cipher
)
return
algorithms
[
i
].
block_size
;
}
FIXME
(
"Unknown cipher %#x, returning 1
\n
"
,
cipher
);
return
1
;
}
static
DWORD
schannel_get_protocol
(
gnutls_protocol_t
proto
)
{
/* FIXME: currently schannel only implements client connections, but
* there's no reason it couldn't be used for servers as well. The
* context doesn't tell us which it is, so assume client for now.
*/
switch
(
proto
)
{
case
GNUTLS_SSL3
:
return
SP_PROT_SSL3_CLIENT
;
case
GNUTLS_TLS1_0
:
return
SP_PROT_TLS1_CLIENT
;
default:
FIXME
(
"unknown protocol %d
\n
"
,
proto
);
return
0
;
}
}
static
ALG_ID
schannel_get_cipher_algid
(
gnutls_cipher_algorithm_t
cipher
)
{
switch
(
cipher
)
{
case
GNUTLS_CIPHER_UNKNOWN
:
case
GNUTLS_CIPHER_NULL
:
return
0
;
case
GNUTLS_CIPHER_ARCFOUR_40
:
case
GNUTLS_CIPHER_ARCFOUR_128
:
return
CALG_RC4
;
case
GNUTLS_CIPHER_DES_CBC
:
case
GNUTLS_CIPHER_3DES_CBC
:
return
CALG_DES
;
case
GNUTLS_CIPHER_AES_128_CBC
:
case
GNUTLS_CIPHER_AES_256_CBC
:
return
CALG_AES
;
case
GNUTLS_CIPHER_RC2_40_CBC
:
return
CALG_RC2
;
default:
FIXME
(
"unknown algorithm %d
\n
"
,
cipher
);
return
0
;
}
}
static
ALG_ID
schannel_get_mac_algid
(
gnutls_mac_algorithm_t
mac
)
{
switch
(
mac
)
{
case
GNUTLS_MAC_UNKNOWN
:
case
GNUTLS_MAC_NULL
:
return
0
;
case
GNUTLS_MAC_MD5
:
return
CALG_MD5
;
case
GNUTLS_MAC_SHA1
:
case
GNUTLS_MAC_SHA256
:
case
GNUTLS_MAC_SHA384
:
case
GNUTLS_MAC_SHA512
:
return
CALG_SHA
;
default:
FIXME
(
"unknown algorithm %d
\n
"
,
mac
);
return
0
;
}
}
static
ALG_ID
schannel_get_kx_algid
(
gnutls_kx_algorithm_t
kx
)
{
switch
(
kx
)
{
case
GNUTLS_KX_RSA
:
return
CALG_RSA_KEYX
;
case
GNUTLS_KX_DHE_DSS
:
case
GNUTLS_KX_DHE_RSA
:
return
CALG_DH_EPHEM
;
default:
FIXME
(
"unknown algorithm %d
\n
"
,
kx
);
return
0
;
}
}
static
SECURITY_STATUS
schan_imp_get_session_peer_certificate
(
gnutls_session_t
s
,
PCCERT_CONTEXT
*
cert
)
{
...
...
@@ -905,102 +1001,6 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextA(
return
ret
;
}
static
unsigned
int
schannel_get_cipher_block_size
(
gnutls_cipher_algorithm_t
cipher
)
{
const
struct
{
gnutls_cipher_algorithm_t
cipher
;
unsigned
int
block_size
;
}
algorithms
[]
=
{
{
GNUTLS_CIPHER_3DES_CBC
,
8
},
{
GNUTLS_CIPHER_AES_128_CBC
,
16
},
{
GNUTLS_CIPHER_AES_256_CBC
,
16
},
{
GNUTLS_CIPHER_ARCFOUR_128
,
1
},
{
GNUTLS_CIPHER_ARCFOUR_40
,
1
},
{
GNUTLS_CIPHER_DES_CBC
,
8
},
{
GNUTLS_CIPHER_NULL
,
1
},
{
GNUTLS_CIPHER_RC2_40_CBC
,
8
},
};
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
algorithms
)
/
sizeof
(
*
algorithms
);
++
i
)
{
if
(
algorithms
[
i
].
cipher
==
cipher
)
return
algorithms
[
i
].
block_size
;
}
FIXME
(
"Unknown cipher %#x, returning 1
\n
"
,
cipher
);
return
1
;
}
static
DWORD
schannel_get_protocol
(
gnutls_protocol_t
proto
)
{
/* FIXME: currently schannel only implements client connections, but
* there's no reason it couldn't be used for servers as well. The
* context doesn't tell us which it is, so assume client for now.
*/
switch
(
proto
)
{
case
GNUTLS_SSL3
:
return
SP_PROT_SSL3_CLIENT
;
case
GNUTLS_TLS1_0
:
return
SP_PROT_TLS1_CLIENT
;
default:
FIXME
(
"unknown protocol %d
\n
"
,
proto
);
return
0
;
}
}
static
ALG_ID
schannel_get_cipher_algid
(
gnutls_cipher_algorithm_t
cipher
)
{
switch
(
cipher
)
{
case
GNUTLS_CIPHER_UNKNOWN
:
case
GNUTLS_CIPHER_NULL
:
return
0
;
case
GNUTLS_CIPHER_ARCFOUR_40
:
case
GNUTLS_CIPHER_ARCFOUR_128
:
return
CALG_RC4
;
case
GNUTLS_CIPHER_DES_CBC
:
case
GNUTLS_CIPHER_3DES_CBC
:
return
CALG_DES
;
case
GNUTLS_CIPHER_AES_128_CBC
:
case
GNUTLS_CIPHER_AES_256_CBC
:
return
CALG_AES
;
case
GNUTLS_CIPHER_RC2_40_CBC
:
return
CALG_RC2
;
default:
FIXME
(
"unknown algorithm %d
\n
"
,
cipher
);
return
0
;
}
}
static
ALG_ID
schannel_get_mac_algid
(
gnutls_mac_algorithm_t
mac
)
{
switch
(
mac
)
{
case
GNUTLS_MAC_UNKNOWN
:
case
GNUTLS_MAC_NULL
:
return
0
;
case
GNUTLS_MAC_MD5
:
return
CALG_MD5
;
case
GNUTLS_MAC_SHA1
:
case
GNUTLS_MAC_SHA256
:
case
GNUTLS_MAC_SHA384
:
case
GNUTLS_MAC_SHA512
:
return
CALG_SHA
;
default:
FIXME
(
"unknown algorithm %d
\n
"
,
mac
);
return
0
;
}
}
static
ALG_ID
schannel_get_kx_algid
(
gnutls_kx_algorithm_t
kx
)
{
switch
(
kx
)
{
case
GNUTLS_KX_RSA
:
return
CALG_RSA_KEYX
;
case
GNUTLS_KX_DHE_DSS
:
case
GNUTLS_KX_DHE_RSA
:
return
CALG_DH_EPHEM
;
default:
FIXME
(
"unknown algorithm %d
\n
"
,
kx
);
return
0
;
}
}
static
SECURITY_STATUS
SEC_ENTRY
schan_QueryContextAttributesW
(
PCtxtHandle
context_handle
,
ULONG
attribute
,
PVOID
buffer
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment