Bug 1512719 - land NSS c8f7602ce9e6 UPGRADE_NSS_RELEASE, r=me

--HG--
rename : security/nss/gtests/common/chachapoly-vectors.h => security/nss/gtests/common/testvectors/chachapoly-vectors.h
rename : security/nss/gtests/common/gcm-vectors.h => security/nss/gtests/common/testvectors/gcm-vectors.h
rename : security/nss/gtests/common/wycheproof/header_bases/chachapoly-vectors.h => security/nss/gtests/common/testvectors_base/chachapoly-vectors_base.h
rename : security/nss/gtests/common/wycheproof/header_bases/gcm-vectors.h => security/nss/gtests/common/testvectors_base/gcm-vectors_base.h
rename : security/nss/gtests/common/wycheproof/testvectors/aes_gcm_test.json => security/nss/gtests/common/wycheproof/source_vectors/aes_gcm_test.json
rename : security/nss/gtests/common/wycheproof/testvectors/chacha20_poly1305_test.json => security/nss/gtests/common/wycheproof/source_vectors/chacha20_poly1305_test.json
extra : rebase_source : 6b249cda30af8f4c72947eb1f564cf55536ce691
This commit is contained in:
J.C. Jones 2019-01-03 03:52:36 +00:00
Родитель f4756f7e8e
Коммит 9917c29558
32 изменённых файлов: 3172 добавлений и 276 удалений

Просмотреть файл

@ -1 +1 @@
0c3304a81f07
c8f7602ce9e6

Просмотреть файл

@ -10,4 +10,3 @@
*/
#error "Do not include this header file."

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,75 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef curve25519_vectors_h__
#define curve25519_vectors_h__
#include <string>
#include <vector>
typedef struct curve25519_testvector_str {
std::vector<uint8_t> private_key;
std::vector<uint8_t> public_key;
std::vector<uint8_t> secret;
bool valid;
} curve25519_testvector;
const curve25519_testvector kCurve25519Vectors[] = {
{{0x30, 0x67, 0x02, 0x01, 0x00, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48,
0xce, 0x3d, 0x02, 0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda,
0x47, 0x0f, 0x01, 0x04, 0x4c, 0x30, 0x4a, 0x02, 0x01, 0x01, 0x04, 0x20,
0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1, 0x72,
0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0, 0x99, 0x2a,
0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a, 0xa1, 0x23, 0x03, 0x21,
0x00, 0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d,
0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 0x1a,
0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a},
{0x30, 0x39, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01,
0x03, 0x21, 0x00, 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3,
0x5b, 0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b,
0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f},
{0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d, 0xe1, 0x72, 0x8e, 0x3b,
0xf4, 0x80, 0x35, 0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47, 0xd1,
0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c, 0x1e, 0x16, 0x17, 0x42},
true},
// A public key that's too short (31 bytes).
{{0x30, 0x67, 0x02, 0x01, 0x00, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48,
0xce, 0x3d, 0x02, 0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda,
0x47, 0x0f, 0x01, 0x04, 0x4c, 0x30, 0x4a, 0x02, 0x01, 0x01, 0x04, 0x20,
0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1, 0x72,
0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0, 0x99, 0x2a,
0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a, 0xa1, 0x23, 0x03, 0x21,
0x00, 0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d,
0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 0x1a,
0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a},
{0x30, 0x38, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01,
0x03, 0x20, 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3, 0x5b,
0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b, 0x78,
0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f},
{},
false},
// A public key that's too long (33 bytes).
{{0x30, 0x67, 0x02, 0x01, 0x00, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48,
0xce, 0x3d, 0x02, 0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda,
0x47, 0x0f, 0x01, 0x04, 0x4c, 0x30, 0x4a, 0x02, 0x01, 0x01, 0x04, 0x20,
0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1, 0x72,
0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0, 0x99, 0x2a,
0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a, 0xa1, 0x23, 0x03, 0x21,
0x00, 0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d,
0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 0x1a,
0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a},
{0x30, 0x3a, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01,
0x03, 0x22, 0x00, 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3,
0x5b, 0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b,
0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f, 0x34},
{},
false}};
#endif // curve25519_vectors_h__

Просмотреть файл

@ -7,6 +7,7 @@
import json
import os
import subprocess
script_dir = os.path.dirname(os.path.abspath(__file__))
@ -58,15 +59,46 @@ class ChaChaPoly():
return result
# Writes one Curve25519 testvector into C-header format. (Not clang-format conform)
class Curve25519():
"""Class that provides the generator function for a single curve25519 test case."""
def generate_header(params):
# Static pkcs8 and skpi wrappers for the raw keys from Wycheproof.
# The public key section of the pkcs8 wrapper is filled up with 0's, which is
# not correct, but acceptable for the tests at this moment because
# validity of the public key is not checked.
# It's still necessary because of
# https://searchfox.org/nss/rev/7bc70a3317b800aac07bad83e74b6c79a9ec5bff/lib/pk11wrap/pk11pk12.c#171
pkcs8WrapperStart = "3067020100301406072a8648ce3d020106092b06010401da470f01044c304a0201010420"
pkcs8WrapperEnd = "a1230321000000000000000000000000000000000000000000000000000000000000000000"
spkiWrapper = "3039301406072a8648ce3d020106092b06010401da470f01032100"
def format_testcase(self, testcase):
result = '\n// Comment: {}'.format(testcase['comment'])
result += '\n{{{},\n'.format(string_to_hex_array(self.pkcs8WrapperStart + testcase['private'] + self.pkcs8WrapperEnd))
result += '{},\n'.format(string_to_hex_array(self.spkiWrapper + testcase['public']))
result += '{},\n'.format(string_to_hex_array(testcase['shared']))
# Flag 'acceptable' cases with secret == 0 as invalid for NSS.
# Flag 'acceptable' cases with forbidden public key values as invalid for NSS.
# Flag 'acceptable' cases with small public key (0 or 1) as invalid for NSS.
valid = testcase['result'] in ['valid', 'acceptable'] \
and not testcase['shared'] == "0000000000000000000000000000000000000000000000000000000000000000" \
and not testcase["public"] == "daffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" \
and not testcase["public"] == "dbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" \
and not 'Small public key' in testcase['flags']
result += '{}}},\n'.format(str(valid).lower())
return result
def generate_vectors_file(params):
"""
Generate and store a .h-file with test vectors for one test.
params -- Dictionary with parameters for test vector generation for the desired test.
"""
cases = import_testvector(os.path.join(script_dir, params['source']))
cases = import_testvector(os.path.join(script_dir, params['source_dir'] + params['source_file']))
with open(os.path.join(script_dir, params['base'])) as base:
header = base.read()
@ -95,33 +127,62 @@ def generate_header(params):
# formatter -- the test case formatter class to be used for this test.
# crop_size_end -- number of characters removed from the end of the last generated test vector to close the array definiton.
# finish -- string to re-insert at the end and finish the file. (identical to chars cropped at the start)
# comment -- additional comments to add to the file just before defintion of the test vector array.
aes_gcm_params = {
'source': 'testvectors/aes_gcm_test.json',
'base': 'header_bases/gcm-vectors.h',
'target': '../gcm-vectors.h',
'source_dir': 'source_vectors/',
'source_file': 'aes_gcm_test.json',
'base': '../testvectors_base/gcm-vectors_base.h',
'target': '../testvectors/gcm-vectors.h',
'crop_size_start': -27,
'array_init': 'const gcm_kat_value kGcmWycheproofVectors[] = {\n',
'formatter' : AESGCM(),
'crop_size_end': -3,
'finish': '#endif // gcm_vectors_h__\n'
'finish': '#endif // gcm_vectors_h__\n',
'comment' : ''
}
chacha_poly_params = {
'source': 'testvectors/chacha20_poly1305_test.json',
'base': 'header_bases/chachapoly-vectors.h',
'target': '../chachapoly-vectors.h',
'source_dir': 'source_vectors/',
'source_file': 'chacha20_poly1305_test.json',
'base': '../testvectors_base/chachapoly-vectors_base.h',
'target': '../testvectors/chachapoly-vectors.h',
'crop_size_start': -35,
'array_init': 'const chacha_testvector kChaCha20WycheproofVectors[] = {\n',
'formatter' : ChaChaPoly(),
'crop_size_end': -2,
'finish': '#endif // chachapoly_vectors_h__\n'
'finish': '#endif // chachapoly_vectors_h__\n',
'comment' : ''
}
curve25519_params = {
'source_dir': 'source_vectors/',
'source_file': 'x25519_test.json',
'base': '../testvectors_base/curve25519-vectors_base.h',
'target': '../testvectors/curve25519-vectors.h',
'crop_size_start': -34,
'array_init': 'const curve25519_testvector kCurve25519WycheproofVectors[] = {\n',
'formatter' : Curve25519(),
'crop_size_end': -2,
'finish': '#endif // curve25519_vectors_h__\n',
'comment' : '// The public key section of the pkcs8 wrapped private key is\n\
// filled up with 0\'s, which is not correct, but acceptable for the\n\
// tests at this moment because validity of the public key is not checked.\n'
}
def update_tests(tests):
remote = "https://raw.githubusercontent.com/google/wycheproof/master/testvectors/"
for test in tests:
subprocess.check_call(['wget', remote+test['source_file'], '-O',
'gtests/common/wycheproof/source_vectors/' +test['source_file'],
'--no-check-certificate'])
def generate_test_vectors():
"""Generate C-header files for all supported tests."""
all_params = [aes_gcm_params, chacha_poly_params]
for param in all_params:
generate_header(param)
all_tests = [aes_gcm_params, chacha_poly_params, curve25519_params]
update_tests(all_tests)
for test in all_tests:
generate_vectors_file(test)
def main():
generate_test_vectors()

Просмотреть файл

