Changeset 80a0f3f


Ignore:
Timestamp:
Jun 16, 2017 7:28:17 AM (20 months ago)
Author:
Kyle <khaefner@…>
Branches:
master
Children:
8200a9c
Parents:
f495b8e
Message:

initial commit

Files:
130 added
1 edited

Legend:

Unmodified
Added
Removed
  • libabac/abac_openssl.c

    r2e92c62 r80a0f3f  
    88#include <ctype.h>
    99#include <unistd.h>
     10
     11#include <string.h> /* memset */
     12#include <unistd.h> /* close */
    1013
    1114#include <fcntl.h>
     
    414417    int keysize=2048;
    415418
     419    int ret = 0;
     420    RSA *r = NULL;
     421    BIGNUM *bne = NULL;
     422    r = RSA_new();
     423    unsigned long   e = RSA_F4;
     424    bne = BN_new();
     425    ret = BN_set_word(bne,e);
     426    ret = RSA_generate_key_ex(r,keysize,bne, NULL);
     427
    416428    if((pk=EVP_PKEY_new()) == NULL){
    417429        return NULL;
     
    419431
    420432//    RSA *rsa=RSA_generate_key(keysize,RSA_F4,_callback,NULL);
    421     RSA *rsa=RSA_generate_key(keysize,RSA_F4,NULL,NULL);
    422     if (!EVP_PKEY_assign_RSA(pk,rsa)) {
     433    //RSA *rsa=RSA_generate_key_ex(keysize,RSA_F4,NULL,NULL);
     434    if (!EVP_PKEY_assign_RSA(pk,ret)) {
    423435        return NULL;
    424436    }
    425     rsa=NULL;
     437    //ret=NULL;
    426438
    427439    return pk;
     
    609621   X509_NAME_ENTRY *ent=X509_NAME_get_entry(nptr,pos);
    610622   ASN1_STRING *adata=X509_NAME_ENTRY_get_data(ent);
    611    unsigned char *val=ASN1_STRING_data(adata);
     623   const unsigned char *val=ASN1_STRING_get0_data(adata);
    612624   return (char *) val;
    613625}
Note: See TracChangeset for help on using the changeset viewer.