summaryrefslogtreecommitdiff
path: root/src/mongo/crypto/SConscript
blob: 8d151e993c65e4285d39bac38abd5bb27c7572e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# -*- mode: python -*-

Import("env")

env = env.Clone()

env.Library('sha1_block',
    source=[
        'sha1_block.cpp'
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/util/secure_compare_memory',
    ])

env.Library('sha256_block',
    source=[
        'sha256_block.cpp'
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/util/secure_compare_memory',
    ])

if "tom" in env["MONGO_CRYPTO"]:
    tomEnv = env.Clone()
    tomEnv.InjectThirdParty(libraries=['tomcrypt'])
    tomEnv.Append(
        CPPDEFINES=[
            'LTC_NO_PROTOTYPES',
        ]
    )

    tomEnv.Library(
        target='sha_block_tom',
        source=[
            'sha_block_tom.cpp'
        ],
        LIBDEPS=[
            '$BUILD_DIR/mongo/base',
            'sha1_block',
            'sha256_block',
        ],
        LIBDEPS_PRIVATE=[
            '$BUILD_DIR/third_party/shim_tomcrypt',
        ]
    )

else:
    env.Library('sha_block_${MONGO_CRYPTO}',
        source=[
            'sha_block_${MONGO_CRYPTO}.cpp'
        ],
        LIBDEPS=[
            '$BUILD_DIR/mongo/base',
            'sha1_block',
            'sha256_block',
        ])

env.Library(target='symmetric_crypto',
            source=[
                'symmetric_crypto.cpp',
                'symmetric_crypto_${MONGO_CRYPTO}.cpp',
                'symmetric_key.cpp',
            ],
            LIBDEPS=[
                '$BUILD_DIR/mongo/base/secure_allocator',
                '$BUILD_DIR/mongo/util/net/openssl_init' if 'openssl' in env['MONGO_CRYPTO'] else '',
                '$BUILD_DIR/mongo/util/secure_zero_memory',
            ],
)

env.Library(
    target="aead_encryption",
    source=[
        "aead_encryption.cpp",
    ],
    LIBDEPS=[
        'symmetric_crypto',
        '$BUILD_DIR/mongo/db/matcher/expressions',
    ],
)

env.CppUnitTest(
    target='crypto_test',
    source=[
        'aead_encryption_test.cpp' if "tom" not in env["MONGO_CRYPTO"] else [],
        'mechanism_scram_test.cpp',
        'sha1_block_test.cpp',
        'sha256_block_test.cpp',
        'sha512_block_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/base/secure_allocator',
        'aead_encryption' if "tom" not in env["MONGO_CRYPTO"] else [],
        'sha_block_${MONGO_CRYPTO}',
    ],
)