ここで説明されているように、fips準拠でlibcrypto.so.1.0.0を構築しました
libcrypto.so.1.0.0 を含めようとしました (android libs フォルダーにファイル libcrypto.so のシンボリック リンクを作成することにより)、FIPS_mode_set(1) を呼び出そうとしました。
以下は、私が従った詳細な手順です。
sqlcipher コードのクラス net_sqlcipher_database_SQLiteDatabase.cpp (jni フォルダー内) に、次のヘッダー ファイルを含めました。
#include <openssl/crypto.h> #include <openssl/fips.h> #include <openssl/ssl.h>
次に、上記のクラスに次のメソッドを追加しました
/*fips mode enable native native void fips_set_mode(int i) */ static void fips_set_mode(JNIEnv* env,jobject object,jint i){ FIPS_mode_set(1); // it should call FIPS_mode_set(1) from fips.c class }
そして、次の表に上記のメソッド宣言を追加しました
//methods static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"dbopen", "(Ljava/lang/String;I)V", (void *)dbopen}, {"fips_set_mode","(I)V",(void *)fips_set_mode}, {"dbclose", "()V", (void *)dbclose}, {"enableSqlTracing", "(Ljava/lang/String;)V", (void *)enableSqlTracing}, {"enableSqlProfiling", "(Ljava/lang/String;)V", (void *)enableSqlProfiling}, {"native_execSQL", "(Ljava/lang/String;)V", (void *)native_execSQL}, {"lastInsertRow", "()J", (void *)lastInsertRow}, {"lastChangeCount", "()I", (void *)lastChangeCount}, {"native_setLocale", "(Ljava/lang/String;I)V", (void *)native_setLocale}, {"native_getDbLookaside", "()I", (void *)native_getDbLookaside}, {"releaseMemory", "()I", (void *)native_releaseMemory}, {"setICURoot", "(Ljava/lang/String;)V", (void *)setICURoot}, {"native_rawExecSQL", "(Ljava/lang/String;)V", (void *)native_rawExecSQL}, {"native_status", "(IZ)I", (void *)native_status}, };
次に、SQLiteDatabase.java (src フォルダー内) に、次のネイティブ メソッド宣言を追加しました。
//setting static public native void fips_set_mode(int i);
最後に、SQLiteDatabase.java の loadLibs メソッドで上記のメソッドを呼び出しました。
//loadlibs public static void loadLibs (Context context, File workingDir) { System.loadLibrary("stlport_shared"); System.loadLibrary("sqlcipher_android"); System.loadLibrary("database_sqlcipher"); fips_set_mode(1); }
次に、sqlcipher コードをコンパイルするために作成しました。しかし、次のエラーが発生します。
jni/net_sqlcipher_database_SQLiteDatabase.cpp:252: undefined reference to `FIPS_mode_set'.
この点に関して何か提案をいただければ幸いです