]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use newer / consistent function names
authorAlan T. DeKok <aland@freeradius.org>
Sat, 26 Apr 2025 16:37:20 +0000 (12:37 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 26 Apr 2025 16:50:00 +0000 (12:50 -0400)
doc/antora/modules/reference/pages/raddb/mods-available/eap.adoc
doc/antora/modules/reference/pages/raddb/sites-available/eap-aka-sim.adoc
raddb/mods-available/eap
raddb/sites-available/eap-aka-sim
src/lib/eap_aka_sim/xlat.c
src/tests/keywords/radius.conf
src/tests/keywords/timeout-catch
src/tests/modules/eap_sim/sim_xlat_id_aka.unlang
src/tests/modules/eap_sim/sim_xlat_id_aka_decrypt_no_tag.unlang
src/tests/modules/eap_sim/sim_xlat_id_sim.unlang

index 5436c3cacd41799d91a9314940da35a1a80aa660..441e8149051d9b58f4ef77babe9d2f8e4ff28a29 100644 (file)
@@ -1254,7 +1254,7 @@ require configuration for each user.
 
 The rlm_eap module provides the below functions to interact with the `3GPP` and `SIM` protocols.
 
-### %3gpp_temporary_id_decrypt('...)
+### %3gpp_temporary_id.decrypt('...)
 
 TODO
 
@@ -1273,7 +1273,7 @@ TODO
 TODO
 ```
 
-### %3gpp_temporary_id_encrypt(...)
+### %3gpp_temporary_id.encrypt(...)
 
 TODO
 
@@ -1292,7 +1292,7 @@ TODO
 TODO
 ```
 
-### %3gpp_temporary_id_key_index(...)
+### %3gpp_temporary_id.key_index(...)
 
 TODO
 
index 039281843d2915e6574df46212577bf9a6790d4a..e0dc5a9d6ed0f31ac70d2e18c42cf51b2e1f65d6 100644 (file)
@@ -566,7 +566,7 @@ The following facilitates may be useful when generating pseudonym
 values:
 
 - The encrypt expansions of the `rlm_cipher` module.
-- The `%3gpp_temporary_id_encrypt()` expansion.
+- The `%3gpp_temporary_id.encrypt()` expansion.
 - The `%str.rand()` expansion.
 
 NOTE: Add a `reply.Next-Pseudonym-Id` attribute in this section to
index eee7c23a7a8d1036be5c78bc7a710ba5dd68ca80..3df403971e366d59a49611c246b51545a1b64635 100644 (file)
@@ -1371,7 +1371,7 @@ eap {
 #
 #  The rlm_eap module provides the below functions to interact with the `3GPP` and `SIM` protocols.
 #
-#  ### %3gpp_temporary_id_decrypt('...)
+#  ### %3gpp_temporary_id.decrypt('...)
 #
 #  TODO
 #
@@ -1390,7 +1390,7 @@ eap {
 #  TODO
 #  ```
 #
-#  ### %3gpp_temporary_id_encrypt(...)
+#  ### %3gpp_temporary_id.encrypt(...)
 #
 #  TODO
 #
@@ -1409,7 +1409,7 @@ eap {
 #  TODO
 #  ```
 #
-#  ### %3gpp_temporary_id_key_index(...)
+#  ### %3gpp_temporary_id.key_index(...)
 #
 #  TODO
 #
index 95d6ef848d08c6d117b53f72ce972172f96174a3..36a7ab1441aa1e851eeb78368972769dd637fdc9 100644 (file)
@@ -529,7 +529,7 @@ server eap-aka-sim {
        #  values:
        #
        #  - The encrypt expansions of the `rlm_cipher` module.
-       #  - The `%3gpp_temporary_id_encrypt()` expansion.
+       #  - The `%3gpp_temporary_id.encrypt()` expansion.
        #  - The `%str.rand()` expansion.
        #
        #  NOTE: Add a `reply.Next-Pseudonym-Id` attribute in this section to
index 82eb8741138cc39ff27764bb6b2e1e9d3c331b2a..e209371d7379e1da5c0ad5ce2819f08d6edd2b9d 100644 (file)
@@ -154,7 +154,7 @@ static xlat_arg_parser_t const aka_sim_id_3gpp_temporary_id_key_index_xlat_args[
 /** Returns the key index from a 3gpp temporary id
  *
 @verbatim
-%3gpp_temporary_id_key_index(%{id_attr})
+%3gpp_temporary_id.key_index(%{id_attr})
 @endverbatim
  *
  * @ingroup xlat_functions
@@ -192,7 +192,7 @@ static xlat_arg_parser_t aka_sim_3gpp_temporary_id_decrypt_xlat_args[] = {
 /** Decrypt a 3gpp temporary id
  *
  @verbatim
- %3gpp_temporary_id_decrypt(<id> <key>)
+ %3gpp_temporary_id.decrypt(<id> <key>)
  @endverbatim
  *
  * The pseudonym is in the format
@@ -335,7 +335,7 @@ static xlat_arg_parser_t aka_sim_3gpp_temporary_id_encrypt_xlat_args[] = {
 /** Encrypts a 3gpp pseudonym
  *
 @verbatim
-%3gpp_temporary_id_encrypt(<id>, <key>, <index>, [(pseudonym|fastauth)])
+%3gpp_temporary_id.encrypt(<id>, <key>, <index>, [(pseudonym|fastauth)])
 @endverbatim
  *
  * @ingroup xlat_functions
@@ -509,10 +509,20 @@ int fr_aka_sim_xlat_func_register(void)
        xlat_func_args_set(xlat, aka_sim_xlat_id_type_xlat_args);
        if (unlikely((xlat = xlat_func_register(NULL, "3gpp_temporary_id_key_index", aka_sim_id_3gpp_temporary_id_key_index_xlat, FR_TYPE_UINT8)) == NULL)) return -1;
        xlat_func_args_set(xlat, aka_sim_id_3gpp_temporary_id_key_index_xlat_args);
+       if (unlikely((xlat = xlat_func_register(NULL, "3gpp_temporary_id.key_index", aka_sim_id_3gpp_temporary_id_key_index_xlat, FR_TYPE_UINT8)) == NULL)) return -1;
+       xlat_func_args_set(xlat, aka_sim_id_3gpp_temporary_id_key_index_xlat_args);
+
        if (unlikely((xlat = xlat_func_register(NULL, "3gpp_temporary_id_decrypt", aka_sim_3gpp_temporary_id_decrypt_xlat, FR_TYPE_STRING)) == NULL)) return -1;
        xlat_func_args_set(xlat, aka_sim_3gpp_temporary_id_decrypt_xlat_args);
+
+       if (unlikely((xlat = xlat_func_register(NULL, "3gpp_temporary_id.decrypt", aka_sim_3gpp_temporary_id_decrypt_xlat, FR_TYPE_STRING)) == NULL)) return -1;
+       xlat_func_args_set(xlat, aka_sim_3gpp_temporary_id_decrypt_xlat_args);
+
        if (unlikely((xlat = xlat_func_register(NULL, "3gpp_temporary_id_encrypt", aka_sim_3gpp_temporary_id_encrypt_xlat, FR_TYPE_STRING)) == NULL)) return -1;
        xlat_func_args_set(xlat, aka_sim_3gpp_temporary_id_encrypt_xlat_args);
+       if (unlikely((xlat = xlat_func_register(NULL, "3gpp_temporary_id.encrypt", aka_sim_3gpp_temporary_id_encrypt_xlat, FR_TYPE_STRING)) == NULL)) return -1;
+       xlat_func_args_set(xlat, aka_sim_3gpp_temporary_id_encrypt_xlat_args);
+
        aka_sim_xlat_refs = 1;
 
        return 0;
index 02902ff2e40665575d5aa9dcd23b8ef497848c2b..789c1a382bd25c163dccc1aaeb350942a52bb31e 100644 (file)
@@ -10,7 +10,7 @@ modules {
        }
 
        delay delay_10s {
-               delay = 10
+               delay = "%{10 + Tmp-String-0}"
        }
 
        #
index d08523295cce9d3452b6c46cee726655833db638..8f40d24e9bc8120a73f362e89997ba16f9baa832 100644 (file)
@@ -1,6 +1,8 @@
 #
 # PRE: timeout
 #
+Tmp-String-0 := "xxx"
+
 
 #
 #  @todo - we have to add a leading '0' here, otherwise cf_file.c complains
index 08dbe06a4fec9f124ca5dc859c1b3dccb8a2b340..aa8ab67b63a8c91274d316a89b4505c47aa17c4e 100644 (file)
@@ -13,7 +13,7 @@ if (%aka_sim_id_type(%{User-Name}) != 'permanent') {
 #  Encrypt the permanent ID
 #
 test_string := '1420032219455258'
-control.User-Name := %3gpp_temporary_id_encrypt(%{User-Name},%{test_string},6)
+control.User-Name := %3gpp_temporary_id.encrypt(%{User-Name},%{test_string},6)
 
 #
 #  0.2 - Can we get the EAP method from the encrypted blob correctly?
@@ -32,14 +32,14 @@ if (%aka_sim_id_type(%{control.User-Name}) != 'pseudonym') {
 #
 #  0.4 - We should refuse to re-encrypt an encrypted NAI
 #
-if (%3gpp_temporary_id_encrypt(%{control.User-Name}, %{test_string}, 6) != '') {
+if (%3gpp_temporary_id.encrypt(%{control.User-Name}, %{test_string}, 6) != '') {
        test_fail
 }
 
 #
 #  0.5 - Get the original IMSI back again
 #
-result_string := %3gpp_temporary_id_decrypt(%{control.User-Name},%{test_string})
+result_string := %3gpp_temporary_id.decrypt(%{control.User-Name},%{test_string})
 
 if (result_string != User-Name) {
        test_fail
@@ -60,7 +60,7 @@ if (User-Name =~ /^[0-9](.*)/) {
 #
 test_string := '1420032219455259'
 control += {
-       User-Name = %3gpp_temporary_id_encrypt(%{User-Name[1]}, %{test_string}, 6)
+       User-Name = %3gpp_temporary_id.encrypt(%{User-Name[1]}, %{test_string}, 6)
 }
 
 #
@@ -73,14 +73,14 @@ if (%aka_sim_id_type(%{control.User-Name[1]}) != 'pseudonym') {
 #
 #  1.3 - We should refuse to re-encrypt an encrypted NAI
 #
-if (%3gpp_temporary_id_encrypt(%{control.User-Name[1]},%{test_string},6) != '') {
+if (%3gpp_temporary_id.encrypt(%{control.User-Name[1]},%{test_string},6) != '') {
        test_fail
 }
 
 #
 #  1.4 - Get the original IMSI back again
 #
-result_string := %3gpp_temporary_id_decrypt(%{control.User-Name[1]},%{test_string})
+result_string := %3gpp_temporary_id.decrypt(%{control.User-Name[1]},%{test_string})
 
 if (result_string != "0%{User-Name[1]}") {
        test_fail
@@ -91,7 +91,7 @@ if (result_string != "0%{User-Name[1]}") {
 #
 test_string := '1420032219455259'
 control += {
-       User-Name = %3gpp_temporary_id_encrypt(%{User-Name[1]},%{test_string},6,'fastauth')
+       User-Name = %3gpp_temporary_id.encrypt(%{User-Name[1]},%{test_string},6,'fastauth')
 }
 
 #
@@ -104,14 +104,14 @@ if (%aka_sim_id_type(%{control.User-Name[2]}) != 'fastauth') {
 #
 #  2.3 - We should refuse to re-encrypt an encrypted NAI
 #
-if (%3gpp_temporary_id_encrypt(%{control.User-Name[2]}, %{test_string}, 6, 'fastauth') != '') {
+if (%3gpp_temporary_id.encrypt(%{control.User-Name[2]}, %{test_string}, 6, 'fastauth') != '') {
        test_fail
 }
 
 #
 #  2.4 - Get the original IMSI back again
 #
-result_string := %3gpp_temporary_id_decrypt(%{control.User-Name[2]}, %{test_string})
+result_string := %3gpp_temporary_id.decrypt(%{control.User-Name[2]}, %{test_string})
 
 if (result_string != "0%{User-Name[1]}") {
        test_fail
index c5d588b7563a38aa8e21b0dcb7abd0ba561448c0..bbaeb36f5bb70bf9aa26ea6f5e77b3d496e9ee0d 100644 (file)
@@ -13,12 +13,12 @@ if (%aka_sim_id_type(%{User-Name}) != 'permanent') {
 #  1.1 - Encrypt the permanent ID
 #
 test_string := '1420032219455259'
-control.User-Name := %3gpp_temporary_id_encrypt(%{User-Name},%{test_string},6)
+control.User-Name := %3gpp_temporary_id.encrypt(%{User-Name},%{test_string},6)
 
 #
 #  1.2 - Get the original IMSI back again sans tag
 #
-result_string := %3gpp_temporary_id_decrypt(%{control.User-Name}, %{test_string}, 'false')
+result_string := %3gpp_temporary_id.decrypt(%{control.User-Name}, %{test_string}, 'false')
 
 if ("%{User-Name}" =~ /^0(.*)/) {
        if (!result_string || (result_string == '') || (%{result_string} != "%{1}")) {
index 3276247c62ac0c6ebe63771c5bd4624f2c2f1617..255217c69d4d361d57221d2c1164981e37701238 100644 (file)
@@ -12,7 +12,7 @@ if (%aka_sim_id_type(%{User-Name}) != 'permanent') {
 #  Encrypt the permanent ID
 #
 test_string := '1234567812345678'
-control.User-Name := %3gpp_temporary_id_encrypt(%{User-Name},%{test_string},6)
+control.User-Name := %3gpp_temporary_id.encrypt(%{User-Name},%{test_string},6)
 
 #
 #  Can we get the EAP method from the encrypted blob correctly?
@@ -31,7 +31,7 @@ if (%aka_sim_id_type(%{control.User-Name}) != 'pseudonym') {
 #
 #  We should refuse to re-encrypt an encrypted NAI
 #
-if %3gpp_temporary_id_encrypt(%{control.User-Name},%{test_string},6) {
+if %3gpp_temporary_id.encrypt(%{control.User-Name},%{test_string},6) {
        test_fail
 }