123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- #ifndef CRYPTO_INTERNAL_H_
- #define CRYPTO_INTERNAL_H_
- #include <stdint.h>
- struct crypto_hmac_key {
- size_t len;
- uint8_t * key;
- };
- /**
- * crypto_keys_lookup_RSA(key):
- * Return the requested RSA key.
- */
- void * crypto_keys_lookup_RSA(int);
- /**
- * crypto_keys_lookup_HMAC(key):
- * Return the requested HMAC key.
- */
- struct crypto_hmac_key * crypto_keys_lookup_HMAC(int);
- /**
- * crypto_keys_server_import_root(void):
- * Import the public part of the server root key.
- */
- int crypto_keys_server_import_root(void);
- /**
- * crypto_keys_subr_import_RSA_priv(key, buf, buflen):
- * Import the specified RSA private key from the provided buffer.
- */
- int crypto_keys_subr_import_RSA_priv(void **, const uint8_t *, size_t);
- /**
- * crypto_keys_subr_import_RSA_pub(key, buf, buflen):
- * Import the specified RSA public key from the provided buffer.
- */
- int crypto_keys_subr_import_RSA_pub(void **, const uint8_t *, size_t);
- /**
- * crypto_keys_subr_import_HMAC(key, buf, buflen):
- * Import the specified HMAC key from the provided buffer.
- */
- int crypto_keys_subr_import_HMAC(struct crypto_hmac_key **, const uint8_t *,
- size_t);
- /**
- * crypto_keys_subr_export_RSA_priv(key, buf, buflen):
- * If buf != NULL, export the specified RSA private key. Return the key
- * length in bytes.
- */
- uint32_t crypto_keys_subr_export_RSA_priv(void *, uint8_t *, size_t);
- /**
- * crypto_keys_subr_export_RSA_pub(key, buf, buflen):
- * If buf != NULL, export the specified RSA public key. Return the key
- * length in bytes.
- */
- uint32_t crypto_keys_subr_export_RSA_pub(void *, uint8_t *, size_t);
- /**
- * crypto_keys_subr_export_HMAC(key, buf, buflen):
- * If buf != NULL, export the specified HMAC key. Return the key length
- * in bytes.
- */
- uint32_t crypto_keys_subr_export_HMAC(struct crypto_hmac_key *, uint8_t *,
- size_t);
- /**
- * crypto_keys_subr_generate_RSA(priv, pub):
- * Generate an RSA key and store the private and public parts.
- */
- int crypto_keys_subr_generate_RSA(void **, void **);
- /**
- * crypto_keys_subr_generate_HMAC(key):
- * Generate an HMAC key.
- */
- int crypto_keys_subr_generate_HMAC(struct crypto_hmac_key **);
- /**
- * crypto_keys_subr_free_HMAC(key):
- * Free an HMAC key.
- */
- void crypto_keys_subr_free_HMAC(struct crypto_hmac_key **);
- /**
- * crypto_file_init_keys(void):
- * Initialize the keys cached by crypto_file.
- */
- int crypto_file_init_keys(void);
- /**
- * crypto_keys_init_keycache(void):
- * Initialize the key cache.
- */
- int crypto_keys_init_keycache(void);
- /**
- * crypto_MGF1(seed, seedlen, buf, buflen):
- * The MGF1 mask generation function, as specified in RFC 3447 section B.2.1,
- * using SHA256 as the hash function.
- */
- void crypto_MGF1(uint8_t *, size_t, uint8_t *, size_t);
- #endif /* !CRYPTO_INTERNAL_H_ */
|