Implement SUCI Profile Scheme A for 5G UE
Extend UICC configuration parsing to provide: routing_indicator, protection_scheme, home_network_public_key, and home_network_public_key_id. Use the protection_scheme value to decide what SUCI Profile Scheme to apply during SUCI generation. Add support for Profile Scheme A which provides ECIES-based encryption using Curve25519 and X9.63 KDF as outlined in TS 33.501 Section C.3.4.1 Profile A. When a configuration file specifies an unsupported Profile Scheme, the NAS layer triggers a fatal error. This occurs either because Profile Scheme B is unimplemented or the build uses OpenSSL < 3.0, which lacks Curve25519 and X9.63 KDF support, ensuring users are informed of the incompatibility.
This commit is contained in:
@@ -94,6 +94,51 @@ char *itoa(int i) {
|
||||
return strdup(buffer);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
** Name: digit_string_to_bcd_value() **
|
||||
** **
|
||||
** Description: Converts a decimal ASCII coded string into its BCD encoded**
|
||||
** value. **
|
||||
** **
|
||||
** Inputs: bcd_value: Output buffer **
|
||||
** digit_string: Input digit string **
|
||||
** size: Size of bcd_value in bytes **
|
||||
** **
|
||||
** Outputs: bcd_value: Converted BCD value **
|
||||
** Return: 0 on success, -1 on error **
|
||||
** **
|
||||
***************************************************************************/
|
||||
int digit_string_to_bcd_value(uint8_t *bcd_value, const char *digit_string, int size)
|
||||
{
|
||||
int i;
|
||||
uint8_t len = strlen(digit_string);
|
||||
|
||||
/* Accept even (size*2) or odd (size*2 - 1) digit counts */
|
||||
if (len < size * 2 - 1 || len > size * 2) {
|
||||
fprintf(stderr, "the string '%s' should be of length %d or %d\n", digit_string, size * 2 - 1, size * 2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
uint8_t low = digit_string[2 * i] - '0';
|
||||
uint8_t high = (2 * i + 1 < len) ? digit_string[2 * i + 1] - '0' : 0xF;
|
||||
|
||||
if (low > 9 || (high > 9 && high != 0xF))
|
||||
goto error;
|
||||
|
||||
bcd_value[i] = (high << 4) | low;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
fprintf(stderr, "the string '%s' is not a valid digit string\n", digit_string);
|
||||
for (i = 0; i < size; i++)
|
||||
bcd_value[i] = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert a version string x.y.z into numbers.
|
||||
*
|
||||
|
||||
@@ -123,6 +123,8 @@ static inline void *malloc_or_fail(size_t size)
|
||||
int hex_char_to_hex_value (char c);
|
||||
// Converts an hexadecimal ASCII coded string into its value.**
|
||||
int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int size);
|
||||
// Converts a decimal ASCII coded string into its BCD encoded value.
|
||||
int digit_string_to_bcd_value(uint8_t *bcd_value, const char *digit_string, int size);
|
||||
|
||||
/* Map task id to printable name. */
|
||||
typedef struct {
|
||||
|
||||
Reference in New Issue
Block a user