mbed TLS Build
include/mbedtls/platform_time.h@1:1a219dea6cb5, 2019-06-04 (annotated)
- Committer:
- williequesada
- Date:
- Tue Jun 04 16:03:38 2019 +0000
- Revision:
- 1:1a219dea6cb5
- Parent:
- 0:cdf462088d13
compartir a Pablo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
markrad | 0:cdf462088d13 | 1 | /** |
markrad | 0:cdf462088d13 | 2 | * \file platform_time.h |
markrad | 0:cdf462088d13 | 3 | * |
markrad | 0:cdf462088d13 | 4 | * \brief mbed TLS Platform time abstraction |
markrad | 0:cdf462088d13 | 5 | * |
markrad | 0:cdf462088d13 | 6 | * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved |
markrad | 0:cdf462088d13 | 7 | * SPDX-License-Identifier: Apache-2.0 |
markrad | 0:cdf462088d13 | 8 | * |
markrad | 0:cdf462088d13 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
markrad | 0:cdf462088d13 | 10 | * not use this file except in compliance with the License. |
markrad | 0:cdf462088d13 | 11 | * You may obtain a copy of the License at |
markrad | 0:cdf462088d13 | 12 | * |
markrad | 0:cdf462088d13 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
markrad | 0:cdf462088d13 | 14 | * |
markrad | 0:cdf462088d13 | 15 | * Unless required by applicable law or agreed to in writing, software |
markrad | 0:cdf462088d13 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
markrad | 0:cdf462088d13 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
markrad | 0:cdf462088d13 | 18 | * See the License for the specific language governing permissions and |
markrad | 0:cdf462088d13 | 19 | * limitations under the License. |
markrad | 0:cdf462088d13 | 20 | * |
markrad | 0:cdf462088d13 | 21 | * This file is part of mbed TLS (https://tls.mbed.org) |
markrad | 0:cdf462088d13 | 22 | */ |
markrad | 0:cdf462088d13 | 23 | #ifndef MBEDTLS_PLATFORM_TIME_H |
markrad | 0:cdf462088d13 | 24 | #define MBEDTLS_PLATFORM_TIME_H |
markrad | 0:cdf462088d13 | 25 | |
markrad | 0:cdf462088d13 | 26 | #if !defined(MBEDTLS_CONFIG_FILE) |
markrad | 0:cdf462088d13 | 27 | #include "config.h" |
markrad | 0:cdf462088d13 | 28 | #else |
markrad | 0:cdf462088d13 | 29 | #include MBEDTLS_CONFIG_FILE |
markrad | 0:cdf462088d13 | 30 | #endif |
markrad | 0:cdf462088d13 | 31 | |
markrad | 0:cdf462088d13 | 32 | #ifdef __cplusplus |
markrad | 0:cdf462088d13 | 33 | extern "C" { |
markrad | 0:cdf462088d13 | 34 | #endif |
markrad | 0:cdf462088d13 | 35 | |
markrad | 0:cdf462088d13 | 36 | /** |
markrad | 0:cdf462088d13 | 37 | * \name SECTION: Module settings |
markrad | 0:cdf462088d13 | 38 | * |
markrad | 0:cdf462088d13 | 39 | * The configuration options you can set for this module are in this section. |
markrad | 0:cdf462088d13 | 40 | * Either change them in config.h or define them on the compiler command line. |
markrad | 0:cdf462088d13 | 41 | * \{ |
markrad | 0:cdf462088d13 | 42 | */ |
markrad | 0:cdf462088d13 | 43 | |
markrad | 0:cdf462088d13 | 44 | /* |
markrad | 0:cdf462088d13 | 45 | * The time_t datatype |
markrad | 0:cdf462088d13 | 46 | */ |
markrad | 0:cdf462088d13 | 47 | #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) |
markrad | 0:cdf462088d13 | 48 | typedef MBEDTLS_PLATFORM_TIME_TYPE_MACRO mbedtls_time_t; |
markrad | 0:cdf462088d13 | 49 | #else |
markrad | 0:cdf462088d13 | 50 | /* For time_t */ |
markrad | 0:cdf462088d13 | 51 | #include <time.h> |
markrad | 0:cdf462088d13 | 52 | typedef time_t mbedtls_time_t; |
markrad | 0:cdf462088d13 | 53 | #endif /* MBEDTLS_PLATFORM_TIME_TYPE_MACRO */ |
markrad | 0:cdf462088d13 | 54 | |
markrad | 0:cdf462088d13 | 55 | /* |
markrad | 0:cdf462088d13 | 56 | * The function pointers for time |
markrad | 0:cdf462088d13 | 57 | */ |
markrad | 0:cdf462088d13 | 58 | #if defined(MBEDTLS_PLATFORM_TIME_ALT) |
markrad | 0:cdf462088d13 | 59 | extern mbedtls_time_t (*mbedtls_time)( mbedtls_time_t* time ); |
markrad | 0:cdf462088d13 | 60 | |
markrad | 0:cdf462088d13 | 61 | /** |
markrad | 0:cdf462088d13 | 62 | * \brief Set your own time function pointer |
markrad | 0:cdf462088d13 | 63 | * |
markrad | 0:cdf462088d13 | 64 | * \param time_func the time function implementation |
markrad | 0:cdf462088d13 | 65 | * |
markrad | 0:cdf462088d13 | 66 | * \return 0 |
markrad | 0:cdf462088d13 | 67 | */ |
markrad | 0:cdf462088d13 | 68 | int mbedtls_platform_set_time( mbedtls_time_t (*time_func)( mbedtls_time_t* time ) ); |
markrad | 0:cdf462088d13 | 69 | #else |
markrad | 0:cdf462088d13 | 70 | #if defined(MBEDTLS_PLATFORM_TIME_MACRO) |
markrad | 0:cdf462088d13 | 71 | #define mbedtls_time MBEDTLS_PLATFORM_TIME_MACRO |
markrad | 0:cdf462088d13 | 72 | #else |
markrad | 0:cdf462088d13 | 73 | #define mbedtls_time time |
markrad | 0:cdf462088d13 | 74 | #endif /* MBEDTLS_PLATFORM_TIME_MACRO */ |
markrad | 0:cdf462088d13 | 75 | #endif /* MBEDTLS_PLATFORM_TIME_ALT */ |
markrad | 0:cdf462088d13 | 76 | |
markrad | 0:cdf462088d13 | 77 | #ifdef __cplusplus |
markrad | 0:cdf462088d13 | 78 | } |
markrad | 0:cdf462088d13 | 79 | #endif |
markrad | 0:cdf462088d13 | 80 | |
markrad | 0:cdf462088d13 | 81 | #endif /* platform_time.h */ |