Fixed RSA "i32" PKCS#1 v1.5 signature generation.

This commit is contained in:
Thomas Pornin 2016-12-31 16:19:12 +01:00
parent f9b85fee90
commit bf809dfae5
3 changed files with 79 additions and 14 deletions

View file

@ -63,6 +63,8 @@ br_rsa_i32_pkcs1_sign(const unsigned char *hash_oid,
if (xlen < hash_len + 11) {
return 0;
}
x[0] = 0x00;
x[1] = 0x01;
u = xlen - hash_len;
memset(x + 2, 0xFF, u - 3);
x[u - 1] = 0x00;
@ -93,7 +95,7 @@ br_rsa_i32_pkcs1_sign(const unsigned char *hash_oid,
x[u ++] = 0x04;
x[u ++] = hash_len;
}
memcpy(x + u + 4, hash, hash_len);
memcpy(x + u, hash, hash_len);
/*
* Do the actual computation.