Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [agc-netpgp-standalone] src/crypto/external/bsd/netpgp/dist/src/libbn



Module Name:    src
Committed By:   agc
Date:           Sun May  6 17:34:56 UTC 2012

Added Files:
        src/crypto/external/bsd/netpgp/dist/src/libbn [agc-netpgp-standalone]:
            Makefile bignum.c bn.h digest.c digest.h libnetpgpbn.3 misc.c
            misc.h rand.c rand.h stubs.c stubs.h

Log Message:
Add an API-alike equivalent library for openssl BIGNUM functionality.
This is accomplished using the libtommath MPI implementation
internally, without exporting any functions.  All of the BIGNUM
functionality to provide working netpgp signatures, verification,
encryption and encryption is provided.

Functions and macros included:

        BN_is_negative(x)
        BN_is_zero(a)
        BN_is_odd(a)
        BN_is_even(a)

        BIGNUM *BN_new(void);
        BIGNUM *BN_dup(const BIGNUM */*a*/);
        int BN_copy(BIGNUM */*b*/, const BIGNUM */*a*/);

        void BN_init(BIGNUM */*a*/);
        void BN_free(BIGNUM */*a*/);
        void BN_clear(BIGNUM */*a*/);
        void BN_clear_free(BIGNUM */*a*/);

        int BN_cmp(BIGNUM */*a*/, BIGNUM */*b*/);

        BIGNUM *BN_bin2bn(const uint8_t */*buf*/, int /*size*/, BIGNUM */*bn*/);
        int BN_bn2bin(const BIGNUM */*a*/, unsigned char */*b*/);
        char *BN_bn2hex(const BIGNUM */*a*/);
        char *BN_bn2dec(const BIGNUM */*a*/);
        int BN_hex2bn(BIGNUM **/*a*/, const char */*str*/);
        int BN_dec2bn(BIGNUM **/*a*/, const char */*str*/);
        int BN_print_fp(FILE */*fp*/, const BIGNUM */*a*/);

        int BN_add(BIGNUM */*r*/, const BIGNUM */*a*/, const BIGNUM */*b*/);
        int BN_sub(BIGNUM */*r*/, const BIGNUM */*a*/, const BIGNUM */*b*/);
        int BN_mul(BIGNUM */*r*/, const BIGNUM */*a*/, const BIGNUM */*b*/, 
BN_CTX */*ctx*/);
        int BN_div(BIGNUM */*q*/, BIGNUM */*r*/, const BIGNUM */*a*/, const 
BIGNUM */*b*/, BN_CTX */*ctx*/);
        void BN_swap(BIGNUM */*a*/, BIGNUM */*b*/);
        int BN_lshift(BIGNUM */*r*/, const BIGNUM */*a*/, int /*n*/);
        int BN_lshift1(BIGNUM */*r*/, BIGNUM */*a*/);
        int BN_rshift(BIGNUM */*r*/, const BIGNUM */*a*/, int /*n*/);
        int BN_rshift1(BIGNUM */*r*/, BIGNUM */*a*/);
        int BN_set_word(BIGNUM */*a*/, BN_ULONG /*w*/);
        void BN_set_negative(BIGNUM */*a*/, int /*n*/);

        int BN_num_bytes(const BIGNUM */*a*/);
        int BN_num_bits(const BIGNUM */*a*/);

        int BN_mod_exp(BIGNUM */*r*/, BIGNUM */*a*/, BIGNUM */*p*/, BIGNUM 
*/*m*/, BN_CTX */*ctx*/);
        BIGNUM *BN_mod_inverse(BIGNUM */*ret*/, BIGNUM */*a*/, const BIGNUM 
*/*n*/, BN_CTX */*ctx*/);
        int BN_mod_mul(BIGNUM */*ret*/, BIGNUM */*a*/, BIGNUM */*b*/, const 
BIGNUM */*m*/, BN_CTX */*ctx*/);
        int BN_mod_sub(BIGNUM */*r*/, BIGNUM */*a*/, BIGNUM */*b*/, const 
BIGNUM */*m*/, BN_CTX */*ctx*/);

        BN_CTX *BN_CTX_new(void);
        BIGNUM *BN_CTX_get(BN_CTX */*ctx*/);
        void BN_CTX_start(BN_CTX */*ctx*/);
        void BN_CTX_end(BN_CTX */*ctx*/);
        void BN_CTX_init(BN_CTX */*c*/);
        void BN_CTX_free(BN_CTX */*c*/);

        int BN_rand(BIGNUM */*rnd*/, int /*bits*/, int /*top*/, int /*bottom*/);
        int BN_rand_range(BIGNUM */*rnd*/, BIGNUM */*range*/);

        int BN_is_prime(const BIGNUM */*a*/, int /*checks*/, void 
(*callback)(int, int, void *), BN_CTX */*ctx*/, void */*cb_arg*/);

        const BIGNUM *BN_value_one(void);
        int BN_is_bit_set(const BIGNUM */*a*/, int /*n*/);


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 \
    src/crypto/external/bsd/netpgp/dist/src/libbn/Makefile \
    src/crypto/external/bsd/netpgp/dist/src/libbn/bignum.c \
    src/crypto/external/bsd/netpgp/dist/src/libbn/bn.h \
    src/crypto/external/bsd/netpgp/dist/src/libbn/digest.c \
    src/crypto/external/bsd/netpgp/dist/src/libbn/digest.h \
    src/crypto/external/bsd/netpgp/dist/src/libbn/libnetpgpbn.3 \
    src/crypto/external/bsd/netpgp/dist/src/libbn/misc.c \
    src/crypto/external/bsd/netpgp/dist/src/libbn/misc.h \
    src/crypto/external/bsd/netpgp/dist/src/libbn/rand.c \
    src/crypto/external/bsd/netpgp/dist/src/libbn/rand.h \
    src/crypto/external/bsd/netpgp/dist/src/libbn/stubs.c \
    src/crypto/external/bsd/netpgp/dist/src/libbn/stubs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index