summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-10-05 14:23:55 +0200
committerRichard Levitte <levitte@openssl.org>2020-10-10 20:23:39 +0200
commit25cf949fc620ff7053e51acca3ec4d0fd094f8b0 (patch)
treedfbffa70ab45c5bad376f86ef518cd02eb38ca7a /include
parent3094351625f0b222f92c22ce4943461df8c7e301 (diff)
ENCODER / DECODER: Add functions to encode/decode to/from a buffer
This adds OSSL_ENCODER_to_data() and OSSL_DECODER_from_data(). These functions allow fairly simple rewrites of type-specific i2d and d2i calls. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13094)
Diffstat (limited to 'include')
-rw-r--r--include/openssl/decoder.h2
-rw-r--r--include/openssl/encoder.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/include/openssl/decoder.h b/include/openssl/decoder.h
index 66790f43c8..1eb1cbe543 100644
--- a/include/openssl/decoder.h
+++ b/include/openssl/decoder.h
@@ -106,6 +106,8 @@ int OSSL_DECODER_from_bio(OSSL_DECODER_CTX *ctx, BIO *in);
#ifndef OPENSSL_NO_STDIO
int OSSL_DECODER_from_fp(OSSL_DECODER_CTX *ctx, FILE *in);
#endif
+int OSSL_DECODER_from_data(OSSL_DECODER_CTX *ctx, const unsigned char **pdata,
+ size_t *pdata_len);
/*
* Create the OSSL_DECODER_CTX with an associated type. This will perform
diff --git a/include/openssl/encoder.h b/include/openssl/encoder.h
index 6698769e24..2d8871df12 100644
--- a/include/openssl/encoder.h
+++ b/include/openssl/encoder.h
@@ -101,6 +101,8 @@ int OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX *ctx, BIO *out);
#ifndef OPENSSL_NO_STDIO
int OSSL_ENCODER_to_fp(OSSL_ENCODER_CTX *ctx, FILE *fp);
#endif
+int OSSL_ENCODER_to_data(OSSL_ENCODER_CTX *ctx, unsigned char **pdata,
+ size_t *pdata_len);
/*
* Create the OSSL_ENCODER_CTX with an associated type. This will perform