1*4f8a354fSEtienne Carriere /* SPDX-License-Identifier: BSD-2-Clause */ 2*4f8a354fSEtienne Carriere /* 3*4f8a354fSEtienne Carriere * Copyright (c) 2017-2020, Linaro Limited 4*4f8a354fSEtienne Carriere */ 5*4f8a354fSEtienne Carriere 6*4f8a354fSEtienne Carriere #ifndef PKCS11_TA_SERIALIZER_H 7*4f8a354fSEtienne Carriere #define PKCS11_TA_SERIALIZER_H 8*4f8a354fSEtienne Carriere 9*4f8a354fSEtienne Carriere #include <stdint.h> 10*4f8a354fSEtienne Carriere #include <stdbool.h> 11*4f8a354fSEtienne Carriere 12*4f8a354fSEtienne Carriere /* 13*4f8a354fSEtienne Carriere * Util routines for serializes unformated arguments in a client memref 14*4f8a354fSEtienne Carriere */ 15*4f8a354fSEtienne Carriere struct serialargs { 16*4f8a354fSEtienne Carriere char *start; 17*4f8a354fSEtienne Carriere char *next; 18*4f8a354fSEtienne Carriere size_t size; 19*4f8a354fSEtienne Carriere }; 20*4f8a354fSEtienne Carriere 21*4f8a354fSEtienne Carriere void serialargs_init(struct serialargs *args, void *in, size_t size); 22*4f8a354fSEtienne Carriere 23*4f8a354fSEtienne Carriere uint32_t serialargs_get(struct serialargs *args, void *out, size_t sz); 24*4f8a354fSEtienne Carriere 25*4f8a354fSEtienne Carriere uint32_t serialargs_get_ptr(struct serialargs *args, void **out, size_t size); 26*4f8a354fSEtienne Carriere 27*4f8a354fSEtienne Carriere uint32_t serialargs_alloc_and_get(struct serialargs *args, 28*4f8a354fSEtienne Carriere void **out, size_t size); 29*4f8a354fSEtienne Carriere 30*4f8a354fSEtienne Carriere bool serialargs_remaining_bytes(struct serialargs *args); 31*4f8a354fSEtienne Carriere 32*4f8a354fSEtienne Carriere #endif /*PKCS11_TA_SERIALIZER_H*/ 33