crypto/ringlwe/ringlwe_key.c
/* Allocate and deallocate reconciliation data structure */
Allocate and deallocate reconciliation data structure
Allocate and deallocate reconciliation data structure
RLWE_REC *RLWE_REC_new(uint32_t muwords) {
  RLWE_REC *rec;
  if (muwords == 0) {
    RINGLWEerr(RINGLWE_F_RLWE_REC_NEW, ERR_R_PASSED_NULL_PARAMETER);
    return (NULL);
  }
  rec = (RLWE_REC *)OPENSSL_malloc(sizeof(RLWE_REC));
  if (rec == NULL) {
    RINGLWEerr(RINGLWE_F_RLWE_REC_NEW, ERR_R_MALLOC_FAILURE);
    return (NULL);
  }
  rec->muwords = muwords;
  rec->c = (uint64_t *) OPENSSL_malloc(muwords * sizeof(uint64_t));
  if (rec->c == NULL) {
    RINGLWEerr(RINGLWE_F_RLWE_REC_NEW, ERR_R_MALLOC_FAILURE);
    RLWE_REC_free(rec);
    return (NULL);
  }
  return rec;
}
RLWE_REC * RLWE_REC_new ( uint32_t muwords ) { RLWE_REC * rec ; if ( muwords == 0 ) { RINGLWEerr ( RINGLWE_F_RLWE_REC_NEW , ERR_R_PASSED_NULL_PARAMETER ) ; return ( NULL ) ; } rec = ( RLWE_REC * ) OPENSSL_malloc ( sizeof ( RLWE_REC ) ) ; if ( rec == NULL ) { RINGLWEerr ( RINGLWE_F_RLWE_REC_NEW , ERR_R_MALLOC_FAILURE ) ; return ( NULL ) ; } rec -> muwords = muwords ; rec -> c = ( uint64_t * ) OPENSSL_malloc ( muwords * sizeof ( uint64_t ) ) ; if ( rec -> c == NULL ) { RINGLWEerr ( RINGLWE_F_RLWE_REC_NEW , ERR_R_MALLOC_FAILURE ) ; RLWE_REC_free ( rec ) ; return ( NULL ) ; } return rec ; }
Allocate and deallocate reconciliation data structure
Allocate and deallocate reconciliation data structure