@ -0,0 +1,956 @@
{
"algorithm" : "X25519",
"generatorVersion" : "0.4.12",
"notes" : {
"LowOrderPublic" : "Curve25519 or its twist contains some points of low order. This test vector contains a public key with such a point. While many libraries reject such public keys, doing so is not a strict requirement according to RFC 7748.",
"Small public key" : "The public key is insecure and does not belong to a valid private key. Some libraries reject such keys.",
"Twist" : "Public keys are either points on curve25519 or points on its twist. Implementations may either reject such keys or compute X25519 using the twist. If a point multiplication is performed then it is important that the result is correct, since otherwise attacks with invalid keys are possible."
},
"numberOfTests" : 87,
"header" : [],
"testGroups" : [
{
"curve" : "curve25519",
"tests" : [
{
"tcId" : 1,
"comment" : "normal case",
"curve" : "curve25519",
"public" : "9c647d9ae589b9f58fdc3ca4947efbc915c4b2e08e744a0edf469dac59c8f85a",
"private" : "4852834d9d6b77dadeabaaf2e11dca66d19fe74993a7bec36c6e16a0983feaba",
"shared" : "87b7f212b627f7a54ca5e0bcdaddd5389d9de6156cdbcf8ebe14ffbcfb436551",
"result" : "valid",
"flags" : []
},
{
"tcId" : 2,
"comment" : "normal case",
"curve" : "curve25519",
"public" : "9c647d9ae589b9f58fdc3ca4947efbc915c4b2e08e744a0edf469dac59c8f85a",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "4b82bd8650ea9b81a42181840926a4ffa16434d1bf298de1db87efb5b0a9e34e",
"result" : "valid",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 3,
"comment" : "public key on twist",
"curve" : "curve25519",
"public" : "63aa40c6e38346c5caf23a6df0a5e6c80889a08647e551b3563449befcfc9733",
"private" : "588c061a50804ac488ad774ac716c3f5ba714b2712e048491379a500211998a8",
"shared" : "b1a707519495ffffb298ff941716b06dfab87cf8d91123fe2be9a233dda22212",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 4,
"comment" : "public key on twist",
"curve" : "curve25519",
"public" : "0f83c36fded9d32fadf4efa3ae93a90bb5cfa66893bc412c43fa7287dbb99779",
"private" : "b05bfd32e55325d9fd648cb302848039000b390e44d521e58aab3b29a6960ba8",
"shared" : "67dd4a6e165533534c0e3f172e4ab8576bca923a5f07b2c069b4c310ff2e935b",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 5,
"comment" : "public key on twist",
"curve" : "curve25519",
"public" : "0b8211a2b6049097f6871c6c052d3c5fc1ba17da9e32ae458403b05bb283092a",
"private" : "70e34bcbe1f47fbc0fddfd7c1e1aa53d57bfe0f66d243067b424bb6210bed19c",
"shared" : "4a0638cfaa9ef1933b47f8939296a6b25be541ef7f70e844c0bcc00b134de64a",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 6,
"comment" : "public key on twist",
"curve" : "curve25519",
"public" : "343ac20a3b9c6a27b1008176509ad30735856ec1c8d8fcae13912d08d152f46c",
"private" : "68c1f3a653a4cdb1d37bba94738f8b957a57beb24d646e994dc29a276aad458d",
"shared" : "399491fce8dfab73b4f9f611de8ea0b27b28f85994250b0f475d585d042ac207",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 7,
"comment" : "public key on twist",
"curve" : "curve25519",
"public" : "fa695fc7be8d1be5bf704898f388c452bafdd3b8eae805f8681a8d15c2d4e142",
"private" : "d877b26d06dff9d9f7fd4c5b3769f8cdd5b30516a5ab806be324ff3eb69ea0b2",
"shared" : "2c4fe11d490a53861776b13b4354abd4cf5a97699db6e6c68c1626d07662f758",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 8,
"comment" : "public key = 0",
"curve" : "curve25519",
"public" : "0000000000000000000000000000000000000000000000000000000000000000",
"private" : "207494038f2bb811d47805bcdf04a2ac585ada7f2f23389bfd4658f9ddd4debc",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"Small public key"
]
},
{
"tcId" : 9,
"comment" : "public key = 1",
"curve" : "curve25519",
"public" : "0100000000000000000000000000000000000000000000000000000000000000",
"private" : "202e8972b61c7e61930eb9450b5070eae1c670475685541f0476217e4818cfab",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"Small public key"
]
},
{
"tcId" : 10,
"comment" : "edge case on twist",
"curve" : "curve25519",
"public" : "0200000000000000000000000000000000000000000000000000000000000000",
"private" : "38dde9f3e7b799045f9ac3793d4a9277dadeadc41bec0290f81f744f73775f84",
"shared" : "9a2cfe84ff9c4a9739625cae4a3b82a906877a441946f8d7b3d795fe8f5d1639",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 11,
"comment" : "edge case on twist",
"curve" : "curve25519",
"public" : "0300000000000000000000000000000000000000000000000000000000000000",
"private" : "9857a914e3c29036fd9a442ba526b5cdcdf28216153e636c10677acab6bd6aa5",
"shared" : "4da4e0aa072c232ee2f0fa4e519ae50b52c1edd08a534d4ef346c2e106d21d60",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 12,
"comment" : "edge case on twist",
"curve" : "curve25519",
"public" : "ffffff030000f8ffff1f0000c0ffffff000000feffff070000f0ffff3f000000",
"private" : "48e2130d723305ed05e6e5894d398a5e33367a8c6aac8fcdf0a88e4b42820db7",
"shared" : "9ed10c53747f647f82f45125d3de15a1e6b824496ab40410ffcc3cfe95760f3b",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 13,
"comment" : "edge case on twist",
"curve" : "curve25519",
"public" : "000000fcffff070000e0ffff3f000000ffffff010000f8ffff0f0000c0ffff7f",
"private" : "28f41011691851b3a62b641553b30d0dfddcb8fffcf53700a7be2f6a872e9fb0",
"shared" : "cf72b4aa6aa1c9f894f4165b86109aa468517648e1f0cc70e1ab08460176506b",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 14,
"comment" : "edge case on twist",
"curve" : "curve25519",
"public" : "00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffff7f",
"private" : "18a93b6499b9f6b3225ca02fef410e0adec23532321d2d8ef1a6d602a8c65b83",
"shared" : "5d50b62836bb69579410386cf7bb811c14bf85b1c7b17e5924c7ffea91ef9e12",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 15,
"comment" : "edge case on twist",
"curve" : "curve25519",
"public" : "eaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "c01d1305a1338a1fcac2ba7e2e032b427e0b04903165aca957d8d0553d8717b0",
"shared" : "19230eb148d5d67c3c22ab1daeff80a57eae4265ce2872657b2c8099fc698e50",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 16,
"comment" : "edge case for public key",
"curve" : "curve25519",
"public" : "0400000000000000000000000000000000000000000000000000000000000000",
"private" : "386f7f16c50731d64f82e6a170b142a4e34f31fd7768fcb8902925e7d1e21abe",
"shared" : "0fcab5d842a078d7a71fc59b57bfb4ca0be6873b49dcdb9f44e14ae8fbdfa542",
"result" : "valid",
"flags" : []
},
{
"tcId" : 17,
"comment" : "edge case for public key",
"curve" : "curve25519",
"public" : "ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000",
"private" : "e023a289bd5e90fa2804ddc019a05ef3e79d434bb6ea2f522ecb643a75296e95",
"shared" : "54ce8f2275c077e3b1306a3939c5e03eef6bbb88060544758d9fef59b0bc3e4f",
"result" : "valid",
"flags" : []
},
{
"tcId" : 18,
"comment" : "edge case for public key",
"curve" : "curve25519",
"public" : "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03",
"private" : "68f010d62ee8d926053a361c3a75c6ea4ebdc8606ab285003a6f8f4076b01e83",
"shared" : "f136775c5beb0af8110af10b20372332043cab752419678775a223df57c9d30d",
"result" : "valid",
"flags" : []
},
{
"tcId" : 19,
"comment" : "edge case for public key",
"curve" : "curve25519",
"public" : "fffffffbfffffbffffdfffffdffffffffefffffefffff7fffff7ffffbfffff3f",
"private" : "58ebcb35b0f8845caf1ec630f96576b62c4b7b6c36b29deb2cb0084651755c96",
"shared" : "bf9affd06b844085586460962ef2146ff3d4533d9444aab006eb88cc3054407d",
"result" : "valid",
"flags" : []
},
{
"tcId" : 20,
"comment" : "edge case for public key",
"curve" : "curve25519",
"public" : "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f",
"private" : "188c4bc5b9c44b38bb658b9b2ae82d5b01015e093184b17cb7863503a783e1bb",
"shared" : "d480de04f699cb3be0684a9cc2e31281ea0bc5a9dcc157d3d20158d46ca5246d",
"result" : "valid",
"flags" : []
},
{
"tcId" : 21,
"comment" : "edge case for public key",
"curve" : "curve25519",
"public" : "fffffffffeffff7ffffffffffeffff7ffffffffffeffff7ffffffffffeffff7f",
"private" : "e06c11bb2e13ce3dc7673f67f5482242909423a9ae95ee986a988d98faee23a2",
"shared" : "4c4401cce6b51e4cb18f2790246c9bf914db667750a1cb89069092af07292276",
"result" : "valid",
"flags" : []
},
{
"tcId" : 22,
"comment" : "edge case for public key",
"curve" : "curve25519",
"public" : "ebffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "c0658c46dde18129293877535b1162b6f9f5414a23cf4d2cbc140a4d99da2b8f",
"shared" : "578ba8cc2dbdc575afcf9df2b3ee6189f5337d6854c79b4ce165ea12293b3a0f",
"result" : "valid",
"flags" : []
},
{
"tcId" : 23,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b800",
"private" : "10255c9230a97a30a458ca284a629669293a31890cda9d147febc7d1e22d6bb1",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 24,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "5f9c95bca3508c24b1d0b1559c83ef5b04445cc4581c8e86d8224eddd09f1157",
"private" : "78f1e8edf14481b389448dac8f59c70b038e7cf92ef2c7eff57a72466e115296",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 25,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "a0a05a3e8f9f44204d5f8059a94ac7dfc39a49ac016dd743dbfa43c5d671fd88",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 26,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "d0dbb3ed1906663f15420af31f4eaf6509d9a9949723500605ad7c1c6e7450a9",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 27,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "c0b1d0eb22b244fe3291140072cdd9d989b5f0ecd96c100feb5bca241c1d9f8f",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 28,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "0000000000000000000000000000000000000000000000000000000000000080",
"private" : "480bf45f594942a8bc0f3353c6e8b8853d77f351f1c2ca6c2d1abf8a00b4229c",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 29,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "0100000000000000000000000000000000000000000000000000000000000080",
"private" : "30f993fcf8514fc89bd8db14cd43ba0d4b2530e73c4276a05e1b145d420cedb4",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 30,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b880",
"private" : "c04974b758380e2a5b5df6eb09bb2f6b3434f982722a8e676d3da251d1b3de83",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 31,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "5f9c95bca3508c24b1d0b1559c83ef5b04445cc4581c8e86d8224eddd09f11d7",
"private" : "502a31373db32446842fe5add3e024022ea54f274182afc3d9f1bb3d39534eb5",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 32,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "90fa6417b0e37030fd6e43eff2abaef14c6793117a039cf621318ba90f4e98be",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 33,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "78ad3f26027f1c9fdd975a1613b947779bad2cf2b741ade01840885a30bb979c",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 34,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "98e23de7b1e0926ed9c87e7b14baf55f497a1d7096f93977680e44dc1c7b7b8b",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"LowOrderPublic"
]
},
{
"tcId" : 35,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "0000000000000000000000000000000000000000000000000000000000000000",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 36,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "0100000000000000000000000000000000000000000000000000000000000000",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 37,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 38,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "5f9c95bca3508c24b1d0b1559c83ef5b04445cc4581c8e86d8224eddd09f1157",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 39,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b800",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 40,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 41,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 42,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "0000000000000000000000000000000000000000000000000000000000000080",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 43,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "0100000000000000000000000000000000000000000000000000000000000080",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 44,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 45,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "5f9c95bca3508c24b1d0b1559c83ef5b04445cc4581c8e86d8224eddd09f11d7",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 46,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b880",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 47,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 48,
"comment" : "public key with low order",
"curve" : "curve25519",
"public" : "eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "1064a67da639a8f6df4fbea2d63358b65bca80a770712e14ea8a72df5a3313ae",
"shared" : "0000000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 49,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "f01e48dafac9d7bcf589cbc382c878d18bda3550589ffb5d50b523bebe329dae",
"shared" : "bd36a0790eb883098c988b21786773de0b3a4df162282cf110de18dd484ce74b",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 50,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "288796bc5aff4b81a37501757bc0753a3c21964790d38699308debc17a6eaf8d",
"shared" : "b4e0dd76da7b071728b61f856771aa356e57eda78a5b1655cc3820fb5f854c5c",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 51,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "f1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "98df845f6651bf1138221f119041f72b6dbc3c4ace7143d99fd55ad867480da8",
"shared" : "6fdf6c37611dbd5304dc0f2eb7c9517eb3c50e12fd050ac6dec27071d4bfc034",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 52,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"private" : "f09498e46f02f878829e78b803d316a2ed695d0498a08abdf8276930e24edcb0",
"shared" : "4c8fc4b1c6ab88fb21f18f6d4c810240d4e94651ba44f7a2c863cec7dc56602d",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 53,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "0200000000000000000000000000000000000000000000000000000000000080",
"private" : "1813c10a5c7f21f96e17f288c0cc37607c04c5f5aea2db134f9e2ffc66bd9db8",
"shared" : "1cd0b28267dc541c642d6d7dca44a8b38a63736eef5c4e6501ffbbb1780c033c",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 54,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "0300000000000000000000000000000000000000000000000000000000000080",
"private" : "7857fb808653645a0beb138a64f5f4d733a45ea84c3cda11a9c06f7e7139149e",
"shared" : "8755be01c60a7e825cff3e0e78cb3aa4333861516aa59b1c51a8b2a543dfa822",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 55,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "0400000000000000000000000000000000000000000000000000000000000080",
"private" : "e03aa842e2abc56e81e87b8b9f417b2a1e5913c723eed28d752f8d47a59f498f",
"shared" : "54c9a1ed95e546d27822a360931dda60a1df049da6f904253c0612bbdc087476",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 56,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "daffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "f8f707b7999b18cb0d6b96124f2045972ca274bfc154ad0c87038c24c6d0d4b2",
"shared" : "cc1f40d743cdc2230e1043daba8b75e810f1fbab7f255269bd9ebb29e6bf494f",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 57,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "dbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "a034f684fa631e1a348118c1ce4c98231f2d9eec9ba5365b4a05d69a785b0796",
"shared" : "54998ee43a5b007bf499f078e736524400a8b5c7e9b9b43771748c7cdf880412",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 58,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "dcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "30b6c6a0f2ffa680768f992ba89e152d5bc9893d38c9119be4f767bfab6e0ca5",
"shared" : "ead9b38efdd723637934e55ab717a7ae09eb86a21dc36a3feeb88b759e391e09",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 59,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "eaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "901b9dcf881e01e027575035d40b43bdc1c5242e030847495b0c7286469b6591",
"shared" : "602ff40789b54b41805915fe2a6221f07a50ffc2c3fc94cf61f13d7904e88e0e",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 60,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "ebffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "8046677c28fd82c9a1bdb71a1a1a34faba1225e2507fe3f54d10bd5b0d865f8e",
"shared" : "e00ae8b143471247ba24f12c885536c3cb981b58e1e56b2baf35c12ae1f79c26",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 61,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "602f7e2f68a846b82cc269b1d48e939886ae54fd636c1fe074d710127d472491",
"shared" : "98cb9b50dd3fc2b0d4f2d2bf7c5cfdd10c8fcd31fc40af1ad44f47c131376362",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 62,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "60887b3dc72443026ebedbbbb70665f42b87add1440e7768fbd7e8e2ce5f639d",
"shared" : "38d6304c4a7e6d9f7959334fb5245bd2c754525d4c91db950206926234c1f633",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 63,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "f1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "78d31dfa854497d72d8def8a1b7fb006cec2d8c4924647c93814ae56faeda495",
"shared" : "786cd54996f014a5a031ec14db812ed08355061fdb5de680a800ac521f318e23",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 64,
"comment" : "public key >= p",
"curve" : "curve25519",
"public" : "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"private" : "c04c5baefa8302ddded6a4bb957761b4eb97aefa4fc3b8043085f96a5659b3a5",
"shared" : "29ae8bc73e9b10a08b4f681c43c3e0ac1a171d31b38f1a48efba29ae639ea134",
"result" : "acceptable",
"flags" : []
},
{
"tcId" : 65,
"comment" : "RFC 7748",
"curve" : "curve25519",
"public" : "e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c",
"private" : "a046e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449a44",
"shared" : "c3da55379de9c6908e94ea4df28d084f32eccf03491c71f754b4075577a28552",
"result" : "valid",
"flags" : []
},
{
"tcId" : 66,
"comment" : "RFC 7748",
"curve" : "curve25519",
"public" : "e5210f12786811d3f4b7959d0538ae2c31dbe7106fc03c3efc4cd549c715a413",
"private" : "4866e9d4d1b4673c5ad22691957d6af5c11b6421e0ea01d42ca4169e7918ba4d",
"shared" : "95cbde9476e8907d7aade45cb4b873f88b595a68799fa152e6f8f7647aac7957",
"result" : "valid",
"flags" : []
},
{
"tcId" : 67,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "0ab4e76380d84dde4f6833c58f2a9fb8f83bb0169b172be4b6e0592887741a36",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "0200000000000000000000000000000000000000000000000000000000000000",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 68,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "89e10d5701b4337d2d032181538b1064bd4084401ceca1fd12663a1959388000",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "0900000000000000000000000000000000000000000000000000000000000000",
"result" : "valid",
"flags" : []
},
{
"tcId" : 69,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "2b55d3aa4a8f80c8c0b2ae5f933e85af49beac36c2fa7394bab76c8933f8f81d",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "1000000000000000000000000000000000000000000000000000000000000000",
"result" : "valid",
"flags" : []
},
{
"tcId" : 70,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "63e5b1fe9601fe84385d8866b0421262f78fbfa5aff9585e626679b18547d959",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "feffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 71,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "e428f3dac17809f827a522ce32355058d07369364aa78902ee10139b9f9dd653",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "fcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f",
"result" : "valid",
"flags" : []
},
{
"tcId" : 72,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "b3b50e3ed3a407b95de942ef74575b5ab8a10c09ee103544d60bdfed8138ab2b",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 73,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "213fffe93d5ea8cd242e462844029922c43c77c9e3e42f562f485d24c501a20b",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "f3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f",
"result" : "valid",
"flags" : []
},
{
"tcId" : 74,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "91b232a178b3cd530932441e6139418f72172292f1da4c1834fc5ebfefb51e3f",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03",
"result" : "valid",
"flags" : []
},
{
"tcId" : 75,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "045c6e11c5d332556c7822fe94ebf89b56a3878dc27ca079103058849fabcb4f",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "e5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 76,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "1ca2190b71163539063c35773bda0c9c928e9136f0620aeb093f099197b7f74e",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "e3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 77,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "f76e9010ac33c5043b2d3b76a842171000c4916222e9e85897a0aec7f6350b3c",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "ddffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"result" : "valid",
"flags" : []
},
{
"tcId" : 78,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "bb72688d8f8aa7a39cd6060cd5c8093cdec6fe341937c3886a99346cd07faa55",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "dbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 79,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "88fddea193391c6a5933ef9b71901549447205aae9da928a6b91a352ba10f41f",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "0000000000000000000000000000000000000000000000000000000000000002",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 80,
"comment" : "edge case for shared secret",
"curve" : "curve25519",
"public" : "303b392f153116cad9cc682a00ccc44c95ff0d3bbe568beb6c4e739bafdc2c68",
"private" : "a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63",
"shared" : "0000000000000000000000000000000000000000000000000000000000008000",
"result" : "acceptable",
"flags" : [
"Twist"
]
},
{
"tcId" : 81,
"comment" : "checking for overflow",
"curve" : "curve25519",
"public" : "fd300aeb40e1fa582518412b49b208a7842b1e1f056a040178ea4141534f652d",
"private" : "c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2",
"shared" : "b734105dc257585d73b566ccb76f062795ccbec89128e52b02f3e59639f13c46",
"result" : "valid",
"flags" : []
},
{
"tcId" : 82,
"comment" : "checking for overflow",
"curve" : "curve25519",
"public" : "c8ef79b514d7682677bc7931e06ee5c27c9b392b4ae9484473f554e6678ecc2e",
"private" : "c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2",
"shared" : "647a46b6fc3f40d62141ee3cee706b4d7a9271593a7b143e8e2e2279883e4550",
"result" : "valid",
"flags" : []
},
{
"tcId" : 83,
"comment" : "checking for overflow",
"curve" : "curve25519",
"public" : "64aeac2504144861532b7bbcb6c87d67dd4c1f07ebc2e06effb95aecc6170b2c",
"private" : "c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2",
"shared" : "4ff03d5fb43cd8657a3cf37c138cadcecce509e4eba089d0ef40b4e4fb946155",
"result" : "valid",
"flags" : []
},
{
"tcId" : 84,
"comment" : "checking for overflow",
"curve" : "curve25519",
"public" : "bf68e35e9bdb7eee1b50570221860f5dcdad8acbab031b14974cc49013c49831",
"private" : "c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2",
"shared" : "21cee52efdbc812e1d021a4af1e1d8bc4db3c400e4d2a2c56a3926db4d99c65b",
"result" : "valid",
"flags" : []
},
{
"tcId" : 85,
"comment" : "checking for overflow",
"curve" : "curve25519",
"public" : "5347c491331a64b43ddc683034e677f53dc32b52a52a577c15a83bf298e99f19",
"private" : "c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2",
"shared" : "18cb89e4e20c0c2bd324305245266c9327690bbe79acb88f5b8fb3f74eca3e52",
"result" : "valid",
"flags" : []
},
{
"tcId" : 86,
"comment" : "private key == -1 (mod order)",
"curve" : "curve25519",
"public" : "258e04523b8d253ee65719fc6906c657192d80717edc828fa0af21686e2faa75",
"private" : "a023cdd083ef5bb82f10d62e59e15a6800000000000000000000000000000050",
"shared" : "258e04523b8d253ee65719fc6906c657192d80717edc828fa0af21686e2faa75",
"result" : "valid",
"flags" : []
},
{
"tcId" : 87,
"comment" : "private key == 1 (mod order) on twist",
"curve" : "curve25519",
"public" : "2eae5ec3dd494e9f2d37d258f873a8e6e9d0dbd1e383ef64d98bb91b3e0be035",
"private" : "58083dd261ad91eff952322ec824c682ffffffffffffffffffffffffffffff5f",
"shared" : "2eae5ec3dd494e9f2d37d258f873a8e6e9d0dbd1e383ef64d98bb91b3e0be035",
"result" : "acceptable",
"flags" : []
}
]
}
]
}

