/openbsd/usr.bin/dig/lib/isc/ |
H A D | hmacsha.c | 44 if (ctx->ctx == NULL) in isc_hmacsha1_invalidate() 47 ctx->ctx = NULL; in isc_hmacsha1_invalidate() 65 ctx->ctx = NULL; in isc_hmacsha1_sign() 85 ctx->ctx = NULL; in isc_hmacsha224_invalidate() 103 ctx->ctx = NULL; in isc_hmacsha224_sign() 123 ctx->ctx = NULL; in isc_hmacsha256_invalidate() 141 ctx->ctx = NULL; in isc_hmacsha256_sign() 161 ctx->ctx = NULL; in isc_hmacsha384_invalidate() 179 ctx->ctx = NULL; in isc_hmacsha384_sign() 199 ctx->ctx = NULL; in isc_hmacsha512_invalidate() [all …]
|
/openbsd/lib/libcrypto/evp/ |
H A D | bio_b64.c | 178 OPENSSL_assert(ctx->buf_len >= ctx->buf_off); in b64_read() 179 i = ctx->buf_len - ctx->buf_off; in b64_read() 183 memcpy(out, &(ctx->buf[ctx->buf_off]), i); in b64_read() 188 if (ctx->buf_len == ctx->buf_off) { in b64_read() 313 memmove(ctx->tmp, &ctx->tmp[jj], i - jj); in b64_read() 342 if (ctx->buf_off == ctx->buf_len) { in b64_read() 376 n = ctx->buf_len - ctx->buf_off; in b64_write() 406 memcpy(&(ctx->tmp[ctx->tmp_len]), in, n); in b64_write() 492 ret = ctx->buf_len - ctx->buf_off; in b64_ctrl() 501 ret = ctx->buf_len - ctx->buf_off; in b64_ctrl() [all …]
|
H A D | pmeth_fn.c | 89 if (!ctx || !ctx->pmeth || !ctx->pmeth->sign) { in EVP_PKEY_sign_init() 96 ret = ctx->pmeth->sign_init(ctx); in EVP_PKEY_sign_init() 107 if (!ctx || !ctx->pmeth || !ctx->pmeth->sign) { in EVP_PKEY_sign() 125 if (!ctx || !ctx->pmeth || !ctx->pmeth->verify) { in EVP_PKEY_verify_init() 143 if (!ctx || !ctx->pmeth || !ctx->pmeth->verify) { in EVP_PKEY_verify() 174 if (!ctx || !ctx->pmeth || !ctx->pmeth->verify_recover) { in EVP_PKEY_verify_recover() 205 if (!ctx || !ctx->pmeth || !ctx->pmeth->encrypt) { in EVP_PKEY_encrypt() 236 if (!ctx || !ctx->pmeth || !ctx->pmeth->decrypt) { in EVP_PKEY_decrypt() 254 if (!ctx || !ctx->pmeth || !ctx->pmeth->derive) { in EVP_PKEY_derive_init() 273 if (!ctx || !ctx->pmeth || !(ctx->pmeth->derive || in EVP_PKEY_derive_set_peer() [all …]
|
H A D | evp_cipher.c | 162 ctx->cipher_data = calloc(1, ctx->cipher->ctx_size); in EVP_CipherInit_ex() 215 memcpy(ctx->iv, ctx->oiv, iv_len); in EVP_CipherInit_ex() 237 if (!ctx->cipher->init(ctx, key, iv, enc)) in EVP_CipherInit_ex() 311 return ctx->cipher->do_cipher(ctx, out, in, in_len); in EVP_Cipher() 334 if (!ctx->cipher->do_cipher(ctx, out, in, in_len)) in evp_cipher() 629 free(ctx); in EVP_CIPHER_CTX_free() 636 memset(ctx, 0, sizeof(*ctx)); in EVP_CIPHER_CTX_legacy_clear() 662 ctx->cipher->cleanup(ctx); in EVP_CIPHER_CTX_cleanup() 691 ret = ctx->cipher->ctrl(ctx, type, arg, ptr); in EVP_CIPHER_CTX_ctrl() 967 memcpy(ctx->iv, ctx->oiv, iv_len); in EVP_CIPHER_get_asn1_iv() [all …]
|
H A D | evp_digest.c | 137 if (ctx->digest && ctx->digest->ctx_size && ctx->md_data && in EVP_DigestInit_ex() 163 return ctx->digest->init(ctx); in EVP_DigestInit_ex() 170 return ctx->update(ctx, data, count); in EVP_DigestUpdate() 196 ret = ctx->digest->final(ctx, md); in EVP_DigestFinal_ex() 200 ctx->digest->cleanup(ctx); in EVP_DigestFinal_ex() 203 memset(ctx->md_data, 0, ctx->digest->ctx_size); in EVP_DigestFinal_ex() 262 memset(ctx, 0, sizeof(*ctx)); in EVP_MD_CTX_legacy_clear() 289 if (ctx->digest && ctx->digest->cleanup && in EVP_MD_CTX_cleanup() 291 ctx->digest->cleanup(ctx); in EVP_MD_CTX_cleanup() 292 if (ctx->digest && ctx->digest->ctx_size && ctx->md_data && in EVP_MD_CTX_cleanup() [all …]
|
H A D | bio_enc.c | 119 freezero(ctx, sizeof(*ctx)); in bio_enc_ctx_free() 137 ctx = NULL; in enc_new() 174 i = ctx->buf_len - ctx->buf_off; in enc_read() 177 memcpy(out, &(ctx->buf[ctx->buf_off]), i); in enc_read() 182 if (ctx->buf_len == ctx->buf_off) { in enc_read() 215 (unsigned char *)ctx->buf, &ctx->buf_len, in enc_read() 256 n = ctx->buf_len - ctx->buf_off; in enc_write() 275 (unsigned char *)ctx->buf, &ctx->buf_len, in enc_write() 325 ret = ctx->buf_len - ctx->buf_off; in enc_ctrl() 330 ret = ctx->buf_len - ctx->buf_off; in enc_ctrl() [all …]
|
/openbsd/sys/crypto/ |
H A D | hmac.c | 39 MD5Init(&ctx->ctx); in HMAC_MD5_Init() 41 MD5Final(ctx->key, &ctx->ctx); in HMAC_MD5_Init() 53 MD5Init(&ctx->ctx); in HMAC_MD5_Init() 78 MD5Init(&ctx->ctx); in HMAC_MD5_Final() 93 SHA1Init(&ctx->ctx); in HMAC_SHA1_Init() 95 SHA1Final(ctx->key, &ctx->ctx); in HMAC_SHA1_Init() 107 SHA1Init(&ctx->ctx); in HMAC_SHA1_Init() 132 SHA1Init(&ctx->ctx); in HMAC_SHA1_Final() 149 SHA256Final(ctx->key, &ctx->ctx); in HMAC_SHA256_Init() 161 SHA256Init(&ctx->ctx); in HMAC_SHA256_Init() [all …]
|
H A D | siphash.c | 126 ctx->buf[7] = ctx->bytes; in SipHash_End() 132 r = (ctx->v[0] ^ ctx->v[1]) ^ (ctx->v[2] ^ ctx->v[3]); in SipHash_End() 133 explicit_bzero(ctx, sizeof(*ctx)); in SipHash_End() 153 ctx->v[0] += ctx->v[1]; in SipHash_Rounds() 154 ctx->v[2] += ctx->v[3]; in SipHash_Rounds() 158 ctx->v[1] ^= ctx->v[0]; in SipHash_Rounds() 159 ctx->v[3] ^= ctx->v[2]; in SipHash_Rounds() 162 ctx->v[2] += ctx->v[1]; in SipHash_Rounds() 163 ctx->v[0] += ctx->v[3]; in SipHash_Rounds() 167 ctx->v[1] ^= ctx->v[2]; in SipHash_Rounds() [all …]
|
H A D | arc4.c | 25 ctx->state[x] = ctx->state[y]; \ 43 ctx->x = ctx->y = 0; in rc4_keysetup() 53 ctx->x = (ctx->x + 1) & (RC4STATE - 1); in rc4_crypt() 54 ctx->y = (ctx->state[ctx->x] + ctx->y) & (RC4STATE - 1); in rc4_crypt() 55 RC4SWAP(ctx->x, ctx->y); in rc4_crypt() 57 (ctx->state[ctx->x] + ctx->state[ctx->y]) & (RC4STATE - 1)]; in rc4_crypt() 68 ctx->y = (ctx->state[ctx->x] + ctx->y) & (RC4STATE - 1); in rc4_getbytes() 69 RC4SWAP(ctx->x, ctx->y); in rc4_getbytes() 71 (ctx->state[ctx->x] + ctx->state[ctx->y]) & (RC4STATE - 1)]; in rc4_getbytes() 80 ctx->y = (ctx->state[ctx->x] + ctx->y) & (RC4STATE - 1); in rc4_skip() [all …]
|
/openbsd/usr.sbin/unbound/libunbound/ |
H A D | libunbound.c | 109 ctx = (struct ub_ctx*)calloc(1, sizeof(*ctx)); in ub_ctx_create_nopipe() 110 if(!ctx) { in ub_ctx_create_nopipe() 170 ctx->env->alloc = &ctx->superalloc; in ub_ctx_create_nopipe() 182 if(!ctx) in ub_ctx_create() 188 modstack_desetup(&ctx->mods, ctx->env); in ub_ctx_create() 202 modstack_desetup(&ctx->mods, ctx->env); in ub_ctx_create() 218 if(!ctx) in ub_ctx_create_ub_event() 232 if(!ctx) in ub_ctx_create_event() 341 if(ctx->created_bg && ctx->pipe_pid != getpid() && ctx->thread_worker) { in ub_ctx_delete() 360 modstack_desetup(&ctx->mods, ctx->env); in ub_ctx_delete() [all …]
|
/openbsd/sbin/unwind/libunbound/libunbound/ |
H A D | libunbound.c | 109 ctx = (struct ub_ctx*)calloc(1, sizeof(*ctx)); in ub_ctx_create_nopipe() 110 if(!ctx) { in ub_ctx_create_nopipe() 170 ctx->env->alloc = &ctx->superalloc; in ub_ctx_create_nopipe() 182 if(!ctx) in ub_ctx_create() 188 modstack_desetup(&ctx->mods, ctx->env); in ub_ctx_create() 202 modstack_desetup(&ctx->mods, ctx->env); in ub_ctx_create() 218 if(!ctx) in ub_ctx_create_ub_event() 232 if(!ctx) in ub_ctx_create_event() 341 if(ctx->created_bg && ctx->pipe_pid != getpid() && ctx->thread_worker) { in ub_ctx_delete() 360 modstack_desetup(&ctx->mods, ctx->env); in ub_ctx_delete() [all …]
|
/openbsd/lib/libcrypto/x509/ |
H A D | x509_verify.c | 349 ctx->saved_error = ctx->xsc->error; in x509_verify_ctx_save_xsc_error() 369 ctx->xsc->error = ctx->saved_error; in x509_verify_ctx_restore_xsc_error() 459 ctx->error_depth = ctx->xsc->error_depth; in x509_verify_ctx_validate_legacy_chain() 478 if (ctx->chains_count >= ctx->max_chains) in x509_verify_ctx_add_chain() 641 return ctx->xsc->verify_cb(ok, ctx->xsc); in x509_verify_cert_error() 676 ctx->error = ctx->saved_error; in x509_verify_build_chains() 678 ctx->error_depth = ctx->saved_error_depth; in x509_verify_build_chains() 759 ctx->error = ctx->xsc->error; in x509_verify_cert_hostname() 1262 ctx->xsc->error = ctx->error; in x509_verify() 1269 return ctx->xsc->verify_cb(0, ctx->xsc); in x509_verify() [all …]
|
H A D | x509_vfy.c | 170 ctx->current_cert = ctx->cert; in check_id_error() 172 return ctx->verify_cb(0, ctx); in check_id_error() 244 if (ctx->chain == NULL || !sk_X509_push(ctx->chain, ctx->cert)) { in X509_verify_cert_legacy_build_chain() 564 ok = ctx->verify(ctx); in X509_verify_cert_legacy() 813 if (!ctx->verify_cb(0, ctx)) in check_name_constraints() 955 ok = ctx->verify_cb(0, ctx); in check_cert() 990 ok = ctx->verify_cb(0, ctx); in check_cert() 1024 if (!ctx->verify_cb(0, ctx)) in check_crl_time() 1032 if (!ctx->verify_cb(0, ctx)) in check_crl_time() 1672 ok = ctx->verify_cb(0, ctx); in x509_vfy_cert_crl() [all …]
|
/openbsd/lib/libc/hash/ |
H A D | siphash.c | 129 ctx->buf[7] = ctx->bytes; in SipHash_End() 135 r = (ctx->v[0] ^ ctx->v[1]) ^ (ctx->v[2] ^ ctx->v[3]); in SipHash_End() 136 explicit_bzero(ctx, sizeof(*ctx)); in SipHash_End() 158 ctx->v[0] += ctx->v[1]; in SipHash_Rounds() 159 ctx->v[2] += ctx->v[3]; in SipHash_Rounds() 163 ctx->v[1] ^= ctx->v[0]; in SipHash_Rounds() 164 ctx->v[3] ^= ctx->v[2]; in SipHash_Rounds() 167 ctx->v[2] += ctx->v[1]; in SipHash_Rounds() 168 ctx->v[0] += ctx->v[3]; in SipHash_Rounds() 172 ctx->v[1] ^= ctx->v[2]; in SipHash_Rounds() [all …]
|
/openbsd/lib/libcbor/src/cbor/internal/ |
H A D | builder_callbacks.c | 28 ctx->root = item; in _cbor_builder_append() 145 CHECK_RES(ctx, res); in cbor_builder_uint8_callback() 154 CHECK_RES(ctx, res); in cbor_builder_uint16_callback() 163 CHECK_RES(ctx, res); in cbor_builder_uint32_callback() 172 CHECK_RES(ctx, res); in cbor_builder_uint64_callback() 181 CHECK_RES(ctx, res); in cbor_builder_negint8_callback() 190 CHECK_RES(ctx, res); in cbor_builder_negint16_callback() 199 CHECK_RES(ctx, res); in cbor_builder_negint32_callback() 208 CHECK_RES(ctx, res); in cbor_builder_negint64_callback() 251 CHECK_RES(ctx, res); in cbor_builder_byte_string_start_callback() [all …]
|
/openbsd/lib/libcrypto/ts/ |
H A D | ts_rsp_sign.c | 159 TS_RESP_CTX *ctx; in TS_RESP_CTX_new() local 171 return ctx; in TS_RESP_CTX_new() 178 if (!ctx) in TS_RESP_CTX_free() 190 free(ctx); in TS_RESP_CTX_free() 284 if (!ctx->mds && !(ctx->mds = sk_EVP_MD_new_null())) in TS_RESP_CTX_add_md() 479 if (!(ctx->tst_info = TS_RESP_create_tst_info(ctx, policy))) in TS_RESP_create_response() 646 if (!(serial = (*ctx->serial_cb)(ctx, ctx->serial_cb_data)) || in TS_RESP_create_tst_info() 649 if (!(*ctx->time_cb)(ctx, ctx->time_cb_data, &sec, &usec) || in TS_RESP_create_tst_info() 655 if ((ctx->seconds || ctx->millis || ctx->micros) && in TS_RESP_create_tst_info() 727 ok = (*ctx->extension_cb)(ctx, ext, NULL); in TS_RESP_process_extensions() [all …]
|
/openbsd/lib/libcrypto/modes/ |
H A D | ccm128.c | 119 (*block)(ctx->nonce.c, ctx->cmac.c, ctx->key), in CRYPTO_ccm128_aad() 152 (*block)(ctx->cmac.c, ctx->cmac.c, ctx->key), in CRYPTO_ccm128_aad() 196 (*block)(ctx->nonce.c, ctx->cmac.c, key), in CRYPTO_ccm128_encrypt() 229 (*block)(ctx->cmac.c, ctx->cmac.c, key); in CRYPTO_ccm128_encrypt() 248 (*block)(ctx->cmac.c, ctx->cmac.c, key); in CRYPTO_ccm128_encrypt() 283 (*block)(ctx->nonce.c, ctx->cmac.c, key); in CRYPTO_ccm128_decrypt() 317 (*block)(ctx->cmac.c, ctx->cmac.c, key); in CRYPTO_ccm128_decrypt() 328 (*block)(ctx->cmac.c, ctx->cmac.c, key); in CRYPTO_ccm128_decrypt() 375 (*block)(ctx->nonce.c, ctx->cmac.c, key), in CRYPTO_ccm128_encrypt_ccm64() 407 (*block)(ctx->cmac.c, ctx->cmac.c, key); in CRYPTO_ccm128_encrypt_ccm64() [all …]
|
/openbsd/regress/usr.bin/ssh/unittests/hostkeys/ |
H A D | test_iterate.c | 879 memset(&ctx, 0, sizeof(ctx)); in test_iterate() 890 memset(&ctx, 0, sizeof(ctx)); in test_iterate() 901 memset(&ctx, 0, sizeof(ctx)); in test_iterate() 913 memset(&ctx, 0, sizeof(ctx)); in test_iterate() 925 memset(&ctx, 0, sizeof(ctx)); in test_iterate() 937 memset(&ctx, 0, sizeof(ctx)); in test_iterate() 949 memset(&ctx, 0, sizeof(ctx)); in test_iterate() 960 memset(&ctx, 0, sizeof(ctx)); in test_iterate() 971 memset(&ctx, 0, sizeof(ctx)); in test_iterate() 983 memset(&ctx, 0, sizeof(ctx)); in test_iterate() [all …]
|
/openbsd/regress/sys/kern/pipe/ |
H A D | test-kqueue.c | 76 n = write(ctx.c_pipe[1], &ctx.c_buf[0], 1); in test_kqueue_read() 128 n = write(ctx.c_pipe[1], ctx.c_buf, ctx.c_bufsiz); in test_kqueue_write() 169 ctx->c_alive = 1; in ctx_setup() 184 ctx->c_buf = malloc(ctx->c_bufsiz); in ctx_setup() 206 free(ctx->c_buf); in ctx_teardown() 210 close(ctx->c_kq); in ctx_teardown() 218 ctx_lock(ctx); in ctx_thread_alive() 220 ctx_unlock(ctx); in ctx_thread_alive() 229 error = pthread_create(&ctx->c_th, NULL, kqueue_thread, ctx); in ctx_thread_start() 299 ctx_lock(ctx); in kqueue_thread() [all …]
|
/openbsd/lib/libtls/ |
H A D | tls_conninfo.c | 155 if (tls_get_peer_cert_hash(ctx, &ctx->conninfo->hash) == -1) in tls_get_peer_cert_info() 157 if (tls_get_peer_cert_subject(ctx, &ctx->conninfo->subject) == -1) in tls_get_peer_cert_info() 159 if (tls_get_peer_cert_issuer(ctx, &ctx->conninfo->issuer) == -1) in tls_get_peer_cert_info() 161 if (tls_get_peer_cert_times(ctx, &ctx->conninfo->notbefore, in tls_get_peer_cert_info() 177 free(ctx->conninfo->alpn); in tls_conninfo_alpn_proto() 178 ctx->conninfo->alpn = NULL; in tls_conninfo_alpn_proto() 235 ctx->conninfo->session_resumed = SSL_session_reused(ctx->ssl_conn); in tls_conninfo_session() 259 ctx->conninfo->cipher_strength = SSL_get_cipher_bits(ctx->ssl_conn, NULL); in tls_conninfo_populate() 285 ctx->conninfo = NULL; in tls_conninfo_populate() 313 if (ctx->conninfo == NULL) in tls_conn_alpn_selected() [all …]
|
H A D | tls_client.c | 40 struct tls *ctx; in tls_client() local 50 return (ctx); in tls_client() 157 ctx->socket = s; in tls_connect_servername() 325 if (tls_configure_ssl(ctx, ctx->ssl_ctx) != 0) in tls_connect_common() 328 if (tls_configure_ssl_keypair(ctx, ctx->ssl_ctx, in tls_connect_common() 340 if (tls_configure_ssl_verify(ctx, ctx->ssl_ctx, SSL_VERIFY_PEER) == -1) in tls_connect_common() 344 if (SSL_CTX_set1_groups(ctx->ssl_ctx, ctx->config->ecdhecurves, in tls_connect_common() 358 if ((ctx->ssl_conn = SSL_new(ctx->ssl_ctx)) == NULL) { in tls_connect_common() 363 if (SSL_set_app_data(ctx->ssl_conn, ctx) != 1) { in tls_connect_common() 475 rv = tls_ssl_error(ctx, ctx->ssl_conn, ssl_ret, "handshake"); in tls_handshake_client() [all …]
|
H A D | tls.c | 248 struct tls *ctx; in tls_new() local 250 if ((ctx = calloc(1, sizeof(*ctx))) == NULL) in tls_new() 253 tls_reset(ctx); in tls_new() 256 free(ctx); in tls_new() 260 return (ctx); in tls_new() 715 tls_reset(ctx); in tls_free() 717 free(ctx); in tls_free() 739 ctx->state = 0; in tls_reset() 843 ctx->ssl_peer_cert = SSL_get_peer_certificate(ctx->ssl_conn); in tls_handshake() 848 ctx->ocsp = tls_ocsp_setup_from_peer(ctx); in tls_handshake() [all …]
|
/openbsd/lib/libcrypto/bio/ |
H A D | bf_buff.c | 108 free(ctx); in buffer_new() 114 free(ctx); in buffer_new() 168 memcpy(out, &(ctx->ibuf[ctx->ibuf_off]), i); in buffer_read() 203 i = BIO_read(b->next_bio, ctx->ibuf, ctx->ibuf_size); in buffer_read() 232 i = ctx->obuf_size - (ctx->obuf_len + ctx->obuf_off); in buffer_write() 235 memcpy(&(ctx->obuf[ctx->obuf_off + ctx->obuf_len]), in, inl); in buffer_write() 244 memcpy(&(ctx->obuf[ctx->obuf_off + ctx->obuf_len]), in, i); in buffer_write() 252 i = BIO_write(b->next_bio, &(ctx->obuf[ctx->obuf_off]), in buffer_write() 422 &(ctx->obuf[ctx->obuf_off]), in buffer_ctrl() 483 p = &(ctx->ibuf[ctx->ibuf_off]); in buffer_gets() [all …]
|
/openbsd/lib/libcrypto/asn1/ |
H A D | bio_asn1.c | 156 if ((ctx = calloc(1, sizeof(*ctx))) == NULL) in asn1_bio_new() 184 ctx->prefix_free(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg); in asn1_bio_free() 186 ctx->suffix_free(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg); in asn1_bio_free() 189 free(ctx); in asn1_bio_free() 217 if (!asn1_bio_setup_ex(b, ctx, ctx->prefix, in asn1_bio_write() 224 ret = asn1_bio_flush_ex(b, ctx, ctx->prefix_free, in asn1_bio_write() 237 ctx->asn1_tag, ctx->asn1_class); in asn1_bio_write() 244 ctx->buf + ctx->bufpos, ctx->buflen); in asn1_bio_write() 309 cleanup(b, &ctx->ex_buf, &ctx->ex_len, in asn1_bio_flush_ex() 323 if (setup && !setup(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg)) { in asn1_bio_setup_ex() [all …]
|
/openbsd/sys/lib/libsa/ |
H A D | arc4.c | 25 ctx->state[x] = ctx->state[y]; \ 43 ctx->x = ctx->y = 0; in rc4_keysetup() 54 ctx->x = (ctx->x + 1) & (RC4STATE - 1); in rc4_crypt() 55 ctx->y = (ctx->state[ctx->x] + ctx->y) & (RC4STATE - 1); in rc4_crypt() 56 RC4SWAP(ctx->x, ctx->y); in rc4_crypt() 58 (ctx->state[ctx->x] + ctx->state[ctx->y]) & (RC4STATE - 1)]; in rc4_crypt() 70 ctx->y = (ctx->state[ctx->x] + ctx->y) & (RC4STATE - 1); in rc4_getbytes() 71 RC4SWAP(ctx->x, ctx->y); in rc4_getbytes() 73 (ctx->state[ctx->x] + ctx->state[ctx->y]) & (RC4STATE - 1)]; in rc4_getbytes() 82 ctx->y = (ctx->state[ctx->x] + ctx->y) & (RC4STATE - 1); in rc4_skip() [all …]
|