/openssl/providers/implementations/ciphers/ |
H A D | ciphercommon_gcm.c | 61 if (ivlen == 0 || ivlen > sizeof(ctx->iv)) { in gcm_init() 65 ctx->ivlen = ivlen; in gcm_init() 66 memcpy(ctx->iv, iv, ivlen); in gcm_init() 118 if (olen == 0 || olen > ctx->ivlen) in getivgen() 119 olen = ctx->ivlen; in getivgen() 125 ctr64_inc(ctx->iv + ctx->ivlen - 8); in getivgen() 186 if (ctx->ivlen > p->data_size) { in ossl_gcm_get_ctx_params() 286 if (ctx->ivlen != sz) { in ossl_gcm_set_ctx_params() 290 ctx->ivlen = sz; in ossl_gcm_set_ctx_params() 400 int sz = ctx->ivlen - offset; in gcm_iv_generate() [all …]
|
H A D | cipher_aes_ocb.c | 105 const unsigned char *iv, size_t ivlen, in aes_ocb_init() argument 118 if (ivlen != ctx->base.ivlen) { in aes_ocb_init() 120 if (ivlen < OCB_MIN_IV_LEN || ivlen > OCB_MAX_IV_LEN) { in aes_ocb_init() 124 ctx->base.ivlen = ivlen; in aes_ocb_init() 126 if (!ossl_cipher_generic_initiv(&ctx->base, iv, ivlen)) in aes_ocb_init() 142 const unsigned char *iv, size_t ivlen, in aes_ocb_einit() argument 149 const unsigned char *iv, size_t ivlen, in aes_ocb_dinit() argument 396 if (ctx->base.ivlen != sz) { in aes_ocb_set_ctx_params() 397 ctx->base.ivlen = sz; in aes_ocb_set_ctx_params() 442 if (ctx->base.ivlen > p->data_size) { in aes_ocb_get_ctx_params() [all …]
|
H A D | cipher_tdes_wrap.c | 84 size_t ivlen = TDES_IVLEN; in des_ede3_wrap() local 86 size_t len = inl + ivlen + icvlen; in des_ede3_wrap() 92 memmove(out + ivlen, in, inl); in des_ede3_wrap() 96 memcpy(out + inl + ivlen, sha1tmp, icvlen); in des_ede3_wrap() 99 if (RAND_bytes_ex(ctx->libctx, ctx->iv, ivlen, 0) <= 0) in des_ede3_wrap() 101 memcpy(out, ctx->iv, ivlen); in des_ede3_wrap() 103 ctx->hw->cipher(ctx, out + ivlen, out + ivlen, inl + ivlen); in des_ede3_wrap() 105 memcpy(ctx->iv, wrap_iv, ivlen); in des_ede3_wrap()
|
H A D | ciphercommon.c | 203 if (!ossl_cipher_generic_initiv(ctx, iv, ivlen)) in cipher_generic_init_internal() 211 memcpy(ctx->iv, ctx->oiv, ctx->ivlen); in cipher_generic_init_internal() 234 iv, ivlen, params, 1); in ossl_cipher_generic_einit() 242 iv, ivlen, params, 0); in ossl_cipher_generic_dinit() 581 if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->ivlen)) { in ossl_cipher_generic_get_ctx_params() 679 size_t ivlen) in ossl_cipher_generic_initiv() argument 681 if (ivlen != ctx->ivlen in ossl_cipher_generic_initiv() 682 || ivlen > sizeof(ctx->iv)) { in ossl_cipher_generic_initiv() 687 memcpy(ctx->iv, iv, ivlen); in ossl_cipher_generic_initiv() 688 memcpy(ctx->oiv, iv, ivlen); in ossl_cipher_generic_initiv() [all …]
|
H A D | ciphercommon_ccm.c | 101 size_t ivlen; in ossl_ccm_set_ctx_params() local 107 ivlen = 15 - sz; in ossl_ccm_set_ctx_params() 108 if (ivlen < 2 || ivlen > 8) { in ossl_ccm_set_ctx_params() 112 if (ctx->l != ivlen) { in ossl_ccm_set_ctx_params() 113 ctx->l = ivlen; in ossl_ccm_set_ctx_params() 226 const unsigned char *iv, size_t ivlen, in ccm_init() argument 237 if (ivlen != ccm_get_ivlen(ctx)) { in ccm_init() 241 memcpy(ctx->iv, iv, ivlen); in ccm_init() 256 const unsigned char *iv, size_t ivlen, in ossl_ccm_einit() argument 259 return ccm_init(vctx, key, keylen, iv, ivlen, params, 1); in ossl_ccm_einit() [all …]
|
H A D | cipher_tdes_common.c | 79 const unsigned char *iv, size_t ivlen, in tdes_init() argument 92 if (!ossl_cipher_generic_initiv(ctx, iv, ivlen)) in tdes_init() 99 memcpy(ctx->iv, ctx->oiv, ctx->ivlen); in tdes_init() 121 const unsigned char *iv, size_t ivlen, in ossl_tdes_einit() argument 124 return tdes_init(vctx, key, keylen, iv, ivlen, params, 1); in ossl_tdes_einit() 128 const unsigned char *iv, size_t ivlen, in ossl_tdes_dinit() argument 131 return tdes_init(vctx, key, keylen, iv, ivlen, params, 0); in ossl_tdes_dinit()
|
H A D | cipher_des.c | 72 const unsigned char *iv, size_t ivlen, in des_init() argument 85 if (!ossl_cipher_generic_initiv(ctx, iv, ivlen)) in des_init() 89 memcpy(ctx->iv, ctx->oiv, ctx->ivlen); in des_init() 105 const unsigned char *iv, size_t ivlen, in des_einit() argument 108 return des_init(vctx, key, keylen, iv, ivlen, params, 1); in des_einit() 112 const unsigned char *iv, size_t ivlen, in des_dinit() argument 115 return des_init(vctx, key, keylen, iv, ivlen, params, 0); in des_dinit()
|
H A D | cipher_aes_xts_s390x.inc | 19 size_t ivlen, const OSSL_PARAM params[], 43 if (ivlen != xctx->base.ivlen 44 || ivlen > sizeof(km->tweak)) { 48 memcpy(km->tweak, iv, ivlen); 80 size_t ivlen, const OSSL_PARAM params[]) 82 return s390x_aes_xts_init(vctx, key, keylen, iv, ivlen, params, 0); 87 size_t ivlen, const OSSL_PARAM params[]) 89 return s390x_aes_xts_init(vctx, key, keylen, iv, ivlen, params,
|
H A D | cipher_rc2.c | 89 const unsigned char *iv, size_t ivlen, in rc2_einit() argument 92 if (!ossl_cipher_generic_einit(ctx, key, keylen, iv, ivlen, NULL)) in rc2_einit() 98 const unsigned char *iv, size_t ivlen, in rc2_dinit() argument 101 if (!ossl_cipher_generic_dinit(ctx, key, keylen, iv, ivlen, NULL)) in rc2_dinit() 142 ctx->base.iv, ctx->base.ivlen)) { in rc2_get_ctx_params() 200 || ctx->base.ivlen > sizeof(iv) in rc2_set_ctx_params() 203 ctx->base.ivlen) in rc2_set_ctx_params() 204 != ctx->base.ivlen) in rc2_set_ctx_params() 205 || !ossl_cipher_generic_initiv(&ctx->base, iv, ctx->base.ivlen) in rc2_set_ctx_params()
|
H A D | cipher_aes_xts.c | 73 const unsigned char *iv, size_t ivlen, in aes_xts_init() argument 85 if (!ossl_cipher_generic_initiv(vctx, iv, ivlen)) in aes_xts_init() 102 const unsigned char *iv, size_t ivlen, in aes_xts_einit() argument 106 if (s390x_aes_xts_einit(vctx, key, keylen, iv, ivlen, params) == 1) in aes_xts_einit() 109 return aes_xts_init(vctx, key, keylen, iv, ivlen, params, 1); in aes_xts_einit() 113 const unsigned char *iv, size_t ivlen, in aes_xts_dinit() argument 117 if (s390x_aes_xts_dinit(vctx, key, keylen, iv, ivlen, params) == 1) in aes_xts_dinit() 120 return aes_xts_init(vctx, key, keylen, iv, ivlen, params, 0); in aes_xts_dinit()
|
H A D | cipher_rc4_hmac_md5.c | 86 size_t ivlen, const OSSL_PARAM params[]) in rc4_hmac_md5_einit() argument 88 if (!ossl_cipher_generic_einit(ctx, key, keylen, iv, ivlen, NULL)) in rc4_hmac_md5_einit() 95 size_t ivlen, const OSSL_PARAM params[]) in rc4_hmac_md5_dinit() argument 97 if (!ossl_cipher_generic_dinit(ctx, key, keylen, iv, ivlen, NULL)) in rc4_hmac_md5_dinit() 126 if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->base.ivlen)) { in rc4_hmac_md5_get_ctx_params() 177 if (ctx->base.ivlen != sz) { in rc4_hmac_md5_set_ctx_params()
|
H A D | cipher_rc4.c | 54 const unsigned char *iv, size_t ivlen, in rc4_einit() argument 57 if (!ossl_cipher_generic_einit(ctx, key, keylen, iv, ivlen, NULL)) in rc4_einit() 63 const unsigned char *iv, size_t ivlen, in rc4_dinit() argument 66 if (!ossl_cipher_generic_dinit(ctx, key, keylen, iv, ivlen, NULL)) in rc4_dinit()
|
H A D | cipher_aes_wrp.c | 64 ctx->pad = (ctx->ivlen == AES_WRAP_PAD_IVLEN); in aes_wrap_newctx() 102 size_t ivlen, const OSSL_PARAM params[], int enc) in aes_wrap_init() argument 117 if (!ossl_cipher_generic_initiv(ctx, iv, ivlen)) in aes_wrap_init() 152 const unsigned char *iv, size_t ivlen, in aes_wrap_einit() argument 155 return aes_wrap_init(ctx, key, keylen, iv, ivlen, params, 1); in aes_wrap_einit() 159 const unsigned char *iv, size_t ivlen, in aes_wrap_dinit() argument 162 return aes_wrap_init(ctx, key, keylen, iv, ivlen, params, 0); in aes_wrap_dinit()
|
H A D | cipher_aes_cbc_hmac_sha.c | 50 const unsigned char *iv, size_t ivlen, in aes_einit() argument 53 if (!ossl_cipher_generic_einit(ctx, key, keylen, iv, ivlen, NULL)) in aes_einit() 59 const unsigned char *iv, size_t ivlen, in aes_dinit() argument 62 if (!ossl_cipher_generic_dinit(ctx, key, keylen, iv, ivlen, NULL)) in aes_dinit() 268 if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->base.ivlen)) { in aes_get_ctx_params() 274 && !OSSL_PARAM_set_octet_string(p, ctx->base.oiv, ctx->base.ivlen) in aes_get_ctx_params() 275 && !OSSL_PARAM_set_octet_ptr(p, &ctx->base.oiv, ctx->base.ivlen)) { in aes_get_ctx_params() 281 && !OSSL_PARAM_set_octet_string(p, ctx->base.iv, ctx->base.ivlen) in aes_get_ctx_params() 282 && !OSSL_PARAM_set_octet_ptr(p, &ctx->base.iv, ctx->base.ivlen)) { in aes_get_ctx_params()
|
H A D | cipher_sm4_xts.c | 37 const unsigned char *iv, size_t ivlen, in sm4_xts_init() argument 49 if (!ossl_cipher_generic_initiv(vctx, iv, ivlen)) in sm4_xts_init() 64 const unsigned char *iv, size_t ivlen, in sm4_xts_einit() argument 67 return sm4_xts_init(vctx, key, keylen, iv, ivlen, params, 1); in sm4_xts_einit() 71 const unsigned char *iv, size_t ivlen, in sm4_xts_dinit() argument 74 return sm4_xts_init(vctx, key, keylen, iv, ivlen, params, 0); in sm4_xts_dinit()
|
H A D | cipher_camellia_cts.inc | 29 const unsigned char *iv, size_t ivlen, 32 if (!ossl_cipher_generic_einit(ctx, key, keylen, iv, ivlen, NULL)) 38 const unsigned char *iv, size_t ivlen, 41 if (!ossl_cipher_generic_dinit(ctx, key, keylen, iv, ivlen, NULL))
|
H A D | cipher_aes_cts.inc | 29 const unsigned char *iv, size_t ivlen, 32 if (!ossl_cipher_generic_einit(ctx, key, keylen, iv, ivlen, NULL)) 38 const unsigned char *iv, size_t ivlen, 41 if (!ossl_cipher_generic_dinit(ctx, key, keylen, iv, ivlen, NULL))
|
/openssl/crypto/evp/ |
H A D | e_aria.c | 38 int ivlen; /* IV length */ member 249 memcpy(gctx->iv, iv, gctx->ivlen); in aria_gcm_init_key() 272 *(int *)ptr = gctx->ivlen; in aria_gcm_ctrl() 285 gctx->ivlen = arg; in aria_gcm_ctrl() 305 memcpy(gctx->iv, ptr, gctx->ivlen); in aria_gcm_ctrl() 313 if ((arg < 4) || (gctx->ivlen - arg) < 8) in aria_gcm_ctrl() 327 if (arg <= 0 || arg > gctx->ivlen) in aria_gcm_ctrl() 328 arg = gctx->ivlen; in aria_gcm_ctrl() 329 memcpy(ptr, gctx->iv + gctx->ivlen - arg, arg); in aria_gcm_ctrl() 334 ctr64_inc(gctx->iv + gctx->ivlen - 8); in aria_gcm_ctrl() [all …]
|
H A D | e_aes.c | 820 keylen/8,ivlen, \ 938 int ivlen; member 1060 if (ivlen <= 0) { in s390x_aes_ofb_init_key() 1126 if (ivlen <= 0) { in s390x_aes_cfb_init_key() 1156 if (ivlen <= 0) { in s390x_aes_cfb_cipher() 1211 if (ivlen <= 0) { in s390x_aes_cfb8_init_key() 1442 int ivlen, enc, len; in s390x_aes_gcm_ctrl() local 1449 gctx->ivlen = ivlen; in s390x_aes_gcm_ctrl() 1468 if (gctx->ivlen == 12 || len > S390X_gcm_ivpadlen(gctx->ivlen)) { in s390x_aes_gcm_ctrl() 1479 gctx->ivlen = arg; in s390x_aes_gcm_ctrl() [all …]
|
/openssl/ssl/record/methods/ |
H A D | ktls_meth.c | 77 unsigned char *iv, size_t ivlen, in ktls_configure_crypto() argument 85 crypto_info->iv_len = ivlen; in ktls_configure_crypto() 90 crypto_info->iv_len = ivlen; in ktls_configure_crypto() 105 crypto_info->iv_len = ivlen; in ktls_configure_crypto() 176 unsigned char *iv, size_t ivlen, in ktls_configure_crypto() argument 195 if (!ossl_assert(ivlen == EVP_GCM_TLS_FIXED_IV_LEN)) in ktls_configure_crypto() 206 if (!ossl_assert(ivlen == EVP_GCM_TLS_FIXED_IV_LEN in ktls_configure_crypto() 269 if (!ossl_assert(ivlen == TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE)) in ktls_configure_crypto() 275 memcpy(crypto_info->chacha20poly1305.iv, iv, ivlen); in ktls_configure_crypto() 291 unsigned char *iv, size_t ivlen, in ktls_set_crypto_state() argument [all …]
|
H A D | tls13_meth.c | 18 unsigned char *iv, size_t ivlen, in tls13_set_crypto_state() argument 33 rl->iv = OPENSSL_malloc(ivlen); in tls13_set_crypto_state() 37 rl->nonce = OPENSSL_malloc(ivlen); in tls13_set_crypto_state() 41 memcpy(rl->iv, iv, ivlen); in tls13_set_crypto_state() 72 || EVP_CIPHER_CTX_ctrl(ciph_ctx, EVP_CTRL_AEAD_SET_IVLEN, ivlen, in tls13_set_crypto_state() 134 int ivlen = EVP_CIPHER_CTX_get_iv_length(enc_ctx); in tls13_cipher() local 136 if (ivlen < 0) { in tls13_cipher() 141 nonce_len = (size_t)ivlen; in tls13_cipher()
|
/openssl/test/ |
H A D | tls13encryptiontest.c | 242 unsigned char **key, unsigned char *iv, size_t ivlen, in load_record() argument 266 memcpy(iv, ivtmp, ivlen); in load_record() 313 size_t ivlen, ctr; in test_tls13_encryption() local 328 ivlen = EVP_CIPHER_get_iv_length(ciph); in test_tls13_encryption() 329 if (!load_record(&rec, &refdata[ctr], &key, iv, ivlen, seqbuf)) { in test_tls13_encryption() 339 key, 16, iv, ivlen, NULL, 0, EVP_aes_128_gcm(), in test_tls13_encryption() 362 key, 16, iv, ivlen, NULL, 0, EVP_aes_128_gcm(), in test_tls13_encryption()
|
/openssl/crypto/cms/ |
H A D | cms_enc.c | 37 int ivlen = 0; in ossl_cms_EncryptedContent_init_bio() local 90 ivlen = EVP_CIPHER_CTX_get_iv_length(ctx); in ossl_cms_EncryptedContent_init_bio() 91 if (ivlen < 0) { in ossl_cms_EncryptedContent_init_bio() 96 if (ivlen > 0) { in ossl_cms_EncryptedContent_init_bio() 97 if (RAND_bytes_ex(libctx, iv, ivlen, 0) <= 0) in ossl_cms_EncryptedContent_init_bio() 173 memcpy(aparams.iv, piv, ivlen); in ossl_cms_EncryptedContent_init_bio() 174 aparams.iv_len = ivlen; in ossl_cms_EncryptedContent_init_bio()
|
/openssl/ssl/ |
H A D | tls13_enc.c | 138 unsigned char *iv, size_t ivlen) in tls13_derive_iv() argument 144 NULL, 0, iv, ivlen, 1); in tls13_derive_iv() 386 *ivlen = *taglen = (size_t)mac_mdleni; in derive_secret_key_and_iv() 396 *ivlen = EVP_CCM_TLS_IV_LEN; in derive_secret_key_and_iv() 427 *ivlen = iivlen; in derive_secret_key_and_iv() 431 if (*ivlen > EVP_MAX_IV_LENGTH) { in derive_secret_key_and_iv() 432 *iv = OPENSSL_malloc(*ivlen); in derive_secret_key_and_iv() 440 || !tls13_derive_iv(s, md, secret, *iv, *ivlen)) { in derive_secret_key_and_iv() 483 size_t keylen, ivlen = EVP_MAX_IV_LENGTH, taglen; in tls13_change_cipher_state() local 734 ivlen, NULL, 0, cipher, taglen, in tls13_change_cipher_state() [all …]
|
/openssl/crypto/asn1/ |
H A D | p5_pbev2.c | 57 int alg_nid, keylen, ivlen; variable 82 ivlen = EVP_CIPHER_get_iv_length(cipher); 83 if (ivlen > 0) { 85 memcpy(iv, aiv, ivlen); 86 else if (RAND_bytes_ex(libctx, iv, ivlen, 0) <= 0)
|