Browse Source

Store OID in bigendian notation in pk and sk

master
Joost Rijneveld 6 years ago
parent
commit
05dac989c4
No known key found for this signature in database GPG Key ID: A4FE39CF49CBC553
1 changed files with 8 additions and 8 deletions
  1. +8
    -8
      xmss.c

+ 8
- 8
xmss.c View File

@@ -16,11 +16,11 @@ int xmss_keypair(unsigned char *pk, unsigned char *sk, const uint32_t oid)
return -1;
}
for (i = 0; i < XMSS_OID_LEN; i++) {
pk[i] = (oid >> (8 * i)) & 0xFF;
pk[XMSS_OID_LEN - i - 1] = (oid >> (8 * i)) & 0xFF;
/* For an implementation that uses runtime parameters, it is crucial
that the OID is part of the secret key as well;
i.e. not just for interoperability, but also for internal use. */
sk[i] = (oid >> (8 * i)) & 0xFF;
sk[XMSS_OID_LEN - i - 1] = (oid >> (8 * i)) & 0xFF;
}
return xmss_core_keypair(&params, pk + XMSS_OID_LEN, sk + XMSS_OID_LEN);
}
@@ -34,7 +34,7 @@ int xmss_sign(unsigned char *sk,
unsigned int i;

for (i = 0; i < XMSS_OID_LEN; i++) {
oid |= sk[i] << (i * 8);
oid |= sk[XMSS_OID_LEN - i - 1] << (i * 8);
}
if (xmss_parse_oid(&params, oid)) {
return -1;
@@ -51,7 +51,7 @@ int xmss_sign_open(unsigned char *m, unsigned long long *mlen,
unsigned int i;

for (i = 0; i < XMSS_OID_LEN; i++) {
oid |= pk[i] << (i * 8);
oid |= pk[XMSS_OID_LEN - i - 1] << (i * 8);
}
if (xmss_parse_oid(&params, oid)) {
return -1;
@@ -68,8 +68,8 @@ int xmssmt_keypair(unsigned char *pk, unsigned char *sk, const uint32_t oid)
return -1;
}
for (i = 0; i < XMSS_OID_LEN; i++) {
pk[i] = (oid >> (8 * i)) & 0xFF;
sk[i] = (oid >> (8 * i)) & 0xFF;
pk[XMSS_OID_LEN - i - 1] = (oid >> (8 * i)) & 0xFF;
sk[XMSS_OID_LEN - i - 1] = (oid >> (8 * i)) & 0xFF;
}
return xmssmt_core_keypair(&params, pk + XMSS_OID_LEN, sk + XMSS_OID_LEN);
}
@@ -83,7 +83,7 @@ int xmssmt_sign(unsigned char *sk,
unsigned int i;

for (i = 0; i < XMSS_OID_LEN; i++) {
oid |= sk[i] << (i * 8);
oid |= sk[XMSS_OID_LEN - i - 1] << (i * 8);
}
if (xmssmt_parse_oid(&params, oid)) {
return -1;
@@ -100,7 +100,7 @@ int xmssmt_sign_open(unsigned char *m, unsigned long long *mlen,
unsigned int i;

for (i = 0; i < XMSS_OID_LEN; i++) {
oid |= pk[i] << (i * 8);
oid |= pk[XMSS_OID_LEN - i - 1] << (i * 8);
}
if (xmssmt_parse_oid(&params, oid)) {
return -1;


Loading…
Cancel
Save