OpenSSL GF2m BiGNUM表示法
解釋OpenSSL如何以BIGNUM object表示位於GF2m上的元素
BIGNUM n=6,存成
n->d[0]=6
∵ 6的binary是 110
∴ 表示的元素是 x^2+x
GF2m的 irreducible polynomial 會存在 EC_GROUP object中的 poly array
例如irreducible polynomial是 p=x^4+x+1
存成
poly[0]=4,poly[1]=1,poly[2]=0
計算 n^2 mod p
n^2=(x^2+x)^2=x^4+x^2 \equiv x^2+x+1\mod x^4+x+1用BIGNUM表示為7,存成n->d[0]=7
因為 x^2+x+1 的Binary表示式是 111
Comments
Post a Comment