# Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
# GCD tests.
#
# These test vectors satisfy gcd(A, B) = GCD.
# They were generated with sage, independent of OpenSSL.
A = 0
B = 0
GCD = 0
# gcd(1,0) = 1
A = 1
B = 0
GCD = 1
# gcd(1,1) = 1
A = 1
B = 1
GCD = 1
# gcd(0,a) = a
A = 0
B = 70030ffeeea3deaea19387f4f1d0f460a6954a2a9cb98290602ac09036143ef8eb9692f3eac22961811083e073ee0be1506c24d7b0d4eb0089406758828f7c99dc01692846f88aafb58b2d56a6dd1157b781eeaf807d59496aac6ca754f8830b743ea938ce16cbe03c8fd8675c78ba2420d502f2227a9bbe3979865cd154cbb2
GCD = 70030ffeeea3deaea19387f4f1d0f460a6954a2a9cb98290602ac09036143ef8eb9692f3eac22961811083e073ee0be1506c24d7b0d4eb0089406758828f7c99dc01692846f88aafb58b2d56a6dd1157b781eeaf807d59496aac6ca754f8830b743ea938ce16cbe03c8fd8675c78ba2420d502f2227a9bbe3979865cd154cbb2
# gcd(-a,0) = |a|
A = -231f16458c487346cf50a17beec83632f25d19abeea1097c746533cd3e35207b7efd75dc3e9c663a64b6861e88579dad08649f107a13edf2ad43d0056f9240ad2a08c4aba20f05cc4aad23eb47e77cc8031df5b1c735b55103e164ca6c07bd040e12616df28064e5895a8903a26dfde7e88229a8d29fc4cb77711bf81bd04db9
B = 0
GCD = 231f16458c487346cf50a17beec83632f25d19abeea1097c746533cd3e35207b7efd75dc3e9c663a64b6861e88579dad08649f107a13edf2ad43d0056f9240ad2a08c4aba20f05cc4aad23eb47e77cc8031df5b1c735b55103e164ca6c07bd040e12616df28064e5895a8903a26dfde7e88229a8d29fc4cb77711bf81bd04db9
# for even i, test:
# gcd(2**i - 1, 2**(i/2) - 1) = 2**(i/2) - 1
# gcd(2**i - 1, 2**(i/2) + 1) = 2**(i/2) + 1
A = f
B = 3
GCD = 3
A = f
B = 5
GCD = 5
A = 3f
B = 7
GCD = 7
A = 3f
B = 9
GCD = 9
A = ff
B = f
GCD = f
A = ff
B = 11
GCD = 11
A = 3ff
B = 1f
GCD = 1f
A = 3ff
B = 21
GCD = 21
A = fff
B = 3f
GCD = 3f
A = fff
B = 41
GCD = 41
A = 3fff
B = 7f
GCD = 7f
A = 3fff
B = 81
GCD = 81
A = ffff
B = ff
GCD = ff
A = ffff
B = 101
GCD = 101
A = 3ffff
B = 1ff
GCD = 1ff
A = 3ffff
B = 201
GCD = 201
A = fffff
B = 3ff
GCD = 3ff
A = fffff
B = 401
GCD = 401
A = 3fffff
B = 7ff
GCD = 7ff
A = 3fffff
B = 801
GCD = 801
A = ffffff
B = fff
GCD = fff
A = ffffff
B = 1001
GCD = 1001
A = 3ffffff
B = 1fff
GCD = 1fff
A = 3ffffff
B = 2001
GCD = 2001
A = fffffff
B = 3fff
GCD = 3fff
A = fffffff
B = 4001
GCD = 4001
A = 3fffffff
B = 7fff
GCD = 7fff
A = 3fffffff
B = 8001
GCD = 8001
A = ffffffff
B = ffff
GCD = ffff
A = ffffffff
B = 10001
GCD = 10001
A = 3ffffffff
B = 1ffff
GCD = 1ffff
A = 3ffffffff
B = 20001
GCD = 20001
A = fffffffff
B = 3ffff
GCD = 3ffff
A = fffffffff
B = 40001
GCD = 40001
A = 3fffffffff
B = 7ffff
GCD = 7ffff
A = 3fffffffff
B = 80001
GCD = 80001
A = ffffffffff
B = fffff
GCD = fffff
A = ffffffffff
B = 100001
GCD = 100001
A = 3ffffffffff
B = 1fffff
GCD = 1fffff
A = 3ffffffffff
B = 200001
GCD = 200001
A = fffffffffff
B = 3fffff
GCD = 3fffff
A = fffffffffff
B = 400001
GCD = 400001
A = 3fffffffffff
B = 7fffff
GCD = 7fffff
A = 3fffffffffff
B = 800001
GCD = 800001
A = ffffffffffff
B = ffffff
GCD = ffffff
A = ffffffffffff
B = 1000001
GCD = 1000001
A = 3ffffffffffff
B = 1ffffff
GCD = 1ffffff
A = 3ffffffffffff
B = 2000001
GCD = 2000001
A = fffffffffffff
B = 3ffffff
GCD = 3ffffff
A = fffffffffffff
B = 4000001
GCD = 4000001
A = 3fffffffffffff
B = 7ffffff
GCD = 7ffffff
A = 3fffffffffffff
B = 8000001
GCD = 8000001
A = ffffffffffffff
B = fffffff
GCD = fffffff
A = ffffffffffffff
B = 10000001
GCD = 10000001
A = 3ffffffffffffff
B = 1fffffff
GCD = 1fffffff
A = 3ffffffffffffff
B = 20000001
GCD = 20000001
A = fffffffffffffff
B = 3fffffff
GCD = 3fffffff
A = fffffffffffffff
B = 40000001
GCD = 40000001
A = 3fffffffffffffff
B = 7fffffff
GCD = 7fffffff
A = 3fffffffffffffff
B = 80000001
GCD = 80000001
A = ffffffffffffffff
B = ffffffff
GCD = ffffffff
A = ffffffffffffffff
B = 100000001
GCD = 100000001
A = 3ffffffffffffffff
B = 1ffffffff
GCD = 1ffffffff
A = 3ffffffffffffffff
B = 200000001
GCD = 200000001
A = fffffffffffffffff
B = 3ffffffff
GCD = 3ffffffff
A = fffffffffffffffff
B = 400000001
GCD = 400000001
A = 3fffffffffffffffff
B = 7ffffffff
GCD = 7ffffffff
A = 3fffffffffffffffff
B = 800000001
GCD = 800000001
A = ffffffffffffffffff
B = fffffffff
GCD = fffffffff
A = ffffffffffffffffff
B = 1000000001
GCD = 1000000001
A = 3ffffffffffffffffff
B = 1fffffffff
GCD = 1fffffffff
A = 3ffffffffffffffffff
B = 2000000001
GCD = 2000000001
A = fffffffffffffffffff
B = 3fffffffff
GCD = 3fffffffff
A = fffffffffffffffffff
B = 4000000001
GCD = 4000000001
A = 3fffffffffffffffffff
B = 7fffffffff
GCD = 7fffffffff
A = 3fffffffffffffffffff
B = 8000000001
GCD = 8000000001
A = ffffffffffffffffffff
B = ffffffffff
GCD = ffffffffff
A = ffffffffffffffffffff
B = 10000000001
GCD = 10000000001
A = 3ffffffffffffffffffff
B = 1ffffffffff
GCD = 1ffffffffff
A = 3ffffffffffffffffffff
B = 20000000001
GCD = 20000000001
A = fffffffffffffffffffff
B = 3ffffffffff
GCD = 3ffffffffff
A = fffffffffffffffffffff
B = 40000000001
GCD = 40000000001
A = 3fffffffffffffffffffff
B = 7ffffffffff
GCD = 7ffffffffff
A = 3fffffffffffffffffffff
B = 80000000001
GCD = 80000000001
A = ffffffffffffffffffffff
B = fffffffffff
GCD = fffffffffff
A = ffffffffffffffffffffff
B = 100000000001
GCD = 100000000001
A = 3ffffffffffffffffffffff
B = 1fffffffffff
GCD = 1fffffffffff
A = 3ffffffffffffffffffffff
B = 200000000001
GCD = 200000000001
A = fffffffffffffffffffffff
B = 3fffffffffff
GCD = 3fffffffffff
A = fffffffffffffffffffffff
B = 400000000001
GCD = 400000000001
A = 3fffffffffffffffffffffff
B = 7fffffffffff
GCD = 7fffffffffff
A = 3fffffffffffffffffffffff
B = 800000000001
GCD = 800000000001
A = ffffffffffffffffffffffff
B = ffffffffffff
GCD = ffffffffffff
A = ffffffffffffffffffffffff
B = 1000000000001
GCD = 1000000000001
A = 3ffffffffffffffffffffffff
B = 1ffffffffffff
GCD = 1ffffffffffff
A = 3ffffffffffffffffffffffff
B = 2000000000001
GCD = 2000000000001
A = fffffffffffffffffffffffff
B = 3ffffffffffff
GCD = 3ffffffffffff
A = fffffffffffffffffffffffff
B = 4000000000001
GCD = 4000000000001
A = 3fffffffffffffffffffffffff
B = 7ffffffffffff
GCD = 7ffffffffffff
A = 3fffffffffffffffffffffffff
B = 8000000000001
GCD = 8000000000001
A = ffffffffffffffffffffffffff
B = fffffffffffff
GCD = fffffffffffff
A = ffffffffffffffffffffffffff
B = 10000000000001
GCD = 10000000000001
A = 3ffffffffffffffffffffffffff
B = 1fffffffffffff
GCD = 1fffffffffffff
A = 3ffffffffffffffffffffffffff
B = 20000000000001
GCD = 20000000000001
A = fffffffffffffffffffffffffff
B = 3fffffffffffff
GCD = 3fffffffffffff
A = fffffffffffffffffffffffffff
B = 40000000000001
GCD = 40000000000001
A = 3fffffffffffffffffffffffffff
B = 7fffffffffffff
GCD = 7fffffffffffff
A = 3fffffffffffffffffffffffffff
B = 80000000000001
GCD = 80000000000001
A = ffffffffffffffffffffffffffff
B = ffffffffffffff
GCD = ffffffffffffff
A = ffffffffffffffffffffffffffff
B = 100000000000001
GCD = 100000000000001
A = 3ffffffffffffffffffffffffffff
B = 1ffffffffffffff
GCD = 1ffffffffffffff
A = 3ffffffffffffffffffffffffffff
B = 200000000000001
GCD = 200000000000001
A = fffffffffffffffffffffffffffff
B = 3ffffffffffffff
GCD = 3ffffffffffffff
A = fffffffffffffffffffffffffffff
B = 400000000000001
GCD = 400000000000001
A = 3fffffffffffffffffffffffffffff
B = 7ffffffffffffff
GCD = 7ffffffffffffff
A = 3fffffffffffffffffffffffffffff
B = 800000000000001
GCD = 800000000000001
A = ffffffffffffffffffffffffffffff
B = fffffffffffffff
GCD = fffffffffffffff
A = ffffffffffffffffffffffffffffff
B = 1000000000000001
GCD = 1000000000000001
A = 3ffffffffffffffffffffffffffffff
B = 1fffffffffffffff
GCD = 1fffffffffffffff
A = 3ffffffffffffffffffffffffffffff
B = 2000000000000001
GCD = 2000000000000001
A = fffffffffffffffffffffffffffffff
B = 3fffffffffffffff
GCD = 3fffffffffffffff
A = fffffffffffffffffffffffffffffff
B = 4000000000000001
GCD = 4000000000000001
A = 3fffffff
评论10