Add (placeholder) CCM module
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
index 86ccee1..4cbd162 100644
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -11,6 +11,7 @@
bignum.c
blowfish.c
camellia.c
+ ccm.c
certs.c
cipher.c
cipher_wrap.c
diff --git a/library/Makefile b/library/Makefile
index e02a258..281353a 100644
--- a/library/Makefile
+++ b/library/Makefile
@@ -37,7 +37,7 @@
OBJS= aes.o aesni.o arc4.o \
asn1parse.o \
asn1write.o base64.o bignum.o \
- blowfish.o camellia.o \
+ blowfish.o camellia.o ccm.o \
certs.o cipher.o cipher_wrap.o \
ctr_drbg.o debug.o des.o \
dhm.o ecdh.o ecdsa.o \
diff --git a/library/ccm.c b/library/ccm.c
new file mode 100644
index 0000000..b4ba3d5
--- /dev/null
+++ b/library/ccm.c
@@ -0,0 +1,67 @@
+/*
+ * NIST SP800-38C compliant CCM implementation
+ *
+ * Copyright (C) 2014, Brainspark B.V.
+ *
+ * This file is part of PolarSSL (http://www.polarssl.org)
+ * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*
+ * Definition of CCM:
+ * http://csrc.nist.gov/publications/nistpubs/800-38C/SP800-38C_updated-July20_2007.pdf
+ * RFC 3610 "Counter with CBC-MAC (CCM)"
+ *
+ * Related:
+ * RFC 5116 "An Interface and Algorithms for Authenticated Encryption"
+ */
+
+#if !defined(POLARSSL_CONFIG_FILE)
+#include "polarssl/config.h"
+#else
+#include POLARSSL_CONFIG_FILE
+#endif
+
+#if defined(POLARSSL_CCM_C)
+
+#include "polarssl/ccm.h"
+
+
+#if defined(POLARSSL_SELF_TEST) && defined(POLARSSL_AES_C)
+
+#if defined(POLARSSL_PLATFORM_C)
+#include "polarssl/platform.h"
+#else
+#define polarssl_printf printf
+#endif
+
+int ccm_self_test( int verbose )
+{
+ if( verbose != 0 )
+ polarssl_printf( " CCM: skip\n" );
+
+ if( verbose != 0 )
+ polarssl_printf( "\n" );
+
+ return( 0 );
+}
+
+#endif /* POLARSSL_SELF_TEST && POLARSSL_AES_C */
+
+#endif /* POLARSSL_CCM_C */
diff --git a/library/error.c b/library/error.c
index 1eac108..8afc092 100644
--- a/library/error.c
+++ b/library/error.c
@@ -53,6 +53,10 @@
#include "polarssl/camellia.h"
#endif
+#if defined(POLARSSL_CCM_C)
+#include "polarssl/ccm.h"
+#endif
+
#if defined(POLARSSL_CIPHER_C)
#include "polarssl/cipher.h"
#endif
@@ -575,6 +579,13 @@
snprintf( buf, buflen, "CAMELLIA - Invalid data input length" );
#endif /* POLARSSL_CAMELLIA_C */
+#if defined(POLARSSL_CCM_C)
+ if( use_ret == -(POLARSSL_ERR_CCM_BAD_INPUT) )
+ snprintf( buf, buflen, "CCM - Bad input parameters to function" );
+ if( use_ret == -(POLARSSL_ERR_CCM_AUTH_FAILED) )
+ snprintf( buf, buflen, "CCM - Authenticated decryption failed" );
+#endif /* POLARSSL_CCM_C */
+
#if defined(POLARSSL_CTR_DRBG_C)
if( use_ret == -(POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED) )
snprintf( buf, buflen, "CTR_DRBG - The entropy source failed" );
diff --git a/library/version_features.c b/library/version_features.c
index 68955c3..8dc530a 100644
--- a/library/version_features.c
+++ b/library/version_features.c
@@ -366,6 +366,9 @@
#if defined(POLARSSL_CAMELLIA_C)
"POLARSSL_CAMELLIA_C",
#endif /* POLARSSL_CAMELLIA_C */
+#if defined(POLARSSL_CCM_C)
+ "POLARSSL_CCM_C",
+#endif /* POLARSSL_CCM_C */
#if defined(POLARSSL_CERTS_C)
"POLARSSL_CERTS_C",
#endif /* POLARSSL_CERTS_C */