int enc_init(const char *pass, const char *method) { int m = TABLE; if (method != NULL) { for (m = TABLE; m < CIPHER_NUM; m++) { if (strcmp(method, supported_ciphers[m]) == 0) { break; } } if (m >= CIPHER_NUM) { LOGE("Invalid cipher name: %s, use table instead", method); m = TABLE; } } if (m == TABLE) { enc_table_init(pass); } else { enc_key_init(m, pass); } return m; }
int enc_init(const char *pass, const char *method) { int m = TABLE; if (method != NULL) { for (m = TABLE; m < CIPHER_NUM; m++) { if (strcmp(method, supported_ciphers[m]) == 0) { break; } } if (m >= CIPHER_NUM) { LOGE("Invalid cipher name: %s, use table instead", method); m = TABLE; } } if (m == TABLE) { enc_table_init(pass); } else { enc_key_init(m, pass); } crypto_generichash(auth_key, ONETIMEAUTH_KEYBYTES, (uint8_t *)pass, strlen(pass), NULL, 0); return m; }