]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
gcm: use TRIE based param name decoder
authorPauli <ppzgs1@gmail.com>
Wed, 16 Apr 2025 07:32:35 +0000 (17:32 +1000)
committerTomas Mraz <tomas@openssl.org>
Wed, 7 May 2025 09:47:24 +0000 (11:47 +0200)
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27392)

providers/implementations/ciphers/ciphercommon_gcm.c

index bd343d5b74f94124a80782131348677af0480484..84a8e7d628296aaf47bce973adfa60c6ac811b64 100644 (file)
@@ -146,11 +146,9 @@ int ossl_gcm_get_ctx_params(void *vctx, OSSL_PARAM params[])
     PROV_GCM_CTX *ctx = (PROV_GCM_CTX *)vctx;
     OSSL_PARAM *p;
     size_t sz;
-    int type;
 
-    for (p = params; p->key != NULL; p++) {
-        type = ossl_param_find_pidx(p->key);
-        switch (type) {
+    for (p = params; p->key != NULL; p++)
+        switch (ossl_cipher_aead_get_ctx_params_find_pidx(p->key)) {
         default:
             break;
 
@@ -238,7 +236,6 @@ int ossl_gcm_get_ctx_params(void *vctx, OSSL_PARAM params[])
             if (!OSSL_PARAM_set_uint(p, ctx->iv_gen_rand))
                 return 0;
         }
-    }
     return 1;
 }
 
@@ -248,14 +245,12 @@ int ossl_gcm_set_ctx_params(void *vctx, const OSSL_PARAM params[])
     const OSSL_PARAM *p;
     size_t sz;
     void *vp;
-    int type;
 
     if (ossl_param_is_empty(params))
         return 1;
 
-    for (p = params; p->key != NULL; p++) {
-        type = ossl_param_find_pidx(p->key);
-        switch (type) {
+    for (p = params; p->key != NULL; p++)
+        switch (ossl_cipher_aead_set_ctx_params_find_pidx(p->key)) {
         default:
             break;
 
@@ -320,8 +315,6 @@ int ossl_gcm_set_ctx_params(void *vctx, const OSSL_PARAM params[])
                 return 0;
             break;
         }
-    }
-
     return 1;
 }