sd-id128: export sd_id128_get_app_specific()
We exported sd_id128_get_machine_app_specific() and sd_id128_get_boot_app_specific(). But those operate on the current machine, and sometimes the user might want to do the same calculation for a different machine, or an earlier boot, etc. We expose the underlying implementation to make this easy.
This commit is contained in:
@@ -828,3 +828,8 @@ global:
|
||||
sd_journal_step_one;
|
||||
sd_session_get_leader;
|
||||
} LIBSYSTEMD_253;
|
||||
|
||||
LIBSYSTEMD_255 {
|
||||
global:
|
||||
sd_id128_get_app_specific;
|
||||
} LIBSYSTEMD_254;
|
||||
|
||||
@@ -338,14 +338,14 @@ _public_ int sd_id128_randomize(sd_id128_t *ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_app_specific(sd_id128_t base, sd_id128_t app_id, sd_id128_t *ret) {
|
||||
_public_ int sd_id128_get_app_specific(sd_id128_t base, sd_id128_t app_id, sd_id128_t *ret) {
|
||||
assert_cc(sizeof(sd_id128_t) < SHA256_DIGEST_SIZE); /* Check that we don't need to pad with zeros. */
|
||||
union {
|
||||
uint8_t hmac[SHA256_DIGEST_SIZE];
|
||||
sd_id128_t result;
|
||||
} buf;
|
||||
|
||||
assert(ret);
|
||||
assert_return(ret, -EINVAL);
|
||||
|
||||
hmac_sha256(&base, sizeof(base), &app_id, sizeof(app_id), buf.hmac);
|
||||
|
||||
@@ -364,7 +364,7 @@ _public_ int sd_id128_get_machine_app_specific(sd_id128_t app_id, sd_id128_t *re
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return get_app_specific(id, app_id, ret);
|
||||
return sd_id128_get_app_specific(id, app_id, ret);
|
||||
}
|
||||
|
||||
_public_ int sd_id128_get_boot_app_specific(sd_id128_t app_id, sd_id128_t *ret) {
|
||||
@@ -377,5 +377,5 @@ _public_ int sd_id128_get_boot_app_specific(sd_id128_t app_id, sd_id128_t *ret)
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return get_app_specific(id, app_id, ret);
|
||||
return sd_id128_get_app_specific(id, app_id, ret);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user