Main Page | Class List | Directories | File List | Class Members | File Members

enc.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "apps.h"
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/rand.h>
#include <openssl/pem.h>
#include <ctype.h>

Go to the source code of this file.

Defines

#define SIZE   (512)
#define BSIZE   (8*1024)
#define PROG   enc_main
#define PROG_NAME_SIZE   39

Functions

int set_hex (char *in, unsigned char *out, int size)
static void show_ciphers (const OBJ_NAME *name, void *bio_)
int MAIN (int, char **)


Define Documentation

#define BSIZE   (8*1024)
 

Definition at line 78 of file enc.c.

#define PROG   enc_main
 

Definition at line 79 of file enc.c.

#define PROG_NAME_SIZE   39
 

#define SIZE   (512)
 

Definition at line 77 of file enc.c.

Referenced by main(), and read_till_nl().


Function Documentation

int MAIN int  ,
char ** 
 

int set_hex char *  in,
unsigned char *  out,
int  size
 

Definition at line 641 of file enc.c.

References BIO_printf().

00642         {
00643         int i,n;
00644         unsigned char j;
00645 
00646         n=strlen(in);
00647         if (n > (size*2))
00648                 {
00649                 BIO_printf(bio_err,"hex string is too long\n");
00650                 return(0);
00651                 }
00652         memset(out,0,size);
00653         for (i=0; i<n; i++)
00654                 {
00655                 j=(unsigned char)*in;
00656                 *(in++)='\0';
00657                 if (j == 0) break;
00658                 if ((j >= '0') && (j <= '9'))
00659                         j-='0';
00660                 else if ((j >= 'A') && (j <= 'F'))
00661                         j=j-'A'+10;
00662                 else if ((j >= 'a') && (j <= 'f'))
00663                         j=j-'a'+10;
00664                 else
00665                         {
00666                         BIO_printf(bio_err,"non-hex digit\n");
00667                         return(0);
00668                         }
00669                 if (i&1)
00670                         out[i/2]|=j;
00671                 else
00672                         out[i/2]=(j<<4);
00673                 }
00674         return(1);
00675         }

static void show_ciphers const OBJ_NAME name,
void *  bio_
[static]
 

Definition at line 81 of file enc.c.

References BIO_printf(), and obj_name_st::name.

00082         {
00083         BIO *bio=bio_;
00084         static int n;
00085 
00086         if(!islower((unsigned char)*name->name))
00087                 return;
00088 
00089         BIO_printf(bio,"-%-25s",name->name);
00090         if(++n == 3)
00091                 {
00092                 BIO_printf(bio,"\n");
00093                 n=0;
00094                 }
00095         else
00096                 BIO_printf(bio," ");
00097         }


© sourcejam.com 2005-2008