diff options
author | Richard Levitte <levitte@openssl.org> | 2020-08-16 21:25:08 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-08-21 09:23:58 +0200 |
commit | ece9304c96f71277ca95696d9bc49fdec51e9f17 (patch) | |
tree | 7038f8760e1538754bc67371cb5a466a83935dad /crypto/pem | |
parent | Rename OSSL_SERIALIZER / OSSL_DESERIALIZER to OSSL_ENCODE / OSSL_DECODE (diff) | |
download | openssl-ece9304c96f71277ca95696d9bc49fdec51e9f17.tar.xz openssl-ece9304c96f71277ca95696d9bc49fdec51e9f17.zip |
Rename OSSL_SERIALIZER / OSSL_DESERIALIZER to OSSL_ENCODE / OSSL_DECODE
Fixes #12455
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12660)
Diffstat (limited to 'crypto/pem')
-rw-r--r-- | crypto/pem/pem_local.h | 38 | ||||
-rw-r--r-- | crypto/pem/pem_pk8.c | 23 | ||||
-rw-r--r-- | crypto/pem/pem_pkey.c | 1 |
3 files changed, 30 insertions, 32 deletions
diff --git a/crypto/pem/pem_local.h b/crypto/pem/pem_local.h index 2fb1e6f4d5..81d1718e32 100644 --- a/crypto/pem/pem_local.h +++ b/crypto/pem/pem_local.h @@ -13,17 +13,17 @@ */ #include <openssl/pem.h> -#include <openssl/serializer.h> +#include <openssl/encoder.h> -/* Alternative IMPLEMENT macros for provided serializers */ +/* Alternative IMPLEMENT macros for provided encoders */ # define IMPLEMENT_PEM_provided_write_body_vars(type, asn1) \ int ret = 0; \ - const char *pq = OSSL_SERIALIZER_##asn1##_TO_PEM_PQ; \ - OSSL_SERIALIZER_CTX *ctx = OSSL_SERIALIZER_CTX_new_by_##type(x, pq); \ + const char *pq = OSSL_ENCODER_##asn1##_TO_PEM_PQ; \ + OSSL_ENCODER_CTX *ctx = OSSL_ENCODER_CTX_new_by_##type(x, pq); \ \ - if (ctx != NULL && OSSL_SERIALIZER_CTX_get_serializer(ctx) == NULL) { \ - OSSL_SERIALIZER_CTX_free(ctx); \ + if (ctx != NULL && OSSL_ENCODER_CTX_get_encoder(ctx) == NULL) { \ + OSSL_ENCODER_CTX_free(ctx); \ goto legacy; \ } # define IMPLEMENT_PEM_provided_write_body_pass() \ @@ -38,31 +38,31 @@ } \ if (enc != NULL) { \ ret = 0; \ - if (OSSL_SERIALIZER_CTX_set_cipher(ctx, EVP_CIPHER_name(enc), \ - NULL)) { \ + if (OSSL_ENCODER_CTX_set_cipher(ctx, EVP_CIPHER_name(enc), \ + NULL)) { \ ret = 1; \ if (kstr != NULL \ - && !OSSL_SERIALIZER_CTX_set_passphrase(ctx, kstr, klen)) \ + && !OSSL_ENCODER_CTX_set_passphrase(ctx, kstr, klen)) \ ret = 0; \ else if (cb != NULL \ - && !OSSL_SERIALIZER_CTX_set_passphrase_cb(ctx, \ - cb, u)) \ + && !OSSL_ENCODER_CTX_set_passphrase_cb(ctx, \ + cb, u)) \ ret = 0; \ } \ } \ if (!ret) { \ - OSSL_SERIALIZER_CTX_free(ctx); \ + OSSL_ENCODER_CTX_free(ctx); \ return 0; \ } # define IMPLEMENT_PEM_provided_write_body_main(type, outtype) \ - ret = OSSL_SERIALIZER_to_##outtype(ctx, out); \ - OSSL_SERIALIZER_CTX_free(ctx); \ + ret = OSSL_ENCODER_to_##outtype(ctx, out); \ + OSSL_ENCODER_CTX_free(ctx); \ return ret # define IMPLEMENT_PEM_provided_write_body_fallback(str, asn1, \ writename) \ legacy: \ return PEM_ASN1_##writename((i2d_of_void *)i2d_##asn1, str, out, \ - x, NULL, NULL, 0, NULL, NULL) + x, NULL, NULL, 0, NULL, NULL) # define IMPLEMENT_PEM_provided_write_body_fallback_cb(str, asn1, \ writename) \ legacy: \ @@ -114,15 +114,15 @@ IMPLEMENT_PEM_provided_write_bio(name, type, str, asn1) \ IMPLEMENT_PEM_provided_write_fp(name, type, str, asn1) -# define IMPLEMENT_PEM_provided_write_cb(name, type, str, asn1) \ - IMPLEMENT_PEM_provided_write_cb_bio(name, type, str, asn1) \ +# define IMPLEMENT_PEM_provided_write_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_provided_write_cb_bio(name, type, str, asn1) \ IMPLEMENT_PEM_provided_write_cb_fp(name, type, str, asn1) -# define IMPLEMENT_PEM_provided_rw(name, type, str, asn1) \ +# define IMPLEMENT_PEM_provided_rw(name, type, str, asn1) \ IMPLEMENT_PEM_read(name, type, str, asn1) \ IMPLEMENT_PEM_provided_write(name, type, str, asn1) -# define IMPLEMENT_PEM_provided_rw_cb(name, type, str, asn1) \ +# define IMPLEMENT_PEM_provided_rw_cb(name, type, str, asn1) \ IMPLEMENT_PEM_read(name, type, str, asn1) \ IMPLEMENT_PEM_provided_write_cb(name, type, str, asn1) diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c index 12a25b7a82..84d431820b 100644 --- a/crypto/pem/pem_pk8.c +++ b/crypto/pem/pem_pk8.c @@ -15,7 +15,7 @@ #include <openssl/x509.h> #include <openssl/pkcs12.h> #include <openssl/pem.h> -#include <openssl/serializer.h> +#include <openssl/encoder.h> static int do_pk8pkey(BIO *bp, const EVP_PKEY *x, int isder, int nid, const EVP_CIPHER *enc, @@ -69,9 +69,9 @@ static int do_pk8pkey(BIO *bp, const EVP_PKEY *x, int isder, int nid, { int ret = 0; const char *pq = isder - ? OSSL_SERIALIZER_PrivateKey_TO_DER_PQ - : OSSL_SERIALIZER_PrivateKey_TO_PEM_PQ; - OSSL_SERIALIZER_CTX *ctx = OSSL_SERIALIZER_CTX_new_by_EVP_PKEY(x, pq); + ? OSSL_ENCODER_PrivateKey_TO_DER_PQ + : OSSL_ENCODER_PrivateKey_TO_PEM_PQ; + OSSL_ENCODER_CTX *ctx = OSSL_ENCODER_CTX_new_by_EVP_PKEY(x, pq); if (ctx == NULL) return 0; @@ -90,12 +90,11 @@ static int do_pk8pkey(BIO *bp, const EVP_PKEY *x, int isder, int nid, } } - if (OSSL_SERIALIZER_CTX_get_serializer(ctx) != NULL) { + if (OSSL_ENCODER_CTX_get_encoder(ctx) != NULL) { ret = 1; if (enc != NULL) { ret = 0; - if (OSSL_SERIALIZER_CTX_set_cipher(ctx, EVP_CIPHER_name(enc), - NULL)) { + if (OSSL_ENCODER_CTX_set_cipher(ctx, EVP_CIPHER_name(enc), NULL)) { const unsigned char *ukstr = (const unsigned char *)kstr; /* @@ -106,14 +105,14 @@ static int do_pk8pkey(BIO *bp, const EVP_PKEY *x, int isder, int nid, */ ret = 1; if (kstr != NULL - && !OSSL_SERIALIZER_CTX_set_passphrase(ctx, ukstr, klen)) + && !OSSL_ENCODER_CTX_set_passphrase(ctx, ukstr, klen)) ret = 0; else if (cb != NULL - && !OSSL_SERIALIZER_CTX_set_passphrase_cb(ctx, cb, u)) + && !OSSL_ENCODER_CTX_set_passphrase_cb(ctx, cb, u)) ret = 0; } } - ret = ret && OSSL_SERIALIZER_to_bio(ctx, bp); + ret = ret && OSSL_ENCODER_to_bio(ctx, bp); } else { X509_SIG *p8; PKCS8_PRIV_KEY_INFO *p8inf; @@ -153,7 +152,7 @@ static int do_pk8pkey(BIO *bp, const EVP_PKEY *x, int isder, int nid, legacy_end: PKCS8_PRIV_KEY_INFO_free(p8inf); } - OSSL_SERIALIZER_CTX_free(ctx); + OSSL_ENCODER_CTX_free(ctx); return ret; } @@ -261,4 +260,4 @@ IMPLEMENT_PEM_rw(PKCS8, X509_SIG, PEM_STRING_PKCS8, X509_SIG) IMPLEMENT_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO, PEM_STRING_PKCS8INF, - PKCS8_PRIV_KEY_INFO) + PKCS8_PRIV_KEY_INFO) diff --git a/crypto/pem/pem_pkey.c b/crypto/pem/pem_pkey.c index 4ee5bb7009..e355afe5f9 100644 --- a/crypto/pem/pem_pkey.c +++ b/crypto/pem/pem_pkey.c @@ -19,7 +19,6 @@ #include <openssl/dh.h> #include <openssl/store.h> #include <openssl/ui.h> -#include <openssl/serializer.h> #include "crypto/store.h" #include "crypto/asn1.h" #include "crypto/evp.h" |