/openssl/crypto/ec/ |
H A D | ecx_key.c | 32 ret->keylen = X25519_KEYLEN; in ossl_ecx_key_new() 35 ret->keylen = X448_KEYLEN; in ossl_ecx_key_new() 38 ret->keylen = ED25519_KEYLEN; in ossl_ecx_key_new() 41 ret->keylen = ED448_KEYLEN; in ossl_ecx_key_new() 102 key->privkey = OPENSSL_secure_zalloc(key->keylen); in ossl_ecx_key_allocate_privkey() 117 if (!ossl_assert(keylen == X25519_KEYLEN in ossl_ecx_compute_key() 118 || keylen == X448_KEYLEN)) { in ossl_ecx_compute_key() 124 *secretlen = keylen; in ossl_ecx_compute_key() 127 if (outlen < keylen) { in ossl_ecx_compute_key() 132 if (keylen == X25519_KEYLEN) { in ossl_ecx_compute_key() [all …]
|
/openssl/crypto/evp/ |
H A D | e_camellia.c | 143 static const EVP_CIPHER cmll_t4_##keylen##_##mode = { \ 144 nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \ 152 static const EVP_CIPHER camellia_##keylen##_##mode = { \ 153 nid##_##keylen##_##nmode,blocksize, \ 154 keylen/8,ivlen, \ 162 const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \ 163 { return SPARC_CMLL_CAPABLE?&cmll_t4_##keylen##_##mode:&camellia_##keylen##_##mode; } 168 static const EVP_CIPHER camellia_##keylen##_##mode = { \ 169 nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \ 177 const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \ [all …]
|
H A D | e_aes.c | 151 if (keylen <= 0) { in aesni_init_key() 424 nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \ 443 { return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; } 469 { return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; } 810 nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \ 1026 if (keylen <= 0) { in s390x_aes_ecb_init_key() 1056 if (keylen <= 0) { in s390x_aes_ofb_init_key() 1122 if (keylen <= 0) { in s390x_aes_cfb_init_key() 1609 int keylen; in s390x_aes_gcm_init_key() local 2020 int keylen; in s390x_aes_ccm_init_key() local [all …]
|
H A D | p5_crpt2.c | 60 if (EVP_KDF_derive(kctx, out, keylen, params) != 1) in ossl_pkcs5_pbkdf2_hmac_ex() 77 0, keylen, out, keylen); in ossl_pkcs5_pbkdf2_hmac_ex() 88 keylen, out, NULL, NULL); in PKCS5_PBKDF2_HMAC() 94 int keylen, unsigned char *out) in PKCS5_PBKDF2_HMAC_SHA1() argument 101 digest, keylen, out, NULL, NULL); in PKCS5_PBKDF2_HMAC_SHA1() 188 unsigned int keylen = 0; in PKCS5_v2_PBKDF2_keyivgen_ex() local 198 keylen = EVP_CIPHER_CTX_get_key_length(ctx); in PKCS5_v2_PBKDF2_keyivgen_ex() 199 OPENSSL_assert(keylen <= sizeof(key)); in PKCS5_v2_PBKDF2_keyivgen_ex() 215 keylen = t; in PKCS5_v2_PBKDF2_keyivgen_ex() 255 keylen, key, libctx, propq)) in PKCS5_v2_PBKDF2_keyivgen_ex() [all …]
|
H A D | p_open.c | 23 size_t keylen = 0; in EVP_OpenInit() local 42 || EVP_PKEY_decrypt(pctx, NULL, &keylen, ek, ekl) <= 0) in EVP_OpenInit() 45 if ((key = OPENSSL_malloc(keylen)) == NULL) in EVP_OpenInit() 48 if (EVP_PKEY_decrypt(pctx, key, &keylen, ek, ekl) <= 0) in EVP_OpenInit() 51 if (EVP_CIPHER_CTX_set_key_length(ctx, keylen) <= 0 in EVP_OpenInit() 58 OPENSSL_clear_free(key, keylen); in EVP_OpenInit()
|
/openssl/providers/implementations/ciphers/ |
H A D | cipher_aes_ocb_hw.c | 22 fn_set_enc_key(key, keylen * 8, &ctx->ksenc.ks); \ 23 fn_set_dec_key(key, keylen * 8, &ctx->ksdec.ks); \ 34 size_t keylen) in cipher_hw_aes_ocb_generic_initkey() argument 66 size_t keylen) in cipher_hw_aes_ocb_aesni_initkey() argument 89 size_t keylen) in cipher_hw_aes_ocb_t4_initkey() argument 111 size_t keylen) in cipher_hw_aes_ocb_rv64i_zknd_zkne_initkey() argument 122 size_t keylen) in cipher_hw_aes_ocb_rv64i_zvkned_initkey() argument 127 if (keylen * 8 == 128 || keylen * 8 == 256) { in cipher_hw_aes_ocb_rv64i_zvkned_initkey() 159 size_t keylen) in cipher_hw_aes_ocb_rv32i_zknd_zkne_initkey() argument 170 size_t keylen) in cipher_hw_aes_ocb_rv32i_zbkb_zknd_zkne_initkey() argument
|
H A D | cipher_aes_xts_hw.c | 21 size_t bytes = keylen / 2; \ 40 size_t keylen) in cipher_hw_aes_xts_generic_initkey() argument 103 const unsigned char *key, size_t keylen) in cipher_hw_aesni_xts_initkey() argument 133 switch (keylen) { in cipher_hw_aes_xts_t4_initkey() 166 size_t keylen) in cipher_hw_aes_xts_rv64i_zknd_zkne_initkey() argument 179 PROV_CIPHER_CTX *ctx, const unsigned char *key, size_t keylen) in cipher_hw_aes_xts_rv64i_zvbb_zvkg_zvkned_initkey() argument 186 if (keylen * 8 == 128 * 2 || keylen * 8 == 256 * 2) { in cipher_hw_aes_xts_rv64i_zvbb_zvkg_zvkned_initkey() 202 size_t keylen) in cipher_hw_aes_xts_rv64i_zvkned_initkey() argument 209 if (keylen * 8 == 128 * 2 || keylen * 8 == 256 * 2) { in cipher_hw_aes_xts_rv64i_zvkned_initkey() 252 size_t keylen) in cipher_hw_aes_xts_rv32i_zknd_zkne_initkey() argument [all …]
|
H A D | cipher_aes_xts.c | 72 static int aes_xts_init(void *vctx, const unsigned char *key, size_t keylen, in aes_xts_init() argument 89 if (keylen != ctx->keylen) { in aes_xts_init() 93 if (!aes_xts_check_keys_differ(key, keylen / 2, enc)) in aes_xts_init() 95 if (!ctx->hw->init(ctx, key, keylen)) in aes_xts_init() 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() 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() 265 size_t keylen; in aes_xts_set_ctx_params() local 267 if (!OSSL_PARAM_get_size_t(p, &keylen)) { in aes_xts_set_ctx_params() [all …]
|
H A D | cipher_aes_siv.c | 42 ctx->keylen = keybits / 8; in aes_siv_newctx() 77 static int siv_init(void *vctx, const unsigned char *key, size_t keylen, in siv_init() argument 89 if (keylen != ctx->keylen) { in siv_init() 93 if (!ctx->hw->initkey(ctx, key, ctx->keylen)) in siv_init() 99 static int siv_einit(void *vctx, const unsigned char *key, size_t keylen, in siv_einit() argument 103 return siv_init(vctx, key, keylen, iv, ivlen, params, 1); in siv_einit() 110 return siv_init(vctx, key, keylen, iv, ivlen, params, 0); in siv_dinit() 180 if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->keylen)) { in aes_siv_get_ctx_params() 228 size_t keylen; in aes_siv_set_ctx_params() local 230 if (!OSSL_PARAM_get_size_t(p, &keylen)) { in aes_siv_set_ctx_params() [all …]
|
H A D | cipher_aes_hw.c | 20 const unsigned char *key, size_t keylen) in cipher_hw_aes_initkey() argument 32 ret = HWAES_set_decrypt_key(key, keylen * 8, ks); in cipher_hw_aes_initkey() 47 ret = AES_set_decrypt_key(key, keylen * 8, ks); in cipher_hw_aes_initkey() 54 ret = vpaes_set_decrypt_key(key, keylen * 8, ks); in cipher_hw_aes_initkey() 61 ret = AES_set_decrypt_key(key, keylen * 8, ks); in cipher_hw_aes_initkey() 69 ret = HWAES_set_encrypt_key(key, keylen * 8, ks); in cipher_hw_aes_initkey() 92 ret = AES_set_encrypt_key(key, keylen * 8, ks); in cipher_hw_aes_initkey() 99 ret = vpaes_set_encrypt_key(key, keylen * 8, ks); in cipher_hw_aes_initkey() 106 ret = AES_set_encrypt_key(key, keylen * 8, ks); in cipher_hw_aes_initkey()
|
H A D | cipher_aes_wrp.c | 101 size_t keylen, const unsigned char *iv, in aes_wrap_init() argument 123 if (keylen != ctx->keylen) { in aes_wrap_init() 141 AES_set_encrypt_key(key, keylen * 8, &wctx->ks.ks); in aes_wrap_init() 144 AES_set_decrypt_key(key, keylen * 8, &wctx->ks.ks); in aes_wrap_init() 151 static int aes_wrap_einit(void *ctx, const unsigned char *key, size_t keylen, in aes_wrap_einit() argument 155 return aes_wrap_init(ctx, key, keylen, iv, ivlen, params, 1); in aes_wrap_einit() 158 static int aes_wrap_dinit(void *ctx, const unsigned char *key, size_t keylen, in aes_wrap_dinit() argument 162 return aes_wrap_init(ctx, key, keylen, iv, ivlen, params, 0); in aes_wrap_dinit() 267 size_t keylen = 0; in aes_wrap_set_ctx_params() local 274 if (!OSSL_PARAM_get_size_t(p, &keylen)) { in aes_wrap_set_ctx_params() [all …]
|
H A D | cipher_tdes_common.c | 78 static int tdes_init(void *vctx, const unsigned char *key, size_t keylen, in tdes_init() argument 103 if (keylen != ctx->keylen) { in tdes_init() 107 if (!ctx->hw->init(ctx, key, ctx->keylen)) in tdes_init() 120 int ossl_tdes_einit(void *vctx, const unsigned char *key, size_t keylen, in ossl_tdes_einit() argument 124 return tdes_init(vctx, key, keylen, iv, ivlen, params, 1); in ossl_tdes_einit() 127 int ossl_tdes_dinit(void *vctx, const unsigned char *key, size_t keylen, in ossl_tdes_dinit() argument 131 return tdes_init(vctx, key, keylen, iv, ivlen, params, 0); in ossl_tdes_dinit() 142 size_t kl = ctx->keylen;
|
H A D | cipher_des.c | 71 static int des_init(void *vctx, const unsigned char *key, size_t keylen, in des_init() argument 93 if (keylen != ctx->keylen) { in des_init() 97 if (!ctx->hw->init(ctx, key, keylen)) in des_init() 104 static int des_einit(void *vctx, const unsigned char *key, size_t keylen, in des_einit() argument 108 return des_init(vctx, key, keylen, iv, ivlen, params, 1); in des_einit() 111 static int des_dinit(void *vctx, const unsigned char *key, size_t keylen, in des_dinit() argument 115 return des_init(vctx, key, keylen, iv, ivlen, params, 0); in des_dinit() 122 size_t kl = ctx->keylen; in des_generatekey()
|
H A D | cipher_aes_hw_s390x.inc | 34 const unsigned char *key, size_t keylen) 38 adat->plat.s390x.fc = S390X_AES_FC(keylen); 39 memcpy(adat->plat.s390x.param.km.k, key, keylen); 55 const unsigned char *key, size_t keylen) 59 memcpy(adat->plat.s390x.param.kmo_kmf.k, key, keylen); 60 adat->plat.s390x.fc = S390X_AES_FC(keylen); 113 adat->plat.s390x.fc = S390X_AES_FC(keylen); 115 memcpy(adat->plat.s390x.param.kmo_kmf.k, key, keylen); 153 S390X_AES_FC(dat->keylen), 174 adat->plat.s390x.fc = S390X_AES_FC(keylen); [all …]
|
H A D | cipher_aes_gcm_hw_rv64i.inc | 19 size_t keylen) 41 size_t keylen) 50 if (keylen * 8 == 128 || keylen * 8 == 256) { 75 size_t keylen) { 83 if (keylen * 8 == 128 || keylen * 8 == 256) {
|
H A D | ciphercommon.c | 125 size_t keylen; variable 127 if (!OSSL_PARAM_get_size_t(p, &keylen)) { 131 if (ctx->keylen != keylen) { 132 ctx->keylen = keylen; 215 if (keylen != ctx->keylen) { in cipher_generic_init_internal() 220 ctx->keylen = keylen; in cipher_generic_init_internal() 222 if (!ctx->hw->init(ctx, key, ctx->keylen)) in cipher_generic_init_internal() 230 size_t keylen, const unsigned char *iv, in ossl_cipher_generic_einit() argument 238 size_t keylen, const unsigned char *iv, in ossl_cipher_generic_dinit() argument 610 if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->keylen)) { in ossl_cipher_generic_get_ctx_params() [all …]
|
/openssl/providers/implementations/macs/ |
H A D | hmac_prov.c | 58 size_t keylen; member 101 OPENSSL_secure_clear_free(macctx->key, macctx->keylen); in hmac_free() 131 dst->key = OPENSSL_secure_malloc(src->keylen > 0 ? src->keylen : 1); in hmac_dup() 136 memcpy(dst->key, src->key, src->keylen); in hmac_dup() 167 int approved = ossl_mac_check_key_size(keylen); in hmac_setkey() 183 macctx->key = OPENSSL_secure_malloc(keylen > 0 ? keylen : 1); in hmac_setkey() 187 memcpy(macctx->key, key, keylen); in hmac_setkey() 188 macctx->keylen = keylen; in hmac_setkey() 193 return HMAC_Init_ex(macctx->ctx, key, keylen, digest, in hmac_setkey() 207 return hmac_setkey(macctx, key, keylen); in hmac_init() [all …]
|
H A D | blake2_mac_impl.c | 91 const unsigned char *key, size_t keylen) in blake2_setkey() argument 93 if (keylen > BLAKE2_KEYBYTES || keylen == 0) { in blake2_setkey() 97 memcpy(macctx->key, key, keylen); in blake2_setkey() 99 if (keylen < BLAKE2_KEYBYTES) in blake2_setkey() 100 memset(macctx->key + keylen, 0, BLAKE2_KEYBYTES - keylen); in blake2_setkey() 101 BLAKE2_PARAM_SET_KEY_LENGTH(&macctx->params, (uint8_t)keylen); in blake2_setkey() 106 size_t keylen, const OSSL_PARAM params[]) in blake2_mac_init() argument 113 if (!blake2_setkey(macctx, key, keylen)) in blake2_mac_init()
|
/openssl/crypto/cms/ |
H A D | cms_enc.c | 132 ec->keylen = tkeylen; in ossl_cms_EncryptedContent_init_bio() 141 if (ec->keylen != tkeylen) { in ossl_cms_EncryptedContent_init_bio() 143 if (EVP_CIPHER_CTX_set_key_length(ctx, ec->keylen) <= 0) { in ossl_cms_EncryptedContent_init_bio() 153 OPENSSL_clear_free(ec->key, ec->keylen); in ossl_cms_EncryptedContent_init_bio() 155 ec->keylen = tkeylen; in ossl_cms_EncryptedContent_init_bio() 195 OPENSSL_clear_free(ec->key, ec->keylen); in ossl_cms_EncryptedContent_init_bio() 212 if ((ec->key = OPENSSL_malloc(keylen)) == NULL) in ossl_cms_EncryptedContent_init() 214 memcpy(ec->key, key, keylen); in ossl_cms_EncryptedContent_init() 216 ec->keylen = keylen; in ossl_cms_EncryptedContent_init() 227 if (!key || !keylen) { in CMS_EncryptedData_set1_key() [all …]
|
/openssl/crypto/asn1/ |
H A D | p5_scrypt.c | 48 size_t keylen = 0; in PKCS5_pbe2_set_scrypt() local 112 keylen = EVP_CIPHER_get_key_length(cipher); in PKCS5_pbe2_set_scrypt() 118 pbe2->keyfunc = pkcs5_scrypt_set(salt, saltlen, keylen, N, r, p); in PKCS5_pbe2_set_scrypt() 197 if (keylen > 0) { in pkcs5_scrypt_set() 203 if (ASN1_INTEGER_set_int64(sparam->keyLength, keylen) == 0) { in pkcs5_scrypt_set() 244 size_t keylen = 0; in PKCS5_v2_scrypt_keyivgen_ex() local 267 keylen = t; in PKCS5_v2_scrypt_keyivgen_ex() 274 || (spkeylen != keylen)) { in PKCS5_v2_scrypt_keyivgen_ex() 294 keylen, libctx, propq) == 0) in PKCS5_v2_scrypt_keyivgen_ex() 298 if (keylen) in PKCS5_v2_scrypt_keyivgen_ex() [all …]
|
H A D | p5_pbev2.c | 57 int alg_nid, keylen, ivlen; variable 119 keylen = EVP_CIPHER_get_key_length(cipher); 121 keylen = -1; 127 pbe2->keyfunc = PKCS5_pbkdf2_set_ex(iter, salt, saltlen, prf_nid, keylen, 183 int prf_nid, int keylen, in PKCS5_pbkdf2_set_ex() argument 231 if (keylen > 0) { in PKCS5_pbkdf2_set_ex() 236 if (!ASN1_INTEGER_set(kdf->keylength, keylen)) { in PKCS5_pbkdf2_set_ex() 279 int prf_nid, int keylen) in PKCS5_pbkdf2_set() argument 281 return PKCS5_pbkdf2_set_ex(iter, salt, saltlen, prf_nid, keylen, NULL); in PKCS5_pbkdf2_set()
|
/openssl/providers/implementations/exchange/ |
H A D | ecx_exch.c | 40 size_t keylen; member 45 static void *ecx_newctx(void *provctx, size_t keylen) in ecx_newctx() argument 56 ctx->keylen = keylen; in ecx_newctx() 81 || key->keylen != ecxctx->keylen in ecx_init() 119 || key->keylen != ecxctx->keylen in ecx_set_peer() 137 return ossl_ecx_compute_key(ecxctx->peerkey, ecxctx->key, ecxctx->keylen, in ecx_derive()
|
/openssl/crypto/pkcs12/ |
H A D | p12_mutl.c | 69 if (keylen != TK26_MAC_KEY_LEN) { in pkcs12_gen_gost_mac_key() 116 int keylen = 0; in PBMAC1_PBKDF2_HMAC() local 146 ret = keylen; in PBMAC1_PBKDF2_HMAC() 172 int keylen = 0; in pkcs12_gen_mac() local 215 keylen = EVP_MD_get_size(md); in pkcs12_gen_mac() 217 if (keylen <= 0) in pkcs12_gen_mac() 224 if (keylen < 0) in pkcs12_gen_mac() 230 keylen = TK26_MAC_KEY_LEN; in pkcs12_gen_mac() 383 md_type, keylen, out); in pkcs12_pbmac1_pbkdf2_key_gen() 447 int keylen = 0; in PKCS12_set_pbmac1_pbkdf2() local [all …]
|
/openssl/test/recipes/30-test_evp_data/ |
H A D | evpmac_common.txt | 48 Input = "Sample message for keylen=blocklen" 56 Input = "Sample message for keylen<blocklen" 63 Input = "Sample message for keylen=blocklen" 73 Input = "Sample message for keylen=blocklen" 82 Input = "Sample message for keylen<blocklen" 89 Input = "Sample message for keylen=blocklen" 95 Input = "Sample message for keylen=blocklen" 103 Input = "Sample message for keylen<blocklen" 109 Input = "Sample message for keylen=blocklen" 115 Input = "Sample message for keylen=blocklen" [all …]
|
/openssl/providers/implementations/rands/ |
H A D | drbg_ctr.c | 47 size_t keylen; member 84 n = inlen < ctr->keylen ? inlen : ctr->keylen; in ctr_XOR() 87 if (inlen <= ctr->keylen) in ctr_XOR() 90 n = inlen - ctr->keylen; in ctr_XOR() 127 if (ctr->keylen != 16) { in ctr_BCC_blocks() 247 if (ctr->keylen != 16) in ctr_df() 275 if (ctr->keylen == 16) { in ctr_update() 539 if (ctr->keylen > 0) { in drbg_ctr_init_lengths() 560 size_t keylen; in drbg_ctr_init() local 566 ctr->keylen = keylen = EVP_CIPHER_get_key_length(ctr->cipher_ctr); in drbg_ctr_init() [all …]
|