gwenhywfar  5.11.1beta
Functions
padd.h File Reference
#include <gwenhywfar/buffer.h>
#include <gwenhywfar/paddalgo.h>
#include <gwenhywfar/mdigest.h>

Go to the source code of this file.

Functions

GWENHYWFAR_API int GWEN_Padd_AddPkcs1Pss (uint8_t *pDestBuffer, uint32_t lDestBuffer, uint32_t nbits, const uint8_t *pHash, uint32_t lHash, uint32_t lSalt, GWEN_MDIGEST *md)
 
GWENHYWFAR_API int GWEN_Padd_ApplyPaddAlgo (const GWEN_CRYPT_PADDALGO *a, GWEN_BUFFER *src)
 
GWENHYWFAR_API int GWEN_Padd_MGF1 (uint8_t *pDestBuffer, uint32_t lDestBuffer, const uint8_t *pSeed, uint32_t lSeed, GWEN_MDIGEST *md)
 
GWENHYWFAR_API int GWEN_Padd_PaddWithAnsiX9_23 (GWEN_BUFFER *src)
 
GWENHYWFAR_API int GWEN_Padd_PaddWithAnsiX9_23ToMultipleOf (GWEN_BUFFER *src, int y)
 
GWENHYWFAR_API int GWEN_Padd_PaddWithISO9796 (GWEN_BUFFER *src)
 
GWENHYWFAR_API int GWEN_Padd_PaddWithIso9796_2 (GWEN_BUFFER *buf, int dstSize)
 
GWENHYWFAR_API int GWEN_Padd_PaddWithPkcs1Bt1 (GWEN_BUFFER *src, int dstSize)
 
GWENHYWFAR_API int GWEN_Padd_PaddWithPkcs1Bt2 (GWEN_BUFFER *src, int dstSize)
 
GWENHYWFAR_API int GWEN_Padd_PaddWithZka (GWEN_BUFFER *src)
 
GWENHYWFAR_API int GWEN_Padd_PaddWithZkaToMultipleOf (GWEN_BUFFER *src, int y)
 
GWENHYWFAR_API int GWEN_Padd_UnapplyPaddAlgo (const GWEN_CRYPT_PADDALGO *a, GWEN_BUFFER *buf)
 
GWENHYWFAR_API int GWEN_Padd_UnpaddWithAnsiX9_23 (GWEN_BUFFER *src)
 
GWENHYWFAR_API int GWEN_Padd_UnpaddWithAnsiX9_23FromMultipleOf (GWEN_BUFFER *src, int y)
 
GWENHYWFAR_API int GWEN_Padd_UnpaddWithIso9796_2 (GWEN_BUFFER *buf)
 
GWENHYWFAR_API int GWEN_Padd_UnpaddWithPkcs1Bt1 (GWEN_BUFFER *src)
 
GWENHYWFAR_API int GWEN_Padd_UnpaddWithPkcs1Bt2 (GWEN_BUFFER *src)
 
GWENHYWFAR_API int GWEN_Padd_UnpaddWithZka (GWEN_BUFFER *buf)
 
GWENHYWFAR_API int GWEN_Padd_UnpaddWithZkaFromMultipleOf (GWEN_BUFFER *buf, int y)
 
GWENHYWFAR_API int GWEN_Padd_VerifyPkcs1Pss (const uint8_t *pSrcBuffer, uint32_t lSrcBuffer, uint32_t nbits, const uint8_t *pHash, uint32_t lHash, uint32_t lSalt, GWEN_MDIGEST *md)
 

Function Documentation

◆ GWEN_Padd_AddPkcs1Pss()

GWENHYWFAR_API int GWEN_Padd_AddPkcs1Pss ( uint8_t *  pDestBuffer,
uint32_t  lDestBuffer,
uint32_t  nbits,
const uint8_t *  pHash,
uint32_t  lHash,
uint32_t  lSalt,
GWEN_MDIGEST md 
)
Parameters
nbitsnumber of actual bits of the modulus

◆ GWEN_Padd_ApplyPaddAlgo()

GWENHYWFAR_API int GWEN_Padd_ApplyPaddAlgo ( const GWEN_CRYPT_PADDALGO a,
GWEN_BUFFER src 
)

◆ GWEN_Padd_MGF1()

GWENHYWFAR_API int GWEN_Padd_MGF1 ( uint8_t *  pDestBuffer,
uint32_t  lDestBuffer,
const uint8_t *  pSeed,
uint32_t  lSeed,
GWEN_MDIGEST md 
)

◆ GWEN_Padd_PaddWithAnsiX9_23()

GWENHYWFAR_API int GWEN_Padd_PaddWithAnsiX9_23 ( GWEN_BUFFER src)

