Skip to content

Commit 95c29f3

Browse files
author
Adam Langley
committed
Inital import.
Initial fork from f2d678e6e89b6508147086610e985d4e8416e867 (1.0.2 beta). (This change contains substantial changes from the original and effectively starts a new history.)
0 parents  commit 95c29f3

File tree

600 files changed

+234775
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

600 files changed

+234775
-0
lines changed

.clang-format

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
BasedOnStyle: Google
2+
MaxEmptyLinesToKeep: 3
3+
AllowShortIfStatementsOnASingleLine: false
4+
AllowShortLoopsOnASingleLine: false

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build/
2+
ssl/test/runner/runner
3+
*.swp
4+
*.swo

BUGS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
On 32-bit, if the CPUID is clear, GCM is miscalculated.

BUILDING

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cmake --version # ensure that you have >= 2.8.8
2+
3+
mkdir build
4+
cd build
5+
cmake ..
6+
make
7+
8+
If you see an error about "Cannot find source file: OBJECT" then your version of CMake is too old.
9+
10+
Note that the default build flags in the top-leve CMakeLists.txt are for
11+
debugging - optimisation isn't enabled.
12+
13+
If you'll be building a lot, then installing Ninja[1] is highly recommended.
14+
Wipe out the build directory and recreate it, but using:
15+
16+
cmake -GNinja ..
17+
ninja
18+
19+
If you want to cross-compile then there are example toolchain files for 32-bit
20+
Intel and ARM in util/. Wipe out the build directory, recreate it and run cmake
21+
like this:
22+
23+
cmake -DCMAKE_TOOLCHAIN_FILE=../util/arm-toolchain.cmake -GNinja ..
24+
25+
[1] http://martine.github.io/ninja/

CMakeLists.txt

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
cmake_minimum_required (VERSION 2.8)
2+
3+
project (BoringSSL)
4+
5+
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
6+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -ggdb -std=c89")
7+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -ggdb -std=c++0x")
8+
elseif(MSVC)
9+
# Disable warnings for implicit integer narrowing.
10+
set(CMAKE_C_FLAGS "/wd4267")
11+
endif()
12+
13+
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
14+
set(ARCH "x86_64")
15+
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
16+
# cmake reports AMD64 on Windows, but we might be building for 32-bit.
17+
if (CMAKE_CL_64)
18+
set(ARCH "x86_64")
19+
else()
20+
set(ARCH "x86")
21+
endif()
22+
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
23+
set(ARCH "x86")
24+
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm")
25+
set(ARCH "arm")
26+
else()
27+
message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR})
28+
endif()
29+
30+
add_subdirectory(crypto)
31+
add_subdirectory(ssl)
32+
add_subdirectory(ssl/test)
33+
add_subdirectory(tool)

crypto/CMakeLists.txt

