Ability to provide alternate timing implementation

This commit is contained in:
Paul Bakker 2014-02-06 15:11:55 +01:00
parent 64abd83b67
commit f2561b3f69
4 changed files with 27 additions and 3 deletions

View file

@ -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

View file

@ -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
*

View file

@ -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 */

View file

@ -1,7 +1,7 @@
/*
* 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"