summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-10-25 00:18:19 +0000
committertb <>2024-10-25 00:18:19 +0000
commit83e184bcfa6b0f7c9edf29ce784e452d3fa88fb3 (patch)
tree56d304dd124157ca449c4f75e94654259d95abb8 /src
parentc00fb2143c3c47d819f7fb7f2965af6e61d27fde (diff)
downloadopenbsd-83e184bcfa6b0f7c9edf29ce784e452d3fa88fb3.tar.gz
openbsd-83e184bcfa6b0f7c9edf29ce784e452d3fa88fb3.tar.bz2
openbsd-83e184bcfa6b0f7c9edf29ce784e452d3fa88fb3.zip
Add regress for {d2i,i2d}_ECPrivateKey() and {o2i,i2o}_ECPublicKey()
Some test cases are disabled since they exercise an upcoming bug fix.
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libcrypto/ec/ec_asn1_test.c1004
1 files changed, 1003 insertions, 1 deletions
diff --git a/src/regress/lib/libcrypto/ec/ec_asn1_test.c b/src/regress/lib/libcrypto/ec/ec_asn1_test.c
index aaff4aa11f..5fd4475466 100644
--- a/src/regress/lib/libcrypto/ec/ec_asn1_test.c
+++ b/src/regress/lib/libcrypto/ec/ec_asn1_test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_asn1_test.c,v 1.13 2024/10/18 19:58:43 tb Exp $ */ 1/* $OpenBSD: ec_asn1_test.c,v 1.14 2024/10/25 00:18:19 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org>
@@ -896,6 +896,1007 @@ ec_group_non_builtin_curves(void)
896 return failed; 896 return failed;
897} 897}
898 898
899static const struct ec_private_key {
900 const char *name;
901 size_t der_len;
902 uint8_t der[256];
903} ec_private_keys[] = {
904 {
905 .name = "secp112r1",
906 .der_len = 64,
907 .der = {
908 0x30, 0x3e, 0x02, 0x01, 0x01, 0x04, 0x0e, 0x6a,
909 0xbb, 0xb5, 0x15, 0xda, 0xa6, 0xe9, 0x85, 0x64,
910 0xc4, 0x6c, 0x00, 0xef, 0x3f, 0xa0, 0x07, 0x06,
911 0x05, 0x2b, 0x81, 0x04, 0x00, 0x06, 0xa1, 0x20,
912 0x03, 0x1e, 0x00, 0x04, 0x0f, 0xa9, 0x6a, 0xcd,
913 0x14, 0x65, 0x87, 0xe4, 0x2c, 0x58, 0x86, 0x1b,
914 0x7a, 0x3d, 0x49, 0x3a, 0xaa, 0xeb, 0x97, 0xec,
915 0x19, 0xa3, 0x92, 0x3d, 0xe7, 0xe6, 0x6e, 0x47,
916 },
917 },
918 {
919 .name = "secp112r2",
920 .der_len = 64,
921 .der = {
922 0x30, 0x3e, 0x02, 0x01, 0x01, 0x04, 0x0e, 0x02,
923 0x97, 0xb2, 0xbb, 0x96, 0xa4, 0xdb, 0x26, 0xd6,
924 0x92, 0xb7, 0x75, 0x1c, 0x90, 0xa0, 0x07, 0x06,
925 0x05, 0x2b, 0x81, 0x04, 0x00, 0x07, 0xa1, 0x20,
926 0x03, 0x1e, 0x00, 0x04, 0x64, 0x2d, 0x25, 0x53,
927 0x3f, 0x43, 0xf2, 0x69, 0xb2, 0x55, 0x8d, 0x7c,
928 0xfd, 0x57, 0x7a, 0x8f, 0x38, 0x8b, 0x04, 0xd9,
929 0xae, 0x3b, 0xcf, 0x10, 0x30, 0x29, 0xdb, 0x59,
930 },
931 },
932 {
933 .name = "secp128r1",
934 .der_len = 70,
935 .der = {
936 0x30, 0x44, 0x02, 0x01, 0x01, 0x04, 0x10, 0x07,
937 0xd8, 0x7a, 0xf8, 0xda, 0xaf, 0x45, 0x03, 0xb5,
938 0x68, 0x63, 0xbd, 0xda, 0xcb, 0xd7, 0x70, 0xa0,
939 0x07, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x1c,
940 0xa1, 0x24, 0x03, 0x22, 0x00, 0x04, 0x3f, 0x88,
941 0x45, 0x10, 0x52, 0xc2, 0xf6, 0x56, 0x88, 0x1b,
942 0x6e, 0xee, 0x30, 0x21, 0x64, 0x98, 0x74, 0xde,
943 0x31, 0xaf, 0xd3, 0x85, 0x5e, 0x4d, 0xc0, 0xee,
944 0x06, 0x4c, 0x26, 0x6d, 0x5e, 0x6d,
945 },
946 },
947 {
948 .name = "secp128r2",
949 .der_len = 70,
950 .der = {
951 0x30, 0x44, 0x02, 0x01, 0x01, 0x04, 0x10, 0x16,
952 0x97, 0x3c, 0x79, 0xa0, 0x8f, 0x38, 0x41, 0x25,
953 0x64, 0xc6, 0x81, 0x5a, 0xce, 0xe4, 0x9f, 0xa0,
954 0x07, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x1d,
955 0xa1, 0x24, 0x03, 0x22, 0x00, 0x04, 0xd5, 0xf5,
956 0x1c, 0x2f, 0x02, 0xc0, 0x39, 0xeb, 0x6c, 0x7b,
957 0x20, 0x2b, 0xcf, 0x67, 0xe0, 0x8a, 0x2b, 0x83,
958 0x0d, 0x54, 0x61, 0xa0, 0xf3, 0x32, 0xdc, 0xe1,
959 0x19, 0xbb, 0x6e, 0xcf, 0x3c, 0xe2,
960 },
961 },
962#if 0
963 {
964 .name = "secp160k1",
965 .der_len = 83,
966 .der = {
967 0x30, 0x51, 0x02, 0x01, 0x01, 0x04, 0x15, 0x00,
968 0x3c, 0x42, 0x8b, 0x77, 0x87, 0x63, 0xab, 0x61,
969 0xff, 0x18, 0xf5, 0x96, 0xa6, 0x41, 0x48, 0xf6,
970 0xf5, 0x85, 0xa5, 0x00, 0xa0, 0x07, 0x06, 0x05,
971 0x2b, 0x81, 0x04, 0x00, 0x09, 0xa1, 0x2c, 0x03,
972 0x2a, 0x00, 0x04, 0xfe, 0x46, 0xef, 0xa6, 0xde,
973 0x95, 0x20, 0x34, 0x2e, 0x7c, 0x65, 0xe9, 0x31,
974 0xef, 0x5b, 0xd6, 0xb2, 0x80, 0x0a, 0x03, 0xba,
975 0xe8, 0xc6, 0x9c, 0x89, 0xff, 0x3d, 0x6b, 0xa5,
976 0x63, 0x8d, 0x7f, 0x17, 0x3e, 0x28, 0x49, 0xcc,
977 0xcd, 0x6e, 0xb0,
978 },
979 },
980 {
981 .name = "secp160r1",
982 .der_len = 83,
983 .der = {
984 0x30, 0x51, 0x02, 0x01, 0x01, 0x04, 0x15, 0x00,
985 0xbf, 0x64, 0xb4, 0xc1, 0x9b, 0xd7, 0x76, 0x1e,
986 0xe8, 0x6f, 0xbf, 0x54, 0xa1, 0xfc, 0x7d, 0x4e,
987 0xfa, 0xf3, 0xcd, 0x2c, 0xa0, 0x07, 0x06, 0x05,
988 0x2b, 0x81, 0x04, 0x00, 0x08, 0xa1, 0x2c, 0x03,
989 0x2a, 0x00, 0x04, 0xda, 0xf0, 0xda, 0x8c, 0xad,
990 0x13, 0xe1, 0x12, 0x3b, 0x53, 0xef, 0x94, 0x98,
991 0xa3, 0x57, 0x85, 0xbb, 0x20, 0xc0, 0xd8, 0xb6,
992 0x61, 0xad, 0x44, 0x79, 0xd4, 0xbe, 0x3e, 0x6c,
993 0xcb, 0xae, 0x9e, 0xe0, 0xa2, 0x7e, 0x26, 0x6b,
994 0xfe, 0xc4, 0xa7,
995 },
996 },
997 {
998 .name = "secp160r2",
999 .der_len = 83,
1000 .der = {
1001 0x30, 0x51, 0x02, 0x01, 0x01, 0x04, 0x15, 0x00,
1002 0x86, 0x4b, 0xae, 0x32, 0x2a, 0x3a, 0xed, 0xb3,
1003 0xad, 0x02, 0x05, 0x6b, 0x0b, 0x9b, 0x3c, 0xae,
1004 0x51, 0xd9, 0x46, 0x3e, 0xa0, 0x07, 0x06, 0x05,
1005 0x2b, 0x81, 0x04, 0x00, 0x1e, 0xa1, 0x2c, 0x03,
1006 0x2a, 0x00, 0x04, 0x36, 0xce, 0x2a, 0xbb, 0xec,
1007 0x29, 0xdf, 0xda, 0x52, 0x21, 0x8b, 0x8b, 0x49,
1008 0x37, 0xe3, 0xd6, 0x7f, 0xab, 0x66, 0x20, 0x81,
1009 0xc7, 0x30, 0xeb, 0x00, 0xf0, 0xad, 0x66, 0x7c,
1010 0x79, 0x19, 0xdc, 0xb1, 0x03, 0xdc, 0xcb, 0x73,
1011 0x2b, 0x02, 0x63,
1012 },
1013 },
1014#endif
1015 {
1016 .name = "secp192k1",
1017 .der_len = 94,
1018 .der = {
1019 0x30, 0x5c, 0x02, 0x01, 0x01, 0x04, 0x18, 0x6b,
1020 0x81, 0x52, 0x97, 0xaf, 0xd3, 0x6b, 0xf3, 0xdb,
1021 0xff, 0xaf, 0x73, 0x66, 0x83, 0x09, 0x84, 0x78,
1022 0x87, 0xe1, 0xfb, 0x17, 0x35, 0x87, 0x3f, 0xa0,
1023 0x07, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x1f,
1024 0xa1, 0x34, 0x03, 0x32, 0x00, 0x04, 0xa8, 0x7c,
1025 0x1e, 0x15, 0xf0, 0x1c, 0x8a, 0x8d, 0x7e, 0x14,
1026 0xdb, 0x07, 0xd1, 0xac, 0xaf, 0x25, 0x77, 0xe5,
1027 0x39, 0xbd, 0x59, 0x5a, 0xed, 0x64, 0x14, 0xef,
1028 0xd3, 0xf2, 0x33, 0xab, 0x7b, 0xd5, 0x9e, 0x2a,
1029 0x95, 0xed, 0x6f, 0x61, 0x83, 0xc3, 0x06, 0x27,
1030 0x0c, 0x73, 0x6e, 0x73, 0x7c, 0xdc,
1031 },
1032 },
1033#if 0
1034 {
1035 .name = "secp224k1",
1036 .der_len = 107,
1037 .der = {
1038 0x30, 0x69, 0x02, 0x01, 0x01, 0x04, 0x1d, 0x00,
1039 0x32, 0x2b, 0x6d, 0xe3, 0x62, 0x60, 0xda, 0xb2,
1040 0x62, 0x0a, 0x38, 0x3e, 0xd3, 0x8c, 0x70, 0x9e,
1041 0x76, 0x38, 0xac, 0x26, 0x17, 0xa9, 0x00, 0xdf,
1042 0xfb, 0x1e, 0xf3, 0xbd, 0xa0, 0x07, 0x06, 0x05,
1043 0x2b, 0x81, 0x04, 0x00, 0x20, 0xa1, 0x3c, 0x03,
1044 0x3a, 0x00, 0x04, 0x51, 0xc4, 0x69, 0xdf, 0x2d,
1045 0x49, 0x7b, 0x05, 0x6c, 0x12, 0x5f, 0x9a, 0x83,
1046 0x51, 0x7d, 0xf3, 0x4a, 0x6c, 0xe1, 0x3a, 0xea,
1047 0x44, 0x35, 0x3e, 0x7a, 0xa4, 0x40, 0xdf, 0xc4,
1048 0x90, 0x18, 0xfc, 0x2f, 0x5d, 0x4b, 0x12, 0x37,
1049 0x87, 0x4d, 0x2a, 0xf8, 0xbd, 0x29, 0xfb, 0x13,
1050 0x34, 0xef, 0xfb, 0x04, 0xa1, 0x28, 0x7d, 0x51,
1051 0xbe, 0xe7, 0x0b,
1052 },
1053 },
1054#endif
1055 {
1056 .name = "secp224r1",
1057 .der_len = 106,
1058 .der = {
1059 0x30, 0x68, 0x02, 0x01, 0x01, 0x04, 0x1c, 0x76,
1060 0x9b, 0x2f, 0x62, 0xff, 0x5f, 0x84, 0x6c, 0x7e,
1061 0x90, 0xda, 0xfb, 0x70, 0x62, 0xc1, 0xb9, 0xa2,
1062 0xc9, 0xf7, 0x1b, 0x76, 0x7f, 0xbb, 0xb1, 0xd4,
1063 0xa4, 0xa0, 0x42, 0xa0, 0x07, 0x06, 0x05, 0x2b,
1064 0x81, 0x04, 0x00, 0x21, 0xa1, 0x3c, 0x03, 0x3a,
1065 0x00, 0x04, 0x94, 0x84, 0xb0, 0xcd, 0x65, 0xef,
1066 0xc5, 0x5d, 0xc9, 0xe4, 0x91, 0x71, 0xcb, 0xc7,
1067 0xf1, 0x8e, 0x44, 0x39, 0xc2, 0xd3, 0x07, 0xf0,
1068 0x6c, 0xb6, 0xef, 0x77, 0xc0, 0x84, 0x30, 0x2c,
1069 0xd2, 0xf2, 0xf0, 0xb5, 0xb6, 0x6f, 0x0a, 0xf4,
1070 0x43, 0xab, 0x5e, 0x5d, 0xd8, 0x97, 0xbf, 0xab,
1071 0xf4, 0x2d, 0x34, 0x25, 0xee, 0x4c, 0xec, 0xfb,
1072 0x4d, 0x0b,
1073 },
1074 },
1075 {
1076 .name = "secp256k1",
1077 .der_len = 118,
1078 .der = {
1079 0x30, 0x74, 0x02, 0x01, 0x01, 0x04, 0x20, 0xf2,
1080 0xe5, 0x5c, 0x24, 0x66, 0x01, 0x2b, 0x95, 0x96,
1081 0xbf, 0xbd, 0x0e, 0x33, 0x3d, 0xfd, 0x8a, 0x22,
1082 0x79, 0x12, 0xc5, 0x93, 0x28, 0x1b, 0x74, 0x39,
1083 0x61, 0x80, 0x1c, 0x17, 0xb1, 0x36, 0xab, 0xa0,
1084 0x07, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x0a,
1085 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x9f, 0xd2,
1086 0xbe, 0xcc, 0xf8, 0x00, 0xe8, 0xd0, 0x40, 0x73,
1087 0x11, 0xb9, 0x34, 0x76, 0x68, 0xb2, 0x6b, 0x88,
1088 0xea, 0xa6, 0x64, 0x37, 0xe7, 0x06, 0xdf, 0x9f,
1089 0x20, 0xb8, 0xc3, 0x7f, 0x9f, 0x8f, 0xbc, 0x80,
1090 0x65, 0xe9, 0x73, 0xcb, 0x1d, 0xa1, 0xfa, 0x34,
1091 0x23, 0x66, 0xb9, 0x47, 0x89, 0xe9, 0x08, 0x92,
1092 0x5e, 0xb5, 0x37, 0x44, 0x40, 0x1c, 0x34, 0x6c,
1093 0xf2, 0xdb, 0x44, 0x71, 0x26, 0xeb,
1094 },
1095 },
1096 {
1097 .name = "secp384r1",
1098 .der_len = 167,
1099 .der = {
1100 0x30, 0x81, 0xa4, 0x02, 0x01, 0x01, 0x04, 0x30,
1101 0xa0, 0xd3, 0x78, 0x23, 0x51, 0xe1, 0x20, 0x5c,
1102 0xbe, 0x84, 0x11, 0x2f, 0x82, 0x55, 0xfc, 0xd1,
1103 0x5d, 0xae, 0xfc, 0x72, 0x60, 0x50, 0x3c, 0x2d,
1104 0x70, 0xb4, 0x00, 0xe2, 0xe6, 0x0a, 0xdf, 0xc5,
1105 0x56, 0xe6, 0xb8, 0x69, 0xf8, 0xad, 0xf5, 0xfc,
1106 0x95, 0xb3, 0x5b, 0x3d, 0xda, 0x6c, 0x5f, 0x74,
1107 0xa0, 0x07, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00,
1108 0x22, 0xa1, 0x64, 0x03, 0x62, 0x00, 0x04, 0xce,
1109 0x9a, 0x3b, 0x4b, 0x01, 0xe6, 0xc4, 0x5a, 0xfa,
1110 0x97, 0x03, 0xc1, 0xce, 0x18, 0xd5, 0x6c, 0x47,
1111 0x27, 0x4d, 0x6c, 0x9a, 0xbd, 0x47, 0xab, 0x20,
1112 0x0f, 0x99, 0x83, 0x19, 0x8b, 0xcb, 0x18, 0xd7,
1113 0xa3, 0xb2, 0xe7, 0x3b, 0xd0, 0xf1, 0xf3, 0x29,
1114 0xb2, 0x6d, 0x38, 0xd6, 0xcc, 0x8e, 0x5e, 0xf0,
1115 0xb2, 0xb9, 0xbd, 0x85, 0x2c, 0xab, 0x4b, 0xb6,
1116 0x9d, 0x98, 0xa1, 0xce, 0xf1, 0x8a, 0xdb, 0x92,
1117 0x75, 0x7d, 0xf7, 0x82, 0x4c, 0x0a, 0xc7, 0x3b,
1118 0x52, 0x6e, 0x97, 0xc6, 0x23, 0xc9, 0x6f, 0x3f,
1119 0xe5, 0xd2, 0xa2, 0x79, 0x47, 0xb0, 0x6e, 0x5f,
1120 0x85, 0x39, 0x94, 0x57, 0xbf, 0x54, 0x76,
1121 },
1122 },
1123 {
1124 .name = "secp521r1",
1125 .der_len = 223,
1126 .der = {
1127 0x30, 0x81, 0xdc, 0x02, 0x01, 0x01, 0x04, 0x42,
1128 0x01, 0x6e, 0xff, 0x5d, 0x18, 0x50, 0x5b, 0x09,
1129 0xf8, 0x38, 0x10, 0x6c, 0x54, 0x19, 0x59, 0xdb,
1130 0x30, 0xc5, 0x60, 0x28, 0xb1, 0x7f, 0xba, 0x22,
1131 0x06, 0x4d, 0x8a, 0x69, 0x53, 0xb0, 0xc5, 0x8f,
1132 0x17, 0x4d, 0x51, 0xc6, 0x2f, 0x41, 0x4e, 0xf0,
1133 0xab, 0xb4, 0x3a, 0x8f, 0x00, 0x6f, 0x32, 0xe7,
1134 0xe6, 0x56, 0xb7, 0xe9, 0xb1, 0xcd, 0x3a, 0x93,
1135 0xe6, 0x8f, 0xe6, 0x60, 0xb6, 0x80, 0xbd, 0x02,
1136 0xfb, 0x90, 0xa0, 0x07, 0x06, 0x05, 0x2b, 0x81,
1137 0x04, 0x00, 0x23, 0xa1, 0x81, 0x89, 0x03, 0x81,
1138 0x86, 0x00, 0x04, 0x01, 0xd2, 0xc3, 0x78, 0x41,
1139 0xb1, 0x86, 0x24, 0xca, 0x6d, 0x80, 0x5c, 0x97,
1140 0xcf, 0x96, 0xf0, 0x87, 0xb4, 0x25, 0xbe, 0x37,
1141 0x9a, 0xf3, 0xe5, 0x4a, 0x70, 0xd1, 0xe6, 0x36,
1142 0x9e, 0x69, 0xcc, 0xfb, 0x83, 0xd6, 0xa1, 0x62,
1143 0x6d, 0xa8, 0xe6, 0xca, 0xe7, 0x0e, 0x24, 0xe6,
1144 0x26, 0xcd, 0xc0, 0x0d, 0x2a, 0x01, 0x81, 0x6a,
1145 0xd6, 0x94, 0xf2, 0x90, 0xcd, 0x26, 0x68, 0x28,
1146 0x2c, 0x57, 0xd3, 0xf0, 0x37, 0x00, 0xbc, 0x5e,
1147 0xfa, 0xf9, 0x36, 0xcd, 0x0f, 0xeb, 0x4f, 0x82,
1148 0x17, 0x6a, 0xa0, 0x73, 0xd2, 0x48, 0xfc, 0xfb,
1149 0xf0, 0x54, 0xc3, 0x23, 0x29, 0x76, 0xc7, 0x21,
1150 0x98, 0x09, 0x29, 0x8b, 0xce, 0x6e, 0x6b, 0xe3,
1151 0x97, 0x94, 0xb2, 0x30, 0xaa, 0xf6, 0x43, 0x5c,
1152 0x15, 0xd7, 0xb8, 0xdb, 0x06, 0x92, 0xa8, 0x36,
1153 0x8f, 0x89, 0xb6, 0x39, 0x2c, 0x2c, 0x23, 0x0a,
1154 0xb6, 0x95, 0x9c, 0x6b, 0xce, 0xc4, 0x8e,
1155 },
1156 },
1157 {
1158 .name = "prime192v1",
1159 .der_len = 97,
1160 .der = {
1161 0x30, 0x5f, 0x02, 0x01, 0x01, 0x04, 0x18, 0x70,
1162 0x28, 0x4b, 0x5c, 0x39, 0xf6, 0x28, 0xea, 0xe0,
1163 0xf4, 0xbc, 0x95, 0x12, 0x05, 0x4e, 0xee, 0x61,
1164 0x84, 0x3e, 0xbc, 0xe7, 0xae, 0x6c, 0x28, 0xa0,
1165 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
1166 0x03, 0x01, 0x01, 0xa1, 0x34, 0x03, 0x32, 0x00,
1167 0x04, 0x6e, 0x8a, 0x84, 0x2c, 0x8a, 0x39, 0xee,
1168 0x94, 0x6b, 0xb2, 0x8a, 0x17, 0x8e, 0x96, 0x5e,
1169 0xa2, 0x0f, 0x2e, 0xb0, 0x73, 0x43, 0x56, 0x46,
1170 0xf1, 0x02, 0xe8, 0xa6, 0x81, 0x41, 0x93, 0x74,
1171 0xfe, 0xe6, 0x4c, 0xf6, 0xb9, 0x5a, 0x39, 0x18,
1172 0x6a, 0xba, 0x4e, 0x52, 0xeb, 0x29, 0x81, 0x87,
1173 0x92,
1174 },
1175 },
1176 {
1177 .name = "prime192v2",
1178 .der_len = 97,
1179 .der = {
1180 0x30, 0x5f, 0x02, 0x01, 0x01, 0x04, 0x18, 0x1a,
1181 0x8a, 0x60, 0x51, 0xe0, 0xd6, 0x66, 0x15, 0x47,
1182 0xba, 0xec, 0xec, 0x0c, 0xa6, 0x26, 0xd4, 0x6d,
1183 0x60, 0x81, 0x22, 0xe6, 0xb2, 0x43, 0x5b, 0xa0,
1184 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
1185 0x03, 0x01, 0x02, 0xa1, 0x34, 0x03, 0x32, 0x00,
1186 0x04, 0x62, 0x5d, 0xfb, 0x0e, 0x58, 0x95, 0xd1,
1187 0xe7, 0x13, 0x66, 0x9a, 0x0c, 0x5c, 0xef, 0x2f,
1188 0x2f, 0x33, 0xbb, 0x2b, 0xa0, 0x09, 0x6e, 0x04,
1189 0x3e, 0x01, 0x3c, 0x60, 0x5e, 0xc3, 0xba, 0xfc,
1190 0x1c, 0xb9, 0x4d, 0x0d, 0xb5, 0xa9, 0x9e, 0x56,
1191 0x4b, 0xab, 0x5b, 0x66, 0xa7, 0x98, 0xa6, 0x9a,
1192 0xe6,
1193 },
1194 },
1195 {
1196 .name = "prime192v3",
1197 .der_len = 97,
1198 .der = {
1199 0x30, 0x5f, 0x02, 0x01, 0x01, 0x04, 0x18, 0x9c,
1200 0x56, 0xc9, 0xaf, 0xc1, 0x86, 0x00, 0x04, 0x9a,
1201 0xb0, 0xb9, 0x11, 0x4c, 0x72, 0x07, 0xe7, 0xa5,
1202 0x4c, 0x73, 0x66, 0x4c, 0x14, 0x70, 0x33, 0xa0,
1203 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
1204 0x03, 0x01, 0x03, 0xa1, 0x34, 0x03, 0x32, 0x00,
1205 0x04, 0x51, 0x38, 0x9f, 0x96, 0x4e, 0x13, 0x0c,
1206 0xe2, 0x93, 0xee, 0xc6, 0x44, 0x10, 0xfd, 0xff,
1207 0xae, 0xd4, 0x08, 0x0f, 0x3a, 0x78, 0x71, 0xdc,
1208 0xfe, 0x6d, 0x46, 0x0e, 0xe4, 0xe6, 0x99, 0xd1,
1209 0x25, 0x8c, 0xb8, 0xc0, 0xe9, 0x7c, 0x7a, 0xd3,
1210 0xc8, 0xd8, 0x3a, 0xc5, 0x7d, 0xfb, 0x9c, 0x78,
1211 0xd3,
1212 },
1213 },
1214 {
1215 .name = "prime239v1",
1216 .der_len = 115,
1217 .der = {
1218 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x6e,
1219 0x26, 0x5e, 0xde, 0x5b, 0x67, 0xd6, 0x38, 0x52,
1220 0xe7, 0x1e, 0x8d, 0x44, 0xb1, 0xfb, 0xf8, 0xaf,
1221 0xf9, 0x94, 0x2c, 0xe2, 0x0d, 0xa8, 0x5f, 0x03,
1222 0x67, 0x53, 0x7b, 0x8b, 0x2e, 0xa0, 0x0a, 0x06,
1223 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01,
1224 0x04, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x33,
1225 0xc6, 0xe5, 0x8a, 0xc1, 0x8b, 0x7c, 0x96, 0x19,
1226 0xc9, 0xe1, 0x54, 0x7f, 0x81, 0x9e, 0x59, 0x62,
1227 0xec, 0xc0, 0x1e, 0xe5, 0x53, 0xd5, 0xae, 0x6b,
1228 0xd3, 0xe0, 0x09, 0x07, 0xc5, 0x27, 0x81, 0xa6,
1229 0x8d, 0x39, 0x8e, 0xfe, 0x01, 0xc2, 0x1d, 0xda,
1230 0xde, 0x7b, 0xdc, 0x76, 0x27, 0x17, 0xf9, 0x6f,
1231 0xe3, 0x04, 0xef, 0x5d, 0x65, 0x75, 0x98, 0x7f,
1232 0x2d, 0xd0, 0x68,
1233 },
1234 },
1235 {
1236 .name = "prime239v2",
1237 .der_len = 115,
1238 .der = {
1239 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x30,
1240 0x2f, 0x01, 0x10, 0xe9, 0x09, 0x15, 0xdd, 0xe3,
1241 0xdd, 0xae, 0xcb, 0x9d, 0x3a, 0x58, 0x92, 0x02,
1242 0x1e, 0x6e, 0x02, 0x57, 0xa8, 0x36, 0x0b, 0x20,
1243 0x0b, 0x7e, 0xf4, 0xad, 0x0b, 0xa0, 0x0a, 0x06,
1244 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01,
1245 0x05, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x3c,
1246 0x10, 0x27, 0x7b, 0xac, 0xdf, 0x86, 0xc9, 0x4f,
1247 0xf8, 0x39, 0x87, 0x02, 0x39, 0xaf, 0x41, 0xbc,
1248 0x4b, 0x67, 0xd8, 0x5e, 0x04, 0x96, 0x84, 0xb5,
1249 0x60, 0x50, 0x48, 0x6a, 0x20, 0x1d, 0x2b, 0x7e,
1250 0x9f, 0xaf, 0xf8, 0x8e, 0x7e, 0xa4, 0xcd, 0x00,
1251 0xad, 0xb1, 0xad, 0x22, 0x69, 0x32, 0x10, 0x6c,
1252 0xe0, 0xcc, 0xdd, 0x45, 0xd8, 0xa6, 0x29, 0x2f,
1253 0xad, 0x6b, 0xf9,
1254 },
1255 },
1256 {
1257 .name = "prime239v3",
1258 .der_len = 115,
1259 .der = {
1260 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x26,
1261 0x3f, 0x23, 0x4c, 0xe7, 0xbd, 0xa8, 0xe4, 0xfe,
1262 0x7c, 0xf6, 0x18, 0x6a, 0xb2, 0xa6, 0x39, 0x15,
1263 0x6d, 0x72, 0xe8, 0x9e, 0x3f, 0x0f, 0x10, 0x1e,
1264 0xe5, 0xdf, 0xac, 0xe8, 0x2f, 0xa0, 0x0a, 0x06,
1265 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01,
1266 0x06, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x37,
1267 0xba, 0x07, 0x7f, 0xd9, 0x46, 0x5a, 0x33, 0x03,
1268 0x31, 0x77, 0x38, 0xef, 0xee, 0xcc, 0x3d, 0xe1,
1269 0xaa, 0x57, 0xe3, 0x8d, 0xb7, 0xcd, 0xe3, 0x01,
1270 0xf4, 0xd6, 0x75, 0x49, 0x72, 0x61, 0x4c, 0xbf,
1271 0xc0, 0x1f, 0x8b, 0x5f, 0x98, 0x9b, 0xa7, 0xe5,
1272 0x6a, 0xb7, 0xfe, 0x63, 0xdb, 0xb0, 0x40, 0xcb,
1273 0x26, 0x81, 0x2a, 0x91, 0x14, 0x0f, 0xc7, 0x31,
1274 0x13, 0x78, 0x16,
1275 },
1276 },
1277 {
1278 .name = "prime256v1",
1279 .der_len = 121,
1280 .der = {
1281 0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x6c,
1282 0x83, 0x81, 0x90, 0x65, 0x7b, 0x45, 0x98, 0x66,
1283 0x4b, 0x91, 0x8e, 0xcf, 0x71, 0x61, 0x22, 0xb6,
1284 0xd6, 0x93, 0x74, 0x84, 0xa3, 0xc6, 0x44, 0x71,
1285 0x25, 0xc5, 0xef, 0x77, 0x52, 0xd2, 0x32, 0xa0,
1286 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
1287 0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00,
1288 0x04, 0x96, 0x8a, 0xc3, 0x66, 0x1e, 0xf7, 0xcf,
1289 0xf6, 0xcc, 0x4e, 0x73, 0xae, 0xe2, 0x64, 0xc4,
1290 0x56, 0x5f, 0x2d, 0xfe, 0xde, 0xac, 0x92, 0xbe,
1291 0x10, 0x40, 0x37, 0xce, 0x24, 0x12, 0x30, 0x19,
1292 0x08, 0x66, 0xcf, 0x90, 0xc9, 0x37, 0x03, 0xd1,
1293 0xd5, 0x8d, 0xaa, 0x18, 0x2a, 0xbc, 0xed, 0x82,
1294 0x32, 0xc9, 0x43, 0x4b, 0x98, 0x7f, 0xdc, 0xb1,
1295 0x0b, 0xa6, 0xdd, 0x16, 0xc5, 0x8d, 0x5a, 0xcf,
1296 0xe3,
1297 },
1298 },
1299 {
1300 .name = "wap-wsg-idm-ecid-wtls6",
1301 .der_len = 64,
1302 .der = {
1303 0x30, 0x3e, 0x02, 0x01, 0x01, 0x04, 0x0e, 0xb0,
1304 0x78, 0x23, 0x28, 0xc9, 0xb6, 0x9a, 0x7f, 0xad,
1305 0x36, 0xa8, 0x56, 0x6c, 0xc8, 0xa0, 0x07, 0x06,
1306 0x05, 0x67, 0x2b, 0x01, 0x04, 0x06, 0xa1, 0x20,
1307 0x03, 0x1e, 0x00, 0x04, 0x56, 0x3f, 0x72, 0xf1,
1308 0xb5, 0xee, 0x7a, 0x4c, 0x59, 0x76, 0xd4, 0x97,
1309 0x43, 0x15, 0x6e, 0x27, 0x8a, 0x4f, 0x28, 0x11,
1310 0xb8, 0xf6, 0x80, 0xfe, 0x7a, 0xb1, 0xa2, 0x74,
1311 },
1312 },
1313#if 0
1314 {
1315 .name = "wap-wsg-idm-ecid-wtls7",
1316 .der_len = 83,
1317 .der = {
1318 0x30, 0x51, 0x02, 0x01, 0x01, 0x04, 0x15, 0x00,
1319 0x4a, 0x5e, 0xc3, 0x6c, 0x1d, 0xd5, 0xf3, 0x1b,
1320 0x2e, 0xf1, 0x3a, 0xd3, 0xae, 0x05, 0xc1, 0x6a,
1321 0x90, 0xa4, 0xc2, 0x85, 0xa0, 0x07, 0x06, 0x05,
1322 0x67, 0x2b, 0x01, 0x04, 0x07, 0xa1, 0x2c, 0x03,
1323 0x2a, 0x00, 0x04, 0xaf, 0x84, 0x2d, 0x08, 0xcb,
1324 0xe2, 0xf2, 0xa3, 0xac, 0x20, 0xb0, 0x99, 0x5c,
1325 0x38, 0xd7, 0x5e, 0xce, 0xb9, 0x0b, 0x2e, 0x38,
1326 0xdd, 0xcf, 0x13, 0x7f, 0x5a, 0xfa, 0xac, 0x1d,
1327 0x92, 0x2e, 0x9a, 0xa9, 0x73, 0x2b, 0xc3, 0x06,
1328 0x0e, 0x4e, 0x69,
1329 },
1330 },
1331 {
1332 .name = "wap-wsg-idm-ecid-wtls8",
1333 .der_len = 65,
1334 .der = {
1335 0x30, 0x3f, 0x02, 0x01, 0x01, 0x04, 0x0f, 0x00,
1336 0x65, 0x6b, 0x08, 0x24, 0x76, 0xd2, 0xbe, 0xc6,
1337 0xc2, 0x44, 0x9a, 0xc8, 0x86, 0xdb, 0xa0, 0x07,
1338 0x06, 0x05, 0x67, 0x2b, 0x01, 0x04, 0x08, 0xa1,
1339 0x20, 0x03, 0x1e, 0x00, 0x04, 0x48, 0x81, 0x4b,
1340 0xae, 0x65, 0xf8, 0xda, 0x02, 0x2c, 0x66, 0xc6,
1341 0x0b, 0x1d, 0xa6, 0x98, 0x42, 0x25, 0xf2, 0x31,
1342 0x52, 0x3c, 0x6a, 0x6a, 0x2f, 0x69, 0x1a, 0x06,
1343 0x56,
1344 },
1345 },
1346 {
1347 .name = "wap-wsg-idm-ecid-wtls9",
1348 .der_len = 83,
1349 .der = {
1350 0x30, 0x51, 0x02, 0x01, 0x01, 0x04, 0x15, 0x00,
1351 0xf4, 0x0c, 0x58, 0x87, 0xc4, 0xb6, 0x20, 0xf5,
1352 0x18, 0xc2, 0x46, 0x9b, 0x2d, 0xbf, 0x1d, 0x56,
1353 0x26, 0x07, 0x7f, 0x85, 0xa0, 0x07, 0x06, 0x05,
1354 0x67, 0x2b, 0x01, 0x04, 0x09, 0xa1, 0x2c, 0x03,
1355 0x2a, 0x00, 0x04, 0xaa, 0xfc, 0xe4, 0xfe, 0xf8,
1356 0x91, 0x48, 0xf1, 0xcc, 0x49, 0x44, 0x35, 0x3d,
1357 0x49, 0x71, 0x44, 0xdc, 0x74, 0x73, 0x5b, 0x5f,
1358 0x01, 0x4b, 0xab, 0x8b, 0x5c, 0x84, 0xec, 0x2b,
1359 0xfa, 0x7e, 0xdc, 0x50, 0xc4, 0xac, 0xea, 0x84,
1360 0x2f, 0xba, 0x3c,
1361 },
1362 },
1363#endif
1364 {
1365 .name = "wap-wsg-idm-ecid-wtls12",
1366 .der_len = 106,
1367 .der = {
1368 0x30, 0x68, 0x02, 0x01, 0x01, 0x04, 0x1c, 0x19,
1369 0x63, 0x30, 0xa6, 0x6b, 0xd3, 0xc6, 0x7a, 0x65,
1370 0xec, 0x6f, 0xe9, 0x2a, 0x37, 0x12, 0xa1, 0x44,
1371 0xe0, 0x42, 0x26, 0x4e, 0x11, 0xc4, 0xec, 0x2b,
1372 0x0a, 0x8b, 0x96, 0xa0, 0x07, 0x06, 0x05, 0x67,
1373 0x2b, 0x01, 0x04, 0x0c, 0xa1, 0x3c, 0x03, 0x3a,
1374 0x00, 0x04, 0x47, 0xd6, 0x63, 0x27, 0xe1, 0xad,
1375 0x30, 0xac, 0xba, 0xab, 0x86, 0xd6, 0x63, 0xb5,
1376 0xd9, 0xc5, 0x9c, 0x24, 0x3a, 0xd9, 0x6a, 0x7a,
1377 0x5d, 0x2b, 0x45, 0x71, 0x8d, 0x7e, 0xd2, 0x32,
1378 0x75, 0x65, 0xc4, 0x37, 0x25, 0xc7, 0x1f, 0xeb,
1379 0x33, 0xf7, 0x68, 0x29, 0x16, 0x82, 0x96, 0xd9,
1380 0x00, 0xaf, 0xdc, 0x4a, 0xe7, 0xc6, 0x61, 0x44,
1381 0x50, 0xc6,
1382 },
1383 },
1384 {
1385 .name = "brainpoolP160r1",
1386 .der_len = 86,
1387 .der = {
1388 0x30, 0x54, 0x02, 0x01, 0x01, 0x04, 0x14, 0x97,
1389 0x68, 0xac, 0xb7, 0x50, 0x24, 0x24, 0x39, 0x41,
1390 0x6e, 0x90, 0x27, 0xea, 0x6f, 0xaa, 0x11, 0x29,
1391 0xa2, 0x4e, 0xae, 0xa0, 0x0b, 0x06, 0x09, 0x2b,
1392 0x24, 0x03, 0x03, 0x02, 0x08, 0x01, 0x01, 0x01,
1393 0xa1, 0x2c, 0x03, 0x2a, 0x00, 0x04, 0x4c, 0x15,
1394 0x49, 0x81, 0x94, 0xf5, 0x6e, 0x80, 0x8e, 0xc8,
1395 0x65, 0xea, 0x48, 0xfa, 0x29, 0xc2, 0x59, 0xf1,
1396 0x36, 0xd6, 0x8d, 0xa4, 0xc5, 0xe0, 0x7d, 0xe5,
1397 0xa2, 0xcc, 0xc4, 0xd0, 0x1d, 0xd6, 0xe6, 0xcf,
1398 0x11, 0x6e, 0x59, 0x12, 0xbb, 0x14,
1399 },
1400 },
1401 {
1402 .name = "brainpoolP160t1",
1403 .der_len = 86,
1404 .der = {
1405 0x30, 0x54, 0x02, 0x01, 0x01, 0x04, 0x14, 0x2a,
1406 0xa6, 0xfa, 0x75, 0x2b, 0xb4, 0xc9, 0x99, 0xbb,
1407 0x61, 0xeb, 0x15, 0xdc, 0xf3, 0xd1, 0x42, 0x63,
1408 0x30, 0x5d, 0x73, 0xa0, 0x0b, 0x06, 0x09, 0x2b,
1409 0x24, 0x03, 0x03, 0x02, 0x08, 0x01, 0x01, 0x02,
1410 0xa1, 0x2c, 0x03, 0x2a, 0x00, 0x04, 0x96, 0x4b,
1411 0x2c, 0x8a, 0xed, 0x9b, 0x18, 0x30, 0xc1, 0x1c,
1412 0xbc, 0x16, 0x56, 0x7b, 0xc0, 0x3a, 0x6c, 0x52,
1413 0xf8, 0x71, 0xdf, 0x54, 0x20, 0x96, 0xe3, 0xe9,
1414 0xcf, 0x8f, 0x31, 0xb1, 0x69, 0x99, 0xc6, 0x11,
1415 0x80, 0x0d, 0x40, 0x25, 0xf0, 0x90,
1416 },
1417 },
1418 {
1419 .name = "brainpoolP192r1",
1420 .der_len = 98,
1421 .der = {
1422 0x30, 0x60, 0x02, 0x01, 0x01, 0x04, 0x18, 0x7c,
1423 0x05, 0x09, 0x95, 0xaf, 0x22, 0x1f, 0xc0, 0x0d,
1424 0xfe, 0x6d, 0x44, 0xf2, 0x87, 0x0c, 0x7d, 0x0e,
1425 0xed, 0x17, 0x46, 0xe1, 0x7d, 0xe3, 0x16, 0xa0,
1426 0x0b, 0x06, 0x09, 0x2b, 0x24, 0x03, 0x03, 0x02,
1427 0x08, 0x01, 0x01, 0x03, 0xa1, 0x34, 0x03, 0x32,
1428 0x00, 0x04, 0x71, 0x60, 0x9c, 0x62, 0x98, 0x76,
1429 0xc9, 0x14, 0x91, 0x75, 0xc6, 0xc8, 0x16, 0x32,
1430 0xc2, 0x29, 0x47, 0x64, 0xa3, 0x59, 0xa7, 0x45,
1431 0xdb, 0xd7, 0x51, 0x95, 0xba, 0xa4, 0x33, 0x46,
1432 0x6e, 0x4f, 0x86, 0xed, 0x1e, 0xea, 0xf6, 0xf1,
1433 0x3c, 0xf1, 0x96, 0x94, 0x1f, 0x9c, 0x04, 0x2a,
1434 0x43, 0x27,
1435 },
1436 },
1437 {
1438 .name = "brainpoolP192t1",
1439 .der_len = 98,
1440 .der = {
1441 0x30, 0x60, 0x02, 0x01, 0x01, 0x04, 0x18, 0xbb,
1442 0x53, 0xd5, 0x6c, 0x01, 0x1f, 0x0f, 0x25, 0xfd,
1443 0x1d, 0x92, 0xc5, 0x60, 0xb2, 0x64, 0xe0, 0x32,
1444 0x0f, 0x69, 0x36, 0xcb, 0x16, 0x3e, 0x37, 0xa0,
1445 0x0b, 0x06, 0x09, 0x2b, 0x24, 0x03, 0x03, 0x02,
1446 0x08, 0x01, 0x01, 0x04, 0xa1, 0x34, 0x03, 0x32,
1447 0x00, 0x04, 0x8d, 0x2b, 0x0c, 0xee, 0xea, 0x4b,
1448 0x63, 0xaf, 0x63, 0x36, 0xb2, 0x3a, 0x55, 0x40,
1449 0x85, 0x33, 0x95, 0xc1, 0x1d, 0x37, 0xd3, 0xfc,
1450 0x5c, 0x25, 0x8a, 0x0a, 0xc5, 0xec, 0x7f, 0xe0,
1451 0x7f, 0x08, 0x5e, 0xdf, 0x89, 0xe6, 0xee, 0x21,
1452 0x6d, 0x1b, 0x15, 0xd7, 0x4b, 0x79, 0xc1, 0xb5,
1453 0x28, 0xc7,
1454 },
1455 },
1456 {
1457 .name = "brainpoolP224r1",
1458 .der_len = 110,
1459 .der = {
1460 0x30, 0x6c, 0x02, 0x01, 0x01, 0x04, 0x1c, 0xae,
1461 0x9c, 0xe1, 0x9c, 0xaf, 0xbd, 0x9d, 0xec, 0x9a,
1462 0xe4, 0xdc, 0x5a, 0x9f, 0xdb, 0x0d, 0x51, 0x65,
1463 0xe2, 0x49, 0xa7, 0x35, 0xea, 0xbc, 0x8b, 0x4a,
1464 0x27, 0xfd, 0xa8, 0xa0, 0x0b, 0x06, 0x09, 0x2b,
1465 0x24, 0x03, 0x03, 0x02, 0x08, 0x01, 0x01, 0x05,
1466 0xa1, 0x3c, 0x03, 0x3a, 0x00, 0x04, 0x30, 0x88,
1467 0x20, 0xb3, 0x47, 0x2e, 0x40, 0x1e, 0x68, 0xae,
1468 0xe1, 0x00, 0x58, 0xa2, 0x4b, 0xb9, 0xac, 0xf7,
1469 0x5d, 0xc1, 0xee, 0xf5, 0xfb, 0xdd, 0x34, 0xae,
1470 0xbe, 0x3c, 0x93, 0xdd, 0xc2, 0xd8, 0x3a, 0x9a,
1471 0x72, 0x65, 0x41, 0xac, 0xcc, 0x25, 0x6a, 0xcf,
1472 0x71, 0x50, 0x6b, 0xed, 0xe3, 0xc5, 0xd4, 0xe9,
1473 0x1b, 0x59, 0x92, 0xa4, 0xa8, 0x81,
1474 },
1475 },
1476 {
1477 .name = "brainpoolP224t1",
1478 .der_len = 110,
1479 .der = {
1480 0x30, 0x6c, 0x02, 0x01, 0x01, 0x04, 0x1c, 0xc0,
1481 0x10, 0xc2, 0xf4, 0xab, 0xbb, 0x00, 0xa0, 0x14,
1482 0x62, 0x13, 0x24, 0xc2, 0x8d, 0x9e, 0x78, 0x92,
1483 0x24, 0x3b, 0xa8, 0xd0, 0xf1, 0x06, 0x69, 0x77,
1484 0x1d, 0x9d, 0x6c, 0xa0, 0x0b, 0x06, 0x09, 0x2b,
1485 0x24, 0x03, 0x03, 0x02, 0x08, 0x01, 0x01, 0x06,
1486 0xa1, 0x3c, 0x03, 0x3a, 0x00, 0x04, 0x0b, 0xbf,
1487 0x95, 0xea, 0x8b, 0xa8, 0x24, 0x94, 0x68, 0x54,
1488 0x69, 0xd9, 0x55, 0xa5, 0x36, 0x34, 0xf1, 0x4a,
1489 0x45, 0xf9, 0x9f, 0x66, 0x7b, 0x5d, 0xc9, 0x8b,
1490 0x0a, 0x7a, 0x5d, 0xef, 0x25, 0x9a, 0xa3, 0x86,
1491 0xe1, 0x98, 0x1b, 0x5b, 0xe3, 0xe3, 0x55, 0xa0,
1492 0x59, 0xb2, 0xfd, 0xe7, 0xdf, 0x41, 0xff, 0x4f,
1493 0x36, 0xe9, 0x56, 0xe9, 0x07, 0xc2,
1494 },
1495 },
1496 {
1497 .name = "brainpoolP256r1",
1498 .der_len = 122,
1499 .der = {
1500 0x30, 0x78, 0x02, 0x01, 0x01, 0x04, 0x20, 0x98,
1501 0x48, 0x86, 0x7a, 0x5b, 0x60, 0xb9, 0xba, 0xab,
1502 0xa2, 0x34, 0x55, 0x43, 0x17, 0xbc, 0xfd, 0xc2,
1503 0x18, 0xc9, 0xa8, 0x4b, 0x28, 0xbe, 0x5e, 0xa0,
1504 0x37, 0xab, 0x0d, 0xe0, 0x54, 0x65, 0x87, 0xa0,
1505 0x0b, 0x06, 0x09, 0x2b, 0x24, 0x03, 0x03, 0x02,
1506 0x08, 0x01, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42,
1507 0x00, 0x04, 0x08, 0xd7, 0x77, 0xf5, 0x10, 0xa9,
1508 0x83, 0xd9, 0xdf, 0xfd, 0x40, 0xe4, 0x42, 0xce,
1509 0xd8, 0x3b, 0x9b, 0xef, 0xe6, 0x4d, 0x4e, 0xca,
1510 0x2d, 0xea, 0xe6, 0x69, 0xfe, 0xd3, 0xa9, 0x3f,
1511 0x30, 0xfa, 0x7e, 0xa7, 0x14, 0x9d, 0x37, 0x77,
1512 0xc5, 0xcc, 0x1e, 0x32, 0xf6, 0xce, 0x17, 0x91,
1513 0x1b, 0xeb, 0xa3, 0x8f, 0xce, 0x70, 0x55, 0xc1,
1514 0xcf, 0xe3, 0x38, 0xa0, 0xb7, 0x95, 0x85, 0x26,
1515 0xf5, 0xb2,
1516 },
1517 },
1518 {
1519 .name = "brainpoolP256t1",
1520 .der_len = 122,
1521 .der = {
1522 0x30, 0x78, 0x02, 0x01, 0x01, 0x04, 0x20, 0x21,
1523 0xb0, 0x02, 0x6c, 0xac, 0x68, 0xe7, 0xaf, 0xb6,
1524 0x8b, 0xb9, 0xe6, 0x68, 0xec, 0x2a, 0xfa, 0x55,
1525 0xb0, 0xd4, 0x23, 0xaa, 0xb9, 0xfb, 0x7c, 0xf5,
1526 0xd1, 0x2f, 0x61, 0x52, 0x19, 0xc0, 0x19, 0xa0,
1527 0x0b, 0x06, 0x09, 0x2b, 0x24, 0x03, 0x03, 0x02,
1528 0x08, 0x01, 0x01, 0x08, 0xa1, 0x44, 0x03, 0x42,
1529 0x00, 0x04, 0x7b, 0x1d, 0x55, 0x29, 0x0b, 0x0a,
1530 0x0d, 0x02, 0x7a, 0x1d, 0x72, 0x53, 0xc1, 0x84,
1531 0xb9, 0x90, 0x00, 0xb9, 0x45, 0xe5, 0xa5, 0xd4,
1532 0xee, 0xd6, 0x9a, 0x1d, 0xb0, 0x3a, 0x91, 0xa8,
1533 0x95, 0x56, 0x58, 0x32, 0xcb, 0xf3, 0x28, 0x95,
1534 0xa6, 0x82, 0x46, 0xe6, 0x0a, 0x33, 0x00, 0xd1,
1535 0x0c, 0x61, 0xac, 0x1e, 0xa0, 0xb0, 0xad, 0x3a,
1536 0xbd, 0x1e, 0x53, 0x8d, 0x26, 0x96, 0xab, 0x44,
1537 0x6b, 0x84,
1538 },
1539 },
1540 {
1541 .name = "brainpoolP320r1",
1542 .der_len = 147,
1543 .der = {
1544 0x30, 0x81, 0x90, 0x02, 0x01, 0x01, 0x04, 0x28,
1545 0x1f, 0x7e, 0x6e, 0x51, 0x13, 0x87, 0x9b, 0x09,
1546 0x2b, 0x3f, 0x1c, 0x39, 0x0f, 0x9f, 0x48, 0x79,
1547 0x48, 0xa1, 0x44, 0xe0, 0x5c, 0x73, 0x2a, 0x6c,
1548 0x6e, 0x60, 0x59, 0xd0, 0xf6, 0x6f, 0x32, 0x0e,
1549 0x6b, 0x2b, 0x0c, 0xf2, 0x39, 0xbd, 0x42, 0xaf,
1550 0xa0, 0x0b, 0x06, 0x09, 0x2b, 0x24, 0x03, 0x03,
1551 0x02, 0x08, 0x01, 0x01, 0x09, 0xa1, 0x54, 0x03,
1552 0x52, 0x00, 0x04, 0xa3, 0x37, 0x85, 0xe2, 0xf2,
1553 0x5f, 0xa1, 0x71, 0xa6, 0x75, 0xfe, 0xa1, 0xea,
1554 0x66, 0x35, 0x7a, 0x53, 0x71, 0x24, 0x83, 0xcd,
1555 0xc9, 0x5d, 0x3f, 0x43, 0xc4, 0x97, 0x6d, 0xcc,
1556 0x0c, 0xed, 0x9a, 0x51, 0x51, 0x7d, 0x1e, 0xd0,
1557 0xea, 0xd2, 0x8c, 0x36, 0xb0, 0x93, 0x62, 0xeb,
1558 0x26, 0xda, 0xe1, 0xef, 0xc7, 0x1a, 0xfa, 0x0c,
1559 0xea, 0x84, 0x7a, 0xf1, 0x50, 0x2c, 0xee, 0xf1,
1560 0xb3, 0xcc, 0xb7, 0xa0, 0x98, 0x5d, 0xde, 0xc2,
1561 0x54, 0xcc, 0x11, 0x2a, 0x84, 0xc6, 0x79, 0x10,
1562 0x7b, 0x20, 0x26,
1563 },
1564 },
1565 {
1566 .name = "brainpoolP320t1",
1567 .der_len = 147,
1568 .der = {
1569 0x30, 0x81, 0x90, 0x02, 0x01, 0x01, 0x04, 0x28,
1570 0x4a, 0x8a, 0x25, 0xd9, 0xfa, 0x04, 0x8f, 0x6b,
1571 0xd5, 0xa3, 0x83, 0xd6, 0xf2, 0xca, 0x82, 0xd5,
1572 0xe2, 0x8e, 0x3f, 0xe6, 0x07, 0xcd, 0xa2, 0x22,
1573 0xa0, 0x3f, 0x0a, 0x7c, 0x09, 0x0f, 0x9f, 0xf4,
1574 0xe3, 0x59, 0x4b, 0x43, 0x0c, 0xfd, 0x5a, 0x96,
1575 0xa0, 0x0b, 0x06, 0x09, 0x2b, 0x24, 0x03, 0x03,
1576 0x02, 0x08, 0x01, 0x01, 0x0a, 0xa1, 0x54, 0x03,
1577 0x52, 0x00, 0x04, 0x3d, 0x8c, 0x4c, 0xbb, 0x30,
1578 0x3f, 0xa0, 0x84, 0x61, 0x43, 0x50, 0x23, 0x70,
1579 0xe3, 0x70, 0xb6, 0x4d, 0x89, 0xc8, 0x95, 0xa0,
1580 0x09, 0xae, 0xfc, 0x55, 0x9c, 0x2f, 0xef, 0x16,
1581 0xc0, 0x72, 0x3c, 0x3e, 0x07, 0xa1, 0xbb, 0xd8,
1582 0x8a, 0xfa, 0xaf, 0x9f, 0xaf, 0x07, 0x7c, 0x15,
1583 0x4d, 0x75, 0x6b, 0xf5, 0x25, 0x65, 0x5b, 0xc4,
1584 0x78, 0x59, 0x22, 0xe5, 0x92, 0x5c, 0xc2, 0x8f,
1585 0xdc, 0x97, 0x59, 0x82, 0xc5, 0x0d, 0x24, 0x70,
1586 0x03, 0xbe, 0xa5, 0x05, 0x88, 0x16, 0x47, 0x9f,
1587 0xe5, 0x3b, 0xb8,
1588 },
1589 },
1590 {
1591 .name = "brainpoolP384r1",
1592 .der_len = 171,
1593 .der = {
1594 0x30, 0x81, 0xa8, 0x02, 0x01, 0x01, 0x04, 0x30,
1595 0x02, 0x57, 0xb6, 0xfe, 0x31, 0xda, 0x87, 0xcd,
1596 0x68, 0x2a, 0x67, 0x98, 0xd1, 0x72, 0x5c, 0xd8,
1597 0x2e, 0x25, 0xf9, 0x39, 0x36, 0x3b, 0x93, 0x98,
1598 0x79, 0x81, 0xc0, 0x7e, 0xa3, 0x44, 0x99, 0xd8,
1599 0xe5, 0x07, 0x1f, 0xea, 0xa1, 0x66, 0x60, 0x00,
1600 0x29, 0x84, 0xa3, 0x35, 0xdd, 0x64, 0x96, 0x93,
1601 0xa0, 0x0b, 0x06, 0x09, 0x2b, 0x24, 0x03, 0x03,
1602 0x02, 0x08, 0x01, 0x01, 0x0b, 0xa1, 0x64, 0x03,
1603 0x62, 0x00, 0x04, 0x4f, 0x79, 0xe0, 0xe7, 0xf9,
1604 0x57, 0x33, 0xf9, 0x9d, 0x6a, 0x5c, 0x00, 0x6e,
1605 0xb8, 0xbc, 0xe6, 0x4f, 0x70, 0x1d, 0x73, 0x02,
1606 0x5c, 0x87, 0xa1, 0x88, 0xea, 0xe3, 0x57, 0x5c,
1607 0x1a, 0x27, 0x40, 0xcf, 0xcc, 0x6f, 0x7e, 0x6d,
1608 0xfd, 0x96, 0x0b, 0xaa, 0xc5, 0x02, 0x92, 0x10,
1609 0x6d, 0x7e, 0xd5, 0x17, 0xda, 0xab, 0x52, 0x9b,
1610 0xcd, 0x87, 0x08, 0x64, 0x2a, 0x61, 0x03, 0xc9,
1611 0xfe, 0x97, 0x79, 0xf0, 0x5c, 0x84, 0x72, 0x50,
1612 0x53, 0x95, 0x56, 0x7a, 0x97, 0xce, 0x36, 0x13,
1613 0x23, 0x78, 0x31, 0x82, 0x36, 0x07, 0x45, 0xad,
1614 0x92, 0x00, 0xaf, 0x3d, 0xe8, 0x5a, 0x7d, 0x7b,
1615 0x63, 0xc2, 0xde,
1616 },
1617 },
1618 {
1619 .name = "brainpoolP384t1",
1620 .der_len = 171,
1621 .der = {
1622 0x30, 0x81, 0xa8, 0x02, 0x01, 0x01, 0x04, 0x30,
1623 0x35, 0xea, 0xbc, 0x66, 0xd4, 0xa9, 0xc0, 0xe1,
1624 0xcd, 0xd4, 0xe5, 0xb1, 0xac, 0x8f, 0x66, 0x82,
1625 0x56, 0xc1, 0xbd, 0xf2, 0xf5, 0x30, 0x95, 0xab,
1626 0x30, 0xaa, 0xc0, 0xc3, 0x07, 0xca, 0x97, 0xc9,
1627 0x53, 0x45, 0xd3, 0xff, 0xbf, 0xfe, 0xdf, 0x39,
1628 0x32, 0x40, 0xe0, 0x45, 0x15, 0xa7, 0x22, 0x5f,
1629 0xa0, 0x0b, 0x06, 0x09, 0x2b, 0x24, 0x03, 0x03,
1630 0x02, 0x08, 0x01, 0x01, 0x0c, 0xa1, 0x64, 0x03,
1631 0x62, 0x00, 0x04, 0x85, 0xdb, 0x57, 0x4b, 0x71,
1632 0xb1, 0x65, 0x93, 0x51, 0x83, 0x7c, 0xb3, 0x24,
1633 0x07, 0x6b, 0x7b, 0x57, 0x33, 0x73, 0x3a, 0xa6,
1634 0x14, 0x86, 0x83, 0xa8, 0x88, 0x81, 0xf2, 0x90,
1635 0xdf, 0x93, 0x4f, 0x67, 0x41, 0xef, 0xcb, 0x35,
1636 0x14, 0xad, 0x4c, 0x67, 0x0b, 0xdb, 0x86, 0x03,
1637 0x5e, 0x6d, 0x5e, 0x7e, 0x4b, 0x0f, 0x73, 0x9e,
1638 0x73, 0x50, 0x86, 0x29, 0x09, 0x7c, 0x38, 0xfc,
1639 0xbe, 0xaf, 0x59, 0x9c, 0x69, 0xdf, 0xb4, 0x60,
1640 0x14, 0x3e, 0xb2, 0x1a, 0x72, 0x86, 0x57, 0xcb,
1641 0x6b, 0x42, 0x20, 0x67, 0x7f, 0xbc, 0xa8, 0x57,
1642 0x88, 0x76, 0x72, 0x9a, 0xb4, 0xea, 0xc0, 0x48,
1643 0x01, 0x5d, 0x8e,
1644 },
1645 },
1646 {
1647 .name = "brainpoolP512r1",
1648 .der_len = 221,
1649 .der = {
1650 0x30, 0x81, 0xda, 0x02, 0x01, 0x01, 0x04, 0x40,
1651 0x7e, 0x04, 0x7d, 0xab, 0x42, 0xc6, 0xdb, 0x95,
1652 0xfb, 0x22, 0x0b, 0xe4, 0x09, 0xff, 0x4a, 0x1e,
1653 0x7b, 0x42, 0x62, 0x82, 0x41, 0xf4, 0x1e, 0xc2,
1654 0x1f, 0x9e, 0x52, 0xea, 0xce, 0x1b, 0x75, 0x07,
1655 0x7c, 0xaf, 0x49, 0xdf, 0xf3, 0x20, 0xfa, 0x88,
1656 0x23, 0xc4, 0x5e, 0x6d, 0x82, 0x45, 0x32, 0x19,
1657 0x04, 0x4a, 0x3d, 0x80, 0xa1, 0xa8, 0x99, 0x09,
1658 0xce, 0x78, 0xde, 0x32, 0x18, 0xf4, 0x83, 0x2c,
1659 0xa0, 0x0b, 0x06, 0x09, 0x2b, 0x24, 0x03, 0x03,
1660 0x02, 0x08, 0x01, 0x01, 0x0d, 0xa1, 0x81, 0x85,
1661 0x03, 0x81, 0x82, 0x00, 0x04, 0x1e, 0x99, 0xea,
1662 0x54, 0xb6, 0x1a, 0x4f, 0x44, 0x25, 0xf4, 0xf8,
1663 0xbe, 0x33, 0x7c, 0xd1, 0x62, 0x35, 0xf5, 0xd1,
1664 0x8e, 0x9f, 0xae, 0xa8, 0x8f, 0x6d, 0x61, 0x27,
1665 0x2d, 0x2a, 0xb1, 0x96, 0x48, 0x6d, 0xb2, 0x63,
1666 0x05, 0x9f, 0xec, 0xa1, 0xcd, 0x65, 0x45, 0xc8,
1667 0xcd, 0xf1, 0xa4, 0xba, 0x20, 0xb7, 0xe4, 0xc7,
1668 0x92, 0x3c, 0x1f, 0x16, 0xf4, 0x5b, 0x75, 0xe4,
1669 0x2a, 0x2e, 0x44, 0x72, 0x65, 0x63, 0xc3, 0x78,
1670 0x54, 0x50, 0xcb, 0x50, 0xe0, 0xbe, 0xe7, 0x6f,
1671 0x2a, 0xdc, 0x24, 0x7b, 0xf8, 0x4b, 0xa8, 0xe2,
1672 0x1b, 0x27, 0x00, 0x2d, 0xe8, 0x99, 0xdc, 0x5f,
1673 0xa4, 0x43, 0xa8, 0xf7, 0xb1, 0x55, 0xea, 0xd7,
1674 0x02, 0x09, 0x08, 0x97, 0x5f, 0x21, 0x1e, 0x16,
1675 0xa0, 0xd8, 0x27, 0xe4, 0x5e, 0x3a, 0xa5, 0x51,
1676 0x68, 0xe7, 0x19, 0xc1, 0x7d, 0xb6, 0x9d, 0xb9,
1677 0xc6, 0xc2, 0x1b, 0x48, 0x7f,
1678 },
1679 },
1680 {
1681 .name = "brainpoolP512t1",
1682 .der_len = 221,
1683 .der = {
1684 0x30, 0x81, 0xda, 0x02, 0x01, 0x01, 0x04, 0x40,
1685 0xa0, 0xcb, 0xab, 0x2e, 0xdb, 0xb0, 0x17, 0x53,
1686 0x91, 0x23, 0x8c, 0x86, 0x29, 0x8b, 0x33, 0x27,
1687 0x27, 0x86, 0x71, 0xdd, 0x9f, 0x92, 0x8a, 0x8a,
1688 0x28, 0xac, 0x1f, 0x4b, 0x67, 0x8d, 0xd3, 0x7a,
1689 0x71, 0xd9, 0x95, 0x3c, 0xc2, 0x48, 0x9a, 0x1e,
1690 0x75, 0xcf, 0x33, 0x6f, 0xdc, 0x88, 0x8c, 0x29,
1691 0x1d, 0x41, 0xf8, 0xe1, 0xb3, 0x8f, 0xf9, 0x9e,
1692 0x13, 0x14, 0xbc, 0x4f, 0xa5, 0x8e, 0x06, 0xba,
1693 0xa0, 0x0b, 0x06, 0x09, 0x2b, 0x24, 0x03, 0x03,
1694 0x02, 0x08, 0x01, 0x01, 0x0e, 0xa1, 0x81, 0x85,
1695 0x03, 0x81, 0x82, 0x00, 0x04, 0x5b, 0x2b, 0x47,
1696 0x83, 0x61, 0xea, 0x80, 0x14, 0x85, 0x06, 0xe7,
1697 0x03, 0xbd, 0x24, 0x04, 0x47, 0x5d, 0x33, 0x4e,
1698 0xde, 0x0c, 0x92, 0x09, 0x54, 0x77, 0x53, 0x0e,
1699 0x33, 0x30, 0x73, 0xc0, 0xc0, 0x6a, 0xf2, 0xb5,
1700 0xb5, 0xd4, 0xd3, 0x02, 0x2f, 0x20, 0xe2, 0x88,
1701 0xb2, 0x07, 0x4a, 0x9f, 0x90, 0xbf, 0xba, 0xb5,
1702 0x3d, 0xc4, 0x5b, 0x65, 0x76, 0xb5, 0xe5, 0xa1,
1703 0x7d, 0x63, 0x39, 0x57, 0xaa, 0x1d, 0x1f, 0x99,
1704 0x52, 0x43, 0x5d, 0x0b, 0x58, 0xa6, 0x51, 0x1e,
1705 0x6f, 0x7b, 0x9e, 0x2f, 0x45, 0x5a, 0x2d, 0x6f,
1706 0xaa, 0x2b, 0xfc, 0xe1, 0x9f, 0x78, 0x11, 0x70,
1707 0x80, 0xf8, 0xfe, 0x51, 0x45, 0x12, 0xbf, 0x79,
1708 0xd8, 0xaf, 0x05, 0x59, 0x14, 0x01, 0x81, 0x9c,
1709 0x12, 0x5c, 0x8d, 0x4d, 0xed, 0xc7, 0x44, 0x61,
1710 0x68, 0x0f, 0x3f, 0x34, 0xee, 0x90, 0x4e, 0xab,
1711 0x80, 0x7c, 0x41, 0xd7, 0x8f,
1712 },
1713 },
1714 {
1715 .name = "FRP256v1",
1716 .der_len = 123,
1717 .der = {
1718 0x30, 0x79, 0x02, 0x01, 0x01, 0x04, 0x20, 0x66,
1719 0xe4, 0xdb, 0x37, 0x46, 0x8d, 0xa1, 0xc8, 0x20,
1720 0x0d, 0xdf, 0xcb, 0x3b, 0x5c, 0x5b, 0x84, 0xe1,
1721 0x89, 0xed, 0x30, 0x37, 0xaa, 0xfa, 0xb2, 0x5b,
1722 0xf4, 0xf6, 0x13, 0x66, 0xfe, 0xfc, 0x7c, 0xa0,
1723 0x0c, 0x06, 0x0a, 0x2a, 0x81, 0x7a, 0x01, 0x81,
1724 0x5f, 0x65, 0x82, 0x00, 0x01, 0xa1, 0x44, 0x03,
1725 0x42, 0x00, 0x04, 0x17, 0xc7, 0xae, 0x1b, 0xe4,
1726 0xc6, 0xd6, 0x3a, 0xcf, 0x6b, 0x7e, 0x43, 0x29,
1727 0x9f, 0xdc, 0xc2, 0xa3, 0x90, 0x53, 0x62, 0x42,
1728 0x6e, 0xa3, 0xa4, 0xca, 0xd3, 0xf6, 0x53, 0x53,
1729 0xd4, 0xa6, 0x1f, 0xa8, 0x03, 0x1f, 0x6d, 0xd4,
1730 0x75, 0x77, 0x23, 0xf7, 0x92, 0xa4, 0x7c, 0x5a,
1731 0x4c, 0xc7, 0xc6, 0x96, 0x54, 0x62, 0x94, 0x9b,
1732 0xa7, 0xe0, 0x31, 0x1c, 0x4d, 0x1c, 0xa8, 0x2a,
1733 0x51, 0x11, 0x24,
1734 },
1735 },
1736};
1737
1738#define N_EC_PRIVATE_KEYS (sizeof(ec_private_keys) / sizeof(ec_private_keys[0]))
1739
1740static int
1741ec_group_check_private_key(const struct ec_private_key *key)
1742{
1743 EC_KEY *ec_key = NULL, *ec_pub_key = NULL;
1744 const unsigned char *p;
1745 unsigned int flags;
1746 unsigned char *der = NULL, *ostr = NULL;
1747 int der_len = 0, ostr_len = 0;
1748 uint8_t form;
1749 int rv;
1750 int failed = 1;
1751
1752 p = key->der;
1753 if ((ec_key = d2i_ECPrivateKey(NULL, &p, key->der_len)) == NULL) {
1754 fprintf(stderr, "FAIL: d2i_ECPrivateKey for %s\n", key->name);
1755 goto err;
1756 }
1757
1758 if ((flags = EC_KEY_get_enc_flags(ec_key)) != 0) {
1759 fprintf(stderr, "FAIL: EC_KEY_get_enc_flags() returned %x for %s\n",
1760 flags, key->name);
1761 goto err;
1762 }
1763
1764 ERR_clear_error();
1765 if (!EC_KEY_check_key(ec_key)) {
1766 fprintf(stderr, "FAIL: EC_KEY_check_key() for %s\n", key->name);
1767 ERR_print_errors_fp(stderr);
1768 }
1769
1770 der = NULL;
1771 if ((der_len = i2d_ECPrivateKey(ec_key, &der)) <= 0) {
1772 fprintf(stderr, "FAIL: i2d_ECPrivateKey() for %s\n", key->name);
1773 der_len = 0;
1774 goto err;
1775 }
1776
1777 if (compare_data(key->name, der, der_len, key->der, key->der_len) == -1)
1778 goto err;
1779
1780 freezero(der, der_len);
1781 der = NULL;
1782
1783 /*
1784 * Round trip the public key through i2o and o2i in compressed form.
1785 */
1786
1787 EC_KEY_set_conv_form(ec_key, POINT_CONVERSION_COMPRESSED);
1788
1789 ostr = NULL;
1790 if ((ostr_len = i2o_ECPublicKey(ec_key, &ostr)) <= 0) {
1791 fprintf(stderr, "FAIL: i2o_ECPublicKey for %s\n", key->name);
1792 ostr_len = 0;
1793 goto err;
1794 }
1795
1796 if ((ec_pub_key = EC_KEY_new()) == NULL)
1797 errx(1, "EC_KEY_new");
1798 if (!EC_KEY_set_group(ec_pub_key, EC_KEY_get0_group(ec_key))) {
1799 fprintf(stderr, "FAIL: EC_KEY_set_group() for %s\n", key->name);
1800 goto err;
1801 }
1802
1803 if ((form = EC_KEY_get_conv_form(ec_pub_key)) != POINT_CONVERSION_UNCOMPRESSED) {
1804 fprintf(stderr, "FAIL: EC_KEY_get_conv_form() for %s:\n"
1805 "got %02x, want %02x\n", key->name, form, POINT_CONVERSION_UNCOMPRESSED);
1806 goto err;
1807 }
1808
1809 /* Need to pass in the public key to tell o2i about the group... */
1810 p = ostr;
1811 if (o2i_ECPublicKey(&ec_pub_key, &p, ostr_len) == NULL) {
1812 fprintf(stderr, "FAIL: o2i_ECPublicKey() for %s\n", key->name);
1813 goto err;
1814 }
1815
1816 if ((form = EC_KEY_get_conv_form(ec_pub_key)) != POINT_CONVERSION_COMPRESSED) {
1817 fprintf(stderr, "FAIL: EC_KEY_get_conv_form() for %s:\n"
1818 "got %02x, want %02x\n", key->name, form, POINT_CONVERSION_COMPRESSED);
1819 goto err;
1820 }
1821
1822 if ((rv = EC_POINT_cmp(EC_KEY_get0_group(ec_pub_key),
1823 EC_KEY_get0_public_key(ec_pub_key), EC_KEY_get0_public_key(ec_key),
1824 NULL)) != 0) {
1825 fprintf(stderr, "FAIL: EC_POINT_cmp() returned %d for %s\n",
1826 rv, key->name);
1827 goto err;
1828 }
1829
1830 EC_KEY_set_conv_form(ec_key, POINT_CONVERSION_HYBRID);
1831 EC_KEY_set_enc_flags(ec_key, EC_PKEY_NO_PARAMETERS | EC_PKEY_NO_PUBKEY);
1832
1833 if ((der_len = i2d_ECPrivateKey(ec_key, &der)) <= 0) {
1834 fprintf(stderr, "FAIL: i2d_ECPrivateKey(2) for %s\n", key->name);
1835 der_len = 0;
1836 goto err;
1837 }
1838
1839 if ((flags = EC_KEY_get_enc_flags(ec_pub_key)) != 0) {
1840 fprintf(stderr, "FAIL: EC_KEY_get_enc_flags() returned %x for %s\n",
1841 flags, key->name);
1842 goto err;
1843 }
1844
1845 /* Clear the public key - this returns failure, but works. */
1846 (void)EC_KEY_set_public_key(ec_pub_key, NULL);
1847
1848 p = der;
1849 if (d2i_ECPrivateKey(&ec_pub_key, &p, der_len) == NULL) {
1850 fprintf(stderr, "FAIL: d2i_ECPrivateKey for public %s\n", key->name);
1851 goto err;
1852 }
1853
1854 /* For reasons of inconsistency, only EC_PKEY_NO_PUBKEY is set. */
1855 if ((flags = EC_KEY_get_enc_flags(ec_pub_key)) != EC_PKEY_NO_PUBKEY) {
1856 fprintf(stderr, "FAIL: EC_KEY_get_enc_flags() for public %s: "
1857 " got %x, want %x\n", key->name, flags, EC_PKEY_NO_PUBKEY);
1858 goto err;
1859 }
1860
1861 /* We had to compute the public key, so point conversion form is unchanged. */
1862 if ((form = EC_KEY_get_conv_form(ec_pub_key)) != POINT_CONVERSION_COMPRESSED) {
1863 fprintf(stderr, "FAIL: EC_KEY_get_conv_form() not compressed for %s:\n"
1864 "got %02x, want %02x\n", key->name, form, POINT_CONVERSION_COMPRESSED);
1865 goto err;
1866 }
1867
1868 if ((rv = EC_POINT_cmp(EC_KEY_get0_group(ec_pub_key),
1869 EC_KEY_get0_public_key(ec_pub_key), EC_KEY_get0_public_key(ec_key),
1870 NULL)) != 0) {
1871 fprintf(stderr, "FAIL: EC_POINT_cmp() returned %d for %s "
1872 "after DER roundtrip\n", rv, key->name);
1873 goto err;
1874 }
1875
1876 failed = 0;
1877
1878 err:
1879 EC_KEY_free(ec_key);
1880 EC_KEY_free(ec_pub_key);
1881
1882 freezero(der, der_len);
1883 freezero(ostr, ostr_len);
1884
1885 return failed;
1886}
1887
1888static int
1889ec_group_check_private_keys(void)
1890{
1891 size_t i;
1892 int failed = 0;
1893
1894 for (i = 0; i < N_EC_PRIVATE_KEYS; i++)
1895 failed |= ec_group_check_private_key(&ec_private_keys[i]);
1896
1897 return failed;
1898}
1899
899int 1900int
900main(int argc, char **argv) 1901main(int argc, char **argv)
901{ 1902{
@@ -906,6 +1907,7 @@ main(int argc, char **argv)
906 failed |= ec_group_pkparameters_correct_padding_test(); 1907 failed |= ec_group_pkparameters_correct_padding_test();
907 failed |= ec_group_roundtrip_builtin_curves(); 1908 failed |= ec_group_roundtrip_builtin_curves();
908 failed |= ec_group_non_builtin_curves(); 1909 failed |= ec_group_non_builtin_curves();
1910 failed |= ec_group_check_private_keys();
909 1911
910 return (failed); 1912 return (failed);
911} 1913}