Просмотреть файл

@ -2,7 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
#include "gcm-vectors.h"
#include "testvectors/gcm-vectors.h"
#include "gtest/gtest.h"
#include "util.h"

Просмотреть файл

@ -12,7 +12,7 @@
#include "nss_scoped_ptrs.h"
#include "gcm-vectors.h"
#include "testvectors/gcm-vectors.h"
#include "gtest/gtest.h"
#include "util.h"

Просмотреть файл

@ -12,7 +12,7 @@
#include "cpputil.h"
#include "nss_scoped_ptrs.h"
#include "chachapoly-vectors.h"
#include "testvectors/chachapoly-vectors.h"
#include "gtest/gtest.h"
namespace nss_test {

Просмотреть файл

@ -9,49 +9,13 @@
#include "cpputil.h"
#include "nss_scoped_ptrs.h"
#include "testvectors/curve25519-vectors.h"
#include "gtest/gtest.h"
namespace nss_test {
// <https://tools.ietf.org/html/rfc7748#section-6.1>
const uint8_t kPkcs8[] = {
0x30, 0x67, 0x02, 0x01, 0x00, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48,
0xce, 0x3d, 0x02, 0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda,
0x47, 0x0f, 0x01, 0x04, 0x4c, 0x30, 0x4a, 0x02, 0x01, 0x01, 0x04, 0x20,
0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1, 0x72,
0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0, 0x99, 0x2a,
0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a, 0xa1, 0x23, 0x03, 0x21,
0x00, 0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d,
0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 0x1a,
0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a};
const uint8_t kSpki[] = {
0x30, 0x39, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01,
0x03, 0x21, 0x00, 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3,
0x5b, 0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b,
0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f};
const uint8_t kSecret[] = {0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d, 0xe1,
0x72, 0x8e, 0x3b, 0xf4, 0x80, 0x35, 0x0f, 0x25,
0xe0, 0x7e, 0x21, 0xc9, 0x47, 0xd1, 0x9e, 0x33,
0x76, 0xf0, 0x9b, 0x3c, 0x1e, 0x16, 0x17, 0x42};
// A public key that's too short (31 bytes).
const uint8_t kSpkiShort[] = {
0x30, 0x38, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01,
0x03, 0x20, 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3, 0x5b,
0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b, 0x78,
0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f};
// A public key that's too long (33 bytes).
const uint8_t kSpkiLong[] = {
0x30, 0x3a, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01,
0x03, 0x22, 0x00, 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3,
0x5b, 0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b,
0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f, 0x34};
class Pkcs11Curve25519Test : public ::testing::Test {
class Pkcs11Curve25519Test
: public ::testing::TestWithParam<curve25519_testvector> {
protected:
void Derive(const uint8_t* pkcs8, size_t pkcs8_len, const uint8_t* spki,
size_t spki_len, const uint8_t* secret, size_t secret_len,
@ -84,7 +48,7 @@ class Pkcs11Curve25519Test : public ::testing::Test {
ScopedPK11SymKey symKey(PK11_PubDeriveWithKDF(
privKey.get(), pubKey.get(), false, nullptr, nullptr, CKM_ECDH1_DERIVE,
CKM_SHA512_HMAC, CKA_DERIVE, 0, CKD_NULL, nullptr, nullptr));
EXPECT_EQ(expect_success, !!symKey);
ASSERT_EQ(expect_success, !!symKey);
if (expect_success) {
rv = PK11_ExtractKeyValue(symKey.get());
@ -94,22 +58,22 @@ class Pkcs11Curve25519Test : public ::testing::Test {
EXPECT_EQ(secret_len, keyData->len);
EXPECT_EQ(memcmp(keyData->data, secret, secret_len), 0);
}
}
};
void Derive(const curve25519_testvector testvector) {
Derive(testvector.private_key.data(), testvector.private_key.size(),
testvector.public_key.data(), testvector.public_key.size(),
testvector.secret.data(), testvector.secret.size(),
testvector.valid);
};
};
TEST_F(Pkcs11Curve25519Test, DeriveSharedSecret) {
Derive(kPkcs8, sizeof(kPkcs8), kSpki, sizeof(kSpki), kSecret, sizeof(kSecret),
true);
}
TEST_P(Pkcs11Curve25519Test, TestVectors) { Derive(GetParam()); }
TEST_F(Pkcs11Curve25519Test, DeriveSharedSecretShort) {
Derive(kPkcs8, sizeof(kPkcs8), kSpkiShort, sizeof(kSpkiShort), nullptr, 0,
false);
}
INSTANTIATE_TEST_CASE_P(NSSTestVector, Pkcs11Curve25519Test,
::testing::ValuesIn(kCurve25519Vectors));
TEST_F(Pkcs11Curve25519Test, DeriveSharedSecretLong) {
Derive(kPkcs8, sizeof(kPkcs8), kSpkiLong, sizeof(kSpkiLong), nullptr, 0,
false);
}
INSTANTIATE_TEST_CASE_P(WycheproofTestVector, Pkcs11Curve25519Test,
::testing::ValuesIn(kCurve25519WycheproofVectors));
} // namespace nss_test

Просмотреть файл

@ -269,4 +269,11 @@ TEST_F(TlsConnectStreamTls13, Tls14ClientHelloWithSupportedVersions) {
ASSERT_LT(static_cast<uint32_t>(SSL_LIBRARY_VERSION_TLS_1_2), version);
}
// Offer 1.3 but with ClientHello.legacy_version == SSL 3.0. This
// causes a protocol version alert. See RFC 8446 Appendix D.5.
TEST_F(TlsConnectStreamTls13, Ssl30ClientHelloWithSupportedVersions) {
MakeTlsFilter<TlsClientHelloVersionSetter>(client_, SSL_LIBRARY_VERSION_3_0);
ConnectExpectAlert(server_, kTlsAlertProtocolVersion);
}
} // namespace nss_test

Просмотреть файл

@ -31,32 +31,32 @@
* @(#)extern.h 8.4 (Berkeley) 6/16/94
*/
BUFHEAD *__add_ovflpage(HTAB *, BUFHEAD *);
int __addel(HTAB *, BUFHEAD *, const DBT *, const DBT *);
int __big_delete(HTAB *, BUFHEAD *);
int __big_insert(HTAB *, BUFHEAD *, const DBT *, const DBT *);
int __big_keydata(HTAB *, BUFHEAD *, DBT *, DBT *, int);
int __big_return(HTAB *, BUFHEAD *, int, DBT *, int);
int __big_split(HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *,
uint32, uint32, SPLIT_RETURN *);
int __buf_free(HTAB *, int, int);
void __buf_init(HTAB *, int);
uint32 __call_hash(HTAB *, char *, size_t);
int __delpair(HTAB *, BUFHEAD *, int);
int __expand_table(HTAB *);
int __find_bigpair(HTAB *, BUFHEAD *, int, char *, int);
uint16 __find_last_page(HTAB *, BUFHEAD **);
void __free_ovflpage(HTAB *, BUFHEAD *);
BUFHEAD *__get_buf(HTAB *, uint32, BUFHEAD *, int);
int __get_page(HTAB *, char *, uint32, int, int, int);
int __ibitmap(HTAB *, int, int, int);
uint32 __log2(uint32);
int __put_page(HTAB *, char *, uint32, int, int);
void __reclaim_buf(HTAB *, BUFHEAD *);
int __split_page(HTAB *, uint32, uint32);
BUFHEAD *dbm_add_ovflpage(HTAB *, BUFHEAD *);
int dbm_addel(HTAB *, BUFHEAD *, const DBT *, const DBT *);
int dbm_big_delete(HTAB *, BUFHEAD *);
int dbm_big_insert(HTAB *, BUFHEAD *, const DBT *, const DBT *);
int dbm_big_keydata(HTAB *, BUFHEAD *, DBT *, DBT *, int);
int dbm_big_return(HTAB *, BUFHEAD *, int, DBT *, int);
int dbm_big_split(HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *,
uint32, uint32, SPLIT_RETURN *);
int dbm_buf_free(HTAB *, int, int);
void dbm_buf_init(HTAB *, int);
uint32 dbm_call_hash(HTAB *, char *, size_t);
int dbm_delpair(HTAB *, BUFHEAD *, int);
int dbm_expand_table(HTAB *);
int dbm_find_bigpair(HTAB *, BUFHEAD *, int, char *, int);
uint16 dbm_find_last_page(HTAB *, BUFHEAD **);
void dbm_free_ovflpage(HTAB *, BUFHEAD *);
BUFHEAD *dbm_get_buf(HTAB *, uint32, BUFHEAD *, int);
int dbm_get_page(HTAB *, char *, uint32, int, int, int);
int dbm_ibitmap(HTAB *, int, int, int);
uint32 dbm_log2(uint32);
int dbm_put_page(HTAB *, char *, uint32, int, int);
void dbm_reclaim_buf(HTAB *, BUFHEAD *);
int dbm_split_page(HTAB *, uint32, uint32);
/* Default hash routine. */
extern uint32 (*__default_hash)(const void *, size_t);
extern uint32 (*dbm_default_hash)(const void *, size_t);
#ifdef HASH_STATISTICS
extern int hash_accesses, hash_collisions, hash_expansions, hash_overflows;

Просмотреть файл

@ -190,7 +190,7 @@ typedef struct htab { /* Memory resident data structure */
#define OADDR_OF(S, O) ((uint32)((uint32)(S) << SPLITSHIFT) + (O))
#define BUCKET_TO_PAGE(B) \
(B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__log2((uint32)((B) + 1)) - 1] : 0)
(B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[dbm_log2((uint32)((B) + 1)) - 1] : 0)
#define OADDR_TO_PAGE(B) \
BUCKET_TO_PAGE((1 << SPLITNUM((B))) - 1) + OPAGENUM((B));
@ -314,28 +314,28 @@ typedef struct htab { /* Memory resident data structure */
#define NEXT_FREE hdr.next_free
#define H_CHARKEY hdr.h_charkey
extern uint32 (*__default_hash)(const void *, size_t);
void __buf_init(HTAB *hashp, int32 nbytes);
int __big_delete(HTAB *hashp, BUFHEAD *bufp);
BUFHEAD *__get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage);
uint32 __call_hash(HTAB *hashp, char *k, size_t len);
extern uint32 (*dbm_default_hash)(const void *, size_t);
void dbm_buf_init(HTAB *hashp, int32 nbytes);
int dbm_big_delete(HTAB *hashp, BUFHEAD *bufp);
BUFHEAD *dbm_get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage);
uint32 dbm_call_hash(HTAB *hashp, char *k, size_t len);
#include "page.h"
extern int __big_split(HTAB *hashp, BUFHEAD *op, BUFHEAD *np,
BUFHEAD *big_keyp, uint32 addr, uint32 obucket, SPLIT_RETURN *ret);
void __free_ovflpage(HTAB *hashp, BUFHEAD *obufp);
BUFHEAD *__add_ovflpage(HTAB *hashp, BUFHEAD *bufp);
int __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val);
int __expand_table(HTAB *hashp);
uint32 __log2(uint32 num);
void __reclaim_buf(HTAB *hashp, BUFHEAD *bp);
int __get_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_disk, int is_bitmap);
int __put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap);
int __ibitmap(HTAB *hashp, int pnum, int nbits, int ndx);
int __buf_free(HTAB *hashp, int do_free, int to_disk);
int __find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size);
uint16 __find_last_page(HTAB *hashp, BUFHEAD **bpp);
int __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val);
int __big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current);
int __delpair(HTAB *hashp, BUFHEAD *bufp, int ndx);
int __big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set);
int __split_page(HTAB *hashp, uint32 obucket, uint32 nbucket);
extern int dbm_big_split(HTAB *hashp, BUFHEAD *op, BUFHEAD *np,
BUFHEAD *big_keyp, uint32 addr, uint32 obucket, SPLIT_RETURN *ret);
void dbm_free_ovflpage(HTAB *hashp, BUFHEAD *obufp);
BUFHEAD *dbm_add_ovflpage(HTAB *hashp, BUFHEAD *bufp);
int dbm_big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val);
int dbm_expand_table(HTAB *hashp);
uint32 dbm_log2(uint32 num);
void dbm_reclaim_buf(HTAB *hashp, BUFHEAD *bp);
int dbm_get_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_disk, int is_bitmap);
int dbm_put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap);
int dbm_ibitmap(HTAB *hashp, int pnum, int nbits, int ndx);
int dbm_buf_free(HTAB *hashp, int do_free, int to_disk);
int dbm_find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size);
uint16 dbm_find_last_page(HTAB *hashp, BUFHEAD **bpp);
int dbm_addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val);
int dbm_big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current);
int dbm_delpair(HTAB *hashp, BUFHEAD *bufp, int ndx);
int dbm_big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set);
int dbm_split_page(HTAB *hashp, uint32 obucket, uint32 nbucket);

