return cipher;
}
-static void *evp_cipher_from_dispatch(const char *name,
+static void *evp_cipher_from_dispatch(const int name_id,
const OSSL_DISPATCH *fns,
OSSL_PROVIDER *prov,
void *unused)
EVP_CIPHER *cipher = NULL;
int fnciphcnt = 0, fnctxcnt = 0;
- if ((cipher = evp_cipher_new()) == NULL
- || (cipher->name = OPENSSL_strdup(name)) == NULL) {
- EVP_CIPHER_free(cipher);
+ if ((cipher = evp_cipher_new()) == NULL) {
EVPerr(0, ERR_R_MALLOC_FAILURE);
return NULL;
}
+ cipher->name_id = name_id;
#ifndef FIPS_MODE
- /*
- * FIPS module note: since internal fetches will be entirely
- * provider based, we know that none of its code depends on legacy
- * NIDs or any functionality that use them.
- *
- * TODO(3.x) get rid of the need for legacy NIDs
- */
- cipher->nid = OBJ_sn2nid(name);
+ {
+ /*
+ * FIPS module note: since internal fetches will be entirely
+ * provider based, we know that none of its code depends on legacy
+ * NIDs or any functionality that use them.
+ *
+ * TODO(3.x) get rid of the need for legacy NIDs
+ */
+ cipher->nid = OBJ_sn2nid(evp_first_name(prov, name_id));
+ }
#endif
for (; fns->function_id != 0; fns++) {
if (i > 0)
return;
ossl_provider_free(cipher->prov);
- OPENSSL_free(cipher->name);
CRYPTO_THREAD_lock_free(cipher->lock);
OPENSSL_free(cipher);
}