cryptenroll: allow to use a public key on a token
This patch allows systemd-cryptenroll to enroll directly with a public key if a certificate is missing on a token. Fixes: #30675
This commit is contained in:
committed by
Yu Watanabe
parent
e104d77da2
commit
85686b37b0
@@ -39,3 +39,19 @@ bool memeqbyte(uint8_t byte, const void *data, size_t length) {
|
||||
/* Now we know first 16 bytes match, memcmp() with self. */
|
||||
return memcmp(data, p + 16, length) == 0;
|
||||
}
|
||||
|
||||
void *memdup_reverse(const void *mem, size_t size) {
|
||||
assert(mem);
|
||||
assert(size != 0);
|
||||
|
||||
void *p = malloc(size);
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
uint8_t *p_dst = p;
|
||||
const uint8_t *p_src = mem;
|
||||
for (size_t i = 0, k = size; i < size; i++, k--)
|
||||
p_dst[i] = p_src[k-1];
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -107,3 +107,6 @@ static inline void erase_and_freep(void *p) {
|
||||
static inline void erase_char(char *p) {
|
||||
explicit_bzero_safe(p, sizeof(char));
|
||||
}
|
||||
|
||||
/* Makes a copy of the buffer with reversed order of bytes */
|
||||
void *memdup_reverse(const void *mem, size_t size);
|
||||
|
||||
Reference in New Issue
Block a user