Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
092b9aca
Commit
092b9aca
authored
13 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
Have get_mozilla_ciphers take sourcedirs as arguments
parent
a6a905cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/get_mozilla_ciphers.py
+27
-7
27 additions, 7 deletions
src/common/get_mozilla_ciphers.py
with
27 additions
and
7 deletions
src/common/get_mozilla_ciphers.py
+
27
−
7
View file @
092b9aca
...
...
@@ -5,13 +5,30 @@
# This script parses Firefox and OpenSSL sources, and uses this information
# to generate a ciphers.inc file.
#
# It takes two arguments: the location of a firefox source directory, and the
# location of an openssl source directory.
import
os
import
re
import
sys
if
len
(
sys
.
argv
)
!=
3
:
print
>>
sys
.
stderr
,
"
Syntax: get_mozilla_ciphers.py <firefox-source-dir> <openssl-source-dir>
"
sys
.
exit
(
1
)
ff_root
=
sys
.
argv
[
1
]
ossl_root
=
sys
.
argv
[
2
]
def
ff
(
s
):
return
os
.
path
.
join
(
ff_root
,
s
)
def
ossl
(
s
):
return
os
.
path
.
join
(
ossl_root
,
s
)
#####
# Read the cpp file to understand what Ciphers map to what name :
# Make "ciphers" a map from name used in the javascript to a cipher macro name
fileA
=
open
(
'
security/manager/ssl/src/nsNSSComponent.cpp
'
,
'
r
'
)
fileA
=
open
(
ff
(
'
security/manager/ssl/src/nsNSSComponent.cpp
'
)
,
'
r
'
)
# The input format is a file containing exactly one section of the form:
# static CipherPref CipherPrefs[] = {
...
...
@@ -49,7 +66,7 @@ for line in cipherLines:
# Build a map enabled_ciphers from javascript name to "true" or "false",
# and an (unordered!) list of the macro names for those ciphers that are
# enabled.
fileB
=
open
(
'
netwerk/base/public/security-prefs.js
'
,
'
r
'
)
fileB
=
open
(
ff
(
'
netwerk/base/public/security-prefs.js
'
)
,
'
r
'
)
enabled_ciphers
=
{}
for
line
in
fileB
:
...
...
@@ -66,15 +83,18 @@ for k, v in enabled_ciphers.items():
if
v
==
"
true
"
:
used_ciphers
.
append
(
ciphers
[
k
])
oSSLinclude
=
(
'
/usr/include/openssl/ssl3.h
'
,
'
/usr/include/openssl/ssl.h
'
,
'
/usr/include/openssl/ssl2.h
'
,
'
/usr/include/openssl/ssl23.h
'
,
'
/usr/include/openssl/tls1.h
'
)
#oSSLinclude = ('/usr/include/openssl/ssl3.h', '/usr/include/openssl/ssl.h',
# '/usr/include/openssl/ssl2.h', '/usr/include/openssl/ssl23.h',
# '/usr/include/openssl/tls1.h')
oSSLinclude
=
(
'
ssl/ssl3.h
'
,
'
ssl/ssl.h
'
,
'
ssl/ssl2.h
'
,
'
ssl/ssl23.h
'
,
'
ssl/tls1.h
'
)
#####
# This reads the hex code for the ciphers that are used by firefox.
# sslProtoD is set to a map from macro name to macro value in sslproto.h;
# cipher_codes is set to an (unordered!) list of these hex values.
sslProto
=
open
(
'
security/nss/lib/ssl/sslproto.h
'
,
'
r
'
)
sslProto
=
open
(
ff
(
'
security/nss/lib/ssl/sslproto.h
'
)
,
'
r
'
)
sslProtoD
=
{}
for
line
in
sslProto
:
...
...
@@ -93,7 +113,7 @@ for x in used_ciphers:
# macro names for those files.
cipher_hex
=
{}
for
fl
in
oSSLinclude
:
fp
=
open
(
fl
,
'
r
'
)
fp
=
open
(
ossl
(
fl
)
,
'
r
'
)
for
line
in
fp
.
readlines
():
m
=
re
.
match
(
'
#define\s+(\S+)\s+(\S+)
'
,
line
)
if
m
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment