Turn on extra compiler checks
Turn on the compiler flags -Wall -Wextra -Werror to make sure no
compiler warnings are added to the project.
Eliminate all unused arguments. Remove unused variables in code.
Change-Id: I0940ba897ac716b4a256f94fcd671f1ff5abc62c
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index 8d30965..3f13c11 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -935,7 +935,7 @@
static const ResponseCode NO_ERROR_RESPONSE_CODE_SENT = (ResponseCode) 0;
-static ResponseCode test(KeyStore* keyStore, int sock, uid_t uid, Value*, Value*, Value*) {
+static ResponseCode test(KeyStore* keyStore, int, uid_t, Value*, Value*, Value*) {
return (ResponseCode) keyStore->getState();
}
@@ -952,7 +952,7 @@
return NO_ERROR_RESPONSE_CODE_SENT;
}
-static ResponseCode insert(KeyStore* keyStore, int sock, uid_t uid, Value* keyName, Value* val,
+static ResponseCode insert(KeyStore* keyStore, int, uid_t uid, Value* keyName, Value* val,
Value*) {
char filename[NAME_MAX];
encode_key_for_uid(filename, uid, keyName);
@@ -960,7 +960,7 @@
return keyStore->put(filename, &keyBlob);
}
-static ResponseCode del(KeyStore* keyStore, int sock, uid_t uid, Value* keyName, Value*, Value*) {
+static ResponseCode del(KeyStore* keyStore, int, uid_t uid, Value* keyName, Value*, Value*) {
char filename[NAME_MAX];
encode_key_for_uid(filename, uid, keyName);
Blob keyBlob;
@@ -971,7 +971,7 @@
return (unlink(filename) && errno != ENOENT) ? SYSTEM_ERROR : NO_ERROR;
}
-static ResponseCode exist(KeyStore* keyStore, int sock, uid_t uid, Value* keyName, Value*, Value*) {
+static ResponseCode exist(KeyStore*, int, uid_t uid, Value* keyName, Value*, Value*) {
char filename[NAME_MAX];
encode_key_for_uid(filename, uid, keyName);
if (access(filename, R_OK) == -1) {
@@ -980,7 +980,7 @@
return NO_ERROR;
}
-static ResponseCode saw(KeyStore* keyStore, int sock, uid_t uid, Value* keyPrefix, Value*, Value*) {
+static ResponseCode saw(KeyStore*, int sock, uid_t uid, Value* keyPrefix, Value*, Value*) {
DIR* dir = opendir(".");
if (!dir) {
return SYSTEM_ERROR;
@@ -1001,7 +1001,7 @@
return NO_ERROR_RESPONSE_CODE_SENT;
}
-static ResponseCode reset(KeyStore* keyStore, int sock, uid_t uid, Value*, Value*, Value*) {
+static ResponseCode reset(KeyStore* keyStore, int, uid_t, Value*, Value*, Value*) {
ResponseCode rc = keyStore->reset() ? NO_ERROR : SYSTEM_ERROR;
const keymaster_device_t* device = keyStore->getDevice();
@@ -1029,7 +1029,7 @@
* any thing goes wrong during the transition, the new file will not overwrite
* the old one. This avoids permanent damages of the existing data. */
-static ResponseCode password(KeyStore* keyStore, int sock, uid_t uid, Value* pw, Value*, Value*) {
+static ResponseCode password(KeyStore* keyStore, int, uid_t, Value* pw, Value*, Value*) {
switch (keyStore->getState()) {
case STATE_UNINITIALIZED: {
// generate master key, encrypt with password, write to file, initialize mMasterKey*.
@@ -1047,7 +1047,7 @@
return SYSTEM_ERROR;
}
-static ResponseCode lock(KeyStore* keyStore, int sock, uid_t uid, Value*, Value*, Value*) {
+static ResponseCode lock(KeyStore* keyStore, int, uid_t, Value*, Value*, Value*) {
keyStore->lock();
return NO_ERROR;
}
@@ -1057,11 +1057,11 @@
return password(keyStore, sock, uid, pw, unused, unused2);
}
-static ResponseCode zero(KeyStore* keyStore, int sock, uid_t uid, Value*, Value*, Value*) {
+static ResponseCode zero(KeyStore* keyStore, int, uid_t, Value*, Value*, Value*) {
return keyStore->isEmpty() ? KEY_NOT_FOUND : NO_ERROR;
}
-static ResponseCode generate(KeyStore* keyStore, int sock, uid_t uid, Value* keyName, Value*,
+static ResponseCode generate(KeyStore* keyStore, int, uid_t uid, Value* keyName, Value*,
Value*) {
char filename[NAME_MAX];
uint8_t* data;
@@ -1094,7 +1094,7 @@
return keyStore->put(filename, &keyBlob);
}
-static ResponseCode import(KeyStore* keyStore, int sock, uid_t uid, Value* keyName, Value* key,
+static ResponseCode import(KeyStore* keyStore, int, uid_t uid, Value* keyName, Value* key,
Value*) {
char filename[NAME_MAX];
@@ -1149,7 +1149,7 @@
return NO_ERROR_RESPONSE_CODE_SENT;
}
-static ResponseCode del_key(KeyStore* keyStore, int sock, uid_t uid, Value* keyName, Value*,
+static ResponseCode del_key(KeyStore* keyStore, int, uid_t uid, Value* keyName, Value*,
Value*) {
char filename[NAME_MAX];
encode_key_for_uid(filename, uid, keyName);
@@ -1169,9 +1169,6 @@
return SYSTEM_ERROR;
}
- uint8_t* data = NULL;
- size_t dataLength;
-
int rc = device->delete_keypair(device, keyBlob.getValue(), keyBlob.getLength());
return rc ? SYSTEM_ERROR : NO_ERROR;
@@ -1218,7 +1215,7 @@
return NO_ERROR_RESPONSE_CODE_SENT;
}
-static ResponseCode verify(KeyStore* keyStore, int sock, uid_t uid, Value* keyName, Value* data,
+static ResponseCode verify(KeyStore* keyStore, int, uid_t uid, Value* keyName, Value* data,
Value* signature) {
Blob keyBlob;
int rc;
@@ -1250,7 +1247,7 @@
}
}
-static ResponseCode grant(KeyStore* keyStore, int sock, uid_t uid, Value* keyName,
+static ResponseCode grant(KeyStore* keyStore, int, uid_t uid, Value* keyName,
Value* granteeData, Value*) {
char filename[NAME_MAX];
encode_key_for_uid(filename, uid, keyName);
@@ -1262,7 +1259,7 @@
return NO_ERROR;
}
-static ResponseCode ungrant(KeyStore* keyStore, int sock, uid_t uid, Value* keyName,
+static ResponseCode ungrant(KeyStore* keyStore, int, uid_t uid, Value* keyName,
Value* granteeData, Value*) {
char filename[NAME_MAX];
encode_key_for_uid(filename, uid, keyName);
@@ -1375,8 +1372,6 @@
}
int main(int argc, char* argv[]) {
- void* hardwareContext = NULL;
-
int controlSocket = android_get_control_socket("keystore");
if (argc < 2) {
ALOGE("A directory must be specified!");