aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Nissler <mnissler@google.com>2016-03-22 15:27:15 +0100
committerMattias Nissler <mnissler@google.com>2016-03-22 16:13:21 +0100
commitfca75c837bebfbd51927156158de36fc517742f7 (patch)
tree250ce715831755b4a9962802cd8168fcfac089a1
parent40349ead4ab9c3043109abf40e12c77b4ca35c07 (diff)
downloadlibconstrainedcrypto-oreo-vts-release.tar.gz
Rename mincrypt to constrainedcryptoandroid-wear-o-preview-4android-wear-o-preview-3android-wear-n-preview-3android-wear-n-preview-2android-wear-n-preview-1android-wear-7.1.1_r1android-vts-8.0_r9android-vts-8.0_r8android-vts-8.0_r7android-vts-8.0_r6android-vts-8.0_r2android-vts-8.0_r13android-vts-8.0_r12android-vts-8.0_r11android-vts-8.0_r10android-vts-8.0_r1android-security-8.0.0_r54android-security-8.0.0_r53android-security-8.0.0_r52android-o-preview-2android-o-preview-1android-n-preview-5android-n-preview-4android-n-preview-3android-n-preview-2android-n-mr2-preview-2android-n-mr2-preview-1android-n-mr1-preview-2android-n-mr1-preview-1android-n-iot-preview-2android-cts-8.0_r9android-cts-8.0_r8android-cts-8.0_r7android-cts-8.0_r6android-cts-8.0_r5android-cts-8.0_r4android-cts-8.0_r3android-cts-8.0_r26android-cts-8.0_r25android-cts-8.0_r24android-cts-8.0_r23android-cts-8.0_r22android-cts-8.0_r21android-cts-8.0_r20android-cts-8.0_r2android-cts-8.0_r19android-cts-8.0_r18android-cts-8.0_r17android-cts-8.0_r16android-cts-8.0_r15android-cts-8.0_r14android-cts-8.0_r13android-cts-8.0_r12android-cts-8.0_r11android-cts-8.0_r10android-cts-8.0_r1android-cts-7.1_r18android-8.0.0_r9android-8.0.0_r7android-8.0.0_r51android-8.0.0_r50android-8.0.0_r49android-8.0.0_r48android-8.0.0_r47android-8.0.0_r46android-8.0.0_r45android-8.0.0_r44android-8.0.0_r43android-8.0.0_r42android-8.0.0_r41android-8.0.0_r40android-8.0.0_r4android-8.0.0_r39android-8.0.0_r38android-8.0.0_r37android-8.0.0_r36android-8.0.0_r35android-8.0.0_r32android-8.0.0_r31android-8.0.0_r30android-8.0.0_r3android-8.0.0_r29android-8.0.0_r28android-8.0.0_r2android-8.0.0_r17android-8.0.0_r16android-8.0.0_r15android-8.0.0_r13android-8.0.0_r12android-8.0.0_r11android-8.0.0_r10android-8.0.0_r1security-oc-releaseoreo-vts-releaseoreo-security-releaseoreo-releaseoreo-r6-releaseoreo-r5-releaseoreo-r4-releaseoreo-r3-releaseoreo-r2-releaseoreo-devoreo-cts-releaseo-previewnougat-mr1-wear-releasen-iot-preview-2
Increasing the clumsiness of the library name will hopefully discourage further use. This change also adds a README file that explains the current thinking regarding native crypto library usage for the Android platform. BUG: 27287913 Change-Id: I48d4aa4b928756403a59d3755a0caf34c6172b26
-rw-r--r--Android.mk20
-rw-r--r--README17
-rw-r--r--dsa_sig.c4
-rw-r--r--include/constrainedcrypto/dsa_sig.h (renamed from include/mincrypt/dsa_sig.h)8
-rw-r--r--include/constrainedcrypto/hash-internal.h (renamed from include/mincrypt/hash-internal.h)6
-rw-r--r--include/constrainedcrypto/p256.h (renamed from include/mincrypt/p256.h)6
-rw-r--r--include/constrainedcrypto/p256_ecdsa.h (renamed from include/mincrypt/p256_ecdsa.h)6
-rw-r--r--include/constrainedcrypto/rsa.h (renamed from include/mincrypt/rsa.h)6
-rw-r--r--include/constrainedcrypto/sha.h (renamed from include/mincrypt/sha.h)6
-rw-r--r--include/constrainedcrypto/sha256.h (renamed from include/mincrypt/sha256.h)6
-rw-r--r--p256.c2
-rw-r--r--p256_ec.c2
-rw-r--r--p256_ecdsa.c4
-rw-r--r--rsa.c6
-rw-r--r--sha.c2
-rw-r--r--sha256.c2
-rw-r--r--test/Android.mk8
-rw-r--r--test/ecdsa_test.c8
-rw-r--r--test/rsa_test.c4
19 files changed, 66 insertions, 57 deletions
diff --git a/Android.mk b/Android.mk
index 2d3e44c..76e53c5 100644
--- a/Android.mk
+++ b/Android.mk
@@ -2,28 +2,20 @@
#
LOCAL_PATH := $(call my-dir)
-# Determine whether to build mincrypt from system/core or from
-# external/libmincrypt. The mincrypt source is temporarily present in both
-# locations during the process of moving mincrypt to external/libmincrypt.
-# TODO(mnissler): Remove this after the transition is complete.
-ifndef MINCRYPT_STANDALONE
-MINCRYPT_STANDALONE := true
-endif
-
-ifeq ($(MINCRYPT_STANDALONE),true)
-
include $(CLEAR_VARS)
-LOCAL_MODULE := libmincrypt
+LOCAL_MODULE := libconstrainedcrypto
LOCAL_SRC_FILES := dsa_sig.c p256.c p256_ec.c p256_ecdsa.c rsa.c sha.c sha256.c
LOCAL_CFLAGS := -Wall -Werror
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
-LOCAL_MODULE := libmincrypt
+LOCAL_MODULE := libconstrainedcrypto
LOCAL_SRC_FILES := dsa_sig.c p256.c p256_ec.c p256_ecdsa.c rsa.c sha.c sha256.c
LOCAL_CFLAGS := -Wall -Werror
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_HOST_STATIC_LIBRARY)
include $(LOCAL_PATH)/test/Android.mk
-
-endif # MINCRYPT_STANDALONE == true
diff --git a/README b/README
new file mode 100644
index 0000000..42eab90
--- /dev/null
+++ b/README
@@ -0,0 +1,17 @@
+libconstrainedcrypto provides a random set of basic crypto algorithms
+originating from Google-internal code.
+
+This is *NOT* a general purpose crypto library. Our goal is to standardize on
+only one native crypto library for the Android platform, and that library is
+BoringSSL. Wherever possible, you should prefer BoringSSL's libcrypto over
+libconstrainedcrypto. In particular, all code running in Android user space
+should use BoringSSL.
+
+There a few rare exceptions where BoringSSL is can't be used yet (such as
+bare-bones bootloaders etc.). There is a plan to reduce BoringSSL' libcrypto's
+dependency footprint to make libcrypto usable in these environments as well
+though.
+
+A number of projects still rely on libconstrainedcrypto (formerly known as
+libmincrypt) due to historic reasons, the goal is to clean these up and switch
+them over to BoringSSL wherever possible.
diff --git a/dsa_sig.c b/dsa_sig.c
index 101314b..c9db6d3 100644
--- a/dsa_sig.c
+++ b/dsa_sig.c
@@ -26,8 +26,8 @@
#include <string.h>
-#include "mincrypt/dsa_sig.h"
-#include "mincrypt/p256.h"
+#include "constrainedcrypto/dsa_sig.h"
+#include "constrainedcrypto/p256.h"
/**
* Trims off the leading zero bytes and copy it to a buffer aligning it to the end.
diff --git a/include/mincrypt/dsa_sig.h b/include/constrainedcrypto/dsa_sig.h
index b0d91cd..3cdf194 100644
--- a/include/mincrypt/dsa_sig.h
+++ b/include/constrainedcrypto/dsa_sig.h
@@ -24,10 +24,10 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SYSTEM_CORE_INCLUDE_MINCRYPT_DSA_SIG_H_
-#define SYSTEM_CORE_INCLUDE_MINCRYPT_DSA_SIG_H_
+#ifndef CONSTRAINEDCRYPTO_DSA_SIG_H_
+#define CONSTRAINEDCRYPTO_DSA_SIG_H_
-#include "mincrypt/p256.h"
+#include "constrainedcrypto/p256.h"
#ifdef __cplusplus
extern "C" {
@@ -40,4 +40,4 @@ int dsa_sig_unpack(unsigned char* sig, int sig_len, p256_int* r_int, p256_int* s
}
#endif
-#endif /* SYSTEM_CORE_INCLUDE_MINCRYPT_DSA_SIG_H_ */
+#endif /* CONSTRAINEDCRYPTO_DSA_SIG_H_ */
diff --git a/include/mincrypt/hash-internal.h b/include/constrainedcrypto/hash-internal.h
index c813b44..f0a00f9 100644
--- a/include/mincrypt/hash-internal.h
+++ b/include/constrainedcrypto/hash-internal.h
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SYSTEM_CORE_INCLUDE_MINCRYPT_HASH_INTERNAL_H_
-#define SYSTEM_CORE_INCLUDE_MINCRYPT_HASH_INTERNAL_H_
+#ifndef CONSTRAINEDCRYPTO_HASH_INTERNAL_H_
+#define CONSTRAINEDCRYPTO_HASH_INTERNAL_H_
#include <stdint.h>
@@ -60,4 +60,4 @@ typedef struct HASH_CTX {
}
#endif // __cplusplus
-#endif // SYSTEM_CORE_INCLUDE_MINCRYPT_HASH_INTERNAL_H_
+#endif // CONSTRAINEDCRYPTO_HASH_INTERNAL_H_
diff --git a/include/mincrypt/p256.h b/include/constrainedcrypto/p256.h
index 465a1b9..0bbd7e5 100644
--- a/include/mincrypt/p256.h
+++ b/include/constrainedcrypto/p256.h
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SYSTEM_CORE_INCLUDE_MINCRYPT_LITE_P256_H_
-#define SYSTEM_CORE_INCLUDE_MINCRYPT_LITE_P256_H_
+#ifndef CONSTRAINEDCRYPTO_LITE_P256_H_
+#define CONSTRAINEDCRYPTO_LITE_P256_H_
// Collection of routines manipulating 256 bit unsigned integers.
// Just enough to implement ecdsa-p256 and related algorithms.
@@ -159,4 +159,4 @@ void p256_from_bin(const uint8_t src[P256_NBYTES], p256_int* dst);
}
#endif
-#endif // SYSTEM_CORE_INCLUDE_MINCRYPT_LITE_P256_H_
+#endif // CONSTRAINEDCRYPTO_LITE_P256_H_
diff --git a/include/mincrypt/p256_ecdsa.h b/include/constrainedcrypto/p256_ecdsa.h
index da339fa..7b0cc96 100644
--- a/include/mincrypt/p256_ecdsa.h
+++ b/include/constrainedcrypto/p256_ecdsa.h
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SYSTEM_CORE_INCLUDE_MINCRYPT_P256_ECDSA_H_
-#define SYSTEM_CORE_INCLUDE_MINCRYPT_P256_ECDSA_H_
+#ifndef CONSTRAINEDCRYPTO_P256_ECDSA_H_
+#define CONSTRAINEDCRYPTO_P256_ECDSA_H_
// Using current directory as relative include path here since
// this code typically gets lifted into a variety of build systems
@@ -50,4 +50,4 @@ int p256_ecdsa_verify(const p256_int* key_x,
}
#endif
-#endif // SYSTEM_CORE_INCLUDE_MINCRYPT_P256_ECDSA_H_
+#endif // CONSTRAINEDCRYPTO_P256_ECDSA_H_
diff --git a/include/mincrypt/rsa.h b/include/constrainedcrypto/rsa.h
index 3d0556b..2090ae3 100644
--- a/include/mincrypt/rsa.h
+++ b/include/constrainedcrypto/rsa.h
@@ -25,8 +25,8 @@
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SYSTEM_CORE_INCLUDE_MINCRYPT_RSA_H_
-#define SYSTEM_CORE_INCLUDE_MINCRYPT_RSA_H_
+#ifndef CONSTRAINEDCRYPTO_RSA_H_
+#define CONSTRAINEDCRYPTO_RSA_H_
#include <inttypes.h>
@@ -55,4 +55,4 @@ int RSA_verify(const RSAPublicKey *key,
}
#endif
-#endif // SYSTEM_CORE_INCLUDE_MINCRYPT_RSA_H_
+#endif // CONSTRAINEDCRYPTO_RSA_H_
diff --git a/include/mincrypt/sha.h b/include/constrainedcrypto/sha.h
index ef60aab..94dcdb4 100644
--- a/include/mincrypt/sha.h
+++ b/include/constrainedcrypto/sha.h
@@ -23,8 +23,8 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SYSTEM_CORE_INCLUDE_MINCRYPT_SHA1_H_
-#define SYSTEM_CORE_INCLUDE_MINCRYPT_SHA1_H_
+#ifndef CONSTRAINEDCRYPTO_SHA1_H_
+#define CONSTRAINEDCRYPTO_SHA1_H_
#include <stdint.h>
#include "hash-internal.h"
@@ -49,4 +49,4 @@ const uint8_t* SHA_hash(const void* data, int len, uint8_t* digest);
}
#endif // __cplusplus
-#endif // SYSTEM_CORE_INCLUDE_MINCRYPT_SHA1_H_
+#endif // CONSTRAINEDCRYPTO_SHA1_H_
diff --git a/include/mincrypt/sha256.h b/include/constrainedcrypto/sha256.h
index 3a87c31..eb2917c 100644
--- a/include/mincrypt/sha256.h
+++ b/include/constrainedcrypto/sha256.h
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SYSTEM_CORE_INCLUDE_MINCRYPT_SHA256_H_
-#define SYSTEM_CORE_INCLUDE_MINCRYPT_SHA256_H_
+#ifndef CONSTRAINEDCRYPTO_SHA256_H_
+#define CONSTRAINEDCRYPTO_SHA256_H_
#include <stdint.h>
#include "hash-internal.h"
@@ -49,4 +49,4 @@ const uint8_t* SHA256_hash(const void* data, int len, uint8_t* digest);
}
#endif // __cplusplus
-#endif // SYSTEM_CORE_INCLUDE_MINCRYPT_SHA256_H_
+#endif // CONSTRAINEDCRYPTO_SHA256_H_
diff --git a/p256.c b/p256.c
index 555a07a..993cd4e 100644
--- a/p256.c
+++ b/p256.c
@@ -37,7 +37,7 @@
#include <string.h>
#include <stdio.h>
-#include "mincrypt/p256.h"
+#include "constrainedcrypto/p256.h"
const p256_int SECP256r1_n = // curve order
{{0xfc632551, 0xf3b9cac2, 0xa7179e84, 0xbce6faad, -1, -1, 0, -1}};
diff --git a/p256_ec.c b/p256_ec.c
index 90262cc..72e80e6 100644
--- a/p256_ec.c
+++ b/p256_ec.c
@@ -38,7 +38,7 @@
#include <string.h>
#include <stdlib.h>
-#include "mincrypt/p256.h"
+#include "constrainedcrypto/p256.h"
typedef uint8_t u8;
typedef uint32_t u32;
diff --git a/p256_ecdsa.c b/p256_ecdsa.c
index f2264b0..47dcd7b 100644
--- a/p256_ecdsa.c
+++ b/p256_ecdsa.c
@@ -26,8 +26,8 @@
#include <string.h>
-#include "mincrypt/p256_ecdsa.h"
-#include "mincrypt/p256.h"
+#include "constrainedcrypto/p256_ecdsa.h"
+#include "constrainedcrypto/p256.h"
int p256_ecdsa_verify(const p256_int* key_x, const p256_int* key_y,
const p256_int* message,
diff --git a/rsa.c b/rsa.c
index 9061b3a..52a29e4 100644
--- a/rsa.c
+++ b/rsa.c
@@ -25,9 +25,9 @@
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "mincrypt/rsa.h"
-#include "mincrypt/sha.h"
-#include "mincrypt/sha256.h"
+#include "constrainedcrypto/rsa.h"
+#include "constrainedcrypto/sha.h"
+#include "constrainedcrypto/sha256.h"
// a[] -= mod
static void subM(const RSAPublicKey* key,
diff --git a/sha.c b/sha.c
index 5bef32e..43440a0 100644
--- a/sha.c
+++ b/sha.c
@@ -27,7 +27,7 @@
// Optimized for minimal code size.
-#include "mincrypt/sha.h"
+#include "constrainedcrypto/sha.h"
#include <stdio.h>
#include <string.h>
diff --git a/sha256.c b/sha256.c
index eb6e308..2b5f073 100644
--- a/sha256.c
+++ b/sha256.c
@@ -27,7 +27,7 @@
// Optimized for minimal code size.
-#include "mincrypt/sha256.h"
+#include "constrainedcrypto/sha256.h"
#include <stdio.h>
#include <string.h>
diff --git a/test/Android.mk b/test/Android.mk
index 73ff7d0..97b107a 100644
--- a/test/Android.mk
+++ b/test/Android.mk
@@ -3,13 +3,13 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_MODULE := rsa_test
+LOCAL_MODULE := constrainedcrypto_rsa_test
LOCAL_SRC_FILES := rsa_test.c
-LOCAL_STATIC_LIBRARIES := libmincrypt
+LOCAL_STATIC_LIBRARIES := libconstrainedcrypto
include $(BUILD_HOST_NATIVE_TEST)
include $(CLEAR_VARS)
-LOCAL_MODULE := ecdsa_test
+LOCAL_MODULE := constrainedcrypto_ecdsa_test
LOCAL_SRC_FILES := ecdsa_test.c
-LOCAL_STATIC_LIBRARIES := libmincrypt
+LOCAL_STATIC_LIBRARIES := libconstrainedcrypto
include $(BUILD_HOST_NATIVE_TEST)
diff --git a/test/ecdsa_test.c b/test/ecdsa_test.c
index 24ec013..4a40c5b 100644
--- a/test/ecdsa_test.c
+++ b/test/ecdsa_test.c
@@ -30,10 +30,10 @@
#include <string.h>
#include <sys/cdefs.h>
-#include "mincrypt/dsa_sig.h"
-#include "mincrypt/p256.h"
-#include "mincrypt/p256_ecdsa.h"
-#include "mincrypt/sha256.h"
+#include "constrainedcrypto/dsa_sig.h"
+#include "constrainedcrypto/p256.h"
+#include "constrainedcrypto/p256_ecdsa.h"
+#include "constrainedcrypto/sha256.h"
#ifndef __unused
#define __unused __attribute__((__unused__))
diff --git a/test/rsa_test.c b/test/rsa_test.c
index 055138f..d579e2f 100644
--- a/test/rsa_test.c
+++ b/test/rsa_test.c
@@ -30,8 +30,8 @@
#include <string.h>
#include <sys/cdefs.h>
-#include "mincrypt/rsa.h"
-#include "mincrypt/sha.h"
+#include "constrainedcrypto/rsa.h"
+#include "constrainedcrypto/sha.h"
#ifndef __unused
#define __unused __attribute__((unused))