mirror of https://github.com/google/oss-fuzz.git
[tink] Initial integration (#5725)
This commit is contained in:
parent
a458e3c8ed
commit
aee8d9330b
|
@ -0,0 +1,25 @@
|
|||
# Copyright 2021 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
FROM gcr.io/oss-fuzz-base/base-builder
|
||||
FROM gcr.io/oss-fuzz-base/base-builder-go
|
||||
RUN apt-get update && apt-get install -y make pkg-config
|
||||
RUN git clone --depth 1 https://github.com/google/tink
|
||||
WORKDIR tink
|
||||
COPY fuzzing_CMake \
|
||||
build.sh \
|
||||
tink_encrypt_decrypt_fuzzer.cc \
|
||||
$SRC/
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash -eu
|
||||
# Copyright 2021 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
mkdir ./cc/fuzzing
|
||||
cp $SRC/tink_encrypt_decrypt_fuzzer.cc ./cc/fuzzing/
|
||||
cp $SRC/fuzzing_CMake ./cc/fuzzing/CMakeLists.txt
|
||||
cd cc/fuzzing && cmake .
|
||||
make -j$(nproc)
|
||||
mv tink_encrypt_fuzzer $OUT/
|
|
@ -0,0 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
project(tink_fuzz CXX)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
add_subdirectory(../.. tink)
|
||||
|
||||
add_executable(tink_encrypt_fuzzer tink_encrypt_decrypt_fuzzer.cc)
|
||||
target_link_libraries(tink_encrypt_fuzzer tink::static $ENV{LIB_FUZZING_ENGINE})
|
|
@ -0,0 +1,12 @@
|
|||
homepage: "https://developers.google.com/tink"
|
||||
language: c++
|
||||
primary_contact: "thaidn@google.com"
|
||||
auto_ccs:
|
||||
- "Adam@adalogics.com"
|
||||
- "sschmieg@google.com"
|
||||
- "tholenst@google.com"
|
||||
sanitizers:
|
||||
- address
|
||||
- undefined
|
||||
- memory
|
||||
main_repo: "https://github.com/google/tink"
|
|
@ -0,0 +1,31 @@
|
|||
/* Copyright 2021 Google LLC
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include "tink/subtle/aes_siv_boringssl.h"
|
||||
|
||||
|
||||
extern "C"
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size){
|
||||
crypto::tink::util::SecretData key = crypto::tink::util::SecretDataFromStringView("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f");
|
||||
auto res = crypto::tink::subtle::AesSivBoringSsl::New(key);
|
||||
auto cipher = std::move(res.ValueOrDie());
|
||||
std::string aad = "Additional data";
|
||||
std::string message(reinterpret_cast<const char*>(data), size);
|
||||
auto ct = cipher->EncryptDeterministically(message, aad);
|
||||
auto pt = cipher->DecryptDeterministically(ct.ValueOrDie(), aad);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue