Skip to content

Commit d4633b9

Browse files
committed
CMake: Move mbedtls stub headers to the mbedtls doubles dir
Previously all the mbedtls stubs headers under mbed-stubs-headers, so this PR move all mbedtls stubs headers under mbedtls/tests/UNITTESTS/double directory and update CMake to include stubs headers into mbed-stubs-mbedtls library to make mbedtls stubs to be self-contained. Made a copy of mbedtls_stub.h and add it into mbed-stubs-mbedtls as previously this file gets referred from connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.h and problem is nanostack unit test is not maintained as part of mbed os unit tests.
1 parent b1075e1 commit d4633b9

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

connectivity/mbedtls/tests/UNITTESTS/doubles/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ target_include_directories(mbed-headers-mbedtls
1111

1212
add_library(mbed-stubs-mbedtls)
1313

14+
target_include_directories(mbed-stubs-mbedtls
15+
PUBLIC
16+
.
17+
)
18+
1419
target_sources(mbed-stubs-mbedtls
1520
PRIVATE
1621
aes_stub.c
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2015-2017, 2019-2020, Pelion and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef MBEDTLS_STUB_H
18+
#define MBEDTLS_STUB_H
19+
20+
#define MBEDTLS_SSL_EXPORT_KEYS
21+
22+
#include <inttypes.h>
23+
#include <stdbool.h>
24+
#include "mbedtls/platform.h"
25+
#include "mbedtls/ssl.h"
26+
#include "mbedtls/ctr_drbg.h"
27+
#include "mbedtls/hmac_drbg.h"
28+
#include "mbedtls/x509_crt.h"
29+
#include "mbedtls/sha256.h"
30+
#include "mbedtls/entropy.h"
31+
#include "mbedtls/pk.h"
32+
#include "mbedtls/platform.h"
33+
#include "mbedtls/md.h"
34+
35+
36+
#define HANDSHAKE_FINISHED_VALUE 8888
37+
#define HANDSHAKE_FINISHED_VALUE_RETURN_ZERO 8889
38+
39+
typedef struct {
40+
int crt_expected_int;
41+
bool useCounter;
42+
int counter;
43+
int retArray[20];
44+
int expected_int;
45+
uint32_t uint32_value;
46+
bool invalidate_timer;
47+
void *cookie_obj;
48+
unsigned char cookie_value[8];
49+
size_t cookie_len;
50+
} mbedtls_stub_def;
51+
52+
extern mbedtls_stub_def mbedtls_stub;
53+
54+
#endif // MBEDTLS_STUB_H

0 commit comments

Comments
 (0)