cipher_t * aead_init(const char *pass, const char *key, const char *method) { int m = AES128GCM; if (method != NULL) { /* check method validity */ for (m = AES128GCM; m < AEAD_CIPHER_NUM; m++) if (strcmp(method, supported_aead_ciphers[m]) == 0) { break; } if (m >= AEAD_CIPHER_NUM) { LOGE("Invalid cipher name: %s, use chacha20-ietf-poly1305 instead", method); m = CHACHA20POLY1305IETF; } } return aead_key_init(m, pass, key); }
cipher_t * aead_init(const char *pass, const char *key, const char *method) { int m = AES128GCM; if (method != NULL) { /* check method validity */ for (m = AES128GCM; m < AEAD_CIPHER_NUM; m++) if (strcmp(method, supported_aead_ciphers[m]) == 0) { break; } if (m >= AEAD_CIPHER_NUM) { LOGE("Invalid cipher name: %s, use aes-256-gcm instead", method); m = AES256GCM; } } return aead_key_init(m, pass, key); }