1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

Add Poly1305 authenticator algorithm (RFC 7539)

Test vectors are included from RFC 7539.

Poly1305 is also added to the benchmark program.
This commit is contained in:
Daniel King
2016-05-16 18:25:45 -03:00
committed by Manuel Pégourié-Gonnard
parent bd92062269
commit adc32c0b50
14 changed files with 798 additions and 7 deletions

View File

@@ -63,6 +63,7 @@ int main( void )
#include "mbedtls/gcm.h"
#include "mbedtls/ccm.h"
#include "mbedtls/cmac.h"
#include "mbedtls/poly1305.h"
#include "mbedtls/havege.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/hmac_drbg.h"
@@ -95,7 +96,8 @@ int main( void )
#define OPTIONS \
"md4, md5, ripemd160, sha1, sha256, sha512,\n" \
"arc4, des3, des, camellia, blowfish, chacha20,\n" \
"aes_cbc, aes_gcm, aes_ccm, aes_cmac, des3_cmac,\n" \
"aes_cbc, aes_gcm, aes_ccm,\n" \
"aes_cmac, des3_cmac, poly1305\n" \
"havege, ctr_drbg, hmac_drbg\n" \
"rsa, dhm, ecdsa, ecdh.\n"
@@ -231,6 +233,7 @@ typedef struct {
arc4, des3, des,
aes_cbc, aes_gcm, aes_ccm, aes_cmac, des3_cmac,
camellia, blowfish, chacha20,
poly1305,
havege, ctr_drbg, hmac_drbg,
rsa, dhm, ecdsa, ecdh;
} todo_list;
@@ -289,6 +292,8 @@ int main( int argc, char *argv[] )
todo.blowfish = 1;
else if( strcmp( argv[i], "chacha20" ) == 0 )
todo.chacha20 = 1;
else if( strcmp( argv[i], "poly1305" ) == 0 )
todo.poly1305 = 1;
else if( strcmp( argv[i], "havege" ) == 0 )
todo.havege = 1;
else if( strcmp( argv[i], "ctr_drbg" ) == 0 )
@@ -530,6 +535,13 @@ int main( int argc, char *argv[] )
}
#endif
#if defined(MBEDTLS_POLY1305_C)
if ( todo.poly1305 )
{
TIME_AND_TSC( "Poly1305", mbedtls_poly1305_mac( buf, BUFSIZE, buf, buf ) );
}
#endif
#if defined(MBEDTLS_BLOWFISH_C) && defined(MBEDTLS_CIPHER_MODE_CBC)
if( todo.blowfish )
{