Просмотреть файл

@ -287,16 +287,16 @@ typedef enum { LockOutDatabase,
#endif
/* Access method description structure. */
typedef struct __db {
typedef struct dbm_db {
DBTYPE type; /* Underlying db type. */
int (*close)(struct __db *);
int (*del)(const struct __db *, const DBT *, uint);
int (*get)(const struct __db *, const DBT *, DBT *, uint);
int (*put)(const struct __db *, DBT *, const DBT *, uint);
int (*seq)(const struct __db *, DBT *, DBT *, uint);
int (*sync)(const struct __db *, uint);
int (*close)(struct dbm_db *);
int (*del)(const struct dbm_db *, const DBT *, uint);
int (*get)(const struct dbm_db *, const DBT *, DBT *, uint);
int (*put)(const struct dbm_db *, DBT *, const DBT *, uint);
int (*seq)(const struct dbm_db *, DBT *, DBT *, uint);
int (*sync)(const struct dbm_db *, uint);
void *internal; /* Access method private. */
int (*fd)(const struct __db *);
int (*fd)(const struct dbm_db *);
} DB;
#define BTREEMAGIC 0x053162
@ -412,10 +412,10 @@ dbopen(const char *, int, int, DBTYPE, const void *);
void dbSetOrClearDBLock(DBLockFlagEnum type);
#ifdef __DBINTERFACE_PRIVATE
DB *__bt_open(const char *, int, int, const BTREEINFO *, int);
DB *__hash_open(const char *, int, int, const HASHINFO *, int);
DB *__rec_open(const char *, int, int, const RECNOINFO *, int);
void __dbpanic(DB *dbp);
DB *dbm_bt_open(const char *, int, int, const BTREEINFO *, int);
DB *dbm_hash_open(const char *, int, int, const HASHINFO *, int);
DB *dbm_rec_open(const char *, int, int, const RECNOINFO *, int);
void dbm_dbpanic(DB *dbp);
#endif
PR_END_EXTERN_C

Просмотреть файл

@ -89,13 +89,13 @@ typedef unsigned int sigset_t;
#define SIG_UNBLOCK 2
#define SIG_SETMASK 3
static int __sigtemp; /* For the use of sigprocmask */
static int dbm_sigtemp; /* For the use of sigprocmask */
/* Repeated test of oset != NULL is to avoid "*0". */
#define sigprocmask(how, set, oset) \
((__sigtemp = \
((dbm_sigtemp = \
(((how) == SIG_BLOCK) ? sigblock(0) | *(set) : (((how) == SIG_UNBLOCK) ? sigblock(0) & ~(*(set)) : ((how) == SIG_SETMASK ? *(set) : sigblock(0))))), \
((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : sigsetmask(__sigtemp)), 0)
((oset) ? (*(oset ? oset : set) = sigsetmask(dbm_sigtemp)) : sigsetmask(dbm_sigtemp)), 0)
#endif
/*

Просмотреть файл

@ -92,16 +92,16 @@ dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo
/* we don't need btree and recno right now */
#if 0
case DB_BTREE:
return (__bt_open(fname, flags & USE_OPEN_FLAGS,
return (dbm_bt_open(fname, flags & USE_OPEN_FLAGS,
mode, openinfo, flags & DB_FLAGS));
case DB_RECNO:
return (__rec_open(fname, flags & USE_OPEN_FLAGS,
return (dbm_rec_open(fname, flags & USE_OPEN_FLAGS,
mode, openinfo, flags & DB_FLAGS));
#endif
case DB_HASH:
return (__hash_open(fname, flags & USE_OPEN_FLAGS,
mode, (const HASHINFO *)openinfo, flags & DB_FLAGS));
return (dbm_hash_open(fname, flags & USE_OPEN_FLAGS,
mode, (const HASHINFO *)openinfo, flags & DB_FLAGS));
default:
break;
}
@ -110,7 +110,7 @@ dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo
}
static int
__dberr()
dbm_dberr()
{
return (RET_ERROR);
}
@ -122,13 +122,13 @@ __dberr()
* dbp: pointer to the DB structure.
*/
void
__dbpanic(DB *dbp)
dbm_dbpanic(DB *dbp)
{
/* The only thing that can succeed is a close. */
dbp->del = (int (*)(const struct __db *, const DBT *, uint))__dberr;
dbp->fd = (int (*)(const struct __db *))__dberr;
dbp->get = (int (*)(const struct __db *, const DBT *, DBT *, uint))__dberr;
dbp->put = (int (*)(const struct __db *, DBT *, const DBT *, uint))__dberr;
dbp->seq = (int (*)(const struct __db *, DBT *, DBT *, uint))__dberr;
dbp->sync = (int (*)(const struct __db *, uint))__dberr;
dbp->del = (int (*)(const struct dbm_db *, const DBT *, uint))dbm_dberr;
dbp->fd = (int (*)(const struct dbm_db *))dbm_dberr;
dbp->get = (int (*)(const struct dbm_db *, const DBT *, DBT *, uint))dbm_dberr;
dbp->put = (int (*)(const struct dbm_db *, DBT *, const DBT *, uint))dbm_dberr;
dbp->seq = (int (*)(const struct dbm_db *, DBT *, DBT *, uint))dbm_dberr;
dbp->sync = (int (*)(const struct dbm_db *, uint))dbm_dberr;
}

Просмотреть файл

@ -85,7 +85,7 @@ static int collect_data(HTAB *, BUFHEAD *, int, int);
*-1 ==> ERROR
*/
extern int
__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
dbm_big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
{
register uint16 *p;
uint key_size, n, val_size;
@ -114,7 +114,7 @@ __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
FREESPACE(p) = off - PAGE_META(n);
OFFSET(p) = off;
p[n] = PARTIAL_KEY;
bufp = __add_ovflpage(hashp, bufp);
bufp = dbm_add_ovflpage(hashp, bufp);
if (!bufp)
return (-1);
n = p[0];
@ -158,7 +158,7 @@ __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
OFFSET(p) = off;
if (val_size) {
p[n] = FULL_KEY;
bufp = __add_ovflpage(hashp, bufp);
bufp = dbm_add_ovflpage(hashp, bufp);
if (!bufp)
return (-1);
cp = bufp->page;
@ -182,7 +182,7 @@ __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
*-1 => ERROR
*/
extern int
__big_delete(HTAB *hashp, BUFHEAD *bufp)
dbm_big_delete(HTAB *hashp, BUFHEAD *bufp)
{
register BUFHEAD *last_bfp, *rbufp;
uint16 *bp, pageno;
@ -207,9 +207,9 @@ __big_delete(HTAB *hashp, BUFHEAD *bufp)
break;
pageno = bp[bp[0] - 1];
rbufp->flags |= BUF_MOD;
rbufp = __get_buf(hashp, pageno, rbufp, 0);
rbufp = dbm_get_buf(hashp, pageno, rbufp, 0);
if (last_bfp)
__free_ovflpage(hashp, last_bfp);
dbm_free_ovflpage(hashp, last_bfp);
last_bfp = rbufp;
if (!rbufp)
return (-1); /* Error. */
@ -244,9 +244,9 @@ __big_delete(HTAB *hashp, BUFHEAD *bufp)
bufp->flags |= BUF_MOD;
if (rbufp)
__free_ovflpage(hashp, rbufp);
dbm_free_ovflpage(hashp, rbufp);
if (last_bfp != rbufp)
__free_ovflpage(hashp, last_bfp);
dbm_free_ovflpage(hashp, last_bfp);
hashp->NKEYS--;
return (0);
@ -259,7 +259,7 @@ __big_delete(HTAB *hashp, BUFHEAD *bufp)
* -3 error
*/
extern int
__find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size)
dbm_find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size)
{
register uint16 *bp;
register char *p;
@ -279,7 +279,7 @@ __find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size)
return (-2);
kkey += bytes;
ksize -= bytes;
bufp = __get_buf(hashp, bp[ndx + 2], bufp, 0);
bufp = dbm_get_buf(hashp, bp[ndx + 2], bufp, 0);
if (!bufp)
return (-3);
p = bufp->page;
@ -306,7 +306,7 @@ __find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size)
* bucket)
*/
extern uint16
__find_last_page(HTAB *hashp, BUFHEAD **bpp)
dbm_find_last_page(HTAB *hashp, BUFHEAD **bpp)
{
BUFHEAD *bufp;
uint16 *bp, pageno;
@ -332,7 +332,7 @@ __find_last_page(HTAB *hashp, BUFHEAD **bpp)
return (0);
pageno = bp[n - 1];
bufp = __get_buf(hashp, pageno, bufp, 0);
bufp = dbm_get_buf(hashp, pageno, bufp, 0);
if (!bufp)
return (0); /* Need to indicate an error! */
bp = (uint16 *)bufp->page;
@ -350,7 +350,7 @@ __find_last_page(HTAB *hashp, BUFHEAD **bpp)
* index (index should always be 1).
*/
extern int
__big_return(
dbm_big_return(
HTAB *hashp,
BUFHEAD *bufp,
int ndx,
@ -364,7 +364,7 @@ __big_return(
bp = (uint16 *)bufp->page;
while (bp[ndx + 1] == PARTIAL_KEY) {
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0);
if (!bufp)
return (-1);
bp = (uint16 *)bufp->page;
@ -372,7 +372,7 @@ __big_return(
}
if (bp[ndx + 1] == FULL_KEY) {
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0);
if (!bufp)
return (-1);
bp = (uint16 *)bufp->page;
@ -392,7 +392,7 @@ __big_return(
len = bp[1] - off;
save_p = bufp;
save_addr = bufp->addr;
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0);
if (!bufp)
return (-1);
bp = (uint16 *)bufp->page;
@ -409,8 +409,8 @@ __big_return(
hashp->cbucket++;
hashp->cndx = 1;
} else {
hashp->cpage = __get_buf(hashp,
bp[bp[0] - 1], bufp, 0);
hashp->cpage = dbm_get_buf(hashp,
bp[bp[0] - 1], bufp, 0);
if (!hashp->cpage)
return (-1);
hashp->cndx = 1;
@ -470,7 +470,7 @@ collect_data(
save_bufp->flags |= BUF_PIN;
/* read the length of the buffer */
for (totlen = len; bufp; bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0)) {
for (totlen = len; bufp; bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0)) {
bp = (uint16 *)bufp->page;
mylen = hashp->BSIZE - bp[1];
@ -502,7 +502,7 @@ collect_data(
/* copy the buffers back into temp buf */
for (bufp = save_bufp; bufp;
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0)) {
bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0)) {
bp = (uint16 *)bufp->page;
mylen = hashp->BSIZE - bp[1];
memmove(&hashp->tmp_buf[len], (bufp->page) + bp[1], (size_t)mylen);
@ -522,7 +522,7 @@ collect_data(
hashp->cpage = NULL;
hashp->cbucket++;
} else {
hashp->cpage = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
hashp->cpage = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0);
if (!hashp->cpage)
return (-1);
else if (!((uint16 *)hashp->cpage->page)[0]) {
@ -538,7 +538,7 @@ collect_data(
* Fill in the key and data for this big pair.
*/
extern int
__big_keydata(
dbm_big_keydata(
HTAB *hashp,
BUFHEAD *bufp,
DBT *key, DBT *val,
@ -579,10 +579,10 @@ collect_key(
free(hashp->tmp_key);
if ((hashp->tmp_key = (char *)malloc((size_t)totlen)) == NULL)
return (-1);
if (__big_return(hashp, bufp, 1, val, set))
if (dbm_big_return(hashp, bufp, 1, val, set))
return (-1);
} else {
xbp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
xbp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0);
if (!xbp || ((totlen =
collect_key(hashp, xbp, totlen, val, set)) < 1))
return (-1);
@ -601,7 +601,7 @@ collect_key(
* -1 => error
*/
extern int
__big_split(
dbm_big_split(
HTAB *hashp,
BUFHEAD *op, /* Pointer to where to put keys that go in old bucket */
BUFHEAD *np, /* Pointer to new bucket page */
@ -621,13 +621,13 @@ __big_split(
bp = big_keyp;
/* Now figure out where the big key/data goes */
if (__big_keydata(hashp, big_keyp, &key, &val, 0))
if (dbm_big_keydata(hashp, big_keyp, &key, &val, 0))
return (-1);
change = (__call_hash(hashp, (char *)key.data, key.size) != obucket);
change = (dbm_call_hash(hashp, (char *)key.data, key.size) != obucket);
if ((ret->next_addr = __find_last_page(hashp, &big_keyp))) {
if ((ret->next_addr = dbm_find_last_page(hashp, &big_keyp))) {
if (!(ret->nextp =
__get_buf(hashp, ret->next_addr, big_keyp, 0)))
dbm_get_buf(hashp, ret->next_addr, big_keyp, 0)))
return (-1);
;
} else
@ -692,7 +692,7 @@ __big_split(
tp[0] -= 2;
FREESPACE(tp) = free_space + OVFLSIZE;
OFFSET(tp) = off;
tmpp = __add_ovflpage(hashp, big_keyp);
tmpp = dbm_add_ovflpage(hashp, big_keyp);
if (!tmpp)
return (-1);
tp[4] = n;

Просмотреть файл

@ -52,7 +52,7 @@ static uint32 hash3(const void *, size_t);
static uint32 hash4(const void *, size_t);
/* Global default hash function */
uint32 (*__default_hash)(const void *, size_t) = hash4;
uint32 (*dbm_default_hash)(const void *, size_t) = hash4;
/*
* HASH FUNCTIONS

Просмотреть файл

@ -43,7 +43,7 @@ static char sccsid[] = "@(#)hash_log2.c 8.2 (Berkeley) 5/31/94";
#include "mcom_db.h"
uint32
__log2(uint32 num)
dbm_log2(uint32 num)
{
register uint32 i, limit;

Просмотреть файл

@ -204,7 +204,7 @@ putpair(char *p, const DBT *key, DBT *val)
* -1 error
*/
extern int
__delpair(HTAB *hashp, BUFHEAD *bufp, int ndx)
dbm_delpair(HTAB *hashp, BUFHEAD *bufp, int ndx)
{
register uint16 *bp, newoff;
register int n;
@ -214,7 +214,7 @@ __delpair(HTAB *hashp, BUFHEAD *bufp, int ndx)
n = bp[0];
if (bp[ndx + 1] < REAL_KEY)
return (__big_delete(hashp, bufp));
return (dbm_big_delete(hashp, bufp));
if (ndx != 1)
newoff = bp[ndx - 1];
else
@ -277,7 +277,7 @@ __delpair(HTAB *hashp, BUFHEAD *bufp, int ndx)
* -1 ==> Error
*/
extern int
__split_page(HTAB *hashp, uint32 obucket, uint32 nbucket)
dbm_split_page(HTAB *hashp, uint32 obucket, uint32 nbucket)
{
register BUFHEAD *new_bufp, *old_bufp;
register uint16 *ino;
@ -292,10 +292,10 @@ __split_page(HTAB *hashp, uint32 obucket, uint32 nbucket)
copyto = (uint16)hashp->BSIZE;
off = (uint16)hashp->BSIZE;
old_bufp = __get_buf(hashp, obucket, NULL, 0);
old_bufp = dbm_get_buf(hashp, obucket, NULL, 0);
if (old_bufp == NULL)
return (-1);
new_bufp = __get_buf(hashp, nbucket, NULL, 0);
new_bufp = dbm_get_buf(hashp, nbucket, NULL, 0);
if (new_bufp == NULL)
return (-1);
@ -331,7 +331,7 @@ __split_page(HTAB *hashp, uint32 obucket, uint32 nbucket)
assert(((int)key.size) > -1);
#endif
if (__call_hash(hashp, (char *)key.data, key.size) == obucket) {
if (dbm_call_hash(hashp, (char *)key.data, key.size) == obucket) {
/* Don't switch page */
diff = copyto - off;
if (diff) {
@ -443,8 +443,8 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp,
return DATABASE_CORRUPTED_ERROR;
if (ino[2] < REAL_KEY && ino[2] != OVFLPAGE) {
if ((status = __big_split(hashp, old_bufp,
new_bufp, bufp, bufp->addr, obucket, &ret)))
if ((status = dbm_big_split(hashp, old_bufp,
new_bufp, bufp, bufp->addr, obucket, &ret)))
return (status);
old_bufp = ret.oldp;
if (!old_bufp)
@ -477,7 +477,7 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp,
scopyto - sizeof(uint16) * (ino[0] + 3);
OFFSET(ino) = scopyto;
bufp = __get_buf(hashp, ov_addr, bufp, 0);
bufp = dbm_get_buf(hashp, ov_addr, bufp, 0);
if (!bufp)
return (-1);
@ -487,7 +487,7 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp,
moved = 0;
if (last_bfp)
__free_ovflpage(hashp, last_bfp);
dbm_free_ovflpage(hashp, last_bfp);
last_bfp = bufp;
}
/* Move regular sized pairs of there are any */
@ -506,13 +506,13 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp,
val.size = ino[n] - ino[n + 1];
off = ino[n + 1];
if (__call_hash(hashp, (char *)key.data, key.size) == obucket) {
if (dbm_call_hash(hashp, (char *)key.data, key.size) == obucket) {
/* Keep on old page */
if (PAIRFITS(op, (&key), (&val)))
putpair((char *)op, &key, &val);
else {
old_bufp =
__add_ovflpage(hashp, old_bufp);
dbm_add_ovflpage(hashp, old_bufp);
if (!old_bufp)
return (-1);
op = (uint16 *)old_bufp->page;
@ -525,7 +525,7 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp,
putpair((char *)np, &key, &val);
else {
new_bufp =
__add_ovflpage(hashp, new_bufp);
dbm_add_ovflpage(hashp, new_bufp);
if (!new_bufp)
return (-1);
np = (uint16 *)new_bufp->page;
@ -536,7 +536,7 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp,
}
}
if (last_bfp)
__free_ovflpage(hashp, last_bfp);
dbm_free_ovflpage(hashp, last_bfp);
return (0);
}
@ -548,7 +548,7 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp,
* 1 ==> failure
*/
extern int
__addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
dbm_addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
{
register uint16 *bp, *sop;
int do_expand;
@ -562,7 +562,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
and we need to add another page */
break;
else if (bp[2] < REAL_KEY && bp[bp[0]] != OVFLPAGE) {
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0);
if (!bufp) {
#ifdef DEBUG
assert(0);
@ -585,7 +585,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
return (0);
}
} else {
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0);
if (!bufp) {
#ifdef DEBUG
assert(0);
@ -599,7 +599,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
putpair(bufp->page, key, (DBT *)val);
else {
do_expand = 1;
bufp = __add_ovflpage(hashp, bufp);
bufp = dbm_add_ovflpage(hashp, bufp);
if (!bufp) {
#ifdef DEBUG
assert(0);
@ -610,7 +610,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
if (PAIRFITS(sop, key, val))
putpair((char *)sop, key, (DBT *)val);
else if (__big_insert(hashp, bufp, key, val)) {
else if (dbm_big_insert(hashp, bufp, key, val)) {
#ifdef DEBUG
assert(0);
#endif
@ -625,7 +625,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
hashp->NKEYS++;
if (do_expand ||
(hashp->NKEYS / (hashp->MAX_BUCKET + 1) > hashp->FFACTOR))
return (__expand_table(hashp));
return (dbm_expand_table(hashp));
return (0);
}
@ -636,7 +636,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
* NULL on error
*/
extern BUFHEAD *
__add_ovflpage(HTAB *hashp, BUFHEAD *bufp)
dbm_add_ovflpage(HTAB *hashp, BUFHEAD *bufp)
{
register uint16 *sp;
uint16 ndx, ovfl_num;
@ -657,7 +657,7 @@ __add_ovflpage(HTAB *hashp, BUFHEAD *bufp)
tmp1 = bufp->addr;
tmp2 = bufp->ovfl ? bufp->ovfl->addr : 0;
#endif
if (!ovfl_num || !(bufp->ovfl = __get_buf(hashp, ovfl_num, bufp, 1)))
if (!ovfl_num || !(bufp->ovfl = dbm_get_buf(hashp, ovfl_num, bufp, 1)))
return (NULL);
bufp->ovfl->flags |= BUF_MOD;
#ifdef DEBUG1
@ -687,12 +687,12 @@ __add_ovflpage(HTAB *hashp, BUFHEAD *bufp)
* -1 indicates FAILURE
*/
extern int
__get_page(HTAB *hashp,
char *p,
uint32 bucket,
int is_bucket,
int is_disk,
int is_bitmap)
dbm_get_page(HTAB *hashp,
char *p,
uint32 bucket,
int is_bucket,
int is_disk,
int is_bitmap)
{
register int fd, page;
size_t size;
@ -805,7 +805,7 @@ __get_page(HTAB *hashp,
* -1 ==>failure
*/
extern int
__put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap)
dbm_put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap)
{
register int fd, page;
size_t size;
@ -895,7 +895,7 @@ __put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap)
* once they are read in.
*/
extern int
__ibitmap(HTAB *hashp, int pnum, int nbits, int ndx)
dbm_ibitmap(HTAB *hashp, int pnum, int nbits, int ndx)
{
uint32 *ip;
size_t clearbytes, clearints;
@ -1011,8 +1011,8 @@ overflow_page(HTAB *hashp)
* don't have to if we tell init_bitmap not to leave it clear
* in the first place.
*/
if (__ibitmap(hashp,
(int)OADDR_OF(splitnum, offset), 1, free_page))
if (dbm_ibitmap(hashp,
(int)OADDR_OF(splitnum, offset), 1, free_page))
return (0);
hashp->SPARES[splitnum]++;
#ifdef DEBUG2
@ -1084,7 +1084,7 @@ found:
* Mark this overflow page as free.
*/
extern void
__free_ovflpage(HTAB *hashp, BUFHEAD *obufp)
dbm_free_ovflpage(HTAB *hashp, BUFHEAD *obufp)
{
uint16 addr;
uint32 *freep;
@ -1125,7 +1125,7 @@ __free_ovflpage(HTAB *hashp, BUFHEAD *obufp)
(void)fprintf(stderr, "FREE_OVFLPAGE: ADDR: %d BIT: %d PAGE %d\n",
obufp->addr, free_bit, free_page);
#endif
__reclaim_buf(hashp, obufp);
dbm_reclaim_buf(hashp, obufp);
}
/*
@ -1236,8 +1236,8 @@ fetch_bitmap(HTAB *hashp, uint32 ndx)
return (NULL);
if ((hashp->mapp[ndx] = (uint32 *)malloc((size_t)hashp->BSIZE)) == NULL)
return (NULL);
if (__get_page(hashp,
(char *)hashp->mapp[ndx], hashp->BITMAPS[ndx], 0, 1, 1)) {
if (dbm_get_page(hashp,
(char *)hashp->mapp[ndx], hashp->BITMAPS[ndx], 0, 1, 1)) {
free(hashp->mapp[ndx]);
hashp->mapp[ndx] = NULL; /* NEW: 9-11-95 */
return (NULL);
@ -1253,13 +1253,13 @@ print_chain(int addr)
short *bp, oaddr;
(void)fprintf(stderr, "%d ", addr);
bufp = __get_buf(hashp, addr, NULL, 0);
bufp = dbm_get_buf(hashp, addr, NULL, 0);
bp = (short *)bufp->page;
while (bp[0] && ((bp[bp[0]] == OVFLPAGE) ||
((bp[0] > 2) && bp[2] < REAL_KEY))) {
oaddr = bp[bp[0] - 1];
(void)fprintf(stderr, "%d ", (int)oaddr);
bufp = __get_buf(hashp, (int)oaddr, bufp, 0);
bufp = dbm_get_buf(hashp, (int)oaddr, bufp, 0);
bp = (short *)bufp->page;
}
(void)fprintf(stderr, "\n");

Просмотреть файл

@ -118,7 +118,7 @@ int hash_accesses, hash_collisions, hash_expansions, hash_overflows;
* This closes the file, flushing buffers as appropriate.
*/
static void
__remove_database(DB *dbp)
dbm_remove_database(DB *dbp)
{
HTAB *hashp = (HTAB *)dbp->internal;
@ -134,7 +134,7 @@ __remove_database(DB *dbp)
/* OPEN/CLOSE */
extern DB *
__hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dflags)
dbm_hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dflags)
{
HTAB *hashp = NULL;
struct stat statbuf;
@ -199,7 +199,7 @@ __hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dfl
if (info && info->hash)
hashp->hash = info->hash;
else
hashp->hash = __default_hash;
hashp->hash = dbm_default_hash;
hdrsize = read(hashp->fp, (char *)&hashp->hdr, sizeof(HASHHDR));
if (hdrsize == -1)
@ -243,9 +243,9 @@ __hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dfl
/* Initialize Buffer Manager */
if (info && info->cachesize)
__buf_init(hashp, (int32)info->cachesize);
dbm_buf_init(hashp, (int32)info->cachesize);
else
__buf_init(hashp, DEF_BUFSIZE);
dbm_buf_init(hashp, DEF_BUFSIZE);
hashp->new_file = new_table;
#ifdef macintosh
@ -331,7 +331,7 @@ init_hash(HTAB *hashp, const char *file, HASHINFO *info)
hashp->SSHIFT = DEF_SEGSIZE_SHIFT;
hashp->DSIZE = DEF_DIRSIZE;
hashp->FFACTOR = DEF_FFACTOR;
hashp->hash = __default_hash;
hashp->hash = dbm_default_hash;
memset(hashp->SPARES, 0, sizeof(hashp->SPARES));
memset(hashp->BITMAPS, 0, sizeof(hashp->BITMAPS));
@ -353,13 +353,13 @@ init_hash(HTAB *hashp, const char *file, HASHINFO *info)
if (hashp->BSIZE > MAX_BSIZE)
hashp->BSIZE = MAX_BSIZE;
#endif
hashp->BSHIFT = __log2((uint32)hashp->BSIZE);
hashp->BSHIFT = dbm_log2((uint32)hashp->BSIZE);
}
if (info) {
if (info->bsize) {
/* Round pagesize up to power of 2 */
hashp->BSHIFT = __log2(info->bsize);
hashp->BSHIFT = dbm_log2(info->bsize);
hashp->BSIZE = 1 << hashp->BSHIFT;
if (hashp->BSIZE > MAX_BSIZE) {
errno = EINVAL;
@ -406,7 +406,7 @@ init_htab(HTAB *hashp, int nelem)
*/
nelem = (nelem - 1) / hashp->FFACTOR + 1;
l2 = __log2((uint32)PR_MAX(nelem, 2));
l2 = dbm_log2((uint32)PR_MAX(nelem, 2));
nbuckets = 1 << l2;
hashp->SPARES[l2] = l2 + 1;
@ -415,7 +415,7 @@ init_htab(HTAB *hashp, int nelem)
hashp->LAST_FREED = 2;
/* First bitmap page is at: splitpoint l2 page offset 1 */
if (__ibitmap(hashp, (int)OADDR_OF(l2, 1), l2 + 1, 0))
if (dbm_ibitmap(hashp, (int)OADDR_OF(l2, 1), l2 + 1, 0))
return (-1);
hashp->MAX_BUCKET = hashp->LOW_MASK = nbuckets - 1;
@ -425,7 +425,7 @@ init_htab(HTAB *hashp, int nelem)
1;
nsegs = (nbuckets - 1) / hashp->SGSIZE + 1;
nsegs = 1 << __log2((uint32)nsegs);
nsegs = 1 << dbm_log2((uint32)nsegs);
if (nsegs > hashp->DSIZE)
hashp->DSIZE = nsegs;
@ -463,7 +463,7 @@ hdestroy(HTAB *hashp)
* Call on buffer manager to free buffers, and if required,
* write them to disk.
*/
if (__buf_free(hashp, 1, hashp->save_file))
if (dbm_buf_free(hashp, 1, hashp->save_file))
save_errno = errno;
if (hashp->dir) {
free(*hashp->dir); /* Free initial segments */
@ -585,7 +585,7 @@ hash_sync(const DB *dbp, uint flags)
if (!hashp->save_file)
return (0);
if (__buf_free(hashp, 0, 1) || flush_meta(hashp))
if (dbm_buf_free(hashp, 0, 1) || flush_meta(hashp))
return (DBM_ERROR);
#if defined(_WIN32) || defined(_WINDOWS)
if (hashp->updateEOF && hashp->filename && !hashp->is_temp) {
@ -635,8 +635,8 @@ flush_meta(HTAB *hashp)
}
for (i = 0; i < NCACHED; i++)
if (hashp->mapp[i])
if (__put_page(hashp, (char *)hashp->mapp[i],
hashp->BITMAPS[i], 0, 1))
if (dbm_put_page(hashp, (char *)hashp->mapp[i],
hashp->BITMAPS[i], 0, 1))
return (-1);
return (0);
}
@ -675,7 +675,7 @@ hash_get(
#if defined(unix) && defined(DEBUG)
printf("\n\nDBM Database has been corrupted, tell Lou...\n\n");
#endif
__remove_database((DB *)dbp);
dbm_remove_database((DB *)dbp);
}
return (rv);
@ -711,7 +711,7 @@ hash_put(
#if defined(unix) && defined(DEBUG)
printf("\n\nDBM Database has been corrupted, tell Lou...\n\n");
#endif
__remove_database((DB *)dbp);
dbm_remove_database((DB *)dbp);
}
return (rv);
@ -744,7 +744,7 @@ hash_delete(
#if defined(unix) && defined(DEBUG)
printf("\n\nDBM Database has been corrupted, tell Lou...\n\n");
#endif
__remove_database((DB *)dbp);
dbm_remove_database((DB *)dbp);
}
return (rv);
@ -777,7 +777,7 @@ hash_access(
off = hashp->BSIZE;
size = key->size;
kp = (char *)key->data;
rbufp = __get_buf(hashp, __call_hash(hashp, kp, size), NULL, 0);
rbufp = dbm_get_buf(hashp, dbm_call_hash(hashp, kp, size), NULL, 0);
if (!rbufp)
return (DATABASE_CORRUPTED_ERROR);
save_bufp = rbufp;
@ -805,7 +805,7 @@ hash_access(
last_overflow_page_no = *bp;
rbufp = __get_buf(hashp, *bp, rbufp, 0);
rbufp = dbm_get_buf(hashp, *bp, rbufp, 0);
if (!rbufp) {
save_bufp->flags &= ~BUF_PIN;
return (DBM_ERROR);
@ -822,17 +822,17 @@ hash_access(
off = hashp->BSIZE;
} else if (bp[1] < REAL_KEY) {
if ((ndx =
__find_bigpair(hashp, rbufp, ndx, kp, (int)size)) > 0)
dbm_find_bigpair(hashp, rbufp, ndx, kp, (int)size)) > 0)
goto found;
if (ndx == -2) {
bufp = rbufp;
if (!(pageno =
__find_last_page(hashp, &bufp))) {
dbm_find_last_page(hashp, &bufp))) {
ndx = 0;
rbufp = bufp;
break; /* FOR */
}
rbufp = __get_buf(hashp, pageno, bufp, 0);
rbufp = dbm_get_buf(hashp, pageno, bufp, 0);
if (!rbufp) {
save_bufp->flags &= ~BUF_PIN;
return (DBM_ERROR);
@ -853,7 +853,7 @@ hash_access(
switch (action) {
case HASH_PUT:
case HASH_PUTNEW:
if (__addel(hashp, rbufp, key, val)) {
if (dbm_addel(hashp, rbufp, key, val)) {
save_bufp->flags &= ~BUF_PIN;
return (DBM_ERROR);
} else {
@ -875,7 +875,7 @@ found:
case HASH_GET:
bp = (uint16 *)rbufp->page;
if (bp[ndx + 1] < REAL_KEY) {
if (__big_return(hashp, rbufp, ndx, val, 0))
if (dbm_big_return(hashp, rbufp, ndx, val, 0))
return (DBM_ERROR);
} else {
val->data = (uint8 *)rbufp->page + (int)bp[ndx + 1];
@ -883,14 +883,14 @@ found:
}
break;
case HASH_PUT:
if ((__delpair(hashp, rbufp, ndx)) ||
(__addel(hashp, rbufp, key, val))) {
if ((dbm_delpair(hashp, rbufp, ndx)) ||
(dbm_addel(hashp, rbufp, key, val))) {
save_bufp->flags &= ~BUF_PIN;
return (DBM_ERROR);
}
break;
case HASH_DELETE:
if (__delpair(hashp, rbufp, ndx))
if (dbm_delpair(hashp, rbufp, ndx))
return (DBM_ERROR);
break;
default:
@ -933,7 +933,7 @@ hash_seq(
for (bucket = hashp->cbucket;
bucket <= (uint32)hashp->MAX_BUCKET;
bucket++, hashp->cndx = 1) {
bufp = __get_buf(hashp, bucket, NULL, 0);
bufp = dbm_get_buf(hashp, bucket, NULL, 0);
if (!bufp)
return (DBM_ERROR);
hashp->cpage = bufp;
@ -955,7 +955,7 @@ hash_seq(
#endif
while (bp[hashp->cndx + 1] == OVFLPAGE) {
bufp = hashp->cpage =
__get_buf(hashp, bp[hashp->cndx], bufp, 0);
dbm_get_buf(hashp, bp[hashp->cndx], bufp, 0);
if (!bufp)
return (DBM_ERROR);
bp = (uint16 *)(bufp->page);
@ -968,7 +968,7 @@ hash_seq(
}
ndx = hashp->cndx;
if (bp[ndx + 1] < REAL_KEY) {
if (__big_keydata(hashp, bufp, key, data, 1))
if (dbm_big_keydata(hashp, bufp, key, data, 1))
return (DBM_ERROR);
} else {
key->data = (uint8 *)hashp->cpage->page + bp[ndx];
@ -994,7 +994,7 @@ hash_seq(
* -1 ==> Error
*/
extern int
__expand_table(HTAB *hashp)
dbm_expand_table(HTAB *hashp)
{
uint32 old_bucket, new_bucket;
int new_segnum, spare_ndx;
@ -1029,7 +1029,7 @@ __expand_table(HTAB *hashp)
* * increases), we need to copy the current contents of the spare
* split bucket to the next bucket.
*/
spare_ndx = __log2((uint32)(hashp->MAX_BUCKET + 1));
spare_ndx = dbm_log2((uint32)(hashp->MAX_BUCKET + 1));
if (spare_ndx > hashp->OVFL_POINT) {
hashp->SPARES[spare_ndx] = hashp->SPARES[hashp->OVFL_POINT];
hashp->OVFL_POINT = spare_ndx;
@ -1041,7 +1041,7 @@ __expand_table(HTAB *hashp)
hashp->HIGH_MASK = new_bucket | hashp->LOW_MASK;
}
/* Relocate records to the new bucket */
return (__split_page(hashp, old_bucket, new_bucket));
return (dbm_split_page(hashp, old_bucket, new_bucket));
}
/*
@ -1065,7 +1065,7 @@ hash_realloc(
}
extern uint32
__call_hash(HTAB *hashp, char *k, size_t len)
dbm_call_hash(HTAB *hashp, char *k, size_t len)
{
uint32 n, bucket;

Просмотреть файл

@ -104,7 +104,7 @@ static BUFHEAD *newbuf(HTAB *, uint32, BUFHEAD *);
* address you are seeking.
*/
extern BUFHEAD *
__get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage)
dbm_get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage)
/* If prev_bp set, indicates a new overflow page. */
{
register BUFHEAD *bp;
@ -124,7 +124,7 @@ __get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage)
/* Grab buffer out of directory */
segment_ndx = addr & (hashp->SGSIZE - 1);
/* valid segment ensured by __call_hash() */
/* valid segment ensured by dbm_call_hash() */
segp = hashp->dir[addr >> hashp->SSHIFT];
#ifdef DEBUG
assert(segp != NULL);
@ -140,7 +140,7 @@ __get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage)
bp = newbuf(hashp, addr, prev_bp);
if (!bp)
return (NULL);
if (__get_page(hashp, bp->page, addr, !prev_bp, is_disk, 0)) {
if (dbm_get_page(hashp, bp->page, addr, !prev_bp, is_disk, 0)) {
/* free bp and its page */
if (prev_bp) {
/* if prev_bp is set then the new page that
@ -242,8 +242,8 @@ newbuf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp)
}
oaddr = shortp[shortp[0] - 1];
}
if ((bp->flags & BUF_MOD) && __put_page(hashp, bp->page,
bp->addr, (int)IS_BUCKET(bp->flags), 0))
if ((bp->flags & BUF_MOD) && dbm_put_page(hashp, bp->page,
bp->addr, (int)IS_BUCKET(bp->flags), 0))
return (NULL);
/*
* Update the pointer to this page (i.e. invalidate it).
@ -298,8 +298,8 @@ newbuf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp)
/* set before __put_page */
oaddr = shortp[shortp[0] - 1];
}
if ((xbp->flags & BUF_MOD) && __put_page(hashp,
xbp->page, xbp->addr, 0, 0))
if ((xbp->flags & BUF_MOD) && dbm_put_page(hashp,
xbp->page, xbp->addr, 0, 0))
return (NULL);
xbp->addr = 0;
xbp->flags = 0;
@ -335,7 +335,7 @@ newbuf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp)
}
extern void
__buf_init(HTAB *hashp, int32 nbytes)
dbm_buf_init(HTAB *hashp, int32 nbytes)
{
BUFHEAD *bfp;
int npages;
@ -358,7 +358,7 @@ __buf_init(HTAB *hashp, int32 nbytes)
}
extern int
__buf_free(HTAB *hashp, int do_free, int to_disk)
dbm_buf_free(HTAB *hashp, int do_free, int to_disk)
{
BUFHEAD *bp;
int status = -1;
@ -370,8 +370,8 @@ __buf_free(HTAB *hashp, int do_free, int to_disk)
/* Check that the buffer is valid */
if (bp->addr || IS_BUCKET(bp->flags)) {
if (to_disk && (bp->flags & BUF_MOD) &&
(status = __put_page(hashp, bp->page,
bp->addr, IS_BUCKET(bp->flags), 0))) {
(status = dbm_put_page(hashp, bp->page,
bp->addr, IS_BUCKET(bp->flags), 0))) {
if (do_free) {
if (bp->page)
@ -397,7 +397,7 @@ __buf_free(HTAB *hashp, int do_free, int to_disk)
}
extern void
__reclaim_buf(HTAB *hashp, BUFHEAD *bp)
dbm_reclaim_buf(HTAB *hashp, BUFHEAD *bp)
{
bp->ovfl = 0;
bp->addr = 0;

Просмотреть файл

@ -457,6 +457,25 @@ smime_choose_cipher(CERTCertificate *scert, CERTCertificate **rcerts)
cipher_votes[strong_mapi] += pref;
pref--;
} else {
if (pklen_bits > 3072) {
/* While support for AES 256 is a SHOULD+ in RFC 5751
* rather than a MUST, RSA and DSA keys longer than 3072
* bits provide more than 128 bits of security strength.
* So, AES 256 should be used to provide comparable
* security. */
cipher_abilities[aes256_mapi]++;
cipher_votes[aes256_mapi] += pref;
pref--;
}
if (pklen_bits > 1023) {
/* RFC 5751 mandates support for AES 128, but also says
* that RSA and DSA signature keys SHOULD NOT be less than
* 1024 bits. So, cast vote for AES 128 if key length
* is at least 1024 bits. */
cipher_abilities[aes128_mapi]++;
cipher_votes[aes128_mapi] += pref;
pref--;
}
if (pklen_bits > 512) {
/* cast votes for the strong algorithm */
cipher_abilities[strong_mapi]++;

Просмотреть файл

@ -1573,6 +1573,13 @@ tls13_HandleClientHelloPart2(sslSocket *ss,
const sslNamedGroupDef *previousGroup = NULL;
PRBool hrr = PR_FALSE;
/* If the legacy_version field is set to 0x300 or smaller,
* reject the connection with protocol_version alert. */
if (ss->clientHelloVersion <= SSL_LIBRARY_VERSION_3_0) {
FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_CLIENT_HELLO, protocol_version);
goto loser;
}
ss->ssl3.hs.endOfFlight = PR_TRUE;
if (ssl3_ExtensionNegotiated(ss, ssl_tls13_early_data_xtn)) {

Просмотреть файл

@ -214,21 +214,12 @@ class commandsAction(argparse.Action):
print(c)
class wycheproofAction(argparse.Action):
tests = ['aes_gcm_test.json', 'chacha20_poly1305_test.json']
def __call__(self, parser, args, values, option_string=None):
self.update_tests()
generate_test_vectors()
clangFormat = cfAction(None, None, None)
clangFormat(None, args, None)
def update_tests(self):
remote = "https://raw.githubusercontent.com/google/wycheproof/master/testvectors/"
for test in self.tests:
subprocess.check_call(['wget', remote+test, '-O',
'gtests/common/wycheproof/testvectors/'+test,
'--no-check-certificate'])
def parse_arguments():
parser = argparse.ArgumentParser(

Просмотреть файл

@ -71,9 +71,7 @@
"name" : "test-tls13-legacy-version.py",
"arguments": [
"-p", "@PORT@"
],
"comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1490006",
"exp_pass": false
]
},
{
"name" : "test-tls13-nociphers.py",