Commit f2561b3f authored by Paul Bakker's avatar Paul Bakker
Browse files

Ability to provide alternate timing implementation

parent 64abd83b
......@@ -10,6 +10,7 @@ Features
* Support for RSASSA-PSS keys and signatures in certificates, CSRs
and CRLs
* Single Platform compatilibity layer (for memory / printf / fprintf)
* Ability to provide alternate timing implementation
Changes
* Deprecated the Memory layer
......
......@@ -159,6 +159,19 @@
* \{
*/
/**
* \def POLARSSL_TIMING_ALT
*
* Uncomment to provide your own alternate implementation for hardclock(),
* get_timer(), set_alarm() and m_sleep().
*
* Only works if you have POLARSSL_TIMING_C enabled.
*
* You will need to provide a header "timing_alt.h" and an implementation at
* compile time.
*/
//#define POLARSSL_TIMING_ALT
/**
* \def POLARSSL_XXX_ALT
*
......
......@@ -3,7 +3,7 @@
*
* \brief Portable interface to the CPU cycle counter
*
* Copyright (C) 2006-2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
......@@ -27,6 +27,12 @@
#ifndef POLARSSL_TIMING_H
#define POLARSSL_TIMING_H
#include "config.h"
#if !defined(POLARSSL_TIMING_ALT)
// Regular implementation
//
#ifdef __cplusplus
extern "C" {
#endif
......@@ -72,4 +78,8 @@ void m_sleep( int milliseconds );
}
#endif
#else /* POLARSSL_TIMING_ALT */
#include "timing_alt.h"
#endif /* POLARSSL_TIMING_ALT */
#endif /* timing.h */
/*
* Portable interface to the CPU cycle counter
*
* Copyright (C) 2006-2010, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
......@@ -25,7 +25,7 @@
#include "polarssl/config.h"
#if defined(POLARSSL_TIMING_C)
#if defined(POLARSSL_TIMING_C) && !defined(POLARSSL_TIMING_ALT)
#include "polarssl/timing.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment