file_path
stringlengths
19
75
code
stringlengths
279
1.37M
./openssl/crypto/camellia/cmll_cfb.c
/* * Copyright 2006-2020 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 */ /* * Camellia low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/camellia.h> #include <openssl/modes.h> /* * The input and output encrypted as though 128bit cfb mode is being used. * The extra state information to record how much of the 128bit block we have * used is contained in *num; */ void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc) { CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc, (block128_f) Camellia_encrypt); } /* N.B. This expects the input to be packed, MS bit first */ void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc) { CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc, (block128_f) Camellia_encrypt); } void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc) { CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, num, enc, (block128_f) Camellia_encrypt); }
./openssl/crypto/camellia/cmll_local.h
/* * Copyright 2006-2016 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 */ /* ==================================================================== * Copyright 2006 NTT (Nippon Telegraph and Telephone Corporation) . * ALL RIGHTS RESERVED. * * Intellectual Property information for Camellia: * http://info.isl.ntt.co.jp/crypt/eng/info/chiteki.html * * News Release for Announcement of Camellia open source: * http://www.ntt.co.jp/news/news06e/0604/060413a.html * * The Camellia Code included herein is developed by * NTT (Nippon Telegraph and Telephone Corporation), and is contributed * to the OpenSSL project. */ #ifndef OSSL_CRYPTO_CAMELLIA_CMLL_LOCAL_H # define OSSL_CRYPTO_CAMELLIA_CMLL_LOCAL_H typedef unsigned int u32; typedef unsigned char u8; int Camellia_Ekeygen(int keyBitLength, const u8 *rawKey, KEY_TABLE_TYPE keyTable); void Camellia_EncryptBlock_Rounds(int grandRounds, const u8 plaintext[], const KEY_TABLE_TYPE keyTable, u8 ciphertext[]); void Camellia_DecryptBlock_Rounds(int grandRounds, const u8 ciphertext[], const KEY_TABLE_TYPE keyTable, u8 plaintext[]); void Camellia_EncryptBlock(int keyBitLength, const u8 plaintext[], const KEY_TABLE_TYPE keyTable, u8 ciphertext[]); void Camellia_DecryptBlock(int keyBitLength, const u8 ciphertext[], const KEY_TABLE_TYPE keyTable, u8 plaintext[]); #endif /* #ifndef OSSL_CRYPTO_CAMELLIA_CMLL_LOCAL_H */
./openssl/crypto/camellia/cmll_ofb.c
/* * Copyright 2006-2020 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 */ /* * Camellia low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/camellia.h> #include <openssl/modes.h> /* * The input and output encrypted as though 128bit ofb mode is being used. * The extra state information to record how much of the 128bit block we have * used is contained in *num; */ void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num) { CRYPTO_ofb128_encrypt(in, out, length, key, ivec, num, (block128_f) Camellia_encrypt); }
./openssl/crypto/camellia/camellia.c
/* * Copyright 2006-2022 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 */ /* ==================================================================== * Copyright 2006 NTT (Nippon Telegraph and Telephone Corporation) . * ALL RIGHTS RESERVED. * * Intellectual Property information for Camellia: * http://info.isl.ntt.co.jp/crypt/eng/info/chiteki.html * * News Release for Announcement of Camellia open source: * http://www.ntt.co.jp/news/news06e/0604/060413a.html * * The Camellia Code included herein is developed by * NTT (Nippon Telegraph and Telephone Corporation), and is contributed * to the OpenSSL project. */ /* * Algorithm Specification * http://info.isl.ntt.co.jp/crypt/eng/camellia/specifications.html */ /* * This release balances code size and performance. In particular key * schedule setup is fully unrolled, because doing so *significantly* * reduces amount of instructions per setup round and code increase is * justifiable. In block functions on the other hand only inner loops * are unrolled, as full unroll gives only nominal performance boost, * while code size grows 4 or 7 times. Also, unlike previous versions * this one "encourages" compiler to keep intermediate variables in * registers, which should give better "all round" results, in other * words reasonable performance even with not so modern compilers. */ /* * Camellia low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/camellia.h> #include "cmll_local.h" #include <string.h> #include <stdlib.h> #define RightRotate(x, s) ( ((x) >> (s)) + ((x) << (32 - s)) ) #define LeftRotate(x, s) ( ((x) << (s)) + ((x) >> (32 - s)) ) #define GETU32(p) (((u32)(p)[0] << 24) ^ ((u32)(p)[1] << 16) ^ ((u32)(p)[2] << 8) ^ ((u32)(p)[3])) #define PUTU32(p,v) ((p)[0] = (u8)((v) >> 24), (p)[1] = (u8)((v) >> 16), (p)[2] = (u8)((v) >> 8), (p)[3] = (u8)(v)) /* S-box data */ #define SBOX1_1110 Camellia_SBOX[0] #define SBOX4_4404 Camellia_SBOX[1] #define SBOX2_0222 Camellia_SBOX[2] #define SBOX3_3033 Camellia_SBOX[3] static const u32 Camellia_SBOX[][256] = { {0x70707000, 0x82828200, 0x2c2c2c00, 0xececec00, 0xb3b3b300, 0x27272700, 0xc0c0c000, 0xe5e5e500, 0xe4e4e400, 0x85858500, 0x57575700, 0x35353500, 0xeaeaea00, 0x0c0c0c00, 0xaeaeae00, 0x41414100, 0x23232300, 0xefefef00, 0x6b6b6b00, 0x93939300, 0x45454500, 0x19191900, 0xa5a5a500, 0x21212100, 0xededed00, 0x0e0e0e00, 0x4f4f4f00, 0x4e4e4e00, 0x1d1d1d00, 0x65656500, 0x92929200, 0xbdbdbd00, 0x86868600, 0xb8b8b800, 0xafafaf00, 0x8f8f8f00, 0x7c7c7c00, 0xebebeb00, 0x1f1f1f00, 0xcecece00, 0x3e3e3e00, 0x30303000, 0xdcdcdc00, 0x5f5f5f00, 0x5e5e5e00, 0xc5c5c500, 0x0b0b0b00, 0x1a1a1a00, 0xa6a6a600, 0xe1e1e100, 0x39393900, 0xcacaca00, 0xd5d5d500, 0x47474700, 0x5d5d5d00, 0x3d3d3d00, 0xd9d9d900, 0x01010100, 0x5a5a5a00, 0xd6d6d600, 0x51515100, 0x56565600, 0x6c6c6c00, 0x4d4d4d00, 0x8b8b8b00, 0x0d0d0d00, 0x9a9a9a00, 0x66666600, 0xfbfbfb00, 0xcccccc00, 0xb0b0b000, 0x2d2d2d00, 0x74747400, 0x12121200, 0x2b2b2b00, 0x20202000, 0xf0f0f000, 0xb1b1b100, 0x84848400, 0x99999900, 0xdfdfdf00, 0x4c4c4c00, 0xcbcbcb00, 0xc2c2c200, 0x34343400, 0x7e7e7e00, 0x76767600, 0x05050500, 0x6d6d6d00, 0xb7b7b700, 0xa9a9a900, 0x31313100, 0xd1d1d100, 0x17171700, 0x04040400, 0xd7d7d700, 0x14141400, 0x58585800, 0x3a3a3a00, 0x61616100, 0xdedede00, 0x1b1b1b00, 0x11111100, 0x1c1c1c00, 0x32323200, 0x0f0f0f00, 0x9c9c9c00, 0x16161600, 0x53535300, 0x18181800, 0xf2f2f200, 0x22222200, 0xfefefe00, 0x44444400, 0xcfcfcf00, 0xb2b2b200, 0xc3c3c300, 0xb5b5b500, 0x7a7a7a00, 0x91919100, 0x24242400, 0x08080800, 0xe8e8e800, 0xa8a8a800, 0x60606000, 0xfcfcfc00, 0x69696900, 0x50505000, 0xaaaaaa00, 0xd0d0d000, 0xa0a0a000, 0x7d7d7d00, 0xa1a1a100, 0x89898900, 0x62626200, 0x97979700, 0x54545400, 0x5b5b5b00, 0x1e1e1e00, 0x95959500, 0xe0e0e000, 0xffffff00, 0x64646400, 0xd2d2d200, 0x10101000, 0xc4c4c400, 0x00000000, 0x48484800, 0xa3a3a300, 0xf7f7f700, 0x75757500, 0xdbdbdb00, 0x8a8a8a00, 0x03030300, 0xe6e6e600, 0xdadada00, 0x09090900, 0x3f3f3f00, 0xdddddd00, 0x94949400, 0x87878700, 0x5c5c5c00, 0x83838300, 0x02020200, 0xcdcdcd00, 0x4a4a4a00, 0x90909000, 0x33333300, 0x73737300, 0x67676700, 0xf6f6f600, 0xf3f3f300, 0x9d9d9d00, 0x7f7f7f00, 0xbfbfbf00, 0xe2e2e200, 0x52525200, 0x9b9b9b00, 0xd8d8d800, 0x26262600, 0xc8c8c800, 0x37373700, 0xc6c6c600, 0x3b3b3b00, 0x81818100, 0x96969600, 0x6f6f6f00, 0x4b4b4b00, 0x13131300, 0xbebebe00, 0x63636300, 0x2e2e2e00, 0xe9e9e900, 0x79797900, 0xa7a7a700, 0x8c8c8c00, 0x9f9f9f00, 0x6e6e6e00, 0xbcbcbc00, 0x8e8e8e00, 0x29292900, 0xf5f5f500, 0xf9f9f900, 0xb6b6b600, 0x2f2f2f00, 0xfdfdfd00, 0xb4b4b400, 0x59595900, 0x78787800, 0x98989800, 0x06060600, 0x6a6a6a00, 0xe7e7e700, 0x46464600, 0x71717100, 0xbababa00, 0xd4d4d400, 0x25252500, 0xababab00, 0x42424200, 0x88888800, 0xa2a2a200, 0x8d8d8d00, 0xfafafa00, 0x72727200, 0x07070700, 0xb9b9b900, 0x55555500, 0xf8f8f800, 0xeeeeee00, 0xacacac00, 0x0a0a0a00, 0x36363600, 0x49494900, 0x2a2a2a00, 0x68686800, 0x3c3c3c00, 0x38383800, 0xf1f1f100, 0xa4a4a400, 0x40404000, 0x28282800, 0xd3d3d300, 0x7b7b7b00, 0xbbbbbb00, 0xc9c9c900, 0x43434300, 0xc1c1c100, 0x15151500, 0xe3e3e300, 0xadadad00, 0xf4f4f400, 0x77777700, 0xc7c7c700, 0x80808000, 0x9e9e9e00}, {0x70700070, 0x2c2c002c, 0xb3b300b3, 0xc0c000c0, 0xe4e400e4, 0x57570057, 0xeaea00ea, 0xaeae00ae, 0x23230023, 0x6b6b006b, 0x45450045, 0xa5a500a5, 0xeded00ed, 0x4f4f004f, 0x1d1d001d, 0x92920092, 0x86860086, 0xafaf00af, 0x7c7c007c, 0x1f1f001f, 0x3e3e003e, 0xdcdc00dc, 0x5e5e005e, 0x0b0b000b, 0xa6a600a6, 0x39390039, 0xd5d500d5, 0x5d5d005d, 0xd9d900d9, 0x5a5a005a, 0x51510051, 0x6c6c006c, 0x8b8b008b, 0x9a9a009a, 0xfbfb00fb, 0xb0b000b0, 0x74740074, 0x2b2b002b, 0xf0f000f0, 0x84840084, 0xdfdf00df, 0xcbcb00cb, 0x34340034, 0x76760076, 0x6d6d006d, 0xa9a900a9, 0xd1d100d1, 0x04040004, 0x14140014, 0x3a3a003a, 0xdede00de, 0x11110011, 0x32320032, 0x9c9c009c, 0x53530053, 0xf2f200f2, 0xfefe00fe, 0xcfcf00cf, 0xc3c300c3, 0x7a7a007a, 0x24240024, 0xe8e800e8, 0x60600060, 0x69690069, 0xaaaa00aa, 0xa0a000a0, 0xa1a100a1, 0x62620062, 0x54540054, 0x1e1e001e, 0xe0e000e0, 0x64640064, 0x10100010, 0x00000000, 0xa3a300a3, 0x75750075, 0x8a8a008a, 0xe6e600e6, 0x09090009, 0xdddd00dd, 0x87870087, 0x83830083, 0xcdcd00cd, 0x90900090, 0x73730073, 0xf6f600f6, 0x9d9d009d, 0xbfbf00bf, 0x52520052, 0xd8d800d8, 0xc8c800c8, 0xc6c600c6, 0x81810081, 0x6f6f006f, 0x13130013, 0x63630063, 0xe9e900e9, 0xa7a700a7, 0x9f9f009f, 0xbcbc00bc, 0x29290029, 0xf9f900f9, 0x2f2f002f, 0xb4b400b4, 0x78780078, 0x06060006, 0xe7e700e7, 0x71710071, 0xd4d400d4, 0xabab00ab, 0x88880088, 0x8d8d008d, 0x72720072, 0xb9b900b9, 0xf8f800f8, 0xacac00ac, 0x36360036, 0x2a2a002a, 0x3c3c003c, 0xf1f100f1, 0x40400040, 0xd3d300d3, 0xbbbb00bb, 0x43430043, 0x15150015, 0xadad00ad, 0x77770077, 0x80800080, 0x82820082, 0xecec00ec, 0x27270027, 0xe5e500e5, 0x85850085, 0x35350035, 0x0c0c000c, 0x41410041, 0xefef00ef, 0x93930093, 0x19190019, 0x21210021, 0x0e0e000e, 0x4e4e004e, 0x65650065, 0xbdbd00bd, 0xb8b800b8, 0x8f8f008f, 0xebeb00eb, 0xcece00ce, 0x30300030, 0x5f5f005f, 0xc5c500c5, 0x1a1a001a, 0xe1e100e1, 0xcaca00ca, 0x47470047, 0x3d3d003d, 0x01010001, 0xd6d600d6, 0x56560056, 0x4d4d004d, 0x0d0d000d, 0x66660066, 0xcccc00cc, 0x2d2d002d, 0x12120012, 0x20200020, 0xb1b100b1, 0x99990099, 0x4c4c004c, 0xc2c200c2, 0x7e7e007e, 0x05050005, 0xb7b700b7, 0x31310031, 0x17170017, 0xd7d700d7, 0x58580058, 0x61610061, 0x1b1b001b, 0x1c1c001c, 0x0f0f000f, 0x16160016, 0x18180018, 0x22220022, 0x44440044, 0xb2b200b2, 0xb5b500b5, 0x91910091, 0x08080008, 0xa8a800a8, 0xfcfc00fc, 0x50500050, 0xd0d000d0, 0x7d7d007d, 0x89890089, 0x97970097, 0x5b5b005b, 0x95950095, 0xffff00ff, 0xd2d200d2, 0xc4c400c4, 0x48480048, 0xf7f700f7, 0xdbdb00db, 0x03030003, 0xdada00da, 0x3f3f003f, 0x94940094, 0x5c5c005c, 0x02020002, 0x4a4a004a, 0x33330033, 0x67670067, 0xf3f300f3, 0x7f7f007f, 0xe2e200e2, 0x9b9b009b, 0x26260026, 0x37370037, 0x3b3b003b, 0x96960096, 0x4b4b004b, 0xbebe00be, 0x2e2e002e, 0x79790079, 0x8c8c008c, 0x6e6e006e, 0x8e8e008e, 0xf5f500f5, 0xb6b600b6, 0xfdfd00fd, 0x59590059, 0x98980098, 0x6a6a006a, 0x46460046, 0xbaba00ba, 0x25250025, 0x42420042, 0xa2a200a2, 0xfafa00fa, 0x07070007, 0x55550055, 0xeeee00ee, 0x0a0a000a, 0x49490049, 0x68680068, 0x38380038, 0xa4a400a4, 0x28280028, 0x7b7b007b, 0xc9c900c9, 0xc1c100c1, 0xe3e300e3, 0xf4f400f4, 0xc7c700c7, 0x9e9e009e}, {0x00e0e0e0, 0x00050505, 0x00585858, 0x00d9d9d9, 0x00676767, 0x004e4e4e, 0x00818181, 0x00cbcbcb, 0x00c9c9c9, 0x000b0b0b, 0x00aeaeae, 0x006a6a6a, 0x00d5d5d5, 0x00181818, 0x005d5d5d, 0x00828282, 0x00464646, 0x00dfdfdf, 0x00d6d6d6, 0x00272727, 0x008a8a8a, 0x00323232, 0x004b4b4b, 0x00424242, 0x00dbdbdb, 0x001c1c1c, 0x009e9e9e, 0x009c9c9c, 0x003a3a3a, 0x00cacaca, 0x00252525, 0x007b7b7b, 0x000d0d0d, 0x00717171, 0x005f5f5f, 0x001f1f1f, 0x00f8f8f8, 0x00d7d7d7, 0x003e3e3e, 0x009d9d9d, 0x007c7c7c, 0x00606060, 0x00b9b9b9, 0x00bebebe, 0x00bcbcbc, 0x008b8b8b, 0x00161616, 0x00343434, 0x004d4d4d, 0x00c3c3c3, 0x00727272, 0x00959595, 0x00ababab, 0x008e8e8e, 0x00bababa, 0x007a7a7a, 0x00b3b3b3, 0x00020202, 0x00b4b4b4, 0x00adadad, 0x00a2a2a2, 0x00acacac, 0x00d8d8d8, 0x009a9a9a, 0x00171717, 0x001a1a1a, 0x00353535, 0x00cccccc, 0x00f7f7f7, 0x00999999, 0x00616161, 0x005a5a5a, 0x00e8e8e8, 0x00242424, 0x00565656, 0x00404040, 0x00e1e1e1, 0x00636363, 0x00090909, 0x00333333, 0x00bfbfbf, 0x00989898, 0x00979797, 0x00858585, 0x00686868, 0x00fcfcfc, 0x00ececec, 0x000a0a0a, 0x00dadada, 0x006f6f6f, 0x00535353, 0x00626262, 0x00a3a3a3, 0x002e2e2e, 0x00080808, 0x00afafaf, 0x00282828, 0x00b0b0b0, 0x00747474, 0x00c2c2c2, 0x00bdbdbd, 0x00363636, 0x00222222, 0x00383838, 0x00646464, 0x001e1e1e, 0x00393939, 0x002c2c2c, 0x00a6a6a6, 0x00303030, 0x00e5e5e5, 0x00444444, 0x00fdfdfd, 0x00888888, 0x009f9f9f, 0x00656565, 0x00878787, 0x006b6b6b, 0x00f4f4f4, 0x00232323, 0x00484848, 0x00101010, 0x00d1d1d1, 0x00515151, 0x00c0c0c0, 0x00f9f9f9, 0x00d2d2d2, 0x00a0a0a0, 0x00555555, 0x00a1a1a1, 0x00414141, 0x00fafafa, 0x00434343, 0x00131313, 0x00c4c4c4, 0x002f2f2f, 0x00a8a8a8, 0x00b6b6b6, 0x003c3c3c, 0x002b2b2b, 0x00c1c1c1, 0x00ffffff, 0x00c8c8c8, 0x00a5a5a5, 0x00202020, 0x00898989, 0x00000000, 0x00909090, 0x00474747, 0x00efefef, 0x00eaeaea, 0x00b7b7b7, 0x00151515, 0x00060606, 0x00cdcdcd, 0x00b5b5b5, 0x00121212, 0x007e7e7e, 0x00bbbbbb, 0x00292929, 0x000f0f0f, 0x00b8b8b8, 0x00070707, 0x00040404, 0x009b9b9b, 0x00949494, 0x00212121, 0x00666666, 0x00e6e6e6, 0x00cecece, 0x00ededed, 0x00e7e7e7, 0x003b3b3b, 0x00fefefe, 0x007f7f7f, 0x00c5c5c5, 0x00a4a4a4, 0x00373737, 0x00b1b1b1, 0x004c4c4c, 0x00919191, 0x006e6e6e, 0x008d8d8d, 0x00767676, 0x00030303, 0x002d2d2d, 0x00dedede, 0x00969696, 0x00262626, 0x007d7d7d, 0x00c6c6c6, 0x005c5c5c, 0x00d3d3d3, 0x00f2f2f2, 0x004f4f4f, 0x00191919, 0x003f3f3f, 0x00dcdcdc, 0x00797979, 0x001d1d1d, 0x00525252, 0x00ebebeb, 0x00f3f3f3, 0x006d6d6d, 0x005e5e5e, 0x00fbfbfb, 0x00696969, 0x00b2b2b2, 0x00f0f0f0, 0x00313131, 0x000c0c0c, 0x00d4d4d4, 0x00cfcfcf, 0x008c8c8c, 0x00e2e2e2, 0x00757575, 0x00a9a9a9, 0x004a4a4a, 0x00575757, 0x00848484, 0x00111111, 0x00454545, 0x001b1b1b, 0x00f5f5f5, 0x00e4e4e4, 0x000e0e0e, 0x00737373, 0x00aaaaaa, 0x00f1f1f1, 0x00dddddd, 0x00595959, 0x00141414, 0x006c6c6c, 0x00929292, 0x00545454, 0x00d0d0d0, 0x00787878, 0x00707070, 0x00e3e3e3, 0x00494949, 0x00808080, 0x00505050, 0x00a7a7a7, 0x00f6f6f6, 0x00777777, 0x00939393, 0x00868686, 0x00838383, 0x002a2a2a, 0x00c7c7c7, 0x005b5b5b, 0x00e9e9e9, 0x00eeeeee, 0x008f8f8f, 0x00010101, 0x003d3d3d}, {0x38003838, 0x41004141, 0x16001616, 0x76007676, 0xd900d9d9, 0x93009393, 0x60006060, 0xf200f2f2, 0x72007272, 0xc200c2c2, 0xab00abab, 0x9a009a9a, 0x75007575, 0x06000606, 0x57005757, 0xa000a0a0, 0x91009191, 0xf700f7f7, 0xb500b5b5, 0xc900c9c9, 0xa200a2a2, 0x8c008c8c, 0xd200d2d2, 0x90009090, 0xf600f6f6, 0x07000707, 0xa700a7a7, 0x27002727, 0x8e008e8e, 0xb200b2b2, 0x49004949, 0xde00dede, 0x43004343, 0x5c005c5c, 0xd700d7d7, 0xc700c7c7, 0x3e003e3e, 0xf500f5f5, 0x8f008f8f, 0x67006767, 0x1f001f1f, 0x18001818, 0x6e006e6e, 0xaf00afaf, 0x2f002f2f, 0xe200e2e2, 0x85008585, 0x0d000d0d, 0x53005353, 0xf000f0f0, 0x9c009c9c, 0x65006565, 0xea00eaea, 0xa300a3a3, 0xae00aeae, 0x9e009e9e, 0xec00ecec, 0x80008080, 0x2d002d2d, 0x6b006b6b, 0xa800a8a8, 0x2b002b2b, 0x36003636, 0xa600a6a6, 0xc500c5c5, 0x86008686, 0x4d004d4d, 0x33003333, 0xfd00fdfd, 0x66006666, 0x58005858, 0x96009696, 0x3a003a3a, 0x09000909, 0x95009595, 0x10001010, 0x78007878, 0xd800d8d8, 0x42004242, 0xcc00cccc, 0xef00efef, 0x26002626, 0xe500e5e5, 0x61006161, 0x1a001a1a, 0x3f003f3f, 0x3b003b3b, 0x82008282, 0xb600b6b6, 0xdb00dbdb, 0xd400d4d4, 0x98009898, 0xe800e8e8, 0x8b008b8b, 0x02000202, 0xeb00ebeb, 0x0a000a0a, 0x2c002c2c, 0x1d001d1d, 0xb000b0b0, 0x6f006f6f, 0x8d008d8d, 0x88008888, 0x0e000e0e, 0x19001919, 0x87008787, 0x4e004e4e, 0x0b000b0b, 0xa900a9a9, 0x0c000c0c, 0x79007979, 0x11001111, 0x7f007f7f, 0x22002222, 0xe700e7e7, 0x59005959, 0xe100e1e1, 0xda00dada, 0x3d003d3d, 0xc800c8c8, 0x12001212, 0x04000404, 0x74007474, 0x54005454, 0x30003030, 0x7e007e7e, 0xb400b4b4, 0x28002828, 0x55005555, 0x68006868, 0x50005050, 0xbe00bebe, 0xd000d0d0, 0xc400c4c4, 0x31003131, 0xcb00cbcb, 0x2a002a2a, 0xad00adad, 0x0f000f0f, 0xca00caca, 0x70007070, 0xff00ffff, 0x32003232, 0x69006969, 0x08000808, 0x62006262, 0x00000000, 0x24002424, 0xd100d1d1, 0xfb00fbfb, 0xba00baba, 0xed00eded, 0x45004545, 0x81008181, 0x73007373, 0x6d006d6d, 0x84008484, 0x9f009f9f, 0xee00eeee, 0x4a004a4a, 0xc300c3c3, 0x2e002e2e, 0xc100c1c1, 0x01000101, 0xe600e6e6, 0x25002525, 0x48004848, 0x99009999, 0xb900b9b9, 0xb300b3b3, 0x7b007b7b, 0xf900f9f9, 0xce00cece, 0xbf00bfbf, 0xdf00dfdf, 0x71007171, 0x29002929, 0xcd00cdcd, 0x6c006c6c, 0x13001313, 0x64006464, 0x9b009b9b, 0x63006363, 0x9d009d9d, 0xc000c0c0, 0x4b004b4b, 0xb700b7b7, 0xa500a5a5, 0x89008989, 0x5f005f5f, 0xb100b1b1, 0x17001717, 0xf400f4f4, 0xbc00bcbc, 0xd300d3d3, 0x46004646, 0xcf00cfcf, 0x37003737, 0x5e005e5e, 0x47004747, 0x94009494, 0xfa00fafa, 0xfc00fcfc, 0x5b005b5b, 0x97009797, 0xfe00fefe, 0x5a005a5a, 0xac00acac, 0x3c003c3c, 0x4c004c4c, 0x03000303, 0x35003535, 0xf300f3f3, 0x23002323, 0xb800b8b8, 0x5d005d5d, 0x6a006a6a, 0x92009292, 0xd500d5d5, 0x21002121, 0x44004444, 0x51005151, 0xc600c6c6, 0x7d007d7d, 0x39003939, 0x83008383, 0xdc00dcdc, 0xaa00aaaa, 0x7c007c7c, 0x77007777, 0x56005656, 0x05000505, 0x1b001b1b, 0xa400a4a4, 0x15001515, 0x34003434, 0x1e001e1e, 0x1c001c1c, 0xf800f8f8, 0x52005252, 0x20002020, 0x14001414, 0xe900e9e9, 0xbd00bdbd, 0xdd00dddd, 0xe400e4e4, 0xa100a1a1, 0xe000e0e0, 0x8a008a8a, 0xf100f1f1, 0xd600d6d6, 0x7a007a7a, 0xbb00bbbb, 0xe300e3e3, 0x40004040, 0x4f004f4f} }; /* Key generation constants */ static const u32 SIGMA[] = { 0xa09e667f, 0x3bcc908b, 0xb67ae858, 0x4caa73b2, 0xc6ef372f, 0xe94f82be, 0x54ff53a5, 0xf1d36f1c, 0x10e527fa, 0xde682d1d, 0xb05688c2, 0xb3e6c1fd }; /* The phi algorithm given in C.2.7 of the Camellia spec document. */ /* * This version does not attempt to minimize amount of temporary * variables, but instead explicitly exposes algorithm's parallelism. * It is therefore most appropriate for platforms with not less than * ~16 registers. For platforms with less registers [well, x86 to be * specific] assembler version should be/is provided anyway... */ #define Camellia_Feistel(_s0,_s1,_s2,_s3,_key) do {\ register u32 _t0,_t1,_t2,_t3;\ \ _t0 = _s0 ^ (_key)[0];\ _t3 = SBOX4_4404[_t0&0xff];\ _t1 = _s1 ^ (_key)[1];\ _t3 ^= SBOX3_3033[(_t0 >> 8)&0xff];\ _t2 = SBOX1_1110[_t1&0xff];\ _t3 ^= SBOX2_0222[(_t0 >> 16)&0xff];\ _t2 ^= SBOX4_4404[(_t1 >> 8)&0xff];\ _t3 ^= SBOX1_1110[(_t0 >> 24)];\ _t2 ^= _t3;\ _t3 = RightRotate(_t3,8);\ _t2 ^= SBOX3_3033[(_t1 >> 16)&0xff];\ _s3 ^= _t3;\ _t2 ^= SBOX2_0222[(_t1 >> 24)];\ _s2 ^= _t2; \ _s3 ^= _t2;\ } while(0) /* * Note that n has to be less than 32. Rotations for larger amount * of bits are achieved by "rotating" order of s-elements and * adjusting n accordingly, e.g. RotLeft128(s1,s2,s3,s0,n-32). */ #define RotLeft128(_s0,_s1,_s2,_s3,_n) do {\ u32 _t0=_s0>>(32-_n);\ _s0 = (_s0<<_n) | (_s1>>(32-_n));\ _s1 = (_s1<<_n) | (_s2>>(32-_n));\ _s2 = (_s2<<_n) | (_s3>>(32-_n));\ _s3 = (_s3<<_n) | _t0;\ } while (0) int Camellia_Ekeygen(int keyBitLength, const u8 *rawKey, KEY_TABLE_TYPE k) { register u32 s0, s1, s2, s3; k[0] = s0 = GETU32(rawKey); k[1] = s1 = GETU32(rawKey + 4); k[2] = s2 = GETU32(rawKey + 8); k[3] = s3 = GETU32(rawKey + 12); if (keyBitLength != 128) { k[8] = s0 = GETU32(rawKey + 16); k[9] = s1 = GETU32(rawKey + 20); if (keyBitLength == 192) { k[10] = s2 = ~s0; k[11] = s3 = ~s1; } else { k[10] = s2 = GETU32(rawKey + 24); k[11] = s3 = GETU32(rawKey + 28); } s0 ^= k[0], s1 ^= k[1], s2 ^= k[2], s3 ^= k[3]; } /* Use the Feistel routine to scramble the key material */ Camellia_Feistel(s0, s1, s2, s3, SIGMA + 0); Camellia_Feistel(s2, s3, s0, s1, SIGMA + 2); s0 ^= k[0], s1 ^= k[1], s2 ^= k[2], s3 ^= k[3]; Camellia_Feistel(s0, s1, s2, s3, SIGMA + 4); Camellia_Feistel(s2, s3, s0, s1, SIGMA + 6); /* Fill the keyTable. Requires many block rotations. */ if (keyBitLength == 128) { k[4] = s0, k[5] = s1, k[6] = s2, k[7] = s3; RotLeft128(s0, s1, s2, s3, 15); /* KA <<< 15 */ k[12] = s0, k[13] = s1, k[14] = s2, k[15] = s3; RotLeft128(s0, s1, s2, s3, 15); /* KA <<< 30 */ k[16] = s0, k[17] = s1, k[18] = s2, k[19] = s3; RotLeft128(s0, s1, s2, s3, 15); /* KA <<< 45 */ k[24] = s0, k[25] = s1; RotLeft128(s0, s1, s2, s3, 15); /* KA <<< 60 */ k[28] = s0, k[29] = s1, k[30] = s2, k[31] = s3; RotLeft128(s1, s2, s3, s0, 2); /* KA <<< 94 */ k[40] = s1, k[41] = s2, k[42] = s3, k[43] = s0; RotLeft128(s1, s2, s3, s0, 17); /* KA <<<111 */ k[48] = s1, k[49] = s2, k[50] = s3, k[51] = s0; s0 = k[0], s1 = k[1], s2 = k[2], s3 = k[3]; RotLeft128(s0, s1, s2, s3, 15); /* KL <<< 15 */ k[8] = s0, k[9] = s1, k[10] = s2, k[11] = s3; RotLeft128(s0, s1, s2, s3, 30); /* KL <<< 45 */ k[20] = s0, k[21] = s1, k[22] = s2, k[23] = s3; RotLeft128(s0, s1, s2, s3, 15); /* KL <<< 60 */ k[26] = s2, k[27] = s3; RotLeft128(s0, s1, s2, s3, 17); /* KL <<< 77 */ k[32] = s0, k[33] = s1, k[34] = s2, k[35] = s3; RotLeft128(s0, s1, s2, s3, 17); /* KL <<< 94 */ k[36] = s0, k[37] = s1, k[38] = s2, k[39] = s3; RotLeft128(s0, s1, s2, s3, 17); /* KL <<<111 */ k[44] = s0, k[45] = s1, k[46] = s2, k[47] = s3; return 3; /* grand rounds */ } else { k[12] = s0, k[13] = s1, k[14] = s2, k[15] = s3; s0 ^= k[8], s1 ^= k[9], s2 ^= k[10], s3 ^= k[11]; Camellia_Feistel(s0, s1, s2, s3, (SIGMA + 8)); Camellia_Feistel(s2, s3, s0, s1, (SIGMA + 10)); k[4] = s0, k[5] = s1, k[6] = s2, k[7] = s3; RotLeft128(s0, s1, s2, s3, 30); /* KB <<< 30 */ k[20] = s0, k[21] = s1, k[22] = s2, k[23] = s3; RotLeft128(s0, s1, s2, s3, 30); /* KB <<< 60 */ k[40] = s0, k[41] = s1, k[42] = s2, k[43] = s3; RotLeft128(s1, s2, s3, s0, 19); /* KB <<<111 */ k[64] = s1, k[65] = s2, k[66] = s3, k[67] = s0; s0 = k[8], s1 = k[9], s2 = k[10], s3 = k[11]; RotLeft128(s0, s1, s2, s3, 15); /* KR <<< 15 */ k[8] = s0, k[9] = s1, k[10] = s2, k[11] = s3; RotLeft128(s0, s1, s2, s3, 15); /* KR <<< 30 */ k[16] = s0, k[17] = s1, k[18] = s2, k[19] = s3; RotLeft128(s0, s1, s2, s3, 30); /* KR <<< 60 */ k[36] = s0, k[37] = s1, k[38] = s2, k[39] = s3; RotLeft128(s1, s2, s3, s0, 2); /* KR <<< 94 */ k[52] = s1, k[53] = s2, k[54] = s3, k[55] = s0; s0 = k[12], s1 = k[13], s2 = k[14], s3 = k[15]; RotLeft128(s0, s1, s2, s3, 15); /* KA <<< 15 */ k[12] = s0, k[13] = s1, k[14] = s2, k[15] = s3; RotLeft128(s0, s1, s2, s3, 30); /* KA <<< 45 */ k[28] = s0, k[29] = s1, k[30] = s2, k[31] = s3; /* KA <<< 77 */ k[48] = s1, k[49] = s2, k[50] = s3, k[51] = s0; RotLeft128(s1, s2, s3, s0, 17); /* KA <<< 94 */ k[56] = s1, k[57] = s2, k[58] = s3, k[59] = s0; s0 = k[0], s1 = k[1], s2 = k[2], s3 = k[3]; RotLeft128(s1, s2, s3, s0, 13); /* KL <<< 45 */ k[24] = s1, k[25] = s2, k[26] = s3, k[27] = s0; RotLeft128(s1, s2, s3, s0, 15); /* KL <<< 60 */ k[32] = s1, k[33] = s2, k[34] = s3, k[35] = s0; RotLeft128(s1, s2, s3, s0, 17); /* KL <<< 77 */ k[44] = s1, k[45] = s2, k[46] = s3, k[47] = s0; RotLeft128(s2, s3, s0, s1, 2); /* KL <<<111 */ k[60] = s2, k[61] = s3, k[62] = s0, k[63] = s1; return 4; /* grand rounds */ } /* * It is possible to perform certain precalculations, which * would spare few cycles in block procedure. It's not done, * because it upsets the performance balance between key * setup and block procedures, negatively affecting overall * throughput in applications operating on short messages * and volatile keys. */ } void Camellia_EncryptBlock_Rounds(int grandRounds, const u8 plaintext[], const KEY_TABLE_TYPE keyTable, u8 ciphertext[]) { register u32 s0, s1, s2, s3; const u32 *k = keyTable, *kend = keyTable + grandRounds * 16; s0 = GETU32(plaintext) ^ k[0]; s1 = GETU32(plaintext + 4) ^ k[1]; s2 = GETU32(plaintext + 8) ^ k[2]; s3 = GETU32(plaintext + 12) ^ k[3]; k += 4; while (1) { /* Camellia makes 6 Feistel rounds */ Camellia_Feistel(s0, s1, s2, s3, k + 0); Camellia_Feistel(s2, s3, s0, s1, k + 2); Camellia_Feistel(s0, s1, s2, s3, k + 4); Camellia_Feistel(s2, s3, s0, s1, k + 6); Camellia_Feistel(s0, s1, s2, s3, k + 8); Camellia_Feistel(s2, s3, s0, s1, k + 10); k += 12; if (k == kend) break; /* * This is the same function as the diffusion function D of the * accompanying documentation. See section 3.2 for properties of the * FLlayer function. */ s1 ^= LeftRotate(s0 & k[0], 1); s2 ^= s3 | k[3]; s0 ^= s1 | k[1]; s3 ^= LeftRotate(s2 & k[2], 1); k += 4; } s2 ^= k[0], s3 ^= k[1], s0 ^= k[2], s1 ^= k[3]; PUTU32(ciphertext, s2); PUTU32(ciphertext + 4, s3); PUTU32(ciphertext + 8, s0); PUTU32(ciphertext + 12, s1); } void Camellia_EncryptBlock(int keyBitLength, const u8 plaintext[], const KEY_TABLE_TYPE keyTable, u8 ciphertext[]) { Camellia_EncryptBlock_Rounds(keyBitLength == 128 ? 3 : 4, plaintext, keyTable, ciphertext); } void Camellia_DecryptBlock_Rounds(int grandRounds, const u8 ciphertext[], const KEY_TABLE_TYPE keyTable, u8 plaintext[]) { u32 s0, s1, s2, s3; const u32 *k = keyTable + grandRounds * 16, *kend = keyTable + 4; s0 = GETU32(ciphertext) ^ k[0]; s1 = GETU32(ciphertext + 4) ^ k[1]; s2 = GETU32(ciphertext + 8) ^ k[2]; s3 = GETU32(ciphertext + 12) ^ k[3]; while (1) { /* Camellia makes 6 Feistel rounds */ k -= 12; Camellia_Feistel(s0, s1, s2, s3, k + 10); Camellia_Feistel(s2, s3, s0, s1, k + 8); Camellia_Feistel(s0, s1, s2, s3, k + 6); Camellia_Feistel(s2, s3, s0, s1, k + 4); Camellia_Feistel(s0, s1, s2, s3, k + 2); Camellia_Feistel(s2, s3, s0, s1, k + 0); if (k == kend) break; /* * This is the same function as the diffusion function D of the * accompanying documentation. See section 3.2 for properties of the * FLlayer function. */ k -= 4; s1 ^= LeftRotate(s0 & k[2], 1); s2 ^= s3 | k[1]; s0 ^= s1 | k[3]; s3 ^= LeftRotate(s2 & k[0], 1); } k -= 4; s2 ^= k[0], s3 ^= k[1], s0 ^= k[2], s1 ^= k[3]; PUTU32(plaintext, s2); PUTU32(plaintext + 4, s3); PUTU32(plaintext + 8, s0); PUTU32(plaintext + 12, s1); } void Camellia_DecryptBlock(int keyBitLength, const u8 ciphertext[], const KEY_TABLE_TYPE keyTable, u8 plaintext[]) { Camellia_DecryptBlock_Rounds(keyBitLength == 128 ? 3 : 4, ciphertext, keyTable, plaintext); }
./openssl/crypto/camellia/cmll_ctr.c
/* * Copyright 2006-2020 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 */ /* * Camellia low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/camellia.h> #include <openssl/modes.h> void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char ivec[CAMELLIA_BLOCK_SIZE], unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], unsigned int *num) { CRYPTO_ctr128_encrypt(in, out, length, key, ivec, ecount_buf, num, (block128_f) Camellia_encrypt); }
./openssl/crypto/camellia/cmll_ecb.c
/* * Copyright 2006-2020 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 */ /* * Camellia low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/camellia.h> #include "cmll_local.h" void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key, const int enc) { if (CAMELLIA_ENCRYPT == enc) Camellia_encrypt(in, out, key); else Camellia_decrypt(in, out, key); }
./openssl/crypto/des/cbc_enc.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #define CBC_ENC_C__DONT_UPDATE_IV #include "ncbc_enc.c" /* des_cbc_encrypt */
./openssl/crypto/des/cfb64enc.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "des_local.h" /* * The input and output encrypted as though 64bit cfb mode is being used. * The extra state information to record how much of the 64bit block we have * used is contained in *num; */ void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *schedule, DES_cblock *ivec, int *num, int enc) { register DES_LONG v0, v1; register long l = length; register int n = *num; DES_LONG ti[2]; unsigned char *iv, c, cc; iv = &(*ivec)[0]; if (enc) { while (l--) { if (n == 0) { c2l(iv, v0); ti[0] = v0; c2l(iv, v1); ti[1] = v1; DES_encrypt1(ti, schedule, DES_ENCRYPT); iv = &(*ivec)[0]; v0 = ti[0]; l2c(v0, iv); v0 = ti[1]; l2c(v0, iv); iv = &(*ivec)[0]; } c = *(in++) ^ iv[n]; *(out++) = c; iv[n] = c; n = (n + 1) & 0x07; } } else { while (l--) { if (n == 0) { c2l(iv, v0); ti[0] = v0; c2l(iv, v1); ti[1] = v1; DES_encrypt1(ti, schedule, DES_ENCRYPT); iv = &(*ivec)[0]; v0 = ti[0]; l2c(v0, iv); v0 = ti[1]; l2c(v0, iv); iv = &(*ivec)[0]; } cc = *(in++); c = iv[n]; iv[n] = cc; *(out++) = c ^ cc; n = (n + 1) & 0x07; } } v0 = v1 = ti[0] = ti[1] = c = cc = 0; *num = n; }
./openssl/crypto/des/rand_key.c
/* * Copyright 1998-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include <openssl/des.h> #include <openssl/rand.h> int DES_random_key(DES_cblock *ret) { do { if (RAND_priv_bytes((unsigned char *)ret, sizeof(DES_cblock)) != 1) return 0; } while (DES_is_weak_key(ret)); DES_set_odd_parity(ret); return 1; }
./openssl/crypto/des/xcbc_enc.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "des_local.h" /* RSA's DESX */ void DES_xcbc_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *schedule, DES_cblock *ivec, const_DES_cblock *inw, const_DES_cblock *outw, int enc) { register DES_LONG tin0, tin1; register DES_LONG tout0, tout1, xor0, xor1; register DES_LONG inW0, inW1, outW0, outW1; register const unsigned char *in2; register long l = length; DES_LONG tin[2]; unsigned char *iv; in2 = &(*inw)[0]; c2l(in2, inW0); c2l(in2, inW1); in2 = &(*outw)[0]; c2l(in2, outW0); c2l(in2, outW1); iv = &(*ivec)[0]; if (enc) { c2l(iv, tout0); c2l(iv, tout1); for (l -= 8; l >= 0; l -= 8) { c2l(in, tin0); c2l(in, tin1); tin0 ^= tout0 ^ inW0; tin[0] = tin0; tin1 ^= tout1 ^ inW1; tin[1] = tin1; DES_encrypt1(tin, schedule, DES_ENCRYPT); tout0 = tin[0] ^ outW0; l2c(tout0, out); tout1 = tin[1] ^ outW1; l2c(tout1, out); } if (l != -8) { c2ln(in, tin0, tin1, l + 8); tin0 ^= tout0 ^ inW0; tin[0] = tin0; tin1 ^= tout1 ^ inW1; tin[1] = tin1; DES_encrypt1(tin, schedule, DES_ENCRYPT); tout0 = tin[0] ^ outW0; l2c(tout0, out); tout1 = tin[1] ^ outW1; l2c(tout1, out); } iv = &(*ivec)[0]; l2c(tout0, iv); l2c(tout1, iv); } else { c2l(iv, xor0); c2l(iv, xor1); for (l -= 8; l > 0; l -= 8) { c2l(in, tin0); tin[0] = tin0 ^ outW0; c2l(in, tin1); tin[1] = tin1 ^ outW1; DES_encrypt1(tin, schedule, DES_DECRYPT); tout0 = tin[0] ^ xor0 ^ inW0; tout1 = tin[1] ^ xor1 ^ inW1; l2c(tout0, out); l2c(tout1, out); xor0 = tin0; xor1 = tin1; } if (l != -8) { c2l(in, tin0); tin[0] = tin0 ^ outW0; c2l(in, tin1); tin[1] = tin1 ^ outW1; DES_encrypt1(tin, schedule, DES_DECRYPT); tout0 = tin[0] ^ xor0 ^ inW0; tout1 = tin[1] ^ xor1 ^ inW1; l2cn(tout0, tout1, out, l + 8); xor0 = tin0; xor1 = tin1; } iv = &(*ivec)[0]; l2c(xor0, iv); l2c(xor1, iv); } tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; inW0 = inW1 = outW0 = outW1 = 0; tin[0] = tin[1] = 0; }
./openssl/crypto/des/ecb3_enc.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "des_local.h" void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, int enc) { register DES_LONG l0, l1; DES_LONG ll[2]; const unsigned char *in = &(*input)[0]; unsigned char *out = &(*output)[0]; c2l(in, l0); c2l(in, l1); ll[0] = l0; ll[1] = l1; if (enc) DES_encrypt3(ll, ks1, ks2, ks3); else DES_decrypt3(ll, ks1, ks2, ks3); l0 = ll[0]; l1 = ll[1]; l2c(l0, out); l2c(l1, out); }
./openssl/crypto/des/qud_cksm.c
/* * Copyright 1995-2020 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 */ /* * From "Message Authentication" R.R. Jueneman, S.M. Matyas, C.H. Meyer IEEE * Communications Magazine Sept 1985 Vol. 23 No. 9 p 29-40 This module in * only based on the code in this paper and is almost definitely not the same * as the MIT implementation. */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "des_local.h" #define Q_B0(a) (((DES_LONG)(a))) #define Q_B1(a) (((DES_LONG)(a))<<8) #define Q_B2(a) (((DES_LONG)(a))<<16) #define Q_B3(a) (((DES_LONG)(a))<<24) /* used to scramble things a bit */ /* Got the value MIT uses via brute force :-) 2/10/90 eay */ #define NOISE ((DES_LONG)83653421L) DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], long length, int out_count, DES_cblock *seed) { DES_LONG z0, z1, t0, t1; int i; long l; const unsigned char *cp; DES_LONG *lp; if (out_count < 1) out_count = 1; lp = (DES_LONG *)&(output[0])[0]; z0 = Q_B0((*seed)[0]) | Q_B1((*seed)[1]) | Q_B2((*seed)[2]) | Q_B3((*seed)[3]); z1 = Q_B0((*seed)[4]) | Q_B1((*seed)[5]) | Q_B2((*seed)[6]) | Q_B3((*seed)[7]); for (i = 0; ((i < 4) && (i < out_count)); i++) { cp = input; l = length; while (l > 0) { if (l > 1) { t0 = (DES_LONG)(*(cp++)); t0 |= (DES_LONG)Q_B1(*(cp++)); l--; } else t0 = (DES_LONG)(*(cp++)); l--; /* add */ t0 += z0; t0 &= 0xffffffffL; t1 = z1; /* square, well sort of square */ z0 = ((((t0 * t0) & 0xffffffffL) + ((t1 * t1) & 0xffffffffL)) & 0xffffffffL) % 0x7fffffffL; z1 = ((t0 * ((t1 + NOISE) & 0xffffffffL)) & 0xffffffffL) % 0x7fffffffL; } if (lp != NULL) { /* * The MIT library assumes that the checksum is composed of * 2*out_count 32 bit ints */ *lp++ = z0; *lp++ = z1; } } return z0; }
./openssl/crypto/des/ncbc_enc.c
/* * Copyright 1998-2016 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 */ /*- * #included by: * cbc_enc.c (DES_cbc_encrypt) * des_enc.c (DES_ncbc_encrypt) */ #include "des_local.h" #ifdef CBC_ENC_C__DONT_UPDATE_IV void DES_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *_schedule, DES_cblock *ivec, int enc) #else void DES_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *_schedule, DES_cblock *ivec, int enc) #endif { register DES_LONG tin0, tin1; register DES_LONG tout0, tout1, xor0, xor1; register long l = length; DES_LONG tin[2]; unsigned char *iv; iv = &(*ivec)[0]; if (enc) { c2l(iv, tout0); c2l(iv, tout1); for (l -= 8; l >= 0; l -= 8) { c2l(in, tin0); c2l(in, tin1); tin0 ^= tout0; tin[0] = tin0; tin1 ^= tout1; tin[1] = tin1; DES_encrypt1((DES_LONG *)tin, _schedule, DES_ENCRYPT); tout0 = tin[0]; l2c(tout0, out); tout1 = tin[1]; l2c(tout1, out); } if (l != -8) { c2ln(in, tin0, tin1, l + 8); tin0 ^= tout0; tin[0] = tin0; tin1 ^= tout1; tin[1] = tin1; DES_encrypt1((DES_LONG *)tin, _schedule, DES_ENCRYPT); tout0 = tin[0]; l2c(tout0, out); tout1 = tin[1]; l2c(tout1, out); } #ifndef CBC_ENC_C__DONT_UPDATE_IV iv = &(*ivec)[0]; l2c(tout0, iv); l2c(tout1, iv); #endif } else { c2l(iv, xor0); c2l(iv, xor1); for (l -= 8; l >= 0; l -= 8) { c2l(in, tin0); tin[0] = tin0; c2l(in, tin1); tin[1] = tin1; DES_encrypt1((DES_LONG *)tin, _schedule, DES_DECRYPT); tout0 = tin[0] ^ xor0; tout1 = tin[1] ^ xor1; l2c(tout0, out); l2c(tout1, out); xor0 = tin0; xor1 = tin1; } if (l != -8) { c2l(in, tin0); tin[0] = tin0; c2l(in, tin1); tin[1] = tin1; DES_encrypt1((DES_LONG *)tin, _schedule, DES_DECRYPT); tout0 = tin[0] ^ xor0; tout1 = tin[1] ^ xor1; l2cn(tout0, tout1, out, l + 8); #ifndef CBC_ENC_C__DONT_UPDATE_IV xor0 = tin0; xor1 = tin1; #endif } #ifndef CBC_ENC_C__DONT_UPDATE_IV iv = &(*ivec)[0]; l2c(xor0, iv); l2c(xor1, iv); #endif } tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; tin[0] = tin[1] = 0; }
./openssl/crypto/des/fcrypt_b.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include <stdio.h> #define DES_FCRYPT #include "des_local.h" #undef DES_FCRYPT #undef PERM_OP #define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ (b)^=(t),\ (a)^=((t)<<(n))) #undef HPERM_OP #define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ (a)=(a)^(t)^(t>>(16-(n))))\ void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0, DES_LONG Eswap1) { register DES_LONG l, r, t, u; register DES_LONG *s; register int j; register DES_LONG E0, E1; l = 0; r = 0; s = (DES_LONG *)ks; E0 = Eswap0; E1 = Eswap1; for (j = 0; j < 25; j++) { D_ENCRYPT(l, r, 0); /* 1 */ D_ENCRYPT(r, l, 2); /* 2 */ D_ENCRYPT(l, r, 4); /* 3 */ D_ENCRYPT(r, l, 6); /* 4 */ D_ENCRYPT(l, r, 8); /* 5 */ D_ENCRYPT(r, l, 10); /* 6 */ D_ENCRYPT(l, r, 12); /* 7 */ D_ENCRYPT(r, l, 14); /* 8 */ D_ENCRYPT(l, r, 16); /* 9 */ D_ENCRYPT(r, l, 18); /* 10 */ D_ENCRYPT(l, r, 20); /* 11 */ D_ENCRYPT(r, l, 22); /* 12 */ D_ENCRYPT(l, r, 24); /* 13 */ D_ENCRYPT(r, l, 26); /* 14 */ D_ENCRYPT(l, r, 28); /* 15 */ D_ENCRYPT(r, l, 30); /* 16 */ t = l; l = r; r = t; } l = ROTATE(l, 3) & 0xffffffffL; r = ROTATE(r, 3) & 0xffffffffL; PERM_OP(l, r, t, 1, 0x55555555L); PERM_OP(r, l, t, 8, 0x00ff00ffL); PERM_OP(l, r, t, 2, 0x33333333L); PERM_OP(r, l, t, 16, 0x0000ffffL); PERM_OP(l, r, t, 4, 0x0f0f0f0fL); out[0] = r; out[1] = l; }
./openssl/crypto/des/ecb_enc.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "des_local.h" #include <openssl/opensslv.h> #include <openssl/bio.h> const char *DES_options(void) { static int init = 1; static char buf[12]; if (init) { if (sizeof(DES_LONG) != sizeof(long)) OPENSSL_strlcpy(buf, "des(int)", sizeof(buf)); else OPENSSL_strlcpy(buf, "des(long)", sizeof(buf)); init = 0; } return buf; } void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, DES_key_schedule *ks, int enc) { register DES_LONG l; DES_LONG ll[2]; const unsigned char *in = &(*input)[0]; unsigned char *out = &(*output)[0]; c2l(in, l); ll[0] = l; c2l(in, l); ll[1] = l; DES_encrypt1(ll, ks, enc); l = ll[0]; l2c(l, out); l = ll[1]; l2c(l, out); l = ll[0] = ll[1] = 0; }
./openssl/crypto/des/cbc_cksm.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "des_local.h" DES_LONG DES_cbc_cksum(const unsigned char *in, DES_cblock *output, long length, DES_key_schedule *schedule, const_DES_cblock *ivec) { register DES_LONG tout0, tout1, tin0, tin1; register long l = length; DES_LONG tin[2]; unsigned char *out = &(*output)[0]; const unsigned char *iv = &(*ivec)[0]; c2l(iv, tout0); c2l(iv, tout1); for (; l > 0; l -= 8) { if (l >= 8) { c2l(in, tin0); c2l(in, tin1); } else c2ln(in, tin0, tin1, l); tin0 ^= tout0; tin[0] = tin0; tin1 ^= tout1; tin[1] = tin1; DES_encrypt1((DES_LONG *)tin, schedule, DES_ENCRYPT); tout0 = tin[0]; tout1 = tin[1]; } if (out != NULL) { l2c(tout0, out); l2c(tout1, out); } tout0 = tin0 = tin1 = tin[0] = tin[1] = 0; /* * Transform the data in tout1 so that it will match the return value * that the MIT Kerberos mit_des_cbc_cksum API returns. */ tout1 = ((tout1 >> 24L) & 0x000000FF) | ((tout1 >> 8L) & 0x0000FF00) | ((tout1 << 8L) & 0x00FF0000) | ((tout1 << 24L) & 0xFF000000); return tout1; }
./openssl/crypto/des/des_enc.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include <openssl/crypto.h> #include "des_local.h" #include "spr.h" void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) { register DES_LONG l, r, t, u; register DES_LONG *s; r = data[0]; l = data[1]; IP(r, l); /* * Things have been modified so that the initial rotate is done outside * the loop. This required the DES_SPtrans values in sp.h to be rotated * 1 bit to the right. One perl script later and things have a 5% speed * up on a sparc2. Thanks to Richard Outerbridge for pointing this out. */ /* clear the top bits on machines with 8byte longs */ /* shift left by 2 */ r = ROTATE(r, 29) & 0xffffffffL; l = ROTATE(l, 29) & 0xffffffffL; s = ks->ks->deslong; /* * I don't know if it is worth the effort of loop unrolling the inner * loop */ if (enc) { D_ENCRYPT(l, r, 0); /* 1 */ D_ENCRYPT(r, l, 2); /* 2 */ D_ENCRYPT(l, r, 4); /* 3 */ D_ENCRYPT(r, l, 6); /* 4 */ D_ENCRYPT(l, r, 8); /* 5 */ D_ENCRYPT(r, l, 10); /* 6 */ D_ENCRYPT(l, r, 12); /* 7 */ D_ENCRYPT(r, l, 14); /* 8 */ D_ENCRYPT(l, r, 16); /* 9 */ D_ENCRYPT(r, l, 18); /* 10 */ D_ENCRYPT(l, r, 20); /* 11 */ D_ENCRYPT(r, l, 22); /* 12 */ D_ENCRYPT(l, r, 24); /* 13 */ D_ENCRYPT(r, l, 26); /* 14 */ D_ENCRYPT(l, r, 28); /* 15 */ D_ENCRYPT(r, l, 30); /* 16 */ } else { D_ENCRYPT(l, r, 30); /* 16 */ D_ENCRYPT(r, l, 28); /* 15 */ D_ENCRYPT(l, r, 26); /* 14 */ D_ENCRYPT(r, l, 24); /* 13 */ D_ENCRYPT(l, r, 22); /* 12 */ D_ENCRYPT(r, l, 20); /* 11 */ D_ENCRYPT(l, r, 18); /* 10 */ D_ENCRYPT(r, l, 16); /* 9 */ D_ENCRYPT(l, r, 14); /* 8 */ D_ENCRYPT(r, l, 12); /* 7 */ D_ENCRYPT(l, r, 10); /* 6 */ D_ENCRYPT(r, l, 8); /* 5 */ D_ENCRYPT(l, r, 6); /* 4 */ D_ENCRYPT(r, l, 4); /* 3 */ D_ENCRYPT(l, r, 2); /* 2 */ D_ENCRYPT(r, l, 0); /* 1 */ } /* rotate and clear the top bits on machines with 8byte longs */ l = ROTATE(l, 3) & 0xffffffffL; r = ROTATE(r, 3) & 0xffffffffL; FP(r, l); data[0] = l; data[1] = r; l = r = t = u = 0; } void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) { register DES_LONG l, r, t, u; register DES_LONG *s; r = data[0]; l = data[1]; /* * Things have been modified so that the initial rotate is done outside * the loop. This required the DES_SPtrans values in sp.h to be rotated * 1 bit to the right. One perl script later and things have a 5% speed * up on a sparc2. Thanks to Richard Outerbridge for pointing this out. */ /* clear the top bits on machines with 8byte longs */ r = ROTATE(r, 29) & 0xffffffffL; l = ROTATE(l, 29) & 0xffffffffL; s = ks->ks->deslong; /* * I don't know if it is worth the effort of loop unrolling the inner * loop */ if (enc) { D_ENCRYPT(l, r, 0); /* 1 */ D_ENCRYPT(r, l, 2); /* 2 */ D_ENCRYPT(l, r, 4); /* 3 */ D_ENCRYPT(r, l, 6); /* 4 */ D_ENCRYPT(l, r, 8); /* 5 */ D_ENCRYPT(r, l, 10); /* 6 */ D_ENCRYPT(l, r, 12); /* 7 */ D_ENCRYPT(r, l, 14); /* 8 */ D_ENCRYPT(l, r, 16); /* 9 */ D_ENCRYPT(r, l, 18); /* 10 */ D_ENCRYPT(l, r, 20); /* 11 */ D_ENCRYPT(r, l, 22); /* 12 */ D_ENCRYPT(l, r, 24); /* 13 */ D_ENCRYPT(r, l, 26); /* 14 */ D_ENCRYPT(l, r, 28); /* 15 */ D_ENCRYPT(r, l, 30); /* 16 */ } else { D_ENCRYPT(l, r, 30); /* 16 */ D_ENCRYPT(r, l, 28); /* 15 */ D_ENCRYPT(l, r, 26); /* 14 */ D_ENCRYPT(r, l, 24); /* 13 */ D_ENCRYPT(l, r, 22); /* 12 */ D_ENCRYPT(r, l, 20); /* 11 */ D_ENCRYPT(l, r, 18); /* 10 */ D_ENCRYPT(r, l, 16); /* 9 */ D_ENCRYPT(l, r, 14); /* 8 */ D_ENCRYPT(r, l, 12); /* 7 */ D_ENCRYPT(l, r, 10); /* 6 */ D_ENCRYPT(r, l, 8); /* 5 */ D_ENCRYPT(l, r, 6); /* 4 */ D_ENCRYPT(r, l, 4); /* 3 */ D_ENCRYPT(l, r, 2); /* 2 */ D_ENCRYPT(r, l, 0); /* 1 */ } /* rotate and clear the top bits on machines with 8byte longs */ data[0] = ROTATE(l, 3) & 0xffffffffL; data[1] = ROTATE(r, 3) & 0xffffffffL; l = r = t = u = 0; } void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3) { register DES_LONG l, r; l = data[0]; r = data[1]; IP(l, r); data[0] = l; data[1] = r; DES_encrypt2((DES_LONG *)data, ks1, DES_ENCRYPT); DES_encrypt2((DES_LONG *)data, ks2, DES_DECRYPT); DES_encrypt2((DES_LONG *)data, ks3, DES_ENCRYPT); l = data[0]; r = data[1]; FP(r, l); data[0] = l; data[1] = r; } void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3) { register DES_LONG l, r; l = data[0]; r = data[1]; IP(l, r); data[0] = l; data[1] = r; DES_encrypt2((DES_LONG *)data, ks3, DES_DECRYPT); DES_encrypt2((DES_LONG *)data, ks2, DES_ENCRYPT); DES_encrypt2((DES_LONG *)data, ks1, DES_DECRYPT); l = data[0]; r = data[1]; FP(r, l); data[0] = l; data[1] = r; } #ifndef DES_DEFAULT_OPTIONS # undef CBC_ENC_C__DONT_UPDATE_IV # include "ncbc_enc.c" /* DES_ncbc_encrypt */ void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, int enc) { register DES_LONG tin0, tin1; register DES_LONG tout0, tout1, xor0, xor1; register const unsigned char *in; unsigned char *out; register long l = length; DES_LONG tin[2]; unsigned char *iv; in = input; out = output; iv = &(*ivec)[0]; if (enc) { c2l(iv, tout0); c2l(iv, tout1); for (l -= 8; l >= 0; l -= 8) { c2l(in, tin0); c2l(in, tin1); tin0 ^= tout0; tin1 ^= tout1; tin[0] = tin0; tin[1] = tin1; DES_encrypt3((DES_LONG *)tin, ks1, ks2, ks3); tout0 = tin[0]; tout1 = tin[1]; l2c(tout0, out); l2c(tout1, out); } if (l != -8) { c2ln(in, tin0, tin1, l + 8); tin0 ^= tout0; tin1 ^= tout1; tin[0] = tin0; tin[1] = tin1; DES_encrypt3((DES_LONG *)tin, ks1, ks2, ks3); tout0 = tin[0]; tout1 = tin[1]; l2c(tout0, out); l2c(tout1, out); } iv = &(*ivec)[0]; l2c(tout0, iv); l2c(tout1, iv); } else { register DES_LONG t0, t1; c2l(iv, xor0); c2l(iv, xor1); for (l -= 8; l >= 0; l -= 8) { c2l(in, tin0); c2l(in, tin1); t0 = tin0; t1 = tin1; tin[0] = tin0; tin[1] = tin1; DES_decrypt3((DES_LONG *)tin, ks1, ks2, ks3); tout0 = tin[0]; tout1 = tin[1]; tout0 ^= xor0; tout1 ^= xor1; l2c(tout0, out); l2c(tout1, out); xor0 = t0; xor1 = t1; } if (l != -8) { c2l(in, tin0); c2l(in, tin1); t0 = tin0; t1 = tin1; tin[0] = tin0; tin[1] = tin1; DES_decrypt3((DES_LONG *)tin, ks1, ks2, ks3); tout0 = tin[0]; tout1 = tin[1]; tout0 ^= xor0; tout1 ^= xor1; l2cn(tout0, tout1, out, l + 8); xor0 = t0; xor1 = t1; } iv = &(*ivec)[0]; l2c(xor0, iv); l2c(xor1, iv); } tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; tin[0] = tin[1] = 0; } #endif /* DES_DEFAULT_OPTIONS */
./openssl/crypto/des/str2key.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include <openssl/crypto.h> #include "des_local.h" void DES_string_to_key(const char *str, DES_cblock *key) { DES_key_schedule ks; int i, length; memset(key, 0, 8); length = strlen(str); for (i = 0; i < length; i++) { register unsigned char j = str[i]; if ((i % 16) < 8) (*key)[i % 8] ^= (j << 1); else { /* Reverse the bit order 05/05/92 eay */ j = ((j << 4) & 0xf0) | ((j >> 4) & 0x0f); j = ((j << 2) & 0xcc) | ((j >> 2) & 0x33); j = ((j << 1) & 0xaa) | ((j >> 1) & 0x55); (*key)[7 - (i % 8)] ^= j; } } DES_set_odd_parity(key); DES_set_key_unchecked(key, &ks); DES_cbc_cksum((const unsigned char *)str, key, length, &ks, key); OPENSSL_cleanse(&ks, sizeof(ks)); DES_set_odd_parity(key); } void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2) { DES_key_schedule ks; int i, length; memset(key1, 0, 8); memset(key2, 0, 8); length = strlen(str); for (i = 0; i < length; i++) { register unsigned char j = str[i]; if ((i % 32) < 16) { if ((i % 16) < 8) (*key1)[i % 8] ^= (j << 1); else (*key2)[i % 8] ^= (j << 1); } else { j = ((j << 4) & 0xf0) | ((j >> 4) & 0x0f); j = ((j << 2) & 0xcc) | ((j >> 2) & 0x33); j = ((j << 1) & 0xaa) | ((j >> 1) & 0x55); if ((i % 16) < 8) (*key1)[7 - (i % 8)] ^= j; else (*key2)[7 - (i % 8)] ^= j; } } if (length <= 8) memcpy(key2, key1, 8); DES_set_odd_parity(key1); DES_set_odd_parity(key2); DES_set_key_unchecked(key1, &ks); DES_cbc_cksum((const unsigned char *)str, key1, length, &ks, key1); DES_set_key_unchecked(key2, &ks); DES_cbc_cksum((const unsigned char *)str, key2, length, &ks, key2); OPENSSL_cleanse(&ks, sizeof(ks)); DES_set_odd_parity(key1); DES_set_odd_parity(key2); }
./openssl/crypto/des/des_local.h
/* * Copyright 1995-2023 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 */ #ifndef OSSL_CRYPTO_DES_LOCAL_H # define OSSL_CRYPTO_DES_LOCAL_H # include <openssl/e_os2.h> # include <stdio.h> # include <stdlib.h> # include <string.h> # include <openssl/des.h> # ifdef OPENSSL_BUILD_SHLIBCRYPTO # undef OPENSSL_EXTERN # define OPENSSL_EXTERN OPENSSL_EXPORT # endif # define ITERATIONS 16 # define HALF_ITERATIONS 8 # define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ l|=((DES_LONG)(*((c)++)))<< 8L, \ l|=((DES_LONG)(*((c)++)))<<16L, \ l|=((DES_LONG)(*((c)++)))<<24L) /* NOTE - c is not incremented as per c2l */ # define c2ln(c,l1,l2,n) { \ c+=n; \ l1=l2=0; \ switch (n) { \ case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ /* fall through */ \ case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ /* fall through */ \ case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ /* fall through */ \ case 5: l2|=((DES_LONG)(*(--(c)))); \ /* fall through */ \ case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ /* fall through */ \ case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ /* fall through */ \ case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ /* fall through */ \ case 1: l1|=((DES_LONG)(*(--(c)))); \ } \ } # define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ *((c)++)=(unsigned char)(((l)>>24L)&0xff)) /* NOTE - c is not incremented as per l2c */ # define l2cn(l1,l2,c,n) { \ c+=n; \ switch (n) { \ case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ /* fall through */ \ case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ /* fall through */ \ case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ /* fall through */ \ case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ /* fall through */ \ case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ /* fall through */ \ case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ /* fall through */ \ case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ /* fall through */ \ case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ } \ } # if defined(_MSC_VER) # define ROTATE(a,n) (_lrotr(a,n)) # elif defined(__ICC) # define ROTATE(a,n) (_rotr(a,n)) # elif defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC) # if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) # define ROTATE(a,n) ({ register unsigned int ret; \ asm ("rorl %1,%0" \ : "=r"(ret) \ : "I"(n),"0"(a) \ : "cc"); \ ret; \ }) # elif defined(__riscv_zbb) || defined(__riscv_zbkb) # if __riscv_xlen == 64 # define ROTATE(x, n) ({ register unsigned int ret; \ asm ("roriw %0, %1, %2" \ : "=r"(ret) \ : "r"(x), "i"(n)); ret; }) # endif # if __riscv_xlen == 32 # define ROTATE(x, n) ({ register unsigned int ret; \ asm ("rori %0, %1, %2" \ : "=r"(ret) \ : "r"(x), "i"(n)); ret; }) # endif # endif # endif # ifndef ROTATE # define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) # endif /* * Don't worry about the LOAD_DATA() stuff, that is used by fcrypt() to add * it's little bit to the front */ # ifdef DES_FCRYPT # define LOAD_DATA_tmp(R,S,u,t,E0,E1) \ { DES_LONG tmp; LOAD_DATA(R,S,u,t,E0,E1,tmp); } # define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ t=R^(R>>16L); \ u=t&E0; t&=E1; \ tmp=(u<<16); u^=R^s[S ]; u^=tmp; \ tmp=(t<<16); t^=R^s[S+1]; t^=tmp # else # define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) # define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ u=R^s[S ]; \ t=R^s[S+1] # endif /* * It recently occurred to me that 0^0^0^0^0^0^0 == 0, so there is no reason * to not xor all the sub items together. This potentially saves a register * since things can be xored directly into L */ # define D_ENCRYPT(LL,R,S) { \ LOAD_DATA_tmp(R,S,u,t,E0,E1); \ t=ROTATE(t,4); \ LL^= \ DES_SPtrans[0][(u>> 2L)&0x3f]^ \ DES_SPtrans[2][(u>>10L)&0x3f]^ \ DES_SPtrans[4][(u>>18L)&0x3f]^ \ DES_SPtrans[6][(u>>26L)&0x3f]^ \ DES_SPtrans[1][(t>> 2L)&0x3f]^ \ DES_SPtrans[3][(t>>10L)&0x3f]^ \ DES_SPtrans[5][(t>>18L)&0x3f]^ \ DES_SPtrans[7][(t>>26L)&0x3f]; } /*- * IP and FP * The problem is more of a geometric problem that random bit fiddling. 0 1 2 3 4 5 6 7 62 54 46 38 30 22 14 6 8 9 10 11 12 13 14 15 60 52 44 36 28 20 12 4 16 17 18 19 20 21 22 23 58 50 42 34 26 18 10 2 24 25 26 27 28 29 30 31 to 56 48 40 32 24 16 8 0 32 33 34 35 36 37 38 39 63 55 47 39 31 23 15 7 40 41 42 43 44 45 46 47 61 53 45 37 29 21 13 5 48 49 50 51 52 53 54 55 59 51 43 35 27 19 11 3 56 57 58 59 60 61 62 63 57 49 41 33 25 17 9 1 The output has been subject to swaps of the form 0 1 -> 3 1 but the odd and even bits have been put into 2 3 2 0 different words. The main trick is to remember that t=((l>>size)^r)&(mask); r^=t; l^=(t<<size); can be used to swap and move bits between words. So l = 0 1 2 3 r = 16 17 18 19 4 5 6 7 20 21 22 23 8 9 10 11 24 25 26 27 12 13 14 15 28 29 30 31 becomes (for size == 2 and mask == 0x3333) t = 2^16 3^17 -- -- l = 0 1 16 17 r = 2 3 18 19 6^20 7^21 -- -- 4 5 20 21 6 7 22 23 10^24 11^25 -- -- 8 9 24 25 10 11 24 25 14^28 15^29 -- -- 12 13 28 29 14 15 28 29 Thanks for hints from Richard Outerbridge - he told me IP&FP could be done in 15 xor, 10 shifts and 5 ands. When I finally started to think of the problem in 2D I first got ~42 operations without xors. When I remembered how to use xors :-) I got it to its final state. */ # define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ (b)^=(t),\ (a)^=((t)<<(n))) # define IP(l,r) \ { \ register DES_LONG tt; \ PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ PERM_OP(l,r,tt,16,0x0000ffffL); \ PERM_OP(r,l,tt, 2,0x33333333L); \ PERM_OP(l,r,tt, 8,0x00ff00ffL); \ PERM_OP(r,l,tt, 1,0x55555555L); \ } # define FP(l,r) \ { \ register DES_LONG tt; \ PERM_OP(l,r,tt, 1,0x55555555L); \ PERM_OP(r,l,tt, 8,0x00ff00ffL); \ PERM_OP(l,r,tt, 2,0x33333333L); \ PERM_OP(r,l,tt,16,0x0000ffffL); \ PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ } extern const DES_LONG DES_SPtrans[8][64]; void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0, DES_LONG Eswap1); #endif
./openssl/crypto/des/set_key.c
/* * Copyright 1995-2020 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 */ /*- * set_key.c v 1.4 eay 24/9/91 * 1.4 Speed up by 400% :-) * 1.3 added register declarations. * 1.2 unrolled make_key_sched a bit more * 1.1 added norm_expand_bits * 1.0 First working version */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include <openssl/crypto.h> #include "internal/constant_time.h" #include "internal/nelem.h" #include "des_local.h" static const unsigned char odd_parity[256] = { 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, 97, 97, 98, 98, 100, 100, 103, 103, 104, 104, 107, 107, 109, 109, 110, 110, 112, 112, 115, 115, 117, 117, 118, 118, 121, 121, 122, 122, 124, 124, 127, 127, 128, 128, 131, 131, 133, 133, 134, 134, 137, 137, 138, 138, 140, 140, 143, 143, 145, 145, 146, 146, 148, 148, 151, 151, 152, 152, 155, 155, 157, 157, 158, 158, 161, 161, 162, 162, 164, 164, 167, 167, 168, 168, 171, 171, 173, 173, 174, 174, 176, 176, 179, 179, 181, 181, 182, 182, 185, 185, 186, 186, 188, 188, 191, 191, 193, 193, 194, 194, 196, 196, 199, 199, 200, 200, 203, 203, 205, 205, 206, 206, 208, 208, 211, 211, 213, 213, 214, 214, 217, 217, 218, 218, 220, 220, 223, 223, 224, 224, 227, 227, 229, 229, 230, 230, 233, 233, 234, 234, 236, 236, 239, 239, 241, 241, 242, 242, 244, 244, 247, 247, 248, 248, 251, 251, 253, 253, 254, 254 }; void DES_set_odd_parity(DES_cblock *key) { unsigned int i; for (i = 0; i < DES_KEY_SZ; i++) (*key)[i] = odd_parity[(*key)[i]]; } /* * Check that a key has the correct parity. * Return 1 if parity is okay and 0 if not. */ int DES_check_key_parity(const_DES_cblock *key) { unsigned int i; unsigned char res = 0377, b; for (i = 0; i < DES_KEY_SZ; i++) { b = (*key)[i]; b ^= b >> 4; b ^= b >> 2; b ^= b >> 1; res &= constant_time_eq_8(b & 1, 1); } return (int)(res & 1); } /*- * Weak and semi weak keys as taken from * %A D.W. Davies * %A W.L. Price * %T Security for Computer Networks * %I John Wiley & Sons * %D 1984 */ static const DES_cblock weak_keys[] = { /* weak keys */ {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, {0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE}, {0x1F, 0x1F, 0x1F, 0x1F, 0x0E, 0x0E, 0x0E, 0x0E}, {0xE0, 0xE0, 0xE0, 0xE0, 0xF1, 0xF1, 0xF1, 0xF1}, /* semi-weak keys */ {0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE}, {0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01}, {0x1F, 0xE0, 0x1F, 0xE0, 0x0E, 0xF1, 0x0E, 0xF1}, {0xE0, 0x1F, 0xE0, 0x1F, 0xF1, 0x0E, 0xF1, 0x0E}, {0x01, 0xE0, 0x01, 0xE0, 0x01, 0xF1, 0x01, 0xF1}, {0xE0, 0x01, 0xE0, 0x01, 0xF1, 0x01, 0xF1, 0x01}, {0x1F, 0xFE, 0x1F, 0xFE, 0x0E, 0xFE, 0x0E, 0xFE}, {0xFE, 0x1F, 0xFE, 0x1F, 0xFE, 0x0E, 0xFE, 0x0E}, {0x01, 0x1F, 0x01, 0x1F, 0x01, 0x0E, 0x01, 0x0E}, {0x1F, 0x01, 0x1F, 0x01, 0x0E, 0x01, 0x0E, 0x01}, {0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1, 0xFE}, {0xFE, 0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1} }; /* * Check for weak keys. * Return 1 if the key is weak and 0 otherwise. */ int DES_is_weak_key(const_DES_cblock *key) { unsigned int i, res = 0; int j; for (i = 0; i < OSSL_NELEM(weak_keys); i++) { j = CRYPTO_memcmp(weak_keys[i], key, sizeof(DES_cblock)); res |= constant_time_is_zero((unsigned int)j); } return (int)(res & 1); } /*- * NOW DEFINED IN des_local.h * See ecb_encrypt.c for a pseudo description of these macros. * #define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ * (b)^=(t),\ * (a)=((a)^((t)<<(n)))) */ #define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ (a)=(a)^(t)^(t>>(16-(n)))) static const DES_LONG des_skb[8][64] = { { /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ 0x00000000L, 0x00000010L, 0x20000000L, 0x20000010L, 0x00010000L, 0x00010010L, 0x20010000L, 0x20010010L, 0x00000800L, 0x00000810L, 0x20000800L, 0x20000810L, 0x00010800L, 0x00010810L, 0x20010800L, 0x20010810L, 0x00000020L, 0x00000030L, 0x20000020L, 0x20000030L, 0x00010020L, 0x00010030L, 0x20010020L, 0x20010030L, 0x00000820L, 0x00000830L, 0x20000820L, 0x20000830L, 0x00010820L, 0x00010830L, 0x20010820L, 0x20010830L, 0x00080000L, 0x00080010L, 0x20080000L, 0x20080010L, 0x00090000L, 0x00090010L, 0x20090000L, 0x20090010L, 0x00080800L, 0x00080810L, 0x20080800L, 0x20080810L, 0x00090800L, 0x00090810L, 0x20090800L, 0x20090810L, 0x00080020L, 0x00080030L, 0x20080020L, 0x20080030L, 0x00090020L, 0x00090030L, 0x20090020L, 0x20090030L, 0x00080820L, 0x00080830L, 0x20080820L, 0x20080830L, 0x00090820L, 0x00090830L, 0x20090820L, 0x20090830L, }, { /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ 0x00000000L, 0x02000000L, 0x00002000L, 0x02002000L, 0x00200000L, 0x02200000L, 0x00202000L, 0x02202000L, 0x00000004L, 0x02000004L, 0x00002004L, 0x02002004L, 0x00200004L, 0x02200004L, 0x00202004L, 0x02202004L, 0x00000400L, 0x02000400L, 0x00002400L, 0x02002400L, 0x00200400L, 0x02200400L, 0x00202400L, 0x02202400L, 0x00000404L, 0x02000404L, 0x00002404L, 0x02002404L, 0x00200404L, 0x02200404L, 0x00202404L, 0x02202404L, 0x10000000L, 0x12000000L, 0x10002000L, 0x12002000L, 0x10200000L, 0x12200000L, 0x10202000L, 0x12202000L, 0x10000004L, 0x12000004L, 0x10002004L, 0x12002004L, 0x10200004L, 0x12200004L, 0x10202004L, 0x12202004L, 0x10000400L, 0x12000400L, 0x10002400L, 0x12002400L, 0x10200400L, 0x12200400L, 0x10202400L, 0x12202400L, 0x10000404L, 0x12000404L, 0x10002404L, 0x12002404L, 0x10200404L, 0x12200404L, 0x10202404L, 0x12202404L, }, { /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ 0x00000000L, 0x00000001L, 0x00040000L, 0x00040001L, 0x01000000L, 0x01000001L, 0x01040000L, 0x01040001L, 0x00000002L, 0x00000003L, 0x00040002L, 0x00040003L, 0x01000002L, 0x01000003L, 0x01040002L, 0x01040003L, 0x00000200L, 0x00000201L, 0x00040200L, 0x00040201L, 0x01000200L, 0x01000201L, 0x01040200L, 0x01040201L, 0x00000202L, 0x00000203L, 0x00040202L, 0x00040203L, 0x01000202L, 0x01000203L, 0x01040202L, 0x01040203L, 0x08000000L, 0x08000001L, 0x08040000L, 0x08040001L, 0x09000000L, 0x09000001L, 0x09040000L, 0x09040001L, 0x08000002L, 0x08000003L, 0x08040002L, 0x08040003L, 0x09000002L, 0x09000003L, 0x09040002L, 0x09040003L, 0x08000200L, 0x08000201L, 0x08040200L, 0x08040201L, 0x09000200L, 0x09000201L, 0x09040200L, 0x09040201L, 0x08000202L, 0x08000203L, 0x08040202L, 0x08040203L, 0x09000202L, 0x09000203L, 0x09040202L, 0x09040203L, }, { /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ 0x00000000L, 0x00100000L, 0x00000100L, 0x00100100L, 0x00000008L, 0x00100008L, 0x00000108L, 0x00100108L, 0x00001000L, 0x00101000L, 0x00001100L, 0x00101100L, 0x00001008L, 0x00101008L, 0x00001108L, 0x00101108L, 0x04000000L, 0x04100000L, 0x04000100L, 0x04100100L, 0x04000008L, 0x04100008L, 0x04000108L, 0x04100108L, 0x04001000L, 0x04101000L, 0x04001100L, 0x04101100L, 0x04001008L, 0x04101008L, 0x04001108L, 0x04101108L, 0x00020000L, 0x00120000L, 0x00020100L, 0x00120100L, 0x00020008L, 0x00120008L, 0x00020108L, 0x00120108L, 0x00021000L, 0x00121000L, 0x00021100L, 0x00121100L, 0x00021008L, 0x00121008L, 0x00021108L, 0x00121108L, 0x04020000L, 0x04120000L, 0x04020100L, 0x04120100L, 0x04020008L, 0x04120008L, 0x04020108L, 0x04120108L, 0x04021000L, 0x04121000L, 0x04021100L, 0x04121100L, 0x04021008L, 0x04121008L, 0x04021108L, 0x04121108L, }, { /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ 0x00000000L, 0x10000000L, 0x00010000L, 0x10010000L, 0x00000004L, 0x10000004L, 0x00010004L, 0x10010004L, 0x20000000L, 0x30000000L, 0x20010000L, 0x30010000L, 0x20000004L, 0x30000004L, 0x20010004L, 0x30010004L, 0x00100000L, 0x10100000L, 0x00110000L, 0x10110000L, 0x00100004L, 0x10100004L, 0x00110004L, 0x10110004L, 0x20100000L, 0x30100000L, 0x20110000L, 0x30110000L, 0x20100004L, 0x30100004L, 0x20110004L, 0x30110004L, 0x00001000L, 0x10001000L, 0x00011000L, 0x10011000L, 0x00001004L, 0x10001004L, 0x00011004L, 0x10011004L, 0x20001000L, 0x30001000L, 0x20011000L, 0x30011000L, 0x20001004L, 0x30001004L, 0x20011004L, 0x30011004L, 0x00101000L, 0x10101000L, 0x00111000L, 0x10111000L, 0x00101004L, 0x10101004L, 0x00111004L, 0x10111004L, 0x20101000L, 0x30101000L, 0x20111000L, 0x30111000L, 0x20101004L, 0x30101004L, 0x20111004L, 0x30111004L, }, { /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ 0x00000000L, 0x08000000L, 0x00000008L, 0x08000008L, 0x00000400L, 0x08000400L, 0x00000408L, 0x08000408L, 0x00020000L, 0x08020000L, 0x00020008L, 0x08020008L, 0x00020400L, 0x08020400L, 0x00020408L, 0x08020408L, 0x00000001L, 0x08000001L, 0x00000009L, 0x08000009L, 0x00000401L, 0x08000401L, 0x00000409L, 0x08000409L, 0x00020001L, 0x08020001L, 0x00020009L, 0x08020009L, 0x00020401L, 0x08020401L, 0x00020409L, 0x08020409L, 0x02000000L, 0x0A000000L, 0x02000008L, 0x0A000008L, 0x02000400L, 0x0A000400L, 0x02000408L, 0x0A000408L, 0x02020000L, 0x0A020000L, 0x02020008L, 0x0A020008L, 0x02020400L, 0x0A020400L, 0x02020408L, 0x0A020408L, 0x02000001L, 0x0A000001L, 0x02000009L, 0x0A000009L, 0x02000401L, 0x0A000401L, 0x02000409L, 0x0A000409L, 0x02020001L, 0x0A020001L, 0x02020009L, 0x0A020009L, 0x02020401L, 0x0A020401L, 0x02020409L, 0x0A020409L, }, { /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ 0x00000000L, 0x00000100L, 0x00080000L, 0x00080100L, 0x01000000L, 0x01000100L, 0x01080000L, 0x01080100L, 0x00000010L, 0x00000110L, 0x00080010L, 0x00080110L, 0x01000010L, 0x01000110L, 0x01080010L, 0x01080110L, 0x00200000L, 0x00200100L, 0x00280000L, 0x00280100L, 0x01200000L, 0x01200100L, 0x01280000L, 0x01280100L, 0x00200010L, 0x00200110L, 0x00280010L, 0x00280110L, 0x01200010L, 0x01200110L, 0x01280010L, 0x01280110L, 0x00000200L, 0x00000300L, 0x00080200L, 0x00080300L, 0x01000200L, 0x01000300L, 0x01080200L, 0x01080300L, 0x00000210L, 0x00000310L, 0x00080210L, 0x00080310L, 0x01000210L, 0x01000310L, 0x01080210L, 0x01080310L, 0x00200200L, 0x00200300L, 0x00280200L, 0x00280300L, 0x01200200L, 0x01200300L, 0x01280200L, 0x01280300L, 0x00200210L, 0x00200310L, 0x00280210L, 0x00280310L, 0x01200210L, 0x01200310L, 0x01280210L, 0x01280310L, }, { /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ 0x00000000L, 0x04000000L, 0x00040000L, 0x04040000L, 0x00000002L, 0x04000002L, 0x00040002L, 0x04040002L, 0x00002000L, 0x04002000L, 0x00042000L, 0x04042000L, 0x00002002L, 0x04002002L, 0x00042002L, 0x04042002L, 0x00000020L, 0x04000020L, 0x00040020L, 0x04040020L, 0x00000022L, 0x04000022L, 0x00040022L, 0x04040022L, 0x00002020L, 0x04002020L, 0x00042020L, 0x04042020L, 0x00002022L, 0x04002022L, 0x00042022L, 0x04042022L, 0x00000800L, 0x04000800L, 0x00040800L, 0x04040800L, 0x00000802L, 0x04000802L, 0x00040802L, 0x04040802L, 0x00002800L, 0x04002800L, 0x00042800L, 0x04042800L, 0x00002802L, 0x04002802L, 0x00042802L, 0x04042802L, 0x00000820L, 0x04000820L, 0x00040820L, 0x04040820L, 0x00000822L, 0x04000822L, 0x00040822L, 0x04040822L, 0x00002820L, 0x04002820L, 0x00042820L, 0x04042820L, 0x00002822L, 0x04002822L, 0x00042822L, 0x04042822L, } }; /* Return values as DES_set_key_checked() but always set the key */ int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule) { int ret = 0; if (!DES_check_key_parity(key)) ret = -1; if (DES_is_weak_key(key)) ret = -2; DES_set_key_unchecked(key, schedule); return ret; } /*- * return 0 if key parity is odd (correct), * return -1 if key parity error, * return -2 if illegal weak key. */ int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule) { if (!DES_check_key_parity(key)) return -1; if (DES_is_weak_key(key)) return -2; DES_set_key_unchecked(key, schedule); return 0; } void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule) { static const int shifts2[16] = { 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0 }; register DES_LONG c, d, t, s, t2; register const unsigned char *in; register DES_LONG *k; register int i; #ifdef OPENBSD_DEV_CRYPTO memcpy(schedule->key, key, sizeof(schedule->key)); schedule->session = NULL; #endif k = &schedule->ks->deslong[0]; in = &(*key)[0]; c2l(in, c); c2l(in, d); /* * do PC1 in 47 simple operations. Thanks to John Fletcher * for the inspiration. */ PERM_OP(d, c, t, 4, 0x0f0f0f0fL); HPERM_OP(c, t, -2, 0xcccc0000L); HPERM_OP(d, t, -2, 0xcccc0000L); PERM_OP(d, c, t, 1, 0x55555555L); PERM_OP(c, d, t, 8, 0x00ff00ffL); PERM_OP(d, c, t, 1, 0x55555555L); d = (((d & 0x000000ffL) << 16L) | (d & 0x0000ff00L) | ((d & 0x00ff0000L) >> 16L) | ((c & 0xf0000000L) >> 4L)); c &= 0x0fffffffL; for (i = 0; i < ITERATIONS; i++) { if (shifts2[i]) { c = ((c >> 2L) | (c << 26L)); d = ((d >> 2L) | (d << 26L)); } else { c = ((c >> 1L) | (c << 27L)); d = ((d >> 1L) | (d << 27L)); } c &= 0x0fffffffL; d &= 0x0fffffffL; /* * could be a few less shifts but I am to lazy at this point in time * to investigate */ s = des_skb[0][(c) & 0x3f] | des_skb[1][((c >> 6L) & 0x03) | ((c >> 7L) & 0x3c)] | des_skb[2][((c >> 13L) & 0x0f) | ((c >> 14L) & 0x30)] | des_skb[3][((c >> 20L) & 0x01) | ((c >> 21L) & 0x06) | ((c >> 22L) & 0x38)]; t = des_skb[4][(d) & 0x3f] | des_skb[5][((d >> 7L) & 0x03) | ((d >> 8L) & 0x3c)] | des_skb[6][(d >> 15L) & 0x3f] | des_skb[7][((d >> 21L) & 0x0f) | ((d >> 22L) & 0x30)]; /* table contained 0213 4657 */ t2 = ((t << 16L) | (s & 0x0000ffffL)) & 0xffffffffL; *(k++) = ROTATE(t2, 30) & 0xffffffffL; t2 = ((s >> 16L) | (t & 0xffff0000L)); *(k++) = ROTATE(t2, 26) & 0xffffffffL; } } int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule) { return DES_set_key(key, schedule); }
./openssl/crypto/des/cfb64ede.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "des_local.h" /* * The input and output encrypted as though 64bit cfb mode is being used. * The extra state information to record how much of the 64bit block we have * used is contained in *num; */ void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, int *num, int enc) { register DES_LONG v0, v1; register long l = length; register int n = *num; DES_LONG ti[2]; unsigned char *iv, c, cc; iv = &(*ivec)[0]; if (enc) { while (l--) { if (n == 0) { c2l(iv, v0); c2l(iv, v1); ti[0] = v0; ti[1] = v1; DES_encrypt3(ti, ks1, ks2, ks3); v0 = ti[0]; v1 = ti[1]; iv = &(*ivec)[0]; l2c(v0, iv); l2c(v1, iv); iv = &(*ivec)[0]; } c = *(in++) ^ iv[n]; *(out++) = c; iv[n] = c; n = (n + 1) & 0x07; } } else { while (l--) { if (n == 0) { c2l(iv, v0); c2l(iv, v1); ti[0] = v0; ti[1] = v1; DES_encrypt3(ti, ks1, ks2, ks3); v0 = ti[0]; v1 = ti[1]; iv = &(*ivec)[0]; l2c(v0, iv); l2c(v1, iv); iv = &(*ivec)[0]; } cc = *(in++); c = iv[n]; iv[n] = cc; *(out++) = c ^ cc; n = (n + 1) & 0x07; } } v0 = v1 = ti[0] = ti[1] = c = cc = 0; *num = n; } /* * This is compatible with the single key CFB-r for DES, even thought that's * not what EVP needs. */ void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, int enc) { register DES_LONG d0, d1, v0, v1; register unsigned long l = length, n = ((unsigned int)numbits + 7) / 8; register int num = numbits, i; DES_LONG ti[2]; unsigned char *iv; unsigned char ovec[16]; if (num > 64) return; iv = &(*ivec)[0]; c2l(iv, v0); c2l(iv, v1); if (enc) { while (l >= n) { l -= n; ti[0] = v0; ti[1] = v1; DES_encrypt3(ti, ks1, ks2, ks3); c2ln(in, d0, d1, n); in += n; d0 ^= ti[0]; d1 ^= ti[1]; l2cn(d0, d1, out, n); out += n; /* * 30-08-94 - eay - changed because l>>32 and l<<32 are bad under * gcc :-( */ if (num == 32) { v0 = v1; v1 = d0; } else if (num == 64) { v0 = d0; v1 = d1; } else { iv = &ovec[0]; l2c(v0, iv); l2c(v1, iv); l2c(d0, iv); l2c(d1, iv); /* shift ovec left most of the bits... */ memmove(ovec, ovec + num / 8, 8 + (num % 8 ? 1 : 0)); /* now the remaining bits */ if (num % 8 != 0) for (i = 0; i < 8; ++i) { ovec[i] <<= num % 8; ovec[i] |= ovec[i + 1] >> (8 - num % 8); } iv = &ovec[0]; c2l(iv, v0); c2l(iv, v1); } } } else { while (l >= n) { l -= n; ti[0] = v0; ti[1] = v1; DES_encrypt3(ti, ks1, ks2, ks3); c2ln(in, d0, d1, n); in += n; /* * 30-08-94 - eay - changed because l>>32 and l<<32 are bad under * gcc :-( */ if (num == 32) { v0 = v1; v1 = d0; } else if (num == 64) { v0 = d0; v1 = d1; } else { iv = &ovec[0]; l2c(v0, iv); l2c(v1, iv); l2c(d0, iv); l2c(d1, iv); /* shift ovec left most of the bits... */ memmove(ovec, ovec + num / 8, 8 + (num % 8 ? 1 : 0)); /* now the remaining bits */ if (num % 8 != 0) for (i = 0; i < 8; ++i) { ovec[i] <<= num % 8; ovec[i] |= ovec[i + 1] >> (8 - num % 8); } iv = &ovec[0]; c2l(iv, v0); c2l(iv, v1); } d0 ^= ti[0]; d1 ^= ti[1]; l2cn(d0, d1, out, n); out += n; } } iv = &(*ivec)[0]; l2c(v0, iv); l2c(v1, iv); v0 = v1 = d0 = d1 = ti[0] = ti[1] = 0; }
./openssl/crypto/des/ofb64ede.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "des_local.h" /* * The input and output encrypted as though 64bit ofb mode is being used. * The extra state information to record how much of the 64bit block we have * used is contained in *num; */ void DES_ede3_ofb64_encrypt(register const unsigned char *in, register unsigned char *out, long length, DES_key_schedule *k1, DES_key_schedule *k2, DES_key_schedule *k3, DES_cblock *ivec, int *num) { register DES_LONG v0, v1; register int n = *num; register long l = length; DES_cblock d; register char *dp; DES_LONG ti[2]; unsigned char *iv; int save = 0; iv = &(*ivec)[0]; c2l(iv, v0); c2l(iv, v1); ti[0] = v0; ti[1] = v1; dp = (char *)d; l2c(v0, dp); l2c(v1, dp); while (l--) { if (n == 0) { /* ti[0]=v0; */ /* ti[1]=v1; */ DES_encrypt3(ti, k1, k2, k3); v0 = ti[0]; v1 = ti[1]; dp = (char *)d; l2c(v0, dp); l2c(v1, dp); save++; } *(out++) = *(in++) ^ d[n]; n = (n + 1) & 0x07; } if (save) { iv = &(*ivec)[0]; l2c(v0, iv); l2c(v1, iv); } v0 = v1 = ti[0] = ti[1] = 0; *num = n; }
./openssl/crypto/des/fcrypt.c
/* * Copyright 1998-2021 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" /* NOCW */ #include <stdio.h> #ifdef _OSD_POSIX # ifndef CHARSET_EBCDIC # define CHARSET_EBCDIC 1 # endif #endif #ifdef CHARSET_EBCDIC # include <openssl/ebcdic.h> #endif #include <openssl/crypto.h> #include "des_local.h" /* * Added more values to handle illegal salt values the way normal crypt() * implementations do. */ static const unsigned char con_salt[128] = { 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, }; static const unsigned char cov_2char[64] = { 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A }; char *DES_crypt(const char *buf, const char *salt) { static char buff[14]; #ifndef CHARSET_EBCDIC return DES_fcrypt(buf, salt, buff); #else char e_salt[2 + 1]; char e_buf[32 + 1]; /* replace 32 by 8 ? */ char *ret; if (salt[0] == '\0' || salt[1] == '\0') return NULL; /* Copy salt, convert to ASCII. */ e_salt[0] = salt[0]; e_salt[1] = salt[1]; e_salt[2] = '\0'; ebcdic2ascii(e_salt, e_salt, sizeof(e_salt)); /* Convert password to ASCII. */ OPENSSL_strlcpy(e_buf, buf, sizeof(e_buf)); ebcdic2ascii(e_buf, e_buf, sizeof(e_buf)); /* Encrypt it (from/to ASCII); if it worked, convert back. */ ret = DES_fcrypt(e_buf, e_salt, buff); if (ret != NULL) ascii2ebcdic(ret, ret, strlen(ret)); return ret; #endif } char *DES_fcrypt(const char *buf, const char *salt, char *ret) { unsigned int i, j, x, y; DES_LONG Eswap0, Eswap1; DES_LONG out[2], ll; DES_cblock key; DES_key_schedule ks; unsigned char bb[9]; unsigned char *b = bb; unsigned char c, u; x = ret[0] = salt[0]; if (x == 0 || x >= sizeof(con_salt)) return NULL; Eswap0 = con_salt[x] << 2; x = ret[1] = salt[1]; if (x == 0 || x >= sizeof(con_salt)) return NULL; Eswap1 = con_salt[x] << 6; /* * EAY r=strlen(buf); r=(r+7)/8; */ for (i = 0; i < 8; i++) { c = *(buf++); if (!c) break; key[i] = (c << 1); } for (; i < 8; i++) key[i] = 0; DES_set_key_unchecked(&key, &ks); fcrypt_body(&(out[0]), &ks, Eswap0, Eswap1); ll = out[0]; l2c(ll, b); ll = out[1]; l2c(ll, b); y = 0; u = 0x80; bb[8] = 0; for (i = 2; i < 13; i++) { c = 0; for (j = 0; j < 6; j++) { c <<= 1; if (bb[y] & u) c |= 1; u >>= 1; if (!u) { y++; u = 0x80; } } ret[i] = cov_2char[c]; } ret[13] = '\0'; return ret; }
./openssl/crypto/des/ofb64enc.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "des_local.h" /* * The input and output encrypted as though 64bit ofb mode is being used. * The extra state information to record how much of the 64bit block we have * used is contained in *num; */ void DES_ofb64_encrypt(register const unsigned char *in, register unsigned char *out, long length, DES_key_schedule *schedule, DES_cblock *ivec, int *num) { register DES_LONG v0, v1, t; register int n = *num; register long l = length; DES_cblock d; register unsigned char *dp; DES_LONG ti[2]; unsigned char *iv; int save = 0; iv = &(*ivec)[0]; c2l(iv, v0); c2l(iv, v1); ti[0] = v0; ti[1] = v1; dp = d; l2c(v0, dp); l2c(v1, dp); while (l--) { if (n == 0) { DES_encrypt1(ti, schedule, DES_ENCRYPT); dp = d; t = ti[0]; l2c(t, dp); t = ti[1]; l2c(t, dp); save++; } *(out++) = *(in++) ^ d[n]; n = (n + 1) & 0x07; } if (save) { v0 = ti[0]; v1 = ti[1]; iv = &(*ivec)[0]; l2c(v0, iv); l2c(v1, iv); } t = v0 = v1 = ti[0] = ti[1] = 0; *num = n; }
./openssl/crypto/des/spr.h
/* * Copyright 1995-2016 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 */ const DES_LONG DES_SPtrans[8][64] = { { /* nibble 0 */ 0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, 0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L, 0x00080802L, 0x02080800L, 0x02080000L, 0x00000802L, 0x02000802L, 0x02000000L, 0x00000000L, 0x00080002L, 0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L, 0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L, 0x00000002L, 0x00000800L, 0x00080800L, 0x02080002L, 0x00000800L, 0x02000802L, 0x02080002L, 0x00000000L, 0x00000000L, 0x02080802L, 0x02000800L, 0x00080002L, 0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L, 0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L, 0x00080802L, 0x00000002L, 0x02000002L, 0x02080000L, 0x02080802L, 0x00080800L, 0x02080000L, 0x02000802L, 0x02000000L, 0x00000802L, 0x00080002L, 0x00000000L, 0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L, 0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L, }, { /* nibble 1 */ 0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L, 0x40000010L, 0x00008010L, 0x40008000L, 0x00108000L, 0x00008000L, 0x40100010L, 0x00000010L, 0x40008000L, 0x00100010L, 0x40108000L, 0x40100000L, 0x00000010L, 0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L, 0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L, 0x40008010L, 0x00108010L, 0x40108000L, 0x40000010L, 0x40000000L, 0x00100000L, 0x00008010L, 0x40108010L, 0x00100010L, 0x40108000L, 0x40008000L, 0x00108010L, 0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L, 0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L, 0x00008000L, 0x40000000L, 0x00108010L, 0x40008010L, 0x40108000L, 0x00008000L, 0x00000000L, 0x40000010L, 0x00000010L, 0x40108010L, 0x00108000L, 0x40100000L, 0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L, 0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L, }, { /* nibble 2 */ 0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L, 0x00040001L, 0x04000000L, 0x04000101L, 0x00040100L, 0x04000100L, 0x00040000L, 0x04040000L, 0x00000001L, 0x04040101L, 0x00000101L, 0x00000001L, 0x04040001L, 0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L, 0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L, 0x04040001L, 0x04000100L, 0x00040101L, 0x04040000L, 0x00040100L, 0x00000000L, 0x04000000L, 0x00040101L, 0x04040100L, 0x00000100L, 0x00000001L, 0x00040000L, 0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L, 0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L, 0x00040001L, 0x04000000L, 0x04040101L, 0x00000001L, 0x00040101L, 0x04000001L, 0x04000000L, 0x04040101L, 0x00040000L, 0x04000100L, 0x04000101L, 0x00040100L, 0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L, 0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L, }, { /* nibble 3 */ 0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L, 0x00000000L, 0x10400000L, 0x10001008L, 0x00400008L, 0x10401000L, 0x10000008L, 0x10000000L, 0x00001008L, 0x10000008L, 0x00401008L, 0x00400000L, 0x10000000L, 0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L, 0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L, 0x00001008L, 0x00000000L, 0x00400008L, 0x10401000L, 0x10001000L, 0x10400008L, 0x10401008L, 0x00400000L, 0x10400008L, 0x00001008L, 0x00400000L, 0x10000008L, 0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L, 0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L, 0x00000000L, 0x10400008L, 0x10401000L, 0x00001000L, 0x10000000L, 0x10401008L, 0x00401008L, 0x00400000L, 0x10401008L, 0x00000008L, 0x10001000L, 0x00401008L, 0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L, 0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L, }, { /* nibble 4 */ 0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L, 0x08010020L, 0x08000400L, 0x00010420L, 0x08010000L, 0x00010000L, 0x00000020L, 0x08000020L, 0x00010400L, 0x08000420L, 0x08010020L, 0x08010400L, 0x00000000L, 0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L, 0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L, 0x00000020L, 0x08000420L, 0x08010420L, 0x00010020L, 0x08010000L, 0x00000400L, 0x00000420L, 0x08010400L, 0x08010400L, 0x08000420L, 0x00010020L, 0x08010000L, 0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L, 0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L, 0x00010420L, 0x08000000L, 0x00000400L, 0x00010020L, 0x08000420L, 0x00000400L, 0x00000000L, 0x08010420L, 0x08010020L, 0x08010400L, 0x00000420L, 0x00010000L, 0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L, 0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L, }, { /* nibble 5 */ 0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L, 0x00200040L, 0x00002000L, 0x80002040L, 0x00200000L, 0x00002040L, 0x80202040L, 0x00202000L, 0x80000000L, 0x80002000L, 0x80000040L, 0x80200000L, 0x00202040L, 0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L, 0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L, 0x80202040L, 0x80200000L, 0x80000000L, 0x00002040L, 0x00000040L, 0x00202000L, 0x00202040L, 0x80002000L, 0x00002040L, 0x80000000L, 0x80002000L, 0x00202040L, 0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L, 0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L, 0x00200040L, 0x80202040L, 0x00202000L, 0x00000040L, 0x80202040L, 0x00202000L, 0x00200000L, 0x80002040L, 0x80000040L, 0x80200000L, 0x00202040L, 0x00000000L, 0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L, 0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L, }, { /* nibble 6 */ 0x00004000L, 0x00000200L, 0x01000200L, 0x01000004L, 0x01004204L, 0x00004004L, 0x00004200L, 0x00000000L, 0x01000000L, 0x01000204L, 0x00000204L, 0x01004000L, 0x00000004L, 0x01004200L, 0x01004000L, 0x00000204L, 0x01000204L, 0x00004000L, 0x00004004L, 0x01004204L, 0x00000000L, 0x01000200L, 0x01000004L, 0x00004200L, 0x01004004L, 0x00004204L, 0x01004200L, 0x00000004L, 0x00004204L, 0x01004004L, 0x00000200L, 0x01000000L, 0x00004204L, 0x01004000L, 0x01004004L, 0x00000204L, 0x00004000L, 0x00000200L, 0x01000000L, 0x01004004L, 0x01000204L, 0x00004204L, 0x00004200L, 0x00000000L, 0x00000200L, 0x01000004L, 0x00000004L, 0x01000200L, 0x00000000L, 0x01000204L, 0x01000200L, 0x00004200L, 0x00000204L, 0x00004000L, 0x01004204L, 0x01000000L, 0x01004200L, 0x00000004L, 0x00004004L, 0x01004204L, 0x01000004L, 0x01004200L, 0x01004000L, 0x00004004L, }, { /* nibble 7 */ 0x20800080L, 0x20820000L, 0x00020080L, 0x00000000L, 0x20020000L, 0x00800080L, 0x20800000L, 0x20820080L, 0x00000080L, 0x20000000L, 0x00820000L, 0x00020080L, 0x00820080L, 0x20020080L, 0x20000080L, 0x20800000L, 0x00020000L, 0x00820080L, 0x00800080L, 0x20020000L, 0x20820080L, 0x20000080L, 0x00000000L, 0x00820000L, 0x20000000L, 0x00800000L, 0x20020080L, 0x20800080L, 0x00800000L, 0x00020000L, 0x20820000L, 0x00000080L, 0x00800000L, 0x00020000L, 0x20000080L, 0x20820080L, 0x00020080L, 0x20000000L, 0x00000000L, 0x00820000L, 0x20800080L, 0x20020080L, 0x20020000L, 0x00800080L, 0x20820000L, 0x00000080L, 0x00800080L, 0x20020000L, 0x20820080L, 0x00800000L, 0x20800000L, 0x20000080L, 0x00820000L, 0x00020080L, 0x20020080L, 0x20800000L, 0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L, 0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L, } };
./openssl/crypto/des/pcbc_enc.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "des_local.h" void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc) { register DES_LONG sin0, sin1, xor0, xor1, tout0, tout1; DES_LONG tin[2]; const unsigned char *in; unsigned char *out, *iv; in = input; out = output; iv = &(*ivec)[0]; if (enc) { c2l(iv, xor0); c2l(iv, xor1); for (; length > 0; length -= 8) { if (length >= 8) { c2l(in, sin0); c2l(in, sin1); } else c2ln(in, sin0, sin1, length); tin[0] = sin0 ^ xor0; tin[1] = sin1 ^ xor1; DES_encrypt1((DES_LONG *)tin, schedule, DES_ENCRYPT); tout0 = tin[0]; tout1 = tin[1]; xor0 = sin0 ^ tout0; xor1 = sin1 ^ tout1; l2c(tout0, out); l2c(tout1, out); } } else { c2l(iv, xor0); c2l(iv, xor1); for (; length > 0; length -= 8) { c2l(in, sin0); c2l(in, sin1); tin[0] = sin0; tin[1] = sin1; DES_encrypt1((DES_LONG *)tin, schedule, DES_DECRYPT); tout0 = tin[0] ^ xor0; tout1 = tin[1] ^ xor1; if (length >= 8) { l2c(tout0, out); l2c(tout1, out); } else l2cn(tout0, tout1, out, length); xor0 = tout0 ^ sin0; xor1 = tout1 ^ sin1; } } tin[0] = tin[1] = 0; sin0 = sin1 = xor0 = xor1 = tout0 = tout1 = 0; }
./openssl/crypto/des/cfb_enc.c
/* * Copyright 1995-2022 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "internal/e_os.h" #include "des_local.h" #include <assert.h> /* * The input and output are loaded in multiples of 8 bits. What this means is * that if you hame numbits=12 and length=2 the first 12 bits will be * retrieved from the first byte and half the second. The second 12 bits * will come from the 3rd and half the 4th byte. */ /* * Until Aug 1 2003 this function did not correctly implement CFB-r, so it * will not be compatible with any encryption prior to that date. Ben. */ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc) { register DES_LONG d0, d1, v0, v1; register unsigned long l = length; register int num = numbits / 8, n = (numbits + 7) / 8, i, rem = numbits % 8; DES_LONG ti[2]; unsigned char *iv; #ifndef L_ENDIAN unsigned char ovec[16]; #else unsigned int sh[4]; unsigned char *ovec = (unsigned char *)sh; /* I kind of count that compiler optimizes away this assertion, */ assert(sizeof(sh[0]) == 4); /* as this holds true for all, */ /* but 16-bit platforms... */ #endif if (numbits <= 0 || numbits > 64) return; iv = &(*ivec)[0]; c2l(iv, v0); c2l(iv, v1); if (enc) { while (l >= (unsigned long)n) { l -= n; ti[0] = v0; ti[1] = v1; DES_encrypt1((DES_LONG *)ti, schedule, DES_ENCRYPT); c2ln(in, d0, d1, n); in += n; d0 ^= ti[0]; d1 ^= ti[1]; l2cn(d0, d1, out, n); out += n; /* * 30-08-94 - eay - changed because l>>32 and l<<32 are bad under * gcc :-( */ if (numbits == 32) { v0 = v1; v1 = d0; } else if (numbits == 64) { v0 = d0; v1 = d1; } else { #ifndef L_ENDIAN iv = &ovec[0]; l2c(v0, iv); l2c(v1, iv); l2c(d0, iv); l2c(d1, iv); #else sh[0] = v0, sh[1] = v1, sh[2] = d0, sh[3] = d1; #endif if (rem == 0) memmove(ovec, ovec + num, 8); else for (i = 0; i < 8; ++i) ovec[i] = ovec[i + num] << rem | ovec[i + num + 1] >> (8 - rem); #ifdef L_ENDIAN v0 = sh[0], v1 = sh[1]; #else iv = &ovec[0]; c2l(iv, v0); c2l(iv, v1); #endif } } } else { while (l >= (unsigned long)n) { l -= n; ti[0] = v0; ti[1] = v1; DES_encrypt1((DES_LONG *)ti, schedule, DES_ENCRYPT); c2ln(in, d0, d1, n); in += n; /* * 30-08-94 - eay - changed because l>>32 and l<<32 are bad under * gcc :-( */ if (numbits == 32) { v0 = v1; v1 = d0; } else if (numbits == 64) { v0 = d0; v1 = d1; } else { #ifndef L_ENDIAN iv = &ovec[0]; l2c(v0, iv); l2c(v1, iv); l2c(d0, iv); l2c(d1, iv); #else sh[0] = v0, sh[1] = v1, sh[2] = d0, sh[3] = d1; #endif if (rem == 0) memmove(ovec, ovec + num, 8); else for (i = 0; i < 8; ++i) ovec[i] = ovec[i + num] << rem | ovec[i + num + 1] >> (8 - rem); #ifdef L_ENDIAN v0 = sh[0], v1 = sh[1]; #else iv = &ovec[0]; c2l(iv, v0); c2l(iv, v1); #endif } d0 ^= ti[0]; d1 ^= ti[1]; l2cn(d0, d1, out, n); out += n; } } iv = &(*ivec)[0]; l2c(v0, iv); l2c(v1, iv); v0 = v1 = d0 = d1 = ti[0] = ti[1] = 0; }
./openssl/crypto/des/ofb_enc.c
/* * Copyright 1995-2020 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 */ /* * DES low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include "des_local.h" /* * The input and output are loaded in multiples of 8 bits. What this means is * that if you have numbits=12 and length=2 the first 12 bits will be * retrieved from the first byte and half the second. The second 12 bits * will come from the 3rd and half the 4th byte. */ void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, long length, DES_key_schedule *schedule, DES_cblock *ivec) { register DES_LONG d0, d1, vv0, vv1, v0, v1, n = (numbits + 7) / 8; register DES_LONG mask0, mask1; register long l = length; register int num = numbits; DES_LONG ti[2]; unsigned char *iv; if (num > 64) return; if (num > 32) { mask0 = 0xffffffffL; if (num >= 64) mask1 = mask0; else mask1 = (1L << (num - 32)) - 1; } else { if (num == 32) mask0 = 0xffffffffL; else mask0 = (1L << num) - 1; mask1 = 0x00000000L; } iv = &(*ivec)[0]; c2l(iv, v0); c2l(iv, v1); ti[0] = v0; ti[1] = v1; while (l-- > 0) { ti[0] = v0; ti[1] = v1; DES_encrypt1((DES_LONG *)ti, schedule, DES_ENCRYPT); vv0 = ti[0]; vv1 = ti[1]; c2ln(in, d0, d1, n); in += n; d0 = (d0 ^ vv0) & mask0; d1 = (d1 ^ vv1) & mask1; l2cn(d0, d1, out, n); out += n; if (num == 32) { v0 = v1; v1 = vv0; } else if (num == 64) { v0 = vv0; v1 = vv1; } else if (num > 32) { /* && num != 64 */ v0 = ((v1 >> (num - 32)) | (vv0 << (64 - num))) & 0xffffffffL; v1 = ((vv0 >> (num - 32)) | (vv1 << (64 - num))) & 0xffffffffL; } else { /* num < 32 */ v0 = ((v0 >> num) | (v1 << (32 - num))) & 0xffffffffL; v1 = ((v1 >> num) | (vv0 << (32 - num))) & 0xffffffffL; } } iv = &(*ivec)[0]; l2c(v0, iv); l2c(v1, iv); v0 = v1 = d0 = d1 = ti[0] = ti[1] = vv0 = vv1 = 0; }
./openssl/crypto/kdf/kdf_err.c
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-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 */ #include <openssl/err.h> #include <openssl/kdferr.h> #ifndef OPENSSL_NO_DEPRECATED_3_0 int ERR_load_KDF_strings(void) { return 1; } #endif
./openssl/crypto/md2/md2_one.c
/* * Copyright 1995-2020 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 */ /* * MD2 low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/md2.h> /* * This is a separate file so that #defines in cryptlib.h can map my MD * functions to different names */ unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md) { MD2_CTX c; static unsigned char m[MD2_DIGEST_LENGTH]; if (md == NULL) md = m; if (!MD2_Init(&c)) return NULL; #ifndef CHARSET_EBCDIC MD2_Update(&c, d, n); #else { char temp[1024]; unsigned long chunk; while (n > 0) { chunk = (n > sizeof(temp)) ? sizeof(temp) : n; ebcdic2ascii(temp, d, chunk); MD2_Update(&c, temp, chunk); n -= chunk; d += chunk; } } #endif MD2_Final(md, &c); OPENSSL_cleanse(&c, sizeof(c)); /* Security consideration */ return md; }
./openssl/crypto/md2/md2_dgst.c
/* * Copyright 1995-2020 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 */ /* * MD2 low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <openssl/md2.h> #include <openssl/opensslv.h> #include <openssl/crypto.h> /* * Implemented from RFC1319 The MD2 Message-Digest Algorithm */ #define UCHAR unsigned char static void md2_block(MD2_CTX *c, const unsigned char *d); /* * The magic S table - I have converted it to hex since it is basically just * a random byte string. */ static const MD2_INT S[256] = { 0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36, 0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13, 0x62, 0xA7, 0x05, 0xF3, 0xC0, 0xC7, 0x73, 0x8C, 0x98, 0x93, 0x2B, 0xD9, 0xBC, 0x4C, 0x82, 0xCA, 0x1E, 0x9B, 0x57, 0x3C, 0xFD, 0xD4, 0xE0, 0x16, 0x67, 0x42, 0x6F, 0x18, 0x8A, 0x17, 0xE5, 0x12, 0xBE, 0x4E, 0xC4, 0xD6, 0xDA, 0x9E, 0xDE, 0x49, 0xA0, 0xFB, 0xF5, 0x8E, 0xBB, 0x2F, 0xEE, 0x7A, 0xA9, 0x68, 0x79, 0x91, 0x15, 0xB2, 0x07, 0x3F, 0x94, 0xC2, 0x10, 0x89, 0x0B, 0x22, 0x5F, 0x21, 0x80, 0x7F, 0x5D, 0x9A, 0x5A, 0x90, 0x32, 0x27, 0x35, 0x3E, 0xCC, 0xE7, 0xBF, 0xF7, 0x97, 0x03, 0xFF, 0x19, 0x30, 0xB3, 0x48, 0xA5, 0xB5, 0xD1, 0xD7, 0x5E, 0x92, 0x2A, 0xAC, 0x56, 0xAA, 0xC6, 0x4F, 0xB8, 0x38, 0xD2, 0x96, 0xA4, 0x7D, 0xB6, 0x76, 0xFC, 0x6B, 0xE2, 0x9C, 0x74, 0x04, 0xF1, 0x45, 0x9D, 0x70, 0x59, 0x64, 0x71, 0x87, 0x20, 0x86, 0x5B, 0xCF, 0x65, 0xE6, 0x2D, 0xA8, 0x02, 0x1B, 0x60, 0x25, 0xAD, 0xAE, 0xB0, 0xB9, 0xF6, 0x1C, 0x46, 0x61, 0x69, 0x34, 0x40, 0x7E, 0x0F, 0x55, 0x47, 0xA3, 0x23, 0xDD, 0x51, 0xAF, 0x3A, 0xC3, 0x5C, 0xF9, 0xCE, 0xBA, 0xC5, 0xEA, 0x26, 0x2C, 0x53, 0x0D, 0x6E, 0x85, 0x28, 0x84, 0x09, 0xD3, 0xDF, 0xCD, 0xF4, 0x41, 0x81, 0x4D, 0x52, 0x6A, 0xDC, 0x37, 0xC8, 0x6C, 0xC1, 0xAB, 0xFA, 0x24, 0xE1, 0x7B, 0x08, 0x0C, 0xBD, 0xB1, 0x4A, 0x78, 0x88, 0x95, 0x8B, 0xE3, 0x63, 0xE8, 0x6D, 0xE9, 0xCB, 0xD5, 0xFE, 0x3B, 0x00, 0x1D, 0x39, 0xF2, 0xEF, 0xB7, 0x0E, 0x66, 0x58, 0xD0, 0xE4, 0xA6, 0x77, 0x72, 0xF8, 0xEB, 0x75, 0x4B, 0x0A, 0x31, 0x44, 0x50, 0xB4, 0x8F, 0xED, 0x1F, 0x1A, 0xDB, 0x99, 0x8D, 0x33, 0x9F, 0x11, 0x83, 0x14, }; const char *MD2_options(void) { if (sizeof(MD2_INT) == 1) return "md2(char)"; else return "md2(int)"; } int MD2_Init(MD2_CTX *c) { c->num = 0; memset(c->state, 0, sizeof(c->state)); memset(c->cksm, 0, sizeof(c->cksm)); memset(c->data, 0, sizeof(c->data)); return 1; } int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len) { register UCHAR *p; if (len == 0) return 1; p = c->data; if (c->num != 0) { if ((c->num + len) >= MD2_BLOCK) { memcpy(&(p[c->num]), data, MD2_BLOCK - c->num); md2_block(c, c->data); data += (MD2_BLOCK - c->num); len -= (MD2_BLOCK - c->num); c->num = 0; /* drop through and do the rest */ } else { memcpy(&(p[c->num]), data, len); /* data+=len; */ c->num += (int)len; return 1; } } /* * we now can process the input data in blocks of MD2_BLOCK chars and * save the leftovers to c->data. */ while (len >= MD2_BLOCK) { md2_block(c, data); data += MD2_BLOCK; len -= MD2_BLOCK; } memcpy(p, data, len); c->num = (int)len; return 1; } static void md2_block(MD2_CTX *c, const unsigned char *d) { register MD2_INT t, *sp1, *sp2; register int i, j; MD2_INT state[48]; sp1 = c->state; sp2 = c->cksm; j = sp2[MD2_BLOCK - 1]; for (i = 0; i < 16; i++) { state[i] = sp1[i]; state[i + 16] = t = d[i]; state[i + 32] = (t ^ sp1[i]); j = sp2[i] ^= S[t ^ j]; } t = 0; for (i = 0; i < 18; i++) { for (j = 0; j < 48; j += 8) { t = state[j + 0] ^= S[t]; t = state[j + 1] ^= S[t]; t = state[j + 2] ^= S[t]; t = state[j + 3] ^= S[t]; t = state[j + 4] ^= S[t]; t = state[j + 5] ^= S[t]; t = state[j + 6] ^= S[t]; t = state[j + 7] ^= S[t]; } t = (t + i) & 0xff; } memcpy(sp1, state, 16 * sizeof(MD2_INT)); OPENSSL_cleanse(state, 48 * sizeof(MD2_INT)); } int MD2_Final(unsigned char *md, MD2_CTX *c) { int i, v; register UCHAR *cp; register MD2_INT *p1, *p2; cp = c->data; p1 = c->state; p2 = c->cksm; v = MD2_BLOCK - c->num; for (i = c->num; i < MD2_BLOCK; i++) cp[i] = (UCHAR) v; md2_block(c, cp); for (i = 0; i < MD2_BLOCK; i++) cp[i] = (UCHAR) p2[i]; md2_block(c, cp); for (i = 0; i < 16; i++) md[i] = (UCHAR) (p1[i] & 0xff); OPENSSL_cleanse(c, sizeof(*c)); return 1; }
./openssl/crypto/pkcs7/pk7_smime.c
/* * Copyright 1999-2023 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 */ /* Simple PKCS#7 processing functions */ #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/x509.h> #include <openssl/x509v3.h> #include "pk7_local.h" #define BUFFERSIZE 4096 static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si); PKCS7 *PKCS7_sign_ex(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, int flags, OSSL_LIB_CTX *libctx, const char *propq) { PKCS7 *p7; int i; if ((p7 = PKCS7_new_ex(libctx, propq)) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_PKCS7_LIB); return NULL; } if (!PKCS7_set_type(p7, NID_pkcs7_signed)) goto err; if (!PKCS7_content_new(p7, NID_pkcs7_data)) goto err; if (pkey && !PKCS7_sign_add_signer(p7, signcert, pkey, NULL, flags)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_PKCS7_ADD_SIGNER_ERROR); goto err; } if (!(flags & PKCS7_NOCERTS)) { for (i = 0; i < sk_X509_num(certs); i++) { if (!PKCS7_add_certificate(p7, sk_X509_value(certs, i))) goto err; } } if (flags & PKCS7_DETACHED) PKCS7_set_detached(p7, 1); if (flags & (PKCS7_STREAM | PKCS7_PARTIAL)) return p7; if (PKCS7_final(p7, data, flags)) return p7; err: PKCS7_free(p7); return NULL; } PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, int flags) { return PKCS7_sign_ex(signcert, pkey, certs, data, flags, NULL, NULL); } int PKCS7_final(PKCS7 *p7, BIO *data, int flags) { BIO *p7bio; int ret = 0; if ((p7bio = PKCS7_dataInit(p7, NULL)) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_PKCS7_LIB); return 0; } if (!SMIME_crlf_copy(data, p7bio, flags)) goto err; (void)BIO_flush(p7bio); if (!PKCS7_dataFinal(p7, p7bio)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_PKCS7_DATASIGN); goto err; } ret = 1; err: BIO_free_all(p7bio); return ret; } /* Check to see if a cipher exists and if so add S/MIME capabilities */ static int add_cipher_smcap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) { if (EVP_get_cipherbynid(nid)) return PKCS7_simple_smimecap(sk, nid, arg); return 1; } static int add_digest_smcap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) { if (EVP_get_digestbynid(nid)) return PKCS7_simple_smimecap(sk, nid, arg); return 1; } PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md, int flags) { PKCS7_SIGNER_INFO *si = NULL; STACK_OF(X509_ALGOR) *smcap = NULL; if (!X509_check_private_key(signcert, pkey)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE); return NULL; } if ((si = PKCS7_add_signature(p7, signcert, pkey, md)) == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR); return NULL; } si->ctx = ossl_pkcs7_get0_ctx(p7); if (!(flags & PKCS7_NOCERTS)) { if (!PKCS7_add_certificate(p7, signcert)) goto err; } if (!(flags & PKCS7_NOATTR)) { if (!PKCS7_add_attrib_content_type(si, NULL)) goto err; /* Add SMIMECapabilities */ if (!(flags & PKCS7_NOSMIMECAP)) { if ((smcap = sk_X509_ALGOR_new_null()) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_CRYPTO_LIB); goto err; } if (!add_cipher_smcap(smcap, NID_aes_256_cbc, -1) || !add_digest_smcap(smcap, NID_id_GostR3411_2012_256, -1) || !add_digest_smcap(smcap, NID_id_GostR3411_2012_512, -1) || !add_digest_smcap(smcap, NID_id_GostR3411_94, -1) || !add_cipher_smcap(smcap, NID_id_Gost28147_89, -1) || !add_cipher_smcap(smcap, NID_aes_192_cbc, -1) || !add_cipher_smcap(smcap, NID_aes_128_cbc, -1) || !add_cipher_smcap(smcap, NID_des_ede3_cbc, -1) || !add_cipher_smcap(smcap, NID_rc2_cbc, 128) || !add_cipher_smcap(smcap, NID_rc2_cbc, 64) || !add_cipher_smcap(smcap, NID_des_cbc, -1) || !add_cipher_smcap(smcap, NID_rc2_cbc, 40) || !PKCS7_add_attrib_smimecap(si, smcap)) goto err; sk_X509_ALGOR_pop_free(smcap, X509_ALGOR_free); smcap = NULL; } if (flags & PKCS7_REUSE_DIGEST) { if (!pkcs7_copy_existing_digest(p7, si)) goto err; if (!(flags & PKCS7_PARTIAL) && !PKCS7_SIGNER_INFO_sign(si)) goto err; } } return si; err: sk_X509_ALGOR_pop_free(smcap, X509_ALGOR_free); return NULL; } /* * Search for a digest matching SignerInfo digest type and if found copy * across. */ static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si) { int i; STACK_OF(PKCS7_SIGNER_INFO) *sinfos; PKCS7_SIGNER_INFO *sitmp; ASN1_OCTET_STRING *osdig = NULL; sinfos = PKCS7_get_signer_info(p7); for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(sinfos); i++) { sitmp = sk_PKCS7_SIGNER_INFO_value(sinfos, i); if (si == sitmp) break; if (sk_X509_ATTRIBUTE_num(sitmp->auth_attr) <= 0) continue; if (!OBJ_cmp(si->digest_alg->algorithm, sitmp->digest_alg->algorithm)) { osdig = PKCS7_digest_from_attributes(sitmp->auth_attr); break; } } if (osdig != NULL) return PKCS7_add1_attrib_digest(si, osdig->data, osdig->length); ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND); return 0; } /* This strongly overlaps with CMS_verify(), partly with PKCS7_dataVerify() */ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata, BIO *out, int flags) { STACK_OF(X509) *signers; X509 *signer; STACK_OF(PKCS7_SIGNER_INFO) *sinfos; PKCS7_SIGNER_INFO *si; X509_STORE_CTX *cert_ctx = NULL; char *buf = NULL; int i, j = 0, k, ret = 0; BIO *p7bio = NULL; BIO *tmpout = NULL; const PKCS7_CTX *p7_ctx; if (p7 == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_INVALID_NULL_POINTER); return 0; } if (!PKCS7_type_is_signed(p7)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE); return 0; } /* Check for no data and no content: no data to verify signature */ if (PKCS7_get_detached(p7) && indata == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT); return 0; } if (flags & PKCS7_NO_DUAL_CONTENT) { /* * This was originally "#if 0" because we thought that only old broken * Netscape did this. It turns out that Authenticode uses this kind * of "extended" PKCS7 format, and things like UEFI secure boot and * tools like osslsigncode need it. In Authenticode the verification * process is different, but the existing PKCs7 verification works. */ if (!PKCS7_get_detached(p7) && indata != NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_CONTENT_AND_DATA_PRESENT); return 0; } } sinfos = PKCS7_get_signer_info(p7); if (!sinfos || !sk_PKCS7_SIGNER_INFO_num(sinfos)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_SIGNATURES_ON_DATA); return 0; } signers = PKCS7_get0_signers(p7, certs, flags); if (signers == NULL) return 0; /* Now verify the certificates */ p7_ctx = ossl_pkcs7_get0_ctx(p7); cert_ctx = X509_STORE_CTX_new_ex(ossl_pkcs7_ctx_get0_libctx(p7_ctx), ossl_pkcs7_ctx_get0_propq(p7_ctx)); if (cert_ctx == NULL) goto err; if (!(flags & PKCS7_NOVERIFY)) for (k = 0; k < sk_X509_num(signers); k++) { signer = sk_X509_value(signers, k); if (!(flags & PKCS7_NOCHAIN)) { if (!X509_STORE_CTX_init(cert_ctx, store, signer, p7->d.sign->cert)) { ERR_raise(ERR_LIB_PKCS7, ERR_R_X509_LIB); goto err; } if (!X509_STORE_CTX_set_default(cert_ctx, "smime_sign")) goto err; } else if (!X509_STORE_CTX_init(cert_ctx, store, signer, NULL)) { ERR_raise(ERR_LIB_PKCS7, ERR_R_X509_LIB); goto err; } if (!(flags & PKCS7_NOCRL)) X509_STORE_CTX_set0_crls(cert_ctx, p7->d.sign->crl); i = X509_verify_cert(cert_ctx); if (i <= 0) j = X509_STORE_CTX_get_error(cert_ctx); if (i <= 0) { ERR_raise_data(ERR_LIB_PKCS7, PKCS7_R_CERTIFICATE_VERIFY_ERROR, "Verify error: %s", X509_verify_cert_error_string(j)); goto err; } /* Check for revocation status here */ } if ((p7bio = PKCS7_dataInit(p7, indata)) == NULL) goto err; if (flags & PKCS7_TEXT) { if ((tmpout = BIO_new(BIO_s_mem())) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_BIO_LIB); goto err; } BIO_set_mem_eof_return(tmpout, 0); } else tmpout = out; /* We now have to 'read' from p7bio to calculate digests etc. */ if ((buf = OPENSSL_malloc(BUFFERSIZE)) == NULL) goto err; for (;;) { i = BIO_read(p7bio, buf, BUFFERSIZE); if (i <= 0) break; if (tmpout) BIO_write(tmpout, buf, i); } if (flags & PKCS7_TEXT) { if (!SMIME_text(tmpout, out)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_SMIME_TEXT_ERROR); BIO_free(tmpout); goto err; } BIO_free(tmpout); } /* Now Verify All Signatures */ if (!(flags & PKCS7_NOSIGS)) for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(sinfos); i++) { si = sk_PKCS7_SIGNER_INFO_value(sinfos, i); signer = sk_X509_value(signers, i); j = PKCS7_signatureVerify(p7bio, p7, si, signer); if (j <= 0) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_SIGNATURE_FAILURE); goto err; } } ret = 1; err: X509_STORE_CTX_free(cert_ctx); OPENSSL_free(buf); if (indata != NULL) BIO_pop(p7bio); BIO_free_all(p7bio); sk_X509_free(signers); return ret; } STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) { STACK_OF(X509) *signers; STACK_OF(PKCS7_SIGNER_INFO) *sinfos; PKCS7_SIGNER_INFO *si; PKCS7_ISSUER_AND_SERIAL *ias; X509 *signer; int i; if (p7 == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_INVALID_NULL_POINTER); return NULL; } if (!PKCS7_type_is_signed(p7)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE); return NULL; } /* Collect all the signers together */ sinfos = PKCS7_get_signer_info(p7); if (sk_PKCS7_SIGNER_INFO_num(sinfos) <= 0) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_SIGNERS); return 0; } if ((signers = sk_X509_new_null()) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_CRYPTO_LIB); return NULL; } for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(sinfos); i++) { si = sk_PKCS7_SIGNER_INFO_value(sinfos, i); ias = si->issuer_and_serial; signer = NULL; /* If any certificates passed they take priority */ if (certs != NULL) signer = X509_find_by_issuer_and_serial(certs, ias->issuer, ias->serial); if (signer == NULL && !(flags & PKCS7_NOINTERN) && p7->d.sign->cert) signer = X509_find_by_issuer_and_serial(p7->d.sign->cert, ias->issuer, ias->serial); if (signer == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND); sk_X509_free(signers); return 0; } if (!sk_X509_push(signers, signer)) { sk_X509_free(signers); return NULL; } } return signers; } /* Build a complete PKCS#7 enveloped data */ PKCS7 *PKCS7_encrypt_ex(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, int flags, OSSL_LIB_CTX *libctx, const char *propq) { PKCS7 *p7; BIO *p7bio = NULL; int i; X509 *x509; if ((p7 = PKCS7_new_ex(libctx, propq)) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_PKCS7_LIB); return NULL; } if (!PKCS7_set_type(p7, NID_pkcs7_enveloped)) goto err; if (!PKCS7_set_cipher(p7, cipher)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_ERROR_SETTING_CIPHER); goto err; } for (i = 0; i < sk_X509_num(certs); i++) { x509 = sk_X509_value(certs, i); if (!PKCS7_add_recipient(p7, x509)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_ERROR_ADDING_RECIPIENT); goto err; } } if (flags & PKCS7_STREAM) return p7; if (PKCS7_final(p7, in, flags)) return p7; err: BIO_free_all(p7bio); PKCS7_free(p7); return NULL; } PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, int flags) { return PKCS7_encrypt_ex(certs, in, cipher, flags, NULL, NULL); } int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags) { BIO *tmpmem; int ret = 0, i; char *buf = NULL; if (p7 == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_INVALID_NULL_POINTER); return 0; } if (!PKCS7_type_is_enveloped(p7) && !PKCS7_type_is_signedAndEnveloped(p7)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE); return 0; } if (cert && !X509_check_private_key(cert, pkey)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE); return 0; } if ((tmpmem = PKCS7_dataDecode(p7, pkey, NULL, cert)) == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_DECRYPT_ERROR); return 0; } if (flags & PKCS7_TEXT) { BIO *tmpbuf, *bread; /* Encrypt BIOs can't do BIO_gets() so add a buffer BIO */ if ((tmpbuf = BIO_new(BIO_f_buffer())) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_BIO_LIB); BIO_free_all(tmpmem); return 0; } if ((bread = BIO_push(tmpbuf, tmpmem)) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_BIO_LIB); BIO_free_all(tmpbuf); BIO_free_all(tmpmem); return 0; } ret = SMIME_text(bread, data); if (ret > 0 && BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) { if (BIO_get_cipher_status(tmpmem) <= 0) ret = 0; } BIO_free_all(bread); return ret; } if ((buf = OPENSSL_malloc(BUFFERSIZE)) == NULL) goto err; for (;;) { i = BIO_read(tmpmem, buf, BUFFERSIZE); if (i <= 0) { ret = 1; if (BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) { if (BIO_get_cipher_status(tmpmem) <= 0) ret = 0; } break; } if (BIO_write(data, buf, i) != i) { break; } } err: OPENSSL_free(buf); BIO_free_all(tmpmem); return ret; }
./openssl/crypto/pkcs7/pk7_mime.c
/* * Copyright 1999-2021 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 */ #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/x509.h> #include <openssl/asn1.h> #include "pk7_local.h" /* PKCS#7 wrappers round generalised stream and MIME routines */ int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags) { return i2d_ASN1_bio_stream(out, (ASN1_VALUE *)p7, in, flags, ASN1_ITEM_rptr(PKCS7)); } int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags) { return PEM_write_bio_ASN1_stream(out, (ASN1_VALUE *)p7, in, flags, "PKCS7", ASN1_ITEM_rptr(PKCS7)); } int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags) { STACK_OF(X509_ALGOR) *mdalgs; int ctype_nid = OBJ_obj2nid(p7->type); const PKCS7_CTX *ctx = ossl_pkcs7_get0_ctx(p7); if (ctype_nid == NID_pkcs7_signed) mdalgs = p7->d.sign->md_algs; else mdalgs = NULL; flags ^= SMIME_OLDMIME; return SMIME_write_ASN1_ex(bio, (ASN1_VALUE *)p7, data, flags, ctype_nid, NID_undef, mdalgs, ASN1_ITEM_rptr(PKCS7), ossl_pkcs7_ctx_get0_libctx(ctx), ossl_pkcs7_ctx_get0_propq(ctx)); } PKCS7 *SMIME_read_PKCS7_ex(BIO *bio, BIO **bcont, PKCS7 **p7) { PKCS7 *ret; OSSL_LIB_CTX *libctx = NULL; const char *propq = NULL; if (p7 != NULL && *p7 != NULL) { libctx = (*p7)->ctx.libctx; propq = (*p7)->ctx.propq; } ret = (PKCS7 *)SMIME_read_ASN1_ex(bio, 0, bcont, ASN1_ITEM_rptr(PKCS7), (ASN1_VALUE **)p7, libctx, propq); if (ret != NULL) ossl_pkcs7_resolve_libctx(ret); return ret; } PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont) { return SMIME_read_PKCS7_ex(bio, bcont, NULL); }
./openssl/crypto/pkcs7/pk7_lib.c
/* * Copyright 1995-2023 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 */ #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/objects.h> #include <openssl/x509.h> #include <openssl/pkcs7.h> #include "crypto/asn1.h" #include "crypto/evp.h" #include "crypto/x509.h" /* for sk_X509_add1_cert() */ #include "pk7_local.h" long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg) { int nid; long ret; nid = OBJ_obj2nid(p7->type); switch (cmd) { /* NOTE(emilia): does not support detached digested data. */ case PKCS7_OP_SET_DETACHED_SIGNATURE: if (nid == NID_pkcs7_signed) { ret = p7->detached = (int)larg; if (ret && PKCS7_type_is_data(p7->d.sign->contents)) { ASN1_OCTET_STRING *os; os = p7->d.sign->contents->d.data; ASN1_OCTET_STRING_free(os); p7->d.sign->contents->d.data = NULL; } } else { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE); ret = 0; } break; case PKCS7_OP_GET_DETACHED_SIGNATURE: if (nid == NID_pkcs7_signed) { if (p7->d.sign == NULL || p7->d.sign->contents->d.ptr == NULL) ret = 1; else ret = 0; p7->detached = ret; } else { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE); ret = 0; } break; default: ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNKNOWN_OPERATION); ret = 0; } return ret; } int PKCS7_content_new(PKCS7 *p7, int type) { PKCS7 *ret = NULL; if ((ret = PKCS7_new()) == NULL) goto err; if (!PKCS7_set_type(ret, type)) goto err; if (!PKCS7_set_content(p7, ret)) goto err; return 1; err: PKCS7_free(ret); return 0; } int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data) { int i; i = OBJ_obj2nid(p7->type); switch (i) { case NID_pkcs7_signed: PKCS7_free(p7->d.sign->contents); p7->d.sign->contents = p7_data; break; case NID_pkcs7_digest: PKCS7_free(p7->d.digest->contents); p7->d.digest->contents = p7_data; break; case NID_pkcs7_data: case NID_pkcs7_enveloped: case NID_pkcs7_signedAndEnveloped: case NID_pkcs7_encrypted: default: ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CONTENT_TYPE); goto err; } return 1; err: return 0; } int PKCS7_set_type(PKCS7 *p7, int type) { ASN1_OBJECT *obj; /* * PKCS7_content_free(p7); */ obj = OBJ_nid2obj(type); /* will not fail */ switch (type) { case NID_pkcs7_signed: p7->type = obj; if ((p7->d.sign = PKCS7_SIGNED_new()) == NULL) goto err; if (!ASN1_INTEGER_set(p7->d.sign->version, 1)) { PKCS7_SIGNED_free(p7->d.sign); p7->d.sign = NULL; goto err; } break; case NID_pkcs7_data: p7->type = obj; if ((p7->d.data = ASN1_OCTET_STRING_new()) == NULL) goto err; break; case NID_pkcs7_signedAndEnveloped: p7->type = obj; if ((p7->d.signed_and_enveloped = PKCS7_SIGN_ENVELOPE_new()) == NULL) goto err; if (!ASN1_INTEGER_set(p7->d.signed_and_enveloped->version, 1)) goto err; p7->d.signed_and_enveloped->enc_data->content_type = OBJ_nid2obj(NID_pkcs7_data); break; case NID_pkcs7_enveloped: p7->type = obj; if ((p7->d.enveloped = PKCS7_ENVELOPE_new()) == NULL) goto err; if (!ASN1_INTEGER_set(p7->d.enveloped->version, 0)) goto err; p7->d.enveloped->enc_data->content_type = OBJ_nid2obj(NID_pkcs7_data); break; case NID_pkcs7_encrypted: p7->type = obj; if ((p7->d.encrypted = PKCS7_ENCRYPT_new()) == NULL) goto err; if (!ASN1_INTEGER_set(p7->d.encrypted->version, 0)) goto err; p7->d.encrypted->enc_data->content_type = OBJ_nid2obj(NID_pkcs7_data); break; case NID_pkcs7_digest: p7->type = obj; if ((p7->d.digest = PKCS7_DIGEST_new()) == NULL) goto err; if (!ASN1_INTEGER_set(p7->d.digest->version, 0)) goto err; break; default: ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CONTENT_TYPE); goto err; } return 1; err: return 0; } int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other) { p7->type = OBJ_nid2obj(type); p7->d.other = other; return 1; } int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *psi) { int i, j; ASN1_OBJECT *obj; X509_ALGOR *alg; STACK_OF(PKCS7_SIGNER_INFO) *signer_sk; STACK_OF(X509_ALGOR) *md_sk; i = OBJ_obj2nid(p7->type); switch (i) { case NID_pkcs7_signed: signer_sk = p7->d.sign->signer_info; md_sk = p7->d.sign->md_algs; break; case NID_pkcs7_signedAndEnveloped: signer_sk = p7->d.signed_and_enveloped->signer_info; md_sk = p7->d.signed_and_enveloped->md_algs; break; default: ERR_raise(ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE); return 0; } obj = psi->digest_alg->algorithm; /* If the digest is not currently listed, add it */ j = 0; for (i = 0; i < sk_X509_ALGOR_num(md_sk); i++) { alg = sk_X509_ALGOR_value(md_sk, i); if (OBJ_cmp(obj, alg->algorithm) == 0) { j = 1; break; } } if (!j) { /* we need to add another algorithm */ int nid; if ((alg = X509_ALGOR_new()) == NULL || (alg->parameter = ASN1_TYPE_new()) == NULL) { X509_ALGOR_free(alg); ERR_raise(ERR_LIB_PKCS7, ERR_R_ASN1_LIB); return 0; } /* * If there is a constant copy of the ASN1 OBJECT in libcrypto, then * use that. Otherwise, use a dynamically duplicated copy */ if ((nid = OBJ_obj2nid(obj)) != NID_undef) alg->algorithm = OBJ_nid2obj(nid); else alg->algorithm = OBJ_dup(obj); alg->parameter->type = V_ASN1_NULL; if (alg->algorithm == NULL || !sk_X509_ALGOR_push(md_sk, alg)) { X509_ALGOR_free(alg); return 0; } } psi->ctx = ossl_pkcs7_get0_ctx(p7); if (!sk_PKCS7_SIGNER_INFO_push(signer_sk, psi)) return 0; return 1; } int PKCS7_add_certificate(PKCS7 *p7, X509 *x509) { int i; STACK_OF(X509) **sk; i = OBJ_obj2nid(p7->type); switch (i) { case NID_pkcs7_signed: sk = &(p7->d.sign->cert); break; case NID_pkcs7_signedAndEnveloped: sk = &(p7->d.signed_and_enveloped->cert); break; default: ERR_raise(ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE); return 0; } return ossl_x509_add_cert_new(sk, x509, X509_ADD_FLAG_UP_REF); } int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl) { int i; STACK_OF(X509_CRL) **sk; i = OBJ_obj2nid(p7->type); switch (i) { case NID_pkcs7_signed: sk = &(p7->d.sign->crl); break; case NID_pkcs7_signedAndEnveloped: sk = &(p7->d.signed_and_enveloped->crl); break; default: ERR_raise(ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE); return 0; } if (*sk == NULL) *sk = sk_X509_CRL_new_null(); if (*sk == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_CRYPTO_LIB); return 0; } X509_CRL_up_ref(crl); if (!sk_X509_CRL_push(*sk, crl)) { X509_CRL_free(crl); return 0; } return 1; } static int pkcs7_ecdsa_or_dsa_sign_verify_setup(PKCS7_SIGNER_INFO *si, int verify) { if (!verify) { int snid, hnid; X509_ALGOR *alg1, *alg2; EVP_PKEY *pkey = si->pkey; PKCS7_SIGNER_INFO_get0_algs(si, NULL, &alg1, &alg2); if (alg1 == NULL || alg1->algorithm == NULL) return -1; hnid = OBJ_obj2nid(alg1->algorithm); if (hnid == NID_undef) return -1; if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_get_id(pkey))) return -1; return X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, NULL); } return 1; } static int pkcs7_rsa_sign_verify_setup(PKCS7_SIGNER_INFO *si, int verify) { if (!verify) { X509_ALGOR *alg = NULL; PKCS7_SIGNER_INFO_get0_algs(si, NULL, NULL, &alg); if (alg != NULL) return X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsaEncryption), V_ASN1_NULL, NULL); } return 1; } int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, const EVP_MD *dgst) { int ret; /* We now need to add another PKCS7_SIGNER_INFO entry */ if (!ASN1_INTEGER_set(p7i->version, 1)) return 0; if (!X509_NAME_set(&p7i->issuer_and_serial->issuer, X509_get_issuer_name(x509))) return 0; /* * because ASN1_INTEGER_set is used to set a 'long' we will do things the * ugly way. */ ASN1_INTEGER_free(p7i->issuer_and_serial->serial); if (!(p7i->issuer_and_serial->serial = ASN1_INTEGER_dup(X509_get0_serialNumber(x509)))) return 0; /* lets keep the pkey around for a while */ EVP_PKEY_up_ref(pkey); p7i->pkey = pkey; /* Set the algorithms */ if (!X509_ALGOR_set0(p7i->digest_alg, OBJ_nid2obj(EVP_MD_get_type(dgst)), V_ASN1_NULL, NULL)) return 0; if (EVP_PKEY_is_a(pkey, "EC") || EVP_PKEY_is_a(pkey, "DSA")) return pkcs7_ecdsa_or_dsa_sign_verify_setup(p7i, 0); if (EVP_PKEY_is_a(pkey, "RSA")) return pkcs7_rsa_sign_verify_setup(p7i, 0); if (pkey->ameth != NULL && pkey->ameth->pkey_ctrl != NULL) { ret = pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_PKCS7_SIGN, 0, p7i); if (ret > 0) return 1; if (ret != -2) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_SIGNING_CTRL_FAILURE); return 0; } } ERR_raise(ERR_LIB_PKCS7, PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE); return 0; } PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, EVP_PKEY *pkey, const EVP_MD *dgst) { PKCS7_SIGNER_INFO *si = NULL; if (dgst == NULL) { int def_nid; if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) <= 0) goto err; dgst = EVP_get_digestbynid(def_nid); if (dgst == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_DEFAULT_DIGEST); goto err; } } if ((si = PKCS7_SIGNER_INFO_new()) == NULL) goto err; if (PKCS7_SIGNER_INFO_set(si, x509, pkey, dgst) <= 0) goto err; if (!PKCS7_add_signer(p7, si)) goto err; return si; err: PKCS7_SIGNER_INFO_free(si); return NULL; } static STACK_OF(X509) *pkcs7_get_signer_certs(const PKCS7 *p7) { if (p7->d.ptr == NULL) return NULL; if (PKCS7_type_is_signed(p7)) return p7->d.sign->cert; if (PKCS7_type_is_signedAndEnveloped(p7)) return p7->d.signed_and_enveloped->cert; return NULL; } static STACK_OF(PKCS7_RECIP_INFO) *pkcs7_get_recipient_info(const PKCS7 *p7) { if (p7->d.ptr == NULL) return NULL; if (PKCS7_type_is_signedAndEnveloped(p7)) return p7->d.signed_and_enveloped->recipientinfo; if (PKCS7_type_is_enveloped(p7)) return p7->d.enveloped->recipientinfo; return NULL; } /* * Set up the library context into any loaded structure that needs it. * i.e loaded X509 objects. */ void ossl_pkcs7_resolve_libctx(PKCS7 *p7) { int i; const PKCS7_CTX *ctx = ossl_pkcs7_get0_ctx(p7); OSSL_LIB_CTX *libctx = ossl_pkcs7_ctx_get0_libctx(ctx); const char *propq = ossl_pkcs7_ctx_get0_propq(ctx); STACK_OF(PKCS7_RECIP_INFO) *rinfos; STACK_OF(PKCS7_SIGNER_INFO) *sinfos; STACK_OF(X509) *certs; if (ctx == NULL || p7->d.ptr == NULL) return; rinfos = pkcs7_get_recipient_info(p7); sinfos = PKCS7_get_signer_info(p7); certs = pkcs7_get_signer_certs(p7); for (i = 0; i < sk_X509_num(certs); i++) ossl_x509_set0_libctx(sk_X509_value(certs, i), libctx, propq); for (i = 0; i < sk_PKCS7_RECIP_INFO_num(rinfos); i++) { PKCS7_RECIP_INFO *ri = sk_PKCS7_RECIP_INFO_value(rinfos, i); ossl_x509_set0_libctx(ri->cert, libctx, propq); } for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(sinfos); i++) { PKCS7_SIGNER_INFO *si = sk_PKCS7_SIGNER_INFO_value(sinfos, i); if (si != NULL) si->ctx = ctx; } } const PKCS7_CTX *ossl_pkcs7_get0_ctx(const PKCS7 *p7) { return p7 != NULL ? &p7->ctx : NULL; } void ossl_pkcs7_set0_libctx(PKCS7 *p7, OSSL_LIB_CTX *ctx) { p7->ctx.libctx = ctx; } int ossl_pkcs7_set1_propq(PKCS7 *p7, const char *propq) { if (p7->ctx.propq != NULL) { OPENSSL_free(p7->ctx.propq); p7->ctx.propq = NULL; } if (propq != NULL) { p7->ctx.propq = OPENSSL_strdup(propq); if (p7->ctx.propq == NULL) return 0; } return 1; } int ossl_pkcs7_ctx_propagate(const PKCS7 *from, PKCS7 *to) { ossl_pkcs7_set0_libctx(to, from->ctx.libctx); if (!ossl_pkcs7_set1_propq(to, from->ctx.propq)) return 0; ossl_pkcs7_resolve_libctx(to); return 1; } OSSL_LIB_CTX *ossl_pkcs7_ctx_get0_libctx(const PKCS7_CTX *ctx) { return ctx != NULL ? ctx->libctx : NULL; } const char *ossl_pkcs7_ctx_get0_propq(const PKCS7_CTX *ctx) { return ctx != NULL ? ctx->propq : NULL; } int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md) { if (PKCS7_type_is_digest(p7)) { if ((p7->d.digest->md->parameter = ASN1_TYPE_new()) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_ASN1_LIB); return 0; } p7->d.digest->md->parameter->type = V_ASN1_NULL; p7->d.digest->md->algorithm = OBJ_nid2obj(EVP_MD_nid(md)); return 1; } ERR_raise(ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE); return 1; } STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7) { if (p7 == NULL || p7->d.ptr == NULL) return NULL; if (PKCS7_type_is_signed(p7)) { return p7->d.sign->signer_info; } else if (PKCS7_type_is_signedAndEnveloped(p7)) { return p7->d.signed_and_enveloped->signer_info; } else return NULL; } void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, X509_ALGOR **pdig, X509_ALGOR **psig) { if (pk) *pk = si->pkey; if (pdig) *pdig = si->digest_alg; if (psig) *psig = si->digest_enc_alg; } void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc) { if (penc) *penc = ri->key_enc_algor; } PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509) { PKCS7_RECIP_INFO *ri; if ((ri = PKCS7_RECIP_INFO_new()) == NULL) goto err; if (PKCS7_RECIP_INFO_set(ri, x509) <= 0) goto err; if (!PKCS7_add_recipient_info(p7, ri)) goto err; ri->ctx = ossl_pkcs7_get0_ctx(p7); return ri; err: PKCS7_RECIP_INFO_free(ri); return NULL; } int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri) { int i; STACK_OF(PKCS7_RECIP_INFO) *sk; i = OBJ_obj2nid(p7->type); switch (i) { case NID_pkcs7_signedAndEnveloped: sk = p7->d.signed_and_enveloped->recipientinfo; break; case NID_pkcs7_enveloped: sk = p7->d.enveloped->recipientinfo; break; default: ERR_raise(ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE); return 0; } if (!sk_PKCS7_RECIP_INFO_push(sk, ri)) return 0; return 1; } static int pkcs7_rsa_encrypt_decrypt_setup(PKCS7_RECIP_INFO *ri, int decrypt) { X509_ALGOR *alg = NULL; if (!decrypt) { PKCS7_RECIP_INFO_get0_alg(ri, &alg); if (alg != NULL) return X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsaEncryption), V_ASN1_NULL, NULL); } return 1; } int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) { int ret; EVP_PKEY *pkey = NULL; if (!ASN1_INTEGER_set(p7i->version, 0)) return 0; if (!X509_NAME_set(&p7i->issuer_and_serial->issuer, X509_get_issuer_name(x509))) return 0; ASN1_INTEGER_free(p7i->issuer_and_serial->serial); if (!(p7i->issuer_and_serial->serial = ASN1_INTEGER_dup(X509_get0_serialNumber(x509)))) return 0; pkey = X509_get0_pubkey(x509); if (pkey == NULL) return 0; if (EVP_PKEY_is_a(pkey, "RSA-PSS")) return -2; if (EVP_PKEY_is_a(pkey, "RSA")) { if (pkcs7_rsa_encrypt_decrypt_setup(p7i, 0) <= 0) goto err; goto finished; } if (pkey->ameth == NULL || pkey->ameth->pkey_ctrl == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE); goto err; } ret = pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_PKCS7_ENCRYPT, 0, p7i); if (ret == -2) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE); goto err; } if (ret <= 0) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_ENCRYPTION_CTRL_FAILURE); goto err; } finished: X509_up_ref(x509); p7i->cert = x509; return 1; err: return 0; } X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si) { if (PKCS7_type_is_signed(p7)) return (X509_find_by_issuer_and_serial(p7->d.sign->cert, si->issuer_and_serial->issuer, si-> issuer_and_serial->serial)); else return NULL; } int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher) { int i; PKCS7_ENC_CONTENT *ec; i = OBJ_obj2nid(p7->type); switch (i) { case NID_pkcs7_signedAndEnveloped: ec = p7->d.signed_and_enveloped->enc_data; break; case NID_pkcs7_enveloped: ec = p7->d.enveloped->enc_data; break; default: ERR_raise(ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE); return 0; } /* Check cipher OID exists and has data in it */ i = EVP_CIPHER_get_type(cipher); if (i == NID_undef) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER); return 0; } ec->cipher = cipher; ec->ctx = ossl_pkcs7_get0_ctx(p7); return 1; } /* unfortunately cannot constify BIO_new_NDEF() due to this and CMS_stream() */ int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7) { ASN1_OCTET_STRING *os = NULL; switch (OBJ_obj2nid(p7->type)) { case NID_pkcs7_data: os = p7->d.data; break; case NID_pkcs7_signedAndEnveloped: os = p7->d.signed_and_enveloped->enc_data->enc_data; if (os == NULL) { os = ASN1_OCTET_STRING_new(); p7->d.signed_and_enveloped->enc_data->enc_data = os; } break; case NID_pkcs7_enveloped: os = p7->d.enveloped->enc_data->enc_data; if (os == NULL) { os = ASN1_OCTET_STRING_new(); p7->d.enveloped->enc_data->enc_data = os; } break; case NID_pkcs7_signed: os = p7->d.sign->contents->d.data; break; default: os = NULL; break; } if (os == NULL) return 0; os->flags |= ASN1_STRING_FLAG_NDEF; *boundary = &os->data; return 1; }
./openssl/crypto/pkcs7/pk7_asn1.c
/* * Copyright 2000-2021 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 */ #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/asn1t.h> #include <openssl/pkcs7.h> #include <openssl/x509.h> #include "pk7_local.h" /* PKCS#7 ASN1 module */ /* This is the ANY DEFINED BY table for the top level PKCS#7 structure */ ASN1_ADB_TEMPLATE(p7default) = ASN1_EXP_OPT(PKCS7, d.other, ASN1_ANY, 0); ASN1_ADB(PKCS7) = { ADB_ENTRY(NID_pkcs7_data, ASN1_NDEF_EXP_OPT(PKCS7, d.data, ASN1_OCTET_STRING_NDEF, 0)), ADB_ENTRY(NID_pkcs7_signed, ASN1_NDEF_EXP_OPT(PKCS7, d.sign, PKCS7_SIGNED, 0)), ADB_ENTRY(NID_pkcs7_enveloped, ASN1_NDEF_EXP_OPT(PKCS7, d.enveloped, PKCS7_ENVELOPE, 0)), ADB_ENTRY(NID_pkcs7_signedAndEnveloped, ASN1_NDEF_EXP_OPT(PKCS7, d.signed_and_enveloped, PKCS7_SIGN_ENVELOPE, 0)), ADB_ENTRY(NID_pkcs7_digest, ASN1_NDEF_EXP_OPT(PKCS7, d.digest, PKCS7_DIGEST, 0)), ADB_ENTRY(NID_pkcs7_encrypted, ASN1_NDEF_EXP_OPT(PKCS7, d.encrypted, PKCS7_ENCRYPT, 0)) } ASN1_ADB_END(PKCS7, 0, type, 0, &p7default_tt, NULL); /* PKCS#7 streaming support */ static int pk7_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) { ASN1_STREAM_ARG *sarg = exarg; PKCS7 **pp7 = (PKCS7 **)pval; switch (operation) { case ASN1_OP_STREAM_PRE: if (PKCS7_stream(&sarg->boundary, *pp7) <= 0) return 0; /* fall through */ case ASN1_OP_DETACHED_PRE: sarg->ndef_bio = PKCS7_dataInit(*pp7, sarg->out); if (!sarg->ndef_bio) return 0; break; case ASN1_OP_STREAM_POST: case ASN1_OP_DETACHED_POST: if (PKCS7_dataFinal(*pp7, sarg->ndef_bio) <= 0) return 0; break; } return 1; } ASN1_NDEF_SEQUENCE_cb(PKCS7, pk7_cb) = { ASN1_SIMPLE(PKCS7, type, ASN1_OBJECT), ASN1_ADB_OBJECT(PKCS7) }ASN1_NDEF_SEQUENCE_END_cb(PKCS7, PKCS7) PKCS7 *d2i_PKCS7(PKCS7 **a, const unsigned char **in, long len) { PKCS7 *ret; OSSL_LIB_CTX *libctx = NULL; const char *propq = NULL; if (a != NULL && *a != NULL) { libctx = (*a)->ctx.libctx; propq = (*a)->ctx.propq; } ret = (PKCS7 *)ASN1_item_d2i_ex((ASN1_VALUE **)a, in, len, (PKCS7_it()), libctx, propq); if (ret != NULL) ossl_pkcs7_resolve_libctx(ret); return ret; } int i2d_PKCS7(const PKCS7 *a, unsigned char **out) { return ASN1_item_i2d((const ASN1_VALUE *)a, out, (PKCS7_it()));\ } PKCS7 *PKCS7_new(void) { return (PKCS7 *)ASN1_item_new(ASN1_ITEM_rptr(PKCS7)); } PKCS7 *PKCS7_new_ex(OSSL_LIB_CTX *libctx, const char *propq) { PKCS7 *pkcs7 = (PKCS7 *)ASN1_item_new_ex(ASN1_ITEM_rptr(PKCS7), libctx, propq); if (pkcs7 != NULL) { pkcs7->ctx.libctx = libctx; pkcs7->ctx.propq = NULL; if (propq != NULL) { pkcs7->ctx.propq = OPENSSL_strdup(propq); if (pkcs7->ctx.propq == NULL) { PKCS7_free(pkcs7); pkcs7 = NULL; } } } return pkcs7; } void PKCS7_free(PKCS7 *p7) { if (p7 != NULL) { OPENSSL_free(p7->ctx.propq); ASN1_item_free((ASN1_VALUE *)p7, ASN1_ITEM_rptr(PKCS7)); } } IMPLEMENT_ASN1_NDEF_FUNCTION(PKCS7) IMPLEMENT_ASN1_DUP_FUNCTION(PKCS7) ASN1_NDEF_SEQUENCE(PKCS7_SIGNED) = { ASN1_SIMPLE(PKCS7_SIGNED, version, ASN1_INTEGER), ASN1_SET_OF(PKCS7_SIGNED, md_algs, X509_ALGOR), ASN1_SIMPLE(PKCS7_SIGNED, contents, PKCS7), ASN1_IMP_SEQUENCE_OF_OPT(PKCS7_SIGNED, cert, X509, 0), ASN1_IMP_SET_OF_OPT(PKCS7_SIGNED, crl, X509_CRL, 1), ASN1_SET_OF(PKCS7_SIGNED, signer_info, PKCS7_SIGNER_INFO) } ASN1_NDEF_SEQUENCE_END(PKCS7_SIGNED) IMPLEMENT_ASN1_FUNCTIONS(PKCS7_SIGNED) /* Minor tweak to operation: free up EVP_PKEY */ static int si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) { if (operation == ASN1_OP_FREE_POST) { PKCS7_SIGNER_INFO *si = (PKCS7_SIGNER_INFO *)*pval; EVP_PKEY_free(si->pkey); } return 1; } ASN1_SEQUENCE_cb(PKCS7_SIGNER_INFO, si_cb) = { ASN1_SIMPLE(PKCS7_SIGNER_INFO, version, ASN1_INTEGER), ASN1_SIMPLE(PKCS7_SIGNER_INFO, issuer_and_serial, PKCS7_ISSUER_AND_SERIAL), ASN1_SIMPLE(PKCS7_SIGNER_INFO, digest_alg, X509_ALGOR), /* NB this should be a SET OF but we use a SEQUENCE OF so the * original order * is retained when the structure is reencoded. * Since the attributes are implicitly tagged this will not affect * the encoding. */ ASN1_IMP_SEQUENCE_OF_OPT(PKCS7_SIGNER_INFO, auth_attr, X509_ATTRIBUTE, 0), ASN1_SIMPLE(PKCS7_SIGNER_INFO, digest_enc_alg, X509_ALGOR), ASN1_SIMPLE(PKCS7_SIGNER_INFO, enc_digest, ASN1_OCTET_STRING), ASN1_IMP_SET_OF_OPT(PKCS7_SIGNER_INFO, unauth_attr, X509_ATTRIBUTE, 1) } ASN1_SEQUENCE_END_cb(PKCS7_SIGNER_INFO, PKCS7_SIGNER_INFO) IMPLEMENT_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) ASN1_SEQUENCE(PKCS7_ISSUER_AND_SERIAL) = { ASN1_SIMPLE(PKCS7_ISSUER_AND_SERIAL, issuer, X509_NAME), ASN1_SIMPLE(PKCS7_ISSUER_AND_SERIAL, serial, ASN1_INTEGER) } ASN1_SEQUENCE_END(PKCS7_ISSUER_AND_SERIAL) IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) ASN1_NDEF_SEQUENCE(PKCS7_ENVELOPE) = { ASN1_SIMPLE(PKCS7_ENVELOPE, version, ASN1_INTEGER), ASN1_SET_OF(PKCS7_ENVELOPE, recipientinfo, PKCS7_RECIP_INFO), ASN1_SIMPLE(PKCS7_ENVELOPE, enc_data, PKCS7_ENC_CONTENT) } ASN1_NDEF_SEQUENCE_END(PKCS7_ENVELOPE) IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENVELOPE) /* Minor tweak to operation: free up X509 */ static int ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) { if (operation == ASN1_OP_FREE_POST) { PKCS7_RECIP_INFO *ri = (PKCS7_RECIP_INFO *)*pval; X509_free(ri->cert); } return 1; } ASN1_SEQUENCE_cb(PKCS7_RECIP_INFO, ri_cb) = { ASN1_SIMPLE(PKCS7_RECIP_INFO, version, ASN1_INTEGER), ASN1_SIMPLE(PKCS7_RECIP_INFO, issuer_and_serial, PKCS7_ISSUER_AND_SERIAL), ASN1_SIMPLE(PKCS7_RECIP_INFO, key_enc_algor, X509_ALGOR), ASN1_SIMPLE(PKCS7_RECIP_INFO, enc_key, ASN1_OCTET_STRING) } ASN1_SEQUENCE_END_cb(PKCS7_RECIP_INFO, PKCS7_RECIP_INFO) IMPLEMENT_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) ASN1_NDEF_SEQUENCE(PKCS7_ENC_CONTENT) = { ASN1_SIMPLE(PKCS7_ENC_CONTENT, content_type, ASN1_OBJECT), ASN1_SIMPLE(PKCS7_ENC_CONTENT, algorithm, X509_ALGOR), ASN1_IMP_OPT(PKCS7_ENC_CONTENT, enc_data, ASN1_OCTET_STRING_NDEF, 0) } ASN1_NDEF_SEQUENCE_END(PKCS7_ENC_CONTENT) IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) ASN1_NDEF_SEQUENCE(PKCS7_SIGN_ENVELOPE) = { ASN1_SIMPLE(PKCS7_SIGN_ENVELOPE, version, ASN1_INTEGER), ASN1_SET_OF(PKCS7_SIGN_ENVELOPE, recipientinfo, PKCS7_RECIP_INFO), ASN1_SET_OF(PKCS7_SIGN_ENVELOPE, md_algs, X509_ALGOR), ASN1_SIMPLE(PKCS7_SIGN_ENVELOPE, enc_data, PKCS7_ENC_CONTENT), ASN1_IMP_SET_OF_OPT(PKCS7_SIGN_ENVELOPE, cert, X509, 0), ASN1_IMP_SET_OF_OPT(PKCS7_SIGN_ENVELOPE, crl, X509_CRL, 1), ASN1_SET_OF(PKCS7_SIGN_ENVELOPE, signer_info, PKCS7_SIGNER_INFO) } ASN1_NDEF_SEQUENCE_END(PKCS7_SIGN_ENVELOPE) IMPLEMENT_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) ASN1_NDEF_SEQUENCE(PKCS7_ENCRYPT) = { ASN1_SIMPLE(PKCS7_ENCRYPT, version, ASN1_INTEGER), ASN1_SIMPLE(PKCS7_ENCRYPT, enc_data, PKCS7_ENC_CONTENT) } ASN1_NDEF_SEQUENCE_END(PKCS7_ENCRYPT) IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENCRYPT) ASN1_NDEF_SEQUENCE(PKCS7_DIGEST) = { ASN1_SIMPLE(PKCS7_DIGEST, version, ASN1_INTEGER), ASN1_SIMPLE(PKCS7_DIGEST, md, X509_ALGOR), ASN1_SIMPLE(PKCS7_DIGEST, contents, PKCS7), ASN1_SIMPLE(PKCS7_DIGEST, digest, ASN1_OCTET_STRING) } ASN1_NDEF_SEQUENCE_END(PKCS7_DIGEST) IMPLEMENT_ASN1_FUNCTIONS(PKCS7_DIGEST) /* Specials for authenticated attributes */ /* * When signing attributes we want to reorder them to match the sorted * encoding. */ ASN1_ITEM_TEMPLATE(PKCS7_ATTR_SIGN) = ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SET_ORDER, 0, PKCS7_ATTRIBUTES, X509_ATTRIBUTE) ASN1_ITEM_TEMPLATE_END(PKCS7_ATTR_SIGN) /* * When verifying attributes we need to use the received order. So we use * SEQUENCE OF and tag it to SET OF */ ASN1_ITEM_TEMPLATE(PKCS7_ATTR_VERIFY) = ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_IMPTAG | ASN1_TFLG_UNIVERSAL, V_ASN1_SET, PKCS7_ATTRIBUTES, X509_ATTRIBUTE) ASN1_ITEM_TEMPLATE_END(PKCS7_ATTR_VERIFY) IMPLEMENT_ASN1_PRINT_FUNCTION(PKCS7)
./openssl/crypto/pkcs7/pk7_local.h
/* * Copyright 2020-2021 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 */ #include "crypto/pkcs7.h" const PKCS7_CTX *ossl_pkcs7_get0_ctx(const PKCS7 *p7); OSSL_LIB_CTX *ossl_pkcs7_ctx_get0_libctx(const PKCS7_CTX *ctx); const char *ossl_pkcs7_ctx_get0_propq(const PKCS7_CTX *ctx); int ossl_pkcs7_ctx_propagate(const PKCS7 *from, PKCS7 *to);
./openssl/crypto/pkcs7/pkcs7err.c
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 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 */ #include <openssl/err.h> #include <openssl/pkcs7err.h> #include "crypto/pkcs7err.h" #ifndef OPENSSL_NO_ERR static const ERR_STRING_DATA PKCS7_str_reasons[] = { {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER), "cipher has no object identifier"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_CIPHER_NOT_INITIALIZED), "cipher not initialized"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_CONTENT_AND_DATA_PRESENT), "content and data present"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_CTRL_ERROR), "ctrl error"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_DECRYPT_ERROR), "decrypt error"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_DIGEST_FAILURE), "digest failure"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_ENCRYPTION_CTRL_FAILURE), "encryption ctrl failure"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE), "encryption not supported for this key type"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_ERROR_ADDING_RECIPIENT), "error adding recipient"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_ERROR_SETTING_CIPHER), "error setting cipher"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_INVALID_NULL_POINTER), "invalid null pointer"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_INVALID_SIGNED_DATA_TYPE), "invalid signed data type"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_NO_CONTENT), "no content"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_NO_DEFAULT_DIGEST), "no default digest"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND), "no matching digest type found"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE), "no recipient matches certificate"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_NO_SIGNATURES_ON_DATA), "no signatures on data"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_NO_SIGNERS), "no signers"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE), "operation not supported on this type"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR), "pkcs7 add signature error"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_PKCS7_ADD_SIGNER_ERROR), "pkcs7 add signer error"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_PKCS7_DATASIGN), "pkcs7 datasign"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE), "private key does not match certificate"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_SIGNATURE_FAILURE), "signature failure"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND), "signer certificate not found"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_SIGNING_CTRL_FAILURE), "signing ctrl failure"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE), "signing not supported for this key type"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_SMIME_TEXT_ERROR), "smime text error"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_UNABLE_TO_FIND_CERTIFICATE), "unable to find certificate"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_UNABLE_TO_FIND_MEM_BIO), "unable to find mem bio"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST), "unable to find message digest"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_UNKNOWN_DIGEST_TYPE), "unknown digest type"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_UNKNOWN_OPERATION), "unknown operation"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_UNSUPPORTED_CIPHER_TYPE), "unsupported cipher type"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_UNSUPPORTED_CONTENT_TYPE), "unsupported content type"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_WRONG_CONTENT_TYPE), "wrong content type"}, {ERR_PACK(ERR_LIB_PKCS7, 0, PKCS7_R_WRONG_PKCS7_TYPE), "wrong pkcs7 type"}, {0, NULL} }; #endif int ossl_err_load_PKCS7_strings(void) { #ifndef OPENSSL_NO_ERR if (ERR_reason_error_string(PKCS7_str_reasons[0].error) == NULL) ERR_load_strings_const(PKCS7_str_reasons); #endif return 1; }
./openssl/crypto/pkcs7/pk7_doit.c
/* * Copyright 1995-2023 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 */ #include <stdio.h> #include <openssl/rand.h> #include <openssl/objects.h> #include <openssl/x509.h> #include <openssl/x509v3.h> #include <openssl/err.h> #include "internal/cryptlib.h" #include "internal/sizes.h" #include "crypto/evp.h" #include "pk7_local.h" static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, void *value); static ASN1_TYPE *get_attribute(const STACK_OF(X509_ATTRIBUTE) *sk, int nid); int PKCS7_type_is_other(PKCS7 *p7) { int isOther = 1; int nid = OBJ_obj2nid(p7->type); switch (nid) { case NID_pkcs7_data: case NID_pkcs7_signed: case NID_pkcs7_enveloped: case NID_pkcs7_signedAndEnveloped: case NID_pkcs7_digest: case NID_pkcs7_encrypted: isOther = 0; break; default: isOther = 1; } return isOther; } ASN1_OCTET_STRING *PKCS7_get_octet_string(PKCS7 *p7) { if (PKCS7_type_is_data(p7)) return p7->d.data; if (PKCS7_type_is_other(p7) && p7->d.other && (p7->d.other->type == V_ASN1_OCTET_STRING)) return p7->d.other->value.octet_string; return NULL; } static int pkcs7_bio_add_digest(BIO **pbio, X509_ALGOR *alg, const PKCS7_CTX *ctx) { BIO *btmp; char name[OSSL_MAX_NAME_SIZE]; EVP_MD *fetched = NULL; const EVP_MD *md; if ((btmp = BIO_new(BIO_f_md())) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_BIO_LIB); goto err; } OBJ_obj2txt(name, sizeof(name), alg->algorithm, 0); (void)ERR_set_mark(); fetched = EVP_MD_fetch(ossl_pkcs7_ctx_get0_libctx(ctx), name, ossl_pkcs7_ctx_get0_propq(ctx)); if (fetched != NULL) md = fetched; else md = EVP_get_digestbyname(name); if (md == NULL) { (void)ERR_clear_last_mark(); ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNKNOWN_DIGEST_TYPE); goto err; } (void)ERR_pop_to_mark(); if (BIO_set_md(btmp, md) <= 0) { ERR_raise(ERR_LIB_PKCS7, ERR_R_BIO_LIB); EVP_MD_free(fetched); goto err; } EVP_MD_free(fetched); if (*pbio == NULL) *pbio = btmp; else if (!BIO_push(*pbio, btmp)) { ERR_raise(ERR_LIB_PKCS7, ERR_R_BIO_LIB); goto err; } btmp = NULL; return 1; err: BIO_free(btmp); return 0; } static int pkcs7_encode_rinfo(PKCS7_RECIP_INFO *ri, unsigned char *key, int keylen) { EVP_PKEY_CTX *pctx = NULL; EVP_PKEY *pkey = NULL; unsigned char *ek = NULL; int ret = 0; size_t eklen; const PKCS7_CTX *ctx = ri->ctx; pkey = X509_get0_pubkey(ri->cert); if (pkey == NULL) return 0; pctx = EVP_PKEY_CTX_new_from_pkey(ossl_pkcs7_ctx_get0_libctx(ctx), pkey, ossl_pkcs7_ctx_get0_propq(ctx)); if (pctx == NULL) return 0; if (EVP_PKEY_encrypt_init(pctx) <= 0) goto err; if (EVP_PKEY_encrypt(pctx, NULL, &eklen, key, keylen) <= 0) goto err; ek = OPENSSL_malloc(eklen); if (ek == NULL) goto err; if (EVP_PKEY_encrypt(pctx, ek, &eklen, key, keylen) <= 0) goto err; ASN1_STRING_set0(ri->enc_key, ek, eklen); ek = NULL; ret = 1; err: EVP_PKEY_CTX_free(pctx); OPENSSL_free(ek); return ret; } static int pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen, PKCS7_RECIP_INFO *ri, EVP_PKEY *pkey, size_t fixlen) { EVP_PKEY_CTX *pctx = NULL; unsigned char *ek = NULL; size_t eklen; int ret = -1; const PKCS7_CTX *ctx = ri->ctx; pctx = EVP_PKEY_CTX_new_from_pkey(ossl_pkcs7_ctx_get0_libctx(ctx), pkey, ossl_pkcs7_ctx_get0_propq(ctx)); if (pctx == NULL) return -1; if (EVP_PKEY_decrypt_init(pctx) <= 0) goto err; if (EVP_PKEY_is_a(pkey, "RSA")) /* upper layer pkcs7 code incorrectly assumes that a successful RSA * decryption means that the key matches ciphertext (which never * was the case, implicit rejection or not), so to make it work * disable implicit rejection for RSA keys */ EVP_PKEY_CTX_ctrl_str(pctx, "rsa_pkcs1_implicit_rejection", "0"); ret = evp_pkey_decrypt_alloc(pctx, &ek, &eklen, fixlen, ri->enc_key->data, ri->enc_key->length); if (ret <= 0) goto err; ret = 1; OPENSSL_clear_free(*pek, *peklen); *pek = ek; *peklen = eklen; err: EVP_PKEY_CTX_free(pctx); if (!ret) OPENSSL_free(ek); return ret; } BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) { int i; BIO *out = NULL, *btmp = NULL; X509_ALGOR *xa = NULL; EVP_CIPHER *fetched_cipher = NULL; const EVP_CIPHER *cipher; const EVP_CIPHER *evp_cipher = NULL; STACK_OF(X509_ALGOR) *md_sk = NULL; STACK_OF(PKCS7_RECIP_INFO) *rsk = NULL; X509_ALGOR *xalg = NULL; PKCS7_RECIP_INFO *ri = NULL; ASN1_OCTET_STRING *os = NULL; const PKCS7_CTX *p7_ctx; OSSL_LIB_CTX *libctx; const char *propq; if (p7 == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_INVALID_NULL_POINTER); return NULL; } p7_ctx = ossl_pkcs7_get0_ctx(p7); libctx = ossl_pkcs7_ctx_get0_libctx(p7_ctx); propq = ossl_pkcs7_ctx_get0_propq(p7_ctx); /* * The content field in the PKCS7 ContentInfo is optional, but that really * only applies to inner content (precisely, detached signatures). * * When reading content, missing outer content is therefore treated as an * error. * * When creating content, PKCS7_content_new() must be called before * calling this method, so a NULL p7->d is always an error. */ if (p7->d.ptr == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT); return NULL; } i = OBJ_obj2nid(p7->type); p7->state = PKCS7_S_HEADER; switch (i) { case NID_pkcs7_signed: md_sk = p7->d.sign->md_algs; os = PKCS7_get_octet_string(p7->d.sign->contents); break; case NID_pkcs7_signedAndEnveloped: rsk = p7->d.signed_and_enveloped->recipientinfo; md_sk = p7->d.signed_and_enveloped->md_algs; xalg = p7->d.signed_and_enveloped->enc_data->algorithm; evp_cipher = p7->d.signed_and_enveloped->enc_data->cipher; if (evp_cipher == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_CIPHER_NOT_INITIALIZED); goto err; } break; case NID_pkcs7_enveloped: rsk = p7->d.enveloped->recipientinfo; xalg = p7->d.enveloped->enc_data->algorithm; evp_cipher = p7->d.enveloped->enc_data->cipher; if (evp_cipher == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_CIPHER_NOT_INITIALIZED); goto err; } break; case NID_pkcs7_digest: xa = p7->d.digest->md; os = PKCS7_get_octet_string(p7->d.digest->contents); break; case NID_pkcs7_data: break; default: ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CONTENT_TYPE); goto err; } for (i = 0; i < sk_X509_ALGOR_num(md_sk); i++) if (!pkcs7_bio_add_digest(&out, sk_X509_ALGOR_value(md_sk, i), p7_ctx)) goto err; if (xa && !pkcs7_bio_add_digest(&out, xa, p7_ctx)) goto err; if (evp_cipher != NULL) { unsigned char key[EVP_MAX_KEY_LENGTH]; unsigned char iv[EVP_MAX_IV_LENGTH]; int keylen, ivlen; EVP_CIPHER_CTX *ctx; if ((btmp = BIO_new(BIO_f_cipher())) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_BIO_LIB); goto err; } BIO_get_cipher_ctx(btmp, &ctx); keylen = EVP_CIPHER_get_key_length(evp_cipher); ivlen = EVP_CIPHER_get_iv_length(evp_cipher); xalg->algorithm = OBJ_nid2obj(EVP_CIPHER_get_type(evp_cipher)); if (ivlen > 0) if (RAND_bytes_ex(libctx, iv, ivlen, 0) <= 0) goto err; (void)ERR_set_mark(); fetched_cipher = EVP_CIPHER_fetch(libctx, EVP_CIPHER_get0_name(evp_cipher), propq); (void)ERR_pop_to_mark(); if (fetched_cipher != NULL) cipher = fetched_cipher; else cipher = evp_cipher; if (EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, 1) <= 0) goto err; EVP_CIPHER_free(fetched_cipher); fetched_cipher = NULL; if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0) goto err; if (EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, 1) <= 0) goto err; if (ivlen > 0) { if (xalg->parameter == NULL) { xalg->parameter = ASN1_TYPE_new(); if (xalg->parameter == NULL) goto err; } if (EVP_CIPHER_param_to_asn1(ctx, xalg->parameter) <= 0) goto err; } /* Lets do the pub key stuff :-) */ for (i = 0; i < sk_PKCS7_RECIP_INFO_num(rsk); i++) { ri = sk_PKCS7_RECIP_INFO_value(rsk, i); if (pkcs7_encode_rinfo(ri, key, keylen) <= 0) goto err; } OPENSSL_cleanse(key, keylen); if (out == NULL) out = btmp; else BIO_push(out, btmp); btmp = NULL; } if (bio == NULL) { if (PKCS7_is_detached(p7)) { bio = BIO_new(BIO_s_null()); } else if (os && os->length > 0) { bio = BIO_new_mem_buf(os->data, os->length); } else { bio = BIO_new(BIO_s_mem()); if (bio == NULL) goto err; BIO_set_mem_eof_return(bio, 0); } if (bio == NULL) goto err; } if (out) BIO_push(out, bio); else out = bio; return out; err: EVP_CIPHER_free(fetched_cipher); BIO_free_all(out); BIO_free_all(btmp); return NULL; } static int pkcs7_cmp_ri(PKCS7_RECIP_INFO *ri, X509 *pcert) { int ret; ret = X509_NAME_cmp(ri->issuer_and_serial->issuer, X509_get_issuer_name(pcert)); if (ret) return ret; return ASN1_INTEGER_cmp(X509_get0_serialNumber(pcert), ri->issuer_and_serial->serial); } /* int */ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) { int i, len; BIO *out = NULL, *btmp = NULL, *etmp = NULL, *bio = NULL; X509_ALGOR *xa; ASN1_OCTET_STRING *data_body = NULL; EVP_MD *evp_md = NULL; const EVP_MD *md; EVP_CIPHER *evp_cipher = NULL; const EVP_CIPHER *cipher = NULL; EVP_CIPHER_CTX *evp_ctx = NULL; X509_ALGOR *enc_alg = NULL; STACK_OF(X509_ALGOR) *md_sk = NULL; STACK_OF(PKCS7_RECIP_INFO) *rsk = NULL; PKCS7_RECIP_INFO *ri = NULL; unsigned char *ek = NULL, *tkey = NULL; int eklen = 0, tkeylen = 0; char name[OSSL_MAX_NAME_SIZE]; const PKCS7_CTX *p7_ctx; OSSL_LIB_CTX *libctx; const char *propq; if (p7 == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_INVALID_NULL_POINTER); return NULL; } p7_ctx = ossl_pkcs7_get0_ctx(p7); libctx = ossl_pkcs7_ctx_get0_libctx(p7_ctx); propq = ossl_pkcs7_ctx_get0_propq(p7_ctx); if (p7->d.ptr == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT); return NULL; } i = OBJ_obj2nid(p7->type); p7->state = PKCS7_S_HEADER; switch (i) { case NID_pkcs7_signed: /* * p7->d.sign->contents is a PKCS7 structure consisting of a contentType * field and optional content. * data_body is NULL if that structure has no (=detached) content * or if the contentType is wrong (i.e., not "data"). */ data_body = PKCS7_get_octet_string(p7->d.sign->contents); if (!PKCS7_is_detached(p7) && data_body == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_INVALID_SIGNED_DATA_TYPE); goto err; } md_sk = p7->d.sign->md_algs; break; case NID_pkcs7_signedAndEnveloped: rsk = p7->d.signed_and_enveloped->recipientinfo; md_sk = p7->d.signed_and_enveloped->md_algs; /* data_body is NULL if the optional EncryptedContent is missing. */ data_body = p7->d.signed_and_enveloped->enc_data->enc_data; enc_alg = p7->d.signed_and_enveloped->enc_data->algorithm; OBJ_obj2txt(name, sizeof(name), enc_alg->algorithm, 0); (void)ERR_set_mark(); evp_cipher = EVP_CIPHER_fetch(libctx, name, propq); if (evp_cipher != NULL) cipher = evp_cipher; else cipher = EVP_get_cipherbyname(name); if (cipher == NULL) { (void)ERR_clear_last_mark(); ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CIPHER_TYPE); goto err; } (void)ERR_pop_to_mark(); break; case NID_pkcs7_enveloped: rsk = p7->d.enveloped->recipientinfo; enc_alg = p7->d.enveloped->enc_data->algorithm; /* data_body is NULL if the optional EncryptedContent is missing. */ data_body = p7->d.enveloped->enc_data->enc_data; OBJ_obj2txt(name, sizeof(name), enc_alg->algorithm, 0); (void)ERR_set_mark(); evp_cipher = EVP_CIPHER_fetch(libctx, name, propq); if (evp_cipher != NULL) cipher = evp_cipher; else cipher = EVP_get_cipherbyname(name); if (cipher == NULL) { (void)ERR_clear_last_mark(); ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CIPHER_TYPE); goto err; } (void)ERR_pop_to_mark(); break; default: ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CONTENT_TYPE); goto err; } /* Detached content must be supplied via in_bio instead. */ if (data_body == NULL && in_bio == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT); goto err; } /* We will be checking the signature */ if (md_sk != NULL) { for (i = 0; i < sk_X509_ALGOR_num(md_sk); i++) { xa = sk_X509_ALGOR_value(md_sk, i); if ((btmp = BIO_new(BIO_f_md())) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_BIO_LIB); goto err; } OBJ_obj2txt(name, sizeof(name), xa->algorithm, 0); (void)ERR_set_mark(); evp_md = EVP_MD_fetch(libctx, name, propq); if (evp_md != NULL) md = evp_md; else md = EVP_get_digestbyname(name); if (md == NULL) { (void)ERR_clear_last_mark(); ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNKNOWN_DIGEST_TYPE); goto err; } (void)ERR_pop_to_mark(); if (BIO_set_md(btmp, md) <= 0) { EVP_MD_free(evp_md); ERR_raise(ERR_LIB_PKCS7, ERR_R_BIO_LIB); goto err; } EVP_MD_free(evp_md); if (out == NULL) out = btmp; else BIO_push(out, btmp); btmp = NULL; } } if (cipher != NULL) { if ((etmp = BIO_new(BIO_f_cipher())) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_BIO_LIB); goto err; } /* * It was encrypted, we need to decrypt the secret key with the * private key */ /* * Find the recipientInfo which matches the passed certificate (if * any) */ if (pcert) { for (i = 0; i < sk_PKCS7_RECIP_INFO_num(rsk); i++) { ri = sk_PKCS7_RECIP_INFO_value(rsk, i); if (!pkcs7_cmp_ri(ri, pcert)) break; ri = NULL; } if (ri == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE); goto err; } } /* If we haven't got a certificate try each ri in turn */ if (pcert == NULL) { /* * Always attempt to decrypt all rinfo even after success as a * defence against MMA timing attacks. */ for (i = 0; i < sk_PKCS7_RECIP_INFO_num(rsk); i++) { ri = sk_PKCS7_RECIP_INFO_value(rsk, i); ri->ctx = p7_ctx; if (pkcs7_decrypt_rinfo(&ek, &eklen, ri, pkey, EVP_CIPHER_get_key_length(cipher)) < 0) goto err; ERR_clear_error(); } } else { ri->ctx = p7_ctx; /* Only exit on fatal errors, not decrypt failure */ if (pkcs7_decrypt_rinfo(&ek, &eklen, ri, pkey, 0) < 0) goto err; ERR_clear_error(); } evp_ctx = NULL; BIO_get_cipher_ctx(etmp, &evp_ctx); if (EVP_CipherInit_ex(evp_ctx, cipher, NULL, NULL, NULL, 0) <= 0) goto err; if (EVP_CIPHER_asn1_to_param(evp_ctx, enc_alg->parameter) <= 0) goto err; /* Generate random key as MMA defence */ len = EVP_CIPHER_CTX_get_key_length(evp_ctx); if (len <= 0) goto err; tkeylen = (size_t)len; tkey = OPENSSL_malloc(tkeylen); if (tkey == NULL) goto err; if (EVP_CIPHER_CTX_rand_key(evp_ctx, tkey) <= 0) goto err; if (ek == NULL) { ek = tkey; eklen = tkeylen; tkey = NULL; } if (eklen != EVP_CIPHER_CTX_get_key_length(evp_ctx)) { /* * Some S/MIME clients don't use the same key and effective key * length. The key length is determined by the size of the * decrypted RSA key. */ if (EVP_CIPHER_CTX_set_key_length(evp_ctx, eklen) <= 0) { /* Use random key as MMA defence */ OPENSSL_clear_free(ek, eklen); ek = tkey; eklen = tkeylen; tkey = NULL; } } /* Clear errors so we don't leak information useful in MMA */ ERR_clear_error(); if (EVP_CipherInit_ex(evp_ctx, NULL, NULL, ek, NULL, 0) <= 0) goto err; OPENSSL_clear_free(ek, eklen); ek = NULL; OPENSSL_clear_free(tkey, tkeylen); tkey = NULL; if (out == NULL) out = etmp; else BIO_push(out, etmp); etmp = NULL; } if (in_bio != NULL) { bio = in_bio; } else { if (data_body->length > 0) bio = BIO_new_mem_buf(data_body->data, data_body->length); else { bio = BIO_new(BIO_s_mem()); if (bio == NULL) goto err; BIO_set_mem_eof_return(bio, 0); } if (bio == NULL) goto err; } BIO_push(out, bio); bio = NULL; EVP_CIPHER_free(evp_cipher); return out; err: EVP_CIPHER_free(evp_cipher); OPENSSL_clear_free(ek, eklen); OPENSSL_clear_free(tkey, tkeylen); BIO_free_all(out); BIO_free_all(btmp); BIO_free_all(etmp); BIO_free_all(bio); return NULL; } static BIO *PKCS7_find_digest(EVP_MD_CTX **pmd, BIO *bio, int nid) { for (;;) { bio = BIO_find_type(bio, BIO_TYPE_MD); if (bio == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST); return NULL; } BIO_get_md_ctx(bio, pmd); if (*pmd == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_INTERNAL_ERROR); return NULL; } if (EVP_MD_CTX_get_type(*pmd) == nid) return bio; bio = BIO_next(bio); } return NULL; } static int do_pkcs7_signed_attrib(PKCS7_SIGNER_INFO *si, EVP_MD_CTX *mctx) { unsigned char md_data[EVP_MAX_MD_SIZE]; unsigned int md_len; /* Add signing time if not already present */ if (!PKCS7_get_signed_attribute(si, NID_pkcs9_signingTime)) { if (!PKCS7_add0_attrib_signing_time(si, NULL)) { ERR_raise(ERR_LIB_PKCS7, ERR_R_PKCS7_LIB); return 0; } } /* Add digest */ if (!EVP_DigestFinal_ex(mctx, md_data, &md_len)) { ERR_raise(ERR_LIB_PKCS7, ERR_R_EVP_LIB); return 0; } if (!PKCS7_add1_attrib_digest(si, md_data, md_len)) { ERR_raise(ERR_LIB_PKCS7, ERR_R_PKCS7_LIB); return 0; } /* Now sign the attributes */ if (!PKCS7_SIGNER_INFO_sign(si)) return 0; return 1; } int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) { int ret = 0; int i, j; BIO *btmp; PKCS7_SIGNER_INFO *si; EVP_MD_CTX *mdc, *ctx_tmp; STACK_OF(X509_ATTRIBUTE) *sk; STACK_OF(PKCS7_SIGNER_INFO) *si_sk = NULL; ASN1_OCTET_STRING *os = NULL; const PKCS7_CTX *p7_ctx; if (p7 == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_INVALID_NULL_POINTER); return 0; } p7_ctx = ossl_pkcs7_get0_ctx(p7); if (p7->d.ptr == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT); return 0; } ctx_tmp = EVP_MD_CTX_new(); if (ctx_tmp == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_EVP_LIB); return 0; } i = OBJ_obj2nid(p7->type); p7->state = PKCS7_S_HEADER; switch (i) { case NID_pkcs7_data: os = p7->d.data; break; case NID_pkcs7_signedAndEnveloped: /* XXXXXXXXXXXXXXXX */ si_sk = p7->d.signed_and_enveloped->signer_info; os = p7->d.signed_and_enveloped->enc_data->enc_data; if (os == NULL) { os = ASN1_OCTET_STRING_new(); if (os == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_ASN1_LIB); goto err; } p7->d.signed_and_enveloped->enc_data->enc_data = os; } break; case NID_pkcs7_enveloped: /* XXXXXXXXXXXXXXXX */ os = p7->d.enveloped->enc_data->enc_data; if (os == NULL) { os = ASN1_OCTET_STRING_new(); if (os == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_ASN1_LIB); goto err; } p7->d.enveloped->enc_data->enc_data = os; } break; case NID_pkcs7_signed: si_sk = p7->d.sign->signer_info; os = PKCS7_get_octet_string(p7->d.sign->contents); /* If detached data then the content is excluded */ if (PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) { ASN1_OCTET_STRING_free(os); os = NULL; p7->d.sign->contents->d.data = NULL; } break; case NID_pkcs7_digest: os = PKCS7_get_octet_string(p7->d.digest->contents); /* If detached data then the content is excluded */ if (PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) { ASN1_OCTET_STRING_free(os); os = NULL; p7->d.digest->contents->d.data = NULL; } break; default: ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CONTENT_TYPE); goto err; } if (si_sk != NULL) { for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(si_sk); i++) { si = sk_PKCS7_SIGNER_INFO_value(si_sk, i); if (si->pkey == NULL) continue; j = OBJ_obj2nid(si->digest_alg->algorithm); btmp = bio; btmp = PKCS7_find_digest(&mdc, btmp, j); if (btmp == NULL) goto err; /* * We now have the EVP_MD_CTX, lets do the signing. */ if (!EVP_MD_CTX_copy_ex(ctx_tmp, mdc)) goto err; sk = si->auth_attr; /* * If there are attributes, we add the digest attribute and only * sign the attributes */ if (sk_X509_ATTRIBUTE_num(sk) > 0) { if (!do_pkcs7_signed_attrib(si, ctx_tmp)) goto err; } else { unsigned char *abuf = NULL; unsigned int abuflen = EVP_PKEY_get_size(si->pkey); if (abuflen == 0 || (abuf = OPENSSL_malloc(abuflen)) == NULL) goto err; if (!EVP_SignFinal_ex(ctx_tmp, abuf, &abuflen, si->pkey, ossl_pkcs7_ctx_get0_libctx(p7_ctx), ossl_pkcs7_ctx_get0_propq(p7_ctx))) { OPENSSL_free(abuf); ERR_raise(ERR_LIB_PKCS7, ERR_R_EVP_LIB); goto err; } ASN1_STRING_set0(si->enc_digest, abuf, abuflen); } } } else if (i == NID_pkcs7_digest) { unsigned char md_data[EVP_MAX_MD_SIZE]; unsigned int md_len; if (!PKCS7_find_digest(&mdc, bio, OBJ_obj2nid(p7->d.digest->md->algorithm))) goto err; if (!EVP_DigestFinal_ex(mdc, md_data, &md_len)) goto err; if (!ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len)) goto err; } if (!PKCS7_is_detached(p7)) { /* * NOTE(emilia): I think we only reach os == NULL here because detached * digested data support is broken. */ if (os == NULL) goto err; if (!(os->flags & ASN1_STRING_FLAG_NDEF)) { char *cont; long contlen; btmp = BIO_find_type(bio, BIO_TYPE_MEM); if (btmp == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_MEM_BIO); goto err; } contlen = BIO_get_mem_data(btmp, &cont); /* * Mark the BIO read only then we can use its copy of the data * instead of making an extra copy. */ BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY); BIO_set_mem_eof_return(btmp, 0); ASN1_STRING_set0(os, (unsigned char *)cont, contlen); } } ret = 1; err: EVP_MD_CTX_free(ctx_tmp); return ret; } int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) { EVP_MD_CTX *mctx; EVP_PKEY_CTX *pctx = NULL; unsigned char *abuf = NULL; int alen; size_t siglen; const EVP_MD *md = NULL; const PKCS7_CTX *ctx = si->ctx; md = EVP_get_digestbyobj(si->digest_alg->algorithm); if (md == NULL) return 0; mctx = EVP_MD_CTX_new(); if (mctx == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_EVP_LIB); goto err; } if (EVP_DigestSignInit_ex(mctx, &pctx, EVP_MD_get0_name(md), ossl_pkcs7_ctx_get0_libctx(ctx), ossl_pkcs7_ctx_get0_propq(ctx), si->pkey, NULL) <= 0) goto err; alen = ASN1_item_i2d((ASN1_VALUE *)si->auth_attr, &abuf, ASN1_ITEM_rptr(PKCS7_ATTR_SIGN)); if (!abuf) goto err; if (EVP_DigestSignUpdate(mctx, abuf, alen) <= 0) goto err; OPENSSL_free(abuf); abuf = NULL; if (EVP_DigestSignFinal(mctx, NULL, &siglen) <= 0) goto err; abuf = OPENSSL_malloc(siglen); if (abuf == NULL) goto err; if (EVP_DigestSignFinal(mctx, abuf, &siglen) <= 0) goto err; EVP_MD_CTX_free(mctx); ASN1_STRING_set0(si->enc_digest, abuf, siglen); return 1; err: OPENSSL_free(abuf); EVP_MD_CTX_free(mctx); return 0; } /* This partly overlaps with PKCS7_verify(). It does not support flags. */ int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si) { PKCS7_ISSUER_AND_SERIAL *ias; int ret = 0, i; STACK_OF(X509) *untrusted; STACK_OF(X509_CRL) *crls; X509 *signer; if (p7 == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_INVALID_NULL_POINTER); return 0; } if (p7->d.ptr == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT); return 0; } if (PKCS7_type_is_signed(p7)) { untrusted = p7->d.sign->cert; crls = p7->d.sign->crl; } else if (PKCS7_type_is_signedAndEnveloped(p7)) { untrusted = p7->d.signed_and_enveloped->cert; crls = p7->d.signed_and_enveloped->crl; } else { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_WRONG_PKCS7_TYPE); goto err; } X509_STORE_CTX_set0_crls(ctx, crls); /* XXXXXXXXXXXXXXXXXXXXXXX */ ias = si->issuer_and_serial; signer = X509_find_by_issuer_and_serial(untrusted, ias->issuer, ias->serial); /* Were we able to find the signer certificate in passed to us? */ if (signer == NULL) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_CERTIFICATE); goto err; } /* Lets verify */ if (!X509_STORE_CTX_init(ctx, cert_store, signer, untrusted)) { ERR_raise(ERR_LIB_PKCS7, ERR_R_X509_LIB); goto err; } X509_STORE_CTX_set_purpose(ctx, X509_PURPOSE_SMIME_SIGN); i = X509_verify_cert(ctx); if (i <= 0) { ERR_raise(ERR_LIB_PKCS7, ERR_R_X509_LIB); goto err; } return PKCS7_signatureVerify(bio, p7, si, signer); err: return ret; } int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, X509 *signer) { ASN1_OCTET_STRING *os; EVP_MD_CTX *mdc_tmp, *mdc; const EVP_MD *md; EVP_MD *fetched_md = NULL; int ret = 0, i; int md_type; STACK_OF(X509_ATTRIBUTE) *sk; BIO *btmp; EVP_PKEY *pkey; const PKCS7_CTX *ctx = ossl_pkcs7_get0_ctx(p7); OSSL_LIB_CTX *libctx = ossl_pkcs7_ctx_get0_libctx(ctx); const char *propq = ossl_pkcs7_ctx_get0_propq(ctx); mdc_tmp = EVP_MD_CTX_new(); if (mdc_tmp == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_EVP_LIB); goto err; } if (!PKCS7_type_is_signed(p7) && !PKCS7_type_is_signedAndEnveloped(p7)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_WRONG_PKCS7_TYPE); goto err; } md_type = OBJ_obj2nid(si->digest_alg->algorithm); btmp = bio; for (;;) { if ((btmp == NULL) || ((btmp = BIO_find_type(btmp, BIO_TYPE_MD)) == NULL)) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST); goto err; } BIO_get_md_ctx(btmp, &mdc); if (mdc == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_INTERNAL_ERROR); goto err; } if (EVP_MD_CTX_get_type(mdc) == md_type) break; /* * Workaround for some broken clients that put the signature OID * instead of the digest OID in digest_alg->algorithm */ if (EVP_MD_get_pkey_type(EVP_MD_CTX_get0_md(mdc)) == md_type) break; btmp = BIO_next(btmp); } /* * mdc is the digest ctx that we want, unless there are attributes, in * which case the digest is the signed attributes */ if (!EVP_MD_CTX_copy_ex(mdc_tmp, mdc)) goto err; sk = si->auth_attr; if ((sk != NULL) && (sk_X509_ATTRIBUTE_num(sk) != 0)) { unsigned char md_dat[EVP_MAX_MD_SIZE], *abuf = NULL; unsigned int md_len; int alen; ASN1_OCTET_STRING *message_digest; if (!EVP_DigestFinal_ex(mdc_tmp, md_dat, &md_len)) goto err; message_digest = PKCS7_digest_from_attributes(sk); if (!message_digest) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST); goto err; } if ((message_digest->length != (int)md_len) || (memcmp(message_digest->data, md_dat, md_len))) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_DIGEST_FAILURE); ret = -1; goto err; } (void)ERR_set_mark(); fetched_md = EVP_MD_fetch(libctx, OBJ_nid2sn(md_type), propq); if (fetched_md != NULL) md = fetched_md; else md = EVP_get_digestbynid(md_type); if (md == NULL || !EVP_VerifyInit_ex(mdc_tmp, md, NULL)) { (void)ERR_clear_last_mark(); goto err; } (void)ERR_pop_to_mark(); alen = ASN1_item_i2d((ASN1_VALUE *)sk, &abuf, ASN1_ITEM_rptr(PKCS7_ATTR_VERIFY)); if (alen <= 0) { ERR_raise(ERR_LIB_PKCS7, ERR_R_ASN1_LIB); ret = -1; goto err; } if (!EVP_VerifyUpdate(mdc_tmp, abuf, alen)) goto err; OPENSSL_free(abuf); } os = si->enc_digest; pkey = X509_get0_pubkey(signer); if (pkey == NULL) { ret = -1; goto err; } i = EVP_VerifyFinal_ex(mdc_tmp, os->data, os->length, pkey, libctx, propq); if (i <= 0) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_SIGNATURE_FAILURE); ret = -1; goto err; } ret = 1; err: EVP_MD_CTX_free(mdc_tmp); EVP_MD_free(fetched_md); return ret; } PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx) { STACK_OF(PKCS7_RECIP_INFO) *rsk; PKCS7_RECIP_INFO *ri; int i; i = OBJ_obj2nid(p7->type); if (i != NID_pkcs7_signedAndEnveloped) return NULL; if (p7->d.signed_and_enveloped == NULL) return NULL; rsk = p7->d.signed_and_enveloped->recipientinfo; if (rsk == NULL) return NULL; if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return NULL; ri = sk_PKCS7_RECIP_INFO_value(rsk, idx); return ri->issuer_and_serial; } ASN1_TYPE *PKCS7_get_signed_attribute(const PKCS7_SIGNER_INFO *si, int nid) { return get_attribute(si->auth_attr, nid); } ASN1_TYPE *PKCS7_get_attribute(const PKCS7_SIGNER_INFO *si, int nid) { return get_attribute(si->unauth_attr, nid); } static ASN1_TYPE *get_attribute(const STACK_OF(X509_ATTRIBUTE) *sk, int nid) { int idx = X509at_get_attr_by_NID(sk, nid, -1); if (idx < 0) return NULL; return X509_ATTRIBUTE_get0_type(X509at_get_attr(sk, idx), 0); } ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk) { ASN1_TYPE *astype; if ((astype = get_attribute(sk, NID_pkcs9_messageDigest)) == NULL) return NULL; return astype->value.octet_string; } int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk) { int i; sk_X509_ATTRIBUTE_pop_free(p7si->auth_attr, X509_ATTRIBUTE_free); p7si->auth_attr = sk_X509_ATTRIBUTE_dup(sk); if (p7si->auth_attr == NULL) return 0; for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) { if ((sk_X509_ATTRIBUTE_set(p7si->auth_attr, i, X509_ATTRIBUTE_dup(sk_X509_ATTRIBUTE_value (sk, i)))) == NULL) return 0; } return 1; } int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk) { int i; sk_X509_ATTRIBUTE_pop_free(p7si->unauth_attr, X509_ATTRIBUTE_free); p7si->unauth_attr = sk_X509_ATTRIBUTE_dup(sk); if (p7si->unauth_attr == NULL) return 0; for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) { if ((sk_X509_ATTRIBUTE_set(p7si->unauth_attr, i, X509_ATTRIBUTE_dup(sk_X509_ATTRIBUTE_value (sk, i)))) == NULL) return 0; } return 1; } int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, void *value) { return add_attribute(&(p7si->auth_attr), nid, atrtype, value); } int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, void *value) { return add_attribute(&(p7si->unauth_attr), nid, atrtype, value); } static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, void *value) { X509_ATTRIBUTE *attr = NULL; if (*sk == NULL) { if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL) return 0; new_attrib: if ((attr = X509_ATTRIBUTE_create(nid, atrtype, value)) == NULL) return 0; if (!sk_X509_ATTRIBUTE_push(*sk, attr)) { X509_ATTRIBUTE_free(attr); return 0; } } else { int i; for (i = 0; i < sk_X509_ATTRIBUTE_num(*sk); i++) { attr = sk_X509_ATTRIBUTE_value(*sk, i); if (OBJ_obj2nid(X509_ATTRIBUTE_get0_object(attr)) == nid) { X509_ATTRIBUTE_free(attr); attr = X509_ATTRIBUTE_create(nid, atrtype, value); if (attr == NULL) return 0; if (!sk_X509_ATTRIBUTE_set(*sk, i, attr)) { X509_ATTRIBUTE_free(attr); return 0; } goto end; } } goto new_attrib; } end: return 1; }
./openssl/crypto/pkcs7/bio_pk7.c
/* * Copyright 2006-2016 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 */ #include <openssl/asn1.h> #include <openssl/pkcs7.h> #include <openssl/bio.h> /* Streaming encode support for PKCS#7 */ BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7) { return BIO_new_NDEF(out, (ASN1_VALUE *)p7, ASN1_ITEM_rptr(PKCS7)); }
./openssl/crypto/pkcs7/pk7_attr.c
/* * Copyright 1999-2020 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 */ #include <stdio.h> #include <stdlib.h> #include <openssl/bio.h> #include <openssl/asn1.h> #include <openssl/asn1t.h> #include <openssl/pem.h> #include <openssl/pkcs7.h> #include <openssl/x509.h> #include <openssl/err.h> int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap) { ASN1_STRING *seq; if ((seq = ASN1_STRING_new()) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_ASN1_LIB); return 0; } seq->length = ASN1_item_i2d((ASN1_VALUE *)cap, &seq->data, ASN1_ITEM_rptr(X509_ALGORS)); if (!PKCS7_add_signed_attribute(si, NID_SMIMECapabilities, V_ASN1_SEQUENCE, seq)) { ASN1_STRING_free(seq); return 0; } return 1; } STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si) { ASN1_TYPE *cap; const unsigned char *p; cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities); if (cap == NULL || (cap->type != V_ASN1_SEQUENCE)) return NULL; p = cap->value.sequence->data; return (STACK_OF(X509_ALGOR) *) ASN1_item_d2i(NULL, &p, cap->value.sequence->length, ASN1_ITEM_rptr(X509_ALGORS)); } /* Basic smime-capabilities OID and optional integer arg */ int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) { ASN1_INTEGER *nbit = NULL; X509_ALGOR *alg; if ((alg = X509_ALGOR_new()) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_ASN1_LIB); return 0; } ASN1_OBJECT_free(alg->algorithm); alg->algorithm = OBJ_nid2obj(nid); if (arg > 0) { if ((alg->parameter = ASN1_TYPE_new()) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_ASN1_LIB); goto err; } if ((nbit = ASN1_INTEGER_new()) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_ASN1_LIB); goto err; } if (!ASN1_INTEGER_set(nbit, arg)) { ERR_raise(ERR_LIB_PKCS7, ERR_R_ASN1_LIB); goto err; } alg->parameter->value.integer = nbit; alg->parameter->type = V_ASN1_INTEGER; nbit = NULL; } if (!sk_X509_ALGOR_push(sk, alg)) { ERR_raise(ERR_LIB_PKCS7, ERR_R_CRYPTO_LIB); goto err; } return 1; err: ASN1_INTEGER_free(nbit); X509_ALGOR_free(alg); return 0; } int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid) { if (PKCS7_get_signed_attribute(si, NID_pkcs9_contentType)) return 0; if (!coid) coid = OBJ_nid2obj(NID_pkcs7_data); return PKCS7_add_signed_attribute(si, NID_pkcs9_contentType, V_ASN1_OBJECT, coid); } int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t) { ASN1_TIME *tmp = NULL; if (t == NULL && (tmp = t = X509_gmtime_adj(NULL, 0)) == NULL) { ERR_raise(ERR_LIB_PKCS7, ERR_R_X509_LIB); return 0; } if (!PKCS7_add_signed_attribute(si, NID_pkcs9_signingTime, V_ASN1_UTCTIME, t)) { ASN1_TIME_free(tmp); return 0; } return 1; } int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, const unsigned char *md, int mdlen) { ASN1_OCTET_STRING *os; os = ASN1_OCTET_STRING_new(); if (os == NULL) return 0; if (!ASN1_STRING_set(os, md, mdlen) || !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, V_ASN1_OCTET_STRING, os)) { ASN1_OCTET_STRING_free(os); return 0; } return 1; }
./openssl/crypto/md5/md5_dgst.c
/* * Copyright 1995-2020 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 */ /* * MD5 low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <stdio.h> #include "md5_local.h" #include <openssl/opensslv.h> /* * Implemented from RFC1321 The MD5 Message-Digest Algorithm */ #define INIT_DATA_A (unsigned long)0x67452301L #define INIT_DATA_B (unsigned long)0xefcdab89L #define INIT_DATA_C (unsigned long)0x98badcfeL #define INIT_DATA_D (unsigned long)0x10325476L int MD5_Init(MD5_CTX *c) { memset(c, 0, sizeof(*c)); c->A = INIT_DATA_A; c->B = INIT_DATA_B; c->C = INIT_DATA_C; c->D = INIT_DATA_D; return 1; } #ifndef md5_block_data_order # ifdef X # undef X # endif void md5_block_data_order(MD5_CTX *c, const void *data_, size_t num) { const unsigned char *data = data_; register unsigned MD32_REG_T A, B, C, D, l; # ifndef MD32_XARRAY /* See comment in crypto/sha/sha_local.h for details. */ unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15; # define X(i) XX##i # else MD5_LONG XX[MD5_LBLOCK]; # define X(i) XX[i] # endif A = c->A; B = c->B; C = c->C; D = c->D; for (; num--;) { (void)HOST_c2l(data, l); X(0) = l; (void)HOST_c2l(data, l); X(1) = l; /* Round 0 */ R0(A, B, C, D, X(0), 7, 0xd76aa478L); (void)HOST_c2l(data, l); X(2) = l; R0(D, A, B, C, X(1), 12, 0xe8c7b756L); (void)HOST_c2l(data, l); X(3) = l; R0(C, D, A, B, X(2), 17, 0x242070dbL); (void)HOST_c2l(data, l); X(4) = l; R0(B, C, D, A, X(3), 22, 0xc1bdceeeL); (void)HOST_c2l(data, l); X(5) = l; R0(A, B, C, D, X(4), 7, 0xf57c0fafL); (void)HOST_c2l(data, l); X(6) = l; R0(D, A, B, C, X(5), 12, 0x4787c62aL); (void)HOST_c2l(data, l); X(7) = l; R0(C, D, A, B, X(6), 17, 0xa8304613L); (void)HOST_c2l(data, l); X(8) = l; R0(B, C, D, A, X(7), 22, 0xfd469501L); (void)HOST_c2l(data, l); X(9) = l; R0(A, B, C, D, X(8), 7, 0x698098d8L); (void)HOST_c2l(data, l); X(10) = l; R0(D, A, B, C, X(9), 12, 0x8b44f7afL); (void)HOST_c2l(data, l); X(11) = l; R0(C, D, A, B, X(10), 17, 0xffff5bb1L); (void)HOST_c2l(data, l); X(12) = l; R0(B, C, D, A, X(11), 22, 0x895cd7beL); (void)HOST_c2l(data, l); X(13) = l; R0(A, B, C, D, X(12), 7, 0x6b901122L); (void)HOST_c2l(data, l); X(14) = l; R0(D, A, B, C, X(13), 12, 0xfd987193L); (void)HOST_c2l(data, l); X(15) = l; R0(C, D, A, B, X(14), 17, 0xa679438eL); R0(B, C, D, A, X(15), 22, 0x49b40821L); /* Round 1 */ R1(A, B, C, D, X(1), 5, 0xf61e2562L); R1(D, A, B, C, X(6), 9, 0xc040b340L); R1(C, D, A, B, X(11), 14, 0x265e5a51L); R1(B, C, D, A, X(0), 20, 0xe9b6c7aaL); R1(A, B, C, D, X(5), 5, 0xd62f105dL); R1(D, A, B, C, X(10), 9, 0x02441453L); R1(C, D, A, B, X(15), 14, 0xd8a1e681L); R1(B, C, D, A, X(4), 20, 0xe7d3fbc8L); R1(A, B, C, D, X(9), 5, 0x21e1cde6L); R1(D, A, B, C, X(14), 9, 0xc33707d6L); R1(C, D, A, B, X(3), 14, 0xf4d50d87L); R1(B, C, D, A, X(8), 20, 0x455a14edL); R1(A, B, C, D, X(13), 5, 0xa9e3e905L); R1(D, A, B, C, X(2), 9, 0xfcefa3f8L); R1(C, D, A, B, X(7), 14, 0x676f02d9L); R1(B, C, D, A, X(12), 20, 0x8d2a4c8aL); /* Round 2 */ R2(A, B, C, D, X(5), 4, 0xfffa3942L); R2(D, A, B, C, X(8), 11, 0x8771f681L); R2(C, D, A, B, X(11), 16, 0x6d9d6122L); R2(B, C, D, A, X(14), 23, 0xfde5380cL); R2(A, B, C, D, X(1), 4, 0xa4beea44L); R2(D, A, B, C, X(4), 11, 0x4bdecfa9L); R2(C, D, A, B, X(7), 16, 0xf6bb4b60L); R2(B, C, D, A, X(10), 23, 0xbebfbc70L); R2(A, B, C, D, X(13), 4, 0x289b7ec6L); R2(D, A, B, C, X(0), 11, 0xeaa127faL); R2(C, D, A, B, X(3), 16, 0xd4ef3085L); R2(B, C, D, A, X(6), 23, 0x04881d05L); R2(A, B, C, D, X(9), 4, 0xd9d4d039L); R2(D, A, B, C, X(12), 11, 0xe6db99e5L); R2(C, D, A, B, X(15), 16, 0x1fa27cf8L); R2(B, C, D, A, X(2), 23, 0xc4ac5665L); /* Round 3 */ R3(A, B, C, D, X(0), 6, 0xf4292244L); R3(D, A, B, C, X(7), 10, 0x432aff97L); R3(C, D, A, B, X(14), 15, 0xab9423a7L); R3(B, C, D, A, X(5), 21, 0xfc93a039L); R3(A, B, C, D, X(12), 6, 0x655b59c3L); R3(D, A, B, C, X(3), 10, 0x8f0ccc92L); R3(C, D, A, B, X(10), 15, 0xffeff47dL); R3(B, C, D, A, X(1), 21, 0x85845dd1L); R3(A, B, C, D, X(8), 6, 0x6fa87e4fL); R3(D, A, B, C, X(15), 10, 0xfe2ce6e0L); R3(C, D, A, B, X(6), 15, 0xa3014314L); R3(B, C, D, A, X(13), 21, 0x4e0811a1L); R3(A, B, C, D, X(4), 6, 0xf7537e82L); R3(D, A, B, C, X(11), 10, 0xbd3af235L); R3(C, D, A, B, X(2), 15, 0x2ad7d2bbL); R3(B, C, D, A, X(9), 21, 0xeb86d391L); A = c->A += A; B = c->B += B; C = c->C += C; D = c->D += D; } } #endif
./openssl/crypto/md5/md5_sha1.c
/* * Copyright 2015-2020 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 */ /* * MD5 and SHA-1 low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <string.h> #include "prov/md5_sha1.h" #include <openssl/evp.h> int ossl_md5_sha1_init(MD5_SHA1_CTX *mctx) { if (!MD5_Init(&mctx->md5)) return 0; return SHA1_Init(&mctx->sha1); } int ossl_md5_sha1_update(MD5_SHA1_CTX *mctx, const void *data, size_t count) { if (!MD5_Update(&mctx->md5, data, count)) return 0; return SHA1_Update(&mctx->sha1, data, count); } int ossl_md5_sha1_final(unsigned char *md, MD5_SHA1_CTX *mctx) { if (!MD5_Final(md, &mctx->md5)) return 0; return SHA1_Final(md + MD5_DIGEST_LENGTH, &mctx->sha1); } int ossl_md5_sha1_ctrl(MD5_SHA1_CTX *mctx, int cmd, int mslen, void *ms) { unsigned char padtmp[48]; unsigned char md5tmp[MD5_DIGEST_LENGTH]; unsigned char sha1tmp[SHA_DIGEST_LENGTH]; if (cmd != EVP_CTRL_SSL3_MASTER_SECRET) return -2; if (mctx == NULL) return 0; /* SSLv3 client auth handling: see RFC-6101 5.6.8 */ if (mslen != 48) return 0; /* At this point hash contains all handshake messages, update * with master secret and pad_1. */ if (ossl_md5_sha1_update(mctx, ms, mslen) <= 0) return 0; /* Set padtmp to pad_1 value */ memset(padtmp, 0x36, sizeof(padtmp)); if (!MD5_Update(&mctx->md5, padtmp, sizeof(padtmp))) return 0; if (!MD5_Final(md5tmp, &mctx->md5)) return 0; if (!SHA1_Update(&mctx->sha1, padtmp, 40)) return 0; if (!SHA1_Final(sha1tmp, &mctx->sha1)) return 0; /* Reinitialise context */ if (!ossl_md5_sha1_init(mctx)) return 0; if (ossl_md5_sha1_update(mctx, ms, mslen) <= 0) return 0; /* Set padtmp to pad_2 value */ memset(padtmp, 0x5c, sizeof(padtmp)); if (!MD5_Update(&mctx->md5, padtmp, sizeof(padtmp))) return 0; if (!MD5_Update(&mctx->md5, md5tmp, sizeof(md5tmp))) return 0; if (!SHA1_Update(&mctx->sha1, padtmp, 40)) return 0; if (!SHA1_Update(&mctx->sha1, sha1tmp, sizeof(sha1tmp))) return 0; /* Now when ctx is finalised it will return the SSL v3 hash value */ OPENSSL_cleanse(md5tmp, sizeof(md5tmp)); OPENSSL_cleanse(sha1tmp, sizeof(sha1tmp)); return 1; }
./openssl/crypto/md5/md5_local.h
/* * Copyright 1995-2022 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 */ #include <stdlib.h> #include <string.h> #include <openssl/e_os2.h> #include <openssl/md5.h> #ifdef MD5_ASM # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \ defined(_M_X64) || defined(__aarch64__) || \ (defined(__loongarch__) && __loongarch_grlen == 64) # define md5_block_data_order ossl_md5_block_asm_data_order # elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) # define md5_block_data_order ossl_md5_block_asm_data_order # elif defined(__sparc) || defined(__sparc__) # define md5_block_data_order ossl_md5_block_asm_data_order # endif #endif void md5_block_data_order(MD5_CTX *c, const void *p, size_t num); #define DATA_ORDER_IS_LITTLE_ENDIAN #define HASH_LONG MD5_LONG #define HASH_CTX MD5_CTX #define HASH_CBLOCK MD5_CBLOCK #define HASH_UPDATE MD5_Update #define HASH_TRANSFORM MD5_Transform #define HASH_FINAL MD5_Final #define HASH_MAKE_STRING(c,s) do { \ unsigned long ll; \ ll=(c)->A; (void)HOST_l2c(ll,(s)); \ ll=(c)->B; (void)HOST_l2c(ll,(s)); \ ll=(c)->C; (void)HOST_l2c(ll,(s)); \ ll=(c)->D; (void)HOST_l2c(ll,(s)); \ } while (0) #define HASH_BLOCK_DATA_ORDER md5_block_data_order #include "crypto/md32_common.h" /*- #define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) #define G(x,y,z) (((x) & (z)) | ((y) & (~(z)))) */ /* * As pointed out by Wei Dai, the above can be simplified to the code * below. Wei attributes these optimizations to Peter Gutmann's * SHS code, and he attributes it to Rich Schroeppel. */ #define F(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) #define G(b,c,d) ((((b) ^ (c)) & (d)) ^ (c)) #define H(b,c,d) ((b) ^ (c) ^ (d)) #define I(b,c,d) (((~(d)) | (b)) ^ (c)) #define R0(a,b,c,d,k,s,t) { \ a+=((k)+(t)+F((b),(c),(d))); \ a=ROTATE(a,s); \ a+=b; }; #define R1(a,b,c,d,k,s,t) { \ a+=((k)+(t)+G((b),(c),(d))); \ a=ROTATE(a,s); \ a+=b; }; #define R2(a,b,c,d,k,s,t) { \ a+=((k)+(t)+H((b),(c),(d))); \ a=ROTATE(a,s); \ a+=b; }; #define R3(a,b,c,d,k,s,t) { \ a+=((k)+(t)+I((b),(c),(d))); \ a=ROTATE(a,s); \ a+=b; };
./openssl/crypto/md5/md5_one.c
/* * Copyright 1995-2020 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 */ /* * MD5 low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <stdio.h> #include <string.h> #include <openssl/md5.h> #include <openssl/crypto.h> #ifdef CHARSET_EBCDIC # include <openssl/ebcdic.h> #endif unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md) { MD5_CTX c; static unsigned char m[MD5_DIGEST_LENGTH]; if (md == NULL) md = m; if (!MD5_Init(&c)) return NULL; #ifndef CHARSET_EBCDIC MD5_Update(&c, d, n); #else { char temp[1024]; unsigned long chunk; while (n > 0) { chunk = (n > sizeof(temp)) ? sizeof(temp) : n; ebcdic2ascii(temp, d, chunk); MD5_Update(&c, temp, chunk); n -= chunk; d += chunk; } } #endif MD5_Final(md, &c); OPENSSL_cleanse(&c, sizeof(c)); /* security consideration */ return md; }
./openssl/crypto/objects/obj_compat.h
/* * Copyright 2022 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 */ #ifndef OPENSSL_NO_DEPRECATED_3_0 #define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm SN_magma_ctr_acpkm #define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm NID_magma_ctr_acpkm #define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm OBJ_magma_ctr_acpkm #define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac SN_magma_ctr_acpkm_omac #define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac NID_magma_ctr_acpkm_omac #define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac OBJ_magma_ctr_acpkm_omac #define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm SN_kuznyechik_ctr_acpkm #define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm NID_kuznyechik_ctr_acpkm #define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm OBJ_kuznyechik_ctr_acpkm #define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac SN_kuznyechik_ctr_acpkm_omac #define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac NID_kuznyechik_ctr_acpkm_omac #define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac OBJ_kuznyechik_ctr_acpkm_omac #define SN_id_tc26_wrap_gostr3412_2015_magma_kexp15 SN_magma_kexp15 #define NID_id_tc26_wrap_gostr3412_2015_magma_kexp15 NID_magma_kexp15 #define OBJ_id_tc26_wrap_gostr3412_2015_magma_kexp15 OBJ_magma_kexp15 #define SN_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 SN_kuznyechik_kexp15 #define NID_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 NID_kuznyechik_kexp15 #define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 OBJ_kuznyechik_kexp15 #define SN_grasshopper_ecb SN_kuznyechik_ecb #define NID_grasshopper_ecb NID_kuznyechik_ecb #define SN_grasshopper_ctr SN_kuznyechik_ctr #define NID_grasshopper_ctr NID_kuznyechik_ctr #define SN_grasshopper_ofb SN_kuznyechik_ofb #define NID_grasshopper_ofb NID_kuznyechik_ofb #define SN_grasshopper_cbc SN_kuznyechik_cbc #define NID_grasshopper_cbc NID_kuznyechik_cbc #define SN_grasshopper_cfb SN_kuznyechik_cfb #define NID_grasshopper_cfb NID_kuznyechik_cfb #define SN_grasshopper_mac SN_kuznyechik_mac #define NID_grasshopper_mac NID_kuznyechik_mac #endif /* OPENSSL_NO_DEPRECATED_3_0 */
./openssl/crypto/objects/obj_err.c
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 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 */ #include <openssl/err.h> #include <openssl/objectserr.h> #include "crypto/objectserr.h" #ifndef OPENSSL_NO_ERR static const ERR_STRING_DATA OBJ_str_reasons[] = { {ERR_PACK(ERR_LIB_OBJ, 0, OBJ_R_OID_EXISTS), "oid exists"}, {ERR_PACK(ERR_LIB_OBJ, 0, OBJ_R_UNKNOWN_NID), "unknown nid"}, {ERR_PACK(ERR_LIB_OBJ, 0, OBJ_R_UNKNOWN_OBJECT_NAME), "unknown object name"}, {0, NULL} }; #endif int ossl_err_load_OBJ_strings(void) { #ifndef OPENSSL_NO_ERR if (ERR_reason_error_string(OBJ_str_reasons[0].error) == NULL) ERR_load_strings_const(OBJ_str_reasons); #endif return 1; }
./openssl/crypto/objects/obj_xref.h
/* * WARNING: do not edit! * Generated by objxref.pl * * Copyright 1998-2023 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 */ typedef struct { int sign_id; int hash_id; int pkey_id; } nid_triple; DEFINE_STACK_OF(nid_triple) static const nid_triple sigoid_srt[] = { {NID_md2WithRSAEncryption, NID_md2, NID_rsaEncryption}, {NID_md5WithRSAEncryption, NID_md5, NID_rsaEncryption}, {NID_shaWithRSAEncryption, NID_sha, NID_rsaEncryption}, {NID_sha1WithRSAEncryption, NID_sha1, NID_rsaEncryption}, {NID_dsaWithSHA, NID_sha, NID_dsa}, {NID_dsaWithSHA1_2, NID_sha1, NID_dsa_2}, {NID_mdc2WithRSA, NID_mdc2, NID_rsaEncryption}, {NID_md5WithRSA, NID_md5, NID_rsa}, {NID_dsaWithSHA1, NID_sha1, NID_dsa}, {NID_sha1WithRSA, NID_sha1, NID_rsa}, {NID_ripemd160WithRSA, NID_ripemd160, NID_rsaEncryption}, {NID_md4WithRSAEncryption, NID_md4, NID_rsaEncryption}, {NID_ecdsa_with_SHA1, NID_sha1, NID_X9_62_id_ecPublicKey}, {NID_sha256WithRSAEncryption, NID_sha256, NID_rsaEncryption}, {NID_sha384WithRSAEncryption, NID_sha384, NID_rsaEncryption}, {NID_sha512WithRSAEncryption, NID_sha512, NID_rsaEncryption}, {NID_sha224WithRSAEncryption, NID_sha224, NID_rsaEncryption}, {NID_ecdsa_with_Recommended, NID_undef, NID_X9_62_id_ecPublicKey}, {NID_ecdsa_with_Specified, NID_undef, NID_X9_62_id_ecPublicKey}, {NID_ecdsa_with_SHA224, NID_sha224, NID_X9_62_id_ecPublicKey}, {NID_ecdsa_with_SHA256, NID_sha256, NID_X9_62_id_ecPublicKey}, {NID_ecdsa_with_SHA384, NID_sha384, NID_X9_62_id_ecPublicKey}, {NID_ecdsa_with_SHA512, NID_sha512, NID_X9_62_id_ecPublicKey}, {NID_dsa_with_SHA224, NID_sha224, NID_dsa}, {NID_dsa_with_SHA256, NID_sha256, NID_dsa}, {NID_id_GostR3411_94_with_GostR3410_2001, NID_id_GostR3411_94, NID_id_GostR3410_2001}, {NID_id_GostR3411_94_with_GostR3410_94, NID_id_GostR3411_94, NID_id_GostR3410_94}, {NID_id_GostR3411_94_with_GostR3410_94_cc, NID_id_GostR3411_94, NID_id_GostR3410_94_cc}, {NID_id_GostR3411_94_with_GostR3410_2001_cc, NID_id_GostR3411_94, NID_id_GostR3410_2001_cc}, {NID_rsassaPss, NID_undef, NID_rsassaPss}, {NID_dhSinglePass_stdDH_sha1kdf_scheme, NID_sha1, NID_dh_std_kdf}, {NID_dhSinglePass_stdDH_sha224kdf_scheme, NID_sha224, NID_dh_std_kdf}, {NID_dhSinglePass_stdDH_sha256kdf_scheme, NID_sha256, NID_dh_std_kdf}, {NID_dhSinglePass_stdDH_sha384kdf_scheme, NID_sha384, NID_dh_std_kdf}, {NID_dhSinglePass_stdDH_sha512kdf_scheme, NID_sha512, NID_dh_std_kdf}, {NID_dhSinglePass_cofactorDH_sha1kdf_scheme, NID_sha1, NID_dh_cofactor_kdf}, {NID_dhSinglePass_cofactorDH_sha224kdf_scheme, NID_sha224, NID_dh_cofactor_kdf}, {NID_dhSinglePass_cofactorDH_sha256kdf_scheme, NID_sha256, NID_dh_cofactor_kdf}, {NID_dhSinglePass_cofactorDH_sha384kdf_scheme, NID_sha384, NID_dh_cofactor_kdf}, {NID_dhSinglePass_cofactorDH_sha512kdf_scheme, NID_sha512, NID_dh_cofactor_kdf}, {NID_id_tc26_signwithdigest_gost3410_2012_256, NID_id_GostR3411_2012_256, NID_id_GostR3410_2012_256}, {NID_id_tc26_signwithdigest_gost3410_2012_512, NID_id_GostR3411_2012_512, NID_id_GostR3410_2012_512}, {NID_ED25519, NID_undef, NID_ED25519}, {NID_ED448, NID_undef, NID_ED448}, {NID_ecdsa_with_SHA3_224, NID_sha3_224, NID_X9_62_id_ecPublicKey}, {NID_ecdsa_with_SHA3_256, NID_sha3_256, NID_X9_62_id_ecPublicKey}, {NID_ecdsa_with_SHA3_384, NID_sha3_384, NID_X9_62_id_ecPublicKey}, {NID_ecdsa_with_SHA3_512, NID_sha3_512, NID_X9_62_id_ecPublicKey}, {NID_RSA_SHA3_224, NID_sha3_224, NID_rsaEncryption}, {NID_RSA_SHA3_256, NID_sha3_256, NID_rsaEncryption}, {NID_RSA_SHA3_384, NID_sha3_384, NID_rsaEncryption}, {NID_RSA_SHA3_512, NID_sha3_512, NID_rsaEncryption}, {NID_SM2_with_SM3, NID_sm3, NID_sm2}, }; static const nid_triple *const sigoid_srt_xref[] = { &sigoid_srt[0], &sigoid_srt[1], &sigoid_srt[7], &sigoid_srt[2], &sigoid_srt[4], &sigoid_srt[3], &sigoid_srt[9], &sigoid_srt[5], &sigoid_srt[8], &sigoid_srt[12], &sigoid_srt[30], &sigoid_srt[35], &sigoid_srt[6], &sigoid_srt[10], &sigoid_srt[11], &sigoid_srt[13], &sigoid_srt[24], &sigoid_srt[20], &sigoid_srt[32], &sigoid_srt[37], &sigoid_srt[14], &sigoid_srt[21], &sigoid_srt[33], &sigoid_srt[38], &sigoid_srt[15], &sigoid_srt[22], &sigoid_srt[34], &sigoid_srt[39], &sigoid_srt[16], &sigoid_srt[23], &sigoid_srt[19], &sigoid_srt[31], &sigoid_srt[36], &sigoid_srt[25], &sigoid_srt[26], &sigoid_srt[27], &sigoid_srt[28], &sigoid_srt[40], &sigoid_srt[41], &sigoid_srt[48], &sigoid_srt[44], &sigoid_srt[49], &sigoid_srt[45], &sigoid_srt[50], &sigoid_srt[46], &sigoid_srt[51], &sigoid_srt[47], &sigoid_srt[52], };
./openssl/crypto/objects/o_names.c
/* * Copyright 1998-2022 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 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <openssl/err.h> #include <openssl/lhash.h> #include <openssl/objects.h> #include <openssl/safestack.h> #include <openssl/e_os2.h> #include "internal/thread_once.h" #include "crypto/lhash.h" #include "obj_local.h" #include "internal/e_os.h" /* * I use the ex_data stuff to manage the identifiers for the obj_name_types * that applications may define. I only really use the free function field. */ static LHASH_OF(OBJ_NAME) *names_lh = NULL; static int names_type_num = OBJ_NAME_TYPE_NUM; static CRYPTO_RWLOCK *obj_lock = NULL; struct name_funcs_st { unsigned long (*hash_func) (const char *name); int (*cmp_func) (const char *a, const char *b); void (*free_func) (const char *, int, const char *); }; static STACK_OF(NAME_FUNCS) *name_funcs_stack; /* * The LHASH callbacks now use the raw "void *" prototypes and do * per-variable casting in the functions. This prevents function pointer * casting without the need for macro-generated wrapper functions. */ static unsigned long obj_name_hash(const OBJ_NAME *a); static int obj_name_cmp(const OBJ_NAME *a, const OBJ_NAME *b); static CRYPTO_ONCE init = CRYPTO_ONCE_STATIC_INIT; DEFINE_RUN_ONCE_STATIC(o_names_init) { names_lh = NULL; obj_lock = CRYPTO_THREAD_lock_new(); if (obj_lock != NULL) names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp); if (names_lh == NULL) { CRYPTO_THREAD_lock_free(obj_lock); obj_lock = NULL; } return names_lh != NULL && obj_lock != NULL; } int OBJ_NAME_init(void) { return RUN_ONCE(&init, o_names_init); } int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), int (*cmp_func) (const char *, const char *), void (*free_func) (const char *, int, const char *)) { int ret = 0, i, push; NAME_FUNCS *name_funcs; if (!OBJ_NAME_init()) return 0; if (!CRYPTO_THREAD_write_lock(obj_lock)) return 0; if (name_funcs_stack == NULL) name_funcs_stack = sk_NAME_FUNCS_new_null(); if (name_funcs_stack == NULL) { /* ERROR */ goto out; } ret = names_type_num; names_type_num++; for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); if (name_funcs == NULL) { ret = 0; goto out; } name_funcs->hash_func = ossl_lh_strcasehash; name_funcs->cmp_func = OPENSSL_strcasecmp; push = sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); if (!push) { ERR_raise(ERR_LIB_OBJ, ERR_R_CRYPTO_LIB); OPENSSL_free(name_funcs); ret = 0; goto out; } } name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret); if (hash_func != NULL) name_funcs->hash_func = hash_func; if (cmp_func != NULL) name_funcs->cmp_func = cmp_func; if (free_func != NULL) name_funcs->free_func = free_func; out: CRYPTO_THREAD_unlock(obj_lock); return ret; } static int obj_name_cmp(const OBJ_NAME *a, const OBJ_NAME *b) { int ret; ret = a->type - b->type; if (ret == 0) { if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) { ret = sk_NAME_FUNCS_value(name_funcs_stack, a->type)->cmp_func(a->name, b->name); } else ret = OPENSSL_strcasecmp(a->name, b->name); } return ret; } static unsigned long obj_name_hash(const OBJ_NAME *a) { unsigned long ret; if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) { ret = sk_NAME_FUNCS_value(name_funcs_stack, a->type)->hash_func(a->name); } else { ret = ossl_lh_strcasehash(a->name); } ret ^= a->type; return ret; } const char *OBJ_NAME_get(const char *name, int type) { OBJ_NAME on, *ret; int num = 0, alias; const char *value = NULL; if (name == NULL) return NULL; if (!OBJ_NAME_init()) return NULL; if (!CRYPTO_THREAD_read_lock(obj_lock)) return NULL; alias = type & OBJ_NAME_ALIAS; type &= ~OBJ_NAME_ALIAS; on.name = name; on.type = type; for (;;) { ret = lh_OBJ_NAME_retrieve(names_lh, &on); if (ret == NULL) break; if ((ret->alias) && !alias) { if (++num > 10) break; on.name = ret->data; } else { value = ret->data; break; } } CRYPTO_THREAD_unlock(obj_lock); return value; } int OBJ_NAME_add(const char *name, int type, const char *data) { OBJ_NAME *onp, *ret; int alias, ok = 0; if (!OBJ_NAME_init()) return 0; alias = type & OBJ_NAME_ALIAS; type &= ~OBJ_NAME_ALIAS; onp = OPENSSL_malloc(sizeof(*onp)); if (onp == NULL) return 0; onp->name = name; onp->alias = alias; onp->type = type; onp->data = data; if (!CRYPTO_THREAD_write_lock(obj_lock)) { OPENSSL_free(onp); return 0; } ret = lh_OBJ_NAME_insert(names_lh, onp); if (ret != NULL) { /* free things */ if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > ret->type)) { /* * XXX: I'm not sure I understand why the free function should * get three arguments... -- Richard Levitte */ sk_NAME_FUNCS_value(name_funcs_stack, ret->type)->free_func(ret->name, ret->type, ret->data); } OPENSSL_free(ret); } else { if (lh_OBJ_NAME_error(names_lh)) { /* ERROR */ OPENSSL_free(onp); goto unlock; } } ok = 1; unlock: CRYPTO_THREAD_unlock(obj_lock); return ok; } int OBJ_NAME_remove(const char *name, int type) { OBJ_NAME on, *ret; int ok = 0; if (!OBJ_NAME_init()) return 0; if (!CRYPTO_THREAD_write_lock(obj_lock)) return 0; type &= ~OBJ_NAME_ALIAS; on.name = name; on.type = type; ret = lh_OBJ_NAME_delete(names_lh, &on); if (ret != NULL) { /* free things */ if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > ret->type)) { /* * XXX: I'm not sure I understand why the free function should * get three arguments... -- Richard Levitte */ sk_NAME_FUNCS_value(name_funcs_stack, ret->type)->free_func(ret->name, ret->type, ret->data); } OPENSSL_free(ret); ok = 1; } CRYPTO_THREAD_unlock(obj_lock); return ok; } typedef struct { int type; void (*fn) (const OBJ_NAME *, void *arg); void *arg; } OBJ_DOALL; static void do_all_fn(const OBJ_NAME *name, OBJ_DOALL *d) { if (name->type == d->type) d->fn(name, d->arg); } IMPLEMENT_LHASH_DOALL_ARG_CONST(OBJ_NAME, OBJ_DOALL); void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), void *arg) { OBJ_DOALL d; d.type = type; d.fn = fn; d.arg = arg; lh_OBJ_NAME_doall_OBJ_DOALL(names_lh, do_all_fn, &d); } struct doall_sorted { int type; int n; const OBJ_NAME **names; }; static void do_all_sorted_fn(const OBJ_NAME *name, void *d_) { struct doall_sorted *d = d_; if (name->type != d->type) return; d->names[d->n++] = name; } static int do_all_sorted_cmp(const void *n1_, const void *n2_) { const OBJ_NAME *const *n1 = n1_; const OBJ_NAME *const *n2 = n2_; return strcmp((*n1)->name, (*n2)->name); } void OBJ_NAME_do_all_sorted(int type, void (*fn) (const OBJ_NAME *, void *arg), void *arg) { struct doall_sorted d; int n; d.type = type; d.names = OPENSSL_malloc(sizeof(*d.names) * lh_OBJ_NAME_num_items(names_lh)); /* Really should return an error if !d.names...but its a void function! */ if (d.names != NULL) { d.n = 0; OBJ_NAME_do_all(type, do_all_sorted_fn, &d); qsort((void *)d.names, d.n, sizeof(*d.names), do_all_sorted_cmp); for (n = 0; n < d.n; ++n) fn(d.names[n], arg); OPENSSL_free((void *)d.names); } } static int free_type; static void names_lh_free_doall(OBJ_NAME *onp) { if (onp == NULL) return; if (free_type < 0 || free_type == onp->type) OBJ_NAME_remove(onp->name, onp->type); } static void name_funcs_free(NAME_FUNCS *ptr) { OPENSSL_free(ptr); } void OBJ_NAME_cleanup(int type) { unsigned long down_load; if (names_lh == NULL) return; free_type = type; down_load = lh_OBJ_NAME_get_down_load(names_lh); lh_OBJ_NAME_set_down_load(names_lh, 0); lh_OBJ_NAME_doall(names_lh, names_lh_free_doall); if (type < 0) { lh_OBJ_NAME_free(names_lh); sk_NAME_FUNCS_pop_free(name_funcs_stack, name_funcs_free); CRYPTO_THREAD_lock_free(obj_lock); names_lh = NULL; name_funcs_stack = NULL; obj_lock = NULL; } else lh_OBJ_NAME_set_down_load(names_lh, down_load); }
./openssl/crypto/objects/obj_dat.c
/* * Copyright 1995-2023 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 */ #include <stdio.h> #include "crypto/ctype.h" #include <limits.h> #include "internal/cryptlib.h" #include "internal/thread_once.h" #include "internal/tsan_assist.h" #include <openssl/lhash.h> #include <openssl/asn1.h> #include "crypto/objects.h" #include <openssl/bn.h> #include "crypto/asn1.h" #include "obj_local.h" /* obj_dat.h is generated from objects.txt and obj_mac.{num,h} by obj_dat.pl */ #include "obj_dat.h" DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn); DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln); DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); #define ADDED_DATA 0 #define ADDED_SNAME 1 #define ADDED_LNAME 2 #define ADDED_NID 3 struct added_obj_st { int type; ASN1_OBJECT *obj; }; static LHASH_OF(ADDED_OBJ) *added = NULL; static CRYPTO_RWLOCK *ossl_obj_lock = NULL; #ifdef TSAN_REQUIRES_LOCKING static CRYPTO_RWLOCK *ossl_obj_nid_lock = NULL; #endif static CRYPTO_ONCE ossl_obj_lock_init = CRYPTO_ONCE_STATIC_INIT; static ossl_inline void objs_free_locks(void) { CRYPTO_THREAD_lock_free(ossl_obj_lock); ossl_obj_lock = NULL; #ifdef TSAN_REQUIRES_LOCKING CRYPTO_THREAD_lock_free(ossl_obj_nid_lock); ossl_obj_nid_lock = NULL; #endif } DEFINE_RUN_ONCE_STATIC(obj_lock_initialise) { ossl_obj_lock = CRYPTO_THREAD_lock_new(); if (ossl_obj_lock == NULL) return 0; #ifdef TSAN_REQUIRES_LOCKING ossl_obj_nid_lock = CRYPTO_THREAD_lock_new(); if (ossl_obj_nid_lock == NULL) { objs_free_locks(); return 0; } #endif return 1; } static ossl_inline int ossl_init_added_lock(void) { #ifndef OPENSSL_NO_AUTOLOAD_CONFIG /* Make sure we've loaded config before checking for any "added" objects */ OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL); #endif return RUN_ONCE(&ossl_obj_lock_init, obj_lock_initialise); } static ossl_inline int ossl_obj_write_lock(int lock) { if (!lock) return 1; if (!ossl_init_added_lock()) return 0; return CRYPTO_THREAD_write_lock(ossl_obj_lock); } static ossl_inline int ossl_obj_read_lock(int lock) { if (!lock) return 1; if (!ossl_init_added_lock()) return 0; return CRYPTO_THREAD_read_lock(ossl_obj_lock); } static ossl_inline void ossl_obj_unlock(int lock) { if (lock) CRYPTO_THREAD_unlock(ossl_obj_lock); } static int sn_cmp(const ASN1_OBJECT *const *a, const unsigned int *b) { return strcmp((*a)->sn, nid_objs[*b].sn); } IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn); static int ln_cmp(const ASN1_OBJECT *const *a, const unsigned int *b) { return strcmp((*a)->ln, nid_objs[*b].ln); } IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln); static unsigned long added_obj_hash(const ADDED_OBJ *ca) { const ASN1_OBJECT *a; int i; unsigned long ret = 0; unsigned char *p; a = ca->obj; switch (ca->type) { case ADDED_DATA: ret = (unsigned long)a->length << 20UL; p = (unsigned char *)a->data; for (i = 0; i < a->length; i++) ret ^= p[i] << ((i * 3) % 24); break; case ADDED_SNAME: ret = OPENSSL_LH_strhash(a->sn); break; case ADDED_LNAME: ret = OPENSSL_LH_strhash(a->ln); break; case ADDED_NID: ret = a->nid; break; default: /* abort(); */ return 0; } ret &= 0x3fffffffL; ret |= ((unsigned long)ca->type) << 30L; return ret; } static int added_obj_cmp(const ADDED_OBJ *ca, const ADDED_OBJ *cb) { ASN1_OBJECT *a, *b; int i; i = ca->type - cb->type; if (i) return i; a = ca->obj; b = cb->obj; switch (ca->type) { case ADDED_DATA: i = (a->length - b->length); if (i) return i; return memcmp(a->data, b->data, (size_t)a->length); case ADDED_SNAME: if (a->sn == NULL) return -1; else if (b->sn == NULL) return 1; else return strcmp(a->sn, b->sn); case ADDED_LNAME: if (a->ln == NULL) return -1; else if (b->ln == NULL) return 1; else return strcmp(a->ln, b->ln); case ADDED_NID: return a->nid - b->nid; default: /* abort(); */ return 0; } } static void cleanup1_doall(ADDED_OBJ *a) { a->obj->nid = 0; a->obj->flags |= ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS | ASN1_OBJECT_FLAG_DYNAMIC_DATA; } static void cleanup2_doall(ADDED_OBJ *a) { a->obj->nid++; } static void cleanup3_doall(ADDED_OBJ *a) { if (--a->obj->nid == 0) ASN1_OBJECT_free(a->obj); OPENSSL_free(a); } void ossl_obj_cleanup_int(void) { if (added != NULL) { lh_ADDED_OBJ_set_down_load(added, 0); lh_ADDED_OBJ_doall(added, cleanup1_doall); /* zero counters */ lh_ADDED_OBJ_doall(added, cleanup2_doall); /* set counters */ lh_ADDED_OBJ_doall(added, cleanup3_doall); /* free objects */ lh_ADDED_OBJ_free(added); added = NULL; } objs_free_locks(); } /* * Requires that the ossl_obj_lock be held * if TSAN_REQUIRES_LOCKING defined */ static int obj_new_nid_unlocked(int num) { static TSAN_QUALIFIER int new_nid = NUM_NID; #ifdef TSAN_REQUIRES_LOCKING int i; i = new_nid; new_nid += num; return i; #else return tsan_add(&new_nid, num); #endif } int OBJ_new_nid(int num) { #ifdef TSAN_REQUIRES_LOCKING int i; if (!ossl_obj_write_lock(1)) { ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_WRITE_LOCK); return NID_undef; } i = obj_new_nid_unlocked(num); ossl_obj_unlock(1); return i; #else return obj_new_nid_unlocked(num); #endif } static int ossl_obj_add_object(const ASN1_OBJECT *obj, int lock) { ASN1_OBJECT *o = NULL; ADDED_OBJ *ao[4] = { NULL, NULL, NULL, NULL }, *aop; int i; if ((o = OBJ_dup(obj)) == NULL) return NID_undef; if ((ao[ADDED_NID] = OPENSSL_malloc(sizeof(*ao[0]))) == NULL || (o->length != 0 && obj->data != NULL && (ao[ADDED_DATA] = OPENSSL_malloc(sizeof(*ao[0]))) == NULL) || (o->sn != NULL && (ao[ADDED_SNAME] = OPENSSL_malloc(sizeof(*ao[0]))) == NULL) || (o->ln != NULL && (ao[ADDED_LNAME] = OPENSSL_malloc(sizeof(*ao[0]))) == NULL)) goto err2; if (!ossl_obj_write_lock(lock)) { ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_WRITE_LOCK); goto err2; } if (added == NULL) { added = lh_ADDED_OBJ_new(added_obj_hash, added_obj_cmp); if (added == NULL) { ERR_raise(ERR_LIB_OBJ, ERR_R_CRYPTO_LIB); goto err; } } for (i = ADDED_DATA; i <= ADDED_NID; i++) { if (ao[i] != NULL) { ao[i]->type = i; ao[i]->obj = o; aop = lh_ADDED_OBJ_insert(added, ao[i]); /* memory leak, but should not normally matter */ OPENSSL_free(aop); } } o->flags &= ~(ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS | ASN1_OBJECT_FLAG_DYNAMIC_DATA); ossl_obj_unlock(lock); return o->nid; err: ossl_obj_unlock(lock); err2: for (i = ADDED_DATA; i <= ADDED_NID; i++) OPENSSL_free(ao[i]); ASN1_OBJECT_free(o); return NID_undef; } ASN1_OBJECT *OBJ_nid2obj(int n) { ADDED_OBJ ad, *adp = NULL; ASN1_OBJECT ob; if (n == NID_undef || (n > 0 && n < NUM_NID && nid_objs[n].nid != NID_undef)) return (ASN1_OBJECT *)&(nid_objs[n]); ad.type = ADDED_NID; ad.obj = &ob; ob.nid = n; if (!ossl_obj_read_lock(1)) { ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_READ_LOCK); return NULL; } if (added != NULL) adp = lh_ADDED_OBJ_retrieve(added, &ad); ossl_obj_unlock(1); if (adp != NULL) return adp->obj; ERR_raise(ERR_LIB_OBJ, OBJ_R_UNKNOWN_NID); return NULL; } const char *OBJ_nid2sn(int n) { ASN1_OBJECT *ob = OBJ_nid2obj(n); return ob == NULL ? NULL : ob->sn; } const char *OBJ_nid2ln(int n) { ASN1_OBJECT *ob = OBJ_nid2obj(n); return ob == NULL ? NULL : ob->ln; } static int obj_cmp(const ASN1_OBJECT *const *ap, const unsigned int *bp) { int j; const ASN1_OBJECT *a = *ap; const ASN1_OBJECT *b = &nid_objs[*bp]; j = (a->length - b->length); if (j) return j; if (a->length == 0) return 0; return memcmp(a->data, b->data, a->length); } IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); static int ossl_obj_obj2nid(const ASN1_OBJECT *a, const int lock) { int nid = NID_undef; const unsigned int *op; ADDED_OBJ ad, *adp; if (a == NULL) return NID_undef; if (a->nid != NID_undef) return a->nid; if (a->length == 0) return NID_undef; op = OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ); if (op != NULL) return nid_objs[*op].nid; if (!ossl_obj_read_lock(lock)) { ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_READ_LOCK); return NID_undef; } if (added != NULL) { ad.type = ADDED_DATA; ad.obj = (ASN1_OBJECT *)a; /* casting away const is harmless here */ adp = lh_ADDED_OBJ_retrieve(added, &ad); if (adp != NULL) nid = adp->obj->nid; } ossl_obj_unlock(lock); return nid; } /* * Convert an object name into an ASN1_OBJECT if "noname" is not set then * search for short and long names first. This will convert the "dotted" form * into an object: unlike OBJ_txt2nid it can be used with any objects, not * just registered ones. */ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) { int nid = NID_undef; ASN1_OBJECT *op = NULL; unsigned char *buf; unsigned char *p; const unsigned char *cp; int i, j; if (!no_name) { if ((nid = OBJ_sn2nid(s)) != NID_undef || (nid = OBJ_ln2nid(s)) != NID_undef) { return OBJ_nid2obj(nid); } if (!ossl_isdigit(*s)) { ERR_raise(ERR_LIB_OBJ, OBJ_R_UNKNOWN_OBJECT_NAME); return NULL; } } /* Work out size of content octets */ i = a2d_ASN1_OBJECT(NULL, 0, s, -1); if (i <= 0) return NULL; /* Work out total size */ j = ASN1_object_size(0, i, V_ASN1_OBJECT); if (j < 0) return NULL; if ((buf = OPENSSL_malloc(j)) == NULL) return NULL; p = buf; /* Write out tag+length */ ASN1_put_object(&p, 0, i, V_ASN1_OBJECT, V_ASN1_UNIVERSAL); /* Write out contents */ a2d_ASN1_OBJECT(p, i, s, -1); cp = buf; op = d2i_ASN1_OBJECT(NULL, &cp, j); OPENSSL_free(buf); return op; } int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) { int i, n = 0, len, nid, first, use_bn; BIGNUM *bl; unsigned long l; const unsigned char *p; char tbuf[DECIMAL_SIZE(i) + DECIMAL_SIZE(l) + 2]; const char *s; /* Ensure that, at every state, |buf| is NUL-terminated. */ if (buf != NULL && buf_len > 0) buf[0] = '\0'; if (a == NULL || a->data == NULL) return 0; if (!no_name && (nid = OBJ_obj2nid(a)) != NID_undef) { s = OBJ_nid2ln(nid); if (s == NULL) s = OBJ_nid2sn(nid); if (s != NULL) { if (buf != NULL) OPENSSL_strlcpy(buf, s, buf_len); return (int)strlen(s); } } len = a->length; p = a->data; first = 1; bl = NULL; /* * RFC 2578 (STD 58) says this about OBJECT IDENTIFIERs: * * > 3.5. OBJECT IDENTIFIER values * > * > An OBJECT IDENTIFIER value is an ordered list of non-negative * > numbers. For the SMIv2, each number in the list is referred to as a * > sub-identifier, there are at most 128 sub-identifiers in a value, * > and each sub-identifier has a maximum value of 2^32-1 (4294967295 * > decimal). * * So a legitimate OID according to this RFC is at most (32 * 128 / 7), * i.e. 586 bytes long. * * Ref: https://datatracker.ietf.org/doc/html/rfc2578#section-3.5 */ if (len > 586) goto err; while (len > 0) { l = 0; use_bn = 0; for (;;) { unsigned char c = *p++; len--; if (len == 0 && (c & 0x80) != 0) goto err; if (use_bn) { if (!BN_add_word(bl, c & 0x7f)) goto err; } else { l |= c & 0x7f; } if ((c & 0x80) == 0) break; if (!use_bn && l > (ULONG_MAX >> 7L)) { if (bl == NULL && (bl = BN_new()) == NULL) goto err; if (!BN_set_word(bl, l)) goto err; use_bn = 1; } if (use_bn) { if (!BN_lshift(bl, bl, 7)) goto err; } else { l <<= 7L; } } if (first) { first = 0; if (l >= 80) { i = 2; if (use_bn) { if (!BN_sub_word(bl, 80)) goto err; } else { l -= 80; } } else { i = (int)(l / 40); l -= (long)(i * 40); } if (buf != NULL && buf_len > 1) { *buf++ = i + '0'; *buf = '\0'; buf_len--; } n++; } if (use_bn) { char *bndec; bndec = BN_bn2dec(bl); if (!bndec) goto err; i = strlen(bndec); if (buf != NULL) { if (buf_len > 1) { *buf++ = '.'; *buf = '\0'; buf_len--; } OPENSSL_strlcpy(buf, bndec, buf_len); if (i > buf_len) { buf += buf_len; buf_len = 0; } else { buf += i; buf_len -= i; } } n++; n += i; OPENSSL_free(bndec); } else { BIO_snprintf(tbuf, sizeof(tbuf), ".%lu", l); i = strlen(tbuf); if (buf && buf_len > 0) { OPENSSL_strlcpy(buf, tbuf, buf_len); if (i > buf_len) { buf += buf_len; buf_len = 0; } else { buf += i; buf_len -= i; } } n += i; l = 0; } } BN_free(bl); return n; err: BN_free(bl); return -1; } int OBJ_txt2nid(const char *s) { ASN1_OBJECT *obj = OBJ_txt2obj(s, 0); int nid = NID_undef; if (obj != NULL) { nid = OBJ_obj2nid(obj); ASN1_OBJECT_free(obj); } return nid; } int OBJ_ln2nid(const char *s) { ASN1_OBJECT o; const ASN1_OBJECT *oo = &o; ADDED_OBJ ad, *adp; const unsigned int *op; int nid = NID_undef; o.ln = s; op = OBJ_bsearch_ln(&oo, ln_objs, NUM_LN); if (op != NULL) return nid_objs[*op].nid; if (!ossl_obj_read_lock(1)) { ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_READ_LOCK); return NID_undef; } if (added != NULL) { ad.type = ADDED_LNAME; ad.obj = &o; adp = lh_ADDED_OBJ_retrieve(added, &ad); if (adp != NULL) nid = adp->obj->nid; } ossl_obj_unlock(1); return nid; } int OBJ_sn2nid(const char *s) { ASN1_OBJECT o; const ASN1_OBJECT *oo = &o; ADDED_OBJ ad, *adp; const unsigned int *op; int nid = NID_undef; o.sn = s; op = OBJ_bsearch_sn(&oo, sn_objs, NUM_SN); if (op != NULL) return nid_objs[*op].nid; if (!ossl_obj_read_lock(1)) { ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_READ_LOCK); return NID_undef; } if (added != NULL) { ad.type = ADDED_SNAME; ad.obj = &o; adp = lh_ADDED_OBJ_retrieve(added, &ad); if (adp != NULL) nid = adp->obj->nid; } ossl_obj_unlock(1); return nid; } const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, int (*cmp) (const void *, const void *)) { return OBJ_bsearch_ex_(key, base, num, size, cmp, 0); } const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, int size, int (*cmp) (const void *, const void *), int flags) { const char *p = ossl_bsearch(key, base, num, size, cmp, flags); #ifdef CHARSET_EBCDIC /* * THIS IS A KLUDGE - Because the *_obj is sorted in ASCII order, and I * don't have perl (yet), we revert to a *LINEAR* search when the object * wasn't found in the binary search. */ if (p == NULL) { const char *base_ = base; int l, h, i = 0, c = 0; char *p1; for (i = 0; i < num; ++i) { p1 = &(base_[i * size]); c = (*cmp) (key, p1); if (c == 0 || (c < 0 && (flags & OBJ_BSEARCH_VALUE_ON_NOMATCH))) return p1; } } #endif return p; } /* * Parse a BIO sink to create some extra oid's objects. * Line format:<OID:isdigit or '.']><isspace><SN><isspace><LN> */ int OBJ_create_objects(BIO *in) { char buf[512]; int i, num = 0; char *o, *s, *l = NULL; for (;;) { s = o = NULL; i = BIO_gets(in, buf, 512); if (i <= 0) return num; buf[i - 1] = '\0'; if (!ossl_isalnum(buf[0])) return num; o = s = buf; while (ossl_isdigit(*s) || *s == '.') s++; if (*s != '\0') { *(s++) = '\0'; while (ossl_isspace(*s)) s++; if (*s == '\0') { s = NULL; } else { l = s; while (*l != '\0' && !ossl_isspace(*l)) l++; if (*l != '\0') { *(l++) = '\0'; while (ossl_isspace(*l)) l++; if (*l == '\0') { l = NULL; } } else { l = NULL; } } } else { s = NULL; } if (*o == '\0') return num; if (!OBJ_create(o, s, l)) return num; num++; } } int OBJ_create(const char *oid, const char *sn, const char *ln) { ASN1_OBJECT *tmpoid = NULL; int ok = 0; /* With no arguments at all, nothing can be done */ if (oid == NULL && sn == NULL && ln == NULL) { ERR_raise(ERR_LIB_OBJ, ERR_R_PASSED_INVALID_ARGUMENT); return 0; } /* Check to see if short or long name already present */ if ((sn != NULL && OBJ_sn2nid(sn) != NID_undef) || (ln != NULL && OBJ_ln2nid(ln) != NID_undef)) { ERR_raise(ERR_LIB_OBJ, OBJ_R_OID_EXISTS); return 0; } if (oid != NULL) { /* Convert numerical OID string to an ASN1_OBJECT structure */ tmpoid = OBJ_txt2obj(oid, 1); if (tmpoid == NULL) return 0; } else { /* Create a no-OID ASN1_OBJECT */ tmpoid = ASN1_OBJECT_new(); if (tmpoid == NULL) { ERR_raise(ERR_LIB_OBJ, ERR_R_ASN1_LIB); return 0; } } if (!ossl_obj_write_lock(1)) { ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_WRITE_LOCK); ASN1_OBJECT_free(tmpoid); return 0; } /* If NID is not NID_undef then object already exists */ if (oid != NULL && ossl_obj_obj2nid(tmpoid, 0) != NID_undef) { ERR_raise(ERR_LIB_OBJ, OBJ_R_OID_EXISTS); goto err; } tmpoid->nid = obj_new_nid_unlocked(1); if (tmpoid->nid == NID_undef) goto err; tmpoid->sn = (char *)sn; tmpoid->ln = (char *)ln; ok = ossl_obj_add_object(tmpoid, 0); tmpoid->sn = NULL; tmpoid->ln = NULL; err: ossl_obj_unlock(1); ASN1_OBJECT_free(tmpoid); return ok; } size_t OBJ_length(const ASN1_OBJECT *obj) { if (obj == NULL) return 0; return obj->length; } const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj) { if (obj == NULL) return NULL; return obj->data; } int OBJ_add_object(const ASN1_OBJECT *obj) { return ossl_obj_add_object(obj, 1); } int OBJ_obj2nid(const ASN1_OBJECT *a) { return ossl_obj_obj2nid(a, 1); }
./openssl/crypto/objects/obj_dat.h
/* * WARNING: do not edit! * Generated by crypto/objects/obj_dat.pl * * Copyright 1995-2023 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 */ /* Serialized OID's */ static const unsigned char so[8476] = { 0x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 0] OBJ_rsadsi */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 6] OBJ_pkcs */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x02, /* [ 13] OBJ_md2 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x05, /* [ 21] OBJ_md5 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x04, /* [ 29] OBJ_rc4 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01, /* [ 37] OBJ_rsaEncryption */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02, /* [ 46] OBJ_md2WithRSAEncryption */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04, /* [ 55] OBJ_md5WithRSAEncryption */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x01, /* [ 64] OBJ_pbeWithMD2AndDES_CBC */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x03, /* [ 73] OBJ_pbeWithMD5AndDES_CBC */ 0x55, /* [ 82] OBJ_X500 */ 0x55,0x04, /* [ 83] OBJ_X509 */ 0x55,0x04,0x03, /* [ 85] OBJ_commonName */ 0x55,0x04,0x06, /* [ 88] OBJ_countryName */ 0x55,0x04,0x07, /* [ 91] OBJ_localityName */ 0x55,0x04,0x08, /* [ 94] OBJ_stateOrProvinceName */ 0x55,0x04,0x0A, /* [ 97] OBJ_organizationName */ 0x55,0x04,0x0B, /* [ 100] OBJ_organizationalUnitName */ 0x55,0x08,0x01,0x01, /* [ 103] OBJ_rsa */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07, /* [ 107] OBJ_pkcs7 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x01, /* [ 115] OBJ_pkcs7_data */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x02, /* [ 124] OBJ_pkcs7_signed */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x03, /* [ 133] OBJ_pkcs7_enveloped */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x04, /* [ 142] OBJ_pkcs7_signedAndEnveloped */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x05, /* [ 151] OBJ_pkcs7_digest */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x06, /* [ 160] OBJ_pkcs7_encrypted */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x03, /* [ 169] OBJ_pkcs3 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x03,0x01, /* [ 177] OBJ_dhKeyAgreement */ 0x2B,0x0E,0x03,0x02,0x06, /* [ 186] OBJ_des_ecb */ 0x2B,0x0E,0x03,0x02,0x09, /* [ 191] OBJ_des_cfb64 */ 0x2B,0x0E,0x03,0x02,0x07, /* [ 196] OBJ_des_cbc */ 0x2B,0x0E,0x03,0x02,0x11, /* [ 201] OBJ_des_ede_ecb */ 0x2B,0x06,0x01,0x04,0x01,0x81,0x3C,0x07,0x01,0x01,0x02, /* [ 206] OBJ_idea_cbc */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x02, /* [ 217] OBJ_rc2_cbc */ 0x2B,0x0E,0x03,0x02,0x12, /* [ 225] OBJ_sha */ 0x2B,0x0E,0x03,0x02,0x0F, /* [ 230] OBJ_shaWithRSAEncryption */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x07, /* [ 235] OBJ_des_ede3_cbc */ 0x2B,0x0E,0x03,0x02,0x08, /* [ 243] OBJ_des_ofb64 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09, /* [ 248] OBJ_pkcs9 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x01, /* [ 256] OBJ_pkcs9_emailAddress */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x02, /* [ 265] OBJ_pkcs9_unstructuredName */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x03, /* [ 274] OBJ_pkcs9_contentType */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x04, /* [ 283] OBJ_pkcs9_messageDigest */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x05, /* [ 292] OBJ_pkcs9_signingTime */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x06, /* [ 301] OBJ_pkcs9_countersignature */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x07, /* [ 310] OBJ_pkcs9_challengePassword */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x08, /* [ 319] OBJ_pkcs9_unstructuredAddress */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x09, /* [ 328] OBJ_pkcs9_extCertAttributes */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42, /* [ 337] OBJ_netscape */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01, /* [ 344] OBJ_netscape_cert_extension */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x02, /* [ 352] OBJ_netscape_data_type */ 0x2B,0x0E,0x03,0x02,0x1A, /* [ 360] OBJ_sha1 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05, /* [ 365] OBJ_sha1WithRSAEncryption */ 0x2B,0x0E,0x03,0x02,0x0D, /* [ 374] OBJ_dsaWithSHA */ 0x2B,0x0E,0x03,0x02,0x0C, /* [ 379] OBJ_dsa_2 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x0B, /* [ 384] OBJ_pbeWithSHA1AndRC2_CBC */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x0C, /* [ 393] OBJ_id_pbkdf2 */ 0x2B,0x0E,0x03,0x02,0x1B, /* [ 402] OBJ_dsaWithSHA1_2 */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x01, /* [ 407] OBJ_netscape_cert_type */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x02, /* [ 416] OBJ_netscape_base_url */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x03, /* [ 425] OBJ_netscape_revocation_url */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x04, /* [ 434] OBJ_netscape_ca_revocation_url */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x07, /* [ 443] OBJ_netscape_renewal_url */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x08, /* [ 452] OBJ_netscape_ca_policy_url */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x0C, /* [ 461] OBJ_netscape_ssl_server_name */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x0D, /* [ 470] OBJ_netscape_comment */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x02,0x05, /* [ 479] OBJ_netscape_cert_sequence */ 0x55,0x1D, /* [ 488] OBJ_id_ce */ 0x55,0x1D,0x0E, /* [ 490] OBJ_subject_key_identifier */ 0x55,0x1D,0x0F, /* [ 493] OBJ_key_usage */ 0x55,0x1D,0x10, /* [ 496] OBJ_private_key_usage_period */ 0x55,0x1D,0x11, /* [ 499] OBJ_subject_alt_name */ 0x55,0x1D,0x12, /* [ 502] OBJ_issuer_alt_name */ 0x55,0x1D,0x13, /* [ 505] OBJ_basic_constraints */ 0x55,0x1D,0x14, /* [ 508] OBJ_crl_number */ 0x55,0x1D,0x20, /* [ 511] OBJ_certificate_policies */ 0x55,0x1D,0x23, /* [ 514] OBJ_authority_key_identifier */ 0x2B,0x06,0x01,0x04,0x01,0x97,0x55,0x01,0x02, /* [ 517] OBJ_bf_cbc */ 0x55,0x08,0x03,0x65, /* [ 526] OBJ_mdc2 */ 0x55,0x08,0x03,0x64, /* [ 530] OBJ_mdc2WithRSA */ 0x55,0x04,0x2A, /* [ 534] OBJ_givenName */ 0x55,0x04,0x04, /* [ 537] OBJ_surname */ 0x55,0x04,0x2B, /* [ 540] OBJ_initials */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x2C, /* [ 543] OBJ_uniqueIdentifier */ 0x55,0x1D,0x1F, /* [ 553] OBJ_crl_distribution_points */ 0x2B,0x0E,0x03,0x02,0x03, /* [ 556] OBJ_md5WithRSA */ 0x55,0x04,0x05, /* [ 561] OBJ_serialNumber */ 0x55,0x04,0x0C, /* [ 564] OBJ_title */ 0x55,0x04,0x0D, /* [ 567] OBJ_description */ 0x2A,0x86,0x48,0x86,0xF6,0x7D,0x07,0x42,0x0A, /* [ 570] OBJ_cast5_cbc */ 0x2A,0x86,0x48,0x86,0xF6,0x7D,0x07,0x42,0x0C, /* [ 579] OBJ_pbeWithMD5AndCast5_CBC */ 0x2A,0x86,0x48,0xCE,0x38,0x04,0x03, /* [ 588] OBJ_dsaWithSHA1 */ 0x2B,0x0E,0x03,0x02,0x1D, /* [ 595] OBJ_sha1WithRSA */ 0x2A,0x86,0x48,0xCE,0x38,0x04,0x01, /* [ 600] OBJ_dsa */ 0x2B,0x24,0x03,0x02,0x01, /* [ 607] OBJ_ripemd160 */ 0x2B,0x24,0x03,0x03,0x01,0x02, /* [ 612] OBJ_ripemd160WithRSA */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x08, /* [ 618] OBJ_rc5_cbc */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x03,0x08, /* [ 626] OBJ_zlib_compression */ 0x55,0x1D,0x25, /* [ 637] OBJ_ext_key_usage */ 0x2B,0x06,0x01,0x05,0x05,0x07, /* [ 640] OBJ_id_pkix */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03, /* [ 646] OBJ_id_kp */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x01, /* [ 653] OBJ_server_auth */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x02, /* [ 661] OBJ_client_auth */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x03, /* [ 669] OBJ_code_sign */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x04, /* [ 677] OBJ_email_protect */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x08, /* [ 685] OBJ_time_stamp */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x15, /* [ 693] OBJ_ms_code_ind */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x16, /* [ 703] OBJ_ms_code_com */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x0A,0x03,0x01, /* [ 713] OBJ_ms_ctl_sign */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x0A,0x03,0x03, /* [ 723] OBJ_ms_sgc */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x0A,0x03,0x04, /* [ 733] OBJ_ms_efs */ 0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x04,0x01, /* [ 743] OBJ_ns_sgc */ 0x55,0x1D,0x1B, /* [ 752] OBJ_delta_crl */ 0x55,0x1D,0x15, /* [ 755] OBJ_crl_reason */ 0x55,0x1D,0x18, /* [ 758] OBJ_invalidity_date */ 0x2B,0x65,0x01,0x04,0x01, /* [ 761] OBJ_sxnet */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x01,0x01, /* [ 766] OBJ_pbe_WithSHA1And128BitRC4 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x01,0x02, /* [ 776] OBJ_pbe_WithSHA1And40BitRC4 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x01,0x03, /* [ 786] OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x01,0x04, /* [ 796] OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x01,0x05, /* [ 806] OBJ_pbe_WithSHA1And128BitRC2_CBC */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x01,0x06, /* [ 816] OBJ_pbe_WithSHA1And40BitRC2_CBC */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x0A,0x01,0x01, /* [ 826] OBJ_keyBag */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x0A,0x01,0x02, /* [ 837] OBJ_pkcs8ShroudedKeyBag */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x0A,0x01,0x03, /* [ 848] OBJ_certBag */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x0A,0x01,0x04, /* [ 859] OBJ_crlBag */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x0A,0x01,0x05, /* [ 870] OBJ_secretBag */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x0A,0x01,0x06, /* [ 881] OBJ_safeContentsBag */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x14, /* [ 892] OBJ_friendlyName */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x15, /* [ 901] OBJ_localKeyID */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x16,0x01, /* [ 910] OBJ_x509Certificate */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x16,0x02, /* [ 920] OBJ_sdsiCertificate */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x17,0x01, /* [ 930] OBJ_x509Crl */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x0D, /* [ 940] OBJ_pbes2 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x0E, /* [ 949] OBJ_pbmac1 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x07, /* [ 958] OBJ_hmacWithSHA1 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x02,0x01, /* [ 966] OBJ_id_qt_cps */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x02,0x02, /* [ 974] OBJ_id_qt_unotice */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x0F, /* [ 982] OBJ_SMIMECapabilities */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x04, /* [ 991] OBJ_pbeWithMD2AndRC2_CBC */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x06, /* [ 1000] OBJ_pbeWithMD5AndRC2_CBC */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x0A, /* [ 1009] OBJ_pbeWithSHA1AndDES_CBC */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x0E, /* [ 1018] OBJ_ms_ext_req */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x0E, /* [ 1028] OBJ_ext_req */ 0x55,0x04,0x29, /* [ 1037] OBJ_name */ 0x55,0x04,0x2E, /* [ 1040] OBJ_dnQualifier */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01, /* [ 1043] OBJ_id_pe */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30, /* [ 1050] OBJ_id_ad */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x01, /* [ 1057] OBJ_info_access */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01, /* [ 1065] OBJ_ad_OCSP */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x02, /* [ 1073] OBJ_ad_ca_issuers */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x09, /* [ 1081] OBJ_OCSP_sign */ 0x2A, /* [ 1089] OBJ_member_body */ 0x2A,0x86,0x48, /* [ 1090] OBJ_ISO_US */ 0x2A,0x86,0x48,0xCE,0x38, /* [ 1093] OBJ_X9_57 */ 0x2A,0x86,0x48,0xCE,0x38,0x04, /* [ 1098] OBJ_X9cm */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01, /* [ 1104] OBJ_pkcs1 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05, /* [ 1112] OBJ_pkcs5 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10, /* [ 1120] OBJ_SMIME */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x00, /* [ 1129] OBJ_id_smime_mod */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01, /* [ 1139] OBJ_id_smime_ct */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02, /* [ 1149] OBJ_id_smime_aa */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x03, /* [ 1159] OBJ_id_smime_alg */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x04, /* [ 1169] OBJ_id_smime_cd */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x05, /* [ 1179] OBJ_id_smime_spq */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x06, /* [ 1189] OBJ_id_smime_cti */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x00,0x01, /* [ 1199] OBJ_id_smime_mod_cms */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x00,0x02, /* [ 1210] OBJ_id_smime_mod_ess */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x00,0x03, /* [ 1221] OBJ_id_smime_mod_oid */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x00,0x04, /* [ 1232] OBJ_id_smime_mod_msg_v3 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x00,0x05, /* [ 1243] OBJ_id_smime_mod_ets_eSignature_88 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x00,0x06, /* [ 1254] OBJ_id_smime_mod_ets_eSignature_97 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x00,0x07, /* [ 1265] OBJ_id_smime_mod_ets_eSigPolicy_88 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x00,0x08, /* [ 1276] OBJ_id_smime_mod_ets_eSigPolicy_97 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x01, /* [ 1287] OBJ_id_smime_ct_receipt */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x02, /* [ 1298] OBJ_id_smime_ct_authData */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x03, /* [ 1309] OBJ_id_smime_ct_publishCert */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x04, /* [ 1320] OBJ_id_smime_ct_TSTInfo */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x05, /* [ 1331] OBJ_id_smime_ct_TDTInfo */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x06, /* [ 1342] OBJ_id_smime_ct_contentInfo */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x07, /* [ 1353] OBJ_id_smime_ct_DVCSRequestData */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x08, /* [ 1364] OBJ_id_smime_ct_DVCSResponseData */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x01, /* [ 1375] OBJ_id_smime_aa_receiptRequest */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x02, /* [ 1386] OBJ_id_smime_aa_securityLabel */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x03, /* [ 1397] OBJ_id_smime_aa_mlExpandHistory */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x04, /* [ 1408] OBJ_id_smime_aa_contentHint */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x05, /* [ 1419] OBJ_id_smime_aa_msgSigDigest */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x06, /* [ 1430] OBJ_id_smime_aa_encapContentType */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x07, /* [ 1441] OBJ_id_smime_aa_contentIdentifier */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x08, /* [ 1452] OBJ_id_smime_aa_macValue */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x09, /* [ 1463] OBJ_id_smime_aa_equivalentLabels */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x0A, /* [ 1474] OBJ_id_smime_aa_contentReference */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x0B, /* [ 1485] OBJ_id_smime_aa_encrypKeyPref */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x0C, /* [ 1496] OBJ_id_smime_aa_signingCertificate */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x0D, /* [ 1507] OBJ_id_smime_aa_smimeEncryptCerts */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x0E, /* [ 1518] OBJ_id_smime_aa_timeStampToken */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x0F, /* [ 1529] OBJ_id_smime_aa_ets_sigPolicyId */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x10, /* [ 1540] OBJ_id_smime_aa_ets_commitmentType */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x11, /* [ 1551] OBJ_id_smime_aa_ets_signerLocation */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x12, /* [ 1562] OBJ_id_smime_aa_ets_signerAttr */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x13, /* [ 1573] OBJ_id_smime_aa_ets_otherSigCert */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x14, /* [ 1584] OBJ_id_smime_aa_ets_contentTimestamp */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x15, /* [ 1595] OBJ_id_smime_aa_ets_CertificateRefs */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x16, /* [ 1606] OBJ_id_smime_aa_ets_RevocationRefs */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x17, /* [ 1617] OBJ_id_smime_aa_ets_certValues */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x18, /* [ 1628] OBJ_id_smime_aa_ets_revocationValues */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x19, /* [ 1639] OBJ_id_smime_aa_ets_escTimeStamp */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x1A, /* [ 1650] OBJ_id_smime_aa_ets_certCRLTimestamp */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x1B, /* [ 1661] OBJ_id_smime_aa_ets_archiveTimeStamp */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x1C, /* [ 1672] OBJ_id_smime_aa_signatureType */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x1D, /* [ 1683] OBJ_id_smime_aa_dvcs_dvc */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x03,0x01, /* [ 1694] OBJ_id_smime_alg_ESDHwith3DES */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x03,0x02, /* [ 1705] OBJ_id_smime_alg_ESDHwithRC2 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x03,0x03, /* [ 1716] OBJ_id_smime_alg_3DESwrap */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x03,0x04, /* [ 1727] OBJ_id_smime_alg_RC2wrap */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x03,0x05, /* [ 1738] OBJ_id_smime_alg_ESDH */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x03,0x06, /* [ 1749] OBJ_id_smime_alg_CMS3DESwrap */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x03,0x07, /* [ 1760] OBJ_id_smime_alg_CMSRC2wrap */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x04,0x01, /* [ 1771] OBJ_id_smime_cd_ldap */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x05,0x01, /* [ 1782] OBJ_id_smime_spq_ets_sqt_uri */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x05,0x02, /* [ 1793] OBJ_id_smime_spq_ets_sqt_unotice */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x06,0x01, /* [ 1804] OBJ_id_smime_cti_ets_proofOfOrigin */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x06,0x02, /* [ 1815] OBJ_id_smime_cti_ets_proofOfReceipt */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x06,0x03, /* [ 1826] OBJ_id_smime_cti_ets_proofOfDelivery */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x06,0x04, /* [ 1837] OBJ_id_smime_cti_ets_proofOfSender */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x06,0x05, /* [ 1848] OBJ_id_smime_cti_ets_proofOfApproval */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x06,0x06, /* [ 1859] OBJ_id_smime_cti_ets_proofOfCreation */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x04, /* [ 1870] OBJ_md4 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00, /* [ 1878] OBJ_id_pkix_mod */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x02, /* [ 1885] OBJ_id_qt */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04, /* [ 1892] OBJ_id_it */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05, /* [ 1899] OBJ_id_pkip */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x06, /* [ 1906] OBJ_id_alg */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07, /* [ 1913] OBJ_id_cmc */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x08, /* [ 1920] OBJ_id_on */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x09, /* [ 1927] OBJ_id_pda */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0A, /* [ 1934] OBJ_id_aca */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0B, /* [ 1941] OBJ_id_qcs */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0C, /* [ 1948] OBJ_id_cct */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x01, /* [ 1955] OBJ_id_pkix1_explicit_88 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x02, /* [ 1963] OBJ_id_pkix1_implicit_88 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x03, /* [ 1971] OBJ_id_pkix1_explicit_93 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x04, /* [ 1979] OBJ_id_pkix1_implicit_93 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x05, /* [ 1987] OBJ_id_mod_crmf */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x06, /* [ 1995] OBJ_id_mod_cmc */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x07, /* [ 2003] OBJ_id_mod_kea_profile_88 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x08, /* [ 2011] OBJ_id_mod_kea_profile_93 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x09, /* [ 2019] OBJ_id_mod_cmp */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x0A, /* [ 2027] OBJ_id_mod_qualified_cert_88 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x0B, /* [ 2035] OBJ_id_mod_qualified_cert_93 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x0C, /* [ 2043] OBJ_id_mod_attribute_cert */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x0D, /* [ 2051] OBJ_id_mod_timestamp_protocol */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x0E, /* [ 2059] OBJ_id_mod_ocsp */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x0F, /* [ 2067] OBJ_id_mod_dvcs */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x10, /* [ 2075] OBJ_id_mod_cmp2000 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x02, /* [ 2083] OBJ_biometricInfo */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x03, /* [ 2091] OBJ_qcStatements */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x04, /* [ 2099] OBJ_ac_auditEntity */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x05, /* [ 2107] OBJ_ac_targeting */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x06, /* [ 2115] OBJ_aaControls */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x07, /* [ 2123] OBJ_sbgp_ipAddrBlock */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x08, /* [ 2131] OBJ_sbgp_autonomousSysNum */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x09, /* [ 2139] OBJ_sbgp_routerIdentifier */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x02,0x03, /* [ 2147] OBJ_textNotice */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x05, /* [ 2155] OBJ_ipsecEndSystem */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x06, /* [ 2163] OBJ_ipsecTunnel */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x07, /* [ 2171] OBJ_ipsecUser */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x0A, /* [ 2179] OBJ_dvcs */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x01, /* [ 2187] OBJ_id_it_caProtEncCert */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x02, /* [ 2195] OBJ_id_it_signKeyPairTypes */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x03, /* [ 2203] OBJ_id_it_encKeyPairTypes */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x04, /* [ 2211] OBJ_id_it_preferredSymmAlg */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x05, /* [ 2219] OBJ_id_it_caKeyUpdateInfo */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x06, /* [ 2227] OBJ_id_it_currentCRL */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x07, /* [ 2235] OBJ_id_it_unsupportedOIDs */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x08, /* [ 2243] OBJ_id_it_subscriptionRequest */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x09, /* [ 2251] OBJ_id_it_subscriptionResponse */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x0A, /* [ 2259] OBJ_id_it_keyPairParamReq */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x0B, /* [ 2267] OBJ_id_it_keyPairParamRep */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x0C, /* [ 2275] OBJ_id_it_revPassphrase */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x0D, /* [ 2283] OBJ_id_it_implicitConfirm */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x0E, /* [ 2291] OBJ_id_it_confirmWaitTime */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x0F, /* [ 2299] OBJ_id_it_origPKIMessage */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x01, /* [ 2307] OBJ_id_regCtrl */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x02, /* [ 2315] OBJ_id_regInfo */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x01,0x01, /* [ 2323] OBJ_id_regCtrl_regToken */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x01,0x02, /* [ 2332] OBJ_id_regCtrl_authenticator */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x01,0x03, /* [ 2341] OBJ_id_regCtrl_pkiPublicationInfo */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x01,0x04, /* [ 2350] OBJ_id_regCtrl_pkiArchiveOptions */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x01,0x05, /* [ 2359] OBJ_id_regCtrl_oldCertID */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x01,0x06, /* [ 2368] OBJ_id_regCtrl_protocolEncrKey */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x02,0x01, /* [ 2377] OBJ_id_regInfo_utf8Pairs */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x02,0x02, /* [ 2386] OBJ_id_regInfo_certReq */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x06,0x01, /* [ 2395] OBJ_id_alg_des40 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x06,0x02, /* [ 2403] OBJ_id_alg_noSignature */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x06,0x03, /* [ 2411] OBJ_id_alg_dh_sig_hmac_sha1 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x06,0x04, /* [ 2419] OBJ_id_alg_dh_pop */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x01, /* [ 2427] OBJ_id_cmc_statusInfo */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x02, /* [ 2435] OBJ_id_cmc_identification */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x03, /* [ 2443] OBJ_id_cmc_identityProof */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x04, /* [ 2451] OBJ_id_cmc_dataReturn */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x05, /* [ 2459] OBJ_id_cmc_transactionId */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x06, /* [ 2467] OBJ_id_cmc_senderNonce */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x07, /* [ 2475] OBJ_id_cmc_recipientNonce */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x08, /* [ 2483] OBJ_id_cmc_addExtensions */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x09, /* [ 2491] OBJ_id_cmc_encryptedPOP */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x0A, /* [ 2499] OBJ_id_cmc_decryptedPOP */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x0B, /* [ 2507] OBJ_id_cmc_lraPOPWitness */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x0F, /* [ 2515] OBJ_id_cmc_getCert */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x10, /* [ 2523] OBJ_id_cmc_getCRL */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x11, /* [ 2531] OBJ_id_cmc_revokeRequest */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x12, /* [ 2539] OBJ_id_cmc_regInfo */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x13, /* [ 2547] OBJ_id_cmc_responseInfo */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x15, /* [ 2555] OBJ_id_cmc_queryPending */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x16, /* [ 2563] OBJ_id_cmc_popLinkRandom */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x17, /* [ 2571] OBJ_id_cmc_popLinkWitness */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x07,0x18, /* [ 2579] OBJ_id_cmc_confirmCertAcceptance */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x08,0x01, /* [ 2587] OBJ_id_on_personalData */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x09,0x01, /* [ 2595] OBJ_id_pda_dateOfBirth */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x09,0x02, /* [ 2603] OBJ_id_pda_placeOfBirth */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x09,0x03, /* [ 2611] OBJ_id_pda_gender */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x09,0x04, /* [ 2619] OBJ_id_pda_countryOfCitizenship */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x09,0x05, /* [ 2627] OBJ_id_pda_countryOfResidence */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0A,0x01, /* [ 2635] OBJ_id_aca_authenticationInfo */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0A,0x02, /* [ 2643] OBJ_id_aca_accessIdentity */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0A,0x03, /* [ 2651] OBJ_id_aca_chargingIdentity */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0A,0x04, /* [ 2659] OBJ_id_aca_group */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0A,0x05, /* [ 2667] OBJ_id_aca_role */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0B,0x01, /* [ 2675] OBJ_id_qcs_pkixQCSyntax_v1 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0C,0x01, /* [ 2683] OBJ_id_cct_crs */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0C,0x02, /* [ 2691] OBJ_id_cct_PKIData */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0C,0x03, /* [ 2699] OBJ_id_cct_PKIResponse */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x03, /* [ 2707] OBJ_ad_timeStamping */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x04, /* [ 2715] OBJ_ad_dvcs */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x01, /* [ 2723] OBJ_id_pkix_OCSP_basic */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x02, /* [ 2732] OBJ_id_pkix_OCSP_Nonce */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x03, /* [ 2741] OBJ_id_pkix_OCSP_CrlID */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x04, /* [ 2750] OBJ_id_pkix_OCSP_acceptableResponses */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x05, /* [ 2759] OBJ_id_pkix_OCSP_noCheck */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x06, /* [ 2768] OBJ_id_pkix_OCSP_archiveCutoff */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x07, /* [ 2777] OBJ_id_pkix_OCSP_serviceLocator */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x08, /* [ 2786] OBJ_id_pkix_OCSP_extendedStatus */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x09, /* [ 2795] OBJ_id_pkix_OCSP_valid */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x0A, /* [ 2804] OBJ_id_pkix_OCSP_path */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x0B, /* [ 2813] OBJ_id_pkix_OCSP_trustRoot */ 0x2B,0x0E,0x03,0x02, /* [ 2822] OBJ_algorithm */ 0x2B,0x0E,0x03,0x02,0x0B, /* [ 2826] OBJ_rsaSignature */ 0x55,0x08, /* [ 2831] OBJ_X500algorithms */ 0x2B, /* [ 2833] OBJ_org */ 0x2B,0x06, /* [ 2834] OBJ_dod */ 0x2B,0x06,0x01, /* [ 2836] OBJ_iana */ 0x2B,0x06,0x01,0x01, /* [ 2839] OBJ_Directory */ 0x2B,0x06,0x01,0x02, /* [ 2843] OBJ_Management */ 0x2B,0x06,0x01,0x03, /* [ 2847] OBJ_Experimental */ 0x2B,0x06,0x01,0x04, /* [ 2851] OBJ_Private */ 0x2B,0x06,0x01,0x05, /* [ 2855] OBJ_Security */ 0x2B,0x06,0x01,0x06, /* [ 2859] OBJ_SNMPv2 */ 0x2B,0x06,0x01,0x07, /* [ 2863] OBJ_Mail */ 0x2B,0x06,0x01,0x04,0x01, /* [ 2867] OBJ_Enterprises */ 0x2B,0x06,0x01,0x04,0x01,0x8B,0x3A,0x82,0x58, /* [ 2872] OBJ_dcObject */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x19, /* [ 2881] OBJ_domainComponent */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x0D, /* [ 2891] OBJ_Domain */ 0x55,0x01,0x05, /* [ 2901] OBJ_selected_attribute_types */ 0x55,0x01,0x05,0x37, /* [ 2904] OBJ_clearance */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x03, /* [ 2908] OBJ_md4WithRSAEncryption */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x0A, /* [ 2917] OBJ_ac_proxying */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x0B, /* [ 2925] OBJ_sinfo_access */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0A,0x06, /* [ 2933] OBJ_id_aca_encAttrs */ 0x55,0x04,0x48, /* [ 2941] OBJ_role */ 0x55,0x1D,0x24, /* [ 2944] OBJ_policy_constraints */ 0x55,0x1D,0x37, /* [ 2947] OBJ_target_information */ 0x55,0x1D,0x38, /* [ 2950] OBJ_no_rev_avail */ 0x2A,0x86,0x48,0xCE,0x3D, /* [ 2953] OBJ_ansi_X9_62 */ 0x2A,0x86,0x48,0xCE,0x3D,0x01,0x01, /* [ 2958] OBJ_X9_62_prime_field */ 0x2A,0x86,0x48,0xCE,0x3D,0x01,0x02, /* [ 2965] OBJ_X9_62_characteristic_two_field */ 0x2A,0x86,0x48,0xCE,0x3D,0x02,0x01, /* [ 2972] OBJ_X9_62_id_ecPublicKey */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x01, /* [ 2979] OBJ_X9_62_prime192v1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x02, /* [ 2987] OBJ_X9_62_prime192v2 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x03, /* [ 2995] OBJ_X9_62_prime192v3 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x04, /* [ 3003] OBJ_X9_62_prime239v1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x05, /* [ 3011] OBJ_X9_62_prime239v2 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x06, /* [ 3019] OBJ_X9_62_prime239v3 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x07, /* [ 3027] OBJ_X9_62_prime256v1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x04,0x01, /* [ 3035] OBJ_ecdsa_with_SHA1 */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x11,0x01, /* [ 3042] OBJ_ms_csp_name */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x01, /* [ 3051] OBJ_aes_128_ecb */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x02, /* [ 3060] OBJ_aes_128_cbc */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x03, /* [ 3069] OBJ_aes_128_ofb128 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x04, /* [ 3078] OBJ_aes_128_cfb128 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x15, /* [ 3087] OBJ_aes_192_ecb */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x16, /* [ 3096] OBJ_aes_192_cbc */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x17, /* [ 3105] OBJ_aes_192_ofb128 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x18, /* [ 3114] OBJ_aes_192_cfb128 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x29, /* [ 3123] OBJ_aes_256_ecb */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2A, /* [ 3132] OBJ_aes_256_cbc */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2B, /* [ 3141] OBJ_aes_256_ofb128 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2C, /* [ 3150] OBJ_aes_256_cfb128 */ 0x55,0x1D,0x17, /* [ 3159] OBJ_hold_instruction_code */ 0x2A,0x86,0x48,0xCE,0x38,0x02,0x01, /* [ 3162] OBJ_hold_instruction_none */ 0x2A,0x86,0x48,0xCE,0x38,0x02,0x02, /* [ 3169] OBJ_hold_instruction_call_issuer */ 0x2A,0x86,0x48,0xCE,0x38,0x02,0x03, /* [ 3176] OBJ_hold_instruction_reject */ 0x09, /* [ 3183] OBJ_data */ 0x09,0x92,0x26, /* [ 3184] OBJ_pss */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C, /* [ 3187] OBJ_ucl */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64, /* [ 3194] OBJ_pilot */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01, /* [ 3202] OBJ_pilotAttributeType */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x03, /* [ 3211] OBJ_pilotAttributeSyntax */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04, /* [ 3220] OBJ_pilotObjectClass */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x0A, /* [ 3229] OBJ_pilotGroups */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x03,0x04, /* [ 3238] OBJ_iA5StringSyntax */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x03,0x05, /* [ 3248] OBJ_caseIgnoreIA5StringSyntax */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x03, /* [ 3258] OBJ_pilotObject */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x04, /* [ 3268] OBJ_pilotPerson */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x05, /* [ 3278] OBJ_account */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x06, /* [ 3288] OBJ_document */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x07, /* [ 3298] OBJ_room */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x09, /* [ 3308] OBJ_documentSeries */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x0E, /* [ 3318] OBJ_rFC822localPart */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x0F, /* [ 3328] OBJ_dNSDomain */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x11, /* [ 3338] OBJ_domainRelatedObject */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x12, /* [ 3348] OBJ_friendlyCountry */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x13, /* [ 3358] OBJ_simpleSecurityObject */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x14, /* [ 3368] OBJ_pilotOrganization */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x15, /* [ 3378] OBJ_pilotDSA */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x04,0x16, /* [ 3388] OBJ_qualityLabelledData */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x01, /* [ 3398] OBJ_userId */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x02, /* [ 3408] OBJ_textEncodedORAddress */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x03, /* [ 3418] OBJ_rfc822Mailbox */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x04, /* [ 3428] OBJ_info */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x05, /* [ 3438] OBJ_favouriteDrink */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x06, /* [ 3448] OBJ_roomNumber */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x07, /* [ 3458] OBJ_photo */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x08, /* [ 3468] OBJ_userClass */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x09, /* [ 3478] OBJ_host */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x0A, /* [ 3488] OBJ_manager */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x0B, /* [ 3498] OBJ_documentIdentifier */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x0C, /* [ 3508] OBJ_documentTitle */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x0D, /* [ 3518] OBJ_documentVersion */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x0E, /* [ 3528] OBJ_documentAuthor */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x0F, /* [ 3538] OBJ_documentLocation */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x14, /* [ 3548] OBJ_homeTelephoneNumber */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x15, /* [ 3558] OBJ_secretary */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x16, /* [ 3568] OBJ_otherMailbox */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x17, /* [ 3578] OBJ_lastModifiedTime */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x18, /* [ 3588] OBJ_lastModifiedBy */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x1A, /* [ 3598] OBJ_aRecord */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x1B, /* [ 3608] OBJ_pilotAttributeType27 */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x1C, /* [ 3618] OBJ_mXRecord */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x1D, /* [ 3628] OBJ_nSRecord */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x1E, /* [ 3638] OBJ_sOARecord */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x1F, /* [ 3648] OBJ_cNAMERecord */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x25, /* [ 3658] OBJ_associatedDomain */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x26, /* [ 3668] OBJ_associatedName */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x27, /* [ 3678] OBJ_homePostalAddress */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x28, /* [ 3688] OBJ_personalTitle */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x29, /* [ 3698] OBJ_mobileTelephoneNumber */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x2A, /* [ 3708] OBJ_pagerTelephoneNumber */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x2B, /* [ 3718] OBJ_friendlyCountryName */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x2D, /* [ 3728] OBJ_organizationalStatus */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x2E, /* [ 3738] OBJ_janetMailbox */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x2F, /* [ 3748] OBJ_mailPreferenceOption */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x30, /* [ 3758] OBJ_buildingName */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x31, /* [ 3768] OBJ_dSAQuality */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x32, /* [ 3778] OBJ_singleLevelQuality */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x33, /* [ 3788] OBJ_subtreeMinimumQuality */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x34, /* [ 3798] OBJ_subtreeMaximumQuality */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x35, /* [ 3808] OBJ_personalSignature */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x36, /* [ 3818] OBJ_dITRedirect */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x37, /* [ 3828] OBJ_audio */ 0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x38, /* [ 3838] OBJ_documentPublisher */ 0x55,0x04,0x2D, /* [ 3848] OBJ_x500UniqueIdentifier */ 0x2B,0x06,0x01,0x07,0x01, /* [ 3851] OBJ_mime_mhs */ 0x2B,0x06,0x01,0x07,0x01,0x01, /* [ 3856] OBJ_mime_mhs_headings */ 0x2B,0x06,0x01,0x07,0x01,0x02, /* [ 3862] OBJ_mime_mhs_bodies */ 0x2B,0x06,0x01,0x07,0x01,0x01,0x01, /* [ 3868] OBJ_id_hex_partial_message */ 0x2B,0x06,0x01,0x07,0x01,0x01,0x02, /* [ 3875] OBJ_id_hex_multipart_message */ 0x55,0x04,0x2C, /* [ 3882] OBJ_generationQualifier */ 0x55,0x04,0x41, /* [ 3885] OBJ_pseudonym */ 0x67,0x2A, /* [ 3888] OBJ_id_set */ 0x67,0x2A,0x00, /* [ 3890] OBJ_set_ctype */ 0x67,0x2A,0x01, /* [ 3893] OBJ_set_msgExt */ 0x67,0x2A,0x03, /* [ 3896] OBJ_set_attr */ 0x67,0x2A,0x05, /* [ 3899] OBJ_set_policy */ 0x67,0x2A,0x07, /* [ 3902] OBJ_set_certExt */ 0x67,0x2A,0x08, /* [ 3905] OBJ_set_brand */ 0x67,0x2A,0x00,0x00, /* [ 3908] OBJ_setct_PANData */ 0x67,0x2A,0x00,0x01, /* [ 3912] OBJ_setct_PANToken */ 0x67,0x2A,0x00,0x02, /* [ 3916] OBJ_setct_PANOnly */ 0x67,0x2A,0x00,0x03, /* [ 3920] OBJ_setct_OIData */ 0x67,0x2A,0x00,0x04, /* [ 3924] OBJ_setct_PI */ 0x67,0x2A,0x00,0x05, /* [ 3928] OBJ_setct_PIData */ 0x67,0x2A,0x00,0x06, /* [ 3932] OBJ_setct_PIDataUnsigned */ 0x67,0x2A,0x00,0x07, /* [ 3936] OBJ_setct_HODInput */ 0x67,0x2A,0x00,0x08, /* [ 3940] OBJ_setct_AuthResBaggage */ 0x67,0x2A,0x00,0x09, /* [ 3944] OBJ_setct_AuthRevReqBaggage */ 0x67,0x2A,0x00,0x0A, /* [ 3948] OBJ_setct_AuthRevResBaggage */ 0x67,0x2A,0x00,0x0B, /* [ 3952] OBJ_setct_CapTokenSeq */ 0x67,0x2A,0x00,0x0C, /* [ 3956] OBJ_setct_PInitResData */ 0x67,0x2A,0x00,0x0D, /* [ 3960] OBJ_setct_PI_TBS */ 0x67,0x2A,0x00,0x0E, /* [ 3964] OBJ_setct_PResData */ 0x67,0x2A,0x00,0x10, /* [ 3968] OBJ_setct_AuthReqTBS */ 0x67,0x2A,0x00,0x11, /* [ 3972] OBJ_setct_AuthResTBS */ 0x67,0x2A,0x00,0x12, /* [ 3976] OBJ_setct_AuthResTBSX */ 0x67,0x2A,0x00,0x13, /* [ 3980] OBJ_setct_AuthTokenTBS */ 0x67,0x2A,0x00,0x14, /* [ 3984] OBJ_setct_CapTokenData */ 0x67,0x2A,0x00,0x15, /* [ 3988] OBJ_setct_CapTokenTBS */ 0x67,0x2A,0x00,0x16, /* [ 3992] OBJ_setct_AcqCardCodeMsg */ 0x67,0x2A,0x00,0x17, /* [ 3996] OBJ_setct_AuthRevReqTBS */ 0x67,0x2A,0x00,0x18, /* [ 4000] OBJ_setct_AuthRevResData */ 0x67,0x2A,0x00,0x19, /* [ 4004] OBJ_setct_AuthRevResTBS */ 0x67,0x2A,0x00,0x1A, /* [ 4008] OBJ_setct_CapReqTBS */ 0x67,0x2A,0x00,0x1B, /* [ 4012] OBJ_setct_CapReqTBSX */ 0x67,0x2A,0x00,0x1C, /* [ 4016] OBJ_setct_CapResData */ 0x67,0x2A,0x00,0x1D, /* [ 4020] OBJ_setct_CapRevReqTBS */ 0x67,0x2A,0x00,0x1E, /* [ 4024] OBJ_setct_CapRevReqTBSX */ 0x67,0x2A,0x00,0x1F, /* [ 4028] OBJ_setct_CapRevResData */ 0x67,0x2A,0x00,0x20, /* [ 4032] OBJ_setct_CredReqTBS */ 0x67,0x2A,0x00,0x21, /* [ 4036] OBJ_setct_CredReqTBSX */ 0x67,0x2A,0x00,0x22, /* [ 4040] OBJ_setct_CredResData */ 0x67,0x2A,0x00,0x23, /* [ 4044] OBJ_setct_CredRevReqTBS */ 0x67,0x2A,0x00,0x24, /* [ 4048] OBJ_setct_CredRevReqTBSX */ 0x67,0x2A,0x00,0x25, /* [ 4052] OBJ_setct_CredRevResData */ 0x67,0x2A,0x00,0x26, /* [ 4056] OBJ_setct_PCertReqData */ 0x67,0x2A,0x00,0x27, /* [ 4060] OBJ_setct_PCertResTBS */ 0x67,0x2A,0x00,0x28, /* [ 4064] OBJ_setct_BatchAdminReqData */ 0x67,0x2A,0x00,0x29, /* [ 4068] OBJ_setct_BatchAdminResData */ 0x67,0x2A,0x00,0x2A, /* [ 4072] OBJ_setct_CardCInitResTBS */ 0x67,0x2A,0x00,0x2B, /* [ 4076] OBJ_setct_MeAqCInitResTBS */ 0x67,0x2A,0x00,0x2C, /* [ 4080] OBJ_setct_RegFormResTBS */ 0x67,0x2A,0x00,0x2D, /* [ 4084] OBJ_setct_CertReqData */ 0x67,0x2A,0x00,0x2E, /* [ 4088] OBJ_setct_CertReqTBS */ 0x67,0x2A,0x00,0x2F, /* [ 4092] OBJ_setct_CertResData */ 0x67,0x2A,0x00,0x30, /* [ 4096] OBJ_setct_CertInqReqTBS */ 0x67,0x2A,0x00,0x31, /* [ 4100] OBJ_setct_ErrorTBS */ 0x67,0x2A,0x00,0x32, /* [ 4104] OBJ_setct_PIDualSignedTBE */ 0x67,0x2A,0x00,0x33, /* [ 4108] OBJ_setct_PIUnsignedTBE */ 0x67,0x2A,0x00,0x34, /* [ 4112] OBJ_setct_AuthReqTBE */ 0x67,0x2A,0x00,0x35, /* [ 4116] OBJ_setct_AuthResTBE */ 0x67,0x2A,0x00,0x36, /* [ 4120] OBJ_setct_AuthResTBEX */ 0x67,0x2A,0x00,0x37, /* [ 4124] OBJ_setct_AuthTokenTBE */ 0x67,0x2A,0x00,0x38, /* [ 4128] OBJ_setct_CapTokenTBE */ 0x67,0x2A,0x00,0x39, /* [ 4132] OBJ_setct_CapTokenTBEX */ 0x67,0x2A,0x00,0x3A, /* [ 4136] OBJ_setct_AcqCardCodeMsgTBE */ 0x67,0x2A,0x00,0x3B, /* [ 4140] OBJ_setct_AuthRevReqTBE */ 0x67,0x2A,0x00,0x3C, /* [ 4144] OBJ_setct_AuthRevResTBE */ 0x67,0x2A,0x00,0x3D, /* [ 4148] OBJ_setct_AuthRevResTBEB */ 0x67,0x2A,0x00,0x3E, /* [ 4152] OBJ_setct_CapReqTBE */ 0x67,0x2A,0x00,0x3F, /* [ 4156] OBJ_setct_CapReqTBEX */ 0x67,0x2A,0x00,0x40, /* [ 4160] OBJ_setct_CapResTBE */ 0x67,0x2A,0x00,0x41, /* [ 4164] OBJ_setct_CapRevReqTBE */ 0x67,0x2A,0x00,0x42, /* [ 4168] OBJ_setct_CapRevReqTBEX */ 0x67,0x2A,0x00,0x43, /* [ 4172] OBJ_setct_CapRevResTBE */ 0x67,0x2A,0x00,0x44, /* [ 4176] OBJ_setct_CredReqTBE */ 0x67,0x2A,0x00,0x45, /* [ 4180] OBJ_setct_CredReqTBEX */ 0x67,0x2A,0x00,0x46, /* [ 4184] OBJ_setct_CredResTBE */ 0x67,0x2A,0x00,0x47, /* [ 4188] OBJ_setct_CredRevReqTBE */ 0x67,0x2A,0x00,0x48, /* [ 4192] OBJ_setct_CredRevReqTBEX */ 0x67,0x2A,0x00,0x49, /* [ 4196] OBJ_setct_CredRevResTBE */ 0x67,0x2A,0x00,0x4A, /* [ 4200] OBJ_setct_BatchAdminReqTBE */ 0x67,0x2A,0x00,0x4B, /* [ 4204] OBJ_setct_BatchAdminResTBE */ 0x67,0x2A,0x00,0x4C, /* [ 4208] OBJ_setct_RegFormReqTBE */ 0x67,0x2A,0x00,0x4D, /* [ 4212] OBJ_setct_CertReqTBE */ 0x67,0x2A,0x00,0x4E, /* [ 4216] OBJ_setct_CertReqTBEX */ 0x67,0x2A,0x00,0x4F, /* [ 4220] OBJ_setct_CertResTBE */ 0x67,0x2A,0x00,0x50, /* [ 4224] OBJ_setct_CRLNotificationTBS */ 0x67,0x2A,0x00,0x51, /* [ 4228] OBJ_setct_CRLNotificationResTBS */ 0x67,0x2A,0x00,0x52, /* [ 4232] OBJ_setct_BCIDistributionTBS */ 0x67,0x2A,0x01,0x01, /* [ 4236] OBJ_setext_genCrypt */ 0x67,0x2A,0x01,0x03, /* [ 4240] OBJ_setext_miAuth */ 0x67,0x2A,0x01,0x04, /* [ 4244] OBJ_setext_pinSecure */ 0x67,0x2A,0x01,0x05, /* [ 4248] OBJ_setext_pinAny */ 0x67,0x2A,0x01,0x07, /* [ 4252] OBJ_setext_track2 */ 0x67,0x2A,0x01,0x08, /* [ 4256] OBJ_setext_cv */ 0x67,0x2A,0x05,0x00, /* [ 4260] OBJ_set_policy_root */ 0x67,0x2A,0x07,0x00, /* [ 4264] OBJ_setCext_hashedRoot */ 0x67,0x2A,0x07,0x01, /* [ 4268] OBJ_setCext_certType */ 0x67,0x2A,0x07,0x02, /* [ 4272] OBJ_setCext_merchData */ 0x67,0x2A,0x07,0x03, /* [ 4276] OBJ_setCext_cCertRequired */ 0x67,0x2A,0x07,0x04, /* [ 4280] OBJ_setCext_tunneling */ 0x67,0x2A,0x07,0x05, /* [ 4284] OBJ_setCext_setExt */ 0x67,0x2A,0x07,0x06, /* [ 4288] OBJ_setCext_setQualf */ 0x67,0x2A,0x07,0x07, /* [ 4292] OBJ_setCext_PGWYcapabilities */ 0x67,0x2A,0x07,0x08, /* [ 4296] OBJ_setCext_TokenIdentifier */ 0x67,0x2A,0x07,0x09, /* [ 4300] OBJ_setCext_Track2Data */ 0x67,0x2A,0x07,0x0A, /* [ 4304] OBJ_setCext_TokenType */ 0x67,0x2A,0x07,0x0B, /* [ 4308] OBJ_setCext_IssuerCapabilities */ 0x67,0x2A,0x03,0x00, /* [ 4312] OBJ_setAttr_Cert */ 0x67,0x2A,0x03,0x01, /* [ 4316] OBJ_setAttr_PGWYcap */ 0x67,0x2A,0x03,0x02, /* [ 4320] OBJ_setAttr_TokenType */ 0x67,0x2A,0x03,0x03, /* [ 4324] OBJ_setAttr_IssCap */ 0x67,0x2A,0x03,0x00,0x00, /* [ 4328] OBJ_set_rootKeyThumb */ 0x67,0x2A,0x03,0x00,0x01, /* [ 4333] OBJ_set_addPolicy */ 0x67,0x2A,0x03,0x02,0x01, /* [ 4338] OBJ_setAttr_Token_EMV */ 0x67,0x2A,0x03,0x02,0x02, /* [ 4343] OBJ_setAttr_Token_B0Prime */ 0x67,0x2A,0x03,0x03,0x03, /* [ 4348] OBJ_setAttr_IssCap_CVM */ 0x67,0x2A,0x03,0x03,0x04, /* [ 4353] OBJ_setAttr_IssCap_T2 */ 0x67,0x2A,0x03,0x03,0x05, /* [ 4358] OBJ_setAttr_IssCap_Sig */ 0x67,0x2A,0x03,0x03,0x03,0x01, /* [ 4363] OBJ_setAttr_GenCryptgrm */ 0x67,0x2A,0x03,0x03,0x04,0x01, /* [ 4369] OBJ_setAttr_T2Enc */ 0x67,0x2A,0x03,0x03,0x04,0x02, /* [ 4375] OBJ_setAttr_T2cleartxt */ 0x67,0x2A,0x03,0x03,0x05,0x01, /* [ 4381] OBJ_setAttr_TokICCsig */ 0x67,0x2A,0x03,0x03,0x05,0x02, /* [ 4387] OBJ_setAttr_SecDevSig */ 0x67,0x2A,0x08,0x01, /* [ 4393] OBJ_set_brand_IATA_ATA */ 0x67,0x2A,0x08,0x1E, /* [ 4397] OBJ_set_brand_Diners */ 0x67,0x2A,0x08,0x22, /* [ 4401] OBJ_set_brand_AmericanExpress */ 0x67,0x2A,0x08,0x23, /* [ 4405] OBJ_set_brand_JCB */ 0x67,0x2A,0x08,0x04, /* [ 4409] OBJ_set_brand_Visa */ 0x67,0x2A,0x08,0x05, /* [ 4413] OBJ_set_brand_MasterCard */ 0x67,0x2A,0x08,0xAE,0x7B, /* [ 4417] OBJ_set_brand_Novus */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x0A, /* [ 4422] OBJ_des_cdmf */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x06, /* [ 4430] OBJ_rsaOAEPEncryptionSET */ 0x67, /* [ 4439] OBJ_international_organizations */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x14,0x02,0x02, /* [ 4440] OBJ_ms_smartcard_login */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x14,0x02,0x03, /* [ 4450] OBJ_ms_upn */ 0x55,0x04,0x09, /* [ 4460] OBJ_streetAddress */ 0x55,0x04,0x11, /* [ 4463] OBJ_postalCode */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x15, /* [ 4466] OBJ_id_ppl */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x0E, /* [ 4473] OBJ_proxyCertInfo */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x15,0x00, /* [ 4481] OBJ_id_ppl_anyLanguage */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x15,0x01, /* [ 4489] OBJ_id_ppl_inheritAll */ 0x55,0x1D,0x1E, /* [ 4497] OBJ_name_constraints */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x15,0x02, /* [ 4500] OBJ_Independent */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B, /* [ 4508] OBJ_sha256WithRSAEncryption */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0C, /* [ 4517] OBJ_sha384WithRSAEncryption */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0D, /* [ 4526] OBJ_sha512WithRSAEncryption */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0E, /* [ 4535] OBJ_sha224WithRSAEncryption */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01, /* [ 4544] OBJ_sha256 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02, /* [ 4553] OBJ_sha384 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03, /* [ 4562] OBJ_sha512 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x04, /* [ 4571] OBJ_sha224 */ 0x2B, /* [ 4580] OBJ_identified_organization */ 0x2B,0x81,0x04, /* [ 4581] OBJ_certicom_arc */ 0x67,0x2B, /* [ 4584] OBJ_wap */ 0x67,0x2B,0x01, /* [ 4586] OBJ_wap_wsg */ 0x2A,0x86,0x48,0xCE,0x3D,0x01,0x02,0x03, /* [ 4589] OBJ_X9_62_id_characteristic_two_basis */ 0x2A,0x86,0x48,0xCE,0x3D,0x01,0x02,0x03,0x01, /* [ 4597] OBJ_X9_62_onBasis */ 0x2A,0x86,0x48,0xCE,0x3D,0x01,0x02,0x03,0x02, /* [ 4606] OBJ_X9_62_tpBasis */ 0x2A,0x86,0x48,0xCE,0x3D,0x01,0x02,0x03,0x03, /* [ 4615] OBJ_X9_62_ppBasis */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x01, /* [ 4624] OBJ_X9_62_c2pnb163v1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x02, /* [ 4632] OBJ_X9_62_c2pnb163v2 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x03, /* [ 4640] OBJ_X9_62_c2pnb163v3 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x04, /* [ 4648] OBJ_X9_62_c2pnb176v1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x05, /* [ 4656] OBJ_X9_62_c2tnb191v1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x06, /* [ 4664] OBJ_X9_62_c2tnb191v2 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x07, /* [ 4672] OBJ_X9_62_c2tnb191v3 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x08, /* [ 4680] OBJ_X9_62_c2onb191v4 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x09, /* [ 4688] OBJ_X9_62_c2onb191v5 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x0A, /* [ 4696] OBJ_X9_62_c2pnb208w1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x0B, /* [ 4704] OBJ_X9_62_c2tnb239v1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x0C, /* [ 4712] OBJ_X9_62_c2tnb239v2 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x0D, /* [ 4720] OBJ_X9_62_c2tnb239v3 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x0E, /* [ 4728] OBJ_X9_62_c2onb239v4 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x0F, /* [ 4736] OBJ_X9_62_c2onb239v5 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x10, /* [ 4744] OBJ_X9_62_c2pnb272w1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x11, /* [ 4752] OBJ_X9_62_c2pnb304w1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x12, /* [ 4760] OBJ_X9_62_c2tnb359v1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x13, /* [ 4768] OBJ_X9_62_c2pnb368w1 */ 0x2A,0x86,0x48,0xCE,0x3D,0x03,0x00,0x14, /* [ 4776] OBJ_X9_62_c2tnb431r1 */ 0x2B,0x81,0x04,0x00,0x06, /* [ 4784] OBJ_secp112r1 */ 0x2B,0x81,0x04,0x00,0x07, /* [ 4789] OBJ_secp112r2 */ 0x2B,0x81,0x04,0x00,0x1C, /* [ 4794] OBJ_secp128r1 */ 0x2B,0x81,0x04,0x00,0x1D, /* [ 4799] OBJ_secp128r2 */ 0x2B,0x81,0x04,0x00,0x09, /* [ 4804] OBJ_secp160k1 */ 0x2B,0x81,0x04,0x00,0x08, /* [ 4809] OBJ_secp160r1 */ 0x2B,0x81,0x04,0x00,0x1E, /* [ 4814] OBJ_secp160r2 */ 0x2B,0x81,0x04,0x00,0x1F, /* [ 4819] OBJ_secp192k1 */ 0x2B,0x81,0x04,0x00,0x20, /* [ 4824] OBJ_secp224k1 */ 0x2B,0x81,0x04,0x00,0x21, /* [ 4829] OBJ_secp224r1 */ 0x2B,0x81,0x04,0x00,0x0A, /* [ 4834] OBJ_secp256k1 */ 0x2B,0x81,0x04,0x00,0x22, /* [ 4839] OBJ_secp384r1 */ 0x2B,0x81,0x04,0x00,0x23, /* [ 4844] OBJ_secp521r1 */ 0x2B,0x81,0x04,0x00,0x04, /* [ 4849] OBJ_sect113r1 */ 0x2B,0x81,0x04,0x00,0x05, /* [ 4854] OBJ_sect113r2 */ 0x2B,0x81,0x04,0x00,0x16, /* [ 4859] OBJ_sect131r1 */ 0x2B,0x81,0x04,0x00,0x17, /* [ 4864] OBJ_sect131r2 */ 0x2B,0x81,0x04,0x00,0x01, /* [ 4869] OBJ_sect163k1 */ 0x2B,0x81,0x04,0x00,0x02, /* [ 4874] OBJ_sect163r1 */ 0x2B,0x81,0x04,0x00,0x0F, /* [ 4879] OBJ_sect163r2 */ 0x2B,0x81,0x04,0x00,0x18, /* [ 4884] OBJ_sect193r1 */ 0x2B,0x81,0x04,0x00,0x19, /* [ 4889] OBJ_sect193r2 */ 0x2B,0x81,0x04,0x00,0x1A, /* [ 4894] OBJ_sect233k1 */ 0x2B,0x81,0x04,0x00,0x1B, /* [ 4899] OBJ_sect233r1 */ 0x2B,0x81,0x04,0x00,0x03, /* [ 4904] OBJ_sect239k1 */ 0x2B,0x81,0x04,0x00,0x10, /* [ 4909] OBJ_sect283k1 */ 0x2B,0x81,0x04,0x00,0x11, /* [ 4914] OBJ_sect283r1 */ 0x2B,0x81,0x04,0x00,0x24, /* [ 4919] OBJ_sect409k1 */ 0x2B,0x81,0x04,0x00,0x25, /* [ 4924] OBJ_sect409r1 */ 0x2B,0x81,0x04,0x00,0x26, /* [ 4929] OBJ_sect571k1 */ 0x2B,0x81,0x04,0x00,0x27, /* [ 4934] OBJ_sect571r1 */ 0x67,0x2B,0x01,0x04,0x01, /* [ 4939] OBJ_wap_wsg_idm_ecid_wtls1 */ 0x67,0x2B,0x01,0x04,0x03, /* [ 4944] OBJ_wap_wsg_idm_ecid_wtls3 */ 0x67,0x2B,0x01,0x04,0x04, /* [ 4949] OBJ_wap_wsg_idm_ecid_wtls4 */ 0x67,0x2B,0x01,0x04,0x05, /* [ 4954] OBJ_wap_wsg_idm_ecid_wtls5 */ 0x67,0x2B,0x01,0x04,0x06, /* [ 4959] OBJ_wap_wsg_idm_ecid_wtls6 */ 0x67,0x2B,0x01,0x04,0x07, /* [ 4964] OBJ_wap_wsg_idm_ecid_wtls7 */ 0x67,0x2B,0x01,0x04,0x08, /* [ 4969] OBJ_wap_wsg_idm_ecid_wtls8 */ 0x67,0x2B,0x01,0x04,0x09, /* [ 4974] OBJ_wap_wsg_idm_ecid_wtls9 */ 0x67,0x2B,0x01,0x04,0x0A, /* [ 4979] OBJ_wap_wsg_idm_ecid_wtls10 */ 0x67,0x2B,0x01,0x04,0x0B, /* [ 4984] OBJ_wap_wsg_idm_ecid_wtls11 */ 0x67,0x2B,0x01,0x04,0x0C, /* [ 4989] OBJ_wap_wsg_idm_ecid_wtls12 */ 0x55,0x1D,0x20,0x00, /* [ 4994] OBJ_any_policy */ 0x55,0x1D,0x21, /* [ 4998] OBJ_policy_mappings */ 0x55,0x1D,0x36, /* [ 5001] OBJ_inhibit_any_policy */ 0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x01,0x02, /* [ 5004] OBJ_camellia_128_cbc */ 0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x01,0x03, /* [ 5015] OBJ_camellia_192_cbc */ 0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x01,0x04, /* [ 5026] OBJ_camellia_256_cbc */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x01, /* [ 5037] OBJ_camellia_128_ecb */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x15, /* [ 5045] OBJ_camellia_192_ecb */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x29, /* [ 5053] OBJ_camellia_256_ecb */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x04, /* [ 5061] OBJ_camellia_128_cfb128 */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x18, /* [ 5069] OBJ_camellia_192_cfb128 */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x2C, /* [ 5077] OBJ_camellia_256_cfb128 */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x03, /* [ 5085] OBJ_camellia_128_ofb128 */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x17, /* [ 5093] OBJ_camellia_192_ofb128 */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x2B, /* [ 5101] OBJ_camellia_256_ofb128 */ 0x55,0x1D,0x09, /* [ 5109] OBJ_subject_directory_attributes */ 0x55,0x1D,0x1C, /* [ 5112] OBJ_issuing_distribution_point */ 0x55,0x1D,0x1D, /* [ 5115] OBJ_certificate_issuer */ 0x2A,0x83,0x1A,0x8C,0x9A,0x44, /* [ 5118] OBJ_kisa */ 0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x03, /* [ 5124] OBJ_seed_ecb */ 0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x04, /* [ 5132] OBJ_seed_cbc */ 0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x06, /* [ 5140] OBJ_seed_ofb128 */ 0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x05, /* [ 5148] OBJ_seed_cfb128 */ 0x2B,0x06,0x01,0x05,0x05,0x08,0x01,0x01, /* [ 5156] OBJ_hmac_md5 */ 0x2B,0x06,0x01,0x05,0x05,0x08,0x01,0x02, /* [ 5164] OBJ_hmac_sha1 */ 0x2A,0x86,0x48,0x86,0xF6,0x7D,0x07,0x42,0x0D, /* [ 5172] OBJ_id_PasswordBasedMAC */ 0x2A,0x86,0x48,0x86,0xF6,0x7D,0x07,0x42,0x1E, /* [ 5181] OBJ_id_DHBasedMac */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x10, /* [ 5190] OBJ_id_it_suppLangTags */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x05, /* [ 5198] OBJ_caRepository */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x09, /* [ 5206] OBJ_id_smime_ct_compressedData */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x1B, /* [ 5217] OBJ_id_ct_asciiTextWithCRLF */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x05, /* [ 5228] OBJ_id_aes128_wrap */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x19, /* [ 5237] OBJ_id_aes192_wrap */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2D, /* [ 5246] OBJ_id_aes256_wrap */ 0x2A,0x86,0x48,0xCE,0x3D,0x04,0x02, /* [ 5255] OBJ_ecdsa_with_Recommended */ 0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03, /* [ 5262] OBJ_ecdsa_with_Specified */ 0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x01, /* [ 5269] OBJ_ecdsa_with_SHA224 */ 0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x02, /* [ 5277] OBJ_ecdsa_with_SHA256 */ 0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03, /* [ 5285] OBJ_ecdsa_with_SHA384 */ 0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x04, /* [ 5293] OBJ_ecdsa_with_SHA512 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x06, /* [ 5301] OBJ_hmacWithMD5 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x08, /* [ 5309] OBJ_hmacWithSHA224 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x09, /* [ 5317] OBJ_hmacWithSHA256 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x0A, /* [ 5325] OBJ_hmacWithSHA384 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x0B, /* [ 5333] OBJ_hmacWithSHA512 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x01, /* [ 5341] OBJ_dsa_with_SHA224 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x02, /* [ 5350] OBJ_dsa_with_SHA256 */ 0x28,0xCF,0x06,0x03,0x00,0x37, /* [ 5359] OBJ_whirlpool */ 0x2A,0x85,0x03,0x02,0x02, /* [ 5365] OBJ_cryptopro */ 0x2A,0x85,0x03,0x02,0x09, /* [ 5370] OBJ_cryptocom */ 0x2A,0x85,0x03,0x02,0x02,0x03, /* [ 5375] OBJ_id_GostR3411_94_with_GostR3410_2001 */ 0x2A,0x85,0x03,0x02,0x02,0x04, /* [ 5381] OBJ_id_GostR3411_94_with_GostR3410_94 */ 0x2A,0x85,0x03,0x02,0x02,0x09, /* [ 5387] OBJ_id_GostR3411_94 */ 0x2A,0x85,0x03,0x02,0x02,0x0A, /* [ 5393] OBJ_id_HMACGostR3411_94 */ 0x2A,0x85,0x03,0x02,0x02,0x13, /* [ 5399] OBJ_id_GostR3410_2001 */ 0x2A,0x85,0x03,0x02,0x02,0x14, /* [ 5405] OBJ_id_GostR3410_94 */ 0x2A,0x85,0x03,0x02,0x02,0x15, /* [ 5411] OBJ_id_Gost28147_89 */ 0x2A,0x85,0x03,0x02,0x02,0x16, /* [ 5417] OBJ_id_Gost28147_89_MAC */ 0x2A,0x85,0x03,0x02,0x02,0x17, /* [ 5423] OBJ_id_GostR3411_94_prf */ 0x2A,0x85,0x03,0x02,0x02,0x62, /* [ 5429] OBJ_id_GostR3410_2001DH */ 0x2A,0x85,0x03,0x02,0x02,0x63, /* [ 5435] OBJ_id_GostR3410_94DH */ 0x2A,0x85,0x03,0x02,0x02,0x0E,0x01, /* [ 5441] OBJ_id_Gost28147_89_CryptoPro_KeyMeshing */ 0x2A,0x85,0x03,0x02,0x02,0x0E,0x00, /* [ 5448] OBJ_id_Gost28147_89_None_KeyMeshing */ 0x2A,0x85,0x03,0x02,0x02,0x1E,0x00, /* [ 5455] OBJ_id_GostR3411_94_TestParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x1E,0x01, /* [ 5462] OBJ_id_GostR3411_94_CryptoProParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x1F,0x00, /* [ 5469] OBJ_id_Gost28147_89_TestParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x1F,0x01, /* [ 5476] OBJ_id_Gost28147_89_CryptoPro_A_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x1F,0x02, /* [ 5483] OBJ_id_Gost28147_89_CryptoPro_B_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x1F,0x03, /* [ 5490] OBJ_id_Gost28147_89_CryptoPro_C_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x1F,0x04, /* [ 5497] OBJ_id_Gost28147_89_CryptoPro_D_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x1F,0x05, /* [ 5504] OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x1F,0x06, /* [ 5511] OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x1F,0x07, /* [ 5518] OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x20,0x00, /* [ 5525] OBJ_id_GostR3410_94_TestParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x20,0x02, /* [ 5532] OBJ_id_GostR3410_94_CryptoPro_A_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x20,0x03, /* [ 5539] OBJ_id_GostR3410_94_CryptoPro_B_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x20,0x04, /* [ 5546] OBJ_id_GostR3410_94_CryptoPro_C_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x20,0x05, /* [ 5553] OBJ_id_GostR3410_94_CryptoPro_D_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x21,0x01, /* [ 5560] OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x21,0x02, /* [ 5567] OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x21,0x03, /* [ 5574] OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x23,0x00, /* [ 5581] OBJ_id_GostR3410_2001_TestParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x23,0x01, /* [ 5588] OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x23,0x02, /* [ 5595] OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x23,0x03, /* [ 5602] OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x24,0x00, /* [ 5609] OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x24,0x01, /* [ 5616] OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet */ 0x2A,0x85,0x03,0x02,0x02,0x14,0x01, /* [ 5623] OBJ_id_GostR3410_94_a */ 0x2A,0x85,0x03,0x02,0x02,0x14,0x02, /* [ 5630] OBJ_id_GostR3410_94_aBis */ 0x2A,0x85,0x03,0x02,0x02,0x14,0x03, /* [ 5637] OBJ_id_GostR3410_94_b */ 0x2A,0x85,0x03,0x02,0x02,0x14,0x04, /* [ 5644] OBJ_id_GostR3410_94_bBis */ 0x2A,0x85,0x03,0x02,0x09,0x01,0x06,0x01, /* [ 5651] OBJ_id_Gost28147_89_cc */ 0x2A,0x85,0x03,0x02,0x09,0x01,0x05,0x03, /* [ 5659] OBJ_id_GostR3410_94_cc */ 0x2A,0x85,0x03,0x02,0x09,0x01,0x05,0x04, /* [ 5667] OBJ_id_GostR3410_2001_cc */ 0x2A,0x85,0x03,0x02,0x09,0x01,0x03,0x03, /* [ 5675] OBJ_id_GostR3411_94_with_GostR3410_94_cc */ 0x2A,0x85,0x03,0x02,0x09,0x01,0x03,0x04, /* [ 5683] OBJ_id_GostR3411_94_with_GostR3410_2001_cc */ 0x2A,0x85,0x03,0x02,0x09,0x01,0x08,0x01, /* [ 5691] OBJ_id_GostR3410_2001_ParamSet_cc */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x11,0x02, /* [ 5699] OBJ_LocalKeySet */ 0x55,0x1D,0x2E, /* [ 5708] OBJ_freshest_crl */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x08,0x03, /* [ 5711] OBJ_id_on_permanentIdentifier */ 0x55,0x04,0x0E, /* [ 5719] OBJ_searchGuide */ 0x55,0x04,0x0F, /* [ 5722] OBJ_businessCategory */ 0x55,0x04,0x10, /* [ 5725] OBJ_postalAddress */ 0x55,0x04,0x12, /* [ 5728] OBJ_postOfficeBox */ 0x55,0x04,0x13, /* [ 5731] OBJ_physicalDeliveryOfficeName */ 0x55,0x04,0x14, /* [ 5734] OBJ_telephoneNumber */ 0x55,0x04,0x15, /* [ 5737] OBJ_telexNumber */ 0x55,0x04,0x16, /* [ 5740] OBJ_teletexTerminalIdentifier */ 0x55,0x04,0x17, /* [ 5743] OBJ_facsimileTelephoneNumber */ 0x55,0x04,0x18, /* [ 5746] OBJ_x121Address */ 0x55,0x04,0x19, /* [ 5749] OBJ_internationaliSDNNumber */ 0x55,0x04,0x1A, /* [ 5752] OBJ_registeredAddress */ 0x55,0x04,0x1B, /* [ 5755] OBJ_destinationIndicator */ 0x55,0x04,0x1C, /* [ 5758] OBJ_preferredDeliveryMethod */ 0x55,0x04,0x1D, /* [ 5761] OBJ_presentationAddress */ 0x55,0x04,0x1E, /* [ 5764] OBJ_supportedApplicationContext */ 0x55,0x04,0x1F, /* [ 5767] OBJ_member */ 0x55,0x04,0x20, /* [ 5770] OBJ_owner */ 0x55,0x04,0x21, /* [ 5773] OBJ_roleOccupant */ 0x55,0x04,0x22, /* [ 5776] OBJ_seeAlso */ 0x55,0x04,0x23, /* [ 5779] OBJ_userPassword */ 0x55,0x04,0x24, /* [ 5782] OBJ_userCertificate */ 0x55,0x04,0x25, /* [ 5785] OBJ_cACertificate */ 0x55,0x04,0x26, /* [ 5788] OBJ_authorityRevocationList */ 0x55,0x04,0x27, /* [ 5791] OBJ_certificateRevocationList */ 0x55,0x04,0x28, /* [ 5794] OBJ_crossCertificatePair */ 0x55,0x04,0x2F, /* [ 5797] OBJ_enhancedSearchGuide */ 0x55,0x04,0x30, /* [ 5800] OBJ_protocolInformation */ 0x55,0x04,0x31, /* [ 5803] OBJ_distinguishedName */ 0x55,0x04,0x32, /* [ 5806] OBJ_uniqueMember */ 0x55,0x04,0x33, /* [ 5809] OBJ_houseIdentifier */ 0x55,0x04,0x34, /* [ 5812] OBJ_supportedAlgorithms */ 0x55,0x04,0x35, /* [ 5815] OBJ_deltaRevocationList */ 0x55,0x04,0x36, /* [ 5818] OBJ_dmdName */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x03,0x09, /* [ 5821] OBJ_id_alg_PWRI_KEK */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x06, /* [ 5832] OBJ_aes_128_gcm */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x07, /* [ 5841] OBJ_aes_128_ccm */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x08, /* [ 5850] OBJ_id_aes128_wrap_pad */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x1A, /* [ 5859] OBJ_aes_192_gcm */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x1B, /* [ 5868] OBJ_aes_192_ccm */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x1C, /* [ 5877] OBJ_id_aes192_wrap_pad */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2E, /* [ 5886] OBJ_aes_256_gcm */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2F, /* [ 5895] OBJ_aes_256_ccm */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x30, /* [ 5904] OBJ_id_aes256_wrap_pad */ 0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x03,0x02, /* [ 5913] OBJ_id_camellia128_wrap */ 0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x03,0x03, /* [ 5924] OBJ_id_camellia192_wrap */ 0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x03,0x04, /* [ 5935] OBJ_id_camellia256_wrap */ 0x55,0x1D,0x25,0x00, /* [ 5946] OBJ_anyExtendedKeyUsage */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x08, /* [ 5950] OBJ_mgf1 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0A, /* [ 5959] OBJ_rsassaPss */ 0x2B,0x6F,0x02,0x8C,0x53,0x00,0x01,0x01, /* [ 5968] OBJ_aes_128_xts */ 0x2B,0x6F,0x02,0x8C,0x53,0x00,0x01,0x02, /* [ 5976] OBJ_aes_256_xts */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x07, /* [ 5984] OBJ_rsaesOaep */ 0x2A,0x86,0x48,0xCE,0x3E,0x02,0x01, /* [ 5993] OBJ_dhpublicnumber */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x01, /* [ 6000] OBJ_brainpoolP160r1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x02, /* [ 6009] OBJ_brainpoolP160t1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x03, /* [ 6018] OBJ_brainpoolP192r1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x04, /* [ 6027] OBJ_brainpoolP192t1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x05, /* [ 6036] OBJ_brainpoolP224r1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x06, /* [ 6045] OBJ_brainpoolP224t1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x07, /* [ 6054] OBJ_brainpoolP256r1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x08, /* [ 6063] OBJ_brainpoolP256t1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x09, /* [ 6072] OBJ_brainpoolP320r1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x0A, /* [ 6081] OBJ_brainpoolP320t1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x0B, /* [ 6090] OBJ_brainpoolP384r1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x0C, /* [ 6099] OBJ_brainpoolP384t1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x0D, /* [ 6108] OBJ_brainpoolP512r1 */ 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x0E, /* [ 6117] OBJ_brainpoolP512t1 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x09, /* [ 6126] OBJ_pSpecified */ 0x2B,0x81,0x05,0x10,0x86,0x48,0x3F,0x00,0x02, /* [ 6135] OBJ_dhSinglePass_stdDH_sha1kdf_scheme */ 0x2B,0x81,0x04,0x01,0x0B,0x00, /* [ 6144] OBJ_dhSinglePass_stdDH_sha224kdf_scheme */ 0x2B,0x81,0x04,0x01,0x0B,0x01, /* [ 6150] OBJ_dhSinglePass_stdDH_sha256kdf_scheme */ 0x2B,0x81,0x04,0x01,0x0B,0x02, /* [ 6156] OBJ_dhSinglePass_stdDH_sha384kdf_scheme */ 0x2B,0x81,0x04,0x01,0x0B,0x03, /* [ 6162] OBJ_dhSinglePass_stdDH_sha512kdf_scheme */ 0x2B,0x81,0x05,0x10,0x86,0x48,0x3F,0x00,0x03, /* [ 6168] OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme */ 0x2B,0x81,0x04,0x01,0x0E,0x00, /* [ 6177] OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme */ 0x2B,0x81,0x04,0x01,0x0E,0x01, /* [ 6183] OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme */ 0x2B,0x81,0x04,0x01,0x0E,0x02, /* [ 6189] OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme */ 0x2B,0x81,0x04,0x01,0x0E,0x03, /* [ 6195] OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme */ 0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x02, /* [ 6201] OBJ_ct_precert_scts */ 0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x03, /* [ 6211] OBJ_ct_precert_poison */ 0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x04, /* [ 6221] OBJ_ct_precert_signer */ 0x2B,0x06,0x01,0x04,0x01,0xD6,0x79,0x02,0x04,0x05, /* [ 6231] OBJ_ct_cert_scts */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x3C,0x02,0x01,0x01, /* [ 6241] OBJ_jurisdictionLocalityName */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x3C,0x02,0x01,0x02, /* [ 6252] OBJ_jurisdictionStateOrProvinceName */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x3C,0x02,0x01,0x03, /* [ 6263] OBJ_jurisdictionCountryName */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x06, /* [ 6274] OBJ_camellia_128_gcm */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x07, /* [ 6282] OBJ_camellia_128_ccm */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x09, /* [ 6290] OBJ_camellia_128_ctr */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x0A, /* [ 6298] OBJ_camellia_128_cmac */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x1A, /* [ 6306] OBJ_camellia_192_gcm */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x1B, /* [ 6314] OBJ_camellia_192_ccm */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x1D, /* [ 6322] OBJ_camellia_192_ctr */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x1E, /* [ 6330] OBJ_camellia_192_cmac */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x2E, /* [ 6338] OBJ_camellia_256_gcm */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x2F, /* [ 6346] OBJ_camellia_256_ccm */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x31, /* [ 6354] OBJ_camellia_256_ctr */ 0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x32, /* [ 6362] OBJ_camellia_256_cmac */ 0x2B,0x06,0x01,0x04,0x01,0xDA,0x47,0x04,0x0B, /* [ 6370] OBJ_id_scrypt */ 0x2A,0x85,0x03,0x07,0x01, /* [ 6379] OBJ_id_tc26 */ 0x2A,0x85,0x03,0x07,0x01,0x01, /* [ 6384] OBJ_id_tc26_algorithms */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x01, /* [ 6390] OBJ_id_tc26_sign */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x01,0x01, /* [ 6397] OBJ_id_GostR3410_2012_256 */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x01,0x02, /* [ 6405] OBJ_id_GostR3410_2012_512 */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x02, /* [ 6413] OBJ_id_tc26_digest */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x02,0x02, /* [ 6420] OBJ_id_GostR3411_2012_256 */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x02,0x03, /* [ 6428] OBJ_id_GostR3411_2012_512 */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x03, /* [ 6436] OBJ_id_tc26_signwithdigest */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x03,0x02, /* [ 6443] OBJ_id_tc26_signwithdigest_gost3410_2012_256 */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x03,0x03, /* [ 6451] OBJ_id_tc26_signwithdigest_gost3410_2012_512 */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x04, /* [ 6459] OBJ_id_tc26_mac */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x04,0x01, /* [ 6466] OBJ_id_tc26_hmac_gost_3411_2012_256 */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x04,0x02, /* [ 6474] OBJ_id_tc26_hmac_gost_3411_2012_512 */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x05, /* [ 6482] OBJ_id_tc26_cipher */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x06, /* [ 6489] OBJ_id_tc26_agreement */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x06,0x01, /* [ 6496] OBJ_id_tc26_agreement_gost_3410_2012_256 */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x06,0x02, /* [ 6504] OBJ_id_tc26_agreement_gost_3410_2012_512 */ 0x2A,0x85,0x03,0x07,0x01,0x02, /* [ 6512] OBJ_id_tc26_constants */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x01, /* [ 6518] OBJ_id_tc26_sign_constants */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x01,0x02, /* [ 6525] OBJ_id_tc26_gost_3410_2012_512_constants */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x01,0x02,0x00, /* [ 6533] OBJ_id_tc26_gost_3410_2012_512_paramSetTest */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x01,0x02,0x01, /* [ 6542] OBJ_id_tc26_gost_3410_2012_512_paramSetA */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x01,0x02,0x02, /* [ 6551] OBJ_id_tc26_gost_3410_2012_512_paramSetB */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x02, /* [ 6560] OBJ_id_tc26_digest_constants */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x05, /* [ 6567] OBJ_id_tc26_cipher_constants */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x05,0x01, /* [ 6574] OBJ_id_tc26_gost_28147_constants */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x05,0x01,0x01, /* [ 6582] OBJ_id_tc26_gost_28147_param_Z */ 0x2A,0x85,0x03,0x03,0x81,0x03,0x01,0x01, /* [ 6591] OBJ_INN */ 0x2A,0x85,0x03,0x64,0x01, /* [ 6599] OBJ_OGRN */ 0x2A,0x85,0x03,0x64,0x03, /* [ 6604] OBJ_SNILS */ 0x2A,0x85,0x03,0x64,0x6F, /* [ 6609] OBJ_subjectSignTool */ 0x2A,0x85,0x03,0x64,0x70, /* [ 6614] OBJ_issuerSignTool */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x18, /* [ 6619] OBJ_tlsfeature */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x11, /* [ 6627] OBJ_ipsec_IKE */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x12, /* [ 6635] OBJ_capwapAC */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x13, /* [ 6643] OBJ_capwapWTP */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x15, /* [ 6651] OBJ_sshClient */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x16, /* [ 6659] OBJ_sshServer */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x17, /* [ 6667] OBJ_sendRouter */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x18, /* [ 6675] OBJ_sendProxiedRouter */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x19, /* [ 6683] OBJ_sendOwner */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x1A, /* [ 6691] OBJ_sendProxiedOwner */ 0x2B,0x06,0x01,0x05,0x02,0x03, /* [ 6699] OBJ_id_pkinit */ 0x2B,0x06,0x01,0x05,0x02,0x03,0x04, /* [ 6705] OBJ_pkInitClientAuth */ 0x2B,0x06,0x01,0x05,0x02,0x03,0x05, /* [ 6712] OBJ_pkInitKDC */ 0x2B,0x65,0x6E, /* [ 6719] OBJ_X25519 */ 0x2B,0x65,0x6F, /* [ 6722] OBJ_X448 */ 0x2B,0x06,0x01,0x04,0x01,0x8D,0x3A,0x0C,0x02,0x01,0x10, /* [ 6725] OBJ_blake2b512 */ 0x2B,0x06,0x01,0x04,0x01,0x8D,0x3A,0x0C,0x02,0x02,0x08, /* [ 6736] OBJ_blake2s256 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x13, /* [ 6747] OBJ_id_smime_ct_contentCollection */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x17, /* [ 6758] OBJ_id_smime_ct_authEnvelopedData */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x1C, /* [ 6769] OBJ_id_ct_xml */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x01, /* [ 6780] OBJ_aria_128_ecb */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x02, /* [ 6789] OBJ_aria_128_cbc */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x03, /* [ 6798] OBJ_aria_128_cfb128 */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x04, /* [ 6807] OBJ_aria_128_ofb128 */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x05, /* [ 6816] OBJ_aria_128_ctr */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x06, /* [ 6825] OBJ_aria_192_ecb */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x07, /* [ 6834] OBJ_aria_192_cbc */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x08, /* [ 6843] OBJ_aria_192_cfb128 */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x09, /* [ 6852] OBJ_aria_192_ofb128 */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x0A, /* [ 6861] OBJ_aria_192_ctr */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x0B, /* [ 6870] OBJ_aria_256_ecb */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x0C, /* [ 6879] OBJ_aria_256_cbc */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x0D, /* [ 6888] OBJ_aria_256_cfb128 */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x0E, /* [ 6897] OBJ_aria_256_ofb128 */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x0F, /* [ 6906] OBJ_aria_256_ctr */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x2F, /* [ 6915] OBJ_id_smime_aa_signingCertificateV2 */ 0x2B,0x65,0x70, /* [ 6926] OBJ_ED25519 */ 0x2B,0x65,0x71, /* [ 6929] OBJ_ED448 */ 0x55,0x04,0x61, /* [ 6932] OBJ_organizationIdentifier */ 0x55,0x04,0x62, /* [ 6935] OBJ_countryCode3c */ 0x55,0x04,0x63, /* [ 6938] OBJ_countryCode3n */ 0x55,0x04,0x64, /* [ 6941] OBJ_dnsName */ 0x2B,0x24,0x08,0x03,0x03, /* [ 6944] OBJ_x509ExtAdmission */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x05, /* [ 6949] OBJ_sha512_224 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x06, /* [ 6958] OBJ_sha512_256 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x07, /* [ 6967] OBJ_sha3_224 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x08, /* [ 6976] OBJ_sha3_256 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x09, /* [ 6985] OBJ_sha3_384 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0A, /* [ 6994] OBJ_sha3_512 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0B, /* [ 7003] OBJ_shake128 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0C, /* [ 7012] OBJ_shake256 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0D, /* [ 7021] OBJ_hmac_sha3_224 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0E, /* [ 7030] OBJ_hmac_sha3_256 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0F, /* [ 7039] OBJ_hmac_sha3_384 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x10, /* [ 7048] OBJ_hmac_sha3_512 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x03, /* [ 7057] OBJ_dsa_with_SHA384 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x04, /* [ 7066] OBJ_dsa_with_SHA512 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x05, /* [ 7075] OBJ_dsa_with_SHA3_224 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x06, /* [ 7084] OBJ_dsa_with_SHA3_256 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x07, /* [ 7093] OBJ_dsa_with_SHA3_384 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x08, /* [ 7102] OBJ_dsa_with_SHA3_512 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x09, /* [ 7111] OBJ_ecdsa_with_SHA3_224 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0A, /* [ 7120] OBJ_ecdsa_with_SHA3_256 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0B, /* [ 7129] OBJ_ecdsa_with_SHA3_384 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0C, /* [ 7138] OBJ_ecdsa_with_SHA3_512 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0D, /* [ 7147] OBJ_RSA_SHA3_224 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0E, /* [ 7156] OBJ_RSA_SHA3_256 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0F, /* [ 7165] OBJ_RSA_SHA3_384 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x10, /* [ 7174] OBJ_RSA_SHA3_512 */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x25, /* [ 7183] OBJ_aria_128_ccm */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x26, /* [ 7192] OBJ_aria_192_ccm */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x27, /* [ 7201] OBJ_aria_256_ccm */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x22, /* [ 7210] OBJ_aria_128_gcm */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x23, /* [ 7219] OBJ_aria_192_gcm */ 0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x24, /* [ 7228] OBJ_aria_256_gcm */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x1B, /* [ 7237] OBJ_cmcCA */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x1C, /* [ 7245] OBJ_cmcRA */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x01, /* [ 7253] OBJ_sm4_ecb */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x02, /* [ 7261] OBJ_sm4_cbc */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x03, /* [ 7269] OBJ_sm4_ofb128 */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x05, /* [ 7277] OBJ_sm4_cfb1 */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x04, /* [ 7285] OBJ_sm4_cfb128 */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x06, /* [ 7293] OBJ_sm4_cfb8 */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x07, /* [ 7301] OBJ_sm4_ctr */ 0x2A,0x81,0x1C, /* [ 7309] OBJ_ISO_CN */ 0x2A,0x81,0x1C,0xCF,0x55, /* [ 7312] OBJ_oscca */ 0x2A,0x81,0x1C,0xCF,0x55,0x01, /* [ 7317] OBJ_sm_scheme */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x11, /* [ 7323] OBJ_sm3 */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x78, /* [ 7331] OBJ_sm3WithRSAEncryption */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0F, /* [ 7339] OBJ_sha512_224WithRSAEncryption */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x10, /* [ 7348] OBJ_sha512_256WithRSAEncryption */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x01,0x01, /* [ 7357] OBJ_id_tc26_gost_3410_2012_256_constants */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x01,0x01,0x01, /* [ 7365] OBJ_id_tc26_gost_3410_2012_256_paramSetA */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x01,0x02,0x03, /* [ 7374] OBJ_id_tc26_gost_3410_2012_512_paramSetC */ 0x2A,0x86,0x24, /* [ 7383] OBJ_ISO_UA */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01, /* [ 7386] OBJ_ua_pki */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x01,0x01, /* [ 7393] OBJ_dstu28147 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x02, /* [ 7403] OBJ_dstu28147_ofb */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x03, /* [ 7414] OBJ_dstu28147_cfb */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x05, /* [ 7425] OBJ_dstu28147_wrap */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x01,0x02, /* [ 7436] OBJ_hmacWithDstu34311 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x02,0x01, /* [ 7446] OBJ_dstu34311 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01, /* [ 7456] OBJ_dstu4145le */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01,0x01,0x01, /* [ 7467] OBJ_dstu4145be */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01,0x02,0x00, /* [ 7480] OBJ_uacurve0 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01,0x02,0x01, /* [ 7493] OBJ_uacurve1 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01,0x02,0x02, /* [ 7506] OBJ_uacurve2 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01,0x02,0x03, /* [ 7519] OBJ_uacurve3 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01,0x02,0x04, /* [ 7532] OBJ_uacurve4 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01,0x02,0x05, /* [ 7545] OBJ_uacurve5 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01,0x02,0x06, /* [ 7558] OBJ_uacurve6 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01,0x02,0x07, /* [ 7571] OBJ_uacurve7 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01,0x02,0x08, /* [ 7584] OBJ_uacurve8 */ 0x2A,0x86,0x24,0x02,0x01,0x01,0x01,0x01,0x03,0x01,0x01,0x02,0x09, /* [ 7597] OBJ_uacurve9 */ 0x2B,0x6F, /* [ 7610] OBJ_ieee */ 0x2B,0x6F,0x02,0x8C,0x53, /* [ 7612] OBJ_ieee_siswg */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D, /* [ 7617] OBJ_sm2 */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x05,0x01, /* [ 7625] OBJ_id_tc26_cipher_gostr3412_2015_magma */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x05,0x01,0x01, /* [ 7633] OBJ_magma_ctr_acpkm */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x05,0x01,0x02, /* [ 7642] OBJ_magma_ctr_acpkm_omac */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x05,0x02, /* [ 7651] OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x05,0x02,0x01, /* [ 7659] OBJ_kuznyechik_ctr_acpkm */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x05,0x02,0x02, /* [ 7668] OBJ_kuznyechik_ctr_acpkm_omac */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x07, /* [ 7677] OBJ_id_tc26_wrap */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x07,0x01, /* [ 7684] OBJ_id_tc26_wrap_gostr3412_2015_magma */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x07,0x01,0x01, /* [ 7692] OBJ_magma_kexp15 */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x07,0x02, /* [ 7701] OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik */ 0x2A,0x85,0x03,0x07,0x01,0x01,0x07,0x02,0x01, /* [ 7709] OBJ_kuznyechik_kexp15 */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x01,0x01,0x02, /* [ 7718] OBJ_id_tc26_gost_3410_2012_256_paramSetB */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x01,0x01,0x03, /* [ 7727] OBJ_id_tc26_gost_3410_2012_256_paramSetC */ 0x2A,0x85,0x03,0x07,0x01,0x02,0x01,0x01,0x04, /* [ 7736] OBJ_id_tc26_gost_3410_2012_256_paramSetD */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x0C, /* [ 7745] OBJ_hmacWithSHA512_224 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x0D, /* [ 7753] OBJ_hmacWithSHA512_256 */ 0x28,0xCC,0x45,0x03,0x04, /* [ 7761] OBJ_gmac */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x13, /* [ 7766] OBJ_kmac128 */ 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x14, /* [ 7775] OBJ_kmac256 */ 0x2B,0x06,0x01,0x04,0x01,0x8D,0x3A,0x0C,0x02,0x01, /* [ 7784] OBJ_blake2bmac */ 0x2B,0x06,0x01,0x04,0x01,0x8D,0x3A,0x0C,0x02,0x02, /* [ 7794] OBJ_blake2smac */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x75, /* [ 7804] OBJ_SM2_with_SM3 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x08,0x09, /* [ 7812] OBJ_id_on_SmtpUTF8Mailbox */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x08,0x05, /* [ 7820] OBJ_XmppAddr */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x08,0x07, /* [ 7828] OBJ_SRVName */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x08,0x08, /* [ 7836] OBJ_NAIRealm */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x1D, /* [ 7844] OBJ_cmcArchive */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x1E, /* [ 7852] OBJ_id_kp_bgpsec_router */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x1F, /* [ 7860] OBJ_id_kp_BrandIndicatorforMessageIdentification */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x20, /* [ 7868] OBJ_cmKGA */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x11, /* [ 7876] OBJ_id_it_caCerts */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x12, /* [ 7884] OBJ_id_it_rootCaKeyUpdate */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x13, /* [ 7892] OBJ_id_it_certReqTemplate */ 0x2A,0x85,0x03,0x64,0x05, /* [ 7900] OBJ_OGRNIP */ 0x2A,0x85,0x03,0x64,0x71, /* [ 7905] OBJ_classSignTool */ 0x2A,0x85,0x03,0x64,0x71,0x01, /* [ 7910] OBJ_classSignToolKC1 */ 0x2A,0x85,0x03,0x64,0x71,0x02, /* [ 7916] OBJ_classSignToolKC2 */ 0x2A,0x85,0x03,0x64,0x71,0x03, /* [ 7922] OBJ_classSignToolKC3 */ 0x2A,0x85,0x03,0x64,0x71,0x04, /* [ 7928] OBJ_classSignToolKB1 */ 0x2A,0x85,0x03,0x64,0x71,0x05, /* [ 7934] OBJ_classSignToolKB2 */ 0x2A,0x85,0x03,0x64,0x71,0x06, /* [ 7940] OBJ_classSignToolKA1 */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x18, /* [ 7946] OBJ_id_ct_routeOriginAuthz */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x1A, /* [ 7957] OBJ_id_ct_rpkiManifest */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x23, /* [ 7968] OBJ_id_ct_rpkiGhostbusters */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x24, /* [ 7979] OBJ_id_ct_resourceTaggedAttest */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0E, /* [ 7990] OBJ_id_cp */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x1C, /* [ 7997] OBJ_sbgp_ipAddrBlockv2 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x1D, /* [ 8005] OBJ_sbgp_autonomousSysNumv2 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0E,0x02, /* [ 8013] OBJ_ipAddr_asNumber */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x0E,0x03, /* [ 8021] OBJ_ipAddr_asNumberv2 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x0A, /* [ 8029] OBJ_rpkiManifest */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x0B, /* [ 8037] OBJ_signedObject */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x0D, /* [ 8045] OBJ_rpkiNotify */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x2F, /* [ 8053] OBJ_id_ct_geofeedCSVwithCRLF */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x30, /* [ 8064] OBJ_id_ct_signedChecklist */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x08, /* [ 8075] OBJ_sm4_gcm */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x09, /* [ 8083] OBJ_sm4_ccm */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x31, /* [ 8091] OBJ_id_ct_ASPA */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x32, /* [ 8102] OBJ_id_mod_cmp2000_02 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x63, /* [ 8110] OBJ_id_mod_cmp2021_88 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x00,0x64, /* [ 8118] OBJ_id_mod_cmp2021_02 */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x14, /* [ 8126] OBJ_id_it_rootCaCert */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x15, /* [ 8134] OBJ_id_it_certProfile */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x16, /* [ 8142] OBJ_id_it_crlStatusList */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x04,0x17, /* [ 8150] OBJ_id_it_crls */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x01,0x07, /* [ 8158] OBJ_id_regCtrl_altCertTemplate */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x01,0x0B, /* [ 8167] OBJ_id_regCtrl_algId */ 0x2B,0x06,0x01,0x05,0x05,0x07,0x05,0x01,0x0C, /* [ 8176] OBJ_id_regCtrl_rsaKeyLen */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x2C, /* [ 8185] OBJ_id_aa_ets_attrCertificateRefs */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x2D, /* [ 8196] OBJ_id_aa_ets_attrRevocationRefs */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x34, /* [ 8207] OBJ_id_aa_CMSAlgorithmProtection */ 0x04, /* [ 8216] OBJ_itu_t_identified_organization */ 0x04,0x00, /* [ 8217] OBJ_etsi */ 0x04,0x00,0x8D,0x45, /* [ 8219] OBJ_electronic_signature_standard */ 0x04,0x00,0x8D,0x45,0x02, /* [ 8223] OBJ_ess_attributes */ 0x04,0x00,0x8D,0x45,0x02,0x01, /* [ 8228] OBJ_id_aa_ets_mimeType */ 0x04,0x00,0x8D,0x45,0x02,0x02, /* [ 8234] OBJ_id_aa_ets_longTermValidation */ 0x04,0x00,0x8D,0x45,0x02,0x03, /* [ 8240] OBJ_id_aa_ets_SignaturePolicyDocument */ 0x04,0x00,0x8D,0x45,0x02,0x04, /* [ 8246] OBJ_id_aa_ets_archiveTimestampV3 */ 0x04,0x00,0x8D,0x45,0x02,0x05, /* [ 8252] OBJ_id_aa_ATSHashIndex */ 0x04,0x00,0x81,0x95,0x32, /* [ 8258] OBJ_cades */ 0x04,0x00,0x81,0x95,0x32,0x01, /* [ 8263] OBJ_cades_attributes */ 0x04,0x00,0x81,0x95,0x32,0x01,0x01, /* [ 8269] OBJ_id_aa_ets_signerAttrV2 */ 0x04,0x00,0x81,0x95,0x32,0x01,0x03, /* [ 8276] OBJ_id_aa_ets_sigPolicyStore */ 0x04,0x00,0x81,0x95,0x32,0x01,0x04, /* [ 8283] OBJ_id_aa_ATSHashIndex_v2 */ 0x04,0x00,0x81,0x95,0x32,0x01,0x05, /* [ 8290] OBJ_id_aa_ATSHashIndex_v3 */ 0x04,0x00,0x81,0x95,0x32,0x01,0x06, /* [ 8297] OBJ_signedAssertion */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x02,0x30, /* [ 8304] OBJ_id_aa_ets_archiveTimestampV2 */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x11,0x03,0x01, /* [ 8315] OBJ_hmacWithSM3 */ 0x60,0x86,0x48,0x01,0x86,0xF9,0x66, /* [ 8325] OBJ_oracle */ 0x60,0x86,0x48,0x01,0x86,0xF9,0x66,0xAD,0xCA,0x7B,0x01,0x01, /* [ 8332] OBJ_oracle_jdk_trustedkeyusage */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x32, /* [ 8344] OBJ_id_ct_signedTAL */ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x0A, /* [ 8355] OBJ_sm4_xts */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x19,0x02,0x01, /* [ 8363] OBJ_ms_ntds_obj_sid */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x19,0x02, /* [ 8373] OBJ_ms_ntds_sec_ext */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x15,0x07, /* [ 8382] OBJ_ms_cert_templ */ 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x15,0x0A, /* [ 8391] OBJ_ms_app_policies */ 0x55,0x1D,0x26, /* [ 8400] OBJ_authority_attribute_identifier */ 0x55,0x1D,0x27, /* [ 8403] OBJ_role_spec_cert_identifier */ 0x55,0x1D,0x29, /* [ 8406] OBJ_basic_att_constraints */ 0x55,0x1D,0x2A, /* [ 8409] OBJ_delegated_name_constraints */ 0x55,0x1D,0x2B, /* [ 8412] OBJ_time_specification */ 0x55,0x1D,0x30, /* [ 8415] OBJ_attribute_descriptor */ 0x55,0x1D,0x31, /* [ 8418] OBJ_user_notice */ 0x55,0x1D,0x32, /* [ 8421] OBJ_soa_identifier */ 0x55,0x1D,0x34, /* [ 8424] OBJ_acceptable_cert_policies */ 0x55,0x1D,0x39, /* [ 8427] OBJ_acceptable_privilege_policies */ 0x55,0x1D,0x3D, /* [ 8430] OBJ_indirect_issuer */ 0x55,0x1D,0x3E, /* [ 8433] OBJ_no_assertion */ 0x55,0x1D,0x3F, /* [ 8436] OBJ_id_aa_issuing_distribution_point */ 0x55,0x1D,0x40, /* [ 8439] OBJ_issued_on_behalf_of */ 0x55,0x1D,0x41, /* [ 8442] OBJ_single_use */ 0x55,0x1D,0x42, /* [ 8445] OBJ_group_ac */ 0x55,0x1D,0x43, /* [ 8448] OBJ_allowed_attribute_assignments */ 0x55,0x1D,0x44, /* [ 8451] OBJ_attribute_mappings */ 0x55,0x1D,0x45, /* [ 8454] OBJ_holder_name_constraints */ 0x55,0x1D,0x46, /* [ 8457] OBJ_authorization_validation */ 0x55,0x1D,0x47, /* [ 8460] OBJ_prot_restrict */ 0x55,0x1D,0x48, /* [ 8463] OBJ_subject_alt_public_key_info */ 0x55,0x1D,0x49, /* [ 8466] OBJ_alt_signature_algorithm */ 0x55,0x1D,0x4A, /* [ 8469] OBJ_alt_signature_value */ 0x55,0x1D,0x4B, /* [ 8472] OBJ_associated_information */ }; #define NUM_NID 1320 static const ASN1_OBJECT nid_objs[NUM_NID] = { {"UNDEF", "undefined", NID_undef}, {"rsadsi", "RSA Data Security, Inc.", NID_rsadsi, 6, &so[0]}, {"pkcs", "RSA Data Security, Inc. PKCS", NID_pkcs, 7, &so[6]}, {"MD2", "md2", NID_md2, 8, &so[13]}, {"MD5", "md5", NID_md5, 8, &so[21]}, {"RC4", "rc4", NID_rc4, 8, &so[29]}, {"rsaEncryption", "rsaEncryption", NID_rsaEncryption, 9, &so[37]}, {"RSA-MD2", "md2WithRSAEncryption", NID_md2WithRSAEncryption, 9, &so[46]}, {"RSA-MD5", "md5WithRSAEncryption", NID_md5WithRSAEncryption, 9, &so[55]}, {"PBE-MD2-DES", "pbeWithMD2AndDES-CBC", NID_pbeWithMD2AndDES_CBC, 9, &so[64]}, {"PBE-MD5-DES", "pbeWithMD5AndDES-CBC", NID_pbeWithMD5AndDES_CBC, 9, &so[73]}, {"X500", "directory services (X.500)", NID_X500, 1, &so[82]}, {"X509", "X509", NID_X509, 2, &so[83]}, {"CN", "commonName", NID_commonName, 3, &so[85]}, {"C", "countryName", NID_countryName, 3, &so[88]}, {"L", "localityName", NID_localityName, 3, &so[91]}, {"ST", "stateOrProvinceName", NID_stateOrProvinceName, 3, &so[94]}, {"O", "organizationName", NID_organizationName, 3, &so[97]}, {"OU", "organizationalUnitName", NID_organizationalUnitName, 3, &so[100]}, {"RSA", "rsa", NID_rsa, 4, &so[103]}, {"pkcs7", "pkcs7", NID_pkcs7, 8, &so[107]}, {"pkcs7-data", "pkcs7-data", NID_pkcs7_data, 9, &so[115]}, {"pkcs7-signedData", "pkcs7-signedData", NID_pkcs7_signed, 9, &so[124]}, {"pkcs7-envelopedData", "pkcs7-envelopedData", NID_pkcs7_enveloped, 9, &so[133]}, {"pkcs7-signedAndEnvelopedData", "pkcs7-signedAndEnvelopedData", NID_pkcs7_signedAndEnveloped, 9, &so[142]}, {"pkcs7-digestData", "pkcs7-digestData", NID_pkcs7_digest, 9, &so[151]}, {"pkcs7-encryptedData", "pkcs7-encryptedData", NID_pkcs7_encrypted, 9, &so[160]}, {"pkcs3", "pkcs3", NID_pkcs3, 8, &so[169]}, {"dhKeyAgreement", "dhKeyAgreement", NID_dhKeyAgreement, 9, &so[177]}, {"DES-ECB", "des-ecb", NID_des_ecb, 5, &so[186]}, {"DES-CFB", "des-cfb", NID_des_cfb64, 5, &so[191]}, {"DES-CBC", "des-cbc", NID_des_cbc, 5, &so[196]}, {"DES-EDE", "des-ede", NID_des_ede_ecb, 5, &so[201]}, {"DES-EDE3", "des-ede3", NID_des_ede3_ecb}, {"IDEA-CBC", "idea-cbc", NID_idea_cbc, 11, &so[206]}, {"IDEA-CFB", "idea-cfb", NID_idea_cfb64}, {"IDEA-ECB", "idea-ecb", NID_idea_ecb}, {"RC2-CBC", "rc2-cbc", NID_rc2_cbc, 8, &so[217]}, {"RC2-ECB", "rc2-ecb", NID_rc2_ecb}, {"RC2-CFB", "rc2-cfb", NID_rc2_cfb64}, {"RC2-OFB", "rc2-ofb", NID_rc2_ofb64}, {"SHA", "sha", NID_sha, 5, &so[225]}, {"RSA-SHA", "shaWithRSAEncryption", NID_shaWithRSAEncryption, 5, &so[230]}, {"DES-EDE-CBC", "des-ede-cbc", NID_des_ede_cbc}, {"DES-EDE3-CBC", "des-ede3-cbc", NID_des_ede3_cbc, 8, &so[235]}, {"DES-OFB", "des-ofb", NID_des_ofb64, 5, &so[243]}, {"IDEA-OFB", "idea-ofb", NID_idea_ofb64}, {"pkcs9", "pkcs9", NID_pkcs9, 8, &so[248]}, {"emailAddress", "emailAddress", NID_pkcs9_emailAddress, 9, &so[256]}, {"unstructuredName", "unstructuredName", NID_pkcs9_unstructuredName, 9, &so[265]}, {"contentType", "contentType", NID_pkcs9_contentType, 9, &so[274]}, {"messageDigest", "messageDigest", NID_pkcs9_messageDigest, 9, &so[283]}, {"signingTime", "signingTime", NID_pkcs9_signingTime, 9, &so[292]}, {"countersignature", "countersignature", NID_pkcs9_countersignature, 9, &so[301]}, {"challengePassword", "challengePassword", NID_pkcs9_challengePassword, 9, &so[310]}, {"unstructuredAddress", "unstructuredAddress", NID_pkcs9_unstructuredAddress, 9, &so[319]}, {"extendedCertificateAttributes", "extendedCertificateAttributes", NID_pkcs9_extCertAttributes, 9, &so[328]}, {"Netscape", "Netscape Communications Corp.", NID_netscape, 7, &so[337]}, {"nsCertExt", "Netscape Certificate Extension", NID_netscape_cert_extension, 8, &so[344]}, {"nsDataType", "Netscape Data Type", NID_netscape_data_type, 8, &so[352]}, {"DES-EDE-CFB", "des-ede-cfb", NID_des_ede_cfb64}, {"DES-EDE3-CFB", "des-ede3-cfb", NID_des_ede3_cfb64}, {"DES-EDE-OFB", "des-ede-ofb", NID_des_ede_ofb64}, {"DES-EDE3-OFB", "des-ede3-ofb", NID_des_ede3_ofb64}, {"SHA1", "sha1", NID_sha1, 5, &so[360]}, {"RSA-SHA1", "sha1WithRSAEncryption", NID_sha1WithRSAEncryption, 9, &so[365]}, {"DSA-SHA", "dsaWithSHA", NID_dsaWithSHA, 5, &so[374]}, {"DSA-old", "dsaEncryption-old", NID_dsa_2, 5, &so[379]}, {"PBE-SHA1-RC2-64", "pbeWithSHA1AndRC2-CBC", NID_pbeWithSHA1AndRC2_CBC, 9, &so[384]}, {"PBKDF2", "PBKDF2", NID_id_pbkdf2, 9, &so[393]}, {"DSA-SHA1-old", "dsaWithSHA1-old", NID_dsaWithSHA1_2, 5, &so[402]}, {"nsCertType", "Netscape Cert Type", NID_netscape_cert_type, 9, &so[407]}, {"nsBaseUrl", "Netscape Base Url", NID_netscape_base_url, 9, &so[416]}, {"nsRevocationUrl", "Netscape Revocation Url", NID_netscape_revocation_url, 9, &so[425]}, {"nsCaRevocationUrl", "Netscape CA Revocation Url", NID_netscape_ca_revocation_url, 9, &so[434]}, {"nsRenewalUrl", "Netscape Renewal Url", NID_netscape_renewal_url, 9, &so[443]}, {"nsCaPolicyUrl", "Netscape CA Policy Url", NID_netscape_ca_policy_url, 9, &so[452]}, {"nsSslServerName", "Netscape SSL Server Name", NID_netscape_ssl_server_name, 9, &so[461]}, {"nsComment", "Netscape Comment", NID_netscape_comment, 9, &so[470]}, {"nsCertSequence", "Netscape Certificate Sequence", NID_netscape_cert_sequence, 9, &so[479]}, {"DESX-CBC", "desx-cbc", NID_desx_cbc}, {"id-ce", "id-ce", NID_id_ce, 2, &so[488]}, {"subjectKeyIdentifier", "X509v3 Subject Key Identifier", NID_subject_key_identifier, 3, &so[490]}, {"keyUsage", "X509v3 Key Usage", NID_key_usage, 3, &so[493]}, {"privateKeyUsagePeriod", "X509v3 Private Key Usage Period", NID_private_key_usage_period, 3, &so[496]}, {"subjectAltName", "X509v3 Subject Alternative Name", NID_subject_alt_name, 3, &so[499]}, {"issuerAltName", "X509v3 Issuer Alternative Name", NID_issuer_alt_name, 3, &so[502]}, {"basicConstraints", "X509v3 Basic Constraints", NID_basic_constraints, 3, &so[505]}, {"crlNumber", "X509v3 CRL Number", NID_crl_number, 3, &so[508]}, {"certificatePolicies", "X509v3 Certificate Policies", NID_certificate_policies, 3, &so[511]}, {"authorityKeyIdentifier", "X509v3 Authority Key Identifier", NID_authority_key_identifier, 3, &so[514]}, {"BF-CBC", "bf-cbc", NID_bf_cbc, 9, &so[517]}, {"BF-ECB", "bf-ecb", NID_bf_ecb}, {"BF-CFB", "bf-cfb", NID_bf_cfb64}, {"BF-OFB", "bf-ofb", NID_bf_ofb64}, {"MDC2", "mdc2", NID_mdc2, 4, &so[526]}, {"RSA-MDC2", "mdc2WithRSA", NID_mdc2WithRSA, 4, &so[530]}, {"RC4-40", "rc4-40", NID_rc4_40}, {"RC2-40-CBC", "rc2-40-cbc", NID_rc2_40_cbc}, {"GN", "givenName", NID_givenName, 3, &so[534]}, {"SN", "surname", NID_surname, 3, &so[537]}, {"initials", "initials", NID_initials, 3, &so[540]}, {"uid", "uniqueIdentifier", NID_uniqueIdentifier, 10, &so[543]}, {"crlDistributionPoints", "X509v3 CRL Distribution Points", NID_crl_distribution_points, 3, &so[553]}, {"RSA-NP-MD5", "md5WithRSA", NID_md5WithRSA, 5, &so[556]}, {"serialNumber", "serialNumber", NID_serialNumber, 3, &so[561]}, {"title", "title", NID_title, 3, &so[564]}, {"description", "description", NID_description, 3, &so[567]}, {"CAST5-CBC", "cast5-cbc", NID_cast5_cbc, 9, &so[570]}, {"CAST5-ECB", "cast5-ecb", NID_cast5_ecb}, {"CAST5-CFB", "cast5-cfb", NID_cast5_cfb64}, {"CAST5-OFB", "cast5-ofb", NID_cast5_ofb64}, {"pbeWithMD5AndCast5CBC", "pbeWithMD5AndCast5CBC", NID_pbeWithMD5AndCast5_CBC, 9, &so[579]}, {"DSA-SHA1", "dsaWithSHA1", NID_dsaWithSHA1, 7, &so[588]}, {"MD5-SHA1", "md5-sha1", NID_md5_sha1}, {"RSA-SHA1-2", "sha1WithRSA", NID_sha1WithRSA, 5, &so[595]}, {"DSA", "dsaEncryption", NID_dsa, 7, &so[600]}, {"RIPEMD160", "ripemd160", NID_ripemd160, 5, &so[607]}, { NULL, NULL, NID_undef }, {"RSA-RIPEMD160", "ripemd160WithRSA", NID_ripemd160WithRSA, 6, &so[612]}, {"RC5-CBC", "rc5-cbc", NID_rc5_cbc, 8, &so[618]}, {"RC5-ECB", "rc5-ecb", NID_rc5_ecb}, {"RC5-CFB", "rc5-cfb", NID_rc5_cfb64}, {"RC5-OFB", "rc5-ofb", NID_rc5_ofb64}, { NULL, NULL, NID_undef }, {"ZLIB", "zlib compression", NID_zlib_compression, 11, &so[626]}, {"extendedKeyUsage", "X509v3 Extended Key Usage", NID_ext_key_usage, 3, &so[637]}, {"PKIX", "PKIX", NID_id_pkix, 6, &so[640]}, {"id-kp", "id-kp", NID_id_kp, 7, &so[646]}, {"serverAuth", "TLS Web Server Authentication", NID_server_auth, 8, &so[653]}, {"clientAuth", "TLS Web Client Authentication", NID_client_auth, 8, &so[661]}, {"codeSigning", "Code Signing", NID_code_sign, 8, &so[669]}, {"emailProtection", "E-mail Protection", NID_email_protect, 8, &so[677]}, {"timeStamping", "Time Stamping", NID_time_stamp, 8, &so[685]}, {"msCodeInd", "Microsoft Individual Code Signing", NID_ms_code_ind, 10, &so[693]}, {"msCodeCom", "Microsoft Commercial Code Signing", NID_ms_code_com, 10, &so[703]}, {"msCTLSign", "Microsoft Trust List Signing", NID_ms_ctl_sign, 10, &so[713]}, {"msSGC", "Microsoft Server Gated Crypto", NID_ms_sgc, 10, &so[723]}, {"msEFS", "Microsoft Encrypted File System", NID_ms_efs, 10, &so[733]}, {"nsSGC", "Netscape Server Gated Crypto", NID_ns_sgc, 9, &so[743]}, {"deltaCRL", "X509v3 Delta CRL Indicator", NID_delta_crl, 3, &so[752]}, {"CRLReason", "X509v3 CRL Reason Code", NID_crl_reason, 3, &so[755]}, {"invalidityDate", "Invalidity Date", NID_invalidity_date, 3, &so[758]}, {"SXNetID", "Strong Extranet ID", NID_sxnet, 5, &so[761]}, {"PBE-SHA1-RC4-128", "pbeWithSHA1And128BitRC4", NID_pbe_WithSHA1And128BitRC4, 10, &so[766]}, {"PBE-SHA1-RC4-40", "pbeWithSHA1And40BitRC4", NID_pbe_WithSHA1And40BitRC4, 10, &so[776]}, {"PBE-SHA1-3DES", "pbeWithSHA1And3-KeyTripleDES-CBC", NID_pbe_WithSHA1And3_Key_TripleDES_CBC, 10, &so[786]}, {"PBE-SHA1-2DES", "pbeWithSHA1And2-KeyTripleDES-CBC", NID_pbe_WithSHA1And2_Key_TripleDES_CBC, 10, &so[796]}, {"PBE-SHA1-RC2-128", "pbeWithSHA1And128BitRC2-CBC", NID_pbe_WithSHA1And128BitRC2_CBC, 10, &so[806]}, {"PBE-SHA1-RC2-40", "pbeWithSHA1And40BitRC2-CBC", NID_pbe_WithSHA1And40BitRC2_CBC, 10, &so[816]}, {"keyBag", "keyBag", NID_keyBag, 11, &so[826]}, {"pkcs8ShroudedKeyBag", "pkcs8ShroudedKeyBag", NID_pkcs8ShroudedKeyBag, 11, &so[837]}, {"certBag", "certBag", NID_certBag, 11, &so[848]}, {"crlBag", "crlBag", NID_crlBag, 11, &so[859]}, {"secretBag", "secretBag", NID_secretBag, 11, &so[870]}, {"safeContentsBag", "safeContentsBag", NID_safeContentsBag, 11, &so[881]}, {"friendlyName", "friendlyName", NID_friendlyName, 9, &so[892]}, {"localKeyID", "localKeyID", NID_localKeyID, 9, &so[901]}, {"x509Certificate", "x509Certificate", NID_x509Certificate, 10, &so[910]}, {"sdsiCertificate", "sdsiCertificate", NID_sdsiCertificate, 10, &so[920]}, {"x509Crl", "x509Crl", NID_x509Crl, 10, &so[930]}, {"PBES2", "PBES2", NID_pbes2, 9, &so[940]}, {"PBMAC1", "PBMAC1", NID_pbmac1, 9, &so[949]}, {"hmacWithSHA1", "hmacWithSHA1", NID_hmacWithSHA1, 8, &so[958]}, {"id-qt-cps", "Policy Qualifier CPS", NID_id_qt_cps, 8, &so[966]}, {"id-qt-unotice", "Policy Qualifier User Notice", NID_id_qt_unotice, 8, &so[974]}, {"RC2-64-CBC", "rc2-64-cbc", NID_rc2_64_cbc}, {"SMIME-CAPS", "S/MIME Capabilities", NID_SMIMECapabilities, 9, &so[982]}, {"PBE-MD2-RC2-64", "pbeWithMD2AndRC2-CBC", NID_pbeWithMD2AndRC2_CBC, 9, &so[991]}, {"PBE-MD5-RC2-64", "pbeWithMD5AndRC2-CBC", NID_pbeWithMD5AndRC2_CBC, 9, &so[1000]}, {"PBE-SHA1-DES", "pbeWithSHA1AndDES-CBC", NID_pbeWithSHA1AndDES_CBC, 9, &so[1009]}, {"msExtReq", "Microsoft Extension Request", NID_ms_ext_req, 10, &so[1018]}, {"extReq", "Extension Request", NID_ext_req, 9, &so[1028]}, {"name", "name", NID_name, 3, &so[1037]}, {"dnQualifier", "dnQualifier", NID_dnQualifier, 3, &so[1040]}, {"id-pe", "id-pe", NID_id_pe, 7, &so[1043]}, {"id-ad", "id-ad", NID_id_ad, 7, &so[1050]}, {"authorityInfoAccess", "Authority Information Access", NID_info_access, 8, &so[1057]}, {"OCSP", "OCSP", NID_ad_OCSP, 8, &so[1065]}, {"caIssuers", "CA Issuers", NID_ad_ca_issuers, 8, &so[1073]}, {"OCSPSigning", "OCSP Signing", NID_OCSP_sign, 8, &so[1081]}, {"ISO", "iso", NID_iso}, {"member-body", "ISO Member Body", NID_member_body, 1, &so[1089]}, {"ISO-US", "ISO US Member Body", NID_ISO_US, 3, &so[1090]}, {"X9-57", "X9.57", NID_X9_57, 5, &so[1093]}, {"X9cm", "X9.57 CM ?", NID_X9cm, 6, &so[1098]}, {"pkcs1", "pkcs1", NID_pkcs1, 8, &so[1104]}, {"pkcs5", "pkcs5", NID_pkcs5, 8, &so[1112]}, {"SMIME", "S/MIME", NID_SMIME, 9, &so[1120]}, {"id-smime-mod", "id-smime-mod", NID_id_smime_mod, 10, &so[1129]}, {"id-smime-ct", "id-smime-ct", NID_id_smime_ct, 10, &so[1139]}, {"id-smime-aa", "id-smime-aa", NID_id_smime_aa, 10, &so[1149]}, {"id-smime-alg", "id-smime-alg", NID_id_smime_alg, 10, &so[1159]}, {"id-smime-cd", "id-smime-cd", NID_id_smime_cd, 10, &so[1169]}, {"id-smime-spq", "id-smime-spq", NID_id_smime_spq, 10, &so[1179]}, {"id-smime-cti", "id-smime-cti", NID_id_smime_cti, 10, &so[1189]}, {"id-smime-mod-cms", "id-smime-mod-cms", NID_id_smime_mod_cms, 11, &so[1199]}, {"id-smime-mod-ess", "id-smime-mod-ess", NID_id_smime_mod_ess, 11, &so[1210]}, {"id-smime-mod-oid", "id-smime-mod-oid", NID_id_smime_mod_oid, 11, &so[1221]}, {"id-smime-mod-msg-v3", "id-smime-mod-msg-v3", NID_id_smime_mod_msg_v3, 11, &so[1232]}, {"id-smime-mod-ets-eSignature-88", "id-smime-mod-ets-eSignature-88", NID_id_smime_mod_ets_eSignature_88, 11, &so[1243]}, {"id-smime-mod-ets-eSignature-97", "id-smime-mod-ets-eSignature-97", NID_id_smime_mod_ets_eSignature_97, 11, &so[1254]}, {"id-smime-mod-ets-eSigPolicy-88", "id-smime-mod-ets-eSigPolicy-88", NID_id_smime_mod_ets_eSigPolicy_88, 11, &so[1265]}, {"id-smime-mod-ets-eSigPolicy-97", "id-smime-mod-ets-eSigPolicy-97", NID_id_smime_mod_ets_eSigPolicy_97, 11, &so[1276]}, {"id-smime-ct-receipt", "id-smime-ct-receipt", NID_id_smime_ct_receipt, 11, &so[1287]}, {"id-smime-ct-authData", "id-smime-ct-authData", NID_id_smime_ct_authData, 11, &so[1298]}, {"id-smime-ct-publishCert", "id-smime-ct-publishCert", NID_id_smime_ct_publishCert, 11, &so[1309]}, {"id-smime-ct-TSTInfo", "id-smime-ct-TSTInfo", NID_id_smime_ct_TSTInfo, 11, &so[1320]}, {"id-smime-ct-TDTInfo", "id-smime-ct-TDTInfo", NID_id_smime_ct_TDTInfo, 11, &so[1331]}, {"id-smime-ct-contentInfo", "id-smime-ct-contentInfo", NID_id_smime_ct_contentInfo, 11, &so[1342]}, {"id-smime-ct-DVCSRequestData", "id-smime-ct-DVCSRequestData", NID_id_smime_ct_DVCSRequestData, 11, &so[1353]}, {"id-smime-ct-DVCSResponseData", "id-smime-ct-DVCSResponseData", NID_id_smime_ct_DVCSResponseData, 11, &so[1364]}, {"id-smime-aa-receiptRequest", "id-smime-aa-receiptRequest", NID_id_smime_aa_receiptRequest, 11, &so[1375]}, {"id-smime-aa-securityLabel", "id-smime-aa-securityLabel", NID_id_smime_aa_securityLabel, 11, &so[1386]}, {"id-smime-aa-mlExpandHistory", "id-smime-aa-mlExpandHistory", NID_id_smime_aa_mlExpandHistory, 11, &so[1397]}, {"id-smime-aa-contentHint", "id-smime-aa-contentHint", NID_id_smime_aa_contentHint, 11, &so[1408]}, {"id-smime-aa-msgSigDigest", "id-smime-aa-msgSigDigest", NID_id_smime_aa_msgSigDigest, 11, &so[1419]}, {"id-smime-aa-encapContentType", "id-smime-aa-encapContentType", NID_id_smime_aa_encapContentType, 11, &so[1430]}, {"id-smime-aa-contentIdentifier", "id-smime-aa-contentIdentifier", NID_id_smime_aa_contentIdentifier, 11, &so[1441]}, {"id-smime-aa-macValue", "id-smime-aa-macValue", NID_id_smime_aa_macValue, 11, &so[1452]}, {"id-smime-aa-equivalentLabels", "id-smime-aa-equivalentLabels", NID_id_smime_aa_equivalentLabels, 11, &so[1463]}, {"id-smime-aa-contentReference", "id-smime-aa-contentReference", NID_id_smime_aa_contentReference, 11, &so[1474]}, {"id-smime-aa-encrypKeyPref", "id-smime-aa-encrypKeyPref", NID_id_smime_aa_encrypKeyPref, 11, &so[1485]}, {"id-smime-aa-signingCertificate", "id-smime-aa-signingCertificate", NID_id_smime_aa_signingCertificate, 11, &so[1496]}, {"id-smime-aa-smimeEncryptCerts", "id-smime-aa-smimeEncryptCerts", NID_id_smime_aa_smimeEncryptCerts, 11, &so[1507]}, {"id-smime-aa-timeStampToken", "id-smime-aa-timeStampToken", NID_id_smime_aa_timeStampToken, 11, &so[1518]}, {"id-smime-aa-ets-sigPolicyId", "id-smime-aa-ets-sigPolicyId", NID_id_smime_aa_ets_sigPolicyId, 11, &so[1529]}, {"id-smime-aa-ets-commitmentType", "id-smime-aa-ets-commitmentType", NID_id_smime_aa_ets_commitmentType, 11, &so[1540]}, {"id-smime-aa-ets-signerLocation", "id-smime-aa-ets-signerLocation", NID_id_smime_aa_ets_signerLocation, 11, &so[1551]}, {"id-smime-aa-ets-signerAttr", "id-smime-aa-ets-signerAttr", NID_id_smime_aa_ets_signerAttr, 11, &so[1562]}, {"id-smime-aa-ets-otherSigCert", "id-smime-aa-ets-otherSigCert", NID_id_smime_aa_ets_otherSigCert, 11, &so[1573]}, {"id-smime-aa-ets-contentTimestamp", "id-smime-aa-ets-contentTimestamp", NID_id_smime_aa_ets_contentTimestamp, 11, &so[1584]}, {"id-smime-aa-ets-CertificateRefs", "id-smime-aa-ets-CertificateRefs", NID_id_smime_aa_ets_CertificateRefs, 11, &so[1595]}, {"id-smime-aa-ets-RevocationRefs", "id-smime-aa-ets-RevocationRefs", NID_id_smime_aa_ets_RevocationRefs, 11, &so[1606]}, {"id-smime-aa-ets-certValues", "id-smime-aa-ets-certValues", NID_id_smime_aa_ets_certValues, 11, &so[1617]}, {"id-smime-aa-ets-revocationValues", "id-smime-aa-ets-revocationValues", NID_id_smime_aa_ets_revocationValues, 11, &so[1628]}, {"id-smime-aa-ets-escTimeStamp", "id-smime-aa-ets-escTimeStamp", NID_id_smime_aa_ets_escTimeStamp, 11, &so[1639]}, {"id-smime-aa-ets-certCRLTimestamp", "id-smime-aa-ets-certCRLTimestamp", NID_id_smime_aa_ets_certCRLTimestamp, 11, &so[1650]}, {"id-smime-aa-ets-archiveTimeStamp", "id-smime-aa-ets-archiveTimeStamp", NID_id_smime_aa_ets_archiveTimeStamp, 11, &so[1661]}, {"id-smime-aa-signatureType", "id-smime-aa-signatureType", NID_id_smime_aa_signatureType, 11, &so[1672]}, {"id-smime-aa-dvcs-dvc", "id-smime-aa-dvcs-dvc", NID_id_smime_aa_dvcs_dvc, 11, &so[1683]}, {"id-smime-alg-ESDHwith3DES", "id-smime-alg-ESDHwith3DES", NID_id_smime_alg_ESDHwith3DES, 11, &so[1694]}, {"id-smime-alg-ESDHwithRC2", "id-smime-alg-ESDHwithRC2", NID_id_smime_alg_ESDHwithRC2, 11, &so[1705]}, {"id-smime-alg-3DESwrap", "id-smime-alg-3DESwrap", NID_id_smime_alg_3DESwrap, 11, &so[1716]}, {"id-smime-alg-RC2wrap", "id-smime-alg-RC2wrap", NID_id_smime_alg_RC2wrap, 11, &so[1727]}, {"id-smime-alg-ESDH", "id-smime-alg-ESDH", NID_id_smime_alg_ESDH, 11, &so[1738]}, {"id-smime-alg-CMS3DESwrap", "id-smime-alg-CMS3DESwrap", NID_id_smime_alg_CMS3DESwrap, 11, &so[1749]}, {"id-smime-alg-CMSRC2wrap", "id-smime-alg-CMSRC2wrap", NID_id_smime_alg_CMSRC2wrap, 11, &so[1760]}, {"id-smime-cd-ldap", "id-smime-cd-ldap", NID_id_smime_cd_ldap, 11, &so[1771]}, {"id-smime-spq-ets-sqt-uri", "id-smime-spq-ets-sqt-uri", NID_id_smime_spq_ets_sqt_uri, 11, &so[1782]}, {"id-smime-spq-ets-sqt-unotice", "id-smime-spq-ets-sqt-unotice", NID_id_smime_spq_ets_sqt_unotice, 11, &so[1793]}, {"id-smime-cti-ets-proofOfOrigin", "id-smime-cti-ets-proofOfOrigin", NID_id_smime_cti_ets_proofOfOrigin, 11, &so[1804]}, {"id-smime-cti-ets-proofOfReceipt", "id-smime-cti-ets-proofOfReceipt", NID_id_smime_cti_ets_proofOfReceipt, 11, &so[1815]}, {"id-smime-cti-ets-proofOfDelivery", "id-smime-cti-ets-proofOfDelivery", NID_id_smime_cti_ets_proofOfDelivery, 11, &so[1826]}, {"id-smime-cti-ets-proofOfSender", "id-smime-cti-ets-proofOfSender", NID_id_smime_cti_ets_proofOfSender, 11, &so[1837]}, {"id-smime-cti-ets-proofOfApproval", "id-smime-cti-ets-proofOfApproval", NID_id_smime_cti_ets_proofOfApproval, 11, &so[1848]}, {"id-smime-cti-ets-proofOfCreation", "id-smime-cti-ets-proofOfCreation", NID_id_smime_cti_ets_proofOfCreation, 11, &so[1859]}, {"MD4", "md4", NID_md4, 8, &so[1870]}, {"id-pkix-mod", "id-pkix-mod", NID_id_pkix_mod, 7, &so[1878]}, {"id-qt", "id-qt", NID_id_qt, 7, &so[1885]}, {"id-it", "id-it", NID_id_it, 7, &so[1892]}, {"id-pkip", "id-pkip", NID_id_pkip, 7, &so[1899]}, {"id-alg", "id-alg", NID_id_alg, 7, &so[1906]}, {"id-cmc", "id-cmc", NID_id_cmc, 7, &so[1913]}, {"id-on", "id-on", NID_id_on, 7, &so[1920]}, {"id-pda", "id-pda", NID_id_pda, 7, &so[1927]}, {"id-aca", "id-aca", NID_id_aca, 7, &so[1934]}, {"id-qcs", "id-qcs", NID_id_qcs, 7, &so[1941]}, {"id-cct", "id-cct", NID_id_cct, 7, &so[1948]}, {"id-pkix1-explicit-88", "id-pkix1-explicit-88", NID_id_pkix1_explicit_88, 8, &so[1955]}, {"id-pkix1-implicit-88", "id-pkix1-implicit-88", NID_id_pkix1_implicit_88, 8, &so[1963]}, {"id-pkix1-explicit-93", "id-pkix1-explicit-93", NID_id_pkix1_explicit_93, 8, &so[1971]}, {"id-pkix1-implicit-93", "id-pkix1-implicit-93", NID_id_pkix1_implicit_93, 8, &so[1979]}, {"id-mod-crmf", "id-mod-crmf", NID_id_mod_crmf, 8, &so[1987]}, {"id-mod-cmc", "id-mod-cmc", NID_id_mod_cmc, 8, &so[1995]}, {"id-mod-kea-profile-88", "id-mod-kea-profile-88", NID_id_mod_kea_profile_88, 8, &so[2003]}, {"id-mod-kea-profile-93", "id-mod-kea-profile-93", NID_id_mod_kea_profile_93, 8, &so[2011]}, {"id-mod-cmp", "id-mod-cmp", NID_id_mod_cmp, 8, &so[2019]}, {"id-mod-qualified-cert-88", "id-mod-qualified-cert-88", NID_id_mod_qualified_cert_88, 8, &so[2027]}, {"id-mod-qualified-cert-93", "id-mod-qualified-cert-93", NID_id_mod_qualified_cert_93, 8, &so[2035]}, {"id-mod-attribute-cert", "id-mod-attribute-cert", NID_id_mod_attribute_cert, 8, &so[2043]}, {"id-mod-timestamp-protocol", "id-mod-timestamp-protocol", NID_id_mod_timestamp_protocol, 8, &so[2051]}, {"id-mod-ocsp", "id-mod-ocsp", NID_id_mod_ocsp, 8, &so[2059]}, {"id-mod-dvcs", "id-mod-dvcs", NID_id_mod_dvcs, 8, &so[2067]}, {"id-mod-cmp2000", "id-mod-cmp2000", NID_id_mod_cmp2000, 8, &so[2075]}, {"biometricInfo", "Biometric Info", NID_biometricInfo, 8, &so[2083]}, {"qcStatements", "qcStatements", NID_qcStatements, 8, &so[2091]}, {"ac-auditEntity", "ac-auditEntity", NID_ac_auditEntity, 8, &so[2099]}, {"ac-targeting", "ac-targeting", NID_ac_targeting, 8, &so[2107]}, {"aaControls", "aaControls", NID_aaControls, 8, &so[2115]}, {"sbgp-ipAddrBlock", "sbgp-ipAddrBlock", NID_sbgp_ipAddrBlock, 8, &so[2123]}, {"sbgp-autonomousSysNum", "sbgp-autonomousSysNum", NID_sbgp_autonomousSysNum, 8, &so[2131]}, {"sbgp-routerIdentifier", "sbgp-routerIdentifier", NID_sbgp_routerIdentifier, 8, &so[2139]}, {"textNotice", "textNotice", NID_textNotice, 8, &so[2147]}, {"ipsecEndSystem", "IPSec End System", NID_ipsecEndSystem, 8, &so[2155]}, {"ipsecTunnel", "IPSec Tunnel", NID_ipsecTunnel, 8, &so[2163]}, {"ipsecUser", "IPSec User", NID_ipsecUser, 8, &so[2171]}, {"DVCS", "dvcs", NID_dvcs, 8, &so[2179]}, {"id-it-caProtEncCert", "id-it-caProtEncCert", NID_id_it_caProtEncCert, 8, &so[2187]}, {"id-it-signKeyPairTypes", "id-it-signKeyPairTypes", NID_id_it_signKeyPairTypes, 8, &so[2195]}, {"id-it-encKeyPairTypes", "id-it-encKeyPairTypes", NID_id_it_encKeyPairTypes, 8, &so[2203]}, {"id-it-preferredSymmAlg", "id-it-preferredSymmAlg", NID_id_it_preferredSymmAlg, 8, &so[2211]}, {"id-it-caKeyUpdateInfo", "id-it-caKeyUpdateInfo", NID_id_it_caKeyUpdateInfo, 8, &so[2219]}, {"id-it-currentCRL", "id-it-currentCRL", NID_id_it_currentCRL, 8, &so[2227]}, {"id-it-unsupportedOIDs", "id-it-unsupportedOIDs", NID_id_it_unsupportedOIDs, 8, &so[2235]}, {"id-it-subscriptionRequest", "id-it-subscriptionRequest", NID_id_it_subscriptionRequest, 8, &so[2243]}, {"id-it-subscriptionResponse", "id-it-subscriptionResponse", NID_id_it_subscriptionResponse, 8, &so[2251]}, {"id-it-keyPairParamReq", "id-it-keyPairParamReq", NID_id_it_keyPairParamReq, 8, &so[2259]}, {"id-it-keyPairParamRep", "id-it-keyPairParamRep", NID_id_it_keyPairParamRep, 8, &so[2267]}, {"id-it-revPassphrase", "id-it-revPassphrase", NID_id_it_revPassphrase, 8, &so[2275]}, {"id-it-implicitConfirm", "id-it-implicitConfirm", NID_id_it_implicitConfirm, 8, &so[2283]}, {"id-it-confirmWaitTime", "id-it-confirmWaitTime", NID_id_it_confirmWaitTime, 8, &so[2291]}, {"id-it-origPKIMessage", "id-it-origPKIMessage", NID_id_it_origPKIMessage, 8, &so[2299]}, {"id-regCtrl", "id-regCtrl", NID_id_regCtrl, 8, &so[2307]}, {"id-regInfo", "id-regInfo", NID_id_regInfo, 8, &so[2315]}, {"id-regCtrl-regToken", "id-regCtrl-regToken", NID_id_regCtrl_regToken, 9, &so[2323]}, {"id-regCtrl-authenticator", "id-regCtrl-authenticator", NID_id_regCtrl_authenticator, 9, &so[2332]}, {"id-regCtrl-pkiPublicationInfo", "id-regCtrl-pkiPublicationInfo", NID_id_regCtrl_pkiPublicationInfo, 9, &so[2341]}, {"id-regCtrl-pkiArchiveOptions", "id-regCtrl-pkiArchiveOptions", NID_id_regCtrl_pkiArchiveOptions, 9, &so[2350]}, {"id-regCtrl-oldCertID", "id-regCtrl-oldCertID", NID_id_regCtrl_oldCertID, 9, &so[2359]}, {"id-regCtrl-protocolEncrKey", "id-regCtrl-protocolEncrKey", NID_id_regCtrl_protocolEncrKey, 9, &so[2368]}, {"id-regInfo-utf8Pairs", "id-regInfo-utf8Pairs", NID_id_regInfo_utf8Pairs, 9, &so[2377]}, {"id-regInfo-certReq", "id-regInfo-certReq", NID_id_regInfo_certReq, 9, &so[2386]}, {"id-alg-des40", "id-alg-des40", NID_id_alg_des40, 8, &so[2395]}, {"id-alg-noSignature", "id-alg-noSignature", NID_id_alg_noSignature, 8, &so[2403]}, {"id-alg-dh-sig-hmac-sha1", "id-alg-dh-sig-hmac-sha1", NID_id_alg_dh_sig_hmac_sha1, 8, &so[2411]}, {"id-alg-dh-pop", "id-alg-dh-pop", NID_id_alg_dh_pop, 8, &so[2419]}, {"id-cmc-statusInfo", "id-cmc-statusInfo", NID_id_cmc_statusInfo, 8, &so[2427]}, {"id-cmc-identification", "id-cmc-identification", NID_id_cmc_identification, 8, &so[2435]}, {"id-cmc-identityProof", "id-cmc-identityProof", NID_id_cmc_identityProof, 8, &so[2443]}, {"id-cmc-dataReturn", "id-cmc-dataReturn", NID_id_cmc_dataReturn, 8, &so[2451]}, {"id-cmc-transactionId", "id-cmc-transactionId", NID_id_cmc_transactionId, 8, &so[2459]}, {"id-cmc-senderNonce", "id-cmc-senderNonce", NID_id_cmc_senderNonce, 8, &so[2467]}, {"id-cmc-recipientNonce", "id-cmc-recipientNonce", NID_id_cmc_recipientNonce, 8, &so[2475]}, {"id-cmc-addExtensions", "id-cmc-addExtensions", NID_id_cmc_addExtensions, 8, &so[2483]}, {"id-cmc-encryptedPOP", "id-cmc-encryptedPOP", NID_id_cmc_encryptedPOP, 8, &so[2491]}, {"id-cmc-decryptedPOP", "id-cmc-decryptedPOP", NID_id_cmc_decryptedPOP, 8, &so[2499]}, {"id-cmc-lraPOPWitness", "id-cmc-lraPOPWitness", NID_id_cmc_lraPOPWitness, 8, &so[2507]}, {"id-cmc-getCert", "id-cmc-getCert", NID_id_cmc_getCert, 8, &so[2515]}, {"id-cmc-getCRL", "id-cmc-getCRL", NID_id_cmc_getCRL, 8, &so[2523]}, {"id-cmc-revokeRequest", "id-cmc-revokeRequest", NID_id_cmc_revokeRequest, 8, &so[2531]}, {"id-cmc-regInfo", "id-cmc-regInfo", NID_id_cmc_regInfo, 8, &so[2539]}, {"id-cmc-responseInfo", "id-cmc-responseInfo", NID_id_cmc_responseInfo, 8, &so[2547]}, {"id-cmc-queryPending", "id-cmc-queryPending", NID_id_cmc_queryPending, 8, &so[2555]}, {"id-cmc-popLinkRandom", "id-cmc-popLinkRandom", NID_id_cmc_popLinkRandom, 8, &so[2563]}, {"id-cmc-popLinkWitness", "id-cmc-popLinkWitness", NID_id_cmc_popLinkWitness, 8, &so[2571]}, {"id-cmc-confirmCertAcceptance", "id-cmc-confirmCertAcceptance", NID_id_cmc_confirmCertAcceptance, 8, &so[2579]}, {"id-on-personalData", "id-on-personalData", NID_id_on_personalData, 8, &so[2587]}, {"id-pda-dateOfBirth", "id-pda-dateOfBirth", NID_id_pda_dateOfBirth, 8, &so[2595]}, {"id-pda-placeOfBirth", "id-pda-placeOfBirth", NID_id_pda_placeOfBirth, 8, &so[2603]}, { NULL, NULL, NID_undef }, {"id-pda-gender", "id-pda-gender", NID_id_pda_gender, 8, &so[2611]}, {"id-pda-countryOfCitizenship", "id-pda-countryOfCitizenship", NID_id_pda_countryOfCitizenship, 8, &so[2619]}, {"id-pda-countryOfResidence", "id-pda-countryOfResidence", NID_id_pda_countryOfResidence, 8, &so[2627]}, {"id-aca-authenticationInfo", "id-aca-authenticationInfo", NID_id_aca_authenticationInfo, 8, &so[2635]}, {"id-aca-accessIdentity", "id-aca-accessIdentity", NID_id_aca_accessIdentity, 8, &so[2643]}, {"id-aca-chargingIdentity", "id-aca-chargingIdentity", NID_id_aca_chargingIdentity, 8, &so[2651]}, {"id-aca-group", "id-aca-group", NID_id_aca_group, 8, &so[2659]}, {"id-aca-role", "id-aca-role", NID_id_aca_role, 8, &so[2667]}, {"id-qcs-pkixQCSyntax-v1", "id-qcs-pkixQCSyntax-v1", NID_id_qcs_pkixQCSyntax_v1, 8, &so[2675]}, {"id-cct-crs", "id-cct-crs", NID_id_cct_crs, 8, &so[2683]}, {"id-cct-PKIData", "id-cct-PKIData", NID_id_cct_PKIData, 8, &so[2691]}, {"id-cct-PKIResponse", "id-cct-PKIResponse", NID_id_cct_PKIResponse, 8, &so[2699]}, {"ad_timestamping", "AD Time Stamping", NID_ad_timeStamping, 8, &so[2707]}, {"AD_DVCS", "ad dvcs", NID_ad_dvcs, 8, &so[2715]}, {"basicOCSPResponse", "Basic OCSP Response", NID_id_pkix_OCSP_basic, 9, &so[2723]}, {"Nonce", "OCSP Nonce", NID_id_pkix_OCSP_Nonce, 9, &so[2732]}, {"CrlID", "OCSP CRL ID", NID_id_pkix_OCSP_CrlID, 9, &so[2741]}, {"acceptableResponses", "Acceptable OCSP Responses", NID_id_pkix_OCSP_acceptableResponses, 9, &so[2750]}, {"noCheck", "OCSP No Check", NID_id_pkix_OCSP_noCheck, 9, &so[2759]}, {"archiveCutoff", "OCSP Archive Cutoff", NID_id_pkix_OCSP_archiveCutoff, 9, &so[2768]}, {"serviceLocator", "OCSP Service Locator", NID_id_pkix_OCSP_serviceLocator, 9, &so[2777]}, {"extendedStatus", "Extended OCSP Status", NID_id_pkix_OCSP_extendedStatus, 9, &so[2786]}, {"valid", "valid", NID_id_pkix_OCSP_valid, 9, &so[2795]}, {"path", "path", NID_id_pkix_OCSP_path, 9, &so[2804]}, {"trustRoot", "Trust Root", NID_id_pkix_OCSP_trustRoot, 9, &so[2813]}, {"algorithm", "algorithm", NID_algorithm, 4, &so[2822]}, {"rsaSignature", "rsaSignature", NID_rsaSignature, 5, &so[2826]}, {"X500algorithms", "directory services - algorithms", NID_X500algorithms, 2, &so[2831]}, {"ORG", "org", NID_org, 1, &so[2833]}, {"DOD", "dod", NID_dod, 2, &so[2834]}, {"IANA", "iana", NID_iana, 3, &so[2836]}, {"directory", "Directory", NID_Directory, 4, &so[2839]}, {"mgmt", "Management", NID_Management, 4, &so[2843]}, {"experimental", "Experimental", NID_Experimental, 4, &so[2847]}, {"private", "Private", NID_Private, 4, &so[2851]}, {"security", "Security", NID_Security, 4, &so[2855]}, {"snmpv2", "SNMPv2", NID_SNMPv2, 4, &so[2859]}, {"Mail", "Mail", NID_Mail, 4, &so[2863]}, {"enterprises", "Enterprises", NID_Enterprises, 5, &so[2867]}, {"dcobject", "dcObject", NID_dcObject, 9, &so[2872]}, {"DC", "domainComponent", NID_domainComponent, 10, &so[2881]}, {"domain", "Domain", NID_Domain, 10, &so[2891]}, {"NULL", "NULL", NID_joint_iso_ccitt}, {"selected-attribute-types", "Selected Attribute Types", NID_selected_attribute_types, 3, &so[2901]}, {"clearance", "clearance", NID_clearance, 4, &so[2904]}, {"RSA-MD4", "md4WithRSAEncryption", NID_md4WithRSAEncryption, 9, &so[2908]}, {"ac-proxying", "ac-proxying", NID_ac_proxying, 8, &so[2917]}, {"subjectInfoAccess", "Subject Information Access", NID_sinfo_access, 8, &so[2925]}, {"id-aca-encAttrs", "id-aca-encAttrs", NID_id_aca_encAttrs, 8, &so[2933]}, {"role", "role", NID_role, 3, &so[2941]}, {"policyConstraints", "X509v3 Policy Constraints", NID_policy_constraints, 3, &so[2944]}, {"targetInformation", "X509v3 AC Targeting", NID_target_information, 3, &so[2947]}, {"noRevAvail", "X509v3 No Revocation Available", NID_no_rev_avail, 3, &so[2950]}, {"NULL", "NULL", NID_ccitt}, {"ansi-X9-62", "ANSI X9.62", NID_ansi_X9_62, 5, &so[2953]}, {"prime-field", "prime-field", NID_X9_62_prime_field, 7, &so[2958]}, {"characteristic-two-field", "characteristic-two-field", NID_X9_62_characteristic_two_field, 7, &so[2965]}, {"id-ecPublicKey", "id-ecPublicKey", NID_X9_62_id_ecPublicKey, 7, &so[2972]}, {"prime192v1", "prime192v1", NID_X9_62_prime192v1, 8, &so[2979]}, {"prime192v2", "prime192v2", NID_X9_62_prime192v2, 8, &so[2987]}, {"prime192v3", "prime192v3", NID_X9_62_prime192v3, 8, &so[2995]}, {"prime239v1", "prime239v1", NID_X9_62_prime239v1, 8, &so[3003]}, {"prime239v2", "prime239v2", NID_X9_62_prime239v2, 8, &so[3011]}, {"prime239v3", "prime239v3", NID_X9_62_prime239v3, 8, &so[3019]}, {"prime256v1", "prime256v1", NID_X9_62_prime256v1, 8, &so[3027]}, {"ecdsa-with-SHA1", "ecdsa-with-SHA1", NID_ecdsa_with_SHA1, 7, &so[3035]}, {"CSPName", "Microsoft CSP Name", NID_ms_csp_name, 9, &so[3042]}, {"AES-128-ECB", "aes-128-ecb", NID_aes_128_ecb, 9, &so[3051]}, {"AES-128-CBC", "aes-128-cbc", NID_aes_128_cbc, 9, &so[3060]}, {"AES-128-OFB", "aes-128-ofb", NID_aes_128_ofb128, 9, &so[3069]}, {"AES-128-CFB", "aes-128-cfb", NID_aes_128_cfb128, 9, &so[3078]}, {"AES-192-ECB", "aes-192-ecb", NID_aes_192_ecb, 9, &so[3087]}, {"AES-192-CBC", "aes-192-cbc", NID_aes_192_cbc, 9, &so[3096]}, {"AES-192-OFB", "aes-192-ofb", NID_aes_192_ofb128, 9, &so[3105]}, {"AES-192-CFB", "aes-192-cfb", NID_aes_192_cfb128, 9, &so[3114]}, {"AES-256-ECB", "aes-256-ecb", NID_aes_256_ecb, 9, &so[3123]}, {"AES-256-CBC", "aes-256-cbc", NID_aes_256_cbc, 9, &so[3132]}, {"AES-256-OFB", "aes-256-ofb", NID_aes_256_ofb128, 9, &so[3141]}, {"AES-256-CFB", "aes-256-cfb", NID_aes_256_cfb128, 9, &so[3150]}, {"holdInstructionCode", "Hold Instruction Code", NID_hold_instruction_code, 3, &so[3159]}, {"holdInstructionNone", "Hold Instruction None", NID_hold_instruction_none, 7, &so[3162]}, {"holdInstructionCallIssuer", "Hold Instruction Call Issuer", NID_hold_instruction_call_issuer, 7, &so[3169]}, {"holdInstructionReject", "Hold Instruction Reject", NID_hold_instruction_reject, 7, &so[3176]}, {"data", "data", NID_data, 1, &so[3183]}, {"pss", "pss", NID_pss, 3, &so[3184]}, {"ucl", "ucl", NID_ucl, 7, &so[3187]}, {"pilot", "pilot", NID_pilot, 8, &so[3194]}, {"pilotAttributeType", "pilotAttributeType", NID_pilotAttributeType, 9, &so[3202]}, {"pilotAttributeSyntax", "pilotAttributeSyntax", NID_pilotAttributeSyntax, 9, &so[3211]}, {"pilotObjectClass", "pilotObjectClass", NID_pilotObjectClass, 9, &so[3220]}, {"pilotGroups", "pilotGroups", NID_pilotGroups, 9, &so[3229]}, {"iA5StringSyntax", "iA5StringSyntax", NID_iA5StringSyntax, 10, &so[3238]}, {"caseIgnoreIA5StringSyntax", "caseIgnoreIA5StringSyntax", NID_caseIgnoreIA5StringSyntax, 10, &so[3248]}, {"pilotObject", "pilotObject", NID_pilotObject, 10, &so[3258]}, {"pilotPerson", "pilotPerson", NID_pilotPerson, 10, &so[3268]}, {"account", "account", NID_account, 10, &so[3278]}, {"document", "document", NID_document, 10, &so[3288]}, {"room", "room", NID_room, 10, &so[3298]}, {"documentSeries", "documentSeries", NID_documentSeries, 10, &so[3308]}, {"rFC822localPart", "rFC822localPart", NID_rFC822localPart, 10, &so[3318]}, {"dNSDomain", "dNSDomain", NID_dNSDomain, 10, &so[3328]}, {"domainRelatedObject", "domainRelatedObject", NID_domainRelatedObject, 10, &so[3338]}, {"friendlyCountry", "friendlyCountry", NID_friendlyCountry, 10, &so[3348]}, {"simpleSecurityObject", "simpleSecurityObject", NID_simpleSecurityObject, 10, &so[3358]}, {"pilotOrganization", "pilotOrganization", NID_pilotOrganization, 10, &so[3368]}, {"pilotDSA", "pilotDSA", NID_pilotDSA, 10, &so[3378]}, {"qualityLabelledData", "qualityLabelledData", NID_qualityLabelledData, 10, &so[3388]}, {"UID", "userId", NID_userId, 10, &so[3398]}, {"textEncodedORAddress", "textEncodedORAddress", NID_textEncodedORAddress, 10, &so[3408]}, {"mail", "rfc822Mailbox", NID_rfc822Mailbox, 10, &so[3418]}, {"info", "info", NID_info, 10, &so[3428]}, {"favouriteDrink", "favouriteDrink", NID_favouriteDrink, 10, &so[3438]}, {"roomNumber", "roomNumber", NID_roomNumber, 10, &so[3448]}, {"photo", "photo", NID_photo, 10, &so[3458]}, {"userClass", "userClass", NID_userClass, 10, &so[3468]}, {"host", "host", NID_host, 10, &so[3478]}, {"manager", "manager", NID_manager, 10, &so[3488]}, {"documentIdentifier", "documentIdentifier", NID_documentIdentifier, 10, &so[3498]}, {"documentTitle", "documentTitle", NID_documentTitle, 10, &so[3508]}, {"documentVersion", "documentVersion", NID_documentVersion, 10, &so[3518]}, {"documentAuthor", "documentAuthor", NID_documentAuthor, 10, &so[3528]}, {"documentLocation", "documentLocation", NID_documentLocation, 10, &so[3538]}, {"homeTelephoneNumber", "homeTelephoneNumber", NID_homeTelephoneNumber, 10, &so[3548]}, {"secretary", "secretary", NID_secretary, 10, &so[3558]}, {"otherMailbox", "otherMailbox", NID_otherMailbox, 10, &so[3568]}, {"lastModifiedTime", "lastModifiedTime", NID_lastModifiedTime, 10, &so[3578]}, {"lastModifiedBy", "lastModifiedBy", NID_lastModifiedBy, 10, &so[3588]}, {"aRecord", "aRecord", NID_aRecord, 10, &so[3598]}, {"pilotAttributeType27", "pilotAttributeType27", NID_pilotAttributeType27, 10, &so[3608]}, {"mXRecord", "mXRecord", NID_mXRecord, 10, &so[3618]}, {"nSRecord", "nSRecord", NID_nSRecord, 10, &so[3628]}, {"sOARecord", "sOARecord", NID_sOARecord, 10, &so[3638]}, {"cNAMERecord", "cNAMERecord", NID_cNAMERecord, 10, &so[3648]}, {"associatedDomain", "associatedDomain", NID_associatedDomain, 10, &so[3658]}, {"associatedName", "associatedName", NID_associatedName, 10, &so[3668]}, {"homePostalAddress", "homePostalAddress", NID_homePostalAddress, 10, &so[3678]}, {"personalTitle", "personalTitle", NID_personalTitle, 10, &so[3688]}, {"mobileTelephoneNumber", "mobileTelephoneNumber", NID_mobileTelephoneNumber, 10, &so[3698]}, {"pagerTelephoneNumber", "pagerTelephoneNumber", NID_pagerTelephoneNumber, 10, &so[3708]}, {"friendlyCountryName", "friendlyCountryName", NID_friendlyCountryName, 10, &so[3718]}, {"organizationalStatus", "organizationalStatus", NID_organizationalStatus, 10, &so[3728]}, {"janetMailbox", "janetMailbox", NID_janetMailbox, 10, &so[3738]}, {"mailPreferenceOption", "mailPreferenceOption", NID_mailPreferenceOption, 10, &so[3748]}, {"buildingName", "buildingName", NID_buildingName, 10, &so[3758]}, {"dSAQuality", "dSAQuality", NID_dSAQuality, 10, &so[3768]}, {"singleLevelQuality", "singleLevelQuality", NID_singleLevelQuality, 10, &so[3778]}, {"subtreeMinimumQuality", "subtreeMinimumQuality", NID_subtreeMinimumQuality, 10, &so[3788]}, {"subtreeMaximumQuality", "subtreeMaximumQuality", NID_subtreeMaximumQuality, 10, &so[3798]}, {"personalSignature", "personalSignature", NID_personalSignature, 10, &so[3808]}, {"dITRedirect", "dITRedirect", NID_dITRedirect, 10, &so[3818]}, {"audio", "audio", NID_audio, 10, &so[3828]}, {"documentPublisher", "documentPublisher", NID_documentPublisher, 10, &so[3838]}, {"x500UniqueIdentifier", "x500UniqueIdentifier", NID_x500UniqueIdentifier, 3, &so[3848]}, {"mime-mhs", "MIME MHS", NID_mime_mhs, 5, &so[3851]}, {"mime-mhs-headings", "mime-mhs-headings", NID_mime_mhs_headings, 6, &so[3856]}, {"mime-mhs-bodies", "mime-mhs-bodies", NID_mime_mhs_bodies, 6, &so[3862]}, {"id-hex-partial-message", "id-hex-partial-message", NID_id_hex_partial_message, 7, &so[3868]}, {"id-hex-multipart-message", "id-hex-multipart-message", NID_id_hex_multipart_message, 7, &so[3875]}, {"generationQualifier", "generationQualifier", NID_generationQualifier, 3, &so[3882]}, {"pseudonym", "pseudonym", NID_pseudonym, 3, &so[3885]}, { NULL, NULL, NID_undef }, {"id-set", "Secure Electronic Transactions", NID_id_set, 2, &so[3888]}, {"set-ctype", "content types", NID_set_ctype, 3, &so[3890]}, {"set-msgExt", "message extensions", NID_set_msgExt, 3, &so[3893]}, {"set-attr", "set-attr", NID_set_attr, 3, &so[3896]}, {"set-policy", "set-policy", NID_set_policy, 3, &so[3899]}, {"set-certExt", "certificate extensions", NID_set_certExt, 3, &so[3902]}, {"set-brand", "set-brand", NID_set_brand, 3, &so[3905]}, {"setct-PANData", "setct-PANData", NID_setct_PANData, 4, &so[3908]}, {"setct-PANToken", "setct-PANToken", NID_setct_PANToken, 4, &so[3912]}, {"setct-PANOnly", "setct-PANOnly", NID_setct_PANOnly, 4, &so[3916]}, {"setct-OIData", "setct-OIData", NID_setct_OIData, 4, &so[3920]}, {"setct-PI", "setct-PI", NID_setct_PI, 4, &so[3924]}, {"setct-PIData", "setct-PIData", NID_setct_PIData, 4, &so[3928]}, {"setct-PIDataUnsigned", "setct-PIDataUnsigned", NID_setct_PIDataUnsigned, 4, &so[3932]}, {"setct-HODInput", "setct-HODInput", NID_setct_HODInput, 4, &so[3936]}, {"setct-AuthResBaggage", "setct-AuthResBaggage", NID_setct_AuthResBaggage, 4, &so[3940]}, {"setct-AuthRevReqBaggage", "setct-AuthRevReqBaggage", NID_setct_AuthRevReqBaggage, 4, &so[3944]}, {"setct-AuthRevResBaggage", "setct-AuthRevResBaggage", NID_setct_AuthRevResBaggage, 4, &so[3948]}, {"setct-CapTokenSeq", "setct-CapTokenSeq", NID_setct_CapTokenSeq, 4, &so[3952]}, {"setct-PInitResData", "setct-PInitResData", NID_setct_PInitResData, 4, &so[3956]}, {"setct-PI-TBS", "setct-PI-TBS", NID_setct_PI_TBS, 4, &so[3960]}, {"setct-PResData", "setct-PResData", NID_setct_PResData, 4, &so[3964]}, {"setct-AuthReqTBS", "setct-AuthReqTBS", NID_setct_AuthReqTBS, 4, &so[3968]}, {"setct-AuthResTBS", "setct-AuthResTBS", NID_setct_AuthResTBS, 4, &so[3972]}, {"setct-AuthResTBSX", "setct-AuthResTBSX", NID_setct_AuthResTBSX, 4, &so[3976]}, {"setct-AuthTokenTBS", "setct-AuthTokenTBS", NID_setct_AuthTokenTBS, 4, &so[3980]}, {"setct-CapTokenData", "setct-CapTokenData", NID_setct_CapTokenData, 4, &so[3984]}, {"setct-CapTokenTBS", "setct-CapTokenTBS", NID_setct_CapTokenTBS, 4, &so[3988]}, {"setct-AcqCardCodeMsg", "setct-AcqCardCodeMsg", NID_setct_AcqCardCodeMsg, 4, &so[3992]}, {"setct-AuthRevReqTBS", "setct-AuthRevReqTBS", NID_setct_AuthRevReqTBS, 4, &so[3996]}, {"setct-AuthRevResData", "setct-AuthRevResData", NID_setct_AuthRevResData, 4, &so[4000]}, {"setct-AuthRevResTBS", "setct-AuthRevResTBS", NID_setct_AuthRevResTBS, 4, &so[4004]}, {"setct-CapReqTBS", "setct-CapReqTBS", NID_setct_CapReqTBS, 4, &so[4008]}, {"setct-CapReqTBSX", "setct-CapReqTBSX", NID_setct_CapReqTBSX, 4, &so[4012]}, {"setct-CapResData", "setct-CapResData", NID_setct_CapResData, 4, &so[4016]}, {"setct-CapRevReqTBS", "setct-CapRevReqTBS", NID_setct_CapRevReqTBS, 4, &so[4020]}, {"setct-CapRevReqTBSX", "setct-CapRevReqTBSX", NID_setct_CapRevReqTBSX, 4, &so[4024]}, {"setct-CapRevResData", "setct-CapRevResData", NID_setct_CapRevResData, 4, &so[4028]}, {"setct-CredReqTBS", "setct-CredReqTBS", NID_setct_CredReqTBS, 4, &so[4032]}, {"setct-CredReqTBSX", "setct-CredReqTBSX", NID_setct_CredReqTBSX, 4, &so[4036]}, {"setct-CredResData", "setct-CredResData", NID_setct_CredResData, 4, &so[4040]}, {"setct-CredRevReqTBS", "setct-CredRevReqTBS", NID_setct_CredRevReqTBS, 4, &so[4044]}, {"setct-CredRevReqTBSX", "setct-CredRevReqTBSX", NID_setct_CredRevReqTBSX, 4, &so[4048]}, {"setct-CredRevResData", "setct-CredRevResData", NID_setct_CredRevResData, 4, &so[4052]}, {"setct-PCertReqData", "setct-PCertReqData", NID_setct_PCertReqData, 4, &so[4056]}, {"setct-PCertResTBS", "setct-PCertResTBS", NID_setct_PCertResTBS, 4, &so[4060]}, {"setct-BatchAdminReqData", "setct-BatchAdminReqData", NID_setct_BatchAdminReqData, 4, &so[4064]}, {"setct-BatchAdminResData", "setct-BatchAdminResData", NID_setct_BatchAdminResData, 4, &so[4068]}, {"setct-CardCInitResTBS", "setct-CardCInitResTBS", NID_setct_CardCInitResTBS, 4, &so[4072]}, {"setct-MeAqCInitResTBS", "setct-MeAqCInitResTBS", NID_setct_MeAqCInitResTBS, 4, &so[4076]}, {"setct-RegFormResTBS", "setct-RegFormResTBS", NID_setct_RegFormResTBS, 4, &so[4080]}, {"setct-CertReqData", "setct-CertReqData", NID_setct_CertReqData, 4, &so[4084]}, {"setct-CertReqTBS", "setct-CertReqTBS", NID_setct_CertReqTBS, 4, &so[4088]}, {"setct-CertResData", "setct-CertResData", NID_setct_CertResData, 4, &so[4092]}, {"setct-CertInqReqTBS", "setct-CertInqReqTBS", NID_setct_CertInqReqTBS, 4, &so[4096]}, {"setct-ErrorTBS", "setct-ErrorTBS", NID_setct_ErrorTBS, 4, &so[4100]}, {"setct-PIDualSignedTBE", "setct-PIDualSignedTBE", NID_setct_PIDualSignedTBE, 4, &so[4104]}, {"setct-PIUnsignedTBE", "setct-PIUnsignedTBE", NID_setct_PIUnsignedTBE, 4, &so[4108]}, {"setct-AuthReqTBE", "setct-AuthReqTBE", NID_setct_AuthReqTBE, 4, &so[4112]}, {"setct-AuthResTBE", "setct-AuthResTBE", NID_setct_AuthResTBE, 4, &so[4116]}, {"setct-AuthResTBEX", "setct-AuthResTBEX", NID_setct_AuthResTBEX, 4, &so[4120]}, {"setct-AuthTokenTBE", "setct-AuthTokenTBE", NID_setct_AuthTokenTBE, 4, &so[4124]}, {"setct-CapTokenTBE", "setct-CapTokenTBE", NID_setct_CapTokenTBE, 4, &so[4128]}, {"setct-CapTokenTBEX", "setct-CapTokenTBEX", NID_setct_CapTokenTBEX, 4, &so[4132]}, {"setct-AcqCardCodeMsgTBE", "setct-AcqCardCodeMsgTBE", NID_setct_AcqCardCodeMsgTBE, 4, &so[4136]}, {"setct-AuthRevReqTBE", "setct-AuthRevReqTBE", NID_setct_AuthRevReqTBE, 4, &so[4140]}, {"setct-AuthRevResTBE", "setct-AuthRevResTBE", NID_setct_AuthRevResTBE, 4, &so[4144]}, {"setct-AuthRevResTBEB", "setct-AuthRevResTBEB", NID_setct_AuthRevResTBEB, 4, &so[4148]}, {"setct-CapReqTBE", "setct-CapReqTBE", NID_setct_CapReqTBE, 4, &so[4152]}, {"setct-CapReqTBEX", "setct-CapReqTBEX", NID_setct_CapReqTBEX, 4, &so[4156]}, {"setct-CapResTBE", "setct-CapResTBE", NID_setct_CapResTBE, 4, &so[4160]}, {"setct-CapRevReqTBE", "setct-CapRevReqTBE", NID_setct_CapRevReqTBE, 4, &so[4164]}, {"setct-CapRevReqTBEX", "setct-CapRevReqTBEX", NID_setct_CapRevReqTBEX, 4, &so[4168]}, {"setct-CapRevResTBE", "setct-CapRevResTBE", NID_setct_CapRevResTBE, 4, &so[4172]}, {"setct-CredReqTBE", "setct-CredReqTBE", NID_setct_CredReqTBE, 4, &so[4176]}, {"setct-CredReqTBEX", "setct-CredReqTBEX", NID_setct_CredReqTBEX, 4, &so[4180]}, {"setct-CredResTBE", "setct-CredResTBE", NID_setct_CredResTBE, 4, &so[4184]}, {"setct-CredRevReqTBE", "setct-CredRevReqTBE", NID_setct_CredRevReqTBE, 4, &so[4188]}, {"setct-CredRevReqTBEX", "setct-CredRevReqTBEX", NID_setct_CredRevReqTBEX, 4, &so[4192]}, {"setct-CredRevResTBE", "setct-CredRevResTBE", NID_setct_CredRevResTBE, 4, &so[4196]}, {"setct-BatchAdminReqTBE", "setct-BatchAdminReqTBE", NID_setct_BatchAdminReqTBE, 4, &so[4200]}, {"setct-BatchAdminResTBE", "setct-BatchAdminResTBE", NID_setct_BatchAdminResTBE, 4, &so[4204]}, {"setct-RegFormReqTBE", "setct-RegFormReqTBE", NID_setct_RegFormReqTBE, 4, &so[4208]}, {"setct-CertReqTBE", "setct-CertReqTBE", NID_setct_CertReqTBE, 4, &so[4212]}, {"setct-CertReqTBEX", "setct-CertReqTBEX", NID_setct_CertReqTBEX, 4, &so[4216]}, {"setct-CertResTBE", "setct-CertResTBE", NID_setct_CertResTBE, 4, &so[4220]}, {"setct-CRLNotificationTBS", "setct-CRLNotificationTBS", NID_setct_CRLNotificationTBS, 4, &so[4224]}, {"setct-CRLNotificationResTBS", "setct-CRLNotificationResTBS", NID_setct_CRLNotificationResTBS, 4, &so[4228]}, {"setct-BCIDistributionTBS", "setct-BCIDistributionTBS", NID_setct_BCIDistributionTBS, 4, &so[4232]}, {"setext-genCrypt", "generic cryptogram", NID_setext_genCrypt, 4, &so[4236]}, {"setext-miAuth", "merchant initiated auth", NID_setext_miAuth, 4, &so[4240]}, {"setext-pinSecure", "setext-pinSecure", NID_setext_pinSecure, 4, &so[4244]}, {"setext-pinAny", "setext-pinAny", NID_setext_pinAny, 4, &so[4248]}, {"setext-track2", "setext-track2", NID_setext_track2, 4, &so[4252]}, {"setext-cv", "additional verification", NID_setext_cv, 4, &so[4256]}, {"set-policy-root", "set-policy-root", NID_set_policy_root, 4, &so[4260]}, {"setCext-hashedRoot", "setCext-hashedRoot", NID_setCext_hashedRoot, 4, &so[4264]}, {"setCext-certType", "setCext-certType", NID_setCext_certType, 4, &so[4268]}, {"setCext-merchData", "setCext-merchData", NID_setCext_merchData, 4, &so[4272]}, {"setCext-cCertRequired", "setCext-cCertRequired", NID_setCext_cCertRequired, 4, &so[4276]}, {"setCext-tunneling", "setCext-tunneling", NID_setCext_tunneling, 4, &so[4280]}, {"setCext-setExt", "setCext-setExt", NID_setCext_setExt, 4, &so[4284]}, {"setCext-setQualf", "setCext-setQualf", NID_setCext_setQualf, 4, &so[4288]}, {"setCext-PGWYcapabilities", "setCext-PGWYcapabilities", NID_setCext_PGWYcapabilities, 4, &so[4292]}, {"setCext-TokenIdentifier", "setCext-TokenIdentifier", NID_setCext_TokenIdentifier, 4, &so[4296]}, {"setCext-Track2Data", "setCext-Track2Data", NID_setCext_Track2Data, 4, &so[4300]}, {"setCext-TokenType", "setCext-TokenType", NID_setCext_TokenType, 4, &so[4304]}, {"setCext-IssuerCapabilities", "setCext-IssuerCapabilities", NID_setCext_IssuerCapabilities, 4, &so[4308]}, {"setAttr-Cert", "setAttr-Cert", NID_setAttr_Cert, 4, &so[4312]}, {"setAttr-PGWYcap", "payment gateway capabilities", NID_setAttr_PGWYcap, 4, &so[4316]}, {"setAttr-TokenType", "setAttr-TokenType", NID_setAttr_TokenType, 4, &so[4320]}, {"setAttr-IssCap", "issuer capabilities", NID_setAttr_IssCap, 4, &so[4324]}, {"set-rootKeyThumb", "set-rootKeyThumb", NID_set_rootKeyThumb, 5, &so[4328]}, {"set-addPolicy", "set-addPolicy", NID_set_addPolicy, 5, &so[4333]}, {"setAttr-Token-EMV", "setAttr-Token-EMV", NID_setAttr_Token_EMV, 5, &so[4338]}, {"setAttr-Token-B0Prime", "setAttr-Token-B0Prime", NID_setAttr_Token_B0Prime, 5, &so[4343]}, {"setAttr-IssCap-CVM", "setAttr-IssCap-CVM", NID_setAttr_IssCap_CVM, 5, &so[4348]}, {"setAttr-IssCap-T2", "setAttr-IssCap-T2", NID_setAttr_IssCap_T2, 5, &so[4353]}, {"setAttr-IssCap-Sig", "setAttr-IssCap-Sig", NID_setAttr_IssCap_Sig, 5, &so[4358]}, {"setAttr-GenCryptgrm", "generate cryptogram", NID_setAttr_GenCryptgrm, 6, &so[4363]}, {"setAttr-T2Enc", "encrypted track 2", NID_setAttr_T2Enc, 6, &so[4369]}, {"setAttr-T2cleartxt", "cleartext track 2", NID_setAttr_T2cleartxt, 6, &so[4375]}, {"setAttr-TokICCsig", "ICC or token signature", NID_setAttr_TokICCsig, 6, &so[4381]}, {"setAttr-SecDevSig", "secure device signature", NID_setAttr_SecDevSig, 6, &so[4387]}, {"set-brand-IATA-ATA", "set-brand-IATA-ATA", NID_set_brand_IATA_ATA, 4, &so[4393]}, {"set-brand-Diners", "set-brand-Diners", NID_set_brand_Diners, 4, &so[4397]}, {"set-brand-AmericanExpress", "set-brand-AmericanExpress", NID_set_brand_AmericanExpress, 4, &so[4401]}, {"set-brand-JCB", "set-brand-JCB", NID_set_brand_JCB, 4, &so[4405]}, {"set-brand-Visa", "set-brand-Visa", NID_set_brand_Visa, 4, &so[4409]}, {"set-brand-MasterCard", "set-brand-MasterCard", NID_set_brand_MasterCard, 4, &so[4413]}, {"set-brand-Novus", "set-brand-Novus", NID_set_brand_Novus, 5, &so[4417]}, {"DES-CDMF", "des-cdmf", NID_des_cdmf, 8, &so[4422]}, {"rsaOAEPEncryptionSET", "rsaOAEPEncryptionSET", NID_rsaOAEPEncryptionSET, 9, &so[4430]}, {"ITU-T", "itu-t", NID_itu_t}, {"JOINT-ISO-ITU-T", "joint-iso-itu-t", NID_joint_iso_itu_t}, {"international-organizations", "International Organizations", NID_international_organizations, 1, &so[4439]}, {"msSmartcardLogin", "Microsoft Smartcard Login", NID_ms_smartcard_login, 10, &so[4440]}, {"msUPN", "Microsoft User Principal Name", NID_ms_upn, 10, &so[4450]}, {"AES-128-CFB1", "aes-128-cfb1", NID_aes_128_cfb1}, {"AES-192-CFB1", "aes-192-cfb1", NID_aes_192_cfb1}, {"AES-256-CFB1", "aes-256-cfb1", NID_aes_256_cfb1}, {"AES-128-CFB8", "aes-128-cfb8", NID_aes_128_cfb8}, {"AES-192-CFB8", "aes-192-cfb8", NID_aes_192_cfb8}, {"AES-256-CFB8", "aes-256-cfb8", NID_aes_256_cfb8}, {"DES-CFB1", "des-cfb1", NID_des_cfb1}, {"DES-CFB8", "des-cfb8", NID_des_cfb8}, {"DES-EDE3-CFB1", "des-ede3-cfb1", NID_des_ede3_cfb1}, {"DES-EDE3-CFB8", "des-ede3-cfb8", NID_des_ede3_cfb8}, {"street", "streetAddress", NID_streetAddress, 3, &so[4460]}, {"postalCode", "postalCode", NID_postalCode, 3, &so[4463]}, {"id-ppl", "id-ppl", NID_id_ppl, 7, &so[4466]}, {"proxyCertInfo", "Proxy Certificate Information", NID_proxyCertInfo, 8, &so[4473]}, {"id-ppl-anyLanguage", "Any language", NID_id_ppl_anyLanguage, 8, &so[4481]}, {"id-ppl-inheritAll", "Inherit all", NID_id_ppl_inheritAll, 8, &so[4489]}, {"nameConstraints", "X509v3 Name Constraints", NID_name_constraints, 3, &so[4497]}, {"id-ppl-independent", "Independent", NID_Independent, 8, &so[4500]}, {"RSA-SHA256", "sha256WithRSAEncryption", NID_sha256WithRSAEncryption, 9, &so[4508]}, {"RSA-SHA384", "sha384WithRSAEncryption", NID_sha384WithRSAEncryption, 9, &so[4517]}, {"RSA-SHA512", "sha512WithRSAEncryption", NID_sha512WithRSAEncryption, 9, &so[4526]}, {"RSA-SHA224", "sha224WithRSAEncryption", NID_sha224WithRSAEncryption, 9, &so[4535]}, {"SHA256", "sha256", NID_sha256, 9, &so[4544]}, {"SHA384", "sha384", NID_sha384, 9, &so[4553]}, {"SHA512", "sha512", NID_sha512, 9, &so[4562]}, {"SHA224", "sha224", NID_sha224, 9, &so[4571]}, {"identified-organization", "identified-organization", NID_identified_organization, 1, &so[4580]}, {"certicom-arc", "certicom-arc", NID_certicom_arc, 3, &so[4581]}, {"wap", "wap", NID_wap, 2, &so[4584]}, {"wap-wsg", "wap-wsg", NID_wap_wsg, 3, &so[4586]}, {"id-characteristic-two-basis", "id-characteristic-two-basis", NID_X9_62_id_characteristic_two_basis, 8, &so[4589]}, {"onBasis", "onBasis", NID_X9_62_onBasis, 9, &so[4597]}, {"tpBasis", "tpBasis", NID_X9_62_tpBasis, 9, &so[4606]}, {"ppBasis", "ppBasis", NID_X9_62_ppBasis, 9, &so[4615]}, {"c2pnb163v1", "c2pnb163v1", NID_X9_62_c2pnb163v1, 8, &so[4624]}, {"c2pnb163v2", "c2pnb163v2", NID_X9_62_c2pnb163v2, 8, &so[4632]}, {"c2pnb163v3", "c2pnb163v3", NID_X9_62_c2pnb163v3, 8, &so[4640]}, {"c2pnb176v1", "c2pnb176v1", NID_X9_62_c2pnb176v1, 8, &so[4648]}, {"c2tnb191v1", "c2tnb191v1", NID_X9_62_c2tnb191v1, 8, &so[4656]}, {"c2tnb191v2", "c2tnb191v2", NID_X9_62_c2tnb191v2, 8, &so[4664]}, {"c2tnb191v3", "c2tnb191v3", NID_X9_62_c2tnb191v3, 8, &so[4672]}, {"c2onb191v4", "c2onb191v4", NID_X9_62_c2onb191v4, 8, &so[4680]}, {"c2onb191v5", "c2onb191v5", NID_X9_62_c2onb191v5, 8, &so[4688]}, {"c2pnb208w1", "c2pnb208w1", NID_X9_62_c2pnb208w1, 8, &so[4696]}, {"c2tnb239v1", "c2tnb239v1", NID_X9_62_c2tnb239v1, 8, &so[4704]}, {"c2tnb239v2", "c2tnb239v2", NID_X9_62_c2tnb239v2, 8, &so[4712]}, {"c2tnb239v3", "c2tnb239v3", NID_X9_62_c2tnb239v3, 8, &so[4720]}, {"c2onb239v4", "c2onb239v4", NID_X9_62_c2onb239v4, 8, &so[4728]}, {"c2onb239v5", "c2onb239v5", NID_X9_62_c2onb239v5, 8, &so[4736]}, {"c2pnb272w1", "c2pnb272w1", NID_X9_62_c2pnb272w1, 8, &so[4744]}, {"c2pnb304w1", "c2pnb304w1", NID_X9_62_c2pnb304w1, 8, &so[4752]}, {"c2tnb359v1", "c2tnb359v1", NID_X9_62_c2tnb359v1, 8, &so[4760]}, {"c2pnb368w1", "c2pnb368w1", NID_X9_62_c2pnb368w1, 8, &so[4768]}, {"c2tnb431r1", "c2tnb431r1", NID_X9_62_c2tnb431r1, 8, &so[4776]}, {"secp112r1", "secp112r1", NID_secp112r1, 5, &so[4784]}, {"secp112r2", "secp112r2", NID_secp112r2, 5, &so[4789]}, {"secp128r1", "secp128r1", NID_secp128r1, 5, &so[4794]}, {"secp128r2", "secp128r2", NID_secp128r2, 5, &so[4799]}, {"secp160k1", "secp160k1", NID_secp160k1, 5, &so[4804]}, {"secp160r1", "secp160r1", NID_secp160r1, 5, &so[4809]}, {"secp160r2", "secp160r2", NID_secp160r2, 5, &so[4814]}, {"secp192k1", "secp192k1", NID_secp192k1, 5, &so[4819]}, {"secp224k1", "secp224k1", NID_secp224k1, 5, &so[4824]}, {"secp224r1", "secp224r1", NID_secp224r1, 5, &so[4829]}, {"secp256k1", "secp256k1", NID_secp256k1, 5, &so[4834]}, {"secp384r1", "secp384r1", NID_secp384r1, 5, &so[4839]}, {"secp521r1", "secp521r1", NID_secp521r1, 5, &so[4844]}, {"sect113r1", "sect113r1", NID_sect113r1, 5, &so[4849]}, {"sect113r2", "sect113r2", NID_sect113r2, 5, &so[4854]}, {"sect131r1", "sect131r1", NID_sect131r1, 5, &so[4859]}, {"sect131r2", "sect131r2", NID_sect131r2, 5, &so[4864]}, {"sect163k1", "sect163k1", NID_sect163k1, 5, &so[4869]}, {"sect163r1", "sect163r1", NID_sect163r1, 5, &so[4874]}, {"sect163r2", "sect163r2", NID_sect163r2, 5, &so[4879]}, {"sect193r1", "sect193r1", NID_sect193r1, 5, &so[4884]}, {"sect193r2", "sect193r2", NID_sect193r2, 5, &so[4889]}, {"sect233k1", "sect233k1", NID_sect233k1, 5, &so[4894]}, {"sect233r1", "sect233r1", NID_sect233r1, 5, &so[4899]}, {"sect239k1", "sect239k1", NID_sect239k1, 5, &so[4904]}, {"sect283k1", "sect283k1", NID_sect283k1, 5, &so[4909]}, {"sect283r1", "sect283r1", NID_sect283r1, 5, &so[4914]}, {"sect409k1", "sect409k1", NID_sect409k1, 5, &so[4919]}, {"sect409r1", "sect409r1", NID_sect409r1, 5, &so[4924]}, {"sect571k1", "sect571k1", NID_sect571k1, 5, &so[4929]}, {"sect571r1", "sect571r1", NID_sect571r1, 5, &so[4934]}, {"wap-wsg-idm-ecid-wtls1", "wap-wsg-idm-ecid-wtls1", NID_wap_wsg_idm_ecid_wtls1, 5, &so[4939]}, {"wap-wsg-idm-ecid-wtls3", "wap-wsg-idm-ecid-wtls3", NID_wap_wsg_idm_ecid_wtls3, 5, &so[4944]}, {"wap-wsg-idm-ecid-wtls4", "wap-wsg-idm-ecid-wtls4", NID_wap_wsg_idm_ecid_wtls4, 5, &so[4949]}, {"wap-wsg-idm-ecid-wtls5", "wap-wsg-idm-ecid-wtls5", NID_wap_wsg_idm_ecid_wtls5, 5, &so[4954]}, {"wap-wsg-idm-ecid-wtls6", "wap-wsg-idm-ecid-wtls6", NID_wap_wsg_idm_ecid_wtls6, 5, &so[4959]}, {"wap-wsg-idm-ecid-wtls7", "wap-wsg-idm-ecid-wtls7", NID_wap_wsg_idm_ecid_wtls7, 5, &so[4964]}, {"wap-wsg-idm-ecid-wtls8", "wap-wsg-idm-ecid-wtls8", NID_wap_wsg_idm_ecid_wtls8, 5, &so[4969]}, {"wap-wsg-idm-ecid-wtls9", "wap-wsg-idm-ecid-wtls9", NID_wap_wsg_idm_ecid_wtls9, 5, &so[4974]}, {"wap-wsg-idm-ecid-wtls10", "wap-wsg-idm-ecid-wtls10", NID_wap_wsg_idm_ecid_wtls10, 5, &so[4979]}, {"wap-wsg-idm-ecid-wtls11", "wap-wsg-idm-ecid-wtls11", NID_wap_wsg_idm_ecid_wtls11, 5, &so[4984]}, {"wap-wsg-idm-ecid-wtls12", "wap-wsg-idm-ecid-wtls12", NID_wap_wsg_idm_ecid_wtls12, 5, &so[4989]}, {"anyPolicy", "X509v3 Any Policy", NID_any_policy, 4, &so[4994]}, {"policyMappings", "X509v3 Policy Mappings", NID_policy_mappings, 3, &so[4998]}, {"inhibitAnyPolicy", "X509v3 Inhibit Any Policy", NID_inhibit_any_policy, 3, &so[5001]}, {"Oakley-EC2N-3", "ipsec3", NID_ipsec3}, {"Oakley-EC2N-4", "ipsec4", NID_ipsec4}, {"CAMELLIA-128-CBC", "camellia-128-cbc", NID_camellia_128_cbc, 11, &so[5004]}, {"CAMELLIA-192-CBC", "camellia-192-cbc", NID_camellia_192_cbc, 11, &so[5015]}, {"CAMELLIA-256-CBC", "camellia-256-cbc", NID_camellia_256_cbc, 11, &so[5026]}, {"CAMELLIA-128-ECB", "camellia-128-ecb", NID_camellia_128_ecb, 8, &so[5037]}, {"CAMELLIA-192-ECB", "camellia-192-ecb", NID_camellia_192_ecb, 8, &so[5045]}, {"CAMELLIA-256-ECB", "camellia-256-ecb", NID_camellia_256_ecb, 8, &so[5053]}, {"CAMELLIA-128-CFB", "camellia-128-cfb", NID_camellia_128_cfb128, 8, &so[5061]}, {"CAMELLIA-192-CFB", "camellia-192-cfb", NID_camellia_192_cfb128, 8, &so[5069]}, {"CAMELLIA-256-CFB", "camellia-256-cfb", NID_camellia_256_cfb128, 8, &so[5077]}, {"CAMELLIA-128-CFB1", "camellia-128-cfb1", NID_camellia_128_cfb1}, {"CAMELLIA-192-CFB1", "camellia-192-cfb1", NID_camellia_192_cfb1}, {"CAMELLIA-256-CFB1", "camellia-256-cfb1", NID_camellia_256_cfb1}, {"CAMELLIA-128-CFB8", "camellia-128-cfb8", NID_camellia_128_cfb8}, {"CAMELLIA-192-CFB8", "camellia-192-cfb8", NID_camellia_192_cfb8}, {"CAMELLIA-256-CFB8", "camellia-256-cfb8", NID_camellia_256_cfb8}, {"CAMELLIA-128-OFB", "camellia-128-ofb", NID_camellia_128_ofb128, 8, &so[5085]}, {"CAMELLIA-192-OFB", "camellia-192-ofb", NID_camellia_192_ofb128, 8, &so[5093]}, {"CAMELLIA-256-OFB", "camellia-256-ofb", NID_camellia_256_ofb128, 8, &so[5101]}, {"subjectDirectoryAttributes", "X509v3 Subject Directory Attributes", NID_subject_directory_attributes, 3, &so[5109]}, {"issuingDistributionPoint", "X509v3 Issuing Distribution Point", NID_issuing_distribution_point, 3, &so[5112]}, {"certificateIssuer", "X509v3 Certificate Issuer", NID_certificate_issuer, 3, &so[5115]}, { NULL, NULL, NID_undef }, {"KISA", "kisa", NID_kisa, 6, &so[5118]}, { NULL, NULL, NID_undef }, { NULL, NULL, NID_undef }, {"SEED-ECB", "seed-ecb", NID_seed_ecb, 8, &so[5124]}, {"SEED-CBC", "seed-cbc", NID_seed_cbc, 8, &so[5132]}, {"SEED-OFB", "seed-ofb", NID_seed_ofb128, 8, &so[5140]}, {"SEED-CFB", "seed-cfb", NID_seed_cfb128, 8, &so[5148]}, {"HMAC-MD5", "hmac-md5", NID_hmac_md5, 8, &so[5156]}, {"HMAC-SHA1", "hmac-sha1", NID_hmac_sha1, 8, &so[5164]}, {"id-PasswordBasedMAC", "password based MAC", NID_id_PasswordBasedMAC, 9, &so[5172]}, {"id-DHBasedMac", "Diffie-Hellman based MAC", NID_id_DHBasedMac, 9, &so[5181]}, {"id-it-suppLangTags", "id-it-suppLangTags", NID_id_it_suppLangTags, 8, &so[5190]}, {"caRepository", "CA Repository", NID_caRepository, 8, &so[5198]}, {"id-smime-ct-compressedData", "id-smime-ct-compressedData", NID_id_smime_ct_compressedData, 11, &so[5206]}, {"id-ct-asciiTextWithCRLF", "id-ct-asciiTextWithCRLF", NID_id_ct_asciiTextWithCRLF, 11, &so[5217]}, {"id-aes128-wrap", "id-aes128-wrap", NID_id_aes128_wrap, 9, &so[5228]}, {"id-aes192-wrap", "id-aes192-wrap", NID_id_aes192_wrap, 9, &so[5237]}, {"id-aes256-wrap", "id-aes256-wrap", NID_id_aes256_wrap, 9, &so[5246]}, {"ecdsa-with-Recommended", "ecdsa-with-Recommended", NID_ecdsa_with_Recommended, 7, &so[5255]}, {"ecdsa-with-Specified", "ecdsa-with-Specified", NID_ecdsa_with_Specified, 7, &so[5262]}, {"ecdsa-with-SHA224", "ecdsa-with-SHA224", NID_ecdsa_with_SHA224, 8, &so[5269]}, {"ecdsa-with-SHA256", "ecdsa-with-SHA256", NID_ecdsa_with_SHA256, 8, &so[5277]}, {"ecdsa-with-SHA384", "ecdsa-with-SHA384", NID_ecdsa_with_SHA384, 8, &so[5285]}, {"ecdsa-with-SHA512", "ecdsa-with-SHA512", NID_ecdsa_with_SHA512, 8, &so[5293]}, {"hmacWithMD5", "hmacWithMD5", NID_hmacWithMD5, 8, &so[5301]}, {"hmacWithSHA224", "hmacWithSHA224", NID_hmacWithSHA224, 8, &so[5309]}, {"hmacWithSHA256", "hmacWithSHA256", NID_hmacWithSHA256, 8, &so[5317]}, {"hmacWithSHA384", "hmacWithSHA384", NID_hmacWithSHA384, 8, &so[5325]}, {"hmacWithSHA512", "hmacWithSHA512", NID_hmacWithSHA512, 8, &so[5333]}, {"dsa_with_SHA224", "dsa_with_SHA224", NID_dsa_with_SHA224, 9, &so[5341]}, {"dsa_with_SHA256", "dsa_with_SHA256", NID_dsa_with_SHA256, 9, &so[5350]}, {"whirlpool", "whirlpool", NID_whirlpool, 6, &so[5359]}, {"cryptopro", "cryptopro", NID_cryptopro, 5, &so[5365]}, {"cryptocom", "cryptocom", NID_cryptocom, 5, &so[5370]}, {"id-GostR3411-94-with-GostR3410-2001", "GOST R 34.11-94 with GOST R 34.10-2001", NID_id_GostR3411_94_with_GostR3410_2001, 6, &so[5375]}, {"id-GostR3411-94-with-GostR3410-94", "GOST R 34.11-94 with GOST R 34.10-94", NID_id_GostR3411_94_with_GostR3410_94, 6, &so[5381]}, {"md_gost94", "GOST R 34.11-94", NID_id_GostR3411_94, 6, &so[5387]}, {"id-HMACGostR3411-94", "HMAC GOST 34.11-94", NID_id_HMACGostR3411_94, 6, &so[5393]}, {"gost2001", "GOST R 34.10-2001", NID_id_GostR3410_2001, 6, &so[5399]}, {"gost94", "GOST R 34.10-94", NID_id_GostR3410_94, 6, &so[5405]}, {"gost89", "GOST 28147-89", NID_id_Gost28147_89, 6, &so[5411]}, {"gost89-cnt", "gost89-cnt", NID_gost89_cnt}, {"gost-mac", "GOST 28147-89 MAC", NID_id_Gost28147_89_MAC, 6, &so[5417]}, {"prf-gostr3411-94", "GOST R 34.11-94 PRF", NID_id_GostR3411_94_prf, 6, &so[5423]}, {"id-GostR3410-2001DH", "GOST R 34.10-2001 DH", NID_id_GostR3410_2001DH, 6, &so[5429]}, {"id-GostR3410-94DH", "GOST R 34.10-94 DH", NID_id_GostR3410_94DH, 6, &so[5435]}, {"id-Gost28147-89-CryptoPro-KeyMeshing", "id-Gost28147-89-CryptoPro-KeyMeshing", NID_id_Gost28147_89_CryptoPro_KeyMeshing, 7, &so[5441]}, {"id-Gost28147-89-None-KeyMeshing", "id-Gost28147-89-None-KeyMeshing", NID_id_Gost28147_89_None_KeyMeshing, 7, &so[5448]}, {"id-GostR3411-94-TestParamSet", "id-GostR3411-94-TestParamSet", NID_id_GostR3411_94_TestParamSet, 7, &so[5455]}, {"id-GostR3411-94-CryptoProParamSet", "id-GostR3411-94-CryptoProParamSet", NID_id_GostR3411_94_CryptoProParamSet, 7, &so[5462]}, {"id-Gost28147-89-TestParamSet", "id-Gost28147-89-TestParamSet", NID_id_Gost28147_89_TestParamSet, 7, &so[5469]}, {"id-Gost28147-89-CryptoPro-A-ParamSet", "id-Gost28147-89-CryptoPro-A-ParamSet", NID_id_Gost28147_89_CryptoPro_A_ParamSet, 7, &so[5476]}, {"id-Gost28147-89-CryptoPro-B-ParamSet", "id-Gost28147-89-CryptoPro-B-ParamSet", NID_id_Gost28147_89_CryptoPro_B_ParamSet, 7, &so[5483]}, {"id-Gost28147-89-CryptoPro-C-ParamSet", "id-Gost28147-89-CryptoPro-C-ParamSet", NID_id_Gost28147_89_CryptoPro_C_ParamSet, 7, &so[5490]}, {"id-Gost28147-89-CryptoPro-D-ParamSet", "id-Gost28147-89-CryptoPro-D-ParamSet", NID_id_Gost28147_89_CryptoPro_D_ParamSet, 7, &so[5497]}, {"id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet", "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet", NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet, 7, &so[5504]}, {"id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet", "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet", NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet, 7, &so[5511]}, {"id-Gost28147-89-CryptoPro-RIC-1-ParamSet", "id-Gost28147-89-CryptoPro-RIC-1-ParamSet", NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet, 7, &so[5518]}, {"id-GostR3410-94-TestParamSet", "id-GostR3410-94-TestParamSet", NID_id_GostR3410_94_TestParamSet, 7, &so[5525]}, {"id-GostR3410-94-CryptoPro-A-ParamSet", "id-GostR3410-94-CryptoPro-A-ParamSet", NID_id_GostR3410_94_CryptoPro_A_ParamSet, 7, &so[5532]}, {"id-GostR3410-94-CryptoPro-B-ParamSet", "id-GostR3410-94-CryptoPro-B-ParamSet", NID_id_GostR3410_94_CryptoPro_B_ParamSet, 7, &so[5539]}, {"id-GostR3410-94-CryptoPro-C-ParamSet", "id-GostR3410-94-CryptoPro-C-ParamSet", NID_id_GostR3410_94_CryptoPro_C_ParamSet, 7, &so[5546]}, {"id-GostR3410-94-CryptoPro-D-ParamSet", "id-GostR3410-94-CryptoPro-D-ParamSet", NID_id_GostR3410_94_CryptoPro_D_ParamSet, 7, &so[5553]}, {"id-GostR3410-94-CryptoPro-XchA-ParamSet", "id-GostR3410-94-CryptoPro-XchA-ParamSet", NID_id_GostR3410_94_CryptoPro_XchA_ParamSet, 7, &so[5560]}, {"id-GostR3410-94-CryptoPro-XchB-ParamSet", "id-GostR3410-94-CryptoPro-XchB-ParamSet", NID_id_GostR3410_94_CryptoPro_XchB_ParamSet, 7, &so[5567]}, {"id-GostR3410-94-CryptoPro-XchC-ParamSet", "id-GostR3410-94-CryptoPro-XchC-ParamSet", NID_id_GostR3410_94_CryptoPro_XchC_ParamSet, 7, &so[5574]}, {"id-GostR3410-2001-TestParamSet", "id-GostR3410-2001-TestParamSet", NID_id_GostR3410_2001_TestParamSet, 7, &so[5581]}, {"id-GostR3410-2001-CryptoPro-A-ParamSet", "id-GostR3410-2001-CryptoPro-A-ParamSet", NID_id_GostR3410_2001_CryptoPro_A_ParamSet, 7, &so[5588]}, {"id-GostR3410-2001-CryptoPro-B-ParamSet", "id-GostR3410-2001-CryptoPro-B-ParamSet", NID_id_GostR3410_2001_CryptoPro_B_ParamSet, 7, &so[5595]}, {"id-GostR3410-2001-CryptoPro-C-ParamSet", "id-GostR3410-2001-CryptoPro-C-ParamSet", NID_id_GostR3410_2001_CryptoPro_C_ParamSet, 7, &so[5602]}, {"id-GostR3410-2001-CryptoPro-XchA-ParamSet", "id-GostR3410-2001-CryptoPro-XchA-ParamSet", NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet, 7, &so[5609]}, {"id-GostR3410-2001-CryptoPro-XchB-ParamSet", "id-GostR3410-2001-CryptoPro-XchB-ParamSet", NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet, 7, &so[5616]}, {"id-GostR3410-94-a", "id-GostR3410-94-a", NID_id_GostR3410_94_a, 7, &so[5623]}, {"id-GostR3410-94-aBis", "id-GostR3410-94-aBis", NID_id_GostR3410_94_aBis, 7, &so[5630]}, {"id-GostR3410-94-b", "id-GostR3410-94-b", NID_id_GostR3410_94_b, 7, &so[5637]}, {"id-GostR3410-94-bBis", "id-GostR3410-94-bBis", NID_id_GostR3410_94_bBis, 7, &so[5644]}, {"id-Gost28147-89-cc", "GOST 28147-89 Cryptocom ParamSet", NID_id_Gost28147_89_cc, 8, &so[5651]}, {"gost94cc", "GOST 34.10-94 Cryptocom", NID_id_GostR3410_94_cc, 8, &so[5659]}, {"gost2001cc", "GOST 34.10-2001 Cryptocom", NID_id_GostR3410_2001_cc, 8, &so[5667]}, {"id-GostR3411-94-with-GostR3410-94-cc", "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom", NID_id_GostR3411_94_with_GostR3410_94_cc, 8, &so[5675]}, {"id-GostR3411-94-with-GostR3410-2001-cc", "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom", NID_id_GostR3411_94_with_GostR3410_2001_cc, 8, &so[5683]}, {"id-GostR3410-2001-ParamSet-cc", "GOST R 3410-2001 Parameter Set Cryptocom", NID_id_GostR3410_2001_ParamSet_cc, 8, &so[5691]}, {"HMAC", "hmac", NID_hmac}, {"LocalKeySet", "Microsoft Local Key set", NID_LocalKeySet, 9, &so[5699]}, {"freshestCRL", "X509v3 Freshest CRL", NID_freshest_crl, 3, &so[5708]}, {"id-on-permanentIdentifier", "Permanent Identifier", NID_id_on_permanentIdentifier, 8, &so[5711]}, {"searchGuide", "searchGuide", NID_searchGuide, 3, &so[5719]}, {"businessCategory", "businessCategory", NID_businessCategory, 3, &so[5722]}, {"postalAddress", "postalAddress", NID_postalAddress, 3, &so[5725]}, {"postOfficeBox", "postOfficeBox", NID_postOfficeBox, 3, &so[5728]}, {"physicalDeliveryOfficeName", "physicalDeliveryOfficeName", NID_physicalDeliveryOfficeName, 3, &so[5731]}, {"telephoneNumber", "telephoneNumber", NID_telephoneNumber, 3, &so[5734]}, {"telexNumber", "telexNumber", NID_telexNumber, 3, &so[5737]}, {"teletexTerminalIdentifier", "teletexTerminalIdentifier", NID_teletexTerminalIdentifier, 3, &so[5740]}, {"facsimileTelephoneNumber", "facsimileTelephoneNumber", NID_facsimileTelephoneNumber, 3, &so[5743]}, {"x121Address", "x121Address", NID_x121Address, 3, &so[5746]}, {"internationaliSDNNumber", "internationaliSDNNumber", NID_internationaliSDNNumber, 3, &so[5749]}, {"registeredAddress", "registeredAddress", NID_registeredAddress, 3, &so[5752]}, {"destinationIndicator", "destinationIndicator", NID_destinationIndicator, 3, &so[5755]}, {"preferredDeliveryMethod", "preferredDeliveryMethod", NID_preferredDeliveryMethod, 3, &so[5758]}, {"presentationAddress", "presentationAddress", NID_presentationAddress, 3, &so[5761]}, {"supportedApplicationContext", "supportedApplicationContext", NID_supportedApplicationContext, 3, &so[5764]}, {"member", "member", NID_member, 3, &so[5767]}, {"owner", "owner", NID_owner, 3, &so[5770]}, {"roleOccupant", "roleOccupant", NID_roleOccupant, 3, &so[5773]}, {"seeAlso", "seeAlso", NID_seeAlso, 3, &so[5776]}, {"userPassword", "userPassword", NID_userPassword, 3, &so[5779]}, {"userCertificate", "userCertificate", NID_userCertificate, 3, &so[5782]}, {"cACertificate", "cACertificate", NID_cACertificate, 3, &so[5785]}, {"authorityRevocationList", "authorityRevocationList", NID_authorityRevocationList, 3, &so[5788]}, {"certificateRevocationList", "certificateRevocationList", NID_certificateRevocationList, 3, &so[5791]}, {"crossCertificatePair", "crossCertificatePair", NID_crossCertificatePair, 3, &so[5794]}, {"enhancedSearchGuide", "enhancedSearchGuide", NID_enhancedSearchGuide, 3, &so[5797]}, {"protocolInformation", "protocolInformation", NID_protocolInformation, 3, &so[5800]}, {"distinguishedName", "distinguishedName", NID_distinguishedName, 3, &so[5803]}, {"uniqueMember", "uniqueMember", NID_uniqueMember, 3, &so[5806]}, {"houseIdentifier", "houseIdentifier", NID_houseIdentifier, 3, &so[5809]}, {"supportedAlgorithms", "supportedAlgorithms", NID_supportedAlgorithms, 3, &so[5812]}, {"deltaRevocationList", "deltaRevocationList", NID_deltaRevocationList, 3, &so[5815]}, {"dmdName", "dmdName", NID_dmdName, 3, &so[5818]}, {"id-alg-PWRI-KEK", "id-alg-PWRI-KEK", NID_id_alg_PWRI_KEK, 11, &so[5821]}, {"CMAC", "cmac", NID_cmac}, {"id-aes128-GCM", "aes-128-gcm", NID_aes_128_gcm, 9, &so[5832]}, {"id-aes128-CCM", "aes-128-ccm", NID_aes_128_ccm, 9, &so[5841]}, {"id-aes128-wrap-pad", "id-aes128-wrap-pad", NID_id_aes128_wrap_pad, 9, &so[5850]}, {"id-aes192-GCM", "aes-192-gcm", NID_aes_192_gcm, 9, &so[5859]}, {"id-aes192-CCM", "aes-192-ccm", NID_aes_192_ccm, 9, &so[5868]}, {"id-aes192-wrap-pad", "id-aes192-wrap-pad", NID_id_aes192_wrap_pad, 9, &so[5877]}, {"id-aes256-GCM", "aes-256-gcm", NID_aes_256_gcm, 9, &so[5886]}, {"id-aes256-CCM", "aes-256-ccm", NID_aes_256_ccm, 9, &so[5895]}, {"id-aes256-wrap-pad", "id-aes256-wrap-pad", NID_id_aes256_wrap_pad, 9, &so[5904]}, {"AES-128-CTR", "aes-128-ctr", NID_aes_128_ctr}, {"AES-192-CTR", "aes-192-ctr", NID_aes_192_ctr}, {"AES-256-CTR", "aes-256-ctr", NID_aes_256_ctr}, {"id-camellia128-wrap", "id-camellia128-wrap", NID_id_camellia128_wrap, 11, &so[5913]}, {"id-camellia192-wrap", "id-camellia192-wrap", NID_id_camellia192_wrap, 11, &so[5924]}, {"id-camellia256-wrap", "id-camellia256-wrap", NID_id_camellia256_wrap, 11, &so[5935]}, {"anyExtendedKeyUsage", "Any Extended Key Usage", NID_anyExtendedKeyUsage, 4, &so[5946]}, {"MGF1", "mgf1", NID_mgf1, 9, &so[5950]}, {"RSASSA-PSS", "rsassaPss", NID_rsassaPss, 9, &so[5959]}, {"AES-128-XTS", "aes-128-xts", NID_aes_128_xts, 8, &so[5968]}, {"AES-256-XTS", "aes-256-xts", NID_aes_256_xts, 8, &so[5976]}, {"RC4-HMAC-MD5", "rc4-hmac-md5", NID_rc4_hmac_md5}, {"AES-128-CBC-HMAC-SHA1", "aes-128-cbc-hmac-sha1", NID_aes_128_cbc_hmac_sha1}, {"AES-192-CBC-HMAC-SHA1", "aes-192-cbc-hmac-sha1", NID_aes_192_cbc_hmac_sha1}, {"AES-256-CBC-HMAC-SHA1", "aes-256-cbc-hmac-sha1", NID_aes_256_cbc_hmac_sha1}, {"RSAES-OAEP", "rsaesOaep", NID_rsaesOaep, 9, &so[5984]}, {"dhpublicnumber", "X9.42 DH", NID_dhpublicnumber, 7, &so[5993]}, {"brainpoolP160r1", "brainpoolP160r1", NID_brainpoolP160r1, 9, &so[6000]}, {"brainpoolP160t1", "brainpoolP160t1", NID_brainpoolP160t1, 9, &so[6009]}, {"brainpoolP192r1", "brainpoolP192r1", NID_brainpoolP192r1, 9, &so[6018]}, {"brainpoolP192t1", "brainpoolP192t1", NID_brainpoolP192t1, 9, &so[6027]}, {"brainpoolP224r1", "brainpoolP224r1", NID_brainpoolP224r1, 9, &so[6036]}, {"brainpoolP224t1", "brainpoolP224t1", NID_brainpoolP224t1, 9, &so[6045]}, {"brainpoolP256r1", "brainpoolP256r1", NID_brainpoolP256r1, 9, &so[6054]}, {"brainpoolP256t1", "brainpoolP256t1", NID_brainpoolP256t1, 9, &so[6063]}, {"brainpoolP320r1", "brainpoolP320r1", NID_brainpoolP320r1, 9, &so[6072]}, {"brainpoolP320t1", "brainpoolP320t1", NID_brainpoolP320t1, 9, &so[6081]}, {"brainpoolP384r1", "brainpoolP384r1", NID_brainpoolP384r1, 9, &so[6090]}, {"brainpoolP384t1", "brainpoolP384t1", NID_brainpoolP384t1, 9, &so[6099]}, {"brainpoolP512r1", "brainpoolP512r1", NID_brainpoolP512r1, 9, &so[6108]}, {"brainpoolP512t1", "brainpoolP512t1", NID_brainpoolP512t1, 9, &so[6117]}, {"PSPECIFIED", "pSpecified", NID_pSpecified, 9, &so[6126]}, {"dhSinglePass-stdDH-sha1kdf-scheme", "dhSinglePass-stdDH-sha1kdf-scheme", NID_dhSinglePass_stdDH_sha1kdf_scheme, 9, &so[6135]}, {"dhSinglePass-stdDH-sha224kdf-scheme", "dhSinglePass-stdDH-sha224kdf-scheme", NID_dhSinglePass_stdDH_sha224kdf_scheme, 6, &so[6144]}, {"dhSinglePass-stdDH-sha256kdf-scheme", "dhSinglePass-stdDH-sha256kdf-scheme", NID_dhSinglePass_stdDH_sha256kdf_scheme, 6, &so[6150]}, {"dhSinglePass-stdDH-sha384kdf-scheme", "dhSinglePass-stdDH-sha384kdf-scheme", NID_dhSinglePass_stdDH_sha384kdf_scheme, 6, &so[6156]}, {"dhSinglePass-stdDH-sha512kdf-scheme", "dhSinglePass-stdDH-sha512kdf-scheme", NID_dhSinglePass_stdDH_sha512kdf_scheme, 6, &so[6162]}, {"dhSinglePass-cofactorDH-sha1kdf-scheme", "dhSinglePass-cofactorDH-sha1kdf-scheme", NID_dhSinglePass_cofactorDH_sha1kdf_scheme, 9, &so[6168]}, {"dhSinglePass-cofactorDH-sha224kdf-scheme", "dhSinglePass-cofactorDH-sha224kdf-scheme", NID_dhSinglePass_cofactorDH_sha224kdf_scheme, 6, &so[6177]}, {"dhSinglePass-cofactorDH-sha256kdf-scheme", "dhSinglePass-cofactorDH-sha256kdf-scheme", NID_dhSinglePass_cofactorDH_sha256kdf_scheme, 6, &so[6183]}, {"dhSinglePass-cofactorDH-sha384kdf-scheme", "dhSinglePass-cofactorDH-sha384kdf-scheme", NID_dhSinglePass_cofactorDH_sha384kdf_scheme, 6, &so[6189]}, {"dhSinglePass-cofactorDH-sha512kdf-scheme", "dhSinglePass-cofactorDH-sha512kdf-scheme", NID_dhSinglePass_cofactorDH_sha512kdf_scheme, 6, &so[6195]}, {"dh-std-kdf", "dh-std-kdf", NID_dh_std_kdf}, {"dh-cofactor-kdf", "dh-cofactor-kdf", NID_dh_cofactor_kdf}, {"AES-128-CBC-HMAC-SHA256", "aes-128-cbc-hmac-sha256", NID_aes_128_cbc_hmac_sha256}, {"AES-192-CBC-HMAC-SHA256", "aes-192-cbc-hmac-sha256", NID_aes_192_cbc_hmac_sha256}, {"AES-256-CBC-HMAC-SHA256", "aes-256-cbc-hmac-sha256", NID_aes_256_cbc_hmac_sha256}, {"ct_precert_scts", "CT Precertificate SCTs", NID_ct_precert_scts, 10, &so[6201]}, {"ct_precert_poison", "CT Precertificate Poison", NID_ct_precert_poison, 10, &so[6211]}, {"ct_precert_signer", "CT Precertificate Signer", NID_ct_precert_signer, 10, &so[6221]}, {"ct_cert_scts", "CT Certificate SCTs", NID_ct_cert_scts, 10, &so[6231]}, {"jurisdictionL", "jurisdictionLocalityName", NID_jurisdictionLocalityName, 11, &so[6241]}, {"jurisdictionST", "jurisdictionStateOrProvinceName", NID_jurisdictionStateOrProvinceName, 11, &so[6252]}, {"jurisdictionC", "jurisdictionCountryName", NID_jurisdictionCountryName, 11, &so[6263]}, {"AES-128-OCB", "aes-128-ocb", NID_aes_128_ocb}, {"AES-192-OCB", "aes-192-ocb", NID_aes_192_ocb}, {"AES-256-OCB", "aes-256-ocb", NID_aes_256_ocb}, {"CAMELLIA-128-GCM", "camellia-128-gcm", NID_camellia_128_gcm, 8, &so[6274]}, {"CAMELLIA-128-CCM", "camellia-128-ccm", NID_camellia_128_ccm, 8, &so[6282]}, {"CAMELLIA-128-CTR", "camellia-128-ctr", NID_camellia_128_ctr, 8, &so[6290]}, {"CAMELLIA-128-CMAC", "camellia-128-cmac", NID_camellia_128_cmac, 8, &so[6298]}, {"CAMELLIA-192-GCM", "camellia-192-gcm", NID_camellia_192_gcm, 8, &so[6306]}, {"CAMELLIA-192-CCM", "camellia-192-ccm", NID_camellia_192_ccm, 8, &so[6314]}, {"CAMELLIA-192-CTR", "camellia-192-ctr", NID_camellia_192_ctr, 8, &so[6322]}, {"CAMELLIA-192-CMAC", "camellia-192-cmac", NID_camellia_192_cmac, 8, &so[6330]}, {"CAMELLIA-256-GCM", "camellia-256-gcm", NID_camellia_256_gcm, 8, &so[6338]}, {"CAMELLIA-256-CCM", "camellia-256-ccm", NID_camellia_256_ccm, 8, &so[6346]}, {"CAMELLIA-256-CTR", "camellia-256-ctr", NID_camellia_256_ctr, 8, &so[6354]}, {"CAMELLIA-256-CMAC", "camellia-256-cmac", NID_camellia_256_cmac, 8, &so[6362]}, {"id-scrypt", "scrypt", NID_id_scrypt, 9, &so[6370]}, {"id-tc26", "id-tc26", NID_id_tc26, 5, &so[6379]}, {"gost89-cnt-12", "gost89-cnt-12", NID_gost89_cnt_12}, {"gost-mac-12", "gost-mac-12", NID_gost_mac_12}, {"id-tc26-algorithms", "id-tc26-algorithms", NID_id_tc26_algorithms, 6, &so[6384]}, {"id-tc26-sign", "id-tc26-sign", NID_id_tc26_sign, 7, &so[6390]}, {"gost2012_256", "GOST R 34.10-2012 with 256 bit modulus", NID_id_GostR3410_2012_256, 8, &so[6397]}, {"gost2012_512", "GOST R 34.10-2012 with 512 bit modulus", NID_id_GostR3410_2012_512, 8, &so[6405]}, {"id-tc26-digest", "id-tc26-digest", NID_id_tc26_digest, 7, &so[6413]}, {"md_gost12_256", "GOST R 34.11-2012 with 256 bit hash", NID_id_GostR3411_2012_256, 8, &so[6420]}, {"md_gost12_512", "GOST R 34.11-2012 with 512 bit hash", NID_id_GostR3411_2012_512, 8, &so[6428]}, {"id-tc26-signwithdigest", "id-tc26-signwithdigest", NID_id_tc26_signwithdigest, 7, &so[6436]}, {"id-tc26-signwithdigest-gost3410-2012-256", "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)", NID_id_tc26_signwithdigest_gost3410_2012_256, 8, &so[6443]}, {"id-tc26-signwithdigest-gost3410-2012-512", "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)", NID_id_tc26_signwithdigest_gost3410_2012_512, 8, &so[6451]}, {"id-tc26-mac", "id-tc26-mac", NID_id_tc26_mac, 7, &so[6459]}, {"id-tc26-hmac-gost-3411-2012-256", "HMAC GOST 34.11-2012 256 bit", NID_id_tc26_hmac_gost_3411_2012_256, 8, &so[6466]}, {"id-tc26-hmac-gost-3411-2012-512", "HMAC GOST 34.11-2012 512 bit", NID_id_tc26_hmac_gost_3411_2012_512, 8, &so[6474]}, {"id-tc26-cipher", "id-tc26-cipher", NID_id_tc26_cipher, 7, &so[6482]}, {"id-tc26-agreement", "id-tc26-agreement", NID_id_tc26_agreement, 7, &so[6489]}, {"id-tc26-agreement-gost-3410-2012-256", "id-tc26-agreement-gost-3410-2012-256", NID_id_tc26_agreement_gost_3410_2012_256, 8, &so[6496]}, {"id-tc26-agreement-gost-3410-2012-512", "id-tc26-agreement-gost-3410-2012-512", NID_id_tc26_agreement_gost_3410_2012_512, 8, &so[6504]}, {"id-tc26-constants", "id-tc26-constants", NID_id_tc26_constants, 6, &so[6512]}, {"id-tc26-sign-constants", "id-tc26-sign-constants", NID_id_tc26_sign_constants, 7, &so[6518]}, {"id-tc26-gost-3410-2012-512-constants", "id-tc26-gost-3410-2012-512-constants", NID_id_tc26_gost_3410_2012_512_constants, 8, &so[6525]}, {"id-tc26-gost-3410-2012-512-paramSetTest", "GOST R 34.10-2012 (512 bit) testing parameter set", NID_id_tc26_gost_3410_2012_512_paramSetTest, 9, &so[6533]}, {"id-tc26-gost-3410-2012-512-paramSetA", "GOST R 34.10-2012 (512 bit) ParamSet A", NID_id_tc26_gost_3410_2012_512_paramSetA, 9, &so[6542]}, {"id-tc26-gost-3410-2012-512-paramSetB", "GOST R 34.10-2012 (512 bit) ParamSet B", NID_id_tc26_gost_3410_2012_512_paramSetB, 9, &so[6551]}, {"id-tc26-digest-constants", "id-tc26-digest-constants", NID_id_tc26_digest_constants, 7, &so[6560]}, {"id-tc26-cipher-constants", "id-tc26-cipher-constants", NID_id_tc26_cipher_constants, 7, &so[6567]}, {"id-tc26-gost-28147-constants", "id-tc26-gost-28147-constants", NID_id_tc26_gost_28147_constants, 8, &so[6574]}, {"id-tc26-gost-28147-param-Z", "GOST 28147-89 TC26 parameter set", NID_id_tc26_gost_28147_param_Z, 9, &so[6582]}, {"INN", "INN", NID_INN, 8, &so[6591]}, {"OGRN", "OGRN", NID_OGRN, 5, &so[6599]}, {"SNILS", "SNILS", NID_SNILS, 5, &so[6604]}, {"subjectSignTool", "Signing Tool of Subject", NID_subjectSignTool, 5, &so[6609]}, {"issuerSignTool", "Signing Tool of Issuer", NID_issuerSignTool, 5, &so[6614]}, {"gost89-cbc", "gost89-cbc", NID_gost89_cbc}, {"gost89-ecb", "gost89-ecb", NID_gost89_ecb}, {"gost89-ctr", "gost89-ctr", NID_gost89_ctr}, {"kuznyechik-ecb", "kuznyechik-ecb", NID_kuznyechik_ecb}, {"kuznyechik-ctr", "kuznyechik-ctr", NID_kuznyechik_ctr}, {"kuznyechik-ofb", "kuznyechik-ofb", NID_kuznyechik_ofb}, {"kuznyechik-cbc", "kuznyechik-cbc", NID_kuznyechik_cbc}, {"kuznyechik-cfb", "kuznyechik-cfb", NID_kuznyechik_cfb}, {"kuznyechik-mac", "kuznyechik-mac", NID_kuznyechik_mac}, {"ChaCha20-Poly1305", "chacha20-poly1305", NID_chacha20_poly1305}, {"ChaCha20", "chacha20", NID_chacha20}, {"tlsfeature", "TLS Feature", NID_tlsfeature, 8, &so[6619]}, {"TLS1-PRF", "tls1-prf", NID_tls1_prf}, {"ipsecIKE", "ipsec Internet Key Exchange", NID_ipsec_IKE, 8, &so[6627]}, {"capwapAC", "Ctrl/provision WAP Access", NID_capwapAC, 8, &so[6635]}, {"capwapWTP", "Ctrl/Provision WAP Termination", NID_capwapWTP, 8, &so[6643]}, {"secureShellClient", "SSH Client", NID_sshClient, 8, &so[6651]}, {"secureShellServer", "SSH Server", NID_sshServer, 8, &so[6659]}, {"sendRouter", "Send Router", NID_sendRouter, 8, &so[6667]}, {"sendProxiedRouter", "Send Proxied Router", NID_sendProxiedRouter, 8, &so[6675]}, {"sendOwner", "Send Owner", NID_sendOwner, 8, &so[6683]}, {"sendProxiedOwner", "Send Proxied Owner", NID_sendProxiedOwner, 8, &so[6691]}, {"id-pkinit", "id-pkinit", NID_id_pkinit, 6, &so[6699]}, {"pkInitClientAuth", "PKINIT Client Auth", NID_pkInitClientAuth, 7, &so[6705]}, {"pkInitKDC", "Signing KDC Response", NID_pkInitKDC, 7, &so[6712]}, {"X25519", "X25519", NID_X25519, 3, &so[6719]}, {"X448", "X448", NID_X448, 3, &so[6722]}, {"HKDF", "hkdf", NID_hkdf}, {"KxRSA", "kx-rsa", NID_kx_rsa}, {"KxECDHE", "kx-ecdhe", NID_kx_ecdhe}, {"KxDHE", "kx-dhe", NID_kx_dhe}, {"KxECDHE-PSK", "kx-ecdhe-psk", NID_kx_ecdhe_psk}, {"KxDHE-PSK", "kx-dhe-psk", NID_kx_dhe_psk}, {"KxRSA_PSK", "kx-rsa-psk", NID_kx_rsa_psk}, {"KxPSK", "kx-psk", NID_kx_psk}, {"KxSRP", "kx-srp", NID_kx_srp}, {"KxGOST", "kx-gost", NID_kx_gost}, {"AuthRSA", "auth-rsa", NID_auth_rsa}, {"AuthECDSA", "auth-ecdsa", NID_auth_ecdsa}, {"AuthPSK", "auth-psk", NID_auth_psk}, {"AuthDSS", "auth-dss", NID_auth_dss}, {"AuthGOST01", "auth-gost01", NID_auth_gost01}, {"AuthGOST12", "auth-gost12", NID_auth_gost12}, {"AuthSRP", "auth-srp", NID_auth_srp}, {"AuthNULL", "auth-null", NID_auth_null}, { NULL, NULL, NID_undef }, { NULL, NULL, NID_undef }, {"BLAKE2b512", "blake2b512", NID_blake2b512, 11, &so[6725]}, {"BLAKE2s256", "blake2s256", NID_blake2s256, 11, &so[6736]}, {"id-smime-ct-contentCollection", "id-smime-ct-contentCollection", NID_id_smime_ct_contentCollection, 11, &so[6747]}, {"id-smime-ct-authEnvelopedData", "id-smime-ct-authEnvelopedData", NID_id_smime_ct_authEnvelopedData, 11, &so[6758]}, {"id-ct-xml", "id-ct-xml", NID_id_ct_xml, 11, &so[6769]}, {"Poly1305", "poly1305", NID_poly1305}, {"SipHash", "siphash", NID_siphash}, {"KxANY", "kx-any", NID_kx_any}, {"AuthANY", "auth-any", NID_auth_any}, {"ARIA-128-ECB", "aria-128-ecb", NID_aria_128_ecb, 9, &so[6780]}, {"ARIA-128-CBC", "aria-128-cbc", NID_aria_128_cbc, 9, &so[6789]}, {"ARIA-128-CFB", "aria-128-cfb", NID_aria_128_cfb128, 9, &so[6798]}, {"ARIA-128-OFB", "aria-128-ofb", NID_aria_128_ofb128, 9, &so[6807]}, {"ARIA-128-CTR", "aria-128-ctr", NID_aria_128_ctr, 9, &so[6816]}, {"ARIA-192-ECB", "aria-192-ecb", NID_aria_192_ecb, 9, &so[6825]}, {"ARIA-192-CBC", "aria-192-cbc", NID_aria_192_cbc, 9, &so[6834]}, {"ARIA-192-CFB", "aria-192-cfb", NID_aria_192_cfb128, 9, &so[6843]}, {"ARIA-192-OFB", "aria-192-ofb", NID_aria_192_ofb128, 9, &so[6852]}, {"ARIA-192-CTR", "aria-192-ctr", NID_aria_192_ctr, 9, &so[6861]}, {"ARIA-256-ECB", "aria-256-ecb", NID_aria_256_ecb, 9, &so[6870]}, {"ARIA-256-CBC", "aria-256-cbc", NID_aria_256_cbc, 9, &so[6879]}, {"ARIA-256-CFB", "aria-256-cfb", NID_aria_256_cfb128, 9, &so[6888]}, {"ARIA-256-OFB", "aria-256-ofb", NID_aria_256_ofb128, 9, &so[6897]}, {"ARIA-256-CTR", "aria-256-ctr", NID_aria_256_ctr, 9, &so[6906]}, {"ARIA-128-CFB1", "aria-128-cfb1", NID_aria_128_cfb1}, {"ARIA-192-CFB1", "aria-192-cfb1", NID_aria_192_cfb1}, {"ARIA-256-CFB1", "aria-256-cfb1", NID_aria_256_cfb1}, {"ARIA-128-CFB8", "aria-128-cfb8", NID_aria_128_cfb8}, {"ARIA-192-CFB8", "aria-192-cfb8", NID_aria_192_cfb8}, {"ARIA-256-CFB8", "aria-256-cfb8", NID_aria_256_cfb8}, {"id-smime-aa-signingCertificateV2", "id-smime-aa-signingCertificateV2", NID_id_smime_aa_signingCertificateV2, 11, &so[6915]}, {"ED25519", "ED25519", NID_ED25519, 3, &so[6926]}, {"ED448", "ED448", NID_ED448, 3, &so[6929]}, {"organizationIdentifier", "organizationIdentifier", NID_organizationIdentifier, 3, &so[6932]}, {"c3", "countryCode3c", NID_countryCode3c, 3, &so[6935]}, {"n3", "countryCode3n", NID_countryCode3n, 3, &so[6938]}, {"dnsName", "dnsName", NID_dnsName, 3, &so[6941]}, {"x509ExtAdmission", "Professional Information or basis for Admission", NID_x509ExtAdmission, 5, &so[6944]}, {"SHA512-224", "sha512-224", NID_sha512_224, 9, &so[6949]}, {"SHA512-256", "sha512-256", NID_sha512_256, 9, &so[6958]}, {"SHA3-224", "sha3-224", NID_sha3_224, 9, &so[6967]}, {"SHA3-256", "sha3-256", NID_sha3_256, 9, &so[6976]}, {"SHA3-384", "sha3-384", NID_sha3_384, 9, &so[6985]}, {"SHA3-512", "sha3-512", NID_sha3_512, 9, &so[6994]}, {"SHAKE128", "shake128", NID_shake128, 9, &so[7003]}, {"SHAKE256", "shake256", NID_shake256, 9, &so[7012]}, {"id-hmacWithSHA3-224", "hmac-sha3-224", NID_hmac_sha3_224, 9, &so[7021]}, {"id-hmacWithSHA3-256", "hmac-sha3-256", NID_hmac_sha3_256, 9, &so[7030]}, {"id-hmacWithSHA3-384", "hmac-sha3-384", NID_hmac_sha3_384, 9, &so[7039]}, {"id-hmacWithSHA3-512", "hmac-sha3-512", NID_hmac_sha3_512, 9, &so[7048]}, {"id-dsa-with-sha384", "dsa_with_SHA384", NID_dsa_with_SHA384, 9, &so[7057]}, {"id-dsa-with-sha512", "dsa_with_SHA512", NID_dsa_with_SHA512, 9, &so[7066]}, {"id-dsa-with-sha3-224", "dsa_with_SHA3-224", NID_dsa_with_SHA3_224, 9, &so[7075]}, {"id-dsa-with-sha3-256", "dsa_with_SHA3-256", NID_dsa_with_SHA3_256, 9, &so[7084]}, {"id-dsa-with-sha3-384", "dsa_with_SHA3-384", NID_dsa_with_SHA3_384, 9, &so[7093]}, {"id-dsa-with-sha3-512", "dsa_with_SHA3-512", NID_dsa_with_SHA3_512, 9, &so[7102]}, {"id-ecdsa-with-sha3-224", "ecdsa_with_SHA3-224", NID_ecdsa_with_SHA3_224, 9, &so[7111]}, {"id-ecdsa-with-sha3-256", "ecdsa_with_SHA3-256", NID_ecdsa_with_SHA3_256, 9, &so[7120]}, {"id-ecdsa-with-sha3-384", "ecdsa_with_SHA3-384", NID_ecdsa_with_SHA3_384, 9, &so[7129]}, {"id-ecdsa-with-sha3-512", "ecdsa_with_SHA3-512", NID_ecdsa_with_SHA3_512, 9, &so[7138]}, {"id-rsassa-pkcs1-v1_5-with-sha3-224", "RSA-SHA3-224", NID_RSA_SHA3_224, 9, &so[7147]}, {"id-rsassa-pkcs1-v1_5-with-sha3-256", "RSA-SHA3-256", NID_RSA_SHA3_256, 9, &so[7156]}, {"id-rsassa-pkcs1-v1_5-with-sha3-384", "RSA-SHA3-384", NID_RSA_SHA3_384, 9, &so[7165]}, {"id-rsassa-pkcs1-v1_5-with-sha3-512", "RSA-SHA3-512", NID_RSA_SHA3_512, 9, &so[7174]}, {"ARIA-128-CCM", "aria-128-ccm", NID_aria_128_ccm, 9, &so[7183]}, {"ARIA-192-CCM", "aria-192-ccm", NID_aria_192_ccm, 9, &so[7192]}, {"ARIA-256-CCM", "aria-256-ccm", NID_aria_256_ccm, 9, &so[7201]}, {"ARIA-128-GCM", "aria-128-gcm", NID_aria_128_gcm, 9, &so[7210]}, {"ARIA-192-GCM", "aria-192-gcm", NID_aria_192_gcm, 9, &so[7219]}, {"ARIA-256-GCM", "aria-256-gcm", NID_aria_256_gcm, 9, &so[7228]}, {"ffdhe2048", "ffdhe2048", NID_ffdhe2048}, {"ffdhe3072", "ffdhe3072", NID_ffdhe3072}, {"ffdhe4096", "ffdhe4096", NID_ffdhe4096}, {"ffdhe6144", "ffdhe6144", NID_ffdhe6144}, {"ffdhe8192", "ffdhe8192", NID_ffdhe8192}, {"cmcCA", "CMC Certificate Authority", NID_cmcCA, 8, &so[7237]}, {"cmcRA", "CMC Registration Authority", NID_cmcRA, 8, &so[7245]}, {"SM4-ECB", "sm4-ecb", NID_sm4_ecb, 8, &so[7253]}, {"SM4-CBC", "sm4-cbc", NID_sm4_cbc, 8, &so[7261]}, {"SM4-OFB", "sm4-ofb", NID_sm4_ofb128, 8, &so[7269]}, {"SM4-CFB1", "sm4-cfb1", NID_sm4_cfb1, 8, &so[7277]}, {"SM4-CFB", "sm4-cfb", NID_sm4_cfb128, 8, &so[7285]}, {"SM4-CFB8", "sm4-cfb8", NID_sm4_cfb8, 8, &so[7293]}, {"SM4-CTR", "sm4-ctr", NID_sm4_ctr, 8, &so[7301]}, {"ISO-CN", "ISO CN Member Body", NID_ISO_CN, 3, &so[7309]}, {"oscca", "oscca", NID_oscca, 5, &so[7312]}, {"sm-scheme", "sm-scheme", NID_sm_scheme, 6, &so[7317]}, {"SM3", "sm3", NID_sm3, 8, &so[7323]}, {"RSA-SM3", "sm3WithRSAEncryption", NID_sm3WithRSAEncryption, 8, &so[7331]}, {"RSA-SHA512/224", "sha512-224WithRSAEncryption", NID_sha512_224WithRSAEncryption, 9, &so[7339]}, {"RSA-SHA512/256", "sha512-256WithRSAEncryption", NID_sha512_256WithRSAEncryption, 9, &so[7348]}, {"id-tc26-gost-3410-2012-256-constants", "id-tc26-gost-3410-2012-256-constants", NID_id_tc26_gost_3410_2012_256_constants, 8, &so[7357]}, {"id-tc26-gost-3410-2012-256-paramSetA", "GOST R 34.10-2012 (256 bit) ParamSet A", NID_id_tc26_gost_3410_2012_256_paramSetA, 9, &so[7365]}, {"id-tc26-gost-3410-2012-512-paramSetC", "GOST R 34.10-2012 (512 bit) ParamSet C", NID_id_tc26_gost_3410_2012_512_paramSetC, 9, &so[7374]}, {"ISO-UA", "ISO-UA", NID_ISO_UA, 3, &so[7383]}, {"ua-pki", "ua-pki", NID_ua_pki, 7, &so[7386]}, {"dstu28147", "DSTU Gost 28147-2009", NID_dstu28147, 10, &so[7393]}, {"dstu28147-ofb", "DSTU Gost 28147-2009 OFB mode", NID_dstu28147_ofb, 11, &so[7403]}, {"dstu28147-cfb", "DSTU Gost 28147-2009 CFB mode", NID_dstu28147_cfb, 11, &so[7414]}, {"dstu28147-wrap", "DSTU Gost 28147-2009 key wrap", NID_dstu28147_wrap, 11, &so[7425]}, {"hmacWithDstu34311", "HMAC DSTU Gost 34311-95", NID_hmacWithDstu34311, 10, &so[7436]}, {"dstu34311", "DSTU Gost 34311-95", NID_dstu34311, 10, &so[7446]}, {"dstu4145le", "DSTU 4145-2002 little endian", NID_dstu4145le, 11, &so[7456]}, {"dstu4145be", "DSTU 4145-2002 big endian", NID_dstu4145be, 13, &so[7467]}, {"uacurve0", "DSTU curve 0", NID_uacurve0, 13, &so[7480]}, {"uacurve1", "DSTU curve 1", NID_uacurve1, 13, &so[7493]}, {"uacurve2", "DSTU curve 2", NID_uacurve2, 13, &so[7506]}, {"uacurve3", "DSTU curve 3", NID_uacurve3, 13, &so[7519]}, {"uacurve4", "DSTU curve 4", NID_uacurve4, 13, &so[7532]}, {"uacurve5", "DSTU curve 5", NID_uacurve5, 13, &so[7545]}, {"uacurve6", "DSTU curve 6", NID_uacurve6, 13, &so[7558]}, {"uacurve7", "DSTU curve 7", NID_uacurve7, 13, &so[7571]}, {"uacurve8", "DSTU curve 8", NID_uacurve8, 13, &so[7584]}, {"uacurve9", "DSTU curve 9", NID_uacurve9, 13, &so[7597]}, {"ieee", "ieee", NID_ieee, 2, &so[7610]}, {"ieee-siswg", "IEEE Security in Storage Working Group", NID_ieee_siswg, 5, &so[7612]}, {"SM2", "sm2", NID_sm2, 8, &so[7617]}, {"id-tc26-cipher-gostr3412-2015-magma", "id-tc26-cipher-gostr3412-2015-magma", NID_id_tc26_cipher_gostr3412_2015_magma, 8, &so[7625]}, {"magma-ctr-acpkm", "magma-ctr-acpkm", NID_magma_ctr_acpkm, 9, &so[7633]}, {"magma-ctr-acpkm-omac", "magma-ctr-acpkm-omac", NID_magma_ctr_acpkm_omac, 9, &so[7642]}, {"id-tc26-cipher-gostr3412-2015-kuznyechik", "id-tc26-cipher-gostr3412-2015-kuznyechik", NID_id_tc26_cipher_gostr3412_2015_kuznyechik, 8, &so[7651]}, {"kuznyechik-ctr-acpkm", "kuznyechik-ctr-acpkm", NID_kuznyechik_ctr_acpkm, 9, &so[7659]}, {"kuznyechik-ctr-acpkm-omac", "kuznyechik-ctr-acpkm-omac", NID_kuznyechik_ctr_acpkm_omac, 9, &so[7668]}, {"id-tc26-wrap", "id-tc26-wrap", NID_id_tc26_wrap, 7, &so[7677]}, {"id-tc26-wrap-gostr3412-2015-magma", "id-tc26-wrap-gostr3412-2015-magma", NID_id_tc26_wrap_gostr3412_2015_magma, 8, &so[7684]}, {"magma-kexp15", "magma-kexp15", NID_magma_kexp15, 9, &so[7692]}, {"id-tc26-wrap-gostr3412-2015-kuznyechik", "id-tc26-wrap-gostr3412-2015-kuznyechik", NID_id_tc26_wrap_gostr3412_2015_kuznyechik, 8, &so[7701]}, {"kuznyechik-kexp15", "kuznyechik-kexp15", NID_kuznyechik_kexp15, 9, &so[7709]}, {"id-tc26-gost-3410-2012-256-paramSetB", "GOST R 34.10-2012 (256 bit) ParamSet B", NID_id_tc26_gost_3410_2012_256_paramSetB, 9, &so[7718]}, {"id-tc26-gost-3410-2012-256-paramSetC", "GOST R 34.10-2012 (256 bit) ParamSet C", NID_id_tc26_gost_3410_2012_256_paramSetC, 9, &so[7727]}, {"id-tc26-gost-3410-2012-256-paramSetD", "GOST R 34.10-2012 (256 bit) ParamSet D", NID_id_tc26_gost_3410_2012_256_paramSetD, 9, &so[7736]}, {"magma-ecb", "magma-ecb", NID_magma_ecb}, {"magma-ctr", "magma-ctr", NID_magma_ctr}, {"magma-ofb", "magma-ofb", NID_magma_ofb}, {"magma-cbc", "magma-cbc", NID_magma_cbc}, {"magma-cfb", "magma-cfb", NID_magma_cfb}, {"magma-mac", "magma-mac", NID_magma_mac}, {"hmacWithSHA512-224", "hmacWithSHA512-224", NID_hmacWithSHA512_224, 8, &so[7745]}, {"hmacWithSHA512-256", "hmacWithSHA512-256", NID_hmacWithSHA512_256, 8, &so[7753]}, {"GMAC", "gmac", NID_gmac, 5, &so[7761]}, {"KMAC128", "kmac128", NID_kmac128, 9, &so[7766]}, {"KMAC256", "kmac256", NID_kmac256, 9, &so[7775]}, {"AES-128-SIV", "aes-128-siv", NID_aes_128_siv}, {"AES-192-SIV", "aes-192-siv", NID_aes_192_siv}, {"AES-256-SIV", "aes-256-siv", NID_aes_256_siv}, {"BLAKE2BMAC", "blake2bmac", NID_blake2bmac, 10, &so[7784]}, {"BLAKE2SMAC", "blake2smac", NID_blake2smac, 10, &so[7794]}, {"SSHKDF", "sshkdf", NID_sshkdf}, {"SM2-SM3", "SM2-with-SM3", NID_SM2_with_SM3, 8, &so[7804]}, {"SSKDF", "sskdf", NID_sskdf}, {"X963KDF", "x963kdf", NID_x963kdf}, {"X942KDF", "x942kdf", NID_x942kdf}, {"id-on-SmtpUTF8Mailbox", "Smtp UTF8 Mailbox", NID_id_on_SmtpUTF8Mailbox, 8, &so[7812]}, {"id-on-xmppAddr", "XmppAddr", NID_XmppAddr, 8, &so[7820]}, {"id-on-dnsSRV", "SRVName", NID_SRVName, 8, &so[7828]}, {"id-on-NAIRealm", "NAIRealm", NID_NAIRealm, 8, &so[7836]}, {"modp_1536", "modp_1536", NID_modp_1536}, {"modp_2048", "modp_2048", NID_modp_2048}, {"modp_3072", "modp_3072", NID_modp_3072}, {"modp_4096", "modp_4096", NID_modp_4096}, {"modp_6144", "modp_6144", NID_modp_6144}, {"modp_8192", "modp_8192", NID_modp_8192}, {"KxGOST18", "kx-gost18", NID_kx_gost18}, {"cmcArchive", "CMC Archive Server", NID_cmcArchive, 8, &so[7844]}, {"id-kp-bgpsec-router", "BGPsec Router", NID_id_kp_bgpsec_router, 8, &so[7852]}, {"id-kp-BrandIndicatorforMessageIdentification", "Brand Indicator for Message Identification", NID_id_kp_BrandIndicatorforMessageIdentification, 8, &so[7860]}, {"cmKGA", "Certificate Management Key Generation Authority", NID_cmKGA, 8, &so[7868]}, {"id-it-caCerts", "id-it-caCerts", NID_id_it_caCerts, 8, &so[7876]}, {"id-it-rootCaKeyUpdate", "id-it-rootCaKeyUpdate", NID_id_it_rootCaKeyUpdate, 8, &so[7884]}, {"id-it-certReqTemplate", "id-it-certReqTemplate", NID_id_it_certReqTemplate, 8, &so[7892]}, {"OGRNIP", "OGRNIP", NID_OGRNIP, 5, &so[7900]}, {"classSignTool", "Class of Signing Tool", NID_classSignTool, 5, &so[7905]}, {"classSignToolKC1", "Class of Signing Tool KC1", NID_classSignToolKC1, 6, &so[7910]}, {"classSignToolKC2", "Class of Signing Tool KC2", NID_classSignToolKC2, 6, &so[7916]}, {"classSignToolKC3", "Class of Signing Tool KC3", NID_classSignToolKC3, 6, &so[7922]}, {"classSignToolKB1", "Class of Signing Tool KB1", NID_classSignToolKB1, 6, &so[7928]}, {"classSignToolKB2", "Class of Signing Tool KB2", NID_classSignToolKB2, 6, &so[7934]}, {"classSignToolKA1", "Class of Signing Tool KA1", NID_classSignToolKA1, 6, &so[7940]}, {"id-ct-routeOriginAuthz", "id-ct-routeOriginAuthz", NID_id_ct_routeOriginAuthz, 11, &so[7946]}, {"id-ct-rpkiManifest", "id-ct-rpkiManifest", NID_id_ct_rpkiManifest, 11, &so[7957]}, {"id-ct-rpkiGhostbusters", "id-ct-rpkiGhostbusters", NID_id_ct_rpkiGhostbusters, 11, &so[7968]}, {"id-ct-resourceTaggedAttest", "id-ct-resourceTaggedAttest", NID_id_ct_resourceTaggedAttest, 11, &so[7979]}, {"id-cp", "id-cp", NID_id_cp, 7, &so[7990]}, {"sbgp-ipAddrBlockv2", "sbgp-ipAddrBlockv2", NID_sbgp_ipAddrBlockv2, 8, &so[7997]}, {"sbgp-autonomousSysNumv2", "sbgp-autonomousSysNumv2", NID_sbgp_autonomousSysNumv2, 8, &so[8005]}, {"ipAddr-asNumber", "ipAddr-asNumber", NID_ipAddr_asNumber, 8, &so[8013]}, {"ipAddr-asNumberv2", "ipAddr-asNumberv2", NID_ipAddr_asNumberv2, 8, &so[8021]}, {"rpkiManifest", "RPKI Manifest", NID_rpkiManifest, 8, &so[8029]}, {"signedObject", "Signed Object", NID_signedObject, 8, &so[8037]}, {"rpkiNotify", "RPKI Notify", NID_rpkiNotify, 8, &so[8045]}, {"id-ct-geofeedCSVwithCRLF", "id-ct-geofeedCSVwithCRLF", NID_id_ct_geofeedCSVwithCRLF, 11, &so[8053]}, {"id-ct-signedChecklist", "id-ct-signedChecklist", NID_id_ct_signedChecklist, 11, &so[8064]}, {"SM4-GCM", "sm4-gcm", NID_sm4_gcm, 8, &so[8075]}, {"SM4-CCM", "sm4-ccm", NID_sm4_ccm, 8, &so[8083]}, {"id-ct-ASPA", "id-ct-ASPA", NID_id_ct_ASPA, 11, &so[8091]}, {"id-mod-cmp2000-02", "id-mod-cmp2000-02", NID_id_mod_cmp2000_02, 8, &so[8102]}, {"id-mod-cmp2021-88", "id-mod-cmp2021-88", NID_id_mod_cmp2021_88, 8, &so[8110]}, {"id-mod-cmp2021-02", "id-mod-cmp2021-02", NID_id_mod_cmp2021_02, 8, &so[8118]}, {"id-it-rootCaCert", "id-it-rootCaCert", NID_id_it_rootCaCert, 8, &so[8126]}, {"id-it-certProfile", "id-it-certProfile", NID_id_it_certProfile, 8, &so[8134]}, {"id-it-crlStatusList", "id-it-crlStatusList", NID_id_it_crlStatusList, 8, &so[8142]}, {"id-it-crls", "id-it-crls", NID_id_it_crls, 8, &so[8150]}, {"id-regCtrl-altCertTemplate", "id-regCtrl-altCertTemplate", NID_id_regCtrl_altCertTemplate, 9, &so[8158]}, {"id-regCtrl-algId", "id-regCtrl-algId", NID_id_regCtrl_algId, 9, &so[8167]}, {"id-regCtrl-rsaKeyLen", "id-regCtrl-rsaKeyLen", NID_id_regCtrl_rsaKeyLen, 9, &so[8176]}, {"id-aa-ets-attrCertificateRefs", "id-aa-ets-attrCertificateRefs", NID_id_aa_ets_attrCertificateRefs, 11, &so[8185]}, {"id-aa-ets-attrRevocationRefs", "id-aa-ets-attrRevocationRefs", NID_id_aa_ets_attrRevocationRefs, 11, &so[8196]}, {"id-aa-CMSAlgorithmProtection", "id-aa-CMSAlgorithmProtection", NID_id_aa_CMSAlgorithmProtection, 9, &so[8207]}, {"itu-t-identified-organization", "itu-t-identified-organization", NID_itu_t_identified_organization, 1, &so[8216]}, {"etsi", "etsi", NID_etsi, 2, &so[8217]}, {"electronic-signature-standard", "electronic-signature-standard", NID_electronic_signature_standard, 4, &so[8219]}, {"ess-attributes", "ess-attributes", NID_ess_attributes, 5, &so[8223]}, {"id-aa-ets-mimeType", "id-aa-ets-mimeType", NID_id_aa_ets_mimeType, 6, &so[8228]}, {"id-aa-ets-longTermValidation", "id-aa-ets-longTermValidation", NID_id_aa_ets_longTermValidation, 6, &so[8234]}, {"id-aa-ets-SignaturePolicyDocument", "id-aa-ets-SignaturePolicyDocument", NID_id_aa_ets_SignaturePolicyDocument, 6, &so[8240]}, {"id-aa-ets-archiveTimestampV3", "id-aa-ets-archiveTimestampV3", NID_id_aa_ets_archiveTimestampV3, 6, &so[8246]}, {"id-aa-ATSHashIndex", "id-aa-ATSHashIndex", NID_id_aa_ATSHashIndex, 6, &so[8252]}, {"cades", "cades", NID_cades, 5, &so[8258]}, {"cades-attributes", "cades-attributes", NID_cades_attributes, 6, &so[8263]}, {"id-aa-ets-signerAttrV2", "id-aa-ets-signerAttrV2", NID_id_aa_ets_signerAttrV2, 7, &so[8269]}, {"id-aa-ets-sigPolicyStore", "id-aa-ets-sigPolicyStore", NID_id_aa_ets_sigPolicyStore, 7, &so[8276]}, {"id-aa-ATSHashIndex-v2", "id-aa-ATSHashIndex-v2", NID_id_aa_ATSHashIndex_v2, 7, &so[8283]}, {"id-aa-ATSHashIndex-v3", "id-aa-ATSHashIndex-v3", NID_id_aa_ATSHashIndex_v3, 7, &so[8290]}, {"signedAssertion", "signedAssertion", NID_signedAssertion, 7, &so[8297]}, {"id-aa-ets-archiveTimestampV2", "id-aa-ets-archiveTimestampV2", NID_id_aa_ets_archiveTimestampV2, 11, &so[8304]}, {"hmacWithSM3", "hmacWithSM3", NID_hmacWithSM3, 10, &so[8315]}, {"oracle-organization", "Oracle organization", NID_oracle, 7, &so[8325]}, {"oracle-jdk-trustedkeyusage", "Trusted key usage (Oracle)", NID_oracle_jdk_trustedkeyusage, 12, &so[8332]}, {"id-ct-signedTAL", "id-ct-signedTAL", NID_id_ct_signedTAL, 11, &so[8344]}, {"brainpoolP256r1tls13", "brainpoolP256r1tls13", NID_brainpoolP256r1tls13}, {"brainpoolP384r1tls13", "brainpoolP384r1tls13", NID_brainpoolP384r1tls13}, {"brainpoolP512r1tls13", "brainpoolP512r1tls13", NID_brainpoolP512r1tls13}, {"brotli", "Brotli compression", NID_brotli}, {"zstd", "Zstandard compression", NID_zstd}, {"SM4-XTS", "sm4-xts", NID_sm4_xts, 8, &so[8355]}, {"ms-ntds-obj-sid", "Microsoft NTDS AD objectSid", NID_ms_ntds_obj_sid, 10, &so[8363]}, {"ms-ntds-sec-ext", "Microsoft NTDS CA Extension", NID_ms_ntds_sec_ext, 9, &so[8373]}, {"ms-cert-templ", "Microsoft certificate template", NID_ms_cert_templ, 9, &so[8382]}, {"ms-app-policies", "Microsoft Application Policies Extension", NID_ms_app_policies, 9, &so[8391]}, {"authorityAttributeIdentifier", "X509v3 Authority Attribute Identifier", NID_authority_attribute_identifier, 3, &so[8400]}, {"roleSpecCertIdentifier", "X509v3 Role Specification Certificate Identifier", NID_role_spec_cert_identifier, 3, &so[8403]}, {"basicAttConstraints", "X509v3 Basic Attribute Certificate Constraints", NID_basic_att_constraints, 3, &so[8406]}, {"delegatedNameConstraints", "X509v3 Delegated Name Constraints", NID_delegated_name_constraints, 3, &so[8409]}, {"timeSpecification", "X509v3 Time Specification", NID_time_specification, 3, &so[8412]}, {"attributeDescriptor", "X509v3 Attribute Descriptor", NID_attribute_descriptor, 3, &so[8415]}, {"userNotice", "X509v3 User Notice", NID_user_notice, 3, &so[8418]}, {"sOAIdentifier", "X509v3 Source of Authority Identifier", NID_soa_identifier, 3, &so[8421]}, {"acceptableCertPolicies", "X509v3 Acceptable Certification Policies", NID_acceptable_cert_policies, 3, &so[8424]}, {"acceptablePrivPolicies", "X509v3 Acceptable Privilege Policies", NID_acceptable_privilege_policies, 3, &so[8427]}, {"indirectIssuer", "X509v3 Indirect Issuer", NID_indirect_issuer, 3, &so[8430]}, {"noAssertion", "X509v3 No Assertion", NID_no_assertion, 3, &so[8433]}, {"aAissuingDistributionPoint", "X509v3 Attribute Authority Issuing Distribution Point", NID_id_aa_issuing_distribution_point, 3, &so[8436]}, {"issuedOnBehalfOf", "X509v3 Issued On Behalf Of", NID_issued_on_behalf_of, 3, &so[8439]}, {"singleUse", "X509v3 Single Use", NID_single_use, 3, &so[8442]}, {"groupAC", "X509v3 Group Attribute Certificate", NID_group_ac, 3, &so[8445]}, {"allowedAttributeAssignments", "X509v3 Allowed Attribute Assignments", NID_allowed_attribute_assignments, 3, &so[8448]}, {"attributeMappings", "X509v3 Attribute Mappings", NID_attribute_mappings, 3, &so[8451]}, {"holderNameConstraints", "X509v3 Holder Name Constraints", NID_holder_name_constraints, 3, &so[8454]}, {"authorizationValidation", "X509v3 Authorization Validation", NID_authorization_validation, 3, &so[8457]}, {"protRestrict", "X509v3 Protocol Restriction", NID_prot_restrict, 3, &so[8460]}, {"subjectAltPublicKeyInfo", "X509v3 Subject Alternative Public Key Info", NID_subject_alt_public_key_info, 3, &so[8463]}, {"altSignatureAlgorithm", "X509v3 Alternative Signature Algorithm", NID_alt_signature_algorithm, 3, &so[8466]}, {"altSignatureValue", "X509v3 Alternative Signature Value", NID_alt_signature_value, 3, &so[8469]}, {"associatedInformation", "X509v3 Associated Information", NID_associated_information, 3, &so[8472]}, }; #define NUM_SN 1311 static const unsigned int sn_objs[NUM_SN] = { 364, /* "AD_DVCS" */ 419, /* "AES-128-CBC" */ 916, /* "AES-128-CBC-HMAC-SHA1" */ 948, /* "AES-128-CBC-HMAC-SHA256" */ 421, /* "AES-128-CFB" */ 650, /* "AES-128-CFB1" */ 653, /* "AES-128-CFB8" */ 904, /* "AES-128-CTR" */ 418, /* "AES-128-ECB" */ 958, /* "AES-128-OCB" */ 420, /* "AES-128-OFB" */ 1198, /* "AES-128-SIV" */ 913, /* "AES-128-XTS" */ 423, /* "AES-192-CBC" */ 917, /* "AES-192-CBC-HMAC-SHA1" */ 949, /* "AES-192-CBC-HMAC-SHA256" */ 425, /* "AES-192-CFB" */ 651, /* "AES-192-CFB1" */ 654, /* "AES-192-CFB8" */ 905, /* "AES-192-CTR" */ 422, /* "AES-192-ECB" */ 959, /* "AES-192-OCB" */ 424, /* "AES-192-OFB" */ 1199, /* "AES-192-SIV" */ 427, /* "AES-256-CBC" */ 918, /* "AES-256-CBC-HMAC-SHA1" */ 950, /* "AES-256-CBC-HMAC-SHA256" */ 429, /* "AES-256-CFB" */ 652, /* "AES-256-CFB1" */ 655, /* "AES-256-CFB8" */ 906, /* "AES-256-CTR" */ 426, /* "AES-256-ECB" */ 960, /* "AES-256-OCB" */ 428, /* "AES-256-OFB" */ 1200, /* "AES-256-SIV" */ 914, /* "AES-256-XTS" */ 1066, /* "ARIA-128-CBC" */ 1120, /* "ARIA-128-CCM" */ 1067, /* "ARIA-128-CFB" */ 1080, /* "ARIA-128-CFB1" */ 1083, /* "ARIA-128-CFB8" */ 1069, /* "ARIA-128-CTR" */ 1065, /* "ARIA-128-ECB" */ 1123, /* "ARIA-128-GCM" */ 1068, /* "ARIA-128-OFB" */ 1071, /* "ARIA-192-CBC" */ 1121, /* "ARIA-192-CCM" */ 1072, /* "ARIA-192-CFB" */ 1081, /* "ARIA-192-CFB1" */ 1084, /* "ARIA-192-CFB8" */ 1074, /* "ARIA-192-CTR" */ 1070, /* "ARIA-192-ECB" */ 1124, /* "ARIA-192-GCM" */ 1073, /* "ARIA-192-OFB" */ 1076, /* "ARIA-256-CBC" */ 1122, /* "ARIA-256-CCM" */ 1077, /* "ARIA-256-CFB" */ 1082, /* "ARIA-256-CFB1" */ 1085, /* "ARIA-256-CFB8" */ 1079, /* "ARIA-256-CTR" */ 1075, /* "ARIA-256-ECB" */ 1125, /* "ARIA-256-GCM" */ 1078, /* "ARIA-256-OFB" */ 1064, /* "AuthANY" */ 1049, /* "AuthDSS" */ 1047, /* "AuthECDSA" */ 1050, /* "AuthGOST01" */ 1051, /* "AuthGOST12" */ 1053, /* "AuthNULL" */ 1048, /* "AuthPSK" */ 1046, /* "AuthRSA" */ 1052, /* "AuthSRP" */ 91, /* "BF-CBC" */ 93, /* "BF-CFB" */ 92, /* "BF-ECB" */ 94, /* "BF-OFB" */ 1201, /* "BLAKE2BMAC" */ 1202, /* "BLAKE2SMAC" */ 1056, /* "BLAKE2b512" */ 1057, /* "BLAKE2s256" */ 14, /* "C" */ 751, /* "CAMELLIA-128-CBC" */ 962, /* "CAMELLIA-128-CCM" */ 757, /* "CAMELLIA-128-CFB" */ 760, /* "CAMELLIA-128-CFB1" */ 763, /* "CAMELLIA-128-CFB8" */ 964, /* "CAMELLIA-128-CMAC" */ 963, /* "CAMELLIA-128-CTR" */ 754, /* "CAMELLIA-128-ECB" */ 961, /* "CAMELLIA-128-GCM" */ 766, /* "CAMELLIA-128-OFB" */ 752, /* "CAMELLIA-192-CBC" */ 966, /* "CAMELLIA-192-CCM" */ 758, /* "CAMELLIA-192-CFB" */ 761, /* "CAMELLIA-192-CFB1" */ 764, /* "CAMELLIA-192-CFB8" */ 968, /* "CAMELLIA-192-CMAC" */ 967, /* "CAMELLIA-192-CTR" */ 755, /* "CAMELLIA-192-ECB" */ 965, /* "CAMELLIA-192-GCM" */ 767, /* "CAMELLIA-192-OFB" */ 753, /* "CAMELLIA-256-CBC" */ 970, /* "CAMELLIA-256-CCM" */ 759, /* "CAMELLIA-256-CFB" */ 762, /* "CAMELLIA-256-CFB1" */ 765, /* "CAMELLIA-256-CFB8" */ 972, /* "CAMELLIA-256-CMAC" */ 971, /* "CAMELLIA-256-CTR" */ 756, /* "CAMELLIA-256-ECB" */ 969, /* "CAMELLIA-256-GCM" */ 768, /* "CAMELLIA-256-OFB" */ 108, /* "CAST5-CBC" */ 110, /* "CAST5-CFB" */ 109, /* "CAST5-ECB" */ 111, /* "CAST5-OFB" */ 894, /* "CMAC" */ 13, /* "CN" */ 141, /* "CRLReason" */ 417, /* "CSPName" */ 1019, /* "ChaCha20" */ 1018, /* "ChaCha20-Poly1305" */ 367, /* "CrlID" */ 391, /* "DC" */ 31, /* "DES-CBC" */ 643, /* "DES-CDMF" */ 30, /* "DES-CFB" */ 656, /* "DES-CFB1" */ 657, /* "DES-CFB8" */ 29, /* "DES-ECB" */ 32, /* "DES-EDE" */ 43, /* "DES-EDE-CBC" */ 60, /* "DES-EDE-CFB" */ 62, /* "DES-EDE-OFB" */ 33, /* "DES-EDE3" */ 44, /* "DES-EDE3-CBC" */ 61, /* "DES-EDE3-CFB" */ 658, /* "DES-EDE3-CFB1" */ 659, /* "DES-EDE3-CFB8" */ 63, /* "DES-EDE3-OFB" */ 45, /* "DES-OFB" */ 80, /* "DESX-CBC" */ 380, /* "DOD" */ 116, /* "DSA" */ 66, /* "DSA-SHA" */ 113, /* "DSA-SHA1" */ 70, /* "DSA-SHA1-old" */ 67, /* "DSA-old" */ 297, /* "DVCS" */ 1087, /* "ED25519" */ 1088, /* "ED448" */ 1195, /* "GMAC" */ 99, /* "GN" */ 1036, /* "HKDF" */ 855, /* "HMAC" */ 780, /* "HMAC-MD5" */ 781, /* "HMAC-SHA1" */ 381, /* "IANA" */ 34, /* "IDEA-CBC" */ 35, /* "IDEA-CFB" */ 36, /* "IDEA-ECB" */ 46, /* "IDEA-OFB" */ 1004, /* "INN" */ 181, /* "ISO" */ 1140, /* "ISO-CN" */ 1150, /* "ISO-UA" */ 183, /* "ISO-US" */ 645, /* "ITU-T" */ 646, /* "JOINT-ISO-ITU-T" */ 773, /* "KISA" */ 1196, /* "KMAC128" */ 1197, /* "KMAC256" */ 1063, /* "KxANY" */ 1039, /* "KxDHE" */ 1041, /* "KxDHE-PSK" */ 1038, /* "KxECDHE" */ 1040, /* "KxECDHE-PSK" */ 1045, /* "KxGOST" */ 1218, /* "KxGOST18" */ 1043, /* "KxPSK" */ 1037, /* "KxRSA" */ 1042, /* "KxRSA_PSK" */ 1044, /* "KxSRP" */ 15, /* "L" */ 856, /* "LocalKeySet" */ 3, /* "MD2" */ 257, /* "MD4" */ 4, /* "MD5" */ 114, /* "MD5-SHA1" */ 95, /* "MDC2" */ 911, /* "MGF1" */ 388, /* "Mail" */ 393, /* "NULL" */ 404, /* "NULL" */ 57, /* "Netscape" */ 366, /* "Nonce" */ 17, /* "O" */ 178, /* "OCSP" */ 180, /* "OCSPSigning" */ 1005, /* "OGRN" */ 1226, /* "OGRNIP" */ 379, /* "ORG" */ 18, /* "OU" */ 749, /* "Oakley-EC2N-3" */ 750, /* "Oakley-EC2N-4" */ 9, /* "PBE-MD2-DES" */ 168, /* "PBE-MD2-RC2-64" */ 10, /* "PBE-MD5-DES" */ 169, /* "PBE-MD5-RC2-64" */ 147, /* "PBE-SHA1-2DES" */ 146, /* "PBE-SHA1-3DES" */ 170, /* "PBE-SHA1-DES" */ 148, /* "PBE-SHA1-RC2-128" */ 149, /* "PBE-SHA1-RC2-40" */ 68, /* "PBE-SHA1-RC2-64" */ 144, /* "PBE-SHA1-RC4-128" */ 145, /* "PBE-SHA1-RC4-40" */ 161, /* "PBES2" */ 69, /* "PBKDF2" */ 162, /* "PBMAC1" */ 127, /* "PKIX" */ 935, /* "PSPECIFIED" */ 1061, /* "Poly1305" */ 98, /* "RC2-40-CBC" */ 166, /* "RC2-64-CBC" */ 37, /* "RC2-CBC" */ 39, /* "RC2-CFB" */ 38, /* "RC2-ECB" */ 40, /* "RC2-OFB" */ 5, /* "RC4" */ 97, /* "RC4-40" */ 915, /* "RC4-HMAC-MD5" */ 120, /* "RC5-CBC" */ 122, /* "RC5-CFB" */ 121, /* "RC5-ECB" */ 123, /* "RC5-OFB" */ 117, /* "RIPEMD160" */ 19, /* "RSA" */ 7, /* "RSA-MD2" */ 396, /* "RSA-MD4" */ 8, /* "RSA-MD5" */ 96, /* "RSA-MDC2" */ 104, /* "RSA-NP-MD5" */ 119, /* "RSA-RIPEMD160" */ 42, /* "RSA-SHA" */ 65, /* "RSA-SHA1" */ 115, /* "RSA-SHA1-2" */ 671, /* "RSA-SHA224" */ 668, /* "RSA-SHA256" */ 669, /* "RSA-SHA384" */ 670, /* "RSA-SHA512" */ 1145, /* "RSA-SHA512/224" */ 1146, /* "RSA-SHA512/256" */ 1144, /* "RSA-SM3" */ 919, /* "RSAES-OAEP" */ 912, /* "RSASSA-PSS" */ 777, /* "SEED-CBC" */ 779, /* "SEED-CFB" */ 776, /* "SEED-ECB" */ 778, /* "SEED-OFB" */ 41, /* "SHA" */ 64, /* "SHA1" */ 675, /* "SHA224" */ 672, /* "SHA256" */ 1096, /* "SHA3-224" */ 1097, /* "SHA3-256" */ 1098, /* "SHA3-384" */ 1099, /* "SHA3-512" */ 673, /* "SHA384" */ 674, /* "SHA512" */ 1094, /* "SHA512-224" */ 1095, /* "SHA512-256" */ 1100, /* "SHAKE128" */ 1101, /* "SHAKE256" */ 1172, /* "SM2" */ 1204, /* "SM2-SM3" */ 1143, /* "SM3" */ 1134, /* "SM4-CBC" */ 1249, /* "SM4-CCM" */ 1137, /* "SM4-CFB" */ 1136, /* "SM4-CFB1" */ 1138, /* "SM4-CFB8" */ 1139, /* "SM4-CTR" */ 1133, /* "SM4-ECB" */ 1248, /* "SM4-GCM" */ 1135, /* "SM4-OFB" */ 1290, /* "SM4-XTS" */ 188, /* "SMIME" */ 167, /* "SMIME-CAPS" */ 100, /* "SN" */ 1006, /* "SNILS" */ 1203, /* "SSHKDF" */ 1205, /* "SSKDF" */ 16, /* "ST" */ 143, /* "SXNetID" */ 1062, /* "SipHash" */ 1021, /* "TLS1-PRF" */ 458, /* "UID" */ 0, /* "UNDEF" */ 1034, /* "X25519" */ 1035, /* "X448" */ 11, /* "X500" */ 378, /* "X500algorithms" */ 12, /* "X509" */ 184, /* "X9-57" */ 1207, /* "X942KDF" */ 1206, /* "X963KDF" */ 185, /* "X9cm" */ 125, /* "ZLIB" */ 1307, /* "aAissuingDistributionPoint" */ 478, /* "aRecord" */ 289, /* "aaControls" */ 287, /* "ac-auditEntity" */ 397, /* "ac-proxying" */ 288, /* "ac-targeting" */ 1303, /* "acceptableCertPolicies" */ 1304, /* "acceptablePrivPolicies" */ 368, /* "acceptableResponses" */ 446, /* "account" */ 363, /* "ad_timestamping" */ 376, /* "algorithm" */ 1311, /* "allowedAttributeAssignments" */ 1317, /* "altSignatureAlgorithm" */ 1318, /* "altSignatureValue" */ 405, /* "ansi-X9-62" */ 910, /* "anyExtendedKeyUsage" */ 746, /* "anyPolicy" */ 370, /* "archiveCutoff" */ 484, /* "associatedDomain" */ 1319, /* "associatedInformation" */ 485, /* "associatedName" */ 1300, /* "attributeDescriptor" */ 1312, /* "attributeMappings" */ 501, /* "audio" */ 1295, /* "authorityAttributeIdentifier" */ 177, /* "authorityInfoAccess" */ 90, /* "authorityKeyIdentifier" */ 882, /* "authorityRevocationList" */ 1314, /* "authorizationValidation" */ 1297, /* "basicAttConstraints" */ 87, /* "basicConstraints" */ 365, /* "basicOCSPResponse" */ 285, /* "biometricInfo" */ 921, /* "brainpoolP160r1" */ 922, /* "brainpoolP160t1" */ 923, /* "brainpoolP192r1" */ 924, /* "brainpoolP192t1" */ 925, /* "brainpoolP224r1" */ 926, /* "brainpoolP224t1" */ 927, /* "brainpoolP256r1" */ 1285, /* "brainpoolP256r1tls13" */ 928, /* "brainpoolP256t1" */ 929, /* "brainpoolP320r1" */ 930, /* "brainpoolP320t1" */ 931, /* "brainpoolP384r1" */ 1286, /* "brainpoolP384r1tls13" */ 932, /* "brainpoolP384t1" */ 933, /* "brainpoolP512r1" */ 1287, /* "brainpoolP512r1tls13" */ 934, /* "brainpoolP512t1" */ 1288, /* "brotli" */ 494, /* "buildingName" */ 860, /* "businessCategory" */ 691, /* "c2onb191v4" */ 692, /* "c2onb191v5" */ 697, /* "c2onb239v4" */ 698, /* "c2onb239v5" */ 684, /* "c2pnb163v1" */ 685, /* "c2pnb163v2" */ 686, /* "c2pnb163v3" */ 687, /* "c2pnb176v1" */ 693, /* "c2pnb208w1" */ 699, /* "c2pnb272w1" */ 700, /* "c2pnb304w1" */ 702, /* "c2pnb368w1" */ 688, /* "c2tnb191v1" */ 689, /* "c2tnb191v2" */ 690, /* "c2tnb191v3" */ 694, /* "c2tnb239v1" */ 695, /* "c2tnb239v2" */ 696, /* "c2tnb239v3" */ 701, /* "c2tnb359v1" */ 703, /* "c2tnb431r1" */ 1090, /* "c3" */ 881, /* "cACertificate" */ 483, /* "cNAMERecord" */ 179, /* "caIssuers" */ 785, /* "caRepository" */ 1273, /* "cades" */ 1274, /* "cades-attributes" */ 1023, /* "capwapAC" */ 1024, /* "capwapWTP" */ 443, /* "caseIgnoreIA5StringSyntax" */ 152, /* "certBag" */ 677, /* "certicom-arc" */ 771, /* "certificateIssuer" */ 89, /* "certificatePolicies" */ 883, /* "certificateRevocationList" */ 54, /* "challengePassword" */ 407, /* "characteristic-two-field" */ 1227, /* "classSignTool" */ 1233, /* "classSignToolKA1" */ 1231, /* "classSignToolKB1" */ 1232, /* "classSignToolKB2" */ 1228, /* "classSignToolKC1" */ 1229, /* "classSignToolKC2" */ 1230, /* "classSignToolKC3" */ 395, /* "clearance" */ 130, /* "clientAuth" */ 1222, /* "cmKGA" */ 1219, /* "cmcArchive" */ 1131, /* "cmcCA" */ 1132, /* "cmcRA" */ 131, /* "codeSigning" */ 50, /* "contentType" */ 53, /* "countersignature" */ 153, /* "crlBag" */ 103, /* "crlDistributionPoints" */ 88, /* "crlNumber" */ 884, /* "crossCertificatePair" */ 806, /* "cryptocom" */ 805, /* "cryptopro" */ 954, /* "ct_cert_scts" */ 952, /* "ct_precert_poison" */ 951, /* "ct_precert_scts" */ 953, /* "ct_precert_signer" */ 500, /* "dITRedirect" */ 451, /* "dNSDomain" */ 495, /* "dSAQuality" */ 434, /* "data" */ 390, /* "dcobject" */ 1298, /* "delegatedNameConstraints" */ 140, /* "deltaCRL" */ 891, /* "deltaRevocationList" */ 107, /* "description" */ 871, /* "destinationIndicator" */ 947, /* "dh-cofactor-kdf" */ 946, /* "dh-std-kdf" */ 28, /* "dhKeyAgreement" */ 941, /* "dhSinglePass-cofactorDH-sha1kdf-scheme" */ 942, /* "dhSinglePass-cofactorDH-sha224kdf-scheme" */ 943, /* "dhSinglePass-cofactorDH-sha256kdf-scheme" */ 944, /* "dhSinglePass-cofactorDH-sha384kdf-scheme" */ 945, /* "dhSinglePass-cofactorDH-sha512kdf-scheme" */ 936, /* "dhSinglePass-stdDH-sha1kdf-scheme" */ 937, /* "dhSinglePass-stdDH-sha224kdf-scheme" */ 938, /* "dhSinglePass-stdDH-sha256kdf-scheme" */ 939, /* "dhSinglePass-stdDH-sha384kdf-scheme" */ 940, /* "dhSinglePass-stdDH-sha512kdf-scheme" */ 920, /* "dhpublicnumber" */ 382, /* "directory" */ 887, /* "distinguishedName" */ 892, /* "dmdName" */ 174, /* "dnQualifier" */ 1092, /* "dnsName" */ 447, /* "document" */ 471, /* "documentAuthor" */ 468, /* "documentIdentifier" */ 472, /* "documentLocation" */ 502, /* "documentPublisher" */ 449, /* "documentSeries" */ 469, /* "documentTitle" */ 470, /* "documentVersion" */ 392, /* "domain" */ 452, /* "domainRelatedObject" */ 802, /* "dsa_with_SHA224" */ 803, /* "dsa_with_SHA256" */ 1152, /* "dstu28147" */ 1154, /* "dstu28147-cfb" */ 1153, /* "dstu28147-ofb" */ 1155, /* "dstu28147-wrap" */ 1157, /* "dstu34311" */ 1159, /* "dstu4145be" */ 1158, /* "dstu4145le" */ 791, /* "ecdsa-with-Recommended" */ 416, /* "ecdsa-with-SHA1" */ 793, /* "ecdsa-with-SHA224" */ 794, /* "ecdsa-with-SHA256" */ 795, /* "ecdsa-with-SHA384" */ 796, /* "ecdsa-with-SHA512" */ 792, /* "ecdsa-with-Specified" */ 1266, /* "electronic-signature-standard" */ 48, /* "emailAddress" */ 132, /* "emailProtection" */ 885, /* "enhancedSearchGuide" */ 389, /* "enterprises" */ 1267, /* "ess-attributes" */ 1265, /* "etsi" */ 384, /* "experimental" */ 172, /* "extReq" */ 56, /* "extendedCertificateAttributes" */ 126, /* "extendedKeyUsage" */ 372, /* "extendedStatus" */ 867, /* "facsimileTelephoneNumber" */ 462, /* "favouriteDrink" */ 1126, /* "ffdhe2048" */ 1127, /* "ffdhe3072" */ 1128, /* "ffdhe4096" */ 1129, /* "ffdhe6144" */ 1130, /* "ffdhe8192" */ 857, /* "freshestCRL" */ 453, /* "friendlyCountry" */ 490, /* "friendlyCountryName" */ 156, /* "friendlyName" */ 509, /* "generationQualifier" */ 815, /* "gost-mac" */ 976, /* "gost-mac-12" */ 811, /* "gost2001" */ 851, /* "gost2001cc" */ 979, /* "gost2012_256" */ 980, /* "gost2012_512" */ 813, /* "gost89" */ 1009, /* "gost89-cbc" */ 814, /* "gost89-cnt" */ 975, /* "gost89-cnt-12" */ 1011, /* "gost89-ctr" */ 1010, /* "gost89-ecb" */ 812, /* "gost94" */ 850, /* "gost94cc" */ 1310, /* "groupAC" */ 1156, /* "hmacWithDstu34311" */ 797, /* "hmacWithMD5" */ 163, /* "hmacWithSHA1" */ 798, /* "hmacWithSHA224" */ 799, /* "hmacWithSHA256" */ 800, /* "hmacWithSHA384" */ 801, /* "hmacWithSHA512" */ 1193, /* "hmacWithSHA512-224" */ 1194, /* "hmacWithSHA512-256" */ 1281, /* "hmacWithSM3" */ 432, /* "holdInstructionCallIssuer" */ 430, /* "holdInstructionCode" */ 431, /* "holdInstructionNone" */ 433, /* "holdInstructionReject" */ 1313, /* "holderNameConstraints" */ 486, /* "homePostalAddress" */ 473, /* "homeTelephoneNumber" */ 466, /* "host" */ 889, /* "houseIdentifier" */ 442, /* "iA5StringSyntax" */ 783, /* "id-DHBasedMac" */ 824, /* "id-Gost28147-89-CryptoPro-A-ParamSet" */ 825, /* "id-Gost28147-89-CryptoPro-B-ParamSet" */ 826, /* "id-Gost28147-89-CryptoPro-C-ParamSet" */ 827, /* "id-Gost28147-89-CryptoPro-D-ParamSet" */ 819, /* "id-Gost28147-89-CryptoPro-KeyMeshing" */ 829, /* "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" */ 828, /* "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" */ 830, /* "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" */ 820, /* "id-Gost28147-89-None-KeyMeshing" */ 823, /* "id-Gost28147-89-TestParamSet" */ 849, /* "id-Gost28147-89-cc" */ 840, /* "id-GostR3410-2001-CryptoPro-A-ParamSet" */ 841, /* "id-GostR3410-2001-CryptoPro-B-ParamSet" */ 842, /* "id-GostR3410-2001-CryptoPro-C-ParamSet" */ 843, /* "id-GostR3410-2001-CryptoPro-XchA-ParamSet" */ 844, /* "id-GostR3410-2001-CryptoPro-XchB-ParamSet" */ 854, /* "id-GostR3410-2001-ParamSet-cc" */ 839, /* "id-GostR3410-2001-TestParamSet" */ 817, /* "id-GostR3410-2001DH" */ 832, /* "id-GostR3410-94-CryptoPro-A-ParamSet" */ 833, /* "id-GostR3410-94-CryptoPro-B-ParamSet" */ 834, /* "id-GostR3410-94-CryptoPro-C-ParamSet" */ 835, /* "id-GostR3410-94-CryptoPro-D-ParamSet" */ 836, /* "id-GostR3410-94-CryptoPro-XchA-ParamSet" */ 837, /* "id-GostR3410-94-CryptoPro-XchB-ParamSet" */ 838, /* "id-GostR3410-94-CryptoPro-XchC-ParamSet" */ 831, /* "id-GostR3410-94-TestParamSet" */ 845, /* "id-GostR3410-94-a" */ 846, /* "id-GostR3410-94-aBis" */ 847, /* "id-GostR3410-94-b" */ 848, /* "id-GostR3410-94-bBis" */ 818, /* "id-GostR3410-94DH" */ 822, /* "id-GostR3411-94-CryptoProParamSet" */ 821, /* "id-GostR3411-94-TestParamSet" */ 807, /* "id-GostR3411-94-with-GostR3410-2001" */ 853, /* "id-GostR3411-94-with-GostR3410-2001-cc" */ 808, /* "id-GostR3411-94-with-GostR3410-94" */ 852, /* "id-GostR3411-94-with-GostR3410-94-cc" */ 810, /* "id-HMACGostR3411-94" */ 782, /* "id-PasswordBasedMAC" */ 1272, /* "id-aa-ATSHashIndex" */ 1277, /* "id-aa-ATSHashIndex-v2" */ 1278, /* "id-aa-ATSHashIndex-v3" */ 1263, /* "id-aa-CMSAlgorithmProtection" */ 1270, /* "id-aa-ets-SignaturePolicyDocument" */ 1280, /* "id-aa-ets-archiveTimestampV2" */ 1271, /* "id-aa-ets-archiveTimestampV3" */ 1261, /* "id-aa-ets-attrCertificateRefs" */ 1262, /* "id-aa-ets-attrRevocationRefs" */ 1269, /* "id-aa-ets-longTermValidation" */ 1268, /* "id-aa-ets-mimeType" */ 1276, /* "id-aa-ets-sigPolicyStore" */ 1275, /* "id-aa-ets-signerAttrV2" */ 266, /* "id-aca" */ 355, /* "id-aca-accessIdentity" */ 354, /* "id-aca-authenticationInfo" */ 356, /* "id-aca-chargingIdentity" */ 399, /* "id-aca-encAttrs" */ 357, /* "id-aca-group" */ 358, /* "id-aca-role" */ 176, /* "id-ad" */ 896, /* "id-aes128-CCM" */ 895, /* "id-aes128-GCM" */ 788, /* "id-aes128-wrap" */ 897, /* "id-aes128-wrap-pad" */ 899, /* "id-aes192-CCM" */ 898, /* "id-aes192-GCM" */ 789, /* "id-aes192-wrap" */ 900, /* "id-aes192-wrap-pad" */ 902, /* "id-aes256-CCM" */ 901, /* "id-aes256-GCM" */ 790, /* "id-aes256-wrap" */ 903, /* "id-aes256-wrap-pad" */ 262, /* "id-alg" */ 893, /* "id-alg-PWRI-KEK" */ 323, /* "id-alg-des40" */ 326, /* "id-alg-dh-pop" */ 325, /* "id-alg-dh-sig-hmac-sha1" */ 324, /* "id-alg-noSignature" */ 907, /* "id-camellia128-wrap" */ 908, /* "id-camellia192-wrap" */ 909, /* "id-camellia256-wrap" */ 268, /* "id-cct" */ 361, /* "id-cct-PKIData" */ 362, /* "id-cct-PKIResponse" */ 360, /* "id-cct-crs" */ 81, /* "id-ce" */ 680, /* "id-characteristic-two-basis" */ 263, /* "id-cmc" */ 334, /* "id-cmc-addExtensions" */ 346, /* "id-cmc-confirmCertAcceptance" */ 330, /* "id-cmc-dataReturn" */ 336, /* "id-cmc-decryptedPOP" */ 335, /* "id-cmc-encryptedPOP" */ 339, /* "id-cmc-getCRL" */ 338, /* "id-cmc-getCert" */ 328, /* "id-cmc-identification" */ 329, /* "id-cmc-identityProof" */ 337, /* "id-cmc-lraPOPWitness" */ 344, /* "id-cmc-popLinkRandom" */ 345, /* "id-cmc-popLinkWitness" */ 343, /* "id-cmc-queryPending" */ 333, /* "id-cmc-recipientNonce" */ 341, /* "id-cmc-regInfo" */ 342, /* "id-cmc-responseInfo" */ 340, /* "id-cmc-revokeRequest" */ 332, /* "id-cmc-senderNonce" */ 327, /* "id-cmc-statusInfo" */ 331, /* "id-cmc-transactionId" */ 1238, /* "id-cp" */ 1250, /* "id-ct-ASPA" */ 787, /* "id-ct-asciiTextWithCRLF" */ 1246, /* "id-ct-geofeedCSVwithCRLF" */ 1237, /* "id-ct-resourceTaggedAttest" */ 1234, /* "id-ct-routeOriginAuthz" */ 1236, /* "id-ct-rpkiGhostbusters" */ 1235, /* "id-ct-rpkiManifest" */ 1247, /* "id-ct-signedChecklist" */ 1284, /* "id-ct-signedTAL" */ 1060, /* "id-ct-xml" */ 1108, /* "id-dsa-with-sha3-224" */ 1109, /* "id-dsa-with-sha3-256" */ 1110, /* "id-dsa-with-sha3-384" */ 1111, /* "id-dsa-with-sha3-512" */ 1106, /* "id-dsa-with-sha384" */ 1107, /* "id-dsa-with-sha512" */ 408, /* "id-ecPublicKey" */ 1112, /* "id-ecdsa-with-sha3-224" */ 1113, /* "id-ecdsa-with-sha3-256" */ 1114, /* "id-ecdsa-with-sha3-384" */ 1115, /* "id-ecdsa-with-sha3-512" */ 508, /* "id-hex-multipart-message" */ 507, /* "id-hex-partial-message" */ 1102, /* "id-hmacWithSHA3-224" */ 1103, /* "id-hmacWithSHA3-256" */ 1104, /* "id-hmacWithSHA3-384" */ 1105, /* "id-hmacWithSHA3-512" */ 260, /* "id-it" */ 1223, /* "id-it-caCerts" */ 302, /* "id-it-caKeyUpdateInfo" */ 298, /* "id-it-caProtEncCert" */ 1255, /* "id-it-certProfile" */ 1225, /* "id-it-certReqTemplate" */ 311, /* "id-it-confirmWaitTime" */ 1256, /* "id-it-crlStatusList" */ 1257, /* "id-it-crls" */ 303, /* "id-it-currentCRL" */ 300, /* "id-it-encKeyPairTypes" */ 310, /* "id-it-implicitConfirm" */ 308, /* "id-it-keyPairParamRep" */ 307, /* "id-it-keyPairParamReq" */ 312, /* "id-it-origPKIMessage" */ 301, /* "id-it-preferredSymmAlg" */ 309, /* "id-it-revPassphrase" */ 1254, /* "id-it-rootCaCert" */ 1224, /* "id-it-rootCaKeyUpdate" */ 299, /* "id-it-signKeyPairTypes" */ 305, /* "id-it-subscriptionRequest" */ 306, /* "id-it-subscriptionResponse" */ 784, /* "id-it-suppLangTags" */ 304, /* "id-it-unsupportedOIDs" */ 128, /* "id-kp" */ 1221, /* "id-kp-BrandIndicatorforMessageIdentification" */ 1220, /* "id-kp-bgpsec-router" */ 280, /* "id-mod-attribute-cert" */ 274, /* "id-mod-cmc" */ 277, /* "id-mod-cmp" */ 284, /* "id-mod-cmp2000" */ 1251, /* "id-mod-cmp2000-02" */ 1253, /* "id-mod-cmp2021-02" */ 1252, /* "id-mod-cmp2021-88" */ 273, /* "id-mod-crmf" */ 283, /* "id-mod-dvcs" */ 275, /* "id-mod-kea-profile-88" */ 276, /* "id-mod-kea-profile-93" */ 282, /* "id-mod-ocsp" */ 278, /* "id-mod-qualified-cert-88" */ 279, /* "id-mod-qualified-cert-93" */ 281, /* "id-mod-timestamp-protocol" */ 264, /* "id-on" */ 1211, /* "id-on-NAIRealm" */ 1208, /* "id-on-SmtpUTF8Mailbox" */ 1210, /* "id-on-dnsSRV" */ 858, /* "id-on-permanentIdentifier" */ 347, /* "id-on-personalData" */ 1209, /* "id-on-xmppAddr" */ 265, /* "id-pda" */ 352, /* "id-pda-countryOfCitizenship" */ 353, /* "id-pda-countryOfResidence" */ 348, /* "id-pda-dateOfBirth" */ 351, /* "id-pda-gender" */ 349, /* "id-pda-placeOfBirth" */ 175, /* "id-pe" */ 1031, /* "id-pkinit" */ 261, /* "id-pkip" */ 258, /* "id-pkix-mod" */ 269, /* "id-pkix1-explicit-88" */ 271, /* "id-pkix1-explicit-93" */ 270, /* "id-pkix1-implicit-88" */ 272, /* "id-pkix1-implicit-93" */ 662, /* "id-ppl" */ 664, /* "id-ppl-anyLanguage" */ 667, /* "id-ppl-independent" */ 665, /* "id-ppl-inheritAll" */ 267, /* "id-qcs" */ 359, /* "id-qcs-pkixQCSyntax-v1" */ 259, /* "id-qt" */ 164, /* "id-qt-cps" */ 165, /* "id-qt-unotice" */ 313, /* "id-regCtrl" */ 1259, /* "id-regCtrl-algId" */ 1258, /* "id-regCtrl-altCertTemplate" */ 316, /* "id-regCtrl-authenticator" */ 319, /* "id-regCtrl-oldCertID" */ 318, /* "id-regCtrl-pkiArchiveOptions" */ 317, /* "id-regCtrl-pkiPublicationInfo" */ 320, /* "id-regCtrl-protocolEncrKey" */ 315, /* "id-regCtrl-regToken" */ 1260, /* "id-regCtrl-rsaKeyLen" */ 314, /* "id-regInfo" */ 322, /* "id-regInfo-certReq" */ 321, /* "id-regInfo-utf8Pairs" */ 1116, /* "id-rsassa-pkcs1-v1_5-with-sha3-224" */ 1117, /* "id-rsassa-pkcs1-v1_5-with-sha3-256" */ 1118, /* "id-rsassa-pkcs1-v1_5-with-sha3-384" */ 1119, /* "id-rsassa-pkcs1-v1_5-with-sha3-512" */ 973, /* "id-scrypt" */ 512, /* "id-set" */ 191, /* "id-smime-aa" */ 215, /* "id-smime-aa-contentHint" */ 218, /* "id-smime-aa-contentIdentifier" */ 221, /* "id-smime-aa-contentReference" */ 240, /* "id-smime-aa-dvcs-dvc" */ 217, /* "id-smime-aa-encapContentType" */ 222, /* "id-smime-aa-encrypKeyPref" */ 220, /* "id-smime-aa-equivalentLabels" */ 232, /* "id-smime-aa-ets-CertificateRefs" */ 233, /* "id-smime-aa-ets-RevocationRefs" */ 238, /* "id-smime-aa-ets-archiveTimeStamp" */ 237, /* "id-smime-aa-ets-certCRLTimestamp" */ 234, /* "id-smime-aa-ets-certValues" */ 227, /* "id-smime-aa-ets-commitmentType" */ 231, /* "id-smime-aa-ets-contentTimestamp" */ 236, /* "id-smime-aa-ets-escTimeStamp" */ 230, /* "id-smime-aa-ets-otherSigCert" */ 235, /* "id-smime-aa-ets-revocationValues" */ 226, /* "id-smime-aa-ets-sigPolicyId" */ 229, /* "id-smime-aa-ets-signerAttr" */ 228, /* "id-smime-aa-ets-signerLocation" */ 219, /* "id-smime-aa-macValue" */ 214, /* "id-smime-aa-mlExpandHistory" */ 216, /* "id-smime-aa-msgSigDigest" */ 212, /* "id-smime-aa-receiptRequest" */ 213, /* "id-smime-aa-securityLabel" */ 239, /* "id-smime-aa-signatureType" */ 223, /* "id-smime-aa-signingCertificate" */ 1086, /* "id-smime-aa-signingCertificateV2" */ 224, /* "id-smime-aa-smimeEncryptCerts" */ 225, /* "id-smime-aa-timeStampToken" */ 192, /* "id-smime-alg" */ 243, /* "id-smime-alg-3DESwrap" */ 246, /* "id-smime-alg-CMS3DESwrap" */ 247, /* "id-smime-alg-CMSRC2wrap" */ 245, /* "id-smime-alg-ESDH" */ 241, /* "id-smime-alg-ESDHwith3DES" */ 242, /* "id-smime-alg-ESDHwithRC2" */ 244, /* "id-smime-alg-RC2wrap" */ 193, /* "id-smime-cd" */ 248, /* "id-smime-cd-ldap" */ 190, /* "id-smime-ct" */ 210, /* "id-smime-ct-DVCSRequestData" */ 211, /* "id-smime-ct-DVCSResponseData" */ 208, /* "id-smime-ct-TDTInfo" */ 207, /* "id-smime-ct-TSTInfo" */ 205, /* "id-smime-ct-authData" */ 1059, /* "id-smime-ct-authEnvelopedData" */ 786, /* "id-smime-ct-compressedData" */ 1058, /* "id-smime-ct-contentCollection" */ 209, /* "id-smime-ct-contentInfo" */ 206, /* "id-smime-ct-publishCert" */ 204, /* "id-smime-ct-receipt" */ 195, /* "id-smime-cti" */ 255, /* "id-smime-cti-ets-proofOfApproval" */ 256, /* "id-smime-cti-ets-proofOfCreation" */ 253, /* "id-smime-cti-ets-proofOfDelivery" */ 251, /* "id-smime-cti-ets-proofOfOrigin" */ 252, /* "id-smime-cti-ets-proofOfReceipt" */ 254, /* "id-smime-cti-ets-proofOfSender" */ 189, /* "id-smime-mod" */ 196, /* "id-smime-mod-cms" */ 197, /* "id-smime-mod-ess" */ 202, /* "id-smime-mod-ets-eSigPolicy-88" */ 203, /* "id-smime-mod-ets-eSigPolicy-97" */ 200, /* "id-smime-mod-ets-eSignature-88" */ 201, /* "id-smime-mod-ets-eSignature-97" */ 199, /* "id-smime-mod-msg-v3" */ 198, /* "id-smime-mod-oid" */ 194, /* "id-smime-spq" */ 250, /* "id-smime-spq-ets-sqt-unotice" */ 249, /* "id-smime-spq-ets-sqt-uri" */ 974, /* "id-tc26" */ 991, /* "id-tc26-agreement" */ 992, /* "id-tc26-agreement-gost-3410-2012-256" */ 993, /* "id-tc26-agreement-gost-3410-2012-512" */ 977, /* "id-tc26-algorithms" */ 990, /* "id-tc26-cipher" */ 1001, /* "id-tc26-cipher-constants" */ 1176, /* "id-tc26-cipher-gostr3412-2015-kuznyechik" */ 1173, /* "id-tc26-cipher-gostr3412-2015-magma" */ 994, /* "id-tc26-constants" */ 981, /* "id-tc26-digest" */ 1000, /* "id-tc26-digest-constants" */ 1002, /* "id-tc26-gost-28147-constants" */ 1003, /* "id-tc26-gost-28147-param-Z" */ 1147, /* "id-tc26-gost-3410-2012-256-constants" */ 1148, /* "id-tc26-gost-3410-2012-256-paramSetA" */ 1184, /* "id-tc26-gost-3410-2012-256-paramSetB" */ 1185, /* "id-tc26-gost-3410-2012-256-paramSetC" */ 1186, /* "id-tc26-gost-3410-2012-256-paramSetD" */ 996, /* "id-tc26-gost-3410-2012-512-constants" */ 998, /* "id-tc26-gost-3410-2012-512-paramSetA" */ 999, /* "id-tc26-gost-3410-2012-512-paramSetB" */ 1149, /* "id-tc26-gost-3410-2012-512-paramSetC" */ 997, /* "id-tc26-gost-3410-2012-512-paramSetTest" */ 988, /* "id-tc26-hmac-gost-3411-2012-256" */ 989, /* "id-tc26-hmac-gost-3411-2012-512" */ 987, /* "id-tc26-mac" */ 978, /* "id-tc26-sign" */ 995, /* "id-tc26-sign-constants" */ 984, /* "id-tc26-signwithdigest" */ 985, /* "id-tc26-signwithdigest-gost3410-2012-256" */ 986, /* "id-tc26-signwithdigest-gost3410-2012-512" */ 1179, /* "id-tc26-wrap" */ 1182, /* "id-tc26-wrap-gostr3412-2015-kuznyechik" */ 1180, /* "id-tc26-wrap-gostr3412-2015-magma" */ 676, /* "identified-organization" */ 1170, /* "ieee" */ 1171, /* "ieee-siswg" */ 1305, /* "indirectIssuer" */ 461, /* "info" */ 748, /* "inhibitAnyPolicy" */ 101, /* "initials" */ 647, /* "international-organizations" */ 869, /* "internationaliSDNNumber" */ 142, /* "invalidityDate" */ 1241, /* "ipAddr-asNumber" */ 1242, /* "ipAddr-asNumberv2" */ 294, /* "ipsecEndSystem" */ 1022, /* "ipsecIKE" */ 295, /* "ipsecTunnel" */ 296, /* "ipsecUser" */ 1308, /* "issuedOnBehalfOf" */ 86, /* "issuerAltName" */ 1008, /* "issuerSignTool" */ 770, /* "issuingDistributionPoint" */ 1264, /* "itu-t-identified-organization" */ 492, /* "janetMailbox" */ 957, /* "jurisdictionC" */ 955, /* "jurisdictionL" */ 956, /* "jurisdictionST" */ 150, /* "keyBag" */ 83, /* "keyUsage" */ 1015, /* "kuznyechik-cbc" */ 1016, /* "kuznyechik-cfb" */ 1013, /* "kuznyechik-ctr" */ 1177, /* "kuznyechik-ctr-acpkm" */ 1178, /* "kuznyechik-ctr-acpkm-omac" */ 1012, /* "kuznyechik-ecb" */ 1183, /* "kuznyechik-kexp15" */ 1017, /* "kuznyechik-mac" */ 1014, /* "kuznyechik-ofb" */ 477, /* "lastModifiedBy" */ 476, /* "lastModifiedTime" */ 157, /* "localKeyID" */ 480, /* "mXRecord" */ 1190, /* "magma-cbc" */ 1191, /* "magma-cfb" */ 1188, /* "magma-ctr" */ 1174, /* "magma-ctr-acpkm" */ 1175, /* "magma-ctr-acpkm-omac" */ 1187, /* "magma-ecb" */ 1181, /* "magma-kexp15" */ 1192, /* "magma-mac" */ 1189, /* "magma-ofb" */ 460, /* "mail" */ 493, /* "mailPreferenceOption" */ 467, /* "manager" */ 982, /* "md_gost12_256" */ 983, /* "md_gost12_512" */ 809, /* "md_gost94" */ 875, /* "member" */ 182, /* "member-body" */ 51, /* "messageDigest" */ 383, /* "mgmt" */ 504, /* "mime-mhs" */ 506, /* "mime-mhs-bodies" */ 505, /* "mime-mhs-headings" */ 488, /* "mobileTelephoneNumber" */ 1212, /* "modp_1536" */ 1213, /* "modp_2048" */ 1214, /* "modp_3072" */ 1215, /* "modp_4096" */ 1216, /* "modp_6144" */ 1217, /* "modp_8192" */ 1294, /* "ms-app-policies" */ 1293, /* "ms-cert-templ" */ 1291, /* "ms-ntds-obj-sid" */ 1292, /* "ms-ntds-sec-ext" */ 136, /* "msCTLSign" */ 135, /* "msCodeCom" */ 134, /* "msCodeInd" */ 138, /* "msEFS" */ 171, /* "msExtReq" */ 137, /* "msSGC" */ 648, /* "msSmartcardLogin" */ 649, /* "msUPN" */ 1091, /* "n3" */ 481, /* "nSRecord" */ 173, /* "name" */ 666, /* "nameConstraints" */ 1306, /* "noAssertion" */ 369, /* "noCheck" */ 403, /* "noRevAvail" */ 72, /* "nsBaseUrl" */ 76, /* "nsCaPolicyUrl" */ 74, /* "nsCaRevocationUrl" */ 58, /* "nsCertExt" */ 79, /* "nsCertSequence" */ 71, /* "nsCertType" */ 78, /* "nsComment" */ 59, /* "nsDataType" */ 75, /* "nsRenewalUrl" */ 73, /* "nsRevocationUrl" */ 139, /* "nsSGC" */ 77, /* "nsSslServerName" */ 681, /* "onBasis" */ 1283, /* "oracle-jdk-trustedkeyusage" */ 1282, /* "oracle-organization" */ 1089, /* "organizationIdentifier" */ 491, /* "organizationalStatus" */ 1141, /* "oscca" */ 475, /* "otherMailbox" */ 876, /* "owner" */ 489, /* "pagerTelephoneNumber" */ 374, /* "path" */ 112, /* "pbeWithMD5AndCast5CBC" */ 499, /* "personalSignature" */ 487, /* "personalTitle" */ 464, /* "photo" */ 863, /* "physicalDeliveryOfficeName" */ 437, /* "pilot" */ 439, /* "pilotAttributeSyntax" */ 438, /* "pilotAttributeType" */ 479, /* "pilotAttributeType27" */ 456, /* "pilotDSA" */ 441, /* "pilotGroups" */ 444, /* "pilotObject" */ 440, /* "pilotObjectClass" */ 455, /* "pilotOrganization" */ 445, /* "pilotPerson" */ 1032, /* "pkInitClientAuth" */ 1033, /* "pkInitKDC" */ 2, /* "pkcs" */ 186, /* "pkcs1" */ 27, /* "pkcs3" */ 187, /* "pkcs5" */ 20, /* "pkcs7" */ 21, /* "pkcs7-data" */ 25, /* "pkcs7-digestData" */ 26, /* "pkcs7-encryptedData" */ 23, /* "pkcs7-envelopedData" */ 24, /* "pkcs7-signedAndEnvelopedData" */ 22, /* "pkcs7-signedData" */ 151, /* "pkcs8ShroudedKeyBag" */ 47, /* "pkcs9" */ 401, /* "policyConstraints" */ 747, /* "policyMappings" */ 862, /* "postOfficeBox" */ 861, /* "postalAddress" */ 661, /* "postalCode" */ 683, /* "ppBasis" */ 872, /* "preferredDeliveryMethod" */ 873, /* "presentationAddress" */ 816, /* "prf-gostr3411-94" */ 406, /* "prime-field" */ 409, /* "prime192v1" */ 410, /* "prime192v2" */ 411, /* "prime192v3" */ 412, /* "prime239v1" */ 413, /* "prime239v2" */ 414, /* "prime239v3" */ 415, /* "prime256v1" */ 385, /* "private" */ 84, /* "privateKeyUsagePeriod" */ 1315, /* "protRestrict" */ 886, /* "protocolInformation" */ 663, /* "proxyCertInfo" */ 510, /* "pseudonym" */ 435, /* "pss" */ 286, /* "qcStatements" */ 457, /* "qualityLabelledData" */ 450, /* "rFC822localPart" */ 870, /* "registeredAddress" */ 400, /* "role" */ 877, /* "roleOccupant" */ 1296, /* "roleSpecCertIdentifier" */ 448, /* "room" */ 463, /* "roomNumber" */ 1243, /* "rpkiManifest" */ 1245, /* "rpkiNotify" */ 6, /* "rsaEncryption" */ 644, /* "rsaOAEPEncryptionSET" */ 377, /* "rsaSignature" */ 1, /* "rsadsi" */ 1302, /* "sOAIdentifier" */ 482, /* "sOARecord" */ 155, /* "safeContentsBag" */ 291, /* "sbgp-autonomousSysNum" */ 1240, /* "sbgp-autonomousSysNumv2" */ 290, /* "sbgp-ipAddrBlock" */ 1239, /* "sbgp-ipAddrBlockv2" */ 292, /* "sbgp-routerIdentifier" */ 159, /* "sdsiCertificate" */ 859, /* "searchGuide" */ 704, /* "secp112r1" */ 705, /* "secp112r2" */ 706, /* "secp128r1" */ 707, /* "secp128r2" */ 708, /* "secp160k1" */ 709, /* "secp160r1" */ 710, /* "secp160r2" */ 711, /* "secp192k1" */ 712, /* "secp224k1" */ 713, /* "secp224r1" */ 714, /* "secp256k1" */ 715, /* "secp384r1" */ 716, /* "secp521r1" */ 154, /* "secretBag" */ 474, /* "secretary" */ 717, /* "sect113r1" */ 718, /* "sect113r2" */ 719, /* "sect131r1" */ 720, /* "sect131r2" */ 721, /* "sect163k1" */ 722, /* "sect163r1" */ 723, /* "sect163r2" */ 724, /* "sect193r1" */ 725, /* "sect193r2" */ 726, /* "sect233k1" */ 727, /* "sect233r1" */ 728, /* "sect239k1" */ 729, /* "sect283k1" */ 730, /* "sect283r1" */ 731, /* "sect409k1" */ 732, /* "sect409r1" */ 733, /* "sect571k1" */ 734, /* "sect571r1" */ 1025, /* "secureShellClient" */ 1026, /* "secureShellServer" */ 386, /* "security" */ 878, /* "seeAlso" */ 394, /* "selected-attribute-types" */ 1029, /* "sendOwner" */ 1030, /* "sendProxiedOwner" */ 1028, /* "sendProxiedRouter" */ 1027, /* "sendRouter" */ 105, /* "serialNumber" */ 129, /* "serverAuth" */ 371, /* "serviceLocator" */ 625, /* "set-addPolicy" */ 515, /* "set-attr" */ 518, /* "set-brand" */ 638, /* "set-brand-AmericanExpress" */ 637, /* "set-brand-Diners" */ 636, /* "set-brand-IATA-ATA" */ 639, /* "set-brand-JCB" */ 641, /* "set-brand-MasterCard" */ 642, /* "set-brand-Novus" */ 640, /* "set-brand-Visa" */ 517, /* "set-certExt" */ 513, /* "set-ctype" */ 514, /* "set-msgExt" */ 516, /* "set-policy" */ 607, /* "set-policy-root" */ 624, /* "set-rootKeyThumb" */ 620, /* "setAttr-Cert" */ 631, /* "setAttr-GenCryptgrm" */ 623, /* "setAttr-IssCap" */ 628, /* "setAttr-IssCap-CVM" */ 630, /* "setAttr-IssCap-Sig" */ 629, /* "setAttr-IssCap-T2" */ 621, /* "setAttr-PGWYcap" */ 635, /* "setAttr-SecDevSig" */ 632, /* "setAttr-T2Enc" */ 633, /* "setAttr-T2cleartxt" */ 634, /* "setAttr-TokICCsig" */ 627, /* "setAttr-Token-B0Prime" */ 626, /* "setAttr-Token-EMV" */ 622, /* "setAttr-TokenType" */ 619, /* "setCext-IssuerCapabilities" */ 615, /* "setCext-PGWYcapabilities" */ 616, /* "setCext-TokenIdentifier" */ 618, /* "setCext-TokenType" */ 617, /* "setCext-Track2Data" */ 611, /* "setCext-cCertRequired" */ 609, /* "setCext-certType" */ 608, /* "setCext-hashedRoot" */ 610, /* "setCext-merchData" */ 613, /* "setCext-setExt" */ 614, /* "setCext-setQualf" */ 612, /* "setCext-tunneling" */ 540, /* "setct-AcqCardCodeMsg" */ 576, /* "setct-AcqCardCodeMsgTBE" */ 570, /* "setct-AuthReqTBE" */ 534, /* "setct-AuthReqTBS" */ 527, /* "setct-AuthResBaggage" */ 571, /* "setct-AuthResTBE" */ 572, /* "setct-AuthResTBEX" */ 535, /* "setct-AuthResTBS" */ 536, /* "setct-AuthResTBSX" */ 528, /* "setct-AuthRevReqBaggage" */ 577, /* "setct-AuthRevReqTBE" */ 541, /* "setct-AuthRevReqTBS" */ 529, /* "setct-AuthRevResBaggage" */ 542, /* "setct-AuthRevResData" */ 578, /* "setct-AuthRevResTBE" */ 579, /* "setct-AuthRevResTBEB" */ 543, /* "setct-AuthRevResTBS" */ 573, /* "setct-AuthTokenTBE" */ 537, /* "setct-AuthTokenTBS" */ 600, /* "setct-BCIDistributionTBS" */ 558, /* "setct-BatchAdminReqData" */ 592, /* "setct-BatchAdminReqTBE" */ 559, /* "setct-BatchAdminResData" */ 593, /* "setct-BatchAdminResTBE" */ 599, /* "setct-CRLNotificationResTBS" */ 598, /* "setct-CRLNotificationTBS" */ 580, /* "setct-CapReqTBE" */ 581, /* "setct-CapReqTBEX" */ 544, /* "setct-CapReqTBS" */ 545, /* "setct-CapReqTBSX" */ 546, /* "setct-CapResData" */ 582, /* "setct-CapResTBE" */ 583, /* "setct-CapRevReqTBE" */ 584, /* "setct-CapRevReqTBEX" */ 547, /* "setct-CapRevReqTBS" */ 548, /* "setct-CapRevReqTBSX" */ 549, /* "setct-CapRevResData" */ 585, /* "setct-CapRevResTBE" */ 538, /* "setct-CapTokenData" */ 530, /* "setct-CapTokenSeq" */ 574, /* "setct-CapTokenTBE" */ 575, /* "setct-CapTokenTBEX" */ 539, /* "setct-CapTokenTBS" */ 560, /* "setct-CardCInitResTBS" */ 566, /* "setct-CertInqReqTBS" */ 563, /* "setct-CertReqData" */ 595, /* "setct-CertReqTBE" */ 596, /* "setct-CertReqTBEX" */ 564, /* "setct-CertReqTBS" */ 565, /* "setct-CertResData" */ 597, /* "setct-CertResTBE" */ 586, /* "setct-CredReqTBE" */ 587, /* "setct-CredReqTBEX" */ 550, /* "setct-CredReqTBS" */ 551, /* "setct-CredReqTBSX" */ 552, /* "setct-CredResData" */ 588, /* "setct-CredResTBE" */ 589, /* "setct-CredRevReqTBE" */ 590, /* "setct-CredRevReqTBEX" */ 553, /* "setct-CredRevReqTBS" */ 554, /* "setct-CredRevReqTBSX" */ 555, /* "setct-CredRevResData" */ 591, /* "setct-CredRevResTBE" */ 567, /* "setct-ErrorTBS" */ 526, /* "setct-HODInput" */ 561, /* "setct-MeAqCInitResTBS" */ 522, /* "setct-OIData" */ 519, /* "setct-PANData" */ 521, /* "setct-PANOnly" */ 520, /* "setct-PANToken" */ 556, /* "setct-PCertReqData" */ 557, /* "setct-PCertResTBS" */ 523, /* "setct-PI" */ 532, /* "setct-PI-TBS" */ 524, /* "setct-PIData" */ 525, /* "setct-PIDataUnsigned" */ 568, /* "setct-PIDualSignedTBE" */ 569, /* "setct-PIUnsignedTBE" */ 531, /* "setct-PInitResData" */ 533, /* "setct-PResData" */ 594, /* "setct-RegFormReqTBE" */ 562, /* "setct-RegFormResTBS" */ 606, /* "setext-cv" */ 601, /* "setext-genCrypt" */ 602, /* "setext-miAuth" */ 604, /* "setext-pinAny" */ 603, /* "setext-pinSecure" */ 605, /* "setext-track2" */ 1279, /* "signedAssertion" */ 1244, /* "signedObject" */ 52, /* "signingTime" */ 454, /* "simpleSecurityObject" */ 496, /* "singleLevelQuality" */ 1309, /* "singleUse" */ 1142, /* "sm-scheme" */ 387, /* "snmpv2" */ 660, /* "street" */ 85, /* "subjectAltName" */ 1316, /* "subjectAltPublicKeyInfo" */ 769, /* "subjectDirectoryAttributes" */ 398, /* "subjectInfoAccess" */ 82, /* "subjectKeyIdentifier" */ 1007, /* "subjectSignTool" */ 498, /* "subtreeMaximumQuality" */ 497, /* "subtreeMinimumQuality" */ 890, /* "supportedAlgorithms" */ 874, /* "supportedApplicationContext" */ 402, /* "targetInformation" */ 864, /* "telephoneNumber" */ 866, /* "teletexTerminalIdentifier" */ 865, /* "telexNumber" */ 459, /* "textEncodedORAddress" */ 293, /* "textNotice" */ 1299, /* "timeSpecification" */ 133, /* "timeStamping" */ 106, /* "title" */ 1020, /* "tlsfeature" */ 682, /* "tpBasis" */ 375, /* "trustRoot" */ 1151, /* "ua-pki" */ 1160, /* "uacurve0" */ 1161, /* "uacurve1" */ 1162, /* "uacurve2" */ 1163, /* "uacurve3" */ 1164, /* "uacurve4" */ 1165, /* "uacurve5" */ 1166, /* "uacurve6" */ 1167, /* "uacurve7" */ 1168, /* "uacurve8" */ 1169, /* "uacurve9" */ 436, /* "ucl" */ 102, /* "uid" */ 888, /* "uniqueMember" */ 55, /* "unstructuredAddress" */ 49, /* "unstructuredName" */ 880, /* "userCertificate" */ 465, /* "userClass" */ 1301, /* "userNotice" */ 879, /* "userPassword" */ 373, /* "valid" */ 678, /* "wap" */ 679, /* "wap-wsg" */ 735, /* "wap-wsg-idm-ecid-wtls1" */ 743, /* "wap-wsg-idm-ecid-wtls10" */ 744, /* "wap-wsg-idm-ecid-wtls11" */ 745, /* "wap-wsg-idm-ecid-wtls12" */ 736, /* "wap-wsg-idm-ecid-wtls3" */ 737, /* "wap-wsg-idm-ecid-wtls4" */ 738, /* "wap-wsg-idm-ecid-wtls5" */ 739, /* "wap-wsg-idm-ecid-wtls6" */ 740, /* "wap-wsg-idm-ecid-wtls7" */ 741, /* "wap-wsg-idm-ecid-wtls8" */ 742, /* "wap-wsg-idm-ecid-wtls9" */ 804, /* "whirlpool" */ 868, /* "x121Address" */ 503, /* "x500UniqueIdentifier" */ 158, /* "x509Certificate" */ 160, /* "x509Crl" */ 1093, /* "x509ExtAdmission" */ 1289, /* "zstd" */ }; #define NUM_LN 1311 static const unsigned int ln_objs[NUM_LN] = { 363, /* "AD Time Stamping" */ 405, /* "ANSI X9.62" */ 368, /* "Acceptable OCSP Responses" */ 910, /* "Any Extended Key Usage" */ 664, /* "Any language" */ 177, /* "Authority Information Access" */ 1220, /* "BGPsec Router" */ 365, /* "Basic OCSP Response" */ 285, /* "Biometric Info" */ 1221, /* "Brand Indicator for Message Identification" */ 1288, /* "Brotli compression" */ 179, /* "CA Issuers" */ 785, /* "CA Repository" */ 1219, /* "CMC Archive Server" */ 1131, /* "CMC Certificate Authority" */ 1132, /* "CMC Registration Authority" */ 954, /* "CT Certificate SCTs" */ 952, /* "CT Precertificate Poison" */ 951, /* "CT Precertificate SCTs" */ 953, /* "CT Precertificate Signer" */ 1222, /* "Certificate Management Key Generation Authority" */ 1227, /* "Class of Signing Tool" */ 1233, /* "Class of Signing Tool KA1" */ 1231, /* "Class of Signing Tool KB1" */ 1232, /* "Class of Signing Tool KB2" */ 1228, /* "Class of Signing Tool KC1" */ 1229, /* "Class of Signing Tool KC2" */ 1230, /* "Class of Signing Tool KC3" */ 131, /* "Code Signing" */ 1024, /* "Ctrl/Provision WAP Termination" */ 1023, /* "Ctrl/provision WAP Access" */ 1159, /* "DSTU 4145-2002 big endian" */ 1158, /* "DSTU 4145-2002 little endian" */ 1152, /* "DSTU Gost 28147-2009" */ 1154, /* "DSTU Gost 28147-2009 CFB mode" */ 1153, /* "DSTU Gost 28147-2009 OFB mode" */ 1155, /* "DSTU Gost 28147-2009 key wrap" */ 1157, /* "DSTU Gost 34311-95" */ 1160, /* "DSTU curve 0" */ 1161, /* "DSTU curve 1" */ 1162, /* "DSTU curve 2" */ 1163, /* "DSTU curve 3" */ 1164, /* "DSTU curve 4" */ 1165, /* "DSTU curve 5" */ 1166, /* "DSTU curve 6" */ 1167, /* "DSTU curve 7" */ 1168, /* "DSTU curve 8" */ 1169, /* "DSTU curve 9" */ 783, /* "Diffie-Hellman based MAC" */ 382, /* "Directory" */ 392, /* "Domain" */ 132, /* "E-mail Protection" */ 1087, /* "ED25519" */ 1088, /* "ED448" */ 389, /* "Enterprises" */ 384, /* "Experimental" */ 372, /* "Extended OCSP Status" */ 172, /* "Extension Request" */ 813, /* "GOST 28147-89" */ 849, /* "GOST 28147-89 Cryptocom ParamSet" */ 815, /* "GOST 28147-89 MAC" */ 1003, /* "GOST 28147-89 TC26 parameter set" */ 851, /* "GOST 34.10-2001 Cryptocom" */ 850, /* "GOST 34.10-94 Cryptocom" */ 811, /* "GOST R 34.10-2001" */ 817, /* "GOST R 34.10-2001 DH" */ 1148, /* "GOST R 34.10-2012 (256 bit) ParamSet A" */ 1184, /* "GOST R 34.10-2012 (256 bit) ParamSet B" */ 1185, /* "GOST R 34.10-2012 (256 bit) ParamSet C" */ 1186, /* "GOST R 34.10-2012 (256 bit) ParamSet D" */ 998, /* "GOST R 34.10-2012 (512 bit) ParamSet A" */ 999, /* "GOST R 34.10-2012 (512 bit) ParamSet B" */ 1149, /* "GOST R 34.10-2012 (512 bit) ParamSet C" */ 997, /* "GOST R 34.10-2012 (512 bit) testing parameter set" */ 979, /* "GOST R 34.10-2012 with 256 bit modulus" */ 980, /* "GOST R 34.10-2012 with 512 bit modulus" */ 985, /* "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)" */ 986, /* "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)" */ 812, /* "GOST R 34.10-94" */ 818, /* "GOST R 34.10-94 DH" */ 982, /* "GOST R 34.11-2012 with 256 bit hash" */ 983, /* "GOST R 34.11-2012 with 512 bit hash" */ 809, /* "GOST R 34.11-94" */ 816, /* "GOST R 34.11-94 PRF" */ 807, /* "GOST R 34.11-94 with GOST R 34.10-2001" */ 853, /* "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" */ 808, /* "GOST R 34.11-94 with GOST R 34.10-94" */ 852, /* "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" */ 854, /* "GOST R 3410-2001 Parameter Set Cryptocom" */ 1156, /* "HMAC DSTU Gost 34311-95" */ 988, /* "HMAC GOST 34.11-2012 256 bit" */ 989, /* "HMAC GOST 34.11-2012 512 bit" */ 810, /* "HMAC GOST 34.11-94" */ 432, /* "Hold Instruction Call Issuer" */ 430, /* "Hold Instruction Code" */ 431, /* "Hold Instruction None" */ 433, /* "Hold Instruction Reject" */ 634, /* "ICC or token signature" */ 1171, /* "IEEE Security in Storage Working Group" */ 1004, /* "INN" */ 294, /* "IPSec End System" */ 295, /* "IPSec Tunnel" */ 296, /* "IPSec User" */ 1140, /* "ISO CN Member Body" */ 182, /* "ISO Member Body" */ 183, /* "ISO US Member Body" */ 1150, /* "ISO-UA" */ 667, /* "Independent" */ 665, /* "Inherit all" */ 647, /* "International Organizations" */ 142, /* "Invalidity Date" */ 504, /* "MIME MHS" */ 388, /* "Mail" */ 383, /* "Management" */ 1294, /* "Microsoft Application Policies Extension" */ 417, /* "Microsoft CSP Name" */ 135, /* "Microsoft Commercial Code Signing" */ 138, /* "Microsoft Encrypted File System" */ 171, /* "Microsoft Extension Request" */ 134, /* "Microsoft Individual Code Signing" */ 856, /* "Microsoft Local Key set" */ 1291, /* "Microsoft NTDS AD objectSid" */ 1292, /* "Microsoft NTDS CA Extension" */ 137, /* "Microsoft Server Gated Crypto" */ 648, /* "Microsoft Smartcard Login" */ 136, /* "Microsoft Trust List Signing" */ 649, /* "Microsoft User Principal Name" */ 1293, /* "Microsoft certificate template" */ 1211, /* "NAIRealm" */ 393, /* "NULL" */ 404, /* "NULL" */ 72, /* "Netscape Base Url" */ 76, /* "Netscape CA Policy Url" */ 74, /* "Netscape CA Revocation Url" */ 71, /* "Netscape Cert Type" */ 58, /* "Netscape Certificate Extension" */ 79, /* "Netscape Certificate Sequence" */ 78, /* "Netscape Comment" */ 57, /* "Netscape Communications Corp." */ 59, /* "Netscape Data Type" */ 75, /* "Netscape Renewal Url" */ 73, /* "Netscape Revocation Url" */ 77, /* "Netscape SSL Server Name" */ 139, /* "Netscape Server Gated Crypto" */ 178, /* "OCSP" */ 370, /* "OCSP Archive Cutoff" */ 367, /* "OCSP CRL ID" */ 369, /* "OCSP No Check" */ 366, /* "OCSP Nonce" */ 371, /* "OCSP Service Locator" */ 180, /* "OCSP Signing" */ 1005, /* "OGRN" */ 1226, /* "OGRNIP" */ 1282, /* "Oracle organization" */ 161, /* "PBES2" */ 69, /* "PBKDF2" */ 162, /* "PBMAC1" */ 1032, /* "PKINIT Client Auth" */ 127, /* "PKIX" */ 858, /* "Permanent Identifier" */ 164, /* "Policy Qualifier CPS" */ 165, /* "Policy Qualifier User Notice" */ 385, /* "Private" */ 1093, /* "Professional Information or basis for Admission" */ 663, /* "Proxy Certificate Information" */ 1243, /* "RPKI Manifest" */ 1245, /* "RPKI Notify" */ 1, /* "RSA Data Security, Inc." */ 2, /* "RSA Data Security, Inc. PKCS" */ 1116, /* "RSA-SHA3-224" */ 1117, /* "RSA-SHA3-256" */ 1118, /* "RSA-SHA3-384" */ 1119, /* "RSA-SHA3-512" */ 188, /* "S/MIME" */ 167, /* "S/MIME Capabilities" */ 1204, /* "SM2-with-SM3" */ 1006, /* "SNILS" */ 387, /* "SNMPv2" */ 1210, /* "SRVName" */ 1025, /* "SSH Client" */ 1026, /* "SSH Server" */ 512, /* "Secure Electronic Transactions" */ 386, /* "Security" */ 394, /* "Selected Attribute Types" */ 1029, /* "Send Owner" */ 1030, /* "Send Proxied Owner" */ 1028, /* "Send Proxied Router" */ 1027, /* "Send Router" */ 1244, /* "Signed Object" */ 1033, /* "Signing KDC Response" */ 1008, /* "Signing Tool of Issuer" */ 1007, /* "Signing Tool of Subject" */ 1208, /* "Smtp UTF8 Mailbox" */ 143, /* "Strong Extranet ID" */ 398, /* "Subject Information Access" */ 1020, /* "TLS Feature" */ 130, /* "TLS Web Client Authentication" */ 129, /* "TLS Web Server Authentication" */ 133, /* "Time Stamping" */ 375, /* "Trust Root" */ 1283, /* "Trusted key usage (Oracle)" */ 1034, /* "X25519" */ 1035, /* "X448" */ 12, /* "X509" */ 402, /* "X509v3 AC Targeting" */ 1303, /* "X509v3 Acceptable Certification Policies" */ 1304, /* "X509v3 Acceptable Privilege Policies" */ 1311, /* "X509v3 Allowed Attribute Assignments" */ 1317, /* "X509v3 Alternative Signature Algorithm" */ 1318, /* "X509v3 Alternative Signature Value" */ 746, /* "X509v3 Any Policy" */ 1319, /* "X509v3 Associated Information" */ 1307, /* "X509v3 Attribute Authority Issuing Distribution Point" */ 1300, /* "X509v3 Attribute Descriptor" */ 1312, /* "X509v3 Attribute Mappings" */ 1295, /* "X509v3 Authority Attribute Identifier" */ 90, /* "X509v3 Authority Key Identifier" */ 1314, /* "X509v3 Authorization Validation" */ 1297, /* "X509v3 Basic Attribute Certificate Constraints" */ 87, /* "X509v3 Basic Constraints" */ 103, /* "X509v3 CRL Distribution Points" */ 88, /* "X509v3 CRL Number" */ 141, /* "X509v3 CRL Reason Code" */ 771, /* "X509v3 Certificate Issuer" */ 89, /* "X509v3 Certificate Policies" */ 1298, /* "X509v3 Delegated Name Constraints" */ 140, /* "X509v3 Delta CRL Indicator" */ 126, /* "X509v3 Extended Key Usage" */ 857, /* "X509v3 Freshest CRL" */ 1310, /* "X509v3 Group Attribute Certificate" */ 1313, /* "X509v3 Holder Name Constraints" */ 1305, /* "X509v3 Indirect Issuer" */ 748, /* "X509v3 Inhibit Any Policy" */ 1308, /* "X509v3 Issued On Behalf Of" */ 86, /* "X509v3 Issuer Alternative Name" */ 770, /* "X509v3 Issuing Distribution Point" */ 83, /* "X509v3 Key Usage" */ 666, /* "X509v3 Name Constraints" */ 1306, /* "X509v3 No Assertion" */ 403, /* "X509v3 No Revocation Available" */ 401, /* "X509v3 Policy Constraints" */ 747, /* "X509v3 Policy Mappings" */ 84, /* "X509v3 Private Key Usage Period" */ 1315, /* "X509v3 Protocol Restriction" */ 1296, /* "X509v3 Role Specification Certificate Identifier" */ 1309, /* "X509v3 Single Use" */ 1302, /* "X509v3 Source of Authority Identifier" */ 85, /* "X509v3 Subject Alternative Name" */ 1316, /* "X509v3 Subject Alternative Public Key Info" */ 769, /* "X509v3 Subject Directory Attributes" */ 82, /* "X509v3 Subject Key Identifier" */ 1299, /* "X509v3 Time Specification" */ 1301, /* "X509v3 User Notice" */ 920, /* "X9.42 DH" */ 184, /* "X9.57" */ 185, /* "X9.57 CM ?" */ 1209, /* "XmppAddr" */ 1289, /* "Zstandard compression" */ 478, /* "aRecord" */ 289, /* "aaControls" */ 287, /* "ac-auditEntity" */ 397, /* "ac-proxying" */ 288, /* "ac-targeting" */ 446, /* "account" */ 364, /* "ad dvcs" */ 606, /* "additional verification" */ 419, /* "aes-128-cbc" */ 916, /* "aes-128-cbc-hmac-sha1" */ 948, /* "aes-128-cbc-hmac-sha256" */ 896, /* "aes-128-ccm" */ 421, /* "aes-128-cfb" */ 650, /* "aes-128-cfb1" */ 653, /* "aes-128-cfb8" */ 904, /* "aes-128-ctr" */ 418, /* "aes-128-ecb" */ 895, /* "aes-128-gcm" */ 958, /* "aes-128-ocb" */ 420, /* "aes-128-ofb" */ 1198, /* "aes-128-siv" */ 913, /* "aes-128-xts" */ 423, /* "aes-192-cbc" */ 917, /* "aes-192-cbc-hmac-sha1" */ 949, /* "aes-192-cbc-hmac-sha256" */ 899, /* "aes-192-ccm" */ 425, /* "aes-192-cfb" */ 651, /* "aes-192-cfb1" */ 654, /* "aes-192-cfb8" */ 905, /* "aes-192-ctr" */ 422, /* "aes-192-ecb" */ 898, /* "aes-192-gcm" */ 959, /* "aes-192-ocb" */ 424, /* "aes-192-ofb" */ 1199, /* "aes-192-siv" */ 427, /* "aes-256-cbc" */ 918, /* "aes-256-cbc-hmac-sha1" */ 950, /* "aes-256-cbc-hmac-sha256" */ 902, /* "aes-256-ccm" */ 429, /* "aes-256-cfb" */ 652, /* "aes-256-cfb1" */ 655, /* "aes-256-cfb8" */ 906, /* "aes-256-ctr" */ 426, /* "aes-256-ecb" */ 901, /* "aes-256-gcm" */ 960, /* "aes-256-ocb" */ 428, /* "aes-256-ofb" */ 1200, /* "aes-256-siv" */ 914, /* "aes-256-xts" */ 376, /* "algorithm" */ 1066, /* "aria-128-cbc" */ 1120, /* "aria-128-ccm" */ 1067, /* "aria-128-cfb" */ 1080, /* "aria-128-cfb1" */ 1083, /* "aria-128-cfb8" */ 1069, /* "aria-128-ctr" */ 1065, /* "aria-128-ecb" */ 1123, /* "aria-128-gcm" */ 1068, /* "aria-128-ofb" */ 1071, /* "aria-192-cbc" */ 1121, /* "aria-192-ccm" */ 1072, /* "aria-192-cfb" */ 1081, /* "aria-192-cfb1" */ 1084, /* "aria-192-cfb8" */ 1074, /* "aria-192-ctr" */ 1070, /* "aria-192-ecb" */ 1124, /* "aria-192-gcm" */ 1073, /* "aria-192-ofb" */ 1076, /* "aria-256-cbc" */ 1122, /* "aria-256-ccm" */ 1077, /* "aria-256-cfb" */ 1082, /* "aria-256-cfb1" */ 1085, /* "aria-256-cfb8" */ 1079, /* "aria-256-ctr" */ 1075, /* "aria-256-ecb" */ 1125, /* "aria-256-gcm" */ 1078, /* "aria-256-ofb" */ 484, /* "associatedDomain" */ 485, /* "associatedName" */ 501, /* "audio" */ 1064, /* "auth-any" */ 1049, /* "auth-dss" */ 1047, /* "auth-ecdsa" */ 1050, /* "auth-gost01" */ 1051, /* "auth-gost12" */ 1053, /* "auth-null" */ 1048, /* "auth-psk" */ 1046, /* "auth-rsa" */ 1052, /* "auth-srp" */ 882, /* "authorityRevocationList" */ 91, /* "bf-cbc" */ 93, /* "bf-cfb" */ 92, /* "bf-ecb" */ 94, /* "bf-ofb" */ 1056, /* "blake2b512" */ 1201, /* "blake2bmac" */ 1057, /* "blake2s256" */ 1202, /* "blake2smac" */ 921, /* "brainpoolP160r1" */ 922, /* "brainpoolP160t1" */ 923, /* "brainpoolP192r1" */ 924, /* "brainpoolP192t1" */ 925, /* "brainpoolP224r1" */ 926, /* "brainpoolP224t1" */ 927, /* "brainpoolP256r1" */ 1285, /* "brainpoolP256r1tls13" */ 928, /* "brainpoolP256t1" */ 929, /* "brainpoolP320r1" */ 930, /* "brainpoolP320t1" */ 931, /* "brainpoolP384r1" */ 1286, /* "brainpoolP384r1tls13" */ 932, /* "brainpoolP384t1" */ 933, /* "brainpoolP512r1" */ 1287, /* "brainpoolP512r1tls13" */ 934, /* "brainpoolP512t1" */ 494, /* "buildingName" */ 860, /* "businessCategory" */ 691, /* "c2onb191v4" */ 692, /* "c2onb191v5" */ 697, /* "c2onb239v4" */ 698, /* "c2onb239v5" */ 684, /* "c2pnb163v1" */ 685, /* "c2pnb163v2" */ 686, /* "c2pnb163v3" */ 687, /* "c2pnb176v1" */ 693, /* "c2pnb208w1" */ 699, /* "c2pnb272w1" */ 700, /* "c2pnb304w1" */ 702, /* "c2pnb368w1" */ 688, /* "c2tnb191v1" */ 689, /* "c2tnb191v2" */ 690, /* "c2tnb191v3" */ 694, /* "c2tnb239v1" */ 695, /* "c2tnb239v2" */ 696, /* "c2tnb239v3" */ 701, /* "c2tnb359v1" */ 703, /* "c2tnb431r1" */ 881, /* "cACertificate" */ 483, /* "cNAMERecord" */ 1273, /* "cades" */ 1274, /* "cades-attributes" */ 751, /* "camellia-128-cbc" */ 962, /* "camellia-128-ccm" */ 757, /* "camellia-128-cfb" */ 760, /* "camellia-128-cfb1" */ 763, /* "camellia-128-cfb8" */ 964, /* "camellia-128-cmac" */ 963, /* "camellia-128-ctr" */ 754, /* "camellia-128-ecb" */ 961, /* "camellia-128-gcm" */ 766, /* "camellia-128-ofb" */ 752, /* "camellia-192-cbc" */ 966, /* "camellia-192-ccm" */ 758, /* "camellia-192-cfb" */ 761, /* "camellia-192-cfb1" */ 764, /* "camellia-192-cfb8" */ 968, /* "camellia-192-cmac" */ 967, /* "camellia-192-ctr" */ 755, /* "camellia-192-ecb" */ 965, /* "camellia-192-gcm" */ 767, /* "camellia-192-ofb" */ 753, /* "camellia-256-cbc" */ 970, /* "camellia-256-ccm" */ 759, /* "camellia-256-cfb" */ 762, /* "camellia-256-cfb1" */ 765, /* "camellia-256-cfb8" */ 972, /* "camellia-256-cmac" */ 971, /* "camellia-256-ctr" */ 756, /* "camellia-256-ecb" */ 969, /* "camellia-256-gcm" */ 768, /* "camellia-256-ofb" */ 443, /* "caseIgnoreIA5StringSyntax" */ 108, /* "cast5-cbc" */ 110, /* "cast5-cfb" */ 109, /* "cast5-ecb" */ 111, /* "cast5-ofb" */ 152, /* "certBag" */ 677, /* "certicom-arc" */ 517, /* "certificate extensions" */ 883, /* "certificateRevocationList" */ 1019, /* "chacha20" */ 1018, /* "chacha20-poly1305" */ 54, /* "challengePassword" */ 407, /* "characteristic-two-field" */ 395, /* "clearance" */ 633, /* "cleartext track 2" */ 894, /* "cmac" */ 13, /* "commonName" */ 513, /* "content types" */ 50, /* "contentType" */ 53, /* "countersignature" */ 1090, /* "countryCode3c" */ 1091, /* "countryCode3n" */ 14, /* "countryName" */ 153, /* "crlBag" */ 884, /* "crossCertificatePair" */ 806, /* "cryptocom" */ 805, /* "cryptopro" */ 500, /* "dITRedirect" */ 451, /* "dNSDomain" */ 495, /* "dSAQuality" */ 434, /* "data" */ 390, /* "dcObject" */ 891, /* "deltaRevocationList" */ 31, /* "des-cbc" */ 643, /* "des-cdmf" */ 30, /* "des-cfb" */ 656, /* "des-cfb1" */ 657, /* "des-cfb8" */ 29, /* "des-ecb" */ 32, /* "des-ede" */ 43, /* "des-ede-cbc" */ 60, /* "des-ede-cfb" */ 62, /* "des-ede-ofb" */ 33, /* "des-ede3" */ 44, /* "des-ede3-cbc" */ 61, /* "des-ede3-cfb" */ 658, /* "des-ede3-cfb1" */ 659, /* "des-ede3-cfb8" */ 63, /* "des-ede3-ofb" */ 45, /* "des-ofb" */ 107, /* "description" */ 871, /* "destinationIndicator" */ 80, /* "desx-cbc" */ 947, /* "dh-cofactor-kdf" */ 946, /* "dh-std-kdf" */ 28, /* "dhKeyAgreement" */ 941, /* "dhSinglePass-cofactorDH-sha1kdf-scheme" */ 942, /* "dhSinglePass-cofactorDH-sha224kdf-scheme" */ 943, /* "dhSinglePass-cofactorDH-sha256kdf-scheme" */ 944, /* "dhSinglePass-cofactorDH-sha384kdf-scheme" */ 945, /* "dhSinglePass-cofactorDH-sha512kdf-scheme" */ 936, /* "dhSinglePass-stdDH-sha1kdf-scheme" */ 937, /* "dhSinglePass-stdDH-sha224kdf-scheme" */ 938, /* "dhSinglePass-stdDH-sha256kdf-scheme" */ 939, /* "dhSinglePass-stdDH-sha384kdf-scheme" */ 940, /* "dhSinglePass-stdDH-sha512kdf-scheme" */ 11, /* "directory services (X.500)" */ 378, /* "directory services - algorithms" */ 887, /* "distinguishedName" */ 892, /* "dmdName" */ 174, /* "dnQualifier" */ 1092, /* "dnsName" */ 447, /* "document" */ 471, /* "documentAuthor" */ 468, /* "documentIdentifier" */ 472, /* "documentLocation" */ 502, /* "documentPublisher" */ 449, /* "documentSeries" */ 469, /* "documentTitle" */ 470, /* "documentVersion" */ 380, /* "dod" */ 391, /* "domainComponent" */ 452, /* "domainRelatedObject" */ 116, /* "dsaEncryption" */ 67, /* "dsaEncryption-old" */ 66, /* "dsaWithSHA" */ 113, /* "dsaWithSHA1" */ 70, /* "dsaWithSHA1-old" */ 802, /* "dsa_with_SHA224" */ 803, /* "dsa_with_SHA256" */ 1108, /* "dsa_with_SHA3-224" */ 1109, /* "dsa_with_SHA3-256" */ 1110, /* "dsa_with_SHA3-384" */ 1111, /* "dsa_with_SHA3-512" */ 1106, /* "dsa_with_SHA384" */ 1107, /* "dsa_with_SHA512" */ 297, /* "dvcs" */ 791, /* "ecdsa-with-Recommended" */ 416, /* "ecdsa-with-SHA1" */ 793, /* "ecdsa-with-SHA224" */ 794, /* "ecdsa-with-SHA256" */ 795, /* "ecdsa-with-SHA384" */ 796, /* "ecdsa-with-SHA512" */ 792, /* "ecdsa-with-Specified" */ 1112, /* "ecdsa_with_SHA3-224" */ 1113, /* "ecdsa_with_SHA3-256" */ 1114, /* "ecdsa_with_SHA3-384" */ 1115, /* "ecdsa_with_SHA3-512" */ 1266, /* "electronic-signature-standard" */ 48, /* "emailAddress" */ 632, /* "encrypted track 2" */ 885, /* "enhancedSearchGuide" */ 1267, /* "ess-attributes" */ 1265, /* "etsi" */ 56, /* "extendedCertificateAttributes" */ 867, /* "facsimileTelephoneNumber" */ 462, /* "favouriteDrink" */ 1126, /* "ffdhe2048" */ 1127, /* "ffdhe3072" */ 1128, /* "ffdhe4096" */ 1129, /* "ffdhe6144" */ 1130, /* "ffdhe8192" */ 453, /* "friendlyCountry" */ 490, /* "friendlyCountryName" */ 156, /* "friendlyName" */ 631, /* "generate cryptogram" */ 509, /* "generationQualifier" */ 601, /* "generic cryptogram" */ 99, /* "givenName" */ 1195, /* "gmac" */ 976, /* "gost-mac-12" */ 1009, /* "gost89-cbc" */ 814, /* "gost89-cnt" */ 975, /* "gost89-cnt-12" */ 1011, /* "gost89-ctr" */ 1010, /* "gost89-ecb" */ 1036, /* "hkdf" */ 855, /* "hmac" */ 780, /* "hmac-md5" */ 781, /* "hmac-sha1" */ 1102, /* "hmac-sha3-224" */ 1103, /* "hmac-sha3-256" */ 1104, /* "hmac-sha3-384" */ 1105, /* "hmac-sha3-512" */ 797, /* "hmacWithMD5" */ 163, /* "hmacWithSHA1" */ 798, /* "hmacWithSHA224" */ 799, /* "hmacWithSHA256" */ 800, /* "hmacWithSHA384" */ 801, /* "hmacWithSHA512" */ 1193, /* "hmacWithSHA512-224" */ 1194, /* "hmacWithSHA512-256" */ 1281, /* "hmacWithSM3" */ 486, /* "homePostalAddress" */ 473, /* "homeTelephoneNumber" */ 466, /* "host" */ 889, /* "houseIdentifier" */ 442, /* "iA5StringSyntax" */ 381, /* "iana" */ 824, /* "id-Gost28147-89-CryptoPro-A-ParamSet" */ 825, /* "id-Gost28147-89-CryptoPro-B-ParamSet" */ 826, /* "id-Gost28147-89-CryptoPro-C-ParamSet" */ 827, /* "id-Gost28147-89-CryptoPro-D-ParamSet" */ 819, /* "id-Gost28147-89-CryptoPro-KeyMeshing" */ 829, /* "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" */ 828, /* "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" */ 830, /* "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" */ 820, /* "id-Gost28147-89-None-KeyMeshing" */ 823, /* "id-Gost28147-89-TestParamSet" */ 840, /* "id-GostR3410-2001-CryptoPro-A-ParamSet" */ 841, /* "id-GostR3410-2001-CryptoPro-B-ParamSet" */ 842, /* "id-GostR3410-2001-CryptoPro-C-ParamSet" */ 843, /* "id-GostR3410-2001-CryptoPro-XchA-ParamSet" */ 844, /* "id-GostR3410-2001-CryptoPro-XchB-ParamSet" */ 839, /* "id-GostR3410-2001-TestParamSet" */ 832, /* "id-GostR3410-94-CryptoPro-A-ParamSet" */ 833, /* "id-GostR3410-94-CryptoPro-B-ParamSet" */ 834, /* "id-GostR3410-94-CryptoPro-C-ParamSet" */ 835, /* "id-GostR3410-94-CryptoPro-D-ParamSet" */ 836, /* "id-GostR3410-94-CryptoPro-XchA-ParamSet" */ 837, /* "id-GostR3410-94-CryptoPro-XchB-ParamSet" */ 838, /* "id-GostR3410-94-CryptoPro-XchC-ParamSet" */ 831, /* "id-GostR3410-94-TestParamSet" */ 845, /* "id-GostR3410-94-a" */ 846, /* "id-GostR3410-94-aBis" */ 847, /* "id-GostR3410-94-b" */ 848, /* "id-GostR3410-94-bBis" */ 822, /* "id-GostR3411-94-CryptoProParamSet" */ 821, /* "id-GostR3411-94-TestParamSet" */ 1272, /* "id-aa-ATSHashIndex" */ 1277, /* "id-aa-ATSHashIndex-v2" */ 1278, /* "id-aa-ATSHashIndex-v3" */ 1263, /* "id-aa-CMSAlgorithmProtection" */ 1270, /* "id-aa-ets-SignaturePolicyDocument" */ 1280, /* "id-aa-ets-archiveTimestampV2" */ 1271, /* "id-aa-ets-archiveTimestampV3" */ 1261, /* "id-aa-ets-attrCertificateRefs" */ 1262, /* "id-aa-ets-attrRevocationRefs" */ 1269, /* "id-aa-ets-longTermValidation" */ 1268, /* "id-aa-ets-mimeType" */ 1276, /* "id-aa-ets-sigPolicyStore" */ 1275, /* "id-aa-ets-signerAttrV2" */ 266, /* "id-aca" */ 355, /* "id-aca-accessIdentity" */ 354, /* "id-aca-authenticationInfo" */ 356, /* "id-aca-chargingIdentity" */ 399, /* "id-aca-encAttrs" */ 357, /* "id-aca-group" */ 358, /* "id-aca-role" */ 176, /* "id-ad" */ 788, /* "id-aes128-wrap" */ 897, /* "id-aes128-wrap-pad" */ 789, /* "id-aes192-wrap" */ 900, /* "id-aes192-wrap-pad" */ 790, /* "id-aes256-wrap" */ 903, /* "id-aes256-wrap-pad" */ 262, /* "id-alg" */ 893, /* "id-alg-PWRI-KEK" */ 323, /* "id-alg-des40" */ 326, /* "id-alg-dh-pop" */ 325, /* "id-alg-dh-sig-hmac-sha1" */ 324, /* "id-alg-noSignature" */ 907, /* "id-camellia128-wrap" */ 908, /* "id-camellia192-wrap" */ 909, /* "id-camellia256-wrap" */ 268, /* "id-cct" */ 361, /* "id-cct-PKIData" */ 362, /* "id-cct-PKIResponse" */ 360, /* "id-cct-crs" */ 81, /* "id-ce" */ 680, /* "id-characteristic-two-basis" */ 263, /* "id-cmc" */ 334, /* "id-cmc-addExtensions" */ 346, /* "id-cmc-confirmCertAcceptance" */ 330, /* "id-cmc-dataReturn" */ 336, /* "id-cmc-decryptedPOP" */ 335, /* "id-cmc-encryptedPOP" */ 339, /* "id-cmc-getCRL" */ 338, /* "id-cmc-getCert" */ 328, /* "id-cmc-identification" */ 329, /* "id-cmc-identityProof" */ 337, /* "id-cmc-lraPOPWitness" */ 344, /* "id-cmc-popLinkRandom" */ 345, /* "id-cmc-popLinkWitness" */ 343, /* "id-cmc-queryPending" */ 333, /* "id-cmc-recipientNonce" */ 341, /* "id-cmc-regInfo" */ 342, /* "id-cmc-responseInfo" */ 340, /* "id-cmc-revokeRequest" */ 332, /* "id-cmc-senderNonce" */ 327, /* "id-cmc-statusInfo" */ 331, /* "id-cmc-transactionId" */ 1238, /* "id-cp" */ 1250, /* "id-ct-ASPA" */ 787, /* "id-ct-asciiTextWithCRLF" */ 1246, /* "id-ct-geofeedCSVwithCRLF" */ 1237, /* "id-ct-resourceTaggedAttest" */ 1234, /* "id-ct-routeOriginAuthz" */ 1236, /* "id-ct-rpkiGhostbusters" */ 1235, /* "id-ct-rpkiManifest" */ 1247, /* "id-ct-signedChecklist" */ 1284, /* "id-ct-signedTAL" */ 1060, /* "id-ct-xml" */ 408, /* "id-ecPublicKey" */ 508, /* "id-hex-multipart-message" */ 507, /* "id-hex-partial-message" */ 260, /* "id-it" */ 1223, /* "id-it-caCerts" */ 302, /* "id-it-caKeyUpdateInfo" */ 298, /* "id-it-caProtEncCert" */ 1255, /* "id-it-certProfile" */ 1225, /* "id-it-certReqTemplate" */ 311, /* "id-it-confirmWaitTime" */ 1256, /* "id-it-crlStatusList" */ 1257, /* "id-it-crls" */ 303, /* "id-it-currentCRL" */ 300, /* "id-it-encKeyPairTypes" */ 310, /* "id-it-implicitConfirm" */ 308, /* "id-it-keyPairParamRep" */ 307, /* "id-it-keyPairParamReq" */ 312, /* "id-it-origPKIMessage" */ 301, /* "id-it-preferredSymmAlg" */ 309, /* "id-it-revPassphrase" */ 1254, /* "id-it-rootCaCert" */ 1224, /* "id-it-rootCaKeyUpdate" */ 299, /* "id-it-signKeyPairTypes" */ 305, /* "id-it-subscriptionRequest" */ 306, /* "id-it-subscriptionResponse" */ 784, /* "id-it-suppLangTags" */ 304, /* "id-it-unsupportedOIDs" */ 128, /* "id-kp" */ 280, /* "id-mod-attribute-cert" */ 274, /* "id-mod-cmc" */ 277, /* "id-mod-cmp" */ 284, /* "id-mod-cmp2000" */ 1251, /* "id-mod-cmp2000-02" */ 1253, /* "id-mod-cmp2021-02" */ 1252, /* "id-mod-cmp2021-88" */ 273, /* "id-mod-crmf" */ 283, /* "id-mod-dvcs" */ 275, /* "id-mod-kea-profile-88" */ 276, /* "id-mod-kea-profile-93" */ 282, /* "id-mod-ocsp" */ 278, /* "id-mod-qualified-cert-88" */ 279, /* "id-mod-qualified-cert-93" */ 281, /* "id-mod-timestamp-protocol" */ 264, /* "id-on" */ 347, /* "id-on-personalData" */ 265, /* "id-pda" */ 352, /* "id-pda-countryOfCitizenship" */ 353, /* "id-pda-countryOfResidence" */ 348, /* "id-pda-dateOfBirth" */ 351, /* "id-pda-gender" */ 349, /* "id-pda-placeOfBirth" */ 175, /* "id-pe" */ 1031, /* "id-pkinit" */ 261, /* "id-pkip" */ 258, /* "id-pkix-mod" */ 269, /* "id-pkix1-explicit-88" */ 271, /* "id-pkix1-explicit-93" */ 270, /* "id-pkix1-implicit-88" */ 272, /* "id-pkix1-implicit-93" */ 662, /* "id-ppl" */ 267, /* "id-qcs" */ 359, /* "id-qcs-pkixQCSyntax-v1" */ 259, /* "id-qt" */ 313, /* "id-regCtrl" */ 1259, /* "id-regCtrl-algId" */ 1258, /* "id-regCtrl-altCertTemplate" */ 316, /* "id-regCtrl-authenticator" */ 319, /* "id-regCtrl-oldCertID" */ 318, /* "id-regCtrl-pkiArchiveOptions" */ 317, /* "id-regCtrl-pkiPublicationInfo" */ 320, /* "id-regCtrl-protocolEncrKey" */ 315, /* "id-regCtrl-regToken" */ 1260, /* "id-regCtrl-rsaKeyLen" */ 314, /* "id-regInfo" */ 322, /* "id-regInfo-certReq" */ 321, /* "id-regInfo-utf8Pairs" */ 191, /* "id-smime-aa" */ 215, /* "id-smime-aa-contentHint" */ 218, /* "id-smime-aa-contentIdentifier" */ 221, /* "id-smime-aa-contentReference" */ 240, /* "id-smime-aa-dvcs-dvc" */ 217, /* "id-smime-aa-encapContentType" */ 222, /* "id-smime-aa-encrypKeyPref" */ 220, /* "id-smime-aa-equivalentLabels" */ 232, /* "id-smime-aa-ets-CertificateRefs" */ 233, /* "id-smime-aa-ets-RevocationRefs" */ 238, /* "id-smime-aa-ets-archiveTimeStamp" */ 237, /* "id-smime-aa-ets-certCRLTimestamp" */ 234, /* "id-smime-aa-ets-certValues" */ 227, /* "id-smime-aa-ets-commitmentType" */ 231, /* "id-smime-aa-ets-contentTimestamp" */ 236, /* "id-smime-aa-ets-escTimeStamp" */ 230, /* "id-smime-aa-ets-otherSigCert" */ 235, /* "id-smime-aa-ets-revocationValues" */ 226, /* "id-smime-aa-ets-sigPolicyId" */ 229, /* "id-smime-aa-ets-signerAttr" */ 228, /* "id-smime-aa-ets-signerLocation" */ 219, /* "id-smime-aa-macValue" */ 214, /* "id-smime-aa-mlExpandHistory" */ 216, /* "id-smime-aa-msgSigDigest" */ 212, /* "id-smime-aa-receiptRequest" */ 213, /* "id-smime-aa-securityLabel" */ 239, /* "id-smime-aa-signatureType" */ 223, /* "id-smime-aa-signingCertificate" */ 1086, /* "id-smime-aa-signingCertificateV2" */ 224, /* "id-smime-aa-smimeEncryptCerts" */ 225, /* "id-smime-aa-timeStampToken" */ 192, /* "id-smime-alg" */ 243, /* "id-smime-alg-3DESwrap" */ 246, /* "id-smime-alg-CMS3DESwrap" */ 247, /* "id-smime-alg-CMSRC2wrap" */ 245, /* "id-smime-alg-ESDH" */ 241, /* "id-smime-alg-ESDHwith3DES" */ 242, /* "id-smime-alg-ESDHwithRC2" */ 244, /* "id-smime-alg-RC2wrap" */ 193, /* "id-smime-cd" */ 248, /* "id-smime-cd-ldap" */ 190, /* "id-smime-ct" */ 210, /* "id-smime-ct-DVCSRequestData" */ 211, /* "id-smime-ct-DVCSResponseData" */ 208, /* "id-smime-ct-TDTInfo" */ 207, /* "id-smime-ct-TSTInfo" */ 205, /* "id-smime-ct-authData" */ 1059, /* "id-smime-ct-authEnvelopedData" */ 786, /* "id-smime-ct-compressedData" */ 1058, /* "id-smime-ct-contentCollection" */ 209, /* "id-smime-ct-contentInfo" */ 206, /* "id-smime-ct-publishCert" */ 204, /* "id-smime-ct-receipt" */ 195, /* "id-smime-cti" */ 255, /* "id-smime-cti-ets-proofOfApproval" */ 256, /* "id-smime-cti-ets-proofOfCreation" */ 253, /* "id-smime-cti-ets-proofOfDelivery" */ 251, /* "id-smime-cti-ets-proofOfOrigin" */ 252, /* "id-smime-cti-ets-proofOfReceipt" */ 254, /* "id-smime-cti-ets-proofOfSender" */ 189, /* "id-smime-mod" */ 196, /* "id-smime-mod-cms" */ 197, /* "id-smime-mod-ess" */ 202, /* "id-smime-mod-ets-eSigPolicy-88" */ 203, /* "id-smime-mod-ets-eSigPolicy-97" */ 200, /* "id-smime-mod-ets-eSignature-88" */ 201, /* "id-smime-mod-ets-eSignature-97" */ 199, /* "id-smime-mod-msg-v3" */ 198, /* "id-smime-mod-oid" */ 194, /* "id-smime-spq" */ 250, /* "id-smime-spq-ets-sqt-unotice" */ 249, /* "id-smime-spq-ets-sqt-uri" */ 974, /* "id-tc26" */ 991, /* "id-tc26-agreement" */ 992, /* "id-tc26-agreement-gost-3410-2012-256" */ 993, /* "id-tc26-agreement-gost-3410-2012-512" */ 977, /* "id-tc26-algorithms" */ 990, /* "id-tc26-cipher" */ 1001, /* "id-tc26-cipher-constants" */ 1176, /* "id-tc26-cipher-gostr3412-2015-kuznyechik" */ 1173, /* "id-tc26-cipher-gostr3412-2015-magma" */ 994, /* "id-tc26-constants" */ 981, /* "id-tc26-digest" */ 1000, /* "id-tc26-digest-constants" */ 1002, /* "id-tc26-gost-28147-constants" */ 1147, /* "id-tc26-gost-3410-2012-256-constants" */ 996, /* "id-tc26-gost-3410-2012-512-constants" */ 987, /* "id-tc26-mac" */ 978, /* "id-tc26-sign" */ 995, /* "id-tc26-sign-constants" */ 984, /* "id-tc26-signwithdigest" */ 1179, /* "id-tc26-wrap" */ 1182, /* "id-tc26-wrap-gostr3412-2015-kuznyechik" */ 1180, /* "id-tc26-wrap-gostr3412-2015-magma" */ 34, /* "idea-cbc" */ 35, /* "idea-cfb" */ 36, /* "idea-ecb" */ 46, /* "idea-ofb" */ 676, /* "identified-organization" */ 1170, /* "ieee" */ 461, /* "info" */ 101, /* "initials" */ 869, /* "internationaliSDNNumber" */ 1241, /* "ipAddr-asNumber" */ 1242, /* "ipAddr-asNumberv2" */ 1022, /* "ipsec Internet Key Exchange" */ 749, /* "ipsec3" */ 750, /* "ipsec4" */ 181, /* "iso" */ 623, /* "issuer capabilities" */ 645, /* "itu-t" */ 1264, /* "itu-t-identified-organization" */ 492, /* "janetMailbox" */ 646, /* "joint-iso-itu-t" */ 957, /* "jurisdictionCountryName" */ 955, /* "jurisdictionLocalityName" */ 956, /* "jurisdictionStateOrProvinceName" */ 150, /* "keyBag" */ 773, /* "kisa" */ 1196, /* "kmac128" */ 1197, /* "kmac256" */ 1015, /* "kuznyechik-cbc" */ 1016, /* "kuznyechik-cfb" */ 1013, /* "kuznyechik-ctr" */ 1177, /* "kuznyechik-ctr-acpkm" */ 1178, /* "kuznyechik-ctr-acpkm-omac" */ 1012, /* "kuznyechik-ecb" */ 1183, /* "kuznyechik-kexp15" */ 1017, /* "kuznyechik-mac" */ 1014, /* "kuznyechik-ofb" */ 1063, /* "kx-any" */ 1039, /* "kx-dhe" */ 1041, /* "kx-dhe-psk" */ 1038, /* "kx-ecdhe" */ 1040, /* "kx-ecdhe-psk" */ 1045, /* "kx-gost" */ 1218, /* "kx-gost18" */ 1043, /* "kx-psk" */ 1037, /* "kx-rsa" */ 1042, /* "kx-rsa-psk" */ 1044, /* "kx-srp" */ 477, /* "lastModifiedBy" */ 476, /* "lastModifiedTime" */ 157, /* "localKeyID" */ 15, /* "localityName" */ 480, /* "mXRecord" */ 1190, /* "magma-cbc" */ 1191, /* "magma-cfb" */ 1188, /* "magma-ctr" */ 1174, /* "magma-ctr-acpkm" */ 1175, /* "magma-ctr-acpkm-omac" */ 1187, /* "magma-ecb" */ 1181, /* "magma-kexp15" */ 1192, /* "magma-mac" */ 1189, /* "magma-ofb" */ 493, /* "mailPreferenceOption" */ 467, /* "manager" */ 3, /* "md2" */ 7, /* "md2WithRSAEncryption" */ 257, /* "md4" */ 396, /* "md4WithRSAEncryption" */ 4, /* "md5" */ 114, /* "md5-sha1" */ 104, /* "md5WithRSA" */ 8, /* "md5WithRSAEncryption" */ 95, /* "mdc2" */ 96, /* "mdc2WithRSA" */ 875, /* "member" */ 602, /* "merchant initiated auth" */ 514, /* "message extensions" */ 51, /* "messageDigest" */ 911, /* "mgf1" */ 506, /* "mime-mhs-bodies" */ 505, /* "mime-mhs-headings" */ 488, /* "mobileTelephoneNumber" */ 1212, /* "modp_1536" */ 1213, /* "modp_2048" */ 1214, /* "modp_3072" */ 1215, /* "modp_4096" */ 1216, /* "modp_6144" */ 1217, /* "modp_8192" */ 481, /* "nSRecord" */ 173, /* "name" */ 681, /* "onBasis" */ 379, /* "org" */ 1089, /* "organizationIdentifier" */ 17, /* "organizationName" */ 491, /* "organizationalStatus" */ 18, /* "organizationalUnitName" */ 1141, /* "oscca" */ 475, /* "otherMailbox" */ 876, /* "owner" */ 935, /* "pSpecified" */ 489, /* "pagerTelephoneNumber" */ 782, /* "password based MAC" */ 374, /* "path" */ 621, /* "payment gateway capabilities" */ 9, /* "pbeWithMD2AndDES-CBC" */ 168, /* "pbeWithMD2AndRC2-CBC" */ 112, /* "pbeWithMD5AndCast5CBC" */ 10, /* "pbeWithMD5AndDES-CBC" */ 169, /* "pbeWithMD5AndRC2-CBC" */ 148, /* "pbeWithSHA1And128BitRC2-CBC" */ 144, /* "pbeWithSHA1And128BitRC4" */ 147, /* "pbeWithSHA1And2-KeyTripleDES-CBC" */ 146, /* "pbeWithSHA1And3-KeyTripleDES-CBC" */ 149, /* "pbeWithSHA1And40BitRC2-CBC" */ 145, /* "pbeWithSHA1And40BitRC4" */ 170, /* "pbeWithSHA1AndDES-CBC" */ 68, /* "pbeWithSHA1AndRC2-CBC" */ 499, /* "personalSignature" */ 487, /* "personalTitle" */ 464, /* "photo" */ 863, /* "physicalDeliveryOfficeName" */ 437, /* "pilot" */ 439, /* "pilotAttributeSyntax" */ 438, /* "pilotAttributeType" */ 479, /* "pilotAttributeType27" */ 456, /* "pilotDSA" */ 441, /* "pilotGroups" */ 444, /* "pilotObject" */ 440, /* "pilotObjectClass" */ 455, /* "pilotOrganization" */ 445, /* "pilotPerson" */ 186, /* "pkcs1" */ 27, /* "pkcs3" */ 187, /* "pkcs5" */ 20, /* "pkcs7" */ 21, /* "pkcs7-data" */ 25, /* "pkcs7-digestData" */ 26, /* "pkcs7-encryptedData" */ 23, /* "pkcs7-envelopedData" */ 24, /* "pkcs7-signedAndEnvelopedData" */ 22, /* "pkcs7-signedData" */ 151, /* "pkcs8ShroudedKeyBag" */ 47, /* "pkcs9" */ 1061, /* "poly1305" */ 862, /* "postOfficeBox" */ 861, /* "postalAddress" */ 661, /* "postalCode" */ 683, /* "ppBasis" */ 872, /* "preferredDeliveryMethod" */ 873, /* "presentationAddress" */ 406, /* "prime-field" */ 409, /* "prime192v1" */ 410, /* "prime192v2" */ 411, /* "prime192v3" */ 412, /* "prime239v1" */ 413, /* "prime239v2" */ 414, /* "prime239v3" */ 415, /* "prime256v1" */ 886, /* "protocolInformation" */ 510, /* "pseudonym" */ 435, /* "pss" */ 286, /* "qcStatements" */ 457, /* "qualityLabelledData" */ 450, /* "rFC822localPart" */ 98, /* "rc2-40-cbc" */ 166, /* "rc2-64-cbc" */ 37, /* "rc2-cbc" */ 39, /* "rc2-cfb" */ 38, /* "rc2-ecb" */ 40, /* "rc2-ofb" */ 5, /* "rc4" */ 97, /* "rc4-40" */ 915, /* "rc4-hmac-md5" */ 120, /* "rc5-cbc" */ 122, /* "rc5-cfb" */ 121, /* "rc5-ecb" */ 123, /* "rc5-ofb" */ 870, /* "registeredAddress" */ 460, /* "rfc822Mailbox" */ 117, /* "ripemd160" */ 119, /* "ripemd160WithRSA" */ 400, /* "role" */ 877, /* "roleOccupant" */ 448, /* "room" */ 463, /* "roomNumber" */ 19, /* "rsa" */ 6, /* "rsaEncryption" */ 644, /* "rsaOAEPEncryptionSET" */ 377, /* "rsaSignature" */ 919, /* "rsaesOaep" */ 912, /* "rsassaPss" */ 482, /* "sOARecord" */ 155, /* "safeContentsBag" */ 291, /* "sbgp-autonomousSysNum" */ 1240, /* "sbgp-autonomousSysNumv2" */ 290, /* "sbgp-ipAddrBlock" */ 1239, /* "sbgp-ipAddrBlockv2" */ 292, /* "sbgp-routerIdentifier" */ 973, /* "scrypt" */ 159, /* "sdsiCertificate" */ 859, /* "searchGuide" */ 704, /* "secp112r1" */ 705, /* "secp112r2" */ 706, /* "secp128r1" */ 707, /* "secp128r2" */ 708, /* "secp160k1" */ 709, /* "secp160r1" */ 710, /* "secp160r2" */ 711, /* "secp192k1" */ 712, /* "secp224k1" */ 713, /* "secp224r1" */ 714, /* "secp256k1" */ 715, /* "secp384r1" */ 716, /* "secp521r1" */ 154, /* "secretBag" */ 474, /* "secretary" */ 717, /* "sect113r1" */ 718, /* "sect113r2" */ 719, /* "sect131r1" */ 720, /* "sect131r2" */ 721, /* "sect163k1" */ 722, /* "sect163r1" */ 723, /* "sect163r2" */ 724, /* "sect193r1" */ 725, /* "sect193r2" */ 726, /* "sect233k1" */ 727, /* "sect233r1" */ 728, /* "sect239k1" */ 729, /* "sect283k1" */ 730, /* "sect283r1" */ 731, /* "sect409k1" */ 732, /* "sect409r1" */ 733, /* "sect571k1" */ 734, /* "sect571r1" */ 635, /* "secure device signature" */ 878, /* "seeAlso" */ 777, /* "seed-cbc" */ 779, /* "seed-cfb" */ 776, /* "seed-ecb" */ 778, /* "seed-ofb" */ 105, /* "serialNumber" */ 625, /* "set-addPolicy" */ 515, /* "set-attr" */ 518, /* "set-brand" */ 638, /* "set-brand-AmericanExpress" */ 637, /* "set-brand-Diners" */ 636, /* "set-brand-IATA-ATA" */ 639, /* "set-brand-JCB" */ 641, /* "set-brand-MasterCard" */ 642, /* "set-brand-Novus" */ 640, /* "set-brand-Visa" */ 516, /* "set-policy" */ 607, /* "set-policy-root" */ 624, /* "set-rootKeyThumb" */ 620, /* "setAttr-Cert" */ 628, /* "setAttr-IssCap-CVM" */ 630, /* "setAttr-IssCap-Sig" */ 629, /* "setAttr-IssCap-T2" */ 627, /* "setAttr-Token-B0Prime" */ 626, /* "setAttr-Token-EMV" */ 622, /* "setAttr-TokenType" */ 619, /* "setCext-IssuerCapabilities" */ 615, /* "setCext-PGWYcapabilities" */ 616, /* "setCext-TokenIdentifier" */ 618, /* "setCext-TokenType" */ 617, /* "setCext-Track2Data" */ 611, /* "setCext-cCertRequired" */ 609, /* "setCext-certType" */ 608, /* "setCext-hashedRoot" */ 610, /* "setCext-merchData" */ 613, /* "setCext-setExt" */ 614, /* "setCext-setQualf" */ 612, /* "setCext-tunneling" */ 540, /* "setct-AcqCardCodeMsg" */ 576, /* "setct-AcqCardCodeMsgTBE" */ 570, /* "setct-AuthReqTBE" */ 534, /* "setct-AuthReqTBS" */ 527, /* "setct-AuthResBaggage" */ 571, /* "setct-AuthResTBE" */ 572, /* "setct-AuthResTBEX" */ 535, /* "setct-AuthResTBS" */ 536, /* "setct-AuthResTBSX" */ 528, /* "setct-AuthRevReqBaggage" */ 577, /* "setct-AuthRevReqTBE" */ 541, /* "setct-AuthRevReqTBS" */ 529, /* "setct-AuthRevResBaggage" */ 542, /* "setct-AuthRevResData" */ 578, /* "setct-AuthRevResTBE" */ 579, /* "setct-AuthRevResTBEB" */ 543, /* "setct-AuthRevResTBS" */ 573, /* "setct-AuthTokenTBE" */ 537, /* "setct-AuthTokenTBS" */ 600, /* "setct-BCIDistributionTBS" */ 558, /* "setct-BatchAdminReqData" */ 592, /* "setct-BatchAdminReqTBE" */ 559, /* "setct-BatchAdminResData" */ 593, /* "setct-BatchAdminResTBE" */ 599, /* "setct-CRLNotificationResTBS" */ 598, /* "setct-CRLNotificationTBS" */ 580, /* "setct-CapReqTBE" */ 581, /* "setct-CapReqTBEX" */ 544, /* "setct-CapReqTBS" */ 545, /* "setct-CapReqTBSX" */ 546, /* "setct-CapResData" */ 582, /* "setct-CapResTBE" */ 583, /* "setct-CapRevReqTBE" */ 584, /* "setct-CapRevReqTBEX" */ 547, /* "setct-CapRevReqTBS" */ 548, /* "setct-CapRevReqTBSX" */ 549, /* "setct-CapRevResData" */ 585, /* "setct-CapRevResTBE" */ 538, /* "setct-CapTokenData" */ 530, /* "setct-CapTokenSeq" */ 574, /* "setct-CapTokenTBE" */ 575, /* "setct-CapTokenTBEX" */ 539, /* "setct-CapTokenTBS" */ 560, /* "setct-CardCInitResTBS" */ 566, /* "setct-CertInqReqTBS" */ 563, /* "setct-CertReqData" */ 595, /* "setct-CertReqTBE" */ 596, /* "setct-CertReqTBEX" */ 564, /* "setct-CertReqTBS" */ 565, /* "setct-CertResData" */ 597, /* "setct-CertResTBE" */ 586, /* "setct-CredReqTBE" */ 587, /* "setct-CredReqTBEX" */ 550, /* "setct-CredReqTBS" */ 551, /* "setct-CredReqTBSX" */ 552, /* "setct-CredResData" */ 588, /* "setct-CredResTBE" */ 589, /* "setct-CredRevReqTBE" */ 590, /* "setct-CredRevReqTBEX" */ 553, /* "setct-CredRevReqTBS" */ 554, /* "setct-CredRevReqTBSX" */ 555, /* "setct-CredRevResData" */ 591, /* "setct-CredRevResTBE" */ 567, /* "setct-ErrorTBS" */ 526, /* "setct-HODInput" */ 561, /* "setct-MeAqCInitResTBS" */ 522, /* "setct-OIData" */ 519, /* "setct-PANData" */ 521, /* "setct-PANOnly" */ 520, /* "setct-PANToken" */ 556, /* "setct-PCertReqData" */ 557, /* "setct-PCertResTBS" */ 523, /* "setct-PI" */ 532, /* "setct-PI-TBS" */ 524, /* "setct-PIData" */ 525, /* "setct-PIDataUnsigned" */ 568, /* "setct-PIDualSignedTBE" */ 569, /* "setct-PIUnsignedTBE" */ 531, /* "setct-PInitResData" */ 533, /* "setct-PResData" */ 594, /* "setct-RegFormReqTBE" */ 562, /* "setct-RegFormResTBS" */ 604, /* "setext-pinAny" */ 603, /* "setext-pinSecure" */ 605, /* "setext-track2" */ 41, /* "sha" */ 64, /* "sha1" */ 115, /* "sha1WithRSA" */ 65, /* "sha1WithRSAEncryption" */ 675, /* "sha224" */ 671, /* "sha224WithRSAEncryption" */ 672, /* "sha256" */ 668, /* "sha256WithRSAEncryption" */ 1096, /* "sha3-224" */ 1097, /* "sha3-256" */ 1098, /* "sha3-384" */ 1099, /* "sha3-512" */ 673, /* "sha384" */ 669, /* "sha384WithRSAEncryption" */ 674, /* "sha512" */ 1094, /* "sha512-224" */ 1145, /* "sha512-224WithRSAEncryption" */ 1095, /* "sha512-256" */ 1146, /* "sha512-256WithRSAEncryption" */ 670, /* "sha512WithRSAEncryption" */ 42, /* "shaWithRSAEncryption" */ 1100, /* "shake128" */ 1101, /* "shake256" */ 1279, /* "signedAssertion" */ 52, /* "signingTime" */ 454, /* "simpleSecurityObject" */ 496, /* "singleLevelQuality" */ 1062, /* "siphash" */ 1142, /* "sm-scheme" */ 1172, /* "sm2" */ 1143, /* "sm3" */ 1144, /* "sm3WithRSAEncryption" */ 1134, /* "sm4-cbc" */ 1249, /* "sm4-ccm" */ 1137, /* "sm4-cfb" */ 1136, /* "sm4-cfb1" */ 1138, /* "sm4-cfb8" */ 1139, /* "sm4-ctr" */ 1133, /* "sm4-ecb" */ 1248, /* "sm4-gcm" */ 1135, /* "sm4-ofb" */ 1290, /* "sm4-xts" */ 1203, /* "sshkdf" */ 1205, /* "sskdf" */ 16, /* "stateOrProvinceName" */ 660, /* "streetAddress" */ 498, /* "subtreeMaximumQuality" */ 497, /* "subtreeMinimumQuality" */ 890, /* "supportedAlgorithms" */ 874, /* "supportedApplicationContext" */ 100, /* "surname" */ 864, /* "telephoneNumber" */ 866, /* "teletexTerminalIdentifier" */ 865, /* "telexNumber" */ 459, /* "textEncodedORAddress" */ 293, /* "textNotice" */ 106, /* "title" */ 1021, /* "tls1-prf" */ 682, /* "tpBasis" */ 1151, /* "ua-pki" */ 436, /* "ucl" */ 0, /* "undefined" */ 102, /* "uniqueIdentifier" */ 888, /* "uniqueMember" */ 55, /* "unstructuredAddress" */ 49, /* "unstructuredName" */ 880, /* "userCertificate" */ 465, /* "userClass" */ 458, /* "userId" */ 879, /* "userPassword" */ 373, /* "valid" */ 678, /* "wap" */ 679, /* "wap-wsg" */ 735, /* "wap-wsg-idm-ecid-wtls1" */ 743, /* "wap-wsg-idm-ecid-wtls10" */ 744, /* "wap-wsg-idm-ecid-wtls11" */ 745, /* "wap-wsg-idm-ecid-wtls12" */ 736, /* "wap-wsg-idm-ecid-wtls3" */ 737, /* "wap-wsg-idm-ecid-wtls4" */ 738, /* "wap-wsg-idm-ecid-wtls5" */ 739, /* "wap-wsg-idm-ecid-wtls6" */ 740, /* "wap-wsg-idm-ecid-wtls7" */ 741, /* "wap-wsg-idm-ecid-wtls8" */ 742, /* "wap-wsg-idm-ecid-wtls9" */ 804, /* "whirlpool" */ 868, /* "x121Address" */ 503, /* "x500UniqueIdentifier" */ 158, /* "x509Certificate" */ 160, /* "x509Crl" */ 1207, /* "x942kdf" */ 1206, /* "x963kdf" */ 125, /* "zlib compression" */ }; #define NUM_OBJ 1177 static const unsigned int obj_objs[NUM_OBJ] = { 0, /* OBJ_undef 0 */ 181, /* OBJ_iso 1 */ 393, /* OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t */ 404, /* OBJ_ccitt OBJ_itu_t */ 645, /* OBJ_itu_t 0 */ 646, /* OBJ_joint_iso_itu_t 2 */ 1264, /* OBJ_itu_t_identified_organization 0 4 */ 434, /* OBJ_data 0 9 */ 182, /* OBJ_member_body 1 2 */ 379, /* OBJ_org 1 3 */ 676, /* OBJ_identified_organization 1 3 */ 11, /* OBJ_X500 2 5 */ 647, /* OBJ_international_organizations 2 23 */ 1265, /* OBJ_etsi 0 4 0 */ 380, /* OBJ_dod 1 3 6 */ 1170, /* OBJ_ieee 1 3 111 */ 12, /* OBJ_X509 2 5 4 */ 378, /* OBJ_X500algorithms 2 5 8 */ 81, /* OBJ_id_ce 2 5 29 */ 512, /* OBJ_id_set 2 23 42 */ 678, /* OBJ_wap 2 23 43 */ 435, /* OBJ_pss 0 9 2342 */ 1140, /* OBJ_ISO_CN 1 2 156 */ 1150, /* OBJ_ISO_UA 1 2 804 */ 183, /* OBJ_ISO_US 1 2 840 */ 381, /* OBJ_iana 1 3 6 1 */ 1034, /* OBJ_X25519 1 3 101 110 */ 1035, /* OBJ_X448 1 3 101 111 */ 1087, /* OBJ_ED25519 1 3 101 112 */ 1088, /* OBJ_ED448 1 3 101 113 */ 677, /* OBJ_certicom_arc 1 3 132 */ 394, /* OBJ_selected_attribute_types 2 5 1 5 */ 13, /* OBJ_commonName 2 5 4 3 */ 100, /* OBJ_surname 2 5 4 4 */ 105, /* OBJ_serialNumber 2 5 4 5 */ 14, /* OBJ_countryName 2 5 4 6 */ 15, /* OBJ_localityName 2 5 4 7 */ 16, /* OBJ_stateOrProvinceName 2 5 4 8 */ 660, /* OBJ_streetAddress 2 5 4 9 */ 17, /* OBJ_organizationName 2 5 4 10 */ 18, /* OBJ_organizationalUnitName 2 5 4 11 */ 106, /* OBJ_title 2 5 4 12 */ 107, /* OBJ_description 2 5 4 13 */ 859, /* OBJ_searchGuide 2 5 4 14 */ 860, /* OBJ_businessCategory 2 5 4 15 */ 861, /* OBJ_postalAddress 2 5 4 16 */ 661, /* OBJ_postalCode 2 5 4 17 */ 862, /* OBJ_postOfficeBox 2 5 4 18 */ 863, /* OBJ_physicalDeliveryOfficeName 2 5 4 19 */ 864, /* OBJ_telephoneNumber 2 5 4 20 */ 865, /* OBJ_telexNumber 2 5 4 21 */ 866, /* OBJ_teletexTerminalIdentifier 2 5 4 22 */ 867, /* OBJ_facsimileTelephoneNumber 2 5 4 23 */ 868, /* OBJ_x121Address 2 5 4 24 */ 869, /* OBJ_internationaliSDNNumber 2 5 4 25 */ 870, /* OBJ_registeredAddress 2 5 4 26 */ 871, /* OBJ_destinationIndicator 2 5 4 27 */ 872, /* OBJ_preferredDeliveryMethod 2 5 4 28 */ 873, /* OBJ_presentationAddress 2 5 4 29 */ 874, /* OBJ_supportedApplicationContext 2 5 4 30 */ 875, /* OBJ_member 2 5 4 31 */ 876, /* OBJ_owner 2 5 4 32 */ 877, /* OBJ_roleOccupant 2 5 4 33 */ 878, /* OBJ_seeAlso 2 5 4 34 */ 879, /* OBJ_userPassword 2 5 4 35 */ 880, /* OBJ_userCertificate 2 5 4 36 */ 881, /* OBJ_cACertificate 2 5 4 37 */ 882, /* OBJ_authorityRevocationList 2 5 4 38 */ 883, /* OBJ_certificateRevocationList 2 5 4 39 */ 884, /* OBJ_crossCertificatePair 2 5 4 40 */ 173, /* OBJ_name 2 5 4 41 */ 99, /* OBJ_givenName 2 5 4 42 */ 101, /* OBJ_initials 2 5 4 43 */ 509, /* OBJ_generationQualifier 2 5 4 44 */ 503, /* OBJ_x500UniqueIdentifier 2 5 4 45 */ 174, /* OBJ_dnQualifier 2 5 4 46 */ 885, /* OBJ_enhancedSearchGuide 2 5 4 47 */ 886, /* OBJ_protocolInformation 2 5 4 48 */ 887, /* OBJ_distinguishedName 2 5 4 49 */ 888, /* OBJ_uniqueMember 2 5 4 50 */ 889, /* OBJ_houseIdentifier 2 5 4 51 */ 890, /* OBJ_supportedAlgorithms 2 5 4 52 */ 891, /* OBJ_deltaRevocationList 2 5 4 53 */ 892, /* OBJ_dmdName 2 5 4 54 */ 510, /* OBJ_pseudonym 2 5 4 65 */ 400, /* OBJ_role 2 5 4 72 */ 1089, /* OBJ_organizationIdentifier 2 5 4 97 */ 1090, /* OBJ_countryCode3c 2 5 4 98 */ 1091, /* OBJ_countryCode3n 2 5 4 99 */ 1092, /* OBJ_dnsName 2 5 4 100 */ 769, /* OBJ_subject_directory_attributes 2 5 29 9 */ 82, /* OBJ_subject_key_identifier 2 5 29 14 */ 83, /* OBJ_key_usage 2 5 29 15 */ 84, /* OBJ_private_key_usage_period 2 5 29 16 */ 85, /* OBJ_subject_alt_name 2 5 29 17 */ 86, /* OBJ_issuer_alt_name 2 5 29 18 */ 87, /* OBJ_basic_constraints 2 5 29 19 */ 88, /* OBJ_crl_number 2 5 29 20 */ 141, /* OBJ_crl_reason 2 5 29 21 */ 430, /* OBJ_hold_instruction_code 2 5 29 23 */ 142, /* OBJ_invalidity_date 2 5 29 24 */ 140, /* OBJ_delta_crl 2 5 29 27 */ 770, /* OBJ_issuing_distribution_point 2 5 29 28 */ 771, /* OBJ_certificate_issuer 2 5 29 29 */ 666, /* OBJ_name_constraints 2 5 29 30 */ 103, /* OBJ_crl_distribution_points 2 5 29 31 */ 89, /* OBJ_certificate_policies 2 5 29 32 */ 747, /* OBJ_policy_mappings 2 5 29 33 */ 90, /* OBJ_authority_key_identifier 2 5 29 35 */ 401, /* OBJ_policy_constraints 2 5 29 36 */ 126, /* OBJ_ext_key_usage 2 5 29 37 */ 1295, /* OBJ_authority_attribute_identifier 2 5 29 38 */ 1296, /* OBJ_role_spec_cert_identifier 2 5 29 39 */ 1297, /* OBJ_basic_att_constraints 2 5 29 41 */ 1298, /* OBJ_delegated_name_constraints 2 5 29 42 */ 1299, /* OBJ_time_specification 2 5 29 43 */ 857, /* OBJ_freshest_crl 2 5 29 46 */ 1300, /* OBJ_attribute_descriptor 2 5 29 48 */ 1301, /* OBJ_user_notice 2 5 29 49 */ 1302, /* OBJ_soa_identifier 2 5 29 50 */ 1303, /* OBJ_acceptable_cert_policies 2 5 29 52 */ 748, /* OBJ_inhibit_any_policy 2 5 29 54 */ 402, /* OBJ_target_information 2 5 29 55 */ 403, /* OBJ_no_rev_avail 2 5 29 56 */ 1304, /* OBJ_acceptable_privilege_policies 2 5 29 57 */ 1305, /* OBJ_indirect_issuer 2 5 29 61 */ 1306, /* OBJ_no_assertion 2 5 29 62 */ 1307, /* OBJ_id_aa_issuing_distribution_point 2 5 29 63 */ 1308, /* OBJ_issued_on_behalf_of 2 5 29 64 */ 1309, /* OBJ_single_use 2 5 29 65 */ 1310, /* OBJ_group_ac 2 5 29 66 */ 1311, /* OBJ_allowed_attribute_assignments 2 5 29 67 */ 1312, /* OBJ_attribute_mappings 2 5 29 68 */ 1313, /* OBJ_holder_name_constraints 2 5 29 69 */ 1314, /* OBJ_authorization_validation 2 5 29 70 */ 1315, /* OBJ_prot_restrict 2 5 29 71 */ 1316, /* OBJ_subject_alt_public_key_info 2 5 29 72 */ 1317, /* OBJ_alt_signature_algorithm 2 5 29 73 */ 1318, /* OBJ_alt_signature_value 2 5 29 74 */ 1319, /* OBJ_associated_information 2 5 29 75 */ 513, /* OBJ_set_ctype 2 23 42 0 */ 514, /* OBJ_set_msgExt 2 23 42 1 */ 515, /* OBJ_set_attr 2 23 42 3 */ 516, /* OBJ_set_policy 2 23 42 5 */ 517, /* OBJ_set_certExt 2 23 42 7 */ 518, /* OBJ_set_brand 2 23 42 8 */ 679, /* OBJ_wap_wsg 2 23 43 1 */ 1266, /* OBJ_electronic_signature_standard 0 4 0 1733 */ 382, /* OBJ_Directory 1 3 6 1 1 */ 383, /* OBJ_Management 1 3 6 1 2 */ 384, /* OBJ_Experimental 1 3 6 1 3 */ 385, /* OBJ_Private 1 3 6 1 4 */ 386, /* OBJ_Security 1 3 6 1 5 */ 387, /* OBJ_SNMPv2 1 3 6 1 6 */ 388, /* OBJ_Mail 1 3 6 1 7 */ 376, /* OBJ_algorithm 1 3 14 3 2 */ 395, /* OBJ_clearance 2 5 1 5 55 */ 19, /* OBJ_rsa 2 5 8 1 1 */ 96, /* OBJ_mdc2WithRSA 2 5 8 3 100 */ 95, /* OBJ_mdc2 2 5 8 3 101 */ 746, /* OBJ_any_policy 2 5 29 32 0 */ 910, /* OBJ_anyExtendedKeyUsage 2 5 29 37 0 */ 519, /* OBJ_setct_PANData 2 23 42 0 0 */ 520, /* OBJ_setct_PANToken 2 23 42 0 1 */ 521, /* OBJ_setct_PANOnly 2 23 42 0 2 */ 522, /* OBJ_setct_OIData 2 23 42 0 3 */ 523, /* OBJ_setct_PI 2 23 42 0 4 */ 524, /* OBJ_setct_PIData 2 23 42 0 5 */ 525, /* OBJ_setct_PIDataUnsigned 2 23 42 0 6 */ 526, /* OBJ_setct_HODInput 2 23 42 0 7 */ 527, /* OBJ_setct_AuthResBaggage 2 23 42 0 8 */ 528, /* OBJ_setct_AuthRevReqBaggage 2 23 42 0 9 */ 529, /* OBJ_setct_AuthRevResBaggage 2 23 42 0 10 */ 530, /* OBJ_setct_CapTokenSeq 2 23 42 0 11 */ 531, /* OBJ_setct_PInitResData 2 23 42 0 12 */ 532, /* OBJ_setct_PI_TBS 2 23 42 0 13 */ 533, /* OBJ_setct_PResData 2 23 42 0 14 */ 534, /* OBJ_setct_AuthReqTBS 2 23 42 0 16 */ 535, /* OBJ_setct_AuthResTBS 2 23 42 0 17 */ 536, /* OBJ_setct_AuthResTBSX 2 23 42 0 18 */ 537, /* OBJ_setct_AuthTokenTBS 2 23 42 0 19 */ 538, /* OBJ_setct_CapTokenData 2 23 42 0 20 */ 539, /* OBJ_setct_CapTokenTBS 2 23 42 0 21 */ 540, /* OBJ_setct_AcqCardCodeMsg 2 23 42 0 22 */ 541, /* OBJ_setct_AuthRevReqTBS 2 23 42 0 23 */ 542, /* OBJ_setct_AuthRevResData 2 23 42 0 24 */ 543, /* OBJ_setct_AuthRevResTBS 2 23 42 0 25 */ 544, /* OBJ_setct_CapReqTBS 2 23 42 0 26 */ 545, /* OBJ_setct_CapReqTBSX 2 23 42 0 27 */ 546, /* OBJ_setct_CapResData 2 23 42 0 28 */ 547, /* OBJ_setct_CapRevReqTBS 2 23 42 0 29 */ 548, /* OBJ_setct_CapRevReqTBSX 2 23 42 0 30 */ 549, /* OBJ_setct_CapRevResData 2 23 42 0 31 */ 550, /* OBJ_setct_CredReqTBS 2 23 42 0 32 */ 551, /* OBJ_setct_CredReqTBSX 2 23 42 0 33 */ 552, /* OBJ_setct_CredResData 2 23 42 0 34 */ 553, /* OBJ_setct_CredRevReqTBS 2 23 42 0 35 */ 554, /* OBJ_setct_CredRevReqTBSX 2 23 42 0 36 */ 555, /* OBJ_setct_CredRevResData 2 23 42 0 37 */ 556, /* OBJ_setct_PCertReqData 2 23 42 0 38 */ 557, /* OBJ_setct_PCertResTBS 2 23 42 0 39 */ 558, /* OBJ_setct_BatchAdminReqData 2 23 42 0 40 */ 559, /* OBJ_setct_BatchAdminResData 2 23 42 0 41 */ 560, /* OBJ_setct_CardCInitResTBS 2 23 42 0 42 */ 561, /* OBJ_setct_MeAqCInitResTBS 2 23 42 0 43 */ 562, /* OBJ_setct_RegFormResTBS 2 23 42 0 44 */ 563, /* OBJ_setct_CertReqData 2 23 42 0 45 */ 564, /* OBJ_setct_CertReqTBS 2 23 42 0 46 */ 565, /* OBJ_setct_CertResData 2 23 42 0 47 */ 566, /* OBJ_setct_CertInqReqTBS 2 23 42 0 48 */ 567, /* OBJ_setct_ErrorTBS 2 23 42 0 49 */ 568, /* OBJ_setct_PIDualSignedTBE 2 23 42 0 50 */ 569, /* OBJ_setct_PIUnsignedTBE 2 23 42 0 51 */ 570, /* OBJ_setct_AuthReqTBE 2 23 42 0 52 */ 571, /* OBJ_setct_AuthResTBE 2 23 42 0 53 */ 572, /* OBJ_setct_AuthResTBEX 2 23 42 0 54 */ 573, /* OBJ_setct_AuthTokenTBE 2 23 42 0 55 */ 574, /* OBJ_setct_CapTokenTBE 2 23 42 0 56 */ 575, /* OBJ_setct_CapTokenTBEX 2 23 42 0 57 */ 576, /* OBJ_setct_AcqCardCodeMsgTBE 2 23 42 0 58 */ 577, /* OBJ_setct_AuthRevReqTBE 2 23 42 0 59 */ 578, /* OBJ_setct_AuthRevResTBE 2 23 42 0 60 */ 579, /* OBJ_setct_AuthRevResTBEB 2 23 42 0 61 */ 580, /* OBJ_setct_CapReqTBE 2 23 42 0 62 */ 581, /* OBJ_setct_CapReqTBEX 2 23 42 0 63 */ 582, /* OBJ_setct_CapResTBE 2 23 42 0 64 */ 583, /* OBJ_setct_CapRevReqTBE 2 23 42 0 65 */ 584, /* OBJ_setct_CapRevReqTBEX 2 23 42 0 66 */ 585, /* OBJ_setct_CapRevResTBE 2 23 42 0 67 */ 586, /* OBJ_setct_CredReqTBE 2 23 42 0 68 */ 587, /* OBJ_setct_CredReqTBEX 2 23 42 0 69 */ 588, /* OBJ_setct_CredResTBE 2 23 42 0 70 */ 589, /* OBJ_setct_CredRevReqTBE 2 23 42 0 71 */ 590, /* OBJ_setct_CredRevReqTBEX 2 23 42 0 72 */ 591, /* OBJ_setct_CredRevResTBE 2 23 42 0 73 */ 592, /* OBJ_setct_BatchAdminReqTBE 2 23 42 0 74 */ 593, /* OBJ_setct_BatchAdminResTBE 2 23 42 0 75 */ 594, /* OBJ_setct_RegFormReqTBE 2 23 42 0 76 */ 595, /* OBJ_setct_CertReqTBE 2 23 42 0 77 */ 596, /* OBJ_setct_CertReqTBEX 2 23 42 0 78 */ 597, /* OBJ_setct_CertResTBE 2 23 42 0 79 */ 598, /* OBJ_setct_CRLNotificationTBS 2 23 42 0 80 */ 599, /* OBJ_setct_CRLNotificationResTBS 2 23 42 0 81 */ 600, /* OBJ_setct_BCIDistributionTBS 2 23 42 0 82 */ 601, /* OBJ_setext_genCrypt 2 23 42 1 1 */ 602, /* OBJ_setext_miAuth 2 23 42 1 3 */ 603, /* OBJ_setext_pinSecure 2 23 42 1 4 */ 604, /* OBJ_setext_pinAny 2 23 42 1 5 */ 605, /* OBJ_setext_track2 2 23 42 1 7 */ 606, /* OBJ_setext_cv 2 23 42 1 8 */ 620, /* OBJ_setAttr_Cert 2 23 42 3 0 */ 621, /* OBJ_setAttr_PGWYcap 2 23 42 3 1 */ 622, /* OBJ_setAttr_TokenType 2 23 42 3 2 */ 623, /* OBJ_setAttr_IssCap 2 23 42 3 3 */ 607, /* OBJ_set_policy_root 2 23 42 5 0 */ 608, /* OBJ_setCext_hashedRoot 2 23 42 7 0 */ 609, /* OBJ_setCext_certType 2 23 42 7 1 */ 610, /* OBJ_setCext_merchData 2 23 42 7 2 */ 611, /* OBJ_setCext_cCertRequired 2 23 42 7 3 */ 612, /* OBJ_setCext_tunneling 2 23 42 7 4 */ 613, /* OBJ_setCext_setExt 2 23 42 7 5 */ 614, /* OBJ_setCext_setQualf 2 23 42 7 6 */ 615, /* OBJ_setCext_PGWYcapabilities 2 23 42 7 7 */ 616, /* OBJ_setCext_TokenIdentifier 2 23 42 7 8 */ 617, /* OBJ_setCext_Track2Data 2 23 42 7 9 */ 618, /* OBJ_setCext_TokenType 2 23 42 7 10 */ 619, /* OBJ_setCext_IssuerCapabilities 2 23 42 7 11 */ 636, /* OBJ_set_brand_IATA_ATA 2 23 42 8 1 */ 640, /* OBJ_set_brand_Visa 2 23 42 8 4 */ 641, /* OBJ_set_brand_MasterCard 2 23 42 8 5 */ 637, /* OBJ_set_brand_Diners 2 23 42 8 30 */ 638, /* OBJ_set_brand_AmericanExpress 2 23 42 8 34 */ 639, /* OBJ_set_brand_JCB 2 23 42 8 35 */ 1273, /* OBJ_cades 0 4 0 19122 */ 1267, /* OBJ_ess_attributes 0 4 0 1733 2 */ 1195, /* OBJ_gmac 1 0 9797 3 4 */ 1141, /* OBJ_oscca 1 2 156 10197 */ 805, /* OBJ_cryptopro 1 2 643 2 2 */ 806, /* OBJ_cryptocom 1 2 643 2 9 */ 974, /* OBJ_id_tc26 1 2 643 7 1 */ 1005, /* OBJ_OGRN 1 2 643 100 1 */ 1006, /* OBJ_SNILS 1 2 643 100 3 */ 1226, /* OBJ_OGRNIP 1 2 643 100 5 */ 1007, /* OBJ_subjectSignTool 1 2 643 100 111 */ 1008, /* OBJ_issuerSignTool 1 2 643 100 112 */ 1227, /* OBJ_classSignTool 1 2 643 100 113 */ 184, /* OBJ_X9_57 1 2 840 10040 */ 405, /* OBJ_ansi_X9_62 1 2 840 10045 */ 389, /* OBJ_Enterprises 1 3 6 1 4 1 */ 504, /* OBJ_mime_mhs 1 3 6 1 7 1 */ 104, /* OBJ_md5WithRSA 1 3 14 3 2 3 */ 29, /* OBJ_des_ecb 1 3 14 3 2 6 */ 31, /* OBJ_des_cbc 1 3 14 3 2 7 */ 45, /* OBJ_des_ofb64 1 3 14 3 2 8 */ 30, /* OBJ_des_cfb64 1 3 14 3 2 9 */ 377, /* OBJ_rsaSignature 1 3 14 3 2 11 */ 67, /* OBJ_dsa_2 1 3 14 3 2 12 */ 66, /* OBJ_dsaWithSHA 1 3 14 3 2 13 */ 42, /* OBJ_shaWithRSAEncryption 1 3 14 3 2 15 */ 32, /* OBJ_des_ede_ecb 1 3 14 3 2 17 */ 41, /* OBJ_sha 1 3 14 3 2 18 */ 64, /* OBJ_sha1 1 3 14 3 2 26 */ 70, /* OBJ_dsaWithSHA1_2 1 3 14 3 2 27 */ 115, /* OBJ_sha1WithRSA 1 3 14 3 2 29 */ 117, /* OBJ_ripemd160 1 3 36 3 2 1 */ 1093, /* OBJ_x509ExtAdmission 1 3 36 8 3 3 */ 143, /* OBJ_sxnet 1 3 101 1 4 1 */ 1171, /* OBJ_ieee_siswg 1 3 111 2 1619 */ 721, /* OBJ_sect163k1 1 3 132 0 1 */ 722, /* OBJ_sect163r1 1 3 132 0 2 */ 728, /* OBJ_sect239k1 1 3 132 0 3 */ 717, /* OBJ_sect113r1 1 3 132 0 4 */ 718, /* OBJ_sect113r2 1 3 132 0 5 */ 704, /* OBJ_secp112r1 1 3 132 0 6 */ 705, /* OBJ_secp112r2 1 3 132 0 7 */ 709, /* OBJ_secp160r1 1 3 132 0 8 */ 708, /* OBJ_secp160k1 1 3 132 0 9 */ 714, /* OBJ_secp256k1 1 3 132 0 10 */ 723, /* OBJ_sect163r2 1 3 132 0 15 */ 729, /* OBJ_sect283k1 1 3 132 0 16 */ 730, /* OBJ_sect283r1 1 3 132 0 17 */ 719, /* OBJ_sect131r1 1 3 132 0 22 */ 720, /* OBJ_sect131r2 1 3 132 0 23 */ 724, /* OBJ_sect193r1 1 3 132 0 24 */ 725, /* OBJ_sect193r2 1 3 132 0 25 */ 726, /* OBJ_sect233k1 1 3 132 0 26 */ 727, /* OBJ_sect233r1 1 3 132 0 27 */ 706, /* OBJ_secp128r1 1 3 132 0 28 */ 707, /* OBJ_secp128r2 1 3 132 0 29 */ 710, /* OBJ_secp160r2 1 3 132 0 30 */ 711, /* OBJ_secp192k1 1 3 132 0 31 */ 712, /* OBJ_secp224k1 1 3 132 0 32 */ 713, /* OBJ_secp224r1 1 3 132 0 33 */ 715, /* OBJ_secp384r1 1 3 132 0 34 */ 716, /* OBJ_secp521r1 1 3 132 0 35 */ 731, /* OBJ_sect409k1 1 3 132 0 36 */ 732, /* OBJ_sect409r1 1 3 132 0 37 */ 733, /* OBJ_sect571k1 1 3 132 0 38 */ 734, /* OBJ_sect571r1 1 3 132 0 39 */ 624, /* OBJ_set_rootKeyThumb 2 23 42 3 0 0 */ 625, /* OBJ_set_addPolicy 2 23 42 3 0 1 */ 626, /* OBJ_setAttr_Token_EMV 2 23 42 3 2 1 */ 627, /* OBJ_setAttr_Token_B0Prime 2 23 42 3 2 2 */ 628, /* OBJ_setAttr_IssCap_CVM 2 23 42 3 3 3 */ 629, /* OBJ_setAttr_IssCap_T2 2 23 42 3 3 4 */ 630, /* OBJ_setAttr_IssCap_Sig 2 23 42 3 3 5 */ 642, /* OBJ_set_brand_Novus 2 23 42 8 6011 */ 735, /* OBJ_wap_wsg_idm_ecid_wtls1 2 23 43 1 4 1 */ 736, /* OBJ_wap_wsg_idm_ecid_wtls3 2 23 43 1 4 3 */ 737, /* OBJ_wap_wsg_idm_ecid_wtls4 2 23 43 1 4 4 */ 738, /* OBJ_wap_wsg_idm_ecid_wtls5 2 23 43 1 4 5 */ 739, /* OBJ_wap_wsg_idm_ecid_wtls6 2 23 43 1 4 6 */ 740, /* OBJ_wap_wsg_idm_ecid_wtls7 2 23 43 1 4 7 */ 741, /* OBJ_wap_wsg_idm_ecid_wtls8 2 23 43 1 4 8 */ 742, /* OBJ_wap_wsg_idm_ecid_wtls9 2 23 43 1 4 9 */ 743, /* OBJ_wap_wsg_idm_ecid_wtls10 2 23 43 1 4 10 */ 744, /* OBJ_wap_wsg_idm_ecid_wtls11 2 23 43 1 4 11 */ 745, /* OBJ_wap_wsg_idm_ecid_wtls12 2 23 43 1 4 12 */ 1274, /* OBJ_cades_attributes 0 4 0 19122 1 */ 1268, /* OBJ_id_aa_ets_mimeType 0 4 0 1733 2 1 */ 1269, /* OBJ_id_aa_ets_longTermValidation 0 4 0 1733 2 2 */ 1270, /* OBJ_id_aa_ets_SignaturePolicyDocument 0 4 0 1733 2 3 */ 1271, /* OBJ_id_aa_ets_archiveTimestampV3 0 4 0 1733 2 4 */ 1272, /* OBJ_id_aa_ATSHashIndex 0 4 0 1733 2 5 */ 804, /* OBJ_whirlpool 1 0 10118 3 0 55 */ 1142, /* OBJ_sm_scheme 1 2 156 10197 1 */ 773, /* OBJ_kisa 1 2 410 200004 */ 807, /* OBJ_id_GostR3411_94_with_GostR3410_2001 1 2 643 2 2 3 */ 808, /* OBJ_id_GostR3411_94_with_GostR3410_94 1 2 643 2 2 4 */ 809, /* OBJ_id_GostR3411_94 1 2 643 2 2 9 */ 810, /* OBJ_id_HMACGostR3411_94 1 2 643 2 2 10 */ 811, /* OBJ_id_GostR3410_2001 1 2 643 2 2 19 */ 812, /* OBJ_id_GostR3410_94 1 2 643 2 2 20 */ 813, /* OBJ_id_Gost28147_89 1 2 643 2 2 21 */ 815, /* OBJ_id_Gost28147_89_MAC 1 2 643 2 2 22 */ 816, /* OBJ_id_GostR3411_94_prf 1 2 643 2 2 23 */ 817, /* OBJ_id_GostR3410_2001DH 1 2 643 2 2 98 */ 818, /* OBJ_id_GostR3410_94DH 1 2 643 2 2 99 */ 977, /* OBJ_id_tc26_algorithms 1 2 643 7 1 1 */ 994, /* OBJ_id_tc26_constants 1 2 643 7 1 2 */ 1228, /* OBJ_classSignToolKC1 1 2 643 100 113 1 */ 1229, /* OBJ_classSignToolKC2 1 2 643 100 113 2 */ 1230, /* OBJ_classSignToolKC3 1 2 643 100 113 3 */ 1231, /* OBJ_classSignToolKB1 1 2 643 100 113 4 */ 1232, /* OBJ_classSignToolKB2 1 2 643 100 113 5 */ 1233, /* OBJ_classSignToolKA1 1 2 643 100 113 6 */ 1, /* OBJ_rsadsi 1 2 840 113549 */ 185, /* OBJ_X9cm 1 2 840 10040 4 */ 1031, /* OBJ_id_pkinit 1 3 6 1 5 2 3 */ 127, /* OBJ_id_pkix 1 3 6 1 5 5 7 */ 505, /* OBJ_mime_mhs_headings 1 3 6 1 7 1 1 */ 506, /* OBJ_mime_mhs_bodies 1 3 6 1 7 1 2 */ 119, /* OBJ_ripemd160WithRSA 1 3 36 3 3 1 2 */ 937, /* OBJ_dhSinglePass_stdDH_sha224kdf_scheme 1 3 132 1 11 0 */ 938, /* OBJ_dhSinglePass_stdDH_sha256kdf_scheme 1 3 132 1 11 1 */ 939, /* OBJ_dhSinglePass_stdDH_sha384kdf_scheme 1 3 132 1 11 2 */ 940, /* OBJ_dhSinglePass_stdDH_sha512kdf_scheme 1 3 132 1 11 3 */ 942, /* OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme 1 3 132 1 14 0 */ 943, /* OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme 1 3 132 1 14 1 */ 944, /* OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme 1 3 132 1 14 2 */ 945, /* OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme 1 3 132 1 14 3 */ 631, /* OBJ_setAttr_GenCryptgrm 2 23 42 3 3 3 1 */ 632, /* OBJ_setAttr_T2Enc 2 23 42 3 3 4 1 */ 633, /* OBJ_setAttr_T2cleartxt 2 23 42 3 3 4 2 */ 634, /* OBJ_setAttr_TokICCsig 2 23 42 3 3 5 1 */ 635, /* OBJ_setAttr_SecDevSig 2 23 42 3 3 5 2 */ 1275, /* OBJ_id_aa_ets_signerAttrV2 0 4 0 19122 1 1 */ 1276, /* OBJ_id_aa_ets_sigPolicyStore 0 4 0 19122 1 3 */ 1277, /* OBJ_id_aa_ATSHashIndex_v2 0 4 0 19122 1 4 */ 1278, /* OBJ_id_aa_ATSHashIndex_v3 0 4 0 19122 1 5 */ 1279, /* OBJ_signedAssertion 0 4 0 19122 1 6 */ 436, /* OBJ_ucl 0 9 2342 19200300 */ 820, /* OBJ_id_Gost28147_89_None_KeyMeshing 1 2 643 2 2 14 0 */ 819, /* OBJ_id_Gost28147_89_CryptoPro_KeyMeshing 1 2 643 2 2 14 1 */ 845, /* OBJ_id_GostR3410_94_a 1 2 643 2 2 20 1 */ 846, /* OBJ_id_GostR3410_94_aBis 1 2 643 2 2 20 2 */ 847, /* OBJ_id_GostR3410_94_b 1 2 643 2 2 20 3 */ 848, /* OBJ_id_GostR3410_94_bBis 1 2 643 2 2 20 4 */ 821, /* OBJ_id_GostR3411_94_TestParamSet 1 2 643 2 2 30 0 */ 822, /* OBJ_id_GostR3411_94_CryptoProParamSet 1 2 643 2 2 30 1 */ 823, /* OBJ_id_Gost28147_89_TestParamSet 1 2 643 2 2 31 0 */ 824, /* OBJ_id_Gost28147_89_CryptoPro_A_ParamSet 1 2 643 2 2 31 1 */ 825, /* OBJ_id_Gost28147_89_CryptoPro_B_ParamSet 1 2 643 2 2 31 2 */ 826, /* OBJ_id_Gost28147_89_CryptoPro_C_ParamSet 1 2 643 2 2 31 3 */ 827, /* OBJ_id_Gost28147_89_CryptoPro_D_ParamSet 1 2 643 2 2 31 4 */ 828, /* OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 1 2 643 2 2 31 5 */ 829, /* OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 1 2 643 2 2 31 6 */ 830, /* OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 1 2 643 2 2 31 7 */ 831, /* OBJ_id_GostR3410_94_TestParamSet 1 2 643 2 2 32 0 */ 832, /* OBJ_id_GostR3410_94_CryptoPro_A_ParamSet 1 2 643 2 2 32 2 */ 833, /* OBJ_id_GostR3410_94_CryptoPro_B_ParamSet 1 2 643 2 2 32 3 */ 834, /* OBJ_id_GostR3410_94_CryptoPro_C_ParamSet 1 2 643 2 2 32 4 */ 835, /* OBJ_id_GostR3410_94_CryptoPro_D_ParamSet 1 2 643 2 2 32 5 */ 836, /* OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet 1 2 643 2 2 33 1 */ 837, /* OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet 1 2 643 2 2 33 2 */ 838, /* OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet 1 2 643 2 2 33 3 */ 839, /* OBJ_id_GostR3410_2001_TestParamSet 1 2 643 2 2 35 0 */ 840, /* OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet 1 2 643 2 2 35 1 */ 841, /* OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet 1 2 643 2 2 35 2 */ 842, /* OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet 1 2 643 2 2 35 3 */ 843, /* OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet 1 2 643 2 2 36 0 */ 844, /* OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet 1 2 643 2 2 36 1 */ 978, /* OBJ_id_tc26_sign 1 2 643 7 1 1 1 */ 981, /* OBJ_id_tc26_digest 1 2 643 7 1 1 2 */ 984, /* OBJ_id_tc26_signwithdigest 1 2 643 7 1 1 3 */ 987, /* OBJ_id_tc26_mac 1 2 643 7 1 1 4 */ 990, /* OBJ_id_tc26_cipher 1 2 643 7 1 1 5 */ 991, /* OBJ_id_tc26_agreement 1 2 643 7 1 1 6 */ 1179, /* OBJ_id_tc26_wrap 1 2 643 7 1 1 7 */ 995, /* OBJ_id_tc26_sign_constants 1 2 643 7 1 2 1 */ 1000, /* OBJ_id_tc26_digest_constants 1 2 643 7 1 2 2 */ 1001, /* OBJ_id_tc26_cipher_constants 1 2 643 7 1 2 5 */ 1151, /* OBJ_ua_pki 1 2 804 2 1 1 1 */ 2, /* OBJ_pkcs 1 2 840 113549 1 */ 431, /* OBJ_hold_instruction_none 1 2 840 10040 2 1 */ 432, /* OBJ_hold_instruction_call_issuer 1 2 840 10040 2 2 */ 433, /* OBJ_hold_instruction_reject 1 2 840 10040 2 3 */ 116, /* OBJ_dsa 1 2 840 10040 4 1 */ 113, /* OBJ_dsaWithSHA1 1 2 840 10040 4 3 */ 406, /* OBJ_X9_62_prime_field 1 2 840 10045 1 1 */ 407, /* OBJ_X9_62_characteristic_two_field 1 2 840 10045 1 2 */ 408, /* OBJ_X9_62_id_ecPublicKey 1 2 840 10045 2 1 */ 416, /* OBJ_ecdsa_with_SHA1 1 2 840 10045 4 1 */ 791, /* OBJ_ecdsa_with_Recommended 1 2 840 10045 4 2 */ 792, /* OBJ_ecdsa_with_Specified 1 2 840 10045 4 3 */ 920, /* OBJ_dhpublicnumber 1 2 840 10046 2 1 */ 1032, /* OBJ_pkInitClientAuth 1 3 6 1 5 2 3 4 */ 1033, /* OBJ_pkInitKDC 1 3 6 1 5 2 3 5 */ 258, /* OBJ_id_pkix_mod 1 3 6 1 5 5 7 0 */ 175, /* OBJ_id_pe 1 3 6 1 5 5 7 1 */ 259, /* OBJ_id_qt 1 3 6 1 5 5 7 2 */ 128, /* OBJ_id_kp 1 3 6 1 5 5 7 3 */ 260, /* OBJ_id_it 1 3 6 1 5 5 7 4 */ 261, /* OBJ_id_pkip 1 3 6 1 5 5 7 5 */ 262, /* OBJ_id_alg 1 3 6 1 5 5 7 6 */ 263, /* OBJ_id_cmc 1 3 6 1 5 5 7 7 */ 264, /* OBJ_id_on 1 3 6 1 5 5 7 8 */ 265, /* OBJ_id_pda 1 3 6 1 5 5 7 9 */ 266, /* OBJ_id_aca 1 3 6 1 5 5 7 10 */ 267, /* OBJ_id_qcs 1 3 6 1 5 5 7 11 */ 268, /* OBJ_id_cct 1 3 6 1 5 5 7 12 */ 1238, /* OBJ_id_cp 1 3 6 1 5 5 7 14 */ 662, /* OBJ_id_ppl 1 3 6 1 5 5 7 21 */ 176, /* OBJ_id_ad 1 3 6 1 5 5 7 48 */ 507, /* OBJ_id_hex_partial_message 1 3 6 1 7 1 1 1 */ 508, /* OBJ_id_hex_multipart_message 1 3 6 1 7 1 1 2 */ 57, /* OBJ_netscape 2 16 840 1 113730 */ 1282, /* OBJ_oracle 2 16 840 1 113894 */ 754, /* OBJ_camellia_128_ecb 0 3 4401 5 3 1 9 1 */ 766, /* OBJ_camellia_128_ofb128 0 3 4401 5 3 1 9 3 */ 757, /* OBJ_camellia_128_cfb128 0 3 4401 5 3 1 9 4 */ 961, /* OBJ_camellia_128_gcm 0 3 4401 5 3 1 9 6 */ 962, /* OBJ_camellia_128_ccm 0 3 4401 5 3 1 9 7 */ 963, /* OBJ_camellia_128_ctr 0 3 4401 5 3 1 9 9 */ 964, /* OBJ_camellia_128_cmac 0 3 4401 5 3 1 9 10 */ 755, /* OBJ_camellia_192_ecb 0 3 4401 5 3 1 9 21 */ 767, /* OBJ_camellia_192_ofb128 0 3 4401 5 3 1 9 23 */ 758, /* OBJ_camellia_192_cfb128 0 3 4401 5 3 1 9 24 */ 965, /* OBJ_camellia_192_gcm 0 3 4401 5 3 1 9 26 */ 966, /* OBJ_camellia_192_ccm 0 3 4401 5 3 1 9 27 */ 967, /* OBJ_camellia_192_ctr 0 3 4401 5 3 1 9 29 */ 968, /* OBJ_camellia_192_cmac 0 3 4401 5 3 1 9 30 */ 756, /* OBJ_camellia_256_ecb 0 3 4401 5 3 1 9 41 */ 768, /* OBJ_camellia_256_ofb128 0 3 4401 5 3 1 9 43 */ 759, /* OBJ_camellia_256_cfb128 0 3 4401 5 3 1 9 44 */ 969, /* OBJ_camellia_256_gcm 0 3 4401 5 3 1 9 46 */ 970, /* OBJ_camellia_256_ccm 0 3 4401 5 3 1 9 47 */ 971, /* OBJ_camellia_256_ctr 0 3 4401 5 3 1 9 49 */ 972, /* OBJ_camellia_256_cmac 0 3 4401 5 3 1 9 50 */ 437, /* OBJ_pilot 0 9 2342 19200300 100 */ 1133, /* OBJ_sm4_ecb 1 2 156 10197 1 104 1 */ 1134, /* OBJ_sm4_cbc 1 2 156 10197 1 104 2 */ 1135, /* OBJ_sm4_ofb128 1 2 156 10197 1 104 3 */ 1137, /* OBJ_sm4_cfb128 1 2 156 10197 1 104 4 */ 1136, /* OBJ_sm4_cfb1 1 2 156 10197 1 104 5 */ 1138, /* OBJ_sm4_cfb8 1 2 156 10197 1 104 6 */ 1139, /* OBJ_sm4_ctr 1 2 156 10197 1 104 7 */ 1248, /* OBJ_sm4_gcm 1 2 156 10197 1 104 8 */ 1249, /* OBJ_sm4_ccm 1 2 156 10197 1 104 9 */ 1290, /* OBJ_sm4_xts 1 2 156 10197 1 104 10 */ 1172, /* OBJ_sm2 1 2 156 10197 1 301 */ 1143, /* OBJ_sm3 1 2 156 10197 1 401 */ 1204, /* OBJ_SM2_with_SM3 1 2 156 10197 1 501 */ 1144, /* OBJ_sm3WithRSAEncryption 1 2 156 10197 1 504 */ 776, /* OBJ_seed_ecb 1 2 410 200004 1 3 */ 777, /* OBJ_seed_cbc 1 2 410 200004 1 4 */ 779, /* OBJ_seed_cfb128 1 2 410 200004 1 5 */ 778, /* OBJ_seed_ofb128 1 2 410 200004 1 6 */ 852, /* OBJ_id_GostR3411_94_with_GostR3410_94_cc 1 2 643 2 9 1 3 3 */ 853, /* OBJ_id_GostR3411_94_with_GostR3410_2001_cc 1 2 643 2 9 1 3 4 */ 850, /* OBJ_id_GostR3410_94_cc 1 2 643 2 9 1 5 3 */ 851, /* OBJ_id_GostR3410_2001_cc 1 2 643 2 9 1 5 4 */ 849, /* OBJ_id_Gost28147_89_cc 1 2 643 2 9 1 6 1 */ 854, /* OBJ_id_GostR3410_2001_ParamSet_cc 1 2 643 2 9 1 8 1 */ 1004, /* OBJ_INN 1 2 643 3 131 1 1 */ 979, /* OBJ_id_GostR3410_2012_256 1 2 643 7 1 1 1 1 */ 980, /* OBJ_id_GostR3410_2012_512 1 2 643 7 1 1 1 2 */ 982, /* OBJ_id_GostR3411_2012_256 1 2 643 7 1 1 2 2 */ 983, /* OBJ_id_GostR3411_2012_512 1 2 643 7 1 1 2 3 */ 985, /* OBJ_id_tc26_signwithdigest_gost3410_2012_256 1 2 643 7 1 1 3 2 */ 986, /* OBJ_id_tc26_signwithdigest_gost3410_2012_512 1 2 643 7 1 1 3 3 */ 988, /* OBJ_id_tc26_hmac_gost_3411_2012_256 1 2 643 7 1 1 4 1 */ 989, /* OBJ_id_tc26_hmac_gost_3411_2012_512 1 2 643 7 1 1 4 2 */ 1173, /* OBJ_id_tc26_cipher_gostr3412_2015_magma 1 2 643 7 1 1 5 1 */ 1176, /* OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik 1 2 643 7 1 1 5 2 */ 992, /* OBJ_id_tc26_agreement_gost_3410_2012_256 1 2 643 7 1 1 6 1 */ 993, /* OBJ_id_tc26_agreement_gost_3410_2012_512 1 2 643 7 1 1 6 2 */ 1180, /* OBJ_id_tc26_wrap_gostr3412_2015_magma 1 2 643 7 1 1 7 1 */ 1182, /* OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik 1 2 643 7 1 1 7 2 */ 1147, /* OBJ_id_tc26_gost_3410_2012_256_constants 1 2 643 7 1 2 1 1 */ 996, /* OBJ_id_tc26_gost_3410_2012_512_constants 1 2 643 7 1 2 1 2 */ 1002, /* OBJ_id_tc26_gost_28147_constants 1 2 643 7 1 2 5 1 */ 186, /* OBJ_pkcs1 1 2 840 113549 1 1 */ 27, /* OBJ_pkcs3 1 2 840 113549 1 3 */ 187, /* OBJ_pkcs5 1 2 840 113549 1 5 */ 20, /* OBJ_pkcs7 1 2 840 113549 1 7 */ 47, /* OBJ_pkcs9 1 2 840 113549 1 9 */ 3, /* OBJ_md2 1 2 840 113549 2 2 */ 257, /* OBJ_md4 1 2 840 113549 2 4 */ 4, /* OBJ_md5 1 2 840 113549 2 5 */ 797, /* OBJ_hmacWithMD5 1 2 840 113549 2 6 */ 163, /* OBJ_hmacWithSHA1 1 2 840 113549 2 7 */ 798, /* OBJ_hmacWithSHA224 1 2 840 113549 2 8 */ 799, /* OBJ_hmacWithSHA256 1 2 840 113549 2 9 */ 800, /* OBJ_hmacWithSHA384 1 2 840 113549 2 10 */ 801, /* OBJ_hmacWithSHA512 1 2 840 113549 2 11 */ 1193, /* OBJ_hmacWithSHA512_224 1 2 840 113549 2 12 */ 1194, /* OBJ_hmacWithSHA512_256 1 2 840 113549 2 13 */ 37, /* OBJ_rc2_cbc 1 2 840 113549 3 2 */ 5, /* OBJ_rc4 1 2 840 113549 3 4 */ 44, /* OBJ_des_ede3_cbc 1 2 840 113549 3 7 */ 120, /* OBJ_rc5_cbc 1 2 840 113549 3 8 */ 643, /* OBJ_des_cdmf 1 2 840 113549 3 10 */ 680, /* OBJ_X9_62_id_characteristic_two_basis 1 2 840 10045 1 2 3 */ 684, /* OBJ_X9_62_c2pnb163v1 1 2 840 10045 3 0 1 */ 685, /* OBJ_X9_62_c2pnb163v2 1 2 840 10045 3 0 2 */ 686, /* OBJ_X9_62_c2pnb163v3 1 2 840 10045 3 0 3 */ 687, /* OBJ_X9_62_c2pnb176v1 1 2 840 10045 3 0 4 */ 688, /* OBJ_X9_62_c2tnb191v1 1 2 840 10045 3 0 5 */ 689, /* OBJ_X9_62_c2tnb191v2 1 2 840 10045 3 0 6 */ 690, /* OBJ_X9_62_c2tnb191v3 1 2 840 10045 3 0 7 */ 691, /* OBJ_X9_62_c2onb191v4 1 2 840 10045 3 0 8 */ 692, /* OBJ_X9_62_c2onb191v5 1 2 840 10045 3 0 9 */ 693, /* OBJ_X9_62_c2pnb208w1 1 2 840 10045 3 0 10 */ 694, /* OBJ_X9_62_c2tnb239v1 1 2 840 10045 3 0 11 */ 695, /* OBJ_X9_62_c2tnb239v2 1 2 840 10045 3 0 12 */ 696, /* OBJ_X9_62_c2tnb239v3 1 2 840 10045 3 0 13 */ 697, /* OBJ_X9_62_c2onb239v4 1 2 840 10045 3 0 14 */ 698, /* OBJ_X9_62_c2onb239v5 1 2 840 10045 3 0 15 */ 699, /* OBJ_X9_62_c2pnb272w1 1 2 840 10045 3 0 16 */ 700, /* OBJ_X9_62_c2pnb304w1 1 2 840 10045 3 0 17 */ 701, /* OBJ_X9_62_c2tnb359v1 1 2 840 10045 3 0 18 */ 702, /* OBJ_X9_62_c2pnb368w1 1 2 840 10045 3 0 19 */ 703, /* OBJ_X9_62_c2tnb431r1 1 2 840 10045 3 0 20 */ 409, /* OBJ_X9_62_prime192v1 1 2 840 10045 3 1 1 */ 410, /* OBJ_X9_62_prime192v2 1 2 840 10045 3 1 2 */ 411, /* OBJ_X9_62_prime192v3 1 2 840 10045 3 1 3 */ 412, /* OBJ_X9_62_prime239v1 1 2 840 10045 3 1 4 */ 413, /* OBJ_X9_62_prime239v2 1 2 840 10045 3 1 5 */ 414, /* OBJ_X9_62_prime239v3 1 2 840 10045 3 1 6 */ 415, /* OBJ_X9_62_prime256v1 1 2 840 10045 3 1 7 */ 793, /* OBJ_ecdsa_with_SHA224 1 2 840 10045 4 3 1 */ 794, /* OBJ_ecdsa_with_SHA256 1 2 840 10045 4 3 2 */ 795, /* OBJ_ecdsa_with_SHA384 1 2 840 10045 4 3 3 */ 796, /* OBJ_ecdsa_with_SHA512 1 2 840 10045 4 3 4 */ 269, /* OBJ_id_pkix1_explicit_88 1 3 6 1 5 5 7 0 1 */ 270, /* OBJ_id_pkix1_implicit_88 1 3 6 1 5 5 7 0 2 */ 271, /* OBJ_id_pkix1_explicit_93 1 3 6 1 5 5 7 0 3 */ 272, /* OBJ_id_pkix1_implicit_93 1 3 6 1 5 5 7 0 4 */ 273, /* OBJ_id_mod_crmf 1 3 6 1 5 5 7 0 5 */ 274, /* OBJ_id_mod_cmc 1 3 6 1 5 5 7 0 6 */ 275, /* OBJ_id_mod_kea_profile_88 1 3 6 1 5 5 7 0 7 */ 276, /* OBJ_id_mod_kea_profile_93 1 3 6 1 5 5 7 0 8 */ 277, /* OBJ_id_mod_cmp 1 3 6 1 5 5 7 0 9 */ 278, /* OBJ_id_mod_qualified_cert_88 1 3 6 1 5 5 7 0 10 */ 279, /* OBJ_id_mod_qualified_cert_93 1 3 6 1 5 5 7 0 11 */ 280, /* OBJ_id_mod_attribute_cert 1 3 6 1 5 5 7 0 12 */ 281, /* OBJ_id_mod_timestamp_protocol 1 3 6 1 5 5 7 0 13 */ 282, /* OBJ_id_mod_ocsp 1 3 6 1 5 5 7 0 14 */ 283, /* OBJ_id_mod_dvcs 1 3 6 1 5 5 7 0 15 */ 284, /* OBJ_id_mod_cmp2000 1 3 6 1 5 5 7 0 16 */ 1251, /* OBJ_id_mod_cmp2000_02 1 3 6 1 5 5 7 0 50 */ 1252, /* OBJ_id_mod_cmp2021_88 1 3 6 1 5 5 7 0 99 */ 1253, /* OBJ_id_mod_cmp2021_02 1 3 6 1 5 5 7 0 100 */ 177, /* OBJ_info_access 1 3 6 1 5 5 7 1 1 */ 285, /* OBJ_biometricInfo 1 3 6 1 5 5 7 1 2 */ 286, /* OBJ_qcStatements 1 3 6 1 5 5 7 1 3 */ 287, /* OBJ_ac_auditEntity 1 3 6 1 5 5 7 1 4 */ 288, /* OBJ_ac_targeting 1 3 6 1 5 5 7 1 5 */ 289, /* OBJ_aaControls 1 3 6 1 5 5 7 1 6 */ 290, /* OBJ_sbgp_ipAddrBlock 1 3 6 1 5 5 7 1 7 */ 291, /* OBJ_sbgp_autonomousSysNum 1 3 6 1 5 5 7 1 8 */ 292, /* OBJ_sbgp_routerIdentifier 1 3 6 1 5 5 7 1 9 */ 397, /* OBJ_ac_proxying 1 3 6 1 5 5 7 1 10 */ 398, /* OBJ_sinfo_access 1 3 6 1 5 5 7 1 11 */ 663, /* OBJ_proxyCertInfo 1 3 6 1 5 5 7 1 14 */ 1020, /* OBJ_tlsfeature 1 3 6 1 5 5 7 1 24 */ 1239, /* OBJ_sbgp_ipAddrBlockv2 1 3 6 1 5 5 7 1 28 */ 1240, /* OBJ_sbgp_autonomousSysNumv2 1 3 6 1 5 5 7 1 29 */ 164, /* OBJ_id_qt_cps 1 3 6 1 5 5 7 2 1 */ 165, /* OBJ_id_qt_unotice 1 3 6 1 5 5 7 2 2 */ 293, /* OBJ_textNotice 1 3 6 1 5 5 7 2 3 */ 129, /* OBJ_server_auth 1 3 6 1 5 5 7 3 1 */ 130, /* OBJ_client_auth 1 3 6 1 5 5 7 3 2 */ 131, /* OBJ_code_sign 1 3 6 1 5 5 7 3 3 */ 132, /* OBJ_email_protect 1 3 6 1 5 5 7 3 4 */ 294, /* OBJ_ipsecEndSystem 1 3 6 1 5 5 7 3 5 */ 295, /* OBJ_ipsecTunnel 1 3 6 1 5 5 7 3 6 */ 296, /* OBJ_ipsecUser 1 3 6 1 5 5 7 3 7 */ 133, /* OBJ_time_stamp 1 3 6 1 5 5 7 3 8 */ 180, /* OBJ_OCSP_sign 1 3 6 1 5 5 7 3 9 */ 297, /* OBJ_dvcs 1 3 6 1 5 5 7 3 10 */ 1022, /* OBJ_ipsec_IKE 1 3 6 1 5 5 7 3 17 */ 1023, /* OBJ_capwapAC 1 3 6 1 5 5 7 3 18 */ 1024, /* OBJ_capwapWTP 1 3 6 1 5 5 7 3 19 */ 1025, /* OBJ_sshClient 1 3 6 1 5 5 7 3 21 */ 1026, /* OBJ_sshServer 1 3 6 1 5 5 7 3 22 */ 1027, /* OBJ_sendRouter 1 3 6 1 5 5 7 3 23 */ 1028, /* OBJ_sendProxiedRouter 1 3 6 1 5 5 7 3 24 */ 1029, /* OBJ_sendOwner 1 3 6 1 5 5 7 3 25 */ 1030, /* OBJ_sendProxiedOwner 1 3 6 1 5 5 7 3 26 */ 1131, /* OBJ_cmcCA 1 3 6 1 5 5 7 3 27 */ 1132, /* OBJ_cmcRA 1 3 6 1 5 5 7 3 28 */ 1219, /* OBJ_cmcArchive 1 3 6 1 5 5 7 3 29 */ 1220, /* OBJ_id_kp_bgpsec_router 1 3 6 1 5 5 7 3 30 */ 1221, /* OBJ_id_kp_BrandIndicatorforMessageIdentification 1 3 6 1 5 5 7 3 31 */ 1222, /* OBJ_cmKGA 1 3 6 1 5 5 7 3 32 */ 298, /* OBJ_id_it_caProtEncCert 1 3 6 1 5 5 7 4 1 */ 299, /* OBJ_id_it_signKeyPairTypes 1 3 6 1 5 5 7 4 2 */ 300, /* OBJ_id_it_encKeyPairTypes 1 3 6 1 5 5 7 4 3 */ 301, /* OBJ_id_it_preferredSymmAlg 1 3 6 1 5 5 7 4 4 */ 302, /* OBJ_id_it_caKeyUpdateInfo 1 3 6 1 5 5 7 4 5 */ 303, /* OBJ_id_it_currentCRL 1 3 6 1 5 5 7 4 6 */ 304, /* OBJ_id_it_unsupportedOIDs 1 3 6 1 5 5 7 4 7 */ 305, /* OBJ_id_it_subscriptionRequest 1 3 6 1 5 5 7 4 8 */ 306, /* OBJ_id_it_subscriptionResponse 1 3 6 1 5 5 7 4 9 */ 307, /* OBJ_id_it_keyPairParamReq 1 3 6 1 5 5 7 4 10 */ 308, /* OBJ_id_it_keyPairParamRep 1 3 6 1 5 5 7 4 11 */ 309, /* OBJ_id_it_revPassphrase 1 3 6 1 5 5 7 4 12 */ 310, /* OBJ_id_it_implicitConfirm 1 3 6 1 5 5 7 4 13 */ 311, /* OBJ_id_it_confirmWaitTime 1 3 6 1 5 5 7 4 14 */ 312, /* OBJ_id_it_origPKIMessage 1 3 6 1 5 5 7 4 15 */ 784, /* OBJ_id_it_suppLangTags 1 3 6 1 5 5 7 4 16 */ 1223, /* OBJ_id_it_caCerts 1 3 6 1 5 5 7 4 17 */ 1224, /* OBJ_id_it_rootCaKeyUpdate 1 3 6 1 5 5 7 4 18 */ 1225, /* OBJ_id_it_certReqTemplate 1 3 6 1 5 5 7 4 19 */ 1254, /* OBJ_id_it_rootCaCert 1 3 6 1 5 5 7 4 20 */ 1255, /* OBJ_id_it_certProfile 1 3 6 1 5 5 7 4 21 */ 1256, /* OBJ_id_it_crlStatusList 1 3 6 1 5 5 7 4 22 */ 1257, /* OBJ_id_it_crls 1 3 6 1 5 5 7 4 23 */ 313, /* OBJ_id_regCtrl 1 3 6 1 5 5 7 5 1 */ 314, /* OBJ_id_regInfo 1 3 6 1 5 5 7 5 2 */ 323, /* OBJ_id_alg_des40 1 3 6 1 5 5 7 6 1 */ 324, /* OBJ_id_alg_noSignature 1 3 6 1 5 5 7 6 2 */ 325, /* OBJ_id_alg_dh_sig_hmac_sha1 1 3 6 1 5 5 7 6 3 */ 326, /* OBJ_id_alg_dh_pop 1 3 6 1 5 5 7 6 4 */ 327, /* OBJ_id_cmc_statusInfo 1 3 6 1 5 5 7 7 1 */ 328, /* OBJ_id_cmc_identification 1 3 6 1 5 5 7 7 2 */ 329, /* OBJ_id_cmc_identityProof 1 3 6 1 5 5 7 7 3 */ 330, /* OBJ_id_cmc_dataReturn 1 3 6 1 5 5 7 7 4 */ 331, /* OBJ_id_cmc_transactionId 1 3 6 1 5 5 7 7 5 */ 332, /* OBJ_id_cmc_senderNonce 1 3 6 1 5 5 7 7 6 */ 333, /* OBJ_id_cmc_recipientNonce 1 3 6 1 5 5 7 7 7 */ 334, /* OBJ_id_cmc_addExtensions 1 3 6 1 5 5 7 7 8 */ 335, /* OBJ_id_cmc_encryptedPOP 1 3 6 1 5 5 7 7 9 */ 336, /* OBJ_id_cmc_decryptedPOP 1 3 6 1 5 5 7 7 10 */ 337, /* OBJ_id_cmc_lraPOPWitness 1 3 6 1 5 5 7 7 11 */ 338, /* OBJ_id_cmc_getCert 1 3 6 1 5 5 7 7 15 */ 339, /* OBJ_id_cmc_getCRL 1 3 6 1 5 5 7 7 16 */ 340, /* OBJ_id_cmc_revokeRequest 1 3 6 1 5 5 7 7 17 */ 341, /* OBJ_id_cmc_regInfo 1 3 6 1 5 5 7 7 18 */ 342, /* OBJ_id_cmc_responseInfo 1 3 6 1 5 5 7 7 19 */ 343, /* OBJ_id_cmc_queryPending 1 3 6 1 5 5 7 7 21 */ 344, /* OBJ_id_cmc_popLinkRandom 1 3 6 1 5 5 7 7 22 */ 345, /* OBJ_id_cmc_popLinkWitness 1 3 6 1 5 5 7 7 23 */ 346, /* OBJ_id_cmc_confirmCertAcceptance 1 3 6 1 5 5 7 7 24 */ 347, /* OBJ_id_on_personalData 1 3 6 1 5 5 7 8 1 */ 858, /* OBJ_id_on_permanentIdentifier 1 3 6 1 5 5 7 8 3 */ 1209, /* OBJ_XmppAddr 1 3 6 1 5 5 7 8 5 */ 1210, /* OBJ_SRVName 1 3 6 1 5 5 7 8 7 */ 1211, /* OBJ_NAIRealm 1 3 6 1 5 5 7 8 8 */ 1208, /* OBJ_id_on_SmtpUTF8Mailbox 1 3 6 1 5 5 7 8 9 */ 348, /* OBJ_id_pda_dateOfBirth 1 3 6 1 5 5 7 9 1 */ 349, /* OBJ_id_pda_placeOfBirth 1 3 6 1 5 5 7 9 2 */ 351, /* OBJ_id_pda_gender 1 3 6 1 5 5 7 9 3 */ 352, /* OBJ_id_pda_countryOfCitizenship 1 3 6 1 5 5 7 9 4 */ 353, /* OBJ_id_pda_countryOfResidence 1 3 6 1 5 5 7 9 5 */ 354, /* OBJ_id_aca_authenticationInfo 1 3 6 1 5 5 7 10 1 */ 355, /* OBJ_id_aca_accessIdentity 1 3 6 1 5 5 7 10 2 */ 356, /* OBJ_id_aca_chargingIdentity 1 3 6 1 5 5 7 10 3 */ 357, /* OBJ_id_aca_group 1 3 6 1 5 5 7 10 4 */ 358, /* OBJ_id_aca_role 1 3 6 1 5 5 7 10 5 */ 399, /* OBJ_id_aca_encAttrs 1 3 6 1 5 5 7 10 6 */ 359, /* OBJ_id_qcs_pkixQCSyntax_v1 1 3 6 1 5 5 7 11 1 */ 360, /* OBJ_id_cct_crs 1 3 6 1 5 5 7 12 1 */ 361, /* OBJ_id_cct_PKIData 1 3 6 1 5 5 7 12 2 */ 362, /* OBJ_id_cct_PKIResponse 1 3 6 1 5 5 7 12 3 */ 1241, /* OBJ_ipAddr_asNumber 1 3 6 1 5 5 7 14 2 */ 1242, /* OBJ_ipAddr_asNumberv2 1 3 6 1 5 5 7 14 3 */ 664, /* OBJ_id_ppl_anyLanguage 1 3 6 1 5 5 7 21 0 */ 665, /* OBJ_id_ppl_inheritAll 1 3 6 1 5 5 7 21 1 */ 667, /* OBJ_Independent 1 3 6 1 5 5 7 21 2 */ 178, /* OBJ_ad_OCSP 1 3 6 1 5 5 7 48 1 */ 179, /* OBJ_ad_ca_issuers 1 3 6 1 5 5 7 48 2 */ 363, /* OBJ_ad_timeStamping 1 3 6 1 5 5 7 48 3 */ 364, /* OBJ_ad_dvcs 1 3 6 1 5 5 7 48 4 */ 785, /* OBJ_caRepository 1 3 6 1 5 5 7 48 5 */ 1243, /* OBJ_rpkiManifest 1 3 6 1 5 5 7 48 10 */ 1244, /* OBJ_signedObject 1 3 6 1 5 5 7 48 11 */ 1245, /* OBJ_rpkiNotify 1 3 6 1 5 5 7 48 13 */ 780, /* OBJ_hmac_md5 1 3 6 1 5 5 8 1 1 */ 781, /* OBJ_hmac_sha1 1 3 6 1 5 5 8 1 2 */ 913, /* OBJ_aes_128_xts 1 3 111 2 1619 0 1 1 */ 914, /* OBJ_aes_256_xts 1 3 111 2 1619 0 1 2 */ 58, /* OBJ_netscape_cert_extension 2 16 840 1 113730 1 */ 59, /* OBJ_netscape_data_type 2 16 840 1 113730 2 */ 438, /* OBJ_pilotAttributeType 0 9 2342 19200300 100 1 */ 439, /* OBJ_pilotAttributeSyntax 0 9 2342 19200300 100 3 */ 440, /* OBJ_pilotObjectClass 0 9 2342 19200300 100 4 */ 441, /* OBJ_pilotGroups 0 9 2342 19200300 100 10 */ 1065, /* OBJ_aria_128_ecb 1 2 410 200046 1 1 1 */ 1066, /* OBJ_aria_128_cbc 1 2 410 200046 1 1 2 */ 1067, /* OBJ_aria_128_cfb128 1 2 410 200046 1 1 3 */ 1068, /* OBJ_aria_128_ofb128 1 2 410 200046 1 1 4 */ 1069, /* OBJ_aria_128_ctr 1 2 410 200046 1 1 5 */ 1070, /* OBJ_aria_192_ecb 1 2 410 200046 1 1 6 */ 1071, /* OBJ_aria_192_cbc 1 2 410 200046 1 1 7 */ 1072, /* OBJ_aria_192_cfb128 1 2 410 200046 1 1 8 */ 1073, /* OBJ_aria_192_ofb128 1 2 410 200046 1 1 9 */ 1074, /* OBJ_aria_192_ctr 1 2 410 200046 1 1 10 */ 1075, /* OBJ_aria_256_ecb 1 2 410 200046 1 1 11 */ 1076, /* OBJ_aria_256_cbc 1 2 410 200046 1 1 12 */ 1077, /* OBJ_aria_256_cfb128 1 2 410 200046 1 1 13 */ 1078, /* OBJ_aria_256_ofb128 1 2 410 200046 1 1 14 */ 1079, /* OBJ_aria_256_ctr 1 2 410 200046 1 1 15 */ 1123, /* OBJ_aria_128_gcm 1 2 410 200046 1 1 34 */ 1124, /* OBJ_aria_192_gcm 1 2 410 200046 1 1 35 */ 1125, /* OBJ_aria_256_gcm 1 2 410 200046 1 1 36 */ 1120, /* OBJ_aria_128_ccm 1 2 410 200046 1 1 37 */ 1121, /* OBJ_aria_192_ccm 1 2 410 200046 1 1 38 */ 1122, /* OBJ_aria_256_ccm 1 2 410 200046 1 1 39 */ 1174, /* OBJ_magma_ctr_acpkm 1 2 643 7 1 1 5 1 1 */ 1175, /* OBJ_magma_ctr_acpkm_omac 1 2 643 7 1 1 5 1 2 */ 1177, /* OBJ_kuznyechik_ctr_acpkm 1 2 643 7 1 1 5 2 1 */ 1178, /* OBJ_kuznyechik_ctr_acpkm_omac 1 2 643 7 1 1 5 2 2 */ 1181, /* OBJ_magma_kexp15 1 2 643 7 1 1 7 1 1 */ 1183, /* OBJ_kuznyechik_kexp15 1 2 643 7 1 1 7 2 1 */ 1148, /* OBJ_id_tc26_gost_3410_2012_256_paramSetA 1 2 643 7 1 2 1 1 1 */ 1184, /* OBJ_id_tc26_gost_3410_2012_256_paramSetB 1 2 643 7 1 2 1 1 2 */ 1185, /* OBJ_id_tc26_gost_3410_2012_256_paramSetC 1 2 643 7 1 2 1 1 3 */ 1186, /* OBJ_id_tc26_gost_3410_2012_256_paramSetD 1 2 643 7 1 2 1 1 4 */ 997, /* OBJ_id_tc26_gost_3410_2012_512_paramSetTest 1 2 643 7 1 2 1 2 0 */ 998, /* OBJ_id_tc26_gost_3410_2012_512_paramSetA 1 2 643 7 1 2 1 2 1 */ 999, /* OBJ_id_tc26_gost_3410_2012_512_paramSetB 1 2 643 7 1 2 1 2 2 */ 1149, /* OBJ_id_tc26_gost_3410_2012_512_paramSetC 1 2 643 7 1 2 1 2 3 */ 1003, /* OBJ_id_tc26_gost_28147_param_Z 1 2 643 7 1 2 5 1 1 */ 108, /* OBJ_cast5_cbc 1 2 840 113533 7 66 10 */ 112, /* OBJ_pbeWithMD5AndCast5_CBC 1 2 840 113533 7 66 12 */ 782, /* OBJ_id_PasswordBasedMAC 1 2 840 113533 7 66 13 */ 783, /* OBJ_id_DHBasedMac 1 2 840 113533 7 66 30 */ 6, /* OBJ_rsaEncryption 1 2 840 113549 1 1 1 */ 7, /* OBJ_md2WithRSAEncryption 1 2 840 113549 1 1 2 */ 396, /* OBJ_md4WithRSAEncryption 1 2 840 113549 1 1 3 */ 8, /* OBJ_md5WithRSAEncryption 1 2 840 113549 1 1 4 */ 65, /* OBJ_sha1WithRSAEncryption 1 2 840 113549 1 1 5 */ 644, /* OBJ_rsaOAEPEncryptionSET 1 2 840 113549 1 1 6 */ 919, /* OBJ_rsaesOaep 1 2 840 113549 1 1 7 */ 911, /* OBJ_mgf1 1 2 840 113549 1 1 8 */ 935, /* OBJ_pSpecified 1 2 840 113549 1 1 9 */ 912, /* OBJ_rsassaPss 1 2 840 113549 1 1 10 */ 668, /* OBJ_sha256WithRSAEncryption 1 2 840 113549 1 1 11 */ 669, /* OBJ_sha384WithRSAEncryption 1 2 840 113549 1 1 12 */ 670, /* OBJ_sha512WithRSAEncryption 1 2 840 113549 1 1 13 */ 671, /* OBJ_sha224WithRSAEncryption 1 2 840 113549 1 1 14 */ 1145, /* OBJ_sha512_224WithRSAEncryption 1 2 840 113549 1 1 15 */ 1146, /* OBJ_sha512_256WithRSAEncryption 1 2 840 113549 1 1 16 */ 28, /* OBJ_dhKeyAgreement 1 2 840 113549 1 3 1 */ 9, /* OBJ_pbeWithMD2AndDES_CBC 1 2 840 113549 1 5 1 */ 10, /* OBJ_pbeWithMD5AndDES_CBC 1 2 840 113549 1 5 3 */ 168, /* OBJ_pbeWithMD2AndRC2_CBC 1 2 840 113549 1 5 4 */ 169, /* OBJ_pbeWithMD5AndRC2_CBC 1 2 840 113549 1 5 6 */ 170, /* OBJ_pbeWithSHA1AndDES_CBC 1 2 840 113549 1 5 10 */ 68, /* OBJ_pbeWithSHA1AndRC2_CBC 1 2 840 113549 1 5 11 */ 69, /* OBJ_id_pbkdf2 1 2 840 113549 1 5 12 */ 161, /* OBJ_pbes2 1 2 840 113549 1 5 13 */ 162, /* OBJ_pbmac1 1 2 840 113549 1 5 14 */ 21, /* OBJ_pkcs7_data 1 2 840 113549 1 7 1 */ 22, /* OBJ_pkcs7_signed 1 2 840 113549 1 7 2 */ 23, /* OBJ_pkcs7_enveloped 1 2 840 113549 1 7 3 */ 24, /* OBJ_pkcs7_signedAndEnveloped 1 2 840 113549 1 7 4 */ 25, /* OBJ_pkcs7_digest 1 2 840 113549 1 7 5 */ 26, /* OBJ_pkcs7_encrypted 1 2 840 113549 1 7 6 */ 48, /* OBJ_pkcs9_emailAddress 1 2 840 113549 1 9 1 */ 49, /* OBJ_pkcs9_unstructuredName 1 2 840 113549 1 9 2 */ 50, /* OBJ_pkcs9_contentType 1 2 840 113549 1 9 3 */ 51, /* OBJ_pkcs9_messageDigest 1 2 840 113549 1 9 4 */ 52, /* OBJ_pkcs9_signingTime 1 2 840 113549 1 9 5 */ 53, /* OBJ_pkcs9_countersignature 1 2 840 113549 1 9 6 */ 54, /* OBJ_pkcs9_challengePassword 1 2 840 113549 1 9 7 */ 55, /* OBJ_pkcs9_unstructuredAddress 1 2 840 113549 1 9 8 */ 56, /* OBJ_pkcs9_extCertAttributes 1 2 840 113549 1 9 9 */ 172, /* OBJ_ext_req 1 2 840 113549 1 9 14 */ 167, /* OBJ_SMIMECapabilities 1 2 840 113549 1 9 15 */ 188, /* OBJ_SMIME 1 2 840 113549 1 9 16 */ 156, /* OBJ_friendlyName 1 2 840 113549 1 9 20 */ 157, /* OBJ_localKeyID 1 2 840 113549 1 9 21 */ 1263, /* OBJ_id_aa_CMSAlgorithmProtection 1 2 840 113549 1 9 52 */ 681, /* OBJ_X9_62_onBasis 1 2 840 10045 1 2 3 1 */ 682, /* OBJ_X9_62_tpBasis 1 2 840 10045 1 2 3 2 */ 683, /* OBJ_X9_62_ppBasis 1 2 840 10045 1 2 3 3 */ 417, /* OBJ_ms_csp_name 1 3 6 1 4 1 311 17 1 */ 856, /* OBJ_LocalKeySet 1 3 6 1 4 1 311 17 2 */ 1293, /* OBJ_ms_cert_templ 1 3 6 1 4 1 311 21 7 */ 1294, /* OBJ_ms_app_policies 1 3 6 1 4 1 311 21 10 */ 1292, /* OBJ_ms_ntds_sec_ext 1 3 6 1 4 1 311 25 2 */ 390, /* OBJ_dcObject 1 3 6 1 4 1 1466 344 */ 91, /* OBJ_bf_cbc 1 3 6 1 4 1 3029 1 2 */ 973, /* OBJ_id_scrypt 1 3 6 1 4 1 11591 4 11 */ 315, /* OBJ_id_regCtrl_regToken 1 3 6 1 5 5 7 5 1 1 */ 316, /* OBJ_id_regCtrl_authenticator 1 3 6 1 5 5 7 5 1 2 */ 317, /* OBJ_id_regCtrl_pkiPublicationInfo 1 3 6 1 5 5 7 5 1 3 */ 318, /* OBJ_id_regCtrl_pkiArchiveOptions 1 3 6 1 5 5 7 5 1 4 */ 319, /* OBJ_id_regCtrl_oldCertID 1 3 6 1 5 5 7 5 1 5 */ 320, /* OBJ_id_regCtrl_protocolEncrKey 1 3 6 1 5 5 7 5 1 6 */ 1258, /* OBJ_id_regCtrl_altCertTemplate 1 3 6 1 5 5 7 5 1 7 */ 1259, /* OBJ_id_regCtrl_algId 1 3 6 1 5 5 7 5 1 11 */ 1260, /* OBJ_id_regCtrl_rsaKeyLen 1 3 6 1 5 5 7 5 1 12 */ 321, /* OBJ_id_regInfo_utf8Pairs 1 3 6 1 5 5 7 5 2 1 */ 322, /* OBJ_id_regInfo_certReq 1 3 6 1 5 5 7 5 2 2 */ 365, /* OBJ_id_pkix_OCSP_basic 1 3 6 1 5 5 7 48 1 1 */ 366, /* OBJ_id_pkix_OCSP_Nonce 1 3 6 1 5 5 7 48 1 2 */ 367, /* OBJ_id_pkix_OCSP_CrlID 1 3 6 1 5 5 7 48 1 3 */ 368, /* OBJ_id_pkix_OCSP_acceptableResponses 1 3 6 1 5 5 7 48 1 4 */ 369, /* OBJ_id_pkix_OCSP_noCheck 1 3 6 1 5 5 7 48 1 5 */ 370, /* OBJ_id_pkix_OCSP_archiveCutoff 1 3 6 1 5 5 7 48 1 6 */ 371, /* OBJ_id_pkix_OCSP_serviceLocator 1 3 6 1 5 5 7 48 1 7 */ 372, /* OBJ_id_pkix_OCSP_extendedStatus 1 3 6 1 5 5 7 48 1 8 */ 373, /* OBJ_id_pkix_OCSP_valid 1 3 6 1 5 5 7 48 1 9 */ 374, /* OBJ_id_pkix_OCSP_path 1 3 6 1 5 5 7 48 1 10 */ 375, /* OBJ_id_pkix_OCSP_trustRoot 1 3 6 1 5 5 7 48 1 11 */ 921, /* OBJ_brainpoolP160r1 1 3 36 3 3 2 8 1 1 1 */ 922, /* OBJ_brainpoolP160t1 1 3 36 3 3 2 8 1 1 2 */ 923, /* OBJ_brainpoolP192r1 1 3 36 3 3 2 8 1 1 3 */ 924, /* OBJ_brainpoolP192t1 1 3 36 3 3 2 8 1 1 4 */ 925, /* OBJ_brainpoolP224r1 1 3 36 3 3 2 8 1 1 5 */ 926, /* OBJ_brainpoolP224t1 1 3 36 3 3 2 8 1 1 6 */ 927, /* OBJ_brainpoolP256r1 1 3 36 3 3 2 8 1 1 7 */ 928, /* OBJ_brainpoolP256t1 1 3 36 3 3 2 8 1 1 8 */ 929, /* OBJ_brainpoolP320r1 1 3 36 3 3 2 8 1 1 9 */ 930, /* OBJ_brainpoolP320t1 1 3 36 3 3 2 8 1 1 10 */ 931, /* OBJ_brainpoolP384r1 1 3 36 3 3 2 8 1 1 11 */ 932, /* OBJ_brainpoolP384t1 1 3 36 3 3 2 8 1 1 12 */ 933, /* OBJ_brainpoolP512r1 1 3 36 3 3 2 8 1 1 13 */ 934, /* OBJ_brainpoolP512t1 1 3 36 3 3 2 8 1 1 14 */ 936, /* OBJ_dhSinglePass_stdDH_sha1kdf_scheme 1 3 133 16 840 63 0 2 */ 941, /* OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme 1 3 133 16 840 63 0 3 */ 418, /* OBJ_aes_128_ecb 2 16 840 1 101 3 4 1 1 */ 419, /* OBJ_aes_128_cbc 2 16 840 1 101 3 4 1 2 */ 420, /* OBJ_aes_128_ofb128 2 16 840 1 101 3 4 1 3 */ 421, /* OBJ_aes_128_cfb128 2 16 840 1 101 3 4 1 4 */ 788, /* OBJ_id_aes128_wrap 2 16 840 1 101 3 4 1 5 */ 895, /* OBJ_aes_128_gcm 2 16 840 1 101 3 4 1 6 */ 896, /* OBJ_aes_128_ccm 2 16 840 1 101 3 4 1 7 */ 897, /* OBJ_id_aes128_wrap_pad 2 16 840 1 101 3 4 1 8 */ 422, /* OBJ_aes_192_ecb 2 16 840 1 101 3 4 1 21 */ 423, /* OBJ_aes_192_cbc 2 16 840 1 101 3 4 1 22 */ 424, /* OBJ_aes_192_ofb128 2 16 840 1 101 3 4 1 23 */ 425, /* OBJ_aes_192_cfb128 2 16 840 1 101 3 4 1 24 */ 789, /* OBJ_id_aes192_wrap 2 16 840 1 101 3 4 1 25 */ 898, /* OBJ_aes_192_gcm 2 16 840 1 101 3 4 1 26 */ 899, /* OBJ_aes_192_ccm 2 16 840 1 101 3 4 1 27 */ 900, /* OBJ_id_aes192_wrap_pad 2 16 840 1 101 3 4 1 28 */ 426, /* OBJ_aes_256_ecb 2 16 840 1 101 3 4 1 41 */ 427, /* OBJ_aes_256_cbc 2 16 840 1 101 3 4 1 42 */ 428, /* OBJ_aes_256_ofb128 2 16 840 1 101 3 4 1 43 */ 429, /* OBJ_aes_256_cfb128 2 16 840 1 101 3 4 1 44 */ 790, /* OBJ_id_aes256_wrap 2 16 840 1 101 3 4 1 45 */ 901, /* OBJ_aes_256_gcm 2 16 840 1 101 3 4 1 46 */ 902, /* OBJ_aes_256_ccm 2 16 840 1 101 3 4 1 47 */ 903, /* OBJ_id_aes256_wrap_pad 2 16 840 1 101 3 4 1 48 */ 672, /* OBJ_sha256 2 16 840 1 101 3 4 2 1 */ 673, /* OBJ_sha384 2 16 840 1 101 3 4 2 2 */ 674, /* OBJ_sha512 2 16 840 1 101 3 4 2 3 */ 675, /* OBJ_sha224 2 16 840 1 101 3 4 2 4 */ 1094, /* OBJ_sha512_224 2 16 840 1 101 3 4 2 5 */ 1095, /* OBJ_sha512_256 2 16 840 1 101 3 4 2 6 */ 1096, /* OBJ_sha3_224 2 16 840 1 101 3 4 2 7 */ 1097, /* OBJ_sha3_256 2 16 840 1 101 3 4 2 8 */ 1098, /* OBJ_sha3_384 2 16 840 1 101 3 4 2 9 */ 1099, /* OBJ_sha3_512 2 16 840 1 101 3 4 2 10 */ 1100, /* OBJ_shake128 2 16 840 1 101 3 4 2 11 */ 1101, /* OBJ_shake256 2 16 840 1 101 3 4 2 12 */ 1102, /* OBJ_hmac_sha3_224 2 16 840 1 101 3 4 2 13 */ 1103, /* OBJ_hmac_sha3_256 2 16 840 1 101 3 4 2 14 */ 1104, /* OBJ_hmac_sha3_384 2 16 840 1 101 3 4 2 15 */ 1105, /* OBJ_hmac_sha3_512 2 16 840 1 101 3 4 2 16 */ 1196, /* OBJ_kmac128 2 16 840 1 101 3 4 2 19 */ 1197, /* OBJ_kmac256 2 16 840 1 101 3 4 2 20 */ 802, /* OBJ_dsa_with_SHA224 2 16 840 1 101 3 4 3 1 */ 803, /* OBJ_dsa_with_SHA256 2 16 840 1 101 3 4 3 2 */ 1106, /* OBJ_dsa_with_SHA384 2 16 840 1 101 3 4 3 3 */ 1107, /* OBJ_dsa_with_SHA512 2 16 840 1 101 3 4 3 4 */ 1108, /* OBJ_dsa_with_SHA3_224 2 16 840 1 101 3 4 3 5 */ 1109, /* OBJ_dsa_with_SHA3_256 2 16 840 1 101 3 4 3 6 */ 1110, /* OBJ_dsa_with_SHA3_384 2 16 840 1 101 3 4 3 7 */ 1111, /* OBJ_dsa_with_SHA3_512 2 16 840 1 101 3 4 3 8 */ 1112, /* OBJ_ecdsa_with_SHA3_224 2 16 840 1 101 3 4 3 9 */ 1113, /* OBJ_ecdsa_with_SHA3_256 2 16 840 1 101 3 4 3 10 */ 1114, /* OBJ_ecdsa_with_SHA3_384 2 16 840 1 101 3 4 3 11 */ 1115, /* OBJ_ecdsa_with_SHA3_512 2 16 840 1 101 3 4 3 12 */ 1116, /* OBJ_RSA_SHA3_224 2 16 840 1 101 3 4 3 13 */ 1117, /* OBJ_RSA_SHA3_256 2 16 840 1 101 3 4 3 14 */ 1118, /* OBJ_RSA_SHA3_384 2 16 840 1 101 3 4 3 15 */ 1119, /* OBJ_RSA_SHA3_512 2 16 840 1 101 3 4 3 16 */ 71, /* OBJ_netscape_cert_type 2 16 840 1 113730 1 1 */ 72, /* OBJ_netscape_base_url 2 16 840 1 113730 1 2 */ 73, /* OBJ_netscape_revocation_url 2 16 840 1 113730 1 3 */ 74, /* OBJ_netscape_ca_revocation_url 2 16 840 1 113730 1 4 */ 75, /* OBJ_netscape_renewal_url 2 16 840 1 113730 1 7 */ 76, /* OBJ_netscape_ca_policy_url 2 16 840 1 113730 1 8 */ 77, /* OBJ_netscape_ssl_server_name 2 16 840 1 113730 1 12 */ 78, /* OBJ_netscape_comment 2 16 840 1 113730 1 13 */ 79, /* OBJ_netscape_cert_sequence 2 16 840 1 113730 2 5 */ 139, /* OBJ_ns_sgc 2 16 840 1 113730 4 1 */ 458, /* OBJ_userId 0 9 2342 19200300 100 1 1 */ 459, /* OBJ_textEncodedORAddress 0 9 2342 19200300 100 1 2 */ 460, /* OBJ_rfc822Mailbox 0 9 2342 19200300 100 1 3 */ 461, /* OBJ_info 0 9 2342 19200300 100 1 4 */ 462, /* OBJ_favouriteDrink 0 9 2342 19200300 100 1 5 */ 463, /* OBJ_roomNumber 0 9 2342 19200300 100 1 6 */ 464, /* OBJ_photo 0 9 2342 19200300 100 1 7 */ 465, /* OBJ_userClass 0 9 2342 19200300 100 1 8 */ 466, /* OBJ_host 0 9 2342 19200300 100 1 9 */ 467, /* OBJ_manager 0 9 2342 19200300 100 1 10 */ 468, /* OBJ_documentIdentifier 0 9 2342 19200300 100 1 11 */ 469, /* OBJ_documentTitle 0 9 2342 19200300 100 1 12 */ 470, /* OBJ_documentVersion 0 9 2342 19200300 100 1 13 */ 471, /* OBJ_documentAuthor 0 9 2342 19200300 100 1 14 */ 472, /* OBJ_documentLocation 0 9 2342 19200300 100 1 15 */ 473, /* OBJ_homeTelephoneNumber 0 9 2342 19200300 100 1 20 */ 474, /* OBJ_secretary 0 9 2342 19200300 100 1 21 */ 475, /* OBJ_otherMailbox 0 9 2342 19200300 100 1 22 */ 476, /* OBJ_lastModifiedTime 0 9 2342 19200300 100 1 23 */ 477, /* OBJ_lastModifiedBy 0 9 2342 19200300 100 1 24 */ 391, /* OBJ_domainComponent 0 9 2342 19200300 100 1 25 */ 478, /* OBJ_aRecord 0 9 2342 19200300 100 1 26 */ 479, /* OBJ_pilotAttributeType27 0 9 2342 19200300 100 1 27 */ 480, /* OBJ_mXRecord 0 9 2342 19200300 100 1 28 */ 481, /* OBJ_nSRecord 0 9 2342 19200300 100 1 29 */ 482, /* OBJ_sOARecord 0 9 2342 19200300 100 1 30 */ 483, /* OBJ_cNAMERecord 0 9 2342 19200300 100 1 31 */ 484, /* OBJ_associatedDomain 0 9 2342 19200300 100 1 37 */ 485, /* OBJ_associatedName 0 9 2342 19200300 100 1 38 */ 486, /* OBJ_homePostalAddress 0 9 2342 19200300 100 1 39 */ 487, /* OBJ_personalTitle 0 9 2342 19200300 100 1 40 */ 488, /* OBJ_mobileTelephoneNumber 0 9 2342 19200300 100 1 41 */ 489, /* OBJ_pagerTelephoneNumber 0 9 2342 19200300 100 1 42 */ 490, /* OBJ_friendlyCountryName 0 9 2342 19200300 100 1 43 */ 102, /* OBJ_uniqueIdentifier 0 9 2342 19200300 100 1 44 */ 491, /* OBJ_organizationalStatus 0 9 2342 19200300 100 1 45 */ 492, /* OBJ_janetMailbox 0 9 2342 19200300 100 1 46 */ 493, /* OBJ_mailPreferenceOption 0 9 2342 19200300 100 1 47 */ 494, /* OBJ_buildingName 0 9 2342 19200300 100 1 48 */ 495, /* OBJ_dSAQuality 0 9 2342 19200300 100 1 49 */ 496, /* OBJ_singleLevelQuality 0 9 2342 19200300 100 1 50 */ 497, /* OBJ_subtreeMinimumQuality 0 9 2342 19200300 100 1 51 */ 498, /* OBJ_subtreeMaximumQuality 0 9 2342 19200300 100 1 52 */ 499, /* OBJ_personalSignature 0 9 2342 19200300 100 1 53 */ 500, /* OBJ_dITRedirect 0 9 2342 19200300 100 1 54 */ 501, /* OBJ_audio 0 9 2342 19200300 100 1 55 */ 502, /* OBJ_documentPublisher 0 9 2342 19200300 100 1 56 */ 442, /* OBJ_iA5StringSyntax 0 9 2342 19200300 100 3 4 */ 443, /* OBJ_caseIgnoreIA5StringSyntax 0 9 2342 19200300 100 3 5 */ 444, /* OBJ_pilotObject 0 9 2342 19200300 100 4 3 */ 445, /* OBJ_pilotPerson 0 9 2342 19200300 100 4 4 */ 446, /* OBJ_account 0 9 2342 19200300 100 4 5 */ 447, /* OBJ_document 0 9 2342 19200300 100 4 6 */ 448, /* OBJ_room 0 9 2342 19200300 100 4 7 */ 449, /* OBJ_documentSeries 0 9 2342 19200300 100 4 9 */ 392, /* OBJ_Domain 0 9 2342 19200300 100 4 13 */ 450, /* OBJ_rFC822localPart 0 9 2342 19200300 100 4 14 */ 451, /* OBJ_dNSDomain 0 9 2342 19200300 100 4 15 */ 452, /* OBJ_domainRelatedObject 0 9 2342 19200300 100 4 17 */ 453, /* OBJ_friendlyCountry 0 9 2342 19200300 100 4 18 */ 454, /* OBJ_simpleSecurityObject 0 9 2342 19200300 100 4 19 */ 455, /* OBJ_pilotOrganization 0 9 2342 19200300 100 4 20 */ 456, /* OBJ_pilotDSA 0 9 2342 19200300 100 4 21 */ 457, /* OBJ_qualityLabelledData 0 9 2342 19200300 100 4 22 */ 1281, /* OBJ_hmacWithSM3 1 2 156 10197 1 401 3 1 */ 1152, /* OBJ_dstu28147 1 2 804 2 1 1 1 1 1 1 */ 1156, /* OBJ_hmacWithDstu34311 1 2 804 2 1 1 1 1 1 2 */ 1157, /* OBJ_dstu34311 1 2 804 2 1 1 1 1 2 1 */ 189, /* OBJ_id_smime_mod 1 2 840 113549 1 9 16 0 */ 190, /* OBJ_id_smime_ct 1 2 840 113549 1 9 16 1 */ 191, /* OBJ_id_smime_aa 1 2 840 113549 1 9 16 2 */ 192, /* OBJ_id_smime_alg 1 2 840 113549 1 9 16 3 */ 193, /* OBJ_id_smime_cd 1 2 840 113549 1 9 16 4 */ 194, /* OBJ_id_smime_spq 1 2 840 113549 1 9 16 5 */ 195, /* OBJ_id_smime_cti 1 2 840 113549 1 9 16 6 */ 158, /* OBJ_x509Certificate 1 2 840 113549 1 9 22 1 */ 159, /* OBJ_sdsiCertificate 1 2 840 113549 1 9 22 2 */ 160, /* OBJ_x509Crl 1 2 840 113549 1 9 23 1 */ 144, /* OBJ_pbe_WithSHA1And128BitRC4 1 2 840 113549 1 12 1 1 */ 145, /* OBJ_pbe_WithSHA1And40BitRC4 1 2 840 113549 1 12 1 2 */ 146, /* OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC 1 2 840 113549 1 12 1 3 */ 147, /* OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC 1 2 840 113549 1 12 1 4 */ 148, /* OBJ_pbe_WithSHA1And128BitRC2_CBC 1 2 840 113549 1 12 1 5 */ 149, /* OBJ_pbe_WithSHA1And40BitRC2_CBC 1 2 840 113549 1 12 1 6 */ 171, /* OBJ_ms_ext_req 1 3 6 1 4 1 311 2 1 14 */ 134, /* OBJ_ms_code_ind 1 3 6 1 4 1 311 2 1 21 */ 135, /* OBJ_ms_code_com 1 3 6 1 4 1 311 2 1 22 */ 136, /* OBJ_ms_ctl_sign 1 3 6 1 4 1 311 10 3 1 */ 137, /* OBJ_ms_sgc 1 3 6 1 4 1 311 10 3 3 */ 138, /* OBJ_ms_efs 1 3 6 1 4 1 311 10 3 4 */ 648, /* OBJ_ms_smartcard_login 1 3 6 1 4 1 311 20 2 2 */ 649, /* OBJ_ms_upn 1 3 6 1 4 1 311 20 2 3 */ 1291, /* OBJ_ms_ntds_obj_sid 1 3 6 1 4 1 311 25 2 1 */ 1201, /* OBJ_blake2bmac 1 3 6 1 4 1 1722 12 2 1 */ 1202, /* OBJ_blake2smac 1 3 6 1 4 1 1722 12 2 2 */ 951, /* OBJ_ct_precert_scts 1 3 6 1 4 1 11129 2 4 2 */ 952, /* OBJ_ct_precert_poison 1 3 6 1 4 1 11129 2 4 3 */ 953, /* OBJ_ct_precert_signer 1 3 6 1 4 1 11129 2 4 4 */ 954, /* OBJ_ct_cert_scts 1 3 6 1 4 1 11129 2 4 5 */ 751, /* OBJ_camellia_128_cbc 1 2 392 200011 61 1 1 1 2 */ 752, /* OBJ_camellia_192_cbc 1 2 392 200011 61 1 1 1 3 */ 753, /* OBJ_camellia_256_cbc 1 2 392 200011 61 1 1 1 4 */ 907, /* OBJ_id_camellia128_wrap 1 2 392 200011 61 1 1 3 2 */ 908, /* OBJ_id_camellia192_wrap 1 2 392 200011 61 1 1 3 3 */ 909, /* OBJ_id_camellia256_wrap 1 2 392 200011 61 1 1 3 4 */ 1153, /* OBJ_dstu28147_ofb 1 2 804 2 1 1 1 1 1 1 2 */ 1154, /* OBJ_dstu28147_cfb 1 2 804 2 1 1 1 1 1 1 3 */ 1155, /* OBJ_dstu28147_wrap 1 2 804 2 1 1 1 1 1 1 5 */ 1158, /* OBJ_dstu4145le 1 2 804 2 1 1 1 1 3 1 1 */ 196, /* OBJ_id_smime_mod_cms 1 2 840 113549 1 9 16 0 1 */ 197, /* OBJ_id_smime_mod_ess 1 2 840 113549 1 9 16 0 2 */ 198, /* OBJ_id_smime_mod_oid 1 2 840 113549 1 9 16 0 3 */ 199, /* OBJ_id_smime_mod_msg_v3 1 2 840 113549 1 9 16 0 4 */ 200, /* OBJ_id_smime_mod_ets_eSignature_88 1 2 840 113549 1 9 16 0 5 */ 201, /* OBJ_id_smime_mod_ets_eSignature_97 1 2 840 113549 1 9 16 0 6 */ 202, /* OBJ_id_smime_mod_ets_eSigPolicy_88 1 2 840 113549 1 9 16 0 7 */ 203, /* OBJ_id_smime_mod_ets_eSigPolicy_97 1 2 840 113549 1 9 16 0 8 */ 204, /* OBJ_id_smime_ct_receipt 1 2 840 113549 1 9 16 1 1 */ 205, /* OBJ_id_smime_ct_authData 1 2 840 113549 1 9 16 1 2 */ 206, /* OBJ_id_smime_ct_publishCert 1 2 840 113549 1 9 16 1 3 */ 207, /* OBJ_id_smime_ct_TSTInfo 1 2 840 113549 1 9 16 1 4 */ 208, /* OBJ_id_smime_ct_TDTInfo 1 2 840 113549 1 9 16 1 5 */ 209, /* OBJ_id_smime_ct_contentInfo 1 2 840 113549 1 9 16 1 6 */ 210, /* OBJ_id_smime_ct_DVCSRequestData 1 2 840 113549 1 9 16 1 7 */ 211, /* OBJ_id_smime_ct_DVCSResponseData 1 2 840 113549 1 9 16 1 8 */ 786, /* OBJ_id_smime_ct_compressedData 1 2 840 113549 1 9 16 1 9 */ 1058, /* OBJ_id_smime_ct_contentCollection 1 2 840 113549 1 9 16 1 19 */ 1059, /* OBJ_id_smime_ct_authEnvelopedData 1 2 840 113549 1 9 16 1 23 */ 1234, /* OBJ_id_ct_routeOriginAuthz 1 2 840 113549 1 9 16 1 24 */ 1235, /* OBJ_id_ct_rpkiManifest 1 2 840 113549 1 9 16 1 26 */ 787, /* OBJ_id_ct_asciiTextWithCRLF 1 2 840 113549 1 9 16 1 27 */ 1060, /* OBJ_id_ct_xml 1 2 840 113549 1 9 16 1 28 */ 1236, /* OBJ_id_ct_rpkiGhostbusters 1 2 840 113549 1 9 16 1 35 */ 1237, /* OBJ_id_ct_resourceTaggedAttest 1 2 840 113549 1 9 16 1 36 */ 1246, /* OBJ_id_ct_geofeedCSVwithCRLF 1 2 840 113549 1 9 16 1 47 */ 1247, /* OBJ_id_ct_signedChecklist 1 2 840 113549 1 9 16 1 48 */ 1250, /* OBJ_id_ct_ASPA 1 2 840 113549 1 9 16 1 49 */ 1284, /* OBJ_id_ct_signedTAL 1 2 840 113549 1 9 16 1 50 */ 212, /* OBJ_id_smime_aa_receiptRequest 1 2 840 113549 1 9 16 2 1 */ 213, /* OBJ_id_smime_aa_securityLabel 1 2 840 113549 1 9 16 2 2 */ 214, /* OBJ_id_smime_aa_mlExpandHistory 1 2 840 113549 1 9 16 2 3 */ 215, /* OBJ_id_smime_aa_contentHint 1 2 840 113549 1 9 16 2 4 */ 216, /* OBJ_id_smime_aa_msgSigDigest 1 2 840 113549 1 9 16 2 5 */ 217, /* OBJ_id_smime_aa_encapContentType 1 2 840 113549 1 9 16 2 6 */ 218, /* OBJ_id_smime_aa_contentIdentifier 1 2 840 113549 1 9 16 2 7 */ 219, /* OBJ_id_smime_aa_macValue 1 2 840 113549 1 9 16 2 8 */ 220, /* OBJ_id_smime_aa_equivalentLabels 1 2 840 113549 1 9 16 2 9 */ 221, /* OBJ_id_smime_aa_contentReference 1 2 840 113549 1 9 16 2 10 */ 222, /* OBJ_id_smime_aa_encrypKeyPref 1 2 840 113549 1 9 16 2 11 */ 223, /* OBJ_id_smime_aa_signingCertificate 1 2 840 113549 1 9 16 2 12 */ 224, /* OBJ_id_smime_aa_smimeEncryptCerts 1 2 840 113549 1 9 16 2 13 */ 225, /* OBJ_id_smime_aa_timeStampToken 1 2 840 113549 1 9 16 2 14 */ 226, /* OBJ_id_smime_aa_ets_sigPolicyId 1 2 840 113549 1 9 16 2 15 */ 227, /* OBJ_id_smime_aa_ets_commitmentType 1 2 840 113549 1 9 16 2 16 */ 228, /* OBJ_id_smime_aa_ets_signerLocation 1 2 840 113549 1 9 16 2 17 */ 229, /* OBJ_id_smime_aa_ets_signerAttr 1 2 840 113549 1 9 16 2 18 */ 230, /* OBJ_id_smime_aa_ets_otherSigCert 1 2 840 113549 1 9 16 2 19 */ 231, /* OBJ_id_smime_aa_ets_contentTimestamp 1 2 840 113549 1 9 16 2 20 */ 232, /* OBJ_id_smime_aa_ets_CertificateRefs 1 2 840 113549 1 9 16 2 21 */ 233, /* OBJ_id_smime_aa_ets_RevocationRefs 1 2 840 113549 1 9 16 2 22 */ 234, /* OBJ_id_smime_aa_ets_certValues 1 2 840 113549 1 9 16 2 23 */ 235, /* OBJ_id_smime_aa_ets_revocationValues 1 2 840 113549 1 9 16 2 24 */ 236, /* OBJ_id_smime_aa_ets_escTimeStamp 1 2 840 113549 1 9 16 2 25 */ 237, /* OBJ_id_smime_aa_ets_certCRLTimestamp 1 2 840 113549 1 9 16 2 26 */ 238, /* OBJ_id_smime_aa_ets_archiveTimeStamp 1 2 840 113549 1 9 16 2 27 */ 239, /* OBJ_id_smime_aa_signatureType 1 2 840 113549 1 9 16 2 28 */ 240, /* OBJ_id_smime_aa_dvcs_dvc 1 2 840 113549 1 9 16 2 29 */ 1261, /* OBJ_id_aa_ets_attrCertificateRefs 1 2 840 113549 1 9 16 2 44 */ 1262, /* OBJ_id_aa_ets_attrRevocationRefs 1 2 840 113549 1 9 16 2 45 */ 1086, /* OBJ_id_smime_aa_signingCertificateV2 1 2 840 113549 1 9 16 2 47 */ 1280, /* OBJ_id_aa_ets_archiveTimestampV2 1 2 840 113549 1 9 16 2 48 */ 241, /* OBJ_id_smime_alg_ESDHwith3DES 1 2 840 113549 1 9 16 3 1 */ 242, /* OBJ_id_smime_alg_ESDHwithRC2 1 2 840 113549 1 9 16 3 2 */ 243, /* OBJ_id_smime_alg_3DESwrap 1 2 840 113549 1 9 16 3 3 */ 244, /* OBJ_id_smime_alg_RC2wrap 1 2 840 113549 1 9 16 3 4 */ 245, /* OBJ_id_smime_alg_ESDH 1 2 840 113549 1 9 16 3 5 */ 246, /* OBJ_id_smime_alg_CMS3DESwrap 1 2 840 113549 1 9 16 3 6 */ 247, /* OBJ_id_smime_alg_CMSRC2wrap 1 2 840 113549 1 9 16 3 7 */ 125, /* OBJ_zlib_compression 1 2 840 113549 1 9 16 3 8 */ 893, /* OBJ_id_alg_PWRI_KEK 1 2 840 113549 1 9 16 3 9 */ 248, /* OBJ_id_smime_cd_ldap 1 2 840 113549 1 9 16 4 1 */ 249, /* OBJ_id_smime_spq_ets_sqt_uri 1 2 840 113549 1 9 16 5 1 */ 250, /* OBJ_id_smime_spq_ets_sqt_unotice 1 2 840 113549 1 9 16 5 2 */ 251, /* OBJ_id_smime_cti_ets_proofOfOrigin 1 2 840 113549 1 9 16 6 1 */ 252, /* OBJ_id_smime_cti_ets_proofOfReceipt 1 2 840 113549 1 9 16 6 2 */ 253, /* OBJ_id_smime_cti_ets_proofOfDelivery 1 2 840 113549 1 9 16 6 3 */ 254, /* OBJ_id_smime_cti_ets_proofOfSender 1 2 840 113549 1 9 16 6 4 */ 255, /* OBJ_id_smime_cti_ets_proofOfApproval 1 2 840 113549 1 9 16 6 5 */ 256, /* OBJ_id_smime_cti_ets_proofOfCreation 1 2 840 113549 1 9 16 6 6 */ 150, /* OBJ_keyBag 1 2 840 113549 1 12 10 1 1 */ 151, /* OBJ_pkcs8ShroudedKeyBag 1 2 840 113549 1 12 10 1 2 */ 152, /* OBJ_certBag 1 2 840 113549 1 12 10 1 3 */ 153, /* OBJ_crlBag 1 2 840 113549 1 12 10 1 4 */ 154, /* OBJ_secretBag 1 2 840 113549 1 12 10 1 5 */ 155, /* OBJ_safeContentsBag 1 2 840 113549 1 12 10 1 6 */ 34, /* OBJ_idea_cbc 1 3 6 1 4 1 188 7 1 1 2 */ 955, /* OBJ_jurisdictionLocalityName 1 3 6 1 4 1 311 60 2 1 1 */ 956, /* OBJ_jurisdictionStateOrProvinceName 1 3 6 1 4 1 311 60 2 1 2 */ 957, /* OBJ_jurisdictionCountryName 1 3 6 1 4 1 311 60 2 1 3 */ 1056, /* OBJ_blake2b512 1 3 6 1 4 1 1722 12 2 1 16 */ 1057, /* OBJ_blake2s256 1 3 6 1 4 1 1722 12 2 2 8 */ 1283, /* OBJ_oracle_jdk_trustedkeyusage 2 16 840 1 113894 746875 1 1 */ 1159, /* OBJ_dstu4145be 1 2 804 2 1 1 1 1 3 1 1 1 1 */ 1160, /* OBJ_uacurve0 1 2 804 2 1 1 1 1 3 1 1 2 0 */ 1161, /* OBJ_uacurve1 1 2 804 2 1 1 1 1 3 1 1 2 1 */ 1162, /* OBJ_uacurve2 1 2 804 2 1 1 1 1 3 1 1 2 2 */ 1163, /* OBJ_uacurve3 1 2 804 2 1 1 1 1 3 1 1 2 3 */ 1164, /* OBJ_uacurve4 1 2 804 2 1 1 1 1 3 1 1 2 4 */ 1165, /* OBJ_uacurve5 1 2 804 2 1 1 1 1 3 1 1 2 5 */ 1166, /* OBJ_uacurve6 1 2 804 2 1 1 1 1 3 1 1 2 6 */ 1167, /* OBJ_uacurve7 1 2 804 2 1 1 1 1 3 1 1 2 7 */ 1168, /* OBJ_uacurve8 1 2 804 2 1 1 1 1 3 1 1 2 8 */ 1169, /* OBJ_uacurve9 1 2 804 2 1 1 1 1 3 1 1 2 9 */ };
./openssl/crypto/objects/obj_lib.c
/* * Copyright 1995-2020 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 */ #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/objects.h> #include <openssl/buffer.h> #include "crypto/asn1.h" ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) { ASN1_OBJECT *r; if (o == NULL) return NULL; /* If object isn't dynamic it's an internal OID which is never freed */ if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC)) return (ASN1_OBJECT *)o; r = ASN1_OBJECT_new(); if (r == NULL) { ERR_raise(ERR_LIB_OBJ, ERR_R_ASN1_LIB); return NULL; } /* Set dynamic flags so everything gets freed up on error */ r->flags = o->flags | (ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS | ASN1_OBJECT_FLAG_DYNAMIC_DATA); if (o->length > 0 && (r->data = OPENSSL_memdup(o->data, o->length)) == NULL) goto err; r->length = o->length; r->nid = o->nid; if (o->ln != NULL && (r->ln = OPENSSL_strdup(o->ln)) == NULL) goto err; if (o->sn != NULL && (r->sn = OPENSSL_strdup(o->sn)) == NULL) goto err; return r; err: ASN1_OBJECT_free(r); return NULL; } int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b) { int ret; ret = (a->length - b->length); if (ret) return ret; return memcmp(a->data, b->data, a->length); }
./openssl/crypto/objects/obj_local.h
/* * Copyright 2016 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 */ typedef struct name_funcs_st NAME_FUNCS; DEFINE_STACK_OF(NAME_FUNCS) DEFINE_LHASH_OF_EX(OBJ_NAME); typedef struct added_obj_st ADDED_OBJ; DEFINE_LHASH_OF_EX(ADDED_OBJ);
./openssl/crypto/objects/obj_xref.c
/* * Copyright 2006-2022 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 */ #include <openssl/objects.h> #include "obj_xref.h" #include "internal/nelem.h" #include "internal/thread_once.h" #include <openssl/err.h> static STACK_OF(nid_triple) *sig_app, *sigx_app; static CRYPTO_RWLOCK *sig_lock; static int sig_cmp(const nid_triple *a, const nid_triple *b) { return a->sign_id - b->sign_id; } DECLARE_OBJ_BSEARCH_CMP_FN(nid_triple, nid_triple, sig); IMPLEMENT_OBJ_BSEARCH_CMP_FN(nid_triple, nid_triple, sig); static int sig_sk_cmp(const nid_triple *const *a, const nid_triple *const *b) { return (*a)->sign_id - (*b)->sign_id; } DECLARE_OBJ_BSEARCH_CMP_FN(const nid_triple *, const nid_triple *, sigx); static int sigx_cmp(const nid_triple *const *a, const nid_triple *const *b) { int ret; ret = (*a)->hash_id - (*b)->hash_id; /* The "b" side of the comparison carries the algorithms already * registered. A NID_undef for 'hash_id' there means that the * signature algorithm doesn't need a digest to operate OK. In * such case, any hash_id/digest algorithm on the test side (a), * incl. NID_undef, is acceptable. signature algorithm NID * (pkey_id) must match in any case. */ if ((ret != 0) && ((*b)->hash_id != NID_undef)) return ret; return (*a)->pkey_id - (*b)->pkey_id; } IMPLEMENT_OBJ_BSEARCH_CMP_FN(const nid_triple *, const nid_triple *, sigx); static CRYPTO_ONCE sig_init = CRYPTO_ONCE_STATIC_INIT; DEFINE_RUN_ONCE_STATIC(o_sig_init) { sig_lock = CRYPTO_THREAD_lock_new(); return sig_lock != NULL; } static ossl_inline int obj_sig_init(void) { return RUN_ONCE(&sig_init, o_sig_init); } static int ossl_obj_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid, int lock) { nid_triple tmp; const nid_triple *rv; int idx; if (signid == NID_undef) return 0; tmp.sign_id = signid; rv = OBJ_bsearch_sig(&tmp, sigoid_srt, OSSL_NELEM(sigoid_srt)); if (rv == NULL) { if (!obj_sig_init()) return 0; if (lock && !CRYPTO_THREAD_read_lock(sig_lock)) { ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_READ_LOCK); return 0; } if (sig_app != NULL) { idx = sk_nid_triple_find(sig_app, &tmp); if (idx >= 0) rv = sk_nid_triple_value(sig_app, idx); } if (lock) CRYPTO_THREAD_unlock(sig_lock); if (rv == NULL) return 0; } if (pdig_nid != NULL) *pdig_nid = rv->hash_id; if (ppkey_nid != NULL) *ppkey_nid = rv->pkey_id; return 1; } int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid) { return ossl_obj_find_sigid_algs(signid, pdig_nid, ppkey_nid, 1); } int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid) { nid_triple tmp; const nid_triple *t = &tmp; const nid_triple **rv; int idx; /* permitting searches for sig algs without digest: */ if (pkey_nid == NID_undef) return 0; tmp.hash_id = dig_nid; tmp.pkey_id = pkey_nid; rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref, OSSL_NELEM(sigoid_srt_xref)); if (rv == NULL) { if (!obj_sig_init()) return 0; if (!CRYPTO_THREAD_read_lock(sig_lock)) { ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_READ_LOCK); return 0; } if (sigx_app != NULL) { idx = sk_nid_triple_find(sigx_app, &tmp); if (idx >= 0) { t = sk_nid_triple_value(sigx_app, idx); rv = &t; } } CRYPTO_THREAD_unlock(sig_lock); if (rv == NULL) return 0; } if (psignid != NULL) *psignid = (*rv)->sign_id; return 1; } int OBJ_add_sigid(int signid, int dig_id, int pkey_id) { nid_triple *ntr; int dnid = NID_undef, pnid = NID_undef, ret = 0; if (signid == NID_undef || pkey_id == NID_undef) return 0; if (!obj_sig_init()) return 0; if ((ntr = OPENSSL_malloc(sizeof(*ntr))) == NULL) return 0; ntr->sign_id = signid; ntr->hash_id = dig_id; ntr->pkey_id = pkey_id; if (!CRYPTO_THREAD_write_lock(sig_lock)) { ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_WRITE_LOCK); OPENSSL_free(ntr); return 0; } /* Check that the entry doesn't exist or exists as desired */ if (ossl_obj_find_sigid_algs(signid, &dnid, &pnid, 0)) { ret = dnid == dig_id && pnid == pkey_id; goto err; } if (sig_app == NULL) { sig_app = sk_nid_triple_new(sig_sk_cmp); if (sig_app == NULL) goto err; } if (sigx_app == NULL) { sigx_app = sk_nid_triple_new(sigx_cmp); if (sigx_app == NULL) goto err; } /* * Better might be to find where to insert the element and insert it there. * This would avoid the sorting steps below. */ if (!sk_nid_triple_push(sig_app, ntr)) goto err; if (!sk_nid_triple_push(sigx_app, ntr)) { ntr = NULL; /* This is referenced by sig_app still */ goto err; } sk_nid_triple_sort(sig_app); sk_nid_triple_sort(sigx_app); ntr = NULL; ret = 1; err: OPENSSL_free(ntr); CRYPTO_THREAD_unlock(sig_lock); return ret; } static void sid_free(nid_triple *tt) { OPENSSL_free(tt); } void OBJ_sigid_free(void) { sk_nid_triple_pop_free(sig_app, sid_free); sk_nid_triple_free(sigx_app); CRYPTO_THREAD_lock_free(sig_lock); sig_app = NULL; sigx_app = NULL; sig_lock = NULL; }
./openssl/crypto/cmac/cmac.c
/* * Copyright 2010-2023 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 */ /* * CMAC low level APIs are deprecated for public use, but still ok for internal * use. */ #include "internal/deprecated.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "internal/cryptlib.h" #include <openssl/cmac.h> #include <openssl/err.h> #define LOCAL_BUF_SIZE 2048 struct CMAC_CTX_st { /* Cipher context to use */ EVP_CIPHER_CTX *cctx; /* Keys k1 and k2 */ unsigned char k1[EVP_MAX_BLOCK_LENGTH]; unsigned char k2[EVP_MAX_BLOCK_LENGTH]; /* Temporary block */ unsigned char tbl[EVP_MAX_BLOCK_LENGTH]; /* Last (possibly partial) block */ unsigned char last_block[EVP_MAX_BLOCK_LENGTH]; /* Number of bytes in last block: -1 means context not initialised */ int nlast_block; }; /* Make temporary keys K1 and K2 */ static void make_kn(unsigned char *k1, const unsigned char *l, int bl) { int i; unsigned char c = l[0], carry = c >> 7, cnext; /* Shift block to left, including carry */ for (i = 0; i < bl - 1; i++, c = cnext) k1[i] = (c << 1) | ((cnext = l[i + 1]) >> 7); /* If MSB set fixup with R */ k1[i] = (c << 1) ^ ((0 - carry) & (bl == 16 ? 0x87 : 0x1b)); } CMAC_CTX *CMAC_CTX_new(void) { CMAC_CTX *ctx; if ((ctx = OPENSSL_malloc(sizeof(*ctx))) == NULL) return NULL; ctx->cctx = EVP_CIPHER_CTX_new(); if (ctx->cctx == NULL) { OPENSSL_free(ctx); return NULL; } ctx->nlast_block = -1; return ctx; } void CMAC_CTX_cleanup(CMAC_CTX *ctx) { EVP_CIPHER_CTX_reset(ctx->cctx); OPENSSL_cleanse(ctx->tbl, EVP_MAX_BLOCK_LENGTH); OPENSSL_cleanse(ctx->k1, EVP_MAX_BLOCK_LENGTH); OPENSSL_cleanse(ctx->k2, EVP_MAX_BLOCK_LENGTH); OPENSSL_cleanse(ctx->last_block, EVP_MAX_BLOCK_LENGTH); ctx->nlast_block = -1; } EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx) { return ctx->cctx; } void CMAC_CTX_free(CMAC_CTX *ctx) { if (!ctx) return; CMAC_CTX_cleanup(ctx); EVP_CIPHER_CTX_free(ctx->cctx); OPENSSL_free(ctx); } int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in) { int bl; if (in->nlast_block == -1) return 0; if ((bl = EVP_CIPHER_CTX_get_block_size(in->cctx)) < 0) return 0; if (!EVP_CIPHER_CTX_copy(out->cctx, in->cctx)) return 0; memcpy(out->k1, in->k1, bl); memcpy(out->k2, in->k2, bl); memcpy(out->tbl, in->tbl, bl); memcpy(out->last_block, in->last_block, bl); out->nlast_block = in->nlast_block; return 1; } int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, const EVP_CIPHER *cipher, ENGINE *impl) { static const unsigned char zero_iv[EVP_MAX_BLOCK_LENGTH] = { 0 }; /* All zeros means restart */ if (!key && !cipher && !impl && keylen == 0) { /* Not initialised */ if (ctx->nlast_block == -1) return 0; if (!EVP_EncryptInit_ex(ctx->cctx, NULL, NULL, NULL, zero_iv)) return 0; memset(ctx->tbl, 0, EVP_CIPHER_CTX_get_block_size(ctx->cctx)); ctx->nlast_block = 0; return 1; } /* Initialise context */ if (cipher != NULL) { /* Ensure we can't use this ctx until we also have a key */ ctx->nlast_block = -1; if (!EVP_EncryptInit_ex(ctx->cctx, cipher, impl, NULL, NULL)) return 0; } /* Non-NULL key means initialisation complete */ if (key != NULL) { int bl; /* If anything fails then ensure we can't use this ctx */ ctx->nlast_block = -1; if (EVP_CIPHER_CTX_get0_cipher(ctx->cctx) == NULL) return 0; if (EVP_CIPHER_CTX_set_key_length(ctx->cctx, keylen) <= 0) return 0; if (!EVP_EncryptInit_ex(ctx->cctx, NULL, NULL, key, zero_iv)) return 0; if ((bl = EVP_CIPHER_CTX_get_block_size(ctx->cctx)) < 0) return 0; if (EVP_Cipher(ctx->cctx, ctx->tbl, zero_iv, bl) <= 0) return 0; make_kn(ctx->k1, ctx->tbl, bl); make_kn(ctx->k2, ctx->k1, bl); OPENSSL_cleanse(ctx->tbl, bl); /* Reset context again ready for first data block */ if (!EVP_EncryptInit_ex(ctx->cctx, NULL, NULL, NULL, zero_iv)) return 0; /* Zero tbl so resume works */ memset(ctx->tbl, 0, bl); ctx->nlast_block = 0; } return 1; } int CMAC_Update(CMAC_CTX *ctx, const void *in, size_t dlen) { const unsigned char *data = in; int bl; size_t max_burst_blocks, cipher_blocks; unsigned char buf[LOCAL_BUF_SIZE]; if (ctx->nlast_block == -1) return 0; if (dlen == 0) return 1; if ((bl = EVP_CIPHER_CTX_get_block_size(ctx->cctx)) < 0) return 0; /* Copy into partial block if we need to */ if (ctx->nlast_block > 0) { size_t nleft; nleft = bl - ctx->nlast_block; if (dlen < nleft) nleft = dlen; memcpy(ctx->last_block + ctx->nlast_block, data, nleft); dlen -= nleft; ctx->nlast_block += nleft; /* If no more to process return */ if (dlen == 0) return 1; data += nleft; /* Else not final block so encrypt it */ if (EVP_Cipher(ctx->cctx, ctx->tbl, ctx->last_block, bl) <= 0) return 0; } /* Encrypt all but one of the complete blocks left */ max_burst_blocks = LOCAL_BUF_SIZE / bl; cipher_blocks = (dlen - 1) / bl; if (max_burst_blocks == 0) { /* * When block length is greater than local buffer size, * use ctx->tbl as cipher output. */ while (dlen > (size_t)bl) { if (EVP_Cipher(ctx->cctx, ctx->tbl, data, bl) <= 0) return 0; dlen -= bl; data += bl; } } else { while (cipher_blocks > max_burst_blocks) { if (EVP_Cipher(ctx->cctx, buf, data, max_burst_blocks * bl) <= 0) return 0; dlen -= max_burst_blocks * bl; data += max_burst_blocks * bl; cipher_blocks -= max_burst_blocks; } if (cipher_blocks > 0) { if (EVP_Cipher(ctx->cctx, buf, data, cipher_blocks * bl) <= 0) return 0; dlen -= cipher_blocks * bl; data += cipher_blocks * bl; memcpy(ctx->tbl, &buf[(cipher_blocks - 1) * bl], bl); } } /* Copy any data left to last block buffer */ memcpy(ctx->last_block, data, dlen); ctx->nlast_block = dlen; return 1; } int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen) { int i, bl, lb; if (ctx->nlast_block == -1) return 0; if ((bl = EVP_CIPHER_CTX_get_block_size(ctx->cctx)) < 0) return 0; if (poutlen != NULL) *poutlen = (size_t)bl; if (!out) return 1; lb = ctx->nlast_block; /* Is last block complete? */ if (lb == bl) { for (i = 0; i < bl; i++) out[i] = ctx->last_block[i] ^ ctx->k1[i]; } else { ctx->last_block[lb] = 0x80; if (bl - lb > 1) memset(ctx->last_block + lb + 1, 0, bl - lb - 1); for (i = 0; i < bl; i++) out[i] = ctx->last_block[i] ^ ctx->k2[i]; } if (EVP_Cipher(ctx->cctx, out, out, bl) <= 0) { OPENSSL_cleanse(out, bl); return 0; } return 1; } int CMAC_resume(CMAC_CTX *ctx) { if (ctx->nlast_block == -1) return 0; /* * The buffer "tbl" contains the last fully encrypted block which is the * last IV (or all zeroes if no last encrypted block). The last block has * not been modified since CMAC_final(). So reinitialising using the last * decrypted block will allow CMAC to continue after calling * CMAC_Final(). */ return EVP_EncryptInit_ex(ctx->cctx, NULL, NULL, NULL, ctx->tbl); }
./openssl/crypto/seed/seed_local.h
/* * Copyright 2007-2021 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 */ /* * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Neither the name of author nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #ifndef OSSL_CRYPTO_SEED_LOCAL_H # define OSSL_CRYPTO_SEED_LOCAL_H # include <openssl/e_os2.h> # include <openssl/seed.h> # ifdef SEED_LONG /* need 32-bit type */ typedef unsigned long seed_word; # else typedef unsigned int seed_word; # endif # define char2word(c, i) \ (i) = ((((seed_word)(c)[0]) << 24) | (((seed_word)(c)[1]) << 16) | (((seed_word)(c)[2]) << 8) | ((seed_word)(c)[3])) # define word2char(l, c) \ *((c)+0) = (unsigned char)((l)>>24) & 0xff; \ *((c)+1) = (unsigned char)((l)>>16) & 0xff; \ *((c)+2) = (unsigned char)((l)>> 8) & 0xff; \ *((c)+3) = (unsigned char)((l)) & 0xff # define KEYSCHEDULE_UPDATE0(T0, T1, X1, X2, X3, X4, KC) \ (T0) = (X3); \ (X3) = (((X3)<<8) ^ ((X4)>>24)) & 0xffffffff; \ (X4) = (((X4)<<8) ^ ((T0)>>24)) & 0xffffffff; \ (T0) = ((X1) + (X3) - (KC)) & 0xffffffff; \ (T1) = ((X2) + (KC) - (X4)) & 0xffffffff # define KEYSCHEDULE_UPDATE1(T0, T1, X1, X2, X3, X4, KC) \ (T0) = (X1); \ (X1) = (((X1)>>8) ^ ((X2)<<24)) & 0xffffffff; \ (X2) = (((X2)>>8) ^ ((T0)<<24)) & 0xffffffff; \ (T0) = ((X1) + (X3) - (KC)) & 0xffffffff; \ (T1) = ((X2) + (KC) - (X4)) & 0xffffffff # define KEYUPDATE_TEMP(T0, T1, K) \ (K)[0] = G_FUNC((T0)); \ (K)[1] = G_FUNC((T1)) # define XOR_SEEDBLOCK(DST, SRC) \ ((DST))[0] ^= ((SRC))[0]; \ ((DST))[1] ^= ((SRC))[1]; \ ((DST))[2] ^= ((SRC))[2]; \ ((DST))[3] ^= ((SRC))[3] # define MOV_SEEDBLOCK(DST, SRC) \ ((DST))[0] = ((SRC))[0]; \ ((DST))[1] = ((SRC))[1]; \ ((DST))[2] = ((SRC))[2]; \ ((DST))[3] = ((SRC))[3] # define CHAR2WORD(C, I) \ char2word((C), (I)[0]); \ char2word((C+4), (I)[1]); \ char2word((C+8), (I)[2]); \ char2word((C+12), (I)[3]) # define WORD2CHAR(I, C) \ word2char((I)[0], (C)); \ word2char((I)[1], (C+4)); \ word2char((I)[2], (C+8)); \ word2char((I)[3], (C+12)) # define E_SEED(T0, T1, X1, X2, X3, X4, rbase) \ (T0) = (X3) ^ (ks->data)[(rbase)]; \ (T1) = (X4) ^ (ks->data)[(rbase)+1]; \ (T1) ^= (T0); \ (T1) = G_FUNC((T1)); \ (T0) = ((T0) + (T1)) & 0xffffffff; \ (T0) = G_FUNC((T0)); \ (T1) = ((T1) + (T0)) & 0xffffffff; \ (T1) = G_FUNC((T1)); \ (T0) = ((T0) + (T1)) & 0xffffffff; \ (X1) ^= (T0); \ (X2) ^= (T1) #endif /* OSSL_CRYPTO_SEED_LOCAL_H */
./openssl/crypto/seed/seed_ofb.c
/* * Copyright 2007-2020 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 */ /* * SEED low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/seed.h> #include <openssl/modes.h> void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num) { CRYPTO_ofb128_encrypt(in, out, len, ks, ivec, num, (block128_f) SEED_encrypt); }
./openssl/crypto/seed/seed_ecb.c
/* * Copyright 2007-2020 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 */ /* * SEED low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/seed.h> void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, const SEED_KEY_SCHEDULE *ks, int enc) { if (enc) SEED_encrypt(in, out, ks); else SEED_decrypt(in, out, ks); }
./openssl/crypto/seed/seed_cfb.c
/* * Copyright 2007-2020 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 */ /* * SEED low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/seed.h> #include <openssl/modes.h> void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc) { CRYPTO_cfb128_encrypt(in, out, len, ks, ivec, num, enc, (block128_f) SEED_encrypt); }
./openssl/crypto/seed/seed_cbc.c
/* * Copyright 2007-2020 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 */ /* * SEED low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/seed.h> #include <openssl/modes.h> void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int enc) { if (enc) CRYPTO_cbc128_encrypt(in, out, len, ks, ivec, (block128_f) SEED_encrypt); else CRYPTO_cbc128_decrypt(in, out, len, ks, ivec, (block128_f) SEED_decrypt); }
./openssl/crypto/seed/seed.c
/* * Copyright 2007-2020 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 */ /* * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Neither the name of author nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #ifndef OPENSSL_NO_SEED /* * SEED low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" # include <stdio.h> # include <stdlib.h> # include <string.h> # ifdef _WIN32 # include <memory.h> # endif # include <openssl/seed.h> # include "seed_local.h" # ifdef SS /* can get defined on Solaris by inclusion of * <stdlib.h> */ # undef SS # endif # if !defined(OPENSSL_SMALL_FOOTPRINT) # define G_FUNC(v) \ SS[0][(unsigned char) (v) & 0xff] ^ \ SS[1][(unsigned char) ((v)>>8) & 0xff] ^ \ SS[2][(unsigned char)((v)>>16) & 0xff] ^ \ SS[3][(unsigned char)((v)>>24) & 0xff] static const seed_word SS[4][256] = { { 0x2989a1a8, 0x05858184, 0x16c6d2d4, 0x13c3d3d0, 0x14445054, 0x1d0d111c, 0x2c8ca0ac, 0x25052124, 0x1d4d515c, 0x03434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc, 0x0acac2c8, 0x23436360, 0x28082028, 0x04444044, 0x20002020, 0x1d8d919c, 0x20c0e0e0, 0x22c2e2e0, 0x08c8c0c8, 0x17071314, 0x2585a1a4, 0x0f8f838c, 0x03030300, 0x3b4b7378, 0x3b8bb3b8, 0x13031310, 0x12c2d2d0, 0x2ecee2ec, 0x30407070, 0x0c8c808c, 0x3f0f333c, 0x2888a0a8, 0x32023230, 0x1dcdd1dc, 0x36c6f2f4, 0x34447074, 0x2ccce0ec, 0x15859194, 0x0b0b0308, 0x17475354, 0x1c4c505c, 0x1b4b5358, 0x3d8db1bc, 0x01010100, 0x24042024, 0x1c0c101c, 0x33437370, 0x18889098, 0x10001010, 0x0cccc0cc, 0x32c2f2f0, 0x19c9d1d8, 0x2c0c202c, 0x27c7e3e4, 0x32427270, 0x03838380, 0x1b8b9398, 0x11c1d1d0, 0x06868284, 0x09c9c1c8, 0x20406060, 0x10405050, 0x2383a3a0, 0x2bcbe3e8, 0x0d0d010c, 0x3686b2b4, 0x1e8e929c, 0x0f4f434c, 0x3787b3b4, 0x1a4a5258, 0x06c6c2c4, 0x38487078, 0x2686a2a4, 0x12021210, 0x2f8fa3ac, 0x15c5d1d4, 0x21416160, 0x03c3c3c0, 0x3484b0b4, 0x01414140, 0x12425250, 0x3d4d717c, 0x0d8d818c, 0x08080008, 0x1f0f131c, 0x19899198, 0x00000000, 0x19091118, 0x04040004, 0x13435350, 0x37c7f3f4, 0x21c1e1e0, 0x3dcdf1fc, 0x36467274, 0x2f0f232c, 0x27072324, 0x3080b0b0, 0x0b8b8388, 0x0e0e020c, 0x2b8ba3a8, 0x2282a2a0, 0x2e4e626c, 0x13839390, 0x0d4d414c, 0x29496168, 0x3c4c707c, 0x09090108, 0x0a0a0208, 0x3f8fb3bc, 0x2fcfe3ec, 0x33c3f3f0, 0x05c5c1c4, 0x07878384, 0x14041014, 0x3ecef2fc, 0x24446064, 0x1eced2dc, 0x2e0e222c, 0x0b4b4348, 0x1a0a1218, 0x06060204, 0x21012120, 0x2b4b6368, 0x26466264, 0x02020200, 0x35c5f1f4, 0x12829290, 0x0a8a8288, 0x0c0c000c, 0x3383b3b0, 0x3e4e727c, 0x10c0d0d0, 0x3a4a7278, 0x07474344, 0x16869294, 0x25c5e1e4, 0x26062224, 0x00808080, 0x2d8da1ac, 0x1fcfd3dc, 0x2181a1a0, 0x30003030, 0x37073334, 0x2e8ea2ac, 0x36063234, 0x15051114, 0x22022220, 0x38083038, 0x34c4f0f4, 0x2787a3a4, 0x05454144, 0x0c4c404c, 0x01818180, 0x29c9e1e8, 0x04848084, 0x17879394, 0x35053134, 0x0bcbc3c8, 0x0ecec2cc, 0x3c0c303c, 0x31417170, 0x11011110, 0x07c7c3c4, 0x09898188, 0x35457174, 0x3bcbf3f8, 0x1acad2d8, 0x38c8f0f8, 0x14849094, 0x19495158, 0x02828280, 0x04c4c0c4, 0x3fcff3fc, 0x09494148, 0x39093138, 0x27476364, 0x00c0c0c0, 0x0fcfc3cc, 0x17c7d3d4, 0x3888b0b8, 0x0f0f030c, 0x0e8e828c, 0x02424240, 0x23032320, 0x11819190, 0x2c4c606c, 0x1bcbd3d8, 0x2484a0a4, 0x34043034, 0x31c1f1f0, 0x08484048, 0x02c2c2c0, 0x2f4f636c, 0x3d0d313c, 0x2d0d212c, 0x00404040, 0x3e8eb2bc, 0x3e0e323c, 0x3c8cb0bc, 0x01c1c1c0, 0x2a8aa2a8, 0x3a8ab2b8, 0x0e4e424c, 0x15455154, 0x3b0b3338, 0x1cccd0dc, 0x28486068, 0x3f4f737c, 0x1c8c909c, 0x18c8d0d8, 0x0a4a4248, 0x16465254, 0x37477374, 0x2080a0a0, 0x2dcde1ec, 0x06464244, 0x3585b1b4, 0x2b0b2328, 0x25456164, 0x3acaf2f8, 0x23c3e3e0, 0x3989b1b8, 0x3181b1b0, 0x1f8f939c, 0x1e4e525c, 0x39c9f1f8, 0x26c6e2e4, 0x3282b2b0, 0x31013130, 0x2acae2e8, 0x2d4d616c, 0x1f4f535c, 0x24c4e0e4, 0x30c0f0f0, 0x0dcdc1cc, 0x08888088, 0x16061214, 0x3a0a3238, 0x18485058, 0x14c4d0d4, 0x22426260, 0x29092128, 0x07070304, 0x33033330, 0x28c8e0e8, 0x1b0b1318, 0x05050104, 0x39497178, 0x10809090, 0x2a4a6268, 0x2a0a2228, 0x1a8a9298 }, { 0x38380830, 0xe828c8e0, 0x2c2d0d21, 0xa42686a2, 0xcc0fcfc3, 0xdc1eced2, 0xb03383b3, 0xb83888b0, 0xac2f8fa3, 0x60204060, 0x54154551, 0xc407c7c3, 0x44044440, 0x6c2f4f63, 0x682b4b63, 0x581b4b53, 0xc003c3c3, 0x60224262, 0x30330333, 0xb43585b1, 0x28290921, 0xa02080a0, 0xe022c2e2, 0xa42787a3, 0xd013c3d3, 0x90118191, 0x10110111, 0x04060602, 0x1c1c0c10, 0xbc3c8cb0, 0x34360632, 0x480b4b43, 0xec2fcfe3, 0x88088880, 0x6c2c4c60, 0xa82888a0, 0x14170713, 0xc404c4c0, 0x14160612, 0xf434c4f0, 0xc002c2c2, 0x44054541, 0xe021c1e1, 0xd416c6d2, 0x3c3f0f33, 0x3c3d0d31, 0x8c0e8e82, 0x98188890, 0x28280820, 0x4c0e4e42, 0xf436c6f2, 0x3c3e0e32, 0xa42585a1, 0xf839c9f1, 0x0c0d0d01, 0xdc1fcfd3, 0xd818c8d0, 0x282b0b23, 0x64264662, 0x783a4a72, 0x24270723, 0x2c2f0f23, 0xf031c1f1, 0x70324272, 0x40024242, 0xd414c4d0, 0x40014141, 0xc000c0c0, 0x70334373, 0x64274763, 0xac2c8ca0, 0x880b8b83, 0xf437c7f3, 0xac2d8da1, 0x80008080, 0x1c1f0f13, 0xc80acac2, 0x2c2c0c20, 0xa82a8aa2, 0x34340430, 0xd012c2d2, 0x080b0b03, 0xec2ecee2, 0xe829c9e1, 0x5c1d4d51, 0x94148490, 0x18180810, 0xf838c8f0, 0x54174753, 0xac2e8ea2, 0x08080800, 0xc405c5c1, 0x10130313, 0xcc0dcdc1, 0x84068682, 0xb83989b1, 0xfc3fcff3, 0x7c3d4d71, 0xc001c1c1, 0x30310131, 0xf435c5f1, 0x880a8a82, 0x682a4a62, 0xb03181b1, 0xd011c1d1, 0x20200020, 0xd417c7d3, 0x00020202, 0x20220222, 0x04040400, 0x68284860, 0x70314171, 0x04070703, 0xd81bcbd3, 0x9c1d8d91, 0x98198991, 0x60214161, 0xbc3e8eb2, 0xe426c6e2, 0x58194951, 0xdc1dcdd1, 0x50114151, 0x90108090, 0xdc1cccd0, 0x981a8a92, 0xa02383a3, 0xa82b8ba3, 0xd010c0d0, 0x80018181, 0x0c0f0f03, 0x44074743, 0x181a0a12, 0xe023c3e3, 0xec2ccce0, 0x8c0d8d81, 0xbc3f8fb3, 0x94168692, 0x783b4b73, 0x5c1c4c50, 0xa02282a2, 0xa02181a1, 0x60234363, 0x20230323, 0x4c0d4d41, 0xc808c8c0, 0x9c1e8e92, 0x9c1c8c90, 0x383a0a32, 0x0c0c0c00, 0x2c2e0e22, 0xb83a8ab2, 0x6c2e4e62, 0x9c1f8f93, 0x581a4a52, 0xf032c2f2, 0x90128292, 0xf033c3f3, 0x48094941, 0x78384870, 0xcc0cccc0, 0x14150511, 0xf83bcbf3, 0x70304070, 0x74354571, 0x7c3f4f73, 0x34350531, 0x10100010, 0x00030303, 0x64244460, 0x6c2d4d61, 0xc406c6c2, 0x74344470, 0xd415c5d1, 0xb43484b0, 0xe82acae2, 0x08090901, 0x74364672, 0x18190911, 0xfc3ecef2, 0x40004040, 0x10120212, 0xe020c0e0, 0xbc3d8db1, 0x04050501, 0xf83acaf2, 0x00010101, 0xf030c0f0, 0x282a0a22, 0x5c1e4e52, 0xa82989a1, 0x54164652, 0x40034343, 0x84058581, 0x14140410, 0x88098981, 0x981b8b93, 0xb03080b0, 0xe425c5e1, 0x48084840, 0x78394971, 0x94178793, 0xfc3cccf0, 0x1c1e0e12, 0x80028282, 0x20210121, 0x8c0c8c80, 0x181b0b13, 0x5c1f4f53, 0x74374773, 0x54144450, 0xb03282b2, 0x1c1d0d11, 0x24250521, 0x4c0f4f43, 0x00000000, 0x44064642, 0xec2dcde1, 0x58184850, 0x50124252, 0xe82bcbe3, 0x7c3e4e72, 0xd81acad2, 0xc809c9c1, 0xfc3dcdf1, 0x30300030, 0x94158591, 0x64254561, 0x3c3c0c30, 0xb43686b2, 0xe424c4e0, 0xb83b8bb3, 0x7c3c4c70, 0x0c0e0e02, 0x50104050, 0x38390931, 0x24260622, 0x30320232, 0x84048480, 0x68294961, 0x90138393, 0x34370733, 0xe427c7e3, 0x24240420, 0xa42484a0, 0xc80bcbc3, 0x50134353, 0x080a0a02, 0x84078783, 0xd819c9d1, 0x4c0c4c40, 0x80038383, 0x8c0f8f83, 0xcc0ecec2, 0x383b0b33, 0x480a4a42, 0xb43787b3 }, { 0xa1a82989, 0x81840585, 0xd2d416c6, 0xd3d013c3, 0x50541444, 0x111c1d0d, 0xa0ac2c8c, 0x21242505, 0x515c1d4d, 0x43400343, 0x10181808, 0x121c1e0e, 0x51501141, 0xf0fc3ccc, 0xc2c80aca, 0x63602343, 0x20282808, 0x40440444, 0x20202000, 0x919c1d8d, 0xe0e020c0, 0xe2e022c2, 0xc0c808c8, 0x13141707, 0xa1a42585, 0x838c0f8f, 0x03000303, 0x73783b4b, 0xb3b83b8b, 0x13101303, 0xd2d012c2, 0xe2ec2ece, 0x70703040, 0x808c0c8c, 0x333c3f0f, 0xa0a82888, 0x32303202, 0xd1dc1dcd, 0xf2f436c6, 0x70743444, 0xe0ec2ccc, 0x91941585, 0x03080b0b, 0x53541747, 0x505c1c4c, 0x53581b4b, 0xb1bc3d8d, 0x01000101, 0x20242404, 0x101c1c0c, 0x73703343, 0x90981888, 0x10101000, 0xc0cc0ccc, 0xf2f032c2, 0xd1d819c9, 0x202c2c0c, 0xe3e427c7, 0x72703242, 0x83800383, 0x93981b8b, 0xd1d011c1, 0x82840686, 0xc1c809c9, 0x60602040, 0x50501040, 0xa3a02383, 0xe3e82bcb, 0x010c0d0d, 0xb2b43686, 0x929c1e8e, 0x434c0f4f, 0xb3b43787, 0x52581a4a, 0xc2c406c6, 0x70783848, 0xa2a42686, 0x12101202, 0xa3ac2f8f, 0xd1d415c5, 0x61602141, 0xc3c003c3, 0xb0b43484, 0x41400141, 0x52501242, 0x717c3d4d, 0x818c0d8d, 0x00080808, 0x131c1f0f, 0x91981989, 0x00000000, 0x11181909, 0x00040404, 0x53501343, 0xf3f437c7, 0xe1e021c1, 0xf1fc3dcd, 0x72743646, 0x232c2f0f, 0x23242707, 0xb0b03080, 0x83880b8b, 0x020c0e0e, 0xa3a82b8b, 0xa2a02282, 0x626c2e4e, 0x93901383, 0x414c0d4d, 0x61682949, 0x707c3c4c, 0x01080909, 0x02080a0a, 0xb3bc3f8f, 0xe3ec2fcf, 0xf3f033c3, 0xc1c405c5, 0x83840787, 0x10141404, 0xf2fc3ece, 0x60642444, 0xd2dc1ece, 0x222c2e0e, 0x43480b4b, 0x12181a0a, 0x02040606, 0x21202101, 0x63682b4b, 0x62642646, 0x02000202, 0xf1f435c5, 0x92901282, 0x82880a8a, 0x000c0c0c, 0xb3b03383, 0x727c3e4e, 0xd0d010c0, 0x72783a4a, 0x43440747, 0x92941686, 0xe1e425c5, 0x22242606, 0x80800080, 0xa1ac2d8d, 0xd3dc1fcf, 0xa1a02181, 0x30303000, 0x33343707, 0xa2ac2e8e, 0x32343606, 0x11141505, 0x22202202, 0x30383808, 0xf0f434c4, 0xa3a42787, 0x41440545, 0x404c0c4c, 0x81800181, 0xe1e829c9, 0x80840484, 0x93941787, 0x31343505, 0xc3c80bcb, 0xc2cc0ece, 0x303c3c0c, 0x71703141, 0x11101101, 0xc3c407c7, 0x81880989, 0x71743545, 0xf3f83bcb, 0xd2d81aca, 0xf0f838c8, 0x90941484, 0x51581949, 0x82800282, 0xc0c404c4, 0xf3fc3fcf, 0x41480949, 0x31383909, 0x63642747, 0xc0c000c0, 0xc3cc0fcf, 0xd3d417c7, 0xb0b83888, 0x030c0f0f, 0x828c0e8e, 0x42400242, 0x23202303, 0x91901181, 0x606c2c4c, 0xd3d81bcb, 0xa0a42484, 0x30343404, 0xf1f031c1, 0x40480848, 0xc2c002c2, 0x636c2f4f, 0x313c3d0d, 0x212c2d0d, 0x40400040, 0xb2bc3e8e, 0x323c3e0e, 0xb0bc3c8c, 0xc1c001c1, 0xa2a82a8a, 0xb2b83a8a, 0x424c0e4e, 0x51541545, 0x33383b0b, 0xd0dc1ccc, 0x60682848, 0x737c3f4f, 0x909c1c8c, 0xd0d818c8, 0x42480a4a, 0x52541646, 0x73743747, 0xa0a02080, 0xe1ec2dcd, 0x42440646, 0xb1b43585, 0x23282b0b, 0x61642545, 0xf2f83aca, 0xe3e023c3, 0xb1b83989, 0xb1b03181, 0x939c1f8f, 0x525c1e4e, 0xf1f839c9, 0xe2e426c6, 0xb2b03282, 0x31303101, 0xe2e82aca, 0x616c2d4d, 0x535c1f4f, 0xe0e424c4, 0xf0f030c0, 0xc1cc0dcd, 0x80880888, 0x12141606, 0x32383a0a, 0x50581848, 0xd0d414c4, 0x62602242, 0x21282909, 0x03040707, 0x33303303, 0xe0e828c8, 0x13181b0b, 0x01040505, 0x71783949, 0x90901080, 0x62682a4a, 0x22282a0a, 0x92981a8a }, { 0x08303838, 0xc8e0e828, 0x0d212c2d, 0x86a2a426, 0xcfc3cc0f, 0xced2dc1e, 0x83b3b033, 0x88b0b838, 0x8fa3ac2f, 0x40606020, 0x45515415, 0xc7c3c407, 0x44404404, 0x4f636c2f, 0x4b63682b, 0x4b53581b, 0xc3c3c003, 0x42626022, 0x03333033, 0x85b1b435, 0x09212829, 0x80a0a020, 0xc2e2e022, 0x87a3a427, 0xc3d3d013, 0x81919011, 0x01111011, 0x06020406, 0x0c101c1c, 0x8cb0bc3c, 0x06323436, 0x4b43480b, 0xcfe3ec2f, 0x88808808, 0x4c606c2c, 0x88a0a828, 0x07131417, 0xc4c0c404, 0x06121416, 0xc4f0f434, 0xc2c2c002, 0x45414405, 0xc1e1e021, 0xc6d2d416, 0x0f333c3f, 0x0d313c3d, 0x8e828c0e, 0x88909818, 0x08202828, 0x4e424c0e, 0xc6f2f436, 0x0e323c3e, 0x85a1a425, 0xc9f1f839, 0x0d010c0d, 0xcfd3dc1f, 0xc8d0d818, 0x0b23282b, 0x46626426, 0x4a72783a, 0x07232427, 0x0f232c2f, 0xc1f1f031, 0x42727032, 0x42424002, 0xc4d0d414, 0x41414001, 0xc0c0c000, 0x43737033, 0x47636427, 0x8ca0ac2c, 0x8b83880b, 0xc7f3f437, 0x8da1ac2d, 0x80808000, 0x0f131c1f, 0xcac2c80a, 0x0c202c2c, 0x8aa2a82a, 0x04303434, 0xc2d2d012, 0x0b03080b, 0xcee2ec2e, 0xc9e1e829, 0x4d515c1d, 0x84909414, 0x08101818, 0xc8f0f838, 0x47535417, 0x8ea2ac2e, 0x08000808, 0xc5c1c405, 0x03131013, 0xcdc1cc0d, 0x86828406, 0x89b1b839, 0xcff3fc3f, 0x4d717c3d, 0xc1c1c001, 0x01313031, 0xc5f1f435, 0x8a82880a, 0x4a62682a, 0x81b1b031, 0xc1d1d011, 0x00202020, 0xc7d3d417, 0x02020002, 0x02222022, 0x04000404, 0x48606828, 0x41717031, 0x07030407, 0xcbd3d81b, 0x8d919c1d, 0x89919819, 0x41616021, 0x8eb2bc3e, 0xc6e2e426, 0x49515819, 0xcdd1dc1d, 0x41515011, 0x80909010, 0xccd0dc1c, 0x8a92981a, 0x83a3a023, 0x8ba3a82b, 0xc0d0d010, 0x81818001, 0x0f030c0f, 0x47434407, 0x0a12181a, 0xc3e3e023, 0xcce0ec2c, 0x8d818c0d, 0x8fb3bc3f, 0x86929416, 0x4b73783b, 0x4c505c1c, 0x82a2a022, 0x81a1a021, 0x43636023, 0x03232023, 0x4d414c0d, 0xc8c0c808, 0x8e929c1e, 0x8c909c1c, 0x0a32383a, 0x0c000c0c, 0x0e222c2e, 0x8ab2b83a, 0x4e626c2e, 0x8f939c1f, 0x4a52581a, 0xc2f2f032, 0x82929012, 0xc3f3f033, 0x49414809, 0x48707838, 0xccc0cc0c, 0x05111415, 0xcbf3f83b, 0x40707030, 0x45717435, 0x4f737c3f, 0x05313435, 0x00101010, 0x03030003, 0x44606424, 0x4d616c2d, 0xc6c2c406, 0x44707434, 0xc5d1d415, 0x84b0b434, 0xcae2e82a, 0x09010809, 0x46727436, 0x09111819, 0xcef2fc3e, 0x40404000, 0x02121012, 0xc0e0e020, 0x8db1bc3d, 0x05010405, 0xcaf2f83a, 0x01010001, 0xc0f0f030, 0x0a22282a, 0x4e525c1e, 0x89a1a829, 0x46525416, 0x43434003, 0x85818405, 0x04101414, 0x89818809, 0x8b93981b, 0x80b0b030, 0xc5e1e425, 0x48404808, 0x49717839, 0x87939417, 0xccf0fc3c, 0x0e121c1e, 0x82828002, 0x01212021, 0x8c808c0c, 0x0b13181b, 0x4f535c1f, 0x47737437, 0x44505414, 0x82b2b032, 0x0d111c1d, 0x05212425, 0x4f434c0f, 0x00000000, 0x46424406, 0xcde1ec2d, 0x48505818, 0x42525012, 0xcbe3e82b, 0x4e727c3e, 0xcad2d81a, 0xc9c1c809, 0xcdf1fc3d, 0x00303030, 0x85919415, 0x45616425, 0x0c303c3c, 0x86b2b436, 0xc4e0e424, 0x8bb3b83b, 0x4c707c3c, 0x0e020c0e, 0x40505010, 0x09313839, 0x06222426, 0x02323032, 0x84808404, 0x49616829, 0x83939013, 0x07333437, 0xc7e3e427, 0x04202424, 0x84a0a424, 0xcbc3c80b, 0x43535013, 0x0a02080a, 0x87838407, 0xc9d1d819, 0x4c404c0c, 0x83838003, 0x8f838c0f, 0xcec2cc0e, 0x0b33383b, 0x4a42480a, 0x87b3b437 } }; #else /* on x86_64 >5x size reduction at 40% performance penalty */ static const unsigned char SEED_Sbox[2][256] = { { 0xA9, 0x85, 0xD6, 0xD3, 0x54, 0x1D, 0xAC, 0x25, 0x5D, 0x43, 0x18, 0x1E, 0x51, 0xFC, 0xCA, 0x63, 0x28, 0x44, 0x20, 0x9D, 0xE0, 0xE2, 0xC8, 0x17, 0xA5, 0x8F, 0x03, 0x7B, 0xBB, 0x13, 0xD2, 0xEE, 0x70, 0x8C, 0x3F, 0xA8, 0x32, 0xDD, 0xF6, 0x74, 0xEC, 0x95, 0x0B, 0x57, 0x5C, 0x5B, 0xBD, 0x01, 0x24, 0x1C, 0x73, 0x98, 0x10, 0xCC, 0xF2, 0xD9, 0x2C, 0xE7, 0x72, 0x83, 0x9B, 0xD1, 0x86, 0xC9, 0x60, 0x50, 0xA3, 0xEB, 0x0D, 0xB6, 0x9E, 0x4F, 0xB7, 0x5A, 0xC6, 0x78, 0xA6, 0x12, 0xAF, 0xD5, 0x61, 0xC3, 0xB4, 0x41, 0x52, 0x7D, 0x8D, 0x08, 0x1F, 0x99, 0x00, 0x19, 0x04, 0x53, 0xF7, 0xE1, 0xFD, 0x76, 0x2F, 0x27, 0xB0, 0x8B, 0x0E, 0xAB, 0xA2, 0x6E, 0x93, 0x4D, 0x69, 0x7C, 0x09, 0x0A, 0xBF, 0xEF, 0xF3, 0xC5, 0x87, 0x14, 0xFE, 0x64, 0xDE, 0x2E, 0x4B, 0x1A, 0x06, 0x21, 0x6B, 0x66, 0x02, 0xF5, 0x92, 0x8A, 0x0C, 0xB3, 0x7E, 0xD0, 0x7A, 0x47, 0x96, 0xE5, 0x26, 0x80, 0xAD, 0xDF, 0xA1, 0x30, 0x37, 0xAE, 0x36, 0x15, 0x22, 0x38, 0xF4, 0xA7, 0x45, 0x4C, 0x81, 0xE9, 0x84, 0x97, 0x35, 0xCB, 0xCE, 0x3C, 0x71, 0x11, 0xC7, 0x89, 0x75, 0xFB, 0xDA, 0xF8, 0x94, 0x59, 0x82, 0xC4, 0xFF, 0x49, 0x39, 0x67, 0xC0, 0xCF, 0xD7, 0xB8, 0x0F, 0x8E, 0x42, 0x23, 0x91, 0x6C, 0xDB, 0xA4, 0x34, 0xF1, 0x48, 0xC2, 0x6F, 0x3D, 0x2D, 0x40, 0xBE, 0x3E, 0xBC, 0xC1, 0xAA, 0xBA, 0x4E, 0x55, 0x3B, 0xDC, 0x68, 0x7F, 0x9C, 0xD8, 0x4A, 0x56, 0x77, 0xA0, 0xED, 0x46, 0xB5, 0x2B, 0x65, 0xFA, 0xE3, 0xB9, 0xB1, 0x9F, 0x5E, 0xF9, 0xE6, 0xB2, 0x31, 0xEA, 0x6D, 0x5F, 0xE4, 0xF0, 0xCD, 0x88, 0x16, 0x3A, 0x58, 0xD4, 0x62, 0x29, 0x07, 0x33, 0xE8, 0x1B, 0x05, 0x79, 0x90, 0x6A, 0x2A, 0x9A }, { 0x38, 0xE8, 0x2D, 0xA6, 0xCF, 0xDE, 0xB3, 0xB8, 0xAF, 0x60, 0x55, 0xC7, 0x44, 0x6F, 0x6B, 0x5B, 0xC3, 0x62, 0x33, 0xB5, 0x29, 0xA0, 0xE2, 0xA7, 0xD3, 0x91, 0x11, 0x06, 0x1C, 0xBC, 0x36, 0x4B, 0xEF, 0x88, 0x6C, 0xA8, 0x17, 0xC4, 0x16, 0xF4, 0xC2, 0x45, 0xE1, 0xD6, 0x3F, 0x3D, 0x8E, 0x98, 0x28, 0x4E, 0xF6, 0x3E, 0xA5, 0xF9, 0x0D, 0xDF, 0xD8, 0x2B, 0x66, 0x7A, 0x27, 0x2F, 0xF1, 0x72, 0x42, 0xD4, 0x41, 0xC0, 0x73, 0x67, 0xAC, 0x8B, 0xF7, 0xAD, 0x80, 0x1F, 0xCA, 0x2C, 0xAA, 0x34, 0xD2, 0x0B, 0xEE, 0xE9, 0x5D, 0x94, 0x18, 0xF8, 0x57, 0xAE, 0x08, 0xC5, 0x13, 0xCD, 0x86, 0xB9, 0xFF, 0x7D, 0xC1, 0x31, 0xF5, 0x8A, 0x6A, 0xB1, 0xD1, 0x20, 0xD7, 0x02, 0x22, 0x04, 0x68, 0x71, 0x07, 0xDB, 0x9D, 0x99, 0x61, 0xBE, 0xE6, 0x59, 0xDD, 0x51, 0x90, 0xDC, 0x9A, 0xA3, 0xAB, 0xD0, 0x81, 0x0F, 0x47, 0x1A, 0xE3, 0xEC, 0x8D, 0xBF, 0x96, 0x7B, 0x5C, 0xA2, 0xA1, 0x63, 0x23, 0x4D, 0xC8, 0x9E, 0x9C, 0x3A, 0x0C, 0x2E, 0xBA, 0x6E, 0x9F, 0x5A, 0xF2, 0x92, 0xF3, 0x49, 0x78, 0xCC, 0x15, 0xFB, 0x70, 0x75, 0x7F, 0x35, 0x10, 0x03, 0x64, 0x6D, 0xC6, 0x74, 0xD5, 0xB4, 0xEA, 0x09, 0x76, 0x19, 0xFE, 0x40, 0x12, 0xE0, 0xBD, 0x05, 0xFA, 0x01, 0xF0, 0x2A, 0x5E, 0xA9, 0x56, 0x43, 0x85, 0x14, 0x89, 0x9B, 0xB0, 0xE5, 0x48, 0x79, 0x97, 0xFC, 0x1E, 0x82, 0x21, 0x8C, 0x1B, 0x5F, 0x77, 0x54, 0xB2, 0x1D, 0x25, 0x4F, 0x00, 0x46, 0xED, 0x58, 0x52, 0xEB, 0x7E, 0xDA, 0xC9, 0xFD, 0x30, 0x95, 0x65, 0x3C, 0xB6, 0xE4, 0xBB, 0x7C, 0x0E, 0x50, 0x39, 0x26, 0x32, 0x84, 0x69, 0x93, 0x37, 0xE7, 0x24, 0xA4, 0xCB, 0x53, 0x0A, 0x87, 0xD9, 0x4C, 0x83, 0x8F, 0xCE, 0x3B, 0x4A, 0xB7 } }; static unsigned int G_FUNC(unsigned int v) { unsigned int s0, s1, s2, s3, ret; s0 = SEED_Sbox[0][(unsigned char) (v) & 0xff]; s1 = SEED_Sbox[1][(unsigned char)((v)>> 8) & 0xff]; s2 = SEED_Sbox[0][(unsigned char)((v)>>16) & 0xff]; s3 = SEED_Sbox[1][(unsigned char)((v)>>24) & 0xff]; ret = ((s0 & 0xFC) ^ (s1 & 0xF3) ^ (s2 & 0xCF) ^ (s3 & 0x3F)); ret |= ((s0 & 0xF3) ^ (s1 & 0xCF) ^ (s2 & 0x3F) ^ (s3 & 0xFC)) << 8; ret |= ((s0 & 0xCF) ^ (s1 & 0x3F) ^ (s2 & 0xFC) ^ (s3 & 0xF3)) << 16; ret |= ((s0 & 0x3F) ^ (s1 & 0xFC) ^ (s2 & 0xF3) ^ (s3 & 0xCF)) << 24; return ret; } # endif /* key schedule constants - golden ratio */ # define KC0 0x9e3779b9 # define KC1 0x3c6ef373 # define KC2 0x78dde6e6 # define KC3 0xf1bbcdcc # define KC4 0xe3779b99 # define KC5 0xc6ef3733 # define KC6 0x8dde6e67 # define KC7 0x1bbcdccf # define KC8 0x3779b99e # define KC9 0x6ef3733c # define KC10 0xdde6e678 # define KC11 0xbbcdccf1 # define KC12 0x779b99e3 # define KC13 0xef3733c6 # define KC14 0xde6e678d # define KC15 0xbcdccf1b # if defined(OPENSSL_SMALL_FOOTPRINT) static const seed_word KC[] = { KC0, KC1, KC2, KC3, KC4, KC5, KC6, KC7, KC8, KC9, KC10, KC11, KC12, KC13, KC14, KC15 }; # endif void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks) { seed_word x1, x2, x3, x4; seed_word t0, t1; char2word(rawkey, x1); char2word(rawkey + 4, x2); char2word(rawkey + 8, x3); char2word(rawkey + 12, x4); t0 = (x1 + x3 - KC0) & 0xffffffff; t1 = (x2 - x4 + KC0) & 0xffffffff; KEYUPDATE_TEMP(t0, t1, &ks->data[0]); KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC1); KEYUPDATE_TEMP(t0, t1, &ks->data[2]); # if !defined(OPENSSL_SMALL_FOOTPRINT) KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC2); KEYUPDATE_TEMP(t0, t1, &ks->data[4]); KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC3); KEYUPDATE_TEMP(t0, t1, &ks->data[6]); KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC4); KEYUPDATE_TEMP(t0, t1, &ks->data[8]); KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC5); KEYUPDATE_TEMP(t0, t1, &ks->data[10]); KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC6); KEYUPDATE_TEMP(t0, t1, &ks->data[12]); KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC7); KEYUPDATE_TEMP(t0, t1, &ks->data[14]); KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC8); KEYUPDATE_TEMP(t0, t1, &ks->data[16]); KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC9); KEYUPDATE_TEMP(t0, t1, &ks->data[18]); KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC10); KEYUPDATE_TEMP(t0, t1, &ks->data[20]); KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC11); KEYUPDATE_TEMP(t0, t1, &ks->data[22]); KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC12); KEYUPDATE_TEMP(t0, t1, &ks->data[24]); KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC13); KEYUPDATE_TEMP(t0, t1, &ks->data[26]); KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC14); KEYUPDATE_TEMP(t0, t1, &ks->data[28]); KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC15); KEYUPDATE_TEMP(t0, t1, &ks->data[30]); # else { int i; for (i = 2; i < 16; i += 2) { KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC[i]); KEYUPDATE_TEMP(t0, t1, &ks->data[i * 2]); KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC[i + 1]); KEYUPDATE_TEMP(t0, t1, &ks->data[i * 2 + 2]); } } # endif } void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks) { seed_word x1, x2, x3, x4; seed_word t0, t1; char2word(s, x1); char2word(s + 4, x2); char2word(s + 8, x3); char2word(s + 12, x4); # if !defined(OPENSSL_SMALL_FOOTPRINT) E_SEED(t0, t1, x1, x2, x3, x4, 0); E_SEED(t0, t1, x3, x4, x1, x2, 2); E_SEED(t0, t1, x1, x2, x3, x4, 4); E_SEED(t0, t1, x3, x4, x1, x2, 6); E_SEED(t0, t1, x1, x2, x3, x4, 8); E_SEED(t0, t1, x3, x4, x1, x2, 10); E_SEED(t0, t1, x1, x2, x3, x4, 12); E_SEED(t0, t1, x3, x4, x1, x2, 14); E_SEED(t0, t1, x1, x2, x3, x4, 16); E_SEED(t0, t1, x3, x4, x1, x2, 18); E_SEED(t0, t1, x1, x2, x3, x4, 20); E_SEED(t0, t1, x3, x4, x1, x2, 22); E_SEED(t0, t1, x1, x2, x3, x4, 24); E_SEED(t0, t1, x3, x4, x1, x2, 26); E_SEED(t0, t1, x1, x2, x3, x4, 28); E_SEED(t0, t1, x3, x4, x1, x2, 30); # else { int i; for (i = 0; i < 30; i += 4) { E_SEED(t0, t1, x1, x2, x3, x4, i); E_SEED(t0, t1, x3, x4, x1, x2, i + 2); } } # endif word2char(x3, d); word2char(x4, d + 4); word2char(x1, d + 8); word2char(x2, d + 12); } void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks) { seed_word x1, x2, x3, x4; seed_word t0, t1; char2word(s, x1); char2word(s + 4, x2); char2word(s + 8, x3); char2word(s + 12, x4); # if !defined(OPENSSL_SMALL_FOOTPRINT) E_SEED(t0, t1, x1, x2, x3, x4, 30); E_SEED(t0, t1, x3, x4, x1, x2, 28); E_SEED(t0, t1, x1, x2, x3, x4, 26); E_SEED(t0, t1, x3, x4, x1, x2, 24); E_SEED(t0, t1, x1, x2, x3, x4, 22); E_SEED(t0, t1, x3, x4, x1, x2, 20); E_SEED(t0, t1, x1, x2, x3, x4, 18); E_SEED(t0, t1, x3, x4, x1, x2, 16); E_SEED(t0, t1, x1, x2, x3, x4, 14); E_SEED(t0, t1, x3, x4, x1, x2, 12); E_SEED(t0, t1, x1, x2, x3, x4, 10); E_SEED(t0, t1, x3, x4, x1, x2, 8); E_SEED(t0, t1, x1, x2, x3, x4, 6); E_SEED(t0, t1, x3, x4, x1, x2, 4); E_SEED(t0, t1, x1, x2, x3, x4, 2); E_SEED(t0, t1, x3, x4, x1, x2, 0); # else { int i; for (i = 30; i > 0; i -= 4) { E_SEED(t0, t1, x1, x2, x3, x4, i); E_SEED(t0, t1, x3, x4, x1, x2, i - 2); } } # endif word2char(x3, d); word2char(x4, d + 4); word2char(x1, d + 8); word2char(x2, d + 12); } #endif /* OPENSSL_NO_SEED */
./openssl/crypto/siphash/siphash.c
/* * Copyright 2017-2022 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 */ /* Based on https://131002.net/siphash C reference implementation */ /* SipHash reference C implementation Copyright (c) 2012-2016 Jean-Philippe Aumasson Copyright (c) 2012-2014 Daniel J. Bernstein To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. */ #include <stdlib.h> #include <string.h> #include <openssl/crypto.h> #include "crypto/siphash.h" #define ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b)))) #define U32TO8_LE(p, v) \ (p)[0] = (uint8_t)((v)); \ (p)[1] = (uint8_t)((v) >> 8); \ (p)[2] = (uint8_t)((v) >> 16); \ (p)[3] = (uint8_t)((v) >> 24); #define U64TO8_LE(p, v) \ U32TO8_LE((p), (uint32_t)((v))); \ U32TO8_LE((p) + 4, (uint32_t)((v) >> 32)); #define U8TO64_LE(p) \ (((uint64_t)((p)[0])) | ((uint64_t)((p)[1]) << 8) | \ ((uint64_t)((p)[2]) << 16) | ((uint64_t)((p)[3]) << 24) | \ ((uint64_t)((p)[4]) << 32) | ((uint64_t)((p)[5]) << 40) | \ ((uint64_t)((p)[6]) << 48) | ((uint64_t)((p)[7]) << 56)) #define SIPROUND \ do { \ v0 += v1; \ v1 = ROTL(v1, 13); \ v1 ^= v0; \ v0 = ROTL(v0, 32); \ v2 += v3; \ v3 = ROTL(v3, 16); \ v3 ^= v2; \ v0 += v3; \ v3 = ROTL(v3, 21); \ v3 ^= v0; \ v2 += v1; \ v1 = ROTL(v1, 17); \ v1 ^= v2; \ v2 = ROTL(v2, 32); \ } while (0) size_t SipHash_ctx_size(void) { return sizeof(SIPHASH); } size_t SipHash_hash_size(SIPHASH *ctx) { return ctx->hash_size; } static size_t siphash_adjust_hash_size(size_t hash_size) { if (hash_size == 0) hash_size = SIPHASH_MAX_DIGEST_SIZE; return hash_size; } int SipHash_set_hash_size(SIPHASH *ctx, size_t hash_size) { hash_size = siphash_adjust_hash_size(hash_size); if (hash_size != SIPHASH_MIN_DIGEST_SIZE && hash_size != SIPHASH_MAX_DIGEST_SIZE) return 0; /* * It's possible that the key was set first. If the hash size changes, * we need to adjust v1 (see SipHash_Init(). */ /* Start by adjusting the stored size, to make things easier */ ctx->hash_size = siphash_adjust_hash_size(ctx->hash_size); /* Now, adjust ctx->v1 if the old and the new size differ */ if ((size_t)ctx->hash_size != hash_size) { ctx->v1 ^= 0xee; ctx->hash_size = hash_size; } return 1; } /* hash_size = crounds = drounds = 0 means SipHash24 with 16-byte output */ int SipHash_Init(SIPHASH *ctx, const unsigned char *k, int crounds, int drounds) { uint64_t k0 = U8TO64_LE(k); uint64_t k1 = U8TO64_LE(k + 8); /* If the hash size wasn't set, i.e. is zero */ ctx->hash_size = siphash_adjust_hash_size(ctx->hash_size); if (drounds == 0) drounds = SIPHASH_D_ROUNDS; if (crounds == 0) crounds = SIPHASH_C_ROUNDS; ctx->crounds = crounds; ctx->drounds = drounds; ctx->len = 0; ctx->total_inlen = 0; ctx->v0 = 0x736f6d6570736575ULL ^ k0; ctx->v1 = 0x646f72616e646f6dULL ^ k1; ctx->v2 = 0x6c7967656e657261ULL ^ k0; ctx->v3 = 0x7465646279746573ULL ^ k1; if (ctx->hash_size == SIPHASH_MAX_DIGEST_SIZE) ctx->v1 ^= 0xee; return 1; } void SipHash_Update(SIPHASH *ctx, const unsigned char *in, size_t inlen) { uint64_t m; const uint8_t *end; int left; unsigned int i; uint64_t v0 = ctx->v0; uint64_t v1 = ctx->v1; uint64_t v2 = ctx->v2; uint64_t v3 = ctx->v3; ctx->total_inlen += inlen; if (ctx->len) { /* deal with leavings */ size_t available = SIPHASH_BLOCK_SIZE - ctx->len; /* not enough to fill leavings */ if (inlen < available) { memcpy(&ctx->leavings[ctx->len], in, inlen); ctx->len += inlen; return; } /* copy data into leavings and reduce input */ memcpy(&ctx->leavings[ctx->len], in, available); inlen -= available; in += available; /* process leavings */ m = U8TO64_LE(ctx->leavings); v3 ^= m; for (i = 0; i < ctx->crounds; ++i) SIPROUND; v0 ^= m; } left = inlen & (SIPHASH_BLOCK_SIZE-1); /* gets put into leavings */ end = in + inlen - left; for (; in != end; in += 8) { m = U8TO64_LE(in); v3 ^= m; for (i = 0; i < ctx->crounds; ++i) SIPROUND; v0 ^= m; } /* save leavings and other ctx */ if (left) memcpy(ctx->leavings, end, left); ctx->len = left; ctx->v0 = v0; ctx->v1 = v1; ctx->v2 = v2; ctx->v3 = v3; } int SipHash_Final(SIPHASH *ctx, unsigned char *out, size_t outlen) { /* finalize hash */ unsigned int i; uint64_t b = ctx->total_inlen << 56; uint64_t v0 = ctx->v0; uint64_t v1 = ctx->v1; uint64_t v2 = ctx->v2; uint64_t v3 = ctx->v3; if (ctx->crounds == 0 || outlen == 0 || outlen != (size_t)ctx->hash_size) return 0; switch (ctx->len) { case 7: b |= ((uint64_t)ctx->leavings[6]) << 48; /* fall through */ case 6: b |= ((uint64_t)ctx->leavings[5]) << 40; /* fall through */ case 5: b |= ((uint64_t)ctx->leavings[4]) << 32; /* fall through */ case 4: b |= ((uint64_t)ctx->leavings[3]) << 24; /* fall through */ case 3: b |= ((uint64_t)ctx->leavings[2]) << 16; /* fall through */ case 2: b |= ((uint64_t)ctx->leavings[1]) << 8; /* fall through */ case 1: b |= ((uint64_t)ctx->leavings[0]); case 0: break; } v3 ^= b; for (i = 0; i < ctx->crounds; ++i) SIPROUND; v0 ^= b; if (ctx->hash_size == SIPHASH_MAX_DIGEST_SIZE) v2 ^= 0xee; else v2 ^= 0xff; for (i = 0; i < ctx->drounds; ++i) SIPROUND; b = v0 ^ v1 ^ v2 ^ v3; U64TO8_LE(out, b); if (ctx->hash_size == SIPHASH_MIN_DIGEST_SIZE) return 1; v1 ^= 0xdd; for (i = 0; i < ctx->drounds; ++i) SIPROUND; b = v0 ^ v1 ^ v2 ^ v3; U64TO8_LE(out + 8, b); return 1; }
./openssl/crypto/conf/conf_def.c
/* * Copyright 1995-2023 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 */ /* Part of the code in here was originally in conf.c, which is now removed */ #include <stdio.h> #include <string.h> #include "internal/e_os.h" /* struct stat */ #ifdef __TANDEM # include <sys/types.h> /* needed for stat.h */ # include <sys/stat.h> /* struct stat */ #endif #include "internal/cryptlib.h" #include "internal/o_dir.h" #include <openssl/lhash.h> #include <openssl/conf.h> #include <openssl/conf_api.h> #include "conf_local.h" #include "conf_def.h" #include <openssl/buffer.h> #include <openssl/err.h> #ifndef OPENSSL_NO_POSIX_IO # include <sys/stat.h> # ifdef _WIN32 # define stat _stat # endif #endif #ifndef S_ISDIR # define S_ISDIR(a) (((a) & S_IFMT) == S_IFDIR) #endif /* * The maximum length we can grow a value to after variable expansion. 64k * should be more than enough for all reasonable uses. */ #define MAX_CONF_VALUE_LENGTH 65536 static int is_keytype(const CONF *conf, char c, unsigned short type); static char *eat_ws(CONF *conf, char *p); static void trim_ws(CONF *conf, char *start); static char *eat_alpha_numeric(CONF *conf, char *p); static void clear_comments(CONF *conf, char *p); static int str_copy(CONF *conf, char *section, char **to, char *from); static char *scan_quote(CONF *conf, char *p); static char *scan_dquote(CONF *conf, char *p); #define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2))) #ifndef OPENSSL_NO_POSIX_IO static BIO *process_include(char *include, OPENSSL_DIR_CTX **dirctx, char **dirpath); static BIO *get_next_file(const char *path, OPENSSL_DIR_CTX **dirctx); #endif static CONF *def_create(CONF_METHOD *meth); static int def_init_default(CONF *conf); #ifndef OPENSSL_NO_DEPRECATED_3_0 static int def_init_WIN32(CONF *conf); #endif static int def_destroy(CONF *conf); static int def_destroy_data(CONF *conf); static int def_load(CONF *conf, const char *name, long *eline); static int def_load_bio(CONF *conf, BIO *bp, long *eline); static int def_dump(const CONF *conf, BIO *bp); static int def_is_number(const CONF *conf, char c); static int def_to_int(const CONF *conf, char c); static CONF_METHOD default_method = { "OpenSSL default", def_create, def_init_default, def_destroy, def_destroy_data, def_load_bio, def_dump, def_is_number, def_to_int, def_load }; CONF_METHOD *NCONF_default(void) { return &default_method; } #ifndef OPENSSL_NO_DEPRECATED_3_0 static CONF_METHOD WIN32_method = { "WIN32", def_create, def_init_WIN32, def_destroy, def_destroy_data, def_load_bio, def_dump, def_is_number, def_to_int, def_load }; CONF_METHOD *NCONF_WIN32(void) { return &WIN32_method; } #endif static CONF *def_create(CONF_METHOD *meth) { CONF *ret; ret = OPENSSL_malloc(sizeof(*ret)); if (ret != NULL) if (meth->init(ret) == 0) { OPENSSL_free(ret); ret = NULL; } return ret; } static int def_init_default(CONF *conf) { if (conf == NULL) return 0; memset(conf, 0, sizeof(*conf)); conf->meth = &default_method; conf->meth_data = (void *)CONF_type_default; return 1; } #ifndef OPENSSL_NO_DEPRECATED_3_0 static int def_init_WIN32(CONF *conf) { if (conf == NULL) return 0; memset(conf, 0, sizeof(*conf)); conf->meth = &WIN32_method; conf->meth_data = (void *)CONF_type_win32; return 1; } #endif static int def_destroy(CONF *conf) { if (def_destroy_data(conf)) { OPENSSL_free(conf); return 1; } return 0; } static int def_destroy_data(CONF *conf) { if (conf == NULL) return 0; _CONF_free_data(conf); return 1; } static int def_load(CONF *conf, const char *name, long *line) { int ret; BIO *in = NULL; #ifdef OPENSSL_SYS_VMS in = BIO_new_file(name, "r"); #else in = BIO_new_file(name, "rb"); #endif if (in == NULL) { if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE) ERR_raise(ERR_LIB_CONF, CONF_R_NO_SUCH_FILE); else ERR_raise(ERR_LIB_CONF, ERR_R_SYS_LIB); return 0; } ret = def_load_bio(conf, in, line); BIO_free(in); return ret; } /* Parse a boolean value and fill in *flag. Return 0 on error. */ static int parsebool(const char *pval, int *flag) { if (OPENSSL_strcasecmp(pval, "on") == 0 || OPENSSL_strcasecmp(pval, "true") == 0) { *flag = 1; } else if (OPENSSL_strcasecmp(pval, "off") == 0 || OPENSSL_strcasecmp(pval, "false") == 0) { *flag = 0; } else { ERR_raise(ERR_LIB_CONF, CONF_R_INVALID_PRAGMA); return 0; } return 1; } static int def_load_bio(CONF *conf, BIO *in, long *line) { /* The macro BUFSIZE conflicts with a system macro in VxWorks */ #define CONFBUFSIZE 512 int bufnum = 0, i, ii; BUF_MEM *buff = NULL; char *s, *p, *end; int again; int first_call = 1; long eline = 0; char btmp[DECIMAL_SIZE(eline) + 1]; CONF_VALUE *v = NULL, *tv; CONF_VALUE *sv = NULL; char *section = NULL, *buf; char *start, *psection, *pname; void *h = (void *)(conf->data); STACK_OF(BIO) *biosk = NULL; #ifndef OPENSSL_NO_POSIX_IO char *dirpath = NULL; OPENSSL_DIR_CTX *dirctx = NULL; #endif #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION int numincludes = 0; #endif if ((buff = BUF_MEM_new()) == NULL) { ERR_raise(ERR_LIB_CONF, ERR_R_BUF_LIB); goto err; } section = OPENSSL_strdup("default"); if (section == NULL) goto err; if (_CONF_new_data(conf) == 0) { ERR_raise(ERR_LIB_CONF, ERR_R_CONF_LIB); goto err; } sv = _CONF_new_section(conf, section); if (sv == NULL) { ERR_raise(ERR_LIB_CONF, CONF_R_UNABLE_TO_CREATE_NEW_SECTION); goto err; } bufnum = 0; again = 0; for (;;) { if (!BUF_MEM_grow(buff, bufnum + CONFBUFSIZE)) { ERR_raise(ERR_LIB_CONF, ERR_R_BUF_LIB); goto err; } p = &(buff->data[bufnum]); *p = '\0'; read_retry: if (in != NULL && BIO_gets(in, p, CONFBUFSIZE - 1) < 0) goto err; p[CONFBUFSIZE - 1] = '\0'; ii = i = strlen(p); if (first_call) { /* Other BOMs imply unsupported multibyte encoding, * so don't strip them and let the error raise */ const unsigned char utf8_bom[3] = {0xEF, 0xBB, 0xBF}; if (i >= 3 && memcmp(p, utf8_bom, 3) == 0) { memmove(p, p + 3, i - 3); p[i - 3] = 0; i -= 3; ii -= 3; } first_call = 0; } if (i == 0 && !again) { /* the currently processed BIO is NULL or at EOF */ BIO *parent; #ifndef OPENSSL_NO_POSIX_IO /* continue processing with the next file from directory */ if (dirctx != NULL) { BIO *next; if ((next = get_next_file(dirpath, &dirctx)) != NULL) { BIO_vfree(in); in = next; goto read_retry; } else { OPENSSL_free(dirpath); dirpath = NULL; } } #endif /* no more files in directory, continue with processing parent */ if ((parent = sk_BIO_pop(biosk)) == NULL) { /* everything processed get out of the loop */ break; } else { BIO_vfree(in); in = parent; goto read_retry; } } again = 0; while (i > 0) { if ((p[i - 1] != '\r') && (p[i - 1] != '\n')) break; else i--; } /* * we removed some trailing stuff so there is a new line on the end. */ if (ii && i == ii) again = 1; /* long line */ else { p[i] = '\0'; eline++; /* another input line */ } /* we now have a line with trailing \r\n removed */ /* i is the number of bytes */ bufnum += i; v = NULL; /* check for line continuation */ if (bufnum >= 1) { /* * If we have bytes and the last char '\\' and second last char * is not '\\' */ p = &(buff->data[bufnum - 1]); if (IS_ESC(conf, p[0]) && ((bufnum <= 1) || !IS_ESC(conf, p[-1]))) { bufnum--; again = 1; } } if (again) continue; bufnum = 0; buf = buff->data; clear_comments(conf, buf); s = eat_ws(conf, buf); if (IS_EOF(conf, *s)) continue; /* blank line */ if (*s == '[') { char *ss; s++; start = eat_ws(conf, s); ss = start; again: end = eat_alpha_numeric(conf, ss); p = eat_ws(conf, end); if (*p != ']') { if (*p != '\0' && ss != p) { ss = p; goto again; } ERR_raise(ERR_LIB_CONF, CONF_R_MISSING_CLOSE_SQUARE_BRACKET); goto err; } *end = '\0'; if (!str_copy(conf, NULL, &section, start)) goto err; if ((sv = _CONF_get_section(conf, section)) == NULL) sv = _CONF_new_section(conf, section); if (sv == NULL) { ERR_raise(ERR_LIB_CONF, CONF_R_UNABLE_TO_CREATE_NEW_SECTION); goto err; } continue; } else { pname = s; end = eat_alpha_numeric(conf, s); if ((end[0] == ':') && (end[1] == ':')) { *end = '\0'; end += 2; psection = pname; pname = end; end = eat_alpha_numeric(conf, end); } else { psection = section; } p = eat_ws(conf, end); if (CHECK_AND_SKIP_PREFIX(pname, ".pragma") && (p != pname || *p == '=')) { char *pval; if (*p == '=') { p++; p = eat_ws(conf, p); } trim_ws(conf, p); /* Pragma values take the form keyword:value */ pval = strchr(p, ':'); if (pval == NULL || pval == p || pval[1] == '\0') { ERR_raise(ERR_LIB_CONF, CONF_R_INVALID_PRAGMA); goto err; } *pval++ = '\0'; trim_ws(conf, p); pval = eat_ws(conf, pval); /* * Known pragmas: * * dollarid takes "on", "true or "off", "false" * abspath takes "on", "true or "off", "false" * includedir directory prefix */ if (strcmp(p, "dollarid") == 0) { if (!parsebool(pval, &conf->flag_dollarid)) goto err; } else if (strcmp(p, "abspath") == 0) { if (!parsebool(pval, &conf->flag_abspath)) goto err; } else if (strcmp(p, "includedir") == 0) { OPENSSL_free(conf->includedir); if ((conf->includedir = OPENSSL_strdup(pval)) == NULL) goto err; } /* * We *ignore* any unknown pragma. */ continue; } else if (CHECK_AND_SKIP_PREFIX(pname, ".include") && (p != pname || *p == '=')) { char *include = NULL; BIO *next; const char *include_dir = ossl_safe_getenv("OPENSSL_CONF_INCLUDE"); char *include_path = NULL; #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION /* * The include processing below can cause the "conf" fuzzer to * timeout due to the fuzzer inserting large and complicated * includes - with a large amount of time spent in * OPENSSL_strlcat/OPENSSL_strcpy. This is not a security * concern because config files should never come from untrusted * sources. We just set an arbitrary limit on the allowed * number of includes when fuzzing to prevent this timeout. */ if (numincludes++ > 10) goto err; #endif if (include_dir == NULL) include_dir = conf->includedir; if (*p == '=') { p++; p = eat_ws(conf, p); } trim_ws(conf, p); if (!str_copy(conf, psection, &include, p)) goto err; if (include_dir != NULL && !ossl_is_absolute_path(include)) { size_t newlen = strlen(include_dir) + strlen(include) + 2; include_path = OPENSSL_malloc(newlen); if (include_path == NULL) { OPENSSL_free(include); goto err; } OPENSSL_strlcpy(include_path, include_dir, newlen); if (!ossl_ends_with_dirsep(include_path)) OPENSSL_strlcat(include_path, "/", newlen); OPENSSL_strlcat(include_path, include, newlen); OPENSSL_free(include); } else { include_path = include; } if (conf->flag_abspath && !ossl_is_absolute_path(include_path)) { ERR_raise(ERR_LIB_CONF, CONF_R_RELATIVE_PATH); OPENSSL_free(include_path); goto err; } /* get the BIO of the included file */ #ifndef OPENSSL_NO_POSIX_IO next = process_include(include_path, &dirctx, &dirpath); if (include_path != dirpath) { /* dirpath will contain include in case of a directory */ OPENSSL_free(include_path); } #else next = BIO_new_file(include_path, "r"); OPENSSL_free(include_path); #endif if (next != NULL) { /* push the currently processing BIO onto stack */ if (biosk == NULL) { if ((biosk = sk_BIO_new_null()) == NULL) { ERR_raise(ERR_LIB_CONF, ERR_R_CRYPTO_LIB); BIO_free(next); goto err; } } if (!sk_BIO_push(biosk, in)) { ERR_raise(ERR_LIB_CONF, ERR_R_CRYPTO_LIB); BIO_free(next); goto err; } /* continue with reading from the included BIO */ in = next; } continue; } else if (*p != '=') { ERR_raise_data(ERR_LIB_CONF, CONF_R_MISSING_EQUAL_SIGN, "HERE-->%s", p); goto err; } *end = '\0'; p++; start = eat_ws(conf, p); trim_ws(conf, start); if ((v = OPENSSL_malloc(sizeof(*v))) == NULL) goto err; v->name = OPENSSL_strdup(pname); v->value = NULL; if (v->name == NULL) goto err; if (!str_copy(conf, psection, &(v->value), start)) goto err; if (strcmp(psection, section) != 0) { if ((tv = _CONF_get_section(conf, psection)) == NULL) tv = _CONF_new_section(conf, psection); if (tv == NULL) { ERR_raise(ERR_LIB_CONF, CONF_R_UNABLE_TO_CREATE_NEW_SECTION); goto err; } } else tv = sv; if (_CONF_add_string(conf, tv, v) == 0) { ERR_raise(ERR_LIB_CONF, ERR_R_CONF_LIB); goto err; } v = NULL; } } BUF_MEM_free(buff); OPENSSL_free(section); /* * No need to pop, since we only get here if the stack is empty. * If this causes a BIO leak, THE ISSUE IS SOMEWHERE ELSE! */ sk_BIO_free(biosk); return 1; err: BUF_MEM_free(buff); OPENSSL_free(section); /* * Since |in| is the first element of the stack and should NOT be freed * here, we cannot use sk_BIO_pop_free(). Instead, we pop and free one * BIO at a time, making sure that the last one popped isn't. */ while (sk_BIO_num(biosk) > 0) { BIO *popped = sk_BIO_pop(biosk); BIO_vfree(in); in = popped; } sk_BIO_free(biosk); #ifndef OPENSSL_NO_POSIX_IO OPENSSL_free(dirpath); if (dirctx != NULL) OPENSSL_DIR_end(&dirctx); #endif if (line != NULL) *line = eline; BIO_snprintf(btmp, sizeof(btmp), "%ld", eline); ERR_add_error_data(2, "line ", btmp); if (h != conf->data) { CONF_free(conf->data); conf->data = NULL; } if (v != NULL) { OPENSSL_free(v->name); OPENSSL_free(v->value); OPENSSL_free(v); } return 0; } static void clear_comments(CONF *conf, char *p) { for (;;) { if (IS_FCOMMENT(conf, *p)) { *p = '\0'; return; } if (!IS_WS(conf, *p)) { break; } p++; } for (;;) { if (IS_COMMENT(conf, *p)) { *p = '\0'; return; } if (IS_DQUOTE(conf, *p)) { p = scan_dquote(conf, p); continue; } if (IS_QUOTE(conf, *p)) { p = scan_quote(conf, p); continue; } if (IS_ESC(conf, *p)) { p = scan_esc(conf, p); continue; } if (IS_EOF(conf, *p)) return; else p++; } } static int str_copy(CONF *conf, char *section, char **pto, char *from) { int q, r, rr = 0, to = 0, len = 0; char *s, *e, *rp, *p, *rrp, *np, *cp, v; BUF_MEM *buf; if ((buf = BUF_MEM_new()) == NULL) return 0; len = strlen(from) + 1; if (!BUF_MEM_grow(buf, len)) goto err; for (;;) { if (IS_QUOTE(conf, *from)) { q = *from; from++; while (!IS_EOF(conf, *from) && (*from != q)) { if (IS_ESC(conf, *from)) { from++; if (IS_EOF(conf, *from)) break; } buf->data[to++] = *(from++); } if (*from == q) from++; } else if (IS_DQUOTE(conf, *from)) { q = *from; from++; while (!IS_EOF(conf, *from)) { if (*from == q) { if (*(from + 1) == q) { from++; } else { break; } } buf->data[to++] = *(from++); } if (*from == q) from++; } else if (IS_ESC(conf, *from)) { from++; v = *(from++); if (IS_EOF(conf, v)) break; else if (v == 'r') v = '\r'; else if (v == 'n') v = '\n'; else if (v == 'b') v = '\b'; else if (v == 't') v = '\t'; buf->data[to++] = v; } else if (IS_EOF(conf, *from)) break; else if (*from == '$' && (!conf->flag_dollarid || from[1] == '{' || from[1] == '(')) { size_t newsize; /* try to expand it */ rrp = NULL; s = &(from[1]); if (*s == '{') q = '}'; else if (*s == '(') q = ')'; else q = 0; if (q) s++; cp = section; e = np = s; while (IS_ALNUM(conf, *e) || (conf->flag_dollarid && IS_DOLLAR(conf, *e))) e++; if ((e[0] == ':') && (e[1] == ':')) { cp = np; rrp = e; rr = *e; *rrp = '\0'; e += 2; np = e; while (IS_ALNUM(conf, *e) || (conf->flag_dollarid && IS_DOLLAR(conf, *e))) e++; } r = *e; *e = '\0'; rp = e; if (q) { if (r != q) { ERR_raise(ERR_LIB_CONF, CONF_R_NO_CLOSE_BRACE); goto err; } e++; } /*- * So at this point we have * np which is the start of the name string which is * '\0' terminated. * cp which is the start of the section string which is * '\0' terminated. * e is the 'next point after'. * r and rr are the chars replaced by the '\0' * rp and rrp is where 'r' and 'rr' came from. */ p = _CONF_get_string(conf, cp, np); if (rrp != NULL) *rrp = rr; *rp = r; if (p == NULL) { ERR_raise(ERR_LIB_CONF, CONF_R_VARIABLE_HAS_NO_VALUE); goto err; } newsize = strlen(p) + buf->length - (e - from); if (newsize > MAX_CONF_VALUE_LENGTH) { ERR_raise(ERR_LIB_CONF, CONF_R_VARIABLE_EXPANSION_TOO_LONG); goto err; } if (!BUF_MEM_grow_clean(buf, newsize)) { ERR_raise(ERR_LIB_CONF, ERR_R_BUF_LIB); goto err; } while (*p) buf->data[to++] = *(p++); /* * Since we change the pointer 'from', we also have to change the * perceived length of the string it points at. /RL */ len -= e - from; from = e; /* * In case there were no braces or parenthesis around the * variable reference, we have to put back the character that was * replaced with a '\0'. /RL */ *rp = r; } else buf->data[to++] = *(from++); } buf->data[to] = '\0'; OPENSSL_free(*pto); *pto = buf->data; OPENSSL_free(buf); return 1; err: BUF_MEM_free(buf); return 0; } #ifndef OPENSSL_NO_POSIX_IO /* * Check whether included path is a directory. * Returns next BIO to process and in case of a directory * also an opened directory context and the include path. */ static BIO *process_include(char *include, OPENSSL_DIR_CTX **dirctx, char **dirpath) { struct stat st; BIO *next; if (stat(include, &st) < 0) { ERR_raise_data(ERR_LIB_SYS, errno, "calling stat(%s)", include); /* missing include file is not fatal error */ return NULL; } if (S_ISDIR(st.st_mode)) { if (*dirctx != NULL) { ERR_raise_data(ERR_LIB_CONF, CONF_R_RECURSIVE_DIRECTORY_INCLUDE, "%s", include); return NULL; } /* a directory, load its contents */ if ((next = get_next_file(include, dirctx)) != NULL) *dirpath = include; return next; } next = BIO_new_file(include, "r"); return next; } /* * Get next file from the directory path. * Returns BIO of the next file to read and updates dirctx. */ static BIO *get_next_file(const char *path, OPENSSL_DIR_CTX **dirctx) { const char *filename; size_t pathlen; pathlen = strlen(path); while ((filename = OPENSSL_DIR_read(dirctx, path)) != NULL) { size_t namelen; namelen = strlen(filename); if ((namelen > 5 && OPENSSL_strcasecmp(filename + namelen - 5, ".conf") == 0) || (namelen > 4 && OPENSSL_strcasecmp(filename + namelen - 4, ".cnf") == 0)) { size_t newlen; char *newpath; BIO *bio; newlen = pathlen + namelen + 2; newpath = OPENSSL_zalloc(newlen); if (newpath == NULL) break; #ifdef OPENSSL_SYS_VMS /* * If the given path isn't clear VMS syntax, * we treat it as on Unix. */ if (path[pathlen - 1] == ']' || path[pathlen - 1] == '>' || path[pathlen - 1] == ':') { /* Clear VMS directory syntax, just copy as is */ OPENSSL_strlcpy(newpath, path, newlen); } #endif if (newpath[0] == '\0') { OPENSSL_strlcpy(newpath, path, newlen); OPENSSL_strlcat(newpath, "/", newlen); } OPENSSL_strlcat(newpath, filename, newlen); bio = BIO_new_file(newpath, "r"); OPENSSL_free(newpath); /* Errors when opening files are non-fatal. */ if (bio != NULL) return bio; } } OPENSSL_DIR_end(dirctx); *dirctx = NULL; return NULL; } #endif static int is_keytype(const CONF *conf, char c, unsigned short type) { const unsigned short *keytypes = (const unsigned short *) conf->meth_data; unsigned char key = (unsigned char)c; #ifdef CHARSET_EBCDIC # if CHAR_BIT > 8 if (key > 255) { /* key is out of range for os_toascii table */ return 0; } # endif /* convert key from ebcdic to ascii */ key = os_toascii[key]; #endif if (key > 127) { /* key is not a seven bit ascii character */ return 0; } return (keytypes[key] & type) ? 1 : 0; } static char *eat_ws(CONF *conf, char *p) { while (IS_WS(conf, *p) && (!IS_EOF(conf, *p))) p++; return p; } static void trim_ws(CONF *conf, char *start) { char *p = start; while (!IS_EOF(conf, *p)) p++; p--; while ((p >= start) && IS_WS(conf, *p)) p--; p++; *p = '\0'; } static char *eat_alpha_numeric(CONF *conf, char *p) { for (;;) { if (IS_ESC(conf, *p)) { p = scan_esc(conf, p); continue; } if (!(IS_ALNUM_PUNCT(conf, *p) || (conf->flag_dollarid && IS_DOLLAR(conf, *p)))) return p; p++; } } static char *scan_quote(CONF *conf, char *p) { int q = *p; p++; while (!(IS_EOF(conf, *p)) && (*p != q)) { if (IS_ESC(conf, *p)) { p++; if (IS_EOF(conf, *p)) return p; } p++; } if (*p == q) p++; return p; } static char *scan_dquote(CONF *conf, char *p) { int q = *p; p++; while (!(IS_EOF(conf, *p))) { if (*p == q) { if (*(p + 1) == q) { p++; } else { break; } } p++; } if (*p == q) p++; return p; } static void dump_value_doall_arg(const CONF_VALUE *a, BIO *out) { if (a->name) BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value); else BIO_printf(out, "[[%s]]\n", a->section); } IMPLEMENT_LHASH_DOALL_ARG_CONST(CONF_VALUE, BIO); static int def_dump(const CONF *conf, BIO *out) { lh_CONF_VALUE_doall_BIO(conf->data, dump_value_doall_arg, out); return 1; } static int def_is_number(const CONF *conf, char c) { return IS_NUMBER(conf, c); } static int def_to_int(const CONF *conf, char c) { return c - '0'; }
./openssl/crypto/conf/conf_def.h
/* * WARNING: do not edit! * Generated by crypto/conf/keysets.pl * * Copyright 1995-2021 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 */ #define CONF_NUMBER 1 #define CONF_UPPER 2 #define CONF_LOWER 4 #define CONF_UNDER 256 #define CONF_PUNCT 512 #define CONF_WS 16 #define CONF_ESC 32 #define CONF_QUOTE 64 #define CONF_DQUOTE 1024 #define CONF_COMMENT 128 #define CONF_FCOMMENT 2048 #define CONF_DOLLAR 4096 #define CONF_EOF 8 #define CONF_ALPHA (CONF_UPPER|CONF_LOWER) #define CONF_ALNUM (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) #define CONF_ALNUM_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER|CONF_PUNCT) #define IS_COMMENT(conf,c) is_keytype(conf, c, CONF_COMMENT) #define IS_FCOMMENT(conf,c) is_keytype(conf, c, CONF_FCOMMENT) #define IS_EOF(conf,c) is_keytype(conf, c, CONF_EOF) #define IS_ESC(conf,c) is_keytype(conf, c, CONF_ESC) #define IS_NUMBER(conf,c) is_keytype(conf, c, CONF_NUMBER) #define IS_WS(conf,c) is_keytype(conf, c, CONF_WS) #define IS_ALNUM(conf,c) is_keytype(conf, c, CONF_ALNUM) #define IS_ALNUM_PUNCT(conf,c) is_keytype(conf, c, CONF_ALNUM_PUNCT) #define IS_QUOTE(conf,c) is_keytype(conf, c, CONF_QUOTE) #define IS_DQUOTE(conf,c) is_keytype(conf, c, CONF_DQUOTE) #define IS_DOLLAR(conf,c) is_keytype(conf, c, CONF_DOLLAR) static const unsigned short CONF_type_default[128] = { 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0200, 0x0040, 0x0080, 0x1000, 0x0200, 0x0200, 0x0040, 0x0000, 0x0000, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000, 0x0200, 0x0200, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0000, 0x0020, 0x0000, 0x0200, 0x0100, 0x0040, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000, }; #ifndef OPENSSL_NO_DEPRECATED_3_0 static const unsigned short CONF_type_win32[128] = { 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0200, 0x0400, 0x0000, 0x1000, 0x0200, 0x0200, 0x0000, 0x0000, 0x0000, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0A00, 0x0000, 0x0000, 0x0000, 0x0200, 0x0200, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0000, 0x0000, 0x0000, 0x0200, 0x0100, 0x0000, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000, }; #endif
./openssl/crypto/conf/conf_mall.c
/* * Copyright 2002-2021 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 */ /* We need to use some engine deprecated APIs */ #define OPENSSL_SUPPRESS_DEPRECATED #include <stdio.h> #include <openssl/crypto.h> #include "internal/cryptlib.h" #include <openssl/conf.h> #include <openssl/x509.h> #include <openssl/asn1.h> #include <openssl/engine.h> #include "internal/provider.h" #include "crypto/rand.h" #include "conf_local.h" /* Load all OpenSSL builtin modules */ void OPENSSL_load_builtin_modules(void) { /* Add builtin modules here */ ASN1_add_oid_module(); ASN1_add_stable_module(); #ifndef OPENSSL_NO_ENGINE ENGINE_add_conf_module(); #endif EVP_add_alg_module(); ossl_config_add_ssl_module(); ossl_provider_add_conf_module(); ossl_random_add_conf_module(); }
./openssl/crypto/conf/conf_local.h
/* * Copyright 2018-2021 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 */ #include <openssl/conftypes.h> void ossl_config_add_ssl_module(void);
./openssl/crypto/conf/conf_sap.c
/* * Copyright 2002-2023 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 */ #include <stdio.h> #include <openssl/crypto.h> #include "internal/cryptlib.h" #include "internal/conf.h" #include "conf_local.h" #include <openssl/x509.h> #include <openssl/asn1.h> #include <openssl/engine.h> #if defined(_WIN32) && !defined(__BORLANDC__) # define strdup _strdup #endif /* * This is the automatic configuration loader: it is called automatically by * OpenSSL when any of a number of standard initialisation functions are * called, unless this is overridden by calling OPENSSL_no_config() */ static int openssl_configured = 0; #ifndef OPENSSL_NO_DEPRECATED_1_1_0 void OPENSSL_config(const char *appname) { OPENSSL_INIT_SETTINGS settings; memset(&settings, 0, sizeof(settings)); if (appname != NULL) settings.appname = strdup(appname); settings.flags = DEFAULT_CONF_MFLAGS; OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, &settings); } #endif int ossl_config_int(const OPENSSL_INIT_SETTINGS *settings) { int ret = 0; #if defined(OPENSSL_INIT_DEBUG) || !defined(OPENSSL_SYS_UEFI) const char *filename; const char *appname; unsigned long flags; #endif if (openssl_configured) return 1; #if defined(OPENSSL_INIT_DEBUG) || !defined(OPENSSL_SYS_UEFI) filename = settings ? settings->filename : NULL; appname = settings ? settings->appname : NULL; flags = settings ? settings->flags : DEFAULT_CONF_MFLAGS; #endif #ifdef OPENSSL_INIT_DEBUG fprintf(stderr, "OPENSSL_INIT: ossl_config_int(%s, %s, %lu)\n", filename, appname, flags); #endif #ifndef OPENSSL_SYS_UEFI ret = CONF_modules_load_file_ex(OSSL_LIB_CTX_get0_global_default(), filename, appname, flags); #else ret = 1; #endif openssl_configured = 1; return ret; } void ossl_no_config_int(void) { openssl_configured = 1; }
./openssl/crypto/conf/conf_err.c
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2023 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 */ #include <openssl/err.h> #include <openssl/conferr.h> #include "crypto/conferr.h" #ifndef OPENSSL_NO_ERR static const ERR_STRING_DATA CONF_str_reasons[] = { {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_ERROR_LOADING_DSO), "error loading dso"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_INVALID_PRAGMA), "invalid pragma"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_LIST_CANNOT_BE_NULL), "list cannot be null"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_MANDATORY_BRACES_IN_VARIABLE_EXPANSION), "mandatory braces in variable expansion"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_MISSING_CLOSE_SQUARE_BRACKET), "missing close square bracket"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_MISSING_EQUAL_SIGN), "missing equal sign"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_MISSING_INIT_FUNCTION), "missing init function"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_MODULE_INITIALIZATION_ERROR), "module initialization error"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_CLOSE_BRACE), "no close brace"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_CONF), "no conf"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE), "no conf or environment variable"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_SECTION), "no section"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_SUCH_FILE), "no such file"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_VALUE), "no value"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NUMBER_TOO_LARGE), "number too large"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_OPENSSL_CONF_REFERENCES_MISSING_SECTION), "openssl conf references missing section"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_RECURSIVE_DIRECTORY_INCLUDE), "recursive directory include"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_RECURSIVE_SECTION_REFERENCE), "recursive section reference"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_RELATIVE_PATH), "relative path"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_COMMAND_SECTION_EMPTY), "ssl command section empty"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_COMMAND_SECTION_NOT_FOUND), "ssl command section not found"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_SECTION_EMPTY), "ssl section empty"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_SECTION_NOT_FOUND), "ssl section not found"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_UNABLE_TO_CREATE_NEW_SECTION), "unable to create new section"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_UNKNOWN_MODULE_NAME), "unknown module name"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_VARIABLE_EXPANSION_TOO_LONG), "variable expansion too long"}, {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_VARIABLE_HAS_NO_VALUE), "variable has no value"}, {0, NULL} }; #endif int ossl_err_load_CONF_strings(void) { #ifndef OPENSSL_NO_ERR if (ERR_reason_error_string(CONF_str_reasons[0].error) == NULL) ERR_load_strings_const(CONF_str_reasons); #endif return 1; }
./openssl/crypto/conf/conf_lib.c
/* * Copyright 2000-2022 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 */ #include "internal/e_os.h" #include <stdio.h> #include <string.h> #include "internal/conf.h" #include "crypto/ctype.h" #include <openssl/crypto.h> #include <openssl/err.h> #include <openssl/conf.h> #include <openssl/conf_api.h> #include "conf_local.h" #include <openssl/lhash.h> static CONF_METHOD *default_CONF_method = NULL; /* Init a 'CONF' structure from an old LHASH */ void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash) { if (default_CONF_method == NULL) default_CONF_method = NCONF_default(); default_CONF_method->init(conf); conf->data = hash; } /* * The following section contains the "CONF classic" functions, rewritten in * terms of the new CONF interface. */ int CONF_set_default_method(CONF_METHOD *meth) { default_CONF_method = meth; return 1; } LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, long *eline) { LHASH_OF(CONF_VALUE) *ltmp; BIO *in = NULL; #ifdef OPENSSL_SYS_VMS in = BIO_new_file(file, "r"); #else in = BIO_new_file(file, "rb"); #endif if (in == NULL) { ERR_raise(ERR_LIB_CONF, ERR_R_SYS_LIB); return NULL; } ltmp = CONF_load_bio(conf, in, eline); BIO_free(in); return ltmp; } #ifndef OPENSSL_NO_STDIO LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, long *eline) { BIO *btmp; LHASH_OF(CONF_VALUE) *ltmp; if ((btmp = BIO_new_fp(fp, BIO_NOCLOSE)) == NULL) { ERR_raise(ERR_LIB_CONF, ERR_R_BUF_LIB); return NULL; } ltmp = CONF_load_bio(conf, btmp, eline); BIO_free(btmp); return ltmp; } #endif LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, long *eline) { CONF ctmp; int ret; CONF_set_nconf(&ctmp, conf); ret = NCONF_load_bio(&ctmp, bp, eline); if (ret) return ctmp.data; return NULL; } STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, const char *section) { if (conf == NULL) { return NULL; } else { CONF ctmp; CONF_set_nconf(&ctmp, conf); return NCONF_get_section(&ctmp, section); } } char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, const char *name) { if (conf == NULL) { return NCONF_get_string(NULL, group, name); } else { CONF ctmp; CONF_set_nconf(&ctmp, conf); return NCONF_get_string(&ctmp, group, name); } } long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, const char *name) { int status; long result = 0; ERR_set_mark(); if (conf == NULL) { status = NCONF_get_number_e(NULL, group, name, &result); } else { CONF ctmp; CONF_set_nconf(&ctmp, conf); status = NCONF_get_number_e(&ctmp, group, name, &result); } ERR_pop_to_mark(); return status == 0 ? 0L : result; } void CONF_free(LHASH_OF(CONF_VALUE) *conf) { CONF ctmp; CONF_set_nconf(&ctmp, conf); NCONF_free_data(&ctmp); } #ifndef OPENSSL_NO_STDIO int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out) { BIO *btmp; int ret; if ((btmp = BIO_new_fp(out, BIO_NOCLOSE)) == NULL) { ERR_raise(ERR_LIB_CONF, ERR_R_BUF_LIB); return 0; } ret = CONF_dump_bio(conf, btmp); BIO_free(btmp); return ret; } #endif int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out) { CONF ctmp; CONF_set_nconf(&ctmp, conf); return NCONF_dump_bio(&ctmp, out); } /* * The following section contains the "New CONF" functions. They are * completely centralised around a new CONF structure that may contain * basically anything, but at least a method pointer and a table of data. * These functions are also written in terms of the bridge functions used by * the "CONF classic" functions, for consistency. */ CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth) { CONF *ret; if (meth == NULL) meth = NCONF_default(); ret = meth->create(meth); if (ret == NULL) { ERR_raise(ERR_LIB_CONF, ERR_R_CONF_LIB); return NULL; } ret->libctx = libctx; return ret; } CONF *NCONF_new(CONF_METHOD *meth) { return NCONF_new_ex(NULL, meth); } void NCONF_free(CONF *conf) { if (conf == NULL) return; conf->meth->destroy(conf); } void NCONF_free_data(CONF *conf) { if (conf == NULL) return; conf->meth->destroy_data(conf); } OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf) { return conf->libctx; } typedef STACK_OF(OPENSSL_CSTRING) SECTION_NAMES; IMPLEMENT_LHASH_DOALL_ARG_CONST(CONF_VALUE, SECTION_NAMES); static void collect_section_name(const CONF_VALUE *v, SECTION_NAMES *names) { /* A section is a CONF_VALUE with name == NULL */ if (v->name == NULL) sk_OPENSSL_CSTRING_push(names, v->section); } static int section_name_cmp(OPENSSL_CSTRING const *a, OPENSSL_CSTRING const *b) { return strcmp(*a, *b); } STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *cnf) { SECTION_NAMES *names; if ((names = sk_OPENSSL_CSTRING_new(section_name_cmp)) == NULL) return NULL; lh_CONF_VALUE_doall_SECTION_NAMES(cnf->data, collect_section_name, names); sk_OPENSSL_CSTRING_sort(names); return names; } int NCONF_load(CONF *conf, const char *file, long *eline) { if (conf == NULL) { ERR_raise(ERR_LIB_CONF, CONF_R_NO_CONF); return 0; } return conf->meth->load(conf, file, eline); } #ifndef OPENSSL_NO_STDIO int NCONF_load_fp(CONF *conf, FILE *fp, long *eline) { BIO *btmp; int ret; if ((btmp = BIO_new_fp(fp, BIO_NOCLOSE)) == NULL) { ERR_raise(ERR_LIB_CONF, ERR_R_BUF_LIB); return 0; } ret = NCONF_load_bio(conf, btmp, eline); BIO_free(btmp); return ret; } #endif int NCONF_load_bio(CONF *conf, BIO *bp, long *eline) { if (conf == NULL) { ERR_raise(ERR_LIB_CONF, CONF_R_NO_CONF); return 0; } return conf->meth->load_bio(conf, bp, eline); } STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section) { if (conf == NULL) { ERR_raise(ERR_LIB_CONF, CONF_R_NO_CONF); return NULL; } if (section == NULL) { ERR_raise(ERR_LIB_CONF, CONF_R_NO_SECTION); return NULL; } return _CONF_get_section_values(conf, section); } char *NCONF_get_string(const CONF *conf, const char *group, const char *name) { char *s = _CONF_get_string(conf, group, name); /* * Since we may get a value from an environment variable even if conf is * NULL, let's check the value first */ if (s) return s; if (conf == NULL) { ERR_raise(ERR_LIB_CONF, CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE); return NULL; } ERR_raise_data(ERR_LIB_CONF, CONF_R_NO_VALUE, "group=%s name=%s", group, name); return NULL; } static int default_is_number(const CONF *conf, char c) { return ossl_isdigit(c); } static int default_to_int(const CONF *conf, char c) { return (int)(c - '0'); } int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, long *result) { char *str; long res; int (*is_number)(const CONF *, char) = &default_is_number; int (*to_int)(const CONF *, char) = &default_to_int; if (result == NULL) { ERR_raise(ERR_LIB_CONF, ERR_R_PASSED_NULL_PARAMETER); return 0; } str = NCONF_get_string(conf, group, name); if (str == NULL) return 0; if (conf != NULL) { if (conf->meth->is_number != NULL) is_number = conf->meth->is_number; if (conf->meth->to_int != NULL) to_int = conf->meth->to_int; } for (res = 0; is_number(conf, *str); str++) { const int d = to_int(conf, *str); if (res > (LONG_MAX - d) / 10L) { ERR_raise(ERR_LIB_CONF, CONF_R_NUMBER_TOO_LARGE); return 0; } res = res * 10 + d; } *result = res; return 1; } long _CONF_get_number(const CONF *conf, const char *section, const char *name) { int status; long result = 0; ERR_set_mark(); status = NCONF_get_number_e(conf, section, name, &result); ERR_pop_to_mark(); return status == 0 ? 0L : result; } #ifndef OPENSSL_NO_STDIO int NCONF_dump_fp(const CONF *conf, FILE *out) { BIO *btmp; int ret; if ((btmp = BIO_new_fp(out, BIO_NOCLOSE)) == NULL) { ERR_raise(ERR_LIB_CONF, ERR_R_BUF_LIB); return 0; } ret = NCONF_dump_bio(conf, btmp); BIO_free(btmp); return ret; } #endif int NCONF_dump_bio(const CONF *conf, BIO *out) { if (conf == NULL) { ERR_raise(ERR_LIB_CONF, CONF_R_NO_CONF); return 0; } return conf->meth->dump(conf, out); } /* * These routines call the C malloc/free, to avoid intermixing with * OpenSSL function pointers before the library is initialized. */ OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void) { OPENSSL_INIT_SETTINGS *ret = malloc(sizeof(*ret)); if (ret == NULL) return NULL; memset(ret, 0, sizeof(*ret)); ret->flags = DEFAULT_CONF_MFLAGS; return ret; } #ifndef OPENSSL_NO_STDIO /* * If CRYPTO_set_mem_functions is called after this, then * memory allocation and deallocation in this function can * become disjointed. Avoid this by always using standard * strdup & free instead of OPENSSL_strdup & OPENSSL_free. */ int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, const char *filename) { char *newfilename = NULL; if (filename != NULL) { newfilename = strdup(filename); if (newfilename == NULL) return 0; } free(settings->filename); settings->filename = newfilename; return 1; } void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings, unsigned long flags) { settings->flags = flags; } /* * If CRYPTO_set_mem_functions is called after this, then * memory allocation and deallocation in this function can * become disjointed. Avoid this by always using standard * strdup & free instead of OPENSSL_strdup & OPENSSL_free. */ int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, const char *appname) { char *newappname = NULL; if (appname != NULL) { newappname = strdup(appname); if (newappname == NULL) return 0; } free(settings->appname); settings->appname = newappname; return 1; } #endif void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings) { free(settings->filename); free(settings->appname); free(settings); }
./openssl/crypto/conf/conf_mod.c
/* * Copyright 2002-2023 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 */ /* We need to use some engine deprecated APIs */ #define OPENSSL_SUPPRESS_DEPRECATED #include "internal/cryptlib.h" #include <stdio.h> #include <ctype.h> #include <openssl/crypto.h> #include "internal/conf.h" #include <openssl/conf_api.h> #include "internal/dso.h" #include "internal/thread_once.h" #include <openssl/x509.h> #include <openssl/trace.h> #include <openssl/engine.h> #include "conf_local.h" DEFINE_STACK_OF(CONF_MODULE) DEFINE_STACK_OF(CONF_IMODULE) #define DSO_mod_init_name "OPENSSL_init" #define DSO_mod_finish_name "OPENSSL_finish" /* * This structure contains a data about supported modules. entries in this * table correspond to either dynamic or static modules. */ struct conf_module_st { /* DSO of this module or NULL if static */ DSO *dso; /* Name of the module */ char *name; /* Init function */ conf_init_func *init; /* Finish function */ conf_finish_func *finish; /* Number of successfully initialized modules */ int links; void *usr_data; }; /* * This structure contains information about modules that have been * successfully initialized. There may be more than one entry for a given * module. */ struct conf_imodule_st { CONF_MODULE *pmod; char *name; char *value; unsigned long flags; void *usr_data; }; static CRYPTO_ONCE init_module_list_lock = CRYPTO_ONCE_STATIC_INIT; static CRYPTO_RWLOCK *module_list_lock = NULL; static STACK_OF(CONF_MODULE) *supported_modules = NULL; /* protected by lock */ static STACK_OF(CONF_IMODULE) *initialized_modules = NULL; /* protected by lock */ static CRYPTO_ONCE load_builtin_modules = CRYPTO_ONCE_STATIC_INIT; static void module_free(CONF_MODULE *md); static void module_finish(CONF_IMODULE *imod); static int module_run(const CONF *cnf, const char *name, const char *value, unsigned long flags); static CONF_MODULE *module_add(DSO *dso, const char *name, conf_init_func *ifunc, conf_finish_func *ffunc); static CONF_MODULE *module_find(const char *name); static int module_init(CONF_MODULE *pmod, const char *name, const char *value, const CONF *cnf); static CONF_MODULE *module_load_dso(const CONF *cnf, const char *name, const char *value); static int conf_modules_finish_int(void); static void module_lists_free(void) { CRYPTO_THREAD_lock_free(module_list_lock); module_list_lock = NULL; sk_CONF_MODULE_free(supported_modules); supported_modules = NULL; sk_CONF_IMODULE_free(initialized_modules); initialized_modules = NULL; } DEFINE_RUN_ONCE_STATIC(do_init_module_list_lock) { module_list_lock = CRYPTO_THREAD_lock_new(); if (module_list_lock == NULL) { ERR_raise(ERR_LIB_CONF, ERR_R_CRYPTO_LIB); return 0; } return 1; } static int conf_diagnostics(const CONF *cnf) { return _CONF_get_number(cnf, NULL, "config_diagnostics") != 0; } /* Main function: load modules from a CONF structure */ int CONF_modules_load(const CONF *cnf, const char *appname, unsigned long flags) { STACK_OF(CONF_VALUE) *values; CONF_VALUE *vl; char *vsection = NULL; int ret, i; if (!cnf) return 1; if (conf_diagnostics(cnf)) flags &= ~(CONF_MFLAGS_IGNORE_ERRORS | CONF_MFLAGS_IGNORE_RETURN_CODES | CONF_MFLAGS_SILENT | CONF_MFLAGS_IGNORE_MISSING_FILE); ERR_set_mark(); if (appname) vsection = NCONF_get_string(cnf, NULL, appname); if (!appname || (!vsection && (flags & CONF_MFLAGS_DEFAULT_SECTION))) vsection = NCONF_get_string(cnf, NULL, "openssl_conf"); if (!vsection) { ERR_pop_to_mark(); return 1; } OSSL_TRACE1(CONF, "Configuration in section %s\n", vsection); values = NCONF_get_section(cnf, vsection); if (values == NULL) { if (!(flags & CONF_MFLAGS_SILENT)) { ERR_clear_last_mark(); ERR_raise_data(ERR_LIB_CONF, CONF_R_OPENSSL_CONF_REFERENCES_MISSING_SECTION, "openssl_conf=%s", vsection); } else { ERR_pop_to_mark(); } return 0; } ERR_pop_to_mark(); for (i = 0; i < sk_CONF_VALUE_num(values); i++) { vl = sk_CONF_VALUE_value(values, i); ERR_set_mark(); ret = module_run(cnf, vl->name, vl->value, flags); OSSL_TRACE3(CONF, "Running module %s (%s) returned %d\n", vl->name, vl->value, ret); if (ret <= 0) if (!(flags & CONF_MFLAGS_IGNORE_ERRORS)) { ERR_clear_last_mark(); return ret; } ERR_pop_to_mark(); } return 1; } int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename, const char *appname, unsigned long flags) { char *file = NULL; CONF *conf = NULL; int ret = 0, diagnostics = 0; ERR_set_mark(); if (filename == NULL) { file = CONF_get1_default_config_file(); if (file == NULL) goto err; if (*file == '\0') { /* Do not try to load an empty file name but do not error out */ ret = 1; goto err; } } else { file = (char *)filename; } conf = NCONF_new_ex(libctx, NULL); if (conf == NULL) goto err; if (NCONF_load(conf, file, NULL) <= 0) { if ((flags & CONF_MFLAGS_IGNORE_MISSING_FILE) && (ERR_GET_REASON(ERR_peek_last_error()) == CONF_R_NO_SUCH_FILE)) { ret = 1; } goto err; } ret = CONF_modules_load(conf, appname, flags); diagnostics = conf_diagnostics(conf); err: if (filename == NULL) OPENSSL_free(file); NCONF_free(conf); if ((flags & CONF_MFLAGS_IGNORE_RETURN_CODES) != 0 && !diagnostics) ret = 1; if (ret > 0) ERR_pop_to_mark(); else ERR_clear_last_mark(); return ret; } int CONF_modules_load_file(const char *filename, const char *appname, unsigned long flags) { return CONF_modules_load_file_ex(NULL, filename, appname, flags); } DEFINE_RUN_ONCE_STATIC(do_load_builtin_modules) { OPENSSL_load_builtin_modules(); #ifndef OPENSSL_NO_ENGINE /* Need to load ENGINEs */ ENGINE_load_builtin_engines(); #endif return 1; } static int module_run(const CONF *cnf, const char *name, const char *value, unsigned long flags) { CONF_MODULE *md; int ret; if (!RUN_ONCE(&load_builtin_modules, do_load_builtin_modules)) return -1; md = module_find(name); /* Module not found: try to load DSO */ if (!md && !(flags & CONF_MFLAGS_NO_DSO)) md = module_load_dso(cnf, name, value); if (!md) { if (!(flags & CONF_MFLAGS_SILENT)) { ERR_raise_data(ERR_LIB_CONF, CONF_R_UNKNOWN_MODULE_NAME, "module=%s", name); } return -1; } ret = module_init(md, name, value, cnf); if (ret <= 0) { if (!(flags & CONF_MFLAGS_SILENT)) ERR_raise_data(ERR_LIB_CONF, CONF_R_MODULE_INITIALIZATION_ERROR, "module=%s, value=%s retcode=%-8d", name, value, ret); } return ret; } /* Load a module from a DSO */ static CONF_MODULE *module_load_dso(const CONF *cnf, const char *name, const char *value) { DSO *dso = NULL; conf_init_func *ifunc; conf_finish_func *ffunc; const char *path = NULL; int errcode = 0; CONF_MODULE *md; /* Look for alternative path in module section */ path = _CONF_get_string(cnf, value, "path"); if (path == NULL) { path = name; } dso = DSO_load(NULL, path, NULL, 0); if (dso == NULL) { errcode = CONF_R_ERROR_LOADING_DSO; goto err; } ifunc = (conf_init_func *)DSO_bind_func(dso, DSO_mod_init_name); if (ifunc == NULL) { errcode = CONF_R_MISSING_INIT_FUNCTION; goto err; } ffunc = (conf_finish_func *)DSO_bind_func(dso, DSO_mod_finish_name); /* All OK, add module */ md = module_add(dso, name, ifunc, ffunc); if (md == NULL) goto err; return md; err: DSO_free(dso); ERR_raise_data(ERR_LIB_CONF, errcode, "module=%s, path=%s", name, path); return NULL; } /* add module to list */ static CONF_MODULE *module_add(DSO *dso, const char *name, conf_init_func *ifunc, conf_finish_func *ffunc) { CONF_MODULE *tmod = NULL; if (!RUN_ONCE(&init_module_list_lock, do_init_module_list_lock)) return NULL; if (!CRYPTO_THREAD_write_lock(module_list_lock)) return NULL; if (supported_modules == NULL) supported_modules = sk_CONF_MODULE_new_null(); if (supported_modules == NULL) goto err; if ((tmod = OPENSSL_zalloc(sizeof(*tmod))) == NULL) goto err; tmod->dso = dso; tmod->name = OPENSSL_strdup(name); tmod->init = ifunc; tmod->finish = ffunc; if (tmod->name == NULL) goto err; if (!sk_CONF_MODULE_push(supported_modules, tmod)) goto err; CRYPTO_THREAD_unlock(module_list_lock); return tmod; err: CRYPTO_THREAD_unlock(module_list_lock); if (tmod != NULL) { OPENSSL_free(tmod->name); OPENSSL_free(tmod); } return NULL; } /* * Find a module from the list. We allow module names of the form * modname.XXXX to just search for modname to allow the same module to be * initialized more than once. */ static CONF_MODULE *module_find(const char *name) { CONF_MODULE *tmod; int i, nchar; char *p; p = strrchr(name, '.'); if (p) nchar = p - name; else nchar = strlen(name); if (!RUN_ONCE(&init_module_list_lock, do_init_module_list_lock)) return NULL; if (!CRYPTO_THREAD_read_lock(module_list_lock)) return NULL; for (i = 0; i < sk_CONF_MODULE_num(supported_modules); i++) { tmod = sk_CONF_MODULE_value(supported_modules, i); if (strncmp(tmod->name, name, nchar) == 0) { CRYPTO_THREAD_unlock(module_list_lock); return tmod; } } CRYPTO_THREAD_unlock(module_list_lock); return NULL; } /* initialize a module */ static int module_init(CONF_MODULE *pmod, const char *name, const char *value, const CONF *cnf) { int ret = 1; int init_called = 0; CONF_IMODULE *imod = NULL; /* Otherwise add initialized module to list */ imod = OPENSSL_malloc(sizeof(*imod)); if (imod == NULL) goto err; imod->pmod = pmod; imod->name = OPENSSL_strdup(name); imod->value = OPENSSL_strdup(value); imod->usr_data = NULL; if (!imod->name || !imod->value) goto memerr; /* Try to initialize module */ if (pmod->init) { ret = pmod->init(imod, cnf); init_called = 1; /* Error occurred, exit */ if (ret <= 0) goto err; } if (!RUN_ONCE(&init_module_list_lock, do_init_module_list_lock)) goto err; if (!CRYPTO_THREAD_write_lock(module_list_lock)) goto err; if (initialized_modules == NULL) { initialized_modules = sk_CONF_IMODULE_new_null(); if (initialized_modules == NULL) { CRYPTO_THREAD_unlock(module_list_lock); ERR_raise(ERR_LIB_CONF, ERR_R_CRYPTO_LIB); goto err; } } if (!sk_CONF_IMODULE_push(initialized_modules, imod)) { CRYPTO_THREAD_unlock(module_list_lock); ERR_raise(ERR_LIB_CONF, ERR_R_CRYPTO_LIB); goto err; } pmod->links++; CRYPTO_THREAD_unlock(module_list_lock); return ret; err: /* We've started the module so we'd better finish it */ if (pmod->finish && init_called) pmod->finish(imod); memerr: if (imod) { OPENSSL_free(imod->name); OPENSSL_free(imod->value); OPENSSL_free(imod); } return -1; } /* * Unload any dynamic modules that have a link count of zero: i.e. have no * active initialized modules. If 'all' is set then all modules are unloaded * including static ones. */ void CONF_modules_unload(int all) { int i; CONF_MODULE *md; if (!conf_modules_finish_int()) /* also inits module list lock */ return; if (!CRYPTO_THREAD_write_lock(module_list_lock)) return; /* unload modules in reverse order */ for (i = sk_CONF_MODULE_num(supported_modules) - 1; i >= 0; i--) { md = sk_CONF_MODULE_value(supported_modules, i); /* If static or in use and 'all' not set ignore it */ if (((md->links > 0) || !md->dso) && !all) continue; /* Since we're working in reverse this is OK */ (void)sk_CONF_MODULE_delete(supported_modules, i); module_free(md); } if (sk_CONF_MODULE_num(supported_modules) == 0) { sk_CONF_MODULE_free(supported_modules); supported_modules = NULL; } CRYPTO_THREAD_unlock(module_list_lock); } /* unload a single module */ static void module_free(CONF_MODULE *md) { DSO_free(md->dso); OPENSSL_free(md->name); OPENSSL_free(md); } /* finish and free up all modules instances */ static int conf_modules_finish_int(void) { CONF_IMODULE *imod; if (!RUN_ONCE(&init_module_list_lock, do_init_module_list_lock)) return 0; /* If module_list_lock is NULL here it means we were already unloaded */ if (module_list_lock == NULL || !CRYPTO_THREAD_write_lock(module_list_lock)) return 0; while (sk_CONF_IMODULE_num(initialized_modules) > 0) { imod = sk_CONF_IMODULE_pop(initialized_modules); module_finish(imod); } sk_CONF_IMODULE_free(initialized_modules); initialized_modules = NULL; CRYPTO_THREAD_unlock(module_list_lock); return 1; } void CONF_modules_finish(void) { conf_modules_finish_int(); } /* finish a module instance */ static void module_finish(CONF_IMODULE *imod) { if (!imod) return; if (imod->pmod->finish) imod->pmod->finish(imod); imod->pmod->links--; OPENSSL_free(imod->name); OPENSSL_free(imod->value); OPENSSL_free(imod); } /* Add a static module to OpenSSL */ int CONF_module_add(const char *name, conf_init_func *ifunc, conf_finish_func *ffunc) { if (module_add(NULL, name, ifunc, ffunc)) return 1; else return 0; } void ossl_config_modules_free(void) { CONF_modules_unload(1); /* calls CONF_modules_finish */ module_lists_free(); } /* Utility functions */ const char *CONF_imodule_get_name(const CONF_IMODULE *md) { return md->name; } const char *CONF_imodule_get_value(const CONF_IMODULE *md) { return md->value; } void *CONF_imodule_get_usr_data(const CONF_IMODULE *md) { return md->usr_data; } void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data) { md->usr_data = usr_data; } CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md) { return md->pmod; } unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md) { return md->flags; } void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags) { md->flags = flags; } void *CONF_module_get_usr_data(CONF_MODULE *pmod) { return pmod->usr_data; } void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data) { pmod->usr_data = usr_data; } /* Return default config file name */ char *CONF_get1_default_config_file(void) { const char *t; char *file, *sep = ""; size_t size; if ((file = ossl_safe_getenv("OPENSSL_CONF")) != NULL) return OPENSSL_strdup(file); t = X509_get_default_cert_area(); #ifndef OPENSSL_SYS_VMS sep = "/"; #endif size = strlen(t) + strlen(sep) + strlen(OPENSSL_CONF) + 1; file = OPENSSL_malloc(size); if (file == NULL) return NULL; BIO_snprintf(file, size, "%s%s%s", t, sep, OPENSSL_CONF); return file; } /* * This function takes a list separated by 'sep' and calls the callback * function giving the start and length of each member optionally stripping * leading and trailing whitespace. This can be used to parse comma separated * lists for example. */ int CONF_parse_list(const char *list_, int sep, int nospc, int (*list_cb) (const char *elem, int len, void *usr), void *arg) { int ret; const char *lstart, *tmpend, *p; if (list_ == NULL) { ERR_raise(ERR_LIB_CONF, CONF_R_LIST_CANNOT_BE_NULL); return 0; } lstart = list_; for (;;) { if (nospc) { while (*lstart && isspace((unsigned char)*lstart)) lstart++; } p = strchr(lstart, sep); if (p == lstart || *lstart == '\0') ret = list_cb(NULL, 0, arg); else { if (p) tmpend = p - 1; else tmpend = lstart + strlen(lstart) - 1; if (nospc) { while (isspace((unsigned char)*tmpend)) tmpend--; } ret = list_cb(lstart, tmpend - lstart + 1, arg); } if (ret <= 0) return ret; if (p == NULL) return 1; lstart = p + 1; } }
./openssl/crypto/conf/conf_ssl.c
/* * Copyright 2015-2021 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 */ #include <stdio.h> #include <string.h> #include <openssl/conf.h> #include <openssl/err.h> #include "internal/sslconf.h" #include "conf_local.h" /* * SSL library configuration module placeholder. We load it here but defer * all decisions about its contents to libssl. */ struct ssl_conf_name_st { /* Name of this set of commands */ char *name; /* List of commands */ SSL_CONF_CMD *cmds; /* Number of commands */ size_t cmd_count; }; struct ssl_conf_cmd_st { /* Command */ char *cmd; /* Argument */ char *arg; }; static struct ssl_conf_name_st *ssl_names; static size_t ssl_names_count; static void ssl_module_free(CONF_IMODULE *md) { size_t i, j; if (ssl_names == NULL) return; for (i = 0; i < ssl_names_count; i++) { struct ssl_conf_name_st *tname = ssl_names + i; OPENSSL_free(tname->name); for (j = 0; j < tname->cmd_count; j++) { OPENSSL_free(tname->cmds[j].cmd); OPENSSL_free(tname->cmds[j].arg); } OPENSSL_free(tname->cmds); } OPENSSL_free(ssl_names); ssl_names = NULL; ssl_names_count = 0; } static int ssl_module_init(CONF_IMODULE *md, const CONF *cnf) { size_t i, j, cnt; int rv = 0; const char *ssl_conf_section; STACK_OF(CONF_VALUE) *cmd_lists; ssl_conf_section = CONF_imodule_get_value(md); cmd_lists = NCONF_get_section(cnf, ssl_conf_section); if (sk_CONF_VALUE_num(cmd_lists) <= 0) { int rcode = cmd_lists == NULL ? CONF_R_SSL_SECTION_NOT_FOUND : CONF_R_SSL_SECTION_EMPTY; ERR_raise_data(ERR_LIB_CONF, rcode, "section=%s", ssl_conf_section); goto err; } cnt = sk_CONF_VALUE_num(cmd_lists); ssl_module_free(md); ssl_names = OPENSSL_zalloc(sizeof(*ssl_names) * cnt); if (ssl_names == NULL) goto err; ssl_names_count = cnt; for (i = 0; i < ssl_names_count; i++) { struct ssl_conf_name_st *ssl_name = ssl_names + i; CONF_VALUE *sect = sk_CONF_VALUE_value(cmd_lists, (int)i); STACK_OF(CONF_VALUE) *cmds = NCONF_get_section(cnf, sect->value); if (sk_CONF_VALUE_num(cmds) <= 0) { int rcode = cmds == NULL ? CONF_R_SSL_COMMAND_SECTION_NOT_FOUND : CONF_R_SSL_COMMAND_SECTION_EMPTY; ERR_raise_data(ERR_LIB_CONF, rcode, "name=%s, value=%s", sect->name, sect->value); goto err; } ssl_name->name = OPENSSL_strdup(sect->name); if (ssl_name->name == NULL) goto err; cnt = sk_CONF_VALUE_num(cmds); ssl_name->cmds = OPENSSL_zalloc(cnt * sizeof(struct ssl_conf_cmd_st)); if (ssl_name->cmds == NULL) goto err; ssl_name->cmd_count = cnt; for (j = 0; j < cnt; j++) { const char *name; CONF_VALUE *cmd_conf = sk_CONF_VALUE_value(cmds, (int)j); struct ssl_conf_cmd_st *cmd = ssl_name->cmds + j; /* Skip any initial dot in name */ name = strchr(cmd_conf->name, '.'); if (name != NULL) name++; else name = cmd_conf->name; cmd->cmd = OPENSSL_strdup(name); cmd->arg = OPENSSL_strdup(cmd_conf->value); if (cmd->cmd == NULL || cmd->arg == NULL) goto err; } } rv = 1; err: if (rv == 0) ssl_module_free(md); return rv; } /* * Returns the set of commands with index |idx| previously searched for via * conf_ssl_name_find. Also stores the name of the set of commands in |*name| * and the number of commands in the set in |*cnt|. */ const SSL_CONF_CMD *conf_ssl_get(size_t idx, const char **name, size_t *cnt) { *name = ssl_names[idx].name; *cnt = ssl_names[idx].cmd_count; return ssl_names[idx].cmds; } /* * Search for the named set of commands given in |name|. On success return the * index for the command set in |*idx|. * Returns 1 on success or 0 on failure. */ int conf_ssl_name_find(const char *name, size_t *idx) { size_t i; const struct ssl_conf_name_st *nm; if (name == NULL) return 0; for (i = 0, nm = ssl_names; i < ssl_names_count; i++, nm++) { if (strcmp(nm->name, name) == 0) { *idx = i; return 1; } } return 0; } /* * Given a command set |cmd|, return details on the command at index |idx| which * must be less than the number of commands in the set (as returned by * conf_ssl_get). The name of the command will be returned in |*cmdstr| and the * argument is returned in |*arg|. */ void conf_ssl_get_cmd(const SSL_CONF_CMD *cmd, size_t idx, char **cmdstr, char **arg) { *cmdstr = cmd[idx].cmd; *arg = cmd[idx].arg; } void ossl_config_add_ssl_module(void) { CONF_module_add("ssl_conf", ssl_module_init, ssl_module_free); }
./openssl/crypto/conf/conf_api.c
/* * Copyright 1995-2022 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 */ /* Part of the code in here was originally in conf.c, which is now removed */ #include "internal/e_os.h" #include "internal/cryptlib.h" #include <stdlib.h> #include <string.h> #include <openssl/conf.h> #include <openssl/conf_api.h> #include "conf_local.h" static void value_free_hash(const CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf); static void value_free_stack_doall(CONF_VALUE *a); CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section) { CONF_VALUE vv; if (conf == NULL || section == NULL) return NULL; vv.name = NULL; vv.section = (char *)section; return conf->data != NULL ? lh_CONF_VALUE_retrieve(conf->data, &vv) : NULL; } STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, const char *section) { CONF_VALUE *v; v = _CONF_get_section(conf, section); if (v == NULL) return NULL; return ((STACK_OF(CONF_VALUE) *)v->value); } int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) { CONF_VALUE *v = NULL; STACK_OF(CONF_VALUE) *ts; ts = (STACK_OF(CONF_VALUE) *)section->value; value->section = section->section; if (!sk_CONF_VALUE_push(ts, value)) return 0; v = lh_CONF_VALUE_insert(conf->data, value); if (v != NULL) { (void)sk_CONF_VALUE_delete_ptr(ts, v); OPENSSL_free(v->name); OPENSSL_free(v->value); OPENSSL_free(v); } return 1; } char *_CONF_get_string(const CONF *conf, const char *section, const char *name) { CONF_VALUE *v, vv; char *p; if (name == NULL) return NULL; if (conf == NULL) return ossl_safe_getenv(name); if (conf->data == NULL) return NULL; if (section != NULL) { vv.name = (char *)name; vv.section = (char *)section; v = lh_CONF_VALUE_retrieve(conf->data, &vv); if (v != NULL) return v->value; if (strcmp(section, "ENV") == 0) { p = ossl_safe_getenv(name); if (p != NULL) return p; } } vv.section = "default"; vv.name = (char *)name; v = lh_CONF_VALUE_retrieve(conf->data, &vv); if (v == NULL) return NULL; return v->value; } static unsigned long conf_value_hash(const CONF_VALUE *v) { return (OPENSSL_LH_strhash(v->section) << 2) ^ OPENSSL_LH_strhash(v->name); } static int conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b) { int i; if (a->section != b->section) { i = strcmp(a->section, b->section); if (i != 0) return i; } if (a->name != NULL && b->name != NULL) return strcmp(a->name, b->name); if (a->name == b->name) return 0; return (a->name == NULL) ? -1 : 1; } int _CONF_new_data(CONF *conf) { if (conf == NULL) return 0; if (conf->data == NULL) { conf->data = lh_CONF_VALUE_new(conf_value_hash, conf_value_cmp); if (conf->data == NULL) return 0; } return 1; } typedef LHASH_OF(CONF_VALUE) LH_CONF_VALUE; IMPLEMENT_LHASH_DOALL_ARG_CONST(CONF_VALUE, LH_CONF_VALUE); void _CONF_free_data(CONF *conf) { if (conf == NULL) return; OPENSSL_free(conf->includedir); if (conf->data == NULL) return; /* evil thing to make sure the 'OPENSSL_free()' works as expected */ lh_CONF_VALUE_set_down_load(conf->data, 0); lh_CONF_VALUE_doall_LH_CONF_VALUE(conf->data, value_free_hash, conf->data); /* * We now have only 'section' entries in the hash table. Due to problems * with */ lh_CONF_VALUE_doall(conf->data, value_free_stack_doall); lh_CONF_VALUE_free(conf->data); } static void value_free_hash(const CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf) { if (a->name != NULL) (void)lh_CONF_VALUE_delete(conf, a); } static void value_free_stack_doall(CONF_VALUE *a) { CONF_VALUE *vv; STACK_OF(CONF_VALUE) *sk; int i; if (a->name != NULL) return; sk = (STACK_OF(CONF_VALUE) *)a->value; for (i = sk_CONF_VALUE_num(sk) - 1; i >= 0; i--) { vv = sk_CONF_VALUE_value(sk, i); OPENSSL_free(vv->value); OPENSSL_free(vv->name); OPENSSL_free(vv); } sk_CONF_VALUE_free(sk); OPENSSL_free(a->section); OPENSSL_free(a); } CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) { STACK_OF(CONF_VALUE) *sk = NULL; int i; CONF_VALUE *v = NULL, *vv; if ((sk = sk_CONF_VALUE_new_null()) == NULL) goto err; if ((v = OPENSSL_malloc(sizeof(*v))) == NULL) goto err; i = strlen(section) + 1; if ((v->section = OPENSSL_malloc(i)) == NULL) goto err; memcpy(v->section, section, i); v->name = NULL; v->value = (char *)sk; vv = lh_CONF_VALUE_insert(conf->data, v); if (vv != NULL || lh_CONF_VALUE_error(conf->data) > 0) goto err; return v; err: sk_CONF_VALUE_free(sk); if (v != NULL) OPENSSL_free(v->section); OPENSSL_free(v); return NULL; }
./openssl/crypto/poly1305/poly1305_base2_44.c
/* * Copyright 2016-2021 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 */ /* * This module is meant to be used as template for base 2^44 assembly * implementation[s]. On side note compiler-generated code is not * slower than compiler-generated base 2^64 code on [high-end] x86_64, * even though amount of multiplications is 50% higher. Go figure... */ #include <stdlib.h> typedef unsigned char u8; typedef unsigned int u32; typedef unsigned long u64; typedef uint128_t u128; typedef struct { u64 h[3]; u64 s[2]; u64 r[3]; } poly1305_internal; #define POLY1305_BLOCK_SIZE 16 /* pick 64-bit unsigned integer in little endian order */ static u64 U8TOU64(const unsigned char *p) { return (((u64)(p[0] & 0xff)) | ((u64)(p[1] & 0xff) << 8) | ((u64)(p[2] & 0xff) << 16) | ((u64)(p[3] & 0xff) << 24) | ((u64)(p[4] & 0xff) << 32) | ((u64)(p[5] & 0xff) << 40) | ((u64)(p[6] & 0xff) << 48) | ((u64)(p[7] & 0xff) << 56)); } /* store a 64-bit unsigned integer in little endian */ static void U64TO8(unsigned char *p, u64 v) { p[0] = (unsigned char)((v) & 0xff); p[1] = (unsigned char)((v >> 8) & 0xff); p[2] = (unsigned char)((v >> 16) & 0xff); p[3] = (unsigned char)((v >> 24) & 0xff); p[4] = (unsigned char)((v >> 32) & 0xff); p[5] = (unsigned char)((v >> 40) & 0xff); p[6] = (unsigned char)((v >> 48) & 0xff); p[7] = (unsigned char)((v >> 56) & 0xff); } int poly1305_init(void *ctx, const unsigned char key[16]) { poly1305_internal *st = (poly1305_internal *)ctx; u64 r0, r1; /* h = 0 */ st->h[0] = 0; st->h[1] = 0; st->h[2] = 0; r0 = U8TOU64(&key[0]) & 0x0ffffffc0fffffff; r1 = U8TOU64(&key[8]) & 0x0ffffffc0ffffffc; /* break r1:r0 to three 44-bit digits, masks are 1<<44-1 */ st->r[0] = r0 & 0x0fffffffffff; st->r[1] = ((r0 >> 44) | (r1 << 20)) & 0x0fffffffffff; st->r[2] = (r1 >> 24); st->s[0] = (st->r[1] + (st->r[1] << 2)) << 2; st->s[1] = (st->r[2] + (st->r[2] << 2)) << 2; return 0; } void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit) { poly1305_internal *st = (poly1305_internal *)ctx; u64 r0, r1, r2; u64 s1, s2; u64 h0, h1, h2, c; u128 d0, d1, d2; u64 pad = (u64)padbit << 40; r0 = st->r[0]; r1 = st->r[1]; r2 = st->r[2]; s1 = st->s[0]; s2 = st->s[1]; h0 = st->h[0]; h1 = st->h[1]; h2 = st->h[2]; while (len >= POLY1305_BLOCK_SIZE) { u64 m0, m1; m0 = U8TOU64(inp + 0); m1 = U8TOU64(inp + 8); /* h += m[i], m[i] is broken to 44-bit digits */ h0 += m0 & 0x0fffffffffff; h1 += ((m0 >> 44) | (m1 << 20)) & 0x0fffffffffff; h2 += (m1 >> 24) + pad; /* h *= r "%" p, where "%" stands for "partial remainder" */ d0 = ((u128)h0 * r0) + ((u128)h1 * s2) + ((u128)h2 * s1); d1 = ((u128)h0 * r1) + ((u128)h1 * r0) + ((u128)h2 * s2); d2 = ((u128)h0 * r2) + ((u128)h1 * r1) + ((u128)h2 * r0); /* "lazy" reduction step */ h0 = (u64)d0 & 0x0fffffffffff; h1 = (u64)(d1 += (u64)(d0 >> 44)) & 0x0fffffffffff; h2 = (u64)(d2 += (u64)(d1 >> 44)) & 0x03ffffffffff; /* last 42 bits */ c = (d2 >> 42); h0 += c + (c << 2); inp += POLY1305_BLOCK_SIZE; len -= POLY1305_BLOCK_SIZE; } st->h[0] = h0; st->h[1] = h1; st->h[2] = h2; } void poly1305_emit(void *ctx, unsigned char mac[16], const u32 nonce[4]) { poly1305_internal *st = (poly1305_internal *) ctx; u64 h0, h1, h2; u64 g0, g1, g2; u128 t; u64 mask; h0 = st->h[0]; h1 = st->h[1]; h2 = st->h[2]; /* after "lazy" reduction, convert 44+bit digits to 64-bit ones */ h0 = (u64)(t = (u128)h0 + (h1 << 44)); h1 >>= 20; h1 = (u64)(t = (u128)h1 + (h2 << 24) + (t >> 64)); h2 >>= 40; h2 += (u64)(t >> 64); /* compare to modulus by computing h + -p */ g0 = (u64)(t = (u128)h0 + 5); g1 = (u64)(t = (u128)h1 + (t >> 64)); g2 = h2 + (u64)(t >> 64); /* if there was carry into 131st bit, h1:h0 = g1:g0 */ mask = 0 - (g2 >> 2); g0 &= mask; g1 &= mask; mask = ~mask; h0 = (h0 & mask) | g0; h1 = (h1 & mask) | g1; /* mac = (h + nonce) % (2^128) */ h0 = (u64)(t = (u128)h0 + nonce[0] + ((u64)nonce[1]<<32)); h1 = (u64)(t = (u128)h1 + nonce[2] + ((u64)nonce[3]<<32) + (t >> 64)); U64TO8(mac + 0, h0); U64TO8(mac + 8, h1); }
./openssl/crypto/poly1305/poly1305_ieee754.c
/* * Copyright 2016-2023 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 */ /* * This module is meant to be used as template for non-x87 floating- * point assembly modules. The template itself is x86_64-specific * though, as it was debugged on x86_64. So that implementer would * have to recognize platform-specific parts, UxTOy and inline asm, * and act accordingly. * * Huh? x86_64-specific code as template for non-x87? Note seven, which * is not a typo, but reference to 80-bit precision. This module on the * other hand relies on 64-bit precision operations, which are default * for x86_64 code. And since we are at it, just for sense of it, * large-block performance in cycles per processed byte for *this* code * is: * gcc-4.8 icc-15.0 clang-3.4(*) * * Westmere 4.96 5.09 4.37 * Sandy Bridge 4.95 4.90 4.17 * Haswell 4.92 4.87 3.78 * Bulldozer 4.67 4.49 4.68 * VIA Nano 7.07 7.05 5.98 * Silvermont 10.6 9.61 12.6 * * (*) clang managed to discover parallelism and deployed SIMD; * * And for range of other platforms with unspecified gcc versions: * * Freescale e300 12.5 * PPC74x0 10.8 * POWER6 4.92 * POWER7 4.50 * POWER8 4.10 * * z10 11.2 * z196+ 7.30 * * UltraSPARC III 16.0 * SPARC T4 16.1 */ #if !(defined(__GNUC__) && __GNUC__>=2) # error "this is gcc-specific template" #endif #include <stdlib.h> typedef unsigned char u8; typedef unsigned int u32; typedef unsigned long long u64; typedef union { double d; u64 u; } elem64; #define TWO(p) ((double)(1ULL<<(p))) #define TWO0 TWO(0) #define TWO32 TWO(32) #define TWO64 (TWO32*TWO(32)) #define TWO96 (TWO64*TWO(32)) #define TWO130 (TWO96*TWO(34)) #define EXP(p) ((1023ULL+(p))<<52) #if defined(__x86_64__) || (defined(__PPC__) && defined(__LITTLE_ENDIAN__)) # define U8TOU32(p) (*(const u32 *)(p)) # define U32TO8(p,v) (*(u32 *)(p) = (v)) #elif defined(__PPC__) || defined(__POWERPC__) # define U8TOU32(p) ({u32 ret; asm ("lwbrx %0,0,%1":"=r"(ret):"b"(p)); ret; }) # define U32TO8(p,v) asm ("stwbrx %0,0,%1"::"r"(v),"b"(p):"memory") #elif defined(__s390x__) # define U8TOU32(p) ({u32 ret; asm ("lrv %0,%1":"=d"(ret):"m"(*(u32 *)(p))); ret; }) # define U32TO8(p,v) asm ("strv %1,%0":"=m"(*(u32 *)(p)):"d"(v)) #endif #ifndef U8TOU32 # define U8TOU32(p) ((u32)(p)[0] | (u32)(p)[1]<<8 | \ (u32)(p)[2]<<16 | (u32)(p)[3]<<24 ) #endif #ifndef U32TO8 # define U32TO8(p,v) ((p)[0] = (u8)(v), (p)[1] = (u8)((v)>>8), \ (p)[2] = (u8)((v)>>16), (p)[3] = (u8)((v)>>24) ) #endif typedef struct { elem64 h[4]; double r[8]; double s[6]; } poly1305_internal; /* "round toward zero (truncate), mask all exceptions" */ #if defined(__x86_64__) static const u32 mxcsr = 0x7f80; #elif defined(__PPC__) || defined(__POWERPC__) static const u64 one = 1; #elif defined(__s390x__) static const u32 fpc = 1; #elif defined(__sparc__) static const u64 fsr = 1ULL<<30; #elif defined(__mips__) static const u32 fcsr = 1; #else #error "unrecognized platform" #endif int poly1305_init(void *ctx, const unsigned char key[16]) { poly1305_internal *st = (poly1305_internal *) ctx; elem64 r0, r1, r2, r3; /* h = 0, biased */ #if 0 st->h[0].d = TWO(52)*TWO0; st->h[1].d = TWO(52)*TWO32; st->h[2].d = TWO(52)*TWO64; st->h[3].d = TWO(52)*TWO96; #else st->h[0].u = EXP(52+0); st->h[1].u = EXP(52+32); st->h[2].u = EXP(52+64); st->h[3].u = EXP(52+96); #endif if (key) { /* * set "truncate" rounding mode */ #if defined(__x86_64__) u32 mxcsr_orig; asm volatile ("stmxcsr %0":"=m"(mxcsr_orig)); asm volatile ("ldmxcsr %0"::"m"(mxcsr)); #elif defined(__PPC__) || defined(__POWERPC__) double fpscr_orig, fpscr = *(double *)&one; asm volatile ("mffs %0":"=f"(fpscr_orig)); asm volatile ("mtfsf 255,%0"::"f"(fpscr)); #elif defined(__s390x__) u32 fpc_orig; asm volatile ("stfpc %0":"=m"(fpc_orig)); asm volatile ("lfpc %0"::"m"(fpc)); #elif defined(__sparc__) u64 fsr_orig; asm volatile ("stx %%fsr,%0":"=m"(fsr_orig)); asm volatile ("ldx %0,%%fsr"::"m"(fsr)); #elif defined(__mips__) u32 fcsr_orig; asm volatile ("cfc1 %0,$31":"=r"(fcsr_orig)); asm volatile ("ctc1 %0,$31"::"r"(fcsr)); #endif /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */ r0.u = EXP(52+0) | (U8TOU32(&key[0]) & 0x0fffffff); r1.u = EXP(52+32) | (U8TOU32(&key[4]) & 0x0ffffffc); r2.u = EXP(52+64) | (U8TOU32(&key[8]) & 0x0ffffffc); r3.u = EXP(52+96) | (U8TOU32(&key[12]) & 0x0ffffffc); st->r[0] = r0.d - TWO(52)*TWO0; st->r[2] = r1.d - TWO(52)*TWO32; st->r[4] = r2.d - TWO(52)*TWO64; st->r[6] = r3.d - TWO(52)*TWO96; st->s[0] = st->r[2] * (5.0/TWO130); st->s[2] = st->r[4] * (5.0/TWO130); st->s[4] = st->r[6] * (5.0/TWO130); /* * base 2^32 -> base 2^16 */ st->r[1] = (st->r[0] + TWO(52)*TWO(16)*TWO0) - TWO(52)*TWO(16)*TWO0; st->r[0] -= st->r[1]; st->r[3] = (st->r[2] + TWO(52)*TWO(16)*TWO32) - TWO(52)*TWO(16)*TWO32; st->r[2] -= st->r[3]; st->r[5] = (st->r[4] + TWO(52)*TWO(16)*TWO64) - TWO(52)*TWO(16)*TWO64; st->r[4] -= st->r[5]; st->r[7] = (st->r[6] + TWO(52)*TWO(16)*TWO96) - TWO(52)*TWO(16)*TWO96; st->r[6] -= st->r[7]; st->s[1] = (st->s[0] + TWO(52)*TWO(16)*TWO0/TWO96) - TWO(52)*TWO(16)*TWO0/TWO96; st->s[0] -= st->s[1]; st->s[3] = (st->s[2] + TWO(52)*TWO(16)*TWO32/TWO96) - TWO(52)*TWO(16)*TWO32/TWO96; st->s[2] -= st->s[3]; st->s[5] = (st->s[4] + TWO(52)*TWO(16)*TWO64/TWO96) - TWO(52)*TWO(16)*TWO64/TWO96; st->s[4] -= st->s[5]; /* * restore original FPU control register */ #if defined(__x86_64__) asm volatile ("ldmxcsr %0"::"m"(mxcsr_orig)); #elif defined(__PPC__) || defined(__POWERPC__) asm volatile ("mtfsf 255,%0"::"f"(fpscr_orig)); #elif defined(__s390x__) asm volatile ("lfpc %0"::"m"(fpc_orig)); #elif defined(__sparc__) asm volatile ("ldx %0,%%fsr"::"m"(fsr_orig)); #elif defined(__mips__) asm volatile ("ctc1 %0,$31"::"r"(fcsr_orig)); #endif } return 0; } void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, int padbit) { poly1305_internal *st = (poly1305_internal *)ctx; elem64 in0, in1, in2, in3; u64 pad = (u64)padbit<<32; double x0, x1, x2, x3; double h0lo, h0hi, h1lo, h1hi, h2lo, h2hi, h3lo, h3hi; double c0lo, c0hi, c1lo, c1hi, c2lo, c2hi, c3lo, c3hi; const double r0lo = st->r[0]; const double r0hi = st->r[1]; const double r1lo = st->r[2]; const double r1hi = st->r[3]; const double r2lo = st->r[4]; const double r2hi = st->r[5]; const double r3lo = st->r[6]; const double r3hi = st->r[7]; const double s1lo = st->s[0]; const double s1hi = st->s[1]; const double s2lo = st->s[2]; const double s2hi = st->s[3]; const double s3lo = st->s[4]; const double s3hi = st->s[5]; /* * set "truncate" rounding mode */ #if defined(__x86_64__) u32 mxcsr_orig; asm volatile ("stmxcsr %0":"=m"(mxcsr_orig)); asm volatile ("ldmxcsr %0"::"m"(mxcsr)); #elif defined(__PPC__) || defined(__POWERPC__) double fpscr_orig, fpscr = *(double *)&one; asm volatile ("mffs %0":"=f"(fpscr_orig)); asm volatile ("mtfsf 255,%0"::"f"(fpscr)); #elif defined(__s390x__) u32 fpc_orig; asm volatile ("stfpc %0":"=m"(fpc_orig)); asm volatile ("lfpc %0"::"m"(fpc)); #elif defined(__sparc__) u64 fsr_orig; asm volatile ("stx %%fsr,%0":"=m"(fsr_orig)); asm volatile ("ldx %0,%%fsr"::"m"(fsr)); #elif defined(__mips__) u32 fcsr_orig; asm volatile ("cfc1 %0,$31":"=r"(fcsr_orig)); asm volatile ("ctc1 %0,$31"::"r"(fcsr)); #endif /* * load base 2^32 and de-bias */ h0lo = st->h[0].d - TWO(52)*TWO0; h1lo = st->h[1].d - TWO(52)*TWO32; h2lo = st->h[2].d - TWO(52)*TWO64; h3lo = st->h[3].d - TWO(52)*TWO96; #ifdef __clang__ h0hi = 0; h1hi = 0; h2hi = 0; h3hi = 0; #else in0.u = EXP(52+0) | U8TOU32(&inp[0]); in1.u = EXP(52+32) | U8TOU32(&inp[4]); in2.u = EXP(52+64) | U8TOU32(&inp[8]); in3.u = EXP(52+96) | U8TOU32(&inp[12]) | pad; x0 = in0.d - TWO(52)*TWO0; x1 = in1.d - TWO(52)*TWO32; x2 = in2.d - TWO(52)*TWO64; x3 = in3.d - TWO(52)*TWO96; x0 += h0lo; x1 += h1lo; x2 += h2lo; x3 += h3lo; goto fast_entry; #endif do { in0.u = EXP(52+0) | U8TOU32(&inp[0]); in1.u = EXP(52+32) | U8TOU32(&inp[4]); in2.u = EXP(52+64) | U8TOU32(&inp[8]); in3.u = EXP(52+96) | U8TOU32(&inp[12]) | pad; x0 = in0.d - TWO(52)*TWO0; x1 = in1.d - TWO(52)*TWO32; x2 = in2.d - TWO(52)*TWO64; x3 = in3.d - TWO(52)*TWO96; /* * note that there are multiple ways to accumulate input, e.g. * one can as well accumulate to h0lo-h1lo-h1hi-h2hi... */ h0lo += x0; h0hi += x1; h2lo += x2; h2hi += x3; /* * carries that cross 32n-bit (and 130-bit) boundaries */ c0lo = (h0lo + TWO(52)*TWO32) - TWO(52)*TWO32; c1lo = (h1lo + TWO(52)*TWO64) - TWO(52)*TWO64; c2lo = (h2lo + TWO(52)*TWO96) - TWO(52)*TWO96; c3lo = (h3lo + TWO(52)*TWO130) - TWO(52)*TWO130; c0hi = (h0hi + TWO(52)*TWO32) - TWO(52)*TWO32; c1hi = (h1hi + TWO(52)*TWO64) - TWO(52)*TWO64; c2hi = (h2hi + TWO(52)*TWO96) - TWO(52)*TWO96; c3hi = (h3hi + TWO(52)*TWO130) - TWO(52)*TWO130; /* * base 2^48 -> base 2^32 with last reduction step */ x1 = (h1lo - c1lo) + c0lo; x2 = (h2lo - c2lo) + c1lo; x3 = (h3lo - c3lo) + c2lo; x0 = (h0lo - c0lo) + c3lo * (5.0/TWO130); x1 += (h1hi - c1hi) + c0hi; x2 += (h2hi - c2hi) + c1hi; x3 += (h3hi - c3hi) + c2hi; x0 += (h0hi - c0hi) + c3hi * (5.0/TWO130); #ifndef __clang__ fast_entry: #endif /* * base 2^32 * base 2^16 = base 2^48 */ h0lo = s3lo * x1 + s2lo * x2 + s1lo * x3 + r0lo * x0; h1lo = r0lo * x1 + s3lo * x2 + s2lo * x3 + r1lo * x0; h2lo = r1lo * x1 + r0lo * x2 + s3lo * x3 + r2lo * x0; h3lo = r2lo * x1 + r1lo * x2 + r0lo * x3 + r3lo * x0; h0hi = s3hi * x1 + s2hi * x2 + s1hi * x3 + r0hi * x0; h1hi = r0hi * x1 + s3hi * x2 + s2hi * x3 + r1hi * x0; h2hi = r1hi * x1 + r0hi * x2 + s3hi * x3 + r2hi * x0; h3hi = r2hi * x1 + r1hi * x2 + r0hi * x3 + r3hi * x0; inp += 16; len -= 16; } while (len >= 16); /* * carries that cross 32n-bit (and 130-bit) boundaries */ c0lo = (h0lo + TWO(52)*TWO32) - TWO(52)*TWO32; c1lo = (h1lo + TWO(52)*TWO64) - TWO(52)*TWO64; c2lo = (h2lo + TWO(52)*TWO96) - TWO(52)*TWO96; c3lo = (h3lo + TWO(52)*TWO130) - TWO(52)*TWO130; c0hi = (h0hi + TWO(52)*TWO32) - TWO(52)*TWO32; c1hi = (h1hi + TWO(52)*TWO64) - TWO(52)*TWO64; c2hi = (h2hi + TWO(52)*TWO96) - TWO(52)*TWO96; c3hi = (h3hi + TWO(52)*TWO130) - TWO(52)*TWO130; /* * base 2^48 -> base 2^32 with last reduction step */ x1 = (h1lo - c1lo) + c0lo; x2 = (h2lo - c2lo) + c1lo; x3 = (h3lo - c3lo) + c2lo; x0 = (h0lo - c0lo) + c3lo * (5.0/TWO130); x1 += (h1hi - c1hi) + c0hi; x2 += (h2hi - c2hi) + c1hi; x3 += (h3hi - c3hi) + c2hi; x0 += (h0hi - c0hi) + c3hi * (5.0/TWO130); /* * store base 2^32, with bias */ st->h[1].d = x1 + TWO(52)*TWO32; st->h[2].d = x2 + TWO(52)*TWO64; st->h[3].d = x3 + TWO(52)*TWO96; st->h[0].d = x0 + TWO(52)*TWO0; /* * restore original FPU control register */ #if defined(__x86_64__) asm volatile ("ldmxcsr %0"::"m"(mxcsr_orig)); #elif defined(__PPC__) || defined(__POWERPC__) asm volatile ("mtfsf 255,%0"::"f"(fpscr_orig)); #elif defined(__s390x__) asm volatile ("lfpc %0"::"m"(fpc_orig)); #elif defined(__sparc__) asm volatile ("ldx %0,%%fsr"::"m"(fsr_orig)); #elif defined(__mips__) asm volatile ("ctc1 %0,$31"::"r"(fcsr_orig)); #endif } void poly1305_emit(void *ctx, unsigned char mac[16], const u32 nonce[4]) { poly1305_internal *st = (poly1305_internal *) ctx; u64 h0, h1, h2, h3, h4; u32 g0, g1, g2, g3, g4; u64 t; u32 mask; /* * thanks to bias masking exponent gives integer result */ h0 = st->h[0].u & 0x000fffffffffffffULL; h1 = st->h[1].u & 0x000fffffffffffffULL; h2 = st->h[2].u & 0x000fffffffffffffULL; h3 = st->h[3].u & 0x000fffffffffffffULL; /* * can be partially reduced, so reduce... */ h4 = h3>>32; h3 &= 0xffffffffU; g4 = h4&-4; h4 &= 3; g4 += g4>>2; h0 += g4; h1 += h0>>32; h0 &= 0xffffffffU; h2 += h1>>32; h1 &= 0xffffffffU; h3 += h2>>32; h2 &= 0xffffffffU; /* compute h + -p */ g0 = (u32)(t = h0 + 5); g1 = (u32)(t = h1 + (t >> 32)); g2 = (u32)(t = h2 + (t >> 32)); g3 = (u32)(t = h3 + (t >> 32)); g4 = h4 + (u32)(t >> 32); /* if there was carry, select g0-g3 */ mask = 0 - (g4 >> 2); g0 &= mask; g1 &= mask; g2 &= mask; g3 &= mask; mask = ~mask; g0 |= (h0 & mask); g1 |= (h1 & mask); g2 |= (h2 & mask); g3 |= (h3 & mask); /* mac = (h + nonce) % (2^128) */ g0 = (u32)(t = (u64)g0 + nonce[0]); g1 = (u32)(t = (u64)g1 + (t >> 32) + nonce[1]); g2 = (u32)(t = (u64)g2 + (t >> 32) + nonce[2]); g3 = (u32)(t = (u64)g3 + (t >> 32) + nonce[3]); U32TO8(mac + 0, g0); U32TO8(mac + 4, g1); U32TO8(mac + 8, g2); U32TO8(mac + 12, g3); }
./openssl/crypto/poly1305/poly1305_ppc.c
/* * Copyright 2009-2021 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 */ #include <openssl/opensslconf.h> #include <openssl/types.h> #include "crypto/poly1305.h" #include "crypto/ppc_arch.h" void poly1305_init_int(void *ctx, const unsigned char key[16]); void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, unsigned int padbit); void poly1305_emit(void *ctx, unsigned char mac[16], const unsigned int nonce[4]); void poly1305_init_fpu(void *ctx, const unsigned char key[16]); void poly1305_blocks_fpu(void *ctx, const unsigned char *inp, size_t len, unsigned int padbit); void poly1305_emit_fpu(void *ctx, unsigned char mac[16], const unsigned int nonce[4]); void poly1305_init_vsx(void *ctx, const unsigned char key[16]); void poly1305_blocks_vsx(void *ctx, const unsigned char *inp, size_t len, unsigned int padbit); void poly1305_emit_vsx(void *ctx, unsigned char mac[16], const unsigned int nonce[4]); int poly1305_init(void *ctx, const unsigned char key[16], void *func[2]); int poly1305_init(void *ctx, const unsigned char key[16], void *func[2]) { if (OPENSSL_ppccap_P & PPC_CRYPTO207) { poly1305_init_int(ctx, key); func[0] = (void*)(uintptr_t)poly1305_blocks_vsx; func[1] = (void*)(uintptr_t)poly1305_emit; } else if (sizeof(size_t) == 4 && (OPENSSL_ppccap_P & PPC_FPU)) { poly1305_init_fpu(ctx, key); func[0] = (void*)(uintptr_t)poly1305_blocks_fpu; func[1] = (void*)(uintptr_t)poly1305_emit_fpu; } else { poly1305_init_int(ctx, key); func[0] = (void*)(uintptr_t)poly1305_blocks; func[1] = (void*)(uintptr_t)poly1305_emit; } return 1; }
./openssl/crypto/poly1305/poly1305.c
/* * Copyright 2015-2021 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 */ #include <stdlib.h> #include <string.h> #include <openssl/crypto.h> #include "crypto/poly1305.h" size_t Poly1305_ctx_size(void) { return sizeof(struct poly1305_context); } /* pick 32-bit unsigned integer in little endian order */ static unsigned int U8TOU32(const unsigned char *p) { return (((unsigned int)(p[0] & 0xff)) | ((unsigned int)(p[1] & 0xff) << 8) | ((unsigned int)(p[2] & 0xff) << 16) | ((unsigned int)(p[3] & 0xff) << 24)); } /* * Implementations can be classified by amount of significant bits in * words making up the multi-precision value, or in other words radix * or base of numerical representation, e.g. base 2^64, base 2^32, * base 2^26. Complementary characteristic is how wide is the result of * multiplication of pair of digits, e.g. it would take 128 bits to * accommodate multiplication result in base 2^64 case. These are used * interchangeably. To describe implementation that is. But interface * is designed to isolate this so that low-level primitives implemented * in assembly can be self-contained/self-coherent. */ #ifndef POLY1305_ASM /* * Even though there is __int128 reference implementation targeting * 64-bit platforms provided below, it's not obvious that it's optimal * choice for every one of them. Depending on instruction set overall * amount of instructions can be comparable to one in __int64 * implementation. Amount of multiplication instructions would be lower, * but not necessarily overall. And in out-of-order execution context, * it is the latter that can be crucial... * * On related note. Poly1305 author, D. J. Bernstein, discusses and * provides floating-point implementations of the algorithm in question. * It made a lot of sense by the time of introduction, because most * then-modern processors didn't have pipelined integer multiplier. * [Not to mention that some had non-constant timing for integer * multiplications.] Floating-point instructions on the other hand could * be issued every cycle, which allowed to achieve better performance. * Nowadays, with SIMD and/or out-or-order execution, shared or * even emulated FPU, it's more complicated, and floating-point * implementation is not necessarily optimal choice in every situation, * rather contrary... * * <appro@openssl.org> */ typedef unsigned int u32; /* * poly1305_blocks processes a multiple of POLY1305_BLOCK_SIZE blocks * of |inp| no longer than |len|. Behaviour for |len| not divisible by * block size is unspecified in general case, even though in reference * implementation the trailing chunk is simply ignored. Per algorithm * specification, every input block, complete or last partial, is to be * padded with a bit past most significant byte. The latter kind is then * padded with zeros till block size. This last partial block padding * is caller(*)'s responsibility, and because of this the last partial * block is always processed with separate call with |len| set to * POLY1305_BLOCK_SIZE and |padbit| to 0. In all other cases |padbit| * should be set to 1 to perform implicit padding with 128th bit. * poly1305_blocks does not actually check for this constraint though, * it's caller(*)'s responsibility to comply. * * (*) In the context "caller" is not application code, but higher * level Poly1305_* from this very module, so that quirks are * handled locally. */ static void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit); /* * Type-agnostic "rip-off" from constant_time.h */ # define CONSTANT_TIME_CARRY(a,b) ( \ (a ^ ((a ^ b) | ((a - b) ^ b))) >> (sizeof(a) * 8 - 1) \ ) # if defined(INT64_MAX) && defined(INT128_MAX) typedef unsigned long u64; typedef uint128_t u128; typedef struct { u64 h[3]; u64 r[2]; } poly1305_internal; /* pick 32-bit unsigned integer in little endian order */ static u64 U8TOU64(const unsigned char *p) { return (((u64)(p[0] & 0xff)) | ((u64)(p[1] & 0xff) << 8) | ((u64)(p[2] & 0xff) << 16) | ((u64)(p[3] & 0xff) << 24) | ((u64)(p[4] & 0xff) << 32) | ((u64)(p[5] & 0xff) << 40) | ((u64)(p[6] & 0xff) << 48) | ((u64)(p[7] & 0xff) << 56)); } /* store a 32-bit unsigned integer in little endian */ static void U64TO8(unsigned char *p, u64 v) { p[0] = (unsigned char)((v) & 0xff); p[1] = (unsigned char)((v >> 8) & 0xff); p[2] = (unsigned char)((v >> 16) & 0xff); p[3] = (unsigned char)((v >> 24) & 0xff); p[4] = (unsigned char)((v >> 32) & 0xff); p[5] = (unsigned char)((v >> 40) & 0xff); p[6] = (unsigned char)((v >> 48) & 0xff); p[7] = (unsigned char)((v >> 56) & 0xff); } static void poly1305_init(void *ctx, const unsigned char key[16]) { poly1305_internal *st = (poly1305_internal *) ctx; /* h = 0 */ st->h[0] = 0; st->h[1] = 0; st->h[2] = 0; /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */ st->r[0] = U8TOU64(&key[0]) & 0x0ffffffc0fffffff; st->r[1] = U8TOU64(&key[8]) & 0x0ffffffc0ffffffc; } static void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit) { poly1305_internal *st = (poly1305_internal *)ctx; u64 r0, r1; u64 s1; u64 h0, h1, h2, c; u128 d0, d1; r0 = st->r[0]; r1 = st->r[1]; s1 = r1 + (r1 >> 2); h0 = st->h[0]; h1 = st->h[1]; h2 = st->h[2]; while (len >= POLY1305_BLOCK_SIZE) { /* h += m[i] */ h0 = (u64)(d0 = (u128)h0 + U8TOU64(inp + 0)); h1 = (u64)(d1 = (u128)h1 + (d0 >> 64) + U8TOU64(inp + 8)); /* * padbit can be zero only when original len was * POLY1306_BLOCK_SIZE, but we don't check */ h2 += (u64)(d1 >> 64) + padbit; /* h *= r "%" p, where "%" stands for "partial remainder" */ d0 = ((u128)h0 * r0) + ((u128)h1 * s1); d1 = ((u128)h0 * r1) + ((u128)h1 * r0) + (h2 * s1); h2 = (h2 * r0); /* last reduction step: */ /* a) h2:h0 = h2<<128 + d1<<64 + d0 */ h0 = (u64)d0; h1 = (u64)(d1 += d0 >> 64); h2 += (u64)(d1 >> 64); /* b) (h2:h0 += (h2:h0>>130) * 5) %= 2^130 */ c = (h2 >> 2) + (h2 & ~3UL); h2 &= 3; h0 += c; h1 += (c = CONSTANT_TIME_CARRY(h0,c)); h2 += CONSTANT_TIME_CARRY(h1,c); /* * Occasional overflows to 3rd bit of h2 are taken care of * "naturally". If after this point we end up at the top of * this loop, then the overflow bit will be accounted for * in next iteration. If we end up in poly1305_emit, then * comparison to modulus below will still count as "carry * into 131st bit", so that properly reduced value will be * picked in conditional move. */ inp += POLY1305_BLOCK_SIZE; len -= POLY1305_BLOCK_SIZE; } st->h[0] = h0; st->h[1] = h1; st->h[2] = h2; } static void poly1305_emit(void *ctx, unsigned char mac[16], const u32 nonce[4]) { poly1305_internal *st = (poly1305_internal *) ctx; u64 h0, h1, h2; u64 g0, g1, g2; u128 t; u64 mask; h0 = st->h[0]; h1 = st->h[1]; h2 = st->h[2]; /* compare to modulus by computing h + -p */ g0 = (u64)(t = (u128)h0 + 5); g1 = (u64)(t = (u128)h1 + (t >> 64)); g2 = h2 + (u64)(t >> 64); /* if there was carry into 131st bit, h1:h0 = g1:g0 */ mask = 0 - (g2 >> 2); g0 &= mask; g1 &= mask; mask = ~mask; h0 = (h0 & mask) | g0; h1 = (h1 & mask) | g1; /* mac = (h + nonce) % (2^128) */ h0 = (u64)(t = (u128)h0 + nonce[0] + ((u64)nonce[1]<<32)); h1 = (u64)(t = (u128)h1 + nonce[2] + ((u64)nonce[3]<<32) + (t >> 64)); U64TO8(mac + 0, h0); U64TO8(mac + 8, h1); } # else # if defined(_WIN32) && !defined(__MINGW32__) typedef unsigned __int64 u64; # elif defined(__arch64__) typedef unsigned long u64; # else typedef unsigned long long u64; # endif typedef struct { u32 h[5]; u32 r[4]; } poly1305_internal; /* store a 32-bit unsigned integer in little endian */ static void U32TO8(unsigned char *p, unsigned int v) { p[0] = (unsigned char)((v) & 0xff); p[1] = (unsigned char)((v >> 8) & 0xff); p[2] = (unsigned char)((v >> 16) & 0xff); p[3] = (unsigned char)((v >> 24) & 0xff); } static void poly1305_init(void *ctx, const unsigned char key[16]) { poly1305_internal *st = (poly1305_internal *) ctx; /* h = 0 */ st->h[0] = 0; st->h[1] = 0; st->h[2] = 0; st->h[3] = 0; st->h[4] = 0; /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */ st->r[0] = U8TOU32(&key[0]) & 0x0fffffff; st->r[1] = U8TOU32(&key[4]) & 0x0ffffffc; st->r[2] = U8TOU32(&key[8]) & 0x0ffffffc; st->r[3] = U8TOU32(&key[12]) & 0x0ffffffc; } static void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit) { poly1305_internal *st = (poly1305_internal *)ctx; u32 r0, r1, r2, r3; u32 s1, s2, s3; u32 h0, h1, h2, h3, h4, c; u64 d0, d1, d2, d3; r0 = st->r[0]; r1 = st->r[1]; r2 = st->r[2]; r3 = st->r[3]; s1 = r1 + (r1 >> 2); s2 = r2 + (r2 >> 2); s3 = r3 + (r3 >> 2); h0 = st->h[0]; h1 = st->h[1]; h2 = st->h[2]; h3 = st->h[3]; h4 = st->h[4]; while (len >= POLY1305_BLOCK_SIZE) { /* h += m[i] */ h0 = (u32)(d0 = (u64)h0 + U8TOU32(inp + 0)); h1 = (u32)(d1 = (u64)h1 + (d0 >> 32) + U8TOU32(inp + 4)); h2 = (u32)(d2 = (u64)h2 + (d1 >> 32) + U8TOU32(inp + 8)); h3 = (u32)(d3 = (u64)h3 + (d2 >> 32) + U8TOU32(inp + 12)); h4 += (u32)(d3 >> 32) + padbit; /* h *= r "%" p, where "%" stands for "partial remainder" */ d0 = ((u64)h0 * r0) + ((u64)h1 * s3) + ((u64)h2 * s2) + ((u64)h3 * s1); d1 = ((u64)h0 * r1) + ((u64)h1 * r0) + ((u64)h2 * s3) + ((u64)h3 * s2) + (h4 * s1); d2 = ((u64)h0 * r2) + ((u64)h1 * r1) + ((u64)h2 * r0) + ((u64)h3 * s3) + (h4 * s2); d3 = ((u64)h0 * r3) + ((u64)h1 * r2) + ((u64)h2 * r1) + ((u64)h3 * r0) + (h4 * s3); h4 = (h4 * r0); /* last reduction step: */ /* a) h4:h0 = h4<<128 + d3<<96 + d2<<64 + d1<<32 + d0 */ h0 = (u32)d0; h1 = (u32)(d1 += d0 >> 32); h2 = (u32)(d2 += d1 >> 32); h3 = (u32)(d3 += d2 >> 32); h4 += (u32)(d3 >> 32); /* b) (h4:h0 += (h4:h0>>130) * 5) %= 2^130 */ c = (h4 >> 2) + (h4 & ~3U); h4 &= 3; h0 += c; h1 += (c = CONSTANT_TIME_CARRY(h0,c)); h2 += (c = CONSTANT_TIME_CARRY(h1,c)); h3 += (c = CONSTANT_TIME_CARRY(h2,c)); h4 += CONSTANT_TIME_CARRY(h3,c); /* * Occasional overflows to 3rd bit of h4 are taken care of * "naturally". If after this point we end up at the top of * this loop, then the overflow bit will be accounted for * in next iteration. If we end up in poly1305_emit, then * comparison to modulus below will still count as "carry * into 131st bit", so that properly reduced value will be * picked in conditional move. */ inp += POLY1305_BLOCK_SIZE; len -= POLY1305_BLOCK_SIZE; } st->h[0] = h0; st->h[1] = h1; st->h[2] = h2; st->h[3] = h3; st->h[4] = h4; } static void poly1305_emit(void *ctx, unsigned char mac[16], const u32 nonce[4]) { poly1305_internal *st = (poly1305_internal *) ctx; u32 h0, h1, h2, h3, h4; u32 g0, g1, g2, g3, g4; u64 t; u32 mask; h0 = st->h[0]; h1 = st->h[1]; h2 = st->h[2]; h3 = st->h[3]; h4 = st->h[4]; /* compare to modulus by computing h + -p */ g0 = (u32)(t = (u64)h0 + 5); g1 = (u32)(t = (u64)h1 + (t >> 32)); g2 = (u32)(t = (u64)h2 + (t >> 32)); g3 = (u32)(t = (u64)h3 + (t >> 32)); g4 = h4 + (u32)(t >> 32); /* if there was carry into 131st bit, h3:h0 = g3:g0 */ mask = 0 - (g4 >> 2); g0 &= mask; g1 &= mask; g2 &= mask; g3 &= mask; mask = ~mask; h0 = (h0 & mask) | g0; h1 = (h1 & mask) | g1; h2 = (h2 & mask) | g2; h3 = (h3 & mask) | g3; /* mac = (h + nonce) % (2^128) */ h0 = (u32)(t = (u64)h0 + nonce[0]); h1 = (u32)(t = (u64)h1 + (t >> 32) + nonce[1]); h2 = (u32)(t = (u64)h2 + (t >> 32) + nonce[2]); h3 = (u32)(t = (u64)h3 + (t >> 32) + nonce[3]); U32TO8(mac + 0, h0); U32TO8(mac + 4, h1); U32TO8(mac + 8, h2); U32TO8(mac + 12, h3); } # endif #else int poly1305_init(void *ctx, const unsigned char key[16], void *func); void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, unsigned int padbit); void poly1305_emit(void *ctx, unsigned char mac[16], const unsigned int nonce[4]); #endif void Poly1305_Init(POLY1305 *ctx, const unsigned char key[32]) { ctx->nonce[0] = U8TOU32(&key[16]); ctx->nonce[1] = U8TOU32(&key[20]); ctx->nonce[2] = U8TOU32(&key[24]); ctx->nonce[3] = U8TOU32(&key[28]); #ifndef POLY1305_ASM poly1305_init(ctx->opaque, key); #else /* * Unlike reference poly1305_init assembly counterpart is expected * to return a value: non-zero if it initializes ctx->func, and zero * otherwise. Latter is to simplify assembly in cases when there no * multiple code paths to switch between. */ if (!poly1305_init(ctx->opaque, key, &ctx->func)) { ctx->func.blocks = poly1305_blocks; ctx->func.emit = poly1305_emit; } #endif ctx->num = 0; } #ifdef POLY1305_ASM /* * This "eclipses" poly1305_blocks and poly1305_emit, but it's * conscious choice imposed by -Wshadow compiler warnings. */ # define poly1305_blocks (*poly1305_blocks_p) # define poly1305_emit (*poly1305_emit_p) #endif void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) { #ifdef POLY1305_ASM /* * As documented, poly1305_blocks is never called with input * longer than single block and padbit argument set to 0. This * property is fluently used in assembly modules to optimize * padbit handling on loop boundary. */ poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; #endif size_t rem, num; if ((num = ctx->num)) { rem = POLY1305_BLOCK_SIZE - num; if (len >= rem) { memcpy(ctx->data + num, inp, rem); poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1); inp += rem; len -= rem; } else { /* Still not enough data to process a block. */ memcpy(ctx->data + num, inp, len); ctx->num = num + len; return; } } rem = len % POLY1305_BLOCK_SIZE; len -= rem; if (len >= POLY1305_BLOCK_SIZE) { poly1305_blocks(ctx->opaque, inp, len, 1); inp += len; } if (rem) memcpy(ctx->data, inp, rem); ctx->num = rem; } void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; poly1305_emit_f poly1305_emit_p = ctx->func.emit; #endif size_t num; if ((num = ctx->num)) { ctx->data[num++] = 1; /* pad bit */ while (num < POLY1305_BLOCK_SIZE) ctx->data[num++] = 0; poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 0); } poly1305_emit(ctx->opaque, mac, ctx->nonce); /* zero out the state */ OPENSSL_cleanse(ctx, sizeof(*ctx)); }
./openssl/crypto/stack/stack.c
/* * Copyright 1995-2023 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 */ #include <stdio.h> #include "internal/cryptlib.h" #include "internal/numbers.h" #include "internal/safe_math.h" #include <openssl/stack.h> #include <errno.h> #include <openssl/e_os2.h> /* For ossl_inline */ OSSL_SAFE_MATH_SIGNED(int, int) /* * The initial number of nodes in the array. */ static const int min_nodes = 4; static const int max_nodes = SIZE_MAX / sizeof(void *) < INT_MAX ? (int)(SIZE_MAX / sizeof(void *)) : INT_MAX; struct stack_st { int num; const void **data; int sorted; int num_alloc; OPENSSL_sk_compfunc comp; }; OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, OPENSSL_sk_compfunc c) { OPENSSL_sk_compfunc old = sk->comp; if (sk->comp != c) sk->sorted = 0; sk->comp = c; return old; } OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *sk) { OPENSSL_STACK *ret; if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) goto err; if (sk == NULL) { ret->num = 0; ret->sorted = 0; ret->comp = NULL; } else { /* direct structure assignment */ *ret = *sk; } if (sk == NULL || sk->num == 0) { /* postpone |ret->data| allocation */ ret->data = NULL; ret->num_alloc = 0; return ret; } /* duplicate |sk->data| content */ ret->data = OPENSSL_malloc(sizeof(*ret->data) * sk->num_alloc); if (ret->data == NULL) goto err; memcpy(ret->data, sk->data, sizeof(void *) * sk->num); return ret; err: OPENSSL_sk_free(ret); return NULL; } OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *sk, OPENSSL_sk_copyfunc copy_func, OPENSSL_sk_freefunc free_func) { OPENSSL_STACK *ret; int i; if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) goto err; if (sk == NULL) { ret->num = 0; ret->sorted = 0; ret->comp = NULL; } else { /* direct structure assignment */ *ret = *sk; } if (sk == NULL || sk->num == 0) { /* postpone |ret| data allocation */ ret->data = NULL; ret->num_alloc = 0; return ret; } ret->num_alloc = sk->num > min_nodes ? sk->num : min_nodes; ret->data = OPENSSL_zalloc(sizeof(*ret->data) * ret->num_alloc); if (ret->data == NULL) goto err; for (i = 0; i < ret->num; ++i) { if (sk->data[i] == NULL) continue; if ((ret->data[i] = copy_func(sk->data[i])) == NULL) { while (--i >= 0) if (ret->data[i] != NULL) free_func((void *)ret->data[i]); goto err; } } return ret; err: OPENSSL_sk_free(ret); return NULL; } OPENSSL_STACK *OPENSSL_sk_new_null(void) { return OPENSSL_sk_new_reserve(NULL, 0); } OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c) { return OPENSSL_sk_new_reserve(c, 0); } /* * Calculate the array growth based on the target size. * * The growth factor is a rational number and is defined by a numerator * and a denominator. According to Andrew Koenig in his paper "Why Are * Vectors Efficient?" from JOOP 11(5) 1998, this factor should be less * than the golden ratio (1.618...). * * Considering only the Fibonacci ratios less than the golden ratio, the * number of steps from the minimum allocation to integer overflow is: * factor decimal growths * 3/2 1.5 51 * 8/5 1.6 45 * 21/13 1.615... 44 * * All larger factors have the same number of growths. * * 3/2 and 8/5 have nice power of two shifts, so seem like a good choice. */ static ossl_inline int compute_growth(int target, int current) { int err = 0; while (current < target) { if (current >= max_nodes) return 0; current = safe_muldiv_int(current, 8, 5, &err); if (err != 0) return 0; if (current >= max_nodes) current = max_nodes; } return current; } /* internal STACK storage allocation */ static int sk_reserve(OPENSSL_STACK *st, int n, int exact) { const void **tmpdata; int num_alloc; /* Check to see the reservation isn't exceeding the hard limit */ if (n > max_nodes - st->num) { ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_RECORDS); return 0; } /* Figure out the new size */ num_alloc = st->num + n; if (num_alloc < min_nodes) num_alloc = min_nodes; /* If |st->data| allocation was postponed */ if (st->data == NULL) { /* * At this point, |st->num_alloc| and |st->num| are 0; * so |num_alloc| value is |n| or |min_nodes| if greater than |n|. */ if ((st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc)) == NULL) return 0; st->num_alloc = num_alloc; return 1; } if (!exact) { if (num_alloc <= st->num_alloc) return 1; num_alloc = compute_growth(num_alloc, st->num_alloc); if (num_alloc == 0) { ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_RECORDS); return 0; } } else if (num_alloc == st->num_alloc) { return 1; } tmpdata = OPENSSL_realloc((void *)st->data, sizeof(void *) * num_alloc); if (tmpdata == NULL) return 0; st->data = tmpdata; st->num_alloc = num_alloc; return 1; } OPENSSL_STACK *OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n) { OPENSSL_STACK *st = OPENSSL_zalloc(sizeof(OPENSSL_STACK)); if (st == NULL) return NULL; st->comp = c; if (n <= 0) return st; if (!sk_reserve(st, n, 1)) { OPENSSL_sk_free(st); return NULL; } return st; } int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n) { if (st == NULL) { ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER); return 0; } if (n < 0) return 1; return sk_reserve(st, n, 1); } int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc) { if (st == NULL) { ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER); return 0; } if (st->num == max_nodes) { ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_RECORDS); return 0; } if (!sk_reserve(st, 1, 0)) return 0; if ((loc >= st->num) || (loc < 0)) { st->data[st->num] = data; } else { memmove(&st->data[loc + 1], &st->data[loc], sizeof(st->data[0]) * (st->num - loc)); st->data[loc] = data; } st->num++; st->sorted = 0; return st->num; } static ossl_inline void *internal_delete(OPENSSL_STACK *st, int loc) { const void *ret = st->data[loc]; if (loc != st->num - 1) memmove(&st->data[loc], &st->data[loc + 1], sizeof(st->data[0]) * (st->num - loc - 1)); st->num--; return (void *)ret; } void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p) { int i; if (st == NULL) return NULL; for (i = 0; i < st->num; i++) if (st->data[i] == p) return internal_delete(st, i); return NULL; } void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc) { if (st == NULL || loc < 0 || loc >= st->num) return NULL; return internal_delete(st, loc); } static int internal_find(OPENSSL_STACK *st, const void *data, int ret_val_options, int *pnum_matched) { const void *r; int i, count = 0; int *pnum = pnum_matched; if (st == NULL || st->num == 0) return -1; if (pnum == NULL) pnum = &count; if (st->comp == NULL) { for (i = 0; i < st->num; i++) if (st->data[i] == data) { *pnum = 1; return i; } *pnum = 0; return -1; } if (data == NULL) return -1; if (!st->sorted) { int res = -1; for (i = 0; i < st->num; i++) if (st->comp(&data, st->data + i) == 0) { if (res == -1) res = i; ++*pnum; /* Check if only one result is wanted and exit if so */ if (pnum_matched == NULL) return i; } if (res == -1) *pnum = 0; return res; } if (pnum_matched != NULL) ret_val_options |= OSSL_BSEARCH_FIRST_VALUE_ON_MATCH; r = ossl_bsearch(&data, st->data, st->num, sizeof(void *), st->comp, ret_val_options); if (pnum_matched != NULL) { *pnum = 0; if (r != NULL) { const void **p = (const void **)r; while (p < st->data + st->num) { if (st->comp(&data, p) != 0) break; ++*pnum; ++p; } } } return r == NULL ? -1 : (int)((const void **)r - st->data); } int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data) { return internal_find(st, data, OSSL_BSEARCH_FIRST_VALUE_ON_MATCH, NULL); } int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data) { return internal_find(st, data, OSSL_BSEARCH_VALUE_ON_NOMATCH, NULL); } int OPENSSL_sk_find_all(OPENSSL_STACK *st, const void *data, int *pnum) { return internal_find(st, data, OSSL_BSEARCH_FIRST_VALUE_ON_MATCH, pnum); } int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data) { if (st == NULL) return 0; return OPENSSL_sk_insert(st, data, st->num); } int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data) { return OPENSSL_sk_insert(st, data, 0); } void *OPENSSL_sk_shift(OPENSSL_STACK *st) { if (st == NULL || st->num == 0) return NULL; return internal_delete(st, 0); } void *OPENSSL_sk_pop(OPENSSL_STACK *st) { if (st == NULL || st->num == 0) return NULL; return internal_delete(st, st->num - 1); } void OPENSSL_sk_zero(OPENSSL_STACK *st) { if (st == NULL || st->num == 0) return; memset(st->data, 0, sizeof(*st->data) * st->num); st->num = 0; } void OPENSSL_sk_pop_free(OPENSSL_STACK *st, OPENSSL_sk_freefunc func) { int i; if (st == NULL) return; for (i = 0; i < st->num; i++) if (st->data[i] != NULL) func((char *)st->data[i]); OPENSSL_sk_free(st); } void OPENSSL_sk_free(OPENSSL_STACK *st) { if (st == NULL) return; OPENSSL_free(st->data); OPENSSL_free(st); } int OPENSSL_sk_num(const OPENSSL_STACK *st) { return st == NULL ? -1 : st->num; } void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) { if (st == NULL || i < 0 || i >= st->num) return NULL; return (void *)st->data[i]; } void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data) { if (st == NULL) { ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } if (i < 0 || i >= st->num) { ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_PASSED_INVALID_ARGUMENT, "i=%d", i); return NULL; } st->data[i] = data; st->sorted = 0; return (void *)st->data[i]; } void OPENSSL_sk_sort(OPENSSL_STACK *st) { if (st != NULL && !st->sorted && st->comp != NULL) { if (st->num > 1) qsort(st->data, st->num, sizeof(void *), st->comp); st->sorted = 1; /* empty or single-element stack is considered sorted */ } } int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st) { return st == NULL ? 1 : st->sorted; }
./openssl/crypto/ripemd/rmd_one.c
/* * Copyright 1995-2020 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 */ /* * RIPEMD160 low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <stdio.h> #include <string.h> #include <openssl/ripemd.h> #include <openssl/crypto.h> unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md) { RIPEMD160_CTX c; static unsigned char m[RIPEMD160_DIGEST_LENGTH]; if (md == NULL) md = m; if (!RIPEMD160_Init(&c)) return NULL; RIPEMD160_Update(&c, d, n); RIPEMD160_Final(md, &c); OPENSSL_cleanse(&c, sizeof(c)); /* security consideration */ return md; }
./openssl/crypto/ripemd/rmdconst.h
/* * Copyright 1995-2016 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 */ #define KL0 0x00000000L #define KL1 0x5A827999L #define KL2 0x6ED9EBA1L #define KL3 0x8F1BBCDCL #define KL4 0xA953FD4EL #define KR0 0x50A28BE6L #define KR1 0x5C4DD124L #define KR2 0x6D703EF3L #define KR3 0x7A6D76E9L #define KR4 0x00000000L #define WL00 0 #define SL00 11 #define WL01 1 #define SL01 14 #define WL02 2 #define SL02 15 #define WL03 3 #define SL03 12 #define WL04 4 #define SL04 5 #define WL05 5 #define SL05 8 #define WL06 6 #define SL06 7 #define WL07 7 #define SL07 9 #define WL08 8 #define SL08 11 #define WL09 9 #define SL09 13 #define WL10 10 #define SL10 14 #define WL11 11 #define SL11 15 #define WL12 12 #define SL12 6 #define WL13 13 #define SL13 7 #define WL14 14 #define SL14 9 #define WL15 15 #define SL15 8 #define WL16 7 #define SL16 7 #define WL17 4 #define SL17 6 #define WL18 13 #define SL18 8 #define WL19 1 #define SL19 13 #define WL20 10 #define SL20 11 #define WL21 6 #define SL21 9 #define WL22 15 #define SL22 7 #define WL23 3 #define SL23 15 #define WL24 12 #define SL24 7 #define WL25 0 #define SL25 12 #define WL26 9 #define SL26 15 #define WL27 5 #define SL27 9 #define WL28 2 #define SL28 11 #define WL29 14 #define SL29 7 #define WL30 11 #define SL30 13 #define WL31 8 #define SL31 12 #define WL32 3 #define SL32 11 #define WL33 10 #define SL33 13 #define WL34 14 #define SL34 6 #define WL35 4 #define SL35 7 #define WL36 9 #define SL36 14 #define WL37 15 #define SL37 9 #define WL38 8 #define SL38 13 #define WL39 1 #define SL39 15 #define WL40 2 #define SL40 14 #define WL41 7 #define SL41 8 #define WL42 0 #define SL42 13 #define WL43 6 #define SL43 6 #define WL44 13 #define SL44 5 #define WL45 11 #define SL45 12 #define WL46 5 #define SL46 7 #define WL47 12 #define SL47 5 #define WL48 1 #define SL48 11 #define WL49 9 #define SL49 12 #define WL50 11 #define SL50 14 #define WL51 10 #define SL51 15 #define WL52 0 #define SL52 14 #define WL53 8 #define SL53 15 #define WL54 12 #define SL54 9 #define WL55 4 #define SL55 8 #define WL56 13 #define SL56 9 #define WL57 3 #define SL57 14 #define WL58 7 #define SL58 5 #define WL59 15 #define SL59 6 #define WL60 14 #define SL60 8 #define WL61 5 #define SL61 6 #define WL62 6 #define SL62 5 #define WL63 2 #define SL63 12 #define WL64 4 #define SL64 9 #define WL65 0 #define SL65 15 #define WL66 5 #define SL66 5 #define WL67 9 #define SL67 11 #define WL68 7 #define SL68 6 #define WL69 12 #define SL69 8 #define WL70 2 #define SL70 13 #define WL71 10 #define SL71 12 #define WL72 14 #define SL72 5 #define WL73 1 #define SL73 12 #define WL74 3 #define SL74 13 #define WL75 8 #define SL75 14 #define WL76 11 #define SL76 11 #define WL77 6 #define SL77 8 #define WL78 15 #define SL78 5 #define WL79 13 #define SL79 6 #define WR00 5 #define SR00 8 #define WR01 14 #define SR01 9 #define WR02 7 #define SR02 9 #define WR03 0 #define SR03 11 #define WR04 9 #define SR04 13 #define WR05 2 #define SR05 15 #define WR06 11 #define SR06 15 #define WR07 4 #define SR07 5 #define WR08 13 #define SR08 7 #define WR09 6 #define SR09 7 #define WR10 15 #define SR10 8 #define WR11 8 #define SR11 11 #define WR12 1 #define SR12 14 #define WR13 10 #define SR13 14 #define WR14 3 #define SR14 12 #define WR15 12 #define SR15 6 #define WR16 6 #define SR16 9 #define WR17 11 #define SR17 13 #define WR18 3 #define SR18 15 #define WR19 7 #define SR19 7 #define WR20 0 #define SR20 12 #define WR21 13 #define SR21 8 #define WR22 5 #define SR22 9 #define WR23 10 #define SR23 11 #define WR24 14 #define SR24 7 #define WR25 15 #define SR25 7 #define WR26 8 #define SR26 12 #define WR27 12 #define SR27 7 #define WR28 4 #define SR28 6 #define WR29 9 #define SR29 15 #define WR30 1 #define SR30 13 #define WR31 2 #define SR31 11 #define WR32 15 #define SR32 9 #define WR33 5 #define SR33 7 #define WR34 1 #define SR34 15 #define WR35 3 #define SR35 11 #define WR36 7 #define SR36 8 #define WR37 14 #define SR37 6 #define WR38 6 #define SR38 6 #define WR39 9 #define SR39 14 #define WR40 11 #define SR40 12 #define WR41 8 #define SR41 13 #define WR42 12 #define SR42 5 #define WR43 2 #define SR43 14 #define WR44 10 #define SR44 13 #define WR45 0 #define SR45 13 #define WR46 4 #define SR46 7 #define WR47 13 #define SR47 5 #define WR48 8 #define SR48 15 #define WR49 6 #define SR49 5 #define WR50 4 #define SR50 8 #define WR51 1 #define SR51 11 #define WR52 3 #define SR52 14 #define WR53 11 #define SR53 14 #define WR54 15 #define SR54 6 #define WR55 0 #define SR55 14 #define WR56 5 #define SR56 6 #define WR57 12 #define SR57 9 #define WR58 2 #define SR58 12 #define WR59 13 #define SR59 9 #define WR60 9 #define SR60 12 #define WR61 7 #define SR61 5 #define WR62 10 #define SR62 15 #define WR63 14 #define SR63 8 #define WR64 12 #define SR64 8 #define WR65 15 #define SR65 5 #define WR66 10 #define SR66 12 #define WR67 4 #define SR67 9 #define WR68 1 #define SR68 12 #define WR69 5 #define SR69 5 #define WR70 8 #define SR70 14 #define WR71 7 #define SR71 6 #define WR72 6 #define SR72 8 #define WR73 2 #define SR73 13 #define WR74 13 #define SR74 6 #define WR75 14 #define SR75 5 #define WR76 0 #define SR76 15 #define WR77 3 #define SR77 13 #define WR78 9 #define SR78 11 #define WR79 11 #define SR79 11
./openssl/crypto/ripemd/rmd_dgst.c
/* * Copyright 1995-2020 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 */ /* * RIPEMD160 low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <stdio.h> #include "rmd_local.h" #include <openssl/opensslv.h> #ifdef RMD160_ASM void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p, size_t num); # define ripemd160_block ripemd160_block_x86 #else void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p, size_t num); #endif int RIPEMD160_Init(RIPEMD160_CTX *c) { memset(c, 0, sizeof(*c)); c->A = RIPEMD160_A; c->B = RIPEMD160_B; c->C = RIPEMD160_C; c->D = RIPEMD160_D; c->E = RIPEMD160_E; return 1; } #ifndef ripemd160_block_data_order # ifdef X # undef X # endif void ripemd160_block_data_order(RIPEMD160_CTX *ctx, const void *p, size_t num) { const unsigned char *data = p; register unsigned MD32_REG_T A, B, C, D, E; unsigned MD32_REG_T a, b, c, d, e, l; # ifndef MD32_XARRAY /* See comment in crypto/sha/sha_local.h for details. */ unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15; # define X(i) XX##i # else RIPEMD160_LONG XX[16]; # define X(i) XX[i] # endif for (; num--;) { A = ctx->A; B = ctx->B; C = ctx->C; D = ctx->D; E = ctx->E; (void)HOST_c2l(data, l); X(0) = l; (void)HOST_c2l(data, l); X(1) = l; RIP1(A, B, C, D, E, WL00, SL00); (void)HOST_c2l(data, l); X(2) = l; RIP1(E, A, B, C, D, WL01, SL01); (void)HOST_c2l(data, l); X(3) = l; RIP1(D, E, A, B, C, WL02, SL02); (void)HOST_c2l(data, l); X(4) = l; RIP1(C, D, E, A, B, WL03, SL03); (void)HOST_c2l(data, l); X(5) = l; RIP1(B, C, D, E, A, WL04, SL04); (void)HOST_c2l(data, l); X(6) = l; RIP1(A, B, C, D, E, WL05, SL05); (void)HOST_c2l(data, l); X(7) = l; RIP1(E, A, B, C, D, WL06, SL06); (void)HOST_c2l(data, l); X(8) = l; RIP1(D, E, A, B, C, WL07, SL07); (void)HOST_c2l(data, l); X(9) = l; RIP1(C, D, E, A, B, WL08, SL08); (void)HOST_c2l(data, l); X(10) = l; RIP1(B, C, D, E, A, WL09, SL09); (void)HOST_c2l(data, l); X(11) = l; RIP1(A, B, C, D, E, WL10, SL10); (void)HOST_c2l(data, l); X(12) = l; RIP1(E, A, B, C, D, WL11, SL11); (void)HOST_c2l(data, l); X(13) = l; RIP1(D, E, A, B, C, WL12, SL12); (void)HOST_c2l(data, l); X(14) = l; RIP1(C, D, E, A, B, WL13, SL13); (void)HOST_c2l(data, l); X(15) = l; RIP1(B, C, D, E, A, WL14, SL14); RIP1(A, B, C, D, E, WL15, SL15); RIP2(E, A, B, C, D, WL16, SL16, KL1); RIP2(D, E, A, B, C, WL17, SL17, KL1); RIP2(C, D, E, A, B, WL18, SL18, KL1); RIP2(B, C, D, E, A, WL19, SL19, KL1); RIP2(A, B, C, D, E, WL20, SL20, KL1); RIP2(E, A, B, C, D, WL21, SL21, KL1); RIP2(D, E, A, B, C, WL22, SL22, KL1); RIP2(C, D, E, A, B, WL23, SL23, KL1); RIP2(B, C, D, E, A, WL24, SL24, KL1); RIP2(A, B, C, D, E, WL25, SL25, KL1); RIP2(E, A, B, C, D, WL26, SL26, KL1); RIP2(D, E, A, B, C, WL27, SL27, KL1); RIP2(C, D, E, A, B, WL28, SL28, KL1); RIP2(B, C, D, E, A, WL29, SL29, KL1); RIP2(A, B, C, D, E, WL30, SL30, KL1); RIP2(E, A, B, C, D, WL31, SL31, KL1); RIP3(D, E, A, B, C, WL32, SL32, KL2); RIP3(C, D, E, A, B, WL33, SL33, KL2); RIP3(B, C, D, E, A, WL34, SL34, KL2); RIP3(A, B, C, D, E, WL35, SL35, KL2); RIP3(E, A, B, C, D, WL36, SL36, KL2); RIP3(D, E, A, B, C, WL37, SL37, KL2); RIP3(C, D, E, A, B, WL38, SL38, KL2); RIP3(B, C, D, E, A, WL39, SL39, KL2); RIP3(A, B, C, D, E, WL40, SL40, KL2); RIP3(E, A, B, C, D, WL41, SL41, KL2); RIP3(D, E, A, B, C, WL42, SL42, KL2); RIP3(C, D, E, A, B, WL43, SL43, KL2); RIP3(B, C, D, E, A, WL44, SL44, KL2); RIP3(A, B, C, D, E, WL45, SL45, KL2); RIP3(E, A, B, C, D, WL46, SL46, KL2); RIP3(D, E, A, B, C, WL47, SL47, KL2); RIP4(C, D, E, A, B, WL48, SL48, KL3); RIP4(B, C, D, E, A, WL49, SL49, KL3); RIP4(A, B, C, D, E, WL50, SL50, KL3); RIP4(E, A, B, C, D, WL51, SL51, KL3); RIP4(D, E, A, B, C, WL52, SL52, KL3); RIP4(C, D, E, A, B, WL53, SL53, KL3); RIP4(B, C, D, E, A, WL54, SL54, KL3); RIP4(A, B, C, D, E, WL55, SL55, KL3); RIP4(E, A, B, C, D, WL56, SL56, KL3); RIP4(D, E, A, B, C, WL57, SL57, KL3); RIP4(C, D, E, A, B, WL58, SL58, KL3); RIP4(B, C, D, E, A, WL59, SL59, KL3); RIP4(A, B, C, D, E, WL60, SL60, KL3); RIP4(E, A, B, C, D, WL61, SL61, KL3); RIP4(D, E, A, B, C, WL62, SL62, KL3); RIP4(C, D, E, A, B, WL63, SL63, KL3); RIP5(B, C, D, E, A, WL64, SL64, KL4); RIP5(A, B, C, D, E, WL65, SL65, KL4); RIP5(E, A, B, C, D, WL66, SL66, KL4); RIP5(D, E, A, B, C, WL67, SL67, KL4); RIP5(C, D, E, A, B, WL68, SL68, KL4); RIP5(B, C, D, E, A, WL69, SL69, KL4); RIP5(A, B, C, D, E, WL70, SL70, KL4); RIP5(E, A, B, C, D, WL71, SL71, KL4); RIP5(D, E, A, B, C, WL72, SL72, KL4); RIP5(C, D, E, A, B, WL73, SL73, KL4); RIP5(B, C, D, E, A, WL74, SL74, KL4); RIP5(A, B, C, D, E, WL75, SL75, KL4); RIP5(E, A, B, C, D, WL76, SL76, KL4); RIP5(D, E, A, B, C, WL77, SL77, KL4); RIP5(C, D, E, A, B, WL78, SL78, KL4); RIP5(B, C, D, E, A, WL79, SL79, KL4); a = A; b = B; c = C; d = D; e = E; /* Do other half */ A = ctx->A; B = ctx->B; C = ctx->C; D = ctx->D; E = ctx->E; RIP5(A, B, C, D, E, WR00, SR00, KR0); RIP5(E, A, B, C, D, WR01, SR01, KR0); RIP5(D, E, A, B, C, WR02, SR02, KR0); RIP5(C, D, E, A, B, WR03, SR03, KR0); RIP5(B, C, D, E, A, WR04, SR04, KR0); RIP5(A, B, C, D, E, WR05, SR05, KR0); RIP5(E, A, B, C, D, WR06, SR06, KR0); RIP5(D, E, A, B, C, WR07, SR07, KR0); RIP5(C, D, E, A, B, WR08, SR08, KR0); RIP5(B, C, D, E, A, WR09, SR09, KR0); RIP5(A, B, C, D, E, WR10, SR10, KR0); RIP5(E, A, B, C, D, WR11, SR11, KR0); RIP5(D, E, A, B, C, WR12, SR12, KR0); RIP5(C, D, E, A, B, WR13, SR13, KR0); RIP5(B, C, D, E, A, WR14, SR14, KR0); RIP5(A, B, C, D, E, WR15, SR15, KR0); RIP4(E, A, B, C, D, WR16, SR16, KR1); RIP4(D, E, A, B, C, WR17, SR17, KR1); RIP4(C, D, E, A, B, WR18, SR18, KR1); RIP4(B, C, D, E, A, WR19, SR19, KR1); RIP4(A, B, C, D, E, WR20, SR20, KR1); RIP4(E, A, B, C, D, WR21, SR21, KR1); RIP4(D, E, A, B, C, WR22, SR22, KR1); RIP4(C, D, E, A, B, WR23, SR23, KR1); RIP4(B, C, D, E, A, WR24, SR24, KR1); RIP4(A, B, C, D, E, WR25, SR25, KR1); RIP4(E, A, B, C, D, WR26, SR26, KR1); RIP4(D, E, A, B, C, WR27, SR27, KR1); RIP4(C, D, E, A, B, WR28, SR28, KR1); RIP4(B, C, D, E, A, WR29, SR29, KR1); RIP4(A, B, C, D, E, WR30, SR30, KR1); RIP4(E, A, B, C, D, WR31, SR31, KR1); RIP3(D, E, A, B, C, WR32, SR32, KR2); RIP3(C, D, E, A, B, WR33, SR33, KR2); RIP3(B, C, D, E, A, WR34, SR34, KR2); RIP3(A, B, C, D, E, WR35, SR35, KR2); RIP3(E, A, B, C, D, WR36, SR36, KR2); RIP3(D, E, A, B, C, WR37, SR37, KR2); RIP3(C, D, E, A, B, WR38, SR38, KR2); RIP3(B, C, D, E, A, WR39, SR39, KR2); RIP3(A, B, C, D, E, WR40, SR40, KR2); RIP3(E, A, B, C, D, WR41, SR41, KR2); RIP3(D, E, A, B, C, WR42, SR42, KR2); RIP3(C, D, E, A, B, WR43, SR43, KR2); RIP3(B, C, D, E, A, WR44, SR44, KR2); RIP3(A, B, C, D, E, WR45, SR45, KR2); RIP3(E, A, B, C, D, WR46, SR46, KR2); RIP3(D, E, A, B, C, WR47, SR47, KR2); RIP2(C, D, E, A, B, WR48, SR48, KR3); RIP2(B, C, D, E, A, WR49, SR49, KR3); RIP2(A, B, C, D, E, WR50, SR50, KR3); RIP2(E, A, B, C, D, WR51, SR51, KR3); RIP2(D, E, A, B, C, WR52, SR52, KR3); RIP2(C, D, E, A, B, WR53, SR53, KR3); RIP2(B, C, D, E, A, WR54, SR54, KR3); RIP2(A, B, C, D, E, WR55, SR55, KR3); RIP2(E, A, B, C, D, WR56, SR56, KR3); RIP2(D, E, A, B, C, WR57, SR57, KR3); RIP2(C, D, E, A, B, WR58, SR58, KR3); RIP2(B, C, D, E, A, WR59, SR59, KR3); RIP2(A, B, C, D, E, WR60, SR60, KR3); RIP2(E, A, B, C, D, WR61, SR61, KR3); RIP2(D, E, A, B, C, WR62, SR62, KR3); RIP2(C, D, E, A, B, WR63, SR63, KR3); RIP1(B, C, D, E, A, WR64, SR64); RIP1(A, B, C, D, E, WR65, SR65); RIP1(E, A, B, C, D, WR66, SR66); RIP1(D, E, A, B, C, WR67, SR67); RIP1(C, D, E, A, B, WR68, SR68); RIP1(B, C, D, E, A, WR69, SR69); RIP1(A, B, C, D, E, WR70, SR70); RIP1(E, A, B, C, D, WR71, SR71); RIP1(D, E, A, B, C, WR72, SR72); RIP1(C, D, E, A, B, WR73, SR73); RIP1(B, C, D, E, A, WR74, SR74); RIP1(A, B, C, D, E, WR75, SR75); RIP1(E, A, B, C, D, WR76, SR76); RIP1(D, E, A, B, C, WR77, SR77); RIP1(C, D, E, A, B, WR78, SR78); RIP1(B, C, D, E, A, WR79, SR79); D = ctx->B + c + D; ctx->B = ctx->C + d + E; ctx->C = ctx->D + e + A; ctx->D = ctx->E + a + B; ctx->E = ctx->A + b + C; ctx->A = D; } } #endif
./openssl/crypto/ripemd/rmd_local.h
/* * Copyright 1995-2016 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 */ #include <stdlib.h> #include <string.h> #include <openssl/opensslconf.h> #include <openssl/ripemd.h> /* * DO EXAMINE COMMENTS IN crypto/md5/md5_local.h & crypto/md5/md5_dgst.c * FOR EXPLANATIONS ON FOLLOWING "CODE." */ #ifdef RMD160_ASM # if defined(__i386) || defined(__i386__) || defined(_M_IX86) # define ripemd160_block_data_order ripemd160_block_asm_data_order # endif #endif void ripemd160_block_data_order(RIPEMD160_CTX *c, const void *p, size_t num); #define DATA_ORDER_IS_LITTLE_ENDIAN #define HASH_LONG RIPEMD160_LONG #define HASH_CTX RIPEMD160_CTX #define HASH_CBLOCK RIPEMD160_CBLOCK #define HASH_UPDATE RIPEMD160_Update #define HASH_TRANSFORM RIPEMD160_Transform #define HASH_FINAL RIPEMD160_Final #define HASH_MAKE_STRING(c,s) do { \ unsigned long ll; \ ll=(c)->A; (void)HOST_l2c(ll,(s)); \ ll=(c)->B; (void)HOST_l2c(ll,(s)); \ ll=(c)->C; (void)HOST_l2c(ll,(s)); \ ll=(c)->D; (void)HOST_l2c(ll,(s)); \ ll=(c)->E; (void)HOST_l2c(ll,(s)); \ } while (0) #define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order #include "crypto/md32_common.h" /* * Transformed F2 and F4 are courtesy of Wei Dai */ #define F1(x,y,z) ((x) ^ (y) ^ (z)) #define F2(x,y,z) ((((y) ^ (z)) & (x)) ^ (z)) #define F3(x,y,z) (((~(y)) | (x)) ^ (z)) #define F4(x,y,z) ((((x) ^ (y)) & (z)) ^ (y)) #define F5(x,y,z) (((~(z)) | (y)) ^ (x)) #define RIPEMD160_A 0x67452301L #define RIPEMD160_B 0xEFCDAB89L #define RIPEMD160_C 0x98BADCFEL #define RIPEMD160_D 0x10325476L #define RIPEMD160_E 0xC3D2E1F0L #include "rmdconst.h" #define RIP1(a,b,c,d,e,w,s) { \ a+=F1(b,c,d)+X(w); \ a=ROTATE(a,s)+e; \ c=ROTATE(c,10); } #define RIP2(a,b,c,d,e,w,s,K) { \ a+=F2(b,c,d)+X(w)+K; \ a=ROTATE(a,s)+e; \ c=ROTATE(c,10); } #define RIP3(a,b,c,d,e,w,s,K) { \ a+=F3(b,c,d)+X(w)+K; \ a=ROTATE(a,s)+e; \ c=ROTATE(c,10); } #define RIP4(a,b,c,d,e,w,s,K) { \ a+=F4(b,c,d)+X(w)+K; \ a=ROTATE(a,s)+e; \ c=ROTATE(c,10); } #define RIP5(a,b,c,d,e,w,s,K) { \ a+=F5(b,c,d)+X(w)+K; \ a=ROTATE(a,s)+e; \ c=ROTATE(c,10); }
./openssl/crypto/sha/sha3.c
/* * Copyright 2017-2020 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 */ #include <string.h> #include "internal/sha3.h" void SHA3_squeeze(uint64_t A[5][5], unsigned char *out, size_t len, size_t r, int next); void ossl_sha3_reset(KECCAK1600_CTX *ctx) { memset(ctx->A, 0, sizeof(ctx->A)); ctx->bufsz = 0; ctx->xof_state = XOF_STATE_INIT; } int ossl_sha3_init(KECCAK1600_CTX *ctx, unsigned char pad, size_t bitlen) { size_t bsz = SHA3_BLOCKSIZE(bitlen); if (bsz <= sizeof(ctx->buf)) { ossl_sha3_reset(ctx); ctx->block_size = bsz; ctx->md_size = bitlen / 8; ctx->pad = pad; return 1; } return 0; } int ossl_keccak_kmac_init(KECCAK1600_CTX *ctx, unsigned char pad, size_t bitlen) { int ret = ossl_sha3_init(ctx, pad, bitlen); if (ret) ctx->md_size *= 2; return ret; } int ossl_sha3_update(KECCAK1600_CTX *ctx, const void *_inp, size_t len) { const unsigned char *inp = _inp; size_t bsz = ctx->block_size; size_t num, rem; if (len == 0) return 1; if (ctx->xof_state == XOF_STATE_SQUEEZE || ctx->xof_state == XOF_STATE_FINAL) return 0; if ((num = ctx->bufsz) != 0) { /* process intermediate buffer? */ rem = bsz - num; if (len < rem) { memcpy(ctx->buf + num, inp, len); ctx->bufsz += len; return 1; } /* * We have enough data to fill or overflow the intermediate * buffer. So we append |rem| bytes and process the block, * leaving the rest for later processing... */ memcpy(ctx->buf + num, inp, rem); inp += rem, len -= rem; (void)SHA3_absorb(ctx->A, ctx->buf, bsz, bsz); ctx->bufsz = 0; /* ctx->buf is processed, ctx->num is guaranteed to be zero */ } if (len >= bsz) rem = SHA3_absorb(ctx->A, inp, len, bsz); else rem = len; if (rem) { memcpy(ctx->buf, inp + len - rem, rem); ctx->bufsz = rem; } return 1; } /* * ossl_sha3_final()is a single shot method * (Use ossl_sha3_squeeze for multiple calls). * outlen is the variable size output. */ int ossl_sha3_final(KECCAK1600_CTX *ctx, unsigned char *out, size_t outlen) { size_t bsz = ctx->block_size; size_t num = ctx->bufsz; if (outlen == 0) return 1; if (ctx->xof_state == XOF_STATE_SQUEEZE || ctx->xof_state == XOF_STATE_FINAL) return 0; /* * Pad the data with 10*1. Note that |num| can be |bsz - 1| * in which case both byte operations below are performed on * same byte... */ memset(ctx->buf + num, 0, bsz - num); ctx->buf[num] = ctx->pad; ctx->buf[bsz - 1] |= 0x80; (void)SHA3_absorb(ctx->A, ctx->buf, bsz, bsz); ctx->xof_state = XOF_STATE_FINAL; SHA3_squeeze(ctx->A, out, outlen, bsz, 0); return 1; } /* * This method can be called multiple times. * Rather than heavily modifying assembler for SHA3_squeeze(), * we instead just use the limitations of the existing function. * i.e. Only request multiples of the ctx->block_size when calling * SHA3_squeeze(). For output length requests smaller than the * ctx->block_size just request a single ctx->block_size bytes and * buffer the results. The next request will use the buffer first * to grab output bytes. */ int ossl_sha3_squeeze(KECCAK1600_CTX *ctx, unsigned char *out, size_t outlen) { size_t bsz = ctx->block_size; size_t num = ctx->bufsz; size_t len; int next = 1; if (outlen == 0) return 1; if (ctx->xof_state == XOF_STATE_FINAL) return 0; /* * On the first squeeze call, finish the absorb process, * by adding the trailing padding and then doing * a final absorb. */ if (ctx->xof_state != XOF_STATE_SQUEEZE) { /* * Pad the data with 10*1. Note that |num| can be |bsz - 1| * in which case both byte operations below are performed on * same byte... */ memset(ctx->buf + num, 0, bsz - num); ctx->buf[num] = ctx->pad; ctx->buf[bsz - 1] |= 0x80; (void)SHA3_absorb(ctx->A, ctx->buf, bsz, bsz); ctx->xof_state = XOF_STATE_SQUEEZE; num = ctx->bufsz = 0; next = 0; } /* * Step 1. Consume any bytes left over from a previous squeeze * (See Step 4 below). */ if (num != 0) { if (outlen > ctx->bufsz) len = ctx->bufsz; else len = outlen; memcpy(out, ctx->buf + bsz - ctx->bufsz, len); out += len; outlen -= len; ctx->bufsz -= len; } if (outlen == 0) return 1; /* Step 2. Copy full sized squeezed blocks to the output buffer directly */ if (outlen >= bsz) { len = bsz * (outlen / bsz); SHA3_squeeze(ctx->A, out, len, bsz, next); next = 1; out += len; outlen -= len; } if (outlen > 0) { /* Step 3. Squeeze one more block into a buffer */ SHA3_squeeze(ctx->A, ctx->buf, bsz, bsz, next); memcpy(out, ctx->buf, outlen); /* Step 4. Remember the leftover part of the squeezed block */ ctx->bufsz = bsz - outlen; } return 1; }
./openssl/crypto/sha/sha_local.h
/* * Copyright 1995-2020 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 */ #include <stdlib.h> #include <string.h> #include <openssl/opensslconf.h> #include <openssl/sha.h> #include "internal/endian.h" #define DATA_ORDER_IS_BIG_ENDIAN #define HASH_LONG SHA_LONG #define HASH_CTX SHA_CTX #define HASH_CBLOCK SHA_CBLOCK #define HASH_MAKE_STRING(c,s) do { \ unsigned long ll; \ ll=(c)->h0; (void)HOST_l2c(ll,(s)); \ ll=(c)->h1; (void)HOST_l2c(ll,(s)); \ ll=(c)->h2; (void)HOST_l2c(ll,(s)); \ ll=(c)->h3; (void)HOST_l2c(ll,(s)); \ ll=(c)->h4; (void)HOST_l2c(ll,(s)); \ } while (0) #define HASH_UPDATE SHA1_Update #define HASH_TRANSFORM SHA1_Transform #define HASH_FINAL SHA1_Final #define HASH_INIT SHA1_Init #define HASH_BLOCK_DATA_ORDER sha1_block_data_order #define Xupdate(a,ix,ia,ib,ic,id) ( (a)=(ia^ib^ic^id), \ ix=(a)=ROTATE((a),1) \ ) #ifndef SHA1_ASM static void sha1_block_data_order(SHA_CTX *c, const void *p, size_t num); #else void sha1_block_data_order(SHA_CTX *c, const void *p, size_t num); #endif #include "crypto/md32_common.h" #define INIT_DATA_h0 0x67452301UL #define INIT_DATA_h1 0xefcdab89UL #define INIT_DATA_h2 0x98badcfeUL #define INIT_DATA_h3 0x10325476UL #define INIT_DATA_h4 0xc3d2e1f0UL int HASH_INIT(SHA_CTX *c) { memset(c, 0, sizeof(*c)); c->h0 = INIT_DATA_h0; c->h1 = INIT_DATA_h1; c->h2 = INIT_DATA_h2; c->h3 = INIT_DATA_h3; c->h4 = INIT_DATA_h4; return 1; } #define K_00_19 0x5a827999UL #define K_20_39 0x6ed9eba1UL #define K_40_59 0x8f1bbcdcUL #define K_60_79 0xca62c1d6UL /* * As pointed out by Wei Dai, F() below can be simplified to the code in * F_00_19. Wei attributes these optimizations to Peter Gutmann's SHS code, * and he attributes it to Rich Schroeppel. * #define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) * I've just become aware of another tweak to be made, again from Wei Dai, * in F_40_59, (x&a)|(y&a) -> (x|y)&a */ #define F_00_19(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) #define F_20_39(b,c,d) ((b) ^ (c) ^ (d)) #define F_40_59(b,c,d) (((b) & (c)) | (((b)|(c)) & (d))) #define F_60_79(b,c,d) F_20_39(b,c,d) #ifndef OPENSSL_SMALL_FOOTPRINT # define BODY_00_15(i,a,b,c,d,e,f,xi) \ (f)=xi+(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ (b)=ROTATE((b),30); # define BODY_16_19(i,a,b,c,d,e,f,xi,xa,xb,xc,xd) \ Xupdate(f,xi,xa,xb,xc,xd); \ (f)+=(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ (b)=ROTATE((b),30); # define BODY_20_31(i,a,b,c,d,e,f,xi,xa,xb,xc,xd) \ Xupdate(f,xi,xa,xb,xc,xd); \ (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ (b)=ROTATE((b),30); # define BODY_32_39(i,a,b,c,d,e,f,xa,xb,xc,xd) \ Xupdate(f,xa,xa,xb,xc,xd); \ (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ (b)=ROTATE((b),30); # define BODY_40_59(i,a,b,c,d,e,f,xa,xb,xc,xd) \ Xupdate(f,xa,xa,xb,xc,xd); \ (f)+=(e)+K_40_59+ROTATE((a),5)+F_40_59((b),(c),(d)); \ (b)=ROTATE((b),30); # define BODY_60_79(i,a,b,c,d,e,f,xa,xb,xc,xd) \ Xupdate(f,xa,xa,xb,xc,xd); \ (f)=xa+(e)+K_60_79+ROTATE((a),5)+F_60_79((b),(c),(d)); \ (b)=ROTATE((b),30); # ifdef X # undef X # endif # ifndef MD32_XARRAY /* * Originally X was an array. As it's automatic it's natural * to expect RISC compiler to accommodate at least part of it in * the register bank, isn't it? Unfortunately not all compilers * "find" this expectation reasonable:-( On order to make such * compilers generate better code I replace X[] with a bunch of * X0, X1, etc. See the function body below... */ # define X(i) XX##i # else /* * However! Some compilers (most notably HP C) get overwhelmed by * that many local variables so that we have to have the way to * fall down to the original behavior. */ # define X(i) XX[i] # endif # if !defined(SHA1_ASM) static void HASH_BLOCK_DATA_ORDER(SHA_CTX *c, const void *p, size_t num) { const unsigned char *data = p; register unsigned MD32_REG_T A, B, C, D, E, T, l; # ifndef MD32_XARRAY unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15; # else SHA_LONG XX[16]; # endif A = c->h0; B = c->h1; C = c->h2; D = c->h3; E = c->h4; for (;;) { DECLARE_IS_ENDIAN; if (!IS_LITTLE_ENDIAN && sizeof(SHA_LONG) == 4 && ((size_t)p % 4) == 0) { const SHA_LONG *W = (const SHA_LONG *)data; X(0) = W[0]; X(1) = W[1]; BODY_00_15(0, A, B, C, D, E, T, X(0)); X(2) = W[2]; BODY_00_15(1, T, A, B, C, D, E, X(1)); X(3) = W[3]; BODY_00_15(2, E, T, A, B, C, D, X(2)); X(4) = W[4]; BODY_00_15(3, D, E, T, A, B, C, X(3)); X(5) = W[5]; BODY_00_15(4, C, D, E, T, A, B, X(4)); X(6) = W[6]; BODY_00_15(5, B, C, D, E, T, A, X(5)); X(7) = W[7]; BODY_00_15(6, A, B, C, D, E, T, X(6)); X(8) = W[8]; BODY_00_15(7, T, A, B, C, D, E, X(7)); X(9) = W[9]; BODY_00_15(8, E, T, A, B, C, D, X(8)); X(10) = W[10]; BODY_00_15(9, D, E, T, A, B, C, X(9)); X(11) = W[11]; BODY_00_15(10, C, D, E, T, A, B, X(10)); X(12) = W[12]; BODY_00_15(11, B, C, D, E, T, A, X(11)); X(13) = W[13]; BODY_00_15(12, A, B, C, D, E, T, X(12)); X(14) = W[14]; BODY_00_15(13, T, A, B, C, D, E, X(13)); X(15) = W[15]; BODY_00_15(14, E, T, A, B, C, D, X(14)); BODY_00_15(15, D, E, T, A, B, C, X(15)); data += SHA_CBLOCK; } else { (void)HOST_c2l(data, l); X(0) = l; (void)HOST_c2l(data, l); X(1) = l; BODY_00_15(0, A, B, C, D, E, T, X(0)); (void)HOST_c2l(data, l); X(2) = l; BODY_00_15(1, T, A, B, C, D, E, X(1)); (void)HOST_c2l(data, l); X(3) = l; BODY_00_15(2, E, T, A, B, C, D, X(2)); (void)HOST_c2l(data, l); X(4) = l; BODY_00_15(3, D, E, T, A, B, C, X(3)); (void)HOST_c2l(data, l); X(5) = l; BODY_00_15(4, C, D, E, T, A, B, X(4)); (void)HOST_c2l(data, l); X(6) = l; BODY_00_15(5, B, C, D, E, T, A, X(5)); (void)HOST_c2l(data, l); X(7) = l; BODY_00_15(6, A, B, C, D, E, T, X(6)); (void)HOST_c2l(data, l); X(8) = l; BODY_00_15(7, T, A, B, C, D, E, X(7)); (void)HOST_c2l(data, l); X(9) = l; BODY_00_15(8, E, T, A, B, C, D, X(8)); (void)HOST_c2l(data, l); X(10) = l; BODY_00_15(9, D, E, T, A, B, C, X(9)); (void)HOST_c2l(data, l); X(11) = l; BODY_00_15(10, C, D, E, T, A, B, X(10)); (void)HOST_c2l(data, l); X(12) = l; BODY_00_15(11, B, C, D, E, T, A, X(11)); (void)HOST_c2l(data, l); X(13) = l; BODY_00_15(12, A, B, C, D, E, T, X(12)); (void)HOST_c2l(data, l); X(14) = l; BODY_00_15(13, T, A, B, C, D, E, X(13)); (void)HOST_c2l(data, l); X(15) = l; BODY_00_15(14, E, T, A, B, C, D, X(14)); BODY_00_15(15, D, E, T, A, B, C, X(15)); } BODY_16_19(16, C, D, E, T, A, B, X(0), X(0), X(2), X(8), X(13)); BODY_16_19(17, B, C, D, E, T, A, X(1), X(1), X(3), X(9), X(14)); BODY_16_19(18, A, B, C, D, E, T, X(2), X(2), X(4), X(10), X(15)); BODY_16_19(19, T, A, B, C, D, E, X(3), X(3), X(5), X(11), X(0)); BODY_20_31(20, E, T, A, B, C, D, X(4), X(4), X(6), X(12), X(1)); BODY_20_31(21, D, E, T, A, B, C, X(5), X(5), X(7), X(13), X(2)); BODY_20_31(22, C, D, E, T, A, B, X(6), X(6), X(8), X(14), X(3)); BODY_20_31(23, B, C, D, E, T, A, X(7), X(7), X(9), X(15), X(4)); BODY_20_31(24, A, B, C, D, E, T, X(8), X(8), X(10), X(0), X(5)); BODY_20_31(25, T, A, B, C, D, E, X(9), X(9), X(11), X(1), X(6)); BODY_20_31(26, E, T, A, B, C, D, X(10), X(10), X(12), X(2), X(7)); BODY_20_31(27, D, E, T, A, B, C, X(11), X(11), X(13), X(3), X(8)); BODY_20_31(28, C, D, E, T, A, B, X(12), X(12), X(14), X(4), X(9)); BODY_20_31(29, B, C, D, E, T, A, X(13), X(13), X(15), X(5), X(10)); BODY_20_31(30, A, B, C, D, E, T, X(14), X(14), X(0), X(6), X(11)); BODY_20_31(31, T, A, B, C, D, E, X(15), X(15), X(1), X(7), X(12)); BODY_32_39(32, E, T, A, B, C, D, X(0), X(2), X(8), X(13)); BODY_32_39(33, D, E, T, A, B, C, X(1), X(3), X(9), X(14)); BODY_32_39(34, C, D, E, T, A, B, X(2), X(4), X(10), X(15)); BODY_32_39(35, B, C, D, E, T, A, X(3), X(5), X(11), X(0)); BODY_32_39(36, A, B, C, D, E, T, X(4), X(6), X(12), X(1)); BODY_32_39(37, T, A, B, C, D, E, X(5), X(7), X(13), X(2)); BODY_32_39(38, E, T, A, B, C, D, X(6), X(8), X(14), X(3)); BODY_32_39(39, D, E, T, A, B, C, X(7), X(9), X(15), X(4)); BODY_40_59(40, C, D, E, T, A, B, X(8), X(10), X(0), X(5)); BODY_40_59(41, B, C, D, E, T, A, X(9), X(11), X(1), X(6)); BODY_40_59(42, A, B, C, D, E, T, X(10), X(12), X(2), X(7)); BODY_40_59(43, T, A, B, C, D, E, X(11), X(13), X(3), X(8)); BODY_40_59(44, E, T, A, B, C, D, X(12), X(14), X(4), X(9)); BODY_40_59(45, D, E, T, A, B, C, X(13), X(15), X(5), X(10)); BODY_40_59(46, C, D, E, T, A, B, X(14), X(0), X(6), X(11)); BODY_40_59(47, B, C, D, E, T, A, X(15), X(1), X(7), X(12)); BODY_40_59(48, A, B, C, D, E, T, X(0), X(2), X(8), X(13)); BODY_40_59(49, T, A, B, C, D, E, X(1), X(3), X(9), X(14)); BODY_40_59(50, E, T, A, B, C, D, X(2), X(4), X(10), X(15)); BODY_40_59(51, D, E, T, A, B, C, X(3), X(5), X(11), X(0)); BODY_40_59(52, C, D, E, T, A, B, X(4), X(6), X(12), X(1)); BODY_40_59(53, B, C, D, E, T, A, X(5), X(7), X(13), X(2)); BODY_40_59(54, A, B, C, D, E, T, X(6), X(8), X(14), X(3)); BODY_40_59(55, T, A, B, C, D, E, X(7), X(9), X(15), X(4)); BODY_40_59(56, E, T, A, B, C, D, X(8), X(10), X(0), X(5)); BODY_40_59(57, D, E, T, A, B, C, X(9), X(11), X(1), X(6)); BODY_40_59(58, C, D, E, T, A, B, X(10), X(12), X(2), X(7)); BODY_40_59(59, B, C, D, E, T, A, X(11), X(13), X(3), X(8)); BODY_60_79(60, A, B, C, D, E, T, X(12), X(14), X(4), X(9)); BODY_60_79(61, T, A, B, C, D, E, X(13), X(15), X(5), X(10)); BODY_60_79(62, E, T, A, B, C, D, X(14), X(0), X(6), X(11)); BODY_60_79(63, D, E, T, A, B, C, X(15), X(1), X(7), X(12)); BODY_60_79(64, C, D, E, T, A, B, X(0), X(2), X(8), X(13)); BODY_60_79(65, B, C, D, E, T, A, X(1), X(3), X(9), X(14)); BODY_60_79(66, A, B, C, D, E, T, X(2), X(4), X(10), X(15)); BODY_60_79(67, T, A, B, C, D, E, X(3), X(5), X(11), X(0)); BODY_60_79(68, E, T, A, B, C, D, X(4), X(6), X(12), X(1)); BODY_60_79(69, D, E, T, A, B, C, X(5), X(7), X(13), X(2)); BODY_60_79(70, C, D, E, T, A, B, X(6), X(8), X(14), X(3)); BODY_60_79(71, B, C, D, E, T, A, X(7), X(9), X(15), X(4)); BODY_60_79(72, A, B, C, D, E, T, X(8), X(10), X(0), X(5)); BODY_60_79(73, T, A, B, C, D, E, X(9), X(11), X(1), X(6)); BODY_60_79(74, E, T, A, B, C, D, X(10), X(12), X(2), X(7)); BODY_60_79(75, D, E, T, A, B, C, X(11), X(13), X(3), X(8)); BODY_60_79(76, C, D, E, T, A, B, X(12), X(14), X(4), X(9)); BODY_60_79(77, B, C, D, E, T, A, X(13), X(15), X(5), X(10)); BODY_60_79(78, A, B, C, D, E, T, X(14), X(0), X(6), X(11)); BODY_60_79(79, T, A, B, C, D, E, X(15), X(1), X(7), X(12)); c->h0 = (c->h0 + E) & 0xffffffffL; c->h1 = (c->h1 + T) & 0xffffffffL; c->h2 = (c->h2 + A) & 0xffffffffL; c->h3 = (c->h3 + B) & 0xffffffffL; c->h4 = (c->h4 + C) & 0xffffffffL; if (--num == 0) break; A = c->h0; B = c->h1; C = c->h2; D = c->h3; E = c->h4; } } # endif #else /* OPENSSL_SMALL_FOOTPRINT */ # define BODY_00_15(xi) do { \ T=E+K_00_19+F_00_19(B,C,D); \ E=D, D=C, C=ROTATE(B,30), B=A; \ A=ROTATE(A,5)+T+xi; } while(0) # define BODY_16_19(xa,xb,xc,xd) do { \ Xupdate(T,xa,xa,xb,xc,xd); \ T+=E+K_00_19+F_00_19(B,C,D); \ E=D, D=C, C=ROTATE(B,30), B=A; \ A=ROTATE(A,5)+T; } while(0) # define BODY_20_39(xa,xb,xc,xd) do { \ Xupdate(T,xa,xa,xb,xc,xd); \ T+=E+K_20_39+F_20_39(B,C,D); \ E=D, D=C, C=ROTATE(B,30), B=A; \ A=ROTATE(A,5)+T; } while(0) # define BODY_40_59(xa,xb,xc,xd) do { \ Xupdate(T,xa,xa,xb,xc,xd); \ T+=E+K_40_59+F_40_59(B,C,D); \ E=D, D=C, C=ROTATE(B,30), B=A; \ A=ROTATE(A,5)+T; } while(0) # define BODY_60_79(xa,xb,xc,xd) do { \ Xupdate(T,xa,xa,xb,xc,xd); \ T=E+K_60_79+F_60_79(B,C,D); \ E=D, D=C, C=ROTATE(B,30), B=A; \ A=ROTATE(A,5)+T+xa; } while(0) # if !defined(SHA1_ASM) static void HASH_BLOCK_DATA_ORDER(SHA_CTX *c, const void *p, size_t num) { const unsigned char *data = p; register unsigned MD32_REG_T A, B, C, D, E, T, l; int i; SHA_LONG X[16]; A = c->h0; B = c->h1; C = c->h2; D = c->h3; E = c->h4; for (;;) { for (i = 0; i < 16; i++) { (void)HOST_c2l(data, l); X[i] = l; BODY_00_15(X[i]); } for (i = 0; i < 4; i++) { BODY_16_19(X[i], X[i + 2], X[i + 8], X[(i + 13) & 15]); } for (; i < 24; i++) { BODY_20_39(X[i & 15], X[(i + 2) & 15], X[(i + 8) & 15], X[(i + 13) & 15]); } for (i = 0; i < 20; i++) { BODY_40_59(X[(i + 8) & 15], X[(i + 10) & 15], X[i & 15], X[(i + 5) & 15]); } for (i = 4; i < 24; i++) { BODY_60_79(X[(i + 8) & 15], X[(i + 10) & 15], X[i & 15], X[(i + 5) & 15]); } c->h0 = (c->h0 + A) & 0xffffffffL; c->h1 = (c->h1 + B) & 0xffffffffL; c->h2 = (c->h2 + C) & 0xffffffffL; c->h3 = (c->h3 + D) & 0xffffffffL; c->h4 = (c->h4 + E) & 0xffffffffL; if (--num == 0) break; A = c->h0; B = c->h1; C = c->h2; D = c->h3; E = c->h4; } } # endif #endif
./openssl/crypto/sha/sha512.c
/* * Copyright 2004-2022 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 */ /* * SHA512 low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <stdio.h> #include <openssl/opensslconf.h> /*- * IMPLEMENTATION NOTES. * * As you might have noticed 32-bit hash algorithms: * * - permit SHA_LONG to be wider than 32-bit * - optimized versions implement two transform functions: one operating * on [aligned] data in host byte order and one - on data in input * stream byte order; * - share common byte-order neutral collector and padding function * implementations, crypto/md32_common.h; * * Neither of the above applies to this SHA-512 implementations. Reasons * [in reverse order] are: * * - it's the only 64-bit hash algorithm for the moment of this writing, * there is no need for common collector/padding implementation [yet]; * - by supporting only one transform function [which operates on * *aligned* data in input stream byte order, big-endian in this case] * we minimize burden of maintenance in two ways: a) collector/padding * function is simpler; b) only one transform function to stare at; * - SHA_LONG64 is required to be exactly 64-bit in order to be able to * apply a number of optimizations to mitigate potential performance * penalties caused by previous design decision; * * Caveat lector. * * Implementation relies on the fact that "long long" is 64-bit on * both 32- and 64-bit platforms. If some compiler vendor comes up * with 128-bit long long, adjustment to sha.h would be required. * As this implementation relies on 64-bit integer type, it's totally * inappropriate for platforms which don't support it, most notably * 16-bit platforms. */ #include <stdlib.h> #include <string.h> #include <openssl/crypto.h> #include <openssl/sha.h> #include <openssl/opensslv.h> #include "internal/cryptlib.h" #include "crypto/sha.h" #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ defined(__x86_64) || defined(_M_AMD64) || defined(_M_X64) || \ defined(__s390__) || defined(__s390x__) || \ defined(__aarch64__) || \ defined(SHA512_ASM) # define SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA #endif #if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) # define U64(C) C##UI64 #elif defined(__arch64__) # define U64(C) C##UL #else # define U64(C) C##ULL #endif int sha512_224_init(SHA512_CTX *c) { c->h[0] = U64(0x8c3d37c819544da2); c->h[1] = U64(0x73e1996689dcd4d6); c->h[2] = U64(0x1dfab7ae32ff9c82); c->h[3] = U64(0x679dd514582f9fcf); c->h[4] = U64(0x0f6d2b697bd44da8); c->h[5] = U64(0x77e36f7304c48942); c->h[6] = U64(0x3f9d85a86a1d36c8); c->h[7] = U64(0x1112e6ad91d692a1); c->Nl = 0; c->Nh = 0; c->num = 0; c->md_len = SHA224_DIGEST_LENGTH; return 1; } int sha512_256_init(SHA512_CTX *c) { c->h[0] = U64(0x22312194fc2bf72c); c->h[1] = U64(0x9f555fa3c84c64c2); c->h[2] = U64(0x2393b86b6f53b151); c->h[3] = U64(0x963877195940eabd); c->h[4] = U64(0x96283ee2a88effe3); c->h[5] = U64(0xbe5e1e2553863992); c->h[6] = U64(0x2b0199fc2c85b8aa); c->h[7] = U64(0x0eb72ddc81c52ca2); c->Nl = 0; c->Nh = 0; c->num = 0; c->md_len = SHA256_DIGEST_LENGTH; return 1; } int SHA384_Init(SHA512_CTX *c) { c->h[0] = U64(0xcbbb9d5dc1059ed8); c->h[1] = U64(0x629a292a367cd507); c->h[2] = U64(0x9159015a3070dd17); c->h[3] = U64(0x152fecd8f70e5939); c->h[4] = U64(0x67332667ffc00b31); c->h[5] = U64(0x8eb44a8768581511); c->h[6] = U64(0xdb0c2e0d64f98fa7); c->h[7] = U64(0x47b5481dbefa4fa4); c->Nl = 0; c->Nh = 0; c->num = 0; c->md_len = SHA384_DIGEST_LENGTH; return 1; } int SHA512_Init(SHA512_CTX *c) { c->h[0] = U64(0x6a09e667f3bcc908); c->h[1] = U64(0xbb67ae8584caa73b); c->h[2] = U64(0x3c6ef372fe94f82b); c->h[3] = U64(0xa54ff53a5f1d36f1); c->h[4] = U64(0x510e527fade682d1); c->h[5] = U64(0x9b05688c2b3e6c1f); c->h[6] = U64(0x1f83d9abfb41bd6b); c->h[7] = U64(0x5be0cd19137e2179); c->Nl = 0; c->Nh = 0; c->num = 0; c->md_len = SHA512_DIGEST_LENGTH; return 1; } #ifndef SHA512_ASM static #else # ifdef INCLUDE_C_SHA512 void sha512_block_data_order_c(SHA512_CTX *ctx, const void *in, size_t num); # endif #endif void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num); int SHA512_Final(unsigned char *md, SHA512_CTX *c) { unsigned char *p = (unsigned char *)c->u.p; size_t n = c->num; p[n] = 0x80; /* There always is a room for one */ n++; if (n > (sizeof(c->u) - 16)) { memset(p + n, 0, sizeof(c->u) - n); n = 0; sha512_block_data_order(c, p, 1); } memset(p + n, 0, sizeof(c->u) - 16 - n); #ifdef B_ENDIAN c->u.d[SHA_LBLOCK - 2] = c->Nh; c->u.d[SHA_LBLOCK - 1] = c->Nl; #else p[sizeof(c->u) - 1] = (unsigned char)(c->Nl); p[sizeof(c->u) - 2] = (unsigned char)(c->Nl >> 8); p[sizeof(c->u) - 3] = (unsigned char)(c->Nl >> 16); p[sizeof(c->u) - 4] = (unsigned char)(c->Nl >> 24); p[sizeof(c->u) - 5] = (unsigned char)(c->Nl >> 32); p[sizeof(c->u) - 6] = (unsigned char)(c->Nl >> 40); p[sizeof(c->u) - 7] = (unsigned char)(c->Nl >> 48); p[sizeof(c->u) - 8] = (unsigned char)(c->Nl >> 56); p[sizeof(c->u) - 9] = (unsigned char)(c->Nh); p[sizeof(c->u) - 10] = (unsigned char)(c->Nh >> 8); p[sizeof(c->u) - 11] = (unsigned char)(c->Nh >> 16); p[sizeof(c->u) - 12] = (unsigned char)(c->Nh >> 24); p[sizeof(c->u) - 13] = (unsigned char)(c->Nh >> 32); p[sizeof(c->u) - 14] = (unsigned char)(c->Nh >> 40); p[sizeof(c->u) - 15] = (unsigned char)(c->Nh >> 48); p[sizeof(c->u) - 16] = (unsigned char)(c->Nh >> 56); #endif sha512_block_data_order(c, p, 1); if (md == 0) return 0; switch (c->md_len) { /* Let compiler decide if it's appropriate to unroll... */ case SHA224_DIGEST_LENGTH: for (n = 0; n < SHA224_DIGEST_LENGTH / 8; n++) { SHA_LONG64 t = c->h[n]; *(md++) = (unsigned char)(t >> 56); *(md++) = (unsigned char)(t >> 48); *(md++) = (unsigned char)(t >> 40); *(md++) = (unsigned char)(t >> 32); *(md++) = (unsigned char)(t >> 24); *(md++) = (unsigned char)(t >> 16); *(md++) = (unsigned char)(t >> 8); *(md++) = (unsigned char)(t); } /* * For 224 bits, there are four bytes left over that have to be * processed separately. */ { SHA_LONG64 t = c->h[SHA224_DIGEST_LENGTH / 8]; *(md++) = (unsigned char)(t >> 56); *(md++) = (unsigned char)(t >> 48); *(md++) = (unsigned char)(t >> 40); *(md++) = (unsigned char)(t >> 32); } break; case SHA256_DIGEST_LENGTH: for (n = 0; n < SHA256_DIGEST_LENGTH / 8; n++) { SHA_LONG64 t = c->h[n]; *(md++) = (unsigned char)(t >> 56); *(md++) = (unsigned char)(t >> 48); *(md++) = (unsigned char)(t >> 40); *(md++) = (unsigned char)(t >> 32); *(md++) = (unsigned char)(t >> 24); *(md++) = (unsigned char)(t >> 16); *(md++) = (unsigned char)(t >> 8); *(md++) = (unsigned char)(t); } break; case SHA384_DIGEST_LENGTH: for (n = 0; n < SHA384_DIGEST_LENGTH / 8; n++) { SHA_LONG64 t = c->h[n]; *(md++) = (unsigned char)(t >> 56); *(md++) = (unsigned char)(t >> 48); *(md++) = (unsigned char)(t >> 40); *(md++) = (unsigned char)(t >> 32); *(md++) = (unsigned char)(t >> 24); *(md++) = (unsigned char)(t >> 16); *(md++) = (unsigned char)(t >> 8); *(md++) = (unsigned char)(t); } break; case SHA512_DIGEST_LENGTH: for (n = 0; n < SHA512_DIGEST_LENGTH / 8; n++) { SHA_LONG64 t = c->h[n]; *(md++) = (unsigned char)(t >> 56); *(md++) = (unsigned char)(t >> 48); *(md++) = (unsigned char)(t >> 40); *(md++) = (unsigned char)(t >> 32); *(md++) = (unsigned char)(t >> 24); *(md++) = (unsigned char)(t >> 16); *(md++) = (unsigned char)(t >> 8); *(md++) = (unsigned char)(t); } break; /* ... as well as make sure md_len is not abused. */ default: return 0; } return 1; } int SHA384_Final(unsigned char *md, SHA512_CTX *c) { return SHA512_Final(md, c); } int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) { SHA_LONG64 l; unsigned char *p = c->u.p; const unsigned char *data = (const unsigned char *)_data; if (len == 0) return 1; l = (c->Nl + (((SHA_LONG64) len) << 3)) & U64(0xffffffffffffffff); if (l < c->Nl) c->Nh++; if (sizeof(len) >= 8) c->Nh += (((SHA_LONG64) len) >> 61); c->Nl = l; if (c->num != 0) { size_t n = sizeof(c->u) - c->num; if (len < n) { memcpy(p + c->num, data, len), c->num += (unsigned int)len; return 1; } else { memcpy(p + c->num, data, n), c->num = 0; len -= n, data += n; sha512_block_data_order(c, p, 1); } } if (len >= sizeof(c->u)) { #ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA if ((size_t)data % sizeof(c->u.d[0]) != 0) while (len >= sizeof(c->u)) memcpy(p, data, sizeof(c->u)), sha512_block_data_order(c, p, 1), len -= sizeof(c->u), data += sizeof(c->u); else #endif sha512_block_data_order(c, data, len / sizeof(c->u)), data += len, len %= sizeof(c->u), data -= len; } if (len != 0) memcpy(p, data, len), c->num = (int)len; return 1; } int SHA384_Update(SHA512_CTX *c, const void *data, size_t len) { return SHA512_Update(c, data, len); } void SHA512_Transform(SHA512_CTX *c, const unsigned char *data) { #ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA if ((size_t)data % sizeof(c->u.d[0]) != 0) memcpy(c->u.p, data, sizeof(c->u.p)), data = c->u.p; #endif sha512_block_data_order(c, data, 1); } #if !defined(SHA512_ASM) || defined(INCLUDE_C_SHA512) static const SHA_LONG64 K512[80] = { U64(0x428a2f98d728ae22), U64(0x7137449123ef65cd), U64(0xb5c0fbcfec4d3b2f), U64(0xe9b5dba58189dbbc), U64(0x3956c25bf348b538), U64(0x59f111f1b605d019), U64(0x923f82a4af194f9b), U64(0xab1c5ed5da6d8118), U64(0xd807aa98a3030242), U64(0x12835b0145706fbe), U64(0x243185be4ee4b28c), U64(0x550c7dc3d5ffb4e2), U64(0x72be5d74f27b896f), U64(0x80deb1fe3b1696b1), U64(0x9bdc06a725c71235), U64(0xc19bf174cf692694), U64(0xe49b69c19ef14ad2), U64(0xefbe4786384f25e3), U64(0x0fc19dc68b8cd5b5), U64(0x240ca1cc77ac9c65), U64(0x2de92c6f592b0275), U64(0x4a7484aa6ea6e483), U64(0x5cb0a9dcbd41fbd4), U64(0x76f988da831153b5), U64(0x983e5152ee66dfab), U64(0xa831c66d2db43210), U64(0xb00327c898fb213f), U64(0xbf597fc7beef0ee4), U64(0xc6e00bf33da88fc2), U64(0xd5a79147930aa725), U64(0x06ca6351e003826f), U64(0x142929670a0e6e70), U64(0x27b70a8546d22ffc), U64(0x2e1b21385c26c926), U64(0x4d2c6dfc5ac42aed), U64(0x53380d139d95b3df), U64(0x650a73548baf63de), U64(0x766a0abb3c77b2a8), U64(0x81c2c92e47edaee6), U64(0x92722c851482353b), U64(0xa2bfe8a14cf10364), U64(0xa81a664bbc423001), U64(0xc24b8b70d0f89791), U64(0xc76c51a30654be30), U64(0xd192e819d6ef5218), U64(0xd69906245565a910), U64(0xf40e35855771202a), U64(0x106aa07032bbd1b8), U64(0x19a4c116b8d2d0c8), U64(0x1e376c085141ab53), U64(0x2748774cdf8eeb99), U64(0x34b0bcb5e19b48a8), U64(0x391c0cb3c5c95a63), U64(0x4ed8aa4ae3418acb), U64(0x5b9cca4f7763e373), U64(0x682e6ff3d6b2b8a3), U64(0x748f82ee5defb2fc), U64(0x78a5636f43172f60), U64(0x84c87814a1f0ab72), U64(0x8cc702081a6439ec), U64(0x90befffa23631e28), U64(0xa4506cebde82bde9), U64(0xbef9a3f7b2c67915), U64(0xc67178f2e372532b), U64(0xca273eceea26619c), U64(0xd186b8c721c0c207), U64(0xeada7dd6cde0eb1e), U64(0xf57d4f7fee6ed178), U64(0x06f067aa72176fba), U64(0x0a637dc5a2c898a6), U64(0x113f9804bef90dae), U64(0x1b710b35131c471b), U64(0x28db77f523047d84), U64(0x32caab7b40c72493), U64(0x3c9ebe0a15c9bebc), U64(0x431d67c49c100d4c), U64(0x4cc5d4becb3e42b6), U64(0x597f299cfc657e2a), U64(0x5fcb6fab3ad6faec), U64(0x6c44198c4a475817) }; # ifndef PEDANTIC # if defined(__GNUC__) && __GNUC__>=2 && \ !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) # if defined(__x86_64) || defined(__x86_64__) # define ROTR(a,n) ({ SHA_LONG64 ret; \ asm ("rorq %1,%0" \ : "=r"(ret) \ : "J"(n),"0"(a) \ : "cc"); ret; }) # if !defined(B_ENDIAN) # define PULL64(x) ({ SHA_LONG64 ret=*((const SHA_LONG64 *)(&(x))); \ asm ("bswapq %0" \ : "=r"(ret) \ : "0"(ret)); ret; }) # endif # elif (defined(__i386) || defined(__i386__)) && !defined(B_ENDIAN) # if defined(I386_ONLY) # define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ unsigned int hi=p[0],lo=p[1]; \ asm("xchgb %%ah,%%al;xchgb %%dh,%%dl;"\ "roll $16,%%eax; roll $16,%%edx; "\ "xchgb %%ah,%%al;xchgb %%dh,%%dl;"\ : "=a"(lo),"=d"(hi) \ : "0"(lo),"1"(hi) : "cc"); \ ((SHA_LONG64)hi)<<32|lo; }) # else # define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ unsigned int hi=p[0],lo=p[1]; \ asm ("bswapl %0; bswapl %1;" \ : "=r"(lo),"=r"(hi) \ : "0"(lo),"1"(hi)); \ ((SHA_LONG64)hi)<<32|lo; }) # endif # elif (defined(_ARCH_PPC) && defined(__64BIT__)) || defined(_ARCH_PPC64) # define ROTR(a,n) ({ SHA_LONG64 ret; \ asm ("rotrdi %0,%1,%2" \ : "=r"(ret) \ : "r"(a),"K"(n)); ret; }) # elif defined(__aarch64__) # define ROTR(a,n) ({ SHA_LONG64 ret; \ asm ("ror %0,%1,%2" \ : "=r"(ret) \ : "r"(a),"I"(n)); ret; }) # if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__ # define PULL64(x) ({ SHA_LONG64 ret; \ asm ("rev %0,%1" \ : "=r"(ret) \ : "r"(*((const SHA_LONG64 *)(&(x))))); ret; }) # endif # elif (defined(__riscv_zbkb) || defined(__riscv_zbb)) && __riscv_xlen == 32 # define PULL64(x) ({ SHA_LONG64 ret; \ unsigned int *r = (unsigned int *)(&(ret)); \ const unsigned int *p = (const unsigned int *)(&(x)); \ asm ("rev8 %0, %1" \ : "=r"(r[0]) \ : "r" (p[1])); \ asm ("rev8 %0, %1" \ : "=r"(r[1]) \ : "r" (p[0])); ret; }) # elif (defined(__riscv_zbkb) || defined(__riscv_zbb)) && __riscv_xlen == 64 # define PULL64(x) ({ SHA_LONG64 ret; \ asm ("rev8 %0, %1" \ : "=r"(ret) \ : "r"(x)); ret; }) # endif # if defined(__riscv_zknh) && __riscv_xlen == 32 # define Sigma0(x) ({ SHA_LONG64 ret; unsigned int *r = (unsigned int *)(&(ret)); \ const unsigned int *p = (const unsigned int *)(&(x)); \ asm ("sha512sum0r %0, %1, %2" \ : "=r"(r[0]) \ : "r" (p[0]), "r" (p[1])); \ asm ("sha512sum0r %0, %2, %1" \ : "=r"(r[1]) \ : "r" (p[0]), "r" (p[1])); ret; }) # define Sigma1(x) ({ SHA_LONG64 ret; unsigned int *r = (unsigned int *)(&(ret)); \ const unsigned int *p = (const unsigned int *)(&(x)); \ asm ("sha512sum1r %0, %1, %2" \ : "=r"(r[0]) \ : "r" (p[0]), "r" (p[1])); \ asm ("sha512sum1r %0, %2, %1" \ : "=r"(r[1]) \ : "r" (p[0]), "r" (p[1])); ret; }) # define sigma0(x) ({ SHA_LONG64 ret; unsigned int *r = (unsigned int *)(&(ret)); \ const unsigned int *p = (const unsigned int *)(&(x)); \ asm ("sha512sig0l %0, %1, %2" \ : "=r"(r[0]) \ : "r" (p[0]), "r" (p[1])); \ asm ("sha512sig0h %0, %2, %1" \ : "=r"(r[1]) \ : "r" (p[0]), "r" (p[1])); ret; }) # define sigma1(x) ({ SHA_LONG64 ret; unsigned int *r = (unsigned int *)(&(ret)); \ const unsigned int *p = (const unsigned int *)(&(x)); \ asm ("sha512sig1l %0, %1, %2" \ : "=r"(r[0]) \ : "r" (p[0]), "r" (p[1])); \ asm ("sha512sig1h %0, %2, %1" \ : "=r"(r[1]) \ : "r" (p[0]), "r" (p[1])); ret; }) # elif defined(__riscv_zknh) && __riscv_xlen == 64 # define Sigma0(x) ({ SHA_LONG64 ret; \ asm ("sha512sum0 %0, %1" \ : "=r"(ret) \ : "r"(x)); ret; }) # define Sigma1(x) ({ SHA_LONG64 ret; \ asm ("sha512sum1 %0, %1" \ : "=r"(ret) \ : "r"(x)); ret; }) # define sigma0(x) ({ SHA_LONG64 ret; \ asm ("sha512sig0 %0, %1" \ : "=r"(ret) \ : "r"(x)); ret; }) # define sigma1(x) ({ SHA_LONG64 ret; \ asm ("sha512sig1 %0, %1" \ : "=r"(ret) \ : "r"(x)); ret; }) # endif # if (defined(__riscv_zbt) || defined(__riscv_zpn)) && __riscv_xlen == 32 # define Ch(x,y,z) ({ SHA_LONG64 ret; unsigned int *r = (unsigned int *)(&(ret)); \ const unsigned int *xp = (const unsigned int *)(&(x)); \ const unsigned int *yp = (const unsigned int *)(&(y)); \ const unsigned int *zp = (const unsigned int *)(&(z)); \ asm (".insn r4 0x33, 1, 0x3, %0, %2, %1, %3\n\t" \ : "=r"(r[0]) \ : "r"(xp[0]), "r"(yp[0]), "r"(zp[0])); \ asm (".insn r4 0x33, 1, 0x3, %0, %2, %1, %3\n\t" \ : "=r"(r[1]) \ : "r"(xp[1]), "r"(yp[1]), "r"(zp[1])); ret; }) # define Maj(x,y,z) ({ SHA_LONG64 ret; unsigned int *r = (unsigned int *)(&(ret)); \ const unsigned int *xp = (const unsigned int *)(&(x)); \ const unsigned int *yp = (const unsigned int *)(&(y)); \ const unsigned int *zp = (const unsigned int *)(&(z)); \ asm (".insn r4 0x33, 1, 0x3, %0, %2, %1, %3\n\t" \ : "=r"(r[0]) \ : "r"(xp[0]^zp[0]), "r"(yp[0]), "r"(zp[0])); \ asm (".insn r4 0x33, 1, 0x3, %0, %2, %1, %3\n\t" \ : "=r"(r[1]) \ : "r"(xp[1]^zp[1]), "r"(yp[1]), "r"(zp[1])); ret; }) # elif (defined(__riscv_zbt) || defined(__riscv_zpn)) && __riscv_xlen == 64 # define Ch(x,y,z) ({ SHA_LONG64 ret; \ asm (".insn r4 0x33, 1, 0x3, %0, %2, %1, %3"\ : "=r"(ret) \ : "r"(x), "r"(y), "r"(z)); ret; }) # define Maj(x,y,z) ({ SHA_LONG64 ret; \ asm (".insn r4 0x33, 1, 0x3, %0, %2, %1, %3"\ : "=r"(ret) \ : "r"(x^z), "r"(y), "r"(x)); ret; }) # endif # elif defined(_MSC_VER) # if defined(_WIN64) /* applies to both IA-64 and AMD64 */ # pragma intrinsic(_rotr64) # define ROTR(a,n) _rotr64((a),n) # endif # if defined(_M_IX86) && !defined(OPENSSL_NO_ASM) && \ !defined(OPENSSL_NO_INLINE_ASM) # if defined(I386_ONLY) static SHA_LONG64 __fastcall __pull64be(const void *x) { _asm mov edx,[ecx + 0] _asm mov eax,[ecx + 4] _asm xchg dh, dl _asm xchg ah, al _asm rol edx, 16 _asm rol eax, 16 _asm xchg dh, dl _asm xchg ah, al } # else static SHA_LONG64 __fastcall __pull64be(const void *x) { _asm mov edx,[ecx + 0] _asm mov eax,[ecx + 4] _asm bswap edx _asm bswap eax } # endif # define PULL64(x) __pull64be(&(x)) # endif # endif # endif # ifndef PULL64 # define B(x,j) (((SHA_LONG64)(*(((const unsigned char *)(&x))+j)))<<((7-j)*8)) # define PULL64(x) (B(x,0)|B(x,1)|B(x,2)|B(x,3)|B(x,4)|B(x,5)|B(x,6)|B(x,7)) # endif # ifndef ROTR # define ROTR(x,s) (((x)>>s) | (x)<<(64-s)) # endif # ifndef Sigma0 # define Sigma0(x) (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39)) # endif # ifndef Sigma1 # define Sigma1(x) (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41)) # endif # ifndef sigma0 # define sigma0(x) (ROTR((x),1) ^ ROTR((x),8) ^ ((x)>>7)) # endif # ifndef sigma1 # define sigma1(x) (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6)) # endif # ifndef Ch # define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) # endif # ifndef Maj # define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) # endif # if defined(__i386) || defined(__i386__) || defined(_M_IX86) /* * This code should give better results on 32-bit CPU with less than * ~24 registers, both size and performance wise... */ static void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num) { const SHA_LONG64 *W = in; SHA_LONG64 A, E, T; SHA_LONG64 X[9 + 80], *F; int i; while (num--) { F = X + 80; A = ctx->h[0]; F[1] = ctx->h[1]; F[2] = ctx->h[2]; F[3] = ctx->h[3]; E = ctx->h[4]; F[5] = ctx->h[5]; F[6] = ctx->h[6]; F[7] = ctx->h[7]; for (i = 0; i < 16; i++, F--) { # ifdef B_ENDIAN T = W[i]; # else T = PULL64(W[i]); # endif F[0] = A; F[4] = E; F[8] = T; T += F[7] + Sigma1(E) + Ch(E, F[5], F[6]) + K512[i]; E = F[3] + T; A = T + Sigma0(A) + Maj(A, F[1], F[2]); } for (; i < 80; i++, F--) { T = sigma0(F[8 + 16 - 1]); T += sigma1(F[8 + 16 - 14]); T += F[8 + 16] + F[8 + 16 - 9]; F[0] = A; F[4] = E; F[8] = T; T += F[7] + Sigma1(E) + Ch(E, F[5], F[6]) + K512[i]; E = F[3] + T; A = T + Sigma0(A) + Maj(A, F[1], F[2]); } ctx->h[0] += A; ctx->h[1] += F[1]; ctx->h[2] += F[2]; ctx->h[3] += F[3]; ctx->h[4] += E; ctx->h[5] += F[5]; ctx->h[6] += F[6]; ctx->h[7] += F[7]; W += SHA_LBLOCK; } } # elif defined(OPENSSL_SMALL_FOOTPRINT) static void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num) { const SHA_LONG64 *W = in; SHA_LONG64 a, b, c, d, e, f, g, h, s0, s1, T1, T2; SHA_LONG64 X[16]; int i; while (num--) { a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; for (i = 0; i < 16; i++) { # ifdef B_ENDIAN T1 = X[i] = W[i]; # else T1 = X[i] = PULL64(W[i]); # endif T1 += h + Sigma1(e) + Ch(e, f, g) + K512[i]; T2 = Sigma0(a) + Maj(a, b, c); h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; } for (; i < 80; i++) { s0 = X[(i + 1) & 0x0f]; s0 = sigma0(s0); s1 = X[(i + 14) & 0x0f]; s1 = sigma1(s1); T1 = X[i & 0xf] += s0 + s1 + X[(i + 9) & 0xf]; T1 += h + Sigma1(e) + Ch(e, f, g) + K512[i]; T2 = Sigma0(a) + Maj(a, b, c); h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; } ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d; ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h; W += SHA_LBLOCK; } } # else # define ROUND_00_15(i,a,b,c,d,e,f,g,h) do { \ T1 += h + Sigma1(e) + Ch(e,f,g) + K512[i]; \ h = Sigma0(a) + Maj(a,b,c); \ d += T1; h += T1; } while (0) # define ROUND_16_80(i,j,a,b,c,d,e,f,g,h,X) do { \ s0 = X[(j+1)&0x0f]; s0 = sigma0(s0); \ s1 = X[(j+14)&0x0f]; s1 = sigma1(s1); \ T1 = X[(j)&0x0f] += s0 + s1 + X[(j+9)&0x0f]; \ ROUND_00_15(i+j,a,b,c,d,e,f,g,h); } while (0) #ifdef INCLUDE_C_SHA512 void sha512_block_data_order_c(SHA512_CTX *ctx, const void *in, size_t num) #else static void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num) #endif { const SHA_LONG64 *W = in; SHA_LONG64 a, b, c, d, e, f, g, h, s0, s1, T1; SHA_LONG64 X[16]; int i; while (num--) { a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; # ifdef B_ENDIAN T1 = X[0] = W[0]; ROUND_00_15(0, a, b, c, d, e, f, g, h); T1 = X[1] = W[1]; ROUND_00_15(1, h, a, b, c, d, e, f, g); T1 = X[2] = W[2]; ROUND_00_15(2, g, h, a, b, c, d, e, f); T1 = X[3] = W[3]; ROUND_00_15(3, f, g, h, a, b, c, d, e); T1 = X[4] = W[4]; ROUND_00_15(4, e, f, g, h, a, b, c, d); T1 = X[5] = W[5]; ROUND_00_15(5, d, e, f, g, h, a, b, c); T1 = X[6] = W[6]; ROUND_00_15(6, c, d, e, f, g, h, a, b); T1 = X[7] = W[7]; ROUND_00_15(7, b, c, d, e, f, g, h, a); T1 = X[8] = W[8]; ROUND_00_15(8, a, b, c, d, e, f, g, h); T1 = X[9] = W[9]; ROUND_00_15(9, h, a, b, c, d, e, f, g); T1 = X[10] = W[10]; ROUND_00_15(10, g, h, a, b, c, d, e, f); T1 = X[11] = W[11]; ROUND_00_15(11, f, g, h, a, b, c, d, e); T1 = X[12] = W[12]; ROUND_00_15(12, e, f, g, h, a, b, c, d); T1 = X[13] = W[13]; ROUND_00_15(13, d, e, f, g, h, a, b, c); T1 = X[14] = W[14]; ROUND_00_15(14, c, d, e, f, g, h, a, b); T1 = X[15] = W[15]; ROUND_00_15(15, b, c, d, e, f, g, h, a); # else T1 = X[0] = PULL64(W[0]); ROUND_00_15(0, a, b, c, d, e, f, g, h); T1 = X[1] = PULL64(W[1]); ROUND_00_15(1, h, a, b, c, d, e, f, g); T1 = X[2] = PULL64(W[2]); ROUND_00_15(2, g, h, a, b, c, d, e, f); T1 = X[3] = PULL64(W[3]); ROUND_00_15(3, f, g, h, a, b, c, d, e); T1 = X[4] = PULL64(W[4]); ROUND_00_15(4, e, f, g, h, a, b, c, d); T1 = X[5] = PULL64(W[5]); ROUND_00_15(5, d, e, f, g, h, a, b, c); T1 = X[6] = PULL64(W[6]); ROUND_00_15(6, c, d, e, f, g, h, a, b); T1 = X[7] = PULL64(W[7]); ROUND_00_15(7, b, c, d, e, f, g, h, a); T1 = X[8] = PULL64(W[8]); ROUND_00_15(8, a, b, c, d, e, f, g, h); T1 = X[9] = PULL64(W[9]); ROUND_00_15(9, h, a, b, c, d, e, f, g); T1 = X[10] = PULL64(W[10]); ROUND_00_15(10, g, h, a, b, c, d, e, f); T1 = X[11] = PULL64(W[11]); ROUND_00_15(11, f, g, h, a, b, c, d, e); T1 = X[12] = PULL64(W[12]); ROUND_00_15(12, e, f, g, h, a, b, c, d); T1 = X[13] = PULL64(W[13]); ROUND_00_15(13, d, e, f, g, h, a, b, c); T1 = X[14] = PULL64(W[14]); ROUND_00_15(14, c, d, e, f, g, h, a, b); T1 = X[15] = PULL64(W[15]); ROUND_00_15(15, b, c, d, e, f, g, h, a); # endif for (i = 16; i < 80; i += 16) { ROUND_16_80(i, 0, a, b, c, d, e, f, g, h, X); ROUND_16_80(i, 1, h, a, b, c, d, e, f, g, X); ROUND_16_80(i, 2, g, h, a, b, c, d, e, f, X); ROUND_16_80(i, 3, f, g, h, a, b, c, d, e, X); ROUND_16_80(i, 4, e, f, g, h, a, b, c, d, X); ROUND_16_80(i, 5, d, e, f, g, h, a, b, c, X); ROUND_16_80(i, 6, c, d, e, f, g, h, a, b, X); ROUND_16_80(i, 7, b, c, d, e, f, g, h, a, X); ROUND_16_80(i, 8, a, b, c, d, e, f, g, h, X); ROUND_16_80(i, 9, h, a, b, c, d, e, f, g, X); ROUND_16_80(i, 10, g, h, a, b, c, d, e, f, X); ROUND_16_80(i, 11, f, g, h, a, b, c, d, e, X); ROUND_16_80(i, 12, e, f, g, h, a, b, c, d, X); ROUND_16_80(i, 13, d, e, f, g, h, a, b, c, X); ROUND_16_80(i, 14, c, d, e, f, g, h, a, b, X); ROUND_16_80(i, 15, b, c, d, e, f, g, h, a, X); } ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d; ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h; W += SHA_LBLOCK; } } # endif #endif /* SHA512_ASM */
./openssl/crypto/sha/sha_riscv.c
/* * Copyright 2023 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 */ #include <stdlib.h> #include <string.h> #include <openssl/opensslconf.h> #include <openssl/sha.h> #include "crypto/riscv_arch.h" void sha256_block_data_order_zvkb_zvknha_or_zvknhb(void *ctx, const void *in, size_t num); void sha256_block_data_order_c(void *ctx, const void *in, size_t num); void sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num); void sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num) { if (RISCV_HAS_ZVKB() && (RISCV_HAS_ZVKNHA() || RISCV_HAS_ZVKNHB()) && riscv_vlen() >= 128) { sha256_block_data_order_zvkb_zvknha_or_zvknhb(ctx, in, num); } else { sha256_block_data_order_c(ctx, in, num); } } void sha512_block_data_order_zvkb_zvknhb(void *ctx, const void *in, size_t num); void sha512_block_data_order_c(void *ctx, const void *in, size_t num); void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num); void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num) { if (RISCV_HAS_ZVKB_AND_ZVKNHB() && riscv_vlen() >= 128) { sha512_block_data_order_zvkb_zvknhb(ctx, in, num); } else { sha512_block_data_order_c(ctx, in, num); } }
./openssl/crypto/sha/keccak1600.c
/* * Copyright 2016-2023 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 */ #include <openssl/e_os2.h> #include <string.h> #include <assert.h> size_t SHA3_absorb(uint64_t A[5][5], const unsigned char *inp, size_t len, size_t r); void SHA3_squeeze(uint64_t A[5][5], unsigned char *out, size_t len, size_t r, int next); #if !defined(KECCAK1600_ASM) || !defined(SELFTEST) /* * Choose some sensible defaults */ #if !defined(KECCAK_REF) && !defined(KECCAK_1X) && !defined(KECCAK_1X_ALT) && \ !defined(KECCAK_2X) && !defined(KECCAK_INPLACE) # define KECCAK_2X /* default to KECCAK_2X variant */ #endif #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ (defined(__x86_64) && !defined(__BMI__)) || defined(_M_X64) || \ defined(__mips) || defined(__riscv) || defined(__s390__) || \ defined(__EMSCRIPTEN__) /* * These don't have "and with complement" instruction, so minimize amount * of "not"-s. Implemented only in the [default] KECCAK_2X variant. */ # define KECCAK_COMPLEMENTING_TRANSFORM #endif #if defined(__x86_64__) || defined(__aarch64__) || \ defined(__mips64) || defined(__ia64) || \ (defined(__VMS) && !defined(__vax)) /* * These are available even in ILP32 flavours, but even then they are * capable of performing 64-bit operations as efficiently as in *P64. * Since it's not given that we can use sizeof(void *), just shunt it. */ # define BIT_INTERLEAVE (0) #else # define BIT_INTERLEAVE (sizeof(void *) < 8) #endif #define ROL32(a, offset) (((a) << (offset)) | ((a) >> ((32 - (offset)) & 31))) static uint64_t ROL64(uint64_t val, int offset) { if (offset == 0) { return val; } else if (!BIT_INTERLEAVE) { return (val << offset) | (val >> (64-offset)); } else { uint32_t hi = (uint32_t)(val >> 32), lo = (uint32_t)val; if (offset & 1) { uint32_t tmp = hi; offset >>= 1; hi = ROL32(lo, offset); lo = ROL32(tmp, offset + 1); } else { offset >>= 1; lo = ROL32(lo, offset); hi = ROL32(hi, offset); } return ((uint64_t)hi << 32) | lo; } } static const unsigned char rhotates[5][5] = { { 0, 1, 62, 28, 27 }, { 36, 44, 6, 55, 20 }, { 3, 10, 43, 25, 39 }, { 41, 45, 15, 21, 8 }, { 18, 2, 61, 56, 14 } }; static const uint64_t iotas[] = { BIT_INTERLEAVE ? 0x0000000000000001ULL : 0x0000000000000001ULL, BIT_INTERLEAVE ? 0x0000008900000000ULL : 0x0000000000008082ULL, BIT_INTERLEAVE ? 0x8000008b00000000ULL : 0x800000000000808aULL, BIT_INTERLEAVE ? 0x8000808000000000ULL : 0x8000000080008000ULL, BIT_INTERLEAVE ? 0x0000008b00000001ULL : 0x000000000000808bULL, BIT_INTERLEAVE ? 0x0000800000000001ULL : 0x0000000080000001ULL, BIT_INTERLEAVE ? 0x8000808800000001ULL : 0x8000000080008081ULL, BIT_INTERLEAVE ? 0x8000008200000001ULL : 0x8000000000008009ULL, BIT_INTERLEAVE ? 0x0000000b00000000ULL : 0x000000000000008aULL, BIT_INTERLEAVE ? 0x0000000a00000000ULL : 0x0000000000000088ULL, BIT_INTERLEAVE ? 0x0000808200000001ULL : 0x0000000080008009ULL, BIT_INTERLEAVE ? 0x0000800300000000ULL : 0x000000008000000aULL, BIT_INTERLEAVE ? 0x0000808b00000001ULL : 0x000000008000808bULL, BIT_INTERLEAVE ? 0x8000000b00000001ULL : 0x800000000000008bULL, BIT_INTERLEAVE ? 0x8000008a00000001ULL : 0x8000000000008089ULL, BIT_INTERLEAVE ? 0x8000008100000001ULL : 0x8000000000008003ULL, BIT_INTERLEAVE ? 0x8000008100000000ULL : 0x8000000000008002ULL, BIT_INTERLEAVE ? 0x8000000800000000ULL : 0x8000000000000080ULL, BIT_INTERLEAVE ? 0x0000008300000000ULL : 0x000000000000800aULL, BIT_INTERLEAVE ? 0x8000800300000000ULL : 0x800000008000000aULL, BIT_INTERLEAVE ? 0x8000808800000001ULL : 0x8000000080008081ULL, BIT_INTERLEAVE ? 0x8000008800000000ULL : 0x8000000000008080ULL, BIT_INTERLEAVE ? 0x0000800000000001ULL : 0x0000000080000001ULL, BIT_INTERLEAVE ? 0x8000808200000000ULL : 0x8000000080008008ULL }; #if defined(KECCAK_REF) /* * This is straightforward or "maximum clarity" implementation aiming * to resemble section 3.2 of the FIPS PUB 202 "SHA-3 Standard: * Permutation-Based Hash and Extendible-Output Functions" as much as * possible. With one caveat. Because of the way C stores matrices, * references to A[x,y] in the specification are presented as A[y][x]. * Implementation unrolls inner x-loops so that modulo 5 operations are * explicitly pre-computed. */ static void Theta(uint64_t A[5][5]) { uint64_t C[5], D[5]; size_t y; C[0] = A[0][0]; C[1] = A[0][1]; C[2] = A[0][2]; C[3] = A[0][3]; C[4] = A[0][4]; for (y = 1; y < 5; y++) { C[0] ^= A[y][0]; C[1] ^= A[y][1]; C[2] ^= A[y][2]; C[3] ^= A[y][3]; C[4] ^= A[y][4]; } D[0] = ROL64(C[1], 1) ^ C[4]; D[1] = ROL64(C[2], 1) ^ C[0]; D[2] = ROL64(C[3], 1) ^ C[1]; D[3] = ROL64(C[4], 1) ^ C[2]; D[4] = ROL64(C[0], 1) ^ C[3]; for (y = 0; y < 5; y++) { A[y][0] ^= D[0]; A[y][1] ^= D[1]; A[y][2] ^= D[2]; A[y][3] ^= D[3]; A[y][4] ^= D[4]; } } static void Rho(uint64_t A[5][5]) { size_t y; for (y = 0; y < 5; y++) { A[y][0] = ROL64(A[y][0], rhotates[y][0]); A[y][1] = ROL64(A[y][1], rhotates[y][1]); A[y][2] = ROL64(A[y][2], rhotates[y][2]); A[y][3] = ROL64(A[y][3], rhotates[y][3]); A[y][4] = ROL64(A[y][4], rhotates[y][4]); } } static void Pi(uint64_t A[5][5]) { uint64_t T[5][5]; /* * T = A * A[y][x] = T[x][(3*y+x)%5] */ memcpy(T, A, sizeof(T)); A[0][0] = T[0][0]; A[0][1] = T[1][1]; A[0][2] = T[2][2]; A[0][3] = T[3][3]; A[0][4] = T[4][4]; A[1][0] = T[0][3]; A[1][1] = T[1][4]; A[1][2] = T[2][0]; A[1][3] = T[3][1]; A[1][4] = T[4][2]; A[2][0] = T[0][1]; A[2][1] = T[1][2]; A[2][2] = T[2][3]; A[2][3] = T[3][4]; A[2][4] = T[4][0]; A[3][0] = T[0][4]; A[3][1] = T[1][0]; A[3][2] = T[2][1]; A[3][3] = T[3][2]; A[3][4] = T[4][3]; A[4][0] = T[0][2]; A[4][1] = T[1][3]; A[4][2] = T[2][4]; A[4][3] = T[3][0]; A[4][4] = T[4][1]; } static void Chi(uint64_t A[5][5]) { uint64_t C[5]; size_t y; for (y = 0; y < 5; y++) { C[0] = A[y][0] ^ (~A[y][1] & A[y][2]); C[1] = A[y][1] ^ (~A[y][2] & A[y][3]); C[2] = A[y][2] ^ (~A[y][3] & A[y][4]); C[3] = A[y][3] ^ (~A[y][4] & A[y][0]); C[4] = A[y][4] ^ (~A[y][0] & A[y][1]); A[y][0] = C[0]; A[y][1] = C[1]; A[y][2] = C[2]; A[y][3] = C[3]; A[y][4] = C[4]; } } static void Iota(uint64_t A[5][5], size_t i) { assert(i < (sizeof(iotas) / sizeof(iotas[0]))); A[0][0] ^= iotas[i]; } static void KeccakF1600(uint64_t A[5][5]) { size_t i; for (i = 0; i < 24; i++) { Theta(A); Rho(A); Pi(A); Chi(A); Iota(A, i); } } #elif defined(KECCAK_1X) /* * This implementation is optimization of above code featuring unroll * of even y-loops, their fusion and code motion. It also minimizes * temporary storage. Compiler would normally do all these things for * you, purpose of manual optimization is to provide "unobscured" * reference for assembly implementation [in case this approach is * chosen for implementation on some platform]. In the nutshell it's * equivalent of "plane-per-plane processing" approach discussed in * section 2.4 of "Keccak implementation overview". */ static void Round(uint64_t A[5][5], size_t i) { uint64_t C[5], E[2]; /* registers */ uint64_t D[5], T[2][5]; /* memory */ assert(i < (sizeof(iotas) / sizeof(iotas[0]))); C[0] = A[0][0] ^ A[1][0] ^ A[2][0] ^ A[3][0] ^ A[4][0]; C[1] = A[0][1] ^ A[1][1] ^ A[2][1] ^ A[3][1] ^ A[4][1]; C[2] = A[0][2] ^ A[1][2] ^ A[2][2] ^ A[3][2] ^ A[4][2]; C[3] = A[0][3] ^ A[1][3] ^ A[2][3] ^ A[3][3] ^ A[4][3]; C[4] = A[0][4] ^ A[1][4] ^ A[2][4] ^ A[3][4] ^ A[4][4]; #if defined(__arm__) D[1] = E[0] = ROL64(C[2], 1) ^ C[0]; D[4] = E[1] = ROL64(C[0], 1) ^ C[3]; D[0] = C[0] = ROL64(C[1], 1) ^ C[4]; D[2] = C[1] = ROL64(C[3], 1) ^ C[1]; D[3] = C[2] = ROL64(C[4], 1) ^ C[2]; T[0][0] = A[3][0] ^ C[0]; /* borrow T[0][0] */ T[0][1] = A[0][1] ^ E[0]; /* D[1] */ T[0][2] = A[0][2] ^ C[1]; /* D[2] */ T[0][3] = A[0][3] ^ C[2]; /* D[3] */ T[0][4] = A[0][4] ^ E[1]; /* D[4] */ C[3] = ROL64(A[3][3] ^ C[2], rhotates[3][3]); /* D[3] */ C[4] = ROL64(A[4][4] ^ E[1], rhotates[4][4]); /* D[4] */ C[0] = A[0][0] ^ C[0]; /* rotate by 0 */ /* D[0] */ C[2] = ROL64(A[2][2] ^ C[1], rhotates[2][2]); /* D[2] */ C[1] = ROL64(A[1][1] ^ E[0], rhotates[1][1]); /* D[1] */ #else D[0] = ROL64(C[1], 1) ^ C[4]; D[1] = ROL64(C[2], 1) ^ C[0]; D[2] = ROL64(C[3], 1) ^ C[1]; D[3] = ROL64(C[4], 1) ^ C[2]; D[4] = ROL64(C[0], 1) ^ C[3]; T[0][0] = A[3][0] ^ D[0]; /* borrow T[0][0] */ T[0][1] = A[0][1] ^ D[1]; T[0][2] = A[0][2] ^ D[2]; T[0][3] = A[0][3] ^ D[3]; T[0][4] = A[0][4] ^ D[4]; C[0] = A[0][0] ^ D[0]; /* rotate by 0 */ C[1] = ROL64(A[1][1] ^ D[1], rhotates[1][1]); C[2] = ROL64(A[2][2] ^ D[2], rhotates[2][2]); C[3] = ROL64(A[3][3] ^ D[3], rhotates[3][3]); C[4] = ROL64(A[4][4] ^ D[4], rhotates[4][4]); #endif A[0][0] = C[0] ^ (~C[1] & C[2]) ^ iotas[i]; A[0][1] = C[1] ^ (~C[2] & C[3]); A[0][2] = C[2] ^ (~C[3] & C[4]); A[0][3] = C[3] ^ (~C[4] & C[0]); A[0][4] = C[4] ^ (~C[0] & C[1]); T[1][0] = A[1][0] ^ (C[3] = D[0]); T[1][1] = A[2][1] ^ (C[4] = D[1]); /* borrow T[1][1] */ T[1][2] = A[1][2] ^ (E[0] = D[2]); T[1][3] = A[1][3] ^ (E[1] = D[3]); T[1][4] = A[2][4] ^ (C[2] = D[4]); /* borrow T[1][4] */ C[0] = ROL64(T[0][3], rhotates[0][3]); C[1] = ROL64(A[1][4] ^ C[2], rhotates[1][4]); /* D[4] */ C[2] = ROL64(A[2][0] ^ C[3], rhotates[2][0]); /* D[0] */ C[3] = ROL64(A[3][1] ^ C[4], rhotates[3][1]); /* D[1] */ C[4] = ROL64(A[4][2] ^ E[0], rhotates[4][2]); /* D[2] */ A[1][0] = C[0] ^ (~C[1] & C[2]); A[1][1] = C[1] ^ (~C[2] & C[3]); A[1][2] = C[2] ^ (~C[3] & C[4]); A[1][3] = C[3] ^ (~C[4] & C[0]); A[1][4] = C[4] ^ (~C[0] & C[1]); C[0] = ROL64(T[0][1], rhotates[0][1]); C[1] = ROL64(T[1][2], rhotates[1][2]); C[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]); C[3] = ROL64(A[3][4] ^ D[4], rhotates[3][4]); C[4] = ROL64(A[4][0] ^ D[0], rhotates[4][0]); A[2][0] = C[0] ^ (~C[1] & C[2]); A[2][1] = C[1] ^ (~C[2] & C[3]); A[2][2] = C[2] ^ (~C[3] & C[4]); A[2][3] = C[3] ^ (~C[4] & C[0]); A[2][4] = C[4] ^ (~C[0] & C[1]); C[0] = ROL64(T[0][4], rhotates[0][4]); C[1] = ROL64(T[1][0], rhotates[1][0]); C[2] = ROL64(T[1][1], rhotates[2][1]); /* originally A[2][1] */ C[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]); C[4] = ROL64(A[4][3] ^ D[3], rhotates[4][3]); A[3][0] = C[0] ^ (~C[1] & C[2]); A[3][1] = C[1] ^ (~C[2] & C[3]); A[3][2] = C[2] ^ (~C[3] & C[4]); A[3][3] = C[3] ^ (~C[4] & C[0]); A[3][4] = C[4] ^ (~C[0] & C[1]); C[0] = ROL64(T[0][2], rhotates[0][2]); C[1] = ROL64(T[1][3], rhotates[1][3]); C[2] = ROL64(T[1][4], rhotates[2][4]); /* originally A[2][4] */ C[3] = ROL64(T[0][0], rhotates[3][0]); /* originally A[3][0] */ C[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]); A[4][0] = C[0] ^ (~C[1] & C[2]); A[4][1] = C[1] ^ (~C[2] & C[3]); A[4][2] = C[2] ^ (~C[3] & C[4]); A[4][3] = C[3] ^ (~C[4] & C[0]); A[4][4] = C[4] ^ (~C[0] & C[1]); } static void KeccakF1600(uint64_t A[5][5]) { size_t i; for (i = 0; i < 24; i++) { Round(A, i); } } #elif defined(KECCAK_1X_ALT) /* * This is variant of above KECCAK_1X that reduces requirement for * temporary storage even further, but at cost of more updates to A[][]. * It's less suitable if A[][] is memory bound, but better if it's * register bound. */ static void Round(uint64_t A[5][5], size_t i) { uint64_t C[5], D[5]; assert(i < (sizeof(iotas) / sizeof(iotas[0]))); C[0] = A[0][0] ^ A[1][0] ^ A[2][0] ^ A[3][0] ^ A[4][0]; C[1] = A[0][1] ^ A[1][1] ^ A[2][1] ^ A[3][1] ^ A[4][1]; C[2] = A[0][2] ^ A[1][2] ^ A[2][2] ^ A[3][2] ^ A[4][2]; C[3] = A[0][3] ^ A[1][3] ^ A[2][3] ^ A[3][3] ^ A[4][3]; C[4] = A[0][4] ^ A[1][4] ^ A[2][4] ^ A[3][4] ^ A[4][4]; D[1] = C[0] ^ ROL64(C[2], 1); D[2] = C[1] ^ ROL64(C[3], 1); D[3] = C[2] ^= ROL64(C[4], 1); D[4] = C[3] ^= ROL64(C[0], 1); D[0] = C[4] ^= ROL64(C[1], 1); A[0][1] ^= D[1]; A[1][1] ^= D[1]; A[2][1] ^= D[1]; A[3][1] ^= D[1]; A[4][1] ^= D[1]; A[0][2] ^= D[2]; A[1][2] ^= D[2]; A[2][2] ^= D[2]; A[3][2] ^= D[2]; A[4][2] ^= D[2]; A[0][3] ^= C[2]; A[1][3] ^= C[2]; A[2][3] ^= C[2]; A[3][3] ^= C[2]; A[4][3] ^= C[2]; A[0][4] ^= C[3]; A[1][4] ^= C[3]; A[2][4] ^= C[3]; A[3][4] ^= C[3]; A[4][4] ^= C[3]; A[0][0] ^= C[4]; A[1][0] ^= C[4]; A[2][0] ^= C[4]; A[3][0] ^= C[4]; A[4][0] ^= C[4]; C[1] = A[0][1]; C[2] = A[0][2]; C[3] = A[0][3]; C[4] = A[0][4]; A[0][1] = ROL64(A[1][1], rhotates[1][1]); A[0][2] = ROL64(A[2][2], rhotates[2][2]); A[0][3] = ROL64(A[3][3], rhotates[3][3]); A[0][4] = ROL64(A[4][4], rhotates[4][4]); A[1][1] = ROL64(A[1][4], rhotates[1][4]); A[2][2] = ROL64(A[2][3], rhotates[2][3]); A[3][3] = ROL64(A[3][2], rhotates[3][2]); A[4][4] = ROL64(A[4][1], rhotates[4][1]); A[1][4] = ROL64(A[4][2], rhotates[4][2]); A[2][3] = ROL64(A[3][4], rhotates[3][4]); A[3][2] = ROL64(A[2][1], rhotates[2][1]); A[4][1] = ROL64(A[1][3], rhotates[1][3]); A[4][2] = ROL64(A[2][4], rhotates[2][4]); A[3][4] = ROL64(A[4][3], rhotates[4][3]); A[2][1] = ROL64(A[1][2], rhotates[1][2]); A[1][3] = ROL64(A[3][1], rhotates[3][1]); A[2][4] = ROL64(A[4][0], rhotates[4][0]); A[4][3] = ROL64(A[3][0], rhotates[3][0]); A[1][2] = ROL64(A[2][0], rhotates[2][0]); A[3][1] = ROL64(A[1][0], rhotates[1][0]); A[1][0] = ROL64(C[3], rhotates[0][3]); A[2][0] = ROL64(C[1], rhotates[0][1]); A[3][0] = ROL64(C[4], rhotates[0][4]); A[4][0] = ROL64(C[2], rhotates[0][2]); C[0] = A[0][0]; C[1] = A[1][0]; D[0] = A[0][1]; D[1] = A[1][1]; A[0][0] ^= (~A[0][1] & A[0][2]); A[1][0] ^= (~A[1][1] & A[1][2]); A[0][1] ^= (~A[0][2] & A[0][3]); A[1][1] ^= (~A[1][2] & A[1][3]); A[0][2] ^= (~A[0][3] & A[0][4]); A[1][2] ^= (~A[1][3] & A[1][4]); A[0][3] ^= (~A[0][4] & C[0]); A[1][3] ^= (~A[1][4] & C[1]); A[0][4] ^= (~C[0] & D[0]); A[1][4] ^= (~C[1] & D[1]); C[2] = A[2][0]; C[3] = A[3][0]; D[2] = A[2][1]; D[3] = A[3][1]; A[2][0] ^= (~A[2][1] & A[2][2]); A[3][0] ^= (~A[3][1] & A[3][2]); A[2][1] ^= (~A[2][2] & A[2][3]); A[3][1] ^= (~A[3][2] & A[3][3]); A[2][2] ^= (~A[2][3] & A[2][4]); A[3][2] ^= (~A[3][3] & A[3][4]); A[2][3] ^= (~A[2][4] & C[2]); A[3][3] ^= (~A[3][4] & C[3]); A[2][4] ^= (~C[2] & D[2]); A[3][4] ^= (~C[3] & D[3]); C[4] = A[4][0]; D[4] = A[4][1]; A[4][0] ^= (~A[4][1] & A[4][2]); A[4][1] ^= (~A[4][2] & A[4][3]); A[4][2] ^= (~A[4][3] & A[4][4]); A[4][3] ^= (~A[4][4] & C[4]); A[4][4] ^= (~C[4] & D[4]); A[0][0] ^= iotas[i]; } static void KeccakF1600(uint64_t A[5][5]) { size_t i; for (i = 0; i < 24; i++) { Round(A, i); } } #elif defined(KECCAK_2X) /* * This implementation is variant of KECCAK_1X above with outer-most * round loop unrolled twice. This allows to take temporary storage * out of round procedure and simplify references to it by alternating * it with actual data (see round loop below). Originally it was meant * rather as reference for an assembly implementation, but it seems to * play best with compilers [as well as provide best instruction per * processed byte ratio at minimal round unroll factor]... */ static void Round(uint64_t R[5][5], uint64_t A[5][5], size_t i) { uint64_t C[5], D[5]; assert(i < (sizeof(iotas) / sizeof(iotas[0]))); C[0] = A[0][0] ^ A[1][0] ^ A[2][0] ^ A[3][0] ^ A[4][0]; C[1] = A[0][1] ^ A[1][1] ^ A[2][1] ^ A[3][1] ^ A[4][1]; C[2] = A[0][2] ^ A[1][2] ^ A[2][2] ^ A[3][2] ^ A[4][2]; C[3] = A[0][3] ^ A[1][3] ^ A[2][3] ^ A[3][3] ^ A[4][3]; C[4] = A[0][4] ^ A[1][4] ^ A[2][4] ^ A[3][4] ^ A[4][4]; D[0] = ROL64(C[1], 1) ^ C[4]; D[1] = ROL64(C[2], 1) ^ C[0]; D[2] = ROL64(C[3], 1) ^ C[1]; D[3] = ROL64(C[4], 1) ^ C[2]; D[4] = ROL64(C[0], 1) ^ C[3]; C[0] = A[0][0] ^ D[0]; /* rotate by 0 */ C[1] = ROL64(A[1][1] ^ D[1], rhotates[1][1]); C[2] = ROL64(A[2][2] ^ D[2], rhotates[2][2]); C[3] = ROL64(A[3][3] ^ D[3], rhotates[3][3]); C[4] = ROL64(A[4][4] ^ D[4], rhotates[4][4]); #ifdef KECCAK_COMPLEMENTING_TRANSFORM R[0][0] = C[0] ^ ( C[1] | C[2]) ^ iotas[i]; R[0][1] = C[1] ^ (~C[2] | C[3]); R[0][2] = C[2] ^ ( C[3] & C[4]); R[0][3] = C[3] ^ ( C[4] | C[0]); R[0][4] = C[4] ^ ( C[0] & C[1]); #else R[0][0] = C[0] ^ (~C[1] & C[2]) ^ iotas[i]; R[0][1] = C[1] ^ (~C[2] & C[3]); R[0][2] = C[2] ^ (~C[3] & C[4]); R[0][3] = C[3] ^ (~C[4] & C[0]); R[0][4] = C[4] ^ (~C[0] & C[1]); #endif C[0] = ROL64(A[0][3] ^ D[3], rhotates[0][3]); C[1] = ROL64(A[1][4] ^ D[4], rhotates[1][4]); C[2] = ROL64(A[2][0] ^ D[0], rhotates[2][0]); C[3] = ROL64(A[3][1] ^ D[1], rhotates[3][1]); C[4] = ROL64(A[4][2] ^ D[2], rhotates[4][2]); #ifdef KECCAK_COMPLEMENTING_TRANSFORM R[1][0] = C[0] ^ (C[1] | C[2]); R[1][1] = C[1] ^ (C[2] & C[3]); R[1][2] = C[2] ^ (C[3] | ~C[4]); R[1][3] = C[3] ^ (C[4] | C[0]); R[1][4] = C[4] ^ (C[0] & C[1]); #else R[1][0] = C[0] ^ (~C[1] & C[2]); R[1][1] = C[1] ^ (~C[2] & C[3]); R[1][2] = C[2] ^ (~C[3] & C[4]); R[1][3] = C[3] ^ (~C[4] & C[0]); R[1][4] = C[4] ^ (~C[0] & C[1]); #endif C[0] = ROL64(A[0][1] ^ D[1], rhotates[0][1]); C[1] = ROL64(A[1][2] ^ D[2], rhotates[1][2]); C[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]); C[3] = ROL64(A[3][4] ^ D[4], rhotates[3][4]); C[4] = ROL64(A[4][0] ^ D[0], rhotates[4][0]); #ifdef KECCAK_COMPLEMENTING_TRANSFORM R[2][0] = C[0] ^ ( C[1] | C[2]); R[2][1] = C[1] ^ ( C[2] & C[3]); R[2][2] = C[2] ^ (~C[3] & C[4]); R[2][3] = ~C[3] ^ ( C[4] | C[0]); R[2][4] = C[4] ^ ( C[0] & C[1]); #else R[2][0] = C[0] ^ (~C[1] & C[2]); R[2][1] = C[1] ^ (~C[2] & C[3]); R[2][2] = C[2] ^ (~C[3] & C[4]); R[2][3] = C[3] ^ (~C[4] & C[0]); R[2][4] = C[4] ^ (~C[0] & C[1]); #endif C[0] = ROL64(A[0][4] ^ D[4], rhotates[0][4]); C[1] = ROL64(A[1][0] ^ D[0], rhotates[1][0]); C[2] = ROL64(A[2][1] ^ D[1], rhotates[2][1]); C[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]); C[4] = ROL64(A[4][3] ^ D[3], rhotates[4][3]); #ifdef KECCAK_COMPLEMENTING_TRANSFORM R[3][0] = C[0] ^ ( C[1] & C[2]); R[3][1] = C[1] ^ ( C[2] | C[3]); R[3][2] = C[2] ^ (~C[3] | C[4]); R[3][3] = ~C[3] ^ ( C[4] & C[0]); R[3][4] = C[4] ^ ( C[0] | C[1]); #else R[3][0] = C[0] ^ (~C[1] & C[2]); R[3][1] = C[1] ^ (~C[2] & C[3]); R[3][2] = C[2] ^ (~C[3] & C[4]); R[3][3] = C[3] ^ (~C[4] & C[0]); R[3][4] = C[4] ^ (~C[0] & C[1]); #endif C[0] = ROL64(A[0][2] ^ D[2], rhotates[0][2]); C[1] = ROL64(A[1][3] ^ D[3], rhotates[1][3]); C[2] = ROL64(A[2][4] ^ D[4], rhotates[2][4]); C[3] = ROL64(A[3][0] ^ D[0], rhotates[3][0]); C[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]); #ifdef KECCAK_COMPLEMENTING_TRANSFORM R[4][0] = C[0] ^ (~C[1] & C[2]); R[4][1] = ~C[1] ^ ( C[2] | C[3]); R[4][2] = C[2] ^ ( C[3] & C[4]); R[4][3] = C[3] ^ ( C[4] | C[0]); R[4][4] = C[4] ^ ( C[0] & C[1]); #else R[4][0] = C[0] ^ (~C[1] & C[2]); R[4][1] = C[1] ^ (~C[2] & C[3]); R[4][2] = C[2] ^ (~C[3] & C[4]); R[4][3] = C[3] ^ (~C[4] & C[0]); R[4][4] = C[4] ^ (~C[0] & C[1]); #endif } static void KeccakF1600(uint64_t A[5][5]) { uint64_t T[5][5]; size_t i; #ifdef KECCAK_COMPLEMENTING_TRANSFORM A[0][1] = ~A[0][1]; A[0][2] = ~A[0][2]; A[1][3] = ~A[1][3]; A[2][2] = ~A[2][2]; A[3][2] = ~A[3][2]; A[4][0] = ~A[4][0]; #endif for (i = 0; i < 24; i += 2) { Round(T, A, i); Round(A, T, i + 1); } #ifdef KECCAK_COMPLEMENTING_TRANSFORM A[0][1] = ~A[0][1]; A[0][2] = ~A[0][2]; A[1][3] = ~A[1][3]; A[2][2] = ~A[2][2]; A[3][2] = ~A[3][2]; A[4][0] = ~A[4][0]; #endif } #else /* define KECCAK_INPLACE to compile this code path */ /* * This implementation is KECCAK_1X from above combined 4 times with * a twist that allows to omit temporary storage and perform in-place * processing. It's discussed in section 2.5 of "Keccak implementation * overview". It's likely to be best suited for processors with large * register bank... On the other hand processor with large register * bank can as well use KECCAK_1X_ALT, it would be as fast but much * more compact... */ static void FourRounds(uint64_t A[5][5], size_t i) { uint64_t B[5], C[5], D[5]; assert(i <= (sizeof(iotas) / sizeof(iotas[0]) - 4)); /* Round 4*n */ C[0] = A[0][0] ^ A[1][0] ^ A[2][0] ^ A[3][0] ^ A[4][0]; C[1] = A[0][1] ^ A[1][1] ^ A[2][1] ^ A[3][1] ^ A[4][1]; C[2] = A[0][2] ^ A[1][2] ^ A[2][2] ^ A[3][2] ^ A[4][2]; C[3] = A[0][3] ^ A[1][3] ^ A[2][3] ^ A[3][3] ^ A[4][3]; C[4] = A[0][4] ^ A[1][4] ^ A[2][4] ^ A[3][4] ^ A[4][4]; D[0] = ROL64(C[1], 1) ^ C[4]; D[1] = ROL64(C[2], 1) ^ C[0]; D[2] = ROL64(C[3], 1) ^ C[1]; D[3] = ROL64(C[4], 1) ^ C[2]; D[4] = ROL64(C[0], 1) ^ C[3]; B[0] = A[0][0] ^ D[0]; /* rotate by 0 */ B[1] = ROL64(A[1][1] ^ D[1], rhotates[1][1]); B[2] = ROL64(A[2][2] ^ D[2], rhotates[2][2]); B[3] = ROL64(A[3][3] ^ D[3], rhotates[3][3]); B[4] = ROL64(A[4][4] ^ D[4], rhotates[4][4]); C[0] = A[0][0] = B[0] ^ (~B[1] & B[2]) ^ iotas[i]; C[1] = A[1][1] = B[1] ^ (~B[2] & B[3]); C[2] = A[2][2] = B[2] ^ (~B[3] & B[4]); C[3] = A[3][3] = B[3] ^ (~B[4] & B[0]); C[4] = A[4][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[0][3] ^ D[3], rhotates[0][3]); B[1] = ROL64(A[1][4] ^ D[4], rhotates[1][4]); B[2] = ROL64(A[2][0] ^ D[0], rhotates[2][0]); B[3] = ROL64(A[3][1] ^ D[1], rhotates[3][1]); B[4] = ROL64(A[4][2] ^ D[2], rhotates[4][2]); C[0] ^= A[2][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[3][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[4][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[0][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[1][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[0][1] ^ D[1], rhotates[0][1]); B[1] = ROL64(A[1][2] ^ D[2], rhotates[1][2]); B[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]); B[3] = ROL64(A[3][4] ^ D[4], rhotates[3][4]); B[4] = ROL64(A[4][0] ^ D[0], rhotates[4][0]); C[0] ^= A[4][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[0][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[1][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[2][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[3][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[0][4] ^ D[4], rhotates[0][4]); B[1] = ROL64(A[1][0] ^ D[0], rhotates[1][0]); B[2] = ROL64(A[2][1] ^ D[1], rhotates[2][1]); B[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]); B[4] = ROL64(A[4][3] ^ D[3], rhotates[4][3]); C[0] ^= A[1][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[2][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[3][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[4][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[0][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[0][2] ^ D[2], rhotates[0][2]); B[1] = ROL64(A[1][3] ^ D[3], rhotates[1][3]); B[2] = ROL64(A[2][4] ^ D[4], rhotates[2][4]); B[3] = ROL64(A[3][0] ^ D[0], rhotates[3][0]); B[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]); C[0] ^= A[3][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[4][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[0][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[1][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[2][4] = B[4] ^ (~B[0] & B[1]); /* Round 4*n+1 */ D[0] = ROL64(C[1], 1) ^ C[4]; D[1] = ROL64(C[2], 1) ^ C[0]; D[2] = ROL64(C[3], 1) ^ C[1]; D[3] = ROL64(C[4], 1) ^ C[2]; D[4] = ROL64(C[0], 1) ^ C[3]; B[0] = A[0][0] ^ D[0]; /* rotate by 0 */ B[1] = ROL64(A[3][1] ^ D[1], rhotates[1][1]); B[2] = ROL64(A[1][2] ^ D[2], rhotates[2][2]); B[3] = ROL64(A[4][3] ^ D[3], rhotates[3][3]); B[4] = ROL64(A[2][4] ^ D[4], rhotates[4][4]); C[0] = A[0][0] = B[0] ^ (~B[1] & B[2]) ^ iotas[i + 1]; C[1] = A[3][1] = B[1] ^ (~B[2] & B[3]); C[2] = A[1][2] = B[2] ^ (~B[3] & B[4]); C[3] = A[4][3] = B[3] ^ (~B[4] & B[0]); C[4] = A[2][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[3][3] ^ D[3], rhotates[0][3]); B[1] = ROL64(A[1][4] ^ D[4], rhotates[1][4]); B[2] = ROL64(A[4][0] ^ D[0], rhotates[2][0]); B[3] = ROL64(A[2][1] ^ D[1], rhotates[3][1]); B[4] = ROL64(A[0][2] ^ D[2], rhotates[4][2]); C[0] ^= A[4][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[2][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[0][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[3][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[1][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[1][1] ^ D[1], rhotates[0][1]); B[1] = ROL64(A[4][2] ^ D[2], rhotates[1][2]); B[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]); B[3] = ROL64(A[0][4] ^ D[4], rhotates[3][4]); B[4] = ROL64(A[3][0] ^ D[0], rhotates[4][0]); C[0] ^= A[3][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[1][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[4][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[2][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[0][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[4][4] ^ D[4], rhotates[0][4]); B[1] = ROL64(A[2][0] ^ D[0], rhotates[1][0]); B[2] = ROL64(A[0][1] ^ D[1], rhotates[2][1]); B[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]); B[4] = ROL64(A[1][3] ^ D[3], rhotates[4][3]); C[0] ^= A[2][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[0][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[3][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[1][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[4][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[2][2] ^ D[2], rhotates[0][2]); B[1] = ROL64(A[0][3] ^ D[3], rhotates[1][3]); B[2] = ROL64(A[3][4] ^ D[4], rhotates[2][4]); B[3] = ROL64(A[1][0] ^ D[0], rhotates[3][0]); B[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]); C[0] ^= A[1][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[4][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[2][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[0][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[3][4] = B[4] ^ (~B[0] & B[1]); /* Round 4*n+2 */ D[0] = ROL64(C[1], 1) ^ C[4]; D[1] = ROL64(C[2], 1) ^ C[0]; D[2] = ROL64(C[3], 1) ^ C[1]; D[3] = ROL64(C[4], 1) ^ C[2]; D[4] = ROL64(C[0], 1) ^ C[3]; B[0] = A[0][0] ^ D[0]; /* rotate by 0 */ B[1] = ROL64(A[2][1] ^ D[1], rhotates[1][1]); B[2] = ROL64(A[4][2] ^ D[2], rhotates[2][2]); B[3] = ROL64(A[1][3] ^ D[3], rhotates[3][3]); B[4] = ROL64(A[3][4] ^ D[4], rhotates[4][4]); C[0] = A[0][0] = B[0] ^ (~B[1] & B[2]) ^ iotas[i + 2]; C[1] = A[2][1] = B[1] ^ (~B[2] & B[3]); C[2] = A[4][2] = B[2] ^ (~B[3] & B[4]); C[3] = A[1][3] = B[3] ^ (~B[4] & B[0]); C[4] = A[3][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[4][3] ^ D[3], rhotates[0][3]); B[1] = ROL64(A[1][4] ^ D[4], rhotates[1][4]); B[2] = ROL64(A[3][0] ^ D[0], rhotates[2][0]); B[3] = ROL64(A[0][1] ^ D[1], rhotates[3][1]); B[4] = ROL64(A[2][2] ^ D[2], rhotates[4][2]); C[0] ^= A[3][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[0][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[2][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[4][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[1][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[3][1] ^ D[1], rhotates[0][1]); B[1] = ROL64(A[0][2] ^ D[2], rhotates[1][2]); B[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]); B[3] = ROL64(A[4][4] ^ D[4], rhotates[3][4]); B[4] = ROL64(A[1][0] ^ D[0], rhotates[4][0]); C[0] ^= A[1][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[3][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[0][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[2][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[4][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[2][4] ^ D[4], rhotates[0][4]); B[1] = ROL64(A[4][0] ^ D[0], rhotates[1][0]); B[2] = ROL64(A[1][1] ^ D[1], rhotates[2][1]); B[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]); B[4] = ROL64(A[0][3] ^ D[3], rhotates[4][3]); C[0] ^= A[4][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[1][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[3][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[0][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[2][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[1][2] ^ D[2], rhotates[0][2]); B[1] = ROL64(A[3][3] ^ D[3], rhotates[1][3]); B[2] = ROL64(A[0][4] ^ D[4], rhotates[2][4]); B[3] = ROL64(A[2][0] ^ D[0], rhotates[3][0]); B[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]); C[0] ^= A[2][0] = B[0] ^ (~B[1] & B[2]); C[1] ^= A[4][1] = B[1] ^ (~B[2] & B[3]); C[2] ^= A[1][2] = B[2] ^ (~B[3] & B[4]); C[3] ^= A[3][3] = B[3] ^ (~B[4] & B[0]); C[4] ^= A[0][4] = B[4] ^ (~B[0] & B[1]); /* Round 4*n+3 */ D[0] = ROL64(C[1], 1) ^ C[4]; D[1] = ROL64(C[2], 1) ^ C[0]; D[2] = ROL64(C[3], 1) ^ C[1]; D[3] = ROL64(C[4], 1) ^ C[2]; D[4] = ROL64(C[0], 1) ^ C[3]; B[0] = A[0][0] ^ D[0]; /* rotate by 0 */ B[1] = ROL64(A[0][1] ^ D[1], rhotates[1][1]); B[2] = ROL64(A[0][2] ^ D[2], rhotates[2][2]); B[3] = ROL64(A[0][3] ^ D[3], rhotates[3][3]); B[4] = ROL64(A[0][4] ^ D[4], rhotates[4][4]); /* C[0] = */ A[0][0] = B[0] ^ (~B[1] & B[2]) ^ iotas[i + 3]; /* C[1] = */ A[0][1] = B[1] ^ (~B[2] & B[3]); /* C[2] = */ A[0][2] = B[2] ^ (~B[3] & B[4]); /* C[3] = */ A[0][3] = B[3] ^ (~B[4] & B[0]); /* C[4] = */ A[0][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[1][3] ^ D[3], rhotates[0][3]); B[1] = ROL64(A[1][4] ^ D[4], rhotates[1][4]); B[2] = ROL64(A[1][0] ^ D[0], rhotates[2][0]); B[3] = ROL64(A[1][1] ^ D[1], rhotates[3][1]); B[4] = ROL64(A[1][2] ^ D[2], rhotates[4][2]); /* C[0] ^= */ A[1][0] = B[0] ^ (~B[1] & B[2]); /* C[1] ^= */ A[1][1] = B[1] ^ (~B[2] & B[3]); /* C[2] ^= */ A[1][2] = B[2] ^ (~B[3] & B[4]); /* C[3] ^= */ A[1][3] = B[3] ^ (~B[4] & B[0]); /* C[4] ^= */ A[1][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[2][1] ^ D[1], rhotates[0][1]); B[1] = ROL64(A[2][2] ^ D[2], rhotates[1][2]); B[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]); B[3] = ROL64(A[2][4] ^ D[4], rhotates[3][4]); B[4] = ROL64(A[2][0] ^ D[0], rhotates[4][0]); /* C[0] ^= */ A[2][0] = B[0] ^ (~B[1] & B[2]); /* C[1] ^= */ A[2][1] = B[1] ^ (~B[2] & B[3]); /* C[2] ^= */ A[2][2] = B[2] ^ (~B[3] & B[4]); /* C[3] ^= */ A[2][3] = B[3] ^ (~B[4] & B[0]); /* C[4] ^= */ A[2][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[3][4] ^ D[4], rhotates[0][4]); B[1] = ROL64(A[3][0] ^ D[0], rhotates[1][0]); B[2] = ROL64(A[3][1] ^ D[1], rhotates[2][1]); B[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]); B[4] = ROL64(A[3][3] ^ D[3], rhotates[4][3]); /* C[0] ^= */ A[3][0] = B[0] ^ (~B[1] & B[2]); /* C[1] ^= */ A[3][1] = B[1] ^ (~B[2] & B[3]); /* C[2] ^= */ A[3][2] = B[2] ^ (~B[3] & B[4]); /* C[3] ^= */ A[3][3] = B[3] ^ (~B[4] & B[0]); /* C[4] ^= */ A[3][4] = B[4] ^ (~B[0] & B[1]); B[0] = ROL64(A[4][2] ^ D[2], rhotates[0][2]); B[1] = ROL64(A[4][3] ^ D[3], rhotates[1][3]); B[2] = ROL64(A[4][4] ^ D[4], rhotates[2][4]); B[3] = ROL64(A[4][0] ^ D[0], rhotates[3][0]); B[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]); /* C[0] ^= */ A[4][0] = B[0] ^ (~B[1] & B[2]); /* C[1] ^= */ A[4][1] = B[1] ^ (~B[2] & B[3]); /* C[2] ^= */ A[4][2] = B[2] ^ (~B[3] & B[4]); /* C[3] ^= */ A[4][3] = B[3] ^ (~B[4] & B[0]); /* C[4] ^= */ A[4][4] = B[4] ^ (~B[0] & B[1]); } static void KeccakF1600(uint64_t A[5][5]) { size_t i; for (i = 0; i < 24; i += 4) { FourRounds(A, i); } } #endif static uint64_t BitInterleave(uint64_t Ai) { if (BIT_INTERLEAVE) { uint32_t hi = (uint32_t)(Ai >> 32), lo = (uint32_t)Ai; uint32_t t0, t1; t0 = lo & 0x55555555; t0 |= t0 >> 1; t0 &= 0x33333333; t0 |= t0 >> 2; t0 &= 0x0f0f0f0f; t0 |= t0 >> 4; t0 &= 0x00ff00ff; t0 |= t0 >> 8; t0 &= 0x0000ffff; t1 = hi & 0x55555555; t1 |= t1 >> 1; t1 &= 0x33333333; t1 |= t1 >> 2; t1 &= 0x0f0f0f0f; t1 |= t1 >> 4; t1 &= 0x00ff00ff; t1 |= t1 >> 8; t1 <<= 16; lo &= 0xaaaaaaaa; lo |= lo << 1; lo &= 0xcccccccc; lo |= lo << 2; lo &= 0xf0f0f0f0; lo |= lo << 4; lo &= 0xff00ff00; lo |= lo << 8; lo >>= 16; hi &= 0xaaaaaaaa; hi |= hi << 1; hi &= 0xcccccccc; hi |= hi << 2; hi &= 0xf0f0f0f0; hi |= hi << 4; hi &= 0xff00ff00; hi |= hi << 8; hi &= 0xffff0000; Ai = ((uint64_t)(hi | lo) << 32) | (t1 | t0); } return Ai; } static uint64_t BitDeinterleave(uint64_t Ai) { if (BIT_INTERLEAVE) { uint32_t hi = (uint32_t)(Ai >> 32), lo = (uint32_t)Ai; uint32_t t0, t1; t0 = lo & 0x0000ffff; t0 |= t0 << 8; t0 &= 0x00ff00ff; t0 |= t0 << 4; t0 &= 0x0f0f0f0f; t0 |= t0 << 2; t0 &= 0x33333333; t0 |= t0 << 1; t0 &= 0x55555555; t1 = hi << 16; t1 |= t1 >> 8; t1 &= 0xff00ff00; t1 |= t1 >> 4; t1 &= 0xf0f0f0f0; t1 |= t1 >> 2; t1 &= 0xcccccccc; t1 |= t1 >> 1; t1 &= 0xaaaaaaaa; lo >>= 16; lo |= lo << 8; lo &= 0x00ff00ff; lo |= lo << 4; lo &= 0x0f0f0f0f; lo |= lo << 2; lo &= 0x33333333; lo |= lo << 1; lo &= 0x55555555; hi &= 0xffff0000; hi |= hi >> 8; hi &= 0xff00ff00; hi |= hi >> 4; hi &= 0xf0f0f0f0; hi |= hi >> 2; hi &= 0xcccccccc; hi |= hi >> 1; hi &= 0xaaaaaaaa; Ai = ((uint64_t)(hi | lo) << 32) | (t1 | t0); } return Ai; } /* * SHA3_absorb can be called multiple times, but at each invocation * largest multiple of |r| out of |len| bytes are processed. Then * remaining amount of bytes is returned. This is done to spare caller * trouble of calculating the largest multiple of |r|. |r| can be viewed * as blocksize. It is commonly (1600 - 256*n)/8, e.g. 168, 136, 104, * 72, but can also be (1600 - 448)/8 = 144. All this means that message * padding and intermediate sub-block buffering, byte- or bitwise, is * caller's responsibility. */ size_t SHA3_absorb(uint64_t A[5][5], const unsigned char *inp, size_t len, size_t r) { uint64_t *A_flat = (uint64_t *)A; size_t i, w = r / 8; assert(r < (25 * sizeof(A[0][0])) && (r % 8) == 0); while (len >= r) { for (i = 0; i < w; i++) { uint64_t Ai = (uint64_t)inp[0] | (uint64_t)inp[1] << 8 | (uint64_t)inp[2] << 16 | (uint64_t)inp[3] << 24 | (uint64_t)inp[4] << 32 | (uint64_t)inp[5] << 40 | (uint64_t)inp[6] << 48 | (uint64_t)inp[7] << 56; inp += 8; A_flat[i] ^= BitInterleave(Ai); } KeccakF1600(A); len -= r; } return len; } /* * SHA3_squeeze may be called after SHA3_absorb to generate |out| hash value of * |len| bytes. * If multiple SHA3_squeeze calls are required the output length |len| must be a * multiple of the blocksize, with |next| being 0 on the first call and 1 on * subsequent calls. It is the callers responsibility to buffer the results. * When only a single call to SHA3_squeeze is required, |len| can be any size * and |next| must be 0. */ void SHA3_squeeze(uint64_t A[5][5], unsigned char *out, size_t len, size_t r, int next) { uint64_t *A_flat = (uint64_t *)A; size_t i, w = r / 8; assert(r < (25 * sizeof(A[0][0])) && (r % 8) == 0); while (len != 0) { if (next) KeccakF1600(A); next = 1; for (i = 0; i < w && len != 0; i++) { uint64_t Ai = BitDeinterleave(A_flat[i]); if (len < 8) { for (i = 0; i < len; i++) { *out++ = (unsigned char)Ai; Ai >>= 8; } return; } out[0] = (unsigned char)(Ai); out[1] = (unsigned char)(Ai >> 8); out[2] = (unsigned char)(Ai >> 16); out[3] = (unsigned char)(Ai >> 24); out[4] = (unsigned char)(Ai >> 32); out[5] = (unsigned char)(Ai >> 40); out[6] = (unsigned char)(Ai >> 48); out[7] = (unsigned char)(Ai >> 56); out += 8; len -= 8; } } } #endif #ifdef SELFTEST /* * Post-padding one-shot implementations would look as following: * * SHA3_224 SHA3_sponge(inp, len, out, 224/8, (1600-448)/8); * SHA3_256 SHA3_sponge(inp, len, out, 256/8, (1600-512)/8); * SHA3_384 SHA3_sponge(inp, len, out, 384/8, (1600-768)/8); * SHA3_512 SHA3_sponge(inp, len, out, 512/8, (1600-1024)/8); * SHAKE_128 SHA3_sponge(inp, len, out, d, (1600-256)/8); * SHAKE_256 SHA3_sponge(inp, len, out, d, (1600-512)/8); */ void SHA3_sponge(const unsigned char *inp, size_t len, unsigned char *out, size_t d, size_t r) { uint64_t A[5][5]; memset(A, 0, sizeof(A)); SHA3_absorb(A, inp, len, r); SHA3_squeeze(A, out, d, r); } # include <stdio.h> int main(void) { /* * This is 5-bit SHAKE128 test from http://csrc.nist.gov/groups/ST/toolkit/examples.html#aHashing */ unsigned char test[168] = { '\xf3', '\x3' }; unsigned char out[512]; size_t i; static const unsigned char result[512] = { 0x2E, 0x0A, 0xBF, 0xBA, 0x83, 0xE6, 0x72, 0x0B, 0xFB, 0xC2, 0x25, 0xFF, 0x6B, 0x7A, 0xB9, 0xFF, 0xCE, 0x58, 0xBA, 0x02, 0x7E, 0xE3, 0xD8, 0x98, 0x76, 0x4F, 0xEF, 0x28, 0x7D, 0xDE, 0xCC, 0xCA, 0x3E, 0x6E, 0x59, 0x98, 0x41, 0x1E, 0x7D, 0xDB, 0x32, 0xF6, 0x75, 0x38, 0xF5, 0x00, 0xB1, 0x8C, 0x8C, 0x97, 0xC4, 0x52, 0xC3, 0x70, 0xEA, 0x2C, 0xF0, 0xAF, 0xCA, 0x3E, 0x05, 0xDE, 0x7E, 0x4D, 0xE2, 0x7F, 0xA4, 0x41, 0xA9, 0xCB, 0x34, 0xFD, 0x17, 0xC9, 0x78, 0xB4, 0x2D, 0x5B, 0x7E, 0x7F, 0x9A, 0xB1, 0x8F, 0xFE, 0xFF, 0xC3, 0xC5, 0xAC, 0x2F, 0x3A, 0x45, 0x5E, 0xEB, 0xFD, 0xC7, 0x6C, 0xEA, 0xEB, 0x0A, 0x2C, 0xCA, 0x22, 0xEE, 0xF6, 0xE6, 0x37, 0xF4, 0xCA, 0xBE, 0x5C, 0x51, 0xDE, 0xD2, 0xE3, 0xFA, 0xD8, 0xB9, 0x52, 0x70, 0xA3, 0x21, 0x84, 0x56, 0x64, 0xF1, 0x07, 0xD1, 0x64, 0x96, 0xBB, 0x7A, 0xBF, 0xBE, 0x75, 0x04, 0xB6, 0xED, 0xE2, 0xE8, 0x9E, 0x4B, 0x99, 0x6F, 0xB5, 0x8E, 0xFD, 0xC4, 0x18, 0x1F, 0x91, 0x63, 0x38, 0x1C, 0xBE, 0x7B, 0xC0, 0x06, 0xA7, 0xA2, 0x05, 0x98, 0x9C, 0x52, 0x6C, 0xD1, 0xBD, 0x68, 0x98, 0x36, 0x93, 0xB4, 0xBD, 0xC5, 0x37, 0x28, 0xB2, 0x41, 0xC1, 0xCF, 0xF4, 0x2B, 0xB6, 0x11, 0x50, 0x2C, 0x35, 0x20, 0x5C, 0xAB, 0xB2, 0x88, 0x75, 0x56, 0x55, 0xD6, 0x20, 0xC6, 0x79, 0x94, 0xF0, 0x64, 0x51, 0x18, 0x7F, 0x6F, 0xD1, 0x7E, 0x04, 0x66, 0x82, 0xBA, 0x12, 0x86, 0x06, 0x3F, 0xF8, 0x8F, 0xE2, 0x50, 0x8D, 0x1F, 0xCA, 0xF9, 0x03, 0x5A, 0x12, 0x31, 0xAD, 0x41, 0x50, 0xA9, 0xC9, 0xB2, 0x4C, 0x9B, 0x2D, 0x66, 0xB2, 0xAD, 0x1B, 0xDE, 0x0B, 0xD0, 0xBB, 0xCB, 0x8B, 0xE0, 0x5B, 0x83, 0x52, 0x29, 0xEF, 0x79, 0x19, 0x73, 0x73, 0x23, 0x42, 0x44, 0x01, 0xE1, 0xD8, 0x37, 0xB6, 0x6E, 0xB4, 0xE6, 0x30, 0xFF, 0x1D, 0xE7, 0x0C, 0xB3, 0x17, 0xC2, 0xBA, 0xCB, 0x08, 0x00, 0x1D, 0x34, 0x77, 0xB7, 0xA7, 0x0A, 0x57, 0x6D, 0x20, 0x86, 0x90, 0x33, 0x58, 0x9D, 0x85, 0xA0, 0x1D, 0xDB, 0x2B, 0x66, 0x46, 0xC0, 0x43, 0xB5, 0x9F, 0xC0, 0x11, 0x31, 0x1D, 0xA6, 0x66, 0xFA, 0x5A, 0xD1, 0xD6, 0x38, 0x7F, 0xA9, 0xBC, 0x40, 0x15, 0xA3, 0x8A, 0x51, 0xD1, 0xDA, 0x1E, 0xA6, 0x1D, 0x64, 0x8D, 0xC8, 0xE3, 0x9A, 0x88, 0xB9, 0xD6, 0x22, 0xBD, 0xE2, 0x07, 0xFD, 0xAB, 0xC6, 0xF2, 0x82, 0x7A, 0x88, 0x0C, 0x33, 0x0B, 0xBF, 0x6D, 0xF7, 0x33, 0x77, 0x4B, 0x65, 0x3E, 0x57, 0x30, 0x5D, 0x78, 0xDC, 0xE1, 0x12, 0xF1, 0x0A, 0x2C, 0x71, 0xF4, 0xCD, 0xAD, 0x92, 0xED, 0x11, 0x3E, 0x1C, 0xEA, 0x63, 0xB9, 0x19, 0x25, 0xED, 0x28, 0x19, 0x1E, 0x6D, 0xBB, 0xB5, 0xAA, 0x5A, 0x2A, 0xFD, 0xA5, 0x1F, 0xC0, 0x5A, 0x3A, 0xF5, 0x25, 0x8B, 0x87, 0x66, 0x52, 0x43, 0x55, 0x0F, 0x28, 0x94, 0x8A, 0xE2, 0xB8, 0xBE, 0xB6, 0xBC, 0x9C, 0x77, 0x0B, 0x35, 0xF0, 0x67, 0xEA, 0xA6, 0x41, 0xEF, 0xE6, 0x5B, 0x1A, 0x44, 0x90, 0x9D, 0x1B, 0x14, 0x9F, 0x97, 0xEE, 0xA6, 0x01, 0x39, 0x1C, 0x60, 0x9E, 0xC8, 0x1D, 0x19, 0x30, 0xF5, 0x7C, 0x18, 0xA4, 0xE0, 0xFA, 0xB4, 0x91, 0xD1, 0xCA, 0xDF, 0xD5, 0x04, 0x83, 0x44, 0x9E, 0xDC, 0x0F, 0x07, 0xFF, 0xB2, 0x4D, 0x2C, 0x6F, 0x9A, 0x9A, 0x3B, 0xFF, 0x39, 0xAE, 0x3D, 0x57, 0xF5, 0x60, 0x65, 0x4D, 0x7D, 0x75, 0xC9, 0x08, 0xAB, 0xE6, 0x25, 0x64, 0x75, 0x3E, 0xAC, 0x39, 0xD7, 0x50, 0x3D, 0xA6, 0xD3, 0x7C, 0x2E, 0x32, 0xE1, 0xAF, 0x3B, 0x8A, 0xEC, 0x8A, 0xE3, 0x06, 0x9C, 0xD9 }; test[167] = '\x80'; SHA3_sponge(test, sizeof(test), out, sizeof(out), sizeof(test)); /* * Rationale behind keeping output [formatted as below] is that * one should be able to redirect it to a file, then copy-n-paste * final "output val" from official example to another file, and * compare the two with diff(1). */ for (i = 0; i < sizeof(out);) { printf("%02X", out[i]); printf(++i % 16 && i != sizeof(out) ? " " : "\n"); } if (memcmp(out, result, sizeof(out))) { fprintf(stderr, "failure\n"); return 1; } else { fprintf(stderr, "success\n"); return 0; } } #endif
./openssl/crypto/sha/sha1dgst.c
/* * Copyright 1995-2022 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 */ /* * SHA-1 low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/crypto.h> #include <openssl/opensslconf.h> #include <openssl/opensslv.h> #include <openssl/evp.h> #include <openssl/sha.h> /* The implementation is in crypto/md32_common.h */ #include "sha_local.h" #include "crypto/sha.h" int ossl_sha1_ctrl(SHA_CTX *sha1, int cmd, int mslen, void *ms) { unsigned char padtmp[40]; unsigned char sha1tmp[SHA_DIGEST_LENGTH]; if (cmd != EVP_CTRL_SSL3_MASTER_SECRET) return -2; if (sha1 == NULL) return 0; /* SSLv3 client auth handling: see RFC-6101 5.6.8 */ if (mslen != 48) return 0; /* At this point hash contains all handshake messages, update * with master secret and pad_1. */ if (SHA1_Update(sha1, ms, mslen) <= 0) return 0; /* Set padtmp to pad_1 value */ memset(padtmp, 0x36, sizeof(padtmp)); if (!SHA1_Update(sha1, padtmp, sizeof(padtmp))) return 0; if (!SHA1_Final(sha1tmp, sha1)) return 0; /* Reinitialise context */ if (!SHA1_Init(sha1)) return 0; if (SHA1_Update(sha1, ms, mslen) <= 0) return 0; /* Set padtmp to pad_2 value */ memset(padtmp, 0x5c, sizeof(padtmp)); if (!SHA1_Update(sha1, padtmp, sizeof(padtmp))) return 0; if (!SHA1_Update(sha1, sha1tmp, sizeof(sha1tmp))) return 0; /* Now when ctx is finalised it will return the SSL v3 hash value */ OPENSSL_cleanse(sha1tmp, sizeof(sha1tmp)); return 1; }
./openssl/crypto/sha/sha1_one.c
/* * Copyright 1995-2021 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 */ /* * SHA-1 low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <stdio.h> #include <string.h> #include <openssl/crypto.h> #include <openssl/sha.h> #include <openssl/evp.h> #include "crypto/sha.h" unsigned char *ossl_sha1(const unsigned char *d, size_t n, unsigned char *md) { SHA_CTX c; static unsigned char m[SHA_DIGEST_LENGTH]; if (md == NULL) md = m; if (!SHA1_Init(&c)) return NULL; SHA1_Update(&c, d, n); SHA1_Final(md, &c); OPENSSL_cleanse(&c, sizeof(c)); return md; } unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) { static unsigned char m[SHA_DIGEST_LENGTH]; if (md == NULL) md = m; return EVP_Q_digest(NULL, "SHA1", NULL, d, n, md, NULL) ? md : NULL; } unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md) { static unsigned char m[SHA224_DIGEST_LENGTH]; if (md == NULL) md = m; return EVP_Q_digest(NULL, "SHA224", NULL, d, n, md, NULL) ? md : NULL; } unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md) { static unsigned char m[SHA256_DIGEST_LENGTH]; if (md == NULL) md = m; return EVP_Q_digest(NULL, "SHA256", NULL, d, n, md, NULL) ? md : NULL; } unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md) { static unsigned char m[SHA384_DIGEST_LENGTH]; if (md == NULL) md = m; return EVP_Q_digest(NULL, "SHA384", NULL, d, n, md, NULL) ? md : NULL; } unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md) { static unsigned char m[SHA512_DIGEST_LENGTH]; if (md == NULL) md = m; return EVP_Q_digest(NULL, "SHA512", NULL, d, n, md, NULL) ? md : NULL; }
./openssl/crypto/sha/sha_ppc.c
/* * Copyright 2009-2021 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 */ #include <stdlib.h> #include <string.h> #include <openssl/opensslconf.h> #include <openssl/sha.h> #include "crypto/ppc_arch.h" void sha256_block_p8(void *ctx, const void *inp, size_t len); void sha256_block_ppc(void *ctx, const void *inp, size_t len); void sha256_block_data_order(void *ctx, const void *inp, size_t len); void sha256_block_data_order(void *ctx, const void *inp, size_t len) { OPENSSL_ppccap_P & PPC_CRYPTO207 ? sha256_block_p8(ctx, inp, len) : sha256_block_ppc(ctx, inp, len); } void sha512_block_p8(void *ctx, const void *inp, size_t len); void sha512_block_ppc(void *ctx, const void *inp, size_t len); void sha512_block_data_order(void *ctx, const void *inp, size_t len); void sha512_block_data_order(void *ctx, const void *inp, size_t len) { OPENSSL_ppccap_P & PPC_CRYPTO207 ? sha512_block_p8(ctx, inp, len) : sha512_block_ppc(ctx, inp, len); }
./openssl/crypto/sha/sha256.c
/* * Copyright 2004-2023 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 */ /* * SHA256 low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/opensslconf.h> #include <stdlib.h> #include <string.h> #include <openssl/crypto.h> #include <openssl/sha.h> #include <openssl/opensslv.h> #include "internal/endian.h" #include "crypto/sha.h" int SHA224_Init(SHA256_CTX *c) { memset(c, 0, sizeof(*c)); c->h[0] = 0xc1059ed8UL; c->h[1] = 0x367cd507UL; c->h[2] = 0x3070dd17UL; c->h[3] = 0xf70e5939UL; c->h[4] = 0xffc00b31UL; c->h[5] = 0x68581511UL; c->h[6] = 0x64f98fa7UL; c->h[7] = 0xbefa4fa4UL; c->md_len = SHA224_DIGEST_LENGTH; return 1; } int SHA256_Init(SHA256_CTX *c) { memset(c, 0, sizeof(*c)); c->h[0] = 0x6a09e667UL; c->h[1] = 0xbb67ae85UL; c->h[2] = 0x3c6ef372UL; c->h[3] = 0xa54ff53aUL; c->h[4] = 0x510e527fUL; c->h[5] = 0x9b05688cUL; c->h[6] = 0x1f83d9abUL; c->h[7] = 0x5be0cd19UL; c->md_len = SHA256_DIGEST_LENGTH; return 1; } int ossl_sha256_192_init(SHA256_CTX *c) { SHA256_Init(c); c->md_len = SHA256_192_DIGEST_LENGTH; return 1; } int SHA224_Update(SHA256_CTX *c, const void *data, size_t len) { return SHA256_Update(c, data, len); } int SHA224_Final(unsigned char *md, SHA256_CTX *c) { return SHA256_Final(md, c); } #define DATA_ORDER_IS_BIG_ENDIAN #define HASH_LONG SHA_LONG #define HASH_CTX SHA256_CTX #define HASH_CBLOCK SHA_CBLOCK /* * Note that FIPS180-2 discusses "Truncation of the Hash Function Output." * default: case below covers for it. It's not clear however if it's * permitted to truncate to amount of bytes not divisible by 4. I bet not, * but if it is, then default: case shall be extended. For reference. * Idea behind separate cases for pre-defined lengths is to let the * compiler decide if it's appropriate to unroll small loops. */ #define HASH_MAKE_STRING(c,s) do { \ unsigned long ll; \ unsigned int nn; \ switch ((c)->md_len) \ { case SHA256_192_DIGEST_LENGTH: \ for (nn=0;nn<SHA256_192_DIGEST_LENGTH/4;nn++) \ { ll=(c)->h[nn]; (void)HOST_l2c(ll,(s)); } \ break; \ case SHA224_DIGEST_LENGTH: \ for (nn=0;nn<SHA224_DIGEST_LENGTH/4;nn++) \ { ll=(c)->h[nn]; (void)HOST_l2c(ll,(s)); } \ break; \ case SHA256_DIGEST_LENGTH: \ for (nn=0;nn<SHA256_DIGEST_LENGTH/4;nn++) \ { ll=(c)->h[nn]; (void)HOST_l2c(ll,(s)); } \ break; \ default: \ if ((c)->md_len > SHA256_DIGEST_LENGTH) \ return 0; \ for (nn=0;nn<(c)->md_len/4;nn++) \ { ll=(c)->h[nn]; (void)HOST_l2c(ll,(s)); } \ break; \ } \ } while (0) #define HASH_UPDATE SHA256_Update #define HASH_TRANSFORM SHA256_Transform #define HASH_FINAL SHA256_Final #define HASH_BLOCK_DATA_ORDER sha256_block_data_order #ifndef SHA256_ASM static #else # ifdef INCLUDE_C_SHA256 void sha256_block_data_order_c(SHA256_CTX *ctx, const void *in, size_t num); # endif /* INCLUDE_C_SHA256 */ #endif /* SHA256_ASM */ void sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num); #include "crypto/md32_common.h" #if !defined(SHA256_ASM) || defined(INCLUDE_C_SHA256) static const SHA_LONG K256[64] = { 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL }; # ifndef PEDANTIC # if defined(__GNUC__) && __GNUC__>=2 && \ !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) # if defined(__riscv_zknh) # define Sigma0(x) ({ MD32_REG_T ret; \ asm ("sha256sum0 %0, %1" \ : "=r"(ret) \ : "r"(x)); ret; }) # define Sigma1(x) ({ MD32_REG_T ret; \ asm ("sha256sum1 %0, %1" \ : "=r"(ret) \ : "r"(x)); ret; }) # define sigma0(x) ({ MD32_REG_T ret; \ asm ("sha256sig0 %0, %1" \ : "=r"(ret) \ : "r"(x)); ret; }) # define sigma1(x) ({ MD32_REG_T ret; \ asm ("sha256sig1 %0, %1" \ : "=r"(ret) \ : "r"(x)); ret; }) # endif # if defined(__riscv_zbt) || defined(__riscv_zpn) # define Ch(x,y,z) ({ MD32_REG_T ret; \ asm (".insn r4 0x33, 1, 0x3, %0, %2, %1, %3"\ : "=r"(ret) \ : "r"(x), "r"(y), "r"(z)); ret; }) # define Maj(x,y,z) ({ MD32_REG_T ret; \ asm (".insn r4 0x33, 1, 0x3, %0, %2, %1, %3"\ : "=r"(ret) \ : "r"(x^z), "r"(y), "r"(x)); ret; }) # endif # endif # endif /* * FIPS specification refers to right rotations, while our ROTATE macro * is left one. This is why you might notice that rotation coefficients * differ from those observed in FIPS document by 32-N... */ # ifndef Sigma0 # define Sigma0(x) (ROTATE((x),30) ^ ROTATE((x),19) ^ ROTATE((x),10)) # endif # ifndef Sigma1 # define Sigma1(x) (ROTATE((x),26) ^ ROTATE((x),21) ^ ROTATE((x),7)) # endif # ifndef sigma0 # define sigma0(x) (ROTATE((x),25) ^ ROTATE((x),14) ^ ((x)>>3)) # endif # ifndef sigma1 # define sigma1(x) (ROTATE((x),15) ^ ROTATE((x),13) ^ ((x)>>10)) # endif # ifndef Ch # define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) # endif # ifndef Maj # define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) # endif # ifdef OPENSSL_SMALL_FOOTPRINT static void sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num) { unsigned MD32_REG_T a, b, c, d, e, f, g, h, s0, s1, T1, T2; SHA_LONG X[16], l; int i; const unsigned char *data = in; while (num--) { a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; for (i = 0; i < 16; i++) { (void)HOST_c2l(data, l); T1 = X[i] = l; T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i]; T2 = Sigma0(a) + Maj(a, b, c); h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; } for (; i < 64; i++) { s0 = X[(i + 1) & 0x0f]; s0 = sigma0(s0); s1 = X[(i + 14) & 0x0f]; s1 = sigma1(s1); T1 = X[i & 0xf] += s0 + s1 + X[(i + 9) & 0xf]; T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i]; T2 = Sigma0(a) + Maj(a, b, c); h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; } ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d; ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h; } } # else # define ROUND_00_15(i,a,b,c,d,e,f,g,h) do { \ T1 += h + Sigma1(e) + Ch(e,f,g) + K256[i]; \ h = Sigma0(a) + Maj(a,b,c); \ d += T1; h += T1; } while (0) # define ROUND_16_63(i,a,b,c,d,e,f,g,h,X) do { \ s0 = X[(i+1)&0x0f]; s0 = sigma0(s0); \ s1 = X[(i+14)&0x0f]; s1 = sigma1(s1); \ T1 = X[(i)&0x0f] += s0 + s1 + X[(i+9)&0x0f]; \ ROUND_00_15(i,a,b,c,d,e,f,g,h); } while (0) #ifdef INCLUDE_C_SHA256 void sha256_block_data_order_c(SHA256_CTX *ctx, const void *in, size_t num) #else static void sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num) #endif { unsigned MD32_REG_T a, b, c, d, e, f, g, h, s0, s1, T1; SHA_LONG X[16]; int i; const unsigned char *data = in; DECLARE_IS_ENDIAN; while (num--) { a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; if (!IS_LITTLE_ENDIAN && sizeof(SHA_LONG) == 4 && ((size_t)in % 4) == 0) { const SHA_LONG *W = (const SHA_LONG *)data; T1 = X[0] = W[0]; ROUND_00_15(0, a, b, c, d, e, f, g, h); T1 = X[1] = W[1]; ROUND_00_15(1, h, a, b, c, d, e, f, g); T1 = X[2] = W[2]; ROUND_00_15(2, g, h, a, b, c, d, e, f); T1 = X[3] = W[3]; ROUND_00_15(3, f, g, h, a, b, c, d, e); T1 = X[4] = W[4]; ROUND_00_15(4, e, f, g, h, a, b, c, d); T1 = X[5] = W[5]; ROUND_00_15(5, d, e, f, g, h, a, b, c); T1 = X[6] = W[6]; ROUND_00_15(6, c, d, e, f, g, h, a, b); T1 = X[7] = W[7]; ROUND_00_15(7, b, c, d, e, f, g, h, a); T1 = X[8] = W[8]; ROUND_00_15(8, a, b, c, d, e, f, g, h); T1 = X[9] = W[9]; ROUND_00_15(9, h, a, b, c, d, e, f, g); T1 = X[10] = W[10]; ROUND_00_15(10, g, h, a, b, c, d, e, f); T1 = X[11] = W[11]; ROUND_00_15(11, f, g, h, a, b, c, d, e); T1 = X[12] = W[12]; ROUND_00_15(12, e, f, g, h, a, b, c, d); T1 = X[13] = W[13]; ROUND_00_15(13, d, e, f, g, h, a, b, c); T1 = X[14] = W[14]; ROUND_00_15(14, c, d, e, f, g, h, a, b); T1 = X[15] = W[15]; ROUND_00_15(15, b, c, d, e, f, g, h, a); data += SHA256_CBLOCK; } else { SHA_LONG l; (void)HOST_c2l(data, l); T1 = X[0] = l; ROUND_00_15(0, a, b, c, d, e, f, g, h); (void)HOST_c2l(data, l); T1 = X[1] = l; ROUND_00_15(1, h, a, b, c, d, e, f, g); (void)HOST_c2l(data, l); T1 = X[2] = l; ROUND_00_15(2, g, h, a, b, c, d, e, f); (void)HOST_c2l(data, l); T1 = X[3] = l; ROUND_00_15(3, f, g, h, a, b, c, d, e); (void)HOST_c2l(data, l); T1 = X[4] = l; ROUND_00_15(4, e, f, g, h, a, b, c, d); (void)HOST_c2l(data, l); T1 = X[5] = l; ROUND_00_15(5, d, e, f, g, h, a, b, c); (void)HOST_c2l(data, l); T1 = X[6] = l; ROUND_00_15(6, c, d, e, f, g, h, a, b); (void)HOST_c2l(data, l); T1 = X[7] = l; ROUND_00_15(7, b, c, d, e, f, g, h, a); (void)HOST_c2l(data, l); T1 = X[8] = l; ROUND_00_15(8, a, b, c, d, e, f, g, h); (void)HOST_c2l(data, l); T1 = X[9] = l; ROUND_00_15(9, h, a, b, c, d, e, f, g); (void)HOST_c2l(data, l); T1 = X[10] = l; ROUND_00_15(10, g, h, a, b, c, d, e, f); (void)HOST_c2l(data, l); T1 = X[11] = l; ROUND_00_15(11, f, g, h, a, b, c, d, e); (void)HOST_c2l(data, l); T1 = X[12] = l; ROUND_00_15(12, e, f, g, h, a, b, c, d); (void)HOST_c2l(data, l); T1 = X[13] = l; ROUND_00_15(13, d, e, f, g, h, a, b, c); (void)HOST_c2l(data, l); T1 = X[14] = l; ROUND_00_15(14, c, d, e, f, g, h, a, b); (void)HOST_c2l(data, l); T1 = X[15] = l; ROUND_00_15(15, b, c, d, e, f, g, h, a); } for (i = 16; i < 64; i += 8) { ROUND_16_63(i + 0, a, b, c, d, e, f, g, h, X); ROUND_16_63(i + 1, h, a, b, c, d, e, f, g, X); ROUND_16_63(i + 2, g, h, a, b, c, d, e, f, X); ROUND_16_63(i + 3, f, g, h, a, b, c, d, e, X); ROUND_16_63(i + 4, e, f, g, h, a, b, c, d, X); ROUND_16_63(i + 5, d, e, f, g, h, a, b, c, X); ROUND_16_63(i + 6, c, d, e, f, g, h, a, b, X); ROUND_16_63(i + 7, b, c, d, e, f, g, h, a, X); } ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d; ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h; } } # endif #endif /* SHA256_ASM */
./openssl/crypto/rsa/rsa_pk1.c
/* * Copyright 1995-2023 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 */ /* * RSA low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include "internal/constant_time.h" #include <stdio.h> #include <openssl/bn.h> #include <openssl/rsa.h> #include <openssl/rand.h> /* Just for the SSL_MAX_MASTER_KEY_LENGTH value */ #include <openssl/prov_ssl.h> #include <openssl/evp.h> #include <openssl/sha.h> #include <openssl/hmac.h> #include "internal/cryptlib.h" #include "crypto/rsa.h" #include "rsa_local.h" int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, const unsigned char *from, int flen) { int j; unsigned char *p; if (flen > (tlen - RSA_PKCS1_PADDING_SIZE)) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); return 0; } p = (unsigned char *)to; *(p++) = 0; *(p++) = 1; /* Private Key BT (Block Type) */ /* pad out with 0xff data */ j = tlen - 3 - flen; memset(p, 0xff, j); p += j; *(p++) = '\0'; memcpy(p, from, (unsigned int)flen); return 1; } int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, const unsigned char *from, int flen, int num) { int i, j; const unsigned char *p; p = from; /* * The format is * 00 || 01 || PS || 00 || D * PS - padding string, at least 8 bytes of FF * D - data. */ if (num < RSA_PKCS1_PADDING_SIZE) return -1; /* Accept inputs with and without the leading 0-byte. */ if (num == flen) { if ((*p++) != 0x00) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_PADDING); return -1; } flen--; } if ((num != (flen + 1)) || (*(p++) != 0x01)) { ERR_raise(ERR_LIB_RSA, RSA_R_BLOCK_TYPE_IS_NOT_01); return -1; } /* scan over padding data */ j = flen - 1; /* one for type. */ for (i = 0; i < j; i++) { if (*p != 0xff) { /* should decrypt to 0xff */ if (*p == 0) { p++; break; } else { ERR_raise(ERR_LIB_RSA, RSA_R_BAD_FIXED_HEADER_DECRYPT); return -1; } } p++; } if (i == j) { ERR_raise(ERR_LIB_RSA, RSA_R_NULL_BEFORE_BLOCK_MISSING); return -1; } if (i < 8) { ERR_raise(ERR_LIB_RSA, RSA_R_BAD_PAD_BYTE_COUNT); return -1; } i++; /* Skip over the '\0' */ j -= i; if (j > tlen) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE); return -1; } memcpy(to, p, (unsigned int)j); return j; } int ossl_rsa_padding_add_PKCS1_type_2_ex(OSSL_LIB_CTX *libctx, unsigned char *to, int tlen, const unsigned char *from, int flen) { int i, j; unsigned char *p; if (flen > (tlen - RSA_PKCS1_PADDING_SIZE)) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); return 0; } else if (flen < 0) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_LENGTH); return 0; } p = (unsigned char *)to; *(p++) = 0; *(p++) = 2; /* Public Key BT (Block Type) */ /* pad out with non-zero random data */ j = tlen - 3 - flen; if (RAND_bytes_ex(libctx, p, j, 0) <= 0) return 0; for (i = 0; i < j; i++) { if (*p == '\0') do { if (RAND_bytes_ex(libctx, p, 1, 0) <= 0) return 0; } while (*p == '\0'); p++; } *(p++) = '\0'; memcpy(p, from, (unsigned int)flen); return 1; } int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, const unsigned char *from, int flen) { return ossl_rsa_padding_add_PKCS1_type_2_ex(NULL, to, tlen, from, flen); } int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, const unsigned char *from, int flen, int num) { int i; /* |em| is the encoded message, zero-padded to exactly |num| bytes */ unsigned char *em = NULL; unsigned int good, found_zero_byte, mask; int zero_index = 0, msg_index, mlen = -1; if (tlen <= 0 || flen <= 0) return -1; /* * PKCS#1 v1.5 decryption. See "PKCS #1 v2.2: RSA Cryptography Standard", * section 7.2.2. */ if (flen > num || num < RSA_PKCS1_PADDING_SIZE) { ERR_raise(ERR_LIB_RSA, RSA_R_PKCS_DECODING_ERROR); return -1; } em = OPENSSL_malloc(num); if (em == NULL) return -1; /* * Caller is encouraged to pass zero-padded message created with * BN_bn2binpad. Trouble is that since we can't read out of |from|'s * bounds, it's impossible to have an invariant memory access pattern * in case |from| was not zero-padded in advance. */ for (from += flen, em += num, i = 0; i < num; i++) { mask = ~constant_time_is_zero(flen); flen -= 1 & mask; from -= 1 & mask; *--em = *from & mask; } good = constant_time_is_zero(em[0]); good &= constant_time_eq(em[1], 2); /* scan over padding data */ found_zero_byte = 0; for (i = 2; i < num; i++) { unsigned int equals0 = constant_time_is_zero(em[i]); zero_index = constant_time_select_int(~found_zero_byte & equals0, i, zero_index); found_zero_byte |= equals0; } /* * PS must be at least 8 bytes long, and it starts two bytes into |em|. * If we never found a 0-byte, then |zero_index| is 0 and the check * also fails. */ good &= constant_time_ge(zero_index, 2 + 8); /* * Skip the zero byte. This is incorrect if we never found a zero-byte * but in this case we also do not copy the message out. */ msg_index = zero_index + 1; mlen = num - msg_index; /* * For good measure, do this check in constant time as well. */ good &= constant_time_ge(tlen, mlen); /* * Move the result in-place by |num|-RSA_PKCS1_PADDING_SIZE-|mlen| bytes to the left. * Then if |good| move |mlen| bytes from |em|+RSA_PKCS1_PADDING_SIZE to |to|. * Otherwise leave |to| unchanged. * Copy the memory back in a way that does not reveal the size of * the data being copied via a timing side channel. This requires copying * parts of the buffer multiple times based on the bits set in the real * length. Clear bits do a non-copy with identical access pattern. * The loop below has overall complexity of O(N*log(N)). */ tlen = constant_time_select_int(constant_time_lt(num - RSA_PKCS1_PADDING_SIZE, tlen), num - RSA_PKCS1_PADDING_SIZE, tlen); for (msg_index = 1; msg_index < num - RSA_PKCS1_PADDING_SIZE; msg_index <<= 1) { mask = ~constant_time_eq(msg_index & (num - RSA_PKCS1_PADDING_SIZE - mlen), 0); for (i = RSA_PKCS1_PADDING_SIZE; i < num - msg_index; i++) em[i] = constant_time_select_8(mask, em[i + msg_index], em[i]); } for (i = 0; i < tlen; i++) { mask = good & constant_time_lt(i, mlen); to[i] = constant_time_select_8(mask, em[i + RSA_PKCS1_PADDING_SIZE], to[i]); } OPENSSL_clear_free(em, num); #ifndef FIPS_MODULE /* * This trick doesn't work in the FIPS provider because libcrypto manages * the error stack. Instead we opt not to put an error on the stack at all * in case of padding failure in the FIPS provider. */ ERR_raise(ERR_LIB_RSA, RSA_R_PKCS_DECODING_ERROR); err_clear_last_constant_time(1 & good); #endif return constant_time_select_int(good, mlen, -1); } static int ossl_rsa_prf(OSSL_LIB_CTX *ctx, unsigned char *to, int tlen, const char *label, int llen, const unsigned char *kdk, uint16_t bitlen) { int pos; int ret = -1; uint16_t iter = 0; unsigned char be_iter[sizeof(iter)]; unsigned char be_bitlen[sizeof(bitlen)]; HMAC_CTX *hmac = NULL; EVP_MD *md = NULL; unsigned char hmac_out[SHA256_DIGEST_LENGTH]; unsigned int md_len; if (tlen * 8 != bitlen) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); return ret; } be_bitlen[0] = (bitlen >> 8) & 0xff; be_bitlen[1] = bitlen & 0xff; hmac = HMAC_CTX_new(); if (hmac == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } /* * we use hardcoded hash so that migrating between versions that use * different hash doesn't provide a Bleichenbacher oracle: * if the attacker can see that different versions return different * messages for the same ciphertext, they'll know that the message is * synthetically generated, which means that the padding check failed */ md = EVP_MD_fetch(ctx, "sha256", NULL); if (md == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } if (HMAC_Init_ex(hmac, kdk, SHA256_DIGEST_LENGTH, md, NULL) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } for (pos = 0; pos < tlen; pos += SHA256_DIGEST_LENGTH, iter++) { if (HMAC_Init_ex(hmac, NULL, 0, NULL, NULL) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } be_iter[0] = (iter >> 8) & 0xff; be_iter[1] = iter & 0xff; if (HMAC_Update(hmac, be_iter, sizeof(be_iter)) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } if (HMAC_Update(hmac, (unsigned char *)label, llen) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } if (HMAC_Update(hmac, be_bitlen, sizeof(be_bitlen)) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } /* * HMAC_Final requires the output buffer to fit the whole MAC * value, so we need to use the intermediate buffer for the last * unaligned block */ md_len = SHA256_DIGEST_LENGTH; if (pos + SHA256_DIGEST_LENGTH > tlen) { if (HMAC_Final(hmac, hmac_out, &md_len) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } memcpy(to + pos, hmac_out, tlen - pos); } else { if (HMAC_Final(hmac, to + pos, &md_len) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } } } ret = 0; err: HMAC_CTX_free(hmac); EVP_MD_free(md); return ret; } /* * ossl_rsa_padding_check_PKCS1_type_2() checks and removes the PKCS#1 type 2 * padding from a decrypted RSA message. Unlike the * RSA_padding_check_PKCS1_type_2() it will not return an error in case it * detects a padding error, rather it will return a deterministically generated * random message. In other words it will perform an implicit rejection * of an invalid padding. This means that the returned value does not indicate * if the padding of the encrypted message was correct or not, making * side channel attacks like the ones described by Bleichenbacher impossible * without access to the full decrypted value and a brute-force search of * remaining padding bytes */ int ossl_rsa_padding_check_PKCS1_type_2(OSSL_LIB_CTX *ctx, unsigned char *to, int tlen, const unsigned char *from, int flen, int num, unsigned char *kdk) { /* * We need to generate a random length for the synthetic message, to avoid * bias towards zero and avoid non-constant timeness of DIV, we prepare * 128 values to check if they are not too large for the used key size, * and use 0 in case none of them are small enough, as 2^-128 is a good enough * safety margin */ #define MAX_LEN_GEN_TRIES 128 unsigned char *synthetic = NULL; int synthetic_length; uint16_t len_candidate; unsigned char candidate_lengths[MAX_LEN_GEN_TRIES * sizeof(len_candidate)]; uint16_t len_mask; uint16_t max_sep_offset; int synth_msg_index = 0; int ret = -1; int i, j; unsigned int good, found_zero_byte; int zero_index = 0, msg_index; /* * If these checks fail then either the message in publicly invalid, or * we've been called incorrectly. We can fail immediately. * Since this code is called only internally by openssl, those are just * sanity checks */ if (num != flen || tlen <= 0 || flen <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); return -1; } /* Generate a random message to return in case the padding checks fail */ synthetic = OPENSSL_malloc(flen); if (synthetic == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_MALLOC_FAILURE); return -1; } if (ossl_rsa_prf(ctx, synthetic, flen, "message", 7, kdk, flen * 8) < 0) goto err; /* decide how long the random message should be */ if (ossl_rsa_prf(ctx, candidate_lengths, sizeof(candidate_lengths), "length", 6, kdk, MAX_LEN_GEN_TRIES * sizeof(len_candidate) * 8) < 0) goto err; /* * max message size is the size of the modulus size less 2 bytes for * version and padding type and a minimum of 8 bytes padding */ len_mask = max_sep_offset = flen - 2 - 8; /* * we want a mask so lets propagate the high bit to all positions less * significant than it */ len_mask |= len_mask >> 1; len_mask |= len_mask >> 2; len_mask |= len_mask >> 4; len_mask |= len_mask >> 8; synthetic_length = 0; for (i = 0; i < MAX_LEN_GEN_TRIES * (int)sizeof(len_candidate); i += sizeof(len_candidate)) { len_candidate = (candidate_lengths[i] << 8) | candidate_lengths[i + 1]; len_candidate &= len_mask; synthetic_length = constant_time_select_int( constant_time_lt(len_candidate, max_sep_offset), len_candidate, synthetic_length); } synth_msg_index = flen - synthetic_length; /* we have alternative message ready, check the real one */ good = constant_time_is_zero(from[0]); good &= constant_time_eq(from[1], 2); /* then look for the padding|message separator (the first zero byte) */ found_zero_byte = 0; for (i = 2; i < flen; i++) { unsigned int equals0 = constant_time_is_zero(from[i]); zero_index = constant_time_select_int(~found_zero_byte & equals0, i, zero_index); found_zero_byte |= equals0; } /* * padding must be at least 8 bytes long, and it starts two bytes into * |from|. If we never found a 0-byte, then |zero_index| is 0 and the check * also fails. */ good &= constant_time_ge(zero_index, 2 + 8); /* * Skip the zero byte. This is incorrect if we never found a zero-byte * but in this case we also do not copy the message out. */ msg_index = zero_index + 1; /* * old code returned an error in case the decrypted message wouldn't fit * into the |to|, since that would leak information, return the synthetic * message instead */ good &= constant_time_ge(tlen, num - msg_index); msg_index = constant_time_select_int(good, msg_index, synth_msg_index); /* * since at this point the |msg_index| does not provide the signal * indicating if the padding check failed or not, we don't have to worry * about leaking the length of returned message, we still need to ensure * that we read contents of both buffers so that cache accesses don't leak * the value of |good| */ for (i = msg_index, j = 0; i < flen && j < tlen; i++, j++) to[j] = constant_time_select_8(good, from[i], synthetic[i]); ret = j; err: /* * the only time ret < 0 is when the ciphertext is publicly invalid * or we were called with invalid parameters, so we don't have to perform * a side-channel secure raising of the error */ if (ret < 0) ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); OPENSSL_free(synthetic); return ret; } /* * ossl_rsa_padding_check_PKCS1_type_2_TLS() checks and removes the PKCS1 type 2 * padding from a decrypted RSA message in a TLS signature. The result is stored * in the buffer pointed to by |to| which should be |tlen| bytes long. |tlen| * must be at least SSL_MAX_MASTER_KEY_LENGTH. The original decrypted message * should be stored in |from| which must be |flen| bytes in length and padded * such that |flen == RSA_size()|. The TLS protocol version that the client * originally requested should be passed in |client_version|. Some buggy clients * can exist which use the negotiated version instead of the originally * requested protocol version. If it is necessary to work around this bug then * the negotiated protocol version can be passed in |alt_version|, otherwise 0 * should be passed. * * If the passed message is publicly invalid or some other error that can be * treated in non-constant time occurs then -1 is returned. On success the * length of the decrypted data is returned. This will always be * SSL_MAX_MASTER_KEY_LENGTH. If an error occurs that should be treated in * constant time then this function will appear to return successfully, but the * decrypted data will be randomly generated (as per * https://tools.ietf.org/html/rfc5246#section-7.4.7.1). */ int ossl_rsa_padding_check_PKCS1_type_2_TLS(OSSL_LIB_CTX *libctx, unsigned char *to, size_t tlen, const unsigned char *from, size_t flen, int client_version, int alt_version) { unsigned int i, good, version_good; unsigned char rand_premaster_secret[SSL_MAX_MASTER_KEY_LENGTH]; /* * If these checks fail then either the message in publicly invalid, or * we've been called incorrectly. We can fail immediately. */ if (flen < RSA_PKCS1_PADDING_SIZE + SSL_MAX_MASTER_KEY_LENGTH || tlen < SSL_MAX_MASTER_KEY_LENGTH) { ERR_raise(ERR_LIB_RSA, RSA_R_PKCS_DECODING_ERROR); return -1; } /* * Generate a random premaster secret to use in the event that we fail * to decrypt. */ if (RAND_priv_bytes_ex(libctx, rand_premaster_secret, sizeof(rand_premaster_secret), 0) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); return -1; } good = constant_time_is_zero(from[0]); good &= constant_time_eq(from[1], 2); /* Check we have the expected padding data */ for (i = 2; i < flen - SSL_MAX_MASTER_KEY_LENGTH - 1; i++) good &= ~constant_time_is_zero_8(from[i]); good &= constant_time_is_zero_8(from[flen - SSL_MAX_MASTER_KEY_LENGTH - 1]); /* * If the version in the decrypted pre-master secret is correct then * version_good will be 0xff, otherwise it'll be zero. The * Klima-Pokorny-Rosa extension of Bleichenbacher's attack * (http://eprint.iacr.org/2003/052/) exploits the version number * check as a "bad version oracle". Thus version checks are done in * constant time and are treated like any other decryption error. */ version_good = constant_time_eq(from[flen - SSL_MAX_MASTER_KEY_LENGTH], (client_version >> 8) & 0xff); version_good &= constant_time_eq(from[flen - SSL_MAX_MASTER_KEY_LENGTH + 1], client_version & 0xff); /* * The premaster secret must contain the same version number as the * ClientHello to detect version rollback attacks (strangely, the * protocol does not offer such protection for DH ciphersuites). * However, buggy clients exist that send the negotiated protocol * version instead if the server does not support the requested * protocol version. If SSL_OP_TLS_ROLLBACK_BUG is set then we tolerate * such clients. In that case alt_version will be non-zero and set to * the negotiated version. */ if (alt_version > 0) { unsigned int workaround_good; workaround_good = constant_time_eq(from[flen - SSL_MAX_MASTER_KEY_LENGTH], (alt_version >> 8) & 0xff); workaround_good &= constant_time_eq(from[flen - SSL_MAX_MASTER_KEY_LENGTH + 1], alt_version & 0xff); version_good |= workaround_good; } good &= version_good; /* * Now copy the result over to the to buffer if good, or random data if * not good. */ for (i = 0; i < SSL_MAX_MASTER_KEY_LENGTH; i++) { to[i] = constant_time_select_8(good, from[flen - SSL_MAX_MASTER_KEY_LENGTH + i], rand_premaster_secret[i]); } /* * We must not leak whether a decryption failure occurs because of * Bleichenbacher's attack on PKCS #1 v1.5 RSA padding (see RFC 2246, * section 7.4.7.1). The code follows that advice of the TLS RFC and * generates a random premaster secret for the case that the decrypt * fails. See https://tools.ietf.org/html/rfc5246#section-7.4.7.1 * So, whether we actually succeeded or not, return success. */ return SSL_MAX_MASTER_KEY_LENGTH; }
./openssl/crypto/rsa/rsa_none.c
/* * Copyright 1995-2020 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 */ /* * RSA low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include "internal/cryptlib.h" #include <openssl/bn.h> #include <openssl/rsa.h> int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *from, int flen) { if (flen > tlen) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); return 0; } if (flen < tlen) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE); return 0; } memcpy(to, from, (unsigned int)flen); return 1; } int RSA_padding_check_none(unsigned char *to, int tlen, const unsigned char *from, int flen, int num) { if (flen > tlen) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE); return -1; } memset(to, 0, tlen - flen); memcpy(to + tlen - flen, from, flen); return tlen; }
./openssl/crypto/rsa/rsa_chk.c
/* * Copyright 1999-2023 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 */ /* * RSA low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/bn.h> #include <openssl/err.h> #include "crypto/rsa.h" #include "rsa_local.h" #ifndef FIPS_MODULE static int rsa_validate_keypair_multiprime(const RSA *key, BN_GENCB *cb) { BIGNUM *i, *j, *k, *l, *m; BN_CTX *ctx; int ret = 1, ex_primes = 0, idx; RSA_PRIME_INFO *pinfo; if (key->p == NULL || key->q == NULL || key->n == NULL || key->e == NULL || key->d == NULL) { ERR_raise(ERR_LIB_RSA, RSA_R_VALUE_MISSING); return 0; } /* multi-prime? */ if (key->version == RSA_ASN1_VERSION_MULTI) { ex_primes = sk_RSA_PRIME_INFO_num(key->prime_infos); if (ex_primes <= 0 || (ex_primes + 2) > ossl_rsa_multip_cap(BN_num_bits(key->n))) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_MULTI_PRIME_KEY); return 0; } } i = BN_new(); j = BN_new(); k = BN_new(); l = BN_new(); m = BN_new(); ctx = BN_CTX_new_ex(key->libctx); if (i == NULL || j == NULL || k == NULL || l == NULL || m == NULL || ctx == NULL) { ret = -1; ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB); goto err; } if (BN_is_one(key->e)) { ret = 0; ERR_raise(ERR_LIB_RSA, RSA_R_BAD_E_VALUE); } if (!BN_is_odd(key->e)) { ret = 0; ERR_raise(ERR_LIB_RSA, RSA_R_BAD_E_VALUE); } /* p prime? */ if (BN_check_prime(key->p, ctx, cb) != 1) { ret = 0; ERR_raise(ERR_LIB_RSA, RSA_R_P_NOT_PRIME); } /* q prime? */ if (BN_check_prime(key->q, ctx, cb) != 1) { ret = 0; ERR_raise(ERR_LIB_RSA, RSA_R_Q_NOT_PRIME); } /* r_i prime? */ for (idx = 0; idx < ex_primes; idx++) { pinfo = sk_RSA_PRIME_INFO_value(key->prime_infos, idx); if (BN_check_prime(pinfo->r, ctx, cb) != 1) { ret = 0; ERR_raise(ERR_LIB_RSA, RSA_R_MP_R_NOT_PRIME); } } /* n = p*q * r_3...r_i? */ if (!BN_mul(i, key->p, key->q, ctx)) { ret = -1; goto err; } for (idx = 0; idx < ex_primes; idx++) { pinfo = sk_RSA_PRIME_INFO_value(key->prime_infos, idx); if (!BN_mul(i, i, pinfo->r, ctx)) { ret = -1; goto err; } } if (BN_cmp(i, key->n) != 0) { ret = 0; if (ex_primes) ERR_raise(ERR_LIB_RSA, RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES); else ERR_raise(ERR_LIB_RSA, RSA_R_N_DOES_NOT_EQUAL_P_Q); } /* d*e = 1 mod \lambda(n)? */ if (!BN_sub(i, key->p, BN_value_one())) { ret = -1; goto err; } if (!BN_sub(j, key->q, BN_value_one())) { ret = -1; goto err; } /* now compute k = \lambda(n) = LCM(i, j, r_3 - 1...) */ if (!BN_mul(l, i, j, ctx)) { ret = -1; goto err; } if (!BN_gcd(m, i, j, ctx)) { ret = -1; goto err; } if (!BN_div(m, NULL, l, m, ctx)) { /* remainder is 0 */ ret = -1; goto err; } for (idx = 0; idx < ex_primes; idx++) { pinfo = sk_RSA_PRIME_INFO_value(key->prime_infos, idx); if (!BN_sub(k, pinfo->r, BN_value_one())) { ret = -1; goto err; } if (!BN_mul(l, m, k, ctx)) { ret = -1; goto err; } if (!BN_gcd(m, m, k, ctx)) { ret = -1; goto err; } if (!BN_div(m, NULL, l, m, ctx)) { /* remainder is 0 */ ret = -1; goto err; } } if (!BN_mod_mul(i, key->d, key->e, m, ctx)) { ret = -1; goto err; } if (!BN_is_one(i)) { ret = 0; ERR_raise(ERR_LIB_RSA, RSA_R_D_E_NOT_CONGRUENT_TO_1); } if (key->dmp1 != NULL && key->dmq1 != NULL && key->iqmp != NULL) { /* dmp1 = d mod (p-1)? */ if (!BN_sub(i, key->p, BN_value_one())) { ret = -1; goto err; } if (!BN_mod(j, key->d, i, ctx)) { ret = -1; goto err; } if (BN_cmp(j, key->dmp1) != 0) { ret = 0; ERR_raise(ERR_LIB_RSA, RSA_R_DMP1_NOT_CONGRUENT_TO_D); } /* dmq1 = d mod (q-1)? */ if (!BN_sub(i, key->q, BN_value_one())) { ret = -1; goto err; } if (!BN_mod(j, key->d, i, ctx)) { ret = -1; goto err; } if (BN_cmp(j, key->dmq1) != 0) { ret = 0; ERR_raise(ERR_LIB_RSA, RSA_R_DMQ1_NOT_CONGRUENT_TO_D); } /* iqmp = q^-1 mod p? */ if (!BN_mod_inverse(i, key->q, key->p, ctx)) { ret = -1; goto err; } if (BN_cmp(i, key->iqmp) != 0) { ret = 0; ERR_raise(ERR_LIB_RSA, RSA_R_IQMP_NOT_INVERSE_OF_Q); } } for (idx = 0; idx < ex_primes; idx++) { pinfo = sk_RSA_PRIME_INFO_value(key->prime_infos, idx); /* d_i = d mod (r_i - 1)? */ if (!BN_sub(i, pinfo->r, BN_value_one())) { ret = -1; goto err; } if (!BN_mod(j, key->d, i, ctx)) { ret = -1; goto err; } if (BN_cmp(j, pinfo->d) != 0) { ret = 0; ERR_raise(ERR_LIB_RSA, RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D); } /* t_i = R_i ^ -1 mod r_i ? */ if (!BN_mod_inverse(i, pinfo->pp, pinfo->r, ctx)) { ret = -1; goto err; } if (BN_cmp(i, pinfo->t) != 0) { ret = 0; ERR_raise(ERR_LIB_RSA, RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R); } } err: BN_free(i); BN_free(j); BN_free(k); BN_free(l); BN_free(m); BN_CTX_free(ctx); return ret; } #endif /* FIPS_MODULE */ int ossl_rsa_validate_public(const RSA *key) { return ossl_rsa_sp800_56b_check_public(key); } int ossl_rsa_validate_private(const RSA *key) { return ossl_rsa_sp800_56b_check_private(key); } int ossl_rsa_validate_pairwise(const RSA *key) { #ifdef FIPS_MODULE return ossl_rsa_sp800_56b_check_keypair(key, NULL, -1, RSA_bits(key)); #else return rsa_validate_keypair_multiprime(key, NULL) > 0; #endif } int RSA_check_key(const RSA *key) { return RSA_check_key_ex(key, NULL); } int RSA_check_key_ex(const RSA *key, BN_GENCB *cb) { #ifdef FIPS_MODULE return ossl_rsa_validate_public(key) && ossl_rsa_validate_private(key) && ossl_rsa_validate_pairwise(key); #else return rsa_validate_keypair_multiprime(key, cb); #endif /* FIPS_MODULE */ }
./openssl/crypto/rsa/rsa_oaep.c
/* * Copyright 1999-2021 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 */ /* EME-OAEP as defined in RFC 2437 (PKCS #1 v2.0) */ /* * See Victor Shoup, "OAEP reconsidered," Nov. 2000, <URL: * http://www.shoup.net/papers/oaep.ps.Z> for problems with the security * proof for the original OAEP scheme, which EME-OAEP is based on. A new * proof can be found in E. Fujisaki, T. Okamoto, D. Pointcheval, J. Stern, * "RSA-OEAP is Still Alive!", Dec. 2000, <URL: * http://eprint.iacr.org/2000/061/>. The new proof has stronger requirements * for the underlying permutation: "partial-one-wayness" instead of * one-wayness. For the RSA function, this is an equivalent notion. */ /* * RSA low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include "internal/constant_time.h" #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/bn.h> #include <openssl/evp.h> #include <openssl/rand.h> #include <openssl/sha.h> #include "rsa_local.h" int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, const unsigned char *from, int flen, const unsigned char *param, int plen) { return ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(NULL, to, tlen, from, flen, param, plen, NULL, NULL); } /* * Perform the padding as per NIST 800-56B 7.2.2.3 * from (K) is the key material. * param (A) is the additional input. * Step numbers are included here but not in the constant time inverse below * to avoid complicating an already difficult enough function. */ int ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(OSSL_LIB_CTX *libctx, unsigned char *to, int tlen, const unsigned char *from, int flen, const unsigned char *param, int plen, const EVP_MD *md, const EVP_MD *mgf1md) { int rv = 0; int i, emlen = tlen - 1; unsigned char *db, *seed; unsigned char *dbmask = NULL; unsigned char seedmask[EVP_MAX_MD_SIZE]; int mdlen, dbmask_len = 0; if (md == NULL) { #ifndef FIPS_MODULE md = EVP_sha1(); #else ERR_raise(ERR_LIB_RSA, ERR_R_PASSED_NULL_PARAMETER); return 0; #endif } if (mgf1md == NULL) mgf1md = md; mdlen = EVP_MD_get_size(md); if (mdlen <= 0) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_LENGTH); return 0; } /* step 2b: check KLen > nLen - 2 HLen - 2 */ if (flen > emlen - 2 * mdlen - 1) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); return 0; } if (emlen < 2 * mdlen + 1) { ERR_raise(ERR_LIB_RSA, RSA_R_KEY_SIZE_TOO_SMALL); return 0; } /* step 3i: EM = 00000000 || maskedMGF || maskedDB */ to[0] = 0; seed = to + 1; db = to + mdlen + 1; /* step 3a: hash the additional input */ if (!EVP_Digest((void *)param, plen, db, NULL, md, NULL)) goto err; /* step 3b: zero bytes array of length nLen - KLen - 2 HLen -2 */ memset(db + mdlen, 0, emlen - flen - 2 * mdlen - 1); /* step 3c: DB = HA || PS || 00000001 || K */ db[emlen - flen - mdlen - 1] = 0x01; memcpy(db + emlen - flen - mdlen, from, (unsigned int)flen); /* step 3d: generate random byte string */ if (RAND_bytes_ex(libctx, seed, mdlen, 0) <= 0) goto err; dbmask_len = emlen - mdlen; dbmask = OPENSSL_malloc(dbmask_len); if (dbmask == NULL) goto err; /* step 3e: dbMask = MGF(mgfSeed, nLen - HLen - 1) */ if (PKCS1_MGF1(dbmask, dbmask_len, seed, mdlen, mgf1md) < 0) goto err; /* step 3f: maskedDB = DB XOR dbMask */ for (i = 0; i < dbmask_len; i++) db[i] ^= dbmask[i]; /* step 3g: mgfSeed = MGF(maskedDB, HLen) */ if (PKCS1_MGF1(seedmask, mdlen, db, dbmask_len, mgf1md) < 0) goto err; /* stepo 3h: maskedMGFSeed = mgfSeed XOR mgfSeedMask */ for (i = 0; i < mdlen; i++) seed[i] ^= seedmask[i]; rv = 1; err: OPENSSL_cleanse(seedmask, sizeof(seedmask)); OPENSSL_clear_free(dbmask, dbmask_len); return rv; } int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, const unsigned char *from, int flen, const unsigned char *param, int plen, const EVP_MD *md, const EVP_MD *mgf1md) { return ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(NULL, to, tlen, from, flen, param, plen, md, mgf1md); } int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, const unsigned char *from, int flen, int num, const unsigned char *param, int plen) { return RSA_padding_check_PKCS1_OAEP_mgf1(to, tlen, from, flen, num, param, plen, NULL, NULL); } int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, const unsigned char *from, int flen, int num, const unsigned char *param, int plen, const EVP_MD *md, const EVP_MD *mgf1md) { int i, dblen = 0, mlen = -1, one_index = 0, msg_index; unsigned int good = 0, found_one_byte, mask; const unsigned char *maskedseed, *maskeddb; /* * |em| is the encoded message, zero-padded to exactly |num| bytes: em = * Y || maskedSeed || maskedDB */ unsigned char *db = NULL, *em = NULL, seed[EVP_MAX_MD_SIZE], phash[EVP_MAX_MD_SIZE]; int mdlen; if (md == NULL) { #ifndef FIPS_MODULE md = EVP_sha1(); #else ERR_raise(ERR_LIB_RSA, ERR_R_PASSED_NULL_PARAMETER); return -1; #endif } if (mgf1md == NULL) mgf1md = md; mdlen = EVP_MD_get_size(md); if (tlen <= 0 || flen <= 0) return -1; /* * |num| is the length of the modulus; |flen| is the length of the * encoded message. Therefore, for any |from| that was obtained by * decrypting a ciphertext, we must have |flen| <= |num|. Similarly, * |num| >= 2 * |mdlen| + 2 must hold for the modulus irrespective of * the ciphertext, see PKCS #1 v2.2, section 7.1.2. * This does not leak any side-channel information. */ if (num < flen || num < 2 * mdlen + 2) { ERR_raise(ERR_LIB_RSA, RSA_R_OAEP_DECODING_ERROR); return -1; } dblen = num - mdlen - 1; db = OPENSSL_malloc(dblen); if (db == NULL) goto cleanup; em = OPENSSL_malloc(num); if (em == NULL) goto cleanup; /* * Caller is encouraged to pass zero-padded message created with * BN_bn2binpad. Trouble is that since we can't read out of |from|'s * bounds, it's impossible to have an invariant memory access pattern * in case |from| was not zero-padded in advance. */ for (from += flen, em += num, i = 0; i < num; i++) { mask = ~constant_time_is_zero(flen); flen -= 1 & mask; from -= 1 & mask; *--em = *from & mask; } /* * The first byte must be zero, however we must not leak if this is * true. See James H. Manger, "A Chosen Ciphertext Attack on RSA * Optimal Asymmetric Encryption Padding (OAEP) [...]", CRYPTO 2001). */ good = constant_time_is_zero(em[0]); maskedseed = em + 1; maskeddb = em + 1 + mdlen; if (PKCS1_MGF1(seed, mdlen, maskeddb, dblen, mgf1md)) goto cleanup; for (i = 0; i < mdlen; i++) seed[i] ^= maskedseed[i]; if (PKCS1_MGF1(db, dblen, seed, mdlen, mgf1md)) goto cleanup; for (i = 0; i < dblen; i++) db[i] ^= maskeddb[i]; if (!EVP_Digest((void *)param, plen, phash, NULL, md, NULL)) goto cleanup; good &= constant_time_is_zero(CRYPTO_memcmp(db, phash, mdlen)); found_one_byte = 0; for (i = mdlen; i < dblen; i++) { /* * Padding consists of a number of 0-bytes, followed by a 1. */ unsigned int equals1 = constant_time_eq(db[i], 1); unsigned int equals0 = constant_time_is_zero(db[i]); one_index = constant_time_select_int(~found_one_byte & equals1, i, one_index); found_one_byte |= equals1; good &= (found_one_byte | equals0); } good &= found_one_byte; /* * At this point |good| is zero unless the plaintext was valid, * so plaintext-awareness ensures timing side-channels are no longer a * concern. */ msg_index = one_index + 1; mlen = dblen - msg_index; /* * For good measure, do this check in constant time as well. */ good &= constant_time_ge(tlen, mlen); /* * Move the result in-place by |dblen|-|mdlen|-1-|mlen| bytes to the left. * Then if |good| move |mlen| bytes from |db|+|mdlen|+1 to |to|. * Otherwise leave |to| unchanged. * Copy the memory back in a way that does not reveal the size of * the data being copied via a timing side channel. This requires copying * parts of the buffer multiple times based on the bits set in the real * length. Clear bits do a non-copy with identical access pattern. * The loop below has overall complexity of O(N*log(N)). */ tlen = constant_time_select_int(constant_time_lt(dblen - mdlen - 1, tlen), dblen - mdlen - 1, tlen); for (msg_index = 1; msg_index < dblen - mdlen - 1; msg_index <<= 1) { mask = ~constant_time_eq(msg_index & (dblen - mdlen - 1 - mlen), 0); for (i = mdlen + 1; i < dblen - msg_index; i++) db[i] = constant_time_select_8(mask, db[i + msg_index], db[i]); } for (i = 0; i < tlen; i++) { mask = good & constant_time_lt(i, mlen); to[i] = constant_time_select_8(mask, db[i + mdlen + 1], to[i]); } #ifndef FIPS_MODULE /* * To avoid chosen ciphertext attacks, the error message should not * reveal which kind of decoding error happened. * * This trick doesn't work in the FIPS provider because libcrypto manages * the error stack. Instead we opt not to put an error on the stack at all * in case of padding failure in the FIPS provider. */ ERR_raise(ERR_LIB_RSA, RSA_R_OAEP_DECODING_ERROR); err_clear_last_constant_time(1 & good); #endif cleanup: OPENSSL_cleanse(seed, sizeof(seed)); OPENSSL_clear_free(db, dblen); OPENSSL_clear_free(em, num); return constant_time_select_int(good, mlen, -1); } /* * Mask Generation Function corresponding to section 7.2.2.2 of NIST SP 800-56B. * The variables are named differently to NIST: * mask (T) and len (maskLen)are the returned mask. * seed (mgfSeed). * The range checking steps inm the process are performed outside. */ int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, long seedlen, const EVP_MD *dgst) { long i, outlen = 0; unsigned char cnt[4]; EVP_MD_CTX *c = EVP_MD_CTX_new(); unsigned char md[EVP_MAX_MD_SIZE]; int mdlen; int rv = -1; if (c == NULL) goto err; mdlen = EVP_MD_get_size(dgst); if (mdlen < 0) goto err; /* step 4 */ for (i = 0; outlen < len; i++) { /* step 4a: D = I2BS(counter, 4) */ cnt[0] = (unsigned char)((i >> 24) & 255); cnt[1] = (unsigned char)((i >> 16) & 255); cnt[2] = (unsigned char)((i >> 8)) & 255; cnt[3] = (unsigned char)(i & 255); /* step 4b: T =T || hash(mgfSeed || D) */ if (!EVP_DigestInit_ex(c, dgst, NULL) || !EVP_DigestUpdate(c, seed, seedlen) || !EVP_DigestUpdate(c, cnt, 4)) goto err; if (outlen + mdlen <= len) { if (!EVP_DigestFinal_ex(c, mask + outlen, NULL)) goto err; outlen += mdlen; } else { if (!EVP_DigestFinal_ex(c, md, NULL)) goto err; memcpy(mask + outlen, md, len - outlen); outlen = len; } } rv = 0; err: OPENSSL_cleanse(md, sizeof(md)); EVP_MD_CTX_free(c); return rv; }
./openssl/crypto/rsa/rsa_depr.c
/* * Copyright 2002-2020 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 */ /* * NB: This file contains deprecated functions (compatibility wrappers to the * "new" versions). */ /* * RSA low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <openssl/opensslconf.h> #include <stdio.h> #include <time.h> #include "internal/cryptlib.h" #include <openssl/bn.h> #include <openssl/rsa.h> RSA *RSA_generate_key(int bits, unsigned long e_value, void (*callback) (int, int, void *), void *cb_arg) { int i; BN_GENCB *cb = BN_GENCB_new(); RSA *rsa = RSA_new(); BIGNUM *e = BN_new(); if (cb == NULL || rsa == NULL || e == NULL) goto err; /* * The problem is when building with 8, 16, or 32 BN_ULONG, unsigned long * can be larger */ for (i = 0; i < (int)sizeof(unsigned long) * 8; i++) { if (e_value & (1UL << i)) if (BN_set_bit(e, i) == 0) goto err; } BN_GENCB_set_old(cb, callback, cb_arg); if (RSA_generate_key_ex(rsa, bits, e, cb)) { BN_free(e); BN_GENCB_free(cb); return rsa; } err: BN_free(e); RSA_free(rsa); BN_GENCB_free(cb); return 0; }
./openssl/crypto/rsa/rsa_x931g.c
/* * Copyright 1995-2023 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 */ /* * RSA low level APIs are deprecated for public use, but still ok for * internal use. */ #define OPENSSL_SUPPRESS_DEPRECATED #include <stdio.h> #include <string.h> #include <time.h> #include <openssl/err.h> #include <openssl/bn.h> #include "rsa_local.h" /* X9.31 RSA key derivation and generation */ int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, BIGNUM *q2, const BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *Xq1, const BIGNUM *Xq2, const BIGNUM *Xq, const BIGNUM *e, BN_GENCB *cb) { BIGNUM *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL; BN_CTX *ctx = NULL, *ctx2 = NULL; int ret = 0; if (rsa == NULL) goto err; ctx = BN_CTX_new_ex(rsa->libctx); if (ctx == NULL) goto err; BN_CTX_start(ctx); r0 = BN_CTX_get(ctx); r1 = BN_CTX_get(ctx); r2 = BN_CTX_get(ctx); r3 = BN_CTX_get(ctx); if (r3 == NULL) goto err; if (!rsa->e) { rsa->e = BN_dup(e); if (!rsa->e) goto err; } else { e = rsa->e; } /* * If not all parameters present only calculate what we can. This allows * test programs to output selective parameters. */ if (Xp && rsa->p == NULL) { rsa->p = BN_new(); if (rsa->p == NULL) goto err; if (!BN_X931_derive_prime_ex(rsa->p, p1, p2, Xp, Xp1, Xp2, e, ctx, cb)) goto err; } if (Xq && rsa->q == NULL) { rsa->q = BN_new(); if (rsa->q == NULL) goto err; if (!BN_X931_derive_prime_ex(rsa->q, q1, q2, Xq, Xq1, Xq2, e, ctx, cb)) goto err; } if (rsa->p == NULL || rsa->q == NULL) { BN_CTX_end(ctx); BN_CTX_free(ctx); return 2; } /* * Since both primes are set we can now calculate all remaining * components. */ /* calculate n */ rsa->n = BN_new(); if (rsa->n == NULL) goto err; if (!BN_mul(rsa->n, rsa->p, rsa->q, ctx)) goto err; /* calculate d */ if (!BN_sub(r1, rsa->p, BN_value_one())) goto err; /* p-1 */ if (!BN_sub(r2, rsa->q, BN_value_one())) goto err; /* q-1 */ if (!BN_mul(r0, r1, r2, ctx)) goto err; /* (p-1)(q-1) */ if (!BN_gcd(r3, r1, r2, ctx)) goto err; if (!BN_div(r0, NULL, r0, r3, ctx)) goto err; /* LCM((p-1)(q-1)) */ ctx2 = BN_CTX_new(); if (ctx2 == NULL) goto err; rsa->d = BN_mod_inverse(NULL, rsa->e, r0, ctx2); /* d */ if (rsa->d == NULL) goto err; /* calculate d mod (p-1) */ rsa->dmp1 = BN_new(); if (rsa->dmp1 == NULL) goto err; if (!BN_mod(rsa->dmp1, rsa->d, r1, ctx)) goto err; /* calculate d mod (q-1) */ rsa->dmq1 = BN_new(); if (rsa->dmq1 == NULL) goto err; if (!BN_mod(rsa->dmq1, rsa->d, r2, ctx)) goto err; /* calculate inverse of q mod p */ rsa->iqmp = BN_mod_inverse(NULL, rsa->q, rsa->p, ctx2); if (rsa->iqmp == NULL) goto err; rsa->dirty_cnt++; ret = 1; err: BN_CTX_end(ctx); BN_CTX_free(ctx); BN_CTX_free(ctx2); return ret; } int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_GENCB *cb) { int ok = 0; BIGNUM *Xp = NULL, *Xq = NULL; BN_CTX *ctx = NULL; ctx = BN_CTX_new_ex(rsa->libctx); if (ctx == NULL) goto error; BN_CTX_start(ctx); Xp = BN_CTX_get(ctx); Xq = BN_CTX_get(ctx); if (Xq == NULL) goto error; if (!BN_X931_generate_Xpq(Xp, Xq, bits, ctx)) goto error; rsa->p = BN_new(); rsa->q = BN_new(); if (rsa->p == NULL || rsa->q == NULL) goto error; /* Generate two primes from Xp, Xq */ if (!BN_X931_generate_prime_ex(rsa->p, NULL, NULL, NULL, NULL, Xp, e, ctx, cb)) goto error; if (!BN_X931_generate_prime_ex(rsa->q, NULL, NULL, NULL, NULL, Xq, e, ctx, cb)) goto error; /* * Since rsa->p and rsa->q are valid this call will just derive remaining * RSA components. */ if (!RSA_X931_derive_ex(rsa, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, e, cb)) goto error; rsa->dirty_cnt++; ok = 1; error: BN_CTX_end(ctx); BN_CTX_free(ctx); if (ok) return 1; return 0; }
./openssl/crypto/rsa/rsa_schemes.c
/* * Copyright 2020 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 */ #include <openssl/core.h> #include <openssl/core_names.h> #include <openssl/evp.h> #include <openssl/obj_mac.h> #include "internal/nelem.h" #include "crypto/rsa.h" static int meth2nid(const void *meth, int (*meth_is_a)(const void *meth, const char *name), const OSSL_ITEM *items, size_t items_n) { size_t i; if (meth != NULL) for (i = 0; i < items_n; i++) if (meth_is_a(meth, items[i].ptr)) return (int)items[i].id; return NID_undef; } static const char *nid2name(int meth, const OSSL_ITEM *items, size_t items_n) { size_t i; for (i = 0; i < items_n; i++) if (meth == (int)items[i].id) return items[i].ptr; return NULL; } /* * The list of permitted hash functions are taken from * https://tools.ietf.org/html/rfc8017#appendix-A.2.1: * * OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= { * { OID id-sha1 PARAMETERS NULL }| * { OID id-sha224 PARAMETERS NULL }| * { OID id-sha256 PARAMETERS NULL }| * { OID id-sha384 PARAMETERS NULL }| * { OID id-sha512 PARAMETERS NULL }| * { OID id-sha512-224 PARAMETERS NULL }| * { OID id-sha512-256 PARAMETERS NULL }, * ... -- Allows for future expansion -- * } */ static const OSSL_ITEM oaeppss_name_nid_map[] = { { NID_sha1, OSSL_DIGEST_NAME_SHA1 }, { NID_sha224, OSSL_DIGEST_NAME_SHA2_224 }, { NID_sha256, OSSL_DIGEST_NAME_SHA2_256 }, { NID_sha384, OSSL_DIGEST_NAME_SHA2_384 }, { NID_sha512, OSSL_DIGEST_NAME_SHA2_512 }, { NID_sha512_224, OSSL_DIGEST_NAME_SHA2_512_224 }, { NID_sha512_256, OSSL_DIGEST_NAME_SHA2_512_256 }, }; static int md_is_a(const void *md, const char *name) { return EVP_MD_is_a(md, name); } int ossl_rsa_oaeppss_md2nid(const EVP_MD *md) { return meth2nid(md, md_is_a, oaeppss_name_nid_map, OSSL_NELEM(oaeppss_name_nid_map)); } const char *ossl_rsa_oaeppss_nid2name(int md) { return nid2name(md, oaeppss_name_nid_map, OSSL_NELEM(oaeppss_name_nid_map)); } const char *ossl_rsa_mgf_nid2name(int mgf) { if (mgf == NID_mgf1) return SN_mgf1; return NULL; }
./openssl/crypto/rsa/rsa_mp_names.c
/* * Copyright 2020 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 */ #include <openssl/core_names.h> #include "crypto/rsa.h" /* * The following tables are constants used during RSA parameter building * operations. It is easier to point to one of these fixed strings than have * to dynamically add and generate the names on the fly. */ /* * A fixed table of names for the RSA prime factors starting with * P,Q and up to 8 additional primes. */ const char *ossl_rsa_mp_factor_names[] = { OSSL_PKEY_PARAM_RSA_FACTOR1, OSSL_PKEY_PARAM_RSA_FACTOR2, #ifndef FIPS_MODULE OSSL_PKEY_PARAM_RSA_FACTOR3, OSSL_PKEY_PARAM_RSA_FACTOR4, OSSL_PKEY_PARAM_RSA_FACTOR5, OSSL_PKEY_PARAM_RSA_FACTOR6, OSSL_PKEY_PARAM_RSA_FACTOR7, OSSL_PKEY_PARAM_RSA_FACTOR8, OSSL_PKEY_PARAM_RSA_FACTOR9, OSSL_PKEY_PARAM_RSA_FACTOR10, #endif NULL }; /* * A fixed table of names for the RSA exponents starting with * DP,DQ and up to 8 additional exponents. */ const char *ossl_rsa_mp_exp_names[] = { OSSL_PKEY_PARAM_RSA_EXPONENT1, OSSL_PKEY_PARAM_RSA_EXPONENT2, #ifndef FIPS_MODULE OSSL_PKEY_PARAM_RSA_EXPONENT3, OSSL_PKEY_PARAM_RSA_EXPONENT4, OSSL_PKEY_PARAM_RSA_EXPONENT5, OSSL_PKEY_PARAM_RSA_EXPONENT6, OSSL_PKEY_PARAM_RSA_EXPONENT7, OSSL_PKEY_PARAM_RSA_EXPONENT8, OSSL_PKEY_PARAM_RSA_EXPONENT9, OSSL_PKEY_PARAM_RSA_EXPONENT10, #endif NULL }; /* * A fixed table of names for the RSA coefficients starting with * QINV and up to 8 additional exponents. */ const char *ossl_rsa_mp_coeff_names[] = { OSSL_PKEY_PARAM_RSA_COEFFICIENT1, #ifndef FIPS_MODULE OSSL_PKEY_PARAM_RSA_COEFFICIENT2, OSSL_PKEY_PARAM_RSA_COEFFICIENT3, OSSL_PKEY_PARAM_RSA_COEFFICIENT4, OSSL_PKEY_PARAM_RSA_COEFFICIENT5, OSSL_PKEY_PARAM_RSA_COEFFICIENT6, OSSL_PKEY_PARAM_RSA_COEFFICIENT7, OSSL_PKEY_PARAM_RSA_COEFFICIENT8, OSSL_PKEY_PARAM_RSA_COEFFICIENT9, #endif NULL };
./openssl/crypto/rsa/rsa_ossl.c
/* * Copyright 1995-2023 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 */ /* * RSA low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include "internal/cryptlib.h" #include "crypto/bn.h" #include "rsa_local.h" #include "internal/constant_time.h" #include <openssl/evp.h> #include <openssl/sha.h> #include <openssl/hmac.h> static int rsa_ossl_public_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); static int rsa_ossl_private_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); static int rsa_ossl_public_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); static int rsa_ossl_private_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); static int rsa_ossl_init(RSA *rsa); static int rsa_ossl_finish(RSA *rsa); #ifdef S390X_MOD_EXP static int rsa_ossl_s390x_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); static RSA_METHOD rsa_pkcs1_ossl_meth = { "OpenSSL PKCS#1 RSA", rsa_ossl_public_encrypt, rsa_ossl_public_decrypt, /* signature verification */ rsa_ossl_private_encrypt, /* signing */ rsa_ossl_private_decrypt, rsa_ossl_s390x_mod_exp, s390x_mod_exp, rsa_ossl_init, rsa_ossl_finish, RSA_FLAG_FIPS_METHOD, /* flags */ NULL, 0, /* rsa_sign */ 0, /* rsa_verify */ NULL, /* rsa_keygen */ NULL /* rsa_multi_prime_keygen */ }; #else static RSA_METHOD rsa_pkcs1_ossl_meth = { "OpenSSL PKCS#1 RSA", rsa_ossl_public_encrypt, rsa_ossl_public_decrypt, /* signature verification */ rsa_ossl_private_encrypt, /* signing */ rsa_ossl_private_decrypt, rsa_ossl_mod_exp, BN_mod_exp_mont, /* XXX probably we should not use Montgomery * if e == 3 */ rsa_ossl_init, rsa_ossl_finish, RSA_FLAG_FIPS_METHOD, /* flags */ NULL, 0, /* rsa_sign */ 0, /* rsa_verify */ NULL, /* rsa_keygen */ NULL /* rsa_multi_prime_keygen */ }; #endif static const RSA_METHOD *default_RSA_meth = &rsa_pkcs1_ossl_meth; void RSA_set_default_method(const RSA_METHOD *meth) { default_RSA_meth = meth; } const RSA_METHOD *RSA_get_default_method(void) { return default_RSA_meth; } const RSA_METHOD *RSA_PKCS1_OpenSSL(void) { return &rsa_pkcs1_ossl_meth; } const RSA_METHOD *RSA_null_method(void) { return NULL; } static int rsa_ossl_public_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding) { BIGNUM *f, *ret; int i, num = 0, r = -1; unsigned char *buf = NULL; BN_CTX *ctx = NULL; if (BN_num_bits(rsa->n) > OPENSSL_RSA_MAX_MODULUS_BITS) { ERR_raise(ERR_LIB_RSA, RSA_R_MODULUS_TOO_LARGE); return -1; } if (BN_ucmp(rsa->n, rsa->e) <= 0) { ERR_raise(ERR_LIB_RSA, RSA_R_BAD_E_VALUE); return -1; } /* for large moduli, enforce exponent limit */ if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS) { if (BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS) { ERR_raise(ERR_LIB_RSA, RSA_R_BAD_E_VALUE); return -1; } } if ((ctx = BN_CTX_new_ex(rsa->libctx)) == NULL) goto err; BN_CTX_start(ctx); f = BN_CTX_get(ctx); ret = BN_CTX_get(ctx); num = BN_num_bytes(rsa->n); buf = OPENSSL_malloc(num); if (ret == NULL || buf == NULL) goto err; switch (padding) { case RSA_PKCS1_PADDING: i = ossl_rsa_padding_add_PKCS1_type_2_ex(rsa->libctx, buf, num, from, flen); break; case RSA_PKCS1_OAEP_PADDING: i = ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(rsa->libctx, buf, num, from, flen, NULL, 0, NULL, NULL); break; case RSA_NO_PADDING: i = RSA_padding_add_none(buf, num, from, flen); break; default: ERR_raise(ERR_LIB_RSA, RSA_R_UNKNOWN_PADDING_TYPE); goto err; } if (i <= 0) goto err; if (BN_bin2bn(buf, num, f) == NULL) goto err; if (BN_ucmp(f, rsa->n) >= 0) { /* usually the padding functions would catch this */ ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_MODULUS); goto err; } if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, rsa->lock, rsa->n, ctx)) goto err; if (!rsa->meth->bn_mod_exp(ret, f, rsa->e, rsa->n, ctx, rsa->_method_mod_n)) goto err; /* * BN_bn2binpad puts in leading 0 bytes if the number is less than * the length of the modulus. */ r = BN_bn2binpad(ret, to, num); err: BN_CTX_end(ctx); BN_CTX_free(ctx); OPENSSL_clear_free(buf, num); return r; } static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx) { BN_BLINDING *ret; if (!CRYPTO_THREAD_read_lock(rsa->lock)) return NULL; if (rsa->blinding == NULL) { /* * This dance with upgrading the lock from read to write will be * slower in cases of a single use RSA object, but should be * significantly better in multi-thread cases (e.g. servers). It's * probably worth it. */ CRYPTO_THREAD_unlock(rsa->lock); if (!CRYPTO_THREAD_write_lock(rsa->lock)) return NULL; if (rsa->blinding == NULL) rsa->blinding = RSA_setup_blinding(rsa, ctx); } ret = rsa->blinding; if (ret == NULL) goto err; if (BN_BLINDING_is_current_thread(ret)) { /* rsa->blinding is ours! */ *local = 1; } else { /* resort to rsa->mt_blinding instead */ /* * instructs rsa_blinding_convert(), rsa_blinding_invert() that the * BN_BLINDING is shared, meaning that accesses require locks, and * that the blinding factor must be stored outside the BN_BLINDING */ *local = 0; if (rsa->mt_blinding == NULL) { CRYPTO_THREAD_unlock(rsa->lock); if (!CRYPTO_THREAD_write_lock(rsa->lock)) return NULL; if (rsa->mt_blinding == NULL) rsa->mt_blinding = RSA_setup_blinding(rsa, ctx); } ret = rsa->mt_blinding; } err: CRYPTO_THREAD_unlock(rsa->lock); return ret; } static int rsa_blinding_convert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind, BN_CTX *ctx) { if (unblind == NULL) { /* * Local blinding: store the unblinding factor in BN_BLINDING. */ return BN_BLINDING_convert_ex(f, NULL, b, ctx); } else { /* * Shared blinding: store the unblinding factor outside BN_BLINDING. */ int ret; if (!BN_BLINDING_lock(b)) return 0; ret = BN_BLINDING_convert_ex(f, unblind, b, ctx); BN_BLINDING_unlock(b); return ret; } } static int rsa_blinding_invert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind, BN_CTX *ctx) { /* * For local blinding, unblind is set to NULL, and BN_BLINDING_invert_ex * will use the unblinding factor stored in BN_BLINDING. If BN_BLINDING * is shared between threads, unblind must be non-null: * BN_BLINDING_invert_ex will then use the local unblinding factor, and * will only read the modulus from BN_BLINDING. In both cases it's safe * to access the blinding without a lock. */ BN_set_flags(f, BN_FLG_CONSTTIME); return BN_BLINDING_invert_ex(f, unblind, b, ctx); } /* signing */ static int rsa_ossl_private_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding) { BIGNUM *f, *ret, *res; int i, num = 0, r = -1; unsigned char *buf = NULL; BN_CTX *ctx = NULL; int local_blinding = 0; /* * Used only if the blinding structure is shared. A non-NULL unblind * instructs rsa_blinding_convert() and rsa_blinding_invert() to store * the unblinding factor outside the blinding structure. */ BIGNUM *unblind = NULL; BN_BLINDING *blinding = NULL; if ((ctx = BN_CTX_new_ex(rsa->libctx)) == NULL) goto err; BN_CTX_start(ctx); f = BN_CTX_get(ctx); ret = BN_CTX_get(ctx); num = BN_num_bytes(rsa->n); buf = OPENSSL_malloc(num); if (ret == NULL || buf == NULL) goto err; switch (padding) { case RSA_PKCS1_PADDING: i = RSA_padding_add_PKCS1_type_1(buf, num, from, flen); break; case RSA_X931_PADDING: i = RSA_padding_add_X931(buf, num, from, flen); break; case RSA_NO_PADDING: i = RSA_padding_add_none(buf, num, from, flen); break; default: ERR_raise(ERR_LIB_RSA, RSA_R_UNKNOWN_PADDING_TYPE); goto err; } if (i <= 0) goto err; if (BN_bin2bn(buf, num, f) == NULL) goto err; if (BN_ucmp(f, rsa->n) >= 0) { /* usually the padding functions would catch this */ ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_MODULUS); goto err; } if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, rsa->lock, rsa->n, ctx)) goto err; if (!(rsa->flags & RSA_FLAG_NO_BLINDING)) { blinding = rsa_get_blinding(rsa, &local_blinding, ctx); if (blinding == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } } if (blinding != NULL) { if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) { ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB); goto err; } if (!rsa_blinding_convert(blinding, f, unblind, ctx)) goto err; } if ((rsa->flags & RSA_FLAG_EXT_PKEY) || (rsa->version == RSA_ASN1_VERSION_MULTI) || ((rsa->p != NULL) && (rsa->q != NULL) && (rsa->dmp1 != NULL) && (rsa->dmq1 != NULL) && (rsa->iqmp != NULL))) { if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) goto err; } else { BIGNUM *d = BN_new(); if (d == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB); goto err; } if (rsa->d == NULL) { ERR_raise(ERR_LIB_RSA, RSA_R_MISSING_PRIVATE_KEY); BN_free(d); goto err; } BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); if (!rsa->meth->bn_mod_exp(ret, f, d, rsa->n, ctx, rsa->_method_mod_n)) { BN_free(d); goto err; } /* We MUST free d before any further use of rsa->d */ BN_free(d); } if (blinding) if (!rsa_blinding_invert(blinding, ret, unblind, ctx)) goto err; if (padding == RSA_X931_PADDING) { if (!BN_sub(f, rsa->n, ret)) goto err; if (BN_cmp(ret, f) > 0) res = f; else res = ret; } else { res = ret; } /* * BN_bn2binpad puts in leading 0 bytes if the number is less than * the length of the modulus. */ r = BN_bn2binpad(res, to, num); err: BN_CTX_end(ctx); BN_CTX_free(ctx); OPENSSL_clear_free(buf, num); return r; } static int derive_kdk(int flen, const unsigned char *from, RSA *rsa, unsigned char *buf, int num, unsigned char *kdk) { int ret = 0; HMAC_CTX *hmac = NULL; EVP_MD *md = NULL; unsigned int md_len = SHA256_DIGEST_LENGTH; unsigned char d_hash[SHA256_DIGEST_LENGTH] = {0}; /* * because we use d as a handle to rsa->d we need to keep it local and * free before any further use of rsa->d */ BIGNUM *d = BN_new(); if (d == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_CRYPTO_LIB); goto err; } if (rsa->d == NULL) { ERR_raise(ERR_LIB_RSA, RSA_R_MISSING_PRIVATE_KEY); BN_free(d); goto err; } BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); if (BN_bn2binpad(d, buf, num) < 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); BN_free(d); goto err; } BN_free(d); /* * we use hardcoded hash so that migrating between versions that use * different hash doesn't provide a Bleichenbacher oracle: * if the attacker can see that different versions return different * messages for the same ciphertext, they'll know that the message is * synthetically generated, which means that the padding check failed */ md = EVP_MD_fetch(rsa->libctx, "sha256", NULL); if (md == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_FETCH_FAILED); goto err; } if (EVP_Digest(buf, num, d_hash, NULL, md, NULL) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } hmac = HMAC_CTX_new(); if (hmac == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_CRYPTO_LIB); goto err; } if (HMAC_Init_ex(hmac, d_hash, sizeof(d_hash), md, NULL) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } if (flen < num) { memset(buf, 0, num - flen); if (HMAC_Update(hmac, buf, num - flen) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } } if (HMAC_Update(hmac, from, flen) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } md_len = SHA256_DIGEST_LENGTH; if (HMAC_Final(hmac, kdk, &md_len) <= 0) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } ret = 1; err: HMAC_CTX_free(hmac); EVP_MD_free(md); return ret; } static int rsa_ossl_private_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding) { BIGNUM *f, *ret; int j, num = 0, r = -1; unsigned char *buf = NULL; unsigned char kdk[SHA256_DIGEST_LENGTH] = {0}; BN_CTX *ctx = NULL; int local_blinding = 0; /* * Used only if the blinding structure is shared. A non-NULL unblind * instructs rsa_blinding_convert() and rsa_blinding_invert() to store * the unblinding factor outside the blinding structure. */ BIGNUM *unblind = NULL; BN_BLINDING *blinding = NULL; /* * we need the value of the private exponent to perform implicit rejection */ if ((rsa->flags & RSA_FLAG_EXT_PKEY) && (padding == RSA_PKCS1_PADDING)) padding = RSA_PKCS1_NO_IMPLICIT_REJECT_PADDING; if ((ctx = BN_CTX_new_ex(rsa->libctx)) == NULL) goto err; BN_CTX_start(ctx); f = BN_CTX_get(ctx); ret = BN_CTX_get(ctx); if (ret == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB); goto err; } num = BN_num_bytes(rsa->n); buf = OPENSSL_malloc(num); if (buf == NULL) goto err; /* * This check was for equality but PGP does evil things and chops off the * top '0' bytes */ if (flen > num) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_GREATER_THAN_MOD_LEN); goto err; } if (flen < 1) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_SMALL); goto err; } /* make data into a big number */ if (BN_bin2bn(from, (int)flen, f) == NULL) goto err; if (BN_ucmp(f, rsa->n) >= 0) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_MODULUS); goto err; } if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, rsa->lock, rsa->n, ctx)) goto err; if (!(rsa->flags & RSA_FLAG_NO_BLINDING)) { blinding = rsa_get_blinding(rsa, &local_blinding, ctx); if (blinding == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); goto err; } } if (blinding != NULL) { if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) { ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB); goto err; } if (!rsa_blinding_convert(blinding, f, unblind, ctx)) goto err; } /* do the decrypt */ if ((rsa->flags & RSA_FLAG_EXT_PKEY) || (rsa->version == RSA_ASN1_VERSION_MULTI) || ((rsa->p != NULL) && (rsa->q != NULL) && (rsa->dmp1 != NULL) && (rsa->dmq1 != NULL) && (rsa->iqmp != NULL))) { if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) goto err; } else { BIGNUM *d = BN_new(); if (d == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB); goto err; } if (rsa->d == NULL) { ERR_raise(ERR_LIB_RSA, RSA_R_MISSING_PRIVATE_KEY); BN_free(d); goto err; } BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); if (!rsa->meth->bn_mod_exp(ret, f, d, rsa->n, ctx, rsa->_method_mod_n)) { BN_free(d); goto err; } /* We MUST free d before any further use of rsa->d */ BN_free(d); } if (blinding) if (!rsa_blinding_invert(blinding, ret, unblind, ctx)) goto err; /* * derive the Key Derivation Key from private exponent and public * ciphertext */ if (padding == RSA_PKCS1_PADDING) { if (derive_kdk(flen, from, rsa, buf, num, kdk) == 0) goto err; } j = BN_bn2binpad(ret, buf, num); if (j < 0) goto err; switch (padding) { case RSA_PKCS1_NO_IMPLICIT_REJECT_PADDING: r = RSA_padding_check_PKCS1_type_2(to, num, buf, j, num); break; case RSA_PKCS1_PADDING: r = ossl_rsa_padding_check_PKCS1_type_2(rsa->libctx, to, num, buf, j, num, kdk); break; case RSA_PKCS1_OAEP_PADDING: r = RSA_padding_check_PKCS1_OAEP(to, num, buf, j, num, NULL, 0); break; case RSA_NO_PADDING: memcpy(to, buf, (r = j)); break; default: ERR_raise(ERR_LIB_RSA, RSA_R_UNKNOWN_PADDING_TYPE); goto err; } #ifndef FIPS_MODULE /* * This trick doesn't work in the FIPS provider because libcrypto manages * the error stack. Instead we opt not to put an error on the stack at all * in case of padding failure in the FIPS provider. */ ERR_raise(ERR_LIB_RSA, RSA_R_PADDING_CHECK_FAILED); err_clear_last_constant_time(1 & ~constant_time_msb(r)); #endif err: BN_CTX_end(ctx); BN_CTX_free(ctx); OPENSSL_clear_free(buf, num); return r; } /* signature verification */ static int rsa_ossl_public_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding) { BIGNUM *f, *ret; int i, num = 0, r = -1; unsigned char *buf = NULL; BN_CTX *ctx = NULL; if (BN_num_bits(rsa->n) > OPENSSL_RSA_MAX_MODULUS_BITS) { ERR_raise(ERR_LIB_RSA, RSA_R_MODULUS_TOO_LARGE); return -1; } if (BN_ucmp(rsa->n, rsa->e) <= 0) { ERR_raise(ERR_LIB_RSA, RSA_R_BAD_E_VALUE); return -1; } /* for large moduli, enforce exponent limit */ if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS) { if (BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS) { ERR_raise(ERR_LIB_RSA, RSA_R_BAD_E_VALUE); return -1; } } if ((ctx = BN_CTX_new_ex(rsa->libctx)) == NULL) goto err; BN_CTX_start(ctx); f = BN_CTX_get(ctx); ret = BN_CTX_get(ctx); if (ret == NULL) { ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB); goto err; } num = BN_num_bytes(rsa->n); buf = OPENSSL_malloc(num); if (buf == NULL) goto err; /* * This check was for equality but PGP does evil things and chops off the * top '0' bytes */ if (flen > num) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_GREATER_THAN_MOD_LEN); goto err; } if (BN_bin2bn(from, flen, f) == NULL) goto err; if (BN_ucmp(f, rsa->n) >= 0) { ERR_raise(ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_MODULUS); goto err; } if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, rsa->lock, rsa->n, ctx)) goto err; if (!rsa->meth->bn_mod_exp(ret, f, rsa->e, rsa->n, ctx, rsa->_method_mod_n)) goto err; if ((padding == RSA_X931_PADDING) && ((bn_get_words(ret)[0] & 0xf) != 12)) if (!BN_sub(ret, rsa->n, ret)) goto err; i = BN_bn2binpad(ret, buf, num); if (i < 0) goto err; switch (padding) { case RSA_PKCS1_PADDING: r = RSA_padding_check_PKCS1_type_1(to, num, buf, i, num); break; case RSA_X931_PADDING: r = RSA_padding_check_X931(to, num, buf, i, num); break; case RSA_NO_PADDING: memcpy(to, buf, (r = i)); break; default: ERR_raise(ERR_LIB_RSA, RSA_R_UNKNOWN_PADDING_TYPE); goto err; } if (r < 0) ERR_raise(ERR_LIB_RSA, RSA_R_PADDING_CHECK_FAILED); err: BN_CTX_end(ctx); BN_CTX_free(ctx); OPENSSL_clear_free(buf, num); return r; } static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) { BIGNUM *r1, *m1, *vrfy; int ret = 0, smooth = 0; #ifndef FIPS_MODULE BIGNUM *r2, *m[RSA_MAX_PRIME_NUM - 2]; int i, ex_primes = 0; RSA_PRIME_INFO *pinfo; #endif BN_CTX_start(ctx); r1 = BN_CTX_get(ctx); #ifndef FIPS_MODULE r2 = BN_CTX_get(ctx); #endif m1 = BN_CTX_get(ctx); vrfy = BN_CTX_get(ctx); if (vrfy == NULL) goto err; #ifndef FIPS_MODULE if (rsa->version == RSA_ASN1_VERSION_MULTI && ((ex_primes = sk_RSA_PRIME_INFO_num(rsa->prime_infos)) <= 0 || ex_primes > RSA_MAX_PRIME_NUM - 2)) goto err; #endif if (rsa->flags & RSA_FLAG_CACHE_PRIVATE) { BIGNUM *factor = BN_new(); if (factor == NULL) goto err; /* * Make sure BN_mod_inverse in Montgomery initialization uses the * BN_FLG_CONSTTIME flag */ if (!(BN_with_flags(factor, rsa->p, BN_FLG_CONSTTIME), BN_MONT_CTX_set_locked(&rsa->_method_mod_p, rsa->lock, factor, ctx)) || !(BN_with_flags(factor, rsa->q, BN_FLG_CONSTTIME), BN_MONT_CTX_set_locked(&rsa->_method_mod_q, rsa->lock, factor, ctx))) { BN_free(factor); goto err; } #ifndef FIPS_MODULE for (i = 0; i < ex_primes; i++) { pinfo = sk_RSA_PRIME_INFO_value(rsa->prime_infos, i); BN_with_flags(factor, pinfo->r, BN_FLG_CONSTTIME); if (!BN_MONT_CTX_set_locked(&pinfo->m, rsa->lock, factor, ctx)) { BN_free(factor); goto err; } } #endif /* * We MUST free |factor| before any further use of the prime factors */ BN_free(factor); smooth = (rsa->meth->bn_mod_exp == BN_mod_exp_mont) #ifndef FIPS_MODULE && (ex_primes == 0) #endif && (BN_num_bits(rsa->q) == BN_num_bits(rsa->p)); } if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, rsa->lock, rsa->n, ctx)) goto err; if (smooth) { /* * Conversion from Montgomery domain, a.k.a. Montgomery reduction, * accepts values in [0-m*2^w) range. w is m's bit width rounded up * to limb width. So that at the very least if |I| is fully reduced, * i.e. less than p*q, we can count on from-to round to perform * below modulo operations on |I|. Unlike BN_mod it's constant time. */ if (/* m1 = I moq q */ !bn_from_mont_fixed_top(m1, I, rsa->_method_mod_q, ctx) || !bn_to_mont_fixed_top(m1, m1, rsa->_method_mod_q, ctx) /* r1 = I mod p */ || !bn_from_mont_fixed_top(r1, I, rsa->_method_mod_p, ctx) || !bn_to_mont_fixed_top(r1, r1, rsa->_method_mod_p, ctx) /* * Use parallel exponentiations optimization if possible, * otherwise fallback to two sequential exponentiations: * m1 = m1^dmq1 mod q * r1 = r1^dmp1 mod p */ || !BN_mod_exp_mont_consttime_x2(m1, m1, rsa->dmq1, rsa->q, rsa->_method_mod_q, r1, r1, rsa->dmp1, rsa->p, rsa->_method_mod_p, ctx) /* r1 = (r1 - m1) mod p */ /* * bn_mod_sub_fixed_top is not regular modular subtraction, * it can tolerate subtrahend to be larger than modulus, but * not bit-wise wider. This makes up for uncommon q>p case, * when |m1| can be larger than |rsa->p|. */ || !bn_mod_sub_fixed_top(r1, r1, m1, rsa->p) /* r1 = r1 * iqmp mod p */ || !bn_to_mont_fixed_top(r1, r1, rsa->_method_mod_p, ctx) || !bn_mul_mont_fixed_top(r1, r1, rsa->iqmp, rsa->_method_mod_p, ctx) /* r0 = r1 * q + m1 */ || !bn_mul_fixed_top(r0, r1, rsa->q, ctx) || !bn_mod_add_fixed_top(r0, r0, m1, rsa->n)) goto err; goto tail; } /* compute I mod q */ { BIGNUM *c = BN_new(); if (c == NULL) goto err; BN_with_flags(c, I, BN_FLG_CONSTTIME); if (!BN_mod(r1, c, rsa->q, ctx)) { BN_free(c); goto err; } { BIGNUM *dmq1 = BN_new(); if (dmq1 == NULL) { BN_free(c); goto err; } BN_with_flags(dmq1, rsa->dmq1, BN_FLG_CONSTTIME); /* compute r1^dmq1 mod q */ if (!rsa->meth->bn_mod_exp(m1, r1, dmq1, rsa->q, ctx, rsa->_method_mod_q)) { BN_free(c); BN_free(dmq1); goto err; } /* We MUST free dmq1 before any further use of rsa->dmq1 */ BN_free(dmq1); } /* compute I mod p */ if (!BN_mod(r1, c, rsa->p, ctx)) { BN_free(c); goto err; } /* We MUST free c before any further use of I */ BN_free(c); } { BIGNUM *dmp1 = BN_new(); if (dmp1 == NULL) goto err; BN_with_flags(dmp1, rsa->dmp1, BN_FLG_CONSTTIME); /* compute r1^dmp1 mod p */ if (!rsa->meth->bn_mod_exp(r0, r1, dmp1, rsa->p, ctx, rsa->_method_mod_p)) { BN_free(dmp1); goto err; } /* We MUST free dmp1 before any further use of rsa->dmp1 */ BN_free(dmp1); } #ifndef FIPS_MODULE if (ex_primes > 0) { BIGNUM *di = BN_new(), *cc = BN_new(); if (cc == NULL || di == NULL) { BN_free(cc); BN_free(di); goto err; } for (i = 0; i < ex_primes; i++) { /* prepare m_i */ if ((m[i] = BN_CTX_get(ctx)) == NULL) { BN_free(cc); BN_free(di); goto err; } pinfo = sk_RSA_PRIME_INFO_value(rsa->prime_infos, i); /* prepare c and d_i */ BN_with_flags(cc, I, BN_FLG_CONSTTIME); BN_with_flags(di, pinfo->d, BN_FLG_CONSTTIME); if (!BN_mod(r1, cc, pinfo->r, ctx)) { BN_free(cc); BN_free(di); goto err; } /* compute r1 ^ d_i mod r_i */ if (!rsa->meth->bn_mod_exp(m[i], r1, di, pinfo->r, ctx, pinfo->m)) { BN_free(cc); BN_free(di); goto err; } } BN_free(cc); BN_free(di); } #endif if (!BN_sub(r0, r0, m1)) goto err; /* * This will help stop the size of r0 increasing, which does affect the * multiply if it optimised for a power of 2 size */ if (BN_is_negative(r0)) if (!BN_add(r0, r0, rsa->p)) goto err; if (!BN_mul(r1, r0, rsa->iqmp, ctx)) goto err; { BIGNUM *pr1 = BN_new(); if (pr1 == NULL) goto err; BN_with_flags(pr1, r1, BN_FLG_CONSTTIME); if (!BN_mod(r0, pr1, rsa->p, ctx)) { BN_free(pr1); goto err; } /* We MUST free pr1 before any further use of r1 */ BN_free(pr1); } /* * If p < q it is occasionally possible for the correction of adding 'p' * if r0 is negative above to leave the result still negative. This can * break the private key operations: the following second correction * should *always* correct this rare occurrence. This will *never* happen * with OpenSSL generated keys because they ensure p > q [steve] */ if (BN_is_negative(r0)) if (!BN_add(r0, r0, rsa->p)) goto err; if (!BN_mul(r1, r0, rsa->q, ctx)) goto err; if (!BN_add(r0, r1, m1)) goto err; #ifndef FIPS_MODULE /* add m_i to m in multi-prime case */ if (ex_primes > 0) { BIGNUM *pr2 = BN_new(); if (pr2 == NULL) goto err; for (i = 0; i < ex_primes; i++) { pinfo = sk_RSA_PRIME_INFO_value(rsa->prime_infos, i); if (!BN_sub(r1, m[i], r0)) { BN_free(pr2); goto err; } if (!BN_mul(r2, r1, pinfo->t, ctx)) { BN_free(pr2); goto err; } BN_with_flags(pr2, r2, BN_FLG_CONSTTIME); if (!BN_mod(r1, pr2, pinfo->r, ctx)) { BN_free(pr2); goto err; } if (BN_is_negative(r1)) if (!BN_add(r1, r1, pinfo->r)) { BN_free(pr2); goto err; } if (!BN_mul(r1, r1, pinfo->pp, ctx)) { BN_free(pr2); goto err; } if (!BN_add(r0, r0, r1)) { BN_free(pr2); goto err; } } BN_free(pr2); } #endif tail: if (rsa->e && rsa->n) { if (rsa->meth->bn_mod_exp == BN_mod_exp_mont) { if (!BN_mod_exp_mont(vrfy, r0, rsa->e, rsa->n, ctx, rsa->_method_mod_n)) goto err; } else { bn_correct_top(r0); if (!rsa->meth->bn_mod_exp(vrfy, r0, rsa->e, rsa->n, ctx, rsa->_method_mod_n)) goto err; } /* * If 'I' was greater than (or equal to) rsa->n, the operation will * be equivalent to using 'I mod n'. However, the result of the * verify will *always* be less than 'n' so we don't check for * absolute equality, just congruency. */ if (!BN_sub(vrfy, vrfy, I)) goto err; if (BN_is_zero(vrfy)) { bn_correct_top(r0); ret = 1; goto err; /* not actually error */ } if (!BN_mod(vrfy, vrfy, rsa->n, ctx)) goto err; if (BN_is_negative(vrfy)) if (!BN_add(vrfy, vrfy, rsa->n)) goto err; if (!BN_is_zero(vrfy)) { /* * 'I' and 'vrfy' aren't congruent mod n. Don't leak * miscalculated CRT output, just do a raw (slower) mod_exp and * return that instead. */ BIGNUM *d = BN_new(); if (d == NULL) goto err; BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); if (!rsa->meth->bn_mod_exp(r0, I, d, rsa->n, ctx, rsa->_method_mod_n)) { BN_free(d); goto err; } /* We MUST free d before any further use of rsa->d */ BN_free(d); } } /* * It's unfortunate that we have to bn_correct_top(r0). What hopefully * saves the day is that correction is highly unlike, and private key * operations are customarily performed on blinded message. Which means * that attacker won't observe correlation with chosen plaintext. * Secondly, remaining code would still handle it in same computational * time and even conceal memory access pattern around corrected top. */ bn_correct_top(r0); ret = 1; err: BN_CTX_end(ctx); return ret; } static int rsa_ossl_init(RSA *rsa) { rsa->flags |= RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE; return 1; } static int rsa_ossl_finish(RSA *rsa) { #ifndef FIPS_MODULE int i; RSA_PRIME_INFO *pinfo; for (i = 0; i < sk_RSA_PRIME_INFO_num(rsa->prime_infos); i++) { pinfo = sk_RSA_PRIME_INFO_value(rsa->prime_infos, i); BN_MONT_CTX_free(pinfo->m); } #endif BN_MONT_CTX_free(rsa->_method_mod_n); BN_MONT_CTX_free(rsa->_method_mod_p); BN_MONT_CTX_free(rsa->_method_mod_q); return 1; } #ifdef S390X_MOD_EXP static int rsa_ossl_s390x_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx) { if (rsa->version != RSA_ASN1_VERSION_MULTI) { if (s390x_crt(r0, i, rsa->p, rsa->q, rsa->dmp1, rsa->dmq1, rsa->iqmp) == 1) return 1; } return rsa_ossl_mod_exp(r0, i, rsa, ctx); } #endif
./openssl/crypto/rsa/rsa_saos.c
/* * Copyright 1995-2020 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 */ /* * RSA low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/bn.h> #include <openssl/rsa.h> #include <openssl/objects.h> #include <openssl/x509.h> int RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len, unsigned char *sigret, unsigned int *siglen, RSA *rsa) { ASN1_OCTET_STRING sig; int i, j, ret = 1; unsigned char *p, *s; sig.type = V_ASN1_OCTET_STRING; sig.length = m_len; sig.data = (unsigned char *)m; i = i2d_ASN1_OCTET_STRING(&sig, NULL); j = RSA_size(rsa); if (i > (j - RSA_PKCS1_PADDING_SIZE)) { ERR_raise(ERR_LIB_RSA, RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY); return 0; } s = OPENSSL_malloc((unsigned int)j + 1); if (s == NULL) return 0; p = s; i2d_ASN1_OCTET_STRING(&sig, &p); i = RSA_private_encrypt(i, s, sigret, rsa, RSA_PKCS1_PADDING); if (i <= 0) ret = 0; else *siglen = i; OPENSSL_clear_free(s, (unsigned int)j + 1); return ret; } int RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m, unsigned int m_len, unsigned char *sigbuf, unsigned int siglen, RSA *rsa) { int i, ret = 0; unsigned char *s; const unsigned char *p; ASN1_OCTET_STRING *sig = NULL; if (siglen != (unsigned int)RSA_size(rsa)) { ERR_raise(ERR_LIB_RSA, RSA_R_WRONG_SIGNATURE_LENGTH); return 0; } s = OPENSSL_malloc((unsigned int)siglen); if (s == NULL) goto err; i = RSA_public_decrypt((int)siglen, sigbuf, s, rsa, RSA_PKCS1_PADDING); if (i <= 0) goto err; p = s; sig = d2i_ASN1_OCTET_STRING(NULL, &p, (long)i); if (sig == NULL) goto err; if (((unsigned int)sig->length != m_len) || (memcmp(m, sig->data, m_len) != 0)) { ERR_raise(ERR_LIB_RSA, RSA_R_BAD_SIGNATURE); } else { ret = 1; } err: ASN1_OCTET_STRING_free(sig); OPENSSL_clear_free(s, (unsigned int)siglen); return ret; }
./openssl/crypto/rsa/rsa_pmeth.c
/* * Copyright 2006-2023 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 */ /* * RSA low level APIs are deprecated for public use, but still ok for * internal use. */ #include "internal/deprecated.h" #include "internal/constant_time.h" #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/asn1t.h> #include <openssl/x509.h> #include <openssl/rsa.h> #include <openssl/bn.h> #include <openssl/evp.h> #include <openssl/x509v3.h> #include <openssl/cms.h> #include "crypto/evp.h" #include "crypto/rsa.h" #include "rsa_local.h" /* RSA pkey context structure */ typedef struct { /* Key gen parameters */ int nbits; BIGNUM *pub_exp; int primes; /* Keygen callback info */ int gentmp[2]; /* RSA padding mode */ int pad_mode; /* message digest */ const EVP_MD *md; /* message digest for MGF1 */ const EVP_MD *mgf1md; /* PSS salt length */ int saltlen; /* Minimum salt length or -1 if no PSS parameter restriction */ int min_saltlen; /* Temp buffer */ unsigned char *tbuf; /* OAEP label */ unsigned char *oaep_label; size_t oaep_labellen; /* if to use implicit rejection in PKCS#1 v1.5 decryption */ int implicit_rejection; } RSA_PKEY_CTX; /* True if PSS parameters are restricted */ #define rsa_pss_restricted(rctx) (rctx->min_saltlen != -1) static int pkey_rsa_init(EVP_PKEY_CTX *ctx) { RSA_PKEY_CTX *rctx = OPENSSL_zalloc(sizeof(*rctx)); if (rctx == NULL) return 0; rctx->nbits = 2048; rctx->primes = RSA_DEFAULT_PRIME_NUM; if (pkey_ctx_is_pss(ctx)) rctx->pad_mode = RSA_PKCS1_PSS_PADDING; else rctx->pad_mode = RSA_PKCS1_PADDING; /* Maximum for sign, auto for verify */ rctx->saltlen = RSA_PSS_SALTLEN_AUTO; rctx->min_saltlen = -1; rctx->implicit_rejection = 1; ctx->data = rctx; ctx->keygen_info = rctx->gentmp; ctx->keygen_info_count = 2; return 1; } static int pkey_rsa_copy(EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src) { RSA_PKEY_CTX *dctx, *sctx; if (!pkey_rsa_init(dst)) return 0; sctx = src->data; dctx = dst->data; dctx->nbits = sctx->nbits; if (sctx->pub_exp) { dctx->pub_exp = BN_dup(sctx->pub_exp); if (!dctx->pub_exp) return 0; } dctx->pad_mode = sctx->pad_mode; dctx->md = sctx->md; dctx->mgf1md = sctx->mgf1md; dctx->saltlen = sctx->saltlen; dctx->implicit_rejection = sctx->implicit_rejection; if (sctx->oaep_label) { OPENSSL_free(dctx->oaep_label); dctx->oaep_label = OPENSSL_memdup(sctx->oaep_label, sctx->oaep_labellen); if (!dctx->oaep_label) return 0; dctx->oaep_labellen = sctx->oaep_labellen; } return 1; } static int setup_tbuf(RSA_PKEY_CTX *ctx, EVP_PKEY_CTX *pk) { if (ctx->tbuf != NULL) return 1; if ((ctx->tbuf = OPENSSL_malloc(RSA_size(EVP_PKEY_get0_RSA(pk->pkey)))) == NULL) return 0; return 1; } static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx) { RSA_PKEY_CTX *rctx = ctx->data; if (rctx) { BN_free(rctx->pub_exp); OPENSSL_free(rctx->tbuf); OPENSSL_free(rctx->oaep_label); OPENSSL_free(rctx); } } static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, const unsigned char *tbs, size_t tbslen) { int ret; RSA_PKEY_CTX *rctx = ctx->data; /* * Discard const. Its marked as const because this may be a cached copy of * the "real" key. These calls don't make any modifications that need to * be reflected back in the "original" key. */ RSA *rsa = (RSA *)EVP_PKEY_get0_RSA(ctx->pkey); if (rctx->md) { if (tbslen != (size_t)EVP_MD_get_size(rctx->md)) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_DIGEST_LENGTH); return -1; } if (EVP_MD_get_type(rctx->md) == NID_mdc2) { unsigned int sltmp; if (rctx->pad_mode != RSA_PKCS1_PADDING) return -1; ret = RSA_sign_ASN1_OCTET_STRING(0, tbs, tbslen, sig, &sltmp, rsa); if (ret <= 0) return ret; ret = sltmp; } else if (rctx->pad_mode == RSA_X931_PADDING) { if ((size_t)RSA_size(rsa) < tbslen + 1) { ERR_raise(ERR_LIB_RSA, RSA_R_KEY_SIZE_TOO_SMALL); return -1; } if (!setup_tbuf(rctx, ctx)) { ERR_raise(ERR_LIB_RSA, ERR_R_RSA_LIB); return -1; } memcpy(rctx->tbuf, tbs, tbslen); rctx->tbuf[tbslen] = RSA_X931_hash_id(EVP_MD_get_type(rctx->md)); ret = RSA_private_encrypt(tbslen + 1, rctx->tbuf, sig, rsa, RSA_X931_PADDING); } else if (rctx->pad_mode == RSA_PKCS1_PADDING) { unsigned int sltmp; ret = RSA_sign(EVP_MD_get_type(rctx->md), tbs, tbslen, sig, &sltmp, rsa); if (ret <= 0) return ret; ret = sltmp; } else if (rctx->pad_mode == RSA_PKCS1_PSS_PADDING) { if (!setup_tbuf(rctx, ctx)) return -1; if (!RSA_padding_add_PKCS1_PSS_mgf1(rsa, rctx->tbuf, tbs, rctx->md, rctx->mgf1md, rctx->saltlen)) return -1; ret = RSA_private_encrypt(RSA_size(rsa), rctx->tbuf, sig, rsa, RSA_NO_PADDING); } else { return -1; } } else { ret = RSA_private_encrypt(tbslen, tbs, sig, rsa, rctx->pad_mode); } if (ret < 0) return ret; *siglen = ret; return 1; } static int pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx, unsigned char *rout, size_t *routlen, const unsigned char *sig, size_t siglen) { int ret; RSA_PKEY_CTX *rctx = ctx->data; /* * Discard const. Its marked as const because this may be a cached copy of * the "real" key. These calls don't make any modifications that need to * be reflected back in the "original" key. */ RSA *rsa = (RSA *)EVP_PKEY_get0_RSA(ctx->pkey); if (rctx->md) { if (rctx->pad_mode == RSA_X931_PADDING) { if (!setup_tbuf(rctx, ctx)) return -1; ret = RSA_public_decrypt(siglen, sig, rctx->tbuf, rsa, RSA_X931_PADDING); if (ret < 1) return 0; ret--; if (rctx->tbuf[ret] != RSA_X931_hash_id(EVP_MD_get_type(rctx->md))) { ERR_raise(ERR_LIB_RSA, RSA_R_ALGORITHM_MISMATCH); return 0; } if (ret != EVP_MD_get_size(rctx->md)) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_DIGEST_LENGTH); return 0; } if (rout) memcpy(rout, rctx->tbuf, ret); } else if (rctx->pad_mode == RSA_PKCS1_PADDING) { size_t sltmp; ret = ossl_rsa_verify(EVP_MD_get_type(rctx->md), NULL, 0, rout, &sltmp, sig, siglen, rsa); if (ret <= 0) return 0; ret = sltmp; } else { return -1; } } else { ret = RSA_public_decrypt(siglen, sig, rout, rsa, rctx->pad_mode); } if (ret < 0) return ret; *routlen = ret; return 1; } static int pkey_rsa_verify(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, const unsigned char *tbs, size_t tbslen) { RSA_PKEY_CTX *rctx = ctx->data; /* * Discard const. Its marked as const because this may be a cached copy of * the "real" key. These calls don't make any modifications that need to * be reflected back in the "original" key. */ RSA *rsa = (RSA *)EVP_PKEY_get0_RSA(ctx->pkey); size_t rslen; if (rctx->md) { if (rctx->pad_mode == RSA_PKCS1_PADDING) return RSA_verify(EVP_MD_get_type(rctx->md), tbs, tbslen, sig, siglen, rsa); if (tbslen != (size_t)EVP_MD_get_size(rctx->md)) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_DIGEST_LENGTH); return -1; } if (rctx->pad_mode == RSA_X931_PADDING) { if (pkey_rsa_verifyrecover(ctx, NULL, &rslen, sig, siglen) <= 0) return 0; } else if (rctx->pad_mode == RSA_PKCS1_PSS_PADDING) { int ret; if (!setup_tbuf(rctx, ctx)) return -1; ret = RSA_public_decrypt(siglen, sig, rctx->tbuf, rsa, RSA_NO_PADDING); if (ret <= 0) return 0; ret = RSA_verify_PKCS1_PSS_mgf1(rsa, tbs, rctx->md, rctx->mgf1md, rctx->tbuf, rctx->saltlen); if (ret <= 0) return 0; return 1; } else { return -1; } } else { if (!setup_tbuf(rctx, ctx)) return -1; rslen = RSA_public_decrypt(siglen, sig, rctx->tbuf, rsa, rctx->pad_mode); if (rslen == 0) return 0; } if ((rslen != tbslen) || memcmp(tbs, rctx->tbuf, rslen)) return 0; return 1; } static int pkey_rsa_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen) { int ret; RSA_PKEY_CTX *rctx = ctx->data; /* * Discard const. Its marked as const because this may be a cached copy of * the "real" key. These calls don't make any modifications that need to * be reflected back in the "original" key. */ RSA *rsa = (RSA *)EVP_PKEY_get0_RSA(ctx->pkey); if (rctx->pad_mode == RSA_PKCS1_OAEP_PADDING) { int klen = RSA_size(rsa); if (!setup_tbuf(rctx, ctx)) return -1; if (!RSA_padding_add_PKCS1_OAEP_mgf1(rctx->tbuf, klen, in, inlen, rctx->oaep_label, rctx->oaep_labellen, rctx->md, rctx->mgf1md)) return -1; ret = RSA_public_encrypt(klen, rctx->tbuf, out, rsa, RSA_NO_PADDING); } else { ret = RSA_public_encrypt(inlen, in, out, rsa, rctx->pad_mode); } if (ret < 0) return ret; *outlen = ret; return 1; } static int pkey_rsa_decrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen) { int ret; int pad_mode; RSA_PKEY_CTX *rctx = ctx->data; /* * Discard const. Its marked as const because this may be a cached copy of * the "real" key. These calls don't make any modifications that need to * be reflected back in the "original" key. */ RSA *rsa = (RSA *)EVP_PKEY_get0_RSA(ctx->pkey); if (rctx->pad_mode == RSA_PKCS1_OAEP_PADDING) { if (!setup_tbuf(rctx, ctx)) return -1; ret = RSA_private_decrypt(inlen, in, rctx->tbuf, rsa, RSA_NO_PADDING); if (ret <= 0) return ret; ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, ret, rctx->tbuf, ret, ret, rctx->oaep_label, rctx->oaep_labellen, rctx->md, rctx->mgf1md); } else { if (rctx->pad_mode == RSA_PKCS1_PADDING && rctx->implicit_rejection == 0) pad_mode = RSA_PKCS1_NO_IMPLICIT_REJECT_PADDING; else pad_mode = rctx->pad_mode; ret = RSA_private_decrypt(inlen, in, out, rsa, pad_mode); } *outlen = constant_time_select_s(constant_time_msb_s(ret), *outlen, ret); ret = constant_time_select_int(constant_time_msb(ret), ret, 1); return ret; } static int check_padding_md(const EVP_MD *md, int padding) { int mdnid; if (!md) return 1; mdnid = EVP_MD_get_type(md); if (padding == RSA_NO_PADDING) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_PADDING_MODE); return 0; } if (padding == RSA_X931_PADDING) { if (RSA_X931_hash_id(mdnid) == -1) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_X931_DIGEST); return 0; } } else { switch (mdnid) { /* List of all supported RSA digests */ case NID_sha1: case NID_sha224: case NID_sha256: case NID_sha384: case NID_sha512: case NID_sha512_224: case NID_sha512_256: case NID_md5: case NID_md5_sha1: case NID_md2: case NID_md4: case NID_mdc2: case NID_ripemd160: case NID_sha3_224: case NID_sha3_256: case NID_sha3_384: case NID_sha3_512: return 1; default: ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_DIGEST); return 0; } } return 1; } static int pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) { RSA_PKEY_CTX *rctx = ctx->data; switch (type) { case EVP_PKEY_CTRL_RSA_PADDING: if ((p1 >= RSA_PKCS1_PADDING) && (p1 <= RSA_PKCS1_PSS_PADDING)) { if (!check_padding_md(rctx->md, p1)) return 0; if (p1 == RSA_PKCS1_PSS_PADDING) { if (!(ctx->operation & (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY))) goto bad_pad; if (!rctx->md) rctx->md = EVP_sha1(); } else if (pkey_ctx_is_pss(ctx)) { goto bad_pad; } if (p1 == RSA_PKCS1_OAEP_PADDING) { if (!(ctx->operation & EVP_PKEY_OP_TYPE_CRYPT)) goto bad_pad; if (!rctx->md) rctx->md = EVP_sha1(); } rctx->pad_mode = p1; return 1; } bad_pad: ERR_raise(ERR_LIB_RSA, RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE); return -2; case EVP_PKEY_CTRL_GET_RSA_PADDING: *(int *)p2 = rctx->pad_mode; return 1; case EVP_PKEY_CTRL_RSA_PSS_SALTLEN: case EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN: if (rctx->pad_mode != RSA_PKCS1_PSS_PADDING) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_PSS_SALTLEN); return -2; } if (type == EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN) { *(int *)p2 = rctx->saltlen; } else { if (p1 < RSA_PSS_SALTLEN_MAX) return -2; if (rsa_pss_restricted(rctx)) { if (p1 == RSA_PSS_SALTLEN_AUTO && ctx->operation == EVP_PKEY_OP_VERIFY) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_PSS_SALTLEN); return -2; } if ((p1 == RSA_PSS_SALTLEN_DIGEST && rctx->min_saltlen > EVP_MD_get_size(rctx->md)) || (p1 >= 0 && p1 < rctx->min_saltlen)) { ERR_raise(ERR_LIB_RSA, RSA_R_PSS_SALTLEN_TOO_SMALL); return 0; } } rctx->saltlen = p1; } return 1; case EVP_PKEY_CTRL_RSA_KEYGEN_BITS: if (p1 < RSA_MIN_MODULUS_BITS) { ERR_raise(ERR_LIB_RSA, RSA_R_KEY_SIZE_TOO_SMALL); return -2; } rctx->nbits = p1; return 1; case EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP: if (p2 == NULL || !BN_is_odd((BIGNUM *)p2) || BN_is_one((BIGNUM *)p2)) { ERR_raise(ERR_LIB_RSA, RSA_R_BAD_E_VALUE); return -2; } BN_free(rctx->pub_exp); rctx->pub_exp = p2; return 1; case EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES: if (p1 < RSA_DEFAULT_PRIME_NUM || p1 > RSA_MAX_PRIME_NUM) { ERR_raise(ERR_LIB_RSA, RSA_R_KEY_PRIME_NUM_INVALID); return -2; } rctx->primes = p1; return 1; case EVP_PKEY_CTRL_RSA_OAEP_MD: case EVP_PKEY_CTRL_GET_RSA_OAEP_MD: if (rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_PADDING_MODE); return -2; } if (type == EVP_PKEY_CTRL_GET_RSA_OAEP_MD) *(const EVP_MD **)p2 = rctx->md; else rctx->md = p2; return 1; case EVP_PKEY_CTRL_MD: if (!check_padding_md(p2, rctx->pad_mode)) return 0; if (rsa_pss_restricted(rctx)) { if (EVP_MD_get_type(rctx->md) == EVP_MD_get_type(p2)) return 1; ERR_raise(ERR_LIB_RSA, RSA_R_DIGEST_NOT_ALLOWED); return 0; } rctx->md = p2; return 1; case EVP_PKEY_CTRL_GET_MD: *(const EVP_MD **)p2 = rctx->md; return 1; case EVP_PKEY_CTRL_RSA_MGF1_MD: case EVP_PKEY_CTRL_GET_RSA_MGF1_MD: if (rctx->pad_mode != RSA_PKCS1_PSS_PADDING && rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_MGF1_MD); return -2; } if (type == EVP_PKEY_CTRL_GET_RSA_MGF1_MD) { if (rctx->mgf1md) *(const EVP_MD **)p2 = rctx->mgf1md; else *(const EVP_MD **)p2 = rctx->md; } else { if (rsa_pss_restricted(rctx)) { if (EVP_MD_get_type(rctx->mgf1md) == EVP_MD_get_type(p2)) return 1; ERR_raise(ERR_LIB_RSA, RSA_R_MGF1_DIGEST_NOT_ALLOWED); return 0; } rctx->mgf1md = p2; } return 1; case EVP_PKEY_CTRL_RSA_OAEP_LABEL: if (rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_PADDING_MODE); return -2; } OPENSSL_free(rctx->oaep_label); if (p2 && p1 > 0) { rctx->oaep_label = p2; rctx->oaep_labellen = p1; } else { rctx->oaep_label = NULL; rctx->oaep_labellen = 0; } return 1; case EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL: if (rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_PADDING_MODE); return -2; } if (p2 == NULL) { ERR_raise(ERR_LIB_EVP, ERR_R_PASSED_NULL_PARAMETER); return 0; } *(unsigned char **)p2 = rctx->oaep_label; return rctx->oaep_labellen; case EVP_PKEY_CTRL_RSA_IMPLICIT_REJECTION: if (rctx->pad_mode != RSA_PKCS1_PADDING) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_PADDING_MODE); return -2; } rctx->implicit_rejection = p1; return 1; case EVP_PKEY_CTRL_DIGESTINIT: case EVP_PKEY_CTRL_PKCS7_SIGN: #ifndef OPENSSL_NO_CMS case EVP_PKEY_CTRL_CMS_SIGN: #endif return 1; case EVP_PKEY_CTRL_PKCS7_ENCRYPT: case EVP_PKEY_CTRL_PKCS7_DECRYPT: #ifndef OPENSSL_NO_CMS case EVP_PKEY_CTRL_CMS_DECRYPT: case EVP_PKEY_CTRL_CMS_ENCRYPT: #endif if (!pkey_ctx_is_pss(ctx)) return 1; /* fall through */ case EVP_PKEY_CTRL_PEER_KEY: ERR_raise(ERR_LIB_RSA, RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); return -2; default: return -2; } } static int pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) { if (value == NULL) { ERR_raise(ERR_LIB_RSA, RSA_R_VALUE_MISSING); return 0; } if (strcmp(type, "rsa_padding_mode") == 0) { int pm; if (strcmp(value, "pkcs1") == 0) { pm = RSA_PKCS1_PADDING; } else if (strcmp(value, "none") == 0) { pm = RSA_NO_PADDING; } else if (strcmp(value, "oeap") == 0) { pm = RSA_PKCS1_OAEP_PADDING; } else if (strcmp(value, "oaep") == 0) { pm = RSA_PKCS1_OAEP_PADDING; } else if (strcmp(value, "x931") == 0) { pm = RSA_X931_PADDING; } else if (strcmp(value, "pss") == 0) { pm = RSA_PKCS1_PSS_PADDING; } else { ERR_raise(ERR_LIB_RSA, RSA_R_UNKNOWN_PADDING_TYPE); return -2; } return EVP_PKEY_CTX_set_rsa_padding(ctx, pm); } if (strcmp(type, "rsa_pss_saltlen") == 0) { int saltlen; if (!strcmp(value, "digest")) saltlen = RSA_PSS_SALTLEN_DIGEST; else if (!strcmp(value, "max")) saltlen = RSA_PSS_SALTLEN_MAX; else if (!strcmp(value, "auto")) saltlen = RSA_PSS_SALTLEN_AUTO; else saltlen = atoi(value); return EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, saltlen); } if (strcmp(type, "rsa_keygen_bits") == 0) { int nbits = atoi(value); return EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, nbits); } if (strcmp(type, "rsa_keygen_pubexp") == 0) { int ret; BIGNUM *pubexp = NULL; if (!BN_asc2bn(&pubexp, value)) return 0; ret = EVP_PKEY_CTX_set1_rsa_keygen_pubexp(ctx, pubexp); BN_free(pubexp); return ret; } if (strcmp(type, "rsa_keygen_primes") == 0) { int nprimes = atoi(value); return EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, nprimes); } if (strcmp(type, "rsa_mgf1_md") == 0) return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, EVP_PKEY_CTRL_RSA_MGF1_MD, value); if (pkey_ctx_is_pss(ctx)) { if (strcmp(type, "rsa_pss_keygen_mgf1_md") == 0) return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_KEYGEN, EVP_PKEY_CTRL_RSA_MGF1_MD, value); if (strcmp(type, "rsa_pss_keygen_md") == 0) return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_KEYGEN, EVP_PKEY_CTRL_MD, value); if (strcmp(type, "rsa_pss_keygen_saltlen") == 0) { int saltlen = atoi(value); return EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(ctx, saltlen); } } if (strcmp(type, "rsa_oaep_md") == 0) return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_CRYPT, EVP_PKEY_CTRL_RSA_OAEP_MD, value); if (strcmp(type, "rsa_oaep_label") == 0) { unsigned char *lab; long lablen; int ret; lab = OPENSSL_hexstr2buf(value, &lablen); if (!lab) return 0; ret = EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, lab, lablen); if (ret <= 0) OPENSSL_free(lab); return ret; } return -2; } /* Set PSS parameters when generating a key, if necessary */ static int rsa_set_pss_param(RSA *rsa, EVP_PKEY_CTX *ctx) { RSA_PKEY_CTX *rctx = ctx->data; if (!pkey_ctx_is_pss(ctx)) return 1; /* If all parameters are default values don't set pss */ if (rctx->md == NULL && rctx->mgf1md == NULL && rctx->saltlen == -2) return 1; rsa->pss = ossl_rsa_pss_params_create(rctx->md, rctx->mgf1md, rctx->saltlen == -2 ? 0 : rctx->saltlen); if (rsa->pss == NULL) return 0; return 1; } static int pkey_rsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) { RSA *rsa = NULL; RSA_PKEY_CTX *rctx = ctx->data; BN_GENCB *pcb; int ret; if (rctx->pub_exp == NULL) { rctx->pub_exp = BN_new(); if (rctx->pub_exp == NULL || !BN_set_word(rctx->pub_exp, RSA_F4)) return 0; } rsa = RSA_new(); if (rsa == NULL) return 0; if (ctx->pkey_gencb) { pcb = BN_GENCB_new(); if (pcb == NULL) { RSA_free(rsa); return 0; } evp_pkey_set_cb_translate(pcb, ctx); } else { pcb = NULL; } ret = RSA_generate_multi_prime_key(rsa, rctx->nbits, rctx->primes, rctx->pub_exp, pcb); BN_GENCB_free(pcb); if (ret > 0 && !rsa_set_pss_param(rsa, ctx)) { RSA_free(rsa); return 0; } if (ret > 0) EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, rsa); else RSA_free(rsa); return ret; } static const EVP_PKEY_METHOD rsa_pkey_meth = { EVP_PKEY_RSA, EVP_PKEY_FLAG_AUTOARGLEN, pkey_rsa_init, pkey_rsa_copy, pkey_rsa_cleanup, 0, 0, 0, pkey_rsa_keygen, 0, pkey_rsa_sign, 0, pkey_rsa_verify, 0, pkey_rsa_verifyrecover, 0, 0, 0, 0, 0, pkey_rsa_encrypt, 0, pkey_rsa_decrypt, 0, 0, pkey_rsa_ctrl, pkey_rsa_ctrl_str }; const EVP_PKEY_METHOD *ossl_rsa_pkey_method(void) { return &rsa_pkey_meth; } /* * Called for PSS sign or verify initialisation: checks PSS parameter * sanity and sets any restrictions on key usage. */ static int pkey_pss_init(EVP_PKEY_CTX *ctx) { const RSA *rsa; RSA_PKEY_CTX *rctx = ctx->data; const EVP_MD *md; const EVP_MD *mgf1md; int min_saltlen, max_saltlen; /* Should never happen */ if (!pkey_ctx_is_pss(ctx)) return 0; rsa = EVP_PKEY_get0_RSA(ctx->pkey); /* If no restrictions just return */ if (rsa->pss == NULL) return 1; /* Get and check parameters */ if (!ossl_rsa_pss_get_param(rsa->pss, &md, &mgf1md, &min_saltlen)) return 0; /* See if minimum salt length exceeds maximum possible */ max_saltlen = RSA_size(rsa) - EVP_MD_get_size(md); if ((RSA_bits(rsa) & 0x7) == 1) max_saltlen--; if (min_saltlen > max_saltlen) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_SALT_LENGTH); return 0; } rctx->min_saltlen = min_saltlen; /* * Set PSS restrictions as defaults: we can then block any attempt to * use invalid values in pkey_rsa_ctrl */ rctx->md = md; rctx->mgf1md = mgf1md; rctx->saltlen = min_saltlen; return 1; } static const EVP_PKEY_METHOD rsa_pss_pkey_meth = { EVP_PKEY_RSA_PSS, EVP_PKEY_FLAG_AUTOARGLEN, pkey_rsa_init, pkey_rsa_copy, pkey_rsa_cleanup, 0, 0, 0, pkey_rsa_keygen, pkey_pss_init, pkey_rsa_sign, pkey_pss_init, pkey_rsa_verify, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, pkey_rsa_ctrl, pkey_rsa_ctrl_str }; const EVP_PKEY_METHOD *ossl_rsa_pss_pkey_method(void) { return &rsa_pss_pkey_meth; }