| 1 | /* |
| 2 | * WARNING: do not edit! |
| 3 | * Generated by Makefile from include/openssl/x509.h.in |
| 4 | * |
| 5 | * Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved. |
| 6 | * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved |
| 7 | * |
| 8 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
| 9 | * this file except in compliance with the License. You can obtain a copy |
| 10 | * in the file LICENSE in the source distribution or at |
| 11 | * https://www.openssl.org/source/license.html |
| 12 | */ |
| 13 | |
| 14 | /* clang-format off */ |
| 15 | |
| 16 | /* clang-format on */ |
| 17 | |
| 18 | #ifndef OPENSSL_X509_H |
| 19 | #define OPENSSL_X509_H |
| 20 | #pragma once |
| 21 | |
| 22 | #include <openssl/macros.h> |
| 23 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 24 | #define |
| 25 | #endif |
| 26 | |
| 27 | #include <openssl/e_os2.h> |
| 28 | #include <openssl/types.h> |
| 29 | #include <openssl/symhacks.h> |
| 30 | #include <openssl/buffer.h> |
| 31 | #include <openssl/evp.h> |
| 32 | #include <openssl/bio.h> |
| 33 | #include <openssl/asn1.h> |
| 34 | #include <openssl/safestack.h> |
| 35 | #include <openssl/ec.h> |
| 36 | |
| 37 | #ifndef OPENSSL_NO_DEPRECATED_1_1_0 |
| 38 | #include <openssl/rsa.h> |
| 39 | #include <openssl/dsa.h> |
| 40 | #include <openssl/dh.h> |
| 41 | #endif |
| 42 | |
| 43 | #include <openssl/sha.h> |
| 44 | #include <openssl/x509err.h> |
| 45 | #ifndef OPENSSL_NO_STDIO |
| 46 | #include <stdio.h> |
| 47 | #endif |
| 48 | |
| 49 | #ifdef __cplusplus |
| 50 | extern "C" { |
| 51 | #endif |
| 52 | |
| 53 | /* Needed stacks for types defined in other headers */ |
| 54 | /* clang-format off */ |
| 55 | SKM_DEFINE_STACK_OF_INTERNAL(X509_NAME, X509_NAME, X509_NAME) |
| 56 | #define sk_X509_NAME_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_sk_type(sk)) |
| 57 | #define sk_X509_NAME_value(sk, idx) ((X509_NAME *)OPENSSL_sk_value(ossl_check_const_X509_NAME_sk_type(sk), (idx))) |
| 58 | #define sk_X509_NAME_new(cmp) \ |
| 59 | ((STACK_OF(X509_NAME) *)OPENSSL_sk_set_thunks( \ |
| 60 | OPENSSL_sk_set_copy_thunks( \ |
| 61 | OPENSSL_sk_set_cmp_thunks( \ |
| 62 | OPENSSL_sk_new(ossl_check_X509_NAME_compfunc_type(cmp)), \ |
| 63 | sk_X509_NAME_cmpfunc_thunk), \ |
| 64 | sk_X509_NAME_copyfunc_thunk), \ |
| 65 | sk_X509_NAME_freefunc_thunk)) |
| 66 | #define sk_X509_NAME_new_null() \ |
| 67 | ((STACK_OF(X509_NAME) *)OPENSSL_sk_set_thunks( \ |
| 68 | OPENSSL_sk_set_copy_thunks( \ |
| 69 | OPENSSL_sk_set_cmp_thunks( \ |
| 70 | OPENSSL_sk_new_null(), \ |
| 71 | sk_X509_NAME_cmpfunc_thunk), \ |
| 72 | sk_X509_NAME_copyfunc_thunk), \ |
| 73 | sk_X509_NAME_freefunc_thunk)) |
| 74 | #define sk_X509_NAME_new_reserve(cmp, n) \ |
| 75 | ((STACK_OF(X509_NAME) *)OPENSSL_sk_set_thunks( \ |
| 76 | OPENSSL_sk_set_copy_thunks( \ |
| 77 | OPENSSL_sk_set_cmp_thunks( \ |
| 78 | OPENSSL_sk_new_reserve(ossl_check_X509_NAME_compfunc_type(cmp), (n)), \ |
| 79 | sk_X509_NAME_cmpfunc_thunk), \ |
| 80 | sk_X509_NAME_copyfunc_thunk), \ |
| 81 | sk_X509_NAME_freefunc_thunk)) |
| 82 | #define sk_X509_NAME_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_NAME_sk_type(sk), (n)) |
| 83 | #define sk_X509_NAME_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_sk_type(sk)) |
| 84 | #define sk_X509_NAME_zero(sk) OPENSSL_sk_zero(ossl_check_X509_NAME_sk_type(sk)) |
| 85 | #define sk_X509_NAME_delete(sk, i) ((X509_NAME *)OPENSSL_sk_delete(ossl_check_X509_NAME_sk_type(sk), (i))) |
| 86 | #define sk_X509_NAME_delete_ptr(sk, ptr) ((X509_NAME *)OPENSSL_sk_delete_ptr(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr))) |
| 87 | #define sk_X509_NAME_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr)) |
| 88 | #define sk_X509_NAME_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr)) |
| 89 | #define sk_X509_NAME_pop(sk) ((X509_NAME *)OPENSSL_sk_pop(ossl_check_X509_NAME_sk_type(sk))) |
| 90 | #define sk_X509_NAME_shift(sk) ((X509_NAME *)OPENSSL_sk_shift(ossl_check_X509_NAME_sk_type(sk))) |
| 91 | #define sk_X509_NAME_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_freefunc_type(freefunc)) |
| 92 | #define sk_X509_NAME_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr), (idx)) |
| 93 | #define sk_X509_NAME_set(sk, idx, ptr) ((X509_NAME *)OPENSSL_sk_set(ossl_check_X509_NAME_sk_type(sk), (idx), ossl_check_X509_NAME_type(ptr))) |
| 94 | #define sk_X509_NAME_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr)) |
| 95 | #define sk_X509_NAME_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr)) |
| 96 | #define sk_X509_NAME_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_type(ptr), pnum) |
| 97 | #define sk_X509_NAME_sort(sk) OPENSSL_sk_sort(ossl_check_X509_NAME_sk_type(sk)) |
| 98 | #define sk_X509_NAME_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_NAME_sk_type(sk)) |
| 99 | #define sk_X509_NAME_dup(sk) \ |
| 100 | ((STACK_OF(X509_NAME) *)OPENSSL_sk_set_thunks( \ |
| 101 | OPENSSL_sk_set_copy_thunks( \ |
| 102 | OPENSSL_sk_set_cmp_thunks( \ |
| 103 | OPENSSL_sk_dup(ossl_check_const_X509_NAME_sk_type(sk)), \ |
| 104 | sk_X509_NAME_cmpfunc_thunk), \ |
| 105 | sk_X509_NAME_copyfunc_thunk), \ |
| 106 | sk_X509_NAME_freefunc_thunk)) |
| 107 | #define sk_X509_NAME_deep_copy(sk, copyfunc, freefunc) \ |
| 108 | ((STACK_OF(X509_NAME) *)OPENSSL_sk_set_thunks( \ |
| 109 | OPENSSL_sk_set_copy_thunks( \ |
| 110 | OPENSSL_sk_set_cmp_thunks( \ |
| 111 | OPENSSL_sk_deep_copy( \ |
| 112 | ossl_check_const_X509_NAME_sk_type(sk), \ |
| 113 | ossl_check_X509_NAME_copyfunc_type(copyfunc), \ |
| 114 | ossl_check_X509_NAME_freefunc_type(freefunc)), \ |
| 115 | sk_X509_NAME_cmpfunc_thunk), \ |
| 116 | sk_X509_NAME_copyfunc_thunk), \ |
| 117 | sk_X509_NAME_freefunc_thunk)) |
| 118 | #define sk_X509_NAME_set_cmp_func(sk, cmp) ((sk_X509_NAME_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_NAME_sk_type(sk), ossl_check_X509_NAME_compfunc_type(cmp))) |
| 119 | SKM_DEFINE_STACK_OF_INTERNAL(X509, X509, X509) |
| 120 | #define sk_X509_num(sk) OPENSSL_sk_num(ossl_check_const_X509_sk_type(sk)) |
| 121 | #define sk_X509_value(sk, idx) ((X509 *)OPENSSL_sk_value(ossl_check_const_X509_sk_type(sk), (idx))) |
| 122 | #define sk_X509_new(cmp) \ |
| 123 | ((STACK_OF(X509) *)OPENSSL_sk_set_thunks( \ |
| 124 | OPENSSL_sk_set_copy_thunks( \ |
| 125 | OPENSSL_sk_set_cmp_thunks( \ |
| 126 | OPENSSL_sk_new(ossl_check_X509_compfunc_type(cmp)), \ |
| 127 | sk_X509_cmpfunc_thunk), \ |
| 128 | sk_X509_copyfunc_thunk), \ |
| 129 | sk_X509_freefunc_thunk)) |
| 130 | #define sk_X509_new_null() \ |
| 131 | ((STACK_OF(X509) *)OPENSSL_sk_set_thunks( \ |
| 132 | OPENSSL_sk_set_copy_thunks( \ |
| 133 | OPENSSL_sk_set_cmp_thunks( \ |
| 134 | OPENSSL_sk_new_null(), \ |
| 135 | sk_X509_cmpfunc_thunk), \ |
| 136 | sk_X509_copyfunc_thunk), \ |
| 137 | sk_X509_freefunc_thunk)) |
| 138 | #define sk_X509_new_reserve(cmp, n) \ |
| 139 | ((STACK_OF(X509) *)OPENSSL_sk_set_thunks( \ |
| 140 | OPENSSL_sk_set_copy_thunks( \ |
| 141 | OPENSSL_sk_set_cmp_thunks( \ |
| 142 | OPENSSL_sk_new_reserve(ossl_check_X509_compfunc_type(cmp), (n)), \ |
| 143 | sk_X509_cmpfunc_thunk), \ |
| 144 | sk_X509_copyfunc_thunk), \ |
| 145 | sk_X509_freefunc_thunk)) |
| 146 | #define sk_X509_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_sk_type(sk), (n)) |
| 147 | #define sk_X509_free(sk) OPENSSL_sk_free(ossl_check_X509_sk_type(sk)) |
| 148 | #define sk_X509_zero(sk) OPENSSL_sk_zero(ossl_check_X509_sk_type(sk)) |
| 149 | #define sk_X509_delete(sk, i) ((X509 *)OPENSSL_sk_delete(ossl_check_X509_sk_type(sk), (i))) |
| 150 | #define sk_X509_delete_ptr(sk, ptr) ((X509 *)OPENSSL_sk_delete_ptr(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr))) |
| 151 | #define sk_X509_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr)) |
| 152 | #define sk_X509_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr)) |
| 153 | #define sk_X509_pop(sk) ((X509 *)OPENSSL_sk_pop(ossl_check_X509_sk_type(sk))) |
| 154 | #define sk_X509_shift(sk) ((X509 *)OPENSSL_sk_shift(ossl_check_X509_sk_type(sk))) |
| 155 | #define sk_X509_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_sk_type(sk), ossl_check_X509_freefunc_type(freefunc)) |
| 156 | #define sk_X509_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr), (idx)) |
| 157 | #define sk_X509_set(sk, idx, ptr) ((X509 *)OPENSSL_sk_set(ossl_check_X509_sk_type(sk), (idx), ossl_check_X509_type(ptr))) |
| 158 | #define sk_X509_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr)) |
| 159 | #define sk_X509_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr)) |
| 160 | #define sk_X509_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_sk_type(sk), ossl_check_X509_type(ptr), pnum) |
| 161 | #define sk_X509_sort(sk) OPENSSL_sk_sort(ossl_check_X509_sk_type(sk)) |
| 162 | #define sk_X509_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_sk_type(sk)) |
| 163 | #define sk_X509_dup(sk) \ |
| 164 | ((STACK_OF(X509) *)OPENSSL_sk_set_thunks( \ |
| 165 | OPENSSL_sk_set_copy_thunks( \ |
| 166 | OPENSSL_sk_set_cmp_thunks( \ |
| 167 | OPENSSL_sk_dup(ossl_check_const_X509_sk_type(sk)), \ |
| 168 | sk_X509_cmpfunc_thunk), \ |
| 169 | sk_X509_copyfunc_thunk), \ |
| 170 | sk_X509_freefunc_thunk)) |
| 171 | #define sk_X509_deep_copy(sk, copyfunc, freefunc) \ |
| 172 | ((STACK_OF(X509) *)OPENSSL_sk_set_thunks( \ |
| 173 | OPENSSL_sk_set_copy_thunks( \ |
| 174 | OPENSSL_sk_set_cmp_thunks( \ |
| 175 | OPENSSL_sk_deep_copy( \ |
| 176 | ossl_check_const_X509_sk_type(sk), \ |
| 177 | ossl_check_X509_copyfunc_type(copyfunc), \ |
| 178 | ossl_check_X509_freefunc_type(freefunc)), \ |
| 179 | sk_X509_cmpfunc_thunk), \ |
| 180 | sk_X509_copyfunc_thunk), \ |
| 181 | sk_X509_freefunc_thunk)) |
| 182 | #define sk_X509_set_cmp_func(sk, cmp) ((sk_X509_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_sk_type(sk), ossl_check_X509_compfunc_type(cmp))) |
| 183 | SKM_DEFINE_STACK_OF_INTERNAL(X509_REVOKED, X509_REVOKED, X509_REVOKED) |
| 184 | #define sk_X509_REVOKED_num(sk) OPENSSL_sk_num(ossl_check_const_X509_REVOKED_sk_type(sk)) |
| 185 | #define sk_X509_REVOKED_value(sk, idx) ((X509_REVOKED *)OPENSSL_sk_value(ossl_check_const_X509_REVOKED_sk_type(sk), (idx))) |
| 186 | #define sk_X509_REVOKED_new(cmp) \ |
| 187 | ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_set_thunks( \ |
| 188 | OPENSSL_sk_set_copy_thunks( \ |
| 189 | OPENSSL_sk_set_cmp_thunks( \ |
| 190 | OPENSSL_sk_new(ossl_check_X509_REVOKED_compfunc_type(cmp)), \ |
| 191 | sk_X509_REVOKED_cmpfunc_thunk), \ |
| 192 | sk_X509_REVOKED_copyfunc_thunk), \ |
| 193 | sk_X509_REVOKED_freefunc_thunk)) |
| 194 | #define sk_X509_REVOKED_new_null() \ |
| 195 | ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_set_thunks( \ |
| 196 | OPENSSL_sk_set_copy_thunks( \ |
| 197 | OPENSSL_sk_set_cmp_thunks( \ |
| 198 | OPENSSL_sk_new_null(), \ |
| 199 | sk_X509_REVOKED_cmpfunc_thunk), \ |
| 200 | sk_X509_REVOKED_copyfunc_thunk), \ |
| 201 | sk_X509_REVOKED_freefunc_thunk)) |
| 202 | #define sk_X509_REVOKED_new_reserve(cmp, n) \ |
| 203 | ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_set_thunks( \ |
| 204 | OPENSSL_sk_set_copy_thunks( \ |
| 205 | OPENSSL_sk_set_cmp_thunks( \ |
| 206 | OPENSSL_sk_new_reserve(ossl_check_X509_REVOKED_compfunc_type(cmp), (n)), \ |
| 207 | sk_X509_REVOKED_cmpfunc_thunk), \ |
| 208 | sk_X509_REVOKED_copyfunc_thunk), \ |
| 209 | sk_X509_REVOKED_freefunc_thunk)) |
| 210 | #define sk_X509_REVOKED_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_REVOKED_sk_type(sk), (n)) |
| 211 | #define sk_X509_REVOKED_free(sk) OPENSSL_sk_free(ossl_check_X509_REVOKED_sk_type(sk)) |
| 212 | #define sk_X509_REVOKED_zero(sk) OPENSSL_sk_zero(ossl_check_X509_REVOKED_sk_type(sk)) |
| 213 | #define sk_X509_REVOKED_delete(sk, i) ((X509_REVOKED *)OPENSSL_sk_delete(ossl_check_X509_REVOKED_sk_type(sk), (i))) |
| 214 | #define sk_X509_REVOKED_delete_ptr(sk, ptr) ((X509_REVOKED *)OPENSSL_sk_delete_ptr(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr))) |
| 215 | #define sk_X509_REVOKED_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr)) |
| 216 | #define sk_X509_REVOKED_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr)) |
| 217 | #define sk_X509_REVOKED_pop(sk) ((X509_REVOKED *)OPENSSL_sk_pop(ossl_check_X509_REVOKED_sk_type(sk))) |
| 218 | #define sk_X509_REVOKED_shift(sk) ((X509_REVOKED *)OPENSSL_sk_shift(ossl_check_X509_REVOKED_sk_type(sk))) |
| 219 | #define sk_X509_REVOKED_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_freefunc_type(freefunc)) |
| 220 | #define sk_X509_REVOKED_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr), (idx)) |
| 221 | #define sk_X509_REVOKED_set(sk, idx, ptr) ((X509_REVOKED *)OPENSSL_sk_set(ossl_check_X509_REVOKED_sk_type(sk), (idx), ossl_check_X509_REVOKED_type(ptr))) |
| 222 | #define sk_X509_REVOKED_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr)) |
| 223 | #define sk_X509_REVOKED_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr)) |
| 224 | #define sk_X509_REVOKED_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_type(ptr), pnum) |
| 225 | #define sk_X509_REVOKED_sort(sk) OPENSSL_sk_sort(ossl_check_X509_REVOKED_sk_type(sk)) |
| 226 | #define sk_X509_REVOKED_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_REVOKED_sk_type(sk)) |
| 227 | #define sk_X509_REVOKED_dup(sk) \ |
| 228 | ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_set_thunks( \ |
| 229 | OPENSSL_sk_set_copy_thunks( \ |
| 230 | OPENSSL_sk_set_cmp_thunks( \ |
| 231 | OPENSSL_sk_dup(ossl_check_const_X509_REVOKED_sk_type(sk)), \ |
| 232 | sk_X509_REVOKED_cmpfunc_thunk), \ |
| 233 | sk_X509_REVOKED_copyfunc_thunk), \ |
| 234 | sk_X509_REVOKED_freefunc_thunk)) |
| 235 | #define sk_X509_REVOKED_deep_copy(sk, copyfunc, freefunc) \ |
| 236 | ((STACK_OF(X509_REVOKED) *)OPENSSL_sk_set_thunks( \ |
| 237 | OPENSSL_sk_set_copy_thunks( \ |
| 238 | OPENSSL_sk_set_cmp_thunks( \ |
| 239 | OPENSSL_sk_deep_copy( \ |
| 240 | ossl_check_const_X509_REVOKED_sk_type(sk), \ |
| 241 | ossl_check_X509_REVOKED_copyfunc_type(copyfunc), \ |
| 242 | ossl_check_X509_REVOKED_freefunc_type(freefunc)), \ |
| 243 | sk_X509_REVOKED_cmpfunc_thunk), \ |
| 244 | sk_X509_REVOKED_copyfunc_thunk), \ |
| 245 | sk_X509_REVOKED_freefunc_thunk)) |
| 246 | #define sk_X509_REVOKED_set_cmp_func(sk, cmp) ((sk_X509_REVOKED_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_compfunc_type(cmp))) |
| 247 | SKM_DEFINE_STACK_OF_INTERNAL(X509_CRL, X509_CRL, X509_CRL) |
| 248 | #define sk_X509_CRL_num(sk) OPENSSL_sk_num(ossl_check_const_X509_CRL_sk_type(sk)) |
| 249 | #define sk_X509_CRL_value(sk, idx) ((X509_CRL *)OPENSSL_sk_value(ossl_check_const_X509_CRL_sk_type(sk), (idx))) |
| 250 | #define sk_X509_CRL_new(cmp) \ |
| 251 | ((STACK_OF(X509_CRL) *)OPENSSL_sk_set_thunks( \ |
| 252 | OPENSSL_sk_set_copy_thunks( \ |
| 253 | OPENSSL_sk_set_cmp_thunks( \ |
| 254 | OPENSSL_sk_new(ossl_check_X509_CRL_compfunc_type(cmp)), \ |
| 255 | sk_X509_CRL_cmpfunc_thunk), \ |
| 256 | sk_X509_CRL_copyfunc_thunk), \ |
| 257 | sk_X509_CRL_freefunc_thunk)) |
| 258 | #define sk_X509_CRL_new_null() \ |
| 259 | ((STACK_OF(X509_CRL) *)OPENSSL_sk_set_thunks( \ |
| 260 | OPENSSL_sk_set_copy_thunks( \ |
| 261 | OPENSSL_sk_set_cmp_thunks( \ |
| 262 | OPENSSL_sk_new_null(), \ |
| 263 | sk_X509_CRL_cmpfunc_thunk), \ |
| 264 | sk_X509_CRL_copyfunc_thunk), \ |
| 265 | sk_X509_CRL_freefunc_thunk)) |
| 266 | #define sk_X509_CRL_new_reserve(cmp, n) \ |
| 267 | ((STACK_OF(X509_CRL) *)OPENSSL_sk_set_thunks( \ |
| 268 | OPENSSL_sk_set_copy_thunks( \ |
| 269 | OPENSSL_sk_set_cmp_thunks( \ |
| 270 | OPENSSL_sk_new_reserve(ossl_check_X509_CRL_compfunc_type(cmp), (n)), \ |
| 271 | sk_X509_CRL_cmpfunc_thunk), \ |
| 272 | sk_X509_CRL_copyfunc_thunk), \ |
| 273 | sk_X509_CRL_freefunc_thunk)) |
| 274 | #define sk_X509_CRL_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_CRL_sk_type(sk), (n)) |
| 275 | #define sk_X509_CRL_free(sk) OPENSSL_sk_free(ossl_check_X509_CRL_sk_type(sk)) |
| 276 | #define sk_X509_CRL_zero(sk) OPENSSL_sk_zero(ossl_check_X509_CRL_sk_type(sk)) |
| 277 | #define sk_X509_CRL_delete(sk, i) ((X509_CRL *)OPENSSL_sk_delete(ossl_check_X509_CRL_sk_type(sk), (i))) |
| 278 | #define sk_X509_CRL_delete_ptr(sk, ptr) ((X509_CRL *)OPENSSL_sk_delete_ptr(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr))) |
| 279 | #define sk_X509_CRL_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr)) |
| 280 | #define sk_X509_CRL_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr)) |
| 281 | #define sk_X509_CRL_pop(sk) ((X509_CRL *)OPENSSL_sk_pop(ossl_check_X509_CRL_sk_type(sk))) |
| 282 | #define sk_X509_CRL_shift(sk) ((X509_CRL *)OPENSSL_sk_shift(ossl_check_X509_CRL_sk_type(sk))) |
| 283 | #define sk_X509_CRL_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_freefunc_type(freefunc)) |
| 284 | #define sk_X509_CRL_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr), (idx)) |
| 285 | #define sk_X509_CRL_set(sk, idx, ptr) ((X509_CRL *)OPENSSL_sk_set(ossl_check_X509_CRL_sk_type(sk), (idx), ossl_check_X509_CRL_type(ptr))) |
| 286 | #define sk_X509_CRL_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr)) |
| 287 | #define sk_X509_CRL_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr)) |
| 288 | #define sk_X509_CRL_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_type(ptr), pnum) |
| 289 | #define sk_X509_CRL_sort(sk) OPENSSL_sk_sort(ossl_check_X509_CRL_sk_type(sk)) |
| 290 | #define sk_X509_CRL_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_CRL_sk_type(sk)) |
| 291 | #define sk_X509_CRL_dup(sk) \ |
| 292 | ((STACK_OF(X509_CRL) *)OPENSSL_sk_set_thunks( \ |
| 293 | OPENSSL_sk_set_copy_thunks( \ |
| 294 | OPENSSL_sk_set_cmp_thunks( \ |
| 295 | OPENSSL_sk_dup(ossl_check_const_X509_CRL_sk_type(sk)), \ |
| 296 | sk_X509_CRL_cmpfunc_thunk), \ |
| 297 | sk_X509_CRL_copyfunc_thunk), \ |
| 298 | sk_X509_CRL_freefunc_thunk)) |
| 299 | #define sk_X509_CRL_deep_copy(sk, copyfunc, freefunc) \ |
| 300 | ((STACK_OF(X509_CRL) *)OPENSSL_sk_set_thunks( \ |
| 301 | OPENSSL_sk_set_copy_thunks( \ |
| 302 | OPENSSL_sk_set_cmp_thunks( \ |
| 303 | OPENSSL_sk_deep_copy( \ |
| 304 | ossl_check_const_X509_CRL_sk_type(sk), \ |
| 305 | ossl_check_X509_CRL_copyfunc_type(copyfunc), \ |
| 306 | ossl_check_X509_CRL_freefunc_type(freefunc)), \ |
| 307 | sk_X509_CRL_cmpfunc_thunk), \ |
| 308 | sk_X509_CRL_copyfunc_thunk), \ |
| 309 | sk_X509_CRL_freefunc_thunk)) |
| 310 | #define sk_X509_CRL_set_cmp_func(sk, cmp) ((sk_X509_CRL_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_CRL_sk_type(sk), ossl_check_X509_CRL_compfunc_type(cmp))) |
| 311 | |
| 312 | /* clang-format on */ |
| 313 | |
| 314 | /* Flags for X509_get_signature_info() */ |
| 315 | /* Signature info is valid */ |
| 316 | #define X509_SIG_INFO_VALID 0x1 |
| 317 | /* Signature is suitable for TLS use */ |
| 318 | #define X509_SIG_INFO_TLS 0x2 |
| 319 | |
| 320 | #define X509_FILETYPE_PEM 1 |
| 321 | #define X509_FILETYPE_ASN1 2 |
| 322 | #define X509_FILETYPE_DEFAULT 3 |
| 323 | |
| 324 | /*- |
| 325 | * <https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.3>: |
| 326 | * The KeyUsage BITSTRING is treated as a little-endian integer, hence bit `0` |
| 327 | * is 0x80, while bit `7` is 0x01 (the LSB of the integer value), bit `8` is |
| 328 | * then the MSB of the second octet, or 0x8000. |
| 329 | */ |
| 330 | #define X509v3_KU_DIGITAL_SIGNATURE 0x0080 /* (0) */ |
| 331 | #define X509v3_KU_NON_REPUDIATION 0x0040 /* (1) */ |
| 332 | #define X509v3_KU_KEY_ENCIPHERMENT 0x0020 /* (2) */ |
| 333 | #define X509v3_KU_DATA_ENCIPHERMENT 0x0010 /* (3) */ |
| 334 | #define X509v3_KU_KEY_AGREEMENT 0x0008 /* (4) */ |
| 335 | #define X509v3_KU_KEY_CERT_SIGN 0x0004 /* (5) */ |
| 336 | #define X509v3_KU_CRL_SIGN 0x0002 /* (6) */ |
| 337 | #define X509v3_KU_ENCIPHER_ONLY 0x0001 /* (7) */ |
| 338 | #define X509v3_KU_DECIPHER_ONLY 0x8000 /* (8) */ |
| 339 | #ifndef OPENSSL_NO_DEPRECATED_3_4 |
| 340 | #define X509v3_KU_UNDEF 0xffff /* vestigial, not used */ |
| 341 | #endif |
| 342 | |
| 343 | struct X509_algor_st { |
| 344 | ASN1_OBJECT *algorithm; |
| 345 | ASN1_TYPE *parameter; |
| 346 | } /* X509_ALGOR */; |
| 347 | |
| 348 | typedef STACK_OF(X509_ALGOR) X509_ALGORS; |
| 349 | |
| 350 | typedef struct X509_val_st { |
| 351 | ASN1_TIME *notBefore; |
| 352 | ASN1_TIME *notAfter; |
| 353 | } X509_VAL; |
| 354 | |
| 355 | typedef struct X509_sig_st X509_SIG; |
| 356 | |
| 357 | typedef struct X509_name_entry_st X509_NAME_ENTRY; |
| 358 | |
| 359 | /* clang-format off */ |
| 360 | SKM_DEFINE_STACK_OF_INTERNAL(X509_NAME_ENTRY, X509_NAME_ENTRY, X509_NAME_ENTRY) |
| 361 | #define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk)) |
| 362 | #define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx))) |
| 363 | #define sk_X509_NAME_ENTRY_new(cmp) \ |
| 364 | ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_set_thunks( \ |
| 365 | OPENSSL_sk_set_copy_thunks( \ |
| 366 | OPENSSL_sk_set_cmp_thunks( \ |
| 367 | OPENSSL_sk_new(ossl_check_X509_NAME_ENTRY_compfunc_type(cmp)), \ |
| 368 | sk_X509_NAME_ENTRY_cmpfunc_thunk), \ |
| 369 | sk_X509_NAME_ENTRY_copyfunc_thunk), \ |
| 370 | sk_X509_NAME_ENTRY_freefunc_thunk)) |
| 371 | #define sk_X509_NAME_ENTRY_new_null() \ |
| 372 | ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_set_thunks( \ |
| 373 | OPENSSL_sk_set_copy_thunks( \ |
| 374 | OPENSSL_sk_set_cmp_thunks( \ |
| 375 | OPENSSL_sk_new_null(), \ |
| 376 | sk_X509_NAME_ENTRY_cmpfunc_thunk), \ |
| 377 | sk_X509_NAME_ENTRY_copyfunc_thunk), \ |
| 378 | sk_X509_NAME_ENTRY_freefunc_thunk)) |
| 379 | #define sk_X509_NAME_ENTRY_new_reserve(cmp, n) \ |
| 380 | ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_set_thunks( \ |
| 381 | OPENSSL_sk_set_copy_thunks( \ |
| 382 | OPENSSL_sk_set_cmp_thunks( \ |
| 383 | OPENSSL_sk_new_reserve(ossl_check_X509_NAME_ENTRY_compfunc_type(cmp), (n)), \ |
| 384 | sk_X509_NAME_ENTRY_cmpfunc_thunk), \ |
| 385 | sk_X509_NAME_ENTRY_copyfunc_thunk), \ |
| 386 | sk_X509_NAME_ENTRY_freefunc_thunk)) |
| 387 | #define sk_X509_NAME_ENTRY_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_NAME_ENTRY_sk_type(sk), (n)) |
| 388 | #define sk_X509_NAME_ENTRY_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_ENTRY_sk_type(sk)) |
| 389 | #define sk_X509_NAME_ENTRY_zero(sk) OPENSSL_sk_zero(ossl_check_X509_NAME_ENTRY_sk_type(sk)) |
| 390 | #define sk_X509_NAME_ENTRY_delete(sk, i) ((X509_NAME_ENTRY *)OPENSSL_sk_delete(ossl_check_X509_NAME_ENTRY_sk_type(sk), (i))) |
| 391 | #define sk_X509_NAME_ENTRY_delete_ptr(sk, ptr) ((X509_NAME_ENTRY *)OPENSSL_sk_delete_ptr(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))) |
| 392 | #define sk_X509_NAME_ENTRY_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr)) |
| 393 | #define sk_X509_NAME_ENTRY_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr)) |
| 394 | #define sk_X509_NAME_ENTRY_pop(sk) ((X509_NAME_ENTRY *)OPENSSL_sk_pop(ossl_check_X509_NAME_ENTRY_sk_type(sk))) |
| 395 | #define sk_X509_NAME_ENTRY_shift(sk) ((X509_NAME_ENTRY *)OPENSSL_sk_shift(ossl_check_X509_NAME_ENTRY_sk_type(sk))) |
| 396 | #define sk_X509_NAME_ENTRY_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_freefunc_type(freefunc)) |
| 397 | #define sk_X509_NAME_ENTRY_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr), (idx)) |
| 398 | #define sk_X509_NAME_ENTRY_set(sk, idx, ptr) ((X509_NAME_ENTRY *)OPENSSL_sk_set(ossl_check_X509_NAME_ENTRY_sk_type(sk), (idx), ossl_check_X509_NAME_ENTRY_type(ptr))) |
| 399 | #define sk_X509_NAME_ENTRY_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr)) |
| 400 | #define sk_X509_NAME_ENTRY_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr)) |
| 401 | #define sk_X509_NAME_ENTRY_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr), pnum) |
| 402 | #define sk_X509_NAME_ENTRY_sort(sk) OPENSSL_sk_sort(ossl_check_X509_NAME_ENTRY_sk_type(sk)) |
| 403 | #define sk_X509_NAME_ENTRY_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_NAME_ENTRY_sk_type(sk)) |
| 404 | #define sk_X509_NAME_ENTRY_dup(sk) \ |
| 405 | ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_set_thunks( \ |
| 406 | OPENSSL_sk_set_copy_thunks( \ |
| 407 | OPENSSL_sk_set_cmp_thunks( \ |
| 408 | OPENSSL_sk_dup(ossl_check_const_X509_NAME_ENTRY_sk_type(sk)), \ |
| 409 | sk_X509_NAME_ENTRY_cmpfunc_thunk), \ |
| 410 | sk_X509_NAME_ENTRY_copyfunc_thunk), \ |
| 411 | sk_X509_NAME_ENTRY_freefunc_thunk)) |
| 412 | #define sk_X509_NAME_ENTRY_deep_copy(sk, copyfunc, freefunc) \ |
| 413 | ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_set_thunks( \ |
| 414 | OPENSSL_sk_set_copy_thunks( \ |
| 415 | OPENSSL_sk_set_cmp_thunks( \ |
| 416 | OPENSSL_sk_deep_copy( \ |
| 417 | ossl_check_const_X509_NAME_ENTRY_sk_type(sk), \ |
| 418 | ossl_check_X509_NAME_ENTRY_copyfunc_type(copyfunc), \ |
| 419 | ossl_check_X509_NAME_ENTRY_freefunc_type(freefunc)), \ |
| 420 | sk_X509_NAME_ENTRY_cmpfunc_thunk), \ |
| 421 | sk_X509_NAME_ENTRY_copyfunc_thunk), \ |
| 422 | sk_X509_NAME_ENTRY_freefunc_thunk)) |
| 423 | #define sk_X509_NAME_ENTRY_set_cmp_func(sk, cmp) ((sk_X509_NAME_ENTRY_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_compfunc_type(cmp))) |
| 424 | |
| 425 | /* clang-format on */ |
| 426 | |
| 427 | #define X509_EX_V_NETSCAPE_HACK 0x8000 |
| 428 | #define X509_EX_V_INIT 0x0001 |
| 429 | typedef struct X509_extension_st X509_EXTENSION; |
| 430 | /* clang-format off */ |
| 431 | SKM_DEFINE_STACK_OF_INTERNAL(X509_EXTENSION, X509_EXTENSION, X509_EXTENSION) |
| 432 | #define sk_X509_EXTENSION_num(sk) OPENSSL_sk_num(ossl_check_const_X509_EXTENSION_sk_type(sk)) |
| 433 | #define sk_X509_EXTENSION_value(sk, idx) ((X509_EXTENSION *)OPENSSL_sk_value(ossl_check_const_X509_EXTENSION_sk_type(sk), (idx))) |
| 434 | #define sk_X509_EXTENSION_new(cmp) \ |
| 435 | ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_set_thunks( \ |
| 436 | OPENSSL_sk_set_copy_thunks( \ |
| 437 | OPENSSL_sk_set_cmp_thunks( \ |
| 438 | OPENSSL_sk_new(ossl_check_X509_EXTENSION_compfunc_type(cmp)), \ |
| 439 | sk_X509_EXTENSION_cmpfunc_thunk), \ |
| 440 | sk_X509_EXTENSION_copyfunc_thunk), \ |
| 441 | sk_X509_EXTENSION_freefunc_thunk)) |
| 442 | #define sk_X509_EXTENSION_new_null() \ |
| 443 | ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_set_thunks( \ |
| 444 | OPENSSL_sk_set_copy_thunks( \ |
| 445 | OPENSSL_sk_set_cmp_thunks( \ |
| 446 | OPENSSL_sk_new_null(), \ |
| 447 | sk_X509_EXTENSION_cmpfunc_thunk), \ |
| 448 | sk_X509_EXTENSION_copyfunc_thunk), \ |
| 449 | sk_X509_EXTENSION_freefunc_thunk)) |
| 450 | #define sk_X509_EXTENSION_new_reserve(cmp, n) \ |
| 451 | ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_set_thunks( \ |
| 452 | OPENSSL_sk_set_copy_thunks( \ |
| 453 | OPENSSL_sk_set_cmp_thunks( \ |
| 454 | OPENSSL_sk_new_reserve(ossl_check_X509_EXTENSION_compfunc_type(cmp), (n)), \ |
| 455 | sk_X509_EXTENSION_cmpfunc_thunk), \ |
| 456 | sk_X509_EXTENSION_copyfunc_thunk), \ |
| 457 | sk_X509_EXTENSION_freefunc_thunk)) |
| 458 | #define sk_X509_EXTENSION_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_EXTENSION_sk_type(sk), (n)) |
| 459 | #define sk_X509_EXTENSION_free(sk) OPENSSL_sk_free(ossl_check_X509_EXTENSION_sk_type(sk)) |
| 460 | #define sk_X509_EXTENSION_zero(sk) OPENSSL_sk_zero(ossl_check_X509_EXTENSION_sk_type(sk)) |
| 461 | #define sk_X509_EXTENSION_delete(sk, i) ((X509_EXTENSION *)OPENSSL_sk_delete(ossl_check_X509_EXTENSION_sk_type(sk), (i))) |
| 462 | #define sk_X509_EXTENSION_delete_ptr(sk, ptr) ((X509_EXTENSION *)OPENSSL_sk_delete_ptr(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr))) |
| 463 | #define sk_X509_EXTENSION_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr)) |
| 464 | #define sk_X509_EXTENSION_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr)) |
| 465 | #define sk_X509_EXTENSION_pop(sk) ((X509_EXTENSION *)OPENSSL_sk_pop(ossl_check_X509_EXTENSION_sk_type(sk))) |
| 466 | #define sk_X509_EXTENSION_shift(sk) ((X509_EXTENSION *)OPENSSL_sk_shift(ossl_check_X509_EXTENSION_sk_type(sk))) |
| 467 | #define sk_X509_EXTENSION_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_freefunc_type(freefunc)) |
| 468 | #define sk_X509_EXTENSION_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr), (idx)) |
| 469 | #define sk_X509_EXTENSION_set(sk, idx, ptr) ((X509_EXTENSION *)OPENSSL_sk_set(ossl_check_X509_EXTENSION_sk_type(sk), (idx), ossl_check_X509_EXTENSION_type(ptr))) |
| 470 | #define sk_X509_EXTENSION_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr)) |
| 471 | #define sk_X509_EXTENSION_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr)) |
| 472 | #define sk_X509_EXTENSION_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_type(ptr), pnum) |
| 473 | #define sk_X509_EXTENSION_sort(sk) OPENSSL_sk_sort(ossl_check_X509_EXTENSION_sk_type(sk)) |
| 474 | #define sk_X509_EXTENSION_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_EXTENSION_sk_type(sk)) |
| 475 | #define sk_X509_EXTENSION_dup(sk) \ |
| 476 | ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_set_thunks( \ |
| 477 | OPENSSL_sk_set_copy_thunks( \ |
| 478 | OPENSSL_sk_set_cmp_thunks( \ |
| 479 | OPENSSL_sk_dup(ossl_check_const_X509_EXTENSION_sk_type(sk)), \ |
| 480 | sk_X509_EXTENSION_cmpfunc_thunk), \ |
| 481 | sk_X509_EXTENSION_copyfunc_thunk), \ |
| 482 | sk_X509_EXTENSION_freefunc_thunk)) |
| 483 | #define sk_X509_EXTENSION_deep_copy(sk, copyfunc, freefunc) \ |
| 484 | ((STACK_OF(X509_EXTENSION) *)OPENSSL_sk_set_thunks( \ |
| 485 | OPENSSL_sk_set_copy_thunks( \ |
| 486 | OPENSSL_sk_set_cmp_thunks( \ |
| 487 | OPENSSL_sk_deep_copy( \ |
| 488 | ossl_check_const_X509_EXTENSION_sk_type(sk), \ |
| 489 | ossl_check_X509_EXTENSION_copyfunc_type(copyfunc), \ |
| 490 | ossl_check_X509_EXTENSION_freefunc_type(freefunc)), \ |
| 491 | sk_X509_EXTENSION_cmpfunc_thunk), \ |
| 492 | sk_X509_EXTENSION_copyfunc_thunk), \ |
| 493 | sk_X509_EXTENSION_freefunc_thunk)) |
| 494 | #define sk_X509_EXTENSION_set_cmp_func(sk, cmp) ((sk_X509_EXTENSION_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_EXTENSION_sk_type(sk), ossl_check_X509_EXTENSION_compfunc_type(cmp))) |
| 495 | |
| 496 | /* clang-format on */ |
| 497 | typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; |
| 498 | typedef struct x509_attributes_st X509_ATTRIBUTE; |
| 499 | /* clang-format off */ |
| 500 | SKM_DEFINE_STACK_OF_INTERNAL(X509_ATTRIBUTE, X509_ATTRIBUTE, X509_ATTRIBUTE) |
| 501 | #define sk_X509_ATTRIBUTE_num(sk) OPENSSL_sk_num(ossl_check_const_X509_ATTRIBUTE_sk_type(sk)) |
| 502 | #define sk_X509_ATTRIBUTE_value(sk, idx) ((X509_ATTRIBUTE *)OPENSSL_sk_value(ossl_check_const_X509_ATTRIBUTE_sk_type(sk), (idx))) |
| 503 | #define sk_X509_ATTRIBUTE_new(cmp) \ |
| 504 | ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_set_thunks( \ |
| 505 | OPENSSL_sk_set_copy_thunks( \ |
| 506 | OPENSSL_sk_set_cmp_thunks( \ |
| 507 | OPENSSL_sk_new(ossl_check_X509_ATTRIBUTE_compfunc_type(cmp)), \ |
| 508 | sk_X509_ATTRIBUTE_cmpfunc_thunk), \ |
| 509 | sk_X509_ATTRIBUTE_copyfunc_thunk), \ |
| 510 | sk_X509_ATTRIBUTE_freefunc_thunk)) |
| 511 | #define sk_X509_ATTRIBUTE_new_null() \ |
| 512 | ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_set_thunks( \ |
| 513 | OPENSSL_sk_set_copy_thunks( \ |
| 514 | OPENSSL_sk_set_cmp_thunks( \ |
| 515 | OPENSSL_sk_new_null(), \ |
| 516 | sk_X509_ATTRIBUTE_cmpfunc_thunk), \ |
| 517 | sk_X509_ATTRIBUTE_copyfunc_thunk), \ |
| 518 | sk_X509_ATTRIBUTE_freefunc_thunk)) |
| 519 | #define sk_X509_ATTRIBUTE_new_reserve(cmp, n) \ |
| 520 | ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_set_thunks( \ |
| 521 | OPENSSL_sk_set_copy_thunks( \ |
| 522 | OPENSSL_sk_set_cmp_thunks( \ |
| 523 | OPENSSL_sk_new_reserve(ossl_check_X509_ATTRIBUTE_compfunc_type(cmp), (n)), \ |
| 524 | sk_X509_ATTRIBUTE_cmpfunc_thunk), \ |
| 525 | sk_X509_ATTRIBUTE_copyfunc_thunk), \ |
| 526 | sk_X509_ATTRIBUTE_freefunc_thunk)) |
| 527 | #define sk_X509_ATTRIBUTE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_ATTRIBUTE_sk_type(sk), (n)) |
| 528 | #define sk_X509_ATTRIBUTE_free(sk) OPENSSL_sk_free(ossl_check_X509_ATTRIBUTE_sk_type(sk)) |
| 529 | #define sk_X509_ATTRIBUTE_zero(sk) OPENSSL_sk_zero(ossl_check_X509_ATTRIBUTE_sk_type(sk)) |
| 530 | #define sk_X509_ATTRIBUTE_delete(sk, i) ((X509_ATTRIBUTE *)OPENSSL_sk_delete(ossl_check_X509_ATTRIBUTE_sk_type(sk), (i))) |
| 531 | #define sk_X509_ATTRIBUTE_delete_ptr(sk, ptr) ((X509_ATTRIBUTE *)OPENSSL_sk_delete_ptr(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr))) |
| 532 | #define sk_X509_ATTRIBUTE_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr)) |
| 533 | #define sk_X509_ATTRIBUTE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr)) |
| 534 | #define sk_X509_ATTRIBUTE_pop(sk) ((X509_ATTRIBUTE *)OPENSSL_sk_pop(ossl_check_X509_ATTRIBUTE_sk_type(sk))) |
| 535 | #define sk_X509_ATTRIBUTE_shift(sk) ((X509_ATTRIBUTE *)OPENSSL_sk_shift(ossl_check_X509_ATTRIBUTE_sk_type(sk))) |
| 536 | #define sk_X509_ATTRIBUTE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_freefunc_type(freefunc)) |
| 537 | #define sk_X509_ATTRIBUTE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr), (idx)) |
| 538 | #define sk_X509_ATTRIBUTE_set(sk, idx, ptr) ((X509_ATTRIBUTE *)OPENSSL_sk_set(ossl_check_X509_ATTRIBUTE_sk_type(sk), (idx), ossl_check_X509_ATTRIBUTE_type(ptr))) |
| 539 | #define sk_X509_ATTRIBUTE_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr)) |
| 540 | #define sk_X509_ATTRIBUTE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr)) |
| 541 | #define sk_X509_ATTRIBUTE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_type(ptr), pnum) |
| 542 | #define sk_X509_ATTRIBUTE_sort(sk) OPENSSL_sk_sort(ossl_check_X509_ATTRIBUTE_sk_type(sk)) |
| 543 | #define sk_X509_ATTRIBUTE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_ATTRIBUTE_sk_type(sk)) |
| 544 | #define sk_X509_ATTRIBUTE_dup(sk) \ |
| 545 | ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_set_thunks( \ |
| 546 | OPENSSL_sk_set_copy_thunks( \ |
| 547 | OPENSSL_sk_set_cmp_thunks( \ |
| 548 | OPENSSL_sk_dup(ossl_check_const_X509_ATTRIBUTE_sk_type(sk)), \ |
| 549 | sk_X509_ATTRIBUTE_cmpfunc_thunk), \ |
| 550 | sk_X509_ATTRIBUTE_copyfunc_thunk), \ |
| 551 | sk_X509_ATTRIBUTE_freefunc_thunk)) |
| 552 | #define sk_X509_ATTRIBUTE_deep_copy(sk, copyfunc, freefunc) \ |
| 553 | ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_set_thunks( \ |
| 554 | OPENSSL_sk_set_copy_thunks( \ |
| 555 | OPENSSL_sk_set_cmp_thunks( \ |
| 556 | OPENSSL_sk_deep_copy( \ |
| 557 | ossl_check_const_X509_ATTRIBUTE_sk_type(sk), \ |
| 558 | ossl_check_X509_ATTRIBUTE_copyfunc_type(copyfunc), \ |
| 559 | ossl_check_X509_ATTRIBUTE_freefunc_type(freefunc)), \ |
| 560 | sk_X509_ATTRIBUTE_cmpfunc_thunk), \ |
| 561 | sk_X509_ATTRIBUTE_copyfunc_thunk), \ |
| 562 | sk_X509_ATTRIBUTE_freefunc_thunk)) |
| 563 | #define sk_X509_ATTRIBUTE_set_cmp_func(sk, cmp) ((sk_X509_ATTRIBUTE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_ATTRIBUTE_sk_type(sk), ossl_check_X509_ATTRIBUTE_compfunc_type(cmp))) |
| 564 | |
| 565 | /* clang-format on */ |
| 566 | typedef struct X509_req_info_st X509_REQ_INFO; |
| 567 | typedef struct X509_req_st X509_REQ; |
| 568 | typedef struct x509_cert_aux_st X509_CERT_AUX; |
| 569 | typedef struct x509_cinf_st X509_CINF; |
| 570 | |
| 571 | /* Flags for X509_print_ex() */ |
| 572 | |
| 573 | #define X509_FLAG_COMPAT 0 |
| 574 | #define 1L |
| 575 | #define X509_FLAG_NO_VERSION (1L << 1) |
| 576 | #define X509_FLAG_NO_SERIAL (1L << 2) |
| 577 | #define X509_FLAG_NO_SIGNAME (1L << 3) |
| 578 | #define X509_FLAG_NO_ISSUER (1L << 4) |
| 579 | #define X509_FLAG_NO_VALIDITY (1L << 5) |
| 580 | #define X509_FLAG_NO_SUBJECT (1L << 6) |
| 581 | #define X509_FLAG_NO_PUBKEY (1L << 7) |
| 582 | #define X509_FLAG_NO_EXTENSIONS (1L << 8) |
| 583 | #define X509_FLAG_NO_SIGDUMP (1L << 9) |
| 584 | #define X509_FLAG_NO_AUX (1L << 10) |
| 585 | #define X509_FLAG_NO_ATTRIBUTES (1L << 11) |
| 586 | #define X509_FLAG_NO_IDS (1L << 12) |
| 587 | #define X509_FLAG_EXTENSIONS_ONLY_KID (1L << 13) |
| 588 | |
| 589 | /* Flags specific to X509_NAME_print_ex() */ |
| 590 | |
| 591 | /* The field separator information */ |
| 592 | |
| 593 | #define XN_FLAG_SEP_MASK (0xf << 16) |
| 594 | |
| 595 | #define XN_FLAG_COMPAT 0 /* Traditional; use old X509_NAME_print */ |
| 596 | #define XN_FLAG_SEP_COMMA_PLUS (1 << 16) /* RFC2253 ,+ */ |
| 597 | #define XN_FLAG_SEP_CPLUS_SPC (2 << 16) /* ,+ spaced: more readable */ |
| 598 | #define XN_FLAG_SEP_SPLUS_SPC (3 << 16) /* ;+ spaced */ |
| 599 | #define XN_FLAG_SEP_MULTILINE (4 << 16) /* One line per field */ |
| 600 | |
| 601 | #define XN_FLAG_DN_REV (1 << 20) /* Reverse DN order */ |
| 602 | |
| 603 | /* How the field name is shown */ |
| 604 | |
| 605 | #define XN_FLAG_FN_MASK (0x3 << 21) |
| 606 | |
| 607 | #define XN_FLAG_FN_SN 0 /* Object short name */ |
| 608 | #define XN_FLAG_FN_LN (1 << 21) /* Object long name */ |
| 609 | #define XN_FLAG_FN_OID (2 << 21) /* Always use OIDs */ |
| 610 | #define XN_FLAG_FN_NONE (3 << 21) /* No field names */ |
| 611 | |
| 612 | #define XN_FLAG_SPC_EQ (1 << 23) /* Put spaces round '=' */ |
| 613 | |
| 614 | /* |
| 615 | * This determines if we dump fields we don't recognise: RFC2253 requires |
| 616 | * this. |
| 617 | */ |
| 618 | |
| 619 | #define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) |
| 620 | |
| 621 | #define XN_FLAG_FN_ALIGN (1 << 25) /* Align field names to 20 \ |
| 622 | * characters */ |
| 623 | |
| 624 | /* Complete set of RFC2253 flags */ |
| 625 | |
| 626 | #define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS) |
| 627 | |
| 628 | /* readable oneline form */ |
| 629 | |
| 630 | #define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_SPC_EQ | XN_FLAG_FN_SN) |
| 631 | |
| 632 | /* readable multiline form */ |
| 633 | |
| 634 | #define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN) |
| 635 | |
| 636 | typedef struct X509_crl_info_st X509_CRL_INFO; |
| 637 | |
| 638 | typedef struct private_key_st { |
| 639 | int version; |
| 640 | /* The PKCS#8 data types */ |
| 641 | X509_ALGOR *enc_algor; |
| 642 | ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ |
| 643 | /* When decrypted, the following will not be NULL */ |
| 644 | EVP_PKEY *dec_pkey; |
| 645 | /* used to encrypt and decrypt */ |
| 646 | int key_length; |
| 647 | char *key_data; |
| 648 | int key_free; /* true if we should auto free key_data */ |
| 649 | /* expanded version of 'enc_algor' */ |
| 650 | EVP_CIPHER_INFO cipher; |
| 651 | } X509_PKEY; |
| 652 | |
| 653 | typedef struct X509_info_st { |
| 654 | X509 *x509; |
| 655 | X509_CRL *crl; |
| 656 | X509_PKEY *x_pkey; |
| 657 | EVP_CIPHER_INFO enc_cipher; |
| 658 | int enc_len; |
| 659 | char *enc_data; |
| 660 | } X509_INFO; |
| 661 | /* clang-format off */ |
| 662 | SKM_DEFINE_STACK_OF_INTERNAL(X509_INFO, X509_INFO, X509_INFO) |
| 663 | #define sk_X509_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_X509_INFO_sk_type(sk)) |
| 664 | #define sk_X509_INFO_value(sk, idx) ((X509_INFO *)OPENSSL_sk_value(ossl_check_const_X509_INFO_sk_type(sk), (idx))) |
| 665 | #define sk_X509_INFO_new(cmp) \ |
| 666 | ((STACK_OF(X509_INFO) *)OPENSSL_sk_set_thunks( \ |
| 667 | OPENSSL_sk_set_copy_thunks( \ |
| 668 | OPENSSL_sk_set_cmp_thunks( \ |
| 669 | OPENSSL_sk_new(ossl_check_X509_INFO_compfunc_type(cmp)), \ |
| 670 | sk_X509_INFO_cmpfunc_thunk), \ |
| 671 | sk_X509_INFO_copyfunc_thunk), \ |
| 672 | sk_X509_INFO_freefunc_thunk)) |
| 673 | #define sk_X509_INFO_new_null() \ |
| 674 | ((STACK_OF(X509_INFO) *)OPENSSL_sk_set_thunks( \ |
| 675 | OPENSSL_sk_set_copy_thunks( \ |
| 676 | OPENSSL_sk_set_cmp_thunks( \ |
| 677 | OPENSSL_sk_new_null(), \ |
| 678 | sk_X509_INFO_cmpfunc_thunk), \ |
| 679 | sk_X509_INFO_copyfunc_thunk), \ |
| 680 | sk_X509_INFO_freefunc_thunk)) |
| 681 | #define sk_X509_INFO_new_reserve(cmp, n) \ |
| 682 | ((STACK_OF(X509_INFO) *)OPENSSL_sk_set_thunks( \ |
| 683 | OPENSSL_sk_set_copy_thunks( \ |
| 684 | OPENSSL_sk_set_cmp_thunks( \ |
| 685 | OPENSSL_sk_new_reserve(ossl_check_X509_INFO_compfunc_type(cmp), (n)), \ |
| 686 | sk_X509_INFO_cmpfunc_thunk), \ |
| 687 | sk_X509_INFO_copyfunc_thunk), \ |
| 688 | sk_X509_INFO_freefunc_thunk)) |
| 689 | #define sk_X509_INFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_INFO_sk_type(sk), (n)) |
| 690 | #define sk_X509_INFO_free(sk) OPENSSL_sk_free(ossl_check_X509_INFO_sk_type(sk)) |
| 691 | #define sk_X509_INFO_zero(sk) OPENSSL_sk_zero(ossl_check_X509_INFO_sk_type(sk)) |
| 692 | #define sk_X509_INFO_delete(sk, i) ((X509_INFO *)OPENSSL_sk_delete(ossl_check_X509_INFO_sk_type(sk), (i))) |
| 693 | #define sk_X509_INFO_delete_ptr(sk, ptr) ((X509_INFO *)OPENSSL_sk_delete_ptr(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr))) |
| 694 | #define sk_X509_INFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr)) |
| 695 | #define sk_X509_INFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr)) |
| 696 | #define sk_X509_INFO_pop(sk) ((X509_INFO *)OPENSSL_sk_pop(ossl_check_X509_INFO_sk_type(sk))) |
| 697 | #define sk_X509_INFO_shift(sk) ((X509_INFO *)OPENSSL_sk_shift(ossl_check_X509_INFO_sk_type(sk))) |
| 698 | #define sk_X509_INFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_freefunc_type(freefunc)) |
| 699 | #define sk_X509_INFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr), (idx)) |
| 700 | #define sk_X509_INFO_set(sk, idx, ptr) ((X509_INFO *)OPENSSL_sk_set(ossl_check_X509_INFO_sk_type(sk), (idx), ossl_check_X509_INFO_type(ptr))) |
| 701 | #define sk_X509_INFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr)) |
| 702 | #define sk_X509_INFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr)) |
| 703 | #define sk_X509_INFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_type(ptr), pnum) |
| 704 | #define sk_X509_INFO_sort(sk) OPENSSL_sk_sort(ossl_check_X509_INFO_sk_type(sk)) |
| 705 | #define sk_X509_INFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_INFO_sk_type(sk)) |
| 706 | #define sk_X509_INFO_dup(sk) \ |
| 707 | ((STACK_OF(X509_INFO) *)OPENSSL_sk_set_thunks( \ |
| 708 | OPENSSL_sk_set_copy_thunks( \ |
| 709 | OPENSSL_sk_set_cmp_thunks( \ |
| 710 | OPENSSL_sk_dup(ossl_check_const_X509_INFO_sk_type(sk)), \ |
| 711 | sk_X509_INFO_cmpfunc_thunk), \ |
| 712 | sk_X509_INFO_copyfunc_thunk), \ |
| 713 | sk_X509_INFO_freefunc_thunk)) |
| 714 | #define sk_X509_INFO_deep_copy(sk, copyfunc, freefunc) \ |
| 715 | ((STACK_OF(X509_INFO) *)OPENSSL_sk_set_thunks( \ |
| 716 | OPENSSL_sk_set_copy_thunks( \ |
| 717 | OPENSSL_sk_set_cmp_thunks( \ |
| 718 | OPENSSL_sk_deep_copy( \ |
| 719 | ossl_check_const_X509_INFO_sk_type(sk), \ |
| 720 | ossl_check_X509_INFO_copyfunc_type(copyfunc), \ |
| 721 | ossl_check_X509_INFO_freefunc_type(freefunc)), \ |
| 722 | sk_X509_INFO_cmpfunc_thunk), \ |
| 723 | sk_X509_INFO_copyfunc_thunk), \ |
| 724 | sk_X509_INFO_freefunc_thunk)) |
| 725 | #define sk_X509_INFO_set_cmp_func(sk, cmp) ((sk_X509_INFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_INFO_sk_type(sk), ossl_check_X509_INFO_compfunc_type(cmp))) |
| 726 | |
| 727 | /* clang-format on */ |
| 728 | |
| 729 | /* |
| 730 | * The next 2 structures and their 8 routines are used to manipulate Netscape's |
| 731 | * spki structures - useful if you are writing a CA web page |
| 732 | */ |
| 733 | typedef struct Netscape_spkac_st { |
| 734 | X509_PUBKEY *pubkey; |
| 735 | ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ |
| 736 | } NETSCAPE_SPKAC; |
| 737 | |
| 738 | typedef struct Netscape_spki_st { |
| 739 | NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ |
| 740 | X509_ALGOR sig_algor; |
| 741 | ASN1_BIT_STRING *signature; |
| 742 | } NETSCAPE_SPKI; |
| 743 | |
| 744 | /* Netscape certificate sequence structure */ |
| 745 | typedef struct Netscape_certificate_sequence { |
| 746 | ASN1_OBJECT *type; |
| 747 | STACK_OF(X509) *certs; |
| 748 | } NETSCAPE_CERT_SEQUENCE; |
| 749 | |
| 750 | /*- Unused (and iv length is wrong) |
| 751 | typedef struct CBCParameter_st |
| 752 | { |
| 753 | unsigned char iv[8]; |
| 754 | } CBC_PARAM; |
| 755 | */ |
| 756 | |
| 757 | /* Password based encryption structure */ |
| 758 | |
| 759 | typedef struct PBEPARAM_st { |
| 760 | ASN1_OCTET_STRING *salt; |
| 761 | ASN1_INTEGER *iter; |
| 762 | } PBEPARAM; |
| 763 | |
| 764 | /* Password based encryption V2 structures */ |
| 765 | |
| 766 | typedef struct PBE2PARAM_st { |
| 767 | X509_ALGOR *keyfunc; |
| 768 | X509_ALGOR *encryption; |
| 769 | } PBE2PARAM; |
| 770 | |
| 771 | typedef struct PBKDF2PARAM_st { |
| 772 | /* Usually OCTET STRING but could be anything */ |
| 773 | ASN1_TYPE *salt; |
| 774 | ASN1_INTEGER *iter; |
| 775 | ASN1_INTEGER *keylength; |
| 776 | X509_ALGOR *prf; |
| 777 | } PBKDF2PARAM; |
| 778 | |
| 779 | typedef struct { |
| 780 | X509_ALGOR *keyDerivationFunc; |
| 781 | X509_ALGOR *messageAuthScheme; |
| 782 | } PBMAC1PARAM; |
| 783 | |
| 784 | #ifndef OPENSSL_NO_SCRYPT |
| 785 | typedef struct SCRYPT_PARAMS_st { |
| 786 | ASN1_OCTET_STRING *salt; |
| 787 | ASN1_INTEGER *costParameter; |
| 788 | ASN1_INTEGER *blockSize; |
| 789 | ASN1_INTEGER *parallelizationParameter; |
| 790 | ASN1_INTEGER *keyLength; |
| 791 | } SCRYPT_PARAMS; |
| 792 | #endif |
| 793 | |
| 794 | #ifdef __cplusplus |
| 795 | } |
| 796 | #endif |
| 797 | |
| 798 | #include <openssl/x509_vfy.h> |
| 799 | #include <openssl/pkcs7.h> |
| 800 | |
| 801 | #ifdef __cplusplus |
| 802 | extern "C" { |
| 803 | #endif |
| 804 | |
| 805 | #define X509_EXT_PACK_UNKNOWN 1 |
| 806 | #define X509_EXT_PACK_STRING 2 |
| 807 | |
| 808 | #define (x) X509_get_pubkey(x) /*****/ |
| 809 | #define (a) X509_REQ_get_pubkey(a) |
| 810 | #define X509_name_cmp(a, b) X509_NAME_cmp((a), (b)) |
| 811 | |
| 812 | void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); |
| 813 | X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init)(X509_CRL *crl), |
| 814 | int (*crl_free)(X509_CRL *crl), |
| 815 | int (*crl_lookup)(X509_CRL *crl, |
| 816 | X509_REVOKED **ret, |
| 817 | const ASN1_INTEGER *serial, |
| 818 | const X509_NAME *issuer), |
| 819 | int (*crl_verify)(X509_CRL *crl, |
| 820 | EVP_PKEY *pk)); |
| 821 | void X509_CRL_METHOD_free(X509_CRL_METHOD *m); |
| 822 | |
| 823 | void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); |
| 824 | void *X509_CRL_get_meth_data(X509_CRL *crl); |
| 825 | |
| 826 | const char *X509_verify_cert_error_string(long n); |
| 827 | |
| 828 | int X509_verify(const X509 *a, EVP_PKEY *r); |
| 829 | int X509_self_signed(const X509 *cert, int verify_signature); |
| 830 | |
| 831 | int X509_REQ_verify_ex(X509_REQ *a, EVP_PKEY *r, OSSL_LIB_CTX *libctx, |
| 832 | const char *propq); |
| 833 | int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); |
| 834 | int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); |
| 835 | int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); |
| 836 | |
| 837 | NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len); |
| 838 | char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); |
| 839 | EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); |
| 840 | int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); |
| 841 | |
| 842 | int NETSCAPE_SPKI_print(BIO *out, const NETSCAPE_SPKI *spki); |
| 843 | |
| 844 | int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent); |
| 845 | int X509_signature_print(BIO *bp, const X509_ALGOR *alg, |
| 846 | const ASN1_STRING *sig); |
| 847 | |
| 848 | int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); |
| 849 | int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); |
| 850 | int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); |
| 851 | int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); |
| 852 | int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); |
| 853 | int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); |
| 854 | int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); |
| 855 | |
| 856 | int X509_pubkey_digest(const X509 *data, const EVP_MD *type, |
| 857 | unsigned char *md, unsigned int *len); |
| 858 | int X509_digest(const X509 *data, const EVP_MD *type, |
| 859 | unsigned char *md, unsigned int *len); |
| 860 | ASN1_OCTET_STRING *X509_digest_sig(const X509 *cert, |
| 861 | EVP_MD **md_used, int *md_is_fallback); |
| 862 | int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, |
| 863 | unsigned char *md, unsigned int *len); |
| 864 | int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, |
| 865 | unsigned char *md, unsigned int *len); |
| 866 | int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, |
| 867 | unsigned char *md, unsigned int *len); |
| 868 | |
| 869 | X509 *X509_load_http(const char *url, BIO *bio, BIO *rbio, int timeout); |
| 870 | X509_CRL *X509_CRL_load_http(const char *url, BIO *bio, BIO *rbio, int timeout); |
| 871 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 872 | #include <openssl/http.h> /* OSSL_HTTP_REQ_CTX_nbio_d2i */ |
| 873 | #define X509_http_nbio(rctx, pcert) \ |
| 874 | OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcert, ASN1_ITEM_rptr(X509)) |
| 875 | #define X509_CRL_http_nbio(rctx, pcrl) \ |
| 876 | OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcrl, ASN1_ITEM_rptr(X509_CRL)) |
| 877 | #endif |
| 878 | |
| 879 | #ifndef OPENSSL_NO_STDIO |
| 880 | X509 *d2i_X509_fp(FILE *fp, X509 **x509); |
| 881 | int i2d_X509_fp(FILE *fp, const X509 *x509); |
| 882 | X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl); |
| 883 | int i2d_X509_CRL_fp(FILE *fp, const X509_CRL *crl); |
| 884 | X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req); |
| 885 | int i2d_X509_REQ_fp(FILE *fp, const X509_REQ *req); |
| 886 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 887 | OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa); |
| 888 | OSSL_DEPRECATEDIN_3_0 int i2d_RSAPrivateKey_fp(FILE *fp, const RSA *rsa); |
| 889 | OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa); |
| 890 | OSSL_DEPRECATEDIN_3_0 int i2d_RSAPublicKey_fp(FILE *fp, const RSA *rsa); |
| 891 | OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa); |
| 892 | OSSL_DEPRECATEDIN_3_0 int i2d_RSA_PUBKEY_fp(FILE *fp, const RSA *rsa); |
| 893 | #endif |
| 894 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 895 | #ifndef OPENSSL_NO_DSA |
| 896 | OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); |
| 897 | OSSL_DEPRECATEDIN_3_0 int i2d_DSA_PUBKEY_fp(FILE *fp, const DSA *dsa); |
| 898 | OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); |
| 899 | OSSL_DEPRECATEDIN_3_0 int i2d_DSAPrivateKey_fp(FILE *fp, const DSA *dsa); |
| 900 | #endif |
| 901 | #endif |
| 902 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 903 | #ifndef OPENSSL_NO_EC |
| 904 | OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); |
| 905 | OSSL_DEPRECATEDIN_3_0 int i2d_EC_PUBKEY_fp(FILE *fp, const EC_KEY *eckey); |
| 906 | OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); |
| 907 | OSSL_DEPRECATEDIN_3_0 int i2d_ECPrivateKey_fp(FILE *fp, const EC_KEY *eckey); |
| 908 | #endif /* OPENSSL_NO_EC */ |
| 909 | #endif /* OPENSSL_NO_DEPRECATED_3_0 */ |
| 910 | X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8); |
| 911 | int i2d_PKCS8_fp(FILE *fp, const X509_SIG *p8); |
| 912 | X509_PUBKEY *d2i_X509_PUBKEY_fp(FILE *fp, X509_PUBKEY **xpk); |
| 913 | int i2d_X509_PUBKEY_fp(FILE *fp, const X509_PUBKEY *xpk); |
| 914 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, |
| 915 | PKCS8_PRIV_KEY_INFO **p8inf); |
| 916 | int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, const PKCS8_PRIV_KEY_INFO *p8inf); |
| 917 | int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, const EVP_PKEY *key); |
| 918 | int i2d_PrivateKey_fp(FILE *fp, const EVP_PKEY *pkey); |
| 919 | EVP_PKEY *d2i_PrivateKey_ex_fp(FILE *fp, EVP_PKEY **a, OSSL_LIB_CTX *libctx, |
| 920 | const char *propq); |
| 921 | EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); |
| 922 | int i2d_PUBKEY_fp(FILE *fp, const EVP_PKEY *pkey); |
| 923 | EVP_PKEY *d2i_PUBKEY_ex_fp(FILE *fp, EVP_PKEY **a, OSSL_LIB_CTX *libctx, |
| 924 | const char *propq); |
| 925 | EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); |
| 926 | #endif |
| 927 | |
| 928 | X509 *d2i_X509_bio(BIO *bp, X509 **x509); |
| 929 | int i2d_X509_bio(BIO *bp, const X509 *x509); |
| 930 | X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); |
| 931 | int i2d_X509_CRL_bio(BIO *bp, const X509_CRL *crl); |
| 932 | X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req); |
| 933 | int i2d_X509_REQ_bio(BIO *bp, const X509_REQ *req); |
| 934 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 935 | OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa); |
| 936 | OSSL_DEPRECATEDIN_3_0 int i2d_RSAPrivateKey_bio(BIO *bp, const RSA *rsa); |
| 937 | OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa); |
| 938 | OSSL_DEPRECATEDIN_3_0 int i2d_RSAPublicKey_bio(BIO *bp, const RSA *rsa); |
| 939 | OSSL_DEPRECATEDIN_3_0 RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa); |
| 940 | OSSL_DEPRECATEDIN_3_0 int i2d_RSA_PUBKEY_bio(BIO *bp, const RSA *rsa); |
| 941 | #endif |
| 942 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 943 | #ifndef OPENSSL_NO_DSA |
| 944 | OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); |
| 945 | OSSL_DEPRECATEDIN_3_0 int i2d_DSA_PUBKEY_bio(BIO *bp, const DSA *dsa); |
| 946 | OSSL_DEPRECATEDIN_3_0 DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); |
| 947 | OSSL_DEPRECATEDIN_3_0 int i2d_DSAPrivateKey_bio(BIO *bp, const DSA *dsa); |
| 948 | #endif |
| 949 | #endif |
| 950 | |
| 951 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 952 | #ifndef OPENSSL_NO_EC |
| 953 | OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); |
| 954 | OSSL_DEPRECATEDIN_3_0 int i2d_EC_PUBKEY_bio(BIO *bp, const EC_KEY *eckey); |
| 955 | OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); |
| 956 | OSSL_DEPRECATEDIN_3_0 int i2d_ECPrivateKey_bio(BIO *bp, const EC_KEY *eckey); |
| 957 | #endif /* OPENSSL_NO_EC */ |
| 958 | #endif /* OPENSSL_NO_DEPRECATED_3_0 */ |
| 959 | |
| 960 | X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8); |
| 961 | int i2d_PKCS8_bio(BIO *bp, const X509_SIG *p8); |
| 962 | X509_PUBKEY *d2i_X509_PUBKEY_bio(BIO *bp, X509_PUBKEY **xpk); |
| 963 | int i2d_X509_PUBKEY_bio(BIO *bp, const X509_PUBKEY *xpk); |
| 964 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, |
| 965 | PKCS8_PRIV_KEY_INFO **p8inf); |
| 966 | int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, const PKCS8_PRIV_KEY_INFO *p8inf); |
| 967 | int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, const EVP_PKEY *key); |
| 968 | int i2d_PrivateKey_bio(BIO *bp, const EVP_PKEY *pkey); |
| 969 | EVP_PKEY *d2i_PrivateKey_ex_bio(BIO *bp, EVP_PKEY **a, OSSL_LIB_CTX *libctx, |
| 970 | const char *propq); |
| 971 | EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); |
| 972 | int i2d_PUBKEY_bio(BIO *bp, const EVP_PKEY *pkey); |
| 973 | EVP_PKEY *d2i_PUBKEY_ex_bio(BIO *bp, EVP_PKEY **a, OSSL_LIB_CTX *libctx, |
| 974 | const char *propq); |
| 975 | EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); |
| 976 | |
| 977 | DECLARE_ASN1_DUP_FUNCTION(X509) |
| 978 | DECLARE_ASN1_DUP_FUNCTION(X509_ALGOR) |
| 979 | DECLARE_ASN1_DUP_FUNCTION(X509_ATTRIBUTE) |
| 980 | DECLARE_ASN1_DUP_FUNCTION(X509_CRL) |
| 981 | DECLARE_ASN1_DUP_FUNCTION(X509_EXTENSION) |
| 982 | DECLARE_ASN1_DUP_FUNCTION(X509_PUBKEY) |
| 983 | DECLARE_ASN1_DUP_FUNCTION(X509_REQ) |
| 984 | DECLARE_ASN1_DUP_FUNCTION(X509_REVOKED) |
| 985 | int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, |
| 986 | void *pval); |
| 987 | void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, |
| 988 | const void **ppval, const X509_ALGOR *algor); |
| 989 | int X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); |
| 990 | int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); |
| 991 | int X509_ALGOR_copy(X509_ALGOR *dest, const X509_ALGOR *src); |
| 992 | |
| 993 | DECLARE_ASN1_DUP_FUNCTION(X509_NAME) |
| 994 | DECLARE_ASN1_DUP_FUNCTION(X509_NAME_ENTRY) |
| 995 | |
| 996 | #ifndef OPENSSL_NO_DEPRECATED_4_0 |
| 997 | OSSL_DEPRECATEDIN_4_0 int X509_cmp_time(const ASN1_TIME *s, const time_t *t); |
| 998 | OSSL_DEPRECATEDIN_4_0 int X509_cmp_current_time(const ASN1_TIME *s); |
| 999 | OSSL_DEPRECATEDIN_4_0 int X509_cmp_timeframe(const X509_VERIFY_PARAM *vpm, |
| 1000 | const ASN1_TIME *start, |
| 1001 | const ASN1_TIME *end); |
| 1002 | #endif |
| 1003 | int X509_check_certificate_times(const X509_VERIFY_PARAM *vpm, const X509 *x, |
| 1004 | int *error); |
| 1005 | ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, const time_t *t); |
| 1006 | ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, |
| 1007 | int offset_day, long offset_sec, const time_t *t); |
| 1008 | ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); |
| 1009 | |
| 1010 | const char *X509_get_default_cert_area(void); |
| 1011 | const char *X509_get_default_cert_dir(void); |
| 1012 | const char *X509_get_default_cert_file(void); |
| 1013 | const char *X509_get_default_cert_dir_env(void); |
| 1014 | const char *X509_get_default_cert_file_env(void); |
| 1015 | const char *X509_get_default_private_dir(void); |
| 1016 | |
| 1017 | X509_REQ *X509_to_X509_REQ(const X509 *x, EVP_PKEY *pkey, const EVP_MD *md); |
| 1018 | X509 *X509_REQ_to_X509(const X509_REQ *r, int days, EVP_PKEY *pkey); |
| 1019 | |
| 1020 | DECLARE_ASN1_FUNCTIONS(X509_ALGOR) |
| 1021 | DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) |
| 1022 | DECLARE_ASN1_FUNCTIONS(X509_VAL) |
| 1023 | |
| 1024 | DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) |
| 1025 | |
| 1026 | X509_PUBKEY *X509_PUBKEY_new_ex(OSSL_LIB_CTX *libctx, const char *propq); |
| 1027 | int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); |
| 1028 | EVP_PKEY *X509_PUBKEY_get0(const X509_PUBKEY *key); |
| 1029 | EVP_PKEY *X509_PUBKEY_get(const X509_PUBKEY *key); |
| 1030 | int X509_get_pubkey_parameters(EVP_PKEY *pkey, const STACK_OF(X509) *chain); |
| 1031 | long X509_get_pathlen(const X509 *x); |
| 1032 | DECLARE_ASN1_ENCODE_FUNCTIONS_only(EVP_PKEY, PUBKEY) |
| 1033 | EVP_PKEY *d2i_PUBKEY_ex(EVP_PKEY **a, const unsigned char **pp, long length, |
| 1034 | OSSL_LIB_CTX *libctx, const char *propq); |
| 1035 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 1036 | DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, RSA, RSA_PUBKEY) |
| 1037 | #endif |
| 1038 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 1039 | #ifndef OPENSSL_NO_DSA |
| 1040 | DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, DSA, DSA_PUBKEY) |
| 1041 | #endif |
| 1042 | #endif |
| 1043 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 1044 | #ifndef OPENSSL_NO_EC |
| 1045 | DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, EC_KEY, EC_PUBKEY) |
| 1046 | #endif |
| 1047 | #endif |
| 1048 | |
| 1049 | DECLARE_ASN1_FUNCTIONS(X509_SIG) |
| 1050 | void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, |
| 1051 | const ASN1_OCTET_STRING **pdigest); |
| 1052 | void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, |
| 1053 | ASN1_OCTET_STRING **pdigest); |
| 1054 | |
| 1055 | DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) |
| 1056 | DECLARE_ASN1_FUNCTIONS(X509_REQ) |
| 1057 | X509_REQ *X509_REQ_new_ex(OSSL_LIB_CTX *libctx, const char *propq); |
| 1058 | |
| 1059 | DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) |
| 1060 | X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); |
| 1061 | |
| 1062 | DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) |
| 1063 | DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) |
| 1064 | |
| 1065 | DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) |
| 1066 | |
| 1067 | DECLARE_ASN1_FUNCTIONS(X509_NAME) |
| 1068 | |
| 1069 | int X509_NAME_set(X509_NAME **xn, const X509_NAME *name); |
| 1070 | |
| 1071 | DECLARE_ASN1_FUNCTIONS(X509_CINF) |
| 1072 | DECLARE_ASN1_FUNCTIONS(X509) |
| 1073 | X509 *X509_new_ex(OSSL_LIB_CTX *libctx, const char *propq); |
| 1074 | DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) |
| 1075 | |
| 1076 | #define X509_get_ex_new_index(l, p, newf, dupf, freef) \ |
| 1077 | CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef) |
| 1078 | int X509_set_ex_data(X509 *r, int idx, void *arg); |
| 1079 | void *X509_get_ex_data(const X509 *r, int idx); |
| 1080 | DECLARE_ASN1_ENCODE_FUNCTIONS_only(X509, X509_AUX) |
| 1081 | |
| 1082 | int i2d_re_X509_tbs(X509 *x, unsigned char **pp); |
| 1083 | |
| 1084 | int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid, |
| 1085 | int *secbits, uint32_t *flags); |
| 1086 | void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid, |
| 1087 | int secbits, uint32_t flags); |
| 1088 | |
| 1089 | int X509_get_signature_info(const X509 *x, int *mdnid, int *pknid, int *secbits, |
| 1090 | uint32_t *flags); |
| 1091 | |
| 1092 | void X509_get0_signature(const ASN1_BIT_STRING **psig, |
| 1093 | const X509_ALGOR **palg, const X509 *x); |
| 1094 | int X509_get_signature_nid(const X509 *x); |
| 1095 | |
| 1096 | void X509_set0_distinguishing_id(X509 *x, ASN1_OCTET_STRING *d_id); |
| 1097 | const ASN1_OCTET_STRING *X509_get0_distinguishing_id(const X509 *x); |
| 1098 | void X509_REQ_set0_distinguishing_id(X509_REQ *x, ASN1_OCTET_STRING *d_id); |
| 1099 | ASN1_OCTET_STRING *X509_REQ_get0_distinguishing_id(X509_REQ *x); |
| 1100 | |
| 1101 | int X509_alias_set1(X509 *x, const unsigned char *name, int len); |
| 1102 | int X509_keyid_set1(X509 *x, const unsigned char *id, int len); |
| 1103 | const unsigned char *X509_alias_get0(const X509 *x, int *len); |
| 1104 | const unsigned char *X509_keyid_get0(const X509 *x, int *len); |
| 1105 | |
| 1106 | DECLARE_ASN1_FUNCTIONS(X509_REVOKED) |
| 1107 | DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) |
| 1108 | DECLARE_ASN1_FUNCTIONS(X509_CRL) |
| 1109 | X509_CRL *X509_CRL_new_ex(OSSL_LIB_CTX *libctx, const char *propq); |
| 1110 | |
| 1111 | int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); |
| 1112 | int X509_CRL_get0_by_serial(X509_CRL *crl, |
| 1113 | X509_REVOKED **ret, const ASN1_INTEGER *serial); |
| 1114 | int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, const X509 *x); |
| 1115 | |
| 1116 | X509_PKEY *X509_PKEY_new(void); |
| 1117 | void X509_PKEY_free(X509_PKEY *a); |
| 1118 | |
| 1119 | DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) |
| 1120 | DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) |
| 1121 | DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) |
| 1122 | |
| 1123 | X509_INFO *X509_INFO_new(void); |
| 1124 | void X509_INFO_free(X509_INFO *a); |
| 1125 | char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size); |
| 1126 | |
| 1127 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 1128 | OSSL_DEPRECATEDIN_3_0 |
| 1129 | int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, |
| 1130 | ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey); |
| 1131 | OSSL_DEPRECATEDIN_3_0 |
| 1132 | int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, |
| 1133 | unsigned char *md, unsigned int *len); |
| 1134 | OSSL_DEPRECATEDIN_3_0 |
| 1135 | int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2, |
| 1136 | ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey, |
| 1137 | const EVP_MD *type); |
| 1138 | #endif |
| 1139 | int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data, |
| 1140 | unsigned char *md, unsigned int *len); |
| 1141 | int ASN1_item_verify(const ASN1_ITEM *it, const X509_ALGOR *alg, |
| 1142 | const ASN1_BIT_STRING *signature, const void *data, |
| 1143 | EVP_PKEY *pkey); |
| 1144 | int ASN1_item_verify_ctx(const ASN1_ITEM *it, const X509_ALGOR *alg, |
| 1145 | const ASN1_BIT_STRING *signature, const void *data, |
| 1146 | EVP_MD_CTX *ctx); |
| 1147 | int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, |
| 1148 | ASN1_BIT_STRING *signature, const void *data, |
| 1149 | EVP_PKEY *pkey, const EVP_MD *md); |
| 1150 | int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, |
| 1151 | X509_ALGOR *algor2, ASN1_BIT_STRING *signature, |
| 1152 | const void *data, EVP_MD_CTX *ctx); |
| 1153 | |
| 1154 | #define X509_VERSION_1 0 |
| 1155 | #define X509_VERSION_2 1 |
| 1156 | #define X509_VERSION_3 2 |
| 1157 | |
| 1158 | long X509_get_version(const X509 *x); |
| 1159 | int X509_set_version(X509 *x, long version); |
| 1160 | int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); |
| 1161 | ASN1_INTEGER *X509_get_serialNumber(X509 *x); |
| 1162 | const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x); |
| 1163 | int X509_set_issuer_name(X509 *x, const X509_NAME *name); |
| 1164 | const X509_NAME *X509_get_issuer_name(const X509 *a); |
| 1165 | int X509_set_subject_name(X509 *x, const X509_NAME *name); |
| 1166 | const X509_NAME *X509_get_subject_name(const X509 *a); |
| 1167 | const ASN1_TIME *X509_get0_notBefore(const X509 *x); |
| 1168 | ASN1_TIME *X509_getm_notBefore(X509 *x); |
| 1169 | int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm); |
| 1170 | const ASN1_TIME *X509_get0_notAfter(const X509 *x); |
| 1171 | ASN1_TIME *X509_getm_notAfter(X509 *x); |
| 1172 | int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm); |
| 1173 | int X509_up_ref(X509 *x); |
| 1174 | int X509_get_signature_type(const X509 *x); |
| 1175 | |
| 1176 | #ifndef OPENSSL_NO_DEPRECATED_1_1_0 |
| 1177 | #define X509_get_notBefore X509_getm_notBefore |
| 1178 | #define X509_get_notAfter X509_getm_notAfter |
| 1179 | #define X509_set_notBefore X509_set1_notBefore |
| 1180 | #define X509_set_notAfter X509_set1_notAfter |
| 1181 | #endif |
| 1182 | |
| 1183 | int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); |
| 1184 | EVP_PKEY *X509_get_pubkey(const X509 *x); /* deprecated */ |
| 1185 | EVP_PKEY *X509_get0_pubkey(const X509 *x); |
| 1186 | /* |
| 1187 | * This one is only used so that a binary form can output, as in |
| 1188 | * i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &buf) |
| 1189 | */ |
| 1190 | const X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x); |
| 1191 | const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x); |
| 1192 | void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid, |
| 1193 | const ASN1_BIT_STRING **psuid); |
| 1194 | const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x); |
| 1195 | |
| 1196 | const ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x); |
| 1197 | |
| 1198 | #define X509_REQ_VERSION_1 0 |
| 1199 | |
| 1200 | long X509_REQ_get_version(const X509_REQ *req); |
| 1201 | int X509_REQ_set_version(X509_REQ *x, long version); |
| 1202 | const X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req); |
| 1203 | int X509_REQ_set_subject_name(X509_REQ *req, const X509_NAME *name); |
| 1204 | void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, |
| 1205 | const X509_ALGOR **palg); |
| 1206 | void X509_REQ_set0_signature(X509_REQ *req, ASN1_BIT_STRING *psig); |
| 1207 | int X509_REQ_set1_signature_algo(X509_REQ *req, X509_ALGOR *palg); |
| 1208 | int X509_REQ_get_signature_nid(const X509_REQ *req); |
| 1209 | int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp); |
| 1210 | int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); |
| 1211 | EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req); /* deprecated */ |
| 1212 | EVP_PKEY *X509_REQ_get0_pubkey(const X509_REQ *req); |
| 1213 | X509_PUBKEY *X509_REQ_get_X509_PUBKEY(const X509_REQ *req); |
| 1214 | int X509_REQ_extension_nid(int nid); |
| 1215 | int *X509_REQ_get_extension_nids(void); |
| 1216 | void X509_REQ_set_extension_nids(int *nids); |
| 1217 | STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(const X509_REQ *req); |
| 1218 | int X509_REQ_add_extensions_nid(X509_REQ *req, |
| 1219 | const STACK_OF(X509_EXTENSION) *exts, int nid); |
| 1220 | int X509_REQ_add_extensions(X509_REQ *req, const STACK_OF(X509_EXTENSION) *ext); |
| 1221 | int X509_REQ_get_attr_count(const X509_REQ *req); |
| 1222 | int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos); |
| 1223 | int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj, |
| 1224 | int lastpos); |
| 1225 | X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); |
| 1226 | X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); |
| 1227 | int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); |
| 1228 | int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, |
| 1229 | const ASN1_OBJECT *obj, int type, |
| 1230 | const unsigned char *bytes, int len); |
| 1231 | int X509_REQ_add1_attr_by_NID(X509_REQ *req, |
| 1232 | int nid, int type, |
| 1233 | const unsigned char *bytes, int len); |
| 1234 | int X509_REQ_add1_attr_by_txt(X509_REQ *req, |
| 1235 | const char *attrname, int type, |
| 1236 | const unsigned char *bytes, int len); |
| 1237 | |
| 1238 | #define X509_CRL_VERSION_1 0 |
| 1239 | #define X509_CRL_VERSION_2 1 |
| 1240 | |
| 1241 | int X509_CRL_set_version(X509_CRL *x, long version); |
| 1242 | int X509_CRL_set_issuer_name(X509_CRL *x, const X509_NAME *name); |
| 1243 | int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); |
| 1244 | int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); |
| 1245 | int X509_CRL_sort(X509_CRL *crl); |
| 1246 | int X509_CRL_up_ref(X509_CRL *crl); |
| 1247 | |
| 1248 | #ifndef OPENSSL_NO_DEPRECATED_1_1_0 |
| 1249 | #define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate |
| 1250 | #define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate |
| 1251 | #endif |
| 1252 | |
| 1253 | long X509_CRL_get_version(const X509_CRL *crl); |
| 1254 | const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); |
| 1255 | const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); |
| 1256 | #ifndef OPENSSL_NO_DEPRECATED_1_1_0 |
| 1257 | OSSL_DEPRECATEDIN_1_1_0 ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl); |
| 1258 | OSSL_DEPRECATEDIN_1_1_0 ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl); |
| 1259 | #endif |
| 1260 | const X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl); |
| 1261 | const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); |
| 1262 | STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(const X509_CRL *crl); |
| 1263 | const X509_ALGOR *X509_CRL_get0_tbs_sigalg(const X509_CRL *crl); |
| 1264 | void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, |
| 1265 | const X509_ALGOR **palg); |
| 1266 | int X509_CRL_get_signature_nid(const X509_CRL *crl); |
| 1267 | int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp); |
| 1268 | |
| 1269 | const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); |
| 1270 | int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); |
| 1271 | const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x); |
| 1272 | int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); |
| 1273 | const STACK_OF(X509_EXTENSION) * |
| 1274 | X509_REVOKED_get0_extensions(const X509_REVOKED *r); |
| 1275 | |
| 1276 | X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, |
| 1277 | EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); |
| 1278 | |
| 1279 | int X509_REQ_check_private_key(const X509_REQ *req, EVP_PKEY *pkey); |
| 1280 | |
| 1281 | int X509_check_private_key(const X509 *cert, const EVP_PKEY *pkey); |
| 1282 | int X509_chain_check_suiteb(int *perror_depth, |
| 1283 | const X509 *x, STACK_OF(X509) *chain, |
| 1284 | unsigned long flags); |
| 1285 | int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags); |
| 1286 | void OSSL_STACK_OF_X509_free(STACK_OF(X509) *certs); |
| 1287 | STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); |
| 1288 | |
| 1289 | int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); |
| 1290 | unsigned long X509_issuer_and_serial_hash(const X509 *a); |
| 1291 | |
| 1292 | int X509_issuer_name_cmp(const X509 *a, const X509 *b); |
| 1293 | unsigned long X509_issuer_name_hash(const X509 *a); |
| 1294 | |
| 1295 | int X509_subject_name_cmp(const X509 *a, const X509 *b); |
| 1296 | unsigned long X509_subject_name_hash(const X509 *x); |
| 1297 | |
| 1298 | #ifndef OPENSSL_NO_MD5 |
| 1299 | unsigned long X509_issuer_name_hash_old(const X509 *a); |
| 1300 | unsigned long X509_subject_name_hash_old(const X509 *x); |
| 1301 | #endif |
| 1302 | |
| 1303 | #define X509_ADD_FLAG_DEFAULT 0 |
| 1304 | #define X509_ADD_FLAG_UP_REF 0x1 |
| 1305 | #define X509_ADD_FLAG_PREPEND 0x2 |
| 1306 | #define X509_ADD_FLAG_NO_DUP 0x4 |
| 1307 | #define X509_ADD_FLAG_NO_SS 0x8 |
| 1308 | int X509_add_cert(STACK_OF(X509) *sk, const X509 *cert, int flags); |
| 1309 | int X509_add_certs(STACK_OF(X509) *sk, const STACK_OF(X509) *certs, int flags); |
| 1310 | |
| 1311 | int X509_cmp(const X509 *a, const X509 *b); |
| 1312 | int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); |
| 1313 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 1314 | #define X509_NAME_hash(x) X509_NAME_hash_ex(x, NULL, NULL, NULL) |
| 1315 | OSSL_DEPRECATEDIN_3_0 int X509_certificate_type(const X509 *x, |
| 1316 | const EVP_PKEY *pubkey); |
| 1317 | #endif |
| 1318 | unsigned long X509_NAME_hash_ex(const X509_NAME *x, OSSL_LIB_CTX *libctx, |
| 1319 | const char *propq, int *ok); |
| 1320 | unsigned long X509_NAME_hash_old(const X509_NAME *x); |
| 1321 | |
| 1322 | int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); |
| 1323 | int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); |
| 1324 | int X509_aux_print(BIO *out, const X509 *x, int indent); |
| 1325 | #ifndef OPENSSL_NO_STDIO |
| 1326 | int X509_print_ex_fp(FILE *bp, const X509 *x, unsigned long nmflag, unsigned long cflag); |
| 1327 | int X509_print_fp(FILE *bp, const X509 *x); |
| 1328 | int X509_CRL_print_fp(FILE *bp, X509_CRL *x); |
| 1329 | int X509_REQ_print_fp(FILE *bp, const X509_REQ *req); |
| 1330 | int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, unsigned long flags); |
| 1331 | #endif |
| 1332 | |
| 1333 | int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase); |
| 1334 | int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, unsigned long flags); |
| 1335 | int X509_print_ex(BIO *bp, const X509 *x, unsigned long nmflag, unsigned long cflag); |
| 1336 | int X509_print(BIO *bp, const X509 *x); |
| 1337 | int X509_ocspid_print(BIO *bp, const X509 *x); |
| 1338 | int X509_CRL_print_ex(BIO *out, const X509_CRL *x, unsigned long nmflag); |
| 1339 | int X509_CRL_print(BIO *bp, const X509_CRL *x); |
| 1340 | int X509_REQ_print_ex(BIO *bp, const X509_REQ *x, unsigned long nmflag, unsigned long cflag); |
| 1341 | int X509_REQ_print(BIO *bp, const X509_REQ *req); |
| 1342 | |
| 1343 | int X509_NAME_entry_count(const X509_NAME *name); |
| 1344 | #if !defined(OPENSSL_NO_DEPRECATED_4_0) |
| 1345 | OSSL_DEPRECATEDIN_4_0 int X509_NAME_get_text_by_NID(const X509_NAME *name, |
| 1346 | int nid, char *buf, int len); |
| 1347 | OSSL_DEPRECATEDIN_4_0 int X509_NAME_get_text_by_OBJ(const X509_NAME *name, |
| 1348 | const ASN1_OBJECT *obj, char *buf, int len); |
| 1349 | #endif /* !defined(OPENSSL_NO_DEPRECATED_4_0) */ |
| 1350 | |
| 1351 | /* |
| 1352 | * NOTE: you should be passing -1, not 0 as lastpos. The functions that use |
| 1353 | * lastpos, search after that position on. |
| 1354 | */ |
| 1355 | int X509_NAME_get_index_by_NID(const X509_NAME *name, int nid, int lastpos); |
| 1356 | int X509_NAME_get_index_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj, |
| 1357 | int lastpos); |
| 1358 | const X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc); |
| 1359 | X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); |
| 1360 | int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, |
| 1361 | int loc, int set); |
| 1362 | int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type, |
| 1363 | const unsigned char *bytes, int len, int loc, |
| 1364 | int set); |
| 1365 | int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, |
| 1366 | const unsigned char *bytes, int len, int loc, |
| 1367 | int set); |
| 1368 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, |
| 1369 | const char *field, int type, |
| 1370 | const unsigned char *bytes, |
| 1371 | int len); |
| 1372 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, |
| 1373 | int type, |
| 1374 | const unsigned char *bytes, |
| 1375 | int len); |
| 1376 | int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, |
| 1377 | const unsigned char *bytes, int len, int loc, |
| 1378 | int set); |
| 1379 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, |
| 1380 | const ASN1_OBJECT *obj, int type, |
| 1381 | const unsigned char *bytes, |
| 1382 | int len); |
| 1383 | int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj); |
| 1384 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, |
| 1385 | const unsigned char *bytes, int len); |
| 1386 | const ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne); |
| 1387 | const ASN1_STRING *X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne); |
| 1388 | int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne); |
| 1389 | |
| 1390 | int X509_NAME_get0_der(const X509_NAME *nm, const unsigned char **pder, |
| 1391 | size_t *pderlen); |
| 1392 | |
| 1393 | int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); |
| 1394 | int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, |
| 1395 | int nid, int lastpos); |
| 1396 | int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, |
| 1397 | const ASN1_OBJECT *obj, int lastpos); |
| 1398 | int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, |
| 1399 | int crit, int lastpos); |
| 1400 | const X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); |
| 1401 | X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); |
| 1402 | X509_EXTENSION *X509v3_delete_extension(STACK_OF(X509_EXTENSION) **x, int loc); |
| 1403 | STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, |
| 1404 | const X509_EXTENSION *ex, int loc); |
| 1405 | STACK_OF(X509_EXTENSION) *X509v3_add_extensions(STACK_OF(X509_EXTENSION) **target, |
| 1406 | const STACK_OF(X509_EXTENSION) *exts); |
| 1407 | |
| 1408 | int X509_get_ext_count(const X509 *x); |
| 1409 | int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos); |
| 1410 | int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos); |
| 1411 | int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos); |
| 1412 | const X509_EXTENSION *X509_get_ext(const X509 *x, int loc); |
| 1413 | X509_EXTENSION *X509_delete_ext(X509 *x, int loc); |
| 1414 | int X509_add_ext(X509 *x, const X509_EXTENSION *ex, int loc); |
| 1415 | void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx); |
| 1416 | int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, |
| 1417 | unsigned long flags); |
| 1418 | |
| 1419 | int X509_CRL_get_ext_count(const X509_CRL *x); |
| 1420 | int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos); |
| 1421 | int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, |
| 1422 | int lastpos); |
| 1423 | int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos); |
| 1424 | const X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc); |
| 1425 | X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); |
| 1426 | int X509_CRL_add_ext(X509_CRL *x, const X509_EXTENSION *ex, int loc); |
| 1427 | void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx); |
| 1428 | int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, |
| 1429 | unsigned long flags); |
| 1430 | |
| 1431 | int X509_REVOKED_get_ext_count(const X509_REVOKED *x); |
| 1432 | int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos); |
| 1433 | int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj, |
| 1434 | int lastpos); |
| 1435 | int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, |
| 1436 | int lastpos); |
| 1437 | const X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc); |
| 1438 | X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); |
| 1439 | int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); |
| 1440 | void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, |
| 1441 | int *idx); |
| 1442 | int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, |
| 1443 | unsigned long flags); |
| 1444 | |
| 1445 | X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, |
| 1446 | int nid, int crit, |
| 1447 | ASN1_OCTET_STRING *data); |
| 1448 | X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, |
| 1449 | const ASN1_OBJECT *obj, int crit, |
| 1450 | ASN1_OCTET_STRING *data); |
| 1451 | int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj); |
| 1452 | int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); |
| 1453 | int X509_EXTENSION_set_data(X509_EXTENSION *ex, const ASN1_OCTET_STRING *data); |
| 1454 | const ASN1_OBJECT *X509_EXTENSION_get_object(const X509_EXTENSION *ex); |
| 1455 | const ASN1_OCTET_STRING *X509_EXTENSION_get_data(const X509_EXTENSION *ne); |
| 1456 | int X509_EXTENSION_get_critical(const X509_EXTENSION *ex); |
| 1457 | |
| 1458 | int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); |
| 1459 | int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, |
| 1460 | int lastpos); |
| 1461 | int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, |
| 1462 | const ASN1_OBJECT *obj, int lastpos); |
| 1463 | X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); |
| 1464 | X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); |
| 1465 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, |
| 1466 | X509_ATTRIBUTE *attr); |
| 1467 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) |
| 1468 | **x, |
| 1469 | const ASN1_OBJECT *obj, |
| 1470 | int type, |
| 1471 | const unsigned char *bytes, |
| 1472 | int len); |
| 1473 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) |
| 1474 | **x, |
| 1475 | int nid, int type, |
| 1476 | const unsigned char *bytes, |
| 1477 | int len); |
| 1478 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) |
| 1479 | **x, |
| 1480 | const char *attrname, |
| 1481 | int type, |
| 1482 | const unsigned char *bytes, |
| 1483 | int len); |
| 1484 | const void *X509at_get0_data_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *x, |
| 1485 | const ASN1_OBJECT *obj, int lastpos, int type); |
| 1486 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, |
| 1487 | int atrtype, const void *data, |
| 1488 | int len); |
| 1489 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, |
| 1490 | const ASN1_OBJECT *obj, |
| 1491 | int atrtype, const void *data, |
| 1492 | int len); |
| 1493 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, |
| 1494 | const char *atrname, int type, |
| 1495 | const unsigned char *bytes, |
| 1496 | int len); |
| 1497 | int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); |
| 1498 | int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, |
| 1499 | const void *data, int len); |
| 1500 | const void *X509_ATTRIBUTE_get0_data(const X509_ATTRIBUTE *attr, int idx, |
| 1501 | int atrtype, void *data); |
| 1502 | int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr); |
| 1503 | const ASN1_OBJECT *X509_ATTRIBUTE_get0_object(const X509_ATTRIBUTE *attr); |
| 1504 | const ASN1_TYPE *X509_ATTRIBUTE_get0_type(const X509_ATTRIBUTE *attr, int idx); |
| 1505 | |
| 1506 | int EVP_PKEY_get_attr_count(const EVP_PKEY *key); |
| 1507 | int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos); |
| 1508 | int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, |
| 1509 | int lastpos); |
| 1510 | X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); |
| 1511 | X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); |
| 1512 | int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); |
| 1513 | int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, |
| 1514 | const ASN1_OBJECT *obj, int type, |
| 1515 | const unsigned char *bytes, int len); |
| 1516 | int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, |
| 1517 | int nid, int type, |
| 1518 | const unsigned char *bytes, int len); |
| 1519 | int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, |
| 1520 | const char *attrname, int type, |
| 1521 | const unsigned char *bytes, int len); |
| 1522 | |
| 1523 | /* lookup a cert from a X509 STACK */ |
| 1524 | X509 *X509_find_by_issuer_and_serial(const STACK_OF(X509) *sk, const X509_NAME *name, |
| 1525 | const ASN1_INTEGER *serial); |
| 1526 | X509 *X509_find_by_subject(const STACK_OF(X509) *sk, const X509_NAME *name); |
| 1527 | |
| 1528 | DECLARE_ASN1_FUNCTIONS(PBEPARAM) |
| 1529 | DECLARE_ASN1_FUNCTIONS(PBE2PARAM) |
| 1530 | DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) |
| 1531 | DECLARE_ASN1_FUNCTIONS(PBMAC1PARAM) |
| 1532 | #ifndef OPENSSL_NO_SCRYPT |
| 1533 | DECLARE_ASN1_FUNCTIONS(SCRYPT_PARAMS) |
| 1534 | #endif |
| 1535 | |
| 1536 | int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, |
| 1537 | const unsigned char *salt, int saltlen); |
| 1538 | int PKCS5_pbe_set0_algor_ex(X509_ALGOR *algor, int alg, int iter, |
| 1539 | const unsigned char *salt, int saltlen, |
| 1540 | OSSL_LIB_CTX *libctx); |
| 1541 | |
| 1542 | X509_ALGOR *PKCS5_pbe_set(int alg, int iter, |
| 1543 | const unsigned char *salt, int saltlen); |
| 1544 | X509_ALGOR *PKCS5_pbe_set_ex(int alg, int iter, |
| 1545 | const unsigned char *salt, int saltlen, |
| 1546 | OSSL_LIB_CTX *libctx); |
| 1547 | |
| 1548 | X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, |
| 1549 | unsigned char *salt, int saltlen); |
| 1550 | X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, |
| 1551 | unsigned char *salt, int saltlen, |
| 1552 | unsigned char *aiv, int prf_nid); |
| 1553 | X509_ALGOR *PKCS5_pbe2_set_iv_ex(const EVP_CIPHER *cipher, int iter, |
| 1554 | unsigned char *salt, int saltlen, |
| 1555 | unsigned char *aiv, int prf_nid, |
| 1556 | OSSL_LIB_CTX *libctx); |
| 1557 | |
| 1558 | #ifndef OPENSSL_NO_SCRYPT |
| 1559 | X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, |
| 1560 | const unsigned char *salt, int saltlen, |
| 1561 | unsigned char *aiv, uint64_t N, uint64_t r, |
| 1562 | uint64_t p); |
| 1563 | #endif |
| 1564 | |
| 1565 | X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, |
| 1566 | int prf_nid, int keylen); |
| 1567 | X509_ALGOR *PKCS5_pbkdf2_set_ex(int iter, unsigned char *salt, int saltlen, |
| 1568 | int prf_nid, int keylen, |
| 1569 | OSSL_LIB_CTX *libctx); |
| 1570 | |
| 1571 | PBKDF2PARAM *PBMAC1_get1_pbkdf2_param(const X509_ALGOR *macalg); |
| 1572 | /* PKCS#8 utilities */ |
| 1573 | |
| 1574 | DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) |
| 1575 | |
| 1576 | EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8); |
| 1577 | EVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OSSL_LIB_CTX *libctx, |
| 1578 | const char *propq); |
| 1579 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(const EVP_PKEY *pkey); |
| 1580 | |
| 1581 | int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, |
| 1582 | int version, int ptype, void *pval, |
| 1583 | unsigned char *penc, int penclen); |
| 1584 | int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, |
| 1585 | const unsigned char **pk, int *ppklen, |
| 1586 | const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8); |
| 1587 | |
| 1588 | const STACK_OF(X509_ATTRIBUTE) * |
| 1589 | PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8); |
| 1590 | int PKCS8_pkey_add1_attr(PKCS8_PRIV_KEY_INFO *p8, X509_ATTRIBUTE *attr); |
| 1591 | int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, |
| 1592 | const unsigned char *bytes, int len); |
| 1593 | int PKCS8_pkey_add1_attr_by_OBJ(PKCS8_PRIV_KEY_INFO *p8, const ASN1_OBJECT *obj, |
| 1594 | int type, const unsigned char *bytes, int len); |
| 1595 | |
| 1596 | void X509_PUBKEY_set0_public_key(X509_PUBKEY *pub, |
| 1597 | unsigned char *penc, int penclen); |
| 1598 | int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, |
| 1599 | int ptype, void *pval, |
| 1600 | unsigned char *penc, int penclen); |
| 1601 | int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, |
| 1602 | const unsigned char **pk, int *ppklen, |
| 1603 | X509_ALGOR **pa, const X509_PUBKEY *pub); |
| 1604 | int X509_PUBKEY_eq(const X509_PUBKEY *a, const X509_PUBKEY *b); |
| 1605 | |
| 1606 | #ifdef __cplusplus |
| 1607 | } |
| 1608 | #endif |
| 1609 | #endif |
| 1610 | |