+159
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
include_directories(. ../include)
2+
3+
if (UNIX)
4+
set(PERLASM_STYLE elf)
5+
set(ASM_EXT S)
6+
enable_language(ASM)
7+
else()
8+
if (CMAKE_CL_64)
9+
message("Using masm")
10+
set(PERLASM_STYLE masm)
11+
else()
12+
message("Using win32n")
13+
set(PERLASM_STYLE win32n)
14+
endif()
15+
set(ASM_EXT asm)
16+
enable_language(ASM_MASM)
17+
endif()
18+
19+
function(perlasm dest src)
20+
add_custom_command(
21+
OUTPUT ${dest}
22+
COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${PERLASM_STYLE} ${ARGN} > ${dest}
23+
DEPENDS
24+
${src}
25+
${PROJECT_SOURCE_DIR}/crypto/perlasm/x86_64-xlate.pl
26+
${PROJECT_SOURCE_DIR}/crypto/perlasm/x86gas.pl
27+
${PROJECT_SOURCE_DIR}/crypto/perlasm/x86asm.pl
28+
${PROJECT_SOURCE_DIR}/crypto/perlasm/x86asm.pl
29+
WORKING_DIRECTORY .
30+
)
31+
endfunction()
32+
33+
if (${ARCH} STREQUAL "x86_64")
34+
set(
35+
CRYPTO_ARCH_SOURCES
36+
37+
cpu-x86_64-asm.${ASM_EXT}
38+
cpu-intel.c
39+
)
40+
endif()
41+
42+
if (${ARCH} STREQUAL "x86")
43+
set(
44+
CRYPTO_ARCH_SOURCES
45+
46+
cpu-x86-asm.${ASM_EXT}
47+
cpu-intel.c
48+
)
49+
endif()
50+
51+
if (${ARCH} STREQUAL "arm")
52+
set(
53+
CRYPTO_ARCH_SOURCES
54+
55+
cpu-x86-asm.${ASM_EXT}
56+
cpu-arm.c
57+
)
58+
endif()
59+
60+
# Level 0.1 - depends on nothing outside this set.
61+
add_subdirectory(stack)
62+
add_subdirectory(lhash)
63+
add_subdirectory(err)
64+
add_subdirectory(buf)
65+
add_subdirectory(comp)
66+
add_subdirectory(base64)
67+
add_subdirectory(bytestring)
68+
69+
# Level 0.2 - depends on nothing but itself
70+
add_subdirectory(sha)
71+
add_subdirectory(md5)
72+
add_subdirectory(modes)
73+
add_subdirectory(aes)
74+
add_subdirectory(des)
75+
add_subdirectory(rc4)
76+
add_subdirectory(conf)
77+
78+
# Level 1, depends only on 0.*
79+
add_subdirectory(digest)
80+
add_subdirectory(cipher)
81+
add_subdirectory(rand)
82+
add_subdirectory(bio)
83+
add_subdirectory(bn)
84+
add_subdirectory(obj)
85+
add_subdirectory(asn1)
86+
87+
# Level 2
88+
add_subdirectory(engine)
89+
add_subdirectory(dh)
90+
add_subdirectory(dsa)
91+
add_subdirectory(rsa)
92+
add_subdirectory(ec)
93+
add_subdirectory(ecdh)
94+
add_subdirectory(ecdsa)
95+
add_subdirectory(hmac)
96+
97+
# Level 3
98+
add_subdirectory(evp)
99+
add_subdirectory(pem)
100+
add_subdirectory(x509)
101+
add_subdirectory(x509v3)
102+
103+
# Level 4
104+
add_subdirectory(pkcs8)
105+
106+
add_library(
107+
crypto
108+
STATIC
109+
110+
crypto_error.c
111+
mem.c
112+
mem_clear.c
113+
thread.c
114+
ex_data.c
115+
ex_data_impl.c
116+
time_support.c
117+
directory_posix.c
118+
directory_win.c
119+
120+
${CRYPTO_ARCH_SOURCES}
121+
122+
$<TARGET_OBJECTS:stack>
123+
$<TARGET_OBJECTS:lhash>
124+
$<TARGET_OBJECTS:err>
125+
$<TARGET_OBJECTS:comp>
126+
$<TARGET_OBJECTS:base64>
127+
$<TARGET_OBJECTS:bytestring>
128+
$<TARGET_OBJECTS:sha>
129+
$<TARGET_OBJECTS:md5>
130+
$<TARGET_OBJECTS:digest>
131+
$<TARGET_OBJECTS:cipher>
132+
$<TARGET_OBJECTS:modes>
133+
$<TARGET_OBJECTS:aes>
134+
$<TARGET_OBJECTS:des>
135+
$<TARGET_OBJECTS:rc4>
136+
$<TARGET_OBJECTS:conf>
137+
$<TARGET_OBJECTS:buf>
138+
$<TARGET_OBJECTS:bn>
139+
$<TARGET_OBJECTS:bio>
140+
$<TARGET_OBJECTS:rand>
141+
$<TARGET_OBJECTS:obj>
142+
$<TARGET_OBJECTS:asn1>
143+
$<TARGET_OBJECTS:engine>
144+
$<TARGET_OBJECTS:dh>
145+
$<TARGET_OBJECTS:dsa>
146+
$<TARGET_OBJECTS:rsa>
147+
$<TARGET_OBJECTS:ec>
148+
$<TARGET_OBJECTS:ecdh>
149+
$<TARGET_OBJECTS:ecdsa>
150+
$<TARGET_OBJECTS:hmac>
151+
$<TARGET_OBJECTS:evp>
152+
$<TARGET_OBJECTS:pem>
153+
$<TARGET_OBJECTS:x509>
154+
$<TARGET_OBJECTS:x509v3>
155+
$<TARGET_OBJECTS:pkcs8>
156+
)
157+
158+
perlasm(cpu-x86_64-asm.${ASM_EXT} cpu-x86_64-asm.pl)
159+
perlasm(cpu-x86-asm.${ASM_EXT} cpu-x86-asm.pl)

crypto/aes/CMakeLists.txt

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
include_directories(. .. ../../include)
2+
3+
if (${ARCH} STREQUAL "x86_64")
4+
set(
5+
AES_ARCH_SOURCES
6+
7+
aes-x86_64.${ASM_EXT}
8+
aesni-x86_64.${ASM_EXT}
9+
bsaes-x86_64.${ASM_EXT}
10+
vpaes-x86_64.${ASM_EXT}
11+
)
12+
endif()
13+
14+
if (${ARCH} STREQUAL "x86")
15+
set(
16+
AES_ARCH_SOURCES
17+
18+
aes-586.${ASM_EXT}
19+
vpaes-x86.${ASM_EXT}
20+
aesni-x86.${ASM_EXT}
21+
)
22+
endif()
23+
24+
if (${ARCH} STREQUAL "arm")
25+
set(
26+
AES_ARCH_SOURCES
27+
28+
aes-armv4.${ASM_EXT}
29+
bsaes-armv7.${ASM_EXT}
30+
)
31+
endif()
32+
33+
add_library(
34+
aes
35+
36+
OBJECT
37+
38+
aes.c
39+
mode_wrappers.c
40+
41+
${AES_ARCH_SOURCES}
42+
)
43+
44+
perlasm(aes-x86_64.${ASM_EXT} asm/aes-x86_64.pl)
45+
perlasm(aesni-x86_64.${ASM_EXT} asm/aesni-x86_64.pl)
46+
perlasm(bsaes-x86_64.${ASM_EXT} asm/bsaes-x86_64.pl)
47+
perlasm(vpaes-x86_64.${ASM_EXT} asm/vpaes-x86_64.pl)
48+
perlasm(aes-586.${ASM_EXT} asm/aes-586.pl)
49+
perlasm(vpaes-x86.${ASM_EXT} asm/vpaes-x86.pl)
50+
perlasm(aesni-x86.${ASM_EXT} asm/aesni-x86.pl)
51+
perlasm(aes-armv4.${ASM_EXT} asm/aes-armv4.pl)
52+
perlasm(bsaes-armv7.${ASM_EXT} asm/bsaes-armv7.pl)

0 commit comments

Comments
 (0)