diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-05-21 16:58:08 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-06-01 12:40:00 +0200 |
commit | ed576acdf591d4164905ab98e89ca5a3b99d90ab (patch) | |
tree | c0f36ca1b3d42f34c0c502e700ad09b69b713d3c /engines | |
parent | Pass library context and property query into private key decoders (diff) | |
download | openssl-ed576acdf591d4164905ab98e89ca5a3b99d90ab.tar.xz openssl-ed576acdf591d4164905ab98e89ca5a3b99d90ab.zip |
Rename all getters to use get/get0 in name
For functions that exist in 1.1.1 provide a simple aliases via #define.
Fixes #15236
Functions with OSSL_DECODER_, OSSL_ENCODER_, OSSL_STORE_LOADER_,
EVP_KEYEXCH_, EVP_KEM_, EVP_ASYM_CIPHER_, EVP_SIGNATURE_,
EVP_KEYMGMT_, EVP_RAND_, EVP_MAC_, EVP_KDF_, EVP_PKEY_,
EVP_MD_, and EVP_CIPHER_ prefixes are renamed.
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15405)
Diffstat (limited to 'engines')
-rw-r--r-- | engines/e_afalg.c | 14 | ||||
-rw-r--r-- | engines/e_dasync.c | 4 | ||||
-rw-r--r-- | engines/e_devcrypto.c | 28 | ||||
-rw-r--r-- | engines/e_ossltest.c | 14 | ||||
-rw-r--r-- | engines/e_padlock.c | 14 |
5 files changed, 37 insertions, 37 deletions
diff --git a/engines/e_afalg.c b/engines/e_afalg.c index db73873911..93b3b3f02e 100644 --- a/engines/e_afalg.c +++ b/engines/e_afalg.c @@ -564,7 +564,7 @@ static int afalg_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, return 0; } - ciphertype = EVP_CIPHER_CTX_nid(ctx); + ciphertype = EVP_CIPHER_CTX_get_nid(ctx); switch (ciphertype) { case NID_aes_128_cbc: case NID_aes_192_cbc: @@ -577,9 +577,9 @@ static int afalg_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, return 0; } - if (ALG_AES_IV_LEN != EVP_CIPHER_CTX_iv_length(ctx)) { + if (ALG_AES_IV_LEN != EVP_CIPHER_CTX_get_iv_length(ctx)) { ALG_WARN("%s(%d): Unsupported IV length :%d\n", __FILE__, __LINE__, - EVP_CIPHER_CTX_iv_length(ctx)); + EVP_CIPHER_CTX_get_iv_length(ctx)); return 0; } @@ -589,7 +589,7 @@ static int afalg_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, return 0; - ret = afalg_set_key(actx, key, EVP_CIPHER_CTX_key_length(ctx)); + ret = afalg_set_key(actx, key, EVP_CIPHER_CTX_get_key_length(ctx)); if (ret < 1) goto err; @@ -635,14 +635,14 @@ static int afalg_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, * set iv now for decrypt operation as the input buffer can be * overwritten for inplace operation where in = out. */ - if (EVP_CIPHER_CTX_encrypting(ctx) == 0) { + if (EVP_CIPHER_CTX_is_encrypting(ctx) == 0) { memcpy(nxtiv, in + (inl - ALG_AES_IV_LEN), ALG_AES_IV_LEN); } /* Send input data to kernel space */ ret = afalg_start_cipher_sk(actx, (unsigned char *)in, inl, EVP_CIPHER_CTX_iv(ctx), - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); if (ret < 1) { return 0; } @@ -652,7 +652,7 @@ static int afalg_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (ret < 1) return 0; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), out + (inl - ALG_AES_IV_LEN), ALG_AES_IV_LEN); } else { diff --git a/engines/e_dasync.c b/engines/e_dasync.c index 4eb50d055c..9866459103 100644 --- a/engines/e_dasync.c +++ b/engines/e_dasync.c @@ -96,7 +96,7 @@ static int dasync_digest_nids(const int **nids) if (!init) { const EVP_MD *md; if ((md = dasync_sha1()) != NULL) - digest_nids[pos++] = EVP_MD_type(md); + digest_nids[pos++] = EVP_MD_get_type(md); digest_nids[pos] = 0; init = 1; } @@ -627,7 +627,7 @@ static int dasync_cipher_ctrl_helper(EVP_CIPHER_CTX *ctx, int type, int arg, len = p[arg - 2] << 8 | p[arg - 1]; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if ((p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) { if (len < AES_BLOCK_SIZE) return 0; diff --git a/engines/e_devcrypto.c b/engines/e_devcrypto.c index d279b601f5..fa01317db5 100644 --- a/engines/e_devcrypto.c +++ b/engines/e_devcrypto.c @@ -207,7 +207,7 @@ static int cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, struct cipher_ctx *cipher_ctx = (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); const struct cipher_data_st *cipher_d = - get_cipher_data(EVP_CIPHER_CTX_nid(ctx)); + get_cipher_data(EVP_CIPHER_CTX_get_nid(ctx)); int ret; /* cleanup a previous session */ @@ -260,12 +260,12 @@ static int cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, #if !defined(COP_FLAG_WRITE_IV) cryp.flags = 0; - ivlen = EVP_CIPHER_CTX_iv_length(ctx); + ivlen = EVP_CIPHER_CTX_get_iv_length(ctx); if (ivlen > 0) switch (cipher_ctx->mode) { case EVP_CIPH_CBC_MODE: assert(inl >= ivlen); - if (!EVP_CIPHER_CTX_encrypting(ctx)) { + if (!EVP_CIPHER_CTX_is_encrypting(ctx)) { ivptr = in + inl - ivlen; memcpy(saved_iv, ivptr, ivlen); } @@ -291,7 +291,7 @@ static int cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, switch (cipher_ctx->mode) { case EVP_CIPH_CBC_MODE: assert(inl >= ivlen); - if (EVP_CIPHER_CTX_encrypting(ctx)) + if (EVP_CIPHER_CTX_is_encrypting(ctx)) ivptr = out + inl - ivlen; else ivptr = saved_iv; @@ -610,7 +610,7 @@ static int cryptodev_select_cipher_cb(const char *str, int len, void *usr) EVP = EVP_get_cipherbyname(name); if (EVP == NULL) fprintf(stderr, "devcrypto: unknown cipher %s\n", name); - else if ((i = find_cipher_data_index(EVP_CIPHER_nid(EVP))) != (size_t)-1) + else if ((i = find_cipher_data_index(EVP_CIPHER_get_nid(EVP))) != (size_t)-1) cipher_list[i] = 1; else fprintf(stderr, "devcrypto: cipher %s not available\n", name); @@ -746,9 +746,9 @@ static const struct digest_data_st *get_digest_data(int nid) static int digest_init(EVP_MD_CTX *ctx) { struct digest_ctx *digest_ctx = - (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); + (struct digest_ctx *)EVP_MD_CTX_get0_md_data(ctx); const struct digest_data_st *digest_d = - get_digest_data(EVP_MD_CTX_type(ctx)); + get_digest_data(EVP_MD_CTX_get_type(ctx)); digest_ctx->init_called = 1; @@ -779,7 +779,7 @@ static int digest_op(struct digest_ctx *ctx, const void *src, size_t srclen, static int digest_update(EVP_MD_CTX *ctx, const void *data, size_t count) { struct digest_ctx *digest_ctx = - (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); + (struct digest_ctx *)EVP_MD_CTX_get0_md_data(ctx); if (count == 0) return 1; @@ -801,13 +801,13 @@ static int digest_update(EVP_MD_CTX *ctx, const void *data, size_t count) static int digest_final(EVP_MD_CTX *ctx, unsigned char *md) { struct digest_ctx *digest_ctx = - (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); + (struct digest_ctx *)EVP_MD_CTX_get0_md_data(ctx); if (md == NULL || digest_ctx == NULL) return 0; if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { - memcpy(md, digest_ctx->digest_res, EVP_MD_CTX_size(ctx)); + memcpy(md, digest_ctx->digest_res, EVP_MD_CTX_get_size(ctx)); } else if (digest_op(digest_ctx, NULL, 0, md, COP_FLAG_FINAL) < 0) { ERR_raise_data(ERR_LIB_SYS, errno, "calling ioctl()"); return 0; @@ -819,9 +819,9 @@ static int digest_final(EVP_MD_CTX *ctx, unsigned char *md) static int digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) { struct digest_ctx *digest_from = - (struct digest_ctx *)EVP_MD_CTX_md_data(from); + (struct digest_ctx *)EVP_MD_CTX_get0_md_data(from); struct digest_ctx *digest_to = - (struct digest_ctx *)EVP_MD_CTX_md_data(to); + (struct digest_ctx *)EVP_MD_CTX_get0_md_data(to); struct cphash_op cphash; if (digest_from == NULL || digest_from->init_called != 1) @@ -844,7 +844,7 @@ static int digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) static int digest_cleanup(EVP_MD_CTX *ctx) { struct digest_ctx *digest_ctx = - (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); + (struct digest_ctx *)EVP_MD_CTX_get0_md_data(ctx); if (digest_ctx == NULL) return 1; @@ -1040,7 +1040,7 @@ static int cryptodev_select_digest_cb(const char *str, int len, void *usr) EVP = EVP_get_digestbyname(name); if (EVP == NULL) fprintf(stderr, "devcrypto: unknown digest %s\n", name); - else if ((i = find_digest_data_index(EVP_MD_type(EVP))) != (size_t)-1) + else if ((i = find_digest_data_index(EVP_MD_get_type(EVP))) != (size_t)-1) digest_list[i] = 1; else fprintf(stderr, "devcrypto: digest %s not available\n", name); diff --git a/engines/e_ossltest.c b/engines/e_ossltest.c index 15a7d75f1e..57dfb13ba1 100644 --- a/engines/e_ossltest.c +++ b/engines/e_ossltest.c @@ -226,15 +226,15 @@ static int ossltest_digest_nids(const int **nids) if (!init) { const EVP_MD *md; if ((md = digest_md5()) != NULL) - digest_nids[pos++] = EVP_MD_type(md); + digest_nids[pos++] = EVP_MD_get_type(md); if ((md = digest_sha1()) != NULL) - digest_nids[pos++] = EVP_MD_type(md); + digest_nids[pos++] = EVP_MD_get_type(md); if ((md = digest_sha256()) != NULL) - digest_nids[pos++] = EVP_MD_type(md); + digest_nids[pos++] = EVP_MD_get_type(md); if ((md = digest_sha384()) != NULL) - digest_nids[pos++] = EVP_MD_type(md); + digest_nids[pos++] = EVP_MD_get_type(md); if ((md = digest_sha512()) != NULL) - digest_nids[pos++] = EVP_MD_type(md); + digest_nids[pos++] = EVP_MD_get_type(md); digest_nids[pos] = 0; init = 1; } @@ -279,7 +279,7 @@ static const EVP_CIPHER *ossltest_aes_128_cbc(void) || !EVP_CIPHER_meth_set_do_cipher(_hidden_aes_128_cbc, ossltest_aes128_cbc_cipher) || !EVP_CIPHER_meth_set_impl_ctx_size(_hidden_aes_128_cbc, - EVP_CIPHER_impl_ctx_size(EVP_aes_128_cbc())))) { + EVP_CIPHER_impl_ctx_size(EVP_aes_128_cbc())))) { EVP_CIPHER_meth_free(_hidden_aes_128_cbc); _hidden_aes_128_cbc = NULL; } @@ -308,7 +308,7 @@ static const EVP_CIPHER *ossltest_aes_128_gcm(void) || !EVP_CIPHER_meth_set_ctrl(_hidden_aes_128_gcm, ossltest_aes128_gcm_ctrl) || !EVP_CIPHER_meth_set_impl_ctx_size(_hidden_aes_128_gcm, - EVP_CIPHER_impl_ctx_size(EVP_aes_128_gcm())))) { + EVP_CIPHER_impl_ctx_size(EVP_aes_128_gcm())))) { EVP_CIPHER_meth_free(_hidden_aes_128_gcm); _hidden_aes_128_gcm = NULL; } diff --git a/engines/e_padlock.c b/engines/e_padlock.c index 572ff90935..a22fc476e6 100644 --- a/engines/e_padlock.c +++ b/engines/e_padlock.c @@ -324,13 +324,13 @@ padlock_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out_arg, struct padlock_cipher_data *cdata = ALIGNED_CIPHER_DATA(ctx); size_t chunk; - if ((chunk = EVP_CIPHER_CTX_num(ctx))) { /* borrow chunk variable */ + if ((chunk = EVP_CIPHER_CTX_get_num(ctx))) { /* borrow chunk variable */ unsigned char *ivp = EVP_CIPHER_CTX_iv_noconst(ctx); if (chunk >= AES_BLOCK_SIZE) return 0; /* bogus value */ - if (EVP_CIPHER_CTX_encrypting(ctx)) + if (EVP_CIPHER_CTX_is_encrypting(ctx)) while (chunk < AES_BLOCK_SIZE && nbytes != 0) { ivp[chunk] = *(out_arg++) = *(in_arg++) ^ ivp[chunk]; chunk++, nbytes--; @@ -398,7 +398,7 @@ padlock_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out_arg, /* * ctx->num is maintained in byte-oriented modes, such as CFB and OFB... */ - if ((chunk = EVP_CIPHER_CTX_num(ctx))) { /* borrow chunk variable */ + if ((chunk = EVP_CIPHER_CTX_get_num(ctx))) { /* borrow chunk variable */ unsigned char *ivp = EVP_CIPHER_CTX_iv_noconst(ctx); if (chunk >= AES_BLOCK_SIZE) @@ -457,7 +457,7 @@ padlock_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out_arg, const unsigned char *in_arg, size_t nbytes) { struct padlock_cipher_data *cdata = ALIGNED_CIPHER_DATA(ctx); - unsigned int num = EVP_CIPHER_CTX_num(ctx); + unsigned int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_ctr128_encrypt_ctr32(in_arg, out_arg, nbytes, cdata, EVP_CIPHER_CTX_iv_noconst(ctx), @@ -600,8 +600,8 @@ padlock_aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { struct padlock_cipher_data *cdata; - int key_len = EVP_CIPHER_CTX_key_length(ctx) * 8; - unsigned long mode = EVP_CIPHER_CTX_mode(ctx); + int key_len = EVP_CIPHER_CTX_get_key_length(ctx) * 8; + unsigned long mode = EVP_CIPHER_CTX_get_mode(ctx); if (key == NULL) return 0; /* ERROR */ @@ -613,7 +613,7 @@ padlock_aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (mode == EVP_CIPH_OFB_MODE || mode == EVP_CIPH_CTR_MODE) cdata->cword.b.encdec = 0; else - cdata->cword.b.encdec = (EVP_CIPHER_CTX_encrypting(ctx) == 0); + cdata->cword.b.encdec = (EVP_CIPHER_CTX_is_encrypting(ctx) == 0); cdata->cword.b.rounds = 10 + (key_len - 128) / 32; cdata->cword.b.ksize = (key_len - 128) / 64; |