Replaced system SQLite with SQLCipher to support encrypted database
This commit is contained in:
39
Sources/DataLiteC/libtomcrypt/pk/pkcs1/pkcs_1_i2osp.c
Normal file
39
Sources/DataLiteC/libtomcrypt/pk/pkcs1/pkcs_1_i2osp.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
#include "tomcrypt_private.h"
|
||||
|
||||
/**
|
||||
@file pkcs_1_i2osp.c
|
||||
Integer to Octet I2OSP, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef LTC_PKCS_1
|
||||
|
||||
/* always stores the same # of bytes, pads with leading zero bytes
|
||||
as required
|
||||
*/
|
||||
|
||||
/**
|
||||
PKCS #1 Integer to binary
|
||||
@param n The integer to store
|
||||
@param modulus_len The length of the RSA modulus
|
||||
@param out [out] The destination for the integer
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int pkcs_1_i2osp(void *n, unsigned long modulus_len, unsigned char *out)
|
||||
{
|
||||
unsigned long size;
|
||||
|
||||
size = ltc_mp_unsigned_bin_size(n);
|
||||
|
||||
if (size > modulus_len) {
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
/* store it */
|
||||
zeromem(out, modulus_len);
|
||||
return ltc_mp_to_unsigned_bin(n, out+(modulus_len-size));
|
||||
}
|
||||
|
||||
#endif /* LTC_PKCS_1 */
|
||||
|
||||
Reference in New Issue
Block a user