Skip to content

Commit

Permalink
Fix compilation issues in the imported recordmethod.h
Browse files Browse the repository at this point in the history
Also, rename the "new" function pointer to "new_record_layer" to avoid a
C++ reserved name

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #18132)
  • Loading branch information
mattcaswell committed Aug 18, 2022
1 parent 79a1f3e commit 11653dc
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions ssl/record/recordmethod.h
Expand Up @@ -125,30 +125,31 @@ struct ossl_record_method_st {
* TODO: Will have to be something other than SSL_CIPHER if we make this
* fetchable
*/
OSSL_RECORD_LAYER *new(int vers, int role, int direction, int level,
unsigned char *secret, size_t secretlen,
SSL_CIPHER *c, BIO *transport, BIO_ADDR *local,
BIO_ADDR *peer, OSSL_PARAM *settings,
OSSL_PARAM *options);
void free(OSSL_RECORD_LAYER *rl);
OSSL_RECORD_LAYER *(*new_record_layer)(int vers, int role, int direction,
int level, unsigned char *secret,
size_t secretlen, SSL_CIPHER *c,
BIO *transport, BIO_ADDR *local,
BIO_ADDR *peer, OSSL_PARAM *settings,
OSSL_PARAM *options);
void (*free)(OSSL_RECORD_LAYER *rl);

int reset(OSSL_RECORD_LAYER *rl); /* Is this needed? */
int (*reset)(OSSL_RECORD_LAYER *rl); /* Is this needed? */

/* Returns 1 if we have unprocessed data buffered or 0 otherwise */
int unprocessed_read_pending(OSSL_RECORD_LAYER *rl);
int (*unprocessed_read_pending)(OSSL_RECORD_LAYER *rl);
/*
* Returns 1 if we have processed data buffered that can be read or 0 otherwise
* - not necessarily app data
*/
int processed_read_pending(OSSL_RECORD_LAYER *rl);
int (*processed_read_pending)(OSSL_RECORD_LAYER *rl);

/*
* The amount of processed app data that is internally bufferred and
* available to read
*/
size_t app_data_pending(OSSL_RECORD_LAYER *rl);
size_t (*app_data_pending)(OSSL_RECORD_LAYER *rl);

int write_pending(OSSL_RECORD_LAYER *rl);
int (*write_pending)(OSSL_RECORD_LAYER *rl);


/*
Expand All @@ -157,15 +158,15 @@ struct ossl_record_method_st {
* the caller's responsibility to ensure that no record template exceeds
* this maximum when calling write_records.
*/
size_t get_max_record_len(OSSL_RECORD_LAYER *rl);
size_t (*get_max_record_len)(OSSL_RECORD_LAYER *rl);

/*
* Find out the maximum number of records that the record layer is prepared
* to process in a single call to write_records. It is the caller's
* responsibility to ensure that no call to write_records exceeds this
* number of records.
*/
size_t get_max_records(OSSL_RECORD_LAYER *rl);
size_t (*get_max_records)(OSSL_RECORD_LAYER *rl);

/*
* Write |numtempl| records from the array of record templates pointed to
Expand All @@ -192,8 +193,8 @@ struct ossl_record_method_st {
* 0 on retry
* -1 on failure
*/
int write_records(OSSL_RECORD_LAYER *rl, OSSL_RECORD_TEMPLATE **templates,
size_t numtempl, size_t allowance, size_t *sent);
int (*write_records)(OSSL_RECORD_LAYER *rl, OSSL_RECORD_TEMPLATE **templates,
size_t numtempl, size_t allowance, size_t *sent);

/*
* Retry a previous call to write_records. The caller should continue to
Expand All @@ -208,8 +209,8 @@ struct ossl_record_method_st {
* 0 on retry
* -1 on failure
*/
int retry_write_records(OSSL_RECORD_LAYER *rl, size_t allowance,
size_t *sent);
int (*retry_write_records)(OSSL_RECORD_LAYER *rl, size_t allowance,
size_t *sent);

/*
* Read a record and return the record layer version and record type in
Expand All @@ -225,14 +226,14 @@ struct ossl_record_method_st {
* Internally the the OSSL_RECORD_METHOD the implementation may read/process
* multiple records in one go and buffer them.
*/
int read_record(OSSL_RECORD_LAYER *rl, void **rechandle, int *rversion,
int *type, unsigned char **data, size_t *datalen,
uint16_t *epoch, unsigned char *seq_num);
int (*read_record)(OSSL_RECORD_LAYER *rl, void **rechandle, int *rversion,
int *type, unsigned char **data, size_t *datalen,
uint16_t *epoch, unsigned char *seq_num);
/*
* Release a buffer associated with a record previously read with
* read_record. Records are guaranteed to be released in the order that they
* are read.
*/
void release_record(OSSL_RECORD_LAYER *rl, void *rechandle);
void (*release_record)(OSSL_RECORD_LAYER *rl, void *rechandle);

};

0 comments on commit 11653dc

Please sign in to comment.