This is a compatibility function (calls GWEN_Padd_PaddWithAnsiX9_23ToMultipleOf with param y=8).

◆ GWEN_Padd_PaddWithAnsiX9_23ToMultipleOf()

GWENHYWFAR_API int GWEN_Padd_PaddWithAnsiX9_23ToMultipleOf ( GWEN_BUFFER src,
int  y 
)

This function is used to pad the plain text data to a multiple of 8 bytes size before encrypting it. This is done by adding bytes to the buffer until its length is multiple of Y bytes. The byte added is the number of padding bytes appended. Example: Y is 8, buffer initially contains 5 bytes, so 3 bytes are needed to make the buffer length a multiple of 8. So the number "3" is added three times. Please note that if the buffer initially has a multiple of Y bytes then Y bytes are added (this is needed to make sure the unpadd function can always recover data padded in this manner).

◆ GWEN_Padd_PaddWithISO9796()

GWENHYWFAR_API int GWEN_Padd_PaddWithISO9796 ( GWEN_BUFFER src)

This function padds the given buffer according to ISO9796. The given buffer is expected to contain a 20 byte hash created using RIPEMD 160. This is padded to 96 bytes according to ISO 9796 (including appendix A4).

◆ GWEN_Padd_PaddWithIso9796_2()

GWENHYWFAR_API int GWEN_Padd_PaddWithIso9796_2 ( GWEN_BUFFER buf,
int  dstSize 
)

This function padds according to ISO 8786-2.

◆ GWEN_Padd_PaddWithPkcs1Bt1()

GWENHYWFAR_API int GWEN_Padd_PaddWithPkcs1Bt1 ( GWEN_BUFFER src,
int  dstSize 
)

◆ GWEN_Padd_PaddWithPkcs1Bt2()

GWENHYWFAR_API int GWEN_Padd_PaddWithPkcs1Bt2 ( GWEN_BUFFER src,
int  dstSize 
)

◆ GWEN_Padd_PaddWithZka()

GWENHYWFAR_API int GWEN_Padd_PaddWithZka ( GWEN_BUFFER src)

◆ GWEN_Padd_PaddWithZkaToMultipleOf()

GWENHYWFAR_API int GWEN_Padd_PaddWithZkaToMultipleOf ( GWEN_BUFFER src,
int  y 
)

◆ GWEN_Padd_UnapplyPaddAlgo()

GWENHYWFAR_API int GWEN_Padd_UnapplyPaddAlgo ( const GWEN_CRYPT_PADDALGO a,
GWEN_BUFFER buf 
)

◆ GWEN_Padd_UnpaddWithAnsiX9_23()

GWENHYWFAR_API int GWEN_Padd_UnpaddWithAnsiX9_23 ( GWEN_BUFFER src)

This is a compatibility function (calls GWEN_Padd_UnpaddWithAnsiX9_23FromMultipleOf with param y=8).

◆ GWEN_Padd_UnpaddWithAnsiX9_23FromMultipleOf()

GWENHYWFAR_API int GWEN_Padd_UnpaddWithAnsiX9_23FromMultipleOf ( GWEN_BUFFER src,
int  y 
)

This function is used to remove padding from plain text data after decrypting it.

◆ GWEN_Padd_UnpaddWithIso9796_2()

GWENHYWFAR_API int GWEN_Padd_UnpaddWithIso9796_2 ( GWEN_BUFFER buf)

◆ GWEN_Padd_UnpaddWithPkcs1Bt1()

GWENHYWFAR_API int GWEN_Padd_UnpaddWithPkcs1Bt1 ( GWEN_BUFFER src)

◆ GWEN_Padd_UnpaddWithPkcs1Bt2()

GWENHYWFAR_API int GWEN_Padd_UnpaddWithPkcs1Bt2 ( GWEN_BUFFER src)

◆ GWEN_Padd_UnpaddWithZka()

GWENHYWFAR_API int GWEN_Padd_UnpaddWithZka ( GWEN_BUFFER buf)

◆ GWEN_Padd_UnpaddWithZkaFromMultipleOf()

GWENHYWFAR_API int GWEN_Padd_UnpaddWithZkaFromMultipleOf ( GWEN_BUFFER buf,
int  y 
)

◆ GWEN_Padd_VerifyPkcs1Pss()

GWENHYWFAR_API int GWEN_Padd_VerifyPkcs1Pss ( const uint8_t *  pSrcBuffer,
uint32_t  lSrcBuffer,
uint32_t  nbits,
const uint8_t *  pHash,
uint32_t  lHash,
uint32_t  lSalt,
GWEN_MDIGEST md 
)