crypto/signature: introduce domain seperation
It might seem a bit like unnecessary bikeshedding but it shouldn't hurt anyone.cute-signatures
parent
dea8ded23e
commit
5b020ec9ef
|
@ -314,6 +314,7 @@ void apk_public_key_free(struct apk_public_key *pub)
|
||||||
|
|
||||||
int apk_verify_digest_start(struct apk_digest_ctx *dctx, uint16_t signature_type)
|
int apk_verify_digest_start(struct apk_digest_ctx *dctx, uint16_t signature_type)
|
||||||
{
|
{
|
||||||
|
const uint8_t domain_seperator[5] = {'q', 't', 's', 'e', 'p'};
|
||||||
uint8_t digest;
|
uint8_t digest;
|
||||||
|
|
||||||
switch (signature_type) {
|
switch (signature_type) {
|
||||||
|
@ -335,6 +336,12 @@ int apk_verify_digest_start(struct apk_digest_ctx *dctx, uint16_t signature_type
|
||||||
return -APKE_CRYPTO_ERROR;
|
return -APKE_CRYPTO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (signature_type == APK_SIGNATURE_CUTE) {
|
||||||
|
if (apk_digest_ctx_update(dctx, domain_seperator, 5) != 0) {
|
||||||
|
return -APKE_CRYPTO_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -311,6 +311,7 @@ void apk_secret_key_free(struct apk_secret_key *sec)
|
||||||
|
|
||||||
int apk_sign_digest_start(struct apk_digest_ctx *dctx, uint16_t signature_type)
|
int apk_sign_digest_start(struct apk_digest_ctx *dctx, uint16_t signature_type)
|
||||||
{
|
{
|
||||||
|
const uint8_t domain_seperator[5] = {'q', 't', 's', 'e', 'p'};
|
||||||
uint8_t digest;
|
uint8_t digest;
|
||||||
|
|
||||||
switch (signature_type) {
|
switch (signature_type) {
|
||||||
|
@ -332,6 +333,12 @@ int apk_sign_digest_start(struct apk_digest_ctx *dctx, uint16_t signature_type)
|
||||||
return -APKE_CRYPTO_ERROR;
|
return -APKE_CRYPTO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (signature_type == APK_SIGNATURE_CUTE) {
|
||||||
|
if (apk_digest_ctx_update(dctx, domain_seperator, 5) != 0) {
|
||||||
|
return -APKE_CRYPTO_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue