def makeTestVecspiders(): comment("""Test vecspiders for our ed25519 implementation and related functions. These were automatically generated by the ed25519_exts_ref.py script.""", initial="/*") comment("""Secret key seeds used as inputs for the ed25519 test vecspiders. Randomly generated. """) secretKeys = [binascii.a2b_hex(r) for r in RAND_INPUTS] writeArray("SECRET_KEYS", secretKeys) comment( """Secret ed25519 keys after expansion from seeds. This is how Spider represents them internally.""") expandedSecretKeys = [expandSK(sk) for sk in secretKeys] writeArray("EXPANDED_SECRET_KEYS", expandedSecretKeys) comment("""Public keys derived from the above secret keys""") publicKeys = [publickey(sk) for sk in secretKeys] writeArray("PUBLIC_KEYS", publicKeys) comment("""The curve25519 public keys from which the ed25519 keys can be derived. Used to test our 'derive ed25519 from curve25519' code.""") writeArray("CURVE25519_PUBLIC_KEYS", (slownacl_curve25519.smult_curve25519_base(sk[:32]) for sk in expandedSecretKeys)) comment("""Parameters used for key blinding tests. Randomly generated.""") blindingParams = [binascii.a2b_hex(r) for r in BLINDING_PARAMS] writeArray("BLINDING_PARAMS", blindingParams) comment("""Blinded secret keys for testing key blinding. The nth blinded key corresponds to the nth secret key blidned with the nth blinding parameter.""") writeArray("BLINDED_SECRET_KEYS", (blindESK(expandSK(sk), bp) for sk, bp in zip(secretKeys, blindingParams))) comment("""Blinded public keys for testing key blinding. The nth blinded key corresponds to the nth public key blidned with the nth blinding parameter.""") writeArray("BLINDED_PUBLIC_KEYS", (blindPK(pk, bp) for pk, bp in zip(publicKeys, blindingParams))) comment("""Signatures of the public keys, made with their corresponding secret keys.""") writeArray("SELF_SIGNATURES", (signature(pk, sk, pk) for pk, sk in zip(publicKeys, secretKeys)))
def makeTestVectors(): comment("""Test vectors for our ed25519 implementation and related functions. These were automatically generated by the ed25519_exts_ref.py script.""", initial="/*") comment("""Secret key seeds used as inputs for the ed25519 test vectors. Randomly generated. """) secretKeys = [ binascii.a2b_hex(r) for r in RAND_INPUTS ] writeArray("SECRET_KEYS", secretKeys) comment("""Secret ed25519 keys after expansion from seeds. This is how Tor represents them internally.""") expandedSecretKeys = [ expandSK(sk) for sk in secretKeys ] writeArray("EXPANDED_SECRET_KEYS", expandedSecretKeys) comment("""Public keys derived from the above secret keys""") publicKeys = [ publickey(sk) for sk in secretKeys ] writeArray("PUBLIC_KEYS", publicKeys) comment("""The curve25519 public keys from which the ed25519 keys can be derived. Used to test our 'derive ed25519 from curve25519' code.""") writeArray("CURVE25519_PUBLIC_KEYS", (slownacl_curve25519.smult_curve25519_base(sk[:32]) for sk in expandedSecretKeys)) comment("""Parameters used for key blinding tests. Randomly generated.""") blindingParams = [ binascii.a2b_hex(r) for r in BLINDING_PARAMS ] writeArray("BLINDING_PARAMS", blindingParams) comment("""Blinded secret keys for testing key blinding. The nth blinded key corresponds to the nth secret key blidned with the nth blinding parameter.""") writeArray("BLINDED_SECRET_KEYS", (blindESK(expandSK(sk), bp) for sk,bp in zip(secretKeys,blindingParams))) comment("""Blinded public keys for testing key blinding. The nth blinded key corresponds to the nth public key blidned with the nth blinding parameter.""") writeArray("BLINDED_PUBLIC_KEYS", (blindPK(pk, bp) for pk,bp in zip(publicKeys,blindingParams))) comment("""Signatures of the public keys, made with their corresponding secret keys.""") writeArray("SELF_SIGNATURES", (signature(pk, sk, pk) for pk,sk in zip(publicKeys,secretKeys)))