added libtomcrypt-0.79
This commit is contained in:
committed by
Steffen Jaeckel
parent
2ef59575df
commit
d5fbe63b70
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Name : ch1-01.c
|
||||
* Purpose : Demonstration of a basic libtomcrypt program
|
||||
* Author : Tom St Denis
|
||||
*
|
||||
* History : v0.79 Initial release
|
||||
*/
|
||||
|
||||
/* ch1-01-1 */
|
||||
/* Include the default headers and libtomcrypt headers */
|
||||
#include <mycrypt.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* ch1-01-1 */
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Name : ch1-02.c
|
||||
* Purpose : Demonstration of error handling
|
||||
* Author : Tom St Denis
|
||||
*
|
||||
* History : v0.79 Initial release
|
||||
*/
|
||||
|
||||
/* ch1-01-1 */
|
||||
#include <mycrypt.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int errno;
|
||||
|
||||
if ((errno = some_func(...)) != CRYPT_OK) {
|
||||
printf("Error: %s\n", error_to_string(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*ch1-01-1 */
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Name : ch1-03.c
|
||||
* Purpose : Demonstration of variable length outputs
|
||||
* Author : Tom St Denis
|
||||
*
|
||||
* History : v0.79 Initial release
|
||||
*/
|
||||
|
||||
/* ch1-01-1 */
|
||||
#include <mycrypt.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned long length;
|
||||
unsigned char buffer[512];
|
||||
int errno;
|
||||
|
||||
length = sizeof(buffer);
|
||||
if ((errno = some_func(..., buffer, &length)) != CRYPT_OK) {
|
||||
printf("Error: %s\n", error_to_string(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("Size of output is %lu bytes\n", length);
|
||||
return 0;
|
||||
}
|
||||
/* ch1-01-1 */
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user