]> git.cryptolib.org Git - arm-crypto-lib.git/blobdiff - prf_tls12/prf_tls12.c
first idea of RSA (PKCS#1 v1.5)
[arm-crypto-lib.git] / prf_tls12 / prf_tls12.c
index 8b84d5210db7e868ae1f40a14e3a76b2f82ea6b2..1fb9b728227a3513fa913ce106ffbb45584280df 100644 (file)
@@ -70,9 +70,9 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
-#include <crypto/hashfunction_descriptor.h>
-#include <crypto/hfal-basic.h>
-#include <crypto/hfal-hmac.h>
+#include "hashfunction_descriptor.h"
+#include "hfal-basic.h"
+#include "hfal-hmac.h"
 #include "prf_tls12.h"
 
 uint8_t prf_tls12_init(prf_tls12_ctx_t* ctx, const hfdesc_t* hash,
@@ -133,3 +133,21 @@ uint8_t prf_tls12_next(void* dest, prf_tls12_ctx_t* ctx){
        return 0;
 }
 
+uint8_t prf_tls12_fill(void* dest, uint16_t length_B, prf_tls12_ctx_t* ctx){
+       uint16_t bs = ctx->blocklength_b/8;
+       while(length_B>=bs){
+               if(prf_tls12_next(dest, ctx)){
+                       return 1;
+               }
+               length_B -= bs;
+               dest = (uint8_t*)dest + bs;
+       }
+       if(length_B){
+               uint8_t buffer[bs];
+               if(prf_tls12_next(buffer, ctx)){
+                       return 2;
+               }
+               memcpy(dest, buffer, length_B);
+       }
+       return 0;
+}